@dxos/react-ui 0.8.2-main.30e4dbb → 0.8.2-main.4c6cf53
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-5Y5JI6KC.mjs +4355 -0
- package/dist/lib/browser/chunk-5Y5JI6KC.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +73 -3518
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/testing/index.mjs +85 -0
- package/dist/lib/browser/testing/index.mjs.map +7 -0
- package/dist/lib/node/chunk-KMS7RFL7.cjs +4340 -0
- package/dist/lib/node/chunk-KMS7RFL7.cjs.map +7 -0
- package/dist/lib/node/index.cjs +69 -3480
- package/dist/lib/node/index.cjs.map +4 -4
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node/testing/index.cjs +114 -0
- package/dist/lib/node/testing/index.cjs.map +7 -0
- package/dist/lib/node-esm/chunk-ANVE7WX5.mjs +4357 -0
- package/dist/lib/node-esm/chunk-ANVE7WX5.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +72 -3518
- 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 +86 -0
- package/dist/lib/node-esm/testing/index.mjs.map +7 -0
- package/dist/types/src/components/Avatars/Avatar.d.ts +2 -2
- package/dist/types/src/components/Avatars/Avatar.d.ts.map +1 -1
- package/dist/types/src/components/Avatars/Avatar.stories.d.ts +2 -2
- package/dist/types/src/components/Avatars/Avatar.stories.d.ts.map +1 -1
- package/dist/types/src/components/Avatars/AvatarGroup.stories.d.ts +0 -1
- package/dist/types/src/components/Avatars/AvatarGroup.stories.d.ts.map +1 -1
- package/dist/types/src/components/Buttons/IconButton.d.ts +1 -2
- package/dist/types/src/components/Buttons/IconButton.d.ts.map +1 -1
- package/dist/types/src/components/Buttons/IconButton.stories.d.ts +7 -6
- package/dist/types/src/components/Buttons/IconButton.stories.d.ts.map +1 -1
- package/dist/types/src/components/Buttons/Toggle.stories.d.ts.map +1 -1
- package/dist/types/src/components/Buttons/ToggleGroup.stories.d.ts +1 -4
- package/dist/types/src/components/Buttons/ToggleGroup.stories.d.ts.map +1 -1
- package/dist/types/src/components/Dialogs/AlertDialog.stories.d.ts +2 -2
- package/dist/types/src/components/Dialogs/AlertDialog.stories.d.ts.map +1 -1
- package/dist/types/src/components/Dialogs/Dialog.d.ts +1 -5
- package/dist/types/src/components/Dialogs/Dialog.d.ts.map +1 -1
- package/dist/types/src/components/Dialogs/Dialog.stories.d.ts +2 -2
- package/dist/types/src/components/Dialogs/Dialog.stories.d.ts.map +1 -1
- package/dist/types/src/components/Input/Input.d.ts +1 -1
- package/dist/types/src/components/Input/Input.d.ts.map +1 -1
- package/dist/types/src/components/Input/Input.stories.d.ts +33 -159
- package/dist/types/src/components/Input/Input.stories.d.ts.map +1 -1
- package/dist/types/src/components/Lists/Tree.stories.d.ts.map +1 -1
- package/dist/types/src/components/Lists/Treegrid.stories.d.ts +1 -1
- package/dist/types/src/components/Lists/Treegrid.stories.d.ts.map +1 -1
- package/dist/types/src/components/Main/Main.d.ts.map +1 -1
- package/dist/types/src/components/Main/Main.stories.d.ts.map +1 -1
- package/dist/types/src/components/Message/Message.stories.d.ts +2 -2
- package/dist/types/src/components/Message/Message.stories.d.ts.map +1 -1
- package/dist/types/src/components/Popover/Popover.d.ts +13 -5
- package/dist/types/src/components/Popover/Popover.d.ts.map +1 -1
- package/dist/types/src/components/Popover/Popover.stories.d.ts +5 -1
- package/dist/types/src/components/Popover/Popover.stories.d.ts.map +1 -1
- package/dist/types/src/components/ScrollArea/ScrollArea.stories.d.ts.map +1 -1
- package/dist/types/src/components/Toast/Toast.stories.d.ts +2 -2
- package/dist/types/src/components/Toast/Toast.stories.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 +0 -2
- package/dist/types/src/components/Tooltip/Tooltip.d.ts.map +1 -1
- package/dist/types/src/components/Tooltip/Tooltip.stories.d.ts +2 -3
- package/dist/types/src/components/Tooltip/Tooltip.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/{withVariants.d.ts → withSurfaceVariantsLayout.d.ts} +2 -3
- package/dist/types/src/testing/decorators/withSurfaceVariantsLayout.d.ts.map +1 -0
- package/package.json +24 -15
- package/src/components/Avatars/Avatar.stories.tsx +27 -27
- package/src/components/Avatars/Avatar.tsx +7 -8
- package/src/components/Avatars/AvatarGroup.stories.tsx +4 -5
- package/src/components/Breadcrumb/Breadcrumb.stories.tsx +2 -2
- package/src/components/Buttons/Button.stories.tsx +2 -2
- package/src/components/Buttons/IconButton.stories.tsx +9 -10
- package/src/components/Buttons/IconButton.tsx +4 -8
- package/src/components/Buttons/Toggle.stories.tsx +2 -2
- package/src/components/Buttons/ToggleGroup.stories.tsx +3 -7
- package/src/components/Dialogs/AlertDialog.stories.tsx +4 -11
- package/src/components/Dialogs/Dialog.stories.tsx +3 -3
- package/src/components/Dialogs/Dialog.tsx +6 -8
- package/src/components/Input/Input.stories.tsx +69 -58
- package/src/components/Input/Input.tsx +1 -0
- package/src/components/Lists/Tree.stories.tsx +2 -2
- package/src/components/Lists/Treegrid.stories.tsx +12 -12
- package/src/components/Main/Main.stories.tsx +2 -2
- package/src/components/Main/Main.tsx +1 -0
- package/src/components/Menus/ContextMenu.stories.tsx +2 -2
- package/src/components/Menus/DropdownMenu.stories.tsx +2 -2
- package/src/components/Message/Message.stories.tsx +3 -3
- package/src/components/Popover/Popover.stories.tsx +2 -2
- package/src/components/Popover/Popover.tsx +5 -4
- package/src/components/ScrollArea/ScrollArea.stories.tsx +4 -4
- package/src/components/Select/Select.stories.tsx +2 -2
- package/src/components/Toast/Toast.stories.tsx +15 -10
- package/src/components/Toolbar/Toolbar.stories.tsx +2 -2
- package/src/components/Tooltip/Tooltip.stories.tsx +3 -3
- package/src/components/Tooltip/Tooltip.tsx +1 -16
- package/src/playground/Controls.stories.tsx +2 -2
- package/src/playground/Typography.stories.tsx +2 -2
- package/src/testing/decorators/index.ts +1 -1
- package/src/testing/decorators/withSurfaceVariantsLayout.tsx +53 -0
- package/dist/types/src/testing/decorators/withVariants.d.ts.map +0 -1
- package/src/testing/decorators/withVariants.tsx +0 -45
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Toolbar.stories.d.ts","sourceRoot":"","sources":["../../../../../src/components/Toolbar/Toolbar.stories.tsx"],"names":[],"mappings":"AAIA,OAAO,aAAa,CAAC;AAGrB,OAAO,KAAK,MAAM,OAAO,CAAC;AAO1B,KAAK,qBAAqB,GAAG,EAAE,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"Toolbar.stories.d.ts","sourceRoot":"","sources":["../../../../../src/components/Toolbar/Toolbar.stories.tsx"],"names":[],"mappings":"AAIA,OAAO,aAAa,CAAC;AAGrB,OAAO,KAAK,MAAM,OAAO,CAAC;AAO1B,KAAK,qBAAqB,GAAG,EAAE,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;oBAEH,qBAAqB;;;;;;;;AAuDlD,wBAME;AAEF,eAAO,MAAM,OAAO;;CAEnB,CAAC"}
|
|
@@ -50,7 +50,6 @@ type PrimitiveButtonProps = ComponentPropsWithoutRef<typeof Primitive.button>;
|
|
|
50
50
|
type TooltipTriggerProps = PrimitiveButtonProps & Pick<TooltipProps, 'delayDuration'> & {
|
|
51
51
|
content?: string;
|
|
52
52
|
side?: TooltipSide;
|
|
53
|
-
suppressNextTooltip?: MutableRefObject<boolean>;
|
|
54
53
|
onInteract?: (event: SyntheticEvent) => void;
|
|
55
54
|
};
|
|
56
55
|
interface TooltipContentProps extends TooltipContentImplProps {
|
|
@@ -88,7 +87,6 @@ export declare const Tooltip: {
|
|
|
88
87
|
}, "ref"> & Pick<TooltipProps, "delayDuration"> & {
|
|
89
88
|
content?: string;
|
|
90
89
|
side?: TooltipSide;
|
|
91
|
-
suppressNextTooltip?: MutableRefObject<boolean>;
|
|
92
90
|
onInteract?: (event: SyntheticEvent) => void;
|
|
93
91
|
} & React.RefAttributes<HTMLButtonElement>>;
|
|
94
92
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Tooltip.d.ts","sourceRoot":"","sources":["../../../../../src/components/Tooltip/Tooltip.tsx"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAC;AACrD,OAAO,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AAErE,OAAO,KAAK,eAAe,MAAM,wBAAwB,CAAC;AAI1D,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AAEtD,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAG5D,OAAO,KAAK,EAAE,EACZ,KAAK,wBAAwB,EAC7B,KAAK,UAAU,EAEf,KAAK,cAAc,EAEnB,KAAK,gBAAgB,EACrB,KAAK,SAAS,EAMf,MAAM,OAAO,CAAC;AAIf,KAAK,kBAAkB,CAAC,CAAC,GAAG,EAAE,IAAI,CAAC,GAAG;IAAE,cAAc,CAAC,EAAE,KAAK,CAAA;CAAE,CAAC;AACjE,QAAA,MAA6B,kBAAkB,+CAAsD,CAAC;AAWtG,KAAK,mBAAmB,GAAG;IACzB,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,OAAO,CAAC;IACd,cAAc,EAAE,QAAQ,GAAG,cAAc,GAAG,cAAc,CAAC;IAC3D,OAAO,EAAE,qBAAqB,GAAG,IAAI,CAAC;IACtC,eAAe,CAAC,OAAO,EAAE,qBAAqB,GAAG,IAAI,GAAG,IAAI,CAAC;IAC7D,cAAc,IAAI,IAAI,CAAC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AAC;AAEjD,YAAY,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,WAAW,EAAE,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import '@dxos-theme';
|
|
2
2
|
import React from 'react';
|
|
3
|
-
type
|
|
3
|
+
type StoryProps = {
|
|
4
4
|
tooltips: {
|
|
5
5
|
label: string;
|
|
6
6
|
content: string;
|
|
@@ -18,11 +18,10 @@ declare const _default: {
|
|
|
18
18
|
}, "ref"> & Pick<import("@radix-ui/react-tooltip").TooltipProps, "delayDuration"> & {
|
|
19
19
|
content?: string;
|
|
20
20
|
side?: import("./Tooltip").TooltipSide;
|
|
21
|
-
suppressNextTooltip?: React.MutableRefObject<boolean>;
|
|
22
21
|
onInteract?: (event: React.SyntheticEvent) => void;
|
|
23
22
|
} & React.RefAttributes<HTMLButtonElement>>;
|
|
24
23
|
};
|
|
25
|
-
render: ({ tooltips, defaultOpen }:
|
|
24
|
+
render: ({ tooltips, defaultOpen }: StoryProps) => React.JSX.Element;
|
|
26
25
|
decorators: import("@storybook/react").Decorator[];
|
|
27
26
|
parameters: {
|
|
28
27
|
chromatic: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Tooltip.stories.d.ts","sourceRoot":"","sources":["../../../../../src/components/Tooltip/Tooltip.stories.tsx"],"names":[],"mappings":"AAIA,OAAO,aAAa,CAAC;AACrB,OAAO,KAAK,MAAM,OAAO,CAAC;AAQ1B,KAAK,
|
|
1
|
+
{"version":3,"file":"Tooltip.stories.d.ts","sourceRoot":"","sources":["../../../../../src/components/Tooltip/Tooltip.stories.tsx"],"names":[],"mappings":"AAIA,OAAO,aAAa,CAAC;AACrB,OAAO,KAAK,MAAM,OAAO,CAAC;AAQ1B,KAAK,UAAU,GAAG;IAChB,QAAQ,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;IAC/C,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB,CAAC;;;;;;;;;;;;;;;wCAE+C,UAAU;;;;;;;;AAY3D,wBAME;AAEF,eAAO,MAAM,OAAO;;;;;;;;;;;;CAYnB,CAAC;AAEF,eAAO,MAAM,WAAW;;;;;;;;;;;;;CAavB,CAAC;AAEF,eAAO,MAAM,UAAU;;;;;;;;;;;;;CActB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/testing/decorators/index.ts"],"names":[],"mappings":"AAIA,cAAc,aAAa,CAAC;AAC5B,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/testing/decorators/index.ts"],"names":[],"mappings":"AAIA,cAAc,aAAa,CAAC;AAC5B,cAAc,6BAA6B,CAAC"}
|
package/dist/types/src/testing/decorators/{withVariants.d.ts → withSurfaceVariantsLayout.d.ts}
RENAMED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import '@dxos-theme';
|
|
2
1
|
import { type Decorator } from '@storybook/react';
|
|
3
2
|
import { type Density, type Elevation } from '@dxos/react-ui-types';
|
|
4
3
|
type Config = {
|
|
@@ -8,6 +7,6 @@ type Config = {
|
|
|
8
7
|
}[];
|
|
9
8
|
densities?: Density[];
|
|
10
9
|
};
|
|
11
|
-
export declare const
|
|
10
|
+
export declare const withSurfaceVariantsLayout: ({ elevations, densities, }?: Config) => Decorator;
|
|
12
11
|
export {};
|
|
13
|
-
//# sourceMappingURL=
|
|
12
|
+
//# sourceMappingURL=withSurfaceVariantsLayout.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"withSurfaceVariantsLayout.d.ts","sourceRoot":"","sources":["../../../../../src/testing/decorators/withSurfaceVariantsLayout.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAIlD,OAAO,EAAE,KAAK,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAEpE,KAAK,MAAM,GAAG;IACZ,UAAU,CAAC,EAAE;QAAE,SAAS,EAAE,SAAS,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;IAC1D,SAAS,CAAC,EAAE,OAAO,EAAE,CAAC;CACvB,CAAC;AAyBF,eAAO,MAAM,yBAAyB,GAAI,6BAOvC,MAAW,KAAG,SAOhB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dxos/react-ui",
|
|
3
|
-
"version": "0.8.2-main.
|
|
3
|
+
"version": "0.8.2-main.4c6cf53",
|
|
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",
|
|
@@ -13,11 +13,20 @@
|
|
|
13
13
|
"types": "./dist/types/src/index.d.ts",
|
|
14
14
|
"browser": "./dist/lib/browser/index.mjs",
|
|
15
15
|
"node": "./dist/lib/node-esm/index.mjs"
|
|
16
|
+
},
|
|
17
|
+
"./testing": {
|
|
18
|
+
"types": "./dist/types/src/testing/index.d.ts",
|
|
19
|
+
"browser": "./dist/lib/browser/testing/index.mjs",
|
|
20
|
+
"node": "./dist/lib/node-esm/testing/index.mjs"
|
|
16
21
|
}
|
|
17
22
|
},
|
|
18
23
|
"types": "dist/types/src/index.d.ts",
|
|
19
24
|
"typesVersions": {
|
|
20
|
-
"*": {
|
|
25
|
+
"*": {
|
|
26
|
+
"testing": [
|
|
27
|
+
"./dist/types/src/testing/index.d.ts"
|
|
28
|
+
]
|
|
29
|
+
}
|
|
21
30
|
},
|
|
22
31
|
"files": [
|
|
23
32
|
"dist",
|
|
@@ -26,7 +35,7 @@
|
|
|
26
35
|
"dependencies": {
|
|
27
36
|
"@atlaskit/pragmatic-drag-and-drop-hitbox": "^1.0.3",
|
|
28
37
|
"@fluentui/react-tabster": "^9.24.2",
|
|
29
|
-
"@
|
|
38
|
+
"@preact-signals/safe-react": "^0.9.0",
|
|
30
39
|
"@radix-ui/primitive": "1.1.1",
|
|
31
40
|
"@radix-ui/react-alert-dialog": "1.1.6",
|
|
32
41
|
"@radix-ui/react-avatar": "1.1.3",
|
|
@@ -63,14 +72,14 @@
|
|
|
63
72
|
"keyborg": "^2.5.0",
|
|
64
73
|
"react-i18next": "^11.18.6",
|
|
65
74
|
"react-remove-scroll": "^2.6.0",
|
|
66
|
-
"@dxos/debug": "0.8.2-main.
|
|
67
|
-
"@dxos/lit-ui": "0.8.2-main.
|
|
68
|
-
"@dxos/
|
|
69
|
-
"@dxos/react-
|
|
70
|
-
"@dxos/react-
|
|
71
|
-
"@dxos/react-
|
|
72
|
-
"@dxos/
|
|
73
|
-
"@dxos/
|
|
75
|
+
"@dxos/debug": "0.8.2-main.4c6cf53",
|
|
76
|
+
"@dxos/lit-ui": "0.8.2-main.4c6cf53",
|
|
77
|
+
"@dxos/log": "0.8.2-main.4c6cf53",
|
|
78
|
+
"@dxos/react-hooks": "0.8.2-main.4c6cf53",
|
|
79
|
+
"@dxos/react-input": "0.8.2-main.4c6cf53",
|
|
80
|
+
"@dxos/react-list": "0.8.2-main.4c6cf53",
|
|
81
|
+
"@dxos/util": "0.8.2-main.4c6cf53",
|
|
82
|
+
"@dxos/react-ui-types": "0.8.2-main.4c6cf53"
|
|
74
83
|
},
|
|
75
84
|
"devDependencies": {
|
|
76
85
|
"@dnd-kit/core": "^6.0.5",
|
|
@@ -82,15 +91,15 @@
|
|
|
82
91
|
"react": "~18.2.0",
|
|
83
92
|
"react-dom": "~18.2.0",
|
|
84
93
|
"vite": "5.4.7",
|
|
85
|
-
"@dxos/react-ui-theme": "0.8.2-main.
|
|
86
|
-
"@dxos/random": "0.8.2-main.
|
|
87
|
-
"@dxos/util": "0.8.2-main.
|
|
94
|
+
"@dxos/react-ui-theme": "0.8.2-main.4c6cf53",
|
|
95
|
+
"@dxos/random": "0.8.2-main.4c6cf53",
|
|
96
|
+
"@dxos/util": "0.8.2-main.4c6cf53"
|
|
88
97
|
},
|
|
89
98
|
"peerDependencies": {
|
|
90
99
|
"@phosphor-icons/react": "^2.1.5",
|
|
91
100
|
"react": "~18.2.0",
|
|
92
101
|
"react-dom": "~18.2.0",
|
|
93
|
-
"@dxos/react-ui-theme": "0.8.2-main.
|
|
102
|
+
"@dxos/react-ui-theme": "0.8.2-main.4c6cf53"
|
|
94
103
|
},
|
|
95
104
|
"publishConfig": {
|
|
96
105
|
"access": "public"
|
|
@@ -12,7 +12,7 @@ import { hexToFallback } from '@dxos/util';
|
|
|
12
12
|
import { Avatar, type AvatarVariant, type AvatarStatus, type AvatarAnimation } from './Avatar';
|
|
13
13
|
import { withTheme } from '../../testing';
|
|
14
14
|
|
|
15
|
-
type
|
|
15
|
+
type StoryProps = {
|
|
16
16
|
id?: string;
|
|
17
17
|
imgSrc?: string;
|
|
18
18
|
fallbackText?: string;
|
|
@@ -25,7 +25,7 @@ type StorybookAvatarProps = {
|
|
|
25
25
|
hue?: HuePalette;
|
|
26
26
|
};
|
|
27
27
|
|
|
28
|
-
const
|
|
28
|
+
const DefaultStory = (props: PropsWithChildren<StoryProps>) => {
|
|
29
29
|
const {
|
|
30
30
|
id = '20970b563fc49b5bb194a6ffdff376031a3a11f9481360c071c3fed87874106b',
|
|
31
31
|
status,
|
|
@@ -58,7 +58,7 @@ const StorybookAvatar = (props: PropsWithChildren<StorybookAvatarProps>) => {
|
|
|
58
58
|
export default {
|
|
59
59
|
title: 'ui/react-ui-core/Avatar',
|
|
60
60
|
component: Avatar,
|
|
61
|
-
render:
|
|
61
|
+
render: DefaultStory,
|
|
62
62
|
decorators: [withTheme],
|
|
63
63
|
parameters: { chromatic: { disableSnapshot: false } },
|
|
64
64
|
};
|
|
@@ -68,9 +68,9 @@ const sampleImage =
|
|
|
68
68
|
|
|
69
69
|
const row = (size: Size) => (
|
|
70
70
|
<>
|
|
71
|
-
<
|
|
72
|
-
<
|
|
73
|
-
<
|
|
71
|
+
<DefaultStory size={size} status='inactive' description='Offline' />
|
|
72
|
+
<DefaultStory size={size} status='active' />
|
|
73
|
+
<DefaultStory size={size} status='active' imgSrc={sampleImage} />
|
|
74
74
|
</>
|
|
75
75
|
);
|
|
76
76
|
|
|
@@ -93,48 +93,48 @@ export const Default = () => (
|
|
|
93
93
|
|
|
94
94
|
export const Image = () => (
|
|
95
95
|
<div>
|
|
96
|
-
<
|
|
96
|
+
<DefaultStory variant='circle' imgSrc={sampleImage} />
|
|
97
97
|
</div>
|
|
98
98
|
);
|
|
99
99
|
|
|
100
100
|
export const Square = () => (
|
|
101
101
|
<div className='flex flex-row gap-4'>
|
|
102
|
-
<
|
|
103
|
-
<
|
|
104
|
-
<
|
|
105
|
-
<
|
|
102
|
+
<DefaultStory variant='square' status='inactive' description='Offline' />
|
|
103
|
+
<DefaultStory variant='square' status='active' />
|
|
104
|
+
<DefaultStory variant='square' status='error' />
|
|
105
|
+
<DefaultStory variant='square' status='warning' />
|
|
106
106
|
</div>
|
|
107
107
|
);
|
|
108
108
|
|
|
109
109
|
export const DefaultEmoji = () => (
|
|
110
110
|
<div className='flex flex-row gap-4'>
|
|
111
|
-
<
|
|
112
|
-
<
|
|
113
|
-
<
|
|
114
|
-
<
|
|
111
|
+
<DefaultStory fallbackText='🦄' status='active' animation='pulse' />
|
|
112
|
+
<DefaultStory fallbackText='🐒' status='warning' animation='pulse' />
|
|
113
|
+
<DefaultStory fallbackText='🪲' status='inactive' />
|
|
114
|
+
<DefaultStory fallbackText='🦁' />
|
|
115
115
|
</div>
|
|
116
116
|
);
|
|
117
117
|
|
|
118
|
-
export const SquareEmoji = () => <
|
|
118
|
+
export const SquareEmoji = () => <DefaultStory variant='square' fallbackText='🦄' />;
|
|
119
119
|
|
|
120
120
|
export const DefaultText = () => (
|
|
121
121
|
<div className='flex flex-row gap-4'>
|
|
122
|
-
<
|
|
123
|
-
<
|
|
124
|
-
<
|
|
125
|
-
<
|
|
126
|
-
<
|
|
127
|
-
<
|
|
122
|
+
<DefaultStory fallbackText='PT' />
|
|
123
|
+
<DefaultStory fallbackText='AP' />
|
|
124
|
+
<DefaultStory fallbackText='Z' />
|
|
125
|
+
<DefaultStory fallbackText='pt' />
|
|
126
|
+
<DefaultStory fallbackText='ap' />
|
|
127
|
+
<DefaultStory fallbackText='z' />
|
|
128
128
|
</div>
|
|
129
129
|
);
|
|
130
130
|
|
|
131
|
-
export const Error = () => <
|
|
131
|
+
export const Error = () => <DefaultStory status='error' description='Errored' />;
|
|
132
132
|
|
|
133
133
|
export const Pulse = () => (
|
|
134
134
|
<div className='flex flex-row gap-4'>
|
|
135
|
-
<
|
|
136
|
-
<
|
|
137
|
-
<
|
|
138
|
-
<
|
|
135
|
+
<DefaultStory description='Online' status='active' animation='pulse' />
|
|
136
|
+
<DefaultStory description='Offline' status='inactive' animation='pulse' />
|
|
137
|
+
<DefaultStory description='Error' status='error' animation='pulse' />
|
|
138
|
+
<DefaultStory description='Warning' status='warning' animation='pulse' />
|
|
139
139
|
</div>
|
|
140
140
|
);
|
|
@@ -4,13 +4,18 @@
|
|
|
4
4
|
|
|
5
5
|
import '@dxos/lit-ui/dx-avatar.pcss';
|
|
6
6
|
|
|
7
|
-
import { createComponent } from '@lit/react';
|
|
8
7
|
import { createContext } from '@radix-ui/react-context';
|
|
9
8
|
import { Primitive } from '@radix-ui/react-primitive';
|
|
10
9
|
import { Slot } from '@radix-ui/react-slot';
|
|
11
10
|
import React, { type ComponentProps, type ComponentPropsWithRef, forwardRef, type PropsWithChildren } from 'react';
|
|
12
11
|
|
|
13
|
-
import {
|
|
12
|
+
import {
|
|
13
|
+
type AvatarVariant,
|
|
14
|
+
type AvatarStatus,
|
|
15
|
+
type AvatarAnimation,
|
|
16
|
+
type DxAvatar as NaturalDxAvatar,
|
|
17
|
+
} from '@dxos/lit-ui';
|
|
18
|
+
import { DxAvatar } from '@dxos/lit-ui/react';
|
|
14
19
|
import { useId } from '@dxos/react-hooks';
|
|
15
20
|
import { mx } from '@dxos/react-ui-theme';
|
|
16
21
|
|
|
@@ -33,12 +38,6 @@ const AvatarRoot = ({ children, labelId: propsLabelId, descriptionId: propsDescr
|
|
|
33
38
|
return <AvatarProvider {...{ labelId, descriptionId }}>{children}</AvatarProvider>;
|
|
34
39
|
};
|
|
35
40
|
|
|
36
|
-
const DxAvatar = createComponent({
|
|
37
|
-
tagName: 'dx-avatar',
|
|
38
|
-
elementClass: NaturalDxAvatar,
|
|
39
|
-
react: React,
|
|
40
|
-
});
|
|
41
|
-
|
|
42
41
|
type AvatarContentProps = ThemedClassName<Omit<ComponentProps<typeof DxAvatar>, 'children'>>;
|
|
43
42
|
|
|
44
43
|
const AvatarContent = forwardRef<NaturalDxAvatar, AvatarContentProps>(
|
|
@@ -13,7 +13,7 @@ import { withTheme } from '../../testing';
|
|
|
13
13
|
|
|
14
14
|
const hues = ['lime', 'teal', 'purple', 'pink'];
|
|
15
15
|
|
|
16
|
-
const
|
|
16
|
+
const AvatarItem = ({ n }: { n: number }) => {
|
|
17
17
|
const emoji = toEmoji(n);
|
|
18
18
|
return (
|
|
19
19
|
<Avatar.Root>
|
|
@@ -22,12 +22,12 @@ const StorybookAvatarGroupItem = ({ n }: { n: number }) => {
|
|
|
22
22
|
);
|
|
23
23
|
};
|
|
24
24
|
|
|
25
|
-
const
|
|
25
|
+
const DefaultStory = () => {
|
|
26
26
|
const labelId = useId('sb-avatar-group');
|
|
27
27
|
return (
|
|
28
28
|
<div className='dx-avatar-group' aria-labelledby={labelId}>
|
|
29
29
|
{[0, 1, 2, 3].map((n) => (
|
|
30
|
-
<
|
|
30
|
+
<AvatarItem key={n} n={n} />
|
|
31
31
|
))}
|
|
32
32
|
<span className='sr-only' id={labelId}>
|
|
33
33
|
23
|
|
@@ -38,8 +38,7 @@ const StorybookAvatarGroup = () => {
|
|
|
38
38
|
|
|
39
39
|
export default {
|
|
40
40
|
title: 'ui/react-ui-core/AvatarGroup',
|
|
41
|
-
|
|
42
|
-
render: StorybookAvatarGroup,
|
|
41
|
+
render: DefaultStory,
|
|
43
42
|
decorators: [withTheme],
|
|
44
43
|
parameters: { chromatic: { disableSnapshot: false } },
|
|
45
44
|
};
|
|
@@ -10,7 +10,7 @@ import { Breadcrumb } from './Breadcrumb';
|
|
|
10
10
|
import { withTheme } from '../../testing';
|
|
11
11
|
import { Button } from '../Buttons';
|
|
12
12
|
|
|
13
|
-
const
|
|
13
|
+
const DefaultStory = () => {
|
|
14
14
|
return (
|
|
15
15
|
<Breadcrumb.Root aria-label='Breadcrumb'>
|
|
16
16
|
<Breadcrumb.List>
|
|
@@ -41,7 +41,7 @@ const StorybookBreadcrumb = () => {
|
|
|
41
41
|
export default {
|
|
42
42
|
title: 'ui/react-ui-core/Breadcrumb',
|
|
43
43
|
component: Breadcrumb,
|
|
44
|
-
render:
|
|
44
|
+
render: DefaultStory,
|
|
45
45
|
decorators: [withTheme],
|
|
46
46
|
parameters: { chromatic: { disableSnapshot: false } },
|
|
47
47
|
};
|
|
@@ -9,7 +9,7 @@ import { type StoryObj, type Meta } from '@storybook/react';
|
|
|
9
9
|
import React from 'react';
|
|
10
10
|
|
|
11
11
|
import { Button, ButtonGroup, type ButtonProps } from './Button';
|
|
12
|
-
import {
|
|
12
|
+
import { withSurfaceVariantsLayout, withTheme } from '../../testing';
|
|
13
13
|
|
|
14
14
|
const DefaultStory = ({ children, ...args }: Omit<ButtonProps, 'ref'>) => {
|
|
15
15
|
return (
|
|
@@ -36,7 +36,7 @@ const meta: Meta<typeof Button> = {
|
|
|
36
36
|
title: 'ui/react-ui-core/Button',
|
|
37
37
|
component: Button,
|
|
38
38
|
render: DefaultStory,
|
|
39
|
-
decorators: [
|
|
39
|
+
decorators: [withSurfaceVariantsLayout(), withTheme],
|
|
40
40
|
parameters: { chromatic: { disableSnapshot: false } },
|
|
41
41
|
};
|
|
42
42
|
|
|
@@ -6,22 +6,18 @@ import '@dxos-theme';
|
|
|
6
6
|
|
|
7
7
|
import React from 'react';
|
|
8
8
|
|
|
9
|
-
import { IconButton } from './IconButton';
|
|
9
|
+
import { IconButton, type IconButtonProps } from './IconButton';
|
|
10
10
|
import { withTheme } from '../../testing';
|
|
11
11
|
import { Tooltip } from '../Tooltip';
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
iconOnly?: boolean;
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
const StorybookIconButton = (props: StorybookIconButtonProps) => {
|
|
13
|
+
const DefaultStory = (props: IconButtonProps) => {
|
|
18
14
|
return (
|
|
19
15
|
<Tooltip.Provider>
|
|
20
16
|
<div className='mbe-4'>
|
|
21
|
-
<IconButton
|
|
17
|
+
<IconButton {...props} />
|
|
22
18
|
</div>
|
|
23
19
|
<div className='mbe-4'>
|
|
24
|
-
<IconButton iconOnly
|
|
20
|
+
<IconButton iconOnly {...props} />
|
|
25
21
|
</div>
|
|
26
22
|
</Tooltip.Provider>
|
|
27
23
|
);
|
|
@@ -30,11 +26,14 @@ const StorybookIconButton = (props: StorybookIconButtonProps) => {
|
|
|
30
26
|
export default {
|
|
31
27
|
title: 'ui/react-ui-core/IconButton',
|
|
32
28
|
component: IconButton,
|
|
33
|
-
render:
|
|
29
|
+
render: DefaultStory,
|
|
34
30
|
decorators: [withTheme],
|
|
35
31
|
parameters: { chromatic: { disableSnapshot: false } },
|
|
36
32
|
};
|
|
37
33
|
|
|
38
34
|
export const Default = {
|
|
39
|
-
args: {
|
|
35
|
+
args: {
|
|
36
|
+
label: 'Bold',
|
|
37
|
+
icon: 'ph--text-b--regular',
|
|
38
|
+
},
|
|
40
39
|
};
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// Copyright 2024 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import React, { forwardRef
|
|
5
|
+
import React, { forwardRef } from 'react';
|
|
6
6
|
|
|
7
7
|
import { Button, type ButtonProps } from './Button';
|
|
8
8
|
import { useThemeContext } from '../../hooks';
|
|
@@ -19,16 +19,15 @@ type IconButtonProps = Omit<ButtonProps, 'children'> &
|
|
|
19
19
|
iconClassNames?: ThemedClassName<any>['classNames'];
|
|
20
20
|
tooltipPortal?: boolean;
|
|
21
21
|
tooltipSide?: TooltipSide;
|
|
22
|
-
suppressNextTooltip?: MutableRefObject<boolean>;
|
|
23
22
|
};
|
|
24
23
|
|
|
25
24
|
const IconOnlyButton = forwardRef<HTMLButtonElement, IconButtonProps>(
|
|
26
|
-
({ noTooltip, tooltipPortal = true, tooltipSide,
|
|
25
|
+
({ noTooltip, tooltipPortal = true, tooltipSide, ...props }, forwardedRef) => {
|
|
27
26
|
if (noTooltip) {
|
|
28
27
|
return <LabelledIconButton {...props} ref={forwardedRef} />;
|
|
29
28
|
}
|
|
30
29
|
return (
|
|
31
|
-
<Tooltip.Trigger asChild content={props.label} side={tooltipSide}
|
|
30
|
+
<Tooltip.Trigger asChild content={props.label} side={tooltipSide}>
|
|
32
31
|
<LabelledIconButton {...props} ref={forwardedRef} />
|
|
33
32
|
</Tooltip.Trigger>
|
|
34
33
|
);
|
|
@@ -36,10 +35,7 @@ const IconOnlyButton = forwardRef<HTMLButtonElement, IconButtonProps>(
|
|
|
36
35
|
);
|
|
37
36
|
|
|
38
37
|
const LabelledIconButton = forwardRef<HTMLButtonElement, IconButtonProps>(
|
|
39
|
-
(
|
|
40
|
-
{ icon, size, iconOnly, label, classNames, iconClassNames, caretDown, suppressNextTooltip, ...props },
|
|
41
|
-
forwardedRef,
|
|
42
|
-
) => {
|
|
38
|
+
({ icon, size, iconOnly, label, classNames, iconClassNames, caretDown, ...props }, forwardedRef) => {
|
|
43
39
|
const { tx } = useThemeContext();
|
|
44
40
|
return (
|
|
45
41
|
<Button {...props} classNames={tx('iconButton.root', 'iconButton', {}, classNames)} ref={forwardedRef}>
|
|
@@ -12,7 +12,7 @@ import { withTheme } from '../../testing';
|
|
|
12
12
|
|
|
13
13
|
type StorybookToggleProps = {};
|
|
14
14
|
|
|
15
|
-
const
|
|
15
|
+
const DefaultStory = (props: StorybookToggleProps) => {
|
|
16
16
|
return (
|
|
17
17
|
<Toggle {...props}>
|
|
18
18
|
<TextB />
|
|
@@ -23,7 +23,7 @@ const StorybookToggle = (props: StorybookToggleProps) => {
|
|
|
23
23
|
export default {
|
|
24
24
|
title: 'ui/react-ui-core/Toggle',
|
|
25
25
|
component: Toggle,
|
|
26
|
-
render:
|
|
26
|
+
render: DefaultStory,
|
|
27
27
|
decorators: [withTheme],
|
|
28
28
|
parameters: { chromatic: { disableSnapshot: false } },
|
|
29
29
|
};
|
|
@@ -10,12 +10,8 @@ import React from 'react';
|
|
|
10
10
|
import { ToggleGroup, ToggleGroupItem, type ToggleGroupProps } from './ToggleGroup';
|
|
11
11
|
import { withTheme } from '../../testing';
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
// TODO(burdon): ToggleGroup.Item.
|
|
18
|
-
const StorybookToggleGroup = (props: StorybookToggleGroupProps) => {
|
|
13
|
+
// TODO(burdon): Create Radix-style Root, Item, etc?
|
|
14
|
+
const DefaultStory = (props: ToggleGroupProps) => {
|
|
19
15
|
return (
|
|
20
16
|
<ToggleGroup {...props}>
|
|
21
17
|
<ToggleGroupItem value='textb'>
|
|
@@ -31,7 +27,7 @@ const StorybookToggleGroup = (props: StorybookToggleGroupProps) => {
|
|
|
31
27
|
export default {
|
|
32
28
|
title: 'ui/react-ui-core/ToggleGroup',
|
|
33
29
|
component: ToggleGroup,
|
|
34
|
-
render:
|
|
30
|
+
render: DefaultStory,
|
|
35
31
|
decorators: [withTheme],
|
|
36
32
|
parameters: { chromatic: { disableSnapshot: false } },
|
|
37
33
|
};
|
|
@@ -11,23 +11,16 @@ import { withTheme } from '../../testing';
|
|
|
11
11
|
import { Button } from '../Buttons';
|
|
12
12
|
import { Toolbar } from '../Toolbar';
|
|
13
13
|
|
|
14
|
-
type
|
|
14
|
+
type StoryProps = Partial<{
|
|
15
15
|
title: string;
|
|
16
16
|
description: string;
|
|
17
17
|
body: string;
|
|
18
|
-
cancelTrigger: string;
|
|
18
|
+
cancelTrigger: string;
|
|
19
19
|
actionTrigger: string;
|
|
20
20
|
openTrigger: string;
|
|
21
21
|
}>;
|
|
22
22
|
|
|
23
|
-
const
|
|
24
|
-
title,
|
|
25
|
-
openTrigger,
|
|
26
|
-
description,
|
|
27
|
-
body,
|
|
28
|
-
cancelTrigger,
|
|
29
|
-
actionTrigger,
|
|
30
|
-
}: StorybookAlertDialogProps) => {
|
|
23
|
+
const DefaultStory = ({ title, openTrigger, description, body, cancelTrigger, actionTrigger }: StoryProps) => {
|
|
31
24
|
return (
|
|
32
25
|
<AlertDialog.Root defaultOpen>
|
|
33
26
|
<AlertDialog.Trigger asChild>
|
|
@@ -56,7 +49,7 @@ const StorybookAlertDialog = ({
|
|
|
56
49
|
export default {
|
|
57
50
|
title: 'ui/react-ui-core/AlertDialog',
|
|
58
51
|
component: AlertDialog,
|
|
59
|
-
render:
|
|
52
|
+
render: DefaultStory,
|
|
60
53
|
decorators: [withTheme],
|
|
61
54
|
parameters: { chromatic: { disableSnapshot: false } },
|
|
62
55
|
};
|
|
@@ -10,7 +10,7 @@ import { Dialog } from './Dialog';
|
|
|
10
10
|
import { withTheme } from '../../testing';
|
|
11
11
|
import { Button } from '../Buttons';
|
|
12
12
|
|
|
13
|
-
type
|
|
13
|
+
type StoryProps = Partial<{
|
|
14
14
|
title: string;
|
|
15
15
|
description: string;
|
|
16
16
|
body: string;
|
|
@@ -19,7 +19,7 @@ type StorybookDialogProps = Partial<{
|
|
|
19
19
|
blockAlign: 'center' | 'start';
|
|
20
20
|
}>;
|
|
21
21
|
|
|
22
|
-
const
|
|
22
|
+
const DefaultStory = ({ title, openTrigger, description, body, closeTrigger, blockAlign }: StoryProps) => {
|
|
23
23
|
return (
|
|
24
24
|
<Dialog.Root defaultOpen>
|
|
25
25
|
<Dialog.Trigger asChild>
|
|
@@ -42,7 +42,7 @@ const StorybookDialog = ({ title, openTrigger, description, body, closeTrigger,
|
|
|
42
42
|
export default {
|
|
43
43
|
title: 'ui/react-ui-core/Dialog',
|
|
44
44
|
component: Dialog,
|
|
45
|
-
render:
|
|
45
|
+
render: DefaultStory,
|
|
46
46
|
decorators: [withTheme],
|
|
47
47
|
parameters: { chromatic: { disableSnapshot: false } },
|
|
48
48
|
};
|
|
@@ -78,7 +78,7 @@ type DialogCloseProps = DialogClosePrimitiveProps;
|
|
|
78
78
|
|
|
79
79
|
const DialogClose: FunctionComponent<DialogCloseProps> = DialogClosePrimitive;
|
|
80
80
|
|
|
81
|
-
type OverlayLayoutContextValue = {
|
|
81
|
+
type OverlayLayoutContextValue = { inOverlayLayout?: boolean };
|
|
82
82
|
const DIALOG_OVERLAY_NAME = 'DialogOverlay';
|
|
83
83
|
const DIALOG_CONTENT_NAME = 'DialogContent';
|
|
84
84
|
const [OverlayLayoutProvider, useOverlayLayoutContext] = createContext<OverlayLayoutContextValue>(
|
|
@@ -86,10 +86,7 @@ const [OverlayLayoutProvider, useOverlayLayoutContext] = createContext<OverlayLa
|
|
|
86
86
|
{},
|
|
87
87
|
);
|
|
88
88
|
|
|
89
|
-
type DialogOverlayProps = ThemedClassName<
|
|
90
|
-
DialogOverlayPrimitiveProps &
|
|
91
|
-
Pick<OverlayLayoutContextValue, 'descriptionId'> & { blockAlign?: 'center' | 'start' | 'end' }
|
|
92
|
-
>;
|
|
89
|
+
type DialogOverlayProps = ThemedClassName<DialogOverlayPrimitiveProps & { blockAlign?: 'center' | 'start' | 'end' }>;
|
|
93
90
|
|
|
94
91
|
const DialogOverlay: ForwardRefExoticComponent<DialogOverlayProps> = forwardRef<HTMLDivElement, DialogOverlayProps>(
|
|
95
92
|
({ classNames, children, blockAlign, ...props }, forwardedRef) => {
|
|
@@ -115,12 +112,13 @@ type DialogContentProps = ThemedClassName<DialogContentPrimitiveProps> & { inOve
|
|
|
115
112
|
const DialogContent: ForwardRefExoticComponent<DialogContentProps> = forwardRef<HTMLDivElement, DialogContentProps>(
|
|
116
113
|
({ classNames, children, inOverlayLayout: propsInOverlayLayout, ...props }, forwardedRef) => {
|
|
117
114
|
const { tx } = useThemeContext();
|
|
118
|
-
const { inOverlayLayout
|
|
115
|
+
const { inOverlayLayout } = useOverlayLayoutContext(DIALOG_CONTENT_NAME);
|
|
119
116
|
|
|
120
117
|
return (
|
|
121
118
|
<DialogContentPrimitive
|
|
122
|
-
// NOTE: Radix warning unless set.
|
|
123
|
-
|
|
119
|
+
// NOTE: Radix warning unless set to undefined.
|
|
120
|
+
// https://www.radix-ui.com/primitives/docs/components/dialog#description
|
|
121
|
+
aria-describedby={undefined}
|
|
124
122
|
{...props}
|
|
125
123
|
className={tx(
|
|
126
124
|
'dialog.content',
|