@bridgebrew/ui 0.0.0-stage → 0.1.9
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,256 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
|
|
3
|
+
import { cn } from "../../../lib/utils";
|
|
4
|
+
import { Button } from "../../core/button/button";
|
|
5
|
+
import {
|
|
6
|
+
Dialog,
|
|
7
|
+
DialogBody,
|
|
8
|
+
DialogContent,
|
|
9
|
+
DialogDescription,
|
|
10
|
+
DialogFooter,
|
|
11
|
+
DialogHeader,
|
|
12
|
+
DialogTitle,
|
|
13
|
+
} from "../../core/dialog/dialog";
|
|
14
|
+
import { Icon } from "../../core/icon/icon";
|
|
15
|
+
import { ScrollArea } from "../../core/scroll-area";
|
|
16
|
+
|
|
17
|
+
// A dialog in steps (Bridge addition): one step shown at a time, chosen by id. A step goes on by a choice in it
|
|
18
|
+
// (`go(id)`, a source picked from a list) or by its primary button (`onSubmit`, Enter in its form), which answers the
|
|
19
|
+
// next step's id or nothing to finish, and closes. "Back" returns along the steps taken. While a submit runs the
|
|
20
|
+
// primary button says so and nothing closes the wizard; a submit that throws keeps its step, its message shown above
|
|
21
|
+
// the buttons (`useWizard().error` lets the step offer the fix). Each step's first field takes the focus. A dialog: no
|
|
22
|
+
// navigation entry. It keeps one height whatever its step (a modal never changes height, bridge#283): a short step
|
|
23
|
+
// leaves room under its content, a long one scrolls in its body, the buttons stay at the bottom; the dialog's own
|
|
24
|
+
// `max-h-[80vh]` still caps it on a small window.
|
|
25
|
+
|
|
26
|
+
interface WizardContextValue {
|
|
27
|
+
/** The step shown. */
|
|
28
|
+
step: string;
|
|
29
|
+
/** Shows step `id`, after this one (Back returns here). */
|
|
30
|
+
go: (id: string) => void;
|
|
31
|
+
/** Returns to the step before, if any. */
|
|
32
|
+
back: () => void;
|
|
33
|
+
/** A step was taken before this one. */
|
|
34
|
+
canGoBack: boolean;
|
|
35
|
+
/** Closes the wizard. */
|
|
36
|
+
close: () => void;
|
|
37
|
+
/** A submit runs. */
|
|
38
|
+
busy: boolean;
|
|
39
|
+
/** The last submit's failure on this step. */
|
|
40
|
+
error: string | undefined;
|
|
41
|
+
/** Clears the step's failure (its fix was taken). */
|
|
42
|
+
clearError: () => void;
|
|
43
|
+
/** Runs `task` as the step's submit: busy meanwhile, its failure kept as `error`; answers its result. */
|
|
44
|
+
run: <T>(task: () => Promise<T>) => Promise<T | undefined>;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
const WizardContext = React.createContext<WizardContextValue | null>(null);
|
|
48
|
+
|
|
49
|
+
/** The wizard around: its step, `go`, `back`, `close`, `busy`, `error`, `run`. */
|
|
50
|
+
function useWizard() {
|
|
51
|
+
const context = React.useContext(WizardContext);
|
|
52
|
+
if (!context) throw new Error("useWizard is used inside a Wizard");
|
|
53
|
+
return context;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
// --- Wizard ---
|
|
57
|
+
|
|
58
|
+
interface WizardProps {
|
|
59
|
+
open: boolean;
|
|
60
|
+
onOpenChange: (open: boolean) => void;
|
|
61
|
+
/** The first step's id. */
|
|
62
|
+
initial: string;
|
|
63
|
+
/** Its steps (`WizardStep`), one shown at a time. */
|
|
64
|
+
children: React.ReactNode;
|
|
65
|
+
className?: string;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
function Wizard({ open, onOpenChange, initial, children, className }: WizardProps) {
|
|
69
|
+
const [path, setPath] = React.useState([initial]);
|
|
70
|
+
const [busy, setBusy] = React.useState(false);
|
|
71
|
+
const [error, setError] = React.useState<string>();
|
|
72
|
+
// Opened again: from the first step, with no failure.
|
|
73
|
+
React.useEffect(() => {
|
|
74
|
+
if (!open) return;
|
|
75
|
+
setPath([initial]);
|
|
76
|
+
setError(undefined);
|
|
77
|
+
}, [open, initial]);
|
|
78
|
+
const step = path.at(-1)!;
|
|
79
|
+
const busyRef = React.useRef(false);
|
|
80
|
+
const value = React.useMemo<WizardContextValue>(
|
|
81
|
+
() => ({
|
|
82
|
+
step,
|
|
83
|
+
go: (id) => {
|
|
84
|
+
setError(undefined);
|
|
85
|
+
setPath((now) => [...now, id]);
|
|
86
|
+
},
|
|
87
|
+
back: () => {
|
|
88
|
+
if (busyRef.current) return;
|
|
89
|
+
setError(undefined);
|
|
90
|
+
setPath((now) => (now.length > 1 ? now.slice(0, -1) : now));
|
|
91
|
+
},
|
|
92
|
+
canGoBack: path.length > 1,
|
|
93
|
+
close: () => onOpenChange(false),
|
|
94
|
+
busy,
|
|
95
|
+
error,
|
|
96
|
+
clearError: () => setError(undefined),
|
|
97
|
+
run: async (task) => {
|
|
98
|
+
busyRef.current = true;
|
|
99
|
+
setBusy(true);
|
|
100
|
+
setError(undefined);
|
|
101
|
+
try {
|
|
102
|
+
return await task();
|
|
103
|
+
} catch (cause) {
|
|
104
|
+
setError(cause instanceof Error ? cause.message : String(cause));
|
|
105
|
+
return undefined;
|
|
106
|
+
} finally {
|
|
107
|
+
busyRef.current = false;
|
|
108
|
+
setBusy(false);
|
|
109
|
+
}
|
|
110
|
+
},
|
|
111
|
+
}),
|
|
112
|
+
[step, path.length, busy, error, onOpenChange],
|
|
113
|
+
);
|
|
114
|
+
return (
|
|
115
|
+
<Dialog
|
|
116
|
+
open={open}
|
|
117
|
+
onOpenChange={(next) => {
|
|
118
|
+
// A submit running: Escape and the backdrop wait for it.
|
|
119
|
+
if (!next && busyRef.current) return;
|
|
120
|
+
onOpenChange(next);
|
|
121
|
+
}}
|
|
122
|
+
>
|
|
123
|
+
<DialogContent
|
|
124
|
+
data-slot="wizard"
|
|
125
|
+
data-step={step}
|
|
126
|
+
className={cn("h-[560px] w-[520px]", className)}
|
|
127
|
+
>
|
|
128
|
+
<WizardContext.Provider value={value}>{children}</WizardContext.Provider>
|
|
129
|
+
</DialogContent>
|
|
130
|
+
</Dialog>
|
|
131
|
+
);
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
// --- WizardStep ---
|
|
135
|
+
|
|
136
|
+
interface WizardStepProps {
|
|
137
|
+
id: string;
|
|
138
|
+
title: React.ReactNode;
|
|
139
|
+
description?: React.ReactNode;
|
|
140
|
+
/** Its place in a linear flow, `[n, total]`: "n / total" beside the title. */
|
|
141
|
+
position?: [number, number];
|
|
142
|
+
/** The primary button's words ("Next", "Create"); none: the step goes on by a choice in it (`go`). */
|
|
143
|
+
submitLabel?: string;
|
|
144
|
+
/** What the primary button says while the submit runs ("Creating…"); `submitLabel` by default. */
|
|
145
|
+
busyLabel?: string;
|
|
146
|
+
/** The primary button is enabled: the step's fields are complete. */
|
|
147
|
+
canSubmit?: boolean;
|
|
148
|
+
/** The primary button (or Enter): answers the next step's id, or nothing to close the wizard. A throw keeps the
|
|
149
|
+
* step, its message shown. */
|
|
150
|
+
onSubmit?: () => Promise<string | void> | string | void;
|
|
151
|
+
children?: React.ReactNode;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
function WizardStep({
|
|
155
|
+
id,
|
|
156
|
+
title,
|
|
157
|
+
description,
|
|
158
|
+
position,
|
|
159
|
+
submitLabel,
|
|
160
|
+
busyLabel,
|
|
161
|
+
canSubmit = true,
|
|
162
|
+
onSubmit,
|
|
163
|
+
children,
|
|
164
|
+
}: WizardStepProps) {
|
|
165
|
+
const wizard = useWizard();
|
|
166
|
+
const body = React.useRef<HTMLDivElement>(null);
|
|
167
|
+
const shown = wizard.step === id;
|
|
168
|
+
// Its first field (or option) takes the focus when it is shown.
|
|
169
|
+
React.useEffect(() => {
|
|
170
|
+
if (!shown) return;
|
|
171
|
+
const first = body.current?.querySelector<HTMLElement>(
|
|
172
|
+
"[autofocus], input:not([type=hidden]):not(:disabled), textarea, select, [role=listbox], [role=option], button:not(:disabled)",
|
|
173
|
+
);
|
|
174
|
+
first?.focus();
|
|
175
|
+
}, [shown]);
|
|
176
|
+
if (!shown) return null;
|
|
177
|
+
const submit = async () => {
|
|
178
|
+
if (!onSubmit || !canSubmit || wizard.busy) return;
|
|
179
|
+
const ok = Symbol("ok");
|
|
180
|
+
const next = await wizard.run(async () => (await onSubmit()) ?? ok);
|
|
181
|
+
if (next === undefined) return;
|
|
182
|
+
if (next === ok) wizard.close();
|
|
183
|
+
else wizard.go(next as string);
|
|
184
|
+
};
|
|
185
|
+
return (
|
|
186
|
+
<form
|
|
187
|
+
data-slot="wizard-step"
|
|
188
|
+
className="flex min-h-0 flex-1 flex-col"
|
|
189
|
+
onSubmit={(event) => {
|
|
190
|
+
event.preventDefault();
|
|
191
|
+
void submit();
|
|
192
|
+
}}
|
|
193
|
+
>
|
|
194
|
+
<DialogHeader className="pl-2">
|
|
195
|
+
<WizardBack />
|
|
196
|
+
<DialogTitle className="flex items-center gap-2 py-1">
|
|
197
|
+
{title}
|
|
198
|
+
{position && (
|
|
199
|
+
<span data-slot="wizard-position" className="text-xs font-normal text-muted">
|
|
200
|
+
{position[0]} / {position[1]}
|
|
201
|
+
</span>
|
|
202
|
+
)}
|
|
203
|
+
</DialogTitle>
|
|
204
|
+
</DialogHeader>
|
|
205
|
+
{/* Its contents never shrink: a list that scrolls on its own would collapse in a capped dialog (bridge#283), so
|
|
206
|
+
the body scrolls instead, in the kit's ScrollArea (Bridge's scrollbar, not the OS's). */}
|
|
207
|
+
<ScrollArea className="flex min-h-0 flex-1 flex-col" viewportClassName="min-h-0 flex-1">
|
|
208
|
+
<DialogBody ref={body} className="flex flex-col gap-3 pb-4 [&>*]:shrink-0">
|
|
209
|
+
{description && <DialogDescription>{description}</DialogDescription>}
|
|
210
|
+
{children}
|
|
211
|
+
{wizard.error && (
|
|
212
|
+
<p role="alert" data-slot="wizard-error" className="text-sm text-destructive">
|
|
213
|
+
{wizard.error}
|
|
214
|
+
</p>
|
|
215
|
+
)}
|
|
216
|
+
</DialogBody>
|
|
217
|
+
</ScrollArea>
|
|
218
|
+
<DialogFooter className="justify-end gap-2">
|
|
219
|
+
<Button type="button" disabled={wizard.busy} onClick={wizard.close}>
|
|
220
|
+
Cancel
|
|
221
|
+
</Button>
|
|
222
|
+
{submitLabel && (
|
|
223
|
+
<Button
|
|
224
|
+
type="submit"
|
|
225
|
+
variant="primary"
|
|
226
|
+
disabled={!canSubmit || wizard.busy}
|
|
227
|
+
aria-busy={wizard.busy || undefined}
|
|
228
|
+
>
|
|
229
|
+
{wizard.busy ? (busyLabel ?? submitLabel) : submitLabel}
|
|
230
|
+
</Button>
|
|
231
|
+
)}
|
|
232
|
+
</DialogFooter>
|
|
233
|
+
</form>
|
|
234
|
+
);
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
/** "Back", before the title, when a step was taken before this one. */
|
|
238
|
+
function WizardBack() {
|
|
239
|
+
const wizard = useWizard();
|
|
240
|
+
if (!wizard.canGoBack) return null;
|
|
241
|
+
return (
|
|
242
|
+
<Button
|
|
243
|
+
type="button"
|
|
244
|
+
variant="ghost"
|
|
245
|
+
size="icon-sm"
|
|
246
|
+
aria-label="Back"
|
|
247
|
+
disabled={wizard.busy}
|
|
248
|
+
onClick={wizard.back}
|
|
249
|
+
>
|
|
250
|
+
<Icon name="chevron-left" />
|
|
251
|
+
</Button>
|
|
252
|
+
);
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
export { Wizard, WizardStep, useWizard };
|
|
256
|
+
export type { WizardProps, WizardStepProps };
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
name: Avatar
|
|
2
|
+
description: "Displays initials in a circle (a person) or a rounded square (an organization), neutral grey or tinted with a hue derived from the name. Includes a getInitials utility."
|
|
3
|
+
layer: core
|
|
4
|
+
category: data-display
|
|
5
|
+
when_to_use:
|
|
6
|
+
- "For displaying user identity in lists, comments, or profiles"
|
|
7
|
+
- "For team member indicators in sidebar or cards"
|
|
8
|
+
- "For compact user representation when no profile image is available"
|
|
9
|
+
when_not_to_use:
|
|
10
|
+
- "For displaying full profile images — Avatar only renders initials"
|
|
11
|
+
- "For status indicators — use StatusIcon instead"
|
|
12
|
+
- "For generic icons or logos — use an icon component"
|
|
13
|
+
composition_partners:
|
|
14
|
+
- Tooltip (wrap to reveal the full name on hover/focus)
|
|
15
|
+
- SidebarItem (as icon slot)
|
|
16
|
+
- Table (in user columns)
|
|
17
|
+
- Properties (as value display)
|
|
18
|
+
props:
|
|
19
|
+
- name: name
|
|
20
|
+
type: string
|
|
21
|
+
required: true
|
|
22
|
+
description: "Full name used to derive initials (e.g. 'Jane Doe' → 'JD')"
|
|
23
|
+
- name: size
|
|
24
|
+
type: "'xs' | 'sm' | 'default' | 'lg' | 'xl' | '2xl' | '3xl'"
|
|
25
|
+
required: false
|
|
26
|
+
default: "'default'"
|
|
27
|
+
description: "Avatar size; 2xl and 3xl are for headers (a detail card, a profile)"
|
|
28
|
+
- name: shape
|
|
29
|
+
type: "'circle' | 'square'"
|
|
30
|
+
required: false
|
|
31
|
+
default: "'circle'"
|
|
32
|
+
description: "circle for a person, square (rounded, radius scales with size) for an organization"
|
|
33
|
+
- name: tint
|
|
34
|
+
type: boolean
|
|
35
|
+
required: false
|
|
36
|
+
default: "false"
|
|
37
|
+
description: "Colour the avatar with a calm hue derived from the name (same name, same hue), mixed into --bg-surface and --fg so it fits light and dark themes. A style prop overrides it."
|
|
38
|
+
- name: aria-label
|
|
39
|
+
type: string
|
|
40
|
+
required: false
|
|
41
|
+
description: "Accessible label, defaults to the name prop value"
|
|
42
|
+
props_priority:
|
|
43
|
+
- name
|
|
44
|
+
- size
|
|
45
|
+
- shape
|
|
46
|
+
- tint
|
|
47
|
+
sizes:
|
|
48
|
+
- xs: "16px (size-4), text-[7px]"
|
|
49
|
+
- sm: "18px (size-[18px]), text-[8px]"
|
|
50
|
+
- default: "20px (size-5), text-[9px]"
|
|
51
|
+
- lg: "24px (size-6), text-[10px]"
|
|
52
|
+
- xl: "28px (size-7), text-[11px]"
|
|
53
|
+
- 2xl: "40px (size-10), text-[15px]"
|
|
54
|
+
- 3xl: "64px (size-16), text-[24px]"
|
|
55
|
+
examples:
|
|
56
|
+
- title: "Basic avatar"
|
|
57
|
+
code: '<Avatar name="Jane Doe" />'
|
|
58
|
+
- title: "Small avatar for lists"
|
|
59
|
+
code: '<Avatar name="John Smith" size="sm" />'
|
|
60
|
+
- title: "Large avatar in profile"
|
|
61
|
+
code: '<Avatar name="Alice Wonderland" size="xl" />'
|
|
62
|
+
- title: "Detail card header, tinted"
|
|
63
|
+
code: '<Avatar name="Alice Wonderland" size="3xl" tint />'
|
|
64
|
+
- title: "An organization in a list row"
|
|
65
|
+
code: '<Avatar name="Acme Corp" shape="square" size="xl" tint />'
|
|
66
|
+
anti_patterns:
|
|
67
|
+
- "Don't pass single-character strings — the component expects full names for proper initials extraction"
|
|
68
|
+
- "Don't set width/height via className — use the size prop"
|
|
69
|
+
- "Don't use for image avatars — this component only renders text initials"
|
|
70
|
+
- "Don't render a bare Avatar in lists, tables, or rows — initials alone (e.g. 'JD') are ambiguous. Wrap it in a Tooltip exposing the full name. This applies to every 'lossy' element that compresses meaning into a glyph (Avatar initials, icon-only Button, truncated Label)."
|
|
71
|
+
accessibility_notes: "Renders as a <span> with role implied by context. Initials are lossy, so always make the full name recoverable: wrap the Avatar in a Tooltip (visual users) AND set aria-label to the full name (screen reader users). The aria-label defaults to the name prop, but a Tooltip is still required for sighted users who only see the initials."
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { cva, type VariantProps } from "class-variance-authority";
|
|
3
|
+
|
|
4
|
+
import { cn } from "../../../lib/utils";
|
|
5
|
+
|
|
6
|
+
type AvatarSize = "xs" | "sm" | "default" | "lg" | "xl" | "2xl" | "3xl";
|
|
7
|
+
|
|
8
|
+
const avatarVariants = cva(
|
|
9
|
+
"inline-flex items-center justify-center shrink-0 bg-active text-secondary font-semibold select-none",
|
|
10
|
+
{
|
|
11
|
+
variants: {
|
|
12
|
+
size: {
|
|
13
|
+
xs: "size-4 text-[7px]",
|
|
14
|
+
sm: "size-[18px] text-[8px]",
|
|
15
|
+
default: "size-5 text-[9px]",
|
|
16
|
+
lg: "size-6 text-[10px]",
|
|
17
|
+
xl: "size-7 text-[11px]",
|
|
18
|
+
// Bridge: header sizes (a detail card), initials at ~0.38 of the side like the small ones.
|
|
19
|
+
"2xl": "size-10 text-[15px]",
|
|
20
|
+
"3xl": "size-16 text-[24px]",
|
|
21
|
+
},
|
|
22
|
+
shape: {
|
|
23
|
+
circle: "rounded-full",
|
|
24
|
+
// A rounded square (an organization); the radius scales with the size.
|
|
25
|
+
square: "rounded-[22%]",
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
defaultVariants: {
|
|
29
|
+
size: "default",
|
|
30
|
+
shape: "circle",
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
);
|
|
34
|
+
|
|
35
|
+
// Bridge: a calm hue picked from the name (same name, same hue), mixed into the theme's surface and text so it
|
|
36
|
+
// reads in light and dark themes alike.
|
|
37
|
+
function avatarTint(name: string): React.CSSProperties {
|
|
38
|
+
let hash = 0;
|
|
39
|
+
for (const ch of name.trim()) hash = (hash * 31 + ch.codePointAt(0)!) >>> 0;
|
|
40
|
+
const hue = `oklch(62% 0.13 ${(hash % 12) * 30})`;
|
|
41
|
+
return {
|
|
42
|
+
backgroundColor: `color-mix(in oklab, ${hue} 22%, var(--bg-surface))`,
|
|
43
|
+
color: `color-mix(in oklab, ${hue} 75%, var(--fg))`,
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
// Bridge: by code point, not UTF-16 unit, so an emoji is never split in half.
|
|
48
|
+
function getInitials(name: string): string {
|
|
49
|
+
const parts = name.trim().split(/\s+/);
|
|
50
|
+
const first = parts[0];
|
|
51
|
+
if (!first) return "";
|
|
52
|
+
const initial = (word: string) => Array.from(word)[0] ?? "";
|
|
53
|
+
const last = parts[parts.length - 1];
|
|
54
|
+
if (parts.length === 1 || !last) return initial(first).toUpperCase();
|
|
55
|
+
return (initial(first) + initial(last)).toUpperCase();
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
interface AvatarProps
|
|
59
|
+
extends Omit<React.ComponentProps<"span">, "children">, VariantProps<typeof avatarVariants> {
|
|
60
|
+
name: string;
|
|
61
|
+
/** Colour the avatar with a hue derived from the name (deterministic) instead of the neutral grey. */
|
|
62
|
+
tint?: boolean;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
function Avatar({
|
|
66
|
+
className,
|
|
67
|
+
name,
|
|
68
|
+
size,
|
|
69
|
+
shape,
|
|
70
|
+
tint,
|
|
71
|
+
style,
|
|
72
|
+
"aria-label": ariaLabel,
|
|
73
|
+
...props
|
|
74
|
+
}: AvatarProps) {
|
|
75
|
+
const label = ariaLabel ?? name;
|
|
76
|
+
const hasLabel = label.trim().length > 0;
|
|
77
|
+
return (
|
|
78
|
+
<span
|
|
79
|
+
role={hasLabel ? "img" : "presentation"}
|
|
80
|
+
aria-label={hasLabel ? label : undefined}
|
|
81
|
+
data-slot="avatar"
|
|
82
|
+
className={cn(avatarVariants({ size, shape, className }))}
|
|
83
|
+
style={tint ? { ...avatarTint(name), ...style } : style}
|
|
84
|
+
{...props}
|
|
85
|
+
>
|
|
86
|
+
{getInitials(name)}
|
|
87
|
+
</span>
|
|
88
|
+
);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
export { Avatar, avatarVariants, getInitials };
|
|
92
|
+
export type { AvatarProps, AvatarSize };
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
name: Badge
|
|
2
|
+
description: "Small numeric pill with muted styling for displaying counts and quantities."
|
|
3
|
+
layer: core
|
|
4
|
+
category: data-display
|
|
5
|
+
when_to_use:
|
|
6
|
+
- "For displaying numeric counts next to labels (e.g. unread messages, issue counts)"
|
|
7
|
+
- "For compact quantity indicators in sidebar items or tabs"
|
|
8
|
+
when_not_to_use:
|
|
9
|
+
- "For status tags with semantic colors — use Label component"
|
|
10
|
+
- "For text badges or tags — Badge is designed for numbers only"
|
|
11
|
+
- "For interactive elements — Badge is display-only"
|
|
12
|
+
composition_partners:
|
|
13
|
+
- SidebarItem (as count display)
|
|
14
|
+
- TabsTrigger (as count display)
|
|
15
|
+
props:
|
|
16
|
+
- name: children
|
|
17
|
+
type: React.ReactNode
|
|
18
|
+
required: false
|
|
19
|
+
description: "Badge content, typically a number"
|
|
20
|
+
props_priority:
|
|
21
|
+
- children
|
|
22
|
+
examples:
|
|
23
|
+
- title: "Count badge"
|
|
24
|
+
code: "<Badge>12</Badge>"
|
|
25
|
+
- title: "Badge in sidebar item"
|
|
26
|
+
code: |
|
|
27
|
+
<SidebarItem icon={<InboxIcon />} count={5}>
|
|
28
|
+
Inbox
|
|
29
|
+
</SidebarItem>
|
|
30
|
+
anti_patterns:
|
|
31
|
+
- "Don't use for long text content — Badge is designed for short numeric values"
|
|
32
|
+
- "Don't add click handlers — Badge is a display-only component"
|
|
33
|
+
- "Don't override height or padding — the pill shape is fixed at h-[18px] px-1.5"
|
|
34
|
+
accessibility_notes: "Renders as a <span>. Content is visible to screen readers. For meaningful context, ensure the parent element provides labeling (e.g. 'Inbox 5 unread')."
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { cva, type VariantProps } from "class-variance-authority";
|
|
3
|
+
|
|
4
|
+
import { cn } from "../../../lib/utils";
|
|
5
|
+
|
|
6
|
+
// Optical centring (Bridge): 1px bottom padding lifts the 12px label to the pill's centre; an icon
|
|
7
|
+
// inside keeps the pill's centre (-1px bottom margin).
|
|
8
|
+
const badgeVariants = cva(
|
|
9
|
+
"pb-px [&_svg]:-mb-px inline-flex items-center justify-center h-[18px] min-w-[18px] px-1.5 text-xs font-medium tabular-nums rounded-full bg-badge text-muted select-none",
|
|
10
|
+
);
|
|
11
|
+
|
|
12
|
+
interface BadgeProps extends React.ComponentProps<"span">, VariantProps<typeof badgeVariants> {}
|
|
13
|
+
|
|
14
|
+
function Badge({ className, children, ...props }: BadgeProps) {
|
|
15
|
+
return (
|
|
16
|
+
<span data-slot="badge" className={cn(badgeVariants({ className }))} {...props}>
|
|
17
|
+
{children}
|
|
18
|
+
</span>
|
|
19
|
+
);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export { Badge, badgeVariants };
|
|
23
|
+
export type { BadgeProps };
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
name: Breadcrumb
|
|
2
|
+
description: "Navigation path display with separator characters. Last item is highlighted as current page."
|
|
3
|
+
layer: core
|
|
4
|
+
category: navigation
|
|
5
|
+
when_to_use:
|
|
6
|
+
- "For showing the current location within a hierarchy"
|
|
7
|
+
- "For page headers in content areas"
|
|
8
|
+
- "For navigable path displays with clickable parent links"
|
|
9
|
+
when_not_to_use:
|
|
10
|
+
- "For primary navigation — use Sidebar"
|
|
11
|
+
- "For tab-style navigation — use Tabs"
|
|
12
|
+
- "For step indicators or wizards — use Wizard"
|
|
13
|
+
composition_partners:
|
|
14
|
+
- AppShell (in main content header area)
|
|
15
|
+
props:
|
|
16
|
+
- name: items
|
|
17
|
+
type: "BreadcrumbItem[]"
|
|
18
|
+
required: true
|
|
19
|
+
description: "Ordered array of breadcrumb segments ({ label, to?, href?, onClick? }). Last item is always rendered as current page; an earlier one is a ScreenLink with `to` (Bridge's click rule, research-048), a link with `href`, a button with `onClick(event)`, else plain text."
|
|
20
|
+
props_priority:
|
|
21
|
+
- items
|
|
22
|
+
examples:
|
|
23
|
+
- title: "Basic breadcrumb"
|
|
24
|
+
code: |
|
|
25
|
+
<Breadcrumb
|
|
26
|
+
items={[
|
|
27
|
+
{ label: "Home", href: "/" },
|
|
28
|
+
{ label: "Projects", href: "/projects" },
|
|
29
|
+
{ label: "Bridge" },
|
|
30
|
+
]}
|
|
31
|
+
/>
|
|
32
|
+
- title: "Breadcrumb without links"
|
|
33
|
+
code: |
|
|
34
|
+
<Breadcrumb
|
|
35
|
+
items={[
|
|
36
|
+
{ label: "Settings" },
|
|
37
|
+
{ label: "Profile" },
|
|
38
|
+
]}
|
|
39
|
+
/>
|
|
40
|
+
anti_patterns:
|
|
41
|
+
- "Don't pass an empty items array — Breadcrumb needs at least one item"
|
|
42
|
+
- "Don't add href to the last item — it's always rendered as the current page (not a link)"
|
|
43
|
+
- "Don't override the separator character — the › separator is a design system constant"
|
|
44
|
+
accessibility_notes: "Renders as <nav aria-label='Breadcrumb'>. Last item has aria-current='page'. Links are standard <a> elements. Non-link items are <span> elements. Separator is aria-hidden."
|
|
45
|
+
notes: "BreadcrumbItem type: { label: string, href?: string }. Items with href render as links (except the last item which always renders as current page text)."
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { cva, type VariantProps } from "class-variance-authority";
|
|
3
|
+
|
|
4
|
+
import { cn } from "../../../lib/utils";
|
|
5
|
+
import { ScreenLink, type FollowTarget } from "../screen-link/screen-link";
|
|
6
|
+
|
|
7
|
+
// --- Breadcrumb ---
|
|
8
|
+
|
|
9
|
+
const breadcrumbVariants = cva("flex items-center gap-1.5 text-sm text-secondary");
|
|
10
|
+
|
|
11
|
+
interface BreadcrumbItem {
|
|
12
|
+
/** Display text for the breadcrumb segment */
|
|
13
|
+
label: string;
|
|
14
|
+
/** Optional URL — renders as <a> link when provided on non-terminal items */
|
|
15
|
+
href?: string;
|
|
16
|
+
/** A screen of the workspace (research-048): a `ScreenLink` on non-terminal items, before `href` */
|
|
17
|
+
to?: FollowTarget;
|
|
18
|
+
/** Optional action — renders a <button> on non-terminal items without `href` */
|
|
19
|
+
onClick?: (event: React.MouseEvent<HTMLButtonElement>) => void;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
interface BreadcrumbProps
|
|
23
|
+
extends React.ComponentProps<"nav">, VariantProps<typeof breadcrumbVariants> {
|
|
24
|
+
/** Ordered breadcrumb segments — last item is always the current page */
|
|
25
|
+
items: BreadcrumbItem[];
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
function Breadcrumb({ className, items, ...props }: BreadcrumbProps) {
|
|
29
|
+
// An item's button usually becomes the current item once clicked (unmounted with its focus): the
|
|
30
|
+
// current item takes the focus then, so a keyboard user stays in the breadcrumb.
|
|
31
|
+
const current = React.useRef<HTMLSpanElement>(null);
|
|
32
|
+
const clicked = React.useRef(false);
|
|
33
|
+
React.useEffect(() => {
|
|
34
|
+
if (!clicked.current) return;
|
|
35
|
+
clicked.current = false;
|
|
36
|
+
current.current?.focus();
|
|
37
|
+
});
|
|
38
|
+
return (
|
|
39
|
+
<nav
|
|
40
|
+
data-slot="breadcrumb"
|
|
41
|
+
aria-label="Breadcrumb"
|
|
42
|
+
className={cn(breadcrumbVariants({ className }))}
|
|
43
|
+
{...props}
|
|
44
|
+
>
|
|
45
|
+
{items.map((item, index) => {
|
|
46
|
+
const isLast = index === items.length - 1;
|
|
47
|
+
return (
|
|
48
|
+
<React.Fragment key={index}>
|
|
49
|
+
{index > 0 && (
|
|
50
|
+
<span
|
|
51
|
+
data-slot="breadcrumb-separator"
|
|
52
|
+
className="text-muted text-xs"
|
|
53
|
+
aria-hidden="true"
|
|
54
|
+
>
|
|
55
|
+
›
|
|
56
|
+
</span>
|
|
57
|
+
)}
|
|
58
|
+
{isLast ? (
|
|
59
|
+
<span
|
|
60
|
+
ref={current}
|
|
61
|
+
data-slot="breadcrumb-item"
|
|
62
|
+
className="text-foreground font-medium outline-none"
|
|
63
|
+
aria-current="page"
|
|
64
|
+
tabIndex={-1}
|
|
65
|
+
>
|
|
66
|
+
{item.label}
|
|
67
|
+
</span>
|
|
68
|
+
) : item.to ? (
|
|
69
|
+
<ScreenLink
|
|
70
|
+
data-slot="breadcrumb-item"
|
|
71
|
+
to={item.to}
|
|
72
|
+
onClick={() => (clicked.current = true)}
|
|
73
|
+
className="text-secondary no-underline hover:no-underline hover:text-foreground transition-colors"
|
|
74
|
+
>
|
|
75
|
+
{item.label}
|
|
76
|
+
</ScreenLink>
|
|
77
|
+
) : item.href ? (
|
|
78
|
+
<a
|
|
79
|
+
data-slot="breadcrumb-item"
|
|
80
|
+
href={item.href}
|
|
81
|
+
className="text-secondary no-underline hover:text-foreground transition-colors"
|
|
82
|
+
>
|
|
83
|
+
{item.label}
|
|
84
|
+
</a>
|
|
85
|
+
) : item.onClick ? (
|
|
86
|
+
<button
|
|
87
|
+
type="button"
|
|
88
|
+
data-slot="breadcrumb-item"
|
|
89
|
+
onClick={(event) => {
|
|
90
|
+
clicked.current = true;
|
|
91
|
+
item.onClick!(event);
|
|
92
|
+
}}
|
|
93
|
+
className="text-secondary hover:text-foreground transition-colors cursor-pointer text-left"
|
|
94
|
+
>
|
|
95
|
+
{item.label}
|
|
96
|
+
</button>
|
|
97
|
+
) : (
|
|
98
|
+
<span data-slot="breadcrumb-item" className="text-secondary">
|
|
99
|
+
{item.label}
|
|
100
|
+
</span>
|
|
101
|
+
)}
|
|
102
|
+
</React.Fragment>
|
|
103
|
+
);
|
|
104
|
+
})}
|
|
105
|
+
</nav>
|
|
106
|
+
);
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
export { Breadcrumb, breadcrumbVariants };
|
|
110
|
+
export type { BreadcrumbProps, BreadcrumbItem };
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
name: Bullets
|
|
2
|
+
description: "Simple dots saying which of several items shows (a carousel, an image viewer); a click on one goes to it."
|
|
3
|
+
layer: core
|
|
4
|
+
category: navigation
|
|
5
|
+
when_to_use:
|
|
6
|
+
- "To say which item of a short series shows, and go to another: images of a viewer, steps of a carousel"
|
|
7
|
+
when_not_to_use:
|
|
8
|
+
- "For many items (past about ten) — use a counter or a list"
|
|
9
|
+
- "For steps that must be done in order — use Wizard"
|
|
10
|
+
props:
|
|
11
|
+
- name: count
|
|
12
|
+
type: number
|
|
13
|
+
required: true
|
|
14
|
+
description: "How many items there are; nothing renders for fewer than two"
|
|
15
|
+
- name: index
|
|
16
|
+
type: number
|
|
17
|
+
required: true
|
|
18
|
+
description: "The item shown, from 0"
|
|
19
|
+
- name: onSelect
|
|
20
|
+
type: "(index: number) => void"
|
|
21
|
+
required: false
|
|
22
|
+
description: "Goes to an item; without it the bullets are indicators only"
|
|
23
|
+
- name: labelOf
|
|
24
|
+
type: "(index: number) => string"
|
|
25
|
+
required: false
|
|
26
|
+
default: '"Item 2 of 5"'
|
|
27
|
+
description: "Each bullet's accessible name"
|
|
28
|
+
props_priority:
|
|
29
|
+
- count
|
|
30
|
+
- index
|
|
31
|
+
- onSelect
|
|
32
|
+
examples:
|
|
33
|
+
- title: "Image viewer"
|
|
34
|
+
code: "<Bullets count={images.length} index={shown} onSelect={setShown} labelOf={(i) => images[i].name} />"
|
|
35
|
+
anti_patterns:
|
|
36
|
+
- "Don't put the bullets on a background pill — they stay small and quiet"
|
|
37
|
+
accessibility_notes: "A tablist of buttons, the shown one aria-selected; each has an accessible name (labelOf). No focus ring on a click; a keyboard focus darkens the bullet."
|