@ostack.tech/ui 0.15.4 → 0.16.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunks/{en-Buw2XVWt.js → en-DT1KWQei.js} +2 -2
- package/dist/chunks/{en-Buw2XVWt.js.map → en-DT1KWQei.js.map} +1 -1
- package/dist/locales/en-GB.js +1 -1
- package/dist/locales/en-US.js +1 -1
- package/dist/locales/fr-FR.js +1 -1
- package/dist/locales/fr-FR.js.map +1 -1
- package/dist/locales/pt-PT.js +1 -1
- package/dist/locales/pt-PT.js.map +1 -1
- package/dist/ostack-ui.css +128 -85
- package/dist/ostack-ui.js +2205 -1817
- package/dist/ostack-ui.js.map +1 -1
- package/package.json +5 -4
- package/scss/_utils.scss +0 -2
- package/scss/components/Checkbox/_Checkbox-variables.scss +7 -4
- package/scss/components/Checkbox/_Checkbox.scss +34 -9
- package/scss/components/CheckboxGroup/_CheckboxGroup.scss +9 -0
- package/scss/components/Code/_Code-variables.scss +8 -4
- package/scss/components/DateRangeInput/_DateRangeInput.scss +1 -1
- package/scss/components/Feedback/_Feedback-variables.scss +28 -1
- package/scss/components/Feedback/_Feedback.scss +95 -2
- package/scss/components/Field/_Field-variables.scss +0 -1
- package/scss/components/Field/_Field.scss +4 -40
- package/scss/components/HelperText/_HelperText-variables.scss +7 -0
- package/scss/components/HelperText/_HelperText.scss +9 -0
- package/scss/components/RadioGroup/_Radio.scss +13 -0
- package/scss/components/RadioGroup/_RadioGroup.scss +9 -0
- package/scss/components/Select/_Select.scss +2 -2
- package/scss/index.scss +0 -2
- package/scss/scss/placeholders/button/_button.scss +10 -6
- package/scss/scss/placeholders/checkable/_checkable-variables.scss +3 -2
- package/scss/scss/placeholders/checkable/_checkable.scss +25 -7
- package/scss/scss/placeholders/checkable-group/_checkable-group-variables.scss +1 -0
- package/scss/scss/placeholders/checkable-group/_checkable-group.scss +15 -3
- package/scss/scss/placeholders/popover/_popover.scss +3 -0
- package/scss/scss/utils/_breakpoints.scss +1 -1
- package/scss/scss/utils/_declare-var.scss +1 -1
- package/types/components/Alert/Alert.d.ts +12 -15
- package/types/components/Alert/AlertTitle.d.ts +2 -2
- package/types/components/AlertDialog/AlertDialog.d.ts +6 -2
- package/types/components/AlertDialog/AlertDialogAction.d.ts +3 -3
- package/types/components/AlertDialog/AlertDialogBody.d.ts +3 -5
- package/types/components/AlertDialog/AlertDialogCancel.d.ts +3 -3
- package/types/components/AlertDialog/AlertDialogContent.d.ts +6 -6
- package/types/components/AlertDialog/AlertDialogDescription.d.ts +3 -3
- package/types/components/AlertDialog/AlertDialogFooter.d.ts +3 -5
- package/types/components/AlertDialog/AlertDialogHeader.d.ts +3 -4
- package/types/components/AlertDialog/AlertDialogTitle.d.ts +4 -4
- package/types/components/AlertDialog/AlertDialogTrigger.d.ts +3 -3
- package/types/components/Button/Button.d.ts +14 -15
- package/types/components/ButtonGroup/ButtonGroup.d.ts +3 -3
- package/types/components/Calendar/Calendar.d.ts +6 -6
- package/types/components/Calendar/CalendarDay.d.ts +1 -1
- package/types/components/Calendar/CalendarHeader.d.ts +1 -1
- package/types/components/Calendar/CalendarMonthGrid.d.ts +1 -1
- package/types/components/Card/Card.d.ts +3 -3
- package/types/components/Card/CardBody.d.ts +3 -3
- package/types/components/Card/CardFooter.d.ts +3 -3
- package/types/components/Card/CardHeader.d.ts +3 -3
- package/types/components/Card/CardTitle.d.ts +3 -3
- package/types/components/Checkbox/Checkbox.d.ts +22 -14
- package/types/components/CheckboxGroup/CheckboxGroup.d.ts +22 -12
- package/types/components/CheckboxGroup/CheckboxGroupContext.d.ts +15 -9
- package/types/components/CheckboxGroup/checkboxGroupUtils.d.ts +3 -0
- package/types/components/ClearContexts/ClearContexts.d.ts +19 -1
- package/types/components/CloseButton/CloseButton.d.ts +3 -4
- package/types/components/Code/Code.d.ts +3 -3
- package/types/components/Collapsible/Collapsible.d.ts +5 -3
- package/types/components/Collapsible/CollapsibleContent.d.ts +3 -3
- package/types/components/Collapsible/CollapsibleTrigger.d.ts +5 -5
- package/types/components/CommandMenu/CommandMenu.d.ts +18 -20
- package/types/components/CommandMenu/CommandMenuDialog.d.ts +6 -6
- package/types/components/CommandMenu/CommandMenuGroup.d.ts +3 -3
- package/types/components/CommandMenu/CommandMenuItem.d.ts +5 -3
- package/types/components/Container/Container.d.ts +3 -3
- package/types/components/Control/Control.d.ts +13 -13
- package/types/components/Control/ControlWithContainerRef.d.ts +12 -5
- package/types/components/Control/controlUtils.d.ts +24 -0
- package/types/components/ControlAddon/ControlAddon.d.ts +9 -3
- package/types/components/ControlCode/ControlCode.d.ts +3 -3
- package/types/components/DataTable/DataTable.d.ts +32 -21
- package/types/components/DataTable/DataTableBody.d.ts +4 -4
- package/types/components/DataTable/DataTableCell.d.ts +6 -4
- package/types/components/DataTable/DataTableColumn.d.ts +43 -13
- package/types/components/DataTable/DataTableColumnGroup.d.ts +31 -0
- package/types/components/DataTable/DataTableColumns.d.ts +14 -0
- package/types/components/DataTable/DataTableContent.d.ts +8 -8
- package/types/components/DataTable/DataTableContext.d.ts +8 -6
- package/types/components/DataTable/DataTableFilter.d.ts +1 -1
- package/types/components/DataTable/DataTableFoot.d.ts +6 -4
- package/types/components/DataTable/DataTableHead.d.ts +3 -4
- package/types/components/DataTable/DataTablePagination.d.ts +6 -6
- package/types/components/DataTable/DataTableRow.d.ts +3 -4
- package/types/components/DataTable/DataTableRowsPerPage.d.ts +3 -3
- package/types/components/DataTable/DataTableSelectionTrigger.d.ts +4 -4
- package/types/components/DataTable/PagedDataTablePagination.d.ts +3 -3
- package/types/components/DataTable/ScrolledDataTablePagination.d.ts +3 -3
- package/types/components/DataTable/__tests__/spliceWindow.test.d.ts +1 -0
- package/types/components/DataTable/columnUtils.d.ts +4 -3
- package/types/components/DataTable/index.d.ts +2 -0
- package/types/components/DataTable/processRows.d.ts +7 -7
- package/types/components/DataTable/sanitizeProps.d.ts +2 -2
- package/types/components/DataTable/useDataTableSelectionColumn.d.ts +2 -2
- package/types/components/DateInput/DateInput.d.ts +27 -18
- package/types/components/DateRangeInput/DateRangeInput.d.ts +37 -24
- package/types/components/DescriptionList/DescriptionList.d.ts +4 -4
- package/types/components/DescriptionList/DescriptionListItem.d.ts +4 -4
- package/types/components/Dialog/Dialog.d.ts +5 -1
- package/types/components/Dialog/DialogBody.d.ts +3 -4
- package/types/components/Dialog/DialogClose.d.ts +3 -3
- package/types/components/Dialog/DialogContent.d.ts +6 -6
- package/types/components/Dialog/DialogDescription.d.ts +3 -3
- package/types/components/Dialog/DialogFooter.d.ts +3 -4
- package/types/components/Dialog/DialogHeader.d.ts +5 -6
- package/types/components/Dialog/DialogTitle.d.ts +4 -4
- package/types/components/Dialog/DialogTrigger.d.ts +3 -3
- package/types/components/DropdownMenu/DropdownMenu.d.ts +4 -4
- package/types/components/DropdownMenu/DropdownMenuCheckboxItem.d.ts +5 -5
- package/types/components/DropdownMenu/DropdownMenuContent.d.ts +7 -7
- package/types/components/DropdownMenu/DropdownMenuGroup.d.ts +3 -3
- package/types/components/DropdownMenu/DropdownMenuItem.d.ts +4 -4
- package/types/components/DropdownMenu/DropdownMenuRadioGroup.d.ts +3 -3
- package/types/components/DropdownMenu/DropdownMenuRadioItem.d.ts +4 -4
- package/types/components/DropdownMenu/DropdownMenuSub.d.ts +4 -0
- package/types/components/DropdownMenu/DropdownMenuSubContent.d.ts +5 -5
- package/types/components/DropdownMenu/DropdownMenuSubTrigger.d.ts +3 -3
- package/types/components/DropdownMenu/DropdownMenuTrigger.d.ts +3 -3
- package/types/components/ErrorBoundary/ErrorBoundary.d.ts +9 -9
- package/types/components/Feedback/Feedback.d.ts +3 -3
- package/types/components/Feedback/FeedbackContext.d.ts +46 -0
- package/types/components/Feedback/FeedbackList.d.ts +6 -0
- package/types/components/Feedback/FeedbackListContext.d.ts +2 -0
- package/types/components/{FeedbackPopover → Feedback}/FeedbackPopover.d.ts +7 -7
- package/types/components/Feedback/FeedbackProvider.d.ts +13 -0
- package/types/components/Feedback/feedbackUtils.d.ts +19 -0
- package/types/components/Feedback/index.d.ts +4 -0
- package/types/components/Field/Field.d.ts +3 -3
- package/types/components/Field/FieldContext.d.ts +2 -70
- package/types/components/Field/fieldUtils.d.ts +7 -0
- package/types/components/Field/index.d.ts +1 -2
- package/types/components/FieldGroup/FieldGroup.d.ts +3 -3
- package/types/components/FieldGroup/FieldGroupBody.d.ts +3 -3
- package/types/components/FieldGroup/FieldGroupHeader.d.ts +4 -4
- package/types/components/FieldGroup/FieldGroupTitle.d.ts +2 -2
- package/types/components/Form/Form.d.ts +6 -6
- package/types/components/Form/FormContext.d.ts +1 -1
- package/types/components/Form/FormReset.d.ts +2 -2
- package/types/components/Form/FormSubmit.d.ts +2 -2
- package/types/components/Form/HiddenFormControl.d.ts +2 -2
- package/types/components/Form/useRegisterFormControl.d.ts +1 -1
- package/types/components/Grid/Grid.d.ts +4 -4
- package/types/components/Grid/GridContext.d.ts +10 -0
- package/types/components/Heading/Heading.d.ts +2 -2
- package/types/components/HelperText/HelperText.d.ts +3 -3
- package/types/components/HelperText/HelperTextContext.d.ts +38 -0
- package/types/components/HelperText/HelperTextProvider.d.ts +13 -0
- package/types/components/HelperText/helperTextUtils.d.ts +2 -0
- package/types/components/HelperText/index.d.ts +2 -0
- package/types/components/Icon/Icon.d.ts +3 -3
- package/types/components/IconButton/IconButton.d.ts +17 -17
- package/types/components/Input/Input.d.ts +1 -1
- package/types/components/Keybinds/Keybinds.d.ts +8 -3
- package/types/components/Keyboard/Keyboard.d.ts +3 -3
- package/types/components/Label/Label.d.ts +14 -14
- package/types/components/Label/LabelContext.d.ts +45 -0
- package/types/components/Label/LabelProvider.d.ts +13 -0
- package/types/components/Label/index.d.ts +2 -0
- package/types/components/Label/labelUtils.d.ts +23 -0
- package/types/components/Layer/Layer.d.ts +5 -5
- package/types/components/Link/Link.d.ts +4 -5
- package/types/components/Mark/Mark.d.ts +3 -3
- package/types/components/MenuList/MenuList.d.ts +3 -3
- package/types/components/MenuList/MenuListGroup.d.ts +5 -5
- package/types/components/MenuList/MenuListItem.d.ts +13 -14
- package/types/components/NumericInput/NumericInput.d.ts +5 -5
- package/types/components/NumericInput/numericInputUtils.d.ts +2 -2
- package/types/components/Output/Output.d.ts +2 -2
- package/types/components/Overlay/Overlay.d.ts +3 -3
- package/types/components/Popover/Popover.d.ts +4 -0
- package/types/components/Popover/PopoverAnchor.d.ts +4 -0
- package/types/components/Popover/PopoverClose.d.ts +5 -5
- package/types/components/Popover/PopoverContent.d.ts +5 -5
- package/types/components/Popover/PopoverTrigger.d.ts +3 -3
- package/types/components/Portal/Portal.d.ts +3 -3
- package/types/components/Printer/Printer.d.ts +1 -1
- package/types/components/Printer/PrinterContent.d.ts +5 -5
- package/types/components/Printer/PrinterTrigger.d.ts +4 -4
- package/types/components/RadioGroup/Radio.d.ts +23 -13
- package/types/components/RadioGroup/RadioGroup.d.ts +19 -16
- package/types/components/Root/Root.d.ts +9 -9
- package/types/components/Root/RootElement.d.ts +3 -3
- package/types/components/Select/Option.d.ts +3 -4
- package/types/components/Select/OptionsGroup.d.ts +3 -4
- package/types/components/Select/Select.d.ts +17 -13
- package/types/components/Select/SelectContext.d.ts +6 -12
- package/types/components/Select/SelectNative.d.ts +3 -3
- package/types/components/Select/selectUtils.d.ts +3 -0
- package/types/components/Separator/Separator.d.ts +3 -3
- package/types/components/Slot/Slot.d.ts +5 -0
- package/types/components/Slot/Slottable.d.ts +2 -2
- package/types/components/Spinner/Spinner.d.ts +3 -3
- package/types/components/Stack/Stack.d.ts +4 -4
- package/types/components/Stack/StackContext.d.ts +9 -0
- package/types/components/Stepper/Step.d.ts +6 -6
- package/types/components/Stepper/StepContent.d.ts +5 -5
- package/types/components/Stepper/StepList.d.ts +3 -3
- package/types/components/Stepper/Stepper.d.ts +6 -6
- package/types/components/Stepper/StepperFinishTrigger.d.ts +5 -5
- package/types/components/Stepper/StepperNextTrigger.d.ts +5 -5
- package/types/components/Stepper/StepperPreviousTrigger.d.ts +5 -5
- package/types/components/Table/Table.d.ts +15 -10
- package/types/components/Table/TableBody.d.ts +3 -3
- package/types/components/Table/TableCell.d.ts +3 -3
- package/types/components/Table/TableColumn.d.ts +29 -21
- package/types/components/Table/TableColumnGroup.d.ts +38 -0
- package/types/components/Table/TableContext.d.ts +1 -1
- package/types/components/Table/TableFoot.d.ts +3 -3
- package/types/components/Table/TableHead.d.ts +15 -7
- package/types/components/Table/TableRow.d.ts +3 -3
- package/types/components/Table/columnUtils.d.ts +11 -17
- package/types/components/Table/index.d.ts +1 -0
- package/types/components/Tabs/Tab.d.ts +7 -7
- package/types/components/Tabs/TabContent.d.ts +4 -4
- package/types/components/Tabs/TabList.d.ts +8 -8
- package/types/components/Tabs/Tabs.d.ts +8 -6
- package/types/components/Tag/Badge.d.ts +2 -2
- package/types/components/Tag/Tag.d.ts +10 -10
- package/types/components/TextArea/TextArea.d.ts +2 -2
- package/types/components/Toast/Toast.d.ts +13 -13
- package/types/components/Toast/ToastDescription.d.ts +4 -0
- package/types/components/Toast/ToastProvider.d.ts +2 -2
- package/types/components/Toast/ToastTitle.d.ts +3 -3
- package/types/components/Toast/ToastViewport.d.ts +3 -3
- package/types/components/Tooltip/Tooltip.d.ts +5 -5
- package/types/components/Tooltip/TooltipProvider.d.ts +4 -0
- package/types/components/VisuallyHidden/VisuallyHidden.d.ts +2 -2
- package/types/index.d.ts +1 -2
- package/types/providers/AlertDialogProvider/AlertDialogProviderContext.d.ts +12 -12
- package/types/providers/ErrorReportingProvider/ErrorReportingProvider.d.ts +1 -1
- package/types/providers/LocalizationProvider/LocalizationObject.d.ts +2 -3
- package/types/providers/ToastManagerProvider/ToastManagerContext.d.ts +6 -6
- package/types/utils/__tests__/combineEventHandlers.test.d.ts +1 -0
- package/types/utils/__tests__/cx.test.d.ts +1 -0
- package/types/utils/__tests__/numericStringUtils.test.d.ts +1 -0
- package/types/utils/__tests__/useNumericTrasformer.test.d.ts +1 -0
- package/types/utils/documentTitleUtils.d.ts +4 -0
- package/types/utils/filtering.d.ts +1 -1
- package/types/utils/parseChildren.d.ts +64 -0
- package/types/utils/polymorphicTypes.d.ts +2 -13
- package/types/utils/sorting.d.ts +2 -2
- package/types/utils/useLocation.d.ts +3 -3
- package/types/utils/useNumericTransformer.d.ts +9 -6
- package/scss/components/FeedbackList/_FeedbackList-variables.scss +0 -6
- package/scss/components/FeedbackList/_FeedbackList.scss +0 -32
- package/scss/components/FeedbackPopover/_FeedbackPopover-variables.scss +0 -26
- package/scss/components/FeedbackPopover/_FeedbackPopover.scss +0 -66
- package/types/components/FeedbackList/FeedbackList.d.ts +0 -6
- package/types/components/FeedbackList/FeedbackListContext.d.ts +0 -4
- package/types/components/FeedbackList/index.d.ts +0 -2
- package/types/components/FeedbackPopover/index.d.ts +0 -2
- package/types/components/Field/FieldProvider.d.ts +0 -13
- /package/types/components/{FeedbackPopover → Feedback}/FeedbackPopoverContext.d.ts +0 -0
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { DropdownMenu as DropdownMenuPrimitive } from "radix-ui";
|
|
2
|
-
import {
|
|
2
|
+
import type { ComponentProps } from "react";
|
|
3
3
|
import { type MenuListItemProps } from "../MenuList";
|
|
4
4
|
/** Properties of the dropdown menu submenu trigger. */
|
|
5
|
-
export interface DropdownMenuSubTriggerProps extends Omit<
|
|
5
|
+
export interface DropdownMenuSubTriggerProps extends Omit<ComponentProps<typeof DropdownMenuPrimitive.SubTrigger>, "asChild" | "color">, Pick<MenuListItemProps, "color" | "icon" | "disabled" | "actionProps" | "contentProps" | "iconProps"> {
|
|
6
6
|
}
|
|
7
7
|
/**
|
|
8
8
|
* A dropdown menu item that opens a submenu. Must be rendered within a
|
|
9
9
|
* `DropdownMenuSub`.
|
|
10
10
|
*/
|
|
11
|
-
export declare
|
|
11
|
+
export declare function DropdownMenuSubTrigger({ color, icon, disabled, actionProps, contentProps, iconProps, className, ...otherProps }: DropdownMenuSubTriggerProps): import("react").JSX.Element;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { DropdownMenu as DropdownMenuPrimitive } from "radix-ui";
|
|
2
|
-
import {
|
|
2
|
+
import type { ComponentProps } from "react";
|
|
3
3
|
/** Properties of the dropdown menu trigger component. */
|
|
4
|
-
export interface DropdownMenuTriggerProps extends Omit<
|
|
4
|
+
export interface DropdownMenuTriggerProps extends Omit<ComponentProps<typeof DropdownMenuPrimitive.Trigger>, "asChild"> {
|
|
5
5
|
}
|
|
6
6
|
/** Trigger component for the dropdown menu. */
|
|
7
|
-
export declare
|
|
7
|
+
export declare function DropdownMenuTrigger(props: DropdownMenuTriggerProps): import("react").JSX.Element;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { type
|
|
1
|
+
import { type ComponentProps, type ComponentType, type ReactNode } from "react";
|
|
2
2
|
import { ErrorBoundary as ReactErrorBoundary } from "react-error-boundary";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
3
|
+
import { type AlertProps } from "../Alert";
|
|
4
|
+
import { type IconButtonProps } from "../IconButton";
|
|
5
5
|
/** Properties provided to the fallback element. */
|
|
6
|
-
export interface
|
|
6
|
+
export interface ErrorBoundaryFallbackProps {
|
|
7
7
|
/** Error that occurred. */
|
|
8
8
|
error: unknown;
|
|
9
9
|
/**
|
|
@@ -14,7 +14,7 @@ export interface FallbackProps {
|
|
|
14
14
|
resetErrorBoundary: (...args: unknown[]) => void;
|
|
15
15
|
}
|
|
16
16
|
/** Properties of the error boundary component. */
|
|
17
|
-
export interface ErrorBoundaryProps extends Pick<
|
|
17
|
+
export interface ErrorBoundaryProps extends Pick<ComponentProps<typeof ReactErrorBoundary>, "resetKeys" | "onError" | "onReset"> {
|
|
18
18
|
/**
|
|
19
19
|
* Fallback component to render in the event of an error while rendering
|
|
20
20
|
* `children`.
|
|
@@ -26,7 +26,7 @@ export interface ErrorBoundaryProps extends Pick<ComponentPropsWithoutRef<typeof
|
|
|
26
26
|
* By default, a “danger” `Alert` is displayed with a message (specified via
|
|
27
27
|
* `fallbackMessage`) or the error that occurred when `showError` is set.
|
|
28
28
|
*/
|
|
29
|
-
fallback?: ReactNode | ComponentType<
|
|
29
|
+
fallback?: ReactNode | ComponentType<ErrorBoundaryFallbackProps> | ((props: ErrorBoundaryFallbackProps) => ReactNode);
|
|
30
30
|
/**
|
|
31
31
|
* Whether to show the error that occurred in the default fallback `Alert`.
|
|
32
32
|
*
|
|
@@ -63,12 +63,12 @@ export interface ErrorBoundaryProps extends Pick<ComponentPropsWithoutRef<typeof
|
|
|
63
63
|
*/
|
|
64
64
|
resetButtonLabel?: ReactNode;
|
|
65
65
|
/** Properties to pass to the default fallback `Alert` component. */
|
|
66
|
-
fallbackProps?:
|
|
66
|
+
fallbackProps?: AlertProps;
|
|
67
67
|
/**
|
|
68
68
|
* Properties to pass to the `IconButton` component used to reset the error
|
|
69
69
|
* boundary.
|
|
70
70
|
*/
|
|
71
|
-
resetButtonProps?:
|
|
71
|
+
resetButtonProps?: IconButtonProps;
|
|
72
72
|
children?: ReactNode;
|
|
73
73
|
}
|
|
74
74
|
/**
|
|
@@ -94,4 +94,4 @@ export interface ErrorBoundaryProps extends Pick<ComponentPropsWithoutRef<typeof
|
|
|
94
94
|
* }
|
|
95
95
|
* ```
|
|
96
96
|
*/
|
|
97
|
-
export declare
|
|
97
|
+
export declare function ErrorBoundary({ fallback, showError, showResetButton, fallbackTitle, fallbackMessage, onError, resetButtonLabel, fallbackProps, resetButtonProps, ...otherProps }: ErrorBoundaryProps): import("react").JSX.Element;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { ComponentProps, ReactNode } from "react";
|
|
2
2
|
/** Possible types of feedback. */
|
|
3
3
|
export type FeedbackType = "success" | "error" | "warning";
|
|
4
4
|
/** Properties of the feedback component. */
|
|
5
|
-
export type FeedbackProps =
|
|
5
|
+
export type FeedbackProps = ComponentProps<"div" | "li"> & {
|
|
6
6
|
/**
|
|
7
7
|
* Change the component to the HTML tag or custom component of the only child.
|
|
8
8
|
* This will merge the original component props with the props of the supplied
|
|
@@ -18,4 +18,4 @@ export type FeedbackProps = ComponentPropsWithoutRef<"div" | "li"> & {
|
|
|
18
18
|
visuallyHiddenPrefix?: ReactNode | ((type: FeedbackType) => ReactNode);
|
|
19
19
|
};
|
|
20
20
|
/** Component used to provide some feedback to a form control. */
|
|
21
|
-
export declare
|
|
21
|
+
export declare function Feedback({ asChild, type, visuallyHiddenPrefix, id, className, children, ...otherProps }: FeedbackProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import type { ControlStatus } from "../Control";
|
|
2
|
+
/** Value of the feedback context. */
|
|
3
|
+
export type FeedbackContextValue = FeedbackStore;
|
|
4
|
+
/** State of the feedback context. */
|
|
5
|
+
export interface FeedbackState {
|
|
6
|
+
controlName?: string;
|
|
7
|
+
controlStatus?: ControlStatus;
|
|
8
|
+
controlFocused: boolean;
|
|
9
|
+
feedbackIds: string[];
|
|
10
|
+
actions: {
|
|
11
|
+
addFeedbackId: (id: string) => void;
|
|
12
|
+
removeFeedbackId: (id: string) => void;
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
/** Helper text store. */
|
|
16
|
+
export type FeedbackStore = ReturnType<typeof useCreateFeedbackContext>;
|
|
17
|
+
/** Helper text context. */
|
|
18
|
+
export declare const FeedbackContext: import("react").Context<(Omit<import("zustand").StoreApi<FeedbackState>, "subscribe"> & {
|
|
19
|
+
subscribe: {
|
|
20
|
+
(listener: (selectedState: FeedbackState, previousSelectedState: FeedbackState) => void): () => void;
|
|
21
|
+
<U>(selector: (state: FeedbackState) => U, listener: (selectedState: U, previousSelectedState: U) => void, options?: {
|
|
22
|
+
equalityFn?: ((a: U, b: U) => boolean) | undefined;
|
|
23
|
+
fireImmediately?: boolean;
|
|
24
|
+
} | undefined): () => void;
|
|
25
|
+
};
|
|
26
|
+
}) | null>;
|
|
27
|
+
/** Hook which creates the feedback context value. */
|
|
28
|
+
export declare function useCreateFeedbackContext(): Omit<import("zustand").StoreApi<FeedbackState>, "subscribe"> & {
|
|
29
|
+
subscribe: {
|
|
30
|
+
(listener: (selectedState: FeedbackState, previousSelectedState: FeedbackState) => void): () => void;
|
|
31
|
+
<U>(selector: (state: FeedbackState) => U, listener: (selectedState: U, previousSelectedState: U) => void, options?: {
|
|
32
|
+
equalityFn?: ((a: U, b: U) => boolean) | undefined;
|
|
33
|
+
fireImmediately?: boolean;
|
|
34
|
+
} | undefined): () => void;
|
|
35
|
+
};
|
|
36
|
+
};
|
|
37
|
+
/** Hook returning the feedback's context value. */
|
|
38
|
+
export declare function useFeedbackContext(): FeedbackContextValue | null;
|
|
39
|
+
/** Hook that returns access to the feedback's store. */
|
|
40
|
+
export declare function useFeedbackStore<T>(selector: (state: Partial<FeedbackState>) => T): T;
|
|
41
|
+
/** Hook exposing whether the `status` of a control. */
|
|
42
|
+
export declare function useFeedbackControlStatus(): ControlStatus | undefined;
|
|
43
|
+
/** Hook exposing the focused status of a control. */
|
|
44
|
+
export declare function useFeedbackControlFocused(): boolean | undefined;
|
|
45
|
+
/** Hook that registers a feedback and returns its identifier. */
|
|
46
|
+
export declare function useRegisterFeedback(feedbackId: string | undefined): string | undefined;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { ComponentProps } from "react";
|
|
2
|
+
/** Properties of the feedback list component. */
|
|
3
|
+
export interface FeedbackListProps extends ComponentProps<"ul"> {
|
|
4
|
+
}
|
|
5
|
+
/** Component used to provide a list of feedbacks to a form control. */
|
|
6
|
+
export declare function FeedbackList({ className, children, ...otherProps }: FeedbackListProps): import("react").JSX.Element;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { type
|
|
1
|
+
import { type ComponentProps, type ReactNode } from "react";
|
|
2
2
|
import type { IconProp } from "../Icon";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
3
|
+
import { type IconButtonProps, type IconButtonSize } from "../IconButton";
|
|
4
|
+
import { type PopoverContentProps } from "../Popover";
|
|
5
5
|
/** Properties of the feedback popover component. */
|
|
6
|
-
export interface FeedbackPopoverProps extends
|
|
6
|
+
export interface FeedbackPopoverProps extends PopoverContentProps {
|
|
7
7
|
/** Default open state of the feedback popover. */
|
|
8
8
|
defaultOpen?: boolean;
|
|
9
9
|
/** Controlled open state of the feedback popover. */
|
|
@@ -23,12 +23,12 @@ export interface FeedbackPopoverProps extends ComponentPropsWithoutRef<typeof Po
|
|
|
23
23
|
/** Label of the feedback popover button. */
|
|
24
24
|
label?: ReactNode;
|
|
25
25
|
/** Properties to pass to the element containing the button. */
|
|
26
|
-
buttonContainerProps?:
|
|
26
|
+
buttonContainerProps?: ComponentProps<"div">;
|
|
27
27
|
/** Properties to pass to the `IconButton` component. */
|
|
28
|
-
iconButtonProps?: Omit<
|
|
28
|
+
iconButtonProps?: Omit<IconButtonProps, "size" | "icon" | "label">;
|
|
29
29
|
}
|
|
30
30
|
/**
|
|
31
31
|
* Component used to provide feedback to a form control, where the feedback is
|
|
32
32
|
* displayed within a popover.
|
|
33
33
|
*/
|
|
34
|
-
export declare
|
|
34
|
+
export declare function FeedbackPopover({ defaultOpen, open: controlledOpen, onOpenChange, modal, icon, size, onOpenAutoFocus, label, buttonContainerProps, iconButtonProps, className, children, ...otherProps }: FeedbackPopoverProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
/** Properties of the feedback provider component. */
|
|
3
|
+
export interface FeedbackProviderProps {
|
|
4
|
+
children?: ReactNode;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Component providing context necessary for form controls aware of feedbacks
|
|
8
|
+
* and vice versa.
|
|
9
|
+
*
|
|
10
|
+
* The `Field` component uses this component internally. As such, it is seldom
|
|
11
|
+
* necessary to use it manually.
|
|
12
|
+
*/
|
|
13
|
+
export declare function FeedbackProvider({ children }: FeedbackProviderProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { ControlStatus } from "../Control";
|
|
2
|
+
/** Hook exposing whether a component is being rendered within a label provider. */
|
|
3
|
+
export declare function useIsInFeedbackProvider(): boolean;
|
|
4
|
+
/** Hook exposing whether a component is being rendered within a feedback list. */
|
|
5
|
+
export declare function useIsInFeedbackList(): boolean;
|
|
6
|
+
/** Hook exposing whether the `id`s of feedbacks. */
|
|
7
|
+
export declare function useFeedbackIds(): string[] | undefined;
|
|
8
|
+
/** Hook exposing whether the `name` of a control. */
|
|
9
|
+
export declare function useFeedbackControlName(): string | undefined;
|
|
10
|
+
/**
|
|
11
|
+
* Hook that registers whether a control is marked as required. Returns whether
|
|
12
|
+
* there is a feedback provider to register in.
|
|
13
|
+
*/
|
|
14
|
+
export declare function useRegisterControlInFeedbackProvider(name?: string, status?: ControlStatus): boolean;
|
|
15
|
+
/**
|
|
16
|
+
* Hook which returns a function that can be used to set the focus status of the
|
|
17
|
+
* field's control.
|
|
18
|
+
*/
|
|
19
|
+
export declare function useSetControlFocusedInFeedbackProvider(): (controlFocused: boolean) => void | undefined;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { type
|
|
1
|
+
import { type ComponentProps } from "react";
|
|
2
2
|
/** Properties of the field component. */
|
|
3
|
-
export interface FieldProps extends
|
|
3
|
+
export interface FieldProps extends ComponentProps<"div"> {
|
|
4
4
|
/**
|
|
5
5
|
* Change the component to the HTML tag or custom component of the only child.
|
|
6
6
|
* This will merge the original component props with the props of the supplied
|
|
@@ -35,4 +35,4 @@ export interface FieldProps extends ComponentPropsWithoutRef<"div"> {
|
|
|
35
35
|
* }
|
|
36
36
|
* ```
|
|
37
37
|
*/
|
|
38
|
-
export declare
|
|
38
|
+
export declare function Field({ asChild, className, ref, ...otherProps }: FieldProps): import("react").JSX.Element;
|
|
@@ -1,28 +1,8 @@
|
|
|
1
|
-
import { type ReactNode } from "react";
|
|
2
|
-
import type { ControlStatus } from "../Control";
|
|
3
1
|
/** Value of the field context. */
|
|
4
2
|
export type FieldContextValue = FieldStore;
|
|
5
3
|
/** State of the field. */
|
|
6
4
|
export interface FieldState {
|
|
7
|
-
controlName?: string;
|
|
8
|
-
controlId?: string;
|
|
9
|
-
controlTagName?: string;
|
|
10
|
-
controlFocused: boolean;
|
|
11
5
|
controlHasCode: boolean;
|
|
12
|
-
controlRequired: boolean;
|
|
13
|
-
controlStatus?: ControlStatus;
|
|
14
|
-
label?: ReactNode;
|
|
15
|
-
labelId?: string;
|
|
16
|
-
descriptionIds: string[];
|
|
17
|
-
errorMessageIds: string[];
|
|
18
|
-
actions: FieldActions;
|
|
19
|
-
}
|
|
20
|
-
/** Actions of the field. */
|
|
21
|
-
export interface FieldActions {
|
|
22
|
-
addDescriptionId: (descriptionId: string) => void;
|
|
23
|
-
removeDescriptionId: (descriptionId: string) => void;
|
|
24
|
-
addErrorMessageId: (errorMessageId: string) => void;
|
|
25
|
-
removeErrorMessageId: (errorMessageId: string) => void;
|
|
26
6
|
}
|
|
27
7
|
/** Field store. */
|
|
28
8
|
export type FieldStore = ReturnType<typeof useCreateFieldContext>;
|
|
@@ -46,53 +26,5 @@ export declare function useCreateFieldContext(): Omit<import("zustand").StoreApi
|
|
|
46
26
|
} | undefined): () => void;
|
|
47
27
|
};
|
|
48
28
|
};
|
|
49
|
-
/** Hook
|
|
50
|
-
export declare function
|
|
51
|
-
/** Hook exposing the field control's id. */
|
|
52
|
-
export declare function useFieldControlId(): string | undefined;
|
|
53
|
-
/** Hook exposing the field control's tag name. */
|
|
54
|
-
export declare function useFieldControlTagName(): string | undefined;
|
|
55
|
-
/** Hook exposing whether the field's control is focused. */
|
|
56
|
-
export declare function useFieldControlFocused(): boolean | undefined;
|
|
57
|
-
/** Hook exposing whether the field's control is required. */
|
|
58
|
-
export declare function useFieldControlRequired(): boolean | undefined;
|
|
59
|
-
/** Hook exposing the field's control status. */
|
|
60
|
-
export declare function useFieldControlStatus(): ControlStatus | undefined;
|
|
61
|
-
/** Hook exposing the `children` of the field's label. */
|
|
62
|
-
export declare function useFieldLabel(): ReactNode;
|
|
63
|
-
/** Hook exposing the field label's id. */
|
|
64
|
-
export declare function useFieldLabelId(): string | undefined;
|
|
65
|
-
/** Hook exposing the field's description ids. */
|
|
66
|
-
export declare function useFieldDescriptionIds(): string[] | undefined;
|
|
67
|
-
/** Hook exposing the field's error message ids. */
|
|
68
|
-
export declare function useFieldErrorMessageIds(): string[] | undefined;
|
|
69
|
-
/** Hook that makes a field aware of its control's information. */
|
|
70
|
-
export declare function useRegisterFieldControl(controlId: string | undefined, controlTagName: string | undefined, controlCodeId: string | undefined, controlHasCode?: boolean | undefined, controlRequired?: boolean | undefined, controlStatus?: ControlStatus | undefined): {
|
|
71
|
-
generatedId: string;
|
|
72
|
-
controlId: string;
|
|
73
|
-
codeId: string | undefined;
|
|
74
|
-
};
|
|
75
|
-
/** Hook which register's a control's name into its field. */
|
|
76
|
-
export declare function useRegisterFieldName(name: string | undefined): void;
|
|
77
|
-
/**
|
|
78
|
-
* Hook which returns a function that can be used to set the focus status of the
|
|
79
|
-
* field's control.
|
|
80
|
-
*/
|
|
81
|
-
export declare function useSetFieldControlFocused(): (controlFocused: boolean) => void | undefined;
|
|
82
|
-
/** Hook that makes the field aware of its label. */
|
|
83
|
-
export declare function useSetFieldLabel(label: ReactNode, labelId: string | undefined): string | undefined;
|
|
84
|
-
/** Options available to the {@link useOnFieldLabelChange} hook. */
|
|
85
|
-
export interface UseOnFieldLabelChangeOptions {
|
|
86
|
-
/**
|
|
87
|
-
* Whether to run the callback immediately with the current label.
|
|
88
|
-
*
|
|
89
|
-
* @default true
|
|
90
|
-
*/
|
|
91
|
-
fireImmediately?: boolean;
|
|
92
|
-
}
|
|
93
|
-
/** Hook which runs the provided callback whenever the field's label changes. */
|
|
94
|
-
export declare function useOnFieldLabelChange(cb: (label: ReactNode) => (() => void) | void, { fireImmediately }?: UseOnFieldLabelChangeOptions): void;
|
|
95
|
-
/** Hook that makes the field aware of some helper text. */
|
|
96
|
-
export declare function useSetFieldHelperText(helperTextId: string | undefined): string | undefined;
|
|
97
|
-
/** Hook that makes the field aware of some feedback. */
|
|
98
|
-
export declare function useSetFieldFeedback(feedbackId: string | undefined, isError: boolean): string | undefined;
|
|
29
|
+
/** Hook returning the field's context value. */
|
|
30
|
+
export declare function useFieldContext(): FieldContextValue | null;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/** Hook exposing whether a component is being rendered within a field. */
|
|
2
|
+
export declare function useIsInField(): boolean;
|
|
3
|
+
/**
|
|
4
|
+
* Hook that registers whether a control is marked as required. Returns whether
|
|
5
|
+
* there is a field to register in.
|
|
6
|
+
*/
|
|
7
|
+
export declare function useRegisterControlInField(hasCode: boolean): boolean;
|
|
@@ -1,3 +1,2 @@
|
|
|
1
1
|
export * from "./Field.tsx";
|
|
2
|
-
export
|
|
3
|
-
export * from "./FieldProvider.tsx";
|
|
2
|
+
export * from "./fieldUtils.ts";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { type
|
|
1
|
+
import { type ComponentProps } from "react";
|
|
2
2
|
/** Properties of the field group component. */
|
|
3
|
-
export interface FieldGroupProps extends
|
|
3
|
+
export interface FieldGroupProps extends ComponentProps<"div"> {
|
|
4
4
|
/**
|
|
5
5
|
* Change the component to the HTML tag or custom component of the only child.
|
|
6
6
|
* This will merge the original component props with the props of the supplied
|
|
@@ -55,4 +55,4 @@ export interface FieldGroupProps extends ComponentPropsWithoutRef<"div"> {
|
|
|
55
55
|
* }
|
|
56
56
|
* ```
|
|
57
57
|
*/
|
|
58
|
-
export declare
|
|
58
|
+
export declare function FieldGroup({ asChild, className, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, ...otherProps }: FieldGroupProps): import("react").JSX.Element;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { ComponentProps } from "react";
|
|
2
2
|
/** Properties of the field group body component. */
|
|
3
|
-
export interface FieldGroupBodyProps extends
|
|
3
|
+
export interface FieldGroupBodyProps extends ComponentProps<"div"> {
|
|
4
4
|
/**
|
|
5
5
|
* Change the component to the HTML tag or custom component of the only child.
|
|
6
6
|
* This will merge the original component props with the props of the supplied
|
|
@@ -9,4 +9,4 @@ export interface FieldGroupBodyProps extends ComponentPropsWithoutRef<"div"> {
|
|
|
9
9
|
asChild?: boolean;
|
|
10
10
|
}
|
|
11
11
|
/** Component used to display the body of a field group. */
|
|
12
|
-
export declare
|
|
12
|
+
export declare function FieldGroupBody({ asChild, className, ...otherProps }: FieldGroupBodyProps): import("react").JSX.Element;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { type
|
|
1
|
+
import { type ComponentProps, type ReactNode } from "react";
|
|
2
2
|
/** Properties of the field group header component. */
|
|
3
|
-
export interface FieldGroupHeaderProps extends
|
|
3
|
+
export interface FieldGroupHeaderProps extends ComponentProps<"div"> {
|
|
4
4
|
/**
|
|
5
5
|
* Change the component to the HTML tag or custom component of the only child.
|
|
6
6
|
* This will merge the original component props with the props of the supplied
|
|
@@ -12,7 +12,7 @@ export interface FieldGroupHeaderProps extends ComponentPropsWithoutRef<"div"> {
|
|
|
12
12
|
/** Text prefixed to the code to be announced by assistive technologies. */
|
|
13
13
|
visuallyHiddenCodePrefix?: ReactNode;
|
|
14
14
|
/** Properties to pass to the code element. */
|
|
15
|
-
codeProps?:
|
|
15
|
+
codeProps?: ComponentProps<"span">;
|
|
16
16
|
}
|
|
17
17
|
/** Component used to display the header of a field group. */
|
|
18
|
-
export declare
|
|
18
|
+
export declare function FieldGroupHeader({ asChild, code, visuallyHiddenCodePrefix, codeProps, className, children, ...otherProps }: FieldGroupHeaderProps): import("react").JSX.Element;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { PolymorphicProps } from "../../utils/polymorphicTypes.ts";
|
|
2
2
|
/** Element a field group title can be rendered as. */
|
|
3
3
|
export type FieldGroupTitleAs = "div" | "span" | "label" | "h2" | "h3" | "h4" | "h5" | "h6";
|
|
4
4
|
/** Properties of the field group title component. */
|
|
@@ -13,4 +13,4 @@ export interface FieldGroupTitleOwnProps {
|
|
|
13
13
|
asChild?: boolean;
|
|
14
14
|
}
|
|
15
15
|
/** Component used to display the caption of a field group. */
|
|
16
|
-
export declare
|
|
16
|
+
export declare function FieldGroupTitle<TAs extends FieldGroupTitleAs = "div">({ as, asChild, id, className, ...otherProps }: FieldGroupTitleProps<TAs>): import("react").JSX.Element;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type
|
|
1
|
+
import { type ComponentProps, type ReactNode, type Ref, type SubmitEvent } from "react";
|
|
2
2
|
/** Form values. */
|
|
3
3
|
export type FormValues = Record<string, any>;
|
|
4
4
|
/** Validation mode of the form. */
|
|
@@ -12,7 +12,7 @@ export type FormNativeErrorMessages = Partial<Record<FormNativeErrorCode, ReactN
|
|
|
12
12
|
/** Validation errors to set on a form. */
|
|
13
13
|
export type FormValidationErrors<T extends FormValues = any> = Partial<Record<keyof T | "", ReactNode>>;
|
|
14
14
|
/** Function used to validate a form. */
|
|
15
|
-
export type FormValidateFn<T extends FormValues = any> = (formValues: T) => ReactNode | FormValidationErrors | void |
|
|
15
|
+
export type FormValidateFn<T extends FormValues = any> = (formValues: T) => ReactNode | FormValidationErrors | void | PromiseLike<ReactNode | FormValidationErrors | void>;
|
|
16
16
|
/** Form API. */
|
|
17
17
|
export interface FormApi<T extends FormValues = any> {
|
|
18
18
|
getElement: (name?: keyof T | "") => RadioNodeList | Element | null;
|
|
@@ -30,7 +30,7 @@ export interface FormApi<T extends FormValues = any> {
|
|
|
30
30
|
focus: (name: keyof T | "") => void;
|
|
31
31
|
}
|
|
32
32
|
/** Properties of the form component. */
|
|
33
|
-
export interface FormProps<T extends FormValues = any> extends Omit<
|
|
33
|
+
export interface FormProps<T extends FormValues = any> extends Omit<ComponentProps<"form">, "noValidate" | "onSubmit"> {
|
|
34
34
|
/**
|
|
35
35
|
* Change the component to the HTML tag or custom component of the only child.
|
|
36
36
|
* This will merge the original component props with the props of the supplied
|
|
@@ -83,14 +83,14 @@ export interface FormProps<T extends FormValues = any> extends Omit<ComponentPro
|
|
|
83
83
|
confirmUnloadWhenDirty?: boolean;
|
|
84
84
|
/**
|
|
85
85
|
* Disables native validations such as `required`, `minLength`, `pattern`,
|
|
86
|
-
*
|
|
86
|
+
* etc. from affecting the form.
|
|
87
87
|
*/
|
|
88
88
|
disableNativeValidations?: boolean;
|
|
89
89
|
/**
|
|
90
90
|
* Function called when the form is submitted. The default behaviour is
|
|
91
91
|
* automatically prevented.
|
|
92
92
|
*/
|
|
93
|
-
onSubmit?: (formValues: T, formData: FormData, evt: SubmitEvent<HTMLFormElement>) => FormValidationErrors | void |
|
|
93
|
+
onSubmit?: (formValues: T, formData: FormData, evt: SubmitEvent<HTMLFormElement>) => FormValidationErrors | void | PromiseLike<FormValidationErrors | void>;
|
|
94
94
|
/** Function called whenever a value of the form changes. */
|
|
95
95
|
onValueChange?: (formValues: T) => void;
|
|
96
96
|
/** Message shown when an error occurs while submitting the form. */
|
|
@@ -152,4 +152,4 @@ export interface FormProps<T extends FormValues = any> extends Omit<ComponentPro
|
|
|
152
152
|
* }
|
|
153
153
|
* ```
|
|
154
154
|
*/
|
|
155
|
-
export declare
|
|
155
|
+
export declare function Form<T extends FormValues = any>({ asChild, validationMode, errorDisplayMode, validate, externalErrors, nativeErrorMessages, className, confirmUnloadWhenDirty, disableNativeValidations, onSubmit, onReset, onValueChange, submitErrorMessage, apiRef, ref, ...otherProps }: FormProps<T>): import("react").JSX.Element;
|
|
@@ -40,7 +40,7 @@ interface FormStoreActions<T extends FormValues = FormValues> extends FormApi<T>
|
|
|
40
40
|
setValue: (name: keyof T, value: unknown) => void;
|
|
41
41
|
queueValidate: () => void;
|
|
42
42
|
firstInvalid: () => keyof T | "" | null;
|
|
43
|
-
runFormValidate: (formValues: T) => void |
|
|
43
|
+
runFormValidate: (formValues: T) => void | PromiseLike<void>;
|
|
44
44
|
setNativeErrors: (name: keyof T, errors: FormNativeError[]) => void;
|
|
45
45
|
setValidateErrors: (name: keyof T | "", errors: ReactNode) => void;
|
|
46
46
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { type
|
|
1
|
+
import { type ComponentProps, type ReactElement } from "react";
|
|
2
2
|
/** Properties of the form reset component. */
|
|
3
|
-
export interface FormResetProps extends Omit<
|
|
3
|
+
export interface FormResetProps extends Omit<ComponentProps<"button">, "form" | "children"> {
|
|
4
4
|
children: ReactElement<HTMLButtonElement>;
|
|
5
5
|
}
|
|
6
6
|
/** Component used to wrap a button to reset the form. */
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { type
|
|
1
|
+
import { type ComponentProps, type ReactElement } from "react";
|
|
2
2
|
/** Properties of the form submit component. */
|
|
3
|
-
export interface FormSubmitProps extends Omit<
|
|
3
|
+
export interface FormSubmitProps extends Omit<ComponentProps<"button">, "form" | "children"> {
|
|
4
4
|
children: ReactElement<HTMLButtonElement>;
|
|
5
5
|
}
|
|
6
6
|
/** Component used to wrap a button to submit the form. */
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { ChangeEvent,
|
|
1
|
+
import type { ChangeEvent, ComponentProps } from "react";
|
|
2
2
|
/** Properties of the hidden native control. */
|
|
3
|
-
export type HiddenNativeControlProps<TElem extends "input" | "select" | "textarea"> =
|
|
3
|
+
export type HiddenNativeControlProps<TElem extends "input" | "select" | "textarea"> = ComponentProps<TElem> & {
|
|
4
4
|
actualElement: HTMLElement | null;
|
|
5
5
|
onChange: (evt: ChangeEvent<any>) => void;
|
|
6
6
|
};
|
|
@@ -2,7 +2,7 @@ import { type ReactNode } from "react";
|
|
|
2
2
|
import type { ControlStatus } from "../Control";
|
|
3
3
|
import type { FormValidationMode } from "./Form.tsx";
|
|
4
4
|
/** Type of function used to validate a form control. */
|
|
5
|
-
export type FormControlValidateFn<T> = (value: T, formValues: Record<string, any>) => ReactNode | void |
|
|
5
|
+
export type FormControlValidateFn<T> = (value: T, formValues: Record<string, any>) => ReactNode | void | PromiseLike<ReactNode | void>;
|
|
6
6
|
/** Result of the `useRegisterFormControl` hook. */
|
|
7
7
|
export interface UseRegisterFormControlResult<T = any> {
|
|
8
8
|
status: ControlStatus | undefined;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type
|
|
1
|
+
import { type ComponentProps } from "react";
|
|
2
2
|
import { type Responsive } from "../../utils/useResponsiveValues.ts";
|
|
3
3
|
/** Size of a column. */
|
|
4
4
|
export type GridColumnSize = number | "auto" | "content";
|
|
@@ -7,7 +7,7 @@ export type GridOffsetSize = number | "auto";
|
|
|
7
7
|
/** Properties of the grid component. */
|
|
8
8
|
export type GridProps = GridContainerProps | GridItemProps;
|
|
9
9
|
/** Base properties of the grid component. */
|
|
10
|
-
export interface GridPropsBase extends
|
|
10
|
+
export interface GridPropsBase extends ComponentProps<"div"> {
|
|
11
11
|
/**
|
|
12
12
|
* Change the component to the HTML tag or custom component of the only child.
|
|
13
13
|
* This will merge the original component props with the props of the supplied
|
|
@@ -113,7 +113,7 @@ export interface GridItemProps extends GridPropsBase {
|
|
|
113
113
|
*
|
|
114
114
|
* For one-dimensional vertical layouts or one-dimensional horizontal layouts
|
|
115
115
|
* without a fixed number of columns, you might prefer to use the [`Stack`
|
|
116
|
-
* component](
|
|
116
|
+
* component](/docs/ostack-ui-layout-stack--docs) instead.
|
|
117
117
|
*
|
|
118
118
|
* Example usage:
|
|
119
119
|
*
|
|
@@ -140,4 +140,4 @@ export interface GridItemProps extends GridPropsBase {
|
|
|
140
140
|
* }
|
|
141
141
|
* ```
|
|
142
142
|
*/
|
|
143
|
-
export declare
|
|
143
|
+
export declare function Grid({ asChild, container, columns, gap, rowGap, columnGap, xs, sm, md, lg, xl, xxl, xsOffset, smOffset, mdOffset, lgOffset, xlOffset, xxlOffset, className, style, ...otherProps }: GridProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { Responsive } from "../../utils/useResponsiveValues.ts";
|
|
2
|
+
/** Grid context value. */
|
|
3
|
+
export interface GridContextValue {
|
|
4
|
+
container: boolean;
|
|
5
|
+
columns?: Responsive<number>;
|
|
6
|
+
rowGap?: Responsive<number | string>;
|
|
7
|
+
columnGap?: Responsive<number | string>;
|
|
8
|
+
}
|
|
9
|
+
/** Grid context. */
|
|
10
|
+
export declare const GridContext: import("react").Context<GridContextValue | null>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { PolymorphicProps } from "../../utils/polymorphicTypes.ts";
|
|
2
2
|
/** Elements a heading can be rendered as. */
|
|
3
3
|
export type HeadingAs = "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | "div" | "span" | "label";
|
|
4
4
|
/** Heading levels. */
|
|
@@ -40,4 +40,4 @@ export interface HeadingOwnProps {
|
|
|
40
40
|
* }
|
|
41
41
|
* ```
|
|
42
42
|
*/
|
|
43
|
-
export declare
|
|
43
|
+
export declare function Heading<TAs extends HeadingAs = "h2">({ as, asChild, level, className, ...otherProps }: HeadingProps<TAs>): import("react").JSX.Element;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { ComponentProps } from "react";
|
|
2
2
|
/** Properties of the helper text component. */
|
|
3
|
-
export interface HelperTextProps extends
|
|
3
|
+
export interface HelperTextProps extends ComponentProps<"div"> {
|
|
4
4
|
/**
|
|
5
5
|
* Change the component to the HTML tag or custom component of the only child.
|
|
6
6
|
* This will merge the original component props with the props of the supplied
|
|
@@ -9,4 +9,4 @@ export interface HelperTextProps extends ComponentPropsWithoutRef<"div"> {
|
|
|
9
9
|
asChild?: boolean;
|
|
10
10
|
}
|
|
11
11
|
/** Component used to provide helper text to a form control. */
|
|
12
|
-
export declare
|
|
12
|
+
export declare function HelperText({ asChild, id, className, ...otherProps }: HelperTextProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/** Value of the helper text context. */
|
|
2
|
+
export type HelperTextContextValue = HelperTextStore;
|
|
3
|
+
/** State of the helper text context. */
|
|
4
|
+
export interface HelperTextState {
|
|
5
|
+
helperTextIds: string[];
|
|
6
|
+
actions: {
|
|
7
|
+
addHelperTextId: (id: string) => void;
|
|
8
|
+
removeHelperTextId: (id: string) => void;
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
/** Helper text store. */
|
|
12
|
+
export type HelperTextStore = ReturnType<typeof useCreateHelperTextContext>;
|
|
13
|
+
/** Helper text context. */
|
|
14
|
+
export declare const HelperTextContext: import("react").Context<(Omit<import("zustand").StoreApi<HelperTextState>, "subscribe"> & {
|
|
15
|
+
subscribe: {
|
|
16
|
+
(listener: (selectedState: HelperTextState, previousSelectedState: HelperTextState) => void): () => void;
|
|
17
|
+
<U>(selector: (state: HelperTextState) => U, listener: (selectedState: U, previousSelectedState: U) => void, options?: {
|
|
18
|
+
equalityFn?: ((a: U, b: U) => boolean) | undefined;
|
|
19
|
+
fireImmediately?: boolean;
|
|
20
|
+
} | undefined): () => void;
|
|
21
|
+
};
|
|
22
|
+
}) | null>;
|
|
23
|
+
/** Hook which creates the helper text context value. */
|
|
24
|
+
export declare function useCreateHelperTextContext(): Omit<import("zustand").StoreApi<HelperTextState>, "subscribe"> & {
|
|
25
|
+
subscribe: {
|
|
26
|
+
(listener: (selectedState: HelperTextState, previousSelectedState: HelperTextState) => void): () => void;
|
|
27
|
+
<U>(selector: (state: HelperTextState) => U, listener: (selectedState: U, previousSelectedState: U) => void, options?: {
|
|
28
|
+
equalityFn?: ((a: U, b: U) => boolean) | undefined;
|
|
29
|
+
fireImmediately?: boolean;
|
|
30
|
+
} | undefined): () => void;
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
/** Hook returning the helper text's context value. */
|
|
34
|
+
export declare function useHelperTextContext(): HelperTextContextValue | null;
|
|
35
|
+
/** Hook that returns access to the helper text's store. */
|
|
36
|
+
export declare function useHelperTextStore<T>(selector: (state: Partial<HelperTextState>) => T): T;
|
|
37
|
+
/** Hook that registers a helper text and returns its identifier. */
|
|
38
|
+
export declare function useRegisterHelperText(helperTextId: string | undefined): string | undefined;
|