@cscfi/csc-ui 4.0.0-alpha.27 → 4.0.0-alpha.29

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.
@@ -52,8 +52,7 @@ export declare const formatDate: (iso: string, pattern: string) => string;
52
52
  * Read typed text against a pattern (ADR-0057). Lenient: a day or month
53
53
  * takes one or two digits whatever its token, and any run of `.`, `/`, `-`
54
54
  * or spaces separates the fields; the year must have four digits. Returns
55
- * the ISO date, or `null` when the text names no real date. Text with no
56
- * separators at all is read by the pattern's digit widths (`ddMMyyyy`).
55
+ * the ISO date, or `null` when the text names no real date.
57
56
  */
58
57
  export declare const parseDate: (text: string, pattern: string) => null | string;
59
58
  /**
@@ -64,6 +63,22 @@ export declare const parseDate: (text: string, pattern: string) => null | string
64
63
  * any of `. / - space` typed in its place and shows as the pattern's own.
65
64
  */
66
65
  export declare const compileDateMask: (pattern: string) => MaskSlot[];
66
+ /** A well-formed ISO `YYYY-MM` month. */
67
+ export declare const isIsoMonth: (month: unknown) => month is string;
68
+ /** The month an ISO month or ISO date names; `null` for anything else. */
69
+ export declare const toMonth: (value: unknown) => null | string;
70
+ /** Whether `pattern` is a usable month pattern: one month and one year token, no day. */
71
+ export declare const isValidMonthPattern: (pattern: string) => boolean;
72
+ /**
73
+ * The month pattern of a date pattern: the day token goes, with the
74
+ * separator after it — or before it when the day comes last (`dd.MM.yyyy` →
75
+ * `MM.yyyy`, `yyyy-MM-dd` → `yyyy-MM`). A pattern that is already a month
76
+ * pattern is kept; anything else falls back to `MM.yyyy`.
77
+ */
78
+ export declare const monthPattern: (pattern: string) => string;
79
+ export declare const formatMonth: (month: string, pattern: string) => string;
80
+ /** Read typed text against a month pattern, as leniently as `parseDate`. */
81
+ export declare const parseMonth: (text: string, pattern: string) => null | string;
67
82
  export interface CDatePickerDisabling {
68
83
  isDateDisabled?: (iso: string) => boolean;
69
84
  list?: readonly CDatePickerDisabledDate[];
@@ -74,6 +89,20 @@ export interface CDatePickerDisabling {
74
89
  export declare const isOutOfRange: (iso: string, { max, min }: CDatePickerDisabling) => boolean;
75
90
  /** Disabled when `min`/`max`, the list or the predicate says so (ADR-0057). */
76
91
  export declare const isDisabledDate: (iso: string, rules: CDatePickerDisabling) => boolean;
92
+ /** Outside `min` / `max` read by their months (ADR-0063). */
93
+ export declare const isMonthOutOfRange: (month: string, { max, min }: CDatePickerDisabling) => boolean;
94
+ /**
95
+ * A month is disabled when it is out of range, or when the list and the
96
+ * predicate rule out every one of its days (ADR-0063). Stops at the first
97
+ * enabled day, so a sparse predicate costs one call a month.
98
+ */
99
+ export declare const isDisabledMonth: (month: string, rules: CDatePickerDisabling) => boolean;
100
+ /**
101
+ * Month mode's month step (ADR-0063): month `m` (1–12) is out when it is
102
+ * disabled in every year of `[from, to]`, so no pick leads to an empty year
103
+ * step. Stops at the first year that takes it.
104
+ */
105
+ export declare const isMonthDisabledEverywhere: (m: number, [from, to]: readonly number[], rules: CDatePickerDisabling) => boolean;
77
106
  /** The name texts `Intl` can supply for a language. */
78
107
  export interface CDatePickerIntlNames {
79
108
  date: (iso: string) => string;
@@ -106,6 +106,18 @@ export interface CNumberFieldProps {
106
106
  * @defaultable 'default'
107
107
  */
108
108
  size?: CFieldSize;
109
+ /**
110
+ * The spacing of the grid the step buttons and arrow keys move along, counted from `min` (or `0`)
111
+ *
112
+ * @defaultable 1
113
+ */
114
+ step?: number;
115
+ /**
116
+ * UI text overrides (i18n), merged over the English defaults. Objects have no attribute form — bind as a DOM property
117
+ *
118
+ * @defaultable {}
119
+ */
120
+ texts?: CNumberFieldTexts;
109
121
  /**
110
122
  * Set the validity of the field
111
123
  */
@@ -115,6 +127,13 @@ export interface CNumberFieldProps {
115
127
  */
116
128
  value?: null | number | string;
117
129
  }
130
+ /** UI texts of `c-number-field`, merged key by key over the English defaults. */
131
+ export interface CNumberFieldTexts {
132
+ /** Accessible label of the step-down button. */
133
+ decrease?: string;
134
+ /** Accessible label of the step-up button. */
135
+ increase?: string;
136
+ }
118
137
  declare const _default: typeof __VLS_export;
119
138
  export default _default;
120
139
  declare const __VLS_export: __VLS_WithSlots<import("vue").DefineComponent<CNumberFieldProps, {
@@ -133,6 +152,7 @@ declare const __VLS_export: __VLS_WithSlots<import("vue").DefineComponent<CNumbe
133
152
  labelOnTop: boolean;
134
153
  placeholder: string;
135
154
  shadow: boolean;
155
+ texts: CNumberFieldTexts;
136
156
  valid: boolean;
137
157
  max: null | number;
138
158
  min: null | number;
@@ -141,6 +161,7 @@ declare const __VLS_export: __VLS_WithSlots<import("vue").DefineComponent<CNumbe
141
161
  fixedDecimals: boolean;
142
162
  groupSeparator: string;
143
163
  readonly: boolean;
164
+ step: number;
144
165
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, {
145
166
  pre?: (props: {}) => any;
146
167
  } & {
@@ -40,3 +40,19 @@ export declare const readNumber: (text: string, format: CNumberFieldFormat) => n
40
40
  * zeros kept only when `fixed`. A non-finite value or `null` shows as empty.
41
41
  */
42
42
  export declare const formatNumber: (value: null | number | undefined, format: CNumberFieldFormat, fixed?: boolean) => string;
43
+ export interface CNumberFieldStepOptions {
44
+ /** The most fraction digits; a stepped number is rounded to them. */
45
+ decimals: number;
46
+ max: null | number;
47
+ min: null | number;
48
+ /** The spacing of the grid, counted from `min` (or `0`); not a positive number reads as `1`. */
49
+ step: number;
50
+ }
51
+ /**
52
+ * Move a number `count` points along its step grid (ADR-0064): to the next
53
+ * point of `base + k·step` above it (`direction` 1) or below it (-1), where
54
+ * `base` is `min`, or `0`. The result is rounded to `decimals` and held in
55
+ * `min`–`max`: a move that would pass a bound lands on it, and a number at or
56
+ * beyond the bound in `direction` stays put. An empty field counts from `0`.
57
+ */
58
+ export declare const stepNumber: (current: null | number, direction: -1 | 1, options: CNumberFieldStepOptions, count?: number) => null | number;
@@ -97,11 +97,11 @@ declare const __VLS_export: import("vue").DefineComponent<CSliderProps, {}, {},
97
97
  hostName: string;
98
98
  max: number | string;
99
99
  min: number | string;
100
+ step: number | string;
100
101
  ariaLabelInternal: string;
101
102
  disableTooltip: boolean;
102
103
  labels: boolean;
103
104
  segments: number | string;
104
- step: number | string;
105
105
  ticks: boolean;
106
106
  unit: string;
107
107
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
@@ -0,0 +1,210 @@
1
+ import type { CFieldSize } from '../../types';
2
+ export interface CTimePickerProps {
3
+ /**
4
+ * Make the value clearable
5
+ */
6
+ clearable?: boolean;
7
+ /**
8
+ * Disable the field
9
+ */
10
+ disabled?: boolean;
11
+ /**
12
+ * Error message shown in place of the hint while the field is invalid
13
+ *
14
+ * @freeform
15
+ */
16
+ errorMessage?: string;
17
+ /**
18
+ * How times are shown and read from typing: a pattern of the tokens `H`,
19
+ * `HH` (24-hour), `h`, `hh` (12-hour, with the period `a`) and `mm` with
20
+ * any separators, e.g. `HH:mm` or `h:mm a`
21
+ *
22
+ * @defaultable 'HH.mm'
23
+ * @freeform
24
+ */
25
+ format?: string;
26
+ /**
27
+ * Hide the hint and error messages
28
+ *
29
+ * @defaultable false
30
+ */
31
+ hideDetails?: boolean;
32
+ /**
33
+ * Hint text for the field
34
+ *
35
+ * @freeform
36
+ */
37
+ hint?: string;
38
+ /**
39
+ * Id of the element
40
+ *
41
+ * @freeform
42
+ */
43
+ hostId?: string;
44
+ /**
45
+ * Element label
46
+ *
47
+ * @freeform
48
+ */
49
+ label?: string;
50
+ /**
51
+ * Label on top of the field
52
+ *
53
+ * @defaultable false
54
+ */
55
+ labelOnTop?: boolean;
56
+ /**
57
+ * The latest time that can be picked or typed, as an ISO `HH:mm` time
58
+ *
59
+ * @freeform
60
+ */
61
+ max?: string;
62
+ /**
63
+ * The earliest time that can be picked or typed, as an ISO `HH:mm` time;
64
+ * a `min` after `max` is invalid and both are ignored
65
+ *
66
+ * @freeform
67
+ */
68
+ min?: string;
69
+ /**
70
+ * Minutes between the minute column's rows; typed times need not fall on
71
+ * the step
72
+ */
73
+ minuteStep?: number;
74
+ /**
75
+ * Input field name
76
+ *
77
+ * @freeform
78
+ */
79
+ name?: string;
80
+ /**
81
+ * Placeholder of the input; the `format` pattern when empty
82
+ *
83
+ * @freeform
84
+ */
85
+ placeholder?: string;
86
+ /**
87
+ * Pick a range: the value becomes `{ start, end }` and the field holds two
88
+ * inputs
89
+ */
90
+ range?: boolean;
91
+ /**
92
+ * Set the field as required
93
+ */
94
+ required?: boolean;
95
+ /**
96
+ * Shadow variant
97
+ *
98
+ * @defaultable false
99
+ */
100
+ shadow?: boolean;
101
+ /**
102
+ * Show a Now button under the columns that commits the current time
103
+ *
104
+ * @defaultable false
105
+ */
106
+ showNow?: boolean;
107
+ /**
108
+ * Field height: the 52px default (the shared control height) or the 36px `small` box
109
+ *
110
+ * @defaultable 'default'
111
+ */
112
+ size?: CFieldSize;
113
+ /**
114
+ * UI text overrides (i18n), merged over the AM/PM texts `Intl` gives for
115
+ * the page's `lang` and the English defaults. Objects have no attribute
116
+ * form — bind as a DOM property
117
+ *
118
+ * @defaultable {}
119
+ */
120
+ texts?: CTimePickerTexts;
121
+ /**
122
+ * Set the validity of the field
123
+ */
124
+ valid?: boolean;
125
+ /**
126
+ * The time as an ISO `HH:mm` string on a 24-hour clock, or `{ start, end }`
127
+ * under `range`; `null` when empty
128
+ */
129
+ value?: CTimePickerValue;
130
+ }
131
+ /** A time range: ISO `HH:mm` ends, either of which may be `null` while only one is typed; an end before the start spans midnight. */
132
+ export interface CTimePickerRange {
133
+ /** The end of the range; earlier than the start for an overnight range. */
134
+ end: null | string;
135
+ /** The start of the range. */
136
+ start: null | string;
137
+ }
138
+ /**
139
+ * The text committed from the field, as typed: a string, or both ends'
140
+ * texts under `range`.
141
+ */
142
+ export type CTimePickerText = {
143
+ end: string;
144
+ start: string;
145
+ } | string;
146
+ /**
147
+ * UI texts of `c-time-picker`, merged key by key over the AM/PM texts
148
+ * `Intl` gives for the page's `lang` and the English defaults.
149
+ */
150
+ export interface CTimePickerTexts {
151
+ /** The period before noon in a 12-hour `format`. */
152
+ am?: string;
153
+ /** Accessible name of the dialog when the field has no label. */
154
+ chooseTime?: string;
155
+ /** Accessible label of the clear button. */
156
+ clearSelection?: string;
157
+ /** Accessible label of the close button in the fullscreen panel (narrow viewports). */
158
+ closePanel?: string;
159
+ /** Label of the Done button in the fullscreen panel (narrow viewports). */
160
+ done?: string;
161
+ /** Name of the end input and the end tab under `range`. */
162
+ end?: string;
163
+ /** Accessible name of the hour column. */
164
+ hours?: string;
165
+ /** Accessible name of the minute column. */
166
+ minutes?: string;
167
+ /** Label of the Now button (`show-now`). */
168
+ now?: string;
169
+ /** Accessible label of the clock button. */
170
+ openClock?: string;
171
+ /** Accessible name of the AM/PM column. */
172
+ period?: string;
173
+ /** The period from noon in a 12-hour `format`. */
174
+ pm?: string;
175
+ /** Name of the start input and the start tab under `range`. */
176
+ start?: string;
177
+ }
178
+ /**
179
+ * Value of `c-time-picker`: an ISO `HH:mm` string, a
180
+ * {@link CTimePickerRange} under `range`, or `null` when empty.
181
+ */
182
+ export type CTimePickerValue = CTimePickerRange | null | string;
183
+ declare const _default: typeof __VLS_export;
184
+ export default _default;
185
+ declare const __VLS_export: import("vue").DefineComponent<CTimePickerProps, {
186
+ badInput: import("vue").ComputedRef<boolean>;
187
+ }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<CTimePickerProps> & Readonly<{}>, {
188
+ label: string;
189
+ value: CTimePickerValue;
190
+ name: string;
191
+ required: boolean;
192
+ disabled: boolean;
193
+ size: CFieldSize;
194
+ clearable: boolean;
195
+ errorMessage: string;
196
+ hideDetails: boolean;
197
+ hint: string;
198
+ hostId: string;
199
+ labelOnTop: boolean;
200
+ placeholder: string;
201
+ shadow: boolean;
202
+ texts: CTimePickerTexts;
203
+ valid: boolean;
204
+ format: string;
205
+ max: string;
206
+ min: string;
207
+ range: boolean;
208
+ minuteStep: number;
209
+ showNow: boolean;
210
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
@@ -0,0 +1,82 @@
1
+ /**
2
+ * Time-of-day helpers for `c-time-picker` (ADR-0061). Pure functions over
3
+ * ISO `HH:mm` strings on a 24-hour clock — no seconds, no date, no zone.
4
+ * Arithmetic works in minutes since midnight.
5
+ */
6
+ import type { MaskSlot } from '../../shared/inputMask';
7
+ /** The two period texts of a 12-hour format, as shown. */
8
+ export interface CTimePickerPeriods {
9
+ am: string;
10
+ pm: string;
11
+ }
12
+ /** `min` / `max` in minutes since midnight; `null` where unbounded. */
13
+ export interface CTimePickerBounds {
14
+ max: null | number;
15
+ min: null | number;
16
+ }
17
+ export declare const isTime: (value: unknown) => value is string;
18
+ export declare const toMinutes: (time: string) => number;
19
+ export declare const fromMinutes: (minutes: number) => string;
20
+ /** The current local time, as ISO. */
21
+ export declare const nowTime: () => string;
22
+ /**
23
+ * Whether `pattern` is usable: one hour token then `mm`, a literal between
24
+ * them, and the period `a` exactly when the hour is 12-hour (`h`, `hh`) —
25
+ * before or after the time. No other letters. Anything else falls back to
26
+ * the built-in pattern.
27
+ */
28
+ export declare const isValidPattern: (pattern: string) => boolean;
29
+ /** Whether a valid pattern shows a 12-hour clock with a period. */
30
+ export declare const isTwelveHour: (pattern: string) => boolean;
31
+ /** Whether a valid pattern pads the hour to two digits. */
32
+ export declare const padsHour: (pattern: string) => boolean;
33
+ /** The hour as its column row shows it under `pattern`: `0`–`23`, or `12`, `1`–`11`. */
34
+ export declare const hourLabel: (hour24: number, pattern: string) => string;
35
+ export declare const formatTime: (time: string, pattern: string, periods: CTimePickerPeriods) => string;
36
+ /**
37
+ * Read typed text as a time (ADR-0061). Lenient: any run of `.`, `:` or
38
+ * spaces separates the hour from the minutes; a bare hour reads as on the
39
+ * hour (`9` → `09:00`); three or four digits split as hour and minutes
40
+ * (`930` → `09:30`); a minute of one digit is that minute (`9.3` →
41
+ * `09:03`). A period — the resolved AM/PM texts or English `a` / `p` —
42
+ * makes the hour 12-hour whatever the pattern; a 12-hour pattern also
43
+ * takes a 24-hour time, and reads an hour without a period as AM. Returns
44
+ * the ISO time, or `null`.
45
+ */
46
+ export declare const parseTime: (text: string, pattern: string, periods: CTimePickerPeriods) => null | string;
47
+ /**
48
+ * The input mask typing follows under a pattern (ADR-0061, ADR-0059): the
49
+ * hour and the minutes take one or two digits, closing early on a typed
50
+ * separator or on a first digit no two-digit value starts with (an hour
51
+ * 3–9, 2–9 on a 12-hour clock; a minute 6–9); the period is a word slot
52
+ * over the resolved AM/PM texts, so `p` shows the whole PM text. A
53
+ * separator of the pattern also accepts any of `. : space` typed in its
54
+ * place and shows as the pattern's own.
55
+ */
56
+ export declare const compileTimeMask: (pattern: string, periods: CTimePickerPeriods) => MaskSlot[];
57
+ /**
58
+ * `min` / `max` read as minutes. A bound that is not an ISO time is
59
+ * unbounded; `min` after `max` is invalid — `null` — not an overnight wrap.
60
+ */
61
+ export declare const readBounds: (min: unknown, max: unknown) => CTimePickerBounds | null;
62
+ export declare const inBounds: (minutes: number, b: CTimePickerBounds) => boolean;
63
+ export declare const clampToBounds: (minutes: number, b: CTimePickerBounds) => number;
64
+ /** Whether no minute of the hour (0–23) is inside the bounds. */
65
+ export declare const hourDisabled: (hour: number, b: CTimePickerBounds) => boolean;
66
+ /** Whether no minute of the half day is inside the bounds. */
67
+ export declare const periodDisabled: (period: "am" | "pm", b: CTimePickerBounds) => boolean;
68
+ /** The hour column's hours (0–23) in row order: `0…23`, or `1…11, 12` of one half day. */
69
+ export declare const hourRows: (twelve: boolean, pm?: boolean) => number[];
70
+ /**
71
+ * The minute column's minutes: every `step` from 0, plus `current` sorted in
72
+ * when it is off the step (ADR-0061: a step shapes the column, never the
73
+ * value). A step that is not a positive integer is 1.
74
+ */
75
+ export declare const minuteRows: (step: number, current: null | number) => number[];
76
+ /** The minute row nearest `minute` on the step, never past the last row. */
77
+ export declare const roundToStep: (minute: number, step: number) => number;
78
+ /**
79
+ * The AM/PM texts for `lang` from `Intl.DateTimeFormat`'s `dayPeriod` — the
80
+ * fallback under `texts` (ADR-0061). `null` without a language or `Intl`.
81
+ */
82
+ export declare const intlPeriods: (lang: string) => CTimePickerPeriods | null;
@@ -4,11 +4,11 @@ export type { CButtonGroupProps, CButtonGroupSize, CButtonGroupValue, } from './
4
4
  export type { CButtonProps, CButtonSize, CButtonType, } from './components/c-button/CButton.vue';
5
5
  export type { CCardActionsAlign, CCardActionsJustify, CCardActionsProps, } from './components/c-card-actions/CCardActions.vue';
6
6
  export type { CDataTableAlign, CDataTableCellContent, CDataTableCellContext, CDataTableColumn, CDataTableColumnExpansion, CDataTableColumnPin, CDataTableExpandedContext, CDataTableFooterContext, CDataTableProps, CDataTableRow, CDataTableSelectionMode, CDataTableSort, CDataTableSortDirection, CDataTableTexts, } from './components/c-data-table/CDataTable.vue';
7
- export type { CDatePickerDisabledDate, CDatePickerProps, CDatePickerRange, CDatePickerText, CDatePickerTexts, CDatePickerValue, CDatePickerWeekday, } from './components/c-date-picker/CDatePicker.vue';
7
+ export type { CDatePickerDisabledDate, CDatePickerProps, CDatePickerRange, CDatePickerText, CDatePickerTexts, CDatePickerType, CDatePickerValue, CDatePickerWeekday, } from './components/c-date-picker/CDatePicker.vue';
8
8
  export type { CIconButtonProps, CIconButtonSize, } from './components/c-icon-button/CIconButton.vue';
9
9
  export type { CLoginCardActionsAlign, CLoginCardActionsJustify, CLoginCardActionsProps, } from './components/c-login-card-actions/CLoginCardActions.vue';
10
10
  export type { CLoginCardBlendMode, CLoginCardProps, } from './components/c-login-card/CLoginCard.vue';
11
- export type { CNumberFieldProps } from './components/c-number-field/CNumberField.vue';
11
+ export type { CNumberFieldProps, CNumberFieldTexts, } from './components/c-number-field/CNumberField.vue';
12
12
  export type { CPaginationOptions, CPaginationProps, CPaginationSize, } from './components/c-pagination/CPagination.vue';
13
13
  export type { CPopoverProps } from './components/c-popover/CPopover.vue';
14
14
  export type { CProgressCircleProps } from './components/c-progress-circle/CProgressCircle.vue';
@@ -19,6 +19,7 @@ export type { CTabsJustify, CTabsProps } from './components/c-tabs/CTabs.vue';
19
19
  export type { CTagProps, CTagSize } from './components/c-tag/CTag.vue';
20
20
  export type { CTagsProps, CTagsSize } from './components/c-tags/CTags.vue';
21
21
  export type { CTextFieldAutocapitalize, CTextFieldProps, CTextFieldType, } from './components/c-text-field/CTextField.vue';
22
+ export type { CTimePickerProps, CTimePickerRange, CTimePickerText, CTimePickerTexts, CTimePickerValue, } from './components/c-time-picker/CTimePicker.vue';
22
23
  export type { CToastProps } from './components/c-toast/CToast.vue';
23
24
  export type { CToastsHorizontal, CToastsProps, CToastsVertical, } from './components/c-toasts/CToasts.vue';
24
25
  export type { CTooltipProps } from './components/c-tooltip/CTooltip.vue';
@@ -0,0 +1,46 @@
1
+ import type { CFieldSize } from '../types';
2
+ import { type TypedField } from './useTypedField';
3
+ type __VLS_Props = {
4
+ /** The `anchor-name` style from `useAnchoredPanel`. */
5
+ anchorStyle: string;
6
+ /** Accessible label of the clear button. */
7
+ clearLabel: string;
8
+ clearable: boolean;
9
+ disabled: boolean;
10
+ errorMessage: string;
11
+ /** The `useTypedField` state this field renders. */
12
+ field: TypedField;
13
+ hideDetails: boolean;
14
+ hint: string;
15
+ inputId: string;
16
+ /** The virtual keyboard the inputs ask for. */
17
+ inputmode: 'numeric' | 'text';
18
+ label: string;
19
+ labelOnTop: boolean;
20
+ name: string;
21
+ /** Whether the host's panel is open — the field stays active. */
22
+ open: boolean;
23
+ required: boolean;
24
+ shadow: boolean;
25
+ size: CFieldSize;
26
+ valid: boolean;
27
+ };
28
+ declare var __VLS_20: {
29
+ buttonSize: "x-small";
30
+ iconSize: number;
31
+ } | {
32
+ buttonSize: "default";
33
+ iconSize: number;
34
+ };
35
+ type __VLS_Slots = {} & {
36
+ trigger?: (props: typeof __VLS_20) => any;
37
+ };
38
+ declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
39
+ declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
40
+ declare const _default: typeof __VLS_export;
41
+ export default _default;
42
+ type __VLS_WithSlots<T, S> = T & {
43
+ new (): {
44
+ $slots: S;
45
+ };
46
+ };
@@ -12,6 +12,11 @@
12
12
  * plain text. A typed character that is the next literal (or one of its
13
13
  * `aliases`) is consumed as that literal.
14
14
  *
15
+ * A **word** slot takes one of a few words — a time's AM/PM period — typed
16
+ * by its first letters: once they name one word, the slot shows the whole
17
+ * word and closes. Its characters all count as typed, and a deleting edit
18
+ * that leaves a word partial clears it, so one Backspace removes it.
19
+ *
15
20
  * An **optional section** (`[…]`, trailing only) holds optional slots: its
16
21
  * tokens take zero or one character (`min: 0`) and its literals are marked
17
22
  * `optional`. Completeness and the mask guide count required slots only.
@@ -49,6 +54,10 @@ export type MaskSlot = {
49
54
  max: number;
50
55
  /** `0` for an optional token. */
51
56
  min: number;
57
+ } | {
58
+ kind: 'word';
59
+ /** The words the slot takes, matched case-insensitively and shown as written here. */
60
+ words: string[];
52
61
  };
53
62
  /**
54
63
  * Compile a `c-text-field` mask: `#` a digit, `A` a letter, `*` a letter or
@@ -0,0 +1,103 @@
1
+ /**
2
+ * The typed half of a picker whose value field holds editable text
3
+ * (ADR-0057, ADR-0058, ADR-0059): one input, or a start and an end input in
4
+ * one field box under `range`. Text is masked while typed and read by the
5
+ * codec only on Enter or blur; text that names no usable value is kept as
6
+ * typed and flags **bad input** (CONTEXT.md). Programmatic values re-sync the
7
+ * text and never emit; commits emit through `emitModelChange`.
8
+ *
9
+ * Generic over the value's codec, so `c-date-picker` and `c-time-picker`
10
+ * share one commit model. The anatomy lives in `TypedField.vue`, which binds
11
+ * the element refs returned here.
12
+ */
13
+ import { type Ref } from 'vue';
14
+ import { type MaskSlot } from './inputMask';
15
+ export type TypedFieldEnd = 'end' | 'start';
16
+ export interface TypedFieldEnds {
17
+ end: null | string;
18
+ start: null | string;
19
+ }
20
+ /** The text committed from the field, as typed: both ends' texts under `range`. */
21
+ export type TypedFieldText = {
22
+ end: string;
23
+ start: string;
24
+ } | string;
25
+ export interface TypedFieldCodec {
26
+ /** The committed value shown as text under `pattern`. */
27
+ format(value: string, pattern: string): string;
28
+ /** Whether a value set from outside is one this field holds (anything else is "no value"). */
29
+ isValue(value: unknown): value is string;
30
+ /** A parsed value that can still not be committed (disabled, out of range) — bad input. */
31
+ isUsable(value: string): boolean;
32
+ /** Typed text read under `pattern`; `null` when it names no value. */
33
+ parse(text: string, pattern: string): null | string;
34
+ }
35
+ export interface UseTypedFieldOptions {
36
+ codec: TypedFieldCodec;
37
+ /** The custom element host: the model events dispatch from it. */
38
+ host: HTMLElement | null;
39
+ /** The field label (props.label). */
40
+ label: () => string;
41
+ /** Whether the label rests on top of the field (the resolved app default). */
42
+ labelOnTop: Readonly<Ref<boolean>>;
43
+ /** The typing mask derived from `pattern`. */
44
+ mask: Readonly<Ref<MaskSlot[]>>;
45
+ /** The end inputs' accessible names under `range`. */
46
+ names: () => {
47
+ end: string;
48
+ start: string;
49
+ };
50
+ /** Fired on every commit of typed text, as typed — the host's `change:text`. */
51
+ onTextCommit: (text: TypedFieldText) => void;
52
+ /** Alt+↓ in an input, after committing its text: open the panel. */
53
+ onOpenRequest: () => void;
54
+ /** The display and parse pattern. */
55
+ pattern: Readonly<Ref<string>>;
56
+ /** The consumer's placeholder (props.placeholder). */
57
+ placeholder: () => string;
58
+ /** Whether the field holds a start and an end. */
59
+ range: Readonly<Ref<boolean>>;
60
+ /** What a committed range with its start after its end becomes: swapped, or kept as typed. */
61
+ reversed: 'keep' | 'swap';
62
+ /** The host's `value` prop. */
63
+ value: () => unknown;
64
+ }
65
+ export declare const useTypedField: (options: UseTypedFieldOptions) => {
66
+ anchor: import("vue").ShallowRef<HTMLElement | null, HTMLElement | null>;
67
+ badEnd: Ref<boolean, boolean>;
68
+ badInput: import("vue").ComputedRef<boolean>;
69
+ badStart: Ref<boolean, boolean>;
70
+ commitAll: () => void;
71
+ commitText: (end: TypedFieldEnd) => void;
72
+ commitValue: (next: TypedFieldEnds) => void;
73
+ endInput: import("vue").ShallowRef<HTMLInputElement | null, HTMLInputElement | null>;
74
+ endText: Ref<string, string>;
75
+ ends: Ref<{
76
+ end: null | string;
77
+ start: null | string;
78
+ }, TypedFieldEnds | {
79
+ end: null | string;
80
+ start: null | string;
81
+ }>;
82
+ field: import("vue").ShallowRef<HTMLElement | null, HTMLElement | null>;
83
+ focused: Ref<boolean, boolean>;
84
+ hasContent: import("vue").ComputedRef<boolean>;
85
+ hasText: import("vue").ComputedRef<boolean>;
86
+ inputLabel: (end: TypedFieldEnd) => string | undefined;
87
+ inputOf: (end: TypedFieldEnd) => HTMLInputElement | null;
88
+ lastInput: Ref<TypedFieldEnd, TypedFieldEnd>;
89
+ onClear: (event?: Event) => void;
90
+ onFocusOut: (event: FocusEvent) => void;
91
+ onKeyDown: (end: TypedFieldEnd, event: KeyboardEvent) => void;
92
+ onTextInput: (end: TypedFieldEnd, event: Event) => void;
93
+ placeholder: import("vue").ComputedRef<string | undefined>;
94
+ range: Readonly<Ref<boolean, boolean>>;
95
+ showSeparator: import("vue").ComputedRef<boolean>;
96
+ startInput: import("vue").ShallowRef<HTMLInputElement | null, HTMLInputElement | null>;
97
+ startText: Ref<string, string>;
98
+ startWidth: import("vue").ComputedRef<{
99
+ width: string;
100
+ } | undefined>;
101
+ };
102
+ /** The state `TypedField.vue` renders. */
103
+ export type TypedField = ReturnType<typeof useTypedField>;