@allxsmith/bestax-bulma 5.27.3 → 5.27.4

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.
@@ -12,11 +12,11 @@ export interface FieldProps extends React.HTMLAttributes<HTMLDivElement>, Omit<B
12
12
  hasAddons?: boolean | 'centered' | 'right';
13
13
  /** Constrains the field to its content's width (used inside horizontal field bodies). */
14
14
  narrow?: boolean;
15
- /** Field label, rendered above the widget. Automatically names the one control the Field holds: a composed `InputBase`, `SelectBase` or `TextAreaBase`, or a bestax input that renders a single input of its own (`Input`, `Select`, `TextArea`, `Numberinput`, `Slider`, `DateInput`, `TimeInput`, `DateTimeInput`, `Autocomplete`, `Taginput`, `File`), adopts a generated id that the label's `htmlFor` points at, and a group (`Radios`, `Checkboxes`, `Rate`, `DateRangeInput`) points `aria-labelledby` at the label's own id unless you gave the group an `aria-label` or `aria-labelledby`. Nothing else takes the label: `Checkbox`, `Radio` and `Switch` are named by their own children. Only the single inputs take the `htmlFor`, so with a group or any other content it matches nothing. Pass `labelProps={{ htmlFor }}` to wire your own `id`, or `labelProps={{ htmlFor: undefined }}` to opt out. Skipped for `grouped`/`hasAddons` fields (multiple controls), and a nested `Field` starts its own scope, so a horizontal Field whose body holds an inner `Field` names the control there only when you wire it. Two controls in one plain labeled Field would both adopt the id, so give each an `id` of its own. */
15
+ /** Field label, rendered above the widget. Automatically names the one control the Field holds: a composed `InputBase`, `SelectBase` or `TextAreaBase`, or a bestax input that renders a single input of its own (`Input`, `Select`, `TextArea`, `Numberinput`, `Slider`, `DateInput`, `TimeInput`, `DateTimeInput`, `Autocomplete`, `Taginput`, `File`), adopts a generated id that the label's `htmlFor` points at, and a group (`Radios`, `Checkboxes`, `Rate`, `DateRangeInput`) points `aria-labelledby` at the label's own id unless you gave the group an `aria-label` or `aria-labelledby`. A range `Slider` takes the id on its low thumb and also starts each thumb's name with the label through `aria-labelledby`, unless its `ariaLabel` names that thumb or its own `aria-label` or `aria-labelledby` takes the label's place. Nothing else takes the label: `Checkbox`, `Radio` and `Switch` are named by their own children. Only the single inputs take the `htmlFor`, so with a group or any other content it matches nothing. Pass `labelProps={{ htmlFor }}` to wire your own `id`, or `labelProps={{ htmlFor: undefined }}` to opt out. Skipped for `grouped`/`hasAddons` fields (multiple controls), and a nested `Field` starts its own scope, so a horizontal Field whose body holds an inner `Field` names the control there only when you wire it. Two controls in one plain labeled Field would both adopt the id, so give each an `id` of its own. */
16
16
  label?: React.ReactNode;
17
17
  /** Size for the label. */
18
18
  labelSize?: 'small' | 'normal' | 'medium' | 'large';
19
- /** Props for the label element. An explicit `htmlFor` key — even set to `undefined` — takes over the association. An `id` here is the one a group control's `aria-labelledby` points at; otherwise the label gets a generated one while the association is on. To point a group in an inner `Field` at this label by hand, pass that `id` with `htmlFor: undefined`, or the label keeps a generated `htmlFor` that nothing takes. */
19
+ /** Props for the label element. An explicit `htmlFor` key — even set to `undefined` — takes over the association. An `id` here is the one a group control's, or a range `Slider`'s, `aria-labelledby` points at; otherwise the label gets a generated one while the association is on. To point a group in an inner `Field` at this label by hand, pass that `id` with `htmlFor: undefined`, or the label keeps a generated `htmlFor` that nothing takes. */
20
20
  labelProps?: React.LabelHTMLAttributes<HTMLLabelElement> & {
21
21
  [key: string]: unknown;
22
22
  };
@@ -115,8 +115,10 @@ export declare const FieldLabelIdProvider: React.Provider<string | undefined>;
115
115
  /**
116
116
  * The id of a labeled Field's own `<label>`, for a group control (Radios,
117
117
  * Checkboxes, Rate, DateRangeInput) to point `aria-labelledby` at, since a group cannot take
118
- * the label's `htmlFor` (#939). Set under the same conditions as
119
- * {@link useFieldLabelId}. Consumed through `useAutoLabelledBy`.
118
+ * the label's `htmlFor` (#939), and for a range Slider's thumbs, which each
119
+ * need the label in a name of their own (#981). Set under the same conditions
120
+ * as {@link useFieldLabelId}. Consumed through `useAutoLabelledBy` and
121
+ * `useAutoLabelId`.
120
122
  * Internal; not part of the public API.
121
123
  */
122
124
  export declare const useFieldLabelElementId: () => string | undefined;
@@ -22,9 +22,9 @@ export interface SliderMark {
22
22
  * Shared base props for single and range Slider modes.
23
23
  */
24
24
  interface SliderBaseProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, 'color' | 'size' | 'onChange' | 'value' | 'defaultValue'>, Omit<BulmaClassesProps, 'color' | 'backgroundColor' | 'size'>, FormFieldProps {
25
- /** Field label. Automatically associated with the slider input via `htmlFor` — uses your `id` when provided, otherwise a generated one. In range mode the label targets the low (minimum) thumb. Dropped inside an outer `Field`, whose own label associates instead when that `Field` generates a target id (not `grouped`/`hasAddons`, no explicit `labelProps.htmlFor`). */
25
+ /** Field label. Automatically associated with the slider input via `htmlFor` — uses your `id` when provided, otherwise a generated one. In range mode the `htmlFor` targets the low (minimum) thumb, and the label also starts each thumb's name through `aria-labelledby`, as in "Price Minimum value" and "Price Maximum value", unless an `aria-label` or `aria-labelledby` on the Slider takes its place there. Dropped inside an outer `Field`, whose own label associates instead when that `Field` generates a target id (not `grouped`/`hasAddons`, no explicit `labelProps.htmlFor`), naming a range Slider's thumbs the same way. */
26
26
  label?: React.ReactNode;
27
- /** Props for the label element. An explicit `htmlFor` here overrides the automatic association (no id is generated then). */
27
+ /** Props for the label element. An explicit `htmlFor` here overrides the automatic association (no id is generated then). In range mode an `id` here is the one the thumbs' `aria-labelledby` points at, in place of a generated one. */
28
28
  labelProps?: React.LabelHTMLAttributes<HTMLLabelElement> & {
29
29
  [key: string]: unknown;
30
30
  };
@@ -82,7 +82,7 @@ export interface SliderSingleProps extends SliderBaseProps {
82
82
  * @defaultValue 0
83
83
  */
84
84
  minDistance?: never;
85
- /** ARIA label(s) for the slider thumb(s). */
85
+ /** ARIA label(s) for the slider thumb(s), which win over a label, the Slider's own or a surrounding `Field`'s. In range mode each entry is that thumb's whole name, and a thumb without one is named "Minimum value" or "Maximum value", after whatever names the Slider: a label, or in its place an `aria-label` or `aria-labelledby` given to the Slider, as in "Budget Minimum value" and "Budget Maximum value". An `aria-labelledby` set to `undefined` keeps every label out of both names. */
86
86
  ariaLabel?: string;
87
87
  }
88
88
  /**
@@ -108,7 +108,7 @@ export interface SliderRangeProps extends SliderBaseProps {
108
108
  * @defaultValue 0
109
109
  */
110
110
  minDistance?: number;
111
- /** ARIA label(s) for the slider thumb(s). */
111
+ /** ARIA label(s) for the slider thumb(s), which win over a label, the Slider's own or a surrounding `Field`'s. In range mode each entry is that thumb's whole name, and a thumb without one is named "Minimum value" or "Maximum value", after whatever names the Slider: a label, or in its place an `aria-label` or `aria-labelledby` given to the Slider, as in "Budget Minimum value" and "Budget Maximum value". An `aria-labelledby` set to `undefined` keeps every label out of both names. */
112
112
  ariaLabel?: [string, string];
113
113
  /** Form field name for the low thumb. Use this in range mode so each thumb submits with its own name. */
114
114
  nameLow?: string;
@@ -18,6 +18,13 @@ interface UseAutoLabelIdOptions {
18
18
  * so it takes no id from a surrounding Field either. Defaults to true.
19
19
  */
20
20
  hasInput?: boolean;
21
+ /**
22
+ * True when the control also points `aria-labelledby` at the label, as a
23
+ * range Slider's thumbs do (#981), so it needs the label's own id. Its own
24
+ * label then gets one (`labelProps.id` when given, otherwise a generated
25
+ * one), and the hook returns it, or a surrounding Field's, as `labelId`.
26
+ */
27
+ needsLabelId?: boolean;
21
28
  }
22
29
  /**
23
30
  * Associates the convenience `label` prop with its control (#368): generates
@@ -27,14 +34,21 @@ interface UseAutoLabelIdOptions {
27
34
  * generation entirely: the user has taken over the association (#495 presence
28
35
  * semantics). When the control renders no label of its own, it adopts the id
29
36
  * a labeled Field around it offers, the way the bases do, so that Field's
30
- * label names it (#939); a user `id` still wins there.
37
+ * label names it (#939); a user `id` still wins there. With `needsLabelId`
38
+ * it also returns the id of whichever label names the control (#981).
31
39
  * Internal; not part of the public API.
32
40
  */
33
- export declare function useAutoLabelId({ label, id, labelProps, rendersLabel, hasInput, }: UseAutoLabelIdOptions): {
41
+ export declare function useAutoLabelId({ label, id, labelProps, rendersLabel, hasInput, needsLabelId, }: UseAutoLabelIdOptions): {
34
42
  controlId: string | undefined;
35
43
  fieldLabelProps: FieldProps['labelProps'] | undefined;
36
44
  /** Whether a rendered label, its own or a surrounding Field's, points at `controlId`. */
37
45
  labelled: boolean;
46
+ /**
47
+ * With `needsLabelId`, the id of the label that names `controlId`, its own
48
+ * or a surrounding Field's. Undefined when no label names it, or when the
49
+ * Field's label was wired by hand, since that Field hands out no label id.
50
+ */
51
+ labelId: string | undefined;
38
52
  };
39
53
  interface UseAutoLabelledByOptions {
40
54
  /** The convenience `label` prop as passed by the caller. */
@@ -12,11 +12,11 @@ export interface FieldProps extends React.HTMLAttributes<HTMLDivElement>, Omit<B
12
12
  hasAddons?: boolean | 'centered' | 'right';
13
13
  /** Constrains the field to its content's width (used inside horizontal field bodies). */
14
14
  narrow?: boolean;
15
- /** Field label, rendered above the widget. Automatically names the one control the Field holds: a composed `InputBase`, `SelectBase` or `TextAreaBase`, or a bestax input that renders a single input of its own (`Input`, `Select`, `TextArea`, `Numberinput`, `Slider`, `DateInput`, `TimeInput`, `DateTimeInput`, `Autocomplete`, `Taginput`, `File`), adopts a generated id that the label's `htmlFor` points at, and a group (`Radios`, `Checkboxes`, `Rate`, `DateRangeInput`) points `aria-labelledby` at the label's own id unless you gave the group an `aria-label` or `aria-labelledby`. Nothing else takes the label: `Checkbox`, `Radio` and `Switch` are named by their own children. Only the single inputs take the `htmlFor`, so with a group or any other content it matches nothing. Pass `labelProps={{ htmlFor }}` to wire your own `id`, or `labelProps={{ htmlFor: undefined }}` to opt out. Skipped for `grouped`/`hasAddons` fields (multiple controls), and a nested `Field` starts its own scope, so a horizontal Field whose body holds an inner `Field` names the control there only when you wire it. Two controls in one plain labeled Field would both adopt the id, so give each an `id` of its own. */
15
+ /** Field label, rendered above the widget. Automatically names the one control the Field holds: a composed `InputBase`, `SelectBase` or `TextAreaBase`, or a bestax input that renders a single input of its own (`Input`, `Select`, `TextArea`, `Numberinput`, `Slider`, `DateInput`, `TimeInput`, `DateTimeInput`, `Autocomplete`, `Taginput`, `File`), adopts a generated id that the label's `htmlFor` points at, and a group (`Radios`, `Checkboxes`, `Rate`, `DateRangeInput`) points `aria-labelledby` at the label's own id unless you gave the group an `aria-label` or `aria-labelledby`. A range `Slider` takes the id on its low thumb and also starts each thumb's name with the label through `aria-labelledby`, unless its `ariaLabel` names that thumb or its own `aria-label` or `aria-labelledby` takes the label's place. Nothing else takes the label: `Checkbox`, `Radio` and `Switch` are named by their own children. Only the single inputs take the `htmlFor`, so with a group or any other content it matches nothing. Pass `labelProps={{ htmlFor }}` to wire your own `id`, or `labelProps={{ htmlFor: undefined }}` to opt out. Skipped for `grouped`/`hasAddons` fields (multiple controls), and a nested `Field` starts its own scope, so a horizontal Field whose body holds an inner `Field` names the control there only when you wire it. Two controls in one plain labeled Field would both adopt the id, so give each an `id` of its own. */
16
16
  label?: React.ReactNode;
17
17
  /** Size for the label. */
18
18
  labelSize?: 'small' | 'normal' | 'medium' | 'large';
19
- /** Props for the label element. An explicit `htmlFor` key — even set to `undefined` — takes over the association. An `id` here is the one a group control's `aria-labelledby` points at; otherwise the label gets a generated one while the association is on. To point a group in an inner `Field` at this label by hand, pass that `id` with `htmlFor: undefined`, or the label keeps a generated `htmlFor` that nothing takes. */
19
+ /** Props for the label element. An explicit `htmlFor` key — even set to `undefined` — takes over the association. An `id` here is the one a group control's, or a range `Slider`'s, `aria-labelledby` points at; otherwise the label gets a generated one while the association is on. To point a group in an inner `Field` at this label by hand, pass that `id` with `htmlFor: undefined`, or the label keeps a generated `htmlFor` that nothing takes. */
20
20
  labelProps?: React.LabelHTMLAttributes<HTMLLabelElement> & {
21
21
  [key: string]: unknown;
22
22
  };
@@ -115,8 +115,10 @@ export declare const FieldLabelIdProvider: React.Provider<string | undefined>;
115
115
  /**
116
116
  * The id of a labeled Field's own `<label>`, for a group control (Radios,
117
117
  * Checkboxes, Rate, DateRangeInput) to point `aria-labelledby` at, since a group cannot take
118
- * the label's `htmlFor` (#939). Set under the same conditions as
119
- * {@link useFieldLabelId}. Consumed through `useAutoLabelledBy`.
118
+ * the label's `htmlFor` (#939), and for a range Slider's thumbs, which each
119
+ * need the label in a name of their own (#981). Set under the same conditions
120
+ * as {@link useFieldLabelId}. Consumed through `useAutoLabelledBy` and
121
+ * `useAutoLabelId`.
120
122
  * Internal; not part of the public API.
121
123
  */
122
124
  export declare const useFieldLabelElementId: () => string | undefined;
@@ -22,9 +22,9 @@ export interface SliderMark {
22
22
  * Shared base props for single and range Slider modes.
23
23
  */
24
24
  interface SliderBaseProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, 'color' | 'size' | 'onChange' | 'value' | 'defaultValue'>, Omit<BulmaClassesProps, 'color' | 'backgroundColor' | 'size'>, FormFieldProps {
25
- /** Field label. Automatically associated with the slider input via `htmlFor` — uses your `id` when provided, otherwise a generated one. In range mode the label targets the low (minimum) thumb. Dropped inside an outer `Field`, whose own label associates instead when that `Field` generates a target id (not `grouped`/`hasAddons`, no explicit `labelProps.htmlFor`). */
25
+ /** Field label. Automatically associated with the slider input via `htmlFor` — uses your `id` when provided, otherwise a generated one. In range mode the `htmlFor` targets the low (minimum) thumb, and the label also starts each thumb's name through `aria-labelledby`, as in "Price Minimum value" and "Price Maximum value", unless an `aria-label` or `aria-labelledby` on the Slider takes its place there. Dropped inside an outer `Field`, whose own label associates instead when that `Field` generates a target id (not `grouped`/`hasAddons`, no explicit `labelProps.htmlFor`), naming a range Slider's thumbs the same way. */
26
26
  label?: React.ReactNode;
27
- /** Props for the label element. An explicit `htmlFor` here overrides the automatic association (no id is generated then). */
27
+ /** Props for the label element. An explicit `htmlFor` here overrides the automatic association (no id is generated then). In range mode an `id` here is the one the thumbs' `aria-labelledby` points at, in place of a generated one. */
28
28
  labelProps?: React.LabelHTMLAttributes<HTMLLabelElement> & {
29
29
  [key: string]: unknown;
30
30
  };
@@ -82,7 +82,7 @@ export interface SliderSingleProps extends SliderBaseProps {
82
82
  * @defaultValue 0
83
83
  */
84
84
  minDistance?: never;
85
- /** ARIA label(s) for the slider thumb(s). */
85
+ /** ARIA label(s) for the slider thumb(s), which win over a label, the Slider's own or a surrounding `Field`'s. In range mode each entry is that thumb's whole name, and a thumb without one is named "Minimum value" or "Maximum value", after whatever names the Slider: a label, or in its place an `aria-label` or `aria-labelledby` given to the Slider, as in "Budget Minimum value" and "Budget Maximum value". An `aria-labelledby` set to `undefined` keeps every label out of both names. */
86
86
  ariaLabel?: string;
87
87
  }
88
88
  /**
@@ -108,7 +108,7 @@ export interface SliderRangeProps extends SliderBaseProps {
108
108
  * @defaultValue 0
109
109
  */
110
110
  minDistance?: number;
111
- /** ARIA label(s) for the slider thumb(s). */
111
+ /** ARIA label(s) for the slider thumb(s), which win over a label, the Slider's own or a surrounding `Field`'s. In range mode each entry is that thumb's whole name, and a thumb without one is named "Minimum value" or "Maximum value", after whatever names the Slider: a label, or in its place an `aria-label` or `aria-labelledby` given to the Slider, as in "Budget Minimum value" and "Budget Maximum value". An `aria-labelledby` set to `undefined` keeps every label out of both names. */
112
112
  ariaLabel?: [string, string];
113
113
  /** Form field name for the low thumb. Use this in range mode so each thumb submits with its own name. */
114
114
  nameLow?: string;
@@ -18,6 +18,13 @@ interface UseAutoLabelIdOptions {
18
18
  * so it takes no id from a surrounding Field either. Defaults to true.
19
19
  */
20
20
  hasInput?: boolean;
21
+ /**
22
+ * True when the control also points `aria-labelledby` at the label, as a
23
+ * range Slider's thumbs do (#981), so it needs the label's own id. Its own
24
+ * label then gets one (`labelProps.id` when given, otherwise a generated
25
+ * one), and the hook returns it, or a surrounding Field's, as `labelId`.
26
+ */
27
+ needsLabelId?: boolean;
21
28
  }
22
29
  /**
23
30
  * Associates the convenience `label` prop with its control (#368): generates
@@ -27,14 +34,21 @@ interface UseAutoLabelIdOptions {
27
34
  * generation entirely: the user has taken over the association (#495 presence
28
35
  * semantics). When the control renders no label of its own, it adopts the id
29
36
  * a labeled Field around it offers, the way the bases do, so that Field's
30
- * label names it (#939); a user `id` still wins there.
37
+ * label names it (#939); a user `id` still wins there. With `needsLabelId`
38
+ * it also returns the id of whichever label names the control (#981).
31
39
  * Internal; not part of the public API.
32
40
  */
33
- export declare function useAutoLabelId({ label, id, labelProps, rendersLabel, hasInput, }: UseAutoLabelIdOptions): {
41
+ export declare function useAutoLabelId({ label, id, labelProps, rendersLabel, hasInput, needsLabelId, }: UseAutoLabelIdOptions): {
34
42
  controlId: string | undefined;
35
43
  fieldLabelProps: FieldProps['labelProps'] | undefined;
36
44
  /** Whether a rendered label, its own or a surrounding Field's, points at `controlId`. */
37
45
  labelled: boolean;
46
+ /**
47
+ * With `needsLabelId`, the id of the label that names `controlId`, its own
48
+ * or a surrounding Field's. Undefined when no label names it, or when the
49
+ * Field's label was wired by hand, since that Field hands out no label id.
50
+ */
51
+ labelId: string | undefined;
38
52
  };
39
53
  interface UseAutoLabelledByOptions {
40
54
  /** The convenience `label` prop as passed by the caller. */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@allxsmith/bestax-bulma",
3
- "version": "5.27.3",
3
+ "version": "5.27.4",
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",