@dxos/react-ui 0.8.4-main.3eb6e50203 → 0.8.4-main.3fbcb4aa9b
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/dist/lib/browser/{chunk-6DTBPJE4.mjs → chunk-BDBC6H6V.mjs} +182 -108
- package/dist/lib/browser/chunk-BDBC6H6V.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +2961 -2056
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/testing/index.mjs +70 -41
- package/dist/lib/browser/testing/index.mjs.map +4 -4
- package/dist/lib/browser/translations.mjs +18 -0
- package/dist/lib/browser/translations.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-JKHQSGNU.mjs → chunk-3JSJK2ZY.mjs} +182 -108
- package/dist/lib/node-esm/chunk-3JSJK2ZY.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +2961 -2056
- package/dist/lib/node-esm/index.mjs.map +4 -4
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/testing/index.mjs +70 -41
- package/dist/lib/node-esm/testing/index.mjs.map +4 -4
- package/dist/lib/node-esm/translations.mjs +20 -0
- package/dist/lib/node-esm/translations.mjs.map +7 -0
- package/dist/types/src/components/Avatars/Avatar.d.ts +1 -1
- package/dist/types/src/components/Avatars/Avatar.d.ts.map +1 -1
- package/dist/types/src/components/Avatars/Avatar.stories.d.ts.map +1 -1
- package/dist/types/src/components/Avatars/AvatarGroup.stories.d.ts.map +1 -1
- package/dist/types/src/components/Breadcrumb/Breadcrumb.d.ts.map +1 -1
- package/dist/types/src/components/Breadcrumb/Breadcrumb.stories.d.ts.map +1 -1
- package/dist/types/src/components/Button/Button.d.ts +2 -2
- package/dist/types/src/components/Button/Button.d.ts.map +1 -1
- package/dist/types/src/components/Button/Button.stories.d.ts +1 -1
- package/dist/types/src/components/Button/Button.stories.d.ts.map +1 -1
- package/dist/types/src/components/Button/IconButton.d.ts +1 -0
- package/dist/types/src/components/Button/IconButton.d.ts.map +1 -1
- package/dist/types/src/components/Button/IconButton.stories.d.ts +3 -0
- package/dist/types/src/components/Button/IconButton.stories.d.ts.map +1 -1
- package/dist/types/src/components/Button/Toggle.d.ts +2 -2
- package/dist/types/src/components/Button/Toggle.d.ts.map +1 -1
- package/dist/types/src/components/Button/Toggle.stories.d.ts.map +1 -1
- package/dist/types/src/components/Button/ToggleGroup.d.ts +6 -6
- package/dist/types/src/components/Button/ToggleGroup.d.ts.map +1 -1
- package/dist/types/src/components/Button/ToggleGroup.stories.d.ts +2 -2
- package/dist/types/src/components/Button/ToggleGroup.stories.d.ts.map +1 -1
- package/dist/types/src/components/Card/Card.d.ts +124 -0
- package/dist/types/src/components/Card/Card.d.ts.map +1 -0
- package/dist/types/src/components/Card/Card.stories.d.ts +21 -0
- package/dist/types/src/components/Card/Card.stories.d.ts.map +1 -0
- package/dist/types/src/components/Card/index.d.ts +2 -0
- package/dist/types/src/components/Card/index.d.ts.map +1 -0
- package/dist/types/src/components/Clipboard/ClipboardProvider.d.ts.map +1 -1
- package/dist/types/src/components/Clipboard/CopyButton.d.ts.map +1 -1
- package/dist/types/src/components/Clipboard/index.d.ts +10 -1
- package/dist/types/src/components/Clipboard/index.d.ts.map +1 -1
- package/dist/types/src/components/DensityProvider/DensityProvider.d.ts.map +1 -1
- package/dist/types/src/components/Dialog/AlertDialog.d.ts +43 -23
- package/dist/types/src/components/Dialog/AlertDialog.d.ts.map +1 -1
- package/dist/types/src/components/Dialog/AlertDialog.stories.d.ts.map +1 -1
- package/dist/types/src/components/Dialog/Dialog.d.ts +48 -30
- package/dist/types/src/components/Dialog/Dialog.d.ts.map +1 -1
- package/dist/types/src/components/Dialog/Dialog.stories.d.ts +6 -8
- package/dist/types/src/components/Dialog/Dialog.stories.d.ts.map +1 -1
- package/dist/types/src/components/ElevationProvider/ElevationProvider.d.ts.map +1 -1
- package/dist/types/src/components/ErrorFallback/ErrorFallback.d.ts +11 -0
- package/dist/types/src/components/ErrorFallback/ErrorFallback.d.ts.map +1 -0
- package/dist/types/src/components/ErrorFallback/ErrorFallback.stories.d.ts +7 -0
- package/dist/types/src/components/ErrorFallback/ErrorFallback.stories.d.ts.map +1 -0
- package/dist/types/src/components/ErrorFallback/ErrorStack.d.ts +19 -0
- package/dist/types/src/components/ErrorFallback/ErrorStack.d.ts.map +1 -0
- package/dist/types/src/components/ErrorFallback/ThrowError.d.ts +9 -0
- package/dist/types/src/components/ErrorFallback/ThrowError.d.ts.map +1 -0
- package/dist/types/src/components/ErrorFallback/index.d.ts +5 -0
- package/dist/types/src/components/ErrorFallback/index.d.ts.map +1 -0
- package/dist/types/src/components/Focus/Focus.d.ts +36 -0
- package/dist/types/src/components/Focus/Focus.d.ts.map +1 -0
- package/dist/types/src/components/Focus/Focus.stories.d.ts +9 -0
- package/dist/types/src/components/Focus/Focus.stories.d.ts.map +1 -0
- package/dist/types/src/components/Focus/index.d.ts +2 -0
- package/dist/types/src/components/Focus/index.d.ts.map +1 -0
- package/dist/types/src/components/Icon/Icon.d.ts +4 -0
- package/dist/types/src/components/Icon/Icon.d.ts.map +1 -1
- package/dist/types/src/components/Icon/Icon.stories.d.ts +11 -3
- package/dist/types/src/components/Icon/Icon.stories.d.ts.map +1 -1
- package/dist/types/src/components/Image/Image.d.ts +15 -0
- package/dist/types/src/components/Image/Image.d.ts.map +1 -0
- package/dist/types/src/components/Image/Image.stories.d.ts +34 -0
- package/dist/types/src/components/Image/Image.stories.d.ts.map +1 -0
- package/dist/types/src/components/Image/index.d.ts +2 -0
- package/dist/types/src/components/Image/index.d.ts.map +1 -0
- package/dist/types/src/components/Input/Input.d.ts +16 -22
- package/dist/types/src/components/Input/Input.d.ts.map +1 -1
- package/dist/types/src/components/Input/Input.stories.d.ts +6 -6
- package/dist/types/src/components/Input/Input.stories.d.ts.map +1 -1
- package/dist/types/src/components/Link/Link.stories.d.ts.map +1 -1
- package/dist/types/src/components/List/List.d.ts +5 -3
- package/dist/types/src/components/List/List.d.ts.map +1 -1
- package/dist/types/src/components/List/List.stories.d.ts +3 -1
- package/dist/types/src/components/List/List.stories.d.ts.map +1 -1
- package/dist/types/src/components/List/ListDropIndicator.d.ts.map +1 -1
- package/dist/types/src/components/List/Tree.d.ts +2 -2
- package/dist/types/src/components/List/Tree.d.ts.map +1 -1
- package/dist/types/src/components/List/Tree.stories.d.ts.map +1 -1
- package/dist/types/src/components/List/TreeDropIndicator.d.ts.map +1 -1
- package/dist/types/src/components/List/Treegrid.d.ts +5 -9
- package/dist/types/src/components/List/Treegrid.d.ts.map +1 -1
- package/dist/types/src/components/List/Treegrid.stories.d.ts.map +1 -1
- package/dist/types/src/components/Main/Main.d.ts +8 -4
- package/dist/types/src/components/Main/Main.d.ts.map +1 -1
- package/dist/types/src/components/Main/Main.stories.d.ts +0 -3
- package/dist/types/src/components/Main/Main.stories.d.ts.map +1 -1
- package/dist/types/src/components/Main/useSwipeToDismiss.d.ts.map +1 -1
- package/dist/types/src/components/Menu/ContextMenu.d.ts.map +1 -1
- package/dist/types/src/components/Menu/ContextMenu.stories.d.ts.map +1 -1
- package/dist/types/src/components/Menu/DropdownMenu.d.ts +58 -49
- package/dist/types/src/components/Menu/DropdownMenu.d.ts.map +1 -1
- package/dist/types/src/components/Menu/DropdownMenu.stories.d.ts +14 -1
- package/dist/types/src/components/Menu/DropdownMenu.stories.d.ts.map +1 -1
- package/dist/types/src/components/Message/Message.d.ts +1 -1
- package/dist/types/src/components/Message/Message.d.ts.map +1 -1
- package/dist/types/src/components/Message/Message.stories.d.ts +4 -5
- package/dist/types/src/components/Message/Message.stories.d.ts.map +1 -1
- package/dist/types/src/components/Popover/Popover.d.ts +39 -22
- package/dist/types/src/components/Popover/Popover.d.ts.map +1 -1
- package/dist/types/src/components/Popover/Popover.stories.d.ts.map +1 -1
- package/dist/types/src/components/ScrollArea/ScrollArea.d.ts +12 -11
- package/dist/types/src/components/ScrollArea/ScrollArea.d.ts.map +1 -1
- package/dist/types/src/components/ScrollArea/ScrollArea.stories.d.ts +21 -10
- package/dist/types/src/components/ScrollArea/ScrollArea.stories.d.ts.map +1 -1
- package/dist/types/src/components/ScrollContainer/ScrollContainer.d.ts +42 -13
- package/dist/types/src/components/ScrollContainer/ScrollContainer.d.ts.map +1 -1
- package/dist/types/src/components/ScrollContainer/ScrollContainer.stories.d.ts +9 -5
- package/dist/types/src/components/ScrollContainer/ScrollContainer.stories.d.ts.map +1 -1
- package/dist/types/src/components/Select/Select.d.ts.map +1 -1
- package/dist/types/src/components/Select/Select.stories.d.ts +2 -2
- package/dist/types/src/components/Select/Select.stories.d.ts.map +1 -1
- package/dist/types/src/components/Separator/Separator.d.ts +3 -3
- package/dist/types/src/components/Separator/Separator.d.ts.map +1 -1
- package/dist/types/src/components/Skeleton/Skeleton.stories.d.ts.map +1 -1
- package/dist/types/src/components/Splitter/Splitter.d.ts +23 -15
- package/dist/types/src/components/Splitter/Splitter.d.ts.map +1 -1
- package/dist/types/src/components/Splitter/Splitter.stories.d.ts.map +1 -1
- package/dist/types/src/components/Status/Status.d.ts +3 -4
- package/dist/types/src/components/Status/Status.d.ts.map +1 -1
- package/dist/types/src/components/Status/Status.stories.d.ts +4 -2
- package/dist/types/src/components/Status/Status.stories.d.ts.map +1 -1
- package/dist/types/src/components/Tag/Tag.stories.d.ts +0 -5
- package/dist/types/src/components/Tag/Tag.stories.d.ts.map +1 -1
- package/dist/types/src/components/ThemeProvider/ThemeProvider.d.ts +1 -1
- package/dist/types/src/components/ThemeProvider/ThemeProvider.d.ts.map +1 -1
- package/dist/types/src/components/ThemeProvider/ThemeProvider.stories.d.ts +12 -0
- package/dist/types/src/components/ThemeProvider/ThemeProvider.stories.d.ts.map +1 -0
- package/dist/types/src/components/ThemeProvider/TranslationsProvider.d.ts +54 -55
- package/dist/types/src/components/ThemeProvider/TranslationsProvider.d.ts.map +1 -1
- package/dist/types/src/components/ThemeProvider/index.d.ts +1 -1
- package/dist/types/src/components/ThemeProvider/index.d.ts.map +1 -1
- package/dist/types/src/components/Toast/Toast.d.ts +16 -16
- package/dist/types/src/components/Toast/Toast.d.ts.map +1 -1
- package/dist/types/src/components/Toast/Toast.stories.d.ts.map +1 -1
- package/dist/types/src/components/Toolbar/Toolbar.d.ts +32 -15
- package/dist/types/src/components/Toolbar/Toolbar.d.ts.map +1 -1
- package/dist/types/src/components/Toolbar/Toolbar.stories.d.ts.map +1 -1
- package/dist/types/src/components/Tooltip/Tooltip.d.ts +10 -10
- package/dist/types/src/components/Tooltip/Tooltip.d.ts.map +1 -1
- package/dist/types/src/components/Tooltip/Tooltip.stories.d.ts +2 -2
- package/dist/types/src/components/Tooltip/Tooltip.stories.d.ts.map +1 -1
- package/dist/types/src/components/index.d.ts +7 -4
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/exemplars/generics.stories.d.ts +8 -6
- package/dist/types/src/exemplars/generics.stories.d.ts.map +1 -1
- package/dist/types/src/exemplars/slot.stories.d.ts +1 -0
- package/dist/types/src/exemplars/slot.stories.d.ts.map +1 -1
- package/dist/types/src/exemplars/tabster.stories.d.ts.map +1 -1
- package/dist/types/src/exemplars/virtualizer.stories.d.ts +11 -0
- package/dist/types/src/exemplars/virtualizer.stories.d.ts.map +1 -0
- package/dist/types/src/hooks/index.d.ts +1 -0
- package/dist/types/src/hooks/index.d.ts.map +1 -1
- package/dist/types/src/hooks/useDensityContext.d.ts +1 -1
- package/dist/types/src/hooks/useDensityContext.d.ts.map +1 -1
- package/dist/types/src/hooks/useElevationContext.d.ts.map +1 -1
- package/dist/types/src/hooks/useIconHref.d.ts.map +1 -1
- package/dist/types/src/hooks/useSafeArea.d.ts.map +1 -1
- package/dist/types/src/hooks/useSafeCollisionPadding.d.ts.map +1 -1
- package/dist/types/src/hooks/useVisualViewport.d.ts.map +1 -1
- package/dist/types/src/playground/Controls.stories.d.ts.map +1 -1
- package/dist/types/src/playground/Custom.stories.d.ts +1 -1
- package/dist/types/src/playground/Custom.stories.d.ts.map +1 -1
- package/dist/types/src/playground/Typography.stories.d.ts.map +1 -1
- package/dist/types/src/primitives/Column/Column.d.ts +33 -0
- package/dist/types/src/primitives/Column/Column.d.ts.map +1 -0
- package/dist/types/src/primitives/Column/Column.stories.d.ts +25 -0
- package/dist/types/src/primitives/Column/Column.stories.d.ts.map +1 -0
- package/dist/types/src/primitives/Column/index.d.ts +2 -0
- package/dist/types/src/primitives/Column/index.d.ts.map +1 -0
- package/dist/types/src/primitives/Container/Container.d.ts +6 -22
- package/dist/types/src/primitives/Container/Container.d.ts.map +1 -1
- package/dist/types/src/primitives/Container/Container.stories.d.ts +2 -7
- package/dist/types/src/primitives/Container/Container.stories.d.ts.map +1 -1
- package/dist/types/src/primitives/Container/index.d.ts +0 -1
- package/dist/types/src/primitives/Container/index.d.ts.map +1 -1
- package/dist/types/src/primitives/Flex/Flex.d.ts +8 -5
- package/dist/types/src/primitives/Flex/Flex.d.ts.map +1 -1
- package/dist/types/src/primitives/Flex/Flex.stories.d.ts +8 -0
- package/dist/types/src/primitives/Flex/Flex.stories.d.ts.map +1 -0
- package/dist/types/src/primitives/Grid/Grid.d.ts +10 -0
- package/dist/types/src/primitives/Grid/Grid.d.ts.map +1 -0
- package/dist/types/src/primitives/Grid/Grid.stories.d.ts +8 -0
- package/dist/types/src/primitives/Grid/Grid.stories.d.ts.map +1 -0
- package/dist/types/src/primitives/Grid/index.d.ts +2 -0
- package/dist/types/src/primitives/Grid/index.d.ts.map +1 -0
- package/dist/types/src/primitives/Panel/Panel.d.ts +35 -0
- package/dist/types/src/primitives/Panel/Panel.d.ts.map +1 -0
- package/dist/types/src/primitives/Panel/Panel.stories.d.ts +6 -0
- package/dist/types/src/primitives/Panel/Panel.stories.d.ts.map +1 -0
- package/dist/types/src/primitives/Panel/index.d.ts +2 -0
- package/dist/types/src/primitives/Panel/index.d.ts.map +1 -0
- package/dist/types/src/primitives/index.d.ts +3 -0
- package/dist/types/src/primitives/index.d.ts.map +1 -1
- package/dist/types/src/testing/Loading.d.ts +9 -0
- package/dist/types/src/testing/Loading.d.ts.map +1 -0
- package/dist/types/src/testing/decorators/withLayout.d.ts +1 -1
- package/dist/types/src/testing/decorators/withLayout.d.ts.map +1 -1
- package/dist/types/src/testing/decorators/withLayoutVariants.d.ts.map +1 -1
- package/dist/types/src/testing/decorators/withTheme.d.ts +1 -1
- package/dist/types/src/testing/decorators/withTheme.d.ts.map +1 -1
- package/dist/types/src/testing/index.d.ts +1 -0
- package/dist/types/src/testing/index.d.ts.map +1 -1
- package/dist/types/src/translations.d.ts +11 -0
- package/dist/types/src/translations.d.ts.map +1 -0
- package/dist/types/src/util/usePx.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +33 -26
- package/src/components/Avatars/Avatar.stories.tsx +5 -7
- package/src/components/Avatars/Avatar.tsx +5 -6
- package/src/components/Avatars/AvatarGroup.stories.tsx +0 -1
- package/src/components/Breadcrumb/Breadcrumb.stories.tsx +1 -2
- package/src/components/Breadcrumb/Breadcrumb.tsx +10 -10
- package/src/components/Button/Button.stories.tsx +1 -2
- package/src/components/Button/Button.tsx +11 -19
- package/src/components/Button/IconButton.stories.tsx +6 -4
- package/src/components/Button/IconButton.tsx +3 -4
- package/src/components/Button/Toggle.stories.tsx +0 -1
- package/src/components/Button/Toggle.tsx +4 -4
- package/src/components/Button/ToggleGroup.stories.tsx +0 -1
- package/src/components/Button/ToggleGroup.tsx +12 -16
- package/src/components/Card/Card.stories.tsx +151 -0
- package/src/components/Card/Card.tsx +512 -0
- package/src/components/Card/index.ts +5 -0
- package/src/components/Clipboard/CopyButton.tsx +6 -7
- package/src/components/Dialog/AlertDialog.stories.tsx +14 -15
- package/src/components/Dialog/AlertDialog.tsx +123 -77
- package/src/components/Dialog/Dialog.stories.tsx +90 -14
- package/src/components/Dialog/Dialog.tsx +105 -104
- package/src/components/ErrorFallback/ErrorFallback.stories.tsx +45 -0
- package/src/components/ErrorFallback/ErrorFallback.tsx +70 -0
- package/src/components/ErrorFallback/ErrorStack.tsx +114 -0
- package/src/components/ErrorFallback/ThrowError.tsx +37 -0
- package/src/components/ErrorFallback/index.ts +9 -0
- package/src/components/Focus/AUDIT.md +43 -0
- package/src/components/Focus/Focus.stories.tsx +230 -0
- package/src/components/Focus/Focus.tsx +201 -0
- package/src/components/Focus/index.ts +5 -0
- package/src/components/Icon/Icon.stories.tsx +43 -13
- package/src/components/Icon/Icon.tsx +14 -3
- package/src/components/Image/Image.stories.tsx +86 -0
- package/src/components/Image/Image.tsx +246 -0
- package/src/components/Image/index.ts +5 -0
- package/src/components/Input/Input.stories.tsx +17 -38
- package/src/components/Input/Input.tsx +20 -50
- package/src/components/Link/Link.stories.tsx +0 -1
- package/src/components/Link/Link.tsx +2 -2
- package/src/components/List/List.stories.tsx +14 -22
- package/src/components/List/List.tsx +11 -9
- package/src/components/List/ListDropIndicator.tsx +7 -8
- package/src/components/List/Tree.stories.tsx +4 -5
- package/src/components/List/Tree.tsx +0 -1
- package/src/components/List/TreeDropIndicator.tsx +6 -6
- package/src/components/List/Treegrid.stories.tsx +27 -28
- package/src/components/List/Treegrid.tsx +20 -20
- package/src/components/Main/Main.stories.tsx +3 -7
- package/src/components/Main/Main.tsx +13 -14
- package/src/components/Menu/ContextMenu.stories.tsx +0 -1
- package/src/components/Menu/ContextMenu.tsx +3 -3
- package/src/components/Menu/DropdownMenu.stories.tsx +0 -1
- package/src/components/Menu/DropdownMenu.tsx +51 -45
- package/src/components/Message/Message.stories.tsx +25 -11
- package/src/components/Message/Message.tsx +30 -15
- package/src/components/Popover/Popover.stories.tsx +5 -6
- package/src/components/Popover/Popover.tsx +59 -56
- package/src/components/ScrollArea/ScrollArea.stories.tsx +98 -39
- package/src/components/ScrollArea/ScrollArea.tsx +45 -25
- package/src/components/ScrollContainer/ScrollContainer.stories.tsx +46 -25
- package/src/components/ScrollContainer/ScrollContainer.tsx +199 -92
- package/src/components/Select/Select.stories.tsx +5 -6
- package/src/components/Select/Select.tsx +2 -2
- package/src/components/Separator/Separator.tsx +4 -7
- package/src/components/Skeleton/Skeleton.stories.tsx +12 -13
- package/src/components/Splitter/Splitter.stories.tsx +47 -37
- package/src/components/Splitter/Splitter.tsx +44 -40
- package/src/components/Status/Status.stories.tsx +19 -16
- package/src/components/Status/Status.tsx +8 -5
- package/src/components/Tag/Tag.stories.tsx +3 -9
- package/src/components/Tag/Tag.tsx +2 -2
- package/src/components/ThemeProvider/ThemeProvider.stories.tsx +31 -0
- package/src/components/ThemeProvider/ThemeProvider.tsx +7 -6
- package/src/components/ThemeProvider/index.ts +1 -1
- package/src/components/Toast/Toast.stories.tsx +0 -1
- package/src/components/Toast/Toast.tsx +22 -37
- package/src/components/Toolbar/Toolbar.stories.tsx +0 -1
- package/src/components/Toolbar/Toolbar.tsx +173 -29
- package/src/components/Tooltip/Tooltip.stories.tsx +18 -17
- package/src/components/Tooltip/Tooltip.tsx +16 -16
- package/src/components/index.ts +8 -5
- package/src/exemplars/generics.stories.tsx +12 -15
- package/src/exemplars/slot.stories.tsx +68 -61
- package/src/exemplars/tabster.stories.tsx +5 -5
- package/src/exemplars/virtualizer.stories.tsx +136 -0
- package/src/hooks/index.ts +1 -0
- package/src/hooks/useDensityContext.ts +2 -2
- package/src/playground/Controls.stories.tsx +0 -6
- package/src/playground/Custom.stories.tsx +13 -16
- package/src/playground/Typography.stories.tsx +1 -1
- package/src/primitives/Column/AUDIT.md +148 -0
- package/src/primitives/Column/Column.stories.tsx +181 -0
- package/src/primitives/Column/Column.tsx +165 -0
- package/src/primitives/Column/index.ts +5 -0
- package/src/primitives/Container/Container.stories.tsx +13 -51
- package/src/primitives/Container/Container.tsx +14 -74
- package/src/primitives/Container/index.ts +0 -1
- package/src/primitives/Flex/Flex.stories.tsx +57 -0
- package/src/primitives/Flex/Flex.tsx +20 -19
- package/src/primitives/Grid/Grid.stories.tsx +56 -0
- package/src/primitives/Grid/Grid.tsx +30 -0
- package/src/primitives/Grid/index.ts +5 -0
- package/src/primitives/Panel/Panel.stories.tsx +68 -0
- package/src/primitives/Panel/Panel.tsx +120 -0
- package/src/primitives/Panel/index.ts +5 -0
- package/src/primitives/index.ts +3 -0
- package/src/testing/Loading.tsx +47 -0
- package/src/testing/decorators/withLayout.tsx +15 -11
- package/src/testing/decorators/withLayoutVariants.tsx +18 -21
- package/src/testing/decorators/withTheme.tsx +10 -7
- package/src/testing/index.ts +2 -0
- package/src/translations.ts +19 -0
- package/src/util/usePx.ts +1 -0
- package/dist/lib/browser/chunk-6DTBPJE4.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-JKHQSGNU.mjs.map +0 -7
- package/dist/types/src/components/AnchoredOverflow/AnchoredOverflow.d.ts +0 -22
- package/dist/types/src/components/AnchoredOverflow/AnchoredOverflow.d.ts.map +0 -1
- package/dist/types/src/components/AnchoredOverflow/index.d.ts +0 -2
- package/dist/types/src/components/AnchoredOverflow/index.d.ts.map +0 -1
- package/dist/types/src/primitives/Container/Layout.d.ts +0 -18
- package/dist/types/src/primitives/Container/Layout.d.ts.map +0 -1
- package/dist/types/src/primitives/Container/Layout.stories.d.ts +0 -10
- package/dist/types/src/primitives/Container/Layout.stories.d.ts.map +0 -1
- package/src/components/AnchoredOverflow/AnchoredOverflow.tsx +0 -57
- package/src/components/AnchoredOverflow/index.ts +0 -5
- package/src/primitives/Container/Layout.stories.tsx +0 -57
- package/src/primitives/Container/Layout.tsx +0 -61
|
@@ -2,85 +2,64 @@
|
|
|
2
2
|
// Copyright 2023 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
+
import { Primitive } from '@radix-ui/react-primitive';
|
|
5
6
|
import { Slot } from '@radix-ui/react-slot';
|
|
6
7
|
import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
7
|
-
import React, {
|
|
8
|
+
import React, { PropsWithChildren } from 'react';
|
|
8
9
|
|
|
9
|
-
import { mx } from '@dxos/ui-theme';
|
|
10
|
-
import { type SlottableClassName, type SlottableProps, type ThemedClassName } from '@dxos/ui-types';
|
|
10
|
+
import { composable, composableProps, mx, slottable } from '@dxos/ui-theme';
|
|
11
11
|
|
|
12
12
|
import { withTheme } from '../testing';
|
|
13
|
+
import { ThemedClassName } from '../util';
|
|
13
14
|
|
|
14
15
|
/**
|
|
15
|
-
*
|
|
16
|
-
*
|
|
16
|
+
* Radix-style composition.
|
|
17
17
|
* All Radix primitive parts that render a DOM element accept an asChild prop.
|
|
18
|
-
* When asChild is set to true, Radix will not render a default DOM element,
|
|
18
|
+
* When asChild is set to true, Radix will not render a default DOM element,
|
|
19
|
+
* instead cloning the part's child and passing it the props and behavior required to make it functional.
|
|
19
20
|
* https://www.radix-ui.com/primitives/docs/guides/composition
|
|
20
21
|
*/
|
|
21
22
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
const Root = asChild ? Slot : 'div';
|
|
23
|
+
const Outer = slottable<HTMLDivElement, { priority?: number }>(
|
|
24
|
+
({ children, asChild, priority, ...props }, forwardedRef) => {
|
|
25
|
+
const Comp = asChild ? Slot : Primitive.div;
|
|
26
26
|
return (
|
|
27
|
-
<
|
|
27
|
+
<Comp
|
|
28
|
+
{...composableProps<HTMLDivElement>(props, { classNames: 'p-2 border border-red-500 rounded' })}
|
|
29
|
+
ref={forwardedRef}
|
|
30
|
+
>
|
|
28
31
|
{children}
|
|
29
|
-
</
|
|
32
|
+
</Comp>
|
|
30
33
|
);
|
|
31
34
|
},
|
|
32
35
|
);
|
|
33
36
|
|
|
34
|
-
|
|
35
|
-
const
|
|
36
|
-
(
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
);
|
|
45
|
-
|
|
46
|
-
// Leaf component (like Card.Root).
|
|
47
|
-
const Leaf = forwardRef<HTMLButtonElement, SlottableClassName<PropsWithChildren>>(
|
|
48
|
-
({ className, classNames, children, ...props }, forwardedRef) => {
|
|
49
|
-
return (
|
|
50
|
-
<button {...props} className={mx('p-2 outline-none border rounded', className, classNames)} ref={forwardedRef}>
|
|
51
|
-
{children}
|
|
52
|
-
</button>
|
|
53
|
-
);
|
|
54
|
-
},
|
|
55
|
-
);
|
|
56
|
-
|
|
57
|
-
// Test 1: Single asChild.
|
|
58
|
-
const TestSingle = ({ classNames, ...props }: ThemedClassName<{ role?: string }>) => (
|
|
59
|
-
<Outer asChild {...props} className={mx('p-2', classNames)}>
|
|
60
|
-
<Leaf>Single asChild</Leaf>
|
|
61
|
-
</Outer>
|
|
62
|
-
);
|
|
37
|
+
const Middle = slottable<HTMLDivElement>(({ children, asChild, ...props }, forwardedRef) => {
|
|
38
|
+
const Comp = asChild ? Slot : Primitive.div;
|
|
39
|
+
return (
|
|
40
|
+
<Comp
|
|
41
|
+
{...composableProps<HTMLDivElement>(props, { classNames: 'p-2 border border-red-500 rounded' })}
|
|
42
|
+
ref={forwardedRef}
|
|
43
|
+
>
|
|
44
|
+
{children}
|
|
45
|
+
</Comp>
|
|
46
|
+
);
|
|
47
|
+
});
|
|
63
48
|
|
|
64
|
-
|
|
65
|
-
const TestNested = ({ classNames, ...props }: ThemedClassName<{ role?: string }>) => {
|
|
49
|
+
const Leaf = composable<HTMLButtonElement>(({ children, ...props }, forwardedRef) => {
|
|
66
50
|
return (
|
|
67
|
-
<
|
|
68
|
-
<
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
51
|
+
<button
|
|
52
|
+
{...composableProps<HTMLButtonElement>(props, { classNames: 'p-2 border border-red-500 rounded' })}
|
|
53
|
+
ref={forwardedRef}
|
|
54
|
+
>
|
|
55
|
+
{children}
|
|
56
|
+
</button>
|
|
72
57
|
);
|
|
73
|
-
};
|
|
58
|
+
});
|
|
74
59
|
|
|
75
|
-
|
|
76
|
-
const
|
|
77
|
-
<
|
|
78
|
-
<Middle asChild>
|
|
79
|
-
<Leaf>
|
|
80
|
-
<div role='none'>Leaf</div>
|
|
81
|
-
</Leaf>
|
|
82
|
-
</Middle>
|
|
83
|
-
</Outer>
|
|
60
|
+
/** This isn't a valid child for a `slottable` component. */
|
|
61
|
+
const Simple = ({ children, classNames }: ThemedClassName<PropsWithChildren>) => (
|
|
62
|
+
<div className={mx(classNames)}>{children}</div>
|
|
84
63
|
);
|
|
85
64
|
|
|
86
65
|
const meta = {
|
|
@@ -96,13 +75,41 @@ export default meta;
|
|
|
96
75
|
type Story = StoryObj<typeof meta>;
|
|
97
76
|
|
|
98
77
|
export const Single: Story = {
|
|
99
|
-
render: () =>
|
|
78
|
+
render: () => (
|
|
79
|
+
<Outer asChild role='article' classNames='border-green-500' priority={1}>
|
|
80
|
+
<Leaf>Single asChild (non-compliant — see console)</Leaf>
|
|
81
|
+
</Outer>
|
|
82
|
+
),
|
|
100
83
|
};
|
|
101
84
|
|
|
102
85
|
export const Nested: Story = {
|
|
103
|
-
render: () =>
|
|
86
|
+
render: () => (
|
|
87
|
+
<Outer asChild role='article' classNames='border-blue-500'>
|
|
88
|
+
<Middle asChild>
|
|
89
|
+
<Leaf>Nested asChild</Leaf>
|
|
90
|
+
</Middle>
|
|
91
|
+
</Outer>
|
|
92
|
+
),
|
|
104
93
|
};
|
|
105
94
|
|
|
106
95
|
export const Inner: Story = {
|
|
107
|
-
render: () =>
|
|
96
|
+
render: () => (
|
|
97
|
+
<Outer asChild role='article' classNames='border-orange-500'>
|
|
98
|
+
<Middle asChild>
|
|
99
|
+
<Leaf>
|
|
100
|
+
<div>Leaf</div>
|
|
101
|
+
</Leaf>
|
|
102
|
+
</Middle>
|
|
103
|
+
</Outer>
|
|
104
|
+
),
|
|
105
|
+
};
|
|
106
|
+
|
|
107
|
+
export const Error: Story = {
|
|
108
|
+
render: () => (
|
|
109
|
+
<Outer asChild role='none' classNames='p-2 border border-green-500 rounded'>
|
|
110
|
+
<Middle asChild>
|
|
111
|
+
<Simple>Simple</Simple>
|
|
112
|
+
</Middle>
|
|
113
|
+
</Outer>
|
|
114
|
+
),
|
|
108
115
|
};
|
|
@@ -21,14 +21,14 @@ import { mx } from '@dxos/ui-theme';
|
|
|
21
21
|
// TODO(burdon): Prevent tab out of app.
|
|
22
22
|
|
|
23
23
|
const border =
|
|
24
|
-
'rounded-
|
|
24
|
+
'rounded-xs outline-hidden border border-subdued-separator focus:border-primary-500 focus-within:border-rose-500';
|
|
25
25
|
|
|
26
26
|
const Board = forwardRef<HTMLDivElement, { columns: string[][] }>(({ columns }, ref) => {
|
|
27
27
|
const arrowNavigationAttrs = useArrowNavigationGroup({ axis: 'horizontal', memorizeCurrent: true, tabbable: true });
|
|
28
28
|
|
|
29
29
|
return (
|
|
30
|
-
<div ref={ref} tabIndex={0} {...arrowNavigationAttrs} className='flex
|
|
31
|
-
<div className={mx('flex
|
|
30
|
+
<div ref={ref} tabIndex={0} {...arrowNavigationAttrs} className='flex h-full w-full overflow-hidden'>
|
|
31
|
+
<div className={mx('flex h-full overflow-x-auto p-4 gap-4')}>
|
|
32
32
|
{columns.map((column) => (
|
|
33
33
|
<Column key={column[0]} items={column} />
|
|
34
34
|
))}
|
|
@@ -43,7 +43,7 @@ const Column = forwardRef<HTMLDivElement, { items: string[] }>(({ items }, ref)
|
|
|
43
43
|
const tabsterAttrs = useMergedTabsterAttributes_unstable(focusableGroupAttrs, arrowNavigationAttrs);
|
|
44
44
|
|
|
45
45
|
return (
|
|
46
|
-
<ScrollArea.Root
|
|
46
|
+
<ScrollArea.Root orientation='vertical' classNames={mx('w-[25rem]', border)}>
|
|
47
47
|
<ScrollArea.Viewport {...tabsterAttrs} classNames='p-4 gap-4' ref={ref}>
|
|
48
48
|
{items.map((item) => (
|
|
49
49
|
<Item key={item} value={item} />
|
|
@@ -61,7 +61,7 @@ const Item = forwardRef<HTMLDivElement, { value: string }>(({ value }, ref) => {
|
|
|
61
61
|
ref={ref}
|
|
62
62
|
tabIndex={0}
|
|
63
63
|
{...focusableGroupAttrs}
|
|
64
|
-
className={mx('flex shrink-0
|
|
64
|
+
className={mx('flex shrink-0 w-full gap-4 p-4 items-center', border)}
|
|
65
65
|
>
|
|
66
66
|
<Input.Root>
|
|
67
67
|
<Input.Checkbox />
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2023 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { type Meta } from '@storybook/react-vite';
|
|
6
|
+
import { useVirtualizer } from '@tanstack/react-virtual';
|
|
7
|
+
import React, { useEffect, useMemo, useRef, useState } from 'react';
|
|
8
|
+
|
|
9
|
+
import { random } from '@dxos/random';
|
|
10
|
+
import { Panel, ScrollArea, Toolbar } from '@dxos/react-ui';
|
|
11
|
+
import { withLayout, withTheme } from '@dxos/react-ui/testing';
|
|
12
|
+
|
|
13
|
+
random.seed(999);
|
|
14
|
+
|
|
15
|
+
type TestItem = {
|
|
16
|
+
name: string;
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
const meta: Meta = {
|
|
20
|
+
title: 'ui/react-ui-core/exemplars/virtualizer',
|
|
21
|
+
decorators: [withLayout({ layout: 'column' }), withTheme()],
|
|
22
|
+
parameters: {
|
|
23
|
+
layout: 'fullscreen',
|
|
24
|
+
},
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
export default meta;
|
|
28
|
+
|
|
29
|
+
const NUM_ITEMS = 500;
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* https://tanstack.com/virtual/latest/docs/introduction
|
|
33
|
+
*/
|
|
34
|
+
export const Default = {
|
|
35
|
+
render: () => {
|
|
36
|
+
const [index, setIndex] = useState(0);
|
|
37
|
+
const items = useMemo<TestItem[]>(
|
|
38
|
+
() =>
|
|
39
|
+
Array.from({ length: NUM_ITEMS }, () => ({
|
|
40
|
+
name: random.lorem.paragraph(),
|
|
41
|
+
})),
|
|
42
|
+
[],
|
|
43
|
+
);
|
|
44
|
+
|
|
45
|
+
const parentRef = useRef(null);
|
|
46
|
+
const [viewport, setViewport] = useState<HTMLElement | null>(null);
|
|
47
|
+
const virtualizer = useVirtualizer({
|
|
48
|
+
getScrollElement: () => viewport,
|
|
49
|
+
estimateSize: () => 40,
|
|
50
|
+
count: items.length,
|
|
51
|
+
gap: 8,
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
useEffect(() => {
|
|
55
|
+
virtualizer.scrollToIndex(index, { align: 'start' });
|
|
56
|
+
}, [virtualizer, index]);
|
|
57
|
+
|
|
58
|
+
const virtualItems = virtualizer.getVirtualItems();
|
|
59
|
+
|
|
60
|
+
return (
|
|
61
|
+
<Panel.Root>
|
|
62
|
+
<Panel.Toolbar asChild>
|
|
63
|
+
<ScrollToolbar items={items} index={index} setIndex={setIndex} />
|
|
64
|
+
</Panel.Toolbar>
|
|
65
|
+
<Panel.Content asChild>
|
|
66
|
+
<ScrollArea.Root orientation='vertical' centered>
|
|
67
|
+
<ScrollArea.Viewport classNames='p-2' ref={setViewport}>
|
|
68
|
+
<div
|
|
69
|
+
style={{
|
|
70
|
+
position: 'relative',
|
|
71
|
+
height: virtualizer.getTotalSize(),
|
|
72
|
+
width: '100%',
|
|
73
|
+
}}
|
|
74
|
+
ref={parentRef}
|
|
75
|
+
>
|
|
76
|
+
{virtualItems.map((virtualItem) => (
|
|
77
|
+
<div
|
|
78
|
+
key={virtualItem.key}
|
|
79
|
+
role='list'
|
|
80
|
+
className='grid grid-cols-[3rem_1fr] overflow-hidden border border-separator rounded-xs'
|
|
81
|
+
style={{
|
|
82
|
+
position: 'absolute',
|
|
83
|
+
top: 0,
|
|
84
|
+
left: 0,
|
|
85
|
+
width: '100%',
|
|
86
|
+
transform: `translateY(${virtualItem.start}px)`,
|
|
87
|
+
}}
|
|
88
|
+
data-index={virtualItem.index}
|
|
89
|
+
ref={virtualizer.measureElement}
|
|
90
|
+
>
|
|
91
|
+
<div className='p-1'>{virtualItem.index + 1}</div>
|
|
92
|
+
<div className='p-1'>{items[virtualItem.index].name}</div>
|
|
93
|
+
</div>
|
|
94
|
+
))}
|
|
95
|
+
</div>
|
|
96
|
+
</ScrollArea.Viewport>
|
|
97
|
+
</ScrollArea.Root>
|
|
98
|
+
</Panel.Content>
|
|
99
|
+
</Panel.Root>
|
|
100
|
+
);
|
|
101
|
+
},
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
const ScrollToolbar = ({
|
|
105
|
+
items,
|
|
106
|
+
index,
|
|
107
|
+
setIndex,
|
|
108
|
+
}: {
|
|
109
|
+
items: any[];
|
|
110
|
+
index: number;
|
|
111
|
+
setIndex: (index: number) => void;
|
|
112
|
+
}) => {
|
|
113
|
+
return (
|
|
114
|
+
<Toolbar.Root classNames='grid grid-cols-3'>
|
|
115
|
+
<div />
|
|
116
|
+
<div className='flex justify-center gap-1'>
|
|
117
|
+
<Toolbar.IconButton icon='ph--arrow-line-left--regular' iconOnly label='start' onClick={() => setIndex(0)} />
|
|
118
|
+
<Toolbar.IconButton
|
|
119
|
+
icon='ph--arrows-out-line-horizontal--regular'
|
|
120
|
+
iconOnly
|
|
121
|
+
label='random'
|
|
122
|
+
onClick={() => setIndex(Math.floor(Math.random() * items.length))}
|
|
123
|
+
/>
|
|
124
|
+
<Toolbar.IconButton
|
|
125
|
+
icon='ph--arrow-line-right--regular'
|
|
126
|
+
iconOnly
|
|
127
|
+
label='end'
|
|
128
|
+
onClick={() => setIndex(items.length - 1)}
|
|
129
|
+
/>
|
|
130
|
+
</div>
|
|
131
|
+
<div className='p-1 text-right'>
|
|
132
|
+
{index + 1}/{items.length}
|
|
133
|
+
</div>
|
|
134
|
+
</Toolbar.Root>
|
|
135
|
+
);
|
|
136
|
+
};
|
package/src/hooks/index.ts
CHANGED
|
@@ -6,6 +6,7 @@ export * from './useDensityContext';
|
|
|
6
6
|
export * from './useElevationContext';
|
|
7
7
|
export * from './useIconHref';
|
|
8
8
|
export * from './useSafeArea';
|
|
9
|
+
export * from './useSafeCollisionPadding';
|
|
9
10
|
export * from './useTranslationsContext';
|
|
10
11
|
export * from './useThemeContext';
|
|
11
12
|
export * from './useVisualViewport';
|
|
@@ -8,7 +8,7 @@ import { type Density } from '@dxos/ui-types';
|
|
|
8
8
|
|
|
9
9
|
import { DensityContext } from '../components';
|
|
10
10
|
|
|
11
|
-
export const useDensityContext = (
|
|
11
|
+
export const useDensityContext = (densityProp?: Density): Density | undefined => {
|
|
12
12
|
const { density } = useContext(DensityContext);
|
|
13
|
-
return
|
|
13
|
+
return densityProp ?? density;
|
|
14
14
|
};
|
|
@@ -31,9 +31,6 @@ const DefaultStory = () => {
|
|
|
31
31
|
</Select.Content>
|
|
32
32
|
</Select.Portal>
|
|
33
33
|
</Select.Root>
|
|
34
|
-
{/* TODO(burdon): Highlight is cyan. */}
|
|
35
|
-
{/* TODO(burdon): Show vertical divider by default. */}
|
|
36
|
-
{/* TODO(burdon): Icon sizes should adapt to density. */}
|
|
37
34
|
<Toolbar.ToggleGroup type='multiple'>
|
|
38
35
|
<Toolbar.ToggleGroupItem value='a'>
|
|
39
36
|
<Icon icon='ph--text-b--regular' />
|
|
@@ -45,7 +42,6 @@ const DefaultStory = () => {
|
|
|
45
42
|
<Icon icon='ph--text-underline--regular' />
|
|
46
43
|
</Toolbar.ToggleGroupItem>
|
|
47
44
|
</Toolbar.ToggleGroup>
|
|
48
|
-
{/* TODO(burdon): Highlight isn't shown. */}
|
|
49
45
|
<Toolbar.ToggleGroup type='single' defaultValue='a'>
|
|
50
46
|
<Toolbar.ToggleGroupItem value='a'>
|
|
51
47
|
<Icon icon='ph--file-ts--regular' />
|
|
@@ -59,11 +55,9 @@ const DefaultStory = () => {
|
|
|
59
55
|
<Icon icon='ph--bug--regular' />
|
|
60
56
|
</Toggle>
|
|
61
57
|
</Toolbar.Button>
|
|
62
|
-
{/* TODO(burdon): Should not be 'is-full' by default. */}
|
|
63
58
|
<Input.Root>
|
|
64
59
|
<Input.TextInput placeholder='Enter text...' />
|
|
65
60
|
</Input.Root>
|
|
66
|
-
{/* TODO(burdon): Checkbox collapsed. */}
|
|
67
61
|
<Input.Root>
|
|
68
62
|
<Input.Checkbox checked={checked} onCheckedChange={(value) => setChecked(!!value)} />
|
|
69
63
|
<Input.Label>Checkbox</Input.Label>
|
|
@@ -20,17 +20,16 @@ const DefaultStory = ({ children, ...args }: Omit<ButtonProps, 'ref'>) => {
|
|
|
20
20
|
</Button>
|
|
21
21
|
</div>
|
|
22
22
|
<div className='flex justify-center'>
|
|
23
|
-
<IconButton {...args} label='Test' icon='ph--
|
|
23
|
+
<IconButton {...args} label='Test' icon='ph--circle--regular' density='coarse' />
|
|
24
24
|
</div>
|
|
25
25
|
<div className='flex justify-center'>
|
|
26
26
|
<IconButton
|
|
27
27
|
{...args}
|
|
28
28
|
label='Test'
|
|
29
|
-
icon='ph--
|
|
29
|
+
icon='ph--circle--regular'
|
|
30
30
|
iconOnly
|
|
31
|
-
size={7}
|
|
32
31
|
density='coarse'
|
|
33
|
-
classNames='
|
|
32
|
+
classNames='px-1.5'
|
|
34
33
|
/>
|
|
35
34
|
</div>
|
|
36
35
|
</div>
|
|
@@ -43,16 +42,16 @@ const DefaultStory = ({ children, ...args }: Omit<ButtonProps, 'ref'>) => {
|
|
|
43
42
|
</Button>
|
|
44
43
|
</div>
|
|
45
44
|
<div className='flex justify-center'>
|
|
46
|
-
<IconButton {...args} label='Test' icon='ph--
|
|
45
|
+
<IconButton {...args} label='Test' icon='ph--circle--regular' density='fine' classNames='px-2' />
|
|
47
46
|
</div>
|
|
48
47
|
<div className='flex justify-center'>
|
|
49
48
|
<IconButton
|
|
50
49
|
{...args}
|
|
51
50
|
label='Test'
|
|
52
|
-
icon='ph--
|
|
51
|
+
icon='ph--circle--regular'
|
|
53
52
|
iconOnly
|
|
54
53
|
density='fine'
|
|
55
|
-
classNames='
|
|
54
|
+
classNames='py-1 px-1.5'
|
|
56
55
|
/>
|
|
57
56
|
</div>
|
|
58
57
|
</div>
|
|
@@ -60,7 +59,7 @@ const DefaultStory = ({ children, ...args }: Omit<ButtonProps, 'ref'>) => {
|
|
|
60
59
|
{/* Small */}
|
|
61
60
|
<div className='grid grid-cols-3 gap-4'>
|
|
62
61
|
<div className='flex justify-center'>
|
|
63
|
-
<Button {...args} density='fine' classNames={'!h-[24px] !text-[14px] p-0
|
|
62
|
+
<Button {...args} density='fine' classNames={'!h-[24px] !text-[14px] p-0 px-1.5 min-h-0'}>
|
|
64
63
|
{children}
|
|
65
64
|
</Button>
|
|
66
65
|
</div>
|
|
@@ -68,35 +67,33 @@ const DefaultStory = ({ children, ...args }: Omit<ButtonProps, 'ref'>) => {
|
|
|
68
67
|
<IconButton
|
|
69
68
|
{...args}
|
|
70
69
|
label='Test'
|
|
71
|
-
icon='ph--
|
|
70
|
+
icon='ph--circle--regular'
|
|
72
71
|
density='fine'
|
|
73
|
-
|
|
74
|
-
classNames={'!h-[24px] !text-[14px] p-1 min-bs-0 gap-0.5'}
|
|
72
|
+
classNames={'!h-[24px] !text-[14px] p-1 min-h-0 gap-0.5'}
|
|
75
73
|
/>
|
|
76
74
|
</div>
|
|
77
75
|
<div className='flex justify-center'>
|
|
78
76
|
<IconButton
|
|
79
77
|
{...args}
|
|
80
78
|
label='Test'
|
|
81
|
-
icon='ph--
|
|
79
|
+
icon='ph--circle--regular'
|
|
82
80
|
iconOnly
|
|
83
81
|
density='fine'
|
|
84
|
-
|
|
85
|
-
classNames={'!h-[24px] !text-[14px] p-1 min-bs-0'}
|
|
82
|
+
classNames={'!h-[24px] !text-[14px] p-1 min-h-0'}
|
|
86
83
|
/>
|
|
87
84
|
</div>
|
|
88
85
|
</div>
|
|
89
86
|
|
|
90
87
|
{/* TODO(burdon): Full variant with max width. */}
|
|
91
88
|
<div className='flex justify-center'>
|
|
92
|
-
<Button classNames='
|
|
89
|
+
<Button classNames='w-full max-w-[15rem] rounded-sm' variant='default'>
|
|
93
90
|
Test
|
|
94
91
|
</Button>
|
|
95
92
|
</div>
|
|
96
93
|
<div className='flex justify-center'>
|
|
97
94
|
{/* TODO(burdon): Option to have button on RHS. Default size for icon should be 5 for this (medium) density. */}
|
|
98
95
|
<IconButton
|
|
99
|
-
classNames='
|
|
96
|
+
classNames='w-full max-w-[15rem] rounded-sm'
|
|
100
97
|
variant='primary'
|
|
101
98
|
icon='ph--arrows-clockwise--regular'
|
|
102
99
|
label='Test'
|
|
@@ -9,7 +9,7 @@ import { withTheme } from '../testing';
|
|
|
9
9
|
|
|
10
10
|
const DefaultStory = () => {
|
|
11
11
|
return (
|
|
12
|
-
<div className='
|
|
12
|
+
<div className='mx-auto p-8 max-w-[60rem] space-b-4'>
|
|
13
13
|
<h1 className='text-4xl font-medium'>
|
|
14
14
|
Việc <span className='italic'>thừa</span> nhận{' '}
|
|
15
15
|
<span className='font-mono bg-neutral-500/10'>
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
# Column architecture reference
|
|
2
|
+
|
|
3
|
+
## Background
|
|
4
|
+
|
|
5
|
+
`Column` establishes a 3-column CSS grid with left/right gutter columns and a center content
|
|
6
|
+
channel. Two CSS custom properties drive the system:
|
|
7
|
+
|
|
8
|
+
- `--gutter` — the gutter track width (e.g. `var(--dx-gutter-md)`); consumed by `ScrollArea.Viewport` for padding.
|
|
9
|
+
- `--dx-col` — the grid-column placement token; set by `Column.Root` and consumed by `withColumn` utilities.
|
|
10
|
+
|
|
11
|
+
## Column primitives
|
|
12
|
+
|
|
13
|
+
### Column.Root
|
|
14
|
+
|
|
15
|
+
```css
|
|
16
|
+
/* column.ts — columnRoot */
|
|
17
|
+
dx-column grid
|
|
18
|
+
/* inline style */
|
|
19
|
+
--gutter: <gutterSize>
|
|
20
|
+
--dx-col: 2 / span 1
|
|
21
|
+
grid-template-columns: <gutter> minmax(0,1fr) <gutter>
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
Sets the 3-column grid and both CSS variables. All `withColumn` utilities are no-ops outside this context.
|
|
25
|
+
|
|
26
|
+
### Column.Center
|
|
27
|
+
|
|
28
|
+
```css
|
|
29
|
+
/* column.ts — columnCenter */
|
|
30
|
+
[grid-column:var(--dx-col,auto)] min-h-0
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
Places a single element in col 2 (the center track). Does not use subgrid — placement is explicit
|
|
34
|
+
on this element only, so arbitrary compound components (including `display: contents` wrappers) can
|
|
35
|
+
be nested safely.
|
|
36
|
+
|
|
37
|
+
### Column.Bleed
|
|
38
|
+
|
|
39
|
+
```css
|
|
40
|
+
/* column.ts — columnBleed */
|
|
41
|
+
col-span-full grid grid-cols-subgrid min-h-0
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
Spans all 3 columns and propagates the subgrid. Use for `ScrollArea`, full-width dividers, and
|
|
45
|
+
any content that should ignore the gutters.
|
|
46
|
+
|
|
47
|
+
### Column.Row
|
|
48
|
+
|
|
49
|
+
```css
|
|
50
|
+
/* column.ts — columnRow */
|
|
51
|
+
col-span-3 grid grid-cols-subgrid
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
Three-slot icon row. Children map to: `[col-1: icon/slot] [col-2: content] [col-3: icon/action]`.
|
|
55
|
+
Must be a direct child of `Column.Root`.
|
|
56
|
+
|
|
57
|
+
## withColumn theme utilities
|
|
58
|
+
|
|
59
|
+
Exported from `@dxos/ui-theme`. Components import and call these in their theme functions to
|
|
60
|
+
participate in the Column grid without importing Column React components.
|
|
61
|
+
|
|
62
|
+
```ts
|
|
63
|
+
withColumn.center();
|
|
64
|
+
// → '[grid-column:var(--dx-col,auto)]'
|
|
65
|
+
|
|
66
|
+
withColumn.propagate();
|
|
67
|
+
// → '[.dx-column_&]:col-span-full [.dx-column_&]:grid [.dx-column_&]:grid-cols-subgrid'
|
|
68
|
+
|
|
69
|
+
withColumn.consumed();
|
|
70
|
+
// → '[--dx-col:auto]'
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
| Utility | Purpose | Where used |
|
|
74
|
+
| :------------ | :-------------------------------------------------------------------------------- | :---------------------------------------------------------------------------- |
|
|
75
|
+
| `center()` | Place element in col 2 via `--dx-col`. No-op outside Column or inside ScrollArea. | Dialog.Header, Dialog.ActionBar, Form.Content, Form.Actions, SearchList.Input |
|
|
76
|
+
| `propagate()` | Extend Column subgrid to children. No-op outside Column. | Dialog.Body, SearchList.Content |
|
|
77
|
+
| `consumed()` | Reset `--dx-col` after `--gutter` is consumed. | ScrollArea.Viewport |
|
|
78
|
+
|
|
79
|
+
## CSS custom property cascade
|
|
80
|
+
|
|
81
|
+
```text
|
|
82
|
+
Column.Root
|
|
83
|
+
sets --gutter = var(--dx-gutter-<size>)
|
|
84
|
+
sets --dx-col = 2 / span 1
|
|
85
|
+
│
|
|
86
|
+
├─ Column.Center → grid-column: var(--dx-col) ← consumes --dx-col
|
|
87
|
+
├─ Column.Bleed → col-span-full, subgrid
|
|
88
|
+
├─ Column.Row → col-span-3, subgrid
|
|
89
|
+
│
|
|
90
|
+
└─ withColumn.center() → grid-column: var(--dx-col) ← consumes --dx-col
|
|
91
|
+
withColumn.propagate() → col-span-full, grid, subgrid (inside .dx-column only)
|
|
92
|
+
│
|
|
93
|
+
└─ ScrollArea.Root → col-span-full (inside .dx-column only)
|
|
94
|
+
ScrollArea.Viewport
|
|
95
|
+
applies pl/pr using --gutter
|
|
96
|
+
withColumn.consumed() → sets --dx-col: auto
|
|
97
|
+
│
|
|
98
|
+
└─ (nested components no longer auto-position)
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
## Component integration
|
|
102
|
+
|
|
103
|
+
### Dialog
|
|
104
|
+
|
|
105
|
+
| Sub-component | withColumn applied | Effect |
|
|
106
|
+
| :----------------- | :---------------------------- | :---------------------------- |
|
|
107
|
+
| `Dialog.Content` | `Column.Root` (gutter `'sm'`) | Establishes the 3-col grid. |
|
|
108
|
+
| `Dialog.Header` | `withColumn.center()` | Placed in col 2. |
|
|
109
|
+
| `Dialog.Body` | `withColumn.propagate()` | Children inherit the subgrid. |
|
|
110
|
+
| `Dialog.ActionBar` | `withColumn.center()` | Placed in col 2. |
|
|
111
|
+
|
|
112
|
+
### Form
|
|
113
|
+
|
|
114
|
+
| Sub-component | withColumn applied | Effect |
|
|
115
|
+
| :------------- | :-------------------- | :---------------------------------- |
|
|
116
|
+
| `Form.Content` | `withColumn.center()` | Placed in col 2 when inside Column. |
|
|
117
|
+
| `Form.Actions` | `withColumn.center()` | Placed in col 2 when inside Column. |
|
|
118
|
+
|
|
119
|
+
### SearchList
|
|
120
|
+
|
|
121
|
+
| Sub-component | withColumn applied | Effect |
|
|
122
|
+
| :------------------------- | :----------------------- | :---------------------------------------------- |
|
|
123
|
+
| `SearchList.Content` | `withColumn.propagate()` | Extends subgrid to children when inside Column. |
|
|
124
|
+
| `SearchList.Input` wrapper | `withColumn.center()` | Input row placed in col 2. |
|
|
125
|
+
|
|
126
|
+
### Card
|
|
127
|
+
|
|
128
|
+
`Card.Row` uses its own inline subgrid CSS (`col-span-3 grid grid-cols-subgrid`) and does not
|
|
129
|
+
participate in an outer Column grid. `Card.Root` establishes a separate 3-column grid for its
|
|
130
|
+
own icon-slot layout.
|
|
131
|
+
|
|
132
|
+
## Subgrid chain integrity
|
|
133
|
+
|
|
134
|
+
Every intermediate container between `Column.Root` and a `ScrollArea.Root` must propagate the
|
|
135
|
+
subgrid, otherwise `ScrollArea.Root`'s `[.dx-column_&]:col-span-full` selector will not match
|
|
136
|
+
and the scrollbar will not extend to the gutter.
|
|
137
|
+
|
|
138
|
+
Required chain:
|
|
139
|
+
|
|
140
|
+
```
|
|
141
|
+
Column.Root (.dx-column)
|
|
142
|
+
→ withColumn.propagate() container (col-span-full, grid, grid-cols-subgrid)
|
|
143
|
+
→ ScrollArea.Root (.dx-container, [.dx-column_&]:col-span-full)
|
|
144
|
+
→ ScrollArea.Viewport (applies --gutter padding, resets --dx-col)
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
If any intermediate element wraps the ScrollArea without propagating, use `Column.Bleed` or
|
|
148
|
+
apply `withColumn.propagate()` to that wrapper.
|