@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
@@ -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>>;
@@ -0,0 +1,81 @@
1
+ import React from 'react';
2
+ import { BulmaClassesProps, validColors } from '../helpers/useBulmaClasses.js';
3
+ declare const radioCardColors: readonly ["primary", "link", "info", "success", "warning", "danger"];
4
+ /**
5
+ * Props for the RadioCard 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, which the cards of one choice share, so the arrow keys move between them. Inside `Radios`, the group's `name` when this is unset.
10
+ * @extraProp {string} [value] - What a form sends when this card is the one picked. Inside a `Radios` group that takes `value`, `defaultValue` or `onChange`, the card is checked while the group's value is this.
11
+ */
12
+ export interface RadioCardProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, 'size' | 'type' | 'color' | 'title'>, Omit<BulmaClassesProps, 'color' | 'backgroundColor' | 'size'> {
13
+ /**
14
+ * What the option is, such as "Express". It names the radio, so a screen
15
+ * reader says it with the state and its place in the group. Without it,
16
+ * the card's whole text names the radio, 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 radio's description when `title`, `aria-label` or `aria-labelledby`
22
+ * names it. Without one of those it's part of the name already, so it
23
+ * 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 pick the card, but a button or another input can't go
30
+ * inside a label at all. It isn't read when the radio takes focus, so put
31
+ * what a screen reader should hear in `title` and `description`.
32
+ */
33
+ children?: React.ReactNode;
34
+ /**
35
+ * Shows the radio at the start of the card. Without it, the card's edge
36
+ * alone shows the selection, and it's thicker when picked, so the
37
+ * selection never rests on color.
38
+ */
39
+ hasIndicator?: boolean;
40
+ /** The color of the radio and of a picked card's edge. */
41
+ color?: (typeof radioCardColors)[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 the arrow keys skip it. */
48
+ disabled?: boolean;
49
+ /**
50
+ * Additional CSS classes, on the outer `<label>`, the card. That's the
51
+ * element that declares the `--bulma-radio-card-*` variables, and Bulma's
52
+ * `--bulma-card-*` ones, so a class is how to set one: `style` and the
53
+ * other input attributes go to the `<input>`. Name `.radio-card` beside
54
+ * your class in the selector, so it beats the card's own declaration
55
+ * whatever order the stylesheets load in. A `color` prop declares the
56
+ * active color again on `.radio-card.is-<color>`, which ties that
57
+ * selector, so leave `color` unset when a class sets it.
58
+ */
59
+ className?: string;
60
+ }
61
+ /**
62
+ * The `RadioCard` component is a radio button drawn as a card, with a title and a description, picked wherever you click it.
63
+ *
64
+ * It's a `<label>` around a real radio, so it sends its `value` with a form,
65
+ * and the cards that share a `name` are one choice the arrow keys move
66
+ * through. The title names the radio and the description describes it.
67
+ * Inside `Radios` it takes the group's name and selection, as `Radio` does.
68
+ *
69
+ * @function
70
+ * @param {RadioCardProps} props - Props for the RadioCard component.
71
+ * @param {React.Ref<HTMLInputElement>} ref - Forwarded ref to the `<input>`.
72
+ * @returns {JSX.Element} The rendered card.
73
+ *
74
+ * @example
75
+ * <Radios label="Shipping" name="shipping" defaultValue="standard">
76
+ * <RadioCard value="standard" title="Standard" description="Arrives in 4 to 6 days." />
77
+ * <RadioCard value="express" title="Express" description="Arrives tomorrow." />
78
+ * </Radios>
79
+ */
80
+ export declare const RadioCard: React.ForwardRefExoticComponent<RadioCardProps & React.RefAttributes<HTMLInputElement>>;
81
+ export default RadioCard;
@@ -30,6 +30,19 @@ export interface RadiosProps extends Omit<BulmaClassesProps, 'color'>, FormField
30
30
  onChange?: (value: string) => void;
31
31
  /** Radio 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>` that keeps `role="radiogroup"`. Where the group renders a
36
+ * `Field` of its own, that `Field` is the `<fieldset>` and the `label` is
37
+ * its `<legend>`, in the label column when `horizontal`, so the legend names
38
+ * the group with no ids to wire. Your other attributes then go on the
39
+ * `<fieldset>`, while `className` and the helper props stay on the box that
40
+ * lays out the radios. Inside an outer `Field` there's no legend: the group
41
+ * element itself is the `<fieldset>`, named by that `Field`'s label as
42
+ * before. `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 Radios: React.FC<RadiosProps> & {
35
48
  Radio: React.ForwardRefExoticComponent<import("./Radio.js").RadioProps & React.RefAttributes<HTMLInputElement>>;
@@ -0,0 +1,32 @@
1
+ import React from 'react';
2
+ import type { FormFieldProps } from './fieldProps.js';
3
+ interface GroupFieldsetProps {
4
+ /** The group's label, rendered as the `<legend>`. */
5
+ label: React.ReactNode;
6
+ /** Sizes the legend's label column when `horizontal`. */
7
+ labelSize?: FormFieldProps['labelSize'];
8
+ /** Props for the element that shows the label; any `htmlFor` is dropped. */
9
+ labelProps?: FormFieldProps['labelProps'];
10
+ /** Puts the legend in the label column and the rest in the body. */
11
+ horizontal?: boolean;
12
+ /** Set on the `<fieldset>` beside its `field` class. */
13
+ fieldClassName?: string;
14
+ /** The group's role, when it isn't the fieldset's own `group`. */
15
+ role?: 'radiogroup';
16
+ /** The group's own attributes: they describe the group, so they go on the `<fieldset>`. */
17
+ attributes: object;
18
+ /** The group's help text, after the content. */
19
+ message: React.ReactNode;
20
+ /** The group's content: its `Control` and the box of choices. */
21
+ children: React.ReactNode;
22
+ }
23
+ /**
24
+ * The `Field` a `Checkboxes` or `Radios` with `as="fieldset"` renders of its
25
+ * own, as a native `<fieldset>`: Bulma's field markup, with its label as the
26
+ * `<legend>` (inside the `field-label` column when horizontal), so the legend
27
+ * names the group and needs no id. It holds a `Field`'s place for what is
28
+ * inside, so the choices read as inside a `Field`. Internal; not part of the
29
+ * public API.
30
+ */
31
+ export declare const GroupFieldset: React.FC<GroupFieldsetProps>;
32
+ export {};
@@ -31,6 +31,7 @@ export * from './components/Carousel.js';
31
31
  export * from './components/Reveal.js';
32
32
  export * from './components/TreeView.js';
33
33
  export * from './components/ScrollArea.js';
34
+ export * from './components/Command.js';
34
35
  export * from './elements/Block.js';
35
36
  export * from './elements/Box.js';
36
37
  export * from './elements/Button.js';
@@ -40,6 +41,7 @@ export * from './elements/ToggleButton.js';
40
41
  export * from './elements/Code.js';
41
42
  export * from './elements/Content.js';
42
43
  export * from './elements/Delete.js';
44
+ export * from './elements/DescriptionList.js';
43
45
  export * from './elements/Divider.js';
44
46
  export * from './elements/Emphasis.js';
45
47
  export * from './elements/Figure.js';
@@ -72,11 +74,13 @@ export * from './elements/Title.js';
72
74
  export * from './elements/Tr.js';
73
75
  export * from './elements/UnorderedList.js';
74
76
  export * from './form/Checkbox.js';
77
+ export * from './form/CheckboxCard.js';
75
78
  export * from './form/Checkboxes.js';
76
79
  export * from './form/Control.js';
77
80
  export * from './form/Field.js';
78
81
  export * from './form/File.js';
79
82
  export * from './form/Radio.js';
83
+ export * from './form/RadioCard.js';
80
84
  export * from './form/Radios.js';
81
85
  export * from './form/Switch.js';
82
86
  export * from './form/Slider.js';