@cscfi/csc-ui 4.0.0-alpha.26 → 4.0.0-alpha.28
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/csc-ui.js +9514 -7086
- package/dist/custom-elements.json +6934 -4840
- package/dist/docs/c-date-picker/usage.md +190 -0
- package/dist/docs/c-number-field/usage.md +82 -0
- package/dist/docs/c-text-field/usage.md +106 -0
- package/dist/docs/c-time-picker/usage.md +143 -0
- package/dist/styles/css/tailwind-theme.css +1 -0
- package/dist/styles/css/tokens.css +10 -0
- package/dist/vscode.css-custom-data.json +140 -0
- package/dist/vscode.html-custom-data.json +302 -1
- package/dist/web-types.json +1132 -130
- package/dist-types/components/c-date-picker/CDatePicker.vue.d.ts +268 -0
- package/dist-types/components/c-date-picker/dates.d.ts +119 -0
- package/dist-types/components/c-number-field/CNumberField.vue.d.ts +153 -0
- package/dist-types/components/c-number-field/numbers.d.ts +42 -0
- package/dist-types/components/c-slider/CSlider.vue.d.ts +2 -2
- package/dist-types/components/c-text-field/CTextField.vue.d.ts +12 -2
- package/dist-types/components/c-time-picker/CTimePicker.vue.d.ts +199 -0
- package/dist-types/components/c-time-picker/times.d.ts +82 -0
- package/dist-types/index.d.ts +3 -0
- package/dist-types/shared/TypedField.vue.d.ts +40 -0
- package/dist-types/shared/inputMask.d.ts +106 -0
- package/dist-types/shared/useAnchoredPanel.d.ts +5 -2
- package/dist-types/shared/useTypedField.d.ts +103 -0
- package/dist-types/tag-name-map.d.ts +300 -2
- package/package.json +1 -1
|
@@ -0,0 +1,268 @@
|
|
|
1
|
+
import type { CFieldSize } from '../../types';
|
|
2
|
+
/** One entry of `disabled-dates`: an ISO date, or an inclusive `{ start, end }` span of them. */
|
|
3
|
+
export type CDatePickerDisabledDate = {
|
|
4
|
+
end: string;
|
|
5
|
+
start: string;
|
|
6
|
+
} | string;
|
|
7
|
+
export interface CDatePickerProps {
|
|
8
|
+
/**
|
|
9
|
+
* Make the value clearable
|
|
10
|
+
*/
|
|
11
|
+
clearable?: boolean;
|
|
12
|
+
/**
|
|
13
|
+
* Disable the field
|
|
14
|
+
*/
|
|
15
|
+
disabled?: boolean;
|
|
16
|
+
/**
|
|
17
|
+
* Dates that cannot be picked: ISO dates and inclusive `{ start, end }`
|
|
18
|
+
* spans. Arrays have no attribute form — bind as a DOM property
|
|
19
|
+
*/
|
|
20
|
+
disabledDates?: CDatePickerDisabledDate[];
|
|
21
|
+
/**
|
|
22
|
+
* Error message shown in place of the hint while the field is invalid
|
|
23
|
+
*
|
|
24
|
+
* @freeform
|
|
25
|
+
*/
|
|
26
|
+
errorMessage?: string;
|
|
27
|
+
/**
|
|
28
|
+
* First day of the week in the calendar, numbered like `Date.getDay()`:
|
|
29
|
+
* 0 = Sunday, 1 = Monday … 6 = Saturday
|
|
30
|
+
*
|
|
31
|
+
* @defaultable 1
|
|
32
|
+
*/
|
|
33
|
+
firstDayOfWeek?: CDatePickerWeekday;
|
|
34
|
+
/**
|
|
35
|
+
* How dates are shown and read from typing: a pattern of the tokens `d`,
|
|
36
|
+
* `dd`, `M`, `MM` and `yyyy` with any separators, e.g. `yyyy-MM-dd`
|
|
37
|
+
*
|
|
38
|
+
* @defaultable 'dd.MM.yyyy'
|
|
39
|
+
* @freeform
|
|
40
|
+
*/
|
|
41
|
+
format?: string;
|
|
42
|
+
/**
|
|
43
|
+
* Hide the hint and error messages
|
|
44
|
+
*
|
|
45
|
+
* @defaultable false
|
|
46
|
+
*/
|
|
47
|
+
hideDetails?: boolean;
|
|
48
|
+
/**
|
|
49
|
+
* Hint text for the field
|
|
50
|
+
*
|
|
51
|
+
* @freeform
|
|
52
|
+
*/
|
|
53
|
+
hint?: string;
|
|
54
|
+
/**
|
|
55
|
+
* Id of the element
|
|
56
|
+
*
|
|
57
|
+
* @freeform
|
|
58
|
+
*/
|
|
59
|
+
hostId?: string;
|
|
60
|
+
/**
|
|
61
|
+
* Predicate for dates that cannot be picked (weekends, say); receives an
|
|
62
|
+
* ISO date. Functions have no attribute form — bind as a DOM property
|
|
63
|
+
*/
|
|
64
|
+
isDateDisabled?: (iso: string) => boolean;
|
|
65
|
+
/**
|
|
66
|
+
* Element label
|
|
67
|
+
*
|
|
68
|
+
* @freeform
|
|
69
|
+
*/
|
|
70
|
+
label?: string;
|
|
71
|
+
/**
|
|
72
|
+
* Label on top of the field
|
|
73
|
+
*
|
|
74
|
+
* @defaultable false
|
|
75
|
+
*/
|
|
76
|
+
labelOnTop?: boolean;
|
|
77
|
+
/**
|
|
78
|
+
* The latest date that can be picked or typed, as an ISO date; also bounds
|
|
79
|
+
* the calendar's navigation
|
|
80
|
+
*
|
|
81
|
+
* @freeform
|
|
82
|
+
*/
|
|
83
|
+
max?: string;
|
|
84
|
+
/**
|
|
85
|
+
* The earliest date that can be picked or typed, as an ISO date; also
|
|
86
|
+
* bounds the calendar's navigation
|
|
87
|
+
*
|
|
88
|
+
* @freeform
|
|
89
|
+
*/
|
|
90
|
+
min?: string;
|
|
91
|
+
/**
|
|
92
|
+
* Input field name
|
|
93
|
+
*
|
|
94
|
+
* @freeform
|
|
95
|
+
*/
|
|
96
|
+
name?: string;
|
|
97
|
+
/**
|
|
98
|
+
* Placeholder of the input; the `format` pattern when empty
|
|
99
|
+
*
|
|
100
|
+
* @freeform
|
|
101
|
+
*/
|
|
102
|
+
placeholder?: string;
|
|
103
|
+
/**
|
|
104
|
+
* Pick a range: the value becomes `{ start, end }` and the field holds two
|
|
105
|
+
* inputs
|
|
106
|
+
*/
|
|
107
|
+
range?: boolean;
|
|
108
|
+
/**
|
|
109
|
+
* Set the field as required
|
|
110
|
+
*/
|
|
111
|
+
required?: boolean;
|
|
112
|
+
/**
|
|
113
|
+
* Shadow variant
|
|
114
|
+
*
|
|
115
|
+
* @defaultable false
|
|
116
|
+
*/
|
|
117
|
+
shadow?: boolean;
|
|
118
|
+
/**
|
|
119
|
+
* Show ISO 8601 week numbers beside the calendar rows (meaningful with a
|
|
120
|
+
* Monday week start)
|
|
121
|
+
*
|
|
122
|
+
* @defaultable false
|
|
123
|
+
*/
|
|
124
|
+
showWeekNumbers?: boolean;
|
|
125
|
+
/**
|
|
126
|
+
* Field height: the 52px default (the shared control height) or the 36px `small` box
|
|
127
|
+
*
|
|
128
|
+
* @defaultable 'default'
|
|
129
|
+
*/
|
|
130
|
+
size?: CFieldSize;
|
|
131
|
+
/**
|
|
132
|
+
* UI text overrides (i18n), merged over the names `Intl` gives for the
|
|
133
|
+
* page's `lang` and the English defaults. Objects have no attribute form —
|
|
134
|
+
* bind as a DOM property
|
|
135
|
+
*
|
|
136
|
+
* @defaultable {}
|
|
137
|
+
*/
|
|
138
|
+
texts?: CDatePickerTexts;
|
|
139
|
+
/**
|
|
140
|
+
* What the field picks: a calendar date, or a year and a month
|
|
141
|
+
* (`'YYYY-MM'`)
|
|
142
|
+
*/
|
|
143
|
+
type?: CDatePickerType;
|
|
144
|
+
/**
|
|
145
|
+
* Set the validity of the field
|
|
146
|
+
*/
|
|
147
|
+
valid?: boolean;
|
|
148
|
+
/**
|
|
149
|
+
* The date as an ISO `YYYY-MM-DD` string (an ISO `YYYY-MM` month under
|
|
150
|
+
* `type="month"`), or `{ start, end }` under `range`; `null` when empty
|
|
151
|
+
*/
|
|
152
|
+
value?: CDatePickerValue;
|
|
153
|
+
}
|
|
154
|
+
/** A date range: ISO `YYYY-MM-DD` ends (`YYYY-MM` under `type="month"`), either of which may be `null` while only one is typed. */
|
|
155
|
+
export interface CDatePickerRange {
|
|
156
|
+
/** The last day of the range, inclusive. */
|
|
157
|
+
end: null | string;
|
|
158
|
+
/** The first day of the range. */
|
|
159
|
+
start: null | string;
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* The text committed from the field, as typed: a string, or both ends'
|
|
163
|
+
* texts under `range`.
|
|
164
|
+
*/
|
|
165
|
+
export type CDatePickerText = {
|
|
166
|
+
end: string;
|
|
167
|
+
start: string;
|
|
168
|
+
} | string;
|
|
169
|
+
/**
|
|
170
|
+
* UI texts of `c-date-picker`, merged key by key over the names `Intl`
|
|
171
|
+
* gives for the page's `lang` and the English defaults. Weekday arrays are
|
|
172
|
+
* indexed like `Date.getDay()`: Sunday first.
|
|
173
|
+
*/
|
|
174
|
+
export interface CDatePickerTexts {
|
|
175
|
+
/** Accessible name of the dialog when the field has no label. */
|
|
176
|
+
chooseDate?: string;
|
|
177
|
+
/** Accessible label of the clear button. */
|
|
178
|
+
clearSelection?: string;
|
|
179
|
+
/** Accessible label of the close button in the fullscreen panel (narrow viewports). */
|
|
180
|
+
closePanel?: string;
|
|
181
|
+
/** A day's accessible name in the grid; receives the ISO date. */
|
|
182
|
+
date?: (iso: string) => string;
|
|
183
|
+
/** Accessible name of the end input under `range`. */
|
|
184
|
+
end?: string;
|
|
185
|
+
/** Label of the end's month step under `type="month"` and `range`; also the end input's name there. */
|
|
186
|
+
endMonth?: string;
|
|
187
|
+
/** Label of the end's year step under `type="month"` and `range`. */
|
|
188
|
+
endYear?: string;
|
|
189
|
+
/** Label of the month step under `type="month"`. */
|
|
190
|
+
month?: string;
|
|
191
|
+
/** Twelve month names, January first. */
|
|
192
|
+
months?: string[];
|
|
193
|
+
/** Twelve short month names, January first — shown on the month button. */
|
|
194
|
+
monthsShort?: string[];
|
|
195
|
+
/** Accessible label of the next-month arrow. */
|
|
196
|
+
nextMonth?: string;
|
|
197
|
+
/** Accessible label of the next-year arrow. */
|
|
198
|
+
nextYear?: string;
|
|
199
|
+
/** Accessible label of the calendar button. */
|
|
200
|
+
openCalendar?: string;
|
|
201
|
+
/** Announcement once a range's first day is picked; receives that day's name. */
|
|
202
|
+
pendingStart?: (date: string) => string;
|
|
203
|
+
/** Accessible label of the previous-month arrow. */
|
|
204
|
+
previousMonth?: string;
|
|
205
|
+
/** Accessible label of the previous-year arrow. */
|
|
206
|
+
previousYear?: string;
|
|
207
|
+
/** Accessible label of the month button and the month list. */
|
|
208
|
+
selectMonth?: string;
|
|
209
|
+
/** Accessible label of the year button and the year list. */
|
|
210
|
+
selectYear?: string;
|
|
211
|
+
/** Accessible name of the start input under `range`. */
|
|
212
|
+
start?: string;
|
|
213
|
+
/** Label of the start's month step under `type="month"` and `range`; also the start input's name there. */
|
|
214
|
+
startMonth?: string;
|
|
215
|
+
/** Label of the start's year step under `type="month"` and `range`. */
|
|
216
|
+
startYear?: string;
|
|
217
|
+
/** Appended to the accessible name of a day that cannot be picked. */
|
|
218
|
+
unavailable?: string;
|
|
219
|
+
/** Seven weekday names, Sunday first. */
|
|
220
|
+
weekdays?: string[];
|
|
221
|
+
/** Seven short weekday names, Sunday first — the grid's column heads. */
|
|
222
|
+
weekdaysShort?: string[];
|
|
223
|
+
/** Accessible name of the week-number column. */
|
|
224
|
+
weekNumber?: string;
|
|
225
|
+
/** Label of the year step under `type="month"`. */
|
|
226
|
+
year?: string;
|
|
227
|
+
}
|
|
228
|
+
/** What `c-date-picker` picks: a calendar date, or a year and a month (ADR-0063). */
|
|
229
|
+
export type CDatePickerType = 'date' | 'month';
|
|
230
|
+
/**
|
|
231
|
+
* Value of `c-date-picker`: an ISO `YYYY-MM-DD` string (`YYYY-MM` under
|
|
232
|
+
* `type="month"`), a {@link CDatePickerRange} under `range`, or `null` when
|
|
233
|
+
* empty.
|
|
234
|
+
*/
|
|
235
|
+
export type CDatePickerValue = CDatePickerRange | null | string;
|
|
236
|
+
/** A day of the week numbered like `Date.getDay()`: 0 = Sunday … 6 = Saturday. */
|
|
237
|
+
export type CDatePickerWeekday = 0 | 1 | 2 | 3 | 4 | 5 | 6;
|
|
238
|
+
declare const _default: typeof __VLS_export;
|
|
239
|
+
export default _default;
|
|
240
|
+
declare const __VLS_export: import("vue").DefineComponent<CDatePickerProps, {
|
|
241
|
+
badInput: import("vue").ComputedRef<boolean>;
|
|
242
|
+
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<CDatePickerProps> & Readonly<{}>, {
|
|
243
|
+
label: string;
|
|
244
|
+
value: CDatePickerValue;
|
|
245
|
+
type: CDatePickerType;
|
|
246
|
+
name: string;
|
|
247
|
+
required: boolean;
|
|
248
|
+
disabled: boolean;
|
|
249
|
+
size: CFieldSize;
|
|
250
|
+
clearable: boolean;
|
|
251
|
+
errorMessage: string;
|
|
252
|
+
hideDetails: boolean;
|
|
253
|
+
hint: string;
|
|
254
|
+
hostId: string;
|
|
255
|
+
labelOnTop: boolean;
|
|
256
|
+
placeholder: string;
|
|
257
|
+
shadow: boolean;
|
|
258
|
+
texts: CDatePickerTexts;
|
|
259
|
+
valid: boolean;
|
|
260
|
+
disabledDates: CDatePickerDisabledDate[];
|
|
261
|
+
firstDayOfWeek: CDatePickerWeekday;
|
|
262
|
+
format: string;
|
|
263
|
+
isDateDisabled: (iso: string) => boolean;
|
|
264
|
+
max: string;
|
|
265
|
+
min: string;
|
|
266
|
+
range: boolean;
|
|
267
|
+
showWeekNumbers: boolean;
|
|
268
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Calendar-date helpers for `c-date-picker` (ADR-0057). Pure functions over
|
|
3
|
+
* ISO `YYYY-MM-DD` strings: no local `Date` is ever constructed, so no
|
|
4
|
+
* timezone can shift a day. Arithmetic goes through `Date.UTC`.
|
|
5
|
+
*/
|
|
6
|
+
import type { MaskSlot } from '../../shared/inputMask';
|
|
7
|
+
import type { CDatePickerDisabledDate } from './CDatePicker.vue';
|
|
8
|
+
/** A calendar date split into its parts; `m` is 1–12. */
|
|
9
|
+
export interface CDatePickerYmd {
|
|
10
|
+
d: number;
|
|
11
|
+
m: number;
|
|
12
|
+
y: number;
|
|
13
|
+
}
|
|
14
|
+
export declare const daysInMonth: (y: number, m: number) => number;
|
|
15
|
+
export declare const toIso: ({ d, m, y }: CDatePickerYmd) => string;
|
|
16
|
+
/** The parts of a well-formed, real ISO calendar date; `null` otherwise. */
|
|
17
|
+
export declare const fromIso: (iso: unknown) => CDatePickerYmd | null;
|
|
18
|
+
export declare const isIso: (iso: unknown) => iso is string;
|
|
19
|
+
/** 0 = Sunday … 6 = Saturday, like `Date.getDay()`. */
|
|
20
|
+
export declare const dayOfWeek: (iso: string) => number;
|
|
21
|
+
export declare const addDays: (iso: string, days: number) => string;
|
|
22
|
+
/** Move by whole months, clamping the day to the target month's length. */
|
|
23
|
+
export declare const addMonths: (iso: string, months: number) => string;
|
|
24
|
+
/** The ISO 8601 week number (weeks start on Monday; week 1 holds the year's first Thursday). */
|
|
25
|
+
export declare const isoWeek: (iso: string) => number;
|
|
26
|
+
/**
|
|
27
|
+
* The ISO week number of one grid row: the week of the row's Thursday,
|
|
28
|
+
* which holds most of the row's days under any week start. It depends on
|
|
29
|
+
* the row's dates alone, so a week split across two months carries the
|
|
30
|
+
* same number in both. `''` for a row with no dates.
|
|
31
|
+
*/
|
|
32
|
+
export declare const rowWeek: (row: readonly (null | string)[], firstDayOfWeek: number) => "" | number;
|
|
33
|
+
/** `YYYY-MM` of a date. */
|
|
34
|
+
export declare const monthOf: (iso: string) => string;
|
|
35
|
+
/** The first day of the month `YYYY-MM`. */
|
|
36
|
+
export declare const firstOfMonth: (month: string) => string;
|
|
37
|
+
/** Today in the browser's local calendar, as ISO. */
|
|
38
|
+
export declare const todayIso: () => string;
|
|
39
|
+
/**
|
|
40
|
+
* The weeks of a month as rows of seven days starting on `firstDayOfWeek`
|
|
41
|
+
* (0 = Sunday). Days of the neighbouring months are `null`. As many rows as
|
|
42
|
+
* the month spans — four to six — so the calendar is as tall as its month.
|
|
43
|
+
*/
|
|
44
|
+
export declare const monthMatrix: (month: string, firstDayOfWeek: number) => (null | string)[][];
|
|
45
|
+
/**
|
|
46
|
+
* Whether `pattern` is usable: exactly one day, one month and one year
|
|
47
|
+
* token. Anything else falls back to the built-in pattern.
|
|
48
|
+
*/
|
|
49
|
+
export declare const isValidPattern: (pattern: string) => boolean;
|
|
50
|
+
export declare const formatDate: (iso: string, pattern: string) => string;
|
|
51
|
+
/**
|
|
52
|
+
* Read typed text against a pattern (ADR-0057). Lenient: a day or month
|
|
53
|
+
* takes one or two digits whatever its token, and any run of `.`, `/`, `-`
|
|
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.
|
|
56
|
+
*/
|
|
57
|
+
export declare const parseDate: (text: string, pattern: string) => null | string;
|
|
58
|
+
/**
|
|
59
|
+
* The input mask typing follows under a pattern (ADR-0059): a day or month
|
|
60
|
+
* takes one or two digits whatever its token, closing early on a typed
|
|
61
|
+
* separator or on a first digit no two-digit value starts with (a day 4–9,
|
|
62
|
+
* a month 2–9); the year takes four. A separator of the pattern also accepts
|
|
63
|
+
* any of `. / - space` typed in its place and shows as the pattern's own.
|
|
64
|
+
*/
|
|
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;
|
|
82
|
+
export interface CDatePickerDisabling {
|
|
83
|
+
isDateDisabled?: (iso: string) => boolean;
|
|
84
|
+
list?: readonly CDatePickerDisabledDate[];
|
|
85
|
+
max?: null | string;
|
|
86
|
+
min?: null | string;
|
|
87
|
+
}
|
|
88
|
+
/** Outside `min` / `max`: unreachable, not merely unpickable. */
|
|
89
|
+
export declare const isOutOfRange: (iso: string, { max, min }: CDatePickerDisabling) => boolean;
|
|
90
|
+
/** Disabled when `min`/`max`, the list or the predicate says so (ADR-0057). */
|
|
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;
|
|
106
|
+
/** The name texts `Intl` can supply for a language. */
|
|
107
|
+
export interface CDatePickerIntlNames {
|
|
108
|
+
date: (iso: string) => string;
|
|
109
|
+
months: string[];
|
|
110
|
+
monthsShort: string[];
|
|
111
|
+
weekdays: string[];
|
|
112
|
+
weekdaysShort: string[];
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Month and weekday names for `lang` from `Intl.DateTimeFormat` — the
|
|
116
|
+
* fallback under `texts` (ADR-0057). Weekday arrays are indexed like
|
|
117
|
+
* `Date.getDay()` (0 = Sunday). `null` without a language or without `Intl`.
|
|
118
|
+
*/
|
|
119
|
+
export declare const intlNames: (lang: string) => CDatePickerIntlNames | null;
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
import type { CFieldSize } from '../../types';
|
|
2
|
+
export interface CNumberFieldProps {
|
|
3
|
+
/**
|
|
4
|
+
* The most fraction digits the field takes; `0` makes it an integer field
|
|
5
|
+
*
|
|
6
|
+
* @defaultable 0
|
|
7
|
+
*/
|
|
8
|
+
decimals?: number;
|
|
9
|
+
/**
|
|
10
|
+
* The decimal separator. Empty follows the page's `lang` (`,` for `fi`, `.` for `en`)
|
|
11
|
+
*
|
|
12
|
+
* @defaultable ''
|
|
13
|
+
* @freeform one character
|
|
14
|
+
*/
|
|
15
|
+
decimalSeparator?: string;
|
|
16
|
+
/**
|
|
17
|
+
* Disable the field
|
|
18
|
+
*/
|
|
19
|
+
disabled?: boolean;
|
|
20
|
+
/**
|
|
21
|
+
* Error message shown in place of the hint while the field is invalid
|
|
22
|
+
*
|
|
23
|
+
* @freeform
|
|
24
|
+
*/
|
|
25
|
+
errorMessage?: string;
|
|
26
|
+
/**
|
|
27
|
+
* Pad the fraction to exactly `decimals` digits when the field is left (`12,5` → `12,50`)
|
|
28
|
+
*
|
|
29
|
+
* @defaultable false
|
|
30
|
+
*/
|
|
31
|
+
fixedDecimals?: boolean;
|
|
32
|
+
/**
|
|
33
|
+
* The thousands separator. Empty follows the page's `lang` (a space for `fi`, `,` for `en`)
|
|
34
|
+
*
|
|
35
|
+
* @defaultable ''
|
|
36
|
+
* @freeform one character
|
|
37
|
+
*/
|
|
38
|
+
groupSeparator?: string;
|
|
39
|
+
/**
|
|
40
|
+
* Hide the hint and error messages
|
|
41
|
+
*
|
|
42
|
+
* @defaultable false
|
|
43
|
+
*/
|
|
44
|
+
hideDetails?: boolean;
|
|
45
|
+
/**
|
|
46
|
+
* Hint text for the field
|
|
47
|
+
*
|
|
48
|
+
* @freeform
|
|
49
|
+
*/
|
|
50
|
+
hint?: string;
|
|
51
|
+
/**
|
|
52
|
+
* Id of the input
|
|
53
|
+
*
|
|
54
|
+
* @freeform
|
|
55
|
+
*/
|
|
56
|
+
hostId?: string;
|
|
57
|
+
/**
|
|
58
|
+
* Label of the field
|
|
59
|
+
*
|
|
60
|
+
* @freeform
|
|
61
|
+
*/
|
|
62
|
+
label?: string;
|
|
63
|
+
/**
|
|
64
|
+
* Label on top of the field
|
|
65
|
+
*
|
|
66
|
+
* @defaultable false
|
|
67
|
+
*/
|
|
68
|
+
labelOnTop?: boolean;
|
|
69
|
+
/**
|
|
70
|
+
* The largest number in range; a larger one is kept and reported as out of range
|
|
71
|
+
*/
|
|
72
|
+
max?: null | number;
|
|
73
|
+
/**
|
|
74
|
+
* The smallest number in range; a smaller one is kept and reported as out of range. At `0` or above, the minus key is ignored
|
|
75
|
+
*/
|
|
76
|
+
min?: null | number;
|
|
77
|
+
/**
|
|
78
|
+
* Name of the input
|
|
79
|
+
*
|
|
80
|
+
* @freeform
|
|
81
|
+
*/
|
|
82
|
+
name?: string;
|
|
83
|
+
/**
|
|
84
|
+
* Placeholder of the input
|
|
85
|
+
*
|
|
86
|
+
* @freeform
|
|
87
|
+
*/
|
|
88
|
+
placeholder?: string;
|
|
89
|
+
/**
|
|
90
|
+
* Mark as readonly
|
|
91
|
+
*/
|
|
92
|
+
readonly?: boolean;
|
|
93
|
+
/**
|
|
94
|
+
* Set the field as required
|
|
95
|
+
*/
|
|
96
|
+
required?: boolean;
|
|
97
|
+
/**
|
|
98
|
+
* Shadow variant of the field
|
|
99
|
+
*
|
|
100
|
+
* @defaultable false
|
|
101
|
+
*/
|
|
102
|
+
shadow?: boolean;
|
|
103
|
+
/**
|
|
104
|
+
* Field height: the 52px default (the shared control height) or the 36px `small` box
|
|
105
|
+
*
|
|
106
|
+
* @defaultable 'default'
|
|
107
|
+
*/
|
|
108
|
+
size?: CFieldSize;
|
|
109
|
+
/**
|
|
110
|
+
* Set the validity of the field
|
|
111
|
+
*/
|
|
112
|
+
valid?: boolean;
|
|
113
|
+
/**
|
|
114
|
+
* The number, or `null` when the field is empty. A string is read as the number it spells, and `''` as empty — what an attribute, or a plain `v-model` holding `null`, writes; the field always emits a number or `null`
|
|
115
|
+
*/
|
|
116
|
+
value?: null | number | string;
|
|
117
|
+
}
|
|
118
|
+
declare const _default: typeof __VLS_export;
|
|
119
|
+
export default _default;
|
|
120
|
+
declare const __VLS_export: __VLS_WithSlots<import("vue").DefineComponent<CNumberFieldProps, {
|
|
121
|
+
outOfRange: import("vue").ComputedRef<boolean>;
|
|
122
|
+
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<CNumberFieldProps> & Readonly<{}>, {
|
|
123
|
+
label: string;
|
|
124
|
+
value: null | number | string;
|
|
125
|
+
name: string;
|
|
126
|
+
required: boolean;
|
|
127
|
+
disabled: boolean;
|
|
128
|
+
size: CFieldSize;
|
|
129
|
+
errorMessage: string;
|
|
130
|
+
hideDetails: boolean;
|
|
131
|
+
hint: string;
|
|
132
|
+
hostId: string;
|
|
133
|
+
labelOnTop: boolean;
|
|
134
|
+
placeholder: string;
|
|
135
|
+
shadow: boolean;
|
|
136
|
+
valid: boolean;
|
|
137
|
+
max: null | number;
|
|
138
|
+
min: null | number;
|
|
139
|
+
decimals: number;
|
|
140
|
+
decimalSeparator: string;
|
|
141
|
+
fixedDecimals: boolean;
|
|
142
|
+
groupSeparator: string;
|
|
143
|
+
readonly: boolean;
|
|
144
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, {
|
|
145
|
+
pre?: (props: {}) => any;
|
|
146
|
+
} & {
|
|
147
|
+
post?: (props: {}) => any;
|
|
148
|
+
}>;
|
|
149
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
150
|
+
new (): {
|
|
151
|
+
$slots: S;
|
|
152
|
+
};
|
|
153
|
+
};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The number core behind `c-number-field` (ADR-0060): the page language's
|
|
3
|
+
* separators, conforming typed text to grouped digits with its caret, and
|
|
4
|
+
* reading and formatting the number. Pure — no DOM, no component state.
|
|
5
|
+
*/
|
|
6
|
+
import type { ConformResult } from '../../shared/inputMask';
|
|
7
|
+
export interface CNumberFieldConform extends ConformResult {
|
|
8
|
+
/** The number the text reads as; `null` when it holds no digit. */
|
|
9
|
+
value: null | number;
|
|
10
|
+
}
|
|
11
|
+
export interface CNumberFieldFormat extends CNumberFieldSeparators {
|
|
12
|
+
/** Whether a leading minus is kept (`false` when `min` ≥ 0). */
|
|
13
|
+
allowNegative: boolean;
|
|
14
|
+
/** The most fraction digits; `0` for an integer field. */
|
|
15
|
+
decimals: number;
|
|
16
|
+
}
|
|
17
|
+
export interface CNumberFieldSeparators {
|
|
18
|
+
decimal: string;
|
|
19
|
+
group: string;
|
|
20
|
+
}
|
|
21
|
+
/** More integer digits than this stop being exact as a JS number. */
|
|
22
|
+
export declare const MAX_INTEGER_DIGITS = 15;
|
|
23
|
+
/**
|
|
24
|
+
* The group and decimal separators `Intl.NumberFormat` uses for `lang`
|
|
25
|
+
* (`fi` → non-breaking space and `,`; `en` → `,` and `.`), else the fallback.
|
|
26
|
+
*/
|
|
27
|
+
export declare const numberSeparators: (lang: string) => CNumberFieldSeparators;
|
|
28
|
+
/**
|
|
29
|
+
* Conform typed text to the number format: keep a leading minus, digits
|
|
30
|
+
* and one decimal separator (up to `decimals` fraction digits and
|
|
31
|
+
* `MAX_INTEGER_DIGITS` integer digits, leading zeros dropped), and regroup
|
|
32
|
+
* the integer digits in threes. The caret keeps its place among the typed
|
|
33
|
+
* characters; group separators are inserted ones (`tokenAt` false).
|
|
34
|
+
*/
|
|
35
|
+
export declare const conformNumber: (text: string, caret: number, format: CNumberFieldFormat) => CNumberFieldConform;
|
|
36
|
+
/** The number `text` reads as under `format`; `null` when it holds no digit. */
|
|
37
|
+
export declare const readNumber: (text: string, format: CNumberFieldFormat) => null | number;
|
|
38
|
+
/**
|
|
39
|
+
* Display a number: rounded to `decimals`, grouped, with trailing fraction
|
|
40
|
+
* zeros kept only when `fixed`. A non-finite value or `null` shows as empty.
|
|
41
|
+
*/
|
|
42
|
+
export declare const formatNumber: (value: null | number | undefined, format: CNumberFieldFormat, fixed?: boolean) => string;
|
|
@@ -95,11 +95,11 @@ declare const __VLS_export: import("vue").DefineComponent<CSliderProps, {}, {},
|
|
|
95
95
|
disabled: boolean;
|
|
96
96
|
hostId: string;
|
|
97
97
|
hostName: string;
|
|
98
|
+
max: number | string;
|
|
99
|
+
min: number | string;
|
|
98
100
|
ariaLabelInternal: string;
|
|
99
101
|
disableTooltip: boolean;
|
|
100
102
|
labels: boolean;
|
|
101
|
-
max: number | string;
|
|
102
|
-
min: number | string;
|
|
103
103
|
segments: number | string;
|
|
104
104
|
step: number | string;
|
|
105
105
|
ticks: boolean;
|
|
@@ -71,6 +71,12 @@ export interface CTextFieldProps {
|
|
|
71
71
|
* @defaultable false
|
|
72
72
|
*/
|
|
73
73
|
labelOnTop?: boolean;
|
|
74
|
+
/**
|
|
75
|
+
* Input mask the typed text follows: `#` a digit, `A` a letter, `*` a letter or a digit, `\` escapes the next character, `[…]` wraps a trailing optional section, anything else is a literal. Applies to a single-line `text`, `tel` or `search` field
|
|
76
|
+
*
|
|
77
|
+
* @freeform a mask pattern, e.g. `+358 ## ### ####`
|
|
78
|
+
*/
|
|
79
|
+
mask?: string;
|
|
74
80
|
/**
|
|
75
81
|
* Maximum value on a numeric input
|
|
76
82
|
*
|
|
@@ -168,8 +174,12 @@ export interface CTextFieldProps {
|
|
|
168
174
|
export type CTextFieldType = 'date' | 'email' | 'number' | 'password' | 'search' | 'tel' | 'text' | 'url';
|
|
169
175
|
declare const _default: typeof __VLS_export;
|
|
170
176
|
export default _default;
|
|
171
|
-
declare const __VLS_export: __VLS_WithSlots<import("vue").DefineComponent<CTextFieldProps, {
|
|
177
|
+
declare const __VLS_export: __VLS_WithSlots<import("vue").DefineComponent<CTextFieldProps, {
|
|
178
|
+
maskComplete: import("vue").ComputedRef<boolean>;
|
|
179
|
+
unmaskedValue: import("vue").ComputedRef<string>;
|
|
180
|
+
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<CTextFieldProps> & Readonly<{}>, {
|
|
172
181
|
label: string;
|
|
182
|
+
mask: string;
|
|
173
183
|
value: string;
|
|
174
184
|
type: CTextFieldType;
|
|
175
185
|
name: string;
|
|
@@ -187,10 +197,10 @@ declare const __VLS_export: __VLS_WithSlots<import("vue").DefineComponent<CTextF
|
|
|
187
197
|
valid: boolean;
|
|
188
198
|
max: null | number;
|
|
189
199
|
min: null | number;
|
|
200
|
+
readonly: boolean;
|
|
190
201
|
step: null | number;
|
|
191
202
|
autocomplete: string;
|
|
192
203
|
automaticCapitalize: CTextFieldAutocapitalize;
|
|
193
|
-
readonly: boolean;
|
|
194
204
|
rows: number;
|
|
195
205
|
trimWhitespace: boolean;
|
|
196
206
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, {
|