@acronis-platform/ui-react 2.0.0 → 4.0.0
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/dist/components/ui/accordion-container/accordion-container.js +144 -0
- package/dist/components/ui/accordion-container/accordion-container.js.map +1 -0
- package/dist/components/ui/app-shell-chat/app-shell-chat.js.map +1 -1
- package/dist/components/ui/area-chart/area-chart.js +141 -139
- package/dist/components/ui/area-chart/area-chart.js.map +1 -1
- package/dist/components/ui/avatar/avatar.js +33 -22
- package/dist/components/ui/avatar/avatar.js.map +1 -1
- package/dist/components/ui/bar-chart/bar-chart.js +295 -293
- package/dist/components/ui/bar-chart/bar-chart.js.map +1 -1
- package/dist/components/ui/card/card.js +150 -74
- package/dist/components/ui/card/card.js.map +1 -1
- package/dist/components/ui/card-section/card-section.js +111 -0
- package/dist/components/ui/card-section/card-section.js.map +1 -0
- package/dist/components/ui/category-bar/category-bar.js +109 -93
- package/dist/components/ui/category-bar/category-bar.js.map +1 -1
- package/dist/components/ui/chart/chart-palette.js +113 -0
- package/dist/components/ui/chart/chart-palette.js.map +1 -0
- package/dist/components/ui/chart/chart.js +176 -129
- package/dist/components/ui/chart/chart.js.map +1 -1
- package/dist/components/ui/chart-state/chart-state-illustrations.js +310 -0
- package/dist/components/ui/chart-state/chart-state-illustrations.js.map +1 -0
- package/dist/components/ui/chart-state/chart-state.js +48 -34
- package/dist/components/ui/chart-state/chart-state.js.map +1 -1
- package/dist/components/ui/chart-widget/chart-widget.js +87 -0
- package/dist/components/ui/chart-widget/chart-widget.js.map +1 -0
- package/dist/components/ui/composed-chart/composed-chart.js +117 -115
- package/dist/components/ui/composed-chart/composed-chart.js.map +1 -1
- package/dist/components/ui/confidence-cone/confidence-cone.js +166 -158
- package/dist/components/ui/confidence-cone/confidence-cone.js.map +1 -1
- package/dist/components/ui/data-table/data-table.js +4 -2
- package/dist/components/ui/data-table/data-table.js.map +1 -1
- package/dist/components/ui/empty-overlay/empty-overlay.js +49 -0
- package/dist/components/ui/empty-overlay/empty-overlay.js.map +1 -0
- package/dist/components/ui/funnel-chart/funnel-chart.js +162 -161
- package/dist/components/ui/funnel-chart/funnel-chart.js.map +1 -1
- package/dist/components/ui/histogram/histogram.js +94 -92
- package/dist/components/ui/histogram/histogram.js.map +1 -1
- package/dist/components/ui/input/input.js.map +1 -1
- package/dist/components/ui/label/label.js +2 -9
- package/dist/components/ui/label/label.js.map +1 -1
- package/dist/components/ui/line-chart/line-chart.js +143 -141
- package/dist/components/ui/line-chart/line-chart.js.map +1 -1
- package/dist/components/ui/metric/metric.js +74 -185
- package/dist/components/ui/metric/metric.js.map +1 -1
- package/dist/components/ui/page-content/page-content.js.map +1 -1
- package/dist/components/ui/pie-chart/pie-chart.js +201 -195
- package/dist/components/ui/pie-chart/pie-chart.js.map +1 -1
- package/dist/components/ui/radar-chart/radar-chart.js +133 -131
- package/dist/components/ui/radar-chart/radar-chart.js.map +1 -1
- package/dist/components/ui/radial-bar-chart/radial-bar-chart.js +297 -265
- package/dist/components/ui/radial-bar-chart/radial-bar-chart.js.map +1 -1
- package/dist/components/ui/sankey-chart/sankey-chart.js +123 -101
- package/dist/components/ui/sankey-chart/sankey-chart.js.map +1 -1
- package/dist/components/ui/scatter-chart/scatter-chart.js +76 -74
- package/dist/components/ui/scatter-chart/scatter-chart.js.map +1 -1
- package/dist/components/ui/section/section.js +157 -31
- package/dist/components/ui/section/section.js.map +1 -1
- package/dist/components/ui/stepper/stepper.js +24 -24
- package/dist/components/ui/stepper/stepper.js.map +1 -1
- package/dist/components/ui/stepper-item/stepper-item.js +43 -24
- package/dist/components/ui/stepper-item/stepper-item.js.map +1 -1
- package/dist/components/ui/table/table.js +27 -27
- package/dist/components/ui/table/table.js.map +1 -1
- package/dist/components/ui/treemap/treemap.js +133 -124
- package/dist/components/ui/treemap/treemap.js.map +1 -1
- package/dist/components/ui/trend-indicator/trend-indicator.js +34 -69
- package/dist/components/ui/trend-indicator/trend-indicator.js.map +1 -1
- package/dist/components/ui/wizard/wizard.js +59 -0
- package/dist/components/ui/wizard/wizard.js.map +1 -0
- package/dist/hooks/use-wizard.js +75 -0
- package/dist/hooks/use-wizard.js.map +1 -0
- package/dist/index.js +540 -525
- package/dist/index.js.map +1 -1
- package/dist/llms/accordion-container.md +181 -0
- package/dist/llms/accordion.md +124 -0
- package/dist/llms/alert.md +225 -0
- package/dist/llms/app-shell-chat.md +415 -0
- package/dist/llms/area-chart.md +355 -0
- package/dist/llms/avatar.md +208 -0
- package/dist/llms/bar-chart.md +406 -0
- package/dist/llms/breadcrumb.md +326 -0
- package/dist/llms/button-group.md +298 -0
- package/dist/llms/button-icon-input.md +142 -0
- package/dist/llms/button-icon-menu.md +209 -0
- package/dist/llms/button-icon.md +128 -0
- package/dist/llms/button-menu.md +172 -0
- package/dist/llms/button.md +185 -0
- package/dist/llms/calendar-panel.md +733 -0
- package/dist/llms/calendar.md +188 -0
- package/dist/llms/card-filter.md +214 -0
- package/dist/llms/card-section.md +293 -0
- package/dist/llms/card.md +447 -0
- package/dist/llms/carousel-dialog.md +156 -0
- package/dist/llms/category-bar.md +193 -0
- package/dist/llms/chart-state.md +190 -0
- package/dist/llms/chart-widget.md +209 -0
- package/dist/llms/chart.md +182 -0
- package/dist/llms/checkbox.md +257 -0
- package/dist/llms/chip.md +195 -0
- package/dist/llms/combobox.md +164 -0
- package/dist/llms/composed-chart.md +508 -0
- package/dist/llms/confidence-cone.md +277 -0
- package/dist/llms/data-table.md +474 -0
- package/dist/llms/date-range-picker.md +272 -0
- package/dist/llms/description-list.md +131 -0
- package/dist/llms/dialog-footer-carousel.md +147 -0
- package/dist/llms/dialog-footer-default.md +142 -0
- package/dist/llms/dialog-root.md +246 -0
- package/dist/llms/dialog-welcome.md +223 -0
- package/dist/llms/dialog.md +403 -0
- package/dist/llms/dropdown-menu.md +193 -0
- package/dist/llms/empty-overlay.md +146 -0
- package/dist/llms/empty.md +156 -0
- package/dist/llms/field.md +185 -0
- package/dist/llms/filter-cards.md +157 -0
- package/dist/llms/filter-chips.md +323 -0
- package/dist/llms/filter-search.md +512 -0
- package/dist/llms/form.md +154 -0
- package/dist/llms/funnel-chart.md +333 -0
- package/dist/llms/grid.md +80 -0
- package/dist/llms/histogram.md +190 -0
- package/dist/llms/input-date-picker.md +203 -0
- package/dist/llms/input-otp.md +173 -0
- package/dist/llms/input-password.md +197 -0
- package/dist/llms/input-search.md +170 -0
- package/dist/llms/input-select.md +278 -0
- package/dist/llms/input-text-area.md +271 -0
- package/dist/llms/input-text.md +192 -0
- package/dist/llms/line-chart.md +369 -0
- package/dist/llms/link.md +209 -0
- package/dist/llms/loading.md +130 -0
- package/dist/llms/meter.md +177 -0
- package/dist/llms/metric.md +204 -0
- package/dist/llms/number-field.md +122 -0
- package/dist/llms/page-content.md +69 -0
- package/dist/llms/page-header.md +182 -0
- package/dist/llms/pagination.md +133 -0
- package/dist/llms/pie-chart.md +307 -0
- package/dist/llms/popover.md +252 -0
- package/dist/llms/progress-circle.md +126 -0
- package/dist/llms/progress.md +111 -0
- package/dist/llms/radar-chart.md +316 -0
- package/dist/llms/radial-bar-chart.md +319 -0
- package/dist/llms/radio.md +255 -0
- package/dist/llms/resizable.md +195 -0
- package/dist/llms/sankey-chart.md +208 -0
- package/dist/llms/scatter-chart.md +239 -0
- package/dist/llms/scroll-area.md +183 -0
- package/dist/llms/section.md +401 -0
- package/dist/llms/select.md +210 -0
- package/dist/llms/separator.md +87 -0
- package/dist/llms/sheet.md +202 -0
- package/dist/llms/sidebar-primary.md +360 -0
- package/dist/llms/sidebar-secondary.md +417 -0
- package/dist/llms/skeleton.md +81 -0
- package/dist/llms/slider.md +97 -0
- package/dist/llms/spinner.md +100 -0
- package/dist/llms/stack.md +80 -0
- package/dist/llms/stepper-item.md +309 -0
- package/dist/llms/stepper.md +251 -0
- package/dist/llms/switch.md +140 -0
- package/dist/llms/table.md +436 -0
- package/dist/llms/tabs.md +197 -0
- package/dist/llms/tag.md +139 -0
- package/dist/llms/timeline.md +361 -0
- package/dist/llms/timer.md +259 -0
- package/dist/llms/toast.md +241 -0
- package/dist/llms/toggle-group.md +121 -0
- package/dist/llms/toolbar.md +453 -0
- package/dist/llms/tooltip.md +164 -0
- package/dist/llms/treemap.md +254 -0
- package/dist/llms/trend-indicator.md +132 -0
- package/dist/llms/widget-placeholder.md +169 -0
- package/dist/llms/wizard.md +412 -0
- package/dist/llms.txt +142 -0
- package/dist/react.js +540 -525
- package/dist/react.js.map +1 -1
- package/dist/src/components/ui/accordion-container/accordion-container.d.ts +44 -0
- package/dist/src/components/ui/accordion-container/index.d.ts +1 -0
- package/dist/src/components/ui/area-chart/area-chart.d.ts +9 -4
- package/dist/src/components/ui/avatar/avatar.d.ts +27 -8
- package/dist/src/components/ui/bar-chart/bar-chart.d.ts +9 -4
- package/dist/src/components/ui/button/button.d.ts +1 -1
- package/dist/src/components/ui/card/card.d.ts +69 -8
- package/dist/src/components/ui/card/index.d.ts +1 -1
- package/dist/src/components/ui/card-section/card-section.d.ts +50 -0
- package/dist/src/components/ui/card-section/index.d.ts +1 -0
- package/dist/src/components/ui/category-bar/category-bar.d.ts +10 -4
- package/dist/src/components/ui/chart/__stories__/palette-control.d.ts +48 -0
- package/dist/src/components/ui/chart/__tests__/chart-palette.test.d.ts +1 -0
- package/dist/src/components/ui/chart/chart-palette.d.ts +128 -0
- package/dist/src/components/ui/chart/chart.d.ts +66 -15
- package/dist/src/components/ui/chart/index.d.ts +4 -2
- package/dist/src/components/ui/chart-state/chart-state-illustrations.d.ts +6 -0
- package/dist/src/components/ui/chart-state/chart-state.d.ts +13 -2
- package/dist/src/components/ui/chart-state/index.d.ts +1 -0
- package/dist/src/components/ui/chart-widget/chart-widget.d.ts +64 -0
- package/dist/src/components/ui/chart-widget/index.d.ts +1 -0
- package/dist/src/components/ui/composed-chart/composed-chart.d.ts +12 -7
- package/dist/src/components/ui/confidence-cone/confidence-cone.d.ts +10 -5
- package/dist/src/components/ui/dialog/dialog.d.ts +1 -1
- package/dist/src/components/ui/empty-overlay/empty-overlay.d.ts +20 -0
- package/dist/src/components/ui/empty-overlay/index.d.ts +2 -0
- package/dist/src/components/ui/funnel-chart/funnel-chart.d.ts +11 -5
- package/dist/src/components/ui/grid/grid.d.ts +1 -1
- package/dist/src/components/ui/histogram/histogram.d.ts +10 -4
- package/dist/src/components/ui/label/index.d.ts +1 -1
- package/dist/src/components/ui/label/label.d.ts +1 -5
- package/dist/src/components/ui/line-chart/line-chart.d.ts +9 -4
- package/dist/src/components/ui/metric/metric.d.ts +13 -14
- package/dist/src/components/ui/pie-chart/pie-chart.d.ts +17 -8
- package/dist/src/components/ui/radar-chart/radar-chart.d.ts +10 -5
- package/dist/src/components/ui/radial-bar-chart/radial-bar-chart.d.ts +17 -6
- package/dist/src/components/ui/sankey-chart/sankey-chart.d.ts +10 -5
- package/dist/src/components/ui/scatter-chart/scatter-chart.d.ts +10 -5
- package/dist/src/components/ui/section/index.d.ts +1 -1
- package/dist/src/components/ui/section/section.d.ts +75 -6
- package/dist/src/components/ui/sheet/sheet.d.ts +1 -1
- package/dist/src/components/ui/stack/stack.d.ts +1 -1
- package/dist/src/components/ui/stepper-item/stepper-item.d.ts +6 -5
- package/dist/src/components/ui/tag/tag.d.ts +1 -1
- package/dist/src/components/ui/treemap/treemap.d.ts +11 -5
- package/dist/src/components/ui/trend-indicator/trend-indicator.d.ts +3 -7
- package/dist/src/components/ui/wizard/index.d.ts +1 -0
- package/dist/src/components/ui/wizard/wizard.d.ts +6 -0
- package/dist/src/hooks/index.d.ts +1 -0
- package/dist/src/hooks/use-wizard.d.ts +80 -0
- package/dist/src/index.d.ts +5 -3
- package/dist/ui-react.css +1 -1
- package/package.json +12 -6
- package/dist/components/ui/app-shell/app-shell.js +0 -75
- package/dist/components/ui/app-shell/app-shell.js.map +0 -1
- package/dist/components/ui/auth-layout/auth-layout.js +0 -56
- package/dist/components/ui/auth-layout/auth-layout.js.map +0 -1
- package/dist/components/ui/collapsible/collapsible.js +0 -22
- package/dist/components/ui/collapsible/collapsible.js.map +0 -1
- package/dist/src/components/ui/app-shell/app-shell.d.ts +0 -8
- package/dist/src/components/ui/app-shell/index.d.ts +0 -1
- package/dist/src/components/ui/auth-layout/auth-layout.d.ts +0 -6
- package/dist/src/components/ui/auth-layout/index.d.ts +0 -1
- package/dist/src/components/ui/collapsible/collapsible.d.ts +0 -5
- package/dist/src/components/ui/collapsible/index.d.ts +0 -1
- package/dist/src/components/ui/label/label.docs.d.ts +0 -10
|
@@ -0,0 +1,417 @@
|
|
|
1
|
+
# SidebarSecondary
|
|
2
|
+
|
|
3
|
+
> The contextual second-level navigation panel that sits beside the primary rail. A set of composable parts (header, content, sections with optional labels, menu, fixed and expandable menu items, level-2 sub-items, extras) that reflows between an expanded (256px) panel and a collapsed (48px) rail. In collapsed mode the section list is replaced by a vertical breadcrumb (parent → separator → current page). Expandable rows disclose a level-2 child list via Base UI Collapsible.
|
|
4
|
+
|
|
5
|
+
**Status:** ready · **Category:** navigation · **Since:** v0.7.0
|
|
6
|
+
|
|
7
|
+
## Import
|
|
8
|
+
|
|
9
|
+
```tsx
|
|
10
|
+
import { SidebarSecondary, SidebarSecondaryHeader, SidebarSecondaryContent, SidebarSecondaryFooter, SidebarSecondarySection, SidebarSecondarySectionLabel, SidebarSecondaryMenu, SidebarSecondaryMenuItem, SidebarSecondaryMenuItemExtras, SidebarSecondaryCollapseTrigger } from '@acronis-platform/ui-react'
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Quick example
|
|
14
|
+
|
|
15
|
+
```tsx
|
|
16
|
+
<SidebarSecondary expanded={expanded} onExpandedChange={setExpanded}>
|
|
17
|
+
<SidebarSecondaryHeader label="Protection" />
|
|
18
|
+
<SidebarSecondaryContent>
|
|
19
|
+
<SidebarSecondarySection>
|
|
20
|
+
<SidebarSecondarySectionLabel>Overview</SidebarSecondarySectionLabel>
|
|
21
|
+
<SidebarSecondaryMenu>
|
|
22
|
+
<SidebarSecondaryMenuItem render={<Link to="/dashboard" />} selected>
|
|
23
|
+
Dashboard
|
|
24
|
+
</SidebarSecondaryMenuItem>
|
|
25
|
+
<SidebarSecondaryMenuItem render={<Link to="/policies" />}>
|
|
26
|
+
Policies
|
|
27
|
+
</SidebarSecondaryMenuItem>
|
|
28
|
+
</SidebarSecondaryMenu>
|
|
29
|
+
</SidebarSecondarySection>
|
|
30
|
+
</SidebarSecondaryContent>
|
|
31
|
+
</SidebarSecondary>
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
The contextual, second-level navigation panel that sits beside the primary rail
|
|
35
|
+
(SidebarPrimary). It lists the destinations within the currently selected
|
|
36
|
+
top-level area, supports an expandable disclosure level, and collapses to a
|
|
37
|
+
breadcrumb rail.
|
|
38
|
+
|
|
39
|
+
## When to Use
|
|
40
|
+
|
|
41
|
+
- Second-level navigation within a top-level area selected in SidebarPrimary.
|
|
42
|
+
- Grouped, labelled sections of links, some with a Level-2 child list.
|
|
43
|
+
- A panel that collapses to a compact location breadcrumb to reclaim space.
|
|
44
|
+
|
|
45
|
+
## When NOT to Use
|
|
46
|
+
|
|
47
|
+
- **App-wide, top-level navigation** — use SidebarPrimary.
|
|
48
|
+
- **A popover menu of actions** — use a Menu/Dropdown.
|
|
49
|
+
- **In-page section links / table of contents** — use anchors.
|
|
50
|
+
- **Deep (3+ level) trees** — this component models one disclosure level only.
|
|
51
|
+
|
|
52
|
+
## Parts
|
|
53
|
+
|
|
54
|
+
| Part | Element | Role |
|
|
55
|
+
| ------------------------------------- | ------------------------------------ | -------------------------------------------------------------------------------------- |
|
|
56
|
+
| `SidebarSecondary` | `<nav>` | Navigation landmark; owns the expanded state |
|
|
57
|
+
| `SidebarSecondaryHeader` | `<div><h2>` | Section title row |
|
|
58
|
+
| `SidebarSecondaryContent` | `<div>` | Scrollable section list (expanded only) |
|
|
59
|
+
| `SidebarSecondaryCollapsedBreadcrumb` | `<div>` | Rail-mode location indicator (collapsed only) |
|
|
60
|
+
| `SidebarSecondaryFooter` | `<div>` | Footer menu with a top divider |
|
|
61
|
+
| `SidebarSecondarySection` | `<div>` / `Collapsible.Root` | A group of rows; `expandable` makes it collapsible |
|
|
62
|
+
| `SidebarSecondarySectionLabel` | `<div>` / `Collapsible.Trigger` | Section caption; the chevron toggle when expandable (`actions` / `unreadRollup` slots) |
|
|
63
|
+
| `SidebarSecondaryMenu` | `<ul>` | List that owns the inter-item gap |
|
|
64
|
+
| `SidebarSecondaryMenuItem` | `<li><a>` (polymorphic via `render`) | Level-1 leaf row |
|
|
65
|
+
| `SidebarSecondaryMenuSub` | `Collapsible.Root` `<li>` | Expandable Level-1 row |
|
|
66
|
+
| `SidebarSecondaryMenuSubTrigger` | `Collapsible.Trigger` `<button>` | Disclosure parent row (rotating chevron) |
|
|
67
|
+
| `SidebarSecondaryMenuSubContent` | `Collapsible.Panel` `<div><ul>` | Level-2 child list |
|
|
68
|
+
| `SidebarSecondaryMenuSubItem` | `<li><a>` | Level-2 indented leaf |
|
|
69
|
+
| `SidebarSecondaryMenuItemExtras` | `<span>` | Trailing shortcut / external-link / tag |
|
|
70
|
+
| `SidebarSecondaryCollapseTrigger` | `<li><button>` | Footer "Collapse menu" button; toggles `expanded` |
|
|
71
|
+
|
|
72
|
+
## Quick Examples
|
|
73
|
+
|
|
74
|
+
### React
|
|
75
|
+
|
|
76
|
+
```tsx
|
|
77
|
+
import {
|
|
78
|
+
SidebarSecondary,
|
|
79
|
+
SidebarSecondaryHeader,
|
|
80
|
+
SidebarSecondaryContent,
|
|
81
|
+
SidebarSecondaryCollapsedBreadcrumb,
|
|
82
|
+
SidebarSecondarySection,
|
|
83
|
+
SidebarSecondarySectionLabel,
|
|
84
|
+
SidebarSecondaryMenu,
|
|
85
|
+
SidebarSecondaryMenuItem,
|
|
86
|
+
SidebarSecondaryMenuSub,
|
|
87
|
+
SidebarSecondaryMenuSubTrigger,
|
|
88
|
+
SidebarSecondaryMenuSubContent,
|
|
89
|
+
SidebarSecondaryMenuSubItem,
|
|
90
|
+
} from '@acronis-platform/ui-react';
|
|
91
|
+
import {
|
|
92
|
+
LayoutGridIcon,
|
|
93
|
+
BoxIcon,
|
|
94
|
+
} from '@acronis-platform/icons-react/stroke-mono';
|
|
95
|
+
|
|
96
|
+
function ProtectionNav() {
|
|
97
|
+
const [expanded, setExpanded] = useState(true);
|
|
98
|
+
return (
|
|
99
|
+
<SidebarSecondary expanded={expanded} onExpandedChange={setExpanded}>
|
|
100
|
+
<SidebarSecondaryHeader label="Protection" />
|
|
101
|
+
<SidebarSecondaryContent>
|
|
102
|
+
<SidebarSecondarySection>
|
|
103
|
+
<SidebarSecondarySectionLabel>Overview</SidebarSecondarySectionLabel>
|
|
104
|
+
<SidebarSecondaryMenu>
|
|
105
|
+
<SidebarSecondaryMenuItem
|
|
106
|
+
href="/dashboard"
|
|
107
|
+
icon={<LayoutGridIcon />}
|
|
108
|
+
selected
|
|
109
|
+
>
|
|
110
|
+
Dashboard
|
|
111
|
+
</SidebarSecondaryMenuItem>
|
|
112
|
+
<SidebarSecondaryMenuSub defaultOpen>
|
|
113
|
+
<SidebarSecondaryMenuSubTrigger icon={<BoxIcon />}>
|
|
114
|
+
Policies
|
|
115
|
+
</SidebarSecondaryMenuSubTrigger>
|
|
116
|
+
<SidebarSecondaryMenuSubContent>
|
|
117
|
+
<SidebarSecondaryMenuSubItem href="/policies/backup" selected>
|
|
118
|
+
Backup
|
|
119
|
+
</SidebarSecondaryMenuSubItem>
|
|
120
|
+
<SidebarSecondaryMenuSubItem href="/policies/av">
|
|
121
|
+
Antivirus
|
|
122
|
+
</SidebarSecondaryMenuSubItem>
|
|
123
|
+
</SidebarSecondaryMenuSubContent>
|
|
124
|
+
</SidebarSecondaryMenuSub>
|
|
125
|
+
</SidebarSecondaryMenu>
|
|
126
|
+
</SidebarSecondarySection>
|
|
127
|
+
</SidebarSecondaryContent>
|
|
128
|
+
<SidebarSecondaryCollapsedBreadcrumb
|
|
129
|
+
parentLabel="Protection"
|
|
130
|
+
currentLabel="Dashboard"
|
|
131
|
+
/>
|
|
132
|
+
</SidebarSecondary>
|
|
133
|
+
);
|
|
134
|
+
}
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
Render a row as a router link via the `render` prop:
|
|
138
|
+
|
|
139
|
+
```tsx
|
|
140
|
+
<SidebarSecondaryMenuItem render={<Link to="/dashboard" />}>
|
|
141
|
+
Dashboard
|
|
142
|
+
</SidebarSecondaryMenuItem>
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
## Collapsed mode
|
|
146
|
+
|
|
147
|
+
Author both the `SidebarSecondaryContent` (section list) and the
|
|
148
|
+
`SidebarSecondaryCollapsedBreadcrumb`. Visibility is toggled by the panel's
|
|
149
|
+
`expanded` state via CSS — both stay in the DOM, so the breadcrumb is
|
|
150
|
+
SSR-present and no JS branch is needed.
|
|
151
|
+
|
|
152
|
+
## Spec Files
|
|
153
|
+
|
|
154
|
+
| File | Contents |
|
|
155
|
+
| ------------------ | ----------------------------------------------------------------- |
|
|
156
|
+
| `index.yaml` | Identity, status, category, dependencies, Figma link |
|
|
157
|
+
| `anatomy.yaml` | Root, parts, layout, states |
|
|
158
|
+
| `api.yaml` | Framework-agnostic contract + framework adapters |
|
|
159
|
+
| `tokens.yaml` | `--ui-sidebar-secondary-*` token references |
|
|
160
|
+
| `behavior.md` | Given/When/Then behavior scenarios |
|
|
161
|
+
| `accessibility.md` | ARIA roles, keyboard map, screen-reader and contrast requirements |
|
|
162
|
+
|
|
163
|
+
## Props
|
|
164
|
+
|
|
165
|
+
| Prop | Type | Default | Required | Description |
|
|
166
|
+
|------|------|---------|----------|-------------|
|
|
167
|
+
| `render` | `RenderProp` | `undefined` | no | Base UI composition prop on the root and on the menu-item / sub-item parts — replaces the rendered element with another component (e.g. a router `Link`, or an `<aside>` wrapper on the root) while merging props and classes. React-only. |
|
|
168
|
+
| `expanded` | `boolean` | `undefined` | no | Controlled panel width state (on the root). `true` = full width (256px), `false` = collapsed rail (48px). Drives `data-state`. |
|
|
169
|
+
| `defaultExpanded` | `boolean` | `true` | no | Uncontrolled initial expanded state (on the root). |
|
|
170
|
+
| `label` | `ReactNode` | `undefined` | no | Heading text for the header part (or pass as children). |
|
|
171
|
+
| `selected` | `boolean` | `false` | no | Marks a menu-item / sub-trigger / sub-item as the current route — applies the `selected` container variant and sets `aria-current="page"`. |
|
|
172
|
+
| `icon` | `ReactNode` | `undefined` | no | Optional leading 16px icon for a Level-1 menu-item / sub-trigger. |
|
|
173
|
+
| `href` | `string` | `undefined` | no | Target URL of a menu-item / sub-item link. |
|
|
174
|
+
| `open` | `boolean` | `undefined` | no | Controlled disclosure state of an expandable row (menu-sub) or an expandable section. Driven by Base UI Collapsible; sets `aria-expanded` / `aria-controls`. |
|
|
175
|
+
| `defaultOpen` | `boolean` | `false` | no | Uncontrolled initial disclosure state of an expandable row or expandable section. (Expandable sections default to open.) |
|
|
176
|
+
| `expandable` | `boolean` | `false` | no | Makes a section a collapsible disclosure (section part): the section-label becomes a chevron toggle and the menu becomes its collapsible panel. Mirrors the Figma Section `expandable` variant. |
|
|
177
|
+
| `actions` | `ReactNode` | `undefined` | no | Trailing header actions on the section-label (e.g. a ghost ButtonIcon), rendered outside the toggle so they stay independently operable. |
|
|
178
|
+
| `unreadRollup` | `ReactNode` | `undefined` | no | A rollup badge (e.g. a Tag with an unread count) shown in an expandable section's header only while it is collapsed. |
|
|
179
|
+
| `resizable` | `boolean` | `true` | no | Enable the draggable resize edge on the right border. When `true`, the sidebar can be resized between the expanded-width token and twice that value. |
|
|
180
|
+
| `resizeAriaLabel` | `string` | `'Resize sidebar'` | no | Accessible label for the resize edge (`role="separator"`). Consumers should localize this string for i18n. |
|
|
181
|
+
| `resizeTooltipExpanded` | `ReactNode` | `(English tooltip: Resize/Collapse/Reset)` | no | Tooltip content shown when the sidebar is expanded. Pass `null` to hide the tooltip entirely. Consumers should localize for i18n. |
|
|
182
|
+
| `resizeTooltipCollapsed` | `ReactNode` | `(English tooltip: Resize/Expand)` | no | Tooltip content shown when the sidebar is collapsed. Pass `null` to hide the tooltip entirely. Consumers should localize for i18n. |
|
|
183
|
+
| `expandTooltip` | `ReactNode` | `'Expand'` | no | Tooltip text shown on the collapse trigger when the sidebar is collapsed. Consumers should localize this string for i18n. |
|
|
184
|
+
| `extras-variant` | `'tag' | 'externalLink' | 'shortcut' | 'tag-externalLink'` | — | yes | Which trailing affordance the extras part renders. React: the `variant` prop on `SidebarSecondaryMenuItemExtras`. (Named here without the bare `variant` key reserved for a root cva axis.) |
|
|
185
|
+
| `shortcut` | `string` | `undefined` | no | Keyboard-shortcut text for the extras `shortcut` variant. |
|
|
186
|
+
| `tag` | `ReactNode` | `undefined` | no | Tag content for the extras `tag` / `tag-externalLink` variants. |
|
|
187
|
+
|
|
188
|
+
## Events
|
|
189
|
+
|
|
190
|
+
| Event | Payload | Description |
|
|
191
|
+
|-------|---------|-------------|
|
|
192
|
+
| `expanded-change` | `boolean` | Fires when the panel expanded state changes. React: `onExpandedChange`. |
|
|
193
|
+
| `open-change` | `boolean` | Fires when an expandable row's disclosure opens/closes (Base UI Collapsible). React: `onOpenChange` on the menu-sub part. |
|
|
194
|
+
|
|
195
|
+
## Content slots
|
|
196
|
+
|
|
197
|
+
| Slot | Description |
|
|
198
|
+
|------|-------------|
|
|
199
|
+
| `default` | The composed panel. Author it from the parts: a header, a scrollable content region of sections (each with an optional label and a menu of fixed and expandable rows), and a footer. The collapsed-breadcrumb is rendered automatically by the root. |
|
|
200
|
+
|
|
201
|
+
## Behavior
|
|
202
|
+
|
|
203
|
+
### Structure
|
|
204
|
+
|
|
205
|
+
#### Renders a navigation landmark
|
|
206
|
+
|
|
207
|
+
**Given** a SidebarSecondary wrapping a header, content, and footer
|
|
208
|
+
**When** the component renders
|
|
209
|
+
**Then** the root is a `<nav>` with a distinguishing `aria-label`
|
|
210
|
+
**And** the header renders an `<h2>` heading
|
|
211
|
+
**And** each menu is a `<ul>` of `<li>` rows
|
|
212
|
+
|
|
213
|
+
#### Sections divide the menu
|
|
214
|
+
|
|
215
|
+
**Given** more than one SidebarSecondarySection
|
|
216
|
+
**When** the panel renders
|
|
217
|
+
**Then** the first section has no top divider
|
|
218
|
+
**And** every following section carries a top border
|
|
219
|
+
**And** a SidebarSecondarySectionLabel renders above its menu when provided
|
|
220
|
+
|
|
221
|
+
---
|
|
222
|
+
|
|
223
|
+
### Selection
|
|
224
|
+
|
|
225
|
+
#### Marks the current route
|
|
226
|
+
|
|
227
|
+
**Given** a SidebarSecondaryMenuItem (or sub-trigger / sub-item) with `selected`
|
|
228
|
+
**When** the panel renders
|
|
229
|
+
**Then** the row applies the `selected` **container** token
|
|
230
|
+
**And** it carries `aria-current="page"`
|
|
231
|
+
**And** its icon and label use the shared global state tokens (same as unselected)
|
|
232
|
+
|
|
233
|
+
---
|
|
234
|
+
|
|
235
|
+
### Expand / collapse (panel width)
|
|
236
|
+
|
|
237
|
+
#### Defaults to expanded
|
|
238
|
+
|
|
239
|
+
**Given** a SidebarSecondary with no `expanded` / `defaultExpanded`
|
|
240
|
+
**When** it renders
|
|
241
|
+
**Then** the root has `data-state="expanded"` (256px width)
|
|
242
|
+
**And** the section list (content) is shown; the collapsed-breadcrumb is hidden
|
|
243
|
+
|
|
244
|
+
#### Collapses to a breadcrumb rail
|
|
245
|
+
|
|
246
|
+
**Given** `expanded={false}`
|
|
247
|
+
**When** it renders
|
|
248
|
+
**Then** the root has `data-state="collapsed"` (48px width)
|
|
249
|
+
**And** the header is hidden
|
|
250
|
+
**And** the content section list is hidden
|
|
251
|
+
**And** the collapsed-breadcrumb is shown: parent → separator → current page
|
|
252
|
+
**And** the breadcrumb labels render vertically (`writing-mode: vertical-rl`)
|
|
253
|
+
**And** menu-item labels (when any rows remain) are kept in the DOM as `sr-only`
|
|
254
|
+
|
|
255
|
+
> The content and the collapsed-breadcrumb are both authored and present in the
|
|
256
|
+
> DOM; visibility is toggled purely by `data-[state]` selectors (SSR-safe, no JS
|
|
257
|
+
> branch).
|
|
258
|
+
|
|
259
|
+
---
|
|
260
|
+
|
|
261
|
+
### Disclosure (expandable sections)
|
|
262
|
+
|
|
263
|
+
#### Toggles a section's menu
|
|
264
|
+
|
|
265
|
+
**Given** a `SidebarSecondarySection` with `expandable`
|
|
266
|
+
**When** the user activates the section-label header
|
|
267
|
+
**Then** `aria-expanded` flips and the section's menu collapses/expands
|
|
268
|
+
**And** the header chevron rotates
|
|
269
|
+
|
|
270
|
+
#### Opens initially / is controllable
|
|
271
|
+
|
|
272
|
+
**Given** an expandable section with `defaultOpen`
|
|
273
|
+
**When** it renders
|
|
274
|
+
**Then** the disclosure is open initially
|
|
275
|
+
**And** `open` / `onOpenChange` allow controlled use (Base UI Collapsible)
|
|
276
|
+
**And** each expandable section has independent open state
|
|
277
|
+
|
|
278
|
+
---
|
|
279
|
+
|
|
280
|
+
### Extras
|
|
281
|
+
|
|
282
|
+
#### Shortcut / external link
|
|
283
|
+
|
|
284
|
+
**Given** a SidebarSecondaryMenuItemExtras with `variant="shortcut"` / `"externalLink"`
|
|
285
|
+
**When** the item renders expanded
|
|
286
|
+
**Then** the shortcut text / external-link icon appears trailing the label
|
|
287
|
+
|
|
288
|
+
#### Hidden when collapsed
|
|
289
|
+
|
|
290
|
+
**Given** any extras inside a menu item
|
|
291
|
+
**When** the panel is collapsed
|
|
292
|
+
**Then** the extras cluster is hidden
|
|
293
|
+
|
|
294
|
+
### Expandable section
|
|
295
|
+
|
|
296
|
+
#### Toggle a section
|
|
297
|
+
|
|
298
|
+
**Given** a `SidebarSecondarySection` with `expandable`
|
|
299
|
+
**When** the user activates its section-label header
|
|
300
|
+
**Then** the section's menu collapses/expands and the header chevron rotates
|
|
301
|
+
(`aria-expanded` flips); an uncontrolled section starts open
|
|
302
|
+
|
|
303
|
+
#### Header actions stay operable
|
|
304
|
+
|
|
305
|
+
**Given** an expandable section-label with an `actions` slot (e.g. a ButtonIcon)
|
|
306
|
+
**When** the user activates the action
|
|
307
|
+
**Then** the action fires and the section does **not** toggle (the action is a
|
|
308
|
+
sibling of the toggle, never nested in it)
|
|
309
|
+
|
|
310
|
+
#### Unread rollup while collapsed
|
|
311
|
+
|
|
312
|
+
**Given** an expandable section-label with an `unreadRollup` badge
|
|
313
|
+
**When** the section is collapsed
|
|
314
|
+
**Then** the rollup badge shows in the header; it hides again when expanded
|
|
315
|
+
|
|
316
|
+
#### Items inside expandable sections are indented
|
|
317
|
+
|
|
318
|
+
**Given** a `SidebarSecondaryMenuItem` inside an expandable section
|
|
319
|
+
**When** the section is open
|
|
320
|
+
**Then** items are left-indented so their label aligns with the section header text
|
|
321
|
+
|
|
322
|
+
## Accessibility
|
|
323
|
+
|
|
324
|
+
A contextual list of navigation links with an optional disclosure level. It is a
|
|
325
|
+
`navigation` landmark, **not** a `menu`/`menubar` widget — interaction is native
|
|
326
|
+
tab order, not arrow-key roving.
|
|
327
|
+
|
|
328
|
+
## ARIA Roles and Attributes
|
|
329
|
+
|
|
330
|
+
### Root (`nav`)
|
|
331
|
+
|
|
332
|
+
| Attribute | Value | Reason |
|
|
333
|
+
| ------------ | ------------------------ | ------------------------------------------------ |
|
|
334
|
+
| `<nav>` | — | Exposes the panel as a navigation landmark |
|
|
335
|
+
| `aria-label` | contextual (overridable) | Distinguishes it from other `nav` landmarks |
|
|
336
|
+
| `data-state` | `expanded`/`collapsed` | Reflects the width state; drives token switching |
|
|
337
|
+
|
|
338
|
+
### Header
|
|
339
|
+
|
|
340
|
+
The header renders an `<h2>` so the panel's section title is in the heading
|
|
341
|
+
outline.
|
|
342
|
+
|
|
343
|
+
### Menu / items
|
|
344
|
+
|
|
345
|
+
- Each menu is a `<ul>` of `<li>` rows; leaves render a native `<a>` (or the
|
|
346
|
+
element supplied via `render`).
|
|
347
|
+
- The selected row carries `aria-current="page"`.
|
|
348
|
+
|
|
349
|
+
### Disclosure (expandable rows)
|
|
350
|
+
|
|
351
|
+
Base UI `Collapsible` wires the disclosure semantics automatically — the trigger
|
|
352
|
+
is a `<button>` with `aria-expanded` and `aria-controls`, and the panel gets a
|
|
353
|
+
matching `id` and `hidden` state. This is the primary reason the expandable row
|
|
354
|
+
uses the primitive.
|
|
355
|
+
|
|
356
|
+
### Collapsed (breadcrumb rail)
|
|
357
|
+
|
|
358
|
+
When collapsed, the section list is hidden and a vertical breadcrumb is shown
|
|
359
|
+
(parent → separator → current page). The separator icon is decorative
|
|
360
|
+
(`aria-hidden`). Any menu-item labels that remain are kept in the DOM as
|
|
361
|
+
`sr-only`, never `display:none`.
|
|
362
|
+
|
|
363
|
+
---
|
|
364
|
+
|
|
365
|
+
## Keyboard Navigation
|
|
366
|
+
|
|
367
|
+
| Key | Element | Action |
|
|
368
|
+
| ----------- | ----------- | ------------------------------- |
|
|
369
|
+
| Tab | Row | Moves focus to the next row |
|
|
370
|
+
| Shift+Tab | Row | Moves focus to the previous row |
|
|
371
|
+
| Enter | Link row | Activates / navigates |
|
|
372
|
+
| Enter/Space | Sub-trigger | Toggles the disclosure |
|
|
373
|
+
|
|
374
|
+
No roving tabindex — this is a list of links plus disclosure buttons, not a
|
|
375
|
+
`menu`/`menubar`.
|
|
376
|
+
|
|
377
|
+
---
|
|
378
|
+
|
|
379
|
+
## Focus
|
|
380
|
+
|
|
381
|
+
A keyboard-focused row shows a visible focus ring using the shared
|
|
382
|
+
`--ui-focus-brand` token (inset, so it stays inside the 48px collapsed rail).
|
|
383
|
+
|
|
384
|
+
---
|
|
385
|
+
|
|
386
|
+
## Screen Reader Requirements
|
|
387
|
+
|
|
388
|
+
1. The navigation landmark is announced with its label.
|
|
389
|
+
2. The header announces as a level-2 heading.
|
|
390
|
+
3. Each row announces its label as a link; the selected row announces
|
|
391
|
+
`aria-current="page"`.
|
|
392
|
+
4. Disclosure triggers announce expanded/collapsed state.
|
|
393
|
+
5. Collapsed rows still announce their (sr-only) label.
|
|
394
|
+
|
|
395
|
+
---
|
|
396
|
+
|
|
397
|
+
## Color and Contrast
|
|
398
|
+
|
|
399
|
+
| Element | Minimum Ratio | Standard |
|
|
400
|
+
| ------------------------------ | ------------- | ---------------------- |
|
|
401
|
+
| Menu-item label vs container | 4.5:1 | WCAG 1.4.3 (AA) |
|
|
402
|
+
| Menu-item icon vs container | 3:1 | WCAG 1.4.11 (non-text) |
|
|
403
|
+
| Selected container vs panel bg | 3:1 | WCAG 1.4.11 |
|
|
404
|
+
| Breadcrumb separator icon | 3:1 | WCAG 1.4.11 (non-text) |
|
|
405
|
+
| Focus indicator | 3:1 | WCAG 1.4.11 |
|
|
406
|
+
|
|
407
|
+
---
|
|
408
|
+
|
|
409
|
+
## Testing Checklist
|
|
410
|
+
|
|
411
|
+
- [ ] `<nav>` root with a distinguishing `aria-label`; header is an `<h2>`
|
|
412
|
+
- [ ] Menus are `<ul>` of `<li>` rows; rows are links
|
|
413
|
+
- [ ] Selected row has `aria-current="page"`; others do not
|
|
414
|
+
- [ ] `data-state` reflects expanded/collapsed; breadcrumb shows when collapsed
|
|
415
|
+
- [ ] Disclosure trigger exposes `aria-expanded` / `aria-controls`; toggles on click + Enter/Space
|
|
416
|
+
- [ ] Level-2 sub-items are indented and reachable via Tab when open
|
|
417
|
+
- [ ] Collapsed rows keep an accessible name (sr-only label, not removed)
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
# Skeleton
|
|
2
|
+
|
|
3
|
+
> A pulsing placeholder box for loading states. Shape and size come from the caller's className. Ported from the legacy shadcn-uikit `skeleton`.
|
|
4
|
+
|
|
5
|
+
**Status:** draft · **Category:** feedback · **Since:** v0.48.0
|
|
6
|
+
|
|
7
|
+
## Import
|
|
8
|
+
|
|
9
|
+
```tsx
|
|
10
|
+
import { Skeleton } from '@acronis-platform/ui-react'
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Quick example
|
|
14
|
+
|
|
15
|
+
```tsx
|
|
16
|
+
<Skeleton className="h-4 w-[250px]" />
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
A pulsing placeholder box for loading states. Shape and size come from the
|
|
20
|
+
caller's `className`.
|
|
21
|
+
|
|
22
|
+
> Design-pending v1, ported from the legacy shadcn-uikit `skeleton`.
|
|
23
|
+
|
|
24
|
+
## When to use
|
|
25
|
+
|
|
26
|
+
- Reserve layout space while content loads, reducing layout shift.
|
|
27
|
+
|
|
28
|
+
## When not to use
|
|
29
|
+
|
|
30
|
+
- Indeterminate work with no known shape — use `Loading`.
|
|
31
|
+
- Determinate progress — use `Progress` / `ProgressCircle`.
|
|
32
|
+
|
|
33
|
+
## Parts
|
|
34
|
+
|
|
35
|
+
| Export | Purpose |
|
|
36
|
+
| ---------- | -------------------------------- |
|
|
37
|
+
| `Skeleton` | The pulsing placeholder `<div>`. |
|
|
38
|
+
|
|
39
|
+
## Example
|
|
40
|
+
|
|
41
|
+
```tsx
|
|
42
|
+
import { Skeleton } from '@acronis-platform/ui-react';
|
|
43
|
+
|
|
44
|
+
<div className="flex items-center gap-4">
|
|
45
|
+
<Skeleton className="size-12 rounded-full" />
|
|
46
|
+
<div className="flex flex-col gap-2">
|
|
47
|
+
<Skeleton className="h-4 w-[250px]" />
|
|
48
|
+
<Skeleton className="h-4 w-[200px]" />
|
|
49
|
+
</div>
|
|
50
|
+
</div>;
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
## Behavior
|
|
54
|
+
|
|
55
|
+
```gherkin
|
|
56
|
+
Scenario: Placeholder while loading
|
|
57
|
+
Given content is not ready
|
|
58
|
+
Then a Skeleton renders a pulsing box at the caller's size/shape
|
|
59
|
+
When the content arrives
|
|
60
|
+
Then the caller swaps the Skeleton for the real content
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
```gherkin
|
|
64
|
+
Scenario: Shape from className
|
|
65
|
+
Given a Skeleton with className="size-12 rounded-full"
|
|
66
|
+
Then it renders a 48px circular placeholder
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
## Accessibility
|
|
70
|
+
|
|
71
|
+
- A Skeleton is decorative — it conveys "loading" visually. It has no inherent
|
|
72
|
+
ARIA semantics; announce loading at the region level instead (e.g. an
|
|
73
|
+
`aria-busy="true"` container, or a visually-hidden "Loading…" message), so
|
|
74
|
+
screen-reader users are told content is pending rather than reading empty boxes.
|
|
75
|
+
- Don't put meaningful text inside a Skeleton.
|
|
76
|
+
|
|
77
|
+
## Contrast
|
|
78
|
+
|
|
79
|
+
Skeleton is a non-informational placeholder, so it's exempt from text-contrast
|
|
80
|
+
requirements; the fill (`--ui-background-surface-active`) is a visible-but-subtle
|
|
81
|
+
gray against the page in both themes.
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
# Slider
|
|
2
|
+
|
|
3
|
+
> A slider for choosing a number (or a range, with two thumbs) within a min/max by dragging. Built on Base UI's Slider. Ported from the legacy shadcn-uikit `slider`.
|
|
4
|
+
|
|
5
|
+
**Status:** draft · **Category:** forms · **Since:** v0.50.0
|
|
6
|
+
|
|
7
|
+
## Import
|
|
8
|
+
|
|
9
|
+
```tsx
|
|
10
|
+
import { Slider } from '@acronis-platform/ui-react'
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Quick example
|
|
14
|
+
|
|
15
|
+
```tsx
|
|
16
|
+
<Slider defaultValue={40} aria-label="Volume" />
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
A slider for choosing a number — or a range (two thumbs) — within a min/max by
|
|
20
|
+
dragging. Built on Base UI's Slider.
|
|
21
|
+
|
|
22
|
+
> Design-pending v1, ported from the legacy shadcn-uikit `slider`.
|
|
23
|
+
|
|
24
|
+
## When to use
|
|
25
|
+
|
|
26
|
+
- Picking an approximate value across a continuous range (volume, opacity, price).
|
|
27
|
+
|
|
28
|
+
## When not to use
|
|
29
|
+
|
|
30
|
+
- Precise numeric entry — use a `NumberField` / `InputText`.
|
|
31
|
+
- A small set of discrete choices — use `RadioGroup` or `ToggleGroup`.
|
|
32
|
+
|
|
33
|
+
## Parts
|
|
34
|
+
|
|
35
|
+
`Slider` is a single component (the track / indicator / thumb are rendered
|
|
36
|
+
internally). Pass an array value for a range.
|
|
37
|
+
|
|
38
|
+
## Example
|
|
39
|
+
|
|
40
|
+
```tsx
|
|
41
|
+
import { Slider } from '@acronis-platform/ui-react';
|
|
42
|
+
|
|
43
|
+
<Slider defaultValue={40} aria-label="Volume" />
|
|
44
|
+
<Slider defaultValue={[20, 80]} aria-label="Price range" />
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
## Props
|
|
48
|
+
|
|
49
|
+
| Prop | Type | Default | Required | Description |
|
|
50
|
+
|------|------|---------|----------|-------------|
|
|
51
|
+
| `value` | `number | number[]` | — | no | The value(s) (controlled). An array renders a range (one thumb each). |
|
|
52
|
+
| `defaultValue` | `number | number[]` | `0` | no | The initial value(s) (uncontrolled). |
|
|
53
|
+
| `min` | `number` | `0` | no | Minimum value. |
|
|
54
|
+
| `max` | `number` | `100` | no | Maximum value. |
|
|
55
|
+
| `step` | `number` | `1` | no | Step increment. |
|
|
56
|
+
| `disabled` | `boolean` | `false` | no | Disables the slider. |
|
|
57
|
+
|
|
58
|
+
## Events
|
|
59
|
+
|
|
60
|
+
| Event | Payload | Description |
|
|
61
|
+
|-------|---------|-------------|
|
|
62
|
+
| `onValueChange` | `(value: number | number[], eventDetails) => void` | Fired as the value changes while dragging. |
|
|
63
|
+
|
|
64
|
+
## Behavior
|
|
65
|
+
|
|
66
|
+
```gherkin
|
|
67
|
+
Scenario: Drag to change the value
|
|
68
|
+
Given a Slider with a value
|
|
69
|
+
When the user drags the thumb (or uses arrow keys)
|
|
70
|
+
Then the value updates and onValueChange fires, clamped to min/max and snapped to step
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
```gherkin
|
|
74
|
+
Scenario: Range
|
|
75
|
+
Given a Slider with an array value [low, high]
|
|
76
|
+
Then two thumbs render and each is dragged independently (they cannot cross)
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
```gherkin
|
|
80
|
+
Scenario: Disabled
|
|
81
|
+
Given disabled is set
|
|
82
|
+
Then the thumb cannot be focused or dragged
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
## Accessibility
|
|
86
|
+
|
|
87
|
+
- Built on Base UI's Slider: each thumb is keyboard-operable (←/→/↑/↓, Home/End,
|
|
88
|
+
PageUp/PageDown) and exposes `aria-valuenow` / min / max so assistive tech reads
|
|
89
|
+
the current value.
|
|
90
|
+
- Give the slider an accessible name — `aria-label` on `Slider`, or pair it with a
|
|
91
|
+
`Field` / `FieldLabel`. For a range, label each end if they have distinct meaning.
|
|
92
|
+
|
|
93
|
+
## Contrast
|
|
94
|
+
|
|
95
|
+
The filled indicator (`--ui-background-brand-secondary`) against the rail
|
|
96
|
+
(`--ui-border-on-surface-border`) and the thumb border are distinguishable in light
|
|
97
|
+
and dark; the focus ring uses `--ui-focus-primary`.
|