@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,52 +1,188 @@
|
|
|
1
|
+
"use client";
|
|
1
2
|
import * as TabsPrimitive from "@radix-ui/react-tabs";
|
|
2
3
|
import { cva, type VariantProps } from "class-variance-authority";
|
|
3
|
-
import {
|
|
4
|
-
|
|
4
|
+
import {
|
|
5
|
+
ChevronDownIcon,
|
|
6
|
+
ChevronLeft,
|
|
7
|
+
ChevronRight,
|
|
8
|
+
Plus,
|
|
9
|
+
X,
|
|
10
|
+
} from "lucide-react";
|
|
11
|
+
import * as React from "react";
|
|
5
12
|
import { cn } from "#shadcn/lib/utils";
|
|
6
13
|
import { Button } from "./button";
|
|
14
|
+
import {
|
|
15
|
+
Command,
|
|
16
|
+
CommandEmpty,
|
|
17
|
+
CommandInput,
|
|
18
|
+
CommandItem,
|
|
19
|
+
CommandList,
|
|
20
|
+
} from "./command";
|
|
21
|
+
import { Popover, PopoverContent, PopoverTrigger } from "./popover";
|
|
22
|
+
|
|
23
|
+
// Base tabs styles
|
|
24
|
+
const baseTabsStyles = cn("flex", "flex-col", "h-full");
|
|
25
|
+
|
|
26
|
+
// Tabs add button container styles
|
|
27
|
+
const tabsAddButtonContainerStyles = cn(
|
|
28
|
+
"grow",
|
|
29
|
+
"h-full",
|
|
30
|
+
"bg-bg-secondary",
|
|
31
|
+
"border-l",
|
|
32
|
+
"border-b",
|
|
33
|
+
);
|
|
34
|
+
|
|
35
|
+
// Tabs list styles
|
|
36
|
+
const tabsListStyles = cn(
|
|
37
|
+
"inline-flex",
|
|
38
|
+
"w-fit",
|
|
39
|
+
"items-center",
|
|
40
|
+
"no-scrollbar",
|
|
41
|
+
);
|
|
42
|
+
|
|
43
|
+
// Base tabs trigger styles
|
|
44
|
+
const baseTabsTriggerStyles = cn(
|
|
45
|
+
// Layout & Sizing
|
|
46
|
+
"box-border",
|
|
47
|
+
"flex-1",
|
|
48
|
+
"h-10",
|
|
49
|
+
"inline-flex",
|
|
50
|
+
"items-center",
|
|
51
|
+
"justify-center",
|
|
52
|
+
"px-3",
|
|
53
|
+
"whitespace-nowrap",
|
|
54
|
+
// Spacing & Padding
|
|
55
|
+
"pb-2",
|
|
56
|
+
"pt-2.5",
|
|
57
|
+
// Typography
|
|
58
|
+
"typo-body",
|
|
59
|
+
// Colors & States
|
|
60
|
+
"cursor-pointer",
|
|
61
|
+
"text-text-tertiary",
|
|
62
|
+
"hover:bg-bg-secondary/60",
|
|
63
|
+
"hover:text-text-tertiary_hover",
|
|
64
|
+
"data-[state=active]:text-text-primary",
|
|
65
|
+
"data-[state=active]:border-b-border-brand",
|
|
66
|
+
"disabled:opacity-50",
|
|
67
|
+
"disabled:pointer-events-none",
|
|
68
|
+
// Borders
|
|
69
|
+
"border-b-2",
|
|
70
|
+
"border-b-transparent",
|
|
71
|
+
// Focus & Accessibility
|
|
72
|
+
"focus-visible:ring-2",
|
|
73
|
+
"focus-visible:ring-utility-blue/70",
|
|
74
|
+
"focus-visible:outline-1",
|
|
75
|
+
// Transitions
|
|
76
|
+
"transition-[color,box-shadow]",
|
|
77
|
+
// Icons
|
|
78
|
+
"[&_svg]:pointer-events-none",
|
|
79
|
+
"[&_svg]:shrink-0",
|
|
80
|
+
"[&_svg:not([class*='size-'])]:size-4",
|
|
81
|
+
// Groups
|
|
82
|
+
"group/tabs-trigger",
|
|
83
|
+
);
|
|
84
|
+
|
|
85
|
+
// Tabs content styles
|
|
86
|
+
const tabsContentStyles = cn("grow", "outline-none", "overflow-auto");
|
|
7
87
|
|
|
8
88
|
const tabsVariants = cva("", {
|
|
9
89
|
variants: {
|
|
10
90
|
variant: {
|
|
11
91
|
browser: cn(
|
|
12
92
|
// Tabs
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
93
|
+
"flex-row",
|
|
94
|
+
"items-center",
|
|
95
|
+
"h-10",
|
|
96
|
+
// TabsList
|
|
97
|
+
"**:data-[slot=tabs-list]:overflow-x-auto",
|
|
98
|
+
"**:data-[slot=tabs-list]:divide-x",
|
|
99
|
+
// TabsTrigger
|
|
100
|
+
"**:data-[slot=tabs-trigger]:max-w-80",
|
|
101
|
+
"**:data-[slot=tabs-trigger]:w-60",
|
|
102
|
+
"**:data-[slot=tabs-trigger]:min-w-40",
|
|
103
|
+
"**:data-[slot=tabs-trigger]:data-[state=inactive]:text-text-secondary",
|
|
104
|
+
"**:data-[slot=tabs-trigger]:data-[state=inactive]:border-b-1",
|
|
105
|
+
"**:data-[slot=tabs-trigger]:data-[state=inactive]:border-b-border-secondary",
|
|
106
|
+
"**:data-[slot=tabs-trigger]:data-[state=inactive]:pt-[9px]", // TODO: Try to implement this without using pt-[9px].
|
|
107
|
+
),
|
|
108
|
+
secondary: cn(
|
|
109
|
+
// TabsList
|
|
110
|
+
"**:data-[slot=tabs-list]:h-10",
|
|
111
|
+
"**:data-[slot=tabs-list]:bg-bg-tertiary",
|
|
112
|
+
// TabsTrigger
|
|
113
|
+
"**:data-[slot=tabs-trigger]:h-10",
|
|
114
|
+
"**:data-[slot=tabs-trigger]:px-3",
|
|
115
|
+
"**:data-[slot=tabs-trigger]:pb-2",
|
|
116
|
+
"**:data-[slot=tabs-trigger]:pt-2",
|
|
117
|
+
"**:data-[slot=tabs-trigger]:text-text-secondary",
|
|
118
|
+
"**:data-[slot=tabs-trigger]:hover:text-text-primary",
|
|
119
|
+
"**:data-[slot=tabs-trigger]:data-[state=active]:border-b-2",
|
|
120
|
+
"**:data-[slot=tabs-trigger]:data-[state=active]:border-b-border-dark",
|
|
121
|
+
"**:data-[slot=tabs-trigger]:data-[state=active]:text-text-primary",
|
|
122
|
+
),
|
|
123
|
+
tertiary: cn(
|
|
17
124
|
// TabsList
|
|
18
|
-
|
|
19
|
-
|
|
125
|
+
"**:data-[slot=tabs-list]:bg-bg-secondary",
|
|
126
|
+
"**:data-[slot=tabs-list]:border-b",
|
|
127
|
+
"**:data-[slot=tabs-list]:border-b-border-separator",
|
|
128
|
+
"**:data-[slot=tabs-list]:gap-2",
|
|
129
|
+
"**:data-[slot=tabs-list]:px-4",
|
|
130
|
+
"**:data-[slot=tabs-list]:py-2",
|
|
20
131
|
// TabsTrigger
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
132
|
+
"**:data-[slot=tabs-trigger]:h-7",
|
|
133
|
+
"**:data-[slot=tabs-trigger]:px-3",
|
|
134
|
+
"**:data-[slot=tabs-trigger]:rounded",
|
|
135
|
+
"**:data-[slot=tabs-trigger]:border-b-0",
|
|
136
|
+
"**:data-[slot=tabs-trigger]:pb-2",
|
|
137
|
+
"**:data-[slot=tabs-trigger]:pt-2",
|
|
138
|
+
"**:data-[slot=tabs-trigger]:border",
|
|
139
|
+
"**:data-[slot=tabs-trigger]:border-transparent",
|
|
140
|
+
"**:data-[slot=tabs-trigger]:text-text-secondary",
|
|
141
|
+
"**:data-[slot=tabs-trigger]:hover:text-text-primary",
|
|
142
|
+
"**:data-[slot=tabs-trigger]:data-[state=active]:bg-bg-primary",
|
|
143
|
+
"**:data-[slot=tabs-trigger]:data-[state=active]:border-border-secondary",
|
|
144
|
+
"**:data-[slot=tabs-trigger]:data-[state=active]:text-text-primary",
|
|
27
145
|
),
|
|
28
146
|
},
|
|
29
147
|
},
|
|
30
148
|
});
|
|
31
149
|
|
|
32
|
-
|
|
150
|
+
// Context for variant
|
|
151
|
+
const TabsVariantContext = React.createContext<
|
|
152
|
+
VariantProps<typeof tabsVariants>["variant"] | undefined
|
|
153
|
+
>(undefined);
|
|
154
|
+
|
|
155
|
+
type TabsProps<T extends string> = Omit<
|
|
156
|
+
React.ComponentProps<typeof TabsPrimitive.Root> &
|
|
157
|
+
VariantProps<typeof tabsVariants>,
|
|
158
|
+
"value" | "defaultValue" | "onValueChange"
|
|
159
|
+
> & {
|
|
160
|
+
value?: T;
|
|
161
|
+
defaultValue?: T;
|
|
162
|
+
onValueChange?: (value: T) => void;
|
|
163
|
+
};
|
|
164
|
+
|
|
165
|
+
function Tabs<T extends string = string>({
|
|
33
166
|
className,
|
|
34
167
|
variant,
|
|
35
168
|
...props
|
|
36
|
-
}:
|
|
37
|
-
|
|
169
|
+
}: TabsProps<T>) {
|
|
170
|
+
const tabProps = {
|
|
171
|
+
"data-slot": "tabs",
|
|
172
|
+
className: cn(baseTabsStyles, tabsVariants({ variant }), className),
|
|
173
|
+
...props,
|
|
174
|
+
onValueChange: (value: string) => props.onValueChange?.(value as T),
|
|
175
|
+
};
|
|
38
176
|
return (
|
|
39
|
-
<
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
{...props}
|
|
43
|
-
/>
|
|
177
|
+
<TabsVariantContext.Provider value={variant}>
|
|
178
|
+
<TabsPrimitive.Root {...tabProps} />
|
|
179
|
+
</TabsVariantContext.Provider>
|
|
44
180
|
);
|
|
45
181
|
}
|
|
46
182
|
|
|
47
183
|
export function TabsAddButton(props: React.ComponentProps<typeof Button>) {
|
|
48
184
|
return (
|
|
49
|
-
<div className=
|
|
185
|
+
<div className={tabsAddButtonContainerStyles}>
|
|
50
186
|
<Button
|
|
51
187
|
data-slot="tabs-add-button"
|
|
52
188
|
variant="link"
|
|
@@ -59,19 +195,542 @@ export function TabsAddButton(props: React.ComponentProps<typeof Button>) {
|
|
|
59
195
|
);
|
|
60
196
|
}
|
|
61
197
|
|
|
198
|
+
function horizontalScroll(event: React.WheelEvent) {
|
|
199
|
+
const mode = event.deltaMode;
|
|
200
|
+
let deltaPx = 0;
|
|
201
|
+
|
|
202
|
+
if (mode === 0) {
|
|
203
|
+
deltaPx = event.deltaY;
|
|
204
|
+
} else if (mode === 1) {
|
|
205
|
+
deltaPx = event.deltaY * 160;
|
|
206
|
+
} else if (mode === 2) {
|
|
207
|
+
deltaPx = event.currentTarget.clientWidth;
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
const newScrollLeft = event.currentTarget.scrollLeft + deltaPx;
|
|
211
|
+
|
|
212
|
+
event.currentTarget.scrollTo({
|
|
213
|
+
left: newScrollLeft,
|
|
214
|
+
behavior: "smooth",
|
|
215
|
+
});
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
function performHorizontalScroll(
|
|
219
|
+
tabsListRef: React.RefObject<HTMLDivElement | null>,
|
|
220
|
+
direction: "left" | "right",
|
|
221
|
+
) {
|
|
222
|
+
if (!tabsListRef.current) return;
|
|
223
|
+
const scrollAmount = 160;
|
|
224
|
+
let newScrollLeft = tabsListRef.current.scrollLeft;
|
|
225
|
+
|
|
226
|
+
if (direction === "left") {
|
|
227
|
+
newScrollLeft -= scrollAmount;
|
|
228
|
+
newScrollLeft -= newScrollLeft % scrollAmount;
|
|
229
|
+
} else {
|
|
230
|
+
newScrollLeft += scrollAmount;
|
|
231
|
+
|
|
232
|
+
const rightCoord = newScrollLeft + tabsListRef.current.clientWidth;
|
|
233
|
+
|
|
234
|
+
if (rightCoord % scrollAmount !== 0) {
|
|
235
|
+
newScrollLeft += scrollAmount - (rightCoord % scrollAmount);
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
tabsListRef.current.scrollTo({
|
|
240
|
+
left: newScrollLeft,
|
|
241
|
+
behavior: "smooth",
|
|
242
|
+
});
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
type EdgeScrollPosition = "touch" | "depart";
|
|
246
|
+
type FlowType = "overflow" | "underflow";
|
|
247
|
+
|
|
248
|
+
type TabsListProps = {
|
|
249
|
+
onLeftEdge?: (position: EdgeScrollPosition) => void;
|
|
250
|
+
onRightEdge?: (position: EdgeScrollPosition) => void;
|
|
251
|
+
onFlow?: (flow: FlowType) => void;
|
|
252
|
+
onResize?: (entries: ResizeObserverEntry[]) => void;
|
|
253
|
+
onTabChange?: (mutationRecords: MutationRecord[]) => void;
|
|
254
|
+
} & React.ComponentProps<typeof TabsPrimitive.List>;
|
|
255
|
+
|
|
62
256
|
function TabsList({
|
|
63
257
|
className,
|
|
258
|
+
onLeftEdge,
|
|
259
|
+
onRightEdge,
|
|
260
|
+
onResize,
|
|
261
|
+
onFlow,
|
|
262
|
+
onTabChange,
|
|
64
263
|
...props
|
|
65
|
-
}:
|
|
264
|
+
}: TabsListProps) {
|
|
265
|
+
const tabListRef = React.useRef<HTMLDivElement | null>(null);
|
|
266
|
+
|
|
267
|
+
const onLeftEdgeRef = React.useRef(onLeftEdge);
|
|
268
|
+
React.useEffect(() => {
|
|
269
|
+
onLeftEdgeRef.current = onLeftEdge;
|
|
270
|
+
}, [onLeftEdge]);
|
|
271
|
+
|
|
272
|
+
const onResizeRef = React.useRef(onResize);
|
|
273
|
+
React.useEffect(() => {
|
|
274
|
+
onResizeRef.current = onResize;
|
|
275
|
+
}, [onResize]);
|
|
276
|
+
|
|
277
|
+
const onRightEdgeRef = React.useRef(onRightEdge);
|
|
278
|
+
React.useEffect(() => {
|
|
279
|
+
onRightEdgeRef.current = onRightEdge;
|
|
280
|
+
}, [onRightEdge]);
|
|
281
|
+
|
|
282
|
+
const onFlowRef = React.useRef(onFlow);
|
|
283
|
+
React.useEffect(() => {
|
|
284
|
+
onFlowRef.current = onFlow;
|
|
285
|
+
}, [onFlow]);
|
|
286
|
+
|
|
287
|
+
const onTabChangeRef = React.useRef(onTabChange);
|
|
288
|
+
React.useEffect(() => {
|
|
289
|
+
onTabChangeRef.current = onTabChange;
|
|
290
|
+
}, [onTabChange]);
|
|
291
|
+
|
|
292
|
+
React.useEffect(() => {
|
|
293
|
+
if (tabListRef.current === null) {
|
|
294
|
+
return;
|
|
295
|
+
}
|
|
296
|
+
const tabList = tabListRef.current;
|
|
297
|
+
|
|
298
|
+
let last: {
|
|
299
|
+
scrollLeft: number;
|
|
300
|
+
scrollWidth: number;
|
|
301
|
+
clientWidth: number;
|
|
302
|
+
} | null = null;
|
|
303
|
+
|
|
304
|
+
const handleScroll = () => {
|
|
305
|
+
if (onLeftEdgeRef.current) {
|
|
306
|
+
const newState: EdgeScrollPosition =
|
|
307
|
+
tabList.scrollLeft < 1 ? "touch" : "depart";
|
|
308
|
+
|
|
309
|
+
if (last === null) {
|
|
310
|
+
onLeftEdgeRef.current(newState);
|
|
311
|
+
} else {
|
|
312
|
+
const lastState: EdgeScrollPosition =
|
|
313
|
+
last.scrollLeft < 1 ? "touch" : "depart";
|
|
314
|
+
|
|
315
|
+
if (lastState !== newState) {
|
|
316
|
+
onLeftEdgeRef.current(newState);
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
if (onRightEdgeRef.current) {
|
|
322
|
+
const newState: EdgeScrollPosition =
|
|
323
|
+
tabList.scrollWidth - tabList.clientWidth - tabList.scrollLeft < 1
|
|
324
|
+
? "touch"
|
|
325
|
+
: "depart";
|
|
326
|
+
|
|
327
|
+
if (last === null) {
|
|
328
|
+
onRightEdgeRef.current(newState);
|
|
329
|
+
} else {
|
|
330
|
+
const lastState: EdgeScrollPosition =
|
|
331
|
+
last.scrollWidth - last.clientWidth - last.scrollLeft < 1
|
|
332
|
+
? "touch"
|
|
333
|
+
: "depart";
|
|
334
|
+
|
|
335
|
+
if (lastState !== newState) {
|
|
336
|
+
onRightEdgeRef.current(newState);
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
if (onFlowRef.current) {
|
|
342
|
+
const newState: FlowType =
|
|
343
|
+
tabList.scrollWidth > tabList.clientWidth ? "overflow" : "underflow";
|
|
344
|
+
|
|
345
|
+
if (last === null) {
|
|
346
|
+
onFlowRef.current(newState);
|
|
347
|
+
} else {
|
|
348
|
+
const lastState =
|
|
349
|
+
last.scrollWidth > last.clientWidth ? "overflow" : "underflow";
|
|
350
|
+
if (lastState !== newState) {
|
|
351
|
+
onFlowRef.current(newState);
|
|
352
|
+
}
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
last = {
|
|
357
|
+
scrollLeft: tabList.scrollLeft,
|
|
358
|
+
scrollWidth: tabList.scrollWidth,
|
|
359
|
+
clientWidth: tabList.clientWidth,
|
|
360
|
+
};
|
|
361
|
+
};
|
|
362
|
+
|
|
363
|
+
const scrollCallback = (_ev: unknown) => handleScroll();
|
|
364
|
+
const resizeObserver = new ResizeObserver((entries) => {
|
|
365
|
+
handleScroll();
|
|
366
|
+
if (onResizeRef.current) {
|
|
367
|
+
onResizeRef.current(entries);
|
|
368
|
+
}
|
|
369
|
+
});
|
|
370
|
+
const mutationObserver = new MutationObserver((mutationRecords) => {
|
|
371
|
+
handleScroll();
|
|
372
|
+
if (onTabChangeRef.current) {
|
|
373
|
+
onTabChangeRef.current(mutationRecords);
|
|
374
|
+
}
|
|
375
|
+
});
|
|
376
|
+
|
|
377
|
+
tabList.addEventListener("scroll", scrollCallback, { passive: true });
|
|
378
|
+
resizeObserver.observe(tabList);
|
|
379
|
+
mutationObserver.observe(tabList, { childList: true });
|
|
380
|
+
|
|
381
|
+
return () => {
|
|
382
|
+
tabList.removeEventListener("scroll", scrollCallback);
|
|
383
|
+
resizeObserver.disconnect();
|
|
384
|
+
mutationObserver.disconnect();
|
|
385
|
+
};
|
|
386
|
+
}, []);
|
|
387
|
+
|
|
66
388
|
return (
|
|
67
389
|
<TabsPrimitive.List
|
|
68
390
|
data-slot="tabs-list"
|
|
69
391
|
className={cn("inline-flex w-fit items-center", className)}
|
|
70
392
|
{...props}
|
|
393
|
+
ref={(element) => {
|
|
394
|
+
tabListRef.current = element;
|
|
395
|
+
if (props.ref !== undefined && props.ref !== null) {
|
|
396
|
+
if (typeof props.ref === "function") {
|
|
397
|
+
props.ref(element);
|
|
398
|
+
} else {
|
|
399
|
+
props.ref.current = element;
|
|
400
|
+
}
|
|
401
|
+
}
|
|
402
|
+
}}
|
|
71
403
|
/>
|
|
72
404
|
);
|
|
73
405
|
}
|
|
74
406
|
|
|
407
|
+
type TabScrollButtonProps = {
|
|
408
|
+
disabled: boolean;
|
|
409
|
+
onClick: () => void;
|
|
410
|
+
};
|
|
411
|
+
|
|
412
|
+
function TabScrollLeftButton({
|
|
413
|
+
disabled,
|
|
414
|
+
onClick,
|
|
415
|
+
}: TabScrollButtonProps): React.ReactElement {
|
|
416
|
+
return (
|
|
417
|
+
<Button
|
|
418
|
+
variant="link"
|
|
419
|
+
size="small"
|
|
420
|
+
disabled={disabled}
|
|
421
|
+
className="h-full border-r border-b bg-bg-secondary rounded-none"
|
|
422
|
+
onClick={onClick}
|
|
423
|
+
>
|
|
424
|
+
<ChevronLeft />
|
|
425
|
+
</Button>
|
|
426
|
+
);
|
|
427
|
+
}
|
|
428
|
+
|
|
429
|
+
function TabScrollRightButton({
|
|
430
|
+
disabled,
|
|
431
|
+
onClick,
|
|
432
|
+
}: TabScrollButtonProps): React.ReactElement {
|
|
433
|
+
return (
|
|
434
|
+
<Button
|
|
435
|
+
variant="link"
|
|
436
|
+
size="small"
|
|
437
|
+
disabled={disabled}
|
|
438
|
+
className="h-full border-l border-b bg-bg-secondary rounded-none"
|
|
439
|
+
onClick={onClick}
|
|
440
|
+
>
|
|
441
|
+
<ChevronRight />
|
|
442
|
+
</Button>
|
|
443
|
+
);
|
|
444
|
+
}
|
|
445
|
+
|
|
446
|
+
type DragState = {
|
|
447
|
+
index: number;
|
|
448
|
+
startX: number;
|
|
449
|
+
offsetX: number;
|
|
450
|
+
currentIndex: number;
|
|
451
|
+
widths: number[];
|
|
452
|
+
lefts: number[];
|
|
453
|
+
};
|
|
454
|
+
|
|
455
|
+
const DRAG_THRESHOLD = 5;
|
|
456
|
+
|
|
457
|
+
function useTabReorder(
|
|
458
|
+
onReorder: ((fromIndex: number, toIndex: number) => void) | undefined,
|
|
459
|
+
) {
|
|
460
|
+
const [drag, setDrag] = React.useState<DragState | null>(null);
|
|
461
|
+
const dragRef = React.useRef<DragState | null>(null);
|
|
462
|
+
const pendingRef = React.useRef(false);
|
|
463
|
+
const itemsRef = React.useRef<(HTMLDivElement | null)[]>([]);
|
|
464
|
+
|
|
465
|
+
const handlePointerDown = React.useCallback(
|
|
466
|
+
(e: React.PointerEvent, index: number) => {
|
|
467
|
+
if (!onReorder || e.button !== 0) return;
|
|
468
|
+
const items = itemsRef.current;
|
|
469
|
+
const widths = items.map((el) => el?.offsetWidth ?? 0);
|
|
470
|
+
const lefts: number[] = [];
|
|
471
|
+
let acc = 0;
|
|
472
|
+
for (const w of widths) {
|
|
473
|
+
lefts.push(acc);
|
|
474
|
+
acc += w;
|
|
475
|
+
}
|
|
476
|
+
dragRef.current = {
|
|
477
|
+
index,
|
|
478
|
+
startX: e.clientX,
|
|
479
|
+
offsetX: 0,
|
|
480
|
+
currentIndex: index,
|
|
481
|
+
widths,
|
|
482
|
+
lefts,
|
|
483
|
+
};
|
|
484
|
+
pendingRef.current = true;
|
|
485
|
+
(e.target as HTMLElement).setPointerCapture(e.pointerId);
|
|
486
|
+
},
|
|
487
|
+
[onReorder],
|
|
488
|
+
);
|
|
489
|
+
|
|
490
|
+
const handlePointerMove = React.useCallback((e: React.PointerEvent) => {
|
|
491
|
+
const d = dragRef.current;
|
|
492
|
+
if (!d) return;
|
|
493
|
+
const dx = e.clientX - d.startX;
|
|
494
|
+
if (pendingRef.current) {
|
|
495
|
+
if (Math.abs(dx) < DRAG_THRESHOLD) return;
|
|
496
|
+
pendingRef.current = false;
|
|
497
|
+
}
|
|
498
|
+
const draggedLeft = d.lefts[d.index] ?? 0;
|
|
499
|
+
const draggedWidth = d.widths[d.index] ?? 0;
|
|
500
|
+
const draggedRightEdge = draggedLeft + draggedWidth + dx;
|
|
501
|
+
const draggedLeftEdge = draggedLeft + dx;
|
|
502
|
+
let newIndex = d.index;
|
|
503
|
+
const TRIGGER_RATIO = 0.3;
|
|
504
|
+
for (let i = 0; i < d.lefts.length; i++) {
|
|
505
|
+
if (i === d.index) continue;
|
|
506
|
+
const left = d.lefts[i] ?? 0;
|
|
507
|
+
const width = d.widths[i] ?? 0;
|
|
508
|
+
if (i > d.index) {
|
|
509
|
+
// Dragging right: trigger when right edge enters 30% of target
|
|
510
|
+
if (draggedRightEdge > left + width * TRIGGER_RATIO) newIndex = i;
|
|
511
|
+
} else {
|
|
512
|
+
// Dragging left: trigger when left edge enters 30% from right
|
|
513
|
+
if (draggedLeftEdge < left + width * (1 - TRIGGER_RATIO))
|
|
514
|
+
newIndex = Math.min(newIndex, i);
|
|
515
|
+
}
|
|
516
|
+
}
|
|
517
|
+
const next: DragState = { ...d, offsetX: dx, currentIndex: newIndex };
|
|
518
|
+
dragRef.current = next;
|
|
519
|
+
setDrag(next);
|
|
520
|
+
}, []);
|
|
521
|
+
|
|
522
|
+
const handlePointerUp = React.useCallback(() => {
|
|
523
|
+
const d = dragRef.current;
|
|
524
|
+
if (d && !pendingRef.current && d.index !== d.currentIndex) {
|
|
525
|
+
onReorder?.(d.index, d.currentIndex);
|
|
526
|
+
}
|
|
527
|
+
dragRef.current = null;
|
|
528
|
+
pendingRef.current = false;
|
|
529
|
+
setDrag(null);
|
|
530
|
+
}, [onReorder]);
|
|
531
|
+
|
|
532
|
+
const getTransform = React.useCallback(
|
|
533
|
+
(index: number): React.CSSProperties => {
|
|
534
|
+
if (!drag || pendingRef.current) return {};
|
|
535
|
+
if (index === drag.index) {
|
|
536
|
+
return {
|
|
537
|
+
transform: `translateX(${drag.offsetX}px)`,
|
|
538
|
+
zIndex: 10,
|
|
539
|
+
position: "relative",
|
|
540
|
+
background: "var(--color-bg-primary)",
|
|
541
|
+
borderLeft: "1px solid var(--color-border-default)",
|
|
542
|
+
};
|
|
543
|
+
}
|
|
544
|
+
const from = drag.index;
|
|
545
|
+
const to = drag.currentIndex;
|
|
546
|
+
const draggedWidth = drag.widths[from] ?? 0;
|
|
547
|
+
if (from < to && index > from && index <= to) {
|
|
548
|
+
return {
|
|
549
|
+
transform: `translateX(${-draggedWidth}px)`,
|
|
550
|
+
transition: "transform 200ms ease",
|
|
551
|
+
};
|
|
552
|
+
}
|
|
553
|
+
if (from > to && index >= to && index < from) {
|
|
554
|
+
return {
|
|
555
|
+
transform: `translateX(${draggedWidth}px)`,
|
|
556
|
+
transition: "transform 200ms ease",
|
|
557
|
+
};
|
|
558
|
+
}
|
|
559
|
+
return { transition: "transform 200ms ease" };
|
|
560
|
+
},
|
|
561
|
+
[drag],
|
|
562
|
+
);
|
|
563
|
+
|
|
564
|
+
return {
|
|
565
|
+
drag,
|
|
566
|
+
itemsRef,
|
|
567
|
+
handlePointerDown,
|
|
568
|
+
handlePointerMove,
|
|
569
|
+
handlePointerUp,
|
|
570
|
+
getTransform,
|
|
571
|
+
};
|
|
572
|
+
}
|
|
573
|
+
|
|
574
|
+
function TabsBrowserList({
|
|
575
|
+
className,
|
|
576
|
+
children,
|
|
577
|
+
onReorder,
|
|
578
|
+
...props
|
|
579
|
+
}: React.ComponentProps<typeof TabsPrimitive.List> & {
|
|
580
|
+
onReorder?: (fromIndex: number, toIndex: number) => void;
|
|
581
|
+
}) {
|
|
582
|
+
const tabsListRef = React.useRef<HTMLDivElement | null>(null);
|
|
583
|
+
|
|
584
|
+
const [showScrollButtons, setShowScrollButtons] = React.useState(false);
|
|
585
|
+
const [canScrollLeft, setCanScrollLeft] = React.useState(false);
|
|
586
|
+
const [canScrollRight, setCanScrollRight] = React.useState(false);
|
|
587
|
+
|
|
588
|
+
const {
|
|
589
|
+
drag,
|
|
590
|
+
itemsRef,
|
|
591
|
+
handlePointerDown,
|
|
592
|
+
handlePointerMove,
|
|
593
|
+
handlePointerUp,
|
|
594
|
+
getTransform,
|
|
595
|
+
} = useTabReorder(onReorder);
|
|
596
|
+
|
|
597
|
+
const wrappedChildren =
|
|
598
|
+
onReorder && React.Children.count(children) > 1
|
|
599
|
+
? React.Children.map(children, (child, index) => (
|
|
600
|
+
<div
|
|
601
|
+
ref={(el) => {
|
|
602
|
+
itemsRef.current[index] = el;
|
|
603
|
+
}}
|
|
604
|
+
style={getTransform(index)}
|
|
605
|
+
onPointerDown={(e) => handlePointerDown(e, index)}
|
|
606
|
+
onPointerMove={handlePointerMove}
|
|
607
|
+
onPointerUp={handlePointerUp}
|
|
608
|
+
className={cn(drag?.index === index && "cursor-grabbing")}
|
|
609
|
+
>
|
|
610
|
+
{child}
|
|
611
|
+
</div>
|
|
612
|
+
))
|
|
613
|
+
: children;
|
|
614
|
+
|
|
615
|
+
return (
|
|
616
|
+
<React.Fragment>
|
|
617
|
+
{showScrollButtons && (
|
|
618
|
+
<TabScrollLeftButton
|
|
619
|
+
disabled={!canScrollLeft}
|
|
620
|
+
onClick={() => performHorizontalScroll(tabsListRef, "left")}
|
|
621
|
+
/>
|
|
622
|
+
)}
|
|
623
|
+
|
|
624
|
+
<TabsList
|
|
625
|
+
onLeftEdge={(edgeState) => {
|
|
626
|
+
if (edgeState === "touch") {
|
|
627
|
+
setCanScrollLeft(false);
|
|
628
|
+
} else {
|
|
629
|
+
setCanScrollLeft(true);
|
|
630
|
+
}
|
|
631
|
+
}}
|
|
632
|
+
onRightEdge={(edgeState) => {
|
|
633
|
+
if (edgeState === "touch") {
|
|
634
|
+
setCanScrollRight(false);
|
|
635
|
+
} else {
|
|
636
|
+
setCanScrollRight(true);
|
|
637
|
+
}
|
|
638
|
+
}}
|
|
639
|
+
onFlow={(flow) => {
|
|
640
|
+
if (flow === "overflow") {
|
|
641
|
+
setShowScrollButtons(true);
|
|
642
|
+
} else {
|
|
643
|
+
setShowScrollButtons(false);
|
|
644
|
+
}
|
|
645
|
+
}}
|
|
646
|
+
onResize={() => {
|
|
647
|
+
tabsListRef.current
|
|
648
|
+
?.querySelector<HTMLButtonElement>('button[data-state="active"]')
|
|
649
|
+
?.scrollIntoView();
|
|
650
|
+
}}
|
|
651
|
+
onTabChange={(entries) => {
|
|
652
|
+
if (
|
|
653
|
+
entries.filter((entry) => entry.addedNodes.length !== 0).length !==
|
|
654
|
+
0
|
|
655
|
+
) {
|
|
656
|
+
tabsListRef.current
|
|
657
|
+
?.querySelector<HTMLButtonElement>('button[data-state="active"]')
|
|
658
|
+
?.scrollIntoView();
|
|
659
|
+
}
|
|
660
|
+
}}
|
|
661
|
+
data-slot="tabs-list"
|
|
662
|
+
className={cn(tabsListStyles, className)}
|
|
663
|
+
onWheel={(event) => horizontalScroll(event)}
|
|
664
|
+
{...props}
|
|
665
|
+
ref={tabsListRef}
|
|
666
|
+
>
|
|
667
|
+
{wrappedChildren}
|
|
668
|
+
</TabsList>
|
|
669
|
+
|
|
670
|
+
{showScrollButtons && (
|
|
671
|
+
<TabScrollRightButton
|
|
672
|
+
disabled={!canScrollRight}
|
|
673
|
+
onClick={() => performHorizontalScroll(tabsListRef, "right")}
|
|
674
|
+
/>
|
|
675
|
+
)}
|
|
676
|
+
</React.Fragment>
|
|
677
|
+
);
|
|
678
|
+
}
|
|
679
|
+
|
|
680
|
+
export function TabsListDropdown({
|
|
681
|
+
tabs,
|
|
682
|
+
handleTabSelect,
|
|
683
|
+
handleCloseTab,
|
|
684
|
+
}: {
|
|
685
|
+
tabs: { id: string; content: React.ReactNode }[];
|
|
686
|
+
handleTabSelect?: (tabId: string) => void;
|
|
687
|
+
handleCloseTab?: (tabId: string) => void;
|
|
688
|
+
}) {
|
|
689
|
+
const [isMenuOpen, setIsMenuOpen] = React.useState(false);
|
|
690
|
+
return (
|
|
691
|
+
<Popover open={isMenuOpen} onOpenChange={setIsMenuOpen}>
|
|
692
|
+
<PopoverTrigger asChild>
|
|
693
|
+
<Button variant="link" className="bg-bg-secondary h-full border-b pr-6">
|
|
694
|
+
<ChevronDownIcon className="size-4" />
|
|
695
|
+
</Button>
|
|
696
|
+
</PopoverTrigger>
|
|
697
|
+
<PopoverContent className="w-80 p-0 mr-3" align="end">
|
|
698
|
+
<Command>
|
|
699
|
+
<CommandInput placeholder="Search tabs..." />
|
|
700
|
+
<CommandList>
|
|
701
|
+
<CommandEmpty>Not tabs found.</CommandEmpty>
|
|
702
|
+
{tabs.map((tab) => (
|
|
703
|
+
<CommandItem
|
|
704
|
+
key={tab.id}
|
|
705
|
+
onSelect={() => {
|
|
706
|
+
handleTabSelect?.(tab.id);
|
|
707
|
+
setIsMenuOpen(false);
|
|
708
|
+
}}
|
|
709
|
+
className="group flex items-center justify-between"
|
|
710
|
+
>
|
|
711
|
+
{tab.content}
|
|
712
|
+
{tabs.length > 1 && (
|
|
713
|
+
<Button
|
|
714
|
+
variant="ghost"
|
|
715
|
+
size="small"
|
|
716
|
+
className="opacity-0 group-hover:opacity-100 transition-opacity p-1 ml-2"
|
|
717
|
+
onClick={(e) => {
|
|
718
|
+
e.stopPropagation();
|
|
719
|
+
handleCloseTab?.(tab.id);
|
|
720
|
+
}}
|
|
721
|
+
>
|
|
722
|
+
<X className="size-3" />
|
|
723
|
+
</Button>
|
|
724
|
+
)}
|
|
725
|
+
</CommandItem>
|
|
726
|
+
))}
|
|
727
|
+
</CommandList>
|
|
728
|
+
</Command>
|
|
729
|
+
</PopoverContent>
|
|
730
|
+
</Popover>
|
|
731
|
+
);
|
|
732
|
+
}
|
|
733
|
+
|
|
75
734
|
function TabsTrigger({
|
|
76
735
|
className,
|
|
77
736
|
onClose,
|
|
@@ -79,19 +738,18 @@ function TabsTrigger({
|
|
|
79
738
|
}: React.ComponentProps<typeof TabsPrimitive.Trigger> & {
|
|
80
739
|
onClose?: (value: string) => void;
|
|
81
740
|
}) {
|
|
741
|
+
const variant = React.useContext(TabsVariantContext);
|
|
742
|
+
const isSecondary = variant === "secondary";
|
|
743
|
+
const isTertiary = variant === "tertiary";
|
|
744
|
+
|
|
82
745
|
return (
|
|
83
746
|
<TabsPrimitive.Trigger
|
|
84
747
|
data-slot="tabs-trigger"
|
|
85
748
|
className={cn(
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
"data-[state=active]:
|
|
89
|
-
"
|
|
90
|
-
"inline-flex flex-1 items-center justify-center whitespace-nowrap transition-[color,box-shadow]",
|
|
91
|
-
"focus-visible:ring-[3px] focus-visible:outline-1 disabled:pointer-events-none disabled:opacity-50",
|
|
92
|
-
"[&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
|
93
|
-
"hover:bg-bg-secondary/60",
|
|
94
|
-
onClose ? "justify-between" : "",
|
|
749
|
+
baseTabsTriggerStyles,
|
|
750
|
+
onClose ? "justify-between" : "justify-start",
|
|
751
|
+
isSecondary && ["body14", "data-[state=active]:body14bold"],
|
|
752
|
+
isTertiary && ["typo-body", "data-[state=active]:typo-label"],
|
|
95
753
|
className,
|
|
96
754
|
)}
|
|
97
755
|
{...props}
|
|
@@ -106,7 +764,7 @@ function TabsTrigger({
|
|
|
106
764
|
}}
|
|
107
765
|
variant="link"
|
|
108
766
|
size="small"
|
|
109
|
-
className="p-0 ml-2"
|
|
767
|
+
className="p-0 ml-2 opacity-0 group-hover/tabs-trigger:opacity-100 transition-opacity"
|
|
110
768
|
asChild
|
|
111
769
|
>
|
|
112
770
|
<span>
|
|
@@ -125,10 +783,10 @@ function TabsContent({
|
|
|
125
783
|
return (
|
|
126
784
|
<TabsPrimitive.Content
|
|
127
785
|
data-slot="tabs-content"
|
|
128
|
-
className={cn(
|
|
786
|
+
className={cn(tabsContentStyles, className)}
|
|
129
787
|
{...props}
|
|
130
788
|
/>
|
|
131
789
|
);
|
|
132
790
|
}
|
|
133
791
|
|
|
134
|
-
export { Tabs, TabsList, TabsTrigger, TabsContent };
|
|
792
|
+
export { Tabs, TabsList, TabsTrigger, TabsContent, TabsBrowserList };
|