@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,10 +1,13 @@
|
|
|
1
1
|
import { cn } from "#shadcn/lib/utils";
|
|
2
2
|
|
|
3
|
+
// Skeleton styles
|
|
4
|
+
const skeletonStyles = cn("bg-bg-tertiary", "animate-pulse", "rounded-md");
|
|
5
|
+
|
|
3
6
|
function Skeleton({ className, ...props }: React.ComponentProps<"div">) {
|
|
4
7
|
return (
|
|
5
8
|
<div
|
|
6
9
|
data-slot="skeleton"
|
|
7
|
-
className={cn(
|
|
10
|
+
className={cn(skeletonStyles, className)}
|
|
8
11
|
{...props}
|
|
9
12
|
/>
|
|
10
13
|
);
|
|
@@ -1,8 +1,87 @@
|
|
|
1
|
+
"use client";
|
|
1
2
|
import * as SliderPrimitive from "@radix-ui/react-slider";
|
|
2
3
|
import * as React from "react";
|
|
3
4
|
|
|
4
5
|
import { cn } from "#shadcn/lib/utils";
|
|
5
6
|
|
|
7
|
+
// Slider root styles
|
|
8
|
+
const sliderRootStyles = cn(
|
|
9
|
+
// Layout
|
|
10
|
+
"relative",
|
|
11
|
+
"flex",
|
|
12
|
+
"w-full",
|
|
13
|
+
"items-center",
|
|
14
|
+
// Interaction
|
|
15
|
+
"touch-none",
|
|
16
|
+
"select-none",
|
|
17
|
+
// Disabled
|
|
18
|
+
"data-[disabled]:opacity-50",
|
|
19
|
+
// Vertical orientation
|
|
20
|
+
"data-[orientation=vertical]:h-full",
|
|
21
|
+
"data-[orientation=vertical]:min-h-44",
|
|
22
|
+
"data-[orientation=vertical]:w-auto",
|
|
23
|
+
"data-[orientation=vertical]:flex-col",
|
|
24
|
+
);
|
|
25
|
+
|
|
26
|
+
// Slider track styles
|
|
27
|
+
const sliderTrackStyles = cn(
|
|
28
|
+
// Background
|
|
29
|
+
"bg-bg-quaternary",
|
|
30
|
+
// Layout
|
|
31
|
+
"relative",
|
|
32
|
+
"grow",
|
|
33
|
+
"overflow-hidden",
|
|
34
|
+
// Shape
|
|
35
|
+
"rounded-full",
|
|
36
|
+
// Horizontal orientation
|
|
37
|
+
"data-[orientation=horizontal]:h-1.5",
|
|
38
|
+
"data-[orientation=horizontal]:w-full",
|
|
39
|
+
// Vertical orientation
|
|
40
|
+
"data-[orientation=vertical]:h-full",
|
|
41
|
+
"data-[orientation=vertical]:w-1.5",
|
|
42
|
+
);
|
|
43
|
+
|
|
44
|
+
// Slider range styles
|
|
45
|
+
const sliderRangeStyles = cn(
|
|
46
|
+
// Background
|
|
47
|
+
"bg-bg-link",
|
|
48
|
+
// Layout
|
|
49
|
+
"absolute",
|
|
50
|
+
// Horizontal orientation
|
|
51
|
+
"data-[orientation=horizontal]:h-full",
|
|
52
|
+
// Vertical orientation
|
|
53
|
+
"data-[orientation=vertical]:w-full",
|
|
54
|
+
);
|
|
55
|
+
|
|
56
|
+
// Slider thumb styles
|
|
57
|
+
const sliderThumbStyles = cn(
|
|
58
|
+
// Layout
|
|
59
|
+
"block",
|
|
60
|
+
"size-4",
|
|
61
|
+
"shrink-0",
|
|
62
|
+
// Shape
|
|
63
|
+
"rounded-full",
|
|
64
|
+
// Borders
|
|
65
|
+
"border",
|
|
66
|
+
"border-border-link",
|
|
67
|
+
// Background
|
|
68
|
+
"bg-bg-primary",
|
|
69
|
+
// Shadow
|
|
70
|
+
"shadow-sm",
|
|
71
|
+
// Transitions
|
|
72
|
+
"transition-[color,box-shadow]",
|
|
73
|
+
// Hover
|
|
74
|
+
"hover:ring-4",
|
|
75
|
+
"hover:ring-utility-blue/70",
|
|
76
|
+
// Focus
|
|
77
|
+
"focus-visible:ring-4",
|
|
78
|
+
"focus-visible:ring-utility-blue/70",
|
|
79
|
+
"focus-visible:outline-hidden",
|
|
80
|
+
// Disabled
|
|
81
|
+
"disabled:pointer-events-none",
|
|
82
|
+
"disabled:opacity-50",
|
|
83
|
+
);
|
|
84
|
+
|
|
6
85
|
function Slider({
|
|
7
86
|
className,
|
|
8
87
|
defaultValue,
|
|
@@ -28,23 +107,16 @@ function Slider({
|
|
|
28
107
|
{...(value !== undefined ? { value } : {})}
|
|
29
108
|
min={min}
|
|
30
109
|
max={max}
|
|
31
|
-
className={cn(
|
|
32
|
-
"relative flex w-full touch-none items-center select-none data-[disabled]:opacity-50 data-[orientation=vertical]:h-full data-[orientation=vertical]:min-h-44 data-[orientation=vertical]:w-auto data-[orientation=vertical]:flex-col",
|
|
33
|
-
className,
|
|
34
|
-
)}
|
|
110
|
+
className={cn(sliderRootStyles, className)}
|
|
35
111
|
{...props}
|
|
36
112
|
>
|
|
37
113
|
<SliderPrimitive.Track
|
|
38
114
|
data-slot="slider-track"
|
|
39
|
-
className={
|
|
40
|
-
"bg-muted relative grow overflow-hidden rounded-full data-[orientation=horizontal]:h-1.5 data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-1.5",
|
|
41
|
-
)}
|
|
115
|
+
className={sliderTrackStyles}
|
|
42
116
|
>
|
|
43
117
|
<SliderPrimitive.Range
|
|
44
118
|
data-slot="slider-range"
|
|
45
|
-
className={
|
|
46
|
-
"bg-primary absolute data-[orientation=horizontal]:h-full data-[orientation=vertical]:w-full",
|
|
47
|
-
)}
|
|
119
|
+
className={sliderRangeStyles}
|
|
48
120
|
/>
|
|
49
121
|
</SliderPrimitive.Track>
|
|
50
122
|
{Array.from({ length: _values.length }, (_, index) => (
|
|
@@ -52,7 +124,7 @@ function Slider({
|
|
|
52
124
|
data-slot="slider-thumb"
|
|
53
125
|
// biome-ignore lint/suspicious/noArrayIndexKey: FIXME: unchanged shadcn
|
|
54
126
|
key={index}
|
|
55
|
-
className=
|
|
127
|
+
className={sliderThumbStyles}
|
|
56
128
|
/>
|
|
57
129
|
))}
|
|
58
130
|
</SliderPrimitive.Root>
|
|
@@ -1,29 +1,250 @@
|
|
|
1
|
+
import { Controls, Primary, Title } from "@storybook/addon-docs/blocks";
|
|
1
2
|
import type { Meta, StoryObj } from "@storybook/react-vite";
|
|
2
|
-
import {
|
|
3
|
+
import { Bug, Play } from "lucide-react";
|
|
4
|
+
import { useEffect } from "react";
|
|
3
5
|
import { Button } from "#shadcn/components/ui/button";
|
|
6
|
+
import { Toaster, toast } from "#shadcn/components/ui/sonner";
|
|
7
|
+
|
|
8
|
+
interface ToastWrapperProps {
|
|
9
|
+
variant?: "info" | "error";
|
|
10
|
+
closeButton?: boolean;
|
|
11
|
+
hasAction?: boolean;
|
|
12
|
+
hasSecondaryAction?: boolean;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
function ToastWrapper({
|
|
16
|
+
variant = "info",
|
|
17
|
+
closeButton = false,
|
|
18
|
+
hasAction = false,
|
|
19
|
+
hasSecondaryAction = false,
|
|
20
|
+
}: ToastWrapperProps) {
|
|
21
|
+
const isError = variant === "error";
|
|
22
|
+
|
|
23
|
+
const showToast = () => {
|
|
24
|
+
const toastFn = isError ? toast.error : toast.info;
|
|
25
|
+
toastFn(isError ? "Error notification" : "Info notification", {
|
|
26
|
+
description: "This is a toast message with description.",
|
|
27
|
+
closeButton,
|
|
28
|
+
actionSlot: hasAction ? (
|
|
29
|
+
<Button variant="primary" size="small" danger={isError}>
|
|
30
|
+
<Play className="size-4" />
|
|
31
|
+
Action
|
|
32
|
+
</Button>
|
|
33
|
+
) : undefined,
|
|
34
|
+
secondaryActionSlot: hasSecondaryAction ? (
|
|
35
|
+
<Button variant="ghost" size="small" danger={isError}>
|
|
36
|
+
<Bug className="size-4" />
|
|
37
|
+
Report
|
|
38
|
+
</Button>
|
|
39
|
+
) : undefined,
|
|
40
|
+
});
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
// biome-ignore lint/correctness/useExhaustiveDependencies: trigger on prop change
|
|
44
|
+
useEffect(() => {
|
|
45
|
+
showToast();
|
|
46
|
+
}, [variant, closeButton, hasAction, hasSecondaryAction]);
|
|
47
|
+
|
|
48
|
+
return (
|
|
49
|
+
<div className="flex flex-col items-center gap-4">
|
|
50
|
+
<Button variant="secondary" onClick={showToast}>
|
|
51
|
+
Show Toast
|
|
52
|
+
</Button>
|
|
53
|
+
<Toaster position="top-center" />
|
|
54
|
+
</div>
|
|
55
|
+
);
|
|
56
|
+
}
|
|
4
57
|
|
|
5
58
|
const meta = {
|
|
6
59
|
title: "Component/Sonner",
|
|
7
|
-
|
|
8
|
-
|
|
60
|
+
component: ToastWrapper,
|
|
61
|
+
parameters: {
|
|
62
|
+
layout: "centered",
|
|
63
|
+
docs: {
|
|
64
|
+
page: () => (
|
|
65
|
+
<>
|
|
66
|
+
<Title />
|
|
67
|
+
<Primary />
|
|
68
|
+
<Controls />
|
|
69
|
+
</>
|
|
70
|
+
),
|
|
71
|
+
},
|
|
72
|
+
},
|
|
73
|
+
argTypes: {
|
|
74
|
+
variant: {
|
|
75
|
+
control: "select",
|
|
76
|
+
options: ["info", "error"],
|
|
77
|
+
},
|
|
78
|
+
closeButton: {
|
|
79
|
+
control: "boolean",
|
|
80
|
+
},
|
|
81
|
+
hasAction: {
|
|
82
|
+
control: "boolean",
|
|
83
|
+
},
|
|
84
|
+
hasSecondaryAction: {
|
|
85
|
+
control: "boolean",
|
|
86
|
+
},
|
|
87
|
+
},
|
|
88
|
+
args: {
|
|
89
|
+
variant: "info",
|
|
90
|
+
closeButton: false,
|
|
91
|
+
hasAction: false,
|
|
92
|
+
hasSecondaryAction: false,
|
|
93
|
+
},
|
|
94
|
+
} satisfies Meta<typeof ToastWrapper>;
|
|
9
95
|
|
|
96
|
+
export default meta;
|
|
10
97
|
type Story = StoryObj<typeof meta>;
|
|
11
98
|
|
|
99
|
+
export const Default = {
|
|
100
|
+
tags: ["!dev"],
|
|
101
|
+
render: ({
|
|
102
|
+
variant = "info",
|
|
103
|
+
closeButton = false,
|
|
104
|
+
hasAction = false,
|
|
105
|
+
hasSecondaryAction = false,
|
|
106
|
+
}) => (
|
|
107
|
+
<ToastWrapper
|
|
108
|
+
variant={variant}
|
|
109
|
+
closeButton={closeButton}
|
|
110
|
+
hasAction={hasAction}
|
|
111
|
+
hasSecondaryAction={hasSecondaryAction}
|
|
112
|
+
/>
|
|
113
|
+
),
|
|
114
|
+
} satisfies Story;
|
|
115
|
+
|
|
12
116
|
export const Demo = {
|
|
117
|
+
tags: ["!autodocs"],
|
|
13
118
|
render: () => (
|
|
14
|
-
<
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
119
|
+
<div className="flex flex-col gap-4">
|
|
120
|
+
<div className="flex gap-2 flex-wrap">
|
|
121
|
+
<Button
|
|
122
|
+
variant="secondary"
|
|
123
|
+
onClick={() => {
|
|
124
|
+
toast.info("Info notification", {
|
|
125
|
+
description: "This is an informational message.",
|
|
126
|
+
});
|
|
127
|
+
}}
|
|
128
|
+
>
|
|
129
|
+
Info
|
|
130
|
+
</Button>
|
|
131
|
+
|
|
132
|
+
<Button
|
|
133
|
+
variant="secondary"
|
|
134
|
+
onClick={() => {
|
|
135
|
+
toast.info("Info with close", {
|
|
136
|
+
description: "This toast has a close button.",
|
|
137
|
+
closeButton: true,
|
|
138
|
+
});
|
|
139
|
+
}}
|
|
140
|
+
>
|
|
141
|
+
Info + Close
|
|
142
|
+
</Button>
|
|
143
|
+
|
|
144
|
+
<Button
|
|
145
|
+
variant="secondary"
|
|
146
|
+
onClick={() => {
|
|
147
|
+
toast.info("Info with action", {
|
|
148
|
+
description: "Click the button to perform action.",
|
|
149
|
+
actionSlot: (
|
|
150
|
+
<Button variant="primary" size="small">
|
|
151
|
+
<Play className="size-4" />
|
|
152
|
+
Action
|
|
153
|
+
</Button>
|
|
154
|
+
),
|
|
155
|
+
});
|
|
156
|
+
}}
|
|
157
|
+
>
|
|
158
|
+
Info + Action
|
|
159
|
+
</Button>
|
|
160
|
+
|
|
161
|
+
<Button
|
|
162
|
+
variant="secondary"
|
|
163
|
+
onClick={() => {
|
|
164
|
+
toast.info("Info with actions", {
|
|
165
|
+
description: "Multiple actions available.",
|
|
166
|
+
actionSlot: (
|
|
167
|
+
<Button variant="primary" size="small">
|
|
168
|
+
<Play className="size-4" />
|
|
169
|
+
Action
|
|
170
|
+
</Button>
|
|
171
|
+
),
|
|
172
|
+
secondaryActionSlot: (
|
|
173
|
+
<Button variant="ghost" size="small">
|
|
174
|
+
<Bug className="size-4" />
|
|
175
|
+
Report
|
|
176
|
+
</Button>
|
|
177
|
+
),
|
|
178
|
+
closeButton: true,
|
|
179
|
+
});
|
|
180
|
+
}}
|
|
181
|
+
>
|
|
182
|
+
Info + All
|
|
183
|
+
</Button>
|
|
184
|
+
|
|
185
|
+
<Button
|
|
186
|
+
variant="secondary"
|
|
187
|
+
onClick={() => {
|
|
188
|
+
toast.error("Error notification", {
|
|
189
|
+
description: "Something went wrong.",
|
|
190
|
+
});
|
|
191
|
+
}}
|
|
192
|
+
>
|
|
193
|
+
Error
|
|
194
|
+
</Button>
|
|
195
|
+
|
|
196
|
+
<Button
|
|
197
|
+
variant="secondary"
|
|
198
|
+
onClick={() => {
|
|
199
|
+
toast.error("Error with close", {
|
|
200
|
+
description: "This error has a close button.",
|
|
201
|
+
closeButton: true,
|
|
202
|
+
});
|
|
203
|
+
}}
|
|
204
|
+
>
|
|
205
|
+
Error + Close
|
|
206
|
+
</Button>
|
|
207
|
+
|
|
208
|
+
<Button
|
|
209
|
+
variant="secondary"
|
|
210
|
+
onClick={() => {
|
|
211
|
+
toast.error("Error with action", {
|
|
212
|
+
description: "Click to retry the operation.",
|
|
213
|
+
actionSlot: (
|
|
214
|
+
<Button variant="primary" size="small" danger>
|
|
215
|
+
Retry
|
|
216
|
+
</Button>
|
|
217
|
+
),
|
|
218
|
+
});
|
|
219
|
+
}}
|
|
220
|
+
>
|
|
221
|
+
Error + Action
|
|
222
|
+
</Button>
|
|
223
|
+
|
|
224
|
+
<Button
|
|
225
|
+
variant="secondary"
|
|
226
|
+
onClick={() => {
|
|
227
|
+
toast.error("Error with actions", {
|
|
228
|
+
description: "Multiple actions available.",
|
|
229
|
+
actionSlot: (
|
|
230
|
+
<Button variant="primary" size="small" danger>
|
|
231
|
+
Retry
|
|
232
|
+
</Button>
|
|
233
|
+
),
|
|
234
|
+
secondaryActionSlot: (
|
|
235
|
+
<Button variant="ghost" size="small" danger>
|
|
236
|
+
<Bug className="size-4" />
|
|
237
|
+
Report
|
|
238
|
+
</Button>
|
|
239
|
+
),
|
|
240
|
+
closeButton: true,
|
|
241
|
+
});
|
|
242
|
+
}}
|
|
243
|
+
>
|
|
244
|
+
Error + All
|
|
245
|
+
</Button>
|
|
246
|
+
</div>
|
|
247
|
+
<Toaster position="top-center" />
|
|
248
|
+
</div>
|
|
28
249
|
),
|
|
29
250
|
} satisfies Story;
|
|
@@ -1,23 +1,266 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { Info, TriangleAlert, X } from "lucide-react";
|
|
1
4
|
import { useTheme } from "next-themes";
|
|
2
|
-
import
|
|
5
|
+
import type * as React from "react";
|
|
6
|
+
import {
|
|
7
|
+
Toaster as Sonner,
|
|
8
|
+
toast as sonnerToast,
|
|
9
|
+
type ToasterProps,
|
|
10
|
+
} from "sonner";
|
|
11
|
+
import { cn } from "#shadcn/lib/utils";
|
|
12
|
+
|
|
13
|
+
/* ==========================================================================
|
|
14
|
+
Styles
|
|
15
|
+
========================================================================== */
|
|
16
|
+
|
|
17
|
+
const toastBaseStyles = cn(
|
|
18
|
+
// Layout
|
|
19
|
+
"flex",
|
|
20
|
+
"items-start",
|
|
21
|
+
"gap-[var(--spacing-x1point5,12px)]",
|
|
22
|
+
// Shape
|
|
23
|
+
"rounded-[var(--corner-corner-m,6px)]",
|
|
24
|
+
// Spacing
|
|
25
|
+
"p-[var(--spacing-x2,16px)]",
|
|
26
|
+
// Border
|
|
27
|
+
"border",
|
|
28
|
+
);
|
|
29
|
+
|
|
30
|
+
const toastDefaultStyles = cn(
|
|
31
|
+
toastBaseStyles,
|
|
32
|
+
// Background
|
|
33
|
+
"bg-bg-primary",
|
|
34
|
+
// Border
|
|
35
|
+
"border-border-separator",
|
|
36
|
+
);
|
|
37
|
+
|
|
38
|
+
const toastErrorStyles = cn(
|
|
39
|
+
toastBaseStyles,
|
|
40
|
+
// Background
|
|
41
|
+
"bg-bg-error-secondary",
|
|
42
|
+
// Border
|
|
43
|
+
"border-border-error_inverse",
|
|
44
|
+
);
|
|
45
|
+
|
|
46
|
+
const iconContainerStyles = cn(
|
|
47
|
+
// Layout
|
|
48
|
+
"shrink-0",
|
|
49
|
+
"size-5",
|
|
50
|
+
);
|
|
51
|
+
|
|
52
|
+
const contentContainerStyles = cn(
|
|
53
|
+
// Layout
|
|
54
|
+
"flex",
|
|
55
|
+
"flex-col",
|
|
56
|
+
"gap-[var(--spacing-x1,8px)]",
|
|
57
|
+
"flex-1",
|
|
58
|
+
"min-w-0",
|
|
59
|
+
);
|
|
60
|
+
|
|
61
|
+
const titleDefaultStyles = cn(
|
|
62
|
+
// Typography
|
|
63
|
+
"body14bold",
|
|
64
|
+
"text-text-primary",
|
|
65
|
+
);
|
|
66
|
+
|
|
67
|
+
const titleErrorStyles = cn(
|
|
68
|
+
// Typography
|
|
69
|
+
"body14bold",
|
|
70
|
+
"text-text-error-primary",
|
|
71
|
+
);
|
|
72
|
+
|
|
73
|
+
const descriptionDefaultStyles = cn(
|
|
74
|
+
// Typography
|
|
75
|
+
"body14",
|
|
76
|
+
"text-text-secondary_hover",
|
|
77
|
+
);
|
|
78
|
+
|
|
79
|
+
const descriptionErrorStyles = cn(
|
|
80
|
+
// Typography
|
|
81
|
+
"body14",
|
|
82
|
+
"text-[var(--color-red-800)]",
|
|
83
|
+
);
|
|
84
|
+
|
|
85
|
+
const closeButtonStyles = cn(
|
|
86
|
+
// Layout
|
|
87
|
+
"shrink-0",
|
|
88
|
+
"size-5",
|
|
89
|
+
// Interaction
|
|
90
|
+
"cursor-pointer",
|
|
91
|
+
"hover:opacity-70",
|
|
92
|
+
"transition-opacity",
|
|
93
|
+
);
|
|
94
|
+
|
|
95
|
+
const closeButtonDefaultStyles = cn(
|
|
96
|
+
closeButtonStyles,
|
|
97
|
+
// Typography
|
|
98
|
+
"text-text-primary",
|
|
99
|
+
);
|
|
100
|
+
|
|
101
|
+
const closeButtonErrorStyles = cn(
|
|
102
|
+
closeButtonStyles,
|
|
103
|
+
// Typography
|
|
104
|
+
"text-[var(--color-red-800)]",
|
|
105
|
+
);
|
|
106
|
+
|
|
107
|
+
/* ==========================================================================
|
|
108
|
+
Components
|
|
109
|
+
========================================================================== */
|
|
110
|
+
|
|
111
|
+
type ToastVariant = "default" | "error";
|
|
112
|
+
|
|
113
|
+
interface ToastContentProps {
|
|
114
|
+
id: string | number;
|
|
115
|
+
title: string;
|
|
116
|
+
description?: string | undefined;
|
|
117
|
+
variant?: ToastVariant;
|
|
118
|
+
showCloseButton?: boolean;
|
|
119
|
+
actionSlot?: React.ReactNode;
|
|
120
|
+
secondaryActionSlot?: React.ReactNode;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
function ToastContent({
|
|
124
|
+
id,
|
|
125
|
+
title,
|
|
126
|
+
description,
|
|
127
|
+
variant = "default",
|
|
128
|
+
showCloseButton = false,
|
|
129
|
+
actionSlot,
|
|
130
|
+
secondaryActionSlot,
|
|
131
|
+
}: ToastContentProps) {
|
|
132
|
+
const isError = variant === "error";
|
|
133
|
+
|
|
134
|
+
const Icon = isError ? TriangleAlert : Info;
|
|
135
|
+
const iconColor = isError ? "text-text-error-primary" : "text-text-primary";
|
|
3
136
|
|
|
4
|
-
const
|
|
137
|
+
const hasActions = actionSlot || secondaryActionSlot;
|
|
138
|
+
|
|
139
|
+
return (
|
|
140
|
+
<div className={isError ? toastErrorStyles : toastDefaultStyles}>
|
|
141
|
+
{/* Icon */}
|
|
142
|
+
<div className={cn(iconContainerStyles, iconColor)}>
|
|
143
|
+
<Icon className="size-5" />
|
|
144
|
+
</div>
|
|
145
|
+
|
|
146
|
+
{/* Content */}
|
|
147
|
+
<div className={contentContainerStyles}>
|
|
148
|
+
<div className={isError ? titleErrorStyles : titleDefaultStyles}>
|
|
149
|
+
{title}
|
|
150
|
+
</div>
|
|
151
|
+
{description && (
|
|
152
|
+
<div
|
|
153
|
+
className={
|
|
154
|
+
isError ? descriptionErrorStyles : descriptionDefaultStyles
|
|
155
|
+
}
|
|
156
|
+
>
|
|
157
|
+
{description}
|
|
158
|
+
</div>
|
|
159
|
+
)}
|
|
160
|
+
{hasActions && (
|
|
161
|
+
<div className="mt-1 flex items-center gap-2 flex-wrap">
|
|
162
|
+
{actionSlot && <div>{actionSlot}</div>}
|
|
163
|
+
{secondaryActionSlot && <div>{secondaryActionSlot}</div>}
|
|
164
|
+
</div>
|
|
165
|
+
)}
|
|
166
|
+
</div>
|
|
167
|
+
|
|
168
|
+
{/* Close button - always shown if showCloseButton is true */}
|
|
169
|
+
{showCloseButton && (
|
|
170
|
+
<button
|
|
171
|
+
type="button"
|
|
172
|
+
onClick={() => sonnerToast.dismiss(id)}
|
|
173
|
+
className={
|
|
174
|
+
isError ? closeButtonErrorStyles : closeButtonDefaultStyles
|
|
175
|
+
}
|
|
176
|
+
aria-label="Close"
|
|
177
|
+
>
|
|
178
|
+
<X className="size-5" />
|
|
179
|
+
</button>
|
|
180
|
+
)}
|
|
181
|
+
</div>
|
|
182
|
+
);
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
/* ==========================================================================
|
|
186
|
+
Toaster
|
|
187
|
+
========================================================================== */
|
|
188
|
+
|
|
189
|
+
function Toaster({ ...props }: ToasterProps) {
|
|
5
190
|
const { theme = "system" } = useTheme();
|
|
6
191
|
|
|
7
192
|
return (
|
|
8
193
|
<Sonner
|
|
9
|
-
theme={
|
|
10
|
-
|
|
11
|
-
style={
|
|
12
|
-
{
|
|
13
|
-
"--normal-bg": "var(--popover)",
|
|
14
|
-
"--normal-text": "var(--popover-foreground)",
|
|
15
|
-
"--normal-border": "var(--border)",
|
|
16
|
-
} as React.CSSProperties
|
|
194
|
+
theme={
|
|
195
|
+
theme === "system" ? "system" : theme === "dark" ? "dark" : "light"
|
|
17
196
|
}
|
|
197
|
+
className="toaster group"
|
|
198
|
+
toastOptions={{
|
|
199
|
+
unstyled: true,
|
|
200
|
+
classNames: {
|
|
201
|
+
toast: "w-full max-w-[588px]",
|
|
202
|
+
},
|
|
203
|
+
}}
|
|
18
204
|
{...props}
|
|
19
205
|
/>
|
|
20
206
|
);
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
/* ==========================================================================
|
|
210
|
+
Toast API
|
|
211
|
+
========================================================================== */
|
|
212
|
+
|
|
213
|
+
interface ToastOptions {
|
|
214
|
+
description?: string;
|
|
215
|
+
actionSlot?: React.ReactNode;
|
|
216
|
+
secondaryActionSlot?: React.ReactNode;
|
|
217
|
+
closeButton?: boolean;
|
|
218
|
+
duration?: number;
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
function createToast(
|
|
222
|
+
title: string,
|
|
223
|
+
variant: ToastVariant,
|
|
224
|
+
options?: ToastOptions,
|
|
225
|
+
) {
|
|
226
|
+
const showCloseButton = options?.closeButton ?? false;
|
|
227
|
+
|
|
228
|
+
return sonnerToast.custom(
|
|
229
|
+
(id) => {
|
|
230
|
+
const contentProps: Omit<ToastContentProps, "id"> = {
|
|
231
|
+
title,
|
|
232
|
+
description: options?.description,
|
|
233
|
+
variant,
|
|
234
|
+
showCloseButton,
|
|
235
|
+
actionSlot: options?.actionSlot,
|
|
236
|
+
secondaryActionSlot: options?.secondaryActionSlot,
|
|
237
|
+
};
|
|
238
|
+
|
|
239
|
+
return <ToastContent id={id} {...contentProps} />;
|
|
240
|
+
},
|
|
241
|
+
options?.duration !== undefined
|
|
242
|
+
? { duration: options.duration }
|
|
243
|
+
: undefined,
|
|
244
|
+
);
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
const toast = {
|
|
248
|
+
/**
|
|
249
|
+
* Default info toast
|
|
250
|
+
*/
|
|
251
|
+
info: (title: string, options?: ToastOptions) =>
|
|
252
|
+
createToast(title, "default", options),
|
|
253
|
+
|
|
254
|
+
/**
|
|
255
|
+
* Error/alert toast
|
|
256
|
+
*/
|
|
257
|
+
error: (title: string, options?: ToastOptions) =>
|
|
258
|
+
createToast(title, "error", options),
|
|
259
|
+
|
|
260
|
+
/**
|
|
261
|
+
* Dismiss a toast by id
|
|
262
|
+
*/
|
|
263
|
+
dismiss: sonnerToast.dismiss,
|
|
21
264
|
};
|
|
22
265
|
|
|
23
|
-
export { Toaster };
|
|
266
|
+
export { Toaster, toast };
|