@ensi-platform/admin-ui 0.6.0 → 0.8.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/{Component-B2_pbcdj.js → Component-BnSNDZFt.js} +3 -3
- package/dist/{Component-B2_pbcdj.js.map → Component-BnSNDZFt.js.map} +1 -1
- package/dist/{Component-BiiaP51W.js → Component-C6mp0LOp.js} +2 -2
- package/dist/{Component-BiiaP51W.js.map → Component-C6mp0LOp.js.map} +1 -1
- package/dist/{Component-7vxv_s32.js → Component-CDgOJr89.js} +2 -2
- package/dist/{Component-7vxv_s32.js.map → Component-CDgOJr89.js.map} +1 -1
- package/dist/{Component-CRVPfwqm.js → Component-CIxKpL6s.js} +3 -3
- package/dist/{Component-CRVPfwqm.js.map → Component-CIxKpL6s.js.map} +1 -1
- package/dist/{Component-KNlwEG00.js → Component-D25FKJAT.js} +2 -2
- package/dist/{Component-KNlwEG00.js.map → Component-D25FKJAT.js.map} +1 -1
- package/dist/{Component-DFwWbzFS.js → Component-D310jlAj.js} +2 -2
- package/dist/{Component-DFwWbzFS.js.map → Component-D310jlAj.js.map} +1 -1
- package/dist/{Component-CwYbdJhI.js → Component-XnDMb714.js} +3 -3
- package/dist/{Component-CwYbdJhI.js.map → Component-XnDMb714.js.map} +1 -1
- package/dist/{Component-Dkvzqo0L.js → Component-ZIAMtMpP.js} +2 -2
- package/dist/{Component-Dkvzqo0L.js.map → Component-ZIAMtMpP.js.map} +1 -1
- package/dist/{Component-DhhrZEMr.js → Component-qJGssCB4.js} +3 -3
- package/dist/{Component-DhhrZEMr.js.map → Component-qJGssCB4.js.map} +1 -1
- package/dist/Copy-DBU7bgFo.js +28 -0
- package/dist/Copy-DBU7bgFo.js.map +1 -0
- package/dist/action-popup/index.js +2 -2
- package/dist/active-filters/index.js +2 -2
- package/dist/arrangement-settings/index.js +3 -3
- package/dist/assets/index.css +1 -1
- package/dist/assets/index10.css +1 -1
- package/dist/assets/index11.css +1 -1
- package/dist/assets/index12.css +1 -1
- package/dist/assets/index13.css +1 -1
- package/dist/assets/index14.css +1 -1
- package/dist/assets/index15.css +1 -1
- package/dist/assets/index16.css +1 -1
- package/dist/assets/index17.css +1 -1
- package/dist/assets/index18.css +1 -1
- package/dist/assets/index19.css +1 -1
- package/dist/assets/index2.css +1 -1
- package/dist/assets/index20.css +1 -1
- package/dist/assets/index21.css +1 -1
- package/dist/assets/index22.css +1 -1
- package/dist/assets/index23.css +1 -1
- package/dist/assets/index24.css +1 -1
- package/dist/assets/index25.css +1 -1
- package/dist/assets/index26.css +1 -1
- package/dist/assets/index27.css +1 -1
- package/dist/assets/index28.css +1 -0
- package/dist/assets/index29.css +1 -0
- package/dist/assets/index3.css +1 -1
- package/dist/assets/index30.css +1 -0
- package/dist/assets/index31.css +1 -0
- package/dist/assets/index4.css +1 -1
- package/dist/assets/index5.css +1 -1
- package/dist/assets/index6.css +1 -1
- package/dist/assets/index7.css +1 -1
- package/dist/assets/index8.css +1 -1
- package/dist/assets/index9.css +1 -1
- package/dist/autocomplete/index.js +1 -1
- package/dist/autocomplete-async/index.js +1 -1
- package/dist/avatar/index.js +1 -1
- package/dist/badge/index.js +1 -1
- package/dist/bottom-sheet/index.js +2 -2
- package/dist/cascade-menu/index.js +3 -3
- package/dist/checkbox-group/index.js +1 -1
- package/dist/combobox/index.js +4 -4
- package/dist/copy-button/Component.d.ts +5 -0
- package/dist/copy-button/Component.d.ts.map +1 -0
- package/dist/copy-button/index.d.ts +3 -0
- package/dist/copy-button/index.d.ts.map +1 -0
- package/dist/copy-button/index.js +97 -0
- package/dist/copy-button/index.js.map +1 -0
- package/dist/copy-button/types.d.ts +14 -0
- package/dist/copy-button/types.d.ts.map +1 -0
- package/dist/data-table/index.js +3 -3
- package/dist/date-picker/index.js +3 -3
- package/dist/date-range-picker/index.js +3 -3
- package/dist/drawer/index.js +1 -1
- package/dist/filters/index.js +1 -1
- package/dist/flex-layout/Component.d.ts +9 -0
- package/dist/flex-layout/Component.d.ts.map +1 -0
- package/dist/flex-layout/components/Item/index.d.ts +5 -0
- package/dist/flex-layout/components/Item/index.d.ts.map +1 -0
- package/dist/flex-layout/index.d.ts +3 -0
- package/dist/flex-layout/index.d.ts.map +1 -0
- package/dist/flex-layout/index.js +93 -0
- package/dist/flex-layout/index.js.map +1 -0
- package/dist/flex-layout/types.d.ts +41 -0
- package/dist/flex-layout/types.d.ts.map +1 -0
- package/dist/grid/Component.d.ts +9 -0
- package/dist/grid/Component.d.ts.map +1 -0
- package/dist/grid/components/Item/index.d.ts +5 -0
- package/dist/grid/components/Item/index.d.ts.map +1 -0
- package/dist/grid/index.d.ts +3 -0
- package/dist/grid/index.d.ts.map +1 -0
- package/dist/grid/index.js +85 -0
- package/dist/grid/index.js.map +1 -0
- package/dist/grid/types.d.ts +44 -0
- package/dist/grid/types.d.ts.map +1 -0
- package/dist/grid/utils.d.ts +6 -0
- package/dist/grid/utils.d.ts.map +1 -0
- package/dist/{hooks-BAkrGC45.js → hooks-BlX5Y4Zt.js} +9 -6
- package/dist/hooks-BlX5Y4Zt.js.map +1 -0
- package/dist/icons/index.js +80 -100
- package/dist/icons/index.js.map +1 -1
- package/dist/{index-B-dHfeT9.js → index-BXlN61PG.js} +2 -2
- package/dist/{index-B-dHfeT9.js.map → index-BXlN61PG.js.map} +1 -1
- package/dist/{index-bdpk2nvt.js → index-CDCqZ3um.js} +3 -3
- package/dist/{index-bdpk2nvt.js.map → index-CDCqZ3um.js.map} +1 -1
- package/dist/{index-CVEaKh8K.js → index-tPhlowOw.js} +4 -4
- package/dist/{index-CVEaKh8K.js.map → index-tPhlowOw.js.map} +1 -1
- package/dist/input/index.js +1 -1
- package/dist/loader/index.js +2 -2
- package/dist/menu-list/index.js +1 -1
- package/dist/{metrics-C8FBvbwl.js → metrics-B5YsELiI.js} +2 -2
- package/dist/{metrics-C8FBvbwl.js.map → metrics-B5YsELiI.js.map} +1 -1
- package/dist/modal/index.js +1 -1
- package/dist/multi-autocomplete/index.js +1 -1
- package/dist/multi-autocomplete-async/index.js +1 -1
- package/dist/multi-select/index.js +3 -3
- package/dist/number-input/index.js +1 -1
- package/dist/number-range/index.js +2 -2
- package/dist/provider/context.d.ts.map +1 -1
- package/dist/provider/index.js +3 -3
- package/dist/provider/types.d.ts +6 -0
- package/dist/provider/types.d.ts.map +1 -1
- package/dist/select/index.js +1 -1
- package/dist/slider/index.js +1 -1
- package/dist/suggest-checklist/index.js +4 -4
- package/dist/switch/index.js +1 -1
- package/dist/table/index.js +1 -1
- package/dist/tabs/index.js +1 -1
- package/dist/tag/index.js +1 -1
- package/dist/textarea/index.js +2 -2
- package/dist/time-field/index.js +2 -2
- package/dist/toast/index.js +2 -2
- package/dist/typography/index.js +1 -1
- package/dist/{utils-DUOIRqE-.js → utils-Dj_u-w0s.js} +3 -3
- package/dist/{utils-DUOIRqE-.js.map → utils-Dj_u-w0s.js.map} +1 -1
- package/dist/vertical-tabs/Component.d.ts +18 -0
- package/dist/vertical-tabs/Component.d.ts.map +1 -0
- package/dist/vertical-tabs/components/Indicator/index.d.ts +6 -0
- package/dist/vertical-tabs/components/Indicator/index.d.ts.map +1 -0
- package/dist/vertical-tabs/components/Item/index.d.ts +5 -0
- package/dist/vertical-tabs/components/Item/index.d.ts.map +1 -0
- package/dist/vertical-tabs/components/Item/theme.d.ts +5 -0
- package/dist/vertical-tabs/components/Item/theme.d.ts.map +1 -0
- package/dist/vertical-tabs/components/List/index.d.ts +5 -0
- package/dist/vertical-tabs/components/List/index.d.ts.map +1 -0
- package/dist/vertical-tabs/components/List/theme.d.ts +5 -0
- package/dist/vertical-tabs/components/List/theme.d.ts.map +1 -0
- package/dist/vertical-tabs/components/Panel/index.d.ts +5 -0
- package/dist/vertical-tabs/components/Panel/index.d.ts.map +1 -0
- package/dist/vertical-tabs/components/Panels/index.d.ts +5 -0
- package/dist/vertical-tabs/components/Panels/index.d.ts.map +1 -0
- package/dist/vertical-tabs/context.d.ts +4 -0
- package/dist/vertical-tabs/context.d.ts.map +1 -0
- package/dist/vertical-tabs/index.d.ts +4 -0
- package/dist/vertical-tabs/index.d.ts.map +1 -0
- package/dist/vertical-tabs/index.js +193 -0
- package/dist/vertical-tabs/index.js.map +1 -0
- package/dist/vertical-tabs/theme.d.ts +5 -0
- package/dist/vertical-tabs/theme.d.ts.map +1 -0
- package/dist/vertical-tabs/types.d.ts +84 -0
- package/dist/vertical-tabs/types.d.ts.map +1 -0
- package/docs/design-language.md +5 -4
- package/docs/skills/SKILL.md +5 -1
- package/package.json +17 -1
- package/src/copy-button/docs/Description.md +23 -0
- package/src/copy-button/docs/Example.md +5 -0
- package/src/copy-button/docs/cssVariables.ts +12 -0
- package/src/copy-button/types.ts +16 -0
- package/src/flex-layout/docs/Description.md +27 -0
- package/src/flex-layout/docs/Example.md +11 -0
- package/src/flex-layout/docs/cssVariables.ts +13 -0
- package/src/flex-layout/types.ts +49 -0
- package/src/grid/docs/Description.md +26 -0
- package/src/grid/docs/Example.md +16 -0
- package/src/grid/docs/cssVariables.ts +13 -0
- package/src/grid/types.ts +53 -0
- package/src/provider/types.ts +6 -0
- package/src/vertical-tabs/docs/Description.md +32 -0
- package/src/vertical-tabs/docs/Example.md +19 -0
- package/src/vertical-tabs/docs/cssVariables.ts +25 -0
- package/src/vertical-tabs/types.ts +110 -0
- package/dist/hooks-BAkrGC45.js.map +0 -1
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { type ComponentPropsWithRef, type ReactNode, type Ref } from 'react';
|
|
2
|
+
|
|
3
|
+
import { type IDataTestIdProps } from '@ds/common';
|
|
4
|
+
|
|
5
|
+
/** Gap step. Matches the spacing scale. */
|
|
6
|
+
export type TFlexLayoutGap = 0 | 4 | 8 | 12 | 16 | 20 | 24 | 32 | 40 | 48 | 64;
|
|
7
|
+
|
|
8
|
+
/** Main axis. */
|
|
9
|
+
export type TFlexLayoutDirection = 'row' | 'column';
|
|
10
|
+
|
|
11
|
+
/** Cross-axis alignment. */
|
|
12
|
+
export type TFlexLayoutAlign = 'start' | 'center' | 'end' | 'stretch';
|
|
13
|
+
|
|
14
|
+
/** Main-axis distribution. */
|
|
15
|
+
export type TFlexLayoutJustify = 'start' | 'center' | 'end' | 'between';
|
|
16
|
+
|
|
17
|
+
/** Own props for FlexLayout. */
|
|
18
|
+
export interface IFlexLayoutOwnProps extends IDataTestIdProps {
|
|
19
|
+
children: ReactNode;
|
|
20
|
+
/** Row or column. */
|
|
21
|
+
direction?: TFlexLayoutDirection;
|
|
22
|
+
/** Gap between items. */
|
|
23
|
+
gap?: TFlexLayoutGap;
|
|
24
|
+
/** Cross-axis alignment. */
|
|
25
|
+
align?: TFlexLayoutAlign;
|
|
26
|
+
/** Main-axis distribution. */
|
|
27
|
+
justify?: TFlexLayoutJustify;
|
|
28
|
+
/** Wrap items onto the next line. */
|
|
29
|
+
wrap?: boolean;
|
|
30
|
+
/** Removes the layout from the page. */
|
|
31
|
+
hidden?: boolean;
|
|
32
|
+
/** Ref to the layout (React 19 prop). */
|
|
33
|
+
ref?: Ref<HTMLDivElement>;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export interface IFlexLayoutProps
|
|
37
|
+
extends Omit<ComponentPropsWithRef<'div'>, keyof IFlexLayoutOwnProps | 'children'>, IFlexLayoutOwnProps {}
|
|
38
|
+
|
|
39
|
+
/** Own props for FlexLayout.Item. */
|
|
40
|
+
export interface IFlexLayoutItemOwnProps extends IDataTestIdProps {
|
|
41
|
+
children: ReactNode;
|
|
42
|
+
/** Take the free space on the main axis. */
|
|
43
|
+
grow?: boolean;
|
|
44
|
+
/** Ref to the item (React 19 prop). */
|
|
45
|
+
ref?: Ref<HTMLDivElement>;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export interface IFlexLayoutItemProps
|
|
49
|
+
extends Omit<ComponentPropsWithRef<'div'>, keyof IFlexLayoutItemOwnProps | 'children'>, IFlexLayoutItemOwnProps {}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
Grid for fields and for column splits.
|
|
2
|
+
|
|
3
|
+
```tsx
|
|
4
|
+
import { Grid } from '@ensi-platform/admin-ui/grid';
|
|
5
|
+
```
|
|
6
|
+
|
|
7
|
+
## When to use
|
|
8
|
+
|
|
9
|
+
- section fields in two or three columns
|
|
10
|
+
- one item across the whole grid (`col="full"`)
|
|
11
|
+
- a content-and-side split, by passing custom tracks in `cols`
|
|
12
|
+
|
|
13
|
+
The list filter grid is `Filters.Grid`.
|
|
14
|
+
|
|
15
|
+
## API (short)
|
|
16
|
+
|
|
17
|
+
| Prop | Values | Default | Description |
|
|
18
|
+
| ------------ | --------------------------------------------- | --------- | ------------------------------ |
|
|
19
|
+
| `cols` | `number` \| track list | — | columns |
|
|
20
|
+
| `gap` | `0` \| `4` \| `8` \| `12` \| `16` \| … \| `64` | `16` | gap, a spacing-scale step |
|
|
21
|
+
| `col` | `number` \| `full` | — | span when nested in another grid |
|
|
22
|
+
| `align` | `start` \| `center` \| `end` \| `stretch` | `stretch` | cross-axis alignment |
|
|
23
|
+
| `hidden` | `boolean` | `false` | removes the grid from layout |
|
|
24
|
+
| `dataTestId` | `string` | — | `data-test-id` for tests |
|
|
25
|
+
|
|
26
|
+
`Grid.Item` `col` is how many columns to take. `full` crosses the grid. A number in `cols` makes equal `minmax(0, 1fr)` columns. A number inside a track list is `Nfr`; a string is used as written (`minmax(0, 1fr)`).
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
## Example
|
|
2
|
+
|
|
3
|
+
```tsx
|
|
4
|
+
<Grid cols={2} gap={16}>
|
|
5
|
+
<FormInput name="last_name" label="Last name" />
|
|
6
|
+
<FormInput name="first_name" label="First name" />
|
|
7
|
+
<Grid.Item col="full">
|
|
8
|
+
<FormInput name="password" label="Password" />
|
|
9
|
+
</Grid.Item>
|
|
10
|
+
</Grid>
|
|
11
|
+
|
|
12
|
+
<Grid cols={['minmax(0, 1fr)', '16.25rem']} gap={0}>
|
|
13
|
+
<div>Main</div>
|
|
14
|
+
<aside>Aside</aside>
|
|
15
|
+
</Grid>
|
|
16
|
+
```
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/** Grid CSS variables from semantic tokens (--aui-grid-*). */
|
|
2
|
+
export const docsCssVariables = `/* CSS variables — Grid (--aui-grid-*) */
|
|
3
|
+
--aui-grid-gap-0: 0; /* no gap */
|
|
4
|
+
--aui-grid-gap-4: var(--aui-spacing-4); /* gap 4 */
|
|
5
|
+
--aui-grid-gap-8: var(--aui-spacing-8); /* gap 8 */
|
|
6
|
+
--aui-grid-gap-12: var(--aui-spacing-12); /* gap 12 */
|
|
7
|
+
--aui-grid-gap-16: var(--aui-spacing-16); /* gap 16 */
|
|
8
|
+
--aui-grid-gap-20: var(--aui-spacing-20); /* gap 20 */
|
|
9
|
+
--aui-grid-gap-24: var(--aui-spacing-24); /* gap 24 */
|
|
10
|
+
--aui-grid-gap-32: var(--aui-spacing-32); /* gap 32 */
|
|
11
|
+
--aui-grid-gap-40: var(--aui-spacing-40); /* gap 40 */
|
|
12
|
+
--aui-grid-gap-48: var(--aui-spacing-48); /* gap 48 */
|
|
13
|
+
--aui-grid-gap-64: var(--aui-spacing-64); /* gap 64 */`;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { type CSSProperties, type ComponentPropsWithRef, type ReactNode, type Ref } from 'react';
|
|
2
|
+
|
|
3
|
+
import { type IDataTestIdProps } from '@ds/common';
|
|
4
|
+
|
|
5
|
+
/** Gap step. Matches the spacing scale. */
|
|
6
|
+
export type TGridGap = 0 | 4 | 8 | 12 | 16 | 20 | 24 | 32 | 40 | 48 | 64;
|
|
7
|
+
|
|
8
|
+
/** One track: a number is `Nfr`, a string is used as written. */
|
|
9
|
+
export type TGridTrack = number | string;
|
|
10
|
+
|
|
11
|
+
/** How many columns an item spans. */
|
|
12
|
+
export type TGridCol = number | 'full';
|
|
13
|
+
|
|
14
|
+
/** Cross-axis alignment of items. */
|
|
15
|
+
export type TGridAlign = 'start' | 'center' | 'end' | 'stretch';
|
|
16
|
+
|
|
17
|
+
/** Own props for Grid. */
|
|
18
|
+
export interface IGridOwnProps extends IDataTestIdProps {
|
|
19
|
+
children: ReactNode;
|
|
20
|
+
/** Equal columns, or an explicit track list. */
|
|
21
|
+
cols: number | TGridTrack[];
|
|
22
|
+
/** Gap between items. */
|
|
23
|
+
gap?: TGridGap;
|
|
24
|
+
/** Span when this grid sits inside another grid. */
|
|
25
|
+
col?: TGridCol;
|
|
26
|
+
/** Cross-axis alignment. */
|
|
27
|
+
align?: TGridAlign;
|
|
28
|
+
/** Removes the grid from the layout. */
|
|
29
|
+
hidden?: boolean;
|
|
30
|
+
/** Ref to the grid (React 19 prop). */
|
|
31
|
+
ref?: Ref<HTMLDivElement>;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export interface IGridProps
|
|
35
|
+
extends Omit<ComponentPropsWithRef<'div'>, keyof IGridOwnProps | 'children'>, IGridOwnProps {}
|
|
36
|
+
|
|
37
|
+
/** Own props for Grid.Item. */
|
|
38
|
+
export interface IGridItemOwnProps extends IDataTestIdProps {
|
|
39
|
+
children: ReactNode;
|
|
40
|
+
/** Column span. `full` crosses the whole grid. */
|
|
41
|
+
col?: TGridCol;
|
|
42
|
+
/** Ref to the item (React 19 prop). */
|
|
43
|
+
ref?: Ref<HTMLDivElement>;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export interface IGridItemProps
|
|
47
|
+
extends Omit<ComponentPropsWithRef<'div'>, keyof IGridItemOwnProps | 'children'>, IGridItemOwnProps {}
|
|
48
|
+
|
|
49
|
+
/** Inline template written by Grid. */
|
|
50
|
+
export interface IGridStyle extends CSSProperties {
|
|
51
|
+
'--aui-grid-template'?: string;
|
|
52
|
+
'--aui-grid-col'?: string;
|
|
53
|
+
}
|
package/src/provider/types.ts
CHANGED
|
@@ -64,6 +64,12 @@ export interface IAuiLabels {
|
|
|
64
64
|
arrangementList: string;
|
|
65
65
|
/** ActiveFilters: clear the whole row. */
|
|
66
66
|
clearFilters: string;
|
|
67
|
+
/** CopyButton: idle accessible name prefix. */
|
|
68
|
+
copy: string;
|
|
69
|
+
/** CopyButton: success tooltip. `{value}` is the copied text. */
|
|
70
|
+
copied: string;
|
|
71
|
+
/** CopyButton: clipboard failure tooltip. */
|
|
72
|
+
copyFailed: string;
|
|
67
73
|
}
|
|
68
74
|
|
|
69
75
|
export type TAuiLabels = IAuiLabels;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
Vertical tabs: a column on the left and a panel on the right.
|
|
2
|
+
|
|
3
|
+
```tsx
|
|
4
|
+
import { VerticalTabs } from '@ensi-platform/admin-ui/vertical-tabs';
|
|
5
|
+
```
|
|
6
|
+
|
|
7
|
+
## When to use
|
|
8
|
+
|
|
9
|
+
- sections inside one page tab, when one column of fields is too long
|
|
10
|
+
- choosing a section replaces the panel beside it, not the whole page
|
|
11
|
+
|
|
12
|
+
Page sections use `Tabs`.
|
|
13
|
+
|
|
14
|
+
## API (short)
|
|
15
|
+
|
|
16
|
+
| Prop | Values | Default | Description |
|
|
17
|
+
| -------------- | ------------------------- | ------- | -------------------------- |
|
|
18
|
+
| `size` | `sm` \| `md` \| `lg` | `md` | size |
|
|
19
|
+
| `variant` | `primary` | `primary` | visual variant |
|
|
20
|
+
| `value` | `string` | — | selected item (controlled) |
|
|
21
|
+
| `defaultValue` | `string` | — | initial item (uncontrolled) |
|
|
22
|
+
| `onChange` | `(value: string) => void` | — | selection change |
|
|
23
|
+
| `disabled` | `boolean` | `false` | disables every item |
|
|
24
|
+
| `dataTestId` | `string` | — | `data-test-id` for tests |
|
|
25
|
+
|
|
26
|
+
Slots: `VerticalTabs.List` / `VerticalTabs.Item` (`id`, `disabled?`) / `VerticalTabs.Panels` / `VerticalTabs.Panel` (`id`). `Item` and `Panel` `id`s must match.
|
|
27
|
+
|
|
28
|
+
Column width, gap, and the selected fill come from `--aui-vertical-tabs-*` or `className` on the root, list, and item.
|
|
29
|
+
|
|
30
|
+
`VerticalTabs` does not write the selection into the URL and does not store it outside the component. Sync it with `value` / `onChange` when you need to.
|
|
31
|
+
|
|
32
|
+
There is no error-count slot. Put a badge in `VerticalTabs.Item` as part of `children` (`Badge` with `variant="danger"`). The number must be text and have an `aria-label`: state must not be color alone.
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
## Example
|
|
2
|
+
|
|
3
|
+
```tsx
|
|
4
|
+
<VerticalTabs value={section} onChange={setSection}>
|
|
5
|
+
<VerticalTabs.List>
|
|
6
|
+
<VerticalTabs.Item id="person">
|
|
7
|
+
Person
|
|
8
|
+
<Badge size="sm" variant="danger" aria-label="2 errors">
|
|
9
|
+
2
|
|
10
|
+
</Badge>
|
|
11
|
+
</VerticalTabs.Item>
|
|
12
|
+
<VerticalTabs.Item id="signin">Sign in</VerticalTabs.Item>
|
|
13
|
+
</VerticalTabs.List>
|
|
14
|
+
<VerticalTabs.Panels>
|
|
15
|
+
<VerticalTabs.Panel id="person">…</VerticalTabs.Panel>
|
|
16
|
+
<VerticalTabs.Panel id="signin">…</VerticalTabs.Panel>
|
|
17
|
+
</VerticalTabs.Panels>
|
|
18
|
+
</VerticalTabs>
|
|
19
|
+
```
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/** Vertical tabs CSS variables from semantic tokens (--aui-vertical-tabs-*). */
|
|
2
|
+
export const docsCssVariables = `/* CSS variables — VerticalTabs (--aui-vertical-tabs-*) */
|
|
3
|
+
--aui-vertical-tabs-fg-primary: var(--aui-page-fg-primary); /* selected foreground */
|
|
4
|
+
--aui-vertical-tabs-fg-muted: var(--aui-page-fg-muted); /* item foreground */
|
|
5
|
+
--aui-vertical-tabs-bg-selected: var(--aui-surface-bg-muted); /* selected fill */
|
|
6
|
+
--aui-vertical-tabs-border-focus: var(--aui-control-border-focus); /* focus border */
|
|
7
|
+
--aui-vertical-tabs-list-border: var(--aui-surface-border-primary); /* list divider */
|
|
8
|
+
--aui-vertical-tabs-item-radius: var(--aui-radius-8); /* item radius */
|
|
9
|
+
--aui-vertical-tabs-col-w: 12.5rem; /* list width */
|
|
10
|
+
--aui-vertical-tabs-col-gap: var(--aui-spacing-24); /* list to panel */
|
|
11
|
+
--aui-vertical-tabs-gap-sm: var(--aui-spacing-4); /* sm item gap */
|
|
12
|
+
--aui-vertical-tabs-gap-md: var(--aui-spacing-4); /* md item gap */
|
|
13
|
+
--aui-vertical-tabs-gap-lg: var(--aui-spacing-8); /* lg item gap */
|
|
14
|
+
--aui-vertical-tabs-h-sm: var(--aui-spacing-32); /* height sm */
|
|
15
|
+
--aui-vertical-tabs-h-md: var(--aui-spacing-40); /* height md */
|
|
16
|
+
--aui-vertical-tabs-h-lg: var(--aui-spacing-48); /* height lg */
|
|
17
|
+
--aui-vertical-tabs-pad-y-sm: var(--aui-spacing-4); /* padding-y sm */
|
|
18
|
+
--aui-vertical-tabs-pad-x-sm: var(--aui-spacing-8); /* padding-x sm */
|
|
19
|
+
--aui-vertical-tabs-pad-y-md: var(--aui-spacing-8); /* padding-y md */
|
|
20
|
+
--aui-vertical-tabs-pad-x-md: var(--aui-spacing-12); /* padding-x md */
|
|
21
|
+
--aui-vertical-tabs-pad-y-lg: var(--aui-spacing-12); /* padding-y lg */
|
|
22
|
+
--aui-vertical-tabs-pad-x-lg: var(--aui-spacing-16); /* padding-x lg */
|
|
23
|
+
--aui-vertical-tabs-panel-shift: var(--aui-spacing-8); /* panel enter offset */
|
|
24
|
+
--aui-vertical-tabs-duration-normal: var(--aui-control-duration-normal); /* transition duration (normal) */
|
|
25
|
+
--aui-vertical-tabs-ease-out: var(--aui-control-ease-out); /* transition easing */`;
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import { type ReactNode, type Ref } from 'react';
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
type TabListProps as RacTabListProps,
|
|
5
|
+
type TabPanelProps as RacTabPanelProps,
|
|
6
|
+
type TabPanelsProps as RacTabPanelsProps,
|
|
7
|
+
type TabProps as RacTabProps,
|
|
8
|
+
type TabsProps as RacTabsProps,
|
|
9
|
+
} from 'react-aria-components';
|
|
10
|
+
|
|
11
|
+
import { type IDataTestIdProps } from '@ds/common';
|
|
12
|
+
|
|
13
|
+
/** Vertical tabs size. */
|
|
14
|
+
export type TVerticalTabsSize = 'sm' | 'md' | 'lg';
|
|
15
|
+
|
|
16
|
+
/** Visual variant. */
|
|
17
|
+
export type TVerticalTabsVariant = 'primary';
|
|
18
|
+
|
|
19
|
+
/** Theme inputs. */
|
|
20
|
+
export interface IVerticalTabsThemeProps {
|
|
21
|
+
/** Vertical tabs size. */
|
|
22
|
+
size?: TVerticalTabsSize;
|
|
23
|
+
/** Visual variant. */
|
|
24
|
+
variant?: TVerticalTabsVariant;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/** Control state (our names, not RAC). */
|
|
28
|
+
export interface IVerticalTabsControlProps {
|
|
29
|
+
/** Controlled selected item id. */
|
|
30
|
+
value?: string;
|
|
31
|
+
/** Uncontrolled initial selected item id. */
|
|
32
|
+
defaultValue?: string;
|
|
33
|
+
/** Selection change handler. */
|
|
34
|
+
onChange?: (value: string) => void;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/** Own / chrome props (not from RAC). */
|
|
38
|
+
export interface IVerticalTabsOwnProps extends IDataTestIdProps {
|
|
39
|
+
/** List and panels. */
|
|
40
|
+
children: ReactNode;
|
|
41
|
+
/** Ref to the tabs root (React 19 prop). */
|
|
42
|
+
ref?: Ref<HTMLDivElement>;
|
|
43
|
+
/** Disables every item. */
|
|
44
|
+
disabled?: boolean;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export interface IVerticalTabsBaseProps
|
|
48
|
+
extends IVerticalTabsThemeProps, IVerticalTabsControlProps, IVerticalTabsOwnProps {}
|
|
49
|
+
|
|
50
|
+
/** RAC keys omitted because names differ from ours. */
|
|
51
|
+
export type TVerticalTabsRacOmit =
|
|
52
|
+
'selectedKey' | 'defaultSelectedKey' | 'onSelectionChange' | 'isDisabled' | 'orientation';
|
|
53
|
+
|
|
54
|
+
export interface IVerticalTabsProps
|
|
55
|
+
extends IVerticalTabsBaseProps, Omit<RacTabsProps, keyof IVerticalTabsBaseProps | TVerticalTabsRacOmit> {}
|
|
56
|
+
|
|
57
|
+
/** Vertical tabs context value. */
|
|
58
|
+
export interface IVerticalTabsContextValue {
|
|
59
|
+
size: TVerticalTabsSize;
|
|
60
|
+
variant: TVerticalTabsVariant;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/** Own props for VerticalTabs.List. */
|
|
64
|
+
export interface IVerticalTabsListOwnProps extends IDataTestIdProps {
|
|
65
|
+
children: ReactNode;
|
|
66
|
+
/** Ref to the list (React 19 prop). */
|
|
67
|
+
ref?: Ref<HTMLDivElement>;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
export interface IVerticalTabsListProps
|
|
71
|
+
extends IVerticalTabsListOwnProps, Omit<RacTabListProps<object>, keyof IVerticalTabsListOwnProps | 'items'> {}
|
|
72
|
+
|
|
73
|
+
/** Own props for VerticalTabs.Item. */
|
|
74
|
+
export interface IVerticalTabsItemOwnProps extends IDataTestIdProps {
|
|
75
|
+
/** Unique item id (matches Panel id). */
|
|
76
|
+
id: string;
|
|
77
|
+
children: ReactNode;
|
|
78
|
+
/** Disables this item. */
|
|
79
|
+
disabled?: boolean;
|
|
80
|
+
/** Ref to the item (React 19 prop). */
|
|
81
|
+
ref?: Ref<HTMLDivElement>;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/** RAC keys omitted because names differ from ours. */
|
|
85
|
+
export type TVerticalTabsItemRacOmit = 'isDisabled';
|
|
86
|
+
|
|
87
|
+
export interface IVerticalTabsItemProps
|
|
88
|
+
extends IVerticalTabsItemOwnProps, Omit<RacTabProps, keyof IVerticalTabsItemOwnProps | TVerticalTabsItemRacOmit> {}
|
|
89
|
+
|
|
90
|
+
/** Own props for VerticalTabs.Panel. */
|
|
91
|
+
export interface IVerticalTabsPanelOwnProps extends IDataTestIdProps {
|
|
92
|
+
/** Unique panel id (matches Item id). */
|
|
93
|
+
id: string;
|
|
94
|
+
children?: ReactNode;
|
|
95
|
+
/** Ref to the panel (React 19 prop). */
|
|
96
|
+
ref?: Ref<HTMLDivElement>;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
export interface IVerticalTabsPanelProps
|
|
100
|
+
extends IVerticalTabsPanelOwnProps, Omit<RacTabPanelProps, keyof IVerticalTabsPanelOwnProps> {}
|
|
101
|
+
|
|
102
|
+
/** Own props for VerticalTabs.Panels. */
|
|
103
|
+
export interface IVerticalTabsPanelsOwnProps extends IDataTestIdProps {
|
|
104
|
+
children: ReactNode;
|
|
105
|
+
/** Ref to the panels container (React 19 prop). */
|
|
106
|
+
ref?: Ref<HTMLDivElement>;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
export interface IVerticalTabsPanelsProps
|
|
110
|
+
extends IVerticalTabsPanelsOwnProps, Omit<RacTabPanelsProps<object>, keyof IVerticalTabsPanelsOwnProps | 'items'> {}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"hooks-BAkrGC45.js","sources":["../src/provider/context.ts","../src/provider/hooks.ts"],"sourcesContent":["import { createContext } from 'react';\n\nimport { type IAuiContextValue, type IAuiLabels } from './types';\n\nexport const defaultLabels: IAuiLabels = {\n close: 'Закрыть',\n clear: 'Очистить',\n confirm: 'Подтвердить',\n cancel: 'Отмена',\n delete: 'Удалить',\n notDelete: 'Не удалять',\n loading: 'Загрузка',\n loadingSuggestions: 'Загрузка подсказок',\n noSuggestions: 'Ничего не найдено',\n suggestionsError: 'Не удалось загрузить подсказки',\n moreSelected: 'ещё выбрано',\n openCalendar: 'Открыть календарь',\n pageSize: 'Строк на странице',\n paginationPrev: 'Назад',\n paginationNext: 'Далее',\n paginationPage: 'Страница {page}',\n paginationRange: '{from}–{to} из {total}',\n collapseSidebar: 'Свернуть меню',\n expandSidebar: 'Развернуть меню',\n resizeSidebar: 'Изменить ширину меню',\n pinMenuItem: 'Закрепить',\n unpinMenuItem: 'Открепить',\n pinnedSection: 'Закреплённые',\n pinnedSectionHint: 'ПКМ по пункту меню, чтобы закрепить',\n searchMenu: 'Поиск по меню',\n searchMenuEmpty: 'Ничего не найдено',\n openInNewTab: 'Открыть в новой вкладке',\n sortAscending: 'По возрастанию',\n sortDescending: 'По убыванию',\n moreActions: 'Ещё действия',\n save: 'Сохранить',\n arrangementList: 'Элементы',\n clearFilters: 'Очистить',\n};\n\nexport const AuiContext = createContext<IAuiContextValue | null>(null);\n","import { useContext } from 'react';\n\nimport { AuiContext } from './context';\nimport { type IAuiContextValue, type IAuiLabels, type TAuiLinkComponent, type TTextDirection } from './types';\n\nconst useAuiContext = (): IAuiContextValue => {\n const context = useContext(AuiContext);\n\n if (!context) {\n throw new Error('AdminUiProvider is required. Wrap the app with <AdminUiProvider>.');\n }\n\n return context;\n};\n\nexport const useAuiLabels = (): IAuiLabels => useAuiContext().labels;\n\nexport const useAuiLocale = (): string => useAuiContext().locale;\n\nexport const useAuiDirection = (): TTextDirection => useAuiContext().direction;\n\n/** Host router link from AdminUiProvider. Defaults to `a`. */\nexport const useAuiLink = (): TAuiLinkComponent => useAuiContext().linkComponent ?? 'a';\n"],"names":["defaultLabels","AuiContext","createContext","useAuiContext","context","useContext","useAuiLabels","useAuiLocale","useAuiDirection","useAuiLink"],"mappings":";AAIO,MAAMA,IAA4B;AAAA,EACrC,OAAO;AAAA,EACP,OAAO;AAAA,EACP,SAAS;AAAA,EACT,QAAQ;AAAA,EACR,QAAQ;AAAA,EACR,WAAW;AAAA,EACX,SAAS;AAAA,EACT,oBAAoB;AAAA,EACpB,eAAe;AAAA,EACf,kBAAkB;AAAA,EAClB,cAAc;AAAA,EACd,cAAc;AAAA,EACd,UAAU;AAAA,EACV,gBAAgB;AAAA,EAChB,gBAAgB;AAAA,EAChB,gBAAgB;AAAA,EAChB,iBAAiB;AAAA,EACjB,iBAAiB;AAAA,EACjB,eAAe;AAAA,EACf,eAAe;AAAA,EACf,aAAa;AAAA,EACb,eAAe;AAAA,EACf,eAAe;AAAA,EACf,mBAAmB;AAAA,EACnB,YAAY;AAAA,EACZ,iBAAiB;AAAA,EACjB,cAAc;AAAA,EACd,eAAe;AAAA,EACf,gBAAgB;AAAA,EAChB,aAAa;AAAA,EACb,MAAM;AAAA,EACN,iBAAiB;AAAA,EACjB,cAAc;AAClB,GAEaC,IAAaC,EAAuC,IAAI,GCnC/DC,IAAgB,MAAwB;AAC1C,QAAMC,IAAUC,EAAWJ,CAAU;AAErC,MAAI,CAACG;AACD,UAAM,IAAI,MAAM,mEAAmE;AAGvF,SAAOA;AACX,GAEaE,IAAe,MAAkBH,IAAgB,QAEjDI,IAAe,MAAcJ,IAAgB,QAE7CK,IAAkB,MAAsBL,IAAgB,WAGxDM,IAAa,MAAyBN,EAAA,EAAgB,iBAAiB;"}
|