tyrell-components 1.0.0-RC11 → 1.0.0-RC13

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.
Files changed (240) hide show
  1. package/README.md +1 -0
  2. package/css/tyrell-colors-static.css +316 -0
  3. package/css/tyrell-theme.css +1454 -0
  4. package/css/tyrell.css +112 -420
  5. package/dist/tyrell-colors-static.css +316 -0
  6. package/dist/tyrell-theme.css +1454 -0
  7. package/dist/tyrell.css +112 -420
  8. package/dist/tyrell.js +1 -1
  9. package/lib/base/ty-component.d.ts +7 -0
  10. package/lib/base/ty-component.d.ts.map +1 -1
  11. package/lib/base/ty-component.js +27 -0
  12. package/lib/base/ty-component.js.map +1 -1
  13. package/lib/components/button.d.ts +16 -1
  14. package/lib/components/button.d.ts.map +1 -1
  15. package/lib/components/button.js +34 -4
  16. package/lib/components/button.js.map +1 -1
  17. package/lib/components/calendar-month.d.ts +23 -0
  18. package/lib/components/calendar-month.d.ts.map +1 -1
  19. package/lib/components/calendar-month.js +168 -11
  20. package/lib/components/calendar-month.js.map +1 -1
  21. package/lib/components/calendar-navigation.d.ts +31 -5
  22. package/lib/components/calendar-navigation.d.ts.map +1 -1
  23. package/lib/components/calendar-navigation.js +71 -31
  24. package/lib/components/calendar-navigation.js.map +1 -1
  25. package/lib/components/calendar.d.ts +17 -2
  26. package/lib/components/calendar.d.ts.map +1 -1
  27. package/lib/components/calendar.js +83 -12
  28. package/lib/components/calendar.js.map +1 -1
  29. package/lib/components/checkbox.d.ts +14 -3
  30. package/lib/components/checkbox.d.ts.map +1 -1
  31. package/lib/components/checkbox.js +86 -57
  32. package/lib/components/checkbox.js.map +1 -1
  33. package/lib/components/copy.d.ts +14 -3
  34. package/lib/components/copy.d.ts.map +1 -1
  35. package/lib/components/copy.js +47 -25
  36. package/lib/components/copy.js.map +1 -1
  37. package/lib/components/date-picker.d.ts +26 -1
  38. package/lib/components/date-picker.d.ts.map +1 -1
  39. package/lib/components/date-picker.js +151 -32
  40. package/lib/components/date-picker.js.map +1 -1
  41. package/lib/components/input.d.ts +17 -2
  42. package/lib/components/input.d.ts.map +1 -1
  43. package/lib/components/input.js +104 -25
  44. package/lib/components/input.js.map +1 -1
  45. package/lib/components/modal.d.ts.map +1 -1
  46. package/lib/components/modal.js +28 -3
  47. package/lib/components/modal.js.map +1 -1
  48. package/lib/components/option.d.ts +0 -27
  49. package/lib/components/option.d.ts.map +1 -1
  50. package/lib/components/option.js +11 -102
  51. package/lib/components/option.js.map +1 -1
  52. package/lib/components/popup.d.ts.map +1 -1
  53. package/lib/components/popup.js +36 -2
  54. package/lib/components/popup.js.map +1 -1
  55. package/lib/components/radio.d.ts +6 -2
  56. package/lib/components/radio.d.ts.map +1 -1
  57. package/lib/components/radio.js +55 -13
  58. package/lib/components/radio.js.map +1 -1
  59. package/lib/components/scroll-container.d.ts +16 -0
  60. package/lib/components/scroll-container.d.ts.map +1 -1
  61. package/lib/components/scroll-container.js +105 -1
  62. package/lib/components/scroll-container.js.map +1 -1
  63. package/lib/components/select.d.ts +550 -0
  64. package/lib/components/select.d.ts.map +1 -0
  65. package/lib/components/select.js +2115 -0
  66. package/lib/components/select.js.map +1 -0
  67. package/lib/components/selected-tags.d.ts +93 -0
  68. package/lib/components/selected-tags.d.ts.map +1 -0
  69. package/lib/components/selected-tags.js +286 -0
  70. package/lib/components/selected-tags.js.map +1 -0
  71. package/lib/components/switch.d.ts +6 -3
  72. package/lib/components/switch.d.ts.map +1 -1
  73. package/lib/components/switch.js +54 -36
  74. package/lib/components/switch.js.map +1 -1
  75. package/lib/components/tabs.d.ts.map +1 -1
  76. package/lib/components/tabs.js +190 -25
  77. package/lib/components/tabs.js.map +1 -1
  78. package/lib/components/tag.d.ts +9 -1
  79. package/lib/components/tag.d.ts.map +1 -1
  80. package/lib/components/tag.js +41 -5
  81. package/lib/components/tag.js.map +1 -1
  82. package/lib/components/textarea.d.ts +3 -0
  83. package/lib/components/textarea.d.ts.map +1 -1
  84. package/lib/components/textarea.js +61 -6
  85. package/lib/components/textarea.js.map +1 -1
  86. package/lib/components/tooltip.d.ts +4 -2
  87. package/lib/components/tooltip.d.ts.map +1 -1
  88. package/lib/components/tooltip.js +109 -70
  89. package/lib/components/tooltip.js.map +1 -1
  90. package/lib/components/wizard.d.ts.map +1 -1
  91. package/lib/components/wizard.js +22 -3
  92. package/lib/components/wizard.js.map +1 -1
  93. package/lib/index.d.ts +3 -2
  94. package/lib/index.d.ts.map +1 -1
  95. package/lib/index.js +3 -2
  96. package/lib/index.js.map +1 -1
  97. package/lib/styles/button.d.ts +41 -6
  98. package/lib/styles/button.d.ts.map +1 -1
  99. package/lib/styles/button.js +294 -254
  100. package/lib/styles/button.js.map +1 -1
  101. package/lib/styles/calendar-month.d.ts +3 -1
  102. package/lib/styles/calendar-month.d.ts.map +1 -1
  103. package/lib/styles/calendar-month.js +100 -67
  104. package/lib/styles/calendar-month.js.map +1 -1
  105. package/lib/styles/calendar-navigation.d.ts +1 -1
  106. package/lib/styles/calendar-navigation.d.ts.map +1 -1
  107. package/lib/styles/calendar-navigation.js +20 -28
  108. package/lib/styles/calendar-navigation.js.map +1 -1
  109. package/lib/styles/checkbox.d.ts +7 -5
  110. package/lib/styles/checkbox.d.ts.map +1 -1
  111. package/lib/styles/checkbox.js +125 -8
  112. package/lib/styles/checkbox.js.map +1 -1
  113. package/lib/styles/copy.d.ts +3 -1
  114. package/lib/styles/copy.d.ts.map +1 -1
  115. package/lib/styles/copy.js +61 -6
  116. package/lib/styles/copy.js.map +1 -1
  117. package/lib/styles/custom-scrollbar.d.ts +1 -1
  118. package/lib/styles/custom-scrollbar.d.ts.map +1 -1
  119. package/lib/styles/custom-scrollbar.js +2 -2
  120. package/lib/styles/date-picker.d.ts +3 -1
  121. package/lib/styles/date-picker.d.ts.map +1 -1
  122. package/lib/styles/date-picker.js +65 -103
  123. package/lib/styles/date-picker.js.map +1 -1
  124. package/lib/styles/file-upload.d.ts +1 -1
  125. package/lib/styles/file-upload.d.ts.map +1 -1
  126. package/lib/styles/file-upload.js +3 -3
  127. package/lib/styles/input.d.ts +3 -1
  128. package/lib/styles/input.d.ts.map +1 -1
  129. package/lib/styles/input.js +93 -419
  130. package/lib/styles/input.js.map +1 -1
  131. package/lib/styles/multiselect.d.ts +3 -1
  132. package/lib/styles/multiselect.d.ts.map +1 -1
  133. package/lib/styles/multiselect.js +26 -2
  134. package/lib/styles/multiselect.js.map +1 -1
  135. package/lib/styles/option.d.ts +1 -1
  136. package/lib/styles/option.d.ts.map +1 -1
  137. package/lib/styles/option.js +20 -47
  138. package/lib/styles/option.js.map +1 -1
  139. package/lib/styles/radio.d.ts +3 -1
  140. package/lib/styles/radio.d.ts.map +1 -1
  141. package/lib/styles/radio.js +24 -21
  142. package/lib/styles/radio.js.map +1 -1
  143. package/lib/styles/scroll-container.d.ts +1 -1
  144. package/lib/styles/scroll-container.d.ts.map +1 -1
  145. package/lib/styles/scroll-container.js +6 -0
  146. package/lib/styles/scroll-container.js.map +1 -1
  147. package/lib/styles/select-base.d.ts +9 -0
  148. package/lib/styles/select-base.d.ts.map +1 -0
  149. package/lib/styles/select-base.js +973 -0
  150. package/lib/styles/select-base.js.map +1 -0
  151. package/lib/styles/select.d.ts +12 -0
  152. package/lib/styles/select.d.ts.map +1 -0
  153. package/lib/styles/select.js +308 -0
  154. package/lib/styles/select.js.map +1 -0
  155. package/lib/styles/step.d.ts +1 -1
  156. package/lib/styles/step.d.ts.map +1 -1
  157. package/lib/styles/switch.d.ts +3 -1
  158. package/lib/styles/switch.d.ts.map +1 -1
  159. package/lib/styles/switch.js +25 -10
  160. package/lib/styles/switch.js.map +1 -1
  161. package/lib/styles/tab.d.ts +1 -1
  162. package/lib/styles/tab.d.ts.map +1 -1
  163. package/lib/styles/tabs.d.ts +1 -1
  164. package/lib/styles/tabs.d.ts.map +1 -1
  165. package/lib/styles/tabs.js +71 -1
  166. package/lib/styles/tabs.js.map +1 -1
  167. package/lib/styles/tag.d.ts +1 -1
  168. package/lib/styles/tag.d.ts.map +1 -1
  169. package/lib/styles/tag.js +40 -141
  170. package/lib/styles/tag.js.map +1 -1
  171. package/lib/styles/textarea.d.ts +1 -1
  172. package/lib/styles/textarea.d.ts.map +1 -1
  173. package/lib/styles/textarea.js +71 -37
  174. package/lib/styles/textarea.js.map +1 -1
  175. package/lib/styles/tooltip.d.ts +4 -2
  176. package/lib/styles/tooltip.d.ts.map +1 -1
  177. package/lib/styles/tooltip.js +4 -119
  178. package/lib/styles/tooltip.js.map +1 -1
  179. package/lib/styles/wizard.d.ts +1 -1
  180. package/lib/styles/wizard.d.ts.map +1 -1
  181. package/lib/styles/wizard.js +18 -6
  182. package/lib/styles/wizard.js.map +1 -1
  183. package/lib/types/common.d.ts +2 -1
  184. package/lib/types/common.d.ts.map +1 -1
  185. package/lib/types/common.js +15 -1
  186. package/lib/types/common.js.map +1 -1
  187. package/lib/utils/calendar-utils.d.ts +0 -48
  188. package/lib/utils/calendar-utils.d.ts.map +1 -1
  189. package/lib/utils/calendar-utils.js +0 -69
  190. package/lib/utils/calendar-utils.js.map +1 -1
  191. package/lib/utils/flavor-sheet.d.ts +32 -0
  192. package/lib/utils/flavor-sheet.d.ts.map +1 -0
  193. package/lib/utils/flavor-sheet.js +40 -0
  194. package/lib/utils/flavor-sheet.js.map +1 -0
  195. package/lib/utils/icon-registry.d.ts +0 -13
  196. package/lib/utils/icon-registry.d.ts.map +1 -1
  197. package/lib/utils/icon-registry.js +0 -35
  198. package/lib/utils/icon-registry.js.map +1 -1
  199. package/lib/utils/icons.d.ts +10 -0
  200. package/lib/utils/icons.d.ts.map +1 -0
  201. package/lib/utils/icons.js +10 -0
  202. package/lib/utils/icons.js.map +1 -0
  203. package/lib/utils/loader-registry.d.ts +2 -2
  204. package/lib/utils/loader-registry.js +2 -2
  205. package/lib/utils/locale.d.ts +0 -57
  206. package/lib/utils/locale.d.ts.map +1 -1
  207. package/lib/utils/locale.js +0 -89
  208. package/lib/utils/locale.js.map +1 -1
  209. package/lib/utils/number-format.d.ts +0 -21
  210. package/lib/utils/number-format.d.ts.map +1 -1
  211. package/lib/utils/number-format.js +0 -27
  212. package/lib/utils/number-format.js.map +1 -1
  213. package/lib/utils/positioning.d.ts +29 -22
  214. package/lib/utils/positioning.d.ts.map +1 -1
  215. package/lib/utils/positioning.js +23 -87
  216. package/lib/utils/positioning.js.map +1 -1
  217. package/lib/utils/scroll-lock.d.ts.map +1 -1
  218. package/lib/utils/scroll-lock.js +0 -1
  219. package/lib/utils/scroll-lock.js.map +1 -1
  220. package/lib/utils/styles.d.ts +0 -5
  221. package/lib/utils/styles.d.ts.map +1 -1
  222. package/lib/utils/styles.js +0 -7
  223. package/lib/utils/styles.js.map +1 -1
  224. package/lib/version.d.ts +1 -1
  225. package/lib/version.js +1 -1
  226. package/package.json +22 -11
  227. package/css/tyrell-brand.css +0 -913
  228. package/dist/tyrell-brand.css +0 -913
  229. package/lib/components/dropdown.d.ts +0 -424
  230. package/lib/components/dropdown.d.ts.map +0 -1
  231. package/lib/components/dropdown.js +0 -1640
  232. package/lib/components/dropdown.js.map +0 -1
  233. package/lib/components/multiselect.d.ts +0 -397
  234. package/lib/components/multiselect.d.ts.map +0 -1
  235. package/lib/components/multiselect.js +0 -1595
  236. package/lib/components/multiselect.js.map +0 -1
  237. package/lib/styles/dropdown.d.ts +0 -12
  238. package/lib/styles/dropdown.d.ts.map +0 -1
  239. package/lib/styles/dropdown.js +0 -1081
  240. package/lib/styles/dropdown.js.map +0 -1
@@ -0,0 +1,550 @@
1
+ /**
2
+ * TySelect Web Component
3
+ *
4
+ * The select control — replaces ty-dropdown and ty-multiselect.
5
+ *
6
+ * Cardinality (native <select> semantics):
7
+ * - default: SINGLE select — scalar value, picking an option closes the popup
8
+ * - `multiple`: multi select — comma value / repeated FormData entries,
9
+ * options toggle and the popup stays open
10
+ *
11
+ * Skins:
12
+ * - default: form FIELD — full width, --ty-input-* tokens, matches ty-input;
13
+ * shows the selected label(s) inline
14
+ * - `compact`: content-hugging trigger for toolbars/filter bars; single shows
15
+ * the selected label, multiple shows placeholder + count badge (pair with
16
+ * <ty-selected-options>)
17
+ * - slot="trigger": consumer skin — replaces field/compact chrome entirely,
18
+ * behavior/ARIA/form participation unchanged
19
+ *
20
+ * - ty-option children (ty-tag also accepted)
21
+ * - Desktop popup with smart positioning, mobile full-screen modal
22
+ * - Search / external-search / debounce, keyboard navigation
23
+ * - Form association: single submits one entry, multiple submits repeated
24
+ * `name=` entries (HTMX-ready)
25
+ * - change event detail: { value, values, items: [{value, label, flavor}], action, item }
26
+ * (`value` is a scalar for single, array for multiple)
27
+ *
28
+ * @example
29
+ * ```html
30
+ * <!-- Single select, field skin -->
31
+ * <ty-select label="Robot" name="robot">
32
+ * <ty-option value="bobo">Bobo Robot</ty-option>
33
+ * <ty-option value="eywa">EYWA Dataset Example</ty-option>
34
+ * </ty-select>
35
+ *
36
+ * <!-- Multi select, compact skin + out-of-band chips -->
37
+ * <ty-select multiple compact label="Robots" name="robots" id="robots">...</ty-select>
38
+ * <ty-selected-options for="robots"></ty-selected-options>
39
+ * ```
40
+ */
41
+ import type { Flavor, Size } from "../types/common.js";
42
+ import { TyComponent } from "../base/ty-component.js";
43
+ import type { PropertyChange } from "../utils/property-manager.js";
44
+ /**
45
+ * Tag data structure
46
+ */
47
+ interface TagData {
48
+ value: string;
49
+ text: string;
50
+ element: HTMLElement;
51
+ }
52
+ /**
53
+ * Component state structure
54
+ */
55
+ interface SelectState {
56
+ open: boolean;
57
+ search: string;
58
+ highlightedIndex: number;
59
+ filteredTags: TagData[];
60
+ selectedValues: string[];
61
+ mode: "desktop" | "mobile";
62
+ }
63
+ /**
64
+ * Ty Select Component
65
+ */
66
+ export declare class TySelect extends TyComponent<SelectState> {
67
+ protected static properties: {
68
+ value: {
69
+ type: "string";
70
+ visual: boolean;
71
+ formValue: boolean;
72
+ emitChange: boolean;
73
+ default: string;
74
+ coerce: (v: any) => string;
75
+ };
76
+ name: {
77
+ type: "string";
78
+ default: string;
79
+ };
80
+ multiple: {
81
+ type: "boolean";
82
+ visual: boolean;
83
+ default: boolean;
84
+ };
85
+ compact: {
86
+ type: "boolean";
87
+ visual: boolean;
88
+ default: boolean;
89
+ };
90
+ placeholder: {
91
+ type: "string";
92
+ visual: boolean;
93
+ default: string;
94
+ };
95
+ label: {
96
+ type: "string";
97
+ visual: boolean;
98
+ default: string;
99
+ };
100
+ disabled: {
101
+ type: "boolean";
102
+ visual: boolean;
103
+ default: boolean;
104
+ };
105
+ readonly: {
106
+ type: "boolean";
107
+ visual: boolean;
108
+ default: boolean;
109
+ };
110
+ required: {
111
+ type: "boolean";
112
+ visual: boolean;
113
+ default: boolean;
114
+ };
115
+ clearable: {
116
+ type: "boolean";
117
+ visual: boolean;
118
+ default: boolean;
119
+ aliases: {
120
+ "not-clearable": boolean;
121
+ };
122
+ };
123
+ externalSearch: {
124
+ type: "boolean";
125
+ visual: boolean;
126
+ default: boolean;
127
+ aliases: {
128
+ "external-search": boolean;
129
+ };
130
+ };
131
+ allowCreate: {
132
+ type: "boolean";
133
+ visual: boolean;
134
+ default: boolean;
135
+ aliases: {
136
+ "allow-create": boolean;
137
+ };
138
+ };
139
+ createTransform: {
140
+ type: "string";
141
+ visual: boolean;
142
+ default: string;
143
+ aliases: {
144
+ "create-transform": boolean;
145
+ };
146
+ coerce: (v: any) => "none" | "slug";
147
+ };
148
+ searchable: {
149
+ type: "string";
150
+ visual: boolean;
151
+ default: string;
152
+ coerce: (v: any) => "auto" | "always" | "never";
153
+ };
154
+ align: {
155
+ type: "string";
156
+ visual: boolean;
157
+ default: string;
158
+ validate: (v: any) => boolean;
159
+ coerce: (v: any) => "start" | "end";
160
+ };
161
+ size: {
162
+ type: "string";
163
+ visual: boolean;
164
+ default: string;
165
+ validate: (v: any) => boolean;
166
+ coerce: (v: any) => any;
167
+ };
168
+ debounce: {
169
+ type: "number";
170
+ default: number;
171
+ validate: (v: any) => boolean;
172
+ coerce: (v: any) => number;
173
+ };
174
+ "available-label": {
175
+ type: "string";
176
+ visual: boolean;
177
+ default: string;
178
+ };
179
+ "no-options-message": {
180
+ type: "string";
181
+ visual: boolean;
182
+ default: string;
183
+ };
184
+ loading: {
185
+ type: "boolean";
186
+ visual: boolean;
187
+ default: boolean;
188
+ };
189
+ flavor: {
190
+ type: "string";
191
+ visual: boolean;
192
+ default: string;
193
+ };
194
+ };
195
+ private _name;
196
+ private _multiple;
197
+ private _compact;
198
+ private _placeholder;
199
+ private _label;
200
+ private _disabled;
201
+ private _readonly;
202
+ private _required;
203
+ private _clearable;
204
+ private _externalSearch;
205
+ private _allowCreate;
206
+ private _createTransform;
207
+ private _searchable;
208
+ private _loading;
209
+ private _scrollLockId;
210
+ private _size;
211
+ private _availableLabel;
212
+ private _noOptionsMessage;
213
+ private _state;
214
+ private _stubClickHandler;
215
+ private _tagClickHandler;
216
+ private _searchInputHandler;
217
+ private _blockSearchClick;
218
+ private _keyboardHandler;
219
+ private _debounce;
220
+ private _searchDebounceTimer;
221
+ private _optionsScrollbar;
222
+ private _childObserver;
223
+ private _selectedClone;
224
+ private _customFlavorSheet;
225
+ constructor();
226
+ /**
227
+ * Called when component is connected to DOM
228
+ * TyComponent handles property capture automatically
229
+ */
230
+ protected onConnect(): void;
231
+ /** Custom (non-built-in) flavors — see utils/flavor-sheet.ts. */
232
+ private _syncCustomFlavor;
233
+ /**
234
+ * Called when component is disconnected from DOM
235
+ * Clean up event listeners and timers
236
+ */
237
+ protected onDisconnect(): void;
238
+ /**
239
+ * Called when properties change
240
+ * Handle state synchronization BEFORE render
241
+ */
242
+ protected onPropertiesChanged(changes: PropertyChange[]): void;
243
+ /**
244
+ * Toggle the loading visual state on the open popup.
245
+ * Replaces the available-options area with a centered spinner; search input stays usable.
246
+ * Pulls the latest registered loader SVG on each call so registry changes
247
+ * take effect on the next loading toggle.
248
+ */
249
+ private applyLoadingState;
250
+ /**
251
+ * Get the form value for this component
252
+ * Returns FormData with multiple entries (HTMX standard)
253
+ */
254
+ protected getFormValue(): FormDataEntryValue | FormData | null;
255
+ /**
256
+ * Parse select value (comma-separated string to array)
257
+ */
258
+ private parseValue;
259
+ /**
260
+ * Initialize component state from attributes
261
+ * Reads from both property and attribute (like ClojureScript version)
262
+ */
263
+ private initializeState;
264
+ /**
265
+ * Get all option elements from the component (ty-option preferred, ty-tag accepted)
266
+ */
267
+ private getTagElements;
268
+ /**
269
+ * Extract value and text from a ty-tag element
270
+ */
271
+ private getTagData;
272
+ /**
273
+ * Select an option - attribute only. The option stays in the list with
274
+ * selected styling; chips are rendered out-of-band (ty-selected-options).
275
+ */
276
+ private selectTag;
277
+ /**
278
+ * Deselect an option - attribute only.
279
+ */
280
+ private deselectTag;
281
+ /**
282
+ * Get array of currently selected values from tags (ALWAYS reads from DOM)
283
+ */
284
+ private getSelectedValues;
285
+ /**
286
+ * Sync tag selection states with desired values
287
+ */
288
+ private syncSelectedTags;
289
+ /**
290
+ * role="option" for every current option/tag — separate from
291
+ * syncSelectedTags (which only runs when the `value` property changes)
292
+ * so it also covers the "nothing selected yet, value never touched"
293
+ * startup case. Idempotent; cheap to call from the child MutationObserver
294
+ * on every light-DOM change.
295
+ */
296
+ private ensureOptionRoles;
297
+ /**
298
+ * Central update function - synchronizes everything
299
+ * Uses TyComponent's property system for proper lifecycle
300
+ */
301
+ private updateComponentValue;
302
+ /**
303
+ * Build rich item info for values, read off the matching option elements
304
+ */
305
+ private getSelectedItems;
306
+ /**
307
+ * Calculate and set dropdown position with smart direction detection
308
+ */
309
+ private calculatePosition;
310
+ private _setupOptionsScrollbar;
311
+ private _destroyOptionsScrollbar;
312
+ /**
313
+ * Open dropdown dialog (desktop mode)
314
+ *
315
+ * `<dialog>.showModal()` puts the dialog in the top layer with a backdrop, but
316
+ * does NOT prevent the page behind it from scrolling. We use the shared scroll
317
+ * lock utility (overflow:hidden on <html>) to keep wheel/touch scrolling from
318
+ * leaking through to the body — same behavior <ty-dropdown> and <ty-modal>
319
+ * implement.
320
+ */
321
+ private openDropdown;
322
+ /**
323
+ * Close dropdown dialog (desktop mode)
324
+ */
325
+ private closeDropdown;
326
+ /**
327
+ * Open mobile modal (mobile mode)
328
+ * Now using <dialog> element for native z-index management
329
+ */
330
+ private openMobileModal;
331
+ /**
332
+ * Close mobile modal (mobile mode)
333
+ * Now using <dialog> element for native management
334
+ */
335
+ private closeMobileModal;
336
+ private handleStubClick;
337
+ /**
338
+ * .select-clear click — must stop propagation before it bubbles to the
339
+ * stub's own click handler (which would otherwise also open the dropdown).
340
+ */
341
+ private handleClearClick;
342
+ /**
343
+ * Keyboard-open the (closed) stub. The stub is a plain div with
344
+ * tabindex="0", not a native <button> — Enter/Space don't turn into
345
+ * click events on their own the way they do for real form controls, and
346
+ * without this a keyboard-only user could Tab to the field but never
347
+ * open it. document-level handleKeyboard() only runs once already open
348
+ * (it early-returns on !this._state.open), so this is the other half.
349
+ */
350
+ private handleStubKeydown;
351
+ private handleTagClick;
352
+ /**
353
+ * Select/toggle a tag by element — the part of handleTagClick that has no
354
+ * dependency on a real DOM event, so keyboard/programmatic callers (Enter
355
+ * on a highlighted option, allow-create's exact-match dedup) can call it
356
+ * directly instead of faking an Event object just to satisfy
357
+ * preventDefault()/stopPropagation().
358
+ */
359
+ private selectByTag;
360
+ /**
361
+ * allow-create: Enter with unmatched search text mints a new option.
362
+ * Returns true if it handled the key (created, or selected an existing
363
+ * exact match instead of duplicating) — false if there's nothing to do
364
+ * (blank query, or allow-create is off), so the caller's normal Enter
365
+ * handling (select highlighted, or no-op) proceeds.
366
+ */
367
+ private tryCreateFromSearch;
368
+ /**
369
+ * Multiple + allow-create: clear the search box and re-show the full
370
+ * (now-longer) option list so the next tag can be typed immediately —
371
+ * the tags-input pattern.
372
+ */
373
+ private clearSearchAfterCreate;
374
+ private blockSearchClick;
375
+ private handleSearchInput;
376
+ private handleKeyboard;
377
+ /**
378
+ * Filter tags based on search query
379
+ */
380
+ private filterTags;
381
+ /**
382
+ * Update visibility of tags based on filtered list
383
+ */
384
+ private updateTagVisibility;
385
+ /**
386
+ * Show/hide the dropdown options area
387
+ */
388
+ private updateOptionsVisibility;
389
+ /**
390
+ * Clear all tag highlights
391
+ */
392
+ private clearHighlights;
393
+ /**
394
+ * Highlight tag at specific index
395
+ */
396
+ private highlightTag;
397
+ /**
398
+ * Dispatch search event for external search handling
399
+ * With optional debounce support
400
+ */
401
+ private dispatchSearchEvent;
402
+ /**
403
+ * Fire the actual search event
404
+ */
405
+ private fireSearchEvent;
406
+ /**
407
+ * Dispatch lifecycle events for popup open/close.
408
+ * On open with external-search, also fire a `search` event with an empty
409
+ * query so consumers have a clean hook to reset/refetch the option list.
410
+ */
411
+ private fireOpenEvent;
412
+ private fireCloseEvent;
413
+ /**
414
+ * Dispatch custom change event
415
+ */
416
+ private dispatchChangeEvent;
417
+ /**
418
+ * Main render method (required by TyComponent)
419
+ * Delegates to mode-specific renderer
420
+ */
421
+ protected render(): void;
422
+ /**
423
+ * Reflect constraint validation to the owning <form> via ElementInternals.
424
+ * Without this `required` is only cosmetic — form.checkValidity() (and a
425
+ * real submit) never actually blocks on an empty required select. Mirrors
426
+ * ty-input's updateValidity(): empty + required => valueMissing; disabled
427
+ * fields are barred from constraint validation.
428
+ */
429
+ private updateValidity;
430
+ /**
431
+ * When a consumer slots their own trigger (slot="trigger"), strip the
432
+ * default field chrome so the trigger is styled entirely by the consumer.
433
+ */
434
+ private setupTriggerSlot;
435
+ /**
436
+ * Setup event listeners
437
+ */
438
+ private setupEventListeners;
439
+ /**
440
+ * Build CSS class list for stub
441
+ */
442
+ private buildStubClasses;
443
+ /**
444
+ * Render desktop mode with dialog
445
+ */
446
+ private renderDesktop;
447
+ /**
448
+ * Render mobile mode with full-screen modal
449
+ * Following dropdown.ts mobile structure
450
+ */
451
+ private renderMobile;
452
+ /**
453
+ * Setup event listeners for mobile mode
454
+ * Using <dialog> element - backdrop clicks handled natively
455
+ */
456
+ private setupMobileEventListeners;
457
+ /**
458
+ * Handle mobile stub click - open modal
459
+ */
460
+ private handleMobileStubClick;
461
+ /** Keyboard-open the (closed) mobile stub — see handleStubKeydown for why this is needed. */
462
+ private handleMobileStubKeydown;
463
+ /**
464
+ * Handle mobile tag click - select and potentially close
465
+ */
466
+ private handleMobileTagClick;
467
+ /**
468
+ * Update mobile options section state (count, empty state)
469
+ */
470
+ private updateMobileSelectedState;
471
+ /**
472
+ * Update selection display: count badge next to the placeholder
473
+ */
474
+ /**
475
+ * Should the popup show a search row? external-search always (the input is
476
+ * the mechanism); searchable always/never wins otherwise; 'auto' shows it
477
+ * only when the option list is long enough to need filtering.
478
+ */
479
+ private shouldShowSearch;
480
+ /**
481
+ * Toggle the search row (desktop header / mobile input) per shouldShowSearch.
482
+ */
483
+ private updateSearchVisibility;
484
+ /**
485
+ * Selection summary appropriate to cardinality × skin:
486
+ * - single (field or compact): the selected OPTION itself — cloned into
487
+ * slot="selected" so rich HTML options display intact (dropdown parity);
488
+ * placeholder when empty
489
+ * - multiple + field: joined labels (ellipsis via CSS), or placeholder
490
+ * - multiple + compact: placeholder + count badge
491
+ */
492
+ private updateSelectionDisplay;
493
+ /**
494
+ * Keep exactly one display clone (slot="selected", marked `cloned`) in our
495
+ * light DOM matching the given value — or none. The clone never counts as
496
+ * an option (getTagElements filters [cloned]) and ty-option's own
497
+ * :host([cloned]) styling strips its list-row chrome.
498
+ */
499
+ private syncSelectedClone;
500
+ /**
501
+ * Deselect a value programmatically WITH a change event.
502
+ * Used by out-of-band chip displays (ty-selected-options) so dismissing a chip
503
+ * fires change like any in-popup interaction (HTMX hx-trigger="change" etc.).
504
+ */
505
+ deselectValue(value: string): void;
506
+ /**
507
+ * Clear the entire selection programmatically WITH a change event
508
+ * (action: 'clear'). No-op if nothing is selected. Exists so slot="trigger"
509
+ * consumers (custom chrome, built-in clear UI hidden by design) can wire
510
+ * their own clear icon's click handler to it.
511
+ */
512
+ clear(): void;
513
+ get value(): string;
514
+ set value(val: string);
515
+ get name(): string;
516
+ set name(val: string);
517
+ get multiple(): boolean;
518
+ set multiple(value: boolean);
519
+ get compact(): boolean;
520
+ set compact(value: boolean);
521
+ get placeholder(): string;
522
+ set placeholder(val: string);
523
+ get label(): string;
524
+ set label(val: string);
525
+ get disabled(): boolean;
526
+ set disabled(value: boolean);
527
+ get loading(): boolean;
528
+ set loading(value: boolean);
529
+ get readonly(): boolean;
530
+ set readonly(value: boolean);
531
+ get clearable(): boolean;
532
+ set clearable(value: boolean);
533
+ get required(): boolean;
534
+ set required(value: boolean);
535
+ get searchable(): "auto" | "always" | "never";
536
+ set searchable(value: "auto" | "always" | "never" | boolean);
537
+ get externalSearch(): boolean;
538
+ set externalSearch(value: boolean);
539
+ get debounce(): number;
540
+ set debounce(value: number | string);
541
+ get size(): Size;
542
+ set size(value: Size);
543
+ get align(): "start" | "end";
544
+ set align(value: "start" | "end");
545
+ get flavor(): Flavor;
546
+ set flavor(value: Flavor);
547
+ get form(): HTMLFormElement | null;
548
+ }
549
+ export {};
550
+ //# sourceMappingURL=select.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"select.d.ts","sourceRoot":"","sources":["../../src/components/select.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AASvD,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AACtD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAsFnE;;GAEG;AACH,UAAU,OAAO;IACf,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,WAAW,CAAC;CACtB;AAED;;GAEG;AACH,UAAU,WAAW;IACnB,IAAI,EAAE,OAAO,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,gBAAgB,EAAE,MAAM,CAAC;IACzB,YAAY,EAAE,OAAO,EAAE,CAAC;IACxB,cAAc,EAAE,MAAM,EAAE,CAAC;IACzB,IA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