@xsolla/xui-multi-select 0.202.2 → 0.202.4
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/README.md +38 -51
- package/native/index.js +2 -1
- package/native/index.js.map +1 -1
- package/native/index.mjs +2 -1
- package/native/index.mjs.map +1 -1
- package/package.json +6 -6
- package/web/index.js +2 -1
- package/web/index.js.map +1 -1
- package/web/index.mjs +2 -1
- package/web/index.mjs.map +1 -1
package/README.md
CHANGED
|
@@ -3,67 +3,54 @@
|
|
|
3
3
|
A cross-platform multi-select control that lets users pick multiple options from a dropdown list.
|
|
4
4
|
|
|
5
5
|
<!-- BEGIN:xui-mcp-instructions:multi-select -->
|
|
6
|
-
|
|
6
|
+
A dropdown input that allows selecting multiple values simultaneously. Displays the current selections inside the field as text labels or removable tag chips, opens a ContextMenu with checkboxes when clicked, and supports an optional count tag when selections overflow. Built on the same trigger pattern as Select but with multi-value semantics.
|
|
7
7
|
|
|
8
8
|
### When to use
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
When
|
|
13
|
-
- When the set of options is finite and does not require freeform typing
|
|
14
|
-
- As part of a larger form or filter bar alongside other controls
|
|
9
|
+
- When the user must choose more than one value from a predefined list — multiple tags, categories, permissions, countries, features
|
|
10
|
+
- In filter bars where the user applies several filters simultaneously
|
|
11
|
+
- In forms where a many-to-many relationship must be configured (e.g. assigning roles, selecting supported platforms)
|
|
12
|
+
- When the full list of options must remain visible and re-selectable without navigating away
|
|
15
13
|
|
|
16
14
|
### When not to use
|
|
17
|
-
|
|
18
|
-
- When
|
|
19
|
-
- When the
|
|
20
|
-
- When the
|
|
21
|
-
- When the choice is a single on/off — use a Switch or Checkbox instead
|
|
22
|
-
- When the list is very long and the user mainly needs to search rather than browse — pair the field with search or reconsider the pattern
|
|
15
|
+
- When only one value can be selected at a time — use Select
|
|
16
|
+
- When the number of selectable options is very small (2–4) and all options should be permanently visible — use Checkbox group or ToggleButtonGroup
|
|
17
|
+
- When the user needs to type free-form tags or values not from a predefined list — use a tag input component
|
|
18
|
+
- When the user needs to rank or order selections — use a dedicated sortable list
|
|
23
19
|
|
|
24
20
|
### Content guidelines
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
When selections overflow a non-flexible field, collapse the remainder into a clear *"+N"* counter (e.g. *"+5"*) rather than truncating tags.
|
|
35
|
-
|
|
36
|
-
Error messages should be constructive: explain what is wrong and how to fix it (e.g. *"Select at least one option"*, not just *"Invalid input"*).
|
|
37
|
-
|
|
38
|
-
The clear-all button should appear only when at least one value is selected.
|
|
21
|
+
- Placeholder text — use a concise instructional phrase: *"Select categories"*, *"Choose platforms"*, *"Pick permissions"*. Avoid generic *"Select…"* alone.
|
|
22
|
+
- Option labels — keep each option label short (1–4 words). Use parallel structure across all options (all nouns or all short phrases). No trailing punctuation.
|
|
23
|
+
- Option order — alphabetical or most common first. Do not randomise.
|
|
24
|
+
- Count tag format — always use +N format (e.g. +3, +12). Do not spell out *"3 more"* inside a chip.
|
|
25
|
+
- Clear button — enable for optional fields. Do not show on required fields — clearing all values on a required field immediately produces a validation error.
|
|
26
|
+
- Field label — always provide a visible label above the field via FieldGroup.
|
|
27
|
+
- Error messages — be specific:
|
|
28
|
+
- *"Please select at least one category"* (required, empty on submit)
|
|
29
|
+
- *"You can select a maximum of 5 items"* (max exceeded)
|
|
39
30
|
|
|
40
31
|
### Behaviour guidelines
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
Validation timing — do not show errors before the user has interacted with the field. Validate on blur or on submit, and preserve the selected values when showing an error.
|
|
32
|
+
- Multi-select model — multiple values can be selected independently. Selecting one value does not deselect others. Unchecking an option in the ContextMenu removes it from the field.
|
|
33
|
+
- Individual removal (Tag variant) — when Variant=Tag and Remove button=true, clicking ✕ on a chip removes that specific value from the selection without reopening the dropdown. The ContextMenu reflects the change if it is open.
|
|
34
|
+
- Clear all — clicking the clear button (✕, Clear button=true) removes all selections at once and returns the field to Fill=False.
|
|
35
|
+
- Count tag — when selections overflow the visible content area, show a +N count tag. Clicking it opens the dropdown panel so the user can review all selected values.
|
|
36
|
+
- Opening — clicking the field or pressing Enter / Space / ↓ when focused opens the ContextMenu. The field enters State=Focus; the chevron rotates upward.
|
|
37
|
+
- Closing — the ContextMenu closes on: clicking outside, pressing Escape, or pressing Tab. Focus returns to the MultiSelect field.
|
|
38
|
+
- Validation — validate on blur (field loses focus with the dropdown closed) or on form submit. Show State=Error with a message if the selection is invalid (e.g. required field with no selection, or max selection exceeded).
|
|
39
|
+
- Disabled — State=Disable prevents opening the dropdown. Existing selections remain visible in muted style.
|
|
40
|
+
- ContextMenu width — the ContextMenu panel must be at least as wide as the MultiSelect field. Never open a narrower panel.
|
|
41
|
+
- Real-time update — the field content updates as the user checks/unchecks options. Do not batch updates to the field until the dropdown closes.
|
|
53
42
|
|
|
54
43
|
### Accessibility
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
Disabled fields should not receive keyboard focus; consider a read-only state if the selected values still need to be accessible.
|
|
44
|
+
- MultiSelect must have role=*"combobox"* (or role=*"button"*) with aria-haspopup=*"listbox"* and aria-expanded=*"true"* / *"false"*.
|
|
45
|
+
- The field must have an accessible name via <label for> (from FieldGroup), aria-label, or aria-labelledby.
|
|
46
|
+
- The selected values must be reflected in aria-label or as visually visible text so screen readers can announce the current state — e.g. aria-label=*"Categories: Design, Development, Marketing"*.
|
|
47
|
+
- When Variant=Tag and Remove button=true, each chip's remove button must have aria-label=*"Remove [value name]"* — e.g. aria-label=*"Remove Design"*.
|
|
48
|
+
- The count tag (+N) must have aria-label describing the hidden count — e.g. aria-label=*"3 more selected items"*.
|
|
49
|
+
- The clear button must have aria-label=*"Clear all selections"*.
|
|
50
|
+
- When State=Error, the error message must be linked via aria-describedby and in an aria-live=*"polite"* region.
|
|
51
|
+
- The ContextMenu dropdown uses role=*"listbox"* (or role=*"menu"*) with each option as role=*"option"* / role=*"menuitemcheckbox"* and aria-checked=*"true"* / *"false"*.
|
|
52
|
+
- Keyboard navigation: Enter / Space / ↓ opens the dropdown; ↑ / ↓ navigate options; Space toggles the focused option; Escape closes without further changes; Tab closes and moves focus forward.
|
|
53
|
+
- When a value is added or removed (via chip ✕ or from dropdown), announce the change via aria-live=*"polite"*: *"Design added"* or *"Design removed"*.
|
|
67
54
|
<!-- END:xui-mcp-instructions:multi-select -->
|
|
68
55
|
|
|
69
56
|
## Installation
|
package/native/index.js
CHANGED
|
@@ -1757,7 +1757,8 @@ var MultiSelect = (0, import_react10.forwardRef)(
|
|
|
1757
1757
|
style: {
|
|
1758
1758
|
maxHeight: searchable ? maxHeight - 60 : maxHeight,
|
|
1759
1759
|
overflowY: "auto",
|
|
1760
|
-
overflowX: optionListOverflowX
|
|
1760
|
+
overflowX: optionListOverflowX,
|
|
1761
|
+
scrollbarWidth: "none"
|
|
1761
1762
|
},
|
|
1762
1763
|
children: menuItems.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1763
1764
|
Box,
|