@allxsmith/bestax-bulma 5.57.1 → 5.57.3

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 (63) hide show
  1. package/dist/bestax.css +1 -1
  2. package/dist/bestax.css.map +1 -1
  3. package/dist/esm/components/Toast.js +21 -7
  4. package/dist/esm/components/Toast.js.map +1 -1
  5. package/dist/esm/elements/Tr.js.map +1 -1
  6. package/dist/esm/form/Checkbox.js +21 -14
  7. package/dist/esm/form/Checkbox.js.map +1 -1
  8. package/dist/esm/form/CheckboxCard.js +17 -11
  9. package/dist/esm/form/CheckboxCard.js.map +1 -1
  10. package/dist/esm/form/Checkboxes.js +30 -3
  11. package/dist/esm/form/Checkboxes.js.map +1 -1
  12. package/dist/esm/form/FormContext.js +31 -1
  13. package/dist/esm/form/FormContext.js.map +1 -1
  14. package/dist/esm/form/Radio.js +13 -10
  15. package/dist/esm/form/Radio.js.map +1 -1
  16. package/dist/esm/form/RadioCard.js +10 -8
  17. package/dist/esm/form/RadioCard.js.map +1 -1
  18. package/dist/esm/form/Radios.js +15 -3
  19. package/dist/esm/form/Radios.js.map +1 -1
  20. package/dist/esm/form/Rate.js +2 -2
  21. package/dist/esm/form/Rate.js.map +1 -1
  22. package/dist/extras.css +1 -1
  23. package/dist/extras.css.map +1 -1
  24. package/dist/index.cjs +152 -52
  25. package/dist/index.cjs.map +1 -1
  26. package/dist/types/components/Toast.d.ts +14 -3
  27. package/dist/types/elements/Tr.d.ts +3 -3
  28. package/dist/types/form/CheckboxCard.d.ts +1 -1
  29. package/dist/types/form/Checkboxes.d.ts +7 -1
  30. package/dist/types/form/FormContext.d.ts +34 -1
  31. package/dist/types/form/RadioCard.d.ts +1 -1
  32. package/dist/types/form/Radios.d.ts +5 -1
  33. package/dist/types/form/Rate.d.ts +5 -1
  34. package/dist/types-cjs/components/Toast.d.ts +14 -3
  35. package/dist/types-cjs/elements/Tr.d.ts +3 -3
  36. package/dist/types-cjs/form/CheckboxCard.d.ts +1 -1
  37. package/dist/types-cjs/form/Checkboxes.d.ts +7 -1
  38. package/dist/types-cjs/form/FormContext.d.ts +34 -1
  39. package/dist/types-cjs/form/RadioCard.d.ts +1 -1
  40. package/dist/types-cjs/form/Radios.d.ts +5 -1
  41. package/dist/types-cjs/form/Rate.d.ts +5 -1
  42. package/dist/versions/bestax-no-dark-mode.css +1 -1
  43. package/dist/versions/bestax-no-dark-mode.css.map +1 -1
  44. package/dist/versions/bestax-no-helpers-prefixed.css +1 -1
  45. package/dist/versions/bestax-no-helpers-prefixed.css.map +1 -1
  46. package/dist/versions/bestax-no-helpers.css +1 -1
  47. package/dist/versions/bestax-no-helpers.css.map +1 -1
  48. package/dist/versions/bestax-prefixed.css +1 -1
  49. package/dist/versions/bestax-prefixed.css.map +1 -1
  50. package/package.json +1 -1
  51. package/src/scss/CLAUDE.md +4 -1
  52. package/src/scss/_selected-row.scss +43 -0
  53. package/src/scss/components/_index.scss +1 -0
  54. package/src/scss/components/_pagination.scss +25 -0
  55. package/src/scss/components/_toast.scss +2 -1
  56. package/src/scss/elements/_delete.scss +63 -0
  57. package/src/scss/elements/_index.scss +1 -0
  58. package/src/scss/form/_checkbox.scss +18 -42
  59. package/src/scss/form/_combobox.scss +11 -0
  60. package/src/scss/form/_dropzone.scss +0 -34
  61. package/src/scss/form/_radio.scss +28 -2
  62. package/src/scss/form/_switch.scss +9 -5
  63. package/src/scss/form/_taginput.scss +6 -2
@@ -50,9 +50,17 @@ export interface ToastProps extends Omit<React.HTMLAttributes<HTMLDivElement>, '
50
50
  onAction?: () => void;
51
51
  /** Callback when toast closes. */
52
52
  onClose?: () => void;
53
- /** CSS selector or DOM node to mount the toast into. */
53
+ /**
54
+ * CSS selector or DOM node to mount the toast into. Through `toast.show()`,
55
+ * a toast with one portals there in a box of its own, rather than joining
56
+ * `ToastContainer`'s stack for its position.
57
+ */
54
58
  container?: string | HTMLElement;
55
- /** Renders inline instead of using a portal. */
59
+ /**
60
+ * Renders inline instead of using a portal. Through `toast.show()`, a toast
61
+ * already renders inline in `ToastContainer`'s stack for its position, and
62
+ * `inline` keeps one with a `container` in that stack too.
63
+ */
56
64
  inline?: boolean;
57
65
  }
58
66
  /**
@@ -153,7 +161,10 @@ export declare const toast: {
153
161
  * Container component for rendering programmatic toasts.
154
162
  * Place once at your app root to enable the toast API. A toast shown with a
155
163
  * `position` appears there, and one shown without goes to the container's
156
- * `position`.
164
+ * `position`. The toasts at one position stack in one `.toast-container`,
165
+ * with a gap between them, in the order they were shown, growing away from
166
+ * the edge of the screen. A toast shown with a `container` of its own, and
167
+ * not `inline`, portals there instead, in a box of its own.
157
168
  *
158
169
  * @function
159
170
  * @param {{ position?: ToastPosition }} props - Container props.
@@ -13,9 +13,9 @@ export interface TrProps extends Omit<React.HTMLAttributes<HTMLTableRowElement>,
13
13
  /**
14
14
  * Whether the row is selected (adds Bulma's is-selected class). It's a look
15
15
  * only: it says nothing to assistive tech, so pair it with a checkbox named
16
- * for the row when the selection matters. A bestax `Checkbox` placed
17
- * straight in one of the row's cells takes the row's text color, so a
18
- * checked box shows on the row's fill. One in a menu or a table nested in a
16
+ * for the row when the selection matters. A bestax `Checkbox` or `Radio`
17
+ * placed straight in one of the row's cells takes the row's text color, so
18
+ * a checked one shows on the row's fill. One in a menu or a table nested in a
19
19
  * cell, or in a cell with a `color` of its own, keeps its own colors, since
20
20
  * it sits on that surface instead, and so does every one in a row with a
21
21
  * `color`, whose cells paint that color over the fill.
@@ -7,7 +7,7 @@ declare const checkboxCardColors: readonly ["primary", "link", "info", "success"
7
7
  * @helperProps Helper props go on the outer `<label>`, the `.card`, with
8
8
  * `className`. The other attributes go on the `<input>`.
9
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.
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. A group given only `onChange` starts from the cards' own `defaultChecked`.
11
11
  */
12
12
  export interface CheckboxCardProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, 'size' | 'type' | 'color' | 'title'>, Omit<BulmaClassesProps, 'color' | 'backgroundColor' | 'size'> {
13
13
  /**
@@ -26,7 +26,13 @@ export interface CheckboxesProps extends Omit<BulmaClassesProps, 'color'>, FormF
26
26
  value?: string[];
27
27
  /** Initial selected values (uncontrolled mode). */
28
28
  defaultValue?: string[];
29
- /** Fires when the selection changes; receives the new array. */
29
+ /**
30
+ * Fires when the selection changes; receives the new array. Passed without
31
+ * `value` or `defaultValue`, it still has the group manage the selection,
32
+ * starting from the checkboxes' own `defaultChecked`: a box that starts
33
+ * checked stays checked when another is clicked, and the first array holds
34
+ * it.
35
+ */
30
36
  onChange?: (values: string[]) => void;
31
37
  /** Checkbox elements to render in the group. */
32
38
  children?: React.ReactNode;
@@ -210,21 +210,54 @@ export declare const useFieldLabelTarget: (id: string | undefined, hasInput?: bo
210
210
  * (i.e., the user passed `value`, `defaultValue`, or `onChange` to `<Radios>`).
211
211
  * When only `name` is provided, the group is in "name-only" mode and child
212
212
  * Radios manage their own checked state independently.
213
+ *
214
+ * A group given only `onChange` manages the selection but holds no value
215
+ * until its first change. Until then a Radio with a value shows its own
216
+ * `defaultChecked`, still controlled, so that change doesn't flip it from
217
+ * uncontrolled to controlled.
213
218
  */
214
219
  export interface RadiosGroupContextValue {
215
220
  name?: string;
216
- value?: string;
221
+ /** `null` once a radio without a value was picked before the group held one, so no radio with a value shows checked. */
222
+ value?: string | null;
217
223
  onChange?: (value: string) => void;
224
+ /** Set with `onChange`. Tells the group a radio without a value, sharing its name, was picked. */
225
+ pickWithoutValue?: () => void;
218
226
  }
227
+ /**
228
+ * Tells a surrounding `<Radios>` that one of its radios was picked. A radio
229
+ * with a value hands the group that value. One without a value tells the
230
+ * group nothing it reports, but when it shares the group's name the browser
231
+ * has just unchecked the radio that showed checked, so the group learns the
232
+ * pick left its radios and React doesn't check that one again, undoing the
233
+ * pick. `Radio` and `RadioCard` call it with their effective name.
234
+ */
235
+ export declare const pickInRadiosGroup: (group: RadiosGroupContextValue | undefined, value: string | number | readonly string[] | undefined, name: string | undefined) => void;
219
236
  /**
220
237
  * Shape of the Checkboxes group context. Like Radios but with array semantics
221
238
  * for multi-select.
239
+ *
240
+ * While the group manages the selection it also sets `registerChecked` and
241
+ * `startingValue`. A group given only `onChange` holds no value until its
242
+ * first change, so its choices register the values they start checked with,
243
+ * and that change starts from them rather than from an empty array.
222
244
  */
223
245
  export interface CheckboxesGroupContextValue {
224
246
  name?: string;
225
247
  value?: string[];
226
248
  onChange?: (values: string[]) => void;
249
+ /** Registers a value a choice starts checked with, and returns the function that takes it back. */
250
+ registerChecked?: (value: string) => () => void;
251
+ /** The values registered as starting checked, each once, in the order they came. */
252
+ startingValue?: () => string[];
227
253
  }
254
+ /**
255
+ * Registers a choice with its surrounding `<Checkboxes>` while it starts
256
+ * checked, so a group with no value yet starts its first change from the
257
+ * choices that were checked. `Checkbox` and `CheckboxCard` call it. It does
258
+ * nothing outside a group that manages the selection, or without a value.
259
+ */
260
+ export declare const useRegisterChecked: (group: CheckboxesGroupContextValue | undefined, value: string | undefined, startsChecked: boolean) => void;
228
261
  /**
229
262
  * Hook to read the full surrounding `<Radios>` group context (name + selection).
230
263
  * Returns `undefined` when not inside a `<Radios>` group.
@@ -7,7 +7,7 @@ declare const radioCardColors: readonly ["primary", "link", "info", "success", "
7
7
  * @helperProps Helper props go on the outer `<label>`, the `.card`, with
8
8
  * `className`. The other attributes go on the `<input>`.
9
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.
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. A group given only `onChange` starts from the card with `defaultChecked`.
11
11
  */
12
12
  export interface RadioCardProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, 'size' | 'type' | 'color' | 'title'>, Omit<BulmaClassesProps, 'color' | 'backgroundColor' | 'size'> {
13
13
  /**
@@ -26,7 +26,11 @@ export interface RadiosProps extends Omit<BulmaClassesProps, 'color'>, FormField
26
26
  value?: string;
27
27
  /** Initial selected value (uncontrolled mode). */
28
28
  defaultValue?: string;
29
- /** Fires when the selection changes. */
29
+ /**
30
+ * Fires when the selection changes; receives the value picked. Passed
31
+ * without `value` or `defaultValue`, it still has the group manage the
32
+ * selection, starting from the radio with `defaultChecked`.
33
+ */
30
34
  onChange?: (value: string) => void;
31
35
  /** Radio elements to render in the group. */
32
36
  children: React.ReactNode;
@@ -51,7 +51,11 @@ export interface RateProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'o
51
51
  max?: number;
52
52
  /** Size variant. */
53
53
  size?: RateSize;
54
- /** Whether the rating is disabled. */
54
+ /**
55
+ * Whether the rating is disabled. A disabled Rate ignores clicks and keys,
56
+ * leaves the tab order, and sets `aria-disabled` on the group and on every
57
+ * star, so a screen reader announces them as unavailable.
58
+ */
55
59
  disabled?: boolean;
56
60
  /**
57
61
  * Show the numeric score next to stars, written the way the `locale` of a
@@ -50,9 +50,17 @@ export interface ToastProps extends Omit<React.HTMLAttributes<HTMLDivElement>, '
50
50
  onAction?: () => void;
51
51
  /** Callback when toast closes. */
52
52
  onClose?: () => void;
53
- /** CSS selector or DOM node to mount the toast into. */
53
+ /**
54
+ * CSS selector or DOM node to mount the toast into. Through `toast.show()`,
55
+ * a toast with one portals there in a box of its own, rather than joining
56
+ * `ToastContainer`'s stack for its position.
57
+ */
54
58
  container?: string | HTMLElement;
55
- /** Renders inline instead of using a portal. */
59
+ /**
60
+ * Renders inline instead of using a portal. Through `toast.show()`, a toast
61
+ * already renders inline in `ToastContainer`'s stack for its position, and
62
+ * `inline` keeps one with a `container` in that stack too.
63
+ */
56
64
  inline?: boolean;
57
65
  }
58
66
  /**
@@ -153,7 +161,10 @@ export declare const toast: {
153
161
  * Container component for rendering programmatic toasts.
154
162
  * Place once at your app root to enable the toast API. A toast shown with a
155
163
  * `position` appears there, and one shown without goes to the container's
156
- * `position`.
164
+ * `position`. The toasts at one position stack in one `.toast-container`,
165
+ * with a gap between them, in the order they were shown, growing away from
166
+ * the edge of the screen. A toast shown with a `container` of its own, and
167
+ * not `inline`, portals there instead, in a box of its own.
157
168
  *
158
169
  * @function
159
170
  * @param {{ position?: ToastPosition }} props - Container props.
@@ -13,9 +13,9 @@ export interface TrProps extends Omit<React.HTMLAttributes<HTMLTableRowElement>,
13
13
  /**
14
14
  * Whether the row is selected (adds Bulma's is-selected class). It's a look
15
15
  * only: it says nothing to assistive tech, so pair it with a checkbox named
16
- * for the row when the selection matters. A bestax `Checkbox` placed
17
- * straight in one of the row's cells takes the row's text color, so a
18
- * checked box shows on the row's fill. One in a menu or a table nested in a
16
+ * for the row when the selection matters. A bestax `Checkbox` or `Radio`
17
+ * placed straight in one of the row's cells takes the row's text color, so
18
+ * a checked one shows on the row's fill. One in a menu or a table nested in a
19
19
  * cell, or in a cell with a `color` of its own, keeps its own colors, since
20
20
  * it sits on that surface instead, and so does every one in a row with a
21
21
  * `color`, whose cells paint that color over the fill.
@@ -7,7 +7,7 @@ declare const checkboxCardColors: readonly ["primary", "link", "info", "success"
7
7
  * @helperProps Helper props go on the outer `<label>`, the `.card`, with
8
8
  * `className`. The other attributes go on the `<input>`.
9
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.
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. A group given only `onChange` starts from the cards' own `defaultChecked`.
11
11
  */
12
12
  export interface CheckboxCardProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, 'size' | 'type' | 'color' | 'title'>, Omit<BulmaClassesProps, 'color' | 'backgroundColor' | 'size'> {
13
13
  /**
@@ -26,7 +26,13 @@ export interface CheckboxesProps extends Omit<BulmaClassesProps, 'color'>, FormF
26
26
  value?: string[];
27
27
  /** Initial selected values (uncontrolled mode). */
28
28
  defaultValue?: string[];
29
- /** Fires when the selection changes; receives the new array. */
29
+ /**
30
+ * Fires when the selection changes; receives the new array. Passed without
31
+ * `value` or `defaultValue`, it still has the group manage the selection,
32
+ * starting from the checkboxes' own `defaultChecked`: a box that starts
33
+ * checked stays checked when another is clicked, and the first array holds
34
+ * it.
35
+ */
30
36
  onChange?: (values: string[]) => void;
31
37
  /** Checkbox elements to render in the group. */
32
38
  children?: React.ReactNode;
@@ -210,21 +210,54 @@ export declare const useFieldLabelTarget: (id: string | undefined, hasInput?: bo
210
210
  * (i.e., the user passed `value`, `defaultValue`, or `onChange` to `<Radios>`).
211
211
  * When only `name` is provided, the group is in "name-only" mode and child
212
212
  * Radios manage their own checked state independently.
213
+ *
214
+ * A group given only `onChange` manages the selection but holds no value
215
+ * until its first change. Until then a Radio with a value shows its own
216
+ * `defaultChecked`, still controlled, so that change doesn't flip it from
217
+ * uncontrolled to controlled.
213
218
  */
214
219
  export interface RadiosGroupContextValue {
215
220
  name?: string;
216
- value?: string;
221
+ /** `null` once a radio without a value was picked before the group held one, so no radio with a value shows checked. */
222
+ value?: string | null;
217
223
  onChange?: (value: string) => void;
224
+ /** Set with `onChange`. Tells the group a radio without a value, sharing its name, was picked. */
225
+ pickWithoutValue?: () => void;
218
226
  }
227
+ /**
228
+ * Tells a surrounding `<Radios>` that one of its radios was picked. A radio
229
+ * with a value hands the group that value. One without a value tells the
230
+ * group nothing it reports, but when it shares the group's name the browser
231
+ * has just unchecked the radio that showed checked, so the group learns the
232
+ * pick left its radios and React doesn't check that one again, undoing the
233
+ * pick. `Radio` and `RadioCard` call it with their effective name.
234
+ */
235
+ export declare const pickInRadiosGroup: (group: RadiosGroupContextValue | undefined, value: string | number | readonly string[] | undefined, name: string | undefined) => void;
219
236
  /**
220
237
  * Shape of the Checkboxes group context. Like Radios but with array semantics
221
238
  * for multi-select.
239
+ *
240
+ * While the group manages the selection it also sets `registerChecked` and
241
+ * `startingValue`. A group given only `onChange` holds no value until its
242
+ * first change, so its choices register the values they start checked with,
243
+ * and that change starts from them rather than from an empty array.
222
244
  */
223
245
  export interface CheckboxesGroupContextValue {
224
246
  name?: string;
225
247
  value?: string[];
226
248
  onChange?: (values: string[]) => void;
249
+ /** Registers a value a choice starts checked with, and returns the function that takes it back. */
250
+ registerChecked?: (value: string) => () => void;
251
+ /** The values registered as starting checked, each once, in the order they came. */
252
+ startingValue?: () => string[];
227
253
  }
254
+ /**
255
+ * Registers a choice with its surrounding `<Checkboxes>` while it starts
256
+ * checked, so a group with no value yet starts its first change from the
257
+ * choices that were checked. `Checkbox` and `CheckboxCard` call it. It does
258
+ * nothing outside a group that manages the selection, or without a value.
259
+ */
260
+ export declare const useRegisterChecked: (group: CheckboxesGroupContextValue | undefined, value: string | undefined, startsChecked: boolean) => void;
228
261
  /**
229
262
  * Hook to read the full surrounding `<Radios>` group context (name + selection).
230
263
  * Returns `undefined` when not inside a `<Radios>` group.
@@ -7,7 +7,7 @@ declare const radioCardColors: readonly ["primary", "link", "info", "success", "
7
7
  * @helperProps Helper props go on the outer `<label>`, the `.card`, with
8
8
  * `className`. The other attributes go on the `<input>`.
9
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.
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. A group given only `onChange` starts from the card with `defaultChecked`.
11
11
  */
12
12
  export interface RadioCardProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, 'size' | 'type' | 'color' | 'title'>, Omit<BulmaClassesProps, 'color' | 'backgroundColor' | 'size'> {
13
13
  /**
@@ -26,7 +26,11 @@ export interface RadiosProps extends Omit<BulmaClassesProps, 'color'>, FormField
26
26
  value?: string;
27
27
  /** Initial selected value (uncontrolled mode). */
28
28
  defaultValue?: string;
29
- /** Fires when the selection changes. */
29
+ /**
30
+ * Fires when the selection changes; receives the value picked. Passed
31
+ * without `value` or `defaultValue`, it still has the group manage the
32
+ * selection, starting from the radio with `defaultChecked`.
33
+ */
30
34
  onChange?: (value: string) => void;
31
35
  /** Radio elements to render in the group. */
32
36
  children: React.ReactNode;
@@ -51,7 +51,11 @@ export interface RateProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'o
51
51
  max?: number;
52
52
  /** Size variant. */
53
53
  size?: RateSize;
54
- /** Whether the rating is disabled. */
54
+ /**
55
+ * Whether the rating is disabled. A disabled Rate ignores clicks and keys,
56
+ * leaves the tab order, and sets `aria-disabled` on the group and on every
57
+ * star, so a screen reader announces them as unavailable.
58
+ */
55
59
  disabled?: boolean;
56
60
  /**
57
61
  * Show the numeric score next to stars, written the way the `locale` of a