@dxos/react-ui 0.8.4-main.67995b8 → 0.8.4-main.69d29f4
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-CEKVHJ27.mjs +774 -0
- package/dist/lib/browser/chunk-CEKVHJ27.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +3069 -59
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/testing/index.mjs +65 -49
- package/dist/lib/browser/testing/index.mjs.map +4 -4
- package/dist/lib/node-esm/chunk-2NHEX4AD.mjs +776 -0
- package/dist/lib/node-esm/chunk-2NHEX4AD.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +3069 -59
- 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 +65 -49
- package/dist/lib/node-esm/testing/index.mjs.map +4 -4
- package/dist/types/src/components/Avatars/Avatar.d.ts +1 -1
- package/dist/types/src/components/Avatars/Avatar.d.ts.map +1 -1
- package/dist/types/src/components/Avatars/Avatar.stories.d.ts +5 -31
- package/dist/types/src/components/Avatars/Avatar.stories.d.ts.map +1 -1
- package/dist/types/src/components/Avatars/AvatarGroup.stories.d.ts +5 -11
- package/dist/types/src/components/Avatars/AvatarGroup.stories.d.ts.map +1 -1
- package/dist/types/src/components/Breadcrumb/Breadcrumb.d.ts +1 -1
- package/dist/types/src/components/Breadcrumb/Breadcrumb.d.ts.map +1 -1
- package/dist/types/src/components/Breadcrumb/Breadcrumb.stories.d.ts +8 -20
- package/dist/types/src/components/Breadcrumb/Breadcrumb.stories.d.ts.map +1 -1
- package/dist/types/src/components/{Buttons → Button}/Button.d.ts +2 -2
- package/dist/types/src/components/Button/Button.d.ts.map +1 -0
- package/dist/types/src/components/Button/Button.stories.d.ts +17 -0
- package/dist/types/src/components/Button/Button.stories.d.ts.map +1 -0
- package/dist/types/src/components/{Buttons → Button}/IconButton.d.ts +4 -4
- package/dist/types/src/components/Button/IconButton.d.ts.map +1 -0
- package/dist/types/src/components/Button/IconButton.stories.d.ts +13 -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/Button/ToggleGroup.d.ts +27 -0
- package/dist/types/src/components/Button/ToggleGroup.d.ts.map +1 -0
- package/dist/types/src/components/Button/ToggleGroup.stories.d.ts +27 -0
- 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/ClipboardProvider.d.ts.map +1 -1
- 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 +1 -1
- package/dist/types/src/components/Dialog/AlertDialog.d.ts.map +1 -0
- package/dist/types/src/components/Dialog/AlertDialog.stories.d.ts +11 -0
- package/dist/types/src/components/Dialog/AlertDialog.stories.d.ts.map +1 -0
- package/dist/types/src/components/Dialog/Dialog.d.ts +40 -0
- package/dist/types/src/components/Dialog/Dialog.d.ts.map +1 -0
- package/dist/types/src/components/Dialog/Dialog.stories.d.ts +27 -0
- 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 +2 -2
- 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 +6 -5
- package/dist/types/src/components/Input/Input.d.ts.map +1 -1
- package/dist/types/src/components/Input/Input.stories.d.ts +11 -12
- package/dist/types/src/components/Input/Input.stories.d.ts.map +1 -1
- package/dist/types/src/components/Link/Link.stories.d.ts +8 -8
- package/dist/types/src/components/Link/Link.stories.d.ts.map +1 -1
- package/dist/types/src/components/{Lists → List}/List.d.ts +3 -3
- package/dist/types/src/components/List/List.d.ts.map +1 -0
- package/dist/types/src/components/List/List.stories.d.ts +14 -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/{Lists → List}/Tree.d.ts +1 -1
- package/dist/types/src/components/List/Tree.d.ts.map +1 -0
- package/dist/types/src/components/List/Tree.stories.d.ts +15 -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/{Lists → List}/Treegrid.d.ts +1 -1
- package/dist/types/src/components/{Lists → List}/Treegrid.d.ts.map +1 -1
- package/dist/types/src/components/List/Treegrid.stories.d.ts +12 -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 +10 -19
- package/dist/types/src/components/Main/Main.d.ts.map +1 -1
- package/dist/types/src/components/Main/Main.stories.d.ts +6 -7
- 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 +12 -0
- package/dist/types/src/components/Menu/ContextMenu.stories.d.ts.map +1 -0
- package/dist/types/src/components/{Menus → Menu}/DropdownMenu.d.ts +8 -8
- package/dist/types/src/components/Menu/DropdownMenu.d.ts.map +1 -0
- package/dist/types/src/components/Menu/DropdownMenu.stories.d.ts +15 -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 +8 -17
- package/dist/types/src/components/Message/Message.stories.d.ts.map +1 -1
- package/dist/types/src/components/Popover/Popover.d.ts +3 -3
- package/dist/types/src/components/Popover/Popover.d.ts.map +1 -1
- package/dist/types/src/components/Popover/Popover.stories.d.ts +6 -34
- package/dist/types/src/components/Popover/Popover.stories.d.ts.map +1 -1
- package/dist/types/src/components/ScrollArea/ScrollArea.d.ts +10 -8
- package/dist/types/src/components/ScrollArea/ScrollArea.d.ts.map +1 -1
- package/dist/types/src/components/ScrollArea/ScrollArea.stories.d.ts +8 -30
- 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/Select/Select.stories.d.ts +4 -9
- package/dist/types/src/components/Select/Select.stories.d.ts.map +1 -1
- package/dist/types/src/components/Separator/Separator.d.ts +1 -1
- package/dist/types/src/components/Status/Status.stories.d.ts +2 -8
- 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 +12 -12
- package/dist/types/src/components/Tag/Tag.stories.d.ts.map +1 -1
- package/dist/types/src/components/ThemeProvider/ThemeProvider.d.ts +2 -3
- 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 +5 -5
- package/dist/types/src/components/Toast/Toast.d.ts.map +1 -1
- package/dist/types/src/components/Toast/Toast.stories.d.ts +6 -44
- package/dist/types/src/components/Toast/Toast.stories.d.ts.map +1 -1
- package/dist/types/src/components/Toolbar/Toolbar.d.ts +17 -17
- package/dist/types/src/components/Toolbar/Toolbar.d.ts.map +1 -1
- package/dist/types/src/components/Toolbar/Toolbar.stories.d.ts +6 -50
- package/dist/types/src/components/Toolbar/Toolbar.stories.d.ts.map +1 -1
- package/dist/types/src/components/Tooltip/Tooltip.d.ts +2 -4
- package/dist/types/src/components/Tooltip/Tooltip.d.ts.map +1 -1
- package/dist/types/src/components/Tooltip/Tooltip.stories.d.ts +8 -61
- package/dist/types/src/components/Tooltip/Tooltip.stories.d.ts.map +1 -1
- package/dist/types/src/components/index.d.ts +5 -4
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/hooks/useDensityContext.d.ts +1 -1
- package/dist/types/src/hooks/useDensityContext.d.ts.map +1 -1
- package/dist/types/src/hooks/useElevationContext.d.ts +1 -1
- package/dist/types/src/hooks/useElevationContext.d.ts.map +1 -1
- package/dist/types/src/hooks/useSafeArea.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 +1 -1
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/playground/Controls.stories.d.ts +5 -9
- package/dist/types/src/playground/Controls.stories.d.ts.map +1 -1
- package/dist/types/src/playground/Custom.stories.d.ts +12 -4
- package/dist/types/src/playground/Custom.stories.d.ts.map +1 -1
- package/dist/types/src/playground/Typography.stories.d.ts +5 -11
- package/dist/types/src/playground/Typography.stories.d.ts.map +1 -1
- 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 -0
- package/dist/types/src/testing/decorators/withTheme.d.ts.map +1 -1
- package/dist/types/src/util/index.d.ts +2 -1
- package/dist/types/src/util/index.d.ts.map +1 -1
- package/dist/types/src/util/usePx.d.ts +8 -0
- package/dist/types/src/util/usePx.d.ts.map +1 -0
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +37 -31
- package/src/components/Avatars/Avatar.stories.tsx +21 -12
- package/src/components/Avatars/Avatar.tsx +4 -4
- package/src/components/Avatars/AvatarGroup.stories.tsx +10 -6
- package/src/components/Breadcrumb/Breadcrumb.stories.tsx +17 -12
- package/src/components/Breadcrumb/Breadcrumb.tsx +1 -1
- package/src/components/{Buttons → Button}/Button.stories.tsx +8 -9
- package/src/components/{Buttons → Button}/Button.tsx +1 -1
- package/src/components/{Buttons → Button}/IconButton.stories.tsx +11 -8
- package/src/components/{Buttons → Button}/IconButton.tsx +22 -15
- package/src/components/{Buttons → Button}/Toggle.stories.tsx +13 -9
- package/src/components/{Buttons → Button}/ToggleGroup.stories.tsx +10 -7
- package/src/components/{Buttons → Button}/ToggleGroup.tsx +17 -4
- package/src/components/Clipboard/ClipboardProvider.tsx +1 -1
- package/src/components/Clipboard/CopyButton.tsx +6 -5
- package/src/components/DensityProvider/DensityProvider.tsx +2 -2
- package/src/components/{Dialogs → Dialog}/AlertDialog.stories.tsx +15 -12
- package/src/components/{Dialogs → Dialog}/AlertDialog.tsx +13 -13
- package/src/components/Dialog/Dialog.stories.tsx +97 -0
- package/src/components/{Dialogs → Dialog}/Dialog.tsx +151 -51
- package/src/components/ElevationProvider/ElevationProvider.tsx +2 -2
- package/src/components/Icon/Icon.stories.tsx +113 -0
- package/src/components/Icon/Icon.tsx +2 -2
- package/src/components/Input/Input.stories.tsx +13 -15
- package/src/components/Input/Input.tsx +28 -19
- package/src/components/Link/Link.stories.tsx +10 -6
- package/src/components/{Lists → List}/List.stories.tsx +32 -26
- package/src/components/{Lists → List}/List.tsx +17 -13
- package/src/components/{Lists → List}/ListDropIndicator.tsx +1 -1
- package/src/components/{Lists → List}/Tree.stories.tsx +11 -8
- package/src/components/{Lists → List}/Tree.tsx +4 -3
- package/src/components/{Lists → List}/TreeDropIndicator.tsx +1 -1
- package/src/components/{Lists → List}/Treegrid.stories.tsx +12 -6
- package/src/components/{Lists → List}/Treegrid.tsx +58 -17
- package/src/components/Main/Main.stories.tsx +17 -9
- package/src/components/Main/Main.tsx +43 -28
- package/src/components/{Menus → Menu}/ContextMenu.stories.tsx +11 -8
- package/src/components/{Menus → Menu}/ContextMenu.tsx +1 -0
- package/src/components/{Menus → Menu}/DropdownMenu.stories.tsx +12 -9
- package/src/components/{Menus → Menu}/DropdownMenu.tsx +102 -71
- package/src/components/Message/Message.stories.tsx +12 -8
- package/src/components/Message/Message.tsx +30 -5
- package/src/components/Popover/Popover.stories.tsx +12 -9
- package/src/components/Popover/Popover.tsx +64 -45
- package/src/components/ScrollArea/ScrollArea.stories.tsx +64 -11
- package/src/components/ScrollArea/ScrollArea.tsx +54 -8
- package/src/components/ScrollContainer/ScrollContainer.stories.tsx +70 -0
- package/src/components/ScrollContainer/ScrollContainer.tsx +233 -0
- package/src/components/ScrollContainer/index.ts +5 -0
- package/src/components/Select/Select.stories.tsx +15 -12
- package/src/components/Select/Select.tsx +9 -8
- package/src/components/Status/Status.stories.tsx +9 -6
- package/src/components/Tag/Tag.stories.tsx +20 -11
- package/src/components/Tag/Tag.tsx +1 -1
- package/src/components/ThemeProvider/ThemeProvider.tsx +3 -4
- package/src/components/ThemeProvider/TranslationsProvider.tsx +3 -18
- package/src/components/ThemeProvider/index.ts +3 -3
- package/src/components/Toast/Toast.stories.tsx +12 -9
- package/src/components/Toast/Toast.tsx +9 -9
- package/src/components/Toolbar/Toolbar.stories.tsx +14 -12
- package/src/components/Toolbar/Toolbar.tsx +37 -10
- package/src/components/Tooltip/Tooltip.stories.tsx +16 -12
- package/src/components/Tooltip/Tooltip.tsx +27 -24
- package/src/components/index.ts +5 -4
- package/src/hooks/useDensityContext.ts +1 -1
- package/src/hooks/useElevationContext.ts +1 -1
- package/src/hooks/useSafeArea.ts +3 -2
- package/src/hooks/useVisualViewport.ts +4 -4
- package/src/index.ts +1 -1
- package/src/playground/Controls.stories.tsx +12 -8
- package/src/playground/Custom.stories.tsx +13 -24
- package/src/playground/Typography.stories.tsx +8 -6
- package/src/testing/decorators/index.ts +2 -1
- package/src/testing/decorators/withLayout.tsx +63 -0
- package/src/testing/decorators/{withSurfaceVariantsLayout.tsx → withLayoutVariants.tsx} +5 -5
- package/src/testing/decorators/withTheme.tsx +32 -0
- package/src/util/index.ts +3 -1
- package/src/util/usePx.ts +61 -0
- package/dist/lib/browser/chunk-2COVUP44.mjs +0 -4373
- package/dist/lib/browser/chunk-2COVUP44.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-GHXHND5V.mjs +0 -4375
- package/dist/lib/node-esm/chunk-GHXHND5V.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 +0 -12
- 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 +0 -22
- 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 -19
- package/dist/types/src/components/Buttons/Toggle.stories.d.ts.map +0 -1
- package/dist/types/src/components/Buttons/ToggleGroup.d.ts +0 -28
- package/dist/types/src/components/Buttons/ToggleGroup.d.ts.map +0 -1
- package/dist/types/src/components/Buttons/ToggleGroup.stories.d.ts +0 -39
- 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 +0 -43
- 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 +0 -48
- 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 +0 -37
- 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 +0 -41
- 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.stories.d.ts +0 -10
- 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 +0 -50
- 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 +0 -50
- 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/src/components/Dialogs/Dialog.stories.tsx +0 -65
- package/src/testing/decorators/withTheme.ts +0 -25
- package/src/util/ThemedClassName.ts +0 -7
- /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}/index.d.ts +0 -0
- /package/dist/types/src/components/{Lists → List}/ListDropIndicator.d.ts +0 -0
- /package/dist/types/src/components/{Lists → List}/TreeDropIndicator.d.ts +0 -0
- /package/dist/types/src/components/{Lists → List}/index.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}/index.ts +0 -0
- /package/src/components/{Dialogs → Dialog}/index.ts +0 -0
- /package/src/components/{Lists → List}/index.ts +0 -0
- /package/src/components/{Menus → Menu}/index.ts +0 -0
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
// Copyright 2023 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import React, {
|
|
5
|
+
import React, { type PropsWithChildren, createContext } from 'react';
|
|
6
6
|
|
|
7
|
-
import { type Density } from '@dxos/
|
|
7
|
+
import { type Density } from '@dxos/ui-types';
|
|
8
8
|
|
|
9
9
|
export interface DensityContextValue {
|
|
10
10
|
density?: Density;
|
|
@@ -2,25 +2,25 @@
|
|
|
2
2
|
// Copyright 2022 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import '@
|
|
6
|
-
|
|
5
|
+
import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
7
6
|
import React from 'react';
|
|
8
7
|
|
|
9
|
-
import { AlertDialog } from './AlertDialog';
|
|
10
8
|
import { withTheme } from '../../testing';
|
|
11
|
-
import { Button } from '../
|
|
9
|
+
import { Button } from '../Button';
|
|
12
10
|
import { Toolbar } from '../Toolbar';
|
|
13
11
|
|
|
12
|
+
import { AlertDialog } from './AlertDialog';
|
|
13
|
+
|
|
14
14
|
type StoryProps = Partial<{
|
|
15
15
|
title: string;
|
|
16
16
|
description: string;
|
|
17
17
|
body: string;
|
|
18
|
+
openTrigger: string;
|
|
18
19
|
cancelTrigger: string;
|
|
19
20
|
actionTrigger: string;
|
|
20
|
-
openTrigger: string;
|
|
21
21
|
}>;
|
|
22
22
|
|
|
23
|
-
const DefaultStory = ({ title,
|
|
23
|
+
const DefaultStory = ({ title, description, body, openTrigger, cancelTrigger, actionTrigger }: StoryProps) => {
|
|
24
24
|
return (
|
|
25
25
|
<AlertDialog.Root defaultOpen>
|
|
26
26
|
<AlertDialog.Trigger asChild>
|
|
@@ -46,15 +46,18 @@ const DefaultStory = ({ title, openTrigger, description, body, cancelTrigger, ac
|
|
|
46
46
|
);
|
|
47
47
|
};
|
|
48
48
|
|
|
49
|
-
|
|
49
|
+
const meta = {
|
|
50
50
|
title: 'ui/react-ui-core/AlertDialog',
|
|
51
|
-
component: AlertDialog,
|
|
52
|
-
render: DefaultStory,
|
|
51
|
+
component: AlertDialog.Root as any,
|
|
52
|
+
render: DefaultStory as any,
|
|
53
53
|
decorators: [withTheme],
|
|
54
|
-
|
|
55
|
-
|
|
54
|
+
} satisfies Meta<typeof DefaultStory>;
|
|
55
|
+
|
|
56
|
+
export default meta;
|
|
57
|
+
|
|
58
|
+
type Story = StoryObj<typeof meta>;
|
|
56
59
|
|
|
57
|
-
export const Default = {
|
|
60
|
+
export const Default: Story = {
|
|
58
61
|
args: {
|
|
59
62
|
title: 'AlertDialog title',
|
|
60
63
|
openTrigger: 'Open AlertDialog',
|
|
@@ -3,27 +3,27 @@
|
|
|
3
3
|
//
|
|
4
4
|
|
|
5
5
|
import {
|
|
6
|
-
type AlertDialogProps as AlertDialogRootPrimitiveProps,
|
|
7
|
-
Root as AlertDialogRootPrimitive,
|
|
8
|
-
AlertDialogTrigger as AlertDialogTriggerPrimitive,
|
|
9
|
-
type AlertDialogTriggerProps as AlertDialogTriggerPrimitiveProps,
|
|
10
|
-
AlertDialogPortal as AlertDialogPortalPrimitive,
|
|
11
|
-
type AlertDialogPortalProps as AlertDialogPortalPrimitiveProps,
|
|
12
|
-
AlertDialogOverlay as AlertDialogOverlayPrimitive,
|
|
13
|
-
type AlertDialogOverlayProps as AlertDialogOverlayPrimitiveProps,
|
|
14
|
-
AlertDialogTitle as AlertDialogTitlePrimitive,
|
|
15
|
-
type AlertDialogTitleProps as AlertDialogTitlePrimitiveProps,
|
|
16
|
-
AlertDialogDescription as AlertDialogDescriptionPrimitive,
|
|
17
|
-
type AlertDialogDescriptionProps as AlertDialogDescriptionPrimitiveProps,
|
|
18
6
|
AlertDialogAction as AlertDialogActionPrimitive,
|
|
19
7
|
type AlertDialogActionProps as AlertDialogActionPrimitiveProps,
|
|
20
8
|
AlertDialogCancel as AlertDialogCancelPrimitive,
|
|
21
9
|
type AlertDialogCancelProps as AlertDialogCancelPrimitiveProps,
|
|
22
10
|
AlertDialogContent as AlertDialogContentPrimitive,
|
|
23
11
|
type AlertDialogContentProps as AlertDialogContentPrimitiveProps,
|
|
12
|
+
AlertDialogDescription as AlertDialogDescriptionPrimitive,
|
|
13
|
+
type AlertDialogDescriptionProps as AlertDialogDescriptionPrimitiveProps,
|
|
14
|
+
AlertDialogOverlay as AlertDialogOverlayPrimitive,
|
|
15
|
+
type AlertDialogOverlayProps as AlertDialogOverlayPrimitiveProps,
|
|
16
|
+
AlertDialogPortal as AlertDialogPortalPrimitive,
|
|
17
|
+
type AlertDialogPortalProps as AlertDialogPortalPrimitiveProps,
|
|
18
|
+
Root as AlertDialogRootPrimitive,
|
|
19
|
+
type AlertDialogProps as AlertDialogRootPrimitiveProps,
|
|
20
|
+
AlertDialogTitle as AlertDialogTitlePrimitive,
|
|
21
|
+
type AlertDialogTitleProps as AlertDialogTitlePrimitiveProps,
|
|
22
|
+
AlertDialogTrigger as AlertDialogTriggerPrimitive,
|
|
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, { type ForwardRefExoticComponent, type FunctionComponent, forwardRef } from 'react';
|
|
27
27
|
|
|
28
28
|
import { useThemeContext } from '../../hooks';
|
|
29
29
|
import { type ThemedClassName } from '../../util';
|
|
@@ -0,0 +1,97 @@
|
|
|
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
|
+
|
|
13
|
+
import { Dialog, type DialogContentProps } from './Dialog';
|
|
14
|
+
|
|
15
|
+
type StoryProps = Pick<DialogContentProps, 'size'> &
|
|
16
|
+
Partial<{
|
|
17
|
+
title: string;
|
|
18
|
+
description: string;
|
|
19
|
+
openTrigger: string;
|
|
20
|
+
closeTrigger: string;
|
|
21
|
+
blockAlign: 'center' | 'start';
|
|
22
|
+
}>;
|
|
23
|
+
|
|
24
|
+
const DefaultStory = ({ size, title, description, openTrigger, closeTrigger, blockAlign }: StoryProps) => {
|
|
25
|
+
return (
|
|
26
|
+
<Dialog.Root defaultOpen>
|
|
27
|
+
<Dialog.Trigger asChild>
|
|
28
|
+
<Button>{openTrigger}</Button>
|
|
29
|
+
</Dialog.Trigger>
|
|
30
|
+
<Dialog.Overlay blockAlign={blockAlign}>
|
|
31
|
+
<Dialog.Content size={size}>
|
|
32
|
+
<Dialog.Header>
|
|
33
|
+
<Dialog.Title>{title}</Dialog.Title>
|
|
34
|
+
{closeTrigger && (
|
|
35
|
+
<Dialog.Close asChild>
|
|
36
|
+
<Dialog.CloseIconButton />
|
|
37
|
+
</Dialog.Close>
|
|
38
|
+
)}
|
|
39
|
+
</Dialog.Header>
|
|
40
|
+
<Dialog.Description>{description}</Dialog.Description>
|
|
41
|
+
<Dialog.Close asChild>
|
|
42
|
+
<Button variant='primary'>{closeTrigger}</Button>
|
|
43
|
+
</Dialog.Close>
|
|
44
|
+
</Dialog.Content>
|
|
45
|
+
</Dialog.Overlay>
|
|
46
|
+
</Dialog.Root>
|
|
47
|
+
);
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
const meta = {
|
|
51
|
+
title: 'ui/react-ui-core/Dialog',
|
|
52
|
+
component: Dialog as any,
|
|
53
|
+
render: DefaultStory,
|
|
54
|
+
decorators: [withTheme],
|
|
55
|
+
parameters: {
|
|
56
|
+
chromatic: {
|
|
57
|
+
disableSnapshot: false,
|
|
58
|
+
},
|
|
59
|
+
},
|
|
60
|
+
} satisfies Meta<typeof DefaultStory>;
|
|
61
|
+
|
|
62
|
+
export default meta;
|
|
63
|
+
|
|
64
|
+
type Story = StoryObj<typeof meta>;
|
|
65
|
+
|
|
66
|
+
export const Small: Story = {
|
|
67
|
+
args: {
|
|
68
|
+
title: 'Dialog title',
|
|
69
|
+
description: faker.lorem.paragraph(2),
|
|
70
|
+
openTrigger: 'Open',
|
|
71
|
+
closeTrigger: 'Close',
|
|
72
|
+
blockAlign: 'center',
|
|
73
|
+
size: 'sm',
|
|
74
|
+
},
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
export const Medium: Story = {
|
|
78
|
+
args: {
|
|
79
|
+
title: 'Dialog title',
|
|
80
|
+
description: faker.lorem.paragraph(2),
|
|
81
|
+
openTrigger: 'Open',
|
|
82
|
+
closeTrigger: 'Close',
|
|
83
|
+
blockAlign: 'center',
|
|
84
|
+
size: 'md',
|
|
85
|
+
},
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
export const Large: Story = {
|
|
89
|
+
args: {
|
|
90
|
+
title: 'Dialog title',
|
|
91
|
+
description: faker.lorem.paragraph(2),
|
|
92
|
+
openTrigger: 'Open Dialog',
|
|
93
|
+
closeTrigger: 'Close',
|
|
94
|
+
blockAlign: 'center',
|
|
95
|
+
size: 'lg',
|
|
96
|
+
},
|
|
97
|
+
};
|
|
@@ -4,29 +4,42 @@
|
|
|
4
4
|
|
|
5
5
|
import { createContext } from '@radix-ui/react-context';
|
|
6
6
|
import {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
type DialogPortalProps as DialogPortalPrimitiveProps,
|
|
7
|
+
DialogClose as DialogClosePrimitive,
|
|
8
|
+
type DialogCloseProps as DialogClosePrimitiveProps,
|
|
9
|
+
DialogContent as DialogContentPrimitive,
|
|
10
|
+
DialogDescription as DialogDescriptionPrimitive,
|
|
11
|
+
type DialogDescriptionProps as DialogDescriptionPrimitiveProps,
|
|
13
12
|
DialogOverlay as DialogOverlayPrimitive,
|
|
14
13
|
type DialogOverlayProps as DialogOverlayPrimitiveProps,
|
|
14
|
+
DialogPortal as DialogPortalPrimitive,
|
|
15
|
+
type DialogPortalProps as DialogPortalPrimitiveProps,
|
|
16
|
+
Root as DialogRootPrimitive,
|
|
17
|
+
type DialogProps as DialogRootPrimitiveProps,
|
|
15
18
|
DialogTitle as DialogTitlePrimitive,
|
|
16
19
|
type DialogTitleProps as DialogTitlePrimitiveProps,
|
|
17
|
-
|
|
18
|
-
type
|
|
19
|
-
DialogClose as DialogClosePrimitive,
|
|
20
|
-
type DialogCloseProps as DialogClosePrimitiveProps,
|
|
21
|
-
DialogContent as DialogContentPrimitive,
|
|
22
|
-
type DialogContentProps as DialogContentPrimitiveProps,
|
|
20
|
+
DialogTrigger as DialogTriggerPrimitive,
|
|
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';
|
|
27
35
|
import { type ThemedClassName } from '../../util';
|
|
36
|
+
import { IconButton, type IconButtonProps } from '../Button';
|
|
28
37
|
import { ElevationProvider } from '../ElevationProvider';
|
|
29
38
|
|
|
39
|
+
//
|
|
40
|
+
// Root
|
|
41
|
+
//
|
|
42
|
+
|
|
30
43
|
type DialogRootProps = DialogRootPrimitiveProps;
|
|
31
44
|
|
|
32
45
|
const DialogRoot: FunctionComponent<DialogRootProps> = (props) => (
|
|
@@ -35,52 +48,30 @@ const DialogRoot: FunctionComponent<DialogRootProps> = (props) => (
|
|
|
35
48
|
</ElevationProvider>
|
|
36
49
|
);
|
|
37
50
|
|
|
51
|
+
//
|
|
52
|
+
// Trigger
|
|
53
|
+
//
|
|
54
|
+
|
|
38
55
|
type DialogTriggerProps = DialogTriggerPrimitiveProps;
|
|
39
56
|
|
|
40
57
|
const DialogTrigger: FunctionComponent<DialogTriggerProps> = DialogTriggerPrimitive;
|
|
41
58
|
|
|
59
|
+
//
|
|
60
|
+
// Portal
|
|
61
|
+
//
|
|
62
|
+
|
|
42
63
|
type DialogPortalProps = DialogPortalPrimitiveProps;
|
|
43
64
|
|
|
44
65
|
const DialogPortal: FunctionComponent<DialogPortalProps> = DialogPortalPrimitive;
|
|
45
66
|
|
|
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;
|
|
67
|
+
//
|
|
68
|
+
// Overlay
|
|
69
|
+
//
|
|
78
70
|
|
|
79
|
-
const
|
|
71
|
+
const DIALOG_OVERLAY_NAME = 'DialogOverlay';
|
|
80
72
|
|
|
81
73
|
type OverlayLayoutContextValue = { inOverlayLayout?: boolean };
|
|
82
|
-
|
|
83
|
-
const DIALOG_CONTENT_NAME = 'DialogContent';
|
|
74
|
+
|
|
84
75
|
const [OverlayLayoutProvider, useOverlayLayoutContext] = createContext<OverlayLayoutContextValue>(
|
|
85
76
|
DIALOG_OVERLAY_NAME,
|
|
86
77
|
{},
|
|
@@ -107,10 +98,19 @@ const DialogOverlay: ForwardRefExoticComponent<DialogOverlayProps> = forwardRef<
|
|
|
107
98
|
|
|
108
99
|
DialogOverlay.displayName = DIALOG_OVERLAY_NAME;
|
|
109
100
|
|
|
110
|
-
|
|
101
|
+
//
|
|
102
|
+
// Content
|
|
103
|
+
//
|
|
104
|
+
|
|
105
|
+
const DIALOG_CONTENT_NAME = 'DialogContent';
|
|
106
|
+
|
|
107
|
+
type DialogContentProps = ThemedClassName<ComponentPropsWithRef<typeof DialogContentPrimitive>> & {
|
|
108
|
+
size?: DialogSize;
|
|
109
|
+
inOverlayLayout?: boolean;
|
|
110
|
+
};
|
|
111
111
|
|
|
112
112
|
const DialogContent: ForwardRefExoticComponent<DialogContentProps> = forwardRef<HTMLDivElement, DialogContentProps>(
|
|
113
|
-
({ classNames, children, inOverlayLayout: propsInOverlayLayout, ...props }, forwardedRef) => {
|
|
113
|
+
({ classNames, children, size, inOverlayLayout: propsInOverlayLayout, ...props }, forwardedRef) => {
|
|
114
114
|
const { tx } = useThemeContext();
|
|
115
115
|
const { inOverlayLayout } = useOverlayLayoutContext(DIALOG_CONTENT_NAME);
|
|
116
116
|
|
|
@@ -123,7 +123,7 @@ const DialogContent: ForwardRefExoticComponent<DialogContentProps> = forwardRef<
|
|
|
123
123
|
className={tx(
|
|
124
124
|
'dialog.content',
|
|
125
125
|
'dialog',
|
|
126
|
-
{ inOverlayLayout: propsInOverlayLayout || inOverlayLayout },
|
|
126
|
+
{ inOverlayLayout: propsInOverlayLayout || inOverlayLayout, size },
|
|
127
127
|
classNames,
|
|
128
128
|
)}
|
|
129
129
|
ref={forwardedRef}
|
|
@@ -136,15 +136,113 @@ const DialogContent: ForwardRefExoticComponent<DialogContentProps> = forwardRef<
|
|
|
136
136
|
|
|
137
137
|
DialogContent.displayName = DIALOG_CONTENT_NAME;
|
|
138
138
|
|
|
139
|
+
//
|
|
140
|
+
// Header
|
|
141
|
+
//
|
|
142
|
+
|
|
143
|
+
type DialogHeaderProps = ThemedClassName<PropsWithChildren> & { srOnly?: boolean };
|
|
144
|
+
|
|
145
|
+
const DialogHeader: ForwardRefExoticComponent<DialogTitleProps> = forwardRef<HTMLHeadingElement, DialogTitleProps>(
|
|
146
|
+
({ classNames, srOnly, ...props }, forwardedRef) => {
|
|
147
|
+
const { tx } = useThemeContext();
|
|
148
|
+
return (
|
|
149
|
+
<div
|
|
150
|
+
{...props}
|
|
151
|
+
role='header'
|
|
152
|
+
className={tx('dialog.header', 'dialog__header', { srOnly }, classNames)}
|
|
153
|
+
ref={forwardedRef}
|
|
154
|
+
/>
|
|
155
|
+
);
|
|
156
|
+
},
|
|
157
|
+
);
|
|
158
|
+
|
|
159
|
+
//
|
|
160
|
+
// Title
|
|
161
|
+
//
|
|
162
|
+
|
|
163
|
+
type DialogTitleProps = ThemedClassName<DialogTitlePrimitiveProps> & { srOnly?: boolean };
|
|
164
|
+
|
|
165
|
+
const DialogTitle: ForwardRefExoticComponent<DialogTitleProps> = forwardRef<HTMLHeadingElement, DialogTitleProps>(
|
|
166
|
+
({ classNames, srOnly, ...props }, forwardedRef) => {
|
|
167
|
+
const { tx } = useThemeContext();
|
|
168
|
+
return (
|
|
169
|
+
<DialogTitlePrimitive
|
|
170
|
+
{...props}
|
|
171
|
+
className={tx('dialog.title', 'dialog__title', { srOnly }, classNames)}
|
|
172
|
+
ref={forwardedRef}
|
|
173
|
+
/>
|
|
174
|
+
);
|
|
175
|
+
},
|
|
176
|
+
);
|
|
177
|
+
|
|
178
|
+
//
|
|
179
|
+
// Description
|
|
180
|
+
//
|
|
181
|
+
|
|
182
|
+
type DialogDescriptionProps = ThemedClassName<DialogDescriptionPrimitiveProps> & { srOnly?: boolean };
|
|
183
|
+
|
|
184
|
+
const DialogDescription: ForwardRefExoticComponent<DialogTitleProps> = forwardRef<
|
|
185
|
+
HTMLParagraphElement,
|
|
186
|
+
DialogDescriptionProps
|
|
187
|
+
>(({ classNames, srOnly, ...props }, forwardedRef) => {
|
|
188
|
+
const { tx } = useThemeContext();
|
|
189
|
+
return (
|
|
190
|
+
<DialogDescriptionPrimitive
|
|
191
|
+
{...props}
|
|
192
|
+
className={tx('dialog.description', 'dialog__description', { srOnly }, classNames)}
|
|
193
|
+
ref={forwardedRef}
|
|
194
|
+
/>
|
|
195
|
+
);
|
|
196
|
+
});
|
|
197
|
+
|
|
198
|
+
//
|
|
199
|
+
// Close
|
|
200
|
+
//
|
|
201
|
+
|
|
202
|
+
type DialogCloseProps = DialogClosePrimitiveProps;
|
|
203
|
+
|
|
204
|
+
const DialogClose: FunctionComponent<DialogCloseProps> = DialogClosePrimitive;
|
|
205
|
+
|
|
206
|
+
//
|
|
207
|
+
// Close Button
|
|
208
|
+
//
|
|
209
|
+
|
|
210
|
+
type DialogCloseIconButtonProps = ThemedClassName<Partial<IconButtonProps>>;
|
|
211
|
+
|
|
212
|
+
const DialogCloseIconButton: ForwardRefExoticComponent<DialogCloseIconButtonProps> = forwardRef<
|
|
213
|
+
HTMLButtonElement,
|
|
214
|
+
DialogCloseIconButtonProps
|
|
215
|
+
>((props, forwardedRef) => {
|
|
216
|
+
const { t } = useTranslation(osTranslations);
|
|
217
|
+
return (
|
|
218
|
+
<IconButton
|
|
219
|
+
{...props}
|
|
220
|
+
label={props.label ?? t('close dialog label')}
|
|
221
|
+
icon='ph--x--regular'
|
|
222
|
+
iconOnly
|
|
223
|
+
size={4}
|
|
224
|
+
density='fine'
|
|
225
|
+
variant='ghost'
|
|
226
|
+
ref={forwardedRef}
|
|
227
|
+
/>
|
|
228
|
+
);
|
|
229
|
+
});
|
|
230
|
+
|
|
231
|
+
//
|
|
232
|
+
// Dialog
|
|
233
|
+
//
|
|
234
|
+
|
|
139
235
|
export const Dialog = {
|
|
140
236
|
Root: DialogRoot,
|
|
141
237
|
Trigger: DialogTrigger,
|
|
142
238
|
Portal: DialogPortal,
|
|
143
239
|
Overlay: DialogOverlay,
|
|
144
240
|
Content: DialogContent,
|
|
241
|
+
Header: DialogHeader,
|
|
145
242
|
Title: DialogTitle,
|
|
146
243
|
Description: DialogDescription,
|
|
147
244
|
Close: DialogClose,
|
|
245
|
+
CloseIconButton: DialogCloseIconButton,
|
|
148
246
|
};
|
|
149
247
|
|
|
150
248
|
export type {
|
|
@@ -153,7 +251,9 @@ export type {
|
|
|
153
251
|
DialogPortalProps,
|
|
154
252
|
DialogOverlayProps,
|
|
155
253
|
DialogContentProps,
|
|
254
|
+
DialogHeaderProps,
|
|
156
255
|
DialogTitleProps,
|
|
157
256
|
DialogDescriptionProps,
|
|
158
257
|
DialogCloseProps,
|
|
258
|
+
DialogCloseIconButtonProps,
|
|
159
259
|
};
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
// Copyright 2023 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import React, {
|
|
5
|
+
import React, { type PropsWithChildren, createContext } from 'react';
|
|
6
6
|
|
|
7
|
-
import { type Elevation } from '@dxos/
|
|
7
|
+
import { type Elevation } from '@dxos/ui-types';
|
|
8
8
|
|
|
9
9
|
export interface ElevationContextValue {
|
|
10
10
|
elevation?: Elevation;
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2023 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { IconBase, type IconProps, type IconWeight } from '@phosphor-icons/react';
|
|
6
|
+
import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
7
|
+
import React, { type FC, type ReactElement, type SVGProps, forwardRef } from 'react';
|
|
8
|
+
|
|
9
|
+
import { getSize, mx } from '@dxos/ui-theme';
|
|
10
|
+
|
|
11
|
+
import { withTheme } from '../../testing';
|
|
12
|
+
|
|
13
|
+
import { Icon } from './Icon';
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Create icon from serializable data.
|
|
17
|
+
* https://github.com/phosphor-icons/react#custom-icons
|
|
18
|
+
* https://github.com/phosphor-icons/core/tree/main/assets
|
|
19
|
+
*/
|
|
20
|
+
const createIcon = ({
|
|
21
|
+
name,
|
|
22
|
+
weights,
|
|
23
|
+
}: {
|
|
24
|
+
name: string;
|
|
25
|
+
weights: Record<string, SVGProps<SVGPathElement>[]>;
|
|
26
|
+
}): FC<IconProps> => {
|
|
27
|
+
const CustomIcon = forwardRef<SVGSVGElement, IconProps>((props, ref) => (
|
|
28
|
+
<IconBase
|
|
29
|
+
ref={ref}
|
|
30
|
+
{...props}
|
|
31
|
+
weights={
|
|
32
|
+
new Map<IconWeight, ReactElement>(
|
|
33
|
+
Object.entries(weights).map(
|
|
34
|
+
([key, paths]) =>
|
|
35
|
+
[
|
|
36
|
+
key,
|
|
37
|
+
<>
|
|
38
|
+
{paths.map((props, i) => (
|
|
39
|
+
<path key={`${key}-${i}`} {...props} />
|
|
40
|
+
))}
|
|
41
|
+
</>,
|
|
42
|
+
] as [IconWeight, ReactElement],
|
|
43
|
+
),
|
|
44
|
+
)
|
|
45
|
+
}
|
|
46
|
+
/>
|
|
47
|
+
));
|
|
48
|
+
|
|
49
|
+
CustomIcon.displayName = name;
|
|
50
|
+
return CustomIcon;
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
const DefaultStory = ({ CustomIcon }: { CustomIcon: FC<IconProps> }) => {
|
|
54
|
+
return (
|
|
55
|
+
<div className='grid grid-cols-2 gap-8'>
|
|
56
|
+
<CustomIcon weight={'regular'} className={mx(getSize(16))} />
|
|
57
|
+
<Icon icon='ph--github-logo--regular' classNames={mx(getSize(16))} />
|
|
58
|
+
</div>
|
|
59
|
+
);
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
const meta = {
|
|
63
|
+
title: 'ui/react-ui-core/Icon',
|
|
64
|
+
render: DefaultStory,
|
|
65
|
+
decorators: [withTheme],
|
|
66
|
+
parameters: {
|
|
67
|
+
layout: 'centered',
|
|
68
|
+
},
|
|
69
|
+
} satisfies Meta<typeof DefaultStory>;
|
|
70
|
+
|
|
71
|
+
export default meta;
|
|
72
|
+
|
|
73
|
+
type Story = StoryObj<typeof meta>;
|
|
74
|
+
|
|
75
|
+
export const Default: Story = {
|
|
76
|
+
args: {
|
|
77
|
+
CustomIcon: createIcon({
|
|
78
|
+
name: 'GithubLogo',
|
|
79
|
+
weights: {
|
|
80
|
+
// https://github.com/phosphor-icons/core/tree/main/assets
|
|
81
|
+
// <path d="M119.83,56A52,52,0,0,0,76,32a51.92,51.92,0,0,0-3.49,44.7A49.28,49.28,0,0,0,64,104v8a48,48,0,0,0,48,48h48a48,48,0,0,0,48-48v-8a49.28,49.28,0,0,0-8.51-27.3A51.92,51.92,0,0,0,196,32a52,52,0,0,0-43.83,24Z" fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="16"/>
|
|
82
|
+
// <path d="M104,232V192a32,32,0,0,1,32-32h0a32,32,0,0,1,32,32v40" fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="16"/>
|
|
83
|
+
// <path d="M104,208H72a32,32,0,0,1-32-32A32,32,0,0,0,8,144" fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="16"/>
|
|
84
|
+
regular: [
|
|
85
|
+
{
|
|
86
|
+
d: 'M119.83,56A52,52,0,0,0,76,32a51.92,51.92,0,0,0-3.49,44.7A49.28,49.28,0,0,0,64,104v8a48,48,0,0,0,48,48h48a48,48,0,0,0,48-48v-8a49.28,49.28,0,0,0-8.51-27.3A51.92,51.92,0,0,0,196,32a52,52,0,0,0-43.83,24Z',
|
|
87
|
+
fill: 'none',
|
|
88
|
+
stroke: 'currentColor',
|
|
89
|
+
strokeLinecap: 'round',
|
|
90
|
+
strokeLinejoin: 'round',
|
|
91
|
+
strokeWidth: '16',
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
d: 'M104,232V192a32,32,0,0,1,32-32h0a32,32,0,0,1,32,32v40',
|
|
95
|
+
fill: 'none',
|
|
96
|
+
stroke: 'currentColor',
|
|
97
|
+
strokeLinecap: 'round',
|
|
98
|
+
strokeLinejoin: 'round',
|
|
99
|
+
strokeWidth: '16',
|
|
100
|
+
},
|
|
101
|
+
{
|
|
102
|
+
d: 'M104,208H72a32,32,0,0,1-32-32A32,32,0,0,0,8,144',
|
|
103
|
+
fill: 'none',
|
|
104
|
+
stroke: 'currentColor',
|
|
105
|
+
strokeLinecap: 'round',
|
|
106
|
+
strokeLinejoin: 'round',
|
|
107
|
+
strokeWidth: '16',
|
|
108
|
+
},
|
|
109
|
+
],
|
|
110
|
+
},
|
|
111
|
+
}),
|
|
112
|
+
},
|
|
113
|
+
};
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
import { type Primitive } from '@radix-ui/react-primitive';
|
|
6
6
|
import React, { type ComponentPropsWithRef, forwardRef, memo } from 'react';
|
|
7
7
|
|
|
8
|
-
import { type Size } from '@dxos/
|
|
8
|
+
import { type Size } from '@dxos/ui-types';
|
|
9
9
|
|
|
10
10
|
import { useIconHref, useThemeContext } from '../../hooks';
|
|
11
11
|
import { type ThemedClassName } from '../../util';
|
|
@@ -16,7 +16,7 @@ export type IconProps = ThemedClassName<ComponentPropsWithRef<typeof Primitive.s
|
|
|
16
16
|
};
|
|
17
17
|
|
|
18
18
|
export const Icon = memo(
|
|
19
|
-
forwardRef<SVGSVGElement, IconProps>(({ icon, classNames, size, ...props }, forwardedRef) => {
|
|
19
|
+
forwardRef<SVGSVGElement, IconProps>(({ icon, classNames, size = 4, ...props }, forwardedRef) => {
|
|
20
20
|
const { tx } = useThemeContext();
|
|
21
21
|
const href = useIconHref(icon);
|
|
22
22
|
return (
|