@devschile/chucao 2.6.0 → 2.7.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chucao/chucao.esm.js +1 -1
- package/dist/chucao/{p-ffaf1a31.entry.js → p-01b6c7bf.entry.js} +2 -2
- package/dist/chucao/{p-2c1bc8bd.entry.js → p-0c7f6f8d.entry.js} +2 -2
- package/dist/chucao/p-10f6801e.entry.js +2 -0
- package/dist/chucao/p-10f6801e.entry.js.map +1 -0
- package/dist/chucao/{p-0409c063.entry.js → p-15d27bb7.entry.js} +2 -2
- package/dist/chucao/{p-e6f959f4.entry.js → p-1b70e3f1.entry.js} +2 -2
- package/dist/chucao/{p-66ae9e2c.entry.js → p-1e4cd3aa.entry.js} +2 -2
- package/dist/chucao/{p-c1b35f1b.entry.js → p-2e37c61b.entry.js} +2 -2
- package/dist/chucao/{p-f7305552.entry.js → p-42028c97.entry.js} +2 -2
- package/dist/chucao/{p-090d26f1.entry.js → p-472ec451.entry.js} +2 -2
- package/dist/chucao/{p-81b6622f.entry.js → p-5240f5ac.entry.js} +2 -2
- package/dist/chucao/p-60e1c1df.entry.js +2 -0
- package/dist/chucao/{p-b56f4a29.entry.js.map → p-60e1c1df.entry.js.map} +1 -1
- package/dist/chucao/{p-b9b47942.entry.js → p-7cdc71cc.entry.js} +2 -2
- package/dist/chucao/{p-50cbea7f.entry.js → p-8ae680a4.entry.js} +2 -2
- package/dist/chucao/{p-20ea1b18.entry.js → p-90284ebe.entry.js} +2 -2
- package/dist/chucao/p-9db118d9.entry.js +2 -0
- package/dist/chucao/p-9ebcc7be.entry.js +2 -0
- package/dist/chucao/p-9ebcc7be.entry.js.map +1 -0
- package/dist/chucao/{p-207648f9.entry.js → p-a7c674b7.entry.js} +2 -2
- package/dist/chucao/{p-79f20bfd.entry.js → p-c4b2bd1f.entry.js} +2 -2
- package/dist/chucao/{p-7d4336bd.entry.js → p-c90da3c0.entry.js} +2 -2
- package/dist/chucao/p-d8b71751.entry.js +2 -0
- package/dist/chucao/p-d8b71751.entry.js.map +1 -0
- package/dist/chucao/{p-925af6b8.entry.js → p-deb2571b.entry.js} +2 -2
- package/dist/chucao/{p-9794a3fa.entry.js → p-e77d35c3.entry.js} +2 -2
- package/dist/chucao/{p-21ca2235.entry.js → p-f6ab0a11.entry.js} +2 -2
- package/dist/chucao/p-f917d34f.entry.js +2 -0
- package/dist/chucao/{p-e2f725bd.entry.js.map → p-f917d34f.entry.js.map} +1 -1
- package/dist/chucao/{p-f0aea6ed.entry.js → p-ffecdf25.entry.js} +2 -2
- package/dist/cjs/ch-accordion.cjs.entry.js +1 -1
- package/dist/cjs/ch-alert_8.cjs.entry.js +7 -7
- package/dist/cjs/ch-checkbox.cjs.entry.js +1 -1
- package/dist/cjs/ch-cluster.cjs.entry.js +2 -2
- package/dist/cjs/ch-description-list.cjs.entry.js +1 -1
- package/dist/cjs/ch-divider.cjs.entry.js +1 -1
- package/dist/cjs/ch-drawer.cjs.entry.js +1 -1
- package/dist/cjs/ch-emoji.cjs.entry.js +1 -1
- package/dist/cjs/ch-empty-state.cjs.entry.js +1 -1
- package/dist/cjs/ch-grid.cjs.entry.js +1 -1
- package/dist/cjs/ch-icon-button.cjs.entry.js +1 -1
- package/dist/cjs/ch-icon.cjs.entry.js +1 -1
- package/dist/cjs/ch-modal.cjs.entry.js +1 -1
- package/dist/cjs/ch-number-input.cjs.entry.js +237 -0
- package/dist/cjs/ch-number-input.cjs.entry.js.map +1 -0
- package/dist/cjs/ch-page-header.cjs.entry.js +1 -1
- package/dist/cjs/ch-radio.cjs.entry.js +1 -1
- package/dist/cjs/ch-segmented-control.cjs.entry.js +1 -1
- package/dist/cjs/ch-skeleton.cjs.entry.js +1 -1
- package/dist/cjs/ch-stack.cjs.entry.js +1 -1
- package/dist/cjs/ch-stat.cjs.entry.js +2 -2
- package/dist/cjs/ch-table.cjs.entry.js +145 -0
- package/dist/cjs/ch-table.cjs.entry.js.map +1 -0
- package/dist/cjs/ch-tabs.cjs.entry.js +1 -1
- package/dist/cjs/ch-textarea.cjs.entry.js +1 -1
- package/dist/cjs/ch-timeline.cjs.entry.js +1 -1
- package/dist/cjs/ch-tooltip.cjs.entry.js +24 -7
- package/dist/cjs/ch-tooltip.cjs.entry.js.map +1 -1
- package/dist/cjs/chucao.cjs.js +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/collection/collection-manifest.json +2 -0
- package/dist/collection/components/ch-accordion/ch-accordion.js +1 -1
- package/dist/collection/components/ch-alert/ch-alert.js +1 -1
- package/dist/collection/components/ch-badge/ch-badge.js +1 -1
- package/dist/collection/components/ch-card/ch-card.js +1 -1
- package/dist/collection/components/ch-checkbox/ch-checkbox.js +1 -1
- package/dist/collection/components/ch-cluster/ch-cluster.js +2 -2
- package/dist/collection/components/ch-description-list/ch-description-list.js +1 -1
- package/dist/collection/components/ch-divider/ch-divider.js +1 -1
- package/dist/collection/components/ch-drawer/ch-drawer.js +1 -1
- package/dist/collection/components/ch-emoji/ch-emoji.js +1 -1
- package/dist/collection/components/ch-empty-state/ch-empty-state.js +1 -1
- package/dist/collection/components/ch-grid/ch-grid.js +1 -1
- package/dist/collection/components/ch-icon/ch-icon.js +1 -1
- package/dist/collection/components/ch-icon-button/ch-icon-button.js +1 -1
- package/dist/collection/components/ch-input/ch-input.js +1 -1
- package/dist/collection/components/ch-modal/ch-modal.js +1 -1
- package/dist/collection/components/ch-number-input/ch-number-input.css +74 -0
- package/dist/collection/components/ch-number-input/ch-number-input.js +555 -0
- package/dist/collection/components/ch-number-input/ch-number-input.js.map +1 -0
- package/dist/collection/components/ch-page-header/ch-page-header.js +1 -1
- package/dist/collection/components/ch-radio/ch-radio.js +1 -1
- package/dist/collection/components/ch-segmented-control/ch-segmented-control.js +1 -1
- package/dist/collection/components/ch-select/ch-select.js +1 -1
- package/dist/collection/components/ch-skeleton/ch-skeleton.js +1 -1
- package/dist/collection/components/ch-spinner/ch-spinner.js +1 -1
- package/dist/collection/components/ch-stack/ch-stack.js +1 -1
- package/dist/collection/components/ch-stat/ch-stat.js +2 -2
- package/dist/collection/components/ch-switch/ch-switch.js +1 -1
- package/dist/collection/components/ch-table/ch-table.css +107 -0
- package/dist/collection/components/ch-table/ch-table.js +347 -0
- package/dist/collection/components/ch-table/ch-table.js.map +1 -0
- package/dist/collection/components/ch-tabs/ch-tabs.js +1 -1
- package/dist/collection/components/ch-textarea/ch-textarea.js +1 -1
- package/dist/collection/components/ch-timeline/ch-timeline.js +1 -1
- package/dist/collection/components/ch-tooltip/ch-tooltip.css +11 -0
- package/dist/collection/components/ch-tooltip/ch-tooltip.js +23 -6
- package/dist/collection/components/ch-tooltip/ch-tooltip.js.map +1 -1
- package/dist/collection/utils/overlay.js.map +1 -1
- package/dist/components/ch-accordion.js +1 -1
- package/dist/components/ch-alert.js +1 -1
- package/dist/components/ch-badge.js +1 -1
- package/dist/components/ch-button.js +1 -1
- package/dist/components/ch-card.js +1 -1
- package/dist/components/ch-card.js.map +1 -1
- package/dist/components/ch-checkbox.js +1 -1
- package/dist/components/ch-cluster.js +1 -1
- package/dist/components/ch-description-list.js +1 -1
- package/dist/components/ch-divider.js +1 -1
- package/dist/components/ch-drawer.js +1 -1
- package/dist/components/ch-emoji.js +1 -1
- package/dist/components/ch-empty-state.js +1 -1
- package/dist/components/ch-grid.js +1 -1
- package/dist/components/ch-icon-button.js +1 -1
- package/dist/components/ch-icon.js +1 -1
- package/dist/components/ch-input.js +1 -1
- package/dist/components/ch-modal.js +1 -1
- package/dist/components/ch-number-input.d.ts +11 -0
- package/dist/components/ch-number-input.js +2 -0
- package/dist/components/ch-number-input.js.map +1 -0
- package/dist/components/ch-page-header.js +1 -1
- package/dist/components/ch-radio.js +1 -1
- package/dist/components/ch-segmented-control.js +1 -1
- package/dist/components/ch-select.js +1 -1
- package/dist/components/ch-skeleton.js +1 -1
- package/dist/components/ch-spinner.js +1 -1
- package/dist/components/ch-stack.js +1 -1
- package/dist/components/ch-stat.js +1 -1
- package/dist/components/ch-switch.js +1 -1
- package/dist/components/ch-table.d.ts +11 -0
- package/dist/components/ch-table.js +2 -0
- package/dist/components/ch-table.js.map +1 -0
- package/dist/components/ch-tabs.js +1 -1
- package/dist/components/ch-textarea.js +1 -1
- package/dist/components/ch-timeline.js +1 -1
- package/dist/components/ch-tooltip.js +1 -1
- package/dist/components/ch-tooltip.js.map +1 -1
- package/dist/components/{p-Cw0b4OGc.js → p-DiUN1WGc.js} +2 -2
- package/dist/esm/ch-accordion.entry.js +1 -1
- package/dist/esm/ch-alert_8.entry.js +7 -7
- package/dist/esm/ch-checkbox.entry.js +1 -1
- package/dist/esm/ch-cluster.entry.js +2 -2
- package/dist/esm/ch-description-list.entry.js +1 -1
- package/dist/esm/ch-divider.entry.js +1 -1
- package/dist/esm/ch-drawer.entry.js +1 -1
- package/dist/esm/ch-emoji.entry.js +1 -1
- package/dist/esm/ch-empty-state.entry.js +1 -1
- package/dist/esm/ch-grid.entry.js +1 -1
- package/dist/esm/ch-icon-button.entry.js +1 -1
- package/dist/esm/ch-icon.entry.js +1 -1
- package/dist/esm/ch-modal.entry.js +1 -1
- package/dist/esm/ch-number-input.entry.js +235 -0
- package/dist/esm/ch-number-input.entry.js.map +1 -0
- package/dist/esm/ch-page-header.entry.js +1 -1
- package/dist/esm/ch-radio.entry.js +1 -1
- package/dist/esm/ch-segmented-control.entry.js +1 -1
- package/dist/esm/ch-skeleton.entry.js +1 -1
- package/dist/esm/ch-stack.entry.js +1 -1
- package/dist/esm/ch-stat.entry.js +2 -2
- package/dist/esm/ch-table.entry.js +143 -0
- package/dist/esm/ch-table.entry.js.map +1 -0
- package/dist/esm/ch-tabs.entry.js +1 -1
- package/dist/esm/ch-textarea.entry.js +1 -1
- package/dist/esm/ch-timeline.entry.js +1 -1
- package/dist/esm/ch-tooltip.entry.js +24 -7
- package/dist/esm/ch-tooltip.entry.js.map +1 -1
- package/dist/esm/chucao.js +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/types/components/ch-number-input/ch-number-input.d.ts +105 -0
- package/dist/types/components/ch-table/ch-table.d.ts +106 -0
- package/dist/types/components/ch-tooltip/ch-tooltip.d.ts +7 -0
- package/dist/types/components.d.ts +459 -0
- package/dist/types/utils/overlay.d.ts +1 -1
- package/dist-react/components.d.ts +15 -1
- package/dist-react/components.js +21 -0
- package/dist-react/components.ts +31 -1
- package/dist-vue/index.d.ts +2 -0
- package/dist-vue/index.js +33 -0
- package/dist-vue/index.ts +37 -0
- package/hydrate/index.js +519 -37
- package/hydrate/index.mjs +519 -37
- package/package.json +9 -1
- package/dist/chucao/p-370d9629.entry.js +0 -2
- package/dist/chucao/p-370d9629.entry.js.map +0 -1
- package/dist/chucao/p-95061461.entry.js +0 -2
- package/dist/chucao/p-b56f4a29.entry.js +0 -2
- package/dist/chucao/p-e2f725bd.entry.js +0 -2
- /package/dist/chucao/{p-ffaf1a31.entry.js.map → p-01b6c7bf.entry.js.map} +0 -0
- /package/dist/chucao/{p-2c1bc8bd.entry.js.map → p-0c7f6f8d.entry.js.map} +0 -0
- /package/dist/chucao/{p-0409c063.entry.js.map → p-15d27bb7.entry.js.map} +0 -0
- /package/dist/chucao/{p-e6f959f4.entry.js.map → p-1b70e3f1.entry.js.map} +0 -0
- /package/dist/chucao/{p-66ae9e2c.entry.js.map → p-1e4cd3aa.entry.js.map} +0 -0
- /package/dist/chucao/{p-c1b35f1b.entry.js.map → p-2e37c61b.entry.js.map} +0 -0
- /package/dist/chucao/{p-f7305552.entry.js.map → p-42028c97.entry.js.map} +0 -0
- /package/dist/chucao/{p-090d26f1.entry.js.map → p-472ec451.entry.js.map} +0 -0
- /package/dist/chucao/{p-81b6622f.entry.js.map → p-5240f5ac.entry.js.map} +0 -0
- /package/dist/chucao/{p-b9b47942.entry.js.map → p-7cdc71cc.entry.js.map} +0 -0
- /package/dist/chucao/{p-50cbea7f.entry.js.map → p-8ae680a4.entry.js.map} +0 -0
- /package/dist/chucao/{p-20ea1b18.entry.js.map → p-90284ebe.entry.js.map} +0 -0
- /package/dist/chucao/{p-95061461.entry.js.map → p-9db118d9.entry.js.map} +0 -0
- /package/dist/chucao/{p-207648f9.entry.js.map → p-a7c674b7.entry.js.map} +0 -0
- /package/dist/chucao/{p-79f20bfd.entry.js.map → p-c4b2bd1f.entry.js.map} +0 -0
- /package/dist/chucao/{p-7d4336bd.entry.js.map → p-c90da3c0.entry.js.map} +0 -0
- /package/dist/chucao/{p-925af6b8.entry.js.map → p-deb2571b.entry.js.map} +0 -0
- /package/dist/chucao/{p-9794a3fa.entry.js.map → p-e77d35c3.entry.js.map} +0 -0
- /package/dist/chucao/{p-21ca2235.entry.js.map → p-f6ab0a11.entry.js.map} +0 -0
- /package/dist/chucao/{p-f0aea6ed.entry.js.map → p-ffecdf25.entry.js.map} +0 -0
- /package/dist/components/{p-Cw0b4OGc.js.map → p-DiUN1WGc.js.map} +0 -0
|
@@ -0,0 +1,555 @@
|
|
|
1
|
+
import { Host, h } from "@stencil/core";
|
|
2
|
+
import { resolveValidity } from "../../utils/validation-message";
|
|
3
|
+
let numberInputIds = 0;
|
|
4
|
+
/**
|
|
5
|
+
* Numeric input that keeps what the user is typing separate from the value the
|
|
6
|
+
* form submits.
|
|
7
|
+
*
|
|
8
|
+
* The display is formatted (`1.234.567` for CLP) while `value` and `FormData`
|
|
9
|
+
* carry a canonical machine-readable string: digits only for CLP, the plain
|
|
10
|
+
* decimal for `plain`. Parsing on every keystroke cannot represent the
|
|
11
|
+
* intermediate states people actually type — `-`, `1.`, `0,` — so those stay as
|
|
12
|
+
* text and are validated at the end.
|
|
13
|
+
*
|
|
14
|
+
* Empty is not zero. A cleared field submits `''` and reports `valueMissing`
|
|
15
|
+
* when required; it never becomes `0`.
|
|
16
|
+
*
|
|
17
|
+
* There is no separate currency component: `format="clp"` is the currency
|
|
18
|
+
* boundary for Chilean pesos, the only case with a real consumer.
|
|
19
|
+
*/
|
|
20
|
+
export class ChNumberInput {
|
|
21
|
+
inputId = `ch-number-input-${++numberInputIds}`;
|
|
22
|
+
hintId = `${this.inputId}-hint`;
|
|
23
|
+
errorId = `${this.inputId}-error`;
|
|
24
|
+
initialValue = '';
|
|
25
|
+
internals;
|
|
26
|
+
formDisabled = false;
|
|
27
|
+
host;
|
|
28
|
+
/** Visible label, associated with the input via `for`/`id`. */
|
|
29
|
+
label;
|
|
30
|
+
/**
|
|
31
|
+
* Canonical value: digits only for `clp`, a plain decimal string for `plain`.
|
|
32
|
+
* Never formatted — formatting lives in the rendered text.
|
|
33
|
+
*/
|
|
34
|
+
value = '';
|
|
35
|
+
/** How the number is displayed while typing. */
|
|
36
|
+
format = 'plain';
|
|
37
|
+
/** Placeholder shown when the field is empty. */
|
|
38
|
+
placeholder;
|
|
39
|
+
/** Name submitted with the form. */
|
|
40
|
+
name;
|
|
41
|
+
/** Whether the field is disabled. */
|
|
42
|
+
disabled = false;
|
|
43
|
+
/** Whether a value is required; an empty field is then invalid. */
|
|
44
|
+
required = false;
|
|
45
|
+
/** Minimum accepted value. */
|
|
46
|
+
min;
|
|
47
|
+
/** Maximum accepted value. */
|
|
48
|
+
max;
|
|
49
|
+
/** Stepping increment. `'any'` disables stepping validation. */
|
|
50
|
+
step = 'any';
|
|
51
|
+
/** Helper text, replaced by `errorMessage` when invalid. */
|
|
52
|
+
hint;
|
|
53
|
+
/** Custom error message; wins over the built-in range messages. */
|
|
54
|
+
errorMessage;
|
|
55
|
+
/** Whether the field is marked invalid by the consumer. */
|
|
56
|
+
invalid = false;
|
|
57
|
+
/** Emitted on every keystroke with the canonical value. */
|
|
58
|
+
chInput;
|
|
59
|
+
/** Emitted on commit (native `change`) with the canonical value. */
|
|
60
|
+
chChange;
|
|
61
|
+
/**
|
|
62
|
+
* The text in the input, which may be a partial number like `-` or `1.`.
|
|
63
|
+
* This is the only thing rendered, so it is also what a reset must restore.
|
|
64
|
+
*/
|
|
65
|
+
draft = '';
|
|
66
|
+
/**
|
|
67
|
+
* Whether the user has typed since the last commit. While false the input
|
|
68
|
+
* renders `value` directly, which is what makes `formResetCallback` and a
|
|
69
|
+
* consumer assigning `.value` repaint without extra bookkeeping.
|
|
70
|
+
*/
|
|
71
|
+
typing = false;
|
|
72
|
+
componentWillLoad() {
|
|
73
|
+
this.draft = this.formatDisplay(this.value);
|
|
74
|
+
}
|
|
75
|
+
get decimals() {
|
|
76
|
+
return this.format !== 'clp';
|
|
77
|
+
}
|
|
78
|
+
/** Formats a canonical value for display. */
|
|
79
|
+
formatDisplay(value) {
|
|
80
|
+
if (value === '') {
|
|
81
|
+
return '';
|
|
82
|
+
}
|
|
83
|
+
if (this.format === 'clp') {
|
|
84
|
+
const digits = value.replace(/\D/gu, '');
|
|
85
|
+
return digits === '' ? '' : Number(digits).toLocaleString('es-CL');
|
|
86
|
+
}
|
|
87
|
+
return value;
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Strips display formatting back to the canonical string: digits only for
|
|
91
|
+
* CLP; a leading sign, digits and one decimal separator for `plain`.
|
|
92
|
+
*/
|
|
93
|
+
toCanonical(text) {
|
|
94
|
+
if (this.format === 'clp') {
|
|
95
|
+
return text.replace(/\D/gu, '');
|
|
96
|
+
}
|
|
97
|
+
const normalised = text.replace(/\s/gu, '').replace(',', '.');
|
|
98
|
+
const match = /^-?\d*(?:\.\d*)?/u.exec(normalised);
|
|
99
|
+
return match ? match[0] : '';
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Whether the field holds a real number. A draft that is only a sign or a
|
|
103
|
+
* separator (`-`, `.`) is still being typed and submits as empty.
|
|
104
|
+
*/
|
|
105
|
+
get isEmpty() {
|
|
106
|
+
return !/^-?\d/u.test(this.toCanonical(this.draft));
|
|
107
|
+
}
|
|
108
|
+
/** What the form receives and `value` exposes. */
|
|
109
|
+
get canonical() {
|
|
110
|
+
return this.isEmpty ? '' : this.toCanonical(this.draft);
|
|
111
|
+
}
|
|
112
|
+
get numericValue() {
|
|
113
|
+
return Number(this.canonical);
|
|
114
|
+
}
|
|
115
|
+
/** The message for a value outside `min`/`max`, if there is one. */
|
|
116
|
+
outOfRange(parsed) {
|
|
117
|
+
const { min, max } = this;
|
|
118
|
+
if (min !== undefined && parsed < min) {
|
|
119
|
+
return `Enter a value of at least ${min}.`;
|
|
120
|
+
}
|
|
121
|
+
if (max !== undefined && parsed > max) {
|
|
122
|
+
return `Enter a value of at most ${max}.`;
|
|
123
|
+
}
|
|
124
|
+
return undefined;
|
|
125
|
+
}
|
|
126
|
+
rangeError() {
|
|
127
|
+
if (this.errorMessage || this.isEmpty || this.invalid) {
|
|
128
|
+
return undefined;
|
|
129
|
+
}
|
|
130
|
+
const parsed = this.numericValue;
|
|
131
|
+
return Number.isNaN(parsed) ? 'Enter a valid number.' : this.outOfRange(parsed);
|
|
132
|
+
}
|
|
133
|
+
syncForm() {
|
|
134
|
+
const { internals, required, invalid, errorMessage, canonical } = this;
|
|
135
|
+
if (typeof internals?.setFormValue !== 'function') {
|
|
136
|
+
return;
|
|
137
|
+
}
|
|
138
|
+
internals.setFormValue(canonical);
|
|
139
|
+
const base = resolveValidity({ required, empty: canonical === '', invalid, errorMessage });
|
|
140
|
+
const rangeMessage = this.rangeError();
|
|
141
|
+
if (rangeMessage) {
|
|
142
|
+
internals.setValidity({ ...base.flags, badInput: true }, rangeMessage);
|
|
143
|
+
return;
|
|
144
|
+
}
|
|
145
|
+
internals.setValidity(base.flags, base.message);
|
|
146
|
+
}
|
|
147
|
+
componentDidLoad() {
|
|
148
|
+
this.initialValue = this.value;
|
|
149
|
+
this.syncForm();
|
|
150
|
+
this.host.addEventListener('change', this.markTouched);
|
|
151
|
+
this.host.addEventListener('focusout', this.markTouched);
|
|
152
|
+
this.host.addEventListener('invalid', this.markTouched);
|
|
153
|
+
}
|
|
154
|
+
markTouched = () => {
|
|
155
|
+
this.host.setAttribute('data-touched', '');
|
|
156
|
+
};
|
|
157
|
+
formResetCallback() {
|
|
158
|
+
this.value = this.initialValue;
|
|
159
|
+
this.draft = this.formatDisplay(this.initialValue);
|
|
160
|
+
this.typing = false;
|
|
161
|
+
this.syncForm();
|
|
162
|
+
// The vdom does not push a re-rendered `value` onto a live `<input>`: the
|
|
163
|
+
// property is set by the browser's own typing and the diff sees no change.
|
|
164
|
+
// A reset restores the text directly.
|
|
165
|
+
const input = this.host.shadowRoot?.querySelector('input');
|
|
166
|
+
if (input) {
|
|
167
|
+
input.value = this.formatDisplay(this.initialValue);
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
formDisabledCallback(isDisabled) {
|
|
171
|
+
this.formDisabled = isDisabled;
|
|
172
|
+
}
|
|
173
|
+
commit(text) {
|
|
174
|
+
this.typing = true;
|
|
175
|
+
this.draft = text;
|
|
176
|
+
this.value = this.canonical;
|
|
177
|
+
this.chInput.emit(this.value);
|
|
178
|
+
this.syncForm();
|
|
179
|
+
}
|
|
180
|
+
handleInput = (ev) => {
|
|
181
|
+
this.commit(ev.target.value);
|
|
182
|
+
};
|
|
183
|
+
handleChange = (ev) => {
|
|
184
|
+
this.commit(ev.target.value);
|
|
185
|
+
this.chChange.emit(this.value);
|
|
186
|
+
};
|
|
187
|
+
/** Reformats grouped CLP digits once the field loses focus. */
|
|
188
|
+
handleBlur = () => {
|
|
189
|
+
if (this.format === 'clp') {
|
|
190
|
+
this.draft = this.formatDisplay(this.canonical);
|
|
191
|
+
}
|
|
192
|
+
};
|
|
193
|
+
get isInvalid() {
|
|
194
|
+
return this.invalid || this.rangeError() !== undefined;
|
|
195
|
+
}
|
|
196
|
+
get describedBy() {
|
|
197
|
+
if (this.isInvalid && this.errorMessage) {
|
|
198
|
+
return this.errorId;
|
|
199
|
+
}
|
|
200
|
+
if (this.hint) {
|
|
201
|
+
return this.hintId;
|
|
202
|
+
}
|
|
203
|
+
return undefined;
|
|
204
|
+
}
|
|
205
|
+
render() {
|
|
206
|
+
const showError = this.isInvalid && this.errorMessage;
|
|
207
|
+
return (h(Host, { key: '1c424d9d76ec39e6cc6018d6ba483f95bd203d32' }, this.label && (h("label", { key: '4fc03334128c33cc425da773df063cd99fee215c', class: "label", htmlFor: this.inputId }, this.label)), h("input", { key: 'ece15737f83c181d615e906aba5cce80c0bcb8ba', id: this.label ? this.inputId : undefined, class: { 'input': true, 'input--invalid': this.isInvalid },
|
|
208
|
+
// `text` with `inputmode`, not `type="number"`: a number input drops
|
|
209
|
+
// partial values and cannot show grouped digits.
|
|
210
|
+
type: "text", inputMode: this.decimals ? 'decimal' : 'numeric', name: this.name, placeholder: this.placeholder, disabled: this.disabled || this.formDisabled, required: this.required, value: this.typing ? this.draft : this.formatDisplay(this.value), "aria-invalid": this.isInvalid ? 'true' : undefined, "aria-describedby": this.describedBy, onInput: this.handleInput, onChange: this.handleChange, onBlur: this.handleBlur }), this.hint && !showError && (h("p", { key: '7a2e3031b8bfebf26857dd60eb18340f21a01f3d', class: "hint", id: this.hintId }, this.hint)), showError && (h("p", { key: 'f90492532d27088f18b258f885d5d471f31d27cb', class: "error", id: this.errorId, role: "alert" }, this.errorMessage))));
|
|
211
|
+
}
|
|
212
|
+
static get is() { return "ch-number-input"; }
|
|
213
|
+
static get encapsulation() { return "shadow"; }
|
|
214
|
+
static get formAssociated() { return true; }
|
|
215
|
+
static get originalStyleUrls() {
|
|
216
|
+
return {
|
|
217
|
+
"$": ["ch-number-input.css"]
|
|
218
|
+
};
|
|
219
|
+
}
|
|
220
|
+
static get styleUrls() {
|
|
221
|
+
return {
|
|
222
|
+
"$": ["ch-number-input.css"]
|
|
223
|
+
};
|
|
224
|
+
}
|
|
225
|
+
static get properties() {
|
|
226
|
+
return {
|
|
227
|
+
"label": {
|
|
228
|
+
"type": "string",
|
|
229
|
+
"mutable": false,
|
|
230
|
+
"complexType": {
|
|
231
|
+
"original": "string",
|
|
232
|
+
"resolved": "string",
|
|
233
|
+
"references": {}
|
|
234
|
+
},
|
|
235
|
+
"required": false,
|
|
236
|
+
"optional": true,
|
|
237
|
+
"docs": {
|
|
238
|
+
"tags": [],
|
|
239
|
+
"text": "Visible label, associated with the input via `for`/`id`."
|
|
240
|
+
},
|
|
241
|
+
"getter": false,
|
|
242
|
+
"setter": false,
|
|
243
|
+
"reflect": false,
|
|
244
|
+
"attribute": "label"
|
|
245
|
+
},
|
|
246
|
+
"value": {
|
|
247
|
+
"type": "string",
|
|
248
|
+
"mutable": true,
|
|
249
|
+
"complexType": {
|
|
250
|
+
"original": "string",
|
|
251
|
+
"resolved": "string",
|
|
252
|
+
"references": {}
|
|
253
|
+
},
|
|
254
|
+
"required": false,
|
|
255
|
+
"optional": false,
|
|
256
|
+
"docs": {
|
|
257
|
+
"tags": [],
|
|
258
|
+
"text": "Canonical value: digits only for `clp`, a plain decimal string for `plain`.\nNever formatted \u2014 formatting lives in the rendered text."
|
|
259
|
+
},
|
|
260
|
+
"getter": false,
|
|
261
|
+
"setter": false,
|
|
262
|
+
"reflect": false,
|
|
263
|
+
"attribute": "value",
|
|
264
|
+
"defaultValue": "''"
|
|
265
|
+
},
|
|
266
|
+
"format": {
|
|
267
|
+
"type": "string",
|
|
268
|
+
"mutable": false,
|
|
269
|
+
"complexType": {
|
|
270
|
+
"original": "ChNumberInputFormat",
|
|
271
|
+
"resolved": "\"clp\" | \"plain\"",
|
|
272
|
+
"references": {
|
|
273
|
+
"ChNumberInputFormat": {
|
|
274
|
+
"location": "local",
|
|
275
|
+
"path": "/home/runner/work/chucao/chucao/src/components/ch-number-input/ch-number-input.tsx",
|
|
276
|
+
"id": "src/components/ch-number-input/ch-number-input.tsx::ChNumberInputFormat"
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
},
|
|
280
|
+
"required": false,
|
|
281
|
+
"optional": false,
|
|
282
|
+
"docs": {
|
|
283
|
+
"tags": [],
|
|
284
|
+
"text": "How the number is displayed while typing."
|
|
285
|
+
},
|
|
286
|
+
"getter": false,
|
|
287
|
+
"setter": false,
|
|
288
|
+
"reflect": false,
|
|
289
|
+
"attribute": "format",
|
|
290
|
+
"defaultValue": "'plain'"
|
|
291
|
+
},
|
|
292
|
+
"placeholder": {
|
|
293
|
+
"type": "string",
|
|
294
|
+
"mutable": false,
|
|
295
|
+
"complexType": {
|
|
296
|
+
"original": "string",
|
|
297
|
+
"resolved": "string",
|
|
298
|
+
"references": {}
|
|
299
|
+
},
|
|
300
|
+
"required": false,
|
|
301
|
+
"optional": true,
|
|
302
|
+
"docs": {
|
|
303
|
+
"tags": [],
|
|
304
|
+
"text": "Placeholder shown when the field is empty."
|
|
305
|
+
},
|
|
306
|
+
"getter": false,
|
|
307
|
+
"setter": false,
|
|
308
|
+
"reflect": false,
|
|
309
|
+
"attribute": "placeholder"
|
|
310
|
+
},
|
|
311
|
+
"name": {
|
|
312
|
+
"type": "string",
|
|
313
|
+
"mutable": false,
|
|
314
|
+
"complexType": {
|
|
315
|
+
"original": "string",
|
|
316
|
+
"resolved": "string",
|
|
317
|
+
"references": {}
|
|
318
|
+
},
|
|
319
|
+
"required": false,
|
|
320
|
+
"optional": true,
|
|
321
|
+
"docs": {
|
|
322
|
+
"tags": [],
|
|
323
|
+
"text": "Name submitted with the form."
|
|
324
|
+
},
|
|
325
|
+
"getter": false,
|
|
326
|
+
"setter": false,
|
|
327
|
+
"reflect": true,
|
|
328
|
+
"attribute": "name"
|
|
329
|
+
},
|
|
330
|
+
"disabled": {
|
|
331
|
+
"type": "boolean",
|
|
332
|
+
"mutable": false,
|
|
333
|
+
"complexType": {
|
|
334
|
+
"original": "boolean",
|
|
335
|
+
"resolved": "boolean",
|
|
336
|
+
"references": {}
|
|
337
|
+
},
|
|
338
|
+
"required": false,
|
|
339
|
+
"optional": false,
|
|
340
|
+
"docs": {
|
|
341
|
+
"tags": [],
|
|
342
|
+
"text": "Whether the field is disabled."
|
|
343
|
+
},
|
|
344
|
+
"getter": false,
|
|
345
|
+
"setter": false,
|
|
346
|
+
"reflect": true,
|
|
347
|
+
"attribute": "disabled",
|
|
348
|
+
"defaultValue": "false"
|
|
349
|
+
},
|
|
350
|
+
"required": {
|
|
351
|
+
"type": "boolean",
|
|
352
|
+
"mutable": false,
|
|
353
|
+
"complexType": {
|
|
354
|
+
"original": "boolean",
|
|
355
|
+
"resolved": "boolean",
|
|
356
|
+
"references": {}
|
|
357
|
+
},
|
|
358
|
+
"required": false,
|
|
359
|
+
"optional": false,
|
|
360
|
+
"docs": {
|
|
361
|
+
"tags": [],
|
|
362
|
+
"text": "Whether a value is required; an empty field is then invalid."
|
|
363
|
+
},
|
|
364
|
+
"getter": false,
|
|
365
|
+
"setter": false,
|
|
366
|
+
"reflect": true,
|
|
367
|
+
"attribute": "required",
|
|
368
|
+
"defaultValue": "false"
|
|
369
|
+
},
|
|
370
|
+
"min": {
|
|
371
|
+
"type": "number",
|
|
372
|
+
"mutable": false,
|
|
373
|
+
"complexType": {
|
|
374
|
+
"original": "number",
|
|
375
|
+
"resolved": "number",
|
|
376
|
+
"references": {}
|
|
377
|
+
},
|
|
378
|
+
"required": false,
|
|
379
|
+
"optional": true,
|
|
380
|
+
"docs": {
|
|
381
|
+
"tags": [],
|
|
382
|
+
"text": "Minimum accepted value."
|
|
383
|
+
},
|
|
384
|
+
"getter": false,
|
|
385
|
+
"setter": false,
|
|
386
|
+
"reflect": false,
|
|
387
|
+
"attribute": "min"
|
|
388
|
+
},
|
|
389
|
+
"max": {
|
|
390
|
+
"type": "number",
|
|
391
|
+
"mutable": false,
|
|
392
|
+
"complexType": {
|
|
393
|
+
"original": "number",
|
|
394
|
+
"resolved": "number",
|
|
395
|
+
"references": {}
|
|
396
|
+
},
|
|
397
|
+
"required": false,
|
|
398
|
+
"optional": true,
|
|
399
|
+
"docs": {
|
|
400
|
+
"tags": [],
|
|
401
|
+
"text": "Maximum accepted value."
|
|
402
|
+
},
|
|
403
|
+
"getter": false,
|
|
404
|
+
"setter": false,
|
|
405
|
+
"reflect": false,
|
|
406
|
+
"attribute": "max"
|
|
407
|
+
},
|
|
408
|
+
"step": {
|
|
409
|
+
"type": "any",
|
|
410
|
+
"mutable": false,
|
|
411
|
+
"complexType": {
|
|
412
|
+
"original": "ChNumberInputStep",
|
|
413
|
+
"resolved": "\"any\" | number",
|
|
414
|
+
"references": {
|
|
415
|
+
"ChNumberInputStep": {
|
|
416
|
+
"location": "local",
|
|
417
|
+
"path": "/home/runner/work/chucao/chucao/src/components/ch-number-input/ch-number-input.tsx",
|
|
418
|
+
"id": "src/components/ch-number-input/ch-number-input.tsx::ChNumberInputStep"
|
|
419
|
+
}
|
|
420
|
+
}
|
|
421
|
+
},
|
|
422
|
+
"required": false,
|
|
423
|
+
"optional": false,
|
|
424
|
+
"docs": {
|
|
425
|
+
"tags": [],
|
|
426
|
+
"text": "Stepping increment. `'any'` disables stepping validation."
|
|
427
|
+
},
|
|
428
|
+
"getter": false,
|
|
429
|
+
"setter": false,
|
|
430
|
+
"reflect": false,
|
|
431
|
+
"attribute": "step",
|
|
432
|
+
"defaultValue": "'any'"
|
|
433
|
+
},
|
|
434
|
+
"hint": {
|
|
435
|
+
"type": "string",
|
|
436
|
+
"mutable": false,
|
|
437
|
+
"complexType": {
|
|
438
|
+
"original": "string",
|
|
439
|
+
"resolved": "string",
|
|
440
|
+
"references": {}
|
|
441
|
+
},
|
|
442
|
+
"required": false,
|
|
443
|
+
"optional": true,
|
|
444
|
+
"docs": {
|
|
445
|
+
"tags": [],
|
|
446
|
+
"text": "Helper text, replaced by `errorMessage` when invalid."
|
|
447
|
+
},
|
|
448
|
+
"getter": false,
|
|
449
|
+
"setter": false,
|
|
450
|
+
"reflect": false,
|
|
451
|
+
"attribute": "hint"
|
|
452
|
+
},
|
|
453
|
+
"errorMessage": {
|
|
454
|
+
"type": "string",
|
|
455
|
+
"mutable": false,
|
|
456
|
+
"complexType": {
|
|
457
|
+
"original": "string",
|
|
458
|
+
"resolved": "string",
|
|
459
|
+
"references": {}
|
|
460
|
+
},
|
|
461
|
+
"required": false,
|
|
462
|
+
"optional": true,
|
|
463
|
+
"docs": {
|
|
464
|
+
"tags": [],
|
|
465
|
+
"text": "Custom error message; wins over the built-in range messages."
|
|
466
|
+
},
|
|
467
|
+
"getter": false,
|
|
468
|
+
"setter": false,
|
|
469
|
+
"reflect": false,
|
|
470
|
+
"attribute": "error-message"
|
|
471
|
+
},
|
|
472
|
+
"invalid": {
|
|
473
|
+
"type": "boolean",
|
|
474
|
+
"mutable": false,
|
|
475
|
+
"complexType": {
|
|
476
|
+
"original": "boolean",
|
|
477
|
+
"resolved": "boolean",
|
|
478
|
+
"references": {}
|
|
479
|
+
},
|
|
480
|
+
"required": false,
|
|
481
|
+
"optional": false,
|
|
482
|
+
"docs": {
|
|
483
|
+
"tags": [],
|
|
484
|
+
"text": "Whether the field is marked invalid by the consumer."
|
|
485
|
+
},
|
|
486
|
+
"getter": false,
|
|
487
|
+
"setter": false,
|
|
488
|
+
"reflect": false,
|
|
489
|
+
"attribute": "invalid",
|
|
490
|
+
"defaultValue": "false"
|
|
491
|
+
}
|
|
492
|
+
};
|
|
493
|
+
}
|
|
494
|
+
static get states() {
|
|
495
|
+
return {
|
|
496
|
+
"formDisabled": {},
|
|
497
|
+
"draft": {},
|
|
498
|
+
"typing": {}
|
|
499
|
+
};
|
|
500
|
+
}
|
|
501
|
+
static get events() {
|
|
502
|
+
return [{
|
|
503
|
+
"method": "chInput",
|
|
504
|
+
"name": "chInput",
|
|
505
|
+
"bubbles": true,
|
|
506
|
+
"cancelable": true,
|
|
507
|
+
"composed": true,
|
|
508
|
+
"docs": {
|
|
509
|
+
"tags": [],
|
|
510
|
+
"text": "Emitted on every keystroke with the canonical value."
|
|
511
|
+
},
|
|
512
|
+
"complexType": {
|
|
513
|
+
"original": "string",
|
|
514
|
+
"resolved": "string",
|
|
515
|
+
"references": {}
|
|
516
|
+
}
|
|
517
|
+
}, {
|
|
518
|
+
"method": "chChange",
|
|
519
|
+
"name": "chChange",
|
|
520
|
+
"bubbles": true,
|
|
521
|
+
"cancelable": true,
|
|
522
|
+
"composed": true,
|
|
523
|
+
"docs": {
|
|
524
|
+
"tags": [],
|
|
525
|
+
"text": "Emitted on commit (native `change`) with the canonical value."
|
|
526
|
+
},
|
|
527
|
+
"complexType": {
|
|
528
|
+
"original": "string",
|
|
529
|
+
"resolved": "string",
|
|
530
|
+
"references": {}
|
|
531
|
+
}
|
|
532
|
+
}];
|
|
533
|
+
}
|
|
534
|
+
static get elementRef() { return "host"; }
|
|
535
|
+
static get watchers() {
|
|
536
|
+
return [{
|
|
537
|
+
"propName": "required",
|
|
538
|
+
"methodName": "syncForm"
|
|
539
|
+
}, {
|
|
540
|
+
"propName": "invalid",
|
|
541
|
+
"methodName": "syncForm"
|
|
542
|
+
}, {
|
|
543
|
+
"propName": "errorMessage",
|
|
544
|
+
"methodName": "syncForm"
|
|
545
|
+
}, {
|
|
546
|
+
"propName": "min",
|
|
547
|
+
"methodName": "syncForm"
|
|
548
|
+
}, {
|
|
549
|
+
"propName": "max",
|
|
550
|
+
"methodName": "syncForm"
|
|
551
|
+
}];
|
|
552
|
+
}
|
|
553
|
+
static get attachInternalsMemberName() { return "internals"; }
|
|
554
|
+
}
|
|
555
|
+
//# sourceMappingURL=ch-number-input.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ch-number-input.js","sourceRoot":"","sources":["../../../../src/components/ch-number-input/ch-number-input.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,SAAS,EAAE,OAAO,EAAE,KAAK,EAAqB,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,EAAE,MAAM,eAAe,CAAC;AAE3H,OAAO,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AAMjE,IAAI,cAAc,GAAG,CAAC,CAAC;AAEvB;;;;;;;;;;;;;;;GAeG;AAOH,MAAM,OAAO,aAAa;IACP,OAAO,GAAG,mBAAmB,EAAE,cAAc,EAAE,CAAC;IAChD,MAAM,GAAG,GAAG,IAAI,CAAC,OAAO,OAAO,CAAC;IAChC,OAAO,GAAG,GAAG,IAAI,CAAC,OAAO,QAAQ,CAAC;IAC3C,YAAY,GAAG,EAAE,CAAC;IAEP,SAA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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { AttachInternals, Component, Element, Event, type EventEmitter, Host, Prop, State, Watch, h } from '@stencil/core';\n\nimport { resolveValidity } from '../../utils/validation-message';\n\nexport type ChNumberInputFormat = 'plain' | 'clp';\n\nexport type ChNumberInputStep = number | 'any';\n\nlet numberInputIds = 0;\n\n/**\n * Numeric input that keeps what the user is typing separate from the value the\n * form submits.\n *\n * The display is formatted (`1.234.567` for CLP) while `value` and `FormData`\n * carry a canonical machine-readable string: digits only for CLP, the plain\n * decimal for `plain`. Parsing on every keystroke cannot represent the\n * intermediate states people actually type — `-`, `1.`, `0,` — so those stay as\n * text and are validated at the end.\n *\n * Empty is not zero. A cleared field submits `''` and reports `valueMissing`\n * when required; it never becomes `0`.\n *\n * There is no separate currency component: `format=\"clp\"` is the currency\n * boundary for Chilean pesos, the only case with a real consumer.\n */\n@Component({\n tag: 'ch-number-input',\n styleUrl: 'ch-number-input.css',\n shadow: true,\n formAssociated: true,\n})\nexport class ChNumberInput {\n private readonly inputId = `ch-number-input-${++numberInputIds}`;\n private readonly hintId = `${this.inputId}-hint`;\n private readonly errorId = `${this.inputId}-error`;\n private initialValue = '';\n\n @AttachInternals() internals!: ElementInternals;\n @State() formDisabled = false;\n @Element() private host!: HTMLElement;\n\n /** Visible label, associated with the input via `for`/`id`. */\n @Prop() label?: string;\n\n /**\n * Canonical value: digits only for `clp`, a plain decimal string for `plain`.\n * Never formatted — formatting lives in the rendered text.\n */\n @Prop({ mutable: true }) value = '';\n\n /** How the number is displayed while typing. */\n @Prop() format: ChNumberInputFormat = 'plain';\n\n /** Placeholder shown when the field is empty. */\n @Prop() placeholder?: string;\n\n /** Name submitted with the form. */\n @Prop({ reflect: true }) name?: string;\n\n /** Whether the field is disabled. */\n @Prop({ reflect: true }) disabled = false;\n\n /** Whether a value is required; an empty field is then invalid. */\n @Prop({ reflect: true }) required = false;\n\n /** Minimum accepted value. */\n @Prop() min?: number;\n\n /** Maximum accepted value. */\n @Prop() max?: number;\n\n /** Stepping increment. `'any'` disables stepping validation. */\n @Prop() step: ChNumberInputStep = 'any';\n\n /** Helper text, replaced by `errorMessage` when invalid. */\n @Prop() hint?: string;\n\n /** Custom error message; wins over the built-in range messages. */\n @Prop() errorMessage?: string;\n\n /** Whether the field is marked invalid by the consumer. */\n @Prop() invalid = false;\n\n /** Emitted on every keystroke with the canonical value. */\n @Event() chInput: EventEmitter<string>;\n\n /** Emitted on commit (native `change`) with the canonical value. */\n @Event() chChange: EventEmitter<string>;\n\n /**\n * The text in the input, which may be a partial number like `-` or `1.`.\n * This is the only thing rendered, so it is also what a reset must restore.\n */\n @State() private draft = '';\n\n /**\n * Whether the user has typed since the last commit. While false the input\n * renders `value` directly, which is what makes `formResetCallback` and a\n * consumer assigning `.value` repaint without extra bookkeeping.\n */\n @State() private typing = false;\n\n componentWillLoad() {\n this.draft = this.formatDisplay(this.value);\n }\n\n private get decimals(): boolean {\n return this.format !== 'clp';\n }\n\n /** Formats a canonical value for display. */\n private formatDisplay(value: string): string {\n if (value === '') {\n return '';\n }\n if (this.format === 'clp') {\n const digits = value.replace(/\\D/gu, '');\n return digits === '' ? '' : Number(digits).toLocaleString('es-CL');\n }\n return value;\n }\n\n /**\n * Strips display formatting back to the canonical string: digits only for\n * CLP; a leading sign, digits and one decimal separator for `plain`.\n */\n private toCanonical(text: string): string {\n if (this.format === 'clp') {\n return text.replace(/\\D/gu, '');\n }\n const normalised = text.replace(/\\s/gu, '').replace(',', '.');\n const match = /^-?\\d*(?:\\.\\d*)?/u.exec(normalised);\n return match ? match[0] : '';\n }\n\n /**\n * Whether the field holds a real number. A draft that is only a sign or a\n * separator (`-`, `.`) is still being typed and submits as empty.\n */\n private get isEmpty(): boolean {\n return !/^-?\\d/u.test(this.toCanonical(this.draft));\n }\n\n /** What the form receives and `value` exposes. */\n private get canonical(): string {\n return this.isEmpty ? '' : this.toCanonical(this.draft);\n }\n\n private get numericValue(): number {\n return Number(this.canonical);\n }\n\n /** The message for a value outside `min`/`max`, if there is one. */\n private outOfRange(parsed: number): string | undefined {\n const { min, max } = this;\n if (min !== undefined && parsed < min) {\n return `Enter a value of at least ${min}.`;\n }\n if (max !== undefined && parsed > max) {\n return `Enter a value of at most ${max}.`;\n }\n return undefined;\n }\n\n private rangeError(): string | undefined {\n if (this.errorMessage || this.isEmpty || this.invalid) {\n return undefined;\n }\n const parsed = this.numericValue;\n return Number.isNaN(parsed) ? 'Enter a valid number.' : this.outOfRange(parsed);\n }\n\n @Watch('required')\n @Watch('invalid')\n @Watch('errorMessage')\n @Watch('min')\n @Watch('max')\n protected syncForm(): void {\n const { internals, required, invalid, errorMessage, canonical } = this;\n if (typeof internals?.setFormValue !== 'function') {\n return;\n }\n internals.setFormValue(canonical);\n\n const base = resolveValidity({ required, empty: canonical === '', invalid, errorMessage });\n const rangeMessage = this.rangeError();\n if (rangeMessage) {\n internals.setValidity({ ...base.flags, badInput: true }, rangeMessage);\n return;\n }\n internals.setValidity(base.flags, base.message);\n }\n\n componentDidLoad() {\n this.initialValue = this.value;\n this.syncForm();\n this.host.addEventListener('change', this.markTouched);\n this.host.addEventListener('focusout', this.markTouched);\n this.host.addEventListener('invalid', this.markTouched);\n }\n\n private markTouched = (): void => {\n this.host.setAttribute('data-touched', '');\n };\n\n formResetCallback(): void {\n this.value = this.initialValue;\n this.draft = this.formatDisplay(this.initialValue);\n this.typing = false;\n this.syncForm();\n // The vdom does not push a re-rendered `value` onto a live `<input>`: the\n // property is set by the browser's own typing and the diff sees no change.\n // A reset restores the text directly.\n const input = this.host.shadowRoot?.querySelector('input');\n if (input) {\n input.value = this.formatDisplay(this.initialValue);\n }\n }\n\n formDisabledCallback(isDisabled: boolean): void {\n this.formDisabled = isDisabled;\n }\n\n private commit(text: string): void {\n this.typing = true;\n this.draft = text;\n this.value = this.canonical;\n this.chInput.emit(this.value);\n this.syncForm();\n }\n\n private handleInput = (ev: InputEvent) => {\n this.commit((ev.target as HTMLInputElement).value);\n };\n\n private handleChange = (ev: Event) => {\n this.commit((ev.target as HTMLInputElement).value);\n this.chChange.emit(this.value);\n };\n\n /** Reformats grouped CLP digits once the field loses focus. */\n private handleBlur = () => {\n if (this.format === 'clp') {\n this.draft = this.formatDisplay(this.canonical);\n }\n };\n\n private get isInvalid(): boolean {\n return this.invalid || this.rangeError() !== undefined;\n }\n\n private get describedBy(): string | undefined {\n if (this.isInvalid && this.errorMessage) {\n return this.errorId;\n }\n if (this.hint) {\n return this.hintId;\n }\n return undefined;\n }\n\n render() {\n const showError = this.isInvalid && this.errorMessage;\n return (\n <Host>\n {this.label && (\n <label class=\"label\" htmlFor={this.inputId}>\n {this.label}\n </label>\n )}\n <input\n id={this.label ? this.inputId : undefined}\n class={{ 'input': true, 'input--invalid': this.isInvalid }}\n // `text` with `inputmode`, not `type=\"number\"`: a number input drops\n // partial values and cannot show grouped digits.\n type=\"text\"\n inputMode={this.decimals ? 'decimal' : 'numeric'}\n name={this.name}\n placeholder={this.placeholder}\n disabled={this.disabled || this.formDisabled}\n required={this.required}\n value={this.typing ? this.draft : this.formatDisplay(this.value)}\n aria-invalid={this.isInvalid ? 'true' : undefined}\n aria-describedby={this.describedBy}\n onInput={this.handleInput}\n onChange={this.handleChange}\n onBlur={this.handleBlur}\n />\n {this.hint && !showError && (\n <p class=\"hint\" id={this.hintId}>\n {this.hint}\n </p>\n )}\n {showError && (\n <p class=\"error\" id={this.errorId} role=\"alert\">\n {this.errorMessage}\n </p>\n )}\n </Host>\n );\n }\n}\n"]}
|
|
@@ -37,7 +37,7 @@ export class ChPageHeader {
|
|
|
37
37
|
actionsStacked = false;
|
|
38
38
|
render() {
|
|
39
39
|
const Heading = this.headingLevel;
|
|
40
|
-
return (h(Host, { key: '
|
|
40
|
+
return (h(Host, { key: '3d8de76e3df7fba8be55d0708861c7d136b05722' }, h("div", { key: '057d2b4359b9faff34b9fbf6886b04d5d89dc9ac', class: { 'header': true, 'header--stacked': this.actionsStacked } }, h("div", { key: '1ff40b1cd100d41a72d80ab35e619f93b4a43633', class: "header-text" }, this.eyebrow && h("p", { key: '6c2538bf1d450a6dca25fd2815968a9622f7fcbf', class: "header-eyebrow" }, this.eyebrow), h(Heading, { key: '54cdf8e62468e11cf9fe084023e4fe624f958452', class: "header-title" }, this.title), this.description && h("p", { key: 'fe9c6cc78354b38b8833871ddc53d412007abe29', class: "header-description" }, this.description)), h("div", { key: 'e91a66715e2c23478c375ce9ddcf29c04f85b3eb', class: "header-actions" }, h("slot", { key: '06654c2a28d004791ed5b9c213cd66ef80bbcc85', name: "actions" })))));
|
|
41
41
|
}
|
|
42
42
|
static get is() { return "ch-page-header"; }
|
|
43
43
|
static get encapsulation() { return "shadow"; }
|
|
@@ -98,7 +98,7 @@ export class ChRadio {
|
|
|
98
98
|
}
|
|
99
99
|
render() {
|
|
100
100
|
const groupName = this.name || `${this.groupId}-group`;
|
|
101
|
-
return (h(Host, { key: '
|
|
101
|
+
return (h(Host, { key: 'a027da2d803a6e8a2a35afa1920dd3b0f8e06b01' }, this.label && (h("span", { key: '28e11cd1148a89a4f3e85d331f00e39f1d7751ce', class: "group-label", id: this.labelId }, this.label)), h("div", { key: '43d8a53c9bec1dc129b6588c0118ebe2109b4b7e', class: "radio-group", role: "radiogroup", "aria-labelledby": this.label ? this.labelId : undefined }, this.options.map(option => (h("label", { class: { 'control': true, 'control--disabled': this.disabled || this.formDisabled || option.disabled } }, h("input", { class: { 'input': true, 'input--invalid': this.invalid }, type: "radio", name: groupName, value: option.value, checked: option.value === this.value, disabled: this.disabled || this.formDisabled || option.disabled, "aria-invalid": this.invalid ? 'true' : undefined, "aria-describedby": this.describedBy, onChange: this.handleChange }), h("span", { class: "mark" }), h("span", { class: "label-text" }, option.label))))), this.hint && !(this.invalid && this.errorMessage) && (h("p", { key: '27335cc50f8b280f93857eea370aa37e2290b46b', class: "hint", id: this.hintId }, this.hint)), this.invalid && this.errorMessage && (h("p", { key: '83f93bdc0739961136062acb784a3d6e666de349', class: "error", id: this.errorId, role: "alert" }, this.errorMessage))));
|
|
102
102
|
}
|
|
103
103
|
static get is() { return "ch-radio"; }
|
|
104
104
|
static get encapsulation() { return "shadow"; }
|
|
@@ -92,7 +92,7 @@ export class ChSegmentedControl {
|
|
|
92
92
|
}
|
|
93
93
|
render() {
|
|
94
94
|
const groupName = this.name || `${this.groupId}-group`;
|
|
95
|
-
return (h(Host, { key: '
|
|
95
|
+
return (h(Host, { key: '59e0782a5c120cd243bbd67eb727ba1a7755d45f' }, this.label && (h("span", { key: 'f1faf9b240224e4c2b10059ed7bf667e24e5997d', class: "group-label", id: this.labelId }, this.label)), h("div", { key: 'b9e59c0fbd4af04ad4d079415497440ec0a60801', class: { segmented: true, [`segmented--${this.size}`]: true }, role: "radiogroup", "aria-labelledby": this.label ? this.labelId : undefined }, this.options.map(option => (h("label", { class: { 'control': true, 'control--disabled': this.disabled || this.formDisabled || option.disabled } }, h("input", { class: "input", type: "radio", name: groupName, value: option.value, checked: option.value === this.value, disabled: this.disabled || this.formDisabled || option.disabled, onChange: this.handleChange }), h("span", { class: "label-text" }, option.label)))))));
|
|
96
96
|
}
|
|
97
97
|
static get is() { return "ch-segmented-control"; }
|
|
98
98
|
static get encapsulation() { return "shadow"; }
|
|
@@ -99,7 +99,7 @@ export class ChSelect {
|
|
|
99
99
|
return undefined;
|
|
100
100
|
}
|
|
101
101
|
render() {
|
|
102
|
-
return (h(Host, { key: '
|
|
102
|
+
return (h(Host, { key: 'f57fbcbfaaf64a9cbf1f201edd2f9f714db9afee' }, this.label && (h("label", { key: 'e7a4a802ff85cd597e5bdb9a54858e3cbbbcf73b', class: "label", htmlFor: this.selectId }, this.label)), h("select", { key: '5d70a598757d9440d90351e8639a876388b5f7a7', id: this.label ? this.selectId : undefined, class: { 'select': true, 'select--invalid': this.invalid }, name: this.name, disabled: this.disabled || this.formDisabled, required: this.required, "aria-invalid": this.invalid ? 'true' : undefined, "aria-describedby": this.describedBy, onChange: this.handleChange }, this.placeholder && (h("option", { key: '9a002af8f52ab2bb2d2c762417cad071b7dd06c7', value: "", disabled: true, hidden: true, selected: !this.value }, this.placeholder)), this.options.map(option => (h("option", { value: option.value, disabled: option.disabled, selected: option.value === this.value }, option.label)))), this.hint && !(this.invalid && this.errorMessage) && (h("p", { key: '0224ab6e0a54b925e0754c43bb15ceaab84c34a4', class: "hint", id: this.hintId }, this.hint)), this.invalid && this.errorMessage && (h("p", { key: '1624ae9938d47971ee8195f986c45454dad7f846', class: "error", id: this.errorId, role: "alert" }, this.errorMessage))));
|
|
103
103
|
}
|
|
104
104
|
static get is() { return "ch-select"; }
|
|
105
105
|
static get encapsulation() { return "shadow"; }
|
|
@@ -47,7 +47,7 @@ export class ChSkeleton {
|
|
|
47
47
|
return { width: this.width, height: this.height };
|
|
48
48
|
}
|
|
49
49
|
render() {
|
|
50
|
-
return (h(Host, { key: '
|
|
50
|
+
return (h(Host, { key: 'b28cd1be6da1721ff6b93ed1e4bab119ea066ad4', "aria-hidden": "true", class: { 'skeleton': true, [`skeleton--${this.shape}`]: true, 'skeleton--animated': this.animated } }, Array.from({ length: this.items }).map((value, index) => (h("span", { class: "skeleton__item", style: this.sizeStyle, key: index, "data-index": String(value) })))));
|
|
51
51
|
}
|
|
52
52
|
static get is() { return "ch-skeleton"; }
|
|
53
53
|
static get encapsulation() { return "shadow"; }
|