@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,868 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { ChevronRight, Plus, X } from "lucide-react";
|
|
3
|
+
import { cva, type VariantProps } from "class-variance-authority";
|
|
4
|
+
|
|
5
|
+
import { cn } from "../../../lib/utils";
|
|
6
|
+
import { Kbd } from "../../core/kbd";
|
|
7
|
+
import { Checkbox } from "../../core/checkbox";
|
|
8
|
+
import { gestureOf, useFollow } from "../../core/screen-link/screen-link";
|
|
9
|
+
import { isComposing } from "../../../lib/keys";
|
|
10
|
+
import { useSwipe, type SwipeAction } from "./list-swipe";
|
|
11
|
+
|
|
12
|
+
// --- ListContext ---
|
|
13
|
+
|
|
14
|
+
type ListVariant = "default" | "records";
|
|
15
|
+
|
|
16
|
+
interface ListContextValue {
|
|
17
|
+
selectionMode: "single" | "multiple" | "none";
|
|
18
|
+
selectedKeys: Set<string>;
|
|
19
|
+
onSelect: (key: string) => void;
|
|
20
|
+
variant: ListVariant;
|
|
21
|
+
openKey?: string | undefined;
|
|
22
|
+
onOpen?: ((key: string) => void) | undefined;
|
|
23
|
+
/** Records only: true when nothing is selected (the row checkboxes hide). */
|
|
24
|
+
selectionEmpty: boolean;
|
|
25
|
+
/** Records only: replace the whole selection (range, select-all, clear). */
|
|
26
|
+
setSelection: (keys: string[]) => void;
|
|
27
|
+
/** Records only: the row a shift-click range extends from. */
|
|
28
|
+
anchorRef: React.RefObject<string | null>;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
const ListContext = React.createContext<ListContextValue>({
|
|
32
|
+
selectionMode: "none",
|
|
33
|
+
selectedKeys: new Set(),
|
|
34
|
+
onSelect: () => {},
|
|
35
|
+
variant: "default",
|
|
36
|
+
openKey: undefined,
|
|
37
|
+
onOpen: undefined,
|
|
38
|
+
selectionEmpty: true,
|
|
39
|
+
setSelection: () => {},
|
|
40
|
+
anchorRef: { current: null },
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
// --- List ---
|
|
44
|
+
|
|
45
|
+
const listVariants = cva("flex flex-col outline-none");
|
|
46
|
+
|
|
47
|
+
interface ListProps
|
|
48
|
+
extends Omit<React.ComponentProps<"div">, "onSelect">, VariantProps<typeof listVariants> {
|
|
49
|
+
/** Selection behavior: "none" (default), "single", or "multiple" */
|
|
50
|
+
selectionMode?: "single" | "multiple" | "none";
|
|
51
|
+
/** Currently selected key (single selection mode) */
|
|
52
|
+
selectedKey?: string | undefined;
|
|
53
|
+
/** Currently selected keys (multiple selection mode) */
|
|
54
|
+
selectedKeys?: string[];
|
|
55
|
+
/** Called when selection changes */
|
|
56
|
+
onSelectionChange?: (keys: string[]) => void;
|
|
57
|
+
/** Single selection: moving with the arrow keys, Home, or End also selects (a master/detail list). */
|
|
58
|
+
selectionFollowsFocus?: boolean;
|
|
59
|
+
/** "records" is Linear's list: a cursor (focus), an open row, and a multiple selection kept apart. */
|
|
60
|
+
variant?: ListVariant;
|
|
61
|
+
/** Records: the key of the open row (marked with data-open). */
|
|
62
|
+
openKey?: string;
|
|
63
|
+
/** Records: called when a row is opened (a plain click or Enter on the cursor). */
|
|
64
|
+
onOpen?: (key: string) => void;
|
|
65
|
+
/** Records: moving the cursor (J/K, arrows) opens the row too, for a list with its card beside it. */
|
|
66
|
+
openFollowsCursor?: boolean;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
function List({
|
|
70
|
+
className,
|
|
71
|
+
selectionMode = "none",
|
|
72
|
+
selectedKey,
|
|
73
|
+
selectedKeys: selectedKeysProp,
|
|
74
|
+
onSelectionChange,
|
|
75
|
+
selectionFollowsFocus = false,
|
|
76
|
+
variant = "default",
|
|
77
|
+
openKey,
|
|
78
|
+
onOpen,
|
|
79
|
+
openFollowsCursor = false,
|
|
80
|
+
children,
|
|
81
|
+
onKeyDown,
|
|
82
|
+
...props
|
|
83
|
+
}: ListProps) {
|
|
84
|
+
const selectedKeys = React.useMemo(() => {
|
|
85
|
+
if (selectedKeysProp) return new Set(selectedKeysProp);
|
|
86
|
+
if (selectedKey) return new Set([selectedKey]);
|
|
87
|
+
return new Set<string>();
|
|
88
|
+
}, [selectedKey, selectedKeysProp]);
|
|
89
|
+
|
|
90
|
+
// In the records variant selection is always multiple, whatever selectionMode says.
|
|
91
|
+
const effectiveSelectionMode = variant === "records" ? "multiple" : selectionMode;
|
|
92
|
+
const anchorRef = React.useRef<string | null>(null);
|
|
93
|
+
|
|
94
|
+
const setSelection = React.useCallback(
|
|
95
|
+
(keys: string[]) => {
|
|
96
|
+
onSelectionChange?.(keys);
|
|
97
|
+
},
|
|
98
|
+
[onSelectionChange],
|
|
99
|
+
);
|
|
100
|
+
|
|
101
|
+
const onSelect = React.useCallback(
|
|
102
|
+
(key: string) => {
|
|
103
|
+
if (effectiveSelectionMode === "none") return;
|
|
104
|
+
if (effectiveSelectionMode === "single") {
|
|
105
|
+
onSelectionChange?.([key]);
|
|
106
|
+
} else {
|
|
107
|
+
const next = new Set(selectedKeys);
|
|
108
|
+
if (next.has(key)) next.delete(key);
|
|
109
|
+
else next.add(key);
|
|
110
|
+
onSelectionChange?.([...next]);
|
|
111
|
+
}
|
|
112
|
+
// Toggling a row by ⌘/Ctrl-click, X or its checkbox sets the range anchor.
|
|
113
|
+
if (variant === "records") anchorRef.current = key;
|
|
114
|
+
},
|
|
115
|
+
[effectiveSelectionMode, selectedKeys, onSelectionChange, variant],
|
|
116
|
+
);
|
|
117
|
+
|
|
118
|
+
const ctx = React.useMemo(
|
|
119
|
+
() => ({
|
|
120
|
+
selectionMode: effectiveSelectionMode,
|
|
121
|
+
selectedKeys,
|
|
122
|
+
onSelect,
|
|
123
|
+
variant,
|
|
124
|
+
openKey,
|
|
125
|
+
onOpen,
|
|
126
|
+
selectionEmpty: selectedKeys.size === 0,
|
|
127
|
+
setSelection,
|
|
128
|
+
anchorRef,
|
|
129
|
+
}),
|
|
130
|
+
[effectiveSelectionMode, selectedKeys, onSelect, variant, openKey, onOpen, setSelection],
|
|
131
|
+
);
|
|
132
|
+
|
|
133
|
+
const handleKeyDown = (e: React.KeyboardEvent<HTMLDivElement>) => {
|
|
134
|
+
// Records: a key typed in a field inside a row, one an IME is composing, or
|
|
135
|
+
// one a child already handled is the child's — the list never touches it.
|
|
136
|
+
if (variant === "records") {
|
|
137
|
+
const target = e.target as HTMLElement | null;
|
|
138
|
+
const editable =
|
|
139
|
+
!!target &&
|
|
140
|
+
(target.isContentEditable ||
|
|
141
|
+
target.tagName === "INPUT" ||
|
|
142
|
+
target.tagName === "TEXTAREA" ||
|
|
143
|
+
target.tagName === "SELECT" ||
|
|
144
|
+
!!target.closest?.('[contenteditable="true"]'));
|
|
145
|
+
if (e.defaultPrevented || isComposing(e) || editable) {
|
|
146
|
+
onKeyDown?.(e);
|
|
147
|
+
return;
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
const items = Array.from(
|
|
152
|
+
e.currentTarget.querySelectorAll<HTMLElement>(
|
|
153
|
+
'[data-slot="list-item"]:not([aria-disabled="true"])',
|
|
154
|
+
),
|
|
155
|
+
);
|
|
156
|
+
if (items.length === 0) return;
|
|
157
|
+
|
|
158
|
+
const currentIndex = items.indexOf(document.activeElement as HTMLElement);
|
|
159
|
+
|
|
160
|
+
// --- Records: focus is the cursor; j/k move it, Enter opens, x toggles ---
|
|
161
|
+
if (variant === "records") {
|
|
162
|
+
// A focused checkbox inside a row is that row's cursor.
|
|
163
|
+
const activeRow = (document.activeElement as HTMLElement | null)?.closest?.(
|
|
164
|
+
'[data-slot="list-item"]',
|
|
165
|
+
) as HTMLElement | null;
|
|
166
|
+
const cursorIndex = activeRow ? items.indexOf(activeRow) : -1;
|
|
167
|
+
|
|
168
|
+
const focusAt = (index: number) => {
|
|
169
|
+
const nextItem = items[index];
|
|
170
|
+
if (!nextItem || index === cursorIndex) return;
|
|
171
|
+
nextItem.focus();
|
|
172
|
+
const key = nextItem.getAttribute("data-value");
|
|
173
|
+
if (openFollowsCursor && key) onOpen?.(key);
|
|
174
|
+
};
|
|
175
|
+
const focusedKey =
|
|
176
|
+
cursorIndex >= 0
|
|
177
|
+
? (items[cursorIndex]?.getAttribute("data-value") ?? undefined)
|
|
178
|
+
: undefined;
|
|
179
|
+
|
|
180
|
+
// Modified keys are not the list's: only a plain key moves, opens,
|
|
181
|
+
// toggles or clears; Meta/Ctrl+A stays the select-all.
|
|
182
|
+
const noMods = !e.metaKey && !e.ctrlKey && !e.altKey;
|
|
183
|
+
const noModsNoShift = noMods && !e.shiftKey;
|
|
184
|
+
|
|
185
|
+
switch (true) {
|
|
186
|
+
case (e.key === "ArrowDown" || e.key === "j") && (e.key === "j" ? noModsNoShift : noMods):
|
|
187
|
+
e.preventDefault();
|
|
188
|
+
focusAt(cursorIndex < 0 ? 0 : Math.min(cursorIndex + 1, items.length - 1));
|
|
189
|
+
break;
|
|
190
|
+
case (e.key === "ArrowUp" || e.key === "k") && (e.key === "k" ? noModsNoShift : noMods):
|
|
191
|
+
e.preventDefault();
|
|
192
|
+
focusAt(cursorIndex < 0 ? items.length - 1 : Math.max(cursorIndex - 1, 0));
|
|
193
|
+
break;
|
|
194
|
+
case e.key === "Enter" && noModsNoShift:
|
|
195
|
+
if (focusedKey) {
|
|
196
|
+
onOpen?.(focusedKey);
|
|
197
|
+
e.preventDefault();
|
|
198
|
+
}
|
|
199
|
+
break;
|
|
200
|
+
case (e.key === "x" || e.key === "X") && noModsNoShift:
|
|
201
|
+
if (focusedKey) {
|
|
202
|
+
onSelect(focusedKey);
|
|
203
|
+
e.preventDefault();
|
|
204
|
+
}
|
|
205
|
+
break;
|
|
206
|
+
case (e.key === "a" || e.key === "A") && (e.metaKey || e.ctrlKey): {
|
|
207
|
+
const keys = items
|
|
208
|
+
.map((el) => el.getAttribute("data-value"))
|
|
209
|
+
.filter((key): key is string => !!key);
|
|
210
|
+
setSelection(keys);
|
|
211
|
+
e.preventDefault();
|
|
212
|
+
break;
|
|
213
|
+
}
|
|
214
|
+
case e.key === "Escape" && noMods:
|
|
215
|
+
if (selectedKeys.size > 0) {
|
|
216
|
+
setSelection([]);
|
|
217
|
+
e.preventDefault();
|
|
218
|
+
}
|
|
219
|
+
break;
|
|
220
|
+
default:
|
|
221
|
+
break;
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
onKeyDown?.(e);
|
|
225
|
+
return;
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
let nextIndex = currentIndex;
|
|
229
|
+
switch (e.key) {
|
|
230
|
+
case "ArrowDown":
|
|
231
|
+
nextIndex = currentIndex < 0 ? 0 : Math.min(currentIndex + 1, items.length - 1);
|
|
232
|
+
e.preventDefault();
|
|
233
|
+
break;
|
|
234
|
+
case "ArrowUp":
|
|
235
|
+
nextIndex = currentIndex < 0 ? items.length - 1 : Math.max(currentIndex - 1, 0);
|
|
236
|
+
e.preventDefault();
|
|
237
|
+
break;
|
|
238
|
+
case "Home":
|
|
239
|
+
nextIndex = 0;
|
|
240
|
+
e.preventDefault();
|
|
241
|
+
break;
|
|
242
|
+
case "End":
|
|
243
|
+
nextIndex = items.length - 1;
|
|
244
|
+
e.preventDefault();
|
|
245
|
+
break;
|
|
246
|
+
case "Enter":
|
|
247
|
+
case " ": {
|
|
248
|
+
if (currentIndex >= 0) {
|
|
249
|
+
const key = items[currentIndex]?.getAttribute("data-value");
|
|
250
|
+
if (key) onSelect(key);
|
|
251
|
+
e.preventDefault();
|
|
252
|
+
}
|
|
253
|
+
break;
|
|
254
|
+
}
|
|
255
|
+
default:
|
|
256
|
+
break;
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
const nextItem = items[nextIndex];
|
|
260
|
+
if (nextIndex !== currentIndex && nextItem) {
|
|
261
|
+
nextItem.focus();
|
|
262
|
+
const key = nextItem.getAttribute("data-value");
|
|
263
|
+
if (selectionFollowsFocus && selectionMode === "single" && key) onSelect(key);
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
onKeyDown?.(e);
|
|
267
|
+
};
|
|
268
|
+
|
|
269
|
+
return (
|
|
270
|
+
<ListContext.Provider value={ctx}>
|
|
271
|
+
<div
|
|
272
|
+
role="listbox"
|
|
273
|
+
data-slot="list"
|
|
274
|
+
aria-multiselectable={effectiveSelectionMode === "multiple" || undefined}
|
|
275
|
+
className={cn(
|
|
276
|
+
listVariants({ className }),
|
|
277
|
+
// research-033's mockup: 4px 8px around, 1px between every row and band; the system font's own smoothing
|
|
278
|
+
// (the shell's antialiased drew the names thinner than the mockup's). The container query measures inside
|
|
279
|
+
// that padding: "from 560px of list" is @min-[544px] here.
|
|
280
|
+
variant === "records" &&
|
|
281
|
+
"@container gap-px px-2 py-1 [-webkit-font-smoothing:auto] [-moz-osx-font-smoothing:auto]",
|
|
282
|
+
)}
|
|
283
|
+
onKeyDown={handleKeyDown}
|
|
284
|
+
tabIndex={0}
|
|
285
|
+
{...props}
|
|
286
|
+
>
|
|
287
|
+
{children}
|
|
288
|
+
</div>
|
|
289
|
+
</ListContext.Provider>
|
|
290
|
+
);
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
// --- ListItem ---
|
|
294
|
+
|
|
295
|
+
// Bridge: text-sm on the row, so plain children read as the two-line row's title does (a plugin cannot add Tailwind classes).
|
|
296
|
+
|
|
297
|
+
const listItemVariants = cva(
|
|
298
|
+
"flex gap-2.5 px-4 text-sm border-b-[0.5px] border-border-subtle cursor-pointer transition-colors duration-75 hover:bg-hover outline-none",
|
|
299
|
+
{
|
|
300
|
+
variants: {
|
|
301
|
+
size: {
|
|
302
|
+
default: "h-[40px] items-center",
|
|
303
|
+
sm: "h-[36px] items-center",
|
|
304
|
+
// Bridge: a two-line row (a 28px avatar, a name and a line under it).
|
|
305
|
+
lg: "h-[52px] items-center",
|
|
306
|
+
auto: "py-3 items-start",
|
|
307
|
+
},
|
|
308
|
+
},
|
|
309
|
+
defaultVariants: { size: "default" },
|
|
310
|
+
},
|
|
311
|
+
);
|
|
312
|
+
|
|
313
|
+
// Records rows (research-033's mockup, its computed styles): no separators, a 7px-rounded chip, tinted by state (no
|
|
314
|
+
// left bar, no outline): hover and the keyboard cursor accent 6%, open accent-subtle, selected accent 14%, mixed in
|
|
315
|
+
// sRGB over the surface as the mockup does.
|
|
316
|
+
const listItemRecordsVariants = cva(
|
|
317
|
+
// From 560px of list (the mockup's table): one 36px line, a 22px avatar, 10px/14px padding.
|
|
318
|
+
"group flex gap-2.5 pl-3 pr-4 @min-[544px]:pl-2.5 @min-[544px]:pr-3.5 text-sm text-foreground cursor-pointer @min-[544px]:[&_[data-slot=avatar]]:size-[22px] @min-[544px]:[&_[data-slot=avatar]]:text-[9.5px] transition-colors duration-75 outline-none rounded-control hover:bg-[color-mix(in_srgb,var(--accent)_6%,var(--bg-surface))] focus-visible:bg-[color-mix(in_srgb,var(--accent)_6%,var(--bg-surface))] data-[open]:bg-[var(--accent-subtle)] aria-selected:bg-[color-mix(in_srgb,var(--accent)_14%,var(--bg-surface))]",
|
|
319
|
+
{
|
|
320
|
+
variants: {
|
|
321
|
+
size: {
|
|
322
|
+
default: "h-[40px] items-center",
|
|
323
|
+
sm: "h-[36px] items-center",
|
|
324
|
+
lg: "h-[52px] @min-[544px]:h-[36px] items-center",
|
|
325
|
+
auto: "py-3 items-start",
|
|
326
|
+
},
|
|
327
|
+
},
|
|
328
|
+
defaultVariants: { size: "default" },
|
|
329
|
+
},
|
|
330
|
+
);
|
|
331
|
+
|
|
332
|
+
interface ListItemProps extends React.ComponentProps<"div">, VariantProps<typeof listItemVariants> {
|
|
333
|
+
/** Accessible text description of this item */
|
|
334
|
+
textValue?: string;
|
|
335
|
+
/** Unique key for selection tracking */
|
|
336
|
+
value?: string | undefined;
|
|
337
|
+
/** Whether this item is disabled */
|
|
338
|
+
disabled?: boolean;
|
|
339
|
+
/** Before the text (an Avatar, an Icon) */
|
|
340
|
+
leading?: React.ReactNode;
|
|
341
|
+
/** A second, muted line under the children; the row defaults to size "lg" */
|
|
342
|
+
description?: React.ReactNode;
|
|
343
|
+
/** At the end of the row, muted (a date, a count) */
|
|
344
|
+
trailing?: React.ReactNode;
|
|
345
|
+
/** Records: the row's properties as a table's columns (tags, an organization), from 560px of list only. */
|
|
346
|
+
properties?: React.ReactNode;
|
|
347
|
+
/** Records: not yet saved (research-033's mockup): all grey, its name in italics, a grey avatar (no Draft pill:
|
|
348
|
+
* owner); only the background follows the state. Marked with data-draft. */
|
|
349
|
+
draft?: boolean;
|
|
350
|
+
/** Records, a draft: its ✕ at the row's end ("Cancel draft"). */
|
|
351
|
+
onCancelDraft?: () => void;
|
|
352
|
+
/** Records: a mark in the row checkbox's place (a mail's unread dot), shown while the checkbox is hidden; the
|
|
353
|
+
* checkbox takes its place on hover and while rows are selected. Decorative: say what it means in textValue. */
|
|
354
|
+
marker?: React.ReactNode;
|
|
355
|
+
/** On touch, the actions a swipe to the right uncovers (at the row's start); a full swipe runs the first. */
|
|
356
|
+
swipeStart?: SwipeAction[];
|
|
357
|
+
/** On touch, the actions a swipe to the left uncovers (at the row's end); a full swipe runs the first. */
|
|
358
|
+
swipeEnd?: SwipeAction[];
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
function ListItem({
|
|
362
|
+
className,
|
|
363
|
+
size,
|
|
364
|
+
textValue,
|
|
365
|
+
value,
|
|
366
|
+
disabled,
|
|
367
|
+
leading,
|
|
368
|
+
description,
|
|
369
|
+
trailing,
|
|
370
|
+
properties,
|
|
371
|
+
draft,
|
|
372
|
+
onCancelDraft,
|
|
373
|
+
marker,
|
|
374
|
+
swipeStart,
|
|
375
|
+
swipeEnd,
|
|
376
|
+
children,
|
|
377
|
+
onClick,
|
|
378
|
+
onPointerDown,
|
|
379
|
+
onPointerMove,
|
|
380
|
+
onPointerUp,
|
|
381
|
+
onPointerCancel,
|
|
382
|
+
style,
|
|
383
|
+
onAuxClick,
|
|
384
|
+
onContextMenu,
|
|
385
|
+
...props
|
|
386
|
+
}: ListItemProps) {
|
|
387
|
+
const follow = useFollow();
|
|
388
|
+
const {
|
|
389
|
+
selectionMode,
|
|
390
|
+
selectedKeys,
|
|
391
|
+
onSelect,
|
|
392
|
+
variant,
|
|
393
|
+
openKey,
|
|
394
|
+
onOpen,
|
|
395
|
+
selectionEmpty,
|
|
396
|
+
setSelection,
|
|
397
|
+
anchorRef,
|
|
398
|
+
} = React.useContext(ListContext);
|
|
399
|
+
const itemKey = value ?? "";
|
|
400
|
+
const isRecords = variant === "records";
|
|
401
|
+
const isSelected = selectionMode !== "none" && selectedKeys.has(itemKey);
|
|
402
|
+
const isOpen = isRecords && openKey != null && openKey === value;
|
|
403
|
+
/** Bridge's click rule on a record's row, in a shell (research-048): ⌘ (Ctrl) or a middle click shows it in a window
|
|
404
|
+
* beside, ⌥ on a new desk; a draft (this tab's alone) or a click a plugin handled, not. */
|
|
405
|
+
const followRow = (e: React.MouseEvent) => {
|
|
406
|
+
if (!follow || !value || draft || e.defaultPrevented) return;
|
|
407
|
+
e.preventDefault();
|
|
408
|
+
follow.follow({ item: value }, e);
|
|
409
|
+
};
|
|
410
|
+
|
|
411
|
+
// Shift-click adds the DOM-ordered range from the anchor (or the open row) to this row.
|
|
412
|
+
const extendSelection = (rowEl: HTMLElement, toKey: string) => {
|
|
413
|
+
const listEl = rowEl.closest<HTMLElement>('[data-slot="list"]');
|
|
414
|
+
const anchor = anchorRef.current ?? openKey;
|
|
415
|
+
if (!listEl || !anchor) {
|
|
416
|
+
onSelect(toKey);
|
|
417
|
+
return;
|
|
418
|
+
}
|
|
419
|
+
const keys = Array.from(
|
|
420
|
+
listEl.querySelectorAll<HTMLElement>('[data-slot="list-item"]:not([aria-disabled="true"])'),
|
|
421
|
+
)
|
|
422
|
+
.map((el) => el.getAttribute("data-value"))
|
|
423
|
+
.filter((key): key is string => !!key);
|
|
424
|
+
const from = keys.indexOf(anchor);
|
|
425
|
+
const to = keys.indexOf(toKey);
|
|
426
|
+
if (from < 0 || to < 0) {
|
|
427
|
+
onSelect(toKey);
|
|
428
|
+
return;
|
|
429
|
+
}
|
|
430
|
+
const [lo, hi] = from <= to ? [from, to] : [to, from];
|
|
431
|
+
const next = new Set(selectedKeys);
|
|
432
|
+
for (const key of keys.slice(lo, hi + 1)) next.add(key);
|
|
433
|
+
setSelection([...next]);
|
|
434
|
+
};
|
|
435
|
+
|
|
436
|
+
const checkbox = isRecords ? (
|
|
437
|
+
<Checkbox
|
|
438
|
+
aria-label={textValue ? `Select ${textValue}` : "Select"}
|
|
439
|
+
checked={isSelected}
|
|
440
|
+
tabIndex={-1}
|
|
441
|
+
disabled={disabled}
|
|
442
|
+
onCheckedChange={() => {
|
|
443
|
+
if (disabled) return;
|
|
444
|
+
if (value) onSelect(itemKey);
|
|
445
|
+
}}
|
|
446
|
+
onClick={(e) => e.stopPropagation()}
|
|
447
|
+
className={cn(
|
|
448
|
+
// The mockup's: 14px, 3px radius, a 0.5px input border, on the bands' caret.
|
|
449
|
+
"size-3.5 self-center rounded-[3px] border-[0.5px] border-input transition-opacity",
|
|
450
|
+
isSelected || !selectionEmpty
|
|
451
|
+
? "opacity-100"
|
|
452
|
+
: // A phone has no hover: in Bridge's phone shell ([data-mobile], its preview too) it stays hidden.
|
|
453
|
+
"opacity-0 group-hover:opacity-100 [[data-mobile]_&]:group-hover:opacity-0",
|
|
454
|
+
)}
|
|
455
|
+
/>
|
|
456
|
+
) : null;
|
|
457
|
+
// Records: the row checkbox; with a marker, both share one cell and the marker shows while the checkbox is hidden.
|
|
458
|
+
const selectCell =
|
|
459
|
+
checkbox && marker != null ? (
|
|
460
|
+
<span className="grid shrink-0 self-center [grid-template-areas:'cell'] [&>*]:[grid-area:cell]">
|
|
461
|
+
{checkbox}
|
|
462
|
+
<span
|
|
463
|
+
aria-hidden="true"
|
|
464
|
+
data-slot="list-item-marker"
|
|
465
|
+
className={cn(
|
|
466
|
+
"pointer-events-none grid size-3.5 place-items-center transition-opacity",
|
|
467
|
+
isSelected || !selectionEmpty
|
|
468
|
+
? "opacity-0"
|
|
469
|
+
: "opacity-100 group-hover:opacity-0 [[data-mobile]_&]:group-hover:opacity-100",
|
|
470
|
+
)}
|
|
471
|
+
>
|
|
472
|
+
{marker}
|
|
473
|
+
</span>
|
|
474
|
+
</span>
|
|
475
|
+
) : (
|
|
476
|
+
checkbox
|
|
477
|
+
);
|
|
478
|
+
|
|
479
|
+
// A disabled row does nothing, a swipe neither.
|
|
480
|
+
const swipe = useSwipe(disabled ? undefined : swipeStart, disabled ? undefined : swipeEnd);
|
|
481
|
+
|
|
482
|
+
const row = (
|
|
483
|
+
<div
|
|
484
|
+
role="option"
|
|
485
|
+
data-slot="list-item"
|
|
486
|
+
data-value={value}
|
|
487
|
+
data-open={isOpen ? "true" : undefined}
|
|
488
|
+
data-draft={draft ? "true" : undefined}
|
|
489
|
+
aria-selected={selectionMode !== "none" ? isSelected : undefined}
|
|
490
|
+
aria-disabled={disabled || undefined}
|
|
491
|
+
aria-label={textValue}
|
|
492
|
+
tabIndex={disabled ? undefined : -1}
|
|
493
|
+
className={cn(
|
|
494
|
+
isRecords
|
|
495
|
+
? listItemRecordsVariants({ size: size ?? (description != null ? "lg" : "default") })
|
|
496
|
+
: listItemVariants({ size: size ?? (description != null ? "lg" : "default") }),
|
|
497
|
+
// Bridge: an accent tint and bar, not bg-active, which is nearly the background in dark themes.
|
|
498
|
+
!isRecords &&
|
|
499
|
+
isSelected &&
|
|
500
|
+
"bg-[color-mix(in_oklab,var(--accent)_18%,transparent)] hover:bg-[color-mix(in_oklab,var(--accent)_24%,transparent)] shadow-[inset_2px_0_0_var(--accent)]",
|
|
501
|
+
disabled && "opacity-50 cursor-default",
|
|
502
|
+
draft &&
|
|
503
|
+
"text-muted [&_[data-slot=avatar]]:!bg-[var(--fg-muted)] [&_[data-slot=avatar]]:!text-white [&_[data-slot=avatar]]:saturate-0 [&_[data-slot=list-item-text]>span:first-child]:italic [&_[data-slot=list-item-text]>span]:!text-muted",
|
|
504
|
+
swipe.enabled && "relative touch-pan-y",
|
|
505
|
+
swipe.offset !== 0 && "z-[1] bg-surface",
|
|
506
|
+
className,
|
|
507
|
+
)}
|
|
508
|
+
style={
|
|
509
|
+
swipe.enabled
|
|
510
|
+
? {
|
|
511
|
+
...style,
|
|
512
|
+
transform: swipe.offset ? `translateX(${swipe.offset}px)` : undefined,
|
|
513
|
+
transition: swipe.dragging ? "none" : "transform 200ms ease",
|
|
514
|
+
}
|
|
515
|
+
: style
|
|
516
|
+
}
|
|
517
|
+
onPointerDown={(e) => {
|
|
518
|
+
if (swipe.enabled) swipe.handlers.onPointerDown(e);
|
|
519
|
+
onPointerDown?.(e);
|
|
520
|
+
}}
|
|
521
|
+
onPointerMove={(e) => {
|
|
522
|
+
if (swipe.enabled) swipe.handlers.onPointerMove(e);
|
|
523
|
+
onPointerMove?.(e);
|
|
524
|
+
}}
|
|
525
|
+
onPointerUp={(e) => {
|
|
526
|
+
if (swipe.enabled) swipe.handlers.onPointerUp(e);
|
|
527
|
+
onPointerUp?.(e);
|
|
528
|
+
}}
|
|
529
|
+
onPointerCancel={(e) => {
|
|
530
|
+
if (swipe.enabled) swipe.handlers.onPointerCancel();
|
|
531
|
+
onPointerCancel?.(e);
|
|
532
|
+
}}
|
|
533
|
+
onClick={(e) => {
|
|
534
|
+
if (disabled) return;
|
|
535
|
+
// The end of a swipe is no tap; a tap on a row left open closes it.
|
|
536
|
+
if (swipe.enabled && swipe.swallowClick()) return;
|
|
537
|
+
if (swipe.offset !== 0) {
|
|
538
|
+
swipe.close();
|
|
539
|
+
return;
|
|
540
|
+
}
|
|
541
|
+
if (isRecords) {
|
|
542
|
+
// ⌘-click, Ctrl-click and ⌥-click are Bridge's own gestures (the row in a window beside, on a new desk).
|
|
543
|
+
const gesture = gestureOf(e);
|
|
544
|
+
const bridgeGesture = gesture === "beside" || gesture === "desk";
|
|
545
|
+
if (bridgeGesture) followRow(e);
|
|
546
|
+
else if (e.shiftKey) {
|
|
547
|
+
extendSelection(e.currentTarget, itemKey);
|
|
548
|
+
} else if (value) {
|
|
549
|
+
// Opening a row sets the range anchor to it (a following Shift-click extends from it).
|
|
550
|
+
anchorRef.current = itemKey;
|
|
551
|
+
onOpen?.(itemKey);
|
|
552
|
+
}
|
|
553
|
+
} else if (value) {
|
|
554
|
+
onSelect(itemKey);
|
|
555
|
+
}
|
|
556
|
+
onClick?.(e);
|
|
557
|
+
}}
|
|
558
|
+
onAuxClick={(e) => {
|
|
559
|
+
if (!disabled && isRecords && e.button === 1) followRow(e);
|
|
560
|
+
onAuxClick?.(e);
|
|
561
|
+
}}
|
|
562
|
+
onContextMenu={(e) => {
|
|
563
|
+
// A right-click outside the selection clears it; on a selected row it is left alone.
|
|
564
|
+
if (isRecords && !isSelected) setSelection([]);
|
|
565
|
+
onContextMenu?.(e);
|
|
566
|
+
}}
|
|
567
|
+
{...props}
|
|
568
|
+
>
|
|
569
|
+
{selectCell}
|
|
570
|
+
{leading}
|
|
571
|
+
{description != null ? (
|
|
572
|
+
<div
|
|
573
|
+
data-slot="list-item-text"
|
|
574
|
+
className={cn(
|
|
575
|
+
"flex flex-1 min-w-0 flex-col gap-0.5",
|
|
576
|
+
isRecords && "@min-[544px]:flex-row @min-[544px]:items-baseline @min-[544px]:gap-2",
|
|
577
|
+
)}
|
|
578
|
+
>
|
|
579
|
+
<span
|
|
580
|
+
className={cn(
|
|
581
|
+
"text-sm truncate",
|
|
582
|
+
isRecords && "@min-[544px]:max-w-[45%] @min-[544px]:shrink-0",
|
|
583
|
+
)}
|
|
584
|
+
>
|
|
585
|
+
{children}
|
|
586
|
+
</span>
|
|
587
|
+
<span
|
|
588
|
+
data-slot="list-item-description"
|
|
589
|
+
className={cn(
|
|
590
|
+
"text-xs text-muted truncate",
|
|
591
|
+
isRecords && "@min-[544px]:text-[13px] @min-[544px]:flex-1",
|
|
592
|
+
)}
|
|
593
|
+
>
|
|
594
|
+
{description}
|
|
595
|
+
</span>
|
|
596
|
+
</div>
|
|
597
|
+
) : draft ? (
|
|
598
|
+
<span className="min-w-0 flex-1 truncate italic">{children}</span>
|
|
599
|
+
) : (
|
|
600
|
+
children
|
|
601
|
+
)}
|
|
602
|
+
{isRecords && properties != null && (
|
|
603
|
+
<span
|
|
604
|
+
data-slot="list-item-properties"
|
|
605
|
+
className="hidden shrink-0 items-center gap-1 @min-[544px]:flex"
|
|
606
|
+
>
|
|
607
|
+
{properties}
|
|
608
|
+
</span>
|
|
609
|
+
)}
|
|
610
|
+
{trailing != null && (
|
|
611
|
+
<span data-slot="list-item-trailing" className="ml-auto shrink-0 text-xs text-muted">
|
|
612
|
+
{trailing}
|
|
613
|
+
</span>
|
|
614
|
+
)}
|
|
615
|
+
{draft && onCancelDraft && (
|
|
616
|
+
<button
|
|
617
|
+
type="button"
|
|
618
|
+
aria-label="Cancel draft"
|
|
619
|
+
title="Cancel draft"
|
|
620
|
+
tabIndex={-1}
|
|
621
|
+
onClick={(e) => {
|
|
622
|
+
e.stopPropagation();
|
|
623
|
+
onCancelDraft();
|
|
624
|
+
}}
|
|
625
|
+
className="ml-auto grid size-[22px] shrink-0 cursor-pointer place-items-center self-center rounded-full border-0 bg-transparent p-0 text-muted outline-none hover:bg-active hover:text-foreground"
|
|
626
|
+
>
|
|
627
|
+
<X aria-hidden="true" size={14} strokeWidth={1.8} />
|
|
628
|
+
</button>
|
|
629
|
+
)}
|
|
630
|
+
</div>
|
|
631
|
+
);
|
|
632
|
+
if (!swipe.enabled) return row;
|
|
633
|
+
return (
|
|
634
|
+
<div
|
|
635
|
+
data-slot="list-item-swipe"
|
|
636
|
+
className={cn("relative overflow-hidden", isRecords && "rounded-control")}
|
|
637
|
+
>
|
|
638
|
+
{swipe.actions("start")}
|
|
639
|
+
{swipe.actions("end")}
|
|
640
|
+
{row}
|
|
641
|
+
</div>
|
|
642
|
+
);
|
|
643
|
+
}
|
|
644
|
+
|
|
645
|
+
// --- ListGroup ---
|
|
646
|
+
|
|
647
|
+
// Two steps off the page's background (bg-hover, opaque), so the header reads as a band, not one more row.
|
|
648
|
+
const listGroupHeaderVariants = cva("sticky top-0 z-10 flex px-4 bg-hover text-xs font-medium", {
|
|
649
|
+
variants: {
|
|
650
|
+
variant: {
|
|
651
|
+
// A letter of an alphabetical index (Contacts' "A", "B"): a quiet marker between the rows.
|
|
652
|
+
index: "h-6 items-center text-muted border-b-[0.5px] border-border-subtle",
|
|
653
|
+
// A section title in a navigation list (a category, a domain): readable, ruled off from its rows.
|
|
654
|
+
section: "h-7 items-center text-secondary border-b-[0.5px] border-border-subtle",
|
|
655
|
+
// A records/property band: a rounded tinted bar inset from the list edges.
|
|
656
|
+
property: "h-7 items-center rounded-control mx-1 text-secondary",
|
|
657
|
+
// Records (research-033's mockup): a rounded band, 24px, 30px from 560px of list, caret, count at the end, +.
|
|
658
|
+
// Its caret on the rows' checkbox (12px in, 10px from 560px), 10px before the label; 7px-rounded as the rows.
|
|
659
|
+
records:
|
|
660
|
+
"h-6 @min-[544px]:h-[30px] items-center rounded-control pl-3 @min-[544px]:pl-2.5 pr-2 text-secondary",
|
|
661
|
+
},
|
|
662
|
+
},
|
|
663
|
+
defaultVariants: { variant: "index" },
|
|
664
|
+
});
|
|
665
|
+
|
|
666
|
+
interface ListGroupProps
|
|
667
|
+
extends React.ComponentProps<"div">, VariantProps<typeof listGroupHeaderVariants> {
|
|
668
|
+
/** The group's heading ("A", "Favorites"), shown above its items and sticky while they scroll */
|
|
669
|
+
label: string;
|
|
670
|
+
/** Records: a caret header that toggles its rows. */
|
|
671
|
+
collapsible?: boolean;
|
|
672
|
+
/** Records: a muted count shown after the label. */
|
|
673
|
+
count?: number;
|
|
674
|
+
/** Records: called by the header's + button. */
|
|
675
|
+
onAdd?: () => void;
|
|
676
|
+
/** Records: the + button's accessible name (default "Add"). */
|
|
677
|
+
addLabel?: string;
|
|
678
|
+
/** Records: start collapsed. */
|
|
679
|
+
defaultCollapsed?: boolean;
|
|
680
|
+
}
|
|
681
|
+
|
|
682
|
+
function ListGroup({
|
|
683
|
+
className,
|
|
684
|
+
label,
|
|
685
|
+
variant,
|
|
686
|
+
collapsible = false,
|
|
687
|
+
count,
|
|
688
|
+
onAdd,
|
|
689
|
+
addLabel,
|
|
690
|
+
defaultCollapsed = false,
|
|
691
|
+
children,
|
|
692
|
+
...props
|
|
693
|
+
}: ListGroupProps) {
|
|
694
|
+
const [collapsed, setCollapsed] = React.useState(defaultCollapsed);
|
|
695
|
+
const expanded = !collapsed;
|
|
696
|
+
|
|
697
|
+
if (!collapsible) {
|
|
698
|
+
return (
|
|
699
|
+
<div role="group" aria-label={label} data-slot="list-group" className={className} {...props}>
|
|
700
|
+
<div
|
|
701
|
+
aria-hidden="true"
|
|
702
|
+
data-slot="list-group-header"
|
|
703
|
+
className={listGroupHeaderVariants({ variant })}
|
|
704
|
+
>
|
|
705
|
+
{label}
|
|
706
|
+
</div>
|
|
707
|
+
{children}
|
|
708
|
+
</div>
|
|
709
|
+
);
|
|
710
|
+
}
|
|
711
|
+
|
|
712
|
+
return (
|
|
713
|
+
<div
|
|
714
|
+
role="group"
|
|
715
|
+
aria-label={label}
|
|
716
|
+
data-slot="list-group"
|
|
717
|
+
// Records: 1px between the band and each of its rows, as between groups.
|
|
718
|
+
className={cn(variant === "records" && "flex flex-col gap-px", className)}
|
|
719
|
+
{...props}
|
|
720
|
+
>
|
|
721
|
+
<div data-slot="list-group-header" className={listGroupHeaderVariants({ variant })}>
|
|
722
|
+
<button
|
|
723
|
+
type="button"
|
|
724
|
+
aria-expanded={expanded}
|
|
725
|
+
onClick={() => setCollapsed((value) => !value)}
|
|
726
|
+
className="flex flex-1 min-w-0 items-center gap-1.5 cursor-pointer border-0 bg-transparent p-0 font-[inherit] text-[length:inherit] text-inherit outline-none text-left focus-visible:text-foreground"
|
|
727
|
+
>
|
|
728
|
+
<ChevronRight
|
|
729
|
+
aria-hidden="true"
|
|
730
|
+
size={14}
|
|
731
|
+
// The mockup's caret: muted, 10px before the label (6px gap + 4px).
|
|
732
|
+
className={cn("mr-1 shrink-0 text-muted transition-transform", expanded && "rotate-90")}
|
|
733
|
+
/>
|
|
734
|
+
<span className="truncate">{label}</span>
|
|
735
|
+
{count != null && <span className="ml-auto pl-2 text-muted tabular-nums">{count}</span>}
|
|
736
|
+
</button>
|
|
737
|
+
{onAdd && (
|
|
738
|
+
<button
|
|
739
|
+
type="button"
|
|
740
|
+
aria-label={addLabel ?? "Add"}
|
|
741
|
+
onClick={onAdd}
|
|
742
|
+
className="ml-auto flex size-5 shrink-0 cursor-pointer items-center justify-center rounded-control border-0 bg-transparent p-0 text-muted outline-none hover:bg-active hover:text-foreground focus-visible:text-foreground"
|
|
743
|
+
>
|
|
744
|
+
<Plus aria-hidden="true" size={14} />
|
|
745
|
+
</button>
|
|
746
|
+
)}
|
|
747
|
+
</div>
|
|
748
|
+
{expanded ? children : null}
|
|
749
|
+
</div>
|
|
750
|
+
);
|
|
751
|
+
}
|
|
752
|
+
|
|
753
|
+
// --- BulkBar ---
|
|
754
|
+
|
|
755
|
+
interface BulkBarProps extends React.ComponentProps<"div"> {
|
|
756
|
+
/** How many rows are selected; the bar draws nothing at 0. */
|
|
757
|
+
count: number;
|
|
758
|
+
/** Clear the selection (the X button). */
|
|
759
|
+
onClear?: () => void;
|
|
760
|
+
/** Floats over its pane, at the bottom centre (the pane positioned): the mockup's selection bar. */
|
|
761
|
+
floating?: boolean;
|
|
762
|
+
}
|
|
763
|
+
|
|
764
|
+
// research-033's mockup: a floating bar: the count in an accent badge, then the actions (BulkAction: a label and its
|
|
765
|
+
// keys), then a clear button. It spans the width the caller gives it (e.g. the bottom of a pane, its sides inset) and
|
|
766
|
+
// centres the bar there, fitting it: under 480px the keys and separators go, under 360px the word "selected".
|
|
767
|
+
function BulkBar({
|
|
768
|
+
count,
|
|
769
|
+
onClear,
|
|
770
|
+
floating = false,
|
|
771
|
+
children,
|
|
772
|
+
className,
|
|
773
|
+
...props
|
|
774
|
+
}: BulkBarProps) {
|
|
775
|
+
if (count === 0) return null;
|
|
776
|
+
return (
|
|
777
|
+
<div
|
|
778
|
+
data-slot="bulk-dock"
|
|
779
|
+
className={cn(
|
|
780
|
+
"pointer-events-none flex w-full justify-center @container",
|
|
781
|
+
floating && "absolute inset-x-3 bottom-5 z-30 w-auto",
|
|
782
|
+
)}
|
|
783
|
+
>
|
|
784
|
+
<div
|
|
785
|
+
role="toolbar"
|
|
786
|
+
aria-label="Selection"
|
|
787
|
+
className={cn(
|
|
788
|
+
"pointer-events-auto inline-flex max-w-full min-w-0 items-center gap-1 overflow-hidden rounded-dropdown bg-surface py-1 pr-1 pl-3 text-sm shadow-[var(--shadow-dropdown)]",
|
|
789
|
+
className,
|
|
790
|
+
)}
|
|
791
|
+
{...props}
|
|
792
|
+
>
|
|
793
|
+
<span className="mr-1.5 flex shrink-0 items-center gap-1.5 font-medium">
|
|
794
|
+
<span className="inline-flex h-[18px] min-w-[18px] items-center justify-center rounded-full bg-accent px-1.5 text-xs text-white tabular-nums">
|
|
795
|
+
{count}
|
|
796
|
+
</span>
|
|
797
|
+
<span className="@max-[360px]:sr-only">{" selected"}</span>
|
|
798
|
+
</span>
|
|
799
|
+
{children}
|
|
800
|
+
<button
|
|
801
|
+
type="button"
|
|
802
|
+
aria-label="Clear selection"
|
|
803
|
+
title="Clear (Esc)"
|
|
804
|
+
onClick={onClear}
|
|
805
|
+
className="flex size-[var(--height-sm)] shrink-0 cursor-pointer items-center justify-center rounded-control border-0 bg-transparent p-0 text-muted outline-none hover:bg-hover hover:text-foreground"
|
|
806
|
+
>
|
|
807
|
+
<X aria-hidden="true" size={14} />
|
|
808
|
+
</button>
|
|
809
|
+
</div>
|
|
810
|
+
</div>
|
|
811
|
+
);
|
|
812
|
+
}
|
|
813
|
+
|
|
814
|
+
interface BulkActionProps extends React.ComponentProps<"button"> {
|
|
815
|
+
/** Its keys, as the kit writes them ("L", "Meta+Backspace"), drawn as keycaps after the label. */
|
|
816
|
+
keys?: string;
|
|
817
|
+
}
|
|
818
|
+
const BULK_KEYS: Record<string, string> = {
|
|
819
|
+
Meta: "⌘",
|
|
820
|
+
Shift: "⇧",
|
|
821
|
+
Alt: "⌥",
|
|
822
|
+
Ctrl: "⌃",
|
|
823
|
+
Backspace: "⌫",
|
|
824
|
+
Enter: "↵",
|
|
825
|
+
};
|
|
826
|
+
|
|
827
|
+
/** One of BulkBar's actions: a quiet button, its label and its keys. */
|
|
828
|
+
function BulkAction({ keys, className, children, ...props }: BulkActionProps) {
|
|
829
|
+
return (
|
|
830
|
+
<button
|
|
831
|
+
type="button"
|
|
832
|
+
className={cn(
|
|
833
|
+
"inline-flex h-[var(--height-sm)] min-w-0 cursor-pointer items-center gap-1.5 truncate rounded-control border-0 bg-transparent px-1.5 font-[inherit] text-xs text-secondary outline-none hover:bg-hover hover:text-foreground focus-visible:bg-hover",
|
|
834
|
+
className,
|
|
835
|
+
)}
|
|
836
|
+
{...props}
|
|
837
|
+
>
|
|
838
|
+
{children}
|
|
839
|
+
{keys?.split("+").map((key, at) => (
|
|
840
|
+
<Kbd key={at} className="@max-[480px]:hidden">
|
|
841
|
+
{BULK_KEYS[key] ?? key}
|
|
842
|
+
</Kbd>
|
|
843
|
+
))}
|
|
844
|
+
</button>
|
|
845
|
+
);
|
|
846
|
+
}
|
|
847
|
+
|
|
848
|
+
/** A thin rule between BulkBar's actions (before "More"). */
|
|
849
|
+
function BulkSeparator() {
|
|
850
|
+
return (
|
|
851
|
+
<span
|
|
852
|
+
aria-hidden="true"
|
|
853
|
+
className="mx-1 h-[18px] w-[0.5px] shrink-0 bg-border @max-[480px]:hidden"
|
|
854
|
+
/>
|
|
855
|
+
);
|
|
856
|
+
}
|
|
857
|
+
|
|
858
|
+
export {
|
|
859
|
+
List,
|
|
860
|
+
listVariants,
|
|
861
|
+
ListItem,
|
|
862
|
+
listItemVariants,
|
|
863
|
+
ListGroup,
|
|
864
|
+
BulkBar,
|
|
865
|
+
BulkAction,
|
|
866
|
+
BulkSeparator,
|
|
867
|
+
};
|
|
868
|
+
export type { ListProps, ListItemProps, ListGroupProps, BulkBarProps, BulkActionProps };
|