@dxos/react-ui 0.8.4-main.406dc2a → 0.8.4-main.59c2e9b
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 +3067 -64
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/testing/index.mjs +34 -46
- 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 +3067 -64
- package/dist/lib/node-esm/index.mjs.map +4 -4
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/testing/index.mjs +34 -46
- package/dist/lib/node-esm/testing/index.mjs.map +4 -4
- package/dist/types/src/components/{Buttons → Button}/Button.d.ts +1 -1
- package/dist/types/src/components/Button/Button.d.ts.map +1 -0
- package/dist/types/src/components/Button/Button.stories.d.ts.map +1 -0
- package/dist/types/src/components/{Buttons → Button}/IconButton.d.ts +2 -2
- package/dist/types/src/components/Button/IconButton.d.ts.map +1 -0
- package/dist/types/src/components/Button/IconButton.stories.d.ts.map +1 -0
- package/dist/types/src/components/Button/Toggle.d.ts.map +1 -0
- package/dist/types/src/components/Button/Toggle.stories.d.ts +16 -0
- package/dist/types/src/components/Button/Toggle.stories.d.ts.map +1 -0
- package/dist/types/src/components/{Buttons → Button}/ToggleGroup.d.ts +4 -4
- package/dist/types/src/components/Button/ToggleGroup.d.ts.map +1 -0
- package/dist/types/src/components/{Buttons → Button}/ToggleGroup.stories.d.ts +4 -4
- package/dist/types/src/components/Button/ToggleGroup.stories.d.ts.map +1 -0
- package/dist/types/src/components/Button/index.d.ts.map +1 -0
- package/dist/types/src/components/Clipboard/CopyButton.d.ts +1 -1
- package/dist/types/src/components/Clipboard/CopyButton.d.ts.map +1 -1
- package/dist/types/src/components/DensityProvider/DensityProvider.d.ts +1 -1
- package/dist/types/src/components/DensityProvider/DensityProvider.d.ts.map +1 -1
- package/dist/types/src/components/Dialog/AlertDialog.d.ts.map +1 -0
- package/dist/types/src/components/Dialog/AlertDialog.stories.d.ts.map +1 -0
- package/dist/types/src/components/Dialog/Dialog.d.ts +40 -0
- package/dist/types/src/components/Dialog/Dialog.d.ts.map +1 -0
- package/dist/types/src/components/{Dialogs → Dialog}/Dialog.stories.d.ts +7 -5
- package/dist/types/src/components/Dialog/Dialog.stories.d.ts.map +1 -0
- package/dist/types/src/components/Dialog/index.d.ts.map +1 -0
- package/dist/types/src/components/ElevationProvider/ElevationProvider.d.ts +1 -1
- package/dist/types/src/components/ElevationProvider/ElevationProvider.d.ts.map +1 -1
- package/dist/types/src/components/Icon/Icon.d.ts +1 -1
- package/dist/types/src/components/Icon/Icon.d.ts.map +1 -1
- package/dist/types/src/components/Icon/Icon.stories.d.ts +17 -0
- package/dist/types/src/components/Icon/Icon.stories.d.ts.map +1 -0
- package/dist/types/src/components/Input/Input.d.ts +5 -2
- package/dist/types/src/components/Input/Input.d.ts.map +1 -1
- package/dist/types/src/components/Input/Input.stories.d.ts +1 -1
- 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 +8 -8
- package/dist/types/src/components/Main/Main.d.ts.map +1 -1
- package/dist/types/src/components/{Menus → Menu}/ContextMenu.d.ts +6 -6
- package/dist/types/src/components/Menu/ContextMenu.d.ts.map +1 -0
- package/dist/types/src/components/Menu/ContextMenu.stories.d.ts.map +1 -0
- package/dist/types/src/components/{Menus → Menu}/DropdownMenu.d.ts +3 -4
- package/dist/types/src/components/Menu/DropdownMenu.d.ts.map +1 -0
- package/dist/types/src/components/Menu/DropdownMenu.stories.d.ts.map +1 -0
- package/dist/types/src/components/Menu/index.d.ts.map +1 -0
- package/dist/types/src/components/Message/Message.d.ts +1 -1
- package/dist/types/src/components/Message/Message.d.ts.map +1 -1
- package/dist/types/src/components/Message/Message.stories.d.ts +1 -1
- package/dist/types/src/components/Message/Message.stories.d.ts.map +1 -1
- package/dist/types/src/components/Popover/Popover.d.ts +1 -1
- package/dist/types/src/components/Popover/Popover.d.ts.map +1 -1
- package/dist/types/src/components/ScrollArea/ScrollArea.d.ts +9 -7
- package/dist/types/src/components/ScrollArea/ScrollArea.d.ts.map +1 -1
- package/dist/types/src/components/ScrollArea/ScrollArea.stories.d.ts +4 -0
- package/dist/types/src/components/ScrollArea/ScrollArea.stories.d.ts.map +1 -1
- package/dist/types/src/components/ScrollContainer/ScrollContainer.d.ts +39 -0
- package/dist/types/src/components/ScrollContainer/ScrollContainer.d.ts.map +1 -0
- package/dist/types/src/components/ScrollContainer/ScrollContainer.stories.d.ts +19 -0
- package/dist/types/src/components/ScrollContainer/ScrollContainer.stories.d.ts.map +1 -0
- package/dist/types/src/components/ScrollContainer/index.d.ts +2 -0
- package/dist/types/src/components/ScrollContainer/index.d.ts.map +1 -0
- package/dist/types/src/components/Select/Select.d.ts +10 -10
- package/dist/types/src/components/Select/Select.d.ts.map +1 -1
- package/dist/types/src/components/Separator/Separator.d.ts +1 -1
- package/dist/types/src/components/Tag/Tag.d.ts +1 -1
- package/dist/types/src/components/Tag/Tag.d.ts.map +1 -1
- package/dist/types/src/components/ThemeProvider/ThemeProvider.d.ts +1 -2
- package/dist/types/src/components/ThemeProvider/ThemeProvider.d.ts.map +1 -1
- package/dist/types/src/components/ThemeProvider/TranslationsProvider.d.ts +1 -8
- package/dist/types/src/components/ThemeProvider/TranslationsProvider.d.ts.map +1 -1
- package/dist/types/src/components/ThemeProvider/index.d.ts +2 -1
- package/dist/types/src/components/ThemeProvider/index.d.ts.map +1 -1
- package/dist/types/src/components/Toast/Toast.d.ts +4 -4
- package/dist/types/src/components/Toolbar/Toolbar.d.ts +11 -9
- package/dist/types/src/components/Toolbar/Toolbar.d.ts.map +1 -1
- package/dist/types/src/components/Toolbar/Toolbar.stories.d.ts.map +1 -1
- package/dist/types/src/components/Tooltip/Tooltip.d.ts.map +1 -1
- package/dist/types/src/components/index.d.ts +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/index.d.ts +1 -1
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/playground/Custom.stories.d.ts.map +1 -1
- package/dist/types/src/testing/decorators/index.d.ts +1 -1
- package/dist/types/src/testing/decorators/index.d.ts.map +1 -1
- package/dist/types/src/testing/decorators/withLayout.d.ts +3 -3
- package/dist/types/src/testing/decorators/withLayout.d.ts.map +1 -1
- package/dist/types/src/testing/decorators/withLayoutVariants.d.ts +12 -0
- package/dist/types/src/testing/decorators/withLayoutVariants.d.ts.map +1 -0
- package/dist/types/src/testing/decorators/withTheme.d.ts.map +1 -1
- package/dist/types/src/util/index.d.ts +1 -2
- package/dist/types/src/util/index.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +32 -24
- package/src/components/Avatars/Avatar.stories.tsx +2 -2
- package/src/components/Avatars/Avatar.tsx +1 -1
- package/src/components/Breadcrumb/Breadcrumb.stories.tsx +1 -1
- package/src/components/{Buttons → Button}/Button.stories.tsx +2 -2
- package/src/components/{Buttons → Button}/Button.tsx +1 -1
- package/src/components/{Buttons → Button}/IconButton.tsx +19 -13
- package/src/components/{Buttons → Button}/Toggle.stories.tsx +5 -4
- package/src/components/Clipboard/CopyButton.tsx +4 -4
- package/src/components/DensityProvider/DensityProvider.tsx +1 -1
- package/src/components/{Dialogs → Dialog}/AlertDialog.stories.tsx +1 -1
- package/src/components/Dialog/Dialog.stories.tsx +97 -0
- package/src/components/{Dialogs → Dialog}/Dialog.tsx +140 -40
- package/src/components/ElevationProvider/ElevationProvider.tsx +1 -1
- package/src/components/Icon/Icon.stories.tsx +113 -0
- package/src/components/Icon/Icon.tsx +2 -2
- package/src/components/Input/Input.stories.tsx +2 -2
- package/src/components/Input/Input.tsx +13 -4
- package/src/components/{Lists → List}/List.stories.tsx +17 -13
- package/src/components/{Lists → List}/List.tsx +1 -1
- package/src/components/{Lists → List}/ListDropIndicator.tsx +1 -1
- package/src/components/Main/Main.stories.tsx +1 -1
- package/src/components/Main/Main.tsx +13 -13
- package/src/components/{Menus → Menu}/DropdownMenu.stories.tsx +1 -1
- package/src/components/{Menus → Menu}/DropdownMenu.tsx +79 -58
- package/src/components/Message/Message.stories.tsx +1 -1
- package/src/components/Message/Message.tsx +30 -5
- package/src/components/Popover/Popover.stories.tsx +1 -1
- package/src/components/Popover/Popover.tsx +52 -33
- package/src/components/ScrollArea/ScrollArea.stories.tsx +54 -4
- package/src/components/ScrollArea/ScrollArea.tsx +50 -4
- 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 +2 -2
- package/src/components/Select/Select.tsx +4 -4
- package/src/components/Tag/Tag.stories.tsx +2 -2
- package/src/components/Tag/Tag.tsx +1 -1
- package/src/components/ThemeProvider/ThemeProvider.tsx +1 -3
- package/src/components/ThemeProvider/TranslationsProvider.tsx +1 -16
- package/src/components/ThemeProvider/index.ts +3 -3
- package/src/components/Toast/Toast.stories.tsx +1 -1
- package/src/components/Toolbar/Toolbar.stories.tsx +2 -4
- package/src/components/Toolbar/Toolbar.tsx +24 -9
- package/src/components/Tooltip/Tooltip.stories.tsx +1 -1
- package/src/components/Tooltip/Tooltip.tsx +22 -20
- package/src/components/index.ts +5 -4
- package/src/hooks/useDensityContext.ts +1 -1
- package/src/hooks/useElevationContext.ts +1 -1
- package/src/index.ts +1 -1
- package/src/playground/Controls.stories.tsx +2 -2
- package/src/playground/Custom.stories.tsx +6 -8
- package/src/testing/decorators/index.ts +1 -1
- package/src/testing/decorators/withLayout.tsx +22 -15
- package/src/testing/decorators/{withSurfaceVariantsLayout.tsx → withLayoutVariants.tsx} +5 -5
- package/src/testing/decorators/withTheme.tsx +3 -2
- package/src/util/index.ts +2 -2
- package/dist/lib/browser/chunk-KX5JDELJ.mjs +0 -4521
- package/dist/lib/browser/chunk-KX5JDELJ.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-3HDQYL5S.mjs +0 -4523
- package/dist/lib/node-esm/chunk-3HDQYL5S.mjs.map +0 -7
- package/dist/types/src/components/Buttons/Button.d.ts.map +0 -1
- package/dist/types/src/components/Buttons/Button.stories.d.ts.map +0 -1
- package/dist/types/src/components/Buttons/IconButton.d.ts.map +0 -1
- package/dist/types/src/components/Buttons/IconButton.stories.d.ts.map +0 -1
- package/dist/types/src/components/Buttons/Toggle.d.ts.map +0 -1
- package/dist/types/src/components/Buttons/Toggle.stories.d.ts +0 -13
- package/dist/types/src/components/Buttons/Toggle.stories.d.ts.map +0 -1
- package/dist/types/src/components/Buttons/ToggleGroup.d.ts.map +0 -1
- package/dist/types/src/components/Buttons/ToggleGroup.stories.d.ts.map +0 -1
- package/dist/types/src/components/Buttons/index.d.ts.map +0 -1
- package/dist/types/src/components/Dialogs/AlertDialog.d.ts.map +0 -1
- package/dist/types/src/components/Dialogs/AlertDialog.stories.d.ts.map +0 -1
- package/dist/types/src/components/Dialogs/Dialog.d.ts +0 -31
- package/dist/types/src/components/Dialogs/Dialog.d.ts.map +0 -1
- package/dist/types/src/components/Dialogs/Dialog.stories.d.ts.map +0 -1
- package/dist/types/src/components/Dialogs/index.d.ts.map +0 -1
- package/dist/types/src/components/Lists/List.d.ts.map +0 -1
- package/dist/types/src/components/Lists/List.stories.d.ts.map +0 -1
- package/dist/types/src/components/Lists/ListDropIndicator.d.ts.map +0 -1
- package/dist/types/src/components/Lists/Tree.d.ts.map +0 -1
- package/dist/types/src/components/Lists/Tree.stories.d.ts.map +0 -1
- package/dist/types/src/components/Lists/TreeDropIndicator.d.ts.map +0 -1
- package/dist/types/src/components/Lists/Treegrid.d.ts.map +0 -1
- package/dist/types/src/components/Lists/Treegrid.stories.d.ts.map +0 -1
- package/dist/types/src/components/Lists/index.d.ts.map +0 -1
- package/dist/types/src/components/Menus/ContextMenu.d.ts.map +0 -1
- package/dist/types/src/components/Menus/ContextMenu.stories.d.ts.map +0 -1
- package/dist/types/src/components/Menus/DropdownMenu.d.ts.map +0 -1
- package/dist/types/src/components/Menus/DropdownMenu.stories.d.ts.map +0 -1
- package/dist/types/src/components/Menus/index.d.ts.map +0 -1
- package/dist/types/src/testing/decorators/withSurfaceVariantsLayout.d.ts +0 -12
- package/dist/types/src/testing/decorators/withSurfaceVariantsLayout.d.ts.map +0 -1
- package/dist/types/src/util/ThemedClassName.d.ts +0 -5
- package/dist/types/src/util/ThemedClassName.d.ts.map +0 -1
- package/dist/types/src/util/domino.d.ts +0 -18
- package/dist/types/src/util/domino.d.ts.map +0 -1
- package/src/components/Dialogs/Dialog.stories.tsx +0 -67
- package/src/util/ThemedClassName.ts +0 -7
- package/src/util/domino.ts +0 -53
- /package/dist/types/src/components/{Buttons → Button}/Button.stories.d.ts +0 -0
- /package/dist/types/src/components/{Buttons → Button}/IconButton.stories.d.ts +0 -0
- /package/dist/types/src/components/{Buttons → Button}/Toggle.d.ts +0 -0
- /package/dist/types/src/components/{Buttons → Button}/index.d.ts +0 -0
- /package/dist/types/src/components/{Dialogs → Dialog}/AlertDialog.d.ts +0 -0
- /package/dist/types/src/components/{Dialogs → Dialog}/AlertDialog.stories.d.ts +0 -0
- /package/dist/types/src/components/{Dialogs → Dialog}/index.d.ts +0 -0
- /package/dist/types/src/components/{Lists → List}/List.stories.d.ts +0 -0
- /package/dist/types/src/components/{Lists → List}/ListDropIndicator.d.ts +0 -0
- /package/dist/types/src/components/{Lists → List}/Tree.d.ts +0 -0
- /package/dist/types/src/components/{Lists → List}/Tree.stories.d.ts +0 -0
- /package/dist/types/src/components/{Lists → List}/TreeDropIndicator.d.ts +0 -0
- /package/dist/types/src/components/{Lists → List}/Treegrid.d.ts +0 -0
- /package/dist/types/src/components/{Lists → List}/Treegrid.stories.d.ts +0 -0
- /package/dist/types/src/components/{Lists → List}/index.d.ts +0 -0
- /package/dist/types/src/components/{Menus → Menu}/ContextMenu.stories.d.ts +0 -0
- /package/dist/types/src/components/{Menus → Menu}/DropdownMenu.stories.d.ts +0 -0
- /package/dist/types/src/components/{Menus → Menu}/index.d.ts +0 -0
- /package/src/components/{Buttons → Button}/IconButton.stories.tsx +0 -0
- /package/src/components/{Buttons → Button}/Toggle.tsx +0 -0
- /package/src/components/{Buttons → Button}/ToggleGroup.stories.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}/AlertDialog.tsx +0 -0
- /package/src/components/{Dialogs → Dialog}/index.ts +0 -0
- /package/src/components/{Lists → List}/Tree.stories.tsx +0 -0
- /package/src/components/{Lists → List}/Tree.tsx +0 -0
- /package/src/components/{Lists → List}/TreeDropIndicator.tsx +0 -0
- /package/src/components/{Lists → List}/Treegrid.stories.tsx +0 -0
- /package/src/components/{Lists → List}/Treegrid.tsx +0 -0
- /package/src/components/{Lists → List}/index.ts +0 -0
- /package/src/components/{Menus → Menu}/ContextMenu.stories.tsx +0 -0
- /package/src/components/{Menus → Menu}/ContextMenu.tsx +0 -0
- /package/src/components/{Menus → Menu}/index.ts +0 -0
package/package.json
CHANGED
|
@@ -1,12 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dxos/react-ui",
|
|
3
|
-
"version": "0.8.4-main.
|
|
3
|
+
"version": "0.8.4-main.59c2e9b",
|
|
4
4
|
"description": "Low-level React components for DXOS, applying a theme to a core group of primitives",
|
|
5
5
|
"homepage": "https://dxos.org",
|
|
6
6
|
"bugs": "https://github.com/dxos/dxos/issues",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "https://github.com/dxos/dxos"
|
|
10
|
+
},
|
|
7
11
|
"license": "MIT",
|
|
8
12
|
"author": "DXOS.org",
|
|
9
|
-
"sideEffects":
|
|
13
|
+
"sideEffects": false,
|
|
10
14
|
"type": "module",
|
|
11
15
|
"exports": {
|
|
12
16
|
".": {
|
|
@@ -35,9 +39,9 @@
|
|
|
35
39
|
"src"
|
|
36
40
|
],
|
|
37
41
|
"dependencies": {
|
|
38
|
-
"@atlaskit/pragmatic-drag-and-drop-hitbox": "
|
|
39
|
-
"@
|
|
40
|
-
"@
|
|
42
|
+
"@atlaskit/pragmatic-drag-and-drop-hitbox": "1.1.0",
|
|
43
|
+
"@effect-atom/atom-react": "^0.4.6",
|
|
44
|
+
"@fluentui/react-tabster": "9.26.11",
|
|
41
45
|
"@radix-ui/primitive": "1.1.1",
|
|
42
46
|
"@radix-ui/react-alert-dialog": "1.1.6",
|
|
43
47
|
"@radix-ui/react-avatar": "1.1.3",
|
|
@@ -56,7 +60,7 @@
|
|
|
56
60
|
"@radix-ui/react-portal": "1.1.4",
|
|
57
61
|
"@radix-ui/react-presence": "1.1.2",
|
|
58
62
|
"@radix-ui/react-primitive": "2.0.2",
|
|
59
|
-
"@radix-ui/react-scroll-area": "1.2.
|
|
63
|
+
"@radix-ui/react-scroll-area": "1.2.10",
|
|
60
64
|
"@radix-ui/react-select": "2.1.6",
|
|
61
65
|
"@radix-ui/react-separator": "1.1.2",
|
|
62
66
|
"@radix-ui/react-slot": "1.1.2",
|
|
@@ -74,32 +78,36 @@
|
|
|
74
78
|
"keyborg": "^2.5.0",
|
|
75
79
|
"react-i18next": "^11.18.6",
|
|
76
80
|
"react-remove-scroll": "^2.6.0",
|
|
77
|
-
"@dxos/
|
|
78
|
-
"@dxos/
|
|
79
|
-
"@dxos/
|
|
80
|
-
"@dxos/
|
|
81
|
-
"@dxos/
|
|
82
|
-
"@dxos/
|
|
83
|
-
"@dxos/react-
|
|
84
|
-
"@dxos/
|
|
81
|
+
"@dxos/async": "0.8.4-main.59c2e9b",
|
|
82
|
+
"@dxos/debug": "0.8.4-main.59c2e9b",
|
|
83
|
+
"@dxos/invariant": "0.8.4-main.59c2e9b",
|
|
84
|
+
"@dxos/lit-ui": "0.8.4-main.59c2e9b",
|
|
85
|
+
"@dxos/react-hooks": "0.8.4-main.59c2e9b",
|
|
86
|
+
"@dxos/log": "0.8.4-main.59c2e9b",
|
|
87
|
+
"@dxos/react-input": "0.8.4-main.59c2e9b",
|
|
88
|
+
"@dxos/react-list": "0.8.4-main.59c2e9b",
|
|
89
|
+
"@dxos/ui-types": "0.8.4-main.59c2e9b",
|
|
90
|
+
"@dxos/util": "0.8.4-main.59c2e9b"
|
|
85
91
|
},
|
|
86
92
|
"devDependencies": {
|
|
87
93
|
"@dnd-kit/core": "^6.0.5",
|
|
88
94
|
"@dnd-kit/sortable": "^7.0.1",
|
|
89
95
|
"@dnd-kit/utilities": "^3.2.0",
|
|
90
|
-
"@
|
|
91
|
-
"@types/react
|
|
92
|
-
"react": "~19.2.
|
|
93
|
-
"react
|
|
96
|
+
"@phosphor-icons/react": "2.1.10",
|
|
97
|
+
"@types/react": "~19.2.7",
|
|
98
|
+
"@types/react-dom": "~19.2.3",
|
|
99
|
+
"react": "~19.2.3",
|
|
100
|
+
"react-dom": "~19.2.3",
|
|
101
|
+
"tabster": "^8.5.5",
|
|
94
102
|
"vite": "7.1.9",
|
|
95
|
-
"@dxos/
|
|
96
|
-
"@dxos/
|
|
97
|
-
"@dxos/
|
|
103
|
+
"@dxos/random": "0.8.4-main.59c2e9b",
|
|
104
|
+
"@dxos/ui-theme": "0.8.4-main.59c2e9b",
|
|
105
|
+
"@dxos/util": "0.8.4-main.59c2e9b"
|
|
98
106
|
},
|
|
99
107
|
"peerDependencies": {
|
|
100
|
-
"react": "
|
|
101
|
-
"react-dom": "
|
|
102
|
-
"@dxos/
|
|
108
|
+
"react": "~19.2.3",
|
|
109
|
+
"react-dom": "~19.2.3",
|
|
110
|
+
"@dxos/ui-theme": "0.8.4-main.59c2e9b"
|
|
103
111
|
},
|
|
104
112
|
"publishConfig": {
|
|
105
113
|
"access": "public"
|
|
@@ -5,8 +5,8 @@
|
|
|
5
5
|
import { type Meta } from '@storybook/react-vite';
|
|
6
6
|
import React, { type PropsWithChildren } from 'react';
|
|
7
7
|
|
|
8
|
-
import { type HuePalette } from '@dxos/
|
|
9
|
-
import { type Size } from '@dxos/
|
|
8
|
+
import { type HuePalette } from '@dxos/ui-theme';
|
|
9
|
+
import { type Size } from '@dxos/ui-types';
|
|
10
10
|
import { hexToFallback } from '@dxos/util';
|
|
11
11
|
|
|
12
12
|
import { withTheme } from '../../testing';
|
|
@@ -17,7 +17,7 @@ import {
|
|
|
17
17
|
} from '@dxos/lit-ui';
|
|
18
18
|
import { DxAvatar } from '@dxos/lit-ui/react';
|
|
19
19
|
import { useId } from '@dxos/react-hooks';
|
|
20
|
-
import { mx } from '@dxos/
|
|
20
|
+
import { mx } from '@dxos/ui-theme';
|
|
21
21
|
|
|
22
22
|
import { useIconHref, useThemeContext } from '../../hooks';
|
|
23
23
|
import { type ThemedClassName } from '../../util';
|
|
@@ -6,7 +6,7 @@ import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
|
6
6
|
import React from 'react';
|
|
7
7
|
|
|
8
8
|
import { withTheme } from '../../testing';
|
|
9
|
-
import { Button } from '../
|
|
9
|
+
import { Button } from '../Button';
|
|
10
10
|
|
|
11
11
|
import { Breadcrumb, type BreadcrumbRootProps } from './Breadcrumb';
|
|
12
12
|
|
|
@@ -6,7 +6,7 @@ import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
|
6
6
|
import React from 'react';
|
|
7
7
|
|
|
8
8
|
import { withTheme } from '../../testing';
|
|
9
|
-
import {
|
|
9
|
+
import { withLayoutVariants } from '../../testing';
|
|
10
10
|
import { Icon } from '../Icon';
|
|
11
11
|
|
|
12
12
|
import { Button, ButtonGroup, type ButtonProps } from './Button';
|
|
@@ -36,7 +36,7 @@ const meta = {
|
|
|
36
36
|
title: 'ui/react-ui-core/Button',
|
|
37
37
|
component: Button,
|
|
38
38
|
render: DefaultStory,
|
|
39
|
-
decorators: [withTheme,
|
|
39
|
+
decorators: [withTheme, withLayoutVariants()],
|
|
40
40
|
} satisfies Meta<typeof Button>;
|
|
41
41
|
|
|
42
42
|
export default meta;
|
|
@@ -7,7 +7,7 @@ import { Primitive } from '@radix-ui/react-primitive';
|
|
|
7
7
|
import { Slot } from '@radix-ui/react-slot';
|
|
8
8
|
import React, { type ComponentPropsWithRef, forwardRef, memo } from 'react';
|
|
9
9
|
|
|
10
|
-
import { type Density, type Elevation } from '@dxos/
|
|
10
|
+
import { type Density, type Elevation } from '@dxos/ui-types';
|
|
11
11
|
|
|
12
12
|
import { useDensityContext, useElevationContext, useThemeContext } from '../../hooks';
|
|
13
13
|
import { type ThemedClassName } from '../../util';
|
|
@@ -14,19 +14,28 @@ import { Button, type ButtonProps } from './Button';
|
|
|
14
14
|
type IconButtonProps = Omit<ButtonProps, 'children'> &
|
|
15
15
|
Partial<Pick<IconProps, 'icon' | 'size'>> & {
|
|
16
16
|
label: string;
|
|
17
|
-
iconOnly?: boolean;
|
|
18
17
|
noTooltip?: boolean;
|
|
19
18
|
caretDown?: boolean;
|
|
19
|
+
iconOnly?: boolean;
|
|
20
|
+
iconEnd?: boolean;
|
|
20
21
|
iconClassNames?: ThemedClassName<any>['classNames'];
|
|
21
|
-
tooltipPortal?: boolean;
|
|
22
22
|
tooltipSide?: TooltipSide;
|
|
23
23
|
};
|
|
24
24
|
|
|
25
|
+
const IconButton = forwardRef<HTMLButtonElement, IconButtonProps>((props, forwardedRef) =>
|
|
26
|
+
props.iconOnly ? (
|
|
27
|
+
<IconOnlyButton {...props} ref={forwardedRef} />
|
|
28
|
+
) : (
|
|
29
|
+
<LabelledIconButton {...props} ref={forwardedRef} />
|
|
30
|
+
),
|
|
31
|
+
);
|
|
32
|
+
|
|
25
33
|
const IconOnlyButton = forwardRef<HTMLButtonElement, IconButtonProps>(
|
|
26
|
-
({ noTooltip,
|
|
34
|
+
({ noTooltip, tooltipSide, ...props }, forwardedRef) => {
|
|
27
35
|
if (noTooltip) {
|
|
28
36
|
return <LabelledIconButton {...props} ref={forwardedRef} />;
|
|
29
37
|
}
|
|
38
|
+
|
|
30
39
|
return (
|
|
31
40
|
<Tooltip.Trigger asChild content={props.label} side={tooltipSide}>
|
|
32
41
|
<LabelledIconButton {...props} ref={forwardedRef} />
|
|
@@ -35,27 +44,24 @@ const IconOnlyButton = forwardRef<HTMLButtonElement, IconButtonProps>(
|
|
|
35
44
|
},
|
|
36
45
|
);
|
|
37
46
|
|
|
47
|
+
// TODO(burdon): Inherit size from container/density.
|
|
38
48
|
const LabelledIconButton = forwardRef<HTMLButtonElement, IconButtonProps>(
|
|
39
|
-
(
|
|
49
|
+
(
|
|
50
|
+
{ size = 5, icon, iconOnly, iconEnd, iconClassNames, label, caretDown, noTooltip: _, classNames, ...props },
|
|
51
|
+
forwardedRef,
|
|
52
|
+
) => {
|
|
40
53
|
const { tx } = useThemeContext();
|
|
41
54
|
return (
|
|
42
55
|
<Button {...props} classNames={tx('iconButton.root', 'iconButton', { iconOnly }, classNames)} ref={forwardedRef}>
|
|
43
|
-
{icon && <Icon icon={icon} size={size} classNames={iconClassNames} />}
|
|
56
|
+
{icon && !iconEnd && <Icon icon={icon} size={size} classNames={iconClassNames} />}
|
|
44
57
|
<span className={iconOnly ? 'sr-only' : undefined}>{label}</span>
|
|
58
|
+
{icon && iconEnd && <Icon icon={icon} size={size} classNames={iconClassNames} />}
|
|
45
59
|
{caretDown && <Icon size={3} icon='ph--caret-down--bold' />}
|
|
46
60
|
</Button>
|
|
47
61
|
);
|
|
48
62
|
},
|
|
49
63
|
);
|
|
50
64
|
|
|
51
|
-
const IconButton = forwardRef<HTMLButtonElement, IconButtonProps>((props, forwardedRef) =>
|
|
52
|
-
props.iconOnly ? (
|
|
53
|
-
<IconOnlyButton {...props} ref={forwardedRef} />
|
|
54
|
-
) : (
|
|
55
|
-
<LabelledIconButton {...props} ref={forwardedRef} />
|
|
56
|
-
),
|
|
57
|
-
);
|
|
58
|
-
|
|
59
65
|
export { IconButton };
|
|
60
66
|
|
|
61
67
|
export type { IconButtonProps };
|
|
@@ -8,11 +8,9 @@ import React from 'react';
|
|
|
8
8
|
import { withTheme } from '../../testing';
|
|
9
9
|
import { Icon } from '../Icon';
|
|
10
10
|
|
|
11
|
-
import { Toggle } from './Toggle';
|
|
11
|
+
import { Toggle, type ToggleProps } from './Toggle';
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
const DefaultStory = (props: StorybookToggleProps) => {
|
|
13
|
+
const DefaultStory = (props: ToggleProps) => {
|
|
16
14
|
return (
|
|
17
15
|
<Toggle {...props}>
|
|
18
16
|
<Icon icon='ph--text-b--regular' />
|
|
@@ -25,6 +23,9 @@ const meta = {
|
|
|
25
23
|
component: Toggle,
|
|
26
24
|
render: DefaultStory,
|
|
27
25
|
decorators: [withTheme],
|
|
26
|
+
parameters: {
|
|
27
|
+
layout: 'centered',
|
|
28
|
+
},
|
|
28
29
|
} satisfies Meta<typeof Toggle>;
|
|
29
30
|
|
|
30
31
|
export default meta;
|
|
@@ -4,9 +4,9 @@
|
|
|
4
4
|
|
|
5
5
|
import React from 'react';
|
|
6
6
|
|
|
7
|
-
import { mx } from '@dxos/
|
|
7
|
+
import { mx, osTranslations } from '@dxos/ui-theme';
|
|
8
8
|
|
|
9
|
-
import { Button, type ButtonProps, IconButton } from '../
|
|
9
|
+
import { Button, type ButtonProps, IconButton } from '../Button';
|
|
10
10
|
import { Icon, type IconProps } from '../Icon';
|
|
11
11
|
import { useTranslation } from '../ThemeProvider';
|
|
12
12
|
import { type TooltipScopedProps, useTooltipContext } from '../Tooltip';
|
|
@@ -21,7 +21,7 @@ export type CopyButtonProps = ButtonProps &
|
|
|
21
21
|
const inactiveLabelStyles = 'invisible bs-px -mbe-px overflow-hidden';
|
|
22
22
|
|
|
23
23
|
export const CopyButton = ({ classNames, value, size = 5, ...props }: CopyButtonProps) => {
|
|
24
|
-
const { t } = useTranslation(
|
|
24
|
+
const { t } = useTranslation(osTranslations);
|
|
25
25
|
const { textValue, setTextValue } = useClipboard();
|
|
26
26
|
const isCopied = textValue === value;
|
|
27
27
|
return (
|
|
@@ -55,7 +55,7 @@ export const CopyButtonIconOnly = ({
|
|
|
55
55
|
variant,
|
|
56
56
|
...props
|
|
57
57
|
}: TooltipScopedProps<CopyButtonIconOnlyProps>) => {
|
|
58
|
-
const { t } = useTranslation(
|
|
58
|
+
const { t } = useTranslation(osTranslations);
|
|
59
59
|
const { textValue, setTextValue } = useClipboard();
|
|
60
60
|
const isCopied = textValue === value;
|
|
61
61
|
const label = isCopied ? t('copy success label') : (props.label ?? t('copy label'));
|
|
@@ -6,7 +6,7 @@ import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
|
6
6
|
import React from 'react';
|
|
7
7
|
|
|
8
8
|
import { withTheme } from '../../testing';
|
|
9
|
-
import { Button } from '../
|
|
9
|
+
import { Button } from '../Button';
|
|
10
10
|
import { Toolbar } from '../Toolbar';
|
|
11
11
|
|
|
12
12
|
import { AlertDialog } from './AlertDialog';
|
|
@@ -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
|
+
};
|
|
@@ -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,26 @@ 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';
|
|
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
|
};
|