tyrell-components 1.0.0-RC16 → 1.0.0-RC18
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/README.md +1 -1
- package/css/tyrell-colors-static.css +1 -316
- package/css/tyrell-theme.css +1 -1471
- package/css/tyrell.css +1 -1385
- package/dist/tyrell-colors-static.css +1 -1
- package/dist/tyrell-theme.css +1 -1
- package/dist/tyrell.js +1 -1
- package/lib/base/ty-component.d.ts +28 -15
- package/lib/base/ty-component.js +81 -38
- package/lib/components/button.d.ts +14 -0
- package/lib/components/button.js +55 -7
- package/lib/components/calendar-month.d.ts +7 -1
- package/lib/components/calendar-month.js +35 -28
- package/lib/components/calendar-navigation.js +19 -6
- package/lib/components/calendar.d.ts +27 -3
- package/lib/components/calendar.js +107 -63
- package/lib/components/checkbox.d.ts +8 -1
- package/lib/components/checkbox.js +27 -6
- package/lib/components/copy.d.ts +2 -0
- package/lib/components/copy.js +15 -31
- package/lib/components/date-picker.d.ts +53 -18
- package/lib/components/date-picker.js +217 -146
- package/lib/components/file-upload.d.ts +4 -1
- package/lib/components/file-upload.js +23 -5
- package/lib/components/input.d.ts +73 -3
- package/lib/components/input.js +158 -22
- package/lib/components/modal.d.ts +2 -0
- package/lib/components/modal.js +97 -17
- package/lib/components/option.d.ts +19 -0
- package/lib/components/option.js +45 -31
- package/lib/components/popup.js +115 -15
- package/lib/components/radio.d.ts +10 -1
- package/lib/components/radio.js +22 -29
- package/lib/components/resize-observer.js +2 -0
- package/lib/components/scroll-container.js +2 -0
- package/lib/components/select.d.ts +150 -190
- package/lib/components/select.js +501 -796
- package/lib/components/selected-tags.d.ts +14 -4
- package/lib/components/selected-tags.js +35 -8
- package/lib/components/switch.d.ts +9 -1
- package/lib/components/switch.js +27 -6
- package/lib/components/tabs.js +1 -1
- package/lib/components/tag.d.ts +0 -9
- package/lib/components/tag.js +0 -11
- package/lib/components/textarea.d.ts +47 -2
- package/lib/components/textarea.js +81 -17
- package/lib/index.d.ts +1 -0
- package/lib/index.js +1 -0
- package/lib/styles/button.js +21 -19
- package/lib/styles/calendar-month.js +1 -1
- package/lib/styles/calendar.js +3 -0
- package/lib/styles/checkbox.js +11 -5
- package/lib/styles/date-picker.js +16 -4
- package/lib/styles/file-upload.d.ts +1 -1
- package/lib/styles/file-upload.js +3 -3
- package/lib/styles/icon.d.ts +1 -1
- package/lib/styles/icon.js +2 -2
- package/lib/styles/input.js +6 -10
- package/lib/styles/option.d.ts +1 -1
- package/lib/styles/option.js +6 -7
- package/lib/styles/popup.d.ts +1 -1
- package/lib/styles/popup.js +2 -0
- package/lib/styles/radio.js +12 -6
- package/lib/styles/select-base.js +22 -60
- package/lib/styles/select.d.ts +1 -1
- package/lib/styles/select.js +13 -2
- package/lib/styles/switch.js +10 -5
- package/lib/styles/tag.js +3 -5
- package/lib/styles/textarea.d.ts +1 -1
- package/lib/styles/textarea.js +7 -0
- package/lib/types/common.d.ts +3 -3
- package/lib/utils/calendar-utils.d.ts +49 -0
- package/lib/utils/calendar-utils.js +63 -6
- package/lib/utils/property-manager.d.ts +6 -5
- package/lib/utils/property-manager.js +14 -15
- package/lib/utils/scroll-lock.d.ts +10 -4
- package/lib/utils/scroll-lock.js +102 -2
- package/lib/utils/upgrade-properties.d.ts +21 -0
- package/lib/utils/upgrade-properties.js +47 -0
- package/lib/utils/validity.d.ts +98 -2
- package/lib/utils/validity.js +244 -8
- package/lib/version.d.ts +1 -1
- package/lib/version.js +1 -1
- package/package.json +8 -6
- package/lib/base/ty-component.d.ts.map +0 -1
- package/lib/base/ty-component.js.map +0 -1
- package/lib/components/button.d.ts.map +0 -1
- package/lib/components/button.js.map +0 -1
- package/lib/components/calendar-month.d.ts.map +0 -1
- package/lib/components/calendar-month.js.map +0 -1
- package/lib/components/calendar-navigation.d.ts.map +0 -1
- package/lib/components/calendar-navigation.js.map +0 -1
- package/lib/components/calendar.d.ts.map +0 -1
- package/lib/components/calendar.js.map +0 -1
- package/lib/components/checkbox.d.ts.map +0 -1
- package/lib/components/checkbox.js.map +0 -1
- package/lib/components/copy.d.ts.map +0 -1
- package/lib/components/copy.js.map +0 -1
- package/lib/components/date-picker.d.ts.map +0 -1
- package/lib/components/date-picker.js.map +0 -1
- package/lib/components/dropdown.d.ts +0 -403
- package/lib/components/dropdown.d.ts.map +0 -1
- package/lib/components/dropdown.js +0 -1315
- package/lib/components/dropdown.js.map +0 -1
- package/lib/components/icon.d.ts.map +0 -1
- package/lib/components/icon.js.map +0 -1
- package/lib/components/input.d.ts.map +0 -1
- package/lib/components/input.js.map +0 -1
- package/lib/components/modal.d.ts.map +0 -1
- package/lib/components/modal.js.map +0 -1
- package/lib/components/multiselect.d.ts +0 -389
- package/lib/components/multiselect.d.ts.map +0 -1
- package/lib/components/multiselect.js +0 -1301
- package/lib/components/multiselect.js.map +0 -1
- package/lib/components/option.d.ts.map +0 -1
- package/lib/components/option.js.map +0 -1
- package/lib/components/popup.d.ts.map +0 -1
- package/lib/components/popup.js.map +0 -1
- package/lib/components/resize-observer.d.ts.map +0 -1
- package/lib/components/resize-observer.js.map +0 -1
- package/lib/components/scroll-container.d.ts.map +0 -1
- package/lib/components/scroll-container.js.map +0 -1
- package/lib/components/step.d.ts.map +0 -1
- package/lib/components/step.js.map +0 -1
- package/lib/components/tab.d.ts.map +0 -1
- package/lib/components/tab.js.map +0 -1
- package/lib/components/tabs.d.ts.map +0 -1
- package/lib/components/tabs.js.map +0 -1
- package/lib/components/tag.d.ts.map +0 -1
- package/lib/components/tag.js.map +0 -1
- package/lib/components/textarea.d.ts.map +0 -1
- package/lib/components/textarea.js.map +0 -1
- package/lib/components/tooltip.d.ts.map +0 -1
- package/lib/components/tooltip.js.map +0 -1
- package/lib/components/wizard.d.ts.map +0 -1
- package/lib/components/wizard.js.map +0 -1
- package/lib/icons/fontawesome/brands.d.ts.map +0 -1
- package/lib/icons/fontawesome/brands.js.map +0 -1
- package/lib/icons/fontawesome/regular.d.ts.map +0 -1
- package/lib/icons/fontawesome/regular.js.map +0 -1
- package/lib/icons/fontawesome/solid.d.ts.map +0 -1
- package/lib/icons/fontawesome/solid.js.map +0 -1
- package/lib/icons/heroicons/micro.d.ts.map +0 -1
- package/lib/icons/heroicons/micro.js.map +0 -1
- package/lib/icons/heroicons/mini.d.ts.map +0 -1
- package/lib/icons/heroicons/mini.js.map +0 -1
- package/lib/icons/heroicons/outline.d.ts.map +0 -1
- package/lib/icons/heroicons/outline.js.map +0 -1
- package/lib/icons/heroicons/solid.d.ts.map +0 -1
- package/lib/icons/heroicons/solid.js.map +0 -1
- package/lib/icons/lucide.d.ts.map +0 -1
- package/lib/icons/lucide.js.map +0 -1
- package/lib/icons/material/filled.d.ts.map +0 -1
- package/lib/icons/material/filled.js.map +0 -1
- package/lib/icons/material/outlined.d.ts.map +0 -1
- package/lib/icons/material/outlined.js.map +0 -1
- package/lib/icons/material/round.d.ts.map +0 -1
- package/lib/icons/material/round.js.map +0 -1
- package/lib/icons/material/sharp.d.ts.map +0 -1
- package/lib/icons/material/sharp.js.map +0 -1
- package/lib/icons/material/two-tone.d.ts.map +0 -1
- package/lib/icons/material/two-tone.js.map +0 -1
- package/lib/index.d.ts.map +0 -1
- package/lib/index.js.map +0 -1
- package/lib/styles/button.d.ts.map +0 -1
- package/lib/styles/button.js.map +0 -1
- package/lib/styles/calendar-month.d.ts.map +0 -1
- package/lib/styles/calendar-month.js.map +0 -1
- package/lib/styles/calendar-navigation.d.ts.map +0 -1
- package/lib/styles/calendar-navigation.js.map +0 -1
- package/lib/styles/calendar.d.ts.map +0 -1
- package/lib/styles/calendar.js.map +0 -1
- package/lib/styles/copy.d.ts.map +0 -1
- package/lib/styles/copy.js.map +0 -1
- package/lib/styles/date-picker.d.ts.map +0 -1
- package/lib/styles/date-picker.js.map +0 -1
- package/lib/styles/dropdown.d.ts +0 -12
- package/lib/styles/dropdown.d.ts.map +0 -1
- package/lib/styles/dropdown.js +0 -725
- package/lib/styles/dropdown.js.map +0 -1
- package/lib/styles/icon.d.ts.map +0 -1
- package/lib/styles/icon.js.map +0 -1
- package/lib/styles/input.d.ts.map +0 -1
- package/lib/styles/input.js.map +0 -1
- package/lib/styles/modal.d.ts.map +0 -1
- package/lib/styles/modal.js.map +0 -1
- package/lib/styles/multiselect.d.ts +0 -6
- package/lib/styles/multiselect.d.ts.map +0 -1
- package/lib/styles/multiselect.js +0 -568
- package/lib/styles/multiselect.js.map +0 -1
- package/lib/styles/option.d.ts.map +0 -1
- package/lib/styles/option.js.map +0 -1
- package/lib/styles/popup.d.ts.map +0 -1
- package/lib/styles/popup.js.map +0 -1
- package/lib/styles/resize-observer.d.ts.map +0 -1
- package/lib/styles/resize-observer.js.map +0 -1
- package/lib/styles/scroll-container.d.ts.map +0 -1
- package/lib/styles/scroll-container.js.map +0 -1
- package/lib/styles/step.d.ts.map +0 -1
- package/lib/styles/step.js.map +0 -1
- package/lib/styles/tab.d.ts.map +0 -1
- package/lib/styles/tab.js.map +0 -1
- package/lib/styles/tabs.d.ts.map +0 -1
- package/lib/styles/tabs.js.map +0 -1
- package/lib/styles/tag.d.ts.map +0 -1
- package/lib/styles/tag.js.map +0 -1
- package/lib/styles/textarea.d.ts.map +0 -1
- package/lib/styles/textarea.js.map +0 -1
- package/lib/styles/tooltip.d.ts.map +0 -1
- package/lib/styles/tooltip.js.map +0 -1
- package/lib/styles/wizard.d.ts.map +0 -1
- package/lib/styles/wizard.js.map +0 -1
- package/lib/types/common.d.ts.map +0 -1
- package/lib/types/common.js.map +0 -1
- package/lib/utils/calendar-utils.d.ts.map +0 -1
- package/lib/utils/calendar-utils.js.map +0 -1
- package/lib/utils/icon-registry.d.ts.map +0 -1
- package/lib/utils/icon-registry.js.map +0 -1
- package/lib/utils/locale.d.ts.map +0 -1
- package/lib/utils/locale.js.map +0 -1
- package/lib/utils/number-format.d.ts.map +0 -1
- package/lib/utils/number-format.js.map +0 -1
- package/lib/utils/parse-boolean.d.ts +0 -39
- package/lib/utils/parse-boolean.d.ts.map +0 -1
- package/lib/utils/parse-boolean.js +0 -23
- package/lib/utils/parse-boolean.js.map +0 -1
- package/lib/utils/positioning.d.ts.map +0 -1
- package/lib/utils/positioning.js.map +0 -1
- package/lib/utils/property-capture.d.ts.map +0 -1
- package/lib/utils/property-capture.js.map +0 -1
- package/lib/utils/property-manager.d.ts.map +0 -1
- package/lib/utils/property-manager.js.map +0 -1
- package/lib/utils/resize-observer.d.ts.map +0 -1
- package/lib/utils/resize-observer.js.map +0 -1
- package/lib/utils/scroll-lock.d.ts.map +0 -1
- package/lib/utils/scroll-lock.js.map +0 -1
- package/lib/utils/styles.d.ts.map +0 -1
- package/lib/utils/styles.js.map +0 -1
- package/lib/version.d.ts.map +0 -1
- package/lib/version.js.map +0 -1
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* TySelectedOptions - out-of-band dismissible <ty-tag> chips for a picker's selection.
|
|
3
|
-
*
|
|
4
|
-
* and flavors
|
|
5
|
-
* come from an optional <template> child,
|
|
3
|
+
* Draws the picker's comma-joined `value`, matched to its options by value for
|
|
4
|
+
* labels and flavors (`[value="..."]`). Works with any element exposing `value`
|
|
5
|
+
* and a bubbling `change`. Custom chips come from an optional <template> child,
|
|
6
|
+
* stamped onto cloned nodes (never innerHTML).
|
|
6
7
|
*/
|
|
7
8
|
export declare class TySelectedOptions extends HTMLElement {
|
|
8
9
|
static get observedAttributes(): string[];
|
|
@@ -11,6 +12,7 @@ export declare class TySelectedOptions extends HTMLElement {
|
|
|
11
12
|
private _childObserver;
|
|
12
13
|
private _pickerObserver;
|
|
13
14
|
private _lastTemplate;
|
|
15
|
+
private _rendered;
|
|
14
16
|
private _pickerOpen;
|
|
15
17
|
private _onPickerOpen;
|
|
16
18
|
private _onPickerClose;
|
|
@@ -22,12 +24,16 @@ export declare class TySelectedOptions extends HTMLElement {
|
|
|
22
24
|
private bind;
|
|
23
25
|
private unbind;
|
|
24
26
|
private values;
|
|
27
|
+
/** Children are still exactly what the last render left. */
|
|
28
|
+
private intact;
|
|
25
29
|
/** The optional chip template (direct child only). */
|
|
26
30
|
private template;
|
|
27
31
|
/**
|
|
28
32
|
* Interpolation context for a value: value, label, flavor plus every
|
|
29
33
|
* data-* attribute of the picker's matching option.
|
|
30
34
|
*/
|
|
35
|
+
/** The picker's option for a value. */
|
|
36
|
+
private option;
|
|
31
37
|
private context;
|
|
32
38
|
/**
|
|
33
39
|
* The template's blueprint fragment. HTML-parsed templates carry children in
|
|
@@ -42,7 +48,11 @@ export declare class TySelectedOptions extends HTMLElement {
|
|
|
42
48
|
* no flavor on the option).
|
|
43
49
|
*/
|
|
44
50
|
private stampTemplate;
|
|
45
|
-
/**
|
|
51
|
+
/**
|
|
52
|
+
* Default chip when no template is provided: the option's own content,
|
|
53
|
+
* cloned, so a rich option makes a rich chip. An explicit `label` on the
|
|
54
|
+
* option replaces it with that text; a <template> child replaces it entirely.
|
|
55
|
+
*/
|
|
46
56
|
private defaultChip;
|
|
47
57
|
private renderChips;
|
|
48
58
|
/** Remove a value from the picker; picker re-emits change → chips re-render. */
|
|
@@ -12,6 +12,7 @@ this._onChange = () => this.renderChips();
|
|
|
12
12
|
this._childObserver = null;
|
|
13
13
|
this._pickerObserver = null;
|
|
14
14
|
this._lastTemplate = null;
|
|
15
|
+
this._rendered = [];
|
|
15
16
|
this._pickerOpen = false;
|
|
16
17
|
this._onPickerOpen = () => {
|
|
17
18
|
this._pickerOpen = true;
|
|
@@ -30,16 +31,21 @@ this.style.display = 'contents';
|
|
|
30
31
|
this.bind();
|
|
31
32
|
this.renderChips();
|
|
32
33
|
if (document.readyState === 'loading') {
|
|
33
|
-
document.addEventListener('DOMContentLoaded', () => {
|
|
34
|
-
this.
|
|
34
|
+
document.addEventListener('DOMContentLoaded', () => {
|
|
35
|
+
if (!this.isConnected)
|
|
36
|
+
return;
|
|
37
|
+
this.bind();
|
|
38
|
+
this.renderChips();
|
|
39
|
+
}, { once: true });
|
|
35
40
|
}
|
|
36
41
|
this._childObserver = new MutationObserver(() => {
|
|
37
|
-
|
|
38
|
-
|
|
42
|
+
if (!this.style.display)
|
|
43
|
+
this.style.display = 'contents';
|
|
44
|
+
if (this.template() !== this._lastTemplate || !this.intact()) {
|
|
39
45
|
this.renderChips();
|
|
40
46
|
}
|
|
41
47
|
});
|
|
42
|
-
this._childObserver.observe(this, { childList: true });
|
|
48
|
+
this._childObserver.observe(this, { childList: true, attributes: true, attributeFilter: ['style'] });
|
|
43
49
|
}
|
|
44
50
|
disconnectedCallback() {
|
|
45
51
|
this.unbind();
|
|
@@ -69,12 +75,18 @@ this._picker?.addEventListener('change', this._onChange);
|
|
|
69
75
|
this._picker?.addEventListener('open', this._onPickerOpen);
|
|
70
76
|
this._picker?.addEventListener('close', this._onPickerClose);
|
|
71
77
|
if (this._picker) {
|
|
78
|
+
const name = this._picker.localName;
|
|
79
|
+
if (name.includes('-') && !customElements.get(name)) {
|
|
80
|
+
customElements.whenDefined(name).then(() => { if (this.isConnected)
|
|
81
|
+
this.renderChips(); });
|
|
82
|
+
}
|
|
72
83
|
this._pickerObserver = new MutationObserver(() => this.renderChips());
|
|
73
84
|
this._pickerObserver.observe(this._picker, {
|
|
74
85
|
childList: true,
|
|
75
86
|
subtree: true,
|
|
87
|
+
characterData: true,
|
|
76
88
|
attributes: true,
|
|
77
|
-
attributeFilter: ['
|
|
89
|
+
attributeFilter: ['value', 'label', 'flavor'],
|
|
78
90
|
});
|
|
79
91
|
}
|
|
80
92
|
}
|
|
@@ -90,11 +102,18 @@ this._pickerOpen = false;
|
|
|
90
102
|
values() {
|
|
91
103
|
return parseValues(this._picker?.value ?? '');
|
|
92
104
|
}
|
|
105
|
+
intact() {
|
|
106
|
+
const kids = this.childNodes;
|
|
107
|
+
return kids.length === this._rendered.length && this._rendered.every((n, i) => kids[i] === n);
|
|
108
|
+
}
|
|
93
109
|
template() {
|
|
94
110
|
return this.querySelector(':scope > template');
|
|
95
111
|
}
|
|
112
|
+
option(value) {
|
|
113
|
+
return this._picker?.querySelector(`[value="${CSS.escape(value)}"]`);
|
|
114
|
+
}
|
|
96
115
|
context(value) {
|
|
97
|
-
const opt = this.
|
|
116
|
+
const opt = this.option(value);
|
|
98
117
|
const ctx = {
|
|
99
118
|
value,
|
|
100
119
|
label: opt?.getAttribute('label') || opt?.textContent?.trim() || value,
|
|
@@ -150,12 +169,18 @@ return clone;
|
|
|
150
169
|
}
|
|
151
170
|
defaultChip(value) {
|
|
152
171
|
const ctx = this.context(value);
|
|
172
|
+
const opt = this.option(value);
|
|
153
173
|
const tag = document.createElement('ty-tag');
|
|
154
174
|
tag.setAttribute('value', value);
|
|
155
175
|
tag.setAttribute('dismissible', 'true');
|
|
156
176
|
if (ctx.flavor)
|
|
157
177
|
tag.setAttribute('flavor', ctx.flavor);
|
|
178
|
+
if (opt && !opt.hasAttribute('label') && opt.hasChildNodes()) {
|
|
179
|
+
opt.childNodes.forEach(n => tag.appendChild(n.cloneNode(true)));
|
|
180
|
+
}
|
|
181
|
+
else {
|
|
158
182
|
tag.textContent = ctx.label;
|
|
183
|
+
}
|
|
159
184
|
tag.addEventListener('dismiss', () => this.deselect(value));
|
|
160
185
|
return tag;
|
|
161
186
|
}
|
|
@@ -165,7 +190,8 @@ return;
|
|
|
165
190
|
const template = this.template();
|
|
166
191
|
this._lastTemplate = template;
|
|
167
192
|
if (!this._picker) {
|
|
168
|
-
this.
|
|
193
|
+
this._rendered = template ? [template] : [];
|
|
194
|
+
this.replaceChildren(...this._rendered);
|
|
169
195
|
return;
|
|
170
196
|
}
|
|
171
197
|
const frag = document.createDocumentFragment();
|
|
@@ -174,6 +200,7 @@ frag.appendChild(template);
|
|
|
174
200
|
for (const value of this.values()) {
|
|
175
201
|
frag.appendChild(template ? this.stampTemplate(template, value) : this.defaultChip(value));
|
|
176
202
|
}
|
|
203
|
+
this._rendered = Array.from(frag.childNodes);
|
|
177
204
|
this.replaceChildren(frag);
|
|
178
205
|
}
|
|
179
206
|
deselect(value) {
|
|
@@ -24,6 +24,8 @@ export interface TySwitchElement extends HTMLElement {
|
|
|
24
24
|
}
|
|
25
25
|
export declare class TySwitch extends TyComponent<SwitchState> implements TySwitchElement {
|
|
26
26
|
static formAssociated: boolean;
|
|
27
|
+
protected static delegatesFocus: boolean;
|
|
28
|
+
protected static labelClicks: boolean;
|
|
27
29
|
protected static properties: {
|
|
28
30
|
checked: {
|
|
29
31
|
type: "boolean";
|
|
@@ -78,11 +80,17 @@ export declare class TySwitch extends TyComponent<SwitchState> implements TySwit
|
|
|
78
80
|
protected getFormValue(): FormDataEntryValue | null;
|
|
79
81
|
private buildClassList;
|
|
80
82
|
private handleSwitchClick;
|
|
83
|
+
/** Keys show the ring, a click hides it (see checkbox.ts). */
|
|
84
|
+
private showFocusRing;
|
|
81
85
|
private handleSwitchKeydown;
|
|
82
86
|
private removeEventListeners;
|
|
83
87
|
private setupEventListeners;
|
|
84
88
|
protected render(): void;
|
|
85
|
-
/**
|
|
89
|
+
/** Focus the switch itself (the host is not focusable; its role element is). */
|
|
90
|
+
focus(options?: FocusOptions): void;
|
|
91
|
+
/** required + unchecked => valueMissing; otherwise valid. The message is a
|
|
92
|
+
* native checkbox's, as a switch where the browser has one (Safari's
|
|
93
|
+
* `switch` attribute). */
|
|
86
94
|
private updateValidity;
|
|
87
95
|
get checked(): boolean;
|
|
88
96
|
set checked(value: boolean);
|
package/lib/components/switch.js
CHANGED
|
@@ -3,6 +3,7 @@ import { TyComponent } from "../base/ty-component.js";
|
|
|
3
3
|
import { ensureStyles } from "../utils/styles.js";
|
|
4
4
|
import { syncCustomFlavorSheet } from "../utils/flavor-sheet.js";
|
|
5
5
|
import { switchStyles, switchCustomFlavorCss } from "../styles/switch.js";
|
|
6
|
+
import { nativeMessage } from "../utils/validity.js";
|
|
6
7
|
export class TySwitch extends TyComponent {
|
|
7
8
|
constructor() {
|
|
8
9
|
super();
|
|
@@ -18,6 +19,9 @@ ensureStyles(shadow, { css: switchStyles, id: "ty-switch" });
|
|
|
18
19
|
onConnect() {
|
|
19
20
|
this.setupEventListeners();
|
|
20
21
|
this._syncCustomFlavor();
|
|
22
|
+
const el = this.shadowRoot.querySelector(".switch-container");
|
|
23
|
+
if (el && this.shadowRoot.activeElement !== el)
|
|
24
|
+
el.classList.remove("focused");
|
|
21
25
|
}
|
|
22
26
|
onDisconnect() {
|
|
23
27
|
this.removeEventListeners();
|
|
@@ -44,8 +48,7 @@ return classes.join(" ");
|
|
|
44
48
|
handleSwitchClick(e) {
|
|
45
49
|
if (this.disabled)
|
|
46
50
|
return;
|
|
47
|
-
|
|
48
|
-
return;
|
|
51
|
+
this.showFocusRing(e instanceof KeyboardEvent);
|
|
49
52
|
const newValue = !this.checked;
|
|
50
53
|
this.checked = newValue;
|
|
51
54
|
setTimeout(() => {
|
|
@@ -59,6 +62,9 @@ this.dispatchEvent(new CustomEvent("input", { detail: eventDetail, bubbles: true
|
|
|
59
62
|
this.dispatchEvent(new CustomEvent("change", { detail: eventDetail, bubbles: true, composed: true }));
|
|
60
63
|
}, 0);
|
|
61
64
|
}
|
|
65
|
+
showFocusRing(on) {
|
|
66
|
+
this.shadowRoot?.querySelector(".switch-container")?.classList.toggle("focused", on);
|
|
67
|
+
}
|
|
62
68
|
handleSwitchKeydown(e) {
|
|
63
69
|
if (this.disabled)
|
|
64
70
|
return;
|
|
@@ -106,7 +112,7 @@ if (!el)
|
|
|
106
112
|
return;
|
|
107
113
|
this._clickHandler = (e) => this.handleSwitchClick(e);
|
|
108
114
|
this._keydownHandler = (e) => this.handleSwitchKeydown(e);
|
|
109
|
-
this._focusHandler = () => el.classList.
|
|
115
|
+
this._focusHandler = () => el.classList.toggle("focused", el.matches(":focus-visible"));
|
|
110
116
|
this._blurHandler = () => el.classList.remove("focused");
|
|
111
117
|
this.addEventListener("click", this._clickHandler);
|
|
112
118
|
el.addEventListener("keydown", this._keydownHandler);
|
|
@@ -121,7 +127,8 @@ const classes = this.buildClassList();
|
|
|
121
127
|
if (!switchEl) {
|
|
122
128
|
switchEl = document.createElement("div");
|
|
123
129
|
switchEl.className = "switch-container " + classes;
|
|
124
|
-
|
|
130
|
+
if (!this.disabled)
|
|
131
|
+
switchEl.tabIndex = 0;
|
|
125
132
|
switchEl.setAttribute("role", "switch");
|
|
126
133
|
switchEl.setAttribute("aria-checked", this.checked ? "true" : "false");
|
|
127
134
|
switchEl.setAttribute("aria-disabled", this.disabled ? "true" : "false");
|
|
@@ -135,8 +142,13 @@ switchEl.appendChild(track);
|
|
|
135
142
|
shadow.appendChild(switchEl);
|
|
136
143
|
}
|
|
137
144
|
else {
|
|
145
|
+
const focused = switchEl.classList.contains("focused") && shadow.activeElement === switchEl;
|
|
138
146
|
switchEl.className = "switch-container " + classes;
|
|
139
|
-
switchEl.
|
|
147
|
+
switchEl.classList.toggle("focused", focused && !this.disabled);
|
|
148
|
+
if (this.disabled)
|
|
149
|
+
switchEl.removeAttribute("tabindex");
|
|
150
|
+
else
|
|
151
|
+
switchEl.tabIndex = 0;
|
|
140
152
|
switchEl.setAttribute("aria-checked", this.checked ? "true" : "false");
|
|
141
153
|
switchEl.setAttribute("aria-disabled", this.disabled ? "true" : "false");
|
|
142
154
|
switchEl.setAttribute("aria-required", this.required ? "true" : "false");
|
|
@@ -145,6 +157,13 @@ this.setupEventListeners();
|
|
|
145
157
|
this.applyLabelName(switchEl);
|
|
146
158
|
this.updateValidity();
|
|
147
159
|
}
|
|
160
|
+
focus(options) {
|
|
161
|
+
const el = this.shadowRoot?.querySelector(".switch-container");
|
|
162
|
+
if (el)
|
|
163
|
+
el.focus(options);
|
|
164
|
+
else
|
|
165
|
+
super.focus(options);
|
|
166
|
+
}
|
|
148
167
|
updateValidity() {
|
|
149
168
|
const anchor = this.shadowRoot?.querySelector(".switch-container");
|
|
150
169
|
if (this.disabled) {
|
|
@@ -152,7 +171,7 @@ this.applyValidity({});
|
|
|
152
171
|
return;
|
|
153
172
|
}
|
|
154
173
|
if (this.required && !this.checked) {
|
|
155
|
-
this.applyValidity({ valueMissing: true }, "
|
|
174
|
+
this.applyValidity({ valueMissing: true }, nativeMessage("input", { type: "checkbox", switch: true, required: true }), anchor ?? undefined);
|
|
156
175
|
}
|
|
157
176
|
else {
|
|
158
177
|
this.applyValidity({});
|
|
@@ -175,6 +194,8 @@ set flavor(value) { this.setProperty("flavor", value); }
|
|
|
175
194
|
get form() { return this._internals.form; }
|
|
176
195
|
}
|
|
177
196
|
TySwitch.formAssociated = true;
|
|
197
|
+
TySwitch.delegatesFocus = true;
|
|
198
|
+
TySwitch.labelClicks = true;
|
|
178
199
|
TySwitch.properties = {
|
|
179
200
|
checked: {
|
|
180
201
|
type: "boolean",
|
package/lib/components/tabs.js
CHANGED
|
@@ -251,7 +251,7 @@ marker.style.top = `${position.top}px`;
|
|
|
251
251
|
marker.style.width = `${position.width}px`;
|
|
252
252
|
marker.style.height = `${position.height}px`;
|
|
253
253
|
if (snap) {
|
|
254
|
-
marker.
|
|
254
|
+
marker.getBoundingClientRect();
|
|
255
255
|
marker.style.transition = '';
|
|
256
256
|
}
|
|
257
257
|
}
|
package/lib/components/tag.d.ts
CHANGED
|
@@ -8,7 +8,6 @@ interface TagState {
|
|
|
8
8
|
flavor: Flavor;
|
|
9
9
|
size: Size;
|
|
10
10
|
value: string;
|
|
11
|
-
selected: boolean;
|
|
12
11
|
noPill: boolean;
|
|
13
12
|
clickable: boolean;
|
|
14
13
|
dismissible: boolean;
|
|
@@ -22,7 +21,6 @@ interface TagState {
|
|
|
22
21
|
* <ty-tag flavor="primary">Primary Tag</ty-tag>
|
|
23
22
|
* <ty-tag flavor="success" dismissible>Success Tag</ty-tag>
|
|
24
23
|
* <ty-tag flavor="danger" clickable>Clickable Tag</ty-tag>
|
|
25
|
-
* <ty-tag value="tag-1" selected>Selected Tag</ty-tag>
|
|
26
24
|
* ```
|
|
27
25
|
*/
|
|
28
26
|
export declare class TyTag extends TyComponent<TagState> implements TyTagElement {
|
|
@@ -45,11 +43,6 @@ export declare class TyTag extends TyComponent<TagState> implements TyTagElement
|
|
|
45
43
|
visual: boolean;
|
|
46
44
|
default: string;
|
|
47
45
|
};
|
|
48
|
-
selected: {
|
|
49
|
-
type: "boolean";
|
|
50
|
-
visual: boolean;
|
|
51
|
-
default: boolean;
|
|
52
|
-
};
|
|
53
46
|
noPill: {
|
|
54
47
|
type: "boolean";
|
|
55
48
|
visual: boolean;
|
|
@@ -101,8 +94,6 @@ export declare class TyTag extends TyComponent<TagState> implements TyTagElement
|
|
|
101
94
|
set size(value: Size);
|
|
102
95
|
get value(): string;
|
|
103
96
|
set value(val: string);
|
|
104
|
-
get selected(): boolean;
|
|
105
|
-
set selected(value: boolean);
|
|
106
97
|
get noPill(): boolean;
|
|
107
98
|
set noPill(value: boolean);
|
|
108
99
|
get clickable(): boolean;
|
package/lib/components/tag.js
CHANGED
|
@@ -165,12 +165,6 @@ return this.getProperty("value");
|
|
|
165
165
|
set value(val) {
|
|
166
166
|
this.setProperty("value", val);
|
|
167
167
|
}
|
|
168
|
-
get selected() {
|
|
169
|
-
return this.getProperty("selected");
|
|
170
|
-
}
|
|
171
|
-
set selected(value) {
|
|
172
|
-
this.setProperty("selected", value);
|
|
173
|
-
}
|
|
174
168
|
get noPill() {
|
|
175
169
|
return this.getProperty("noPill");
|
|
176
170
|
}
|
|
@@ -221,11 +215,6 @@ type: "string",
|
|
|
221
215
|
visual: true,
|
|
222
216
|
default: "",
|
|
223
217
|
},
|
|
224
|
-
selected: {
|
|
225
|
-
type: "boolean",
|
|
226
|
-
visual: true,
|
|
227
|
-
default: false,
|
|
228
|
-
},
|
|
229
218
|
noPill: {
|
|
230
219
|
type: "boolean",
|
|
231
220
|
visual: true,
|
|
@@ -21,6 +21,10 @@ export interface TyTextareaElement extends HTMLElement {
|
|
|
21
21
|
label?: string;
|
|
22
22
|
disabled?: boolean;
|
|
23
23
|
required?: boolean;
|
|
24
|
+
minLength?: number;
|
|
25
|
+
maxLength?: number;
|
|
26
|
+
tooShortMessage?: string;
|
|
27
|
+
tooLongMessage?: string;
|
|
24
28
|
error?: string;
|
|
25
29
|
size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
26
30
|
rows?: string | number;
|
|
@@ -63,6 +67,26 @@ export declare class TyTextarea extends TyComponent<TextareaState> implements Ty
|
|
|
63
67
|
visual: boolean;
|
|
64
68
|
default: boolean;
|
|
65
69
|
};
|
|
70
|
+
minlength: {
|
|
71
|
+
type: "string";
|
|
72
|
+
visual: boolean;
|
|
73
|
+
default: string;
|
|
74
|
+
};
|
|
75
|
+
maxlength: {
|
|
76
|
+
type: "string";
|
|
77
|
+
visual: boolean;
|
|
78
|
+
default: string;
|
|
79
|
+
};
|
|
80
|
+
tooShortMessage: {
|
|
81
|
+
type: "string";
|
|
82
|
+
visual: boolean;
|
|
83
|
+
default: string;
|
|
84
|
+
};
|
|
85
|
+
tooLongMessage: {
|
|
86
|
+
type: "string";
|
|
87
|
+
visual: boolean;
|
|
88
|
+
default: string;
|
|
89
|
+
};
|
|
66
90
|
error: {
|
|
67
91
|
type: "string";
|
|
68
92
|
visual: boolean;
|
|
@@ -125,8 +149,18 @@ export declare class TyTextarea extends TyComponent<TextareaState> implements Ty
|
|
|
125
149
|
set label(v: string);
|
|
126
150
|
get disabled(): boolean;
|
|
127
151
|
set disabled(v: boolean);
|
|
152
|
+
/** Focus the inner <textarea>: the host itself isn't focusable. */
|
|
153
|
+
focus(options?: FocusOptions): void;
|
|
128
154
|
get required(): boolean;
|
|
129
155
|
set required(v: boolean);
|
|
156
|
+
get minLength(): number;
|
|
157
|
+
set minLength(v: number);
|
|
158
|
+
get maxLength(): number;
|
|
159
|
+
set maxLength(v: number);
|
|
160
|
+
get tooShortMessage(): string;
|
|
161
|
+
set tooShortMessage(v: string);
|
|
162
|
+
get tooLongMessage(): string;
|
|
163
|
+
set tooLongMessage(v: string);
|
|
130
164
|
get error(): string;
|
|
131
165
|
set error(v: string);
|
|
132
166
|
get size(): 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
@@ -157,9 +191,20 @@ export declare class TyTextarea extends TyComponent<TextareaState> implements Ty
|
|
|
157
191
|
private buildClassList;
|
|
158
192
|
private applyHeightConstraints;
|
|
159
193
|
private setupTextareaEvents;
|
|
194
|
+
private removeTextareaEvents;
|
|
160
195
|
protected render(): void;
|
|
161
|
-
/**
|
|
162
|
-
*
|
|
196
|
+
/**
|
|
197
|
+
* minlength goes on the inner <textarea> for the browser's own too-short
|
|
198
|
+
* message after the user types, maxlength so typing stops at the limit
|
|
199
|
+
* (like ty-input).
|
|
200
|
+
*/
|
|
201
|
+
private syncConstraintAttributes;
|
|
202
|
+
/**
|
|
203
|
+
* required + empty => valueMissing (the browser's own message); otherwise
|
|
204
|
+
* minlength / maxlength, worded like ty-input's (lengthValidity). Empty
|
|
205
|
+
* values only fail `required`, like native. Disabled fields are barred
|
|
206
|
+
* from constraint validation.
|
|
207
|
+
*/
|
|
163
208
|
private updateValidity;
|
|
164
209
|
}
|
|
165
210
|
export {};
|
|
@@ -4,7 +4,8 @@ import { ensureStyles } from '../utils/styles.js';
|
|
|
4
4
|
import { textareaStyles } from '../styles/textarea.js';
|
|
5
5
|
import { CustomScrollbar, isCustomScrollbarEnabled } from '../utils/custom-scrollbar.js';
|
|
6
6
|
import { customScrollbarStyles } from '../styles/custom-scrollbar.js';
|
|
7
|
-
|
|
7
|
+
import { nativeMessage, lengthValidity, toLimit } from '../utils/validity.js';
|
|
8
|
+
import { REQUIRED_ICON_SVG } from '../utils/icons.js';
|
|
8
9
|
export class TyTextarea extends TyComponent {
|
|
9
10
|
constructor() {
|
|
10
11
|
super();
|
|
@@ -13,6 +14,9 @@ this._dummyEl = null;
|
|
|
13
14
|
this._scrollbar = null;
|
|
14
15
|
this._isFocused = false;
|
|
15
16
|
this.handleInputEvent = (e) => {
|
|
17
|
+
this._userEdited = true;
|
|
18
|
+
e.stopPropagation();
|
|
19
|
+
e.stopImmediatePropagation();
|
|
16
20
|
const target = e.target;
|
|
17
21
|
const newValue = target.value;
|
|
18
22
|
this.value = newValue;
|
|
@@ -30,6 +34,8 @@ this._valueAtFocus = this.value;
|
|
|
30
34
|
};
|
|
31
35
|
this.handleBlurEvent = (e) => {
|
|
32
36
|
this._isFocused = false;
|
|
37
|
+
if (this._userEdited)
|
|
38
|
+
this.revealValidity();
|
|
33
39
|
if (this._valueAtFocus !== null && this.value !== this._valueAtFocus) {
|
|
34
40
|
this.emitValueEvent('change', e);
|
|
35
41
|
}
|
|
@@ -42,20 +48,22 @@ ensureStyles(shadow, { css: customScrollbarStyles, id: 'ty-custom-scrollbar' });
|
|
|
42
48
|
}
|
|
43
49
|
}
|
|
44
50
|
onConnect() {
|
|
51
|
+
this.updateFormValue();
|
|
52
|
+
if (this._rendered) {
|
|
53
|
+
this.render();
|
|
54
|
+
if (this._textareaEl)
|
|
55
|
+
this.setupTextareaEvents(this._textareaEl);
|
|
56
|
+
}
|
|
45
57
|
}
|
|
46
58
|
onDisconnect() {
|
|
47
59
|
this._destroyScrollbar();
|
|
48
|
-
if (this._textareaEl)
|
|
49
|
-
|
|
50
|
-
this._textareaEl.parentNode?.replaceChild(newTextarea, this._textareaEl);
|
|
51
|
-
this._textareaEl = null;
|
|
52
|
-
}
|
|
53
|
-
this._dummyEl = null;
|
|
60
|
+
if (this._textareaEl)
|
|
61
|
+
this.removeTextareaEvents(this._textareaEl);
|
|
54
62
|
}
|
|
55
63
|
onPropertiesChanged(changes) {
|
|
56
64
|
}
|
|
57
65
|
getFormValue() {
|
|
58
|
-
return this.getProperty('value') ||
|
|
66
|
+
return this.getProperty('value') || '';
|
|
59
67
|
}
|
|
60
68
|
get value() { return this.getProperty('value'); }
|
|
61
69
|
set value(v) { this.setProperty('value', v); }
|
|
@@ -67,8 +75,19 @@ get label() { return this.getProperty('label'); }
|
|
|
67
75
|
set label(v) { this.setProperty('label', v); }
|
|
68
76
|
get disabled() { return this.getProperty('disabled'); }
|
|
69
77
|
set disabled(v) { this.setProperty('disabled', v); }
|
|
78
|
+
focus(options) {
|
|
79
|
+
this.shadowRoot?.querySelector('textarea')?.focus(options);
|
|
80
|
+
}
|
|
70
81
|
get required() { return this.getProperty('required'); }
|
|
71
82
|
set required(v) { this.setProperty('required', v); }
|
|
83
|
+
get minLength() { return toLimit(this.getProperty('minlength')) ?? -1; }
|
|
84
|
+
set minLength(v) { this.setProperty('minlength', v == null || v < 0 ? '' : String(v)); }
|
|
85
|
+
get maxLength() { return toLimit(this.getProperty('maxlength')) ?? -1; }
|
|
86
|
+
set maxLength(v) { this.setProperty('maxlength', v == null || v < 0 ? '' : String(v)); }
|
|
87
|
+
get tooShortMessage() { return this.getProperty('tooShortMessage'); }
|
|
88
|
+
set tooShortMessage(v) { this.setProperty('tooShortMessage', v ?? ''); }
|
|
89
|
+
get tooLongMessage() { return this.getProperty('tooLongMessage'); }
|
|
90
|
+
set tooLongMessage(v) { this.setProperty('tooLongMessage', v ?? ''); }
|
|
72
91
|
get error() { return this.getProperty('error'); }
|
|
73
92
|
set error(v) { this.setProperty('error', v); }
|
|
74
93
|
get size() {
|
|
@@ -175,6 +194,10 @@ textareaEl.style.overflowY = 'hidden';
|
|
|
175
194
|
this._destroyScrollbar();
|
|
176
195
|
}
|
|
177
196
|
}
|
|
197
|
+
else if (maxHeight !== null && measuredHeight >= maxHeight && !this._scrollbar) {
|
|
198
|
+
textareaEl.style.overflowY = 'auto';
|
|
199
|
+
this._setupScrollbar(textareaEl);
|
|
200
|
+
}
|
|
178
201
|
this._scrollbar?.update();
|
|
179
202
|
}
|
|
180
203
|
_setupScrollbar(textareaEl) {
|
|
@@ -211,7 +234,7 @@ value: this.value,
|
|
|
211
234
|
originalEvent
|
|
212
235
|
}
|
|
213
236
|
};
|
|
214
|
-
|
|
237
|
+
this.dispatchEvent(new CustomEvent(type, data));
|
|
215
238
|
}
|
|
216
239
|
buildClassList() {
|
|
217
240
|
const classes = [this.size];
|
|
@@ -241,6 +264,11 @@ textareaEl.addEventListener('input', this.handleInputEvent);
|
|
|
241
264
|
textareaEl.addEventListener('focus', this.handleFocusEvent);
|
|
242
265
|
textareaEl.addEventListener('blur', this.handleBlurEvent);
|
|
243
266
|
}
|
|
267
|
+
removeTextareaEvents(textareaEl) {
|
|
268
|
+
textareaEl.removeEventListener('input', this.handleInputEvent);
|
|
269
|
+
textareaEl.removeEventListener('focus', this.handleFocusEvent);
|
|
270
|
+
textareaEl.removeEventListener('blur', this.handleBlurEvent);
|
|
271
|
+
}
|
|
244
272
|
render() {
|
|
245
273
|
const root = this.shadowRoot;
|
|
246
274
|
const existingContainer = root.querySelector('.textarea-container');
|
|
@@ -250,18 +278,19 @@ const existingError = root.querySelector('.error-message');
|
|
|
250
278
|
if (existingContainer && existingTextarea) {
|
|
251
279
|
if (this.label) {
|
|
252
280
|
if (existingLabel) {
|
|
253
|
-
existingLabel.innerHTML = this.label
|
|
254
|
-
|
|
255
|
-
existingLabel.style.display = 'block';
|
|
281
|
+
existingLabel.innerHTML = `${this.label}${this.required ? `<span class="required-icon">${REQUIRED_ICON_SVG}</span>` : ''}`;
|
|
282
|
+
existingLabel.style.display = 'flex';
|
|
256
283
|
}
|
|
257
284
|
}
|
|
258
285
|
else if (existingLabel) {
|
|
259
286
|
existingLabel.style.display = 'none';
|
|
260
287
|
}
|
|
288
|
+
if (existingTextarea.value !== (this.value || ''))
|
|
261
289
|
existingTextarea.value = this.value || '';
|
|
262
290
|
existingTextarea.placeholder = this.placeholder || '';
|
|
263
291
|
existingTextarea.disabled = this.disabled;
|
|
264
292
|
existingTextarea.required = this.required;
|
|
293
|
+
this.syncConstraintAttributes(existingTextarea);
|
|
265
294
|
existingTextarea.className = this.buildClassList();
|
|
266
295
|
if (this.label)
|
|
267
296
|
existingTextarea.setAttribute('aria-label', this.label);
|
|
@@ -301,9 +330,8 @@ container.className = 'textarea-container';
|
|
|
301
330
|
const labelEl = document.createElement('label');
|
|
302
331
|
labelEl.className = 'ty-field-label';
|
|
303
332
|
if (this.label) {
|
|
304
|
-
labelEl.innerHTML = this.label
|
|
305
|
-
|
|
306
|
-
labelEl.style.display = 'block';
|
|
333
|
+
labelEl.innerHTML = `${this.label}${this.required ? `<span class="required-icon">${REQUIRED_ICON_SVG}</span>` : ''}`;
|
|
334
|
+
labelEl.style.display = 'flex';
|
|
307
335
|
}
|
|
308
336
|
else {
|
|
309
337
|
labelEl.style.display = 'none';
|
|
@@ -313,6 +341,7 @@ textareaEl.value = this.value || '';
|
|
|
313
341
|
textareaEl.placeholder = this.placeholder || '';
|
|
314
342
|
textareaEl.disabled = this.disabled;
|
|
315
343
|
textareaEl.required = this.required;
|
|
344
|
+
this.syncConstraintAttributes(textareaEl);
|
|
316
345
|
textareaEl.className = this.buildClassList();
|
|
317
346
|
if (this.label)
|
|
318
347
|
textareaEl.setAttribute('aria-label', this.label);
|
|
@@ -364,6 +393,11 @@ this._textareaEl = textareaEl;
|
|
|
364
393
|
}
|
|
365
394
|
this.updateValidity();
|
|
366
395
|
}
|
|
396
|
+
syncConstraintAttributes(ta) {
|
|
397
|
+
const set = (name, limit) => limit !== null ? ta.setAttribute(name, String(limit)) : ta.removeAttribute(name);
|
|
398
|
+
set('minlength', toLimit(this.getProperty('minlength')));
|
|
399
|
+
set('maxlength', toLimit(this.getProperty('maxlength')));
|
|
400
|
+
}
|
|
367
401
|
updateValidity() {
|
|
368
402
|
const ta = this.shadowRoot?.querySelector('textarea');
|
|
369
403
|
if (this.disabled) {
|
|
@@ -371,12 +405,22 @@ this.applyValidity({});
|
|
|
371
405
|
return;
|
|
372
406
|
}
|
|
373
407
|
const current = ta ? ta.value : String(this.value ?? '');
|
|
374
|
-
if (
|
|
375
|
-
this.
|
|
408
|
+
if (current.trim() === '') {
|
|
409
|
+
if (this.required) {
|
|
410
|
+
this.applyValidity({ valueMissing: true }, nativeMessage('textarea', { required: true }), ta ?? undefined);
|
|
376
411
|
}
|
|
377
412
|
else {
|
|
378
413
|
this.applyValidity({});
|
|
379
414
|
}
|
|
415
|
+
return;
|
|
416
|
+
}
|
|
417
|
+
const { tooShort, tooLong } = lengthValidity(current, {
|
|
418
|
+
minlength: this.getProperty('minlength'),
|
|
419
|
+
maxlength: this.getProperty('maxlength'),
|
|
420
|
+
tooShortMessage: this.tooShortMessage,
|
|
421
|
+
tooLongMessage: this.tooLongMessage,
|
|
422
|
+
}, ta);
|
|
423
|
+
this.applyValidity({ tooShort: !!tooShort, tooLong: !!tooLong }, tooShort ?? tooLong, ta ?? undefined);
|
|
380
424
|
}
|
|
381
425
|
}
|
|
382
426
|
TyTextarea.formAssociated = true;
|
|
@@ -412,6 +456,26 @@ type: 'boolean',
|
|
|
412
456
|
visual: true,
|
|
413
457
|
default: false
|
|
414
458
|
},
|
|
459
|
+
minlength: {
|
|
460
|
+
type: 'string',
|
|
461
|
+
visual: true,
|
|
462
|
+
default: ''
|
|
463
|
+
},
|
|
464
|
+
maxlength: {
|
|
465
|
+
type: 'string',
|
|
466
|
+
visual: true,
|
|
467
|
+
default: ''
|
|
468
|
+
},
|
|
469
|
+
tooShortMessage: {
|
|
470
|
+
type: 'string',
|
|
471
|
+
visual: true,
|
|
472
|
+
default: ''
|
|
473
|
+
},
|
|
474
|
+
tooLongMessage: {
|
|
475
|
+
type: 'string',
|
|
476
|
+
visual: true,
|
|
477
|
+
default: ''
|
|
478
|
+
},
|
|
415
479
|
error: {
|
|
416
480
|
type: 'string',
|
|
417
481
|
visual: true,
|
package/lib/index.d.ts
CHANGED
|
@@ -75,6 +75,7 @@ declare global {
|
|
|
75
75
|
tyResizeObserver: {
|
|
76
76
|
getSize: (id: string) => ResizeSize | undefined;
|
|
77
77
|
onResize: (id: string, callback: ResizeCallback) => () => void;
|
|
78
|
+
getAllSizes: () => Record<string, ResizeSize>;
|
|
78
79
|
sizes: Record<string, ResizeSize>;
|
|
79
80
|
};
|
|
80
81
|
tyLoader: {
|
package/lib/index.js
CHANGED