@openproject/primer-view-components 0.85.0 → 0.86.0-rc.c515bebc5
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.
- package/app/assets/javascripts/primer_view_components.js +1 -1
- package/app/assets/javascripts/primer_view_components.js.map +1 -1
- package/app/assets/styles/primer_view_components.css +1 -1
- package/app/assets/styles/primer_view_components.css.map +1 -1
- package/app/components/primer/alpha/tree_view.css +1 -1
- package/app/components/primer/alpha/tree_view.css.json +4 -1
- package/app/components/primer/open_project/filterable_tree_view.css +1 -0
- package/app/components/primer/open_project/filterable_tree_view.css.json +14 -0
- package/app/components/primer/open_project/filterable_tree_view.js +294 -5
- package/package.json +1 -1
- package/static/arguments.json +22 -0
- package/static/audited_at.json +1 -0
- package/static/classes.json +9 -0
- package/static/constants.json +9 -0
- package/static/info_arch.json +123 -1
- package/static/previews.json +39 -0
- package/static/statuses.json +1 -0
package/static/info_arch.json
CHANGED
|
@@ -4610,6 +4610,11 @@
|
|
|
4610
4610
|
"description": null,
|
|
4611
4611
|
"parameters": []
|
|
4612
4612
|
},
|
|
4613
|
+
{
|
|
4614
|
+
"name": "trailing_action",
|
|
4615
|
+
"description": null,
|
|
4616
|
+
"parameters": []
|
|
4617
|
+
},
|
|
4613
4618
|
{
|
|
4614
4619
|
"name": "trailing_visual",
|
|
4615
4620
|
"description": null,
|
|
@@ -4645,6 +4650,11 @@
|
|
|
4645
4650
|
"description": null,
|
|
4646
4651
|
"parameters": []
|
|
4647
4652
|
},
|
|
4653
|
+
{
|
|
4654
|
+
"name": "trailing_action",
|
|
4655
|
+
"description": null,
|
|
4656
|
+
"parameters": []
|
|
4657
|
+
},
|
|
4648
4658
|
{
|
|
4649
4659
|
"name": "trailing_visual",
|
|
4650
4660
|
"description": null,
|
|
@@ -10900,6 +10910,32 @@
|
|
|
10900
10910
|
"previews": [],
|
|
10901
10911
|
"subcomponents": []
|
|
10902
10912
|
},
|
|
10913
|
+
{
|
|
10914
|
+
"fully_qualified_name": "Primer::Alpha::TreeView::TrailingAction",
|
|
10915
|
+
"description": "The trailing action for `TreeView` nodes.\n\nThis component is part of the {{#link_to_component}}Primer::Alpha::TreeView{{/link_to_component}} component and should\nnot be used directly.",
|
|
10916
|
+
"accessibility_docs": null,
|
|
10917
|
+
"is_form_component": false,
|
|
10918
|
+
"is_published": true,
|
|
10919
|
+
"requires_js": false,
|
|
10920
|
+
"component": "TreeView::TrailingAction",
|
|
10921
|
+
"status": "alpha",
|
|
10922
|
+
"a11y_reviewed": false,
|
|
10923
|
+
"short_name": "TreeViewTrailingAction",
|
|
10924
|
+
"source": "https://github.com/primer/view_components/tree/main/app/components/primer/alpha/tree_view/trailing_action.rb",
|
|
10925
|
+
"lookbook": "https://primer.style/view-components/lookbook/inspect/primer/alpha/tree_view/trailing_action/default/",
|
|
10926
|
+
"parameters": [
|
|
10927
|
+
{
|
|
10928
|
+
"name": "action",
|
|
10929
|
+
"type": "ViewComponent::Base",
|
|
10930
|
+
"default": "N/A",
|
|
10931
|
+
"description": "A component or other renderable to use as the action button etc."
|
|
10932
|
+
}
|
|
10933
|
+
],
|
|
10934
|
+
"slots": [],
|
|
10935
|
+
"methods": [],
|
|
10936
|
+
"previews": [],
|
|
10937
|
+
"subcomponents": []
|
|
10938
|
+
},
|
|
10903
10939
|
{
|
|
10904
10940
|
"fully_qualified_name": "Primer::Alpha::TreeView::SubTreeContainer",
|
|
10905
10941
|
"description": "This component is part of the {{#link_to_component}}Primer::Alpha::TreeView{{/link_to_component}} component and should\nnot be used directly.",
|
|
@@ -11240,6 +11276,11 @@
|
|
|
11240
11276
|
"description": "Generic leading action slot",
|
|
11241
11277
|
"parameters": []
|
|
11242
11278
|
},
|
|
11279
|
+
{
|
|
11280
|
+
"name": "trailing_action",
|
|
11281
|
+
"description": "Generic trailing action slot",
|
|
11282
|
+
"parameters": []
|
|
11283
|
+
},
|
|
11243
11284
|
{
|
|
11244
11285
|
"name": "leading_visual",
|
|
11245
11286
|
"description": "Generic leading visual slot",
|
|
@@ -11545,6 +11586,11 @@
|
|
|
11545
11586
|
"description": null,
|
|
11546
11587
|
"parameters": []
|
|
11547
11588
|
},
|
|
11589
|
+
{
|
|
11590
|
+
"name": "trailing_action",
|
|
11591
|
+
"description": null,
|
|
11592
|
+
"parameters": []
|
|
11593
|
+
},
|
|
11548
11594
|
{
|
|
11549
11595
|
"name": "trailing_visual",
|
|
11550
11596
|
"description": null,
|
|
@@ -11584,6 +11630,19 @@
|
|
|
11584
11630
|
],
|
|
11585
11631
|
"return_types": []
|
|
11586
11632
|
},
|
|
11633
|
+
{
|
|
11634
|
+
"name": "with_trailing_action_button",
|
|
11635
|
+
"description": "Adds a trailing action rendered to the right of the node's content.",
|
|
11636
|
+
"parameters": [
|
|
11637
|
+
{
|
|
11638
|
+
"name": "system_arguments",
|
|
11639
|
+
"type": "Hash",
|
|
11640
|
+
"default": "N/A",
|
|
11641
|
+
"description": "The arguments accepted by {{#link_to_component}}Primer::Beta::IconButton{{/link_to_component}}."
|
|
11642
|
+
}
|
|
11643
|
+
],
|
|
11644
|
+
"return_types": []
|
|
11645
|
+
},
|
|
11587
11646
|
{
|
|
11588
11647
|
"name": "with_trailing_visual_icon",
|
|
11589
11648
|
"description": "Adds a trailing visual icon rendered to the right of the node's label.",
|
|
@@ -11675,6 +11734,11 @@
|
|
|
11675
11734
|
"description": null,
|
|
11676
11735
|
"parameters": []
|
|
11677
11736
|
},
|
|
11737
|
+
{
|
|
11738
|
+
"name": "trailing_action",
|
|
11739
|
+
"description": null,
|
|
11740
|
+
"parameters": []
|
|
11741
|
+
},
|
|
11678
11742
|
{
|
|
11679
11743
|
"name": "trailing_visual",
|
|
11680
11744
|
"description": null,
|
|
@@ -11733,6 +11797,19 @@
|
|
|
11733
11797
|
],
|
|
11734
11798
|
"return_types": []
|
|
11735
11799
|
},
|
|
11800
|
+
{
|
|
11801
|
+
"name": "with_trailing_action_button",
|
|
11802
|
+
"description": "Adds a trailing action rendered to the right of the node's content.",
|
|
11803
|
+
"parameters": [
|
|
11804
|
+
{
|
|
11805
|
+
"name": "system_arguments",
|
|
11806
|
+
"type": "Hash",
|
|
11807
|
+
"default": "N/A",
|
|
11808
|
+
"description": "The arguments accepted by {{#link_to_component}}Primer::Beta::IconButton{{/link_to_component}}."
|
|
11809
|
+
}
|
|
11810
|
+
],
|
|
11811
|
+
"return_types": []
|
|
11812
|
+
},
|
|
11736
11813
|
{
|
|
11737
11814
|
"name": "with_trailing_visual_icon",
|
|
11738
11815
|
"description": "Adds a trailing visual icon rendered to the right of the node's label.",
|
|
@@ -20273,7 +20350,7 @@
|
|
|
20273
20350
|
},
|
|
20274
20351
|
{
|
|
20275
20352
|
"fully_qualified_name": "Primer::OpenProject::FilterableTreeView",
|
|
20276
|
-
"description": "A TreeView and associated filter controls for searching nested hierarchies.\n\n## Filter controls\n\n`FilterableTreeView`s can be filtered using two controls, both present in the toolbar above the tree:\n\n1. A free-form query string from a text input field.\n2. A `SegmentedControl` with two options (by default):\n 1. The \"Selected\" option causes the component to only show checked nodes, provided they also satisfy the other\n filter criteria described here.\n 2. The \"All\" option causes the component to show all nodes, provided they also satisfy the other filter\n criteria described here.\n\n## Custom filter modes\n\nIn addition to the default filter modes of `'all'` and `'selected'` described above, `FilterableTreeView` supports\nadding custom filter modes. Adding a filter mode will cause its label to appear in the `SegmentedControl` in the\ntoolbar, and will be passed as the third argument to the filter function (see below).\n\nHere's how to add a custom filter mode in addition to the default ones:\n\n```erb\n<%= render(Primer::OpenProject::FilterableTreeView.new) do |tree_view| %>\n <%# remove this line to prevent adding the default modes %>\n <% tree_view.with_default_filter_modes %>\n <% tree_view.with_filter_mode(name: \"Custom\", system_arguments)\n<% end %>\n```\n\n## Filter behavior\n\nBy default, matching node text is identified by looking for an exact substring match, operating on a lowercased\nversion of both the query string and the node text. For more information, and to provide a customized filter\nfunction, please see the section titled \"Customizing the filter function\" below.\n\nNodes that match the filter appear as normal; nodes that do not match are presented as follows:\n\n1. Leaf nodes are hidden.\n2. Sub-tree nodes with no matching children are hidden.\n3. Sub-tree nodes with at least one matching child are disabled but still visible.\n\n## Checking behavior\n\nBy default, checking a node in a `FilterableTreeView` checks only that node (i.e. no child nodes are checked).\nTo aide in checking children in deeply nested or highly populated hierarchies, a third control exists in the\ntoolbar: the \"Include sub-items\" check box. If this feature is turned on, checking sub-tree nodes causes all\nchildren, both leaf and sub-tree nodes, to also be checked recursively. Moreover, turning this feature on will\ncause the children of any previously checked nodes to be checked recursively. Unchecking a node while in\n\"Include sub-items\" mode will restore that sub-tree and all its children to their previously checked state, so as\nnot to permanently override a user's selections. Unchecking the \"Include sub-items\" check box has a similar effect,\ni.e. restores all previous user selections under currently checked sub-trees.\n\n## JavaScript API\n\n`FilterableTreeView` does not yet have an extensive JavaScript API, but this may change in the future as the\ncomponent is further developed to fit additional use-cases.\n\n### Customizing the filter function\n\nThe filter function can be customized by setting the value of the `filterFn` property to a function with the\nfollowing signature:\n\n```typescript\nexport type FilterFn = (node: HTMLElement, query: string, filterMode?: string) => Range[] | null\n```\n\nThis function will be called once for each node in the tree every time filter controls change (i.e. when the\nfilter mode or query string are altered). The function is called with the following arguments:\n\n|Argument |Description |\n|:-----------|:----------------------------------------------------------------|\n|`node` |The HTML node element, i.e. the element with `role=treeitem` set.|\n|`query` |The query string. |\n|`filterMode`|The filter mode, either `'all'` or `'selected'`. |\n\nThe component expects the filter function to return specific values depending on the type of match:\n\n1. No match - return `null`\n2. Match but no highlights (eg. when the query string is empty) - return an empty array\n3. Match with highlights - return a non-empty array of `Range` objects\n\nExample:\n\n```javascript\nconst filterableTreeView = document.querySelector('filterable-tree-view')\nfilterableTreeView.filterFn = (node, query, filterMode) => {\n // custom filter implementation here\n}\n```\n\nYou can read about `Range` objects here: https://developer.mozilla.org/en-US/docs/Web/API/Range.\n\nFor a complete example demonstrating how to implement a working filter function complete with range highlighting,\nsee the default filter function available in the `FilterableTreeViewElement` JavaScript class, which is part of\nthe Primer source code.\n\n### Events\n\nCurrently `FilterableTreeView` does not emit any events aside from the events already emitted by the `TreeView`\ncomponent.",
|
|
20353
|
+
"description": "A TreeView and associated filter controls for searching nested hierarchies.\n\n## Filter controls\n\n`FilterableTreeView`s can be filtered using two controls, both present in the toolbar above the tree:\n\n1. A free-form query string from a text input field.\n2. A `SegmentedControl` with two options (by default):\n 1. The \"Selected\" option causes the component to only show checked nodes, provided they also satisfy the other\n filter criteria described here.\n 2. The \"All\" option causes the component to show all nodes, provided they also satisfy the other filter\n criteria described here.\n\n## Custom filter modes\n\nIn addition to the default filter modes of `'all'` and `'selected'` described above, `FilterableTreeView` supports\nadding custom filter modes. Adding a filter mode will cause its label to appear in the `SegmentedControl` in the\ntoolbar, and will be passed as the third argument to the filter function (see below).\n\nHere's how to add a custom filter mode in addition to the default ones:\n\n```erb\n<%= render(Primer::OpenProject::FilterableTreeView.new) do |tree_view| %>\n <%# remove this line to prevent adding the default modes %>\n <% tree_view.with_default_filter_modes %>\n <% tree_view.with_filter_mode(name: \"Custom\", system_arguments)\n<% end %>\n```\n\n## Filter behavior\n\nBy default, matching node text is identified by looking for an exact substring match, operating on a lowercased\nversion of both the query string and the node text. For more information, and to provide a customized filter\nfunction, please see the section titled \"Customizing the filter function\" below.\n\nNodes that match the filter appear as normal; nodes that do not match are presented as follows:\n\n1. Leaf nodes are hidden.\n2. Sub-tree nodes with no matching children are hidden.\n3. Sub-tree nodes with at least one matching child are disabled but still visible.\n\n## Checking behavior\n\nBy default, checking a node in a `FilterableTreeView` checks only that node (i.e. no child nodes are checked).\nTo aide in checking children in deeply nested or highly populated hierarchies, a third control exists in the\ntoolbar: the \"Include sub-items\" check box. If this feature is turned on, checking sub-tree nodes causes all\nchildren, both leaf and sub-tree nodes, to also be checked recursively. Moreover, turning this feature on will\ncause the children of any previously checked nodes to be checked recursively. Unchecking a node while in\n\"Include sub-items\" mode will restore that sub-tree and all its children to their previously checked state, so as\nnot to permanently override a user's selections. Unchecking the \"Include sub-items\" check box has a similar effect,\ni.e. restores all previous user selections under currently checked sub-trees.\n\n## JavaScript API\n\n`FilterableTreeView` does not yet have an extensive JavaScript API, but this may change in the future as the\ncomponent is further developed to fit additional use-cases.\n\n### Customizing the filter function\n\nThe filter function can be customized by setting the value of the `filterFn` property to a function with the\nfollowing signature:\n\n```typescript\nexport type FilterFn = (node: HTMLElement, query: string, filterMode?: string) => Range[] | null\n```\n\nThis function will be called once for each node in the tree every time filter controls change (i.e. when the\nfilter mode or query string are altered). The function is called with the following arguments:\n\n|Argument |Description |\n|:-----------|:----------------------------------------------------------------|\n|`node` |The HTML node element, i.e. the element with `role=treeitem` set.|\n|`query` |The query string. |\n|`filterMode`|The filter mode, either `'all'` or `'selected'`. |\n\nThe component expects the filter function to return specific values depending on the type of match:\n\n1. No match - return `null`\n2. Match but no highlights (eg. when the query string is empty) - return an empty array\n3. Match with highlights - return a non-empty array of `Range` objects\n\nExample:\n\n```javascript\nconst filterableTreeView = document.querySelector('filterable-tree-view')\nfilterableTreeView.filterFn = (node, query, filterMode) => {\n // custom filter implementation here\n}\n```\n\nYou can read about `Range` objects here: https://developer.mozilla.org/en-US/docs/Web/API/Range.\n\nFor a complete example demonstrating how to implement a working filter function complete with range highlighting,\nsee the default filter function available in the `FilterableTreeViewElement` JavaScript class, which is part of\nthe Primer source code.\n\n### Events\n\nCurrently `FilterableTreeView` does not emit any events aside from the events already emitted by the `TreeView`\ncomponent.\n\n## Async loading strategy\n\nWhen `src` is set on the component, all filter interactions (text input, filter mode changes) trigger a debounced\nserver request instead of client-side filtering. The server is responsible for returning a filtered `<tree-view>`\nHTML fragment that replaces the current tree.\n\n### Behavior\n\n- The full tree is loaded initially from the server via `src`.\n- Each filter input event triggers a debounced (300 ms) request to the server.\n- The server returns a filtered `<tree-view>` element which replaces the existing one.\n- All matching results and their full ancestor hierarchy are expanded automatically.\n- Matching text is highlighted using the CSS Custom Highlight API (or `<mark>` fallback).\n- When the filter is cleared, the tree is replaced with the full (unfiltered) result from\n the server and the expansion state from before the search is restored.\n- Checked nodes are preserved across tree replacements using `data-node-id` attributes.\n- When \"include sub-items\" is active and the tree is filtered, clicking a parent node\n selects ALL its descendants (not just the visible filtered ones). Therefore, \"include_sub_items\" is passed\n to the server, since it holds the only truth about the data.\n\n### Server endpoint\n\nThe server endpoint must return a `<tree-view>` HTML fragment. Each node must have a stable\n`data-node-id` on its `[role=treeitem]` element.\n\n### Usage\n\n```erb\n<%= render(Primer::OpenProject::FilterableTreeView.new(\n src: my_path\n)) %>\n```",
|
|
20277
20354
|
"accessibility_docs": null,
|
|
20278
20355
|
"is_form_component": false,
|
|
20279
20356
|
"is_published": true,
|
|
@@ -20285,6 +20362,12 @@
|
|
|
20285
20362
|
"source": "https://github.com/primer/view_components/tree/main/app/components/primer/open_project/filterable_tree_view.rb",
|
|
20286
20363
|
"lookbook": "https://primer.style/view-components/lookbook/inspect/primer/open_project/filterable_tree_view/default/",
|
|
20287
20364
|
"parameters": [
|
|
20365
|
+
{
|
|
20366
|
+
"name": "src",
|
|
20367
|
+
"type": "String",
|
|
20368
|
+
"default": "`nil`",
|
|
20369
|
+
"description": "URL of the server endpoint that returns a filtered `<tree-view>` HTML fragment. When set, activates async (server-side) filtering mode. See \"Async loading strategy\" above."
|
|
20370
|
+
},
|
|
20288
20371
|
{
|
|
20289
20372
|
"name": "tree_view_arguments",
|
|
20290
20373
|
"type": "Hash",
|
|
@@ -20403,6 +20486,45 @@
|
|
|
20403
20486
|
]
|
|
20404
20487
|
}
|
|
20405
20488
|
},
|
|
20489
|
+
{
|
|
20490
|
+
"preview_path": "primer/open_project/filterable_tree_view/async",
|
|
20491
|
+
"name": "async",
|
|
20492
|
+
"snapshot": "false",
|
|
20493
|
+
"skip_rules": {
|
|
20494
|
+
"wont_fix": [
|
|
20495
|
+
"region"
|
|
20496
|
+
],
|
|
20497
|
+
"will_fix": [
|
|
20498
|
+
"color-contrast"
|
|
20499
|
+
]
|
|
20500
|
+
}
|
|
20501
|
+
},
|
|
20502
|
+
{
|
|
20503
|
+
"preview_path": "primer/open_project/filterable_tree_view/async_form_input",
|
|
20504
|
+
"name": "async_form_input",
|
|
20505
|
+
"snapshot": "false",
|
|
20506
|
+
"skip_rules": {
|
|
20507
|
+
"wont_fix": [
|
|
20508
|
+
"region"
|
|
20509
|
+
],
|
|
20510
|
+
"will_fix": [
|
|
20511
|
+
"color-contrast"
|
|
20512
|
+
]
|
|
20513
|
+
}
|
|
20514
|
+
},
|
|
20515
|
+
{
|
|
20516
|
+
"preview_path": "primer/open_project/filterable_tree_view/link_nodes",
|
|
20517
|
+
"name": "link_nodes",
|
|
20518
|
+
"snapshot": "false",
|
|
20519
|
+
"skip_rules": {
|
|
20520
|
+
"wont_fix": [
|
|
20521
|
+
"region"
|
|
20522
|
+
],
|
|
20523
|
+
"will_fix": [
|
|
20524
|
+
"color-contrast"
|
|
20525
|
+
]
|
|
20526
|
+
}
|
|
20527
|
+
},
|
|
20406
20528
|
{
|
|
20407
20529
|
"preview_path": "primer/open_project/filterable_tree_view/hide_checkbox",
|
|
20408
20530
|
"name": "hide_checkbox",
|
package/static/previews.json
CHANGED
|
@@ -4502,6 +4502,45 @@
|
|
|
4502
4502
|
]
|
|
4503
4503
|
}
|
|
4504
4504
|
},
|
|
4505
|
+
{
|
|
4506
|
+
"preview_path": "primer/open_project/filterable_tree_view/async",
|
|
4507
|
+
"name": "async",
|
|
4508
|
+
"snapshot": "false",
|
|
4509
|
+
"skip_rules": {
|
|
4510
|
+
"wont_fix": [
|
|
4511
|
+
"region"
|
|
4512
|
+
],
|
|
4513
|
+
"will_fix": [
|
|
4514
|
+
"color-contrast"
|
|
4515
|
+
]
|
|
4516
|
+
}
|
|
4517
|
+
},
|
|
4518
|
+
{
|
|
4519
|
+
"preview_path": "primer/open_project/filterable_tree_view/async_form_input",
|
|
4520
|
+
"name": "async_form_input",
|
|
4521
|
+
"snapshot": "false",
|
|
4522
|
+
"skip_rules": {
|
|
4523
|
+
"wont_fix": [
|
|
4524
|
+
"region"
|
|
4525
|
+
],
|
|
4526
|
+
"will_fix": [
|
|
4527
|
+
"color-contrast"
|
|
4528
|
+
]
|
|
4529
|
+
}
|
|
4530
|
+
},
|
|
4531
|
+
{
|
|
4532
|
+
"preview_path": "primer/open_project/filterable_tree_view/link_nodes",
|
|
4533
|
+
"name": "link_nodes",
|
|
4534
|
+
"snapshot": "false",
|
|
4535
|
+
"skip_rules": {
|
|
4536
|
+
"wont_fix": [
|
|
4537
|
+
"region"
|
|
4538
|
+
],
|
|
4539
|
+
"will_fix": [
|
|
4540
|
+
"color-contrast"
|
|
4541
|
+
]
|
|
4542
|
+
}
|
|
4543
|
+
},
|
|
4505
4544
|
{
|
|
4506
4545
|
"preview_path": "primer/open_project/filterable_tree_view/hide_checkbox",
|
|
4507
4546
|
"name": "hide_checkbox",
|
package/static/statuses.json
CHANGED
|
@@ -84,6 +84,7 @@
|
|
|
84
84
|
"Primer::Alpha::TreeView::SubTree": "alpha",
|
|
85
85
|
"Primer::Alpha::TreeView::SubTreeContainer": "alpha",
|
|
86
86
|
"Primer::Alpha::TreeView::SubTreeNode": "alpha",
|
|
87
|
+
"Primer::Alpha::TreeView::TrailingAction": "alpha",
|
|
87
88
|
"Primer::Alpha::TreeView::Visual": "alpha",
|
|
88
89
|
"Primer::Alpha::UnderlineNav": "alpha",
|
|
89
90
|
"Primer::Alpha::UnderlinePanels": "alpha",
|