@health-samurai/react-components 0.0.0-alpha.2 → 0.0.0-alpha.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +102 -1
- package/dist/bundle.css +2349 -754
- package/dist/src/components/button-dropdown.d.ts +10 -0
- package/dist/src/components/button-dropdown.d.ts.map +1 -0
- package/dist/src/components/button-dropdown.js +70 -0
- package/dist/src/components/button-dropdown.js.map +1 -0
- package/dist/src/components/button-dropdown.stories.js +48 -0
- package/dist/src/components/button-dropdown.stories.js.map +1 -0
- package/dist/src/components/code-editor/fhir-autocomplete.d.ts +70 -0
- package/dist/src/components/code-editor/fhir-autocomplete.d.ts.map +1 -0
- package/dist/src/components/code-editor/fhir-autocomplete.js +1850 -0
- package/dist/src/components/code-editor/fhir-autocomplete.js.map +1 -0
- package/dist/src/components/code-editor/fhir-autocomplete.test.js +1099 -0
- package/dist/src/components/code-editor/fhir-autocomplete.test.js.map +1 -0
- package/dist/src/components/code-editor/http/grammar/http.d.ts +3 -0
- package/dist/src/components/code-editor/http/grammar/http.d.ts.map +1 -0
- package/dist/src/components/code-editor/http/grammar/http.grammar +74 -0
- package/dist/src/components/code-editor/http/grammar/http.js +38 -0
- package/dist/src/components/code-editor/http/grammar/http.js.map +1 -0
- package/dist/src/components/code-editor/http/grammar/http.terms.d.ts +2 -0
- package/dist/src/components/code-editor/http/grammar/http.terms.d.ts.map +1 -0
- package/dist/src/components/code-editor/http/grammar/http.terms.js +4 -0
- package/dist/src/components/code-editor/http/grammar/http.terms.js.map +1 -0
- package/dist/src/components/code-editor/http/grammar/http.test.js +80 -0
- package/dist/src/components/code-editor/http/grammar/http.test.js.map +1 -0
- package/dist/src/components/code-editor/http/index.d.ts +12 -0
- package/dist/src/components/code-editor/http/index.d.ts.map +1 -0
- package/dist/src/components/code-editor/http/index.js +486 -0
- package/dist/src/components/code-editor/http/index.js.map +1 -0
- package/dist/src/components/code-editor/index.d.ts +39 -1
- package/dist/src/components/code-editor/index.d.ts.map +1 -1
- package/dist/src/components/code-editor/index.js +1792 -45
- package/dist/src/components/code-editor/index.js.map +1 -1
- package/dist/src/components/code-editor/json-ast.d.ts +46 -0
- package/dist/src/components/code-editor/json-ast.d.ts.map +1 -0
- package/dist/src/components/code-editor/json-ast.js +465 -0
- package/dist/src/components/code-editor/json-ast.js.map +1 -0
- package/dist/src/components/code-editor/json-ast.test.js +206 -0
- package/dist/src/components/code-editor/json-ast.test.js.map +1 -0
- package/dist/src/components/code-editor/sql-completion.d.ts +22 -0
- package/dist/src/components/code-editor/sql-completion.d.ts.map +1 -0
- package/dist/src/components/code-editor/sql-completion.js +897 -0
- package/dist/src/components/code-editor/sql-completion.js.map +1 -0
- package/dist/src/components/code-editor.stories.js +280 -3
- package/dist/src/components/code-editor.stories.js.map +1 -1
- package/dist/src/components/copy-icon.d.ts +5 -1
- package/dist/src/components/copy-icon.d.ts.map +1 -1
- package/dist/src/components/copy-icon.js +41 -3
- package/dist/src/components/copy-icon.js.map +1 -1
- package/dist/src/components/data-table.d.ts +9 -0
- package/dist/src/components/data-table.d.ts.map +1 -0
- package/dist/src/components/data-table.js +66 -0
- package/dist/src/components/data-table.js.map +1 -0
- package/dist/src/components/data-table.stories.js +240 -0
- package/dist/src/components/data-table.stories.js.map +1 -0
- package/dist/src/components/date-picker-input.d.ts +10 -0
- package/dist/src/components/date-picker-input.d.ts.map +1 -0
- package/dist/src/components/date-picker-input.js +90 -0
- package/dist/src/components/date-picker-input.js.map +1 -0
- package/dist/src/components/date-picker-input.stories.js +76 -0
- package/dist/src/components/date-picker-input.stories.js.map +1 -0
- package/dist/src/components/fhir-structure-view.d.ts +34 -0
- package/dist/src/components/fhir-structure-view.d.ts.map +1 -0
- package/dist/src/components/fhir-structure-view.js +230 -0
- package/dist/src/components/fhir-structure-view.js.map +1 -0
- package/dist/src/components/fhir-structure-view.stories.js +447 -0
- package/dist/src/components/fhir-structure-view.stories.js.map +1 -0
- package/dist/src/components/icon-button.d.ts +12 -0
- package/dist/src/components/icon-button.d.ts.map +1 -0
- package/dist/src/components/icon-button.js +41 -0
- package/dist/src/components/icon-button.js.map +1 -0
- package/dist/src/components/icon-button.stories.js +157 -0
- package/dist/src/components/icon-button.stories.js.map +1 -0
- package/dist/src/components/operation-outcome-view.d.ts +27 -0
- package/dist/src/components/operation-outcome-view.d.ts.map +1 -0
- package/dist/src/components/operation-outcome-view.js +198 -0
- package/dist/src/components/operation-outcome-view.js.map +1 -0
- package/dist/src/components/operation-outcome-view.stories.js +207 -0
- package/dist/src/components/operation-outcome-view.stories.js.map +1 -0
- package/dist/src/components/request-line-editor.d.ts +13 -35
- package/dist/src/components/request-line-editor.d.ts.map +1 -1
- package/dist/src/components/request-line-editor.js +73 -49
- package/dist/src/components/request-line-editor.js.map +1 -1
- package/dist/src/components/request-line-editor.stories.js +17 -53
- package/dist/src/components/request-line-editor.stories.js.map +1 -1
- package/dist/src/components/sandbox.d.ts +13 -0
- package/dist/src/components/sandbox.d.ts.map +1 -0
- package/dist/src/components/sandbox.js +107 -0
- package/dist/src/components/sandbox.js.map +1 -0
- package/dist/src/components/sandbox.stories.js +126 -0
- package/dist/src/components/sandbox.stories.js.map +1 -0
- package/dist/src/components/segment-control.d.ts +13 -0
- package/dist/src/components/segment-control.d.ts.map +1 -0
- package/dist/src/components/segment-control.js +33 -0
- package/dist/src/components/segment-control.js.map +1 -0
- package/dist/src/components/segment-control.stories.js +68 -0
- package/dist/src/components/segment-control.stories.js.map +1 -0
- package/dist/src/components/split-button.d.ts +12 -0
- package/dist/src/components/split-button.d.ts.map +1 -0
- package/dist/src/components/split-button.js +33 -0
- package/dist/src/components/split-button.js.map +1 -0
- package/dist/src/components/split-button.stories.js +84 -0
- package/dist/src/components/split-button.stories.js.map +1 -0
- package/dist/src/components/tag.d.ts +16 -0
- package/dist/src/components/tag.d.ts.map +1 -0
- package/dist/src/components/tag.js +198 -0
- package/dist/src/components/tag.js.map +1 -0
- package/dist/src/components/tag.stories.js +459 -0
- package/dist/src/components/tag.stories.js.map +1 -0
- package/dist/src/components/tile.d.ts +15 -0
- package/dist/src/components/tile.d.ts.map +1 -0
- package/dist/src/components/tile.js +76 -0
- package/dist/src/components/tile.js.map +1 -0
- package/dist/src/components/tile.stories.js +167 -0
- package/dist/src/components/tile.stories.js.map +1 -0
- package/dist/src/components/toolbar.d.ts +18 -0
- package/dist/src/components/toolbar.d.ts.map +1 -0
- package/dist/src/components/toolbar.js +61 -0
- package/dist/src/components/toolbar.js.map +1 -0
- package/dist/src/components/toolbar.stories.js +69 -0
- package/dist/src/components/toolbar.stories.js.map +1 -0
- package/dist/src/components/tree-view.d.ts +47 -0
- package/dist/src/components/tree-view.d.ts.map +1 -0
- package/dist/src/components/tree-view.js +122 -0
- package/dist/src/components/tree-view.js.map +1 -0
- package/dist/src/components/tree-view.stories.js +283 -0
- package/dist/src/components/tree-view.stories.js.map +1 -0
- package/dist/src/icons.d.ts +11 -0
- package/dist/src/icons.d.ts.map +1 -0
- package/dist/src/icons.js +328 -0
- package/dist/src/icons.js.map +1 -0
- package/dist/src/index.css +358 -74
- package/dist/src/index.d.ts +17 -1
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +17 -1
- package/dist/src/index.js.map +1 -1
- package/dist/src/shadcn/components/ui/accordion.d.ts +2 -2
- package/dist/src/shadcn/components/ui/accordion.d.ts.map +1 -1
- package/dist/src/shadcn/components/ui/accordion.js +35 -9
- package/dist/src/shadcn/components/ui/accordion.js.map +1 -1
- package/dist/src/shadcn/components/ui/alert-dialog.d.ts +12 -4
- package/dist/src/shadcn/components/ui/alert-dialog.d.ts.map +1 -1
- package/dist/src/shadcn/components/ui/alert-dialog.js +128 -18
- package/dist/src/shadcn/components/ui/alert-dialog.js.map +1 -1
- package/dist/src/shadcn/components/ui/alert-dialog.stories.js +269 -19
- package/dist/src/shadcn/components/ui/alert-dialog.stories.js.map +1 -1
- package/dist/src/shadcn/components/ui/alert.d.ts +29 -6
- package/dist/src/shadcn/components/ui/alert.d.ts.map +1 -1
- package/dist/src/shadcn/components/ui/alert.js +50 -19
- package/dist/src/shadcn/components/ui/alert.js.map +1 -1
- package/dist/src/shadcn/components/ui/alert.stories.js +140 -36
- package/dist/src/shadcn/components/ui/alert.stories.js.map +1 -1
- package/dist/src/shadcn/components/ui/aspect-ratio.d.ts.map +1 -1
- package/dist/src/shadcn/components/ui/aspect-ratio.js +1 -0
- package/dist/src/shadcn/components/ui/aspect-ratio.js.map +1 -1
- package/dist/src/shadcn/components/ui/avatar.d.ts.map +1 -1
- package/dist/src/shadcn/components/ui/avatar.js +4 -3
- package/dist/src/shadcn/components/ui/avatar.js.map +1 -1
- package/dist/src/shadcn/components/ui/avatar.stories.js +68 -2
- package/dist/src/shadcn/components/ui/avatar.stories.js.map +1 -1
- package/dist/src/shadcn/components/ui/badge.d.ts +1 -1
- package/dist/src/shadcn/components/ui/badge.d.ts.map +1 -1
- package/dist/src/shadcn/components/ui/badge.js +16 -5
- package/dist/src/shadcn/components/ui/badge.js.map +1 -1
- package/dist/src/shadcn/components/ui/breadcrumb.d.ts +5 -2
- package/dist/src/shadcn/components/ui/breadcrumb.d.ts.map +1 -1
- package/dist/src/shadcn/components/ui/breadcrumb.js +98 -13
- package/dist/src/shadcn/components/ui/breadcrumb.js.map +1 -1
- package/dist/src/shadcn/components/ui/breadcrumb.stories.js +205 -45
- package/dist/src/shadcn/components/ui/breadcrumb.stories.js.map +1 -1
- package/dist/src/shadcn/components/ui/button.d.ts.map +1 -1
- package/dist/src/shadcn/components/ui/button.js +65 -11
- package/dist/src/shadcn/components/ui/button.js.map +1 -1
- package/dist/src/shadcn/components/ui/button.stories.js +99 -17
- package/dist/src/shadcn/components/ui/button.stories.js.map +1 -1
- package/dist/src/shadcn/components/ui/calendar.d.ts +1 -1
- package/dist/src/shadcn/components/ui/calendar.d.ts.map +1 -1
- package/dist/src/shadcn/components/ui/calendar.js +1 -0
- package/dist/src/shadcn/components/ui/calendar.js.map +1 -1
- package/dist/src/shadcn/components/ui/card.d.ts +5 -1
- package/dist/src/shadcn/components/ui/card.d.ts.map +1 -1
- package/dist/src/shadcn/components/ui/card.js +28 -7
- package/dist/src/shadcn/components/ui/card.js.map +1 -1
- package/dist/src/shadcn/components/ui/card.stories.js +23 -2
- package/dist/src/shadcn/components/ui/card.stories.js.map +1 -1
- package/dist/src/shadcn/components/ui/carousel.d.ts +1 -1
- package/dist/src/shadcn/components/ui/carousel.d.ts.map +1 -1
- package/dist/src/shadcn/components/ui/carousel.js +1 -0
- package/dist/src/shadcn/components/ui/carousel.js.map +1 -1
- package/dist/src/shadcn/components/ui/chart.d.ts +5 -5
- package/dist/src/shadcn/components/ui/chart.d.ts.map +1 -1
- package/dist/src/shadcn/components/ui/chart.js +4 -3
- package/dist/src/shadcn/components/ui/chart.js.map +1 -1
- package/dist/src/shadcn/components/ui/checkbox.d.ts +5 -1
- package/dist/src/shadcn/components/ui/checkbox.d.ts.map +1 -1
- package/dist/src/shadcn/components/ui/checkbox.js +46 -6
- package/dist/src/shadcn/components/ui/checkbox.js.map +1 -1
- package/dist/src/shadcn/components/ui/checkbox.stories.js +156 -46
- package/dist/src/shadcn/components/ui/checkbox.stories.js.map +1 -1
- package/dist/src/shadcn/components/ui/combobox.d.ts +29 -0
- package/dist/src/shadcn/components/ui/combobox.d.ts.map +1 -0
- package/dist/src/shadcn/components/ui/combobox.js +226 -0
- package/dist/src/shadcn/components/ui/combobox.js.map +1 -0
- package/dist/src/shadcn/components/ui/combobox.stories.js +167 -0
- package/dist/src/shadcn/components/ui/combobox.stories.js.map +1 -0
- package/dist/src/shadcn/components/ui/command.d.ts +4 -2
- package/dist/src/shadcn/components/ui/command.d.ts.map +1 -1
- package/dist/src/shadcn/components/ui/command.js +75 -13
- package/dist/src/shadcn/components/ui/command.js.map +1 -1
- package/dist/src/shadcn/components/ui/command.stories.js +277 -57
- package/dist/src/shadcn/components/ui/command.stories.js.map +1 -1
- package/dist/src/shadcn/components/ui/context-menu.d.ts +7 -3
- package/dist/src/shadcn/components/ui/context-menu.d.ts.map +1 -1
- package/dist/src/shadcn/components/ui/context-menu.js +120 -13
- package/dist/src/shadcn/components/ui/context-menu.js.map +1 -1
- package/dist/src/shadcn/components/ui/dialog.d.ts.map +1 -1
- package/dist/src/shadcn/components/ui/dialog.js +35 -7
- package/dist/src/shadcn/components/ui/dialog.js.map +1 -1
- package/dist/src/shadcn/components/ui/drawer.d.ts.map +1 -1
- package/dist/src/shadcn/components/ui/drawer.js +27 -5
- package/dist/src/shadcn/components/ui/drawer.js.map +1 -1
- package/dist/src/shadcn/components/ui/dropdown-menu.d.ts +7 -3
- package/dist/src/shadcn/components/ui/dropdown-menu.d.ts.map +1 -1
- package/dist/src/shadcn/components/ui/dropdown-menu.js +122 -14
- package/dist/src/shadcn/components/ui/dropdown-menu.js.map +1 -1
- package/dist/src/shadcn/components/ui/dropdown-menu.stories.js +22 -5
- package/dist/src/shadcn/components/ui/dropdown-menu.stories.js.map +1 -1
- package/dist/src/shadcn/components/ui/form.d.ts +2 -2
- package/dist/src/shadcn/components/ui/form.d.ts.map +1 -1
- package/dist/src/shadcn/components/ui/form.js +17 -8
- package/dist/src/shadcn/components/ui/form.js.map +1 -1
- package/dist/src/shadcn/components/ui/hover-card.d.ts.map +1 -1
- package/dist/src/shadcn/components/ui/hover-card.js +2 -1
- package/dist/src/shadcn/components/ui/hover-card.js.map +1 -1
- package/dist/src/shadcn/components/ui/input-otp.d.ts.map +1 -1
- package/dist/src/shadcn/components/ui/input-otp.js +1 -0
- package/dist/src/shadcn/components/ui/input-otp.js.map +1 -1
- package/dist/src/shadcn/components/ui/input.d.ts +3 -1
- package/dist/src/shadcn/components/ui/input.d.ts.map +1 -1
- package/dist/src/shadcn/components/ui/input.js +126 -17
- package/dist/src/shadcn/components/ui/input.js.map +1 -1
- package/dist/src/shadcn/components/ui/input.stories.js +218 -29
- package/dist/src/shadcn/components/ui/input.stories.js.map +1 -1
- package/dist/src/shadcn/components/ui/label.d.ts.map +1 -1
- package/dist/src/shadcn/components/ui/label.js +9 -1
- package/dist/src/shadcn/components/ui/label.js.map +1 -1
- package/dist/src/shadcn/components/ui/menubar.d.ts.map +1 -1
- package/dist/src/shadcn/components/ui/menubar.js +35 -13
- package/dist/src/shadcn/components/ui/menubar.js.map +1 -1
- package/dist/src/shadcn/components/ui/pagination.d.ts +9 -2
- package/dist/src/shadcn/components/ui/pagination.d.ts.map +1 -1
- package/dist/src/shadcn/components/ui/pagination.js +41 -24
- package/dist/src/shadcn/components/ui/pagination.js.map +1 -1
- package/dist/src/shadcn/components/ui/pagination.stories.js +44 -37
- package/dist/src/shadcn/components/ui/pagination.stories.js.map +1 -1
- package/dist/src/shadcn/components/ui/popover.d.ts.map +1 -1
- package/dist/src/shadcn/components/ui/popover.js +13 -1
- package/dist/src/shadcn/components/ui/popover.js.map +1 -1
- package/dist/src/shadcn/components/ui/progress.d.ts.map +1 -1
- package/dist/src/shadcn/components/ui/progress.js +6 -2
- package/dist/src/shadcn/components/ui/progress.js.map +1 -1
- package/dist/src/shadcn/components/ui/radio-button-group.d.ts +21 -0
- package/dist/src/shadcn/components/ui/radio-button-group.d.ts.map +1 -0
- package/dist/src/shadcn/components/ui/radio-button-group.js +148 -0
- package/dist/src/shadcn/components/ui/radio-button-group.js.map +1 -0
- package/dist/src/shadcn/components/ui/radio-button-group.stories.js +283 -0
- package/dist/src/shadcn/components/ui/radio-button-group.stories.js.map +1 -0
- package/dist/src/shadcn/components/ui/radio-group.d.ts +5 -1
- package/dist/src/shadcn/components/ui/radio-group.d.ts.map +1 -1
- package/dist/src/shadcn/components/ui/radio-group.js +40 -7
- package/dist/src/shadcn/components/ui/radio-group.js.map +1 -1
- package/dist/src/shadcn/components/ui/radio-group.stories.js +107 -32
- package/dist/src/shadcn/components/ui/radio-group.stories.js.map +1 -1
- package/dist/src/shadcn/components/ui/resizable.d.ts.map +1 -1
- package/dist/src/shadcn/components/ui/resizable.js +2 -1
- package/dist/src/shadcn/components/ui/resizable.js.map +1 -1
- package/dist/src/shadcn/components/ui/resizable.stories.js +2 -2
- package/dist/src/shadcn/components/ui/resizable.stories.js.map +1 -1
- package/dist/src/shadcn/components/ui/scroll-area.d.ts.map +1 -1
- package/dist/src/shadcn/components/ui/scroll-area.js +10 -3
- package/dist/src/shadcn/components/ui/scroll-area.js.map +1 -1
- package/dist/src/shadcn/components/ui/select.d.ts +1 -2
- package/dist/src/shadcn/components/ui/select.d.ts.map +1 -1
- package/dist/src/shadcn/components/ui/select.js +49 -19
- package/dist/src/shadcn/components/ui/select.js.map +1 -1
- package/dist/src/shadcn/components/ui/select.stories.js +193 -70
- package/dist/src/shadcn/components/ui/select.stories.js.map +1 -1
- package/dist/src/shadcn/components/ui/separator.d.ts.map +1 -1
- package/dist/src/shadcn/components/ui/separator.js +8 -1
- package/dist/src/shadcn/components/ui/separator.js.map +1 -1
- package/dist/src/shadcn/components/ui/sheet.js +1 -1
- package/dist/src/shadcn/components/ui/sheet.js.map +1 -1
- package/dist/src/shadcn/components/ui/sidebar.d.ts +4 -4
- package/dist/src/shadcn/components/ui/sidebar.d.ts.map +1 -1
- package/dist/src/shadcn/components/ui/sidebar.js +21 -6
- package/dist/src/shadcn/components/ui/sidebar.js.map +1 -1
- package/dist/src/shadcn/components/ui/skeleton.d.ts.map +1 -1
- package/dist/src/shadcn/components/ui/skeleton.js +3 -1
- package/dist/src/shadcn/components/ui/skeleton.js.map +1 -1
- package/dist/src/shadcn/components/ui/slider.d.ts.map +1 -1
- package/dist/src/shadcn/components/ui/slider.js +35 -4
- package/dist/src/shadcn/components/ui/slider.js.map +1 -1
- package/dist/src/shadcn/components/ui/sonner.d.ts +24 -2
- package/dist/src/shadcn/components/ui/sonner.d.ts.map +1 -1
- package/dist/src/shadcn/components/ui/sonner.js +127 -9
- package/dist/src/shadcn/components/ui/sonner.js.map +1 -1
- package/dist/src/shadcn/components/ui/sonner.stories.js +251 -12
- package/dist/src/shadcn/components/ui/sonner.stories.js.map +1 -1
- package/dist/src/shadcn/components/ui/switch.d.ts +7 -1
- package/dist/src/shadcn/components/ui/switch.d.ts.map +1 -1
- package/dist/src/shadcn/components/ui/switch.js +55 -3
- package/dist/src/shadcn/components/ui/switch.js.map +1 -1
- package/dist/src/shadcn/components/ui/switch.stories.js +84 -9
- package/dist/src/shadcn/components/ui/switch.stories.js.map +1 -1
- package/dist/src/shadcn/components/ui/table.d.ts +23 -6
- package/dist/src/shadcn/components/ui/table.d.ts.map +1 -1
- package/dist/src/shadcn/components/ui/table.js +65 -20
- package/dist/src/shadcn/components/ui/table.js.map +1 -1
- package/dist/src/shadcn/components/ui/table.stories.js +217 -97
- package/dist/src/shadcn/components/ui/table.stories.js.map +1 -1
- package/dist/src/shadcn/components/ui/tabs.d.ts +30 -5
- package/dist/src/shadcn/components/ui/tabs.d.ts.map +1 -1
- package/dist/src/shadcn/components/ui/tabs.js +470 -23
- package/dist/src/shadcn/components/ui/tabs.js.map +1 -1
- package/dist/src/shadcn/components/ui/tabs.stories.js +405 -181
- package/dist/src/shadcn/components/ui/tabs.stories.js.map +1 -1
- package/dist/src/shadcn/components/ui/textarea.d.ts +8 -1
- package/dist/src/shadcn/components/ui/textarea.d.ts.map +1 -1
- package/dist/src/shadcn/components/ui/textarea.js +30 -2
- package/dist/src/shadcn/components/ui/textarea.js.map +1 -1
- package/dist/src/shadcn/components/ui/textarea.stories.js +85 -4
- package/dist/src/shadcn/components/ui/textarea.stories.js.map +1 -1
- package/dist/src/shadcn/components/ui/toggle-group.d.ts +3 -3
- package/dist/src/shadcn/components/ui/toggle-group.d.ts.map +1 -1
- package/dist/src/shadcn/components/ui/toggle-group.js +14 -12
- package/dist/src/shadcn/components/ui/toggle-group.js.map +1 -1
- package/dist/src/shadcn/components/ui/toggle.d.ts +3 -4
- package/dist/src/shadcn/components/ui/toggle.d.ts.map +1 -1
- package/dist/src/shadcn/components/ui/toggle.js +44 -16
- package/dist/src/shadcn/components/ui/toggle.js.map +1 -1
- package/dist/src/shadcn/components/ui/toggle.stories.js +130 -7
- package/dist/src/shadcn/components/ui/toggle.stories.js.map +1 -1
- package/dist/src/shadcn/components/ui/tooltip.d.ts.map +1 -1
- package/dist/src/shadcn/components/ui/tooltip.js +12 -1
- package/dist/src/shadcn/components/ui/tooltip.js.map +1 -1
- package/dist/src/shadcn/components/ui/tree.d.ts +29 -0
- package/dist/src/shadcn/components/ui/tree.d.ts.map +1 -0
- package/dist/src/shadcn/components/ui/tree.js +135 -0
- package/dist/src/shadcn/components/ui/tree.js.map +1 -0
- package/dist/src/shadcn/shadcn.css +4 -4
- package/dist/src/tokens.css +50 -20
- package/dist/src/typography.css +78 -15
- package/package.json +84 -64
- package/src/components/button-dropdown.stories.tsx +41 -0
- package/src/components/button-dropdown.tsx +97 -0
- package/src/components/code-editor/fhir-autocomplete.test.ts +993 -0
- package/src/components/code-editor/fhir-autocomplete.ts +2322 -0
- package/src/components/code-editor/http/grammar/http.grammar +74 -0
- package/src/components/code-editor/http/grammar/http.terms.ts +9 -0
- package/src/components/code-editor/http/grammar/http.test.ts +110 -0
- package/src/components/code-editor/http/grammar/http.ts +21 -0
- package/src/components/code-editor/http/index.ts +424 -0
- package/src/components/code-editor/index.tsx +1944 -42
- package/src/components/code-editor/json-ast.test.ts +230 -0
- package/src/components/code-editor/json-ast.ts +590 -0
- package/src/components/code-editor/sql-completion.ts +1112 -0
- package/src/components/code-editor.stories.tsx +325 -2
- package/src/components/copy-icon.tsx +57 -3
- package/src/components/data-table.stories.tsx +91 -0
- package/src/components/data-table.tsx +126 -0
- package/src/components/date-picker-input.stories.tsx +79 -0
- package/src/components/date-picker-input.tsx +104 -0
- package/src/components/fhir-structure-view.stories.tsx +439 -0
- package/src/components/fhir-structure-view.tsx +233 -0
- package/src/components/icon-button.stories.tsx +86 -0
- package/src/components/icon-button.tsx +57 -0
- package/src/components/operation-outcome-view.stories.tsx +163 -0
- package/src/components/operation-outcome-view.tsx +254 -0
- package/src/components/request-line-editor.stories.tsx +17 -27
- package/src/components/request-line-editor.tsx +103 -61
- package/src/components/sandbox.stories.tsx +131 -0
- package/src/components/sandbox.tsx +191 -0
- package/src/components/segment-control.stories.tsx +61 -0
- package/src/components/segment-control.tsx +83 -0
- package/src/components/split-button.stories.tsx +68 -0
- package/src/components/split-button.tsx +74 -0
- package/src/components/tag.stories.tsx +371 -0
- package/src/components/tag.tsx +236 -0
- package/src/components/tile.stories.tsx +149 -0
- package/src/components/tile.tsx +105 -0
- package/src/components/toolbar.stories.tsx +64 -0
- package/src/components/toolbar.tsx +98 -0
- package/src/components/tree-view.stories.tsx +265 -0
- package/src/components/tree-view.tsx +246 -0
- package/src/icons.tsx +331 -0
- package/src/index.css +358 -74
- package/src/index.tsx +17 -3
- package/src/shadcn/components/ui/accordion.tsx +91 -10
- package/src/shadcn/components/ui/alert-dialog.stories.tsx +209 -15
- package/src/shadcn/components/ui/alert-dialog.tsx +236 -26
- package/src/shadcn/components/ui/alert.stories.tsx +120 -21
- package/src/shadcn/components/ui/alert.tsx +125 -28
- package/src/shadcn/components/ui/aspect-ratio.tsx +1 -0
- package/src/shadcn/components/ui/avatar.stories.tsx +74 -1
- package/src/shadcn/components/ui/avatar.tsx +22 -6
- package/src/shadcn/components/ui/badge.tsx +67 -18
- package/src/shadcn/components/ui/breadcrumb.stories.tsx +161 -41
- package/src/shadcn/components/ui/breadcrumb.tsx +172 -23
- package/src/shadcn/components/ui/button.stories.tsx +106 -18
- package/src/shadcn/components/ui/button.tsx +151 -55
- package/src/shadcn/components/ui/calendar.tsx +1 -0
- package/src/shadcn/components/ui/card.stories.tsx +17 -3
- package/src/shadcn/components/ui/card.tsx +89 -14
- package/src/shadcn/components/ui/carousel.tsx +1 -0
- package/src/shadcn/components/ui/chart.tsx +9 -5
- package/src/shadcn/components/ui/checkbox.stories.tsx +78 -30
- package/src/shadcn/components/ui/checkbox.tsx +91 -8
- package/src/shadcn/components/ui/combobox.stories.tsx +148 -0
- package/src/shadcn/components/ui/combobox.tsx +324 -0
- package/src/shadcn/components/ui/command.stories.tsx +184 -39
- package/src/shadcn/components/ui/command.tsx +218 -37
- package/src/shadcn/components/ui/context-menu.tsx +333 -40
- package/src/shadcn/components/ui/dialog.tsx +101 -13
- package/src/shadcn/components/ui/drawer.tsx +94 -18
- package/src/shadcn/components/ui/dropdown-menu.stories.tsx +18 -2
- package/src/shadcn/components/ui/dropdown-menu.tsx +334 -68
- package/src/shadcn/components/ui/form.tsx +22 -11
- package/src/shadcn/components/ui/hover-card.tsx +2 -1
- package/src/shadcn/components/ui/input-otp.tsx +1 -0
- package/src/shadcn/components/ui/input.stories.tsx +235 -27
- package/src/shadcn/components/ui/input.tsx +400 -29
- package/src/shadcn/components/ui/label.tsx +22 -4
- package/src/shadcn/components/ui/menubar.tsx +188 -43
- package/src/shadcn/components/ui/pagination.stories.tsx +8 -2
- package/src/shadcn/components/ui/pagination.tsx +65 -8
- package/src/shadcn/components/ui/popover.tsx +36 -4
- package/src/shadcn/components/ui/progress.tsx +21 -5
- package/src/shadcn/components/ui/radio-button-group.stories.tsx +247 -0
- package/src/shadcn/components/ui/radio-button-group.tsx +188 -0
- package/src/shadcn/components/ui/radio-group.stories.tsx +70 -14
- package/src/shadcn/components/ui/radio-group.tsx +85 -9
- package/src/shadcn/components/ui/resizable.stories.tsx +2 -2
- package/src/shadcn/components/ui/resizable.tsx +2 -1
- package/src/shadcn/components/ui/scroll-area.tsx +34 -5
- package/src/shadcn/components/ui/select.stories.tsx +108 -32
- package/src/shadcn/components/ui/select.tsx +182 -36
- package/src/shadcn/components/ui/separator.tsx +16 -5
- package/src/shadcn/components/ui/sheet.tsx +1 -1
- package/src/shadcn/components/ui/sidebar.tsx +69 -26
- package/src/shadcn/components/ui/skeleton.tsx +4 -1
- package/src/shadcn/components/ui/slider.tsx +83 -11
- package/src/shadcn/components/ui/sonner.stories.tsx +238 -17
- package/src/shadcn/components/ui/sonner.tsx +254 -11
- package/src/shadcn/components/ui/switch.stories.tsx +52 -5
- package/src/shadcn/components/ui/switch.tsx +92 -7
- package/src/shadcn/components/ui/table.stories.tsx +252 -72
- package/src/shadcn/components/ui/table.tsx +204 -26
- package/src/shadcn/components/ui/tabs.stories.tsx +235 -123
- package/src/shadcn/components/ui/tabs.tsx +694 -36
- package/src/shadcn/components/ui/textarea.stories.tsx +94 -2
- package/src/shadcn/components/ui/textarea.tsx +70 -5
- package/src/shadcn/components/ui/toggle-group.tsx +35 -13
- package/src/shadcn/components/ui/toggle.stories.tsx +92 -5
- package/src/shadcn/components/ui/toggle.tsx +96 -23
- package/src/shadcn/components/ui/tooltip.tsx +34 -8
- package/src/shadcn/components/ui/tree.tsx +257 -0
- package/src/shadcn/shadcn.css +4 -4
- package/src/tokens.css +50 -20
- package/src/typography.css +78 -15
- package/dist/src/components/code-editor.stories.d.ts +0 -7
- package/dist/src/components/code-editor.stories.d.ts.map +0 -1
- package/dist/src/components/request-line-editor.stories.d.ts +0 -11
- package/dist/src/components/request-line-editor.stories.d.ts.map +0 -1
- package/dist/src/index.stories.d.ts +0 -14
- package/dist/src/index.stories.d.ts.map +0 -1
- package/dist/src/index.stories.js +0 -19
- package/dist/src/index.stories.js.map +0 -1
- package/dist/src/shadcn/components/ui/accordion.stories.d.ts +0 -8
- package/dist/src/shadcn/components/ui/accordion.stories.d.ts.map +0 -1
- package/dist/src/shadcn/components/ui/alert-dialog.stories.d.ts +0 -8
- package/dist/src/shadcn/components/ui/alert-dialog.stories.d.ts.map +0 -1
- package/dist/src/shadcn/components/ui/alert.stories.d.ts +0 -8
- package/dist/src/shadcn/components/ui/alert.stories.d.ts.map +0 -1
- package/dist/src/shadcn/components/ui/aspect-ratio.stories.d.ts +0 -8
- package/dist/src/shadcn/components/ui/aspect-ratio.stories.d.ts.map +0 -1
- package/dist/src/shadcn/components/ui/avatar.stories.d.ts +0 -8
- package/dist/src/shadcn/components/ui/avatar.stories.d.ts.map +0 -1
- package/dist/src/shadcn/components/ui/badge.stories.d.ts +0 -8
- package/dist/src/shadcn/components/ui/badge.stories.d.ts.map +0 -1
- package/dist/src/shadcn/components/ui/breadcrumb.stories.d.ts +0 -8
- package/dist/src/shadcn/components/ui/breadcrumb.stories.d.ts.map +0 -1
- package/dist/src/shadcn/components/ui/button.stories.d.ts +0 -23
- package/dist/src/shadcn/components/ui/button.stories.d.ts.map +0 -1
- package/dist/src/shadcn/components/ui/calendar.stories.d.ts +0 -8
- package/dist/src/shadcn/components/ui/calendar.stories.d.ts.map +0 -1
- package/dist/src/shadcn/components/ui/card.stories.d.ts +0 -8
- package/dist/src/shadcn/components/ui/card.stories.d.ts.map +0 -1
- package/dist/src/shadcn/components/ui/carousel.stories.d.ts +0 -8
- package/dist/src/shadcn/components/ui/carousel.stories.d.ts.map +0 -1
- package/dist/src/shadcn/components/ui/chart.stories.d.ts +0 -8
- package/dist/src/shadcn/components/ui/chart.stories.d.ts.map +0 -1
- package/dist/src/shadcn/components/ui/checkbox.stories.d.ts +0 -8
- package/dist/src/shadcn/components/ui/checkbox.stories.d.ts.map +0 -1
- package/dist/src/shadcn/components/ui/collapsible.stories.d.ts +0 -8
- package/dist/src/shadcn/components/ui/collapsible.stories.d.ts.map +0 -1
- package/dist/src/shadcn/components/ui/command.stories.d.ts +0 -8
- package/dist/src/shadcn/components/ui/command.stories.d.ts.map +0 -1
- package/dist/src/shadcn/components/ui/context-menu.stories.d.ts +0 -8
- package/dist/src/shadcn/components/ui/context-menu.stories.d.ts.map +0 -1
- package/dist/src/shadcn/components/ui/dialog.stories.d.ts +0 -8
- package/dist/src/shadcn/components/ui/dialog.stories.d.ts.map +0 -1
- package/dist/src/shadcn/components/ui/drawer.stories.d.ts +0 -8
- package/dist/src/shadcn/components/ui/drawer.stories.d.ts.map +0 -1
- package/dist/src/shadcn/components/ui/dropdown-menu.stories.d.ts +0 -8
- package/dist/src/shadcn/components/ui/dropdown-menu.stories.d.ts.map +0 -1
- package/dist/src/shadcn/components/ui/form.stories.d.ts +0 -8
- package/dist/src/shadcn/components/ui/form.stories.d.ts.map +0 -1
- package/dist/src/shadcn/components/ui/hover-card.stories.d.ts +0 -8
- package/dist/src/shadcn/components/ui/hover-card.stories.d.ts.map +0 -1
- package/dist/src/shadcn/components/ui/input-otp.stories.d.ts +0 -8
- package/dist/src/shadcn/components/ui/input-otp.stories.d.ts.map +0 -1
- package/dist/src/shadcn/components/ui/input.stories.d.ts +0 -18
- package/dist/src/shadcn/components/ui/input.stories.d.ts.map +0 -1
- package/dist/src/shadcn/components/ui/label.stories.d.ts +0 -8
- package/dist/src/shadcn/components/ui/label.stories.d.ts.map +0 -1
- package/dist/src/shadcn/components/ui/menubar.stories.d.ts +0 -8
- package/dist/src/shadcn/components/ui/menubar.stories.d.ts.map +0 -1
- package/dist/src/shadcn/components/ui/navigation-menu.stories.d.ts +0 -8
- package/dist/src/shadcn/components/ui/navigation-menu.stories.d.ts.map +0 -1
- package/dist/src/shadcn/components/ui/pagination.stories.d.ts +0 -8
- package/dist/src/shadcn/components/ui/pagination.stories.d.ts.map +0 -1
- package/dist/src/shadcn/components/ui/popover.stories.d.ts +0 -8
- package/dist/src/shadcn/components/ui/popover.stories.d.ts.map +0 -1
- package/dist/src/shadcn/components/ui/progress.stories.d.ts +0 -8
- package/dist/src/shadcn/components/ui/progress.stories.d.ts.map +0 -1
- package/dist/src/shadcn/components/ui/radio-group.stories.d.ts +0 -8
- package/dist/src/shadcn/components/ui/radio-group.stories.d.ts.map +0 -1
- package/dist/src/shadcn/components/ui/resizable.stories.d.ts +0 -8
- package/dist/src/shadcn/components/ui/resizable.stories.d.ts.map +0 -1
- package/dist/src/shadcn/components/ui/scroll-area.stories.d.ts +0 -8
- package/dist/src/shadcn/components/ui/scroll-area.stories.d.ts.map +0 -1
- package/dist/src/shadcn/components/ui/select.stories.d.ts +0 -11
- package/dist/src/shadcn/components/ui/select.stories.d.ts.map +0 -1
- package/dist/src/shadcn/components/ui/separator.stories.d.ts +0 -8
- package/dist/src/shadcn/components/ui/separator.stories.d.ts.map +0 -1
- package/dist/src/shadcn/components/ui/sheet.stories.d.ts +0 -8
- package/dist/src/shadcn/components/ui/sheet.stories.d.ts.map +0 -1
- package/dist/src/shadcn/components/ui/sidebar.stories.d.ts +0 -11
- package/dist/src/shadcn/components/ui/sidebar.stories.d.ts.map +0 -1
- package/dist/src/shadcn/components/ui/skeleton.stories.d.ts +0 -8
- package/dist/src/shadcn/components/ui/skeleton.stories.d.ts.map +0 -1
- package/dist/src/shadcn/components/ui/slider.stories.d.ts +0 -8
- package/dist/src/shadcn/components/ui/slider.stories.d.ts.map +0 -1
- package/dist/src/shadcn/components/ui/sonner.stories.d.ts +0 -8
- package/dist/src/shadcn/components/ui/sonner.stories.d.ts.map +0 -1
- package/dist/src/shadcn/components/ui/switch.stories.d.ts +0 -8
- package/dist/src/shadcn/components/ui/switch.stories.d.ts.map +0 -1
- package/dist/src/shadcn/components/ui/table.stories.d.ts +0 -8
- package/dist/src/shadcn/components/ui/table.stories.d.ts.map +0 -1
- package/dist/src/shadcn/components/ui/tabs.stories.d.ts +0 -32
- package/dist/src/shadcn/components/ui/tabs.stories.d.ts.map +0 -1
- package/dist/src/shadcn/components/ui/textarea.stories.d.ts +0 -8
- package/dist/src/shadcn/components/ui/textarea.stories.d.ts.map +0 -1
- package/dist/src/shadcn/components/ui/toggle-group.stories.d.ts +0 -8
- package/dist/src/shadcn/components/ui/toggle-group.stories.d.ts.map +0 -1
- package/dist/src/shadcn/components/ui/toggle.stories.d.ts +0 -8
- package/dist/src/shadcn/components/ui/toggle.stories.d.ts.map +0 -1
- package/dist/src/shadcn/components/ui/tooltip.stories.d.ts +0 -8
- package/dist/src/shadcn/components/ui/tooltip.stories.d.ts.map +0 -1
- package/src/index.stories.tsx +0 -21
|
@@ -0,0 +1,254 @@
|
|
|
1
|
+
import { Check, Copy, Info, TriangleAlert } from "lucide-react";
|
|
2
|
+
import React from "react";
|
|
3
|
+
import {
|
|
4
|
+
Tooltip,
|
|
5
|
+
TooltipContent,
|
|
6
|
+
TooltipTrigger,
|
|
7
|
+
} from "../shadcn/components/ui/tooltip";
|
|
8
|
+
import { cn } from "../shadcn/lib/utils";
|
|
9
|
+
|
|
10
|
+
type OperationOutcomeSeverity = "fatal" | "error" | "warning" | "information";
|
|
11
|
+
|
|
12
|
+
export interface OperationOutcomeIssue {
|
|
13
|
+
code: string;
|
|
14
|
+
severity: OperationOutcomeSeverity;
|
|
15
|
+
diagnostics?: string;
|
|
16
|
+
expression?: string[];
|
|
17
|
+
details?: {
|
|
18
|
+
coding?: { system?: string; code?: string; display?: string }[];
|
|
19
|
+
text?: string;
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export interface OperationOutcome {
|
|
24
|
+
resourceType: "OperationOutcome";
|
|
25
|
+
issue: OperationOutcomeIssue[];
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export type OperationOutcomeViewProps = {
|
|
29
|
+
resource: OperationOutcome;
|
|
30
|
+
onIssueClick?: (issue: OperationOutcomeIssue) => void;
|
|
31
|
+
} & Omit<React.ComponentProps<"div">, "resource">;
|
|
32
|
+
|
|
33
|
+
const severityOrder: OperationOutcomeSeverity[] = [
|
|
34
|
+
"fatal",
|
|
35
|
+
"error",
|
|
36
|
+
"warning",
|
|
37
|
+
"information",
|
|
38
|
+
];
|
|
39
|
+
|
|
40
|
+
const severityConfig = {
|
|
41
|
+
fatal: {
|
|
42
|
+
header: cn("bg-bg-error-primary_inverse", "text-text-primary_on-brand"),
|
|
43
|
+
text: "text-text-error-primary",
|
|
44
|
+
icon: TriangleAlert,
|
|
45
|
+
label: "fatal",
|
|
46
|
+
},
|
|
47
|
+
error: {
|
|
48
|
+
header: cn("bg-bg-error-primary_inverse", "text-text-primary_on-brand"),
|
|
49
|
+
text: "text-text-error-primary",
|
|
50
|
+
icon: TriangleAlert,
|
|
51
|
+
label: "error",
|
|
52
|
+
},
|
|
53
|
+
warning: {
|
|
54
|
+
header: cn("bg-bg-warning-primary_inverse", "text-text-warning-primary"),
|
|
55
|
+
text: "text-text-warning-primary",
|
|
56
|
+
icon: TriangleAlert,
|
|
57
|
+
label: "warning",
|
|
58
|
+
},
|
|
59
|
+
information: {
|
|
60
|
+
header: cn("bg-bg-info-primary_inverse", "text-text-primary_on-brand"),
|
|
61
|
+
text: "text-text-info-primary",
|
|
62
|
+
icon: Info,
|
|
63
|
+
label: "info",
|
|
64
|
+
},
|
|
65
|
+
} as const;
|
|
66
|
+
|
|
67
|
+
const issueCodeLabels: Record<string, string> = {
|
|
68
|
+
"constraint-error": "Constraint violation",
|
|
69
|
+
"constraint-exception": "Constraint exception",
|
|
70
|
+
"empty-value": "Empty value",
|
|
71
|
+
"expected-array": "Expected array",
|
|
72
|
+
"extension-for-repeated-primitive-types-must-be-an-array":
|
|
73
|
+
"Extension must be array",
|
|
74
|
+
"extension-for-scalar-primitive-types-must-be-an-object":
|
|
75
|
+
"Extension must be object",
|
|
76
|
+
"internal-validator-error": "Internal validator error",
|
|
77
|
+
"invalid-cardinality": "Invalid cardinality",
|
|
78
|
+
"invalid-constant": "Invalid constant",
|
|
79
|
+
"invalid-extension-cardinality": "Invalid extension cardinality",
|
|
80
|
+
"invalid-slice-cardinality": "Invalid slice cardinality",
|
|
81
|
+
"invalid-slice-default": "Invalid slice default",
|
|
82
|
+
"invalid-slicing-ordrer": "Invalid slicing order",
|
|
83
|
+
"invalid-target-profile": "Invalid target profile",
|
|
84
|
+
"invalid-type": "Invalid type",
|
|
85
|
+
"non-existent-resource": "Resource not found",
|
|
86
|
+
"required-key": "Required field",
|
|
87
|
+
"terminology-binding-error": "Terminology binding error",
|
|
88
|
+
"terminology-binding-check": "Terminology binding check",
|
|
89
|
+
"too-many-union-subtypes": "Too many union subtypes",
|
|
90
|
+
"underscore-keys-should-be-element-type": "Invalid underscore key",
|
|
91
|
+
"underscore-property-on-complex-type": "Invalid underscore property",
|
|
92
|
+
"unexpected-array": "Unexpected array",
|
|
93
|
+
"unexpected-object": "Unexpected object",
|
|
94
|
+
"unknown-extension": "Unknown extension",
|
|
95
|
+
"unknown-key": "Unknown property",
|
|
96
|
+
"unknown-profile": "Unknown profile",
|
|
97
|
+
"unknown-resource-type": "Unknown resource type",
|
|
98
|
+
"unmatched-element-in-closed-slicing": "Unmatched element in slicing",
|
|
99
|
+
"unmathced-resource": "Unmatched resource",
|
|
100
|
+
"wrong-union-type": "Wrong union type",
|
|
101
|
+
processing: "Processing error",
|
|
102
|
+
invalid: "Invalid",
|
|
103
|
+
structure: "Structure error",
|
|
104
|
+
required: "Required",
|
|
105
|
+
value: "Invalid value",
|
|
106
|
+
invariant: "Invariant violation",
|
|
107
|
+
"not-found": "Not found",
|
|
108
|
+
"not-supported": "Not supported",
|
|
109
|
+
duplicate: "Duplicate",
|
|
110
|
+
"business-rule": "Business rule violation",
|
|
111
|
+
conflict: "Conflict",
|
|
112
|
+
transient: "Transient error",
|
|
113
|
+
exception: "Exception",
|
|
114
|
+
};
|
|
115
|
+
|
|
116
|
+
function getIssueCode(issue: OperationOutcomeIssue): string {
|
|
117
|
+
return issue.details?.coding?.[0]?.code ?? issue.code;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
function getIssueCodeLabel(code: string): string {
|
|
121
|
+
return issueCodeLabels[code] ?? code;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
function groupIssuesBySeverity(issues: OperationOutcomeIssue[]) {
|
|
125
|
+
const groups = new Map<OperationOutcomeSeverity, OperationOutcomeIssue[]>();
|
|
126
|
+
for (const issue of issues) {
|
|
127
|
+
const existing = groups.get(issue.severity) ?? [];
|
|
128
|
+
existing.push(issue);
|
|
129
|
+
groups.set(issue.severity, existing);
|
|
130
|
+
}
|
|
131
|
+
return severityOrder
|
|
132
|
+
.filter((s) => groups.has(s))
|
|
133
|
+
.map((s) => ({
|
|
134
|
+
severity: s,
|
|
135
|
+
issues: groups.get(s) as OperationOutcomeIssue[],
|
|
136
|
+
}));
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
function CopyButton({ resource }: { resource: OperationOutcome }) {
|
|
140
|
+
const [copied, setCopied] = React.useState(false);
|
|
141
|
+
|
|
142
|
+
const handleCopy = (e: React.MouseEvent) => {
|
|
143
|
+
e.stopPropagation();
|
|
144
|
+
navigator.clipboard.writeText(JSON.stringify(resource, null, 2));
|
|
145
|
+
setCopied(true);
|
|
146
|
+
setTimeout(() => setCopied(false), 2000);
|
|
147
|
+
};
|
|
148
|
+
|
|
149
|
+
return (
|
|
150
|
+
<Tooltip>
|
|
151
|
+
<TooltipTrigger asChild>
|
|
152
|
+
<button
|
|
153
|
+
type="button"
|
|
154
|
+
className="p-1 rounded hover:bg-white/20 transition-colors [&>svg]:size-3.5"
|
|
155
|
+
onClick={handleCopy}
|
|
156
|
+
>
|
|
157
|
+
{copied ? <Check /> : <Copy />}
|
|
158
|
+
</button>
|
|
159
|
+
</TooltipTrigger>
|
|
160
|
+
<TooltipContent side="bottom">
|
|
161
|
+
{copied ? "Copied" : "Copy OperationOutcome"}
|
|
162
|
+
</TooltipContent>
|
|
163
|
+
</Tooltip>
|
|
164
|
+
);
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
export function OperationOutcomeView({
|
|
168
|
+
resource,
|
|
169
|
+
onIssueClick,
|
|
170
|
+
className,
|
|
171
|
+
...props
|
|
172
|
+
}: OperationOutcomeViewProps) {
|
|
173
|
+
const groups = groupIssuesBySeverity(resource.issue);
|
|
174
|
+
|
|
175
|
+
return (
|
|
176
|
+
<div
|
|
177
|
+
data-slot="operation-outcome-view"
|
|
178
|
+
className={cn("flex flex-col", className)}
|
|
179
|
+
{...props}
|
|
180
|
+
>
|
|
181
|
+
{groups.map(({ severity, issues }) => {
|
|
182
|
+
const config = severityConfig[severity];
|
|
183
|
+
const Icon = config.icon;
|
|
184
|
+
const count = issues.length;
|
|
185
|
+
const label = `${count} ${config.label}${count !== 1 ? "s" : ""}`;
|
|
186
|
+
|
|
187
|
+
return (
|
|
188
|
+
<div key={severity}>
|
|
189
|
+
<div
|
|
190
|
+
className={cn(
|
|
191
|
+
"flex items-center gap-2 px-4 h-8",
|
|
192
|
+
"[&>svg]:size-4 [&>svg]:shrink-0",
|
|
193
|
+
"typo-body",
|
|
194
|
+
"sticky top-0 z-10",
|
|
195
|
+
config.header,
|
|
196
|
+
)}
|
|
197
|
+
>
|
|
198
|
+
<Icon />
|
|
199
|
+
<span className="grow">{label}</span>
|
|
200
|
+
<CopyButton resource={resource} />
|
|
201
|
+
</div>
|
|
202
|
+
<div className="flex flex-col py-1 bg-bg-primary">
|
|
203
|
+
{issues.map((issue) => {
|
|
204
|
+
const expressionText = issue.expression?.join(", ");
|
|
205
|
+
const codeLabel = getIssueCodeLabel(getIssueCode(issue));
|
|
206
|
+
const key = `${issue.severity}-${getIssueCode(issue)}-${expressionText ?? ""}`;
|
|
207
|
+
|
|
208
|
+
const row = (
|
|
209
|
+
<button
|
|
210
|
+
type="button"
|
|
211
|
+
key={key}
|
|
212
|
+
className={cn(
|
|
213
|
+
"flex cursor-pointer hover:bg-bg-secondary w-full text-left",
|
|
214
|
+
)}
|
|
215
|
+
onClick={
|
|
216
|
+
onIssueClick ? () => onIssueClick(issue) : undefined
|
|
217
|
+
}
|
|
218
|
+
>
|
|
219
|
+
<span
|
|
220
|
+
className={cn(
|
|
221
|
+
"px-4 py-1 typo-body font-medium whitespace-nowrap",
|
|
222
|
+
config.text,
|
|
223
|
+
)}
|
|
224
|
+
>
|
|
225
|
+
{codeLabel}
|
|
226
|
+
</span>
|
|
227
|
+
<span className="pr-4 py-1 typo-body text-text-primary whitespace-nowrap">
|
|
228
|
+
{expressionText ?? ""}
|
|
229
|
+
</span>
|
|
230
|
+
</button>
|
|
231
|
+
);
|
|
232
|
+
|
|
233
|
+
if (!issue.diagnostics) return row;
|
|
234
|
+
|
|
235
|
+
return (
|
|
236
|
+
<Tooltip key={key}>
|
|
237
|
+
<TooltipTrigger asChild>{row}</TooltipTrigger>
|
|
238
|
+
<TooltipContent
|
|
239
|
+
side="bottom"
|
|
240
|
+
align="start"
|
|
241
|
+
className="max-w-lg whitespace-pre-wrap"
|
|
242
|
+
>
|
|
243
|
+
{issue.diagnostics}
|
|
244
|
+
</TooltipContent>
|
|
245
|
+
</Tooltip>
|
|
246
|
+
);
|
|
247
|
+
})}
|
|
248
|
+
</div>
|
|
249
|
+
</div>
|
|
250
|
+
);
|
|
251
|
+
})}
|
|
252
|
+
</div>
|
|
253
|
+
);
|
|
254
|
+
}
|
|
@@ -18,13 +18,9 @@ const meta: Meta<typeof RequestLineEditor> = {
|
|
|
18
18
|
export default meta;
|
|
19
19
|
type Story = StoryObj<typeof RequestLineEditor>;
|
|
20
20
|
|
|
21
|
-
function RequestLineEditorWrapper({
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
inputValue,
|
|
25
|
-
}: RequestLineEditorProps) {
|
|
26
|
-
const [currentSelectedMethod, setMethod] = React.useState(selectedMethod);
|
|
27
|
-
const [currentInputValue, setInputValue] = React.useState(inputValue);
|
|
21
|
+
function RequestLineEditorWrapper({ method, path }: RequestLineEditorProps) {
|
|
22
|
+
const [currentSelectedMethod, setMethod] = React.useState(method);
|
|
23
|
+
const [currentInputValue, setInputValue] = React.useState(path);
|
|
28
24
|
const actionSetMethod = (method: string) => {
|
|
29
25
|
action("setMethod")(method);
|
|
30
26
|
setMethod(method);
|
|
@@ -35,56 +31,50 @@ function RequestLineEditorWrapper({
|
|
|
35
31
|
};
|
|
36
32
|
return (
|
|
37
33
|
<RequestLineEditor
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
onInputChange={actionSetInputValue}
|
|
34
|
+
method={currentSelectedMethod}
|
|
35
|
+
onMethodChange={actionSetMethod}
|
|
36
|
+
path={currentInputValue}
|
|
37
|
+
onPathChange={actionSetInputValue}
|
|
43
38
|
/>
|
|
44
39
|
);
|
|
45
40
|
}
|
|
46
41
|
|
|
47
42
|
export const GET: Story = {
|
|
48
43
|
args: {
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
inputValue: "/fhir/Patient",
|
|
44
|
+
method: "GET",
|
|
45
|
+
path: "/fhir/Patient",
|
|
52
46
|
},
|
|
53
47
|
render: (args) => <RequestLineEditorWrapper {...args} />,
|
|
54
48
|
};
|
|
55
49
|
|
|
56
50
|
export const POST: Story = {
|
|
57
51
|
args: {
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
inputValue: "/fhir/Patient",
|
|
52
|
+
method: "POST",
|
|
53
|
+
path: "/fhir/Patient",
|
|
61
54
|
},
|
|
62
55
|
render: (args) => <RequestLineEditorWrapper {...args} />,
|
|
63
56
|
};
|
|
64
57
|
|
|
65
58
|
export const PUT: Story = {
|
|
66
59
|
args: {
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
inputValue: "/fhir/Patient",
|
|
60
|
+
method: "PUT",
|
|
61
|
+
path: "/fhir/Patient",
|
|
70
62
|
},
|
|
71
63
|
render: (args) => <RequestLineEditorWrapper {...args} />,
|
|
72
64
|
};
|
|
73
65
|
|
|
74
66
|
export const PATCH: Story = {
|
|
75
67
|
args: {
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
inputValue: "/fhir/Patient",
|
|
68
|
+
method: "PATCH",
|
|
69
|
+
path: "/fhir/Patient",
|
|
79
70
|
},
|
|
80
71
|
render: (args) => <RequestLineEditorWrapper {...args} />,
|
|
81
72
|
};
|
|
82
73
|
|
|
83
74
|
export const DELETE: Story = {
|
|
84
75
|
args: {
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
inputValue: "/fhir/Patient",
|
|
76
|
+
method: "DELETE",
|
|
77
|
+
path: "/fhir/Patient",
|
|
88
78
|
},
|
|
89
79
|
render: (args) => <RequestLineEditorWrapper {...args} />,
|
|
90
80
|
};
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
+
import { cva } from "class-variance-authority";
|
|
1
2
|
import type * as React from "react";
|
|
3
|
+
import { toast } from "sonner";
|
|
2
4
|
import { Input } from "#shadcn/components/ui/input";
|
|
3
5
|
import {
|
|
4
6
|
Select,
|
|
@@ -10,63 +12,68 @@ import {
|
|
|
10
12
|
import { cn } from "#shadcn/lib/utils";
|
|
11
13
|
import { CopyIcon } from "./copy-icon";
|
|
12
14
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
setMethod: (value: string) => void;
|
|
16
|
-
methods: string[];
|
|
17
|
-
inputValue?: string | undefined;
|
|
18
|
-
onInputChange?: React.ChangeEventHandler<HTMLInputElement>;
|
|
19
|
-
}
|
|
15
|
+
const METHODS = ["GET", "POST", "PUT", "PATCH", "DELETE"] as const;
|
|
16
|
+
type RequestMethod = (typeof METHODS)[number];
|
|
20
17
|
|
|
21
|
-
const
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
border: "border-red-300! hover:border-red-300 ring-red-200!",
|
|
18
|
+
const requestMethodVariants = cva<{ method: { [K in RequestMethod]: string } }>(
|
|
19
|
+
cn(
|
|
20
|
+
"cursor-pointer",
|
|
21
|
+
"border-r-0",
|
|
22
|
+
"rounded-r-none",
|
|
23
|
+
"shadow-none",
|
|
24
|
+
"typo-label",
|
|
25
|
+
"text-left",
|
|
26
|
+
"items-center",
|
|
27
|
+
"w-26",
|
|
28
|
+
// Focus states
|
|
29
|
+
"focus-visible:ring-3",
|
|
30
|
+
"focus-visible:ring-ring-blue",
|
|
31
|
+
"focus-visible:border-border-link",
|
|
32
|
+
),
|
|
33
|
+
{
|
|
34
|
+
variants: {
|
|
35
|
+
method: {
|
|
36
|
+
GET: "text-utility-green [&_svg]:text-utility-green",
|
|
37
|
+
POST: "text-utility-yellow [&_svg]:text-utility-yellow",
|
|
38
|
+
PUT: "text-utility-blue [&_svg]:text-utility-blue ",
|
|
39
|
+
PATCH: "text-utility-violet [&_svg]:text-utility-violet",
|
|
40
|
+
DELETE: "text-utility-red [&_svg]:text-utility-red",
|
|
41
|
+
},
|
|
42
|
+
},
|
|
47
43
|
},
|
|
44
|
+
);
|
|
45
|
+
|
|
46
|
+
type RequestMethodSelectorProps = {
|
|
47
|
+
value: string;
|
|
48
|
+
onValueChange?: (newMethod: string) => void;
|
|
48
49
|
};
|
|
49
50
|
|
|
51
|
+
function isKnownMethod(candidate: string): candidate is RequestMethod {
|
|
52
|
+
const methods: readonly string[] = METHODS;
|
|
53
|
+
return methods.includes(candidate);
|
|
54
|
+
}
|
|
55
|
+
|
|
50
56
|
function RequestMethodSelector({
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
}: RequestLineEditorProps) {
|
|
57
|
+
value,
|
|
58
|
+
onValueChange,
|
|
59
|
+
}: RequestMethodSelectorProps) {
|
|
55
60
|
return (
|
|
56
|
-
<Select
|
|
61
|
+
<Select
|
|
62
|
+
value={value}
|
|
63
|
+
{...(onValueChange ? { onValueChange: onValueChange } : {})}
|
|
64
|
+
>
|
|
57
65
|
<SelectTrigger
|
|
58
|
-
className={
|
|
66
|
+
className={requestMethodVariants(
|
|
67
|
+
isKnownMethod(value) ? { method: value } : undefined,
|
|
68
|
+
)}
|
|
59
69
|
>
|
|
60
|
-
<SelectValue
|
|
70
|
+
<SelectValue>{value}</SelectValue>
|
|
61
71
|
</SelectTrigger>
|
|
62
72
|
<SelectContent>
|
|
63
|
-
{
|
|
73
|
+
{METHODS.map((method) => (
|
|
64
74
|
<SelectItem key={method} value={method}>
|
|
65
|
-
<span
|
|
66
|
-
|
|
67
|
-
>
|
|
68
|
-
{" "}
|
|
69
|
-
{method}{" "}
|
|
75
|
+
<span className={requestMethodVariants({ method: method })}>
|
|
76
|
+
{method}
|
|
70
77
|
</span>
|
|
71
78
|
</SelectItem>
|
|
72
79
|
))}
|
|
@@ -75,29 +82,64 @@ function RequestMethodSelector({
|
|
|
75
82
|
);
|
|
76
83
|
}
|
|
77
84
|
|
|
85
|
+
type RequestLineEditorProps = {
|
|
86
|
+
method: string;
|
|
87
|
+
placeholder?: string;
|
|
88
|
+
autoFocus?: boolean;
|
|
89
|
+
onMethodChange: (newMethod: string) => void;
|
|
90
|
+
path?: string | undefined;
|
|
91
|
+
onPathChange?: React.ChangeEventHandler<HTMLInputElement>;
|
|
92
|
+
className?: string;
|
|
93
|
+
};
|
|
94
|
+
|
|
78
95
|
function RequestLineEditor({
|
|
79
96
|
className,
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
97
|
+
method,
|
|
98
|
+
onMethodChange,
|
|
99
|
+
path,
|
|
100
|
+
placeholder,
|
|
101
|
+
autoFocus,
|
|
102
|
+
onPathChange,
|
|
85
103
|
}: RequestLineEditorProps) {
|
|
86
104
|
return (
|
|
87
105
|
<div className={cn("flex", className)}>
|
|
88
|
-
<RequestMethodSelector
|
|
89
|
-
selectedMethod={selectedMethod}
|
|
90
|
-
setMethod={setMethod}
|
|
91
|
-
methods={methods}
|
|
92
|
-
/>
|
|
106
|
+
<RequestMethodSelector value={method} onValueChange={onMethodChange} />
|
|
93
107
|
<Input
|
|
94
|
-
className=
|
|
95
|
-
value={
|
|
96
|
-
|
|
97
|
-
{
|
|
108
|
+
className="rounded-l-none"
|
|
109
|
+
value={path}
|
|
110
|
+
autoFocus={autoFocus}
|
|
111
|
+
placeholder={placeholder}
|
|
112
|
+
rightSlot={
|
|
113
|
+
<CopyIcon
|
|
114
|
+
text={`${method} ${path}`}
|
|
115
|
+
tooltipText="Copy request line"
|
|
116
|
+
showToast={false}
|
|
117
|
+
onCopy={(text) => {
|
|
118
|
+
// Custom toast for request line
|
|
119
|
+
const truncatedText =
|
|
120
|
+
text.length > 30 ? `${text.slice(0, 30)}...` : text;
|
|
121
|
+
toast(
|
|
122
|
+
<div className="flex flex-col gap-1">
|
|
123
|
+
<span className="typo-body">Request line copied</span>
|
|
124
|
+
<span className="typo-code text-text-secondary">
|
|
125
|
+
{truncatedText}
|
|
126
|
+
</span>
|
|
127
|
+
</div>,
|
|
128
|
+
{
|
|
129
|
+
duration: 2000,
|
|
130
|
+
},
|
|
131
|
+
);
|
|
132
|
+
}}
|
|
133
|
+
/>
|
|
134
|
+
}
|
|
135
|
+
{...(onPathChange !== undefined ? { onChange: onPathChange } : {})}
|
|
98
136
|
/>
|
|
99
137
|
</div>
|
|
100
138
|
);
|
|
101
139
|
}
|
|
102
140
|
|
|
103
|
-
export {
|
|
141
|
+
export {
|
|
142
|
+
RequestLineEditor,
|
|
143
|
+
type RequestLineEditorProps,
|
|
144
|
+
requestMethodVariants,
|
|
145
|
+
};
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
import { Check, Copy } from "lucide-react";
|
|
2
|
+
import { Sandbox } from "./sandbox";
|
|
3
|
+
|
|
4
|
+
const meta = {
|
|
5
|
+
title: "Component/Sandbox",
|
|
6
|
+
component: Sandbox,
|
|
7
|
+
parameters: {
|
|
8
|
+
layout: "centered",
|
|
9
|
+
},
|
|
10
|
+
tags: ["autodocs"],
|
|
11
|
+
argTypes: {
|
|
12
|
+
url: {
|
|
13
|
+
control: "text",
|
|
14
|
+
description: "Display url",
|
|
15
|
+
},
|
|
16
|
+
showCopy: {
|
|
17
|
+
control: "boolean",
|
|
18
|
+
description: "Show the copy button",
|
|
19
|
+
},
|
|
20
|
+
showEye: {
|
|
21
|
+
control: "boolean",
|
|
22
|
+
description: "Show the eye button",
|
|
23
|
+
},
|
|
24
|
+
copyIcon: {
|
|
25
|
+
control: false,
|
|
26
|
+
description: "Show the copy icon",
|
|
27
|
+
},
|
|
28
|
+
tooltipText: {
|
|
29
|
+
control: "text",
|
|
30
|
+
description: "Copy button tooltip text",
|
|
31
|
+
},
|
|
32
|
+
showToast: {
|
|
33
|
+
control: "boolean",
|
|
34
|
+
description: "Show toast on copy",
|
|
35
|
+
},
|
|
36
|
+
onCopy: {
|
|
37
|
+
action: "copied",
|
|
38
|
+
description: "Successful copy callback",
|
|
39
|
+
},
|
|
40
|
+
},
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
export default meta;
|
|
44
|
+
|
|
45
|
+
export const Default = {
|
|
46
|
+
args: {
|
|
47
|
+
url: "http://localhost:8080/fhir",
|
|
48
|
+
showCopy: true,
|
|
49
|
+
showEye: true,
|
|
50
|
+
copyIcon: <Copy />,
|
|
51
|
+
tooltipText: "Copy URL",
|
|
52
|
+
showToast: true,
|
|
53
|
+
},
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
export const LongUrl = {
|
|
57
|
+
args: {
|
|
58
|
+
url: "https://very-long-domain-name-that-should-be-truncated.example.com/api/v1/very-long-endpoint-name",
|
|
59
|
+
showCopy: true,
|
|
60
|
+
showEye: true,
|
|
61
|
+
copyIcon: <Copy />,
|
|
62
|
+
tooltipText: "Copy URL",
|
|
63
|
+
showToast: true,
|
|
64
|
+
},
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
export const WithoutCopy = {
|
|
68
|
+
args: {
|
|
69
|
+
url: "http://localhost:8080/fhir",
|
|
70
|
+
showCopy: false,
|
|
71
|
+
showEye: true,
|
|
72
|
+
},
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
export const CustomIcon = {
|
|
76
|
+
args: {
|
|
77
|
+
url: "http://localhost:8080/fhir",
|
|
78
|
+
showCopy: true,
|
|
79
|
+
showEye: true,
|
|
80
|
+
copyIcon: <Check />,
|
|
81
|
+
tooltipText: "Copy URL",
|
|
82
|
+
showToast: true,
|
|
83
|
+
},
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
export const CustomTooltip = {
|
|
87
|
+
args: {
|
|
88
|
+
url: "http://localhost:8080/fhir",
|
|
89
|
+
showCopy: true,
|
|
90
|
+
showEye: true,
|
|
91
|
+
copyIcon: <Copy />,
|
|
92
|
+
tooltipText: "Copy link",
|
|
93
|
+
showToast: true,
|
|
94
|
+
},
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
export const WithoutToast = {
|
|
98
|
+
args: {
|
|
99
|
+
url: "http://localhost:8080/fhir",
|
|
100
|
+
showCopy: true,
|
|
101
|
+
showEye: true,
|
|
102
|
+
copyIcon: <Copy />,
|
|
103
|
+
tooltipText: "Copy URL",
|
|
104
|
+
showToast: false,
|
|
105
|
+
},
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
export const WithCallback = {
|
|
109
|
+
args: {
|
|
110
|
+
url: "http://localhost:8080/fhir",
|
|
111
|
+
showCopy: true,
|
|
112
|
+
showEye: true,
|
|
113
|
+
copyIcon: <Copy />,
|
|
114
|
+
tooltipText: "Copy URL",
|
|
115
|
+
showToast: true,
|
|
116
|
+
onCopy: (text: string) => {
|
|
117
|
+
console.log("Copied:", text);
|
|
118
|
+
},
|
|
119
|
+
},
|
|
120
|
+
};
|
|
121
|
+
|
|
122
|
+
export const WithoutEye = {
|
|
123
|
+
args: {
|
|
124
|
+
url: "http://localhost:8080/fhir",
|
|
125
|
+
showCopy: true,
|
|
126
|
+
showEye: false,
|
|
127
|
+
copyIcon: <Copy />,
|
|
128
|
+
tooltipText: "Copy URL",
|
|
129
|
+
showToast: true,
|
|
130
|
+
},
|
|
131
|
+
};
|