@ostack.tech/ui 0.10.5 → 0.11.1
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/chunks/{en-DwZKZVGL.js → en-DtnihkTA.js} +20 -3
- package/dist/chunks/en-DtnihkTA.js.map +1 -0
- package/dist/locales/en-GB.js +1 -1
- package/dist/locales/en-US.js +1 -1
- package/dist/locales/fr-FR.js +19 -2
- package/dist/locales/fr-FR.js.map +1 -1
- package/dist/locales/pt-PT.js +19 -2
- package/dist/locales/pt-PT.js.map +1 -1
- package/dist/ostack-ui.css +192 -113
- package/dist/ostack-ui.js +1467 -682
- package/dist/ostack-ui.js.map +1 -1
- package/dist/types/components/Alert/Alert.d.ts +3 -3
- package/dist/types/components/AlertDialog/AlertDialog.d.ts +6 -2
- package/dist/types/components/Button/Button.d.ts +7 -7
- package/dist/types/components/Calendar/Calendar.d.ts +60 -4
- package/dist/types/components/Card/Card.d.ts +2 -2
- package/dist/types/components/Code/Code.d.ts +1 -1
- package/dist/types/components/Collapsible/Collapsible.d.ts +26 -8
- package/dist/types/components/Collapsible/CollapsibleContext.d.ts +2 -2
- package/dist/types/components/Collapsible/CollapsibleTrigger.d.ts +22 -6
- package/dist/types/components/CommandMenu/CommandMenu.d.ts +1 -1
- package/dist/types/components/Container/Container.d.ts +21 -10
- package/dist/types/components/DataTable/DataTable.d.ts +63 -29
- package/dist/types/components/DataTable/DataTableContext.d.ts +3 -1
- package/dist/types/components/DateInput/DateInput.d.ts +8 -5
- package/dist/types/components/DateRangeInput/DateRangeInput.d.ts +6 -5
- package/dist/types/components/DescriptionList/DescriptionList.d.ts +38 -0
- package/dist/types/components/DescriptionList/DescriptionListItem.d.ts +15 -0
- package/dist/types/components/DescriptionList/index.d.ts +2 -0
- package/dist/types/components/Dialog/Dialog.d.ts +1 -2
- package/dist/types/components/Dialog/DialogContent.d.ts +3 -3
- package/dist/types/components/DropdownMenu/DropdownMenu.d.ts +1 -1
- package/dist/types/components/FieldGroup/FieldGroup.d.ts +42 -14
- package/dist/types/components/Grid/Grid.d.ts +64 -11
- package/dist/types/components/Icon/Icon.d.ts +1 -1
- package/dist/types/components/IconButton/IconButton.d.ts +8 -10
- package/dist/types/components/Input/Input.d.ts +2 -3
- package/dist/types/components/Link/Link.d.ts +1 -3
- package/dist/types/components/Mark/Mark.d.ts +1 -1
- package/dist/types/components/MenuList/MenuList.d.ts +5 -0
- package/dist/types/components/MenuList/MenuListItem.d.ts +3 -3
- package/dist/types/components/NumericInput/NumericInput.d.ts +2 -2
- package/dist/types/components/Popover/Popover.d.ts +32 -19
- package/dist/types/components/Popover/PopoverClose.d.ts +10 -3
- package/dist/types/components/Printer/Printer.d.ts +4 -4
- package/dist/types/components/Printer/PrinterContentContext.d.ts +4 -4
- package/dist/types/components/Printer/PrinterContext.d.ts +2 -2
- package/dist/types/components/Root/Root.d.ts +7 -7
- package/dist/types/components/Select/Select.d.ts +6 -0
- package/dist/types/components/Select/SelectContext.d.ts +2 -1
- package/dist/types/components/Select/SelectNative.d.ts +7 -0
- package/dist/types/components/Separator/Separator.d.ts +39 -1
- package/dist/types/components/Stack/Stack.d.ts +27 -5
- package/dist/types/components/Stepper/Step.d.ts +21 -6
- package/dist/types/components/Stepper/StepContent.d.ts +13 -4
- package/dist/types/components/Stepper/StepList.d.ts +8 -3
- package/dist/types/components/Stepper/Stepper.d.ts +51 -34
- package/dist/types/components/Stepper/StepperContext.d.ts +77 -4
- package/dist/types/components/Stepper/StepperFinishTrigger.d.ts +37 -0
- package/dist/types/components/Stepper/StepperNextTrigger.d.ts +34 -0
- package/dist/types/components/Stepper/StepperPreviousTrigger.d.ts +37 -0
- package/dist/types/components/Stepper/StepperState.d.ts +8 -0
- package/dist/types/components/Stepper/index.d.ts +5 -0
- package/dist/types/components/Table/Table.d.ts +2 -2
- package/dist/types/components/Table/TableColumn.d.ts +1 -1
- package/dist/types/components/Tabs/Tab.d.ts +6 -1
- package/dist/types/components/Tabs/Tabs.d.ts +1 -1
- package/dist/types/components/Toast/Toast.d.ts +81 -15
- package/dist/types/components/Tooltip/Tooltip.d.ts +4 -0
- package/dist/types/components/VisuallyHidden/VisuallyHidden.d.ts +22 -1
- package/dist/types/index.d.ts +1 -2
- package/dist/types/providers/AlertDialogProvider/AlertDialogProviderContext.d.ts +2 -2
- package/dist/types/providers/ErrorReportingProvider/ErrorReport.d.ts +3 -3
- package/dist/types/providers/ErrorReportingProvider/ErrorReportingProvider.d.ts +2 -2
- package/dist/types/providers/LocalizationProvider/LocalizationObject.d.ts +7 -0
- package/dist/types/providers/ToastManagerProvider/ToastManagerContext.d.ts +4 -2
- package/dist/types/utils/control.d.ts +1 -1
- package/dist/types/utils/keyboardShortcut.d.ts +1 -1
- package/dist/types/utils/useSearchParam.d.ts +5 -5
- package/dist/types/utils/useSearchParams.d.ts +7 -4
- package/package.json +3 -3
- package/scss/_utils.scss +3 -0
- package/scss/components/Checkbox/_Checkbox.scss +1 -1
- package/scss/components/Collapsible/_Collapsible-variables.scss +0 -1
- package/scss/components/Collapsible/_Collapsible.scss +2 -6
- package/scss/components/Container/_Container.scss +16 -5
- package/scss/components/DataTable/_DataTable-variables.scss +8 -5
- package/scss/components/DataTable/_DataTable.scss +2 -0
- package/scss/components/DateRangeInput/_DateRangeInput.scss +6 -1
- package/scss/components/DescriptionList/_DescriptionList-variables.scss +21 -0
- package/scss/components/DescriptionList/_DescriptionList.scss +33 -0
- package/scss/components/DropdownMenu/_DropdownMenu.scss +1 -3
- package/scss/components/FeedbackList/_FeedbackList.scss +1 -0
- package/scss/components/FeedbackPopover/_FeedbackPopover-variables.scss +9 -9
- package/scss/components/FeedbackPopover/_FeedbackPopover.scss +1 -1
- package/scss/components/Field/_Field-variables.scss +9 -0
- package/scss/components/Field/_Field.scss +6 -8
- package/scss/components/Input/_Input.scss +5 -0
- package/scss/components/Label/_Label-variables.scss +1 -1
- package/scss/components/MenuList/_MenuList.scss +4 -1
- package/scss/components/RadioGroup/_Radio.scss +1 -1
- package/scss/components/Separator/_Separator-variables.scss +11 -0
- package/scss/components/Separator/_Separator.scss +13 -5
- package/scss/components/Stepper/_Stepper-variables.scss +37 -9
- package/scss/components/Stepper/_Stepper.scss +69 -22
- package/scss/components/Tabs/_Tabs-variables.scss +1 -0
- package/scss/components/Tabs/_Tabs.scss +7 -4
- package/scss/index.scss +1 -0
- package/scss/scss/placeholders/checkable/_checkable.scss +3 -3
- package/scss/scss/placeholders/control/_control.scss +1 -1
- package/scss/scss/placeholders/menu/_menu.scss +5 -16
- package/scss/scss/utils/_animation.scss +1 -1
- package/scss/scss/utils/_transition.scss +1 -1
- package/dist/chunks/en-DwZKZVGL.js.map +0 -1
- package/dist/types/components/DatePicker/DatePicker.d.ts +0 -27
- package/dist/types/components/DatePicker/index.d.ts +0 -1
- package/dist/types/components/DateRangePicker/DateRangePicker.d.ts +0 -41
- 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
|
-
/**
|
|
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
|
|
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<
|
|
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<
|
|
33
|
+
wrap?: Responsive<StackWrap>;
|
|
32
34
|
}
|
|
33
35
|
/**
|
|
34
|
-
* 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 {
|
|
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
|
|
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
|
-
/**
|
|
12
|
-
|
|
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<
|
|
32
|
+
export declare const Step: import('react').ForwardRefExoticComponent<StepProps & import('react').RefAttributes<HTMLLIElement>>;
|
|
@@ -1,9 +1,18 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { ComponentPropsWithoutRef } from 'react';
|
|
1
|
+
import { ComponentPropsWithoutRef, ComponentPropsWithRef } from 'react';
|
|
3
2
|
/** Properties of the step content component. */
|
|
4
|
-
export interface StepContentProps extends
|
|
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
|
|
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<
|
|
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<
|
|
17
|
+
export declare const StepList: import('react').ForwardRefExoticComponent<StepListProps & import('react').RefAttributes<HTMLOListElement>>;
|
|
@@ -1,7 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { ComponentPropsWithoutRef, Ref } from 'react';
|
|
2
|
+
import { StepperApi } from './StepperContext.ts';
|
|
3
3
|
/** Properties of the stepper component. */
|
|
4
|
-
export interface StepperProps extends
|
|
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
|
-
/**
|
|
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
|
-
*
|
|
31
|
+
* Display progress through a sequence of numbered steps.
|
|
39
32
|
*
|
|
40
33
|
* It composes the following subcomponents:
|
|
41
34
|
*
|
|
42
|
-
* - `StepList`:
|
|
43
|
-
*
|
|
44
|
-
* - `
|
|
45
|
-
*
|
|
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
|
-
*
|
|
48
|
-
*
|
|
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
|
-
*
|
|
51
|
-
*
|
|
52
|
-
*
|
|
53
|
-
*
|
|
54
|
-
*
|
|
55
|
-
*
|
|
56
|
-
*
|
|
57
|
-
*
|
|
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
|
-
|
|
1
|
+
import { ReactNode, RefObject } from 'react';
|
|
2
|
+
/** Value of the stepper context. */
|
|
2
3
|
export interface StepperContextValue {
|
|
3
|
-
|
|
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
|
-
|
|
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
|
-
/**
|
|
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
|
-
* **
|
|
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<"
|
|
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>>;
|