@nuraly/lumenui 0.1.0 → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (312) hide show
  1. package/dist/nuralyui.bundle.js +23024 -17355
  2. package/dist/nuralyui.bundle.js.gz +0 -0
  3. package/dist/src/components/alert/alert.component.d.ts +8 -5
  4. package/dist/src/components/alert/alert.component.js +24 -20
  5. package/dist/src/components/alert/alert.style.d.ts +0 -7
  6. package/dist/src/components/alert/alert.style.js +48 -90
  7. package/dist/src/components/alert/bundle.js +82 -108
  8. package/dist/src/components/alert/bundle.js.gz +0 -0
  9. package/dist/src/components/badge/badge.component.d.ts +9 -8
  10. package/dist/src/components/badge/badge.component.js +17 -14
  11. package/dist/src/components/badge/badge.style.d.ts +0 -7
  12. package/dist/src/components/badge/badge.style.js +49 -107
  13. package/dist/src/components/badge/bundle.js +81 -119
  14. package/dist/src/components/badge/bundle.js.gz +0 -0
  15. package/dist/src/components/breadcrumb/breadcrumb.component.d.ts +8 -10
  16. package/dist/src/components/breadcrumb/breadcrumb.component.js +16 -15
  17. package/dist/src/components/breadcrumb/breadcrumb.style.d.ts +0 -7
  18. package/dist/src/components/breadcrumb/breadcrumb.style.js +42 -60
  19. package/dist/src/components/breadcrumb/bundle.js +96 -93
  20. package/dist/src/components/breadcrumb/bundle.js.gz +0 -0
  21. package/dist/src/components/button/bundle.js +221 -470
  22. package/dist/src/components/button/bundle.js.gz +0 -0
  23. package/dist/src/components/button/button.component.d.ts +2 -1
  24. package/dist/src/components/button/button.component.js +6 -6
  25. package/dist/src/components/button/button.style.d.ts +0 -7
  26. package/dist/src/components/button/button.style.js +167 -433
  27. package/dist/src/components/canvas/base-canvas.component.d.ts +2 -1
  28. package/dist/src/components/canvas/base-canvas.component.js +1 -0
  29. package/dist/src/components/canvas/bundle.js +16919 -9595
  30. package/dist/src/components/canvas/bundle.js.gz +0 -0
  31. package/dist/src/components/canvas/canvas.constants.d.ts +1 -1
  32. package/dist/src/components/canvas/canvas.constants.js +1 -1
  33. package/dist/src/components/canvas/chatbot-panel.style.js +31 -31
  34. package/dist/src/components/canvas/index.d.ts +2 -0
  35. package/dist/src/components/canvas/index.js +3 -0
  36. package/dist/src/components/canvas/whiteboard-canvas.component.d.ts +3 -1
  37. package/dist/src/components/canvas/whiteboard-canvas.component.js +19 -1
  38. package/dist/src/components/canvas/whiteboard-canvas.style.js +159 -138
  39. package/dist/src/components/canvas/whiteboard-node.component.d.ts +2 -1
  40. package/dist/src/components/canvas/whiteboard-node.component.js +2 -1
  41. package/dist/src/components/canvas/whiteboard-node.style.js +44 -44
  42. package/dist/src/components/canvas/workflow-canvas-only.d.ts +4 -0
  43. package/dist/src/components/canvas/workflow-canvas-only.js +5 -0
  44. package/dist/src/components/canvas/workflow-canvas.component.d.ts +3 -1
  45. package/dist/src/components/canvas/workflow-canvas.component.js +24 -2
  46. package/dist/src/components/canvas/workflow-canvas.style.js +776 -648
  47. package/dist/src/components/canvas/workflow-canvas.types.d.ts +113 -4
  48. package/dist/src/components/canvas/workflow-canvas.types.js +646 -3
  49. package/dist/src/components/canvas/workflow-node.component.d.ts +3 -2
  50. package/dist/src/components/canvas/workflow-node.component.js +5 -5
  51. package/dist/src/components/canvas/workflow-node.style.js +183 -181
  52. package/dist/src/components/card/bundle.js +43 -35
  53. package/dist/src/components/card/bundle.js.gz +0 -0
  54. package/dist/src/components/card/card.component.d.ts +6 -1
  55. package/dist/src/components/card/card.component.js +8 -2
  56. package/dist/src/components/card/card.style.js +26 -30
  57. package/dist/src/components/carousel/bundle.js +8 -8
  58. package/dist/src/components/carousel/bundle.js.gz +0 -0
  59. package/dist/src/components/carousel/carousel.component.d.ts +12 -0
  60. package/dist/src/components/carousel/carousel.component.js +16 -4
  61. package/dist/src/components/chatbot/bundle.js +422 -406
  62. package/dist/src/components/chatbot/bundle.js.gz +0 -0
  63. package/dist/src/components/chatbot/chatbot.component.d.ts +2 -1
  64. package/dist/src/components/chatbot/chatbot.component.js +1 -0
  65. package/dist/src/components/chatbot/chatbot.style.js +277 -277
  66. package/dist/src/components/checkbox/bundle.js +86 -245
  67. package/dist/src/components/checkbox/bundle.js.gz +0 -0
  68. package/dist/src/components/checkbox/checkbox.component.d.ts +5 -2
  69. package/dist/src/components/checkbox/checkbox.component.js +11 -13
  70. package/dist/src/components/checkbox/checkbox.style.js +56 -231
  71. package/dist/src/components/code-editor/bundle.js +151 -25
  72. package/dist/src/components/code-editor/bundle.js.gz +0 -0
  73. package/dist/src/components/code-editor/code-editor.component.d.ts +18 -56
  74. package/dist/src/components/code-editor/code-editor.component.js +141 -394
  75. package/dist/src/components/code-editor/code-editor.style.js +139 -15
  76. package/dist/src/components/collapse/bundle.js +97 -84
  77. package/dist/src/components/collapse/bundle.js.gz +0 -0
  78. package/dist/src/components/collapse/collapse.component.d.ts +7 -1
  79. package/dist/src/components/collapse/collapse.component.js +11 -2
  80. package/dist/src/components/collapse/collapse.style.js +60 -60
  81. package/dist/src/components/colorpicker/bundle.js +85 -48
  82. package/dist/src/components/colorpicker/bundle.js.gz +0 -0
  83. package/dist/src/components/colorpicker/color-holder.component.d.ts +2 -4
  84. package/dist/src/components/colorpicker/color-holder.component.js +5 -6
  85. package/dist/src/components/colorpicker/color-holder.style.js +11 -11
  86. package/dist/src/components/colorpicker/color-picker.component.d.ts +2 -1
  87. package/dist/src/components/colorpicker/color-picker.component.js +1 -0
  88. package/dist/src/components/colorpicker/color-picker.style.js +12 -12
  89. package/dist/src/components/colorpicker/default-color-sets.component.d.ts +2 -2
  90. package/dist/src/components/colorpicker/default-color-sets.component.js +4 -3
  91. package/dist/src/components/colorpicker/default-color-sets.style.js +5 -5
  92. package/dist/src/components/container/bundle.js +24 -14
  93. package/dist/src/components/container/bundle.js.gz +0 -0
  94. package/dist/src/components/container/container.component.d.ts +4 -1
  95. package/dist/src/components/container/container.component.js +7 -5
  96. package/dist/src/components/container/container.style.js +9 -9
  97. package/dist/src/components/datepicker/bundle.js +193 -177
  98. package/dist/src/components/datepicker/bundle.js.gz +0 -0
  99. package/dist/src/components/datepicker/datepicker.component.d.ts +2 -1
  100. package/dist/src/components/datepicker/datepicker.component.js +1 -0
  101. package/dist/src/components/datepicker/datepicker.style.js +65 -65
  102. package/dist/src/components/datepicker/datepicker.style.variables.js +91 -91
  103. package/dist/src/components/db-connection-select/bundle.js +7 -6
  104. package/dist/src/components/db-connection-select/bundle.js.gz +0 -0
  105. package/dist/src/components/db-connection-select/db-connection-select.component.d.ts +3 -0
  106. package/dist/src/components/db-connection-select/db-connection-select.component.js +4 -0
  107. package/dist/src/components/divider/bundle.js +61 -35
  108. package/dist/src/components/divider/bundle.js.gz +0 -0
  109. package/dist/src/components/divider/divider.component.d.ts +4 -6
  110. package/dist/src/components/divider/divider.component.js +10 -14
  111. package/dist/src/components/divider/divider.style.js +41 -31
  112. package/dist/src/components/document/bundle.js +50 -48
  113. package/dist/src/components/document/bundle.js.gz +0 -0
  114. package/dist/src/components/document/document.component.d.ts +12 -1
  115. package/dist/src/components/document/document.component.js +18 -6
  116. package/dist/src/components/document/document.style.js +21 -36
  117. package/dist/src/components/dropdown/bundle.js +117 -101
  118. package/dist/src/components/dropdown/bundle.js.gz +0 -0
  119. package/dist/src/components/dropdown/dropdown.component.d.ts +2 -1
  120. package/dist/src/components/dropdown/dropdown.component.js +1 -0
  121. package/dist/src/components/dropdown/dropdown.style.js +68 -68
  122. package/dist/src/components/file-upload/bundle.js +82 -76
  123. package/dist/src/components/file-upload/bundle.js.gz +0 -0
  124. package/dist/src/components/file-upload/file-upload.component.d.ts +2 -1
  125. package/dist/src/components/file-upload/file-upload.component.js +1 -0
  126. package/dist/src/components/file-upload/styles.js +59 -59
  127. package/dist/src/components/flex/bundle.js +18 -8
  128. package/dist/src/components/flex/bundle.js.gz +0 -0
  129. package/dist/src/components/flex/flex.component.d.ts +4 -1
  130. package/dist/src/components/flex/flex.component.js +7 -4
  131. package/dist/src/components/flex/flex.style.js +2 -2
  132. package/dist/src/components/form/bundle.js +22 -10
  133. package/dist/src/components/form/bundle.js.gz +0 -0
  134. package/dist/src/components/form/form.component.d.ts +4 -1
  135. package/dist/src/components/form/form.component.js +5 -1
  136. package/dist/src/components/form/form.style.js +2 -2
  137. package/dist/src/components/grid/bundle.js +26 -14
  138. package/dist/src/components/grid/bundle.js.gz +0 -0
  139. package/dist/src/components/grid/col.component.d.ts +4 -1
  140. package/dist/src/components/grid/col.component.js +4 -1
  141. package/dist/src/components/grid/col.style.js +2 -2
  142. package/dist/src/components/grid/row.component.d.ts +4 -1
  143. package/dist/src/components/grid/row.component.js +4 -1
  144. package/dist/src/components/grid/row.style.js +2 -2
  145. package/dist/src/components/icon/bundle.js +78 -252
  146. package/dist/src/components/icon/bundle.js.gz +0 -0
  147. package/dist/src/components/icon/icon-paths.d.ts +2 -0
  148. package/dist/src/components/icon/icon-paths.js +141 -0
  149. package/dist/src/components/icon/icon.component.d.ts +10 -12
  150. package/dist/src/components/icon/icon.component.js +42 -93
  151. package/dist/src/components/icon/icon.style.js +42 -130
  152. package/dist/src/components/icon/icon.variables.js +9 -9
  153. package/dist/src/components/iconpicker/bundle.js +859 -1511
  154. package/dist/src/components/iconpicker/bundle.js.gz +0 -0
  155. package/dist/src/components/iconpicker/icon-picker.component.d.ts +2 -1
  156. package/dist/src/components/iconpicker/icon-picker.component.js +1 -0
  157. package/dist/src/components/iconpicker/icon-picker.style.js +13 -13
  158. package/dist/src/components/image/bundle.js +43 -33
  159. package/dist/src/components/image/bundle.js.gz +0 -0
  160. package/dist/src/components/image/image.component.d.ts +10 -1
  161. package/dist/src/components/image/image.component.js +13 -3
  162. package/dist/src/components/image/image.style.js +19 -26
  163. package/dist/src/components/input/bundle.js +420 -644
  164. package/dist/src/components/input/bundle.js.gz +0 -0
  165. package/dist/src/components/input/input.component.d.ts +16 -3
  166. package/dist/src/components/input/input.component.js +43 -27
  167. package/dist/src/components/input/input.style.d.ts +1 -1
  168. package/dist/src/components/input/input.style.js +331 -634
  169. package/dist/src/components/kv-secret-select/bundle.js +2 -1
  170. package/dist/src/components/kv-secret-select/bundle.js.gz +0 -0
  171. package/dist/src/components/kv-secret-select/kv-secret-select.component.d.ts +3 -0
  172. package/dist/src/components/kv-secret-select/kv-secret-select.component.js +4 -0
  173. package/dist/src/components/label/bundle.js +37 -60
  174. package/dist/src/components/label/bundle.js.gz +0 -0
  175. package/dist/src/components/label/label.component.d.ts +8 -4
  176. package/dist/src/components/label/label.component.js +9 -14
  177. package/dist/src/components/label/label.style.js +17 -25
  178. package/dist/src/components/label/label.style.variables.js +18 -18
  179. package/dist/src/components/layout/bundle.js +86 -70
  180. package/dist/src/components/layout/bundle.js.gz +0 -0
  181. package/dist/src/components/layout/content.component.d.ts +2 -1
  182. package/dist/src/components/layout/content.component.js +2 -1
  183. package/dist/src/components/layout/content.style.js +3 -3
  184. package/dist/src/components/layout/footer.component.d.ts +2 -1
  185. package/dist/src/components/layout/footer.component.js +3 -2
  186. package/dist/src/components/layout/footer.style.js +7 -7
  187. package/dist/src/components/layout/header.component.d.ts +2 -1
  188. package/dist/src/components/layout/header.component.js +3 -2
  189. package/dist/src/components/layout/header.style.js +7 -7
  190. package/dist/src/components/layout/layout.component.d.ts +4 -7
  191. package/dist/src/components/layout/layout.component.js +9 -22
  192. package/dist/src/components/layout/layout.style.js +1 -1
  193. package/dist/src/components/layout/sider.component.d.ts +3 -1
  194. package/dist/src/components/layout/sider.component.js +3 -1
  195. package/dist/src/components/layout/sider.style.js +29 -29
  196. package/dist/src/components/menu/bundle.js +135 -125
  197. package/dist/src/components/menu/bundle.js.gz +0 -0
  198. package/dist/src/components/menu/menu.component.d.ts +2 -1
  199. package/dist/src/components/menu/menu.component.js +1 -0
  200. package/dist/src/components/menu/menu.style.js +87 -87
  201. package/dist/src/components/modal/bundle.js +105 -96
  202. package/dist/src/components/modal/bundle.js.gz +0 -0
  203. package/dist/src/components/modal/modal.component.d.ts +2 -1
  204. package/dist/src/components/modal/modal.component.js +1 -0
  205. package/dist/src/components/modal/modal.style.js +69 -71
  206. package/dist/src/components/panel/bundle.js +190 -391
  207. package/dist/src/components/panel/bundle.js.gz +0 -0
  208. package/dist/src/components/panel/panel.component.d.ts +2 -1
  209. package/dist/src/components/panel/panel.component.js +1 -0
  210. package/dist/src/components/panel/panel.style.js +65 -65
  211. package/dist/src/components/popconfirm/bundle.js +107 -93
  212. package/dist/src/components/popconfirm/bundle.js.gz +0 -0
  213. package/dist/src/components/popconfirm/popconfirm-manager.component.d.ts +2 -1
  214. package/dist/src/components/popconfirm/popconfirm-manager.component.js +1 -0
  215. package/dist/src/components/popconfirm/popconfirm-manager.style.js +16 -16
  216. package/dist/src/components/popconfirm/popconfirm.component.d.ts +2 -1
  217. package/dist/src/components/popconfirm/popconfirm.component.js +9 -5
  218. package/dist/src/components/popconfirm/popconfirm.style.js +43 -43
  219. package/dist/src/components/radio/bundle.js +56 -86
  220. package/dist/src/components/radio/bundle.js.gz +0 -0
  221. package/dist/src/components/radio/radio.component.d.ts +8 -2
  222. package/dist/src/components/radio/radio.component.js +17 -9
  223. package/dist/src/components/radio/radio.style.js +30 -77
  224. package/dist/src/components/radio-group/bundle.js +125 -89
  225. package/dist/src/components/radio-group/bundle.js.gz +0 -0
  226. package/dist/src/components/radio-group/radio-group.component.d.ts +5 -1
  227. package/dist/src/components/radio-group/radio-group.component.js +18 -10
  228. package/dist/src/components/radio-group/radio-group.style.js +44 -44
  229. package/dist/src/components/select/bundle.js +260 -367
  230. package/dist/src/components/select/bundle.js.gz +0 -0
  231. package/dist/src/components/select/select.component.d.ts +12 -17
  232. package/dist/src/components/select/select.component.js +35 -35
  233. package/dist/src/components/select/select.style.js +184 -324
  234. package/dist/src/components/skeleton/bundle.js +82 -162
  235. package/dist/src/components/skeleton/bundle.js.gz +0 -0
  236. package/dist/src/components/skeleton/skeleton.component.d.ts +10 -5
  237. package/dist/src/components/skeleton/skeleton.component.js +20 -7
  238. package/dist/src/components/skeleton/skeleton.style.js +34 -133
  239. package/dist/src/components/slider-input/bundle.js +89 -88
  240. package/dist/src/components/slider-input/bundle.js.gz +0 -0
  241. package/dist/src/components/slider-input/slider-input.component.d.ts +11 -0
  242. package/dist/src/components/slider-input/slider-input.component.js +20 -8
  243. package/dist/src/components/slider-input/slider-input.style.js +47 -47
  244. package/dist/src/components/slider-input/slider-input.style.variables.js +32 -32
  245. package/dist/src/components/table/bundle.js +149 -128
  246. package/dist/src/components/table/bundle.js.gz +0 -0
  247. package/dist/src/components/table/table.component.d.ts +2 -1
  248. package/dist/src/components/table/table.component.js +1 -0
  249. package/dist/src/components/table/table.style.js +79 -79
  250. package/dist/src/components/tabs/bundle.js +462 -663
  251. package/dist/src/components/tabs/bundle.js.gz +0 -0
  252. package/dist/src/components/tabs/tabs.component.d.ts +6 -1
  253. package/dist/src/components/tabs/tabs.component.js +8 -1
  254. package/dist/src/components/tabs/tabs.style.js +200 -201
  255. package/dist/src/components/tag/bundle.js +44 -36
  256. package/dist/src/components/tag/bundle.js.gz +0 -0
  257. package/dist/src/components/tag/tag.component.d.ts +7 -6
  258. package/dist/src/components/tag/tag.component.js +10 -19
  259. package/dist/src/components/tag/tag.style.js +20 -24
  260. package/dist/src/components/textarea/bundle.js +131 -94
  261. package/dist/src/components/textarea/bundle.js.gz +0 -0
  262. package/dist/src/components/textarea/textarea.component.d.ts +7 -1
  263. package/dist/src/components/textarea/textarea.component.js +10 -3
  264. package/dist/src/components/textarea/textarea.style.d.ts +1 -13
  265. package/dist/src/components/textarea/textarea.style.js +79 -91
  266. package/dist/src/components/timeline/bundle.js +71 -134
  267. package/dist/src/components/timeline/bundle.js.gz +0 -0
  268. package/dist/src/components/timeline/timeline.component.d.ts +9 -6
  269. package/dist/src/components/timeline/timeline.component.js +16 -13
  270. package/dist/src/components/timeline/timeline.style.d.ts +0 -7
  271. package/dist/src/components/timeline/timeline.style.js +41 -122
  272. package/dist/src/components/timepicker/bundle.js +196 -166
  273. package/dist/src/components/timepicker/bundle.js.gz +0 -0
  274. package/dist/src/components/timepicker/timepicker.component.d.ts +2 -1
  275. package/dist/src/components/timepicker/timepicker.component.js +1 -0
  276. package/dist/src/components/timepicker/timepicker.style.js +42 -42
  277. package/dist/src/components/timepicker/timepicker.style.variables.js +91 -91
  278. package/dist/src/components/toast/bundle.js +97 -81
  279. package/dist/src/components/toast/bundle.js.gz +0 -0
  280. package/dist/src/components/toast/toast.component.d.ts +2 -1
  281. package/dist/src/components/toast/toast.component.js +1 -0
  282. package/dist/src/components/toast/toast.style.js +62 -62
  283. package/dist/src/components/tooltips/bundle.js +10 -10
  284. package/dist/src/components/tooltips/bundle.js.gz +0 -0
  285. package/dist/src/components/tooltips/tooltips.component.d.ts +8 -0
  286. package/dist/src/components/tooltips/tooltips.component.js +9 -1
  287. package/dist/src/components/tooltips/tooltips.style.js +6 -6
  288. package/dist/src/components/video/bundle.js +47 -36
  289. package/dist/src/components/video/bundle.js.gz +0 -0
  290. package/dist/src/components/video/video.component.d.ts +12 -1
  291. package/dist/src/components/video/video.component.js +18 -6
  292. package/dist/src/components/video/video.style.js +18 -24
  293. package/package.json +25 -12
  294. package/packages/common/dist/VERSIONS.md +2 -2
  295. package/packages/common/dist/shared/base-mixin.d.ts +21 -19
  296. package/packages/common/dist/shared/base-mixin.d.ts.map +1 -1
  297. package/packages/common/dist/shared/base-mixin.js +102 -18
  298. package/packages/common/dist/shared/base-mixin.js.map +1 -1
  299. package/packages/common/dist/shared/index.d.ts +1 -0
  300. package/packages/common/dist/shared/index.d.ts.map +1 -1
  301. package/packages/common/dist/shared/index.js +2 -0
  302. package/packages/common/dist/shared/index.js.map +1 -1
  303. package/packages/common/dist/shared/style-injector.d.ts +11 -0
  304. package/packages/common/dist/shared/style-injector.d.ts.map +1 -0
  305. package/packages/common/dist/shared/style-injector.js +53 -0
  306. package/packages/common/dist/shared/style-injector.js.map +1 -0
  307. package/packages/common/dist/shared/theme-mixin.d.ts +2 -24
  308. package/packages/common/dist/shared/theme-mixin.d.ts.map +1 -1
  309. package/packages/common/dist/shared/theme-mixin.js +5 -38
  310. package/packages/common/dist/shared/theme-mixin.js.map +1 -1
  311. package/packages/themes/dist/default.css +0 -10
  312. package/packages/themes/dist/package.json +1 -1
@@ -1,9 +1,9 @@
1
- import{css as t,LitElement as i,html as s}from"lit";import{property as e,state as n,customElement as r}from"lit/decorators.js";import{NuralyUIBaseMixin as o}from"@nuralyui/common/mixins";
1
+ import{css as t,html as i,LitElement as e}from"lit";import{property as s,state as n,customElement as r}from"lit/decorators.js";
2
2
  /**
3
3
  * @license
4
4
  * Copyright 2023 Nuraly, Laabidi Aymen
5
5
  * SPDX-License-Identifier: MIT
6
- */const a=t`
6
+ */const o=t`
7
7
  :host {
8
8
  display: block;
9
9
  width: 100%;
@@ -18,7 +18,7 @@ import{css as t,LitElement as i,html as s}from"lit";import{property as e,state a
18
18
  width: 100%;
19
19
  display: flex;
20
20
  flex-direction: column;
21
- gap: var(--nuraly-form-gap, 16px);
21
+ gap: 16px;
22
22
  }
23
23
 
24
24
  .form-wrapper[disabled] {
@@ -60,7 +60,7 @@ import{css as t,LitElement as i,html as s}from"lit";import{property as e,state a
60
60
  /* Responsive design */
61
61
  @media (max-width: 768px) {
62
62
  .form-wrapper {
63
- gap: var(--nuraly-form-gap-mobile, 12px);
63
+ gap: 12px;
64
64
  }
65
65
  }
66
66
  `
@@ -68,23 +68,35 @@ import{css as t,LitElement as i,html as s}from"lit";import{property as e,state a
68
68
  * @license
69
69
  * Copyright 2023 Nuraly, Laabidi Aymen
70
70
  * SPDX-License-Identifier: MIT
71
- */;var d,l;!function(t){t.Pristine="pristine",t.Pending="pending",t.Valid="valid",t.Invalid="invalid",t.Submitted="submitted"}(d||(d={})),function(t){t.Idle="idle",t.Submitting="submitting",t.Success="success",t.Error="error"}(l||(l={}));const h={VALIDATION_CHANGED:"nr-form-validation-changed",FIELD_CHANGED:"nr-form-field-changed",SUBMIT_ATTEMPT:"nr-form-submit-attempt",SUBMIT_SUCCESS:"nr-form-submit-success",SUBMIT_ERROR:"nr-form-submit-error",RESET:"nr-form-reset"};
71
+ */;var a,d;!function(t){t.Pristine="pristine",t.Pending="pending",t.Valid="valid",t.Invalid="invalid",t.Submitted="submitted"}(a||(a={})),function(t){t.Idle="idle",t.Submitting="submitting",t.Success="success",t.Error="error"}(d||(d={}));const h={VALIDATION_CHANGED:"nr-form-validation-changed",FIELD_CHANGED:"nr-form-field-changed",SUBMIT_ATTEMPT:"nr-form-submit-attempt",SUBMIT_SUCCESS:"nr-form-submit-success",SUBMIT_ERROR:"nr-form-submit-error",RESET:"nr-form-reset"},l=t=>class extends t{constructor(){super(...arguments),this.handleSystemThemeChange=()=>{this.closest("[data-theme]")||document.documentElement.hasAttribute("data-theme")||this.requestUpdate()}}connectedCallback(){super.connectedCallback(),this.setupThemeObserver(),this.setupDesignSystemObserver(),this.setupSystemThemeListener()}disconnectedCallback(){var t,i,e;super.disconnectedCallback(),null===(t=this.themeObserver)||void 0===t||t.disconnect(),null===(i=this.designSystemObserver)||void 0===i||i.disconnect(),null===(e=this.mediaQuery)||void 0===e||e.removeEventListener("change",this.handleSystemThemeChange)}get currentTheme(){var t,i;const e=(null===(t=this.closest("[data-theme]"))||void 0===t?void 0:t.getAttribute("data-theme"))||document.documentElement.getAttribute("data-theme");return e||((null===(i=window.matchMedia)||void 0===i?void 0:i.call(window,"(prefers-color-scheme: dark)").matches)?"dark":"light")}get currentDesignSystem(){var t;const i=(null===(t=this.closest("[design-system]"))||void 0===t?void 0:t.getAttribute("design-system"))||document.documentElement.getAttribute("design-system");return"carbon"===i?i:"default"}setupThemeObserver(){this.themeObserver=new MutationObserver(()=>{this.requestUpdate()}),this.themeObserver.observe(document.documentElement,{attributes:!0,attributeFilter:["data-theme"]})}setupDesignSystemObserver(){this.designSystemObserver=new MutationObserver(()=>{this.requestUpdate()}),this.designSystemObserver.observe(document.documentElement,{attributes:!0,attributeFilter:["design-system"]})}setupSystemThemeListener(){window.matchMedia&&(this.mediaQuery=window.matchMedia("(prefers-color-scheme: dark)"),this.mediaQuery.addEventListener("change",this.handleSystemThemeChange))}},c=()=>{var t;return void 0!==globalThis.litElementVersions||"undefined"!=typeof process&&"development"===(null===(t=process.env)||void 0===t?void 0:t.NODE_ENV)||"undefined"!=typeof window&&("localhost"===window.location.hostname||"127.0.0.1"===window.location.hostname)},u=t=>class extends t{constructor(){super(...arguments),this.requiredComponents=[]}validateDependencies(){if(c())for(const t of this.requiredComponents)if(!this.isComponentAvailable(t))throw new Error(`Required component "${t}" is not registered. Please import and register the component before using ${this.tagName.toLowerCase()}. Example: import '@nuralyui/${t}';`)}validateDependenciesWithHandler(t){if(!c())return!0;let i=!0;for(const e of this.requiredComponents)if(!this.isComponentAvailable(e)){i=!1;const s=new Error(`Required component "${e}" is not registered. Please import and register the component before using ${this.tagName.toLowerCase()}.`);t?t(e,s):console.error(s.message)}return i}isComponentAvailable(t){return!!customElements.get(t)}getMissingDependencies(){return this.requiredComponents.filter(t=>!this.isComponentAvailable(t))}areDependenciesAvailable(){return this.requiredComponents.every(t=>this.isComponentAvailable(t))}addRequiredComponent(t){this.requiredComponents.includes(t)||this.requiredComponents.push(t)}removeRequiredComponent(t){const i=this.requiredComponents.indexOf(t);i>-1&&this.requiredComponents.splice(i,1)}},v=t=>class extends t{dispatchCustomEvent(t,i){this.dispatchEvent(new CustomEvent(t,{detail:i,bubbles:!0,composed:!0}))}dispatchEventWithMetadata(t,i){var e;const s=Object.assign(Object.assign({},i),{timestamp:Date.now(),componentName:(null===(e=this.tagName)||void 0===e?void 0:e.toLowerCase())||"unknown"});this.dispatchCustomEvent(t,s)}dispatchInputEvent(t,i){const e=Object.assign({target:i.target||this,value:i.value,originalEvent:i.originalEvent},i);this.dispatchCustomEvent(t,e)}dispatchFocusEvent(t,i){const e=Object.assign({target:i.target||this,value:i.value,focused:i.focused,cursorPosition:i.cursorPosition,selectedText:i.selectedText},i);this.dispatchCustomEvent(t,e)}dispatchValidationEvent(t,i){var e;const s=Object.assign({target:i.target||this,value:i.value,isValid:null!==(e=i.isValid)&&void 0!==e&&e,error:i.error},i);this.dispatchCustomEvent(t,s)}dispatchActionEvent(t,i){const e=Object.assign({target:i.target||this,action:i.action,previousValue:i.previousValue,newValue:i.newValue},i);this.dispatchCustomEvent(t,e)}isReadonlyKeyAllowed(t){if(t.ctrlKey||t.metaKey){return["KeyA","KeyC"].includes(t.code)}return["Tab","Escape","ArrowLeft","ArrowRight","ArrowUp","ArrowDown","Home","End","PageUp","PageDown"].includes(t.key)}isActivationKey(t){return"Enter"===t.key||" "===t.key}},m=new Set,f=new Map;
72
72
  /**
73
73
  * @license
74
74
  * Copyright 2023 Nuraly, Laabidi Aymen
75
75
  * SPDX-License-Identifier: MIT
76
- */var u=function(t,i,s,e){return new(s||(s=Promise))(function(n,r){function o(t){try{d(e.next(t))}catch(t){r(t)}}function a(t){try{d(e.throw(t))}catch(t){r(t)}}function d(t){var i;t.done?n(t.value):(i=t.value,i instanceof s?i:new s(function(t){t(i)})).then(o,a)}d((e=e.apply(t,i||[])).next())})};class c{constructor(t){this.host=t,this.fields=new Map,this.validationState=d.Pristine,this.validationPromise=null}registerField(t){var i;const s=t.name||t.getAttribute("name")||`field-${Date.now()}`,e={element:t,name:s,value:t.value,isValid:t.getValidationStatus().isValid,validationMessage:t.validationMessage||"",required:null!==(i=t.required)&&void 0!==i&&i,touched:!1,dirty:!1};this.fields.set(s,e),this.addFieldListeners(t,s)}unregisterField(t){const i=this.fields.get(t);i&&(this.removeFieldListeners(i.element),this.fields.delete(t))}addFieldListeners(t,i){t.addEventListener("nr-validation",t=>this.handleFieldValidation(i,t))}removeFieldListeners(t){}handleFieldValidation(t,i){const s=this.fields.get(t);if(s){if(i&&i.detail)s.isValid=i.detail.isValid||!1,s.validationMessage=i.detail.validationMessage||"";else{const t=s.element.getValidationStatus();s.isValid=t.isValid,s.validationMessage=s.element.validationMessage||""}this.updateFormValidationState()}}updateFormValidationState(){const t=this.getInvalidFields(),i=0===t.length;this.validationState=i?d.Valid:d.Invalid;const s={isValid:i,invalidFields:t,validationErrors:this.buildValidationErrors(),summary:i?"Form is valid":`${t.length} field(s) have errors`};this.dispatchValidationEvent(s)}buildValidationErrors(){const t={};for(const[i,s]of this.fields)!s.isValid&&s.validationMessage&&(t[i]=s.validationMessage);return t}validateForm(){return null!==this.validationPromise||(this.validationState=d.Pending,this.validationPromise=this.performValidation()),this.validationPromise}performValidation(){return u(this,void 0,void 0,function*(){const t=[],i={};for(const[s,e]of this.fields){const n=e.element.getValidationStatus().isValid;e.isValid=n,e.validationMessage=e.element.validationMessage||"",n||(t.push(e),i[s]=e.validationMessage)}const s=0===t.length;this.validationState=s?d.Valid:d.Invalid;const e={isValid:s,invalidFields:t,validationErrors:i,summary:s?"Form is valid":`${t.length} field(s) have errors`};return this.dispatchValidationEvent(e),this.validationPromise=null,e})}getValidationState(){return this.validationState}getFields(){return Array.from(this.fields.values())}getInvalidFields(){return Array.from(this.fields.values()).filter(t=>!t.isValid)}isValid(){return this.validationState===d.Valid&&Array.from(this.fields.values()).every(t=>t.isValid)}focusFirstInvalidField(){const t=Array.from(this.fields.values()).find(t=>!t.isValid);return!(!t||"function"!=typeof t.element.focus)&&(t.element.focus(),!0)}reset(){for(const t of this.fields.values())"clearValidation"in t.element&&"function"==typeof t.element.clearValidation&&t.element.clearValidation(),"value"in t.element&&(t.element.value=""),t.touched=!1,t.dirty=!1,t.isValid=!0,t.validationMessage="";this.validationState=d.Pristine,this.dispatchResetEvent()}dispatchValidationEvent(t){var i,s;null===(s=(i=this.host).dispatchCustomEvent)||void 0===s||s.call(i,h.VALIDATION_CHANGED,{validationResult:t})}dispatchResetEvent(){var t,i;null===(i=(t=this.host).dispatchCustomEvent)||void 0===i||i.call(t,h.RESET,{})}}
76
+ */
77
77
  /**
78
78
  * @license
79
79
  * Copyright 2023 Nuraly, Laabidi Aymen
80
80
  * SPDX-License-Identifier: MIT
81
- */var v=function(t,i,s,e){return new(s||(s=Promise))(function(n,r){function o(t){try{d(e.next(t))}catch(t){r(t)}}function a(t){try{d(e.throw(t))}catch(t){r(t)}}function d(t){var i;t.done?n(t.value):(i=t.value,i instanceof s?i:new s(function(t){t(i)})).then(o,a)}d((e=e.apply(t,i||[])).next())})};class m{constructor(t){this.host=t,this.submissionState=l.Idle,this.lastSubmissionData=null}getSubmissionState(){return this.submissionState}isSubmitting(){return this.submissionState===l.Submitting}collectFormData(){const t=new FormData,i={},s={};return this.getFormFields().forEach(e=>{const n=e.name||e.getAttribute("name");if(!n)return;const r=e.value;null!=r&&t.append(n,String(r)),i[n]=r,s[n]={element:e,value:r,name:n,type:e.tagName.toLowerCase(),required:e.required||!1,disabled:e.disabled||!1}}),{formData:t,jsonData:i,fields:s}}submitForm(t){return v(this,void 0,void 0,function*(){if(this.isSubmitting())throw new Error("Form is already submitting");try{this.setSubmissionState(l.Submitting);const i=this.host.validationController;if(i){const t=yield i.validateForm();if(!t.isValid)throw i.focusFirstInvalidField(),this.dispatchSubmitAttemptEvent(t),new Error(`Form validation failed: ${t.summary}`)}const s=this.collectFormData();return t&&(Object.assign(s.jsonData,t),Object.entries(t).forEach(([t,i])=>{s.formData.append(t,String(i))})),this.lastSubmissionData=s,this.dispatchSubmitSuccessEvent(s),this.setSubmissionState(l.Success),s}catch(t){throw this.setSubmissionState(l.Error),this.dispatchSubmitErrorEvent(t),t}})}resetSubmission(){this.submissionState=l.Idle,this.lastSubmissionData=null}getLastSubmissionData(){return this.lastSubmissionData}getFormFields(){var t;const i=this.host,s=[],e=["nr-input","nr-select","nr-radio","nr-checkbox","nr-textarea","nr-timepicker","nr-datepicker","input","select","textarea"];e.forEach(t=>{i.querySelectorAll(t).forEach(t=>{(t.name||t.getAttribute("name"))&&s.push(t)})});return((null===(t=i.shadowRoot)||void 0===t?void 0:t.querySelectorAll("slot"))||[]).forEach(t=>{t.assignedElements({flatten:!0}).forEach(t=>{e.forEach(i=>{if(t.matches&&t.matches(i)){const i=t;(i.name||i.getAttribute("name"))&&s.push(i)}t.querySelectorAll(i).forEach(t=>{const i=t;(i.name||i.getAttribute("name"))&&s.push(i)})})})}),s}setSubmissionState(t){var i,s;this.submissionState=t,null===(s=(i=this.host).requestUpdate)||void 0===s||s.call(i)}dispatchSubmitAttemptEvent(t){var i,s;null===(s=(i=this.host).dispatchCustomEvent)||void 0===s||s.call(i,h.SUBMIT_ATTEMPT,{validationResult:t})}dispatchSubmitSuccessEvent(t){var i,s;null===(s=(i=this.host).dispatchCustomEvent)||void 0===s||s.call(i,h.SUBMIT_SUCCESS,{formData:t})}dispatchSubmitErrorEvent(t){var i,s;null===(s=(i=this.host).dispatchCustomEvent)||void 0===s||s.call(i,h.SUBMIT_ERROR,{error:t})}}
81
+ */
82
+ const p=t=>{class i extends t{constructor(){super(...arguments),this.t=null}createRenderRoot(){return this.constructor.useShadowDom?super.createRenderRoot():this}connectedCallback(){const t=this.constructor.useShadowDom;if(!t&&null===this.t)for(this.t=[];this.firstChild;)this.t.push(this.removeChild(this.firstChild));if(super.connectedCallback(),!t){const t=this.constructor,i=this.tagName.toLowerCase(),e=t.styles;if(e){const t=b(e);t&&function(t,i,e){var s;if(!f.has(t)){const e=new CSSStyleSheet;e.replaceSync(i),f.set(t,e)}const n=f.get(t),r=`doc:${t}`;if(m.has(r)||(document.adoptedStyleSheets=[...document.adoptedStyleSheets,n],m.add(r)),e){let i=e;for(;i;){const e=i.getRootNode();if(!(e instanceof ShadowRoot))break;{const r=`shadow:${((null===(s=e.host)||void 0===s?void 0:s.tagName)||"").toLowerCase()}:${t}`;m.has(r)||(e.adoptedStyleSheets=[...e.adoptedStyleSheets,n],m.add(r)),i=e.host}}}}(i,t,this)}}}get lightChildren(){return this.t?this.t.filter(t=>!(t instanceof Element&&t.hasAttribute("slot"))):[]}lightChildrenNamed(t){return this.t?this.t.filter(i=>i instanceof Element&&i.getAttribute("slot")===t):[]}}return i.useShadowDom=!1,i};function b(t){return Array.isArray(t)?t.map(t=>b(t)).filter(Boolean).join("\n"):t&&"string"==typeof t.cssText?t.cssText:"string"==typeof t?t:""}
82
83
  /**
83
84
  * @license
84
85
  * Copyright 2023 Nuraly, Laabidi Aymen
85
86
  * SPDX-License-Identifier: MIT
86
- */var f=function(t,i,s,e){for(var n,r=arguments.length,o=r<3?i:null===e?e=Object.getOwnPropertyDescriptor(i,s):e,a=t.length-1;a>=0;a--)(n=t[a])&&(o=(r<3?n(o):r>3?n(i,s,o):n(i,s))||o);return r>3&&o&&Object.defineProperty(i,s,o),o},p=function(t,i,s,e){return new(s||(s=Promise))(function(n,r){function o(t){try{d(e.next(t))}catch(t){r(t)}}function a(t){try{d(e.throw(t))}catch(t){r(t)}}function d(t){var i;t.done?n(t.value):(i=t.value,i instanceof s?i:new s(function(t){t(i)})).then(o,a)}d((e=e.apply(t,i||[])).next())})};let b=class extends(o(i)){constructor(){super(...arguments),this.config={validateOnChange:!1,validateOnBlur:!0,showErrorsImmediately:!1,preventInvalidSubmission:!0,resetOnSuccess:!1,validationDelay:300},this.validateOnChange=!1,this.validateOnBlur=!0,this.preventInvalidSubmission=!0,this.resetOnSuccess=!1,this.method="POST",this.enctype="multipart/form-data",this.disabled=!1,this._validationState=d.Pristine,this._submissionState=l.Idle,this.validationController=new c(this),this.submissionController=new m(this),this.handleValidationChanged=t=>{const i=t.detail.validationResult;i&&(this._validationState=i.isValid?d.Valid:d.Invalid)}}get validationState(){return this._validationState}get submissionState(){return this._submissionState}connectedCallback(){super.connectedCallback(),this.setupFormObserver()}disconnectedCallback(){super.disconnectedCallback(),this.cleanupFormObserver()}willUpdate(t){super.willUpdate(t),(t.has("validateOnChange")||t.has("validateOnBlur")||t.has("preventInvalidSubmission")||t.has("resetOnSuccess"))&&(this.config=Object.assign(Object.assign({},this.config),{validateOnChange:this.validateOnChange,validateOnBlur:this.validateOnBlur,preventInvalidSubmission:this.preventInvalidSubmission,resetOnSuccess:this.resetOnSuccess}))}firstUpdated(){this.registerExistingFields(),this.setupFormEvents()}setupFormObserver(){const t=new MutationObserver(t=>{t.forEach(t=>{t.addedNodes.forEach(t=>{t.nodeType===Node.ELEMENT_NODE&&this.registerFieldsInElement(t)})})});t.observe(this,{childList:!0,subtree:!0}),this._formObserver=t}cleanupFormObserver(){const t=this._formObserver;t&&t.disconnect()}registerExistingFields(){this.registerFieldsInElement(this)}registerFieldsInElement(t){["nr-input","nr-select","nr-radio","nr-checkbox","nr-textarea","nr-timepicker","nr-datepicker"].forEach(i=>{t.querySelectorAll(i).forEach(t=>{t.getAttribute("name")&&this.validationController.registerField(t)})})}setupFormEvents(){this.addEventListener("submit",this.handleFormSubmit),this.addEventListener("reset",this.handleFormReset),this.addEventListener(h.VALIDATION_CHANGED,this.handleValidationChanged)}handleFormSubmit(t){return p(this,void 0,void 0,function*(){if(t.preventDefault(),!this.disabled)try{const t=yield this.submissionController.submitForm();this.resetOnSuccess&&this.reset(),this.action&&this.performNativeSubmission(t.formData)}catch(t){console.error("Form submission failed:",t)}})}handleFormReset(t){t.preventDefault(),this.reset()}performNativeSubmission(t){const i=document.createElement("form");i.action=this.action,i.method=this.method,i.enctype=this.enctype,this.target&&(i.target=this.target);for(const[s,e]of t.entries()){const t=document.createElement("input");t.type="hidden",t.name=s,t.value=e,i.appendChild(t)}document.body.appendChild(i),i.submit(),document.body.removeChild(i)}validate(){return p(this,void 0,void 0,function*(){return(yield this.validationController.validateForm()).isValid})}submit(t){return p(this,void 0,void 0,function*(){yield this.submissionController.submitForm(t)})}reset(){this.validationController.reset(),this.submissionController.resetSubmission(),this._validationState=d.Pristine,this._submissionState=l.Idle}get isValid(){return this.validationController.isValid()}get isSubmitting(){return this.submissionController.isSubmitting()}getFormData(){return this.submissionController.collectFormData()}getInvalidFields(){return this.validationController.getInvalidFields()}getFieldsValue(t){const i=this.getFormData().jsonData;if(t&&t.length>0){const s={};return t.forEach(t=>{t in i&&(s[t]=i[t])}),s}return i}getFieldValue(t){return this.getFieldsValue()[t]}setFieldsValue(t){Object.entries(t).forEach(([t,i])=>{this.setFieldValue(t,i)})}setFieldValue(t,i){const s=this.validationController.getFields().find(i=>i.name===t);s&&s.element&&(s.element.value=i,s.value=i,s.element.dispatchEvent(new Event("change",{bubbles:!0})))}validateFields(t){return p(this,void 0,void 0,function*(){const i=yield this.validationController.validateForm();if(t&&t.length>0){const s={};if(t.forEach(t=>{i.validationErrors[t]&&(s[t]=i.validationErrors[t])}),Object.keys(s).length>0)throw new Error(JSON.stringify(s));return this.getFieldsValue(t)}if(!i.isValid)throw new Error(JSON.stringify(i.validationErrors));return this.getFieldsValue()})}resetFields(t){if(!t||0===t.length)return void this.reset();const i=this.validationController.getFields();t.forEach(t=>{const s=i.find(i=>i.name===t);s&&s.element&&(s.element.value="",s.value="",s.touched=!1,s.dirty=!1,s.isValid=!0,s.validationMessage="",s.element.dispatchEvent(new Event("change",{bubbles:!0})))})}getFieldError(t){const i=this.validationController.getFields().find(i=>i.name===t);return i&&!i.isValid?i.validationMessage:null}getFieldsError(t){const i=this.validationController.getFields(),s={};return(t?i.filter(i=>t.includes(i.name)):i).forEach(t=>{s[t.name]=t.isValid?null:t.validationMessage}),s}isFieldTouched(t){const i=this.validationController.getFields().find(i=>i.name===t);return!!i&&i.touched}isFieldsTouched(t){const i=this.validationController.getFields();return(t?i.filter(i=>t.includes(i.name)):i).some(t=>t.touched)}isFieldDirty(t){const i=this.validationController.getFields().find(i=>i.name===t);return!!i&&i.dirty}isFieldsDirty(t){const i=this.validationController.getFields();return(t?i.filter(i=>t.includes(i.name)):i).some(t=>t.dirty)}getFieldInstance(t){const i=this.validationController.getFields().find(i=>i.name===t);return i?i.element:null}scrollToField(t){if(t){const i=this.getFieldInstance(t);return!!i&&(i.scrollIntoView({behavior:"smooth",block:"center"}),"function"==typeof i.focus&&i.focus(),!0)}return this.validationController.focusFirstInvalidField()}finish(){return p(this,void 0,void 0,function*(){try{const t=yield this.validateFields();return yield this.submit(),t}catch(t){throw this.scrollToField(),t}})}getFieldsWithErrors(){return this.validationController.getFields().filter(t=>!t.isValid).map(t=>t.name)}hasErrors(){return this.getFieldsWithErrors().length>0}getFormState(){const t=this.validationController.getFields();return{isValid:this.isValid,isSubmitting:this.isSubmitting,hasErrors:this.hasErrors(),errorCount:this.getFieldsWithErrors().length,fieldCount:t.length,touchedFields:t.filter(t=>t.touched).map(t=>t.name),dirtyFields:t.filter(t=>t.dirty).map(t=>t.name),invalidFields:this.getFieldsWithErrors()}}setLoading(t){this.disabled=t,this.requestUpdate()}render(){return s`
87
- <form
87
+ */var g=function(t,i,e,s){return new(e||(e=Promise))(function(n,r){function o(t){try{d(s.next(t))}catch(t){r(t)}}function a(t){try{d(s.throw(t))}catch(t){r(t)}}function d(t){var i;t.done?n(t.value):(i=t.value,i instanceof e?i:new e(function(t){t(i)})).then(o,a)}d((s=s.apply(t,i||[])).next())})};class y{constructor(t){this.host=t,this.fields=new Map,this.validationState=a.Pristine,this.validationPromise=null}registerField(t){var i;const e=t.name||t.getAttribute("name")||`field-${Date.now()}`,s={element:t,name:e,value:t.value,isValid:t.getValidationStatus().isValid,validationMessage:t.validationMessage||"",required:null!==(i=t.required)&&void 0!==i&&i,touched:!1,dirty:!1};this.fields.set(e,s),this.addFieldListeners(t,e)}unregisterField(t){const i=this.fields.get(t);i&&(this.removeFieldListeners(i.element),this.fields.delete(t))}addFieldListeners(t,i){t.addEventListener("nr-validation",t=>this.handleFieldValidation(i,t))}removeFieldListeners(t){}handleFieldValidation(t,i){const e=this.fields.get(t);if(e){if(i&&i.detail)e.isValid=i.detail.isValid||!1,e.validationMessage=i.detail.validationMessage||"";else{const t=e.element.getValidationStatus();e.isValid=t.isValid,e.validationMessage=e.element.validationMessage||""}this.updateFormValidationState()}}updateFormValidationState(){const t=this.getInvalidFields(),i=0===t.length;this.validationState=i?a.Valid:a.Invalid;const e={isValid:i,invalidFields:t,validationErrors:this.buildValidationErrors(),summary:i?"Form is valid":`${t.length} field(s) have errors`};this.dispatchValidationEvent(e)}buildValidationErrors(){const t={};for(const[i,e]of this.fields)!e.isValid&&e.validationMessage&&(t[i]=e.validationMessage);return t}validateForm(){return null!==this.validationPromise||(this.validationState=a.Pending,this.validationPromise=this.performValidation()),this.validationPromise}performValidation(){return g(this,void 0,void 0,function*(){const t=[],i={};for(const[e,s]of this.fields){const n=s.element.getValidationStatus().isValid;s.isValid=n,s.validationMessage=s.element.validationMessage||"",n||(t.push(s),i[e]=s.validationMessage)}const e=0===t.length;this.validationState=e?a.Valid:a.Invalid;const s={isValid:e,invalidFields:t,validationErrors:i,summary:e?"Form is valid":`${t.length} field(s) have errors`};return this.dispatchValidationEvent(s),this.validationPromise=null,s})}getValidationState(){return this.validationState}getFields(){return Array.from(this.fields.values())}getInvalidFields(){return Array.from(this.fields.values()).filter(t=>!t.isValid)}isValid(){return this.validationState===a.Valid&&Array.from(this.fields.values()).every(t=>t.isValid)}focusFirstInvalidField(){const t=Array.from(this.fields.values()).find(t=>!t.isValid);return!(!t||"function"!=typeof t.element.focus)&&(t.element.focus(),!0)}reset(){for(const t of this.fields.values())"clearValidation"in t.element&&"function"==typeof t.element.clearValidation&&t.element.clearValidation(),"value"in t.element&&(t.element.value=""),t.touched=!1,t.dirty=!1,t.isValid=!0,t.validationMessage="";this.validationState=a.Pristine,this.dispatchResetEvent()}dispatchValidationEvent(t){var i,e;null===(e=(i=this.host).dispatchCustomEvent)||void 0===e||e.call(i,h.VALIDATION_CHANGED,{validationResult:t})}dispatchResetEvent(){var t,i;null===(i=(t=this.host).dispatchCustomEvent)||void 0===i||i.call(t,h.RESET,{})}}
88
+ /**
89
+ * @license
90
+ * Copyright 2023 Nuraly, Laabidi Aymen
91
+ * SPDX-License-Identifier: MIT
92
+ */var w=function(t,i,e,s){return new(e||(e=Promise))(function(n,r){function o(t){try{d(s.next(t))}catch(t){r(t)}}function a(t){try{d(s.throw(t))}catch(t){r(t)}}function d(t){var i;t.done?n(t.value):(i=t.value,i instanceof e?i:new e(function(t){t(i)})).then(o,a)}d((s=s.apply(t,i||[])).next())})};class F{constructor(t){this.host=t,this.submissionState=d.Idle,this.lastSubmissionData=null}getSubmissionState(){return this.submissionState}isSubmitting(){return this.submissionState===d.Submitting}collectFormData(){const t=new FormData,i={},e={};return this.getFormFields().forEach(s=>{const n=s.name||s.getAttribute("name");if(!n)return;const r=s.value;null!=r&&t.append(n,String(r)),i[n]=r,e[n]={element:s,value:r,name:n,type:s.tagName.toLowerCase(),required:s.required||!1,disabled:s.disabled||!1}}),{formData:t,jsonData:i,fields:e}}submitForm(t){return w(this,void 0,void 0,function*(){if(this.isSubmitting())throw new Error("Form is already submitting");try{this.setSubmissionState(d.Submitting);const i=this.host.validationController;if(i){const t=yield i.validateForm();if(!t.isValid)throw i.focusFirstInvalidField(),this.dispatchSubmitAttemptEvent(t),new Error(`Form validation failed: ${t.summary}`)}const e=this.collectFormData();return t&&(Object.assign(e.jsonData,t),Object.entries(t).forEach(([t,i])=>{e.formData.append(t,String(i))})),this.lastSubmissionData=e,this.dispatchSubmitSuccessEvent(e),this.setSubmissionState(d.Success),e}catch(t){throw this.setSubmissionState(d.Error),this.dispatchSubmitErrorEvent(t),t}})}resetSubmission(){this.submissionState=d.Idle,this.lastSubmissionData=null}getLastSubmissionData(){return this.lastSubmissionData}getFormFields(){var t;const i=this.host,e=[],s=["nr-input","nr-select","nr-radio","nr-checkbox","nr-textarea","nr-timepicker","nr-datepicker","input","select","textarea"];s.forEach(t=>{i.querySelectorAll(t).forEach(t=>{(t.name||t.getAttribute("name"))&&e.push(t)})});return((null===(t=i.shadowRoot)||void 0===t?void 0:t.querySelectorAll("slot"))||[]).forEach(t=>{t.assignedElements({flatten:!0}).forEach(t=>{s.forEach(i=>{if(t.matches&&t.matches(i)){const i=t;(i.name||i.getAttribute("name"))&&e.push(i)}t.querySelectorAll(i).forEach(t=>{const i=t;(i.name||i.getAttribute("name"))&&e.push(i)})})})}),e}setSubmissionState(t){var i,e;this.submissionState=t,null===(e=(i=this.host).requestUpdate)||void 0===e||e.call(i)}dispatchSubmitAttemptEvent(t){var i,e;null===(e=(i=this.host).dispatchCustomEvent)||void 0===e||e.call(i,h.SUBMIT_ATTEMPT,{validationResult:t})}dispatchSubmitSuccessEvent(t){var i,e;null===(e=(i=this.host).dispatchCustomEvent)||void 0===e||e.call(i,h.SUBMIT_SUCCESS,{formData:t})}dispatchSubmitErrorEvent(t){var i,e;null===(e=(i=this.host).dispatchCustomEvent)||void 0===e||e.call(i,h.SUBMIT_ERROR,{error:t})}}
93
+ /**
94
+ * @license
95
+ * Copyright 2023 Nuraly, Laabidi Aymen
96
+ * SPDX-License-Identifier: MIT
97
+ */var S=function(t,i,e,s){for(var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s,a=t.length-1;a>=0;a--)(n=t[a])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o},E=function(t,i,e,s){return new(e||(e=Promise))(function(n,r){function o(t){try{d(s.next(t))}catch(t){r(t)}}function a(t){try{d(s.throw(t))}catch(t){r(t)}}function d(t){var i;t.done?n(t.value):(i=t.value,i instanceof e?i:new e(function(t){t(i)})).then(o,a)}d((s=s.apply(t,i||[])).next())})};let O=class extends((t=>u(l(v(p(t)))))(e)){constructor(){super(...arguments),this.config={validateOnChange:!1,validateOnBlur:!0,showErrorsImmediately:!1,preventInvalidSubmission:!0,resetOnSuccess:!1,validationDelay:300},this.validateOnChange=!1,this.validateOnBlur=!0,this.preventInvalidSubmission=!0,this.resetOnSuccess=!1,this.method="POST",this.enctype="multipart/form-data",this.disabled=!1,this._validationState=a.Pristine,this._submissionState=d.Idle,this.validationController=new y(this),this.submissionController=new F(this),this.handleValidationChanged=t=>{const i=t.detail.validationResult;i&&(this._validationState=i.isValid?a.Valid:a.Invalid)}}get validationState(){return this._validationState}get submissionState(){return this._submissionState}connectedCallback(){super.connectedCallback(),this.setupFormObserver()}disconnectedCallback(){super.disconnectedCallback(),this.cleanupFormObserver()}willUpdate(t){super.willUpdate(t),(t.has("validateOnChange")||t.has("validateOnBlur")||t.has("preventInvalidSubmission")||t.has("resetOnSuccess"))&&(this.config=Object.assign(Object.assign({},this.config),{validateOnChange:this.validateOnChange,validateOnBlur:this.validateOnBlur,preventInvalidSubmission:this.preventInvalidSubmission,resetOnSuccess:this.resetOnSuccess}))}firstUpdated(){this.registerExistingFields(),this.setupFormEvents()}setupFormObserver(){const t=new MutationObserver(t=>{t.forEach(t=>{t.addedNodes.forEach(t=>{t.nodeType===Node.ELEMENT_NODE&&this.registerFieldsInElement(t)})})});t.observe(this,{childList:!0,subtree:!0}),this._formObserver=t}cleanupFormObserver(){const t=this._formObserver;t&&t.disconnect()}registerExistingFields(){this.registerFieldsInElement(this)}registerFieldsInElement(t){["nr-input","nr-select","nr-radio","nr-checkbox","nr-textarea","nr-timepicker","nr-datepicker"].forEach(i=>{t.querySelectorAll(i).forEach(t=>{t.getAttribute("name")&&this.validationController.registerField(t)})})}setupFormEvents(){this.addEventListener("submit",this.handleFormSubmit),this.addEventListener("reset",this.handleFormReset),this.addEventListener(h.VALIDATION_CHANGED,this.handleValidationChanged)}handleFormSubmit(t){return E(this,void 0,void 0,function*(){if(t.preventDefault(),!this.disabled)try{const t=yield this.submissionController.submitForm();this.resetOnSuccess&&this.reset(),this.action&&this.performNativeSubmission(t.formData)}catch(t){console.error("Form submission failed:",t)}})}handleFormReset(t){t.preventDefault(),this.reset()}performNativeSubmission(t){const i=document.createElement("form");i.action=this.action,i.method=this.method,i.enctype=this.enctype,this.target&&(i.target=this.target);for(const[e,s]of t.entries()){const t=document.createElement("input");t.type="hidden",t.name=e,t.value=s,i.appendChild(t)}document.body.appendChild(i),i.submit(),document.body.removeChild(i)}validate(){return E(this,void 0,void 0,function*(){return(yield this.validationController.validateForm()).isValid})}submit(t){return E(this,void 0,void 0,function*(){yield this.submissionController.submitForm(t)})}reset(){this.validationController.reset(),this.submissionController.resetSubmission(),this._validationState=a.Pristine,this._submissionState=d.Idle}get isValid(){return this.validationController.isValid()}get isSubmitting(){return this.submissionController.isSubmitting()}getFormData(){return this.submissionController.collectFormData()}getInvalidFields(){return this.validationController.getInvalidFields()}getFieldsValue(t){const i=this.getFormData().jsonData;if(t&&t.length>0){const e={};return t.forEach(t=>{t in i&&(e[t]=i[t])}),e}return i}getFieldValue(t){return this.getFieldsValue()[t]}setFieldsValue(t){Object.entries(t).forEach(([t,i])=>{this.setFieldValue(t,i)})}setFieldValue(t,i){const e=this.validationController.getFields().find(i=>i.name===t);e&&e.element&&(e.element.value=i,e.value=i,e.element.dispatchEvent(new Event("change",{bubbles:!0})))}validateFields(t){return E(this,void 0,void 0,function*(){const i=yield this.validationController.validateForm();if(t&&t.length>0){const e={};if(t.forEach(t=>{i.validationErrors[t]&&(e[t]=i.validationErrors[t])}),Object.keys(e).length>0)throw new Error(JSON.stringify(e));return this.getFieldsValue(t)}if(!i.isValid)throw new Error(JSON.stringify(i.validationErrors));return this.getFieldsValue()})}resetFields(t){if(!t||0===t.length)return void this.reset();const i=this.validationController.getFields();t.forEach(t=>{const e=i.find(i=>i.name===t);e&&e.element&&(e.element.value="",e.value="",e.touched=!1,e.dirty=!1,e.isValid=!0,e.validationMessage="",e.element.dispatchEvent(new Event("change",{bubbles:!0})))})}getFieldError(t){const i=this.validationController.getFields().find(i=>i.name===t);return i&&!i.isValid?i.validationMessage:null}getFieldsError(t){const i=this.validationController.getFields(),e={};return(t?i.filter(i=>t.includes(i.name)):i).forEach(t=>{e[t.name]=t.isValid?null:t.validationMessage}),e}isFieldTouched(t){const i=this.validationController.getFields().find(i=>i.name===t);return!!i&&i.touched}isFieldsTouched(t){const i=this.validationController.getFields();return(t?i.filter(i=>t.includes(i.name)):i).some(t=>t.touched)}isFieldDirty(t){const i=this.validationController.getFields().find(i=>i.name===t);return!!i&&i.dirty}isFieldsDirty(t){const i=this.validationController.getFields();return(t?i.filter(i=>t.includes(i.name)):i).some(t=>t.dirty)}getFieldInstance(t){const i=this.validationController.getFields().find(i=>i.name===t);return i?i.element:null}scrollToField(t){if(t){const i=this.getFieldInstance(t);return!!i&&(i.scrollIntoView({behavior:"smooth",block:"center"}),"function"==typeof i.focus&&i.focus(),!0)}return this.validationController.focusFirstInvalidField()}finish(){return E(this,void 0,void 0,function*(){try{const t=yield this.validateFields();return yield this.submit(),t}catch(t){throw this.scrollToField(),t}})}getFieldsWithErrors(){return this.validationController.getFields().filter(t=>!t.isValid).map(t=>t.name)}hasErrors(){return this.getFieldsWithErrors().length>0}getFormState(){const t=this.validationController.getFields();return{isValid:this.isValid,isSubmitting:this.isSubmitting,hasErrors:this.hasErrors(),errorCount:this.getFieldsWithErrors().length,fieldCount:t.length,touchedFields:t.filter(t=>t.touched).map(t=>t.name),dirtyFields:t.filter(t=>t.dirty).map(t=>t.name),invalidFields:this.getFieldsWithErrors()}}setLoading(t){this.disabled=t,this.requestUpdate()}render(){return i`
98
+ <form
99
+ part="form"
88
100
  action="${this.action||""}"
89
101
  method="${this.method.toLowerCase()}"
90
102
  enctype="${this.enctype}"
@@ -95,4 +107,4 @@ import{css as t,LitElement as i,html as s}from"lit";import{property as e,state a
95
107
  >
96
108
  <slot></slot>
97
109
  </form>
98
- `}};b.styles=a,f([e({type:Object})],b.prototype,"config",void 0),f([e({type:Boolean,attribute:"validate-on-change"})],b.prototype,"validateOnChange",void 0),f([e({type:Boolean,attribute:"validate-on-blur"})],b.prototype,"validateOnBlur",void 0),f([e({type:Boolean,attribute:"prevent-invalid-submission"})],b.prototype,"preventInvalidSubmission",void 0),f([e({type:Boolean,attribute:"reset-on-success"})],b.prototype,"resetOnSuccess",void 0),f([e({type:String})],b.prototype,"action",void 0),f([e({type:String})],b.prototype,"method",void 0),f([e({type:String,attribute:"enctype"})],b.prototype,"enctype",void 0),f([e({type:String})],b.prototype,"target",void 0),f([e({type:Boolean,reflect:!0})],b.prototype,"disabled",void 0),f([n()],b.prototype,"_validationState",void 0),f([n()],b.prototype,"_submissionState",void 0),b=f([r("nr-form")],b);export{h as FORM_EVENTS,m as FormSubmissionController,l as FormSubmissionState,c as FormValidationController,d as FormValidationState,b as NrFormElement};
110
+ `}};O.useShadowDom=!0,O.styles=o,S([s({type:Object})],O.prototype,"config",void 0),S([s({type:Boolean,attribute:"validate-on-change"})],O.prototype,"validateOnChange",void 0),S([s({type:Boolean,attribute:"validate-on-blur"})],O.prototype,"validateOnBlur",void 0),S([s({type:Boolean,attribute:"prevent-invalid-submission"})],O.prototype,"preventInvalidSubmission",void 0),S([s({type:Boolean,attribute:"reset-on-success"})],O.prototype,"resetOnSuccess",void 0),S([s({type:String})],O.prototype,"action",void 0),S([s({type:String})],O.prototype,"method",void 0),S([s({type:String,attribute:"enctype"})],O.prototype,"enctype",void 0),S([s({type:String})],O.prototype,"target",void 0),S([s({type:Boolean,reflect:!0})],O.prototype,"disabled",void 0),S([n()],O.prototype,"_validationState",void 0),S([n()],O.prototype,"_submissionState",void 0),O=S([r("nr-form")],O);export{h as FORM_EVENTS,F as FormSubmissionController,d as FormSubmissionState,y as FormValidationController,a as FormValidationState,O as NrFormElement};
@@ -5,7 +5,7 @@
5
5
  */
6
6
  import { LitElement, type PropertyValues } from 'lit';
7
7
  import { FormConfig, FormValidationState, FormSubmissionState } from './form.types.js';
8
- declare const NrFormElement_base: (new (...args: any[]) => import("@nuralyui/common/mixins").DependencyAware) & (new (...args: any[]) => import("@nuralyui/common/mixins").ThemeAware) & (new (...args: any[]) => import("@nuralyui/common/mixins").EventHandlerCapable) & typeof LitElement;
8
+ declare const NrFormElement_base: (new (...args: any[]) => import("@nuralyui/common/mixins").DependencyAware) & (new (...args: any[]) => import("@nuralyui/common/mixins").ThemeAware) & (new (...args: any[]) => import("@nuralyui/common/mixins").EventHandlerCapable) & (new (...args: any[]) => import("packages/common/src/shared/base-mixin.js").LightDomContent) & typeof LitElement;
9
9
  /**
10
10
  * Comprehensive form component with field management and validation API
11
11
  *
@@ -56,8 +56,11 @@ declare const NrFormElement_base: (new (...args: any[]) => import("@nuralyui/com
56
56
  * @fires nr-form-reset - Form was reset
57
57
  *
58
58
  * @slot default - Form content (inputs, buttons, etc.)
59
+ *
60
+ * @csspart form - The inner native form element
59
61
  */
60
62
  export declare class NrFormElement extends NrFormElement_base {
63
+ static useShadowDom: boolean;
61
64
  static styles: import("lit").CSSResult;
62
65
  /** Form configuration */
63
66
  config: FormConfig;
@@ -75,6 +75,8 @@ import { FormSubmissionController } from './controllers/submission.controller.js
75
75
  * @fires nr-form-reset - Form was reset
76
76
  *
77
77
  * @slot default - Form content (inputs, buttons, etc.)
78
+ *
79
+ * @csspart form - The inner native form element
78
80
  */
79
81
  let NrFormElement = class NrFormElement extends NuralyUIBaseMixin(LitElement) {
80
82
  constructor() {
@@ -586,7 +588,8 @@ let NrFormElement = class NrFormElement extends NuralyUIBaseMixin(LitElement) {
586
588
  }
587
589
  render() {
588
590
  return html `
589
- <form
591
+ <form
592
+ part="form"
590
593
  action="${this.action || ''}"
591
594
  method="${this.method.toLowerCase()}"
592
595
  enctype="${this.enctype}"
@@ -600,6 +603,7 @@ let NrFormElement = class NrFormElement extends NuralyUIBaseMixin(LitElement) {
600
603
  `;
601
604
  }
602
605
  };
606
+ NrFormElement.useShadowDom = true;
603
607
  NrFormElement.styles = styles;
604
608
  __decorate([
605
609
  property({ type: Object })
@@ -19,7 +19,7 @@ export const styles = css `
19
19
  width: 100%;
20
20
  display: flex;
21
21
  flex-direction: column;
22
- gap: var(--nuraly-form-gap, 16px);
22
+ gap: 16px;
23
23
  }
24
24
 
25
25
  .form-wrapper[disabled] {
@@ -61,7 +61,7 @@ export const styles = css `
61
61
  /* Responsive design */
62
62
  @media (max-width: 768px) {
63
63
  .form-wrapper {
64
- gap: var(--nuraly-form-gap-mobile, 12px);
64
+ gap: 12px;
65
65
  }
66
66
  }
67
67
  `;
@@ -1,4 +1,4 @@
1
- import{css as t,LitElement as a,html as s}from"lit";import{property as e,state as o,customElement as r}from"lit/decorators.js";import{NuralyUIBaseMixin as i}from"@nuralyui/common/mixins";const d=t`
1
+ import{css as t,html as e,LitElement as s}from"lit";import{property as a,state as o,customElement as i}from"lit/decorators.js";const r=t`
2
2
  :host {
3
3
  display: block;
4
4
  width: 100%;
@@ -8,9 +8,9 @@ import{css as t,LitElement as a,html as s}from"lit";import{property as e,state a
8
8
  display: flex;
9
9
  flex-flow: row wrap;
10
10
  min-width: 0;
11
-
11
+
12
12
  /* Theme-aware */
13
- color: var(--nuraly-color-text);
13
+ color: #161616;
14
14
  }
15
15
 
16
16
  /* Wrap control */
@@ -59,25 +59,36 @@ import{css as t,LitElement as a,html as s}from"lit";import{property as e,state a
59
59
  .nr-row[data-align="stretch"] {
60
60
  align-items: stretch;
61
61
  }
62
- `,h="",n={xs:0,sm:576,md:768,lg:992,xl:1200,xxl:1600};
62
+ `
63
+ /**
64
+ * @license
65
+ * Copyright 2023 Nuraly, Laabidi Aymen
66
+ * SPDX-License-Identifier: MIT
67
+ */,n=t=>class extends t{constructor(){super(...arguments),this.handleSystemThemeChange=()=>{this.closest("[data-theme]")||document.documentElement.hasAttribute("data-theme")||this.requestUpdate()}}connectedCallback(){super.connectedCallback(),this.setupThemeObserver(),this.setupDesignSystemObserver(),this.setupSystemThemeListener()}disconnectedCallback(){var t,e,s;super.disconnectedCallback(),null===(t=this.themeObserver)||void 0===t||t.disconnect(),null===(e=this.designSystemObserver)||void 0===e||e.disconnect(),null===(s=this.mediaQuery)||void 0===s||s.removeEventListener("change",this.handleSystemThemeChange)}get currentTheme(){var t,e;const s=(null===(t=this.closest("[data-theme]"))||void 0===t?void 0:t.getAttribute("data-theme"))||document.documentElement.getAttribute("data-theme");return s||((null===(e=window.matchMedia)||void 0===e?void 0:e.call(window,"(prefers-color-scheme: dark)").matches)?"dark":"light")}get currentDesignSystem(){var t;const e=(null===(t=this.closest("[design-system]"))||void 0===t?void 0:t.getAttribute("design-system"))||document.documentElement.getAttribute("design-system");return"carbon"===e?e:"default"}setupThemeObserver(){this.themeObserver=new MutationObserver(()=>{this.requestUpdate()}),this.themeObserver.observe(document.documentElement,{attributes:!0,attributeFilter:["data-theme"]})}setupDesignSystemObserver(){this.designSystemObserver=new MutationObserver(()=>{this.requestUpdate()}),this.designSystemObserver.observe(document.documentElement,{attributes:!0,attributeFilter:["design-system"]})}setupSystemThemeListener(){window.matchMedia&&(this.mediaQuery=window.matchMedia("(prefers-color-scheme: dark)"),this.mediaQuery.addEventListener("change",this.handleSystemThemeChange))}},d=()=>{var t;return void 0!==globalThis.litElementVersions||"undefined"!=typeof process&&"development"===(null===(t=process.env)||void 0===t?void 0:t.NODE_ENV)||"undefined"!=typeof window&&("localhost"===window.location.hostname||"127.0.0.1"===window.location.hostname)},h=t=>class extends t{constructor(){super(...arguments),this.requiredComponents=[]}validateDependencies(){if(d())for(const t of this.requiredComponents)if(!this.isComponentAvailable(t))throw new Error(`Required component "${t}" is not registered. Please import and register the component before using ${this.tagName.toLowerCase()}. Example: import '@nuralyui/${t}';`)}validateDependenciesWithHandler(t){if(!d())return!0;let e=!0;for(const s of this.requiredComponents)if(!this.isComponentAvailable(s)){e=!1;const a=new Error(`Required component "${s}" is not registered. Please import and register the component before using ${this.tagName.toLowerCase()}.`);t?t(s,a):console.error(a.message)}return e}isComponentAvailable(t){return!!customElements.get(t)}getMissingDependencies(){return this.requiredComponents.filter(t=>!this.isComponentAvailable(t))}areDependenciesAvailable(){return this.requiredComponents.every(t=>this.isComponentAvailable(t))}addRequiredComponent(t){this.requiredComponents.includes(t)||this.requiredComponents.push(t)}removeRequiredComponent(t){const e=this.requiredComponents.indexOf(t);e>-1&&this.requiredComponents.splice(e,1)}},l=t=>class extends t{dispatchCustomEvent(t,e){this.dispatchEvent(new CustomEvent(t,{detail:e,bubbles:!0,composed:!0}))}dispatchEventWithMetadata(t,e){var s;const a=Object.assign(Object.assign({},e),{timestamp:Date.now(),componentName:(null===(s=this.tagName)||void 0===s?void 0:s.toLowerCase())||"unknown"});this.dispatchCustomEvent(t,a)}dispatchInputEvent(t,e){const s=Object.assign({target:e.target||this,value:e.value,originalEvent:e.originalEvent},e);this.dispatchCustomEvent(t,s)}dispatchFocusEvent(t,e){const s=Object.assign({target:e.target||this,value:e.value,focused:e.focused,cursorPosition:e.cursorPosition,selectedText:e.selectedText},e);this.dispatchCustomEvent(t,s)}dispatchValidationEvent(t,e){var s;const a=Object.assign({target:e.target||this,value:e.value,isValid:null!==(s=e.isValid)&&void 0!==s&&s,error:e.error},e);this.dispatchCustomEvent(t,a)}dispatchActionEvent(t,e){const s=Object.assign({target:e.target||this,action:e.action,previousValue:e.previousValue,newValue:e.newValue},e);this.dispatchCustomEvent(t,s)}isReadonlyKeyAllowed(t){if(t.ctrlKey||t.metaKey){return["KeyA","KeyC"].includes(t.code)}return["Tab","Escape","ArrowLeft","ArrowRight","ArrowUp","ArrowDown","Home","End","PageUp","PageDown"].includes(t.key)}isActivationKey(t){return"Enter"===t.key||" "===t.key}},u=new Set,f=new Map;
63
68
  /**
64
69
  * @license
65
70
  * Copyright 2023 Nuraly, Laabidi Aymen
66
71
  * SPDX-License-Identifier: MIT
67
72
  */
68
- var l=function(t,a,s,e){for(var o,r=arguments.length,i=r<3?a:null===e?e=Object.getOwnPropertyDescriptor(a,s):e,d=t.length-1;d>=0;d--)(o=t[d])&&(i=(r<3?o(i):r>3?o(a,s,i):o(a,s))||i);return r>3&&i&&Object.defineProperty(a,s,i),i};let f=class extends(i(a)){constructor(){super(...arguments),this.align="",this.justify="",this.gutter=0,this.wrap=!0,this.currentBreakpoint="xs"}connectedCallback(){super.connectedCallback(),this.setupResponsiveGutter()}disconnectedCallback(){var t;super.disconnectedCallback(),null===(t=this.resizeObserver)||void 0===t||t.disconnect()}setupResponsiveGutter(){"object"!=typeof this.gutter||Array.isArray(this.gutter)||(this.updateBreakpoint(),this.resizeObserver=new ResizeObserver(()=>{this.updateBreakpoint()}),this.resizeObserver.observe(document.documentElement))}updateBreakpoint(){const t=window.innerWidth;this.currentBreakpoint=t>=n.xxl?"xxl":t>=n.xl?"xl":t>=n.lg?"lg":t>=n.md?"md":t>=n.sm?"sm":"xs"}getGutterValues(){if("number"==typeof this.gutter)return[this.gutter,this.gutter];if(Array.isArray(this.gutter))return this.gutter;const t=[this.currentBreakpoint,"xl","lg","md","sm","xs"];for(const a of t){const t=this.gutter[a];if(void 0!==t)return"number"==typeof t?[t,t]:t}return[0,0]}getRowStyle(){const[t,a]=this.getGutterValues(),s={};return t>0&&(s["margin-left"]=`-${t/2}px`,s["margin-right"]=`-${t/2}px`),a>0&&(s["row-gap"]=`${a}px`),s}getGutterContext(){const[t]=this.getGutterValues();return t}render(){const t=this.getRowStyle(),a=this.getGutterContext();return s`
73
+ const p=t=>{class e extends t{constructor(){super(...arguments),this.t=null}createRenderRoot(){return this.constructor.useShadowDom?super.createRenderRoot():this}connectedCallback(){const t=this.constructor.useShadowDom;if(!t&&null===this.t)for(this.t=[];this.firstChild;)this.t.push(this.removeChild(this.firstChild));if(super.connectedCallback(),!t){const t=this.constructor,e=this.tagName.toLowerCase(),s=t.styles;if(s){const t=m(s);t&&function(t,e,s){var a;if(!f.has(t)){const s=new CSSStyleSheet;s.replaceSync(e),f.set(t,s)}const o=f.get(t),i=`doc:${t}`;if(u.has(i)||(document.adoptedStyleSheets=[...document.adoptedStyleSheets,o],u.add(i)),s){let e=s;for(;e;){const s=e.getRootNode();if(!(s instanceof ShadowRoot))break;{const i=`shadow:${((null===(a=s.host)||void 0===a?void 0:a.tagName)||"").toLowerCase()}:${t}`;u.has(i)||(s.adoptedStyleSheets=[...s.adoptedStyleSheets,o],u.add(i)),e=s.host}}}}(e,t,this)}}}get lightChildren(){return this.t?this.t.filter(t=>!(t instanceof Element&&t.hasAttribute("slot"))):[]}lightChildrenNamed(t){return this.t?this.t.filter(e=>e instanceof Element&&e.getAttribute("slot")===t):[]}}return e.useShadowDom=!1,e},c=t=>h(n(l(p(t))));function m(t){return Array.isArray(t)?t.map(t=>m(t)).filter(Boolean).join("\n"):t&&"string"==typeof t.cssText?t.cssText:"string"==typeof t?t:""}const g="",x={xs:0,sm:576,md:768,lg:992,xl:1200,xxl:1600};
74
+ /**
75
+ * @license
76
+ * Copyright 2023 Nuraly, Laabidi Aymen
77
+ * SPDX-License-Identifier: MIT
78
+ */
79
+ var v=function(t,e,s,a){for(var o,i=arguments.length,r=i<3?e:null===a?a=Object.getOwnPropertyDescriptor(e,s):a,n=t.length-1;n>=0;n--)(o=t[n])&&(r=(i<3?o(r):i>3?o(e,s,r):o(e,s))||r);return i>3&&r&&Object.defineProperty(e,s,r),r};let w=class extends(c(s)){constructor(){super(...arguments),this.align="",this.justify="",this.gutter=0,this.wrap=!0,this.currentBreakpoint="xs"}connectedCallback(){super.connectedCallback(),this.setupResponsiveGutter()}disconnectedCallback(){var t;super.disconnectedCallback(),null===(t=this.resizeObserver)||void 0===t||t.disconnect()}setupResponsiveGutter(){"object"!=typeof this.gutter||Array.isArray(this.gutter)||(this.updateBreakpoint(),this.resizeObserver=new ResizeObserver(()=>{this.updateBreakpoint()}),this.resizeObserver.observe(document.documentElement))}updateBreakpoint(){const t=window.innerWidth;this.currentBreakpoint=t>=x.xxl?"xxl":t>=x.xl?"xl":t>=x.lg?"lg":t>=x.md?"md":t>=x.sm?"sm":"xs"}getGutterValues(){if("number"==typeof this.gutter)return[this.gutter,this.gutter];if(Array.isArray(this.gutter))return this.gutter;const t=[this.currentBreakpoint,"xl","lg","md","sm","xs"];for(const e of t){const t=this.gutter[e];if(void 0!==t)return"number"==typeof t?[t,t]:t}return[0,0]}getRowStyle(){const[t,e]=this.getGutterValues(),s={};return t>0&&(s["margin-left"]=`-${t/2}px`,s["margin-right"]=`-${t/2}px`),e>0&&(s["row-gap"]=`${e}px`),s}getGutterContext(){const[t]=this.getGutterValues();return t}render(){const t=this.getRowStyle(),s=this.getGutterContext();return e`
69
80
  <div
81
+ part="row"
70
82
  class="nr-row"
71
83
  data-align="${this.align}"
72
84
  data-justify="${this.justify}"
73
85
  data-wrap="${this.wrap}"
74
- data-theme="${this.currentTheme}"
75
- style="${Object.entries(t).map(([t,a])=>`${t}: ${a}`).join("; ")}"
76
- data-gutter="${a}"
86
+ style="${Object.entries(t).map(([t,e])=>`${t}: ${e}`).join("; ")}"
87
+ data-gutter="${s}"
77
88
  >
78
89
  <slot></slot>
79
90
  </div>
80
- `}};f.styles=d,l([e({type:String})],f.prototype,"align",void 0),l([e({type:String})],f.prototype,"justify",void 0),l([e({type:Object})],f.prototype,"gutter",void 0),l([e({type:Boolean})],f.prototype,"wrap",void 0),l([o()],f.prototype,"currentBreakpoint",void 0),f=l([r("nr-row")],f);const p=t`
91
+ `}};w.styles=r,w.useShadowDom=!0,v([a({type:String})],w.prototype,"align",void 0),v([a({type:String})],w.prototype,"justify",void 0),v([a({type:Object})],w.prototype,"gutter",void 0),v([a({type:Boolean})],w.prototype,"wrap",void 0),v([o()],w.prototype,"currentBreakpoint",void 0),w=v([i("nr-row")],w);const y=t`
81
92
  :host {
82
93
  display: block;
83
94
  box-sizing: border-box;
@@ -89,9 +100,9 @@ var l=function(t,a,s,e){for(var o,r=arguments.length,i=r<3?a:null===e?e=Object.g
89
100
  box-sizing: border-box;
90
101
  width: 100%;
91
102
  height: 100%;
92
-
103
+
93
104
  /* Theme-aware */
94
- color: var(--nuraly-color-text);
105
+ color: #161616;
95
106
  }
96
107
 
97
108
  /* Column spans (1-24) - Apply flex to :host */
@@ -192,11 +203,12 @@ var l=function(t,a,s,e){for(var o,r=arguments.length,i=r<3?a:null===e?e=Object.g
192
203
  * @license
193
204
  * Copyright 2023 Nuraly, Laabidi Aymen
194
205
  * SPDX-License-Identifier: MIT
195
- */;var u=function(t,a,s,e){for(var o,r=arguments.length,i=r<3?a:null===e?e=Object.getOwnPropertyDescriptor(a,s):e,d=t.length-1;d>=0;d--)(o=t[d])&&(i=(r<3?o(i):r>3?o(a,s,i):o(a,s))||i);return r>3&&i&&Object.defineProperty(a,s,i),i};let m=class extends(i(a)){constructor(){super(...arguments),this.offset=0,this.pull=0,this.push=0,this.flex="",this.currentBreakpoint="xs"}connectedCallback(){super.connectedCallback(),this.setupResponsive()}disconnectedCallback(){var t;super.disconnectedCallback(),null===(t=this.resizeObserver)||void 0===t||t.disconnect()}setupResponsive(){this.updateBreakpoint(),this.resizeObserver=new ResizeObserver(()=>{this.updateBreakpoint()}),this.resizeObserver.observe(document.documentElement)}updateBreakpoint(){const t=window.innerWidth;let a;a=t>=n.xxl?"xxl":t>=n.xl?"xl":t>=n.lg?"lg":t>=n.md?"md":t>=n.sm?"sm":"xs",a!==this.currentBreakpoint&&(this.currentBreakpoint=a)}getResponsiveConfig(){const t=[this.currentBreakpoint,"xl","lg","md","sm","xs"];for(const a of t){const t=this[a];if(void 0!==t)return"number"==typeof t?{span:t}:t}return{}}getColProperties(){var t,a,s,e,o;const r=this.getResponsiveConfig();return{span:null!==(t=r.span)&&void 0!==t?t:this.span,offset:null!==(a=r.offset)&&void 0!==a?a:this.offset,order:null!==(s=r.order)&&void 0!==s?s:this.order,pull:null!==(e=r.pull)&&void 0!==e?e:this.pull,push:null!==(o=r.push)&&void 0!==o?o:this.push}}getGutterFromParent(){const t=this.closest("nr-row");if(t){const a=t.getAttribute("data-gutter");return a?Number.parseInt(a,10):0}return 0}getColStyle(){const t={},a=this.getGutterFromParent();return a>0&&(t["padding-left"]=a/2+"px",t["padding-right"]=a/2+"px"),this.flex&&("auto"===this.flex?t.flex="1 1 auto":"none"===this.flex?t.flex="0 0 auto":"number"==typeof this.flex?t.flex=`${this.flex} ${this.flex} auto`:t.flex=this.flex),t}render(){var t;const a=this.getColStyle(),e=this.getColProperties();return this.setAttribute("data-span",(null===(t=e.span)||void 0===t?void 0:t.toString())||""),this.setAttribute("data-offset",e.offset.toString()),void 0!==e.order?this.setAttribute("data-order",e.order.toString()):this.removeAttribute("data-order"),this.setAttribute("data-pull",e.pull.toString()),this.setAttribute("data-push",e.push.toString()),this.setAttribute("data-theme",this.currentTheme),s`
206
+ */;var b=function(t,e,s,a){for(var o,i=arguments.length,r=i<3?e:null===a?a=Object.getOwnPropertyDescriptor(e,s):a,n=t.length-1;n>=0;n--)(o=t[n])&&(r=(i<3?o(r):i>3?o(e,s,r):o(e,s))||r);return i>3&&r&&Object.defineProperty(e,s,r),r};let j=class extends(c(s)){constructor(){super(...arguments),this.offset=0,this.pull=0,this.push=0,this.flex="",this.currentBreakpoint="xs"}connectedCallback(){super.connectedCallback(),this.setupResponsive()}disconnectedCallback(){var t;super.disconnectedCallback(),null===(t=this.resizeObserver)||void 0===t||t.disconnect()}setupResponsive(){this.updateBreakpoint(),this.resizeObserver=new ResizeObserver(()=>{this.updateBreakpoint()}),this.resizeObserver.observe(document.documentElement)}updateBreakpoint(){const t=window.innerWidth;let e;e=t>=x.xxl?"xxl":t>=x.xl?"xl":t>=x.lg?"lg":t>=x.md?"md":t>=x.sm?"sm":"xs",e!==this.currentBreakpoint&&(this.currentBreakpoint=e)}getResponsiveConfig(){const t=[this.currentBreakpoint,"xl","lg","md","sm","xs"];for(const e of t){const t=this[e];if(void 0!==t)return"number"==typeof t?{span:t}:t}return{}}getColProperties(){var t,e,s,a,o;const i=this.getResponsiveConfig();return{span:null!==(t=i.span)&&void 0!==t?t:this.span,offset:null!==(e=i.offset)&&void 0!==e?e:this.offset,order:null!==(s=i.order)&&void 0!==s?s:this.order,pull:null!==(a=i.pull)&&void 0!==a?a:this.pull,push:null!==(o=i.push)&&void 0!==o?o:this.push}}getGutterFromParent(){const t=this.closest("nr-row");if(t){const e=t.getAttribute("data-gutter");return e?Number.parseInt(e,10):0}return 0}getColStyle(){const t={},e=this.getGutterFromParent();return e>0&&(t["padding-left"]=e/2+"px",t["padding-right"]=e/2+"px"),this.flex&&("auto"===this.flex?t.flex="1 1 auto":"none"===this.flex?t.flex="0 0 auto":"number"==typeof this.flex?t.flex=`${this.flex} ${this.flex} auto`:t.flex=this.flex),t}render(){var t;const s=this.getColStyle(),a=this.getColProperties();return this.setAttribute("data-span",(null===(t=a.span)||void 0===t?void 0:t.toString())||""),this.setAttribute("data-offset",a.offset.toString()),void 0!==a.order?this.setAttribute("data-order",a.order.toString()):this.removeAttribute("data-order"),this.setAttribute("data-pull",a.pull.toString()),this.setAttribute("data-push",a.push.toString()),e`
196
207
  <div
208
+ part="col"
197
209
  class="nr-col"
198
- style="${Object.entries(a).map(([t,a])=>`${t}: ${a}`).join("; ")}"
210
+ style="${Object.entries(s).map(([t,e])=>`${t}: ${e}`).join("; ")}"
199
211
  >
200
212
  <slot></slot>
201
213
  </div>
202
- `}};m.styles=p,u([e({type:Number})],m.prototype,"span",void 0),u([e({type:Number})],m.prototype,"offset",void 0),u([e({type:Number})],m.prototype,"order",void 0),u([e({type:Number})],m.prototype,"pull",void 0),u([e({type:Number})],m.prototype,"push",void 0),u([e({type:String})],m.prototype,"flex",void 0),u([e({type:Object})],m.prototype,"xs",void 0),u([e({type:Object})],m.prototype,"sm",void 0),u([e({type:Object})],m.prototype,"md",void 0),u([e({type:Object})],m.prototype,"lg",void 0),u([e({type:Object})],m.prototype,"xl",void 0),u([e({type:Object})],m.prototype,"xxl",void 0),u([o()],m.prototype,"currentBreakpoint",void 0),m=u([r("nr-col")],m);export{n as BREAKPOINTS,h as EMPTY_STRING,m as NrColElement,f as NrRowElement};
214
+ `}};j.styles=y,j.useShadowDom=!0,b([a({type:Number})],j.prototype,"span",void 0),b([a({type:Number})],j.prototype,"offset",void 0),b([a({type:Number})],j.prototype,"order",void 0),b([a({type:Number})],j.prototype,"pull",void 0),b([a({type:Number})],j.prototype,"push",void 0),b([a({type:String})],j.prototype,"flex",void 0),b([a({type:Object})],j.prototype,"xs",void 0),b([a({type:Object})],j.prototype,"sm",void 0),b([a({type:Object})],j.prototype,"md",void 0),b([a({type:Object})],j.prototype,"lg",void 0),b([a({type:Object})],j.prototype,"xl",void 0),b([a({type:Object})],j.prototype,"xxl",void 0),b([o()],j.prototype,"currentBreakpoint",void 0),j=b([i("nr-col")],j);export{x as BREAKPOINTS,g as EMPTY_STRING,j as NrColElement,w as NrRowElement};
@@ -5,7 +5,7 @@
5
5
  */
6
6
  import { LitElement } from 'lit';
7
7
  import { ColSize, FlexType } from './grid.types.js';
8
- declare const NrColElement_base: (new (...args: any[]) => import("@nuralyui/common/mixins").DependencyAware) & (new (...args: any[]) => import("@nuralyui/common/mixins").ThemeAware) & (new (...args: any[]) => import("@nuralyui/common/mixins").EventHandlerCapable) & typeof LitElement;
8
+ declare const NrColElement_base: (new (...args: any[]) => import("@nuralyui/common/mixins").DependencyAware) & (new (...args: any[]) => import("@nuralyui/common/mixins").ThemeAware) & (new (...args: any[]) => import("@nuralyui/common/mixins").EventHandlerCapable) & (new (...args: any[]) => import("packages/common/src/shared/base-mixin.js").LightDomContent) & typeof LitElement;
9
9
  /**
10
10
  * Column component for grid layout system
11
11
  *
@@ -36,9 +36,12 @@ declare const NrColElement_base: (new (...args: any[]) => import("@nuralyui/comm
36
36
  * ```
37
37
  *
38
38
  * @slot default - Column content
39
+ *
40
+ * @csspart col - The inner div applying column width, offset, and gutter padding
39
41
  */
40
42
  export declare class NrColElement extends NrColElement_base {
41
43
  static styles: import("lit").CSSResult;
44
+ static useShadowDom: boolean;
42
45
  /** Number of columns to span (out of 24) */
43
46
  span?: number;
44
47
  /** Number of columns to offset */
@@ -44,6 +44,8 @@ import { BREAKPOINTS, EMPTY_STRING } from './grid.types.js';
44
44
  * ```
45
45
  *
46
46
  * @slot default - Column content
47
+ *
48
+ * @csspart col - The inner div applying column width, offset, and gutter padding
47
49
  */
48
50
  let NrColElement = class NrColElement extends NuralyUIBaseMixin(LitElement) {
49
51
  constructor() {
@@ -195,9 +197,9 @@ let NrColElement = class NrColElement extends NuralyUIBaseMixin(LitElement) {
195
197
  }
196
198
  this.setAttribute('data-pull', props.pull.toString());
197
199
  this.setAttribute('data-push', props.push.toString());
198
- this.setAttribute('data-theme', this.currentTheme);
199
200
  return html `
200
201
  <div
202
+ part="col"
201
203
  class="nr-col"
202
204
  style="${Object.entries(colStyle).map(([key, value]) => `${key}: ${value}`).join('; ')}"
203
205
  >
@@ -207,6 +209,7 @@ let NrColElement = class NrColElement extends NuralyUIBaseMixin(LitElement) {
207
209
  }
208
210
  };
209
211
  NrColElement.styles = styles;
212
+ NrColElement.useShadowDom = true;
210
213
  __decorate([
211
214
  property({ type: Number })
212
215
  ], NrColElement.prototype, "span", void 0);
@@ -15,9 +15,9 @@ export const styles = css `
15
15
  box-sizing: border-box;
16
16
  width: 100%;
17
17
  height: 100%;
18
-
18
+
19
19
  /* Theme-aware */
20
- color: var(--nuraly-color-text);
20
+ color: #161616;
21
21
  }
22
22
 
23
23
  /* Column spans (1-24) - Apply flex to :host */
@@ -5,7 +5,7 @@
5
5
  */
6
6
  import { LitElement } from 'lit';
7
7
  import { RowAlign, RowJustify, Gutter } from './grid.types.js';
8
- declare const NrRowElement_base: (new (...args: any[]) => import("@nuralyui/common/mixins").DependencyAware) & (new (...args: any[]) => import("@nuralyui/common/mixins").ThemeAware) & (new (...args: any[]) => import("@nuralyui/common/mixins").EventHandlerCapable) & typeof LitElement;
8
+ declare const NrRowElement_base: (new (...args: any[]) => import("@nuralyui/common/mixins").DependencyAware) & (new (...args: any[]) => import("@nuralyui/common/mixins").ThemeAware) & (new (...args: any[]) => import("@nuralyui/common/mixins").EventHandlerCapable) & (new (...args: any[]) => import("packages/common/src/shared/base-mixin.js").LightDomContent) & typeof LitElement;
9
9
  /**
10
10
  * Row component for grid layout system
11
11
  *
@@ -36,9 +36,12 @@ declare const NrRowElement_base: (new (...args: any[]) => import("@nuralyui/comm
36
36
  * ```
37
37
  *
38
38
  * @slot default - Column elements
39
+ *
40
+ * @csspart row - The inner div applying the grid row styles, gutter margins, and alignment
39
41
  */
40
42
  export declare class NrRowElement extends NrRowElement_base {
41
43
  static styles: import("lit").CSSResult;
44
+ static useShadowDom: boolean;
42
45
  /** Vertical alignment of columns */
43
46
  align: RowAlign | '';
44
47
  /** Horizontal alignment of columns */
@@ -44,6 +44,8 @@ import { EMPTY_STRING, BREAKPOINTS } from './grid.types.js';
44
44
  * ```
45
45
  *
46
46
  * @slot default - Column elements
47
+ *
48
+ * @csspart row - The inner div applying the grid row styles, gutter margins, and alignment
47
49
  */
48
50
  let NrRowElement = class NrRowElement extends NuralyUIBaseMixin(LitElement) {
49
51
  constructor() {
@@ -161,11 +163,11 @@ let NrRowElement = class NrRowElement extends NuralyUIBaseMixin(LitElement) {
161
163
  const gutter = this.getGutterContext();
162
164
  return html `
163
165
  <div
166
+ part="row"
164
167
  class="nr-row"
165
168
  data-align="${this.align}"
166
169
  data-justify="${this.justify}"
167
170
  data-wrap="${this.wrap}"
168
- data-theme="${this.currentTheme}"
169
171
  style="${Object.entries(rowStyle).map(([key, value]) => `${key}: ${value}`).join('; ')}"
170
172
  data-gutter="${gutter}"
171
173
  >
@@ -175,6 +177,7 @@ let NrRowElement = class NrRowElement extends NuralyUIBaseMixin(LitElement) {
175
177
  }
176
178
  };
177
179
  NrRowElement.styles = styles;
180
+ NrRowElement.useShadowDom = true;
178
181
  __decorate([
179
182
  property({ type: String })
180
183
  ], NrRowElement.prototype, "align", void 0);
@@ -13,9 +13,9 @@ export const styles = css `
13
13
  display: flex;
14
14
  flex-flow: row wrap;
15
15
  min-width: 0;
16
-
16
+
17
17
  /* Theme-aware */
18
- color: var(--nuraly-color-text);
18
+ color: #161616;
19
19
  }
20
20
 
21
21
  /* Wrap control */