openproject-primer_view_components 0.65.0 → 0.66.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (30) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +12 -0
  3. data/app/assets/styles/primer_view_components.css +1 -1
  4. data/app/assets/styles/primer_view_components.css.map +1 -1
  5. data/app/components/primer/open_project/page_header.rb +1 -1
  6. data/app/components/primer/open_project/sub_header/button.rb +43 -0
  7. data/app/components/primer/open_project/sub_header/button_group.rb +16 -0
  8. data/app/components/primer/open_project/sub_header/menu.rb +67 -0
  9. data/app/components/primer/open_project/sub_header/segmented_control.rb +16 -0
  10. data/app/components/primer/open_project/sub_header.css +1 -1
  11. data/app/components/primer/open_project/sub_header.css.json +4 -1
  12. data/app/components/primer/open_project/sub_header.css.map +1 -1
  13. data/app/components/primer/open_project/sub_header.html.erb +21 -0
  14. data/app/components/primer/open_project/sub_header.pcss +29 -3
  15. data/app/components/primer/open_project/sub_header.rb +106 -21
  16. data/lib/primer/view_components/version.rb +2 -2
  17. data/previews/primer/open_project/page_header_preview/create_action.html.erb +1 -2
  18. data/previews/primer/open_project/sub_header_preview/action_menu_buttons.html.erb +7 -10
  19. data/previews/primer/open_project/sub_header_preview/button_group.html.erb +13 -7
  20. data/previews/primer/open_project/sub_header_preview/custom_filter_button.html.erb +1 -1
  21. data/previews/primer/open_project/sub_header_preview/dialog_buttons.html.erb +9 -8
  22. data/previews/primer/open_project/sub_header_preview.rb +26 -7
  23. data/static/arguments.json +124 -0
  24. data/static/audited_at.json +4 -0
  25. data/static/classes.json +3 -0
  26. data/static/constants.json +25 -1
  27. data/static/info_arch.json +245 -0
  28. data/static/previews.json +13 -0
  29. data/static/statuses.json +4 -0
  30. metadata +6 -2
@@ -5712,6 +5712,130 @@
5712
5712
  }
5713
5713
  ]
5714
5714
  },
5715
+ {
5716
+ "component": "OpenProject::SubHeader::Button",
5717
+ "status": "open_project",
5718
+ "a11y_reviewed": false,
5719
+ "short_name": "OpenProjectSubHeaderButton",
5720
+ "source": "https://github.com/primer/view_components/tree/main/app/components/primer/open_project/sub_header/button.rb",
5721
+ "lookbook": "https://primer.style/view-components/lookbook/inspect/primer/open_project/sub_header/button/default/",
5722
+ "parameters": [
5723
+ {
5724
+ "name": "icon",
5725
+ "type": "Symbol",
5726
+ "default": "N/A",
5727
+ "description": "The name of an [Octicon](https://primer.style/octicons/) icon to use as leading visual"
5728
+ },
5729
+ {
5730
+ "name": "system_arguments",
5731
+ "type": "Hash",
5732
+ "default": "N/A",
5733
+ "description": "[System arguments](/system-arguments)"
5734
+ }
5735
+ ]
5736
+ },
5737
+ {
5738
+ "component": "OpenProject::SubHeader::ButtonGroup",
5739
+ "status": "open_project",
5740
+ "a11y_reviewed": false,
5741
+ "short_name": "OpenProjectSubHeaderButtonGroup",
5742
+ "source": "https://github.com/primer/view_components/tree/main/app/components/primer/open_project/sub_header/button_group.rb",
5743
+ "lookbook": "https://primer.style/view-components/lookbook/inspect/primer/open_project/sub_header/button_group/default/",
5744
+ "parameters": [
5745
+ {
5746
+ "name": "scheme",
5747
+ "type": "Symbol",
5748
+ "default": "`:default`",
5749
+ "description": "DEPRECATED. One of `:danger`, `:default`, `:invisible`, `:link`, `:primary`, or `:secondary`."
5750
+ },
5751
+ {
5752
+ "name": "size",
5753
+ "type": "Symbol",
5754
+ "default": "`:medium`",
5755
+ "description": "One of `:large`, `:medium`, or `:small`."
5756
+ },
5757
+ {
5758
+ "name": "system_arguments",
5759
+ "type": "Hash",
5760
+ "default": "N/A",
5761
+ "description": "[System arguments](/system-arguments)"
5762
+ }
5763
+ ]
5764
+ },
5765
+ {
5766
+ "component": "OpenProject::SubHeader::Menu",
5767
+ "status": "open_project",
5768
+ "a11y_reviewed": false,
5769
+ "short_name": "OpenProjectSubHeaderMenu",
5770
+ "source": "https://github.com/primer/view_components/tree/main/app/components/primer/open_project/sub_header/menu.rb",
5771
+ "lookbook": "https://primer.style/view-components/lookbook/inspect/primer/open_project/sub_header/menu/default/",
5772
+ "parameters": [
5773
+ {
5774
+ "name": "icon_only",
5775
+ "type": "Boolean",
5776
+ "default": "`false`",
5777
+ "description": "Whether the trigger button is an IconButton"
5778
+ },
5779
+ {
5780
+ "name": "leading_icon",
5781
+ "type": "Symbol",
5782
+ "default": "N/A",
5783
+ "description": "Name of Octicon icon to use as either leading icon or IconButton."
5784
+ },
5785
+ {
5786
+ "name": "label",
5787
+ "type": "String",
5788
+ "default": "N/A",
5789
+ "description": "The button label"
5790
+ },
5791
+ {
5792
+ "name": "button_arguments",
5793
+ "type": "Hash",
5794
+ "default": "`{}`",
5795
+ "description": "Additional arguments for the button"
5796
+ },
5797
+ {
5798
+ "name": "system_arguments",
5799
+ "type": "Hash",
5800
+ "default": "N/A",
5801
+ "description": "[System arguments](/system-arguments)"
5802
+ }
5803
+ ]
5804
+ },
5805
+ {
5806
+ "component": "OpenProject::SubHeader::SegmentedControl",
5807
+ "status": "open_project",
5808
+ "a11y_reviewed": true,
5809
+ "short_name": "OpenProjectSubHeaderSegmentedControl",
5810
+ "source": "https://github.com/primer/view_components/tree/main/app/components/primer/open_project/sub_header/segmented_control.rb",
5811
+ "lookbook": "https://primer.style/view-components/lookbook/inspect/primer/open_project/sub_header/segmented_control/default/",
5812
+ "parameters": [
5813
+ {
5814
+ "name": "hide_labels",
5815
+ "type": "Boolean",
5816
+ "default": "`false`",
5817
+ "description": "Whether to hide the labels and only show the icons"
5818
+ },
5819
+ {
5820
+ "name": "full_width",
5821
+ "type": "Boolean",
5822
+ "default": "`false`",
5823
+ "description": "If the component should be full width"
5824
+ },
5825
+ {
5826
+ "name": "size",
5827
+ "type": "Symbol",
5828
+ "default": "`:medium`",
5829
+ "description": "One of `:large`, `:medium`, or `:small`."
5830
+ },
5831
+ {
5832
+ "name": "system_arguments",
5833
+ "type": "Hash",
5834
+ "default": "N/A",
5835
+ "description": "[System arguments](/system-arguments)"
5836
+ }
5837
+ ]
5838
+ },
5715
5839
  {
5716
5840
  "component": "OpenProject::TreeView",
5717
5841
  "status": "alpha",
@@ -144,6 +144,10 @@
144
144
  "Primer::OpenProject::SidePanel::Section": "",
145
145
  "Primer::OpenProject::SkeletonBox": "",
146
146
  "Primer::OpenProject::SubHeader": "",
147
+ "Primer::OpenProject::SubHeader::Button": "",
148
+ "Primer::OpenProject::SubHeader::ButtonGroup": "",
149
+ "Primer::OpenProject::SubHeader::Menu": "",
150
+ "Primer::OpenProject::SubHeader::SegmentedControl": "2023-02-01",
147
151
  "Primer::OpenProject::TreeView": "",
148
152
  "Primer::OpenProject::TreeView::Icon": "",
149
153
  "Primer::OpenProject::TreeView::IconPair": "",
data/static/classes.json CHANGED
@@ -619,6 +619,9 @@
619
619
  "SubHeader": [
620
620
  "Primer::OpenProject::SubHeader"
621
621
  ],
622
+ "SubHeader--emptyLeftPane": [
623
+ "Primer::OpenProject::SubHeader"
624
+ ],
622
625
  "SubHeader--expandedSearch": [
623
626
  "Primer::OpenProject::SubHeader"
624
627
  ],
@@ -1757,9 +1757,33 @@
1757
1757
  "GeneratedSlotMethods": "Primer::OpenProject::SkeletonBox::GeneratedSlotMethods"
1758
1758
  },
1759
1759
  "Primer::OpenProject::SubHeader": {
1760
+ "Button": "Primer::OpenProject::SubHeader::Button",
1761
+ "ButtonGroup": "Primer::OpenProject::SubHeader::ButtonGroup",
1762
+ "DESKTOP_ACTIONS_DISPLAY": [
1763
+ "none",
1764
+ "flex"
1765
+ ],
1760
1766
  "GeneratedSlotMethods": "Primer::OpenProject::SubHeader::GeneratedSlotMethods",
1761
1767
  "HIDDEN_FILTER_TARGET_SELECTOR": "sub-header.hiddenItemsOnExpandedFilter",
1762
- "SHOWN_FILTER_TARGET_SELECTOR": "sub-header.shownItemsOnExpandedFilter"
1768
+ "MOBILE_ACTIONS_DISPLAY": [
1769
+ "flex",
1770
+ "none"
1771
+ ],
1772
+ "Menu": "Primer::OpenProject::SubHeader::Menu",
1773
+ "SHOWN_FILTER_TARGET_SELECTOR": "sub-header.shownItemsOnExpandedFilter",
1774
+ "SegmentedControl": "Primer::OpenProject::SubHeader::SegmentedControl"
1775
+ },
1776
+ "Primer::OpenProject::SubHeader::Button": {
1777
+ "GeneratedSlotMethods": "Primer::OpenProject::SubHeader::Button::GeneratedSlotMethods"
1778
+ },
1779
+ "Primer::OpenProject::SubHeader::ButtonGroup": {
1780
+ "GeneratedSlotMethods": "Primer::OpenProject::SubHeader::ButtonGroup::GeneratedSlotMethods"
1781
+ },
1782
+ "Primer::OpenProject::SubHeader::Menu": {
1783
+ "GeneratedSlotMethods": "Primer::OpenProject::SubHeader::Menu::GeneratedSlotMethods"
1784
+ },
1785
+ "Primer::OpenProject::SubHeader::SegmentedControl": {
1786
+ "GeneratedSlotMethods": "Primer::OpenProject::SubHeader::SegmentedControl::GeneratedSlotMethods"
1763
1787
  },
1764
1788
  "Primer::OpenProject::TreeView": {
1765
1789
  "GeneratedSlotMethods": "Primer::OpenProject::TreeView::GeneratedSlotMethods",
@@ -20071,6 +20071,13 @@
20071
20071
 
20072
20072
  ]
20073
20073
  },
20074
+ {
20075
+ "name": "segmented_control",
20076
+ "description": null,
20077
+ "parameters": [
20078
+
20079
+ ]
20080
+ },
20074
20081
  {
20075
20082
  "name": "text",
20076
20083
  "description": null,
@@ -20168,6 +20175,19 @@
20168
20175
  ]
20169
20176
  }
20170
20177
  },
20178
+ {
20179
+ "preview_path": "primer/open_project/sub_header/segmented_control",
20180
+ "name": "segmented_control",
20181
+ "snapshot": "false",
20182
+ "skip_rules": {
20183
+ "wont_fix": [
20184
+ "region"
20185
+ ],
20186
+ "will_fix": [
20187
+ "color-contrast"
20188
+ ]
20189
+ }
20190
+ },
20171
20191
  {
20172
20192
  "preview_path": "primer/open_project/sub_header/bottom_pane",
20173
20193
  "name": "bottom_pane",
@@ -20199,6 +20219,231 @@
20199
20219
 
20200
20220
  ]
20201
20221
  },
20222
+ {
20223
+ "fully_qualified_name": "Primer::OpenProject::SubHeader::Button",
20224
+ "description": "A Helper class to create a Button with required icon inside the SubHeader action slot\nDo not use standalone",
20225
+ "accessibility_docs": null,
20226
+ "is_form_component": false,
20227
+ "is_published": true,
20228
+ "requires_js": false,
20229
+ "component": "OpenProject::SubHeader::Button",
20230
+ "status": "open_project",
20231
+ "a11y_reviewed": false,
20232
+ "short_name": "OpenProjectSubHeaderButton",
20233
+ "source": "https://github.com/primer/view_components/tree/main/app/components/primer/open_project/sub_header/button.rb",
20234
+ "lookbook": "https://primer.style/view-components/lookbook/inspect/primer/open_project/sub_header/button/default/",
20235
+ "parameters": [
20236
+ {
20237
+ "name": "icon",
20238
+ "type": "Symbol",
20239
+ "default": "N/A",
20240
+ "description": "The name of an {{link_to_octicons}} icon to use as leading visual"
20241
+ },
20242
+ {
20243
+ "name": "system_arguments",
20244
+ "type": "Hash",
20245
+ "default": "N/A",
20246
+ "description": "{{link_to_system_arguments_docs}}"
20247
+ }
20248
+ ],
20249
+ "slots": [
20250
+ {
20251
+ "name": "leading_visual_icon",
20252
+ "description": null,
20253
+ "parameters": [
20254
+
20255
+ ]
20256
+ }
20257
+ ],
20258
+ "methods": [
20259
+
20260
+ ],
20261
+ "previews": [
20262
+
20263
+ ],
20264
+ "subcomponents": [
20265
+
20266
+ ]
20267
+ },
20268
+ {
20269
+ "fully_qualified_name": "Primer::OpenProject::SubHeader::ButtonGroup",
20270
+ "description": "A Helper class to create ButtonGroups inside the SubHeader action slot\nDo not use standalone",
20271
+ "accessibility_docs": null,
20272
+ "is_form_component": false,
20273
+ "is_published": true,
20274
+ "requires_js": false,
20275
+ "component": "OpenProject::SubHeader::ButtonGroup",
20276
+ "status": "open_project",
20277
+ "a11y_reviewed": false,
20278
+ "short_name": "OpenProjectSubHeaderButtonGroup",
20279
+ "source": "https://github.com/primer/view_components/tree/main/app/components/primer/open_project/sub_header/button_group.rb",
20280
+ "lookbook": "https://primer.style/view-components/lookbook/inspect/primer/open_project/sub_header/button_group/default/",
20281
+ "parameters": [
20282
+ {
20283
+ "name": "scheme",
20284
+ "type": "Symbol",
20285
+ "default": "`:default`",
20286
+ "description": "DEPRECATED. One of `:danger`, `:default`, `:invisible`, `:link`, `:primary`, or `:secondary`."
20287
+ },
20288
+ {
20289
+ "name": "size",
20290
+ "type": "Symbol",
20291
+ "default": "`:medium`",
20292
+ "description": "One of `:large`, `:medium`, or `:small`."
20293
+ },
20294
+ {
20295
+ "name": "system_arguments",
20296
+ "type": "Hash",
20297
+ "default": "N/A",
20298
+ "description": "{{link_to_system_arguments_docs}}"
20299
+ }
20300
+ ],
20301
+ "slots": [
20302
+ {
20303
+ "name": "buttons",
20304
+ "description": "List of buttons to be rendered. Add buttons via the `#with_button`, `#with_menu_button`, and `#with_clipboard_copy_button` methods (see below).",
20305
+ "parameters": [
20306
+
20307
+ ]
20308
+ }
20309
+ ],
20310
+ "methods": [
20311
+
20312
+ ],
20313
+ "previews": [
20314
+
20315
+ ],
20316
+ "subcomponents": [
20317
+
20318
+ ]
20319
+ },
20320
+ {
20321
+ "fully_qualified_name": "Primer::OpenProject::SubHeader::Menu",
20322
+ "description": "A Helper class to create an ActionMenu with a required icon on the trigger button.\nIt is meant to be used inside the SubHeader\nDo not use standalone",
20323
+ "accessibility_docs": null,
20324
+ "is_form_component": false,
20325
+ "is_published": true,
20326
+ "requires_js": false,
20327
+ "component": "OpenProject::SubHeader::Menu",
20328
+ "status": "open_project",
20329
+ "a11y_reviewed": false,
20330
+ "short_name": "OpenProjectSubHeaderMenu",
20331
+ "source": "https://github.com/primer/view_components/tree/main/app/components/primer/open_project/sub_header/menu.rb",
20332
+ "lookbook": "https://primer.style/view-components/lookbook/inspect/primer/open_project/sub_header/menu/default/",
20333
+ "parameters": [
20334
+ {
20335
+ "name": "icon_only",
20336
+ "type": "Boolean",
20337
+ "default": "`false`",
20338
+ "description": "Whether the trigger button is an IconButton"
20339
+ },
20340
+ {
20341
+ "name": "leading_icon",
20342
+ "type": "Symbol",
20343
+ "default": "N/A",
20344
+ "description": "Name of Octicon icon to use as either leading icon or IconButton."
20345
+ },
20346
+ {
20347
+ "name": "label",
20348
+ "type": "String",
20349
+ "default": "N/A",
20350
+ "description": "The button label"
20351
+ },
20352
+ {
20353
+ "name": "button_arguments",
20354
+ "type": "Hash",
20355
+ "default": "`{}`",
20356
+ "description": "Additional arguments for the button"
20357
+ },
20358
+ {
20359
+ "name": "system_arguments",
20360
+ "type": "Hash",
20361
+ "default": "N/A",
20362
+ "description": "{{link_to_system_arguments_docs}}"
20363
+ }
20364
+ ],
20365
+ "slots": [
20366
+ {
20367
+ "name": "show_button",
20368
+ "description": null,
20369
+ "parameters": [
20370
+
20371
+ ]
20372
+ }
20373
+ ],
20374
+ "methods": [
20375
+
20376
+ ],
20377
+ "previews": [
20378
+
20379
+ ],
20380
+ "subcomponents": [
20381
+
20382
+ ]
20383
+ },
20384
+ {
20385
+ "fully_qualified_name": "Primer::OpenProject::SubHeader::SegmentedControl",
20386
+ "description": "A Helper class to create SegmentedControls inside the SubHeader action slot\nDo not use standalone",
20387
+ "accessibility_docs": null,
20388
+ "is_form_component": false,
20389
+ "is_published": true,
20390
+ "requires_js": false,
20391
+ "component": "OpenProject::SubHeader::SegmentedControl",
20392
+ "status": "open_project",
20393
+ "a11y_reviewed": true,
20394
+ "short_name": "OpenProjectSubHeaderSegmentedControl",
20395
+ "source": "https://github.com/primer/view_components/tree/main/app/components/primer/open_project/sub_header/segmented_control.rb",
20396
+ "lookbook": "https://primer.style/view-components/lookbook/inspect/primer/open_project/sub_header/segmented_control/default/",
20397
+ "parameters": [
20398
+ {
20399
+ "name": "hide_labels",
20400
+ "type": "Boolean",
20401
+ "default": "`false`",
20402
+ "description": "Whether to hide the labels and only show the icons"
20403
+ },
20404
+ {
20405
+ "name": "full_width",
20406
+ "type": "Boolean",
20407
+ "default": "`false`",
20408
+ "description": "If the component should be full width"
20409
+ },
20410
+ {
20411
+ "name": "size",
20412
+ "type": "Symbol",
20413
+ "default": "`:medium`",
20414
+ "description": "One of `:large`, `:medium`, or `:small`."
20415
+ },
20416
+ {
20417
+ "name": "system_arguments",
20418
+ "type": "Hash",
20419
+ "default": "N/A",
20420
+ "description": "{{link_to_system_arguments_docs}}"
20421
+ }
20422
+ ],
20423
+ "slots": [
20424
+ {
20425
+ "name": "items",
20426
+ "description": "Use to render an item in the segmented control",
20427
+ "parameters": [
20428
+ {
20429
+ "name": "system_arguments",
20430
+ "type": "Hash",
20431
+ "default": "N/A",
20432
+ "description": "{{link_to_system_arguments_docs}}"
20433
+ }
20434
+ ]
20435
+ }
20436
+ ],
20437
+ "methods": [
20438
+
20439
+ ],
20440
+ "previews": [
20441
+
20442
+ ],
20443
+ "subcomponents": [
20444
+
20445
+ ]
20446
+ },
20202
20447
  {
20203
20448
  "fully_qualified_name": "Primer::OpenProject::TreeView",
20204
20449
  "description": "TreeView is a hierarchical list of items that may have a parent-child relationship where children\ncan be toggled into view by expanding or collapsing their parent item.\n\n## Terminology\n\nConsider the following tree structure:\n\nsrc\n├ button.rb\n└ action_list\n ├ item.rb\n └ header.rb\n\n1. **Node**. A node is an item in the tree. Nodes can either be \"leaf\" nodes (i.e. have no children), or \"sub-tree\"\nnodes, which do have children. In the example above, button.rb, item.rb, and header.rb are all leaf nodes, while\naction_list is a sub-tree node.\n2. **Path**. A node's path is like its ID. It's an array of strings containing the current node's label and all the\nlabels of its ancestors, in order. In the example above, header.rb's path is [\"src\", \"action_list\", \"header.rb\"].\n\n## Static nodes\n\nThe `TreeView` component allows items to be provided statically or loaded dynamically from the server.\nProviding items statically is done using the `leaf` and `sub_tree` slots:\n\n```erb\n<%= render(Primer::OpenProject::TreeView.new) do |tree| %>\n <% tree.with_sub_tree(label: \"Directory\") do |sub_tree| %>\n <% sub_tree.with_leaf(label: \"File 1\")\n <% end %>\n <% tree.with_leaf(label: \"File 2\") %>\n<% end %>\n```\n\n## Dynamic nodes\n\nTree nodes can also be fetched dynamically from the server and will require creating a Rails controller action\nto respond with the list of nodes. Unlike other Primer components, `TreeView` allows the programmer to specify\nloading behavior on a per-sub-tree basis, i.e. each sub-tree must specify how its nodes are loaded. To load nodes\ndynamically for a given sub-tree, configure it with either a loading spinner or a loading skeleton, and provide\nthe URL to fetch nodes from:\n\n```erb\n<%= render(Primer::OpenProject::TreeView.new) do |tree| %>\n <% tree.with_sub_tree(label: \"Directory\") do |sub_tree| %>\n <% sub_tree.with_loading_spinner(src: tree_view_items_path) %>\n <% end %>\n<% end %>\n```\n\nDefine a controller action to serve the list of nodes. The `TreeView` component automatically includes the\nsub-tree's path as a GET parameter, encoded as a JSON array.\n\n```ruby\nclass TreeViewItemsController < ApplicationController\n def show\n @path = JSON.parse(params[:path])\n @results = get_tree_items(starting_at: path)\n end\nend\n```\n\nResponses must be HTML fragments, eg. have a content type of `text/html+fragment`. This content type isn't\navailable by default in Rails, so you may have to register it eg. in an initializer:\n\n```ruby\nMime::Type.register(\"text/fragment+html\", :html_fragment)\n```\n\nRender a `Primer::OpenProject::TreeView::SubTree` in the action's template, tree_view_items/show.html_fragment.erb:\n\n```erb\n<%= render(Primer::OpenProject::TreeView::SubTree.new(path: @path)) do |tree| %>\n <% tree.with_leaf(...) %>\n <% tree.with_sub_tree(...) do |sub_tree| %>\n ...\n <% end %>\n<% end %>\n```\n\n### JavaScript API\n\n`TreeView`s render a `<tree-view>` custom element that exposes behavior to the client.\n\n|Name |Notes |\n|:-----------------------------------------------------------------|:-------------------------------------------------------------------------------------------------------------------------------------------------|\n|`getNodePath(node: Element): string[]` |Returns the path to the given node. |\n|`getNodeType(node: Element): TreeViewNodeType | null` |Returns either `\"leaf\"` or `\"sub-tree\"`. |\n|`markCurrentAtPath(path: string[])` |Marks the node as the \"current\" node, which appears visually distinct from other nodes. |\n|`get currentNode(): HTMLLIElement | null` |Returns the current node. |\n|`expandAtPath(path: string[])` |Expands the sub-tree at `path`. |\n|`collapseAtPath(path: string[])` |Collapses the sub-tree at `path`. |\n|`toggleAtPath(path: string[])` |If the sub-tree at `path` is collapsed, this function expands it, and vice-versa. |\n|`checkAtPath(path: string[])` |If the node at `path` has a checkbox, this function checks it. |\n|`uncheckAtPath(path: string[])` |If the node at `path` has a checkbox, this function unchecks it. |\n|`toggleCheckedAtPath(path: string[])` |If the sub-tree at `path` is checked, this function unchecks it, and vice-versa. |\n|`checkedValueAtPath(path: string[]): TreeViewCheckedValue` |Returns `\"true\"` (all child nodes are checked), `\"false\"` (no child nodes are checked), or `\"mixed\"` (some child nodes are checked, some are not).|\n|`nodeAtPath(path: string[], selector?: string): Element | null` |Returns the node for the given `path`, either a leaf node or sub-tree node. |\n|`subTreeAtPath(path: string[]): TreeViewSubTreeNodeElement | null`|Returns the sub-tree at the given `path`, if it exists. |\n|`leafAtPath(path: string[]): HTMLLIElement | null` |Returns the leaf node at the given `path`, if it exists. |\n|`getNodeCheckedValue(node: Element): TreeViewCheckedValue` |The same as `checkedValueAtPath`, but accepts a node instead of a path. |\n\n#### Events\n\nThe events enumerated below include node information by way of the `TreeViewNodeInfo` object, which has the\nfollowing signature:\n\n```typescript\ntype TreeViewNodeType = 'leaf' | 'sub-tree'\ntype TreeViewCheckedValue = 'true' | 'false' | 'mixed'\n\ntype TreeViewNodeInfo = {\n node: Element\n type: TreeViewNodeType\n path: string[]\n checkedValue: TreeViewCheckedValue\n previousCheckedValue: TreeViewCheckedValue\n}\n```\n\n|Name |Type |Bubbles |Cancelable |\n|:----------------------------|:------------------------------------------|:-------|:----------|\n|`treeViewNodeActivated` |`CustomEvent<TreeViewNodeInfo>` |Yes |No |\n|`treeViewBeforeNodeActivated`|`CustomEvent<TreeViewNodeInfo>` |Yes |Yes |\n|`treeViewNodeExpanded` |`CustomEvent<TreeViewNodeInfo>>` |Yes |No |\n|`treeViewNodeCollapsed` |`CustomEvent<TreeViewNodeInfo>>` |Yes |No |\n|`treeViewNodeChecked` |`CustomEvent<TreeViewNodeInfo[]>` |Yes |Yes |\n|`treeViewBeforeNodeChecked` |`CustomEvent<TreeViewNodeInfo[]>` |Yes |No |\n\n_Item activation_\n\nThe `<tree-view>` element fires an `treeViewNodeActivated` event whenever a node is activated (eg. clicked)\nvia the mouse or keyboard.\n\nThe `treeViewBeforeNodeActivated` event fires before a node is activated. Canceling this event will prevent the\nnode from being activated.\n\n```typescript\ndocument.querySelector(\"select-panel\").addEventListener(\n \"treeViewBeforeNodeActivated\",\n (event: CustomEvent<TreeViewNodeInfo>) => {\n event.preventDefault() // Cancel the event to prevent activation (eg. expanding/collapsing)\n }\n)\n```\n\n_Item checking/unchecking_\n\nThe `tree-view` element fires a `treeViewNodeChecked` event whenever a node is checked or unchecked.\n\nThe `treeViewBeforeNodeChecked` event fires before a node is checked or unchecked. Canceling this event will\nprevent the check/uncheck operation.\n\n```typescript\ndocument.querySelector(\"select-panel\").addEventListener(\n \"treeViewBeforeNodeChecked\",\n (event: CustomEvent<TreeViewNodeInfo[]>) => {\n event.preventDefault() // Cancel the event to prevent activation (eg. expanding/collapsing)\n }\n)\n```\n\nBecause checking or unchecking a sub-tree results in the checking or unchecking of all its children recursively,\nboth the `treeViewNodeChecked` and `treeViewBeforeNodeChecked` events provide an array of `TreeViewNodeInfo`\nobjects, which contain entries for every modified node in the tree.",
data/static/previews.json CHANGED
@@ -7621,6 +7621,19 @@
7621
7621
  ]
7622
7622
  }
7623
7623
  },
7624
+ {
7625
+ "preview_path": "primer/open_project/sub_header/segmented_control",
7626
+ "name": "segmented_control",
7627
+ "snapshot": "false",
7628
+ "skip_rules": {
7629
+ "wont_fix": [
7630
+ "region"
7631
+ ],
7632
+ "will_fix": [
7633
+ "color-contrast"
7634
+ ]
7635
+ }
7636
+ },
7624
7637
  {
7625
7638
  "preview_path": "primer/open_project/sub_header/bottom_pane",
7626
7639
  "name": "bottom_pane",
data/static/statuses.json CHANGED
@@ -144,6 +144,10 @@
144
144
  "Primer::OpenProject::SidePanel::Section": "open_project",
145
145
  "Primer::OpenProject::SkeletonBox": "alpha",
146
146
  "Primer::OpenProject::SubHeader": "open_project",
147
+ "Primer::OpenProject::SubHeader::Button": "open_project",
148
+ "Primer::OpenProject::SubHeader::ButtonGroup": "open_project",
149
+ "Primer::OpenProject::SubHeader::Menu": "open_project",
150
+ "Primer::OpenProject::SubHeader::SegmentedControl": "open_project",
147
151
  "Primer::OpenProject::TreeView": "alpha",
148
152
  "Primer::OpenProject::TreeView::Icon": "alpha",
149
153
  "Primer::OpenProject::TreeView::IconPair": "alpha",
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.65.0
4
+ version: 0.66.1
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: 2025-05-09 00:00:00.000000000 Z
12
+ date: 2025-05-19 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: actionview
@@ -596,6 +596,10 @@ files:
596
596
  - app/components/primer/open_project/sub_header.html.erb
597
597
  - app/components/primer/open_project/sub_header.pcss
598
598
  - app/components/primer/open_project/sub_header.rb
599
+ - app/components/primer/open_project/sub_header/button.rb
600
+ - app/components/primer/open_project/sub_header/button_group.rb
601
+ - app/components/primer/open_project/sub_header/menu.rb
602
+ - app/components/primer/open_project/sub_header/segmented_control.rb
599
603
  - app/components/primer/open_project/sub_header_element.d.ts
600
604
  - app/components/primer/open_project/sub_header_element.js
601
605
  - app/components/primer/open_project/sub_header_element.ts