@cscfi/csc-ui 4.0.0-alpha.25 → 4.0.0-alpha.27
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 +9463 -7899
- package/dist/custom-elements.json +3146 -1738
- package/dist/docs/c-date-picker/usage.md +141 -0
- package/dist/docs/c-number-field/usage.md +82 -0
- package/dist/docs/c-text-field/usage.md +106 -0
- package/dist/styles/css/tokens.css +2 -0
- package/dist/vscode.css-custom-data.json +92 -2
- package/dist/vscode.html-custom-data.json +207 -2
- package/dist/web-types.json +761 -85
- package/dist-types/components/c-date-picker/CDatePicker.vue.d.ts +247 -0
- package/dist-types/components/c-date-picker/dates.d.ts +90 -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/index.d.ts +2 -0
- package/dist-types/shared/inputMask.d.ts +97 -0
- package/dist-types/shared/reducedMotion.d.ts +10 -0
- package/dist-types/shared/useAnchoredPanel.d.ts +5 -2
- package/dist-types/tag-name-map.d.ts +198 -2
- package/package.json +1 -1
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Input masks (CONTEXT.md "Input mask"; ADR-0059): conform typed text to a
|
|
3
|
+
* pattern as it is typed. One engine behind `c-text-field`'s `mask` and
|
|
4
|
+
* `c-date-picker`'s `format`.
|
|
5
|
+
*
|
|
6
|
+
* A mask compiles to a list of slots. A **token** slot takes one to `max`
|
|
7
|
+
* characters its `accepts` predicate allows — a `c-text-field` token takes
|
|
8
|
+
* exactly one; a date part takes one or two digits, and closes early on a
|
|
9
|
+
* typed separator or a first digit no longer value can start. A **literal**
|
|
10
|
+
* slot is a fixed character, inserted lazily: only when a later token
|
|
11
|
+
* character arrives, so an empty field stays `''` and Backspace behaves like
|
|
12
|
+
* plain text. A typed character that is the next literal (or one of its
|
|
13
|
+
* `aliases`) is consumed as that literal.
|
|
14
|
+
*
|
|
15
|
+
* An **optional section** (`[…]`, trailing only) holds optional slots: its
|
|
16
|
+
* tokens take zero or one character (`min: 0`) and its literals are marked
|
|
17
|
+
* `optional`. Completeness and the mask guide count required slots only.
|
|
18
|
+
*/
|
|
19
|
+
export interface MaskResult {
|
|
20
|
+
/** The caret position in `text`. */
|
|
21
|
+
caret: number;
|
|
22
|
+
/** Whether every required token slot is filled. */
|
|
23
|
+
complete: boolean;
|
|
24
|
+
/**
|
|
25
|
+
* What the mask still asks for after `text` — the **mask guide**: each
|
|
26
|
+
* unfilled required token drawn as `_`, literals as themselves; optional
|
|
27
|
+
* slots are never drawn. `''` once complete.
|
|
28
|
+
*/
|
|
29
|
+
rest: string;
|
|
30
|
+
/** The conformed text. */
|
|
31
|
+
text: string;
|
|
32
|
+
/** Per character of `text`: whether it fills a token slot (not a literal). */
|
|
33
|
+
tokenAt: boolean[];
|
|
34
|
+
/** Only the characters filling token slots. */
|
|
35
|
+
unmasked: string;
|
|
36
|
+
}
|
|
37
|
+
export type MaskSlot = {
|
|
38
|
+
/** Other typed characters that stand for this literal. */
|
|
39
|
+
aliases?: string;
|
|
40
|
+
kind: 'literal';
|
|
41
|
+
/** Part of an optional section: never drawn in the guide, never appended. */
|
|
42
|
+
optional?: boolean;
|
|
43
|
+
text: string;
|
|
44
|
+
} | {
|
|
45
|
+
accepts: (ch: string) => boolean;
|
|
46
|
+
/** Closes the slot early once its characters so far are `value`. */
|
|
47
|
+
closesAfter?: (value: string) => boolean;
|
|
48
|
+
kind: 'token';
|
|
49
|
+
max: number;
|
|
50
|
+
/** `0` for an optional token. */
|
|
51
|
+
min: number;
|
|
52
|
+
};
|
|
53
|
+
/**
|
|
54
|
+
* Compile a `c-text-field` mask: `#` a digit, `A` a letter, `*` a letter or
|
|
55
|
+
* a digit, `\` escapes the next character, `[…]` wraps a trailing optional
|
|
56
|
+
* section; everything else is a literal. Returns `null` for a mask that
|
|
57
|
+
* breaks the section rules: a nested, unclosed or stray bracket, or anything
|
|
58
|
+
* but another section after the first one.
|
|
59
|
+
*/
|
|
60
|
+
export declare const compileMask: (pattern: string) => MaskSlot[] | null;
|
|
61
|
+
/** Say once per pattern, page-wide, that a mask was ignored as invalid. */
|
|
62
|
+
export declare const warnInvalidMask: (tag: string, pattern: string) => void;
|
|
63
|
+
/** Whether every token of a mask takes only digits (a numeric keyboard fits). */
|
|
64
|
+
export declare const isNumericMask: (pattern: string) => boolean;
|
|
65
|
+
/**
|
|
66
|
+
* Conform `text` to `slots`, mapping `caret` (a position in `text`) onto the
|
|
67
|
+
* result. Characters that fit no slot are dropped. `deleting` marks an edit
|
|
68
|
+
* that removed text: trailing literals are then trimmed, so Backspace never
|
|
69
|
+
* sticks on a separator. Otherwise literals that end the mask are appended
|
|
70
|
+
* once the last token is filled.
|
|
71
|
+
*/
|
|
72
|
+
export declare const conformMask: (slots: MaskSlot[], text: string, caret?: number, deleting?: boolean) => MaskResult;
|
|
73
|
+
/** Rewrites text to its conformed form, mapping a caret position onto it. */
|
|
74
|
+
export type Conformer<R extends ConformResult = ConformResult> = (text: string, caret?: number, deleting?: boolean) => R;
|
|
75
|
+
/** The part of a conform result the caret machinery needs. */
|
|
76
|
+
export interface ConformResult {
|
|
77
|
+
caret: number;
|
|
78
|
+
text: string;
|
|
79
|
+
/** Per character of `text`: whether it is typed content (not an inserted literal or separator). */
|
|
80
|
+
tokenAt: boolean[];
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Conform an `<input>` after a native `input` event: rewrite its text and
|
|
84
|
+
* caret in place and return the result. `previous` is the text shown before
|
|
85
|
+
* the edit — a Backspace (Delete) that only removed an inserted character (a
|
|
86
|
+
* literal, a group separator) removes the typed character before (after) it
|
|
87
|
+
* instead. Returns `null`, leaving the input untouched, during IME
|
|
88
|
+
* composition, or on a paste or drop when `skipPaste` is set (the date picker
|
|
89
|
+
* reads pasted text leniently instead).
|
|
90
|
+
*/
|
|
91
|
+
export declare const applyConform: <R extends ConformResult>(input: HTMLInputElement, event: Event, conform: Conformer<R>, previous: string, { skipPaste }?: {
|
|
92
|
+
skipPaste?: boolean | undefined;
|
|
93
|
+
}) => null | R;
|
|
94
|
+
/** `applyConform` over mask slots. */
|
|
95
|
+
export declare const applyMask: (input: HTMLInputElement, event: Event, slots: MaskSlot[], previous: string, options?: {
|
|
96
|
+
skipPaste?: boolean;
|
|
97
|
+
}) => MaskResult | null;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The OS-level reduced-motion preference (CONTEXT.md "Reduced motion",
|
|
3
|
+
* ADR-0057). CSS motion honours it from the shared utility sheet; this is the
|
|
4
|
+
* read for motion a script drives — the ripple, smooth strip scrolling, the
|
|
5
|
+
* tabs indicator, the modal keyframes. Read at the moment of use, not once at
|
|
6
|
+
* mount, so a preference toggled while the page is open is picked up.
|
|
7
|
+
*
|
|
8
|
+
* Returns false where `matchMedia` is missing (SSR, a bare test runtime).
|
|
9
|
+
*/
|
|
10
|
+
export declare const prefersReducedMotion: () => boolean;
|
|
@@ -2,8 +2,9 @@
|
|
|
2
2
|
* Anchored field panel (CONTEXT.md "Autocomplete", "Tree select", "Top
|
|
3
3
|
* layer", "Fullscreen panel"; ADR-0008, ADR-0009, ADR-0047, ADR-0050): the
|
|
4
4
|
* lifecycle shared by the value-selection fields that keep a readonly value
|
|
5
|
-
* field in place and open a native popover panel — `c-autocomplete
|
|
6
|
-
* `c-tree-select
|
|
5
|
+
* field in place and open a native popover panel — `c-autocomplete`,
|
|
6
|
+
* `c-tree-select` and `c-date-picker` (whose field is editable and whose
|
|
7
|
+
* calendar keeps its own width: `matchWidth: false`, ADR-0058). One panel, two layouts: **anchored** under the field, or
|
|
7
8
|
* — on a **narrow viewport** — a **fullscreen panel** covering the viewport.
|
|
8
9
|
*
|
|
9
10
|
* What it owns:
|
|
@@ -87,6 +88,8 @@ export interface UseAnchoredPanelOptions {
|
|
|
87
88
|
fullscreen?: Readonly<Ref<boolean>>;
|
|
88
89
|
/** The custom element host: light dismiss keeps gestures whose composed path includes it; it is what the page lock keeps interactive. */
|
|
89
90
|
host: HTMLElement | null;
|
|
91
|
+
/** Pin the anchored panel's width to the anchor's (default `true`). `false` lets the card size the panel — a calendar keeps its own width whatever the field's. */
|
|
92
|
+
matchWidth?: boolean;
|
|
90
93
|
/** Runs inside the native `toggle` handler once closed, before focus returns. */
|
|
91
94
|
onClosed?: () => void;
|
|
92
95
|
/** Runs inside the native `toggle` handler once open, after the fallback positioning / page lock and the dismiss listener — the consumer's open sequence goes here. */
|
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
import type { CAutocompleteFilter, CAutocompleteItem, CAutocompleteTexts, CAutocompleteValue } from './components/c-autocomplete/CAutocomplete.vue';
|
|
13
13
|
import type { CButtonGroupValue } from './components/c-button-group/CButtonGroup.vue';
|
|
14
14
|
import type { CDataTableCellContent, CDataTableColumn, CDataTableExpandedContext, CDataTableRow, CDataTableSort, CDataTableTexts } from './components/c-data-table/CDataTable.vue';
|
|
15
|
+
import type { CDatePickerDisabledDate, CDatePickerText, CDatePickerTexts, CDatePickerValue } from './components/c-date-picker/CDatePicker.vue';
|
|
15
16
|
import type { CPaginationOptions } from './components/c-pagination/CPagination.vue';
|
|
16
17
|
import type { CSelectTexts, CSelectValue } from './components/c-select/CSelect.vue';
|
|
17
18
|
import type { CTreeSelectFilter, CTreeSelectItem, CTreeSelectTexts, CTreeSelectValue } from './components/c-tree-select/CTreeSelect.vue';
|
|
@@ -514,6 +515,121 @@ export interface CDataTableElement extends Omit<HTMLElement, 'autohide' | 'colum
|
|
|
514
515
|
removeEventListener<K extends keyof CDataTableElementEventMap>(type: K, listener: (this: CDataTableElement, ev: CDataTableElementEventMap[K]) => void, options?: boolean | EventListenerOptions): void;
|
|
515
516
|
removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
|
|
516
517
|
}
|
|
518
|
+
/** Events dispatched by `<c-date-picker>`. */
|
|
519
|
+
export interface CDatePickerElementEventMap {
|
|
520
|
+
/**
|
|
521
|
+
* Fired when the value changes — a day or range is picked, typed text is
|
|
522
|
+
* committed, or the field is cleared — carrying the new value: an ISO
|
|
523
|
+
* date, `{ start, end }` under `range`, or `null`.
|
|
524
|
+
*/
|
|
525
|
+
change: CustomEvent<CDatePickerValue>;
|
|
526
|
+
/**
|
|
527
|
+
* Fired with the displayed month as `YYYY-MM` whenever it changes, and
|
|
528
|
+
* when the panel opens — the signal to load that month's `disabled-dates`.
|
|
529
|
+
*/
|
|
530
|
+
'change:month': CustomEvent<string>;
|
|
531
|
+
/**
|
|
532
|
+
* Fired on every commit of typed text (Enter or leaving the input) with the
|
|
533
|
+
* text as typed — `{ start, end }` under `range`. Read `badInput` to tell
|
|
534
|
+
* whether it named a date that can be picked.
|
|
535
|
+
*/
|
|
536
|
+
'change:text': CustomEvent<CDatePickerText>;
|
|
537
|
+
/**
|
|
538
|
+
* Native bubbling input event dispatched alongside every value change so a
|
|
539
|
+
* plain `v-model` stays in sync. Carries no detail.
|
|
540
|
+
*/
|
|
541
|
+
input: CustomEvent<void>;
|
|
542
|
+
/** Fired alongside `change` with the same detail — the `v-model` contract. */
|
|
543
|
+
'update:value': CustomEvent<CDatePickerValue>;
|
|
544
|
+
}
|
|
545
|
+
/** A date field that takes a typed date, or opens a calendar panel for picking one, or a start and end date under `range`. */
|
|
546
|
+
export interface CDatePickerElement extends Omit<HTMLElement, 'clearable' | 'disabled' | 'disabledDates' | 'errorMessage' | 'firstDayOfWeek' | 'format' | 'hideDetails' | 'hint' | 'hostId' | 'isDateDisabled' | 'label' | 'labelOnTop' | 'max' | 'min' | 'name' | 'placeholder' | 'range' | 'required' | 'shadow' | 'showWeekNumbers' | 'size' | 'texts' | 'valid' | 'value'> {
|
|
547
|
+
/** Make the value clearable */
|
|
548
|
+
clearable?: boolean;
|
|
549
|
+
/** Disable the field */
|
|
550
|
+
disabled?: boolean;
|
|
551
|
+
/**
|
|
552
|
+
* Dates that cannot be picked: ISO dates and inclusive `{ start, end }`
|
|
553
|
+
* spans. Arrays have no attribute form — bind as a DOM property
|
|
554
|
+
*/
|
|
555
|
+
disabledDates?: CDatePickerDisabledDate[];
|
|
556
|
+
/** Error message shown in place of the hint while the field is invalid */
|
|
557
|
+
errorMessage?: string;
|
|
558
|
+
/**
|
|
559
|
+
* First day of the week in the calendar, numbered like `Date.getDay()`:
|
|
560
|
+
* 0 = Sunday, 1 = Monday … 6 = Saturday
|
|
561
|
+
*/
|
|
562
|
+
firstDayOfWeek?: 0 | 1 | 2 | 3 | 4 | 5 | 6;
|
|
563
|
+
/**
|
|
564
|
+
* How dates are shown and read from typing: a pattern of the tokens `d`,
|
|
565
|
+
* `dd`, `M`, `MM` and `yyyy` with any separators, e.g. `yyyy-MM-dd`
|
|
566
|
+
*/
|
|
567
|
+
format?: string;
|
|
568
|
+
/** Hide the hint and error messages */
|
|
569
|
+
hideDetails?: boolean;
|
|
570
|
+
/** Hint text for the field */
|
|
571
|
+
hint?: string;
|
|
572
|
+
/** Id of the element */
|
|
573
|
+
hostId?: string;
|
|
574
|
+
/**
|
|
575
|
+
* Predicate for dates that cannot be picked (weekends, say); receives an
|
|
576
|
+
* ISO date. Functions have no attribute form — bind as a DOM property
|
|
577
|
+
*/
|
|
578
|
+
isDateDisabled?: (iso: string) => boolean;
|
|
579
|
+
/** Element label */
|
|
580
|
+
label?: string;
|
|
581
|
+
/** Label on top of the field */
|
|
582
|
+
labelOnTop?: boolean;
|
|
583
|
+
/**
|
|
584
|
+
* The latest date that can be picked or typed, as an ISO date; also bounds
|
|
585
|
+
* the calendar's navigation
|
|
586
|
+
*/
|
|
587
|
+
max?: string;
|
|
588
|
+
/**
|
|
589
|
+
* The earliest date that can be picked or typed, as an ISO date; also
|
|
590
|
+
* bounds the calendar's navigation
|
|
591
|
+
*/
|
|
592
|
+
min?: string;
|
|
593
|
+
/** Input field name */
|
|
594
|
+
name?: string;
|
|
595
|
+
/** Placeholder of the input; the `format` pattern when empty */
|
|
596
|
+
placeholder?: string;
|
|
597
|
+
/**
|
|
598
|
+
* Pick a range: the value becomes `{ start, end }` and the field holds two
|
|
599
|
+
* inputs
|
|
600
|
+
*/
|
|
601
|
+
range?: boolean;
|
|
602
|
+
/** Set the field as required */
|
|
603
|
+
required?: boolean;
|
|
604
|
+
/** Shadow variant */
|
|
605
|
+
shadow?: boolean;
|
|
606
|
+
/**
|
|
607
|
+
* Show ISO 8601 week numbers beside the calendar rows (meaningful with a
|
|
608
|
+
* Monday week start)
|
|
609
|
+
*/
|
|
610
|
+
showWeekNumbers?: boolean;
|
|
611
|
+
/** Field height: the 52px default (the shared control height) or the 36px `small` box */
|
|
612
|
+
size?: 'default' | 'small';
|
|
613
|
+
/**
|
|
614
|
+
* UI text overrides (i18n), merged over the names `Intl` gives for the
|
|
615
|
+
* page's `lang` and the English defaults. Objects have no attribute form —
|
|
616
|
+
* bind as a DOM property
|
|
617
|
+
*/
|
|
618
|
+
texts?: CDatePickerTexts;
|
|
619
|
+
/** Set the validity of the field */
|
|
620
|
+
valid?: boolean;
|
|
621
|
+
/**
|
|
622
|
+
* The date as an ISO `YYYY-MM-DD` string, or `{ start, end }` under
|
|
623
|
+
* `range`; `null` when empty
|
|
624
|
+
*/
|
|
625
|
+
value?: CDatePickerValue;
|
|
626
|
+
/** Whether the committed text names no date that can be picked — the value is then `null` (CONTEXT.md "Bad input"). */
|
|
627
|
+
readonly badInput: boolean;
|
|
628
|
+
addEventListener<K extends keyof CDatePickerElementEventMap>(type: K, listener: (this: CDatePickerElement, ev: CDatePickerElementEventMap[K]) => void, options?: boolean | AddEventListenerOptions): void;
|
|
629
|
+
addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
|
|
630
|
+
removeEventListener<K extends keyof CDatePickerElementEventMap>(type: K, listener: (this: CDatePickerElement, ev: CDatePickerElementEventMap[K]) => void, options?: boolean | EventListenerOptions): void;
|
|
631
|
+
removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
|
|
632
|
+
}
|
|
517
633
|
export interface CDividerElement extends Omit<HTMLElement, 'vertical'> {
|
|
518
634
|
/** Render a vertical separator instead of the default horizontal one. */
|
|
519
635
|
vertical?: boolean;
|
|
@@ -872,6 +988,73 @@ export interface CModalElement extends Omit<HTMLElement, 'disableBackdropBlur' |
|
|
|
872
988
|
}
|
|
873
989
|
export interface CNavigationButtonElement extends HTMLElement {
|
|
874
990
|
}
|
|
991
|
+
/** Events dispatched by `<c-number-field>`. */
|
|
992
|
+
export interface CNumberFieldElementEventMap {
|
|
993
|
+
/**
|
|
994
|
+
* Fired whenever typing changes the number, carrying it — `null` once the
|
|
995
|
+
* field holds no digit. Not fired when only the text changes (a group
|
|
996
|
+
* separator, a trailing decimal separator) or when `value` is set.
|
|
997
|
+
*/
|
|
998
|
+
change: CustomEvent<null | number>;
|
|
999
|
+
/**
|
|
1000
|
+
* Native bubbling input event fired alongside every value change so a
|
|
1001
|
+
* plain Vue `v-model` works. No detail.
|
|
1002
|
+
*/
|
|
1003
|
+
input: CustomEvent<void>;
|
|
1004
|
+
/** v-model contract event, fired with `change`. */
|
|
1005
|
+
'update:value': CustomEvent<null | number>;
|
|
1006
|
+
}
|
|
1007
|
+
/** A field for a number — an integer, or one with decimals — shown with thousands separators as it is typed. */
|
|
1008
|
+
export interface CNumberFieldElement extends Omit<HTMLElement, 'decimals' | 'decimalSeparator' | 'disabled' | 'errorMessage' | 'fixedDecimals' | 'groupSeparator' | 'hideDetails' | 'hint' | 'hostId' | 'label' | 'labelOnTop' | 'max' | 'min' | 'name' | 'placeholder' | 'readonly' | 'required' | 'shadow' | 'size' | 'valid' | 'value'> {
|
|
1009
|
+
/** The most fraction digits the field takes; `0` makes it an integer field */
|
|
1010
|
+
decimals?: number;
|
|
1011
|
+
/** The decimal separator. Empty follows the page's `lang` (`,` for `fi`, `.` for `en`) */
|
|
1012
|
+
decimalSeparator?: string;
|
|
1013
|
+
/** Disable the field */
|
|
1014
|
+
disabled?: boolean;
|
|
1015
|
+
/** Error message shown in place of the hint while the field is invalid */
|
|
1016
|
+
errorMessage?: string;
|
|
1017
|
+
/** Pad the fraction to exactly `decimals` digits when the field is left (`12,5` → `12,50`) */
|
|
1018
|
+
fixedDecimals?: boolean;
|
|
1019
|
+
/** The thousands separator. Empty follows the page's `lang` (a space for `fi`, `,` for `en`) */
|
|
1020
|
+
groupSeparator?: string;
|
|
1021
|
+
/** Hide the hint and error messages */
|
|
1022
|
+
hideDetails?: boolean;
|
|
1023
|
+
/** Hint text for the field */
|
|
1024
|
+
hint?: string;
|
|
1025
|
+
/** Id of the input */
|
|
1026
|
+
hostId?: string;
|
|
1027
|
+
/** Label of the field */
|
|
1028
|
+
label?: string;
|
|
1029
|
+
/** Label on top of the field */
|
|
1030
|
+
labelOnTop?: boolean;
|
|
1031
|
+
/** The largest number in range; a larger one is kept and reported as out of range */
|
|
1032
|
+
max?: null | number;
|
|
1033
|
+
/** 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 */
|
|
1034
|
+
min?: null | number;
|
|
1035
|
+
/** Name of the input */
|
|
1036
|
+
name?: string;
|
|
1037
|
+
/** Placeholder of the input */
|
|
1038
|
+
placeholder?: string;
|
|
1039
|
+
/** Mark as readonly */
|
|
1040
|
+
readonly?: boolean;
|
|
1041
|
+
/** Set the field as required */
|
|
1042
|
+
required?: boolean;
|
|
1043
|
+
/** Shadow variant of the field */
|
|
1044
|
+
shadow?: boolean;
|
|
1045
|
+
/** Field height: the 52px default (the shared control height) or the 36px `small` box */
|
|
1046
|
+
size?: 'default' | 'small';
|
|
1047
|
+
/** Set the validity of the field */
|
|
1048
|
+
valid?: boolean;
|
|
1049
|
+
/** 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` */
|
|
1050
|
+
value?: null | number | string;
|
|
1051
|
+
/** Whether the number is below `min` or above `max` (CONTEXT.md "Out of range") */
|
|
1052
|
+
readonly outOfRange: boolean;
|
|
1053
|
+
addEventListener<K extends keyof CNumberFieldElementEventMap>(type: K, listener: (this: CNumberFieldElement, ev: CNumberFieldElementEventMap[K]) => void, options?: boolean | AddEventListenerOptions): void;
|
|
1054
|
+
addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
|
|
1055
|
+
removeEventListener<K extends keyof CNumberFieldElementEventMap>(type: K, listener: (this: CNumberFieldElement, ev: CNumberFieldElementEventMap[K]) => void, options?: boolean | EventListenerOptions): void;
|
|
1056
|
+
removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
|
|
1057
|
+
}
|
|
875
1058
|
export interface COptionElement extends Omit<HTMLElement, 'disabled' | 'name' | 'selected' | 'value'> {
|
|
876
1059
|
/** Set option as disabled */
|
|
877
1060
|
disabled?: boolean;
|
|
@@ -1582,7 +1765,8 @@ export interface CTextFieldElementEventMap {
|
|
|
1582
1765
|
*/
|
|
1583
1766
|
'update:value': CustomEvent<string>;
|
|
1584
1767
|
}
|
|
1585
|
-
|
|
1768
|
+
/** A text field for a single line of text, or several lines under `rows`, with a label, a hint and an error message. */
|
|
1769
|
+
export interface CTextFieldElement extends Omit<HTMLElement, 'autocomplete' | 'autocorrect' | 'automaticCapitalize' | 'disabled' | 'errorMessage' | 'hideDetails' | 'hint' | 'hostId' | 'label' | 'labelOnTop' | 'mask' | 'max' | 'min' | 'name' | 'placeholder' | 'readonly' | 'required' | 'rows' | 'shadow' | 'size' | 'step' | 'trimWhitespace' | 'type' | 'valid' | 'value'> {
|
|
1586
1770
|
/** HTML input autocomplete */
|
|
1587
1771
|
autocomplete?: string;
|
|
1588
1772
|
/**
|
|
@@ -1608,6 +1792,8 @@ export interface CTextFieldElement extends Omit<HTMLElement, 'autocomplete' | 'a
|
|
|
1608
1792
|
label?: string;
|
|
1609
1793
|
/** Label on top of the input */
|
|
1610
1794
|
labelOnTop?: boolean;
|
|
1795
|
+
/** 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 */
|
|
1796
|
+
mask?: string;
|
|
1611
1797
|
/** Maximum value on a numeric input */
|
|
1612
1798
|
max?: null | number;
|
|
1613
1799
|
/** Minimum value on a numeric input */
|
|
@@ -1636,6 +1822,10 @@ export interface CTextFieldElement extends Omit<HTMLElement, 'autocomplete' | 'a
|
|
|
1636
1822
|
valid?: boolean;
|
|
1637
1823
|
/** Value of the input */
|
|
1638
1824
|
value?: string;
|
|
1825
|
+
/** Whether a masked field has every mask token filled (always `true` without a mask) */
|
|
1826
|
+
readonly maskComplete: boolean;
|
|
1827
|
+
/** The text without the mask's literals: only the characters filling its tokens (the text as is without a mask) */
|
|
1828
|
+
readonly unmaskedValue: string;
|
|
1639
1829
|
addEventListener<K extends keyof CTextFieldElementEventMap>(type: K, listener: (this: CTextFieldElement, ev: CTextFieldElementEventMap[K]) => void, options?: boolean | AddEventListenerOptions): void;
|
|
1640
1830
|
addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
|
|
1641
1831
|
removeEventListener<K extends keyof CTextFieldElementEventMap>(type: K, listener: (this: CTextFieldElement, ev: CTextFieldElementEventMap[K]) => void, options?: boolean | EventListenerOptions): void;
|
|
@@ -1829,6 +2019,8 @@ export interface CTreeSelectElement extends Omit<HTMLElement, 'allowBranch' | 'c
|
|
|
1829
2019
|
export interface AppDefaults {
|
|
1830
2020
|
'c-autocomplete'?: Partial<Pick<CAutocompleteElement, 'hideDetails' | 'itemsPerPage' | 'labelOnTop' | 'shadow' | 'size' | 'texts'>>;
|
|
1831
2021
|
'c-data-table'?: Partial<Pick<CDataTableElement, 'texts'>>;
|
|
2022
|
+
'c-date-picker'?: Partial<Pick<CDatePickerElement, 'firstDayOfWeek' | 'format' | 'hideDetails' | 'labelOnTop' | 'shadow' | 'showWeekNumbers' | 'size' | 'texts'>>;
|
|
2023
|
+
'c-number-field'?: Partial<Pick<CNumberFieldElement, 'decimalSeparator' | 'decimals' | 'fixedDecimals' | 'groupSeparator' | 'hideDetails' | 'labelOnTop' | 'shadow' | 'size'>>;
|
|
1832
2024
|
'c-select'?: Partial<Pick<CSelectElement, 'hideDetails' | 'itemsPerPage' | 'labelOnTop' | 'shadow' | 'size' | 'texts'>>;
|
|
1833
2025
|
'c-text-field'?: Partial<Pick<CTextFieldElement, 'hideDetails' | 'labelOnTop' | 'shadow' | 'size'>>;
|
|
1834
2026
|
'c-tree-select'?: Partial<Pick<CTreeSelectElement, 'hideDetails' | 'itemsPerPage' | 'labelOnTop' | 'shadow' | 'size' | 'texts'>>;
|
|
@@ -1837,12 +2029,14 @@ export interface AppDefaults {
|
|
|
1837
2029
|
export declare const DEFAULTABLE_PROPS: {
|
|
1838
2030
|
readonly 'c-autocomplete': readonly ["hideDetails", "itemsPerPage", "labelOnTop", "shadow", "size", "texts"];
|
|
1839
2031
|
readonly 'c-data-table': readonly ["texts"];
|
|
2032
|
+
readonly 'c-date-picker': readonly ["firstDayOfWeek", "format", "hideDetails", "labelOnTop", "shadow", "showWeekNumbers", "size", "texts"];
|
|
2033
|
+
readonly 'c-number-field': readonly ["decimalSeparator", "decimals", "fixedDecimals", "groupSeparator", "hideDetails", "labelOnTop", "shadow", "size"];
|
|
1840
2034
|
readonly 'c-select': readonly ["hideDetails", "itemsPerPage", "labelOnTop", "shadow", "size", "texts"];
|
|
1841
2035
|
readonly 'c-text-field': readonly ["hideDetails", "labelOnTop", "shadow", "size"];
|
|
1842
2036
|
readonly 'c-tree-select': readonly ["hideDetails", "itemsPerPage", "labelOnTop", "shadow", "size", "texts"];
|
|
1843
2037
|
};
|
|
1844
2038
|
/** Tags dispatching the v-model contract event `update:value` — the value controls (CONTEXT.md). */
|
|
1845
|
-
export declare const VALUE_TAGS: readonly ["c-accordion", "c-autocomplete", "c-button-group", "c-checkbox", "c-modal", "c-otp-input", "c-pagination", "c-radio-group", "c-select", "c-slider", "c-switch", "c-tabs", "c-text-field", "c-tree-select"];
|
|
2039
|
+
export declare const VALUE_TAGS: readonly ["c-accordion", "c-autocomplete", "c-button-group", "c-checkbox", "c-date-picker", "c-modal", "c-number-field", "c-otp-input", "c-pagination", "c-radio-group", "c-select", "c-slider", "c-switch", "c-tabs", "c-text-field", "c-tree-select"];
|
|
1846
2040
|
declare global {
|
|
1847
2041
|
interface HTMLElementTagNameMap {
|
|
1848
2042
|
'c-accordion': CAccordionElement;
|
|
@@ -1859,6 +2053,7 @@ declare global {
|
|
|
1859
2053
|
'c-checkbox': CCheckboxElement;
|
|
1860
2054
|
'c-csc-logo': CCscLogoElement;
|
|
1861
2055
|
'c-data-table': CDataTableElement;
|
|
2056
|
+
'c-date-picker': CDatePickerElement;
|
|
1862
2057
|
'c-divider': CDividerElement;
|
|
1863
2058
|
'c-dropdown': CDropdownElement;
|
|
1864
2059
|
'c-icon': CIconElement;
|
|
@@ -1882,6 +2077,7 @@ declare global {
|
|
|
1882
2077
|
'c-message': CMessageElement;
|
|
1883
2078
|
'c-modal': CModalElement;
|
|
1884
2079
|
'c-navigation-button': CNavigationButtonElement;
|
|
2080
|
+
'c-number-field': CNumberFieldElement;
|
|
1885
2081
|
'c-option': COptionElement;
|
|
1886
2082
|
'c-option-value': COptionValueElement;
|
|
1887
2083
|
'c-otp-input': COtpInputElement;
|
package/package.json
CHANGED