@xsolla/xui-slider 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 +29 -41
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -2,59 +2,47 @@
|
|
|
2
2
|
|
|
3
3
|
A cross-platform React slider component for selecting values within a range. Supports single value, range mode with two thumbs, and optional input fields for direct value entry.
|
|
4
4
|
<!-- BEGIN:xui-mcp-instructions:slider -->
|
|
5
|
-
|
|
5
|
+
A control that lets users set a value by dragging a thumb along a track. The filled portion of the track shows the current magnitude, giving immediate visual feedback. With Range=True the slider has two thumbs, letting users define a span between a minimum and a maximum.
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
Slider is a pure track-and-thumb component. It has no built-in label, value readout, or numeric input — these must be provided by the surrounding layout or via InputRange which composes the Slider with editable input fields.
|
|
8
8
|
|
|
9
|
-
When
|
|
9
|
+
### When to use
|
|
10
|
+
- When the user adjusts a value along a continuous or stepped scale and quick, approximate setting matters more than exact entry — volume, brightness, opacity, zoom level
|
|
10
11
|
- When seeing the magnitude visually helps the user judge the choice
|
|
11
|
-
- When filtering by a numeric range — use Range
|
|
12
|
+
- When filtering by a numeric range — use Range=True for a min–max span (e.g. price filter, age range, score threshold)
|
|
12
13
|
|
|
13
14
|
### When not to use
|
|
14
|
-
|
|
15
|
-
When the
|
|
16
|
-
|
|
17
|
-
When the choice is a small set of discrete, named options — use a SegmentedControl or Radio buttons instead or MultiSelect
|
|
18
|
-
- When the control is a simple on/off — use a Switch instead
|
|
15
|
+
- When the user needs to enter a precise or exact number — use a numeric InputRange field instead
|
|
16
|
+
- When the choice is a small set of discrete, named options — use ToggleButtonGroup, Radio buttons, or Select
|
|
17
|
+
- When the control is a simple on/off — use a Switch
|
|
19
18
|
- When the value has no meaningful continuous or ordered scale
|
|
20
19
|
|
|
21
20
|
### Content guidelines
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
Display the minimum and maximum bounds when they aren't obvious, so users understand the range.
|
|
28
|
-
|
|
29
|
-
For Range: True, expose both values (lower and upper) so the selected span is always clear.
|
|
30
|
-
|
|
31
|
-
Keep the scale meaningful: choose a step that matches how precisely the user actually needs to set the value.
|
|
21
|
+
- Label — always provide a visible label above or beside the slider. Do not rely on the thumb position alone to communicate what is being controlled.
|
|
22
|
+
- Value readout — show the current value numerically alongside the slider. Include units: *"70%"*, *"$1,200"*, *"2.5 MB"*.
|
|
23
|
+
- Range readout — for Range=True, always show both the lower and upper values so the selected span is always clear.
|
|
24
|
+
- Min / max markers — show the scale boundaries when they are not obvious from context. Use short labels or numeric values: 0, 100, $0, $10,000.
|
|
25
|
+
- Step clarity — if the step size is non-obvious (e.g. jumps of 5 on a 0–100 scale), communicate this in helper text: *"Adjustable in steps of 5"*.
|
|
32
26
|
|
|
33
27
|
### Behaviour guidelines
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
Disabled — the disabled state is dimmed and non-interactive; the thumb cannot be dragged or focused.
|
|
28
|
+
- Setting a value — the user drags the thumb or clicks anywhere on the track; the filled portion and thumb position update immediately to reflect the new value.
|
|
29
|
+
- Track click — clicking anywhere on the inactive track (not on the thumb) moves the nearest thumb to that position. For Range=True, click snaps to the closer of the two thumbs.
|
|
30
|
+
- Fullness direction — the fill grows from the start of the track (left in LTR) to the thumb for Range=False, and between the two thumbs for Range=True.
|
|
31
|
+
- Live feedback — reflect the current value in real time while dragging. Show the exact value in a tooltip over the thumb or in a nearby readout — do not make users guess from thumb position alone.
|
|
32
|
+
- Step size — define a step appropriate to the data domain (e.g. 1 for percentages, 5 for large ranges). Choose a step that matches how precisely the user actually needs to set the value.
|
|
33
|
+
- Value readout — Slider has no built-in label or value display. Always pair it with a visible label and a readout of the current value outside the component. Show units where relevant (e.g. *"70%"*, *"$1,200"*).
|
|
34
|
+
- Min / max labels — display the minimum and maximum bounds adjacent to the track when they aren't obvious, so users understand the scale.
|
|
35
|
+
- Disabled state — the disabled state is dimmed and non-interactive; the thumb cannot be dragged or focused. If the current value still needs to be communicated, consider a read-only presentation instead.
|
|
44
36
|
|
|
45
37
|
### Accessibility
|
|
46
|
-
|
|
47
|
-
Each thumb must be keyboard-operable:
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
Never rely on the fill color alone to communicate the value — always provide a textual readout and an associated label.
|
|
56
|
-
|
|
57
|
-
Disabled sliders should not receive keyboard focus; consider a read-only presentation if the value still needs to be conveyed.
|
|
38
|
+
- Each thumb must have role=*"slider"* with aria-valuemin, aria-valuemax, aria-valuenow, and aria-valuetext (for a human-readable value with units, e.g. *"70%"* or *"$200"*).
|
|
39
|
+
- Each thumb must be keyboard-operable: ← / ↓ decrements by one step; → / ↑ increments by one step; Home jumps to the minimum; End jumps to the maximum. Page Down / Page Up can move by a larger step (e.g. 10% of range).
|
|
40
|
+
- For Range=True, each thumb must be separately focusable and clearly labelled — e.g. aria-label=*"Minimum price"* and aria-label=*"Maximum price"*.
|
|
41
|
+
- Show a visible focus indicator on the active thumb (:focus-visible ring).
|
|
42
|
+
- Never rely on the fill colour alone to communicate the value — always provide a textual readout and an associated label (WCAG 1.4.1).
|
|
43
|
+
- State=Disable thumbs must not receive keyboard focus. Use aria-disabled=*"true"* and tabindex=*"-1"* on the thumb element.
|
|
44
|
+
- When the value changes via keyboard or drag, update aria-valuenow and aria-valuetext so screen readers announce the new value.
|
|
45
|
+
- Wrap the slider and its label in a container with role=*"group"* and aria-label when the slider is part of a form (e.g. aria-label=*"Price range filter"*).
|
|
58
46
|
<!-- END:xui-mcp-instructions:slider -->
|
|
59
47
|
|
|
60
48
|
## Installation
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xsolla/xui-slider",
|
|
3
|
-
"version": "0.202.
|
|
3
|
+
"version": "0.202.4",
|
|
4
4
|
"main": "./web/index.js",
|
|
5
5
|
"module": "./web/index.mjs",
|
|
6
6
|
"types": "./web/index.d.ts",
|
|
@@ -13,9 +13,9 @@
|
|
|
13
13
|
"test:coverage": "vitest run --coverage"
|
|
14
14
|
},
|
|
15
15
|
"dependencies": {
|
|
16
|
-
"@xsolla/xui-core": "0.202.
|
|
17
|
-
"@xsolla/xui-input": "0.202.
|
|
18
|
-
"@xsolla/xui-primitives-core": "0.202.
|
|
16
|
+
"@xsolla/xui-core": "0.202.4",
|
|
17
|
+
"@xsolla/xui-input": "0.202.4",
|
|
18
|
+
"@xsolla/xui-primitives-core": "0.202.4"
|
|
19
19
|
},
|
|
20
20
|
"peerDependencies": {
|
|
21
21
|
"react": ">=16.8.0",
|