@allxsmith/bestax-bulma 5.26.6 → 5.27.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (50) hide show
  1. package/dist/bestax.css +1 -1
  2. package/dist/bestax.css.map +1 -1
  3. package/dist/extras.css +1 -1
  4. package/dist/extras.css.map +1 -1
  5. package/dist/index.cjs +752 -79
  6. package/dist/index.cjs.map +1 -1
  7. package/dist/index.esm.js +751 -80
  8. package/dist/index.esm.js.map +1 -1
  9. package/dist/types/components/Tabs.d.ts +25 -3
  10. package/dist/types/form/DateInputBase.d.ts +5 -2
  11. package/dist/types/form/DateRangeInput.d.ts +91 -0
  12. package/dist/types/form/DateRangeInputBase.d.ts +172 -0
  13. package/dist/types/form/DateTimeInputBase.d.ts +7 -2
  14. package/dist/types/form/File.d.ts +15 -2
  15. package/dist/types/form/FormContext.d.ts +11 -0
  16. package/dist/types/form/TimeInputBase.d.ts +1 -1
  17. package/dist/types/form/_pickerInternals/PickerPopover.d.ts +1 -0
  18. package/dist/types/form/_pickerInternals/dateUtils.d.ts +7 -0
  19. package/dist/types/form/_pickerInternals/formatters.d.ts +14 -0
  20. package/dist/types/form/_pickerInternals/pickerTypes.d.ts +13 -0
  21. package/dist/types/form/_pickerInternals/useSegmentedEntry.d.ts +12 -3
  22. package/dist/types/index.d.ts +4 -0
  23. package/dist/types-cjs/components/Tabs.d.ts +25 -3
  24. package/dist/types-cjs/form/DateInputBase.d.ts +5 -2
  25. package/dist/types-cjs/form/DateRangeInput.d.ts +91 -0
  26. package/dist/types-cjs/form/DateRangeInputBase.d.ts +172 -0
  27. package/dist/types-cjs/form/DateTimeInputBase.d.ts +7 -2
  28. package/dist/types-cjs/form/File.d.ts +15 -2
  29. package/dist/types-cjs/form/FormContext.d.ts +11 -0
  30. package/dist/types-cjs/form/TimeInputBase.d.ts +1 -1
  31. package/dist/types-cjs/form/_pickerInternals/PickerPopover.d.ts +1 -0
  32. package/dist/types-cjs/form/_pickerInternals/dateUtils.d.ts +7 -0
  33. package/dist/types-cjs/form/_pickerInternals/formatters.d.ts +14 -0
  34. package/dist/types-cjs/form/_pickerInternals/pickerTypes.d.ts +13 -0
  35. package/dist/types-cjs/form/_pickerInternals/useSegmentedEntry.d.ts +12 -3
  36. package/dist/types-cjs/index.d.ts +4 -0
  37. package/dist/versions/bestax-no-dark-mode.css +1 -1
  38. package/dist/versions/bestax-no-dark-mode.css.map +1 -1
  39. package/dist/versions/bestax-no-helpers-prefixed.css +1 -1
  40. package/dist/versions/bestax-no-helpers-prefixed.css.map +1 -1
  41. package/dist/versions/bestax-no-helpers.css +1 -1
  42. package/dist/versions/bestax-no-helpers.css.map +1 -1
  43. package/dist/versions/bestax-prefixed.css +1 -1
  44. package/dist/versions/bestax-prefixed.css.map +1 -1
  45. package/package.json +1 -1
  46. package/src/scss/components/_tabs.scss +44 -0
  47. package/src/scss/form/_dateinput.scss +50 -2
  48. package/src/scss/form/_daterangeinput.scss +63 -0
  49. package/src/scss/form/_file.scss +37 -0
  50. package/src/scss/form/_index.scss +2 -0
@@ -0,0 +1,91 @@
1
+ import React from 'react';
2
+ import { FieldProps } from './Field.js';
3
+ import { ControlBaseProps } from './Control.js';
4
+ import { DateRangeInputBaseProps } from './DateRangeInputBase.js';
5
+ /**
6
+ * Props for the DateRangeInput convenience wrapper. Extends
7
+ * `DateRangeInputBaseProps` with Field-level (label, horizontal) and
8
+ * Control-level (icons, loading) props. Inside an existing `Control` it
9
+ * renders no `Control` of its own, so its Control-level props do nothing
10
+ * there and warn in development; set them on that `Control` instead. In
11
+ * `inline` mode it renders no `Control` anywhere, so they do nothing inside a
12
+ * `Control` or out, and warn in development there too. Inside an outer
13
+ * `Field`, or a `Control` with no `Field` around it, it renders no `Field` of
14
+ * its own either. The exception is
15
+ * `label`, `message`, `horizontal` or `fieldClassName` in that bare
16
+ * `Control`: it keeps a `Field` for them, nested in the `.control`, and warns
17
+ * in development. Wrap the `Control` in a `Field` instead.
18
+ * @extraProp {string} [className] - Additional CSS classes for the root, the `role="group"` that holds the two inputs.
19
+ * @extraProp {React.Ref<HTMLInputElement>} [ref] - Forwarded to the start `<input>`.
20
+ */
21
+ export interface DateRangeInputProps extends DateRangeInputBaseProps {
22
+ /** Field label naming the whole range. Associated through `aria-labelledby` on the `role="group"` root, since it names two inputs rather than one; uses your `labelProps.id` when provided, otherwise a generated one. Each input keeps its own name, "Start date" or "End date" (`labels.rangeStart` / `labels.rangeEnd`). Dropped inside an outer `Field`. */
23
+ label?: React.ReactNode;
24
+ /** Size for the label. */
25
+ labelSize?: FieldProps['labelSize'];
26
+ /** Props for the label element. An `htmlFor` here is dropped, since the label names the group rather than one input. */
27
+ labelProps?: FieldProps['labelProps'];
28
+ /** Render the field with horizontal layout. */
29
+ horizontal?: boolean;
30
+ /**
31
+ * Icon props for the left icon.
32
+ * Bulma gives control icons `pointer-events: none`, so a clickable node here
33
+ * never receives a click. Put a button beside the field in its own addon `Control` instead.
34
+ */
35
+ iconLeft?: ControlBaseProps['iconLeft'];
36
+ /**
37
+ * Icon props for the right icon.
38
+ * Bulma gives control icons `pointer-events: none`, so a clickable node here
39
+ * never receives a click. Put a button beside the field in its own addon `Control` instead.
40
+ */
41
+ iconRight?: ControlBaseProps['iconRight'];
42
+ /** Shortcut for the right icon name. */
43
+ iconRightName?: string;
44
+ /** Shortcut for left icon size. */
45
+ iconLeftSize?: ControlBaseProps['iconLeftSize'];
46
+ /** Shortcut for right icon size. */
47
+ iconRightSize?: ControlBaseProps['iconRightSize'];
48
+ /** Force the left icon container. */
49
+ hasIconsLeft?: boolean;
50
+ /** Force the right icon container. */
51
+ hasIconsRight?: boolean;
52
+ /**
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 and warns in development; set
56
+ * `isLoading` on that `Control`.
57
+ */
58
+ isLoading?: boolean;
59
+ /**
60
+ * Show a clickable launcher button on the right that toggles the popover.
61
+ * Hidden by default while a spinner shows at the same right edge: this
62
+ * component's `isLoading` when it renders its own `Control`, or the
63
+ * enclosing `Control`'s `isLoading` inside one.
64
+ * @defaultValue true
65
+ */
66
+ triggerIcon?: boolean;
67
+ /** Expand the control to fill its container. */
68
+ isExpanded?: boolean;
69
+ /** Size of the wrapping Control. */
70
+ controlSize?: ControlBaseProps['size'];
71
+ /** Help/validation text below the field. */
72
+ message?: React.ReactNode;
73
+ /** Color modifier for the help message. */
74
+ messageColor?: 'primary' | 'link' | 'info' | 'success' | 'warning' | 'danger';
75
+ /** Additional CSS classes for the Field wrapper. */
76
+ fieldClassName?: string;
77
+ /** Additional CSS classes for the Control wrapper. */
78
+ controlClassName?: string;
79
+ }
80
+ /**
81
+ * The `DateRangeInput` component is a form input for a start and end date, picked from one popover calendar or typed into two segmented inputs.
82
+ *
83
+ * @function
84
+ * @param {DateRangeInputProps} props - Props for the DateRangeInput.
85
+ * @returns {JSX.Element}
86
+ *
87
+ * @example
88
+ * <DateRangeInput label="Stay" name="stay" min={new Date()} />
89
+ */
90
+ export declare const DateRangeInput: React.ForwardRefExoticComponent<DateRangeInputProps & React.RefAttributes<HTMLInputElement>>;
91
+ export default DateRangeInput;
@@ -0,0 +1,172 @@
1
+ import React from 'react';
2
+ import { BulmaClassesProps } from '../helpers/useBulmaClasses.js';
3
+ import { DateRangeValue, DayOfWeek, PickerLabels, PickerPosition } from './_pickerInternals/pickerTypes.js';
4
+ import { DateFormatOption } from './_pickerInternals/formatters.js';
5
+ export type { DateRangeValue };
6
+ /**
7
+ * Props for the raw DateRangeInput base. Use the higher-level
8
+ * `DateRangeInput` for Field/Control composition; `DateRangeInputBase` is the
9
+ * two inputs and the popover only.
10
+ */
11
+ export interface DateRangeInputBaseProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'defaultValue' | 'onChange' | 'color' | 'placeholder' | 'popover'>, Omit<BulmaClassesProps, 'color'> {
12
+ /**
13
+ * Controlled range, start first. Either end may be `null`, and
14
+ * `[null, null]` is empty.
15
+ */
16
+ value?: DateRangeValue;
17
+ /** Initial range for uncontrolled usage. */
18
+ defaultValue?: DateRangeValue;
19
+ /**
20
+ * Fired when the range changes, with the start first. Typing commits one
21
+ * end at a time, so a range half typed arrives as `[start, null]`. The
22
+ * calendar commits only a finished range: its first pick marks the start
23
+ * inside the calendar and its second commits both ends in one call. The
24
+ * range stays ordered, so the end is never before the start.
25
+ */
26
+ onChange?: (range: DateRangeValue) => void;
27
+ /** Fired when the popover opens. */
28
+ onOpen?: () => void;
29
+ /** Fired when the popover closes. */
30
+ onClose?: () => void;
31
+ /**
32
+ * Earliest selectable date, for either end. A `min` before year 1 is raised
33
+ * to 1 January of year 1, where the range starts without one too.
34
+ */
35
+ min?: Date;
36
+ /** Latest selectable date, for either end. */
37
+ max?: Date;
38
+ /** Disable both inputs and the launcher. */
39
+ disabled?: boolean;
40
+ /** Make both inputs read-only and keep the popover closed. */
41
+ readOnly?: boolean;
42
+ /** Placeholder text, shown in both inputs while they are empty. */
43
+ placeholder?: string;
44
+ /**
45
+ * Token format string or `Intl.DateTimeFormat` options, used by both
46
+ * inputs.
47
+ * @defaultValue 'YYYY-MM-DD'
48
+ */
49
+ format?: DateFormatOption;
50
+ /**
51
+ * Custom parser (use when `format` is `Intl.DateTimeFormatOptions`).
52
+ * Enter and leaving an input call it only if the user changed its text.
53
+ */
54
+ parse?: (s: string) => Date | null;
55
+ /** BCP-47 locale tag for day/month names and Intl formatting. */
56
+ locale?: string;
57
+ /**
58
+ * Render the calendar inline, with no inputs and no popover. The hidden
59
+ * form inputs still carry the range.
60
+ */
61
+ inline?: boolean;
62
+ /**
63
+ * Use two native `<input type="date">`s on coarse-pointer, small-viewport
64
+ * devices (`'auto'`), always (`true`) or never (`false`). The end input's
65
+ * `min` follows the start, and a change goes through the same rules as
66
+ * typing.
67
+ */
68
+ mobileNative?: boolean | 'auto';
69
+ /** Allow segmented keyboard typing in both inputs. `false` makes the field picker-only. */
70
+ editable?: boolean;
71
+ /** Whether the calendar popover exists. `false` makes the field input-only. */
72
+ popover?: boolean;
73
+ /**
74
+ * Open the popover when focus arrives in the field. Moving focus between
75
+ * the two inputs, or back from the launcher, leaves it closed, and so does
76
+ * the focus a closing popover hands back. A click on either input opens it.
77
+ * With it off, the launcher or Alt+ArrowDown opens it.
78
+ */
79
+ openOnFocus?: boolean;
80
+ /**
81
+ * Close the popover once the range is picked. The first pick, which only
82
+ * marks the start, never closes it.
83
+ */
84
+ closeOnSelect?: boolean;
85
+ /** Popover anchor position relative to the field. */
86
+ position?: PickerPosition;
87
+ /** Render the popover into `document.body` via portal. */
88
+ appendToBody?: boolean;
89
+ /**
90
+ * Bulma color modifier for the field, also carried by the calendar, where it
91
+ * colors the range's ends and the band between them.
92
+ */
93
+ color?: 'primary' | 'link' | 'info' | 'success' | 'warning' | 'danger';
94
+ /** Size variant. */
95
+ size?: 'small' | 'medium' | 'large';
96
+ /** Render the field with rounded corners. */
97
+ isRounded?: boolean;
98
+ /**
99
+ * Predicate to disable specific dates (e.g. weekends). A disabled day can
100
+ * be neither end, typing rejects it, and a range can't include one unless
101
+ * `allowDisabledInRange` is set.
102
+ */
103
+ shouldDisableDate?: (d: Date) => boolean;
104
+ /** Convenience array of disabled dates; merged with `shouldDisableDate`. Matched by calendar day. */
105
+ unselectableDates?: Date[];
106
+ /**
107
+ * Let a range include days that `shouldDisableDate` or `unselectableDates`
108
+ * disable, such as a stay over a night with no check-ins. Its ends still
109
+ * can't be such days. Off, a pick in the calendar past a disabled day
110
+ * starts a new range there, typing refuses an end past one, and a start
111
+ * typed with one before the end clears the end. Finding one walks the days
112
+ * between, so off, a span too long to walk is refused as well.
113
+ */
114
+ allowDisabledInRange?: boolean;
115
+ /** Day the week starts on (0 = Sunday). */
116
+ firstDayOfWeek?: DayOfWeek;
117
+ /** Override the 7 day-name labels (in calendar order, post-rotation). */
118
+ dayNames?: string[];
119
+ /** Override the 12 month-name labels. */
120
+ monthNames?: string[];
121
+ /** Show dimmed dates from adjacent months in the grid. */
122
+ nearbyMonthDays?: boolean;
123
+ /** Decorative left icon glyph for the wrapping `Control` (shown by default). Set `''` to hide. */
124
+ iconLeftName?: string;
125
+ /**
126
+ * Show a clickable launcher button on the right that toggles the popover.
127
+ * Hidden by default while a `Control` it sits in shows its `isLoading`
128
+ * spinner, which shares that right edge.
129
+ * @defaultValue true
130
+ */
131
+ triggerIcon?: boolean;
132
+ /** Glyph for the right launcher button. */
133
+ triggerIconName?: string;
134
+ /**
135
+ * Optional translatable string overrides. `rangeStart` and `rangeEnd` name
136
+ * the two inputs and the range's ends in the calendar, `rangePreviewEnd`
137
+ * describes the day a pending range would end on, `rangeSeparator` sits
138
+ * between the inputs, and `chooseDateRange` names the launcher and the
139
+ * popover.
140
+ */
141
+ labels?: PickerLabels;
142
+ /**
143
+ * Form field name. Two hidden inputs submit the range as `YYYY-MM-DD`,
144
+ * named `name[start]` and `name[end]`, in every mode. The visible inputs
145
+ * carry no name.
146
+ */
147
+ name?: string;
148
+ /** Name of the hidden input carrying the start, in place of `name[start]`. */
149
+ startName?: string;
150
+ /** Name of the hidden input carrying the end, in place of `name[end]`. */
151
+ endName?: string;
152
+ /** Form id the hidden inputs belong to. */
153
+ form?: string;
154
+ /**
155
+ * Mark both visible inputs required, so a form won't submit with either
156
+ * end empty. An `inline` calendar has no visible input, so it is not
157
+ * checked there.
158
+ */
159
+ required?: boolean;
160
+ /** Id of the start input. The end input takes `${id}-end`. */
161
+ id?: string;
162
+ }
163
+ /**
164
+ * Raw DateRangeInput: the two inputs and the popover calendar without
165
+ * Field/Control wrapping. Use `DateRangeInput` for the convenience wrapper.
166
+ *
167
+ * @function
168
+ * @param {DateRangeInputBaseProps} props
169
+ * @returns {JSX.Element}
170
+ */
171
+ export declare const DateRangeInputBase: React.ForwardRefExoticComponent<DateRangeInputBaseProps & React.RefAttributes<HTMLInputElement>>;
172
+ export default DateRangeInputBase;
@@ -12,7 +12,12 @@ export interface DateTimeInputBaseProps extends Omit<React.InputHTMLAttributes<H
12
12
  value?: Date | null;
13
13
  /** Initial value for uncontrolled usage. */
14
14
  defaultValue?: Date | null;
15
- /** Fired when either the date or time portion changes. */
15
+ /**
16
+ * Fired when either the date or time portion changes. Picking a day keeps
17
+ * the value's whole time of day, down to seconds and milliseconds the field
18
+ * doesn't show, and `min` and `max` judge the picked day at that time. An
19
+ * empty field's day is picked at midnight.
20
+ */
16
21
  onChange?: (d: Date | null) => void;
17
22
  /** Fired when the popover opens. */
18
23
  onOpen?: () => void;
@@ -58,7 +63,7 @@ export interface DateTimeInputBaseProps extends Omit<React.InputHTMLAttributes<H
58
63
  * Open the popover on focus. Default `true`. Focus that a closing popover
59
64
  * hands back to the input leaves it closed. Dismissing it commits nothing:
60
65
  * an empty field stays empty, and leaving afterwards commits only what was
61
- * typed since.
66
+ * typed since. With it off, the launcher or Alt+ArrowDown opens it.
62
67
  */
63
68
  openOnFocus?: boolean;
64
69
  /** Off by default — users typically tweak both halves before committing. */
@@ -31,7 +31,12 @@ export interface FileProps extends Omit<React.InputHTMLAttributes<HTMLInputEleme
31
31
  isRight?: boolean;
32
32
  /** Center the file input within its container. */
33
33
  isCentered?: boolean;
34
- /** Show a file name indicator. */
34
+ /**
35
+ * Show a file name area. Without `fileName` it shows what the user picked: the file's name, or
36
+ * a count when `multiple` lets them pick several (see `pickedFilesLabel`). Before a pick there is
37
+ * no name area. A reset of the input's form clears the name, but clearing the input from code
38
+ * fires no change event and leaves it showing, so pass `fileName` to control the text then.
39
+ */
35
40
  hasName?: boolean;
36
41
  /** Text on the file CTA button (defaults to "Choose a file…"). */
37
42
  buttonLabel?: React.ReactNode;
@@ -50,8 +55,16 @@ export interface FileProps extends Omit<React.InputHTMLAttributes<HTMLInputEleme
50
55
  className?: string;
51
56
  /** Additional CSS classes for the `<input>`. */
52
57
  inputClassName?: string;
53
- /** File name to display. */
58
+ /**
59
+ * Text for the file name area (with `hasName`), for a file chosen earlier or your own wording.
60
+ * Setting it takes over from the picked file's name; an empty string shows no name area.
61
+ */
54
62
  fileName?: string;
63
+ /**
64
+ * Builds the text `hasName` shows when several files are picked, from their count, for
65
+ * localization. Default: `` `${count} files` ``. A single pick shows its file's name.
66
+ */
67
+ pickedFilesLabel?: (count: number) => string;
55
68
  }
56
69
  /**
57
70
  * The `File` component provides a Bulma-styled file input, supporting color, size, boxed/fullwidth/align styles, icons, "has name", and filename display.
@@ -76,6 +76,13 @@ interface OwnControlOptions extends ControlLevelProps {
76
76
  insideControl: boolean;
77
77
  /** A picker's `inline`, which renders no `Control` inside one or out. */
78
78
  inline?: boolean;
79
+ /**
80
+ * The left glyph the wrapper's own `Control` shows when the caller sets no
81
+ * `iconLeftName`; read only then. `bare-control.test.tsx` reads that glyph
82
+ * from what each wrapper hands its own `Control`, so a wrapper that gains
83
+ * one fails there until it passes it here.
84
+ */
85
+ defaultIconLeftName?: string;
79
86
  }
80
87
  /**
81
88
  * Whether a convenience form wrapper renders a `Control` of its own (#921):
@@ -87,6 +94,10 @@ interface OwnControlOptions extends ControlLevelProps {
87
94
  * only the props it hands its own `Control`, as the caller gave them, so a
88
95
  * default the wrapper fills in itself never warns. A prop counts when it is
89
96
  * truthy, since a falsy one would change nothing on a `Control` either.
97
+ * `iconLeftSize` and `hasIconsLeft` show nothing on a `Control` without a
98
+ * glyph, so when they move and the caller chose no left icon, the advice
99
+ * names the wrapper's default glyph too, and following it draws what the
100
+ * wrapper's own `Control` did.
90
101
  * Internal; not part of the public API.
91
102
  */
92
103
  export declare const rendersOwnControl: (component: string, options: OwnControlOptions) => boolean;
@@ -56,7 +56,7 @@ export interface TimeInputBaseProps extends Omit<React.InputHTMLAttributes<HTMLI
56
56
  * Open the popover when the input is focused. Focus that a closing popover
57
57
  * hands back to the input leaves it closed. Dismissing it commits nothing:
58
58
  * an empty field stays empty, and leaving afterwards commits only what was
59
- * typed since.
59
+ * typed since. With it off, the launcher or Alt+ArrowDown opens it.
60
60
  */
61
61
  openOnFocus?: boolean;
62
62
  /** Close the popover after a time is selected (off by default). */
@@ -10,6 +10,7 @@ export interface PickerPopoverProps {
10
10
  className?: string;
11
11
  trapFocus?: boolean;
12
12
  closeOnClickOutside?: boolean;
13
+ /** Close on Escape and on Alt+ArrowUp. Default `true`. */
13
14
  closeOnEscape?: boolean;
14
15
  ariaLabel?: string;
15
16
  ariaLabelledBy?: string;
@@ -83,10 +83,17 @@ export declare function addYears(d: Date, n: number): Date;
83
83
  export declare function addHours(d: Date, n: number): Date;
84
84
  export declare function addMinutes(d: Date, n: number): Date;
85
85
  export declare function addSeconds(d: Date, n: number): Date;
86
+ /**
87
+ * A copy of `d` with the given parts of its time of day set and the rest
88
+ * left as they are. A time started from the clock rather than from a value
89
+ * should pass the seconds its picker does not show, and the milliseconds,
90
+ * as `0`, or it keeps the ones the clock had.
91
+ */
86
92
  export declare function setTimeOfDay(d: Date, parts: {
87
93
  hours?: number;
88
94
  minutes?: number;
89
95
  seconds?: number;
96
+ milliseconds?: number;
90
97
  }): Date;
91
98
  export declare function getTimeOfDay(d: Date): {
92
99
  hours: number;
@@ -1,3 +1,4 @@
1
+ import type { DateGranularity } from './pickerTypes.js';
1
2
  export type DateFormatOption = Intl.DateTimeFormatOptions | string;
2
3
  export declare const DEFAULT_DATE_FORMAT = "YYYY-MM-DD";
3
4
  export declare const DEFAULT_MONTH_FORMAT = "YYYY-MM";
@@ -8,6 +9,19 @@ export declare const DEFAULT_DATETIME_FORMAT = "YYYY-MM-DD HH:mm";
8
9
  export declare function formatDate(d: Date, fmt: DateFormatOption | undefined, locale?: string): string;
9
10
  export declare function formatTime(d: Date, fmt: DateFormatOption | undefined, locale?: string): string;
10
11
  export declare function formatDateTime(d: Date, fmt: DateFormatOption | undefined, locale?: string): string;
12
+ /**
13
+ * The value as a native input and a hidden form input carry it:
14
+ * `YYYY-MM-DD`, `YYYY-MM` or `YYYY`, the shapes `<input type="date">` and
15
+ * `<input type="month">` use. The year is padded to four digits, as those
16
+ * inputs require and as the `YYYY` token displays it. HTML has no such shape
17
+ * for a year before 1, so a date then is empty, as those inputs would make it.
18
+ */
19
+ export declare function toIsoValue(d: Date, granularity: DateGranularity): string;
20
+ /**
21
+ * Read a native `type="date"` or `type="month"` value back into a Date. HTML
22
+ * allows a year of four or more digits, as `toIsoValue` writes one past 9999.
23
+ */
24
+ export declare function fromIsoValue(s: string, granularity: DateGranularity): Date | null;
11
25
  /**
12
26
  * Derive the hour cycle (`'12'` or `'24'`) a display format will render, from
13
27
  * its first hour token: `h`/`hh` → 12-hour with meridiem, `H`/`HH` → 24-hour.
@@ -1,6 +1,15 @@
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
+ * Whether a key is Alt+ArrowDown or Alt+ArrowUp, which open and close a
6
+ * picker's popover. The calendar and the time wheels leave both to it rather
7
+ * than reading them as plain arrows.
8
+ */
9
+ export declare const isPopoverToggleKey: (e: {
10
+ altKey: boolean;
11
+ key: string;
12
+ }) => boolean;
4
13
  /** The unit a date picker selects: a day, a month or a year. */
5
14
  export type DateGranularity = 'day' | 'month' | 'year';
6
15
  /**
@@ -33,6 +42,10 @@ export interface PickerLabels {
33
42
  * the pointer or the keyboard is on, until it is picked.
34
43
  */
35
44
  rangePreviewEnd?: string;
45
+ /** Range picking: shown between the start and end inputs. */
46
+ rangeSeparator?: string;
47
+ /** Range picking: names the launcher and the popover. */
48
+ chooseDateRange?: string;
36
49
  hours?: string;
37
50
  minutes?: string;
38
51
  seconds?: string;
@@ -37,19 +37,28 @@ export interface UseSegmentedEntryParams {
37
37
  * every manual-entry commit; return true to reject the candidate value.
38
38
  */
39
39
  isBlocked?: (d: Date) => boolean;
40
+ /**
41
+ * Rejects a candidate only while the digits typed into its segment leave
42
+ * it unfinished, such as the first digits of a year. The digit stays in
43
+ * the segment and the next one tries again, so a value passing through a
44
+ * candidate it can't commit on the way to one it can costs nothing. A
45
+ * finished segment, an arrow step and parsed text answer to `isBlocked`
46
+ * alone.
47
+ */
48
+ isUnfinishedBlocked?: (d: Date) => boolean;
40
49
  disabled?: boolean;
41
50
  readOnly?: boolean;
42
51
  /** Allow segmented typing. When false, segment mode never engages. */
43
52
  editable?: boolean;
44
- /** Whether a popover exists; gates open-on-focus / click / ArrowDown. */
53
+ /** Whether a popover exists; gates open-on-focus / click / Alt+ArrowDown. */
45
54
  popover?: boolean;
46
55
  openOnFocus?: boolean;
47
56
  closeOnSelect?: boolean;
48
57
  isOpen: boolean;
49
58
  /**
50
59
  * The host's open-state setter. The hook asks it to open on focus, click
51
- * or ArrowDown, but not on the focus the popover's focus trap hands back
52
- * to the input as it closes, which is not the user arriving.
60
+ * or Alt+ArrowDown, but not on the focus the popover's focus trap hands
61
+ * back to the input as it closes, which is not the user arriving.
53
62
  */
54
63
  setOpen: (next: boolean) => void;
55
64
  inputRef: React.RefObject<HTMLInputElement | null>;
@@ -98,6 +98,10 @@ export { DateTimeInputBase } from './form/DateTimeInputBase.js';
98
98
  export type { DateTimeInputBaseProps } from './form/DateTimeInputBase.js';
99
99
  export { DateTimeInput } from './form/DateTimeInput.js';
100
100
  export type { DateTimeInputProps } from './form/DateTimeInput.js';
101
+ export { DateRangeInputBase } from './form/DateRangeInputBase.js';
102
+ export type { DateRangeInputBaseProps, DateRangeValue, } from './form/DateRangeInputBase.js';
103
+ export { DateRangeInput } from './form/DateRangeInput.js';
104
+ export type { DateRangeInputProps } from './form/DateRangeInput.js';
101
105
  export { useInsideField, useInsideControl } from './form/FormContext.js';
102
106
  export type { FormFieldProps } from './form/fieldProps.js';
103
107
  export * from './grid/Cell.js';