@allxsmith/bestax-bulma 5.30.0 → 5.32.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/index.esm.js CHANGED
@@ -14,6 +14,7 @@ export { Navbar, NavbarBrand, NavbarBurger, NavbarDivider, NavbarDropdown, Navba
14
14
  export { Pagination, PaginationEllipsis, PaginationLink, PaginationList, PaginationNext, PaginationPrevious } from './esm/components/Pagination.js';
15
15
  export { Panel, PanelBlock, PanelButtonBlock, PanelCheckboxBlock, PanelHeading, PanelIcon, PanelInputBlock, PanelTabs } from './esm/components/Panel.js';
16
16
  export { Tab, TabContentItem, TabItem, TabList, Tabs, TabsContent } from './esm/components/Tabs.js';
17
+ export { SegmentedControl } from './esm/components/SegmentedControl.js';
17
18
  export { Loading } from './esm/components/Loading.js';
18
19
  export { Collapse } from './esm/components/Collapse.js';
19
20
  export { Collapses } from './esm/components/Collapses.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -0,0 +1,116 @@
1
+ import React from 'react';
2
+ import { type ButtonOwnProps } from '../elements/Button.js';
3
+ import { BulmaClassesProps } from '../helpers/useBulmaClasses.js';
4
+ /**
5
+ * The fills the checked segment takes: `Button`'s colors, minus `text` and
6
+ * `ghost`, which don't fill, and `white`, `light`, `dark` and `black`, which in
7
+ * one theme or the other fill about as light or dark as an unchecked segment
8
+ * already is. The same set `ToggleButton` takes.
9
+ */
10
+ export type SegmentedControlColor = 'primary' | 'link' | 'info' | 'success' | 'warning' | 'danger';
11
+ /**
12
+ * Props for the SegmentedControl component. The helper props, the other `<div>`
13
+ * attributes and the `ref` all land on the row.
14
+ *
15
+ * @extraProp {string} [aria-label] - Names the group for a screen reader, such as "Text alignment". A radio group needs a name, so pass this or `aria-labelledby`, and a development build warns when it has neither.
16
+ * @extraProp {string} [aria-labelledby] - The id of a visible heading or label that names the group, in place of `aria-label`.
17
+ * @extraProp {React.Ref<HTMLDivElement>} [ref] - Ref forwarded to the row's `<div>`.
18
+ */
19
+ export interface SegmentedControlProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'onChange' | 'defaultValue' | 'color' | 'role'>, Omit<BulmaClassesProps, 'color' | 'colorShade' | 'backgroundColor' | 'backgroundColorShade'> {
20
+ /**
21
+ * The checked segment's `value`, when you hold the state. Setting it makes
22
+ * the group controlled: picking a segment only calls `onChange`, and nothing
23
+ * changes until you pass the new value. `null` checks nothing, with the
24
+ * tab stop `defaultValue` describes for that. Pick this or `defaultValue`
25
+ * for the group's lifetime.
26
+ */
27
+ value?: string | null;
28
+ /**
29
+ * The segment checked to begin with, when the group holds its own state.
30
+ * Leave it out and nothing is checked until someone picks one, and Tab
31
+ * lands on the first enabled segment meanwhile. That fallback takes hold
32
+ * once the row has rendered in the browser: server markup with nothing
33
+ * checked has no tab stop until then, while a checked segment is the stop
34
+ * from the server markup on.
35
+ */
36
+ defaultValue?: string;
37
+ /**
38
+ * Called with the newly checked segment's `value`, whether or not `value`
39
+ * is set. The arrow keys, Home and End check the segment they move to, so
40
+ * each of those calls it too: the check follows focus, as in a native radio
41
+ * group. Pressing the checked segment again doesn't call it, since a
42
+ * segmented control can't be cleared: one stays checked once one is.
43
+ */
44
+ onChange?: (value: string) => void;
45
+ /**
46
+ * The checked segment's fill. The others are plain buttons, so the fill is
47
+ * the difference people see. Takes the same colors as `ToggleButton`, for
48
+ * the same reason: `white`, `light`, `dark` and `black` fill about as light
49
+ * or dark as a plain button already is in one theme or the other.
50
+ */
51
+ color?: SegmentedControlColor;
52
+ /** Size of every segment, through Bulma's `are-<size>` on the row. */
53
+ size?: 'small' | 'medium' | 'large';
54
+ /**
55
+ * Joins the segments into one row with no gap between them, Bulma's
56
+ * `has-addons`. Set it to `false` for separate buttons.
57
+ */
58
+ hasAddons?: boolean;
59
+ /** Centers the row. */
60
+ isCentered?: boolean;
61
+ /** Aligns the row to the right. */
62
+ isRight?: boolean;
63
+ /** Additional CSS classes to apply. */
64
+ className?: string;
65
+ /** The `SegmentedControl.Segment`s, each with a `value` of its own. */
66
+ children?: React.ReactNode;
67
+ }
68
+ /**
69
+ * Props for SegmentedControl.Segment. The helper props, the other button
70
+ * attributes and the `ref` all land on the `<button>`.
71
+ *
72
+ * Some of `Button`'s props are left out on purpose. `as`, `type`, `role` and
73
+ * `tabIndex`, since a segment is always a `<button type="button" role="radio">`
74
+ * and the group decides which segment Tab reaches. `color`, which the group
75
+ * sets for the checked segment, and the props that change the fill
76
+ * (`isActive`, `isLight`, `isOutlined`, `isInverted`, `textColor`, `bgColor`
77
+ * and their shades), since each would color it whether checked or not. `size`
78
+ * and the width and shape props, which the row sets for every segment. And
79
+ * `isStatic` and `isLoading`, a segment you couldn't pick.
80
+ *
81
+ * @extraProp {React.Ref<HTMLButtonElement>} [ref] - Ref forwarded to the `<button>`.
82
+ */
83
+ export interface SegmentedControlSegmentProps extends Omit<ButtonOwnProps, 'color' | 'size' | 'isActive' | 'isStatic' | 'isLoading' | 'isLight' | 'isOutlined' | 'isInverted' | 'isRounded' | 'isFullwidth' | 'isFullWidth' | 'textColor' | 'bgColor' | 'colorShade' | 'backgroundColorShade'>, Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, keyof ButtonOwnProps | 'type' | 'value' | 'role' | 'tabIndex' | 'aria-checked' | 'aria-pressed'> {
84
+ /**
85
+ * **Required.** What `onChange` reports when this segment is checked, and
86
+ * what the group's `value` and `defaultValue` name it by. Unique within the
87
+ * group.
88
+ */
89
+ value: string;
90
+ /**
91
+ * The label. An icon on its own needs an `aria-label`, so a screen reader
92
+ * has something to say.
93
+ */
94
+ children?: React.ReactNode;
95
+ /**
96
+ * Disables the segment, the same as `disabled`: it can't be clicked, the
97
+ * arrow keys, Home and End skip it, and it never holds the row's tab stop.
98
+ * A checked one keeps its fill under Bulma's disabled look.
99
+ */
100
+ isDisabled?: boolean;
101
+ /**
102
+ * Not accepted: `aria-checked` follows the group's value. Declared because
103
+ * JSX lets a hyphenated attribute through when the props don't name it.
104
+ * @internal
105
+ */
106
+ 'aria-checked'?: never;
107
+ /**
108
+ * Not accepted: a segment is a radio, which says checked, not pressed.
109
+ * @internal
110
+ */
111
+ 'aria-pressed'?: never;
112
+ }
113
+ export declare const SegmentedControl: React.ForwardRefExoticComponent<SegmentedControlProps & React.RefAttributes<HTMLDivElement>> & {
114
+ Segment: React.ForwardRefExoticComponent<SegmentedControlSegmentProps & React.RefAttributes<HTMLButtonElement>>;
115
+ };
116
+ export default SegmentedControl;
@@ -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
@@ -68,7 +78,8 @@ export interface ToggleButtonProps extends Omit<ButtonOwnProps, 'color' | 'isAct
68
78
  * carries no form value: a setting saved with a form is a `Checkbox` or a
69
79
  * `Switch`. A set of toggles that each turn on and off on their own goes in
70
80
  * `Buttons hasAddons` with `role="group"` and an `aria-label`. A set where only
71
- * one can be on is a radio group rather than a row of these: use `Radios`.
81
+ * one can be on is a radio group rather than a row of these: use
82
+ * `SegmentedControl`, or `Radios` for a choice that's sent with a form.
72
83
  *
73
84
  * @function
74
85
  * @param {ToggleButtonProps} props - Props for the ToggleButton component.
@@ -13,6 +13,7 @@ export * from './components/Navbar.js';
13
13
  export * from './components/Pagination.js';
14
14
  export * from './components/Panel.js';
15
15
  export * from './components/Tabs.js';
16
+ export * from './components/SegmentedControl.js';
16
17
  export * from './components/Loading.js';
17
18
  export * from './components/Collapse.js';
18
19
  export * from './components/Collapses.js';
@@ -0,0 +1,116 @@
1
+ import React from 'react';
2
+ import { type ButtonOwnProps } from '../elements/Button.js';
3
+ import { BulmaClassesProps } from '../helpers/useBulmaClasses.js';
4
+ /**
5
+ * The fills the checked segment takes: `Button`'s colors, minus `text` and
6
+ * `ghost`, which don't fill, and `white`, `light`, `dark` and `black`, which in
7
+ * one theme or the other fill about as light or dark as an unchecked segment
8
+ * already is. The same set `ToggleButton` takes.
9
+ */
10
+ export type SegmentedControlColor = 'primary' | 'link' | 'info' | 'success' | 'warning' | 'danger';
11
+ /**
12
+ * Props for the SegmentedControl component. The helper props, the other `<div>`
13
+ * attributes and the `ref` all land on the row.
14
+ *
15
+ * @extraProp {string} [aria-label] - Names the group for a screen reader, such as "Text alignment". A radio group needs a name, so pass this or `aria-labelledby`, and a development build warns when it has neither.
16
+ * @extraProp {string} [aria-labelledby] - The id of a visible heading or label that names the group, in place of `aria-label`.
17
+ * @extraProp {React.Ref<HTMLDivElement>} [ref] - Ref forwarded to the row's `<div>`.
18
+ */
19
+ export interface SegmentedControlProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'onChange' | 'defaultValue' | 'color' | 'role'>, Omit<BulmaClassesProps, 'color' | 'colorShade' | 'backgroundColor' | 'backgroundColorShade'> {
20
+ /**
21
+ * The checked segment's `value`, when you hold the state. Setting it makes
22
+ * the group controlled: picking a segment only calls `onChange`, and nothing
23
+ * changes until you pass the new value. `null` checks nothing, with the
24
+ * tab stop `defaultValue` describes for that. Pick this or `defaultValue`
25
+ * for the group's lifetime.
26
+ */
27
+ value?: string | null;
28
+ /**
29
+ * The segment checked to begin with, when the group holds its own state.
30
+ * Leave it out and nothing is checked until someone picks one, and Tab
31
+ * lands on the first enabled segment meanwhile. That fallback takes hold
32
+ * once the row has rendered in the browser: server markup with nothing
33
+ * checked has no tab stop until then, while a checked segment is the stop
34
+ * from the server markup on.
35
+ */
36
+ defaultValue?: string;
37
+ /**
38
+ * Called with the newly checked segment's `value`, whether or not `value`
39
+ * is set. The arrow keys, Home and End check the segment they move to, so
40
+ * each of those calls it too: the check follows focus, as in a native radio
41
+ * group. Pressing the checked segment again doesn't call it, since a
42
+ * segmented control can't be cleared: one stays checked once one is.
43
+ */
44
+ onChange?: (value: string) => void;
45
+ /**
46
+ * The checked segment's fill. The others are plain buttons, so the fill is
47
+ * the difference people see. Takes the same colors as `ToggleButton`, for
48
+ * the same reason: `white`, `light`, `dark` and `black` fill about as light
49
+ * or dark as a plain button already is in one theme or the other.
50
+ */
51
+ color?: SegmentedControlColor;
52
+ /** Size of every segment, through Bulma's `are-<size>` on the row. */
53
+ size?: 'small' | 'medium' | 'large';
54
+ /**
55
+ * Joins the segments into one row with no gap between them, Bulma's
56
+ * `has-addons`. Set it to `false` for separate buttons.
57
+ */
58
+ hasAddons?: boolean;
59
+ /** Centers the row. */
60
+ isCentered?: boolean;
61
+ /** Aligns the row to the right. */
62
+ isRight?: boolean;
63
+ /** Additional CSS classes to apply. */
64
+ className?: string;
65
+ /** The `SegmentedControl.Segment`s, each with a `value` of its own. */
66
+ children?: React.ReactNode;
67
+ }
68
+ /**
69
+ * Props for SegmentedControl.Segment. The helper props, the other button
70
+ * attributes and the `ref` all land on the `<button>`.
71
+ *
72
+ * Some of `Button`'s props are left out on purpose. `as`, `type`, `role` and
73
+ * `tabIndex`, since a segment is always a `<button type="button" role="radio">`
74
+ * and the group decides which segment Tab reaches. `color`, which the group
75
+ * sets for the checked segment, and the props that change the fill
76
+ * (`isActive`, `isLight`, `isOutlined`, `isInverted`, `textColor`, `bgColor`
77
+ * and their shades), since each would color it whether checked or not. `size`
78
+ * and the width and shape props, which the row sets for every segment. And
79
+ * `isStatic` and `isLoading`, a segment you couldn't pick.
80
+ *
81
+ * @extraProp {React.Ref<HTMLButtonElement>} [ref] - Ref forwarded to the `<button>`.
82
+ */
83
+ export interface SegmentedControlSegmentProps extends Omit<ButtonOwnProps, 'color' | 'size' | 'isActive' | 'isStatic' | 'isLoading' | 'isLight' | 'isOutlined' | 'isInverted' | 'isRounded' | 'isFullwidth' | 'isFullWidth' | 'textColor' | 'bgColor' | 'colorShade' | 'backgroundColorShade'>, Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, keyof ButtonOwnProps | 'type' | 'value' | 'role' | 'tabIndex' | 'aria-checked' | 'aria-pressed'> {
84
+ /**
85
+ * **Required.** What `onChange` reports when this segment is checked, and
86
+ * what the group's `value` and `defaultValue` name it by. Unique within the
87
+ * group.
88
+ */
89
+ value: string;
90
+ /**
91
+ * The label. An icon on its own needs an `aria-label`, so a screen reader
92
+ * has something to say.
93
+ */
94
+ children?: React.ReactNode;
95
+ /**
96
+ * Disables the segment, the same as `disabled`: it can't be clicked, the
97
+ * arrow keys, Home and End skip it, and it never holds the row's tab stop.
98
+ * A checked one keeps its fill under Bulma's disabled look.
99
+ */
100
+ isDisabled?: boolean;
101
+ /**
102
+ * Not accepted: `aria-checked` follows the group's value. Declared because
103
+ * JSX lets a hyphenated attribute through when the props don't name it.
104
+ * @internal
105
+ */
106
+ 'aria-checked'?: never;
107
+ /**
108
+ * Not accepted: a segment is a radio, which says checked, not pressed.
109
+ * @internal
110
+ */
111
+ 'aria-pressed'?: never;
112
+ }
113
+ export declare const SegmentedControl: React.ForwardRefExoticComponent<SegmentedControlProps & React.RefAttributes<HTMLDivElement>> & {
114
+ Segment: React.ForwardRefExoticComponent<SegmentedControlSegmentProps & React.RefAttributes<HTMLButtonElement>>;
115
+ };
116
+ export default SegmentedControl;
@@ -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
@@ -68,7 +78,8 @@ export interface ToggleButtonProps extends Omit<ButtonOwnProps, 'color' | 'isAct
68
78
  * carries no form value: a setting saved with a form is a `Checkbox` or a
69
79
  * `Switch`. A set of toggles that each turn on and off on their own goes in
70
80
  * `Buttons hasAddons` with `role="group"` and an `aria-label`. A set where only
71
- * one can be on is a radio group rather than a row of these: use `Radios`.
81
+ * one can be on is a radio group rather than a row of these: use
82
+ * `SegmentedControl`, or `Radios` for a choice that's sent with a form.
72
83
  *
73
84
  * @function
74
85
  * @param {ToggleButtonProps} props - Props for the ToggleButton component.
@@ -13,6 +13,7 @@ export * from './components/Navbar.js';
13
13
  export * from './components/Pagination.js';
14
14
  export * from './components/Panel.js';
15
15
  export * from './components/Tabs.js';
16
+ export * from './components/SegmentedControl.js';
16
17
  export * from './components/Loading.js';
17
18
  export * from './components/Collapse.js';
18
19
  export * from './components/Collapses.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@allxsmith/bestax-bulma",
3
- "version": "5.30.0",
3
+ "version": "5.32.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",