tyrell-components 1.0.0-RC15 → 1.0.0-RC17
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 +44 -52
- package/css/tyrell-colors-static.css +14 -0
- package/css/tyrell-theme.css +13 -7
- package/css/tyrell.css +15 -22
- package/dist/tyrell-colors-static.css +1 -1
- package/dist/tyrell-theme.css +1 -1
- package/dist/tyrell.css +1 -1
- package/dist/tyrell.js +1 -1
- package/lib/base/ty-component.d.ts +37 -15
- package/lib/base/ty-component.js +90 -26
- package/lib/components/button.d.ts +14 -0
- package/lib/components/button.js +61 -7
- package/lib/components/calendar-month.d.ts +7 -1
- package/lib/components/calendar-month.js +38 -30
- package/lib/components/calendar-navigation.d.ts +11 -0
- package/lib/components/calendar-navigation.js +68 -44
- package/lib/components/calendar.d.ts +52 -3
- package/lib/components/calendar.js +274 -61
- package/lib/components/checkbox.d.ts +8 -1
- package/lib/components/checkbox.js +29 -8
- package/lib/components/copy.d.ts +2 -0
- package/lib/components/copy.js +24 -33
- package/lib/components/date-picker.d.ts +68 -34
- package/lib/components/date-picker.js +386 -389
- package/lib/components/file-upload.d.ts +7 -0
- package/lib/components/file-upload.js +36 -4
- package/lib/components/input.d.ts +73 -3
- package/lib/components/input.js +159 -24
- package/lib/components/modal.d.ts +4 -8
- package/lib/components/modal.js +103 -33
- package/lib/components/option.js +7 -5
- package/lib/components/popup.js +117 -14
- package/lib/components/radio.d.ts +24 -0
- package/lib/components/radio.js +55 -32
- package/lib/components/resize-observer.js +2 -0
- package/lib/components/scroll-container.d.ts +3 -2
- package/lib/components/scroll-container.js +7 -8
- package/lib/components/select.d.ts +68 -11
- package/lib/components/select.js +196 -44
- package/lib/components/selected-tags.d.ts +7 -1
- package/lib/components/selected-tags.js +10 -1
- package/lib/components/switch.d.ts +9 -1
- package/lib/components/switch.js +29 -8
- package/lib/components/tab.d.ts +49 -1
- package/lib/components/tab.js +151 -10
- package/lib/components/tabs.d.ts +14 -2
- package/lib/components/tabs.js +185 -136
- package/lib/components/tag.d.ts +4 -7
- package/lib/components/tag.js +6 -7
- package/lib/components/textarea.d.ts +51 -5
- package/lib/components/textarea.js +95 -30
- package/lib/components/tooltip.d.ts +4 -3
- package/lib/components/tooltip.js +34 -24
- package/lib/components/wizard.d.ts +5 -4
- package/lib/components/wizard.js +120 -156
- package/lib/index.d.ts +2 -1
- package/lib/index.js +1 -0
- package/lib/styles/button.js +21 -19
- package/lib/styles/calendar-month.d.ts +3 -0
- package/lib/styles/calendar-month.js +43 -27
- package/lib/styles/calendar-navigation.d.ts +1 -1
- package/lib/styles/calendar-navigation.js +55 -26
- package/lib/styles/calendar.d.ts +3 -2
- package/lib/styles/calendar.js +77 -0
- package/lib/styles/checkbox.js +31 -13
- package/lib/styles/copy.js +5 -1
- package/lib/styles/date-picker.js +68 -26
- 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 +7 -3
- package/lib/styles/popup.d.ts +1 -1
- package/lib/styles/popup.js +10 -5
- package/lib/styles/radio.js +18 -6
- package/lib/styles/scroll-container.d.ts +1 -1
- package/lib/styles/scroll-container.js +1 -1
- package/lib/styles/select-base.js +24 -3
- package/lib/styles/select.d.ts +1 -1
- package/lib/styles/select.js +10 -0
- package/lib/styles/step.d.ts +1 -1
- package/lib/styles/step.js +1 -9
- package/lib/styles/switch.js +14 -6
- package/lib/styles/tab.d.ts +1 -1
- package/lib/styles/tab.js +67 -3
- package/lib/styles/tabs.d.ts +1 -1
- package/lib/styles/tabs.js +7 -3
- package/lib/styles/tag.js +3 -3
- package/lib/styles/textarea.d.ts +1 -1
- package/lib/styles/textarea.js +7 -0
- package/lib/styles/wizard.d.ts +9 -5
- package/lib/styles/wizard.js +211 -99
- package/lib/types/common.d.ts +2 -2
- package/lib/utils/calendar-utils.d.ts +49 -0
- package/lib/utils/calendar-utils.js +63 -6
- package/lib/utils/property-manager.d.ts +7 -1
- package/lib/utils/property-manager.js +16 -4
- 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 +122 -0
- package/lib/utils/validity.js +289 -0
- package/lib/version.d.ts +1 -1
- package/lib/version.js +1 -1
- package/package.json +27 -5
package/lib/components/radio.js
CHANGED
|
@@ -4,6 +4,7 @@ import { ensureStyles } from "../utils/styles.js";
|
|
|
4
4
|
import { syncCustomFlavorSheet } from "../utils/flavor-sheet.js";
|
|
5
5
|
import { radioStyles, radioCustomFlavorCss } from "../styles/radio.js";
|
|
6
6
|
import { REQUIRED_ICON_SVG } from "../utils/icons.js";
|
|
7
|
+
import { nativeMessage } from "../utils/validity.js";
|
|
7
8
|
export class TyRadio extends TyComponent {
|
|
8
9
|
constructor() {
|
|
9
10
|
super();
|
|
@@ -12,9 +13,23 @@ this._listenersSetup = false;
|
|
|
12
13
|
this._clickHandler = null;
|
|
13
14
|
this._focusHandler = null;
|
|
14
15
|
this._blurHandler = null;
|
|
16
|
+
this._tabStop = true;
|
|
15
17
|
const shadow = this.shadowRoot;
|
|
16
18
|
ensureStyles(shadow, { css: radioStyles, id: "ty-radio" });
|
|
17
19
|
}
|
|
20
|
+
setTabStop(on) {
|
|
21
|
+
this._tabStop = on;
|
|
22
|
+
const el = this.shadowRoot?.querySelector(".radio-container");
|
|
23
|
+
if (el)
|
|
24
|
+
el.tabIndex = this.disabled || !on ? -1 : 0;
|
|
25
|
+
}
|
|
26
|
+
focus(options) {
|
|
27
|
+
const el = this.shadowRoot?.querySelector(".radio-container");
|
|
28
|
+
if (el)
|
|
29
|
+
el.focus(options);
|
|
30
|
+
else
|
|
31
|
+
super.focus(options);
|
|
32
|
+
}
|
|
18
33
|
onConnect() {
|
|
19
34
|
this.setupEventListeners();
|
|
20
35
|
this.dispatchEvent(new CustomEvent("ty-radio-connected", { bubbles: true }));
|
|
@@ -90,7 +105,7 @@ const classes = this.buildClassList();
|
|
|
90
105
|
if (!radioEl) {
|
|
91
106
|
radioEl = document.createElement("div");
|
|
92
107
|
radioEl.className = "radio-container " + classes;
|
|
93
|
-
radioEl.tabIndex = this.disabled ? -1 : 0;
|
|
108
|
+
radioEl.tabIndex = this.disabled || !this._tabStop ? -1 : 0;
|
|
94
109
|
radioEl.setAttribute("role", "radio");
|
|
95
110
|
radioEl.setAttribute("aria-checked", String(this.checked));
|
|
96
111
|
radioEl.setAttribute("aria-disabled", String(this.disabled));
|
|
@@ -101,7 +116,7 @@ shadow.appendChild(radioEl);
|
|
|
101
116
|
}
|
|
102
117
|
else {
|
|
103
118
|
radioEl.className = "radio-container " + classes;
|
|
104
|
-
radioEl.tabIndex = this.disabled ? -1 : 0;
|
|
119
|
+
radioEl.tabIndex = this.disabled || !this._tabStop ? -1 : 0;
|
|
105
120
|
radioEl.setAttribute("aria-checked", String(this.checked));
|
|
106
121
|
radioEl.setAttribute("aria-disabled", String(this.disabled));
|
|
107
122
|
}
|
|
@@ -119,6 +134,7 @@ set size(v) { this.setProperty("size", v); }
|
|
|
119
134
|
get flavor() { return this.getProperty("flavor"); }
|
|
120
135
|
set flavor(v) { this.setProperty("flavor", v); }
|
|
121
136
|
}
|
|
137
|
+
TyRadio.labelClicks = true;
|
|
122
138
|
TyRadio.properties = {
|
|
123
139
|
value: { type: "string", default: "" },
|
|
124
140
|
checked: {
|
|
@@ -163,15 +179,24 @@ onDisconnect() {
|
|
|
163
179
|
this.removeEventListeners();
|
|
164
180
|
}
|
|
165
181
|
onPropertiesChanged(changes) {
|
|
166
|
-
if (changes.some((c) => c.name === "value" || c.name === "size" || c.name === "flavor" || c.name === "disabled")) {
|
|
182
|
+
if (changes.some((c) => c.name === "value" || c.name === "size" || c.name === "flavor" || c.name === "disabled" || c.name === "required")) {
|
|
167
183
|
this.syncChildren();
|
|
168
184
|
}
|
|
169
185
|
}
|
|
170
186
|
getFormValue() {
|
|
171
187
|
return this.value || null;
|
|
172
188
|
}
|
|
189
|
+
focus(options) {
|
|
190
|
+
const enabled = this.getRadios().filter((r) => !r.disabled);
|
|
191
|
+
const stop = enabled.find((r) => r.checked) ?? enabled[0];
|
|
192
|
+
if (stop)
|
|
193
|
+
stop.focus(options);
|
|
194
|
+
else
|
|
195
|
+
super.focus(options);
|
|
196
|
+
}
|
|
173
197
|
getRadios() {
|
|
174
|
-
return Array.from(this.querySelectorAll("ty-radio"))
|
|
198
|
+
return Array.from(this.querySelectorAll("ty-radio"))
|
|
199
|
+
.filter((r) => typeof r.setTabStop === "function");
|
|
175
200
|
}
|
|
176
201
|
syncChildren() {
|
|
177
202
|
const radios = this.getRadios();
|
|
@@ -190,6 +215,21 @@ delete radio.dataset.tyGroupDisabled;
|
|
|
190
215
|
radio.size = this.size;
|
|
191
216
|
radio.flavor = this.flavor;
|
|
192
217
|
}
|
|
218
|
+
const enabled = radios.filter((r) => !r.disabled);
|
|
219
|
+
const stop = enabled.find((r) => r.checked) ?? enabled[0];
|
|
220
|
+
for (const radio of radios)
|
|
221
|
+
radio.setTabStop(radio === stop);
|
|
222
|
+
this.updateValidity();
|
|
223
|
+
}
|
|
224
|
+
updateValidity() {
|
|
225
|
+
if (this.required && !this.disabled && !this.value) {
|
|
226
|
+
const anchor = this.getRadios().find((r) => !r.disabled);
|
|
227
|
+
const target = anchor?.shadowRoot?.querySelector(".radio-container");
|
|
228
|
+
this.applyValidity({ valueMissing: true }, nativeMessage("input", { type: "radio", name: "ty", required: true }), target ?? undefined);
|
|
229
|
+
}
|
|
230
|
+
else {
|
|
231
|
+
this.applyValidity({});
|
|
232
|
+
}
|
|
193
233
|
}
|
|
194
234
|
handleRadioSelect(e) {
|
|
195
235
|
if (this.disabled)
|
|
@@ -198,16 +238,17 @@ const detail = e.detail;
|
|
|
198
238
|
const newValue = detail?.value;
|
|
199
239
|
if (typeof newValue !== "string" || newValue === this.value)
|
|
200
240
|
return;
|
|
201
|
-
this.
|
|
241
|
+
this.select(newValue, e);
|
|
242
|
+
}
|
|
243
|
+
select(value, originalEvent) {
|
|
244
|
+
if (value === this.value)
|
|
245
|
+
return;
|
|
246
|
+
this.value = value;
|
|
202
247
|
this.syncChildren();
|
|
248
|
+
const detail = { value, formValue: value, originalEvent };
|
|
203
249
|
setTimeout(() => {
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
formValue: newValue,
|
|
207
|
-
originalEvent: e,
|
|
208
|
-
};
|
|
209
|
-
this.dispatchEvent(new CustomEvent("input", { detail: eventDetail, bubbles: true, composed: true }));
|
|
210
|
-
this.dispatchEvent(new CustomEvent("change", { detail: eventDetail, bubbles: true, composed: true }));
|
|
250
|
+
this.dispatchEvent(new CustomEvent("input", { detail, bubbles: true, composed: true }));
|
|
251
|
+
this.dispatchEvent(new CustomEvent("change", { detail, bubbles: true, composed: true }));
|
|
211
252
|
}, 0);
|
|
212
253
|
}
|
|
213
254
|
handleKeydown(e) {
|
|
@@ -232,16 +273,7 @@ nextIndex = current
|
|
|
232
273
|
else if (["Space", " ", "Enter"].includes(e.key)) {
|
|
233
274
|
if (current) {
|
|
234
275
|
e.preventDefault();
|
|
235
|
-
this.
|
|
236
|
-
this.syncChildren();
|
|
237
|
-
const eventDetail = {
|
|
238
|
-
value: current.value,
|
|
239
|
-
formValue: current.value,
|
|
240
|
-
originalEvent: e,
|
|
241
|
-
};
|
|
242
|
-
setTimeout(() => {
|
|
243
|
-
this.dispatchEvent(new CustomEvent("change", { detail: eventDetail, bubbles: true, composed: true }));
|
|
244
|
-
}, 0);
|
|
276
|
+
this.select(current.value, e);
|
|
245
277
|
}
|
|
246
278
|
return;
|
|
247
279
|
}
|
|
@@ -251,16 +283,7 @@ return;
|
|
|
251
283
|
const next = radios[nextIndex];
|
|
252
284
|
if (next) {
|
|
253
285
|
next.focus();
|
|
254
|
-
this.
|
|
255
|
-
this.syncChildren();
|
|
256
|
-
const eventDetail = {
|
|
257
|
-
value: next.value,
|
|
258
|
-
formValue: next.value,
|
|
259
|
-
originalEvent: e,
|
|
260
|
-
};
|
|
261
|
-
setTimeout(() => {
|
|
262
|
-
this.dispatchEvent(new CustomEvent("change", { detail: eventDetail, bubbles: true, composed: true }));
|
|
263
|
-
}, 0);
|
|
286
|
+
this.select(next.value, e);
|
|
264
287
|
}
|
|
265
288
|
}
|
|
266
289
|
removeEventListeners() {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { ensureStyles } from '../utils/styles.js';
|
|
2
2
|
import { resizeObserverStyles } from '../styles/resize-observer.js';
|
|
3
3
|
import { updateSize, removeSize } from '../utils/resize-observer.js';
|
|
4
|
+
import { upgradeProperties } from '../utils/upgrade-properties.js';
|
|
4
5
|
export class TyResizeObserver extends HTMLElement {
|
|
5
6
|
static get observedAttributes() {
|
|
6
7
|
return ['id', 'debounce'];
|
|
@@ -20,6 +21,7 @@ ensureStyles(shadow, { css: resizeObserverStyles, id: 'ty-resize-observer' });
|
|
|
20
21
|
shadow.innerHTML = '<slot></slot>';
|
|
21
22
|
}
|
|
22
23
|
connectedCallback() {
|
|
24
|
+
upgradeProperties(this);
|
|
23
25
|
this.setupObserver();
|
|
24
26
|
}
|
|
25
27
|
attributeChangedCallback(name, oldValue, newValue) {
|
|
@@ -15,8 +15,9 @@ export declare class TyScrollContainer extends HTMLElement {
|
|
|
15
15
|
private _nearStartFired;
|
|
16
16
|
private _nearEndFired;
|
|
17
17
|
static get observedAttributes(): string[];
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
/** Edge shadows are on by default; no-shadow turns them off. */
|
|
19
|
+
get noShadow(): boolean;
|
|
20
|
+
set noShadow(value: boolean);
|
|
20
21
|
get maxHeight(): string | null;
|
|
21
22
|
set maxHeight(value: string | null);
|
|
22
23
|
get hideScrollbar(): boolean;
|
|
@@ -1,18 +1,16 @@
|
|
|
1
1
|
import { ensureStyles } from '../utils/styles.js';
|
|
2
2
|
import { scrollContainerStyles } from '../styles/scroll-container.js';
|
|
3
3
|
import { CustomScrollbar } from '../utils/custom-scrollbar.js';
|
|
4
|
+
import { upgradeProperties } from '../utils/upgrade-properties.js';
|
|
4
5
|
export class TyScrollContainer extends HTMLElement {
|
|
5
6
|
static get observedAttributes() {
|
|
6
|
-
return ['shadow', 'max-height', 'hide-scrollbar', 'custom-scrollbar', 'overflow-x', 'scroll-anchoring'];
|
|
7
|
+
return ['no-shadow', 'max-height', 'hide-scrollbar', 'custom-scrollbar', 'overflow-x', 'scroll-anchoring'];
|
|
7
8
|
}
|
|
8
|
-
get
|
|
9
|
-
return this.
|
|
9
|
+
get noShadow() {
|
|
10
|
+
return this.hasAttribute('no-shadow');
|
|
10
11
|
}
|
|
11
|
-
set
|
|
12
|
-
|
|
13
|
-
this.removeAttribute('shadow');
|
|
14
|
-
else
|
|
15
|
-
this.setAttribute('shadow', 'false');
|
|
12
|
+
set noShadow(value) {
|
|
13
|
+
value ? this.setAttribute('no-shadow', '') : this.removeAttribute('no-shadow');
|
|
16
14
|
}
|
|
17
15
|
get maxHeight() {
|
|
18
16
|
return this.getAttribute('max-height');
|
|
@@ -115,6 +113,7 @@ this._shadowLeft = shadow.querySelector('.shadow-left');
|
|
|
115
113
|
this._shadowRight = shadow.querySelector('.shadow-right');
|
|
116
114
|
}
|
|
117
115
|
connectedCallback() {
|
|
116
|
+
upgradeProperties(this);
|
|
118
117
|
this._scrollWrapper?.addEventListener('scroll', this._onScroll, { passive: true });
|
|
119
118
|
this._resizeObserver = new ResizeObserver(() => {
|
|
120
119
|
this._scrollbar?.update();
|
|
@@ -73,13 +73,15 @@ export declare class TySelect extends TyComponent<SelectState> {
|
|
|
73
73
|
visual: boolean;
|
|
74
74
|
default: boolean;
|
|
75
75
|
};
|
|
76
|
-
|
|
76
|
+
error: {
|
|
77
|
+
type: "string";
|
|
78
|
+
visual: boolean;
|
|
79
|
+
default: string;
|
|
80
|
+
};
|
|
81
|
+
noClear: {
|
|
77
82
|
type: "boolean";
|
|
78
83
|
visual: boolean;
|
|
79
84
|
default: boolean;
|
|
80
|
-
aliases: {
|
|
81
|
-
"not-clearable": boolean;
|
|
82
|
-
};
|
|
83
85
|
};
|
|
84
86
|
externalSearch: {
|
|
85
87
|
type: "boolean";
|
|
@@ -193,6 +195,8 @@ export declare class TySelect extends TyComponent<SelectState> {
|
|
|
193
195
|
private _childObserver;
|
|
194
196
|
private _selectedClone;
|
|
195
197
|
private _customFlavorSheet;
|
|
198
|
+
private _ariaTrigger;
|
|
199
|
+
private _ariaObserver;
|
|
196
200
|
constructor();
|
|
197
201
|
/** TyComponent handles property capture automatically. */
|
|
198
202
|
protected onConnect(): void;
|
|
@@ -210,6 +214,12 @@ export declare class TySelect extends TyComponent<SelectState> {
|
|
|
210
214
|
private applyLoadingState;
|
|
211
215
|
/** Form value: a plain entry for single, FormData with repeated entries for multiple (HTMX standard). */
|
|
212
216
|
protected getFormValue(): FormDataEntryValue | FormData | null;
|
|
217
|
+
/**
|
|
218
|
+
* Focus the trigger: a slotted one, else the field. The host itself isn't
|
|
219
|
+
* focusable. A slotted trigger that can't take focus (a <span>, a disabled
|
|
220
|
+
* button) leaves it to the field.
|
|
221
|
+
*/
|
|
222
|
+
focus(options?: FocusOptions): void;
|
|
213
223
|
private parseValue;
|
|
214
224
|
/** Initialize component state from the value property / pre-selected children. */
|
|
215
225
|
private initializeState;
|
|
@@ -240,6 +250,12 @@ export declare class TySelect extends TyComponent<SelectState> {
|
|
|
240
250
|
* Get all option elements from the component (ty-option preferred, ty-tag accepted)
|
|
241
251
|
*/
|
|
242
252
|
private getTagElements;
|
|
253
|
+
/**
|
|
254
|
+
* The options on offer: all but the ones the author hid (`hidden`, like a
|
|
255
|
+
* native <option hidden>). The search filters these and the keyboard walks
|
|
256
|
+
* them; a hidden option can still be the value.
|
|
257
|
+
*/
|
|
258
|
+
private getOfferedTags;
|
|
243
259
|
private getTagData;
|
|
244
260
|
/**
|
|
245
261
|
* Select an option - attribute only. The option stays in the list with
|
|
@@ -338,11 +354,17 @@ export declare class TySelect extends TyComponent<SelectState> {
|
|
|
338
354
|
/**
|
|
339
355
|
* Next tag index in `direction` (-1/1) that isn't disabled, wrapping
|
|
340
356
|
* around — mirrors handleTagClick's disabled check so keyboard nav can
|
|
341
|
-
* never land on/select what a click already refuses to.
|
|
342
|
-
*
|
|
357
|
+
* never land on/select what a click already refuses to. Nor on one out of
|
|
358
|
+
* sight: `tags` is the list as it was offered, and an option can get
|
|
359
|
+
* `hidden` while it's open (a server patch). Returns -1 if every tag is
|
|
360
|
+
* skipped (or there are none).
|
|
343
361
|
*/
|
|
344
362
|
private nextEnabledTagIndex;
|
|
345
363
|
private filterTags;
|
|
364
|
+
/**
|
|
365
|
+
* Search filtering marks the options it leaves out `filtered-out`, never
|
|
366
|
+
* `hidden`: that one is the author's (see getOfferedTags).
|
|
367
|
+
*/
|
|
346
368
|
private updateTagVisibility;
|
|
347
369
|
private updateOptionsVisibility;
|
|
348
370
|
private clearHighlights;
|
|
@@ -359,12 +381,29 @@ export declare class TySelect extends TyComponent<SelectState> {
|
|
|
359
381
|
private fireCloseEvent;
|
|
360
382
|
private dispatchChangeEvent;
|
|
361
383
|
protected render(): void;
|
|
384
|
+
/**
|
|
385
|
+
* Patch label, required marker and disabled/compact state onto the
|
|
386
|
+
* already-built shadow DOM. renderDesktop/renderMobile only write markup on
|
|
387
|
+
* first render, so without this toggling `required`, `label`, `disabled` or
|
|
388
|
+
* `compact` after connect never showed up.
|
|
389
|
+
*/
|
|
390
|
+
private syncFieldChrome;
|
|
391
|
+
/**
|
|
392
|
+
* A slotted trigger is what takes focus (focus()), so it carries the error
|
|
393
|
+
* state too. aria-describedby can't reach into our shadow root from the
|
|
394
|
+
* light DOM: the message goes in aria-description instead. The trigger is
|
|
395
|
+
* the author's markup, so a morph can strip these while the error stays:
|
|
396
|
+
* a watch on them puts them back. Writes only on a real change, or the
|
|
397
|
+
* watch would feed itself.
|
|
398
|
+
*/
|
|
399
|
+
private syncTriggerAria;
|
|
362
400
|
/**
|
|
363
401
|
* Reflect constraint validation to the owning <form> via ElementInternals.
|
|
364
402
|
* Without this `required` is only cosmetic — form.checkValidity() (and a
|
|
365
403
|
* real submit) never actually blocks on an empty required select. Mirrors
|
|
366
|
-
* ty-input's updateValidity(): empty + required => valueMissing
|
|
367
|
-
* fields are barred from constraint
|
|
404
|
+
* ty-input's updateValidity(): empty + required => valueMissing, with a
|
|
405
|
+
* native <select>'s message; disabled fields are barred from constraint
|
|
406
|
+
* validation.
|
|
368
407
|
*/
|
|
369
408
|
private updateValidity;
|
|
370
409
|
/**
|
|
@@ -377,11 +416,25 @@ export declare class TySelect extends TyComponent<SelectState> {
|
|
|
377
416
|
private renderDesktop;
|
|
378
417
|
private renderMobile;
|
|
379
418
|
private setupMobileEventListeners;
|
|
419
|
+
/**
|
|
420
|
+
* The dialog was closed by someone else — a ty-modal around this select
|
|
421
|
+
* closes the dialogs still open inside it. Run our own close too, so the
|
|
422
|
+
* open state, aria-expanded and the scroll lock follow. Watches the `open`
|
|
423
|
+
* attribute rather than the `close` event: that one comes a task later,
|
|
424
|
+
* so right after modal.hide() the stub would still say expanded. Our own
|
|
425
|
+
* close() calls land here with the state already closed, and a dialog
|
|
426
|
+
* reopened since then is open again: both are no-ops.
|
|
427
|
+
*/
|
|
428
|
+
private syncOnOutsideClose;
|
|
380
429
|
private handleMobileStubClick;
|
|
381
430
|
/** Keyboard-open the (closed) mobile stub — see handleStubKeydown for why this is needed. */
|
|
382
431
|
private handleMobileStubKeydown;
|
|
383
432
|
private handleMobileTagClick;
|
|
384
433
|
private updateMobileSelectedState;
|
|
434
|
+
/** "Label (n)" with the count in its own muted span — same shape for both
|
|
435
|
+
sections, and re-reads the label so selected-label/available-label
|
|
436
|
+
changes after first render show up. */
|
|
437
|
+
private setMobileSectionTitle;
|
|
385
438
|
/**
|
|
386
439
|
* Hand the dialog's spare vertical space to one section or the other. Only
|
|
387
440
|
* one can own it: on a phone there isn't enough height for two scrollable
|
|
@@ -434,7 +487,9 @@ export declare class TySelect extends TyComponent<SelectState> {
|
|
|
434
487
|
* Clear the entire selection programmatically WITH a change event
|
|
435
488
|
* (action: 'clear'). No-op if nothing is selected. Exists so slot="trigger"
|
|
436
489
|
* consumers (custom chrome, built-in clear UI hidden by design) can wire
|
|
437
|
-
* their own clear icon's click handler to it.
|
|
490
|
+
* their own clear icon's click handler to it. Shows no validation
|
|
491
|
+
* message (a code reset after a save shouldn't flag the field); the
|
|
492
|
+
* built-in × does.
|
|
438
493
|
*/
|
|
439
494
|
clear(): void;
|
|
440
495
|
get value(): string;
|
|
@@ -455,10 +510,12 @@ export declare class TySelect extends TyComponent<SelectState> {
|
|
|
455
510
|
set loading(value: boolean);
|
|
456
511
|
get readonly(): boolean;
|
|
457
512
|
set readonly(value: boolean);
|
|
458
|
-
get
|
|
459
|
-
set
|
|
513
|
+
get noClear(): boolean;
|
|
514
|
+
set noClear(value: boolean);
|
|
460
515
|
get required(): boolean;
|
|
461
516
|
set required(value: boolean);
|
|
517
|
+
get error(): string;
|
|
518
|
+
set error(value: string);
|
|
462
519
|
get notSearchable(): boolean;
|
|
463
520
|
set notSearchable(value: boolean);
|
|
464
521
|
get externalSearch(): boolean;
|