@allxsmith/bestax-bulma 5.30.0 → 5.31.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.
@@ -8,7 +8,16 @@ export type TooltipColor = 'primary' | 'link' | 'info' | 'success' | 'warning' |
8
8
  export type TooltipSize = 'small' | 'medium' | 'large';
9
9
  /**
10
10
  * Props for the Tooltip component.
11
- * @extraProp {React.ReactNode} [children] - The element that triggers the tooltip.
11
+ * @extraProp {React.ReactNode} [children] - The element that triggers the
12
+ * tooltip. Its `aria-describedby` points at the tooltip, after any ids it
13
+ * already had, so a screen reader reads the tooltip as its description when
14
+ * it takes focus, even while the tooltip is hidden. That takes a single
15
+ * element which passes `aria-describedby` on to its DOM node, as native
16
+ * elements and bestax components do, and takes focus itself, such as a
17
+ * button, a link or a `Span` with `tabIndex={0}`: something focusable inside
18
+ * it doesn't get the link, and text, a fragment or several elements get none.
19
+ * A development build warns when the first element Tab reaches in the
20
+ * trigger doesn't carry the link, or there isn't one.
12
21
  * @extraProp {string} [className] - Additional CSS classes.
13
22
  */
14
23
  export interface TooltipProps extends Omit<React.HTMLAttributes<HTMLSpanElement>, 'color' | 'content'>, Omit<BulmaClassesProps, 'color' | 'backgroundColor'> {
@@ -19,7 +28,8 @@ export interface TooltipProps extends Omit<React.HTMLAttributes<HTMLSpanElement>
19
28
  * Nothing in it should take focus or a click: it isn't in the Tab order
20
29
  * while hidden, focus there isn't counted as being in the tooltip, and
21
30
  * Escape hiding it would drop that focus. For links or buttons, use
22
- * `HoverCard` or `Popover`.
31
+ * `HoverCard` or `Popover`. A screen reader reads it as plain text, since
32
+ * it's the trigger's description.
23
33
  */
24
34
  content?: React.ReactNode;
25
35
  /** Position of the tooltip. Default: 'top'. */
@@ -81,7 +91,8 @@ export interface TooltipProps extends Omit<React.HTMLAttributes<HTMLSpanElement>
81
91
  * the trigger and comes back, or, with `openOnTap`, until the next tap on
82
92
  * the trigger. The key always goes on too, to whatever has focus or a
83
93
  * `Modal` or `Popover` around it, since a tooltip only adds to what's
84
- * there.
94
+ * there. The tooltip is its trigger's description, so a screen reader reads
95
+ * it as the trigger takes focus, whether it's showing yet or not.
85
96
  *
86
97
  * @function
87
98
  * @param {TooltipProps} props - Props for the Tooltip component.
@@ -94,15 +105,17 @@ export interface TooltipProps extends Omit<React.HTMLAttributes<HTMLSpanElement>
94
105
  * </Tooltip>
95
106
  *
96
107
  * @example
97
- * // Positioned tooltip with color
98
- * <Tooltip label="Delete item" position="right" color="danger">
99
- * <Icon icon="fas fa-trash" />
108
+ * // Positioned tooltip with color, on an icon-only button with a name of its own
109
+ * <Tooltip label="Moves it to the trash" position="right" color="danger">
110
+ * <Button aria-label="Delete">
111
+ * <Icon name="fas fa-trash" />
112
+ * </Button>
100
113
  * </Tooltip>
101
114
  *
102
115
  * @example
103
116
  * // Multiline tooltip
104
117
  * <Tooltip label="This is a longer tooltip that wraps to multiple lines" multiline>
105
- * <span>?</span>
118
+ * <button>More info</button>
106
119
  * </Tooltip>
107
120
  */
108
121
  export declare const Tooltip: React.FC<TooltipProps>;
@@ -36,5 +36,6 @@ interface ButtonsProps extends React.HTMLAttributes<HTMLDivElement>, Omit<BulmaC
36
36
  export declare const Buttons: React.FC<ButtonsProps> & {
37
37
  Button: import("../index.js").PolymorphicComponent<import("./Button.js").ButtonOwnProps, "button", never>;
38
38
  LinkButton: import("../index.js").PolymorphicComponent<import("./LinkButton.js").LinkButtonOwnProps, "button", never>;
39
+ ToggleButton: React.ForwardRefExoticComponent<import("./ToggleButton.js").ToggleButtonProps & React.RefAttributes<HTMLButtonElement>>;
39
40
  };
40
41
  export {};
@@ -33,9 +33,9 @@ export interface ToggleButtonProps extends Omit<ButtonOwnProps, 'color' | 'isAct
33
33
  /** Whether it starts pressed, when it holds its own state. */
34
34
  defaultPressed?: boolean;
35
35
  /**
36
- * Called with the new state each time it's toggled, by a click, Enter or
37
- * Space, whether or not `pressed` is set. An `onClick` that calls
38
- * `preventDefault()` stops the toggle, and this doesn't fire.
36
+ * Called with the new state each time it's toggled, whether or not
37
+ * `pressed` is set. An `onClick` that calls `preventDefault()` stops the
38
+ * toggle, and this doesn't fire.
39
39
  */
40
40
  onPressedChange?: (pressed: boolean) => void;
41
41
  /**
@@ -53,6 +53,16 @@ export interface ToggleButtonProps extends Omit<ButtonOwnProps, 'color' | 'isAct
53
53
  * ("Play", then "Pause") belongs on a plain `Button`.
54
54
  */
55
55
  children?: React.ReactNode;
56
+ /**
57
+ * Shows Bulma's spinner in place of the label and holds the toggle where it
58
+ * is: a click, Enter or Space does nothing, so neither `onClick` nor
59
+ * `onPressedChange` fires, until it's cleared. Set it while a change is
60
+ * saving. The button carries `aria-busy` and `aria-disabled` meanwhile, and
61
+ * stays focusable, so focus isn't lost mid-save. Under
62
+ * `prefers-reduced-motion: reduce` the spinner stops and stays drawn (with
63
+ * bestax's CSS loaded).
64
+ */
65
+ isLoading?: boolean;
56
66
  /**
57
67
  * Not accepted: `aria-pressed` follows the state. Declared because JSX lets a
58
68
  * hyphenated attribute through when the props don't name it, so leaving it
@@ -8,7 +8,16 @@ export type TooltipColor = 'primary' | 'link' | 'info' | 'success' | 'warning' |
8
8
  export type TooltipSize = 'small' | 'medium' | 'large';
9
9
  /**
10
10
  * Props for the Tooltip component.
11
- * @extraProp {React.ReactNode} [children] - The element that triggers the tooltip.
11
+ * @extraProp {React.ReactNode} [children] - The element that triggers the
12
+ * tooltip. Its `aria-describedby` points at the tooltip, after any ids it
13
+ * already had, so a screen reader reads the tooltip as its description when
14
+ * it takes focus, even while the tooltip is hidden. That takes a single
15
+ * element which passes `aria-describedby` on to its DOM node, as native
16
+ * elements and bestax components do, and takes focus itself, such as a
17
+ * button, a link or a `Span` with `tabIndex={0}`: something focusable inside
18
+ * it doesn't get the link, and text, a fragment or several elements get none.
19
+ * A development build warns when the first element Tab reaches in the
20
+ * trigger doesn't carry the link, or there isn't one.
12
21
  * @extraProp {string} [className] - Additional CSS classes.
13
22
  */
14
23
  export interface TooltipProps extends Omit<React.HTMLAttributes<HTMLSpanElement>, 'color' | 'content'>, Omit<BulmaClassesProps, 'color' | 'backgroundColor'> {
@@ -19,7 +28,8 @@ export interface TooltipProps extends Omit<React.HTMLAttributes<HTMLSpanElement>
19
28
  * Nothing in it should take focus or a click: it isn't in the Tab order
20
29
  * while hidden, focus there isn't counted as being in the tooltip, and
21
30
  * Escape hiding it would drop that focus. For links or buttons, use
22
- * `HoverCard` or `Popover`.
31
+ * `HoverCard` or `Popover`. A screen reader reads it as plain text, since
32
+ * it's the trigger's description.
23
33
  */
24
34
  content?: React.ReactNode;
25
35
  /** Position of the tooltip. Default: 'top'. */
@@ -81,7 +91,8 @@ export interface TooltipProps extends Omit<React.HTMLAttributes<HTMLSpanElement>
81
91
  * the trigger and comes back, or, with `openOnTap`, until the next tap on
82
92
  * the trigger. The key always goes on too, to whatever has focus or a
83
93
  * `Modal` or `Popover` around it, since a tooltip only adds to what's
84
- * there.
94
+ * there. The tooltip is its trigger's description, so a screen reader reads
95
+ * it as the trigger takes focus, whether it's showing yet or not.
85
96
  *
86
97
  * @function
87
98
  * @param {TooltipProps} props - Props for the Tooltip component.
@@ -94,15 +105,17 @@ export interface TooltipProps extends Omit<React.HTMLAttributes<HTMLSpanElement>
94
105
  * </Tooltip>
95
106
  *
96
107
  * @example
97
- * // Positioned tooltip with color
98
- * <Tooltip label="Delete item" position="right" color="danger">
99
- * <Icon icon="fas fa-trash" />
108
+ * // Positioned tooltip with color, on an icon-only button with a name of its own
109
+ * <Tooltip label="Moves it to the trash" position="right" color="danger">
110
+ * <Button aria-label="Delete">
111
+ * <Icon name="fas fa-trash" />
112
+ * </Button>
100
113
  * </Tooltip>
101
114
  *
102
115
  * @example
103
116
  * // Multiline tooltip
104
117
  * <Tooltip label="This is a longer tooltip that wraps to multiple lines" multiline>
105
- * <span>?</span>
118
+ * <button>More info</button>
106
119
  * </Tooltip>
107
120
  */
108
121
  export declare const Tooltip: React.FC<TooltipProps>;
@@ -36,5 +36,6 @@ interface ButtonsProps extends React.HTMLAttributes<HTMLDivElement>, Omit<BulmaC
36
36
  export declare const Buttons: React.FC<ButtonsProps> & {
37
37
  Button: import("../index.js").PolymorphicComponent<import("./Button.js").ButtonOwnProps, "button", never>;
38
38
  LinkButton: import("../index.js").PolymorphicComponent<import("./LinkButton.js").LinkButtonOwnProps, "button", never>;
39
+ ToggleButton: React.ForwardRefExoticComponent<import("./ToggleButton.js").ToggleButtonProps & React.RefAttributes<HTMLButtonElement>>;
39
40
  };
40
41
  export {};
@@ -33,9 +33,9 @@ export interface ToggleButtonProps extends Omit<ButtonOwnProps, 'color' | 'isAct
33
33
  /** Whether it starts pressed, when it holds its own state. */
34
34
  defaultPressed?: boolean;
35
35
  /**
36
- * Called with the new state each time it's toggled, by a click, Enter or
37
- * Space, whether or not `pressed` is set. An `onClick` that calls
38
- * `preventDefault()` stops the toggle, and this doesn't fire.
36
+ * Called with the new state each time it's toggled, whether or not
37
+ * `pressed` is set. An `onClick` that calls `preventDefault()` stops the
38
+ * toggle, and this doesn't fire.
39
39
  */
40
40
  onPressedChange?: (pressed: boolean) => void;
41
41
  /**
@@ -53,6 +53,16 @@ export interface ToggleButtonProps extends Omit<ButtonOwnProps, 'color' | 'isAct
53
53
  * ("Play", then "Pause") belongs on a plain `Button`.
54
54
  */
55
55
  children?: React.ReactNode;
56
+ /**
57
+ * Shows Bulma's spinner in place of the label and holds the toggle where it
58
+ * is: a click, Enter or Space does nothing, so neither `onClick` nor
59
+ * `onPressedChange` fires, until it's cleared. Set it while a change is
60
+ * saving. The button carries `aria-busy` and `aria-disabled` meanwhile, and
61
+ * stays focusable, so focus isn't lost mid-save. Under
62
+ * `prefers-reduced-motion: reduce` the spinner stops and stays drawn (with
63
+ * bestax's CSS loaded).
64
+ */
65
+ isLoading?: boolean;
56
66
  /**
57
67
  * Not accepted: `aria-pressed` follows the state. Declared because JSX lets a
58
68
  * hyphenated attribute through when the props don't name it, so leaving it
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@allxsmith/bestax-bulma",
3
- "version": "5.30.0",
3
+ "version": "5.31.0",
4
4
  "description": "A fully-typed React component library for the Bulma CSS framework. Build modern UIs quickly with reusable, accessible, and customizable Bulma-based React components.",
5
5
  "main": "dist/index.cjs",
6
6
  "module": "dist/index.esm.js",