Skip to content

Commit

Permalink
Merge branch 'main' into eager_load_forms
Browse files Browse the repository at this point in the history
  • Loading branch information
camertron committed Sep 23, 2024
2 parents 1958f1e + 3fa6eb9 commit be92278
Show file tree
Hide file tree
Showing 81 changed files with 534 additions and 172 deletions.
6 changes: 6 additions & 0 deletions .changeset/chatty-apples-hope.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@primer/view-components': minor
---

[SelectPanel] replace loading label using parameter loading_label
[SelectPanel] show additional loading content with loading_description
5 changes: 5 additions & 0 deletions .changeset/sweet-donkeys-allow.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@primer/view-components': patch
---

Clear input on SelectPanel when dialog closed
4 changes: 2 additions & 2 deletions .erb-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ linters:
Enabled: false
Exclude:
- app/components/primer/layout_component.html.erb
Primer/Migrations/IconButtonComponent:
Migrations/IconButtonComponent:
Enabled: true
Primer/Migrations/TruncateComponent:
Migrations/TruncateComponent:
Enabled: true
10 changes: 2 additions & 8 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,11 @@ jobs:
demo/**/*.rb
test/**/*.rb
- uses: ruby/setup-ruby@v1
if: steps.changed-files.outputs.any_changed == 'true'
with:
ruby-version: '3.3'
bundler-cache: true
- name: Lint with Rubocop
if: steps.changed-files.outputs.any_changed == 'true'
run: |
bundle exec rubocop ${{ steps.changed-files.outputs.all_changed_files }} --format github
run: script/rubocop --format github

erblint:
runs-on: ubuntu-latest
Expand All @@ -67,14 +64,11 @@ jobs:
files: |
app/components/**/*.erb
- uses: ruby/setup-ruby@v1
if: steps.changed-files.outputs.any_changed == 'true'
with:
ruby-version: '3.3'
bundler-cache: true
- name: Lint with ERB Lint
if: steps.changed-files.outputs.any_changed == 'true'
run: |
bundle exec erblint ${{ steps.changed-files.outputs.all_changed_files }} --format github
run: script/erblint --format github

eslint:
runs-on: ubuntu-latest
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ jobs:
- name: Run Playwright tests
id: playwright-run
continue-on-error: true
run: npx playwright test --workers 6
run: ./script/run-playwright
- id: auto-commit
uses: stefanzweifel/git-auto-commit-action@v5
with:
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 3 additions & 3 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ group :development do
gem "capybara", "~> 3.40.0"
gem "cuprite", "~> 0.15"
gem "debug"
gem "erb_lint", "~> 0.5.0"
gem "erblint-github", "~> 0.5.1"
gem "erb_lint", "~> 0.6"
gem "erblint-github", "~> 1.0"
gem "listen", "~> 3.9"
gem "matrix", "~> 0.4.2"
gem "mocha"
Expand All @@ -63,7 +63,7 @@ group :development do
gem "rubocop-github", "~> 0.20.0"
gem "rubocop-performance"
gem "rubocop-rails"
gem "rubocop-rails-accessibility", "~> 0.2.0"
gem "rubocop-rails-accessibility", "~> 1.0"
gem "selenium-webdriver", "~> 4.18"
gem "simplecov", "~> 0.22.0"
gem "simplecov-console", "~> 0.9.1"
Expand Down
35 changes: 16 additions & 19 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -85,14 +85,14 @@ GEM
docile (1.4.0)
drb (2.2.1)
dry-cli (1.1.0)
erb_lint (0.5.0)
erb_lint (0.6.0)
activesupport
better_html (>= 2.0.1)
parser (>= 2.7.1.4)
rainbow
rubocop
rubocop (>= 1)
smart_properties
erblint-github (0.5.1)
erblint-github (1.0.1)
erubi (1.13.0)
ferrum (0.14)
addressable (~> 2.5)
Expand All @@ -103,7 +103,7 @@ GEM
hashdiff (1.1.0)
htmlbeautifier (1.4.3)
htmlentities (4.3.4)
i18n (1.14.5)
i18n (1.14.6)
concurrent-ruby (~> 1.0)
io-console (0.7.2)
irb (1.14.0)
Expand Down Expand Up @@ -148,8 +148,8 @@ GEM
nokogiri (1.16.7-x86_64-linux)
racc (~> 1.4)
octicons (19.9.0)
parallel (1.24.0)
parser (3.3.2.0)
parallel (1.26.3)
parser (3.3.5.0)
ast (~> 2.4.1)
racc
pry (0.14.2)
Expand Down Expand Up @@ -199,21 +199,19 @@ GEM
regexp_parser (2.9.2)
reline (0.5.10)
io-console (~> 0.5)
rexml (3.2.8)
strscan (>= 3.0.9)
rexml (3.3.7)
rouge (4.2.1)
rubocop (1.64.1)
rubocop (1.66.1)
json (~> 2.3)
language_server-protocol (>= 3.17.0)
parallel (~> 1.10)
parser (>= 3.3.0.2)
rainbow (>= 2.2.2, < 4.0)
regexp_parser (>= 1.8, < 3.0)
rexml (>= 3.2.5, < 4.0)
rubocop-ast (>= 1.31.1, < 2.0)
regexp_parser (>= 2.4, < 3.0)
rubocop-ast (>= 1.32.2, < 2.0)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 2.4.0, < 3.0)
rubocop-ast (1.31.3)
rubocop-ast (1.32.3)
parser (>= 3.3.1.0)
rubocop-github (0.20.0)
rubocop (>= 1.37)
Expand All @@ -227,7 +225,7 @@ GEM
rack (>= 1.1)
rubocop (>= 1.33.0, < 2.0)
rubocop-ast (>= 1.31.1, < 2.0)
rubocop-rails-accessibility (0.2.0)
rubocop-rails-accessibility (1.0.1)
rubocop (>= 1.0.0)
ruby-progressbar (1.13.0)
ruby2_keywords (0.0.5)
Expand Down Expand Up @@ -257,14 +255,13 @@ GEM
activesupport (>= 5.2)
sprockets (>= 3.0.0)
stringio (3.1.1)
strscan (3.1.0)
terminal-table (3.0.2)
unicode-display_width (>= 1.1.1, < 3)
thor (1.3.2)
timecop (0.9.9)
tzinfo (2.0.6)
concurrent-ruby (~> 1.0)
unicode-display_width (2.5.0)
unicode-display_width (2.6.0)
view_component (3.12.1)
activesupport (>= 5.2.0, < 8.0)
concurrent-ruby (~> 1.0)
Expand Down Expand Up @@ -305,8 +302,8 @@ DEPENDENCIES
cssbundling-rails (~> 1.4)
cuprite (~> 0.15)
debug
erb_lint (~> 0.5.0)
erblint-github (~> 0.5.1)
erb_lint (~> 0.6)
erblint-github (~> 1.0)
kramdown (~> 2.4)
listen (~> 3.9)
lookbook (~> 2.3.1)
Expand All @@ -322,7 +319,7 @@ DEPENDENCIES
rubocop-github (~> 0.20.0)
rubocop-performance
rubocop-rails
rubocop-rails-accessibility (~> 0.2.0)
rubocop-rails-accessibility (~> 1.0)
selenium-webdriver (~> 4.18)
simplecov (~> 0.22.0)
simplecov-console (~> 0.9.1)
Expand Down
4 changes: 2 additions & 2 deletions Procfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
vite: cd demo; bin/vite dev
css: cd demo; npm run build:css -- --watch
vite: cd demo; script/start-vite
css: cd demo; script/start-css
web: cd demo; bin/rails s -p 4000
5 changes: 4 additions & 1 deletion app/components/primer/alpha/select_panel.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,10 @@
classes: "SelectPanel-loadingPanel"
)) do %>
<div data-hide-on-error>
<%= render Primer::Beta::Spinner.new(aria: { label: "Loading content..." }, data: { target: "select-panel.bodySpinner" }) %>
<%= render Primer::Beta::Spinner.new(aria: { label: @loading_label, describedby: @loading_description_id }, data: { target: "select-panel.bodySpinner" }) %>
<% if @loading_description.present? %>
<div id="<%= @loading_description_id %>" aria-hidden="true"><%= @loading_description %></div>
<% end %>
</div>
<div data-show-on-error hidden data-target="select-panel.fragmentErrorElement">
<% if preload_error_content? %>
Expand Down
10 changes: 10 additions & 0 deletions app/components/primer/alpha/select_panel.rb
Original file line number Diff line number Diff line change
Expand Up @@ -380,6 +380,8 @@ def with_avatar_item(**system_arguments)
# @param open_on_load [Boolean] Open the panel when the page loads.
# @param anchor_align [Symbol] The anchor alignment of the Overlay. <%= one_of(Primer::Alpha::Overlay::ANCHOR_ALIGN_OPTIONS) %>
# @param anchor_side [Symbol] The side to anchor the Overlay to. <%= one_of(Primer::Alpha::Overlay::ANCHOR_SIDE_OPTIONS) %>
# @param loading_label [String] The aria-label to use when the panel is loading, defaults to 'Loading content...'.
# @param loading_description [String] The description to use when the panel is loading. If not provided, no description will be used.
# @param banner_scheme [Symbol] The scheme for the error banner <%= one_of(Primer::Alpha::SelectPanel::BANNER_SCHEME_OPTIONS) %>
# @param system_arguments [Hash] <%= link_to_system_arguments_docs %>
def initialize(
Expand All @@ -401,6 +403,8 @@ def initialize(
open_on_load: false,
anchor_align: Primer::Alpha::Overlay::DEFAULT_ANCHOR_ALIGN,
anchor_side: Primer::Alpha::Overlay::DEFAULT_ANCHOR_SIDE,
loading_label: "Loading content...",
loading_description: nil,
banner_scheme: DEFAULT_BANNER_SCHEME,
**system_arguments
)
Expand All @@ -423,6 +427,12 @@ def initialize(
@dynamic_label = dynamic_label
@dynamic_label_prefix = dynamic_label_prefix
@dynamic_aria_label_prefix = dynamic_aria_label_prefix
@loading_label = loading_label
@loading_description_id = nil
if loading_description.present?
@loading_description_id = "#{@panel_id}-loading-description"
end
@loading_description = loading_description
@banner_scheme = fetch_or_fallback(BANNER_SCHEME_OPTIONS, banner_scheme, DEFAULT_BANNER_SCHEME)

@system_arguments = deny_tag_argument(**system_arguments)
Expand Down
8 changes: 7 additions & 1 deletion app/components/primer/alpha/select_panel_element.ts
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ export class SelectPanelElement extends HTMLElement {
updateAnchorPosition() {
// If the selectPanel is removed from the screen on resize close the dialog
if (this && this.offsetParent === null) {
this.dialog.close()
this.hide()
}

if (this.invokerElement) {
Expand Down Expand Up @@ -464,6 +464,12 @@ export class SelectPanelElement extends HTMLElement {
// Remove data-ready so it can be set the next time the panel is opened
this.dialog.removeAttribute('data-ready')
this.invokerElement?.setAttribute('aria-expanded', 'false')
// When we close the dialog, clear the filter input
const fireSearchEvent = this.filterInputTextField.value.length > 0
this.filterInputTextField.value = ''
if (fireSearchEvent) {
this.filterInputTextField.dispatchEvent(new Event('input'))
}

this.dispatchEvent(
new CustomEvent('panelClosed', {
Expand Down
2 changes: 1 addition & 1 deletion app/components/primer/base_component.rb
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ class BaseComponent < Primer::Component
# | `pb` | Integer | Padding bottom. <%= one_of(Primer::Classify::Utilities.mappings(:pb)) %> |
# | `pl` | Integer | Padding left. <%= one_of(Primer::Classify::Utilities.mappings(:pl)) %> |
# | `pr` | Integer | Padding right. <%= one_of(Primer::Classify::Utilities.mappings(:pr)) %> |
# | `pt` | Integer | Padding left. <%= one_of(Primer::Classify::Utilities.mappings(:pt)) %> |
# | `pt` | Integer | Padding top. <%= one_of(Primer::Classify::Utilities.mappings(:pt)) %> |
# | `px` | Integer | Horizontal padding. <%= one_of(Primer::Classify::Utilities.mappings(:px)) %> |
# | `py` | Integer | Vertical padding. <%= one_of(Primer::Classify::Utilities.mappings(:py)) %> |
#
Expand Down
1 change: 0 additions & 1 deletion app/lib/primer/forms/select.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,3 @@
<%= builder.select(@input.name, options, @input.select_arguments, **@input.input_arguments) %>
<% end %>
<% end %>

2 changes: 1 addition & 1 deletion demo/Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ end
eval_gemfile "gemfiles/kuby.gemfile"

# Use Puma as the app server
gem "puma", "~> 6.4.2"
gem "puma", "~> 6.4.3"

# Reduces boot times through caching; required in config/boot.rb
gem "bootsnap", ">= 1.4.2", require: false
Expand Down
24 changes: 10 additions & 14 deletions demo/Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,6 @@ GEM
erubi (~> 1.11)
rails-dom-testing (~> 2.2)
rails-html-sanitizer (~> 1.6)
activejob (7.1.3.2)
activesupport (= 7.1.3.2)
globalid (>= 0.3.6)
activemodel (7.1.3.2)
activesupport (= 7.1.3.2)
activesupport (7.1.3.2)
Expand Down Expand Up @@ -99,14 +96,14 @@ GEM
faraday-patron (1.0.0)
faraday-rack (1.0.0)
faraday-retry (1.0.3)
ffi (1.16.3)
ffi (1.17.0-arm64-darwin)
ffi (1.17.0-x86_64-darwin)
ffi (1.17.0-x86_64-linux-gnu)
ffi-compiler (1.3.2)
ffi (>= 1.15.5)
rake
foreman (0.88.1)
gli (2.21.1)
globalid (1.2.1)
activesupport (>= 6.1)
google-cloud-env (2.1.1)
faraday (>= 1.0, < 3.a)
googleauth (1.11.0)
Expand All @@ -121,7 +118,7 @@ GEM
helm-rb (0.2.1-arm64-darwin)
helm-rb (0.2.1-x86_64-darwin)
helm-rb (0.2.1-x86_64-linux)
hotwire-livereload (1.4.0)
hotwire-livereload (1.4.1)
actioncable (>= 6.0.0)
listen (>= 3.0.0)
railties (>= 6.0.0)
Expand All @@ -137,7 +134,7 @@ GEM
http-cookie (1.0.5)
domain_name (~> 0.5)
http-form_data (2.3.0)
i18n (1.14.5)
i18n (1.14.6)
concurrent-ruby (~> 1.0)
importmap-rails (2.0.1)
actionpack (>= 6.0.0)
Expand Down Expand Up @@ -261,7 +258,7 @@ GEM
psych (5.1.2)
stringio
public_suffix (6.0.0)
puma (6.4.2)
puma (6.4.3)
nio4r (~> 2.0)
racc (1.8.1)
rack (3.1.7)
Expand Down Expand Up @@ -293,7 +290,7 @@ GEM
zeitwerk (~> 2.6)
rake (13.2.1)
rb-fsevent (0.11.2)
rb-inotify (0.10.1)
rb-inotify (0.11.1)
ffi (~> 1.0)
rdoc (6.7.0)
psych (>= 4.0.0)
Expand Down Expand Up @@ -330,13 +327,12 @@ GEM
stringio (3.1.1)
thor (1.3.2)
timeliness (0.3.10)
turbo-rails (2.0.6)
turbo-rails (2.0.10)
actionpack (>= 6.0.0)
activejob (>= 6.0.0)
railties (>= 6.0.0)
tzinfo (2.0.6)
concurrent-ruby (~> 1.0)
view_component (3.13.0)
view_component (3.14.0)
activesupport (>= 5.2.0, < 8.0)
concurrent-ruby (~> 1.0)
method_source (~> 1.0)
Expand Down Expand Up @@ -381,7 +377,7 @@ DEPENDENCIES
lookbook (~> 2.3.2)
primer_view_components!
pry-byebug
puma (~> 6.4.2)
puma (~> 6.4.3)
rack-cors
railties (= 7.1.3.2)
rake (~> 13.2)
Expand Down
4 changes: 4 additions & 0 deletions demo/script/start-css
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#! /bin/bash

echo $$ > tmp/pids/css.pid
exec npm run build:css -- --watch
4 changes: 4 additions & 0 deletions demo/script/start-vite
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#! /bin/bash

echo $$ > tmp/pids/vite.pid
exec bin/vite dev
Loading

0 comments on commit be92278

Please sign in to comment.