@dxos/react-ui 0.8.4-main.b97322e → 0.8.4-main.dedc0f3
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-2COVUP44.mjs → chunk-Y4PW3CX2.mjs} +56 -27
- package/dist/lib/browser/chunk-Y4PW3CX2.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +3 -1
- package/dist/lib/browser/index.mjs.map +1 -1
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/testing/index.mjs +2 -2
- package/dist/lib/browser/testing/index.mjs.map +3 -3
- package/dist/lib/node-esm/{chunk-GHXHND5V.mjs → chunk-L6LIOSFT.mjs} +56 -27
- package/dist/lib/node-esm/chunk-L6LIOSFT.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +3 -1
- package/dist/lib/node-esm/index.mjs.map +1 -1
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/testing/index.mjs +2 -2
- package/dist/lib/node-esm/testing/index.mjs.map +3 -3
- 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 -25
- package/dist/types/src/components/Avatars/Avatar.stories.d.ts.map +1 -1
- package/dist/types/src/components/Avatars/AvatarGroup.stories.d.ts +5 -5
- 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 -14
- package/dist/types/src/components/Breadcrumb/Breadcrumb.stories.d.ts.map +1 -1
- package/dist/types/src/components/Buttons/Button.stories.d.ts +14 -3
- package/dist/types/src/components/Buttons/Button.stories.d.ts.map +1 -1
- package/dist/types/src/components/Buttons/IconButton.d.ts +2 -2
- package/dist/types/src/components/Buttons/IconButton.d.ts.map +1 -1
- package/dist/types/src/components/Buttons/IconButton.stories.d.ts +6 -9
- package/dist/types/src/components/Buttons/IconButton.stories.d.ts.map +1 -1
- package/dist/types/src/components/Buttons/Toggle.stories.d.ts +5 -5
- package/dist/types/src/components/Buttons/Toggle.stories.d.ts.map +1 -1
- package/dist/types/src/components/Buttons/ToggleGroup.d.ts +5 -2
- package/dist/types/src/components/Buttons/ToggleGroup.d.ts.map +1 -1
- package/dist/types/src/components/Buttons/ToggleGroup.stories.d.ts +5 -7
- package/dist/types/src/components/Buttons/ToggleGroup.stories.d.ts.map +1 -1
- package/dist/types/src/components/Clipboard/ClipboardProvider.d.ts.map +1 -1
- package/dist/types/src/components/Clipboard/CopyButton.d.ts.map +1 -1
- package/dist/types/src/components/DensityProvider/DensityProvider.d.ts.map +1 -1
- package/dist/types/src/components/Dialogs/AlertDialog.d.ts +1 -1
- package/dist/types/src/components/Dialogs/AlertDialog.d.ts.map +1 -1
- package/dist/types/src/components/Dialogs/AlertDialog.stories.d.ts +7 -33
- package/dist/types/src/components/Dialogs/AlertDialog.stories.d.ts.map +1 -1
- package/dist/types/src/components/Dialogs/Dialog.d.ts +1 -1
- package/dist/types/src/components/Dialogs/Dialog.d.ts.map +1 -1
- package/dist/types/src/components/Dialogs/Dialog.stories.d.ts +6 -28
- package/dist/types/src/components/Dialogs/Dialog.stories.d.ts.map +1 -1
- package/dist/types/src/components/ElevationProvider/ElevationProvider.d.ts.map +1 -1
- package/dist/types/src/components/Input/Input.d.ts +2 -2
- package/dist/types/src/components/Input/Input.d.ts.map +1 -1
- package/dist/types/src/components/Input/Input.stories.d.ts +15 -10
- package/dist/types/src/components/Input/Input.stories.d.ts.map +1 -1
- package/dist/types/src/components/Link/Link.stories.d.ts +12 -6
- package/dist/types/src/components/Link/Link.stories.d.ts.map +1 -1
- package/dist/types/src/components/Lists/List.d.ts +2 -2
- package/dist/types/src/components/Lists/List.d.ts.map +1 -1
- package/dist/types/src/components/Lists/List.stories.d.ts +8 -25
- package/dist/types/src/components/Lists/List.stories.d.ts.map +1 -1
- package/dist/types/src/components/Lists/Tree.d.ts +1 -1
- package/dist/types/src/components/Lists/Tree.d.ts.map +1 -1
- package/dist/types/src/components/Lists/Tree.stories.d.ts +6 -26
- package/dist/types/src/components/Lists/Tree.stories.d.ts.map +1 -1
- package/dist/types/src/components/Lists/Treegrid.d.ts +1 -1
- package/dist/types/src/components/Lists/Treegrid.d.ts.map +1 -1
- package/dist/types/src/components/Lists/Treegrid.stories.d.ts +6 -4
- package/dist/types/src/components/Lists/Treegrid.stories.d.ts.map +1 -1
- package/dist/types/src/components/Main/Main.d.ts +1 -1
- package/dist/types/src/components/Main/Main.d.ts.map +1 -1
- package/dist/types/src/components/Main/Main.stories.d.ts +6 -6
- package/dist/types/src/components/Main/Main.stories.d.ts.map +1 -1
- package/dist/types/src/components/Menus/ContextMenu.d.ts.map +1 -1
- package/dist/types/src/components/Menus/ContextMenu.stories.d.ts +6 -38
- package/dist/types/src/components/Menus/ContextMenu.stories.d.ts.map +1 -1
- package/dist/types/src/components/Menus/DropdownMenu.d.ts +5 -4
- package/dist/types/src/components/Menus/DropdownMenu.d.ts.map +1 -1
- package/dist/types/src/components/Menus/DropdownMenu.stories.d.ts +6 -35
- package/dist/types/src/components/Menus/DropdownMenu.stories.d.ts.map +1 -1
- 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 +7 -15
- 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/Popover/Popover.stories.d.ts +6 -28
- package/dist/types/src/components/Popover/Popover.stories.d.ts.map +1 -1
- package/dist/types/src/components/ScrollArea/ScrollArea.d.ts +1 -1
- package/dist/types/src/components/ScrollArea/ScrollArea.d.ts.map +1 -1
- package/dist/types/src/components/ScrollArea/ScrollArea.stories.d.ts +6 -26
- package/dist/types/src/components/ScrollArea/ScrollArea.stories.d.ts.map +1 -1
- package/dist/types/src/components/Select/Select.d.ts.map +1 -1
- package/dist/types/src/components/Select/Select.stories.d.ts +4 -3
- package/dist/types/src/components/Select/Select.stories.d.ts.map +1 -1
- package/dist/types/src/components/Status/Status.stories.d.ts +2 -2
- package/dist/types/src/components/Status/Status.stories.d.ts.map +1 -1
- package/dist/types/src/components/Tag/Tag.stories.d.ts +6 -6
- package/dist/types/src/components/Tag/Tag.stories.d.ts.map +1 -1
- package/dist/types/src/components/ThemeProvider/ThemeProvider.d.ts +1 -1
- package/dist/types/src/components/ThemeProvider/ThemeProvider.d.ts.map +1 -1
- package/dist/types/src/components/ThemeProvider/TranslationsProvider.d.ts +1 -1
- package/dist/types/src/components/ThemeProvider/TranslationsProvider.d.ts.map +1 -1
- package/dist/types/src/components/Toast/Toast.d.ts +1 -1
- package/dist/types/src/components/Toast/Toast.d.ts.map +1 -1
- package/dist/types/src/components/Toast/Toast.stories.d.ts +6 -38
- package/dist/types/src/components/Toast/Toast.stories.d.ts.map +1 -1
- package/dist/types/src/components/Toolbar/Toolbar.d.ts +1 -1
- package/dist/types/src/components/Toolbar/Toolbar.d.ts.map +1 -1
- package/dist/types/src/components/Toolbar/Toolbar.stories.d.ts +6 -44
- package/dist/types/src/components/Toolbar/Toolbar.stories.d.ts.map +1 -1
- package/dist/types/src/components/Tooltip/Tooltip.d.ts +1 -1
- package/dist/types/src/components/Tooltip/Tooltip.d.ts.map +1 -1
- package/dist/types/src/components/Tooltip/Tooltip.stories.d.ts +8 -55
- package/dist/types/src/components/Tooltip/Tooltip.stories.d.ts.map +1 -1
- package/dist/types/src/playground/Controls.stories.d.ts +5 -3
- package/dist/types/src/playground/Controls.stories.d.ts.map +1 -1
- package/dist/types/src/playground/Custom.stories.d.ts +12 -3
- package/dist/types/src/playground/Custom.stories.d.ts.map +1 -1
- package/dist/types/src/playground/Typography.stories.d.ts +5 -5
- package/dist/types/src/playground/Typography.stories.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +16 -14
- package/src/components/Avatars/Avatar.stories.tsx +19 -8
- package/src/components/Avatars/Avatar.tsx +3 -3
- package/src/components/Avatars/AvatarGroup.stories.tsx +11 -4
- package/src/components/Breadcrumb/Breadcrumb.stories.tsx +16 -8
- package/src/components/Breadcrumb/Breadcrumb.tsx +1 -1
- package/src/components/Buttons/Button.stories.tsx +5 -4
- package/src/components/Buttons/IconButton.stories.tsx +11 -5
- package/src/components/Buttons/IconButton.tsx +4 -3
- package/src/components/Buttons/Toggle.stories.tsx +10 -4
- package/src/components/Buttons/ToggleGroup.stories.tsx +10 -4
- package/src/components/Buttons/ToggleGroup.tsx +17 -4
- package/src/components/Clipboard/ClipboardProvider.tsx +1 -1
- package/src/components/Clipboard/CopyButton.tsx +2 -1
- package/src/components/DensityProvider/DensityProvider.tsx +1 -1
- package/src/components/Dialogs/AlertDialog.stories.tsx +14 -8
- package/src/components/Dialogs/AlertDialog.tsx +13 -13
- package/src/components/Dialogs/Dialog.stories.tsx +11 -11
- package/src/components/Dialogs/Dialog.tsx +13 -13
- package/src/components/ElevationProvider/ElevationProvider.tsx +1 -1
- package/src/components/Input/Input.stories.tsx +12 -11
- package/src/components/Input/Input.tsx +13 -13
- package/src/components/Link/Link.stories.tsx +11 -4
- package/src/components/Lists/List.stories.tsx +14 -8
- package/src/components/Lists/List.tsx +16 -12
- package/src/components/Lists/Tree.stories.tsx +11 -5
- package/src/components/Lists/Tree.tsx +4 -3
- package/src/components/Lists/TreeDropIndicator.tsx +1 -1
- package/src/components/Lists/Treegrid.stories.tsx +12 -6
- package/src/components/Lists/Treegrid.tsx +2 -2
- package/src/components/Main/Main.stories.tsx +14 -6
- package/src/components/Main/Main.tsx +15 -9
- package/src/components/Menus/ContextMenu.stories.tsx +11 -5
- package/src/components/Menus/ContextMenu.tsx +1 -0
- package/src/components/Menus/DropdownMenu.stories.tsx +11 -5
- package/src/components/Menus/DropdownMenu.tsx +21 -11
- package/src/components/Message/Message.stories.tsx +11 -5
- package/src/components/Message/Message.tsx +1 -1
- package/src/components/Popover/Popover.stories.tsx +11 -5
- package/src/components/Popover/Popover.tsx +7 -7
- package/src/components/ScrollArea/ScrollArea.stories.tsx +11 -5
- package/src/components/ScrollArea/ScrollArea.tsx +4 -4
- package/src/components/Select/Select.stories.tsx +14 -9
- package/src/components/Select/Select.tsx +5 -4
- package/src/components/Status/Status.stories.tsx +9 -3
- package/src/components/Tag/Tag.stories.tsx +13 -5
- package/src/components/ThemeProvider/ThemeProvider.tsx +3 -2
- package/src/components/ThemeProvider/TranslationsProvider.tsx +3 -3
- package/src/components/Toast/Toast.stories.tsx +11 -5
- package/src/components/Toast/Toast.tsx +9 -9
- package/src/components/Toolbar/Toolbar.stories.tsx +12 -5
- package/src/components/Toolbar/Toolbar.tsx +3 -2
- package/src/components/Tooltip/Tooltip.stories.tsx +16 -9
- package/src/components/Tooltip/Tooltip.tsx +3 -3
- package/src/playground/Controls.stories.tsx +10 -4
- package/src/playground/Custom.stories.tsx +4 -4
- package/src/playground/Typography.stories.tsx +8 -3
- package/src/testing/decorators/withTheme.ts +1 -1
- package/dist/lib/browser/chunk-2COVUP44.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-GHXHND5V.mjs.map +0 -7
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dxos/react-ui",
|
|
3
|
-
"version": "0.8.4-main.
|
|
3
|
+
"version": "0.8.4-main.dedc0f3",
|
|
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",
|
|
@@ -10,11 +10,13 @@
|
|
|
10
10
|
"type": "module",
|
|
11
11
|
"exports": {
|
|
12
12
|
".": {
|
|
13
|
+
"source": "./src/index.ts",
|
|
13
14
|
"types": "./dist/types/src/index.d.ts",
|
|
14
15
|
"browser": "./dist/lib/browser/index.mjs",
|
|
15
16
|
"node": "./dist/lib/node-esm/index.mjs"
|
|
16
17
|
},
|
|
17
18
|
"./testing": {
|
|
19
|
+
"source": "./src/testing/index.ts",
|
|
18
20
|
"types": "./dist/types/src/testing/index.d.ts",
|
|
19
21
|
"browser": "./dist/lib/browser/testing/index.mjs",
|
|
20
22
|
"node": "./dist/lib/node-esm/testing/index.mjs"
|
|
@@ -73,14 +75,14 @@
|
|
|
73
75
|
"keyborg": "^2.5.0",
|
|
74
76
|
"react-i18next": "^11.18.6",
|
|
75
77
|
"react-remove-scroll": "^2.6.0",
|
|
76
|
-
"@dxos/
|
|
77
|
-
"@dxos/
|
|
78
|
-
"@dxos/
|
|
79
|
-
"@dxos/react-hooks": "0.8.4-main.
|
|
80
|
-
"@dxos/react-
|
|
81
|
-
"@dxos/react-
|
|
82
|
-
"@dxos/react-
|
|
83
|
-
"@dxos/util": "0.8.4-main.
|
|
78
|
+
"@dxos/debug": "0.8.4-main.dedc0f3",
|
|
79
|
+
"@dxos/log": "0.8.4-main.dedc0f3",
|
|
80
|
+
"@dxos/lit-ui": "0.8.4-main.dedc0f3",
|
|
81
|
+
"@dxos/react-hooks": "0.8.4-main.dedc0f3",
|
|
82
|
+
"@dxos/react-input": "0.8.4-main.dedc0f3",
|
|
83
|
+
"@dxos/react-list": "0.8.4-main.dedc0f3",
|
|
84
|
+
"@dxos/react-ui-types": "0.8.4-main.dedc0f3",
|
|
85
|
+
"@dxos/util": "0.8.4-main.dedc0f3"
|
|
84
86
|
},
|
|
85
87
|
"devDependencies": {
|
|
86
88
|
"@dnd-kit/core": "^6.0.5",
|
|
@@ -90,16 +92,16 @@
|
|
|
90
92
|
"@types/react-dom": "~18.2.0",
|
|
91
93
|
"react": "~18.2.0",
|
|
92
94
|
"react-dom": "~18.2.0",
|
|
93
|
-
"vite": "
|
|
94
|
-
"@dxos/random": "0.8.4-main.
|
|
95
|
-
"@dxos/
|
|
96
|
-
"@dxos/
|
|
95
|
+
"vite": "7.1.1",
|
|
96
|
+
"@dxos/random": "0.8.4-main.dedc0f3",
|
|
97
|
+
"@dxos/react-ui-theme": "0.8.4-main.dedc0f3",
|
|
98
|
+
"@dxos/util": "0.8.4-main.dedc0f3"
|
|
97
99
|
},
|
|
98
100
|
"peerDependencies": {
|
|
99
101
|
"@phosphor-icons/react": "^2.1.5",
|
|
100
102
|
"react": "~18.2.0",
|
|
101
103
|
"react-dom": "~18.2.0",
|
|
102
|
-
"@dxos/react-ui-theme": "0.8.4-main.
|
|
104
|
+
"@dxos/react-ui-theme": "0.8.4-main.dedc0f3"
|
|
103
105
|
},
|
|
104
106
|
"publishConfig": {
|
|
105
107
|
"access": "public"
|
|
@@ -3,16 +3,18 @@
|
|
|
3
3
|
//
|
|
4
4
|
|
|
5
5
|
import '@dxos-theme';
|
|
6
|
+
import { type Meta } from '@storybook/react-vite';
|
|
6
7
|
import React, { type PropsWithChildren } from 'react';
|
|
7
8
|
|
|
8
9
|
import { type HuePalette } from '@dxos/react-ui-theme';
|
|
9
10
|
import { type Size } from '@dxos/react-ui-types';
|
|
10
11
|
import { hexToFallback } from '@dxos/util';
|
|
11
12
|
|
|
12
|
-
import { Avatar, type AvatarVariant, type AvatarStatus, type AvatarAnimation } from './Avatar';
|
|
13
13
|
import { withTheme } from '../../testing';
|
|
14
14
|
|
|
15
|
-
type
|
|
15
|
+
import { Avatar, type AvatarAnimation, type AvatarStatus, type AvatarVariant } from './Avatar';
|
|
16
|
+
|
|
17
|
+
type StoryProps = PropsWithChildren<{
|
|
16
18
|
id?: string;
|
|
17
19
|
imgSrc?: string;
|
|
18
20
|
fallbackText?: string;
|
|
@@ -23,9 +25,9 @@ type StoryProps = {
|
|
|
23
25
|
animation?: AvatarAnimation;
|
|
24
26
|
size?: Size;
|
|
25
27
|
hue?: HuePalette;
|
|
26
|
-
}
|
|
28
|
+
}>;
|
|
27
29
|
|
|
28
|
-
const DefaultStory = (props:
|
|
30
|
+
const DefaultStory = (props: StoryProps) => {
|
|
29
31
|
const {
|
|
30
32
|
id = '20970b563fc49b5bb194a6ffdff376031a3a11f9481360c071c3fed87874106b',
|
|
31
33
|
status,
|
|
@@ -55,17 +57,20 @@ const DefaultStory = (props: PropsWithChildren<StoryProps>) => {
|
|
|
55
57
|
);
|
|
56
58
|
};
|
|
57
59
|
|
|
58
|
-
|
|
60
|
+
const meta = {
|
|
59
61
|
title: 'ui/react-ui-core/Avatar',
|
|
60
|
-
component: Avatar,
|
|
61
|
-
render: DefaultStory,
|
|
62
|
+
component: Avatar.Root,
|
|
62
63
|
decorators: [withTheme],
|
|
63
64
|
parameters: { chromatic: { disableSnapshot: false } },
|
|
64
|
-
}
|
|
65
|
+
} satisfies Meta<typeof Avatar.Root>;
|
|
66
|
+
|
|
67
|
+
export default meta;
|
|
65
68
|
|
|
66
69
|
const sampleImage =
|
|
67
70
|
'https://png.pngtree.com/thumb_back/fh260/background/20230614/pngtree-the-photo-of-a-woman-with-red-sunglasses-is-surrounded-by-image_2931163.jpg';
|
|
68
71
|
|
|
72
|
+
const brokenImage = 'https://png.pngtree.com/potato_squirrel.png';
|
|
73
|
+
|
|
69
74
|
const row = (size: Size) => (
|
|
70
75
|
<>
|
|
71
76
|
<DefaultStory size={size} status='inactive' description='Offline' />
|
|
@@ -97,6 +102,12 @@ export const Image = () => (
|
|
|
97
102
|
</div>
|
|
98
103
|
);
|
|
99
104
|
|
|
105
|
+
export const BrokenImage = () => (
|
|
106
|
+
<div>
|
|
107
|
+
<DefaultStory variant='circle' imgSrc={brokenImage} />
|
|
108
|
+
</div>
|
|
109
|
+
);
|
|
110
|
+
|
|
100
111
|
export const Square = () => (
|
|
101
112
|
<div className='flex flex-row gap-4'>
|
|
102
113
|
<DefaultStory variant='square' status='inactive' description='Offline' />
|
|
@@ -7,12 +7,12 @@ import '@dxos/lit-ui/dx-avatar.pcss';
|
|
|
7
7
|
import { createContext } from '@radix-ui/react-context';
|
|
8
8
|
import { Primitive } from '@radix-ui/react-primitive';
|
|
9
9
|
import { Slot } from '@radix-ui/react-slot';
|
|
10
|
-
import React, { type ComponentProps, type ComponentPropsWithRef,
|
|
10
|
+
import React, { type ComponentProps, type ComponentPropsWithRef, type PropsWithChildren, forwardRef } from 'react';
|
|
11
11
|
|
|
12
12
|
import {
|
|
13
|
-
type AvatarVariant,
|
|
14
|
-
type AvatarStatus,
|
|
15
13
|
type AvatarAnimation,
|
|
14
|
+
type AvatarStatus,
|
|
15
|
+
type AvatarVariant,
|
|
16
16
|
type DxAvatar as NaturalDxAvatar,
|
|
17
17
|
} from '@dxos/lit-ui';
|
|
18
18
|
import { DxAvatar } from '@dxos/lit-ui/react';
|
|
@@ -3,14 +3,17 @@
|
|
|
3
3
|
//
|
|
4
4
|
|
|
5
5
|
import '@dxos-theme';
|
|
6
|
+
|
|
7
|
+
import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
6
8
|
import React from 'react';
|
|
7
9
|
|
|
8
10
|
import { useId } from '@dxos/react-hooks';
|
|
9
11
|
import { toEmoji } from '@dxos/util';
|
|
10
12
|
|
|
11
|
-
import { Avatar } from './Avatar';
|
|
12
13
|
import { withTheme } from '../../testing';
|
|
13
14
|
|
|
15
|
+
import { Avatar } from './Avatar';
|
|
16
|
+
|
|
14
17
|
const hues = ['lime', 'teal', 'purple', 'pink'];
|
|
15
18
|
|
|
16
19
|
const AvatarItem = ({ n }: { n: number }) => {
|
|
@@ -36,13 +39,17 @@ const DefaultStory = () => {
|
|
|
36
39
|
);
|
|
37
40
|
};
|
|
38
41
|
|
|
39
|
-
|
|
42
|
+
const meta = {
|
|
40
43
|
title: 'ui/react-ui-core/AvatarGroup',
|
|
41
44
|
render: DefaultStory,
|
|
42
45
|
decorators: [withTheme],
|
|
43
46
|
parameters: { chromatic: { disableSnapshot: false } },
|
|
44
|
-
}
|
|
47
|
+
} satisfies Meta<typeof DefaultStory>;
|
|
48
|
+
|
|
49
|
+
export default meta;
|
|
50
|
+
|
|
51
|
+
type Story = StoryObj<typeof meta>;
|
|
45
52
|
|
|
46
|
-
export const Default = {
|
|
53
|
+
export const Default: Story = {
|
|
47
54
|
args: {},
|
|
48
55
|
};
|
|
@@ -4,15 +4,17 @@
|
|
|
4
4
|
|
|
5
5
|
import '@dxos-theme';
|
|
6
6
|
|
|
7
|
+
import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
7
8
|
import React from 'react';
|
|
8
9
|
|
|
9
|
-
import { Breadcrumb } from './Breadcrumb';
|
|
10
10
|
import { withTheme } from '../../testing';
|
|
11
11
|
import { Button } from '../Buttons';
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
import { Breadcrumb, type BreadcrumbRootProps } from './Breadcrumb';
|
|
14
|
+
|
|
15
|
+
const DefaultStory = (props: BreadcrumbRootProps) => {
|
|
14
16
|
return (
|
|
15
|
-
<Breadcrumb.Root
|
|
17
|
+
<Breadcrumb.Root {...props}>
|
|
16
18
|
<Breadcrumb.List>
|
|
17
19
|
<Breadcrumb.ListItem>
|
|
18
20
|
<Breadcrumb.Link asChild>
|
|
@@ -38,14 +40,20 @@ const DefaultStory = () => {
|
|
|
38
40
|
);
|
|
39
41
|
};
|
|
40
42
|
|
|
41
|
-
|
|
43
|
+
const meta = {
|
|
42
44
|
title: 'ui/react-ui-core/Breadcrumb',
|
|
43
|
-
component: Breadcrumb,
|
|
45
|
+
component: Breadcrumb.Root as any,
|
|
44
46
|
render: DefaultStory,
|
|
45
47
|
decorators: [withTheme],
|
|
46
48
|
parameters: { chromatic: { disableSnapshot: false } },
|
|
47
|
-
}
|
|
49
|
+
} satisfies Meta<typeof DefaultStory>;
|
|
50
|
+
|
|
51
|
+
export default meta;
|
|
52
|
+
|
|
53
|
+
type Story = StoryObj<typeof meta>;
|
|
48
54
|
|
|
49
|
-
export const Default = {
|
|
50
|
-
args: {
|
|
55
|
+
export const Default: Story = {
|
|
56
|
+
args: {
|
|
57
|
+
'aria-label': 'Breadcrumb',
|
|
58
|
+
},
|
|
51
59
|
};
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
import { Primitive } from '@radix-ui/react-primitive';
|
|
6
6
|
import { Slot } from '@radix-ui/react-slot';
|
|
7
|
-
import React, { type
|
|
7
|
+
import React, { type ComponentPropsWithRef, type ComponentPropsWithoutRef, forwardRef } from 'react';
|
|
8
8
|
|
|
9
9
|
import { useThemeContext } from '../../hooks';
|
|
10
10
|
import { type ThemedClassName } from '../../util';
|
|
@@ -4,13 +4,14 @@
|
|
|
4
4
|
|
|
5
5
|
import '@dxos-theme';
|
|
6
6
|
|
|
7
|
-
import { type
|
|
7
|
+
import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
8
8
|
import React from 'react';
|
|
9
9
|
|
|
10
|
-
import { Button, ButtonGroup, type ButtonProps } from './Button';
|
|
11
10
|
import { withSurfaceVariantsLayout, withTheme } from '../../testing';
|
|
12
11
|
import { Icon } from '../Icon';
|
|
13
12
|
|
|
13
|
+
import { Button, ButtonGroup, type ButtonProps } from './Button';
|
|
14
|
+
|
|
14
15
|
const DefaultStory = ({ children, ...args }: Omit<ButtonProps, 'ref'>) => {
|
|
15
16
|
return (
|
|
16
17
|
<div>
|
|
@@ -32,13 +33,13 @@ const DefaultStory = ({ children, ...args }: Omit<ButtonProps, 'ref'>) => {
|
|
|
32
33
|
);
|
|
33
34
|
};
|
|
34
35
|
|
|
35
|
-
const meta
|
|
36
|
+
const meta = {
|
|
36
37
|
title: 'ui/react-ui-core/Button',
|
|
37
38
|
component: Button,
|
|
38
39
|
render: DefaultStory,
|
|
39
40
|
decorators: [withSurfaceVariantsLayout(), withTheme],
|
|
40
41
|
parameters: { chromatic: { disableSnapshot: false } },
|
|
41
|
-
}
|
|
42
|
+
} satisfies Meta<typeof Button>;
|
|
42
43
|
|
|
43
44
|
export default meta;
|
|
44
45
|
|
|
@@ -4,12 +4,14 @@
|
|
|
4
4
|
|
|
5
5
|
import '@dxos-theme';
|
|
6
6
|
|
|
7
|
+
import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
7
8
|
import React from 'react';
|
|
8
9
|
|
|
9
|
-
import { IconButton, type IconButtonProps } from './IconButton';
|
|
10
10
|
import { withTheme } from '../../testing';
|
|
11
11
|
import { Tooltip } from '../Tooltip';
|
|
12
12
|
|
|
13
|
+
import { IconButton, type IconButtonProps } from './IconButton';
|
|
14
|
+
|
|
13
15
|
const DefaultStory = (props: IconButtonProps) => {
|
|
14
16
|
return (
|
|
15
17
|
<Tooltip.Provider>
|
|
@@ -23,15 +25,19 @@ const DefaultStory = (props: IconButtonProps) => {
|
|
|
23
25
|
);
|
|
24
26
|
};
|
|
25
27
|
|
|
26
|
-
|
|
28
|
+
const meta = {
|
|
27
29
|
title: 'ui/react-ui-core/IconButton',
|
|
28
30
|
component: IconButton,
|
|
29
|
-
render: DefaultStory,
|
|
31
|
+
render: DefaultStory as any,
|
|
30
32
|
decorators: [withTheme],
|
|
31
33
|
parameters: { chromatic: { disableSnapshot: false } },
|
|
32
|
-
}
|
|
34
|
+
} satisfies Meta<typeof IconButton>;
|
|
35
|
+
|
|
36
|
+
export default meta;
|
|
37
|
+
|
|
38
|
+
type Story = StoryObj<typeof meta>;
|
|
33
39
|
|
|
34
|
-
export const Default = {
|
|
40
|
+
export const Default: Story = {
|
|
35
41
|
args: {
|
|
36
42
|
label: 'Bold',
|
|
37
43
|
icon: 'ph--text-b--regular',
|
|
@@ -4,14 +4,15 @@
|
|
|
4
4
|
|
|
5
5
|
import React, { forwardRef } from 'react';
|
|
6
6
|
|
|
7
|
-
import { Button, type ButtonProps } from './Button';
|
|
8
7
|
import { useThemeContext } from '../../hooks';
|
|
9
8
|
import { type ThemedClassName } from '../../util';
|
|
10
9
|
import { Icon, type IconProps } from '../Icon';
|
|
11
10
|
import { Tooltip, type TooltipSide } from '../Tooltip';
|
|
12
11
|
|
|
12
|
+
import { Button, type ButtonProps } from './Button';
|
|
13
|
+
|
|
13
14
|
type IconButtonProps = Omit<ButtonProps, 'children'> &
|
|
14
|
-
Pick<IconProps, 'icon' | 'size'
|
|
15
|
+
Partial<Pick<IconProps, 'icon' | 'size'>> & {
|
|
15
16
|
label: string;
|
|
16
17
|
iconOnly?: boolean;
|
|
17
18
|
noTooltip?: boolean;
|
|
@@ -39,7 +40,7 @@ const LabelledIconButton = forwardRef<HTMLButtonElement, IconButtonProps>(
|
|
|
39
40
|
const { tx } = useThemeContext();
|
|
40
41
|
return (
|
|
41
42
|
<Button {...props} classNames={tx('iconButton.root', 'iconButton', { iconOnly }, classNames)} ref={forwardedRef}>
|
|
42
|
-
<Icon icon={icon} size={size} classNames={iconClassNames} />
|
|
43
|
+
{icon && <Icon icon={icon} size={size} classNames={iconClassNames} />}
|
|
43
44
|
<span className={iconOnly ? 'sr-only' : undefined}>{label}</span>
|
|
44
45
|
{caretDown && <Icon size={3} icon='ph--caret-down--bold' />}
|
|
45
46
|
</Button>
|
|
@@ -4,12 +4,14 @@
|
|
|
4
4
|
|
|
5
5
|
import '@dxos-theme';
|
|
6
6
|
|
|
7
|
+
import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
7
8
|
import React from 'react';
|
|
8
9
|
|
|
9
|
-
import { Toggle } from './Toggle';
|
|
10
10
|
import { withTheme } from '../../testing';
|
|
11
11
|
import { Icon } from '../Icon';
|
|
12
12
|
|
|
13
|
+
import { Toggle } from './Toggle';
|
|
14
|
+
|
|
13
15
|
type StorybookToggleProps = {};
|
|
14
16
|
|
|
15
17
|
const DefaultStory = (props: StorybookToggleProps) => {
|
|
@@ -20,14 +22,18 @@ const DefaultStory = (props: StorybookToggleProps) => {
|
|
|
20
22
|
);
|
|
21
23
|
};
|
|
22
24
|
|
|
23
|
-
|
|
25
|
+
const meta = {
|
|
24
26
|
title: 'ui/react-ui-core/Toggle',
|
|
25
27
|
component: Toggle,
|
|
26
28
|
render: DefaultStory,
|
|
27
29
|
decorators: [withTheme],
|
|
28
30
|
parameters: { chromatic: { disableSnapshot: false } },
|
|
29
|
-
}
|
|
31
|
+
} satisfies Meta<typeof Toggle>;
|
|
32
|
+
|
|
33
|
+
export default meta;
|
|
34
|
+
|
|
35
|
+
type Story = StoryObj<typeof meta>;
|
|
30
36
|
|
|
31
|
-
export const Default = {
|
|
37
|
+
export const Default: Story = {
|
|
32
38
|
args: {},
|
|
33
39
|
};
|
|
@@ -4,12 +4,14 @@
|
|
|
4
4
|
|
|
5
5
|
import '@dxos-theme';
|
|
6
6
|
|
|
7
|
+
import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
7
8
|
import React from 'react';
|
|
8
9
|
|
|
9
|
-
import { ToggleGroup, ToggleGroupItem, type ToggleGroupProps } from './ToggleGroup';
|
|
10
10
|
import { withTheme } from '../../testing';
|
|
11
11
|
import { Icon } from '../Icon';
|
|
12
12
|
|
|
13
|
+
import { ToggleGroup, ToggleGroupItem, type ToggleGroupProps } from './ToggleGroup';
|
|
14
|
+
|
|
13
15
|
// TODO(burdon): Create Radix-style Root, Item, etc?
|
|
14
16
|
const DefaultStory = (props: ToggleGroupProps) => {
|
|
15
17
|
return (
|
|
@@ -24,15 +26,19 @@ const DefaultStory = (props: ToggleGroupProps) => {
|
|
|
24
26
|
);
|
|
25
27
|
};
|
|
26
28
|
|
|
27
|
-
|
|
29
|
+
const meta = {
|
|
28
30
|
title: 'ui/react-ui-core/ToggleGroup',
|
|
29
31
|
component: ToggleGroup,
|
|
30
32
|
render: DefaultStory,
|
|
31
33
|
decorators: [withTheme],
|
|
32
34
|
parameters: { chromatic: { disableSnapshot: false } },
|
|
33
|
-
}
|
|
35
|
+
} satisfies Meta<typeof ToggleGroup>;
|
|
36
|
+
|
|
37
|
+
export default meta;
|
|
38
|
+
|
|
39
|
+
type Story = StoryObj<typeof meta>;
|
|
34
40
|
|
|
35
|
-
export const Default = {
|
|
41
|
+
export const Default: Story = {
|
|
36
42
|
args: {
|
|
37
43
|
type: 'single',
|
|
38
44
|
},
|
|
@@ -3,15 +3,16 @@
|
|
|
3
3
|
//
|
|
4
4
|
|
|
5
5
|
import {
|
|
6
|
+
ToggleGroupItem as ToggleGroupItemPrimitive,
|
|
7
|
+
type ToggleGroupItemProps as ToggleGroupItemPrimitiveProps,
|
|
8
|
+
type ToggleGroupMultipleProps,
|
|
6
9
|
ToggleGroup as ToggleGroupPrimitive,
|
|
7
10
|
type ToggleGroupSingleProps,
|
|
8
|
-
type ToggleGroupMultipleProps,
|
|
9
|
-
type ToggleGroupItemProps as ToggleGroupItemPrimitiveProps,
|
|
10
|
-
ToggleGroupItem as ToggleGroupItemPrimitive,
|
|
11
11
|
} from '@radix-ui/react-toggle-group';
|
|
12
12
|
import React, { forwardRef } from 'react';
|
|
13
13
|
|
|
14
14
|
import { Button, ButtonGroup, type ButtonGroupProps, type ButtonProps } from './Button';
|
|
15
|
+
import { IconButton, type IconButtonProps } from './IconButton';
|
|
15
16
|
|
|
16
17
|
type ToggleGroupProps = Omit<ToggleGroupSingleProps, 'className'> | Omit<ToggleGroupMultipleProps, 'className'>;
|
|
17
18
|
|
|
@@ -37,5 +38,17 @@ const ToggleGroupItem = forwardRef<HTMLButtonElement, ToggleGroupItemProps>(
|
|
|
37
38
|
},
|
|
38
39
|
);
|
|
39
40
|
|
|
40
|
-
|
|
41
|
+
type ToggleGroupIconItemProps = Omit<ToggleGroupItemPrimitiveProps, 'className'> & IconButtonProps;
|
|
42
|
+
|
|
43
|
+
const ToggleGroupIconItem = forwardRef<HTMLButtonElement, ToggleGroupIconItemProps>(
|
|
44
|
+
({ variant, label, icon, size, elevation, density, classNames, ...props }, forwardedRef) => {
|
|
45
|
+
return (
|
|
46
|
+
<ToggleGroupItemPrimitive {...props} asChild>
|
|
47
|
+
<IconButton {...{ variant, elevation, density, classNames, label, icon, size }} ref={forwardedRef} />
|
|
48
|
+
</ToggleGroupItemPrimitive>
|
|
49
|
+
);
|
|
50
|
+
},
|
|
51
|
+
);
|
|
52
|
+
|
|
53
|
+
export { ToggleGroup, ToggleGroupItem, ToggleGroupIconItem };
|
|
41
54
|
export type { ToggleGroupProps, ToggleGroupItemProps };
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// Copyright 2023 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import React, {
|
|
5
|
+
import React, { type PropsWithChildren, createContext, useCallback, useContext, useState } from 'react';
|
|
6
6
|
|
|
7
7
|
export type ClipboardContextValue = {
|
|
8
8
|
textValue: string;
|
|
@@ -6,12 +6,13 @@ import React from 'react';
|
|
|
6
6
|
|
|
7
7
|
import { mx } from '@dxos/react-ui-theme';
|
|
8
8
|
|
|
9
|
-
import { useClipboard } from './ClipboardProvider';
|
|
10
9
|
import { Button, type ButtonProps, IconButton } from '../Buttons';
|
|
11
10
|
import { Icon, type IconProps } from '../Icon';
|
|
12
11
|
import { useTranslation } from '../ThemeProvider';
|
|
13
12
|
import { type TooltipScopedProps, useTooltipContext } from '../Tooltip';
|
|
14
13
|
|
|
14
|
+
import { useClipboard } from './ClipboardProvider';
|
|
15
|
+
|
|
15
16
|
export type CopyButtonProps = ButtonProps &
|
|
16
17
|
Pick<IconProps, 'size'> & {
|
|
17
18
|
value: string;
|
|
@@ -4,23 +4,25 @@
|
|
|
4
4
|
|
|
5
5
|
import '@dxos-theme';
|
|
6
6
|
|
|
7
|
+
import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
7
8
|
import React from 'react';
|
|
8
9
|
|
|
9
|
-
import { AlertDialog } from './AlertDialog';
|
|
10
10
|
import { withTheme } from '../../testing';
|
|
11
11
|
import { Button } from '../Buttons';
|
|
12
12
|
import { Toolbar } from '../Toolbar';
|
|
13
13
|
|
|
14
|
+
import { AlertDialog } from './AlertDialog';
|
|
15
|
+
|
|
14
16
|
type StoryProps = Partial<{
|
|
15
17
|
title: string;
|
|
16
18
|
description: string;
|
|
17
19
|
body: string;
|
|
20
|
+
openTrigger: string;
|
|
18
21
|
cancelTrigger: string;
|
|
19
22
|
actionTrigger: string;
|
|
20
|
-
openTrigger: string;
|
|
21
23
|
}>;
|
|
22
24
|
|
|
23
|
-
const DefaultStory = ({ title,
|
|
25
|
+
const DefaultStory = ({ title, description, body, openTrigger, cancelTrigger, actionTrigger }: StoryProps) => {
|
|
24
26
|
return (
|
|
25
27
|
<AlertDialog.Root defaultOpen>
|
|
26
28
|
<AlertDialog.Trigger asChild>
|
|
@@ -46,15 +48,19 @@ const DefaultStory = ({ title, openTrigger, description, body, cancelTrigger, ac
|
|
|
46
48
|
);
|
|
47
49
|
};
|
|
48
50
|
|
|
49
|
-
|
|
51
|
+
const meta = {
|
|
50
52
|
title: 'ui/react-ui-core/AlertDialog',
|
|
51
|
-
component: AlertDialog,
|
|
52
|
-
render: DefaultStory,
|
|
53
|
+
component: AlertDialog.Root as any,
|
|
54
|
+
render: DefaultStory as any,
|
|
53
55
|
decorators: [withTheme],
|
|
54
56
|
parameters: { chromatic: { disableSnapshot: false } },
|
|
55
|
-
}
|
|
57
|
+
} satisfies Meta<typeof DefaultStory>;
|
|
58
|
+
|
|
59
|
+
export default meta;
|
|
60
|
+
|
|
61
|
+
type Story = StoryObj<typeof meta>;
|
|
56
62
|
|
|
57
|
-
export const Default = {
|
|
63
|
+
export const Default: Story = {
|
|
58
64
|
args: {
|
|
59
65
|
title: 'AlertDialog title',
|
|
60
66
|
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';
|
|
@@ -4,12 +4,14 @@
|
|
|
4
4
|
|
|
5
5
|
import '@dxos-theme';
|
|
6
6
|
|
|
7
|
+
import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
7
8
|
import React from 'react';
|
|
8
9
|
|
|
9
|
-
import { Dialog } from './Dialog';
|
|
10
10
|
import { withTheme } from '../../testing';
|
|
11
11
|
import { Button } from '../Buttons';
|
|
12
12
|
|
|
13
|
+
import { Dialog } from './Dialog';
|
|
14
|
+
|
|
13
15
|
type StoryProps = Partial<{
|
|
14
16
|
title: string;
|
|
15
17
|
description: string;
|
|
@@ -39,15 +41,19 @@ const DefaultStory = ({ title, openTrigger, description, body, closeTrigger, blo
|
|
|
39
41
|
);
|
|
40
42
|
};
|
|
41
43
|
|
|
42
|
-
|
|
44
|
+
const meta = {
|
|
43
45
|
title: 'ui/react-ui-core/Dialog',
|
|
44
|
-
component: Dialog,
|
|
46
|
+
component: Dialog as any,
|
|
45
47
|
render: DefaultStory,
|
|
46
48
|
decorators: [withTheme],
|
|
47
49
|
parameters: { chromatic: { disableSnapshot: false } },
|
|
48
|
-
}
|
|
50
|
+
} satisfies Meta<typeof DefaultStory>;
|
|
49
51
|
|
|
50
|
-
export
|
|
52
|
+
export default meta;
|
|
53
|
+
|
|
54
|
+
type Story = StoryObj<typeof meta>;
|
|
55
|
+
|
|
56
|
+
export const Default: Story = {
|
|
51
57
|
args: {
|
|
52
58
|
title: 'Dialog title',
|
|
53
59
|
openTrigger: 'Open Dialog',
|
|
@@ -56,10 +62,4 @@ export const Default = {
|
|
|
56
62
|
closeTrigger: 'Close trigger',
|
|
57
63
|
blockAlign: 'center',
|
|
58
64
|
},
|
|
59
|
-
argTypes: {
|
|
60
|
-
blockAlign: {
|
|
61
|
-
type: 'select',
|
|
62
|
-
options: ['center', 'start', 'end'],
|
|
63
|
-
},
|
|
64
|
-
},
|
|
65
65
|
};
|