@ostack.tech/ui 1.2.0-beta.0 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunks/en-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 +26835 -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
|
@@ -12,9 +12,9 @@ export type LinkProps<TAs extends LinkAs = "a"> = PolymorphicProps<LinkAs, TAs,
|
|
|
12
12
|
/** Own properties of the link component. */
|
|
13
13
|
export interface LinkOwnProps {
|
|
14
14
|
/**
|
|
15
|
-
* Change the component to the HTML tag or custom component of the only child.
|
|
16
|
-
*
|
|
17
|
-
*
|
|
15
|
+
* Change the component to the HTML tag or custom component of the only child. This will merge the
|
|
16
|
+
* original component props with the props of the supplied element/component and change the
|
|
17
|
+
* underlying DOM node.
|
|
18
18
|
*/
|
|
19
19
|
asChild?: boolean;
|
|
20
20
|
/**
|
|
@@ -24,16 +24,16 @@ export interface LinkOwnProps {
|
|
|
24
24
|
*/
|
|
25
25
|
color?: LinkColor;
|
|
26
26
|
/**
|
|
27
|
-
* Link variant. Defaults to `"default"`, unless when rendered within an
|
|
28
|
-
*
|
|
27
|
+
* Link variant. Defaults to `"default"`, unless when rendered within an `Alert`, in which case
|
|
28
|
+
* the `"alert"` variant is used.
|
|
29
29
|
*/
|
|
30
30
|
variant?: LinkVariant;
|
|
31
31
|
/**
|
|
32
|
-
* Marks this link as external, making it open in a new tab (it sets both
|
|
33
|
-
* `
|
|
32
|
+
* Marks this link as external, making it open in a new tab (it sets both `target="_blank"` and
|
|
33
|
+
* `rel="noopener noreferrer"`).
|
|
34
34
|
*
|
|
35
|
-
* If a `Referer` header should be included when navigating, then the `rel`
|
|
36
|
-
*
|
|
35
|
+
* If a `Referer` header should be included when navigating, then the `rel` attribute should be
|
|
36
|
+
* overriden to simply `rel="noopener"`.
|
|
37
37
|
*/
|
|
38
38
|
external?: boolean;
|
|
39
39
|
/** Link icon. By default, only `external` links have an icon. */
|
|
@@ -42,9 +42,9 @@ export interface LinkOwnProps {
|
|
|
42
42
|
iconProps?: Omit<IconProps, "icon">;
|
|
43
43
|
}
|
|
44
44
|
/**
|
|
45
|
-
* The link component, with its `href` property, is used to create a hyperlink
|
|
46
|
-
*
|
|
47
|
-
*
|
|
45
|
+
* The link component, with its `href` property, is used to create a hyperlink to web pages, files,
|
|
46
|
+
* email addresses, locations in the same page, or anything else a URL can address. It is built on
|
|
47
|
+
* top of the browser's [`<a>` (anchor)
|
|
48
48
|
* element](https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/a).
|
|
49
49
|
*
|
|
50
50
|
* Example usage:
|
|
@@ -57,4 +57,4 @@ export interface LinkOwnProps {
|
|
|
57
57
|
* }
|
|
58
58
|
* ```
|
|
59
59
|
*/
|
|
60
|
-
export declare function Link<TAs extends LinkAs = "a">({ as, asChild, type, color, variant, external, icon, iconProps, className, children, ...otherProps }: LinkProps<TAs>): import("react").JSX.Element;
|
|
60
|
+
export declare function Link<TAs extends LinkAs = "a">({ as, asChild, type, color: colorProp, variant: variantProp, external, icon, iconProps, className, children, ...otherProps }: LinkProps<TAs>): import("react").JSX.Element;
|
|
@@ -5,9 +5,9 @@ export type MarkColor = AccentColor;
|
|
|
5
5
|
/** Properties of the mark component. */
|
|
6
6
|
export interface MarkProps extends ComponentProps<"mark"> {
|
|
7
7
|
/**
|
|
8
|
-
* Change the component to the HTML tag or custom component of the only child.
|
|
9
|
-
*
|
|
10
|
-
*
|
|
8
|
+
* Change the component to the HTML tag or custom component of the only child. This will merge the
|
|
9
|
+
* original component props with the props of the supplied element/component and change the
|
|
10
|
+
* underlying DOM node.
|
|
11
11
|
*/
|
|
12
12
|
asChild?: boolean;
|
|
13
13
|
/**
|
|
@@ -18,8 +18,8 @@ export interface MarkProps extends ComponentProps<"mark"> {
|
|
|
18
18
|
color?: MarkColor;
|
|
19
19
|
}
|
|
20
20
|
/**
|
|
21
|
-
* Component used to mark or highlight text for reference or notation purposes.
|
|
22
|
-
*
|
|
21
|
+
* Component used to mark or highlight text for reference or notation purposes. It is built on top
|
|
22
|
+
* of the browser's [`<mark>`
|
|
23
23
|
* element](https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/mark).
|
|
24
24
|
*
|
|
25
25
|
* Example usage:
|
|
@@ -30,8 +30,7 @@ export interface MarkProps extends ComponentProps<"mark"> {
|
|
|
30
30
|
* function HighlightedPassage() {
|
|
31
31
|
* return (
|
|
32
32
|
* <>
|
|
33
|
-
* “The study found that
|
|
34
|
-
* <Mark>climate change significantly impacts biodiversity</Mark>,
|
|
33
|
+
* “The study found that <Mark>climate change significantly impacts biodiversity</Mark>,
|
|
35
34
|
* leading to habitat loss and species extinction.”
|
|
36
35
|
* </>
|
|
37
36
|
* );
|
|
@@ -6,9 +6,9 @@ export type MenuListIconPlacement = "start" | "end";
|
|
|
6
6
|
/** Properties of the menu list component. */
|
|
7
7
|
export interface MenuListProps extends ComponentProps<"ul"> {
|
|
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
14
|
/**
|
|
@@ -18,16 +18,15 @@ export interface MenuListProps extends ComponentProps<"ul"> {
|
|
|
18
18
|
*/
|
|
19
19
|
variant?: MenuListVariant;
|
|
20
20
|
/**
|
|
21
|
-
* Default placement of icons within menu list items. This property can be
|
|
22
|
-
*
|
|
21
|
+
* Default placement of icons within menu list items. This property can be overridden on a
|
|
22
|
+
* per-item basis.
|
|
23
23
|
*
|
|
24
24
|
* @default start
|
|
25
25
|
*/
|
|
26
26
|
iconPlacement?: MenuListIconPlacement;
|
|
27
27
|
}
|
|
28
28
|
/**
|
|
29
|
-
* The menu list component is used to display a list as a menu of actionable
|
|
30
|
-
* items.
|
|
29
|
+
* The menu list component is used to display a list as a menu of actionable items.
|
|
31
30
|
*
|
|
32
31
|
* It composes the following subcomponents:
|
|
33
32
|
*
|
|
@@ -2,17 +2,16 @@ import { type ComponentProps, type ElementType, type ReactNode } from "react";
|
|
|
2
2
|
/** Properties of the menu list group component. */
|
|
3
3
|
export interface MenuListGroupProps extends ComponentProps<"ul"> {
|
|
4
4
|
/**
|
|
5
|
-
* Change the component to the HTML tag or custom component of the only child.
|
|
6
|
-
*
|
|
7
|
-
*
|
|
5
|
+
* Change the component to the HTML tag or custom component of the only child. This will merge the
|
|
6
|
+
* original component props with the props of the supplied element/component and change the
|
|
7
|
+
* underlying DOM node.
|
|
8
8
|
*/
|
|
9
9
|
asChild?: boolean;
|
|
10
10
|
/** Optional label of the menu list group. */
|
|
11
11
|
label?: ReactNode;
|
|
12
12
|
/**
|
|
13
|
-
* What the item element containing the group should be rendered as. Defaults
|
|
14
|
-
*
|
|
15
|
-
* `"div"`.
|
|
13
|
+
* What the item element containing the group should be rendered as. Defaults to `"li"` unless
|
|
14
|
+
* `asChild` is provided, in which case it defaults to `"div"`.
|
|
16
15
|
*/
|
|
17
16
|
itemAs?: ElementType;
|
|
18
17
|
/** Properties to pass to the item element containing the group. */
|
|
@@ -12,9 +12,9 @@ export type MenuListItemColor = AccentColor;
|
|
|
12
12
|
/** Properties of the menu list item component. */
|
|
13
13
|
export interface MenuListItemProps extends Omit<ComponentProps<"li">, "onSelect"> {
|
|
14
14
|
/**
|
|
15
|
-
* Change the component to the HTML tag or custom component of the only child.
|
|
16
|
-
*
|
|
17
|
-
*
|
|
15
|
+
* Change the component to the HTML tag or custom component of the only child. This will merge the
|
|
16
|
+
* original component props with the props of the supplied element/component and change the
|
|
17
|
+
* underlying DOM node.
|
|
18
18
|
*/
|
|
19
19
|
asChild?: boolean;
|
|
20
20
|
/**
|
|
@@ -42,33 +42,31 @@ export interface MenuListItemProps extends Omit<ComponentProps<"li">, "onSelect"
|
|
|
42
42
|
/**
|
|
43
43
|
* Renders the item in a **loading** state.
|
|
44
44
|
*
|
|
45
|
-
* When `true`, the item is “soft-disabled”: it looks disabled and ignores
|
|
46
|
-
*
|
|
47
|
-
*
|
|
45
|
+
* When `true`, the item is “soft-disabled”: it looks disabled and ignores user interaction but
|
|
46
|
+
* remains focusable. By default, a spinner is shown as the item's icon (i.e. `showSpinner` is set
|
|
47
|
+
* to `true` unless overridden).
|
|
48
48
|
*
|
|
49
|
-
* The item's content while loading can be controlled via `loadingContent`.
|
|
50
|
-
*
|
|
49
|
+
* The item's content while loading can be controlled via `loadingContent`. The position of the
|
|
50
|
+
* spinner may be controlled via `iconPlacement`.
|
|
51
51
|
*
|
|
52
|
-
* To only show a spinner without “soft-disabling” the item, set `showSpinner`
|
|
53
|
-
* instead.
|
|
52
|
+
* To only show a spinner without “soft-disabling” the item, set `showSpinner` instead.
|
|
54
53
|
*
|
|
55
54
|
* @default false
|
|
56
55
|
*/
|
|
57
56
|
loading?: boolean;
|
|
58
57
|
/**
|
|
59
|
-
* Content of the item when it is in "loading" state. If not provided, the
|
|
60
|
-
*
|
|
58
|
+
* Content of the item when it is in "loading" state. If not provided, the item content will
|
|
59
|
+
* remain unchanged.
|
|
61
60
|
*/
|
|
62
61
|
loadingContent?: ReactNode;
|
|
63
62
|
/**
|
|
64
63
|
* Whether to show a spinner as the item's icon.
|
|
65
64
|
*
|
|
66
|
-
* Defaults to the value of the `loading` property. In most cases, prefer
|
|
67
|
-
*
|
|
65
|
+
* Defaults to the value of the `loading` property. In most cases, prefer `loading`, which also
|
|
66
|
+
* “soft-disables” the item.
|
|
68
67
|
*
|
|
69
|
-
* Use `showSpinner` when you want a spinner **without** “soft-disabling” the
|
|
70
|
-
*
|
|
71
|
-
* `showSpinner` to `false`.
|
|
68
|
+
* Use `showSpinner` when you want a spinner **without** “soft-disabling” the item. To
|
|
69
|
+
* “soft-disable” **without** a spinner, set `loading` to `true` and `showSpinner` to `false`.
|
|
72
70
|
*
|
|
73
71
|
* The position of the spinner may be controlled via `iconPlacement`.
|
|
74
72
|
*
|
|
@@ -88,14 +86,12 @@ export interface MenuListItemProps extends Omit<ComponentProps<"li">, "onSelect"
|
|
|
88
86
|
*/
|
|
89
87
|
iconPlacement?: MenuListIconPlacement;
|
|
90
88
|
/**
|
|
91
|
-
* [`tinykeys`](https://jamiebuilds.github.io/tinykeys) keyboard shortcut
|
|
92
|
-
*
|
|
93
|
-
*
|
|
94
|
-
* `aria-keyshortcuts`.
|
|
89
|
+
* [`tinykeys`](https://jamiebuilds.github.io/tinykeys) keyboard shortcut keybinds used to trigger
|
|
90
|
+
* the action performed by the item. Rendered next to the item for visual users and announced to
|
|
91
|
+
* screen readers via `aria-keyshortcuts`.
|
|
95
92
|
*
|
|
96
|
-
* > **Note:** This property does **not** automatically register a keyboard
|
|
97
|
-
* >
|
|
98
|
-
* > the `useKeyboardShortcut` hook.
|
|
93
|
+
* > **Note:** This property does **not** automatically register a keyboard shortcut to run the
|
|
94
|
+
* > item's action. This should be done manually via e.g. the `useKeyboardShortcut` hook.
|
|
99
95
|
*/
|
|
100
96
|
keybinds?: KeyboardShortcutKeybinds;
|
|
101
97
|
/** Href for the link, when `type` is set to `"link"`. */
|
|
@@ -116,4 +112,4 @@ export interface MenuListItemProps extends Omit<ComponentProps<"li">, "onSelect"
|
|
|
116
112
|
keybindsProps?: Omit<KeybindsProps, "keybinds">;
|
|
117
113
|
}
|
|
118
114
|
/** Menu list item component. */
|
|
119
|
-
export declare function MenuListItem({ asChild, type, selected, onSelect, color, disabled, loading, loadingContent, showSpinner, icon, iconPlacement, keybinds, href, target, rel, actionProps, contentProps, iconProps, spinnerProps, keybindsProps, className, children, "aria-disabled": ariaDisabled, ...otherProps }: MenuListItemProps): import("react").JSX.Element;
|
|
115
|
+
export declare function MenuListItem({ asChild, type, selected, onSelect, color, disabled, loading, loadingContent, showSpinner, icon, iconPlacement: iconPlacementProp, keybinds, href, target, rel, actionProps, contentProps, iconProps, spinnerProps, keybindsProps, className, children, "aria-disabled": ariaDisabled, ...otherProps }: MenuListItemProps): import("react").JSX.Element;
|
|
@@ -16,53 +16,41 @@ export interface NumericInputProps extends NumericTransformerOptions, Omit<Contr
|
|
|
16
16
|
*/
|
|
17
17
|
onValueChange?: (valueRepresentations: NumericValueRepresentations) => void;
|
|
18
18
|
/**
|
|
19
|
-
* Set this property when passing in an unformatted string as `defaultValue`
|
|
20
|
-
* or `value`.
|
|
19
|
+
* Set this property when passing in an unformatted string as `defaultValue` or `value`.
|
|
21
20
|
*
|
|
22
21
|
* @default false
|
|
23
22
|
*/
|
|
24
23
|
valueIsUnformattedString?: boolean;
|
|
25
24
|
/**
|
|
26
|
-
* Specifies the precision of a number, set to `null` to have no limit on
|
|
27
|
-
*
|
|
28
|
-
* `0` otherwise.
|
|
25
|
+
* Specifies the precision of a number, set to `null` to have no limit on precision. When
|
|
26
|
+
* provided, a `scale` must also be set and will default to `0` otherwise.
|
|
29
27
|
*
|
|
30
28
|
* @default null
|
|
31
29
|
*/
|
|
32
30
|
precision?: number | null;
|
|
33
31
|
/**
|
|
34
|
-
* Minimum number allowed. If a string is provided, it should **not** be the
|
|
35
|
-
*
|
|
36
|
-
* `"999 999,99 €"`.
|
|
32
|
+
* Minimum number allowed. If a string is provided, it should **not** be the formatted
|
|
33
|
+
* representation, e.g. `"999999.99" should be provided instead of `"999 999,99 €"`.
|
|
37
34
|
*/
|
|
38
35
|
min?: string | number | bigint | null;
|
|
39
36
|
/**
|
|
40
|
-
* Maximum number allowed. If a string is provided, it should **not** be the
|
|
41
|
-
*
|
|
42
|
-
* `"999 999,99 €"`.
|
|
37
|
+
* Maximum number allowed. If a string is provided, it should **not** be the formatted
|
|
38
|
+
* representation, e.g. `"999999.99" should be provided instead of `"999 999,99 €"`.
|
|
43
39
|
*/
|
|
44
40
|
max?: string | number | bigint | null;
|
|
45
41
|
/**
|
|
46
|
-
* Value that the number should be greater than. If a string is provided, it
|
|
47
|
-
*
|
|
48
|
-
* provided instead of `"999 999,99 €"`.
|
|
42
|
+
* Value that the number should be greater than. If a string is provided, it should **not** be the
|
|
43
|
+
* formatted representation, e.g. `"999999.99" should be provided instead of `"999 999,99 €"`.
|
|
49
44
|
*/
|
|
50
45
|
exclusiveMin?: string | number | bigint | null;
|
|
51
46
|
/**
|
|
52
|
-
* Value that the number should be less than. If a string is provided, it
|
|
53
|
-
*
|
|
54
|
-
* provided instead of `"999 999,99 €"`.
|
|
47
|
+
* Value that the number should be less than. If a string is provided, it should **not** be the
|
|
48
|
+
* formatted representation, e.g. `"999999.99" should be provided instead of `"999 999,99 €"`.
|
|
55
49
|
*/
|
|
56
50
|
exclusiveMax?: string | number | bigint | null;
|
|
57
|
-
/**
|
|
58
|
-
* Custom validation function meant to validate the control when it is part of
|
|
59
|
-
* a `Form`.
|
|
60
|
-
*/
|
|
51
|
+
/** Custom validation function meant to validate the control when it is part of a `Form`. */
|
|
61
52
|
validate?: FormControlValidateFn<string>;
|
|
62
|
-
/**
|
|
63
|
-
* Specifies when the control should be validated. Defaults to the value
|
|
64
|
-
* specified in the `Form`.
|
|
65
|
-
*/
|
|
53
|
+
/** Specifies when the control should be validated. Defaults to the value specified in the `Form`. */
|
|
66
54
|
validationMode?: FormValidationMode;
|
|
67
55
|
}
|
|
68
56
|
/** Representations of the numeric value. */
|
|
@@ -75,17 +63,15 @@ export interface NumericValueRepresentations {
|
|
|
75
63
|
numberValue: number | null;
|
|
76
64
|
}
|
|
77
65
|
/**
|
|
78
|
-
* The numeric input component is used to collect numeric user input. It is
|
|
79
|
-
*
|
|
80
|
-
* and the [`react-number-format`
|
|
66
|
+
* The numeric input component is used to collect numeric user input. It is built on top of the
|
|
67
|
+
* [`Input` component](/docs/ostack-ui-forms-input--docs) and the [`react-number-format`
|
|
81
68
|
* library](https://s-yadav.github.io/react-number-format/).
|
|
82
69
|
*
|
|
83
|
-
* It supports specifying the precision, scale, separators, grouping of digits,
|
|
84
|
-
*
|
|
70
|
+
* It supports specifying the precision, scale, separators, grouping of digits, restrictions, or
|
|
71
|
+
* affixes of a number.
|
|
85
72
|
*
|
|
86
|
-
* For accessibility purposes, numeric inputs are usually included within a
|
|
87
|
-
* `
|
|
88
|
-
* `Feedback`.
|
|
73
|
+
* For accessibility purposes, numeric inputs are usually included within a `Field` together with a
|
|
74
|
+
* `Label` and optionally `HelperText` and/or `Feedback`.
|
|
89
75
|
*
|
|
90
76
|
* Example usage:
|
|
91
77
|
*
|
|
@@ -97,4 +83,4 @@ export interface NumericValueRepresentations {
|
|
|
97
83
|
* }
|
|
98
84
|
* ```
|
|
99
85
|
*/
|
|
100
|
-
export declare function NumericInput({ name, defaultValue, value: controlledValue, valueIsUnformattedString, valueIsInteger, onValueChange, onBlurToOutside, precision, scale, fixedScale, decimalSeparator, groupDigits, groupingStyle, groupSeparator, prefix, suffix, min, max, exclusiveMin, exclusiveMax, validate, validationMode, required, disabled, readOnly, status, autoComplete, form, ref, ...otherProps }: NumericInputProps): import("react").JSX.Element;
|
|
86
|
+
export declare function NumericInput({ name, defaultValue, value: controlledValue, valueIsUnformattedString, valueIsInteger, onValueChange, onBlurToOutside, precision, scale: scaleProp, fixedScale: fixedScaleProp, decimalSeparator: decimalSeparatorProp, groupDigits, groupingStyle: groupingStyleProp, groupSeparator: groupSeparatorProp, prefix, suffix, min, max, exclusiveMin, exclusiveMax, validate, validationMode, required, disabled: disabledProp, readOnly, status: statusProp, autoComplete, form, ref, ...otherProps }: NumericInputProps): import("react").JSX.Element;
|
|
@@ -8,16 +8,15 @@ export declare function validateNumericProps({ valueIsInteger, precision, scale,
|
|
|
8
8
|
exclusiveMaxString?: string;
|
|
9
9
|
}): void;
|
|
10
10
|
/**
|
|
11
|
-
* Transforms the provided value into a string value to be accepted by
|
|
12
|
-
*
|
|
13
|
-
* is an integer value with a scale.
|
|
11
|
+
* Transforms the provided value into a string value to be accepted by `react-number-format`. In
|
|
12
|
+
* particular, the value needs transformation when it is an integer value with a scale.
|
|
14
13
|
*/
|
|
15
14
|
export declare function valueToRNFString(value: string | number | bigint | null | undefined, valueIsInteger: boolean, formatProps: NumericFormatProps): string;
|
|
16
15
|
/** Transforms the provided value into a string value. */
|
|
17
16
|
export declare function valueToStringValue(value: string | number | bigint | null | undefined, valueIsInteger: boolean, formatProps: NumericFormatProps): string;
|
|
18
17
|
/**
|
|
19
|
-
* Converts the `react-number-format` values representation into our own
|
|
20
|
-
*
|
|
18
|
+
* Converts the `react-number-format` values representation into our own representation, while
|
|
19
|
+
* handling the case of integer values with a scale.
|
|
21
20
|
*/
|
|
22
21
|
export declare function transformNumberFormatValues({ formattedValue, value, floatValue }: NumberFormatValues, valueIsInteger: boolean, scale: number | null | undefined): NumericValueRepresentations;
|
|
23
22
|
/** Transforms the numeric scale into a `step` value. */
|
|
@@ -5,30 +5,29 @@ export interface OutputProps extends Omit<ControlOutputProps, "asChild" | "disab
|
|
|
5
5
|
/**
|
|
6
6
|
* Renders the output in a **pending** state.
|
|
7
7
|
*
|
|
8
|
-
* When `true`, the value should be treated as not final (for example, it is
|
|
9
|
-
*
|
|
10
|
-
*
|
|
8
|
+
* When `true`, the value should be treated as not final (for example, it is still being
|
|
9
|
+
* calculated or refreshed). While pending, the output is marked as busy for assistive
|
|
10
|
+
* technologies.
|
|
11
11
|
*
|
|
12
12
|
* The output's content while pending can be controlled via `pendingContent`.
|
|
13
13
|
*
|
|
14
|
-
* To show a spinner without marking the output as `pending`, set
|
|
15
|
-
* `showSpinner` instead.
|
|
14
|
+
* To show a spinner without marking the output as `pending`, set `showSpinner` instead.
|
|
16
15
|
*/
|
|
17
16
|
pending?: boolean;
|
|
18
17
|
/**
|
|
19
|
-
* Content to show while the output is in a **pending** state. If not
|
|
20
|
-
*
|
|
18
|
+
* Content to show while the output is in a **pending** state. If not provided, the output content
|
|
19
|
+
* will remain unchanged.
|
|
21
20
|
*/
|
|
22
21
|
pendingContent?: ReactNode;
|
|
23
22
|
}
|
|
24
23
|
/**
|
|
25
|
-
* The output component is used to display the result of a calculation or user
|
|
26
|
-
*
|
|
27
|
-
* element](https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/output)
|
|
28
|
-
*
|
|
24
|
+
* The output component is used to display the result of a calculation or user action. It is built
|
|
25
|
+
* on top of the browser's [`<output>`
|
|
26
|
+
* element](https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/output) as well as
|
|
27
|
+
* our own `Input` component in “read-only” mode.
|
|
29
28
|
*
|
|
30
|
-
* For accessibility purposes, outputs are usually included within a `Field`
|
|
31
|
-
*
|
|
29
|
+
* For accessibility purposes, outputs are usually included within a `Field` together with a `Label`
|
|
30
|
+
* and optionally `HelperText` and/or `Feedback`.
|
|
32
31
|
*
|
|
33
32
|
* Example usage:
|
|
34
33
|
*
|
|
@@ -4,28 +4,21 @@ import type { ComponentProps } from "react";
|
|
|
4
4
|
export interface PopoverProps extends ComponentProps<typeof PopoverPrimitive.Root> {
|
|
5
5
|
}
|
|
6
6
|
/**
|
|
7
|
-
* The popover component displays content in a floating pop-up, triggered by a
|
|
8
|
-
*
|
|
9
|
-
* primitive](https://www.radix-ui.com/primitives/docs/components/popover)
|
|
7
|
+
* The popover component displays content in a floating pop-up, triggered by a button. Built on top
|
|
8
|
+
* of the [Radix Popover primitive](https://www.radix-ui.com/primitives/docs/components/popover)
|
|
10
9
|
*
|
|
11
10
|
* It composes the following subcomponents:
|
|
12
11
|
*
|
|
13
|
-
* - `PopoverTrigger`: Button that toggles the popover. By default, popover
|
|
14
|
-
*
|
|
12
|
+
* - `PopoverTrigger`: Button that toggles the popover. By default, popover content positions itself
|
|
13
|
+
* against this component.
|
|
15
14
|
* - `PopoverContent`: Content that pops out when the popover is open.
|
|
16
|
-
* - `PopoverAnchor`: Optional element to position the popover content against
|
|
17
|
-
* instead of the trigger.
|
|
15
|
+
* - `PopoverAnchor`: Optional element to position the popover content against instead of the trigger.
|
|
18
16
|
* - `PopoverClose`: Optional button that closes an open popover.
|
|
19
17
|
*
|
|
20
18
|
* Example usage:
|
|
21
19
|
*
|
|
22
20
|
* ```tsx
|
|
23
|
-
* import {
|
|
24
|
-
* Button,
|
|
25
|
-
* Popover,
|
|
26
|
-
* PopoverContent,
|
|
27
|
-
* PopoverTrigger,
|
|
28
|
-
* } from "@ostack.tech/ui";
|
|
21
|
+
* import { Button, Popover, PopoverContent, PopoverTrigger } from "@ostack.tech/ui";
|
|
29
22
|
*
|
|
30
23
|
* export function AccountInformation() {
|
|
31
24
|
* return (
|
|
@@ -4,7 +4,7 @@ import type { ComponentProps } from "react";
|
|
|
4
4
|
export interface PopoverAnchorProps extends ComponentProps<typeof PopoverPrimitive.Anchor> {
|
|
5
5
|
}
|
|
6
6
|
/**
|
|
7
|
-
* An optional element to position the `PopoverContent` against. If this part is
|
|
8
|
-
*
|
|
7
|
+
* An optional element to position the `PopoverContent` against. If this part is not used, the
|
|
8
|
+
* content will position alongside the `PopoverTrigger`.
|
|
9
9
|
*/
|
|
10
10
|
export declare const PopoverAnchor: import("react").ForwardRefExoticComponent<PopoverPrimitive.PopoverAnchorProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
@@ -4,7 +4,7 @@ import type { ComponentProps } from "react";
|
|
|
4
4
|
export interface PopoverTriggerProps extends Omit<ComponentProps<typeof PopoverPrimitive.Trigger>, "asChild"> {
|
|
5
5
|
}
|
|
6
6
|
/**
|
|
7
|
-
* The button that toggles the popover. By default, the `PopoverContent` will
|
|
8
|
-
*
|
|
7
|
+
* The button that toggles the popover. By default, the `PopoverContent` will position itself
|
|
8
|
+
* against the trigger.
|
|
9
9
|
*/
|
|
10
10
|
export declare function PopoverTrigger(props: PopoverTriggerProps): import("react").JSX.Element;
|
|
@@ -4,10 +4,9 @@ import type { ComponentProps } from "react";
|
|
|
4
4
|
export interface PortalProps extends ComponentProps<typeof PortalPrimitive.Root> {
|
|
5
5
|
}
|
|
6
6
|
/**
|
|
7
|
-
* Portal component used to render a React subtree in a different part of the
|
|
8
|
-
* DOM.
|
|
7
|
+
* Portal component used to render a React subtree in a different part of the DOM.
|
|
9
8
|
*
|
|
10
|
-
* The rendered subtree is automatically wrapped in a `Root` component, so that
|
|
11
|
-
*
|
|
9
|
+
* The rendered subtree is automatically wrapped in a `Root` component, so that styles are rendered
|
|
10
|
+
* correctly.
|
|
12
11
|
*/
|
|
13
12
|
export declare function Portal({ asChild, children, ...otherProps }: PortalProps): import("react").JSX.Element;
|
|
@@ -3,21 +3,20 @@ import { type UseReactToPrintOptions } from "react-to-print";
|
|
|
3
3
|
/** Options that can be passed when calling `print`. */
|
|
4
4
|
export interface PrintOptions {
|
|
5
5
|
/**
|
|
6
|
-
* Title of the `<iframe>` document, used by some browsers when saving as a
|
|
7
|
-
* file.
|
|
6
|
+
* Title of the `<iframe>` document, used by some browsers when saving as a file.
|
|
8
7
|
*
|
|
9
8
|
* A function may be provided which will be called before each print.
|
|
10
9
|
*/
|
|
11
10
|
documentTitle?: string | (() => string | undefined);
|
|
12
11
|
/**
|
|
13
|
-
* [`size`](https://developer.mozilla.org/en-US/docs/Web/CSS/Reference/At-rules/@page/size)
|
|
14
|
-
*
|
|
15
|
-
*
|
|
12
|
+
* [`size`](https://developer.mozilla.org/en-US/docs/Web/CSS/Reference/At-rules/@page/size) to
|
|
13
|
+
* apply to print pages. This property can be used to specify custom page sizes and/or page
|
|
14
|
+
* orientation. By default, the browser default is used.
|
|
16
15
|
*/
|
|
17
16
|
pageSize?: string;
|
|
18
17
|
/**
|
|
19
|
-
* Margin to apply to print pages. By default, no margin is specified and the
|
|
20
|
-
*
|
|
18
|
+
* Margin to apply to print pages. By default, no margin is specified and the browser default is
|
|
19
|
+
* used.
|
|
21
20
|
*/
|
|
22
21
|
pageMargin?: CSSProperties["margin"];
|
|
23
22
|
/**
|
|
@@ -30,13 +29,13 @@ export interface PrintOptions {
|
|
|
30
29
|
/**
|
|
31
30
|
* A list of fonts to load into the printing `<iframe>`.
|
|
32
31
|
*
|
|
33
|
-
* Useful when using custom fonts: the printing will be halted until all fonts
|
|
34
|
-
*
|
|
32
|
+
* Useful when using custom fonts: the printing will be halted until all fonts are loaded to
|
|
33
|
+
* ensure that the content is able to use said fonts.
|
|
35
34
|
*/
|
|
36
35
|
fonts?: UseReactToPrintOptions["fonts"];
|
|
37
36
|
/**
|
|
38
|
-
* Copy shadow root content into the print `<iframe>`. Use with care when
|
|
39
|
-
*
|
|
37
|
+
* Copy shadow root content into the print `<iframe>`. Use with care when printing large documents
|
|
38
|
+
* as traversing these can be slow.
|
|
40
39
|
*
|
|
41
40
|
* @default false
|
|
42
41
|
*/
|
|
@@ -44,14 +43,10 @@ export interface PrintOptions {
|
|
|
44
43
|
/**
|
|
45
44
|
* Set the
|
|
46
45
|
* [`nonce`](https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Global_attributes/nonce)
|
|
47
|
-
* attribute for allow-listing script and style elements for Content Security
|
|
48
|
-
* Policy (CSP).
|
|
46
|
+
* attribute for allow-listing script and style elements for Content Security Policy (CSP).
|
|
49
47
|
*/
|
|
50
48
|
nonce?: string;
|
|
51
|
-
/**
|
|
52
|
-
* Custom print function. By default, the `<iframe>` window's `print` function
|
|
53
|
-
* is called.
|
|
54
|
-
*/
|
|
49
|
+
/** Custom print function. By default, the `<iframe>` window's `print` function is called. */
|
|
55
50
|
printFn?: UseReactToPrintOptions["print"];
|
|
56
51
|
/** Properties to pass to the `<iframe>` used for printing. */
|
|
57
52
|
iframeProps?: UseReactToPrintOptions["printIframeProps"];
|
|
@@ -59,64 +54,60 @@ export interface PrintOptions {
|
|
|
59
54
|
/** Properties of the printer component. */
|
|
60
55
|
export interface PrinterProps extends PrintOptions {
|
|
61
56
|
/**
|
|
62
|
-
* Whether to render the printer content as if it were being printed. This
|
|
63
|
-
*
|
|
57
|
+
* Whether to render the printer content as if it were being printed. This property is expected to
|
|
58
|
+
* be used only for development/testing purposes.
|
|
64
59
|
*
|
|
65
|
-
* When `true`, this effectively causes the printer to “print” in the
|
|
66
|
-
*
|
|
60
|
+
* When `true`, this effectively causes the printer to “print” in the foreground, so the
|
|
61
|
+
* `printInForeground` property is ignored.
|
|
67
62
|
*
|
|
68
63
|
* @default false
|
|
69
64
|
*/
|
|
70
65
|
preview?: boolean;
|
|
71
66
|
/**
|
|
72
|
-
* By default, the provided `children` will be rendered twice while printing:
|
|
73
|
-
*
|
|
74
|
-
* “portalled” element for printing.
|
|
67
|
+
* By default, the provided `children` will be rendered twice while printing: once for the content
|
|
68
|
+
* displayed on screen; and another in a hidden “portalled” element for printing.
|
|
75
69
|
*
|
|
76
|
-
* By setting the property to `true`, the content visible on the screen itself
|
|
77
|
-
*
|
|
78
|
-
*
|
|
79
|
-
* differently while printing, a user will notice it changing.
|
|
70
|
+
* By setting the property to `true`, the content visible on the screen itself will be printed.
|
|
71
|
+
* Note that this content will see `printing` set to `true` in the printer context while printing;
|
|
72
|
+
* so if the content behaves differently while printing, a user will notice it changing.
|
|
80
73
|
*
|
|
81
|
-
* This property has no effect when `preview` is set, since the previewed
|
|
82
|
-
*
|
|
74
|
+
* This property has no effect when `preview` is set, since the previewed content is shown in the
|
|
75
|
+
* foreground.
|
|
83
76
|
*
|
|
84
77
|
* @default false
|
|
85
78
|
*/
|
|
86
79
|
printInForeground?: boolean;
|
|
87
80
|
/**
|
|
88
|
-
* Function called just before printing starts, but after the content is ready
|
|
89
|
-
* to
|
|
90
|
-
*
|
|
81
|
+
* Function called just before printing starts, but after the content is ready to be copied over
|
|
82
|
+
* to an `<iframe>` for printing. If a promise is returned, printing is halted until it
|
|
83
|
+
* completes.
|
|
91
84
|
*
|
|
92
|
-
* @param event Before print event. Calling `event.preventDefault()` will
|
|
93
|
-
*
|
|
85
|
+
* @param event Before print event. Calling `event.preventDefault()` will prevent printing from
|
|
86
|
+
* occurring.
|
|
94
87
|
*/
|
|
95
88
|
onBeforePrint?: (event: Event) => void | PromiseLike<void>;
|
|
96
89
|
/**
|
|
97
90
|
* Function called after printing finishes.
|
|
98
91
|
*
|
|
99
|
-
* @param event After print event. Calling `event.preventDefault()` will
|
|
100
|
-
*
|
|
92
|
+
* @param event After print event. Calling `event.preventDefault()` will prevent focusing of the
|
|
93
|
+
* print trigger from occurring.
|
|
101
94
|
*/
|
|
102
95
|
onAfterPrint?: (event: Event) => void;
|
|
103
96
|
children?: ReactNode;
|
|
104
97
|
}
|
|
105
98
|
/**
|
|
106
|
-
* Component used to print content using the browser's printing functionality.
|
|
107
|
-
*
|
|
108
|
-
* browser.
|
|
99
|
+
* Component used to print content using the browser's printing functionality. The content is copied
|
|
100
|
+
* to a hidden `<iframe>` which is then printed by the browser.
|
|
109
101
|
*
|
|
110
|
-
* Content being printed is aware of the fact that it is being printed and can
|
|
111
|
-
*
|
|
112
|
-
*
|
|
102
|
+
* Content being printed is aware of the fact that it is being printed and can adapt its appearance
|
|
103
|
+
* accordingly. Use the `usePrinting` and `useStartPrintingTask` hooks to control the printing
|
|
104
|
+
* behaviour.
|
|
113
105
|
*
|
|
114
|
-
* Built on top of the
|
|
115
|
-
* [`react-to-print`](https://github.com/MatthewHerbst/react-to-print) package.
|
|
106
|
+
* Built on top of the [`react-to-print`](https://github.com/MatthewHerbst/react-to-print) package.
|
|
116
107
|
*
|
|
117
|
-
* > **Note:** While printing, the content to print is typically (unless
|
|
118
|
-
* >
|
|
119
|
-
* >
|
|
108
|
+
* > **Note:** While printing, the content to print is typically (unless `printInForeground` is
|
|
109
|
+
* > provided) rendered twice: once for the content visible on the screen and another in a hidden and
|
|
110
|
+
* > “portalled” element for printing.
|
|
120
111
|
*
|
|
121
112
|
* It composes the following subcomponents:
|
|
122
113
|
*
|
|
@@ -126,12 +117,7 @@ export interface PrinterProps extends PrintOptions {
|
|
|
126
117
|
* Example usage:
|
|
127
118
|
*
|
|
128
119
|
* ```tsx
|
|
129
|
-
* import {
|
|
130
|
-
* Button,
|
|
131
|
-
* Printer,
|
|
132
|
-
* PrinterContent,
|
|
133
|
-
* PrinterTrigger,
|
|
134
|
-
* } from "@ostack.tech/ui";
|
|
120
|
+
* import { Button, Printer, PrinterContent, PrinterTrigger } from "@ostack.tech/ui";
|
|
135
121
|
*
|
|
136
122
|
* function ContentToPrint() {
|
|
137
123
|
* return (
|