@acronis-platform/ui-react 3.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 +14 -14
- package/dist/components/ui/accordion-container/accordion-container.js.map +1 -1
- 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/bar-chart/bar-chart.js +295 -293
- package/dist/components/ui/bar-chart/bar-chart.js.map +1 -1
- 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/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/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 +502 -497
- 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 +502 -497
- package/dist/react.js.map +1 -1
- package/dist/src/components/ui/area-chart/area-chart.d.ts +9 -4
- package/dist/src/components/ui/avatar/avatar.d.ts +1 -1
- package/dist/src/components/ui/bar-chart/bar-chart.d.ts +9 -4
- 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/empty-overlay/empty-overlay.d.ts +1 -1
- package/dist/src/components/ui/funnel-chart/funnel-chart.d.ts +11 -5
- 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/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 +2 -3
- package/dist/ui-react.css +1 -1
- package/package.json +9 -3
- 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
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
# AccordionContainer
|
|
2
|
+
|
|
3
|
+
> The shared disclosure primitive behind Card's and Section's `isCollapsable` variant. Built directly on Base UI's Collapsible — owns open state, the trigger button, chevron rotation, and panel animation — while imposing no visual styling beyond what the disclosure mechanic itself requires — the two exceptions are its trigger's chevron glyph color (the same neutral treatment Accordion's chevron uses) and, when `collapsible` is true, Root defaulting to `display: contents` so it stays transparent to the consumer's layout. Every other visual decision (header layout, spacing, background, borders) stays owned by the component composing it.
|
|
4
|
+
|
|
5
|
+
**Status:** draft · **Category:** layout · **Since:** v1.1.0
|
|
6
|
+
|
|
7
|
+
## Import
|
|
8
|
+
|
|
9
|
+
```tsx
|
|
10
|
+
import { AccordionContainer } from '@acronis-platform/ui-react'
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Quick example
|
|
14
|
+
|
|
15
|
+
```tsx
|
|
16
|
+
<AccordionContainer collapsible defaultOpen>
|
|
17
|
+
{({ open }) => (
|
|
18
|
+
<>
|
|
19
|
+
<div className="flex items-center justify-between">
|
|
20
|
+
<span>Title</span>
|
|
21
|
+
<AccordionContainer.Trigger />
|
|
22
|
+
</div>
|
|
23
|
+
<AccordionContainer.Content>
|
|
24
|
+
{open && <p>Body content</p>}
|
|
25
|
+
</AccordionContainer.Content>
|
|
26
|
+
</>
|
|
27
|
+
)}
|
|
28
|
+
</AccordionContainer>
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
The shared disclosure primitive behind Card's and Section's `isCollapsable`
|
|
32
|
+
variant. Owns open state, the trigger button, chevron rotation, and panel
|
|
33
|
+
animation — nothing else. It never imposes visual styling beyond what the
|
|
34
|
+
disclosure mechanic itself requires: no padding/background/border on `Root` or
|
|
35
|
+
`Content`, no position/hover opinion on `Trigger` beyond the chevron's glyph
|
|
36
|
+
color (the same neutral treatment Accordion's chevron uses). Every other
|
|
37
|
+
visual decision (header layout, spacing, background, borders) stays owned by
|
|
38
|
+
the component composing it.
|
|
39
|
+
|
|
40
|
+
> **Status: draft.** No single Figma node maps 1:1 to this component — it's a
|
|
41
|
+
> generic primitive factored out of Card's and Section's confirmed
|
|
42
|
+
> `isCollapsable` contract (Figma file `lrU3ydIyvPYQNE6ixdsKtJ`, node
|
|
43
|
+
> `10561:83806`). No Figma Code Connect file exists for this reason.
|
|
44
|
+
|
|
45
|
+
## When to use
|
|
46
|
+
|
|
47
|
+
- Composing a disclosure (expand/collapse) mechanic into your own component's
|
|
48
|
+
header layout, where you control the header's spacing, borders, and which
|
|
49
|
+
content varies by state.
|
|
50
|
+
|
|
51
|
+
## When not to use
|
|
52
|
+
|
|
53
|
+
- A standalone, generically-styled disclosure with no host component — use
|
|
54
|
+
**`Collapsible`** directly.
|
|
55
|
+
- A vertical set of mutually-exclusive disclosure sections — use
|
|
56
|
+
**`Accordion`**.
|
|
57
|
+
|
|
58
|
+
## Parts
|
|
59
|
+
|
|
60
|
+
| Export | Purpose |
|
|
61
|
+
| ---------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
62
|
+
| `AccordionContainer` | Root — holds the open state. Renders no wrapping element when `collapsible` is false, unless a ref/className/style/render/DOM prop is passed. |
|
|
63
|
+
| `AccordionContainer.Trigger` | Toggles the panel; renders a rotating chevron with a default `aria-label`. Renders nothing when not collapsible. |
|
|
64
|
+
| `AccordionContainer.Content` | The height-animating panel. Renders children unwrapped when not collapsible, with the same wrapper exception as Root. |
|
|
65
|
+
|
|
66
|
+
## Example
|
|
67
|
+
|
|
68
|
+
```tsx
|
|
69
|
+
import { AccordionContainer } from '@acronis-platform/ui-react';
|
|
70
|
+
|
|
71
|
+
function CollapsibleCard({ collapsible, title, children }) {
|
|
72
|
+
return (
|
|
73
|
+
<AccordionContainer collapsible={collapsible} defaultOpen>
|
|
74
|
+
{({ open }) => (
|
|
75
|
+
<>
|
|
76
|
+
<div className="flex items-center justify-between border-b p-4">
|
|
77
|
+
<span className="font-medium">{title}</span>
|
|
78
|
+
<AccordionContainer.Trigger
|
|
79
|
+
aria-label={open ? 'Collapse' : 'Expand'}
|
|
80
|
+
className="size-8 rounded-md hover:bg-[var(--ui-background-surface-hover)]"
|
|
81
|
+
/>
|
|
82
|
+
</div>
|
|
83
|
+
<AccordionContainer.Content>
|
|
84
|
+
<div className="p-4">{children}</div>
|
|
85
|
+
</AccordionContainer.Content>
|
|
86
|
+
</>
|
|
87
|
+
)}
|
|
88
|
+
</AccordionContainer>
|
|
89
|
+
);
|
|
90
|
+
}
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
## Props
|
|
94
|
+
|
|
95
|
+
| Prop | Type | Default | Required | Description |
|
|
96
|
+
|------|------|---------|----------|-------------|
|
|
97
|
+
| `collapsible` | `boolean` | `false` | no | Whether the disclosure exists at all. When false, `children` render directly with no trigger and no panel wrapper. |
|
|
98
|
+
| `open` | `boolean` | — | no | Whether the panel is open (controlled). No trigger or panel renders when collapsible is false, but the value is still tracked internally and exposed via the `children` render-prop's `{ open }` state. |
|
|
99
|
+
| `defaultOpen` | `boolean` | `false` | no | Whether the panel is initially open (uncontrolled). No trigger or panel renders when collapsible is false, but the value still seeds the internal state exposed via the `children` render-prop's `{ open }` state. |
|
|
100
|
+
| `disabled` | `boolean` | `false` | no | Disables the trigger. Ignored when collapsible is false. |
|
|
101
|
+
| `render` | `RenderProp` | `undefined` | no | Base UI composition prop on the root — replaces the rendered element while merging props and classes. When collapsible is false the root renders no wrapping element unless a ref, className, style, render, or other DOM prop is supplied — in which case it wraps children in a plain `div` so none of those are silently dropped. React-only; other frameworks use their own polymorphism. |
|
|
102
|
+
| `children` | `ReactNode | ((state: { open: boolean }) => ReactNode)` | — | no | The composed content — typically a trigger placed by the consumer's own header layout plus a `Content` panel. May also be a function receiving the current `{ open }` state, for content outside `Content` that needs to vary by state even when this component owns the open state itself (uncontrolled). Not needed when the consumer already controls `open` — it already has the value in scope. |
|
|
103
|
+
|
|
104
|
+
## Events
|
|
105
|
+
|
|
106
|
+
| Event | Payload | Description |
|
|
107
|
+
|-------|---------|-------------|
|
|
108
|
+
| `onOpenChange` | `(open: boolean, eventDetails) => void` | Fired when the open state changes. Ignored when collapsible is false. |
|
|
109
|
+
|
|
110
|
+
## Behavior
|
|
111
|
+
|
|
112
|
+
```gherkin
|
|
113
|
+
Scenario: Not collapsible
|
|
114
|
+
Given an AccordionContainer with collapsible=false
|
|
115
|
+
When it renders
|
|
116
|
+
Then no Trigger renders
|
|
117
|
+
And Content renders its children directly, with no panel wrapper
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
```gherkin
|
|
121
|
+
Scenario: Toggle (uncontrolled)
|
|
122
|
+
Given a collapsible AccordionContainer with a Trigger and Content
|
|
123
|
+
When the user activates the Trigger
|
|
124
|
+
Then the Content panel animates open (and closed on the next activation)
|
|
125
|
+
And the Trigger's chevron rotates 90° to reflect the open state
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
```gherkin
|
|
129
|
+
Scenario: Initially open (uncontrolled)
|
|
130
|
+
Given collapsible is true and defaultOpen is set
|
|
131
|
+
Then the panel renders open on mount
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
```gherkin
|
|
135
|
+
Scenario: Controlled
|
|
136
|
+
Given collapsible is true, open is passed explicitly, and onOpenChange is provided
|
|
137
|
+
When the user activates the Trigger
|
|
138
|
+
Then AccordionContainer does not change its own open state
|
|
139
|
+
And onOpenChange fires with the next open value
|
|
140
|
+
And the panel only reflects the new state once the consumer updates `open`
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
```gherkin
|
|
144
|
+
Scenario: Render-prop children receive the open state
|
|
145
|
+
Given a collapsible AccordionContainer whose children is a function
|
|
146
|
+
When the panel's open state changes (controlled or uncontrolled)
|
|
147
|
+
Then the function is called with the current { open } value
|
|
148
|
+
And content outside Content (e.g. a header) can vary based on it
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
## Accessibility
|
|
152
|
+
|
|
153
|
+
- Built on Base UI's Collapsible when `collapsible` is true: the trigger is a
|
|
154
|
+
`<button>` with `aria-expanded` and `aria-controls` pointing at the panel,
|
|
155
|
+
toggled with Enter/Space. Focus stays on the trigger.
|
|
156
|
+
- The trigger renders only an icon (no text). It falls back to
|
|
157
|
+
`aria-label="Toggle"` when the consumer supplies neither `aria-label` nor
|
|
158
|
+
`aria-labelledby`, so the default rendering always has an accessible name —
|
|
159
|
+
but the consumer composing it into a header should still override it (e.g.
|
|
160
|
+
`aria-labelledby` pointing at the surrounding heading/title) for a
|
|
161
|
+
meaningful name.
|
|
162
|
+
- When `collapsible` is false there is no interactive element at all — content
|
|
163
|
+
renders as if there were no disclosure.
|
|
164
|
+
|
|
165
|
+
## Keyboard
|
|
166
|
+
|
|
167
|
+
- Enter/Space toggles the trigger when focused.
|
|
168
|
+
- No other keyboard behavior is added; focus order follows source order.
|
|
169
|
+
|
|
170
|
+
## Screen reader
|
|
171
|
+
|
|
172
|
+
- The trigger's `aria-expanded` state is announced on toggle. The panel's
|
|
173
|
+
content is only reachable via normal document flow (no `aria-hidden`
|
|
174
|
+
toggling beyond what Base UI's Collapsible manages internally).
|
|
175
|
+
|
|
176
|
+
## Contrast
|
|
177
|
+
|
|
178
|
+
The trigger's chevron uses `--ui-glyph-on-surface-neutral-dark`, which meets
|
|
179
|
+
WCAG AA against a surface background in both light and dark themes.
|
|
180
|
+
AccordionContainer adds no other color; contrast for everything else is
|
|
181
|
+
governed by whatever the consumer places inside it.
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
# Accordion
|
|
2
|
+
|
|
3
|
+
> A vertical set of disclosure sections — each with a header trigger and a height-animating panel; single or multiple open at once. Built on Base UI's Accordion. Ported from the legacy shadcn-uikit `accordion`.
|
|
4
|
+
|
|
5
|
+
**Status:** draft · **Category:** layout · **Since:** v0.49.0
|
|
6
|
+
|
|
7
|
+
## Import
|
|
8
|
+
|
|
9
|
+
```tsx
|
|
10
|
+
import { Accordion, AccordionItem, AccordionTrigger, AccordionContent } from '@acronis-platform/ui-react'
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Quick example
|
|
14
|
+
|
|
15
|
+
```tsx
|
|
16
|
+
<Accordion>
|
|
17
|
+
<AccordionItem value="a">
|
|
18
|
+
<AccordionTrigger>Section</AccordionTrigger>
|
|
19
|
+
<AccordionContent>Content</AccordionContent>
|
|
20
|
+
</AccordionItem>
|
|
21
|
+
</Accordion>
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
A vertical set of disclosure sections — each a header trigger over a
|
|
25
|
+
height-animating panel. Single open at a time by default; `multiple` allows
|
|
26
|
+
several. Built on Base UI's Accordion.
|
|
27
|
+
|
|
28
|
+
> Design-pending v1, ported from the legacy shadcn-uikit `accordion`.
|
|
29
|
+
|
|
30
|
+
## When to use
|
|
31
|
+
|
|
32
|
+
- Condense a long page into expandable sections (e.g. an FAQ, grouped settings).
|
|
33
|
+
|
|
34
|
+
## When not to use
|
|
35
|
+
|
|
36
|
+
- A single optional section — use `Collapsible`.
|
|
37
|
+
- Navigating between views — use `Tabs`.
|
|
38
|
+
|
|
39
|
+
## Parts
|
|
40
|
+
|
|
41
|
+
| Export | Purpose |
|
|
42
|
+
| ------------------ | --------------------------------------------------- |
|
|
43
|
+
| `Accordion` | Root — tracks open items; `multiple` to allow many. |
|
|
44
|
+
| `AccordionItem` | One section (needs a `value`). |
|
|
45
|
+
| `AccordionTrigger` | The header button (title + chevron). |
|
|
46
|
+
| `AccordionContent` | The height-animating panel. |
|
|
47
|
+
|
|
48
|
+
## Example
|
|
49
|
+
|
|
50
|
+
```tsx
|
|
51
|
+
import {
|
|
52
|
+
Accordion,
|
|
53
|
+
AccordionItem,
|
|
54
|
+
AccordionTrigger,
|
|
55
|
+
AccordionContent,
|
|
56
|
+
} from '@acronis-platform/ui-react';
|
|
57
|
+
|
|
58
|
+
<Accordion defaultValue={['a']}>
|
|
59
|
+
<AccordionItem value="a">
|
|
60
|
+
<AccordionTrigger>What is included?</AccordionTrigger>
|
|
61
|
+
<AccordionContent>Backup, recovery, and anti-malware.</AccordionContent>
|
|
62
|
+
</AccordionItem>
|
|
63
|
+
</Accordion>;
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
## Props
|
|
67
|
+
|
|
68
|
+
| Prop | Type | Default | Required | Description |
|
|
69
|
+
|------|------|---------|----------|-------------|
|
|
70
|
+
| `value` | `Value[]` | — | no | The open item value(s) (controlled). |
|
|
71
|
+
| `defaultValue` | `Value[]` | — | no | The initially open item value(s) (uncontrolled). |
|
|
72
|
+
| `multiple` | `boolean` | `false` | no | Whether multiple items can be open at the same time. |
|
|
73
|
+
| `disabled` | `boolean` | `false` | no | Disables all items. |
|
|
74
|
+
|
|
75
|
+
## Events
|
|
76
|
+
|
|
77
|
+
| Event | Payload | Description |
|
|
78
|
+
|-------|---------|-------------|
|
|
79
|
+
| `onValueChange` | `(value: Value[], eventDetails) => void` | Fired when the set of open items changes. |
|
|
80
|
+
|
|
81
|
+
## Behavior
|
|
82
|
+
|
|
83
|
+
```gherkin
|
|
84
|
+
Scenario: Expand a section
|
|
85
|
+
Given an Accordion with items
|
|
86
|
+
When the user clicks a section's trigger
|
|
87
|
+
Then its panel animates open and the chevron rotates
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
```gherkin
|
|
91
|
+
Scenario: Single (default)
|
|
92
|
+
Given the default (single) mode
|
|
93
|
+
When the user opens another section
|
|
94
|
+
Then the previously open section closes
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
```gherkin
|
|
98
|
+
Scenario: Multiple
|
|
99
|
+
Given multiple is set
|
|
100
|
+
When the user opens several sections
|
|
101
|
+
Then they all stay open until individually toggled
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
```gherkin
|
|
105
|
+
Scenario: Initially open
|
|
106
|
+
Given defaultValue lists item value(s)
|
|
107
|
+
Then those sections render open on mount
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
## Accessibility
|
|
111
|
+
|
|
112
|
+
- Built on Base UI's Accordion: each trigger sits in an `Accordion.Header`
|
|
113
|
+
(heading role) and is a `<button>` with `aria-expanded` / `aria-controls`; the
|
|
114
|
+
panel is associated back via `aria-labelledby`. Arrow keys move between headers,
|
|
115
|
+
Enter/Space toggles, and Home/End jump to the first/last.
|
|
116
|
+
- The chevron rotation is decorative — the open state is conveyed by
|
|
117
|
+
`aria-expanded`, so don't rely on the icon alone.
|
|
118
|
+
- Give each trigger a clear, distinct label.
|
|
119
|
+
|
|
120
|
+
## Contrast
|
|
121
|
+
|
|
122
|
+
The divider (`--ui-border-on-surface-border`) and the muted chevron/panel text
|
|
123
|
+
(`--ui-text-on-surface-secondary`) meet contrast in light and dark; trigger labels
|
|
124
|
+
inherit the foreground.
|
|
@@ -0,0 +1,225 @@
|
|
|
1
|
+
# Alert
|
|
2
|
+
|
|
3
|
+
> An inline status banner: a neutral surface carrying its severity through a status-colored border and a status line down the leading edge, with a fixed status icon per severity, composable title / description / action parts, and an optional dismiss control.
|
|
4
|
+
|
|
5
|
+
**Status:** stable · **Category:** feedback · **Since:** v0.48.0
|
|
6
|
+
|
|
7
|
+
## Import
|
|
8
|
+
|
|
9
|
+
```tsx
|
|
10
|
+
import { Alert, AlertIcon, AlertContent, AlertText, AlertTitle, AlertDescription, AlertActions, AlertClose } from '@acronis-platform/ui-react'
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Quick example
|
|
14
|
+
|
|
15
|
+
```tsx
|
|
16
|
+
<Alert variant="danger">
|
|
17
|
+
<AlertIcon />
|
|
18
|
+
<AlertContent>
|
|
19
|
+
<AlertText>
|
|
20
|
+
<AlertTitle>Session expired</AlertTitle>
|
|
21
|
+
<AlertDescription>Sign in again to keep working.</AlertDescription>
|
|
22
|
+
</AlertText>
|
|
23
|
+
<AlertActions>
|
|
24
|
+
<Button variant="secondary">Sign in</Button>
|
|
25
|
+
</AlertActions>
|
|
26
|
+
</AlertContent>
|
|
27
|
+
<AlertClose onClick={dismiss} />
|
|
28
|
+
</Alert>
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
An inline status banner. The surface is neutral in every severity; the severity
|
|
32
|
+
is carried by a status-colored border and a 6px status line down the leading
|
|
33
|
+
edge, plus a fixed icon per severity.
|
|
34
|
+
|
|
35
|
+
## When to use
|
|
36
|
+
|
|
37
|
+
- Surface a contextual status message (info, success, warning, critical, danger)
|
|
38
|
+
inline on a page or in a panel, where it stays until the condition changes or
|
|
39
|
+
the user dismisses it.
|
|
40
|
+
- Give the user something to do about it — `AlertActions` is the intended place
|
|
41
|
+
for the remedy.
|
|
42
|
+
|
|
43
|
+
## When not to use
|
|
44
|
+
|
|
45
|
+
- Transient, auto-dismissing notifications — use `Toast`.
|
|
46
|
+
- A blocking confirmation — use `Dialog`.
|
|
47
|
+
- A page-wide, top-anchored announcement bar — that's `AlertRibbon`.
|
|
48
|
+
- A field-level validation message — that belongs on the input.
|
|
49
|
+
|
|
50
|
+
## Severity
|
|
51
|
+
|
|
52
|
+
| Variant | Icon | Use for |
|
|
53
|
+
| ---------- | ----------------------- | ---------------------------------------------- |
|
|
54
|
+
| `info` | `CircleInfoBlue` | Neutral context the user should notice. |
|
|
55
|
+
| `success` | `CircleCheckGreen` | An operation completed. |
|
|
56
|
+
| `warning` | `TriangleWarningYellow` | Something needs attention soon. |
|
|
57
|
+
| `critical` | `CircleWarningOrange` | Something is degraded and needs attention now. |
|
|
58
|
+
| `danger` | `DiamondWarningRed` | A failure or destructive condition. |
|
|
59
|
+
|
|
60
|
+
## Parts
|
|
61
|
+
|
|
62
|
+
| Export | Purpose |
|
|
63
|
+
| ------------------ | ------------------------------------------------------------------------------------- |
|
|
64
|
+
| `Alert` | The banner root (`role="alert"`) + `variant`. |
|
|
65
|
+
| `AlertIcon` | The leading status icon — defaults to the variant's own glyph. |
|
|
66
|
+
| `AlertContent` | The column beside the icon. |
|
|
67
|
+
| `AlertText` | Wraps the title + description; its padding aligns the first line with the icon. |
|
|
68
|
+
| `AlertTitle` | A short heading. |
|
|
69
|
+
| `AlertDescription` | Optional supporting text. |
|
|
70
|
+
| `AlertActions` | Optional wrapping row of action buttons, inside `AlertContent` after `AlertText`. |
|
|
71
|
+
| `AlertClose` | Optional trailing dismiss control — rendering it is what makes the alert dismissable. |
|
|
72
|
+
|
|
73
|
+
Keep the title and description inside `AlertText` rather than directly under
|
|
74
|
+
`AlertContent`: `AlertText`'s vertical padding is what keeps the first line of
|
|
75
|
+
text aligned with the icon box.
|
|
76
|
+
|
|
77
|
+
## Example
|
|
78
|
+
|
|
79
|
+
```tsx
|
|
80
|
+
import {
|
|
81
|
+
Alert,
|
|
82
|
+
AlertActions,
|
|
83
|
+
AlertClose,
|
|
84
|
+
AlertContent,
|
|
85
|
+
AlertDescription,
|
|
86
|
+
AlertIcon,
|
|
87
|
+
AlertText,
|
|
88
|
+
AlertTitle,
|
|
89
|
+
Button,
|
|
90
|
+
} from '@acronis-platform/ui-react';
|
|
91
|
+
|
|
92
|
+
<Alert variant="danger">
|
|
93
|
+
<AlertIcon />
|
|
94
|
+
<AlertContent>
|
|
95
|
+
<AlertText>
|
|
96
|
+
<AlertTitle>Session expired</AlertTitle>
|
|
97
|
+
<AlertDescription>Sign in again to keep working.</AlertDescription>
|
|
98
|
+
</AlertText>
|
|
99
|
+
<AlertActions>
|
|
100
|
+
<Button variant="secondary">Sign in</Button>
|
|
101
|
+
</AlertActions>
|
|
102
|
+
</AlertContent>
|
|
103
|
+
<AlertClose onClick={dismiss} />
|
|
104
|
+
</Alert>;
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
A title-only, non-dismissable alert is just the parts you keep:
|
|
108
|
+
|
|
109
|
+
```tsx
|
|
110
|
+
<Alert variant="success">
|
|
111
|
+
<AlertIcon />
|
|
112
|
+
<AlertContent>
|
|
113
|
+
<AlertText>
|
|
114
|
+
<AlertTitle>Your changes were saved</AlertTitle>
|
|
115
|
+
</AlertText>
|
|
116
|
+
</AlertContent>
|
|
117
|
+
</Alert>
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
## Props
|
|
121
|
+
|
|
122
|
+
| Prop | Type | Default | Required | Description |
|
|
123
|
+
|------|------|---------|----------|-------------|
|
|
124
|
+
| `variant` | `'info' | 'success' | 'warning' | 'critical' | 'danger'` | `'info'` | no | Severity. Sets the border color, the leading status-line color, and the default status icon. The surface stays neutral in every severity. |
|
|
125
|
+
|
|
126
|
+
## Content slots
|
|
127
|
+
|
|
128
|
+
| Slot | Description |
|
|
129
|
+
|------|-------------|
|
|
130
|
+
| `children` | The composed parts — AlertIcon, AlertContent (AlertText wrapping AlertTitle / AlertDescription, optionally AlertActions), and AlertClose. |
|
|
131
|
+
|
|
132
|
+
## Behavior
|
|
133
|
+
|
|
134
|
+
```gherkin
|
|
135
|
+
Scenario: Announce a status
|
|
136
|
+
Given an Alert with a title and description
|
|
137
|
+
Then it renders with role="alert" so assistive tech announces it
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
```gherkin
|
|
141
|
+
Scenario: Severity variant
|
|
142
|
+
Given variant="success" (or info / warning / critical / danger)
|
|
143
|
+
Then the container border and the leading status line take that severity's color
|
|
144
|
+
And the surface stays neutral, identical across every severity
|
|
145
|
+
And AlertIcon renders that severity's own icon
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
```gherkin
|
|
149
|
+
Scenario: Override the status icon
|
|
150
|
+
Given an AlertIcon with children
|
|
151
|
+
Then the supplied glyph replaces the variant's default icon
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
```gherkin
|
|
155
|
+
Scenario: Title-only alert
|
|
156
|
+
Given an AlertText containing only an AlertTitle
|
|
157
|
+
Then the title's first line stays aligned with the status icon
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
```gherkin
|
|
161
|
+
Scenario: Actions below the text
|
|
162
|
+
Given an AlertActions inside AlertContent, after AlertText
|
|
163
|
+
Then the buttons flow below the description
|
|
164
|
+
And the row wraps onto further lines when it runs out of width
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
```gherkin
|
|
168
|
+
Scenario: Dismiss
|
|
169
|
+
Given an AlertClose with an onClick handler
|
|
170
|
+
When the control is activated by pointer or keyboard
|
|
171
|
+
Then the handler fires and the consumer removes the alert
|
|
172
|
+
# The component never removes itself — visibility is the consumer's state.
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
```gherkin
|
|
176
|
+
Scenario: Not dismissable
|
|
177
|
+
Given an Alert with no AlertClose
|
|
178
|
+
Then no dismiss control renders and the content column takes that width
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
```gherkin
|
|
182
|
+
Scenario: Right-to-left
|
|
183
|
+
Given dir="rtl" on an ancestor
|
|
184
|
+
Then the status line sits on the right edge and the dismiss control on the left
|
|
185
|
+
And the status icons are not mirrored (they are direction-agnostic)
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
## Accessibility
|
|
189
|
+
|
|
190
|
+
- The root carries `role="alert"`, so screen readers announce its content when it
|
|
191
|
+
appears. Use it for important, time-sensitive messages; for non-urgent status,
|
|
192
|
+
pass `role="status"` so it is announced politely instead of assertively.
|
|
193
|
+
- `role="alert"` implies `aria-live="assertive"`, which interrupts the user. Do
|
|
194
|
+
not render a batch of alerts at once, and do not re-mount one on every keystroke.
|
|
195
|
+
- Don't rely on color alone to signal severity. Each variant pairs its color with
|
|
196
|
+
a distinct icon **shape** (circle-info, circle-check, triangle, circle-warning,
|
|
197
|
+
diamond) and the title text carries the meaning in words.
|
|
198
|
+
- The status icons are decorative — the title and description carry the message —
|
|
199
|
+
so they contribute no accessible name. Supply your own labelled glyph via
|
|
200
|
+
`AlertIcon` children if it conveys something the text doesn't.
|
|
201
|
+
|
|
202
|
+
## Keyboard
|
|
203
|
+
|
|
204
|
+
| Key | Action |
|
|
205
|
+
| ----------------- | -------------------------------------------------------------------------- |
|
|
206
|
+
| `Tab` | Moves through the action buttons, then the dismiss control (source order). |
|
|
207
|
+
| `Enter` / `Space` | Activates the focused action or dismiss control. |
|
|
208
|
+
|
|
209
|
+
The banner itself is not focusable — only its controls are.
|
|
210
|
+
|
|
211
|
+
## Screen reader
|
|
212
|
+
|
|
213
|
+
- The whole banner's text is announced on insertion, so keep the title short and
|
|
214
|
+
put detail in the description.
|
|
215
|
+
- `AlertClose` needs an accessible name; it defaults to `"Close"` and is
|
|
216
|
+
overridable via the `ariaLabel` prop for localization.
|
|
217
|
+
|
|
218
|
+
## Contrast
|
|
219
|
+
|
|
220
|
+
Text sits on the neutral surface (`--ui-alert-global-container-background`) using
|
|
221
|
+
the shared title/description colors, so contrast does not vary by severity. The
|
|
222
|
+
severity colors are used only on the border and the status line — both
|
|
223
|
+
non-text, so they are held to the 3:1 non-text contrast requirement rather than
|
|
224
|
+
4.5:1. The status line's 6px width also makes severity distinguishable without
|
|
225
|
+
reading color at all.
|