@allxsmith/bestax-bulma 5.8.1 → 5.8.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.
- package/dist/index.cjs.js +122 -27
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +122 -27
- package/dist/index.esm.js.map +1 -1
- package/dist/types/form/Autocomplete.d.ts +9 -1
- package/dist/types/form/DateInput.d.ts +2 -2
- package/dist/types/form/DateTimeInput.d.ts +2 -2
- package/dist/types/form/Field.d.ts +2 -2
- package/dist/types/form/File.d.ts +6 -0
- package/dist/types/form/Input.d.ts +2 -2
- package/dist/types/form/Numberinput.d.ts +6 -0
- package/dist/types/form/Select.d.ts +2 -2
- package/dist/types/form/Slider.d.ts +6 -0
- package/dist/types/form/Taginput.d.ts +9 -1
- package/dist/types/form/TextArea.d.ts +2 -2
- package/dist/types/form/TimeInput.d.ts +2 -2
- package/dist/types/form/useAutoLabelId.d.ts +28 -0
- package/package.json +1 -1
|
@@ -16,9 +16,17 @@ export interface AutocompleteItem {
|
|
|
16
16
|
/**
|
|
17
17
|
* Props for the Autocomplete component.
|
|
18
18
|
* @extraProp {string} [className] - Additional CSS classes.
|
|
19
|
-
* @extraProp {React.Ref<
|
|
19
|
+
* @extraProp {React.Ref<HTMLInputElement>} [ref] - Ref forwarded to the input element.
|
|
20
20
|
*/
|
|
21
21
|
export interface AutocompleteProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'onSelect' | 'onInput'>, Omit<BulmaClassesProps, 'color'>, FormFieldProps {
|
|
22
|
+
/** Field label. Automatically associated with the text input via `htmlFor` — uses your `id` when provided, otherwise a generated one. Dropped inside an outer `Field` (label that `Field` yourself). */
|
|
23
|
+
label?: React.ReactNode;
|
|
24
|
+
/** Props for the label element. An explicit `htmlFor` here overrides the automatic association (no id is generated then). */
|
|
25
|
+
labelProps?: React.LabelHTMLAttributes<HTMLLabelElement> & {
|
|
26
|
+
[key: string]: unknown;
|
|
27
|
+
};
|
|
28
|
+
/** Applied to the inner text input (the labellable control), not the wrapper div. */
|
|
29
|
+
id?: string;
|
|
22
30
|
/** The options data to display (required). */
|
|
23
31
|
data: AutocompleteItem[] | string[];
|
|
24
32
|
/** The current input value (controlled). */
|
|
@@ -12,11 +12,11 @@ import { DateInputBaseProps } from './DateInputBase';
|
|
|
12
12
|
* @extraProp {React.Ref<HTMLInputElement>} [ref] - Forwarded to the underlying `<input>`.
|
|
13
13
|
*/
|
|
14
14
|
export interface DateInputProps extends DateInputBaseProps {
|
|
15
|
-
/** Field label (component auto-wraps in a `Field` if not already inside). */
|
|
15
|
+
/** Field label (component auto-wraps in a `Field` if not already inside). Automatically associated with the input via `htmlFor` — uses your `id` when provided, otherwise a generated one. Not wired in `inline` mode (no visible input to label) and dropped inside an outer `Field`. */
|
|
16
16
|
label?: React.ReactNode;
|
|
17
17
|
/** Size for the label. */
|
|
18
18
|
labelSize?: FieldProps['labelSize'];
|
|
19
|
-
/** Props for the label element. */
|
|
19
|
+
/** Props for the label element. An explicit `htmlFor` here overrides the automatic association (no id is generated then). */
|
|
20
20
|
labelProps?: FieldProps['labelProps'];
|
|
21
21
|
/** Render the field with horizontal layout. */
|
|
22
22
|
horizontal?: boolean;
|
|
@@ -10,11 +10,11 @@ import { DateTimeInputBaseProps } from './DateTimeInputBase';
|
|
|
10
10
|
* @extraProp {boolean} [required=false] - Marks the field as required for native HTML form validation.
|
|
11
11
|
*/
|
|
12
12
|
export interface DateTimeInputProps extends DateTimeInputBaseProps {
|
|
13
|
-
/** Field label. */
|
|
13
|
+
/** Field label. Automatically associated with the input via `htmlFor` — uses your `id` when provided, otherwise a generated one. Not wired in `inline` mode (no visible input to label) and dropped inside an outer `Field`. */
|
|
14
14
|
label?: React.ReactNode;
|
|
15
15
|
/** Size for the label. */
|
|
16
16
|
labelSize?: FieldProps['labelSize'];
|
|
17
|
-
/** Props for the label element. */
|
|
17
|
+
/** Props for the label element. An explicit `htmlFor` here overrides the automatic association (no id is generated then). */
|
|
18
18
|
labelProps?: FieldProps['labelProps'];
|
|
19
19
|
/** Render the field with horizontal layout. */
|
|
20
20
|
horizontal?: boolean;
|
|
@@ -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. */
|
|
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`). */
|
|
16
16
|
label?: React.ReactNode;
|
|
17
17
|
/** Size for the label. */
|
|
18
18
|
labelSize?: 'small' | 'normal' | 'medium' | 'large';
|
|
19
|
-
/** Props for the label element. */
|
|
19
|
+
/** Props for the label element — where `htmlFor` goes when composing. */
|
|
20
20
|
labelProps?: React.LabelHTMLAttributes<HTMLLabelElement> & {
|
|
21
21
|
[key: string]: unknown;
|
|
22
22
|
};
|
|
@@ -5,6 +5,12 @@ import { FormFieldProps } from './fieldProps';
|
|
|
5
5
|
* Props for the File component.
|
|
6
6
|
*/
|
|
7
7
|
export interface FileProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, 'size' | 'color' | 'type'>, Omit<BulmaClassesProps, 'color'>, FormFieldProps {
|
|
8
|
+
/** Field label. Automatically associated with the file input via `htmlFor` — uses your `id` when provided, otherwise a generated one. The input then has two labels (this one plus the wrapping `file-label`); assistive tech reads both. Dropped inside an outer `Field` (label that `Field` yourself). */
|
|
9
|
+
label?: React.ReactNode;
|
|
10
|
+
/** Props for the label element. An explicit `htmlFor` here overrides the automatic association (no id is generated then). */
|
|
11
|
+
labelProps?: React.LabelHTMLAttributes<HTMLLabelElement> & {
|
|
12
|
+
[key: string]: unknown;
|
|
13
|
+
};
|
|
8
14
|
/** Bulma color modifier for the file input. */
|
|
9
15
|
color?: 'primary' | 'link' | 'info' | 'success' | 'warning' | 'danger' | 'black' | 'dark' | 'light' | 'white';
|
|
10
16
|
/** Size modifier for the file input. */
|
|
@@ -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. */
|
|
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). */
|
|
14
14
|
label?: React.ReactNode;
|
|
15
15
|
/** Size for the label. */
|
|
16
16
|
labelSize?: FieldProps['labelSize'];
|
|
17
|
-
/** Props for the label element. */
|
|
17
|
+
/** Props for the label element. An explicit `htmlFor` here overrides the automatic association (no id is generated then). */
|
|
18
18
|
labelProps?: FieldProps['labelProps'];
|
|
19
19
|
/** Horizontal field layout. */
|
|
20
20
|
horizontal?: boolean;
|
|
@@ -17,6 +17,12 @@ export type NumberinputVariant = 'plusminus' | 'stepper';
|
|
|
17
17
|
* @extraProp {React.Ref<HTMLElement>} [ref] - Ref forwarded to the input element.
|
|
18
18
|
*/
|
|
19
19
|
export interface NumberinputProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, 'color' | 'size' | 'onChange' | 'value' | 'defaultValue' | 'type'>, Omit<BulmaClassesProps, 'color' | 'backgroundColor' | 'size'>, FormFieldProps {
|
|
20
|
+
/** Field label. Automatically associated with the number input via `htmlFor` — uses your `id` when provided, otherwise a generated one. Not wired when no Field wrapper is rendered (inside a `Field`, or plusminus `bare`). */
|
|
21
|
+
label?: React.ReactNode;
|
|
22
|
+
/** Props for the label element. An explicit `htmlFor` here overrides the automatic association (no id is generated then). */
|
|
23
|
+
labelProps?: React.LabelHTMLAttributes<HTMLLabelElement> & {
|
|
24
|
+
[key: string]: unknown;
|
|
25
|
+
};
|
|
20
26
|
/** Controlled value. */
|
|
21
27
|
value?: number;
|
|
22
28
|
/** Default value for uncontrolled usage. */
|
|
@@ -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. */
|
|
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). */
|
|
14
14
|
label?: React.ReactNode;
|
|
15
15
|
/** Size for the label. */
|
|
16
16
|
labelSize?: FieldProps['labelSize'];
|
|
17
|
-
/** Props for the label element. */
|
|
17
|
+
/** Props for the label element. An explicit `htmlFor` here overrides the automatic association (no id is generated then). */
|
|
18
18
|
labelProps?: FieldProps['labelProps'];
|
|
19
19
|
/** Horizontal field layout. */
|
|
20
20
|
horizontal?: boolean;
|
|
@@ -22,6 +22,12 @@ 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` (label that `Field` yourself). */
|
|
26
|
+
label?: React.ReactNode;
|
|
27
|
+
/** Props for the label element. An explicit `htmlFor` here overrides the automatic association (no id is generated then). */
|
|
28
|
+
labelProps?: React.LabelHTMLAttributes<HTMLLabelElement> & {
|
|
29
|
+
[key: string]: unknown;
|
|
30
|
+
};
|
|
25
31
|
/** Minimum value. */
|
|
26
32
|
min?: number;
|
|
27
33
|
/** Maximum value. */
|
|
@@ -17,9 +17,17 @@ type IconLibrary = 'fa' | 'mdi' | 'ion' | 'material-icons' | 'material-symbols';
|
|
|
17
17
|
/**
|
|
18
18
|
* Props for the Taginput component.
|
|
19
19
|
* @extraProp {string} [className] - Additional CSS classes.
|
|
20
|
-
* @extraProp {React.Ref<
|
|
20
|
+
* @extraProp {React.Ref<HTMLInputElement>} [ref] - Ref forwarded to the input element.
|
|
21
21
|
*/
|
|
22
22
|
export interface TaginputProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'onChange' | 'defaultValue'>, Omit<BulmaClassesProps, 'color'>, FormFieldProps {
|
|
23
|
+
/** Field label. Automatically associated with the text input via `htmlFor` — uses your `id` when provided, otherwise a generated one. Not wired when the tag limit is reached (the input is not rendered) and dropped inside an outer `Field`. */
|
|
24
|
+
label?: React.ReactNode;
|
|
25
|
+
/** Props for the label element. An explicit `htmlFor` here overrides the automatic association (no id is generated then). */
|
|
26
|
+
labelProps?: React.LabelHTMLAttributes<HTMLLabelElement> & {
|
|
27
|
+
[key: string]: unknown;
|
|
28
|
+
};
|
|
29
|
+
/** Applied to the inner text input (the labellable control), not the wrapper div. */
|
|
30
|
+
id?: string;
|
|
23
31
|
/** The current tags (controlled). */
|
|
24
32
|
value?: TaginputTag[];
|
|
25
33
|
/** Default tags (uncontrolled). */
|
|
@@ -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. */
|
|
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). */
|
|
14
14
|
label?: React.ReactNode;
|
|
15
15
|
/** Size for the label. */
|
|
16
16
|
labelSize?: FieldProps['labelSize'];
|
|
17
|
-
/** Props for the label element. */
|
|
17
|
+
/** Props for the label element. An explicit `htmlFor` here overrides the automatic association (no id is generated then). */
|
|
18
18
|
labelProps?: FieldProps['labelProps'];
|
|
19
19
|
/** Horizontal field layout. */
|
|
20
20
|
horizontal?: boolean;
|
|
@@ -12,11 +12,11 @@ import { TimeInputBaseProps } from './TimeInputBase';
|
|
|
12
12
|
* @extraProp {React.Ref<HTMLInputElement>} [ref] - Forwarded to the underlying `<input>`.
|
|
13
13
|
*/
|
|
14
14
|
export interface TimeInputProps extends TimeInputBaseProps {
|
|
15
|
-
/** Field label. */
|
|
15
|
+
/** Field label. Automatically associated with the input via `htmlFor` — uses your `id` when provided, otherwise a generated one. Not wired in `inline` mode (no visible input to label) and dropped inside an outer `Field`. */
|
|
16
16
|
label?: React.ReactNode;
|
|
17
17
|
/** Size for the label. */
|
|
18
18
|
labelSize?: FieldProps['labelSize'];
|
|
19
|
-
/** Props for the label element. */
|
|
19
|
+
/** Props for the label element. An explicit `htmlFor` here overrides the automatic association (no id is generated then). */
|
|
20
20
|
labelProps?: FieldProps['labelProps'];
|
|
21
21
|
/** Render the field with horizontal layout. */
|
|
22
22
|
horizontal?: boolean;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { FieldProps } from './Field';
|
|
3
|
+
interface UseAutoLabelIdOptions {
|
|
4
|
+
/** The convenience `label` prop as passed by the caller. */
|
|
5
|
+
label: React.ReactNode;
|
|
6
|
+
/** User-supplied id for the control, if any. */
|
|
7
|
+
id?: string;
|
|
8
|
+
/** User-supplied labelProps, if any. */
|
|
9
|
+
labelProps?: FieldProps['labelProps'];
|
|
10
|
+
/**
|
|
11
|
+
* True when this render actually outputs the label wired to a control —
|
|
12
|
+
* false inside an outer Field (label is dropped), in variants that render
|
|
13
|
+
* no Field, and in modes with no labellable control (e.g. inline pickers).
|
|
14
|
+
*/
|
|
15
|
+
rendersLabel: boolean;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Associates the convenience `label` prop with its control (#368): generates
|
|
19
|
+
* an id for the control and returns labelProps carrying a matching `htmlFor`.
|
|
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.
|
|
23
|
+
*/
|
|
24
|
+
export declare function useAutoLabelId({ label, id, labelProps, rendersLabel, }: UseAutoLabelIdOptions): {
|
|
25
|
+
controlId: string | undefined;
|
|
26
|
+
fieldLabelProps: FieldProps['labelProps'] | undefined;
|
|
27
|
+
};
|
|
28
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@allxsmith/bestax-bulma",
|
|
3
|
-
"version": "5.8.
|
|
3
|
+
"version": "5.8.3",
|
|
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",
|