@allxsmith/bestax-bulma 5.26.3 → 5.26.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/bestax.css +1 -1
- package/dist/bestax.css.map +1 -1
- package/dist/extras.css +1 -1
- package/dist/extras.css.map +1 -1
- package/dist/index.cjs +385 -123
- package/dist/index.cjs.map +1 -1
- package/dist/index.esm.js +385 -123
- package/dist/index.esm.js.map +1 -1
- package/dist/types/form/Checkboxes.d.ts +7 -0
- package/dist/types/form/DateInput.d.ts +18 -3
- package/dist/types/form/DateInputBase.d.ts +17 -3
- package/dist/types/form/DateTimeInput.d.ts +18 -3
- package/dist/types/form/DateTimeInputBase.d.ts +17 -3
- package/dist/types/form/File.d.ts +6 -0
- package/dist/types/form/FormContext.d.ts +39 -7
- package/dist/types/form/Input.d.ts +7 -2
- package/dist/types/form/Radios.d.ts +7 -0
- package/dist/types/form/Rate.d.ts +7 -0
- package/dist/types/form/Select.d.ts +7 -2
- package/dist/types/form/Slider.d.ts +7 -0
- package/dist/types/form/Taginput.d.ts +6 -0
- package/dist/types/form/TextArea.d.ts +7 -2
- package/dist/types/form/TimeInput.d.ts +18 -3
- package/dist/types/form/TimeInputBase.d.ts +16 -3
- package/dist/types/form/_pickerInternals/Calendar.d.ts +9 -3
- package/dist/types/form/_pickerInternals/dateUtils.d.ts +17 -0
- package/dist/types/form/controlLoading.d.ts +4 -0
- package/dist/types/helpers/useAnchoredPosition.d.ts +4 -1
- package/dist/types/helpers/useFocusTrap.d.ts +11 -4
- package/dist/types-cjs/form/Checkboxes.d.ts +7 -0
- package/dist/types-cjs/form/DateInput.d.ts +18 -3
- package/dist/types-cjs/form/DateInputBase.d.ts +17 -3
- package/dist/types-cjs/form/DateTimeInput.d.ts +18 -3
- package/dist/types-cjs/form/DateTimeInputBase.d.ts +17 -3
- package/dist/types-cjs/form/File.d.ts +6 -0
- package/dist/types-cjs/form/FormContext.d.ts +39 -7
- package/dist/types-cjs/form/Input.d.ts +7 -2
- package/dist/types-cjs/form/Radios.d.ts +7 -0
- package/dist/types-cjs/form/Rate.d.ts +7 -0
- package/dist/types-cjs/form/Select.d.ts +7 -2
- package/dist/types-cjs/form/Slider.d.ts +7 -0
- package/dist/types-cjs/form/Taginput.d.ts +6 -0
- package/dist/types-cjs/form/TextArea.d.ts +7 -2
- package/dist/types-cjs/form/TimeInput.d.ts +18 -3
- package/dist/types-cjs/form/TimeInputBase.d.ts +16 -3
- package/dist/types-cjs/form/_pickerInternals/Calendar.d.ts +9 -3
- package/dist/types-cjs/form/_pickerInternals/dateUtils.d.ts +17 -0
- package/dist/types-cjs/form/controlLoading.d.ts +4 -0
- package/dist/types-cjs/helpers/useAnchoredPosition.d.ts +4 -1
- package/dist/types-cjs/helpers/useFocusTrap.d.ts +11 -4
- package/dist/versions/bestax-no-dark-mode.css +1 -1
- package/dist/versions/bestax-no-dark-mode.css.map +1 -1
- package/dist/versions/bestax-no-helpers-prefixed.css +1 -1
- package/dist/versions/bestax-no-helpers-prefixed.css.map +1 -1
- package/dist/versions/bestax-no-helpers.css +1 -1
- package/dist/versions/bestax-no-helpers.css.map +1 -1
- package/dist/versions/bestax-prefixed.css +1 -1
- package/dist/versions/bestax-prefixed.css.map +1 -1
- package/package.json +1 -1
- package/src/scss/form/_datetimeinput.scss +9 -0
- package/src/scss/form/_picker-popover.scss +12 -9
- package/src/scss/form/_rate.scss +3 -1
- package/src/scss/form/_timeinput.scss +5 -0
|
@@ -3,6 +3,13 @@ import { BulmaClassesProps } from '../helpers/useBulmaClasses.js';
|
|
|
3
3
|
import { FormFieldProps } from './fieldProps.js';
|
|
4
4
|
/**
|
|
5
5
|
* Props for the Checkboxes component.
|
|
6
|
+
* Inside an existing `Control` it renders no `Control` of its own. Inside an
|
|
7
|
+
* outer `Field`, or a `Control` with no `Field` around it, it renders no
|
|
8
|
+
* `Field` of its own either. The exception is `label`, `message`, `horizontal`
|
|
9
|
+
* or `fieldClassName` in that bare `Control`: it keeps a `Field` for them,
|
|
10
|
+
* nested in the `.control`, and warns in development. Wrap the `Control` in a
|
|
11
|
+
* `Field` instead, and set the `label`, `horizontal` and class name on that
|
|
12
|
+
* `Field`.
|
|
6
13
|
*/
|
|
7
14
|
export interface CheckboxesProps extends Omit<BulmaClassesProps, 'color'>, FormFieldProps {
|
|
8
15
|
/** 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). */
|
|
@@ -5,8 +5,13 @@ import { DateInputBaseProps } from './DateInputBase.js';
|
|
|
5
5
|
/**
|
|
6
6
|
* Props for the DateInput convenience wrapper. Extends `DateInputBaseProps`
|
|
7
7
|
* with Field-level (label, horizontal) and Control-level (icons, loading) props.
|
|
8
|
-
* Inside an existing `Control`
|
|
9
|
-
*
|
|
8
|
+
* Inside an existing `Control` it renders no `Control` of its own, so set the
|
|
9
|
+
* Control-level props on that `Control` instead. Inside an outer `Field`, or a
|
|
10
|
+
* `Control` with no `Field` around it, it renders no `Field` of its own either.
|
|
11
|
+
* The exception is `label`, `message`, `horizontal` or `fieldClassName` in that
|
|
12
|
+
* bare `Control`: it keeps a `Field` for them, nested in the `.control`, and
|
|
13
|
+
* warns in development. Wrap the `Control` in a `Field` instead, and set the
|
|
14
|
+
* `label`, `horizontal` and class name on that `Field`.
|
|
10
15
|
* @extraProp {string} [name] - Form field name. The text field submits the text it displays. The native input on touch devices submits the ISO value (`YYYY-MM-DD`, or `YYYY-MM` at month granularity), and an `inline` calendar, which has no visible input, submits it from a hidden input (`YYYY-MM-DD`, `YYYY-MM` or `YYYY`).
|
|
11
16
|
* @extraProp {string} [form] - Form id the input belongs to.
|
|
12
17
|
* @extraProp {boolean} [required=false] - Marks the input as required.
|
|
@@ -45,11 +50,21 @@ export interface DateInputProps extends DateInputBaseProps {
|
|
|
45
50
|
/** Force the right icon container. */
|
|
46
51
|
hasIconsRight?: boolean;
|
|
47
52
|
/**
|
|
48
|
-
* Shows a loading spinner on the `Control` it renders
|
|
53
|
+
* Shows a loading spinner on the `Control` it renders, and hides the
|
|
54
|
+
* launcher (`triggerIcon`) while it does. Inside your own `Control` it
|
|
55
|
+
* renders none, so this draws nothing; set `isLoading` on that `Control`.
|
|
49
56
|
* Under `prefers-reduced-motion: reduce` the spinner stops and stays
|
|
50
57
|
* drawn (with bestax's CSS loaded).
|
|
51
58
|
*/
|
|
52
59
|
isLoading?: boolean;
|
|
60
|
+
/**
|
|
61
|
+
* Show a clickable launcher button on the right that toggles the popover.
|
|
62
|
+
* Hidden by default while a spinner shows at the same right edge: this
|
|
63
|
+
* component's `isLoading` when it renders its own `Control`, or the
|
|
64
|
+
* enclosing `Control`'s `isLoading` inside one.
|
|
65
|
+
* @defaultValue true
|
|
66
|
+
*/
|
|
67
|
+
triggerIcon?: boolean;
|
|
53
68
|
/** Expand the control to fill its container. */
|
|
54
69
|
isExpanded?: boolean;
|
|
55
70
|
/** Size of the wrapping Control. */
|
|
@@ -17,7 +17,11 @@ export interface DateInputBaseProps extends Omit<React.InputHTMLAttributes<HTMLI
|
|
|
17
17
|
onOpen?: () => void;
|
|
18
18
|
/** Fired when the popover closes. */
|
|
19
19
|
onClose?: () => void;
|
|
20
|
-
/**
|
|
20
|
+
/**
|
|
21
|
+
* Earliest selectable date. A `min` before year 1 is raised to 1 January of
|
|
22
|
+
* year 1, where the range starts without one too: HTML's date and month
|
|
23
|
+
* inputs hold no earlier year, so the calendar and typing stop there.
|
|
24
|
+
*/
|
|
21
25
|
min?: Date;
|
|
22
26
|
/** Latest selectable date. */
|
|
23
27
|
max?: Date;
|
|
@@ -54,7 +58,12 @@ export interface DateInputBaseProps extends Omit<React.InputHTMLAttributes<HTMLI
|
|
|
54
58
|
* @defaultValue 'YYYY-MM-DD'
|
|
55
59
|
*/
|
|
56
60
|
format?: DateFormatOption;
|
|
57
|
-
/**
|
|
61
|
+
/**
|
|
62
|
+
* Custom parser (use when `format` is `Intl.DateTimeFormatOptions`).
|
|
63
|
+
* Enter and leaving the field call it only if the user changed the text,
|
|
64
|
+
* so focus passing through commits nothing and the value keeps what the
|
|
65
|
+
* format leaves out, such as the time of day.
|
|
66
|
+
*/
|
|
58
67
|
parse?: (s: string) => Date | null;
|
|
59
68
|
/** BCP-47 locale tag for day/month names and Intl formatting. */
|
|
60
69
|
locale?: string;
|
|
@@ -115,7 +124,12 @@ export interface DateInputBaseProps extends Omit<React.InputHTMLAttributes<HTMLI
|
|
|
115
124
|
nearbyMonthDays?: boolean;
|
|
116
125
|
/** Decorative left icon glyph for the wrapping `Control` (shown by default). Set `''` to hide. */
|
|
117
126
|
iconLeftName?: string;
|
|
118
|
-
/**
|
|
127
|
+
/**
|
|
128
|
+
* Show a clickable launcher button on the right that toggles the popover.
|
|
129
|
+
* Hidden by default while a `Control` it sits in shows its `isLoading`
|
|
130
|
+
* spinner, which shares that right edge.
|
|
131
|
+
* @defaultValue true
|
|
132
|
+
*/
|
|
119
133
|
triggerIcon?: boolean;
|
|
120
134
|
/** Glyph for the right launcher button. */
|
|
121
135
|
triggerIconName?: string;
|
|
@@ -5,8 +5,13 @@ import { DateTimeInputBaseProps } from './DateTimeInputBase.js';
|
|
|
5
5
|
/**
|
|
6
6
|
* Props for the DateTimeInput convenience wrapper. Extends
|
|
7
7
|
* `DateTimeInputBaseProps` with Field-level and Control-level props.
|
|
8
|
-
* Inside an existing `Control`
|
|
9
|
-
*
|
|
8
|
+
* Inside an existing `Control` it renders no `Control` of its own, so set the
|
|
9
|
+
* Control-level props on that `Control` instead. Inside an outer `Field`, or a
|
|
10
|
+
* `Control` with no `Field` around it, it renders no `Field` of its own either.
|
|
11
|
+
* The exception is `label`, `message`, `horizontal` or `fieldClassName` in that
|
|
12
|
+
* bare `Control`: it keeps a `Field` for them, nested in the `.control`, and
|
|
13
|
+
* warns in development. Wrap the `Control` in a `Field` instead, and set the
|
|
14
|
+
* `label`, `horizontal` and class name on that `Field`.
|
|
10
15
|
* @extraProp {string} [name] - Form field name.
|
|
11
16
|
* @extraProp {string} [form] - Optional id of the form the input belongs to.
|
|
12
17
|
* @extraProp {boolean} [required=false] - Marks the field as required for native HTML form validation.
|
|
@@ -43,11 +48,21 @@ export interface DateTimeInputProps extends DateTimeInputBaseProps {
|
|
|
43
48
|
/** Force the right icon container. */
|
|
44
49
|
hasIconsRight?: boolean;
|
|
45
50
|
/**
|
|
46
|
-
* Shows a loading spinner on the `Control` it renders
|
|
51
|
+
* Shows a loading spinner on the `Control` it renders, and hides the
|
|
52
|
+
* launcher (`triggerIcon`) while it does. Inside your own `Control` it
|
|
53
|
+
* renders none, so this draws nothing; set `isLoading` on that `Control`.
|
|
47
54
|
* Under `prefers-reduced-motion: reduce` the spinner stops and stays
|
|
48
55
|
* drawn (with bestax's CSS loaded).
|
|
49
56
|
*/
|
|
50
57
|
isLoading?: boolean;
|
|
58
|
+
/**
|
|
59
|
+
* Show a clickable launcher button on the right that toggles the popover.
|
|
60
|
+
* Hidden by default while a spinner shows at the same right edge: this
|
|
61
|
+
* component's `isLoading` when it renders its own `Control`, or the
|
|
62
|
+
* enclosing `Control`'s `isLoading` inside one.
|
|
63
|
+
* @defaultValue true
|
|
64
|
+
*/
|
|
65
|
+
triggerIcon?: boolean;
|
|
51
66
|
/** Expand the control to fill its container. */
|
|
52
67
|
isExpanded?: boolean;
|
|
53
68
|
/** Size of the wrapping Control. */
|
|
@@ -18,7 +18,12 @@ export interface DateTimeInputBaseProps extends Omit<React.InputHTMLAttributes<H
|
|
|
18
18
|
onOpen?: () => void;
|
|
19
19
|
/** Fired when the popover closes. */
|
|
20
20
|
onClose?: () => void;
|
|
21
|
-
/**
|
|
21
|
+
/**
|
|
22
|
+
* Lower bound for the combined date-time. A `min` before year 1 is raised
|
|
23
|
+
* to midnight on 1 January of year 1, where the range starts without one
|
|
24
|
+
* too: HTML's datetime-local input holds no earlier year, so the calendar,
|
|
25
|
+
* the time wheels and typing stop there.
|
|
26
|
+
*/
|
|
22
27
|
min?: Date;
|
|
23
28
|
/** Upper bound for the combined date-time. */
|
|
24
29
|
max?: Date;
|
|
@@ -33,7 +38,11 @@ export interface DateTimeInputBaseProps extends Omit<React.InputHTMLAttributes<H
|
|
|
33
38
|
* @defaultValue 'YYYY-MM-DD HH:mm'
|
|
34
39
|
*/
|
|
35
40
|
format?: DateFormatOption;
|
|
36
|
-
/**
|
|
41
|
+
/**
|
|
42
|
+
* Custom parser. Enter and leaving the field call it only if the user
|
|
43
|
+
* changed the text, so focus passing through commits nothing and the value
|
|
44
|
+
* keeps what the format leaves out, such as seconds.
|
|
45
|
+
*/
|
|
37
46
|
parse?: (s: string) => Date | null;
|
|
38
47
|
/** BCP-47 locale tag. */
|
|
39
48
|
locale?: string;
|
|
@@ -102,7 +111,12 @@ export interface DateTimeInputBaseProps extends Omit<React.InputHTMLAttributes<H
|
|
|
102
111
|
unselectableTimes?: (d: Date) => boolean;
|
|
103
112
|
/** Decorative left icon glyph for the wrapping `Control` (shown by default). Set `''` to hide. */
|
|
104
113
|
iconLeftName?: string;
|
|
105
|
-
/**
|
|
114
|
+
/**
|
|
115
|
+
* Show a clickable launcher button on the right that toggles the popover.
|
|
116
|
+
* Hidden by default while a `Control` it sits in shows its `isLoading`
|
|
117
|
+
* spinner, which shares that right edge.
|
|
118
|
+
* @defaultValue true
|
|
119
|
+
*/
|
|
106
120
|
triggerIcon?: boolean;
|
|
107
121
|
/** Glyph for the right launcher button. */
|
|
108
122
|
triggerIconName?: string;
|
|
@@ -3,6 +3,12 @@ import { BulmaClassesProps } from '../helpers/useBulmaClasses.js';
|
|
|
3
3
|
import { FormFieldProps } from './fieldProps.js';
|
|
4
4
|
/**
|
|
5
5
|
* Props for the File component.
|
|
6
|
+
* Inside an outer `Field`, or a `Control` with no `Field` around it, it
|
|
7
|
+
* renders no `Field` of its own. The exception is `label`, `message`,
|
|
8
|
+
* `horizontal` or `fieldClassName` in that bare `Control`: it keeps a `Field`
|
|
9
|
+
* for them, nested in the `.control`, and warns in development. Wrap the
|
|
10
|
+
* `Control` in a `Field` instead, and set the `label`, `horizontal` and class
|
|
11
|
+
* name on that `Field`.
|
|
6
12
|
*/
|
|
7
13
|
export interface FileProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, 'size' | 'color' | 'type'>, Omit<BulmaClassesProps, 'color'>, FormFieldProps {
|
|
8
14
|
/** 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). */
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import React from 'react';
|
|
1
2
|
/**
|
|
2
3
|
* Hook to detect if the component is inside a Field wrapper.
|
|
3
4
|
* Form components use this to skip rendering their own Field.
|
|
@@ -9,9 +10,39 @@ export declare const useInsideField: () => boolean;
|
|
|
9
10
|
*/
|
|
10
11
|
export declare const useInsideControl: () => boolean;
|
|
11
12
|
/** Provider for Field context — used internally by Field component. */
|
|
12
|
-
export declare const FieldProvider:
|
|
13
|
+
export declare const FieldProvider: React.Provider<boolean>;
|
|
13
14
|
/** Provider for Control context — used internally by Control component. */
|
|
14
|
-
export declare const ControlProvider:
|
|
15
|
+
export declare const ControlProvider: React.Provider<boolean>;
|
|
16
|
+
/** The wrapper props that change what its own `Field` renders. */
|
|
17
|
+
interface FieldShapingProps {
|
|
18
|
+
/** Rendered as the `Field`'s label. */
|
|
19
|
+
label?: React.ReactNode;
|
|
20
|
+
/** Rendered as help text after the widget. */
|
|
21
|
+
message?: React.ReactNode;
|
|
22
|
+
/** Lays the `Field` out horizontally. */
|
|
23
|
+
horizontal?: boolean;
|
|
24
|
+
/** Set on the `Field` as its class. */
|
|
25
|
+
fieldClassName?: string;
|
|
26
|
+
}
|
|
27
|
+
interface OwnFieldOptions extends FieldShapingProps {
|
|
28
|
+
/** `useInsideField()` as the wrapper read it. */
|
|
29
|
+
insideField: boolean;
|
|
30
|
+
/** `useInsideControl()` as the wrapper read it. */
|
|
31
|
+
insideControl: boolean;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Whether a convenience form wrapper renders a `Field` of its own (#905).
|
|
35
|
+
* Never inside an outer `Field`. Inside a `Control` with no `Field` around
|
|
36
|
+
* it, a `Field` of its own would put a `.field` inside the `.control`, where
|
|
37
|
+
* Bulma's control styles break (its icon rules are sibling selectors on the
|
|
38
|
+
* input). So it renders one there only when a prop that shapes the `Field`'s
|
|
39
|
+
* markup is set (`label`, `message`, `horizontal`, `fieldClassName`), keeping
|
|
40
|
+
* the markup it always had, and warns in development that the fix is a
|
|
41
|
+
* `Field` around that `Control`. A prop counts when it is truthy, the same
|
|
42
|
+
* test that decides whether it changes the `Field`'s output.
|
|
43
|
+
* Internal; not part of the public API.
|
|
44
|
+
*/
|
|
45
|
+
export declare const rendersOwnField: (component: string, options: OwnFieldOptions) => boolean;
|
|
15
46
|
/**
|
|
16
47
|
* The id a labeled Field wants its single composed control to adopt (#495).
|
|
17
48
|
* `undefined` outside a Field, in unlabeled/grouped/addons Fields, or when the
|
|
@@ -21,7 +52,7 @@ export declare const ControlProvider: import("react").Provider<boolean>;
|
|
|
21
52
|
*/
|
|
22
53
|
export declare const useFieldLabelId: () => string | undefined;
|
|
23
54
|
/** Provider for the Field label-target id — used internally by Field. */
|
|
24
|
-
export declare const FieldLabelIdProvider:
|
|
55
|
+
export declare const FieldLabelIdProvider: React.Provider<string | undefined>;
|
|
25
56
|
/**
|
|
26
57
|
* Shape of the Radios group context. The group provides:
|
|
27
58
|
* - `name`: shared form field name (Stage 1)
|
|
@@ -69,10 +100,11 @@ export declare const useRadiosName: () => string | undefined;
|
|
|
69
100
|
*/
|
|
70
101
|
export declare const useCheckboxesName: () => string | undefined;
|
|
71
102
|
/** Provider for the Radios group context — used internally by Radios. */
|
|
72
|
-
export declare const RadiosProvider:
|
|
103
|
+
export declare const RadiosProvider: React.Provider<RadiosGroupContextValue | undefined>;
|
|
73
104
|
/** Provider for the Checkboxes group context — used internally by Checkboxes. */
|
|
74
|
-
export declare const CheckboxesProvider:
|
|
105
|
+
export declare const CheckboxesProvider: React.Provider<CheckboxesGroupContextValue | undefined>;
|
|
75
106
|
/** @deprecated Use `RadiosProvider` (provides {name, value, onChange}). */
|
|
76
|
-
export declare const RadiosNameProvider:
|
|
107
|
+
export declare const RadiosNameProvider: React.Provider<RadiosGroupContextValue | undefined>;
|
|
77
108
|
/** @deprecated Use `CheckboxesProvider` (provides {name, value, onChange}). */
|
|
78
|
-
export declare const CheckboxesNameProvider:
|
|
109
|
+
export declare const CheckboxesNameProvider: React.Provider<CheckboxesGroupContextValue | undefined>;
|
|
110
|
+
export {};
|
|
@@ -8,8 +8,13 @@ import { InputBaseProps } from './InputBase.js';
|
|
|
8
8
|
* Composes Field, Control, and Input into a single convenience component.
|
|
9
9
|
* Supports all Input props, plus Field-level (label, horizontal) and
|
|
10
10
|
* Control-level (icons, loading) props.
|
|
11
|
-
* Inside an existing `Control`
|
|
12
|
-
*
|
|
11
|
+
* Inside an existing `Control` it renders no `Control` of its own, so set the
|
|
12
|
+
* Control-level props on that `Control` instead. Inside an outer `Field`, or a
|
|
13
|
+
* `Control` with no `Field` around it, it renders no `Field` of its own either.
|
|
14
|
+
* The exception is `label`, `message`, `horizontal` or `fieldClassName` in that
|
|
15
|
+
* bare `Control`: it keeps a `Field` for them, nested in the `.control`, and
|
|
16
|
+
* warns in development. Wrap the `Control` in a `Field` instead, and set the
|
|
17
|
+
* `label`, `horizontal` and class name on that `Field`.
|
|
13
18
|
*/
|
|
14
19
|
export interface InputProps extends InputBaseProps {
|
|
15
20
|
/** 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`). */
|
|
@@ -3,6 +3,13 @@ import { BulmaClassesProps } from '../helpers/useBulmaClasses.js';
|
|
|
3
3
|
import { FormFieldProps } from './fieldProps.js';
|
|
4
4
|
/**
|
|
5
5
|
* Props for the Radios component.
|
|
6
|
+
* Inside an existing `Control` it renders no `Control` of its own. Inside an
|
|
7
|
+
* outer `Field`, or a `Control` with no `Field` around it, it renders no
|
|
8
|
+
* `Field` of its own either. The exception is `label`, `message`, `horizontal`
|
|
9
|
+
* or `fieldClassName` in that bare `Control`: it keeps a `Field` for them,
|
|
10
|
+
* nested in the `.control`, and warns in development. Wrap the `Control` in a
|
|
11
|
+
* `Field` instead, and set the `label`, `horizontal` and class name on that
|
|
12
|
+
* `Field`.
|
|
6
13
|
*/
|
|
7
14
|
export interface RadiosProps extends Omit<BulmaClassesProps, 'color'>, FormFieldProps {
|
|
8
15
|
/** 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). */
|
|
@@ -22,6 +22,13 @@ export interface RateIconProps {
|
|
|
22
22
|
}
|
|
23
23
|
/**
|
|
24
24
|
* Props for the Rate component.
|
|
25
|
+
* Inside an existing `Control` it renders no `Control` of its own. Inside an
|
|
26
|
+
* outer `Field`, or a `Control` with no `Field` around it, it renders no
|
|
27
|
+
* `Field` of its own either. The exception is `label`, `message`, `horizontal`
|
|
28
|
+
* or `fieldClassName` in that bare `Control`: it keeps a `Field` for them,
|
|
29
|
+
* nested in the `.control`, and warns in development. Wrap the `Control` in a
|
|
30
|
+
* `Field` instead, and set the `label`, `horizontal` and class name on that
|
|
31
|
+
* `Field`.
|
|
25
32
|
* @extraProp {string} [className] - Additional CSS classes.
|
|
26
33
|
* @extraProp {React.Ref<HTMLElement>} [ref] - Ref forwarded to the container element.
|
|
27
34
|
*/
|
|
@@ -8,8 +8,13 @@ import { SelectBaseProps } from './SelectBase.js';
|
|
|
8
8
|
* Composes Field, Control, and SelectBase into a single convenience component.
|
|
9
9
|
* Supports all SelectBase props, plus Field-level (label, horizontal) and
|
|
10
10
|
* Control-level (icons) props.
|
|
11
|
-
* Inside an existing `Control`
|
|
12
|
-
*
|
|
11
|
+
* Inside an existing `Control` it renders no `Control` of its own, so set the
|
|
12
|
+
* Control-level props on that `Control` instead. Inside an outer `Field`, or a
|
|
13
|
+
* `Control` with no `Field` around it, it renders no `Field` of its own either.
|
|
14
|
+
* The exception is `label`, `message`, `horizontal` or `fieldClassName` in that
|
|
15
|
+
* bare `Control`: it keeps a `Field` for them, nested in the `.control`, and
|
|
16
|
+
* warns in development. Wrap the `Control` in a `Field` instead, and set the
|
|
17
|
+
* `label`, `horizontal` and class name on that `Field`.
|
|
13
18
|
*/
|
|
14
19
|
export interface SelectProps extends SelectBaseProps {
|
|
15
20
|
/** 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`). */
|
|
@@ -117,6 +117,13 @@ export interface SliderRangeProps extends SliderBaseProps {
|
|
|
117
117
|
}
|
|
118
118
|
/**
|
|
119
119
|
* Props for the Slider component — a discriminated union of single and range modes.
|
|
120
|
+
* Inside an existing `Control` it renders no `Control` of its own. Inside an
|
|
121
|
+
* outer `Field`, or a `Control` with no `Field` around it, it renders no
|
|
122
|
+
* `Field` of its own either. The exception is `label`, `message`, `horizontal`
|
|
123
|
+
* or `fieldClassName` in that bare `Control`: it keeps a `Field` for them,
|
|
124
|
+
* nested in the `.control`, and warns in development. Wrap the `Control` in a
|
|
125
|
+
* `Field` instead, and set the `label`, `horizontal` and class name on that
|
|
126
|
+
* `Field`.
|
|
120
127
|
* @extraProp {boolean} [disabled=false] - Whether the slider is disabled.
|
|
121
128
|
* @extraProp {string} [className] - Additional CSS classes.
|
|
122
129
|
* @extraProp {React.Ref<HTMLElement>} [ref] - Ref forwarded to the input element.
|
|
@@ -16,6 +16,12 @@ export type TaginputTag = TaginputItem | string;
|
|
|
16
16
|
type IconLibrary = 'fa' | 'mdi' | 'ion' | 'material-icons' | 'material-symbols';
|
|
17
17
|
/**
|
|
18
18
|
* Props for the Taginput component.
|
|
19
|
+
* Inside an outer `Field`, or a `Control` with no `Field` around it, it
|
|
20
|
+
* renders no `Field` of its own. The exception is `label`, `message`,
|
|
21
|
+
* `horizontal` or `fieldClassName` in that bare `Control`: it keeps a `Field`
|
|
22
|
+
* for them, nested in the `.control`, and warns in development. Wrap the
|
|
23
|
+
* `Control` in a `Field` instead, and set the `label`, `horizontal` and class
|
|
24
|
+
* name on that `Field`.
|
|
19
25
|
* @extraProp {string} [className] - Additional CSS classes.
|
|
20
26
|
* @extraProp {React.Ref<HTMLInputElement>} [ref] - Ref forwarded to the input element.
|
|
21
27
|
*/
|
|
@@ -8,8 +8,13 @@ import { TextAreaBaseProps } from './TextAreaBase.js';
|
|
|
8
8
|
* Composes Field, Control, and TextAreaBase into a single convenience component.
|
|
9
9
|
* Supports all TextAreaBase props, plus Field-level (label, horizontal) and
|
|
10
10
|
* Control-level (loading) props.
|
|
11
|
-
* Inside an existing `Control`
|
|
12
|
-
*
|
|
11
|
+
* Inside an existing `Control` it renders no `Control` of its own, so set the
|
|
12
|
+
* Control-level props on that `Control` instead. Inside an outer `Field`, or a
|
|
13
|
+
* `Control` with no `Field` around it, it renders no `Field` of its own either.
|
|
14
|
+
* The exception is `label`, `message`, `horizontal` or `fieldClassName` in that
|
|
15
|
+
* bare `Control`: it keeps a `Field` for them, nested in the `.control`, and
|
|
16
|
+
* warns in development. Wrap the `Control` in a `Field` instead, and set the
|
|
17
|
+
* `label`, `horizontal` and class name on that `Field`.
|
|
13
18
|
*/
|
|
14
19
|
export interface TextAreaProps extends TextAreaBaseProps {
|
|
15
20
|
/** 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`). */
|
|
@@ -5,8 +5,13 @@ import { TimeInputBaseProps } from './TimeInputBase.js';
|
|
|
5
5
|
/**
|
|
6
6
|
* Props for the TimeInput convenience wrapper. Extends `TimeInputBaseProps`
|
|
7
7
|
* with Field-level (label, horizontal) and Control-level (icons, loading) props.
|
|
8
|
-
* Inside an existing `Control`
|
|
9
|
-
*
|
|
8
|
+
* Inside an existing `Control` it renders no `Control` of its own, so set the
|
|
9
|
+
* Control-level props on that `Control` instead. Inside an outer `Field`, or a
|
|
10
|
+
* `Control` with no `Field` around it, it renders no `Field` of its own either.
|
|
11
|
+
* The exception is `label`, `message`, `horizontal` or `fieldClassName` in that
|
|
12
|
+
* bare `Control`: it keeps a `Field` for them, nested in the `.control`, and
|
|
13
|
+
* warns in development. Wrap the `Control` in a `Field` instead, and set the
|
|
14
|
+
* `label`, `horizontal` and class name on that `Field`.
|
|
10
15
|
* @extraProp {string} [name] - Form field name.
|
|
11
16
|
* @extraProp {string} [form] - Form id the input belongs to.
|
|
12
17
|
* @extraProp {boolean} [required=false] - Marks the input as required.
|
|
@@ -45,11 +50,21 @@ export interface TimeInputProps extends TimeInputBaseProps {
|
|
|
45
50
|
/** Force the right icon container. */
|
|
46
51
|
hasIconsRight?: boolean;
|
|
47
52
|
/**
|
|
48
|
-
* Shows a loading spinner on the `Control` it renders
|
|
53
|
+
* Shows a loading spinner on the `Control` it renders, and hides the
|
|
54
|
+
* launcher (`triggerIcon`) while it does. Inside your own `Control` it
|
|
55
|
+
* renders none, so this draws nothing; set `isLoading` on that `Control`.
|
|
49
56
|
* Under `prefers-reduced-motion: reduce` the spinner stops and stays
|
|
50
57
|
* drawn (with bestax's CSS loaded).
|
|
51
58
|
*/
|
|
52
59
|
isLoading?: boolean;
|
|
60
|
+
/**
|
|
61
|
+
* Show a clickable launcher button on the right that toggles the popover.
|
|
62
|
+
* Hidden by default while a spinner shows at the same right edge: this
|
|
63
|
+
* component's `isLoading` when it renders its own `Control`, or the
|
|
64
|
+
* enclosing `Control`'s `isLoading` inside one.
|
|
65
|
+
* @defaultValue true
|
|
66
|
+
*/
|
|
67
|
+
triggerIcon?: boolean;
|
|
53
68
|
/** Expand the control to fill its container. */
|
|
54
69
|
isExpanded?: boolean;
|
|
55
70
|
/** Size of the wrapping Control. */
|
|
@@ -17,7 +17,11 @@ export interface TimeInputBaseProps extends Omit<React.InputHTMLAttributes<HTMLI
|
|
|
17
17
|
onOpen?: () => void;
|
|
18
18
|
/** Fired when the popover closes. */
|
|
19
19
|
onClose?: () => void;
|
|
20
|
-
/**
|
|
20
|
+
/**
|
|
21
|
+
* Earliest selectable time. A `min` before year 1 is raised to midnight on
|
|
22
|
+
* 1 January of year 1, and a `value` dated before then is out of range, so
|
|
23
|
+
* the wheels and typing change nothing on it, as in the date pickers.
|
|
24
|
+
*/
|
|
21
25
|
min?: Date;
|
|
22
26
|
/** Latest selectable time. */
|
|
23
27
|
max?: Date;
|
|
@@ -32,7 +36,11 @@ export interface TimeInputBaseProps extends Omit<React.InputHTMLAttributes<HTMLI
|
|
|
32
36
|
* @defaultValue (see below)
|
|
33
37
|
*/
|
|
34
38
|
format?: DateFormatOption;
|
|
35
|
-
/**
|
|
39
|
+
/**
|
|
40
|
+
* Custom parser. Enter and leaving the field call it only if the user
|
|
41
|
+
* changed the text, so focus passing through commits nothing and the value
|
|
42
|
+
* keeps what the format leaves out, such as seconds and the date.
|
|
43
|
+
*/
|
|
36
44
|
parse?: (s: string) => Date | null;
|
|
37
45
|
/** BCP-47 locale tag for Intl formatting. */
|
|
38
46
|
locale?: string;
|
|
@@ -87,7 +95,12 @@ export interface TimeInputBaseProps extends Omit<React.InputHTMLAttributes<HTMLI
|
|
|
87
95
|
unselectableTimes?: (d: Date) => boolean;
|
|
88
96
|
/** Decorative left icon glyph for the wrapping `Control` (shown by default). Set `''` to hide. */
|
|
89
97
|
iconLeftName?: string;
|
|
90
|
-
/**
|
|
98
|
+
/**
|
|
99
|
+
* Show a clickable launcher button on the right that toggles the popover.
|
|
100
|
+
* Hidden by default while a `Control` it sits in shows its `isLoading`
|
|
101
|
+
* spinner, which shares that right edge.
|
|
102
|
+
* @defaultValue true
|
|
103
|
+
*/
|
|
91
104
|
triggerIcon?: boolean;
|
|
92
105
|
/** Glyph for the right launcher button. */
|
|
93
106
|
triggerIconName?: string;
|
|
@@ -5,6 +5,10 @@ export interface CalendarProps {
|
|
|
5
5
|
focusedDate: Date;
|
|
6
6
|
onSelect: (d: Date) => void;
|
|
7
7
|
onFocusedDateChange: (d: Date) => void;
|
|
8
|
+
/**
|
|
9
|
+
* Earliest selectable date. One before year 1, or none, counts as the start
|
|
10
|
+
* of year 1.
|
|
11
|
+
*/
|
|
8
12
|
min?: Date;
|
|
9
13
|
max?: Date;
|
|
10
14
|
shouldDisableDate?: (d: Date) => boolean;
|
|
@@ -28,7 +32,8 @@ export interface CalendarProps {
|
|
|
28
32
|
labels?: PickerLabels;
|
|
29
33
|
/**
|
|
30
34
|
* Inclusive `[min, max]` year range shown in the year-dropdown view.
|
|
31
|
-
* Defaults to ±100 years around the focused year, clamped by `min`/`max
|
|
35
|
+
* Defaults to ±100 years around the focused year, clamped by `min`/`max`
|
|
36
|
+
* and never reaching below year 1.
|
|
32
37
|
* At `'year'` granularity the window centres on the year focused when the
|
|
33
38
|
* calendar mounted, so moving focus never reflows the list.
|
|
34
39
|
*/
|
|
@@ -44,8 +49,9 @@ export interface CalendarProps {
|
|
|
44
49
|
}
|
|
45
50
|
/**
|
|
46
51
|
* Selects the calendar's focused cell, the one tab stop of whichever grid or
|
|
47
|
-
* year list is on show, for a popover to put focus on as it opens.
|
|
52
|
+
* year list is on show, for a popover to put focus on as it opens. It runs
|
|
53
|
+
* against the whole panel, so it matches only inside the grid or the list.
|
|
48
54
|
*/
|
|
49
|
-
export declare const CALENDAR_FOCUSED_CELL = "[data-focused=\"true\"], [data-focused-year=\"true\"]";
|
|
55
|
+
export declare const CALENDAR_FOCUSED_CELL = "[role=\"grid\"] [data-focused=\"true\"], [role=\"listbox\"] [data-focused-year=\"true\"]";
|
|
50
56
|
export declare const Calendar: React.FC<CalendarProps>;
|
|
51
57
|
export default Calendar;
|
|
@@ -19,6 +19,18 @@ export declare function endOfMonth(d: Date): Date;
|
|
|
19
19
|
* turning into 1900–1999.
|
|
20
20
|
*/
|
|
21
21
|
export declare function makeDate(year: number, month?: number, day?: number): Date;
|
|
22
|
+
/**
|
|
23
|
+
* The earliest year the pickers accept. HTML's date, month and datetime-local
|
|
24
|
+
* inputs hold no year below 1, so the calendar, typing and parsing stop there
|
|
25
|
+
* too.
|
|
26
|
+
*/
|
|
27
|
+
export declare const FIRST_YEAR = 1;
|
|
28
|
+
/**
|
|
29
|
+
* The lower bound a picker applies: `min`, raised to local midnight on
|
|
30
|
+
* 1 January of {@link FIRST_YEAR} when it is earlier or absent. A `min` in
|
|
31
|
+
* range comes back as the same object.
|
|
32
|
+
*/
|
|
33
|
+
export declare function floorMin(min?: Date): Date;
|
|
22
34
|
/**
|
|
23
35
|
* First instant of the day, month or year containing `d`. Works by setters on
|
|
24
36
|
* a copy rather than the `Date(y, m, d)` constructor, which reads years 0–99
|
|
@@ -64,6 +76,11 @@ export declare function getTimeOfDay(d: Date): {
|
|
|
64
76
|
minutes: number;
|
|
65
77
|
seconds: number;
|
|
66
78
|
};
|
|
79
|
+
/**
|
|
80
|
+
* A copy of `d` moved into `[min, max]`. When `min` is after `max` nothing is
|
|
81
|
+
* in range and `min` wins, so clamping twice gives the same date and a
|
|
82
|
+
* picker's focus stays off the years before 1 under a `max` before then.
|
|
83
|
+
*/
|
|
67
84
|
export declare function clampDate(d: Date, min?: Date, max?: Date): Date;
|
|
68
85
|
/**
|
|
69
86
|
* Snap a Date's time-of-day to the nearest grid defined by the given
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
/** Provider for the loading state, used internally by `Control`. */
|
|
2
|
+
export declare const ControlLoadingProvider: import("react").Provider<boolean>;
|
|
3
|
+
/** Whether the nearest enclosing `Control` is loading; `false` outside one. */
|
|
4
|
+
export declare const useControlLoading: () => boolean;
|
|
@@ -28,7 +28,10 @@ export interface UseAnchoredPositionOptions {
|
|
|
28
28
|
/**
|
|
29
29
|
* The gap between the anchor and the panel, in pixels, that the hook puts
|
|
30
30
|
* there itself: added to the fixed coordinates and to the room `auto` asks
|
|
31
|
-
* for below the anchor.
|
|
31
|
+
* for below the anchor. Popover and the pickers' popover pass `0` and take
|
|
32
|
+
* their gap from a margin in their stylesheet, read through `styledGap`, so
|
|
33
|
+
* a theme's offset moves the panel and `auto` alike. A new panel should do
|
|
34
|
+
* the same rather than rely on this default, which no stylesheet sees.
|
|
32
35
|
* @defaultValue 4
|
|
33
36
|
*/
|
|
34
37
|
offset?: number;
|
|
@@ -64,10 +64,17 @@ export interface UseFocusTrapOptions {
|
|
|
64
64
|
* container, or give them a trap of their own. To trap content a `Portal`
|
|
65
65
|
* renders, pass a ref to the element inside the `Portal` as `containerRef`.
|
|
66
66
|
*
|
|
67
|
-
* The
|
|
68
|
-
*
|
|
69
|
-
*
|
|
70
|
-
*
|
|
67
|
+
* The trap looks at `containerRef` again each time the component calling it
|
|
68
|
+
* renders. A container that mounts after the trap turns on, such as a panel
|
|
69
|
+
* waiting for a `Portal` target held in state, has it attach once that
|
|
70
|
+
* component renders with the container in the DOM. When the container leaves
|
|
71
|
+
* or is replaced, the trap lets go of it as it would turning off, handing
|
|
72
|
+
* focus back, and attaches to the next one.
|
|
73
|
+
* A child that mounts the container in a render of its own (from its own
|
|
74
|
+
* state, or as a `Suspense` boundary resolves) goes unseen until the
|
|
75
|
+
* component calling the hook renders again. The trap waits for hydration, so
|
|
76
|
+
* that component renders again when the page hydrates, and portaled content,
|
|
77
|
+
* which first appears then, is found.
|
|
71
78
|
*
|
|
72
79
|
* @function useFocusTrap
|
|
73
80
|
* @param containerRef - Ref to the element focus stays inside.
|
|
@@ -3,6 +3,13 @@ import { BulmaClassesProps } from '../helpers/useBulmaClasses.js';
|
|
|
3
3
|
import { FormFieldProps } from './fieldProps.js';
|
|
4
4
|
/**
|
|
5
5
|
* Props for the Checkboxes component.
|
|
6
|
+
* Inside an existing `Control` it renders no `Control` of its own. Inside an
|
|
7
|
+
* outer `Field`, or a `Control` with no `Field` around it, it renders no
|
|
8
|
+
* `Field` of its own either. The exception is `label`, `message`, `horizontal`
|
|
9
|
+
* or `fieldClassName` in that bare `Control`: it keeps a `Field` for them,
|
|
10
|
+
* nested in the `.control`, and warns in development. Wrap the `Control` in a
|
|
11
|
+
* `Field` instead, and set the `label`, `horizontal` and class name on that
|
|
12
|
+
* `Field`.
|
|
6
13
|
*/
|
|
7
14
|
export interface CheckboxesProps extends Omit<BulmaClassesProps, 'color'>, FormFieldProps {
|
|
8
15
|
/** 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). */
|
|
@@ -5,8 +5,13 @@ import { DateInputBaseProps } from './DateInputBase.js';
|
|
|
5
5
|
/**
|
|
6
6
|
* Props for the DateInput convenience wrapper. Extends `DateInputBaseProps`
|
|
7
7
|
* with Field-level (label, horizontal) and Control-level (icons, loading) props.
|
|
8
|
-
* Inside an existing `Control`
|
|
9
|
-
*
|
|
8
|
+
* Inside an existing `Control` it renders no `Control` of its own, so set the
|
|
9
|
+
* Control-level props on that `Control` instead. Inside an outer `Field`, or a
|
|
10
|
+
* `Control` with no `Field` around it, it renders no `Field` of its own either.
|
|
11
|
+
* The exception is `label`, `message`, `horizontal` or `fieldClassName` in that
|
|
12
|
+
* bare `Control`: it keeps a `Field` for them, nested in the `.control`, and
|
|
13
|
+
* warns in development. Wrap the `Control` in a `Field` instead, and set the
|
|
14
|
+
* `label`, `horizontal` and class name on that `Field`.
|
|
10
15
|
* @extraProp {string} [name] - Form field name. The text field submits the text it displays. The native input on touch devices submits the ISO value (`YYYY-MM-DD`, or `YYYY-MM` at month granularity), and an `inline` calendar, which has no visible input, submits it from a hidden input (`YYYY-MM-DD`, `YYYY-MM` or `YYYY`).
|
|
11
16
|
* @extraProp {string} [form] - Form id the input belongs to.
|
|
12
17
|
* @extraProp {boolean} [required=false] - Marks the input as required.
|
|
@@ -45,11 +50,21 @@ export interface DateInputProps extends DateInputBaseProps {
|
|
|
45
50
|
/** Force the right icon container. */
|
|
46
51
|
hasIconsRight?: boolean;
|
|
47
52
|
/**
|
|
48
|
-
* Shows a loading spinner on the `Control` it renders
|
|
53
|
+
* Shows a loading spinner on the `Control` it renders, and hides the
|
|
54
|
+
* launcher (`triggerIcon`) while it does. Inside your own `Control` it
|
|
55
|
+
* renders none, so this draws nothing; set `isLoading` on that `Control`.
|
|
49
56
|
* Under `prefers-reduced-motion: reduce` the spinner stops and stays
|
|
50
57
|
* drawn (with bestax's CSS loaded).
|
|
51
58
|
*/
|
|
52
59
|
isLoading?: boolean;
|
|
60
|
+
/**
|
|
61
|
+
* Show a clickable launcher button on the right that toggles the popover.
|
|
62
|
+
* Hidden by default while a spinner shows at the same right edge: this
|
|
63
|
+
* component's `isLoading` when it renders its own `Control`, or the
|
|
64
|
+
* enclosing `Control`'s `isLoading` inside one.
|
|
65
|
+
* @defaultValue true
|
|
66
|
+
*/
|
|
67
|
+
triggerIcon?: boolean;
|
|
53
68
|
/** Expand the control to fill its container. */
|
|
54
69
|
isExpanded?: boolean;
|
|
55
70
|
/** Size of the wrapping Control. */
|