tyrell-components 1.0.0-TC9 → 1.0.0-rc.22

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 (393) hide show
  1. package/AGENTS.md +122 -0
  2. package/CHANGELOG.md +1541 -0
  3. package/README.md +71 -53
  4. package/bin/tyrell.mjs +77 -0
  5. package/css/tyrell-colors-static.css +1 -0
  6. package/css/tyrell-theme.css +1 -0
  7. package/css/tyrell.css +1 -1783
  8. package/dist/tyrell-colors-static.css +1 -0
  9. package/dist/tyrell-theme.css +1 -0
  10. package/dist/tyrell.css +1 -1783
  11. package/dist/tyrell.js +1 -1
  12. package/guides/AGENT_INSTRUCTIONS.md +124 -0
  13. package/guides/AI_GUIDE.md +53 -0
  14. package/guides/CSS_GUIDE.md +1016 -0
  15. package/guides/DATASTAR_TY_GUIDE.md +657 -0
  16. package/guides/ICONS_GUIDE.md +212 -0
  17. package/guides/TY_GUIDE.md +937 -0
  18. package/guides/clj/CLOJURESCRIPT_GUIDE.md +300 -0
  19. package/guides/clj/CODE_SPLITTING.md +279 -0
  20. package/guides/clj/COMPONENT_GUIDE.md +391 -0
  21. package/guides/clj/HELIX_TY_GUIDE.md +428 -0
  22. package/guides/clj/I18N_GUIDE.md +478 -0
  23. package/guides/clj/LAYOUT_GUIDE.md +273 -0
  24. package/guides/clj/QUICKSTART.md +266 -0
  25. package/guides/clj/REAGENT_TY_GUIDE.md +408 -0
  26. package/guides/clj/REPLICANT_TY_GUIDE.md +623 -0
  27. package/guides/clj/ROUTING_GUIDE.md +346 -0
  28. package/guides/clj/UIX_TY_GUIDE.md +319 -0
  29. package/guides/js/HTMX_TY_GUIDE.md +252 -0
  30. package/guides/js/JAVASCRIPT_GUIDE.md +388 -0
  31. package/guides/js/REACT_TY_GUIDE.md +983 -0
  32. package/guides/js/SVELTE_TY_GUIDE.md +682 -0
  33. package/guides/js/TYCOMPONENT_GUIDE.md +962 -0
  34. package/guides/js/VUE_TY_GUIDE.md +738 -0
  35. package/lib/base/ty-component.d.ts +57 -13
  36. package/lib/base/ty-component.js +266 -292
  37. package/lib/components/button.d.ts +33 -18
  38. package/lib/components/button.js +317 -267
  39. package/lib/components/calendar-month.d.ts +30 -47
  40. package/lib/components/calendar-month.js +455 -429
  41. package/lib/components/calendar-navigation.d.ts +41 -49
  42. package/lib/components/calendar-navigation.js +287 -346
  43. package/lib/components/calendar.d.ts +73 -83
  44. package/lib/components/calendar.js +837 -762
  45. package/lib/components/checkbox.d.ts +26 -75
  46. package/lib/components/checkbox.js +298 -391
  47. package/lib/components/copy.d.ts +20 -60
  48. package/lib/components/copy.js +276 -380
  49. package/lib/components/date-picker.d.ts +100 -183
  50. package/lib/components/date-picker.js +1155 -1570
  51. package/lib/components/file-upload.d.ts +16 -15
  52. package/lib/components/file-upload.js +436 -426
  53. package/lib/components/icon.d.ts +3 -24
  54. package/lib/components/icon.js +141 -230
  55. package/lib/components/input.d.ts +93 -108
  56. package/lib/components/input.js +734 -710
  57. package/lib/components/modal.d.ts +39 -29
  58. package/lib/components/modal.js +419 -438
  59. package/lib/components/option.d.ts +20 -35
  60. package/lib/components/option.js +184 -309
  61. package/lib/components/popup.d.ts +2 -17
  62. package/lib/components/popup.js +353 -347
  63. package/lib/components/radio.d.ts +33 -25
  64. package/lib/components/radio.js +433 -422
  65. package/lib/components/resize-observer.d.ts +3 -30
  66. package/lib/components/resize-observer.js +71 -103
  67. package/lib/components/scroll-container.d.ts +21 -14
  68. package/lib/components/scroll-container.js +292 -234
  69. package/lib/components/select.d.ts +458 -0
  70. package/lib/components/select.js +1458 -0
  71. package/lib/components/selected-tags.d.ts +60 -0
  72. package/lib/components/selected-tags.js +225 -0
  73. package/lib/components/sortable.d.ts +175 -0
  74. package/lib/components/sortable.js +1844 -0
  75. package/lib/components/step.d.ts +1 -6
  76. package/lib/components/step.js +62 -68
  77. package/lib/components/switch.d.ts +15 -15
  78. package/lib/components/switch.js +237 -231
  79. package/lib/components/tab.d.ts +50 -7
  80. package/lib/components/tab.js +203 -69
  81. package/lib/components/tabs.d.ts +19 -64
  82. package/lib/components/tabs.js +600 -618
  83. package/lib/components/tag.d.ts +14 -52
  84. package/lib/components/tag.js +231 -306
  85. package/lib/components/textarea.d.ts +58 -89
  86. package/lib/components/textarea.js +523 -573
  87. package/lib/components/tooltip.d.ts +8 -13
  88. package/lib/components/tooltip.js +322 -409
  89. package/lib/components/wizard.d.ts +7 -54
  90. package/lib/components/wizard.js +376 -606
  91. package/lib/icons/fontawesome/brands.d.ts +0 -1
  92. package/lib/icons/fontawesome/brands.js +0 -8
  93. package/lib/icons/fontawesome/regular.d.ts +0 -1
  94. package/lib/icons/fontawesome/regular.js +0 -8
  95. package/lib/icons/fontawesome/solid.d.ts +0 -1
  96. package/lib/icons/fontawesome/solid.js +0 -8
  97. package/lib/icons/heroicons/micro.d.ts +0 -1
  98. package/lib/icons/heroicons/micro.js +392 -400
  99. package/lib/icons/heroicons/mini.d.ts +0 -1
  100. package/lib/icons/heroicons/mini.js +382 -390
  101. package/lib/icons/heroicons/outline.d.ts +0 -1
  102. package/lib/icons/heroicons/outline.js +337 -345
  103. package/lib/icons/heroicons/solid.d.ts +0 -1
  104. package/lib/icons/heroicons/solid.js +407 -415
  105. package/lib/icons/lucide.d.ts +0 -1
  106. package/lib/icons/lucide.js +24479 -26351
  107. package/lib/icons/material/filled.d.ts +0 -1
  108. package/lib/icons/material/filled.js +9653 -9663
  109. package/lib/icons/material/outlined.d.ts +0 -1
  110. package/lib/icons/material/outlined.js +10271 -10281
  111. package/lib/icons/material/round.d.ts +0 -1
  112. package/lib/icons/material/round.js +10495 -10505
  113. package/lib/icons/material/sharp.d.ts +0 -1
  114. package/lib/icons/material/sharp.js +9905 -9915
  115. package/lib/icons/material/two-tone.d.ts +0 -1
  116. package/lib/icons/material/two-tone.js +12792 -12802
  117. package/lib/index.d.ts +7 -4
  118. package/lib/index.js +26 -39
  119. package/lib/styles/button.d.ts +24 -7
  120. package/lib/styles/button.js +285 -445
  121. package/lib/styles/calendar-month.d.ts +7 -6
  122. package/lib/styles/calendar-month.js +158 -226
  123. package/lib/styles/calendar-navigation.d.ts +2 -6
  124. package/lib/styles/calendar-navigation.js +108 -127
  125. package/lib/styles/calendar.d.ts +3 -3
  126. package/lib/styles/calendar.js +87 -23
  127. package/lib/styles/checkbox.d.ts +7 -6
  128. package/lib/styles/checkbox.js +101 -15
  129. package/lib/styles/copy.d.ts +3 -2
  130. package/lib/styles/copy.js +91 -71
  131. package/lib/styles/custom-scrollbar.d.ts +1 -2
  132. package/lib/styles/custom-scrollbar.js +80 -115
  133. package/lib/styles/date-picker.d.ts +4 -6
  134. package/lib/styles/date-picker.js +321 -388
  135. package/lib/styles/field-size.d.ts +6 -0
  136. package/lib/styles/field-size.js +91 -0
  137. package/lib/styles/file-upload.d.ts +1 -2
  138. package/lib/styles/file-upload.js +143 -188
  139. package/lib/styles/icon.d.ts +2 -6
  140. package/lib/styles/icon.js +92 -170
  141. package/lib/styles/input.d.ts +4 -7
  142. package/lib/styles/input.js +148 -643
  143. package/lib/styles/modal.d.ts +1 -2
  144. package/lib/styles/modal.js +127 -108
  145. package/lib/styles/option.d.ts +2 -6
  146. package/lib/styles/option.js +53 -96
  147. package/lib/styles/popup.d.ts +1 -2
  148. package/lib/styles/popup.js +47 -77
  149. package/lib/styles/radio.d.ts +3 -2
  150. package/lib/styles/radio.js +90 -116
  151. package/lib/styles/resize-observer.d.ts +1 -2
  152. package/lib/styles/resize-observer.js +2 -12
  153. package/lib/styles/scroll-container.d.ts +1 -2
  154. package/lib/styles/scroll-container.js +103 -146
  155. package/lib/styles/select-base.d.ts +8 -0
  156. package/lib/styles/select-base.js +752 -0
  157. package/lib/styles/select.d.ts +11 -0
  158. package/lib/styles/select.js +229 -0
  159. package/lib/styles/sortable.d.ts +16 -0
  160. package/lib/styles/sortable.js +85 -0
  161. package/lib/styles/step.d.ts +1 -2
  162. package/lib/styles/step.js +15 -34
  163. package/lib/styles/switch.d.ts +3 -2
  164. package/lib/styles/switch.js +52 -68
  165. package/lib/styles/tab.d.ts +1 -2
  166. package/lib/styles/tab.js +86 -34
  167. package/lib/styles/tabs.d.ts +3 -11
  168. package/lib/styles/tabs.js +204 -162
  169. package/lib/styles/tag.d.ts +2 -6
  170. package/lib/styles/tag.js +168 -362
  171. package/lib/styles/textarea.d.ts +1 -2
  172. package/lib/styles/textarea.js +238 -306
  173. package/lib/styles/tooltip.d.ts +4 -3
  174. package/lib/styles/tooltip.js +3 -131
  175. package/lib/styles/wizard.d.ts +8 -20
  176. package/lib/styles/wizard.js +306 -295
  177. package/lib/types/common.d.ts +9 -8
  178. package/lib/types/common.js +8 -5
  179. package/lib/utils/calendar-utils.d.ts +49 -65
  180. package/lib/utils/calendar-utils.js +158 -343
  181. package/lib/utils/custom-scrollbar.d.ts +6 -20
  182. package/lib/utils/custom-scrollbar.js +273 -317
  183. package/lib/utils/flavor-sheet.d.ts +31 -0
  184. package/lib/utils/flavor-sheet.js +17 -0
  185. package/lib/utils/icon-registry.d.ts +0 -15
  186. package/lib/utils/icon-registry.js +138 -279
  187. package/lib/utils/icons.d.ts +9 -0
  188. package/lib/utils/icons.js +1 -0
  189. package/lib/utils/loader-registry.d.ts +2 -3
  190. package/lib/utils/loader-registry.js +3 -35
  191. package/lib/utils/locale.d.ts +2 -80
  192. package/lib/utils/locale.js +30 -205
  193. package/lib/utils/mobile.d.ts +0 -1
  194. package/lib/utils/mobile.js +1 -18
  195. package/lib/utils/number-format.d.ts +6 -24
  196. package/lib/utils/number-format.js +53 -136
  197. package/lib/utils/positioning.d.ts +72 -22
  198. package/lib/utils/positioning.js +224 -298
  199. package/lib/utils/property-capture.d.ts +5 -27
  200. package/lib/utils/property-capture.js +36 -144
  201. package/lib/utils/property-manager.d.ts +6 -6
  202. package/lib/utils/property-manager.js +127 -196
  203. package/lib/utils/resize-observer.d.ts +0 -1
  204. package/lib/utils/resize-observer.js +23 -59
  205. package/lib/utils/scroll-lock.d.ts +10 -11
  206. package/lib/utils/scroll-lock.js +165 -173
  207. package/lib/utils/styles.d.ts +0 -6
  208. package/lib/utils/styles.js +17 -48
  209. package/lib/utils/upgrade-properties.d.ts +21 -0
  210. package/lib/utils/upgrade-properties.js +47 -0
  211. package/lib/utils/validity.d.ts +122 -0
  212. package/lib/utils/validity.js +289 -0
  213. package/lib/version.d.ts +1 -2
  214. package/lib/version.js +1 -11
  215. package/package.json +66 -18
  216. package/lib/base/ty-component.d.ts.map +0 -1
  217. package/lib/base/ty-component.js.map +0 -1
  218. package/lib/components/button.d.ts.map +0 -1
  219. package/lib/components/button.js.map +0 -1
  220. package/lib/components/calendar-month.d.ts.map +0 -1
  221. package/lib/components/calendar-month.js.map +0 -1
  222. package/lib/components/calendar-navigation.d.ts.map +0 -1
  223. package/lib/components/calendar-navigation.js.map +0 -1
  224. package/lib/components/calendar.d.ts.map +0 -1
  225. package/lib/components/calendar.js.map +0 -1
  226. package/lib/components/checkbox.d.ts.map +0 -1
  227. package/lib/components/checkbox.js.map +0 -1
  228. package/lib/components/copy.d.ts.map +0 -1
  229. package/lib/components/copy.js.map +0 -1
  230. package/lib/components/date-picker.d.ts.map +0 -1
  231. package/lib/components/date-picker.js.map +0 -1
  232. package/lib/components/dropdown.d.ts +0 -404
  233. package/lib/components/dropdown.d.ts.map +0 -1
  234. package/lib/components/dropdown.js +0 -1563
  235. package/lib/components/dropdown.js.map +0 -1
  236. package/lib/components/file-upload.d.ts.map +0 -1
  237. package/lib/components/file-upload.js.map +0 -1
  238. package/lib/components/icon.d.ts.map +0 -1
  239. package/lib/components/icon.js.map +0 -1
  240. package/lib/components/input.d.ts.map +0 -1
  241. package/lib/components/input.js.map +0 -1
  242. package/lib/components/modal.d.ts.map +0 -1
  243. package/lib/components/modal.js.map +0 -1
  244. package/lib/components/multiselect.d.ts +0 -408
  245. package/lib/components/multiselect.d.ts.map +0 -1
  246. package/lib/components/multiselect.js +0 -1611
  247. package/lib/components/multiselect.js.map +0 -1
  248. package/lib/components/option.d.ts.map +0 -1
  249. package/lib/components/option.js.map +0 -1
  250. package/lib/components/popup.d.ts.map +0 -1
  251. package/lib/components/popup.js.map +0 -1
  252. package/lib/components/radio.d.ts.map +0 -1
  253. package/lib/components/radio.js.map +0 -1
  254. package/lib/components/resize-observer.d.ts.map +0 -1
  255. package/lib/components/resize-observer.js.map +0 -1
  256. package/lib/components/scroll-container.d.ts.map +0 -1
  257. package/lib/components/scroll-container.js.map +0 -1
  258. package/lib/components/step.d.ts.map +0 -1
  259. package/lib/components/step.js.map +0 -1
  260. package/lib/components/switch.d.ts.map +0 -1
  261. package/lib/components/switch.js.map +0 -1
  262. package/lib/components/tab.d.ts.map +0 -1
  263. package/lib/components/tab.js.map +0 -1
  264. package/lib/components/tabs.d.ts.map +0 -1
  265. package/lib/components/tabs.js.map +0 -1
  266. package/lib/components/tag.d.ts.map +0 -1
  267. package/lib/components/tag.js.map +0 -1
  268. package/lib/components/textarea.d.ts.map +0 -1
  269. package/lib/components/textarea.js.map +0 -1
  270. package/lib/components/tooltip.d.ts.map +0 -1
  271. package/lib/components/tooltip.js.map +0 -1
  272. package/lib/components/wizard.d.ts.map +0 -1
  273. package/lib/components/wizard.js.map +0 -1
  274. package/lib/icons/fontawesome/brands.d.ts.map +0 -1
  275. package/lib/icons/fontawesome/brands.js.map +0 -1
  276. package/lib/icons/fontawesome/regular.d.ts.map +0 -1
  277. package/lib/icons/fontawesome/regular.js.map +0 -1
  278. package/lib/icons/fontawesome/solid.d.ts.map +0 -1
  279. package/lib/icons/fontawesome/solid.js.map +0 -1
  280. package/lib/icons/heroicons/micro.d.ts.map +0 -1
  281. package/lib/icons/heroicons/micro.js.map +0 -1
  282. package/lib/icons/heroicons/mini.d.ts.map +0 -1
  283. package/lib/icons/heroicons/mini.js.map +0 -1
  284. package/lib/icons/heroicons/outline.d.ts.map +0 -1
  285. package/lib/icons/heroicons/outline.js.map +0 -1
  286. package/lib/icons/heroicons/solid.d.ts.map +0 -1
  287. package/lib/icons/heroicons/solid.js.map +0 -1
  288. package/lib/icons/lucide.d.ts.map +0 -1
  289. package/lib/icons/lucide.js.map +0 -1
  290. package/lib/icons/material/filled.d.ts.map +0 -1
  291. package/lib/icons/material/filled.js.map +0 -1
  292. package/lib/icons/material/outlined.d.ts.map +0 -1
  293. package/lib/icons/material/outlined.js.map +0 -1
  294. package/lib/icons/material/round.d.ts.map +0 -1
  295. package/lib/icons/material/round.js.map +0 -1
  296. package/lib/icons/material/sharp.d.ts.map +0 -1
  297. package/lib/icons/material/sharp.js.map +0 -1
  298. package/lib/icons/material/two-tone.d.ts.map +0 -1
  299. package/lib/icons/material/two-tone.js.map +0 -1
  300. package/lib/index.d.ts.map +0 -1
  301. package/lib/index.js.map +0 -1
  302. package/lib/styles/button.d.ts.map +0 -1
  303. package/lib/styles/button.js.map +0 -1
  304. package/lib/styles/calendar-month.d.ts.map +0 -1
  305. package/lib/styles/calendar-month.js.map +0 -1
  306. package/lib/styles/calendar-navigation.d.ts.map +0 -1
  307. package/lib/styles/calendar-navigation.js.map +0 -1
  308. package/lib/styles/calendar.d.ts.map +0 -1
  309. package/lib/styles/calendar.js.map +0 -1
  310. package/lib/styles/checkbox.d.ts.map +0 -1
  311. package/lib/styles/checkbox.js.map +0 -1
  312. package/lib/styles/copy.d.ts.map +0 -1
  313. package/lib/styles/copy.js.map +0 -1
  314. package/lib/styles/custom-scrollbar.d.ts.map +0 -1
  315. package/lib/styles/custom-scrollbar.js.map +0 -1
  316. package/lib/styles/date-picker.d.ts.map +0 -1
  317. package/lib/styles/date-picker.js.map +0 -1
  318. package/lib/styles/dropdown.d.ts +0 -12
  319. package/lib/styles/dropdown.d.ts.map +0 -1
  320. package/lib/styles/dropdown.js +0 -1048
  321. package/lib/styles/dropdown.js.map +0 -1
  322. package/lib/styles/file-upload.d.ts.map +0 -1
  323. package/lib/styles/file-upload.js.map +0 -1
  324. package/lib/styles/icon.d.ts.map +0 -1
  325. package/lib/styles/icon.js.map +0 -1
  326. package/lib/styles/input.d.ts.map +0 -1
  327. package/lib/styles/input.js.map +0 -1
  328. package/lib/styles/modal.d.ts.map +0 -1
  329. package/lib/styles/modal.js.map +0 -1
  330. package/lib/styles/multiselect.d.ts +0 -6
  331. package/lib/styles/multiselect.d.ts.map +0 -1
  332. package/lib/styles/multiselect.js +0 -837
  333. package/lib/styles/multiselect.js.map +0 -1
  334. package/lib/styles/option.d.ts.map +0 -1
  335. package/lib/styles/option.js.map +0 -1
  336. package/lib/styles/popup.d.ts.map +0 -1
  337. package/lib/styles/popup.js.map +0 -1
  338. package/lib/styles/radio.d.ts.map +0 -1
  339. package/lib/styles/radio.js.map +0 -1
  340. package/lib/styles/resize-observer.d.ts.map +0 -1
  341. package/lib/styles/resize-observer.js.map +0 -1
  342. package/lib/styles/scroll-container.d.ts.map +0 -1
  343. package/lib/styles/scroll-container.js.map +0 -1
  344. package/lib/styles/step.d.ts.map +0 -1
  345. package/lib/styles/step.js.map +0 -1
  346. package/lib/styles/switch.d.ts.map +0 -1
  347. package/lib/styles/switch.js.map +0 -1
  348. package/lib/styles/tab.d.ts.map +0 -1
  349. package/lib/styles/tab.js.map +0 -1
  350. package/lib/styles/tabs.d.ts.map +0 -1
  351. package/lib/styles/tabs.js.map +0 -1
  352. package/lib/styles/tag.d.ts.map +0 -1
  353. package/lib/styles/tag.js.map +0 -1
  354. package/lib/styles/textarea.d.ts.map +0 -1
  355. package/lib/styles/textarea.js.map +0 -1
  356. package/lib/styles/tooltip.d.ts.map +0 -1
  357. package/lib/styles/tooltip.js.map +0 -1
  358. package/lib/styles/wizard.d.ts.map +0 -1
  359. package/lib/styles/wizard.js.map +0 -1
  360. package/lib/types/common.d.ts.map +0 -1
  361. package/lib/types/common.js.map +0 -1
  362. package/lib/utils/calendar-utils.d.ts.map +0 -1
  363. package/lib/utils/calendar-utils.js.map +0 -1
  364. package/lib/utils/custom-scrollbar.d.ts.map +0 -1
  365. package/lib/utils/custom-scrollbar.js.map +0 -1
  366. package/lib/utils/icon-registry.d.ts.map +0 -1
  367. package/lib/utils/icon-registry.js.map +0 -1
  368. package/lib/utils/loader-registry.d.ts.map +0 -1
  369. package/lib/utils/loader-registry.js.map +0 -1
  370. package/lib/utils/locale.d.ts.map +0 -1
  371. package/lib/utils/locale.js.map +0 -1
  372. package/lib/utils/mobile.d.ts.map +0 -1
  373. package/lib/utils/mobile.js.map +0 -1
  374. package/lib/utils/number-format.d.ts.map +0 -1
  375. package/lib/utils/number-format.js.map +0 -1
  376. package/lib/utils/parse-boolean.d.ts +0 -39
  377. package/lib/utils/parse-boolean.d.ts.map +0 -1
  378. package/lib/utils/parse-boolean.js +0 -58
  379. package/lib/utils/parse-boolean.js.map +0 -1
  380. package/lib/utils/positioning.d.ts.map +0 -1
  381. package/lib/utils/positioning.js.map +0 -1
  382. package/lib/utils/property-capture.d.ts.map +0 -1
  383. package/lib/utils/property-capture.js.map +0 -1
  384. package/lib/utils/property-manager.d.ts.map +0 -1
  385. package/lib/utils/property-manager.js.map +0 -1
  386. package/lib/utils/resize-observer.d.ts.map +0 -1
  387. package/lib/utils/resize-observer.js.map +0 -1
  388. package/lib/utils/scroll-lock.d.ts.map +0 -1
  389. package/lib/utils/scroll-lock.js.map +0 -1
  390. package/lib/utils/styles.d.ts.map +0 -1
  391. package/lib/utils/styles.js.map +0 -1
  392. package/lib/version.d.ts.map +0 -1
  393. package/lib/version.js.map +0 -1
@@ -1,400 +1,307 @@
1
- /**
2
- * TyCheckbox Web Component
3
- *
4
- * "Just the box" primitive — renders only the checkbox visual + state.
5
- * Label, required asterisk, and error display are the consumer's
6
- * responsibility — wrap in a `<label>` for click delegation.
7
- *
8
- * - Boolean checked state, form-associated
9
- * - Keyboard accessibility (Space/Enter)
10
- * - Sizes (xs, sm, md, lg, xl) and semantic flavors
11
- *
12
- * @example
13
- * <label>
14
- * <ty-checkbox name="terms" required></ty-checkbox>
15
- * I agree to the <a href="/terms">terms</a>
16
- * </label>
17
- */
1
+ import { DEFAULT_SIZE } from "../types/common.js";
18
2
  import { TyComponent } from "../base/ty-component.js";
19
3
  import { ensureStyles } from "../utils/styles.js";
20
- import { checkboxStyles } from "../styles/checkbox.js";
21
- /**
22
- * Checkbox unchecked icon (Font Awesome)
23
- */
24
- const CHECKBOX_UNCHECKED_ICON = `<svg fill='currentColor' xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 640"><!--!Font Awesome Free v7.0.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2025 Fonticons, Inc.--><path d="M160 96L480 96C515.3 96 544 124.7 544 160L544 480C544 515.3 515.3 544 480 544L160 544C124.7 544 96 515.3 96 480L96 160C96 124.7 124.7 96 160 96z"/></svg>`;
25
- /**
26
- * Checkbox checked icon (Font Awesome)
27
- */
28
- const CHECKBOX_CHECKED_ICON = `<svg fill='currentColor' xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 640"><!--!Font Awesome Free v7.0.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2025 Fonticons, Inc.--><path d="M480 96C515.3 96 544 124.7 544 160L544 480C544 515.3 515.3 544 480 544L160 544C124.7 544 96 515.3 96 480L96 160C96 124.7 124.7 96 160 96L480 96zM438 209.7C427.3 201.9 412.3 204.3 404.5 215L285.1 379.2L233 327.1C223.6 317.7 208.4 317.7 199.1 327.1C189.8 336.5 189.7 351.7 199.1 361L271.1 433C276.1 438 283 440.5 289.9 440C296.8 439.5 303.3 435.9 307.4 430.2L443.3 243.2C451.1 232.5 448.7 217.5 438 209.7z"/></svg>`;
29
- /**
30
- * Ty Checkbox Component
31
- *
32
- * @example
33
- * ```html
34
- * <!-- Basic checkbox -->
35
- * <ty-checkbox>Subscribe to newsletter</ty-checkbox>
36
- *
37
- * <!-- Pre-checked with custom value -->
38
- * <ty-checkbox
39
- * checked
40
- * value="accepted"
41
- * required>
42
- * Accept terms
43
- * </ty-checkbox>
44
- *
45
- * <!-- With error state -->
46
- * <ty-checkbox
47
- * required
48
- * error="You must agree to continue"
49
- * flavor="danger">
50
- * Agree to terms
51
- * </ty-checkbox>
52
- *
53
- * <!-- Different sizes -->
54
- * <ty-checkbox size="sm">Small</ty-checkbox>
55
- * <ty-checkbox size="lg">Large</ty-checkbox>
56
- *
57
- * <!-- Semantic flavors -->
58
- * <ty-checkbox flavor="primary" checked>Primary</ty-checkbox>
59
- * <ty-checkbox flavor="success" checked>Success</ty-checkbox>
60
- *
61
- * <!-- Rich content (with icon) -->
62
- * <ty-checkbox checked>
63
- * <ty-icon name="star"></ty-icon>
64
- * Premium feature
65
- * </ty-checkbox>
66
- * ```
67
- */
4
+ import { syncCustomFlavorSheet } from "../utils/flavor-sheet.js";
5
+ import { checkboxStyles, checkboxCustomFlavorCss } from "../styles/checkbox.js";
6
+ import { nativeMessage } from "../utils/validity.js";
7
+ const CHECK_ICON = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="3" stroke-linecap="round" stroke-linejoin="round"><path d="M20 6 9 17l-5-5"/></svg>`;
8
+ const DASH_ICON = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="3" stroke-linecap="round" stroke-linejoin="round"><path d="M5 12h14"/></svg>`;
68
9
  export class TyCheckbox extends TyComponent {
69
- constructor() {
70
- super(); // TyComponent handles attachInternals() and attachShadow()
71
- // ============================================================================
72
- // INTERNAL STATE - Not managed by PropertyManager
73
- // NOTE: _internals provided by TyComponent base class
74
- // ============================================================================
75
- this._listenersSetup = false;
76
- // Store references to handlers for cleanup
77
- this._clickHandler = null;
78
- this._keydownHandler = null;
79
- this._focusHandler = null;
80
- this._blurHandler = null;
81
- // Apply styles to shadow root
82
- const shadow = this.shadowRoot;
83
- ensureStyles(shadow, { css: checkboxStyles, id: "ty-checkbox" });
84
- }
85
- // observedAttributes auto-generated by TyComponent from properties config
86
- // ============================================================================
87
- // TYCOMPONENT LIFECYCLE HOOKS
88
- // ============================================================================
89
- /**
90
- * Called when component connects to DOM
91
- * TyComponent already handled pre-connection property capture
92
- */
93
- onConnect() {
94
- // TyComponent will call render() automatically after this hook
95
- // No need to call render() manually or use requestAnimationFrame
96
- }
97
- /**
98
- * Called when component disconnects from DOM
99
- */
100
- onDisconnect() {
101
- // Clean up event listeners when component is removed from DOM
102
- this.removeEventListeners();
103
- }
104
- /**
105
- * Handle property changes - called BEFORE render
106
- */
107
- onPropertiesChanged(_changes) {
108
- // No special handling needed - TyComponent handles rendering automatically
109
- }
110
- /**
111
- * Override form value to return value when checked, null when unchecked
112
- */
113
- getFormValue() {
114
- return this.checked ? this.value : null;
115
- }
116
- // Removed old attributeChangedCallback, initializeCheckboxState, validateFlavor - handled by TyComponent
117
- /**
118
- * Build CSS class list for checkbox container
119
- */
120
- buildClassList() {
121
- const classes = [this.size, this.flavor];
122
- if (this.disabled)
123
- classes.push("disabled");
124
- if (this.required)
125
- classes.push("required");
126
- return classes.join(" ");
127
- }
128
- /**
129
- * Handle checkbox click event - standards compliant approach
130
- */
131
- handleCheckboxClick(e) {
132
- if (this.disabled)
133
- return;
134
- // Toggle checked state - this will trigger automatic form value update
135
- const newValue = !this.checked;
136
- this.checked = newValue; // Uses setProperty which handles everything
137
- // Emit custom events after property update
138
- setTimeout(() => {
139
- const eventDetail = {
140
- value: newValue,
141
- checked: newValue,
142
- formValue: newValue ? this.value : null,
143
- originalEvent: e,
144
- };
145
- this.dispatchEvent(new CustomEvent("input", {
146
- detail: eventDetail,
147
- bubbles: true,
148
- composed: true,
149
- }));
150
- this.dispatchEvent(new CustomEvent("change", {
151
- detail: eventDetail,
152
- bubbles: true,
153
- composed: true,
154
- }));
155
- }, 0);
156
- }
157
- /**
158
- * Handle checkbox keyboard events - space/enter to toggle
159
- */
160
- handleCheckboxKeydown(e) {
161
- if (this.disabled)
162
- return;
163
- if (["Space", " ", "Enter"].includes(e.key)) {
164
- e.preventDefault(); // Prevent default for keyboard to avoid page scroll
165
- e.stopPropagation();
166
- this.handleCheckboxClick(e);
167
- }
168
- }
169
- /**
170
- * Remove event listeners for cleanup
171
- */
172
- removeEventListeners() {
173
- if (!this._listenersSetup)
174
- return;
175
- const shadow = this.shadowRoot;
176
- if (!shadow)
177
- return;
178
- const checkboxEl = shadow.querySelector(".checkbox-container");
179
- if (!checkboxEl)
180
- return;
181
- // Remove all event listeners using stored handler references
182
- if (this._clickHandler) {
183
- checkboxEl.removeEventListener("click", this._clickHandler);
184
- this._clickHandler = null;
185
- }
186
- if (this._keydownHandler) {
187
- checkboxEl.removeEventListener("keydown", this._keydownHandler);
188
- this._keydownHandler = null;
189
- }
190
- if (this._focusHandler) {
191
- checkboxEl.removeEventListener("focus", this._focusHandler);
192
- this._focusHandler = null;
193
- }
194
- if (this._blurHandler) {
195
- checkboxEl.removeEventListener("blur", this._blurHandler);
196
- this._blurHandler = null;
197
- }
198
- this._listenersSetup = false;
199
- }
200
- /**
201
- * Setup event listeners for checkbox functionality
202
- * IMPORTANT: Only called ONCE, not on every render
203
- */
204
- setupEventListeners() {
205
- if (this._listenersSetup)
206
- return;
207
- const shadow = this.shadowRoot;
208
- const checkboxEl = shadow.querySelector(".checkbox-container");
209
- if (!checkboxEl)
210
- return;
211
- // Create and store handler references for cleanup
212
- this._clickHandler = (e) => {
213
- this.handleCheckboxClick(e);
214
- };
215
- this._keydownHandler = (e) => {
216
- this.handleCheckboxKeydown(e);
217
- };
218
- this._focusHandler = () => {
219
- checkboxEl.classList.add("focused");
220
- };
221
- this._blurHandler = () => {
222
- checkboxEl.classList.remove("focused");
223
- };
224
- // Add event listeners
225
- checkboxEl.addEventListener("click", this._clickHandler);
226
- checkboxEl.addEventListener("keydown", this._keydownHandler);
227
- checkboxEl.addEventListener("focus", this._focusHandler);
228
- checkboxEl.addEventListener("blur", this._blurHandler);
229
- this._listenersSetup = true;
230
- }
231
- /**
232
- * Render the checkbox — just the box visual.
233
- * Label, required asterisk, and error UI are the consumer's responsibility.
234
- */
235
- render() {
236
- const shadow = this.shadowRoot;
237
- let checkboxEl = shadow.querySelector(".checkbox-container");
238
- const classes = this.buildClassList();
239
- if (!checkboxEl) {
240
- checkboxEl = document.createElement("div");
241
- checkboxEl.className = "checkbox-container " + classes;
242
- checkboxEl.tabIndex = this.disabled ? -1 : 0;
243
- checkboxEl.setAttribute("role", "checkbox");
244
- checkboxEl.setAttribute("aria-checked", String(this.checked));
245
- checkboxEl.setAttribute("aria-disabled", String(this.disabled));
246
- checkboxEl.setAttribute("aria-required", String(this.required));
247
- const checkboxIcon = document.createElement("div");
248
- checkboxIcon.className = "checkbox-icon";
249
- checkboxIcon.innerHTML = this.checked
250
- ? CHECKBOX_CHECKED_ICON
251
- : CHECKBOX_UNCHECKED_ICON;
252
- checkboxEl.appendChild(checkboxIcon);
253
- shadow.appendChild(checkboxEl);
254
- this.setupEventListeners();
255
- }
256
- else {
257
- checkboxEl.className = "checkbox-container " + classes;
258
- checkboxEl.tabIndex = this.disabled ? -1 : 0;
259
- checkboxEl.setAttribute("aria-checked", String(this.checked));
260
- checkboxEl.setAttribute("aria-disabled", String(this.disabled));
261
- checkboxEl.setAttribute("aria-required", String(this.required));
262
- const checkboxIcon = checkboxEl.querySelector(".checkbox-icon");
263
- if (checkboxIcon) {
264
- checkboxIcon.innerHTML = this.checked
265
- ? CHECKBOX_CHECKED_ICON
266
- : CHECKBOX_UNCHECKED_ICON;
267
- }
268
- }
269
- }
270
- // ============================================================================
271
- // PROPERTY ACCESSORS - Simple wrappers (no logic!)
272
- // ============================================================================
273
- get checked() {
274
- return this.getProperty("checked");
275
- }
276
- set checked(value) {
277
- this.setProperty("checked", value);
278
- }
279
- get value() {
280
- return this.getProperty("value");
281
- }
282
- set value(val) {
283
- this.setProperty("value", val);
284
- }
285
- get name() {
286
- return this.getProperty("name");
287
- }
288
- set name(val) {
289
- this.setProperty("name", val);
290
- }
291
- get disabled() {
292
- return this.getProperty("disabled");
293
- }
294
- set disabled(value) {
295
- this.setProperty("disabled", value);
296
- }
297
- get required() {
298
- return this.getProperty("required");
299
- }
300
- set required(value) {
301
- this.setProperty("required", value);
302
- }
303
- get size() {
304
- return this.getProperty("size");
305
- }
306
- set size(value) {
307
- this.setProperty("size", value);
308
- }
309
- get flavor() {
310
- return this.getProperty("flavor");
311
- }
312
- set flavor(value) {
313
- this.setProperty("flavor", value);
314
- }
315
- get form() {
316
- return this._internals.form;
317
- }
10
+ constructor() {
11
+ super();
12
+ this._customFlavorSheet = null;
13
+ this._listenersSetup = false;
14
+ this._clickHandler = null;
15
+ this._keydownHandler = null;
16
+ this._focusHandler = null;
17
+ this._blurHandler = null;
18
+ const shadow = this.shadowRoot;
19
+ ensureStyles(shadow, { css: checkboxStyles, id: "ty-checkbox" });
20
+ }
21
+ onConnect() {
22
+ this.setupEventListeners();
23
+ this._syncCustomFlavor();
24
+ const el = this.shadowRoot.querySelector(".checkbox-container");
25
+ if (el && this.shadowRoot.activeElement !== el)
26
+ el.classList.remove("focused");
27
+ }
28
+ _syncCustomFlavor() {
29
+ this._customFlavorSheet = syncCustomFlavorSheet(this.shadowRoot, this._customFlavorSheet, this.flavor, ({ base }) => checkboxCustomFlavorCss(base));
30
+ }
31
+ onDisconnect() {
32
+ this.removeEventListeners();
33
+ }
34
+ onPropertiesChanged(changes) {
35
+ if (changes.some((c) => c.name === "flavor")) {
36
+ this._syncCustomFlavor();
37
+ }
38
+ }
39
+ getFormValue() {
40
+ return this.checked ? this.value : null;
41
+ }
42
+ buildClassList() {
43
+ const classes = [this.size];
44
+ if (this.disabled)
45
+ classes.push("disabled");
46
+ if (this.required)
47
+ classes.push("required");
48
+ return classes.join(" ");
49
+ }
50
+ handleCheckboxClick(e) {
51
+ if (this.disabled)
52
+ return;
53
+ this.showFocusRing(e instanceof KeyboardEvent);
54
+ const newValue = this.indeterminate ? true : !this.checked;
55
+ if (this.indeterminate)
56
+ this.indeterminate = false;
57
+ this.checked = newValue;
58
+ setTimeout(() => {
59
+ const eventDetail = {
60
+ value: newValue,
61
+ checked: newValue,
62
+ formValue: newValue ? this.value : null,
63
+ originalEvent: e,
64
+ };
65
+ this.dispatchEvent(new CustomEvent("input", {
66
+ detail: eventDetail,
67
+ bubbles: true,
68
+ composed: true,
69
+ }));
70
+ this.dispatchEvent(new CustomEvent("change", {
71
+ detail: eventDetail,
72
+ bubbles: true,
73
+ composed: true,
74
+ }));
75
+ }, 0);
76
+ }
77
+ showFocusRing(on) {
78
+ this.shadowRoot?.querySelector(".checkbox-container")?.classList.toggle("focused", on);
79
+ }
80
+ handleCheckboxKeydown(e) {
81
+ if (this.disabled)
82
+ return;
83
+ if (["Space", " ", "Enter"].includes(e.key)) {
84
+ e.preventDefault();
85
+ e.stopPropagation();
86
+ this.handleCheckboxClick(e);
87
+ }
88
+ }
89
+ removeEventListeners() {
90
+ if (!this._listenersSetup)
91
+ return;
92
+ if (this._clickHandler) {
93
+ this.removeEventListener("click", this._clickHandler);
94
+ this._clickHandler = null;
95
+ }
96
+ const shadow = this.shadowRoot;
97
+ if (!shadow)
98
+ return;
99
+ const checkboxEl = shadow.querySelector(".checkbox-container");
100
+ if (!checkboxEl) {
101
+ this._listenersSetup = false;
102
+ return;
103
+ }
104
+ if (this._keydownHandler) {
105
+ checkboxEl.removeEventListener("keydown", this._keydownHandler);
106
+ this._keydownHandler = null;
107
+ }
108
+ if (this._focusHandler) {
109
+ checkboxEl.removeEventListener("focus", this._focusHandler);
110
+ this._focusHandler = null;
111
+ }
112
+ if (this._blurHandler) {
113
+ checkboxEl.removeEventListener("blur", this._blurHandler);
114
+ this._blurHandler = null;
115
+ }
116
+ this._listenersSetup = false;
117
+ }
118
+ setupEventListeners() {
119
+ if (this._listenersSetup)
120
+ return;
121
+ const shadow = this.shadowRoot;
122
+ const checkboxEl = shadow.querySelector(".checkbox-container");
123
+ if (!checkboxEl)
124
+ return;
125
+ this._clickHandler = (e) => {
126
+ this.handleCheckboxClick(e);
127
+ };
128
+ this._keydownHandler = (e) => {
129
+ this.handleCheckboxKeydown(e);
130
+ };
131
+ this._focusHandler = () => {
132
+ checkboxEl.classList.toggle("focused", checkboxEl.matches(":focus-visible"));
133
+ };
134
+ this._blurHandler = () => {
135
+ checkboxEl.classList.remove("focused");
136
+ };
137
+ this.addEventListener("click", this._clickHandler);
138
+ checkboxEl.addEventListener("keydown", this._keydownHandler);
139
+ checkboxEl.addEventListener("focus", this._focusHandler);
140
+ checkboxEl.addEventListener("blur", this._blurHandler);
141
+ this._listenersSetup = true;
142
+ }
143
+ render() {
144
+ const shadow = this.shadowRoot;
145
+ let checkboxEl = shadow.querySelector(".checkbox-container");
146
+ const classes = this.buildClassList();
147
+ const ariaChecked = this.indeterminate ? "mixed" : String(this.checked);
148
+ if (!checkboxEl) {
149
+ checkboxEl = document.createElement("div");
150
+ checkboxEl.className = "checkbox-container " + classes;
151
+ if (!this.disabled)
152
+ checkboxEl.tabIndex = 0;
153
+ checkboxEl.setAttribute("role", "checkbox");
154
+ checkboxEl.setAttribute("aria-checked", ariaChecked);
155
+ checkboxEl.setAttribute("aria-disabled", String(this.disabled));
156
+ checkboxEl.setAttribute("aria-required", String(this.required));
157
+ const checkboxIcon = document.createElement("div");
158
+ checkboxIcon.className = "checkbox-icon";
159
+ checkboxEl.appendChild(checkboxIcon);
160
+ shadow.appendChild(checkboxEl);
161
+ }
162
+ else {
163
+ const focused = checkboxEl.classList.contains("focused") && shadow.activeElement === checkboxEl;
164
+ checkboxEl.className = "checkbox-container " + classes;
165
+ checkboxEl.classList.toggle("focused", focused && !this.disabled);
166
+ if (this.disabled)
167
+ checkboxEl.removeAttribute("tabindex");
168
+ else
169
+ checkboxEl.tabIndex = 0;
170
+ checkboxEl.setAttribute("aria-checked", ariaChecked);
171
+ checkboxEl.setAttribute("aria-disabled", String(this.disabled));
172
+ checkboxEl.setAttribute("aria-required", String(this.required));
173
+ }
174
+ const icon = checkboxEl.querySelector(".checkbox-icon");
175
+ icon.innerHTML = this.indeterminate ? DASH_ICON : CHECK_ICON;
176
+ this.setupEventListeners();
177
+ this.applyLabelName(checkboxEl);
178
+ this.updateValidity();
179
+ }
180
+ focus(options) {
181
+ const el = this.shadowRoot?.querySelector(".checkbox-container");
182
+ if (el)
183
+ el.focus(options);
184
+ else
185
+ super.focus(options);
186
+ }
187
+ updateValidity() {
188
+ const anchor = this.shadowRoot?.querySelector(".checkbox-container");
189
+ if (this.disabled) {
190
+ this.applyValidity({});
191
+ return;
192
+ }
193
+ if (this.required && !this.checked) {
194
+ this.applyValidity({ valueMissing: true }, nativeMessage("input", { type: "checkbox", required: true }), anchor ?? undefined);
195
+ }
196
+ else {
197
+ this.applyValidity({});
198
+ }
199
+ }
200
+ get checked() {
201
+ return this.getProperty("checked");
202
+ }
203
+ set checked(value) {
204
+ this.setProperty("checked", value);
205
+ }
206
+ get indeterminate() {
207
+ return this.getProperty("indeterminate");
208
+ }
209
+ set indeterminate(value) {
210
+ this.setProperty("indeterminate", value);
211
+ }
212
+ get value() {
213
+ return this.getProperty("value");
214
+ }
215
+ set value(val) {
216
+ this.setProperty("value", val);
217
+ }
218
+ get name() {
219
+ return this.getProperty("name");
220
+ }
221
+ set name(val) {
222
+ this.setProperty("name", val);
223
+ }
224
+ get disabled() {
225
+ return this.getProperty("disabled");
226
+ }
227
+ set disabled(value) {
228
+ this.setProperty("disabled", value);
229
+ }
230
+ get required() {
231
+ return this.getProperty("required");
232
+ }
233
+ set required(value) {
234
+ this.setProperty("required", value);
235
+ }
236
+ get size() {
237
+ return this.getProperty("size");
238
+ }
239
+ set size(value) {
240
+ this.setProperty("size", value);
241
+ }
242
+ get flavor() {
243
+ return this.getProperty("flavor");
244
+ }
245
+ set flavor(value) {
246
+ this.setProperty("flavor", value);
247
+ }
248
+ get form() {
249
+ return this._internals.form;
250
+ }
318
251
  }
319
252
  TyCheckbox.formAssociated = true;
320
- // ============================================================================
321
- // PROPERTY CONFIGURATION - Declarative property lifecycle
322
- // ============================================================================
253
+ TyCheckbox.delegatesFocus = true;
254
+ TyCheckbox.labelClicks = true;
323
255
  TyCheckbox.properties = {
324
- // Core boolean state
325
- checked: {
326
- type: "boolean",
327
- visual: true,
328
- formValue: true, // Triggers form value update
329
- emitChange: true, // Emits 'prop:change' event
330
- default: false,
331
- },
332
- // Form submission value (when checked)
333
- value: {
334
- type: "string",
335
- default: "on",
336
- },
337
- name: {
338
- type: "string",
339
- default: "",
340
- },
341
- disabled: {
342
- type: "boolean",
343
- visual: true,
344
- default: false,
345
- },
346
- required: {
347
- type: "boolean",
348
- visual: true,
349
- default: false,
350
- },
351
- size: {
352
- type: "string",
353
- visual: true,
354
- default: "md",
355
- validate: (v) => ["xs", "sm", "md", "lg", "xl"].includes(v),
356
- coerce: (v) => {
357
- if (!["xs", "sm", "md", "lg", "xl"].includes(v)) {
358
- console.warn(`[ty-checkbox] Invalid size '${v}'. Using 'md'.`);
359
- return "md";
360
- }
361
- return v;
362
- },
363
- },
364
- flavor: {
365
- type: "string",
366
- visual: true,
367
- default: "neutral",
368
- validate: (v) => {
369
- const valid = [
370
- "primary",
371
- "secondary",
372
- "success",
373
- "danger",
374
- "warning",
375
- "neutral",
376
- ];
377
- return valid.includes(v);
378
- },
379
- coerce: (v) => {
380
- const valid = [
381
- "primary",
382
- "secondary",
383
- "success",
384
- "danger",
385
- "warning",
386
- "neutral",
387
- ];
388
- if (!valid.includes(v)) {
389
- console.warn(`[ty-checkbox] Invalid flavor '${v}'. Using 'neutral'.`);
390
- return "neutral";
391
- }
392
- return v;
393
- },
394
- },
256
+ checked: {
257
+ type: "boolean",
258
+ visual: true,
259
+ formValue: true,
260
+ emitChange: true,
261
+ default: false,
262
+ },
263
+ indeterminate: {
264
+ type: "boolean",
265
+ visual: true,
266
+ default: false,
267
+ },
268
+ value: {
269
+ type: "string",
270
+ default: "on",
271
+ },
272
+ name: {
273
+ type: "string",
274
+ default: "",
275
+ },
276
+ disabled: {
277
+ type: "boolean",
278
+ visual: true,
279
+ default: false,
280
+ },
281
+ required: {
282
+ type: "boolean",
283
+ visual: true,
284
+ default: false,
285
+ },
286
+ size: {
287
+ type: "string",
288
+ visual: true,
289
+ default: DEFAULT_SIZE,
290
+ validate: (v) => ["xs", "sm", "md", "lg", "xl"].includes(v),
291
+ coerce: (v) => {
292
+ if (!["xs", "sm", "md", "lg", "xl"].includes(v)) {
293
+ console.warn(`[ty-checkbox] Invalid size '${v}'. Using '${DEFAULT_SIZE}'.`);
294
+ return DEFAULT_SIZE;
295
+ }
296
+ return v;
297
+ },
298
+ },
299
+ flavor: {
300
+ type: "string",
301
+ visual: true,
302
+ default: "neutral",
303
+ },
395
304
  };
396
- // Register the custom element
397
305
  if (!customElements.get("ty-checkbox")) {
398
- customElements.define("ty-checkbox", TyCheckbox);
306
+ customElements.define("ty-checkbox", TyCheckbox);
399
307
  }
400
- //# sourceMappingURL=checkbox.js.map