@allxsmith/bestax-bulma 5.34.3 → 5.35.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/bestax.css +1 -1
- package/dist/bestax.css.map +1 -1
- package/dist/esm/components/Loading.js +19 -6
- package/dist/esm/components/Loading.js.map +1 -1
- package/dist/esm/components/Menu.js +5 -1
- package/dist/esm/components/Menu.js.map +1 -1
- package/dist/esm/components/Modal.js +22 -31
- package/dist/esm/components/Modal.js.map +1 -1
- package/dist/esm/components/Sidebar.js +19 -6
- package/dist/esm/components/Sidebar.js.map +1 -1
- package/dist/esm/components/Steps.js +14 -13
- package/dist/esm/components/Steps.js.map +1 -1
- package/dist/esm/components/Toast.js +18 -7
- package/dist/esm/components/Toast.js.map +1 -1
- package/dist/esm/components/Tooltip.js +3 -3
- package/dist/esm/components/Tooltip.js.map +1 -1
- package/dist/esm/elements/Loader.js +2 -1
- package/dist/esm/elements/Loader.js.map +1 -1
- package/dist/esm/form/Checkbox.js +37 -4
- package/dist/esm/form/Checkbox.js.map +1 -1
- package/dist/esm/form/Slider.js +5 -4
- package/dist/esm/form/Slider.js.map +1 -1
- package/dist/esm/form/Taginput.js +21 -9
- package/dist/esm/form/Taginput.js.map +1 -1
- package/dist/esm/form/_pickerInternals/PickerPopover.js +9 -1
- package/dist/esm/form/_pickerInternals/PickerPopover.js.map +1 -1
- package/dist/esm/form/_pickerInternals/useSegmentedEntry.js +5 -4
- package/dist/esm/form/_pickerInternals/useSegmentedEntry.js.map +1 -1
- package/dist/esm/helpers/overlayStack.js +49 -0
- package/dist/esm/helpers/overlayStack.js.map +1 -0
- package/dist/esm/helpers/useLatestRef.js +33 -0
- package/dist/esm/helpers/useLatestRef.js.map +1 -0
- package/dist/extras.css +1 -1
- package/dist/extras.css.map +1 -1
- package/dist/index.cjs +240 -92
- package/dist/index.cjs.map +1 -1
- package/dist/types/components/Loading.d.ts +13 -3
- package/dist/types/components/Menu.d.ts +14 -1
- package/dist/types/components/Modal.d.ts +7 -4
- package/dist/types/components/Sidebar.d.ts +8 -3
- package/dist/types/components/Steps.d.ts +27 -5
- package/dist/types/components/Toast.d.ts +5 -2
- package/dist/types/elements/Loader.d.ts +2 -1
- package/dist/types/form/Checkbox.d.ts +11 -0
- package/dist/types/form/Taginput.d.ts +5 -1
- package/dist/types/helpers/overlayStack.d.ts +15 -0
- package/dist/types/helpers/useLatestRef.d.ts +21 -0
- package/dist/types-cjs/components/Loading.d.ts +13 -3
- package/dist/types-cjs/components/Menu.d.ts +14 -1
- package/dist/types-cjs/components/Modal.d.ts +7 -4
- package/dist/types-cjs/components/Sidebar.d.ts +8 -3
- package/dist/types-cjs/components/Steps.d.ts +27 -5
- package/dist/types-cjs/components/Toast.d.ts +5 -2
- package/dist/types-cjs/elements/Loader.d.ts +2 -1
- package/dist/types-cjs/form/Checkbox.d.ts +11 -0
- package/dist/types-cjs/form/Taginput.d.ts +5 -1
- package/dist/types-cjs/helpers/overlayStack.d.ts +15 -0
- package/dist/types-cjs/helpers/useLatestRef.d.ts +21 -0
- package/dist/versions/bestax-no-dark-mode.css +1 -1
- package/dist/versions/bestax-no-dark-mode.css.map +1 -1
- package/dist/versions/bestax-no-helpers-prefixed.css +1 -1
- package/dist/versions/bestax-no-helpers-prefixed.css.map +1 -1
- package/dist/versions/bestax-no-helpers.css +1 -1
- package/dist/versions/bestax-no-helpers.css.map +1 -1
- package/dist/versions/bestax-prefixed.css +1 -1
- package/dist/versions/bestax-prefixed.css.map +1 -1
- package/package.json +1 -1
- package/src/scss/components/_steps.scss +96 -38
- package/src/scss/elements/_loader.scss +20 -0
- package/src/scss/form/_checkbox.scss +28 -1
|
@@ -16,7 +16,12 @@ export type LoadingColor = 'primary' | 'link' | 'info' | 'success' | 'warning' |
|
|
|
16
16
|
export interface LoadingProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'color'>, Omit<BulmaClassesProps, 'color' | 'backgroundColor' | 'size' | 'overlay'> {
|
|
17
17
|
/** Whether the loading overlay is visible. */
|
|
18
18
|
active?: boolean;
|
|
19
|
-
/**
|
|
19
|
+
/**
|
|
20
|
+
* Cover the entire viewport. A full-page loading also takes its turn with
|
|
21
|
+
* Modal and Sidebar for Escape: while it's the topmost open overlay, the
|
|
22
|
+
* Modal or Sidebar under it doesn't answer Escape or hold Tab, whether or
|
|
23
|
+
* not the loading can be cancelled.
|
|
24
|
+
*/
|
|
20
25
|
isFullPage?: boolean;
|
|
21
26
|
/** Size of the loading spinner. */
|
|
22
27
|
size?: 'small' | 'medium' | 'large';
|
|
@@ -24,8 +29,13 @@ export interface LoadingProps extends Omit<React.HTMLAttributes<HTMLDivElement>,
|
|
|
24
29
|
color?: LoadingColor;
|
|
25
30
|
/**
|
|
26
31
|
* Show a cancel button and allow closing, by a click on the overlay or by
|
|
27
|
-
* Escape.
|
|
28
|
-
*
|
|
32
|
+
* Escape. With `isFullPage`, the loading is an overlay like Modal and
|
|
33
|
+
* Sidebar: only the topmost open overlay answers Escape, so a full-page
|
|
34
|
+
* loading shown over a Modal cancels first, and the Modal closes on the
|
|
35
|
+
* next Escape. Without it, Escape cancels once no Modal, Dialog, Sidebar or
|
|
36
|
+
* full-page Loading is open. Either way it marks the Escape it cancels on as
|
|
37
|
+
* used with `preventDefault()`. An Escape a popup on the page closed on, by
|
|
38
|
+
* calling `preventDefault()`, doesn't cancel.
|
|
29
39
|
*/
|
|
30
40
|
canCancel?: boolean;
|
|
31
41
|
/** Callback when cancel is triggered. */
|
|
@@ -56,7 +56,16 @@ export interface MenuItemOwnProps extends BulmaClassesProps {
|
|
|
56
56
|
className?: string;
|
|
57
57
|
/** Item content and optional nested MenuList. */
|
|
58
58
|
children: React.ReactNode;
|
|
59
|
-
/**
|
|
59
|
+
/**
|
|
60
|
+
* Marks the item as the current one. It adds Bulma's `is-active` class, and
|
|
61
|
+
* `aria-current="page"` on the element `as` renders, so assistive tech can
|
|
62
|
+
* tell which item is current too. An `aria-current` you pass wins, even
|
|
63
|
+
* `undefined`: use it to say something else (`"location"` for a section of
|
|
64
|
+
* one page, say), or `aria-current={false}` to turn it off. A menu should
|
|
65
|
+
* mark one page, so when the section above the current page is `active` too,
|
|
66
|
+
* give it `aria-current="location"`, and give an `active` item that isn't
|
|
67
|
+
* navigation, such as an `as="button"` filter, `aria-current={false}`.
|
|
68
|
+
*/
|
|
60
69
|
active?: boolean;
|
|
61
70
|
/** Inline styles for the wrapping `<li>`. */
|
|
62
71
|
style?: React.CSSProperties;
|
|
@@ -91,6 +100,10 @@ export type MenuItemProps<T extends React.ElementType = 'a'> = MenuItemOwnProps
|
|
|
91
100
|
/**
|
|
92
101
|
* MenuItem supports `as` prop for custom link components, e.g., react-router-dom Link.
|
|
93
102
|
*
|
|
103
|
+
* Give each item an `href`, a router link through `as`, or `as="button"`, so
|
|
104
|
+
* the keyboard can reach it: an `<a>` with no `href` isn't a link, and Tab
|
|
105
|
+
* skips it.
|
|
106
|
+
*
|
|
94
107
|
* @function
|
|
95
108
|
* @param {MenuItemProps} props - Props for the MenuItem component.
|
|
96
109
|
* @param {React.Ref} ref - Forwarded ref to the inner element `as` renders.
|
|
@@ -30,10 +30,13 @@ export interface ModalProps extends Omit<React.HTMLAttributes<HTMLDivElement>, '
|
|
|
30
30
|
children?: React.ReactNode;
|
|
31
31
|
/**
|
|
32
32
|
* Close the modal when the Escape key is pressed (calls `onClose`). Only the
|
|
33
|
-
* topmost open
|
|
34
|
-
*
|
|
35
|
-
*
|
|
36
|
-
* on
|
|
33
|
+
* topmost open overlay responds, whichever Modal, Dialog, Sidebar or
|
|
34
|
+
* full-page Loading opened last, so Escape closes one layer at a time. The
|
|
35
|
+
* modal marks the Escape it closes on as used with `preventDefault()`, and
|
|
36
|
+
* a Toast waits until no overlay is open. Turned off, a modal on top still
|
|
37
|
+
* keeps Escape from the layers under it. A popup inside it, such as a
|
|
38
|
+
* Dropdown's menu or a date picker's calendar, takes its own Escape first,
|
|
39
|
+
* and so does content that calls `preventDefault()` on it.
|
|
37
40
|
* @defaultValue true
|
|
38
41
|
*/
|
|
39
42
|
closeOnEscape?: boolean;
|
|
@@ -25,9 +25,14 @@ export interface SidebarProps extends Omit<React.HTMLAttributes<HTMLElement>, 'c
|
|
|
25
25
|
/** Close sidebar when overlay is clicked. Default: true. */
|
|
26
26
|
overlayClose?: boolean;
|
|
27
27
|
/**
|
|
28
|
-
* Close sidebar on Escape key.
|
|
29
|
-
*
|
|
30
|
-
*
|
|
28
|
+
* Close sidebar on Escape key. Only the topmost open overlay responds,
|
|
29
|
+
* whichever Modal, Dialog, Sidebar or full-page Loading opened last, so
|
|
30
|
+
* Escape closes one layer at a time. The sidebar marks the Escape it closes
|
|
31
|
+
* on as used with `preventDefault()`, and a Toast waits until no overlay is
|
|
32
|
+
* open. Turned off, a sidebar on top still keeps Escape from the layers
|
|
33
|
+
* under it. A popup inside it, such as a Dropdown's menu or a date picker's
|
|
34
|
+
* calendar, takes its own Escape first, and so does content that calls
|
|
35
|
+
* `preventDefault()` on it. Default: true.
|
|
31
36
|
*/
|
|
32
37
|
escapeClose?: boolean;
|
|
33
38
|
/** Allow closing the sidebar. Default: true. */
|
|
@@ -8,7 +8,11 @@ export type StepsColor = 'primary' | 'link' | 'info' | 'success' | 'warning' | '
|
|
|
8
8
|
* Props for individual Step items.
|
|
9
9
|
*/
|
|
10
10
|
export interface StepItemProps {
|
|
11
|
-
/**
|
|
11
|
+
/**
|
|
12
|
+
* Step label/title. On a `clickable` step it's rendered inside the step's
|
|
13
|
+
* `<button>`, so it has to be phrasing content, like text, a `<span>` or an
|
|
14
|
+
* icon, with no link, button or other control in it.
|
|
15
|
+
*/
|
|
12
16
|
label?: React.ReactNode;
|
|
13
17
|
/** Icon for the step marker */
|
|
14
18
|
icon?: React.ReactNode;
|
|
@@ -17,7 +21,11 @@ export interface StepItemProps {
|
|
|
17
21
|
* @defaultValue '✓'
|
|
18
22
|
*/
|
|
19
23
|
completedIcon?: React.ReactNode;
|
|
20
|
-
/**
|
|
24
|
+
/**
|
|
25
|
+
* Whether this step is clickable. A clickable step puts its marker and
|
|
26
|
+
* label in a `<button type="button">` inside its list item, which calls
|
|
27
|
+
* `onStepClick`, and the current step's `aria-current` goes on that button.
|
|
28
|
+
*/
|
|
21
29
|
clickable?: boolean;
|
|
22
30
|
/** Additional CSS classes. */
|
|
23
31
|
className?: string;
|
|
@@ -44,7 +52,11 @@ export interface StepsProps extends Omit<React.HTMLAttributes<HTMLDivElement>, '
|
|
|
44
52
|
rounded?: boolean;
|
|
45
53
|
/** Vertical layout. */
|
|
46
54
|
vertical?: boolean;
|
|
47
|
-
/**
|
|
55
|
+
/**
|
|
56
|
+
* Position of labels. `right` and `left` mean the end and the start of the
|
|
57
|
+
* line, so in a right-to-left page `right` puts each label to the left of
|
|
58
|
+
* its marker, and `left` to the right.
|
|
59
|
+
*/
|
|
48
60
|
labelPosition?: 'bottom' | 'right' | 'left';
|
|
49
61
|
/** Mobile display mode. */
|
|
50
62
|
mobileMode?: 'minimal' | 'compact' | 'right';
|
|
@@ -75,11 +87,21 @@ export interface StepProps extends Omit<React.LiHTMLAttributes<HTMLLIElement>, '
|
|
|
75
87
|
isActive?: boolean;
|
|
76
88
|
/** Whether this step is completed */
|
|
77
89
|
isCompleted?: boolean;
|
|
78
|
-
/**
|
|
90
|
+
/**
|
|
91
|
+
* Step label/title, or pass it as `children`. On a `clickable` step it's
|
|
92
|
+
* rendered inside the step's `<button>`, so it has to be phrasing content,
|
|
93
|
+
* like text, a `<span>` or an icon, with no link, button or other control
|
|
94
|
+
* in it.
|
|
95
|
+
*/
|
|
79
96
|
label?: React.ReactNode;
|
|
80
97
|
/** Icon for the step marker */
|
|
81
98
|
icon?: React.ReactNode;
|
|
82
|
-
/**
|
|
99
|
+
/**
|
|
100
|
+
* Whether this step is clickable. A clickable step puts its marker and
|
|
101
|
+
* label in a `<button type="button">` inside the `<li>`, which calls
|
|
102
|
+
* `onClick`, and `aria-current` goes on that button. The `<li>` keeps the
|
|
103
|
+
* rest of the props.
|
|
104
|
+
*/
|
|
83
105
|
clickable?: boolean;
|
|
84
106
|
/** Click handler */
|
|
85
107
|
onClick?: () => void;
|
|
@@ -35,8 +35,11 @@ export interface ToastProps extends Omit<React.HTMLAttributes<HTMLDivElement>, '
|
|
|
35
35
|
/** Pause auto-close timer on hover. Default: false. */
|
|
36
36
|
pauseOnHover?: boolean;
|
|
37
37
|
/**
|
|
38
|
-
* Whether the toast can be dismissed with Escape.
|
|
39
|
-
* page
|
|
38
|
+
* Whether the toast can be dismissed with Escape. While a Modal, Dialog,
|
|
39
|
+
* Sidebar or full-page Loading is open, Escape goes to that overlay and the
|
|
40
|
+
* toast stays up, so Escape dismisses the toast once none is open. An
|
|
41
|
+
* Escape a popup on the page closed on, by calling `preventDefault()`,
|
|
42
|
+
* leaves it up too. Default: true.
|
|
40
43
|
*/
|
|
41
44
|
cancelable?: boolean;
|
|
42
45
|
/** Text for an action button (e.g. "Undo"). */
|
|
@@ -23,7 +23,8 @@ export interface LoaderProps extends Omit<React.HTMLAttributes<HTMLSpanElement>,
|
|
|
23
23
|
*
|
|
24
24
|
* The ring is `1em` square, so `textSize` scales it. It is exposed as an
|
|
25
25
|
* indeterminate `progressbar` named by `ariaLabel`, and it stops spinning
|
|
26
|
-
* under `prefers-reduced-motion: reduce` while staying drawn.
|
|
26
|
+
* under `prefers-reduced-motion: reduce` while staying drawn. In forced
|
|
27
|
+
* colors its two open sides take the page's color, so it stays open.
|
|
27
28
|
*
|
|
28
29
|
* @function
|
|
29
30
|
* @param {LoaderProps} props - Props for the Loader component.
|
|
@@ -44,6 +44,17 @@ export interface CheckboxProps extends Omit<React.InputHTMLAttributes<HTMLInputE
|
|
|
44
44
|
textColor?: (typeof validColors)[number] | 'inherit' | 'current';
|
|
45
45
|
/** Whether the checkbox is disabled. */
|
|
46
46
|
disabled?: boolean;
|
|
47
|
+
/**
|
|
48
|
+
* Shows the mixed state, as in a "Select all" box when some of what it
|
|
49
|
+
* covers is checked. It's a look and an announcement only: `checked` is
|
|
50
|
+
* still the value, and a click still toggles `checked`. A browser clears
|
|
51
|
+
* the mixed state on a click, so the component sets it again from this
|
|
52
|
+
* prop after every click and every render. Left unset, the component
|
|
53
|
+
* doesn't touch it, and once it has set it, going back to unset clears it
|
|
54
|
+
* once and hands it back. It has no HTML attribute, so server-rendered
|
|
55
|
+
* markup can't carry it, and a mixed box renders unmixed until hydration.
|
|
56
|
+
*/
|
|
57
|
+
indeterminate?: boolean;
|
|
47
58
|
/** Additional CSS classes to apply. */
|
|
48
59
|
className?: string;
|
|
49
60
|
/** The label/content for the checkbox. */
|
|
@@ -63,7 +63,11 @@ export interface TaginputProps extends Omit<React.HTMLAttributes<HTMLDivElement>
|
|
|
63
63
|
closable?: boolean;
|
|
64
64
|
/** Attach tags visually. */
|
|
65
65
|
attached?: boolean;
|
|
66
|
-
/**
|
|
66
|
+
/**
|
|
67
|
+
* Maximum number of tags allowed. At the limit the text input isn't
|
|
68
|
+
* rendered, and neither is the suggestion list, so the field takes no more
|
|
69
|
+
* tags until one is removed.
|
|
70
|
+
*/
|
|
67
71
|
maxTags?: number;
|
|
68
72
|
/** Maximum length of input. */
|
|
69
73
|
maxlength?: number;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Holds this overlay's place in the stack of open overlays while `inStack`
|
|
3
|
+
* is true, from the effect after it opens until the one after it closes.
|
|
4
|
+
* Opening again puts it back on top.
|
|
5
|
+
*
|
|
6
|
+
* Returns a check for whether nothing in the stack sits above this overlay,
|
|
7
|
+
* to call when a key arrives. For an overlay in the stack, that's whether it
|
|
8
|
+
* is the topmost one. For one that isn't, such as a Toast, it's whether no
|
|
9
|
+
* overlay is open at all.
|
|
10
|
+
*
|
|
11
|
+
* @function useOverlayStack
|
|
12
|
+
* @param inStack - Whether this overlay is open and takes part.
|
|
13
|
+
* @returns A check for whether nothing in the stack is above this overlay.
|
|
14
|
+
*/
|
|
15
|
+
export declare function useOverlayStack(inStack: boolean): () => boolean;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A ref holding the value from the latest commit, for a listener that is
|
|
3
|
+
* added once and calls whatever callback it was given most recently.
|
|
4
|
+
*
|
|
5
|
+
* A listener whose effect lists a callback prop is taken off and added again
|
|
6
|
+
* each time that callback changes, and an inline one changes on every render
|
|
7
|
+
* of its parent. React can render between two listeners for the same
|
|
8
|
+
* keypress, and the browser runs neither a listener taken off mid-event nor
|
|
9
|
+
* one added mid-event, so that keypress never reaches it (#1088). Reading the
|
|
10
|
+
* callback from here keeps the listener where it is.
|
|
11
|
+
*
|
|
12
|
+
* It's updated before paint on each commit, so a listener reads the props of
|
|
13
|
+
* the render that's on screen.
|
|
14
|
+
*
|
|
15
|
+
* @function useLatestRef
|
|
16
|
+
* @param value - The value to keep current, usually a callback prop.
|
|
17
|
+
* @returns A ref whose `current` is `value` as of the latest commit.
|
|
18
|
+
*/
|
|
19
|
+
export declare function useLatestRef<T>(value: T): {
|
|
20
|
+
readonly current: T;
|
|
21
|
+
};
|
|
@@ -16,7 +16,12 @@ export type LoadingColor = 'primary' | 'link' | 'info' | 'success' | 'warning' |
|
|
|
16
16
|
export interface LoadingProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'color'>, Omit<BulmaClassesProps, 'color' | 'backgroundColor' | 'size' | 'overlay'> {
|
|
17
17
|
/** Whether the loading overlay is visible. */
|
|
18
18
|
active?: boolean;
|
|
19
|
-
/**
|
|
19
|
+
/**
|
|
20
|
+
* Cover the entire viewport. A full-page loading also takes its turn with
|
|
21
|
+
* Modal and Sidebar for Escape: while it's the topmost open overlay, the
|
|
22
|
+
* Modal or Sidebar under it doesn't answer Escape or hold Tab, whether or
|
|
23
|
+
* not the loading can be cancelled.
|
|
24
|
+
*/
|
|
20
25
|
isFullPage?: boolean;
|
|
21
26
|
/** Size of the loading spinner. */
|
|
22
27
|
size?: 'small' | 'medium' | 'large';
|
|
@@ -24,8 +29,13 @@ export interface LoadingProps extends Omit<React.HTMLAttributes<HTMLDivElement>,
|
|
|
24
29
|
color?: LoadingColor;
|
|
25
30
|
/**
|
|
26
31
|
* Show a cancel button and allow closing, by a click on the overlay or by
|
|
27
|
-
* Escape.
|
|
28
|
-
*
|
|
32
|
+
* Escape. With `isFullPage`, the loading is an overlay like Modal and
|
|
33
|
+
* Sidebar: only the topmost open overlay answers Escape, so a full-page
|
|
34
|
+
* loading shown over a Modal cancels first, and the Modal closes on the
|
|
35
|
+
* next Escape. Without it, Escape cancels once no Modal, Dialog, Sidebar or
|
|
36
|
+
* full-page Loading is open. Either way it marks the Escape it cancels on as
|
|
37
|
+
* used with `preventDefault()`. An Escape a popup on the page closed on, by
|
|
38
|
+
* calling `preventDefault()`, doesn't cancel.
|
|
29
39
|
*/
|
|
30
40
|
canCancel?: boolean;
|
|
31
41
|
/** Callback when cancel is triggered. */
|
|
@@ -56,7 +56,16 @@ export interface MenuItemOwnProps extends BulmaClassesProps {
|
|
|
56
56
|
className?: string;
|
|
57
57
|
/** Item content and optional nested MenuList. */
|
|
58
58
|
children: React.ReactNode;
|
|
59
|
-
/**
|
|
59
|
+
/**
|
|
60
|
+
* Marks the item as the current one. It adds Bulma's `is-active` class, and
|
|
61
|
+
* `aria-current="page"` on the element `as` renders, so assistive tech can
|
|
62
|
+
* tell which item is current too. An `aria-current` you pass wins, even
|
|
63
|
+
* `undefined`: use it to say something else (`"location"` for a section of
|
|
64
|
+
* one page, say), or `aria-current={false}` to turn it off. A menu should
|
|
65
|
+
* mark one page, so when the section above the current page is `active` too,
|
|
66
|
+
* give it `aria-current="location"`, and give an `active` item that isn't
|
|
67
|
+
* navigation, such as an `as="button"` filter, `aria-current={false}`.
|
|
68
|
+
*/
|
|
60
69
|
active?: boolean;
|
|
61
70
|
/** Inline styles for the wrapping `<li>`. */
|
|
62
71
|
style?: React.CSSProperties;
|
|
@@ -91,6 +100,10 @@ export type MenuItemProps<T extends React.ElementType = 'a'> = MenuItemOwnProps
|
|
|
91
100
|
/**
|
|
92
101
|
* MenuItem supports `as` prop for custom link components, e.g., react-router-dom Link.
|
|
93
102
|
*
|
|
103
|
+
* Give each item an `href`, a router link through `as`, or `as="button"`, so
|
|
104
|
+
* the keyboard can reach it: an `<a>` with no `href` isn't a link, and Tab
|
|
105
|
+
* skips it.
|
|
106
|
+
*
|
|
94
107
|
* @function
|
|
95
108
|
* @param {MenuItemProps} props - Props for the MenuItem component.
|
|
96
109
|
* @param {React.Ref} ref - Forwarded ref to the inner element `as` renders.
|
|
@@ -30,10 +30,13 @@ export interface ModalProps extends Omit<React.HTMLAttributes<HTMLDivElement>, '
|
|
|
30
30
|
children?: React.ReactNode;
|
|
31
31
|
/**
|
|
32
32
|
* Close the modal when the Escape key is pressed (calls `onClose`). Only the
|
|
33
|
-
* topmost open
|
|
34
|
-
*
|
|
35
|
-
*
|
|
36
|
-
* on
|
|
33
|
+
* topmost open overlay responds, whichever Modal, Dialog, Sidebar or
|
|
34
|
+
* full-page Loading opened last, so Escape closes one layer at a time. The
|
|
35
|
+
* modal marks the Escape it closes on as used with `preventDefault()`, and
|
|
36
|
+
* a Toast waits until no overlay is open. Turned off, a modal on top still
|
|
37
|
+
* keeps Escape from the layers under it. A popup inside it, such as a
|
|
38
|
+
* Dropdown's menu or a date picker's calendar, takes its own Escape first,
|
|
39
|
+
* and so does content that calls `preventDefault()` on it.
|
|
37
40
|
* @defaultValue true
|
|
38
41
|
*/
|
|
39
42
|
closeOnEscape?: boolean;
|
|
@@ -25,9 +25,14 @@ export interface SidebarProps extends Omit<React.HTMLAttributes<HTMLElement>, 'c
|
|
|
25
25
|
/** Close sidebar when overlay is clicked. Default: true. */
|
|
26
26
|
overlayClose?: boolean;
|
|
27
27
|
/**
|
|
28
|
-
* Close sidebar on Escape key.
|
|
29
|
-
*
|
|
30
|
-
*
|
|
28
|
+
* Close sidebar on Escape key. Only the topmost open overlay responds,
|
|
29
|
+
* whichever Modal, Dialog, Sidebar or full-page Loading opened last, so
|
|
30
|
+
* Escape closes one layer at a time. The sidebar marks the Escape it closes
|
|
31
|
+
* on as used with `preventDefault()`, and a Toast waits until no overlay is
|
|
32
|
+
* open. Turned off, a sidebar on top still keeps Escape from the layers
|
|
33
|
+
* under it. A popup inside it, such as a Dropdown's menu or a date picker's
|
|
34
|
+
* calendar, takes its own Escape first, and so does content that calls
|
|
35
|
+
* `preventDefault()` on it. Default: true.
|
|
31
36
|
*/
|
|
32
37
|
escapeClose?: boolean;
|
|
33
38
|
/** Allow closing the sidebar. Default: true. */
|
|
@@ -8,7 +8,11 @@ export type StepsColor = 'primary' | 'link' | 'info' | 'success' | 'warning' | '
|
|
|
8
8
|
* Props for individual Step items.
|
|
9
9
|
*/
|
|
10
10
|
export interface StepItemProps {
|
|
11
|
-
/**
|
|
11
|
+
/**
|
|
12
|
+
* Step label/title. On a `clickable` step it's rendered inside the step's
|
|
13
|
+
* `<button>`, so it has to be phrasing content, like text, a `<span>` or an
|
|
14
|
+
* icon, with no link, button or other control in it.
|
|
15
|
+
*/
|
|
12
16
|
label?: React.ReactNode;
|
|
13
17
|
/** Icon for the step marker */
|
|
14
18
|
icon?: React.ReactNode;
|
|
@@ -17,7 +21,11 @@ export interface StepItemProps {
|
|
|
17
21
|
* @defaultValue '✓'
|
|
18
22
|
*/
|
|
19
23
|
completedIcon?: React.ReactNode;
|
|
20
|
-
/**
|
|
24
|
+
/**
|
|
25
|
+
* Whether this step is clickable. A clickable step puts its marker and
|
|
26
|
+
* label in a `<button type="button">` inside its list item, which calls
|
|
27
|
+
* `onStepClick`, and the current step's `aria-current` goes on that button.
|
|
28
|
+
*/
|
|
21
29
|
clickable?: boolean;
|
|
22
30
|
/** Additional CSS classes. */
|
|
23
31
|
className?: string;
|
|
@@ -44,7 +52,11 @@ export interface StepsProps extends Omit<React.HTMLAttributes<HTMLDivElement>, '
|
|
|
44
52
|
rounded?: boolean;
|
|
45
53
|
/** Vertical layout. */
|
|
46
54
|
vertical?: boolean;
|
|
47
|
-
/**
|
|
55
|
+
/**
|
|
56
|
+
* Position of labels. `right` and `left` mean the end and the start of the
|
|
57
|
+
* line, so in a right-to-left page `right` puts each label to the left of
|
|
58
|
+
* its marker, and `left` to the right.
|
|
59
|
+
*/
|
|
48
60
|
labelPosition?: 'bottom' | 'right' | 'left';
|
|
49
61
|
/** Mobile display mode. */
|
|
50
62
|
mobileMode?: 'minimal' | 'compact' | 'right';
|
|
@@ -75,11 +87,21 @@ export interface StepProps extends Omit<React.LiHTMLAttributes<HTMLLIElement>, '
|
|
|
75
87
|
isActive?: boolean;
|
|
76
88
|
/** Whether this step is completed */
|
|
77
89
|
isCompleted?: boolean;
|
|
78
|
-
/**
|
|
90
|
+
/**
|
|
91
|
+
* Step label/title, or pass it as `children`. On a `clickable` step it's
|
|
92
|
+
* rendered inside the step's `<button>`, so it has to be phrasing content,
|
|
93
|
+
* like text, a `<span>` or an icon, with no link, button or other control
|
|
94
|
+
* in it.
|
|
95
|
+
*/
|
|
79
96
|
label?: React.ReactNode;
|
|
80
97
|
/** Icon for the step marker */
|
|
81
98
|
icon?: React.ReactNode;
|
|
82
|
-
/**
|
|
99
|
+
/**
|
|
100
|
+
* Whether this step is clickable. A clickable step puts its marker and
|
|
101
|
+
* label in a `<button type="button">` inside the `<li>`, which calls
|
|
102
|
+
* `onClick`, and `aria-current` goes on that button. The `<li>` keeps the
|
|
103
|
+
* rest of the props.
|
|
104
|
+
*/
|
|
83
105
|
clickable?: boolean;
|
|
84
106
|
/** Click handler */
|
|
85
107
|
onClick?: () => void;
|
|
@@ -35,8 +35,11 @@ export interface ToastProps extends Omit<React.HTMLAttributes<HTMLDivElement>, '
|
|
|
35
35
|
/** Pause auto-close timer on hover. Default: false. */
|
|
36
36
|
pauseOnHover?: boolean;
|
|
37
37
|
/**
|
|
38
|
-
* Whether the toast can be dismissed with Escape.
|
|
39
|
-
* page
|
|
38
|
+
* Whether the toast can be dismissed with Escape. While a Modal, Dialog,
|
|
39
|
+
* Sidebar or full-page Loading is open, Escape goes to that overlay and the
|
|
40
|
+
* toast stays up, so Escape dismisses the toast once none is open. An
|
|
41
|
+
* Escape a popup on the page closed on, by calling `preventDefault()`,
|
|
42
|
+
* leaves it up too. Default: true.
|
|
40
43
|
*/
|
|
41
44
|
cancelable?: boolean;
|
|
42
45
|
/** Text for an action button (e.g. "Undo"). */
|
|
@@ -23,7 +23,8 @@ export interface LoaderProps extends Omit<React.HTMLAttributes<HTMLSpanElement>,
|
|
|
23
23
|
*
|
|
24
24
|
* The ring is `1em` square, so `textSize` scales it. It is exposed as an
|
|
25
25
|
* indeterminate `progressbar` named by `ariaLabel`, and it stops spinning
|
|
26
|
-
* under `prefers-reduced-motion: reduce` while staying drawn.
|
|
26
|
+
* under `prefers-reduced-motion: reduce` while staying drawn. In forced
|
|
27
|
+
* colors its two open sides take the page's color, so it stays open.
|
|
27
28
|
*
|
|
28
29
|
* @function
|
|
29
30
|
* @param {LoaderProps} props - Props for the Loader component.
|
|
@@ -44,6 +44,17 @@ export interface CheckboxProps extends Omit<React.InputHTMLAttributes<HTMLInputE
|
|
|
44
44
|
textColor?: (typeof validColors)[number] | 'inherit' | 'current';
|
|
45
45
|
/** Whether the checkbox is disabled. */
|
|
46
46
|
disabled?: boolean;
|
|
47
|
+
/**
|
|
48
|
+
* Shows the mixed state, as in a "Select all" box when some of what it
|
|
49
|
+
* covers is checked. It's a look and an announcement only: `checked` is
|
|
50
|
+
* still the value, and a click still toggles `checked`. A browser clears
|
|
51
|
+
* the mixed state on a click, so the component sets it again from this
|
|
52
|
+
* prop after every click and every render. Left unset, the component
|
|
53
|
+
* doesn't touch it, and once it has set it, going back to unset clears it
|
|
54
|
+
* once and hands it back. It has no HTML attribute, so server-rendered
|
|
55
|
+
* markup can't carry it, and a mixed box renders unmixed until hydration.
|
|
56
|
+
*/
|
|
57
|
+
indeterminate?: boolean;
|
|
47
58
|
/** Additional CSS classes to apply. */
|
|
48
59
|
className?: string;
|
|
49
60
|
/** The label/content for the checkbox. */
|
|
@@ -63,7 +63,11 @@ export interface TaginputProps extends Omit<React.HTMLAttributes<HTMLDivElement>
|
|
|
63
63
|
closable?: boolean;
|
|
64
64
|
/** Attach tags visually. */
|
|
65
65
|
attached?: boolean;
|
|
66
|
-
/**
|
|
66
|
+
/**
|
|
67
|
+
* Maximum number of tags allowed. At the limit the text input isn't
|
|
68
|
+
* rendered, and neither is the suggestion list, so the field takes no more
|
|
69
|
+
* tags until one is removed.
|
|
70
|
+
*/
|
|
67
71
|
maxTags?: number;
|
|
68
72
|
/** Maximum length of input. */
|
|
69
73
|
maxlength?: number;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Holds this overlay's place in the stack of open overlays while `inStack`
|
|
3
|
+
* is true, from the effect after it opens until the one after it closes.
|
|
4
|
+
* Opening again puts it back on top.
|
|
5
|
+
*
|
|
6
|
+
* Returns a check for whether nothing in the stack sits above this overlay,
|
|
7
|
+
* to call when a key arrives. For an overlay in the stack, that's whether it
|
|
8
|
+
* is the topmost one. For one that isn't, such as a Toast, it's whether no
|
|
9
|
+
* overlay is open at all.
|
|
10
|
+
*
|
|
11
|
+
* @function useOverlayStack
|
|
12
|
+
* @param inStack - Whether this overlay is open and takes part.
|
|
13
|
+
* @returns A check for whether nothing in the stack is above this overlay.
|
|
14
|
+
*/
|
|
15
|
+
export declare function useOverlayStack(inStack: boolean): () => boolean;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A ref holding the value from the latest commit, for a listener that is
|
|
3
|
+
* added once and calls whatever callback it was given most recently.
|
|
4
|
+
*
|
|
5
|
+
* A listener whose effect lists a callback prop is taken off and added again
|
|
6
|
+
* each time that callback changes, and an inline one changes on every render
|
|
7
|
+
* of its parent. React can render between two listeners for the same
|
|
8
|
+
* keypress, and the browser runs neither a listener taken off mid-event nor
|
|
9
|
+
* one added mid-event, so that keypress never reaches it (#1088). Reading the
|
|
10
|
+
* callback from here keeps the listener where it is.
|
|
11
|
+
*
|
|
12
|
+
* It's updated before paint on each commit, so a listener reads the props of
|
|
13
|
+
* the render that's on screen.
|
|
14
|
+
*
|
|
15
|
+
* @function useLatestRef
|
|
16
|
+
* @param value - The value to keep current, usually a callback prop.
|
|
17
|
+
* @returns A ref whose `current` is `value` as of the latest commit.
|
|
18
|
+
*/
|
|
19
|
+
export declare function useLatestRef<T>(value: T): {
|
|
20
|
+
readonly current: T;
|
|
21
|
+
};
|