@openproject/primer-view-components 0.89.2-rc.f4c974eb0 → 0.89.2
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/action_bar.css +1 -1
- package/app/components/primer/alpha/action_list.css +1 -1
- package/app/components/primer/alpha/action_list.css.json +4 -10
- package/app/components/primer/alpha/auto_complete.css +1 -1
- package/app/components/primer/alpha/banner.css +1 -1
- package/app/components/primer/alpha/button_marketing.css +1 -1
- package/app/components/primer/alpha/dialog.css +1 -1
- package/app/components/primer/alpha/dialog.css.json +2 -1
- package/app/components/primer/alpha/dropdown.css +1 -1
- package/app/components/primer/alpha/layout.css +1 -1
- package/app/components/primer/alpha/layout.css.json +10 -14
- package/app/components/primer/alpha/menu.css +1 -1
- package/app/components/primer/alpha/overlay.css +1 -1
- package/app/components/primer/alpha/segmented_control.css +1 -1
- package/app/components/primer/alpha/segmented_control.css.json +1 -2
- package/app/components/primer/alpha/select_panel.css +1 -1
- package/app/components/primer/alpha/skeleton_box.css +1 -1
- package/app/components/primer/alpha/stack.css +1 -1
- package/app/components/primer/alpha/tab_nav.css +1 -1
- package/app/components/primer/alpha/text_field.css +1 -1
- package/app/components/primer/alpha/text_field.css.json +1 -2
- package/app/components/primer/alpha/toggle_switch.css +1 -1
- package/app/components/primer/alpha/tree_view.css +1 -1
- package/app/components/primer/alpha/tree_view.css.json +2 -2
- package/app/components/primer/alpha/underline_nav.css +1 -1
- package/app/components/primer/beta/avatar.css +1 -1
- package/app/components/primer/beta/avatar_stack.css +1 -1
- package/app/components/primer/beta/blankslate.css +1 -1
- package/app/components/primer/beta/border_box.css +1 -1
- package/app/components/primer/beta/breadcrumbs.css +1 -1
- package/app/components/primer/beta/button.css +1 -1
- package/app/components/primer/beta/button_group.css +1 -1
- package/app/components/primer/beta/counter.css +1 -1
- package/app/components/primer/beta/flash.css +1 -1
- package/app/components/primer/beta/label.css +1 -1
- package/app/components/primer/beta/link.css +1 -1
- package/app/components/primer/beta/popover.css +1 -1
- package/app/components/primer/beta/progress_bar.css +1 -1
- package/app/components/primer/beta/state.css +1 -1
- package/app/components/primer/beta/subhead.css +1 -1
- package/app/components/primer/beta/timeline_item.css +1 -1
- package/app/components/primer/beta/truncate.css +1 -1
- package/app/components/primer/dialog_helper.js +10 -1
- package/app/components/primer/open_project/border_box/collapsible_header.css +1 -1
- package/app/components/primer/open_project/border_box/collapsible_header.css.json +1 -3
- package/app/components/primer/open_project/border_grid.css +1 -1
- package/app/components/primer/open_project/drag_handle.css +1 -1
- package/app/components/primer/open_project/filterable_tree_view.css +1 -1
- package/app/components/primer/open_project/inline_message.css +1 -1
- package/app/components/primer/open_project/page_header.css +1 -1
- package/app/components/primer/open_project/pagination.css +1 -1
- package/app/components/primer/open_project/side_panel/section.css +1 -1
- package/app/components/primer/open_project/sub_header.css +1 -1
- package/package.json +3 -3
- package/static/info_arch.json +21 -2
- package/static/previews.json +13 -0
package/static/info_arch.json
CHANGED
|
@@ -20375,7 +20375,7 @@
|
|
|
20375
20375
|
},
|
|
20376
20376
|
{
|
|
20377
20377
|
"fully_qualified_name": "Primer::OpenProject::FilterableTreeView",
|
|
20378
|
-
"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```",
|
|
20378
|
+
"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)) do |tree_view| %>\n <% tree_view.with_loading_indicator do %>\n <%= render(Primer::Beta::Spinner.new) %>\n <% end %>\n<% end %>\n```",
|
|
20379
20379
|
"accessibility_docs": null,
|
|
20380
20380
|
"is_form_component": false,
|
|
20381
20381
|
"is_published": true,
|
|
@@ -20436,7 +20436,13 @@
|
|
|
20436
20436
|
"description": "Arguments that will be passed to a {{#link_to_component}}Primer::Alpha::TreeView::LeafNode{{/link_to_component}} component that appears when no items match the filter criteria."
|
|
20437
20437
|
}
|
|
20438
20438
|
],
|
|
20439
|
-
"slots": [
|
|
20439
|
+
"slots": [
|
|
20440
|
+
{
|
|
20441
|
+
"name": "loading_indicator",
|
|
20442
|
+
"description": "An optional loading indicator shown while an async filter request is in progress. When omitted, a skeleton\nloader is rendered. This slot is only used when `src` is set.",
|
|
20443
|
+
"parameters": []
|
|
20444
|
+
}
|
|
20445
|
+
],
|
|
20440
20446
|
"methods": [],
|
|
20441
20447
|
"previews": [
|
|
20442
20448
|
{
|
|
@@ -20530,6 +20536,19 @@
|
|
|
20530
20536
|
]
|
|
20531
20537
|
}
|
|
20532
20538
|
},
|
|
20539
|
+
{
|
|
20540
|
+
"preview_path": "primer/open_project/filterable_tree_view/async_custom_loading_indicator",
|
|
20541
|
+
"name": "async_custom_loading_indicator",
|
|
20542
|
+
"snapshot": "false",
|
|
20543
|
+
"skip_rules": {
|
|
20544
|
+
"wont_fix": [
|
|
20545
|
+
"region"
|
|
20546
|
+
],
|
|
20547
|
+
"will_fix": [
|
|
20548
|
+
"color-contrast"
|
|
20549
|
+
]
|
|
20550
|
+
}
|
|
20551
|
+
},
|
|
20533
20552
|
{
|
|
20534
20553
|
"preview_path": "primer/open_project/filterable_tree_view/async_server_highlights",
|
|
20535
20554
|
"name": "async_server_highlights",
|
package/static/previews.json
CHANGED
|
@@ -4515,6 +4515,19 @@
|
|
|
4515
4515
|
]
|
|
4516
4516
|
}
|
|
4517
4517
|
},
|
|
4518
|
+
{
|
|
4519
|
+
"preview_path": "primer/open_project/filterable_tree_view/async_custom_loading_indicator",
|
|
4520
|
+
"name": "async_custom_loading_indicator",
|
|
4521
|
+
"snapshot": "false",
|
|
4522
|
+
"skip_rules": {
|
|
4523
|
+
"wont_fix": [
|
|
4524
|
+
"region"
|
|
4525
|
+
],
|
|
4526
|
+
"will_fix": [
|
|
4527
|
+
"color-contrast"
|
|
4528
|
+
]
|
|
4529
|
+
}
|
|
4530
|
+
},
|
|
4518
4531
|
{
|
|
4519
4532
|
"preview_path": "primer/open_project/filterable_tree_view/async_server_highlights",
|
|
4520
4533
|
"name": "async_server_highlights",
|