@allxsmith/bestax-bulma 5.7.0 → 5.8.1
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/AGENTS.md +28 -0
- package/CLAUDE.md +28 -0
- package/README.md +24 -0
- package/dist/index.cjs.js +3485 -55
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +3485 -55
- package/dist/index.esm.js.map +1 -1
- package/dist/types/columns/Column.d.ts +38 -0
- package/dist/types/columns/Columns.d.ts +31 -0
- package/dist/types/components/Avatar.d.ts +32 -0
- package/dist/types/components/Avatars.d.ts +12 -0
- package/dist/types/components/Badge.d.ts +34 -0
- package/dist/types/components/Breadcrumb.d.ts +25 -0
- package/dist/types/components/Card.d.ts +60 -0
- package/dist/types/components/Carousel.d.ts +70 -0
- package/dist/types/components/Collapse.d.ts +52 -0
- package/dist/types/components/Dialog.d.ts +89 -0
- package/dist/types/components/Dropdown.d.ts +42 -0
- package/dist/types/components/Loading.d.ts +50 -0
- package/dist/types/components/Menu.d.ts +44 -0
- package/dist/types/components/Message.d.ts +20 -0
- package/dist/types/components/Modal.d.ts +50 -0
- package/dist/types/components/Navbar.d.ts +147 -0
- package/dist/types/components/Pagination.d.ts +81 -0
- package/dist/types/components/Panel.d.ts +93 -0
- package/dist/types/components/Reveal.d.ts +37 -0
- package/dist/types/components/Sidebar.d.ts +37 -0
- package/dist/types/components/Steps.d.ts +56 -0
- package/dist/types/components/Tabs.d.ts +90 -0
- package/dist/types/components/Toast.d.ts +104 -0
- package/dist/types/components/Tooltip.d.ts +46 -0
- package/dist/types/elements/Block.d.ts +21 -0
- package/dist/types/elements/Box.d.ts +25 -1
- package/dist/types/elements/Button.d.ts +33 -0
- package/dist/types/elements/Buttons.d.ts +16 -0
- package/dist/types/elements/Code.d.ts +14 -0
- package/dist/types/elements/Content.d.ts +22 -0
- package/dist/types/elements/Delete.d.ts +24 -0
- package/dist/types/elements/Divider.d.ts +12 -0
- package/dist/types/elements/Emphasis.d.ts +14 -0
- package/dist/types/elements/Figure.d.ts +23 -0
- package/dist/types/elements/Icon.d.ts +28 -0
- package/dist/types/elements/IconText.d.ts +20 -0
- package/dist/types/elements/Image.d.ts +27 -0
- package/dist/types/elements/Link.d.ts +20 -0
- package/dist/types/elements/LinkButton.d.ts +20 -0
- package/dist/types/elements/ListItem.d.ts +15 -0
- package/dist/types/elements/Notification.d.ts +110 -0
- package/dist/types/elements/OrderedList.d.ts +10 -0
- package/dist/types/elements/Paragraph.d.ts +14 -0
- package/dist/types/elements/Pre.d.ts +14 -0
- package/dist/types/elements/Progress.d.ts +26 -0
- package/dist/types/elements/Skeleton.d.ts +22 -0
- package/dist/types/elements/Span.d.ts +14 -0
- package/dist/types/elements/Strong.d.ts +14 -0
- package/dist/types/elements/SubTitle.d.ts +25 -0
- package/dist/types/elements/Table.d.ts +14 -0
- package/dist/types/elements/Tag.d.ts +25 -0
- package/dist/types/elements/Tags.d.ts +7 -0
- package/dist/types/elements/Tbody.d.ts +18 -0
- package/dist/types/elements/Td.d.ts +23 -0
- package/dist/types/elements/Tfoot.d.ts +18 -0
- package/dist/types/elements/Th.d.ts +24 -0
- package/dist/types/elements/Thead.d.ts +18 -0
- package/dist/types/elements/Title.d.ts +26 -0
- package/dist/types/elements/Tr.d.ts +20 -0
- package/dist/types/elements/UnorderedList.d.ts +7 -0
- package/dist/types/form/Autocomplete.d.ts +64 -0
- package/dist/types/form/Checkbox.d.ts +33 -0
- package/dist/types/form/Checkboxes.d.ts +9 -0
- package/dist/types/form/Control.d.ts +37 -0
- package/dist/types/form/DateInput.d.ts +44 -0
- package/dist/types/form/DateInputBase.d.ts +49 -0
- package/dist/types/form/DateTimeInput.d.ts +42 -0
- package/dist/types/form/DateTimeInputBase.d.ts +58 -0
- package/dist/types/form/Field.d.ts +52 -0
- package/dist/types/form/File.d.ts +24 -0
- package/dist/types/form/FormContext.d.ts +46 -0
- package/dist/types/form/Input.d.ts +45 -0
- package/dist/types/form/InputBase.d.ts +21 -0
- package/dist/types/form/Numberinput.d.ts +43 -0
- package/dist/types/form/Radio.d.ts +33 -0
- package/dist/types/form/Radios.d.ts +9 -0
- package/dist/types/form/Rate.d.ts +55 -0
- package/dist/types/form/Select.d.ts +35 -0
- package/dist/types/form/SelectBase.d.ts +24 -0
- package/dist/types/form/Slider.d.ts +86 -0
- package/dist/types/form/Switch.d.ts +50 -0
- package/dist/types/form/Taginput.d.ts +74 -0
- package/dist/types/form/TextArea.d.ts +34 -0
- package/dist/types/form/TextAreaBase.d.ts +24 -0
- package/dist/types/form/TimeInput.d.ts +40 -0
- package/dist/types/form/TimeInputBase.d.ts +51 -0
- package/dist/types/form/_pickerInternals/Calendar.d.ts +6 -0
- package/dist/types/form/_pickerInternals/TimeWheels.d.ts +13 -0
- package/dist/types/form/_pickerInternals/audioTick.d.ts +47 -0
- package/dist/types/form/_pickerInternals/dateUtils.d.ts +13 -0
- package/dist/types/form/_pickerInternals/formatters.d.ts +19 -0
- package/dist/types/form/_pickerInternals/haptics.d.ts +23 -0
- package/dist/types/form/_pickerInternals/pickerTypes.d.ts +8 -0
- package/dist/types/form/_pickerInternals/segmentMap.d.ts +48 -0
- package/dist/types/form/_pickerInternals/useNativeMobilePicker.d.ts +1 -0
- package/dist/types/form/_pickerInternals/useSegmentedEntry.d.ts +30 -0
- package/dist/types/form/fieldProps.d.ts +12 -0
- package/dist/types/grid/Cell.d.ts +25 -0
- package/dist/types/grid/Grid.d.ts +32 -0
- package/dist/types/helpers/Config.d.ts +50 -0
- package/dist/types/helpers/Theme.d.ts +66 -0
- package/dist/types/helpers/bulmaClassHelpers.d.ts +97 -0
- package/dist/types/helpers/classNames.d.ts +50 -0
- package/dist/types/helpers/colorDeprecations.d.ts +17 -0
- package/dist/types/helpers/useBulmaClasses.d.ts +22 -0
- package/dist/types/helpers/useColorClasses.d.ts +20 -0
- package/dist/types/helpers/useFlexboxClasses.d.ts +34 -0
- package/dist/types/helpers/useOtherClasses.d.ts +27 -0
- package/dist/types/helpers/useSpacingClasses.d.ts +27 -0
- package/dist/types/helpers/useTypographyClasses.d.ts +32 -0
- package/dist/types/helpers/useVisibilityClasses.d.ts +25 -0
- package/dist/types/helpers/withSubComponents.d.ts +13 -0
- package/dist/types/layout/Container.d.ts +29 -0
- package/dist/types/layout/Footer.d.ts +22 -0
- package/dist/types/layout/Hero.d.ts +67 -0
- package/dist/types/layout/Level.d.ts +60 -0
- package/dist/types/layout/Media.d.ts +56 -0
- package/dist/types/layout/Section.d.ts +20 -0
- package/dist/types/skill-examples/ExampleMeta.d.ts +5 -0
- package/dist/types/skill-examples/ProfileCard.d.ts +13 -0
- package/llms.txt +9 -0
- package/package.json +30 -28
|
@@ -1,54 +1,128 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { BulmaClassesProps } from '../helpers/useBulmaClasses';
|
|
3
3
|
import { FormFieldProps } from './fieldProps';
|
|
4
|
+
/**
|
|
5
|
+
* Represents a tag item object with a value and optional label.
|
|
6
|
+
*/
|
|
4
7
|
export interface TaginputItem {
|
|
8
|
+
/** The tag value. */
|
|
5
9
|
value: string;
|
|
10
|
+
/** Display label (optional). */
|
|
6
11
|
label?: string;
|
|
7
12
|
[key: string]: unknown;
|
|
8
13
|
}
|
|
14
|
+
/** A tag can be either a TaginputItem object or a plain string. */
|
|
9
15
|
export type TaginputTag = TaginputItem | string;
|
|
10
16
|
type IconLibrary = 'fa' | 'mdi' | 'ion' | 'material-icons' | 'material-symbols';
|
|
17
|
+
/**
|
|
18
|
+
* Props for the Taginput component.
|
|
19
|
+
* @extraProp {string} [className] - Additional CSS classes.
|
|
20
|
+
* @extraProp {React.Ref<HTMLElement>} [ref] - Ref forwarded to the input element.
|
|
21
|
+
*/
|
|
11
22
|
export interface TaginputProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'onChange' | 'defaultValue'>, Omit<BulmaClassesProps, 'color'>, FormFieldProps {
|
|
23
|
+
/** The current tags (controlled). */
|
|
12
24
|
value?: TaginputTag[];
|
|
25
|
+
/** Default tags (uncontrolled). */
|
|
13
26
|
defaultValue?: TaginputTag[];
|
|
27
|
+
/** Autocomplete suggestions. */
|
|
14
28
|
data?: string[];
|
|
29
|
+
/** Placeholder text when no tags. */
|
|
15
30
|
placeholder?: string;
|
|
31
|
+
/** Object property to use as display field. */
|
|
16
32
|
field?: string;
|
|
33
|
+
/** Allow creating new tags not in suggestions. */
|
|
17
34
|
allowNew?: boolean;
|
|
35
|
+
/** Allow duplicate tags. */
|
|
18
36
|
allowDuplicates?: boolean;
|
|
37
|
+
/** Open autocomplete dropdown on focus. */
|
|
19
38
|
openOnFocus?: boolean;
|
|
39
|
+
/** Remove tag on backspace. Default: true. */
|
|
20
40
|
removeOnKeys?: boolean;
|
|
41
|
+
/** Keys to confirm tag creation. Default: ['Enter', ',']. */
|
|
21
42
|
confirmKeys?: string[];
|
|
43
|
+
/** Show close button on tags. Default: true. */
|
|
22
44
|
closable?: boolean;
|
|
45
|
+
/** Attach tags visually. */
|
|
23
46
|
attached?: boolean;
|
|
47
|
+
/** Maximum number of tags allowed. */
|
|
24
48
|
maxTags?: number;
|
|
49
|
+
/** Maximum length of input. */
|
|
25
50
|
maxlength?: number;
|
|
51
|
+
/** Whether the input is disabled. */
|
|
26
52
|
disabled?: boolean;
|
|
53
|
+
/** Whether the input is read-only. */
|
|
27
54
|
readonly?: boolean;
|
|
55
|
+
/** Applies rounded corners to the tags. */
|
|
28
56
|
rounded?: boolean;
|
|
57
|
+
/** Truncates long tag text with ellipsis. */
|
|
29
58
|
ellipsis?: boolean;
|
|
59
|
+
/** Shows a counter of the number of tags. */
|
|
30
60
|
hasCounter?: boolean;
|
|
61
|
+
/** Characters that split pasted text into tags. */
|
|
31
62
|
onPasteSeparators?: string[];
|
|
63
|
+
/** Validation function called before adding a tag. */
|
|
32
64
|
beforeAdding?: (tag: string) => boolean;
|
|
65
|
+
/** Custom function for creating tag objects from input. */
|
|
33
66
|
createTag?: (input: string) => TaginputTag;
|
|
67
|
+
/** Keeps the first autocomplete suggestion highlighted. */
|
|
34
68
|
keepFirst?: boolean;
|
|
69
|
+
/** Keeps the autocomplete dropdown open after selection. */
|
|
35
70
|
keepOpen?: boolean;
|
|
71
|
+
/** Shows a loading indicator. */
|
|
36
72
|
loading?: boolean;
|
|
73
|
+
/** ARIA label for tag close buttons. */
|
|
37
74
|
ariaCloseLabel?: string;
|
|
75
|
+
/** Icon name for the input field. */
|
|
38
76
|
icon?: string;
|
|
77
|
+
/** Icon library to use. */
|
|
39
78
|
iconLibrary?: IconLibrary;
|
|
79
|
+
/** Icon style variant (e.g., 'solid', 'outlined'). */
|
|
40
80
|
iconVariant?: string;
|
|
81
|
+
/** Additional icon modifiers. */
|
|
41
82
|
iconFeatures?: string | string[];
|
|
83
|
+
/** Input color variant. */
|
|
42
84
|
color?: 'primary' | 'link' | 'info' | 'success' | 'warning' | 'danger';
|
|
85
|
+
/** Tag color variant. */
|
|
43
86
|
tagColor?: 'primary' | 'link' | 'info' | 'success' | 'warning' | 'danger' | 'dark' | 'light';
|
|
87
|
+
/** Size variant. */
|
|
44
88
|
size?: 'small' | 'medium' | 'large';
|
|
89
|
+
/** Form field name. When set, one hidden input per tag is rendered. */
|
|
45
90
|
name?: string;
|
|
91
|
+
/** Optional id of the form the hidden inputs belong to. */
|
|
46
92
|
form?: string;
|
|
93
|
+
/** Callback when tags change. */
|
|
47
94
|
onChange?: (tags: TaginputTag[]) => void;
|
|
95
|
+
/** Callback when tag is added. */
|
|
48
96
|
onAdd?: (tag: TaginputTag) => void;
|
|
97
|
+
/** Callback when tag is removed. */
|
|
49
98
|
onRemove?: (tag: TaginputTag, index: number) => void;
|
|
99
|
+
/** Callback when typing in input. */
|
|
50
100
|
onTyping?: (value: string) => void;
|
|
101
|
+
/** Custom render for tags. */
|
|
51
102
|
tagTemplate?: (tag: TaginputTag) => React.ReactNode;
|
|
52
103
|
}
|
|
104
|
+
/**
|
|
105
|
+
* The `Taginput` component provides a tag/chip input field for managing multiple tags.
|
|
106
|
+
*
|
|
107
|
+
* @function
|
|
108
|
+
* @param {TaginputProps} props - Props for the Taginput component.
|
|
109
|
+
* @param {React.Ref<HTMLInputElement>} ref - Forwarded ref to the input element.
|
|
110
|
+
* @returns {JSX.Element} The rendered taginput component.
|
|
111
|
+
*
|
|
112
|
+
* @example
|
|
113
|
+
* // Basic usage
|
|
114
|
+
* <Taginput
|
|
115
|
+
* placeholder="Add a tag..."
|
|
116
|
+
* onChange={(tags) => console.log(tags)}
|
|
117
|
+
* />
|
|
118
|
+
*
|
|
119
|
+
* @example
|
|
120
|
+
* // With autocomplete
|
|
121
|
+
* <Taginput
|
|
122
|
+
* data={['React', 'Vue', 'Angular', 'Svelte']}
|
|
123
|
+
* allowNew={false}
|
|
124
|
+
* placeholder="Select frameworks..."
|
|
125
|
+
* />
|
|
126
|
+
*/
|
|
53
127
|
export declare const Taginput: React.ForwardRefExoticComponent<TaginputProps & React.RefAttributes<HTMLInputElement>>;
|
|
54
128
|
export default Taginput;
|
|
@@ -2,17 +2,51 @@ import React from 'react';
|
|
|
2
2
|
import { FieldProps } from './Field';
|
|
3
3
|
import { ControlBaseProps } from './Control';
|
|
4
4
|
import { TextAreaBaseProps } from './TextAreaBase';
|
|
5
|
+
/**
|
|
6
|
+
* Props for the TextArea component.
|
|
7
|
+
*
|
|
8
|
+
* Composes Field, Control, and TextAreaBase into a single convenience component.
|
|
9
|
+
* Supports all TextAreaBase props, plus Field-level (label, horizontal) and
|
|
10
|
+
* Control-level (loading) props.
|
|
11
|
+
*/
|
|
5
12
|
export interface TextAreaProps extends TextAreaBaseProps {
|
|
13
|
+
/** Field label. */
|
|
6
14
|
label?: React.ReactNode;
|
|
15
|
+
/** Size for the label. */
|
|
7
16
|
labelSize?: FieldProps['labelSize'];
|
|
17
|
+
/** Props for the label element. */
|
|
8
18
|
labelProps?: FieldProps['labelProps'];
|
|
19
|
+
/** Horizontal field layout. */
|
|
9
20
|
horizontal?: boolean;
|
|
21
|
+
/** Shows loading indicator on the wrapping Control. */
|
|
10
22
|
isLoading?: boolean;
|
|
23
|
+
/** Control size. */
|
|
11
24
|
controlSize?: ControlBaseProps['size'];
|
|
25
|
+
/** Help/validation message below the textarea. */
|
|
12
26
|
message?: React.ReactNode;
|
|
27
|
+
/** Bulma color for the message. */
|
|
13
28
|
messageColor?: 'primary' | 'link' | 'info' | 'success' | 'warning' | 'danger';
|
|
29
|
+
/** Additional CSS classes for the Field. */
|
|
14
30
|
fieldClassName?: string;
|
|
31
|
+
/** Additional CSS classes for the Control. */
|
|
15
32
|
controlClassName?: string;
|
|
16
33
|
}
|
|
34
|
+
/**
|
|
35
|
+
* The `TextArea` component provides a Bulma-styled multi-line text input, supporting color, size, rounded corners, static/read-only state, hover/focus/loading states, fixed size, and all Bulma helper props.
|
|
36
|
+
*
|
|
37
|
+
* @function
|
|
38
|
+
* @param {TextAreaProps} props - Props for TextArea.
|
|
39
|
+
* @returns {JSX.Element} The composed field element.
|
|
40
|
+
*
|
|
41
|
+
* @example
|
|
42
|
+
* <TextArea label="Bio" placeholder="Tell us about yourself" rows={4} />
|
|
43
|
+
*
|
|
44
|
+
* @example
|
|
45
|
+
* <TextArea
|
|
46
|
+
* label="Comments"
|
|
47
|
+
* message="Max 500 characters"
|
|
48
|
+
* messageColor="info"
|
|
49
|
+
* />
|
|
50
|
+
*/
|
|
17
51
|
export declare const TextArea: React.ForwardRefExoticComponent<TextAreaProps & React.RefAttributes<HTMLTextAreaElement>>;
|
|
18
52
|
export default TextArea;
|
|
@@ -1,19 +1,43 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { BulmaClassesProps } from '../helpers/useBulmaClasses';
|
|
3
|
+
/**
|
|
4
|
+
* Props for the TextArea component.
|
|
5
|
+
*/
|
|
3
6
|
export interface TextAreaBaseProps extends Omit<React.TextareaHTMLAttributes<HTMLTextAreaElement>, 'size'>, Omit<BulmaClassesProps, 'color'> {
|
|
7
|
+
/** Bulma color modifier for the textarea. */
|
|
4
8
|
color?: 'primary' | 'link' | 'info' | 'success' | 'warning' | 'danger' | 'black' | 'dark' | 'light' | 'white';
|
|
9
|
+
/** Size modifier for the textarea. */
|
|
5
10
|
size?: 'small' | 'medium' | 'large';
|
|
11
|
+
/** Rounded textarea corners. */
|
|
6
12
|
isRounded?: boolean;
|
|
13
|
+
/** Renders textarea as static (styled readonly). */
|
|
7
14
|
isStatic?: boolean;
|
|
15
|
+
/** Applies hovered state. */
|
|
8
16
|
isHovered?: boolean;
|
|
17
|
+
/** Applies focused state. */
|
|
9
18
|
isFocused?: boolean;
|
|
19
|
+
/** Shows loading indicator on the wrapping Control. */
|
|
10
20
|
isLoading?: boolean;
|
|
21
|
+
/** Applies Bulma's is-active modifier. */
|
|
11
22
|
isActive?: boolean;
|
|
23
|
+
/** Fixed textarea size (no resize). */
|
|
12
24
|
hasFixedSize?: boolean;
|
|
25
|
+
/** Additional CSS classes to apply. */
|
|
13
26
|
className?: string;
|
|
27
|
+
/** Disables the textarea. */
|
|
14
28
|
disabled?: boolean;
|
|
29
|
+
/** Read-only textarea. */
|
|
15
30
|
readOnly?: boolean;
|
|
31
|
+
/** Number of visible text lines. */
|
|
16
32
|
rows?: number;
|
|
17
33
|
}
|
|
34
|
+
/**
|
|
35
|
+
* Bulma TextArea component with full Bulma helper class support.
|
|
36
|
+
*
|
|
37
|
+
* @function
|
|
38
|
+
* @param {TextAreaBaseProps} props - Props for the TextAreaBase component.
|
|
39
|
+
* @returns {JSX.Element} The rendered textarea element.
|
|
40
|
+
* @see {@link https://bulma.io/documentation/form/textarea/ | Bulma Textarea documentation}
|
|
41
|
+
*/
|
|
18
42
|
export declare const TextAreaBase: React.ForwardRefExoticComponent<TextAreaBaseProps & React.RefAttributes<HTMLTextAreaElement>>;
|
|
19
43
|
export default TextAreaBase;
|
|
@@ -2,25 +2,65 @@ import React from 'react';
|
|
|
2
2
|
import { FieldProps } from './Field';
|
|
3
3
|
import { ControlBaseProps } from './Control';
|
|
4
4
|
import { TimeInputBaseProps } from './TimeInputBase';
|
|
5
|
+
/**
|
|
6
|
+
* Props for the TimeInput convenience wrapper. Extends `TimeInputBaseProps`
|
|
7
|
+
* with Field-level (label, horizontal) and Control-level (icons, loading) props.
|
|
8
|
+
* @extraProp {string} [name] - Form field name.
|
|
9
|
+
* @extraProp {string} [form] - Form id the input belongs to.
|
|
10
|
+
* @extraProp {boolean} [required=false] - Marks the input as required.
|
|
11
|
+
* @extraProp {string} [className] - Additional CSS classes for the input.
|
|
12
|
+
* @extraProp {React.Ref<HTMLInputElement>} [ref] - Forwarded to the underlying `<input>`.
|
|
13
|
+
*/
|
|
5
14
|
export interface TimeInputProps extends TimeInputBaseProps {
|
|
15
|
+
/** Field label. */
|
|
6
16
|
label?: React.ReactNode;
|
|
17
|
+
/** Size for the label. */
|
|
7
18
|
labelSize?: FieldProps['labelSize'];
|
|
19
|
+
/** Props for the label element. */
|
|
8
20
|
labelProps?: FieldProps['labelProps'];
|
|
21
|
+
/** Render the field with horizontal layout. */
|
|
9
22
|
horizontal?: boolean;
|
|
23
|
+
/** Icon props for the left icon. */
|
|
10
24
|
iconLeft?: ControlBaseProps['iconLeft'];
|
|
25
|
+
/** Icon props for the right icon. */
|
|
11
26
|
iconRight?: ControlBaseProps['iconRight'];
|
|
27
|
+
/** Shortcut for the right icon name. */
|
|
12
28
|
iconRightName?: string;
|
|
29
|
+
/** Shortcut for left icon size. */
|
|
13
30
|
iconLeftSize?: ControlBaseProps['iconLeftSize'];
|
|
31
|
+
/** Shortcut for right icon size. */
|
|
14
32
|
iconRightSize?: ControlBaseProps['iconRightSize'];
|
|
33
|
+
/** Force the left icon container. */
|
|
15
34
|
hasIconsLeft?: boolean;
|
|
35
|
+
/** Force the right icon container. */
|
|
16
36
|
hasIconsRight?: boolean;
|
|
37
|
+
/** Show a loading indicator on the control. */
|
|
17
38
|
isLoading?: boolean;
|
|
39
|
+
/** Expand the control to fill its container. */
|
|
18
40
|
isExpanded?: boolean;
|
|
41
|
+
/** Size of the wrapping Control. */
|
|
19
42
|
controlSize?: ControlBaseProps['size'];
|
|
43
|
+
/** Help/validation text below the input. */
|
|
20
44
|
message?: React.ReactNode;
|
|
45
|
+
/** Color modifier for the help message. */
|
|
21
46
|
messageColor?: 'primary' | 'link' | 'info' | 'success' | 'warning' | 'danger';
|
|
47
|
+
/** Additional CSS classes for the Field wrapper. */
|
|
22
48
|
fieldClassName?: string;
|
|
49
|
+
/** Additional CSS classes for the Control wrapper. */
|
|
23
50
|
controlClassName?: string;
|
|
24
51
|
}
|
|
52
|
+
/**
|
|
53
|
+
* The `TimeInput` component is a form input that opens a popover spinner for time-of-day selection.
|
|
54
|
+
*
|
|
55
|
+
* @function
|
|
56
|
+
* @param {TimeInputProps} props
|
|
57
|
+
* @returns {JSX.Element}
|
|
58
|
+
*
|
|
59
|
+
* @example
|
|
60
|
+
* <TimeInput label="Departure" defaultValue={new Date()} />
|
|
61
|
+
*
|
|
62
|
+
* @example
|
|
63
|
+
* <TimeInput label="Slot" hourFormat="12" incrementMinutes={15} />
|
|
64
|
+
*/
|
|
25
65
|
export declare const TimeInput: React.ForwardRefExoticComponent<TimeInputProps & React.RefAttributes<HTMLInputElement>>;
|
|
26
66
|
export default TimeInput;
|
|
@@ -2,43 +2,94 @@ import React from 'react';
|
|
|
2
2
|
import { BulmaClassesProps } from '../helpers/useBulmaClasses';
|
|
3
3
|
import { PickerPosition, HourFormat, PickerLabels } from './_pickerInternals/pickerTypes';
|
|
4
4
|
import { DateFormatOption } from './_pickerInternals/formatters';
|
|
5
|
+
/**
|
|
6
|
+
* Props for the raw TimeInput base. Use the higher-level `TimeInput` for
|
|
7
|
+
* Field/Control composition; `TimeInputBase` is the input + popover only.
|
|
8
|
+
*/
|
|
5
9
|
export interface TimeInputBaseProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, 'value' | 'defaultValue' | 'onChange' | 'size' | 'color' | 'min' | 'max' | 'type' | 'popover'>, Omit<BulmaClassesProps, 'color'> {
|
|
10
|
+
/** Controlled selected time (date portion is preserved). */
|
|
6
11
|
value?: Date | null;
|
|
12
|
+
/** Initial value for uncontrolled usage. */
|
|
7
13
|
defaultValue?: Date | null;
|
|
14
|
+
/** Fired when the value changes. */
|
|
8
15
|
onChange?: (d: Date | null) => void;
|
|
16
|
+
/** Fired when the popover opens. */
|
|
9
17
|
onOpen?: () => void;
|
|
18
|
+
/** Fired when the popover closes. */
|
|
10
19
|
onClose?: () => void;
|
|
20
|
+
/** Earliest selectable time. */
|
|
11
21
|
min?: Date;
|
|
22
|
+
/** Latest selectable time. */
|
|
12
23
|
max?: Date;
|
|
24
|
+
/** Disable the input. */
|
|
13
25
|
disabled?: boolean;
|
|
26
|
+
/** Make the input read-only. */
|
|
14
27
|
readOnly?: boolean;
|
|
28
|
+
/** Placeholder text for the input. */
|
|
15
29
|
placeholder?: string;
|
|
30
|
+
/**
|
|
31
|
+
* Token format string or `Intl.DateTimeFormat` options.
|
|
32
|
+
* @defaultValue (see below)
|
|
33
|
+
*/
|
|
16
34
|
format?: DateFormatOption;
|
|
35
|
+
/** Custom parser. */
|
|
17
36
|
parse?: (s: string) => Date | null;
|
|
37
|
+
/** BCP-47 locale tag for Intl formatting. */
|
|
18
38
|
locale?: string;
|
|
39
|
+
/** Render the spinner inline (no popover). */
|
|
19
40
|
inline?: boolean;
|
|
41
|
+
/** Use `<input type="time">` on coarse-pointer + small-viewport devices. */
|
|
20
42
|
mobileNative?: boolean | 'auto';
|
|
43
|
+
/** Allow segmented keyboard typing in the input (type the time directly, auto-advancing across segments). `false` makes the field picker-only. */
|
|
21
44
|
editable?: boolean;
|
|
45
|
+
/** Whether the spinner popover exists. `false` makes the field input-only (segmented typing, no popover). */
|
|
22
46
|
popover?: boolean;
|
|
47
|
+
/** Open the popover when the input is focused. */
|
|
23
48
|
openOnFocus?: boolean;
|
|
49
|
+
/** Close the popover after a time is selected (off by default). */
|
|
24
50
|
closeOnSelect?: boolean;
|
|
51
|
+
/** Popover anchor position relative to the input. */
|
|
25
52
|
position?: PickerPosition;
|
|
53
|
+
/** Render the popover into `document.body` via portal. */
|
|
26
54
|
appendToBody?: boolean;
|
|
55
|
+
/** Bulma color modifier. */
|
|
27
56
|
color?: 'primary' | 'link' | 'info' | 'success' | 'warning' | 'danger';
|
|
57
|
+
/** Size variant. */
|
|
28
58
|
size?: 'small' | 'medium' | 'large';
|
|
59
|
+
/** Render the input with rounded corners. */
|
|
29
60
|
isRounded?: boolean;
|
|
61
|
+
/** Hour format. `'12'` shows an AM/PM toggle. */
|
|
30
62
|
hourFormat?: HourFormat;
|
|
63
|
+
/** Show a seconds column. Note: iOS Safari's native time picker UI does not include a seconds wheel; pass `mobileNative={false}` if you need one on iOS. */
|
|
31
64
|
enableSeconds?: boolean;
|
|
65
|
+
/** Hour step for the spinner. */
|
|
32
66
|
incrementHours?: number;
|
|
67
|
+
/** Minute step. Combine with `min`/`max` for slot-style pickers. */
|
|
33
68
|
incrementMinutes?: number;
|
|
69
|
+
/** Second step. Default `1`. */
|
|
34
70
|
incrementSeconds?: number;
|
|
71
|
+
/** Predicate returning `true` for times that should be skipped. Blocked times are also rejected during manual typing. */
|
|
35
72
|
unselectableTimes?: (d: Date) => boolean;
|
|
73
|
+
/** Decorative left icon glyph for the wrapping `Control` (shown by default). Set `''` to hide. */
|
|
36
74
|
iconLeftName?: string;
|
|
75
|
+
/** Show a clickable launcher button on the right that toggles the popover. Default `true`. */
|
|
37
76
|
triggerIcon?: boolean;
|
|
77
|
+
/** Glyph for the right launcher button. */
|
|
38
78
|
triggerIconName?: string;
|
|
79
|
+
/** Optional translatable string overrides. */
|
|
39
80
|
labels?: PickerLabels;
|
|
81
|
+
/** Play a short audible click on each wheel-item crossing. Substitute for haptic feedback on iOS Safari (which has no web haptic API as of May 2026); on Android, `navigator.vibrate(5)` fires automatically regardless. */
|
|
40
82
|
audioTick?: boolean;
|
|
83
|
+
/** Auto-route platform-appropriate feedback: vibrate on Android (already happening), audio thunk on iOS (where vibrate is unavailable). One switch instead of platform-sniffing on the consumer side. `audioTick={true}` always wins. */
|
|
41
84
|
haptics?: boolean;
|
|
42
85
|
}
|
|
86
|
+
/**
|
|
87
|
+
* Raw TimeInput — input + popover spinner without Field/Control wrapping.
|
|
88
|
+
* Use `TimeInput` for the convenience wrapper.
|
|
89
|
+
*
|
|
90
|
+
* @function
|
|
91
|
+
* @param {TimeInputBaseProps} props
|
|
92
|
+
* @returns {JSX.Element}
|
|
93
|
+
*/
|
|
43
94
|
export declare const TimeInputBase: React.ForwardRefExoticComponent<TimeInputBaseProps & React.RefAttributes<HTMLInputElement>>;
|
|
44
95
|
export default TimeInputBase;
|
|
@@ -18,8 +18,14 @@ export interface CalendarProps {
|
|
|
18
18
|
size?: 'small' | 'medium' | 'large';
|
|
19
19
|
className?: string;
|
|
20
20
|
id?: string;
|
|
21
|
+
/** When true, focus the cell matching `focusedDate` after each render. */
|
|
21
22
|
autoFocusCell?: boolean;
|
|
23
|
+
/** Optional translatable string overrides. */
|
|
22
24
|
labels?: PickerLabels;
|
|
25
|
+
/**
|
|
26
|
+
* Inclusive `[min, max]` year range shown in the year-dropdown view.
|
|
27
|
+
* Defaults to ±100 years around the focused year, clamped by `min`/`max`.
|
|
28
|
+
*/
|
|
23
29
|
yearsRange?: [number, number];
|
|
24
30
|
}
|
|
25
31
|
export declare const Calendar: React.FC<CalendarProps>;
|
|
@@ -10,6 +10,7 @@ export interface TimeWheelsProps {
|
|
|
10
10
|
onChange: (v: TimeWheelsValue) => void;
|
|
11
11
|
hourFormat?: HourFormat;
|
|
12
12
|
enableSeconds?: boolean;
|
|
13
|
+
/** Step between visible values in the wheel. Default `1`. */
|
|
13
14
|
incrementHours?: number;
|
|
14
15
|
incrementMinutes?: number;
|
|
15
16
|
incrementSeconds?: number;
|
|
@@ -20,9 +21,21 @@ export interface TimeWheelsProps {
|
|
|
20
21
|
className?: string;
|
|
21
22
|
id?: string;
|
|
22
23
|
labels?: PickerLabels;
|
|
24
|
+
/** Number of items visible at once (must be odd). Default 5. */
|
|
23
25
|
visibleCount?: number;
|
|
26
|
+
/** Item height in px. Default 32. */
|
|
24
27
|
itemHeight?: number;
|
|
28
|
+
/**
|
|
29
|
+
* Play a short audible tick on each item crossing. Useful as a fallback on
|
|
30
|
+
* iOS Safari, where there is no web-accessible haptic API. Off by default
|
|
31
|
+
* to avoid surprising users with sound; flip on for iOS-targeted UIs.
|
|
32
|
+
*/
|
|
25
33
|
audioTick?: boolean;
|
|
34
|
+
/**
|
|
35
|
+
* Fired when the user presses Enter on a wheel column. The current value is
|
|
36
|
+
* already committed (each wheel-tick calls onChange), so this typically just
|
|
37
|
+
* needs to close the surrounding popover.
|
|
38
|
+
*/
|
|
26
39
|
onCommit?: () => void;
|
|
27
40
|
}
|
|
28
41
|
export declare const TimeWheels: React.FC<TimeWheelsProps>;
|
|
@@ -1,3 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Audio-tick fallback for platforms with no haptic API. iOS Safari has no
|
|
3
|
+
* web-accessible Taptic path (see `./haptics.ts` for the full story), so the
|
|
4
|
+
* closest UX substitute is a very short audible thunk played per item tick.
|
|
5
|
+
*
|
|
6
|
+
* Sound design — tuned to read as a body-felt impact, not an ear-felt beep:
|
|
7
|
+
*
|
|
8
|
+
* - Single triangle-wave oscillator at 160Hz, exponentially sweeping down to
|
|
9
|
+
* 110Hz over ~30ms. The low fundamental matches the frequency band where
|
|
10
|
+
* the Taptic Engine fires its UI pops (~150–200Hz); the downward sweep is
|
|
11
|
+
* the single biggest contributor to the perception of a damped physical
|
|
12
|
+
* impact (vs. a flat tone, which reads as a beep).
|
|
13
|
+
*
|
|
14
|
+
* - Triangle adds one odd harmonic over sine — just enough body to feel
|
|
15
|
+
* "soft" without the buzz of square or sawtooth.
|
|
16
|
+
*
|
|
17
|
+
* - Quick 1ms attack to 0.08 gain; exponential decay to silence over ~30ms;
|
|
18
|
+
* oscillator stops at +0.04s. Ramped envelope (no hard 0→1 jumps) avoids
|
|
19
|
+
* the classic Web Audio speaker pop on attack/release.
|
|
20
|
+
*
|
|
21
|
+
* - Uses a single oscillator + envelope rather than an audio buffer /
|
|
22
|
+
* decoded sample so there's no asset to ship and no `decodeAudioData`
|
|
23
|
+
* round-trip.
|
|
24
|
+
*
|
|
25
|
+
* - iOS Safari requires a user gesture to *resume* a suspended
|
|
26
|
+
* `AudioContext`. Call `unlockAudioTick()` from inside a touch / click
|
|
27
|
+
* handler before the first `playAudioTick()`. After that single resume,
|
|
28
|
+
* the context stays running and subsequent ticks play with no further
|
|
29
|
+
* gesture needed.
|
|
30
|
+
*
|
|
31
|
+
* - Silent / Ring switch behaviour on iOS: with the side switch in silent
|
|
32
|
+
* mode, this tick is suppressed (Web Audio respects the ringer). That
|
|
33
|
+
* matches iOS native UX expectations — silent mode means silent UI.
|
|
34
|
+
*
|
|
35
|
+
* - On hardware with neither speakers nor an audio device, every call
|
|
36
|
+
* silently no-ops.
|
|
37
|
+
*/
|
|
38
|
+
/**
|
|
39
|
+
* Call from inside a user-gesture handler (pointerdown, click, touchstart)
|
|
40
|
+
* to resume the AudioContext on iOS Safari. Idempotent and cheap; safe to
|
|
41
|
+
* call on every gesture. No-ops on platforms without Web Audio.
|
|
42
|
+
*/
|
|
1
43
|
export declare const unlockAudioTick: () => void;
|
|
44
|
+
/**
|
|
45
|
+
* Play a single short tick. No-op if Web Audio is unavailable or the
|
|
46
|
+
* context hasn't been unlocked yet.
|
|
47
|
+
*/
|
|
2
48
|
export declare const playAudioTick: () => void;
|
|
49
|
+
/** Test-only hook to drop the singleton AudioContext. */
|
|
3
50
|
export declare const __resetAudioTickForTest: () => void;
|
|
@@ -30,10 +30,23 @@ export declare function getTimeOfDay(d: Date): {
|
|
|
30
30
|
seconds: number;
|
|
31
31
|
};
|
|
32
32
|
export declare function clampDate(d: Date, min?: Date, max?: Date): Date;
|
|
33
|
+
/**
|
|
34
|
+
* Snap a Date's time-of-day to the nearest grid defined by the given
|
|
35
|
+
* increment steps. Used by the "Now" button in pickers configured with
|
|
36
|
+
* non-1 hour / minute / second steps so the committed time always lands on
|
|
37
|
+
* a slot that exists on the wheel. Overflows roll up: e.g.
|
|
38
|
+
* 13:58 with step=15 → 14:00. Seconds are zeroed when `enableSeconds` is
|
|
39
|
+
* false, regardless of step.
|
|
40
|
+
*/
|
|
33
41
|
export declare function snapTimeToIncrement(d: Date, opts?: {
|
|
34
42
|
incrementHours?: number;
|
|
35
43
|
incrementMinutes?: number;
|
|
36
44
|
incrementSeconds?: number;
|
|
37
45
|
enableSeconds?: boolean;
|
|
38
46
|
}): Date;
|
|
47
|
+
/**
|
|
48
|
+
* Build a 6-week × 7-day grid (42 cells) anchored on the month containing
|
|
49
|
+
* `monthAnchor`. The first cell is the start of the week containing the first
|
|
50
|
+
* of the month, where the week starts on `firstDayOfWeek`.
|
|
51
|
+
*/
|
|
39
52
|
export declare function buildMonthGrid(monthAnchor: Date, firstDayOfWeek?: DayOfWeek): CalendarCell[];
|
|
@@ -6,8 +6,27 @@ export declare const DEFAULT_DATETIME_FORMAT = "YYYY-MM-DD HH:mm";
|
|
|
6
6
|
export declare function formatDate(d: Date, fmt: DateFormatOption | undefined, locale?: string): string;
|
|
7
7
|
export declare function formatTime(d: Date, fmt: DateFormatOption | undefined, locale?: string): string;
|
|
8
8
|
export declare function formatDateTime(d: Date, fmt: DateFormatOption | undefined, locale?: string): string;
|
|
9
|
+
/**
|
|
10
|
+
* Derive the hour cycle (`'12'` or `'24'`) a display format will render, from
|
|
11
|
+
* its first hour token: `h`/`hh` → 12-hour with meridiem, `H`/`HH` → 24-hour.
|
|
12
|
+
*
|
|
13
|
+
* Returns `null` when the cycle can't be read from the format — it's an
|
|
14
|
+
* `Intl.DateTimeFormat` options object (no token string), `undefined`, or has
|
|
15
|
+
* no hour token — so callers fall back to the raw `hourFormat` prop. Scans with
|
|
16
|
+
* the same {@link TOKEN_RE} grammar the input renders with, so the derived cycle
|
|
17
|
+
* always agrees with what the field actually displays.
|
|
18
|
+
*/
|
|
9
19
|
export declare function hourCycleFromFormat(fmt: DateFormatOption | undefined): '12' | '24' | null;
|
|
20
|
+
/**
|
|
21
|
+
* Parse a date string against a token format. Returns null on mismatch.
|
|
22
|
+
* For Intl-options formats parsing is the consumer's responsibility — pass
|
|
23
|
+
* a custom `parse` prop on the picker.
|
|
24
|
+
*/
|
|
10
25
|
export declare function parseDate(s: string, fmt?: string, _locale?: string): Date | null;
|
|
11
26
|
export declare function parseTime(s: string, fmt?: string): Date | null;
|
|
27
|
+
/**
|
|
28
|
+
* Locale-aware day name labels in calendar order (Sunday → Saturday).
|
|
29
|
+
* Caller rotates by `firstDayOfWeek`.
|
|
30
|
+
*/
|
|
12
31
|
export declare function getDayNames(locale: string | undefined, length?: 'narrow' | 'short' | 'long'): string[];
|
|
13
32
|
export declare function getMonthNames(locale: string | undefined, length?: 'short' | 'long'): string[];
|
|
@@ -1 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tiny haptic blip used to signal each item tick on the time-wheel scroller.
|
|
3
|
+
*
|
|
4
|
+
* Implementation: feature-detect `navigator.vibrate()` and call it with a
|
|
5
|
+
* 5ms duration. Supported on Android Chrome (since v30), Firefox Android,
|
|
6
|
+
* and Samsung Internet. Silently no-ops elsewhere.
|
|
7
|
+
*
|
|
8
|
+
* iOS Safari does not expose `navigator.vibrate` and has no other web-
|
|
9
|
+
* accessible haptic API as of May 2026. We previously shipped a fallback
|
|
10
|
+
* that toggled a hidden `<input type="checkbox" switch>` element via
|
|
11
|
+
* `.click()` — that produced toggle haptics on iOS 17.4 through 26.4, but
|
|
12
|
+
* Apple patched the loophole in iOS 26.5: haptics now only fire on
|
|
13
|
+
* genuine, user-initiated taps on a visible switch, not on programmatic
|
|
14
|
+
* invocation. There is no public WebKit ticket for the patch; it's
|
|
15
|
+
* documented in the `tijnjh/ios-haptics` README and downstream community
|
|
16
|
+
* write-ups. The Web Audio "silent buffer" trick unlocks audio playback
|
|
17
|
+
* but never produced Taptic Engine output. PWAs added to the Home Screen
|
|
18
|
+
* use the same WebKit and gain no extra haptic capability.
|
|
19
|
+
*
|
|
20
|
+
* If you need haptics on iOS, the only path today is wrapping the web view
|
|
21
|
+
* in a native shell (Capacitor, react-native-webview) and bridging to
|
|
22
|
+
* `UIImpactFeedbackGenerator`. Pure web cannot do it.
|
|
23
|
+
*/
|
|
1
24
|
export declare const tickHaptic: () => void;
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
export type PickerPosition = 'bottom-left' | 'bottom-right' | 'top-left' | 'top-right' | 'auto';
|
|
2
2
|
export type HourFormat = '12' | '24';
|
|
3
3
|
export type DayOfWeek = 0 | 1 | 2 | 3 | 4 | 5 | 6;
|
|
4
|
+
/**
|
|
5
|
+
* Translatable strings used across all four pickers. Pass via the `labels`
|
|
6
|
+
* prop to override defaults; consumers manage their own locale-driven mapping.
|
|
7
|
+
*/
|
|
4
8
|
export interface PickerLabels {
|
|
5
9
|
prevMonth?: string;
|
|
6
10
|
nextMonth?: string;
|
|
@@ -23,9 +27,13 @@ export interface PickerLabels {
|
|
|
23
27
|
clear?: string;
|
|
24
28
|
cancel?: string;
|
|
25
29
|
ok?: string;
|
|
30
|
+
/** Mobile footer: text link that reverts to the value at open (like iOS). */
|
|
26
31
|
reset?: string;
|
|
32
|
+
/** Mobile footer: aria-label for the circular checkmark commit button. */
|
|
27
33
|
done?: string;
|
|
34
|
+
/** DateTimeInput footer: label preceding the selected-time display. */
|
|
28
35
|
time?: string;
|
|
29
36
|
}
|
|
30
37
|
export declare const DEFAULT_PICKER_LABELS: Required<PickerLabels>;
|
|
38
|
+
/** Merge user-supplied label overrides with the defaults. */
|
|
31
39
|
export declare const mergeLabels: (overrides?: PickerLabels) => Required<PickerLabels>;
|
|
@@ -1,20 +1,68 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Segment-map utility for manual keyboard entry on a date / time picker input.
|
|
3
|
+
* Given a token-format string like `'YYYY-MM-DD'`, `'HH:mm:ss'`, `'hh:mm A'`,
|
|
4
|
+
* or a combined `'YYYY-MM-DD HH:mm'`, we compute the character ranges of each
|
|
5
|
+
* editable segment in the formatted output, plus arithmetic helpers
|
|
6
|
+
* (increment / digit-set) for each kind.
|
|
7
|
+
*
|
|
8
|
+
* Variable-width tokens (`Y`, `YYY`, `M`, `D`, `H`, `h`, `m`, `s`) cause the
|
|
9
|
+
* renderer to emit output of unpredictable width depending on value, which
|
|
10
|
+
* would shift segment boundaries between renders and break the selection.
|
|
11
|
+
* `buildSegmentMap` returns `null` for any format containing those, signalling
|
|
12
|
+
* the caller to fall back to free-form text entry.
|
|
13
|
+
*/
|
|
1
14
|
export type SegmentKind = 'year' | 'month' | 'day' | 'hours' | 'minutes' | 'seconds' | 'ampm' | 'literal';
|
|
2
15
|
export interface Segment {
|
|
3
16
|
kind: SegmentKind;
|
|
17
|
+
/** Source token (e.g., `'HH'`) for editable segments; literal text for `'literal'`. */
|
|
4
18
|
token: string;
|
|
19
|
+
/** Inclusive char index into the formatted-string output. */
|
|
5
20
|
start: number;
|
|
21
|
+
/** Exclusive char index. */
|
|
6
22
|
end: number;
|
|
23
|
+
/** Populated only when `kind === 'hours'`. */
|
|
7
24
|
hourFormat?: '12' | '24';
|
|
8
25
|
}
|
|
9
26
|
export interface SegmentMap {
|
|
10
27
|
segments: Segment[];
|
|
28
|
+
/** Indices of non-literal segments, left to right. */
|
|
11
29
|
editable: number[];
|
|
12
30
|
}
|
|
31
|
+
/**
|
|
32
|
+
* Walk a token-format string and produce a {@link SegmentMap}, or `null` if
|
|
33
|
+
* the format contains any variable-width tokens (`H`, `h`, `m`, `s`) — the
|
|
34
|
+
* caller should treat that case as "segment mode unsupported, use the input's
|
|
35
|
+
* free-form text-entry fallback".
|
|
36
|
+
*/
|
|
13
37
|
export declare function buildSegmentMap(format: string): SegmentMap | null;
|
|
38
|
+
/**
|
|
39
|
+
* Returns a new Date with the given segment incremented (`delta` = +1 or -1).
|
|
40
|
+
* Wraps at segment boundaries: year is unbounded, month 0↔11 (in place, no
|
|
41
|
+
* year roll), day within the current month's length, hours-24 0↔23, hours-12
|
|
42
|
+
* 1↔12, minutes/seconds 0↔59, am/pm toggles. Day is re-clamped after a
|
|
43
|
+
* month/year change (Jan 31 → Feb 28/29). `isPm` is the *current* meridiem
|
|
44
|
+
* when editing a 12h hour segment so we preserve it across the increment;
|
|
45
|
+
* date segments ignore it.
|
|
46
|
+
*/
|
|
14
47
|
export declare function incrementSegmentValue(segment: Segment, currentDate: Date, delta: number, isPm: boolean): Date;
|
|
48
|
+
/**
|
|
49
|
+
* Apply a buffered string of typed digits to the active segment. Returns the
|
|
50
|
+
* updated Date plus an `advance` flag — `true` when the buffer is full (its
|
|
51
|
+
* token width) or when the first digit alone forecloses any valid multi-digit
|
|
52
|
+
* completion (e.g., first digit `3` for hours-24 since 30+ is out of range, or
|
|
53
|
+
* `2` for month since there is no month 20+).
|
|
54
|
+
*
|
|
55
|
+
* Special cases: a leading `'0'` is held without committing for hours-12,
|
|
56
|
+
* month, and day (00 isn't a valid display value for any of them) — the buffer
|
|
57
|
+
* must reach `'0X'` first. Month/day writes clamp to range and re-clamp the
|
|
58
|
+
* day to the month's length; year writes re-clamp the day across leap-year
|
|
59
|
+
* boundaries.
|
|
60
|
+
*/
|
|
15
61
|
export declare function setSegmentValue(segment: Segment, currentDate: Date, rawDigits: string, isPm: boolean): {
|
|
16
62
|
date: Date;
|
|
17
63
|
advance: boolean;
|
|
18
64
|
};
|
|
65
|
+
/** Force the meridiem of `currentDate` to AM (isPm=false) or PM (true). */
|
|
19
66
|
export declare function setAmPm(currentDate: Date, isPm: boolean): Date;
|
|
67
|
+
/** Map a caret position into the index of the segment that contains it. */
|
|
20
68
|
export declare function segmentIndexAtCaret(map: SegmentMap, caret: number): number | null;
|
|
@@ -5,6 +5,7 @@ export interface NativeMobileDetect {
|
|
|
5
5
|
}
|
|
6
6
|
export interface UseNativeMobilePickerOptions {
|
|
7
7
|
smallViewportMaxPx?: number;
|
|
8
|
+
/** When set, overrides detection. */
|
|
8
9
|
force?: boolean;
|
|
9
10
|
}
|
|
10
11
|
export declare function useNativeMobilePicker(options?: UseNativeMobilePickerOptions): NativeMobileDetect;
|