@dashforge/tw 1.1.1 → 1.3.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/CHANGELOG.md +141 -0
- package/README.md +45 -0
- package/dist/index.esm.js +4443 -667
- package/dist/src/components/Accordion/Accordion.d.ts.map +1 -1
- package/dist/src/components/Accordion/accordion.types.d.ts +7 -0
- package/dist/src/components/Accordion/accordion.types.d.ts.map +1 -1
- package/dist/src/components/Alert/Alert.d.ts +1 -1
- package/dist/src/components/Alert/Alert.d.ts.map +1 -1
- package/dist/src/components/Alert/alert.types.d.ts +17 -0
- package/dist/src/components/Alert/alert.types.d.ts.map +1 -1
- package/dist/src/components/AppShell/AppShell.d.ts.map +1 -1
- package/dist/src/components/AppShell/appShell.types.d.ts +7 -0
- package/dist/src/components/AppShell/appShell.types.d.ts.map +1 -1
- package/dist/src/components/Autocomplete/Autocomplete.d.ts.map +1 -1
- package/dist/src/components/Autocomplete/autocomplete.types.d.ts +47 -1
- package/dist/src/components/Autocomplete/autocomplete.types.d.ts.map +1 -1
- package/dist/src/components/Avatar/Avatar.d.ts.map +1 -1
- package/dist/src/components/Avatar/avatar.types.d.ts +17 -1
- package/dist/src/components/Avatar/avatar.types.d.ts.map +1 -1
- package/dist/src/components/Badge/Badge.d.ts.map +1 -1
- package/dist/src/components/Badge/badge.types.d.ts +27 -2
- package/dist/src/components/Badge/badge.types.d.ts.map +1 -1
- package/dist/src/components/Box/Box.d.ts.map +1 -1
- package/dist/src/components/Box/box.types.d.ts +64 -1
- package/dist/src/components/Box/box.types.d.ts.map +1 -1
- package/dist/src/components/Breadcrumbs/Breadcrumbs.d.ts.map +1 -1
- package/dist/src/components/Breadcrumbs/breadcrumbs.types.d.ts +26 -1
- package/dist/src/components/Breadcrumbs/breadcrumbs.types.d.ts.map +1 -1
- package/dist/src/components/Button/Button.d.ts.map +1 -1
- package/dist/src/components/Button/button.types.d.ts +53 -1
- package/dist/src/components/Button/button.types.d.ts.map +1 -1
- package/dist/src/components/Calendar/Calendar.d.ts.map +1 -1
- package/dist/src/components/Calendar/calendar.types.d.ts +16 -0
- package/dist/src/components/Calendar/calendar.types.d.ts.map +1 -1
- package/dist/src/components/Card/Card.d.ts.map +1 -1
- package/dist/src/components/Card/card.types.d.ts +17 -0
- package/dist/src/components/Card/card.types.d.ts.map +1 -1
- package/dist/src/components/Checkbox/Checkbox.d.ts.map +1 -1
- package/dist/src/components/Checkbox/checkbox.types.d.ts +19 -1
- package/dist/src/components/Checkbox/checkbox.types.d.ts.map +1 -1
- package/dist/src/components/Chip/Chip.d.ts.map +1 -1
- package/dist/src/components/Chip/chip.types.d.ts +40 -1
- package/dist/src/components/Chip/chip.types.d.ts.map +1 -1
- package/dist/src/components/ConfirmDialog/ConfirmDialog.d.ts.map +1 -1
- package/dist/src/components/ConfirmDialog/confirmDialog.types.d.ts +30 -2
- package/dist/src/components/ConfirmDialog/confirmDialog.types.d.ts.map +1 -1
- package/dist/src/components/Container/Container.d.ts.map +1 -1
- package/dist/src/components/Container/container.types.d.ts +29 -1
- package/dist/src/components/Container/container.types.d.ts.map +1 -1
- package/dist/src/components/DataGrid/DataGrid.d.ts +1 -1
- package/dist/src/components/DataGrid/DataGrid.d.ts.map +1 -1
- package/dist/src/components/DataGrid/dataGrid.types.d.ts +124 -10
- package/dist/src/components/DataGrid/dataGrid.types.d.ts.map +1 -1
- package/dist/src/components/DatePicker/DatePicker.d.ts +1 -1
- package/dist/src/components/DatePicker/DatePicker.d.ts.map +1 -1
- package/dist/src/components/DatePicker/datePicker.types.d.ts +18 -0
- package/dist/src/components/DatePicker/datePicker.types.d.ts.map +1 -1
- package/dist/src/components/DateRangePicker/DateRangePicker.d.ts +1 -1
- package/dist/src/components/DateRangePicker/DateRangePicker.d.ts.map +1 -1
- package/dist/src/components/DateRangePicker/dateRangePicker.types.d.ts +18 -0
- package/dist/src/components/DateRangePicker/dateRangePicker.types.d.ts.map +1 -1
- package/dist/src/components/DateTimePicker/DateTimePicker.d.ts +1 -1
- package/dist/src/components/DateTimePicker/DateTimePicker.d.ts.map +1 -1
- package/dist/src/components/DateTimePicker/dateTimePicker.types.d.ts +20 -0
- package/dist/src/components/DateTimePicker/dateTimePicker.types.d.ts.map +1 -1
- package/dist/src/components/Dialog/Dialog.d.ts.map +1 -1
- package/dist/src/components/Dialog/dialog.types.d.ts +25 -1
- package/dist/src/components/Dialog/dialog.types.d.ts.map +1 -1
- package/dist/src/components/Divider/Divider.d.ts.map +1 -1
- package/dist/src/components/Divider/divider.types.d.ts +37 -1
- package/dist/src/components/Divider/divider.types.d.ts.map +1 -1
- package/dist/src/components/Drawer/Drawer.d.ts +21 -0
- package/dist/src/components/Drawer/Drawer.d.ts.map +1 -0
- package/dist/src/components/Drawer/drawer.types.d.ts +311 -0
- package/dist/src/components/Drawer/drawer.types.d.ts.map +1 -0
- package/dist/src/components/Drawer/drawer.variants.d.ts +177 -0
- package/dist/src/components/Drawer/drawer.variants.d.ts.map +1 -0
- package/dist/src/components/Grid/Grid.d.ts.map +1 -1
- package/dist/src/components/Grid/grid.types.d.ts +16 -0
- package/dist/src/components/Grid/grid.types.d.ts.map +1 -1
- package/dist/src/components/IconButton/IconButton.d.ts.map +1 -1
- package/dist/src/components/IconButton/iconButton.types.d.ts +40 -1
- package/dist/src/components/IconButton/iconButton.types.d.ts.map +1 -1
- package/dist/src/components/Image/Image.d.ts +27 -0
- package/dist/src/components/Image/Image.d.ts.map +1 -0
- package/dist/src/components/Image/image.types.d.ts +126 -0
- package/dist/src/components/Image/image.types.d.ts.map +1 -0
- package/dist/src/components/Image/image.variants.d.ts +149 -0
- package/dist/src/components/Image/image.variants.d.ts.map +1 -0
- package/dist/src/components/LeftNav/LeftNav.d.ts.map +1 -1
- package/dist/src/components/LeftNav/leftNav.types.d.ts +26 -6
- package/dist/src/components/LeftNav/leftNav.types.d.ts.map +1 -1
- package/dist/src/components/Link/Link.d.ts +15 -0
- package/dist/src/components/Link/Link.d.ts.map +1 -0
- package/dist/src/components/Link/link.types.d.ts +169 -0
- package/dist/src/components/Link/link.types.d.ts.map +1 -0
- package/dist/src/components/Link/link.variants.d.ts +107 -0
- package/dist/src/components/Link/link.variants.d.ts.map +1 -0
- package/dist/src/components/Menu/Menu.d.ts +1 -1
- package/dist/src/components/Menu/Menu.d.ts.map +1 -1
- package/dist/src/components/Menu/menu.types.d.ts +20 -0
- package/dist/src/components/Menu/menu.types.d.ts.map +1 -1
- package/dist/src/components/NumberField/NumberField.d.ts.map +1 -1
- package/dist/src/components/NumberField/numberField.types.d.ts +47 -1
- package/dist/src/components/NumberField/numberField.types.d.ts.map +1 -1
- package/dist/src/components/OTPField/OTPField.d.ts.map +1 -1
- package/dist/src/components/OTPField/otpField.types.d.ts +35 -1
- package/dist/src/components/OTPField/otpField.types.d.ts.map +1 -1
- package/dist/src/components/Pagination/Pagination.d.ts.map +1 -1
- package/dist/src/components/Pagination/pagination.types.d.ts +26 -1
- package/dist/src/components/Pagination/pagination.types.d.ts.map +1 -1
- package/dist/src/components/Popover/Popover.d.ts.map +1 -1
- package/dist/src/components/Popover/popover.types.d.ts +29 -0
- package/dist/src/components/Popover/popover.types.d.ts.map +1 -1
- package/dist/src/components/Progress/Progress.d.ts +20 -0
- package/dist/src/components/Progress/Progress.d.ts.map +1 -0
- package/dist/src/components/Progress/progress.types.d.ts +200 -0
- package/dist/src/components/Progress/progress.types.d.ts.map +1 -0
- package/dist/src/components/Progress/progress.variants.d.ts +224 -0
- package/dist/src/components/Progress/progress.variants.d.ts.map +1 -0
- package/dist/src/components/RadioGroup/RadioGroup.d.ts.map +1 -1
- package/dist/src/components/RadioGroup/radioGroup.types.d.ts +25 -1
- package/dist/src/components/RadioGroup/radioGroup.types.d.ts.map +1 -1
- package/dist/src/components/Select/Select.d.ts +14 -0
- package/dist/src/components/Select/Select.d.ts.map +1 -0
- package/dist/src/components/Select/select.types.d.ts +272 -0
- package/dist/src/components/Select/select.types.d.ts.map +1 -0
- package/dist/src/components/Select/select.variants.d.ts +204 -0
- package/dist/src/components/Select/select.variants.d.ts.map +1 -0
- package/dist/src/components/Skeleton/Skeleton.d.ts.map +1 -1
- package/dist/src/components/Skeleton/skeleton.types.d.ts +25 -1
- package/dist/src/components/Skeleton/skeleton.types.d.ts.map +1 -1
- package/dist/src/components/Slider/Slider.d.ts +15 -0
- package/dist/src/components/Slider/Slider.d.ts.map +1 -0
- package/dist/src/components/Slider/slider.types.d.ts +279 -0
- package/dist/src/components/Slider/slider.types.d.ts.map +1 -0
- package/dist/src/components/Slider/slider.variants.d.ts +313 -0
- package/dist/src/components/Slider/slider.variants.d.ts.map +1 -0
- package/dist/src/components/Snackbar/Snackbar.d.ts.map +1 -1
- package/dist/src/components/Snackbar/snackbar.types.d.ts +29 -5
- package/dist/src/components/Snackbar/snackbar.types.d.ts.map +1 -1
- package/dist/src/components/Spinner/Spinner.d.ts.map +1 -1
- package/dist/src/components/Spinner/spinner.types.d.ts +22 -2
- package/dist/src/components/Spinner/spinner.types.d.ts.map +1 -1
- package/dist/src/components/Stack/Stack.d.ts.map +1 -1
- package/dist/src/components/Stack/stack.types.d.ts +53 -2
- package/dist/src/components/Stack/stack.types.d.ts.map +1 -1
- package/dist/src/components/Stack/stack.variants.d.ts +23 -0
- package/dist/src/components/Stack/stack.variants.d.ts.map +1 -1
- package/dist/src/components/Stepper/Step.d.ts +30 -0
- package/dist/src/components/Stepper/Step.d.ts.map +1 -0
- package/dist/src/components/Stepper/Stepper.d.ts +15 -0
- package/dist/src/components/Stepper/Stepper.d.ts.map +1 -0
- package/dist/src/components/Stepper/StepperContext.d.ts +8 -0
- package/dist/src/components/Stepper/StepperContext.d.ts.map +1 -0
- package/dist/src/components/Stepper/stepper.types.d.ts +358 -0
- package/dist/src/components/Stepper/stepper.types.d.ts.map +1 -0
- package/dist/src/components/Stepper/stepper.variants.d.ts +253 -0
- package/dist/src/components/Stepper/stepper.variants.d.ts.map +1 -0
- package/dist/src/components/Stepper/useStep.d.ts +53 -0
- package/dist/src/components/Stepper/useStep.d.ts.map +1 -0
- package/dist/src/components/Switch/Switch.d.ts.map +1 -1
- package/dist/src/components/Switch/switch.types.d.ts +44 -1
- package/dist/src/components/Switch/switch.types.d.ts.map +1 -1
- package/dist/src/components/Table/Table.d.ts +1 -1
- package/dist/src/components/Table/Table.d.ts.map +1 -1
- package/dist/src/components/Table/table.types.d.ts +103 -8
- package/dist/src/components/Table/table.types.d.ts.map +1 -1
- package/dist/src/components/Tabs/Tabs.d.ts.map +1 -1
- package/dist/src/components/Tabs/tabs.types.d.ts +26 -1
- package/dist/src/components/Tabs/tabs.types.d.ts.map +1 -1
- package/dist/src/components/TextField/TextField.d.ts.map +1 -1
- package/dist/src/components/TextField/textField.types.d.ts +30 -1
- package/dist/src/components/TextField/textField.types.d.ts.map +1 -1
- package/dist/src/components/Textarea/Textarea.d.ts.map +1 -1
- package/dist/src/components/Textarea/textarea.types.d.ts +51 -1
- package/dist/src/components/Textarea/textarea.types.d.ts.map +1 -1
- package/dist/src/components/TimePicker/TimePicker.d.ts +1 -1
- package/dist/src/components/TimePicker/TimePicker.d.ts.map +1 -1
- package/dist/src/components/TimePicker/timePicker.types.d.ts +18 -0
- package/dist/src/components/TimePicker/timePicker.types.d.ts.map +1 -1
- package/dist/src/components/Tooltip/Tooltip.d.ts.map +1 -1
- package/dist/src/components/Tooltip/tooltip.types.d.ts +30 -0
- package/dist/src/components/Tooltip/tooltip.types.d.ts.map +1 -1
- package/dist/src/components/TopBar/TopBar.d.ts.map +1 -1
- package/dist/src/components/TopBar/topBar.types.d.ts +25 -1
- package/dist/src/components/TopBar/topBar.types.d.ts.map +1 -1
- package/dist/src/components/Typography/Typography.d.ts.map +1 -1
- package/dist/src/components/Typography/typography.types.d.ts +47 -1
- package/dist/src/components/Typography/typography.types.d.ts.map +1 -1
- package/dist/src/components/Typography/typography.variants.d.ts +2 -2
- package/dist/src/components/Typography/typography.variants.d.ts.map +1 -1
- package/dist/src/hooks/useStandaloneFieldWarning.d.ts +38 -0
- package/dist/src/hooks/useStandaloneFieldWarning.d.ts.map +1 -0
- package/dist/src/index.d.ts +66 -42
- package/dist/src/index.d.ts.map +1 -1
- package/package.json +5 -4
|
@@ -26,7 +26,10 @@ export type SpinnerThickness = 'thin' | 'md' | 'thick';
|
|
|
26
26
|
* under `prefers-reduced-motion`).
|
|
27
27
|
*/
|
|
28
28
|
export interface SpinnerProps {
|
|
29
|
-
/**
|
|
29
|
+
/**
|
|
30
|
+
* Diameter tier — xs:12px, sm:16px, md:20px, lg:24px, xl:32px.
|
|
31
|
+
* @default 'md'
|
|
32
|
+
*/
|
|
30
33
|
size?: SpinnerSize;
|
|
31
34
|
/**
|
|
32
35
|
* Intent color. **When omitted, inherits parent's text color via
|
|
@@ -35,7 +38,10 @@ export interface SpinnerProps {
|
|
|
35
38
|
* for standalone usage on neutral surfaces.
|
|
36
39
|
*/
|
|
37
40
|
color?: SpinnerColor;
|
|
38
|
-
/**
|
|
41
|
+
/**
|
|
42
|
+
* SVG stroke-width — thin:1.5, md:2.25, thick:3.
|
|
43
|
+
* @default 'md'
|
|
44
|
+
*/
|
|
39
45
|
thickness?: SpinnerThickness;
|
|
40
46
|
/**
|
|
41
47
|
* Renders a faint "ghost ring" behind the spinning arc (20%
|
|
@@ -83,7 +89,21 @@ export interface SpinnerProps {
|
|
|
83
89
|
* otherwise display-only.
|
|
84
90
|
*/
|
|
85
91
|
visibleWhen?: (engine: Engine) => boolean;
|
|
92
|
+
/** Standard React `className` — appended to the root via `cn()`. */
|
|
86
93
|
className?: string;
|
|
94
|
+
/** Root-element class shortcut (string or clsx-compatible value). Wins over variant classes via `tailwind-merge`. */
|
|
87
95
|
sx?: ClassValue;
|
|
88
96
|
}
|
|
97
|
+
/**
|
|
98
|
+
* Subset of `<Spinner>` props theme-configurable via
|
|
99
|
+
* `theme.components.Spinner.defaults` (Option C).
|
|
100
|
+
*/
|
|
101
|
+
export type SpinnerVariantProps = Pick<SpinnerProps, 'size' | 'color' | 'thickness' | 'withTrack'>;
|
|
102
|
+
declare module '@dashforge/tw-tokens' {
|
|
103
|
+
interface TWComponentDefaults {
|
|
104
|
+
Spinner?: {
|
|
105
|
+
defaults?: Partial<SpinnerVariantProps>;
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
}
|
|
89
109
|
//# sourceMappingURL=spinner.types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"spinner.types.d.ts","sourceRoot":"","sources":["../../../../src/components/Spinner/spinner.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAEjD;;;GAGG;AACH,MAAM,MAAM,WAAW,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;AAE3D;;;;GAIG;AACH,MAAM,MAAM,YAAY,GACpB,SAAS,GACT,SAAS,GACT,WAAW,GACX,SAAS,GACT,SAAS,GACT,QAAQ,GACR,MAAM,CAAC;AAEX,6DAA6D;AAC7D,MAAM,MAAM,gBAAgB,GAAG,MAAM,GAAG,IAAI,GAAG,OAAO,CAAC;AAEvD;;;;;;;;;;;GAWG;AACH,MAAM,WAAW,YAAY;IAE3B
|
|
1
|
+
{"version":3,"file":"spinner.types.d.ts","sourceRoot":"","sources":["../../../../src/components/Spinner/spinner.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAEjD;;;GAGG;AACH,MAAM,MAAM,WAAW,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;AAE3D;;;;GAIG;AACH,MAAM,MAAM,YAAY,GACpB,SAAS,GACT,SAAS,GACT,WAAW,GACX,SAAS,GACT,SAAS,GACT,QAAQ,GACR,MAAM,CAAC;AAEX,6DAA6D;AAC7D,MAAM,MAAM,gBAAgB,GAAG,MAAM,GAAG,IAAI,GAAG,OAAO,CAAC;AAEvD;;;;;;;;;;;GAWG;AACH,MAAM,WAAW,YAAY;IAE3B;;;OAGG;IACH,IAAI,CAAC,EAAE,WAAW,CAAC;IAEnB;;;;;OAKG;IACH,KAAK,CAAC,EAAE,YAAY,CAAC;IAErB;;;OAGG;IACH,SAAS,CAAC,EAAE,gBAAgB,CAAC;IAE7B;;;;;;;;;;;OAWG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IAGpB;;;;;OAKG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf;;;;;;;;;;;;;;;;;OAiBG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IAGf;;;;;OAKG;IACH,WAAW,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,OAAO,CAAC;IAM1C,oEAAoE;IACpE,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB,qHAAqH;IACrH,EAAE,CAAC,EAAE,UAAU,CAAC;CACjB;AAED;;;GAGG;AACH,MAAM,MAAM,mBAAmB,GAAG,IAAI,CACpC,YAAY,EACZ,MAAM,GAAG,OAAO,GAAG,WAAW,GAAG,WAAW,CAC7C,CAAC;AAEF,OAAO,QAAQ,sBAAsB,CAAC;IACpC,UAAU,mBAAmB;QAC3B,OAAO,CAAC,EAAE;YACR,QAAQ,CAAC,EAAE,OAAO,CAAC,mBAAmB,CAAC,CAAC;SACzC,CAAC;KACH;CACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Stack.d.ts","sourceRoot":"","sources":["../../../../src/components/Stack/Stack.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Stack.d.ts","sourceRoot":"","sources":["../../../../src/components/Stack/Stack.tsx"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AA6CnD;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,eAAO,MAAM,KAAK,oGAgGjB,CAAC"}
|
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
import type { ElementType, HTMLAttributes, ReactNode } from 'react';
|
|
2
|
-
import type { StackVariants } from './stack.variants.js';
|
|
2
|
+
import type { StackGap, StackVariants } from './stack.variants.js';
|
|
3
|
+
/**
|
|
4
|
+
* Subset of `<Stack>` props theme-configurable via
|
|
5
|
+
* `theme.components.Stack.defaults` (Option C).
|
|
6
|
+
*
|
|
7
|
+
* `gap` is deliberately overridden to the strict `StackGap` literal
|
|
8
|
+
* union rather than the `VariantProps`-widened `string` — see
|
|
9
|
+
* `stack.variants.ts` and issue #111 (G-27) for the widening bug.
|
|
10
|
+
*/
|
|
11
|
+
export type StackVariantProps = Pick<StackVariants, 'direction' | 'align' | 'justify' | 'wrap' | 'fullWidth' | 'fullHeight'> & {
|
|
12
|
+
gap?: StackGap;
|
|
13
|
+
};
|
|
14
|
+
declare module '@dashforge/tw-tokens' {
|
|
15
|
+
interface TWComponentDefaults {
|
|
16
|
+
Stack?: {
|
|
17
|
+
defaults?: Partial<StackVariantProps>;
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
}
|
|
3
21
|
/**
|
|
4
22
|
* Props for `<Stack>` — flex container 1D, the layout primitive.
|
|
5
23
|
*
|
|
@@ -21,7 +39,40 @@ import type { StackVariants } from './stack.variants.js';
|
|
|
21
39
|
* • 2D layout (rows AND columns) → use <Grid>
|
|
22
40
|
* • Text styling → <Typography>
|
|
23
41
|
*/
|
|
24
|
-
export interface StackProps extends Omit<HTMLAttributes<HTMLDivElement>, 'className'
|
|
42
|
+
export interface StackProps extends Omit<HTMLAttributes<HTMLDivElement>, 'className'> {
|
|
43
|
+
/**
|
|
44
|
+
* Flex direction.
|
|
45
|
+
* @default 'col'
|
|
46
|
+
*/
|
|
47
|
+
direction?: StackVariants['direction'];
|
|
48
|
+
/** Cross-axis alignment (`items-*`). */
|
|
49
|
+
align?: StackVariants['align'];
|
|
50
|
+
/** Main-axis alignment (`justify-*`). */
|
|
51
|
+
justify?: StackVariants['justify'];
|
|
52
|
+
/**
|
|
53
|
+
* Gap between children — spacing token step. Accepts one of eleven
|
|
54
|
+
* numeric literals matching Box's spacing scale: `0 | 0.5 | 1 | 2 |
|
|
55
|
+
* 3 | 4 | 6 | 8 | 12 | 16 | 24`. Token strings (`'xs' | 'sm' | 'md'`)
|
|
56
|
+
* are **not** accepted — TypeScript rejects them at compile time,
|
|
57
|
+
* and a runtime pass through with an unknown value emits a
|
|
58
|
+
* dev-only `console.warn` (issue #111 / G-27).
|
|
59
|
+
*/
|
|
60
|
+
gap?: StackGap;
|
|
61
|
+
/**
|
|
62
|
+
* Allow children to wrap to the next line (`flex-wrap`).
|
|
63
|
+
* @default false
|
|
64
|
+
*/
|
|
65
|
+
wrap?: StackVariants['wrap'];
|
|
66
|
+
/**
|
|
67
|
+
* Stretch to fill the container's width.
|
|
68
|
+
* @default false
|
|
69
|
+
*/
|
|
70
|
+
fullWidth?: StackVariants['fullWidth'];
|
|
71
|
+
/**
|
|
72
|
+
* Stretch to fill the container's height.
|
|
73
|
+
* @default false
|
|
74
|
+
*/
|
|
75
|
+
fullHeight?: StackVariants['fullHeight'];
|
|
25
76
|
/**
|
|
26
77
|
* Node rendered N-1 times BETWEEN children — mirror of MUI Stack's
|
|
27
78
|
* divider prop. Useful for visual separators (a `<hr>`, a thin
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stack.types.d.ts","sourceRoot":"","sources":["../../../../src/components/Stack/stack.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACpE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"stack.types.d.ts","sourceRoot":"","sources":["../../../../src/components/Stack/stack.types.ts"],"names":[],"mappings":"AAAA,OAAO,K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AE,OAAO,CAAC;IAElB;;;;OAIG;IACH,EAAE,CAAC,EAAE,MAAM,CAAC;CACb"}
|
|
@@ -160,4 +160,27 @@ export declare const stackVariants: import("tailwind-variants").TVReturnType<{
|
|
|
160
160
|
};
|
|
161
161
|
}, undefined, "flex", unknown, unknown, undefined>>;
|
|
162
162
|
export type StackVariants = VariantProps<typeof stackVariants>;
|
|
163
|
+
/**
|
|
164
|
+
* The 11 accepted values for `<Stack gap>` — same set as Box's spacing
|
|
165
|
+
* axes (p, m, etc.). Exported so the JSDoc, the runtime dev-warn, and
|
|
166
|
+
* the `<Stack>` prop type all speak the same list.
|
|
167
|
+
*
|
|
168
|
+
* Why re-declared instead of derived from `stackVariants.variants.gap`
|
|
169
|
+
* via `VariantProps`: `tailwind-variants` 3.x widens variant value
|
|
170
|
+
* types to `string | undefined` when the variant object has mixed-type
|
|
171
|
+
* keys (numeric literals + string literals like `'0.5'`), which is why
|
|
172
|
+
* TS silently accepted `<Stack gap="md">` before #111 — that's the
|
|
173
|
+
* whole bug this literal union closes. Keep this list in sync with
|
|
174
|
+
* the `gap` object in the `variants` block above.
|
|
175
|
+
*
|
|
176
|
+
* @see Issue #111 — silent-fail when `gap` receives a token value that
|
|
177
|
+
* isn't on the numeric scale (G-27).
|
|
178
|
+
*/
|
|
179
|
+
export type StackGap = 0 | 0.5 | 1 | 2 | 3 | 4 | 6 | 8 | 12 | 16 | 24;
|
|
180
|
+
/**
|
|
181
|
+
* Runtime allow-list, for the dev-warn to check against a passed
|
|
182
|
+
* `gap` value at render time. Same set as {@link StackGap}. Frozen
|
|
183
|
+
* so callers can't mutate the source of truth.
|
|
184
|
+
*/
|
|
185
|
+
export declare const STACK_GAP_VALUES: readonly StackGap[];
|
|
163
186
|
//# sourceMappingURL=stack.variants.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stack.variants.d.ts","sourceRoot":"","sources":["../../../../src/components/Stack/stack.variants.ts"],"names":[],"mappings":"AAAA,OAAO,EAAM,KAAK,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAE1D;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;mDAgDxB,CAAC;AAEH,MAAM,MAAM,aAAa,GAAG,YAAY,CAAC,OAAO,aAAa,CAAC,CAAC"}
|
|
1
|
+
{"version":3,"file":"stack.variants.d.ts","sourceRoot":"","sources":["../../../../src/components/Stack/stack.variants.ts"],"names":[],"mappings":"AAAA,OAAO,EAAM,KAAK,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAE1D;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;mDAgDxB,CAAC;AAEH,MAAM,MAAM,aAAa,GAAG,YAAY,CAAC,OAAO,aAAa,CAAC,CAAC;AAE/D;;;;;;;;;;;;;;;GAeG;AACH,MAAM,MAAM,QAAQ,GAChB,CAAC,GACD,GAAG,GACH,CAAC,GACD,CAAC,GACD,CAAC,GACD,CAAC,GACD,CAAC,GACD,CAAC,GACD,EAAE,GACF,EAAE,GACF,EAAE,CAAC;AAEP;;;;GAIG;AACH,eAAO,MAAM,gBAAgB,EAAE,SAAS,QAAQ,EAE9C,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { StepProps } from './stepper.types.js';
|
|
2
|
+
/**
|
|
3
|
+
* `<Step>` — a config-carrier child of `<Stepper>`.
|
|
4
|
+
*
|
|
5
|
+
* Renders NOTHING on its own — the parent `<Stepper>` walks its children
|
|
6
|
+
* with `React.Children.toArray`, extracts each `<Step>`'s props to build
|
|
7
|
+
* the visible sequence, and drives the strip + content rendering from
|
|
8
|
+
* there. This mirrors the MUI Tabs / Chakra Tabs "compound children as
|
|
9
|
+
* config" pattern.
|
|
10
|
+
*
|
|
11
|
+
* Placement rule (enforced by the parent's dev-warn): `<Step>` must be a
|
|
12
|
+
* DIRECT child of `<Stepper>`. Wrapping steps in a fragment is fine
|
|
13
|
+
* (`React.Children.toArray` flattens fragments); wrapping in an arbitrary
|
|
14
|
+
* `<div>` is not — the parent won't see the step and will skip it.
|
|
15
|
+
*
|
|
16
|
+
* @see StepProps for the full config surface.
|
|
17
|
+
*/
|
|
18
|
+
export declare function Step(_props: StepProps): null;
|
|
19
|
+
export declare namespace Step {
|
|
20
|
+
var displayName: string;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Marker used by `<Stepper>` to recognize its own compound child type
|
|
24
|
+
* without pulling in `React.ReactElement<StepProps>` machinery. The
|
|
25
|
+
* parent traverses `React.Children.toArray(children)` and matches on
|
|
26
|
+
* `child.type === Step` — matching on `displayName` would be brittle
|
|
27
|
+
* against React tree cloning.
|
|
28
|
+
*/
|
|
29
|
+
export declare const __IS_STEP: unique symbol;
|
|
30
|
+
//# sourceMappingURL=Step.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Step.d.ts","sourceRoot":"","sources":["../../../../src/components/Stepper/Step.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAEpD;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,IAAI,CAAC,MAAM,EAAE,SAAS,GAAG,IAAI,CAE5C;yBAFe,IAAI;;;AAMpB;;;;;;GAMG;AACH,eAAO,MAAM,SAAS,eAAmC,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { StepperProps } from './stepper.types.js';
|
|
2
|
+
/**
|
|
3
|
+
* `<Stepper>` — declarative multi-step navigation with compound `<Step>`
|
|
4
|
+
* children. The parent walks its children, extracts each `<Step>`'s
|
|
5
|
+
* props, filters by `visibleWhen`, and drives the strip + content
|
|
6
|
+
* rendering. Consumers reach the current step state + navigation API
|
|
7
|
+
* via the `useStep()` hook.
|
|
8
|
+
*
|
|
9
|
+
* See {@link StepperProps} for the full API surface.
|
|
10
|
+
*/
|
|
11
|
+
export declare function Stepper(props: StepperProps): import("react/jsx-runtime").JSX.Element | null;
|
|
12
|
+
export declare namespace Stepper {
|
|
13
|
+
var displayName: string;
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=Stepper.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Stepper.d.ts","sourceRoot":"","sources":["../../../../src/components/Stepper/Stepper.tsx"],"names":[],"mappings":"AAqBA,OAAO,KAAK,EAEV,YAAY,EAIb,MAAM,oBAAoB,CAAC;AAqC5B;;;;;;;;GAQG;AACH,wBAAgB,OAAO,CAAC,KAAK,EAAE,YAAY,kDAia1C;yBAjae,OAAO"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { UseStepReturn } from './stepper.types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Internal context wired by `<Stepper>` and read by `useStep()`. Not
|
|
4
|
+
* exported from the package — consumers reach the state only via the
|
|
5
|
+
* `useStep()` hook.
|
|
6
|
+
*/
|
|
7
|
+
export declare const StepperContext: import("react").Context<UseStepReturn | null>;
|
|
8
|
+
//# sourceMappingURL=StepperContext.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"StepperContext.d.ts","sourceRoot":"","sources":["../../../../src/components/Stepper/StepperContext.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAExD;;;;GAIG;AACH,eAAO,MAAM,cAAc,+CAA4C,CAAC"}
|
|
@@ -0,0 +1,358 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
import type { Engine } from '@dashforge/ui-core';
|
|
3
|
+
import type { AccessRequirement } from '@dashforge/rbac';
|
|
4
|
+
import type { StepperVariants } from './stepper.variants.js';
|
|
5
|
+
/**
|
|
6
|
+
* The lifecycle state of a single step within the visible sequence.
|
|
7
|
+
*
|
|
8
|
+
* - `pending` — step comes AFTER the current step (not yet visited).
|
|
9
|
+
* - `current` — the step the user is on right now.
|
|
10
|
+
* - `completed` — step was visited AND the consumer has advanced past it
|
|
11
|
+
* (implies `visitedSteps.has(step.name)` AND it is not
|
|
12
|
+
* the current step and is before it in the sequence).
|
|
13
|
+
* - `invalid` — the step has an entry in `errors`, populated after a
|
|
14
|
+
* failed `goNext()` attempt (from `fields` trigger or
|
|
15
|
+
* `isValid` callback returning false).
|
|
16
|
+
* - `skipped` — reserved for future non-linear skip semantics; unused
|
|
17
|
+
* in v1.
|
|
18
|
+
*/
|
|
19
|
+
export type StepState = 'pending' | 'current' | 'completed' | 'invalid' | 'skipped';
|
|
20
|
+
/**
|
|
21
|
+
* Per-step error record surfaced on `useStep().errors`. Populated when
|
|
22
|
+
* `<Step fields={...}>` fails its RHF `trigger` call, or when a step's
|
|
23
|
+
* `isValid` callback returns `false`.
|
|
24
|
+
*
|
|
25
|
+
* The error routing pattern (Review step with clickable list) reads
|
|
26
|
+
* this array to render jump-links back to the step that failed.
|
|
27
|
+
*/
|
|
28
|
+
export interface StepError {
|
|
29
|
+
/** The step's `name` (unique key). */
|
|
30
|
+
step: string;
|
|
31
|
+
/** The step's `label` (for consumer-friendly display). */
|
|
32
|
+
label: ReactNode;
|
|
33
|
+
/** How the step became invalid. */
|
|
34
|
+
reason: 'fields' | 'isValid';
|
|
35
|
+
/** RHF `formState.errors` at the moment of the failed transition. */
|
|
36
|
+
errors: Record<string, unknown> | null;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Payload emitted to `<Stepper onStepInvalid>` when a `goNext()` attempt
|
|
40
|
+
* fails validation.
|
|
41
|
+
*/
|
|
42
|
+
export interface OnStepInvalidPayload {
|
|
43
|
+
/** The step that failed. */
|
|
44
|
+
step: string;
|
|
45
|
+
/** Its index within the visible sequence. */
|
|
46
|
+
index: number;
|
|
47
|
+
/** How it failed. */
|
|
48
|
+
reason: 'fields' | 'isValid';
|
|
49
|
+
/** RHF errors, if the failure came from `fields` trigger. */
|
|
50
|
+
errors: Record<string, unknown> | null;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* The shape returned by `useStep()` — the consumer-facing API of the
|
|
54
|
+
* current Stepper context. Available to any component rendered inside
|
|
55
|
+
* a `<Stepper>` tree (typically the current `<Step>`'s children or a
|
|
56
|
+
* custom footer).
|
|
57
|
+
*
|
|
58
|
+
* The hook is the ONLY public path to the Stepper's internal state —
|
|
59
|
+
* consumers do NOT reach into the internal context directly.
|
|
60
|
+
*/
|
|
61
|
+
export interface UseStepReturn {
|
|
62
|
+
/** The current step's `name`. */
|
|
63
|
+
currentStep: string;
|
|
64
|
+
/** Its index within the visible sequence. */
|
|
65
|
+
currentStepIndex: number;
|
|
66
|
+
/**
|
|
67
|
+
* The filtered visible sequence, in declaration order. Steps whose
|
|
68
|
+
* `visibleWhen` returned `false` are absent.
|
|
69
|
+
*/
|
|
70
|
+
visibleSteps: Array<{
|
|
71
|
+
name: string;
|
|
72
|
+
label: ReactNode;
|
|
73
|
+
}>;
|
|
74
|
+
/**
|
|
75
|
+
* Set of step names the user has visited so far. Reset by `reset()`,
|
|
76
|
+
* pre-populated by `initialStep` (every step before the initial one
|
|
77
|
+
* is treated as visited so a resumed wizard doesn't break the
|
|
78
|
+
* `allowJumpTo="visited"` gate).
|
|
79
|
+
*/
|
|
80
|
+
visitedSteps: Set<string>;
|
|
81
|
+
/**
|
|
82
|
+
* Errors recorded from the most recent failed `goNext()` calls. Cleared
|
|
83
|
+
* for a step when it is re-visited AND successfully re-validated.
|
|
84
|
+
*/
|
|
85
|
+
errors: StepError[];
|
|
86
|
+
/**
|
|
87
|
+
* Advance to the next step. Runs the current step's validation
|
|
88
|
+
* (`fields` trigger via `bridge.trigger` + optional `isValid` callback
|
|
89
|
+
* with AND semantics) and, on failure, records the error + fires
|
|
90
|
+
* `onStepInvalid`. On success beyond the last step, fires
|
|
91
|
+
* `onComplete()`.
|
|
92
|
+
*
|
|
93
|
+
* @returns `true` when the transition succeeded, `false` when blocked.
|
|
94
|
+
*/
|
|
95
|
+
goNext: () => Promise<boolean>;
|
|
96
|
+
/**
|
|
97
|
+
* Go back one step. Does not run validation — pending steps between
|
|
98
|
+
* the current and the target are marked pending again, but the
|
|
99
|
+
* consumer's state (RHF values) is preserved.
|
|
100
|
+
*/
|
|
101
|
+
goBack: () => void;
|
|
102
|
+
/**
|
|
103
|
+
* Jump directly to a step by name. Gated by `allowJumpTo`:
|
|
104
|
+
* - `'visited'` — allowed only if `visitedSteps.has(name)`.
|
|
105
|
+
* - `'none'` — always rejected (silent no-op).
|
|
106
|
+
* The Review-step error-routing pattern uses this to send the user
|
|
107
|
+
* back to a failed step from the error summary.
|
|
108
|
+
*/
|
|
109
|
+
goToStep: (name: string) => void;
|
|
110
|
+
/**
|
|
111
|
+
* Reset to `initialStep` (or the first visible step if `initialStep`
|
|
112
|
+
* is unset). Clears `visitedSteps` and `errors`.
|
|
113
|
+
*/
|
|
114
|
+
reset: () => void;
|
|
115
|
+
/** `true` when the current step is the first in the visible sequence. */
|
|
116
|
+
isFirstStep: boolean;
|
|
117
|
+
/** `true` when the current step is the last in the visible sequence. */
|
|
118
|
+
isLastStep: boolean;
|
|
119
|
+
/**
|
|
120
|
+
* `true` when `goNext()` would succeed as of this render. Consumers
|
|
121
|
+
* can use this to render the Next button as `disabled`. Note this is
|
|
122
|
+
* a SYNC readout (based on `bridge.getError(field)` for each `fields`
|
|
123
|
+
* entry) — the `isValid` callback is NOT invoked here, since it may
|
|
124
|
+
* be async and consumers wouldn't want a render-time promise.
|
|
125
|
+
*/
|
|
126
|
+
canGoNext: boolean;
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* Per-slot overrides — same shape as every other tw catalog entry.
|
|
130
|
+
*/
|
|
131
|
+
export interface StepperSlotProps {
|
|
132
|
+
root?: {
|
|
133
|
+
className?: string;
|
|
134
|
+
};
|
|
135
|
+
strip?: {
|
|
136
|
+
className?: string;
|
|
137
|
+
};
|
|
138
|
+
step?: {
|
|
139
|
+
className?: string;
|
|
140
|
+
};
|
|
141
|
+
indicator?: {
|
|
142
|
+
className?: string;
|
|
143
|
+
};
|
|
144
|
+
labelGroup?: {
|
|
145
|
+
className?: string;
|
|
146
|
+
};
|
|
147
|
+
label?: {
|
|
148
|
+
className?: string;
|
|
149
|
+
};
|
|
150
|
+
helperText?: {
|
|
151
|
+
className?: string;
|
|
152
|
+
};
|
|
153
|
+
optionalTag?: {
|
|
154
|
+
className?: string;
|
|
155
|
+
};
|
|
156
|
+
connector?: {
|
|
157
|
+
className?: string;
|
|
158
|
+
};
|
|
159
|
+
content?: {
|
|
160
|
+
className?: string;
|
|
161
|
+
};
|
|
162
|
+
footer?: {
|
|
163
|
+
className?: string;
|
|
164
|
+
};
|
|
165
|
+
}
|
|
166
|
+
/**
|
|
167
|
+
* Subset of `<Stepper>` props theme-configurable via
|
|
168
|
+
* `theme.components.Stepper.defaults` (Option C).
|
|
169
|
+
*/
|
|
170
|
+
export type StepperVariantProps = Pick<StepperVariants, 'color' | 'size' | 'orientation' | 'labelPlacement'>;
|
|
171
|
+
declare module '@dashforge/tw-tokens' {
|
|
172
|
+
interface TWComponentDefaults {
|
|
173
|
+
Stepper?: {
|
|
174
|
+
defaults?: Partial<StepperVariantProps>;
|
|
175
|
+
slotProps?: StepperSlotProps;
|
|
176
|
+
};
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
/**
|
|
180
|
+
* Props for `<Step>` — a config-carrier child of `<Stepper>`.
|
|
181
|
+
*
|
|
182
|
+
* `<Step>` renders no DOM of its own; the parent `<Stepper>` walks the
|
|
183
|
+
* children, reads each `<Step>`'s props, and drives rendering from
|
|
184
|
+
* there. This mirrors the MUI / Chakra "compound children as config"
|
|
185
|
+
* pattern (`<Tabs><Tab /><Tab /></Tabs>`).
|
|
186
|
+
*/
|
|
187
|
+
export interface StepProps {
|
|
188
|
+
/**
|
|
189
|
+
* Unique step key. Also used by `visitedSteps`, `goToStep`, `errors`,
|
|
190
|
+
* and `initialStep`. Required — every step must have a distinct name.
|
|
191
|
+
*/
|
|
192
|
+
name: string;
|
|
193
|
+
/** Short label rendered next to (or below) the indicator dot. */
|
|
194
|
+
label: ReactNode;
|
|
195
|
+
/**
|
|
196
|
+
* Secondary line rendered under the label. Optional.
|
|
197
|
+
* Common uses: "2 min", "Enter card info", "Optional".
|
|
198
|
+
*/
|
|
199
|
+
helperText?: ReactNode;
|
|
200
|
+
/**
|
|
201
|
+
* Custom icon rendered inside the indicator dot for the `pending` and
|
|
202
|
+
* `current` states. Not shown when `completed` (a check mark takes
|
|
203
|
+
* over) or `invalid` (an alert-triangle icon takes over).
|
|
204
|
+
*
|
|
205
|
+
* MUI-parity — an escape hatch for domain-specific dots
|
|
206
|
+
* (`<Eye />` on a Review step, `<Cog />` on a Settings step).
|
|
207
|
+
*/
|
|
208
|
+
icon?: ReactNode;
|
|
209
|
+
/**
|
|
210
|
+
* Marks the step as optional. `true` renders a default "Optional"
|
|
211
|
+
* italic caption below the label; passing a ReactNode substitutes the
|
|
212
|
+
* caption (`optional={<span>Skip if remote</span>}`). MUI-parity.
|
|
213
|
+
*
|
|
214
|
+
* NOTE: `optional` is display-only — it does NOT skip validation. A
|
|
215
|
+
* step that should be skippable at the flow level should use
|
|
216
|
+
* `visibleWhen` to hide itself, not `optional`.
|
|
217
|
+
*/
|
|
218
|
+
optional?: boolean | ReactNode;
|
|
219
|
+
/**
|
|
220
|
+
* List of RHF field names to validate on `goNext()`. Runs
|
|
221
|
+
* `bridge.trigger(fields)` and blocks the transition if any field
|
|
222
|
+
* fails. Combined with `isValid` via **AND** semantics: both must
|
|
223
|
+
* pass for the step to be considered valid.
|
|
224
|
+
*
|
|
225
|
+
* Requires a wrapping `<DashForm>` — outside a form context this prop
|
|
226
|
+
* is a no-op (dev-warn).
|
|
227
|
+
*/
|
|
228
|
+
fields?: string[];
|
|
229
|
+
/**
|
|
230
|
+
* Custom validation callback with AND-semantics against `fields`.
|
|
231
|
+
* Runs AFTER `fields` (only if `fields` passes). Return `false` (sync
|
|
232
|
+
* or async) to block the transition.
|
|
233
|
+
*
|
|
234
|
+
* Use for domain rules that can't be expressed as RHF field
|
|
235
|
+
* validators (e.g., "at least one item in the cart", "the payment
|
|
236
|
+
* gateway acknowledged the pre-auth").
|
|
237
|
+
*/
|
|
238
|
+
isValid?: () => boolean | Promise<boolean>;
|
|
239
|
+
/**
|
|
240
|
+
* Reactive visibility predicate — catalog-uniform closure. Steps
|
|
241
|
+
* whose predicate returns `false` are excluded from `visibleSteps`,
|
|
242
|
+
* skipped by `goNext()` / `goBack()`, and hidden from the indicator
|
|
243
|
+
* strip. This is the primary hook for dynamic step composition
|
|
244
|
+
* (e.g., a "Legal address" step that only shows for EU customers).
|
|
245
|
+
*/
|
|
246
|
+
visibleWhen?: (engine: Engine) => boolean;
|
|
247
|
+
/** RBAC gate — hides or disables the step. */
|
|
248
|
+
access?: AccessRequirement;
|
|
249
|
+
/** The step's content — rendered inside the `content` slot when active. */
|
|
250
|
+
children?: ReactNode;
|
|
251
|
+
}
|
|
252
|
+
/**
|
|
253
|
+
* Props for `<Stepper>` — the compound parent.
|
|
254
|
+
*
|
|
255
|
+
* @example Linear wizard with form-driven validation
|
|
256
|
+
* ```tsx
|
|
257
|
+
* <DashForm defaultValues={{ email: '', card: '' }}>
|
|
258
|
+
* <Stepper name="cardActivation" onComplete={handleActivate}>
|
|
259
|
+
* <Step name="account" label="Account" fields={['email']}>
|
|
260
|
+
* <TextField name="email" label="Email" />
|
|
261
|
+
* </Step>
|
|
262
|
+
* <Step name="card" label="Card details" fields={['card']}>
|
|
263
|
+
* <TextField name="card" label="Card number" />
|
|
264
|
+
* </Step>
|
|
265
|
+
* <Step name="review" label="Review">
|
|
266
|
+
* <ReviewPanel />
|
|
267
|
+
* </Step>
|
|
268
|
+
* </Stepper>
|
|
269
|
+
* </DashForm>
|
|
270
|
+
* ```
|
|
271
|
+
*
|
|
272
|
+
* @example Dynamic step with `visibleWhen`
|
|
273
|
+
* ```tsx
|
|
274
|
+
* <Step
|
|
275
|
+
* name="contract"
|
|
276
|
+
* label="Contract"
|
|
277
|
+
* visibleWhen={(engine) => engine.get('activation') === 'deferred'}
|
|
278
|
+
* >
|
|
279
|
+
* ...
|
|
280
|
+
* </Step>
|
|
281
|
+
* ```
|
|
282
|
+
*/
|
|
283
|
+
export interface StepperProps {
|
|
284
|
+
/** Optional identifier — used for logging / test IDs. */
|
|
285
|
+
name?: string;
|
|
286
|
+
/**
|
|
287
|
+
* `<Step>` children. Non-`<Step>` children are dev-warned and
|
|
288
|
+
* ignored — the parent only recognizes its own compound child type.
|
|
289
|
+
*/
|
|
290
|
+
children: ReactNode;
|
|
291
|
+
/**
|
|
292
|
+
* Name of the step to render on mount. Every step declared BEFORE
|
|
293
|
+
* `initialStep` in the visible sequence is marked as visited (so
|
|
294
|
+
* `allowJumpTo="visited"` allows the user to walk back through them).
|
|
295
|
+
*
|
|
296
|
+
* Common uses: resuming an interrupted wizard from persistent state,
|
|
297
|
+
* deep-linking to a specific step from a URL query.
|
|
298
|
+
*
|
|
299
|
+
* If the name doesn't match any visible step, falls back to the first
|
|
300
|
+
* visible step and dev-warns.
|
|
301
|
+
*/
|
|
302
|
+
initialStep?: string;
|
|
303
|
+
/**
|
|
304
|
+
* Controls the `goToStep` (indicator-click) affordance:
|
|
305
|
+
* - `'visited'` (default) — the user can jump only to steps they've
|
|
306
|
+
* already visited. Forward jumps are blocked
|
|
307
|
+
* because they'd bypass validation.
|
|
308
|
+
* - `'none'` — no jumping; navigation is strictly
|
|
309
|
+
* `goNext` / `goBack`.
|
|
310
|
+
*
|
|
311
|
+
* @default 'visited'
|
|
312
|
+
*/
|
|
313
|
+
allowJumpTo?: 'visited' | 'none';
|
|
314
|
+
/**
|
|
315
|
+
* Fires when the user advances past the LAST visible step via
|
|
316
|
+
* `goNext()`. If this Stepper is wrapped in a `<DashForm>` and
|
|
317
|
+
* `onComplete` is omitted, the DashForm's own submit handler runs
|
|
318
|
+
* naturally on the consumer's Next button (typical pattern:
|
|
319
|
+
* `<Button type="submit">Finish</Button>` on the last step). Optional.
|
|
320
|
+
*/
|
|
321
|
+
onComplete?: () => void;
|
|
322
|
+
/**
|
|
323
|
+
* Fires on every successful transition — moving forward, moving back,
|
|
324
|
+
* or jumping. Receives the previous step name, next step name, and
|
|
325
|
+
* the direction.
|
|
326
|
+
*/
|
|
327
|
+
onStepChange?: (prev: string, next: string, reason: 'next' | 'back' | 'jump') => void;
|
|
328
|
+
/**
|
|
329
|
+
* Fires when `goNext()` blocks because validation failed. Useful for
|
|
330
|
+
* side-effects like scrolling the first invalid field into view or
|
|
331
|
+
* emitting a Snackbar toast.
|
|
332
|
+
*/
|
|
333
|
+
onStepInvalid?: (payload: OnStepInvalidPayload) => void;
|
|
334
|
+
/** Colour intent applied to the indicator + connector fills. @default 'primary' */
|
|
335
|
+
color?: StepperVariants['color'];
|
|
336
|
+
/** Density knob (indicator diameter + label size). @default 'md' */
|
|
337
|
+
size?: StepperVariants['size'];
|
|
338
|
+
/** `horizontal` (default) or `vertical` strip layout. @default 'horizontal' */
|
|
339
|
+
orientation?: StepperVariants['orientation'];
|
|
340
|
+
/**
|
|
341
|
+
* `end` (label next to indicator, default) or `below` (label under
|
|
342
|
+
* the indicator, MUI `alternativeLabel` semantics). Horizontal only —
|
|
343
|
+
* ignored on `orientation='vertical'`.
|
|
344
|
+
* @default 'end'
|
|
345
|
+
*/
|
|
346
|
+
labelPlacement?: StepperVariants['labelPlacement'];
|
|
347
|
+
/** Reactive visibility predicate for the whole Stepper. */
|
|
348
|
+
visibleWhen?: (engine: Engine) => boolean;
|
|
349
|
+
/** RBAC gate for the whole Stepper. */
|
|
350
|
+
access?: AccessRequirement;
|
|
351
|
+
/** Utility-class shortcut for `slotProps.root.className`. */
|
|
352
|
+
sx?: string;
|
|
353
|
+
/** Per-slot overrides. */
|
|
354
|
+
slotProps?: StepperSlotProps;
|
|
355
|
+
/** `data-testid` on the root wrapper. */
|
|
356
|
+
testId?: string;
|
|
357
|
+
}
|
|
358
|
+
//# sourceMappingURL=stepper.types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stepper.types.d.ts","sourceRoot":"","sources":["../../../../src/components/Stepper/stepper.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACzD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAE7D;;;;;;;;;;;;;GAaG;AACH,MAAM,MAAM,SAAS,GACjB,SAAS,GACT,SAAS,GACT,WAAW,GACX,SAAS,GACT,SAAS,CAAC;AAEd;;;;;;;GAOG;AACH,MAAM,WAAW,SAAS;IACxB,sCAAsC;IACtC,IAAI,EAAE,MAAM,CAAC;IACb,0DAA0D;IAC1D,KAAK,EAAE,SAAS,CAAC;IACjB,mCAAmC;IACnC,MAAM,EAAE,QAAQ,GAAG,SAAS,CAAC;IAC7B,qEAAqE;IACrE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;CACxC;AAED;;;GAGG;AACH,MAAM,WAAW,oBAAoB;IACnC,4BAA4B;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,6CAA6C;IAC7C,KAAK,EAAE,MAAM,CAAC;IACd,qBAAqB;IACrB,MAAM,EAAE,QAAQ,GAAG,SAAS,C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