@bridgebrew/ui 0.0.0-stage → 0.1.10-next.79
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 +39 -2
- package/SOURCE.md +182 -0
- package/dist/build.js +871 -0
- package/dist/theme-css.js +896 -0
- package/dist/themes.js +69 -0
- package/dist/types/build/stylesheet.d.ts +31 -0
- package/dist/types/components/composite/command/command.d.ts +94 -0
- package/dist/types/components/composite/command/index.d.ts +2 -0
- package/dist/types/components/composite/draft-bar/draft-bar.d.ts +12 -0
- package/dist/types/components/composite/draft-bar/index.d.ts +2 -0
- package/dist/types/components/composite/image-field/image-field.d.ts +33 -0
- package/dist/types/components/composite/image-field/index.d.ts +2 -0
- package/dist/types/components/composite/list/index.d.ts +3 -0
- package/dist/types/components/composite/list/list-swipe.d.ts +28 -0
- package/dist/types/components/composite/list/list.d.ts +95 -0
- package/dist/types/components/composite/picker/index.d.ts +2 -0
- package/dist/types/components/composite/picker/picker.d.ts +44 -0
- package/dist/types/components/composite/prompt-field/index.d.ts +2 -0
- package/dist/types/components/composite/prompt-field/prompt-field.d.ts +18 -0
- package/dist/types/components/composite/properties/index.d.ts +2 -0
- package/dist/types/components/composite/properties/properties.d.ts +24 -0
- package/dist/types/components/composite/snooze-menu/index.d.ts +4 -0
- package/dist/types/components/composite/snooze-menu/presets.d.ts +36 -0
- package/dist/types/components/composite/snooze-menu/snooze-menu.d.ts +27 -0
- package/dist/types/components/composite/tag-input/index.d.ts +2 -0
- package/dist/types/components/composite/tag-input/tag-input.d.ts +22 -0
- package/dist/types/components/composite/wizard/index.d.ts +2 -0
- package/dist/types/components/composite/wizard/wizard.d.ts +53 -0
- package/dist/types/components/core/avatar/avatar.d.ts +16 -0
- package/dist/types/components/core/avatar/index.d.ts +2 -0
- package/dist/types/components/core/badge/badge.d.ts +8 -0
- package/dist/types/components/core/badge/index.d.ts +2 -0
- package/dist/types/components/core/breadcrumb/breadcrumb.d.ts +21 -0
- package/dist/types/components/core/breadcrumb/index.d.ts +2 -0
- package/dist/types/components/core/bullets/bullets.d.ts +15 -0
- package/dist/types/components/core/bullets/index.d.ts +2 -0
- package/dist/types/components/core/button/button.d.ts +14 -0
- package/dist/types/components/core/button/index.d.ts +2 -0
- package/dist/types/components/core/card/card.d.ts +16 -0
- package/dist/types/components/core/card/index.d.ts +2 -0
- package/dist/types/components/core/checkbox/checkbox.d.ts +15 -0
- package/dist/types/components/core/checkbox/index.d.ts +2 -0
- package/dist/types/components/core/cluster/cluster.d.ts +5 -0
- package/dist/types/components/core/cluster/index.d.ts +1 -0
- package/dist/types/components/core/code-block/code-block.d.ts +18 -0
- package/dist/types/components/core/code-block/index.d.ts +2 -0
- package/dist/types/components/core/collapsible/collapsible.d.ts +8 -0
- package/dist/types/components/core/collapsible/index.d.ts +1 -0
- package/dist/types/components/core/colour-picker/colour-picker.d.ts +25 -0
- package/dist/types/components/core/colour-picker/index.d.ts +4 -0
- package/dist/types/components/core/combobox/combobox.d.ts +63 -0
- package/dist/types/components/core/combobox/index.d.ts +2 -0
- package/dist/types/components/core/detail/detail.d.ts +12 -0
- package/dist/types/components/core/detail/index.d.ts +1 -0
- package/dist/types/components/core/dialog/dialog.d.ts +43 -0
- package/dist/types/components/core/dialog/drag.d.ts +4 -0
- package/dist/types/components/core/dialog/index.d.ts +2 -0
- package/dist/types/components/core/drop-zone/drop-zone.d.ts +23 -0
- package/dist/types/components/core/drop-zone/index.d.ts +2 -0
- package/dist/types/components/core/dropdown-menu/dropdown-menu.d.ts +78 -0
- package/dist/types/components/core/dropdown-menu/index.d.ts +2 -0
- package/dist/types/components/core/editable-field/editable-field.d.ts +42 -0
- package/dist/types/components/core/editable-field/index.d.ts +2 -0
- package/dist/types/components/core/empty-state/empty-state.d.ts +11 -0
- package/dist/types/components/core/empty-state/index.d.ts +2 -0
- package/dist/types/components/core/field/field.d.ts +31 -0
- package/dist/types/components/core/field/index.d.ts +2 -0
- package/dist/types/components/core/icon/icon-sets.d.ts +38 -0
- package/dist/types/components/core/icon/icon.d.ts +14 -0
- package/dist/types/components/core/icon/index.d.ts +2 -0
- package/dist/types/components/core/input/index.d.ts +4 -0
- package/dist/types/components/core/input/input.d.ts +22 -0
- package/dist/types/components/core/input/textarea.d.ts +8 -0
- package/dist/types/components/core/kbd/index.d.ts +2 -0
- package/dist/types/components/core/kbd/kbd.d.ts +7 -0
- package/dist/types/components/core/label/index.d.ts +2 -0
- package/dist/types/components/core/label/label.d.ts +13 -0
- package/dist/types/components/core/main-content/index.d.ts +2 -0
- package/dist/types/components/core/main-content/main-content.d.ts +18 -0
- package/dist/types/components/core/pane/index.d.ts +1 -0
- package/dist/types/components/core/pane/pane.d.ts +12 -0
- package/dist/types/components/core/pick-menu/index.d.ts +4 -0
- package/dist/types/components/core/pick-menu/pick-menu.d.ts +57 -0
- package/dist/types/components/core/pick-menu/tag-menu.d.ts +19 -0
- package/dist/types/components/core/popover/index.d.ts +2 -0
- package/dist/types/components/core/popover/popover.d.ts +22 -0
- package/dist/types/components/core/progress/index.d.ts +2 -0
- package/dist/types/components/core/progress/progress.d.ts +13 -0
- package/dist/types/components/core/resizable/index.d.ts +2 -0
- package/dist/types/components/core/resizable/resizable.d.ts +15 -0
- package/dist/types/components/core/resizable/use-remembered-layout.d.ts +31 -0
- package/dist/types/components/core/screen-link/index.d.ts +2 -0
- package/dist/types/components/core/screen-link/screen-link.d.ts +52 -0
- package/dist/types/components/core/scroll-area/index.d.ts +2 -0
- package/dist/types/components/core/scroll-area/scroll-area.d.ts +13 -0
- package/dist/types/components/core/scroll-area/steps.d.ts +5 -0
- package/dist/types/components/core/section/index.d.ts +2 -0
- package/dist/types/components/core/section/section.d.ts +16 -0
- package/dist/types/components/core/segment-group/index.d.ts +2 -0
- package/dist/types/components/core/segment-group/segment-group.d.ts +24 -0
- package/dist/types/components/core/select/index.d.ts +2 -0
- package/dist/types/components/core/select/select.d.ts +39 -0
- package/dist/types/components/core/skeleton/index.d.ts +2 -0
- package/dist/types/components/core/skeleton/skeleton.d.ts +13 -0
- package/dist/types/components/core/slider/index.d.ts +2 -0
- package/dist/types/components/core/slider/slider.d.ts +9 -0
- package/dist/types/components/core/sortable/index.d.ts +2 -0
- package/dist/types/components/core/sortable/sortable.d.ts +53 -0
- package/dist/types/components/core/split-view/index.d.ts +2 -0
- package/dist/types/components/core/split-view/split-view.d.ts +28 -0
- package/dist/types/components/core/status-icon/index.d.ts +2 -0
- package/dist/types/components/core/status-icon/status-icon.d.ts +13 -0
- package/dist/types/components/core/table/collapsible-rows.d.ts +7 -0
- package/dist/types/components/core/table/expand-toggle.d.ts +10 -0
- package/dist/types/components/core/table/group-header.d.ts +14 -0
- package/dist/types/components/core/table/index.d.ts +8 -0
- package/dist/types/components/core/table/table.d.ts +31 -0
- package/dist/types/components/core/tabs/index.d.ts +2 -0
- package/dist/types/components/core/tabs/tabs.d.ts +20 -0
- package/dist/types/components/core/tag-pill/index.d.ts +2 -0
- package/dist/types/components/core/tag-pill/tag-pill.d.ts +25 -0
- package/dist/types/components/core/thumbnail/index.d.ts +2 -0
- package/dist/types/components/core/thumbnail/thumbnail.d.ts +23 -0
- package/dist/types/components/core/toast/index.d.ts +2 -0
- package/dist/types/components/core/toast/toast.d.ts +88 -0
- package/dist/types/components/core/toggle/index.d.ts +2 -0
- package/dist/types/components/core/toggle/toggle.d.ts +9 -0
- package/dist/types/components/core/toggle-group/index.d.ts +2 -0
- package/dist/types/components/core/toggle-group/toggle-group.d.ts +21 -0
- package/dist/types/components/core/tooltip/index.d.ts +2 -0
- package/dist/types/components/core/tooltip/tooltip.d.ts +33 -0
- package/dist/types/components/layout/multi-pane/index.d.ts +4 -0
- package/dist/types/components/layout/multi-pane/list-detail.d.ts +17 -0
- package/dist/types/components/layout/multi-pane/multi-pane.d.ts +34 -0
- package/dist/types/components/layout/single-pane/index.d.ts +2 -0
- package/dist/types/components/layout/single-pane/single-pane.d.ts +11 -0
- package/dist/types/components/shell/app-shell/app-shell.d.ts +12 -0
- package/dist/types/components/shell/app-shell/index.d.ts +2 -0
- package/dist/types/components/shell/sidebar/index.d.ts +2 -0
- package/dist/types/components/shell/sidebar/sidebar-group.d.ts +45 -0
- package/dist/types/components/shell/sidebar/sidebar-item.d.ts +19 -0
- package/dist/types/components/shell/sidebar/sidebar-resize-handle.d.ts +17 -0
- package/dist/types/components/shell/sidebar/sidebar-tree.d.ts +42 -0
- package/dist/types/components/shell/sidebar/sidebar.d.ts +27 -0
- package/dist/types/components/template/address-book-template/address-book-template.d.ts +15 -0
- package/dist/types/components/template/address-book-template/index.d.ts +2 -0
- package/dist/types/components/template/mail-template/index.d.ts +2 -0
- package/dist/types/components/template/mail-template/mail-template.d.ts +11 -0
- package/dist/types/components/template/use-narrow.d.ts +3 -0
- package/dist/types/index.d.ts +149 -0
- package/dist/types/kit/check-rendering.d.ts +3 -0
- package/dist/types/kit/kit.d.ts +76 -0
- package/dist/types/lib/clipboard.d.ts +5 -0
- package/dist/types/lib/dates.d.ts +9 -0
- package/dist/types/lib/json.d.ts +26 -0
- package/dist/types/lib/keys.d.ts +15 -0
- package/dist/types/lib/utils.d.ts +2 -0
- package/dist/types/lib/view-scope.d.ts +22 -0
- package/dist/types/profile/profile.d.ts +34 -0
- package/dist/types/theme/appearance.d.ts +31 -0
- package/dist/types/theme/boot.d.ts +3 -0
- package/dist/types/theme/client-appearance-react.d.ts +3 -0
- package/dist/types/theme/client-appearance.d.ts +69 -0
- package/dist/types/theme/generate-tokens.d.ts +45 -0
- package/dist/types/theme/pack-themes-react.d.ts +24 -0
- package/dist/types/theme/palette.d.ts +111 -0
- package/dist/types/theme/semantic-mapping.d.ts +28 -0
- package/dist/types/theme/set-theme.d.ts +30 -0
- package/dist/types/theme/theme-colours.d.ts +14 -0
- package/dist/types/theme/theme-css.d.ts +3 -0
- package/dist/types/theme/themes.d.ts +63 -0
- package/dist/types/theme/wallpaper-sheet.d.ts +16 -0
- package/dist/types/theme/wallpaper-theme-react.d.ts +7 -0
- package/dist/types/theme/wallpaper-theme.d.ts +37 -0
- package/package.json +87 -3
- package/src/build/stylesheet.ts +128 -0
- package/src/components/composite/command/command.meta.yaml +74 -0
- package/src/components/composite/command/command.tsx +939 -0
- package/src/components/composite/command/index.ts +17 -0
- package/src/components/composite/draft-bar/draft-bar.meta.yaml +19 -0
- package/src/components/composite/draft-bar/draft-bar.tsx +57 -0
- package/src/components/composite/draft-bar/index.ts +2 -0
- package/src/components/composite/image-field/image-field.meta.yaml +69 -0
- package/src/components/composite/image-field/image-field.tsx +267 -0
- package/src/components/composite/image-field/index.ts +2 -0
- package/src/components/composite/list/index.ts +18 -0
- package/src/components/composite/list/list-swipe.tsx +163 -0
- package/src/components/composite/list/list.meta.yaml +238 -0
- package/src/components/composite/list/list.tsx +868 -0
- package/src/components/composite/picker/index.ts +2 -0
- package/src/components/composite/picker/picker.meta.yaml +103 -0
- package/src/components/composite/picker/picker.tsx +276 -0
- package/src/components/composite/prompt-field/index.ts +2 -0
- package/src/components/composite/prompt-field/prompt-field.meta.yaml +60 -0
- package/src/components/composite/prompt-field/prompt-field.tsx +81 -0
- package/src/components/composite/properties/index.ts +9 -0
- package/src/components/composite/properties/properties.meta.yaml +56 -0
- package/src/components/composite/properties/properties.tsx +132 -0
- package/src/components/composite/snooze-menu/index.ts +11 -0
- package/src/components/composite/snooze-menu/presets.ts +169 -0
- package/src/components/composite/snooze-menu/snooze-menu.meta.yaml +58 -0
- package/src/components/composite/snooze-menu/snooze-menu.tsx +146 -0
- package/src/components/composite/tag-input/index.ts +2 -0
- package/src/components/composite/tag-input/tag-input.meta.yaml +51 -0
- package/src/components/composite/tag-input/tag-input.tsx +404 -0
- package/src/components/composite/wizard/index.ts +2 -0
- package/src/components/composite/wizard/wizard.meta.yaml +73 -0
- package/src/components/composite/wizard/wizard.tsx +256 -0
- package/src/components/core/avatar/avatar.meta.yaml +71 -0
- package/src/components/core/avatar/avatar.tsx +92 -0
- package/src/components/core/avatar/index.ts +2 -0
- package/src/components/core/badge/badge.meta.yaml +34 -0
- package/src/components/core/badge/badge.tsx +23 -0
- package/src/components/core/badge/index.ts +2 -0
- package/src/components/core/breadcrumb/breadcrumb.meta.yaml +45 -0
- package/src/components/core/breadcrumb/breadcrumb.tsx +110 -0
- package/src/components/core/breadcrumb/index.ts +2 -0
- package/src/components/core/bullets/bullets.meta.yaml +37 -0
- package/src/components/core/bullets/bullets.tsx +60 -0
- package/src/components/core/bullets/index.ts +2 -0
- package/src/components/core/button/button.meta.yaml +91 -0
- package/src/components/core/button/button.tsx +93 -0
- package/src/components/core/button/index.ts +2 -0
- package/src/components/core/card/card.meta.yaml +94 -0
- package/src/components/core/card/card.tsx +54 -0
- package/src/components/core/card/index.ts +2 -0
- package/src/components/core/checkbox/checkbox.meta.yaml +59 -0
- package/src/components/core/checkbox/checkbox.tsx +106 -0
- package/src/components/core/checkbox/index.ts +2 -0
- package/src/components/core/cluster/cluster.meta.yaml +4 -0
- package/src/components/core/cluster/cluster.tsx +17 -0
- package/src/components/core/cluster/index.ts +1 -0
- package/src/components/core/code-block/code-block.meta.yaml +30 -0
- package/src/components/core/code-block/code-block.tsx +93 -0
- package/src/components/core/code-block/index.ts +2 -0
- package/src/components/core/collapsible/collapsible.meta.yaml +34 -0
- package/src/components/core/collapsible/collapsible.tsx +54 -0
- package/src/components/core/collapsible/index.ts +1 -0
- package/src/components/core/colour-picker/colour-picker.meta.yaml +52 -0
- package/src/components/core/colour-picker/colour-picker.tsx +314 -0
- package/src/components/core/colour-picker/index.ts +4 -0
- package/src/components/core/combobox/combobox.meta.yaml +75 -0
- package/src/components/core/combobox/combobox.tsx +288 -0
- package/src/components/core/combobox/index.ts +2 -0
- package/src/components/core/detail/detail.meta.yaml +13 -0
- package/src/components/core/detail/detail.tsx +73 -0
- package/src/components/core/detail/index.ts +1 -0
- package/src/components/core/dialog/dialog.meta.yaml +95 -0
- package/src/components/core/dialog/dialog.tsx +254 -0
- package/src/components/core/dialog/drag.ts +40 -0
- package/src/components/core/dialog/index.ts +25 -0
- package/src/components/core/drop-zone/drop-zone.meta.yaml +55 -0
- package/src/components/core/drop-zone/drop-zone.tsx +146 -0
- package/src/components/core/drop-zone/index.ts +2 -0
- package/src/components/core/dropdown-menu/dropdown-menu.meta.yaml +118 -0
- package/src/components/core/dropdown-menu/dropdown-menu.tsx +407 -0
- package/src/components/core/dropdown-menu/index.ts +32 -0
- package/src/components/core/editable-field/editable-field.meta.yaml +120 -0
- package/src/components/core/editable-field/editable-field.tsx +346 -0
- package/src/components/core/editable-field/index.ts +2 -0
- package/src/components/core/empty-state/empty-state.meta.yaml +21 -0
- package/src/components/core/empty-state/empty-state.tsx +42 -0
- package/src/components/core/empty-state/index.ts +2 -0
- package/src/components/core/field/field.meta.yaml +37 -0
- package/src/components/core/field/field.tsx +100 -0
- package/src/components/core/field/index.ts +9 -0
- package/src/components/core/icon/curated-names.json +107 -0
- package/src/components/core/icon/icon-sets.ts +109 -0
- package/src/components/core/icon/icon.meta.yaml +30 -0
- package/src/components/core/icon/icon.tsx +93 -0
- package/src/components/core/icon/index.ts +2 -0
- package/src/components/core/input/index.ts +4 -0
- package/src/components/core/input/input.meta.yaml +98 -0
- package/src/components/core/input/input.tsx +133 -0
- package/src/components/core/input/textarea.meta.yaml +79 -0
- package/src/components/core/input/textarea.tsx +63 -0
- package/src/components/core/kbd/index.ts +2 -0
- package/src/components/core/kbd/kbd.meta.yaml +12 -0
- package/src/components/core/kbd/kbd.tsx +29 -0
- package/src/components/core/label/index.ts +2 -0
- package/src/components/core/label/label.meta.yaml +55 -0
- package/src/components/core/label/label.tsx +72 -0
- package/src/components/core/main-content/index.ts +2 -0
- package/src/components/core/main-content/main-content.meta.yaml +23 -0
- package/src/components/core/main-content/main-content.tsx +49 -0
- package/src/components/core/pane/index.ts +1 -0
- package/src/components/core/pane/pane.meta.yaml +13 -0
- package/src/components/core/pane/pane.tsx +64 -0
- package/src/components/core/pick-menu/index.ts +4 -0
- package/src/components/core/pick-menu/pick-menu.meta.yaml +36 -0
- package/src/components/core/pick-menu/pick-menu.tsx +348 -0
- package/src/components/core/pick-menu/tag-menu.meta.yaml +7 -0
- package/src/components/core/pick-menu/tag-menu.tsx +79 -0
- package/src/components/core/popover/index.ts +2 -0
- package/src/components/core/popover/popover.meta.yaml +16 -0
- package/src/components/core/popover/popover.tsx +66 -0
- package/src/components/core/progress/index.ts +2 -0
- package/src/components/core/progress/progress.meta.yaml +47 -0
- package/src/components/core/progress/progress.tsx +56 -0
- package/src/components/core/resizable/index.ts +13 -0
- package/src/components/core/resizable/resizable.meta.yaml +110 -0
- package/src/components/core/resizable/resizable.tsx +125 -0
- package/src/components/core/resizable/use-remembered-layout.ts +261 -0
- package/src/components/core/screen-link/index.ts +2 -0
- package/src/components/core/screen-link/screen-link.meta.yaml +34 -0
- package/src/components/core/screen-link/screen-link.tsx +100 -0
- package/src/components/core/scroll-area/index.ts +2 -0
- package/src/components/core/scroll-area/scroll-area.meta.yaml +72 -0
- package/src/components/core/scroll-area/scroll-area.tsx +95 -0
- package/src/components/core/scroll-area/steps.tsx +72 -0
- package/src/components/core/section/index.ts +2 -0
- package/src/components/core/section/section.meta.yaml +72 -0
- package/src/components/core/section/section.tsx +93 -0
- package/src/components/core/segment-group/index.ts +2 -0
- package/src/components/core/segment-group/segment-group.meta.yaml +71 -0
- package/src/components/core/segment-group/segment-group.tsx +166 -0
- package/src/components/core/select/index.ts +20 -0
- package/src/components/core/select/select.meta.yaml +48 -0
- package/src/components/core/select/select.tsx +226 -0
- package/src/components/core/skeleton/index.ts +2 -0
- package/src/components/core/skeleton/skeleton.meta.yaml +50 -0
- package/src/components/core/skeleton/skeleton.tsx +71 -0
- package/src/components/core/slider/index.ts +2 -0
- package/src/components/core/slider/slider.meta.yaml +55 -0
- package/src/components/core/slider/slider.tsx +46 -0
- package/src/components/core/sortable/index.ts +16 -0
- package/src/components/core/sortable/sortable.meta.yaml +125 -0
- package/src/components/core/sortable/sortable.tsx +471 -0
- package/src/components/core/split-view/index.ts +2 -0
- package/src/components/core/split-view/split-view.meta.yaml +85 -0
- package/src/components/core/split-view/split-view.tsx +193 -0
- package/src/components/core/status-icon/index.ts +2 -0
- package/src/components/core/status-icon/status-icon.meta.yaml +64 -0
- package/src/components/core/status-icon/status-icon.tsx +94 -0
- package/src/components/core/table/collapsible-rows.tsx +30 -0
- package/src/components/core/table/expand-toggle.tsx +58 -0
- package/src/components/core/table/group-header.tsx +35 -0
- package/src/components/core/table/index.ts +26 -0
- package/src/components/core/table/table.meta.yaml +67 -0
- package/src/components/core/table/table.tsx +166 -0
- package/src/components/core/tabs/index.ts +2 -0
- package/src/components/core/tabs/tabs.meta.yaml +57 -0
- package/src/components/core/tabs/tabs.tsx +74 -0
- package/src/components/core/tag-pill/index.ts +2 -0
- package/src/components/core/tag-pill/tag-pill.meta.yaml +19 -0
- package/src/components/core/tag-pill/tag-pill.tsx +102 -0
- package/src/components/core/thumbnail/index.ts +2 -0
- package/src/components/core/thumbnail/thumbnail.meta.yaml +59 -0
- package/src/components/core/thumbnail/thumbnail.tsx +162 -0
- package/src/components/core/toast/index.ts +12 -0
- package/src/components/core/toast/toast.meta.yaml +93 -0
- package/src/components/core/toast/toast.tsx +763 -0
- package/src/components/core/toggle/index.ts +2 -0
- package/src/components/core/toggle/toggle.meta.yaml +53 -0
- package/src/components/core/toggle/toggle.tsx +44 -0
- package/src/components/core/toggle-group/index.ts +2 -0
- package/src/components/core/toggle-group/toggle-group.meta.yaml +59 -0
- package/src/components/core/toggle-group/toggle-group.tsx +68 -0
- package/src/components/core/tooltip/index.ts +7 -0
- package/src/components/core/tooltip/tooltip.meta.yaml +93 -0
- package/src/components/core/tooltip/tooltip.tsx +198 -0
- package/src/components/layout/multi-pane/index.ts +4 -0
- package/src/components/layout/multi-pane/list-detail.tsx +45 -0
- package/src/components/layout/multi-pane/multi-pane.meta.yaml +67 -0
- package/src/components/layout/multi-pane/multi-pane.tsx +158 -0
- package/src/components/layout/single-pane/index.ts +2 -0
- package/src/components/layout/single-pane/single-pane.meta.yaml +35 -0
- package/src/components/layout/single-pane/single-pane.tsx +48 -0
- package/src/components/shell/app-shell/app-shell.meta.yaml +65 -0
- package/src/components/shell/app-shell/app-shell.tsx +61 -0
- package/src/components/shell/app-shell/index.ts +2 -0
- package/src/components/shell/sidebar/index.ts +35 -0
- package/src/components/shell/sidebar/sidebar-group.tsx +254 -0
- package/src/components/shell/sidebar/sidebar-item.tsx +88 -0
- package/src/components/shell/sidebar/sidebar-resize-handle.tsx +101 -0
- package/src/components/shell/sidebar/sidebar-tree.tsx +325 -0
- package/src/components/shell/sidebar/sidebar.meta.yaml +126 -0
- package/src/components/shell/sidebar/sidebar.tsx +142 -0
- package/src/components/template/address-book-template/address-book-template.meta.yaml +22 -0
- package/src/components/template/address-book-template/address-book-template.tsx +201 -0
- package/src/components/template/address-book-template/index.ts +2 -0
- package/src/components/template/mail-template/index.ts +2 -0
- package/src/components/template/mail-template/mail-template.meta.yaml +22 -0
- package/src/components/template/mail-template/mail-template.tsx +731 -0
- package/src/components/template/use-narrow.ts +18 -0
- package/src/index.ts +505 -0
- package/src/kit/check-rendering.tsx +130 -0
- package/src/kit/kit.tsx +177 -0
- package/src/lib/clipboard.ts +27 -0
- package/src/lib/dates.ts +13 -0
- package/src/lib/json.ts +59 -0
- package/src/lib/keys.ts +54 -0
- package/src/lib/utils.ts +12 -0
- package/src/lib/view-scope.tsx +60 -0
- package/src/profile/profile.ts +238 -0
- package/src/theme/appearance.ts +198 -0
- package/src/theme/boot.ts +6 -0
- package/src/theme/client-appearance-react.ts +14 -0
- package/src/theme/client-appearance.ts +284 -0
- package/src/theme/generate-tokens.ts +658 -0
- package/src/theme/pack-themes-react.ts +107 -0
- package/src/theme/palette.ts +301 -0
- package/src/theme/semantic-mapping.ts +165 -0
- package/src/theme/set-theme.ts +162 -0
- package/src/theme/theme-colours.ts +60 -0
- package/src/theme/theme-css.ts +15 -0
- package/src/theme/themes.ts +133 -0
- package/src/theme/wallpaper-sheet.ts +58 -0
- package/src/theme/wallpaper-theme-react.ts +60 -0
- package/src/theme/wallpaper-theme.ts +231 -0
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
|
|
3
|
+
import { cn } from "../../../lib/utils";
|
|
4
|
+
import { ResizableHandle, ResizablePanel, ResizablePanelGroup } from "../../core/resizable";
|
|
5
|
+
import { ScrollArea } from "../../core/scroll-area";
|
|
6
|
+
import { useRememberedLayout } from "../../core/resizable/use-remembered-layout";
|
|
7
|
+
|
|
8
|
+
// research-070: a screen's skeleton in two or three panes, `nav` | `main` | `aside` (HTML's names): `main` takes what
|
|
9
|
+
// the others leave, `nav` and `aside` start at 25 %. Each edge is dragged, the sizes kept (`storageKey`), a double-click
|
|
10
|
+
// on an edge back to the starting widths. When room runs out the panes leave from the right: under 800px of its own box
|
|
11
|
+
// the `aside` goes (three panes), under 640px the first pane stays alone (a container query: a window's width, not the
|
|
12
|
+
// page's); the screen opens what left elsewhere (a window; on a phone, pushed with the shell's Back). `mode`: one pane
|
|
13
|
+
// alone, a window showing only it.
|
|
14
|
+
|
|
15
|
+
type PaneName = "nav" | "main" | "aside";
|
|
16
|
+
|
|
17
|
+
/** Under this width (px) of its box, MultiPane shows its first pane alone (the container query says the same). */
|
|
18
|
+
const multiPaneNarrowWidth = 640;
|
|
19
|
+
/** Under this width (px) of its box, three MultiPane leave their `aside` out. */
|
|
20
|
+
const multiPaneAsideWidth = 800;
|
|
21
|
+
|
|
22
|
+
interface MultiPaneProps extends Omit<React.ComponentProps<"div">, "children"> {
|
|
23
|
+
/** The left pane (a list, folders); none: `main` on the left. */
|
|
24
|
+
nav?: React.ReactNode;
|
|
25
|
+
/** The pane that takes the room. */
|
|
26
|
+
main: React.ReactNode;
|
|
27
|
+
/** The right pane (a record, properties); none: `main` on the right. */
|
|
28
|
+
aside?: React.ReactNode;
|
|
29
|
+
/** `split`: the panes side by side; a pane's name: that pane alone at any width (a window showing it). */
|
|
30
|
+
mode?: "split" | PaneName;
|
|
31
|
+
/** When room runs out, the panes leave from the right (default); off for a screen that cannot open them elsewhere
|
|
32
|
+
* yet. */
|
|
33
|
+
collapse?: boolean;
|
|
34
|
+
/** `nav`'s starting width (`"25%"`, `"320px"`): dragged from there, a double-click on the edge back to it. */
|
|
35
|
+
defaultNavSize?: string;
|
|
36
|
+
/** `aside`'s starting width (`"25%"`, `"380px"`). */
|
|
37
|
+
defaultAsideSize?: string;
|
|
38
|
+
/** `<plugin>/<screen>/<split>@v<n>`: the sizes a user dragged, kept per workspace in their profile (research-049). */
|
|
39
|
+
storageKey?: string;
|
|
40
|
+
/** The panes that scroll their content (the kit's ScrollArea, as a frame's `scrolling`); the others (default) leave
|
|
41
|
+
* it to their content (a Pane's body, a Detail). */
|
|
42
|
+
scroll?: PaneName[];
|
|
43
|
+
/** Its group's props (a customization owner's data attribute). */
|
|
44
|
+
groupProps?: Omit<React.ComponentProps<typeof ResizablePanelGroup>, "orientation" | "children">;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
const present = (node: React.ReactNode) => node !== undefined && node !== null && node !== false;
|
|
48
|
+
|
|
49
|
+
/** One pane at any width: the library's inline sizes overridden, the other panels and the handles hidden. */
|
|
50
|
+
const firstAlone =
|
|
51
|
+
"[&>[data-slot=resizable-handle]]:hidden! [&>[data-slot=resizable-panel]:not(:first-of-type)]:hidden! [&>[data-slot=resizable-panel]]:min-w-0! [&>[data-slot=resizable-panel]]:max-w-none! [&>[data-slot=resizable-panel]]:flex-[1_1_0]!";
|
|
52
|
+
/** The same, only when its box is narrow. */
|
|
53
|
+
const firstAloneNarrow =
|
|
54
|
+
"@max-[639.98px]:[&>[data-slot=resizable-handle]]:hidden! @max-[639.98px]:[&>[data-slot=resizable-panel]:not(:first-of-type)]:hidden! @max-[639.98px]:[&>[data-slot=resizable-panel]]:min-w-0! @max-[639.98px]:[&>[data-slot=resizable-panel]]:max-w-none! @max-[639.98px]:[&>[data-slot=resizable-panel]]:flex-[1_1_0]!";
|
|
55
|
+
|
|
56
|
+
/** Its box's width, `undefined` until measured; 0 when not laid out (hidden, jsdom). */
|
|
57
|
+
function useWidth(ref: React.RefObject<HTMLDivElement | null>, watch: boolean) {
|
|
58
|
+
const [width, setWidth] = React.useState<number>();
|
|
59
|
+
React.useLayoutEffect(() => {
|
|
60
|
+
const element = ref.current;
|
|
61
|
+
if (!watch || !element || typeof ResizeObserver === "undefined") return;
|
|
62
|
+
setWidth(element.getBoundingClientRect().width);
|
|
63
|
+
const observer = new ResizeObserver(([entry]) => entry && setWidth(entry.contentRect.width));
|
|
64
|
+
observer.observe(element);
|
|
65
|
+
return () => observer.disconnect();
|
|
66
|
+
}, [ref, watch]);
|
|
67
|
+
return width;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
function MultiPane({
|
|
71
|
+
nav,
|
|
72
|
+
main,
|
|
73
|
+
aside,
|
|
74
|
+
mode = "split",
|
|
75
|
+
collapse = true,
|
|
76
|
+
defaultNavSize = "25%",
|
|
77
|
+
defaultAsideSize = "25%",
|
|
78
|
+
storageKey,
|
|
79
|
+
groupProps,
|
|
80
|
+
scroll = [],
|
|
81
|
+
className,
|
|
82
|
+
...props
|
|
83
|
+
}: MultiPaneProps) {
|
|
84
|
+
const root = React.useRef<HTMLDivElement | null>(null);
|
|
85
|
+
const frame = (id: PaneName, node: React.ReactNode) =>
|
|
86
|
+
scroll.includes(id) ? <ScrollArea className="h-full min-h-0">{node}</ScrollArea> : node;
|
|
87
|
+
const three = present(nav) && present(aside);
|
|
88
|
+
const width = useWidth(root, collapse && three && mode === "split");
|
|
89
|
+
// The aside is unmounted rather than hidden: the library sizes the panes it holds, a hidden one would skew a drag.
|
|
90
|
+
const shown = [
|
|
91
|
+
present(nav) && { id: "nav" as const, node: nav, size: defaultNavSize, min: "200px" },
|
|
92
|
+
{ id: "main" as const, node: main, size: undefined, min: "380px" },
|
|
93
|
+
present(aside) &&
|
|
94
|
+
!(collapse && three && width !== undefined && width > 0 && width < multiPaneAsideWidth) && {
|
|
95
|
+
id: "aside" as const,
|
|
96
|
+
node: aside,
|
|
97
|
+
size: defaultAsideSize,
|
|
98
|
+
min: "200px",
|
|
99
|
+
},
|
|
100
|
+
].filter((pane) => pane !== false);
|
|
101
|
+
const { defaultLayout, groupRef, elementRef, onLayoutChange, onLayoutChanged, forget } =
|
|
102
|
+
useRememberedLayout(storageKey, () => shown.map(({ id, size }) => ({ id, size })));
|
|
103
|
+
const alone = mode !== "split" && mode !== shown[0]?.id;
|
|
104
|
+
return (
|
|
105
|
+
<div
|
|
106
|
+
ref={root}
|
|
107
|
+
data-slot="multi-pane"
|
|
108
|
+
data-mode={mode}
|
|
109
|
+
className={cn("@container relative flex min-h-0 min-w-0 flex-1 flex-col", className)}
|
|
110
|
+
{...props}
|
|
111
|
+
>
|
|
112
|
+
{alone ? (
|
|
113
|
+
<div data-slot="multi-pane-alone" className="min-h-0 flex-1 [&>*]:h-full [&>*]:min-h-0">
|
|
114
|
+
{frame(mode, mode === "nav" ? nav : mode === "aside" ? aside : main)}
|
|
115
|
+
</div>
|
|
116
|
+
) : (
|
|
117
|
+
<ResizablePanelGroup
|
|
118
|
+
orientation="horizontal"
|
|
119
|
+
{...groupProps}
|
|
120
|
+
{...(defaultLayout !== undefined && { defaultLayout })}
|
|
121
|
+
groupRef={groupRef}
|
|
122
|
+
elementRef={elementRef}
|
|
123
|
+
onLayoutChange={(layout) => {
|
|
124
|
+
onLayoutChange();
|
|
125
|
+
groupProps?.onLayoutChange?.(layout);
|
|
126
|
+
}}
|
|
127
|
+
onLayoutChanged={(layout) => {
|
|
128
|
+
onLayoutChanged(layout);
|
|
129
|
+
groupProps?.onLayoutChanged?.(layout);
|
|
130
|
+
}}
|
|
131
|
+
className={cn(
|
|
132
|
+
"min-h-0 flex-1 [&_[data-bridge-customization-slot]]:min-w-0",
|
|
133
|
+
collapse && firstAloneNarrow,
|
|
134
|
+
mode !== "split" && firstAlone,
|
|
135
|
+
groupProps?.className,
|
|
136
|
+
)}
|
|
137
|
+
>
|
|
138
|
+
{shown.map((pane, i) => (
|
|
139
|
+
<React.Fragment key={pane.id}>
|
|
140
|
+
{i > 0 && <ResizableHandle onDoubleClick={forget} />}
|
|
141
|
+
<ResizablePanel
|
|
142
|
+
id={pane.id}
|
|
143
|
+
{...(pane.size !== undefined && { defaultSize: pane.size })}
|
|
144
|
+
minSize={pane.min}
|
|
145
|
+
className={i > 0 ? "[&>*]:h-full [&>*]:min-h-0" : undefined}
|
|
146
|
+
>
|
|
147
|
+
{frame(pane.id, pane.node)}
|
|
148
|
+
</ResizablePanel>
|
|
149
|
+
</React.Fragment>
|
|
150
|
+
))}
|
|
151
|
+
</ResizablePanelGroup>
|
|
152
|
+
)}
|
|
153
|
+
</div>
|
|
154
|
+
);
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
export { MultiPane, multiPaneNarrowWidth, multiPaneAsideWidth };
|
|
158
|
+
export type { MultiPaneProps };
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
name: SinglePane
|
|
2
|
+
description: "A screen's skeleton in one pane; it scrolls only when asked (scroll, as a frame's scrolling, through the kit's ScrollArea), else its content fits it and scrolls itself. Its content is a MainContent: width read (default) a centred column 720px at most, readable on a wide screen; wide 1040px; full the whole width. On a narrow box (a phone) both take the width. One pane: no mode, nothing to detach."
|
|
3
|
+
layer: layout
|
|
4
|
+
category: layout
|
|
5
|
+
when_to_use:
|
|
6
|
+
- "A page to read or fill: settings, a record alone, a document (width read)"
|
|
7
|
+
- "One large piece of content: a sheet-like table, a dashboard (width full)"
|
|
8
|
+
when_not_to_use:
|
|
9
|
+
- "A list beside its record, a table beside the row it opened, three columns — use MultiPane"
|
|
10
|
+
props:
|
|
11
|
+
- name: width
|
|
12
|
+
type: "'read' | 'wide' | 'full'"
|
|
13
|
+
required: false
|
|
14
|
+
default: "'read'"
|
|
15
|
+
description: "MainContent's width: read, centred, 720px at most; wide, 1040px; full, the whole width"
|
|
16
|
+
- name: scroll
|
|
17
|
+
type: boolean
|
|
18
|
+
required: false
|
|
19
|
+
default: "false"
|
|
20
|
+
description: "Its content scrolls in the pane, through the kit's ScrollArea (Bridge's own scrollbar, the same on every OS); off, the content fits the pane and scrolls itself (a Table's own ScrollArea)"
|
|
21
|
+
- name: children
|
|
22
|
+
type: React.ReactNode
|
|
23
|
+
required: true
|
|
24
|
+
description: "The page's content (Sections, a Table, a Detail)"
|
|
25
|
+
composition_partners:
|
|
26
|
+
- Section (a page of titled blocks)
|
|
27
|
+
- Table (width full)
|
|
28
|
+
examples:
|
|
29
|
+
- title: "A settings page"
|
|
30
|
+
code: |
|
|
31
|
+
<SinglePane scroll><Section size="lg" title="General" />…</SinglePane>
|
|
32
|
+
anti_patterns:
|
|
33
|
+
- "Don't declare a component inside the screen's render for its content: each render makes a new component, React mounts it again and its state goes (a draft, the scroll, the focus). Pass elements"
|
|
34
|
+
- "Don't write a large block of JSX inline when it grows: put it in small components of its own"
|
|
35
|
+
notes: "Sub-parts by data-slot: single-pane (data-width), single-pane-content (inside its ScrollArea with scroll). Never overflow: auto: every scroll goes through the kit's ScrollArea. Its content is a MainContent (its margins, 16px then 40px from 640px of pane, and its centred column); single-pane-content is that MainContent's column."
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
|
|
3
|
+
import { cn } from "../../../lib/utils";
|
|
4
|
+
import { MainContent, type MainContentProps } from "../../core/main-content";
|
|
5
|
+
import { ScrollArea } from "../../core/scroll-area";
|
|
6
|
+
|
|
7
|
+
// research-070: a screen's skeleton in one pane; it scrolls only when asked (`scroll`, as a frame's `scrolling`),
|
|
8
|
+
// through the kit's ScrollArea, else its content scrolls itself. Its content is a MainContent (its column, margins and
|
|
9
|
+
// alignment): `read` (default) a centred column to read (settings, a document), `wide` a wider one, `full` the whole
|
|
10
|
+
// width (a large table, a dashboard). One pane: no mode, nothing to detach.
|
|
11
|
+
|
|
12
|
+
interface SinglePaneProps extends React.ComponentProps<"div"> {
|
|
13
|
+
/** MainContent's width: `read` (default) 720px centred, `wide` 1040px, `full` the whole width. */
|
|
14
|
+
width?: MainContentProps["width"];
|
|
15
|
+
/** Its content scrolls in the pane (the kit's ScrollArea); off (default), the content fits it and scrolls itself. */
|
|
16
|
+
scroll?: boolean;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
function SinglePane({
|
|
20
|
+
width = "read",
|
|
21
|
+
scroll = false,
|
|
22
|
+
className,
|
|
23
|
+
children,
|
|
24
|
+
...props
|
|
25
|
+
}: SinglePaneProps) {
|
|
26
|
+
const content = (
|
|
27
|
+
<MainContent
|
|
28
|
+
width={width}
|
|
29
|
+
data-slot="single-pane-content"
|
|
30
|
+
className={cn(!scroll && "flex min-h-0 flex-1 flex-col")}
|
|
31
|
+
>
|
|
32
|
+
{children}
|
|
33
|
+
</MainContent>
|
|
34
|
+
);
|
|
35
|
+
return (
|
|
36
|
+
<div
|
|
37
|
+
data-slot="single-pane"
|
|
38
|
+
data-width={width}
|
|
39
|
+
className={cn("@container flex min-h-0 min-w-0 flex-1 flex-col", className)}
|
|
40
|
+
{...props}
|
|
41
|
+
>
|
|
42
|
+
{scroll ? <ScrollArea className="min-h-0 flex-1">{content}</ScrollArea> : content}
|
|
43
|
+
</div>
|
|
44
|
+
);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export { SinglePane };
|
|
48
|
+
export type { SinglePaneProps };
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
name: AppShell
|
|
2
|
+
description: "Full-height application shell with an optional global header spanning a fixed sidebar and scrollable main content area."
|
|
3
|
+
layer: shell
|
|
4
|
+
category: layout
|
|
5
|
+
when_to_use:
|
|
6
|
+
- "As the top-level layout wrapper for the entire application"
|
|
7
|
+
- "For creating the classic sidebar + main content layout"
|
|
8
|
+
- "For full-height applications with scrollable content area"
|
|
9
|
+
when_not_to_use:
|
|
10
|
+
- "For pages without a sidebar — use plain layout elements"
|
|
11
|
+
- "For nested layout sections — AppShell is designed as a top-level wrapper"
|
|
12
|
+
- "For mobile-first layouts — AppShell uses a fixed desktop sidebar"
|
|
13
|
+
composition_partners:
|
|
14
|
+
- Sidebar (as sidebar prop)
|
|
15
|
+
- Breadcrumb (in the global header or main content header)
|
|
16
|
+
- Tabs (in main content area)
|
|
17
|
+
- Table (in main content area)
|
|
18
|
+
props:
|
|
19
|
+
- name: header
|
|
20
|
+
type: React.ReactNode
|
|
21
|
+
required: false
|
|
22
|
+
description: "Global toolbar content rendered in a semantic header spanning above both sidebar and main. Use for product branding and app-wide actions."
|
|
23
|
+
- name: sidebar
|
|
24
|
+
type: React.ReactNode
|
|
25
|
+
required: false
|
|
26
|
+
description: "Sidebar content rendered in a fixed-width aside on the left. Typically a <Sidebar> component."
|
|
27
|
+
- name: children
|
|
28
|
+
type: React.ReactNode
|
|
29
|
+
required: false
|
|
30
|
+
description: "Main content rendered in the scrollable <main> area"
|
|
31
|
+
props_priority:
|
|
32
|
+
- header
|
|
33
|
+
- sidebar
|
|
34
|
+
- children
|
|
35
|
+
examples:
|
|
36
|
+
- title: "App shell with sidebar"
|
|
37
|
+
code: |
|
|
38
|
+
<AppShell
|
|
39
|
+
header={
|
|
40
|
+
<div className="flex h-lg items-center px-4">
|
|
41
|
+
<strong>Acme</strong>
|
|
42
|
+
<Breadcrumb items={[{ label: "Projects" }, { label: "Issues" }]} />
|
|
43
|
+
</div>
|
|
44
|
+
}
|
|
45
|
+
sidebar={<Sidebar>...</Sidebar>}
|
|
46
|
+
>
|
|
47
|
+
<div className="p-4">
|
|
48
|
+
<Table columns="1fr 200px">...</Table>
|
|
49
|
+
</div>
|
|
50
|
+
</AppShell>
|
|
51
|
+
- title: "App shell without sidebar"
|
|
52
|
+
code: |
|
|
53
|
+
<AppShell>
|
|
54
|
+
<div className="p-4">Full-width content</div>
|
|
55
|
+
</AppShell>
|
|
56
|
+
anti_patterns:
|
|
57
|
+
- "Don't nest AppShell inside another AppShell — it's designed as the outermost layout"
|
|
58
|
+
- "Don't add height/overflow styles — AppShell already handles h-screen and overflow"
|
|
59
|
+
- "Don't put navigation content directly in children — pass it via the sidebar prop"
|
|
60
|
+
- "Don't duplicate product branding in both the AppShell header and SidebarHeader — a global brand belongs in the spanning header"
|
|
61
|
+
- "Never allow body-level scrolling — your app CSS must set html, body { height: 100%; overflow: hidden } (the setup scaffold includes it; tokens.css does not style html/body — CSS contract). Only individual layout regions (sidebar, main) scroll independently via overflow-y:auto"
|
|
62
|
+
accessibility_notes: "Renders the optional global toolbar as <header>, sidebar as <aside>, and content as <main>. The landmark roles provide natural navigation for screen readers. Sidebar has border-r separation and independent scroll."
|
|
63
|
+
related_patterns:
|
|
64
|
+
- list-view
|
|
65
|
+
- crud-page
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { cva, type VariantProps } from "class-variance-authority";
|
|
3
|
+
|
|
4
|
+
import { cn } from "../../../lib/utils";
|
|
5
|
+
|
|
6
|
+
// --- AppShell ---
|
|
7
|
+
|
|
8
|
+
const appShellVariants = cva("flex h-screen bg-background overflow-hidden");
|
|
9
|
+
|
|
10
|
+
interface AppShellProps extends React.ComponentProps<"div">, VariantProps<typeof appShellVariants> {
|
|
11
|
+
/** Optional global toolbar rendered above both sidebar and main content */
|
|
12
|
+
header?: React.ReactNode;
|
|
13
|
+
/** Optional sidebar content rendered in a fixed-width aside on the left */
|
|
14
|
+
sidebar?: React.ReactNode;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
function AppShell({ className, header, sidebar, children, ...props }: AppShellProps) {
|
|
18
|
+
const hasHeader = header !== undefined && header !== null && header !== false;
|
|
19
|
+
const body = (
|
|
20
|
+
<>
|
|
21
|
+
{sidebar && (
|
|
22
|
+
<aside
|
|
23
|
+
data-slot="app-shell-sidebar"
|
|
24
|
+
className="flex min-h-0 shrink-0 flex-col overflow-hidden border-r border-border"
|
|
25
|
+
>
|
|
26
|
+
{sidebar}
|
|
27
|
+
</aside>
|
|
28
|
+
)}
|
|
29
|
+
<main
|
|
30
|
+
data-slot="app-shell-main"
|
|
31
|
+
className="min-h-0 min-w-0 flex-1 flex flex-col overflow-hidden"
|
|
32
|
+
>
|
|
33
|
+
{children}
|
|
34
|
+
</main>
|
|
35
|
+
</>
|
|
36
|
+
);
|
|
37
|
+
|
|
38
|
+
return (
|
|
39
|
+
<div
|
|
40
|
+
data-slot="app-shell"
|
|
41
|
+
className={cn(appShellVariants(), hasHeader && "flex-col", className)}
|
|
42
|
+
{...props}
|
|
43
|
+
>
|
|
44
|
+
{hasHeader ? (
|
|
45
|
+
<>
|
|
46
|
+
<header data-slot="app-shell-header" className="shrink-0 border-b border-border">
|
|
47
|
+
{header}
|
|
48
|
+
</header>
|
|
49
|
+
<div data-slot="app-shell-body" className="flex min-h-0 flex-1 overflow-hidden">
|
|
50
|
+
{body}
|
|
51
|
+
</div>
|
|
52
|
+
</>
|
|
53
|
+
) : (
|
|
54
|
+
body
|
|
55
|
+
)}
|
|
56
|
+
</div>
|
|
57
|
+
);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export { AppShell, appShellVariants };
|
|
61
|
+
export type { AppShellProps };
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
export {
|
|
2
|
+
Sidebar,
|
|
3
|
+
sidebarVariants,
|
|
4
|
+
SidebarContent,
|
|
5
|
+
SidebarHeader,
|
|
6
|
+
SidebarSection,
|
|
7
|
+
SidebarItem,
|
|
8
|
+
sidebarItemVariants,
|
|
9
|
+
SidebarFooter,
|
|
10
|
+
SidebarGroup,
|
|
11
|
+
SidebarGroupTrigger,
|
|
12
|
+
SidebarGroupContent,
|
|
13
|
+
SidebarTree,
|
|
14
|
+
SidebarTreeItem,
|
|
15
|
+
SidebarCollapse,
|
|
16
|
+
SidebarResizeHandle,
|
|
17
|
+
SIDEBAR_MIN_WIDTH,
|
|
18
|
+
SIDEBAR_DEFAULT_WIDTH,
|
|
19
|
+
clampSidebarWidth,
|
|
20
|
+
} from "./sidebar";
|
|
21
|
+
export type {
|
|
22
|
+
SidebarProps,
|
|
23
|
+
SidebarContentProps,
|
|
24
|
+
SidebarHeaderProps,
|
|
25
|
+
SidebarSectionProps,
|
|
26
|
+
SidebarItemProps,
|
|
27
|
+
SidebarFooterProps,
|
|
28
|
+
SidebarGroupProps,
|
|
29
|
+
SidebarGroupTriggerProps,
|
|
30
|
+
SidebarGroupContentProps,
|
|
31
|
+
SidebarTreeProps,
|
|
32
|
+
SidebarTreeItemProps,
|
|
33
|
+
SidebarCollapseProps,
|
|
34
|
+
SidebarResizeHandleProps,
|
|
35
|
+
} from "./sidebar";
|
|
@@ -0,0 +1,254 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
|
|
3
|
+
import { cn } from "../../../lib/utils";
|
|
4
|
+
|
|
5
|
+
// --- SidebarGroupContext ---
|
|
6
|
+
|
|
7
|
+
interface SidebarGroupContextValue {
|
|
8
|
+
expanded: boolean;
|
|
9
|
+
onExpandedChange: (expanded: boolean) => void;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
const SidebarGroupContext = React.createContext<SidebarGroupContextValue | undefined>(undefined);
|
|
13
|
+
|
|
14
|
+
function useSidebarGroup() {
|
|
15
|
+
const ctx = React.useContext(SidebarGroupContext);
|
|
16
|
+
if (!ctx) {
|
|
17
|
+
throw new Error("SidebarGroupTrigger and SidebarGroupContent must be used within SidebarGroup");
|
|
18
|
+
}
|
|
19
|
+
return ctx;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
// --- SidebarGroup ---
|
|
23
|
+
|
|
24
|
+
interface SidebarGroupProps extends React.ComponentProps<"div"> {
|
|
25
|
+
/** Initial expanded state (uncontrolled) */
|
|
26
|
+
defaultExpanded?: boolean;
|
|
27
|
+
/** Controlled expanded state */
|
|
28
|
+
expanded?: boolean;
|
|
29
|
+
/** Callback when expanded state changes */
|
|
30
|
+
onExpandedChange?: (expanded: boolean) => void;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
function SidebarGroup({
|
|
34
|
+
className,
|
|
35
|
+
defaultExpanded = true,
|
|
36
|
+
expanded: controlledExpanded,
|
|
37
|
+
onExpandedChange: controlledOnChange,
|
|
38
|
+
...props
|
|
39
|
+
}: SidebarGroupProps) {
|
|
40
|
+
const [internalExpanded, setInternalExpanded] = React.useState(defaultExpanded);
|
|
41
|
+
|
|
42
|
+
const expanded = controlledExpanded ?? internalExpanded;
|
|
43
|
+
const onExpandedChange = controlledOnChange ?? setInternalExpanded;
|
|
44
|
+
|
|
45
|
+
const ctx = React.useMemo(() => ({ expanded, onExpandedChange }), [expanded, onExpandedChange]);
|
|
46
|
+
|
|
47
|
+
return (
|
|
48
|
+
<SidebarGroupContext.Provider value={ctx}>
|
|
49
|
+
<div data-slot="sidebar-group" className={cn("flex flex-col", className)} {...props} />
|
|
50
|
+
</SidebarGroupContext.Provider>
|
|
51
|
+
);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
// --- SidebarChevron ---
|
|
55
|
+
|
|
56
|
+
/** Points down when `expanded`, otherwise right (`closed="left"`: left, for a chevron on the right edge). */
|
|
57
|
+
function SidebarChevron({
|
|
58
|
+
expanded,
|
|
59
|
+
closed = "right",
|
|
60
|
+
}: {
|
|
61
|
+
expanded: boolean;
|
|
62
|
+
closed?: "left" | "right";
|
|
63
|
+
}) {
|
|
64
|
+
return (
|
|
65
|
+
<svg
|
|
66
|
+
className={cn(
|
|
67
|
+
"size-3 transition-transform duration-150",
|
|
68
|
+
!expanded && (closed === "left" ? "rotate-90" : "-rotate-90"),
|
|
69
|
+
)}
|
|
70
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
71
|
+
viewBox="0 0 24 24"
|
|
72
|
+
fill="none"
|
|
73
|
+
stroke="currentColor"
|
|
74
|
+
strokeWidth="2.5"
|
|
75
|
+
aria-hidden="true"
|
|
76
|
+
>
|
|
77
|
+
<path d="m6 9 6 6 6-6" />
|
|
78
|
+
</svg>
|
|
79
|
+
);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
// --- Trailing content ---
|
|
83
|
+
|
|
84
|
+
/** Whether React renders anything for `node` (`cond && <Badge />` gives `false`). */
|
|
85
|
+
const renders = (node: React.ReactNode) => node != null && typeof node !== "boolean" && node !== "";
|
|
86
|
+
|
|
87
|
+
/** A row's trailing content: out of its button's name, its description instead (`aria-describedby`). */
|
|
88
|
+
function SidebarTrailing({
|
|
89
|
+
id,
|
|
90
|
+
className,
|
|
91
|
+
children,
|
|
92
|
+
}: {
|
|
93
|
+
id: string;
|
|
94
|
+
className?: string;
|
|
95
|
+
children: React.ReactNode;
|
|
96
|
+
}) {
|
|
97
|
+
return (
|
|
98
|
+
<span
|
|
99
|
+
id={id}
|
|
100
|
+
data-slot="sidebar-item-trailing"
|
|
101
|
+
className={cn("flex shrink-0 items-center", className)}
|
|
102
|
+
>
|
|
103
|
+
{children}
|
|
104
|
+
</span>
|
|
105
|
+
);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
// --- SidebarGroupTrigger ---
|
|
109
|
+
|
|
110
|
+
interface SidebarGroupTriggerProps extends Omit<React.ComponentProps<"button">, "color"> {
|
|
111
|
+
/** Optional team dot color (hex string) */
|
|
112
|
+
teamDot?: string;
|
|
113
|
+
/** `section`: a collapsible SidebarSection, its small caps label with the chevron on the right. */
|
|
114
|
+
variant?: "group" | "section";
|
|
115
|
+
/** Shown at the right end, before a section's chevron (a count, a status icon): the button's
|
|
116
|
+
* description, not its name. Non-interactive: it sits inside the button. */
|
|
117
|
+
trailing?: React.ReactNode;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
function SidebarGroupTrigger({
|
|
121
|
+
className,
|
|
122
|
+
children,
|
|
123
|
+
teamDot,
|
|
124
|
+
variant = "group",
|
|
125
|
+
trailing,
|
|
126
|
+
...props
|
|
127
|
+
}: SidebarGroupTriggerProps) {
|
|
128
|
+
const { expanded, onExpandedChange } = useSidebarGroup();
|
|
129
|
+
const chevron = (
|
|
130
|
+
<span
|
|
131
|
+
data-slot="expand-toggle"
|
|
132
|
+
className="size-4 flex items-center justify-center text-muted shrink-0"
|
|
133
|
+
>
|
|
134
|
+
<SidebarChevron expanded={expanded} closed={variant === "section" ? "left" : "right"} />
|
|
135
|
+
</span>
|
|
136
|
+
);
|
|
137
|
+
const labelId = React.useId();
|
|
138
|
+
const trailingId = React.useId();
|
|
139
|
+
const end = renders(trailing) && (
|
|
140
|
+
<SidebarTrailing id={trailingId} className="ml-auto">
|
|
141
|
+
{trailing}
|
|
142
|
+
</SidebarTrailing>
|
|
143
|
+
);
|
|
144
|
+
|
|
145
|
+
return (
|
|
146
|
+
<button
|
|
147
|
+
type="button"
|
|
148
|
+
data-slot="sidebar-group-trigger"
|
|
149
|
+
data-variant={variant}
|
|
150
|
+
className={cn(
|
|
151
|
+
"flex items-center gap-1 rounded-control cursor-pointer border-0 bg-transparent w-full text-left",
|
|
152
|
+
variant === "section"
|
|
153
|
+
? "text-xs font-medium text-muted uppercase tracking-[0.5px] px-1.5 pt-3.5 pb-1 transition-[color] duration-100 hover:text-foreground"
|
|
154
|
+
: "px-0.5 h-(--height-md) text-sm text-foreground font-medium transition-[background] duration-100 hover:bg-hover",
|
|
155
|
+
className,
|
|
156
|
+
)}
|
|
157
|
+
aria-expanded={expanded}
|
|
158
|
+
// Named by its label alone: the trailing content describes it.
|
|
159
|
+
aria-labelledby={end ? labelId : undefined}
|
|
160
|
+
aria-describedby={end ? trailingId : undefined}
|
|
161
|
+
onClick={() => onExpandedChange(!expanded)}
|
|
162
|
+
{...props}
|
|
163
|
+
>
|
|
164
|
+
{variant === "group" && chevron}
|
|
165
|
+
{teamDot && (
|
|
166
|
+
<span
|
|
167
|
+
data-slot="sidebar-team-dot"
|
|
168
|
+
className="size-2 rounded-full shrink-0"
|
|
169
|
+
style={{ background: teamDot }}
|
|
170
|
+
/>
|
|
171
|
+
)}
|
|
172
|
+
{variant === "section" ? (
|
|
173
|
+
<>
|
|
174
|
+
<span id={labelId} className="min-w-0 flex-1 truncate">
|
|
175
|
+
{children}
|
|
176
|
+
</span>
|
|
177
|
+
{end}
|
|
178
|
+
{chevron}
|
|
179
|
+
</>
|
|
180
|
+
) : (
|
|
181
|
+
<>
|
|
182
|
+
{end ? <span id={labelId}>{children}</span> : children}
|
|
183
|
+
{end}
|
|
184
|
+
</>
|
|
185
|
+
)}
|
|
186
|
+
</button>
|
|
187
|
+
);
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
// --- SidebarCollapse ---
|
|
191
|
+
|
|
192
|
+
interface SidebarCollapseProps extends React.ComponentProps<"div"> {
|
|
193
|
+
open: boolean;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
/** Content that opens and closes with a short height animation (the grid-rows trick), staying mounted.
|
|
197
|
+
* Closed, it is `inert` and `aria-hidden` (out of the tab order and the accessibility tree, as if
|
|
198
|
+
* unmounted) and, once the animation ends, `invisible`; opening shows it at once. */
|
|
199
|
+
function SidebarCollapse({ open, className, children, ...props }: SidebarCollapseProps) {
|
|
200
|
+
return (
|
|
201
|
+
<div
|
|
202
|
+
data-slot="sidebar-collapse"
|
|
203
|
+
data-state={open ? "open" : "closed"}
|
|
204
|
+
inert={!open}
|
|
205
|
+
aria-hidden={open ? undefined : true}
|
|
206
|
+
className={cn(
|
|
207
|
+
"grid duration-150 ease-out motion-reduce:transition-none",
|
|
208
|
+
// `visibility` is transitioned only when closing: it flips at the end, after the height. Open,
|
|
209
|
+
// it is inherited, never set: an open collapse inside a closed one stays hidden.
|
|
210
|
+
open
|
|
211
|
+
? "grid-rows-[1fr] opacity-100 transition-[grid-template-rows,opacity]"
|
|
212
|
+
: "invisible grid-rows-[0fr] opacity-0 transition-[grid-template-rows,opacity,visibility]",
|
|
213
|
+
className,
|
|
214
|
+
)}
|
|
215
|
+
{...props}
|
|
216
|
+
>
|
|
217
|
+
<div className="min-h-0 overflow-hidden">{children}</div>
|
|
218
|
+
</div>
|
|
219
|
+
);
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
// --- SidebarGroupContent ---
|
|
223
|
+
|
|
224
|
+
interface SidebarGroupContentProps extends React.ComponentProps<"div"> {}
|
|
225
|
+
|
|
226
|
+
function SidebarGroupContent({ className, ...props }: SidebarGroupContentProps) {
|
|
227
|
+
const { expanded } = useSidebarGroup();
|
|
228
|
+
|
|
229
|
+
return (
|
|
230
|
+
<SidebarCollapse open={expanded}>
|
|
231
|
+
<div
|
|
232
|
+
data-slot="sidebar-group-content"
|
|
233
|
+
className={cn("flex flex-col gap-[1px]", className)}
|
|
234
|
+
{...props}
|
|
235
|
+
/>
|
|
236
|
+
</SidebarCollapse>
|
|
237
|
+
);
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
export {
|
|
241
|
+
SidebarGroup,
|
|
242
|
+
SidebarGroupTrigger,
|
|
243
|
+
SidebarGroupContent,
|
|
244
|
+
SidebarCollapse,
|
|
245
|
+
SidebarChevron,
|
|
246
|
+
SidebarTrailing,
|
|
247
|
+
renders,
|
|
248
|
+
};
|
|
249
|
+
export type {
|
|
250
|
+
SidebarGroupProps,
|
|
251
|
+
SidebarGroupTriggerProps,
|
|
252
|
+
SidebarGroupContentProps,
|
|
253
|
+
SidebarCollapseProps,
|
|
254
|
+
};
|