@ostack.tech/ui 0.10.5 → 0.11.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.
Files changed (113) hide show
  1. package/dist/chunks/{en-DwZKZVGL.js → en-DtnihkTA.js} +20 -3
  2. package/dist/chunks/en-DtnihkTA.js.map +1 -0
  3. package/dist/locales/en-GB.js +1 -1
  4. package/dist/locales/en-US.js +1 -1
  5. package/dist/locales/fr-FR.js +19 -2
  6. package/dist/locales/fr-FR.js.map +1 -1
  7. package/dist/locales/pt-PT.js +19 -2
  8. package/dist/locales/pt-PT.js.map +1 -1
  9. package/dist/ostack-ui.css +186 -110
  10. package/dist/ostack-ui.js +1466 -681
  11. package/dist/ostack-ui.js.map +1 -1
  12. package/dist/types/components/Alert/Alert.d.ts +3 -3
  13. package/dist/types/components/AlertDialog/AlertDialog.d.ts +6 -2
  14. package/dist/types/components/Button/Button.d.ts +7 -7
  15. package/dist/types/components/Calendar/Calendar.d.ts +60 -4
  16. package/dist/types/components/Card/Card.d.ts +2 -2
  17. package/dist/types/components/Code/Code.d.ts +1 -1
  18. package/dist/types/components/Collapsible/Collapsible.d.ts +26 -8
  19. package/dist/types/components/Collapsible/CollapsibleContext.d.ts +2 -2
  20. package/dist/types/components/Collapsible/CollapsibleTrigger.d.ts +22 -6
  21. package/dist/types/components/CommandMenu/CommandMenu.d.ts +1 -1
  22. package/dist/types/components/Container/Container.d.ts +21 -10
  23. package/dist/types/components/DataTable/DataTable.d.ts +63 -29
  24. package/dist/types/components/DataTable/DataTableContext.d.ts +3 -1
  25. package/dist/types/components/DateInput/DateInput.d.ts +8 -5
  26. package/dist/types/components/DateRangeInput/DateRangeInput.d.ts +6 -5
  27. package/dist/types/components/DescriptionList/DescriptionList.d.ts +38 -0
  28. package/dist/types/components/DescriptionList/DescriptionListItem.d.ts +15 -0
  29. package/dist/types/components/DescriptionList/index.d.ts +2 -0
  30. package/dist/types/components/Dialog/Dialog.d.ts +1 -2
  31. package/dist/types/components/Dialog/DialogContent.d.ts +3 -3
  32. package/dist/types/components/DropdownMenu/DropdownMenu.d.ts +1 -1
  33. package/dist/types/components/FieldGroup/FieldGroup.d.ts +42 -14
  34. package/dist/types/components/Grid/Grid.d.ts +64 -11
  35. package/dist/types/components/Icon/Icon.d.ts +1 -1
  36. package/dist/types/components/IconButton/IconButton.d.ts +8 -10
  37. package/dist/types/components/Input/Input.d.ts +2 -3
  38. package/dist/types/components/Link/Link.d.ts +1 -3
  39. package/dist/types/components/Mark/Mark.d.ts +1 -1
  40. package/dist/types/components/MenuList/MenuList.d.ts +5 -0
  41. package/dist/types/components/MenuList/MenuListItem.d.ts +3 -3
  42. package/dist/types/components/NumericInput/NumericInput.d.ts +2 -2
  43. package/dist/types/components/Popover/Popover.d.ts +32 -19
  44. package/dist/types/components/Popover/PopoverClose.d.ts +10 -3
  45. package/dist/types/components/Printer/Printer.d.ts +4 -4
  46. package/dist/types/components/Printer/PrinterContentContext.d.ts +4 -4
  47. package/dist/types/components/Printer/PrinterContext.d.ts +2 -2
  48. package/dist/types/components/Root/Root.d.ts +7 -7
  49. package/dist/types/components/Select/Select.d.ts +6 -0
  50. package/dist/types/components/Select/SelectContext.d.ts +2 -1
  51. package/dist/types/components/Select/SelectNative.d.ts +7 -0
  52. package/dist/types/components/Separator/Separator.d.ts +39 -1
  53. package/dist/types/components/Stack/Stack.d.ts +27 -5
  54. package/dist/types/components/Stepper/Step.d.ts +21 -6
  55. package/dist/types/components/Stepper/StepContent.d.ts +13 -4
  56. package/dist/types/components/Stepper/StepList.d.ts +8 -3
  57. package/dist/types/components/Stepper/Stepper.d.ts +51 -34
  58. package/dist/types/components/Stepper/StepperContext.d.ts +77 -4
  59. package/dist/types/components/Stepper/StepperFinishTrigger.d.ts +37 -0
  60. package/dist/types/components/Stepper/StepperNextTrigger.d.ts +34 -0
  61. package/dist/types/components/Stepper/StepperPreviousTrigger.d.ts +37 -0
  62. package/dist/types/components/Stepper/StepperState.d.ts +8 -0
  63. package/dist/types/components/Stepper/index.d.ts +5 -0
  64. package/dist/types/components/Table/Table.d.ts +2 -2
  65. package/dist/types/components/Table/TableColumn.d.ts +1 -1
  66. package/dist/types/components/Tabs/Tab.d.ts +6 -1
  67. package/dist/types/components/Tabs/Tabs.d.ts +1 -1
  68. package/dist/types/components/Toast/Toast.d.ts +81 -15
  69. package/dist/types/components/Tooltip/Tooltip.d.ts +4 -0
  70. package/dist/types/components/VisuallyHidden/VisuallyHidden.d.ts +22 -1
  71. package/dist/types/index.d.ts +1 -2
  72. package/dist/types/providers/AlertDialogProvider/AlertDialogProviderContext.d.ts +2 -2
  73. package/dist/types/providers/ErrorReportingProvider/ErrorReport.d.ts +3 -3
  74. package/dist/types/providers/ErrorReportingProvider/ErrorReportingProvider.d.ts +2 -2
  75. package/dist/types/providers/LocalizationProvider/LocalizationObject.d.ts +7 -0
  76. package/dist/types/providers/ToastManagerProvider/ToastManagerContext.d.ts +4 -2
  77. package/dist/types/utils/control.d.ts +1 -1
  78. package/dist/types/utils/keyboardShortcut.d.ts +1 -1
  79. package/dist/types/utils/useSearchParam.d.ts +5 -5
  80. package/dist/types/utils/useSearchParams.d.ts +7 -4
  81. package/package.json +3 -3
  82. package/scss/_utils.scss +3 -0
  83. package/scss/components/Checkbox/_Checkbox.scss +1 -1
  84. package/scss/components/Collapsible/_Collapsible-variables.scss +0 -1
  85. package/scss/components/Collapsible/_Collapsible.scss +2 -6
  86. package/scss/components/Container/_Container.scss +16 -5
  87. package/scss/components/DescriptionList/_DescriptionList-variables.scss +21 -0
  88. package/scss/components/DescriptionList/_DescriptionList.scss +33 -0
  89. package/scss/components/DropdownMenu/_DropdownMenu.scss +1 -3
  90. package/scss/components/FeedbackPopover/_FeedbackPopover-variables.scss +9 -9
  91. package/scss/components/FeedbackPopover/_FeedbackPopover.scss +1 -1
  92. package/scss/components/Field/_Field-variables.scss +9 -0
  93. package/scss/components/Field/_Field.scss +6 -8
  94. package/scss/components/Input/_Input.scss +5 -0
  95. package/scss/components/Label/_Label-variables.scss +1 -1
  96. package/scss/components/MenuList/_MenuList.scss +4 -1
  97. package/scss/components/RadioGroup/_Radio.scss +1 -1
  98. package/scss/components/Separator/_Separator-variables.scss +11 -0
  99. package/scss/components/Separator/_Separator.scss +13 -5
  100. package/scss/components/Stepper/_Stepper-variables.scss +37 -9
  101. package/scss/components/Stepper/_Stepper.scss +69 -22
  102. package/scss/components/Tabs/_Tabs.scss +6 -4
  103. package/scss/index.scss +1 -0
  104. package/scss/scss/placeholders/checkable/_checkable.scss +3 -3
  105. package/scss/scss/placeholders/control/_control.scss +1 -1
  106. package/scss/scss/placeholders/menu/_menu.scss +5 -16
  107. package/scss/scss/utils/_animation.scss +1 -1
  108. package/scss/scss/utils/_transition.scss +1 -1
  109. package/dist/chunks/en-DwZKZVGL.js.map +0 -1
  110. package/dist/types/components/DatePicker/DatePicker.d.ts +0 -27
  111. package/dist/types/components/DatePicker/index.d.ts +0 -1
  112. package/dist/types/components/DateRangePicker/DateRangePicker.d.ts +0 -41
  113. package/dist/types/components/DateRangePicker/index.d.ts +0 -1
@@ -1,7 +1,45 @@
1
1
  import { Separator as SeparatorPrimitive } from 'radix-ui';
2
2
  import { ComponentPropsWithoutRef } from 'react';
3
+ import { AccentColor } from '../../utils/accent.ts';
4
+ /** Link colours. */
5
+ export type SeparatorColor = AccentColor;
3
6
  /** Properties of the separator component. */
4
7
  export interface SeparatorProps extends ComponentPropsWithoutRef<typeof SeparatorPrimitive.Root> {
8
+ /**
9
+ * Colour of the separator.
10
+ *
11
+ * @default neutral
12
+ */
13
+ color?: SeparatorColor;
14
+ /**
15
+ * Length of the separator. When a number is provided, each unit corresponds
16
+ * to `var(--o-ui-space)`.
17
+ *
18
+ * Defaults to `"100%"` when horizontal, and `4` when vertical.
19
+ */
20
+ length?: number | string;
5
21
  }
6
- /** Component that visually or semantically separates content. */
22
+ /**
23
+ * Component that visually or semantically separates content. Built on top of
24
+ * the [Radix Separator
25
+ * primitive](https://www.radix-ui.com/primitives/docs/components/separator)
26
+ *
27
+ * Example usage:
28
+ *
29
+ * ```tsx
30
+ * import { Link, Separator, Stack } from "@ostack.tech/ui";
31
+ *
32
+ * function NavLinks() {
33
+ * return (
34
+ * <Stack gap={2}>
35
+ * <Link href="#home">Home</Link>
36
+ * <Separator />
37
+ * <Link href="#user">User</Link>
38
+ * <Separator />
39
+ * <Link href="#settings">Settings</Link>
40
+ * </Stack>
41
+ * );
42
+ * }
43
+ * ```
44
+ */
7
45
  export declare const Separator: import('react').ForwardRefExoticComponent<SeparatorProps & import('react').RefAttributes<HTMLDivElement>>;
@@ -1,7 +1,9 @@
1
1
  import { ComponentPropsWithoutRef, CSSProperties, ReactElement } from 'react';
2
2
  import { Responsive } from '../../utils/useResponsiveValues.ts';
3
3
  /** Possible stack directions. */
4
- export type FlexDirection = "column" | "column-reverse" | "row" | "row-reverse";
4
+ export type StackDirection = "column" | "column-reverse" | "row" | "row-reverse";
5
+ /** Whether to wrap items. */
6
+ export type StackWrap = boolean | "reverse";
5
7
  /** Properties of the stack component. */
6
8
  export interface StackProps extends ComponentPropsWithoutRef<"div"> {
7
9
  /**
@@ -13,9 +15,9 @@ export interface StackProps extends ComponentPropsWithoutRef<"div"> {
13
15
  /**
14
16
  * Direction of the stack.
15
17
  *
16
- * @default column
18
+ * @default "column"
17
19
  */
18
- direction?: Responsive<FlexDirection>;
20
+ direction?: Responsive<StackDirection>;
19
21
  /**
20
22
  * Spacing between items. When a number is provided, each unit corresponds to
21
23
  * `var(--o-ui-space)`.
@@ -28,15 +30,35 @@ export interface StackProps extends ComponentPropsWithoutRef<"div"> {
28
30
  justifyContent?: Responsive<CSSProperties["justifyContent"]>;
29
31
  alignItems?: Responsive<CSSProperties["alignItems"]>;
30
32
  alignContent?: Responsive<CSSProperties["alignContent"]>;
31
- wrap?: Responsive<CSSProperties["flexWrap"]>;
33
+ wrap?: Responsive<StackWrap>;
32
34
  }
33
35
  /**
34
- * The Stack component manages the layout of immediate children along the
36
+ * The stack component manages the layout of immediate children along the
35
37
  * vertical or horizontal axis with optional spacing and/or dividers between
36
38
  * each child.
37
39
  *
38
40
  * It uses a flex display together with a variant of the [lobotomised
39
41
  * owl](https://css-tricks.com/lobotomized-owls/) selector (`* + *`) for
40
42
  * spacing.
43
+ *
44
+ * The stack component is mostly concerned with one-dimension layouts. For
45
+ * two-dimensional layouts, you might prefer to use the [`Grid`
46
+ * component](?path=/docs/ostack-ui-layout-grid--docs) instead.
47
+ *
48
+ * Example usage:
49
+ *
50
+ * ```tsx
51
+ * import { Stack } from "@ostack.tech/ui";
52
+ *
53
+ * function Items() {
54
+ * return (
55
+ * <Stack>
56
+ * <Item>Item 1</Item>
57
+ * <Item>Item 2</Item>
58
+ * <Item>Item 3</Item>
59
+ * </Stack>
60
+ * );
61
+ * }
62
+ * ```
41
63
  */
42
64
  export declare const Stack: import('react').ForwardRefExoticComponent<StackProps & import('react').RefAttributes<HTMLDivElement>>;
@@ -1,17 +1,32 @@
1
- import { Tabs as TabsPrimitive } from 'radix-ui';
2
- import { ComponentPropsWithoutRef, ComponentPropsWithRef } from 'react';
1
+ import { ComponentPropsWithoutRef, ComponentPropsWithRef, ReactNode } from 'react';
3
2
  import { ControlStatus } from '../../utils/control.ts';
3
+ import { ButtonProps } from '../Button';
4
4
  import { Label } from '../Label';
5
5
  /** Properties of the step component. */
6
- export interface StepProps extends Omit<ComponentPropsWithoutRef<typeof TabsPrimitive.TabsTrigger>, "asChild" | "value"> {
6
+ export interface StepProps extends ComponentPropsWithoutRef<"li">, Pick<ButtonProps, "variant" | "disabled" | "loading" | "showSpinner" | "spinnerProps"> {
7
+ /**
8
+ * Change the component to the HTML tag or custom component of the only child.
9
+ * This will merge the original component props with the props of the supplied
10
+ * element/component and change the underlying DOM node.
11
+ */
12
+ asChild?: boolean;
7
13
  /** Index of the step. */
8
14
  index?: number;
15
+ /**
16
+ * Whether the step is completed. By default, a step is marked as completed if
17
+ * its index is less than the currently active step.
18
+ */
19
+ completed?: boolean;
9
20
  /** Status of the step. */
10
21
  status?: ControlStatus;
11
- /** Properties to pass to the container element. */
12
- containerProps?: ComponentPropsWithRef<"div">;
22
+ /** Visually hidden label for the step number. */
23
+ stepNumberLabel?: (number: number) => ReactNode;
24
+ /** Visually hidden label for completed steps. */
25
+ completedLabel?: ReactNode;
26
+ /** Properties to pass to the button element. */
27
+ buttonProps?: Omit<ComponentPropsWithRef<"button">, "color" | "children" | "disabled">;
13
28
  /** Properties to pass to the step's label component. */
14
29
  labelProps?: Omit<ComponentPropsWithRef<typeof Label>, "htmlFor">;
15
30
  }
16
31
  /** Step trigger component. */
17
- export declare const Step: import('react').ForwardRefExoticComponent<StepProps & import('react').RefAttributes<HTMLButtonElement>>;
32
+ export declare const Step: import('react').ForwardRefExoticComponent<StepProps & import('react').RefAttributes<HTMLLIElement>>;
@@ -1,9 +1,18 @@
1
- import { Tabs as TabsPrimitive } from 'radix-ui';
2
- import { ComponentPropsWithoutRef } from 'react';
1
+ import { ComponentPropsWithoutRef, ComponentPropsWithRef } from 'react';
3
2
  /** Properties of the step content component. */
4
- export interface StepContentProps extends Omit<ComponentPropsWithoutRef<typeof TabsPrimitive.TabsContent>, "value"> {
3
+ export interface StepContentProps extends ComponentPropsWithoutRef<"div"> {
4
+ /**
5
+ * Change the component to the HTML tag or custom component of the only child.
6
+ * This will merge the original component props with the props of the supplied
7
+ * element/component and change the underlying DOM node.
8
+ */
9
+ asChild?: boolean;
5
10
  /** Index of the step that corresponds to this content. */
6
- index: number;
11
+ index?: number;
12
+ /** Properties to pass to the content label element (print only). */
13
+ stepContentLabelProps?: ComponentPropsWithRef<"span">;
14
+ /** Properties to pass to the content label index element (print only). */
15
+ stepContentLabelIndexProps?: ComponentPropsWithRef<"span">;
7
16
  }
8
17
  /** Step content component. */
9
18
  export declare const StepContent: import('react').ForwardRefExoticComponent<StepContentProps & import('react').RefAttributes<HTMLDivElement>>;
@@ -1,7 +1,12 @@
1
- import { Tabs as TabsPrimitive } from 'radix-ui';
2
1
  import { ComponentPropsWithoutRef } from 'react';
3
2
  /** Properties of the step list component. */
4
- export interface StepListProps extends ComponentPropsWithoutRef<typeof TabsPrimitive.List> {
3
+ export interface StepListProps extends ComponentPropsWithoutRef<"ol"> {
4
+ /**
5
+ * Change the component to the HTML tag or custom component of the only child.
6
+ * This will merge the original component props with the props of the supplied
7
+ * element/component and change the underlying DOM node.
8
+ */
9
+ asChild?: boolean;
5
10
  }
6
11
  /**
7
12
  * Component containing the list of steps.
@@ -9,4 +14,4 @@ export interface StepListProps extends ComponentPropsWithoutRef<typeof TabsPrimi
9
14
  * The `index` of each `Step` is automatically added when `Step`s are direct
10
15
  * children of `StepList`.
11
16
  */
12
- export declare const StepList: import('react').ForwardRefExoticComponent<StepListProps & import('react').RefAttributes<HTMLDivElement>>;
17
+ export declare const StepList: import('react').ForwardRefExoticComponent<StepListProps & import('react').RefAttributes<HTMLOListElement>>;
@@ -1,7 +1,13 @@
1
- import { Tabs as TabsPrimitive } from 'radix-ui';
2
- import { ComponentPropsWithoutRef, ReactNode, Ref } from 'react';
1
+ import { ComponentPropsWithoutRef, Ref } from 'react';
2
+ import { StepperApi } from './StepperContext.ts';
3
3
  /** Properties of the stepper component. */
4
- export interface StepperProps extends Omit<ComponentPropsWithoutRef<typeof TabsPrimitive.Root>, "defaultValue" | "value" | "onValueChange" | "orientation" | "dir" | "children"> {
4
+ export interface StepperProps extends ComponentPropsWithoutRef<"div"> {
5
+ /**
6
+ * Change the component to the HTML tag or custom component of the only child.
7
+ * This will merge the original component props with the props of the supplied
8
+ * element/component and change the underlying DOM node.
9
+ */
10
+ asChild?: boolean;
5
11
  /**
6
12
  * Index of the default active step.
7
13
  *
@@ -16,44 +22,55 @@ export interface StepperProps extends Omit<ComponentPropsWithoutRef<typeof TabsP
16
22
  * @param newActiveStep Index of the new active step.
17
23
  */
18
24
  onActiveStepChange?: (newActiveStep: number) => void;
19
- /** Reference to interact with the stepper's API. */
25
+ /** Whether the content of all steps should be shown while printing. */
26
+ showAllStepsWhilePrinting?: boolean;
27
+ /** Reference to interact with the stepper API. */
20
28
  apiRef?: Ref<StepperApi | undefined>;
21
- children?: ReactNode | ((api: StepperApi) => ReactNode);
22
- }
23
- export interface StepperApi {
24
- /** Currently active step. */
25
- activeStep: number;
26
- /**
27
- * Navigates to the provided step.
28
- *
29
- * @param step Step to go to.
30
- */
31
- goTo: (step: number) => void;
32
- /** Navigates to the next step. */
33
- next: () => void;
34
- /** Navigates to the previous step. */
35
- previous: () => void;
36
29
  }
37
30
  /**
38
- * Component used to display progress through a sequence of numbered steps.
31
+ * Display progress through a sequence of numbered steps.
39
32
  *
40
33
  * It composes the following subcomponents:
41
34
  *
42
- * - `StepList`: Displays the `Step` in the sequence, helping users visualize
43
- * their progress and navigate between steps.
44
- * - `StepComponent`: Displays the content relevant to each `Step`, ensuring users
45
- * see detailed information as they progress through the steps.
35
+ * - `StepList`: List of steps.
36
+ * - `Step`: Single step of the list.
37
+ * - `StepContent`: Content of a step.
38
+ * - `StepperPreviousTrigger`: Trigger to navigate to the previous step.
39
+ * - `StepperNextTrigger`: Trigger to navigate to the next step.
40
+ * - `StepperFinishTrigger`: Trigger to finish the stepper.
41
+ * - `StepperState`: Utility component providing access to the state of the
42
+ * stepper and its API.
43
+ *
44
+ * Example usage:
46
45
  *
47
- * The component leverages the `StepperApi` interface to manage navigation and
48
- * active step tracking through the following props:
46
+ * ```tsx
47
+ * import {
48
+ * Step,
49
+ * StepContent,
50
+ * StepList,
51
+ * Stepper,
52
+ * StepperFinishTrigger,
53
+ * StepperNextTrigger,
54
+ * StepperPreviousTrigger,
55
+ * } from "@ostack.tech/ui";
49
56
  *
50
- * - `activeStep`: Tracks the currently active step to synchronize navigation and
51
- * step content display.
52
- * - `previous`: Enables moving to the previous step. Prevents navigation beyond
53
- * the first step by disabling the relevant button.
54
- * - `next`: Allows progression to the next step. On the final step, disables
55
- * further navigation to maintain flow.
56
- * - `goTo`: Provides direct access to a specific step. While not used in all
57
- * implementations, it adds flexibility for custom navigation flows.
57
+ * function Checkout() {
58
+ * return (
59
+ * <Stepper>
60
+ * <StepList>
61
+ * <Step>Shipping</Step>
62
+ * <Step>Payment</Step>
63
+ * <Step>Review</Step>
64
+ * </StepList>
65
+ * <StepContent>…</StepContent>
66
+ * <StepContent>…</StepContent>
67
+ * <StepContent>…</StepContent>
68
+ * <StepperPreviousTrigger />
69
+ * <StepperNextTrigger />
70
+ * <StepperFinishTrigger onClick={completeCheckout} />
71
+ * </Stepper>
72
+ * );
73
+ * }
74
+ * ```
58
75
  */
59
76
  export declare const Stepper: import('react').ForwardRefExoticComponent<StepperProps & import('react').RefAttributes<HTMLDivElement>>;
@@ -1,8 +1,81 @@
1
- /** Value of the stepper's context. */
1
+ import { ReactNode, RefObject } from 'react';
2
+ /** Value of the stepper context. */
2
3
  export interface StepperContextValue {
3
- activeStep: number;
4
+ showAllStepsWhilePrinting?: boolean;
5
+ store: StepperStore;
6
+ }
7
+ /** Information about a registered step. */
8
+ export interface RegisteredStepInfo {
9
+ labelId: string;
10
+ label: ReactNode;
11
+ disabled?: boolean;
12
+ }
13
+ /** Information about a registered step content. */
14
+ export interface RegisteredStepContentInfo {
15
+ id: string;
16
+ ref: RefObject<HTMLElement | null>;
17
+ }
18
+ /** State of the stepper. */
19
+ export interface StepperState {
20
+ _activeStep: number;
21
+ _controlledActiveStep: number | undefined;
22
+ activeStep: () => number;
23
+ stepsInfo: Record<number, RegisteredStepInfo>;
24
+ stepsContent: Record<number, RegisteredStepContentInfo>;
25
+ stepCount: () => number;
26
+ actions: StepperStateActions;
4
27
  }
5
- /** Stepper's context. */
28
+ interface StepperStateActions {
29
+ registerStep: (index: number, info: RegisteredStepInfo) => (() => void) | void;
30
+ registerStepContent: (index: number, info: RegisteredStepContentInfo) => (() => void) | void;
31
+ getStepInfo: (index: number) => RegisteredStepInfo | undefined;
32
+ getStepContent: (index: number) => RegisteredStepContentInfo | undefined;
33
+ goTo: (index: string | number) => void;
34
+ previous: () => void;
35
+ next: () => void;
36
+ }
37
+ /** Stepper store. */
38
+ export type StepperStore = ReturnType<typeof useCreateStepperContext>["store"];
39
+ /** Stepper context. */
6
40
  export declare const StepperContext: import('react').Context<StepperContextValue | null>;
7
- /** Hook exposing the stepper's context. */
41
+ /** Stepper API. */
42
+ export interface StepperApi {
43
+ /** Currently active step. */
44
+ activeStep: number;
45
+ /**
46
+ * Navigates to the provided step.
47
+ *
48
+ * @param step Step to go to.
49
+ */
50
+ goTo: (step: number) => void;
51
+ /** Navigates to the next step. */
52
+ next: () => void;
53
+ /** Navigates to the previous step. */
54
+ previous: () => void;
55
+ }
56
+ /** Hook which creates the stepper store. */
57
+ export declare function useCreateStepperContext(defaultActiveStep?: number, activeStep?: number, onActiveStepChange?: (activeStep: number) => void, showAllStepsWhilePrinting?: boolean): {
58
+ showAllStepsWhilePrinting: boolean | undefined;
59
+ store: Omit<import('zustand').StoreApi<StepperState>, "subscribe"> & {
60
+ subscribe: {
61
+ (listener: (selectedState: StepperState, previousSelectedState: StepperState) => void): () => void;
62
+ <U>(selector: (state: StepperState) => U, listener: (selectedState: U, previousSelectedState: U) => void, options?: {
63
+ equalityFn?: ((a: U, b: U) => boolean) | undefined;
64
+ fireImmediately?: boolean;
65
+ } | undefined): () => void;
66
+ };
67
+ };
68
+ };
69
+ /** Hooks returning the stepper context value. */
8
70
  export declare function useStepperContext(): StepperContextValue;
71
+ /** Hook which registers a step. */
72
+ export declare function useRegisterStep(index: number, info: RegisteredStepInfo): void;
73
+ /** Hook which registers the id of a step content. */
74
+ export declare function useRegisterStepContent(index: number, info: RegisteredStepContentInfo): void;
75
+ /** Hook which returns the info of a step. */
76
+ export declare function useStepInfo(index: number): RegisteredStepInfo | undefined;
77
+ /** Hook which returns the info of a step. */
78
+ export declare function useStepContentInfo(index: number): RegisteredStepContentInfo | undefined;
79
+ /** Hook providing access to the stepper API. */
80
+ export declare function useStepperApi(): StepperApi;
81
+ export {};
@@ -0,0 +1,37 @@
1
+ import { ComponentPropsWithoutRef, ReactNode } from 'react';
2
+ import { Button } from '../Button';
3
+ /** Properties of the stepper finish trigger component. */
4
+ export type StepperFinishTriggerProps = StepperFinishTriggerChildlessProps | StepperFinishTriggerChildrenProps;
5
+ /** Base properties of the stepper finish trigger component. */
6
+ export interface StepperFinishTriggerPropsBase {
7
+ /**
8
+ * Whether to show the (disabled) trigger when **not** on the last step.
9
+ *
10
+ * @default false
11
+ */
12
+ showWhenNotLast?: boolean;
13
+ /**
14
+ * Whether to show the trigger when it is being printed.
15
+ *
16
+ * @default false
17
+ */
18
+ showWhilePrinting?: boolean;
19
+ }
20
+ /**
21
+ * Properties of the stepper finish trigger component when rendered without
22
+ * children.
23
+ */
24
+ export interface StepperFinishTriggerChildlessProps extends StepperFinishTriggerPropsBase, Omit<ComponentPropsWithoutRef<typeof Button<"button">>, "asChild" | "children"> {
25
+ /** Label displayed on the button. */
26
+ label?: ReactNode;
27
+ children?: never;
28
+ }
29
+ /**
30
+ * Properties of the stepper finish trigger component when rendered with
31
+ * children.
32
+ */
33
+ export interface StepperFinishTriggerChildrenProps extends StepperFinishTriggerPropsBase, ComponentPropsWithoutRef<"button"> {
34
+ children: ReactNode;
35
+ }
36
+ /** Trigger used to conclude the stepper. */
37
+ export declare const StepperFinishTrigger: import('react').ForwardRefExoticComponent<StepperFinishTriggerProps & import('react').RefAttributes<HTMLButtonElement>>;
@@ -0,0 +1,34 @@
1
+ import { ComponentPropsWithoutRef, ReactNode } from 'react';
2
+ import { Button } from '../Button';
3
+ /** Properties of the stepper next trigger component. */
4
+ export type StepperNextTriggerProps = StepperNextTriggerChildlessProps | StepperNextTriggerChildrenProps;
5
+ /** Base properties of the stepper next trigger component. */
6
+ export interface StepperNextTriggerPropsBase {
7
+ /**
8
+ * Whether to show the (disabled) trigger when on the last step.
9
+ *
10
+ * @default false
11
+ */
12
+ showWhenLast?: boolean;
13
+ /**
14
+ * Whether to show the trigger when it is being printed.
15
+ *
16
+ * @default false
17
+ */
18
+ showWhilePrinting?: boolean;
19
+ }
20
+ /**
21
+ * Properties of the stepper next trigger component when rendered without
22
+ * children.
23
+ */
24
+ export interface StepperNextTriggerChildlessProps extends StepperNextTriggerPropsBase, Omit<ComponentPropsWithoutRef<typeof Button<"button">>, "asChild" | "children"> {
25
+ /** Label displayed on the button. */
26
+ label?: ReactNode;
27
+ children?: never;
28
+ }
29
+ /** Properties of the stepper next trigger component when rendered with children. */
30
+ export interface StepperNextTriggerChildrenProps extends StepperNextTriggerPropsBase, ComponentPropsWithoutRef<"button"> {
31
+ children: ReactNode;
32
+ }
33
+ /** Trigger used to go to the next step of the stepper. */
34
+ export declare const StepperNextTrigger: import('react').ForwardRefExoticComponent<StepperNextTriggerProps & import('react').RefAttributes<HTMLButtonElement>>;
@@ -0,0 +1,37 @@
1
+ import { ComponentPropsWithoutRef, ReactNode } from 'react';
2
+ import { Button } from '../Button';
3
+ /** Properties of the stepper previous trigger component. */
4
+ export type StepperPreviousTriggerProps = StepperPreviousTriggerChildlessProps | StepperPreviousTriggerChildrenProps;
5
+ /** Base properties of the stepper previous trigger component. */
6
+ export interface StepperPreviousTriggerPropsBase {
7
+ /**
8
+ * Whether to show the (disabled) trigger when on the first step.
9
+ *
10
+ * @default true
11
+ */
12
+ showWhenFirst?: boolean;
13
+ /**
14
+ * Whether to show the trigger when it is being printed.
15
+ *
16
+ * @default false
17
+ */
18
+ showWhilePrinting?: boolean;
19
+ }
20
+ /**
21
+ * Properties of the stepper previous trigger component when rendered without
22
+ * children.
23
+ */
24
+ export interface StepperPreviousTriggerChildlessProps extends StepperPreviousTriggerPropsBase, Omit<ComponentPropsWithoutRef<typeof Button<"button">>, "asChild" | "children"> {
25
+ /** Label displayed on the button. */
26
+ label?: ReactNode;
27
+ children?: never;
28
+ }
29
+ /**
30
+ * Properties of the stepper previous trigger component when rendered with
31
+ * children.
32
+ */
33
+ export interface StepperPreviousTriggerChildrenProps extends StepperPreviousTriggerPropsBase, ComponentPropsWithoutRef<"button"> {
34
+ children: ReactNode;
35
+ }
36
+ /** Trigger used to go to the previous step of the stepper. */
37
+ export declare const StepperPreviousTrigger: import('react').ForwardRefExoticComponent<StepperPreviousTriggerProps & import('react').RefAttributes<HTMLButtonElement>>;
@@ -0,0 +1,8 @@
1
+ import { ReactNode } from 'react';
2
+ import { StepperApi } from './StepperContext.ts';
3
+ /** Properties of the stepper state component. */
4
+ export interface StepperStateProps {
5
+ children?: (api: StepperApi) => ReactNode;
6
+ }
7
+ /** Component used to access the state of the stepper and act on its API. */
8
+ export declare function StepperState({ children }: StepperStateProps): ReactNode;
@@ -2,3 +2,8 @@ export * from './Step.tsx';
2
2
  export * from './StepContent.tsx';
3
3
  export * from './StepList.tsx';
4
4
  export * from './Stepper.tsx';
5
+ export { type StepperApi, useStepperApi } from './StepperContext.ts';
6
+ export * from './StepperFinishTrigger.tsx';
7
+ export * from './StepperNextTrigger.tsx';
8
+ export * from './StepperPreviousTrigger.tsx';
9
+ export * from './StepperState.tsx';
@@ -23,8 +23,8 @@ export interface TableProps extends ComponentPropsWithoutRef<"table"> {
23
23
  * as the `visuallyHiddenCaption` property is automatically set with the value
24
24
  * of the `Label`'s `children`.
25
25
  *
26
- * **NOTE**: The visible caption is rendered as a `<div>` because of the
27
- * difficulty in styling a `<caption>` element.
26
+ * > **Note:** The visible caption is rendered as a `<div>` because of the
27
+ * > difficulty in styling a `<caption>` element.
28
28
  */
29
29
  caption?: ReactNode;
30
30
  /**
@@ -40,7 +40,7 @@ export interface TableColumnProps extends Omit<ComponentPropsWithoutRef<typeof T
40
40
  * Direction to initially sort the column by when first clicking on the sort
41
41
  * button.
42
42
  *
43
- * @default asc
43
+ * @default "asc"
44
44
  */
45
45
  defaultSortDirection?: SortDirection;
46
46
  /**
@@ -1,14 +1,19 @@
1
1
  import { Tabs as TabsPrimitive } from 'radix-ui';
2
2
  import { ComponentPropsWithoutRef, ComponentPropsWithRef } from 'react';
3
3
  import { ControlStatus } from '../../utils/control.ts';
4
+ import { Tooltip } from '../Tooltip';
4
5
  /** Properties of the tab component. */
5
6
  export interface TabProps extends Omit<ComponentPropsWithoutRef<typeof TabsPrimitive.TabsTrigger>, "asChild" | "value"> {
6
7
  /** Value representing this tab. */
7
8
  value: string | number;
8
9
  /** Status of the tab. */
9
10
  status?: ControlStatus;
11
+ /** Properties to pass to the tooltip component when the tab text overflows. */
12
+ tooltipProps?: Omit<ComponentPropsWithRef<typeof Tooltip>, "content">;
10
13
  /** Properties to pass to the inner tab element. */
11
- tabInnerProps?: ComponentPropsWithRef<"div">;
14
+ tabInnerProps?: ComponentPropsWithRef<"span">;
15
+ /** Properties to pass to the text of the tab element. */
16
+ tabTextProps?: ComponentPropsWithRef<"span">;
12
17
  }
13
18
  /** Tab trigger component. */
14
19
  export declare const Tab: import('react').ForwardRefExoticComponent<TabProps & import('react').RefAttributes<HTMLButtonElement>>;
@@ -7,7 +7,7 @@ export interface TabsProps extends Omit<ComponentPropsWithoutRef<typeof TabsPrim
7
7
  /**
8
8
  * Tabs variant.
9
9
  *
10
- * @default default
10
+ * @default "default"
11
11
  */
12
12
  variant?: TabsVariant;
13
13
  /** Value of the default active tab. */