@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
|
@@ -37,12 +37,10 @@ export interface ToastPropsBase extends Pick<ComponentProps<typeof ToastPrimitiv
|
|
|
37
37
|
/**
|
|
38
38
|
* Controls how the toast is announced to screen reader users:
|
|
39
39
|
*
|
|
40
|
-
* - `polite`: The screen reader will announce the toast at the next available
|
|
41
|
-
*
|
|
42
|
-
*
|
|
43
|
-
*
|
|
44
|
-
* announce this immediately. Recommended for feedback directly resulting
|
|
45
|
-
* from a user action.
|
|
40
|
+
* - `polite`: The screen reader will announce the toast at the next available opportunity without
|
|
41
|
+
* interrupting the user. Best for background events not directly triggered by the user.
|
|
42
|
+
* - `assertive`: The screen reader will interrupt any current speech to announce this immediately.
|
|
43
|
+
* Recommended for feedback directly resulting from a user action.
|
|
46
44
|
*
|
|
47
45
|
* @default "assertive"
|
|
48
46
|
*/
|
|
@@ -50,8 +48,8 @@ export interface ToastPropsBase extends Pick<ComponentProps<typeof ToastPrimitiv
|
|
|
50
48
|
/** Toast action. */
|
|
51
49
|
action?: ReactNode;
|
|
52
50
|
/**
|
|
53
|
-
* Describes an alternative way to achieve the action for assistive technology
|
|
54
|
-
*
|
|
51
|
+
* Describes an alternative way to achieve the action for assistive technology users who cannot
|
|
52
|
+
* access the toast easily.
|
|
55
53
|
*
|
|
56
54
|
* This should always be provided whenever the toast has an `action`.
|
|
57
55
|
*/
|
|
@@ -59,32 +57,30 @@ export interface ToastPropsBase extends Pick<ComponentProps<typeof ToastPrimitiv
|
|
|
59
57
|
/** Icon to show. Each severity except `"neutral"` has its own default icon. */
|
|
60
58
|
icon?: IconProp | null;
|
|
61
59
|
/**
|
|
62
|
-
* Whether the toast can be manually dismissed by the user. Setting this to
|
|
63
|
-
*
|
|
60
|
+
* Whether the toast can be manually dismissed by the user. Setting this to `false` disables all
|
|
61
|
+
* manual exit triggers:
|
|
64
62
|
*
|
|
65
63
|
* - The close button is not rendered.
|
|
66
64
|
* - The `Escape` key is ignored.
|
|
67
65
|
* - Swipe gestures are disabled.
|
|
68
66
|
*
|
|
69
|
-
* > **Note:** This does not affect automatic dismissal via the `duration`
|
|
70
|
-
* >
|
|
71
|
-
* > `Infinity`.
|
|
67
|
+
* > **Note:** This does not affect automatic dismissal via the `duration` property. To create a
|
|
68
|
+
* > truly "permanent" toast, set `duration` to `Infinity`.
|
|
72
69
|
*
|
|
73
70
|
* @default true
|
|
74
71
|
*/
|
|
75
72
|
dismissible?: boolean;
|
|
76
73
|
/**
|
|
77
|
-
* Whether to show a close button. By default, a close button is shown when an
|
|
78
|
-
*
|
|
74
|
+
* Whether to show a close button. By default, a close button is shown when an `action` is not
|
|
75
|
+
* specified and when the toast is dismissible.
|
|
79
76
|
*/
|
|
80
77
|
showCloseButton?: boolean;
|
|
81
78
|
/**
|
|
82
|
-
* Whether the toast should be visually hidden. I.e. it provides a
|
|
83
|
-
*
|
|
79
|
+
* Whether the toast should be visually hidden. I.e. it provides a notification only to screen
|
|
80
|
+
* readers.
|
|
84
81
|
*
|
|
85
|
-
* This is useful when sighted users can easily see that something has
|
|
86
|
-
*
|
|
87
|
-
* otherwise.
|
|
82
|
+
* This is useful when sighted users can easily see that something has happened, but nothing would
|
|
83
|
+
* be announced to assistive technology otherwise.
|
|
88
84
|
*/
|
|
89
85
|
visuallyHidden?: boolean;
|
|
90
86
|
/** Properties to pass to the root component. */
|
|
@@ -101,8 +97,7 @@ export interface ToastPropsBase extends Pick<ComponentProps<typeof ToastPrimitiv
|
|
|
101
97
|
closeButtonProps?: CloseButtonProps;
|
|
102
98
|
}
|
|
103
99
|
/**
|
|
104
|
-
* The toast component provides a brief, temporary notification. Built on top of
|
|
105
|
-
* the [Radix Toast
|
|
100
|
+
* The toast component provides a brief, temporary notification. Built on top of the [Radix Toast
|
|
106
101
|
* primitive](https://www.radix-ui.com/primitives/docs/components/toast).
|
|
107
102
|
*
|
|
108
103
|
* It composes the following subcomponents:
|
|
@@ -113,12 +108,7 @@ export interface ToastPropsBase extends Pick<ComponentProps<typeof ToastPrimitiv
|
|
|
113
108
|
* Example usage:
|
|
114
109
|
*
|
|
115
110
|
* ```tsx
|
|
116
|
-
* import {
|
|
117
|
-
* Button,
|
|
118
|
-
* Toast,
|
|
119
|
-
* ToastTitle,
|
|
120
|
-
* ToastDescription,
|
|
121
|
-
* } from "@ostack.tech/ui";
|
|
111
|
+
* import { Button, Toast, ToastTitle, ToastDescription } from "@ostack.tech/ui";
|
|
122
112
|
* import { useState } from "react";
|
|
123
113
|
*
|
|
124
114
|
* function UpdateProfile() {
|
|
@@ -134,21 +124,18 @@ export interface ToastPropsBase extends Pick<ComponentProps<typeof ToastPrimitiv
|
|
|
134
124
|
* <Button onClick={handleSave}>Save changes</Button>
|
|
135
125
|
* <Toast open={notifySaved} onOpenChange={setNotifySaved}>
|
|
136
126
|
* <ToastTitle>Changes saved</ToastTitle>
|
|
137
|
-
* <ToastDescription>
|
|
138
|
-
* Your profile information has been updated.
|
|
139
|
-
* </ToastDescription>
|
|
127
|
+
* <ToastDescription>Your profile information has been updated.</ToastDescription>
|
|
140
128
|
* </Toast>
|
|
141
129
|
* </>
|
|
142
130
|
* );
|
|
143
131
|
* }
|
|
144
132
|
* ```
|
|
145
133
|
*
|
|
146
|
-
* > **Note:** In most scenarios, you might prefer to use the `useToastManager`
|
|
147
|
-
* >
|
|
134
|
+
* > **Note:** In most scenarios, you might prefer to use the `useToastManager` hook instead, which
|
|
135
|
+
* > provides an imperative API to manage toasts.
|
|
148
136
|
*
|
|
149
|
-
* > **Note:** The `Root` component automatically initializes the `ToastProvider`
|
|
150
|
-
* >
|
|
151
|
-
* >
|
|
152
|
-
* > components is not required.
|
|
137
|
+
* > **Note:** The `Root` component automatically initializes the `ToastProvider` and `ToastViewport`.
|
|
138
|
+
* > These manage the global state, configuration, and the accessible region where notifications are
|
|
139
|
+
* > rendered. Manual setup of these components is not required.
|
|
153
140
|
*/
|
|
154
|
-
export declare function Toast({ duration, defaultOpen, open: controlledOpen, onOpenChange, onEscapeKeyDown, onPause, onResume, onSwipeStart, onSwipeMove, onSwipeEnd, onSwipeCancel, forceMount, variant, severity, announce, icon, action, actionAltText, dismissible, showCloseButton, visuallyHidden, rootProps, containerProps, iconProps, contentProps, actionContainerProps, closeButtonProps, children, className, ...otherProps }: ToastProps): import("react").JSX.Element;
|
|
141
|
+
export declare function Toast({ duration, defaultOpen, open: controlledOpen, onOpenChange, onEscapeKeyDown, onPause, onResume, onSwipeStart, onSwipeMove, onSwipeEnd, onSwipeCancel, forceMount, variant, severity, announce, icon, action, actionAltText, dismissible, showCloseButton: showCloseButtonProp, visuallyHidden, rootProps, containerProps, iconProps, contentProps, actionContainerProps, closeButtonProps, children, className, ...otherProps }: ToastProps): import("react").JSX.Element;
|
|
@@ -6,8 +6,5 @@ export type ToastSwipeDirection = "left" | "right";
|
|
|
6
6
|
export interface ToastProviderProps extends ComponentProps<typeof ToastPrimitive.Provider> {
|
|
7
7
|
swipeDirection?: ToastSwipeDirection;
|
|
8
8
|
}
|
|
9
|
-
/**
|
|
10
|
-
|
|
11
|
-
* application.
|
|
12
|
-
*/
|
|
13
|
-
export declare function ToastProvider({ label, ...otherProps }: ToastProviderProps): import("react").JSX.Element;
|
|
9
|
+
/** The provider that wraps the toasts and their viewport. It usually wraps the application. */
|
|
10
|
+
export declare function ToastProvider({ label: labelProp, ...otherProps }: ToastProviderProps): import("react").JSX.Element;
|
|
@@ -11,8 +11,5 @@ export interface ToastViewportProps extends ComponentProps<typeof ToastPrimitive
|
|
|
11
11
|
*/
|
|
12
12
|
position?: ToastViewportPosition;
|
|
13
13
|
}
|
|
14
|
-
/**
|
|
15
|
-
|
|
16
|
-
* pressing a hotkey.
|
|
17
|
-
*/
|
|
18
|
-
export declare function ToastViewport({ position, label, className, ...otherProps }: ToastViewportProps): import("react").JSX.Element;
|
|
14
|
+
/** The fixed area where toasts appear. Users can jump to the viewport by pressing a hotkey. */
|
|
15
|
+
export declare function ToastViewport({ position, label: labelProp, className, ...otherProps }: ToastViewportProps): import("react").JSX.Element;
|
|
@@ -21,18 +21,18 @@ export interface TooltipProps extends Omit<ComponentProps<typeof TooltipPrimitiv
|
|
|
21
21
|
*/
|
|
22
22
|
open?: boolean;
|
|
23
23
|
/**
|
|
24
|
-
* Function called when the open state of the tooltip changes. Use it to
|
|
25
|
-
*
|
|
24
|
+
* Function called when the open state of the tooltip changes. Use it to control the tooltip's
|
|
25
|
+
* open state together with the `open` property.
|
|
26
26
|
*/
|
|
27
27
|
onOpenChange?: (open: boolean) => void;
|
|
28
28
|
/**
|
|
29
|
-
* Override the duration given to the `TooltipProvider` to customise the open
|
|
30
|
-
*
|
|
29
|
+
* Override the duration given to the `TooltipProvider` to customise the open delay for a specific
|
|
30
|
+
* tooltip.
|
|
31
31
|
*/
|
|
32
32
|
delayDuration?: number;
|
|
33
33
|
/**
|
|
34
|
-
* Prevents the content from remaining open when hovering. Disabling this has
|
|
35
|
-
*
|
|
34
|
+
* Prevents the content from remaining open when hovering. Disabling this has accessibility
|
|
35
|
+
* consequences. Inherits from `TooltipProvider`.
|
|
36
36
|
*/
|
|
37
37
|
disableHoverableContent?: boolean;
|
|
38
38
|
/** Used to force mounting when more control is needed. */
|
|
@@ -43,8 +43,8 @@ export interface TooltipProps extends Omit<ComponentProps<typeof TooltipPrimitiv
|
|
|
43
43
|
arrowProps?: ComponentProps<typeof TooltipPrimitive.Arrow>;
|
|
44
44
|
}
|
|
45
45
|
/**
|
|
46
|
-
* The tooltip component displays a popup containing information related to an
|
|
47
|
-
*
|
|
46
|
+
* The tooltip component displays a popup containing information related to an element when the user
|
|
47
|
+
* focuses or hovers over it.
|
|
48
48
|
*
|
|
49
49
|
* Built on top of the [Radix Tooltip
|
|
50
50
|
* primitive](https://www.radix-ui.com/primitives/docs/components/tooltip).
|
|
@@ -63,8 +63,8 @@ export interface TooltipProps extends Omit<ComponentProps<typeof TooltipPrimitiv
|
|
|
63
63
|
* }
|
|
64
64
|
* ```
|
|
65
65
|
*
|
|
66
|
-
* > **Note:** The `Root` component automatically initializes the
|
|
67
|
-
* >
|
|
68
|
-
* >
|
|
66
|
+
* > **Note:** The `Root` component automatically initializes the `TooltipProvider`, which manages the
|
|
67
|
+
* > global configuration and state for all nested tooltips. Manual setup of the provider is not
|
|
68
|
+
* > required.
|
|
69
69
|
*/
|
|
70
70
|
export declare function Tooltip({ content, showArrow, children, defaultOpen, open, onOpenChange, delayDuration, disableHoverableContent, forceMount, portalProps, arrowProps, sideOffset, collisionPadding, className, ...otherProps }: TooltipProps): import("react").JSX.Element;
|
|
@@ -6,23 +6,19 @@ export type VisuallyHiddenProps<TAs extends VisuallyHiddenAs = "span"> = Polymor
|
|
|
6
6
|
/** Own properties of the visually hidden component. */
|
|
7
7
|
export interface VisuallyHiddenOwnProps {
|
|
8
8
|
/**
|
|
9
|
-
* Change the component to the HTML tag or custom component of the only child.
|
|
10
|
-
*
|
|
11
|
-
*
|
|
9
|
+
* Change the component to the HTML tag or custom component of the only child. This will merge the
|
|
10
|
+
* original component props with the props of the supplied element/component and change the
|
|
11
|
+
* underlying DOM node.
|
|
12
12
|
*/
|
|
13
13
|
asChild?: boolean;
|
|
14
|
-
/**
|
|
15
|
-
* Marks this component as focusable, in which case the content is visible
|
|
16
|
-
* when it receives focus.
|
|
17
|
-
*/
|
|
14
|
+
/** Marks this component as focusable, in which case the content is visible when it receives focus. */
|
|
18
15
|
focusable?: boolean;
|
|
19
16
|
}
|
|
20
17
|
/**
|
|
21
|
-
* Component that hides content from the screen while keeping it accessible to
|
|
22
|
-
*
|
|
18
|
+
* Component that hides content from the screen while keeping it accessible to assistive
|
|
19
|
+
* technologies.
|
|
23
20
|
*
|
|
24
|
-
* Used to provide context to screen readers that is redundant for sighted
|
|
25
|
-
* users.
|
|
21
|
+
* Used to provide context to screen readers that is redundant for sighted users.
|
|
26
22
|
*
|
|
27
23
|
* Example usage:
|
|
28
24
|
*
|
package/types/index.d.ts
CHANGED
|
@@ -69,7 +69,7 @@ export * from "./providers/ToastManagerProvider";
|
|
|
69
69
|
export * from "./utils/boolDataAttr.ts";
|
|
70
70
|
export * from "./utils/breakpoints.ts";
|
|
71
71
|
export * from "./utils/combineAriaIds.ts";
|
|
72
|
-
export * from "./utils/
|
|
72
|
+
export * from "./utils/useCombinedEventHandler.ts";
|
|
73
73
|
export * from "./utils/cx.ts";
|
|
74
74
|
export * from "./utils/filtering.ts";
|
|
75
75
|
export * from "./utils/keyboardShortcut.ts";
|
|
@@ -79,6 +79,7 @@ export * from "./utils/numericStringUtils.ts";
|
|
|
79
79
|
export * from "./utils/parseChildren.ts";
|
|
80
80
|
export * from "./utils/parseDateStrict.ts";
|
|
81
81
|
export * from "./utils/polymorphicTypes.ts";
|
|
82
|
+
export * from "./utils/reactCompilerUtils.ts";
|
|
82
83
|
export * from "./utils/setNativeProperty.ts";
|
|
83
84
|
export * from "./utils/sorting.ts";
|
|
84
85
|
export * from "./utils/stringHash.ts";
|
|
@@ -12,9 +12,8 @@ export interface AlertDialogOptions {
|
|
|
12
12
|
*/
|
|
13
13
|
variant?: AlertDialogContentVariant;
|
|
14
14
|
/**
|
|
15
|
-
* Whether sections should be merged together, as opposed to them being
|
|
16
|
-
*
|
|
17
|
-
* border or solid background colour.
|
|
15
|
+
* Whether sections should be merged together, as opposed to them being clearly delimited. By
|
|
16
|
+
* default, each section is clearly delimited via a border or solid background colour.
|
|
18
17
|
*
|
|
19
18
|
* @default false
|
|
20
19
|
*/
|
|
@@ -32,8 +31,8 @@ export interface AlertDialogOptions {
|
|
|
32
31
|
/** Alert dialog's action text. */
|
|
33
32
|
okText?: ReactNode;
|
|
34
33
|
/**
|
|
35
|
-
* Element that caused the alert dialog to be triggered. This element will be
|
|
36
|
-
*
|
|
34
|
+
* Element that caused the alert dialog to be triggered. This element will be automatically
|
|
35
|
+
* focused when the dialog closes.
|
|
37
36
|
*/
|
|
38
37
|
triggerElement?: HTMLElement | null;
|
|
39
38
|
/** Properties to pass to the alert dialog's content component. */
|
|
@@ -61,21 +60,20 @@ export interface ConfirmDialogOptions extends AlertDialogOptions {
|
|
|
61
60
|
/** Value of the alert dialog context. */
|
|
62
61
|
export interface AlertDialogProviderContextValue {
|
|
63
62
|
/**
|
|
64
|
-
* Displays an alert to prompt the user with custom content rendered by the
|
|
65
|
-
*
|
|
63
|
+
* Displays an alert to prompt the user with custom content rendered by the provided
|
|
64
|
+
* `renderContent` function.
|
|
66
65
|
*
|
|
67
|
-
* The displayed content should eventually call the provided `resolve`
|
|
68
|
-
*
|
|
66
|
+
* The displayed content should eventually call the provided `resolve` function with the
|
|
67
|
+
* user-provided value.
|
|
69
68
|
*
|
|
70
|
-
* @param renderContent Function used to render the alert's content. Receives
|
|
71
|
-
*
|
|
72
|
-
* @returns A promise that resolves with the value called in `resolve`, or
|
|
73
|
-
*
|
|
69
|
+
* @param renderContent Function used to render the alert's content. Receives a `resolve` function
|
|
70
|
+
* that should be called with the user-provided value.
|
|
71
|
+
* @returns A promise that resolves with the value called in `resolve`, or `undefined` if the
|
|
72
|
+
* dialog was closed for another reason.
|
|
74
73
|
*/
|
|
75
74
|
prompt: <T>(renderContent: (resolve: (value?: T | PromiseLike<T>) => void) => ReactNode) => Promise<T | undefined>;
|
|
76
75
|
/**
|
|
77
|
-
* Displays an alert (similar to the browser's `alert`, but non-blocking) via
|
|
78
|
-
* an alert dialog.
|
|
76
|
+
* Displays an alert (similar to the browser's `alert`, but non-blocking) via an alert dialog.
|
|
79
77
|
*
|
|
80
78
|
* @param description Alert description.
|
|
81
79
|
* @param dialogOptions Dialog options.
|
|
@@ -83,13 +81,13 @@ export interface AlertDialogProviderContextValue {
|
|
|
83
81
|
*/
|
|
84
82
|
alert: (description: ReactNode, dialogOptions?: AlertDialogOptions) => Promise<void>;
|
|
85
83
|
/**
|
|
86
|
-
* Displays a confirmation dialog (similar to the browser's `confirm` but
|
|
87
|
-
*
|
|
84
|
+
* Displays a confirmation dialog (similar to the browser's `confirm` but non-blocking) via an
|
|
85
|
+
* alert dialog.
|
|
88
86
|
*
|
|
89
87
|
* @param description Confirmation description.
|
|
90
88
|
* @param dialogOptions Dialog options.
|
|
91
|
-
* @returns A promise that resolves with a boolean representing whether the
|
|
92
|
-
*
|
|
89
|
+
* @returns A promise that resolves with a boolean representing whether the dialog has been
|
|
90
|
+
* confirmed or cancelled.
|
|
93
91
|
*/
|
|
94
92
|
confirm: (description: ReactNode, dialogOptions?: ConfirmDialogOptions) => Promise<boolean>;
|
|
95
93
|
}
|
|
@@ -1,68 +1,60 @@
|
|
|
1
1
|
import { type AlertDialogProviderContextValue } from "./AlertDialogProviderContext.ts";
|
|
2
2
|
/**
|
|
3
|
-
* Hook used to access an alert dialog in an imperative manner, providing
|
|
4
|
-
*
|
|
3
|
+
* Hook used to access an alert dialog in an imperative manner, providing `alert` and `confirm`
|
|
4
|
+
* functions somewhat mimicking the browser's.
|
|
5
5
|
*
|
|
6
|
-
* It also exposes a lower level `prompt` function which allows custom dialog
|
|
7
|
-
*
|
|
6
|
+
* It also exposes a lower level `prompt` function which allows custom dialog content to be
|
|
7
|
+
* provided, and any value to be resolved.
|
|
8
8
|
*
|
|
9
9
|
* @example
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
* });
|
|
10
|
+
* const { alert, confirm } = useAlertDialog();
|
|
11
|
+
*
|
|
12
|
+
* async function handleRemoveItemClick(event) {
|
|
13
|
+
* if (
|
|
14
|
+
* (await confirm(`Are you sure you wish to remove item #${itemId}?`),
|
|
15
|
+
* {
|
|
16
|
+
* title: "Remove item",
|
|
17
|
+
* color: "danger",
|
|
18
|
+
* okText: "Remove",
|
|
19
|
+
* triggerElement: event.target,
|
|
20
|
+
* })
|
|
21
|
+
* ) {
|
|
22
|
+
* api.removeItem(itemId);
|
|
23
|
+
* await alert("Item removed successfully!", {
|
|
24
|
+
* color: "success",
|
|
25
|
+
* triggerElement: event.target,
|
|
26
|
+
* });
|
|
27
|
+
* }
|
|
29
28
|
* }
|
|
30
|
-
* }
|
|
31
|
-
* ```
|
|
32
29
|
*
|
|
33
30
|
* @example
|
|
34
|
-
*
|
|
35
|
-
*
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
*
|
|
39
|
-
*
|
|
40
|
-
*
|
|
41
|
-
*
|
|
42
|
-
* <
|
|
43
|
-
*
|
|
44
|
-
*
|
|
45
|
-
* <
|
|
46
|
-
*
|
|
47
|
-
*
|
|
48
|
-
*
|
|
49
|
-
*
|
|
50
|
-
*
|
|
51
|
-
* <
|
|
52
|
-
*
|
|
53
|
-
*
|
|
54
|
-
*
|
|
55
|
-
*
|
|
56
|
-
*
|
|
57
|
-
*
|
|
58
|
-
*
|
|
59
|
-
*
|
|
60
|
-
*
|
|
61
|
-
*
|
|
62
|
-
* ));
|
|
63
|
-
*
|
|
64
|
-
* console.assert(result === "custom" || result === undefined);
|
|
65
|
-
* }
|
|
66
|
-
* ```
|
|
31
|
+
* const { prompt } = useAlertDialog();
|
|
32
|
+
*
|
|
33
|
+
* async function handleClick(event) {
|
|
34
|
+
* const result = await prompt((resolve) => (
|
|
35
|
+
* <AlertDialogContent>
|
|
36
|
+
* <AlertDialogHeader>
|
|
37
|
+
* <AlertDialogTitle>Custom alert dialog title</AlertDialogTitle>
|
|
38
|
+
* </AlertDialogHeader>
|
|
39
|
+
* <AlertDialogBody>
|
|
40
|
+
* <AlertDialogDescription>Custom alert dialog description</AlertDialogDescription>
|
|
41
|
+
* </AlertDialogBody>
|
|
42
|
+
* <AlertDialogFooter>
|
|
43
|
+
* <AlertDialogCancel>
|
|
44
|
+
* <Button variant="subtle" onClick={() => resolve()}>
|
|
45
|
+
* Cancel
|
|
46
|
+
* </Button>
|
|
47
|
+
* </AlertDialogCancel>
|
|
48
|
+
* <AlertDialogAction>
|
|
49
|
+
* <Button color="primary" onClick={() => resolve("custom")}>
|
|
50
|
+
* Confirm
|
|
51
|
+
* </Button>
|
|
52
|
+
* </AlertDialogAction>
|
|
53
|
+
* </AlertDialogFooter>
|
|
54
|
+
* </AlertDialogContent>
|
|
55
|
+
* ));
|
|
56
|
+
*
|
|
57
|
+
* console.assert(result === "custom" || result === undefined);
|
|
58
|
+
* }
|
|
67
59
|
*/
|
|
68
60
|
export declare function useAlertDialog(): AlertDialogProviderContextValue;
|
|
@@ -5,8 +5,5 @@ export interface DocumentTitleProps {
|
|
|
5
5
|
title?: string;
|
|
6
6
|
children: ReactNode;
|
|
7
7
|
}
|
|
8
|
-
/**
|
|
9
|
-
* Component used to set the provided title as a breadcrumb of the document
|
|
10
|
-
* title.
|
|
11
|
-
*/
|
|
8
|
+
/** Component used to set the provided title as a breadcrumb of the document title. */
|
|
12
9
|
export declare function DocumentTitle({ title, children }: DocumentTitleProps): import("react").JSX.Element;
|
|
@@ -7,19 +7,16 @@ export interface ErrorReport {
|
|
|
7
7
|
message: string;
|
|
8
8
|
/** Error stack, when available. */
|
|
9
9
|
stack: string | null;
|
|
10
|
-
/**
|
|
11
|
-
* Component error stack (React component tree of where the error occurred),
|
|
12
|
-
* when available.
|
|
13
|
-
*/
|
|
10
|
+
/** Component error stack (React component tree of where the error occurred), when available. */
|
|
14
11
|
componentStack: string | null;
|
|
15
12
|
/** Timestamp of when the error occurred. */
|
|
16
13
|
timestamp: Date;
|
|
17
14
|
/**
|
|
18
15
|
* Browser's user agent.
|
|
19
16
|
*
|
|
20
|
-
* > **Note:** This could also be obtained from the `User-Agent` header of the
|
|
21
|
-
* >
|
|
22
|
-
* >
|
|
17
|
+
* > **Note:** This could also be obtained from the `User-Agent` header of the HTTP request.
|
|
18
|
+
* > However, it is included here since it is possible for the reporting to go through a proxy,
|
|
19
|
+
* > which is free to alter the HTTP header.
|
|
23
20
|
*/
|
|
24
21
|
userAgent: string;
|
|
25
22
|
/** URL where the error occurred. */
|
|
@@ -2,18 +2,15 @@ import { type ReactNode } from "react";
|
|
|
2
2
|
import { type ErrorReport } from "./ErrorReport.ts";
|
|
3
3
|
/** Properties of the error reporting provider. */
|
|
4
4
|
export interface ErrorReportingProviderProps {
|
|
5
|
-
/**
|
|
6
|
-
* Whether error reporting is enabled. By default, error reporting is only
|
|
7
|
-
* enabled in production.
|
|
8
|
-
*/
|
|
5
|
+
/** Whether error reporting is enabled. By default, error reporting is only enabled in production. */
|
|
9
6
|
enabled?: boolean;
|
|
10
7
|
/**
|
|
11
|
-
* Function used to report an error. This function completely overrides the
|
|
12
|
-
*
|
|
13
|
-
*
|
|
8
|
+
* Function used to report an error. This function completely overrides the default error
|
|
9
|
+
* reporting and, as such, properties related to error reporting such as the `errorReportingUrl`
|
|
10
|
+
* are ignored.
|
|
14
11
|
*
|
|
15
|
-
* The default `reportError` function uses `fetch` with the remaining
|
|
16
|
-
*
|
|
12
|
+
* The default `reportError` function uses `fetch` with the remaining properties such as
|
|
13
|
+
* `errorReportingUrl` to perform the reporting.
|
|
17
14
|
*
|
|
18
15
|
* @param report Error report that should be reported.
|
|
19
16
|
*/
|
|
@@ -51,9 +48,8 @@ export interface ErrorReportingProviderProps {
|
|
|
51
48
|
*/
|
|
52
49
|
encodedErrorReportMimeType?: string;
|
|
53
50
|
/**
|
|
54
|
-
* Options to provide to the `fetch` call when reporting an error, such as
|
|
55
|
-
*
|
|
56
|
-
* content-type.
|
|
51
|
+
* Options to provide to the `fetch` call when reporting an error, such as headers or others. By
|
|
52
|
+
* default, the request is a `POST` with JSON content-type.
|
|
57
53
|
*
|
|
58
54
|
* This property is ignored when a custom `reportError` is provided.
|
|
59
55
|
*/
|
|
@@ -61,10 +57,9 @@ export interface ErrorReportingProviderProps {
|
|
|
61
57
|
children?: ReactNode;
|
|
62
58
|
}
|
|
63
59
|
/**
|
|
64
|
-
* Provider used to report errors caught in error boundaries throughout the
|
|
65
|
-
* application.
|
|
60
|
+
* Provider used to report errors caught in error boundaries throughout the application.
|
|
66
61
|
*
|
|
67
|
-
* Note that this provider does **not** automatically set an error boundary, so
|
|
68
|
-
*
|
|
62
|
+
* Note that this provider does **not** automatically set an error boundary, so at least one should
|
|
63
|
+
* be manually set.
|
|
69
64
|
*/
|
|
70
|
-
export declare function ErrorReportingProvider({ enabled, reportError, errorReportingUrl, errorReportingMethod, encodeErrorReport, encodedErrorReportMimeType, errorReportingOptions, children, }: ErrorReportingProviderProps): import("react").JSX.Element;
|
|
65
|
+
export declare function ErrorReportingProvider({ enabled, reportError: reportErrorProp, errorReportingUrl, errorReportingMethod, encodeErrorReport, encodedErrorReportMimeType, errorReportingOptions, children, }: ErrorReportingProviderProps): import("react").JSX.Element;
|
|
@@ -1,6 +1,3 @@
|
|
|
1
1
|
import type { LocalizationObject } from "./LocalizationObject.ts";
|
|
2
2
|
/** Hook used to get and set the current locale. */
|
|
3
|
-
export declare function useLocale(): [
|
|
4
|
-
LocalizationObject,
|
|
5
|
-
(locale: LocalizationObject) => void
|
|
6
|
-
];
|
|
3
|
+
export declare function useLocale(): [LocalizationObject, (locale: LocalizationObject) => void];
|
|
@@ -3,9 +3,8 @@ export declare const defaultPrefixStore: import("zustand").StoreApi<{
|
|
|
3
3
|
defaultPrefix: string;
|
|
4
4
|
}>;
|
|
5
5
|
/**
|
|
6
|
-
* Function used to set the default library's prefix. The default library prefix
|
|
7
|
-
*
|
|
8
|
-
* `Root` components.
|
|
6
|
+
* Function used to set the default library's prefix. The default library prefix can be overridden
|
|
7
|
+
* by providing a `prefix` property to the `PrefixProvider` or `Root` components.
|
|
9
8
|
*
|
|
10
9
|
* @param defaultPrefix Prefix to set as the library's default.
|
|
11
10
|
*/
|
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Function which prefixes the provided `toPrefix` string. If no argument is
|
|
3
|
-
*
|
|
2
|
+
* Function which prefixes the provided `toPrefix` string. If no argument is provided, the prefix is
|
|
3
|
+
* returned as-is.
|
|
4
4
|
*/
|
|
5
5
|
export type PrefixFn = (toPrefix?: string) => string;
|
|
6
|
-
/**
|
|
7
|
-
* Hook which returns a function which can be used to prefix a string with the
|
|
8
|
-
* current prefix.
|
|
9
|
-
*/
|
|
6
|
+
/** Hook which returns a function which can be used to prefix a string with the current prefix. */
|
|
10
7
|
export declare function usePrefix(): PrefixFn;
|
|
@@ -25,9 +25,9 @@ export interface ToastManagerContextValue {
|
|
|
25
25
|
*/
|
|
26
26
|
addToast: (description: ReactNode, toastOptions?: ToastOptions) => ToastId;
|
|
27
27
|
/**
|
|
28
|
-
* Removes an existing toast with the given identifier. Calling `removeToast`
|
|
29
|
-
*
|
|
30
|
-
*
|
|
28
|
+
* Removes an existing toast with the given identifier. Calling `removeToast` with `null`,
|
|
29
|
+
* `undefined`, or the id of a toast which has already been removed is supported and behaves as a
|
|
30
|
+
* no-op.
|
|
31
31
|
*
|
|
32
32
|
* @param toastId Toast identifier.
|
|
33
33
|
*/
|
|
@@ -3,21 +3,18 @@ import { type ToastManagerContextValue } from "./ToastManagerContext.ts";
|
|
|
3
3
|
* Hook used to programmatically manage toasts within an application.
|
|
4
4
|
*
|
|
5
5
|
* @example
|
|
6
|
+
* const { addToast } = useToastManager();
|
|
6
7
|
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
* severity: "danger",
|
|
18
|
-
* });
|
|
8
|
+
* async function handleNewItemClick() {
|
|
9
|
+
* try {
|
|
10
|
+
* await api.createNewItem();
|
|
11
|
+
* addToast("New item created successfully!", { severity: "success" });
|
|
12
|
+
* } catch (err) {
|
|
13
|
+
* addToast(err.message, {
|
|
14
|
+
* title: "Error creating new item. :-(",
|
|
15
|
+
* severity: "danger",
|
|
16
|
+
* });
|
|
17
|
+
* }
|
|
19
18
|
* }
|
|
20
|
-
* }
|
|
21
|
-
* ```
|
|
22
19
|
*/
|
|
23
20
|
export declare function useToastManager(): ToastManagerContextValue;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -11,23 +11,22 @@ export declare const BREAKPOINTS: {
|
|
|
11
11
|
/** Type of available breakpoints. */
|
|
12
12
|
export type Breakpoint = keyof typeof BREAKPOINTS;
|
|
13
13
|
/**
|
|
14
|
-
* Hook that returns `true` when the screen size is greater or equal than the
|
|
15
|
-
*
|
|
14
|
+
* Hook that returns `true` when the screen size is greater or equal than the width of the provided
|
|
15
|
+
* breakpoint.
|
|
16
16
|
*
|
|
17
17
|
* @param breakpoint Breakpoint from which to match.
|
|
18
18
|
* @param options Media query options.
|
|
19
19
|
* @returns Whether the screen size is greater or equal than the width of the
|
|
20
|
-
*
|
|
20
|
+
* provided breakpoint.
|
|
21
21
|
*/
|
|
22
22
|
export declare function useMediaBreakpointUp(breakpoint: Breakpoint, options?: UseMediaQueryOptions): boolean;
|
|
23
23
|
/**
|
|
24
|
-
* Hook that returns `true` when the screen size is less than the width of the
|
|
25
|
-
* provided breakpoint.
|
|
24
|
+
* Hook that returns `true` when the screen size is less than the width of the provided breakpoint.
|
|
26
25
|
*
|
|
27
26
|
* @param breakpoint Breakpoint to up to which to match.
|
|
28
27
|
* @param options Media query options.
|
|
29
28
|
* @returns Whether the screen size is less than the width of the provided
|
|
30
|
-
*
|
|
29
|
+
* breakpoint.
|
|
31
30
|
*/
|
|
32
31
|
export declare function useMediaBreakpointDown(breakpoint: Breakpoint, options?: UseMediaQueryOptions): boolean;
|
|
33
32
|
/**
|