@allxsmith/bestax-bulma 5.50.0 → 5.52.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.
Files changed (65) hide show
  1. package/dist/bestax.css +1 -1
  2. package/dist/bestax.css.map +1 -1
  3. package/dist/esm/components/Command.js +637 -0
  4. package/dist/esm/components/Command.js.map +1 -0
  5. package/dist/esm/components/EmptyState.js +2 -2
  6. package/dist/esm/components/Timeline.js +5 -5
  7. package/dist/esm/components/TreeView.js +3 -3
  8. package/dist/esm/components/TreeView.js.map +1 -1
  9. package/dist/esm/elements/DescriptionList.js +133 -0
  10. package/dist/esm/elements/DescriptionList.js.map +1 -0
  11. package/dist/esm/form/Autocomplete.js +2 -2
  12. package/dist/esm/form/CheckboxCard.js +118 -0
  13. package/dist/esm/form/CheckboxCard.js.map +1 -0
  14. package/dist/esm/form/Checkboxes.js +14 -3
  15. package/dist/esm/form/Checkboxes.js.map +1 -1
  16. package/dist/esm/form/RadioCard.js +85 -0
  17. package/dist/esm/form/RadioCard.js.map +1 -0
  18. package/dist/esm/form/Radios.js +14 -3
  19. package/dist/esm/form/Radios.js.map +1 -1
  20. package/dist/esm/form/groupFieldset.js +38 -0
  21. package/dist/esm/form/groupFieldset.js.map +1 -0
  22. package/dist/esm/form/useAutoLabelId.js +1 -1
  23. package/dist/esm/helpers/useComboboxEngine.js +3 -3
  24. package/dist/esm/helpers/useFocusTrap.js +2 -2
  25. package/dist/esm/helpers/useFocusTrap.js.map +1 -1
  26. package/dist/extras.css +1 -1
  27. package/dist/extras.css.map +1 -1
  28. package/dist/index.cjs +2685 -1694
  29. package/dist/index.cjs.map +1 -1
  30. package/dist/index.esm.js +4 -0
  31. package/dist/index.esm.js.map +1 -1
  32. package/dist/types/components/Command.d.ts +318 -0
  33. package/dist/types/elements/DescriptionList.d.ts +185 -0
  34. package/dist/types/form/CheckboxCard.d.ts +94 -0
  35. package/dist/types/form/Checkboxes.d.ts +13 -0
  36. package/dist/types/form/RadioCard.d.ts +81 -0
  37. package/dist/types/form/Radios.d.ts +13 -0
  38. package/dist/types/form/groupFieldset.d.ts +32 -0
  39. package/dist/types/index.d.ts +4 -0
  40. package/dist/types-cjs/components/Command.d.ts +318 -0
  41. package/dist/types-cjs/elements/DescriptionList.d.ts +185 -0
  42. package/dist/types-cjs/form/CheckboxCard.d.ts +94 -0
  43. package/dist/types-cjs/form/Checkboxes.d.ts +13 -0
  44. package/dist/types-cjs/form/RadioCard.d.ts +81 -0
  45. package/dist/types-cjs/form/Radios.d.ts +13 -0
  46. package/dist/types-cjs/form/groupFieldset.d.ts +32 -0
  47. package/dist/types-cjs/index.d.ts +4 -0
  48. package/dist/versions/bestax-no-dark-mode.css +1 -1
  49. package/dist/versions/bestax-no-dark-mode.css.map +1 -1
  50. package/dist/versions/bestax-no-helpers-prefixed.css +1 -1
  51. package/dist/versions/bestax-no-helpers-prefixed.css.map +1 -1
  52. package/dist/versions/bestax-no-helpers.css +1 -1
  53. package/dist/versions/bestax-no-helpers.css.map +1 -1
  54. package/dist/versions/bestax-prefixed.css +1 -1
  55. package/dist/versions/bestax-prefixed.css.map +1 -1
  56. package/package.json +1 -1
  57. package/src/scss/components/_command.scss +259 -0
  58. package/src/scss/components/_index.scss +1 -0
  59. package/src/scss/elements/_descriptionlist.scss +153 -0
  60. package/src/scss/elements/_index.scss +1 -0
  61. package/src/scss/form/_checkbox.scss +44 -0
  62. package/src/scss/form/_checkboxcard.scss +355 -0
  63. package/src/scss/form/_index.scss +2 -0
  64. package/src/scss/form/_radio.scss +44 -0
  65. package/src/scss/form/_radiocard.scss +291 -0
package/dist/index.esm.js CHANGED
@@ -32,6 +32,7 @@ export { Carousel, CarouselItem } from './esm/components/Carousel.js';
32
32
  export { Reveal } from './esm/components/Reveal.js';
33
33
  export { TreeView, TreeViewItem } from './esm/components/TreeView.js';
34
34
  export { ScrollArea } from './esm/components/ScrollArea.js';
35
+ export { Command, CommandDialog, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList } from './esm/components/Command.js';
35
36
  export { Block } from './esm/elements/Block.js';
36
37
  export { Box } from './esm/elements/Box.js';
37
38
  export { Button } from './esm/elements/Button.js';
@@ -41,6 +42,7 @@ export { ToggleButton } from './esm/elements/ToggleButton.js';
41
42
  export { Code } from './esm/elements/Code.js';
42
43
  export { Content } from './esm/elements/Content.js';
43
44
  export { Delete } from './esm/elements/Delete.js';
45
+ export { DescriptionList, DescriptionListItem, DescriptionListLabel, DescriptionListValue } from './esm/elements/DescriptionList.js';
44
46
  export { Divider } from './esm/elements/Divider.js';
45
47
  export { Emphasis } from './esm/elements/Emphasis.js';
46
48
  export { Figure } from './esm/elements/Figure.js';
@@ -73,11 +75,13 @@ export { Title } from './esm/elements/Title.js';
73
75
  export { Tr } from './esm/elements/Tr.js';
74
76
  export { UnorderedList } from './esm/elements/UnorderedList.js';
75
77
  export { Checkbox, checkboxColors, checkboxSizes } from './esm/form/Checkbox.js';
78
+ export { CheckboxCard } from './esm/form/CheckboxCard.js';
76
79
  export { Checkboxes } from './esm/form/Checkboxes.js';
77
80
  export { Control } from './esm/form/Control.js';
78
81
  export { Field, FieldBody, FieldLabel } from './esm/form/Field.js';
79
82
  export { File } from './esm/form/File.js';
80
83
  export { Radio, radioColors, radioSizes } from './esm/form/Radio.js';
84
+ export { RadioCard } from './esm/form/RadioCard.js';
81
85
  export { Radios } from './esm/form/Radios.js';
82
86
  export { Switch, switchColors, switchSizes } from './esm/form/Switch.js';
83
87
  export { Slider } from './esm/form/Slider.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,318 @@
1
+ import React from 'react';
2
+ import { BulmaClassesProps } from '../helpers/useBulmaClasses.js';
3
+ import { InputProps } from '../form/Input.js';
4
+ /** One action in a Command's `actions`. */
5
+ export interface CommandAction {
6
+ /** Unique within the Command. It's the item's `value`, so `onSelect` hands it back. */
7
+ id: string;
8
+ /** What the item shows, and what typing matches first. */
9
+ label: string;
10
+ /**
11
+ * A line under the label, such as what the action does or where it goes.
12
+ * Typing matches it too, after the labels. A screen reader hears it after
13
+ * the label, as the item's description.
14
+ */
15
+ description?: string;
16
+ /**
17
+ * More words typing matches, after the labels, such as `['theme']` for
18
+ * "Dark mode". They aren't shown.
19
+ */
20
+ keywords?: string[];
21
+ /**
22
+ * The heading the action goes under. Groups show in the order the matches
23
+ * first name them, so the best match is always on top, and the actions with
24
+ * no group show together where the first of them is.
25
+ */
26
+ group?: string;
27
+ /** Shown before the label, and hidden from assistive tech. */
28
+ icon?: React.ReactNode;
29
+ /**
30
+ * Shown at the end of the row, such as the action's own keyboard shortcut in
31
+ * a `Kbd.Group`, or a `Tag`. It only shows: nothing listens for a shortcut
32
+ * written here. A screen reader hears it after the label, with the
33
+ * description.
34
+ */
35
+ hint?: React.ReactNode;
36
+ /** Shown, and reached with the arrows so a screen reader user finds it, but never run. */
37
+ disabled?: boolean;
38
+ /** Runs the action, when it's picked with Enter or a click, before the Command's `onSelect`. */
39
+ onSelect?: () => void;
40
+ }
41
+ /** What a Command takes whether it's given `actions` or built from parts. */
42
+ interface CommandBaseProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'color' | 'onSelect'>, Omit<BulmaClassesProps, 'color'> {
43
+ /**
44
+ * What the Command is for, such as "Commands" or "Settings". It's never
45
+ * shown: it names the search field and the list for assistive tech, and in
46
+ * `Command.Dialog` the dialog too. An empty string counts as none.
47
+ * @defaultValue 'Commands'
48
+ */
49
+ label?: string;
50
+ /**
51
+ * The search, controlled: the text in the field. Pair it with
52
+ * `onQueryChange`.
53
+ */
54
+ query?: string;
55
+ /**
56
+ * The search to start with when uncontrolled.
57
+ * @defaultValue ''
58
+ */
59
+ defaultQuery?: string;
60
+ /**
61
+ * Called with the search as the user types it. Built from parts, this is
62
+ * where the app filters its items.
63
+ */
64
+ onQueryChange?: (query: string) => void;
65
+ /**
66
+ * Called with the picked item's `value`, an action's `id`, when it's run
67
+ * with Enter or a click, after the item's own `onSelect`. A disabled item
68
+ * is never run.
69
+ */
70
+ onSelect?: (value: string) => void;
71
+ }
72
+ /** Props for a Command given `actions`. */
73
+ export interface CommandActionsProps extends CommandBaseProps {
74
+ /**
75
+ * The actions, for a Command that renders the field, the list, the groups
76
+ * and the empty message itself. Typing filters them by label, keywords and
77
+ * description, ignoring case, with label matches first. Leave it out to
78
+ * build the Command from parts.
79
+ */
80
+ actions: CommandAction[];
81
+ /**
82
+ * Takes over the filtering, with `actions`: it's handed the search as typed
83
+ * and every action, and returns the ones to show, in the order to show
84
+ * them, which is how to plug in fuzzy matching or cut the list short. It's
85
+ * called with an empty search too.
86
+ */
87
+ filter?: (query: string, actions: CommandAction[]) => CommandAction[];
88
+ /** The field's placeholder, with `actions`. */
89
+ placeholder?: string;
90
+ /**
91
+ * What shows in place of the list, with `actions`, when nothing matches.
92
+ * It's announced the way `Command.Empty` is. `null` shows nothing.
93
+ * @defaultValue 'No results'
94
+ */
95
+ empty?: React.ReactNode;
96
+ /** @internal With `actions`, the Command renders its own parts. */
97
+ children?: never;
98
+ }
99
+ /** Props for a Command built from parts. */
100
+ export interface CommandPartsProps extends CommandBaseProps {
101
+ /**
102
+ * The parts, in order: `Command.Input`, then `Command.List` while there are
103
+ * items and `Command.Empty` while there aren't. Nothing filters them, so
104
+ * render the items that match the search `onQueryChange` reports. With
105
+ * `actions` there are none to give: children given with it are ignored,
106
+ * with a warning in development.
107
+ */
108
+ children?: React.ReactNode;
109
+ /** @internal Built from parts, the app renders the items. */
110
+ actions?: never;
111
+ /** @internal Built from parts, the app filters. */
112
+ filter?: never;
113
+ /** @internal Built from parts, `Command.Input` takes the placeholder. */
114
+ placeholder?: never;
115
+ /** @internal Built from parts, `Command.Empty` is the empty message. */
116
+ empty?: never;
117
+ }
118
+ /**
119
+ * Props for the Command component: given `actions`, it renders, filters and
120
+ * groups them itself, and without them it's built from parts. The helper
121
+ * props, the other attributes and the `ref` land on the `div.command` around
122
+ * the field and the list.
123
+ *
124
+ * @extraProp {React.Ref<HTMLDivElement>} [ref] - Ref forwarded to the `div.command` around the field and the list.
125
+ */
126
+ export type CommandProps = CommandActionsProps | CommandPartsProps;
127
+ /** What Command.Dialog takes on top of a Command's props. */
128
+ interface CommandDialogOwnProps {
129
+ /** Controlled open state. When set, opening and closing only report through `onOpenChange`. */
130
+ open?: boolean;
131
+ /**
132
+ * Initial open state when uncontrolled.
133
+ * @defaultValue false
134
+ */
135
+ defaultOpen?: boolean;
136
+ /**
137
+ * Called with the open state asked for: `true` from the `shortcut`, and
138
+ * `false` from Escape, a click on the background, or a pick while
139
+ * `closeOnSelect` is on. Fires in controlled and uncontrolled use.
140
+ */
141
+ onOpenChange?: (open: boolean) => void;
142
+ /**
143
+ * A key combination that opens the dialog from anywhere on the page, such
144
+ * as `"mod+k"`: modifiers and a key joined by `+`, where `mod` is Ctrl or
145
+ * ⌘ (either one, on every platform), and the others are `ctrl`, `meta`,
146
+ * `alt` and `shift`. It's ignored while the user is typing in a text field,
147
+ * a select or editable content, while an IME is composing, while a modal
148
+ * overlay is open (a `Modal`, a `Dialog`, a `Sidebar` with its overlay or a
149
+ * full-page `Loading`), and when something else has already used the key.
150
+ * It only opens the dialog. Off unless given.
151
+ */
152
+ shortcut?: string;
153
+ /**
154
+ * Closes the dialog once an item has run. Turn it off for an item that
155
+ * opens another page of the palette, and close it yourself with `open`.
156
+ * @defaultValue true
157
+ */
158
+ closeOnSelect?: boolean;
159
+ /**
160
+ * Clears the search when the dialog closes: an uncontrolled one itself,
161
+ * and a controlled one through `onQueryChange('')`.
162
+ * @defaultValue true
163
+ */
164
+ clearOnClose?: boolean;
165
+ /**
166
+ * Renders the dialog into a portal target instead of inline. Forwarded to
167
+ * the underlying `Modal`; see its `portal` prop for the accepted values.
168
+ * @defaultValue false
169
+ */
170
+ portal?: boolean | string | HTMLElement;
171
+ }
172
+ /** Props for a Command.Dialog given `actions`. */
173
+ export interface CommandDialogActionsProps extends CommandActionsProps, CommandDialogOwnProps {
174
+ }
175
+ /** Props for a Command.Dialog built from parts. */
176
+ export interface CommandDialogPartsProps extends CommandPartsProps, CommandDialogOwnProps {
177
+ }
178
+ /**
179
+ * Props for Command.Dialog, the Command in a modal: a Command's props, given
180
+ * `actions` or built from parts, and the dialog's own. The helper props, the
181
+ * other attributes and the `ref` land on the `div.command` that is the
182
+ * dialog.
183
+ *
184
+ * @extraProp {React.Ref<HTMLDivElement>} [ref] - Ref forwarded to the `div.command` that is the dialog.
185
+ */
186
+ export type CommandDialogProps = CommandDialogActionsProps | CommandDialogPartsProps;
187
+ /**
188
+ * Props for Command.Input, the search field. It renders `Input`, so its
189
+ * icons, `isLoading` and `color` work as they do there. Its text is the
190
+ * Command's `query`, and it's `autoComplete="off"`, so the browser's own
191
+ * suggestions don't open over the list: neither is yours to set.
192
+ */
193
+ export type CommandInputProps = Omit<InputProps, 'label' | 'labelSize' | 'labelProps' | 'horizontal' | 'message' | 'messageColor' | 'fieldClassName' | 'role' | 'autoComplete' | 'value' | 'defaultValue'>;
194
+ /**
195
+ * Props for Command.List, the list. Its `id` is the one the field's
196
+ * `aria-controls` names, so it isn't yours to set.
197
+ */
198
+ export interface CommandListProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'role' | 'id'> {
199
+ /** `Command.Item`s and `Command.Group`s, in the order they're shown. */
200
+ children?: React.ReactNode;
201
+ }
202
+ /** Props for Command.Group, items under a heading. */
203
+ export interface CommandGroupProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'role'> {
204
+ /**
205
+ * The heading, which also names the group for assistive tech, unless you
206
+ * give the group an `aria-label` or `aria-labelledby` of its own.
207
+ */
208
+ label: React.ReactNode;
209
+ /** The group's `Command.Item`s. */
210
+ children?: React.ReactNode;
211
+ }
212
+ /**
213
+ * Props for Command.Item, one thing to do in the list. Its `id` follows from
214
+ * its `value`, since the field's `aria-activedescendant` names it, so it
215
+ * isn't yours to set.
216
+ */
217
+ export interface CommandItemProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'role' | 'onSelect' | 'id'> {
218
+ /** What the Command's `onSelect` hands back. Unique within the Command. */
219
+ value: string;
220
+ /**
221
+ * Can't be run. The arrows still reach it, so a screen reader user finds
222
+ * it, and it's never `aria-selected`.
223
+ * @defaultValue false
224
+ */
225
+ disabled?: boolean;
226
+ /** Runs the item, when it's picked with Enter or a click, before the Command's `onSelect`. */
227
+ onSelect?: () => void;
228
+ /** Shown before the label, and hidden from assistive tech. */
229
+ icon?: React.ReactNode;
230
+ /**
231
+ * A line under the label. A screen reader hears it after the label, as the
232
+ * item's description.
233
+ */
234
+ description?: React.ReactNode;
235
+ /**
236
+ * Shown at the end of the row, such as a keyboard shortcut in a
237
+ * `Kbd.Group`, or a `Tag`. It only shows. A screen reader hears it after
238
+ * the label, with the description.
239
+ */
240
+ hint?: React.ReactNode;
241
+ /** The label, which names the item. */
242
+ children?: React.ReactNode;
243
+ }
244
+ /** Props for Command.Empty, the message shown in place of the list. */
245
+ export interface CommandEmptyProps extends React.HTMLAttributes<HTMLDivElement> {
246
+ /**
247
+ * The message, such as "No commands match". Its text is announced when
248
+ * typing brings it on screen and isn't read again while it stays, so a
249
+ * message that names the search is heard for the first search only.
250
+ */
251
+ children?: React.ReactNode;
252
+ }
253
+ /**
254
+ * The search field, with the combobox role and the keys, rendered as an `Input` with a search icon.
255
+ *
256
+ * @function
257
+ * @param {CommandInputProps} props - Props for the Command.Input component.
258
+ * @param {React.Ref<HTMLInputElement>} ref - Forwarded ref to the `<input>`.
259
+ * @returns {JSX.Element} The field in its Control.
260
+ */
261
+ export declare const CommandInput: React.ForwardRefExoticComponent<CommandInputProps & React.RefAttributes<HTMLInputElement>>;
262
+ /**
263
+ * The list of items, a `listbox` named by the Command's `label`.
264
+ *
265
+ * @function
266
+ * @param {CommandListProps} props - Props for the Command.List component.
267
+ * @returns {JSX.Element} The listbox.
268
+ */
269
+ export declare const CommandList: React.FC<CommandListProps>;
270
+ /**
271
+ * Items under a heading, a `group` named by it.
272
+ *
273
+ * @function
274
+ * @param {CommandGroupProps} props - Props for the Command.Group component.
275
+ * @returns {JSX.Element} The group and its heading.
276
+ */
277
+ export declare const CommandGroup: React.FC<CommandGroupProps>;
278
+ /**
279
+ * One thing to do in the list, named by its label and described by its description and hint.
280
+ *
281
+ * @function
282
+ * @param {CommandItemProps} props - Props for the Command.Item component.
283
+ * @returns {JSX.Element} The item.
284
+ */
285
+ export declare const CommandItem: React.FC<CommandItemProps>;
286
+ /**
287
+ * The message shown in place of the list when nothing matches, announced when typing brings it on screen.
288
+ *
289
+ * @function
290
+ * @param {CommandEmptyProps} props - Props for the Command.Empty component.
291
+ * @returns {JSX.Element} The message.
292
+ */
293
+ export declare const CommandEmpty: React.FC<CommandEmptyProps>;
294
+ /**
295
+ * The Command in a modal, a command palette, opened by its `shortcut` or by `open`, that closes once an item has run.
296
+ *
297
+ * It renders nothing while it's closed. Open, it's a `Modal` with a
298
+ * background and the Command's box as the `dialog`, named by `label`:
299
+ * focus goes to the search field, Tab stays inside, Escape and a click on
300
+ * the background close it, the page behind it doesn't scroll, and focus goes
301
+ * back to where it was when it closes.
302
+ *
303
+ * @function
304
+ * @param {CommandDialogProps} props - Props for the Command.Dialog component.
305
+ * @param {React.Ref<HTMLDivElement>} ref - Forwarded ref to the `div.command` that is the dialog.
306
+ * @returns {JSX.Element | null} The dialog, or nothing while it's closed.
307
+ */
308
+ export declare const CommandDialog: React.ForwardRefExoticComponent<CommandDialogProps & React.RefAttributes<HTMLDivElement>>;
309
+ /** Command with Input, List, Group, Item, Empty and Dialog sub-components. */
310
+ export declare const Command: React.ForwardRefExoticComponent<CommandProps & React.RefAttributes<HTMLDivElement>> & {
311
+ Input: React.ForwardRefExoticComponent<CommandInputProps & React.RefAttributes<HTMLInputElement>>;
312
+ List: React.FC<CommandListProps>;
313
+ Group: React.FC<CommandGroupProps>;
314
+ Item: React.FC<CommandItemProps>;
315
+ Empty: React.FC<CommandEmptyProps>;
316
+ Dialog: React.ForwardRefExoticComponent<CommandDialogProps & React.RefAttributes<HTMLDivElement>>;
317
+ };
318
+ export default Command;
@@ -0,0 +1,185 @@
1
+ import React from 'react';
2
+ import { BulmaClassesProps, validColors } from '../helpers/useBulmaClasses.js';
3
+ declare const validDescriptionListOrientations: readonly ["vertical", "horizontal"];
4
+ /** Whether each label sits above its value (`vertical`) or beside it (`horizontal`). */
5
+ export type DescriptionListOrientation = (typeof validDescriptionListOrientations)[number];
6
+ /**
7
+ * Props for the DescriptionList component. The helper props, the other
8
+ * attributes and the `ref` land on the `<dl>`.
9
+ *
10
+ * @extraProp {React.Ref<HTMLDListElement>} [ref] - Ref forwarded to the `<dl>`.
11
+ * @extraProp {string} [aria-labelledby] - The id of the heading above the list, which names it.
12
+ */
13
+ export interface DescriptionListProps extends Omit<React.HTMLAttributes<HTMLDListElement>, 'color'>, Omit<BulmaClassesProps, 'color' | 'backgroundColor'> {
14
+ /** Additional CSS classes to apply. */
15
+ className?: string;
16
+ /** `DescriptionList.Item`s, one for each fact. */
17
+ children?: React.ReactNode;
18
+ /**
19
+ * Whether each label sits above its value or beside it, at every width no
20
+ * `orientation<Viewport>` prop covers. Those props read the way a
21
+ * `Column`'s `size<Viewport>` props do: `orientationMobile` applies below
22
+ * Bulma's tablet breakpoint, each of the others from its own breakpoint
23
+ * up, and where several apply the widest one wins. With none of them,
24
+ * labels sit above their values below the tablet breakpoint and beside
25
+ * them from it up. Beside, the labels share one column as wide as the
26
+ * longest label, up to `--bulma-description-list-label-max-width`, so the
27
+ * values line up.
28
+ */
29
+ orientation?: DescriptionListOrientation;
30
+ /**
31
+ * The orientation below Bulma's tablet breakpoint (769px). Falls back to
32
+ * `orientation`, then to `vertical`.
33
+ */
34
+ orientationMobile?: DescriptionListOrientation;
35
+ /**
36
+ * The orientation from Bulma's tablet breakpoint (769px) up, until a wider
37
+ * viewport's prop takes over. Falls back to `orientation`, then to
38
+ * `horizontal`.
39
+ */
40
+ orientationTablet?: DescriptionListOrientation;
41
+ /**
42
+ * The orientation from Bulma's desktop breakpoint (1024px) up, until a
43
+ * wider viewport's prop takes over. Falls back to `orientationTablet`, and
44
+ * on down.
45
+ */
46
+ orientationDesktop?: DescriptionListOrientation;
47
+ /**
48
+ * The orientation from Bulma's widescreen breakpoint (1216px) up, until
49
+ * `orientationFullhd` takes over. Falls back to `orientationDesktop`, and
50
+ * on down.
51
+ */
52
+ orientationWidescreen?: DescriptionListOrientation;
53
+ /**
54
+ * The orientation from Bulma's fullhd breakpoint (1408px) up. Falls back to
55
+ * `orientationWidescreen`, and on down.
56
+ */
57
+ orientationFullhd?: DescriptionListOrientation;
58
+ /**
59
+ * Draws a line between items, which helps the eye from a label to its
60
+ * value across a wide list, and shows where each item ends to someone
61
+ * zoomed in.
62
+ */
63
+ hasDividers?: boolean;
64
+ /** Text color helper. It colors the values; the labels keep their own color. */
65
+ textColor?: (typeof validColors)[number] | 'inherit' | 'current';
66
+ /** Background color helper. */
67
+ bgColor?: (typeof validColors)[number] | 'inherit' | 'current';
68
+ }
69
+ /**
70
+ * Props for DescriptionList.Item, one fact. The helper props, the other
71
+ * attributes and the `ref` land on its `<div>`.
72
+ *
73
+ * @extraProp {React.Ref<HTMLDivElement>} [ref] - Ref forwarded to the `<div>`.
74
+ */
75
+ export interface DescriptionListItemProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'color'>, Omit<BulmaClassesProps, 'color' | 'backgroundColor'> {
76
+ /** Additional CSS classes to apply. */
77
+ className?: string;
78
+ /**
79
+ * The label, such as "Order", as a `DescriptionList.Label` before the
80
+ * children.
81
+ */
82
+ label?: React.ReactNode;
83
+ /**
84
+ * The value, such as "#1234", as a `DescriptionList.Value` after the
85
+ * children. Text, a link, a `Tag`: anything that renders. `undefined`,
86
+ * `null` and `''` render nothing, so when a value is missing, say so in
87
+ * words, such as "Not given", rather than leave a label with nothing after
88
+ * it.
89
+ */
90
+ value?: React.ReactNode;
91
+ /**
92
+ * `DescriptionList.Label`s and `DescriptionList.Value`s, for what `label`
93
+ * and `value` don't cover, such as a label with an info tip or several
94
+ * values. They render between the two, so a `Label` here reads before
95
+ * `value`, and a `Value` here after `label`.
96
+ */
97
+ children?: React.ReactNode;
98
+ /** Text color helper. */
99
+ textColor?: (typeof validColors)[number] | 'inherit' | 'current';
100
+ /** Background color helper. */
101
+ bgColor?: (typeof validColors)[number] | 'inherit' | 'current';
102
+ }
103
+ /**
104
+ * Props for DescriptionList.Label. The helper props, the other attributes and
105
+ * the `ref` land on its `<dt>`.
106
+ *
107
+ * @extraProp {React.Ref<HTMLElement>} [ref] - Ref forwarded to the `<dt>`.
108
+ */
109
+ export interface DescriptionListLabelProps extends Omit<React.HTMLAttributes<HTMLElement>, 'color'>, Omit<BulmaClassesProps, 'color' | 'backgroundColor'> {
110
+ /** Additional CSS classes to apply. */
111
+ className?: string;
112
+ /**
113
+ * The label. A button may sit in it, such as one that opens a `Popover`
114
+ * about the label, but not a heading, which HTML doesn't allow here.
115
+ */
116
+ children?: React.ReactNode;
117
+ /** Text color helper. */
118
+ textColor?: (typeof validColors)[number] | 'inherit' | 'current';
119
+ /** Background color helper. */
120
+ bgColor?: (typeof validColors)[number] | 'inherit' | 'current';
121
+ }
122
+ /**
123
+ * Props for DescriptionList.Value. The helper props, the other attributes and
124
+ * the `ref` land on its `<dd>`.
125
+ *
126
+ * @extraProp {React.Ref<HTMLElement>} [ref] - Ref forwarded to the `<dd>`.
127
+ */
128
+ export interface DescriptionListValueProps extends Omit<React.HTMLAttributes<HTMLElement>, 'color'>, Omit<BulmaClassesProps, 'color' | 'backgroundColor'> {
129
+ /** Additional CSS classes to apply. */
130
+ className?: string;
131
+ /** The value. Anything goes, a list or a paragraph included. */
132
+ children?: React.ReactNode;
133
+ /** Text color helper. */
134
+ textColor?: (typeof validColors)[number] | 'inherit' | 'current';
135
+ /** Background color helper. */
136
+ bgColor?: (typeof validColors)[number] | 'inherit' | 'current';
137
+ }
138
+ /**
139
+ * A label, the name of a fact: a `<dt>`, in the weaker text color.
140
+ *
141
+ * @function
142
+ * @param {DescriptionListLabelProps} props - Props for DescriptionList.Label.
143
+ * @param {React.Ref<HTMLElement>} ref - Forwarded ref to the `<dt>`.
144
+ * @returns {JSX.Element} The rendered label.
145
+ *
146
+ * @example
147
+ * <DescriptionList.Label>Placed on</DescriptionList.Label>
148
+ */
149
+ export declare const DescriptionListLabel: React.ForwardRefExoticComponent<DescriptionListLabelProps & React.RefAttributes<HTMLElement>>;
150
+ /**
151
+ * A value, what the label says about the thing: a `<dd>`. An item may have several.
152
+ *
153
+ * @function
154
+ * @param {DescriptionListValueProps} props - Props for DescriptionList.Value.
155
+ * @param {React.Ref<HTMLElement>} ref - Forwarded ref to the `<dd>`.
156
+ * @returns {JSX.Element} The rendered value.
157
+ *
158
+ * @example
159
+ * <DescriptionList.Value>14 October 2026</DescriptionList.Value>
160
+ */
161
+ export declare const DescriptionListValue: React.ForwardRefExoticComponent<DescriptionListValueProps & React.RefAttributes<HTMLElement>>;
162
+ /**
163
+ * One fact: its label and its value, in a `<div>`, from the `label` and `value` props or from `Label` and `Value` children.
164
+ *
165
+ * @function
166
+ * @param {DescriptionListItemProps} props - Props for DescriptionList.Item.
167
+ * @param {React.Ref<HTMLDivElement>} ref - Forwarded ref to the `<div>`.
168
+ * @returns {JSX.Element} The rendered item.
169
+ *
170
+ * @example
171
+ * <DescriptionList.Item label="Order" value="#1234" />
172
+ *
173
+ * @example
174
+ * <DescriptionList.Item label="Tags">
175
+ * <DescriptionList.Value>Gift</DescriptionList.Value>
176
+ * <DescriptionList.Value>Priority</DescriptionList.Value>
177
+ * </DescriptionList.Item>
178
+ */
179
+ export declare const DescriptionListItem: React.ForwardRefExoticComponent<DescriptionListItemProps & React.RefAttributes<HTMLDivElement>>;
180
+ export declare const DescriptionList: React.ForwardRefExoticComponent<DescriptionListProps & React.RefAttributes<HTMLDListElement>> & {
181
+ Item: React.ForwardRefExoticComponent<DescriptionListItemProps & React.RefAttributes<HTMLDivElement>>;
182
+ Label: React.ForwardRefExoticComponent<DescriptionListLabelProps & React.RefAttributes<HTMLElement>>;
183
+ Value: React.ForwardRefExoticComponent<DescriptionListValueProps & React.RefAttributes<HTMLElement>>;
184
+ };
185
+ export default DescriptionList;
@@ -0,0 +1,94 @@
1
+ import React from 'react';
2
+ import { BulmaClassesProps, validColors } from '../helpers/useBulmaClasses.js';
3
+ declare const checkboxCardColors: readonly ["primary", "link", "info", "success", "warning", "danger"];
4
+ /**
5
+ * Props for the CheckboxCard component.
6
+ *
7
+ * @helperProps Helper props go on the outer `<label>`, the `.card`, with
8
+ * `className`. The other attributes go on the `<input>`.
9
+ * @extraProp {string} [name] - The form field name. Inside `Checkboxes`, the group's `name` when this is unset.
10
+ * @extraProp {string} [value] - What a form sends for the card when it's checked. Inside a `Checkboxes` group that takes `value`, `defaultValue` or `onChange`, the card is checked while the group's value holds it.
11
+ */
12
+ export interface CheckboxCardProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, 'size' | 'type' | 'color' | 'title'>, Omit<BulmaClassesProps, 'color' | 'backgroundColor' | 'size'> {
13
+ /**
14
+ * What the option is, such as "Daily backups". It names the checkbox, so
15
+ * a screen reader says it with the state. Without it, the card's whole
16
+ * text names the checkbox, as a label's text does.
17
+ */
18
+ title?: React.ReactNode;
19
+ /**
20
+ * A line or two about the option, read after the name and the state. It's
21
+ * the checkbox's description when `title`, `aria-label` or
22
+ * `aria-labelledby` names it. Without one of those it's part of the name
23
+ * already, so it isn't read twice.
24
+ */
25
+ description?: React.ReactNode;
26
+ /**
27
+ * Anything else in the card, after the description, such as a price. A
28
+ * label holds phrasing content only, so spans, images and links: a link
29
+ * works and doesn't toggle the card, but a button or another input can't
30
+ * go inside a label at all. It isn't read when the checkbox takes focus,
31
+ * so put what a screen reader should hear in `title` and `description`.
32
+ */
33
+ children?: React.ReactNode;
34
+ /**
35
+ * Shows the checkbox at the start of the card. Without it, the card's
36
+ * edge alone shows the selection, and it's thicker when checked, so the
37
+ * selection never rests on color.
38
+ */
39
+ hasIndicator?: boolean;
40
+ /** The color of the checkbox and of a checked card's edge. */
41
+ color?: (typeof checkboxCardColors)[number];
42
+ /**
43
+ * Text color helper, on the card. The title and the children take it, and
44
+ * the description keeps its own color.
45
+ */
46
+ textColor?: (typeof validColors)[number] | 'inherit' | 'current';
47
+ /** Whether the card is disabled. A disabled card dims, takes no clicks, and leaves the Tab order. */
48
+ disabled?: boolean;
49
+ /**
50
+ * Shows the mixed state, as in a "Select all" card when some of what it
51
+ * covers is checked. It's a look and an announcement only: `checked` is
52
+ * still the value, and a click still toggles `checked`. Set to `true` or
53
+ * `false`, it's controlled: a browser clears the mixed state on a click,
54
+ * so the component sets it again from this prop after every click and
55
+ * every render. Unset isn't `false`. The component leaves the input's own
56
+ * `indeterminate` property alone, so a ref can set it, and going from set
57
+ * to unset clears it once and hands it back. It has no HTML attribute, so
58
+ * server-rendered markup can't carry it, and a mixed card renders unmixed
59
+ * until hydration.
60
+ */
61
+ indeterminate?: boolean;
62
+ /**
63
+ * Additional CSS classes, on the outer `<label>`, the card. That's the
64
+ * element that declares the `--bulma-checkbox-card-*` variables, and
65
+ * Bulma's `--bulma-card-*` ones, so a class is how to set one: `style` and
66
+ * the other input attributes go to the `<input>`. Name `.checkbox-card`
67
+ * beside your class in the selector, so it beats the card's own
68
+ * declaration whatever order the stylesheets load in. A `color` prop
69
+ * declares the active color again on `.checkbox-card.is-<color>`, which
70
+ * ties that selector, so leave `color` unset when a class sets it.
71
+ */
72
+ className?: string;
73
+ }
74
+ /**
75
+ * The `CheckboxCard` component is a checkbox drawn as a card, with a title and a description, that toggles wherever you click it.
76
+ *
77
+ * It's a `<label>` around a real checkbox, so it sends its `value` with a
78
+ * form and Space toggles it. The title names the checkbox and the
79
+ * description describes it. Alone it's one choice; inside `Checkboxes` it
80
+ * takes the group's name and selection, as `Checkbox` does.
81
+ *
82
+ * @function
83
+ * @param {CheckboxCardProps} props - Props for the CheckboxCard component.
84
+ * @param {React.Ref<HTMLInputElement>} ref - Forwarded ref to the `<input>`.
85
+ * @returns {JSX.Element} The rendered card.
86
+ *
87
+ * @example
88
+ * <Checkboxes label="Add-ons" name="extras" defaultValue={['backups']}>
89
+ * <CheckboxCard value="backups" title="Daily backups" description="Kept for 30 days." />
90
+ * <CheckboxCard value="domain" title="Custom domain" description="Bring your own." />
91
+ * </Checkboxes>
92
+ */
93
+ export declare const CheckboxCard: React.ForwardRefExoticComponent<CheckboxCardProps & React.RefAttributes<HTMLInputElement>>;
94
+ export default CheckboxCard;
@@ -30,6 +30,19 @@ export interface CheckboxesProps extends Omit<BulmaClassesProps, 'color'>, FormF
30
30
  onChange?: (values: string[]) => void;
31
31
  /** Checkbox elements to render in the group. */
32
32
  children?: React.ReactNode;
33
+ /**
34
+ * The element the group renders as. With `fieldset` it's a native
35
+ * `<fieldset>`. Where the group renders a `Field` of its own, that `Field`
36
+ * is the `<fieldset>` and the `label` is its `<legend>`, in the label
37
+ * column when `horizontal`, so the legend names the group with no ids to
38
+ * wire. Your other attributes then go on the `<fieldset>`, while
39
+ * `className` and the helper props stay on the box that lays out the
40
+ * checkboxes. Inside an outer `Field` there's no legend: the group element
41
+ * itself is the `<fieldset>`, named by that `Field`'s label as before.
42
+ * `div`, the default, renders the group as it always has.
43
+ * @defaultValue 'div'
44
+ */
45
+ as?: 'div' | 'fieldset';
33
46
  }
34
47
  export declare const Checkboxes: React.FC<CheckboxesProps> & {
35
48
  Checkbox: React.ForwardRefExoticComponent<import("./Checkbox.js").CheckboxProps & React.RefAttributes<HTMLInputElement>>;