Skip to content

Commit

Permalink
Merge pull request #137 from opf/bump/primer-upstream
Browse files Browse the repository at this point in the history
Bump/primer upstream 0.27.0
  • Loading branch information
HDinger authored Jul 3, 2024
2 parents 2dc4f18 + c249cfd commit e9981ee
Show file tree
Hide file tree
Showing 47 changed files with 627 additions and 1,461 deletions.
5 changes: 5 additions & 0 deletions .changeset/forty-ways-grab.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@openproject/primer-view-components': minor
---

Change ActionMenu to accept and forward overlay arguments
5 changes: 5 additions & 0 deletions .changeset/short-ligers-smile.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@openproject/primer-view-components': patch
---

Update ActionList such that if role='listbox' is passed in the items render as options
5 changes: 5 additions & 0 deletions .changeset/tough-otters-sniff.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@openproject/primer-view-components': patch
---

Add a valid selector to focus-group
10 changes: 5 additions & 5 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
- uses: actions/checkout@v4
- name: Get specific changed files
id: changed-files
uses: tj-actions/changed-files@v44.5.2
uses: tj-actions/changed-files@v44.5.4
with:
files: |
docs/**/*.md
Expand All @@ -39,7 +39,7 @@ jobs:
- uses: actions/checkout@v4
- name: Get specific changed files
id: changed-files
uses: tj-actions/changed-files@v44.5.2
uses: tj-actions/changed-files@v44.5.4
with:
files: |
app/**/*.rb
Expand All @@ -62,7 +62,7 @@ jobs:
- uses: actions/checkout@v4
- name: Get changed files
id: changed-files
uses: tj-actions/changed-files@v44.5.2
uses: tj-actions/changed-files@v44.5.4
with:
files: |
app/components/**/*.erb
Expand All @@ -82,7 +82,7 @@ jobs:
- uses: actions/checkout@v4
- name: Get changed files
id: changed-files
uses: tj-actions/changed-files@v44.5.2
uses: tj-actions/changed-files@v44.5.4
with:
files: |
app/components/**/*.ts
Expand All @@ -103,7 +103,7 @@ jobs:
- uses: actions/checkout@v4
- name: Get changed files
id: changed-files
uses: tj-actions/changed-files@v44.5.2
uses: tj-actions/changed-files@v44.5.4
with:
files: |
app/components/**/*.pcss
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release-canary.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
release-canary:
name: npm
if: ${{ github.repository == 'opf/primer_view_components' }}
uses: primer/.github/.github/workflows/release_canary.yml@v2.1.0
uses: primer/.github/.github/workflows/release_canary.yml@v2.1.1
with:
install: npm i
secrets:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release-candidate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
release-candidate:
name: npm
if: ${{ github.repository == 'opf/primer_view_components' }}
uses: primer/.github/.github/workflows/release_candidate.yml@v2.1.0
uses: primer/.github/.github/workflows/release_candidate.yml@v2.1.1
secrets:
gh_token: ${{ secrets.GITHUB_TOKEN }}
npm_token: ${{ secrets.NPM_AUTH_TOKEN_SHARED }}
2 changes: 1 addition & 1 deletion .github/workflows/release_tracking.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@ on:
jobs:
release-tracking:
name: Release Tracking
uses: primer/.github/.github/workflows/release_tracking.yml@v2.1.0
uses: primer/.github/.github/workflows/release_tracking.yml@v2.1.1
secrets:
datadog_api_key: ${{ secrets.DATADOG_API_KEY }}
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.
4 changes: 2 additions & 2 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ PATH
openproject-primer_view_components (0.35.2)
actionview (>= 5.0.0)
activesupport (>= 5.0.0)
openproject-octicons (>= 19.12.0)
openproject-octicons (>= 19.15.0)
view_component (>= 3.1, < 4.0)

GEM
Expand Down Expand Up @@ -144,7 +144,7 @@ GEM
racc (~> 1.4)
nokogiri (1.16.6-x86_64-linux)
racc (~> 1.4)
openproject-octicons (19.12.0)
openproject-octicons (19.15.0)
parallel (1.24.0)
parser (3.3.2.0)
ast (~> 2.4.1)
Expand Down
16 changes: 14 additions & 2 deletions app/components/primer/alpha/action_list.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,19 @@ class ActionList < Primer::Component

MENU_ROLE = :menu
DEFAULT_MENU_ITEM_ROLE = :menuitem

LIST_BOX_ITEM_ROLE = :option
DEFAULT_SCHEME = :full
SCHEME_MAPPINGS = {
DEFAULT_SCHEME => nil,
:inset => "ActionListWrap--inset"
}.freeze
SCHEME_OPTIONS = SCHEME_MAPPINGS.keys.freeze

DEFAULT_ARIA_SELECTION_VARIANT = :checked
ARIA_SELECTION_VARIANT_OPTIONS = [
:selected,
DEFAULT_ARIA_SELECTION_VARIANT,
].freeze
DEFAULT_SELECT_VARIANT = :none
SELECT_VARIANT_OPTIONS = [
:single,
Expand Down Expand Up @@ -115,14 +120,15 @@ def custom_element_name
}
}

attr_reader :id, :select_variant, :role
attr_reader :id, :select_variant, :role, :aria_selection_variant

# @param id [String] HTML ID value.
# @param role [Boolean] ARIA role describing the function of the list. listbox and menu are a common values.
# @param item_classes [String] Additional CSS classes to attach to items.
# @param scheme [Symbol] <%= one_of(Primer::Alpha::ActionList::SCHEME_OPTIONS) %> `inset` children are offset (vertically and horizontally) from list edges. `full` (default) children are flush (vertically and horizontally) with list edges.
# @param show_dividers [Boolean] Display a divider above each item in the list when it does not follow a header or divider.
# @param select_variant [Symbol] How items may be selected in the list. <%= one_of(Primer::Alpha::ActionList::SELECT_VARIANT_OPTIONS) %>
# @param aria_selection_variant [Symbol] Specifies which aria selection to use. <%= one_of(Primer::Alpha::ActionList::ARIA_SELECTION_VARIANT_OPTIONS) %?
# @param form_arguments [Hash] Allows an `ActionList` to act as a select list in multi- and single-select modes. Pass the `builder:` and `name:` options to this hash. `builder:` should be an instance of `ActionView::Helpers::FormBuilder`, which are created by the standard Rails `#form_with` and `#form_for` helpers. The `name:` option is the desired name of the field that will be included in the params sent to the server on form submission. *NOTE*: Consider using an <%= link_to_component(Primer::Alpha::ActionMenu) %> instead of using this feature directly.
# @param system_arguments [Hash] <%= link_to_system_arguments_docs %>
def initialize(
Expand All @@ -131,6 +137,7 @@ def initialize(
item_classes: nil,
scheme: DEFAULT_SCHEME,
show_dividers: false,
aria_selection_variant: DEFAULT_ARIA_SELECTION_VARIANT,
select_variant: DEFAULT_SELECT_VARIANT,
form_arguments: {},
**system_arguments
Expand All @@ -143,6 +150,7 @@ def initialize(
@scheme = fetch_or_fallback(SCHEME_OPTIONS, scheme, DEFAULT_SCHEME)
@show_dividers = show_dividers
@select_variant = select_variant
@aria_selection_variant = aria_selection_variant
@system_arguments[:classes] = class_names(
SCHEME_MAPPINGS[@scheme],
system_arguments[:classes],
Expand Down Expand Up @@ -229,6 +237,10 @@ def allows_selection?
single_select? || multi_select?
end

def acts_as_listbox?
@system_arguments[:role] == "listbox"
end

def acts_as_menu?
@system_arguments[:role] == :menu || @system_arguments[:role] == :group
end
Expand Down
8 changes: 5 additions & 3 deletions app/components/primer/alpha/action_list/item.rb
Original file line number Diff line number Diff line change
Expand Up @@ -271,13 +271,15 @@ def initialize(
end

@content_arguments[:role] = role ||
if @list.allows_selection?
if @list.acts_as_listbox?
ActionList::LIST_BOX_ITEM_ROLE
elsif @list.allows_selection?
ActionList::SELECT_VARIANT_ROLE_MAP[@list.select_variant]
elsif @list.acts_as_menu?
ActionList::DEFAULT_MENU_ITEM_ROLE
end

@system_arguments[:role] = @list.acts_as_menu? ? :none : nil
@system_arguments[:role] = @list.acts_as_menu? || @list.acts_as_listbox? ? :none : nil

@description_wrapper_arguments = {
classes: class_names(
Expand All @@ -293,7 +295,7 @@ def before_render
if @list.allows_selection?
@content_arguments[:aria] = merge_aria(
@content_arguments,
{ aria: { checked: active? } }
{ aria: @list.aria_selection_variant == :selected ? {selected: active?} : { checked: active? } }
)
end

Expand Down
5 changes: 4 additions & 1 deletion app/components/primer/alpha/action_menu.rb
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,7 @@ class ActionMenu < Primer::Component
# @param dynamic_label_prefix [String] If provided, the prefix is prepended to the dynamic label and displayed in the show button.
# @param select_variant [Symbol] <%= one_of(Primer::Alpha::ActionMenu::SELECT_VARIANT_OPTIONS) %>
# @param form_arguments [Hash] Allows an `ActionMenu` to act as a select list in multi- and single-select modes. Pass the `builder:` and `name:` options to this hash. `builder:` should be an instance of `ActionView::Helpers::FormBuilder`, which are created by the standard Rails `#form_with` and `#form_for` helpers. The `name:` option is the desired name of the field that will be included in the params sent to the server on form submission.
# @param overlay_arguments [Hash] Arguments to pass to the underlying <%= link_to_component(Primer::Alpha::Overlay) %>
# @param system_arguments [Hash] <%= link_to_system_arguments_docs %>.
def initialize(
menu_id: self.class.generate_id,
Expand All @@ -199,6 +200,7 @@ def initialize(
dynamic_label_prefix: nil,
select_variant: DEFAULT_SELECT_VARIANT,
form_arguments: {},
overlay_arguments: {},
**system_arguments
)
@menu_id = menu_id
Expand All @@ -221,7 +223,8 @@ def initialize(
visually_hide_title: true,
anchor_align: anchor_align,
anchor_side: anchor_side,
size: size
size: size,
**overlay_arguments
)

@list = Primer::Alpha::ActionMenu::List.new(
Expand Down
2 changes: 1 addition & 1 deletion app/components/primer/focus_group.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import '@oddbird/popover-polyfill'

const validSelectors = ['[role="menuitem"]', '[role="menuitemcheckbox"]', '[role="menuitemradio"]']
const validSelectors = ['[role="menuitem"]', '[role="menuitemcheckbox"]', '[role="menuitemradio"]', '[role="option"]']
const menuItemSelector = validSelectors.map(selector => `:not([hidden]) > ${selector}`).join(', ')

const getMnemonicFor = (item: Element) => item.textContent?.trim()[0].toLowerCase()
Expand Down
2 changes: 1 addition & 1 deletion demo/Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ gem "bootsnap", ">= 1.4.2", require: false

gem "openproject-primer_view_components", path: "../"
gem "view_component", '>= 3.11.0'
gem "lookbook", "~> 2.3.1" unless rails_version.to_f < 7
gem "lookbook", "~> 2.3.2" unless rails_version.to_f < 7

group :development do
# Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
Expand Down
28 changes: 14 additions & 14 deletions demo/Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ PATH
openproject-primer_view_components (0.35.2)
actionview (>= 5.0.0)
activesupport (>= 5.0.0)
openproject-octicons (>= 19.12.0)
openproject-octicons (>= 19.15.0)
view_component (>= 3.1, < 4.0)

GEM
Expand Down Expand Up @@ -47,8 +47,8 @@ GEM
minitest (>= 5.1)
mutex_m
tzinfo (~> 2.0)
addressable (2.8.6)
public_suffix (>= 2.0.2, < 6.0)
addressable (2.8.7)
public_suffix (>= 2.0.2, < 7.0)
azure_mgmt_container_service (0.22.0)
ms_rest_azure (~> 0.12.0)
base64 (0.2.0)
Expand All @@ -69,7 +69,7 @@ GEM
drb (2.2.1)
dry-inflector (0.3.0)
ejson (1.4.1)
erubi (1.12.0)
erubi (1.13.0)
faraday (1.10.3)
faraday-em_http (~> 1.0)
faraday-em_synchrony (~> 1.0)
Expand Down Expand Up @@ -141,7 +141,7 @@ GEM
activesupport (>= 6.0.0)
railties (>= 6.0.0)
io-console (0.7.2)
irb (1.13.1)
irb (1.13.2)
rdoc (>= 4.0.0)
reline (>= 0.4.2)
jsonpath (1.1.5)
Expand Down Expand Up @@ -206,7 +206,7 @@ GEM
loofah (2.22.0)
crass (~> 1.0.2)
nokogiri (>= 1.12.0)
lookbook (2.3.1)
lookbook (2.3.2)
activemodel
css_parser
htmlbeautifier (~> 1.3)
Expand All @@ -223,7 +223,7 @@ GEM
mime-types (3.5.2)
mime-types-data (~> 3.2015)
mime-types-data (3.2024.0507)
minitest (5.23.1)
minitest (5.24.0)
ms_rest (0.7.6)
concurrent-ruby (~> 1.0)
faraday (>= 0.9, < 2.0.0)
Expand All @@ -247,7 +247,7 @@ GEM
racc (~> 1.4)
oj (3.16.3)
bigdecimal (>= 3.0)
openproject-octicons (19.12.0)
openproject-octicons (19.15.0)
os (1.1.4)
pry (0.14.2)
coderay (~> 1.1)
Expand All @@ -257,11 +257,11 @@ GEM
pry (>= 0.13, < 0.15)
psych (5.1.2)
stringio
public_suffix (5.0.5)
public_suffix (6.0.0)
puma (6.4.2)
nio4r (~> 2.0)
racc (1.8.0)
rack (3.1.0)
rack (3.1.4)
rack-cors (2.0.2)
rack (>= 2.0.0)
rack-session (2.0.0)
Expand Down Expand Up @@ -294,7 +294,7 @@ GEM
psych (>= 4.0.0)
recursive-open-struct (1.1.3)
redcarpet (3.6.0)
reline (0.5.7)
reline (0.5.9)
io-console (~> 0.5)
rest-client (2.1.0)
http-accept (>= 1.7.0, < 2.0)
Expand Down Expand Up @@ -322,7 +322,7 @@ GEM
statsd-instrument (3.7.0)
stimulus-rails (1.3.3)
railties (>= 6.0.0)
stringio (3.1.0)
stringio (3.1.1)
thor (1.3.1)
timeliness (0.3.10)
turbo-rails (2.0.5)
Expand All @@ -340,7 +340,7 @@ GEM
websocket-extensions (>= 0.1.0)
websocket-extensions (0.1.5)
yard (0.9.36)
zeitwerk (2.6.14)
zeitwerk (2.6.16)

PLATFORMS
arm64-darwin-21
Expand All @@ -365,7 +365,7 @@ DEPENDENCIES
kuby-core (~> 0.20)
kuby-kind (~> 0.2)
listen
lookbook (~> 2.3.1)
lookbook (~> 2.3.2)
openproject-primer_view_components!
pry-byebug
puma (~> 6.4.2)
Expand Down
Loading

0 comments on commit e9981ee

Please sign in to comment.