tyrell-components 1.0.0-RC13 → 1.0.0-RC15

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 (358) hide show
  1. package/README.md +10 -2
  2. package/css/tyrell-theme.css +192 -180
  3. package/css/tyrell.css +23 -0
  4. package/dist/tyrell-colors-static.css +1 -316
  5. package/dist/tyrell-theme.css +1 -1454
  6. package/dist/tyrell.css +1 -1371
  7. package/dist/tyrell.js +1 -1
  8. package/lib/base/ty-component.d.ts +20 -10
  9. package/lib/base/ty-component.js +196 -319
  10. package/lib/components/button.d.ts +3 -17
  11. package/lib/components/button.js +261 -295
  12. package/lib/components/calendar-month.d.ts +4 -50
  13. package/lib/components/calendar-month.js +443 -582
  14. package/lib/components/calendar-navigation.d.ts +3 -48
  15. package/lib/components/calendar-navigation.js +239 -362
  16. package/lib/components/calendar.d.ts +8 -83
  17. package/lib/components/calendar.js +616 -829
  18. package/lib/components/checkbox.d.ts +5 -72
  19. package/lib/components/checkbox.js +273 -416
  20. package/lib/components/copy.d.ts +4 -57
  21. package/lib/components/copy.js +280 -397
  22. package/lib/components/date-picker.d.ts +21 -163
  23. package/lib/components/date-picker.js +1143 -1674
  24. package/lib/components/file-upload.d.ts +9 -15
  25. package/lib/components/file-upload.js +404 -426
  26. package/lib/components/icon.d.ts +3 -24
  27. package/lib/components/icon.js +141 -230
  28. package/lib/components/input.d.ts +8 -108
  29. package/lib/components/input.js +593 -784
  30. package/lib/components/modal.d.ts +17 -26
  31. package/lib/components/modal.js +340 -484
  32. package/lib/components/option.d.ts +2 -9
  33. package/lib/components/option.js +168 -216
  34. package/lib/components/popup.d.ts +2 -17
  35. package/lib/components/popup.js +249 -380
  36. package/lib/components/radio.d.ts +5 -25
  37. package/lib/components/radio.js +407 -461
  38. package/lib/components/resize-observer.d.ts +3 -30
  39. package/lib/components/resize-observer.js +69 -103
  40. package/lib/components/scroll-container.d.ts +2 -12
  41. package/lib/components/scroll-container.js +293 -338
  42. package/lib/components/select.d.ts +87 -159
  43. package/lib/components/select.js +1609 -2090
  44. package/lib/components/selected-tags.d.ts +5 -48
  45. package/lib/components/selected-tags.js +188 -276
  46. package/lib/components/step.d.ts +1 -6
  47. package/lib/components/step.js +62 -68
  48. package/lib/components/switch.d.ts +1 -12
  49. package/lib/components/switch.js +214 -247
  50. package/lib/components/tab.d.ts +1 -6
  51. package/lib/components/tab.js +62 -69
  52. package/lib/components/tabs.d.ts +6 -63
  53. package/lib/components/tabs.js +545 -777
  54. package/lib/components/tag.d.ts +3 -37
  55. package/lib/components/tag.js +236 -335
  56. package/lib/components/textarea.d.ts +7 -87
  57. package/lib/components/textarea.js +457 -627
  58. package/lib/components/tooltip.d.ts +3 -11
  59. package/lib/components/tooltip.js +307 -443
  60. package/lib/components/wizard.d.ts +6 -54
  61. package/lib/components/wizard.js +405 -618
  62. package/lib/icons/fontawesome/brands.d.ts +0 -1
  63. package/lib/icons/fontawesome/brands.js +0 -8
  64. package/lib/icons/fontawesome/regular.d.ts +0 -1
  65. package/lib/icons/fontawesome/regular.js +0 -8
  66. package/lib/icons/fontawesome/solid.d.ts +0 -1
  67. package/lib/icons/fontawesome/solid.js +0 -8
  68. package/lib/icons/heroicons/micro.d.ts +0 -1
  69. package/lib/icons/heroicons/micro.js +392 -400
  70. package/lib/icons/heroicons/mini.d.ts +0 -1
  71. package/lib/icons/heroicons/mini.js +382 -390
  72. package/lib/icons/heroicons/outline.d.ts +0 -1
  73. package/lib/icons/heroicons/outline.js +337 -345
  74. package/lib/icons/heroicons/solid.d.ts +0 -1
  75. package/lib/icons/heroicons/solid.js +407 -415
  76. package/lib/icons/lucide.d.ts +0 -1
  77. package/lib/icons/lucide.js +24479 -26351
  78. package/lib/icons/material/filled.d.ts +0 -1
  79. package/lib/icons/material/filled.js +9653 -9663
  80. package/lib/icons/material/outlined.d.ts +0 -1
  81. package/lib/icons/material/outlined.js +10271 -10281
  82. package/lib/icons/material/round.d.ts +0 -1
  83. package/lib/icons/material/round.js +10495 -10505
  84. package/lib/icons/material/sharp.d.ts +0 -1
  85. package/lib/icons/material/sharp.js +9905 -9915
  86. package/lib/icons/material/two-tone.d.ts +0 -1
  87. package/lib/icons/material/two-tone.js +12792 -12802
  88. package/lib/index.d.ts +0 -1
  89. package/lib/index.js +21 -41
  90. package/lib/styles/button.d.ts +2 -20
  91. package/lib/styles/button.js +202 -404
  92. package/lib/styles/calendar-month.d.ts +1 -5
  93. package/lib/styles/calendar-month.js +127 -244
  94. package/lib/styles/calendar-navigation.d.ts +2 -6
  95. package/lib/styles/calendar-navigation.js +64 -104
  96. package/lib/styles/calendar.d.ts +1 -2
  97. package/lib/styles/calendar.js +9 -22
  98. package/lib/styles/checkbox.d.ts +0 -1
  99. package/lib/styles/checkbox.js +45 -94
  100. package/lib/styles/copy.d.ts +0 -1
  101. package/lib/styles/copy.js +67 -106
  102. package/lib/styles/custom-scrollbar.d.ts +1 -2
  103. package/lib/styles/custom-scrollbar.js +80 -115
  104. package/lib/styles/date-picker.d.ts +1 -5
  105. package/lib/styles/date-picker.js +261 -335
  106. package/lib/styles/field-size.d.ts +6 -0
  107. package/lib/styles/field-size.js +91 -0
  108. package/lib/styles/file-upload.d.ts +1 -2
  109. package/lib/styles/file-upload.js +143 -188
  110. package/lib/styles/icon.d.ts +2 -6
  111. package/lib/styles/icon.js +92 -170
  112. package/lib/styles/input.d.ts +1 -6
  113. package/lib/styles/input.js +125 -290
  114. package/lib/styles/modal.d.ts +1 -2
  115. package/lib/styles/modal.js +71 -108
  116. package/lib/styles/option.d.ts +2 -6
  117. package/lib/styles/option.js +49 -64
  118. package/lib/styles/popup.d.ts +1 -2
  119. package/lib/styles/popup.js +42 -77
  120. package/lib/styles/radio.d.ts +0 -1
  121. package/lib/styles/radio.js +69 -110
  122. package/lib/styles/resize-observer.d.ts +1 -2
  123. package/lib/styles/resize-observer.js +2 -12
  124. package/lib/styles/scroll-container.d.ts +1 -2
  125. package/lib/styles/scroll-container.js +100 -149
  126. package/lib/styles/select-base.d.ts +0 -1
  127. package/lib/styles/select-base.js +597 -785
  128. package/lib/styles/select.d.ts +1 -2
  129. package/lib/styles/select.js +140 -236
  130. package/lib/styles/step.d.ts +1 -2
  131. package/lib/styles/step.js +22 -33
  132. package/lib/styles/switch.d.ts +0 -1
  133. package/lib/styles/switch.js +34 -73
  134. package/lib/styles/tab.d.ts +1 -2
  135. package/lib/styles/tab.js +22 -34
  136. package/lib/styles/tabs.d.ts +3 -11
  137. package/lib/styles/tabs.js +190 -222
  138. package/lib/styles/tag.d.ts +1 -5
  139. package/lib/styles/tag.js +136 -218
  140. package/lib/styles/textarea.d.ts +1 -2
  141. package/lib/styles/textarea.js +210 -319
  142. package/lib/styles/tooltip.d.ts +0 -1
  143. package/lib/styles/tooltip.js +3 -13
  144. package/lib/styles/wizard.d.ts +5 -21
  145. package/lib/styles/wizard.js +170 -306
  146. package/lib/types/common.d.ts +2 -2
  147. package/lib/types/common.js +6 -17
  148. package/lib/utils/calendar-utils.d.ts +4 -21
  149. package/lib/utils/calendar-utils.js +100 -273
  150. package/lib/utils/custom-scrollbar.d.ts +6 -20
  151. package/lib/utils/custom-scrollbar.js +273 -317
  152. package/lib/utils/flavor-sheet.d.ts +0 -1
  153. package/lib/utils/flavor-sheet.js +14 -37
  154. package/lib/utils/icon-registry.d.ts +0 -2
  155. package/lib/utils/icon-registry.js +137 -243
  156. package/lib/utils/icons.d.ts +0 -1
  157. package/lib/utils/icons.js +0 -9
  158. package/lib/utils/loader-registry.d.ts +0 -1
  159. package/lib/utils/loader-registry.js +3 -35
  160. package/lib/utils/locale.d.ts +2 -23
  161. package/lib/utils/locale.js +34 -120
  162. package/lib/utils/mobile.d.ts +0 -1
  163. package/lib/utils/mobile.js +1 -18
  164. package/lib/utils/number-format.d.ts +6 -3
  165. package/lib/utils/number-format.js +54 -110
  166. package/lib/utils/positioning.d.ts +50 -7
  167. package/lib/utils/positioning.js +224 -234
  168. package/lib/utils/property-capture.d.ts +5 -27
  169. package/lib/utils/property-capture.js +36 -144
  170. package/lib/utils/property-manager.d.ts +0 -1
  171. package/lib/utils/property-manager.js +126 -196
  172. package/lib/utils/resize-observer.d.ts +0 -1
  173. package/lib/utils/resize-observer.js +23 -59
  174. package/lib/utils/scroll-lock.d.ts +4 -11
  175. package/lib/utils/scroll-lock.js +65 -172
  176. package/lib/utils/styles.d.ts +0 -1
  177. package/lib/utils/styles.js +17 -41
  178. package/lib/version.d.ts +1 -2
  179. package/lib/version.js +1 -11
  180. package/package.json +4 -4
  181. package/lib/base/ty-component.d.ts.map +0 -1
  182. package/lib/base/ty-component.js.map +0 -1
  183. package/lib/components/button.d.ts.map +0 -1
  184. package/lib/components/button.js.map +0 -1
  185. package/lib/components/calendar-month.d.ts.map +0 -1
  186. package/lib/components/calendar-month.js.map +0 -1
  187. package/lib/components/calendar-navigation.d.ts.map +0 -1
  188. package/lib/components/calendar-navigation.js.map +0 -1
  189. package/lib/components/calendar.d.ts.map +0 -1
  190. package/lib/components/calendar.js.map +0 -1
  191. package/lib/components/checkbox.d.ts.map +0 -1
  192. package/lib/components/checkbox.js.map +0 -1
  193. package/lib/components/copy.d.ts.map +0 -1
  194. package/lib/components/copy.js.map +0 -1
  195. package/lib/components/date-picker.d.ts.map +0 -1
  196. package/lib/components/date-picker.js.map +0 -1
  197. package/lib/components/file-upload.d.ts.map +0 -1
  198. package/lib/components/file-upload.js.map +0 -1
  199. package/lib/components/icon.d.ts.map +0 -1
  200. package/lib/components/icon.js.map +0 -1
  201. package/lib/components/input.d.ts.map +0 -1
  202. package/lib/components/input.js.map +0 -1
  203. package/lib/components/modal.d.ts.map +0 -1
  204. package/lib/components/modal.js.map +0 -1
  205. package/lib/components/option.d.ts.map +0 -1
  206. package/lib/components/option.js.map +0 -1
  207. package/lib/components/popup.d.ts.map +0 -1
  208. package/lib/components/popup.js.map +0 -1
  209. package/lib/components/radio.d.ts.map +0 -1
  210. package/lib/components/radio.js.map +0 -1
  211. package/lib/components/resize-observer.d.ts.map +0 -1
  212. package/lib/components/resize-observer.js.map +0 -1
  213. package/lib/components/scroll-container.d.ts.map +0 -1
  214. package/lib/components/scroll-container.js.map +0 -1
  215. package/lib/components/select.d.ts.map +0 -1
  216. package/lib/components/select.js.map +0 -1
  217. package/lib/components/selected-tags.d.ts.map +0 -1
  218. package/lib/components/selected-tags.js.map +0 -1
  219. package/lib/components/step.d.ts.map +0 -1
  220. package/lib/components/step.js.map +0 -1
  221. package/lib/components/switch.d.ts.map +0 -1
  222. package/lib/components/switch.js.map +0 -1
  223. package/lib/components/tab.d.ts.map +0 -1
  224. package/lib/components/tab.js.map +0 -1
  225. package/lib/components/tabs.d.ts.map +0 -1
  226. package/lib/components/tabs.js.map +0 -1
  227. package/lib/components/tag.d.ts.map +0 -1
  228. package/lib/components/tag.js.map +0 -1
  229. package/lib/components/textarea.d.ts.map +0 -1
  230. package/lib/components/textarea.js.map +0 -1
  231. package/lib/components/tooltip.d.ts.map +0 -1
  232. package/lib/components/tooltip.js.map +0 -1
  233. package/lib/components/wizard.d.ts.map +0 -1
  234. package/lib/components/wizard.js.map +0 -1
  235. package/lib/icons/fontawesome/brands.d.ts.map +0 -1
  236. package/lib/icons/fontawesome/brands.js.map +0 -1
  237. package/lib/icons/fontawesome/regular.d.ts.map +0 -1
  238. package/lib/icons/fontawesome/regular.js.map +0 -1
  239. package/lib/icons/fontawesome/solid.d.ts.map +0 -1
  240. package/lib/icons/fontawesome/solid.js.map +0 -1
  241. package/lib/icons/heroicons/micro.d.ts.map +0 -1
  242. package/lib/icons/heroicons/micro.js.map +0 -1
  243. package/lib/icons/heroicons/mini.d.ts.map +0 -1
  244. package/lib/icons/heroicons/mini.js.map +0 -1
  245. package/lib/icons/heroicons/outline.d.ts.map +0 -1
  246. package/lib/icons/heroicons/outline.js.map +0 -1
  247. package/lib/icons/heroicons/solid.d.ts.map +0 -1
  248. package/lib/icons/heroicons/solid.js.map +0 -1
  249. package/lib/icons/lucide.d.ts.map +0 -1
  250. package/lib/icons/lucide.js.map +0 -1
  251. package/lib/icons/material/filled.d.ts.map +0 -1
  252. package/lib/icons/material/filled.js.map +0 -1
  253. package/lib/icons/material/outlined.d.ts.map +0 -1
  254. package/lib/icons/material/outlined.js.map +0 -1
  255. package/lib/icons/material/round.d.ts.map +0 -1
  256. package/lib/icons/material/round.js.map +0 -1
  257. package/lib/icons/material/sharp.d.ts.map +0 -1
  258. package/lib/icons/material/sharp.js.map +0 -1
  259. package/lib/icons/material/two-tone.d.ts.map +0 -1
  260. package/lib/icons/material/two-tone.js.map +0 -1
  261. package/lib/index.d.ts.map +0 -1
  262. package/lib/index.js.map +0 -1
  263. package/lib/styles/button.d.ts.map +0 -1
  264. package/lib/styles/button.js.map +0 -1
  265. package/lib/styles/calendar-month.d.ts.map +0 -1
  266. package/lib/styles/calendar-month.js.map +0 -1
  267. package/lib/styles/calendar-navigation.d.ts.map +0 -1
  268. package/lib/styles/calendar-navigation.js.map +0 -1
  269. package/lib/styles/calendar.d.ts.map +0 -1
  270. package/lib/styles/calendar.js.map +0 -1
  271. package/lib/styles/checkbox.d.ts.map +0 -1
  272. package/lib/styles/checkbox.js.map +0 -1
  273. package/lib/styles/copy.d.ts.map +0 -1
  274. package/lib/styles/copy.js.map +0 -1
  275. package/lib/styles/custom-scrollbar.d.ts.map +0 -1
  276. package/lib/styles/custom-scrollbar.js.map +0 -1
  277. package/lib/styles/date-picker.d.ts.map +0 -1
  278. package/lib/styles/date-picker.js.map +0 -1
  279. package/lib/styles/file-upload.d.ts.map +0 -1
  280. package/lib/styles/file-upload.js.map +0 -1
  281. package/lib/styles/icon.d.ts.map +0 -1
  282. package/lib/styles/icon.js.map +0 -1
  283. package/lib/styles/input.d.ts.map +0 -1
  284. package/lib/styles/input.js.map +0 -1
  285. package/lib/styles/modal.d.ts.map +0 -1
  286. package/lib/styles/modal.js.map +0 -1
  287. package/lib/styles/multiselect.d.ts +0 -8
  288. package/lib/styles/multiselect.d.ts.map +0 -1
  289. package/lib/styles/multiselect.js +0 -849
  290. package/lib/styles/multiselect.js.map +0 -1
  291. package/lib/styles/option.d.ts.map +0 -1
  292. package/lib/styles/option.js.map +0 -1
  293. package/lib/styles/popup.d.ts.map +0 -1
  294. package/lib/styles/popup.js.map +0 -1
  295. package/lib/styles/radio.d.ts.map +0 -1
  296. package/lib/styles/radio.js.map +0 -1
  297. package/lib/styles/resize-observer.d.ts.map +0 -1
  298. package/lib/styles/resize-observer.js.map +0 -1
  299. package/lib/styles/scroll-container.d.ts.map +0 -1
  300. package/lib/styles/scroll-container.js.map +0 -1
  301. package/lib/styles/select-base.d.ts.map +0 -1
  302. package/lib/styles/select-base.js.map +0 -1
  303. package/lib/styles/select.d.ts.map +0 -1
  304. package/lib/styles/select.js.map +0 -1
  305. package/lib/styles/step.d.ts.map +0 -1
  306. package/lib/styles/step.js.map +0 -1
  307. package/lib/styles/switch.d.ts.map +0 -1
  308. package/lib/styles/switch.js.map +0 -1
  309. package/lib/styles/tab.d.ts.map +0 -1
  310. package/lib/styles/tab.js.map +0 -1
  311. package/lib/styles/tabs.d.ts.map +0 -1
  312. package/lib/styles/tabs.js.map +0 -1
  313. package/lib/styles/tag.d.ts.map +0 -1
  314. package/lib/styles/tag.js.map +0 -1
  315. package/lib/styles/textarea.d.ts.map +0 -1
  316. package/lib/styles/textarea.js.map +0 -1
  317. package/lib/styles/tooltip.d.ts.map +0 -1
  318. package/lib/styles/tooltip.js.map +0 -1
  319. package/lib/styles/wizard.d.ts.map +0 -1
  320. package/lib/styles/wizard.js.map +0 -1
  321. package/lib/types/common.d.ts.map +0 -1
  322. package/lib/types/common.js.map +0 -1
  323. package/lib/utils/calendar-utils.d.ts.map +0 -1
  324. package/lib/utils/calendar-utils.js.map +0 -1
  325. package/lib/utils/custom-scrollbar.d.ts.map +0 -1
  326. package/lib/utils/custom-scrollbar.js.map +0 -1
  327. package/lib/utils/flavor-sheet.d.ts.map +0 -1
  328. package/lib/utils/flavor-sheet.js.map +0 -1
  329. package/lib/utils/icon-registry.d.ts.map +0 -1
  330. package/lib/utils/icon-registry.js.map +0 -1
  331. package/lib/utils/icons.d.ts.map +0 -1
  332. package/lib/utils/icons.js.map +0 -1
  333. package/lib/utils/loader-registry.d.ts.map +0 -1
  334. package/lib/utils/loader-registry.js.map +0 -1
  335. package/lib/utils/locale.d.ts.map +0 -1
  336. package/lib/utils/locale.js.map +0 -1
  337. package/lib/utils/mobile.d.ts.map +0 -1
  338. package/lib/utils/mobile.js.map +0 -1
  339. package/lib/utils/number-format.d.ts.map +0 -1
  340. package/lib/utils/number-format.js.map +0 -1
  341. package/lib/utils/parse-boolean.d.ts +0 -39
  342. package/lib/utils/parse-boolean.d.ts.map +0 -1
  343. package/lib/utils/parse-boolean.js +0 -58
  344. package/lib/utils/parse-boolean.js.map +0 -1
  345. package/lib/utils/positioning.d.ts.map +0 -1
  346. package/lib/utils/positioning.js.map +0 -1
  347. package/lib/utils/property-capture.d.ts.map +0 -1
  348. package/lib/utils/property-capture.js.map +0 -1
  349. package/lib/utils/property-manager.d.ts.map +0 -1
  350. package/lib/utils/property-manager.js.map +0 -1
  351. package/lib/utils/resize-observer.d.ts.map +0 -1
  352. package/lib/utils/resize-observer.js.map +0 -1
  353. package/lib/utils/scroll-lock.d.ts.map +0 -1
  354. package/lib/utils/scroll-lock.js.map +0 -1
  355. package/lib/utils/styles.d.ts.map +0 -1
  356. package/lib/utils/styles.js.map +0 -1
  357. package/lib/version.d.ts.map +0 -1
  358. package/lib/version.js.map +0 -1
@@ -1,307 +1,273 @@
1
- /**
2
- * TyButton Web Component
3
- *
4
- * Three appearance variants × six flavors × three tones (+/base/-).
5
- * appearance="solid" saturated brand fill (default)
6
- * appearance="outlined" transparent bg, text === border
7
- * appearance="ghost" text only, hover bg
8
- *
9
- * Append `+` or `-` to a flavor for stronger/softer tone (e.g. "primary+").
10
- */
1
+ import { DEFAULT_SIZE } from "../types/common.js";
11
2
  import { TyComponent } from "../base/ty-component.js";
12
3
  import { ensureStyles, buildClassList } from "../utils/styles.js";
13
4
  import { buttonStyles, buttonCustomFlavorCss } from "../styles/button.js";
14
5
  import { syncCustomFlavorSheet } from "../utils/flavor-sheet.js";
15
6
  import { getLoaderSvg } from "../utils/loader-registry.js";
16
- /**
17
- * Ty Button Component
18
- *
19
- * @example
20
- * ```html
21
- * <ty-button flavor="primary">Default solid</ty-button>
22
- * <ty-button appearance="outlined" flavor="danger">Outlined</ty-button>
23
- * <ty-button appearance="ghost" flavor="success+">Ghost stronger</ty-button>
24
- * ```
25
- */
26
7
  export class TyButton extends TyComponent {
27
- constructor() {
28
- super();
29
- this._structureInitialized = false;
30
- // Adopted sheet with generated rules for a custom (non-built-in) flavor
31
- this._customFlavorSheet = null;
32
- ensureStyles(this.shadowRoot, { css: buttonStyles, id: "ty-button" });
33
- }
34
- onConnect() {
35
- this._syncCustomFlavor();
36
- }
37
- onDisconnect() { }
38
- onPropertiesChanged(changes) {
39
- if (changes.some((c) => c.name === "flavor")) {
40
- this._syncCustomFlavor();
41
- }
42
- }
43
- /**
44
- * Custom flavors: adopt generated per-flavor rules pointed at the user's
45
- * design tokens (--ty-solid-X / --ty-color-X / --ty-bg-X), falling back to
46
- * neutral for any token the user didn't define. Tone (+/-) is handled by
47
- * the tone-plus/tone-minus classes, so only the base flavor matters here.
48
- */
49
- _syncCustomFlavor() {
50
- const { base } = this.parseFlavor();
51
- this._customFlavorSheet = syncCustomFlavorSheet(this.shadowRoot, this._customFlavorSheet, base, () => buttonCustomFlavorCss(base));
52
- }
53
- // ============================================================================
54
- // PROPERTY ACCESSORS
55
- // ============================================================================
56
- get flavor() {
57
- return this.getProperty("flavor");
58
- }
59
- set flavor(value) {
60
- this.setProperty("flavor", value);
61
- }
62
- get size() {
63
- return this.getProperty("size");
64
- }
65
- set size(value) {
66
- this.setProperty("size", value);
67
- }
68
- get appearance() {
69
- return this.getProperty("appearance");
70
- }
71
- set appearance(value) {
72
- this.setProperty("appearance", value);
73
- }
74
- get disabled() {
75
- return this.getProperty("disabled");
76
- }
77
- set disabled(value) {
78
- this.setProperty("disabled", value);
79
- }
80
- get loading() {
81
- return this.getProperty("loading");
82
- }
83
- set loading(value) {
84
- this.setProperty("loading", value);
85
- }
86
- get type() {
87
- return this.getProperty("type");
88
- }
89
- set type(value) {
90
- this.setProperty("type", value);
91
- }
92
- get pill() {
93
- return this.getProperty("pill");
94
- }
95
- set pill(value) {
96
- this.setProperty("pill", value);
97
- }
98
- get action() {
99
- return this.getProperty("action");
100
- }
101
- set action(value) {
102
- this.setProperty("action", value);
103
- }
104
- get muted() {
105
- return this.getProperty("muted");
106
- }
107
- set muted(value) {
108
- this.setProperty("muted", value);
109
- }
110
- get wide() {
111
- return this.getProperty("wide");
112
- }
113
- set wide(value) {
114
- this.setProperty("wide", value);
115
- }
116
- get name() {
117
- return this.getProperty("name");
118
- }
119
- set name(value) {
120
- this.setProperty("name", value);
121
- }
122
- get value() {
123
- return this.getProperty("value");
124
- }
125
- set value(value) {
126
- this.setProperty("value", value);
127
- }
128
- // ============================================================================
129
- // INTERNAL
130
- // ============================================================================
131
- /** Parse the optional `+`/`-` shade suffix from a flavor string. */
132
- parseFlavor() {
133
- const f = this.flavor || "";
134
- if (f.length > 1 && f.endsWith("+"))
135
- return { base: f.slice(0, -1), tone: "+" };
136
- if (f.length > 1 && f.endsWith("-"))
137
- return { base: f.slice(0, -1), tone: "-" };
138
- return { base: f, tone: "" };
139
- }
140
- buildClasses() {
141
- const { base, tone } = this.parseFlavor();
142
- return buildClassList(base, this.size, this.appearance, this.pill && "pill", this.action && "action", this.muted && "muted", tone === "+" && "tone-plus", tone === "-" && "tone-minus");
143
- }
144
- handleFormAction() {
145
- const form = this._internals.form;
146
- if (!form)
147
- return;
148
- switch (this.type) {
149
- case "submit":
150
- if (this.name && this.value) {
151
- this._internals.setFormValue(this.value);
152
- }
153
- form.requestSubmit();
154
- break;
155
- case "reset":
156
- form.reset();
157
- break;
158
- case "button":
159
- break;
160
- }
161
- }
162
- initializeButtonStructure() {
163
- const shadow = this.shadowRoot;
164
- const classes = this.buildClasses();
165
- const button = document.createElement("button");
166
- button.disabled = this.disabled;
167
- button.className = classes;
168
- const loader = document.createElement("span");
169
- loader.className = "loader-icon";
170
- loader.setAttribute("aria-hidden", "true");
171
- loader.innerHTML = getLoaderSvg();
172
- const startSlot = document.createElement("slot");
173
- startSlot.name = "start";
174
- startSlot.className = "start";
175
- const defaultSlot = document.createElement("slot");
176
- const endSlot = document.createElement("slot");
177
- endSlot.name = "end";
178
- endSlot.className = "end";
179
- button.appendChild(loader);
180
- button.appendChild(startSlot);
181
- button.appendChild(defaultSlot);
182
- button.appendChild(endSlot);
183
- button.addEventListener("click", (e) => {
184
- if (this.disabled || this.loading)
185
- return;
186
- e.stopPropagation();
187
- this.handleFormAction();
188
- this.dispatchEvent(new CustomEvent("click", {
189
- bubbles: true,
190
- composed: true,
191
- detail: { originalEvent: e },
192
- }));
193
- });
194
- this.applyLoadingState(button);
195
- shadow.appendChild(button);
196
- this._structureInitialized = true;
197
- }
198
- applyLoadingState(button) {
199
- const isLoading = this.loading;
200
- button.classList.toggle("loading", isLoading);
201
- if (isLoading) {
202
- button.setAttribute("aria-busy", "true");
203
- // Pull the latest registered loader SVG so registry changes take effect
204
- const loader = button.querySelector(".loader-icon");
205
- if (loader)
206
- loader.innerHTML = getLoaderSvg();
207
- }
208
- else {
209
- button.removeAttribute("aria-busy");
210
- }
211
- }
212
- render() {
213
- const shadow = this.shadowRoot;
214
- if (!this._structureInitialized) {
215
- this.initializeButtonStructure();
216
- return;
217
- }
218
- const classes = this.buildClasses();
219
- const button = shadow.querySelector("button");
220
- if (button) {
221
- button.disabled = this.disabled;
222
- button.className = classes;
223
- this.applyLoadingState(button);
224
- }
225
- }
8
+ constructor() {
9
+ super();
10
+ this._structureInitialized = false;
11
+ this._customFlavorSheet = null;
12
+ ensureStyles(this.shadowRoot, { css: buttonStyles, id: "ty-button" });
13
+ }
14
+ onConnect() {
15
+ this._syncCustomFlavor();
16
+ }
17
+ onDisconnect() { }
18
+ onPropertiesChanged(changes) {
19
+ if (changes.some((c) => c.name === "flavor")) {
20
+ this._syncCustomFlavor();
21
+ }
22
+ }
23
+ _syncCustomFlavor() {
24
+ const { base } = this.parseFlavor();
25
+ this._customFlavorSheet = syncCustomFlavorSheet(this.shadowRoot, this._customFlavorSheet, base, () => buttonCustomFlavorCss(base));
26
+ }
27
+ get flavor() {
28
+ return this.getProperty("flavor");
29
+ }
30
+ set flavor(value) {
31
+ this.setProperty("flavor", value);
32
+ }
33
+ get size() {
34
+ return this.getProperty("size");
35
+ }
36
+ set size(value) {
37
+ this.setProperty("size", value);
38
+ }
39
+ get appearance() {
40
+ return this.getProperty("appearance");
41
+ }
42
+ set appearance(value) {
43
+ this.setProperty("appearance", value);
44
+ }
45
+ get disabled() {
46
+ return this.getProperty("disabled");
47
+ }
48
+ set disabled(value) {
49
+ this.setProperty("disabled", value);
50
+ }
51
+ get loading() {
52
+ return this.getProperty("loading");
53
+ }
54
+ set loading(value) {
55
+ this.setProperty("loading", value);
56
+ }
57
+ get type() {
58
+ return this.getProperty("type");
59
+ }
60
+ set type(value) {
61
+ this.setProperty("type", value);
62
+ }
63
+ get pill() {
64
+ return this.getProperty("pill");
65
+ }
66
+ set pill(value) {
67
+ this.setProperty("pill", value);
68
+ }
69
+ get action() {
70
+ return this.getProperty("action");
71
+ }
72
+ set action(value) {
73
+ this.setProperty("action", value);
74
+ }
75
+ get muted() {
76
+ return this.getProperty("muted");
77
+ }
78
+ set muted(value) {
79
+ this.setProperty("muted", value);
80
+ }
81
+ get wide() {
82
+ return this.getProperty("wide");
83
+ }
84
+ set wide(value) {
85
+ this.setProperty("wide", value);
86
+ }
87
+ get name() {
88
+ return this.getProperty("name");
89
+ }
90
+ set name(value) {
91
+ this.setProperty("name", value);
92
+ }
93
+ get value() {
94
+ return this.getProperty("value");
95
+ }
96
+ set value(value) {
97
+ this.setProperty("value", value);
98
+ }
99
+ parseFlavor() {
100
+ const f = this.flavor || "";
101
+ if (f.length > 1 && f.endsWith("+"))
102
+ return { base: f.slice(0, -1), tone: "+" };
103
+ if (f.length > 1 && f.endsWith("-"))
104
+ return { base: f.slice(0, -1), tone: "-" };
105
+ return { base: f, tone: "" };
106
+ }
107
+ buildClasses() {
108
+ const { base, tone } = this.parseFlavor();
109
+ return buildClassList(base, this.size, this.appearance, this.pill && "pill", this.action && "action", this.muted && "muted", tone === "+" && "tone-plus", tone === "-" && "tone-minus");
110
+ }
111
+ handleFormAction() {
112
+ const form = this._internals.form;
113
+ if (!form)
114
+ return;
115
+ switch (this.type) {
116
+ case "submit":
117
+ if (this.name && this.value) {
118
+ this._internals.setFormValue(this.value);
119
+ }
120
+ form.requestSubmit();
121
+ break;
122
+ case "reset":
123
+ form.reset();
124
+ break;
125
+ case "button":
126
+ break;
127
+ }
128
+ }
129
+ initializeButtonStructure() {
130
+ const shadow = this.shadowRoot;
131
+ const classes = this.buildClasses();
132
+ const button = document.createElement("button");
133
+ button.disabled = this.disabled;
134
+ button.className = classes;
135
+ button.setAttribute("part", "button");
136
+ const loader = document.createElement("span");
137
+ loader.className = "loader-icon";
138
+ loader.setAttribute("aria-hidden", "true");
139
+ loader.innerHTML = getLoaderSvg();
140
+ const startSlot = document.createElement("slot");
141
+ startSlot.name = "start";
142
+ startSlot.className = "start";
143
+ const defaultSlot = document.createElement("slot");
144
+ const endSlot = document.createElement("slot");
145
+ endSlot.name = "end";
146
+ endSlot.className = "end";
147
+ button.appendChild(loader);
148
+ button.appendChild(startSlot);
149
+ button.appendChild(defaultSlot);
150
+ button.appendChild(endSlot);
151
+ button.addEventListener("click", (e) => {
152
+ if (this.disabled || this.loading)
153
+ return;
154
+ e.stopPropagation();
155
+ this.handleFormAction();
156
+ this.dispatchEvent(new CustomEvent("click", {
157
+ bubbles: true,
158
+ composed: true,
159
+ detail: { originalEvent: e },
160
+ }));
161
+ });
162
+ this.applyLoadingState(button);
163
+ shadow.appendChild(button);
164
+ this._structureInitialized = true;
165
+ }
166
+ applyLoadingState(button) {
167
+ const isLoading = this.loading;
168
+ button.classList.toggle("loading", isLoading);
169
+ if (isLoading) {
170
+ button.setAttribute("aria-busy", "true");
171
+ const loader = button.querySelector(".loader-icon");
172
+ if (loader)
173
+ loader.innerHTML = getLoaderSvg();
174
+ }
175
+ else {
176
+ button.removeAttribute("aria-busy");
177
+ }
178
+ }
179
+ render() {
180
+ const shadow = this.shadowRoot;
181
+ if (!this._structureInitialized) {
182
+ this.initializeButtonStructure();
183
+ return;
184
+ }
185
+ const classes = this.buildClasses();
186
+ const button = shadow.querySelector("button");
187
+ if (button) {
188
+ button.disabled = this.disabled;
189
+ button.className = classes;
190
+ this.applyLoadingState(button);
191
+ }
192
+ }
226
193
  }
227
194
  TyButton.formAssociated = true;
228
195
  TyButton.properties = {
229
- flavor: {
230
- type: "string",
231
- visual: true,
232
- default: "neutral",
233
- },
234
- size: {
235
- type: "string",
236
- visual: true,
237
- default: "md",
238
- validate: (v) => ["xs", "sm", "md", "lg", "xl"].includes(v),
239
- coerce: (v) => {
240
- if (!["xs", "sm", "md", "lg", "xl"].includes(v)) {
241
- console.warn(`[ty-button] Invalid size '${v}'. Using 'md'.`);
242
- return "md";
243
- }
244
- return v;
245
- },
246
- },
247
- appearance: {
248
- type: "string",
249
- visual: true,
250
- default: "solid",
251
- validate: (v) => ["solid", "outlined", "ghost"].includes(v),
252
- coerce: (v) => {
253
- if (!["solid", "outlined", "ghost"].includes(v)) {
254
- console.warn(`[ty-button] Invalid appearance '${v}'. Using 'solid'.`);
255
- return "solid";
256
- }
257
- return v;
258
- },
259
- },
260
- disabled: {
261
- type: "boolean",
262
- visual: true,
263
- default: false,
264
- },
265
- loading: {
266
- type: "boolean",
267
- visual: true,
268
- default: false,
269
- },
270
- type: {
271
- type: "string",
272
- visual: false,
273
- default: "submit",
274
- },
275
- pill: {
276
- type: "boolean",
277
- visual: true,
278
- default: false,
279
- },
280
- action: {
281
- type: "boolean",
282
- visual: true,
283
- default: false,
284
- },
285
- muted: {
286
- type: "boolean",
287
- visual: true,
288
- default: false,
289
- },
290
- wide: {
291
- type: "boolean",
292
- visual: false,
293
- default: false,
294
- },
295
- name: {
296
- type: "string",
297
- default: "",
298
- },
299
- value: {
300
- type: "string",
301
- default: "",
302
- },
196
+ flavor: {
197
+ type: "string",
198
+ visual: true,
199
+ default: "neutral",
200
+ },
201
+ size: {
202
+ type: "string",
203
+ visual: true,
204
+ default: DEFAULT_SIZE,
205
+ validate: (v) => ["xs", "sm", "md", "lg", "xl"].includes(v),
206
+ coerce: (v) => {
207
+ if (!["xs", "sm", "md", "lg", "xl"].includes(v)) {
208
+ console.warn(`[ty-button] Invalid size '${v}'. Using '${DEFAULT_SIZE}'.`);
209
+ return DEFAULT_SIZE;
210
+ }
211
+ return v;
212
+ },
213
+ },
214
+ appearance: {
215
+ type: "string",
216
+ visual: true,
217
+ default: "solid",
218
+ validate: (v) => ["solid", "outlined", "ghost"].includes(v),
219
+ coerce: (v) => {
220
+ if (!["solid", "outlined", "ghost"].includes(v)) {
221
+ console.warn(`[ty-button] Invalid appearance '${v}'. Using 'solid'.`);
222
+ return "solid";
223
+ }
224
+ return v;
225
+ },
226
+ },
227
+ disabled: {
228
+ type: "boolean",
229
+ visual: true,
230
+ default: false,
231
+ },
232
+ loading: {
233
+ type: "boolean",
234
+ visual: true,
235
+ default: false,
236
+ },
237
+ type: {
238
+ type: "string",
239
+ visual: false,
240
+ default: "submit",
241
+ },
242
+ pill: {
243
+ type: "boolean",
244
+ visual: true,
245
+ default: false,
246
+ },
247
+ action: {
248
+ type: "boolean",
249
+ visual: true,
250
+ default: false,
251
+ },
252
+ muted: {
253
+ type: "boolean",
254
+ visual: true,
255
+ default: false,
256
+ },
257
+ wide: {
258
+ type: "boolean",
259
+ visual: false,
260
+ default: false,
261
+ },
262
+ name: {
263
+ type: "string",
264
+ default: "",
265
+ },
266
+ value: {
267
+ type: "string",
268
+ default: "",
269
+ },
303
270
  };
304
271
  if (!customElements.get("ty-button")) {
305
- customElements.define("ty-button", TyButton);
272
+ customElements.define("ty-button", TyButton);
306
273
  }
307
- //# sourceMappingURL=button.js.map
@@ -1,39 +1,6 @@
1
1
  /**
2
- * TyCalendarMonth Web Component
3
- * PORTED FROM: cljs/ty/components/calendar_month.cljs
4
- *
5
- * A stateless, property-driven calendar month renderer with customizable
6
- * day content and styling.
7
- *
8
- * Features:
9
- * - 42-day grid (6 weeks × 7 days) with Monday-first ordering
10
- * - Localized weekday headers
11
- * - Custom day content rendering via dayContentFn
12
- * - Custom day classes via dayClassesFn
13
- * - Custom CSS injection via customCSS
14
- * - Responsive width system (width, minWidth, maxWidth)
15
- * - Rich day-click events with full context
16
- *
17
- * @example
18
- * ```html
19
- * <!-- Basic usage -->
20
- * <ty-calendar-month
21
- * display-year="2025"
22
- * display-month="10"
23
- * locale="en-US">
24
- * </ty-calendar-month>
25
- *
26
- * <!-- With custom rendering -->
27
- * <ty-calendar-month id="custom"></ty-calendar-month>
28
- * <script type="module">
29
- * const cal = document.getElementById('custom');
30
- * cal.dayContentFn = (ctx) => {
31
- * const el = document.createElement('div');
32
- * el.textContent = ctx.dayInMonth;
33
- * return el;
34
- * };
35
- * </script>
36
- * ```
2
+ * TyCalendarMonth Web Component — a stateless, property-driven calendar month
3
+ * renderer (42-day grid, Monday-first) with customizable day content/styling.
37
4
  */
38
5
  import { type DayContext } from '../utils/calendar-utils.js';
39
6
  /**
@@ -80,8 +47,8 @@ export declare class TyCalendarMonth extends HTMLElement {
80
47
  private _focusedIndex;
81
48
  private _cellElements;
82
49
  /**
83
- * Observed attributes (minimal - mainly for debugging)
84
- * Properties are the primary API
50
+ * Observed attributes. `display-year`/`display-month` mirror the
51
+ * displayYear/displayMonth properties (which are what ty-calendar drives).
85
52
  */
86
53
  static get observedAttributes(): string[];
87
54
  constructor();
@@ -124,22 +91,13 @@ export declare class TyCalendarMonth extends HTMLElement {
124
91
  * Apply width-related properties as CSS custom properties
125
92
  */
126
93
  private applyWidthProperties;
127
- /**
128
- * Apply custom CSS to shadow root
129
- */
130
94
  private applyCustomCSS;
131
95
  /**
132
96
  * Force re-render of the calendar month
133
97
  * Useful when external data changes (e.g., async event loading)
134
98
  */
135
99
  refresh(): void;
136
- /**
137
- * Dispatch day-click custom event with day context
138
- */
139
100
  private dispatchDayClick;
140
- /**
141
- * Render a single day cell
142
- */
143
101
  /**
144
102
  * WAI-ARIA grid pattern: gridcell + roving tabindex (exactly one cell in
145
103
  * the whole grid is tabindex="0" at a time — the rest are -1, so Tab
@@ -147,9 +105,5 @@ export declare class TyCalendarMonth extends HTMLElement {
147
105
  * Disabled days are excluded from the roving set entirely.
148
106
  */
149
107
  private renderDayCell;
150
- /**
151
- * Main render function - property-based approach
152
- */
153
108
  private render;
154
109
  }
155
- //# sourceMappingURL=calendar-month.d.ts.map