@ostack.tech/ui 1.2.0-beta.0 → 1.2.0-beta.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-DGLb7rrz.js.map +1 -1
- package/dist/locales/fr-FR.js.map +1 -1
- package/dist/locales/pt-PT.js.map +1 -1
- package/dist/ostack-ui.css +8 -16
- package/dist/ostack-ui.js +26831 -7981
- package/dist/ostack-ui.js.map +1 -1
- package/package.json +15 -13
- package/scss/components/Button/_Button.scss +4 -18
- package/scss/components/ButtonGroup/_ButtonGroup.scss +2 -6
- package/scss/components/Calendar/_Calendar-variables.scss +4 -12
- package/scss/components/Calendar/_Calendar.scss +19 -38
- package/scss/components/Card/_Card-variables.scss +4 -12
- package/scss/components/Card/_Card.scss +8 -28
- package/scss/components/Collapsible/_Collapsible.scss +2 -8
- package/scss/components/CommandMenu/_CommandMenu-variables.scss +2 -6
- package/scss/components/CommandMenu/_CommandMenu.scss +5 -13
- package/scss/components/ControlAddon/_ControlAddon-variables.scss +4 -12
- package/scss/components/ControlAddon/_ControlAddon.scss +16 -52
- package/scss/components/DataTable/_DataTable.scss +1 -2
- package/scss/components/DateRangeInput/_DateRangeInput-variables.scss +1 -3
- package/scss/components/DateRangeInput/_DateRangeInput.scss +7 -21
- package/scss/components/Dialog/_Dialog.scss +6 -19
- package/scss/components/DropdownMenu/_DropdownMenu.scss +1 -2
- package/scss/components/Feedback/_Feedback-variables.scss +1 -6
- package/scss/components/Feedback/_Feedback.scss +8 -33
- package/scss/components/FieldGroup/_FieldGroup.scss +1 -4
- package/scss/components/Grid/_Grid.scss +4 -12
- package/scss/components/HelperText/_HelperText.scss +1 -4
- package/scss/components/Input/_Input.scss +11 -32
- package/scss/components/Label/_Label.scss +2 -6
- package/scss/components/Link/_Link.scss +1 -2
- package/scss/components/MenuList/_MenuList.scss +2 -6
- package/scss/components/Overlay/_Overlay-variables.scss +1 -3
- package/scss/components/Overlay/_Overlay.scss +2 -4
- package/scss/components/Root/_Root.scss +4 -16
- package/scss/components/Select/_Select-variables.scss +4 -12
- package/scss/components/Select/_Select.scss +1 -2
- package/scss/components/Separator/_Separator.scss +2 -8
- package/scss/components/Spinner/_Spinner.scss +2 -8
- package/scss/components/Stepper/_Stepper-variables.scss +5 -15
- package/scss/components/Stepper/_Stepper.scss +2 -5
- package/scss/components/Table/_Table-variables.scss +16 -47
- package/scss/components/Table/_Table.scss +30 -112
- package/scss/components/Tabs/_Tabs-variables.scss +15 -43
- package/scss/components/Tabs/_Tabs.scss +13 -46
- package/scss/components/Tag/_Tag-variables.scss +1 -4
- package/scss/components/Tag/_Tag.scss +5 -14
- package/scss/components/Toast/_Toast.scss +3 -8
- package/scss/components/Tooltip/_Tooltip-variables.scss +1 -3
- package/scss/components/Tooltip/_Tooltip.scss +4 -12
- package/scss/scss/_base-variables.scss +6 -7
- package/scss/scss/placeholders/button/_button.scss +2 -8
- package/scss/scss/placeholders/checkable/_checkable.scss +15 -60
- package/scss/scss/placeholders/control/_control-variables.scss +3 -10
- package/scss/scss/placeholders/control/_control.scss +10 -38
- package/scss/scss/placeholders/menu/_menu-variables.scss +14 -42
- package/scss/scss/placeholders/menu/_menu.scss +22 -82
- package/scss/scss/placeholders/notification/_notification.scss +2 -4
- package/scss/scss/placeholders/popover/_popover-variables.scss +1 -3
- package/scss/scss/placeholders/popover/_popover.scss +4 -11
- package/scss/scss/utils/_breakpoints.scss +1 -4
- package/scss/scss/utils/_responsive-values.scss +2 -5
- package/scss/scss/utils/_spinner.scss +1 -2
- package/types/components/Actions/Action.d.ts +6 -6
- package/types/components/Actions/ActionGroup.d.ts +10 -14
- package/types/components/Actions/ActionMenu.d.ts +13 -17
- package/types/components/Actions/ActionSplit.d.ts +4 -4
- package/types/components/Actions/Actions.d.ts +20 -25
- package/types/components/Actions/ActionsSecondary.d.ts +1 -1
- package/types/components/Alert/Alert.d.ts +8 -9
- package/types/components/Alert/AlertTitle.d.ts +3 -3
- package/types/components/AlertDialog/AlertDialog.d.ts +16 -20
- package/types/components/AlertDialog/AlertDialogAction.d.ts +2 -2
- package/types/components/AlertDialog/AlertDialogCancel.d.ts +2 -2
- package/types/components/AlertDialog/AlertDialogContent.d.ts +2 -3
- package/types/components/AlertDialog/AlertDialogDescription.d.ts +4 -5
- package/types/components/Button/Button.d.ts +32 -39
- package/types/components/ButtonGroup/ButtonGroup.d.ts +3 -3
- package/types/components/Calendar/Calendar.d.ts +2 -3
- package/types/components/Calendar/CalendarDay.d.ts +3 -4
- package/types/components/Calendar/CalendarHeader.d.ts +2 -2
- package/types/components/Card/Card.d.ts +6 -13
- 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 +17 -29
- package/types/components/CheckboxGroup/CheckboxGroup.d.ts +24 -38
- package/types/components/CheckboxGroup/CheckboxGroupContext.d.ts +5 -6
- package/types/components/CloseButton/CloseButton.d.ts +1 -1
- package/types/components/Code/Code.d.ts +4 -5
- package/types/components/Collapsible/Collapsible.d.ts +3 -9
- package/types/components/Collapsible/CollapsibleTrigger.d.ts +1 -4
- package/types/components/CommandMenu/CommandMenu.d.ts +6 -7
- package/types/components/CommandMenu/CommandMenuDialog.d.ts +6 -10
- package/types/components/CommandMenu/CommandMenuItem.d.ts +3 -3
- package/types/components/CommandMenu/cmdk/index.d.ts +73 -112
- package/types/components/Container/Container.d.ts +17 -21
- package/types/components/Control/Control.d.ts +21 -27
- package/types/components/Control/ControlWithContainerRef.d.ts +5 -6
- package/types/components/ControlAddon/ControlAddon.d.ts +9 -13
- package/types/components/ControlCode/ControlCode.d.ts +5 -8
- package/types/components/DataTable/DataTable.d.ts +59 -90
- package/types/components/DataTable/DataTableApi.d.ts +11 -12
- package/types/components/DataTable/DataTableColumn.d.ts +18 -21
- package/types/components/DataTable/DataTableColumnGroup.d.ts +3 -4
- package/types/components/DataTable/DataTableColumns.d.ts +4 -4
- package/types/components/DataTable/DataTableContent.d.ts +2 -5
- package/types/components/DataTable/DataTableEmptyOrLoadingRows.d.ts +1 -4
- package/types/components/DataTable/DataTableFilter.d.ts +3 -3
- package/types/components/DataTable/DataTablePagination.d.ts +5 -9
- package/types/components/DataTable/DataTableRowsPerPage.d.ts +4 -5
- package/types/components/DataTable/DataTableSelectionTrigger.d.ts +5 -11
- package/types/components/DataTable/PagedDataTablePagination.d.ts +1 -1
- package/types/components/DataTable/PagedDataTableRows.d.ts +1 -1
- package/types/components/DataTable/ScrolledDataTableRows.d.ts +1 -1
- package/types/components/DataTable/index.d.ts +1 -1
- package/types/components/DataTable/{getRowKey.d.ts → keyUtils.d.ts} +2 -0
- package/types/components/DataTable/spliceWindow.d.ts +3 -4
- package/types/components/DateInput/DateInput.d.ts +21 -34
- package/types/components/DateRangeInput/DateRangeInput.d.ts +41 -70
- package/types/components/DescriptionList/DescriptionList.d.ts +5 -10
- package/types/components/Dialog/Dialog.d.ts +9 -11
- package/types/components/Dialog/DialogContent.d.ts +3 -4
- package/types/components/Dialog/DialogDescription.d.ts +2 -3
- package/types/components/DropdownMenu/DropdownMenu.d.ts +10 -21
- package/types/components/DropdownMenu/DropdownMenuCheckboxItem.d.ts +1 -1
- package/types/components/DropdownMenu/DropdownMenuItem.d.ts +3 -3
- package/types/components/DropdownMenu/DropdownMenuRadioItem.d.ts +1 -1
- package/types/components/DropdownMenu/DropdownMenuSubContent.d.ts +1 -4
- package/types/components/DropdownMenu/DropdownMenuSubTrigger.d.ts +1 -4
- package/types/components/ErrorBoundary/ErrorBoundary.d.ts +21 -27
- package/types/components/Feedback/Feedback.d.ts +6 -6
- package/types/components/Feedback/FeedbackPopover.d.ts +3 -3
- package/types/components/Feedback/FeedbackProvider.d.ts +3 -4
- package/types/components/Feedback/feedbackUtils.d.ts +5 -8
- package/types/components/Field/Field.d.ts +9 -11
- package/types/components/Field/fieldUtils.d.ts +2 -2
- package/types/components/FieldGroup/FieldGroup.d.ts +4 -5
- 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 +3 -3
- package/types/components/Form/Form.d.ts +25 -40
- package/types/components/Form/FormContext.d.ts +2 -2
- package/types/components/Form/FormError.d.ts +6 -11
- package/types/components/Form/FormState.d.ts +2 -2
- package/types/components/Form/formUtils.d.ts +1 -1
- package/types/components/Form/useRegisterFormControl.d.ts +1 -1
- package/types/components/Grid/Grid.d.ts +19 -24
- package/types/components/Heading/Heading.d.ts +9 -10
- package/types/components/HelperText/HelperText.d.ts +3 -3
- package/types/components/HelperText/HelperTextProvider.d.ts +3 -4
- package/types/components/Icon/Icon.d.ts +9 -16
- package/types/components/IconButton/IconButton.d.ts +35 -53
- package/types/components/Input/Input.d.ts +5 -12
- package/types/components/Keybinds/KeyPress.d.ts +1 -1
- package/types/components/Keybinds/Keybind.d.ts +1 -1
- package/types/components/Keybinds/Keybinds.d.ts +3 -9
- package/types/components/Keyboard/Keyboard.d.ts +7 -8
- package/types/components/Label/Label.d.ts +5 -6
- package/types/components/Label/LabelProvider.d.ts +3 -4
- package/types/components/Label/labelUtils.d.ts +2 -2
- package/types/components/Layer/Layer.d.ts +4 -4
- package/types/components/Link/Link.d.ts +13 -13
- package/types/components/Mark/Mark.d.ts +6 -7
- package/types/components/MenuList/MenuList.d.ts +6 -7
- package/types/components/MenuList/MenuListGroup.d.ts +5 -6
- package/types/components/MenuList/MenuListItem.d.ts +21 -25
- package/types/components/NumericInput/NumericInput.d.ts +20 -34
- package/types/components/NumericInput/numericInputUtils.d.ts +4 -5
- package/types/components/Output/Output.d.ts +12 -13
- package/types/components/Popover/Popover.d.ts +6 -13
- package/types/components/Popover/PopoverAnchor.d.ts +2 -2
- package/types/components/Popover/PopoverTrigger.d.ts +2 -2
- package/types/components/Portal/Portal.d.ts +3 -4
- package/types/components/Printer/Printer.d.ts +40 -54
- package/types/components/Printer/PrinterContent.d.ts +6 -6
- package/types/components/Printer/PrinterContentContext.d.ts +4 -5
- package/types/components/Printer/PrinterContext.d.ts +4 -4
- package/types/components/Printer/PrinterTrigger.d.ts +5 -6
- package/types/components/Printer/index.d.ts +1 -1
- package/types/components/RadioGroup/Radio.d.ts +10 -13
- package/types/components/RadioGroup/RadioGroup.d.ts +21 -34
- package/types/components/Root/Root.d.ts +21 -27
- package/types/components/Root/RootContext.d.ts +1 -4
- package/types/components/Select/Option.d.ts +3 -3
- package/types/components/Select/Select.d.ts +14 -26
- package/types/components/Select/SelectNative.d.ts +1 -1
- package/types/components/Separator/Separator.d.ts +3 -4
- package/types/components/Slot/Slottable.d.ts +1 -4
- package/types/components/Spinner/Spinner.d.ts +5 -12
- package/types/components/Stack/Stack.d.ts +9 -13
- package/types/components/Stepper/Step.d.ts +6 -6
- package/types/components/Stepper/StepContent.d.ts +3 -3
- package/types/components/Stepper/StepList.d.ts +4 -5
- package/types/components/Stepper/Stepper.d.ts +4 -5
- package/types/components/Stepper/StepperFinishTrigger.d.ts +3 -9
- package/types/components/Stepper/StepperNextTrigger.d.ts +3 -6
- package/types/components/Stepper/StepperPreviousTrigger.d.ts +4 -10
- package/types/components/Table/Table.d.ts +42 -58
- package/types/components/Table/TableCell.d.ts +15 -19
- package/types/components/Table/TableColumn.d.ts +15 -27
- package/types/components/Table/TableColumnGroup.d.ts +2 -3
- package/types/components/Table/TableHead.d.ts +5 -5
- package/types/components/Tabs/TabContent.d.ts +2 -2
- package/types/components/Tabs/TabList.d.ts +1 -1
- package/types/components/Tabs/Tabs.d.ts +4 -8
- package/types/components/Tag/Tag.d.ts +8 -8
- package/types/components/TextArea/TextArea.d.ts +7 -13
- package/types/components/Toast/Toast.d.ts +25 -38
- package/types/components/Toast/ToastProvider.d.ts +2 -5
- package/types/components/Toast/ToastViewport.d.ts +2 -5
- package/types/components/Tooltip/Tooltip.d.ts +11 -11
- package/types/components/VisuallyHidden/VisuallyHidden.d.ts +7 -11
- package/types/index.d.ts +2 -1
- package/types/providers/AlertDialogProvider/AlertDialogProviderContext.d.ts +17 -19
- package/types/providers/AlertDialogProvider/useAlertDialog.d.ts +50 -58
- package/types/providers/DocumentTitleProvider/DocumentTitle.d.ts +1 -4
- package/types/providers/ErrorReportingProvider/ErrorReport.d.ts +4 -7
- package/types/providers/ErrorReportingProvider/ErrorReportingProvider.d.ts +12 -17
- package/types/providers/LocalizationProvider/useLocale.d.ts +1 -4
- package/types/providers/PrefixProvider/defaultPrefix.d.ts +2 -3
- package/types/providers/PrefixProvider/usePrefix.d.ts +3 -6
- package/types/providers/ToastManagerProvider/ToastManagerContext.d.ts +3 -3
- package/types/providers/ToastManagerProvider/useToastManager.d.ts +11 -14
- package/types/utils/__tests__/useCombinedRef.test.d.ts +1 -0
- package/types/utils/breakpoints.d.ts +5 -6
- package/types/utils/combineAriaIds.d.ts +1 -1
- package/types/utils/cx.d.ts +2 -5
- package/types/utils/filtering.d.ts +2 -2
- package/types/utils/keyboardShortcut.d.ts +18 -25
- package/types/utils/navigate.d.ts +2 -2
- package/types/utils/numericStringUtils.d.ts +6 -13
- package/types/utils/parseChildren.d.ts +5 -9
- package/types/utils/reactCompilerUtils.d.ts +7 -0
- package/types/utils/setNativeProperty.d.ts +2 -3
- package/types/utils/sorting.d.ts +2 -2
- package/types/utils/useCombinedEventHandler.d.ts +30 -0
- package/types/utils/useCombinedRef.d.ts +6 -4
- package/types/utils/useCssVars.d.ts +9 -20
- package/types/utils/useDateTransformer.d.ts +4 -8
- package/types/utils/useIntersectionObserver.d.ts +2 -5
- package/types/utils/useLatestRef.d.ts +1 -2
- package/types/utils/useLocation.d.ts +5 -8
- package/types/utils/useMeasure.d.ts +2 -5
- package/types/utils/useMediaQuery.d.ts +1 -4
- package/types/utils/useNumericTransformer.d.ts +12 -19
- package/types/utils/usePrevious.d.ts +3 -4
- package/types/utils/useResponsiveValues.d.ts +7 -10
- package/types/utils/useScrollPosition.d.ts +1 -6
- package/types/utils/useSearchParam.d.ts +2 -6
- package/types/utils/useSearchParams.d.ts +1 -4
- package/types/utils/useSpacing.d.ts +1 -4
- package/types/utils/zustandUtils.d.ts +3 -2
- package/types/utils/combineEventHandlers.d.ts +0 -24
- /package/types/utils/__tests__/{combineEventHandlers.test.d.ts → useCombinedEventHandler.test.d.ts} +0 -0
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/** Combines `aria` identifiers for usage in, for example, `aria-describedby`. */
|
|
2
|
-
export declare function combineAriaIds(
|
|
2
|
+
export declare function combineAriaIds(args: unknown[]): string | undefined;
|
package/types/utils/cx.d.ts
CHANGED
|
@@ -2,11 +2,8 @@
|
|
|
2
2
|
* Utility function used to join class names together.
|
|
3
3
|
*
|
|
4
4
|
* @example
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
* cx("foo", "bar", [false, "baz"]); // "foo bar baz"
|
|
8
|
-
* cx({ foo: true, bar: false }, "baz"); // "foo baz"
|
|
9
|
-
* ```
|
|
5
|
+
* cx("foo", "bar", [false, "baz"]); // "foo bar baz"
|
|
6
|
+
* cx({ foo: true, bar: false }, "baz"); // "foo baz"
|
|
10
7
|
*
|
|
11
8
|
* @param args Class arguments to join.
|
|
12
9
|
* @returns Joined class names.
|
|
@@ -8,7 +8,7 @@ export interface MatchAgainstFilter {
|
|
|
8
8
|
after: string;
|
|
9
9
|
}
|
|
10
10
|
/**
|
|
11
|
-
* Matches a string value against a filter and returns the match or `null` when
|
|
12
|
-
*
|
|
11
|
+
* Matches a string value against a filter and returns the match or `null` when the value doesn't
|
|
12
|
+
* match.
|
|
13
13
|
*/
|
|
14
14
|
export declare function matchAgainstFilter(value: string, filter: string, locale?: Intl.LocalesArgument): MatchAgainstFilter | null;
|
|
@@ -18,8 +18,8 @@ export interface RegisterKeyboardShortcutOptions {
|
|
|
18
18
|
*/
|
|
19
19
|
eventType?: "keydown" | "keyup";
|
|
20
20
|
/**
|
|
21
|
-
* Keybinding sequences will wait this long (in milliseconds) between key
|
|
22
|
-
*
|
|
21
|
+
* Keybinding sequences will wait this long (in milliseconds) between key presses before
|
|
22
|
+
* cancelling.
|
|
23
23
|
*
|
|
24
24
|
* @default 1000
|
|
25
25
|
*/
|
|
@@ -27,13 +27,11 @@ export interface RegisterKeyboardShortcutOptions {
|
|
|
27
27
|
/**
|
|
28
28
|
* Whether the triggered shortcut should be ignored.
|
|
29
29
|
*
|
|
30
|
-
* By default, shortcuts are ignored according to
|
|
31
|
-
*
|
|
32
|
-
* through.
|
|
30
|
+
* By default, shortcuts are ignored according to {@link defaultIgnoreKeyboardShortcut}, which
|
|
31
|
+
* allows mostly all shortcuts through.
|
|
33
32
|
*
|
|
34
|
-
* To ignore shortcuts originating from editable elements
|
|
35
|
-
*
|
|
36
|
-
* {@link ignoreKeyboardShortcutInEditableElements} instead.
|
|
33
|
+
* To ignore shortcuts originating from editable elements (`[contenteditable]`, `input`,
|
|
34
|
+
* `textarea`, and `select`), you can use {@link ignoreKeyboardShortcutInEditableElements} instead.
|
|
37
35
|
*
|
|
38
36
|
* @param event Keyboard event which triggered the shortcut.
|
|
39
37
|
* @returns Whether the keyboard shortcut should be ignored.
|
|
@@ -53,17 +51,15 @@ export interface RegisterKeyboardShortcutOptions {
|
|
|
53
51
|
preventDefault?: boolean;
|
|
54
52
|
}
|
|
55
53
|
/**
|
|
56
|
-
* Function which registers an action to run when one of the provided keybinds
|
|
57
|
-
* is triggered.
|
|
54
|
+
* Function which registers an action to run when one of the provided keybinds is triggered.
|
|
58
55
|
*
|
|
59
|
-
* Built on top of the [`tinykeys`](https://jamiebuilds.github.io/tinykeys)
|
|
60
|
-
*
|
|
56
|
+
* Built on top of the [`tinykeys`](https://jamiebuilds.github.io/tinykeys) library. For more
|
|
57
|
+
* information on keybinding syntax, read the [`tinykeys`
|
|
61
58
|
* documentation](https://github.com/jamiebuilds/tinykeys).
|
|
62
59
|
*
|
|
63
60
|
* @param keybinds Keybinds which should trigger the action.
|
|
64
61
|
* @param action Action to run. Receives the keyboard event as an argument.
|
|
65
|
-
* @param options Configuration options (see
|
|
66
|
-
* {@link RegisterKeyboardShortcutOptions}).
|
|
62
|
+
* @param options Configuration options (see {@link RegisterKeyboardShortcutOptions}).
|
|
67
63
|
* @returns Function used to unregister the shortcut.
|
|
68
64
|
* @see {@link useKeyboardShortcut} for a hook version of this function.
|
|
69
65
|
*/
|
|
@@ -73,8 +69,8 @@ export interface UseKeyboardShortcutOptions extends Omit<RegisterKeyboardShortcu
|
|
|
73
69
|
/** Whether the shortcut should be disabled. */
|
|
74
70
|
disabled?: boolean;
|
|
75
71
|
/**
|
|
76
|
-
* Target element on which to listen for the keybinds. While set to `null`
|
|
77
|
-
*
|
|
72
|
+
* Target element on which to listen for the keybinds. While set to `null` keybinds will be
|
|
73
|
+
* ignored.
|
|
78
74
|
*
|
|
79
75
|
* @default window
|
|
80
76
|
*/
|
|
@@ -83,8 +79,8 @@ export interface UseKeyboardShortcutOptions extends Omit<RegisterKeyboardShortcu
|
|
|
83
79
|
/**
|
|
84
80
|
* Hook which runs an action when one of the provided keybinds is triggered.
|
|
85
81
|
*
|
|
86
|
-
* Built on top of the [`tinykeys`](https://jamiebuilds.github.io/tinykeys)
|
|
87
|
-
*
|
|
82
|
+
* Built on top of the [`tinykeys`](https://jamiebuilds.github.io/tinykeys) library. For more
|
|
83
|
+
* information on keybinding syntax, read the [`tinykeys`
|
|
88
84
|
* documentation](https://github.com/jamiebuilds/tinykeys).
|
|
89
85
|
*
|
|
90
86
|
* Example usage:
|
|
@@ -104,8 +100,7 @@ export interface UseKeyboardShortcutOptions extends Omit<RegisterKeyboardShortcu
|
|
|
104
100
|
*
|
|
105
101
|
* @param keybinds Keybinds which should trigger the action.
|
|
106
102
|
* @param action Action to run. Receives the keyboard event as an argument.
|
|
107
|
-
* @param options Configuration options (see
|
|
108
|
-
* {@link RegisterKeyboardShortcutOptions}).
|
|
103
|
+
* @param options Configuration options (see {@link RegisterKeyboardShortcutOptions}).
|
|
109
104
|
* @see {@link registerKeyboardShortcut} for a non-hook version of this
|
|
110
105
|
* function.
|
|
111
106
|
*/
|
|
@@ -113,9 +108,8 @@ export declare function useKeyboardShortcut(keybinds: KeyboardShortcutKeybinds,
|
|
|
113
108
|
/** Default function used to choose whether to ignore a keyboard shortcut. */
|
|
114
109
|
export declare function defaultIgnoreKeyboardShortcut(evt: KeyboardEvent): boolean;
|
|
115
110
|
/**
|
|
116
|
-
* Function used to ignore keyboard events from elements matching
|
|
117
|
-
* `
|
|
118
|
-
* `event.currentTarget`.
|
|
111
|
+
* Function used to ignore keyboard events from elements matching `[contenteditable]`, `input`,
|
|
112
|
+
* `textarea`, and `select`, unless they are the `event.currentTarget`.
|
|
119
113
|
*/
|
|
120
114
|
export declare const ignoreKeyboardShortcutInEditableElements: typeof defaultKeybindingsHandlerIgnore;
|
|
121
115
|
/**
|
|
@@ -128,8 +122,7 @@ export declare function normalizeKeybinds(keybinds: KeyboardShortcutKeybinds): s
|
|
|
128
122
|
/**
|
|
129
123
|
* Converts the provided `tinykeys` keybinds into an `aria-keyshortcuts` string.
|
|
130
124
|
*
|
|
131
|
-
* @param keybinds `tinykeys` keybinds to convert into `aria-keyshortcuts`
|
|
132
|
-
* string.
|
|
125
|
+
* @param keybinds `tinykeys` keybinds to convert into `aria-keyshortcuts` string.
|
|
133
126
|
* @returns `aria-keyshortcuts` string.
|
|
134
127
|
*/
|
|
135
128
|
export declare function keybindsToAriaKeyShortcuts(keybinds: KeyboardShortcutKeybinds): string | undefined;
|
|
@@ -10,7 +10,7 @@ export interface NavigationOptions {
|
|
|
10
10
|
replace?: boolean;
|
|
11
11
|
}
|
|
12
12
|
/**
|
|
13
|
-
* Function used to navigate to a new URL (small utility function around
|
|
14
|
-
* `history.
|
|
13
|
+
* Function used to navigate to a new URL (small utility function around `history.pushState` and
|
|
14
|
+
* `history.replaceState`).
|
|
15
15
|
*/
|
|
16
16
|
export declare function navigate(url: string | URL, options?: NavigationOptions): void;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Converts a numeric value to a string, removing exponential notation. Nullish
|
|
3
|
-
*
|
|
2
|
+
* Converts a numeric value to a string, removing exponential notation. Nullish or `NaN` values
|
|
3
|
+
* become the empty string.
|
|
4
4
|
*/
|
|
5
5
|
export declare function numericToString(v: string | number | bigint | null | undefined): string;
|
|
6
6
|
/** Whether a numeric string represents a negative number. */
|
|
@@ -10,18 +10,11 @@ export declare function numericStringRepresentsNull(v: string): boolean;
|
|
|
10
10
|
/** Removes leading and trailing zeros from a numeric string. */
|
|
11
11
|
export declare function normalizeNumericString(v: string): string;
|
|
12
12
|
/**
|
|
13
|
-
* Compares two numeric strings and returns a positive number if the first one
|
|
14
|
-
*
|
|
15
|
-
* zero when they're equal.
|
|
13
|
+
* Compares two numeric strings and returns a positive number if the first one is greater than the
|
|
14
|
+
* second one, a negative number if the opposite is true, or zero when they're equal.
|
|
16
15
|
*/
|
|
17
16
|
export declare function compareNumericStrings(v1: string, v2: string): number;
|
|
18
|
-
/**
|
|
19
|
-
* Transforms an integer numeric string into a float numeric string, given the
|
|
20
|
-
* scale.
|
|
21
|
-
*/
|
|
17
|
+
/** Transforms an integer numeric string into a float numeric string, given the scale. */
|
|
22
18
|
export declare function numericStringIntToFloat(v: string, scale: number): string;
|
|
23
|
-
/**
|
|
24
|
-
* Transforms a float numeric string into an integer numeric string, given the
|
|
25
|
-
* scale.
|
|
26
|
-
*/
|
|
19
|
+
/** Transforms a float numeric string into an integer numeric string, given the scale. */
|
|
27
20
|
export declare function numericStringFloatToInt(v: string, scale: number): string;
|
|
@@ -18,8 +18,8 @@ export interface ParseChildrenOptions {
|
|
|
18
18
|
*/
|
|
19
19
|
allowNestedGroups?: boolean;
|
|
20
20
|
/**
|
|
21
|
-
* Property to set on the object with the group children objects when a
|
|
22
|
-
*
|
|
21
|
+
* Property to set on the object with the group children objects when a `groupComponent` is
|
|
22
|
+
* provided.
|
|
23
23
|
*
|
|
24
24
|
* @default "children"
|
|
25
25
|
*/
|
|
@@ -30,10 +30,7 @@ export interface ParseChildrenOptions {
|
|
|
30
30
|
* @default true
|
|
31
31
|
*/
|
|
32
32
|
renderUnknownComponents?: boolean;
|
|
33
|
-
/**
|
|
34
|
-
* Components that should **not** be rendered, even if
|
|
35
|
-
* `renderUnknownComponents` is `true`.
|
|
36
|
-
*/
|
|
33
|
+
/** Components that should **not** be rendered, even if `renderUnknownComponents` is `true`. */
|
|
37
34
|
doNotRender?: FunctionComponent<any>[];
|
|
38
35
|
/** Function used to transform an object. */
|
|
39
36
|
transformObject?: (object: any) => any;
|
|
@@ -53,9 +50,8 @@ export interface ParseChildrenOptions {
|
|
|
53
50
|
/** Result type of the `parseChildren` function. */
|
|
54
51
|
export type ParseChildrenResult<_TChildType, TOptions extends ParseChildrenOptions = ParseChildrenOptions> = TOptions["toObject"] extends true ? Record<string, any> : any[];
|
|
55
52
|
/**
|
|
56
|
-
* Utility function used to parse JSX elements within a `children` property and
|
|
57
|
-
*
|
|
58
|
-
* properties.
|
|
53
|
+
* Utility function used to parse JSX elements within a `children` property and transform them into
|
|
54
|
+
* standard JS objects containing the JSX elements' properties.
|
|
59
55
|
*
|
|
60
56
|
* @param children Children property.
|
|
61
57
|
* @param childType Child type that should be transformed into an object.
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `try`/`finally` wrapper for use while the React compiler doesn't support `finally` clauses, see:
|
|
3
|
+
* https://github.com/react/react/pull/35607.
|
|
4
|
+
*/
|
|
5
|
+
export declare function withCleanup<T>(cb: () => PromiseLike<T>, cleanup: () => void | PromiseLike<void>): Promise<T>;
|
|
6
|
+
export declare function withCleanup<T>(cb: () => T, cleanup: () => PromiseLike<void>): Promise<T>;
|
|
7
|
+
export declare function withCleanup<T>(cb: () => T, cleanup: () => void): T;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Sets the native property of an HTML element in a way that bypasses React’s
|
|
3
|
-
*
|
|
4
|
-
* React will handle.
|
|
2
|
+
* Sets the native property of an HTML element in a way that bypasses React’s value tracker
|
|
3
|
+
* interference, meaning that we can then dispatch an event that React will handle.
|
|
5
4
|
*
|
|
6
5
|
* See: https://github.com/facebook/react/issues/10135
|
|
7
6
|
*/
|
package/types/utils/sorting.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ export type SortDirection = "asc" | "desc";
|
|
|
3
3
|
/** Stable sort implementation. */
|
|
4
4
|
export declare function stableSort<T>(array: T[], comparator: (v1: T, v2: T, i1: number, i2: number) => number, sortDirection?: SortDirection): T[];
|
|
5
5
|
/**
|
|
6
|
-
* Comparison function allowing comparison of values of multiple types,
|
|
7
|
-
*
|
|
6
|
+
* Comparison function allowing comparison of values of multiple types, including all primitive
|
|
7
|
+
* types, as well as dates.
|
|
8
8
|
*/
|
|
9
9
|
export declare function compare<T>(v1: T, v2: T, locale?: Intl.LocalesArgument, options?: Intl.CollatorOptions): number;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/** Generic event handler. */
|
|
2
|
+
export type EventHandler<T extends unknown[] = unknown[]> = (...args: T) => void;
|
|
3
|
+
/** Whether at least one handler is defined. */
|
|
4
|
+
type HasGuaranteedHandler<T extends readonly unknown[]> = T extends readonly [
|
|
5
|
+
infer Head,
|
|
6
|
+
...infer Tail
|
|
7
|
+
] ? undefined extends Head ? HasGuaranteedHandler<Tail> : true : false;
|
|
8
|
+
/** Extracts the combined parameter list across all defined handlers */
|
|
9
|
+
type ExtractParams<T extends readonly (EventHandler<any> | undefined)[]> = [
|
|
10
|
+
NonNullable<T[number]>
|
|
11
|
+
] extends [never] ? unknown[] : Parameters<NonNullable<T[number]>>;
|
|
12
|
+
/** Options of the {@link useCombinedEventHandler} hook. */
|
|
13
|
+
export interface UseCombinedEventHandlerOptions {
|
|
14
|
+
/**
|
|
15
|
+
* Whether to check whether an event's default behaviour has been cancelled before running
|
|
16
|
+
* subsequent handlers.
|
|
17
|
+
*
|
|
18
|
+
* @default false
|
|
19
|
+
*/
|
|
20
|
+
checkDefaultPrevented?: boolean;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Combines an array of event handlers into a single event handler.
|
|
24
|
+
*
|
|
25
|
+
* @param handlers Array of optional event handlers.
|
|
26
|
+
* @param options Options.
|
|
27
|
+
* @returns Combined handler, or `undefined` if no active handlers are provided.
|
|
28
|
+
*/
|
|
29
|
+
export declare function useCombinedEventHandler<const T extends readonly (EventHandler<any> | undefined)[]>(handlers: T, options?: UseCombinedEventHandlerOptions): HasGuaranteedHandler<T> extends true ? EventHandler<ExtractParams<T>> : EventHandler<ExtractParams<T>> | undefined;
|
|
30
|
+
export {};
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
import { type Ref
|
|
1
|
+
import { type Ref, type RefCallback } from "react";
|
|
2
|
+
type ArgRef<T> = Ref<T> | null | undefined;
|
|
2
3
|
/**
|
|
3
|
-
* Combines multiple references into a single stable callback reference while
|
|
4
|
-
*
|
|
4
|
+
* Combines multiple references into a single stable callback reference while respecting React's
|
|
5
|
+
* rules for references.
|
|
5
6
|
*
|
|
6
7
|
* @param refs References to combine.
|
|
7
8
|
* @returns Stable callback reference.
|
|
8
9
|
*/
|
|
9
|
-
export declare function useCombinedRef<T>(
|
|
10
|
+
export declare function useCombinedRef<T>(refs: ArgRef<T>[]): RefCallback<T>;
|
|
11
|
+
export {};
|
|
@@ -6,38 +6,27 @@ export interface UseCssVarsOptions {
|
|
|
6
6
|
/** Result of the {@link useCssVars} hook. */
|
|
7
7
|
export interface UseCssVarsResult {
|
|
8
8
|
/**
|
|
9
|
-
* Returns the name of a CSS variable prefixed by the component library's
|
|
10
|
-
* prefix.
|
|
9
|
+
* Returns the name of a CSS variable prefixed by the component library's prefix.
|
|
11
10
|
*
|
|
12
11
|
* @example
|
|
13
|
-
*
|
|
14
|
-
* ```ts
|
|
15
|
-
* cssVarName("color"); // returns "--[prefix]-color"
|
|
16
|
-
* ```
|
|
12
|
+
* cssVarName("color"); // returns "--[prefix]-color"
|
|
17
13
|
*/
|
|
18
14
|
cssVarName: (name: string) => string;
|
|
19
15
|
/**
|
|
20
|
-
* Returns a CSS variable with the given name, prefixed by the component
|
|
21
|
-
* library's prefix.
|
|
16
|
+
* Returns a CSS variable with the given name, prefixed by the component library's prefix.
|
|
22
17
|
*
|
|
23
18
|
* @example
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
* cssVar("color"); // returns "var(--[prefix]-color)"
|
|
27
|
-
* cssVar("size", "10px"); // returns "var(--[prefix]-size, 10px)"
|
|
28
|
-
* ```
|
|
19
|
+
* cssVar("color"); // returns "var(--[prefix]-color)"
|
|
20
|
+
* cssVar("size", "10px"); // returns "var(--[prefix]-size, 10px)"
|
|
29
21
|
*/
|
|
30
22
|
cssVar: (name: string, fallback?: unknown) => string;
|
|
31
23
|
/**
|
|
32
|
-
* Returns an object used to set a CSS variable with the given name, prefixed
|
|
33
|
-
*
|
|
24
|
+
* Returns an object used to set a CSS variable with the given name, prefixed by the component
|
|
25
|
+
* library's prefix.
|
|
34
26
|
*
|
|
35
27
|
* @example
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
* cssVarStyle("color", "red"); // returns {"--[prefix]-color": "red"}
|
|
39
|
-
* cssVarStyle("size", undefined); // returns undefined
|
|
40
|
-
* ```
|
|
28
|
+
* cssVarStyle("color", "red"); // returns {"--[prefix]-color": "red"}
|
|
29
|
+
* cssVarStyle("size", undefined); // returns undefined
|
|
41
30
|
*/
|
|
42
31
|
cssVarStyle: (name: string, value: unknown) => Record<string, string> | undefined;
|
|
43
32
|
/** Returns the name of a CSS variable to use for a CSS space toggle. */
|
|
@@ -5,10 +5,7 @@ export declare const DEFAULT_DATE_FORMAT = "yyyy-MM-dd";
|
|
|
5
5
|
export interface DateTransformerOptions {
|
|
6
6
|
/** `date-fns` locale to format dates. */
|
|
7
7
|
locale?: Locale;
|
|
8
|
-
/**
|
|
9
|
-
* Format of the date, as supported by
|
|
10
|
-
* [`date-fns`](https://date-fns.org/docs/format).
|
|
11
|
-
*/
|
|
8
|
+
/** Format of the date, as supported by [`date-fns`](https://date-fns.org/docs/format). */
|
|
12
9
|
format?: string;
|
|
13
10
|
}
|
|
14
11
|
/** Options used to parse a date string. */
|
|
@@ -25,8 +22,7 @@ export interface DateTransformer {
|
|
|
25
22
|
format: (date: string | number | Date | null, options?: DateFormatterOptions) => string;
|
|
26
23
|
}
|
|
27
24
|
/**
|
|
28
|
-
* Hook returning functions that can be used to transform a date according to
|
|
29
|
-
*
|
|
30
|
-
* the same way a `DateInput` would.
|
|
25
|
+
* Hook returning functions that can be used to transform a date according to the current locale. By
|
|
26
|
+
* default, the returned functions transform a date in the same way a `DateInput` would.
|
|
31
27
|
*/
|
|
32
|
-
export declare function useDateTransformer({ locale:
|
|
28
|
+
export declare function useDateTransformer({ locale: dateFnsLocaleProp, format: formatProp, }?: DateTransformerOptions): DateTransformer;
|
|
@@ -1,5 +1,2 @@
|
|
|
1
|
-
/**
|
|
2
|
-
|
|
3
|
-
* of an element.
|
|
4
|
-
*/
|
|
5
|
-
export declare function useIntersectionObserver<T extends Element = Element>(element: T | null, onIntersectionEntryChange: (entry: IntersectionObserverEntry) => void, options?: IntersectionObserverInit): void;
|
|
1
|
+
/** Hook wrapping an `IntersectionObserver` which tracks the intersection ratio of an element. */
|
|
2
|
+
export declare function useIntersectionObserver(element: Element | null, onIntersectionEntryChange: (entry: IntersectionObserverEntry) => void, options?: IntersectionObserverInit): void;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { type RefObject } from "react";
|
|
2
2
|
/**
|
|
3
|
-
* Hook providing a reference which is continuously updated with the latest
|
|
4
|
-
* provided `value`.
|
|
3
|
+
* Hook providing a reference which is continuously updated with the latest provided `value`.
|
|
5
4
|
*
|
|
6
5
|
* @param value Value to store in the reference.
|
|
7
6
|
* @returns Reference to the latest provided value.
|
|
@@ -7,24 +7,21 @@ interface LocationPath {
|
|
|
7
7
|
*/
|
|
8
8
|
readonly pathname: string;
|
|
9
9
|
/**
|
|
10
|
-
* Search string (also known as _query string_): `"?"` followed by the
|
|
11
|
-
*
|
|
10
|
+
* Search string (also known as _query string_): `"?"` followed by the parameters of the URL or an
|
|
11
|
+
* empty string if there are no such parameters.
|
|
12
12
|
*
|
|
13
13
|
* E.g. `?q=baz` in `https://example.org:8080/foo/bar?q=baz#bang`.
|
|
14
14
|
*/
|
|
15
15
|
readonly search: string;
|
|
16
16
|
/**
|
|
17
|
-
* `"#"` followed by the fragment identifier of the URL or an empty string if
|
|
18
|
-
*
|
|
17
|
+
* `"#"` followed by the fragment identifier of the URL or an empty string if there is no fragment
|
|
18
|
+
* identifier.
|
|
19
19
|
*
|
|
20
20
|
* E.g. `#bang` in `https://example.org:8080/foo/bar?q=baz#bang`.
|
|
21
21
|
*/
|
|
22
22
|
readonly hash: string;
|
|
23
23
|
}
|
|
24
|
-
/**
|
|
25
|
-
* Hook exposing the current location and a function to navigate to a new
|
|
26
|
-
* location.
|
|
27
|
-
*/
|
|
24
|
+
/** Hook exposing the current location and a function to navigate to a new location. */
|
|
28
25
|
export declare function useLocation(): LocationPath;
|
|
29
26
|
export declare function useLocation<T>(selector: (location: LocationPath) => T): T;
|
|
30
27
|
export {};
|
|
@@ -1,5 +1,2 @@
|
|
|
1
|
-
/**
|
|
2
|
-
|
|
3
|
-
* API.
|
|
4
|
-
*/
|
|
5
|
-
export declare function useMeasure<T extends Element = Element>(element: T | null, setMeasurement: (measurement: DOMRectReadOnly | undefined) => void): void;
|
|
1
|
+
/** Hook that tracks the dimensions of an HTML element using the Resize Observer API. */
|
|
2
|
+
export declare function useMeasure(element: Element | null, setMeasurement: (measurement: DOMRectReadOnly | undefined) => void): void;
|
|
@@ -5,8 +5,5 @@ export interface UseMediaQueryOptions {
|
|
|
5
5
|
/** `matchMedia` implementation (e.g. for tests). */
|
|
6
6
|
matchMedia?: typeof window.matchMedia;
|
|
7
7
|
}
|
|
8
|
-
/**
|
|
9
|
-
* Hook exposing a CSS media query to React. Returns whether the media query
|
|
10
|
-
* matches or not.
|
|
11
|
-
*/
|
|
8
|
+
/** Hook exposing a CSS media query to React. Returns whether the media query matches or not. */
|
|
12
9
|
export declare function useMediaQuery(query: string, options?: UseMediaQueryOptions): boolean;
|
|
@@ -3,30 +3,26 @@ export type GroupingStyle = "thousand" | "lakh" | "wan";
|
|
|
3
3
|
/** Options of the `useNumericTransformer` hook. */
|
|
4
4
|
export interface NumericTransformerOptions {
|
|
5
5
|
/**
|
|
6
|
-
* Whether the value should always represent an integer. When set, the `scale`
|
|
7
|
-
*
|
|
6
|
+
* Whether the value should always represent an integer. When set, the `scale` must be defined
|
|
7
|
+
* (and defaults to `0` if not provided).
|
|
8
8
|
*
|
|
9
|
-
* As an example, if `valueIsInteger` set with a `scale` of `2`, the value
|
|
10
|
-
*
|
|
9
|
+
* As an example, if `valueIsInteger` set with a `scale` of `2`, the value `1000` will be
|
|
10
|
+
* formatted similarly to `10.00`.
|
|
11
11
|
*/
|
|
12
12
|
valueIsInteger?: boolean;
|
|
13
13
|
/**
|
|
14
|
-
* Specifies the number of digits allowed after the decimal separator. When
|
|
15
|
-
*
|
|
14
|
+
* Specifies the number of digits allowed after the decimal separator. When not specified (or
|
|
15
|
+
* `null`), the scale has no limits.
|
|
16
16
|
*
|
|
17
|
-
* The scale must be set when `valueIsInteger` is also set, defaulting to `0`
|
|
18
|
-
* otherwise.
|
|
17
|
+
* The scale must be set when `valueIsInteger` is also set, defaulting to `0` otherwise.
|
|
19
18
|
*/
|
|
20
19
|
scale?: number | null;
|
|
21
20
|
/**
|
|
22
|
-
* Whether to always add trailing zeros to match the given `scale`. Defaults
|
|
23
|
-
*
|
|
21
|
+
* Whether to always add trailing zeros to match the given `scale`. Defaults to `false` when
|
|
22
|
+
* `scale` is `null` and `true` otherwise.
|
|
24
23
|
*/
|
|
25
24
|
fixedScale?: boolean;
|
|
26
|
-
/**
|
|
27
|
-
* Character to use as a decimal separator. Defaults to the locale's
|
|
28
|
-
* separator.
|
|
29
|
-
*/
|
|
25
|
+
/** Character to use as a decimal separator. Defaults to the locale's separator. */
|
|
30
26
|
decimalSeparator?: string;
|
|
31
27
|
/**
|
|
32
28
|
* Whether to group the integer part of the number.
|
|
@@ -36,10 +32,7 @@ export interface NumericTransformerOptions {
|
|
|
36
32
|
groupDigits?: boolean;
|
|
37
33
|
/** Style of grouping. Defaults to the locale's default style. */
|
|
38
34
|
groupingStyle?: GroupingStyle;
|
|
39
|
-
/**
|
|
40
|
-
* Character to use to separate the groups of digits. Defaults to the locale's
|
|
41
|
-
* separator.
|
|
42
|
-
*/
|
|
35
|
+
/** Character to use to separate the groups of digits. Defaults to the locale's separator. */
|
|
43
36
|
groupSeparator?: string;
|
|
44
37
|
/** Prefix to add to the input's text. */
|
|
45
38
|
prefix?: string;
|
|
@@ -54,7 +47,7 @@ export interface NumericTransformer {
|
|
|
54
47
|
format: (value: string | number | null | undefined, options?: NumericTransformerOptions) => string;
|
|
55
48
|
}
|
|
56
49
|
/** Hook returning functions that can be used to transform a numeric value. */
|
|
57
|
-
export declare function useNumericTransformer({ valueIsInteger, scale, fixedScale, decimalSeparator, groupDigits, groupingStyle, groupSeparator, prefix, suffix, }?: NumericTransformerOptions): NumericTransformer;
|
|
50
|
+
export declare function useNumericTransformer({ valueIsInteger, scale, fixedScale: fixedScaleProp, decimalSeparator: decimalSeparatorProp, groupDigits, groupingStyle: groupingStyleProp, groupSeparator: groupSeparatorProp, prefix, suffix, }?: NumericTransformerOptions): NumericTransformer;
|
|
58
51
|
/** Validates numeric transformer options. */
|
|
59
52
|
export declare function validateNumericTransformerOptions({ valueIsInteger, scale, decimalSeparator, groupSeparator, }?: NumericTransformerOptions): void;
|
|
60
53
|
/** Transforms a formatted numeric value into its numeric string representation. */
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Hook providing access to the value of a provided argument in the previous
|
|
3
|
-
* render.
|
|
2
|
+
* Hook providing access to the value of a provided argument in the previous render.
|
|
4
3
|
*
|
|
5
4
|
* @param value Value to store and return on the next render.
|
|
6
|
-
* @returns The value of the provided argument in the previous render or
|
|
7
|
-
*
|
|
5
|
+
* @returns The value of the provided argument in the previous render or `undefined` during the
|
|
6
|
+
* first render.
|
|
8
7
|
*/
|
|
9
8
|
export declare function usePrevious<T>(value: T): T | undefined;
|
|
@@ -7,9 +7,8 @@ export type UseResponsiveValuesOptions = UseCssVarsOptions;
|
|
|
7
7
|
/** Result of the {@link useResponsiveValues} hook. */
|
|
8
8
|
export interface UseResponsiveValuesResult {
|
|
9
9
|
/**
|
|
10
|
-
* Returns an object of CSS variables for multiple responsive values, together
|
|
11
|
-
*
|
|
12
|
-
* associated CSS variable.
|
|
10
|
+
* Returns an object of CSS variables for multiple responsive values, together with data
|
|
11
|
+
* attributes specifying which breakpoints of each value have an associated CSS variable.
|
|
13
12
|
*/
|
|
14
13
|
responsiveValuesToCssVarsAndDataAttrs: <T extends Record<string, unknown>, TMappers extends {
|
|
15
14
|
[TKey in keyof T]: (value: T[TKey] extends Responsive<infer TValue> | undefined ? TValue : never) => unknown;
|
|
@@ -18,9 +17,8 @@ export interface UseResponsiveValuesResult {
|
|
|
18
17
|
dataAttrs: Record<string, string | undefined>;
|
|
19
18
|
};
|
|
20
19
|
/**
|
|
21
|
-
* Returns an object of CSS variables for a responsive value, together with
|
|
22
|
-
*
|
|
23
|
-
* variable.
|
|
20
|
+
* Returns an object of CSS variables for a responsive value, together with data attributes
|
|
21
|
+
* specifying which breakpoints have an associated CSS variable.
|
|
24
22
|
*/
|
|
25
23
|
responsiveValueToCssVarsAndDataAttrs: <T>(componentName: string, varName: string, value?: Responsive<T>, mapper?: (value: T) => unknown) => {
|
|
26
24
|
cssVars: Record<string, string | undefined>;
|
|
@@ -30,12 +28,11 @@ export interface UseResponsiveValuesResult {
|
|
|
30
28
|
/** Hook providing access to responsive value utilities. */
|
|
31
29
|
export declare function useResponsiveValues(options?: UseResponsiveValuesOptions): UseResponsiveValuesResult;
|
|
32
30
|
/**
|
|
33
|
-
* Resolves a `Responsive<T>` value to the specific value matching the current
|
|
34
|
-
* breakpoint.
|
|
31
|
+
* Resolves a `Responsive<T>` value to the specific value matching the current breakpoint.
|
|
35
32
|
*
|
|
36
33
|
* @param value Responsive value.
|
|
37
|
-
* @param defaultValue Fallback value if no matching breakpoint is found or if
|
|
38
|
-
* `
|
|
34
|
+
* @param defaultValue Fallback value if no matching breakpoint is found or if `value` is
|
|
35
|
+
* `undefined`.
|
|
39
36
|
* @returns The resolved value for the current breakpoint, or `defaultValue`.
|
|
40
37
|
*/
|
|
41
38
|
export declare function useCurrentResponsiveValue<T = unknown>(value: Responsive<T> | undefined): T | undefined;
|
|
@@ -6,10 +6,5 @@ export interface ScrollPosition<T extends Element = Element> {
|
|
|
6
6
|
bottom: number;
|
|
7
7
|
left: number;
|
|
8
8
|
}
|
|
9
|
-
/** Result of the `useScrollPosition` hook. */
|
|
10
|
-
export type UseScrollPositionResult<T extends Element = Element> = [
|
|
11
|
-
setElement: (element: T) => void,
|
|
12
|
-
scrollPosition: ScrollPosition | undefined
|
|
13
|
-
];
|
|
14
9
|
/** Hook that tracks the position of an element's scroll. */
|
|
15
|
-
export declare function useScrollPosition
|
|
10
|
+
export declare function useScrollPosition(element: Element | null, setScrollPosition: (scrollPosition: ScrollPosition | undefined) => void): void;
|
|
@@ -2,8 +2,7 @@ import type { SetSearchParamsOptions } from "./useSearchParams.ts";
|
|
|
2
2
|
/** Options used to navigate to the new search parameter. */
|
|
3
3
|
export interface SetSearchParamOptions extends SetSearchParamsOptions {
|
|
4
4
|
/**
|
|
5
|
-
* Whether the search parameter should be cleared when its value equals the
|
|
6
|
-
* default value.
|
|
5
|
+
* Whether the search parameter should be cleared when its value equals the default value.
|
|
7
6
|
*
|
|
8
7
|
* @default false
|
|
9
8
|
*/
|
|
@@ -18,9 +17,6 @@ export type UseSearchParamResult<TValue extends string | undefined = string | un
|
|
|
18
17
|
searchParamValue: TValue,
|
|
19
18
|
setSearchParamValue: (nextSearchParamValue: SearchParamValue | ((prevSearchParamValue: TValue) => SearchParamValue), options?: SetSearchParamOptions) => void
|
|
20
19
|
];
|
|
21
|
-
/**
|
|
22
|
-
* Hook exposing the value of a single URL search parameter and a function to
|
|
23
|
-
* update it.
|
|
24
|
-
*/
|
|
20
|
+
/** Hook exposing the value of a single URL search parameter and a function to update it. */
|
|
25
21
|
export declare function useSearchParam(searchParam: string): UseSearchParamResult;
|
|
26
22
|
export declare function useSearchParam(searchParam: string, defaultValue: string): UseSearchParamResult<string>;
|
|
@@ -15,9 +15,6 @@ export interface UseSearchParamsResult {
|
|
|
15
15
|
searchParams: URLSearchParams;
|
|
16
16
|
setSearchParams: (nextSearchParams: URLSearchParamsInit | ((prevSearchParams: URLSearchParams) => URLSearchParamsInit), options?: SetSearchParamsOptions) => void;
|
|
17
17
|
}
|
|
18
|
-
/**
|
|
19
|
-
* Hook exposing the current URL search parameters and a function to update
|
|
20
|
-
* them.
|
|
21
|
-
*/
|
|
18
|
+
/** Hook exposing the current URL search parameters and a function to update them. */
|
|
22
19
|
export declare function useSearchParams(): UseSearchParamsResult;
|
|
23
20
|
export {};
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Function used to obtain a CSS values representing a size based on the theme's
|
|
3
|
-
* “space” value.
|
|
4
|
-
*/
|
|
1
|
+
/** Function used to obtain a CSS values representing a size based on the theme's “space” value. */
|
|
5
2
|
export type SpacingFn = (...values: number[]) => string;
|
|
6
3
|
/** Returns a CSS value representing a size based on the theme's "space" value. */
|
|
7
4
|
export declare function useSpacing(): SpacingFn;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import { type ExtractState, type StoreApi } from "zustand";
|
|
2
|
+
/** Returns a Zustand store, falling back to an empty one if `undefined` is provided. */
|
|
3
|
+
export declare function ensureStore<T extends StoreApi<any>>(store: T | null | undefined): T & StoreApi<Partial<ExtractState<T>>>;
|
|
3
4
|
/** Function used within a Zustand store to hold computed state. */
|
|
4
5
|
export declare function computed<const TDeps extends readonly unknown[] = unknown[], TResult = unknown>(depsFn: () => TDeps, computeFn: (...deps: TDeps) => TResult): () => TResult;
|