@allxsmith/bestax-bulma 5.8.3 → 5.9.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.
@@ -5,6 +5,12 @@ import { FormFieldProps } from './fieldProps';
5
5
  * Props for the Checkboxes component.
6
6
  */
7
7
  export interface CheckboxesProps extends Omit<BulmaClassesProps, 'color'>, FormFieldProps {
8
+ /** Field label naming the whole group. Automatically associated via `aria-labelledby` on the `role="group"` wrapper — uses your `labelProps.id` when provided, otherwise a generated one. Dropped inside an outer `Field` (label that `Field` yourself). */
9
+ label?: React.ReactNode;
10
+ /** Props for the label element. An explicit `id` here is used as the `aria-labelledby` target instead of a generated one; any `htmlFor` is ignored (a group label names the group, never a single control). */
11
+ labelProps?: React.LabelHTMLAttributes<HTMLLabelElement> & {
12
+ [key: string]: unknown;
13
+ };
8
14
  /** Additional CSS classes to apply. */
9
15
  className?: string;
10
16
  /** Form field name shared by every Checkbox in the group (via context). */
@@ -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. `Field` itself does not associate it with any control — pass `labelProps={{ htmlFor }}` and a matching `id` on your control (the single-control convenience inputs do this automatically when they render their own `Field`). */
15
+ /** Field label, rendered above the widget. Automatically associated with a single composed `InputBase`, `SelectBase`, or `TextAreaBase` via a generated id and `htmlFor`. Pass `labelProps={{ htmlFor }}` to wire your own `id`, or `labelProps={{ htmlFor: undefined }}` to opt out. Skipped for `grouped`/`hasAddons` fields (multiple controls). */
16
16
  label?: React.ReactNode;
17
17
  /** Size for the label. */
18
18
  labelSize?: 'small' | 'normal' | 'medium' | 'large';
19
- /** Props for the label element — where `htmlFor` goes when composing. */
19
+ /** Props for the label element. An explicit `htmlFor` key — even set to `undefined` — takes over the association. */
20
20
  labelProps?: React.LabelHTMLAttributes<HTMLLabelElement> & {
21
21
  [key: string]: unknown;
22
22
  };
@@ -12,6 +12,16 @@ export declare const useInsideControl: () => boolean;
12
12
  export declare const FieldProvider: import("react").Provider<boolean>;
13
13
  /** Provider for Control context — used internally by Control component. */
14
14
  export declare const ControlProvider: import("react").Provider<boolean>;
15
+ /**
16
+ * The id a labeled Field wants its single composed control to adopt (#495).
17
+ * `undefined` outside a Field, in unlabeled/grouped/addons Fields, or when the
18
+ * user took over the association with an explicit `labelProps.htmlFor`.
19
+ * Consumed only by the single-control bases (InputBase, SelectBase,
20
+ * TextAreaBase). Internal; not part of the public API.
21
+ */
22
+ export declare const useFieldLabelId: () => string | undefined;
23
+ /** Provider for the Field label-target id — used internally by Field. */
24
+ export declare const FieldLabelIdProvider: import("react").Provider<string | undefined>;
15
25
  /**
16
26
  * Shape of the Radios group context. The group provides:
17
27
  * - `name`: shared form field name (Stage 1)
@@ -10,11 +10,11 @@ import { InputBaseProps } from './InputBase';
10
10
  * Control-level (icons, loading) props.
11
11
  */
12
12
  export interface InputProps extends InputBaseProps {
13
- /** Field label. Automatically associated with the input via `htmlFor` — uses your `id` when provided, otherwise a generated one. Dropped inside an outer `Field` (label that `Field` yourself). */
13
+ /** Field label. Automatically associated with the input via `htmlFor` — uses your `id` when provided, otherwise a generated one. Dropped inside an outer `Field`, whose own label associates instead when that `Field` generates a target id (not `grouped`/`hasAddons`, no explicit `labelProps.htmlFor`). */
14
14
  label?: React.ReactNode;
15
15
  /** Size for the label. */
16
16
  labelSize?: FieldProps['labelSize'];
17
- /** Props for the label element. An explicit `htmlFor` here overrides the automatic association (no id is generated then). */
17
+ /** Props for the label element when the component renders its own `Field`; dropped inside an outer `Field` (use that `Field`'s `labelProps` instead). An explicit `htmlFor` key — even `undefined` — overrides the automatic association and no id is generated. */
18
18
  labelProps?: FieldProps['labelProps'];
19
19
  /** Horizontal field layout. */
20
20
  horizontal?: boolean;
@@ -5,6 +5,12 @@ import { FormFieldProps } from './fieldProps';
5
5
  * Props for the Radios component.
6
6
  */
7
7
  export interface RadiosProps extends Omit<BulmaClassesProps, 'color'>, FormFieldProps {
8
+ /** Field label naming the whole group. Automatically associated via `aria-labelledby` on the `role="radiogroup"` wrapper — uses your `labelProps.id` when provided, otherwise a generated one. Dropped inside an outer `Field` (label that `Field` yourself). */
9
+ label?: React.ReactNode;
10
+ /** Props for the label element. An explicit `id` here is used as the `aria-labelledby` target instead of a generated one; any `htmlFor` is ignored (a group label names the group, never a single control). */
11
+ labelProps?: React.LabelHTMLAttributes<HTMLLabelElement> & {
12
+ [key: string]: unknown;
13
+ };
8
14
  /** Additional CSS classes to apply. */
9
15
  className?: string;
10
16
  /** Form field name shared by every Radio in the group (via context). */
@@ -26,6 +26,12 @@ export interface RateIconProps {
26
26
  * @extraProp {React.Ref<HTMLElement>} [ref] - Ref forwarded to the container element.
27
27
  */
28
28
  export interface RateProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'onChange' | 'color'>, Omit<BulmaClassesProps, 'size'>, FormFieldProps {
29
+ /** Field label naming the rating group. Automatically associated via `aria-labelledby` on the `role="radiogroup"` container — uses your `labelProps.id` when provided, otherwise a generated one; it also replaces the default `aria-label="Rating"`. Dropped inside an outer `Field` (label that `Field` yourself). */
30
+ label?: React.ReactNode;
31
+ /** Props for the label element. An explicit `id` here is used as the `aria-labelledby` target instead of a generated one; any `htmlFor` is ignored (a group label names the group, never a single control). */
32
+ labelProps?: React.LabelHTMLAttributes<HTMLLabelElement> & {
33
+ [key: string]: unknown;
34
+ };
29
35
  /** Form field name. When set, a hidden input is rendered. */
30
36
  name?: string;
31
37
  /** Optional id of the form this hidden input belongs to (use when the input lives outside the form element). */
@@ -10,11 +10,11 @@ import { SelectBaseProps } from './SelectBase';
10
10
  * Control-level (icons, loading) props.
11
11
  */
12
12
  export interface SelectProps extends SelectBaseProps {
13
- /** Field label. Automatically associated with the select via `htmlFor` — uses your `id` when provided, otherwise a generated one. Dropped inside an outer `Field` (label that `Field` yourself). */
13
+ /** Field label. Automatically associated with the select via `htmlFor` — uses your `id` when provided, otherwise a generated one. Dropped inside an outer `Field`, whose own label associates instead when that `Field` generates a target id (not `grouped`/`hasAddons`, no explicit `labelProps.htmlFor`). */
14
14
  label?: React.ReactNode;
15
15
  /** Size for the label. */
16
16
  labelSize?: FieldProps['labelSize'];
17
- /** Props for the label element. An explicit `htmlFor` here overrides the automatic association (no id is generated then). */
17
+ /** Props for the label element when the component renders its own `Field`; dropped inside an outer `Field` (use that `Field`'s `labelProps` instead). An explicit `htmlFor` key — even `undefined` — overrides the automatic association and no id is generated. */
18
18
  labelProps?: FieldProps['labelProps'];
19
19
  /** Horizontal field layout. */
20
20
  horizontal?: boolean;
@@ -10,11 +10,11 @@ import { TextAreaBaseProps } from './TextAreaBase';
10
10
  * Control-level (loading) props.
11
11
  */
12
12
  export interface TextAreaProps extends TextAreaBaseProps {
13
- /** Field label. Automatically associated with the textarea via `htmlFor` — uses your `id` when provided, otherwise a generated one. Dropped inside an outer `Field` (label that `Field` yourself). */
13
+ /** Field label. Automatically associated with the textarea via `htmlFor` — uses your `id` when provided, otherwise a generated one. Dropped inside an outer `Field`, whose own label associates instead when that `Field` generates a target id (not `grouped`/`hasAddons`, no explicit `labelProps.htmlFor`). */
14
14
  label?: React.ReactNode;
15
15
  /** Size for the label. */
16
16
  labelSize?: FieldProps['labelSize'];
17
- /** Props for the label element. An explicit `htmlFor` here overrides the automatic association (no id is generated then). */
17
+ /** Props for the label element when the component renders its own `Field`; dropped inside an outer `Field` (use that `Field`'s `labelProps` instead). An explicit `htmlFor` key — even `undefined` — overrides the automatic association and no id is generated. */
18
18
  labelProps?: FieldProps['labelProps'];
19
19
  /** Horizontal field layout. */
20
20
  horizontal?: boolean;
@@ -18,11 +18,34 @@ interface UseAutoLabelIdOptions {
18
18
  * Associates the convenience `label` prop with its control (#368): generates
19
19
  * an id for the control and returns labelProps carrying a matching `htmlFor`.
20
20
  * A user-supplied `id` is used as the target instead of the generated one, and
21
- * an explicit `labelProps.htmlFor` disables generation entirely — the user has
22
- * taken over the association. Internal; not part of the public API.
21
+ * an explicit `htmlFor` key in labelProps — even set to `undefined` — disables
22
+ * generation entirely: the user has taken over the association (#495 presence
23
+ * semantics). Internal; not part of the public API.
23
24
  */
24
25
  export declare function useAutoLabelId({ label, id, labelProps, rendersLabel, }: UseAutoLabelIdOptions): {
25
26
  controlId: string | undefined;
26
27
  fieldLabelProps: FieldProps['labelProps'] | undefined;
27
28
  };
29
+ interface UseAutoLabelledByOptions {
30
+ /** The convenience `label` prop as passed by the caller. */
31
+ label: React.ReactNode;
32
+ /** User-supplied labelProps, if any. */
33
+ labelProps?: FieldProps['labelProps'];
34
+ /** True when this render actually outputs the label naming the group. */
35
+ rendersLabel: boolean;
36
+ }
37
+ /**
38
+ * Group-input counterpart of {@link useAutoLabelId} (#494): a group of
39
+ * controls cannot take a single `htmlFor`, so instead the rendered `<label>`
40
+ * gets a generated id and the group container points at it with
41
+ * `aria-labelledby`. A user-supplied `labelProps.id` is used as the target
42
+ * instead of generating one. Any caller `htmlFor` is stripped — a group label
43
+ * names the group, never a single control — so the merged labelProps always
44
+ * carry an explicit `htmlFor: undefined`.
45
+ * Internal; not part of the public API.
46
+ */
47
+ export declare function useAutoLabelledBy({ label, labelProps, rendersLabel, }: UseAutoLabelledByOptions): {
48
+ ariaLabelledBy: string | undefined;
49
+ fieldLabelProps: FieldProps['labelProps'] | undefined;
50
+ };
28
51
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@allxsmith/bestax-bulma",
3
- "version": "5.8.3",
3
+ "version": "5.9.0",
4
4
  "description": "A fully-typed React component library for the Bulma CSS framework. Build modern UIs quickly with reusable, accessible, and customizable Bulma-based React components.",
5
5
  "main": "dist/index.cjs.js",
6
6
  "module": "dist/index.esm.js",