@dxos/react-ui 0.8.4-main.c4373fc → 0.8.4-main.c85a9c8dae
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-2FKSMWNY.mjs +774 -0
- package/dist/lib/browser/chunk-2FKSMWNY.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +3929 -66
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/testing/index.mjs +77 -55
- package/dist/lib/browser/testing/index.mjs.map +4 -4
- package/dist/lib/node-esm/chunk-ZNBLTSHI.mjs +776 -0
- package/dist/lib/node-esm/chunk-ZNBLTSHI.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +3929 -66
- 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 +77 -55
- package/dist/lib/node-esm/testing/index.mjs.map +4 -4
- 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/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/Card/Card.d.ts +121 -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/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/{Dialogs → Dialog}/AlertDialog.d.ts +12 -3
- 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 +47 -0
- package/dist/types/src/components/Dialog/Dialog.d.ts.map +1 -0
- package/dist/types/src/components/{Dialogs → Dialog}/Dialog.stories.d.ts +9 -10
- 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/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 +8 -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/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/Image/Image.d.ts +14 -0
- package/dist/types/src/components/Image/Image.d.ts.map +1 -0
- package/dist/types/src/components/Image/Image.stories.d.ts +33 -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 +5 -5
- package/dist/types/src/components/Input/Input.d.ts.map +1 -1
- package/dist/types/src/components/Input/Input.stories.d.ts +8 -8
- 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 +17 -18
- 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/{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 +3 -4
- package/dist/types/src/components/Message/Message.stories.d.ts.map +1 -1
- package/dist/types/src/components/Popover/Popover.d.ts +2 -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 +24 -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 +36 -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/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.d.ts +1 -1
- package/dist/types/src/components/Tag/Tag.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 +2 -2
- 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 +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 +45 -13
- 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/Tooltip/Tooltip.stories.d.ts.map +1 -1
- package/dist/types/src/components/index.d.ts +13 -8
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/exemplars/generics.stories.d.ts +18 -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/exemplars/virtualizer.stories.d.ts +11 -0
- package/dist/types/src/exemplars/virtualizer.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/hooks/useVisualViewport.d.ts +2 -2
- package/dist/types/src/hooks/useVisualViewport.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/Column/Column.d.ts +32 -0
- package/dist/types/src/primitives/Column/Column.d.ts.map +1 -0
- package/dist/types/src/primitives/Column/Column.stories.d.ts +6 -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/Flex/Flex.d.ts +8 -0
- package/dist/types/src/primitives/Flex/Flex.d.ts.map +1 -0
- 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/Flex/index.d.ts +2 -0
- package/dist/types/src/primitives/Flex/index.d.ts.map +1 -0
- package/dist/types/src/primitives/Grid/Grid.d.ts +9 -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 +34 -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 +5 -0
- package/dist/types/src/primitives/index.d.ts.map +1 -0
- package/dist/types/src/testing/decorators/index.d.ts +2 -1
- package/dist/types/src/testing/decorators/index.d.ts.map +1 -1
- package/dist/types/src/testing/decorators/withLayout.d.ts +15 -0
- package/dist/types/src/testing/decorators/withLayout.d.ts.map +1 -0
- 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/translations.d.ts +11 -0
- package/dist/types/src/translations.d.ts.map +1 -0
- 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 +41 -29
- package/src/components/Avatars/Avatar.stories.tsx +5 -6
- package/src/components/Avatars/Avatar.tsx +6 -13
- package/src/components/Avatars/AvatarGroup.stories.tsx +2 -2
- package/src/components/Breadcrumb/Breadcrumb.stories.tsx +4 -4
- package/src/components/Breadcrumb/Breadcrumb.tsx +11 -37
- package/src/components/{Buttons → Button}/Button.stories.tsx +4 -4
- package/src/components/{Buttons → Button}/Button.tsx +7 -13
- package/src/components/{Buttons → Button}/IconButton.stories.tsx +4 -4
- 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/Card/Card.stories.tsx +151 -0
- package/src/components/Card/Card.tsx +352 -0
- package/src/components/Card/index.ts +5 -0
- package/src/components/Clipboard/CopyButton.tsx +7 -7
- package/src/components/DensityProvider/DensityProvider.tsx +1 -1
- package/src/components/Dialog/AlertDialog.stories.tsx +69 -0
- package/src/components/{Dialogs → Dialog}/AlertDialog.tsx +116 -16
- package/src/components/Dialog/Dialog.stories.tsx +122 -0
- package/src/components/{Dialogs → Dialog}/Dialog.tsx +179 -49
- package/src/components/ElevationProvider/ElevationProvider.tsx +1 -1
- package/src/components/ErrorFallback/ErrorFallback.stories.tsx +50 -0
- package/src/components/ErrorFallback/ErrorFallback.tsx +70 -0
- package/src/components/ErrorFallback/ErrorStack.tsx +80 -0
- package/src/components/ErrorFallback/ThrowError.tsx +37 -0
- package/src/components/ErrorFallback/index.ts +9 -0
- package/src/components/Icon/Icon.stories.tsx +113 -0
- package/src/components/Icon/Icon.tsx +3 -3
- package/src/components/Image/Image.stories.tsx +86 -0
- package/src/components/Image/Image.tsx +223 -0
- package/src/components/Image/index.ts +5 -0
- package/src/components/Input/Input.stories.tsx +21 -40
- package/src/components/Input/Input.tsx +32 -68
- package/src/components/Link/Link.stories.tsx +2 -2
- package/src/components/Link/Link.tsx +2 -2
- package/src/components/{Lists → List}/List.stories.tsx +30 -33
- package/src/components/{Lists → List}/List.tsx +12 -17
- package/src/components/{Lists → List}/ListDropIndicator.tsx +7 -7
- package/src/components/{Lists → List}/Tree.stories.tsx +4 -4
- package/src/components/{Lists → List}/TreeDropIndicator.tsx +6 -6
- package/src/components/{Lists → List}/Treegrid.stories.tsx +3 -3
- package/src/components/{Lists → List}/Treegrid.tsx +10 -15
- package/src/components/Main/Main.stories.tsx +41 -23
- package/src/components/Main/Main.tsx +149 -92
- package/src/components/{Menus → Menu}/ContextMenu.stories.tsx +2 -2
- package/src/components/{Menus → Menu}/ContextMenu.tsx +9 -33
- package/src/components/{Menus → Menu}/DropdownMenu.stories.tsx +3 -3
- package/src/components/{Menus → Menu}/DropdownMenu.tsx +89 -68
- package/src/components/Message/Message.stories.tsx +26 -11
- package/src/components/Message/Message.tsx +46 -33
- package/src/components/Popover/Popover.stories.tsx +5 -5
- package/src/components/Popover/Popover.tsx +78 -56
- package/src/components/ScrollArea/ScrollArea.stories.tsx +166 -40
- package/src/components/ScrollArea/ScrollArea.tsx +84 -82
- package/src/components/ScrollArea/index.ts +1 -1
- package/src/components/ScrollContainer/ScrollContainer.stories.tsx +89 -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 +11 -27
- 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 +83 -0
- package/src/components/Splitter/Splitter.tsx +138 -0
- package/src/components/Splitter/index.ts +5 -0
- package/src/components/Status/Status.stories.tsx +21 -17
- package/src/components/Status/Status.tsx +2 -2
- package/src/components/Tag/Tag.stories.tsx +6 -11
- package/src/components/Tag/Tag.tsx +3 -8
- package/src/components/ThemeProvider/ThemeProvider.stories.tsx +32 -0
- package/src/components/ThemeProvider/ThemeProvider.tsx +5 -6
- 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 +10 -14
- package/src/components/Toolbar/Toolbar.stories.tsx +4 -6
- package/src/components/Toolbar/Toolbar.tsx +196 -9
- package/src/components/Tooltip/Tooltip.stories.tsx +16 -14
- package/src/components/Tooltip/Tooltip.tsx +25 -22
- package/src/components/index.ts +14 -9
- package/src/exemplars/generics.stories.tsx +49 -0
- package/src/exemplars/slot.stories.tsx +119 -0
- package/src/exemplars/tabster.stories.tsx +127 -0
- package/src/exemplars/virtualizer.stories.tsx +137 -0
- package/src/hooks/useDensityContext.ts +1 -1
- package/src/hooks/useElevationContext.ts +1 -1
- package/src/hooks/useSafeArea.ts +2 -2
- package/src/hooks/useVisualViewport.ts +3 -3
- package/src/index.ts +2 -1
- package/src/playground/Controls.stories.tsx +3 -10
- package/src/playground/Custom.stories.tsx +8 -10
- package/src/playground/Typography.stories.tsx +3 -3
- package/src/primitives/Column/Column.stories.tsx +72 -0
- package/src/primitives/Column/Column.tsx +156 -0
- package/src/primitives/Column/index.ts +5 -0
- package/src/primitives/Flex/Flex.stories.tsx +58 -0
- package/src/primitives/Flex/Flex.tsx +27 -0
- package/src/primitives/Flex/index.ts +5 -0
- package/src/primitives/Grid/Grid.stories.tsx +57 -0
- package/src/primitives/Grid/Grid.tsx +43 -0
- package/src/primitives/Grid/index.ts +5 -0
- package/src/primitives/Panel/Panel.stories.tsx +67 -0
- package/src/primitives/Panel/Panel.tsx +137 -0
- package/src/primitives/Panel/index.ts +5 -0
- package/src/primitives/index.ts +8 -0
- package/src/testing/decorators/index.ts +2 -1
- package/src/testing/decorators/withLayout.tsx +77 -0
- package/src/testing/decorators/withLayoutVariants.tsx +48 -0
- package/src/testing/decorators/withTheme.tsx +21 -18
- package/src/translations.ts +19 -0
- package/src/util/index.ts +2 -2
- package/dist/lib/browser/chunk-B7HPXBP2.mjs +0 -4514
- package/dist/lib/browser/chunk-B7HPXBP2.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-6JCSY5Y7.mjs +0 -4516
- package/dist/lib/node-esm/chunk-6JCSY5Y7.mjs.map +0 -7
- package/dist/types/src/components/AnchoredOverflow/AnchoredOverflow.d.ts +0 -15
- 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/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/AnchoredOverflow/AnchoredOverflow.tsx +0 -59
- package/src/components/AnchoredOverflow/index.ts +0 -5
- package/src/components/Dialogs/AlertDialog.stories.tsx +0 -69
- package/src/components/Dialogs/Dialog.stories.tsx +0 -67
- package/src/testing/decorators/withSurfaceVariantsLayout.tsx +0 -51
- package/src/util/ThemedClassName.ts +0 -7
- package/src/util/domino.ts +0 -51
- /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.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}/index.ts +0 -0
- /package/src/components/{Menus → Menu}/index.ts +0 -0
|
@@ -23,12 +23,24 @@ import {
|
|
|
23
23
|
type AlertDialogTriggerProps as AlertDialogTriggerPrimitiveProps,
|
|
24
24
|
} from '@radix-ui/react-alert-dialog';
|
|
25
25
|
import { createContext } from '@radix-ui/react-context';
|
|
26
|
-
import React, {
|
|
26
|
+
import React, {
|
|
27
|
+
type ForwardRefExoticComponent,
|
|
28
|
+
type FunctionComponent,
|
|
29
|
+
type PropsWithChildren,
|
|
30
|
+
forwardRef,
|
|
31
|
+
} from 'react';
|
|
32
|
+
|
|
33
|
+
import { type DialogSize } from '@dxos/ui-theme';
|
|
27
34
|
|
|
28
35
|
import { useThemeContext } from '../../hooks';
|
|
36
|
+
import { Column } from '../../primitives';
|
|
29
37
|
import { type ThemedClassName } from '../../util';
|
|
30
38
|
import { ElevationProvider } from '../ElevationProvider';
|
|
31
39
|
|
|
40
|
+
//
|
|
41
|
+
// Root
|
|
42
|
+
//
|
|
43
|
+
|
|
32
44
|
type AlertDialogRootProps = AlertDialogRootPrimitiveProps;
|
|
33
45
|
|
|
34
46
|
const AlertDialogRoot: FunctionComponent<AlertDialogRootProps> = (props) => (
|
|
@@ -37,22 +49,42 @@ const AlertDialogRoot: FunctionComponent<AlertDialogRootProps> = (props) => (
|
|
|
37
49
|
</ElevationProvider>
|
|
38
50
|
);
|
|
39
51
|
|
|
52
|
+
//
|
|
53
|
+
// Trigger
|
|
54
|
+
//
|
|
55
|
+
|
|
40
56
|
type AlertDialogTriggerProps = AlertDialogTriggerPrimitiveProps;
|
|
41
57
|
|
|
42
58
|
const AlertDialogTrigger: FunctionComponent<AlertDialogTriggerProps> = AlertDialogTriggerPrimitive;
|
|
43
59
|
|
|
60
|
+
//
|
|
61
|
+
// Portal
|
|
62
|
+
//
|
|
63
|
+
|
|
44
64
|
type AlertDialogPortalProps = AlertDialogPortalPrimitiveProps;
|
|
45
65
|
|
|
46
66
|
const AlertDialogPortal: FunctionComponent<AlertDialogPortalProps> = AlertDialogPortalPrimitive;
|
|
47
67
|
|
|
68
|
+
//
|
|
69
|
+
// Cancel
|
|
70
|
+
//
|
|
71
|
+
|
|
48
72
|
type AlertDialogCancelProps = AlertDialogCancelPrimitiveProps;
|
|
49
73
|
|
|
50
74
|
const AlertDialogCancel: FunctionComponent<AlertDialogCancelProps> = AlertDialogCancelPrimitive;
|
|
51
75
|
|
|
76
|
+
//
|
|
77
|
+
// Action
|
|
78
|
+
//
|
|
79
|
+
|
|
52
80
|
type AlertDialogActionProps = AlertDialogActionPrimitiveProps;
|
|
53
81
|
|
|
54
82
|
const AlertDialogAction: FunctionComponent<AlertDialogActionProps> = AlertDialogActionPrimitive;
|
|
55
83
|
|
|
84
|
+
//
|
|
85
|
+
// Title
|
|
86
|
+
//
|
|
87
|
+
|
|
56
88
|
type AlertDialogTitleProps = ThemedClassName<AlertDialogTitlePrimitiveProps> & { srOnly?: boolean };
|
|
57
89
|
|
|
58
90
|
const AlertDialogTitle: ForwardRefExoticComponent<AlertDialogTitleProps> = forwardRef<
|
|
@@ -61,14 +93,14 @@ const AlertDialogTitle: ForwardRefExoticComponent<AlertDialogTitleProps> = forwa
|
|
|
61
93
|
>(({ classNames, srOnly, ...props }, forwardedRef) => {
|
|
62
94
|
const { tx } = useThemeContext();
|
|
63
95
|
return (
|
|
64
|
-
<AlertDialogTitlePrimitive
|
|
65
|
-
{...props}
|
|
66
|
-
className={tx('dialog.title', 'dialog--alert__title', { srOnly }, classNames)}
|
|
67
|
-
ref={forwardedRef}
|
|
68
|
-
/>
|
|
96
|
+
<AlertDialogTitlePrimitive {...props} className={tx('dialog.title', { srOnly }, classNames)} ref={forwardedRef} />
|
|
69
97
|
);
|
|
70
98
|
});
|
|
71
99
|
|
|
100
|
+
//
|
|
101
|
+
// Description
|
|
102
|
+
//
|
|
103
|
+
|
|
72
104
|
type AlertDialogDescriptionProps = ThemedClassName<AlertDialogDescriptionPrimitiveProps> & { srOnly?: boolean };
|
|
73
105
|
|
|
74
106
|
const AlertDialogDescription: ForwardRefExoticComponent<AlertDialogTitleProps> = forwardRef<
|
|
@@ -79,15 +111,23 @@ const AlertDialogDescription: ForwardRefExoticComponent<AlertDialogTitleProps> =
|
|
|
79
111
|
return (
|
|
80
112
|
<AlertDialogDescriptionPrimitive
|
|
81
113
|
{...props}
|
|
82
|
-
className={tx('dialog.description',
|
|
114
|
+
className={tx('dialog.description', { srOnly }, classNames)}
|
|
83
115
|
ref={forwardedRef}
|
|
84
116
|
/>
|
|
85
117
|
);
|
|
86
118
|
});
|
|
87
119
|
|
|
88
120
|
type OverlayLayoutContextValue = { inOverlayLayout?: boolean };
|
|
121
|
+
|
|
122
|
+
//
|
|
123
|
+
// Context
|
|
124
|
+
//
|
|
125
|
+
|
|
89
126
|
const ALERT_DIALOG_OVERLAY_NAME = 'AlertDialogOverlay';
|
|
90
127
|
const ALERT_DIALOG_CONTENT_NAME = 'AlertDialogContent';
|
|
128
|
+
const ALERT_DIALOG_BODY_NAME = 'AlertDialogBody';
|
|
129
|
+
const ALERT_DIALOG_ACTIONBAR_NAME = 'AlertDialogActionBar';
|
|
130
|
+
|
|
91
131
|
const [OverlayLayoutProvider, useOverlayLayoutContext] = createContext<OverlayLayoutContextValue>(
|
|
92
132
|
ALERT_DIALOG_OVERLAY_NAME,
|
|
93
133
|
{
|
|
@@ -95,6 +135,10 @@ const [OverlayLayoutProvider, useOverlayLayoutContext] = createContext<OverlayLa
|
|
|
95
135
|
},
|
|
96
136
|
);
|
|
97
137
|
|
|
138
|
+
//
|
|
139
|
+
// Overlay
|
|
140
|
+
//
|
|
141
|
+
|
|
98
142
|
type AlertDialogOverlayProps = ThemedClassName<AlertDialogOverlayPrimitiveProps> & {
|
|
99
143
|
blockAlign?: 'center' | 'start' | 'end';
|
|
100
144
|
};
|
|
@@ -107,17 +151,17 @@ const AlertDialogOverlay: ForwardRefExoticComponent<AlertDialogOverlayProps> = f
|
|
|
107
151
|
return (
|
|
108
152
|
<AlertDialogOverlayPrimitive
|
|
109
153
|
{...props}
|
|
154
|
+
data-block-align={blockAlign}
|
|
110
155
|
className={tx(
|
|
111
156
|
'dialog.overlay',
|
|
112
|
-
'dialog--alert__overlay',
|
|
113
157
|
{},
|
|
114
158
|
classNames,
|
|
115
|
-
|
|
116
|
-
'data-[
|
|
117
|
-
'data-[
|
|
159
|
+
// TODO(burdon): Move to dialog.ts.
|
|
160
|
+
'data-[h-align=start]:justify-center',
|
|
161
|
+
'data-[h-align=start]:items-start',
|
|
162
|
+
'data-[h-align=center]:place-content-center',
|
|
118
163
|
)}
|
|
119
164
|
ref={forwardedRef}
|
|
120
|
-
data-block-align={blockAlign}
|
|
121
165
|
>
|
|
122
166
|
<OverlayLayoutProvider inOverlayLayout>{children}</OverlayLayoutProvider>
|
|
123
167
|
</AlertDialogOverlayPrimitive>
|
|
@@ -126,35 +170,89 @@ const AlertDialogOverlay: ForwardRefExoticComponent<AlertDialogOverlayProps> = f
|
|
|
126
170
|
|
|
127
171
|
AlertDialogOverlay.displayName = ALERT_DIALOG_OVERLAY_NAME;
|
|
128
172
|
|
|
129
|
-
|
|
173
|
+
//
|
|
174
|
+
// Content
|
|
175
|
+
//
|
|
176
|
+
|
|
177
|
+
type AlertDialogContentProps = ThemedClassName<AlertDialogContentPrimitiveProps> & { size?: DialogSize };
|
|
130
178
|
|
|
131
179
|
const AlertDialogContent: ForwardRefExoticComponent<AlertDialogContentProps> = forwardRef<
|
|
132
180
|
HTMLDivElement,
|
|
133
181
|
AlertDialogContentProps
|
|
134
|
-
>(({ classNames, children, ...props }, forwardedRef) => {
|
|
182
|
+
>(({ classNames, children, size = 'md', ...props }, forwardedRef) => {
|
|
135
183
|
const { tx } = useThemeContext();
|
|
136
184
|
const { inOverlayLayout } = useOverlayLayoutContext(ALERT_DIALOG_CONTENT_NAME);
|
|
137
185
|
return (
|
|
138
186
|
<AlertDialogContentPrimitive
|
|
139
187
|
{...props}
|
|
140
|
-
className={tx('dialog.content',
|
|
188
|
+
className={tx('dialog.content', { inOverlayLayout, size }, classNames)}
|
|
141
189
|
ref={forwardedRef}
|
|
142
190
|
>
|
|
143
|
-
{children}
|
|
191
|
+
<Column.Root>{children}</Column.Root>
|
|
144
192
|
</AlertDialogContentPrimitive>
|
|
145
193
|
);
|
|
146
194
|
});
|
|
147
195
|
|
|
148
196
|
AlertDialogContent.displayName = ALERT_DIALOG_CONTENT_NAME;
|
|
149
197
|
|
|
198
|
+
//
|
|
199
|
+
// Body
|
|
200
|
+
//
|
|
201
|
+
|
|
202
|
+
type AlertDialogBodyProps = PropsWithChildren;
|
|
203
|
+
|
|
204
|
+
const AlertDialogBody: ForwardRefExoticComponent<AlertDialogBodyProps> = forwardRef<
|
|
205
|
+
HTMLDivElement,
|
|
206
|
+
AlertDialogBodyProps
|
|
207
|
+
>(({ children, ...props }, forwardedRef) => {
|
|
208
|
+
const { tx } = useThemeContext();
|
|
209
|
+
return (
|
|
210
|
+
<Column.Segment asChild>
|
|
211
|
+
<div role='none' {...props} className={tx('dialog.body')} ref={forwardedRef}>
|
|
212
|
+
{children}
|
|
213
|
+
</div>
|
|
214
|
+
</Column.Segment>
|
|
215
|
+
);
|
|
216
|
+
});
|
|
217
|
+
|
|
218
|
+
AlertDialogBody.displayName = ALERT_DIALOG_BODY_NAME;
|
|
219
|
+
|
|
220
|
+
//
|
|
221
|
+
// ActionBar
|
|
222
|
+
//
|
|
223
|
+
|
|
224
|
+
type AlertDialogActionBarProps = ThemedClassName<PropsWithChildren>;
|
|
225
|
+
|
|
226
|
+
const AlertDialogActionBar: ForwardRefExoticComponent<AlertDialogActionBarProps> = forwardRef<
|
|
227
|
+
HTMLDivElement,
|
|
228
|
+
AlertDialogActionBarProps
|
|
229
|
+
>(({ children, classNames, ...props }, forwardedRef) => {
|
|
230
|
+
const { tx } = useThemeContext();
|
|
231
|
+
return (
|
|
232
|
+
<Column.Segment asChild>
|
|
233
|
+
<div {...props} className={tx('dialog.actionbar', {}, classNames)} ref={forwardedRef}>
|
|
234
|
+
{children}
|
|
235
|
+
</div>
|
|
236
|
+
</Column.Segment>
|
|
237
|
+
);
|
|
238
|
+
});
|
|
239
|
+
|
|
240
|
+
AlertDialogActionBar.displayName = ALERT_DIALOG_ACTIONBAR_NAME;
|
|
241
|
+
|
|
242
|
+
//
|
|
243
|
+
// AlertDialog
|
|
244
|
+
//
|
|
245
|
+
|
|
150
246
|
export const AlertDialog = {
|
|
151
247
|
Root: AlertDialogRoot,
|
|
152
248
|
Trigger: AlertDialogTrigger,
|
|
153
249
|
Portal: AlertDialogPortal,
|
|
154
250
|
Overlay: AlertDialogOverlay,
|
|
155
251
|
Content: AlertDialogContent,
|
|
252
|
+
Body: AlertDialogBody,
|
|
156
253
|
Title: AlertDialogTitle,
|
|
157
254
|
Description: AlertDialogDescription,
|
|
255
|
+
ActionBar: AlertDialogActionBar,
|
|
158
256
|
Cancel: AlertDialogCancel,
|
|
159
257
|
Action: AlertDialogAction,
|
|
160
258
|
};
|
|
@@ -165,8 +263,10 @@ export type {
|
|
|
165
263
|
AlertDialogPortalProps,
|
|
166
264
|
AlertDialogOverlayProps,
|
|
167
265
|
AlertDialogContentProps,
|
|
266
|
+
AlertDialogBodyProps,
|
|
168
267
|
AlertDialogTitleProps,
|
|
169
268
|
AlertDialogDescriptionProps,
|
|
269
|
+
AlertDialogActionBarProps,
|
|
170
270
|
AlertDialogCancelProps,
|
|
171
271
|
AlertDialogActionProps,
|
|
172
272
|
};
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2022 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
6
|
+
import React from 'react';
|
|
7
|
+
|
|
8
|
+
import { faker } from '@dxos/random';
|
|
9
|
+
|
|
10
|
+
import { withTheme } from '../../testing';
|
|
11
|
+
import { Button } from '../Button';
|
|
12
|
+
import { Input } from '../Input';
|
|
13
|
+
|
|
14
|
+
import { Dialog, type DialogContentProps } from './Dialog';
|
|
15
|
+
|
|
16
|
+
type StoryProps = Pick<DialogContentProps, 'size'> &
|
|
17
|
+
Partial<{
|
|
18
|
+
title: string;
|
|
19
|
+
description: string;
|
|
20
|
+
openTrigger: string;
|
|
21
|
+
closeTrigger: string;
|
|
22
|
+
blockAlign: 'start' | 'center';
|
|
23
|
+
}>;
|
|
24
|
+
|
|
25
|
+
const DefaultStory = ({ size, title, description, openTrigger, closeTrigger, blockAlign }: StoryProps) => {
|
|
26
|
+
return (
|
|
27
|
+
<Dialog.Root defaultOpen modal>
|
|
28
|
+
<Dialog.Trigger asChild>
|
|
29
|
+
<Button>{openTrigger}</Button>
|
|
30
|
+
</Dialog.Trigger>
|
|
31
|
+
<Dialog.Overlay blockAlign={blockAlign}>
|
|
32
|
+
<Dialog.Content size={size}>
|
|
33
|
+
<Dialog.Header>
|
|
34
|
+
<Dialog.Title>{title}</Dialog.Title>
|
|
35
|
+
{closeTrigger && (
|
|
36
|
+
<Dialog.Close asChild>
|
|
37
|
+
<Dialog.CloseIconButton />
|
|
38
|
+
</Dialog.Close>
|
|
39
|
+
)}
|
|
40
|
+
</Dialog.Header>
|
|
41
|
+
<Dialog.Body>
|
|
42
|
+
<Dialog.Description>{description}</Dialog.Description>
|
|
43
|
+
<Input.Root>
|
|
44
|
+
<Input.Label>Value</Input.Label>
|
|
45
|
+
<Input.TextInput placeholder='Enter value' />
|
|
46
|
+
</Input.Root>
|
|
47
|
+
</Dialog.Body>
|
|
48
|
+
<Dialog.ActionBar>
|
|
49
|
+
<Dialog.Close asChild>
|
|
50
|
+
<Button variant='primary'>{closeTrigger}</Button>
|
|
51
|
+
</Dialog.Close>
|
|
52
|
+
</Dialog.ActionBar>
|
|
53
|
+
</Dialog.Content>
|
|
54
|
+
</Dialog.Overlay>
|
|
55
|
+
</Dialog.Root>
|
|
56
|
+
);
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
const meta = {
|
|
60
|
+
title: 'ui/react-ui-core/components/Dialog',
|
|
61
|
+
component: Dialog as any,
|
|
62
|
+
render: DefaultStory,
|
|
63
|
+
decorators: [withTheme()],
|
|
64
|
+
} satisfies Meta<typeof DefaultStory>;
|
|
65
|
+
|
|
66
|
+
export default meta;
|
|
67
|
+
|
|
68
|
+
type Story = StoryObj<typeof meta>;
|
|
69
|
+
|
|
70
|
+
export const Default: Story = {
|
|
71
|
+
args: {
|
|
72
|
+
title: 'Dialog title',
|
|
73
|
+
description: faker.lorem.paragraph(1),
|
|
74
|
+
openTrigger: 'Open',
|
|
75
|
+
closeTrigger: 'Close',
|
|
76
|
+
blockAlign: 'start',
|
|
77
|
+
},
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
export const Small: Story = {
|
|
81
|
+
args: {
|
|
82
|
+
title: 'Dialog title',
|
|
83
|
+
description: faker.lorem.paragraph(1),
|
|
84
|
+
openTrigger: 'Open',
|
|
85
|
+
closeTrigger: 'Close',
|
|
86
|
+
blockAlign: 'center',
|
|
87
|
+
size: 'sm',
|
|
88
|
+
},
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
export const Medium: Story = {
|
|
92
|
+
args: {
|
|
93
|
+
title: 'Dialog title',
|
|
94
|
+
description: faker.lorem.paragraph(1),
|
|
95
|
+
openTrigger: 'Open',
|
|
96
|
+
closeTrigger: 'Close',
|
|
97
|
+
blockAlign: 'center',
|
|
98
|
+
size: 'md',
|
|
99
|
+
},
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
export const Large: Story = {
|
|
103
|
+
args: {
|
|
104
|
+
title: 'Dialog title',
|
|
105
|
+
description: faker.lorem.paragraph(2),
|
|
106
|
+
openTrigger: 'Open Dialog',
|
|
107
|
+
closeTrigger: 'Close',
|
|
108
|
+
blockAlign: 'center',
|
|
109
|
+
size: 'lg',
|
|
110
|
+
},
|
|
111
|
+
};
|
|
112
|
+
|
|
113
|
+
export const ExtraLarge: Story = {
|
|
114
|
+
args: {
|
|
115
|
+
title: 'Dialog title',
|
|
116
|
+
description: faker.lorem.paragraph(2),
|
|
117
|
+
openTrigger: 'Open Dialog',
|
|
118
|
+
closeTrigger: 'Close',
|
|
119
|
+
blockAlign: 'center',
|
|
120
|
+
size: 'xl',
|
|
121
|
+
},
|
|
122
|
+
};
|
|
@@ -7,7 +7,6 @@ import {
|
|
|
7
7
|
DialogClose as DialogClosePrimitive,
|
|
8
8
|
type DialogCloseProps as DialogClosePrimitiveProps,
|
|
9
9
|
DialogContent as DialogContentPrimitive,
|
|
10
|
-
type DialogContentProps as DialogContentPrimitiveProps,
|
|
11
10
|
DialogDescription as DialogDescriptionPrimitive,
|
|
12
11
|
type DialogDescriptionProps as DialogDescriptionPrimitiveProps,
|
|
13
12
|
DialogOverlay as DialogOverlayPrimitive,
|
|
@@ -21,12 +20,27 @@ import {
|
|
|
21
20
|
DialogTrigger as DialogTriggerPrimitive,
|
|
22
21
|
type DialogTriggerProps as DialogTriggerPrimitiveProps,
|
|
23
22
|
} from '@radix-ui/react-dialog';
|
|
24
|
-
import React, {
|
|
23
|
+
import React, {
|
|
24
|
+
type ComponentPropsWithRef,
|
|
25
|
+
type ForwardRefExoticComponent,
|
|
26
|
+
type FunctionComponent,
|
|
27
|
+
type PropsWithChildren,
|
|
28
|
+
forwardRef,
|
|
29
|
+
} from 'react';
|
|
30
|
+
import { useTranslation } from 'react-i18next';
|
|
31
|
+
|
|
32
|
+
import { type DialogSize, osTranslations } from '@dxos/ui-theme';
|
|
25
33
|
|
|
26
34
|
import { useThemeContext } from '../../hooks';
|
|
35
|
+
import { Column } from '../../primitives';
|
|
27
36
|
import { type ThemedClassName } from '../../util';
|
|
37
|
+
import { IconButton } from '../Button';
|
|
28
38
|
import { ElevationProvider } from '../ElevationProvider';
|
|
29
39
|
|
|
40
|
+
//
|
|
41
|
+
// Root
|
|
42
|
+
//
|
|
43
|
+
|
|
30
44
|
type DialogRootProps = DialogRootPrimitiveProps;
|
|
31
45
|
|
|
32
46
|
const DialogRoot: FunctionComponent<DialogRootProps> = (props) => (
|
|
@@ -35,52 +49,30 @@ const DialogRoot: FunctionComponent<DialogRootProps> = (props) => (
|
|
|
35
49
|
</ElevationProvider>
|
|
36
50
|
);
|
|
37
51
|
|
|
52
|
+
//
|
|
53
|
+
// Trigger
|
|
54
|
+
//
|
|
55
|
+
|
|
38
56
|
type DialogTriggerProps = DialogTriggerPrimitiveProps;
|
|
39
57
|
|
|
40
58
|
const DialogTrigger: FunctionComponent<DialogTriggerProps> = DialogTriggerPrimitive;
|
|
41
59
|
|
|
60
|
+
//
|
|
61
|
+
// Portal
|
|
62
|
+
//
|
|
63
|
+
|
|
42
64
|
type DialogPortalProps = DialogPortalPrimitiveProps;
|
|
43
65
|
|
|
44
66
|
const DialogPortal: FunctionComponent<DialogPortalProps> = DialogPortalPrimitive;
|
|
45
67
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
({ classNames, srOnly, ...props }, forwardedRef) => {
|
|
50
|
-
const { tx } = useThemeContext();
|
|
51
|
-
return (
|
|
52
|
-
<DialogTitlePrimitive
|
|
53
|
-
{...props}
|
|
54
|
-
className={tx('dialog.title', 'dialog__title', { srOnly }, classNames)}
|
|
55
|
-
ref={forwardedRef}
|
|
56
|
-
/>
|
|
57
|
-
);
|
|
58
|
-
},
|
|
59
|
-
);
|
|
60
|
-
|
|
61
|
-
type DialogDescriptionProps = ThemedClassName<DialogDescriptionPrimitiveProps> & { srOnly?: boolean };
|
|
62
|
-
|
|
63
|
-
const DialogDescription: ForwardRefExoticComponent<DialogTitleProps> = forwardRef<
|
|
64
|
-
HTMLParagraphElement,
|
|
65
|
-
DialogDescriptionProps
|
|
66
|
-
>(({ classNames, srOnly, ...props }, forwardedRef) => {
|
|
67
|
-
const { tx } = useThemeContext();
|
|
68
|
-
return (
|
|
69
|
-
<DialogDescriptionPrimitive
|
|
70
|
-
{...props}
|
|
71
|
-
className={tx('dialog.description', 'dialog__description', { srOnly }, classNames)}
|
|
72
|
-
ref={forwardedRef}
|
|
73
|
-
/>
|
|
74
|
-
);
|
|
75
|
-
});
|
|
76
|
-
|
|
77
|
-
type DialogCloseProps = DialogClosePrimitiveProps;
|
|
68
|
+
//
|
|
69
|
+
// Overlay
|
|
70
|
+
//
|
|
78
71
|
|
|
79
|
-
const
|
|
72
|
+
const DIALOG_OVERLAY_NAME = 'DialogOverlay';
|
|
80
73
|
|
|
81
74
|
type OverlayLayoutContextValue = { inOverlayLayout?: boolean };
|
|
82
|
-
|
|
83
|
-
const DIALOG_CONTENT_NAME = 'DialogContent';
|
|
75
|
+
|
|
84
76
|
const [OverlayLayoutProvider, useOverlayLayoutContext] = createContext<OverlayLayoutContextValue>(
|
|
85
77
|
DIALOG_OVERLAY_NAME,
|
|
86
78
|
{},
|
|
@@ -95,9 +87,9 @@ const DialogOverlay: ForwardRefExoticComponent<DialogOverlayProps> = forwardRef<
|
|
|
95
87
|
return (
|
|
96
88
|
<DialogOverlayPrimitive
|
|
97
89
|
{...props}
|
|
98
|
-
className={tx('dialog.overlay', 'dialog__overlay', {}, classNames)}
|
|
99
|
-
ref={forwardedRef}
|
|
100
90
|
data-block-align={blockAlign}
|
|
91
|
+
className={tx('dialog.overlay', {}, classNames)}
|
|
92
|
+
ref={forwardedRef}
|
|
101
93
|
>
|
|
102
94
|
<OverlayLayoutProvider inOverlayLayout>{children}</OverlayLayoutProvider>
|
|
103
95
|
</DialogOverlayPrimitive>
|
|
@@ -107,28 +99,32 @@ const DialogOverlay: ForwardRefExoticComponent<DialogOverlayProps> = forwardRef<
|
|
|
107
99
|
|
|
108
100
|
DialogOverlay.displayName = DIALOG_OVERLAY_NAME;
|
|
109
101
|
|
|
110
|
-
|
|
102
|
+
//
|
|
103
|
+
// Content
|
|
104
|
+
//
|
|
105
|
+
|
|
106
|
+
const DIALOG_CONTENT_NAME = 'DialogContent';
|
|
107
|
+
|
|
108
|
+
type DialogContentProps = ThemedClassName<ComponentPropsWithRef<typeof DialogContentPrimitive>> & {
|
|
109
|
+
size?: DialogSize;
|
|
110
|
+
inOverlayLayout?: boolean;
|
|
111
|
+
};
|
|
111
112
|
|
|
112
113
|
const DialogContent: ForwardRefExoticComponent<DialogContentProps> = forwardRef<HTMLDivElement, DialogContentProps>(
|
|
113
|
-
({ classNames, children, inOverlayLayout: propsInOverlayLayout, ...props }, forwardedRef) => {
|
|
114
|
+
({ classNames, children, size = 'md', inOverlayLayout: propsInOverlayLayout, ...props }, forwardedRef) => {
|
|
114
115
|
const { tx } = useThemeContext();
|
|
115
116
|
const { inOverlayLayout } = useOverlayLayoutContext(DIALOG_CONTENT_NAME);
|
|
116
117
|
|
|
117
118
|
return (
|
|
118
119
|
<DialogContentPrimitive
|
|
120
|
+
{...props}
|
|
119
121
|
// NOTE: Radix warning unless set to undefined.
|
|
120
122
|
// https://www.radix-ui.com/primitives/docs/components/dialog#description
|
|
121
123
|
aria-describedby={undefined}
|
|
122
|
-
{
|
|
123
|
-
className={tx(
|
|
124
|
-
'dialog.content',
|
|
125
|
-
'dialog',
|
|
126
|
-
{ inOverlayLayout: propsInOverlayLayout || inOverlayLayout },
|
|
127
|
-
classNames,
|
|
128
|
-
)}
|
|
124
|
+
className={tx('dialog.content', { inOverlayLayout: propsInOverlayLayout || inOverlayLayout, size }, classNames)}
|
|
129
125
|
ref={forwardedRef}
|
|
130
126
|
>
|
|
131
|
-
{children}
|
|
127
|
+
<Column.Root>{children}</Column.Root>
|
|
132
128
|
</DialogContentPrimitive>
|
|
133
129
|
);
|
|
134
130
|
},
|
|
@@ -136,15 +132,146 @@ const DialogContent: ForwardRefExoticComponent<DialogContentProps> = forwardRef<
|
|
|
136
132
|
|
|
137
133
|
DialogContent.displayName = DIALOG_CONTENT_NAME;
|
|
138
134
|
|
|
135
|
+
//
|
|
136
|
+
// Header
|
|
137
|
+
//
|
|
138
|
+
|
|
139
|
+
type DialogHeaderProps = ThemedClassName<PropsWithChildren> & { srOnly?: boolean };
|
|
140
|
+
|
|
141
|
+
const DialogHeader: ForwardRefExoticComponent<DialogTitleProps> = forwardRef<HTMLHeadingElement, DialogTitleProps>(
|
|
142
|
+
({ classNames, srOnly, ...props }, forwardedRef) => {
|
|
143
|
+
const { tx } = useThemeContext();
|
|
144
|
+
return (
|
|
145
|
+
<Column.Segment asChild>
|
|
146
|
+
<div role='heading' {...props} className={tx('dialog.header', { srOnly }, [classNames])} ref={forwardedRef} />
|
|
147
|
+
</Column.Segment>
|
|
148
|
+
);
|
|
149
|
+
},
|
|
150
|
+
);
|
|
151
|
+
|
|
152
|
+
//
|
|
153
|
+
// CloseIconButton
|
|
154
|
+
//
|
|
155
|
+
|
|
156
|
+
type DialogCloseIconButtonProps = { label?: string };
|
|
157
|
+
|
|
158
|
+
const DialogCloseIconButton = forwardRef<HTMLButtonElement, DialogCloseIconButtonProps>(
|
|
159
|
+
({ label, ...props }, forwardedRef) => {
|
|
160
|
+
const { t } = useTranslation(osTranslations);
|
|
161
|
+
return (
|
|
162
|
+
<IconButton
|
|
163
|
+
{...props}
|
|
164
|
+
label={label ?? t('close dialog label')}
|
|
165
|
+
icon='ph--x--regular'
|
|
166
|
+
iconOnly
|
|
167
|
+
size={4}
|
|
168
|
+
density='fine'
|
|
169
|
+
variant='ghost'
|
|
170
|
+
ref={forwardedRef}
|
|
171
|
+
/>
|
|
172
|
+
);
|
|
173
|
+
},
|
|
174
|
+
);
|
|
175
|
+
|
|
176
|
+
//
|
|
177
|
+
// Body
|
|
178
|
+
//
|
|
179
|
+
|
|
180
|
+
type DialogBodyProps = PropsWithChildren;
|
|
181
|
+
|
|
182
|
+
const DialogBody: ForwardRefExoticComponent<DialogBodyProps> = forwardRef<HTMLDivElement, DialogBodyProps>(
|
|
183
|
+
({ children, ...props }, forwardedRef) => {
|
|
184
|
+
const { tx } = useThemeContext();
|
|
185
|
+
return (
|
|
186
|
+
<Column.Segment asChild>
|
|
187
|
+
<div role='none' {...props} className={tx('dialog.body')} ref={forwardedRef}>
|
|
188
|
+
{children}
|
|
189
|
+
</div>
|
|
190
|
+
</Column.Segment>
|
|
191
|
+
);
|
|
192
|
+
},
|
|
193
|
+
);
|
|
194
|
+
|
|
195
|
+
//
|
|
196
|
+
// Title
|
|
197
|
+
//
|
|
198
|
+
|
|
199
|
+
type DialogTitleProps = ThemedClassName<DialogTitlePrimitiveProps> & { srOnly?: boolean };
|
|
200
|
+
|
|
201
|
+
const DialogTitle: ForwardRefExoticComponent<DialogTitleProps> = forwardRef<HTMLHeadingElement, DialogTitleProps>(
|
|
202
|
+
({ classNames, srOnly, ...props }, forwardedRef) => {
|
|
203
|
+
const { tx } = useThemeContext();
|
|
204
|
+
return (
|
|
205
|
+
<DialogTitlePrimitive {...props} className={tx('dialog.title', { srOnly }, classNames)} ref={forwardedRef} />
|
|
206
|
+
);
|
|
207
|
+
},
|
|
208
|
+
);
|
|
209
|
+
|
|
210
|
+
//
|
|
211
|
+
// Description
|
|
212
|
+
//
|
|
213
|
+
|
|
214
|
+
type DialogDescriptionProps = ThemedClassName<DialogDescriptionPrimitiveProps> & { srOnly?: boolean };
|
|
215
|
+
|
|
216
|
+
const DialogDescription: ForwardRefExoticComponent<DialogTitleProps> = forwardRef<
|
|
217
|
+
HTMLParagraphElement,
|
|
218
|
+
DialogDescriptionProps
|
|
219
|
+
>(({ classNames, srOnly, ...props }, forwardedRef) => {
|
|
220
|
+
const { tx } = useThemeContext();
|
|
221
|
+
return (
|
|
222
|
+
<DialogDescriptionPrimitive
|
|
223
|
+
{...props}
|
|
224
|
+
className={tx('dialog.description', { srOnly }, classNames)}
|
|
225
|
+
ref={forwardedRef}
|
|
226
|
+
/>
|
|
227
|
+
);
|
|
228
|
+
});
|
|
229
|
+
|
|
230
|
+
//
|
|
231
|
+
// ActionBar
|
|
232
|
+
//
|
|
233
|
+
|
|
234
|
+
type DialogActionBarProps = ThemedClassName<PropsWithChildren>;
|
|
235
|
+
|
|
236
|
+
const DialogActionBar: ForwardRefExoticComponent<DialogActionBarProps> = forwardRef<
|
|
237
|
+
HTMLDivElement,
|
|
238
|
+
DialogActionBarProps
|
|
239
|
+
>(({ children, classNames, ...props }, forwardedRef) => {
|
|
240
|
+
const { tx } = useThemeContext();
|
|
241
|
+
return (
|
|
242
|
+
<Column.Segment asChild>
|
|
243
|
+
<div {...props} className={tx('dialog.actionbar', {}, classNames)} ref={forwardedRef}>
|
|
244
|
+
{children}
|
|
245
|
+
</div>
|
|
246
|
+
</Column.Segment>
|
|
247
|
+
);
|
|
248
|
+
});
|
|
249
|
+
|
|
250
|
+
//
|
|
251
|
+
// Close
|
|
252
|
+
//
|
|
253
|
+
|
|
254
|
+
type DialogCloseProps = DialogClosePrimitiveProps;
|
|
255
|
+
|
|
256
|
+
const DialogClose: FunctionComponent<DialogCloseProps> = DialogClosePrimitive;
|
|
257
|
+
|
|
258
|
+
//
|
|
259
|
+
// Dialog
|
|
260
|
+
//
|
|
261
|
+
|
|
139
262
|
export const Dialog = {
|
|
140
263
|
Root: DialogRoot,
|
|
141
264
|
Trigger: DialogTrigger,
|
|
142
265
|
Portal: DialogPortal,
|
|
143
266
|
Overlay: DialogOverlay,
|
|
144
267
|
Content: DialogContent,
|
|
268
|
+
Header: DialogHeader,
|
|
269
|
+
Body: DialogBody,
|
|
145
270
|
Title: DialogTitle,
|
|
146
271
|
Description: DialogDescription,
|
|
272
|
+
ActionBar: DialogActionBar,
|
|
147
273
|
Close: DialogClose,
|
|
274
|
+
CloseIconButton: DialogCloseIconButton,
|
|
148
275
|
};
|
|
149
276
|
|
|
150
277
|
export type {
|
|
@@ -153,7 +280,10 @@ export type {
|
|
|
153
280
|
DialogPortalProps,
|
|
154
281
|
DialogOverlayProps,
|
|
155
282
|
DialogContentProps,
|
|
283
|
+
DialogHeaderProps,
|
|
284
|
+
DialogBodyProps,
|
|
156
285
|
DialogTitleProps,
|
|
157
286
|
DialogDescriptionProps,
|
|
287
|
+
DialogActionBarProps,
|
|
158
288
|
DialogCloseProps,
|
|
159
289
|
};
|