tyrell-components 1.0.0-RC17 → 1.0.0-RC19
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 -330
- package/css/tyrell-theme.css +1 -1472
- package/css/tyrell.css +1 -1387
- package/dist/tyrell.js +1 -1
- package/lib/base/ty-component.d.ts +5 -0
- package/lib/base/ty-component.js +19 -13
- package/lib/components/calendar.d.ts +1 -0
- package/lib/components/calendar.js +4 -0
- package/lib/components/input.js +1 -0
- package/lib/components/modal.d.ts +3 -0
- package/lib/components/modal.js +7 -1
- package/lib/components/option.d.ts +19 -0
- package/lib/components/option.js +38 -26
- package/lib/components/select.d.ts +108 -197
- package/lib/components/select.js +402 -807
- package/lib/components/selected-tags.d.ts +8 -4
- package/lib/components/selected-tags.js +26 -8
- package/lib/components/tag.d.ts +0 -9
- package/lib/components/tag.js +0 -11
- package/lib/styles/modal.d.ts +1 -1
- package/lib/styles/modal.js +56 -0
- package/lib/styles/option.d.ts +1 -1
- package/lib/styles/option.js +3 -8
- package/lib/styles/select-base.js +1 -60
- package/lib/styles/select.d.ts +1 -1
- package/lib/styles/select.js +9 -2
- package/lib/styles/tag.js +1 -4
- package/lib/types/common.d.ts +3 -3
- package/lib/utils/property-manager.d.ts +0 -5
- package/lib/utils/property-manager.js +0 -11
- package/lib/version.d.ts +1 -1
- package/lib/version.js +1 -1
- package/package.json +6 -5
|
@@ -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,13 +24,15 @@ 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
|
*/
|
|
31
|
-
/** The picker's option for a value
|
|
35
|
+
/** The picker's option for a value. */
|
|
32
36
|
private option;
|
|
33
37
|
private context;
|
|
34
38
|
/**
|
|
@@ -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,15 @@ 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
|
}
|
|
96
112
|
option(value) {
|
|
97
|
-
return this._picker?.querySelector(`[value="${CSS.escape(value)}"]
|
|
113
|
+
return this._picker?.querySelector(`[value="${CSS.escape(value)}"]`);
|
|
98
114
|
}
|
|
99
115
|
context(value) {
|
|
100
116
|
const opt = this.option(value);
|
|
@@ -174,7 +190,8 @@ return;
|
|
|
174
190
|
const template = this.template();
|
|
175
191
|
this._lastTemplate = template;
|
|
176
192
|
if (!this._picker) {
|
|
177
|
-
this.
|
|
193
|
+
this._rendered = template ? [template] : [];
|
|
194
|
+
this.replaceChildren(...this._rendered);
|
|
178
195
|
return;
|
|
179
196
|
}
|
|
180
197
|
const frag = document.createDocumentFragment();
|
|
@@ -183,6 +200,7 @@ frag.appendChild(template);
|
|
|
183
200
|
for (const value of this.values()) {
|
|
184
201
|
frag.appendChild(template ? this.stampTemplate(template, value) : this.defaultChip(value));
|
|
185
202
|
}
|
|
203
|
+
this._rendered = Array.from(frag.childNodes);
|
|
186
204
|
this.replaceChildren(frag);
|
|
187
205
|
}
|
|
188
206
|
deselect(value) {
|
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,
|
package/lib/styles/modal.d.ts
CHANGED
|
@@ -4,4 +4,4 @@
|
|
|
4
4
|
* CSS for the modal component wrapper.
|
|
5
5
|
* The modal is a pure wrapper - all content styling is user-defined.
|
|
6
6
|
*/
|
|
7
|
-
export declare const modalStyles = "\n:host {\n display: contents;\n /* Don't interfere with layout */\n}\n\n/* Part of the modal wrapper functionality, not user content styling */\n.close-button {\n position: absolute;\n top: -8px;\n right: -8px;\n background: transparent;\n border: none;\n cursor: pointer;\n padding: 4px;\n border-radius: 4px;\n transition: var(--ty-transition-colors);\n z-index: 1;\n color: #d8d8d8;\n\n /* Remove all default browser styling that could cause outlines/borders */\n outline: none;\n box-shadow: none;\n -webkit-appearance: none;\n -moz-appearance: none;\n appearance: none;\n\n /* Remove mobile tap highlights and focus rings */\n -webkit-tap-highlight-color: transparent;\n -webkit-touch-callout: none;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n}\n\n.close-button:hover {\n color: white;\n}\n\n/* Explicitly remove focus and active states for all interaction modes */\n.close-button:focus,\n.close-button:focus-visible,\n.close-button:focus-within,\n.close-button:active {\n outline: none !important;\n box-shadow: none !important;\n border: none !important;\n background: transparent !important;\n}\n\n/* Override hover color even in focus/active states */\n.close-button:hover,\n.close-button:focus:hover,\n.close-button:active:hover {\n color: white;\n}\n\n.close-button.hide {\n visibility: hidden;\n}\n\n/* Pure wrapper: only essential modal functionality, no styling of user content */\n.ty-modal-dialog {\n /* Reset default dialog styles */\n padding: 18px;\n border: none;\n margin: 0;\n background: transparent;\n\n /* Centered */\n position: fixed;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n\n z-index: 1000;\n overflow: hidden;\n\n /* No sizing - let user content determine size */\n max-width: 85vw;\n max-height: 90vh;\n\n outline: none;\n}\n\n/* Panel zoom-in synced with the backdrop fade (shadcn-style zoom-in-95).\n Enter-only: animating exit on a native <dialog> means delaying close(). */\n.ty-modal-dialog[open] {\n animation: ty-modal-enter var(--ty-modal-duration, 200ms) ease-out;\n}\n\n@keyframes ty-modal-enter {\n from {\n opacity: 0;\n transform: translate(-50%, -50%) scale(0.93);\n }\n\n to {\n opacity: 1;\n transform: translate(-50%, -50%) scale(1);\n }\n}\n\n/* Backdrop is part of modal functionality, not user content */\n.ty-modal-dialog::backdrop {\n background: var(--ty-modal-backdrop, rgba(0, 0, 0, 0.5));\n backdrop-filter: var(--ty-modal-backdrop-blur, blur(2px));\n animation: ty-modal-backdrop-enter var(--ty-modal-duration, 200ms) ease-out;\n}\n\n/* When backdrop is disabled */\n.ty-modal-dialog:not([data-backdrop])::backdrop {\n background: transparent;\n backdrop-filter: none;\n}\n\n/* Minimal container - no styling imposed on user content */\n.modal-content {\n color: var(--ty-text);\n}\n\n@keyframes ty-modal-backdrop-enter {\n from {\n opacity: 0;\n }\n\n to {\n opacity: 1;\n }\n}\n";
|
|
7
|
+
export declare const modalStyles = "\n:host {\n display: contents;\n /* Don't interfere with layout */\n}\n\n/* Part of the modal wrapper functionality, not user content styling */\n.close-button {\n position: absolute;\n top: -8px;\n right: -8px;\n background: transparent;\n border: none;\n cursor: pointer;\n padding: 4px;\n border-radius: 4px;\n transition: var(--ty-transition-colors);\n z-index: 1;\n color: #d8d8d8;\n\n /* Remove all default browser styling that could cause outlines/borders */\n outline: none;\n box-shadow: none;\n -webkit-appearance: none;\n -moz-appearance: none;\n appearance: none;\n\n /* Remove mobile tap highlights and focus rings */\n -webkit-tap-highlight-color: transparent;\n -webkit-touch-callout: none;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n}\n\n.close-button:hover {\n color: white;\n}\n\n/* Explicitly remove focus and active states for all interaction modes */\n.close-button:focus,\n.close-button:focus-visible,\n.close-button:focus-within,\n.close-button:active {\n outline: none !important;\n box-shadow: none !important;\n border: none !important;\n background: transparent !important;\n}\n\n/* Override hover color even in focus/active states */\n.close-button:hover,\n.close-button:focus:hover,\n.close-button:active:hover {\n color: white;\n}\n\n.close-button.hide {\n visibility: hidden;\n}\n\n/* Pure wrapper: only essential modal functionality, no styling of user content */\n.ty-modal-dialog {\n /* Reset default dialog styles */\n padding: 18px;\n border: none;\n margin: 0;\n background: transparent;\n\n /* Centered */\n position: fixed;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n\n z-index: 1000;\n overflow: hidden;\n\n /* No sizing - let user content determine size */\n max-width: 85vw;\n max-height: 90vh;\n\n outline: none;\n}\n\n/* Panel zoom-in synced with the backdrop fade (shadcn-style zoom-in-95).\n Enter-only: animating exit on a native <dialog> means delaying close(). */\n.ty-modal-dialog[open] {\n animation: ty-modal-enter var(--ty-modal-duration, 200ms) ease-out;\n}\n\n@keyframes ty-modal-enter {\n from {\n opacity: 0;\n transform: translate(-50%, -50%) scale(0.93);\n }\n\n to {\n opacity: 1;\n transform: translate(-50%, -50%) scale(1);\n }\n}\n\n/* Backdrop is part of modal functionality, not user content */\n.ty-modal-dialog::backdrop {\n background: var(--ty-modal-backdrop, rgba(0, 0, 0, 0.5));\n backdrop-filter: var(--ty-modal-backdrop-blur, blur(2px));\n animation: ty-modal-backdrop-enter var(--ty-modal-duration, 200ms) ease-out;\n}\n\n/* When backdrop is disabled */\n.ty-modal-dialog:not([data-backdrop])::backdrop {\n background: transparent;\n backdrop-filter: none;\n}\n\n/* sheet: full screen on phones, sliding up from the bottom. Opt-in, and only\n below 768px (the select's mobile line); wider screens keep the centered dialog. The panel is forced to\n fill the sheet (!important beats its own width, inline style included),\n since a sheet that leaves page showing around the panel isn't one. */\n@media (max-width: 768px) {\n .ty-modal-dialog[data-sheet] {\n inset: 0;\n transform: none;\n width: 100%;\n height: 100dvh;\n max-width: none;\n max-height: none;\n padding: env(safe-area-inset-top) env(safe-area-inset-right)\n env(safe-area-inset-bottom) env(safe-area-inset-left);\n background: var(--ty-surface-floating);\n box-sizing: border-box;\n }\n\n .ty-modal-dialog[data-sheet][open] {\n animation-name: ty-modal-sheet-enter;\n }\n\n .ty-modal-dialog[data-sheet] .modal-content {\n height: 100%;\n overflow-y: auto;\n overscroll-behavior: contain;\n }\n\n .ty-modal-dialog[data-sheet] ::slotted(*) {\n box-sizing: border-box !important;\n width: 100% !important;\n max-width: none !important;\n min-height: 100% !important;\n margin: 0 !important;\n border: none !important;\n border-radius: 0 !important;\n }\n\n /* On the panel, not out on the backdrop */\n .ty-modal-dialog[data-sheet] .close-button {\n top: calc(env(safe-area-inset-top) + 8px);\n right: calc(env(safe-area-inset-right) + 8px);\n color: var(--ty-text-soft);\n }\n\n .ty-modal-dialog[data-sheet] .close-button:hover,\n .ty-modal-dialog[data-sheet] .close-button:focus:hover,\n .ty-modal-dialog[data-sheet] .close-button:active:hover {\n color: var(--ty-text);\n }\n}\n\n@keyframes ty-modal-sheet-enter {\n from {\n transform: translateY(100%);\n }\n\n to {\n transform: none;\n }\n}\n\n/* Minimal container - no styling imposed on user content */\n.modal-content {\n color: var(--ty-text);\n}\n\n@keyframes ty-modal-backdrop-enter {\n from {\n opacity: 0;\n }\n\n to {\n opacity: 1;\n }\n}\n\n@media (prefers-reduced-motion: reduce) {\n .ty-modal-dialog[open],\n .ty-modal-dialog[data-sheet][open],\n .ty-modal-dialog::backdrop {\n animation: none;\n }\n}\n";
|
package/lib/styles/modal.js
CHANGED
|
@@ -83,6 +83,55 @@ animation: ty-modal-backdrop-enter var(--ty-modal-duration, 200ms) ease-out;
|
|
|
83
83
|
background: transparent;
|
|
84
84
|
backdrop-filter: none;
|
|
85
85
|
}
|
|
86
|
+
@media (max-width: 768px) {
|
|
87
|
+
.ty-modal-dialog[data-sheet] {
|
|
88
|
+
inset: 0;
|
|
89
|
+
transform: none;
|
|
90
|
+
width: 100%;
|
|
91
|
+
height: 100dvh;
|
|
92
|
+
max-width: none;
|
|
93
|
+
max-height: none;
|
|
94
|
+
padding: env(safe-area-inset-top) env(safe-area-inset-right)
|
|
95
|
+
env(safe-area-inset-bottom) env(safe-area-inset-left);
|
|
96
|
+
background: var(--ty-surface-floating);
|
|
97
|
+
box-sizing: border-box;
|
|
98
|
+
}
|
|
99
|
+
.ty-modal-dialog[data-sheet][open] {
|
|
100
|
+
animation-name: ty-modal-sheet-enter;
|
|
101
|
+
}
|
|
102
|
+
.ty-modal-dialog[data-sheet] .modal-content {
|
|
103
|
+
height: 100%;
|
|
104
|
+
overflow-y: auto;
|
|
105
|
+
overscroll-behavior: contain;
|
|
106
|
+
}
|
|
107
|
+
.ty-modal-dialog[data-sheet] ::slotted(*) {
|
|
108
|
+
box-sizing: border-box !important;
|
|
109
|
+
width: 100% !important;
|
|
110
|
+
max-width: none !important;
|
|
111
|
+
min-height: 100% !important;
|
|
112
|
+
margin: 0 !important;
|
|
113
|
+
border: none !important;
|
|
114
|
+
border-radius: 0 !important;
|
|
115
|
+
}
|
|
116
|
+
.ty-modal-dialog[data-sheet] .close-button {
|
|
117
|
+
top: calc(env(safe-area-inset-top) + 8px);
|
|
118
|
+
right: calc(env(safe-area-inset-right) + 8px);
|
|
119
|
+
color: var(--ty-text-soft);
|
|
120
|
+
}
|
|
121
|
+
.ty-modal-dialog[data-sheet] .close-button:hover,
|
|
122
|
+
.ty-modal-dialog[data-sheet] .close-button:focus:hover,
|
|
123
|
+
.ty-modal-dialog[data-sheet] .close-button:active:hover {
|
|
124
|
+
color: var(--ty-text);
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
@keyframes ty-modal-sheet-enter {
|
|
128
|
+
from {
|
|
129
|
+
transform: translateY(100%);
|
|
130
|
+
}
|
|
131
|
+
to {
|
|
132
|
+
transform: none;
|
|
133
|
+
}
|
|
134
|
+
}
|
|
86
135
|
.modal-content {
|
|
87
136
|
color: var(--ty-text);
|
|
88
137
|
}
|
|
@@ -94,4 +143,11 @@ to {
|
|
|
94
143
|
opacity: 1;
|
|
95
144
|
}
|
|
96
145
|
}
|
|
146
|
+
@media (prefers-reduced-motion: reduce) {
|
|
147
|
+
.ty-modal-dialog[open],
|
|
148
|
+
.ty-modal-dialog[data-sheet][open],
|
|
149
|
+
.ty-modal-dialog::backdrop {
|
|
150
|
+
animation: none;
|
|
151
|
+
}
|
|
152
|
+
}
|
|
97
153
|
`;
|
package/lib/styles/option.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/** Option Component Styles */
|
|
2
|
-
export declare const optionStyles = "\n/* Options the author hid and options a ty-select search left out, at any\n depth in the select (a framework component's element around each option\n too). !important beats the select's mobile list display:block. */\n:host([hidden]),\n:host([filtered-out]) {\n display: none !important;\n}\n\n.option-content {\n display: flex;\n align-items: center;\n justify-content: space-between;\n gap: var(--ty-spacing-2);\n box-sizing: border-box;\n width: 100%;\n\n cursor: pointer;\n user-select: none;\n\n transition: var(--ty-transition-all);\n\n /* Linear-paired typography */\n color: var(--ty-text);\n font-family: inherit;\n font-size: var(--ty-font-sm);\n line-height: var(--ty-leading-sm);\n letter-spacing: var(--ty-tracking-sm);\n padding: var(--ty-spacing-2) var(--ty-spacing-3);\n border-radius: var(--ty-radius-md);\n}\n\n/*
|
|
2
|
+
export declare const optionStyles = "\n/* Options the author hid and options a ty-select search left out, at any\n depth in the select (a framework component's element around each option\n too). !important beats the select's mobile list display:block. The\n select's trigger sets the variable: a hidden option can still be the\n value it shows. */\n:host([hidden]),\n:host([filtered-out]) {\n display: var(--ty-option-hidden-display, none) !important;\n}\n\n.option-content {\n display: flex;\n align-items: center;\n justify-content: space-between;\n gap: var(--ty-spacing-2);\n box-sizing: border-box;\n width: 100%;\n\n cursor: pointer;\n user-select: none;\n\n transition: var(--ty-transition-all);\n\n /* Linear-paired typography */\n color: var(--ty-text);\n font-family: inherit;\n font-size: var(--ty-font-sm);\n line-height: var(--ty-leading-sm);\n letter-spacing: var(--ty-tracking-sm);\n padding: var(--ty-spacing-2) var(--ty-spacing-3);\n border-radius: var(--ty-radius-md);\n}\n\n/* Shown in the select's trigger (the select sets inTrigger): one ellipsized\n line on the field size ladder (styles/field-size.ts), no row chrome. The\n select sizes the host. */\n.option-content.in-trigger {\n display: block;\n padding: 0px;\n background: transparent;\n min-width: 0;\n overflow: hidden;\n white-space: nowrap;\n text-overflow: ellipsis;\n font-size: var(--ty-field-font, var(--ty-font-sm));\n line-height: var(--ty-field-leading, var(--ty-leading-sm));\n letter-spacing: var(--ty-field-tracking, var(--ty-tracking-sm));\n}\n\n.option-content:hover {\n background: var(--ty-bg-neutral-soft);\n}\n\n.option-content[highlighted] {\n background: var(--ty-bg-neutral-soft);\n color: var(--ty-text-strong);\n}\n\n/* Selected: quiet \u2014 bolder text color only, no background slab, no weight change */\n.option-content[selected] {\n background: transparent;\n color: var(--ty-text-bold);\n}\n\n/* Lucide check \u2014 right-aligned. Its box is always reserved so selecting\n (or highlighting) never changes the row's width and rewraps the text. */\n.option-check {\n display: block;\n visibility: hidden;\n flex-shrink: 0;\n width: 14px;\n height: 14px;\n margin-left: auto;\n color: var(--ty-color-primary);\n}\n\n.option-content[selected] .option-check {\n visibility: visible;\n}\n\n.option-content.in-trigger .option-check {\n display: none;\n}\n\n.option-content[selected]:hover {\n background: var(--ty-bg-neutral-soft);\n}\n\n.option-content[disabled] {\n opacity: 0.5;\n cursor: not-allowed;\n}\n\n.option-content[hidden] {}\n\n.option-content * {\n pointer-events: none;\n}\n";
|
package/lib/styles/option.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export const optionStyles = `
|
|
2
2
|
:host([hidden]),
|
|
3
3
|
:host([filtered-out]) {
|
|
4
|
-
display: none !important;
|
|
4
|
+
display: var(--ty-option-hidden-display, none) !important;
|
|
5
5
|
}
|
|
6
6
|
.option-content {
|
|
7
7
|
display: flex;
|
|
@@ -21,12 +21,7 @@ letter-spacing: var(--ty-tracking-sm);
|
|
|
21
21
|
padding: var(--ty-spacing-2) var(--ty-spacing-3);
|
|
22
22
|
border-radius: var(--ty-radius-md);
|
|
23
23
|
}
|
|
24
|
-
|
|
25
|
-
display: block;
|
|
26
|
-
min-width: 0;
|
|
27
|
-
overflow: hidden;
|
|
28
|
-
}
|
|
29
|
-
:host([cloned]) .option-content {
|
|
24
|
+
.option-content.in-trigger {
|
|
30
25
|
display: block;
|
|
31
26
|
padding: 0px;
|
|
32
27
|
background: transparent;
|
|
@@ -61,7 +56,7 @@ color: var(--ty-color-primary);
|
|
|
61
56
|
.option-content[selected] .option-check {
|
|
62
57
|
visibility: visible;
|
|
63
58
|
}
|
|
64
|
-
|
|
59
|
+
.option-content.in-trigger .option-check {
|
|
65
60
|
display: none;
|
|
66
61
|
}
|
|
67
62
|
.option-content[selected]:hover {
|
|
@@ -63,7 +63,6 @@ transition:
|
|
|
63
63
|
opacity var(--ty-popup-duration, 180ms) var(--ty-popup-ease, cubic-bezier(0.34, 1.56, 0.64, 1)),
|
|
64
64
|
scale var(--ty-popup-duration, 180ms) var(--ty-popup-ease, cubic-bezier(0.34, 1.56, 0.64, 1)),
|
|
65
65
|
translate var(--ty-popup-duration, 180ms) var(--ty-popup-ease, cubic-bezier(0.34, 1.56, 0.64, 1));
|
|
66
|
-
transform: translate(var(--dropdown-offset-x, 0px), var(--dropdown-offset-y, 0px));
|
|
67
66
|
top: -1000px;
|
|
68
67
|
left: -1000px;
|
|
69
68
|
}
|
|
@@ -260,18 +259,6 @@ padding-left: 0;
|
|
|
260
259
|
.select-stub.error:not(.custom-trigger):not([disabled]) {
|
|
261
260
|
background: var(--ty-bg-danger-soft);
|
|
262
261
|
}
|
|
263
|
-
.dropdown-mode-mobile .dropdown-wrapper:has(.mobile-dialog[open]) .select-chips {
|
|
264
|
-
display: none;
|
|
265
|
-
}
|
|
266
|
-
.select-stub.has-tags {
|
|
267
|
-
padding: 0.25rem 2.5rem 0.25rem 0.5rem;
|
|
268
|
-
width: 100%;
|
|
269
|
-
}
|
|
270
|
-
.select-stub.has-tags slot[name="selected"] {
|
|
271
|
-
display: flex;
|
|
272
|
-
flex-wrap: wrap;
|
|
273
|
-
gap: 0.25rem;
|
|
274
|
-
}
|
|
275
262
|
.dropdown-chevron {
|
|
276
263
|
position: absolute;
|
|
277
264
|
top: 50%;
|
|
@@ -290,13 +277,6 @@ transform: translateY(-50%) rotate(180deg);
|
|
|
290
277
|
width: 100%;
|
|
291
278
|
height: 100%;
|
|
292
279
|
}
|
|
293
|
-
.select-chips {
|
|
294
|
-
display: flex;
|
|
295
|
-
flex-wrap: wrap;
|
|
296
|
-
gap: 0.5rem;
|
|
297
|
-
align-items: center;
|
|
298
|
-
min-width: 0;
|
|
299
|
-
}
|
|
300
280
|
.dropdown-placeholder {
|
|
301
281
|
color: var(--input-placeholder, var(--ty-input-placeholder, #9ca3af));
|
|
302
282
|
font-size: var(--ty-field-font);
|
|
@@ -347,27 +327,6 @@ position: relative;
|
|
|
347
327
|
.dropdown-options-wrapper:hover .ty-scrollbar-track-y.has-overflow {
|
|
348
328
|
opacity: 1;
|
|
349
329
|
}
|
|
350
|
-
.dropdown-options ty-tag {
|
|
351
|
-
user-select: none;
|
|
352
|
-
transition: transform 0.1s ease;
|
|
353
|
-
}
|
|
354
|
-
.dropdown-options ty-tag:hover {
|
|
355
|
-
transform: scale(1.02);
|
|
356
|
-
}
|
|
357
|
-
.dropdown-options ty-tag:active {
|
|
358
|
-
transform: scale(0.98);
|
|
359
|
-
}
|
|
360
|
-
.dropdown-options ty-tag[selected] {
|
|
361
|
-
opacity: 0.5;
|
|
362
|
-
}
|
|
363
|
-
.select-chips ty-tag {
|
|
364
|
-
max-width: 150px;
|
|
365
|
-
}
|
|
366
|
-
@media (max-width: 640px) {
|
|
367
|
-
.select-chips ty-tag {
|
|
368
|
-
max-width: 100px;
|
|
369
|
-
}
|
|
370
|
-
}
|
|
371
330
|
.select-container {
|
|
372
331
|
display: flex;
|
|
373
332
|
flex-direction: column;
|
|
@@ -706,30 +665,12 @@ display: block;
|
|
|
706
665
|
.dropdown-mode-mobile .mobile-available-section[data-empty="true"] slot {
|
|
707
666
|
display: none;
|
|
708
667
|
}
|
|
709
|
-
.dropdown-mode-mobile .section-content ::slotted(ty-tag) {
|
|
710
|
-
cursor: pointer;
|
|
711
|
-
user-select: none;
|
|
712
|
-
transition: transform 0.1s ease;
|
|
713
|
-
margin: 2px 0;
|
|
714
|
-
animation: ty-select-tag-enter 180ms cubic-bezier(0.16, 1, 0.3, 1);
|
|
715
|
-
}
|
|
716
|
-
@media (hover: hover) {
|
|
717
|
-
.dropdown-mode-mobile .section-content ::slotted(ty-tag:hover) {
|
|
718
|
-
transform: scale(1.02);
|
|
719
|
-
}
|
|
720
|
-
}
|
|
721
|
-
.dropdown-mode-mobile .section-content ::slotted(ty-tag:active) {
|
|
722
|
-
transform: scale(0.96);
|
|
723
|
-
}
|
|
724
|
-
.dropdown-mode-mobile .section-content ::slotted(ty-tag[hidden]) {
|
|
725
|
-
display: none !important;
|
|
726
|
-
}
|
|
727
668
|
@keyframes ty-select-tag-enter {
|
|
728
669
|
from { opacity: 0; transform: scale(0.85); }
|
|
729
670
|
to { opacity: 1; transform: scale(1); }
|
|
730
671
|
}
|
|
731
672
|
@media (prefers-reduced-motion: reduce) {
|
|
732
|
-
.dropdown-mode-mobile .
|
|
673
|
+
.dropdown-mode-mobile .mobile-selected-chip {
|
|
733
674
|
animation: none;
|
|
734
675
|
}
|
|
735
676
|
}
|
package/lib/styles/select.d.ts
CHANGED
|
@@ -8,4 +8,4 @@
|
|
|
8
8
|
* - .compact: content-hugging trigger for toolbars, count badge
|
|
9
9
|
* - .custom-trigger (slot="trigger"): all chrome stripped
|
|
10
10
|
*/
|
|
11
|
-
export declare const selectStyles = "\n/* Compact skin hugs its content (field skin = base styles) */\n.select-stub.compact {\n display: inline-flex;\n flex-wrap: nowrap;\n width: auto;\n gap: 0.5rem;\n /* extra right padding = room for the absolutely-positioned chevron */\n padding: 0.5rem 2.25rem 0.5rem 0.875rem;\n}\n\n/* Consumer-provided trigger (slot=\"trigger\"): no chrome at all */\n.select-stub.custom-trigger {\n display: inline-block;\n width: auto;\n border: none;\n background: none;\n padding: 0;\n min-height: 0;\n border-radius: 0;\n}\n.select-stub.custom-trigger:hover {\n border: none;\n}\n\n.select-count {\n flex-shrink: 0;\n display: inline-flex;\n align-items: center;\n justify-content: center;\n min-width: 1.25rem;\n height: 1.25rem;\n padding: 0 0.375rem;\n border-radius: 9999px;\n /* --ty-text-primary never existed as a token \u2014 this silently fell back\n to inherited/unset color. Now follows the select's own flavor. */\n background: color-mix(in oklab, var(--select-accent, var(--ty-color-primary)) 15%, transparent);\n color: var(--select-accent-bold, var(--ty-color-primary-strong));\n font-size: var(--ty-font-xs);\n font-weight: var(--ty-font-semibold);\n font-style: normal;\n}\n.select-count[hidden] {\n display: none;\n}\n\n/* Clear (x) button \u2014 normal flex child of .select-stub, not absolutely\n positioned like .dropdown-chevron: it just takes its own space in the\n row, no padding-right gutter math needed. Lives in the trigger slot's\n fallback content, so it's automatically absent under slot=\"trigger\". */\n.select-clear {\n flex-shrink: 0;\n display: inline-flex;\n align-items: center;\n justify-content: center;\n width: 1rem;\n height: 1rem;\n padding: 0;\n border: none;\n background: none;\n color: var(--input-placeholder, var(--ty-input-placeholder));\n cursor: pointer;\n border-radius: var(--ty-radius-sm);\n transition: var(--ty-local-transition, all 0.15s ease);\n}\n/* Pull toward the chevron: the stub's right padding (chevron room) left 12px\n between them on the field skin, 8px on compact. Both land at 6px. */\n.select-stub .select-clear {\n margin-right: -0.375rem;\n}\n.select-stub.compact .select-clear {\n margin-right: -0.125rem;\n}\n.select-clear[hidden] {\n display: none;\n}\n.select-clear:hover {\n /* Destructive utility action \u2014 neutral at rest, warns danger-red on\n hover regardless of the field's own flavor. */\n color: var(--ty-color-danger);\n background-color: var(--ty-bg-danger-soft);\n}\n.select-clear svg {\n width: 100%;\n height: 100%;\n}\n\n/* Selection text (field skin): single line, ellipsis, input colors.\n flex-basis 0, not auto \u2014 .select-stub is flex-wrap:wrap, and auto's\n hypothetical size is the FULL untruncated text width (wrap-line\n assignment happens before shrinking), which pushed fixed-size siblings\n (.select-clear) onto a second line even though the text visibly had\n room after truncating. 0 makes this item contribute ~nothing to the\n line-fit check up front; grow/shrink + overflow:hidden still truncate\n it identically. */\n.select-stub .dropdown-placeholder {\n font-style: normal;\n flex: 1 1 0%;\n min-width: 0;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n color: var(--input-color, var(--ty-input-color));\n}\n\n.select-stub .dropdown-placeholder.placeholder-shown {\n color: var(--input-placeholder, var(--ty-input-placeholder));\n}\n.select-stub .dropdown-placeholder[hidden] {\n display: none;\n}\n\n/* Single-select display clone (slot=\"selected\"): the selected ty-option\n projected into the stub \u2014 its own :host([cloned]) styling strips the\n list-row chrome; here it just takes the text's flex slot. */\n.select-stub slot[name=\"selected\"] {\n display: none;\n}\n.select-stub.has-clone slot[name=\"selected\"] {\n display: block;\n /* flex-basis 0, not auto \u2014 same reasoning as .dropdown-placeholder above:\n .select-stub is flex-wrap:wrap, and auto's hypothetical size is the\n clone's full untruncated text width, which pushes .select-clear onto\n a second line. */\n flex: 1 1 0%;\n min-width: 0;\n overflow: hidden;\n}\n.select-stub.compact.has-clone slot[name=\"selected\"] {\n flex: 0 1 auto;\n}\n\n/* start/end slot content (icons etc.) \u2014 spacing comes from the stub's flex\n gap; muted like ty-input adornments. end sits before the chevron. */\n.select-stub ::slotted([slot=\"start\"]),\n.select-stub ::slotted([slot=\"end\"]) {\n flex-shrink: 0;\n color: var(--ty-text-soft);\n}\n\n/* Compact skin: the text IS the trigger label \u2014 no grow, regular text color.\n flex-basis: auto (not the field skin's 0%) \u2014 content-hugging needs its\n natural content width as the starting point; 0% would collapse it since\n grow is also 0 here (nothing left to expand it back out). */\n.select-stub.compact .dropdown-placeholder {\n flex: 0 1 auto;\n color: var(--ty-text);\n}\n\n/* Trigger stays visible while the popup is open (the popup hides it) */\n.dropdown-wrapper:has(.dropdown-chevron.open) .select-stub {\n opacity: 1;\n pointer-events: auto;\n}\n\n/* One-panel popup: search header fused with the options list */\n\n/* Single unified shadow around the whole panel (header + list as one silhouette) */\n.dropdown-dialog.open {\n filter: drop-shadow(0 12px 24px rgba(0, 0, 0, 0.14)) drop-shadow(0 2px 6px rgba(0, 0, 0, 0.08));\n}\n\n/* Card-style header: the search input keeps its own bordered-field look\n (base styles) and sits inset in the panel, TagPicker-style \u2014 no divider,\n whitespace separates it from the list. The header's OWN surface/border is\n part of the floating panel's chrome, not a form field \u2014 --ty-surface-\n floating/--ty-floating-border, matching .dropdown-options below it (same\n reasoning as the base-panel fix: --ty-input-* is deliberately faint for\n resting form fields and read as a missing/mismatched edge here). */\n.dropdown-header {\n background: var(--ty-surface-floating);\n border: 1px solid var(--ty-floating-border);\n border-bottom: none;\n border-radius: var(--ty-radius-lg) var(--ty-radius-lg) 0 0;\n padding: var(--ty-spacing-2) var(--ty-spacing-2) var(--ty-spacing-1);\n}\n.dropdown-dialog.position-below .dropdown-header {\n margin-bottom: 0;\n}\n.dropdown-dialog.position-above .dropdown-header {\n margin-top: 0;\n border-top: none;\n border-bottom: 1px solid var(--ty-floating-border);\n border-radius: 0 0 var(--ty-radius-lg) var(--ty-radius-lg);\n padding: var(--ty-spacing-1) var(--ty-spacing-2) var(--ty-spacing-2);\n}\n\n/* Magnifier adornment inside the search field (header padding + field inset) */\n.dropdown-search-icon {\n position: absolute;\n top: 50%;\n left: calc(var(--ty-spacing-2) + var(--ty-spacing-3));\n transform: translateY(-50%);\n width: 1rem;\n height: 1rem;\n color: var(--input-placeholder, var(--ty-input-placeholder));\n pointer-events: none;\n}\n.dropdown-search-icon svg {\n width: 100%;\n height: 100%;\n}\n\n/* Mobile header: flex row, icon flows inline before the input. Same 32x32\n footprint as .mobile-close-button (18px glyph centered in the box, not a\n bare 18px glyph flush at the edge) so the row has two matching bookends \u2014\n a bare icon on one side and a 32px circle on the other read as lopsided\n even with equal flex gap on both sides. Matching them also centers the\n search input's flex:1 fill symmetrically between the two. Fixed white +\n 18px glyph, same reasoning as .mobile-header-label \u2014 this sits on the\n dark ::backdrop blur in both themes, not a theme surface. */\n.dropdown-mode-mobile .mobile-header-content .dropdown-search-icon {\n position: static;\n transform: none;\n flex-shrink: 0;\n display: flex;\n align-items: center;\n justify-content: center;\n width: 32px;\n height: 32px;\n color: #ffffff;\n}\n.dropdown-mode-mobile .mobile-header-content .dropdown-search-icon svg {\n width: 18px;\n height: 18px;\n}\n\n/* Search input: bordered field from base styles; just size + icon room */\n.dropdown-search-input {\n min-height: 2.25rem;\n padding-right: var(--ty-spacing-2);\n /* room for the magnifier adornment */\n padding-left: calc(var(--ty-spacing-3) + 1rem + var(--ty-spacing-2));\n}\n/* Trigger already has a chevron - no second one inside the search row */\n.dropdown-search-chevron {\n display: none;\n}\n\n/* With the search row hidden nothing inside is focusable, so the <dialog>\n itself receives focus on open \u2014 suppress its UA focus ring */\n.dropdown-dialog:focus,\n.dropdown-dialog:focus-visible {\n outline: none;\n}\n\n/* Search row hidden ('auto' below threshold / searchable=\"false\"):\n the options panel owns the whole silhouette */\n.dropdown-header[hidden] {\n display: none;\n}\n.dropdown-header[hidden] ~ .dropdown-options-wrapper .dropdown-options {\n border-top: 1px solid var(--ty-floating-border);\n border-radius: var(--ty-radius-lg);\n}\n.mobile-search-input[hidden],\n.mobile-header-content .dropdown-search-icon[hidden] {\n display: none;\n}\n\n/* Options: vertical list rows fused under the search header.\n No own shadow/animation - the panel appears as one via dialog opacity. */\n.dropdown-options {\n flex-direction: column;\n flex-wrap: nowrap;\n align-items: stretch;\n gap: 0;\n /* Card-style list: rounded rows sit inset from the panel edges */\n padding: var(--ty-spacing-1);\n border-top: none;\n border-radius: 0 0 var(--ty-radius-lg) var(--ty-radius-lg);\n box-shadow: none;\n transform: none;\n transition: none;\n /* ~9-10 visible rows before scrolling (custom scrollbar, native hidden) */\n max-height: 24rem;\n}\n.dropdown-dialog.position-below .dropdown-options {\n box-shadow: none;\n}\n.dropdown-dialog.position-above .dropdown-options {\n border-top: 1px solid var(--ty-floating-border);\n border-bottom: none;\n border-radius: var(--ty-radius-lg) var(--ty-radius-lg) 0 0;\n}\n\n/* Loading panel continues the fused silhouette exactly like .dropdown-options \u2014\n the base layer styles it as a floating card (radius + shadow), which left a\n see-through gap under the search header while loading. */\n.dropdown-loading {\n border-top: none;\n border-radius: 0 0 var(--ty-radius-lg) var(--ty-radius-lg);\n box-shadow: none;\n}\n.dropdown-dialog.position-above .dropdown-loading {\n border-top: 1px solid var(--ty-floating-border);\n border-bottom: none;\n border-radius: var(--ty-radius-lg) var(--ty-radius-lg) 0 0;\n}\n\n/* Selection tick lives inside ty-option (lucide check on [selected]) */\n\n/* Mobile modal: same vertical list */\n.dropdown-mode-mobile .section-content ::slotted(ty-option) {\n display: block;\n width: 100%;\n}\n\n/* Options the author hid and options the search left out. Beats the display\n rule above, which beats the browser's own [hidden] { display: none }. */\n#options-slot::slotted([hidden]),\n#options-slot::slotted([filtered-out]) {\n display: none !important;\n}\n";
|
|
11
|
+
export declare const selectStyles = "\n/* Compact skin hugs its content (field skin = base styles) */\n.select-stub.compact {\n display: inline-flex;\n flex-wrap: nowrap;\n width: auto;\n gap: 0.5rem;\n /* extra right padding = room for the absolutely-positioned chevron */\n padding: 0.5rem 2.25rem 0.5rem 0.875rem;\n}\n\n/* Consumer-provided trigger (slot=\"trigger\"): no chrome at all */\n.select-stub.custom-trigger {\n display: inline-block;\n width: auto;\n border: none;\n background: none;\n padding: 0;\n min-height: 0;\n border-radius: 0;\n}\n.select-stub.custom-trigger:hover {\n border: none;\n}\n\n.select-count {\n flex-shrink: 0;\n display: inline-flex;\n align-items: center;\n justify-content: center;\n min-width: 1.25rem;\n height: 1.25rem;\n padding: 0 0.375rem;\n border-radius: 9999px;\n /* --ty-text-primary never existed as a token \u2014 this silently fell back\n to inherited/unset color. Now follows the select's own flavor. */\n background: color-mix(in oklab, var(--select-accent, var(--ty-color-primary)) 15%, transparent);\n color: var(--select-accent-bold, var(--ty-color-primary-strong));\n font-size: var(--ty-font-xs);\n font-weight: var(--ty-font-semibold);\n font-style: normal;\n}\n.select-count[hidden] {\n display: none;\n}\n\n/* Clear (x) button \u2014 normal flex child of .select-stub, not absolutely\n positioned like .dropdown-chevron: it just takes its own space in the\n row, no padding-right gutter math needed. Lives in the trigger slot's\n fallback content, so it's automatically absent under slot=\"trigger\". */\n.select-clear {\n flex-shrink: 0;\n display: inline-flex;\n align-items: center;\n justify-content: center;\n width: 1rem;\n height: 1rem;\n padding: 0;\n border: none;\n background: none;\n color: var(--input-placeholder, var(--ty-input-placeholder));\n cursor: pointer;\n border-radius: var(--ty-radius-sm);\n transition: var(--ty-local-transition, all 0.15s ease);\n}\n/* Pull toward the chevron: the stub's right padding (chevron room) left 12px\n between them on the field skin, 8px on compact. Both land at 6px. */\n.select-stub .select-clear {\n margin-right: -0.375rem;\n}\n.select-stub.compact .select-clear {\n margin-right: -0.125rem;\n}\n.select-clear[hidden] {\n display: none;\n}\n.select-clear:hover {\n /* Destructive utility action \u2014 neutral at rest, warns danger-red on\n hover regardless of the field's own flavor. */\n color: var(--ty-color-danger);\n background-color: var(--ty-bg-danger-soft);\n}\n.select-clear svg {\n width: 100%;\n height: 100%;\n}\n\n/* Selection text (field skin): single line, ellipsis, input colors.\n flex-basis 0, not auto \u2014 .select-stub is flex-wrap:wrap, and auto's\n hypothetical size is the FULL untruncated text width (wrap-line\n assignment happens before shrinking), which pushed fixed-size siblings\n (.select-clear) onto a second line even though the text visibly had\n room after truncating. 0 makes this item contribute ~nothing to the\n line-fit check up front; grow/shrink + overflow:hidden still truncate\n it identically. */\n.select-stub .dropdown-placeholder {\n font-style: normal;\n flex: 1 1 0%;\n min-width: 0;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n color: var(--input-color, var(--ty-input-color));\n}\n\n.select-stub .dropdown-placeholder.placeholder-shown {\n color: var(--input-placeholder, var(--ty-input-placeholder));\n}\n.select-stub .dropdown-placeholder[hidden] {\n display: none;\n}\n\n/* Single select, closed: the picked option itself is assigned to the\n selected slot (select.ts assignSlots); it takes the text's flex slot. */\n.select-stub slot[name=\"selected\"] {\n display: none;\n}\n.select-stub.has-option slot[name=\"selected\"] {\n display: block;\n /* flex-basis 0, not auto \u2014 same reasoning as .dropdown-placeholder above:\n .select-stub is flex-wrap:wrap, and auto's hypothetical size is the\n option's full untruncated text width, which pushes .select-clear onto\n a second line. */\n flex: 1 1 0%;\n min-width: 0;\n overflow: hidden;\n}\n.select-stub.compact.has-option slot[name=\"selected\"] {\n flex: 0 1 auto;\n}\n.select-stub ::slotted(ty-option) {\n display: block;\n min-width: 0;\n overflow: hidden;\n --ty-option-hidden-display: block;\n /* Never the pointer's target: a click opens the select either way, and\n WebKit leaves :hover stuck on the trigger when the hovered option moves\n to the list on open */\n pointer-events: none;\n}\n\n/* start/end slot content (icons etc.) \u2014 spacing comes from the stub's flex\n gap; muted like ty-input adornments. end sits before the chevron. */\n.select-stub ::slotted([slot=\"start\"]),\n.select-stub ::slotted([slot=\"end\"]) {\n flex-shrink: 0;\n color: var(--ty-text-soft);\n}\n\n/* Compact skin: the text IS the trigger label \u2014 no grow, regular text color.\n flex-basis: auto (not the field skin's 0%) \u2014 content-hugging needs its\n natural content width as the starting point; 0% would collapse it since\n grow is also 0 here (nothing left to expand it back out). */\n.select-stub.compact .dropdown-placeholder {\n flex: 0 1 auto;\n color: var(--ty-text);\n}\n\n/* Trigger stays visible while the popup is open (the popup hides it) */\n.dropdown-wrapper:has(.dropdown-chevron.open) .select-stub {\n opacity: 1;\n pointer-events: auto;\n}\n\n/* One-panel popup: search header fused with the options list */\n\n/* Single unified shadow around the whole panel (header + list as one silhouette) */\n.dropdown-dialog.open {\n filter: drop-shadow(0 12px 24px rgba(0, 0, 0, 0.14)) drop-shadow(0 2px 6px rgba(0, 0, 0, 0.08));\n}\n\n/* Card-style header: the search input keeps its own bordered-field look\n (base styles) and sits inset in the panel, TagPicker-style \u2014 no divider,\n whitespace separates it from the list. The header's OWN surface/border is\n part of the floating panel's chrome, not a form field \u2014 --ty-surface-\n floating/--ty-floating-border, matching .dropdown-options below it (same\n reasoning as the base-panel fix: --ty-input-* is deliberately faint for\n resting form fields and read as a missing/mismatched edge here). */\n.dropdown-header {\n background: var(--ty-surface-floating);\n border: 1px solid var(--ty-floating-border);\n border-bottom: none;\n border-radius: var(--ty-radius-lg) var(--ty-radius-lg) 0 0;\n padding: var(--ty-spacing-2) var(--ty-spacing-2) var(--ty-spacing-1);\n}\n.dropdown-dialog.position-below .dropdown-header {\n margin-bottom: 0;\n}\n.dropdown-dialog.position-above .dropdown-header {\n margin-top: 0;\n border-top: none;\n border-bottom: 1px solid var(--ty-floating-border);\n border-radius: 0 0 var(--ty-radius-lg) var(--ty-radius-lg);\n padding: var(--ty-spacing-1) var(--ty-spacing-2) var(--ty-spacing-2);\n}\n\n/* Magnifier adornment inside the search field (header padding + field inset) */\n.dropdown-search-icon {\n position: absolute;\n top: 50%;\n left: calc(var(--ty-spacing-2) + var(--ty-spacing-3));\n transform: translateY(-50%);\n width: 1rem;\n height: 1rem;\n color: var(--input-placeholder, var(--ty-input-placeholder));\n pointer-events: none;\n}\n.dropdown-search-icon svg {\n width: 100%;\n height: 100%;\n}\n\n/* Mobile header: flex row, icon flows inline before the input. Same 32x32\n footprint as .mobile-close-button (18px glyph centered in the box, not a\n bare 18px glyph flush at the edge) so the row has two matching bookends \u2014\n a bare icon on one side and a 32px circle on the other read as lopsided\n even with equal flex gap on both sides. Matching them also centers the\n search input's flex:1 fill symmetrically between the two. Fixed white +\n 18px glyph, same reasoning as .mobile-header-label \u2014 this sits on the\n dark ::backdrop blur in both themes, not a theme surface. */\n.dropdown-mode-mobile .mobile-header-content .dropdown-search-icon {\n position: static;\n transform: none;\n flex-shrink: 0;\n display: flex;\n align-items: center;\n justify-content: center;\n width: 32px;\n height: 32px;\n color: #ffffff;\n}\n.dropdown-mode-mobile .mobile-header-content .dropdown-search-icon svg {\n width: 18px;\n height: 18px;\n}\n\n/* Search input: bordered field from base styles; just size + icon room */\n.dropdown-search-input {\n min-height: 2.25rem;\n padding-right: var(--ty-spacing-2);\n /* room for the magnifier adornment */\n padding-left: calc(var(--ty-spacing-3) + 1rem + var(--ty-spacing-2));\n}\n/* Trigger already has a chevron - no second one inside the search row */\n.dropdown-search-chevron {\n display: none;\n}\n\n/* With the search row hidden nothing inside is focusable, so the <dialog>\n itself receives focus on open \u2014 suppress its UA focus ring */\n.dropdown-dialog:focus,\n.dropdown-dialog:focus-visible {\n outline: none;\n}\n\n/* Search row hidden ('auto' below threshold / searchable=\"false\"):\n the options panel owns the whole silhouette */\n.dropdown-header[hidden] {\n display: none;\n}\n.dropdown-header[hidden] ~ .dropdown-options-wrapper .dropdown-options {\n border-top: 1px solid var(--ty-floating-border);\n border-radius: var(--ty-radius-lg);\n}\n.mobile-search-input[hidden],\n.mobile-header-content .dropdown-search-icon[hidden] {\n display: none;\n}\n\n/* Options: vertical list rows fused under the search header.\n No own shadow/animation - the panel appears as one via dialog opacity. */\n.dropdown-options {\n flex-direction: column;\n flex-wrap: nowrap;\n align-items: stretch;\n gap: 0;\n /* Card-style list: rounded rows sit inset from the panel edges */\n padding: var(--ty-spacing-1);\n border-top: none;\n border-radius: 0 0 var(--ty-radius-lg) var(--ty-radius-lg);\n box-shadow: none;\n transform: none;\n transition: none;\n /* ~9-10 visible rows before scrolling (custom scrollbar, native hidden) */\n max-height: 24rem;\n}\n.dropdown-dialog.position-below .dropdown-options {\n box-shadow: none;\n}\n.dropdown-dialog.position-above .dropdown-options {\n border-top: 1px solid var(--ty-floating-border);\n border-bottom: none;\n border-radius: var(--ty-radius-lg) var(--ty-radius-lg) 0 0;\n}\n\n/* Loading panel continues the fused silhouette exactly like .dropdown-options \u2014\n the base layer styles it as a floating card (radius + shadow), which left a\n see-through gap under the search header while loading. */\n.dropdown-loading {\n border-top: none;\n border-radius: 0 0 var(--ty-radius-lg) var(--ty-radius-lg);\n box-shadow: none;\n}\n.dropdown-dialog.position-above .dropdown-loading {\n border-top: 1px solid var(--ty-floating-border);\n border-bottom: none;\n border-radius: var(--ty-radius-lg) var(--ty-radius-lg) 0 0;\n}\n\n/* Selection tick lives inside ty-option (lucide check on [selected]) */\n\n/* Mobile modal: same vertical list */\n.dropdown-mode-mobile .section-content ::slotted(ty-option) {\n display: block;\n width: 100%;\n}\n\n/* Options the author hid and options the search left out. Beats the display\n rule above, which beats the browser's own [hidden] { display: none }. */\n#options-slot::slotted([hidden]),\n#options-slot::slotted([filtered-out]) {\n display: none !important;\n}\n";
|
package/lib/styles/select.js
CHANGED
|
@@ -86,15 +86,22 @@ display: none;
|
|
|
86
86
|
.select-stub slot[name="selected"] {
|
|
87
87
|
display: none;
|
|
88
88
|
}
|
|
89
|
-
.select-stub.has-
|
|
89
|
+
.select-stub.has-option slot[name="selected"] {
|
|
90
90
|
display: block;
|
|
91
91
|
flex: 1 1 0%;
|
|
92
92
|
min-width: 0;
|
|
93
93
|
overflow: hidden;
|
|
94
94
|
}
|
|
95
|
-
.select-stub.compact.has-
|
|
95
|
+
.select-stub.compact.has-option slot[name="selected"] {
|
|
96
96
|
flex: 0 1 auto;
|
|
97
97
|
}
|
|
98
|
+
.select-stub ::slotted(ty-option) {
|
|
99
|
+
display: block;
|
|
100
|
+
min-width: 0;
|
|
101
|
+
overflow: hidden;
|
|
102
|
+
--ty-option-hidden-display: block;
|
|
103
|
+
pointer-events: none;
|
|
104
|
+
}
|
|
98
105
|
.select-stub ::slotted([slot="start"]),
|
|
99
106
|
.select-stub ::slotted([slot="end"]) {
|
|
100
107
|
flex-shrink: 0;
|
package/lib/styles/tag.js
CHANGED
|
@@ -57,12 +57,9 @@ border-color: var(--tag-border-color, var(--ty-border));
|
|
|
57
57
|
:host([no-pill]) .tag-container {
|
|
58
58
|
border-radius: var(--ty-radius-md);
|
|
59
59
|
}
|
|
60
|
-
:host([value]
|
|
60
|
+
:host([value]) .tag-container:not([aria-disabled="true"]) {
|
|
61
61
|
cursor: pointer;
|
|
62
62
|
}
|
|
63
|
-
:host([selected]) .tag-container:not([aria-disabled="true"]) {
|
|
64
|
-
cursor: initial;
|
|
65
|
-
}
|
|
66
63
|
.tag-container[tabindex]:not([aria-disabled="true"]):hover {
|
|
67
64
|
background: var(--ty-bg-neutral-soft);
|
|
68
65
|
transform: translateY(-1px);
|
package/lib/types/common.d.ts
CHANGED
|
@@ -80,8 +80,6 @@ export interface TyTagElement extends TyBaseElement {
|
|
|
80
80
|
value?: string;
|
|
81
81
|
/** Tag size */
|
|
82
82
|
size?: Size;
|
|
83
|
-
/** Selected state */
|
|
84
|
-
selected?: boolean;
|
|
85
83
|
/** Square corners instead of the default pill */
|
|
86
84
|
noPill?: boolean;
|
|
87
85
|
/** Clickable state */
|
|
@@ -95,8 +93,10 @@ export interface TyTagElement extends TyBaseElement {
|
|
|
95
93
|
export interface TyOptionElement extends Omit<HTMLElement, 'hidden'> {
|
|
96
94
|
/** Option value */
|
|
97
95
|
value?: string;
|
|
98
|
-
/**
|
|
96
|
+
/** The app's mark, read by ty-select only in `external-selection` mode */
|
|
99
97
|
selected?: boolean;
|
|
98
|
+
/** Set by the parent ty-select: draws the check and aria-selected */
|
|
99
|
+
checked?: boolean;
|
|
100
100
|
/** Disabled state */
|
|
101
101
|
disabled?: boolean;
|
|
102
102
|
/** Highlighted state (keyboard navigation) */
|
|
@@ -15,7 +15,6 @@ export interface PropertyConfig {
|
|
|
15
15
|
default?: any;
|
|
16
16
|
validate?: (value: any) => boolean;
|
|
17
17
|
coerce?: (value: any) => any;
|
|
18
|
-
aliases?: Record<string, any>;
|
|
19
18
|
}
|
|
20
19
|
/**
|
|
21
20
|
* Represents a property change
|
|
@@ -88,8 +87,4 @@ export declare class PropertyManager<T = any> {
|
|
|
88
87
|
* Check if a property should emit change events
|
|
89
88
|
*/
|
|
90
89
|
shouldEmitChange(name: string): boolean;
|
|
91
|
-
/**
|
|
92
|
-
* Handle property aliases (extra attribute names mapped to a fixed value)
|
|
93
|
-
*/
|
|
94
|
-
handleAlias(aliasName: string, value: any): PropertyChange | null;
|
|
95
90
|
}
|
|
@@ -125,15 +125,4 @@ return this._config[name]?.formValue ?? false;
|
|
|
125
125
|
shouldEmitChange(name) {
|
|
126
126
|
return this._config[name]?.emitChange ?? false;
|
|
127
127
|
}
|
|
128
|
-
handleAlias(aliasName, value) {
|
|
129
|
-
for (const [propName, config] of Object.entries(this._config)) {
|
|
130
|
-
if (config.aliases && aliasName in config.aliases) {
|
|
131
|
-
if (value === null)
|
|
132
|
-
return this.updateProperty(propName, defaultOf(config), 'attribute');
|
|
133
|
-
const aliasedValue = config.aliases[aliasName];
|
|
134
|
-
return this.updateProperty(propName, aliasedValue, 'attribute');
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
return null;
|
|
138
|
-
}
|
|
139
128
|
}
|
package/lib/version.d.ts
CHANGED
package/lib/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const VERSION = '1.0.0-
|
|
1
|
+
export const VERSION = '1.0.0-RC19';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tyrell-components",
|
|
3
|
-
"version": "1.0.0-
|
|
3
|
+
"version": "1.0.0-RC19",
|
|
4
4
|
"description": "Tyrell Components - Framework-agnostic web components with semantic design system",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": [
|
|
@@ -155,10 +155,11 @@
|
|
|
155
155
|
"scripts": {
|
|
156
156
|
"dev": "vite",
|
|
157
157
|
"generate:version": "node scripts/generate-version.js",
|
|
158
|
-
"build:lib": "npm run generate:version && tsc --project tsconfig.lib.json && tsc --project tsconfig.lib.dts.json && node scripts/strip-lib-comments.mjs",
|
|
159
|
-
"build:
|
|
160
|
-
"build:
|
|
161
|
-
"build:dev:
|
|
158
|
+
"build:lib": "npm run generate:version && npm run build:css && tsc --project tsconfig.lib.json && tsc --project tsconfig.lib.dts.json && node scripts/strip-lib-comments.mjs",
|
|
159
|
+
"build:css": "node scripts/build-css.mjs",
|
|
160
|
+
"build:cdn": "npm run generate:version && vite build --config vite.config.cdn.ts && npm run build:css",
|
|
161
|
+
"build:dev": "npm run generate:version && vite build --config vite.config.dev.ts && npm run build:css",
|
|
162
|
+
"build:dev:watch": "node scripts/build-css.mjs --watch & vite build --config vite.config.dev.ts --watch",
|
|
162
163
|
"build": "npm run build:lib && npm run build:cdn",
|
|
163
164
|
"prepublishOnly": "npm run build",
|
|
164
165
|
"preview": "vite preview",
|