revotech-ui-kit 0.0.0 → 0.0.2-beta

Sign up to get free protection for your applications and to get access to all the features.
Files changed (307) hide show
  1. package/.github/workflows/deploy-storybook.yml +107 -0
  2. package/.storybook/main.ts +3 -3
  3. package/assume_role.sh +18 -0
  4. package/dist/183c6c38.js +1 -0
  5. package/dist/f28fd4b1.js +1 -0
  6. package/dist/index.ts +1 -0
  7. package/dist/public/globals.css +2215 -0
  8. package/dist/public/tailwind-lib.css +115 -0
  9. package/dist/src/assets/icons/arrows.icon.js +20 -0
  10. package/dist/src/assets/icons/arrows.icon.js.map +1 -0
  11. package/dist/src/assets/icons/index.js +4 -0
  12. package/dist/src/assets/icons/index.js.map +1 -0
  13. package/dist/src/assets/icons/search.icon.js +19 -0
  14. package/dist/src/assets/icons/search.icon.js.map +1 -0
  15. package/dist/src/assets/icons/tick.icon.js +20 -0
  16. package/dist/src/assets/icons/tick.icon.js.map +1 -0
  17. package/dist/src/components/atoms/alert/alert-description.js +18 -0
  18. package/dist/src/components/atoms/alert/alert-description.js.map +1 -0
  19. package/dist/src/components/atoms/alert/alert-title.js +20 -0
  20. package/dist/src/components/atoms/alert/alert-title.js.map +1 -0
  21. package/dist/src/components/atoms/alert/alert.atom.js +55 -0
  22. package/dist/src/components/atoms/alert/alert.atom.js.map +1 -0
  23. package/dist/src/components/atoms/alert/alert.stories.js +62 -0
  24. package/dist/src/components/atoms/alert/alert.stories.js.map +1 -0
  25. package/dist/src/components/atoms/alert/alert.styles.js +21 -0
  26. package/dist/src/components/atoms/alert/alert.styles.js.map +1 -0
  27. package/dist/src/components/atoms/alert/alert.types.js +2 -0
  28. package/dist/src/components/atoms/alert/alert.types.js.map +1 -0
  29. package/dist/src/components/atoms/badge/badge.atom.js +43 -0
  30. package/dist/src/components/atoms/badge/badge.atom.js.map +1 -0
  31. package/dist/src/components/atoms/badge/badge.stories.js +110 -0
  32. package/dist/src/components/atoms/badge/badge.stories.js.map +1 -0
  33. package/dist/src/components/atoms/badge/badge.style.js +17 -0
  34. package/dist/src/components/atoms/badge/badge.style.js.map +1 -0
  35. package/dist/src/components/atoms/badge/badge.type.js +2 -0
  36. package/dist/src/components/atoms/badge/badge.type.js.map +1 -0
  37. package/dist/src/components/atoms/button/button.atom.js +67 -0
  38. package/dist/src/components/atoms/button/button.atom.js.map +1 -0
  39. package/dist/src/components/atoms/button/button.stories.js +204 -0
  40. package/dist/src/components/atoms/button/button.stories.js.map +1 -0
  41. package/dist/src/components/atoms/button/button.style.js +24 -0
  42. package/dist/src/components/atoms/button/button.style.js.map +1 -0
  43. package/dist/src/components/atoms/button/button.type.js +2 -0
  44. package/dist/src/components/atoms/button/button.type.js.map +1 -0
  45. package/dist/src/components/atoms/card/card-content.js +17 -0
  46. package/dist/src/components/atoms/card/card-content.js.map +1 -0
  47. package/dist/src/components/atoms/card/card-description.js +17 -0
  48. package/dist/src/components/atoms/card/card-description.js.map +1 -0
  49. package/dist/src/components/atoms/card/card-footer.js +17 -0
  50. package/dist/src/components/atoms/card/card-footer.js.map +1 -0
  51. package/dist/src/components/atoms/card/card-header.js +17 -0
  52. package/dist/src/components/atoms/card/card-header.js.map +1 -0
  53. package/dist/src/components/atoms/card/card-title.js +17 -0
  54. package/dist/src/components/atoms/card/card-title.js.map +1 -0
  55. package/dist/src/components/atoms/card/card.atom.js +25 -0
  56. package/dist/src/components/atoms/card/card.atom.js.map +1 -0
  57. package/dist/src/components/atoms/card/card.stories.js +136 -0
  58. package/dist/src/components/atoms/card/card.stories.js.map +1 -0
  59. package/dist/src/components/atoms/checkbox/checkbox.atom.js +87 -0
  60. package/dist/src/components/atoms/checkbox/checkbox.atom.js.map +1 -0
  61. package/dist/src/components/atoms/checkbox/checkbox.stories.js +244 -0
  62. package/dist/src/components/atoms/checkbox/checkbox.stories.js.map +1 -0
  63. package/dist/src/components/atoms/checkbox/checkbox.style.js +3 -0
  64. package/dist/src/components/atoms/checkbox/checkbox.style.js.map +1 -0
  65. package/dist/src/components/atoms/checkbox/checkbox.type.js +2 -0
  66. package/dist/src/components/atoms/checkbox/checkbox.type.js.map +1 -0
  67. package/dist/src/components/atoms/combo-box/combo-box-input.js +47 -0
  68. package/dist/src/components/atoms/combo-box/combo-box-input.js.map +1 -0
  69. package/dist/src/components/atoms/combo-box/combo-box-item.js +85 -0
  70. package/dist/src/components/atoms/combo-box/combo-box-item.js.map +1 -0
  71. package/dist/src/components/atoms/combo-box/combo-box-list.js +67 -0
  72. package/dist/src/components/atoms/combo-box/combo-box-list.js.map +1 -0
  73. package/dist/src/components/atoms/combo-box/combo-box.atom.js +199 -0
  74. package/dist/src/components/atoms/combo-box/combo-box.atom.js.map +1 -0
  75. package/dist/src/components/atoms/combo-box/combo-box.stories.js +86 -0
  76. package/dist/src/components/atoms/combo-box/combo-box.stories.js.map +1 -0
  77. package/dist/src/components/atoms/command-empty/command-empty.atom.js +54 -0
  78. package/dist/src/components/atoms/command-empty/command-empty.atom.js.map +1 -0
  79. package/dist/src/components/atoms/command-group/command-group.atom.js +71 -0
  80. package/dist/src/components/atoms/command-group/command-group.atom.js.map +1 -0
  81. package/dist/src/components/atoms/command-item/command-item.atom.js +80 -0
  82. package/dist/src/components/atoms/command-item/command-item.atom.js.map +1 -0
  83. package/dist/src/components/atoms/command-list/command-list.atom.js +36 -0
  84. package/dist/src/components/atoms/command-list/command-list.atom.js.map +1 -0
  85. package/dist/src/components/atoms/command-separator/command-separator.atom.js +52 -0
  86. package/dist/src/components/atoms/command-separator/command-separator.atom.js.map +1 -0
  87. package/dist/src/components/atoms/dialog/dialog-close.js +47 -0
  88. package/dist/src/components/atoms/dialog/dialog-close.js.map +1 -0
  89. package/dist/src/components/atoms/dialog/dialog-content.js +72 -0
  90. package/dist/src/components/atoms/dialog/dialog-content.js.map +1 -0
  91. package/dist/src/components/atoms/dialog/dialog-footer.js +22 -0
  92. package/dist/src/components/atoms/dialog/dialog-footer.js.map +1 -0
  93. package/dist/src/components/atoms/dialog/dialog-header.js +40 -0
  94. package/dist/src/components/atoms/dialog/dialog-header.js.map +1 -0
  95. package/dist/src/components/atoms/dialog/dialog-overly.js +20 -0
  96. package/dist/src/components/atoms/dialog/dialog-overly.js.map +1 -0
  97. package/dist/src/components/atoms/dialog/dialog-trigger.js +54 -0
  98. package/dist/src/components/atoms/dialog/dialog-trigger.js.map +1 -0
  99. package/dist/src/components/atoms/dialog/dialog.atom.js +79 -0
  100. package/dist/src/components/atoms/dialog/dialog.atom.js.map +1 -0
  101. package/dist/src/components/atoms/dialog/dialog.stories.js +88 -0
  102. package/dist/src/components/atoms/dialog/dialog.stories.js.map +1 -0
  103. package/dist/src/components/atoms/dropdownMenu/dropdown-menu-checkbox-Item.js +117 -0
  104. package/dist/src/components/atoms/dropdownMenu/dropdown-menu-checkbox-Item.js.map +1 -0
  105. package/dist/src/components/atoms/dropdownMenu/dropdown-menu-content.js +81 -0
  106. package/dist/src/components/atoms/dropdownMenu/dropdown-menu-content.js.map +1 -0
  107. package/dist/src/components/atoms/dropdownMenu/dropdown-menu-group.js +71 -0
  108. package/dist/src/components/atoms/dropdownMenu/dropdown-menu-group.js.map +1 -0
  109. package/dist/src/components/atoms/dropdownMenu/dropdown-menu-item.js +80 -0
  110. package/dist/src/components/atoms/dropdownMenu/dropdown-menu-item.js.map +1 -0
  111. package/dist/src/components/atoms/dropdownMenu/dropdown-menu-radio-item.js +118 -0
  112. package/dist/src/components/atoms/dropdownMenu/dropdown-menu-radio-item.js.map +1 -0
  113. package/dist/src/components/atoms/dropdownMenu/dropdown-menu-seperator.js +52 -0
  114. package/dist/src/components/atoms/dropdownMenu/dropdown-menu-seperator.js.map +1 -0
  115. package/dist/src/components/atoms/dropdownMenu/dropdown-menu-shortcut.js +20 -0
  116. package/dist/src/components/atoms/dropdownMenu/dropdown-menu-shortcut.js.map +1 -0
  117. package/dist/src/components/atoms/dropdownMenu/dropdown-menu.atom.js +79 -0
  118. package/dist/src/components/atoms/dropdownMenu/dropdown-menu.atom.js.map +1 -0
  119. package/dist/src/components/atoms/dropdownMenu/dropdownMenu.stories.js +211 -0
  120. package/dist/src/components/atoms/dropdownMenu/dropdownMenu.stories.js.map +1 -0
  121. package/dist/src/components/atoms/dropdownMenu/dropdownMenu.style.js +4 -0
  122. package/dist/src/components/atoms/dropdownMenu/dropdownMenu.style.js.map +1 -0
  123. package/dist/src/components/atoms/index.js +14 -0
  124. package/dist/src/components/atoms/index.js.map +1 -0
  125. package/dist/src/components/atoms/input/input.atom.js +93 -0
  126. package/dist/src/components/atoms/input/input.atom.js.map +1 -0
  127. package/dist/src/components/atoms/input/input.stories.js +382 -0
  128. package/dist/src/components/atoms/input/input.stories.js.map +1 -0
  129. package/dist/src/components/atoms/input/input.styles.js +2 -0
  130. package/dist/src/components/atoms/input/input.styles.js.map +1 -0
  131. package/dist/src/components/atoms/input/input.type.js +2 -0
  132. package/dist/src/components/atoms/input/input.type.js.map +1 -0
  133. package/dist/src/components/atoms/label/label.atom.js +68 -0
  134. package/dist/src/components/atoms/label/label.atom.js.map +1 -0
  135. package/dist/src/components/atoms/label/label.stories.js +85 -0
  136. package/dist/src/components/atoms/label/label.stories.js.map +1 -0
  137. package/dist/src/components/atoms/label/label.style.js +3 -0
  138. package/dist/src/components/atoms/label/label.style.js.map +1 -0
  139. package/dist/src/components/atoms/popover/popover-content.js +64 -0
  140. package/dist/src/components/atoms/popover/popover-content.js.map +1 -0
  141. package/dist/src/components/atoms/popover/popover-trigger.js +51 -0
  142. package/dist/src/components/atoms/popover/popover-trigger.js.map +1 -0
  143. package/dist/src/components/atoms/popover/popover.atom.js +40 -0
  144. package/dist/src/components/atoms/popover/popover.atom.js.map +1 -0
  145. package/dist/src/components/atoms/popover/popover.stories.js +69 -0
  146. package/dist/src/components/atoms/popover/popover.stories.js.map +1 -0
  147. package/dist/src/components/atoms/popover/popover.style.js +21 -0
  148. package/dist/src/components/atoms/popover/popover.style.js.map +1 -0
  149. package/dist/src/components/atoms/popover/popover.types.js +4 -0
  150. package/dist/src/components/atoms/popover/popover.types.js.map +1 -0
  151. package/dist/src/components/atoms/toggle/defs.js +30 -0
  152. package/dist/src/components/atoms/toggle/defs.js.map +1 -0
  153. package/dist/src/components/atoms/toggle/toggle.atom.js +72 -0
  154. package/dist/src/components/atoms/toggle/toggle.atom.js.map +1 -0
  155. package/dist/src/components/atoms/toggle/toggle.stories.js +189 -0
  156. package/dist/src/components/atoms/toggle/toggle.stories.js.map +1 -0
  157. package/dist/src/components/atoms/toggle/toggle.style.js +19 -0
  158. package/dist/src/components/atoms/toggle/toggle.style.js.map +1 -0
  159. package/dist/src/components/command/command.js +410 -0
  160. package/dist/src/components/command/command.js.map +1 -0
  161. package/dist/src/components/command/command.stories.js +153 -0
  162. package/dist/src/components/command/command.stories.js.map +1 -0
  163. package/dist/src/components/index.js +3 -0
  164. package/dist/src/components/index.js.map +1 -0
  165. package/dist/src/components/molecules/command/command.molecules.js +27 -0
  166. package/dist/src/components/molecules/command/command.molecules.js.map +1 -0
  167. package/dist/src/components/molecules/command-input/command-input.atom.js +127 -0
  168. package/dist/src/components/molecules/command-input/command-input.atom.js.map +1 -0
  169. package/dist/src/components/molecules/dropdownMenu/dropdownMenu.molecules.js +2 -0
  170. package/dist/src/components/molecules/dropdownMenu/dropdownMenu.molecules.js.map +1 -0
  171. package/dist/src/components/molecules/index.js +2 -0
  172. package/dist/src/components/molecules/index.js.map +1 -0
  173. package/dist/src/helpers/base-element.js +64 -0
  174. package/dist/src/helpers/base-element.js.map +1 -0
  175. package/dist/src/helpers/index.js +4 -0
  176. package/dist/src/helpers/index.js.map +1 -0
  177. package/dist/src/helpers/mouse-conroller.helper.js +33 -0
  178. package/dist/src/helpers/mouse-conroller.helper.js.map +1 -0
  179. package/dist/src/helpers/style.helpers.js +6 -0
  180. package/dist/src/helpers/style.helpers.js.map +1 -0
  181. package/dist/src/index.js +2 -0
  182. package/dist/src/index.js.map +1 -0
  183. package/dist/src/interfaces/actionable.interface.js +2 -0
  184. package/dist/src/interfaces/actionable.interface.js.map +1 -0
  185. package/dist/src/interfaces/atomic.interface.js +2 -0
  186. package/dist/src/interfaces/atomic.interface.js.map +1 -0
  187. package/dist/src/interfaces/changeable.interface.js +2 -0
  188. package/dist/src/interfaces/changeable.interface.js.map +1 -0
  189. package/dist/src/interfaces/child-support-atomic.interface.js +2 -0
  190. package/dist/src/interfaces/child-support-atomic.interface.js.map +1 -0
  191. package/dist/src/interfaces/index.js +7 -0
  192. package/dist/src/interfaces/index.js.map +1 -0
  193. package/dist/src/interfaces/intractable.interface.js +2 -0
  194. package/dist/src/interfaces/intractable.interface.js.map +1 -0
  195. package/dist/src/interfaces/variant.interface.js +2 -0
  196. package/dist/src/interfaces/variant.interface.js.map +1 -0
  197. package/dist/src/lib/index.js +2 -0
  198. package/dist/src/lib/index.js.map +1 -0
  199. package/dist/src/lib/next/next.lib.js +2 -0
  200. package/dist/src/lib/next/next.lib.js.map +1 -0
  201. package/dist/src/lib/react/react.lib.js +16 -0
  202. package/dist/src/lib/react/react.lib.js.map +1 -0
  203. package/dist/src/lib/tw-styles.js +1956 -0
  204. package/dist/src/lib/tw-styles.js.map +1 -0
  205. package/dist/src/styles/index.js +2 -0
  206. package/dist/src/styles/index.js.map +1 -0
  207. package/dist/src/styles/tw.styles.js +2218 -0
  208. package/dist/src/styles/tw.styles.js.map +1 -0
  209. package/dist/src/wc-ui-app.js +88 -0
  210. package/dist/src/wc-ui-app.js.map +1 -0
  211. package/dist/sw.js +2 -0
  212. package/dist/sw.js.map +1 -0
  213. package/dist/test/wc-ui-app.test.js +18 -0
  214. package/dist/test/wc-ui-app.test.js.map +1 -0
  215. package/dist/tsconfig.tsbuildinfo +1 -0
  216. package/dist/workbox-a523fd56.js +2 -0
  217. package/dist/workbox-a523fd56.js.map +1 -0
  218. package/index.html +18 -66
  219. package/package.json +41 -18
  220. package/rollup.config.js +25 -13
  221. package/src/assets/icons/arrows.icon.ts +20 -0
  222. package/src/assets/icons/index.ts +3 -0
  223. package/src/assets/icons/search.icon.ts +19 -0
  224. package/src/assets/icons/tick.icon.ts +20 -0
  225. package/src/chai-custom.d.ts +0 -0
  226. package/src/components/atoms/alert/alert-description.ts +15 -0
  227. package/src/components/atoms/alert/alert-title.ts +17 -0
  228. package/src/components/atoms/alert/alert.atom.ts +51 -0
  229. package/src/components/atoms/alert/alert.stories.ts +71 -0
  230. package/src/components/atoms/alert/alert.styles.ts +21 -0
  231. package/src/components/atoms/alert/alert.types.ts +1 -0
  232. package/src/components/atoms/badge/badge.atom.ts +40 -0
  233. package/src/components/atoms/badge/badge.stories.ts +118 -0
  234. package/src/components/atoms/badge/badge.style.ts +24 -0
  235. package/src/components/atoms/badge/badge.type.ts +7 -0
  236. package/src/components/atoms/button/button.atom.ts +22 -8
  237. package/src/components/atoms/button/button.stories.ts +177 -139
  238. package/src/components/atoms/card/card-content.ts +15 -0
  239. package/src/components/atoms/card/card-description.ts +15 -0
  240. package/src/components/atoms/card/card-footer.ts +15 -0
  241. package/src/components/atoms/card/card-header.ts +15 -0
  242. package/src/components/atoms/card/card-title.ts +15 -0
  243. package/src/components/atoms/card/card.atom.ts +31 -0
  244. package/src/components/atoms/card/card.stories.ts +149 -0
  245. package/src/components/atoms/checkbox/checkbox.atom.ts +30 -16
  246. package/src/components/atoms/checkbox/checkbox.stories.ts +292 -25
  247. package/src/components/atoms/checkbox/checkbox.style.ts +5 -0
  248. package/src/components/atoms/checkbox/checkbox.type.ts +24 -0
  249. package/src/components/atoms/combo-box/combo-box-input.ts +33 -0
  250. package/src/components/atoms/combo-box/combo-box-item.ts +59 -0
  251. package/src/components/atoms/combo-box/combo-box-list.ts +57 -0
  252. package/src/components/atoms/combo-box/combo-box.atom.ts +187 -0
  253. package/src/components/atoms/combo-box/combo-box.stories.ts +95 -0
  254. package/src/components/atoms/command-empty/command-empty.atom.ts +2 -2
  255. package/src/components/atoms/command-group/command-group.atom.ts +1 -1
  256. package/src/components/atoms/command-item/command-item.atom.ts +2 -2
  257. package/src/components/atoms/command-list/command-list.atom.ts +2 -2
  258. package/src/components/atoms/command-separator/command-separator.atom.ts +2 -2
  259. package/src/components/atoms/dialog/dialog-close.ts +50 -0
  260. package/src/components/atoms/dialog/dialog-content.ts +71 -0
  261. package/src/components/atoms/dialog/dialog-footer.ts +22 -0
  262. package/src/components/atoms/dialog/dialog-header.ts +36 -0
  263. package/src/components/atoms/dialog/dialog-overly.ts +20 -0
  264. package/src/components/atoms/dialog/dialog-trigger.ts +54 -0
  265. package/src/components/atoms/dialog/dialog.atom.ts +3 -226
  266. package/src/components/atoms/dialog/dialog.stories.ts +11 -4
  267. package/src/components/atoms/dropdownMenu/dropdown-menu-checkbox-Item.ts +106 -0
  268. package/src/components/atoms/dropdownMenu/dropdown-menu-content.ts +79 -0
  269. package/src/components/atoms/dropdownMenu/dropdown-menu-group.ts +60 -0
  270. package/src/components/atoms/dropdownMenu/dropdown-menu-item.ts +74 -0
  271. package/src/components/atoms/dropdownMenu/dropdown-menu-radio-item.ts +107 -0
  272. package/src/components/atoms/dropdownMenu/dropdown-menu-seperator.ts +44 -0
  273. package/src/components/atoms/dropdownMenu/dropdown-menu-shortcut.ts +17 -0
  274. package/src/components/atoms/dropdownMenu/dropdown-menu.atom.ts +84 -0
  275. package/src/components/atoms/dropdownMenu/dropdownMenu.stories.ts +220 -0
  276. package/src/components/atoms/dropdownMenu/dropdownMenu.style.ts +7 -0
  277. package/src/components/atoms/index.ts +3 -0
  278. package/src/components/atoms/input/input.atom.ts +64 -10
  279. package/src/components/atoms/input/input.stories.ts +426 -64
  280. package/src/components/atoms/input/input.styles.ts +2 -0
  281. package/src/components/atoms/input/input.type.ts +42 -8
  282. package/src/components/atoms/label/label.atom.ts +31 -7
  283. package/src/components/atoms/label/label.stories.ts +87 -3
  284. package/src/components/atoms/popover/popover-content.ts +58 -0
  285. package/src/components/atoms/popover/popover-trigger.ts +50 -0
  286. package/src/components/atoms/popover/popover.atom.ts +34 -0
  287. package/src/components/atoms/popover/popover.stories.ts +79 -0
  288. package/src/components/atoms/popover/popover.style.ts +25 -0
  289. package/src/components/atoms/popover/popover.types.ts +3 -0
  290. package/src/components/atoms/toggle/defs.ts +29 -0
  291. package/src/components/atoms/toggle/toggle.atom.ts +58 -0
  292. package/src/components/atoms/toggle/toggle.stories.ts +204 -0
  293. package/src/components/atoms/toggle/toggle.style.ts +22 -0
  294. package/src/components/molecules/command/command.molecules.ts +2 -2
  295. package/src/components/molecules/command-input/command-input.atom.ts +3 -3
  296. package/src/components/molecules/dropdownMenu/dropdownMenu.molecules.ts +0 -0
  297. package/src/globals.css +475 -66
  298. package/src/helpers/base-element.ts +79 -0
  299. package/src/helpers/index.ts +1 -0
  300. package/src/index.ts +0 -0
  301. package/src/lib/react/react.lib.ts +18 -0
  302. package/src/lib/tw-styles.ts +1957 -0
  303. package/src/styles/tw.styles.ts +2051 -1699
  304. package/src/tailwind-lib.css +26 -6
  305. package/tailwind.config.js +174 -38
  306. package/tsconfig.json +6 -1
  307. package/src/components/popover.ts +0 -247
@@ -0,0 +1 @@
1
+ {"version":3,"file":"card.stories.js","sourceRoot":"","sources":["../../../../../src/components/atoms/card/card.stories.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAE3B,OAAO,EAAE,MAAM,EAAE,MAAM,EAAM,OAAO,EAAa,MAAM,iBAAiB,CAAC;AACzE,OAAO,aAAa,CAAC;AAErB,eAAe;IACb,SAAS,EAAE,iBAAiB;IAC5B,IAAI,EAAE,CAAC,UAAU,CAAC;CACX,CAAC;AAIV,MAAM,gBAAgB,GAAG,KAAK,EAAE,IAAS,EAAE,aAA0B,EAAE,EAAE;IACvE,MAAM,MAAM,GAAG,MAAM,CAAC,aAAa,CAAC,CAAC;IACrC,MAAM,IAAI,GAAG,MAAM,OAAO,CAAC,GAAG,EAAE,CAAC,MAAM,CAAC,WAAW,CAAC,SAAS,CAAC,CAAC,CAAC;IAChE,MAAM,UAAU,GAAG,MAAM,OAAO,CAAC,GAAG,EAAE,CAAC,MAAM,CAAC,WAAW,CAAC,gBAAgB,CAAC,CAAC,CAAC;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pB,MAAM,CAAC,eAAe,CAAC,WAAW,CAAC,CAAC,SAAS,CAC3C,uCAAuC,CACxC,CAAC;QACF,MAAM,CAAC,eAAe,CAAC,OAAO,CAAC,WAAW,EAAE,CAAC,CAAC,OAAO,CAAC,iBAAiB,CAAC,CAAC;IAC3E,CAAC;AACH,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,KAAK,GAAU;IAC1B,IAAI,EAAE,OAAO;IACb,MAAM,EAAE,GAAG,EAAE,CAAC,IAAI,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyFjB;IACD,IAAI,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE,aAAa,EAAE,EAAE,EAAE;QACtC,IAAI,CAAC;YACH,MAAM,gBAAgB,CAAC,IAAI,EAAE,aAAa,CAAC,CAAC;QAC9C,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,CAAC,KAAK,CAAC,6CAA6C,EAAE,KAAK,CAAC,CAAC;QACtE,CAAC;IACH,CAAC;CACF,CAAC","sourcesContent":["import { html } from 'lit';\nimport type { Meta, StoryFn, StoryObj } from '@storybook/web-components';\nimport { expect, within, fn, waitFor, userEvent } from '@storybook/test';\nimport './card.atom';\n\nexport default {\n component: 'components/card',\n tags: ['autodocs'],\n} as Meta;\n\ntype Story = StoryObj;\n\nconst testCardBehavior = async (args: any, canvasElement: HTMLElement) => {\n const canvas = within(canvasElement);\n const card = await waitFor(() => canvas.getByTestId('card-id'));\n const cardHeader = await waitFor(() => canvas.getByTestId('card-header-id'));\n const cardTitle = await waitFor(() => canvas.getByTestId('card-title-id'));\n const cardDescription = await waitFor(() =>\n canvas.getByTestId('card-description-id')\n );\n const cardContent = await waitFor(() =>\n canvas.getByTestId('card-content-id')\n );\n const cardFooter = await waitFor(() => canvas.getByTestId('card-footer-id'));\n expect(card).toBeVisible();\n expect(cardHeader).toBeVisible();\n expect(cardTitle).toBeVisible();\n expect(cardDescription).toBeVisible();\n expect(cardContent).toBeVisible();\n expect(cardFooter).toBeVisible();\n\n if (card.shadowRoot) {\n const cardItem = await card.shadowRoot.getElementById('rtg-card-id');\n expect(cardItem).toHaveClass(\n 'rounded-lg border bg-card text-card-foreground shadow-sm p-6'\n );\n }\n if (cardTitle) {\n expect(cardTitle.textContent).toContain('Create project');\n expect(cardTitle.tagName.toLowerCase()).toEqual('cardtitle');\n }\n if (cardDescription) {\n expect(cardDescription.textContent).toContain(\n 'Deploy your new project in one-click.'\n );\n expect(cardDescription.tagName.toLowerCase()).toEqual('carddescription');\n }\n};\n\nexport const Cards: Story = {\n name: 'Cards',\n render: () => html`\n <rtg-card data-testid=\"card-id\">\n <CardHeader data-testid=\"card-header-id\">\n <CardTitle data-testid=\"card-title-id\">\n <h3>Create project</h3>\n </CardTitle>\n <CardDescription data-testid=\"card-description-id\">\n <p class=\"text-sm text-muted-foreground\">\n Deploy your new project in one-click.\n </p>\n </CardDescription>\n </CardHeader>\n <CardContent data-testid=\"card-content-id\">\n <form class=\"pt-4\">\n <div class=\"grid w-full items-center gap-4\">\n <div class=\"flex flex-col space-y-1.5\">\n <label\n class=\"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70\"\n for=\"name\"\n >Name</label\n ><input\n class=\"flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50\"\n id=\"name\"\n placeholder=\"Name of your project\"\n />\n </div>\n <div class=\"flex flex-col space-y-1.5\">\n <label\n class=\"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70\"\n for=\"framework\"\n >Framework</label\n ><button\n type=\"button\"\n role=\"combobox\"\n aria-controls=\"radix-:r2b:\"\n aria-expanded=\"false\"\n aria-autocomplete=\"none\"\n dir=\"ltr\"\n data-state=\"closed\"\n data-placeholder=\"\"\n class=\"flex h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 [&amp;>span]:line-clamp-1\"\n id=\"framework\"\n >\n <span style=\"pointer-events: none;\">Select</span\n ><svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"24\"\n height=\"24\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n class=\"lucide lucide-chevron-down h-4 w-4 opacity-50\"\n aria-hidden=\"true\"\n >\n <path d=\"m6 9 6 6 6-6\"></path>\n </svg></button\n ><select\n aria-hidden=\"true\"\n tabindex=\"-1\"\n style=\"position: absolute; border: 0px; width: 1px; height: 1px; padding: 0px; margin: -1px; overflow: hidden; clip: rect(0px, 0px, 0px, 0px); white-space: nowrap; overflow-wrap: normal;\"\n >\n <option value=\"\"></option>\n <option value=\"next\">Next.js</option>\n <option value=\"sveltekit\">SvelteKit</option>\n <option value=\"astro\">Astro</option>\n <option value=\"nuxt\">Nuxt.js</option>\n </select>\n </div>\n </div>\n </form>\n </CardContent>\n <CardFooter data-testid=\"card-footer-id\">\n <div class=\"items-center pt-4 flex justify-between\">\n <button\n class=\"inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 border border-input bg-background hover:bg-accent hover:text-accent-foreground h-10 px-4 py-2\"\n >\n Cancel\n </button>\n <button\n class=\"inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 bg-primary text-primary-foreground hover:bg-primary/90 h-10 px-4 py-2\"\n >\n Deploy\n </button>\n </div>\n </CardFooter>\n </rtg-card>\n `,\n play: async ({ args, canvasElement }) => {\n try {\n await testCardBehavior(args, canvasElement);\n } catch (error) {\n console.error('An error occurred during the play function:', error);\n }\n },\n};\n"]}
@@ -0,0 +1,87 @@
1
+ import { __decorate } from "tslib";
2
+ import { LitElement, html, css, nothing } from 'lit';
3
+ import { property, customElement } from 'lit/decorators.js';
4
+ import { cn } from '../../../helpers';
5
+ import { TWStyles } from '../../../styles';
6
+ import { checkboxStyles, iconStyles } from './checkbox.style';
7
+ let Checkbox = class Checkbox extends LitElement {
8
+ constructor() {
9
+ super(...arguments);
10
+ this.disabled = false;
11
+ this.checked = false;
12
+ this.type = 'text';
13
+ this.value = '';
14
+ this.required = false;
15
+ }
16
+ _onClick(e) {
17
+ if (e.defaultPrevented)
18
+ return;
19
+ this.checked = !this.checked;
20
+ this.required = !this.required;
21
+ // Dispatch a custom change event when the state changes
22
+ this.dispatchEvent(new Event('change', { bubbles: true, composed: true }));
23
+ }
24
+ click() {
25
+ this.checked = !this.checked;
26
+ this.required = !this.required;
27
+ }
28
+ render() {
29
+ const additionalProps = { ...this.dataset }; // Example of additional props
30
+ return html `
31
+ <button
32
+ data-testid="checkbox-atom"
33
+ type="button"
34
+ role="checkbox"
35
+ aria-checked="${this.checked || this.value === 'on'}"
36
+ data-state="${this.checked || this.value === 'on'
37
+ ? 'checked'
38
+ : 'unchecked'}"
39
+ value="${this.value}"
40
+ ?required=${this.required}
41
+ ?disabled=${this.disabled}
42
+ @click="${this._onClick}"
43
+ class="${cn(checkboxStyles, this.className)}"
44
+ ${Object.entries(additionalProps).map(([key, value]) => html ` ${key}="${value}" `)}
45
+ >
46
+ ${this.checked || this.value === 'on'
47
+ ? html `<span data-state="checked" class="${iconStyles}"
48
+ ><svg
49
+ xmlns="http://www.w3.org/2000/svg"
50
+ width="24"
51
+ height="24"
52
+ viewBox="0 0 24 24"
53
+ fill="none"
54
+ stroke="currentColor"
55
+ stroke-width="3"
56
+ stroke-linecap="round"
57
+ stroke-linejoin="round"
58
+ class="h-4 w-4"
59
+ >
60
+ <polyline points="20 6 9 17 4 12"></polyline></svg
61
+ ></span>`
62
+ : nothing}
63
+ </button>
64
+ `;
65
+ }
66
+ };
67
+ Checkbox.styles = [css ``, TWStyles];
68
+ __decorate([
69
+ property({ type: Boolean })
70
+ ], Checkbox.prototype, "disabled", void 0);
71
+ __decorate([
72
+ property({ type: Boolean })
73
+ ], Checkbox.prototype, "checked", void 0);
74
+ __decorate([
75
+ property({ type: String })
76
+ ], Checkbox.prototype, "type", void 0);
77
+ __decorate([
78
+ property({ type: String })
79
+ ], Checkbox.prototype, "value", void 0);
80
+ __decorate([
81
+ property({ type: Boolean })
82
+ ], Checkbox.prototype, "required", void 0);
83
+ Checkbox = __decorate([
84
+ customElement('rtg-checkbox')
85
+ ], Checkbox);
86
+ export { Checkbox };
87
+ //# sourceMappingURL=checkbox.atom.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"checkbox.atom.js","sourceRoot":"","sources":["../../../../../src/components/atoms/checkbox/checkbox.atom.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAE,OAAO,EAAE,MAAM,KAAK,CAAC;AACrD,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EAAE,EAAE,EAAE,MAAM,kBAAkB,CAAC;AACtC,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC3C,OAAO,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAIvD,IAAM,QAAQ,GAAd,MAAM,QAAS,SAAQ,UAAU;IAAjC;;QACwB,aAAQ,GAAG,KAAK,CAAC;QAEjB,YAAO,GAAG,KAAK,CAAC;QAEjB,S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AC,OAAO,IAAI,IAAI,CAAC,KAAK,KAAK,IAAI;YACnC,CAAC,CAAC,IAAI,CAAA,qCAAqC,UAAU;;;;;;;;;;;;;;qBAc1C;YACX,CAAC,CAAC,OAAO;;KAEd,CAAC;IACJ,CAAC;;AAvDM,eAAM,GAAG,CAAC,GAAG,CAAA,EAAE,EAAE,QAAQ,CAAC,AAApB,CAAqB;AAVL;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;0CAAkB;AAEjB;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;yCAAiB;AAEjB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;sCAAe;AAEd;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;uCAAY;AAEV;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;0CAAkB;AATnC,QAAQ;IADpB,aAAa,CAAC,cAAc,CAAC;GACjB,QAAQ,CAmEpB","sourcesContent":["import { LitElement, html, css, nothing } from 'lit';\nimport { property, customElement } from 'lit/decorators.js';\nimport { cn } from '../../../helpers';\nimport { TWStyles } from '../../../styles';\nimport { checkboxStyles, iconStyles } from './checkbox.style';\nimport { CheckboxProperties } from './checkbox.type';\n\n@customElement('rtg-checkbox')\nexport class Checkbox extends LitElement implements CheckboxProperties {\n @property({ type: Boolean }) disabled = false;\n\n @property({ type: Boolean }) checked = false;\n\n @property({ type: String }) type = 'text';\n\n @property({ type: String }) value = '';\n\n @property({ type: Boolean }) required = false;\n\n static styles = [css``, TWStyles];\n\n private _onClick(e: Event) {\n if (e.defaultPrevented) return;\n this.checked = !this.checked;\n this.required = !this.required;\n\n // Dispatch a custom change event when the state changes\n this.dispatchEvent(new Event('change', { bubbles: true, composed: true }));\n }\n\n public click() {\n this.checked = !this.checked;\n this.required = !this.required;\n }\n\n render() {\n const additionalProps = { ...this.dataset }; // Example of additional props\n return html`\n <button\n data-testid=\"checkbox-atom\"\n type=\"button\"\n role=\"checkbox\"\n aria-checked=\"${this.checked || this.value === 'on'}\"\n data-state=\"${this.checked || this.value === 'on'\n ? 'checked'\n : 'unchecked'}\"\n value=\"${this.value}\"\n ?required=${this.required}\n ?disabled=${this.disabled}\n @click=\"${this._onClick}\"\n class=\"${cn(checkboxStyles, this.className)}\"\n ${Object.entries(additionalProps).map(\n ([key, value]) => html` ${key}=\"${value}\" `\n )}\n >\n ${this.checked || this.value === 'on'\n ? html`<span data-state=\"checked\" class=\"${iconStyles}\"\n ><svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"24\"\n height=\"24\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"3\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n class=\"h-4 w-4\"\n >\n <polyline points=\"20 6 9 17 4 12\"></polyline></svg\n ></span>`\n : nothing}\n </button>\n `;\n }\n}\n"]}
@@ -0,0 +1,244 @@
1
+ import { html } from 'lit';
2
+ import './checkbox.atom';
3
+ import { expect, within, waitFor, fn } from '@storybook/test';
4
+ import '../button/button.atom';
5
+ const allowedTypes = ['checkbox'];
6
+ export default {
7
+ component: 'components/checkbox',
8
+ tags: ['autodocs'],
9
+ };
10
+ const mockOnClickHandler = fn(event => {
11
+ alert('submit data!');
12
+ });
13
+ const testCheckboxBehavior = async (args, canvasElement) => {
14
+ const canvas = within(canvasElement);
15
+ const checkbox = await waitFor(() => canvas.getByTestId('checkbox-id'));
16
+ if (checkbox.shadowRoot) {
17
+ const innerCheckbox = checkbox.shadowRoot.querySelector('[data-testid="checkbox-atom"]');
18
+ // 1. Test: Checkbox should have correct Role attribute
19
+ expect(innerCheckbox).toHaveRole('checkbox');
20
+ // 2. Test: Checkbox should have the correct `checked` state based on args
21
+ if (args.checked) {
22
+ expect(innerCheckbox).toBeChecked();
23
+ }
24
+ else {
25
+ expect(innerCheckbox).not.toBeChecked();
26
+ }
27
+ // 3. Test: Checkbox should be disabled when the `disabled` prop is true
28
+ if (args.disabled) {
29
+ expect(innerCheckbox).toBeDisabled();
30
+ }
31
+ else {
32
+ expect(innerCheckbox).not.toBeDisabled();
33
+ }
34
+ // 4. Test: Label should have correct `for` attribute linking to the checkbox
35
+ const label = await waitFor(() => canvas.getByText(args.label));
36
+ expect(label).toBeInTheDocument();
37
+ expect(label).toHaveAttribute('for', checkbox.getAttribute('id'));
38
+ }
39
+ };
40
+ const testCheckboxWithRequiredBehavior = async (args, canvasElement) => {
41
+ const canvas = within(canvasElement);
42
+ const checkbox = await waitFor(() => canvas.getByTestId('checkbox-id'));
43
+ const button = await waitFor(() => canvas.getByTestId('btn-id'));
44
+ if (checkbox.shadowRoot) {
45
+ const innerCheckbox = checkbox.shadowRoot.querySelector('[data-testid="checkbox-atom"]');
46
+ // Test: Checkbox should have the correct required attribute
47
+ if (args.required) {
48
+ expect(innerCheckbox).toHaveAttribute('required');
49
+ }
50
+ else {
51
+ expect(innerCheckbox).not.toHaveAttribute('required');
52
+ }
53
+ // Test: Button should be disabled when checkbox is unchecked and required is true
54
+ if (args.required && !args.checked) {
55
+ expect(button).toBeDisabled();
56
+ }
57
+ else if (args.required && args.checked) {
58
+ expect(button).not.toBeDisabled();
59
+ }
60
+ // Additional tests for the checked state
61
+ if (args.checked) {
62
+ expect(innerCheckbox).toBeChecked();
63
+ }
64
+ else {
65
+ expect(innerCheckbox).not.toBeChecked();
66
+ }
67
+ // Additional tests for the disabled state
68
+ if (args.disabled) {
69
+ expect(innerCheckbox).toBeDisabled();
70
+ }
71
+ else {
72
+ expect(innerCheckbox).not.toBeDisabled();
73
+ }
74
+ }
75
+ };
76
+ const testCheckboxWithValueBehavior = async (args, canvasElement) => {
77
+ const canvas = within(canvasElement);
78
+ const checkbox = await waitFor(() => canvas.getByTestId('checkbox-id'));
79
+ if (checkbox.shadowRoot) {
80
+ const innerCheckbox = checkbox.shadowRoot.querySelector('[data-testid="checkbox-atom"]');
81
+ // Test: Checkbox should have the correct value attribute
82
+ expect(innerCheckbox).toHaveAttribute('value', args.value);
83
+ // Additional tests for disabled state if needed
84
+ if (args.disabled) {
85
+ expect(innerCheckbox).toBeDisabled();
86
+ }
87
+ else {
88
+ expect(innerCheckbox).not.toBeDisabled();
89
+ }
90
+ }
91
+ };
92
+ const TemplatewithChecked = ({ disabled, checked, label }) => html `
93
+ <div style="display:flex">
94
+ <rtg-checkbox
95
+ id="terms"
96
+ data-testid="checkbox-id"
97
+ ?disabled=${disabled}
98
+ ?checked=${checked}
99
+ ></rtg-checkbox>
100
+ <rtg-label style="margin:2px 0px 0px 4px" for="terms">${label}</rtg-label>
101
+ </div>
102
+ `;
103
+ const TemplatewithRequired = ({ disabled, checked, label, required, }) => html `
104
+ <div style="display: flex; flex-direction: column;">
105
+ <div style="display:flex">
106
+ <rtg-checkbox
107
+ id="terms"
108
+ data-testid="checkbox-id"
109
+ ?disabled=${disabled}
110
+ ?checked=${checked}
111
+ ?required=${required}
112
+ @click=${(e) => {
113
+ const checkbox = e.target;
114
+ const button = document.querySelector('rtg-button');
115
+ if (button) {
116
+ button.disabled = required ? !checkbox.checked : false;
117
+ }
118
+ }}
119
+ ></rtg-checkbox>
120
+ <rtg-label style="margin:2px 0px 0px 4px" for="terms"
121
+ >${label}</rtg-label
122
+ >
123
+ </div>
124
+ <div style="margin-top:16px">
125
+ <rtg-button
126
+ variant="default"
127
+ size="default"
128
+ data-testid="btn-id"
129
+ ?disabled=${required ? !checked : false}
130
+ .click=${mockOnClickHandler}
131
+ >Submit</rtg-button
132
+ >
133
+ </div>
134
+ </div>
135
+ `;
136
+ const TemplateWithVlaue = ({ disabled, label, value }) => html `
137
+ <div style="display:flex">
138
+ <rtg-checkbox
139
+ id="terms"
140
+ data-testid="checkbox-id"
141
+ value=${value}
142
+ ?disabled=${disabled}
143
+ ></rtg-checkbox>
144
+ <rtg-label style="margin:2px 0px 0px 4px" for="terms">${label}</rtg-label>
145
+ </div>
146
+ `;
147
+ export const CheckboxWithReuired = TemplatewithRequired.bind({});
148
+ CheckboxWithReuired.args = {
149
+ disabled: false,
150
+ checked: false,
151
+ required: false,
152
+ label: 'Accept terms and conditions',
153
+ };
154
+ CheckboxWithReuired.parameters = {
155
+ docs: {
156
+ source: {
157
+ transform: (code, storyContext) => {
158
+ const args = storyContext.args;
159
+ // Handling boolean attributes: if true, render without value, if false, omit the attribute
160
+ const updatedCode = code
161
+ .replace(/disabled=""/g, 'disabled=true')
162
+ .replace(/checked=""/g, 'checked=true')
163
+ .replace(/required=""/g, 'required=true')
164
+ .replace(/disabled="false"/g, '')
165
+ .replace(/checked="false"/g, '')
166
+ .replace(/required="false"/g, '');
167
+ return updatedCode;
168
+ },
169
+ },
170
+ },
171
+ };
172
+ CheckboxWithReuired.argTypes = {
173
+ disabled: {
174
+ control: 'boolean',
175
+ description: 'Determines whether the checkbox is disabled (unclickable).',
176
+ table: {
177
+ defaultValue: { summary: 'false' },
178
+ },
179
+ docs: {
180
+ source: {
181
+ code: (args) => (args.disabled ? true : ''),
182
+ },
183
+ },
184
+ },
185
+ checked: {
186
+ control: 'boolean',
187
+ description: 'Specifies whether the checkbox is checked by default.',
188
+ table: {
189
+ defaultValue: { summary: 'false' },
190
+ },
191
+ },
192
+ required: {
193
+ control: 'boolean',
194
+ description: 'Marks the checkbox as a required field. When true, the checkbox must be checked for form submission, and related actions such as enabling a submit button are dependent on this state.',
195
+ table: {
196
+ defaultValue: { summary: 'false' },
197
+ },
198
+ },
199
+ label: {
200
+ control: 'text',
201
+ description: 'The text displayed next to the checkbox, describing its purpose.',
202
+ },
203
+ };
204
+ CheckboxWithReuired.play = async ({ args, canvasElement }) => {
205
+ await testCheckboxWithRequiredBehavior(args, canvasElement);
206
+ };
207
+ export const Checkbox = TemplatewithChecked.bind({});
208
+ Checkbox.args = {
209
+ disabled: false,
210
+ checked: false,
211
+ label: 'Accept terms and conditions',
212
+ };
213
+ Checkbox.argTypes = {
214
+ disabled: {
215
+ control: 'boolean',
216
+ },
217
+ checked: {
218
+ control: 'boolean',
219
+ },
220
+ label: {
221
+ control: 'text',
222
+ },
223
+ };
224
+ Checkbox.play = async ({ args, canvasElement }) => {
225
+ await testCheckboxBehavior(args, canvasElement);
226
+ };
227
+ export const CheckboxWithValue = TemplateWithVlaue.bind({});
228
+ CheckboxWithValue.args = {
229
+ disabled: false,
230
+ value: 'off',
231
+ label: 'Accept terms and conditions',
232
+ };
233
+ CheckboxWithValue.argTypes = {
234
+ disabled: { control: 'boolean' },
235
+ value: {
236
+ control: { type: 'select' },
237
+ options: ['on', 'off'],
238
+ },
239
+ label: { control: 'text' },
240
+ };
241
+ CheckboxWithValue.play = async ({ args, canvasElement }) => {
242
+ await testCheckboxWithValueBehavior(args, canvasElement);
243
+ };
244
+ //# sourceMappingURL=checkbox.stories.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"checkbox.stories.js","sourceRoot":"","sources":["../../../../../src/components/atoms/checkbox/checkbox.stories.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAC3B,OAAO,iBAAiB,CAAC;AACzB,OAAO,EAAE,MAAM,EAAE,MAAM,EAAa,OAAO,EAAE,EAAE,EAAE,MAAM,iBAAiB,CAAC;AAMzE,OAAO,uBAAuB,CAAC;AAE/B,MAAM,YAAY,GAAG,CAAC,UAAU,CAAC,CAAC;AAElC,eAAe;IACb,SAAS,EAAE,qBAAqB;IAChC,IAAI,EAAE,CAAC,UAAU,CAAC;CACX,CAAC;AAEV,MAAM,kBAAkB,GAAG,EAAE,CAAC,KAAK,CAAC,EAAE;IACpC,KAAK,CAAC,cAAc,CAAC,CAAC;AACxB,CAAC,CAAC,CAAC;AAEH,MAAM,oBAAoB,GAAG,KAAK,EAChC,IAAkB,EAClB,aAA0B,EAC1B,EAAE;IACF,MAAM,MAAM,GAAG,MAAM,CAAC,aAAa,CAAC,CAAC;IACrC,MAAM,QAAQ,GAAG,MAAM,OAAO,CAAC,G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AAM;KAChB;CACF,CAAC;AAEF,QAAQ,CAAC,IAAI,GAAG,KAAK,EAAE,EAAE,IAAI,EAAE,aAAa,EAAE,EAAE,EAAE;IAChD,MAAM,oBAAoB,CAAC,IAAoB,EAAE,aAAa,CAAC,CAAC;AAClE,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,iBAAiB,GAAG,iBAAiB,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;AAC5D,iBAAiB,CAAC,IAAI,GAAG;IACvB,QAAQ,EAAE,KAAK;IACf,KAAK,EAAE,KAAK;IACZ,KAAK,EAAE,6BAA6B;CACrC,CAAC;AAEF,iBAAiB,CAAC,QAAQ,GAAG;IAC3B,QAAQ,EAAE,EAAE,OAAO,EAAE,SAAS,EAAE;IAChC,KAAK,EAAE;QACL,OAAO,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;QAC3B,OAAO,EAAE,CAAC,IAAI,EAAE,KAAK,CAAC;KACvB;IACD,KAAK,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE;CAC3B,CAAC;AAEF,iBAAiB,CAAC,IAAI,GAAG,KAAK,EAAE,EAAE,IAAI,EAAE,aAAa,EAAE,EAAE,EAAE;IACzD,MAAM,6BAA6B,CACjC,IAA6B,EAC7B,aAAa,CACd,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import type { Meta, StoryFn, StoryContext } from '@storybook/web-components';\nimport { html } from 'lit';\nimport './checkbox.atom';\nimport { expect, within, userEvent, waitFor, fn } from '@storybook/test';\nimport {\n CheckboxArgs,\n CheckboxWithRequiredArgs,\n CheckboxWithValueArgs,\n} from './checkbox.type';\nimport '../button/button.atom';\n\nconst allowedTypes = ['checkbox'];\n\nexport default {\n component: 'components/checkbox',\n tags: ['autodocs'],\n} as Meta;\n\nconst mockOnClickHandler = fn(event => {\n alert('submit data!');\n});\n\nconst testCheckboxBehavior = async (\n args: CheckboxArgs,\n canvasElement: HTMLElement\n) => {\n const canvas = within(canvasElement);\n const checkbox = await waitFor(() => canvas.getByTestId('checkbox-id'));\n\n if (checkbox.shadowRoot) {\n const innerCheckbox = checkbox.shadowRoot.querySelector(\n '[data-testid=\"checkbox-atom\"]'\n );\n\n // 1. Test: Checkbox should have correct Role attribute\n expect(innerCheckbox).toHaveRole('checkbox');\n\n // 2. Test: Checkbox should have the correct `checked` state based on args\n if (args.checked) {\n expect(innerCheckbox).toBeChecked();\n } else {\n expect(innerCheckbox).not.toBeChecked();\n }\n\n // 3. Test: Checkbox should be disabled when the `disabled` prop is true\n if (args.disabled) {\n expect(innerCheckbox).toBeDisabled();\n } else {\n expect(innerCheckbox).not.toBeDisabled();\n }\n\n // 4. Test: Label should have correct `for` attribute linking to the checkbox\n const label = await waitFor(() => canvas.getByText(args.label));\n expect(label).toBeInTheDocument();\n expect(label).toHaveAttribute('for', checkbox.getAttribute('id'));\n }\n};\n\nconst testCheckboxWithRequiredBehavior = async (\n args: CheckboxWithRequiredArgs,\n canvasElement: HTMLElement\n) => {\n const canvas = within(canvasElement);\n const checkbox = await waitFor(() => canvas.getByTestId('checkbox-id'));\n const button = await waitFor(() => canvas.getByTestId('btn-id'));\n\n if (checkbox.shadowRoot) {\n const innerCheckbox = checkbox.shadowRoot.querySelector(\n '[data-testid=\"checkbox-atom\"]'\n );\n\n // Test: Checkbox should have the correct required attribute\n if (args.required) {\n expect(innerCheckbox).toHaveAttribute('required');\n } else {\n expect(innerCheckbox).not.toHaveAttribute('required');\n }\n\n // Test: Button should be disabled when checkbox is unchecked and required is true\n if (args.required && !args.checked) {\n expect(button).toBeDisabled();\n } else if (args.required && args.checked) {\n expect(button).not.toBeDisabled();\n }\n\n // Additional tests for the checked state\n if (args.checked) {\n expect(innerCheckbox).toBeChecked();\n } else {\n expect(innerCheckbox).not.toBeChecked();\n }\n\n // Additional tests for the disabled state\n if (args.disabled) {\n expect(innerCheckbox).toBeDisabled();\n } else {\n expect(innerCheckbox).not.toBeDisabled();\n }\n }\n};\n\nconst testCheckboxWithValueBehavior = async (\n args: CheckboxWithValueArgs,\n canvasElement: HTMLElement\n) => {\n const canvas = within(canvasElement);\n const checkbox = await waitFor(() => canvas.getByTestId('checkbox-id'));\n\n if (checkbox.shadowRoot) {\n const innerCheckbox = checkbox.shadowRoot.querySelector(\n '[data-testid=\"checkbox-atom\"]'\n );\n\n // Test: Checkbox should have the correct value attribute\n expect(innerCheckbox).toHaveAttribute('value', args.value);\n\n // Additional tests for disabled state if needed\n if (args.disabled) {\n expect(innerCheckbox).toBeDisabled();\n } else {\n expect(innerCheckbox).not.toBeDisabled();\n }\n }\n};\n\nconst TemplatewithChecked: StoryFn = ({ disabled, checked, label }) =>\n html`\n <div style=\"display:flex\">\n <rtg-checkbox\n id=\"terms\"\n data-testid=\"checkbox-id\"\n ?disabled=${disabled}\n ?checked=${checked}\n ></rtg-checkbox>\n <rtg-label style=\"margin:2px 0px 0px 4px\" for=\"terms\">${label}</rtg-label>\n </div>\n `;\n\nconst TemplatewithRequired: StoryFn = ({\n disabled,\n checked,\n label,\n required,\n}) =>\n html`\n <div style=\"display: flex; flex-direction: column;\">\n <div style=\"display:flex\">\n <rtg-checkbox\n id=\"terms\"\n data-testid=\"checkbox-id\"\n ?disabled=${disabled}\n ?checked=${checked}\n ?required=${required}\n @click=${(e: Event) => {\n const checkbox = e.target as HTMLInputElement;\n const button = document.querySelector(\n 'rtg-button'\n ) as HTMLButtonElement;\n if (button) {\n button.disabled = required ? !checkbox.checked : false;\n }\n }}\n ></rtg-checkbox>\n <rtg-label style=\"margin:2px 0px 0px 4px\" for=\"terms\"\n >${label}</rtg-label\n >\n </div>\n <div style=\"margin-top:16px\">\n <rtg-button\n variant=\"default\"\n size=\"default\"\n data-testid=\"btn-id\"\n ?disabled=${required ? !checked : false}\n .click=${mockOnClickHandler}\n >Submit</rtg-button\n >\n </div>\n </div>\n `;\n\nconst TemplateWithVlaue: StoryFn = ({ disabled, label, value }) =>\n html`\n <div style=\"display:flex\">\n <rtg-checkbox\n id=\"terms\"\n data-testid=\"checkbox-id\"\n value=${value}\n ?disabled=${disabled}\n ></rtg-checkbox>\n <rtg-label style=\"margin:2px 0px 0px 4px\" for=\"terms\">${label}</rtg-label>\n </div>\n `;\n\nexport const CheckboxWithReuired = TemplatewithRequired.bind({});\nCheckboxWithReuired.args = {\n disabled: false,\n checked: false,\n required: false,\n label: 'Accept terms and conditions',\n};\n\nCheckboxWithReuired.parameters = {\n docs: {\n source: {\n transform: (code: string, storyContext: StoryContext) => {\n const args = storyContext.args;\n\n // Handling boolean attributes: if true, render without value, if false, omit the attribute\n const updatedCode = code\n .replace(/disabled=\"\"/g, 'disabled=true')\n .replace(/checked=\"\"/g, 'checked=true')\n .replace(/required=\"\"/g, 'required=true')\n .replace(/disabled=\"false\"/g, '')\n .replace(/checked=\"false\"/g, '')\n .replace(/required=\"false\"/g, '');\n\n return updatedCode;\n },\n },\n },\n};\n\nCheckboxWithReuired.argTypes = {\n disabled: {\n control: 'boolean',\n description: 'Determines whether the checkbox is disabled (unclickable).',\n table: {\n defaultValue: { summary: 'false' },\n },\n docs: {\n source: {\n code: (args: { disabled: boolean }) => (args.disabled ? true : ''),\n },\n },\n },\n checked: {\n control: 'boolean',\n description: 'Specifies whether the checkbox is checked by default.',\n table: {\n defaultValue: { summary: 'false' },\n },\n },\n required: {\n control: 'boolean',\n description:\n 'Marks the checkbox as a required field. When true, the checkbox must be checked for form submission, and related actions such as enabling a submit button are dependent on this state.',\n table: {\n defaultValue: { summary: 'false' },\n },\n },\n label: {\n control: 'text',\n description:\n 'The text displayed next to the checkbox, describing its purpose.',\n },\n};\n\nCheckboxWithReuired.play = async ({ args, canvasElement }) => {\n await testCheckboxWithRequiredBehavior(\n args as CheckboxWithRequiredArgs,\n canvasElement\n );\n};\n\nexport const Checkbox = TemplatewithChecked.bind({});\nCheckbox.args = {\n disabled: false,\n checked: false,\n label: 'Accept terms and conditions',\n};\n\nCheckbox.argTypes = {\n disabled: {\n control: 'boolean',\n },\n checked: {\n control: 'boolean',\n },\n label: {\n control: 'text',\n },\n};\n\nCheckbox.play = async ({ args, canvasElement }) => {\n await testCheckboxBehavior(args as CheckboxArgs, canvasElement);\n};\n\nexport const CheckboxWithValue = TemplateWithVlaue.bind({});\nCheckboxWithValue.args = {\n disabled: false,\n value: 'off',\n label: 'Accept terms and conditions',\n};\n\nCheckboxWithValue.argTypes = {\n disabled: { control: 'boolean' },\n value: {\n control: { type: 'select' },\n options: ['on', 'off'],\n },\n label: { control: 'text' },\n};\n\nCheckboxWithValue.play = async ({ args, canvasElement }) => {\n await testCheckboxWithValueBehavior(\n args as CheckboxWithValueArgs,\n canvasElement\n );\n};\n"]}
@@ -0,0 +1,3 @@
1
+ export const checkboxStyles = 'peer h-4 w-4 align-middle shrink-0 rounded-sm border border-primary ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground';
2
+ export const iconStyles = 'flex items-center justify-center text-current pointer-events-none';
3
+ //# sourceMappingURL=checkbox.style.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"checkbox.style.js","sourceRoot":"","sources":["../../../../../src/components/atoms/checkbox/checkbox.style.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,cAAc,GACzB,iSAAiS,CAAC;AAEpS,MAAM,CAAC,MAAM,UAAU,GACrB,mEAAmE,CAAC","sourcesContent":["export const checkboxStyles =\n 'peer h-4 w-4 align-middle shrink-0 rounded-sm border border-primary ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground';\n\nexport const iconStyles =\n 'flex items-center justify-center text-current pointer-events-none';\n"]}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=checkbox.type.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"checkbox.type.js","sourceRoot":"","sources":["../../../../../src/components/atoms/checkbox/checkbox.type.ts"],"names":[],"mappings":"","sourcesContent":["export type CheckboxProperties = {\n disabled: boolean;\n checked: boolean;\n};\n\nexport type CheckboxArgs = {\n disabled: boolean;\n checked: boolean;\n label: string;\n};\n\nexport type CheckboxWithRequiredArgs = {\n disabled: boolean;\n checked: boolean;\n required: boolean;\n label: string;\n value?: string;\n};\n\nexport type CheckboxWithValueArgs = {\n disabled: boolean;\n value: string;\n label: string;\n};\n"]}
@@ -0,0 +1,47 @@
1
+ import { __decorate } from "tslib";
2
+ import { LitElement, html, css } from 'lit';
3
+ import { customElement, property } from 'lit/decorators.js';
4
+ import { TWStyles } from '../../../styles';
5
+ let ComboBoxInput = class ComboBoxInput extends LitElement {
6
+ constructor() {
7
+ super(...arguments);
8
+ this.value = '';
9
+ this.handleClick = () => { };
10
+ this.handleKeyDown = () => { };
11
+ }
12
+ render() {
13
+ return html `
14
+ <input
15
+ class="inline-flex justify-between items-center w-full h-10 px-4 py-2 whitespace-nowrap rounded-md
16
+ text-sm font-medium border border-input cursor-pointer
17
+ ring-offset-background
18
+ transition-colors disabled:pointer-events-none
19
+ disabled:opacity-50
20
+ bg-background hover:bg-accent
21
+ hover:text-accent-foreground
22
+ outline-none"
23
+ role="combobox"
24
+ aria-expanded="false"
25
+ readonly="true"
26
+ .value=${this.value}
27
+ @click=${this.handleClick}
28
+ @keydown=${this.handleKeyDown}
29
+ />
30
+ `;
31
+ }
32
+ };
33
+ ComboBoxInput.styles = [css ``, TWStyles];
34
+ __decorate([
35
+ property({ type: String })
36
+ ], ComboBoxInput.prototype, "value", void 0);
37
+ __decorate([
38
+ property({ type: Function })
39
+ ], ComboBoxInput.prototype, "handleClick", void 0);
40
+ __decorate([
41
+ property({ type: Function })
42
+ ], ComboBoxInput.prototype, "handleKeyDown", void 0);
43
+ ComboBoxInput = __decorate([
44
+ customElement('combo-box-input')
45
+ ], ComboBoxInput);
46
+ export { ComboBoxInput };
47
+ //# sourceMappingURL=combo-box-input.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"combo-box-input.js","sourceRoot":"","sources":["../../../../../src/components/atoms/combo-box/combo-box-input.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAC5C,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAGpC,IAAM,aAAa,GAAnB,MAAM,aAAc,SAAQ,UAAU;IAAtC;;QACuB,UAAK,GAAG,EAAE,CAAC;QACT,gBAAW,GAAG,GAAG,EAAE,GAAE,CAAC,CAAC;QACvB,kBAAa,GAAG,GAAG,EAAE,GAAE,CAAC,CAAC;IAwBzD,CAAC;IApBC,MAAM;QACJ,OAAO,IAAI,CAAA;;;;;;;;;;;;;iBAaE,IAAI,CAAC,KAAK;iBACV,IAAI,CAAC,WAAW;mBACd,IAAI,CAAC,aAAa;;KAEhC,CAAC;IACJ,CAAC;;AArBM,oBAAM,GAAG,CAAC,GAAG,CAAA,EAAE,EAAE,QAAQ,CAAC,AAApB,CAAqB;AAJN;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;4CAAY;AACT;IAA7B,QAAQ,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC;kDAAwB;AACvB;IAA7B,QAAQ,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC;oDAA0B;AAH5C,aAAa;IADzB,aAAa,CAAC,iBAAiB,CAAC;GACpB,aAAa,CA2BzB","sourcesContent":["import { LitElement, html, css } from 'lit';\nimport { customElement, property } from 'lit/decorators.js';\nimport { TWStyles } from '../../../styles';\n\n@customElement('combo-box-input')\nexport class ComboBoxInput extends LitElement {\n @property({ type: String }) value = '';\n @property({ type: Function }) handleClick = () => {};\n @property({ type: Function }) handleKeyDown = () => {};\n\n static styles = [css``, TWStyles];\n\n render() {\n return html`\n <input\n class=\"inline-flex justify-between items-center w-full h-10 px-4 py-2 whitespace-nowrap rounded-md \n text-sm font-medium border border-input cursor-pointer \n ring-offset-background \n transition-colors disabled:pointer-events-none \n disabled:opacity-50 \n bg-background hover:bg-accent \n hover:text-accent-foreground \n outline-none\"\n role=\"combobox\"\n aria-expanded=\"false\"\n readonly=\"true\"\n .value=${this.value}\n @click=${this.handleClick}\n @keydown=${this.handleKeyDown}\n />\n `;\n }\n}\n"]}
@@ -0,0 +1,85 @@
1
+ import { __decorate } from "tslib";
2
+ import { LitElement, css, html } from 'lit';
3
+ import { customElement, property } from 'lit/decorators.js';
4
+ import { tickIcon } from '../../../assets/icons';
5
+ import { TWStyles } from '../../../styles';
6
+ let ComboBoxItem = class ComboBoxItem extends LitElement {
7
+ constructor() {
8
+ super(...arguments);
9
+ this.key = '';
10
+ this.searchText = '';
11
+ this.value = '';
12
+ this.tabindex = 0;
13
+ this.isSelected = false;
14
+ this.class = '';
15
+ this.onSelect = () => { };
16
+ }
17
+ render() {
18
+ console.log('this', this.class);
19
+ return html `
20
+ <div
21
+ key="${this.key}"
22
+ class="flex items-center cursor-pointer py-2 px-4 w-full text-sm text-gray-800
23
+ rounded-lg
24
+ hover:bg-gray-100
25
+ focus:outline-none
26
+ focus:bg-gray-100
27
+ dark:bg-neutral-900
28
+ dark:hover:bg-neutral-800
29
+ dark:text-neutral-200
30
+ dark:focus:bg-neutral-800
31
+ ${this.class}
32
+ "
33
+ tabindex="${this.tabindex}"
34
+ aria-selected="${this.isSelected}"
35
+ data-selected="${this.isSelected}"
36
+ data-hs-combo-box-output-item=""
37
+ role="option"
38
+ @click="${this.onSelect}"
39
+ >
40
+ <span
41
+ class="${this.isSelected
42
+ ? 'visible'
43
+ : 'invisible'} hs-combo-box-selected:block mr-2"
44
+ >
45
+ ${tickIcon()}
46
+ </span>
47
+ <div class="flex justify-between items-center w-full">
48
+ <span
49
+ data-hs-combo-box-search-text="${this.searchText}"
50
+ data-hs-combo-box-value="${this.value}"
51
+ >
52
+ ${this.searchText}
53
+ </span>
54
+ </div>
55
+ </div>
56
+ `;
57
+ }
58
+ };
59
+ ComboBoxItem.styles = [css ``, TWStyles];
60
+ __decorate([
61
+ property({ type: String })
62
+ ], ComboBoxItem.prototype, "key", void 0);
63
+ __decorate([
64
+ property({ type: String })
65
+ ], ComboBoxItem.prototype, "searchText", void 0);
66
+ __decorate([
67
+ property({ type: String })
68
+ ], ComboBoxItem.prototype, "value", void 0);
69
+ __decorate([
70
+ property({ type: Number })
71
+ ], ComboBoxItem.prototype, "tabindex", void 0);
72
+ __decorate([
73
+ property({ type: Boolean })
74
+ ], ComboBoxItem.prototype, "isSelected", void 0);
75
+ __decorate([
76
+ property({ type: String })
77
+ ], ComboBoxItem.prototype, "class", void 0);
78
+ __decorate([
79
+ property({ type: Function })
80
+ ], ComboBoxItem.prototype, "onSelect", void 0);
81
+ ComboBoxItem = __decorate([
82
+ customElement('combo-box-item')
83
+ ], ComboBoxItem);
84
+ export { ComboBoxItem };
85
+ //# sourceMappingURL=combo-box-item.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"combo-box-item.js","sourceRoot":"","sources":["../../../../../src/components/atoms/combo-box/combo-box-item.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAC5C,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACjD,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAGpC,IAAM,YAAY,GAAlB,MAAM,YAAa,SAAQ,UAAU;IAArC;;QACuB,QAAG,GAAG,EAAE,CAAC;QACT,eAAU,GAAG,EAAE,CAAC;QAChB,UAAK,GAAG,EAAE,CAAC;QACX,aAAQ,GAAG,CAAC,CAAC;QACZ,eAAU,GAAG,KAAK,CAAC;QACpB,UAAK,GAAG,EAAE,CAAC;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.js';\nimport { tickIcon } from '../../../assets/icons';\nimport { TWStyles } from '../../../styles';\n\n@customElement('combo-box-item')\nexport class ComboBoxItem extends LitElement {\n @property({ type: String }) key = '';\n @property({ type: String }) searchText = '';\n @property({ type: String }) value = '';\n @property({ type: Number }) tabindex = 0;\n @property({ type: Boolean }) isSelected = false;\n @property({ type: String }) class = '';\n @property({ type: Function }) onSelect = () => {};\n\n static styles = [css``, TWStyles];\n\n render() {\n console.log('this', this.class);\n return html`\n <div\n key=\"${this.key}\"\n class=\"flex items-center cursor-pointer py-2 px-4 w-full text-sm text-gray-800 \n rounded-lg \n hover:bg-gray-100\n focus:outline-none \n focus:bg-gray-100 \n dark:bg-neutral-900 \n dark:hover:bg-neutral-800 \n dark:text-neutral-200 \n dark:focus:bg-neutral-800\n ${this.class}\n \"\n tabindex=\"${this.tabindex}\"\n aria-selected=\"${this.isSelected}\"\n data-selected=\"${this.isSelected}\"\n data-hs-combo-box-output-item=\"\"\n role=\"option\"\n @click=\"${this.onSelect}\"\n >\n <span\n class=\"${this.isSelected\n ? 'visible'\n : 'invisible'} hs-combo-box-selected:block mr-2\"\n >\n ${tickIcon()}\n </span>\n <div class=\"flex justify-between items-center w-full\">\n <span\n data-hs-combo-box-search-text=\"${this.searchText}\"\n data-hs-combo-box-value=\"${this.value}\"\n >\n ${this.searchText}\n </span>\n </div>\n </div>\n `;\n }\n}\n"]}
@@ -0,0 +1,67 @@
1
+ import { __decorate } from "tslib";
2
+ import { LitElement, css, html } from 'lit';
3
+ import { customElement, property, state } from 'lit/decorators.js';
4
+ import { searchIcon } from '../../../assets/icons';
5
+ import { TWStyles } from '../../../styles';
6
+ import { STATE_CLOSED, STATE_OPEN } from '../popover/popover.types';
7
+ import { ComboBox } from './combo-box.atom';
8
+ let ComboBoxList = class ComboBoxList extends LitElement {
9
+ constructor() {
10
+ super(...arguments);
11
+ this.state = STATE_CLOSED;
12
+ this.isOpen = false;
13
+ }
14
+ get _popover() {
15
+ let parent = this.parentElement;
16
+ // Traverse up the DOM tree to find the parent `Popover`
17
+ while (parent && !(parent instanceof ComboBox)) {
18
+ parent = parent.parentElement;
19
+ }
20
+ return parent;
21
+ }
22
+ render() {
23
+ console.log('this.state', this.state);
24
+ // @keydown="${this.handleKeyDown}"
25
+ // @input="${this.handleSearch}"
26
+ // @keydown="${this.handleKeyDown}"
27
+ return html `
28
+ <div
29
+ class="absolute z-50 w-full max-h-72 p-1 bg-white border border-gray-200 rounded-lg overflow-hidden overflow-y-auto [&::-webkit-scrollbar]:w-2 [&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar-track]:bg-gray-100 [&::-webkit-scrollbar-thumb]:bg-gray-300 dark:[&::-webkit-scrollbar-track]:bg-neutral-700 dark:[&::-webkit-scrollbar-thumb]:bg-neutral-500 dark:bg-neutral-900 dark:border-neutral-700"
30
+ data-hs-combo-box-output=""
31
+ style="display: ${this.state === STATE_OPEN
32
+ ? 'block'
33
+ : 'none'}; top:115%"
34
+ >
35
+ <div
36
+ class="flex items-center justify-center px-3 border-b border-gray-300 mb-1"
37
+ >
38
+ ${searchIcon()}
39
+ <input
40
+ type="text"
41
+ class="w-full px-2 py-2 rounded focus:outline-none"
42
+ placeholder="Search..."
43
+ autocomplete="off"
44
+ autocorrect="off"
45
+ spellcheck="false"
46
+ aria-autocomplete="list"
47
+ aria-expanded="true"
48
+ role="combobox"
49
+ />
50
+ </div>
51
+ <slot></slot>
52
+ </div>
53
+ `;
54
+ }
55
+ };
56
+ ComboBoxList.styles = [css ``, TWStyles];
57
+ __decorate([
58
+ property({ attribute: 'data-state', type: String })
59
+ ], ComboBoxList.prototype, "state", void 0);
60
+ __decorate([
61
+ state()
62
+ ], ComboBoxList.prototype, "isOpen", void 0);
63
+ ComboBoxList = __decorate([
64
+ customElement('combo-box-list')
65
+ ], ComboBoxList);
66
+ export { ComboBoxList };
67
+ //# sourceMappingURL=combo-box-list.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"combo-box-list.js","sourceRoot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AAY,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;2CAAsB;AAEjE;IAAR,KAAK,EAAE;4CAAgB;AAJb,YAAY;IADxB,aAAa,CAAC,gBAAgB,CAAC;GACnB,YAAY,CAgDxB","sourcesContent":["import { LitElement, PropertyValues, css, html } from 'lit';\nimport { customElement, property, state } from 'lit/decorators.js';\nimport { searchIcon } from '../../../assets/icons';\nimport { TWStyles } from '../../../styles';\nimport { STATE_CLOSED, STATE_OPEN } from '../popover/popover.types';\nimport { ComboBox } from './combo-box.atom';\n\n@customElement('combo-box-list')\nexport class ComboBoxList extends LitElement {\n static styles = [css``, TWStyles];\n @property({ attribute: 'data-state', type: String }) state = STATE_CLOSED;\n\n @state() isOpen = false;\n get _popover(): ComboBox | null {\n let parent = this.parentElement;\n // Traverse up the DOM tree to find the parent `Popover`\n while (parent && !(parent instanceof ComboBox)) {\n parent = parent.parentElement;\n }\n return parent;\n }\n\n render() {\n console.log('this.state', this.state);\n // @keydown=\"${this.handleKeyDown}\"\n\n // @input=\"${this.handleSearch}\"\n // @keydown=\"${this.handleKeyDown}\"\n return html`\n <div\n class=\"absolute z-50 w-full max-h-72 p-1 bg-white border border-gray-200 rounded-lg overflow-hidden overflow-y-auto [&::-webkit-scrollbar]:w-2 [&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar-track]:bg-gray-100 [&::-webkit-scrollbar-thumb]:bg-gray-300 dark:[&::-webkit-scrollbar-track]:bg-neutral-700 dark:[&::-webkit-scrollbar-thumb]:bg-neutral-500 dark:bg-neutral-900 dark:border-neutral-700\"\n data-hs-combo-box-output=\"\"\n style=\"display: ${this.state === STATE_OPEN\n ? 'block'\n : 'none'}; top:115%\"\n >\n <div\n class=\"flex items-center justify-center px-3 border-b border-gray-300 mb-1\"\n >\n ${searchIcon()}\n <input\n type=\"text\"\n class=\"w-full px-2 py-2 rounded focus:outline-none\"\n placeholder=\"Search...\"\n autocomplete=\"off\"\n autocorrect=\"off\"\n spellcheck=\"false\"\n aria-autocomplete=\"list\"\n aria-expanded=\"true\"\n role=\"combobox\"\n />\n </div>\n <slot></slot>\n </div>\n `;\n }\n}\n"]}