-
Notifications
You must be signed in to change notification settings - Fork 130
feat: bumps autocomplete element package, updates API #1050
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
32 commits
Select commit
Hold shift + click to select a range
42bcfec
chore: bumps autocomplete element package to 3.1.0
lindseywild 324d0f0
chore: updates changelog
lindseywild ce0ed9f
feat: updates autocomplete api to match web component
lindseywild 258d73d
docs: build docs
actions-user 1f85564
fix: removes extra file changes
lindseywild 04daed1
Work in progress adding input back in with restrictions
owenniblock 7ef4773
Fixes tests and auto_complete template
owenniblock 0ebdfbd
fix: updates api, writes tests
lindseywild 8e34c9f
docs: build docs
actions-user 70b8227
Update app/components/primer/beta/auto_complete.rb
owenniblock 391b2d5
Fix restrictions on autocomplete input and fix tests
owenniblock fd7647b
docs: build docs
actions-user ab0e63f
* explicitly deny name and id on input slot
khiga8 b017638
* move test to beta folder and add test for deny
khiga8 c691edf
Add optional input_name parameter to new AutoComplete component
owenniblock 40de4d0
docs: build docs
actions-user 613ed34
* update deny message for name
khiga8 fb77d81
* update test name message
khiga8 fcf33d4
Merge branch 'main' into update-auto-complete-package
khiga8 fe1a356
* yarn upgrade @primer/css
khiga8 881306b
* bump primer/css dependency in docs
khiga8 d35cc72
* bump primer/css dependency in demo
khiga8 cb2b04a
* add stacked and inline classes and body wrapper
khiga8 8cf51b7
* add example descriptions and re-order by importance
khiga8 e0c7626
* add link to accessibility section
khiga8 cf8cfd5
* remove position: relative in examples
khiga8 bd0aa45
feat: adds wrapping div, restricts to search icon, tests
lindseywild 78360cc
docs: build docs
actions-user 5c6b176
Merge branch 'main' into update-auto-complete-package
khiga8 6608793
chore: cleanup
lindseywild d858a03
docs: build docs
actions-user d222125
Merge branch 'main' into update-auto-complete-package
khiga8 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 16 additions & 6 deletions
22
app/components/primer/beta/auto_complete/auto_complete.html.erb
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,14 +1,24 @@ | ||
| <%= render Primer::BaseComponent.new(**@system_arguments) do %> | ||
| <label for="<%= @input_id %>"> | ||
| <label for="<%= @input_id %>" class="<%= @label_classes %>"> | ||
| <% if @is_label_visible %> | ||
| <%= @label_text %> | ||
| <% else %> | ||
| <span class="sr-only"><%= @label_text %></span> | ||
| <% end %> | ||
| <% if icon.present? %> | ||
| <%= icon %> | ||
| <% end %> | ||
| </label> | ||
| <input id="<%= @input_id %>" name="<%= @input_id %>" type="text" class="form-control" autocomplete="off"> | ||
| <%= results %> | ||
| <span class="autocomplete-body"> | ||
| <% if @with_icon %> | ||
| <div class="form-control autocomplete-embedded-icon-wrap"> | ||
| <%= render Primer::OcticonComponent.new(:search) %> | ||
| <% end %> | ||
| <%= input %> | ||
| <% if @is_clearable %> | ||
| <button id="<%= @input_id %>-clear" class="btn-octicon" aria-label="Clear"><%= primer_octicon "x" %></button> | ||
| <% end %> | ||
| <% if @with_icon %> | ||
| </div> | ||
| <% end %> | ||
| <%= results %> | ||
| </span> | ||
| <div id="<%= @list_id %>-feedback" class="sr-only"></div> | ||
| <% end %> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 7 additions & 5 deletions
12
demo/test/components/previews/primer/auto_complete_preview.rb
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,17 +1,19 @@ | ||
| module Primer | ||
| class AutoCompletePreview < ViewComponent::Preview | ||
| def default | ||
| render(Primer::Beta::AutoComplete.new(label_text: "Select a fruit", input_id: "input-id", list_id: "test-id", src: "/auto_complete", position: :relative)) | ||
| render(Primer::Beta::AutoComplete.new(label_text: "Select a fruit", input_id: "input-id", list_id: "test-id", src: "/auto_complete")) | ||
| end | ||
|
|
||
| def with_non_visible_label | ||
| render(Primer::Beta::AutoComplete.new(label_text: "Select a fruit", input_id: "input-id", list_id: "test-id", src: "/auto_complete", is_label_visible: false, position: :relative)) | ||
| render(Primer::Beta::AutoComplete.new(label_text: "Select a fruit", input_id: "input-id", list_id: "test-id", src: "/auto_complete", is_label_visible: false)) | ||
| end | ||
|
|
||
| def with_icon | ||
| render(Primer::Beta::AutoComplete.new(label_text: "Select a fruit", input_id: "input-id", list_id: "test-id", src: "/auto_complete", position: :relative)) do |c| | ||
| c.icon(icon: :search) | ||
| end | ||
| render(Primer::Beta::AutoComplete.new(label_text: "Select a fruit", input_id: "input-id", list_id: "test-id", src: "/auto_complete", with_icon: true)) | ||
| end | ||
|
|
||
| def with_clear_button | ||
| render(Primer::Beta::AutoComplete.new(label_text: "Select a fruit", input_id: "input-id", list_id: "test-id", src: "/auto_complete", is_clearable: true)) | ||
| end | ||
| end | ||
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.