openproject-primer_view_components 0.35.1 → 0.36.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (38) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +18 -0
  3. data/app/assets/javascripts/primer_view_components.js +1 -1
  4. data/app/assets/javascripts/primer_view_components.js.map +1 -1
  5. data/app/assets/styles/primer_view_components.css +1 -1
  6. data/app/assets/styles/primer_view_components.css.map +1 -1
  7. data/app/components/primer/alpha/action_list/item.rb +5 -3
  8. data/app/components/primer/alpha/action_list.rb +14 -2
  9. data/app/components/primer/alpha/action_menu.rb +4 -1
  10. data/app/components/primer/alpha/tab_nav.css +1 -1
  11. data/app/components/primer/alpha/tab_nav.css.json +0 -2
  12. data/app/components/primer/alpha/tab_nav.css.map +1 -1
  13. data/app/components/primer/alpha/tab_nav.pcss +0 -10
  14. data/app/components/primer/alpha/tab_panels.html.erb +9 -5
  15. data/app/components/primer/alpha/tab_panels.rb +13 -4
  16. data/app/components/primer/alpha/text_field.css +1 -1
  17. data/app/components/primer/alpha/text_field.css.map +1 -1
  18. data/app/components/primer/alpha/underline_nav.css +1 -1
  19. data/app/components/primer/alpha/underline_nav.css.json +0 -2
  20. data/app/components/primer/alpha/underline_nav.css.map +1 -1
  21. data/app/components/primer/alpha/underline_nav.pcss +1 -7
  22. data/app/components/primer/alpha/underline_panels.html.erb +8 -6
  23. data/app/components/primer/alpha/underline_panels.rb +14 -6
  24. data/app/components/primer/focus_group.js +1 -1
  25. data/app/components/primer/focus_group.ts +1 -1
  26. data/app/components/primer/primer.pcss +0 -1
  27. data/lib/primer/classify/utilities.rb +13 -13
  28. data/lib/primer/view_components/version.rb +2 -2
  29. data/previews/primer/alpha/action_list_preview.rb +19 -0
  30. data/static/arguments.json +30 -0
  31. data/static/constants.json +6 -0
  32. data/static/info_arch.json +50 -0
  33. data/static/previews.json +13 -0
  34. metadata +4 -8
  35. data/app/components/primer/alpha/underline_panels.css +0 -1
  36. data/app/components/primer/alpha/underline_panels.css.json +0 -6
  37. data/app/components/primer/alpha/underline_panels.css.map +0 -1
  38. data/app/components/primer/alpha/underline_panels.pcss +0 -4
@@ -18,7 +18,7 @@ module Primer
18
18
  Primer::Alpha::Navigation::Tab.new(
19
19
  selected: selected,
20
20
  with_panel: true,
21
- list: false,
21
+ list: true,
22
22
  icon_classes: "UnderlineNav-octicon",
23
23
  panel_id: "panel-#{id}",
24
24
  **system_arguments
@@ -43,16 +43,24 @@ module Primer
43
43
  # @param system_arguments [Hash] <%= link_to_system_arguments_docs %>
44
44
  def initialize(label:, align: ALIGN_DEFAULT, body_arguments: {}, wrapper_arguments: {}, **system_arguments)
45
45
  @align = fetch_or_fallback(ALIGN_OPTIONS, align, ALIGN_DEFAULT)
46
- @wrapper_arguments = deny_tag_argument(**wrapper_arguments)
47
- @wrapper_arguments[:tag] = :div
46
+ @wrapper_arguments = wrapper_arguments
48
47
 
49
48
  @system_arguments = deny_tag_argument(**system_arguments)
50
- @system_arguments[:tag] = :"tab-container"
49
+ @system_arguments[:tag] = :div
51
50
  @system_arguments[:classes] = underline_nav_classes(@system_arguments[:classes], @align)
52
- @system_arguments[:"aria-label"] = label
53
51
 
54
52
  @body_arguments = deny_tag_argument(**body_arguments)
55
- @body_arguments[:tag] = :div
53
+ @body_arguments[:tag] = :ul
54
+ @body_arguments[:classes] = underline_nav_body_classes(@body_arguments[:classes])
55
+
56
+ @body_arguments[:role] = :tablist
57
+ @body_arguments[:"aria-label"] = label
58
+ end
59
+
60
+ private
61
+
62
+ def body
63
+ Primer::BaseComponent.new(**@body_arguments)
56
64
  end
57
65
  end
58
66
  end
@@ -11,7 +11,7 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
11
11
  };
12
12
  var _FocusGroupElement_instances, _FocusGroupElement_retainSignal, _FocusGroupElement_abortController, _FocusGroupElement_items_get;
13
13
  import '@oddbird/popover-polyfill';
14
- const validSelectors = ['[role="menuitem"]', '[role="menuitemcheckbox"]', '[role="menuitemradio"]'];
14
+ const validSelectors = ['[role="menuitem"]', '[role="menuitemcheckbox"]', '[role="menuitemradio"]', '[role="option"]'];
15
15
  const menuItemSelector = validSelectors.map(selector => `:not([hidden]) > ${selector}`).join(', ');
16
16
  const getMnemonicFor = (item) => item.textContent?.trim()[0].toLowerCase();
17
17
  const printable = /^\S$/;
@@ -1,6 +1,6 @@
1
1
  import '@oddbird/popover-polyfill'
2
2
 
3
- const validSelectors = ['[role="menuitem"]', '[role="menuitemcheckbox"]', '[role="menuitemradio"]']
3
+ const validSelectors = ['[role="menuitem"]', '[role="menuitemcheckbox"]', '[role="menuitemradio"]', '[role="option"]']
4
4
  const menuItemSelector = validSelectors.map(selector => `:not([hidden]) > ${selector}`).join(', ')
5
5
 
6
6
  const getMnemonicFor = (item: Element) => item.textContent?.trim()[0].toLowerCase()
@@ -12,7 +12,6 @@
12
12
  @import "./alpha/button_marketing.pcss";
13
13
  @import "./alpha/toggle_switch.pcss";
14
14
  @import "./alpha/underline_nav.pcss";
15
- @import "./alpha/underline_panels.pcss";
16
15
  @import "./alpha/segmented_control.pcss";
17
16
  @import "./alpha/menu.pcss";
18
17
 
@@ -18,18 +18,18 @@ module Primer
18
18
 
19
19
  # Replacements for some classnames that end up being a different argument key
20
20
  REPLACEMENT_KEYS = {
21
- "^f" => "font_size",
22
- "^anim" => "animation",
23
- "^v-align" => "vertical_align",
24
- "^d" => "display",
25
- "^wb" => "word_break",
26
- "^v" => "visibility",
27
- "^width" => "w",
28
- "^height" => "h",
29
- "^color-bg" => "bg",
30
- "^color-border" => "border_color",
31
- "^color-fg" => "color",
32
- "^rounded" => "border_radius"
21
+ Regexp.new("^f") => "font_size",
22
+ Regexp.new("^anim") => "animation",
23
+ Regexp.new("^v-align") => "vertical_align",
24
+ Regexp.new("^d") => "display",
25
+ Regexp.new("^wb") => "word_break",
26
+ Regexp.new("^v") => "visibility",
27
+ Regexp.new("^width") => "w",
28
+ Regexp.new("^height") => "h",
29
+ Regexp.new("^color-bg") => "bg",
30
+ Regexp.new("^color-border") => "border_color",
31
+ Regexp.new("^color-fg") => "color",
32
+ Regexp.new("^rounded") => "border_radius"
33
33
  }.freeze
34
34
 
35
35
  SUPPORTED_KEY_CACHE = Hash.new { |h, k| h[k] = !UTILITIES[k].nil? }
@@ -190,7 +190,7 @@ module Primer
190
190
 
191
191
  def infer_selector_key(selector)
192
192
  REPLACEMENT_KEYS.each do |k, v|
193
- return v.to_sym if selector.match?(Regexp.new(k))
193
+ return v.to_sym if selector.match?(k)
194
194
  end
195
195
  selector.split("-").first.to_sym
196
196
  end
@@ -5,8 +5,8 @@ module Primer
5
5
  module ViewComponents
6
6
  module VERSION
7
7
  MAJOR = 0
8
- MINOR = 35
9
- PATCH = 1
8
+ MINOR = 36
9
+ PATCH = 0
10
10
 
11
11
  STRING = [MAJOR, MINOR, PATCH].join(".")
12
12
  end
@@ -519,6 +519,25 @@ module Primer
519
519
  end
520
520
  end
521
521
  end
522
+
523
+ # @label Listbox
524
+ def listbox(
525
+ role: "listbox",
526
+ aria_selection_variant: :selected,
527
+ scheme: Primer::Alpha::ActionList::DEFAULT_SCHEME,
528
+ show_dividers: false
529
+ )
530
+ render(Primer::Alpha::ActionList.new(
531
+ role: role,
532
+ scheme: scheme,
533
+ show_dividers: show_dividers
534
+ )) do |component|
535
+ component.with_heading(title: "Action List")
536
+ component.with_item(label: "Item one", href: "/", active: true)
537
+ component.with_item(label: "Item two", href: "/")
538
+ component.with_item(label: "Item three", href: "/")
539
+ end
540
+ end
522
541
  end
523
542
  end
524
543
  end
@@ -104,6 +104,12 @@
104
104
  "default": "`:none`",
105
105
  "description": "How items may be selected in the list. One of `:multiple`, `:multiple_checkbox`, `:none`, or `:single`."
106
106
  },
107
+ {
108
+ "name": "aria_selection_variant",
109
+ "type": "Symbol",
110
+ "default": "`:checked`",
111
+ "description": "Specifies which aria selection to use. <%= one_of(Primer::Alpha::ActionList::ARIA_SELECTION_VARIANT_OPTIONS) %?"
112
+ },
107
113
  {
108
114
  "name": "form_arguments",
109
115
  "type": "Hash",
@@ -383,6 +389,12 @@
383
389
  "default": "`{}`",
384
390
  "description": "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."
385
391
  },
392
+ {
393
+ "name": "overlay_arguments",
394
+ "type": "Hash",
395
+ "default": "`{}`",
396
+ "description": "Arguments to pass to the underlying [Overlay](/components/alpha/overlay)"
397
+ },
386
398
  {
387
399
  "name": "system_arguments",
388
400
  "type": "Hash",
@@ -435,6 +447,12 @@
435
447
  "default": "`:none`",
436
448
  "description": "How items may be selected in the list. One of `:multiple`, `:multiple_checkbox`, `:none`, or `:single`."
437
449
  },
450
+ {
451
+ "name": "aria_selection_variant",
452
+ "type": "Symbol",
453
+ "default": "`:checked`",
454
+ "description": "Specifies which aria selection to use. <%= one_of(Primer::Alpha::ActionList::ARIA_SELECTION_VARIANT_OPTIONS) %?"
455
+ },
438
456
  {
439
457
  "name": "form_arguments",
440
458
  "type": "Hash",
@@ -2462,6 +2480,18 @@
2462
2480
  "default": "N/A",
2463
2481
  "description": "One of `:left` or `:right`. - Defaults to left"
2464
2482
  },
2483
+ {
2484
+ "name": "body_arguments",
2485
+ "type": "Hash",
2486
+ "default": "`{}`",
2487
+ "description": "[System arguments](/system-arguments) for the body wrapper."
2488
+ },
2489
+ {
2490
+ "name": "wrapper_arguments",
2491
+ "type": "Hash",
2492
+ "default": "`{}`",
2493
+ "description": "[System arguments](/system-arguments) for the `TabContainer` wrapper."
2494
+ },
2465
2495
  {
2466
2496
  "name": "system_arguments",
2467
2497
  "type": "Hash",
@@ -19,6 +19,11 @@
19
19
  "Primer::Alpha::ActionBar::Item": {
20
20
  },
21
21
  "Primer::Alpha::ActionList": {
22
+ "ARIA_SELECTION_VARIANT_OPTIONS": [
23
+ "selected",
24
+ "checked"
25
+ ],
26
+ "DEFAULT_ARIA_SELECTION_VARIANT": "checked",
22
27
  "DEFAULT_MENU_ITEM_ROLE": "menuitem",
23
28
  "DEFAULT_ROLE": "list",
24
29
  "DEFAULT_SCHEME": "full",
@@ -27,6 +32,7 @@
27
32
  "FormWrapper": "Primer::Alpha::ActionList::FormWrapper",
28
33
  "Heading": "Primer::Alpha::ActionList::Heading",
29
34
  "Item": "Primer::Alpha::ActionList::Item",
35
+ "LIST_BOX_ITEM_ROLE": "option",
30
36
  "MENU_ROLE": "menu",
31
37
  "SCHEME_MAPPINGS": {
32
38
  "full": null,
@@ -246,6 +246,12 @@
246
246
  "default": "`:none`",
247
247
  "description": "How items may be selected in the list. One of `:multiple`, `:multiple_checkbox`, `:none`, or `:single`."
248
248
  },
249
+ {
250
+ "name": "aria_selection_variant",
251
+ "type": "Symbol",
252
+ "default": "`:checked`",
253
+ "description": "Specifies which aria selection to use. <%= one_of(Primer::Alpha::ActionList::ARIA_SELECTION_VARIANT_OPTIONS) %?"
254
+ },
249
255
  {
250
256
  "name": "form_arguments",
251
257
  "type": "Hash",
@@ -386,6 +392,13 @@
386
392
 
387
393
  ]
388
394
  },
395
+ {
396
+ "name": "aria_selection_variant",
397
+ "description": "Returns the value of attribute aria_selection_variant.",
398
+ "parameters": [
399
+
400
+ ]
401
+ },
389
402
  {
390
403
  "name": "build_item",
391
404
  "description": "Builds a new item but does not add it to the list. Use this method\ninstead of the `#with_item` slot if you need to render an item outside\nthe context of a list, eg. if rendering additional items to append to\nan existing list, perhaps via a separate HTTP request.",
@@ -798,6 +811,19 @@
798
811
  "color-contrast"
799
812
  ]
800
813
  }
814
+ },
815
+ {
816
+ "preview_path": "primer/alpha/action_list/listbox",
817
+ "name": "listbox",
818
+ "snapshot": "false",
819
+ "skip_rules": {
820
+ "wont_fix": [
821
+ "region"
822
+ ],
823
+ "will_fix": [
824
+ "color-contrast"
825
+ ]
826
+ }
801
827
  }
802
828
  ],
803
829
  "subcomponents": [
@@ -1271,6 +1297,12 @@
1271
1297
  "default": "`{}`",
1272
1298
  "description": "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."
1273
1299
  },
1300
+ {
1301
+ "name": "overlay_arguments",
1302
+ "type": "Hash",
1303
+ "default": "`{}`",
1304
+ "description": "Arguments to pass to the underlying {{#link_to_component}}Primer::Alpha::Overlay{{/link_to_component}}"
1305
+ },
1274
1306
  {
1275
1307
  "name": "system_arguments",
1276
1308
  "type": "Hash",
@@ -1968,6 +2000,12 @@
1968
2000
  "default": "`:none`",
1969
2001
  "description": "How items may be selected in the list. One of `:multiple`, `:multiple_checkbox`, `:none`, or `:single`."
1970
2002
  },
2003
+ {
2004
+ "name": "aria_selection_variant",
2005
+ "type": "Symbol",
2006
+ "default": "`:checked`",
2007
+ "description": "Specifies which aria selection to use. <%= one_of(Primer::Alpha::ActionList::ARIA_SELECTION_VARIANT_OPTIONS) %?"
2008
+ },
1971
2009
  {
1972
2010
  "name": "form_arguments",
1973
2011
  "type": "Hash",
@@ -7628,6 +7666,18 @@
7628
7666
  "default": "N/A",
7629
7667
  "description": "One of `:left` or `:right`. - Defaults to left"
7630
7668
  },
7669
+ {
7670
+ "name": "body_arguments",
7671
+ "type": "Hash",
7672
+ "default": "`{}`",
7673
+ "description": "{{link_to_system_arguments_docs}} for the body wrapper."
7674
+ },
7675
+ {
7676
+ "name": "wrapper_arguments",
7677
+ "type": "Hash",
7678
+ "default": "`{}`",
7679
+ "description": "{{link_to_system_arguments_docs}} for the `TabContainer` wrapper."
7680
+ },
7631
7681
  {
7632
7682
  "name": "system_arguments",
7633
7683
  "type": "Hash",
data/static/previews.json CHANGED
@@ -428,6 +428,19 @@
428
428
  "color-contrast"
429
429
  ]
430
430
  }
431
+ },
432
+ {
433
+ "preview_path": "primer/alpha/action_list/listbox",
434
+ "name": "listbox",
435
+ "snapshot": "false",
436
+ "skip_rules": {
437
+ "wont_fix": [
438
+ "region"
439
+ ],
440
+ "will_fix": [
441
+ "color-contrast"
442
+ ]
443
+ }
431
444
  }
432
445
  ]
433
446
  },
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: openproject-primer_view_components
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.35.1
4
+ version: 0.36.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - GitHub Open Source
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2024-06-24 00:00:00.000000000 Z
12
+ date: 2024-07-03 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: actionview
@@ -45,14 +45,14 @@ dependencies:
45
45
  requirements:
46
46
  - - ">="
47
47
  - !ruby/object:Gem::Version
48
- version: 19.12.0
48
+ version: 19.15.0
49
49
  type: :runtime
50
50
  prerelease: false
51
51
  version_requirements: !ruby/object:Gem::Requirement
52
52
  requirements:
53
53
  - - ">="
54
54
  - !ruby/object:Gem::Version
55
- version: 19.12.0
55
+ version: 19.15.0
56
56
  - !ruby/object:Gem::Dependency
57
57
  name: view_component
58
58
  requirement: !ruby/object:Gem::Requirement
@@ -293,11 +293,7 @@ files:
293
293
  - app/components/primer/alpha/underline_nav.html.erb
294
294
  - app/components/primer/alpha/underline_nav.pcss
295
295
  - app/components/primer/alpha/underline_nav.rb
296
- - app/components/primer/alpha/underline_panels.css
297
- - app/components/primer/alpha/underline_panels.css.json
298
- - app/components/primer/alpha/underline_panels.css.map
299
296
  - app/components/primer/alpha/underline_panels.html.erb
300
- - app/components/primer/alpha/underline_panels.pcss
301
297
  - app/components/primer/alpha/underline_panels.rb
302
298
  - app/components/primer/alpha/x_banner.d.ts
303
299
  - app/components/primer/alpha/x_banner.js
@@ -1 +0,0 @@
1
- tab-container.UnderlineNav{box-shadow:none;flex-direction:column}
@@ -1,6 +0,0 @@
1
- {
2
- "name": "alpha/underline_panels",
3
- "selectors": [
4
- "tab-container.UnderlineNav"
5
- ]
6
- }
@@ -1 +0,0 @@
1
- {"version":3,"sources":["underline_panels.pcss"],"names":[],"mappings":"AAAA,2BACE,eAAgB,CAChB,qBACF","file":"underline_panels.css","sourcesContent":["tab-container.UnderlineNav {\n box-shadow: none;\n flex-direction: column;\n}\n"]}
@@ -1,4 +0,0 @@
1
- tab-container.UnderlineNav {
2
- box-shadow: none;
3
- flex-direction: column;
4
- }