@dxos/react-ui 0.8.4-main.406dc2a → 0.8.4-main.52d7546f51
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 +774 -0
- package/dist/lib/browser/chunk-6DTBPJE4.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +3200 -64
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/testing/index.mjs +37 -48
- package/dist/lib/browser/testing/index.mjs.map +4 -4
- package/dist/lib/node-esm/chunk-JKHQSGNU.mjs +776 -0
- package/dist/lib/node-esm/chunk-JKHQSGNU.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +3200 -64
- 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 +37 -48
- package/dist/lib/node-esm/testing/index.mjs.map +4 -4
- package/dist/types/src/components/AnchoredOverflow/AnchoredOverflow.d.ts +7 -0
- package/dist/types/src/components/AnchoredOverflow/AnchoredOverflow.d.ts.map +1 -1
- package/dist/types/src/components/Avatars/Avatar.d.ts.map +1 -1
- package/dist/types/src/components/Breadcrumb/Breadcrumb.d.ts.map +1 -1
- package/dist/types/src/components/{Buttons → Button}/Button.d.ts +1 -1
- package/dist/types/src/components/Button/Button.d.ts.map +1 -0
- package/dist/types/src/components/Button/Button.stories.d.ts.map +1 -0
- package/dist/types/src/components/{Buttons → Button}/IconButton.d.ts +2 -2
- package/dist/types/src/components/Button/IconButton.d.ts.map +1 -0
- package/dist/types/src/components/Button/IconButton.stories.d.ts.map +1 -0
- package/dist/types/src/components/Button/Toggle.d.ts.map +1 -0
- package/dist/types/src/components/Button/Toggle.stories.d.ts +16 -0
- package/dist/types/src/components/Button/Toggle.stories.d.ts.map +1 -0
- package/dist/types/src/components/{Buttons → Button}/ToggleGroup.d.ts +4 -4
- package/dist/types/src/components/Button/ToggleGroup.d.ts.map +1 -0
- package/dist/types/src/components/{Buttons → Button}/ToggleGroup.stories.d.ts +4 -4
- package/dist/types/src/components/Button/ToggleGroup.stories.d.ts.map +1 -0
- package/dist/types/src/components/Button/index.d.ts.map +1 -0
- package/dist/types/src/components/Clipboard/CopyButton.d.ts +1 -1
- package/dist/types/src/components/Clipboard/CopyButton.d.ts.map +1 -1
- package/dist/types/src/components/DensityProvider/DensityProvider.d.ts +1 -1
- package/dist/types/src/components/DensityProvider/DensityProvider.d.ts.map +1 -1
- package/dist/types/src/components/Dialog/AlertDialog.d.ts.map +1 -0
- package/dist/types/src/components/Dialog/AlertDialog.stories.d.ts.map +1 -0
- package/dist/types/src/components/Dialog/Dialog.d.ts +46 -0
- package/dist/types/src/components/Dialog/Dialog.d.ts.map +1 -0
- package/dist/types/src/components/{Dialogs → Dialog}/Dialog.stories.d.ts +7 -5
- package/dist/types/src/components/Dialog/Dialog.stories.d.ts.map +1 -0
- package/dist/types/src/components/Dialog/index.d.ts.map +1 -0
- package/dist/types/src/components/ElevationProvider/ElevationProvider.d.ts +1 -1
- package/dist/types/src/components/ElevationProvider/ElevationProvider.d.ts.map +1 -1
- package/dist/types/src/components/Icon/Icon.d.ts +1 -1
- package/dist/types/src/components/Icon/Icon.d.ts.map +1 -1
- package/dist/types/src/components/Icon/Icon.stories.d.ts +17 -0
- package/dist/types/src/components/Icon/Icon.stories.d.ts.map +1 -0
- package/dist/types/src/components/Input/Input.d.ts +5 -2
- package/dist/types/src/components/Input/Input.d.ts.map +1 -1
- package/dist/types/src/components/Input/Input.stories.d.ts +2 -2
- package/dist/types/src/components/Input/Input.stories.d.ts.map +1 -1
- package/dist/types/src/components/{Lists → List}/List.d.ts +1 -1
- package/dist/types/src/components/List/List.d.ts.map +1 -0
- package/dist/types/src/components/List/List.stories.d.ts.map +1 -0
- package/dist/types/src/components/List/ListDropIndicator.d.ts.map +1 -0
- package/dist/types/src/components/List/Tree.d.ts.map +1 -0
- package/dist/types/src/components/List/Tree.stories.d.ts.map +1 -0
- package/dist/types/src/components/List/TreeDropIndicator.d.ts.map +1 -0
- package/dist/types/src/components/List/Treegrid.d.ts.map +1 -0
- package/dist/types/src/components/List/Treegrid.stories.d.ts.map +1 -0
- package/dist/types/src/components/List/index.d.ts.map +1 -0
- package/dist/types/src/components/Main/Main.d.ts +16 -17
- package/dist/types/src/components/Main/Main.d.ts.map +1 -1
- package/dist/types/src/components/Main/Main.stories.d.ts.map +1 -1
- package/dist/types/src/components/{Menus → Menu}/ContextMenu.d.ts +6 -6
- package/dist/types/src/components/Menu/ContextMenu.d.ts.map +1 -0
- package/dist/types/src/components/Menu/ContextMenu.stories.d.ts.map +1 -0
- package/dist/types/src/components/{Menus → Menu}/DropdownMenu.d.ts +3 -4
- package/dist/types/src/components/Menu/DropdownMenu.d.ts.map +1 -0
- package/dist/types/src/components/Menu/DropdownMenu.stories.d.ts.map +1 -0
- package/dist/types/src/components/Menu/index.d.ts.map +1 -0
- 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 +1 -1
- package/dist/types/src/components/Message/Message.stories.d.ts.map +1 -1
- package/dist/types/src/components/Popover/Popover.d.ts +1 -1
- package/dist/types/src/components/Popover/Popover.d.ts.map +1 -1
- package/dist/types/src/components/ScrollArea/ScrollArea.d.ts +25 -26
- package/dist/types/src/components/ScrollArea/ScrollArea.d.ts.map +1 -1
- package/dist/types/src/components/ScrollArea/ScrollArea.stories.d.ts +46 -8
- package/dist/types/src/components/ScrollArea/ScrollArea.stories.d.ts.map +1 -1
- package/dist/types/src/components/ScrollContainer/ScrollContainer.d.ts +39 -0
- package/dist/types/src/components/ScrollContainer/ScrollContainer.d.ts.map +1 -0
- package/dist/types/src/components/ScrollContainer/ScrollContainer.stories.d.ts +19 -0
- package/dist/types/src/components/ScrollContainer/ScrollContainer.stories.d.ts.map +1 -0
- package/dist/types/src/components/ScrollContainer/index.d.ts +2 -0
- package/dist/types/src/components/ScrollContainer/index.d.ts.map +1 -0
- package/dist/types/src/components/Select/Select.d.ts +10 -10
- package/dist/types/src/components/Select/Select.d.ts.map +1 -1
- package/dist/types/src/components/Separator/Separator.d.ts +1 -1
- package/dist/types/src/components/Skeleton/Skeleton.d.ts +12 -0
- package/dist/types/src/components/Skeleton/Skeleton.d.ts.map +1 -0
- package/dist/types/src/components/Skeleton/Skeleton.stories.d.ts +17 -0
- package/dist/types/src/components/Skeleton/Skeleton.stories.d.ts.map +1 -0
- package/dist/types/src/components/Skeleton/index.d.ts +2 -0
- package/dist/types/src/components/Skeleton/index.d.ts.map +1 -0
- package/dist/types/src/components/Splitter/Splitter.d.ts +26 -0
- package/dist/types/src/components/Splitter/Splitter.d.ts.map +1 -0
- package/dist/types/src/components/Splitter/Splitter.stories.d.ts +7 -0
- package/dist/types/src/components/Splitter/Splitter.stories.d.ts.map +1 -0
- package/dist/types/src/components/Splitter/index.d.ts +2 -0
- package/dist/types/src/components/Splitter/index.d.ts.map +1 -0
- package/dist/types/src/components/Tag/Tag.d.ts +1 -1
- package/dist/types/src/components/Tag/Tag.d.ts.map +1 -1
- package/dist/types/src/components/ThemeProvider/ThemeProvider.d.ts +2 -2
- package/dist/types/src/components/ThemeProvider/ThemeProvider.d.ts.map +1 -1
- package/dist/types/src/components/ThemeProvider/TranslationsProvider.d.ts +1 -8
- package/dist/types/src/components/ThemeProvider/TranslationsProvider.d.ts.map +1 -1
- package/dist/types/src/components/ThemeProvider/index.d.ts +2 -1
- package/dist/types/src/components/ThemeProvider/index.d.ts.map +1 -1
- package/dist/types/src/components/Toast/Toast.d.ts +4 -4
- package/dist/types/src/components/Toast/Toast.d.ts.map +1 -1
- package/dist/types/src/components/Toolbar/Toolbar.d.ts +14 -11
- 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.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 +17 -0
- package/dist/types/src/exemplars/generics.stories.d.ts.map +1 -0
- package/dist/types/src/exemplars/slot.stories.d.ts +14 -0
- package/dist/types/src/exemplars/slot.stories.d.ts.map +1 -0
- package/dist/types/src/exemplars/tabster.stories.d.ts +8 -0
- package/dist/types/src/exemplars/tabster.stories.d.ts.map +1 -0
- 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 +1 -1
- package/dist/types/src/hooks/useElevationContext.d.ts.map +1 -1
- package/dist/types/src/index.d.ts +2 -1
- package/dist/types/src/index.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.map +1 -1
- package/dist/types/src/primitives/Container/Container.d.ts +23 -0
- package/dist/types/src/primitives/Container/Container.d.ts.map +1 -0
- package/dist/types/src/primitives/Container/Container.stories.d.ts +11 -0
- package/dist/types/src/primitives/Container/Container.stories.d.ts.map +1 -0
- package/dist/types/src/primitives/Container/Layout.d.ts +18 -0
- package/dist/types/src/primitives/Container/Layout.d.ts.map +1 -0
- package/dist/types/src/primitives/Container/Layout.stories.d.ts +10 -0
- package/dist/types/src/primitives/Container/Layout.stories.d.ts.map +1 -0
- package/dist/types/src/primitives/Container/index.d.ts +3 -0
- package/dist/types/src/primitives/Container/index.d.ts.map +1 -0
- package/dist/types/src/primitives/Flex/Flex.d.ts +8 -0
- package/dist/types/src/primitives/Flex/Flex.d.ts.map +1 -0
- package/dist/types/src/primitives/Flex/index.d.ts +2 -0
- package/dist/types/src/primitives/Flex/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 -0
- package/dist/types/src/testing/decorators/index.d.ts +1 -1
- package/dist/types/src/testing/decorators/index.d.ts.map +1 -1
- package/dist/types/src/testing/decorators/withLayout.d.ts +3 -3
- package/dist/types/src/testing/decorators/withLayout.d.ts.map +1 -1
- package/dist/types/src/testing/decorators/withLayoutVariants.d.ts +12 -0
- package/dist/types/src/testing/decorators/withLayoutVariants.d.ts.map +1 -0
- package/dist/types/src/testing/decorators/withTheme.d.ts +3 -2
- package/dist/types/src/testing/decorators/withTheme.d.ts.map +1 -1
- package/dist/types/src/util/index.d.ts +1 -2
- package/dist/types/src/util/index.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +38 -30
- package/src/components/AnchoredOverflow/AnchoredOverflow.tsx +10 -12
- package/src/components/Avatars/Avatar.stories.tsx +4 -4
- package/src/components/Avatars/Avatar.tsx +3 -10
- package/src/components/Avatars/AvatarGroup.stories.tsx +2 -2
- package/src/components/Breadcrumb/Breadcrumb.stories.tsx +3 -3
- package/src/components/Breadcrumb/Breadcrumb.tsx +5 -31
- package/src/components/{Buttons → Button}/Button.stories.tsx +3 -3
- package/src/components/{Buttons → Button}/Button.tsx +2 -8
- package/src/components/{Buttons → Button}/IconButton.stories.tsx +2 -2
- package/src/components/{Buttons → Button}/IconButton.tsx +20 -14
- package/src/components/{Buttons → Button}/Toggle.stories.tsx +7 -6
- package/src/components/{Buttons → Button}/ToggleGroup.stories.tsx +2 -2
- package/src/components/Clipboard/CopyButton.tsx +4 -4
- package/src/components/DensityProvider/DensityProvider.tsx +1 -1
- package/src/components/{Dialogs → Dialog}/AlertDialog.stories.tsx +3 -3
- package/src/components/{Dialogs → Dialog}/AlertDialog.tsx +3 -8
- package/src/components/Dialog/Dialog.stories.tsx +101 -0
- package/src/components/{Dialogs → Dialog}/Dialog.tsx +171 -46
- package/src/components/ElevationProvider/ElevationProvider.tsx +1 -1
- package/src/components/Icon/Icon.stories.tsx +113 -0
- package/src/components/Icon/Icon.tsx +3 -3
- package/src/components/Input/Input.stories.tsx +12 -11
- package/src/components/Input/Input.tsx +23 -29
- package/src/components/Link/Link.stories.tsx +2 -2
- package/src/components/Link/Link.tsx +1 -1
- package/src/components/{Lists → List}/List.stories.tsx +19 -15
- package/src/components/{Lists → List}/List.tsx +8 -14
- package/src/components/{Lists → List}/ListDropIndicator.tsx +1 -1
- package/src/components/{Lists → List}/Tree.stories.tsx +2 -2
- package/src/components/{Lists → List}/Treegrid.stories.tsx +2 -2
- package/src/components/{Lists → List}/Treegrid.tsx +4 -9
- package/src/components/Main/Main.stories.tsx +41 -20
- package/src/components/Main/Main.tsx +139 -82
- package/src/components/{Menus → Menu}/ContextMenu.stories.tsx +2 -2
- package/src/components/{Menus → Menu}/ContextMenu.tsx +7 -31
- package/src/components/{Menus → Menu}/DropdownMenu.stories.tsx +3 -3
- package/src/components/{Menus → Menu}/DropdownMenu.tsx +87 -66
- package/src/components/Message/Message.stories.tsx +3 -3
- package/src/components/Message/Message.tsx +34 -23
- package/src/components/Popover/Popover.stories.tsx +3 -3
- package/src/components/Popover/Popover.tsx +55 -36
- package/src/components/ScrollArea/ScrollArea.stories.tsx +166 -40
- package/src/components/ScrollArea/ScrollArea.tsx +80 -82
- package/src/components/ScrollArea/index.ts +1 -1
- package/src/components/ScrollContainer/ScrollContainer.stories.tsx +70 -0
- package/src/components/ScrollContainer/ScrollContainer.tsx +238 -0
- package/src/components/ScrollContainer/index.ts +5 -0
- package/src/components/Select/Select.stories.tsx +3 -3
- package/src/components/Select/Select.tsx +13 -29
- package/src/components/Separator/Separator.tsx +1 -1
- package/src/components/Skeleton/Skeleton.stories.tsx +52 -0
- package/src/components/Skeleton/Skeleton.tsx +26 -0
- package/src/components/Skeleton/index.ts +5 -0
- package/src/components/Splitter/Splitter.stories.tsx +73 -0
- package/src/components/Splitter/Splitter.tsx +123 -0
- package/src/components/Splitter/index.ts +5 -0
- package/src/components/Status/Status.stories.tsx +2 -2
- package/src/components/Status/Status.tsx +2 -2
- package/src/components/Tag/Tag.stories.tsx +4 -4
- package/src/components/Tag/Tag.tsx +2 -7
- package/src/components/ThemeProvider/ThemeProvider.tsx +3 -4
- package/src/components/ThemeProvider/TranslationsProvider.tsx +1 -16
- package/src/components/ThemeProvider/index.ts +3 -3
- package/src/components/Toast/Toast.stories.tsx +3 -3
- package/src/components/Toast/Toast.tsx +6 -10
- package/src/components/Toolbar/Toolbar.stories.tsx +4 -6
- package/src/components/Toolbar/Toolbar.tsx +32 -12
- package/src/components/Tooltip/Tooltip.stories.tsx +3 -3
- package/src/components/Tooltip/Tooltip.tsx +24 -22
- package/src/components/index.ts +7 -4
- package/src/exemplars/generics.stories.tsx +44 -0
- package/src/exemplars/slot.stories.tsx +108 -0
- package/src/exemplars/tabster.stories.tsx +127 -0
- package/src/hooks/useDensityContext.ts +1 -1
- package/src/hooks/useElevationContext.ts +1 -1
- package/src/index.ts +2 -1
- package/src/playground/Controls.stories.tsx +3 -4
- package/src/playground/Custom.stories.tsx +8 -10
- package/src/playground/Typography.stories.tsx +2 -2
- package/src/primitives/Container/Container.stories.tsx +67 -0
- package/src/primitives/Container/Container.tsx +79 -0
- package/src/primitives/Container/Layout.stories.tsx +57 -0
- package/src/primitives/Container/Layout.tsx +61 -0
- package/src/primitives/Container/index.ts +6 -0
- package/src/primitives/Flex/Flex.tsx +26 -0
- package/src/primitives/Flex/index.ts +5 -0
- package/src/primitives/index.ts +6 -0
- package/src/testing/decorators/index.ts +1 -1
- package/src/testing/decorators/withLayout.tsx +22 -15
- package/src/testing/decorators/{withSurfaceVariantsLayout.tsx → withLayoutVariants.tsx} +5 -5
- package/src/testing/decorators/withTheme.tsx +21 -18
- package/src/util/index.ts +2 -2
- package/dist/lib/browser/chunk-KX5JDELJ.mjs +0 -4521
- package/dist/lib/browser/chunk-KX5JDELJ.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-3HDQYL5S.mjs +0 -4523
- package/dist/lib/node-esm/chunk-3HDQYL5S.mjs.map +0 -7
- package/dist/types/src/components/Buttons/Button.d.ts.map +0 -1
- package/dist/types/src/components/Buttons/Button.stories.d.ts.map +0 -1
- package/dist/types/src/components/Buttons/IconButton.d.ts.map +0 -1
- package/dist/types/src/components/Buttons/IconButton.stories.d.ts.map +0 -1
- package/dist/types/src/components/Buttons/Toggle.d.ts.map +0 -1
- package/dist/types/src/components/Buttons/Toggle.stories.d.ts +0 -13
- package/dist/types/src/components/Buttons/Toggle.stories.d.ts.map +0 -1
- package/dist/types/src/components/Buttons/ToggleGroup.d.ts.map +0 -1
- package/dist/types/src/components/Buttons/ToggleGroup.stories.d.ts.map +0 -1
- package/dist/types/src/components/Buttons/index.d.ts.map +0 -1
- package/dist/types/src/components/Dialogs/AlertDialog.d.ts.map +0 -1
- package/dist/types/src/components/Dialogs/AlertDialog.stories.d.ts.map +0 -1
- package/dist/types/src/components/Dialogs/Dialog.d.ts +0 -31
- package/dist/types/src/components/Dialogs/Dialog.d.ts.map +0 -1
- package/dist/types/src/components/Dialogs/Dialog.stories.d.ts.map +0 -1
- package/dist/types/src/components/Dialogs/index.d.ts.map +0 -1
- package/dist/types/src/components/Lists/List.d.ts.map +0 -1
- package/dist/types/src/components/Lists/List.stories.d.ts.map +0 -1
- package/dist/types/src/components/Lists/ListDropIndicator.d.ts.map +0 -1
- package/dist/types/src/components/Lists/Tree.d.ts.map +0 -1
- package/dist/types/src/components/Lists/Tree.stories.d.ts.map +0 -1
- package/dist/types/src/components/Lists/TreeDropIndicator.d.ts.map +0 -1
- package/dist/types/src/components/Lists/Treegrid.d.ts.map +0 -1
- package/dist/types/src/components/Lists/Treegrid.stories.d.ts.map +0 -1
- package/dist/types/src/components/Lists/index.d.ts.map +0 -1
- package/dist/types/src/components/Menus/ContextMenu.d.ts.map +0 -1
- package/dist/types/src/components/Menus/ContextMenu.stories.d.ts.map +0 -1
- package/dist/types/src/components/Menus/DropdownMenu.d.ts.map +0 -1
- package/dist/types/src/components/Menus/DropdownMenu.stories.d.ts.map +0 -1
- package/dist/types/src/components/Menus/index.d.ts.map +0 -1
- package/dist/types/src/testing/decorators/withSurfaceVariantsLayout.d.ts +0 -12
- package/dist/types/src/testing/decorators/withSurfaceVariantsLayout.d.ts.map +0 -1
- package/dist/types/src/util/ThemedClassName.d.ts +0 -5
- package/dist/types/src/util/ThemedClassName.d.ts.map +0 -1
- package/dist/types/src/util/domino.d.ts +0 -18
- package/dist/types/src/util/domino.d.ts.map +0 -1
- package/src/components/Dialogs/Dialog.stories.tsx +0 -67
- package/src/util/ThemedClassName.ts +0 -7
- package/src/util/domino.ts +0 -53
- /package/dist/types/src/components/{Buttons → Button}/Button.stories.d.ts +0 -0
- /package/dist/types/src/components/{Buttons → Button}/IconButton.stories.d.ts +0 -0
- /package/dist/types/src/components/{Buttons → Button}/Toggle.d.ts +0 -0
- /package/dist/types/src/components/{Buttons → Button}/index.d.ts +0 -0
- /package/dist/types/src/components/{Dialogs → Dialog}/AlertDialog.d.ts +0 -0
- /package/dist/types/src/components/{Dialogs → Dialog}/AlertDialog.stories.d.ts +0 -0
- /package/dist/types/src/components/{Dialogs → Dialog}/index.d.ts +0 -0
- /package/dist/types/src/components/{Lists → List}/List.stories.d.ts +0 -0
- /package/dist/types/src/components/{Lists → List}/ListDropIndicator.d.ts +0 -0
- /package/dist/types/src/components/{Lists → List}/Tree.d.ts +0 -0
- /package/dist/types/src/components/{Lists → List}/Tree.stories.d.ts +0 -0
- /package/dist/types/src/components/{Lists → List}/TreeDropIndicator.d.ts +0 -0
- /package/dist/types/src/components/{Lists → List}/Treegrid.d.ts +0 -0
- /package/dist/types/src/components/{Lists → List}/Treegrid.stories.d.ts +0 -0
- /package/dist/types/src/components/{Lists → List}/index.d.ts +0 -0
- /package/dist/types/src/components/{Menus → Menu}/ContextMenu.stories.d.ts +0 -0
- /package/dist/types/src/components/{Menus → Menu}/DropdownMenu.stories.d.ts +0 -0
- /package/dist/types/src/components/{Menus → Menu}/index.d.ts +0 -0
- /package/src/components/{Buttons → Button}/Toggle.tsx +0 -0
- /package/src/components/{Buttons → Button}/ToggleGroup.tsx +0 -0
- /package/src/components/{Buttons → Button}/index.ts +0 -0
- /package/src/components/{Dialogs → Dialog}/index.ts +0 -0
- /package/src/components/{Lists → List}/Tree.tsx +0 -0
- /package/src/components/{Lists → List}/TreeDropIndicator.tsx +0 -0
- /package/src/components/{Lists → List}/index.ts +0 -0
- /package/src/components/{Menus → Menu}/index.ts +0 -0
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2023 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
6
|
+
import React, { type ReactElement, type Ref, forwardRef } from 'react';
|
|
7
|
+
|
|
8
|
+
import { type SlottableProps } from '@dxos/ui-types';
|
|
9
|
+
|
|
10
|
+
import { withTheme } from '../testing';
|
|
11
|
+
|
|
12
|
+
const ComponentInner = forwardRef<HTMLDivElement, ComponentProps>(({ children, ...props }, forwardedRef) => {
|
|
13
|
+
return (
|
|
14
|
+
<div {...props} ref={forwardedRef}>
|
|
15
|
+
{children}
|
|
16
|
+
</div>
|
|
17
|
+
);
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
ComponentInner.displayName = 'Component';
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Generic component pattern.
|
|
24
|
+
*/
|
|
25
|
+
type ComponentProps<P extends HTMLElement = any> = SlottableProps<P>;
|
|
26
|
+
|
|
27
|
+
const Component = ComponentInner as <P extends HTMLElement>(
|
|
28
|
+
props: SlottableProps<P> & { ref?: Ref<P> },
|
|
29
|
+
) => ReactElement;
|
|
30
|
+
|
|
31
|
+
const meta = {
|
|
32
|
+
title: 'ui/react-ui-core/exemplars/generics',
|
|
33
|
+
component: Component,
|
|
34
|
+
decorators: [withTheme()],
|
|
35
|
+
parameters: {
|
|
36
|
+
layout: 'centered',
|
|
37
|
+
},
|
|
38
|
+
} satisfies Meta;
|
|
39
|
+
|
|
40
|
+
export default meta;
|
|
41
|
+
|
|
42
|
+
type Story = StoryObj<typeof meta>;
|
|
43
|
+
|
|
44
|
+
export const Single: Story = {};
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2023 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { Slot } from '@radix-ui/react-slot';
|
|
6
|
+
import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
7
|
+
import React, { type PropsWithChildren, forwardRef } from 'react';
|
|
8
|
+
|
|
9
|
+
import { mx } from '@dxos/ui-theme';
|
|
10
|
+
import { type SlottableClassName, type SlottableProps, type ThemedClassName } from '@dxos/ui-types';
|
|
11
|
+
|
|
12
|
+
import { withTheme } from '../testing';
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Composition
|
|
16
|
+
*
|
|
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, instead cloning the part's child and passing it the props and behavior required to make it functional.
|
|
19
|
+
* https://www.radix-ui.com/primitives/docs/guides/composition
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
|
+
// Outer primitive (like Tooltip.Trigger or Focus.Group).
|
|
23
|
+
const Outer = forwardRef<HTMLDivElement, SlottableProps<HTMLDivElement>>(
|
|
24
|
+
({ children, className, classNames, asChild, ...props }, forwardedRef) => {
|
|
25
|
+
const Root = asChild ? Slot : 'div';
|
|
26
|
+
return (
|
|
27
|
+
<Root {...props} className={mx(className, classNames)} data-outer='true' ref={forwardedRef}>
|
|
28
|
+
{children}
|
|
29
|
+
</Root>
|
|
30
|
+
);
|
|
31
|
+
},
|
|
32
|
+
);
|
|
33
|
+
|
|
34
|
+
// Middle primitive (like Dialog.Trigger or Mosaic.Cell).
|
|
35
|
+
const Middle = forwardRef<HTMLDivElement, SlottableProps<HTMLDivElement>>(
|
|
36
|
+
({ children, className, classNames, asChild, ...props }, forwardedRef) => {
|
|
37
|
+
const Root = asChild ? Slot : 'div';
|
|
38
|
+
return (
|
|
39
|
+
<Root {...props} className={mx(className, classNames)} data-middle='true' ref={forwardedRef}>
|
|
40
|
+
{children}
|
|
41
|
+
</Root>
|
|
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
|
+
);
|
|
63
|
+
|
|
64
|
+
// Test 2: Nested asChild.
|
|
65
|
+
const TestNested = ({ classNames, ...props }: ThemedClassName<{ role?: string }>) => {
|
|
66
|
+
return (
|
|
67
|
+
<Outer asChild {...props} className={mx('p-2', classNames)}>
|
|
68
|
+
<Middle asChild>
|
|
69
|
+
<Leaf>Nested asChild</Leaf>
|
|
70
|
+
</Middle>
|
|
71
|
+
</Outer>
|
|
72
|
+
);
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
// Test 3: Complex.
|
|
76
|
+
const TestInner = ({ classNames, ...props }: ThemedClassName<{ role?: string }>) => (
|
|
77
|
+
<Outer asChild {...props} className={mx('p-2', classNames)}>
|
|
78
|
+
<Middle asChild>
|
|
79
|
+
<Leaf>
|
|
80
|
+
<div role='none'>Leaf</div>
|
|
81
|
+
</Leaf>
|
|
82
|
+
</Middle>
|
|
83
|
+
</Outer>
|
|
84
|
+
);
|
|
85
|
+
|
|
86
|
+
const meta = {
|
|
87
|
+
title: 'ui/react-ui-core/exemplars/slot',
|
|
88
|
+
decorators: [withTheme()],
|
|
89
|
+
parameters: {
|
|
90
|
+
layout: 'centered',
|
|
91
|
+
},
|
|
92
|
+
} satisfies Meta;
|
|
93
|
+
|
|
94
|
+
export default meta;
|
|
95
|
+
|
|
96
|
+
type Story = StoryObj<typeof meta>;
|
|
97
|
+
|
|
98
|
+
export const Single: Story = {
|
|
99
|
+
render: () => <TestSingle role='listitem' classNames='border-red-500' />,
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
export const Nested: Story = {
|
|
103
|
+
render: () => <TestNested role='listitem' classNames='border-green-500' />,
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
export const Inner: Story = {
|
|
107
|
+
render: () => <TestInner role='listitem' classNames='border-blue-500' />,
|
|
108
|
+
};
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import {
|
|
6
|
+
useArrowNavigationGroup,
|
|
7
|
+
useFocusFinders,
|
|
8
|
+
useFocusableGroup,
|
|
9
|
+
useMergedTabsterAttributes_unstable,
|
|
10
|
+
} from '@fluentui/react-tabster';
|
|
11
|
+
import { type Decorator, type Meta, type StoryObj } from '@storybook/react-vite';
|
|
12
|
+
import React, { forwardRef, useEffect, useMemo, useRef } from 'react';
|
|
13
|
+
import { createTabster, disposeTabster } from 'tabster';
|
|
14
|
+
|
|
15
|
+
import { Input, ScrollArea } from '@dxos/react-ui';
|
|
16
|
+
import { withLayout, withTheme } from '@dxos/react-ui/testing';
|
|
17
|
+
import { mx } from '@dxos/ui-theme';
|
|
18
|
+
|
|
19
|
+
// TODO(burdon): Factor out styles (incl. tabster debugging).
|
|
20
|
+
// TODO(burdon): Implement horizontal movement between columns when column is selected.
|
|
21
|
+
// TODO(burdon): Prevent tab out of app.
|
|
22
|
+
|
|
23
|
+
const border =
|
|
24
|
+
'rounded-sm outline-none border border-subduedSeparator focus:border-primary-500 focus-within:border-rose-500';
|
|
25
|
+
|
|
26
|
+
const Board = forwardRef<HTMLDivElement, { columns: string[][] }>(({ columns }, ref) => {
|
|
27
|
+
const arrowNavigationAttrs = useArrowNavigationGroup({ axis: 'horizontal', memorizeCurrent: true, tabbable: true });
|
|
28
|
+
|
|
29
|
+
return (
|
|
30
|
+
<div ref={ref} tabIndex={0} {...arrowNavigationAttrs} className='flex bs-full is-full overflow-hidden'>
|
|
31
|
+
<div className={mx('flex bs-full overflow-x-auto p-4 gap-4')}>
|
|
32
|
+
{columns.map((column) => (
|
|
33
|
+
<Column key={column[0]} items={column} />
|
|
34
|
+
))}
|
|
35
|
+
</div>
|
|
36
|
+
</div>
|
|
37
|
+
);
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
const Column = forwardRef<HTMLDivElement, { items: string[] }>(({ items }, ref) => {
|
|
41
|
+
const focusableGroupAttrs = useFocusableGroup({ tabBehavior: 'limited' });
|
|
42
|
+
const arrowNavigationAttrs = useArrowNavigationGroup({ axis: 'vertical', memorizeCurrent: true });
|
|
43
|
+
const tabsterAttrs = useMergedTabsterAttributes_unstable(focusableGroupAttrs, arrowNavigationAttrs);
|
|
44
|
+
|
|
45
|
+
return (
|
|
46
|
+
<ScrollArea.Root tabIndex={0} orientation='vertical' classNames={mx('shrink-0 bs-full is-[25rem]', border)}>
|
|
47
|
+
<ScrollArea.Viewport {...tabsterAttrs} classNames='p-4 gap-4' ref={ref}>
|
|
48
|
+
{items.map((item) => (
|
|
49
|
+
<Item key={item} value={item} />
|
|
50
|
+
))}
|
|
51
|
+
</ScrollArea.Viewport>
|
|
52
|
+
</ScrollArea.Root>
|
|
53
|
+
);
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
const Item = forwardRef<HTMLDivElement, { value: string }>(({ value }, ref) => {
|
|
57
|
+
const focusableGroupAttrs = useFocusableGroup();
|
|
58
|
+
|
|
59
|
+
return (
|
|
60
|
+
<div
|
|
61
|
+
ref={ref}
|
|
62
|
+
tabIndex={0}
|
|
63
|
+
{...focusableGroupAttrs}
|
|
64
|
+
className={mx('flex shrink-0 is-full gap-4 p-4 items-center', border)}
|
|
65
|
+
>
|
|
66
|
+
<Input.Root>
|
|
67
|
+
<Input.Checkbox />
|
|
68
|
+
</Input.Root>
|
|
69
|
+
<Input.Root>
|
|
70
|
+
<Input.TextInput defaultValue={value} />
|
|
71
|
+
</Input.Root>
|
|
72
|
+
</div>
|
|
73
|
+
);
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
const DefaultStory = () => {
|
|
77
|
+
const columns = useMemo(() => {
|
|
78
|
+
return [['A1', 'A2', 'A3'], ['B1'], ['C1', 'C2', 'C3', 'C4', 'C5', 'C6'], ['D1', 'D2']];
|
|
79
|
+
}, []);
|
|
80
|
+
|
|
81
|
+
const ref = useRef<HTMLDivElement>(null);
|
|
82
|
+
const { findFirstFocusable } = useFocusFinders();
|
|
83
|
+
useEffect(() => {
|
|
84
|
+
if (ref.current) {
|
|
85
|
+
findFirstFocusable(ref.current)?.focus();
|
|
86
|
+
}
|
|
87
|
+
}, []);
|
|
88
|
+
|
|
89
|
+
return <Board columns={columns} ref={ref} />;
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
// TODO(burdon): This doesn't seem to be necessary or recongized; memoization doesn't work.
|
|
93
|
+
const withTabster: Decorator = (Story) => {
|
|
94
|
+
useEffect(() => {
|
|
95
|
+
const tabster = createTabster(window, {
|
|
96
|
+
autoRoot: {},
|
|
97
|
+
// TODO(burdon): Not called.
|
|
98
|
+
// checkUncontrolledCompletely: (el) => {
|
|
99
|
+
// console.log(el);
|
|
100
|
+
// return true;
|
|
101
|
+
// },
|
|
102
|
+
});
|
|
103
|
+
|
|
104
|
+
return () => {
|
|
105
|
+
disposeTabster(tabster);
|
|
106
|
+
};
|
|
107
|
+
}, []);
|
|
108
|
+
|
|
109
|
+
return <Story />;
|
|
110
|
+
};
|
|
111
|
+
|
|
112
|
+
const meta: Meta<typeof DefaultStory> = {
|
|
113
|
+
title: 'ui/react-ui-core/exemplars/tabster',
|
|
114
|
+
component: DefaultStory,
|
|
115
|
+
decorators: [withTheme(), withLayout({ layout: 'fullscreen' }), withTabster],
|
|
116
|
+
parameters: {
|
|
117
|
+
layout: 'fullscreen',
|
|
118
|
+
},
|
|
119
|
+
};
|
|
120
|
+
|
|
121
|
+
export default meta;
|
|
122
|
+
|
|
123
|
+
type Story = StoryObj<typeof meta>;
|
|
124
|
+
|
|
125
|
+
export const Default: Story = {
|
|
126
|
+
args: {},
|
|
127
|
+
};
|
package/src/index.ts
CHANGED
|
@@ -6,8 +6,9 @@ export { type Resource, type TFunction } from 'i18next';
|
|
|
6
6
|
export { Trans } from 'react-i18next';
|
|
7
7
|
|
|
8
8
|
export * from '@dxos/react-hooks';
|
|
9
|
-
export * from '@dxos/
|
|
9
|
+
export * from '@dxos/ui-types';
|
|
10
10
|
|
|
11
11
|
export * from './components';
|
|
12
12
|
export * from './hooks';
|
|
13
|
+
export * from './primitives';
|
|
13
14
|
export * from './util';
|
|
@@ -6,8 +6,7 @@ import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
|
6
6
|
import React, { useState } from 'react';
|
|
7
7
|
|
|
8
8
|
import { Icon, Input, Select, Toggle, Toolbar } from '../components';
|
|
9
|
-
import { withTheme } from '../testing';
|
|
10
|
-
import { withSurfaceVariantsLayout } from '../testing';
|
|
9
|
+
import { withLayoutVariants, withTheme } from '../testing';
|
|
11
10
|
|
|
12
11
|
const DefaultStory = () => {
|
|
13
12
|
const [checked, setChecked] = useState<boolean>(false);
|
|
@@ -82,9 +81,9 @@ const DefaultStory = () => {
|
|
|
82
81
|
};
|
|
83
82
|
|
|
84
83
|
const meta = {
|
|
85
|
-
title: 'ui/react-ui-core/
|
|
84
|
+
title: 'ui/react-ui-core/playground/Controls',
|
|
86
85
|
render: DefaultStory,
|
|
87
|
-
decorators: [withTheme,
|
|
86
|
+
decorators: [withTheme(), withLayoutVariants()],
|
|
88
87
|
} satisfies Meta<typeof Icon>;
|
|
89
88
|
|
|
90
89
|
export default meta;
|
|
@@ -30,7 +30,7 @@ const DefaultStory = ({ children, ...args }: Omit<ButtonProps, 'ref'>) => {
|
|
|
30
30
|
iconOnly
|
|
31
31
|
size={7}
|
|
32
32
|
density='coarse'
|
|
33
|
-
classNames='
|
|
33
|
+
classNames='pli-1.5'
|
|
34
34
|
/>
|
|
35
35
|
</div>
|
|
36
36
|
</div>
|
|
@@ -43,7 +43,7 @@ const DefaultStory = ({ children, ...args }: Omit<ButtonProps, 'ref'>) => {
|
|
|
43
43
|
</Button>
|
|
44
44
|
</div>
|
|
45
45
|
<div className='flex justify-center'>
|
|
46
|
-
<IconButton {...args} label='Test' icon='ph--atom--regular'
|
|
46
|
+
<IconButton {...args} label='Test' icon='ph--atom--regular' density='fine' classNames='pli-2' />
|
|
47
47
|
</div>
|
|
48
48
|
<div className='flex justify-center'>
|
|
49
49
|
<IconButton
|
|
@@ -51,9 +51,8 @@ const DefaultStory = ({ children, ...args }: Omit<ButtonProps, 'ref'>) => {
|
|
|
51
51
|
label='Test'
|
|
52
52
|
icon='ph--atom--regular'
|
|
53
53
|
iconOnly
|
|
54
|
-
size={5}
|
|
55
54
|
density='fine'
|
|
56
|
-
classNames='
|
|
55
|
+
classNames='plb-1 pli-1.5'
|
|
57
56
|
/>
|
|
58
57
|
</div>
|
|
59
58
|
</div>
|
|
@@ -61,7 +60,7 @@ const DefaultStory = ({ children, ...args }: Omit<ButtonProps, 'ref'>) => {
|
|
|
61
60
|
{/* Small */}
|
|
62
61
|
<div className='grid grid-cols-3 gap-4'>
|
|
63
62
|
<div className='flex justify-center'>
|
|
64
|
-
<Button {...args} density='fine' classNames={'!h-[24px] !text-[14px] p-0
|
|
63
|
+
<Button {...args} density='fine' classNames={'!h-[24px] !text-[14px] p-0 pli-1.5 min-bs-0'}>
|
|
65
64
|
{children}
|
|
66
65
|
</Button>
|
|
67
66
|
</div>
|
|
@@ -90,18 +89,17 @@ const DefaultStory = ({ children, ...args }: Omit<ButtonProps, 'ref'>) => {
|
|
|
90
89
|
|
|
91
90
|
{/* TODO(burdon): Full variant with max width. */}
|
|
92
91
|
<div className='flex justify-center'>
|
|
93
|
-
<Button classNames='
|
|
92
|
+
<Button classNames='is-full max-is-[15rem] rounded' variant='default'>
|
|
94
93
|
Test
|
|
95
94
|
</Button>
|
|
96
95
|
</div>
|
|
97
96
|
<div className='flex justify-center'>
|
|
98
97
|
{/* TODO(burdon): Option to have button on RHS. Default size for icon should be 5 for this (medium) density. */}
|
|
99
98
|
<IconButton
|
|
100
|
-
classNames='
|
|
99
|
+
classNames='is-full max-is-[15rem] rounded'
|
|
101
100
|
variant='primary'
|
|
102
101
|
icon='ph--arrows-clockwise--regular'
|
|
103
102
|
label='Test'
|
|
104
|
-
size={5}
|
|
105
103
|
/>
|
|
106
104
|
</div>
|
|
107
105
|
</div>
|
|
@@ -110,10 +108,10 @@ const DefaultStory = ({ children, ...args }: Omit<ButtonProps, 'ref'>) => {
|
|
|
110
108
|
};
|
|
111
109
|
|
|
112
110
|
const meta = {
|
|
113
|
-
title: 'ui/react-ui-core/
|
|
111
|
+
title: 'ui/react-ui-core/playground/Custom',
|
|
114
112
|
component: Button,
|
|
115
113
|
render: DefaultStory,
|
|
116
|
-
decorators: [withTheme],
|
|
114
|
+
decorators: [withTheme()],
|
|
117
115
|
parameters: {
|
|
118
116
|
layout: 'centered',
|
|
119
117
|
},
|
|
@@ -43,9 +43,9 @@ const DefaultStory = () => {
|
|
|
43
43
|
};
|
|
44
44
|
|
|
45
45
|
const meta = {
|
|
46
|
-
title: 'ui/react-ui-core/
|
|
46
|
+
title: 'ui/react-ui-core/playground/Typography',
|
|
47
47
|
render: DefaultStory,
|
|
48
|
-
decorators: [withTheme],
|
|
48
|
+
decorators: [withTheme()],
|
|
49
49
|
} satisfies Meta<typeof DefaultStory>;
|
|
50
50
|
|
|
51
51
|
export default meta;
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
6
|
+
import React from 'react';
|
|
7
|
+
|
|
8
|
+
import { Input } from '../../components';
|
|
9
|
+
import { withTheme } from '../../testing';
|
|
10
|
+
|
|
11
|
+
import { Container, type ContainerRootProps } from './Container';
|
|
12
|
+
|
|
13
|
+
const DefaultStory = (props: ContainerRootProps) => {
|
|
14
|
+
return (
|
|
15
|
+
<div className='plb-2 is-[20rem] border border-separator rounded-sm'>
|
|
16
|
+
<Container.Root {...props}>
|
|
17
|
+
<Container.Column>
|
|
18
|
+
<Input.Root>
|
|
19
|
+
<Input.Label>Label</Input.Label>
|
|
20
|
+
<Input.TextInput />
|
|
21
|
+
</Input.Root>
|
|
22
|
+
</Container.Column>
|
|
23
|
+
</Container.Root>
|
|
24
|
+
</div>
|
|
25
|
+
);
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
const meta: Meta<typeof Container.Root> = {
|
|
29
|
+
title: 'ui/react-ui-core/primitives/Container',
|
|
30
|
+
component: Container.Root,
|
|
31
|
+
render: DefaultStory,
|
|
32
|
+
decorators: [withTheme()],
|
|
33
|
+
parameters: {
|
|
34
|
+
layout: 'centered',
|
|
35
|
+
},
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
export default meta;
|
|
39
|
+
|
|
40
|
+
type Story = StoryObj<typeof meta>;
|
|
41
|
+
|
|
42
|
+
// TODO(burdon): Requires container.
|
|
43
|
+
export const Default = () => {
|
|
44
|
+
return (
|
|
45
|
+
<Container.Root>
|
|
46
|
+
<Container.Column>Column</Container.Column>
|
|
47
|
+
</Container.Root>
|
|
48
|
+
);
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
export const SM: Story = {
|
|
52
|
+
args: {
|
|
53
|
+
variant: 'sm',
|
|
54
|
+
},
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
export const MD: Story = {
|
|
58
|
+
args: {
|
|
59
|
+
variant: 'md',
|
|
60
|
+
},
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
export const LG: Story = {
|
|
64
|
+
args: {
|
|
65
|
+
variant: 'lg',
|
|
66
|
+
},
|
|
67
|
+
};
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { createContext } from '@radix-ui/react-context';
|
|
6
|
+
import { Primitive } from '@radix-ui/react-primitive';
|
|
7
|
+
import { Slot } from '@radix-ui/react-slot';
|
|
8
|
+
import React, { type PropsWithChildren, type Ref, forwardRef } from 'react';
|
|
9
|
+
|
|
10
|
+
import { type ColumnPadding } from '@dxos/ui-theme';
|
|
11
|
+
import { type SlottableProps } from '@dxos/ui-types';
|
|
12
|
+
|
|
13
|
+
import { useThemeContext } from '../../hooks';
|
|
14
|
+
|
|
15
|
+
// TODO(burdon): Replace Form, Container, Card spacing.
|
|
16
|
+
// TODO(burdon): Scrolling (reconcile with Mosaic Viewport).
|
|
17
|
+
// TODO(burdon): Reconcile AnchoredOverflow.
|
|
18
|
+
|
|
19
|
+
//
|
|
20
|
+
// Context
|
|
21
|
+
//
|
|
22
|
+
|
|
23
|
+
type ContainerContext = {
|
|
24
|
+
variant?: ColumnPadding;
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
const [ContainerProvider, useContext] = createContext<ContainerContext>('Container');
|
|
28
|
+
|
|
29
|
+
//
|
|
30
|
+
// Root
|
|
31
|
+
//
|
|
32
|
+
|
|
33
|
+
type RootProps = PropsWithChildren<Partial<ContainerContext>>;
|
|
34
|
+
|
|
35
|
+
const Root = ({ variant, children }: RootProps) => {
|
|
36
|
+
return <ContainerProvider {...{ variant }}>{children}</ContainerProvider>;
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
//
|
|
40
|
+
// Column
|
|
41
|
+
//
|
|
42
|
+
|
|
43
|
+
const CONTAINER_COLUMN_NAME = 'Container.Column';
|
|
44
|
+
|
|
45
|
+
type ColumnProps = SlottableProps<HTMLDivElement> & { variant?: ColumnPadding };
|
|
46
|
+
|
|
47
|
+
const Column = forwardRef(
|
|
48
|
+
(
|
|
49
|
+
{ classNames, className, asChild, role = 'none', children, variant, ...props }: ColumnProps,
|
|
50
|
+
ref: Ref<HTMLDivElement>,
|
|
51
|
+
) => {
|
|
52
|
+
const { tx } = useThemeContext();
|
|
53
|
+
const Root = asChild ? Slot : Primitive.div;
|
|
54
|
+
const context = useContext(CONTAINER_COLUMN_NAME);
|
|
55
|
+
return (
|
|
56
|
+
<Root
|
|
57
|
+
{...props}
|
|
58
|
+
className={tx('container.column', { variant: variant ?? context.variant }, [className, classNames])}
|
|
59
|
+
role={role}
|
|
60
|
+
ref={ref}
|
|
61
|
+
>
|
|
62
|
+
{children}
|
|
63
|
+
</Root>
|
|
64
|
+
);
|
|
65
|
+
},
|
|
66
|
+
);
|
|
67
|
+
|
|
68
|
+
Column.displayName = CONTAINER_COLUMN_NAME;
|
|
69
|
+
|
|
70
|
+
//
|
|
71
|
+
// Container
|
|
72
|
+
//
|
|
73
|
+
|
|
74
|
+
export const Container = {
|
|
75
|
+
Root,
|
|
76
|
+
Column,
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
export type { RootProps as ContainerRootProps, ColumnProps as ContainerColumnProps };
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
6
|
+
import React from 'react';
|
|
7
|
+
|
|
8
|
+
import { Input, ScrollArea, Toolbar } from '../../components';
|
|
9
|
+
import { withLayout, withTheme } from '../../testing';
|
|
10
|
+
|
|
11
|
+
import { Layout } from './Layout';
|
|
12
|
+
|
|
13
|
+
const DefaultStory = ({ count }: { count: number }) => {
|
|
14
|
+
return (
|
|
15
|
+
<Layout.Main toolbar statusbar>
|
|
16
|
+
<Toolbar.Root classNames='gap-2'>
|
|
17
|
+
<Toolbar.IconButton icon='ph--plus--regular' variant='primary' label='Add' />
|
|
18
|
+
<Input.Root>
|
|
19
|
+
<Input.TextInput placeholder='Search' />
|
|
20
|
+
</Input.Root>
|
|
21
|
+
<Toolbar.IconButton icon='ph--dots-three-vertical--regular' iconOnly label='Menu' />
|
|
22
|
+
</Toolbar.Root>
|
|
23
|
+
<ScrollArea.Root thin orientation='vertical'>
|
|
24
|
+
<ScrollArea.Viewport classNames='pli-2 plb-1 gap-1'>
|
|
25
|
+
{Array.from({ length: count }).map((_, index) => (
|
|
26
|
+
<div key={index} role='listitem' className='pli-2 plb-1 border border-separator'>
|
|
27
|
+
{index}
|
|
28
|
+
</div>
|
|
29
|
+
))}
|
|
30
|
+
</ScrollArea.Viewport>
|
|
31
|
+
</ScrollArea.Root>
|
|
32
|
+
<Toolbar.Root classNames='justify-between'>
|
|
33
|
+
<Toolbar.IconButton variant='ghost' icon='ph--house--regular' iconOnly label='Add' size={4} />
|
|
34
|
+
<Toolbar.IconButton variant='ghost' icon='ph--alarm--regular' iconOnly label='Status' size={4} />
|
|
35
|
+
</Toolbar.Root>
|
|
36
|
+
</Layout.Main>
|
|
37
|
+
);
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
const meta: Meta<typeof DefaultStory> = {
|
|
41
|
+
title: 'ui/react-ui-core/primitives/Layout',
|
|
42
|
+
component: DefaultStory,
|
|
43
|
+
decorators: [withTheme(), withLayout({ layout: 'column' })],
|
|
44
|
+
parameters: {
|
|
45
|
+
layout: 'fullscreen',
|
|
46
|
+
},
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
export default meta;
|
|
50
|
+
|
|
51
|
+
type Story = StoryObj<typeof meta>;
|
|
52
|
+
|
|
53
|
+
export const Default: Story = {
|
|
54
|
+
args: {
|
|
55
|
+
count: 100,
|
|
56
|
+
},
|
|
57
|
+
};
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2026 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import React, { type PropsWithChildren, forwardRef, useMemo } from 'react';
|
|
6
|
+
|
|
7
|
+
import { mx } from '@dxos/ui-theme';
|
|
8
|
+
import { type ThemedClassName } from '@dxos/ui-types';
|
|
9
|
+
|
|
10
|
+
//
|
|
11
|
+
// Main
|
|
12
|
+
//
|
|
13
|
+
|
|
14
|
+
type MainProps = ThemedClassName<
|
|
15
|
+
PropsWithChildren<{
|
|
16
|
+
role?: string;
|
|
17
|
+
toolbar?: boolean;
|
|
18
|
+
statusbar?: boolean;
|
|
19
|
+
}>
|
|
20
|
+
>;
|
|
21
|
+
|
|
22
|
+
const Main = forwardRef<HTMLDivElement, MainProps>(
|
|
23
|
+
({ classNames, children, role, toolbar, statusbar }, forwardedRef) => {
|
|
24
|
+
const style = useMemo(
|
|
25
|
+
() => ({
|
|
26
|
+
gridTemplateRows: [toolbar && 'var(--toolbar-size)', '1fr', statusbar && 'var(--statusbar-size)']
|
|
27
|
+
.filter(Boolean)
|
|
28
|
+
.join(' '),
|
|
29
|
+
}),
|
|
30
|
+
[toolbar, statusbar],
|
|
31
|
+
);
|
|
32
|
+
|
|
33
|
+
return (
|
|
34
|
+
<div
|
|
35
|
+
ref={forwardedRef}
|
|
36
|
+
role={role ?? 'none'}
|
|
37
|
+
style={style}
|
|
38
|
+
className={mx(
|
|
39
|
+
'bs-full is-full grid grid-cols-[100%] overflow-hidden',
|
|
40
|
+
toolbar && [
|
|
41
|
+
'[.dx-main-mobile-layout_&>.dx-toolbar]:pli-3 [&>.dx-toolbar]:relative',
|
|
42
|
+
'[&>.dx-toolbar]:border-be [&>.dx-toolbar]:border-subduedSeparator',
|
|
43
|
+
],
|
|
44
|
+
classNames,
|
|
45
|
+
)}
|
|
46
|
+
>
|
|
47
|
+
{children}
|
|
48
|
+
</div>
|
|
49
|
+
);
|
|
50
|
+
},
|
|
51
|
+
);
|
|
52
|
+
|
|
53
|
+
//
|
|
54
|
+
// Layout
|
|
55
|
+
//
|
|
56
|
+
|
|
57
|
+
export const Layout = {
|
|
58
|
+
Main,
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
export type { MainProps as LayoutMainProps };
|