@rcarls/rc-listbox 0.0.0-next-20260921045401

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/CHANGELOG.md ADDED
@@ -0,0 +1,100 @@
1
+ # @rcarls/rc-listbox
2
+
3
+ ## 0.0.0-next-20260921045401
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [50d5610]
8
+ - Updated dependencies [4341311]
9
+ - @rcarls/rc-common@0.0.0-next-20260921045401
10
+
11
+ ## 0.6.0
12
+
13
+ ### Patch Changes
14
+
15
+ - Updated dependencies [6683eb9]
16
+ - Updated dependencies [ee7ba6c]
17
+ - Updated dependencies [30eb232]
18
+ - @rcarls/rc-common@0.6.0
19
+
20
+ ## 0.5.0
21
+
22
+ ### Patch Changes
23
+
24
+ - Updated dependencies [4ae2ef0]
25
+ - Updated dependencies [689340c]
26
+ - @rcarls/rc-common@0.5.0
27
+
28
+ ## 0.4.2
29
+
30
+ ### Patch Changes
31
+
32
+ - @rcarls/rc-common@0.4.2
33
+
34
+ ## 0.4.1
35
+
36
+ ### Patch Changes
37
+
38
+ - @rcarls/rc-common@0.4.1
39
+
40
+ ## 0.4.0
41
+
42
+ ### Patch Changes
43
+
44
+ - 8944083: Document the `multiple`, `checkmark`, and `filter-strategy` attributes, add
45
+ real defaults to the eight `--rc-listbox-*` option-styling custom properties
46
+ that already had one in code but not in the JSDoc, add `@example` blocks to
47
+ the `options` setter and `appendOption()`, and add the missing `checkmark`,
48
+ `value`, and `defaultValue` rows to the README's API table.
49
+ - Updated dependencies [e57277f]
50
+ - Updated dependencies [ccca8e2]
51
+ - Updated dependencies [037b1b3]
52
+ - @rcarls/rc-common@0.4.0
53
+
54
+ ## 0.3.2
55
+
56
+ ### Patch Changes
57
+
58
+ - Updated dependencies [88b4086]
59
+ - @rcarls/rc-common@0.3.2
60
+
61
+ ## 0.3.1
62
+
63
+ ### Patch Changes
64
+
65
+ - @rcarls/rc-common@0.3.1
66
+
67
+ ## 0.3.0
68
+
69
+ ### Breaking
70
+
71
+ - Render options as `<li role="option">` instead of `<div role="option">`.
72
+ - Remove `part="option-label"`.
73
+ - Move the component-owned structure into shadow DOM.
74
+
75
+ ### Added
76
+
77
+ - Add typed action option rows and discriminated `rc-listbox-change` details.
78
+ - Add progressive enhancement from a pre-rendered `<ul>` with `<li>` options.
79
+
80
+ ### Changed
81
+
82
+ - Normalize option styling around `--rc-listbox-*` custom properties.
83
+ - Inject base listbox styles into the component root.
84
+ - Update package metadata, README intro, and docs links.
85
+
86
+ ### Migration
87
+
88
+ - Update CSS selectors from `div[role="option"]` to `li[role="option"]`.
89
+ - Replace `part="option-label"` styling with selectors for the option text structure now exposed by the component.
90
+ - Query light-DOM option data from the host; do not query the component shadow root for consumer option DOM.
91
+
92
+ ### Dependencies
93
+
94
+ - Sync internal dependencies to 0.3.0.
95
+
96
+ ## 0.2.0
97
+
98
+ ### Patch Changes
99
+
100
+ - @rcarls/rc-common@0.2.0
package/README.md ADDED
@@ -0,0 +1,96 @@
1
+ # `@rcarls/rc-listbox`
2
+
3
+ Listbox that keeps option DOM in light DOM for `aria-activedescendant` navigation, following the [WAI-ARIA Listbox pattern](https://www.w3.org/WAI/ARIA/apg/patterns/listbox/).
4
+
5
+ Docs: [https://richardcarls.github.io/rc-webcomponents/components/rc-listbox](https://richardcarls.github.io/rc-webcomponents/components/rc-listbox).
6
+
7
+ `rc-listbox` is primarily an infrastructure component that can be used
8
+ directly when an application or component controls option data and selection state.
9
+
10
+ ## Installation
11
+
12
+ PowerShell:
13
+
14
+ ```powershell
15
+ yarn.cmd add @rcarls/rc-listbox
16
+ ```
17
+
18
+ Bash/zsh:
19
+
20
+ ```bash
21
+ yarn add @rcarls/rc-listbox
22
+ ```
23
+
24
+ ## Import
25
+
26
+ ```ts
27
+ import '@rcarls/rc-listbox/define';
28
+ ```
29
+
30
+ ## Basic Usage
31
+
32
+ ```ts
33
+ const listbox = document.querySelector('rc-listbox');
34
+
35
+ listbox.options = [
36
+ { value: 'apple', label: 'Apple' },
37
+ { value: 'banana', label: 'Banana' },
38
+ { value: 'cherry', label: 'Cherry', disabled: true },
39
+ ];
40
+
41
+ listbox.setSelectedValues(['apple']);
42
+ ```
43
+
44
+ Options may also represent actions instead of selectable values:
45
+
46
+ ```ts
47
+ listbox.options = [
48
+ { value: 'none', label: 'None' },
49
+ { kind: 'action', action: 'clear', value: 'clear', label: 'Clear selection' },
50
+ ];
51
+
52
+ listbox.addEventListener('rc-listbox-change', (event) => {
53
+ if (event.detail.reason === 'action') {
54
+ // event.detail.option is narrowed to ListboxActionOption
55
+ return;
56
+ }
57
+
58
+ // event.detail.option is narrowed to ListboxSelectableOption
59
+ });
60
+ ```
61
+
62
+ ## API
63
+
64
+ | Property / method | Type | Description |
65
+ | --------------------------- | ------------------------------------ | ------------------------------------------------------------ |
66
+ | `multiple` | `boolean` | Enables multi-selection and reflects `aria-multiselectable`. |
67
+ | `checkmark` | `boolean` | Renders a checkmark indicator inside each option element. |
68
+ | `filterStrategy` | `'prefix' \| 'contains' \| function` | Controls how `filterOptions()` matches labels. |
69
+ | `value` | `string \| string[]` | Current selection. Host writes update silently. |
70
+ | `defaultValue` | `string \| string[] \| undefined` | Initial uncontrolled selection. |
71
+ | `options` | `ListboxOption[]` | Replaces the rendered option list. |
72
+ | `allOptions` | `readonly ListboxOption[]` | All configured options. |
73
+ | `filteredOptions` | `readonly ListboxOption[]` | Options currently passing the filter. |
74
+ | `selectedValues` | `string[]` | Current selected values. |
75
+ | `appendOption(opt)` | `void` | Adds one option. |
76
+ | `setSelectedValues(values)` | `void` | Replaces selection without firing an event. |
77
+ | `toggleOption(value)` | `void` | Toggles selection and fires `rc-listbox-change`. |
78
+ | `clearSelection()` | `void` | Clears selected values. |
79
+ | `filterOptions(text)` | `void` | Filters visible options. |
80
+ | `clearFilter()` | `void` | Clears the active filter. |
81
+ | `navigableItems` | `Element[]` | Visible, enabled options for active-descendant navigation. |
82
+ | `setCreateOption(label)` | `void` | Shows or hides the synthetic create option. |
83
+
84
+ ## Events
85
+
86
+ | Event | Detail | Description |
87
+ | ------------------- | --------------------------------------------------------------------------------------- | ------------------------------------------------ |
88
+ | `rc-listbox-change` | `{ reason: 'select'; value; selected; option } \| { reason: 'action'; action; option }` | Fires when an option or action row is activated. |
89
+
90
+ ## Accessibility
91
+
92
+ - Host role defaults to `listbox`.
93
+ - Options render with `role="option"` and `aria-selected`.
94
+ - Disabled options render with `aria-disabled="true"` and are omitted from
95
+ `navigableItems`.
96
+ - Multi-select mode reflects `aria-multiselectable="true"`.