@ostack.tech/ui 0.6.5 → 0.8.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-C2peM913.js → en-BfgHKQwn.js} +2 -1
- package/dist/chunks/en-BfgHKQwn.js.map +1 -0
- package/dist/locales/en-GB.js +1 -1
- package/dist/locales/en-US.js +1 -1
- package/dist/locales/fr-FR.js +1 -0
- package/dist/locales/fr-FR.js.map +1 -1
- package/dist/locales/pt-PT.js +1 -0
- package/dist/locales/pt-PT.js.map +1 -1
- package/dist/ostack-ui.css +15 -12
- package/dist/ostack-ui.css.map +1 -1
- package/dist/ostack-ui.js +1266 -1086
- package/dist/ostack-ui.js.map +1 -1
- package/dist/types/components/Alert/Alert.d.ts +1 -1
- package/dist/types/components/Alert/AlertTitle.d.ts +7 -3
- package/dist/types/components/AlertDialog/AlertDialogTitle.d.ts +7 -2
- package/dist/types/components/Button/Button.d.ts +43 -13
- package/dist/types/components/Calendar/Calendar.d.ts +2 -2
- package/dist/types/components/Card/CardTitle.d.ts +8 -11
- package/dist/types/components/Checkbox/Checkbox.d.ts +26 -2
- package/dist/types/components/CheckboxGroup/CheckboxGroup.d.ts +29 -2
- package/dist/types/components/CheckboxGroup/CheckboxGroupContext.d.ts +4 -0
- package/dist/types/components/CloseButton/CloseButton.d.ts +1 -1
- package/dist/types/components/CommandMenu/CommandMenuItem.d.ts +1 -1
- package/dist/types/components/DataTable/DataTablePagination.d.ts +2 -2
- package/dist/types/components/DataTable/DataTableSelectionTrigger.d.ts +1 -1
- package/dist/types/components/DateRangeInput/DateRangeInput.d.ts +47 -12
- package/dist/types/components/Dialog/DialogTitle.d.ts +7 -2
- package/dist/types/components/DropdownMenu/DropdownMenuCheckboxItem.d.ts +1 -1
- package/dist/types/components/DropdownMenu/DropdownMenuItem.d.ts +1 -1
- package/dist/types/components/DropdownMenu/DropdownMenuRadioItem.d.ts +1 -1
- package/dist/types/components/ErrorBoundary/ErrorBoundary.d.ts +1 -1
- package/dist/types/components/FeedbackPopover/FeedbackPopover.d.ts +1 -1
- package/dist/types/components/Field/FieldContext.d.ts +1 -0
- package/dist/types/components/FieldGroup/FieldGroupTitle.d.ts +7 -10
- package/dist/types/components/Heading/Heading.d.ts +13 -6
- package/dist/types/components/IconButton/IconButton.d.ts +44 -12
- package/dist/types/components/Input/Input.d.ts +32 -2
- package/dist/types/components/Label/Label.d.ts +1 -1
- package/dist/types/components/Link/Link.d.ts +8 -3
- package/dist/types/components/MenuList/MenuListItem.d.ts +36 -17
- package/dist/types/components/Output/Output.d.ts +20 -2
- package/dist/types/components/RadioGroup/Radio.d.ts +26 -2
- package/dist/types/components/RadioGroup/RadioGroup.d.ts +26 -2
- package/dist/types/components/Select/Select.d.ts +2 -2
- package/dist/types/components/Table/TableColumn.d.ts +2 -2
- package/dist/types/index.d.ts +3 -1
- package/dist/types/providers/AlertDialogProvider/AlertDialogProviderContext.d.ts +2 -2
- package/dist/types/providers/LocalizationProvider/LocalizationObject.d.ts +1 -1
- package/dist/types/utils/combineAriaIds.d.ts +2 -0
- package/dist/types/utils/control.d.ts +1 -0
- package/dist/types/utils/polymorphicTypes.d.ts +23 -0
- package/dist/types/utils/setNativeProperty.d.ts +8 -0
- package/package.json +1 -1
- package/scss/components/Checkbox/_Checkbox.scss +1 -1
- package/scss/components/ControlAddon/_ControlAddon.scss +3 -3
- package/scss/components/DropdownMenu/_DropdownMenu.scss +1 -1
- package/scss/components/FieldGroup/_FieldGroup-variables.scss +3 -3
- package/scss/components/RadioGroup/_Radio.scss +1 -1
- package/scss/components/Select/_Select-variables.scss +1 -1
- package/scss/components/Select/_Select.scss +1 -1
- package/scss/scss/placeholders/checkable/_checkable.scss +3 -3
- package/scss/scss/placeholders/control/_control.scss +1 -1
- package/scss/scss/placeholders/menu/_menu.scss +8 -3
- package/scss/scss/placeholders/popover/_popover.scss +10 -12
- package/scss/scss/utils/_breakpoints.scss +4 -5
- package/scss/scss/utils/_css-color-functions.scss +10 -6
- package/scss/scss/utils/_declare-var.scss +1 -1
- package/scss/scss/utils/_maybe-important.scss +1 -1
- package/scss/scss/utils/_spacing.scss +10 -5
- package/dist/chunks/en-C2peM913.js.map +0 -1
- package/dist/types/utils/mergeAriaIds.d.ts +0 -2
- package/dist/types/utils/setNativeValue.d.ts +0 -7
|
@@ -1,8 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { ComponentPropsWithRef, ReactElement, ReactNode } from 'react';
|
|
2
|
+
import { PolymorphicComponent, PolymorphicProps } from '../../utils/polymorphicTypes.ts';
|
|
3
|
+
import { ButtonAs, ButtonColor, ButtonSize, ButtonVariant } from '../Button';
|
|
3
4
|
import { Icon, IconProp } from '../Icon';
|
|
4
5
|
import { Spinner } from '../Spinner';
|
|
5
6
|
import { Tooltip } from '../Tooltip';
|
|
7
|
+
/** Elements an icon button can be rendered as. */
|
|
8
|
+
export type IconButtonAs = ButtonAs;
|
|
6
9
|
/** Icon button variants. */
|
|
7
10
|
export type IconButtonVariant = ButtonVariant;
|
|
8
11
|
/** Icon button colours. */
|
|
@@ -10,7 +13,9 @@ export type IconButtonColor = ButtonColor;
|
|
|
10
13
|
/** Icon button sizes. */
|
|
11
14
|
export type IconButtonSize = ButtonSize;
|
|
12
15
|
/** Properties of the icon button component. */
|
|
13
|
-
export
|
|
16
|
+
export type IconButtonProps<TAs extends IconButtonAs = "button"> = PolymorphicProps<IconButtonAs, TAs, "button", IconButtonOwnProps>;
|
|
17
|
+
/** Own properties of the icon button component. */
|
|
18
|
+
export interface IconButtonOwnProps {
|
|
14
19
|
/**
|
|
15
20
|
* Change the component to the HTML tag or custom component of the only child.
|
|
16
21
|
* This will merge the original component props with the props of the supplied
|
|
@@ -61,23 +66,50 @@ export interface IconButtonProps extends Omit<ComponentPropsWithoutRef<"button">
|
|
|
61
66
|
*/
|
|
62
67
|
disabled?: boolean;
|
|
63
68
|
/**
|
|
64
|
-
*
|
|
65
|
-
* button displays a spinner instead of its icon.
|
|
69
|
+
* Renders the icon button in a **loading** state.
|
|
66
70
|
*
|
|
67
|
-
*
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
*
|
|
71
|
+
* When `true`, the button is “soft-disabled”: it looks disabled and ignores
|
|
72
|
+
* user interaction but remains focusable. By default, a spinner is shown as
|
|
73
|
+
* the button's icon (_i.e._, `showSpinner` is set to `true` unless
|
|
74
|
+
* overridden).
|
|
75
|
+
*
|
|
76
|
+
* The button's label while loading can be controlled via `loadingLabel`.
|
|
77
|
+
*
|
|
78
|
+
* To only show a spinner without “soft-disabling” the button, set
|
|
79
|
+
* `showSpinner` instead.
|
|
80
|
+
*
|
|
81
|
+
* @example
|
|
82
|
+
*
|
|
83
|
+
* ```tsx
|
|
84
|
+
* <IconButton
|
|
85
|
+
* icon={faFloppyDisk}
|
|
86
|
+
* label="Save"
|
|
87
|
+
* loading={saving}
|
|
88
|
+
* loadingLabel="Saving…"
|
|
89
|
+
* />;
|
|
90
|
+
* ```
|
|
72
91
|
*
|
|
73
92
|
* @default false
|
|
74
93
|
*/
|
|
75
|
-
|
|
94
|
+
loading?: boolean;
|
|
76
95
|
/**
|
|
77
96
|
* Label of the icon button when it is in "loading" state. If not provided,
|
|
78
97
|
* the label will remain unchanged.
|
|
79
98
|
*/
|
|
80
99
|
loadingLabel?: ReactNode;
|
|
100
|
+
/**
|
|
101
|
+
* Whether to show a spinner as the icon button's icon.
|
|
102
|
+
*
|
|
103
|
+
* Defaults to the value of the `loading` property. In most cases, prefer
|
|
104
|
+
* `loading`, which also “soft-disables” the button.
|
|
105
|
+
*
|
|
106
|
+
* Use `showSpinner` when you want a spinner **without** “soft-disabling” the
|
|
107
|
+
* button. To “soft-disable” **without** a spinner, set `loading` to `true`
|
|
108
|
+
* and `showSpinner` to `false`.
|
|
109
|
+
*
|
|
110
|
+
* @default loading
|
|
111
|
+
*/
|
|
112
|
+
showSpinner?: boolean;
|
|
81
113
|
/**
|
|
82
114
|
* Whether to disable showing the icon button's label in a tooltip. Disabling
|
|
83
115
|
* the tooltip does **not** affect the button's accessibility.
|
|
@@ -117,4 +149,4 @@ export interface IconButtonProps extends Omit<ComponentPropsWithoutRef<"button">
|
|
|
117
149
|
* }
|
|
118
150
|
* ```
|
|
119
151
|
*/
|
|
120
|
-
export declare const IconButton:
|
|
152
|
+
export declare const IconButton: PolymorphicComponent<IconButtonAs, "button", IconButtonOwnProps>;
|
|
@@ -27,12 +27,42 @@ export interface InputPropsBase {
|
|
|
27
27
|
/** Input code. */
|
|
28
28
|
code?: ReactNode;
|
|
29
29
|
/**
|
|
30
|
-
*
|
|
31
|
-
*
|
|
30
|
+
* Renders the input in a **loading** state.
|
|
31
|
+
*
|
|
32
|
+
* When `true`, the input is “soft-disabled”: it looks disabled and ignores
|
|
33
|
+
* user interaction but remains focusable. By default, a spinner is shown
|
|
34
|
+
* (_i.e._, `showSpinner` is set to `true` unless overridden).
|
|
35
|
+
*
|
|
36
|
+
* The input's accessible description while loading can be controlled via
|
|
37
|
+
* `loadingDescription`.
|
|
38
|
+
*
|
|
39
|
+
* To only show a spinner without “soft-disabling” the input, set
|
|
40
|
+
* `showSpinner` instead.
|
|
41
|
+
*
|
|
42
|
+
* @example
|
|
43
|
+
*
|
|
44
|
+
* ```tsx
|
|
45
|
+
* <Input loading={fetching} loadingDescription="Fetching…" />;
|
|
46
|
+
* ```
|
|
32
47
|
*
|
|
33
48
|
* @default false
|
|
34
49
|
*/
|
|
35
50
|
loading?: boolean;
|
|
51
|
+
/** Accessible description of the input when it is in a “loading” state. */
|
|
52
|
+
loadingDescription?: ReactNode;
|
|
53
|
+
/**
|
|
54
|
+
* Whether to show a spinner in the input.
|
|
55
|
+
*
|
|
56
|
+
* Defaults to the value of the `loading` property. In most cases, prefer
|
|
57
|
+
* `loading`, which also “soft-disables” the input.
|
|
58
|
+
*
|
|
59
|
+
* Use `showSpinner` when you want a spinner **without** “soft-disabling” the
|
|
60
|
+
* input. To “soft-disable” **without** a spinner, set `loading` to `true` and
|
|
61
|
+
* `showSpinner` to `false`.
|
|
62
|
+
*
|
|
63
|
+
* @default loading
|
|
64
|
+
*/
|
|
65
|
+
showSpinner?: boolean;
|
|
36
66
|
/** Sets the input's text align. */
|
|
37
67
|
align?: Responsive<CSSProperties["textAlign"]>;
|
|
38
68
|
/** Input's start adornment. */
|
|
@@ -20,7 +20,7 @@ export interface LabelProps extends ComponentPropsWithoutRef<typeof LabelPrimiti
|
|
|
20
20
|
/** Properties to pass to the required icon component. */
|
|
21
21
|
requiredIconProps?: Omit<ComponentPropsWithRef<typeof Icon>, "icon">;
|
|
22
22
|
/** Properties to pass to the helper button component. */
|
|
23
|
-
helperButtonProps?: Omit<ComponentPropsWithRef<typeof IconButton
|
|
23
|
+
helperButtonProps?: Omit<ComponentPropsWithRef<typeof IconButton<"button">>, "icon">;
|
|
24
24
|
/** Properties to pass to the helper popover component. */
|
|
25
25
|
helperPopoverProps?: ComponentPropsWithRef<typeof Popover>;
|
|
26
26
|
/** Properties to pass to the helper popover content component. */
|
|
@@ -1,12 +1,17 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ComponentPropsWithRef } from 'react';
|
|
2
2
|
import { AccentColor } from '../../utils/accent.ts';
|
|
3
|
+
import { PolymorphicComponent, PolymorphicProps } from '../../utils/polymorphicTypes.ts';
|
|
3
4
|
import { Icon, IconProp } from '../Icon';
|
|
5
|
+
/** Elements a link can be rendered as. */
|
|
6
|
+
export type LinkAs = "a" | "button";
|
|
4
7
|
/** Link variants. */
|
|
5
8
|
export type LinkVariant = "default" | "alert";
|
|
6
9
|
/** Link colours. */
|
|
7
10
|
export type LinkColor = AccentColor;
|
|
8
11
|
/** Properties of the link component. */
|
|
9
|
-
export
|
|
12
|
+
export type LinkProps<TAs extends LinkAs = "a"> = PolymorphicProps<LinkAs, TAs, "a", LinkOwnProps>;
|
|
13
|
+
/** Own properties of the link component. */
|
|
14
|
+
export interface LinkOwnProps {
|
|
10
15
|
/**
|
|
11
16
|
* Change the component to the HTML tag or custom component of the only child.
|
|
12
17
|
* This will merge the original component props with the props of the supplied
|
|
@@ -55,4 +60,4 @@ export interface LinkProps extends ComponentPropsWithoutRef<"a"> {
|
|
|
55
60
|
* }
|
|
56
61
|
* ```
|
|
57
62
|
*/
|
|
58
|
-
export declare const Link:
|
|
63
|
+
export declare const Link: PolymorphicComponent<LinkAs, "a", LinkOwnProps>;
|
|
@@ -3,6 +3,8 @@ import { AccentColor } from '../../utils/accent.ts';
|
|
|
3
3
|
import { Icon, IconProp } from '../Icon';
|
|
4
4
|
import { Spinner } from '../Spinner';
|
|
5
5
|
import { MenuListIconPlacement } from './MenuList.tsx';
|
|
6
|
+
/** Elements a menu list item's action can be rendered as. */
|
|
7
|
+
export type MenuListItemType = "button" | "link" | "text";
|
|
6
8
|
/** Menu list item colours. */
|
|
7
9
|
export type MenuListItemColor = AccentColor;
|
|
8
10
|
/** Properties of the menu list item component. */
|
|
@@ -18,7 +20,7 @@ export interface MenuListItemProps extends Omit<ComponentPropsWithoutRef<"li">,
|
|
|
18
20
|
*
|
|
19
21
|
* @default button
|
|
20
22
|
*/
|
|
21
|
-
type?:
|
|
23
|
+
type?: MenuListItemType;
|
|
22
24
|
/**
|
|
23
25
|
* Marks the item as being selected.
|
|
24
26
|
*
|
|
@@ -30,25 +32,48 @@ export interface MenuListItemProps extends Omit<ComponentPropsWithoutRef<"li">,
|
|
|
30
32
|
/** Accent colour of the menu list item. */
|
|
31
33
|
color?: MenuListItemColor;
|
|
32
34
|
/**
|
|
33
|
-
* Whether
|
|
34
|
-
* icon. The position of the spinner may be controlled via `iconPlacement`.
|
|
35
|
-
*
|
|
36
|
-
* Setting this property will automatically disable the item.
|
|
35
|
+
* Whether the item should be disabled.
|
|
37
36
|
*
|
|
38
37
|
* @default false
|
|
39
38
|
*/
|
|
40
|
-
|
|
39
|
+
disabled?: boolean;
|
|
41
40
|
/**
|
|
42
|
-
*
|
|
41
|
+
* Renders the item in a **loading** state.
|
|
42
|
+
*
|
|
43
|
+
* When `true`, the item is “soft-disabled”: it looks disabled and ignores
|
|
44
|
+
* user interaction but remains focusable. By default, a spinner is shown as
|
|
45
|
+
* the item's icon (_i.e._, `showSpinner` is set to `true` unless
|
|
46
|
+
* overridden).
|
|
47
|
+
*
|
|
48
|
+
* The item's content while loading can be controlled via `loadingContent`.
|
|
49
|
+
* The position of the spinner may be controlled via `iconPlacement`.
|
|
50
|
+
*
|
|
51
|
+
* To only show a spinner without “soft-disabling” the item, set `showSpinner`
|
|
52
|
+
* instead.
|
|
43
53
|
*
|
|
44
54
|
* @default false
|
|
45
55
|
*/
|
|
46
|
-
|
|
56
|
+
loading?: boolean;
|
|
47
57
|
/**
|
|
48
58
|
* Content of the item when it is in "loading" state. If not provided, the
|
|
49
59
|
* item content will remain unchanged.
|
|
50
60
|
*/
|
|
51
61
|
loadingContent?: ReactNode;
|
|
62
|
+
/**
|
|
63
|
+
* Whether to show a spinner as the item's icon.
|
|
64
|
+
*
|
|
65
|
+
* Defaults to the value of the `loading` property. In most cases, prefer
|
|
66
|
+
* `loading`, which also “soft-disables” the item.
|
|
67
|
+
*
|
|
68
|
+
* Use `showSpinner` when you want a spinner **without** “soft-disabling” the
|
|
69
|
+
* item. To “soft-disable” **without** a spinner, set `loading` to `true` and
|
|
70
|
+
* `showSpinner` to `false`.
|
|
71
|
+
*
|
|
72
|
+
* The position of the spinner may be controlled via `iconPlacement`.
|
|
73
|
+
*
|
|
74
|
+
* @default loading
|
|
75
|
+
*/
|
|
76
|
+
showSpinner?: boolean;
|
|
52
77
|
/**
|
|
53
78
|
* Optional item icon.
|
|
54
79
|
*
|
|
@@ -61,17 +86,11 @@ export interface MenuListItemProps extends Omit<ComponentPropsWithoutRef<"li">,
|
|
|
61
86
|
* @default start
|
|
62
87
|
*/
|
|
63
88
|
iconPlacement?: MenuListIconPlacement;
|
|
64
|
-
/**
|
|
65
|
-
* Whether the item should be disabled.
|
|
66
|
-
*
|
|
67
|
-
* @default false
|
|
68
|
-
*/
|
|
69
|
-
disabled?: boolean;
|
|
70
|
-
/** Href for the link, when `itemType` is set to `"link"`. */
|
|
89
|
+
/** Href for the link, when `type` is set to `"link"`. */
|
|
71
90
|
href?: ComponentProps<"a">["href"];
|
|
72
|
-
/** Target of the link, when `
|
|
91
|
+
/** Target of the link, when `type` is set to `"link"`. */
|
|
73
92
|
target?: ComponentProps<"a">["target"];
|
|
74
|
-
/** Rel of the link, when `
|
|
93
|
+
/** Rel of the link, when `type` is set to `"link"`. */
|
|
75
94
|
rel?: ComponentProps<"a">["rel"];
|
|
76
95
|
/** Properties to pass to the action element of the item. */
|
|
77
96
|
actionProps?: Omit<ComponentPropsWithRef<"button" | "a" | "div">, "disabled" | "href" | "target" | "rel">;
|
|
@@ -1,7 +1,25 @@
|
|
|
1
|
-
import { ComponentPropsWithoutRef } from 'react';
|
|
1
|
+
import { ComponentPropsWithoutRef, ReactNode } from 'react';
|
|
2
2
|
import { InputPropsBase } from '../Input';
|
|
3
3
|
/** Properties of the output component. */
|
|
4
|
-
export interface OutputProps extends Omit<InputPropsBase, "asChild" | "
|
|
4
|
+
export interface OutputProps extends Omit<InputPropsBase, "asChild" | "disabled" | "loading" | "loadingDescription" | "showClearButton" | "clearButtonLabel" | "onValueChange" | "onBlurToOutside" | "clearButtonProps" | "children">, ComponentPropsWithoutRef<"output"> {
|
|
5
|
+
/**
|
|
6
|
+
* Renders the output in a **pending** state.
|
|
7
|
+
*
|
|
8
|
+
* When `true`, the value should be treated as not final (for example, it is
|
|
9
|
+
* still being calculated or refreshed). While pending, the output is marked
|
|
10
|
+
* as busy for assistive technologies.
|
|
11
|
+
*
|
|
12
|
+
* The output's content while pending can be controlled via `pendingContent`.
|
|
13
|
+
*
|
|
14
|
+
* To show a spinner without marking the output as `pending`, set
|
|
15
|
+
* `showSpinner` instead.
|
|
16
|
+
*/
|
|
17
|
+
pending?: boolean;
|
|
18
|
+
/**
|
|
19
|
+
* Content to show while the output is in a **pending** state. If not
|
|
20
|
+
* provided, the output content will remain unchanged.
|
|
21
|
+
*/
|
|
22
|
+
pendingContent?: ReactNode;
|
|
5
23
|
}
|
|
6
24
|
/**
|
|
7
25
|
* The output component is used to display the result of a calculation or user
|
|
@@ -15,12 +15,36 @@ export interface RadioProps extends Omit<ComponentPropsWithoutRef<typeof RadioGr
|
|
|
15
15
|
/** Sets the radio as read-only. */
|
|
16
16
|
readOnly?: boolean;
|
|
17
17
|
/**
|
|
18
|
-
*
|
|
19
|
-
*
|
|
18
|
+
* Renders the radio in a **loading** state.
|
|
19
|
+
*
|
|
20
|
+
* When `true`, the radio is “soft-disabled”: it looks disabled and ignores
|
|
21
|
+
* user interaction but remains focusable. By default, a spinner is shown
|
|
22
|
+
* (_i.e._, `showSpinner` is set to `true` unless overridden).
|
|
23
|
+
*
|
|
24
|
+
* The radio's accessible description while loading can be controlled via
|
|
25
|
+
* `loadingDescription`.
|
|
26
|
+
*
|
|
27
|
+
* To only show a spinner without “soft-disabling” the radio, set
|
|
28
|
+
* `showSpinner` instead.
|
|
20
29
|
*
|
|
21
30
|
* @default false
|
|
22
31
|
*/
|
|
23
32
|
loading?: boolean;
|
|
33
|
+
/** Accessible description of the radio when it is in a “loading” state. */
|
|
34
|
+
loadingDescription?: ReactNode;
|
|
35
|
+
/**
|
|
36
|
+
* Whether to show a spinner next to the radio.
|
|
37
|
+
*
|
|
38
|
+
* Defaults to the value of the `loading` property. In most cases, prefer
|
|
39
|
+
* `loading`, which also “soft-disables” the radio.
|
|
40
|
+
*
|
|
41
|
+
* Use `showSpinner` when you want a spinner **without** “soft-disabling” the
|
|
42
|
+
* radio. To “soft-disable” **without** a spinner, set `loading` to `true` and
|
|
43
|
+
* `showSpinner` to `false`.
|
|
44
|
+
*
|
|
45
|
+
* @default loading
|
|
46
|
+
*/
|
|
47
|
+
showSpinner?: boolean;
|
|
24
48
|
/** Properties to pass to the root component. */
|
|
25
49
|
rootProps?: ComponentPropsWithRef<"div">;
|
|
26
50
|
/** Properties to pass to the code component. */
|
|
@@ -19,12 +19,36 @@ export interface RadioGroupProps extends Omit<ComponentPropsWithoutRef<typeof Ra
|
|
|
19
19
|
/** Sets the radio group as read-only. */
|
|
20
20
|
readOnly?: boolean;
|
|
21
21
|
/**
|
|
22
|
-
*
|
|
23
|
-
*
|
|
22
|
+
* Renders the radio group in a **loading** state.
|
|
23
|
+
*
|
|
24
|
+
* When `true`, the radio group is “soft-disabled”: it looks disabled and
|
|
25
|
+
* ignores user interaction but remains focusable. By default, a spinner is
|
|
26
|
+
* shown (_i.e._, `showSpinner` is set to `true` unless overridden).
|
|
27
|
+
*
|
|
28
|
+
* The radio group's accessible description while loading can be controlled
|
|
29
|
+
* via `loadingDescription`.
|
|
30
|
+
*
|
|
31
|
+
* To only show a spinner without “soft-disabling” the radio group, set
|
|
32
|
+
* `showSpinner` instead.
|
|
24
33
|
*
|
|
25
34
|
* @default false
|
|
26
35
|
*/
|
|
27
36
|
loading?: boolean;
|
|
37
|
+
/** Accessible description of the radio group when it is in a “loading” state. */
|
|
38
|
+
loadingDescription?: ReactNode;
|
|
39
|
+
/**
|
|
40
|
+
* Whether to show a spinner next to the radio group.
|
|
41
|
+
*
|
|
42
|
+
* Defaults to the value of the `loading` property. In most cases, prefer
|
|
43
|
+
* `loading`, which also “soft-disables” the radio group.
|
|
44
|
+
*
|
|
45
|
+
* Use `showSpinner` when you want a spinner **without** “soft-disabling” the
|
|
46
|
+
* radio group. To “soft-disable” **without** a spinner, set `loading` to
|
|
47
|
+
* `true` and `showSpinner` to `false`.
|
|
48
|
+
*
|
|
49
|
+
* @default loading
|
|
50
|
+
*/
|
|
51
|
+
showSpinner?: boolean;
|
|
28
52
|
/** Radio group code. */
|
|
29
53
|
code?: ReactNode;
|
|
30
54
|
/**
|
|
@@ -5,7 +5,7 @@ import { Input } from '../Input';
|
|
|
5
5
|
import { PopoverContent, PopoverTrigger } from '../Popover';
|
|
6
6
|
import { Tag } from '../Tag';
|
|
7
7
|
/** Base properties of the select component. */
|
|
8
|
-
export interface SelectPropsBase<T extends string | number | readonly string[] = string | number | readonly string[]> extends ComponentPropsWithoutRef<typeof PopoverTrigger>, Pick<ComponentPropsWithoutRef<typeof Input>, "name" | "required" | "variant" | "status" | "code" | "readOnly" | "loading" | "align" | "startAdornment" | "endAdornment" | "showClearButton" | "onBlurToOutside" | "rootProps" | "codeProps" | "containerProps" | "clearButtonProps" | "spinnerProps">, Pick<ComponentPropsWithoutRef<typeof CommandMenu>, "searchPlaceholder" | "searchValue" | "onSearchValueChange"> {
|
|
8
|
+
export interface SelectPropsBase<T extends string | number | readonly string[] = string | number | readonly string[]> extends ComponentPropsWithoutRef<typeof PopoverTrigger>, Pick<ComponentPropsWithoutRef<typeof Input>, "name" | "required" | "variant" | "status" | "code" | "readOnly" | "loading" | "loadingDescription" | "showSpinner" | "align" | "startAdornment" | "endAdornment" | "showClearButton" | "onBlurToOutside" | "rootProps" | "codeProps" | "containerProps" | "clearButtonProps" | "spinnerProps">, Pick<ComponentPropsWithoutRef<typeof CommandMenu>, "searchPlaceholder" | "searchValue" | "onSearchValueChange"> {
|
|
9
9
|
/**
|
|
10
10
|
* Whether multiple options can be selected. If not set, at most one option
|
|
11
11
|
* can be selected at a time.
|
|
@@ -63,7 +63,7 @@ export interface SelectPropsBase<T extends string | number | readonly string[] =
|
|
|
63
63
|
/** Properties to pass to each `Tag` holding a value, when `multiple` is set. */
|
|
64
64
|
valueTagProps?: Omit<ComponentPropsWithoutRef<typeof Tag>, "defaultOpen" | "open" | "onOpenChange" | "color" | "showCloseButton">;
|
|
65
65
|
/** Properties to pass to the arrow `Icon` component. */
|
|
66
|
-
arrowProps?: Omit<ComponentPropsWithRef<typeof IconButton
|
|
66
|
+
arrowProps?: Omit<ComponentPropsWithRef<typeof IconButton<"button">>, "icon" | "label">;
|
|
67
67
|
/** Properties to pass to the `Popover` component. */
|
|
68
68
|
popoverProps?: ComponentPropsWithRef<typeof PopoverContent>;
|
|
69
69
|
/** Options to pass to the `CommandMenu` component. */
|
|
@@ -59,7 +59,7 @@ export interface TableColumnProps extends Omit<ComponentPropsWithoutRef<typeof T
|
|
|
59
59
|
/** Properties to pass to the label component. */
|
|
60
60
|
labelProps?: ComponentPropsWithRef<"div">;
|
|
61
61
|
/** Properties to pass to the sort button. */
|
|
62
|
-
sortButtonProps?: ComponentPropsWithRef<typeof Button
|
|
62
|
+
sortButtonProps?: ComponentPropsWithRef<typeof Button<"button">>;
|
|
63
63
|
/** Properties to pass to the component containing the sort icons. */
|
|
64
64
|
sortIconContainerProps?: ComponentPropsWithRef<"div">;
|
|
65
65
|
/** Properties to pass to the sort ascending icon component. */
|
|
@@ -67,7 +67,7 @@ export interface TableColumnProps extends Omit<ComponentPropsWithoutRef<typeof T
|
|
|
67
67
|
/** Properties to pass to the sort descending icon component. */
|
|
68
68
|
sortDescIconProps?: ComponentPropsWithRef<typeof Icon>;
|
|
69
69
|
/** Properties to pass to the helper button component. */
|
|
70
|
-
helperButtonProps?: Omit<ComponentPropsWithRef<typeof IconButton
|
|
70
|
+
helperButtonProps?: Omit<ComponentPropsWithRef<typeof IconButton<"button">>, "icon">;
|
|
71
71
|
/** Properties to pass to the helper popover component. */
|
|
72
72
|
helperPopoverProps?: ComponentPropsWithRef<typeof Popover>;
|
|
73
73
|
/** Properties to pass to the helper popover content component. */
|
package/dist/types/index.d.ts
CHANGED
|
@@ -67,16 +67,18 @@ export * from './providers/PrefixProvider';
|
|
|
67
67
|
export * from './providers/ToastManagerProvider';
|
|
68
68
|
export * from './utils/boolDataAttr.ts';
|
|
69
69
|
export * from './utils/breakpoints.ts';
|
|
70
|
+
export * from './utils/combineAriaIds.ts';
|
|
70
71
|
export * from './utils/combineEventHandlers.ts';
|
|
71
72
|
export * from './utils/control.ts';
|
|
72
73
|
export * from './utils/cx.ts';
|
|
73
74
|
export * from './utils/filtering.ts';
|
|
74
75
|
export * from './utils/keyboardShortcut.ts';
|
|
75
|
-
export * from './utils/mergeAriaIds.ts';
|
|
76
76
|
export * from './utils/nativeControls.ts';
|
|
77
77
|
export * from './utils/navigate.ts';
|
|
78
78
|
export * from './utils/numericStringUtils.ts';
|
|
79
79
|
export * from './utils/parseDateStrict.ts';
|
|
80
|
+
export * from './utils/polymorphicTypes.ts';
|
|
81
|
+
export * from './utils/setNativeProperty.ts';
|
|
80
82
|
export * from './utils/sorting.ts';
|
|
81
83
|
export * from './utils/stringHash.ts';
|
|
82
84
|
export * from './utils/useCombinedRef.ts';
|
|
@@ -49,14 +49,14 @@ export interface AlertDialogOptions {
|
|
|
49
49
|
/** Properties to pass to the alert dialog's footer component. */
|
|
50
50
|
footerProps?: ComponentPropsWithRef<typeof AlertDialogFooter>;
|
|
51
51
|
/** Properties to pass to the alert dialog's OK button component. */
|
|
52
|
-
okButtonProps?: Omit<ComponentPropsWithRef<typeof Button
|
|
52
|
+
okButtonProps?: Omit<ComponentPropsWithRef<typeof Button<"button">>, "onClick">;
|
|
53
53
|
}
|
|
54
54
|
/** Options that can be provided to a `confirm` alert dialog. */
|
|
55
55
|
export interface ConfirmDialogOptions extends AlertDialogOptions {
|
|
56
56
|
/** Alert dialog's cancel text. */
|
|
57
57
|
cancelText?: ReactNode;
|
|
58
58
|
/** Properties to pass to the alert dialog's cancel button component. */
|
|
59
|
-
cancelButtonProps?: Omit<ComponentPropsWithRef<typeof Button
|
|
59
|
+
cancelButtonProps?: Omit<ComponentPropsWithRef<typeof Button<"button">>, "onClick">;
|
|
60
60
|
}
|
|
61
61
|
/** Value of the alert dialog context. */
|
|
62
62
|
export interface AlertDialogProviderContextValue {
|
|
@@ -38,7 +38,7 @@ export interface LocalizationObject {
|
|
|
38
38
|
Feedback: Pick<FeedbackProps, "visuallyHiddenPrefix">;
|
|
39
39
|
FeedbackPopover: Pick<FeedbackPopoverProps, "label">;
|
|
40
40
|
FieldGroupHeader: Pick<FieldGroupHeaderProps, "visuallyHiddenCodePrefix">;
|
|
41
|
-
Input: Pick<InputProps, "clearButtonLabel">;
|
|
41
|
+
Input: Pick<InputProps, "loadingDescription" | "clearButtonLabel">;
|
|
42
42
|
Label: Pick<LabelProps, "requiredIconLabel" | "helperButtonLabel">;
|
|
43
43
|
NumericInput: Pick<NumericInputProps, "decimalSeparator" | "groupingStyle" | "groupSeparator">;
|
|
44
44
|
Select: Pick<SelectProps, "searchPlaceholder" | "emptyMessage" | "optionsLabel" | "loadingOptionsLabel">;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { ComponentPropsWithoutRef, ComponentPropsWithRef, ElementType, ReactElement } from 'react';
|
|
2
|
+
/** Properties of a polymorphic component. */
|
|
3
|
+
export type PolymorphicProps<TAsAllowed extends ElementType, TAs extends TAsAllowed, TAsDefault extends TAsAllowed, TOwnProps> = TOwnProps & AsProp<TAsAllowed, TAs, TAsDefault> & Omit<ComponentPropsWithoutRef<TAs>, keyof TOwnProps | "as">;
|
|
4
|
+
/** Reference type for a polymorphic component. */
|
|
5
|
+
export type PolymorphicRef<TAs extends ElementType> = ComponentPropsWithRef<TAs>["ref"];
|
|
6
|
+
/** Polymorphic component type supporting an `as` property. */
|
|
7
|
+
export interface PolymorphicComponent<TAsAllowed extends ElementType, TAsDefault extends TAsAllowed, TOwnProps> {
|
|
8
|
+
(props: PolymorphicProps<TAsAllowed, TAsDefault, TAsDefault, TOwnProps> & {
|
|
9
|
+
ref?: PolymorphicRef<TAsDefault>;
|
|
10
|
+
}): ReactElement | null;
|
|
11
|
+
<TAs extends TAsAllowed>(props: PolymorphicProps<TAsAllowed, TAs, TAsDefault, TOwnProps> & {
|
|
12
|
+
ref?: PolymorphicRef<TAs>;
|
|
13
|
+
}): ReactElement | null;
|
|
14
|
+
}
|
|
15
|
+
/** `as` property for polymorphic components. */
|
|
16
|
+
type AsProp<TAsAllowed extends ElementType, TAs extends TAsAllowed, TAsDefault extends TAsAllowed> = TAsDefault extends TAs ? {
|
|
17
|
+
/** Element to render the component as. */
|
|
18
|
+
as?: TAs;
|
|
19
|
+
} : {
|
|
20
|
+
/** Element to render the component as. */
|
|
21
|
+
as: TAs;
|
|
22
|
+
};
|
|
23
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Sets the native property of an HTML element in a way that bypasses React’s
|
|
3
|
+
* value tracker interference, meaning that we can then dispatch an event that
|
|
4
|
+
* React will handle.
|
|
5
|
+
*
|
|
6
|
+
* See: https://github.com/facebook/react/issues/10135
|
|
7
|
+
*/
|
|
8
|
+
export declare function setNativeProperty(element: HTMLElement, prop: string, value: unknown): void;
|
package/package.json
CHANGED
|
@@ -121,9 +121,9 @@
|
|
|
121
121
|
& > .#{$prefix}icon {
|
|
122
122
|
font-size: $control-addon-icon-font-size;
|
|
123
123
|
filter: if(
|
|
124
|
-
$control-addon-text-shadow != null
|
|
125
|
-
|
|
126
|
-
|
|
124
|
+
sass($control-addon-text-shadow != null): drop-shadow(
|
|
125
|
+
$control-addon-text-shadow
|
|
126
|
+
)
|
|
127
127
|
);
|
|
128
128
|
}
|
|
129
129
|
|
|
@@ -13,10 +13,10 @@ $field-group-code-width: $control-code-width !default;
|
|
|
13
13
|
$field-group-code-padding-y: spacing(1) !default;
|
|
14
14
|
$field-group-code-padding-x: spacing(0.5) !default;
|
|
15
15
|
$field-group-code-margin-x: spacing(2) !default;
|
|
16
|
-
$field-group-code-font-size:
|
|
17
|
-
$field-group-code-line-height:
|
|
16
|
+
$field-group-code-font-size: $control-code-font-size !default;
|
|
17
|
+
$field-group-code-line-height: $control-code-line-height !default;
|
|
18
18
|
$field-group-code-font-weight: $font-weight-semibold !default;
|
|
19
|
-
$field-group-code-border-radius:
|
|
19
|
+
$field-group-code-border-radius: $control-code-border-radius !default;
|
|
20
20
|
$field-group-code-border-color: var(--#{$prefix}primary-a5) !default;
|
|
21
21
|
$field-group-code-background-color: var(--#{$prefix}background-color) !default;
|
|
22
22
|
$field-group-code-color: var(--#{$prefix}primary-11) !default;
|
|
@@ -70,7 +70,7 @@ $select-option-text-transform: null !default;
|
|
|
70
70
|
$select-option-indicator-font-size: var(--#{$prefix}font-size-sm) !default;
|
|
71
71
|
|
|
72
72
|
// Popover
|
|
73
|
-
$select-popover-min-width:
|
|
73
|
+
$select-popover-min-width: 150px !default;
|
|
74
74
|
|
|
75
75
|
// Variants
|
|
76
76
|
$select-variants: $control-variants !default;
|
|
@@ -139,11 +139,11 @@
|
|
|
139
139
|
|
|
140
140
|
@include accessible-transition();
|
|
141
141
|
|
|
142
|
-
&:not(:disabled, [data-readonly]) {
|
|
142
|
+
&:not(:disabled, [data-loading], [data-readonly]) {
|
|
143
143
|
cursor: pointer;
|
|
144
144
|
}
|
|
145
145
|
|
|
146
|
-
&:disabled {
|
|
146
|
+
&:is(:disabled, [data-loading]) {
|
|
147
147
|
cursor: $checkable-disabled-cursor;
|
|
148
148
|
opacity: $checkable-disabled-opacity;
|
|
149
149
|
}
|
|
@@ -283,7 +283,7 @@
|
|
|
283
283
|
}
|
|
284
284
|
}
|
|
285
285
|
|
|
286
|
-
&:active:not(:disabled, [data-readonly]) {
|
|
286
|
+
&:active:not(:disabled, [data-loading], [data-readonly]) {
|
|
287
287
|
background-color: var(--#{$prefix}checkable-active-background-color);
|
|
288
288
|
|
|
289
289
|
&[data-status] {
|