@dxos/react-ui 0.8.4-main.66e292d → 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 +3065 -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 +31 -43
- package/dist/lib/browser/testing/index.mjs.map +3 -3
- 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 +3065 -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 +31 -43
- package/dist/lib/node-esm/testing/index.mjs.map +3 -3
- package/dist/types/src/components/Button/Button.d.ts +1 -1
- package/dist/types/src/components/Button/Button.d.ts.map +1 -1
- package/dist/types/src/components/Button/IconButton.d.ts +2 -1
- package/dist/types/src/components/Button/IconButton.d.ts.map +1 -1
- package/dist/types/src/components/Button/ToggleGroup.d.ts +4 -4
- package/dist/types/src/components/Button/ToggleGroup.stories.d.ts +4 -4
- 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/Dialog.d.ts +18 -9
- package/dist/types/src/components/Dialog/Dialog.d.ts.map +1 -1
- package/dist/types/src/components/Dialog/Dialog.stories.d.ts +7 -5
- package/dist/types/src/components/Dialog/Dialog.stories.d.ts.map +1 -1
- 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/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/List/List.d.ts +1 -1
- package/dist/types/src/components/List/List.d.ts.map +1 -1
- package/dist/types/src/components/List/List.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 +1 -1
- 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 +4 -2
- package/dist/types/src/components/ScrollContainer/ScrollContainer.d.ts.map +1 -1
- package/dist/types/src/components/ScrollContainer/ScrollContainer.stories.d.ts +2 -1
- package/dist/types/src/components/ScrollContainer/ScrollContainer.stories.d.ts.map +1 -1
- package/dist/types/src/components/Select/Select.d.ts +9 -9
- 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 +10 -10
- package/dist/types/src/components/Toolbar/Toolbar.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 +1 -1
- 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/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 +1 -1
- package/dist/types/src/testing/decorators/withLayoutVariants.d.ts.map +1 -1
- 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 +31 -26
- package/src/components/Avatars/Avatar.stories.tsx +2 -2
- package/src/components/Avatars/Avatar.tsx +1 -1
- package/src/components/Button/Button.tsx +1 -1
- package/src/components/Button/IconButton.tsx +8 -3
- package/src/components/Clipboard/CopyButton.tsx +3 -3
- package/src/components/DensityProvider/DensityProvider.tsx +1 -1
- package/src/components/Dialog/Dialog.stories.tsx +47 -17
- package/src/components/Dialog/Dialog.tsx +140 -40
- package/src/components/ElevationProvider/ElevationProvider.tsx +1 -1
- package/src/components/Icon/Icon.stories.tsx +1 -1
- package/src/components/Icon/Icon.tsx +1 -1
- package/src/components/Input/Input.stories.tsx +2 -2
- package/src/components/Input/Input.tsx +13 -4
- package/src/components/List/List.stories.tsx +16 -12
- package/src/components/List/List.tsx +1 -1
- package/src/components/{Menus → Menu}/DropdownMenu.tsx +57 -55
- package/src/components/Message/Message.stories.tsx +1 -1
- package/src/components/Message/Message.tsx +30 -5
- package/src/components/Popover/Popover.tsx +35 -33
- package/src/components/ScrollArea/ScrollArea.stories.tsx +53 -3
- package/src/components/ScrollArea/ScrollArea.tsx +50 -4
- package/src/components/ScrollContainer/ScrollContainer.stories.tsx +2 -1
- package/src/components/ScrollContainer/ScrollContainer.tsx +90 -88
- 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/Toolbar/Toolbar.tsx +23 -8
- package/src/components/Tooltip/Tooltip.tsx +22 -20
- package/src/components/index.ts +1 -1
- package/src/hooks/useDensityContext.ts +1 -1
- package/src/hooks/useElevationContext.ts +1 -1
- package/src/index.ts +1 -1
- package/src/testing/decorators/withLayout.tsx +22 -15
- package/src/testing/decorators/withLayoutVariants.tsx +3 -3
- package/src/testing/decorators/withTheme.tsx +3 -2
- package/src/util/index.ts +2 -2
- package/dist/lib/browser/chunk-N5GDJTT2.mjs +0 -4707
- package/dist/lib/browser/chunk-N5GDJTT2.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-SP7VQH72.mjs +0 -4709
- package/dist/lib/node-esm/chunk-SP7VQH72.mjs.map +0 -7
- 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/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/util/ThemedClassName.ts +0 -7
- package/src/util/domino.ts +0 -53
- /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/{Menus → Menu}/ContextMenu.stories.tsx +0 -0
- /package/src/components/{Menus → Menu}/ContextMenu.tsx +0 -0
- /package/src/components/{Menus → Menu}/DropdownMenu.stories.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.69d29f4",
|
|
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",
|
|
@@ -74,35 +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/lit-ui": "0.8.4-main.
|
|
81
|
-
"@dxos/
|
|
82
|
-
"@dxos/react-
|
|
83
|
-
"@dxos/
|
|
84
|
-
"@dxos/
|
|
85
|
-
"@dxos/react-
|
|
86
|
-
"@dxos/util": "0.8.4-main.
|
|
81
|
+
"@dxos/invariant": "0.8.4-main.69d29f4",
|
|
82
|
+
"@dxos/debug": "0.8.4-main.69d29f4",
|
|
83
|
+
"@dxos/async": "0.8.4-main.69d29f4",
|
|
84
|
+
"@dxos/lit-ui": "0.8.4-main.69d29f4",
|
|
85
|
+
"@dxos/log": "0.8.4-main.69d29f4",
|
|
86
|
+
"@dxos/react-hooks": "0.8.4-main.69d29f4",
|
|
87
|
+
"@dxos/react-input": "0.8.4-main.69d29f4",
|
|
88
|
+
"@dxos/ui-types": "0.8.4-main.69d29f4",
|
|
89
|
+
"@dxos/react-list": "0.8.4-main.69d29f4",
|
|
90
|
+
"@dxos/util": "0.8.4-main.69d29f4"
|
|
87
91
|
},
|
|
88
92
|
"devDependencies": {
|
|
89
93
|
"@dnd-kit/core": "^6.0.5",
|
|
90
94
|
"@dnd-kit/sortable": "^7.0.1",
|
|
91
95
|
"@dnd-kit/utilities": "^3.2.0",
|
|
92
|
-
"@phosphor-icons/react": "
|
|
93
|
-
"@types/react": "~19.2.
|
|
94
|
-
"@types/react-dom": "~19.2.
|
|
95
|
-
"react": "~19.2.
|
|
96
|
-
"react-dom": "~19.2.
|
|
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",
|
|
97
102
|
"vite": "7.1.9",
|
|
98
|
-
"@dxos/random": "0.8.4-main.
|
|
99
|
-
"@dxos/
|
|
100
|
-
"@dxos/util": "0.8.4-main.
|
|
103
|
+
"@dxos/random": "0.8.4-main.69d29f4",
|
|
104
|
+
"@dxos/ui-theme": "0.8.4-main.69d29f4",
|
|
105
|
+
"@dxos/util": "0.8.4-main.69d29f4"
|
|
101
106
|
},
|
|
102
107
|
"peerDependencies": {
|
|
103
|
-
"react": "
|
|
104
|
-
"react-dom": "
|
|
105
|
-
"@dxos/
|
|
108
|
+
"react": "~19.2.3",
|
|
109
|
+
"react-dom": "~19.2.3",
|
|
110
|
+
"@dxos/ui-theme": "0.8.4-main.69d29f4"
|
|
106
111
|
},
|
|
107
112
|
"publishConfig": {
|
|
108
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';
|
|
@@ -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,9 +14,10 @@ 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
22
|
tooltipSide?: TooltipSide;
|
|
22
23
|
};
|
|
@@ -45,12 +46,16 @@ const IconOnlyButton = forwardRef<HTMLButtonElement, IconButtonProps>(
|
|
|
45
46
|
|
|
46
47
|
// TODO(burdon): Inherit size from container/density.
|
|
47
48
|
const LabelledIconButton = forwardRef<HTMLButtonElement, IconButtonProps>(
|
|
48
|
-
(
|
|
49
|
+
(
|
|
50
|
+
{ size = 5, icon, iconOnly, iconEnd, iconClassNames, label, caretDown, noTooltip: _, classNames, ...props },
|
|
51
|
+
forwardedRef,
|
|
52
|
+
) => {
|
|
49
53
|
const { tx } = useThemeContext();
|
|
50
54
|
return (
|
|
51
55
|
<Button {...props} classNames={tx('iconButton.root', 'iconButton', { iconOnly }, classNames)} ref={forwardedRef}>
|
|
52
|
-
{icon && <Icon icon={icon} size={size} classNames={iconClassNames} />}
|
|
56
|
+
{icon && !iconEnd && <Icon icon={icon} size={size} classNames={iconClassNames} />}
|
|
53
57
|
<span className={iconOnly ? 'sr-only' : undefined}>{label}</span>
|
|
58
|
+
{icon && iconEnd && <Icon icon={icon} size={size} classNames={iconClassNames} />}
|
|
54
59
|
{caretDown && <Icon size={3} icon='ph--caret-down--bold' />}
|
|
55
60
|
</Button>
|
|
56
61
|
);
|
|
@@ -4,7 +4,7 @@
|
|
|
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
9
|
import { Button, type ButtonProps, IconButton } from '../Button';
|
|
10
10
|
import { Icon, type IconProps } from '../Icon';
|
|
@@ -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'));
|
|
@@ -5,31 +5,39 @@
|
|
|
5
5
|
import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
6
6
|
import React from 'react';
|
|
7
7
|
|
|
8
|
+
import { faker } from '@dxos/random';
|
|
9
|
+
|
|
8
10
|
import { withTheme } from '../../testing';
|
|
9
11
|
import { Button } from '../Button';
|
|
10
12
|
|
|
11
|
-
import { Dialog } from './Dialog';
|
|
13
|
+
import { Dialog, type DialogContentProps } from './Dialog';
|
|
12
14
|
|
|
13
|
-
type StoryProps =
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
}>;
|
|
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
|
+
}>;
|
|
21
23
|
|
|
22
|
-
const DefaultStory = ({
|
|
24
|
+
const DefaultStory = ({ size, title, description, openTrigger, closeTrigger, blockAlign }: StoryProps) => {
|
|
23
25
|
return (
|
|
24
26
|
<Dialog.Root defaultOpen>
|
|
25
27
|
<Dialog.Trigger asChild>
|
|
26
28
|
<Button>{openTrigger}</Button>
|
|
27
29
|
</Dialog.Trigger>
|
|
28
30
|
<Dialog.Overlay blockAlign={blockAlign}>
|
|
29
|
-
<Dialog.Content>
|
|
30
|
-
<Dialog.
|
|
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>
|
|
31
40
|
<Dialog.Description>{description}</Dialog.Description>
|
|
32
|
-
<p className='mbs-2 mbe-4'>{body}</p>
|
|
33
41
|
<Dialog.Close asChild>
|
|
34
42
|
<Button variant='primary'>{closeTrigger}</Button>
|
|
35
43
|
</Dialog.Close>
|
|
@@ -55,13 +63,35 @@ export default meta;
|
|
|
55
63
|
|
|
56
64
|
type Story = StoryObj<typeof meta>;
|
|
57
65
|
|
|
58
|
-
export const
|
|
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 = {
|
|
59
89
|
args: {
|
|
60
90
|
title: 'Dialog title',
|
|
91
|
+
description: faker.lorem.paragraph(2),
|
|
61
92
|
openTrigger: 'Open Dialog',
|
|
62
|
-
|
|
63
|
-
body: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.',
|
|
64
|
-
closeTrigger: 'Close trigger',
|
|
93
|
+
closeTrigger: 'Close',
|
|
65
94
|
blockAlign: 'center',
|
|
95
|
+
size: 'lg',
|
|
66
96
|
},
|
|
67
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
|
};
|
|
@@ -6,7 +6,7 @@ import { IconBase, type IconProps, type IconWeight } from '@phosphor-icons/react
|
|
|
6
6
|
import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
7
7
|
import React, { type FC, type ReactElement, type SVGProps, forwardRef } from 'react';
|
|
8
8
|
|
|
9
|
-
import { getSize, mx } from '@dxos/
|
|
9
|
+
import { getSize, mx } from '@dxos/ui-theme';
|
|
10
10
|
|
|
11
11
|
import { withTheme } from '../../testing';
|
|
12
12
|
|
|
@@ -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';
|
|
@@ -5,8 +5,8 @@
|
|
|
5
5
|
import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
6
6
|
import React from 'react';
|
|
7
7
|
|
|
8
|
-
import { baseSurface, modalSurface, mx, surfaceShadow } from '@dxos/
|
|
9
|
-
import { type MessageValence } from '@dxos/
|
|
8
|
+
import { baseSurface, modalSurface, mx, surfaceShadow } from '@dxos/ui-theme';
|
|
9
|
+
import { type MessageValence } from '@dxos/ui-types';
|
|
10
10
|
|
|
11
11
|
import { withTheme } from '../../testing';
|
|
12
12
|
|
|
@@ -27,8 +27,8 @@ import {
|
|
|
27
27
|
type ValidationProps as ValidationPrimitiveProps,
|
|
28
28
|
useInputContext,
|
|
29
29
|
} from '@dxos/react-input';
|
|
30
|
-
import { mx } from '@dxos/
|
|
31
|
-
import { type ClassNameValue, type Density, type Elevation, type Size } from '@dxos/
|
|
30
|
+
import { mx } from '@dxos/ui-theme';
|
|
31
|
+
import { type ClassNameValue, type Density, type Elevation, type Size } from '@dxos/ui-types';
|
|
32
32
|
|
|
33
33
|
import { useDensityContext, useElevationContext, useThemeContext } from '../../hooks';
|
|
34
34
|
import { type ThemedClassName } from '../../util';
|
|
@@ -162,10 +162,17 @@ const PinInput = forwardRef<HTMLInputElement, PinInputProps>(
|
|
|
162
162
|
|
|
163
163
|
// TODO(burdon): Implement inline icon within button: e.g., https://www.radix-ui.com/themes/playground#text-field
|
|
164
164
|
|
|
165
|
-
type
|
|
165
|
+
type AutoFillProps = {
|
|
166
|
+
noAutoFill?: boolean;
|
|
167
|
+
};
|
|
168
|
+
|
|
169
|
+
type TextInputProps = InputSharedProps & ThemedClassName<TextInputPrimitiveProps> & AutoFillProps;
|
|
166
170
|
|
|
167
171
|
const TextInput = forwardRef<HTMLInputElement, InputScopedProps<TextInputProps>>(
|
|
168
|
-
(
|
|
172
|
+
(
|
|
173
|
+
{ __inputScope, classNames, density: propsDensity, elevation: propsElevation, variant, noAutoFill, ...props },
|
|
174
|
+
forwardedRef,
|
|
175
|
+
) => {
|
|
169
176
|
const { hasIosKeyboard } = useThemeContext();
|
|
170
177
|
const themeContextValue = useThemeContext();
|
|
171
178
|
const density = useDensityContext(propsDensity);
|
|
@@ -177,6 +184,8 @@ const TextInput = forwardRef<HTMLInputElement, InputScopedProps<TextInputProps>>
|
|
|
177
184
|
return (
|
|
178
185
|
<TextInputPrimitive
|
|
179
186
|
{...props}
|
|
187
|
+
// TODO(wittjosiah): Factor out autofill properies.
|
|
188
|
+
{...{ 'data-1p-ignore': noAutoFill }}
|
|
180
189
|
className={tx(
|
|
181
190
|
'input.input',
|
|
182
191
|
'input',
|
|
@@ -7,7 +7,7 @@ import { SortableContext, arrayMove, useSortable, verticalListSortingStrategy }
|
|
|
7
7
|
import { CSS } from '@dnd-kit/utilities';
|
|
8
8
|
import { useArrowNavigationGroup } from '@fluentui/react-tabster';
|
|
9
9
|
import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
10
|
-
import React, { type ReactNode, useState } from 'react';
|
|
10
|
+
import React, { type ReactNode, useCallback, useState } from 'react';
|
|
11
11
|
|
|
12
12
|
import {
|
|
13
13
|
getSize,
|
|
@@ -16,7 +16,7 @@ import {
|
|
|
16
16
|
ghostSelectedTrackingInterFromNormal,
|
|
17
17
|
mx,
|
|
18
18
|
surfaceShadow,
|
|
19
|
-
} from '@dxos/
|
|
19
|
+
} from '@dxos/ui-theme';
|
|
20
20
|
|
|
21
21
|
import { withTheme } from '../../testing';
|
|
22
22
|
import { Icon } from '../Icon';
|
|
@@ -63,16 +63,20 @@ export const UniformSizeDraggable: Story = {
|
|
|
63
63
|
})),
|
|
64
64
|
);
|
|
65
65
|
|
|
66
|
-
const handleDragEnd = (
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
66
|
+
const handleDragEnd = useCallback(
|
|
67
|
+
(event: DragEndEvent) => {
|
|
68
|
+
const { active, over } = event;
|
|
69
|
+
if (active.id !== over?.id) {
|
|
70
|
+
setItems((items) => {
|
|
71
|
+
const oldIndex = items.findIndex((item) => item.id === active.id);
|
|
72
|
+
const newIndex = items.findIndex((item) => item.id === over?.id);
|
|
73
|
+
return arrayMove(items, oldIndex, newIndex);
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
},
|
|
77
|
+
[items],
|
|
78
|
+
);
|
|
79
|
+
|
|
76
80
|
return (
|
|
77
81
|
<DndContext onDragEnd={handleDragEnd}>
|
|
78
82
|
<SortableContext items={items.map(({ id }) => id)} strategy={verticalListSortingStrategy}>
|