@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.
- package/dist/index.js +18655 -16777
- package/dist/kit/builder/data-table/components/DataTable.d.ts +2 -2
- package/dist/kit/builder/data-table/components/DataTable.d.ts.map +1 -1
- package/dist/kit/builder/form/components/FormBuilder.d.ts +42 -14
- package/dist/kit/builder/form/components/FormBuilder.d.ts.map +1 -1
- package/dist/kit/builder/form/components/FormBuilderField.d.ts.map +1 -1
- package/dist/kit/builder/form/components/fields/AutocompleteField.d.ts.map +1 -1
- package/dist/kit/builder/form/components/fields/DatePickerField.d.ts +3 -0
- package/dist/kit/builder/form/components/fields/DatePickerField.d.ts.map +1 -0
- package/dist/kit/builder/form/components/fields/DateRangePickerField.d.ts +3 -0
- package/dist/kit/builder/form/components/fields/DateRangePickerField.d.ts.map +1 -0
- package/dist/kit/builder/form/components/fields/MonthPickerField.d.ts +3 -0
- package/dist/kit/builder/form/components/fields/MonthPickerField.d.ts.map +1 -0
- package/dist/kit/builder/form/components/fields/MonthRangePickerField.d.ts +3 -0
- package/dist/kit/builder/form/components/fields/MonthRangePickerField.d.ts.map +1 -0
- package/dist/kit/builder/form/components/fields/index.d.ts +4 -0
- package/dist/kit/builder/form/components/fields/index.d.ts.map +1 -1
- package/dist/kit/builder/section/SectionBuilder.d.ts.map +1 -1
- package/dist/kit/builder/section/types.d.ts +12 -1
- package/dist/kit/builder/section/types.d.ts.map +1 -1
- package/dist/kit/builder/stack-dialog/context.d.ts +3 -0
- package/dist/kit/builder/stack-dialog/context.d.ts.map +1 -0
- package/dist/kit/builder/stack-dialog/hooks.d.ts +6 -0
- package/dist/kit/builder/stack-dialog/hooks.d.ts.map +1 -0
- package/dist/kit/builder/stack-dialog/index.d.ts +5 -0
- package/dist/kit/builder/stack-dialog/index.d.ts.map +1 -0
- package/dist/kit/builder/stack-dialog/provider.d.ts +3 -0
- package/dist/kit/builder/stack-dialog/provider.d.ts.map +1 -0
- package/dist/kit/builder/stack-dialog/renderer.d.ts +6 -0
- package/dist/kit/builder/stack-dialog/renderer.d.ts.map +1 -0
- package/dist/kit/builder/stack-dialog/types.d.ts +20 -0
- package/dist/kit/builder/stack-dialog/types.d.ts.map +1 -0
- package/dist/kit/components/autocomplete/Autocomplete.d.ts +35 -3
- package/dist/kit/components/autocomplete/Autocomplete.d.ts.map +1 -1
- package/dist/kit/components/autocomplete/index.d.ts +1 -0
- package/dist/kit/components/autocomplete/index.d.ts.map +1 -1
- package/dist/kit/components/datepicker/DatePicker.d.ts +27 -0
- package/dist/kit/components/datepicker/DatePicker.d.ts.map +1 -0
- package/dist/kit/components/datepicker/DateRangePicker.d.ts +41 -0
- package/dist/kit/components/datepicker/DateRangePicker.d.ts.map +1 -0
- package/dist/kit/components/monthpicker/MonthInput.d.ts +26 -0
- package/dist/kit/components/monthpicker/MonthInput.d.ts.map +1 -0
- package/dist/kit/components/monthpicker/MonthPicker.d.ts +32 -0
- package/dist/kit/components/monthpicker/MonthPicker.d.ts.map +1 -0
- package/dist/kit/components/monthpicker/MonthRangeInput.d.ts +31 -0
- package/dist/kit/components/monthpicker/MonthRangeInput.d.ts.map +1 -0
- package/dist/kit/components/monthpicker/MonthRangePicker.d.ts +48 -0
- package/dist/kit/components/monthpicker/MonthRangePicker.d.ts.map +1 -0
- package/dist/kit/themes/clean-slate.css +165 -1
- package/dist/kit/themes/default.css +165 -1
- package/dist/kit/themes/minimal-modern.css +165 -1
- package/dist/kit/themes/spotify.css +165 -1
- package/package.json +1 -1
- package/src/kit/builder/data-table/components/DataTable.tsx +9 -9
- package/src/kit/builder/form/components/FormBuilder.tsx +363 -145
- package/src/kit/builder/form/components/FormBuilderField.tsx +52 -3
- package/src/kit/builder/form/components/fields/AutocompleteField.tsx +29 -1
- package/src/kit/builder/form/components/fields/DatePickerField.tsx +24 -0
- package/src/kit/builder/form/components/fields/DateRangePickerField.tsx +41 -0
- package/src/kit/builder/form/components/fields/MonthPickerField.tsx +26 -0
- package/src/kit/builder/form/components/fields/MonthRangePickerField.tsx +35 -0
- package/src/kit/builder/form/components/fields/index.ts +4 -0
- package/src/kit/builder/section/SectionBuilder.tsx +24 -2
- package/src/kit/builder/section/types.ts +15 -1
- package/src/kit/builder/stack-dialog/context.ts +9 -0
- package/src/kit/builder/stack-dialog/hooks.ts +11 -0
- package/src/kit/builder/stack-dialog/index.ts +13 -0
- package/src/kit/builder/stack-dialog/provider.tsx +55 -0
- package/src/kit/builder/stack-dialog/renderer.tsx +33 -0
- package/src/kit/builder/stack-dialog/types.ts +22 -0
- package/src/kit/components/autocomplete/Autocomplete.tsx +783 -233
- package/src/kit/components/autocomplete/index.ts +1 -0
- package/src/kit/components/datepicker/DatePicker.tsx +149 -0
- package/src/kit/components/datepicker/DateRangePicker.tsx +454 -0
- package/src/kit/components/monthpicker/MonthInput.tsx +122 -0
- package/src/kit/components/monthpicker/MonthPicker.tsx +223 -0
- package/src/kit/components/monthpicker/MonthRangeInput.tsx +132 -0
- package/src/kit/components/monthpicker/MonthRangePicker.tsx +407 -0
- package/src/stories/kit/builder/Form.Autocomplete.stories.tsx +210 -0
- package/src/stories/kit/builder/Form.Complex.stories.tsx +101 -0
- package/src/stories/kit/builder/Form.Dynamic.stories.tsx +149 -0
- package/src/stories/kit/builder/Form.Pickers.stories.tsx +71 -0
- package/src/stories/kit/builder/Section.stories.tsx +58 -2
- package/src/stories/kit/components/Autocomplete.stories.tsx +27 -0
- package/src/stories/kit/components/DatePicker.stories.tsx +128 -0
- package/src/stories/kit/components/DateRangePicker.stories.tsx +154 -0
- package/src/stories/kit/components/MonthPicker.stories.tsx +80 -0
- package/src/stories/kit/components/MonthRangePicker.stories.tsx +98 -0
- package/storybook-static/assets/{Accordion.stories-q6yg6wg1.js → Accordion.stories-KU4JBR8U.js} +1 -1
- package/storybook-static/assets/{AdminLayout-B9bV4J_6.js → AdminLayout-CPvVCwfY.js} +10 -10
- package/storybook-static/assets/AdminLayout.Basic.stories-DkP2UVXe.js +4 -0
- package/storybook-static/assets/AdminLayout.Collapsible.stories-BuuVjtpW.js +4 -0
- package/storybook-static/assets/AdminLayout.Complex.stories-D-k4H0hJ.js +29 -0
- package/storybook-static/assets/AdminLayout.CustomSidebarHeaderComponent.stories-B_0IEDd4.js +9 -0
- package/storybook-static/assets/AdminLayout.CustomSidebarTitleAndIcon.stories-CvAeXUyA.js +4 -0
- package/storybook-static/assets/AdminLayout.HeaderSlots.stories-RBFHoSZK.js +7 -0
- package/storybook-static/assets/{Alert.stories-DXwNfJ3w.js → Alert.stories-DKxKtIc0.js} +1 -1
- package/storybook-static/assets/{AlertDialog.stories-I324NsnP.js → AlertDialog.stories-BqTpZ_nG.js} +1 -1
- package/storybook-static/assets/{AspectRatio.stories-CghHiX3Z.js → AspectRatio.stories-DPO9QQ5F.js} +1 -1
- package/storybook-static/assets/Autocomplete-Cpg4CaJe.js +56 -0
- package/storybook-static/assets/Autocomplete.stories-CWj4G5fh.js +56 -0
- package/storybook-static/assets/{Avatar.stories-CEF5FVSR.js → Avatar.stories-DPhov_2g.js} +1 -1
- package/storybook-static/assets/Badge.stories-DFKrRdXq.js +12 -0
- package/storybook-static/assets/{Breadcrumb.stories-DORe9T4b.js → Breadcrumb.stories-CTE6CZUC.js} +1 -1
- package/storybook-static/assets/{Button.stories-3nQ6wsBX.js → Button.stories-cbt2InL-.js} +1 -1
- package/storybook-static/assets/{Calendar.stories-Dn__djE1.js → Calendar.stories-DRhTw_43.js} +1 -1
- package/storybook-static/assets/{Card.stories-BJcbdwCI.js → Card.stories-Isf6n_K3.js} +1 -1
- package/storybook-static/assets/{Carousel.stories-CfqbE7Va.js → Carousel.stories-Cmg0I3fR.js} +1 -1
- package/storybook-static/assets/{Chart.stories-cGgef3tv.js → Chart.stories-aQ-fNijT.js} +1 -1
- package/storybook-static/assets/{Checkbox.stories-BcaxWzCS.js → Checkbox.stories-B7YMXPDc.js} +1 -1
- package/storybook-static/assets/{Collapsible.stories-CQ95s7Cs.js → Collapsible.stories-BUzl17ZZ.js} +1 -1
- package/storybook-static/assets/{Combination-CeVus13L.js → Combination-BdQWAuko.js} +1 -1
- package/storybook-static/assets/{Command.stories-DYflJh8u.js → Command.stories-DzBlWQs0.js} +1 -1
- package/storybook-static/assets/{ContextMenu.stories-CU7ehYrE.js → ContextMenu.stories-CJlBQyXc.js} +1 -1
- package/storybook-static/assets/DataTable.Basic.stories-BWYKFDmK.js +6 -0
- package/storybook-static/assets/DataTable.Filters.stories-uZdtJk8t.js +21 -0
- package/storybook-static/assets/DataTable.Pagination.stories-C5N1khkp.js +24 -0
- package/storybook-static/assets/DataTable.SelectionAndActions.stories-FhCqZKvO.js +26 -0
- package/storybook-static/assets/DataTable.Sorting.stories-D-k7EtRj.js +6 -0
- package/storybook-static/assets/{Dialog.stories-DobNZ0Hp.js → Dialog.stories-C62AF-Gx.js} +1 -1
- package/storybook-static/assets/{Dialog.stories-Bu6ZJXNH.js → Dialog.stories-lrjRwOus.js} +1 -1
- package/storybook-static/assets/{Drawer.stories-BN0idp4u.js → Drawer.stories-CGjkdJeV.js} +1 -1
- package/storybook-static/assets/{DropdownMenu.stories-sfsVDTvm.js → DropdownMenu.stories-DkGClRAA.js} +1 -1
- package/storybook-static/assets/Form.ArrayLayouts.stories-C5d_062d.js +130 -0
- package/storybook-static/assets/Form.Autocomplete.stories-CPZPkk4o.js +142 -0
- package/storybook-static/assets/Form.Basic.stories-Bhcu3-3n.js +58 -0
- package/storybook-static/assets/Form.Complex.stories-QnXh5a7Q.js +361 -0
- package/storybook-static/assets/Form.Dynamic.stories-DFW6wIuT.js +502 -0
- package/storybook-static/assets/Form.Simple.stories-BhJcyhbE.js +53 -0
- package/storybook-static/assets/{Form.stories-27doU7JS.js → Form.stories-PFNsMYxO.js} +1 -1
- package/storybook-static/assets/FormBuilder-BQBBxo_k.js +5 -0
- package/storybook-static/assets/{HoverCard.stories-0lted9Zx.js → HoverCard.stories-CAlQEVn8.js} +1 -1
- package/storybook-static/assets/{Input.stories-CwsIObFs.js → Input.stories-CEhODt0V.js} +1 -1
- package/storybook-static/assets/{InputOtp.stories-DVc086h4.js → InputOtp.stories-DSvNP4dS.js} +1 -1
- package/storybook-static/assets/{Label.stories-bJa0rk1A.js → Label.stories-B3pa8ZLY.js} +1 -1
- package/storybook-static/assets/{Login.stories-C6X6Kj5B.js → Login.stories-C7KQkmR_.js} +5 -5
- package/storybook-static/assets/{Menubar.stories-CuediVp7.js → Menubar.stories-CHXhSHxc.js} +1 -1
- package/storybook-static/assets/MonthPicker.stories-BnrOc4fm.js +99 -0
- package/storybook-static/assets/MonthRangePicker.stories-55Gk1t-7.js +134 -0
- package/storybook-static/assets/{NavigationMenu.stories-CKGZYhKk.js → NavigationMenu.stories-CXoS080P.js} +1 -1
- package/storybook-static/assets/{Page.stories-Cf76wtRx.js → Page.stories-GdSJgZ6-.js} +1 -1
- package/storybook-static/assets/{Pagination.stories-D7IdL1_4.js → Pagination.stories-BEBwqH4N.js} +1 -1
- package/storybook-static/assets/{Popover.stories-1VP_zNY8.js → Popover.stories-BICy98Cw.js} +1 -1
- package/storybook-static/assets/{Progress.stories-C35R5YvA.js → Progress.stories-DECHNOME.js} +1 -1
- package/storybook-static/assets/{RadioGroup.stories-CjuD3CwD.js → RadioGroup.stories-DA7-uKfV.js} +1 -1
- package/storybook-static/assets/{Resizable.stories-Cs8dvdc5.js → Resizable.stories-B99kWkH7.js} +1 -1
- package/storybook-static/assets/{ScrollArea.stories-D6_z-5jm.js → ScrollArea.stories-BqvUAXqU.js} +1 -1
- package/storybook-static/assets/Section.stories-lFMlFBQn.js +277 -0
- package/storybook-static/assets/SectionBuilder-BQW705x0.js +1 -0
- package/storybook-static/assets/{Select.stories-w_kbza5k.js → Select.stories-BsKyZ6Io.js} +1 -1
- package/storybook-static/assets/{Separator.stories-B5QnaJXb.js → Separator.stories-BTDOaOM2.js} +1 -1
- package/storybook-static/assets/{Sheet.stories-CORnEGvV.js → Sheet.stories-Cam1gR6G.js} +1 -1
- package/storybook-static/assets/{Sidebar.stories-DVuWTi4j.js → Sidebar.stories-DnOa6G7y.js} +1 -1
- package/storybook-static/assets/{Slider.stories-YoS2vvT2.js → Slider.stories-Bslq7hjq.js} +1 -1
- package/storybook-static/assets/Sonner.stories-D34pBBtI.js +18 -0
- package/storybook-static/assets/Switch.stories-Puyb1-Bx.js +3 -0
- package/storybook-static/assets/{Table.stories-BuGU4MUM.js → Table.stories-ClZxAhut.js} +1 -1
- package/storybook-static/assets/Tabs.stories-CURNTETB.js +10 -0
- package/storybook-static/assets/{Textarea.stories-CHXVobz6.js → Textarea.stories-Cf1ZBrWw.js} +1 -1
- package/storybook-static/assets/{Toggle.stories-C4uB4Hkq.js → Toggle.stories-CdMHY_bi.js} +1 -1
- package/storybook-static/assets/{ToggleGroup.stories-Cr229wf_.js → ToggleGroup.stories-BM68m1dX.js} +1 -1
- package/storybook-static/assets/{Tooltip.stories-DmMYGR3T.js → Tooltip.stories-DiQv64dM.js} +1 -1
- package/storybook-static/assets/{accordion-BCfsz_gl.js → accordion-DVgwQcnw.js} +1 -1
- package/storybook-static/assets/{alert-dialog-BYt6Z7Kt.js → alert-dialog-DCUEwpqm.js} +1 -1
- package/storybook-static/assets/{avatar-CRn1qQsC.js → avatar-BzwOE-mi.js} +1 -1
- package/storybook-static/assets/{axe-JCJl60WC.js → axe-HmUsR1st.js} +1 -1
- package/storybook-static/assets/badge-BnQWua6u.js +1 -0
- package/storybook-static/assets/{button-BObfgcV1.js → button-0oMkiryo.js} +1 -1
- package/storybook-static/assets/{chart-column-CplFCmg8.js → chart-column-DZGb4ZZS.js} +1 -1
- package/storybook-static/assets/{check-DyecuwP4.js → check-B9hBGj6o.js} +1 -1
- package/storybook-static/assets/{checkbox-D5BmNJeL.js → checkbox-CyIeaWHX.js} +1 -1
- package/storybook-static/assets/{chevron-down-Bp7zbUB0.js → chevron-down-D_37S6il.js} +1 -1
- package/storybook-static/assets/{chevron-left-D1L4J3UW.js → chevron-left-BBoN0vbI.js} +1 -1
- package/storybook-static/assets/{chevron-right-oMYqDJ_f.js → chevron-right-B5vIMLxK.js} +1 -1
- package/storybook-static/assets/{circle-CyarsADt.js → circle-C5Lzx6Nx.js} +1 -1
- package/storybook-static/assets/clean-slate-D1HmMFJM.css +1 -0
- package/storybook-static/assets/{command-DCnXmNmT.js → command-Csa9p8_a.js} +1 -1
- package/storybook-static/assets/{createLucideIcon-CLBo0iA0.js → createLucideIcon-BrHXro7t.js} +1 -1
- package/storybook-static/assets/default-CN_Fo1GY.css +1 -0
- package/storybook-static/assets/{dialog-DL0QBIbC.js → dialog-CsnqITTn.js} +1 -1
- package/storybook-static/assets/{dropdown-menu-BwL9gQwG.js → dropdown-menu-BWxxwPHL.js} +1 -1
- package/storybook-static/assets/{ellipsis-DPg968Rc.js → ellipsis-BRS038RR.js} +1 -1
- package/storybook-static/assets/{grip-vertical-CM0GDwvq.js → grip-vertical-BxXG8KNA.js} +1 -1
- package/storybook-static/assets/{iframe-BWjPIle6.js → iframe-v7iAhKit.js} +219 -219
- package/storybook-static/assets/{index-DschQYGl.js → index-0-qMRXou.js} +1 -1
- package/storybook-static/assets/{index-CKwUGXmt.js → index-AvwFFKJc.js} +1 -1
- package/storybook-static/assets/{index-BfKpUbCE.js → index-BVDb4dFc.js} +1 -1
- package/storybook-static/assets/{index-Dr2xmx-F.js → index-B_qx7A5T.js} +1 -1
- package/storybook-static/assets/index-BfiCOk42.js +1 -0
- package/storybook-static/assets/{index-C9xvlw_B.js → index-Bv9yk470.js} +1 -1
- package/storybook-static/assets/{index-DMk2qc2_.js → index-Bw1A27Kp.js} +1 -1
- package/storybook-static/assets/{index-7XoYQV2z.js → index-ByqivBWx.js} +1 -1
- package/storybook-static/assets/{index-URSssr5a.js → index-C9Ta0ZTH.js} +1 -1
- package/storybook-static/assets/{index-Pk2lGsul.js → index-CDY5kTx5.js} +1 -1
- package/storybook-static/assets/{index-3zykFCgl.js → index-CGnyVRgB.js} +1 -1
- package/storybook-static/assets/{index-Cw7p-pms.js → index-CWjrGFAQ.js} +1 -1
- package/storybook-static/assets/{index-npvyVsxD.js → index-CwBdPBFz.js} +1 -1
- package/storybook-static/assets/index-D8RXF03I.js +1 -0
- package/storybook-static/assets/{index-DE2OlfDP.js → index-DLIxT4Z7.js} +1 -1
- package/storybook-static/assets/{index-BcAKBHrX.js → index-DbaA6-o1.js} +1 -1
- package/storybook-static/assets/index-Dph_5COR.js +1 -0
- package/storybook-static/assets/index-DrN5n71E.js +1 -0
- package/storybook-static/assets/{index-04C4iZwC.js → index-Tp9IdbR8.js} +1 -1
- package/storybook-static/assets/{index-Dsg7S8zu.js → index-WyF3-wTE.js} +1 -1
- package/storybook-static/assets/{index-A7UzX-Xw.js → index-XSmPROEP.js} +1 -1
- package/storybook-static/assets/{index-u70nzfOV.js → index-Z6wF44KX.js} +1 -1
- package/storybook-static/assets/{index-Dqw7miiX.js → index-_RPqOjlQ.js} +1 -1
- package/storybook-static/assets/{index-Cce91yJQ.js → index-jrimW4QO.js} +1 -1
- package/storybook-static/assets/{index-C6O7WofA.js → index-nqc17SX4.js} +1 -1
- package/storybook-static/assets/{label-CwntpYJ0.js → label-Do8ODIVk.js} +1 -1
- package/storybook-static/assets/lodash-DDwpuhPG.js +73 -0
- package/storybook-static/assets/minimal-modern-BlYVzfQU.css +1 -0
- package/storybook-static/assets/{popover-ClqrrvjL.js → popover-CcciSWAw.js} +1 -1
- package/storybook-static/assets/{radio-group-CvN0LQZp.js → radio-group-DiJ0Y_KQ.js} +1 -1
- package/storybook-static/assets/{react-18-Bj31y5Nr.js → react-18-Cr9fq_Ip.js} +1 -1
- package/storybook-static/assets/{react-icons.esm-DNr9VcvP.js → react-icons.esm-B_ULMmNU.js} +1 -1
- package/storybook-static/assets/{refresh-cw-OZakDsFY.js → refresh-cw-BmRDhIV_.js} +1 -1
- package/storybook-static/assets/{schemas-CaLvKjsI.js → schemas-CGNYCiJ6.js} +3 -3
- package/storybook-static/assets/{section-factories-DKfKL-5s.js → section-factories-DCCY9R35.js} +1 -1
- package/storybook-static/assets/{select-gtXRB92c.js → select-DDrkxaOg.js} +1 -1
- package/storybook-static/assets/{separator-CxCWfpZX.js → separator-o5SAUnaJ.js} +1 -1
- package/storybook-static/assets/{settings-2-DSSkfF6W.js → settings-2-xWGvvbG6.js} +1 -1
- package/storybook-static/assets/{sheet-r0VNiBiN.js → sheet-C7jhU3XE.js} +1 -1
- package/storybook-static/assets/{shopping-cart-CJBClF2m.js → shopping-cart-BFlrufvo.js} +1 -1
- package/storybook-static/assets/{sidebar-BsMnOE7Y.js → sidebar-C8hU1Mxy.js} +1 -1
- package/storybook-static/assets/spotify-CUDj7g8m.css +1 -0
- package/storybook-static/assets/switch-CKGRuk3u.js +1 -0
- package/storybook-static/assets/tabs-CopK2m3j.js +1 -0
- package/storybook-static/assets/{toggle-D08-8sQA.js → toggle-DmHbWetf.js} +1 -1
- package/storybook-static/assets/{tooltip-CZ1UAE_e.js → tooltip-_LqYEYFw.js} +1 -1
- package/storybook-static/assets/{trash-2-D55eseMQ.js → trash-2-xdbApPby.js} +1 -1
- package/storybook-static/assets/{x-n8sFtlI2.js → x-B1a4fyWM.js} +1 -1
- package/storybook-static/iframe.html +1 -1
- package/storybook-static/index.json +1 -1
- package/storybook-static/kit/builder/data-table/components/DataTable.d.ts +6 -3
- package/storybook-static/kit/builder/data-table/components/DataTable.d.ts.map +1 -1
- package/storybook-static/kit/builder/data-table/index.d.ts +6 -5
- package/storybook-static/kit/builder/data-table/index.d.ts.map +1 -1
- package/storybook-static/kit/builder/form/components/FormBuilder.d.ts +53 -13
- package/storybook-static/kit/builder/form/components/FormBuilder.d.ts.map +1 -1
- package/storybook-static/kit/builder/form/components/FormBuilderField.d.ts +5 -5
- package/storybook-static/kit/builder/form/components/FormBuilderField.d.ts.map +1 -1
- package/storybook-static/kit/builder/form/components/fields/ArrayField.d.ts +3 -0
- package/storybook-static/kit/builder/form/components/fields/ArrayField.d.ts.map +1 -0
- package/storybook-static/kit/builder/form/components/fields/AutocompleteField.d.ts +3 -0
- package/storybook-static/kit/builder/form/components/fields/AutocompleteField.d.ts.map +1 -0
- package/storybook-static/kit/builder/form/components/fields/CheckboxField.d.ts +3 -0
- package/storybook-static/kit/builder/form/components/fields/CheckboxField.d.ts.map +1 -0
- package/storybook-static/kit/builder/form/components/fields/DateField.d.ts +3 -0
- package/storybook-static/kit/builder/form/components/fields/DateField.d.ts.map +1 -0
- package/storybook-static/kit/builder/form/components/fields/FileField.d.ts +3 -0
- package/storybook-static/kit/builder/form/components/fields/FileField.d.ts.map +1 -0
- package/storybook-static/kit/builder/form/components/fields/NumberField.d.ts +3 -0
- package/storybook-static/kit/builder/form/components/fields/NumberField.d.ts.map +1 -0
- package/storybook-static/kit/builder/form/components/fields/ObjectField.d.ts +3 -0
- package/storybook-static/kit/builder/form/components/fields/ObjectField.d.ts.map +1 -0
- package/storybook-static/kit/builder/form/components/fields/RadioField.d.ts +3 -0
- package/storybook-static/kit/builder/form/components/fields/RadioField.d.ts.map +1 -0
- package/storybook-static/kit/builder/form/components/fields/SelectField.d.ts +3 -0
- package/storybook-static/kit/builder/form/components/fields/SelectField.d.ts.map +1 -0
- package/storybook-static/kit/builder/form/components/fields/SwitchField.d.ts +3 -0
- package/storybook-static/kit/builder/form/components/fields/SwitchField.d.ts.map +1 -0
- package/storybook-static/kit/builder/form/components/fields/TextField.d.ts +3 -0
- package/storybook-static/kit/builder/form/components/fields/TextField.d.ts.map +1 -0
- package/storybook-static/kit/builder/form/components/fields/TextareaField.d.ts +3 -0
- package/storybook-static/kit/builder/form/components/fields/TextareaField.d.ts.map +1 -0
- package/storybook-static/kit/builder/form/components/fields/index.d.ts +14 -0
- package/storybook-static/kit/builder/form/components/fields/index.d.ts.map +1 -0
- package/storybook-static/kit/builder/form/components/fields/types.d.ts +14 -0
- package/storybook-static/kit/builder/form/components/fields/types.d.ts.map +1 -0
- package/storybook-static/kit/builder/form/utils/field-factories.d.ts +1 -0
- package/storybook-static/kit/builder/form/utils/field-factories.d.ts.map +1 -1
- package/storybook-static/kit/builder/section/SectionBuilder.d.ts.map +1 -1
- package/storybook-static/kit/builder/section/types.d.ts +12 -1
- package/storybook-static/kit/builder/section/types.d.ts.map +1 -1
- package/storybook-static/kit/builder/stack-dialog/context.d.ts +3 -0
- package/storybook-static/kit/builder/stack-dialog/context.d.ts.map +1 -0
- package/storybook-static/kit/builder/stack-dialog/hooks.d.ts +6 -0
- package/storybook-static/kit/builder/stack-dialog/hooks.d.ts.map +1 -0
- package/storybook-static/kit/builder/stack-dialog/index.d.ts +5 -0
- package/storybook-static/kit/builder/stack-dialog/index.d.ts.map +1 -0
- package/storybook-static/kit/builder/stack-dialog/provider.d.ts +3 -0
- package/storybook-static/kit/builder/stack-dialog/provider.d.ts.map +1 -0
- package/storybook-static/kit/builder/stack-dialog/renderer.d.ts +6 -0
- package/storybook-static/kit/builder/stack-dialog/renderer.d.ts.map +1 -0
- package/storybook-static/kit/builder/stack-dialog/types.d.ts +20 -0
- package/storybook-static/kit/builder/stack-dialog/types.d.ts.map +1 -0
- package/storybook-static/kit/components/autocomplete/Autocomplete.d.ts +35 -3
- package/storybook-static/kit/components/autocomplete/Autocomplete.d.ts.map +1 -1
- package/storybook-static/kit/components/autocomplete/index.d.ts +1 -0
- package/storybook-static/kit/components/autocomplete/index.d.ts.map +1 -1
- package/storybook-static/kit/components/autocomplete/types.d.ts +1 -1
- package/storybook-static/kit/components/autocomplete/types.d.ts.map +1 -1
- package/storybook-static/kit/components/monthpicker/MonthPicker.d.ts +32 -0
- package/storybook-static/kit/components/monthpicker/MonthPicker.d.ts.map +1 -0
- package/storybook-static/kit/components/monthpicker/MonthRangePicker.d.ts +48 -0
- package/storybook-static/kit/components/monthpicker/MonthRangePicker.d.ts.map +1 -0
- package/storybook-static/kit/layouts/admin/components/AdminLayout.d.ts.map +1 -1
- package/storybook-static/kit/layouts/admin/hooks/menu.d.ts +1 -0
- package/storybook-static/kit/layouts/admin/hooks/menu.d.ts.map +1 -1
- package/storybook-static/kit/providers/ThemeProvider.d.ts.map +1 -1
- package/storybook-static/project.json +1 -1
- package/storybook-static/assets/AdminLayout.Basic.stories-C-ZxuH-O.js +0 -4
- package/storybook-static/assets/AdminLayout.Collapsible.stories-xcQzkxio.js +0 -4
- package/storybook-static/assets/AdminLayout.Complex.stories-DyjkVpvE.js +0 -29
- package/storybook-static/assets/AdminLayout.CustomSidebarHeaderComponent.stories-BqhzWCIA.js +0 -9
- package/storybook-static/assets/AdminLayout.CustomSidebarTitleAndIcon.stories-aWxyR67T.js +0 -4
- package/storybook-static/assets/AdminLayout.HeaderSlots.stories-dNzhUdDt.js +0 -7
- package/storybook-static/assets/Autocomplete-B4gV705L.js +0 -35
- package/storybook-static/assets/Autocomplete.stories-CyOvjTGN.js +0 -33
- package/storybook-static/assets/Badge.stories-_-G3GriP.js +0 -12
- package/storybook-static/assets/DataTable.Basic.stories-BQNWUKiw.js +0 -6
- package/storybook-static/assets/DataTable.Filters.stories-DPCoeYhK.js +0 -21
- package/storybook-static/assets/DataTable.Pagination.stories-8UNqTNgw.js +0 -24
- package/storybook-static/assets/DataTable.SelectionAndActions.stories-CDEjgQ6T.js +0 -26
- package/storybook-static/assets/DataTable.Sorting.stories-qG7-X_6r.js +0 -6
- package/storybook-static/assets/Form.Basic.stories-dE4nbgpr.js +0 -45
- package/storybook-static/assets/Form.Complex.stories-BEZufnjb.js +0 -230
- package/storybook-static/assets/Form.Dynamic.stories-cJTbd6cV.js +0 -247
- package/storybook-static/assets/Form.Simple.stories-DOPzZKhh.js +0 -50
- package/storybook-static/assets/FormBuilder-C0S7C69Q.js +0 -5
- package/storybook-static/assets/Section.stories-Ce5qYITI.js +0 -196
- package/storybook-static/assets/SectionBuilder-Df_lRZkj.js +0 -1
- package/storybook-static/assets/Sonner.stories-CXW5e_Qg.js +0 -18
- package/storybook-static/assets/Switch.stories-zr6i-aNi.js +0 -3
- package/storybook-static/assets/Tabs.stories-jxkJ-AUI.js +0 -10
- package/storybook-static/assets/clean-slate-V4nUw2Bm.css +0 -1
- package/storybook-static/assets/default-CuTBjDca.css +0 -1
- package/storybook-static/assets/index-BN5_W3Yi.js +0 -1
- package/storybook-static/assets/index-C5eJ31Z3.js +0 -1
- package/storybook-static/assets/index-DWC9SV-P.js +0 -1
- package/storybook-static/assets/lodash-BkmSIg_J.js +0 -73
- package/storybook-static/assets/minimal-modern-d2yFlFJM.css +0 -1
- package/storybook-static/assets/spotify-BuPUgQEa.css +0 -1
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { useCallback } from 'react';
|
|
2
|
-
import { Control, FieldValues
|
|
2
|
+
import type { Control, FieldValues } from 'react-hook-form';
|
|
3
|
+
import { useController } from 'react-hook-form';
|
|
3
4
|
import { cn } from '../../../../shadcn/lib/utils';
|
|
4
5
|
import { Label } from '../../../../shadcn/ui/label';
|
|
5
|
-
import { FormBuilderFieldConfig } from './FormBuilder';
|
|
6
|
+
import type { FormBuilderFieldConfig } from './FormBuilder';
|
|
6
7
|
import {
|
|
7
8
|
AutocompleteField,
|
|
8
9
|
TextField,
|
|
@@ -13,6 +14,10 @@ import {
|
|
|
13
14
|
SwitchField,
|
|
14
15
|
RadioField,
|
|
15
16
|
DateField,
|
|
17
|
+
DatePickerField,
|
|
18
|
+
DateRangePickerField,
|
|
19
|
+
MonthPickerField,
|
|
20
|
+
MonthRangePickerField,
|
|
16
21
|
FileField,
|
|
17
22
|
ObjectField,
|
|
18
23
|
ArrayField,
|
|
@@ -41,7 +46,7 @@ export function FormBuilderField({ field, control, onChange, parentPath }: FormB
|
|
|
41
46
|
const handleChange = useCallback((value: unknown) => {
|
|
42
47
|
controllerField.onChange(value);
|
|
43
48
|
onChange?.(value);
|
|
44
|
-
}, [controllerField
|
|
49
|
+
}, [controllerField, onChange]);
|
|
45
50
|
const baseClassName = cn(
|
|
46
51
|
error && 'border-destructive focus-visible:ring-destructive',
|
|
47
52
|
field.className,
|
|
@@ -150,6 +155,50 @@ export function FormBuilderField({ field, control, onChange, parentPath }: FormB
|
|
|
150
155
|
className={baseClassName}
|
|
151
156
|
/>
|
|
152
157
|
);
|
|
158
|
+
case 'date_picker':
|
|
159
|
+
return (
|
|
160
|
+
<DatePickerField
|
|
161
|
+
field={field}
|
|
162
|
+
control={control}
|
|
163
|
+
fieldPath={fieldPath}
|
|
164
|
+
value={controllerField.value}
|
|
165
|
+
onChange={handleChange}
|
|
166
|
+
className={baseClassName}
|
|
167
|
+
/>
|
|
168
|
+
);
|
|
169
|
+
case 'date_range':
|
|
170
|
+
return (
|
|
171
|
+
<DateRangePickerField
|
|
172
|
+
field={field}
|
|
173
|
+
control={control}
|
|
174
|
+
fieldPath={fieldPath}
|
|
175
|
+
value={controllerField.value}
|
|
176
|
+
onChange={handleChange}
|
|
177
|
+
className={baseClassName}
|
|
178
|
+
/>
|
|
179
|
+
);
|
|
180
|
+
case 'month':
|
|
181
|
+
return (
|
|
182
|
+
<MonthPickerField
|
|
183
|
+
field={field}
|
|
184
|
+
control={control}
|
|
185
|
+
fieldPath={fieldPath}
|
|
186
|
+
value={controllerField.value}
|
|
187
|
+
onChange={handleChange}
|
|
188
|
+
className={baseClassName}
|
|
189
|
+
/>
|
|
190
|
+
);
|
|
191
|
+
case 'month_range':
|
|
192
|
+
return (
|
|
193
|
+
<MonthRangePickerField
|
|
194
|
+
field={field}
|
|
195
|
+
control={control}
|
|
196
|
+
fieldPath={fieldPath}
|
|
197
|
+
value={controllerField.value}
|
|
198
|
+
onChange={handleChange}
|
|
199
|
+
className={baseClassName}
|
|
200
|
+
/>
|
|
201
|
+
);
|
|
153
202
|
case 'file':
|
|
154
203
|
return (
|
|
155
204
|
<FileField
|
|
@@ -7,13 +7,41 @@ export function AutocompleteField({ field, value, onChange, className }: FieldRe
|
|
|
7
7
|
.filter((o): o is { label: string; value: string | number } => o.value !== null && o.value !== undefined)
|
|
8
8
|
.map(o => ({ label: o.label, value: o.value as string | number }))
|
|
9
9
|
|
|
10
|
+
// Shape defaultValue according to single/multiple
|
|
11
|
+
let defaultValueShaped: string | number | null | Array<string | number> | undefined = undefined
|
|
12
|
+
if (field.defaultValue !== undefined) {
|
|
13
|
+
if (field.multiple) {
|
|
14
|
+
if (Array.isArray(field.defaultValue)) {
|
|
15
|
+
defaultValueShaped = field.defaultValue.filter((v): v is string | number => typeof v === 'string' || typeof v === 'number')
|
|
16
|
+
} else if (field.defaultValue === null || field.defaultValue === undefined) {
|
|
17
|
+
defaultValueShaped = []
|
|
18
|
+
} else if (typeof field.defaultValue === 'string' || typeof field.defaultValue === 'number') {
|
|
19
|
+
defaultValueShaped = [field.defaultValue]
|
|
20
|
+
} else {
|
|
21
|
+
defaultValueShaped = []
|
|
22
|
+
}
|
|
23
|
+
} else {
|
|
24
|
+
defaultValueShaped = (typeof field.defaultValue === 'string' || typeof field.defaultValue === 'number' || field.defaultValue === null)
|
|
25
|
+
? field.defaultValue as string | number | null
|
|
26
|
+
: null
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
10
30
|
return (
|
|
11
31
|
<Autocomplete
|
|
12
32
|
mode={field.autocompleteMode ?? 'client'}
|
|
13
33
|
options={options}
|
|
14
34
|
fetcher={field.fetcher}
|
|
15
35
|
pageSize={field.pageSize}
|
|
16
|
-
|
|
36
|
+
multiple={field.multiple}
|
|
37
|
+
allowCustomValue={field.allowCustomValue}
|
|
38
|
+
chipVariant={field.chipVariant}
|
|
39
|
+
chipClassName={field.chipClassName}
|
|
40
|
+
clearable={field.clearable}
|
|
41
|
+
defaultValue={defaultValueShaped}
|
|
42
|
+
initialSelectedOptions={field.initialSelectedOptions ?? null}
|
|
43
|
+
loadSelected={field.loadSelected}
|
|
44
|
+
value={field.multiple ? ((Array.isArray(value) ? value : (value ? [value] : [])) as Array<string | number>) : ((value as string | number | null) ?? null)}
|
|
17
45
|
onChange={(val) => onChange(val)}
|
|
18
46
|
placeholder={field.placeholder}
|
|
19
47
|
searchPlaceholder={field.searchPlaceholder}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import * as React from 'react'
|
|
2
|
+
import type { FieldRenderProps } from './types'
|
|
3
|
+
import { DatePicker } from '../../../../components/datepicker/DatePicker'
|
|
4
|
+
|
|
5
|
+
export function DatePickerField({ field, value, onChange, className }: FieldRenderProps) {
|
|
6
|
+
const v = React.useMemo(() => {
|
|
7
|
+
if (!value) return null
|
|
8
|
+
if (value instanceof Date) return value
|
|
9
|
+
const d = new Date(value as string)
|
|
10
|
+
return Number.isNaN(d.getTime()) ? null : d
|
|
11
|
+
}, [value])
|
|
12
|
+
|
|
13
|
+
return (
|
|
14
|
+
<DatePicker
|
|
15
|
+
className={className}
|
|
16
|
+
value={v}
|
|
17
|
+
onChange={(d: Date | null) => onChange(d)}
|
|
18
|
+
minDate={field.minDate}
|
|
19
|
+
maxDate={field.maxDate}
|
|
20
|
+
disabledDates={field.disabledDates}
|
|
21
|
+
buttonVariant="outline"
|
|
22
|
+
/>
|
|
23
|
+
)
|
|
24
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import * as React from 'react'
|
|
2
|
+
import type { FieldRenderProps } from './types'
|
|
3
|
+
import { DateRangePicker } from '../../../../components/datepicker/DateRangePicker'
|
|
4
|
+
import type { DateRange } from 'react-day-picker'
|
|
5
|
+
|
|
6
|
+
function coerceDate(input: unknown): Date | undefined {
|
|
7
|
+
if (!input) return undefined
|
|
8
|
+
if (input instanceof Date) return input
|
|
9
|
+
const d = new Date(input as string)
|
|
10
|
+
return Number.isNaN(d.getTime()) ? undefined : d
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export function DateRangePickerField({ field, value, onChange, className }: FieldRenderProps) {
|
|
14
|
+
const v = React.useMemo<DateRange | null>(() => {
|
|
15
|
+
if (!value) return null
|
|
16
|
+
if (typeof value === 'object' && value !== null) {
|
|
17
|
+
const anyVal = value as { from?: unknown; to?: unknown }
|
|
18
|
+
return {
|
|
19
|
+
from: coerceDate(anyVal.from),
|
|
20
|
+
to: coerceDate(anyVal.to),
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
return null
|
|
24
|
+
}, [value])
|
|
25
|
+
|
|
26
|
+
return (
|
|
27
|
+
<DateRangePicker
|
|
28
|
+
className={className}
|
|
29
|
+
value={v}
|
|
30
|
+
onChange={(r) => onChange(r)}
|
|
31
|
+
minDate={field.minDate}
|
|
32
|
+
maxDate={field.maxDate}
|
|
33
|
+
disabledDates={field.disabledDates}
|
|
34
|
+
numberOfMonths={field.numberOfMonths ?? 2}
|
|
35
|
+
popoverSide={field.popoverSide}
|
|
36
|
+
showFooter={field.showFooter}
|
|
37
|
+
cancelLabel={field.cancelLabel}
|
|
38
|
+
applyLabel={field.applyLabel}
|
|
39
|
+
/>
|
|
40
|
+
)
|
|
41
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import * as React from 'react'
|
|
2
|
+
import type { FieldRenderProps } from './types'
|
|
3
|
+
import { MonthInput } from '../../../../components/monthpicker/MonthInput'
|
|
4
|
+
|
|
5
|
+
export function MonthPickerField({ field, value, onChange, className }: FieldRenderProps) {
|
|
6
|
+
const v = React.useMemo(() => {
|
|
7
|
+
if (!value) return undefined
|
|
8
|
+
if (value instanceof Date) return value
|
|
9
|
+
const d = new Date(value as string)
|
|
10
|
+
return Number.isNaN(d.getTime()) ? undefined : d
|
|
11
|
+
}, [value])
|
|
12
|
+
|
|
13
|
+
return (
|
|
14
|
+
<MonthInput
|
|
15
|
+
className={className}
|
|
16
|
+
value={v ?? null}
|
|
17
|
+
onChange={(d: Date | null) => onChange(d)}
|
|
18
|
+
minDate={field.minDate}
|
|
19
|
+
maxDate={field.maxDate}
|
|
20
|
+
disabledDates={(field.disabledDates?.filter((it): it is Date => it instanceof Date))}
|
|
21
|
+
showFooter
|
|
22
|
+
clearLabel={field.cancelLabel}
|
|
23
|
+
closeLabel={field.applyLabel}
|
|
24
|
+
/>
|
|
25
|
+
)
|
|
26
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import * as React from 'react'
|
|
2
|
+
import type { FieldRenderProps } from './types'
|
|
3
|
+
import { MonthRangeInput } from '../../../../components/monthpicker/MonthRangeInput'
|
|
4
|
+
|
|
5
|
+
export function MonthRangePickerField({ field, value, onChange, className }: FieldRenderProps) {
|
|
6
|
+
const v = React.useMemo(() => {
|
|
7
|
+
if (!value || typeof value !== 'object') return undefined as { start: Date; end: Date } | undefined
|
|
8
|
+
const anyVal = value as { start?: unknown; end?: unknown }
|
|
9
|
+
const toDate = (x: unknown) => {
|
|
10
|
+
if (!x) return undefined
|
|
11
|
+
if (x instanceof Date) return x
|
|
12
|
+
const d = new Date(x as string)
|
|
13
|
+
return Number.isNaN(d.getTime()) ? undefined : d
|
|
14
|
+
}
|
|
15
|
+
const start = toDate(anyVal.start)
|
|
16
|
+
const end = toDate(anyVal.end)
|
|
17
|
+
if (!start || !end) return undefined
|
|
18
|
+
return { start, end }
|
|
19
|
+
}, [value])
|
|
20
|
+
|
|
21
|
+
return (
|
|
22
|
+
<MonthRangeInput
|
|
23
|
+
className={className}
|
|
24
|
+
value={v ?? null}
|
|
25
|
+
onChange={(range) => onChange(range)}
|
|
26
|
+
minDate={field.minDate}
|
|
27
|
+
maxDate={field.maxDate}
|
|
28
|
+
showQuickSelectors
|
|
29
|
+
popoverSide={field.popoverSide}
|
|
30
|
+
showFooter
|
|
31
|
+
cancelLabel={field.cancelLabel}
|
|
32
|
+
applyLabel={field.applyLabel}
|
|
33
|
+
/>
|
|
34
|
+
)
|
|
35
|
+
}
|
|
@@ -8,6 +8,10 @@ export * from './CheckboxField'
|
|
|
8
8
|
export * from './SwitchField'
|
|
9
9
|
export * from './RadioField'
|
|
10
10
|
export * from './DateField'
|
|
11
|
+
export * from './DatePickerField'
|
|
12
|
+
export * from './DateRangePickerField'
|
|
13
|
+
export * from './MonthPickerField'
|
|
14
|
+
export * from './MonthRangePickerField'
|
|
11
15
|
export * from './FileField'
|
|
12
16
|
export * from './ObjectField'
|
|
13
17
|
export * from './ArrayField'
|
|
@@ -3,6 +3,7 @@ import { cn } from '../../../shadcn/lib/utils';
|
|
|
3
3
|
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '../../../shadcn/ui/card';
|
|
4
4
|
import { Separator } from '../../../shadcn/ui/separator';
|
|
5
5
|
import type { SectionBuilderProps, SectionLeaf, SectionNode } from './types';
|
|
6
|
+
import { Tabs, TabsList, TabsTrigger, TabsContent } from '../../../shadcn/ui/tabs';
|
|
6
7
|
|
|
7
8
|
// Tailwind-safe literal class maps (1-12)
|
|
8
9
|
const GRID_COLS = {
|
|
@@ -175,7 +176,7 @@ const SectionLeafRenderer = memo(
|
|
|
175
176
|
function SectionNodeRenderer({ node, renderLeaf }: { node: SectionNode; renderLeaf?: (leaf: SectionLeaf) => React.ReactNode }) {
|
|
176
177
|
if (node.hidden) return null;
|
|
177
178
|
const layout = node.layout ?? 'grid';
|
|
178
|
-
const containerClass = layout === 'grid' ? gridClasses(node.grid) : flexClasses(node.flex);
|
|
179
|
+
const containerClass = layout === 'grid' ? gridClasses(node.grid) : layout === 'flex' ? flexClasses(node.flex) : '';
|
|
179
180
|
|
|
180
181
|
// Local presentational container replacing FormBuilderSection
|
|
181
182
|
const SectionContainer = ({ children }: { children: React.ReactNode }) => {
|
|
@@ -229,7 +230,6 @@ function SectionNodeRenderer({ node, renderLeaf }: { node: SectionNode; renderLe
|
|
|
229
230
|
{renderContent()}
|
|
230
231
|
</div>
|
|
231
232
|
);
|
|
232
|
-
case 'plain':
|
|
233
233
|
default:
|
|
234
234
|
return (
|
|
235
235
|
<div className={cn('space-y-6', className)}>
|
|
@@ -240,6 +240,28 @@ function SectionNodeRenderer({ node, renderLeaf }: { node: SectionNode; renderLe
|
|
|
240
240
|
}
|
|
241
241
|
};
|
|
242
242
|
|
|
243
|
+
if (layout === 'tabs' && node.tabs && node.tabs.length > 0) {
|
|
244
|
+
const defaultTabId = node.defaultTabId ?? node.tabs[0]?.id;
|
|
245
|
+
return (
|
|
246
|
+
<SectionContainer>
|
|
247
|
+
<Tabs defaultValue={defaultTabId} className={cn('space-y-2')}>
|
|
248
|
+
<TabsList className={cn(node.tabsListClassName)}>
|
|
249
|
+
{node.tabs.map((tab) => (
|
|
250
|
+
<TabsTrigger key={tab.id} value={tab.id} className={cn(tab.className)}>
|
|
251
|
+
{tab.label}
|
|
252
|
+
</TabsTrigger>
|
|
253
|
+
))}
|
|
254
|
+
</TabsList>
|
|
255
|
+
{node.tabs.map((tab) => (
|
|
256
|
+
<TabsContent key={tab.id} value={tab.id} className={cn(node.tabsContentClassName, tab.contentClassName)}>
|
|
257
|
+
<SectionNodeRenderer node={tab.node} renderLeaf={renderLeaf} />
|
|
258
|
+
</TabsContent>
|
|
259
|
+
))}
|
|
260
|
+
</Tabs>
|
|
261
|
+
</SectionContainer>
|
|
262
|
+
);
|
|
263
|
+
}
|
|
264
|
+
|
|
243
265
|
return (
|
|
244
266
|
<SectionContainer>
|
|
245
267
|
<div className={containerClass}>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type React from 'react';
|
|
2
2
|
|
|
3
|
-
export type SectionLayout = 'grid' | 'flex';
|
|
3
|
+
export type SectionLayout = 'grid' | 'flex' | 'tabs';
|
|
4
4
|
|
|
5
5
|
export interface SectionGridOptions {
|
|
6
6
|
cols?: number;
|
|
@@ -52,11 +52,25 @@ export interface SectionLeaf {
|
|
|
52
52
|
renderKey?: string | number;
|
|
53
53
|
}
|
|
54
54
|
|
|
55
|
+
// Tabs layout support
|
|
56
|
+
export interface SectionTab {
|
|
57
|
+
id: string;
|
|
58
|
+
label: React.ReactNode;
|
|
59
|
+
className?: string;
|
|
60
|
+
contentClassName?: string;
|
|
61
|
+
node: SectionNode; // Content of this tab as a nested section node
|
|
62
|
+
}
|
|
63
|
+
|
|
55
64
|
export interface SectionNode extends SectionBase {
|
|
56
65
|
layout?: SectionLayout;
|
|
57
66
|
grid?: SectionGridOptions;
|
|
58
67
|
flex?: SectionFlexOptions;
|
|
59
68
|
children?: Array<SectionNode | SectionLeaf>;
|
|
69
|
+
// Tabs layout (layout === 'tabs')
|
|
70
|
+
tabs?: SectionTab[];
|
|
71
|
+
defaultTabId?: string;
|
|
72
|
+
tabsListClassName?: string;
|
|
73
|
+
tabsContentClassName?: string;
|
|
60
74
|
}
|
|
61
75
|
|
|
62
76
|
export interface SectionBuilderProps {
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { createContext } from 'react';
|
|
2
|
+
import { StackDialogContextInstance } from './types';
|
|
3
|
+
|
|
4
|
+
export const StackDialogContext = createContext<StackDialogContextInstance>({
|
|
5
|
+
activeDialogs: [],
|
|
6
|
+
createDialog: () => { throw new Error('createDialog must be called within StackDialogProvider') },
|
|
7
|
+
closeDialog: () => { throw new Error('closeDialog must be called within StackDialogProvider') },
|
|
8
|
+
closeAllDialogs: () => { throw new Error('closeAllDialog must be called within StackDialogProvider') },
|
|
9
|
+
});
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { useContext } from 'react';
|
|
2
|
+
import { StackDialogContext } from './context';
|
|
3
|
+
|
|
4
|
+
export function useStackDialog() {
|
|
5
|
+
const { createDialog, closeDialog, closeAllDialogs } = useContext(StackDialogContext);
|
|
6
|
+
return {
|
|
7
|
+
createDialog,
|
|
8
|
+
closeDialog,
|
|
9
|
+
closeAllDialogs,
|
|
10
|
+
}
|
|
11
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { PropsWithChildren, useCallback, useRef, useState } from 'react';
|
|
2
|
+
import { StackDialogContext } from './context';
|
|
3
|
+
import { StackDialogRenderer } from './renderer';
|
|
4
|
+
import { StackDialogCreateConfig, StackDialogInstance } from './types';
|
|
5
|
+
|
|
6
|
+
export function StackDialogContextProvider(props: PropsWithChildren) {
|
|
7
|
+
const [activeDialogs, setActiveDialogs] = useState<StackDialogInstance[]>([]);
|
|
8
|
+
const ids = useRef<number>(0)
|
|
9
|
+
|
|
10
|
+
const handleCreateDialog = useCallback((config: StackDialogCreateConfig) => {
|
|
11
|
+
const dialogId = config.id || (ids.current++).toString();
|
|
12
|
+
|
|
13
|
+
setActiveDialogs(prev => {
|
|
14
|
+
const clone = [...prev];
|
|
15
|
+
clone.push({
|
|
16
|
+
id: dialogId,
|
|
17
|
+
template: config.template,
|
|
18
|
+
closeOnEscapePressed: config.closeOnEscapePressed,
|
|
19
|
+
closeOnInteractOutside: config.closeOnInteractOutside,
|
|
20
|
+
});
|
|
21
|
+
return clone;
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
return dialogId;
|
|
25
|
+
}, [setActiveDialogs]);
|
|
26
|
+
|
|
27
|
+
const handleCloseDialog = useCallback((id?: string) => {
|
|
28
|
+
setActiveDialogs(prev => {
|
|
29
|
+
const clone = [...prev];
|
|
30
|
+
clone.splice(clone.findIndex(d => d.id === (id || '')));
|
|
31
|
+
return clone;
|
|
32
|
+
});
|
|
33
|
+
}, [setActiveDialogs]);
|
|
34
|
+
|
|
35
|
+
const handleCloseAllDialog = useCallback(() => {
|
|
36
|
+
setActiveDialogs([]);
|
|
37
|
+
}, [setActiveDialogs]);
|
|
38
|
+
|
|
39
|
+
return (
|
|
40
|
+
<StackDialogContext.Provider
|
|
41
|
+
value={{
|
|
42
|
+
activeDialogs,
|
|
43
|
+
createDialog: handleCreateDialog,
|
|
44
|
+
closeDialog: handleCloseDialog,
|
|
45
|
+
closeAllDialogs: handleCloseAllDialog,
|
|
46
|
+
}}
|
|
47
|
+
>
|
|
48
|
+
{props.children}
|
|
49
|
+
<StackDialogRenderer
|
|
50
|
+
dialogs={activeDialogs}
|
|
51
|
+
closeDialog={handleCloseDialog}
|
|
52
|
+
/>
|
|
53
|
+
</StackDialogContext.Provider>
|
|
54
|
+
)
|
|
55
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { Dialog } from '@/shadcn/ui/dialog';
|
|
2
|
+
import { StackDialogInstance } from './types';
|
|
3
|
+
import { DialogContent } from '@radix-ui/react-dialog';
|
|
4
|
+
|
|
5
|
+
export function StackDialogRenderer(props: {
|
|
6
|
+
dialogs: StackDialogInstance[],
|
|
7
|
+
closeDialog: (id: string) => void
|
|
8
|
+
}) {
|
|
9
|
+
const handleCloseDialog = (id: string) => () => {
|
|
10
|
+
props.closeDialog(id)
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
return props.dialogs.map((dialog) => (
|
|
14
|
+
(
|
|
15
|
+
<Dialog
|
|
16
|
+
open
|
|
17
|
+
onOpenChange={(open) => (!open && handleCloseDialog(dialog.id))}
|
|
18
|
+
key={dialog.id}
|
|
19
|
+
>
|
|
20
|
+
<DialogContent
|
|
21
|
+
onEscapeKeyDown={e => {
|
|
22
|
+
if (!dialog.closeOnEscapePressed) e.preventDefault();
|
|
23
|
+
}}
|
|
24
|
+
onInteractOutside={e => {
|
|
25
|
+
if (!dialog.closeOnInteractOutside) e.preventDefault();
|
|
26
|
+
}}
|
|
27
|
+
>
|
|
28
|
+
{dialog.template}
|
|
29
|
+
</DialogContent>
|
|
30
|
+
</Dialog>
|
|
31
|
+
)
|
|
32
|
+
));
|
|
33
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
|
|
3
|
+
export type StackDialogContextInstance = {
|
|
4
|
+
activeDialogs: StackDialogInstance[],
|
|
5
|
+
createDialog: (config: StackDialogCreateConfig) => string,
|
|
6
|
+
closeDialog: (id?: string) => void,
|
|
7
|
+
closeAllDialogs: () => void,
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
export type StackDialogInstance = {
|
|
11
|
+
id: string,
|
|
12
|
+
template: ReactNode,
|
|
13
|
+
closeOnInteractOutside?: boolean,
|
|
14
|
+
closeOnEscapePressed?: boolean,
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export type StackDialogCreateConfig = {
|
|
18
|
+
id?: string,
|
|
19
|
+
template: ReactNode,
|
|
20
|
+
closeOnInteractOutside?: boolean,
|
|
21
|
+
closeOnEscapePressed?: boolean,
|
|
22
|
+
};
|