@health-samurai/react-components 0.0.0-alpha.2 → 0.0.0-alpha.21
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/LICENSE +21 -0
- package/README.md +102 -1
- package/dist/bundle.css +2349 -754
- package/dist/src/components/button-dropdown.d.ts +10 -0
- package/dist/src/components/button-dropdown.d.ts.map +1 -0
- package/dist/src/components/button-dropdown.js +70 -0
- package/dist/src/components/button-dropdown.js.map +1 -0
- package/dist/src/components/button-dropdown.stories.js +48 -0
- package/dist/src/components/button-dropdown.stories.js.map +1 -0
- package/dist/src/components/code-editor/fhir-autocomplete.d.ts +70 -0
- package/dist/src/components/code-editor/fhir-autocomplete.d.ts.map +1 -0
- package/dist/src/components/code-editor/fhir-autocomplete.js +1850 -0
- package/dist/src/components/code-editor/fhir-autocomplete.js.map +1 -0
- package/dist/src/components/code-editor/fhir-autocomplete.test.js +1099 -0
- package/dist/src/components/code-editor/fhir-autocomplete.test.js.map +1 -0
- package/dist/src/components/code-editor/http/grammar/http.d.ts +3 -0
- package/dist/src/components/code-editor/http/grammar/http.d.ts.map +1 -0
- package/dist/src/components/code-editor/http/grammar/http.grammar +74 -0
- package/dist/src/components/code-editor/http/grammar/http.js +38 -0
- package/dist/src/components/code-editor/http/grammar/http.js.map +1 -0
- package/dist/src/components/code-editor/http/grammar/http.terms.d.ts +2 -0
- package/dist/src/components/code-editor/http/grammar/http.terms.d.ts.map +1 -0
- package/dist/src/components/code-editor/http/grammar/http.terms.js +4 -0
- package/dist/src/components/code-editor/http/grammar/http.terms.js.map +1 -0
- package/dist/src/components/code-editor/http/grammar/http.test.js +80 -0
- package/dist/src/components/code-editor/http/grammar/http.test.js.map +1 -0
- package/dist/src/components/code-editor/http/index.d.ts +12 -0
- package/dist/src/components/code-editor/http/index.d.ts.map +1 -0
- package/dist/src/components/code-editor/http/index.js +486 -0
- package/dist/src/components/code-editor/http/index.js.map +1 -0
- package/dist/src/components/code-editor/index.d.ts +39 -1
- package/dist/src/components/code-editor/index.d.ts.map +1 -1
- package/dist/src/components/code-editor/index.js +1792 -45
- package/dist/src/components/code-editor/index.js.map +1 -1
- package/dist/src/components/code-editor/json-ast.d.ts +46 -0
- package/dist/src/components/code-editor/json-ast.d.ts.map +1 -0
- package/dist/src/components/code-editor/json-ast.js +465 -0
- package/dist/src/components/code-editor/json-ast.js.map +1 -0
- package/dist/src/components/code-editor/json-ast.test.js +206 -0
- package/dist/src/components/code-editor/json-ast.test.js.map +1 -0
- package/dist/src/components/code-editor/sql-completion.d.ts +22 -0
- package/dist/src/components/code-editor/sql-completion.d.ts.map +1 -0
- package/dist/src/components/code-editor/sql-completion.js +897 -0
- package/dist/src/components/code-editor/sql-completion.js.map +1 -0
- package/dist/src/components/code-editor.stories.js +280 -3
- package/dist/src/components/code-editor.stories.js.map +1 -1
- package/dist/src/components/copy-icon.d.ts +5 -1
- package/dist/src/components/copy-icon.d.ts.map +1 -1
- package/dist/src/components/copy-icon.js +41 -3
- package/dist/src/components/copy-icon.js.map +1 -1
- package/dist/src/components/data-table.d.ts +9 -0
- package/dist/src/components/data-table.d.ts.map +1 -0
- package/dist/src/components/data-table.js +66 -0
- package/dist/src/components/data-table.js.map +1 -0
- package/dist/src/components/data-table.stories.js +240 -0
- package/dist/src/components/data-table.stories.js.map +1 -0
- package/dist/src/components/date-picker-input.d.ts +10 -0
- package/dist/src/components/date-picker-input.d.ts.map +1 -0
- package/dist/src/components/date-picker-input.js +90 -0
- package/dist/src/components/date-picker-input.js.map +1 -0
- package/dist/src/components/date-picker-input.stories.js +76 -0
- package/dist/src/components/date-picker-input.stories.js.map +1 -0
- package/dist/src/components/fhir-structure-view.d.ts +34 -0
- package/dist/src/components/fhir-structure-view.d.ts.map +1 -0
- package/dist/src/components/fhir-structure-view.js +230 -0
- package/dist/src/components/fhir-structure-view.js.map +1 -0
- package/dist/src/components/fhir-structure-view.stories.js +447 -0
- package/dist/src/components/fhir-structure-view.stories.js.map +1 -0
- package/dist/src/components/icon-button.d.ts +12 -0
- package/dist/src/components/icon-button.d.ts.map +1 -0
- package/dist/src/components/icon-button.js +41 -0
- package/dist/src/components/icon-button.js.map +1 -0
- package/dist/src/components/icon-button.stories.js +157 -0
- package/dist/src/components/icon-button.stories.js.map +1 -0
- package/dist/src/components/operation-outcome-view.d.ts +27 -0
- package/dist/src/components/operation-outcome-view.d.ts.map +1 -0
- package/dist/src/components/operation-outcome-view.js +198 -0
- package/dist/src/components/operation-outcome-view.js.map +1 -0
- package/dist/src/components/operation-outcome-view.stories.js +207 -0
- package/dist/src/components/operation-outcome-view.stories.js.map +1 -0
- package/dist/src/components/request-line-editor.d.ts +13 -35
- package/dist/src/components/request-line-editor.d.ts.map +1 -1
- package/dist/src/components/request-line-editor.js +73 -49
- package/dist/src/components/request-line-editor.js.map +1 -1
- package/dist/src/components/request-line-editor.stories.js +17 -53
- package/dist/src/components/request-line-editor.stories.js.map +1 -1
- package/dist/src/components/sandbox.d.ts +13 -0
- package/dist/src/components/sandbox.d.ts.map +1 -0
- package/dist/src/components/sandbox.js +107 -0
- package/dist/src/components/sandbox.js.map +1 -0
- package/dist/src/components/sandbox.stories.js +126 -0
- package/dist/src/components/sandbox.stories.js.map +1 -0
- package/dist/src/components/segment-control.d.ts +13 -0
- package/dist/src/components/segment-control.d.ts.map +1 -0
- package/dist/src/components/segment-control.js +33 -0
- package/dist/src/components/segment-control.js.map +1 -0
- package/dist/src/components/segment-control.stories.js +68 -0
- package/dist/src/components/segment-control.stories.js.map +1 -0
- package/dist/src/components/split-button.d.ts +12 -0
- package/dist/src/components/split-button.d.ts.map +1 -0
- package/dist/src/components/split-button.js +33 -0
- package/dist/src/components/split-button.js.map +1 -0
- package/dist/src/components/split-button.stories.js +84 -0
- package/dist/src/components/split-button.stories.js.map +1 -0
- package/dist/src/components/tag.d.ts +16 -0
- package/dist/src/components/tag.d.ts.map +1 -0
- package/dist/src/components/tag.js +198 -0
- package/dist/src/components/tag.js.map +1 -0
- package/dist/src/components/tag.stories.js +459 -0
- package/dist/src/components/tag.stories.js.map +1 -0
- package/dist/src/components/tile.d.ts +15 -0
- package/dist/src/components/tile.d.ts.map +1 -0
- package/dist/src/components/tile.js +76 -0
- package/dist/src/components/tile.js.map +1 -0
- package/dist/src/components/tile.stories.js +167 -0
- package/dist/src/components/tile.stories.js.map +1 -0
- package/dist/src/components/toolbar.d.ts +18 -0
- package/dist/src/components/toolbar.d.ts.map +1 -0
- package/dist/src/components/toolbar.js +61 -0
- package/dist/src/components/toolbar.js.map +1 -0
- package/dist/src/components/toolbar.stories.js +69 -0
- package/dist/src/components/toolbar.stories.js.map +1 -0
- package/dist/src/components/tree-view.d.ts +47 -0
- package/dist/src/components/tree-view.d.ts.map +1 -0
- package/dist/src/components/tree-view.js +122 -0
- package/dist/src/components/tree-view.js.map +1 -0
- package/dist/src/components/tree-view.stories.js +283 -0
- package/dist/src/components/tree-view.stories.js.map +1 -0
- package/dist/src/icons.d.ts +11 -0
- package/dist/src/icons.d.ts.map +1 -0
- package/dist/src/icons.js +328 -0
- package/dist/src/icons.js.map +1 -0
- package/dist/src/index.css +358 -74
- package/dist/src/index.d.ts +17 -1
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +17 -1
- package/dist/src/index.js.map +1 -1
- package/dist/src/shadcn/components/ui/accordion.d.ts +2 -2
- package/dist/src/shadcn/components/ui/accordion.d.ts.map +1 -1
- package/dist/src/shadcn/components/ui/accordion.js +35 -9
- package/dist/src/shadcn/components/ui/accordion.js.map +1 -1
- package/dist/src/shadcn/components/ui/alert-dialog.d.ts +12 -4
- package/dist/src/shadcn/components/ui/alert-dialog.d.ts.map +1 -1
- package/dist/src/shadcn/components/ui/alert-dialog.js +128 -18
- package/dist/src/shadcn/components/ui/alert-dialog.js.map +1 -1
- package/dist/src/shadcn/components/ui/alert-dialog.stories.js +269 -19
- package/dist/src/shadcn/components/ui/alert-dialog.stories.js.map +1 -1
- package/dist/src/shadcn/components/ui/alert.d.ts +29 -6
- package/dist/src/shadcn/components/ui/alert.d.ts.map +1 -1
- package/dist/src/shadcn/components/ui/alert.js +50 -19
- package/dist/src/shadcn/components/ui/alert.js.map +1 -1
- package/dist/src/shadcn/components/ui/alert.stories.js +140 -36
- package/dist/src/shadcn/components/ui/alert.stories.js.map +1 -1
- package/dist/src/shadcn/components/ui/aspect-ratio.d.ts.map +1 -1
- package/dist/src/shadcn/components/ui/aspect-ratio.js +1 -0
- package/dist/src/shadcn/components/ui/aspect-ratio.js.map +1 -1
- package/dist/src/shadcn/components/ui/avatar.d.ts.map +1 -1
- package/dist/src/shadcn/components/ui/avatar.js +4 -3
- package/dist/src/shadcn/components/ui/avatar.js.map +1 -1
- package/dist/src/shadcn/components/ui/avatar.stories.js +68 -2
- package/dist/src/shadcn/components/ui/avatar.stories.js.map +1 -1
- package/dist/src/shadcn/components/ui/badge.d.ts +1 -1
- package/dist/src/shadcn/components/ui/badge.d.ts.map +1 -1
- package/dist/src/shadcn/components/ui/badge.js +16 -5
- package/dist/src/shadcn/components/ui/badge.js.map +1 -1
- package/dist/src/shadcn/components/ui/breadcrumb.d.ts +5 -2
- package/dist/src/shadcn/components/ui/breadcrumb.d.ts.map +1 -1
- package/dist/src/shadcn/components/ui/breadcrumb.js +98 -13
- package/dist/src/shadcn/components/ui/breadcrumb.js.map +1 -1
- package/dist/src/shadcn/components/ui/breadcrumb.stories.js +205 -45
- package/dist/src/shadcn/components/ui/breadcrumb.stories.js.map +1 -1
- package/dist/src/shadcn/components/ui/button.d.ts.map +1 -1
- package/dist/src/shadcn/components/ui/button.js +65 -11
- package/dist/src/shadcn/components/ui/button.js.map +1 -1
- package/dist/src/shadcn/components/ui/button.stories.js +99 -17
- package/dist/src/shadcn/components/ui/button.stories.js.map +1 -1
- package/dist/src/shadcn/components/ui/calendar.d.ts +1 -1
- package/dist/src/shadcn/components/ui/calendar.d.ts.map +1 -1
- package/dist/src/shadcn/components/ui/calendar.js +1 -0
- package/dist/src/shadcn/components/ui/calendar.js.map +1 -1
- package/dist/src/shadcn/components/ui/card.d.ts +5 -1
- package/dist/src/shadcn/components/ui/card.d.ts.map +1 -1
- package/dist/src/shadcn/components/ui/card.js +28 -7
- package/dist/src/shadcn/components/ui/card.js.map +1 -1
- package/dist/src/shadcn/components/ui/card.stories.js +23 -2
- package/dist/src/shadcn/components/ui/card.stories.js.map +1 -1
- package/dist/src/shadcn/components/ui/carousel.d.ts +1 -1
- package/dist/src/shadcn/components/ui/carousel.d.ts.map +1 -1
- package/dist/src/shadcn/components/ui/carousel.js +1 -0
- package/dist/src/shadcn/components/ui/carousel.js.map +1 -1
- package/dist/src/shadcn/components/ui/chart.d.ts +5 -5
- package/dist/src/shadcn/components/ui/chart.d.ts.map +1 -1
- package/dist/src/shadcn/components/ui/chart.js +4 -3
- package/dist/src/shadcn/components/ui/chart.js.map +1 -1
- package/dist/src/shadcn/components/ui/checkbox.d.ts +5 -1
- package/dist/src/shadcn/components/ui/checkbox.d.ts.map +1 -1
- package/dist/src/shadcn/components/ui/checkbox.js +46 -6
- package/dist/src/shadcn/components/ui/checkbox.js.map +1 -1
- package/dist/src/shadcn/components/ui/checkbox.stories.js +156 -46
- package/dist/src/shadcn/components/ui/checkbox.stories.js.map +1 -1
- package/dist/src/shadcn/components/ui/combobox.d.ts +29 -0
- package/dist/src/shadcn/components/ui/combobox.d.ts.map +1 -0
- package/dist/src/shadcn/components/ui/combobox.js +226 -0
- package/dist/src/shadcn/components/ui/combobox.js.map +1 -0
- package/dist/src/shadcn/components/ui/combobox.stories.js +167 -0
- package/dist/src/shadcn/components/ui/combobox.stories.js.map +1 -0
- package/dist/src/shadcn/components/ui/command.d.ts +4 -2
- package/dist/src/shadcn/components/ui/command.d.ts.map +1 -1
- package/dist/src/shadcn/components/ui/command.js +75 -13
- package/dist/src/shadcn/components/ui/command.js.map +1 -1
- package/dist/src/shadcn/components/ui/command.stories.js +277 -57
- package/dist/src/shadcn/components/ui/command.stories.js.map +1 -1
- package/dist/src/shadcn/components/ui/context-menu.d.ts +7 -3
- package/dist/src/shadcn/components/ui/context-menu.d.ts.map +1 -1
- package/dist/src/shadcn/components/ui/context-menu.js +120 -13
- package/dist/src/shadcn/components/ui/context-menu.js.map +1 -1
- package/dist/src/shadcn/components/ui/dialog.d.ts.map +1 -1
- package/dist/src/shadcn/components/ui/dialog.js +35 -7
- package/dist/src/shadcn/components/ui/dialog.js.map +1 -1
- package/dist/src/shadcn/components/ui/drawer.d.ts.map +1 -1
- package/dist/src/shadcn/components/ui/drawer.js +27 -5
- package/dist/src/shadcn/components/ui/drawer.js.map +1 -1
- package/dist/src/shadcn/components/ui/dropdown-menu.d.ts +7 -3
- package/dist/src/shadcn/components/ui/dropdown-menu.d.ts.map +1 -1
- package/dist/src/shadcn/components/ui/dropdown-menu.js +122 -14
- package/dist/src/shadcn/components/ui/dropdown-menu.js.map +1 -1
- package/dist/src/shadcn/components/ui/dropdown-menu.stories.js +22 -5
- package/dist/src/shadcn/components/ui/dropdown-menu.stories.js.map +1 -1
- package/dist/src/shadcn/components/ui/form.d.ts +2 -2
- package/dist/src/shadcn/components/ui/form.d.ts.map +1 -1
- package/dist/src/shadcn/components/ui/form.js +17 -8
- package/dist/src/shadcn/components/ui/form.js.map +1 -1
- package/dist/src/shadcn/components/ui/hover-card.d.ts.map +1 -1
- package/dist/src/shadcn/components/ui/hover-card.js +2 -1
- package/dist/src/shadcn/components/ui/hover-card.js.map +1 -1
- package/dist/src/shadcn/components/ui/input-otp.d.ts.map +1 -1
- package/dist/src/shadcn/components/ui/input-otp.js +1 -0
- package/dist/src/shadcn/components/ui/input-otp.js.map +1 -1
- package/dist/src/shadcn/components/ui/input.d.ts +3 -1
- package/dist/src/shadcn/components/ui/input.d.ts.map +1 -1
- package/dist/src/shadcn/components/ui/input.js +126 -17
- package/dist/src/shadcn/components/ui/input.js.map +1 -1
- package/dist/src/shadcn/components/ui/input.stories.js +218 -29
- package/dist/src/shadcn/components/ui/input.stories.js.map +1 -1
- package/dist/src/shadcn/components/ui/label.d.ts.map +1 -1
- package/dist/src/shadcn/components/ui/label.js +9 -1
- package/dist/src/shadcn/components/ui/label.js.map +1 -1
- package/dist/src/shadcn/components/ui/menubar.d.ts.map +1 -1
- package/dist/src/shadcn/components/ui/menubar.js +35 -13
- package/dist/src/shadcn/components/ui/menubar.js.map +1 -1
- package/dist/src/shadcn/components/ui/pagination.d.ts +9 -2
- package/dist/src/shadcn/components/ui/pagination.d.ts.map +1 -1
- package/dist/src/shadcn/components/ui/pagination.js +41 -24
- package/dist/src/shadcn/components/ui/pagination.js.map +1 -1
- package/dist/src/shadcn/components/ui/pagination.stories.js +44 -37
- package/dist/src/shadcn/components/ui/pagination.stories.js.map +1 -1
- package/dist/src/shadcn/components/ui/popover.d.ts.map +1 -1
- package/dist/src/shadcn/components/ui/popover.js +13 -1
- package/dist/src/shadcn/components/ui/popover.js.map +1 -1
- package/dist/src/shadcn/components/ui/progress.d.ts.map +1 -1
- package/dist/src/shadcn/components/ui/progress.js +6 -2
- package/dist/src/shadcn/components/ui/progress.js.map +1 -1
- package/dist/src/shadcn/components/ui/radio-button-group.d.ts +21 -0
- package/dist/src/shadcn/components/ui/radio-button-group.d.ts.map +1 -0
- package/dist/src/shadcn/components/ui/radio-button-group.js +148 -0
- package/dist/src/shadcn/components/ui/radio-button-group.js.map +1 -0
- package/dist/src/shadcn/components/ui/radio-button-group.stories.js +283 -0
- package/dist/src/shadcn/components/ui/radio-button-group.stories.js.map +1 -0
- package/dist/src/shadcn/components/ui/radio-group.d.ts +5 -1
- package/dist/src/shadcn/components/ui/radio-group.d.ts.map +1 -1
- package/dist/src/shadcn/components/ui/radio-group.js +40 -7
- package/dist/src/shadcn/components/ui/radio-group.js.map +1 -1
- package/dist/src/shadcn/components/ui/radio-group.stories.js +107 -32
- package/dist/src/shadcn/components/ui/radio-group.stories.js.map +1 -1
- package/dist/src/shadcn/components/ui/resizable.d.ts.map +1 -1
- package/dist/src/shadcn/components/ui/resizable.js +2 -1
- package/dist/src/shadcn/components/ui/resizable.js.map +1 -1
- package/dist/src/shadcn/components/ui/resizable.stories.js +2 -2
- package/dist/src/shadcn/components/ui/resizable.stories.js.map +1 -1
- package/dist/src/shadcn/components/ui/scroll-area.d.ts.map +1 -1
- package/dist/src/shadcn/components/ui/scroll-area.js +10 -3
- package/dist/src/shadcn/components/ui/scroll-area.js.map +1 -1
- package/dist/src/shadcn/components/ui/select.d.ts +1 -2
- package/dist/src/shadcn/components/ui/select.d.ts.map +1 -1
- package/dist/src/shadcn/components/ui/select.js +49 -19
- package/dist/src/shadcn/components/ui/select.js.map +1 -1
- package/dist/src/shadcn/components/ui/select.stories.js +193 -70
- package/dist/src/shadcn/components/ui/select.stories.js.map +1 -1
- package/dist/src/shadcn/components/ui/separator.d.ts.map +1 -1
- package/dist/src/shadcn/components/ui/separator.js +8 -1
- package/dist/src/shadcn/components/ui/separator.js.map +1 -1
- package/dist/src/shadcn/components/ui/sheet.js +1 -1
- package/dist/src/shadcn/components/ui/sheet.js.map +1 -1
- package/dist/src/shadcn/components/ui/sidebar.d.ts +4 -4
- package/dist/src/shadcn/components/ui/sidebar.d.ts.map +1 -1
- package/dist/src/shadcn/components/ui/sidebar.js +21 -6
- package/dist/src/shadcn/components/ui/sidebar.js.map +1 -1
- package/dist/src/shadcn/components/ui/skeleton.d.ts.map +1 -1
- package/dist/src/shadcn/components/ui/skeleton.js +3 -1
- package/dist/src/shadcn/components/ui/skeleton.js.map +1 -1
- package/dist/src/shadcn/components/ui/slider.d.ts.map +1 -1
- package/dist/src/shadcn/components/ui/slider.js +35 -4
- package/dist/src/shadcn/components/ui/slider.js.map +1 -1
- package/dist/src/shadcn/components/ui/sonner.d.ts +24 -2
- package/dist/src/shadcn/components/ui/sonner.d.ts.map +1 -1
- package/dist/src/shadcn/components/ui/sonner.js +127 -9
- package/dist/src/shadcn/components/ui/sonner.js.map +1 -1
- package/dist/src/shadcn/components/ui/sonner.stories.js +251 -12
- package/dist/src/shadcn/components/ui/sonner.stories.js.map +1 -1
- package/dist/src/shadcn/components/ui/switch.d.ts +7 -1
- package/dist/src/shadcn/components/ui/switch.d.ts.map +1 -1
- package/dist/src/shadcn/components/ui/switch.js +55 -3
- package/dist/src/shadcn/components/ui/switch.js.map +1 -1
- package/dist/src/shadcn/components/ui/switch.stories.js +84 -9
- package/dist/src/shadcn/components/ui/switch.stories.js.map +1 -1
- package/dist/src/shadcn/components/ui/table.d.ts +23 -6
- package/dist/src/shadcn/components/ui/table.d.ts.map +1 -1
- package/dist/src/shadcn/components/ui/table.js +65 -20
- package/dist/src/shadcn/components/ui/table.js.map +1 -1
- package/dist/src/shadcn/components/ui/table.stories.js +217 -97
- package/dist/src/shadcn/components/ui/table.stories.js.map +1 -1
- package/dist/src/shadcn/components/ui/tabs.d.ts +30 -5
- package/dist/src/shadcn/components/ui/tabs.d.ts.map +1 -1
- package/dist/src/shadcn/components/ui/tabs.js +470 -23
- package/dist/src/shadcn/components/ui/tabs.js.map +1 -1
- package/dist/src/shadcn/components/ui/tabs.stories.js +405 -181
- package/dist/src/shadcn/components/ui/tabs.stories.js.map +1 -1
- package/dist/src/shadcn/components/ui/textarea.d.ts +8 -1
- package/dist/src/shadcn/components/ui/textarea.d.ts.map +1 -1
- package/dist/src/shadcn/components/ui/textarea.js +30 -2
- package/dist/src/shadcn/components/ui/textarea.js.map +1 -1
- package/dist/src/shadcn/components/ui/textarea.stories.js +85 -4
- package/dist/src/shadcn/components/ui/textarea.stories.js.map +1 -1
- package/dist/src/shadcn/components/ui/toggle-group.d.ts +3 -3
- package/dist/src/shadcn/components/ui/toggle-group.d.ts.map +1 -1
- package/dist/src/shadcn/components/ui/toggle-group.js +14 -12
- package/dist/src/shadcn/components/ui/toggle-group.js.map +1 -1
- package/dist/src/shadcn/components/ui/toggle.d.ts +3 -4
- package/dist/src/shadcn/components/ui/toggle.d.ts.map +1 -1
- package/dist/src/shadcn/components/ui/toggle.js +44 -16
- package/dist/src/shadcn/components/ui/toggle.js.map +1 -1
- package/dist/src/shadcn/components/ui/toggle.stories.js +130 -7
- package/dist/src/shadcn/components/ui/toggle.stories.js.map +1 -1
- package/dist/src/shadcn/components/ui/tooltip.d.ts.map +1 -1
- package/dist/src/shadcn/components/ui/tooltip.js +12 -1
- package/dist/src/shadcn/components/ui/tooltip.js.map +1 -1
- package/dist/src/shadcn/components/ui/tree.d.ts +29 -0
- package/dist/src/shadcn/components/ui/tree.d.ts.map +1 -0
- package/dist/src/shadcn/components/ui/tree.js +135 -0
- package/dist/src/shadcn/components/ui/tree.js.map +1 -0
- package/dist/src/shadcn/shadcn.css +4 -4
- package/dist/src/tokens.css +50 -20
- package/dist/src/typography.css +78 -15
- package/package.json +84 -64
- package/src/components/button-dropdown.stories.tsx +41 -0
- package/src/components/button-dropdown.tsx +97 -0
- package/src/components/code-editor/fhir-autocomplete.test.ts +993 -0
- package/src/components/code-editor/fhir-autocomplete.ts +2322 -0
- package/src/components/code-editor/http/grammar/http.grammar +74 -0
- package/src/components/code-editor/http/grammar/http.terms.ts +9 -0
- package/src/components/code-editor/http/grammar/http.test.ts +110 -0
- package/src/components/code-editor/http/grammar/http.ts +21 -0
- package/src/components/code-editor/http/index.ts +424 -0
- package/src/components/code-editor/index.tsx +1944 -42
- package/src/components/code-editor/json-ast.test.ts +230 -0
- package/src/components/code-editor/json-ast.ts +590 -0
- package/src/components/code-editor/sql-completion.ts +1112 -0
- package/src/components/code-editor.stories.tsx +325 -2
- package/src/components/copy-icon.tsx +57 -3
- package/src/components/data-table.stories.tsx +91 -0
- package/src/components/data-table.tsx +126 -0
- package/src/components/date-picker-input.stories.tsx +79 -0
- package/src/components/date-picker-input.tsx +104 -0
- package/src/components/fhir-structure-view.stories.tsx +439 -0
- package/src/components/fhir-structure-view.tsx +233 -0
- package/src/components/icon-button.stories.tsx +86 -0
- package/src/components/icon-button.tsx +57 -0
- package/src/components/operation-outcome-view.stories.tsx +163 -0
- package/src/components/operation-outcome-view.tsx +254 -0
- package/src/components/request-line-editor.stories.tsx +17 -27
- package/src/components/request-line-editor.tsx +103 -61
- package/src/components/sandbox.stories.tsx +131 -0
- package/src/components/sandbox.tsx +191 -0
- package/src/components/segment-control.stories.tsx +61 -0
- package/src/components/segment-control.tsx +83 -0
- package/src/components/split-button.stories.tsx +68 -0
- package/src/components/split-button.tsx +74 -0
- package/src/components/tag.stories.tsx +371 -0
- package/src/components/tag.tsx +236 -0
- package/src/components/tile.stories.tsx +149 -0
- package/src/components/tile.tsx +105 -0
- package/src/components/toolbar.stories.tsx +64 -0
- package/src/components/toolbar.tsx +98 -0
- package/src/components/tree-view.stories.tsx +265 -0
- package/src/components/tree-view.tsx +246 -0
- package/src/icons.tsx +331 -0
- package/src/index.css +358 -74
- package/src/index.tsx +17 -3
- package/src/shadcn/components/ui/accordion.tsx +91 -10
- package/src/shadcn/components/ui/alert-dialog.stories.tsx +209 -15
- package/src/shadcn/components/ui/alert-dialog.tsx +236 -26
- package/src/shadcn/components/ui/alert.stories.tsx +120 -21
- package/src/shadcn/components/ui/alert.tsx +125 -28
- package/src/shadcn/components/ui/aspect-ratio.tsx +1 -0
- package/src/shadcn/components/ui/avatar.stories.tsx +74 -1
- package/src/shadcn/components/ui/avatar.tsx +22 -6
- package/src/shadcn/components/ui/badge.tsx +67 -18
- package/src/shadcn/components/ui/breadcrumb.stories.tsx +161 -41
- package/src/shadcn/components/ui/breadcrumb.tsx +172 -23
- package/src/shadcn/components/ui/button.stories.tsx +106 -18
- package/src/shadcn/components/ui/button.tsx +151 -55
- package/src/shadcn/components/ui/calendar.tsx +1 -0
- package/src/shadcn/components/ui/card.stories.tsx +17 -3
- package/src/shadcn/components/ui/card.tsx +89 -14
- package/src/shadcn/components/ui/carousel.tsx +1 -0
- package/src/shadcn/components/ui/chart.tsx +9 -5
- package/src/shadcn/components/ui/checkbox.stories.tsx +78 -30
- package/src/shadcn/components/ui/checkbox.tsx +91 -8
- package/src/shadcn/components/ui/combobox.stories.tsx +148 -0
- package/src/shadcn/components/ui/combobox.tsx +324 -0
- package/src/shadcn/components/ui/command.stories.tsx +184 -39
- package/src/shadcn/components/ui/command.tsx +218 -37
- package/src/shadcn/components/ui/context-menu.tsx +333 -40
- package/src/shadcn/components/ui/dialog.tsx +101 -13
- package/src/shadcn/components/ui/drawer.tsx +94 -18
- package/src/shadcn/components/ui/dropdown-menu.stories.tsx +18 -2
- package/src/shadcn/components/ui/dropdown-menu.tsx +334 -68
- package/src/shadcn/components/ui/form.tsx +22 -11
- package/src/shadcn/components/ui/hover-card.tsx +2 -1
- package/src/shadcn/components/ui/input-otp.tsx +1 -0
- package/src/shadcn/components/ui/input.stories.tsx +235 -27
- package/src/shadcn/components/ui/input.tsx +400 -29
- package/src/shadcn/components/ui/label.tsx +22 -4
- package/src/shadcn/components/ui/menubar.tsx +188 -43
- package/src/shadcn/components/ui/pagination.stories.tsx +8 -2
- package/src/shadcn/components/ui/pagination.tsx +65 -8
- package/src/shadcn/components/ui/popover.tsx +36 -4
- package/src/shadcn/components/ui/progress.tsx +21 -5
- package/src/shadcn/components/ui/radio-button-group.stories.tsx +247 -0
- package/src/shadcn/components/ui/radio-button-group.tsx +188 -0
- package/src/shadcn/components/ui/radio-group.stories.tsx +70 -14
- package/src/shadcn/components/ui/radio-group.tsx +85 -9
- package/src/shadcn/components/ui/resizable.stories.tsx +2 -2
- package/src/shadcn/components/ui/resizable.tsx +2 -1
- package/src/shadcn/components/ui/scroll-area.tsx +34 -5
- package/src/shadcn/components/ui/select.stories.tsx +108 -32
- package/src/shadcn/components/ui/select.tsx +182 -36
- package/src/shadcn/components/ui/separator.tsx +16 -5
- package/src/shadcn/components/ui/sheet.tsx +1 -1
- package/src/shadcn/components/ui/sidebar.tsx +69 -26
- package/src/shadcn/components/ui/skeleton.tsx +4 -1
- package/src/shadcn/components/ui/slider.tsx +83 -11
- package/src/shadcn/components/ui/sonner.stories.tsx +238 -17
- package/src/shadcn/components/ui/sonner.tsx +254 -11
- package/src/shadcn/components/ui/switch.stories.tsx +52 -5
- package/src/shadcn/components/ui/switch.tsx +92 -7
- package/src/shadcn/components/ui/table.stories.tsx +252 -72
- package/src/shadcn/components/ui/table.tsx +204 -26
- package/src/shadcn/components/ui/tabs.stories.tsx +235 -123
- package/src/shadcn/components/ui/tabs.tsx +694 -36
- package/src/shadcn/components/ui/textarea.stories.tsx +94 -2
- package/src/shadcn/components/ui/textarea.tsx +70 -5
- package/src/shadcn/components/ui/toggle-group.tsx +35 -13
- package/src/shadcn/components/ui/toggle.stories.tsx +92 -5
- package/src/shadcn/components/ui/toggle.tsx +96 -23
- package/src/shadcn/components/ui/tooltip.tsx +34 -8
- package/src/shadcn/components/ui/tree.tsx +257 -0
- package/src/shadcn/shadcn.css +4 -4
- package/src/tokens.css +50 -20
- package/src/typography.css +78 -15
- package/dist/src/components/code-editor.stories.d.ts +0 -7
- package/dist/src/components/code-editor.stories.d.ts.map +0 -1
- package/dist/src/components/request-line-editor.stories.d.ts +0 -11
- package/dist/src/components/request-line-editor.stories.d.ts.map +0 -1
- package/dist/src/index.stories.d.ts +0 -14
- package/dist/src/index.stories.d.ts.map +0 -1
- package/dist/src/index.stories.js +0 -19
- package/dist/src/index.stories.js.map +0 -1
- package/dist/src/shadcn/components/ui/accordion.stories.d.ts +0 -8
- package/dist/src/shadcn/components/ui/accordion.stories.d.ts.map +0 -1
- package/dist/src/shadcn/components/ui/alert-dialog.stories.d.ts +0 -8
- package/dist/src/shadcn/components/ui/alert-dialog.stories.d.ts.map +0 -1
- package/dist/src/shadcn/components/ui/alert.stories.d.ts +0 -8
- package/dist/src/shadcn/components/ui/alert.stories.d.ts.map +0 -1
- package/dist/src/shadcn/components/ui/aspect-ratio.stories.d.ts +0 -8
- package/dist/src/shadcn/components/ui/aspect-ratio.stories.d.ts.map +0 -1
- package/dist/src/shadcn/components/ui/avatar.stories.d.ts +0 -8
- package/dist/src/shadcn/components/ui/avatar.stories.d.ts.map +0 -1
- package/dist/src/shadcn/components/ui/badge.stories.d.ts +0 -8
- package/dist/src/shadcn/components/ui/badge.stories.d.ts.map +0 -1
- package/dist/src/shadcn/components/ui/breadcrumb.stories.d.ts +0 -8
- package/dist/src/shadcn/components/ui/breadcrumb.stories.d.ts.map +0 -1
- package/dist/src/shadcn/components/ui/button.stories.d.ts +0 -23
- package/dist/src/shadcn/components/ui/button.stories.d.ts.map +0 -1
- package/dist/src/shadcn/components/ui/calendar.stories.d.ts +0 -8
- package/dist/src/shadcn/components/ui/calendar.stories.d.ts.map +0 -1
- package/dist/src/shadcn/components/ui/card.stories.d.ts +0 -8
- package/dist/src/shadcn/components/ui/card.stories.d.ts.map +0 -1
- package/dist/src/shadcn/components/ui/carousel.stories.d.ts +0 -8
- package/dist/src/shadcn/components/ui/carousel.stories.d.ts.map +0 -1
- package/dist/src/shadcn/components/ui/chart.stories.d.ts +0 -8
- package/dist/src/shadcn/components/ui/chart.stories.d.ts.map +0 -1
- package/dist/src/shadcn/components/ui/checkbox.stories.d.ts +0 -8
- package/dist/src/shadcn/components/ui/checkbox.stories.d.ts.map +0 -1
- package/dist/src/shadcn/components/ui/collapsible.stories.d.ts +0 -8
- package/dist/src/shadcn/components/ui/collapsible.stories.d.ts.map +0 -1
- package/dist/src/shadcn/components/ui/command.stories.d.ts +0 -8
- package/dist/src/shadcn/components/ui/command.stories.d.ts.map +0 -1
- package/dist/src/shadcn/components/ui/context-menu.stories.d.ts +0 -8
- package/dist/src/shadcn/components/ui/context-menu.stories.d.ts.map +0 -1
- package/dist/src/shadcn/components/ui/dialog.stories.d.ts +0 -8
- package/dist/src/shadcn/components/ui/dialog.stories.d.ts.map +0 -1
- package/dist/src/shadcn/components/ui/drawer.stories.d.ts +0 -8
- package/dist/src/shadcn/components/ui/drawer.stories.d.ts.map +0 -1
- package/dist/src/shadcn/components/ui/dropdown-menu.stories.d.ts +0 -8
- package/dist/src/shadcn/components/ui/dropdown-menu.stories.d.ts.map +0 -1
- package/dist/src/shadcn/components/ui/form.stories.d.ts +0 -8
- package/dist/src/shadcn/components/ui/form.stories.d.ts.map +0 -1
- package/dist/src/shadcn/components/ui/hover-card.stories.d.ts +0 -8
- package/dist/src/shadcn/components/ui/hover-card.stories.d.ts.map +0 -1
- package/dist/src/shadcn/components/ui/input-otp.stories.d.ts +0 -8
- package/dist/src/shadcn/components/ui/input-otp.stories.d.ts.map +0 -1
- package/dist/src/shadcn/components/ui/input.stories.d.ts +0 -18
- package/dist/src/shadcn/components/ui/input.stories.d.ts.map +0 -1
- package/dist/src/shadcn/components/ui/label.stories.d.ts +0 -8
- package/dist/src/shadcn/components/ui/label.stories.d.ts.map +0 -1
- package/dist/src/shadcn/components/ui/menubar.stories.d.ts +0 -8
- package/dist/src/shadcn/components/ui/menubar.stories.d.ts.map +0 -1
- package/dist/src/shadcn/components/ui/navigation-menu.stories.d.ts +0 -8
- package/dist/src/shadcn/components/ui/navigation-menu.stories.d.ts.map +0 -1
- package/dist/src/shadcn/components/ui/pagination.stories.d.ts +0 -8
- package/dist/src/shadcn/components/ui/pagination.stories.d.ts.map +0 -1
- package/dist/src/shadcn/components/ui/popover.stories.d.ts +0 -8
- package/dist/src/shadcn/components/ui/popover.stories.d.ts.map +0 -1
- package/dist/src/shadcn/components/ui/progress.stories.d.ts +0 -8
- package/dist/src/shadcn/components/ui/progress.stories.d.ts.map +0 -1
- package/dist/src/shadcn/components/ui/radio-group.stories.d.ts +0 -8
- package/dist/src/shadcn/components/ui/radio-group.stories.d.ts.map +0 -1
- package/dist/src/shadcn/components/ui/resizable.stories.d.ts +0 -8
- package/dist/src/shadcn/components/ui/resizable.stories.d.ts.map +0 -1
- package/dist/src/shadcn/components/ui/scroll-area.stories.d.ts +0 -8
- package/dist/src/shadcn/components/ui/scroll-area.stories.d.ts.map +0 -1
- package/dist/src/shadcn/components/ui/select.stories.d.ts +0 -11
- package/dist/src/shadcn/components/ui/select.stories.d.ts.map +0 -1
- package/dist/src/shadcn/components/ui/separator.stories.d.ts +0 -8
- package/dist/src/shadcn/components/ui/separator.stories.d.ts.map +0 -1
- package/dist/src/shadcn/components/ui/sheet.stories.d.ts +0 -8
- package/dist/src/shadcn/components/ui/sheet.stories.d.ts.map +0 -1
- package/dist/src/shadcn/components/ui/sidebar.stories.d.ts +0 -11
- package/dist/src/shadcn/components/ui/sidebar.stories.d.ts.map +0 -1
- package/dist/src/shadcn/components/ui/skeleton.stories.d.ts +0 -8
- package/dist/src/shadcn/components/ui/skeleton.stories.d.ts.map +0 -1
- package/dist/src/shadcn/components/ui/slider.stories.d.ts +0 -8
- package/dist/src/shadcn/components/ui/slider.stories.d.ts.map +0 -1
- package/dist/src/shadcn/components/ui/sonner.stories.d.ts +0 -8
- package/dist/src/shadcn/components/ui/sonner.stories.d.ts.map +0 -1
- package/dist/src/shadcn/components/ui/switch.stories.d.ts +0 -8
- package/dist/src/shadcn/components/ui/switch.stories.d.ts.map +0 -1
- package/dist/src/shadcn/components/ui/table.stories.d.ts +0 -8
- package/dist/src/shadcn/components/ui/table.stories.d.ts.map +0 -1
- package/dist/src/shadcn/components/ui/tabs.stories.d.ts +0 -32
- package/dist/src/shadcn/components/ui/tabs.stories.d.ts.map +0 -1
- package/dist/src/shadcn/components/ui/textarea.stories.d.ts +0 -8
- package/dist/src/shadcn/components/ui/textarea.stories.d.ts.map +0 -1
- package/dist/src/shadcn/components/ui/toggle-group.stories.d.ts +0 -8
- package/dist/src/shadcn/components/ui/toggle-group.stories.d.ts.map +0 -1
- package/dist/src/shadcn/components/ui/toggle.stories.d.ts +0 -8
- package/dist/src/shadcn/components/ui/toggle.stories.d.ts.map +0 -1
- package/dist/src/shadcn/components/ui/tooltip.stories.d.ts +0 -8
- package/dist/src/shadcn/components/ui/tooltip.stories.d.ts.map +0 -1
- package/src/index.stories.tsx +0 -21
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Activity, BarChart3, Settings, Users } from "lucide-react";
|
|
3
|
+
import { Tile } from "./tile.js";
|
|
4
|
+
const meta = {
|
|
5
|
+
title: "Component/Tile",
|
|
6
|
+
component: Tile,
|
|
7
|
+
parameters: {
|
|
8
|
+
layout: "centered"
|
|
9
|
+
},
|
|
10
|
+
tags: [
|
|
11
|
+
"autodocs"
|
|
12
|
+
],
|
|
13
|
+
argTypes: {
|
|
14
|
+
size: {
|
|
15
|
+
control: {
|
|
16
|
+
type: "select"
|
|
17
|
+
},
|
|
18
|
+
options: [
|
|
19
|
+
"auto",
|
|
20
|
+
"free"
|
|
21
|
+
]
|
|
22
|
+
},
|
|
23
|
+
showIcon: {
|
|
24
|
+
control: {
|
|
25
|
+
type: "boolean"
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
icon: {
|
|
29
|
+
control: {
|
|
30
|
+
type: "select"
|
|
31
|
+
},
|
|
32
|
+
options: [
|
|
33
|
+
"Activity",
|
|
34
|
+
"Users",
|
|
35
|
+
"Settings",
|
|
36
|
+
"BarChart"
|
|
37
|
+
],
|
|
38
|
+
mapping: {
|
|
39
|
+
Activity: /*#__PURE__*/ _jsx(Activity, {}),
|
|
40
|
+
Users: /*#__PURE__*/ _jsx(Users, {}),
|
|
41
|
+
Settings: /*#__PURE__*/ _jsx(Settings, {}),
|
|
42
|
+
BarChart: /*#__PURE__*/ _jsx(BarChart3, {})
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
width: {
|
|
46
|
+
control: {
|
|
47
|
+
type: "text"
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
export default meta;
|
|
53
|
+
const ActivityIcon = ()=>/*#__PURE__*/ _jsx(Activity, {});
|
|
54
|
+
const UsersIcon = ()=>/*#__PURE__*/ _jsx(Users, {});
|
|
55
|
+
const SettingsIcon = ()=>/*#__PURE__*/ _jsx(Settings, {});
|
|
56
|
+
const BarChartIcon = ()=>/*#__PURE__*/ _jsx(BarChart3, {});
|
|
57
|
+
export const Default = {
|
|
58
|
+
args: {
|
|
59
|
+
label: "Active Apps",
|
|
60
|
+
value: "0",
|
|
61
|
+
icon: /*#__PURE__*/ _jsx(ActivityIcon, {}),
|
|
62
|
+
showIcon: true
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
export const WithIcon = {
|
|
66
|
+
args: {
|
|
67
|
+
label: "Active Apps",
|
|
68
|
+
value: "0",
|
|
69
|
+
icon: /*#__PURE__*/ _jsx(ActivityIcon, {}),
|
|
70
|
+
showIcon: true
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
export const AutoSize = {
|
|
74
|
+
args: {
|
|
75
|
+
label: "Users",
|
|
76
|
+
value: "1,234",
|
|
77
|
+
icon: /*#__PURE__*/ _jsx(UsersIcon, {}),
|
|
78
|
+
showIcon: true,
|
|
79
|
+
size: "auto"
|
|
80
|
+
}
|
|
81
|
+
};
|
|
82
|
+
export const FreeSize = {
|
|
83
|
+
args: {
|
|
84
|
+
label: "Total Revenue",
|
|
85
|
+
value: "$12,345",
|
|
86
|
+
icon: /*#__PURE__*/ _jsx(BarChartIcon, {}),
|
|
87
|
+
showIcon: true,
|
|
88
|
+
size: "free"
|
|
89
|
+
}
|
|
90
|
+
};
|
|
91
|
+
export const CustomWidth = {
|
|
92
|
+
args: {
|
|
93
|
+
label: "Settings",
|
|
94
|
+
value: "Configured",
|
|
95
|
+
icon: /*#__PURE__*/ _jsx(SettingsIcon, {}),
|
|
96
|
+
showIcon: true,
|
|
97
|
+
width: "200px"
|
|
98
|
+
}
|
|
99
|
+
};
|
|
100
|
+
export const WithoutIcon = {
|
|
101
|
+
args: {
|
|
102
|
+
label: "Simple Tile",
|
|
103
|
+
value: "No Icon",
|
|
104
|
+
showIcon: false
|
|
105
|
+
}
|
|
106
|
+
};
|
|
107
|
+
export const OnlyLabel = {
|
|
108
|
+
args: {
|
|
109
|
+
label: "Status",
|
|
110
|
+
showIcon: false
|
|
111
|
+
}
|
|
112
|
+
};
|
|
113
|
+
export const OnlyValue = {
|
|
114
|
+
args: {
|
|
115
|
+
value: "42",
|
|
116
|
+
showIcon: false
|
|
117
|
+
}
|
|
118
|
+
};
|
|
119
|
+
export const Grid = {
|
|
120
|
+
render: ()=>/*#__PURE__*/ _jsxs("div", {
|
|
121
|
+
className: "grid grid-cols-3 gap-4 w-full max-w-4xl",
|
|
122
|
+
children: [
|
|
123
|
+
/*#__PURE__*/ _jsx(Tile, {
|
|
124
|
+
label: "Active Apps",
|
|
125
|
+
value: "0",
|
|
126
|
+
icon: /*#__PURE__*/ _jsx(ActivityIcon, {}),
|
|
127
|
+
showIcon: true,
|
|
128
|
+
size: "free"
|
|
129
|
+
}),
|
|
130
|
+
/*#__PURE__*/ _jsx(Tile, {
|
|
131
|
+
label: "Users",
|
|
132
|
+
value: "1,234",
|
|
133
|
+
icon: /*#__PURE__*/ _jsx(UsersIcon, {}),
|
|
134
|
+
showIcon: true,
|
|
135
|
+
size: "free"
|
|
136
|
+
}),
|
|
137
|
+
/*#__PURE__*/ _jsx(Tile, {
|
|
138
|
+
label: "Revenue",
|
|
139
|
+
value: "$12,345",
|
|
140
|
+
icon: /*#__PURE__*/ _jsx(BarChartIcon, {}),
|
|
141
|
+
showIcon: true,
|
|
142
|
+
size: "free"
|
|
143
|
+
}),
|
|
144
|
+
/*#__PURE__*/ _jsx(Tile, {
|
|
145
|
+
label: "Settings",
|
|
146
|
+
value: "Configured",
|
|
147
|
+
icon: /*#__PURE__*/ _jsx(SettingsIcon, {}),
|
|
148
|
+
showIcon: true,
|
|
149
|
+
size: "free"
|
|
150
|
+
}),
|
|
151
|
+
/*#__PURE__*/ _jsx(Tile, {
|
|
152
|
+
label: "Simple",
|
|
153
|
+
value: "No Icon",
|
|
154
|
+
showIcon: false,
|
|
155
|
+
size: "free"
|
|
156
|
+
}),
|
|
157
|
+
/*#__PURE__*/ _jsx(Tile, {
|
|
158
|
+
label: "Status",
|
|
159
|
+
value: "Online",
|
|
160
|
+
showIcon: false,
|
|
161
|
+
size: "free"
|
|
162
|
+
})
|
|
163
|
+
]
|
|
164
|
+
})
|
|
165
|
+
};
|
|
166
|
+
|
|
167
|
+
//# sourceMappingURL=tile.stories.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/components/tile.stories.tsx"],"sourcesContent":["import type { Meta, StoryObj } from \"@storybook/react-vite\";\nimport { Activity, BarChart3, Settings, Users } from \"lucide-react\";\nimport { Tile } from \"./tile\";\n\nconst meta: Meta<typeof Tile> = {\n\ttitle: \"Component/Tile\",\n\tcomponent: Tile,\n\tparameters: {\n\t\tlayout: \"centered\",\n\t},\n\ttags: [\"autodocs\"],\n\targTypes: {\n\t\tsize: {\n\t\t\tcontrol: { type: \"select\" },\n\t\t\toptions: [\"auto\", \"free\"],\n\t\t},\n\t\tshowIcon: {\n\t\t\tcontrol: { type: \"boolean\" },\n\t\t},\n\t\ticon: {\n\t\t\tcontrol: { type: \"select\" },\n\t\t\toptions: [\"Activity\", \"Users\", \"Settings\", \"BarChart\"],\n\t\t\tmapping: {\n\t\t\t\tActivity: <Activity />,\n\t\t\t\tUsers: <Users />,\n\t\t\t\tSettings: <Settings />,\n\t\t\t\tBarChart: <BarChart3 />,\n\t\t\t},\n\t\t},\n\t\twidth: {\n\t\t\tcontrol: { type: \"text\" },\n\t\t},\n\t},\n};\n\nexport default meta;\ntype Story = StoryObj<typeof meta>;\n\nconst ActivityIcon = () => <Activity />;\nconst UsersIcon = () => <Users />;\nconst SettingsIcon = () => <Settings />;\nconst BarChartIcon = () => <BarChart3 />;\n\nexport const Default: Story = {\n\targs: {\n\t\tlabel: \"Active Apps\",\n\t\tvalue: \"0\",\n\t\ticon: <ActivityIcon />,\n\t\tshowIcon: true,\n\t},\n};\n\nexport const WithIcon: Story = {\n\targs: {\n\t\tlabel: \"Active Apps\",\n\t\tvalue: \"0\",\n\t\ticon: <ActivityIcon />,\n\t\tshowIcon: true,\n\t},\n};\n\nexport const AutoSize: Story = {\n\targs: {\n\t\tlabel: \"Users\",\n\t\tvalue: \"1,234\",\n\t\ticon: <UsersIcon />,\n\t\tshowIcon: true,\n\t\tsize: \"auto\",\n\t},\n};\n\nexport const FreeSize: Story = {\n\targs: {\n\t\tlabel: \"Total Revenue\",\n\t\tvalue: \"$12,345\",\n\t\ticon: <BarChartIcon />,\n\t\tshowIcon: true,\n\t\tsize: \"free\",\n\t},\n};\n\nexport const CustomWidth: Story = {\n\targs: {\n\t\tlabel: \"Settings\",\n\t\tvalue: \"Configured\",\n\t\ticon: <SettingsIcon />,\n\t\tshowIcon: true,\n\t\twidth: \"200px\",\n\t},\n};\n\nexport const WithoutIcon: Story = {\n\targs: {\n\t\tlabel: \"Simple Tile\",\n\t\tvalue: \"No Icon\",\n\t\tshowIcon: false,\n\t},\n};\n\nexport const OnlyLabel: Story = {\n\targs: {\n\t\tlabel: \"Status\",\n\t\tshowIcon: false,\n\t},\n};\n\nexport const OnlyValue: Story = {\n\targs: {\n\t\tvalue: \"42\",\n\t\tshowIcon: false,\n\t},\n};\n\nexport const Grid: Story = {\n\trender: () => (\n\t\t<div className=\"grid grid-cols-3 gap-4 w-full max-w-4xl\">\n\t\t\t<Tile\n\t\t\t\tlabel=\"Active Apps\"\n\t\t\t\tvalue=\"0\"\n\t\t\t\ticon={<ActivityIcon />}\n\t\t\t\tshowIcon={true}\n\t\t\t\tsize=\"free\"\n\t\t\t/>\n\t\t\t<Tile\n\t\t\t\tlabel=\"Users\"\n\t\t\t\tvalue=\"1,234\"\n\t\t\t\ticon={<UsersIcon />}\n\t\t\t\tshowIcon={true}\n\t\t\t\tsize=\"free\"\n\t\t\t/>\n\t\t\t<Tile\n\t\t\t\tlabel=\"Revenue\"\n\t\t\t\tvalue=\"$12,345\"\n\t\t\t\ticon={<BarChartIcon />}\n\t\t\t\tshowIcon={true}\n\t\t\t\tsize=\"free\"\n\t\t\t/>\n\t\t\t<Tile\n\t\t\t\tlabel=\"Settings\"\n\t\t\t\tvalue=\"Configured\"\n\t\t\t\ticon={<SettingsIcon />}\n\t\t\t\tshowIcon={true}\n\t\t\t\tsize=\"free\"\n\t\t\t/>\n\t\t\t<Tile label=\"Simple\" value=\"No Icon\" showIcon={false} size=\"free\" />\n\t\t\t<Tile label=\"Status\" value=\"Online\" showIcon={false} size=\"free\" />\n\t\t</div>\n\t),\n};\n"],"names":["Activity","BarChart3","Settings","Users","Tile","meta","title","component","parameters","layout","tags","argTypes","size","control","type","options","showIcon","icon","mapping","BarChart","width","ActivityIcon","UsersIcon","SettingsIcon","BarChartIcon","Default","args","label","value","WithIcon","AutoSize","FreeSize","CustomWidth","WithoutIcon","OnlyLabel","OnlyValue","Grid","render","div","className"],"mappings":";AACA,SAASA,QAAQ,EAAEC,SAAS,EAAEC,QAAQ,EAAEC,KAAK,QAAQ,eAAe;AACpE,SAASC,IAAI,QAAQ,YAAS;AAE9B,MAAMC,OAA0B;IAC/BC,OAAO;IACPC,WAAWH;IACXI,YAAY;QACXC,QAAQ;IACT;IACAC,MAAM;QAAC;KAAW;IAClBC,UAAU;QACTC,MAAM;YACLC,SAAS;gBAAEC,MAAM;YAAS;YAC1BC,SAAS;gBAAC;gBAAQ;aAAO;QAC1B;QACAC,UAAU;YACTH,SAAS;gBAAEC,MAAM;YAAU;QAC5B;QACAG,MAAM;YACLJ,SAAS;gBAAEC,MAAM;YAAS;YAC1BC,SAAS;gBAAC;gBAAY;gBAAS;gBAAY;aAAW;YACtDG,SAAS;gBACRlB,wBAAU,KAACA;gBACXG,qBAAO,KAACA;gBACRD,wBAAU,KAACA;gBACXiB,wBAAU,KAAClB;YACZ;QACD;QACAmB,OAAO;YACNP,SAAS;gBAAEC,MAAM;YAAO;QACzB;IACD;AACD;AAEA,eAAeT,KAAK;AAGpB,MAAMgB,eAAe,kBAAM,KAACrB;AAC5B,MAAMsB,YAAY,kBAAM,KAACnB;AACzB,MAAMoB,eAAe,kBAAM,KAACrB;AAC5B,MAAMsB,eAAe,kBAAM,KAACvB;AAE5B,OAAO,MAAMwB,UAAiB;IAC7BC,MAAM;QACLC,OAAO;QACPC,OAAO;QACPX,oBAAM,KAACI;QACPL,UAAU;IACX;A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UZ,UAAU;oBAAOJ,MAAK;;8BAC3D,KAACR;oBAAKuB,OAAM;oBAASC,OAAM;oBAASZ,UAAU;oBAAOJ,MAAK;;;;AAG7D,EAAE"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type React from "react";
|
|
2
|
+
export interface ToolbarProps extends Omit<React.ComponentProps<"div">, "children"> {
|
|
3
|
+
segmentControlValue?: string;
|
|
4
|
+
onSegmentControlChange?: (value: string) => void;
|
|
5
|
+
segmentControlItems?: {
|
|
6
|
+
value: string;
|
|
7
|
+
label: React.ReactNode;
|
|
8
|
+
}[];
|
|
9
|
+
onCopyClick?: () => void;
|
|
10
|
+
onAlignLeftClick?: () => void;
|
|
11
|
+
onDownloadClick?: () => void;
|
|
12
|
+
showCopy?: boolean;
|
|
13
|
+
showAlignLeft?: boolean;
|
|
14
|
+
showDownload?: boolean;
|
|
15
|
+
}
|
|
16
|
+
declare function Toolbar({ segmentControlValue, onSegmentControlChange, segmentControlItems, onCopyClick, onAlignLeftClick, onDownloadClick, showCopy, showAlignLeft, showDownload, className, ...props }: ToolbarProps): import("react/jsx-runtime").JSX.Element;
|
|
17
|
+
export { Toolbar };
|
|
18
|
+
//# sourceMappingURL=toolbar.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"toolbar.d.ts","sourceRoot":"","sources":["../../../src/components/toolbar.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAiC/B,MAAM,WAAW,YAChB,SAAQ,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,EAAE,UAAU,CAAC;IACrD,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,sBAAsB,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACjD,mBAAmB,CAAC,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,KAAK,CAAC,SAAS,CAAA;KAAE,EAAE,CAAC;IAClE,WAAW,CAAC,EAAE,MAAM,IAAI,CAAC;IACzB,gBAAgB,CAAC,EAAE,MAAM,IAAI,CAAC;IAC9B,eAAe,CAAC,EAAE,MAAM,IAAI,CAAC;IAC7B,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,YAAY,CAAC,EAAE,OAAO,CAAC;CACvB;AAED,iBAAS,OAAO,CAAC,EAChB,mBAA4B,EAC5B,sBAAsB,EACtB,mBAGC,EACD,WAAW,EACX,gBAAgB,EAChB,eAAe,EACf,QAAe,EACf,aAAoB,EACpB,YAAmB,EACnB,SAAS,EACT,GAAG,KAAK,EACR,EAAE,YAAY,2CAiCd;AAED,OAAO,EAAE,OAAO,EAAE,CAAC"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { AlignLeft, Copy, Download } from "lucide-react";
|
|
3
|
+
import { cn } from "../shadcn/lib/utils.js";
|
|
4
|
+
import { IconButton } from "./icon-button.js";
|
|
5
|
+
import { SegmentControl } from "./segment-control.js";
|
|
6
|
+
// Styles
|
|
7
|
+
const toolbarContainerStyles = cn(// Layout
|
|
8
|
+
"inline-flex", "items-center", "gap-2", // Spacing
|
|
9
|
+
"pl-[9px]", "pr-2", "py-2", // Background
|
|
10
|
+
"bg-bg-primary", // Border
|
|
11
|
+
"border", "border-border-secondary", // Shape
|
|
12
|
+
"rounded-full", // Shadow
|
|
13
|
+
"toolbar-shadow");
|
|
14
|
+
const iconsContainerStyles = cn(// Layout
|
|
15
|
+
"flex", "items-center", "gap-0");
|
|
16
|
+
function Toolbar({ segmentControlValue = "json", onSegmentControlChange, segmentControlItems = [
|
|
17
|
+
{
|
|
18
|
+
value: "json",
|
|
19
|
+
label: "JSON"
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
value: "yaml",
|
|
23
|
+
label: "YAML"
|
|
24
|
+
}
|
|
25
|
+
], onCopyClick, onAlignLeftClick, onDownloadClick, showCopy = true, showAlignLeft = true, showDownload = true, className, ...props }) {
|
|
26
|
+
return /*#__PURE__*/ _jsxs("div", {
|
|
27
|
+
"data-slot": "toolbar",
|
|
28
|
+
className: cn(toolbarContainerStyles, className),
|
|
29
|
+
...props,
|
|
30
|
+
children: [
|
|
31
|
+
/*#__PURE__*/ _jsx(SegmentControl, {
|
|
32
|
+
value: segmentControlValue,
|
|
33
|
+
onValueChange: onSegmentControlChange || (()=>{}),
|
|
34
|
+
items: segmentControlItems
|
|
35
|
+
}),
|
|
36
|
+
/*#__PURE__*/ _jsxs("div", {
|
|
37
|
+
className: iconsContainerStyles,
|
|
38
|
+
children: [
|
|
39
|
+
showCopy && /*#__PURE__*/ _jsx(IconButton, {
|
|
40
|
+
icon: /*#__PURE__*/ _jsx(Copy, {}),
|
|
41
|
+
"aria-label": "Copy",
|
|
42
|
+
onClick: onCopyClick
|
|
43
|
+
}),
|
|
44
|
+
showAlignLeft && /*#__PURE__*/ _jsx(IconButton, {
|
|
45
|
+
icon: /*#__PURE__*/ _jsx(AlignLeft, {}),
|
|
46
|
+
"aria-label": "Align left",
|
|
47
|
+
onClick: onAlignLeftClick
|
|
48
|
+
}),
|
|
49
|
+
showDownload && /*#__PURE__*/ _jsx(IconButton, {
|
|
50
|
+
icon: /*#__PURE__*/ _jsx(Download, {}),
|
|
51
|
+
"aria-label": "Download",
|
|
52
|
+
onClick: onDownloadClick
|
|
53
|
+
})
|
|
54
|
+
]
|
|
55
|
+
})
|
|
56
|
+
]
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
export { Toolbar };
|
|
60
|
+
|
|
61
|
+
//# sourceMappingURL=toolbar.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/components/toolbar.tsx"],"sourcesContent":["import { AlignLeft, Copy, Download } from \"lucide-react\";\nimport type React from \"react\";\nimport { cn } from \"#shadcn/lib/utils\";\nimport { IconButton } from \"./icon-button\";\nimport { SegmentControl } from \"./segment-control\";\n\n// Styles\nconst toolbarContainerStyles = cn(\n\t// Layout\n\t\"inline-flex\",\n\t\"items-center\",\n\t\"gap-2\",\n\t// Spacing\n\t\"pl-[9px]\",\n\t\"pr-2\",\n\t\"py-2\",\n\t// Background\n\t\"bg-bg-primary\",\n\t// Border\n\t\"border\",\n\t\"border-border-secondary\",\n\t// Shape\n\t\"rounded-full\",\n\t// Shadow\n\t\"toolbar-shadow\",\n);\n\nconst iconsContainerStyles = cn(\n\t// Layout\n\t\"flex\",\n\t\"items-center\",\n\t\"gap-0\",\n);\n\nexport interface ToolbarProps\n\textends Omit<React.ComponentProps<\"div\">, \"children\"> {\n\tsegmentControlValue?: string;\n\tonSegmentControlChange?: (value: string) => void;\n\tsegmentControlItems?: { value: string; label: React.ReactNode }[];\n\tonCopyClick?: () => void;\n\tonAlignLeftClick?: () => void;\n\tonDownloadClick?: () => void;\n\tshowCopy?: boolean;\n\tshowAlignLeft?: boolean;\n\tshowDownload?: boolean;\n}\n\nfunction Toolbar({\n\tsegmentControlValue = \"json\",\n\tonSegmentControlChange,\n\tsegmentControlItems = [\n\t\t{ value: \"json\", label: \"JSON\" },\n\t\t{ value: \"yaml\", label: \"YAML\" },\n\t],\n\tonCopyClick,\n\tonAlignLeftClick,\n\tonDownloadClick,\n\tshowCopy = true,\n\tshowAlignLeft = true,\n\tshowDownload = true,\n\tclassName,\n\t...props\n}: ToolbarProps) {\n\treturn (\n\t\t<div\n\t\t\tdata-slot=\"toolbar\"\n\t\t\tclassName={cn(toolbarContainerStyles, className)}\n\t\t\t{...props}\n\t\t>\n\t\t\t<SegmentControl\n\t\t\t\tvalue={segmentControlValue}\n\t\t\t\tonValueChange={onSegmentControlChange || (() => {})}\n\t\t\t\titems={segmentControlItems}\n\t\t\t/>\n\t\t\t<div className={iconsContainerStyles}>\n\t\t\t\t{showCopy && (\n\t\t\t\t\t<IconButton icon={<Copy />} aria-label=\"Copy\" onClick={onCopyClick} />\n\t\t\t\t)}\n\t\t\t\t{showAlignLeft && (\n\t\t\t\t\t<IconButton\n\t\t\t\t\t\ticon={<AlignLeft />}\n\t\t\t\t\t\taria-label=\"Align left\"\n\t\t\t\t\t\tonClick={onAlignLeftClick}\n\t\t\t\t\t/>\n\t\t\t\t)}\n\t\t\t\t{showDownload && (\n\t\t\t\t\t<IconButton\n\t\t\t\t\t\ticon={<Download />}\n\t\t\t\t\t\taria-label=\"Download\"\n\t\t\t\t\t\tonClick={onDownloadClick}\n\t\t\t\t\t/>\n\t\t\t\t)}\n\t\t\t</div>\n\t\t</div>\n\t);\n}\n\nexport { Toolbar };\n"],"names":["AlignLeft","Copy","Download","cn","IconButton","SegmentControl","toolbarContainerStyles","iconsContainerStyles","Toolbar","segmentControlValue","onSegmentControlChange","segmentControlItems","value","label","onCopyClick","onAlignLeftClick","onDownloadClick","showCopy","showAlignLeft","showDownload","className","props","div","data-slot","onValueChange","items","icon","aria-label","onClick"],"mappings":";AAAA,SAASA,SAAS,EAAEC,IAAI,EAAEC,QAAQ,QAAQ,eAAe;AAEzD,SAASC,EAAE,QAAQ,yBAAoB;AACvC,SAASC,UAAU,QAAQ,mBAAgB;AAC3C,SAASC,cAAc,QAAQ,uBAAoB;AAEnD,SAAS;AACT,MAAMC,yBAAyBH,GAC9B,SAAS;AACT,eACA,gBACA,SACA,UAAU;AACV,YACA,QACA,QACA,aAAa;AACb,iBACA,SAAS;AACT,UACA,2BACA,QAAQ;AACR,gBACA,SAAS;AACT;AAGD,MAAMI,uBAAuBJ,GAC5B,SAAS;AACT,QACA,gBACA;AAgBD,SAASK,QAAQ,EAChBC,sBAAsB,MAAM,EAC5BC,sBAAsB,EACtBC,sBAAsB;IACrB;QAAEC,OAAO;QAAQC,OAAO;IAAO;IAC/B;QAAED,OAAO;QAAQC,OAAO;IAAO;CAC/B,EACDC,WAAW,EACXC,gBAAgB,EAChBC,eAAe,EACfC,WAAW,IAAI,EACfC,gBAAgB,IAAI,EACpBC,eAAe,IAAI,EACnBC,SAAS,EACT,GAAGC,OACW;IACd,qBACC,MAACC;QACAC,aAAU;QACVH,WAAWjB,GAAGG,wBAAwBc;QACrC,GAAGC,KAAK;;0BAET,KAAChB;gBACAO,OAAOH;gBACPe,eAAed,0BAA2B,CAAA,KAAO,CAAA;gBACjDe,OAAOd;;0BAER,MAACW;gBAAIF,WAAWb;;oBACdU,0BACA,KAACb;wBAAWsB,oBAAM,KAACzB;wBAAS0B,cAAW;wBAAOC,SAASd;;oBAEvDI,+BACA,KAACd;wBACAsB,oBAAM,KAAC1B;wBACP2B,cAAW;wBACXC,SAASb;;oBAGVI,8BACA,KAACf;wBACAsB,oBAAM,KAACxB;wBACPyB,cAAW;wBACXC,SAASZ;;;;;;AAMf;AAEA,SAASR,OAAO,GAAG"}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useState } from "react";
|
|
3
|
+
import { Toolbar } from "./toolbar.js";
|
|
4
|
+
const meta = {
|
|
5
|
+
title: "Component/Toolbar",
|
|
6
|
+
component: Toolbar,
|
|
7
|
+
parameters: {
|
|
8
|
+
layout: "centered"
|
|
9
|
+
},
|
|
10
|
+
tags: [
|
|
11
|
+
"autodocs"
|
|
12
|
+
]
|
|
13
|
+
};
|
|
14
|
+
export default meta;
|
|
15
|
+
export const Default = {
|
|
16
|
+
args: {
|
|
17
|
+
segmentControlValue: "json",
|
|
18
|
+
onSegmentControlChange: ()=>{},
|
|
19
|
+
segmentControlItems: [
|
|
20
|
+
{
|
|
21
|
+
value: "json",
|
|
22
|
+
label: "JSON"
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
value: "yaml",
|
|
26
|
+
label: "YAML"
|
|
27
|
+
}
|
|
28
|
+
],
|
|
29
|
+
showCopy: true,
|
|
30
|
+
showAlignLeft: true,
|
|
31
|
+
showDownload: true
|
|
32
|
+
},
|
|
33
|
+
render: (args)=>{
|
|
34
|
+
const [value, setValue] = useState(args.segmentControlValue || "json");
|
|
35
|
+
return /*#__PURE__*/ _jsx(Toolbar, {
|
|
36
|
+
...args,
|
|
37
|
+
segmentControlValue: value,
|
|
38
|
+
onSegmentControlChange: setValue
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
export const WithCustomActions = {
|
|
43
|
+
args: {
|
|
44
|
+
segmentControlValue: "json",
|
|
45
|
+
segmentControlItems: [
|
|
46
|
+
{
|
|
47
|
+
value: "json",
|
|
48
|
+
label: "JSON"
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
value: "yaml",
|
|
52
|
+
label: "YAML"
|
|
53
|
+
}
|
|
54
|
+
],
|
|
55
|
+
showCopy: true,
|
|
56
|
+
showAlignLeft: false,
|
|
57
|
+
showDownload: true
|
|
58
|
+
},
|
|
59
|
+
render: (args)=>{
|
|
60
|
+
const [value, setValue] = useState(args.segmentControlValue || "json");
|
|
61
|
+
return /*#__PURE__*/ _jsx(Toolbar, {
|
|
62
|
+
...args,
|
|
63
|
+
segmentControlValue: value,
|
|
64
|
+
onSegmentControlChange: setValue
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
//# sourceMappingURL=toolbar.stories.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/components/toolbar.stories.tsx"],"sourcesContent":["import type { Meta, StoryObj } from \"@storybook/react-vite\";\nimport { useState } from \"react\";\nimport { Toolbar } from \"./toolbar\";\n\nconst meta = {\n\ttitle: \"Component/Toolbar\",\n\tcomponent: Toolbar,\n\tparameters: {\n\t\tlayout: \"centered\",\n\t},\n\ttags: [\"autodocs\"],\n} satisfies Meta<typeof Toolbar>;\n\nexport default meta;\ntype Story = StoryObj<typeof meta>;\n\nexport const Default: Story = {\n\targs: {\n\t\tsegmentControlValue: \"json\",\n\t\tonSegmentControlChange: () => {},\n\t\tsegmentControlItems: [\n\t\t\t{ value: \"json\", label: \"JSON\" },\n\t\t\t{ value: \"yaml\", label: \"YAML\" },\n\t\t],\n\t\tshowCopy: true,\n\t\tshowAlignLeft: true,\n\t\tshowDownload: true,\n\t},\n\trender: (args) => {\n\t\tconst [value, setValue] = useState(args.segmentControlValue || \"json\");\n\n\t\treturn (\n\t\t\t<Toolbar\n\t\t\t\t{...args}\n\t\t\t\tsegmentControlValue={value}\n\t\t\t\tonSegmentControlChange={setValue}\n\t\t\t/>\n\t\t);\n\t},\n};\n\nexport const WithCustomActions: Story = {\n\targs: {\n\t\tsegmentControlValue: \"json\",\n\t\tsegmentControlItems: [\n\t\t\t{ value: \"json\", label: \"JSON\" },\n\t\t\t{ value: \"yaml\", label: \"YAML\" },\n\t\t],\n\t\tshowCopy: true,\n\t\tshowAlignLeft: false,\n\t\tshowDownload: true,\n\t},\n\trender: (args) => {\n\t\tconst [value, setValue] = useState(args.segmentControlValue || \"json\");\n\n\t\treturn (\n\t\t\t<Toolbar\n\t\t\t\t{...args}\n\t\t\t\tsegmentControlValue={value}\n\t\t\t\tonSegmentControlChange={setValue}\n\t\t\t/>\n\t\t);\n\t},\n};\n"],"names":["useState","Toolbar","meta","title","component","parameters","layout","tags","Default","args","segmentControlValue","onSegmentControlChange","segmentControlItems","value","label","showCopy","showAlignLeft","showDownload","render","setValue","WithCustomActions"],"mappings":";AACA,SAASA,QAAQ,QAAQ,QAAQ;AACjC,SAASC,OAAO,QAAQ,eAAY;AAEpC,MAAMC,OAAO;IACZC,OAAO;IACPC,WAAWH;IACXI,YAAY;QACXC,QAAQ;IACT;IACAC,MAAM;QAAC;KAAW;AACnB;AAEA,eAAeL,KAAK;AAGpB,OAAO,MAAMM,UAAiB;IAC7BC,MAAM;QACLC,qBAAqB;QACrBC,wBAAwB,KAAO;QAC/BC,qBAAqB;YACpB;gBAAEC,OAAO;gBAAQC,OAAO;YAAO;YAC/B;gBAAED,OAAO;gBAAQC,OAAO;YAAO;SAC/B;QACDC,UAAU;QACVC,eAAe;QACfC,cAAc;IACf;IACAC,QAAQ,CAACT;QACR,MAAM,CAACI,OAAOM,SAAS,GAAGnB,SAASS,KAAKC,mBAAmB,IAAI;QAE/D,qBACC,KAACT;YACC,GAAGQ,IAAI;YACRC,qBAAqBG;YACrBF,wBAAwBQ;;IAG3B;AACD,EAAE;AAEF,OAAO,MAAMC,oBAA2B;IACvCX,MAAM;QACLC,qBAAqB;QACrBE,qBAAqB;YACpB;gBAAEC,OAAO;gBAAQC,OAAO;YAAO;YAC/B;gBAAED,OAAO;gBAAQC,OAAO;YAAO;SAC/B;QACDC,UAAU;QACVC,eAAe;QACfC,cAAc;IACf;IACAC,QAAQ,CAACT;QACR,MAAM,CAACI,OAAOM,SAAS,GAAGnB,SAASS,KAAKC,mBAAmB,IAAI;QAE/D,qBACC,KAACT;YACC,GAAGQ,IAAI;YACRC,qBAAqBG;YACrBF,wBAAwBQ;;IAG3B;AACD,EAAE"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import type { ItemInstance, TreeInstance } from "@headless-tree/core";
|
|
2
|
+
import React from "react";
|
|
3
|
+
interface TreeViewItem<T> {
|
|
4
|
+
name: string;
|
|
5
|
+
children?: string[];
|
|
6
|
+
meta?: T;
|
|
7
|
+
}
|
|
8
|
+
type ExpansionPropsUncontrolled = {
|
|
9
|
+
defaultExpandedItems?: string[];
|
|
10
|
+
expandedItems?: never;
|
|
11
|
+
onExpandedItemsChange?: never;
|
|
12
|
+
};
|
|
13
|
+
type ExpansionPropsControlled = {
|
|
14
|
+
defaultExpandedItems?: never;
|
|
15
|
+
expandedItems: string[];
|
|
16
|
+
onExpandedItemsChange: (items: string[]) => void;
|
|
17
|
+
};
|
|
18
|
+
type ExpansionProps = ExpansionPropsUncontrolled | ExpansionPropsControlled;
|
|
19
|
+
type FocusPropsUncontrolled = {
|
|
20
|
+
defaultFocusedItem?: string;
|
|
21
|
+
focusedItem?: never;
|
|
22
|
+
onFocusedItemChange?: never;
|
|
23
|
+
};
|
|
24
|
+
type FocusPropsControlled = {
|
|
25
|
+
defaultFocusedItem?: never;
|
|
26
|
+
focusedItem: string | null;
|
|
27
|
+
onFocusedItemChange: (item: string | null) => void;
|
|
28
|
+
};
|
|
29
|
+
type FocusProps = FocusPropsUncontrolled | FocusPropsControlled;
|
|
30
|
+
type TreeViewProps<T> = {
|
|
31
|
+
rootItemId: string;
|
|
32
|
+
items: Record<string, TreeViewItem<T>>;
|
|
33
|
+
customItemView?: (item: ItemInstance<TreeViewItem<T>>, tree: TreeInstance<TreeViewItem<T>>) => React.ReactNode;
|
|
34
|
+
onRename?: ((item: ItemInstance<TreeViewItem<T>>, value: string) => void) | undefined;
|
|
35
|
+
disableHover?: boolean;
|
|
36
|
+
zebra?: boolean;
|
|
37
|
+
horizontalLines?: boolean;
|
|
38
|
+
hideChevron?: boolean;
|
|
39
|
+
itemLabelClassFn?: (item: ItemInstance<TreeViewItem<T>>) => string;
|
|
40
|
+
onItemLabelClick?: (item: ItemInstance<TreeViewItem<T>>) => void;
|
|
41
|
+
chevronClassName?: string;
|
|
42
|
+
canReorder?: boolean;
|
|
43
|
+
onDropFn?: (tree: TreeInstance<TreeViewItem<T>>, item: ItemInstance<TreeViewItem<T>>, newChildren: string[]) => void;
|
|
44
|
+
} & ExpansionProps & FocusProps;
|
|
45
|
+
declare function TreeView<T>({ rootItemId, items, defaultFocusedItem, focusedItem, onFocusedItemChange, defaultExpandedItems, expandedItems, onExpandedItemsChange, customItemView, onRename, disableHover, zebra, horizontalLines, hideChevron, itemLabelClassFn, onItemLabelClick, chevronClassName, canReorder, onDropFn, }: TreeViewProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
46
|
+
export { TreeView, type TreeViewItem, type TreeInstance };
|
|
47
|
+
//# sourceMappingURL=tree-view.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tree-view.d.ts","sourceRoot":"","sources":["../../../src/components/tree-view.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEX,YAA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,2CAgHlB;AAED,OAAO,EAAE,QAAQ,EAAE,KAAK,YAAY,EAAE,KAAK,YAAY,EAAE,CAAC"}
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { createOnDropHandler, dragAndDropFeature, hotkeysCoreFeature, renamingFeature, selectionFeature, syncDataLoaderFeature } from "@headless-tree/core";
|
|
3
|
+
import { useTree } from "@headless-tree/react";
|
|
4
|
+
import React from "react";
|
|
5
|
+
import { Tree, TreeItem, TreeItemLabel } from "../shadcn/components/ui/tree.js";
|
|
6
|
+
import { cn } from "../shadcn/lib/utils.js";
|
|
7
|
+
// Styles
|
|
8
|
+
const treeItemStyle = cn("relative", "before:absolute", "before:inset-0", "before:-ms-1", "before:-z-20", "before:bg-[repeating-linear-gradient(to_right,transparent_0,transparent_calc(var(--tree-indent)-1px),var(--border)_calc(var(--tree-indent)-1px),var(--border)_calc(var(--tree-indent)))]");
|
|
9
|
+
const treeItemLabelStyle = cn("before:bg-background", "relative", "before:absolute", "before:inset-x-0", "before:-inset-y-0", "before:-z-10");
|
|
10
|
+
const customClickBehavior = {
|
|
11
|
+
itemInstance: {
|
|
12
|
+
getProps: ({ item, prev })=>{
|
|
13
|
+
return {
|
|
14
|
+
...prev?.(),
|
|
15
|
+
onClick: ()=>{
|
|
16
|
+
item.setFocused();
|
|
17
|
+
item.primaryAction();
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
const indent = 22;
|
|
24
|
+
function TreeView({ rootItemId, items, defaultFocusedItem, focusedItem, onFocusedItemChange, defaultExpandedItems, expandedItems, onExpandedItemsChange, customItemView, onRename, disableHover, zebra, horizontalLines, hideChevron, itemLabelClassFn, onItemLabelClick, chevronClassName, canReorder, onDropFn }) {
|
|
25
|
+
"use no memo";
|
|
26
|
+
const initialExpandedItems = defaultExpandedItems ?? expandedItems;
|
|
27
|
+
const initialFocusedItem = defaultFocusedItem ?? focusedItem;
|
|
28
|
+
const setExpandedItems = expandedItems !== undefined && onExpandedItemsChange !== undefined ? (updater)=>{
|
|
29
|
+
const newVal = updater instanceof Function ? updater(expandedItems) : updater;
|
|
30
|
+
onExpandedItemsChange(newVal);
|
|
31
|
+
} : undefined;
|
|
32
|
+
const setFocusedItem = focusedItem !== undefined && onFocusedItemChange !== undefined ? (updater)=>{
|
|
33
|
+
const newVal = updater instanceof Function ? updater(focusedItem) : updater;
|
|
34
|
+
onFocusedItemChange(newVal);
|
|
35
|
+
} : undefined;
|
|
36
|
+
const treeConfig = {
|
|
37
|
+
initialState: {
|
|
38
|
+
...initialExpandedItems !== undefined ? {
|
|
39
|
+
expandedItems: initialExpandedItems
|
|
40
|
+
} : {},
|
|
41
|
+
...initialFocusedItem !== undefined ? {
|
|
42
|
+
focusedItem: initialFocusedItem
|
|
43
|
+
} : {}
|
|
44
|
+
},
|
|
45
|
+
state: {
|
|
46
|
+
...expandedItems !== undefined ? {
|
|
47
|
+
expandedItems
|
|
48
|
+
} : {},
|
|
49
|
+
...focusedItem !== undefined ? {
|
|
50
|
+
focusedItem
|
|
51
|
+
} : {}
|
|
52
|
+
},
|
|
53
|
+
...setExpandedItems !== undefined ? {
|
|
54
|
+
setExpandedItems
|
|
55
|
+
} : {},
|
|
56
|
+
...setFocusedItem !== undefined ? {
|
|
57
|
+
setFocusedItem
|
|
58
|
+
} : {},
|
|
59
|
+
indent,
|
|
60
|
+
rootItemId: rootItemId,
|
|
61
|
+
isItemFolder: (item)=>item.getItemData()?.children !== undefined,
|
|
62
|
+
getItemName: (item)=>item.getItemData()?.name,
|
|
63
|
+
dataLoader: {
|
|
64
|
+
getItem: (itemId)=>items[itemId] ?? {
|
|
65
|
+
name: "",
|
|
66
|
+
children: []
|
|
67
|
+
},
|
|
68
|
+
getChildren: (itemId)=>items[itemId]?.children ?? []
|
|
69
|
+
},
|
|
70
|
+
...onRename ? {
|
|
71
|
+
onRename: onRename
|
|
72
|
+
} : {},
|
|
73
|
+
features: [
|
|
74
|
+
syncDataLoaderFeature,
|
|
75
|
+
hotkeysCoreFeature,
|
|
76
|
+
selectionFeature,
|
|
77
|
+
renamingFeature,
|
|
78
|
+
dragAndDropFeature,
|
|
79
|
+
customClickBehavior
|
|
80
|
+
],
|
|
81
|
+
canReorder: canReorder ?? false,
|
|
82
|
+
onDrop: createOnDropHandler((item, newChildren)=>{
|
|
83
|
+
onDropFn?.(tree, item, newChildren);
|
|
84
|
+
})
|
|
85
|
+
};
|
|
86
|
+
const tree = useTree(treeConfig);
|
|
87
|
+
const [prevItems, setPrevItems] = React.useState(null);
|
|
88
|
+
if (prevItems !== items) {
|
|
89
|
+
tree.rebuildTree();
|
|
90
|
+
setPrevItems(items);
|
|
91
|
+
}
|
|
92
|
+
return /*#__PURE__*/ _jsxs(Tree, {
|
|
93
|
+
tree: tree,
|
|
94
|
+
indent: indent,
|
|
95
|
+
children: [
|
|
96
|
+
tree.getItems().map((item)=>{
|
|
97
|
+
return /*#__PURE__*/ _jsx(TreeItem, {
|
|
98
|
+
item: item,
|
|
99
|
+
className: cn(treeItemStyle, zebra ? "even:bg-bg-secondary even:[&_[data-slot=tree-item-label]]:bg-bg-secondary" : ""),
|
|
100
|
+
children: /*#__PURE__*/ _jsx(TreeItemLabel, {
|
|
101
|
+
hideChevron: hideChevron ?? false,
|
|
102
|
+
disableHover: disableHover ?? false,
|
|
103
|
+
className: cn(treeItemLabelStyle, itemLabelClassFn?.(item)),
|
|
104
|
+
onClick: onItemLabelClick ? ()=>onItemLabelClick(item) : undefined,
|
|
105
|
+
horizontalLines: horizontalLines ?? false,
|
|
106
|
+
...chevronClassName !== undefined ? {
|
|
107
|
+
chevronClassName
|
|
108
|
+
} : {},
|
|
109
|
+
children: customItemView ? customItemView(item, tree) : item.getItemData()?.name
|
|
110
|
+
})
|
|
111
|
+
}, item.getId());
|
|
112
|
+
}),
|
|
113
|
+
/*#__PURE__*/ _jsx("div", {
|
|
114
|
+
style: tree.getDragLineStyle(),
|
|
115
|
+
className: "h-px bg-bg-link z-100 mx-4"
|
|
116
|
+
})
|
|
117
|
+
]
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
export { TreeView };
|
|
121
|
+
|
|
122
|
+
//# sourceMappingURL=tree-view.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/components/tree-view.tsx"],"sourcesContent":["import type {\n\tFeatureImplementation,\n\tItemInstance,\n\tTreeConfig,\n\tTreeInstance,\n\tUpdater,\n} from \"@headless-tree/core\";\nimport {\n\tcreateOnDropHandler,\n\tdragAndDropFeature,\n\thotkeysCoreFeature,\n\trenamingFeature,\n\tselectionFeature,\n\tsyncDataLoaderFeature,\n} from \"@headless-tree/core\";\nimport { useTree } from \"@headless-tree/react\";\nimport React from \"react\";\nimport { Tree, TreeItem, TreeItemLabel } from \"#shadcn/components/ui/tree\";\nimport { cn } from \"#shadcn/lib/utils.js\";\n\n// Styles\nconst treeItemStyle = cn(\n\t\"relative\",\n\t\"before:absolute\",\n\t\"before:inset-0\",\n\t\"before:-ms-1\",\n\t\"before:-z-20\",\n\t\"before:bg-[repeating-linear-gradient(to_right,transparent_0,transparent_calc(var(--tree-indent)-1px),var(--border)_calc(var(--tree-indent)-1px),var(--border)_calc(var(--tree-indent)))]\",\n);\n\nconst treeItemLabelStyle = cn(\n\t\"before:bg-background\",\n\t\"relative\",\n\t\"before:absolute\",\n\t\"before:inset-x-0\",\n\t\"before:-inset-y-0\",\n\t\"before:-z-10\",\n);\n\ninterface TreeViewItem<T> {\n\tname: string;\n\tchildren?: string[];\n\tmeta?: T;\n}\n\nconst customClickBehavior: FeatureImplementation = {\n\titemInstance: {\n\t\tgetProps: ({ item, prev }) => {\n\t\t\treturn {\n\t\t\t\t...prev?.(),\n\t\t\t\tonClick: () => {\n\t\t\t\t\titem.setFocused();\n\t\t\t\t\titem.primaryAction();\n\t\t\t\t},\n\t\t\t};\n\t\t},\n\t},\n};\n\nconst indent = 22;\n\ntype ExpansionPropsUncontrolled = {\n\tdefaultExpandedItems?: string[];\n\texpandedItems?: never;\n\tonExpandedItemsChange?: never;\n};\ntype ExpansionPropsControlled = {\n\tdefaultExpandedItems?: never;\n\texpandedItems: string[];\n\tonExpandedItemsChange: (items: string[]) => void;\n};\ntype ExpansionProps = ExpansionPropsUncontrolled | ExpansionPropsControlled;\n\ntype FocusPropsUncontrolled = {\n\tdefaultFocusedItem?: string;\n\tfocusedItem?: never;\n\tonFocusedItemChange?: never;\n};\ntype FocusPropsControlled = {\n\tdefaultFocusedItem?: never;\n\tfocusedItem: string | null;\n\tonFocusedItemChange: (item: string | null) => void;\n};\ntype FocusProps = FocusPropsUncontrolled | FocusPropsControlled;\n\ntype TreeViewProps<T> = {\n\trootItemId: string;\n\titems: Record<string, TreeViewItem<T>>;\n\tcustomItemView?: (\n\t\titem: ItemInstance<TreeViewItem<T>>,\n\t\ttree: TreeInstance<TreeViewItem<T>>,\n\t) => React.ReactNode;\n\tonRename?:\n\t\t| ((item: ItemInstance<TreeViewItem<T>>, value: string) => void)\n\t\t| undefined;\n\tdisableHover?: boolean;\n\tzebra?: boolean;\n\thorizontalLines?: boolean;\n\thideChevron?: boolean;\n\titemLabelClassFn?: (item: ItemInstance<TreeViewItem<T>>) => string;\n\tonItemLabelClick?: (item: ItemInstance<TreeViewItem<T>>) => void;\n\tchevronClassName?: string;\n\tcanReorder?: boolean;\n\tonDropFn?: (\n\t\ttree: TreeInstance<TreeViewItem<T>>,\n\t\titem: ItemInstance<TreeViewItem<T>>,\n\t\tnewChildren: string[],\n\t) => void;\n} & ExpansionProps &\n\tFocusProps;\n\nfunction TreeView<T>({\n\trootItemId,\n\titems,\n\tdefaultFocusedItem,\n\tfocusedItem,\n\tonFocusedItemChange,\n\tdefaultExpandedItems,\n\texpandedItems,\n\tonExpandedItemsChange,\n\tcustomItemView,\n\tonRename,\n\tdisableHover,\n\tzebra,\n\thorizontalLines,\n\thideChevron,\n\titemLabelClassFn,\n\tonItemLabelClick,\n\tchevronClassName,\n\tcanReorder,\n\tonDropFn,\n}: TreeViewProps<T>) {\n\t\"use no memo\";\n\n\tconst initialExpandedItems = defaultExpandedItems ?? expandedItems;\n\tconst initialFocusedItem = defaultFocusedItem ?? focusedItem;\n\n\tconst setExpandedItems =\n\t\texpandedItems !== undefined && onExpandedItemsChange !== undefined\n\t\t\t? (updater: Updater<string[]>) => {\n\t\t\t\t\tconst newVal =\n\t\t\t\t\t\tupdater instanceof Function ? updater(expandedItems) : updater;\n\n\t\t\t\t\tonExpandedItemsChange(newVal);\n\t\t\t\t}\n\t\t\t: undefined;\n\n\tconst setFocusedItem =\n\t\tfocusedItem !== undefined && onFocusedItemChange !== undefined\n\t\t\t? (updater: Updater<string | null>) => {\n\t\t\t\t\tconst newVal =\n\t\t\t\t\t\tupdater instanceof Function ? updater(focusedItem) : updater;\n\n\t\t\t\t\tonFocusedItemChange(newVal);\n\t\t\t\t}\n\t\t\t: undefined;\n\n\tconst treeConfig: TreeConfig<TreeViewItem<T>> = {\n\t\tinitialState: {\n\t\t\t...(initialExpandedItems !== undefined\n\t\t\t\t? { expandedItems: initialExpandedItems }\n\t\t\t\t: {}),\n\t\t\t...(initialFocusedItem !== undefined\n\t\t\t\t? { focusedItem: initialFocusedItem }\n\t\t\t\t: {}),\n\t\t},\n\t\tstate: {\n\t\t\t...(expandedItems !== undefined ? { expandedItems } : {}),\n\t\t\t...(focusedItem !== undefined ? { focusedItem } : {}),\n\t\t},\n\t\t...(setExpandedItems !== undefined ? { setExpandedItems } : {}),\n\t\t...(setFocusedItem !== undefined ? { setFocusedItem } : {}),\n\t\tindent,\n\t\trootItemId: rootItemId,\n\t\tisItemFolder: (item: ItemInstance<TreeViewItem<T>>) =>\n\t\t\titem.getItemData()?.children !== undefined,\n\t\tgetItemName: (item: ItemInstance<TreeViewItem<T>>) =>\n\t\t\titem.getItemData()?.name,\n\t\tdataLoader: {\n\t\t\tgetItem: (itemId) =>\n\t\t\t\titems[itemId] ?? ({ name: \"\", children: [] } as TreeViewItem<T>),\n\t\t\tgetChildren: (itemId) => items[itemId]?.children ?? [],\n\t\t},\n\t\t...(onRename ? { onRename: onRename } : {}),\n\t\tfeatures: [\n\t\t\tsyncDataLoaderFeature,\n\t\t\thotkeysCoreFeature,\n\t\t\tselectionFeature,\n\t\t\trenamingFeature,\n\t\t\tdragAndDropFeature,\n\t\t\tcustomClickBehavior,\n\t\t],\n\t\tcanReorder: canReorder ?? false,\n\t\tonDrop: createOnDropHandler((item, newChildren) => {\n\t\t\tonDropFn?.(tree, item, newChildren);\n\t\t}),\n\t};\n\n\tconst tree = useTree<TreeViewItem<T>>(treeConfig);\n\n\tconst [prevItems, setPrevItems] = React.useState<null | typeof items>(null);\n\tif (prevItems !== items) {\n\t\ttree.rebuildTree();\n\t\tsetPrevItems(items);\n\t}\n\n\treturn (\n\t\t<Tree tree={tree} indent={indent}>\n\t\t\t{tree.getItems().map((item) => {\n\t\t\t\treturn (\n\t\t\t\t\t<TreeItem\n\t\t\t\t\t\tkey={item.getId()}\n\t\t\t\t\t\titem={item}\n\t\t\t\t\t\tclassName={cn(\n\t\t\t\t\t\t\ttreeItemStyle,\n\t\t\t\t\t\t\tzebra\n\t\t\t\t\t\t\t\t? \"even:bg-bg-secondary even:[&_[data-slot=tree-item-label]]:bg-bg-secondary\"\n\t\t\t\t\t\t\t\t: \"\",\n\t\t\t\t\t\t)}\n\t\t\t\t\t>\n\t\t\t\t\t\t<TreeItemLabel\n\t\t\t\t\t\t\thideChevron={hideChevron ?? false}\n\t\t\t\t\t\t\tdisableHover={disableHover ?? false}\n\t\t\t\t\t\t\tclassName={cn(treeItemLabelStyle, itemLabelClassFn?.(item))}\n\t\t\t\t\t\t\tonClick={\n\t\t\t\t\t\t\t\tonItemLabelClick ? () => onItemLabelClick(item) : undefined\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\thorizontalLines={horizontalLines ?? false}\n\t\t\t\t\t\t\t{...(chevronClassName !== undefined ? { chevronClassName } : {})}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{customItemView\n\t\t\t\t\t\t\t\t? customItemView(item, tree)\n\t\t\t\t\t\t\t\t: item.getItemData()?.name}\n\t\t\t\t\t\t</TreeItemLabel>\n\t\t\t\t\t</TreeItem>\n\t\t\t\t);\n\t\t\t})}\n\t\t\t<div\n\t\t\t\tstyle={tree.getDragLineStyle()}\n\t\t\t\tclassName=\"h-px bg-bg-link z-100 mx-4\"\n\t\t\t/>\n\t\t</Tree>\n\t);\n}\n\nexport { TreeView, type TreeViewItem, type TreeInstance };\n"],"names":["createOnDropHandler","dragAndDropFeature","hotkeysCoreFeature","renamingFeature","selectionFeature","syncDataLoaderFeature","useTree","React","Tree","TreeItem","TreeItemLabel","cn","treeItemStyle","treeItemLabelStyle","customClickBehavior","itemInstance","getProps","item","prev","onClick","setFocused","primaryAction","indent","TreeView","rootItemId","items","defaultFocusedItem","focusedItem","onFocusedItemChange","defaultExpandedItems","expandedItems","onExpandedItemsChange","customItemView","onRename","disableHover","zebra","horizontalLines","hideChevron","itemLabelClassFn","onItemLabelClick","chevronClassName","canReorder","onDropFn","initialExpandedItems","initialFocusedItem","setExpandedItems","undefined","updater","newVal","Function","setFocusedItem","treeConfig","initialState","state","isItemFolder","getItemData","children","getItemName","name","dataLoader","getItem","itemId","getChildren","features","onDrop","newChildren","tree","prevItems","setPrevItems","useState","rebuildTree","getItems","map","className","getId","div","style","getDragLineStyle"],"mappings":";AAOA,SACCA,mBAAmB,EACnBC,kBAAkB,EAClBC,kBAAkB,EAClBC,eAAe,EACfC,gBAAgB,EAChBC,qBAAqB,QACf,sBAAsB;AAC7B,SAASC,OAAO,QAAQ,uBAAuB;AAC/C,OAAOC,WAAW,QAAQ;AAC1B,SAASC,IAAI,EAAEC,QAAQ,EAAEC,aAAa,QAAQ,kCAA6B;AAC3E,SAASC,EAAE,QAAQ,yBAAuB;AAE1C,SAAS;AACT,MAAMC,gBAAgBD,GAC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