@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
|
@@ -1,27 +1,110 @@
|
|
|
1
|
+
"use client";
|
|
1
2
|
import * as CheckboxPrimitive from "@radix-ui/react-checkbox";
|
|
2
|
-
import {
|
|
3
|
+
import { cva, type VariantProps } from "class-variance-authority";
|
|
4
|
+
import { CheckIcon, MinusIcon } from "lucide-react";
|
|
3
5
|
import type * as React from "react";
|
|
4
6
|
|
|
5
7
|
import { cn } from "#shadcn/lib/utils";
|
|
6
8
|
|
|
9
|
+
// Checkbox root styles
|
|
10
|
+
const baseCheckboxStyles = cn(
|
|
11
|
+
// Layout
|
|
12
|
+
"inline-flex",
|
|
13
|
+
"items-center",
|
|
14
|
+
"justify-center",
|
|
15
|
+
"peer",
|
|
16
|
+
"shrink-0",
|
|
17
|
+
// Shape
|
|
18
|
+
"rounded-[2px]",
|
|
19
|
+
// Interaction
|
|
20
|
+
"outline-none",
|
|
21
|
+
"cursor-pointer",
|
|
22
|
+
// Animation
|
|
23
|
+
"transition-colors",
|
|
24
|
+
"duration-200",
|
|
25
|
+
// Default state
|
|
26
|
+
"bg-bg-primary",
|
|
27
|
+
"border-border-dark",
|
|
28
|
+
// Checked state
|
|
29
|
+
"data-[state=checked]:bg-[var(--color-fg-link)]",
|
|
30
|
+
"data-[state=checked]:border-[var(--color-fg-link)]",
|
|
31
|
+
"data-[state=checked]:text-white",
|
|
32
|
+
// Indeterminate state
|
|
33
|
+
"data-[state=indeterminate]:bg-[var(--color-fg-link)]",
|
|
34
|
+
"data-[state=indeterminate]:border-[var(--color-fg-link)]",
|
|
35
|
+
"data-[state=indeterminate]:text-white",
|
|
36
|
+
// Disabled states
|
|
37
|
+
"disabled:cursor-not-allowed",
|
|
38
|
+
"disabled:bg-bg-primary",
|
|
39
|
+
"disabled:border-[var(--color-fg-disabled)]",
|
|
40
|
+
"disabled:data-[state=checked]:bg-[var(--color-fg-disabled)]",
|
|
41
|
+
"disabled:data-[state=checked]:border-[var(--color-fg-disabled)]",
|
|
42
|
+
"disabled:data-[state=checked]:text-[var(--color-fg-secondary)]",
|
|
43
|
+
"disabled:data-[state=indeterminate]:bg-[var(--color-fg-disabled)]",
|
|
44
|
+
"disabled:data-[state=indeterminate]:border-[var(--color-fg-disabled)]",
|
|
45
|
+
"disabled:data-[state=indeterminate]:text-[var(--color-fg-secondary)]",
|
|
46
|
+
// Focus styles
|
|
47
|
+
"focus-visible:ring-4",
|
|
48
|
+
"focus-visible:ring-ring-blue",
|
|
49
|
+
"focus-visible:border-border-link",
|
|
50
|
+
// Hover styles
|
|
51
|
+
"disabled:hover:ring-0",
|
|
52
|
+
);
|
|
53
|
+
|
|
54
|
+
const checkboxVariants = cva(baseCheckboxStyles, {
|
|
55
|
+
variants: {
|
|
56
|
+
size: {
|
|
57
|
+
regular: "size-5 border-[1.5px]",
|
|
58
|
+
small: "size-4 border-[1.5px]",
|
|
59
|
+
},
|
|
60
|
+
},
|
|
61
|
+
defaultVariants: {
|
|
62
|
+
size: "regular",
|
|
63
|
+
},
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
// Checkbox indicator styles
|
|
67
|
+
const checkboxIndicatorStyles = cn(
|
|
68
|
+
// Layout
|
|
69
|
+
"flex",
|
|
70
|
+
"items-center",
|
|
71
|
+
"justify-center",
|
|
72
|
+
// Colors
|
|
73
|
+
"text-white",
|
|
74
|
+
"disabled:text-[var(--color-fg-secondary)]",
|
|
75
|
+
);
|
|
76
|
+
|
|
7
77
|
function Checkbox({
|
|
8
78
|
className,
|
|
79
|
+
size,
|
|
9
80
|
...props
|
|
10
|
-
}: React.ComponentProps<typeof CheckboxPrimitive.Root>
|
|
81
|
+
}: React.ComponentProps<typeof CheckboxPrimitive.Root> &
|
|
82
|
+
VariantProps<typeof checkboxVariants>) {
|
|
11
83
|
return (
|
|
12
84
|
<CheckboxPrimitive.Root
|
|
13
85
|
data-slot="checkbox"
|
|
14
|
-
className={cn(
|
|
15
|
-
"peer border-input dark:bg-input/30 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground dark:data-[state=checked]:bg-primary data-[state=checked]:border-primary focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive size-4 shrink-0 rounded-[4px] border shadow-xs transition-shadow outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50",
|
|
16
|
-
className,
|
|
17
|
-
)}
|
|
86
|
+
className={cn(checkboxVariants({ size }), className)}
|
|
18
87
|
{...props}
|
|
19
88
|
>
|
|
20
89
|
<CheckboxPrimitive.Indicator
|
|
90
|
+
forceMount
|
|
21
91
|
data-slot="checkbox-indicator"
|
|
22
|
-
className=
|
|
92
|
+
className={cn(
|
|
93
|
+
checkboxIndicatorStyles,
|
|
94
|
+
"data-[state=unchecked]:opacity-0",
|
|
95
|
+
)}
|
|
23
96
|
>
|
|
24
|
-
|
|
97
|
+
{props.checked === "indeterminate" ? (
|
|
98
|
+
<MinusIcon
|
|
99
|
+
className={cn(size === "small" ? "size-2.5" : "size-3.5")}
|
|
100
|
+
style={{ strokeWidth: 3 }}
|
|
101
|
+
/>
|
|
102
|
+
) : (
|
|
103
|
+
<CheckIcon
|
|
104
|
+
className={cn(size === "small" ? "size-2.5" : "size-3.5")}
|
|
105
|
+
style={{ strokeWidth: 3 }}
|
|
106
|
+
/>
|
|
107
|
+
)}
|
|
25
108
|
</CheckboxPrimitive.Indicator>
|
|
26
109
|
</CheckboxPrimitive.Root>
|
|
27
110
|
);
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
import { Controls, Primary, Title } from "@storybook/addon-docs/blocks";
|
|
2
|
+
import type { Meta, StoryObj } from "@storybook/react-vite";
|
|
3
|
+
import { useState } from "react";
|
|
4
|
+
import { Combobox, MultiCombobox } from "./combobox";
|
|
5
|
+
|
|
6
|
+
const demoOptions = [
|
|
7
|
+
{ value: "next.js", label: "Next.js" },
|
|
8
|
+
{ value: "sveltekit", label: "SvelteKit" },
|
|
9
|
+
{ value: "nuxt.js", label: "Nuxt.js" },
|
|
10
|
+
{ value: "remix", label: "Remix" },
|
|
11
|
+
{ value: "astro", label: "Astro" },
|
|
12
|
+
];
|
|
13
|
+
|
|
14
|
+
interface ComboboxWrapperProps {
|
|
15
|
+
multi?: boolean;
|
|
16
|
+
disabled?: boolean;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
function ComboboxWrapper({
|
|
20
|
+
multi = false,
|
|
21
|
+
disabled = false,
|
|
22
|
+
}: ComboboxWrapperProps) {
|
|
23
|
+
const [value, setValue] = useState("");
|
|
24
|
+
const [multiValue, setMultiValue] = useState<string[]>([]);
|
|
25
|
+
|
|
26
|
+
if (multi) {
|
|
27
|
+
return (
|
|
28
|
+
<MultiCombobox
|
|
29
|
+
options={demoOptions}
|
|
30
|
+
value={multiValue}
|
|
31
|
+
onValueChange={setMultiValue}
|
|
32
|
+
placeholder="Select frameworks..."
|
|
33
|
+
searchPlaceholder="Search framework..."
|
|
34
|
+
disabled={disabled}
|
|
35
|
+
/>
|
|
36
|
+
);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
return (
|
|
40
|
+
<Combobox
|
|
41
|
+
options={demoOptions}
|
|
42
|
+
value={value}
|
|
43
|
+
onValueChange={setValue}
|
|
44
|
+
placeholder="Select framework..."
|
|
45
|
+
searchPlaceholder="Search framework..."
|
|
46
|
+
disabled={disabled}
|
|
47
|
+
/>
|
|
48
|
+
);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
const meta = {
|
|
52
|
+
title: "Component/Combobox",
|
|
53
|
+
component: ComboboxWrapper,
|
|
54
|
+
parameters: {
|
|
55
|
+
layout: "centered",
|
|
56
|
+
docs: {
|
|
57
|
+
page: () => (
|
|
58
|
+
<>
|
|
59
|
+
<Title />
|
|
60
|
+
<p className="sbdocs-p">
|
|
61
|
+
Combobox is a searchable select component. When the dropdown opens,
|
|
62
|
+
it displays a <strong>Command</strong> component for search and
|
|
63
|
+
selection. See the Command component for all available styling
|
|
64
|
+
options.
|
|
65
|
+
</p>
|
|
66
|
+
<Primary />
|
|
67
|
+
<Controls />
|
|
68
|
+
</>
|
|
69
|
+
),
|
|
70
|
+
},
|
|
71
|
+
},
|
|
72
|
+
argTypes: {
|
|
73
|
+
multi: {
|
|
74
|
+
control: "boolean",
|
|
75
|
+
},
|
|
76
|
+
disabled: {
|
|
77
|
+
control: "boolean",
|
|
78
|
+
},
|
|
79
|
+
},
|
|
80
|
+
args: {
|
|
81
|
+
multi: false,
|
|
82
|
+
disabled: false,
|
|
83
|
+
},
|
|
84
|
+
} satisfies Meta<typeof ComboboxWrapper>;
|
|
85
|
+
export default meta;
|
|
86
|
+
|
|
87
|
+
type Story = StoryObj<typeof meta>;
|
|
88
|
+
|
|
89
|
+
export const Default = {
|
|
90
|
+
tags: ["!dev"],
|
|
91
|
+
render: ({ multi = false, disabled = false }) => (
|
|
92
|
+
<div className="w-[300px]">
|
|
93
|
+
<ComboboxWrapper multi={multi} disabled={disabled} />
|
|
94
|
+
</div>
|
|
95
|
+
),
|
|
96
|
+
} satisfies Story;
|
|
97
|
+
|
|
98
|
+
export const Demo = {
|
|
99
|
+
tags: ["!autodocs"],
|
|
100
|
+
render: () => {
|
|
101
|
+
const [value, setValue] = useState("");
|
|
102
|
+
const [multiValue, setMultiValue] = useState<string[]>([]);
|
|
103
|
+
|
|
104
|
+
return (
|
|
105
|
+
<div className="space-y-8">
|
|
106
|
+
{/* Single */}
|
|
107
|
+
<div>
|
|
108
|
+
<h3 className="typo-label mb-4">Single select</h3>
|
|
109
|
+
<div className="w-[300px]">
|
|
110
|
+
<Combobox
|
|
111
|
+
options={demoOptions}
|
|
112
|
+
value={value}
|
|
113
|
+
onValueChange={setValue}
|
|
114
|
+
placeholder="Select framework..."
|
|
115
|
+
searchPlaceholder="Search framework..."
|
|
116
|
+
/>
|
|
117
|
+
</div>
|
|
118
|
+
</div>
|
|
119
|
+
|
|
120
|
+
{/* Multi */}
|
|
121
|
+
<div>
|
|
122
|
+
<h3 className="typo-label mb-4">Multi select</h3>
|
|
123
|
+
<div className="w-[300px]">
|
|
124
|
+
<MultiCombobox
|
|
125
|
+
options={demoOptions}
|
|
126
|
+
value={multiValue}
|
|
127
|
+
onValueChange={setMultiValue}
|
|
128
|
+
placeholder="Select frameworks..."
|
|
129
|
+
searchPlaceholder="Search framework..."
|
|
130
|
+
/>
|
|
131
|
+
</div>
|
|
132
|
+
</div>
|
|
133
|
+
|
|
134
|
+
{/* Disabled */}
|
|
135
|
+
<div>
|
|
136
|
+
<h3 className="typo-label mb-4">Disabled</h3>
|
|
137
|
+
<div className="w-[300px]">
|
|
138
|
+
<Combobox
|
|
139
|
+
options={demoOptions}
|
|
140
|
+
placeholder="Select framework..."
|
|
141
|
+
disabled
|
|
142
|
+
/>
|
|
143
|
+
</div>
|
|
144
|
+
</div>
|
|
145
|
+
</div>
|
|
146
|
+
);
|
|
147
|
+
},
|
|
148
|
+
} satisfies Story;
|
|
@@ -0,0 +1,324 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { CheckIcon, X } from "lucide-react";
|
|
4
|
+
import * as React from "react";
|
|
5
|
+
import {
|
|
6
|
+
Command,
|
|
7
|
+
CommandEmpty,
|
|
8
|
+
CommandInput,
|
|
9
|
+
CommandItem,
|
|
10
|
+
CommandList,
|
|
11
|
+
} from "#shadcn/components/ui/command";
|
|
12
|
+
import {
|
|
13
|
+
Select,
|
|
14
|
+
SelectContent,
|
|
15
|
+
SelectTrigger,
|
|
16
|
+
SelectValue,
|
|
17
|
+
} from "#shadcn/components/ui/select";
|
|
18
|
+
import { cn } from "#shadcn/lib/utils";
|
|
19
|
+
import { Tag } from "../../../components/tag";
|
|
20
|
+
|
|
21
|
+
/* ==========================================================================
|
|
22
|
+
Styles
|
|
23
|
+
========================================================================== */
|
|
24
|
+
|
|
25
|
+
const selectContentStyles = cn(
|
|
26
|
+
// Spacing
|
|
27
|
+
"p-0",
|
|
28
|
+
// Radix viewport reset
|
|
29
|
+
"[&_[data-radix-select-viewport]]:p-0",
|
|
30
|
+
);
|
|
31
|
+
|
|
32
|
+
const commandStyles = cn(
|
|
33
|
+
// Layout
|
|
34
|
+
"w-full",
|
|
35
|
+
);
|
|
36
|
+
|
|
37
|
+
const checkIconStyles = cn(
|
|
38
|
+
// Layout
|
|
39
|
+
"ml-auto",
|
|
40
|
+
// Size
|
|
41
|
+
"size-4",
|
|
42
|
+
);
|
|
43
|
+
|
|
44
|
+
const checkIconVisibleStyles = cn(checkIconStyles, "opacity-100");
|
|
45
|
+
|
|
46
|
+
const checkIconHiddenStyles = cn(checkIconStyles, "opacity-0");
|
|
47
|
+
|
|
48
|
+
const triggerWithValueStyles = cn("text-text-primary");
|
|
49
|
+
|
|
50
|
+
const triggerWithTagsStyles = cn("pl-2");
|
|
51
|
+
|
|
52
|
+
const clearButtonStyles = cn(
|
|
53
|
+
// Layout
|
|
54
|
+
"ml-auto",
|
|
55
|
+
"shrink-0",
|
|
56
|
+
// Size
|
|
57
|
+
"size-4",
|
|
58
|
+
// Colors
|
|
59
|
+
"text-text-tertiary",
|
|
60
|
+
"hover:text-text-primary",
|
|
61
|
+
// Interactions
|
|
62
|
+
"cursor-pointer",
|
|
63
|
+
"pointer-events-auto",
|
|
64
|
+
"z-10",
|
|
65
|
+
// Transitions
|
|
66
|
+
"transition-colors",
|
|
67
|
+
);
|
|
68
|
+
|
|
69
|
+
/* ==========================================================================
|
|
70
|
+
Types
|
|
71
|
+
========================================================================== */
|
|
72
|
+
|
|
73
|
+
export interface ComboboxOption {
|
|
74
|
+
value: string;
|
|
75
|
+
label: string;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
interface ComboboxProps {
|
|
79
|
+
options: ComboboxOption[];
|
|
80
|
+
value?: string;
|
|
81
|
+
onValueChange?: (value: string) => void;
|
|
82
|
+
placeholder?: string;
|
|
83
|
+
searchPlaceholder?: string;
|
|
84
|
+
emptyText?: string;
|
|
85
|
+
disabled?: boolean;
|
|
86
|
+
className?: string;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/* ==========================================================================
|
|
90
|
+
Components
|
|
91
|
+
========================================================================== */
|
|
92
|
+
|
|
93
|
+
export function Combobox({
|
|
94
|
+
options,
|
|
95
|
+
value,
|
|
96
|
+
onValueChange,
|
|
97
|
+
placeholder = "Select option...",
|
|
98
|
+
searchPlaceholder = "Search...",
|
|
99
|
+
emptyText = "No options found.",
|
|
100
|
+
disabled = false,
|
|
101
|
+
className,
|
|
102
|
+
}: ComboboxProps) {
|
|
103
|
+
const [open, setOpen] = React.useState(false);
|
|
104
|
+
const [searchValue, setSearchValue] = React.useState("");
|
|
105
|
+
const inputRef = React.useRef<HTMLInputElement>(null);
|
|
106
|
+
|
|
107
|
+
const filteredOptions = React.useMemo(() => {
|
|
108
|
+
if (!searchValue) return options;
|
|
109
|
+
return options.filter((option) =>
|
|
110
|
+
option.label.toLowerCase().includes(searchValue.toLowerCase()),
|
|
111
|
+
);
|
|
112
|
+
}, [options, searchValue]);
|
|
113
|
+
|
|
114
|
+
const selectedOption = options.find((option) => option.value === value);
|
|
115
|
+
|
|
116
|
+
const changeOpen = (newOpen: boolean) => {
|
|
117
|
+
if (!newOpen) {
|
|
118
|
+
setSearchValue("");
|
|
119
|
+
} else {
|
|
120
|
+
inputRef.current?.focus();
|
|
121
|
+
}
|
|
122
|
+
setOpen(newOpen);
|
|
123
|
+
};
|
|
124
|
+
|
|
125
|
+
return (
|
|
126
|
+
<Select
|
|
127
|
+
value={value || ""}
|
|
128
|
+
{...(onValueChange && { onValueChange })}
|
|
129
|
+
disabled={disabled}
|
|
130
|
+
open={open}
|
|
131
|
+
onOpenChange={changeOpen}
|
|
132
|
+
>
|
|
133
|
+
<SelectTrigger className={className}>
|
|
134
|
+
<SelectValue placeholder={placeholder}>
|
|
135
|
+
{selectedOption?.label}
|
|
136
|
+
</SelectValue>
|
|
137
|
+
</SelectTrigger>
|
|
138
|
+
<SelectContent className={selectContentStyles}>
|
|
139
|
+
<Command className={commandStyles}>
|
|
140
|
+
<CommandInput
|
|
141
|
+
ref={inputRef}
|
|
142
|
+
placeholder={searchPlaceholder}
|
|
143
|
+
value={searchValue}
|
|
144
|
+
onValueChange={setSearchValue}
|
|
145
|
+
/>
|
|
146
|
+
<CommandList>
|
|
147
|
+
<CommandEmpty>{emptyText}</CommandEmpty>
|
|
148
|
+
|
|
149
|
+
{filteredOptions.map((option) => (
|
|
150
|
+
<CommandItem
|
|
151
|
+
key={option.value}
|
|
152
|
+
value={option.value}
|
|
153
|
+
data-state={value === option.value ? "checked" : undefined}
|
|
154
|
+
onSelect={(currentValue) => {
|
|
155
|
+
onValueChange?.(currentValue);
|
|
156
|
+
changeOpen(false);
|
|
157
|
+
}}
|
|
158
|
+
>
|
|
159
|
+
{option.label}
|
|
160
|
+
<CheckIcon
|
|
161
|
+
className={
|
|
162
|
+
value === option.value
|
|
163
|
+
? checkIconVisibleStyles
|
|
164
|
+
: checkIconHiddenStyles
|
|
165
|
+
}
|
|
166
|
+
/>
|
|
167
|
+
</CommandItem>
|
|
168
|
+
))}
|
|
169
|
+
</CommandList>
|
|
170
|
+
</Command>
|
|
171
|
+
</SelectContent>
|
|
172
|
+
</Select>
|
|
173
|
+
);
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
interface MultiComboboxProps {
|
|
177
|
+
options: ComboboxOption[];
|
|
178
|
+
value?: string[];
|
|
179
|
+
onValueChange?: (value: string[]) => void;
|
|
180
|
+
placeholder?: string;
|
|
181
|
+
searchPlaceholder?: string;
|
|
182
|
+
emptyText?: string;
|
|
183
|
+
disabled?: boolean;
|
|
184
|
+
className?: string;
|
|
185
|
+
maxDisplay?: number;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
export function MultiCombobox({
|
|
189
|
+
options,
|
|
190
|
+
value = [],
|
|
191
|
+
onValueChange,
|
|
192
|
+
placeholder = "Select options...",
|
|
193
|
+
searchPlaceholder = "Search...",
|
|
194
|
+
emptyText = "No options found.",
|
|
195
|
+
disabled = false,
|
|
196
|
+
className,
|
|
197
|
+
maxDisplay = 2,
|
|
198
|
+
}: MultiComboboxProps) {
|
|
199
|
+
const [open, setOpen] = React.useState(false);
|
|
200
|
+
const [searchValue, setSearchValue] = React.useState("");
|
|
201
|
+
const inputRef = React.useRef<HTMLInputElement>(null);
|
|
202
|
+
|
|
203
|
+
const filteredOptions = React.useMemo(() => {
|
|
204
|
+
if (!searchValue) return options;
|
|
205
|
+
return options.filter((option) =>
|
|
206
|
+
option.label.toLowerCase().includes(searchValue.toLowerCase()),
|
|
207
|
+
);
|
|
208
|
+
}, [options, searchValue]);
|
|
209
|
+
|
|
210
|
+
const selectedOptions = React.useMemo(
|
|
211
|
+
() => options.filter((option) => value.includes(option.value)),
|
|
212
|
+
[options, value],
|
|
213
|
+
);
|
|
214
|
+
|
|
215
|
+
const handleSelect = (selectedValue: string) => {
|
|
216
|
+
const newValue = value.includes(selectedValue)
|
|
217
|
+
? value.filter((v) => v !== selectedValue)
|
|
218
|
+
: [...value, selectedValue];
|
|
219
|
+
onValueChange?.(newValue);
|
|
220
|
+
};
|
|
221
|
+
|
|
222
|
+
const handleClear = (e: React.MouseEvent) => {
|
|
223
|
+
e.stopPropagation();
|
|
224
|
+
onValueChange?.([]);
|
|
225
|
+
};
|
|
226
|
+
|
|
227
|
+
const changeOpen = (newOpen: boolean) => {
|
|
228
|
+
if (!newOpen) {
|
|
229
|
+
setSearchValue("");
|
|
230
|
+
} else {
|
|
231
|
+
inputRef.current?.focus();
|
|
232
|
+
}
|
|
233
|
+
setOpen(newOpen);
|
|
234
|
+
};
|
|
235
|
+
|
|
236
|
+
const hasValue = selectedOptions.length > 0;
|
|
237
|
+
const displayedOptions = selectedOptions.slice(0, maxDisplay);
|
|
238
|
+
const remainingCount = selectedOptions.length - maxDisplay;
|
|
239
|
+
|
|
240
|
+
return (
|
|
241
|
+
<Select open={open} onOpenChange={changeOpen}>
|
|
242
|
+
<SelectTrigger
|
|
243
|
+
className={cn(
|
|
244
|
+
className,
|
|
245
|
+
hasValue && triggerWithValueStyles,
|
|
246
|
+
hasValue && triggerWithTagsStyles,
|
|
247
|
+
)}
|
|
248
|
+
disabled={disabled}
|
|
249
|
+
>
|
|
250
|
+
{hasValue ? (
|
|
251
|
+
<>
|
|
252
|
+
<div className="flex items-center gap-1 overflow-hidden">
|
|
253
|
+
{displayedOptions.map((opt) => (
|
|
254
|
+
<Tag
|
|
255
|
+
key={opt.value}
|
|
256
|
+
size="small"
|
|
257
|
+
color="gray"
|
|
258
|
+
vibrance="subtle"
|
|
259
|
+
showIcon={false}
|
|
260
|
+
>
|
|
261
|
+
{opt.label}
|
|
262
|
+
</Tag>
|
|
263
|
+
))}
|
|
264
|
+
{remainingCount > 0 && (
|
|
265
|
+
<Tag
|
|
266
|
+
size="small"
|
|
267
|
+
color="gray"
|
|
268
|
+
vibrance="subtle"
|
|
269
|
+
showIcon={false}
|
|
270
|
+
>
|
|
271
|
+
+{remainingCount}
|
|
272
|
+
</Tag>
|
|
273
|
+
)}
|
|
274
|
+
</div>
|
|
275
|
+
<button
|
|
276
|
+
type="button"
|
|
277
|
+
className={clearButtonStyles}
|
|
278
|
+
onClick={handleClear}
|
|
279
|
+
onPointerDown={(e) => e.stopPropagation()}
|
|
280
|
+
>
|
|
281
|
+
<X className="size-4" />
|
|
282
|
+
</button>
|
|
283
|
+
</>
|
|
284
|
+
) : (
|
|
285
|
+
<SelectValue placeholder={placeholder} />
|
|
286
|
+
)}
|
|
287
|
+
</SelectTrigger>
|
|
288
|
+
<SelectContent className={selectContentStyles}>
|
|
289
|
+
<Command className={commandStyles}>
|
|
290
|
+
<CommandInput
|
|
291
|
+
ref={inputRef}
|
|
292
|
+
placeholder={searchPlaceholder}
|
|
293
|
+
value={searchValue}
|
|
294
|
+
onValueChange={setSearchValue}
|
|
295
|
+
/>
|
|
296
|
+
<CommandList>
|
|
297
|
+
<CommandEmpty>{emptyText}</CommandEmpty>
|
|
298
|
+
|
|
299
|
+
{filteredOptions.map((option) => {
|
|
300
|
+
const isSelected = value.includes(option.value);
|
|
301
|
+
return (
|
|
302
|
+
<CommandItem
|
|
303
|
+
key={option.value}
|
|
304
|
+
value={option.value}
|
|
305
|
+
data-state={isSelected ? "checked" : undefined}
|
|
306
|
+
onSelect={handleSelect}
|
|
307
|
+
>
|
|
308
|
+
{option.label}
|
|
309
|
+
<CheckIcon
|
|
310
|
+
className={
|
|
311
|
+
isSelected
|
|
312
|
+
? checkIconVisibleStyles
|
|
313
|
+
: checkIconHiddenStyles
|
|
314
|
+
}
|
|
315
|
+
/>
|
|
316
|
+
</CommandItem>
|
|
317
|
+
);
|
|
318
|
+
})}
|
|
319
|
+
</CommandList>
|
|
320
|
+
</Command>
|
|
321
|
+
</SelectContent>
|
|
322
|
+
</Select>
|
|
323
|
+
);
|
|
324
|
+
}
|