@allxsmith/bestax-bulma 5.8.2 → 5.8.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.
- package/dist/index.cjs.js +83 -32
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +83 -32
- package/dist/index.esm.js.map +1 -1
- package/dist/types/form/Autocomplete.d.ts +9 -1
- package/dist/types/form/Checkboxes.d.ts +6 -0
- package/dist/types/form/Radios.d.ts +6 -0
- package/dist/types/form/Rate.d.ts +6 -0
- package/dist/types/form/Taginput.d.ts +9 -1
- package/dist/types/form/useAutoLabelId.d.ts +22 -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). */
|
|
@@ -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). */
|
|
@@ -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). */
|
|
@@ -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). */
|
|
@@ -25,4 +25,26 @@ export declare function useAutoLabelId({ label, id, labelProps, rendersLabel, }:
|
|
|
25
25
|
controlId: string | undefined;
|
|
26
26
|
fieldLabelProps: FieldProps['labelProps'] | undefined;
|
|
27
27
|
};
|
|
28
|
+
interface UseAutoLabelledByOptions {
|
|
29
|
+
/** The convenience `label` prop as passed by the caller. */
|
|
30
|
+
label: React.ReactNode;
|
|
31
|
+
/** User-supplied labelProps, if any. */
|
|
32
|
+
labelProps?: FieldProps['labelProps'];
|
|
33
|
+
/** True when this render actually outputs the label naming the group. */
|
|
34
|
+
rendersLabel: boolean;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Group-input counterpart of {@link useAutoLabelId} (#494): a group of
|
|
38
|
+
* controls cannot take a single `htmlFor`, so instead the rendered `<label>`
|
|
39
|
+
* gets a generated id and the group container points at it with
|
|
40
|
+
* `aria-labelledby`. A user-supplied `labelProps.id` is used as the target
|
|
41
|
+
* instead of generating one. Any caller `htmlFor` is stripped — a group label
|
|
42
|
+
* names the group, never a single control — so the merged labelProps always
|
|
43
|
+
* carry an explicit `htmlFor: undefined`.
|
|
44
|
+
* Internal; not part of the public API.
|
|
45
|
+
*/
|
|
46
|
+
export declare function useAutoLabelledBy({ label, labelProps, rendersLabel, }: UseAutoLabelledByOptions): {
|
|
47
|
+
ariaLabelledBy: string | undefined;
|
|
48
|
+
fieldLabelProps: FieldProps['labelProps'] | undefined;
|
|
49
|
+
};
|
|
28
50
|
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.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.js",
|
|
6
6
|
"module": "dist/index.esm.js",
|