@k3-universe/react-kit 0.0.8 → 0.0.10

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 (334) hide show
  1. package/dist/index.js +18655 -16777
  2. package/dist/kit/builder/data-table/components/DataTable.d.ts +2 -2
  3. package/dist/kit/builder/data-table/components/DataTable.d.ts.map +1 -1
  4. package/dist/kit/builder/form/components/FormBuilder.d.ts +42 -14
  5. package/dist/kit/builder/form/components/FormBuilder.d.ts.map +1 -1
  6. package/dist/kit/builder/form/components/FormBuilderField.d.ts.map +1 -1
  7. package/dist/kit/builder/form/components/fields/AutocompleteField.d.ts.map +1 -1
  8. package/dist/kit/builder/form/components/fields/DatePickerField.d.ts +3 -0
  9. package/dist/kit/builder/form/components/fields/DatePickerField.d.ts.map +1 -0
  10. package/dist/kit/builder/form/components/fields/DateRangePickerField.d.ts +3 -0
  11. package/dist/kit/builder/form/components/fields/DateRangePickerField.d.ts.map +1 -0
  12. package/dist/kit/builder/form/components/fields/MonthPickerField.d.ts +3 -0
  13. package/dist/kit/builder/form/components/fields/MonthPickerField.d.ts.map +1 -0
  14. package/dist/kit/builder/form/components/fields/MonthRangePickerField.d.ts +3 -0
  15. package/dist/kit/builder/form/components/fields/MonthRangePickerField.d.ts.map +1 -0
  16. package/dist/kit/builder/form/components/fields/index.d.ts +4 -0
  17. package/dist/kit/builder/form/components/fields/index.d.ts.map +1 -1
  18. package/dist/kit/builder/section/SectionBuilder.d.ts.map +1 -1
  19. package/dist/kit/builder/section/types.d.ts +12 -1
  20. package/dist/kit/builder/section/types.d.ts.map +1 -1
  21. package/dist/kit/builder/stack-dialog/context.d.ts +3 -0
  22. package/dist/kit/builder/stack-dialog/context.d.ts.map +1 -0
  23. package/dist/kit/builder/stack-dialog/hooks.d.ts +6 -0
  24. package/dist/kit/builder/stack-dialog/hooks.d.ts.map +1 -0
  25. package/dist/kit/builder/stack-dialog/index.d.ts +5 -0
  26. package/dist/kit/builder/stack-dialog/index.d.ts.map +1 -0
  27. package/dist/kit/builder/stack-dialog/provider.d.ts +3 -0
  28. package/dist/kit/builder/stack-dialog/provider.d.ts.map +1 -0
  29. package/dist/kit/builder/stack-dialog/renderer.d.ts +6 -0
  30. package/dist/kit/builder/stack-dialog/renderer.d.ts.map +1 -0
  31. package/dist/kit/builder/stack-dialog/types.d.ts +20 -0
  32. package/dist/kit/builder/stack-dialog/types.d.ts.map +1 -0
  33. package/dist/kit/components/autocomplete/Autocomplete.d.ts +35 -3
  34. package/dist/kit/components/autocomplete/Autocomplete.d.ts.map +1 -1
  35. package/dist/kit/components/autocomplete/index.d.ts +1 -0
  36. package/dist/kit/components/autocomplete/index.d.ts.map +1 -1
  37. package/dist/kit/components/datepicker/DatePicker.d.ts +27 -0
  38. package/dist/kit/components/datepicker/DatePicker.d.ts.map +1 -0
  39. package/dist/kit/components/datepicker/DateRangePicker.d.ts +41 -0
  40. package/dist/kit/components/datepicker/DateRangePicker.d.ts.map +1 -0
  41. package/dist/kit/components/monthpicker/MonthInput.d.ts +26 -0
  42. package/dist/kit/components/monthpicker/MonthInput.d.ts.map +1 -0
  43. package/dist/kit/components/monthpicker/MonthPicker.d.ts +32 -0
  44. package/dist/kit/components/monthpicker/MonthPicker.d.ts.map +1 -0
  45. package/dist/kit/components/monthpicker/MonthRangeInput.d.ts +31 -0
  46. package/dist/kit/components/monthpicker/MonthRangeInput.d.ts.map +1 -0
  47. package/dist/kit/components/monthpicker/MonthRangePicker.d.ts +48 -0
  48. package/dist/kit/components/monthpicker/MonthRangePicker.d.ts.map +1 -0
  49. package/dist/kit/themes/clean-slate.css +165 -1
  50. package/dist/kit/themes/default.css +165 -1
  51. package/dist/kit/themes/minimal-modern.css +165 -1
  52. package/dist/kit/themes/spotify.css +165 -1
  53. package/package.json +1 -1
  54. package/src/kit/builder/data-table/components/DataTable.tsx +9 -9
  55. package/src/kit/builder/form/components/FormBuilder.tsx +363 -145
  56. package/src/kit/builder/form/components/FormBuilderField.tsx +52 -3
  57. package/src/kit/builder/form/components/fields/AutocompleteField.tsx +29 -1
  58. package/src/kit/builder/form/components/fields/DatePickerField.tsx +24 -0
  59. package/src/kit/builder/form/components/fields/DateRangePickerField.tsx +41 -0
  60. package/src/kit/builder/form/components/fields/MonthPickerField.tsx +26 -0
  61. package/src/kit/builder/form/components/fields/MonthRangePickerField.tsx +35 -0
  62. package/src/kit/builder/form/components/fields/index.ts +4 -0
  63. package/src/kit/builder/section/SectionBuilder.tsx +24 -2
  64. package/src/kit/builder/section/types.ts +15 -1
  65. package/src/kit/builder/stack-dialog/context.ts +9 -0
  66. package/src/kit/builder/stack-dialog/hooks.ts +11 -0
  67. package/src/kit/builder/stack-dialog/index.ts +13 -0
  68. package/src/kit/builder/stack-dialog/provider.tsx +55 -0
  69. package/src/kit/builder/stack-dialog/renderer.tsx +33 -0
  70. package/src/kit/builder/stack-dialog/types.ts +22 -0
  71. package/src/kit/components/autocomplete/Autocomplete.tsx +783 -233
  72. package/src/kit/components/autocomplete/index.ts +1 -0
  73. package/src/kit/components/datepicker/DatePicker.tsx +149 -0
  74. package/src/kit/components/datepicker/DateRangePicker.tsx +454 -0
  75. package/src/kit/components/monthpicker/MonthInput.tsx +122 -0
  76. package/src/kit/components/monthpicker/MonthPicker.tsx +223 -0
  77. package/src/kit/components/monthpicker/MonthRangeInput.tsx +132 -0
  78. package/src/kit/components/monthpicker/MonthRangePicker.tsx +407 -0
  79. package/src/stories/kit/builder/Form.Autocomplete.stories.tsx +210 -0
  80. package/src/stories/kit/builder/Form.Complex.stories.tsx +101 -0
  81. package/src/stories/kit/builder/Form.Dynamic.stories.tsx +149 -0
  82. package/src/stories/kit/builder/Form.Pickers.stories.tsx +71 -0
  83. package/src/stories/kit/builder/Section.stories.tsx +58 -2
  84. package/src/stories/kit/components/Autocomplete.stories.tsx +27 -0
  85. package/src/stories/kit/components/DatePicker.stories.tsx +128 -0
  86. package/src/stories/kit/components/DateRangePicker.stories.tsx +154 -0
  87. package/src/stories/kit/components/MonthPicker.stories.tsx +80 -0
  88. package/src/stories/kit/components/MonthRangePicker.stories.tsx +98 -0
  89. package/storybook-static/assets/{Accordion.stories-q6yg6wg1.js → Accordion.stories-KU4JBR8U.js} +1 -1
  90. package/storybook-static/assets/{AdminLayout-B9bV4J_6.js → AdminLayout-CPvVCwfY.js} +10 -10
  91. package/storybook-static/assets/AdminLayout.Basic.stories-DkP2UVXe.js +4 -0
  92. package/storybook-static/assets/AdminLayout.Collapsible.stories-BuuVjtpW.js +4 -0
  93. package/storybook-static/assets/AdminLayout.Complex.stories-D-k4H0hJ.js +29 -0
  94. package/storybook-static/assets/AdminLayout.CustomSidebarHeaderComponent.stories-B_0IEDd4.js +9 -0
  95. package/storybook-static/assets/AdminLayout.CustomSidebarTitleAndIcon.stories-CvAeXUyA.js +4 -0
  96. package/storybook-static/assets/AdminLayout.HeaderSlots.stories-RBFHoSZK.js +7 -0
  97. package/storybook-static/assets/{Alert.stories-DXwNfJ3w.js → Alert.stories-DKxKtIc0.js} +1 -1
  98. package/storybook-static/assets/{AlertDialog.stories-I324NsnP.js → AlertDialog.stories-BqTpZ_nG.js} +1 -1
  99. package/storybook-static/assets/{AspectRatio.stories-CghHiX3Z.js → AspectRatio.stories-DPO9QQ5F.js} +1 -1
  100. package/storybook-static/assets/Autocomplete-Cpg4CaJe.js +56 -0
  101. package/storybook-static/assets/Autocomplete.stories-CWj4G5fh.js +56 -0
  102. package/storybook-static/assets/{Avatar.stories-CEF5FVSR.js → Avatar.stories-DPhov_2g.js} +1 -1
  103. package/storybook-static/assets/Badge.stories-DFKrRdXq.js +12 -0
  104. package/storybook-static/assets/{Breadcrumb.stories-DORe9T4b.js → Breadcrumb.stories-CTE6CZUC.js} +1 -1
  105. package/storybook-static/assets/{Button.stories-3nQ6wsBX.js → Button.stories-cbt2InL-.js} +1 -1
  106. package/storybook-static/assets/{Calendar.stories-Dn__djE1.js → Calendar.stories-DRhTw_43.js} +1 -1
  107. package/storybook-static/assets/{Card.stories-BJcbdwCI.js → Card.stories-Isf6n_K3.js} +1 -1
  108. package/storybook-static/assets/{Carousel.stories-CfqbE7Va.js → Carousel.stories-Cmg0I3fR.js} +1 -1
  109. package/storybook-static/assets/{Chart.stories-cGgef3tv.js → Chart.stories-aQ-fNijT.js} +1 -1
  110. package/storybook-static/assets/{Checkbox.stories-BcaxWzCS.js → Checkbox.stories-B7YMXPDc.js} +1 -1
  111. package/storybook-static/assets/{Collapsible.stories-CQ95s7Cs.js → Collapsible.stories-BUzl17ZZ.js} +1 -1
  112. package/storybook-static/assets/{Combination-CeVus13L.js → Combination-BdQWAuko.js} +1 -1
  113. package/storybook-static/assets/{Command.stories-DYflJh8u.js → Command.stories-DzBlWQs0.js} +1 -1
  114. package/storybook-static/assets/{ContextMenu.stories-CU7ehYrE.js → ContextMenu.stories-CJlBQyXc.js} +1 -1
  115. package/storybook-static/assets/DataTable.Basic.stories-BWYKFDmK.js +6 -0
  116. package/storybook-static/assets/DataTable.Filters.stories-uZdtJk8t.js +21 -0
  117. package/storybook-static/assets/DataTable.Pagination.stories-C5N1khkp.js +24 -0
  118. package/storybook-static/assets/DataTable.SelectionAndActions.stories-FhCqZKvO.js +26 -0
  119. package/storybook-static/assets/DataTable.Sorting.stories-D-k7EtRj.js +6 -0
  120. package/storybook-static/assets/{Dialog.stories-DobNZ0Hp.js → Dialog.stories-C62AF-Gx.js} +1 -1
  121. package/storybook-static/assets/{Dialog.stories-Bu6ZJXNH.js → Dialog.stories-lrjRwOus.js} +1 -1
  122. package/storybook-static/assets/{Drawer.stories-BN0idp4u.js → Drawer.stories-CGjkdJeV.js} +1 -1
  123. package/storybook-static/assets/{DropdownMenu.stories-sfsVDTvm.js → DropdownMenu.stories-DkGClRAA.js} +1 -1
  124. package/storybook-static/assets/Form.ArrayLayouts.stories-C5d_062d.js +130 -0
  125. package/storybook-static/assets/Form.Autocomplete.stories-CPZPkk4o.js +142 -0
  126. package/storybook-static/assets/Form.Basic.stories-Bhcu3-3n.js +58 -0
  127. package/storybook-static/assets/Form.Complex.stories-QnXh5a7Q.js +361 -0
  128. package/storybook-static/assets/Form.Dynamic.stories-DFW6wIuT.js +502 -0
  129. package/storybook-static/assets/Form.Simple.stories-BhJcyhbE.js +53 -0
  130. package/storybook-static/assets/{Form.stories-27doU7JS.js → Form.stories-PFNsMYxO.js} +1 -1
  131. package/storybook-static/assets/FormBuilder-BQBBxo_k.js +5 -0
  132. package/storybook-static/assets/{HoverCard.stories-0lted9Zx.js → HoverCard.stories-CAlQEVn8.js} +1 -1
  133. package/storybook-static/assets/{Input.stories-CwsIObFs.js → Input.stories-CEhODt0V.js} +1 -1
  134. package/storybook-static/assets/{InputOtp.stories-DVc086h4.js → InputOtp.stories-DSvNP4dS.js} +1 -1
  135. package/storybook-static/assets/{Label.stories-bJa0rk1A.js → Label.stories-B3pa8ZLY.js} +1 -1
  136. package/storybook-static/assets/{Login.stories-C6X6Kj5B.js → Login.stories-C7KQkmR_.js} +5 -5
  137. package/storybook-static/assets/{Menubar.stories-CuediVp7.js → Menubar.stories-CHXhSHxc.js} +1 -1
  138. package/storybook-static/assets/MonthPicker.stories-BnrOc4fm.js +99 -0
  139. package/storybook-static/assets/MonthRangePicker.stories-55Gk1t-7.js +134 -0
  140. package/storybook-static/assets/{NavigationMenu.stories-CKGZYhKk.js → NavigationMenu.stories-CXoS080P.js} +1 -1
  141. package/storybook-static/assets/{Page.stories-Cf76wtRx.js → Page.stories-GdSJgZ6-.js} +1 -1
  142. package/storybook-static/assets/{Pagination.stories-D7IdL1_4.js → Pagination.stories-BEBwqH4N.js} +1 -1
  143. package/storybook-static/assets/{Popover.stories-1VP_zNY8.js → Popover.stories-BICy98Cw.js} +1 -1
  144. package/storybook-static/assets/{Progress.stories-C35R5YvA.js → Progress.stories-DECHNOME.js} +1 -1
  145. package/storybook-static/assets/{RadioGroup.stories-CjuD3CwD.js → RadioGroup.stories-DA7-uKfV.js} +1 -1
  146. package/storybook-static/assets/{Resizable.stories-Cs8dvdc5.js → Resizable.stories-B99kWkH7.js} +1 -1
  147. package/storybook-static/assets/{ScrollArea.stories-D6_z-5jm.js → ScrollArea.stories-BqvUAXqU.js} +1 -1
  148. package/storybook-static/assets/Section.stories-lFMlFBQn.js +277 -0
  149. package/storybook-static/assets/SectionBuilder-BQW705x0.js +1 -0
  150. package/storybook-static/assets/{Select.stories-w_kbza5k.js → Select.stories-BsKyZ6Io.js} +1 -1
  151. package/storybook-static/assets/{Separator.stories-B5QnaJXb.js → Separator.stories-BTDOaOM2.js} +1 -1
  152. package/storybook-static/assets/{Sheet.stories-CORnEGvV.js → Sheet.stories-Cam1gR6G.js} +1 -1
  153. package/storybook-static/assets/{Sidebar.stories-DVuWTi4j.js → Sidebar.stories-DnOa6G7y.js} +1 -1
  154. package/storybook-static/assets/{Slider.stories-YoS2vvT2.js → Slider.stories-Bslq7hjq.js} +1 -1
  155. package/storybook-static/assets/Sonner.stories-D34pBBtI.js +18 -0
  156. package/storybook-static/assets/Switch.stories-Puyb1-Bx.js +3 -0
  157. package/storybook-static/assets/{Table.stories-BuGU4MUM.js → Table.stories-ClZxAhut.js} +1 -1
  158. package/storybook-static/assets/Tabs.stories-CURNTETB.js +10 -0
  159. package/storybook-static/assets/{Textarea.stories-CHXVobz6.js → Textarea.stories-Cf1ZBrWw.js} +1 -1
  160. package/storybook-static/assets/{Toggle.stories-C4uB4Hkq.js → Toggle.stories-CdMHY_bi.js} +1 -1
  161. package/storybook-static/assets/{ToggleGroup.stories-Cr229wf_.js → ToggleGroup.stories-BM68m1dX.js} +1 -1
  162. package/storybook-static/assets/{Tooltip.stories-DmMYGR3T.js → Tooltip.stories-DiQv64dM.js} +1 -1
  163. package/storybook-static/assets/{accordion-BCfsz_gl.js → accordion-DVgwQcnw.js} +1 -1
  164. package/storybook-static/assets/{alert-dialog-BYt6Z7Kt.js → alert-dialog-DCUEwpqm.js} +1 -1
  165. package/storybook-static/assets/{avatar-CRn1qQsC.js → avatar-BzwOE-mi.js} +1 -1
  166. package/storybook-static/assets/{axe-JCJl60WC.js → axe-HmUsR1st.js} +1 -1
  167. package/storybook-static/assets/badge-BnQWua6u.js +1 -0
  168. package/storybook-static/assets/{button-BObfgcV1.js → button-0oMkiryo.js} +1 -1
  169. package/storybook-static/assets/{chart-column-CplFCmg8.js → chart-column-DZGb4ZZS.js} +1 -1
  170. package/storybook-static/assets/{check-DyecuwP4.js → check-B9hBGj6o.js} +1 -1
  171. package/storybook-static/assets/{checkbox-D5BmNJeL.js → checkbox-CyIeaWHX.js} +1 -1
  172. package/storybook-static/assets/{chevron-down-Bp7zbUB0.js → chevron-down-D_37S6il.js} +1 -1
  173. package/storybook-static/assets/{chevron-left-D1L4J3UW.js → chevron-left-BBoN0vbI.js} +1 -1
  174. package/storybook-static/assets/{chevron-right-oMYqDJ_f.js → chevron-right-B5vIMLxK.js} +1 -1
  175. package/storybook-static/assets/{circle-CyarsADt.js → circle-C5Lzx6Nx.js} +1 -1
  176. package/storybook-static/assets/clean-slate-D1HmMFJM.css +1 -0
  177. package/storybook-static/assets/{command-DCnXmNmT.js → command-Csa9p8_a.js} +1 -1
  178. package/storybook-static/assets/{createLucideIcon-CLBo0iA0.js → createLucideIcon-BrHXro7t.js} +1 -1
  179. package/storybook-static/assets/default-CN_Fo1GY.css +1 -0
  180. package/storybook-static/assets/{dialog-DL0QBIbC.js → dialog-CsnqITTn.js} +1 -1
  181. package/storybook-static/assets/{dropdown-menu-BwL9gQwG.js → dropdown-menu-BWxxwPHL.js} +1 -1
  182. package/storybook-static/assets/{ellipsis-DPg968Rc.js → ellipsis-BRS038RR.js} +1 -1
  183. package/storybook-static/assets/{grip-vertical-CM0GDwvq.js → grip-vertical-BxXG8KNA.js} +1 -1
  184. package/storybook-static/assets/{iframe-BWjPIle6.js → iframe-v7iAhKit.js} +219 -219
  185. package/storybook-static/assets/{index-DschQYGl.js → index-0-qMRXou.js} +1 -1
  186. package/storybook-static/assets/{index-CKwUGXmt.js → index-AvwFFKJc.js} +1 -1
  187. package/storybook-static/assets/{index-BfKpUbCE.js → index-BVDb4dFc.js} +1 -1
  188. package/storybook-static/assets/{index-Dr2xmx-F.js → index-B_qx7A5T.js} +1 -1
  189. package/storybook-static/assets/index-BfiCOk42.js +1 -0
  190. package/storybook-static/assets/{index-C9xvlw_B.js → index-Bv9yk470.js} +1 -1
  191. package/storybook-static/assets/{index-DMk2qc2_.js → index-Bw1A27Kp.js} +1 -1
  192. package/storybook-static/assets/{index-7XoYQV2z.js → index-ByqivBWx.js} +1 -1
  193. package/storybook-static/assets/{index-URSssr5a.js → index-C9Ta0ZTH.js} +1 -1
  194. package/storybook-static/assets/{index-Pk2lGsul.js → index-CDY5kTx5.js} +1 -1
  195. package/storybook-static/assets/{index-3zykFCgl.js → index-CGnyVRgB.js} +1 -1
  196. package/storybook-static/assets/{index-Cw7p-pms.js → index-CWjrGFAQ.js} +1 -1
  197. package/storybook-static/assets/{index-npvyVsxD.js → index-CwBdPBFz.js} +1 -1
  198. package/storybook-static/assets/index-D8RXF03I.js +1 -0
  199. package/storybook-static/assets/{index-DE2OlfDP.js → index-DLIxT4Z7.js} +1 -1
  200. package/storybook-static/assets/{index-BcAKBHrX.js → index-DbaA6-o1.js} +1 -1
  201. package/storybook-static/assets/index-Dph_5COR.js +1 -0
  202. package/storybook-static/assets/index-DrN5n71E.js +1 -0
  203. package/storybook-static/assets/{index-04C4iZwC.js → index-Tp9IdbR8.js} +1 -1
  204. package/storybook-static/assets/{index-Dsg7S8zu.js → index-WyF3-wTE.js} +1 -1
  205. package/storybook-static/assets/{index-A7UzX-Xw.js → index-XSmPROEP.js} +1 -1
  206. package/storybook-static/assets/{index-u70nzfOV.js → index-Z6wF44KX.js} +1 -1
  207. package/storybook-static/assets/{index-Dqw7miiX.js → index-_RPqOjlQ.js} +1 -1
  208. package/storybook-static/assets/{index-Cce91yJQ.js → index-jrimW4QO.js} +1 -1
  209. package/storybook-static/assets/{index-C6O7WofA.js → index-nqc17SX4.js} +1 -1
  210. package/storybook-static/assets/{label-CwntpYJ0.js → label-Do8ODIVk.js} +1 -1
  211. package/storybook-static/assets/lodash-DDwpuhPG.js +73 -0
  212. package/storybook-static/assets/minimal-modern-BlYVzfQU.css +1 -0
  213. package/storybook-static/assets/{popover-ClqrrvjL.js → popover-CcciSWAw.js} +1 -1
  214. package/storybook-static/assets/{radio-group-CvN0LQZp.js → radio-group-DiJ0Y_KQ.js} +1 -1
  215. package/storybook-static/assets/{react-18-Bj31y5Nr.js → react-18-Cr9fq_Ip.js} +1 -1
  216. package/storybook-static/assets/{react-icons.esm-DNr9VcvP.js → react-icons.esm-B_ULMmNU.js} +1 -1
  217. package/storybook-static/assets/{refresh-cw-OZakDsFY.js → refresh-cw-BmRDhIV_.js} +1 -1
  218. package/storybook-static/assets/{schemas-CaLvKjsI.js → schemas-CGNYCiJ6.js} +3 -3
  219. package/storybook-static/assets/{section-factories-DKfKL-5s.js → section-factories-DCCY9R35.js} +1 -1
  220. package/storybook-static/assets/{select-gtXRB92c.js → select-DDrkxaOg.js} +1 -1
  221. package/storybook-static/assets/{separator-CxCWfpZX.js → separator-o5SAUnaJ.js} +1 -1
  222. package/storybook-static/assets/{settings-2-DSSkfF6W.js → settings-2-xWGvvbG6.js} +1 -1
  223. package/storybook-static/assets/{sheet-r0VNiBiN.js → sheet-C7jhU3XE.js} +1 -1
  224. package/storybook-static/assets/{shopping-cart-CJBClF2m.js → shopping-cart-BFlrufvo.js} +1 -1
  225. package/storybook-static/assets/{sidebar-BsMnOE7Y.js → sidebar-C8hU1Mxy.js} +1 -1
  226. package/storybook-static/assets/spotify-CUDj7g8m.css +1 -0
  227. package/storybook-static/assets/switch-CKGRuk3u.js +1 -0
  228. package/storybook-static/assets/tabs-CopK2m3j.js +1 -0
  229. package/storybook-static/assets/{toggle-D08-8sQA.js → toggle-DmHbWetf.js} +1 -1
  230. package/storybook-static/assets/{tooltip-CZ1UAE_e.js → tooltip-_LqYEYFw.js} +1 -1
  231. package/storybook-static/assets/{trash-2-D55eseMQ.js → trash-2-xdbApPby.js} +1 -1
  232. package/storybook-static/assets/{x-n8sFtlI2.js → x-B1a4fyWM.js} +1 -1
  233. package/storybook-static/iframe.html +1 -1
  234. package/storybook-static/index.json +1 -1
  235. package/storybook-static/kit/builder/data-table/components/DataTable.d.ts +6 -3
  236. package/storybook-static/kit/builder/data-table/components/DataTable.d.ts.map +1 -1
  237. package/storybook-static/kit/builder/data-table/index.d.ts +6 -5
  238. package/storybook-static/kit/builder/data-table/index.d.ts.map +1 -1
  239. package/storybook-static/kit/builder/form/components/FormBuilder.d.ts +53 -13
  240. package/storybook-static/kit/builder/form/components/FormBuilder.d.ts.map +1 -1
  241. package/storybook-static/kit/builder/form/components/FormBuilderField.d.ts +5 -5
  242. package/storybook-static/kit/builder/form/components/FormBuilderField.d.ts.map +1 -1
  243. package/storybook-static/kit/builder/form/components/fields/ArrayField.d.ts +3 -0
  244. package/storybook-static/kit/builder/form/components/fields/ArrayField.d.ts.map +1 -0
  245. package/storybook-static/kit/builder/form/components/fields/AutocompleteField.d.ts +3 -0
  246. package/storybook-static/kit/builder/form/components/fields/AutocompleteField.d.ts.map +1 -0
  247. package/storybook-static/kit/builder/form/components/fields/CheckboxField.d.ts +3 -0
  248. package/storybook-static/kit/builder/form/components/fields/CheckboxField.d.ts.map +1 -0
  249. package/storybook-static/kit/builder/form/components/fields/DateField.d.ts +3 -0
  250. package/storybook-static/kit/builder/form/components/fields/DateField.d.ts.map +1 -0
  251. package/storybook-static/kit/builder/form/components/fields/FileField.d.ts +3 -0
  252. package/storybook-static/kit/builder/form/components/fields/FileField.d.ts.map +1 -0
  253. package/storybook-static/kit/builder/form/components/fields/NumberField.d.ts +3 -0
  254. package/storybook-static/kit/builder/form/components/fields/NumberField.d.ts.map +1 -0
  255. package/storybook-static/kit/builder/form/components/fields/ObjectField.d.ts +3 -0
  256. package/storybook-static/kit/builder/form/components/fields/ObjectField.d.ts.map +1 -0
  257. package/storybook-static/kit/builder/form/components/fields/RadioField.d.ts +3 -0
  258. package/storybook-static/kit/builder/form/components/fields/RadioField.d.ts.map +1 -0
  259. package/storybook-static/kit/builder/form/components/fields/SelectField.d.ts +3 -0
  260. package/storybook-static/kit/builder/form/components/fields/SelectField.d.ts.map +1 -0
  261. package/storybook-static/kit/builder/form/components/fields/SwitchField.d.ts +3 -0
  262. package/storybook-static/kit/builder/form/components/fields/SwitchField.d.ts.map +1 -0
  263. package/storybook-static/kit/builder/form/components/fields/TextField.d.ts +3 -0
  264. package/storybook-static/kit/builder/form/components/fields/TextField.d.ts.map +1 -0
  265. package/storybook-static/kit/builder/form/components/fields/TextareaField.d.ts +3 -0
  266. package/storybook-static/kit/builder/form/components/fields/TextareaField.d.ts.map +1 -0
  267. package/storybook-static/kit/builder/form/components/fields/index.d.ts +14 -0
  268. package/storybook-static/kit/builder/form/components/fields/index.d.ts.map +1 -0
  269. package/storybook-static/kit/builder/form/components/fields/types.d.ts +14 -0
  270. package/storybook-static/kit/builder/form/components/fields/types.d.ts.map +1 -0
  271. package/storybook-static/kit/builder/form/utils/field-factories.d.ts +1 -0
  272. package/storybook-static/kit/builder/form/utils/field-factories.d.ts.map +1 -1
  273. package/storybook-static/kit/builder/section/SectionBuilder.d.ts.map +1 -1
  274. package/storybook-static/kit/builder/section/types.d.ts +12 -1
  275. package/storybook-static/kit/builder/section/types.d.ts.map +1 -1
  276. package/storybook-static/kit/builder/stack-dialog/context.d.ts +3 -0
  277. package/storybook-static/kit/builder/stack-dialog/context.d.ts.map +1 -0
  278. package/storybook-static/kit/builder/stack-dialog/hooks.d.ts +6 -0
  279. package/storybook-static/kit/builder/stack-dialog/hooks.d.ts.map +1 -0
  280. package/storybook-static/kit/builder/stack-dialog/index.d.ts +5 -0
  281. package/storybook-static/kit/builder/stack-dialog/index.d.ts.map +1 -0
  282. package/storybook-static/kit/builder/stack-dialog/provider.d.ts +3 -0
  283. package/storybook-static/kit/builder/stack-dialog/provider.d.ts.map +1 -0
  284. package/storybook-static/kit/builder/stack-dialog/renderer.d.ts +6 -0
  285. package/storybook-static/kit/builder/stack-dialog/renderer.d.ts.map +1 -0
  286. package/storybook-static/kit/builder/stack-dialog/types.d.ts +20 -0
  287. package/storybook-static/kit/builder/stack-dialog/types.d.ts.map +1 -0
  288. package/storybook-static/kit/components/autocomplete/Autocomplete.d.ts +35 -3
  289. package/storybook-static/kit/components/autocomplete/Autocomplete.d.ts.map +1 -1
  290. package/storybook-static/kit/components/autocomplete/index.d.ts +1 -0
  291. package/storybook-static/kit/components/autocomplete/index.d.ts.map +1 -1
  292. package/storybook-static/kit/components/autocomplete/types.d.ts +1 -1
  293. package/storybook-static/kit/components/autocomplete/types.d.ts.map +1 -1
  294. package/storybook-static/kit/components/monthpicker/MonthPicker.d.ts +32 -0
  295. package/storybook-static/kit/components/monthpicker/MonthPicker.d.ts.map +1 -0
  296. package/storybook-static/kit/components/monthpicker/MonthRangePicker.d.ts +48 -0
  297. package/storybook-static/kit/components/monthpicker/MonthRangePicker.d.ts.map +1 -0
  298. package/storybook-static/kit/layouts/admin/components/AdminLayout.d.ts.map +1 -1
  299. package/storybook-static/kit/layouts/admin/hooks/menu.d.ts +1 -0
  300. package/storybook-static/kit/layouts/admin/hooks/menu.d.ts.map +1 -1
  301. package/storybook-static/kit/providers/ThemeProvider.d.ts.map +1 -1
  302. package/storybook-static/project.json +1 -1
  303. package/storybook-static/assets/AdminLayout.Basic.stories-C-ZxuH-O.js +0 -4
  304. package/storybook-static/assets/AdminLayout.Collapsible.stories-xcQzkxio.js +0 -4
  305. package/storybook-static/assets/AdminLayout.Complex.stories-DyjkVpvE.js +0 -29
  306. package/storybook-static/assets/AdminLayout.CustomSidebarHeaderComponent.stories-BqhzWCIA.js +0 -9
  307. package/storybook-static/assets/AdminLayout.CustomSidebarTitleAndIcon.stories-aWxyR67T.js +0 -4
  308. package/storybook-static/assets/AdminLayout.HeaderSlots.stories-dNzhUdDt.js +0 -7
  309. package/storybook-static/assets/Autocomplete-B4gV705L.js +0 -35
  310. package/storybook-static/assets/Autocomplete.stories-CyOvjTGN.js +0 -33
  311. package/storybook-static/assets/Badge.stories-_-G3GriP.js +0 -12
  312. package/storybook-static/assets/DataTable.Basic.stories-BQNWUKiw.js +0 -6
  313. package/storybook-static/assets/DataTable.Filters.stories-DPCoeYhK.js +0 -21
  314. package/storybook-static/assets/DataTable.Pagination.stories-8UNqTNgw.js +0 -24
  315. package/storybook-static/assets/DataTable.SelectionAndActions.stories-CDEjgQ6T.js +0 -26
  316. package/storybook-static/assets/DataTable.Sorting.stories-qG7-X_6r.js +0 -6
  317. package/storybook-static/assets/Form.Basic.stories-dE4nbgpr.js +0 -45
  318. package/storybook-static/assets/Form.Complex.stories-BEZufnjb.js +0 -230
  319. package/storybook-static/assets/Form.Dynamic.stories-cJTbd6cV.js +0 -247
  320. package/storybook-static/assets/Form.Simple.stories-DOPzZKhh.js +0 -50
  321. package/storybook-static/assets/FormBuilder-C0S7C69Q.js +0 -5
  322. package/storybook-static/assets/Section.stories-Ce5qYITI.js +0 -196
  323. package/storybook-static/assets/SectionBuilder-Df_lRZkj.js +0 -1
  324. package/storybook-static/assets/Sonner.stories-CXW5e_Qg.js +0 -18
  325. package/storybook-static/assets/Switch.stories-zr6i-aNi.js +0 -3
  326. package/storybook-static/assets/Tabs.stories-jxkJ-AUI.js +0 -10
  327. package/storybook-static/assets/clean-slate-V4nUw2Bm.css +0 -1
  328. package/storybook-static/assets/default-CuTBjDca.css +0 -1
  329. package/storybook-static/assets/index-BN5_W3Yi.js +0 -1
  330. package/storybook-static/assets/index-C5eJ31Z3.js +0 -1
  331. package/storybook-static/assets/index-DWC9SV-P.js +0 -1
  332. package/storybook-static/assets/lodash-BkmSIg_J.js +0 -73
  333. package/storybook-static/assets/minimal-modern-d2yFlFJM.css +0 -1
  334. package/storybook-static/assets/spotify-BuPUgQEa.css +0 -1
@@ -1,247 +0,0 @@
1
- import{j as r}from"./jsx-runtime-D_zvdyIk.js";import{F as u}from"./FormBuilder-C0S7C69Q.js";import{c as l,a as e}from"./section-factories-DKfKL-5s.js";import{c as i,a as t}from"./dependencies-ctrV69dx.js";import"./iframe-BWjPIle6.js";import"./preload-helper-Dp1pzeXC.js";import"./schemas-CaLvKjsI.js";import"./utils-D-KgF5mV.js";import"./button-BObfgcV1.js";import"./index-BcAKBHrX.js";import"./index-CGrAONsN.js";import"./input-11YRd9gD.js";import"./textarea-Dw2vruMl.js";import"./select-gtXRB92c.js";import"./index-C5eJ31Z3.js";import"./index-npvyVsxD.js";import"./index-BdQq_4o_.js";import"./index-DW48STyt.js";import"./index-C9xvlw_B.js";import"./index-Pk2lGsul.js";import"./index-Dr2xmx-F.js";import"./index-BfKpUbCE.js";import"./index-04C4iZwC.js";import"./index-DschQYGl.js";import"./Combination-CeVus13L.js";import"./index-BN5_W3Yi.js";import"./index-DWC9SV-P.js";import"./index-C6O7WofA.js";import"./index-DMk2qc2_.js";import"./index-Cce91yJQ.js";import"./index-7XoYQV2z.js";import"./index-Dqw7miiX.js";import"./index-URSssr5a.js";import"./chevron-down-Bp7zbUB0.js";import"./createLucideIcon-CLBo0iA0.js";import"./check-DyecuwP4.js";import"./checkbox-D5BmNJeL.js";import"./index-CKwUGXmt.js";import"./radio-group-CvN0LQZp.js";import"./index-Cw7p-pms.js";import"./circle-CyarsADt.js";import"./label-CwntpYJ0.js";import"./card-BJpPOzP8.js";import"./Autocomplete-B4gV705L.js";import"./popover-ClqrrvjL.js";import"./command-DCnXmNmT.js";import"./index-u70nzfOV.js";import"./dialog-DL0QBIbC.js";import"./x-n8sFtlI2.js";import"./trash-2-D55eseMQ.js";import"./grip-vertical-CM0GDwvq.js";import"./SectionBuilder-Df_lRZkj.js";import"./separator-CxCWfpZX.js";const me={title:"Kit/Builder/Form",component:u,parameters:{controls:{expanded:!0},backgrounds:{disable:!0}}},n={name:"Dynamic example",render:()=>{const p=a=>{console.log("Dynamic form submitted:",a)},h=(a,o)=>{console.log(`Field ${a} changed to:`,o),a==="productType"&&o==="subscription"&&console.log("Subscription product selected - additional fields will appear"),a==="hasDiscount"&&o===!0&&console.log("Discount enabled - discount fields will appear")},m=[l.card("Product Configuration",[e.select("productType","Product Type",[{label:"One-time Purchase",value:"onetime"},{label:"Subscription",value:"subscription"},{label:"Bundle",value:"bundle"},{label:"Digital Download",value:"digital"}],{required:!0,placeholder:"Select product type"}),e.text("productName","Product Name",{required:!0,placeholder:"Enter product name"}),e.number("basePrice","Base Price ($)",{required:!0,placeholder:"29.99"}),e.select("billingCycle","Billing Cycle",[{label:"Monthly",value:"monthly"},{label:"Quarterly",value:"quarterly"},{label:"Yearly",value:"yearly"}],{required:!0,placeholder:"Select billing cycle",dependencies:[i.showWhen("productType",t.equals("subscription"))]}),e.number("trialDays","Free Trial Days",{placeholder:"14",defaultValue:0,dependencies:[i.showWhen("productType",t.equals("subscription"))]}),e.array("bundleItems","Bundle Items",[e.text("itemName","Item Name",{required:!0,placeholder:"Item name"}),e.number("itemPrice","Item Price ($)",{required:!0,placeholder:"9.99"}),e.number("quantity","Quantity",{required:!0,defaultValue:1,placeholder:"1"})],{gridCols:2,defaultValue:[{itemName:"",itemPrice:0,quantity:1}],dependencies:[i.showWhen("productType",t.equals("bundle"))]}),e.select("fileFormat","File Format",[{label:"PDF",value:"pdf"},{label:"ZIP Archive",value:"zip"},{label:"Video (MP4)",value:"mp4"},{label:"Audio (MP3)",value:"mp3"},{label:"Software Installer",value:"exe"}],{required:!0,placeholder:"Select file format",dependencies:[i.showWhen("productType",t.equals("digital"))]}),e.number("fileSizeMB","File Size (MB)",{placeholder:"50",dependencies:[i.showWhen("productType",t.equals("digital"))]})]),l.card("Pricing & Discounts",[e.checkbox("hasDiscount","Apply Discount",{defaultValue:!1,gridCols:2}),e.select("discountType","Discount Type",[{label:"Percentage",value:"percentage"},{label:"Fixed Amount",value:"fixed"},{label:"Buy One Get One",value:"bogo"}],{required:!0,placeholder:"Select discount type",dependencies:[i.showWhen("hasDiscount",t.isTrue())]}),e.number("discountValue","Discount Value",{required:!0,placeholder:"10",dependencies:[i.showWhen("hasDiscount",t.isTrue()),i.showWhen("discountType",a=>a!=="bogo")]}),e.date("discountStartDate","Discount Start Date",{dependencies:[i.showWhen("hasDiscount",t.isTrue())]}),e.date("discountEndDate","Discount End Date",{dependencies:[i.showWhen("hasDiscount",t.isTrue())]}),e.number("minimumQuantity","Minimum Quantity for Discount",{placeholder:"2",defaultValue:1,dependencies:[i.showWhen("hasDiscount",t.isTrue())]})]),l.card("Shipping Configuration",[e.checkbox("requiresShipping","Requires Physical Shipping",{defaultValue:!0,gridCols:2,dependencies:[i.setValueWhen("productType",t.equals("digital"),!1),i.disableWhen("productType",t.equals("digital"))]}),e.number("weight","Weight (lbs)",{placeholder:"1.5",dependencies:[i.showWhen("requiresShipping",t.isTrue())]}),e.object("dimensions","Dimensions (inches)",[e.number("length","Length",{required:!0,placeholder:"10"}),e.number("width","Width",{required:!0,placeholder:"8"}),e.number("height","Height",{required:!0,placeholder:"2"})],{dependencies:[i.showWhen("requiresShipping",t.isTrue())]}),e.select("shippingClass","Shipping Class",[{label:"Standard",value:"standard"},{label:"Express",value:"express"},{label:"Overnight",value:"overnight"},{label:"Fragile",value:"fragile"},{label:"Hazardous",value:"hazardous"}],{required:!0,defaultValue:"standard",placeholder:"Select shipping class",dependencies:[i.showWhen("requiresShipping",t.isTrue())]}),e.checkbox("freeShipping","Offer Free Shipping",{defaultValue:!1,dependencies:[i.showWhen("requiresShipping",t.isTrue())]}),e.number("freeShippingThreshold","Free Shipping Threshold ($)",{placeholder:"50",dependencies:[i.showWhen("requiresShipping",t.isTrue()),i.showWhen("freeShipping",t.isTrue())]})]),l.card("Inventory Management",[e.checkbox("trackInventory","Track Inventory",{defaultValue:!0,gridCols:2,dependencies:[i.setValueWhen("productType",t.equals("digital"),!1)]}),e.number("stockQuantity","Stock Quantity",{required:!0,placeholder:"100",dependencies:[i.showWhen("trackInventory",t.isTrue())]}),e.number("lowStockThreshold","Low Stock Alert Threshold",{placeholder:"10",dependencies:[i.showWhen("trackInventory",t.isTrue())]}),e.checkbox("allowBackorders","Allow Backorders",{defaultValue:!1,dependencies:[i.showWhen("trackInventory",t.isTrue())]}),e.text("sku","SKU (Stock Keeping Unit)",{placeholder:"PROD-001",dependencies:[i.showWhen("trackInventory",t.isTrue())]}),e.text("barcode","Barcode",{placeholder:"123456789012",dependencies:[i.showWhen("trackInventory",t.isTrue())]})]),l.card("Marketing & SEO",[e.text("metaTitle","Meta Title",{placeholder:"SEO-friendly title",gridCols:2}),e.textarea("metaDescription","Meta Description",{placeholder:"SEO-friendly description (150-160 characters)",gridCols:2}),e.array("tags","Product Tags",[e.text("tag","Tag",{required:!0,placeholder:"e.g., electronics, gadgets"})],{gridCols:2,defaultValue:[{tag:""}]}),e.checkbox("featured","Featured Product",{defaultValue:!1}),e.checkbox("newProduct","Mark as New",{defaultValue:!1}),e.select("visibility","Product Visibility",[{label:"Public",value:"public"},{label:"Private",value:"private"},{label:"Password Protected",value:"password"},{label:"Coming Soon",value:"coming_soon"}],{required:!0,defaultValue:"public",placeholder:"Select visibility"}),e.text("password","Access Password",{placeholder:"Enter password",dependencies:[i.showWhen("visibility",t.equals("password"))]}),e.date("launchDate","Launch Date",{dependencies:[i.showWhen("visibility",t.equals("coming_soon"))]})])];return r.jsxs("div",{className:"max-w-6xl mx-auto p-6",children:[r.jsxs("div",{className:"mb-8",children:[r.jsx("h1",{className:"text-3xl font-bold text-gray-900",children:"Dynamic Product Configuration"}),r.jsx("p",{className:"text-gray-600 mt-2",children:"This form demonstrates advanced field dependencies and real-time interactions. Watch how fields appear, disappear, and change based on your selections."}),r.jsxs("div",{className:"mt-4 p-4 bg-blue-50 border border-blue-200 rounded-lg",children:[r.jsx("h3",{className:"font-semibold text-blue-900",children:"Try these interactions:"}),r.jsxs("ul",{className:"mt-2 text-sm text-blue-800 space-y-1",children:[r.jsx("li",{children:"• Change Product Type to see different field sets"}),r.jsx("li",{children:'• Enable "Apply Discount" to reveal discount configuration'}),r.jsx("li",{children:'• Toggle "Requires Physical Shipping" for shipping options'}),r.jsx("li",{children:'• Select "Digital Download" to auto-disable shipping'}),r.jsx("li",{children:'• Choose "Password Protected" visibility for password field'})]})]})]}),r.jsx(u,{sections:m,onSubmit:p,onFieldChange:h,submitLabel:"Save Product Configuration",resetLabel:"Reset All",className:"space-y-8"})]})}};var s,d,c;n.parameters={...n.parameters,docs:{...(s=n.parameters)==null?void 0:s.docs,source:{originalSource:`{
2
- name: 'Dynamic example',
3
- render: () => {
4
- const handleSubmit = (data: unknown) => {
5
- console.log('Dynamic form submitted:', data);
6
- };
7
- const handleFieldChange = (name: string, value: unknown) => {
8
- console.log(\`Field \${name} changed to:\`, value);
9
- if (name === 'productType' && value === 'subscription') {
10
- console.log('Subscription product selected - additional fields will appear');
11
- }
12
- if (name === 'hasDiscount' && value === true) {
13
- console.log('Discount enabled - discount fields will appear');
14
- }
15
- };
16
- const sections = [createSection.card('Product Configuration', [createField.select('productType', 'Product Type', [{
17
- label: 'One-time Purchase',
18
- value: 'onetime'
19
- }, {
20
- label: 'Subscription',
21
- value: 'subscription'
22
- }, {
23
- label: 'Bundle',
24
- value: 'bundle'
25
- }, {
26
- label: 'Digital Download',
27
- value: 'digital'
28
- }], {
29
- required: true,
30
- placeholder: 'Select product type'
31
- }), createField.text('productName', 'Product Name', {
32
- required: true,
33
- placeholder: 'Enter product name'
34
- }), createField.number('basePrice', 'Base Price ($)', {
35
- required: true,
36
- placeholder: '29.99'
37
- }), createField.select('billingCycle', 'Billing Cycle', [{
38
- label: 'Monthly',
39
- value: 'monthly'
40
- }, {
41
- label: 'Quarterly',
42
- value: 'quarterly'
43
- }, {
44
- label: 'Yearly',
45
- value: 'yearly'
46
- }], {
47
- required: true,
48
- placeholder: 'Select billing cycle',
49
- dependencies: [createDependency.showWhen('productType', conditions.equals('subscription'))]
50
- }), createField.number('trialDays', 'Free Trial Days', {
51
- placeholder: '14',
52
- defaultValue: 0,
53
- dependencies: [createDependency.showWhen('productType', conditions.equals('subscription'))]
54
- }), createField.array('bundleItems', 'Bundle Items', [createField.text('itemName', 'Item Name', {
55
- required: true,
56
- placeholder: 'Item name'
57
- }), createField.number('itemPrice', 'Item Price ($)', {
58
- required: true,
59
- placeholder: '9.99'
60
- }), createField.number('quantity', 'Quantity', {
61
- required: true,
62
- defaultValue: 1,
63
- placeholder: '1'
64
- })], {
65
- gridCols: 2,
66
- defaultValue: [{
67
- itemName: '',
68
- itemPrice: 0,
69
- quantity: 1
70
- }],
71
- dependencies: [createDependency.showWhen('productType', conditions.equals('bundle'))]
72
- }), createField.select('fileFormat', 'File Format', [{
73
- label: 'PDF',
74
- value: 'pdf'
75
- }, {
76
- label: 'ZIP Archive',
77
- value: 'zip'
78
- }, {
79
- label: 'Video (MP4)',
80
- value: 'mp4'
81
- }, {
82
- label: 'Audio (MP3)',
83
- value: 'mp3'
84
- }, {
85
- label: 'Software Installer',
86
- value: 'exe'
87
- }], {
88
- required: true,
89
- placeholder: 'Select file format',
90
- dependencies: [createDependency.showWhen('productType', conditions.equals('digital'))]
91
- }), createField.number('fileSizeMB', 'File Size (MB)', {
92
- placeholder: '50',
93
- dependencies: [createDependency.showWhen('productType', conditions.equals('digital'))]
94
- })]), createSection.card('Pricing & Discounts', [createField.checkbox('hasDiscount', 'Apply Discount', {
95
- defaultValue: false,
96
- gridCols: 2
97
- }), createField.select('discountType', 'Discount Type', [{
98
- label: 'Percentage',
99
- value: 'percentage'
100
- }, {
101
- label: 'Fixed Amount',
102
- value: 'fixed'
103
- }, {
104
- label: 'Buy One Get One',
105
- value: 'bogo'
106
- }], {
107
- required: true,
108
- placeholder: 'Select discount type',
109
- dependencies: [createDependency.showWhen('hasDiscount', conditions.isTrue())]
110
- }), createField.number('discountValue', 'Discount Value', {
111
- required: true,
112
- placeholder: '10',
113
- dependencies: [createDependency.showWhen('hasDiscount', conditions.isTrue()), createDependency.showWhen('discountType', value => value !== 'bogo')]
114
- }), createField.date('discountStartDate', 'Discount Start Date', {
115
- dependencies: [createDependency.showWhen('hasDiscount', conditions.isTrue())]
116
- }), createField.date('discountEndDate', 'Discount End Date', {
117
- dependencies: [createDependency.showWhen('hasDiscount', conditions.isTrue())]
118
- }), createField.number('minimumQuantity', 'Minimum Quantity for Discount', {
119
- placeholder: '2',
120
- defaultValue: 1,
121
- dependencies: [createDependency.showWhen('hasDiscount', conditions.isTrue())]
122
- })]), createSection.card('Shipping Configuration', [createField.checkbox('requiresShipping', 'Requires Physical Shipping', {
123
- defaultValue: true,
124
- gridCols: 2,
125
- dependencies: [createDependency.setValueWhen('productType', conditions.equals('digital'), false), createDependency.disableWhen('productType', conditions.equals('digital'))]
126
- }), createField.number('weight', 'Weight (lbs)', {
127
- placeholder: '1.5',
128
- dependencies: [createDependency.showWhen('requiresShipping', conditions.isTrue())]
129
- }), createField.object('dimensions', 'Dimensions (inches)', [createField.number('length', 'Length', {
130
- required: true,
131
- placeholder: '10'
132
- }), createField.number('width', 'Width', {
133
- required: true,
134
- placeholder: '8'
135
- }), createField.number('height', 'Height', {
136
- required: true,
137
- placeholder: '2'
138
- })], {
139
- dependencies: [createDependency.showWhen('requiresShipping', conditions.isTrue())]
140
- }), createField.select('shippingClass', 'Shipping Class', [{
141
- label: 'Standard',
142
- value: 'standard'
143
- }, {
144
- label: 'Express',
145
- value: 'express'
146
- }, {
147
- label: 'Overnight',
148
- value: 'overnight'
149
- }, {
150
- label: 'Fragile',
151
- value: 'fragile'
152
- }, {
153
- label: 'Hazardous',
154
- value: 'hazardous'
155
- }], {
156
- required: true,
157
- defaultValue: 'standard',
158
- placeholder: 'Select shipping class',
159
- dependencies: [createDependency.showWhen('requiresShipping', conditions.isTrue())]
160
- }), createField.checkbox('freeShipping', 'Offer Free Shipping', {
161
- defaultValue: false,
162
- dependencies: [createDependency.showWhen('requiresShipping', conditions.isTrue())]
163
- }), createField.number('freeShippingThreshold', 'Free Shipping Threshold ($)', {
164
- placeholder: '50',
165
- dependencies: [createDependency.showWhen('requiresShipping', conditions.isTrue()), createDependency.showWhen('freeShipping', conditions.isTrue())]
166
- })]), createSection.card('Inventory Management', [createField.checkbox('trackInventory', 'Track Inventory', {
167
- defaultValue: true,
168
- gridCols: 2,
169
- dependencies: [createDependency.setValueWhen('productType', conditions.equals('digital'), false)]
170
- }), createField.number('stockQuantity', 'Stock Quantity', {
171
- required: true,
172
- placeholder: '100',
173
- dependencies: [createDependency.showWhen('trackInventory', conditions.isTrue())]
174
- }), createField.number('lowStockThreshold', 'Low Stock Alert Threshold', {
175
- placeholder: '10',
176
- dependencies: [createDependency.showWhen('trackInventory', conditions.isTrue())]
177
- }), createField.checkbox('allowBackorders', 'Allow Backorders', {
178
- defaultValue: false,
179
- dependencies: [createDependency.showWhen('trackInventory', conditions.isTrue())]
180
- }), createField.text('sku', 'SKU (Stock Keeping Unit)', {
181
- placeholder: 'PROD-001',
182
- dependencies: [createDependency.showWhen('trackInventory', conditions.isTrue())]
183
- }), createField.text('barcode', 'Barcode', {
184
- placeholder: '123456789012',
185
- dependencies: [createDependency.showWhen('trackInventory', conditions.isTrue())]
186
- })]), createSection.card('Marketing & SEO', [createField.text('metaTitle', 'Meta Title', {
187
- placeholder: 'SEO-friendly title',
188
- gridCols: 2
189
- }), createField.textarea('metaDescription', 'Meta Description', {
190
- placeholder: 'SEO-friendly description (150-160 characters)',
191
- gridCols: 2
192
- }), createField.array('tags', 'Product Tags', [createField.text('tag', 'Tag', {
193
- required: true,
194
- placeholder: 'e.g., electronics, gadgets'
195
- })], {
196
- gridCols: 2,
197
- defaultValue: [{
198
- tag: ''
199
- }]
200
- }), createField.checkbox('featured', 'Featured Product', {
201
- defaultValue: false
202
- }), createField.checkbox('newProduct', 'Mark as New', {
203
- defaultValue: false
204
- }), createField.select('visibility', 'Product Visibility', [{
205
- label: 'Public',
206
- value: 'public'
207
- }, {
208
- label: 'Private',
209
- value: 'private'
210
- }, {
211
- label: 'Password Protected',
212
- value: 'password'
213
- }, {
214
- label: 'Coming Soon',
215
- value: 'coming_soon'
216
- }], {
217
- required: true,
218
- defaultValue: 'public',
219
- placeholder: 'Select visibility'
220
- }), createField.text('password', 'Access Password', {
221
- placeholder: 'Enter password',
222
- dependencies: [createDependency.showWhen('visibility', conditions.equals('password'))]
223
- }), createField.date('launchDate', 'Launch Date', {
224
- dependencies: [createDependency.showWhen('visibility', conditions.equals('coming_soon'))]
225
- })])];
226
- return <div className="max-w-6xl mx-auto p-6">
227
- <div className="mb-8">
228
- <h1 className="text-3xl font-bold text-gray-900">Dynamic Product Configuration</h1>
229
- <p className="text-gray-600 mt-2">
230
- This form demonstrates advanced field dependencies and real-time interactions. Watch how fields appear, disappear, and change based on your selections.
231
- </p>
232
- <div className="mt-4 p-4 bg-blue-50 border border-blue-200 rounded-lg">
233
- <h3 className="font-semibold text-blue-900">Try these interactions:</h3>
234
- <ul className="mt-2 text-sm text-blue-800 space-y-1">
235
- <li>• Change Product Type to see different field sets</li>
236
- <li>• Enable "Apply Discount" to reveal discount configuration</li>
237
- <li>• Toggle "Requires Physical Shipping" for shipping options</li>
238
- <li>• Select "Digital Download" to auto-disable shipping</li>
239
- <li>• Choose "Password Protected" visibility for password field</li>
240
- </ul>
241
- </div>
242
- </div>
243
-
244
- <FormBuilder sections={sections} onSubmit={handleSubmit} onFieldChange={handleFieldChange} submitLabel="Save Product Configuration" resetLabel="Reset All" className="space-y-8" />
245
- </div>;
246
- }
247
- }`,...(c=(d=n.parameters)==null?void 0:d.docs)==null?void 0:c.source}}};const be=["DynamicExample"];export{n as DynamicExample,be as __namedExportsOrder,me as default};
@@ -1,50 +0,0 @@
1
- import{j as r}from"./jsx-runtime-D_zvdyIk.js";import{F as i}from"./FormBuilder-C0S7C69Q.js";import{c as n,a as e,b as c}from"./section-factories-DKfKL-5s.js";import"./iframe-BWjPIle6.js";import"./preload-helper-Dp1pzeXC.js";import"./schemas-CaLvKjsI.js";import"./utils-D-KgF5mV.js";import"./button-BObfgcV1.js";import"./index-BcAKBHrX.js";import"./index-CGrAONsN.js";import"./input-11YRd9gD.js";import"./textarea-Dw2vruMl.js";import"./select-gtXRB92c.js";import"./index-C5eJ31Z3.js";import"./index-npvyVsxD.js";import"./index-BdQq_4o_.js";import"./index-DW48STyt.js";import"./index-C9xvlw_B.js";import"./index-Pk2lGsul.js";import"./index-Dr2xmx-F.js";import"./index-BfKpUbCE.js";import"./index-04C4iZwC.js";import"./index-DschQYGl.js";import"./Combination-CeVus13L.js";import"./index-BN5_W3Yi.js";import"./index-DWC9SV-P.js";import"./index-C6O7WofA.js";import"./index-DMk2qc2_.js";import"./index-Cce91yJQ.js";import"./index-7XoYQV2z.js";import"./index-Dqw7miiX.js";import"./index-URSssr5a.js";import"./chevron-down-Bp7zbUB0.js";import"./createLucideIcon-CLBo0iA0.js";import"./check-DyecuwP4.js";import"./checkbox-D5BmNJeL.js";import"./index-CKwUGXmt.js";import"./radio-group-CvN0LQZp.js";import"./index-Cw7p-pms.js";import"./circle-CyarsADt.js";import"./label-CwntpYJ0.js";import"./card-BJpPOzP8.js";import"./Autocomplete-B4gV705L.js";import"./popover-ClqrrvjL.js";import"./command-DCnXmNmT.js";import"./index-u70nzfOV.js";import"./dialog-DL0QBIbC.js";import"./x-n8sFtlI2.js";import"./trash-2-D55eseMQ.js";import"./grip-vertical-CM0GDwvq.js";import"./SectionBuilder-Df_lRZkj.js";import"./separator-CxCWfpZX.js";const ne={title:"Kit/Builder/Form",component:i,parameters:{controls:{expanded:!0},backgrounds:{disable:!0}}},t={name:"Simple example",render:()=>{const s=p=>{console.log("Form submitted:",p)},m=[n.card("Contact Information",[e.text("name","Full Name",{required:!0,placeholder:"Enter your full name"}),e.email("email","Email Address",{required:!0,placeholder:"Enter your email address"}),e.text("phone","Phone Number",{validation:c.phone,placeholder:"+1 (555) 123-4567"}),e.select("subject","Subject",[{label:"General Inquiry",value:"general"},{label:"Technical Support",value:"support"},{label:"Sales Question",value:"sales"},{label:"Partnership",value:"partnership"}],{required:!0,placeholder:"Select a subject"}),e.textarea("message","Message",{required:!0,placeholder:"Enter your message here...",gridCols:2}),e.checkbox("subscribe","Subscribe to newsletter",{defaultValue:!1,gridCols:2})])];return r.jsxs("div",{className:"max-w-2xl mx-auto p-6",children:[r.jsxs("div",{className:"mb-6",children:[r.jsx("h1",{className:"text-2xl font-bold text-gray-900",children:"Contact Us"}),r.jsx("p",{className:"text-gray-600 mt-2",children:"Fill out the form below and we'll get back to you as soon as possible."})]}),r.jsx(i,{sections:m,onSubmit:s,className:"space-y-6"})]})}};var a,o,l;t.parameters={...t.parameters,docs:{...(a=t.parameters)==null?void 0:a.docs,source:{originalSource:`{
2
- name: 'Simple example',
3
- render: () => {
4
- const handleSubmit = (data: unknown) => {
5
- console.log('Form submitted:', data);
6
- };
7
- const sections = [createSection.card('Contact Information', [createField.text('name', 'Full Name', {
8
- required: true,
9
- placeholder: 'Enter your full name'
10
- }), createField.email('email', 'Email Address', {
11
- required: true,
12
- placeholder: 'Enter your email address'
13
- }), createField.text('phone', 'Phone Number', {
14
- validation: commonValidations.phone,
15
- placeholder: '+1 (555) 123-4567'
16
- }), createField.select('subject', 'Subject', [{
17
- label: 'General Inquiry',
18
- value: 'general'
19
- }, {
20
- label: 'Technical Support',
21
- value: 'support'
22
- }, {
23
- label: 'Sales Question',
24
- value: 'sales'
25
- }, {
26
- label: 'Partnership',
27
- value: 'partnership'
28
- }], {
29
- required: true,
30
- placeholder: 'Select a subject'
31
- }), createField.textarea('message', 'Message', {
32
- required: true,
33
- placeholder: 'Enter your message here...',
34
- gridCols: 2
35
- }), createField.checkbox('subscribe', 'Subscribe to newsletter', {
36
- defaultValue: false,
37
- gridCols: 2
38
- })])];
39
- return <div className="max-w-2xl mx-auto p-6">
40
- <div className="mb-6">
41
- <h1 className="text-2xl font-bold text-gray-900">Contact Us</h1>
42
- <p className="text-gray-600 mt-2">
43
- Fill out the form below and we'll get back to you as soon as possible.
44
- </p>
45
- </div>
46
-
47
- <FormBuilder sections={sections} onSubmit={handleSubmit} className="space-y-6" />
48
- </div>;
49
- }
50
- }`,...(l=(o=t.parameters)==null?void 0:o.docs)==null?void 0:l.source}}};const ce=["SimpleExample"];export{t as SimpleExample,ce as __namedExportsOrder,ne as default};
@@ -1,5 +0,0 @@
1
- import{j as a}from"./jsx-runtime-D_zvdyIk.js";import{r as C}from"./iframe-BWjPIle6.js";import{u as ne,c as le,o as F,d as ie,e as ce,Z as K,s as V,f as Q,g as W,h as M,n as E,i as O,j as X,a as Y,b as oe,l as me}from"./schemas-CaLvKjsI.js";import{c as k}from"./utils-D-KgF5mV.js";import{B as $}from"./button-BObfgcV1.js";import{I as q}from"./input-11YRd9gD.js";import{T as de}from"./textarea-Dw2vruMl.js";import{S as ue,a as pe,b as he,c as ve,d as ge}from"./select-gtXRB92c.js";import{C as be}from"./checkbox-D5BmNJeL.js";import{R as xe,a as ye}from"./radio-group-CvN0LQZp.js";import{L as z}from"./label-CwntpYJ0.js";import{C as U,a as Z,b as ee,c as D}from"./card-BJpPOzP8.js";import{A as fe}from"./Autocomplete-B4gV705L.js";import{P as je,T as Ne}from"./trash-2-D55eseMQ.js";import{G as Ce}from"./grip-vertical-CM0GDwvq.js";import{S as we}from"./SectionBuilder-Df_lRZkj.js";function P({field:e,control:x,onChange:b,onFieldChange:I,parentPath:L}){const d=L?`${L}.${e.name}`:e.name,f="__NULL__",{field:u,fieldState:{error:j}}=ne({name:d,control:x,disabled:e.disabled}),h=C.useCallback(m=>{u.onChange(m),b==null||b(m)},[u.onChange,b]),w=()=>{var N,T;const m={id:d,disabled:e.disabled,placeholder:e.placeholder,className:k(j&&"border-destructive focus-visible:ring-destructive",e.className)};switch(e.type){case"autocomplete":{const c=(e.options??[]).filter(o=>o.value!==null&&o.value!==void 0).map(o=>({label:o.label,value:o.value}));return a.jsx(fe,{mode:e.autocompleteMode??"client",options:c,fetcher:e.fetcher,pageSize:e.pageSize,value:u.value??null,onChange:o=>h(o),placeholder:e.placeholder,searchPlaceholder:e.searchPlaceholder,renderOption:e.renderOption,disabled:e.disabled,className:m.className})}case"text":case"email":case"password":return a.jsx(q,{...m,type:e.type,value:u.value||"",onChange:c=>h(c.target.value)});case"number":return a.jsx(q,{...m,type:"number",value:u.value||"",onChange:c=>h(Number(c.target.value))});case"textarea":return a.jsx(de,{...m,value:u.value||"",onChange:c=>h(c.target.value),rows:4});case"select":{const c=t=>t==null?f:String(t),o=t=>{var v;const g=(v=e.options)==null?void 0:v.find(y=>c(y.value)===t);return g?g.value:null};return a.jsxs(ue,{value:c(u.value),onValueChange:t=>h(o(t)),disabled:e.disabled,children:[a.jsx(pe,{className:m.className,children:a.jsx(he,{placeholder:e.placeholder})}),a.jsx(ve,{children:(N=e.options)==null?void 0:N.map(t=>a.jsx(ge,{value:c(t.value),children:t.label},c(t.value)))})]})}case"checkbox":return a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(be,{id:d,checked:u.value||!1,onCheckedChange:h,disabled:e.disabled,className:k(j&&"border-destructive",e.className)}),a.jsx(z,{htmlFor:d,className:"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",children:e.label})]});case"radio":{const c=t=>t==null?f:String(t),o=t=>{var v;const g=(v=e.options)==null?void 0:v.find(y=>c(y.value)===t);return g?g.value:null};return a.jsx(xe,{value:c(u.value),onValueChange:t=>h(o(t)),disabled:e.disabled,className:e.className,children:(T=e.options)==null?void 0:T.map(t=>a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(ye,{value:c(t.value),id:`${d}-${c(t.value)}`}),a.jsx(z,{htmlFor:`${d}-${c(t.value)}`,children:t.label})]},c(t.value)))})}case"date":return a.jsx(q,{...m,type:"date",value:u.value?new Date(u.value).toISOString().split("T")[0]:"",onChange:c=>h(c.target.value?new Date(c.target.value):null)});case"file":return a.jsx(q,{...m,type:"file",onChange:c=>{var o;return h(((o=c.target.files)==null?void 0:o[0])||null)}});default:return a.jsx(q,{...m,value:u.value||"",onChange:c=>h(c.target.value)})}},A=()=>e.fields?a.jsxs(U,{className:e.className,children:[a.jsxs(Z,{className:"pb-3",children:[a.jsx(ee,{className:"text-base",children:e.label}),e.description&&a.jsx("p",{className:"text-sm text-muted-foreground",children:e.description})]}),a.jsx(D,{className:"space-y-4",children:a.jsx("div",{className:"grid gap-4 md:grid-cols-2",children:e.fields.map(m=>a.jsx(P,{field:m,control:x,parentPath:d,onChange:b,onFieldChange:I},m.name))})})]}):null,_=()=>{const{fields:m,append:N,remove:T}=le({control:x,name:d}),c=()=>{if(e.fields&&e.fields.length===1){const o=e.fields[0].defaultValue||"";N(o)}else if(e.fields){const o={};e.fields.forEach(t=>{o[t.name]=t.defaultValue||""}),N(o)}else N("")};return a.jsxs(U,{className:e.className,children:[a.jsx(Z,{className:"pb-3",children:a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{children:[a.jsx(ee,{className:"text-base",children:e.label}),e.description&&a.jsx("p",{className:"text-sm text-muted-foreground",children:e.description})]}),a.jsxs($,{type:"button",variant:"outline",size:"sm",onClick:c,disabled:e.disabled,children:[a.jsx(je,{className:"h-4 w-4 mr-1"}),"Add Item"]})]})}),a.jsx(D,{className:"space-y-4",children:m.length===0?a.jsx("p",{className:"text-sm text-muted-foreground text-center py-4",children:'No items added yet. Click "Add Item" to get started.'}):m.map((o,t)=>{var g;return a.jsxs(U,{className:"relative",children:[a.jsx(Z,{className:"pb-3",children:a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(Ce,{className:"h-4 w-4 text-muted-foreground"}),a.jsxs("span",{className:"text-sm font-medium",children:["Item",t+1]})]}),a.jsx($,{type:"button",variant:"ghost",size:"sm",onClick:()=>T(t),disabled:e.disabled,children:a.jsx(Ne,{className:"h-4 w-4"})})]})}),a.jsx(D,{children:e.fields&&e.fields.length===1?a.jsx(P,{field:{...e.fields[0],name:e.fields[0].name,label:e.fields[0].label||"Value"},control:x,parentPath:`${d}.${t}`,onChange:b}):e.fields?a.jsx("div",{className:"grid gap-4 md:grid-cols-2",children:e.fields.map(v=>a.jsx(P,{field:v,control:x,parentPath:`${d}.${t}`,onChange:b,onFieldChange:I},v.name))}):a.jsx(q,{value:((g=u.value)==null?void 0:g[t])||"",onChange:v=>{const y=[...u.value||[]];y[t]=v.target.value,h(y)},placeholder:`Item ${t+1}`,disabled:e.disabled})})]},o.id)})})]})};return e.type==="object"?A():e.type==="array"?_():e.type==="checkbox"?a.jsxs("div",{className:k("space-y-2",e.gridCols&&`md:col-span-${e.gridCols}`),children:[w(),e.description&&a.jsx("p",{className:"text-sm text-muted-foreground",children:e.description}),j&&a.jsx("p",{className:"text-sm text-destructive",children:j.message})]}):a.jsxs("div",{className:k("space-y-2",e.gridCols&&`md:col-span-${e.gridCols}`),children:[a.jsxs(z,{htmlFor:d,className:"text-sm font-medium",children:[e.label,e.required&&a.jsx("span",{className:"text-destructive ml-1",children:"*"})]}),w(),e.description&&a.jsx("p",{className:"text-sm text-muted-foreground",children:e.description}),j&&a.jsx("p",{className:"text-sm text-destructive",children:j.message})]})}P.__docgenInfo={description:"",methods:[],displayName:"FormBuilderField",props:{field:{required:!0,tsType:{name:"FormBuilderFieldConfig"},description:""},control:{required:!0,tsType:{name:"Control",elements:[{name:"any"}],raw:"Control<any>"},description:""},onChange:{required:!1,tsType:{name:"signature",type:"function",raw:"(value: any) => void",signature:{arguments:[{type:{name:"any"},name:"value"}],return:{name:"void"}}},description:""},onFieldChange:{required:!1,tsType:{name:"signature",type:"function",raw:"(name: string, value: any, allValues: Record<string, any>) => void",signature:{arguments:[{type:{name:"string"},name:"name"},{type:{name:"any"},name:"value"},{type:{name:"Record",elements:[{name:"string"},{name:"any"}],raw:"Record<string, any>"},name:"allValues"}],return:{name:"void"}}},description:""},parentPath:{required:!1,tsType:{name:"string"},description:""}}};function Ve({sections:e,schema:x,defaultValues:b={},onSubmit:I,onCancel:L,onReset:d,onFieldChange:f,submitLabel:u="Submit",cancelLabel:j="Cancel",resetLabel:h="Reset",isSubmitting:w=!1,className:A,formClassName:_,actionsClassName:m,showActions:N=!0,customActions:T}){const c=C.useMemo(()=>{if(x)return x;const l=i=>{if(i.validation&&i.validation instanceof K)return i.validation;if(i.validation&&typeof i.validation=="object"&&!(i.validation instanceof K)){const n=i.validation;let r;switch(i.type){case"email":r=V().email("Invalid email address");break;case"number":r=E();break;case"autocomplete":r=M([V(),E()]).nullable();break;case"checkbox":r=W();break;case"date":r=Q();break;default:r=V()}return n.pattern&&r instanceof O&&(r=r.regex(n.pattern.value,n.pattern.message)),n.min&&r instanceof X&&(r=r.min(n.min.value,n.min.message)),n.max&&r instanceof X&&(r=r.max(n.max.value,n.max.message)),n.minLength&&r instanceof O&&(r=r.min(n.minLength.value,n.minLength.message)),n.maxLength&&r instanceof O&&(r=r.max(n.maxLength.value,n.maxLength.message)),i.required?r:r.optional()}let s;switch(i.type){case"email":s=V().email("Invalid email address");break;case"number":s=E();break;case"autocomplete":s=M([V(),E(),F()]).nullable();break;case"checkbox":s=W();break;case"date":s=Q();break;case"select":case"radio":if(i.options&&i.options.length>0){const n=i.options.map(r=>me(r.value));n.length===1?s=n[0]:s=M(n)}else s=V();break;case"object":if(i.fields){const n={};i.fields.forEach(r=>{n[r.name]=l(r)}),s=F(n)}else s=F({});break;case"array":if(i.fields&&i.fields.length>0){const n=i.fields.length===1?l(i.fields[0]):F(i.fields.reduce((r,R)=>(r[R.name]=l(R),r),{}));s=Y(n)}else s=Y(oe());break;default:s=V()}return i.required?s:s.optional()},p={};return e.forEach(i=>{i.fields.forEach(s=>{p[s.name]=l(s)})}),F(p)},[e,x]),o=C.useMemo(()=>{const l={...b},p=i=>{i.forEach(s=>{if(l[s.name]===void 0&&s.defaultValue!==void 0&&(l[s.name]=s.defaultValue),s.type==="object"&&s.fields){l[s.name]||(l[s.name]={});const n={};s.fields.forEach(r=>{r.defaultValue!==void 0&&(n[r.name]=r.defaultValue)}),l[s.name]={...n,...l[s.name]}}s.type==="array"&&s.fields&&(l[s.name]||(l[s.name]=s.defaultValue||[]))})};return e.forEach(i=>p(i.fields)),l},[e,b]),t=ie({resolver:ce(c),defaultValues:o}),{control:g,handleSubmit:v,reset:y,setValue:B,getValues:S,watch:ae}=t,G=ae(),H=C.useCallback(l=>{if(!l.dependencies)return{};const p={};return l.dependencies.forEach(i=>{const s=G[i.field],n=i.condition(s);switch(i.action){case"show":n||(p.hidden=!0);break;case"hide":n&&(p.hidden=!0);break;case"enable":n||(p.disabled=!0);break;case"disable":n&&(p.disabled=!0);break;case"setValue":n&&i.value!==void 0&&S(l.name)!==i.value&&B(l.name,i.value);break}}),p},[G,B,S]),J=C.useCallback((l,p)=>{l.onChange&&l.onChange(p,B,S)},[B,S]),se=C.useCallback(async l=>{try{await I(l)}catch(p){console.error("Form submission error:",p)}},[I]),te=C.useCallback(()=>{y(o),d==null||d()},[y,o,d]),re=C.useMemo(()=>e.map((l,p)=>({id:l.id??`section-${p}`,title:l.title,subtitle:l.description,variant:l.variant??"card",className:l.className,layout:l.layout??"grid",grid:l.grid??{cols:1,mdCols:2,gap:"gap-4"},flex:l.flex,hidden:l.hidden,children:l.fields.map(s=>{const n=H(s);if(s.hidden||n.hidden)return null;const r=Math.max(1,Math.min(12,s.gridCols??1));return{key:s.name,span:{base:1,md:r},hidden:s.hidden,content:a.jsx(P,{field:{...s,disabled:s.disabled||n.disabled},control:g,onChange:R=>{J(s,R),f==null||f(s.name,R,S())},onFieldChange:f},s.name)}}).filter(Boolean)})),[e,g,H,J,f,S]);return a.jsx("div",{className:k("space-y-6",A),children:a.jsxs("form",{onSubmit:v(se),className:k("space-y-6",_),children:[a.jsx(we,{sections:re}),N&&a.jsxs("div",{className:k("flex flex-col sm:flex-row gap-3 pt-6 border-t",m),children:[a.jsx($,{type:"submit",disabled:w,className:"sm:order-last",children:w?"Submitting...":u}),L&&a.jsx($,{type:"button",variant:"outline",onClick:L,disabled:w,children:j}),d&&a.jsx($,{type:"button",variant:"ghost",onClick:te,disabled:w,children:h}),T]})]})})}Ve.__docgenInfo={description:"",methods:[],displayName:"FormBuilder",props:{sections:{required:!0,tsType:{name:"Array",elements:[{name:"FormBuilderSectionConfig"}],raw:"FormBuilderSectionConfig[]"},description:""},schema:{required:!1,tsType:{name:"z.ZodType",elements:[{name:"any"}],raw:"z.ZodType<any>"},description:""},defaultValues:{required:!1,tsType:{name:"union",raw:"Record<string, any> | null",elements:[{name:"Record",elements:[{name:"string"},{name:"any"}],raw:"Record<string, any>"},{name:"null"}]},description:"",defaultValue:{value:"{}",computed:!1}},onSubmit:{required:!0,tsType:{name:"signature",type:"function",raw:"(data: any) => void | Promise<void>",signature:{arguments:[{type:{name:"any"},name:"data"}],return:{name:"union",raw:"void | Promise<void>",elements:[{name:"void"},{name:"Promise",elements:[{name:"void"}],raw:"Promise<void>"}]}}},description:""},onCancel:{required:!1,tsType:{name:"signature",type:"function",raw:"() => void",signature:{arguments:[],return:{name:"void"}}},description:""},onReset:{required:!1,tsType:{name:"signature",type:"function",raw:"() => void",signature:{arguments:[],return:{name:"void"}}},description:""},onFieldChange:{required:!1,tsType:{name:"signature",type:"function",raw:`(
2
- name: string,
3
- value: any,
4
- allValues: Record<string, any>
5
- ) => void`,signature:{arguments:[{type:{name:"string"},name:"name"},{type:{name:"any"},name:"value"},{type:{name:"Record",elements:[{name:"string"},{name:"any"}],raw:"Record<string, any>"},name:"allValues"}],return:{name:"void"}}},description:""},submitLabel:{required:!1,tsType:{name:"string"},description:"",defaultValue:{value:"'Submit'",computed:!1}},cancelLabel:{required:!1,tsType:{name:"string"},description:"",defaultValue:{value:"'Cancel'",computed:!1}},resetLabel:{required:!1,tsType:{name:"string"},description:"",defaultValue:{value:"'Reset'",computed:!1}},isSubmitting:{required:!1,tsType:{name:"boolean"},description:"",defaultValue:{value:"false",computed:!1}},className:{required:!1,tsType:{name:"string"},description:""},formClassName:{required:!1,tsType:{name:"string"},description:""},actionsClassName:{required:!1,tsType:{name:"string"},description:""},showActions:{required:!1,tsType:{name:"boolean"},description:"",defaultValue:{value:"true",computed:!1}},customActions:{required:!1,tsType:{name:"ReactReactNode",raw:"React.ReactNode"},description:""}}};export{Ve as F};
@@ -1,196 +0,0 @@
1
- import{j as a}from"./jsx-runtime-D_zvdyIk.js";import{S as t}from"./SectionBuilder-Df_lRZkj.js";import"./iframe-BWjPIle6.js";import"./preload-helper-Dp1pzeXC.js";import"./utils-D-KgF5mV.js";import"./card-BJpPOzP8.js";import"./separator-CxCWfpZX.js";import"./index-04C4iZwC.js";import"./index-C5eJ31Z3.js";import"./index-npvyVsxD.js";import"./index-BcAKBHrX.js";const D={title:"Kit/Builder/Section",component:t,parameters:{controls:{expanded:!0},backgrounds:{disable:!0}},render:n=>a.jsx(t,{...n})};function e(n,N){return a.jsx("div",{className:["rounded border p-3 text-sm",N].filter(Boolean).join(" "),children:n})}const I=[{key:"a",content:e("A"),span:{md:6}},{key:"b",content:e("B"),span:{md:6}},{key:"c",content:e("C"),span:{md:4}},{key:"d",content:e("D"),span:{md:4}},{key:"e",content:e("E"),span:{md:4}}],r={name:"Grid layout",args:{sections:[{id:"grid-1",title:"Grid (responsive spans)",subtitle:"Uses md column spans 6/6 then 4/4/4",variant:"card",layout:"grid",grid:{cols:1,mdCols:12,gap:"gap-4"},children:I}]},render:n=>a.jsx(t,{...n})},s={name:"Leaves with labels",args:{sections:[{id:"labels-1",title:"Label layouts",variant:"card",layout:"grid",grid:{cols:1,mdCols:12},children:[{key:"l1",label:"Inline label",labelLayout:"inline",inlineLabelWidthClass:"w-40",content:e("Value content inline"),span:{md:12}},{key:"l2",label:"Stacked label",labelLayout:"stacked",description:"Optional description appears under value",content:e("Value content stacked"),span:{md:6}},{key:"l3",label:"No description",labelLayout:"stacked",content:e("Another value"),span:{md:6}}]}]},render:n=>a.jsx(t,{...n})},o={name:"Flex layout",args:{sections:[{id:"flex-1",title:"Horizontal flex with wrap",variant:"card",layout:"flex",flex:{direction:"row",wrap:!0,gap:"gap-3",align:"start",justify:"start"},children:[{key:"f1",content:e("Item 1"),className:"w-56"},{key:"f2",content:e("Item 2"),className:"w-56"},{key:"f3",content:e("Item 3"),className:"w-56"},{key:"f4",content:e("Item 4"),className:"w-56"}]}]}},i={name:"Nested sections",args:{sections:[{id:"outer",title:"Outer section",variant:"card",layout:"grid",grid:{cols:1,mdCols:12},children:[{id:"inner-1",title:"Inner A",variant:"separator",layout:"grid",grid:{cols:1,mdCols:12},children:[{key:"ia",content:e("Inner A1"),span:{md:6}},{key:"ib",content:e("Inner A2"),span:{md:6}}]},{id:"inner-2",title:"Inner B",variant:"plain",layout:"grid",grid:{cols:1,mdCols:12},children:[{key:"ic",content:e("Inner B1"),span:{md:4}},{key:"id",content:e("Inner B2"),span:{md:4}},{key:"ie",content:e("Inner B3"),span:{md:4}}]}]}]},render:n=>a.jsx(t,{...n})},l={name:"Custom leaf renderer",args:{sections:[{id:"custom-1",title:"Custom renderer",layout:"grid",grid:{cols:1,mdCols:12},children:[{key:"x",label:"Name",labelLayout:"inline",content:"Jane Doe",span:{md:6}},{key:"y",label:"Email",labelLayout:"inline",content:"jane@example.com",span:{md:6}}]}],renderLeaf:n=>a.jsxs("div",{className:"rounded border p-3",children:[a.jsx("div",{className:"text-[10px] uppercase tracking-wide text-muted-foreground",children:n.label??"Field"}),a.jsx("div",{className:"text-sm",children:n.content})]})},render:n=>a.jsx(t,{...n})};var d,c,m;r.parameters={...r.parameters,docs:{...(d=r.parameters)==null?void 0:d.docs,source:{originalSource:`{
2
- name: 'Grid layout',
3
- args: {
4
- sections: [{
5
- id: 'grid-1',
6
- title: 'Grid (responsive spans)',
7
- subtitle: 'Uses md column spans 6/6 then 4/4/4',
8
- variant: 'card',
9
- layout: 'grid',
10
- grid: {
11
- cols: 1,
12
- mdCols: 12,
13
- gap: 'gap-4'
14
- },
15
- children: gridLeaves
16
- }] satisfies SectionNode[]
17
- },
18
- render: args => <SectionBuilder {...args} />
19
- }`,...(m=(c=r.parameters)==null?void 0:c.docs)==null?void 0:m.source}}};var p,u,y;s.parameters={...s.parameters,docs:{...(p=s.parameters)==null?void 0:p.docs,source:{originalSource:`{
20
- name: 'Leaves with labels',
21
- args: {
22
- sections: [{
23
- id: 'labels-1',
24
- title: 'Label layouts',
25
- variant: 'card',
26
- layout: 'grid',
27
- grid: {
28
- cols: 1,
29
- mdCols: 12
30
- },
31
- children: [{
32
- key: 'l1',
33
- label: 'Inline label',
34
- labelLayout: 'inline',
35
- inlineLabelWidthClass: 'w-40',
36
- content: demoBox('Value content inline'),
37
- span: {
38
- md: 12
39
- }
40
- }, {
41
- key: 'l2',
42
- label: 'Stacked label',
43
- labelLayout: 'stacked',
44
- description: 'Optional description appears under value',
45
- content: demoBox('Value content stacked'),
46
- span: {
47
- md: 6
48
- }
49
- }, {
50
- key: 'l3',
51
- label: 'No description',
52
- labelLayout: 'stacked',
53
- content: demoBox('Another value'),
54
- span: {
55
- md: 6
56
- }
57
- }]
58
- }] satisfies SectionNode[]
59
- },
60
- render: args => <SectionBuilder {...args} />
61
- }`,...(y=(u=s.parameters)==null?void 0:u.docs)==null?void 0:y.source}}};var g,x,b;o.parameters={...o.parameters,docs:{...(g=o.parameters)==null?void 0:g.docs,source:{originalSource:`{
62
- name: 'Flex layout',
63
- args: {
64
- sections: [{
65
- id: 'flex-1',
66
- title: 'Horizontal flex with wrap',
67
- variant: 'card',
68
- layout: 'flex',
69
- flex: {
70
- direction: 'row',
71
- wrap: true,
72
- gap: 'gap-3',
73
- align: 'start',
74
- justify: 'start'
75
- },
76
- children: [{
77
- key: 'f1',
78
- content: demoBox('Item 1'),
79
- className: 'w-56'
80
- }, {
81
- key: 'f2',
82
- content: demoBox('Item 2'),
83
- className: 'w-56'
84
- }, {
85
- key: 'f3',
86
- content: demoBox('Item 3'),
87
- className: 'w-56'
88
- }, {
89
- key: 'f4',
90
- content: demoBox('Item 4'),
91
- className: 'w-56'
92
- }]
93
- }] satisfies SectionNode[]
94
- }
95
- }`,...(b=(x=o.parameters)==null?void 0:x.docs)==null?void 0:b.source}}};var k,f,v;i.parameters={...i.parameters,docs:{...(k=i.parameters)==null?void 0:k.docs,source:{originalSource:`{
96
- name: 'Nested sections',
97
- args: {
98
- sections: [{
99
- id: 'outer',
100
- title: 'Outer section',
101
- variant: 'card',
102
- layout: 'grid',
103
- grid: {
104
- cols: 1,
105
- mdCols: 12
106
- },
107
- children: [{
108
- id: 'inner-1',
109
- title: 'Inner A',
110
- variant: 'separator',
111
- layout: 'grid',
112
- grid: {
113
- cols: 1,
114
- mdCols: 12
115
- },
116
- children: [{
117
- key: 'ia',
118
- content: demoBox('Inner A1'),
119
- span: {
120
- md: 6
121
- }
122
- }, {
123
- key: 'ib',
124
- content: demoBox('Inner A2'),
125
- span: {
126
- md: 6
127
- }
128
- }]
129
- }, {
130
- id: 'inner-2',
131
- title: 'Inner B',
132
- variant: 'plain',
133
- layout: 'grid',
134
- grid: {
135
- cols: 1,
136
- mdCols: 12
137
- },
138
- children: [{
139
- key: 'ic',
140
- content: demoBox('Inner B1'),
141
- span: {
142
- md: 4
143
- }
144
- }, {
145
- key: 'id',
146
- content: demoBox('Inner B2'),
147
- span: {
148
- md: 4
149
- }
150
- }, {
151
- key: 'ie',
152
- content: demoBox('Inner B3'),
153
- span: {
154
- md: 4
155
- }
156
- }]
157
- }]
158
- } as unknown as SectionNode]
159
- },
160
- render: args => <SectionBuilder {...args} />
161
- }`,...(v=(f=i.parameters)==null?void 0:f.docs)==null?void 0:v.source}}};var h,B,L;l.parameters={...l.parameters,docs:{...(h=l.parameters)==null?void 0:h.docs,source:{originalSource:`{
162
- name: 'Custom leaf renderer',
163
- args: {
164
- sections: [{
165
- id: 'custom-1',
166
- title: 'Custom renderer',
167
- layout: 'grid',
168
- grid: {
169
- cols: 1,
170
- mdCols: 12
171
- },
172
- children: [{
173
- key: 'x',
174
- label: 'Name',
175
- labelLayout: 'inline',
176
- content: 'Jane Doe',
177
- span: {
178
- md: 6
179
- }
180
- }, {
181
- key: 'y',
182
- label: 'Email',
183
- labelLayout: 'inline',
184
- content: 'jane@example.com',
185
- span: {
186
- md: 6
187
- }
188
- }]
189
- }] satisfies SectionNode[],
190
- renderLeaf: leaf => <div className="rounded border p-3">
191
- <div className="text-[10px] uppercase tracking-wide text-muted-foreground">{leaf.label ?? 'Field'}</div>
192
- <div className="text-sm">{leaf.content}</div>
193
- </div>
194
- },
195
- render: args => <SectionBuilder {...args} />
196
- }`,...(L=(B=l.parameters)==null?void 0:B.docs)==null?void 0:L.source}}};const R=["GridLayout","WithLabels","FlexLayout","NestedSections","CustomLeafRenderer"];export{l as CustomLeafRenderer,o as FlexLayout,r as GridLayout,i as NestedSections,s as WithLabels,R as __namedExportsOrder,D as default};
@@ -1 +0,0 @@
1
- import{j as e}from"./jsx-runtime-D_zvdyIk.js";import{r as C}from"./iframe-BWjPIle6.js";import{c}from"./utils-D-KgF5mV.js";import{C as f,a as y,b as v,d as S,c as L}from"./card-BJpPOzP8.js";import{S as b}from"./separator-CxCWfpZX.js";const m={base:{1:"grid-cols-1",2:"grid-cols-2",3:"grid-cols-3",4:"grid-cols-4",5:"grid-cols-5",6:"grid-cols-6",7:"grid-cols-7",8:"grid-cols-8",9:"grid-cols-9",10:"grid-cols-10",11:"grid-cols-11",12:"grid-cols-12"},sm:{1:"sm:grid-cols-1",2:"sm:grid-cols-2",3:"sm:grid-cols-3",4:"sm:grid-cols-4",5:"sm:grid-cols-5",6:"sm:grid-cols-6",7:"sm:grid-cols-7",8:"sm:grid-cols-8",9:"sm:grid-cols-9",10:"sm:grid-cols-10",11:"sm:grid-cols-11",12:"sm:grid-cols-12"},md:{1:"md:grid-cols-1",2:"md:grid-cols-2",3:"md:grid-cols-3",4:"md:grid-cols-4",5:"md:grid-cols-5",6:"md:grid-cols-6",7:"md:grid-cols-7",8:"md:grid-cols-8",9:"md:grid-cols-9",10:"md:grid-cols-10",11:"md:grid-cols-11",12:"md:grid-cols-12"},lg:{1:"lg:grid-cols-1",2:"lg:grid-cols-2",3:"lg:grid-cols-3",4:"lg:grid-cols-4",5:"lg:grid-cols-5",6:"lg:grid-cols-6",7:"lg:grid-cols-7",8:"lg:grid-cols-8",9:"lg:grid-cols-9",10:"lg:grid-cols-10",11:"lg:grid-cols-11",12:"lg:grid-cols-12"},xl:{1:"xl:grid-cols-1",2:"xl:grid-cols-2",3:"xl:grid-cols-3",4:"xl:grid-cols-4",5:"xl:grid-cols-5",6:"xl:grid-cols-6",7:"xl:grid-cols-7",8:"xl:grid-cols-8",9:"xl:grid-cols-9",10:"xl:grid-cols-10",11:"xl:grid-cols-11",12:"xl:grid-cols-12"}},o={base:{1:"col-span-1",2:"col-span-2",3:"col-span-3",4:"col-span-4",5:"col-span-5",6:"col-span-6",7:"col-span-7",8:"col-span-8",9:"col-span-9",10:"col-span-10",11:"col-span-11",12:"col-span-12"},sm:{1:"sm:col-span-1",2:"sm:col-span-2",3:"sm:col-span-3",4:"sm:col-span-4",5:"sm:col-span-5",6:"sm:col-span-6",7:"sm:col-span-7",8:"sm:col-span-8",9:"sm:col-span-9",10:"sm:col-span-10",11:"sm:col-span-11",12:"sm:col-span-12"},md:{1:"md:col-span-1",2:"md:col-span-2",3:"md:col-span-3",4:"md:col-span-4",5:"md:col-span-5",6:"md:col-span-6",7:"md:col-span-7",8:"md:col-span-8",9:"md:col-span-9",10:"md:col-span-10",11:"md:col-span-11",12:"md:col-span-12"},lg:{1:"lg:col-span-1",2:"lg:col-span-2",3:"lg:col-span-3",4:"lg:col-span-4",5:"lg:col-span-5",6:"lg:col-span-6",7:"lg:col-span-7",8:"lg:col-span-8",9:"lg:col-span-9",10:"lg:col-span-10",11:"lg:col-span-11",12:"lg:col-span-12"},xl:{1:"xl:col-span-1",2:"xl:col-span-2",3:"xl:col-span-3",4:"xl:col-span-4",5:"xl:col-span-5",6:"xl:col-span-6",7:"xl:col-span-7",8:"xl:col-span-8",9:"xl:col-span-9",10:"xl:col-span-10",11:"xl:col-span-11",12:"xl:col-span-12"}};function w(s){const l=(s==null?void 0:s.cols)??1,i=s==null?void 0:s.smCols,n=s==null?void 0:s.mdCols,t=s==null?void 0:s.lgCols,a=s==null?void 0:s.xlCols,r=(s==null?void 0:s.gap)??"gap-4";return c("grid",m.base[l],i?m.sm[i]:void 0,n?m.md[n]:void 0,t?m.lg[t]:void 0,a?m.xl[a]:void 0,r)}function R(s){const l=(s==null?void 0:s.direction)??"col",i=s!=null&&s.wrap?"flex-wrap":"flex-nowrap",n=(s==null?void 0:s.gap)??"gap-4",t=(s==null?void 0:s.align)??"stretch",a=(s==null?void 0:s.justify)??"start",r=t==="start"?"items-start":t==="center"?"items-center":t==="end"?"items-end":"items-stretch",d=a==="start"?"justify-start":a==="center"?"justify-center":a==="between"?"justify-between":"justify-end";return c("flex",`flex-${l}`,i,n,r,d)}function q(s){if(!s.span)return;const l=[];return s.span.base&&l.push(o.base[s.span.base]),s.span.sm&&l.push(o.sm[s.span.sm]),s.span.md&&l.push(o.md[s.span.md]),s.span.lg&&l.push(o.lg[s.span.lg]),s.span.xl&&l.push(o.xl[s.span.xl]),l.join(" ")}function E(s){return s.content!==void 0}function k(s,l){return s===l?!0:!s||!l?!s&&!l:s.base===l.base&&s.sm===l.sm&&s.md===l.md&&s.lg===l.lg&&s.xl===l.xl}function B(s,l){const i=(s.renderKey??null)===(l.renderKey??null);return s.key===l.key&&s.hidden===l.hidden&&s.className===l.className&&s.labelLayout===l.labelLayout&&s.labelClassName===l.labelClassName&&s.valueClassName===l.valueClassName&&s.inlineLabelWidthClass===l.inlineLabelWidthClass&&k(s.span,l.span)&&i}const T=C.memo(function({leaf:l,renderLeaf:i}){if(l.hidden)return null;const n=q(l);if(i)return e.jsx("div",{className:c(n,l.className),children:i(l)});const t=l.label!==void 0&&l.label!==null&&l.label!=="",a=l.labelLayout??"stacked",r="text-xs text-muted-foreground",d="text-sm leading-6";if(!t)return e.jsx("div",{className:c(n,l.className,l.valueClassName),children:l.content});if(a==="inline"){const g=l.inlineLabelWidthClass??"w-32";return e.jsxs("div",{className:c(n,l.className,"flex items-start gap-4"),children:[e.jsx("div",{className:c(g,r,l.labelClassName),children:l.label}),e.jsxs("div",{className:c("flex-1",d,l.valueClassName),children:[l.content,l.description?e.jsx("div",{className:c("mt-1",r),children:l.description}):null]})]})}return e.jsxs("div",{className:c(n,l.className,"flex flex-col"),children:[e.jsx("div",{className:c(r,l.labelClassName),children:l.label}),e.jsx("div",{className:c(d,l.valueClassName),children:l.content}),l.description?e.jsx("div",{className:c("mt-1",r),children:l.description}):null]})},(s,l)=>B(s.leaf,l.leaf)&&s.renderLeaf===l.renderLeaf);function N({node:s,renderLeaf:l}){if(s.hidden)return null;const n=(s.layout??"grid")==="grid"?w(s.grid):R(s.flex),t=({children:a})=>{const r=s.title,d=s.subtitle,g=s.variant??"card",u=s.className,h=s.headerClassName,j=s.contentClassName,p=()=>!r&&!d?null:e.jsxs("div",{className:c("space-y-1",h),children:[r&&e.jsx("h3",{className:"text-lg font-medium leading-none",children:r}),d&&e.jsx("p",{className:"text-sm text-muted-foreground",children:d})]}),x=()=>e.jsx("div",{className:c("space-y-4",j),children:a});switch(g){case"card":return e.jsxs(f,{className:u,children:[(r||d)&&e.jsxs(y,{children:[r&&e.jsx(v,{children:r}),d&&e.jsx(S,{children:d})]}),e.jsx(L,{className:c(!r&&!d&&"pt-6"),children:x()})]});case"separator":return e.jsxs("div",{className:c("space-y-6",u),children:[(r||d)&&e.jsxs(e.Fragment,{children:[p(),e.jsx(b,{})]}),x()]});case"plain":default:return e.jsxs("div",{className:c("space-y-6",u),children:[p(),x()]})}};return e.jsx(t,{children:e.jsx("div",{className:n,children:(s.children??[]).map(a=>E(a)?e.jsx(T,{leaf:a,renderLeaf:l},a.key):a.hidden?null:e.jsx("div",{className:"col-span-full",children:e.jsx(N,{node:a,renderLeaf:l})},a.id))})})}function W({sections:s,className:l,renderLeaf:i}){return e.jsx("div",{className:c("space-y-6",l),children:s.map(n=>e.jsx(N,{node:n,renderLeaf:i},n.id))})}W.__docgenInfo={description:"",methods:[],displayName:"SectionBuilder",props:{sections:{required:!0,tsType:{name:"Array",elements:[{name:"SectionNode"}],raw:"SectionNode[]"},description:""},renderLeaf:{required:!1,tsType:{name:"signature",type:"function",raw:"(leaf: SectionLeaf) => React.ReactNode",signature:{arguments:[{type:{name:"SectionLeaf"},name:"leaf"}],return:{name:"ReactReactNode",raw:"React.ReactNode"}}},description:""},className:{required:!1,tsType:{name:"string"},description:""}}};export{W as S};
@@ -1,18 +0,0 @@
1
- import{j as r}from"./jsx-runtime-D_zvdyIk.js";import{r as p}from"./iframe-BWjPIle6.js";import{T,t as a}from"./index-A7UzX-Xw.js";import{B as m}from"./button-BObfgcV1.js";import"./preload-helper-Dp1pzeXC.js";import"./index-C5eJ31Z3.js";import"./index-npvyVsxD.js";import"./index-BcAKBHrX.js";import"./index-CGrAONsN.js";import"./utils-D-KgF5mV.js";var E=(t,n,h,i,c,o,f,v)=>{let s=document.documentElement,g=["light","dark"];function l(e){(Array.isArray(t)?t:[t]).forEach(d=>{let y=d==="class",b=y&&o?c.map(S=>o[S]||S):c;y?(s.classList.remove(...b),s.classList.add(o&&o[e]?o[e]:e)):s.setAttribute(d,e)}),w(e)}function w(e){v&&g.includes(e)&&(s.style.colorScheme=e)}function j(){return window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}if(i)l(i);else try{let e=localStorage.getItem(n)||h,d=f&&e==="system"?j():e;l(d)}catch{}},N=p.createContext(void 0),U={setTheme:t=>{},themes:[]},_=()=>{var t;return(t=p.useContext(N))!=null?t:U};p.memo(({forcedTheme:t,storageKey:n,attribute:h,enableSystem:i,enableColorScheme:c,defaultTheme:o,value:f,themes:v,nonce:s,scriptProps:g})=>{let l=JSON.stringify([h,n,o,t,v,f,i,c]).slice(1,-1);return p.createElement("script",{...g,suppressHydrationWarning:!0,nonce:typeof window>"u"?s:"",dangerouslySetInnerHTML:{__html:`(${E.toString()})(${l})`}})});const x=({...t})=>{const{theme:n="system"}=_();return r.jsx(T,{theme:n,className:"toaster group",style:{"--normal-bg":"var(--popover)","--normal-text":"var(--popover-foreground)","--normal-border":"var(--border)"},...t})};x.__docgenInfo={description:"",methods:[],displayName:"Toaster"};const R={title:"Shadcn/UI/Sonner",component:x},u={render:()=>r.jsxs("div",{className:"space-y-3",children:[r.jsx(x,{richColors:!0,position:"top-right"}),r.jsxs("div",{className:"flex flex-wrap gap-2",children:[r.jsx(m,{onClick:()=>a("Hello from Sonner!"),children:"Default"}),r.jsx(m,{variant:"secondary",onClick:()=>a.success("Saved successfully"),children:"Success"}),r.jsx(m,{variant:"destructive",onClick:()=>a.error("Something went wrong"),children:"Error"}),r.jsx(m,{variant:"outline",onClick:()=>a("Action required",{action:{label:"Undo",onClick:()=>a("Undone")}}),children:"With action"})]})]})};var C,k,B;u.parameters={...u.parameters,docs:{...(C=u.parameters)==null?void 0:C.docs,source:{originalSource:`{
2
- render: () => <div className="space-y-3">
3
- <Toaster richColors position="top-right" />
4
- <div className="flex flex-wrap gap-2">
5
- <Button onClick={() => toast('Hello from Sonner!')}>Default</Button>
6
- <Button variant="secondary" onClick={() => toast.success('Saved successfully')}>Success</Button>
7
- <Button variant="destructive" onClick={() => toast.error('Something went wrong')}>Error</Button>
8
- <Button variant="outline" onClick={() => toast('Action required', {
9
- action: {
10
- label: 'Undo',
11
- onClick: () => toast('Undone')
12
- }
13
- })}>
14
- With action
15
- </Button>
16
- </div>
17
- </div>
18
- }`,...(B=(k=u.parameters)==null?void 0:k.docs)==null?void 0:B.source}}};const z=["Basic"];export{u as Basic,z as __namedExportsOrder,R as default};
@@ -1,3 +0,0 @@
1
- import{j as t}from"./jsx-runtime-D_zvdyIk.js";import{r as s}from"./iframe-BWjPIle6.js";import{c as U}from"./index-DW48STyt.js";import{u as _}from"./index-BcAKBHrX.js";import{c as z}from"./index-Pk2lGsul.js";import{u as A}from"./index-7XoYQV2z.js";import{u as O}from"./index-Dqw7miiX.js";import{u as q}from"./index-DMk2qc2_.js";import{P as N}from"./index-04C4iZwC.js";import{c as y}from"./utils-D-KgF5mV.js";import"./preload-helper-Dp1pzeXC.js";import"./index-DWC9SV-P.js";import"./index-C5eJ31Z3.js";import"./index-npvyVsxD.js";var b="Switch",[F,de]=z(b),[L,W]=F(b),R=s.forwardRef((e,r)=>{const{__scopeSwitch:o,name:n,checked:a,defaultChecked:w,required:d,disabled:c,value:l="on",onCheckedChange:S,form:i,...x}=e,[u,p]=s.useState(null),k=_(r,h=>p(h)),g=s.useRef(!1),C=u?i||!!u.closest("form"):!0,[m,D]=A({prop:a,defaultProp:w??!1,onChange:S,caller:b});return t.jsxs(L,{scope:o,checked:m,disabled:c,children:[t.jsx(N.button,{type:"button",role:"switch","aria-checked":m,"aria-required":d,"data-state":M(m),"data-disabled":c?"":void 0,disabled:c,value:l,...x,ref:k,onClick:U(e.onClick,h=>{D(H=>!H),C&&(g.current=h.isPropagationStopped(),g.current||h.stopPropagation())})}),C&&t.jsx(T,{control:u,bubbles:!g.current,name:n,value:l,checked:m,required:d,disabled:c,form:i,style:{transform:"translateX(-100%)"}})]})});R.displayName=b;var B="SwitchThumb",I=s.forwardRef((e,r)=>{const{__scopeSwitch:o,...n}=e,a=W(B,o);return t.jsx(N.span,{"data-state":M(a.checked),"data-disabled":a.disabled?"":void 0,...n,ref:r})});I.displayName=B;var X="SwitchBubbleInput",T=s.forwardRef(({__scopeSwitch:e,control:r,checked:o,bubbles:n=!0,...a},w)=>{const d=s.useRef(null),c=_(d,w),l=O(o),S=q(r);return s.useEffect(()=>{const i=d.current;if(!i)return;const x=window.HTMLInputElement.prototype,p=Object.getOwnPropertyDescriptor(x,"checked").set;if(l!==o&&p){const k=new Event("click",{bubbles:n});p.call(i,o),i.dispatchEvent(k)}},[l,o,n]),t.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:o,...a,tabIndex:-1,ref:c,style:{...a.style,...S,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});T.displayName=X;function M(e){return e?"checked":"unchecked"}var $=R,G=I;function v({className:e,...r}){return t.jsx($,{"data-slot":"switch",className:y("peer data-[state=checked]:bg-primary data-[state=unchecked]:bg-input focus-visible:border-ring focus-visible:ring-ring/50 dark:data-[state=unchecked]:bg-input/80 inline-flex h-[1.15rem] w-8 shrink-0 items-center rounded-full border border-transparent shadow-xs transition-all outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50",e),...r,children:t.jsx(G,{"data-slot":"switch-thumb",className:y("bg-background dark:data-[state=unchecked]:bg-foreground dark:data-[state=checked]:bg-primary-foreground pointer-events-none block size-4 rounded-full ring-0 transition-transform data-[state=checked]:translate-x-[calc(100%-2px)] data-[state=unchecked]:translate-x-0")})})}v.__docgenInfo={description:"",methods:[],displayName:"Switch"};const le={title:"Shadcn/UI/Switch",component:v};function J(){const[e,r]=s.useState(!1);return t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx(v,{checked:e,onCheckedChange:r,id:"demo-switch"}),t.jsx("label",{htmlFor:"demo-switch",className:"text-sm",children:e?"Enabled":"Disabled"})]})}const f={render:()=>t.jsx(J,{})};var E,j,P;f.parameters={...f.parameters,docs:{...(E=f.parameters)==null?void 0:E.docs,source:{originalSource:`{
2
- render: () => <SwitchDemo />
3
- }`,...(P=(j=f.parameters)==null?void 0:j.docs)==null?void 0:P.source}}};const ue=["Basic"];export{f as Basic,ue as __namedExportsOrder,le as default};