revotech-ui-kit 0.0.11 → 0.0.12

Sign up to get free protection for your applications and to get access to all the features.
Files changed (255) hide show
  1. package/dist/src/components/atoms/alert/alert.atom.d.ts +7 -0
  2. package/dist/src/components/atoms/card/card.atom.d.ts +10 -0
  3. package/dist/src/components/atoms/checkbox/checkbox.atom.d.ts +5 -0
  4. package/dist/src/components/atoms/combo-box/combo-box.atom.d.ts +5 -0
  5. package/dist/src/components/atoms/combo-box/combo-box.stories.d.ts +5 -6
  6. package/dist/src/components/atoms/command/command.stories.d.ts +11 -0
  7. package/dist/src/components/atoms/dialog/dialog-close.d.ts +5 -0
  8. package/dist/src/components/atoms/dialog/dialog.atom.d.ts +17 -1
  9. package/dist/src/components/atoms/dropdownMenu/dropdown-menu.atom.d.ts +19 -3
  10. package/dist/src/components/atoms/dropdownMenu/dropdownMenu.stories.d.ts +1 -0
  11. package/dist/src/components/atoms/index.d.ts +11 -5
  12. package/dist/src/components/atoms/label/label.atom.d.ts +5 -0
  13. package/dist/src/components/atoms/popover/popover.atom.d.ts +11 -1
  14. package/dist/src/components/atoms/textarea/textarea.atom.d.ts +16 -0
  15. package/dist/src/components/atoms/textarea/textarea.stories.d.ts +7 -0
  16. package/dist/src/components/atoms/textarea/textarea.styles.d.ts +1 -0
  17. package/dist/src/components/atoms/textarea/textarea.type.d.ts +11 -0
  18. package/dist/src/components/atoms/toggle/toggle.stories.d.ts +5 -6
  19. package/dist/src/components/molecules/breadCrumb/Breadcrumb-link.d.ts +7 -0
  20. package/dist/src/components/molecules/breadCrumb/breadCrumb.stories.d.ts +16 -0
  21. package/dist/src/components/molecules/breadCrumb/breadcrumb-ellipsis.d.ts +6 -0
  22. package/dist/src/components/molecules/breadCrumb/breadcrumb-item.d.ts +6 -0
  23. package/dist/src/components/molecules/breadCrumb/breadcrumb-list.d.ts +6 -0
  24. package/dist/src/components/molecules/breadCrumb/breadcrumb-separator.d.ts +6 -0
  25. package/dist/src/components/molecules/breadCrumb/breadcrumb-text.d.ts +6 -0
  26. package/dist/src/components/molecules/breadCrumb/breadcrumb.molecules.d.ts +6 -0
  27. package/dist/src/components/molecules/breadCrumb/breadcrumb.styles.d.ts +6 -0
  28. package/dist/src/components/molecules/index.d.ts +7 -1
  29. package/dist/src/components/molecules/toggle-group/defs.d.ts +37 -0
  30. package/dist/src/components/molecules/toggle-group/toggle-group-item.d.ts +17 -0
  31. package/dist/src/components/molecules/toggle-group/toggle-group.molecules.d.ts +19 -0
  32. package/dist/src/components/molecules/toggle-group/toggle-group.stories.d.ts +5 -0
  33. package/dist/src/components/molecules/toggle-group/toggle-group.style.d.ts +4 -0
  34. package/dist/src/index.d.ts +2 -4
  35. package/dist/tsconfig.tsbuildinfo +1 -1
  36. package/package.json +1 -1
  37. package/dist/revotech-ui-kit.cjs +0 -2293
  38. package/dist/revotech-ui-kit.js +0 -5608
  39. package/dist/src/assets/icons/arrows.icon.js +0 -20
  40. package/dist/src/assets/icons/arrows.icon.js.map +0 -1
  41. package/dist/src/assets/icons/index.js +0 -4
  42. package/dist/src/assets/icons/index.js.map +0 -1
  43. package/dist/src/assets/icons/search.icon.js +0 -19
  44. package/dist/src/assets/icons/search.icon.js.map +0 -1
  45. package/dist/src/assets/icons/tick.icon.js +0 -20
  46. package/dist/src/assets/icons/tick.icon.js.map +0 -1
  47. package/dist/src/components/atoms/alert/alert-description.js +0 -18
  48. package/dist/src/components/atoms/alert/alert-description.js.map +0 -1
  49. package/dist/src/components/atoms/alert/alert-title.js +0 -20
  50. package/dist/src/components/atoms/alert/alert-title.js.map +0 -1
  51. package/dist/src/components/atoms/alert/alert.atom.js +0 -55
  52. package/dist/src/components/atoms/alert/alert.atom.js.map +0 -1
  53. package/dist/src/components/atoms/alert/alert.stories.js +0 -62
  54. package/dist/src/components/atoms/alert/alert.stories.js.map +0 -1
  55. package/dist/src/components/atoms/alert/alert.styles.js +0 -21
  56. package/dist/src/components/atoms/alert/alert.styles.js.map +0 -1
  57. package/dist/src/components/atoms/alert/alert.types.js +0 -2
  58. package/dist/src/components/atoms/alert/alert.types.js.map +0 -1
  59. package/dist/src/components/atoms/badge/badge.atom.js +0 -43
  60. package/dist/src/components/atoms/badge/badge.atom.js.map +0 -1
  61. package/dist/src/components/atoms/badge/badge.stories.js +0 -110
  62. package/dist/src/components/atoms/badge/badge.stories.js.map +0 -1
  63. package/dist/src/components/atoms/badge/badge.style.js +0 -17
  64. package/dist/src/components/atoms/badge/badge.style.js.map +0 -1
  65. package/dist/src/components/atoms/badge/badge.type.js +0 -2
  66. package/dist/src/components/atoms/badge/badge.type.js.map +0 -1
  67. package/dist/src/components/atoms/button/button.atom.js +0 -67
  68. package/dist/src/components/atoms/button/button.atom.js.map +0 -1
  69. package/dist/src/components/atoms/button/button.stories.js +0 -204
  70. package/dist/src/components/atoms/button/button.stories.js.map +0 -1
  71. package/dist/src/components/atoms/button/button.style.js +0 -24
  72. package/dist/src/components/atoms/button/button.style.js.map +0 -1
  73. package/dist/src/components/atoms/button/button.type.js +0 -2
  74. package/dist/src/components/atoms/button/button.type.js.map +0 -1
  75. package/dist/src/components/atoms/card/card-content.js +0 -17
  76. package/dist/src/components/atoms/card/card-content.js.map +0 -1
  77. package/dist/src/components/atoms/card/card-description.js +0 -17
  78. package/dist/src/components/atoms/card/card-description.js.map +0 -1
  79. package/dist/src/components/atoms/card/card-footer.js +0 -17
  80. package/dist/src/components/atoms/card/card-footer.js.map +0 -1
  81. package/dist/src/components/atoms/card/card-header.js +0 -17
  82. package/dist/src/components/atoms/card/card-header.js.map +0 -1
  83. package/dist/src/components/atoms/card/card-title.js +0 -17
  84. package/dist/src/components/atoms/card/card-title.js.map +0 -1
  85. package/dist/src/components/atoms/card/card.atom.js +0 -25
  86. package/dist/src/components/atoms/card/card.atom.js.map +0 -1
  87. package/dist/src/components/atoms/card/card.stories.js +0 -136
  88. package/dist/src/components/atoms/card/card.stories.js.map +0 -1
  89. package/dist/src/components/atoms/checkbox/checkbox.atom.js +0 -87
  90. package/dist/src/components/atoms/checkbox/checkbox.atom.js.map +0 -1
  91. package/dist/src/components/atoms/checkbox/checkbox.stories.js +0 -244
  92. package/dist/src/components/atoms/checkbox/checkbox.stories.js.map +0 -1
  93. package/dist/src/components/atoms/checkbox/checkbox.style.js +0 -3
  94. package/dist/src/components/atoms/checkbox/checkbox.style.js.map +0 -1
  95. package/dist/src/components/atoms/checkbox/checkbox.type.js +0 -2
  96. package/dist/src/components/atoms/checkbox/checkbox.type.js.map +0 -1
  97. package/dist/src/components/atoms/combo-box/combo-box-input.js +0 -47
  98. package/dist/src/components/atoms/combo-box/combo-box-input.js.map +0 -1
  99. package/dist/src/components/atoms/combo-box/combo-box-item.js +0 -85
  100. package/dist/src/components/atoms/combo-box/combo-box-item.js.map +0 -1
  101. package/dist/src/components/atoms/combo-box/combo-box-list.js +0 -67
  102. package/dist/src/components/atoms/combo-box/combo-box-list.js.map +0 -1
  103. package/dist/src/components/atoms/combo-box/combo-box.atom.js +0 -199
  104. package/dist/src/components/atoms/combo-box/combo-box.atom.js.map +0 -1
  105. package/dist/src/components/atoms/combo-box/combo-box.stories.js +0 -86
  106. package/dist/src/components/atoms/combo-box/combo-box.stories.js.map +0 -1
  107. package/dist/src/components/atoms/command-empty/command-empty.atom.js +0 -53
  108. package/dist/src/components/atoms/command-empty/command-empty.atom.js.map +0 -1
  109. package/dist/src/components/atoms/command-group/command-group.atom.js +0 -70
  110. package/dist/src/components/atoms/command-group/command-group.atom.js.map +0 -1
  111. package/dist/src/components/atoms/command-item/command-item.atom.js +0 -78
  112. package/dist/src/components/atoms/command-item/command-item.atom.js.map +0 -1
  113. package/dist/src/components/atoms/command-list/command-list.atom.js +0 -35
  114. package/dist/src/components/atoms/command-list/command-list.atom.js.map +0 -1
  115. package/dist/src/components/atoms/command-separator/command-separator.atom.js +0 -51
  116. package/dist/src/components/atoms/command-separator/command-separator.atom.js.map +0 -1
  117. package/dist/src/components/atoms/dialog/dialog-close.js +0 -46
  118. package/dist/src/components/atoms/dialog/dialog-close.js.map +0 -1
  119. package/dist/src/components/atoms/dialog/dialog-content.js +0 -72
  120. package/dist/src/components/atoms/dialog/dialog-content.js.map +0 -1
  121. package/dist/src/components/atoms/dialog/dialog-footer.js +0 -22
  122. package/dist/src/components/atoms/dialog/dialog-footer.js.map +0 -1
  123. package/dist/src/components/atoms/dialog/dialog-header.js +0 -40
  124. package/dist/src/components/atoms/dialog/dialog-header.js.map +0 -1
  125. package/dist/src/components/atoms/dialog/dialog-overly.js +0 -20
  126. package/dist/src/components/atoms/dialog/dialog-overly.js.map +0 -1
  127. package/dist/src/components/atoms/dialog/dialog-trigger.js +0 -53
  128. package/dist/src/components/atoms/dialog/dialog-trigger.js.map +0 -1
  129. package/dist/src/components/atoms/dialog/dialog.atom.js +0 -78
  130. package/dist/src/components/atoms/dialog/dialog.atom.js.map +0 -1
  131. package/dist/src/components/atoms/dialog/dialog.stories.js +0 -88
  132. package/dist/src/components/atoms/dialog/dialog.stories.js.map +0 -1
  133. package/dist/src/components/atoms/dropdownMenu/dropdown-menu-checkbox-Item.js +0 -115
  134. package/dist/src/components/atoms/dropdownMenu/dropdown-menu-checkbox-Item.js.map +0 -1
  135. package/dist/src/components/atoms/dropdownMenu/dropdown-menu-content.js +0 -80
  136. package/dist/src/components/atoms/dropdownMenu/dropdown-menu-content.js.map +0 -1
  137. package/dist/src/components/atoms/dropdownMenu/dropdown-menu-group.js +0 -70
  138. package/dist/src/components/atoms/dropdownMenu/dropdown-menu-group.js.map +0 -1
  139. package/dist/src/components/atoms/dropdownMenu/dropdown-menu-item.js +0 -78
  140. package/dist/src/components/atoms/dropdownMenu/dropdown-menu-item.js.map +0 -1
  141. package/dist/src/components/atoms/dropdownMenu/dropdown-menu-radio-item.js +0 -116
  142. package/dist/src/components/atoms/dropdownMenu/dropdown-menu-radio-item.js.map +0 -1
  143. package/dist/src/components/atoms/dropdownMenu/dropdown-menu-seperator.js +0 -51
  144. package/dist/src/components/atoms/dropdownMenu/dropdown-menu-seperator.js.map +0 -1
  145. package/dist/src/components/atoms/dropdownMenu/dropdown-menu-shortcut.js +0 -20
  146. package/dist/src/components/atoms/dropdownMenu/dropdown-menu-shortcut.js.map +0 -1
  147. package/dist/src/components/atoms/dropdownMenu/dropdown-menu.atom.js +0 -77
  148. package/dist/src/components/atoms/dropdownMenu/dropdown-menu.atom.js.map +0 -1
  149. package/dist/src/components/atoms/dropdownMenu/dropdownMenu.stories.js +0 -211
  150. package/dist/src/components/atoms/dropdownMenu/dropdownMenu.stories.js.map +0 -1
  151. package/dist/src/components/atoms/dropdownMenu/dropdownMenu.style.js +0 -4
  152. package/dist/src/components/atoms/dropdownMenu/dropdownMenu.style.js.map +0 -1
  153. package/dist/src/components/atoms/index.js +0 -14
  154. package/dist/src/components/atoms/index.js.map +0 -1
  155. package/dist/src/components/atoms/input/input.atom.js +0 -93
  156. package/dist/src/components/atoms/input/input.atom.js.map +0 -1
  157. package/dist/src/components/atoms/input/input.stories.js +0 -382
  158. package/dist/src/components/atoms/input/input.stories.js.map +0 -1
  159. package/dist/src/components/atoms/input/input.styles.js +0 -2
  160. package/dist/src/components/atoms/input/input.styles.js.map +0 -1
  161. package/dist/src/components/atoms/input/input.type.js +0 -2
  162. package/dist/src/components/atoms/input/input.type.js.map +0 -1
  163. package/dist/src/components/atoms/label/label.atom.js +0 -67
  164. package/dist/src/components/atoms/label/label.atom.js.map +0 -1
  165. package/dist/src/components/atoms/label/label.stories.js +0 -85
  166. package/dist/src/components/atoms/label/label.stories.js.map +0 -1
  167. package/dist/src/components/atoms/label/label.style.js +0 -3
  168. package/dist/src/components/atoms/label/label.style.js.map +0 -1
  169. package/dist/src/components/atoms/popover/popover-content.js +0 -62
  170. package/dist/src/components/atoms/popover/popover-content.js.map +0 -1
  171. package/dist/src/components/atoms/popover/popover-trigger.js +0 -50
  172. package/dist/src/components/atoms/popover/popover-trigger.js.map +0 -1
  173. package/dist/src/components/atoms/popover/popover.atom.js +0 -40
  174. package/dist/src/components/atoms/popover/popover.atom.js.map +0 -1
  175. package/dist/src/components/atoms/popover/popover.stories.js +0 -69
  176. package/dist/src/components/atoms/popover/popover.stories.js.map +0 -1
  177. package/dist/src/components/atoms/popover/popover.style.js +0 -21
  178. package/dist/src/components/atoms/popover/popover.style.js.map +0 -1
  179. package/dist/src/components/atoms/popover/popover.types.js +0 -4
  180. package/dist/src/components/atoms/popover/popover.types.js.map +0 -1
  181. package/dist/src/components/atoms/toggle/defs.js +0 -30
  182. package/dist/src/components/atoms/toggle/defs.js.map +0 -1
  183. package/dist/src/components/atoms/toggle/toggle.atom.js +0 -72
  184. package/dist/src/components/atoms/toggle/toggle.atom.js.map +0 -1
  185. package/dist/src/components/atoms/toggle/toggle.stories.js +0 -189
  186. package/dist/src/components/atoms/toggle/toggle.stories.js.map +0 -1
  187. package/dist/src/components/atoms/toggle/toggle.style.js +0 -19
  188. package/dist/src/components/atoms/toggle/toggle.style.js.map +0 -1
  189. package/dist/src/components/command/command.d.ts +0 -56
  190. package/dist/src/components/command/command.js +0 -402
  191. package/dist/src/components/command/command.js.map +0 -1
  192. package/dist/src/components/command/command.stories.d.ts +0 -5
  193. package/dist/src/components/command/command.stories.js +0 -153
  194. package/dist/src/components/command/command.stories.js.map +0 -1
  195. package/dist/src/components/index.js +0 -3
  196. package/dist/src/components/index.js.map +0 -1
  197. package/dist/src/components/molecules/command/command.molecules.js +0 -27
  198. package/dist/src/components/molecules/command/command.molecules.js.map +0 -1
  199. package/dist/src/components/molecules/command-input/command-input.atom.js +0 -125
  200. package/dist/src/components/molecules/command-input/command-input.atom.js.map +0 -1
  201. package/dist/src/components/molecules/dropdownMenu/dropdownMenu.molecules.js +0 -2
  202. package/dist/src/components/molecules/dropdownMenu/dropdownMenu.molecules.js.map +0 -1
  203. package/dist/src/components/molecules/index.js +0 -2
  204. package/dist/src/components/molecules/index.js.map +0 -1
  205. package/dist/src/helpers/base-element.js +0 -62
  206. package/dist/src/helpers/base-element.js.map +0 -1
  207. package/dist/src/helpers/index.js +0 -4
  208. package/dist/src/helpers/index.js.map +0 -1
  209. package/dist/src/helpers/mouse-conroller.helper.js +0 -33
  210. package/dist/src/helpers/mouse-conroller.helper.js.map +0 -1
  211. package/dist/src/helpers/style.helpers.js +0 -6
  212. package/dist/src/helpers/style.helpers.js.map +0 -1
  213. package/dist/src/index.js +0 -5
  214. package/dist/src/index.js.map +0 -1
  215. package/dist/src/interfaces/actionable.interface.js +0 -2
  216. package/dist/src/interfaces/actionable.interface.js.map +0 -1
  217. package/dist/src/interfaces/atomic.interface.js +0 -2
  218. package/dist/src/interfaces/atomic.interface.js.map +0 -1
  219. package/dist/src/interfaces/changeable.interface.js +0 -2
  220. package/dist/src/interfaces/changeable.interface.js.map +0 -1
  221. package/dist/src/interfaces/child-support-atomic.interface.js +0 -2
  222. package/dist/src/interfaces/child-support-atomic.interface.js.map +0 -1
  223. package/dist/src/interfaces/index.js +0 -7
  224. package/dist/src/interfaces/index.js.map +0 -1
  225. package/dist/src/interfaces/intractable.interface.js +0 -2
  226. package/dist/src/interfaces/intractable.interface.js.map +0 -1
  227. package/dist/src/interfaces/variant.interface.js +0 -2
  228. package/dist/src/interfaces/variant.interface.js.map +0 -1
  229. package/dist/src/lib/index.js +0 -2
  230. package/dist/src/lib/index.js.map +0 -1
  231. package/dist/src/lib/next/next.lib.js +0 -2
  232. package/dist/src/lib/next/next.lib.js.map +0 -1
  233. package/dist/src/lib/react/react.lib.js +0 -16
  234. package/dist/src/lib/react/react.lib.js.map +0 -1
  235. package/dist/src/lib/tw-styles.js +0 -1956
  236. package/dist/src/lib/tw-styles.js.map +0 -1
  237. package/dist/src/styles/index.js +0 -2
  238. package/dist/src/styles/index.js.map +0 -1
  239. package/dist/src/styles/tw.styles.js +0 -2218
  240. package/dist/src/styles/tw.styles.js.map +0 -1
  241. package/dist/src/wc-ui-app.js +0 -88
  242. package/dist/src/wc-ui-app.js.map +0 -1
  243. package/dist/test/wc-ui-app.test.d.ts +0 -0
  244. package/dist/test/wc-ui-app.test.js +0 -18
  245. package/dist/test/wc-ui-app.test.js.map +0 -1
  246. package/dist/vite.config.d.ts +0 -2
  247. package/dist/vite.config.js +0 -29
  248. package/dist/vite.config.js.map +0 -1
  249. /package/dist/src/components/atoms/{command-empty → command}/command-empty.atom.d.ts +0 -0
  250. /package/dist/src/components/atoms/{command-group → command}/command-group.atom.d.ts +0 -0
  251. /package/dist/src/components/{molecules/command-input → atoms/command}/command-input.atom.d.ts +0 -0
  252. /package/dist/src/components/atoms/{command-item → command}/command-item.atom.d.ts +0 -0
  253. /package/dist/src/components/atoms/{command-list → command}/command-list.atom.d.ts +0 -0
  254. /package/dist/src/components/atoms/{command-separator → command}/command-separator.atom.d.ts +0 -0
  255. /package/dist/src/components/{molecules/command/command.molecules.d.ts → atoms/command/command.atom.d.ts} +0 -0
@@ -1,87 +0,0 @@
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
@@ -1 +0,0 @@
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,GAA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GAAG,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,IAAI,CAAA,IAAI,GAAG,KAAK,KAAK,IAAI,CAC5C;;UAEC,IAAI,CAAC,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"]}
@@ -1,244 +0,0 @@
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
@@ -1 +0,0 @@
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,GAAG,EAAE,CAAC,MAAM,CAAC,WAAW,CAAC,aAAa,CAAC,CAAC,CAAC;IAExE,IAAI,QAAQ,CAAC,UAAU,EAAE,CAAC;QACxB,MAAM,aAAa,GAAG,QAAQ,CAAC,UAAU,CAAC,aAAa,CACrD,+BAA+B,CAChC,CAA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,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 unknown 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"]}
@@ -1,3 +0,0 @@
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
@@ -1 +0,0 @@
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"]}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=checkbox.type.js.map
@@ -1 +0,0 @@
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"]}
@@ -1,47 +0,0 @@
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
@@ -1 +0,0 @@
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"]}
@@ -1,85 +0,0 @@
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
@@ -1 +0,0 @@
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;QACT,aAAQ,GAAG,GAAG,EAAE,GAAE,CAAC,CAAC;IA6CpD,CAAC;IAzCC,MAAM;QACJ,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC;QAChC,OAAO,IAAI,CAAA;;eAEA,IAAI,CAAC,GAAG;;;;;;;;;;UAUb,IAAI,CAAC,KAAK;;oBAEA,IAAI,CAAC,QAAQ;yBACR,IAAI,CAAC,UAAU;yBACf,IAAI,CAAC,UAAU;;;kBAGtB,IAAI,CAAC,QAAQ;;;mBAGZ,IAAI,CAAC,UAAU;YACtB,CAAC,CAAC,SAAS;YACX,CAAC,CAAC,WAAW;;YAEb,QAAQ,EAAE;;;;6CAIuB,IAAI,CAAC,UAAU;uCACrB,IAAI,CAAC,KAAK;;cAEnC,IAAI,CAAC,UAAU;;;;KAIxB,CAAC;IACJ,CAAC;;AA1CM,mBAAM,GAAG,CAAC,GAAG,CAAA,EAAE,EAAE,QAAQ,CAAC,AAApB,CAAqB;AARN;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;yCAAU;AACT;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;gDAAiB;AAChB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;2CAAY;AACX;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;8CAAc;AACZ;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;gDAAoB;AACpB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;2CAAY;AACT;IAA7B,QAAQ,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC;8CAAqB;AAPvC,YAAY;IADxB,aAAa,CAAC,gBAAgB,CAAC;GACnB,YAAY,CAoDxB","sourcesContent":["import { LitElement, css, html } from 'lit';\nimport { customElement, property } from 'lit/decorators.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"]}
@@ -1,67 +0,0 @@
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
@@ -1 +0,0 @@
1
- {"version":3,"file":"combo-box-list.js","sourceRoot":"","sources":["../../../../../src/components/atoms/combo-box/combo-box-list.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAkB,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAC5D,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AACnE,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC3C,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AACpE,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAGrC,IAAM,YAAY,GAAlB,MAAM,YAAa,SAAQ,UAAU;IAArC;;QAEgD,UAAK,GAAG,YAAY,CAAC;QAEjE,WAAM,GAAG,KAAK,CAAC;IA4C1B,CAAC;IA3CC,IAAI,QAAQ;QACV,IAAI,MAAM,GAAG,IAAI,CAAC,aAAa,CAAC;QAChC,wDAAwD;QACxD,OAAO,MAAM,IAAI,CAAC,CAAC,MAAM,YAAY,QAAQ,CAAC,EAAE,CAAC;YAC/C,MAAM,GAAG,MAAM,CAAC,aAAa,CAAC;QAChC,CAAC;QACD,OAAO,MAAM,CAAC;IAChB,CAAC;IAED,MAAM;QACJ,OAAO,CAAC,GAAG,CAAC,YAAY,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC;QACtC,mCAAmC;QAEnC,kCAAkC;QAClC,qCAAqC;QACrC,OAAO,IAAI,CAAA;;;;0BAIW,IAAI,CAAC,KAAK,KAAK,UAAU;YACzC,CAAC,CAAC,OAAO;YACT,CAAC,CAAC,MAAM;;;;;YAKN,UAAU,EAAE;;;;;;;;;;;;;;;KAenB,CAAC;IACJ,CAAC;;AA9CM,mBAAM,GAAG,CAAC,GAAG,CAAA,EAAE,EAAE,QAAQ,CAAC,AAApB,CAAqB;AACmB;IAApD,QAAQ,CAAC,EAAE,SAAS,EAAE,YAAY,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"]}