@dxos/react-ui 0.8.3 → 0.8.4-main.28f8d3d
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-WXW6KSRL.mjs → chunk-BKNGMGOK.mjs} +150 -153
- package/dist/lib/browser/chunk-BKNGMGOK.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +2 -3
- package/dist/lib/browser/index.mjs.map +2 -2
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/testing/index.mjs +6 -7
- package/dist/lib/browser/testing/index.mjs.map +3 -3
- package/dist/lib/node-esm/{chunk-EQ7EG74H.mjs → chunk-D2HZS6F4.mjs} +150 -153
- package/dist/lib/node-esm/chunk-D2HZS6F4.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +2 -3
- package/dist/lib/node-esm/index.mjs.map +2 -2
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/testing/index.mjs +6 -7
- 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 +1 -1
- package/dist/types/src/components/Avatars/Avatar.stories.d.ts.map +1 -1
- 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.map +1 -1
- package/dist/types/src/components/Buttons/Button.d.ts.map +1 -1
- package/dist/types/src/components/Buttons/Button.stories.d.ts +1 -1
- package/dist/types/src/components/Buttons/Button.stories.d.ts.map +1 -1
- package/dist/types/src/components/Buttons/IconButton.d.ts +1 -1
- package/dist/types/src/components/Buttons/IconButton.d.ts.map +1 -1
- 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.d.ts +1 -1
- package/dist/types/src/components/Buttons/ToggleGroup.d.ts.map +1 -1
- 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 +4 -5
- package/dist/types/src/components/Clipboard/CopyButton.d.ts.map +1 -1
- package/dist/types/src/components/Clipboard/index.d.ts +2 -3
- package/dist/types/src/components/Clipboard/index.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.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.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 +2 -2
- package/dist/types/src/components/Input/Input.stories.d.ts.map +1 -1
- 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.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.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.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.map +1 -1
- package/dist/types/src/components/Menus/ContextMenu.stories.d.ts.map +1 -1
- package/dist/types/src/components/Menus/DropdownMenu.d.ts +1 -1
- package/dist/types/src/components/Menus/DropdownMenu.d.ts.map +1 -1
- 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.map +1 -1
- package/dist/types/src/components/Popover/Popover.d.ts +2 -2
- package/dist/types/src/components/Popover/Popover.d.ts.map +1 -1
- 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.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 +1 -1
- package/dist/types/src/components/Select/Select.stories.d.ts.map +1 -1
- package/dist/types/src/components/Status/Status.stories.d.ts.map +1 -1
- package/dist/types/src/components/Tag/Tag.stories.d.ts.map +1 -1
- package/dist/types/src/components/ThemeProvider/ThemeProvider.d.ts +2 -2
- 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/ThemeProvider/index.d.ts +1 -1
- package/dist/types/src/components/ThemeProvider/index.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.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.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.map +1 -1
- package/dist/types/src/index.d.ts +2 -2
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/playground/Controls.stories.d.ts.map +1 -1
- package/dist/types/src/playground/Custom.stories.d.ts +1 -1
- package/dist/types/src/playground/Custom.stories.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 -1
- package/dist/types/src/util/index.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +16 -14
- package/src/components/Avatars/Avatar.stories.tsx +2 -1
- package/src/components/Avatars/Avatar.tsx +3 -3
- package/src/components/Avatars/AvatarGroup.stories.tsx +2 -1
- package/src/components/Breadcrumb/Breadcrumb.stories.tsx +2 -1
- package/src/components/Breadcrumb/Breadcrumb.tsx +3 -3
- package/src/components/Buttons/Button.stories.tsx +6 -5
- package/src/components/Buttons/Button.tsx +1 -0
- package/src/components/Buttons/IconButton.stories.tsx +2 -1
- package/src/components/Buttons/IconButton.tsx +3 -2
- package/src/components/Buttons/Toggle.stories.tsx +4 -3
- package/src/components/Buttons/ToggleGroup.stories.tsx +5 -4
- package/src/components/Buttons/ToggleGroup.tsx +3 -3
- package/src/components/Clipboard/ClipboardProvider.tsx +1 -1
- package/src/components/Clipboard/CopyButton.tsx +13 -14
- package/src/components/DensityProvider/DensityProvider.tsx +1 -1
- package/src/components/Dialogs/AlertDialog.stories.tsx +2 -1
- package/src/components/Dialogs/AlertDialog.tsx +13 -13
- package/src/components/Dialogs/Dialog.stories.tsx +2 -1
- package/src/components/Dialogs/Dialog.tsx +13 -13
- package/src/components/ElevationProvider/ElevationProvider.tsx +1 -1
- package/src/components/Input/Input.stories.tsx +5 -4
- package/src/components/Input/Input.tsx +13 -13
- package/src/components/Link/Link.stories.tsx +2 -1
- package/src/components/Lists/List.stories.tsx +9 -8
- package/src/components/Lists/List.tsx +14 -18
- package/src/components/Lists/Tree.stories.tsx +2 -1
- package/src/components/Lists/Tree.tsx +4 -3
- package/src/components/Lists/TreeDropIndicator.tsx +1 -1
- package/src/components/Lists/Treegrid.stories.tsx +2 -1
- package/src/components/Lists/Treegrid.tsx +2 -2
- package/src/components/Main/Main.stories.tsx +2 -1
- package/src/components/Main/Main.tsx +7 -6
- package/src/components/Menus/ContextMenu.stories.tsx +2 -1
- package/src/components/Menus/DropdownMenu.stories.tsx +2 -1
- package/src/components/Menus/DropdownMenu.tsx +8 -8
- package/src/components/Message/Message.stories.tsx +2 -1
- package/src/components/Message/Message.tsx +1 -1
- package/src/components/Popover/Popover.stories.tsx +2 -1
- package/src/components/Popover/Popover.tsx +8 -8
- package/src/components/ScrollArea/ScrollArea.stories.tsx +2 -1
- package/src/components/ScrollArea/ScrollArea.tsx +4 -4
- package/src/components/Select/Select.stories.tsx +3 -2
- package/src/components/Select/Select.tsx +3 -4
- package/src/components/Status/Status.stories.tsx +2 -1
- package/src/components/Tag/Tag.stories.tsx +2 -1
- package/src/components/ThemeProvider/ThemeProvider.tsx +4 -4
- package/src/components/ThemeProvider/TranslationsProvider.tsx +4 -4
- package/src/components/ThemeProvider/index.ts +3 -1
- package/src/components/Toast/Toast.stories.tsx +2 -1
- package/src/components/Toast/Toast.tsx +9 -9
- package/src/components/Toolbar/Toolbar.stories.tsx +10 -9
- package/src/components/Toolbar/Toolbar.tsx +2 -2
- package/src/components/Tooltip/Tooltip.stories.tsx +2 -1
- package/src/components/Tooltip/Tooltip.tsx +3 -3
- package/src/hooks/useSafeCollisionPadding.ts +1 -1
- package/src/index.ts +2 -2
- package/src/playground/Controls.stories.tsx +9 -10
- package/src/playground/Custom.stories.tsx +2 -2
- package/src/testing/decorators/withSurfaceVariantsLayout.tsx +1 -1
- package/src/testing/decorators/withTheme.ts +8 -5
- package/src/util/index.ts +1 -1
- package/README.yml +0 -1
- package/dist/lib/browser/chunk-WXW6KSRL.mjs.map +0 -7
- package/dist/lib/node/chunk-3E3QKWX4.cjs +0 -4363
- package/dist/lib/node/chunk-3E3QKWX4.cjs.map +0 -7
- package/dist/lib/node/index.cjs +0 -175
- package/dist/lib/node/index.cjs.map +0 -7
- package/dist/lib/node/meta.json +0 -1
- package/dist/lib/node/testing/index.cjs +0 -114
- package/dist/lib/node/testing/index.cjs.map +0 -7
- package/dist/lib/node-esm/chunk-EQ7EG74H.mjs.map +0 -7
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dxos/react-ui",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.4-main.28f8d3d",
|
|
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"
|
|
@@ -35,6 +37,7 @@
|
|
|
35
37
|
"dependencies": {
|
|
36
38
|
"@atlaskit/pragmatic-drag-and-drop-hitbox": "^1.0.3",
|
|
37
39
|
"@fluentui/react-tabster": "^9.24.2",
|
|
40
|
+
"@phosphor-icons/react": "^2.1.5",
|
|
38
41
|
"@preact-signals/safe-react": "^0.9.0",
|
|
39
42
|
"@radix-ui/primitive": "1.1.1",
|
|
40
43
|
"@radix-ui/react-alert-dialog": "1.1.6",
|
|
@@ -72,34 +75,33 @@
|
|
|
72
75
|
"keyborg": "^2.5.0",
|
|
73
76
|
"react-i18next": "^11.18.6",
|
|
74
77
|
"react-remove-scroll": "^2.6.0",
|
|
75
|
-
"@dxos/debug": "0.8.
|
|
76
|
-
"@dxos/
|
|
77
|
-
"@dxos/
|
|
78
|
-
"@dxos/
|
|
79
|
-
"@dxos/react-
|
|
80
|
-
"@dxos/react-ui-types": "0.8.
|
|
81
|
-
"@dxos/
|
|
82
|
-
"@dxos/
|
|
78
|
+
"@dxos/debug": "0.8.4-main.28f8d3d",
|
|
79
|
+
"@dxos/log": "0.8.4-main.28f8d3d",
|
|
80
|
+
"@dxos/react-hooks": "0.8.4-main.28f8d3d",
|
|
81
|
+
"@dxos/lit-ui": "0.8.4-main.28f8d3d",
|
|
82
|
+
"@dxos/react-input": "0.8.4-main.28f8d3d",
|
|
83
|
+
"@dxos/react-ui-types": "0.8.4-main.28f8d3d",
|
|
84
|
+
"@dxos/util": "0.8.4-main.28f8d3d",
|
|
85
|
+
"@dxos/react-list": "0.8.4-main.28f8d3d"
|
|
83
86
|
},
|
|
84
87
|
"devDependencies": {
|
|
85
88
|
"@dnd-kit/core": "^6.0.5",
|
|
86
89
|
"@dnd-kit/sortable": "^7.0.1",
|
|
87
90
|
"@dnd-kit/utilities": "^3.2.0",
|
|
88
|
-
"@phosphor-icons/react": "^2.1.5",
|
|
89
91
|
"@types/react": "~18.2.0",
|
|
90
92
|
"@types/react-dom": "~18.2.0",
|
|
91
93
|
"react": "~18.2.0",
|
|
92
94
|
"react-dom": "~18.2.0",
|
|
93
95
|
"vite": "5.4.7",
|
|
94
|
-
"@dxos/random": "0.8.
|
|
95
|
-
"@dxos/util": "0.8.
|
|
96
|
-
"@dxos/react-ui-theme": "0.8.
|
|
96
|
+
"@dxos/random": "0.8.4-main.28f8d3d",
|
|
97
|
+
"@dxos/util": "0.8.4-main.28f8d3d",
|
|
98
|
+
"@dxos/react-ui-theme": "0.8.4-main.28f8d3d"
|
|
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.
|
|
104
|
+
"@dxos/react-ui-theme": "0.8.4-main.28f8d3d"
|
|
103
105
|
},
|
|
104
106
|
"publishConfig": {
|
|
105
107
|
"access": "public"
|
|
@@ -9,9 +9,10 @@ import { type HuePalette } from '@dxos/react-ui-theme';
|
|
|
9
9
|
import { type Size } from '@dxos/react-ui-types';
|
|
10
10
|
import { hexToFallback } from '@dxos/util';
|
|
11
11
|
|
|
12
|
-
import { Avatar, type AvatarVariant, type AvatarStatus, type AvatarAnimation } from './Avatar';
|
|
13
12
|
import { withTheme } from '../../testing';
|
|
14
13
|
|
|
14
|
+
import { Avatar, type AvatarAnimation, type AvatarStatus, type AvatarVariant } from './Avatar';
|
|
15
|
+
|
|
15
16
|
type StoryProps = {
|
|
16
17
|
id?: string;
|
|
17
18
|
imgSrc?: string;
|
|
@@ -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';
|
|
@@ -8,9 +8,10 @@ import React from 'react';
|
|
|
8
8
|
import { useId } from '@dxos/react-hooks';
|
|
9
9
|
import { toEmoji } from '@dxos/util';
|
|
10
10
|
|
|
11
|
-
import { Avatar } from './Avatar';
|
|
12
11
|
import { withTheme } from '../../testing';
|
|
13
12
|
|
|
13
|
+
import { Avatar } from './Avatar';
|
|
14
|
+
|
|
14
15
|
const hues = ['lime', 'teal', 'purple', 'pink'];
|
|
15
16
|
|
|
16
17
|
const AvatarItem = ({ n }: { n: number }) => {
|
|
@@ -6,10 +6,11 @@ import '@dxos-theme';
|
|
|
6
6
|
|
|
7
7
|
import React from 'react';
|
|
8
8
|
|
|
9
|
-
import { Breadcrumb } from './Breadcrumb';
|
|
10
9
|
import { withTheme } from '../../testing';
|
|
11
10
|
import { Button } from '../Buttons';
|
|
12
11
|
|
|
12
|
+
import { Breadcrumb } from './Breadcrumb';
|
|
13
|
+
|
|
13
14
|
const DefaultStory = () => {
|
|
14
15
|
return (
|
|
15
16
|
<Breadcrumb.Root aria-label='Breadcrumb'>
|
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
// Copyright 2023 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import { Dot } from '@phosphor-icons/react';
|
|
6
5
|
import { Primitive } from '@radix-ui/react-primitive';
|
|
7
6
|
import { Slot } from '@radix-ui/react-slot';
|
|
8
|
-
import React, { type
|
|
7
|
+
import React, { type ComponentPropsWithRef, type ComponentPropsWithoutRef, forwardRef } from 'react';
|
|
9
8
|
|
|
10
9
|
import { useThemeContext } from '../../hooks';
|
|
11
10
|
import { type ThemedClassName } from '../../util';
|
|
11
|
+
import { Icon } from '../Icon';
|
|
12
12
|
import { Link, type LinkProps } from '../Link';
|
|
13
13
|
|
|
14
14
|
type BreadcrumbRootProps = ThemedClassName<ComponentPropsWithRef<typeof Primitive.div>> & {
|
|
@@ -100,7 +100,7 @@ const BreadcrumbSeparator = ({ children, classNames, ...props }: BreadcrumbSepar
|
|
|
100
100
|
{...props}
|
|
101
101
|
className={tx('breadcrumb.separator', 'breadcrumb__separator', {}, classNames)}
|
|
102
102
|
>
|
|
103
|
-
{children ?? <
|
|
103
|
+
{children ?? <Icon icon='ph--dot--bold' />}
|
|
104
104
|
</Primitive.span>
|
|
105
105
|
);
|
|
106
106
|
};
|
|
@@ -4,12 +4,13 @@
|
|
|
4
4
|
|
|
5
5
|
import '@dxos-theme';
|
|
6
6
|
|
|
7
|
-
import {
|
|
8
|
-
import { type StoryObj, type Meta } from '@storybook/react';
|
|
7
|
+
import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
9
8
|
import React from 'react';
|
|
10
9
|
|
|
11
|
-
import { Button, ButtonGroup, type ButtonProps } from './Button';
|
|
12
10
|
import { withSurfaceVariantsLayout, withTheme } from '../../testing';
|
|
11
|
+
import { Icon } from '../Icon';
|
|
12
|
+
|
|
13
|
+
import { Button, ButtonGroup, type ButtonProps } from './Button';
|
|
13
14
|
|
|
14
15
|
const DefaultStory = ({ children, ...args }: Omit<ButtonProps, 'ref'>) => {
|
|
15
16
|
return (
|
|
@@ -21,10 +22,10 @@ const DefaultStory = ({ children, ...args }: Omit<ButtonProps, 'ref'>) => {
|
|
|
21
22
|
{(args.variant === 'default' || args.variant === 'primary') && (
|
|
22
23
|
<ButtonGroup>
|
|
23
24
|
<Button {...args}>
|
|
24
|
-
<
|
|
25
|
+
<Icon icon='ph--caret-left--regular' />
|
|
25
26
|
</Button>
|
|
26
27
|
<Button {...args}>
|
|
27
|
-
<
|
|
28
|
+
<Icon icon='ph--caret-right--regular' />
|
|
28
29
|
</Button>
|
|
29
30
|
</ButtonGroup>
|
|
30
31
|
)}
|
|
@@ -23,6 +23,7 @@ type ButtonGroupContextValue = { inGroup?: boolean };
|
|
|
23
23
|
|
|
24
24
|
const BUTTON_GROUP_NAME = 'ButtonGroup';
|
|
25
25
|
const BUTTON_NAME = 'Button';
|
|
26
|
+
|
|
26
27
|
const [ButtonGroupProvider, useButtonGroupContext] = createContext<ButtonGroupContextValue>(BUTTON_GROUP_NAME, {
|
|
27
28
|
inGroup: false,
|
|
28
29
|
});
|
|
@@ -6,10 +6,11 @@ import '@dxos-theme';
|
|
|
6
6
|
|
|
7
7
|
import React from 'react';
|
|
8
8
|
|
|
9
|
-
import { IconButton, type IconButtonProps } from './IconButton';
|
|
10
9
|
import { withTheme } from '../../testing';
|
|
11
10
|
import { Tooltip } from '../Tooltip';
|
|
12
11
|
|
|
12
|
+
import { IconButton, type IconButtonProps } from './IconButton';
|
|
13
|
+
|
|
13
14
|
const DefaultStory = (props: IconButtonProps) => {
|
|
14
15
|
return (
|
|
15
16
|
<Tooltip.Provider>
|
|
@@ -4,12 +4,13 @@
|
|
|
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
15
|
Pick<IconProps, 'icon' | 'size'> & {
|
|
15
16
|
label: string;
|
|
@@ -38,7 +39,7 @@ const LabelledIconButton = forwardRef<HTMLButtonElement, IconButtonProps>(
|
|
|
38
39
|
({ icon, size, iconOnly, label, classNames, iconClassNames, caretDown, ...props }, forwardedRef) => {
|
|
39
40
|
const { tx } = useThemeContext();
|
|
40
41
|
return (
|
|
41
|
-
<Button {...props} classNames={tx('iconButton.root', 'iconButton', {}, classNames)} ref={forwardedRef}>
|
|
42
|
+
<Button {...props} classNames={tx('iconButton.root', 'iconButton', { iconOnly }, classNames)} ref={forwardedRef}>
|
|
42
43
|
<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' />}
|
|
@@ -4,18 +4,19 @@
|
|
|
4
4
|
|
|
5
5
|
import '@dxos-theme';
|
|
6
6
|
|
|
7
|
-
import { TextB } from '@phosphor-icons/react';
|
|
8
7
|
import React from 'react';
|
|
9
8
|
|
|
10
|
-
import { Toggle } from './Toggle';
|
|
11
9
|
import { withTheme } from '../../testing';
|
|
10
|
+
import { Icon } from '../Icon';
|
|
11
|
+
|
|
12
|
+
import { Toggle } from './Toggle';
|
|
12
13
|
|
|
13
14
|
type StorybookToggleProps = {};
|
|
14
15
|
|
|
15
16
|
const DefaultStory = (props: StorybookToggleProps) => {
|
|
16
17
|
return (
|
|
17
18
|
<Toggle {...props}>
|
|
18
|
-
<
|
|
19
|
+
<Icon icon='ph--text-b--regular' />
|
|
19
20
|
</Toggle>
|
|
20
21
|
);
|
|
21
22
|
};
|
|
@@ -4,21 +4,22 @@
|
|
|
4
4
|
|
|
5
5
|
import '@dxos-theme';
|
|
6
6
|
|
|
7
|
-
import { TextB, TextItalic } from '@phosphor-icons/react';
|
|
8
7
|
import React from 'react';
|
|
9
8
|
|
|
10
|
-
import { ToggleGroup, ToggleGroupItem, type ToggleGroupProps } from './ToggleGroup';
|
|
11
9
|
import { withTheme } from '../../testing';
|
|
10
|
+
import { Icon } from '../Icon';
|
|
11
|
+
|
|
12
|
+
import { ToggleGroup, ToggleGroupItem, type ToggleGroupProps } from './ToggleGroup';
|
|
12
13
|
|
|
13
14
|
// TODO(burdon): Create Radix-style Root, Item, etc?
|
|
14
15
|
const DefaultStory = (props: ToggleGroupProps) => {
|
|
15
16
|
return (
|
|
16
17
|
<ToggleGroup {...props}>
|
|
17
18
|
<ToggleGroupItem value='textb'>
|
|
18
|
-
<
|
|
19
|
+
<Icon icon='ph--text-b--regular' />
|
|
19
20
|
</ToggleGroupItem>
|
|
20
21
|
<ToggleGroupItem value='texti'>
|
|
21
|
-
<
|
|
22
|
+
<Icon icon='ph--text-italic--regular' />
|
|
22
23
|
</ToggleGroupItem>
|
|
23
24
|
</ToggleGroup>
|
|
24
25
|
);
|
|
@@ -3,11 +3,11 @@
|
|
|
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
|
|
|
@@ -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;
|
|
@@ -2,25 +2,25 @@
|
|
|
2
2
|
// Copyright 2023 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import { type IconProps } from '@phosphor-icons/react';
|
|
6
5
|
import React from 'react';
|
|
7
6
|
|
|
8
7
|
import { mx } from '@dxos/react-ui-theme';
|
|
9
8
|
|
|
10
|
-
import { useClipboard } from './ClipboardProvider';
|
|
11
9
|
import { Button, type ButtonProps, IconButton } from '../Buttons';
|
|
12
|
-
import { Icon } from '../Icon';
|
|
10
|
+
import { Icon, type IconProps } from '../Icon';
|
|
13
11
|
import { useTranslation } from '../ThemeProvider';
|
|
14
12
|
import { type TooltipScopedProps, useTooltipContext } from '../Tooltip';
|
|
15
13
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
14
|
+
import { useClipboard } from './ClipboardProvider';
|
|
15
|
+
|
|
16
|
+
export type CopyButtonProps = ButtonProps &
|
|
17
|
+
Pick<IconProps, 'size'> & {
|
|
18
|
+
value: string;
|
|
19
|
+
};
|
|
20
20
|
|
|
21
21
|
const inactiveLabelStyles = 'invisible bs-px -mbe-px overflow-hidden';
|
|
22
22
|
|
|
23
|
-
export const CopyButton = ({
|
|
23
|
+
export const CopyButton = ({ classNames, value, size = 5, ...props }: CopyButtonProps) => {
|
|
24
24
|
const { t } = useTranslation('os');
|
|
25
25
|
const { textValue, setTextValue } = useClipboard();
|
|
26
26
|
const isCopied = textValue === value;
|
|
@@ -33,12 +33,11 @@ export const CopyButton = ({ value, classNames, iconProps, ...props }: CopyButto
|
|
|
33
33
|
>
|
|
34
34
|
<div role='none' className={mx('flex gap-1 items-center', isCopied && inactiveLabelStyles)}>
|
|
35
35
|
<span className='pli-1'>{t('copy label')}</span>
|
|
36
|
-
|
|
37
|
-
<Icon icon='ph--copy--regular' size={5 as any} {...iconProps} />
|
|
36
|
+
<Icon icon='ph--copy--regular' size={size} />
|
|
38
37
|
</div>
|
|
39
38
|
<div role='none' className={mx('flex gap-1 items-center', !isCopied && inactiveLabelStyles)}>
|
|
40
39
|
<span className='pli-1'>{t('copy success label')}</span>
|
|
41
|
-
<Icon icon='ph--check--regular' size={
|
|
40
|
+
<Icon icon='ph--check--regular' size={size} />
|
|
42
41
|
</div>
|
|
43
42
|
</Button>
|
|
44
43
|
);
|
|
@@ -52,21 +51,21 @@ export const CopyButtonIconOnly = ({
|
|
|
52
51
|
__scopeTooltip,
|
|
53
52
|
value,
|
|
54
53
|
classNames,
|
|
55
|
-
|
|
54
|
+
size,
|
|
56
55
|
variant,
|
|
57
56
|
...props
|
|
58
57
|
}: TooltipScopedProps<CopyButtonIconOnlyProps>) => {
|
|
59
58
|
const { t } = useTranslation('os');
|
|
60
59
|
const { textValue, setTextValue } = useClipboard();
|
|
61
60
|
const isCopied = textValue === value;
|
|
62
|
-
const label = isCopied ? t('copy success label') : props.label ?? t('copy label');
|
|
61
|
+
const label = isCopied ? t('copy success label') : (props.label ?? t('copy label'));
|
|
63
62
|
const { onOpen } = useTooltipContext('CopyButton', __scopeTooltip);
|
|
64
63
|
return (
|
|
65
64
|
<IconButton
|
|
66
65
|
iconOnly
|
|
67
66
|
label={label!}
|
|
68
67
|
icon='ph--copy--regular'
|
|
69
|
-
size={
|
|
68
|
+
size={size}
|
|
70
69
|
variant={variant}
|
|
71
70
|
classNames={['inline-flex flex-col justify-center', classNames]}
|
|
72
71
|
onClick={() => setTextValue(value).then(onOpen)}
|
|
@@ -6,11 +6,12 @@ import '@dxos-theme';
|
|
|
6
6
|
|
|
7
7
|
import React from 'react';
|
|
8
8
|
|
|
9
|
-
import { AlertDialog } from './AlertDialog';
|
|
10
9
|
import { withTheme } from '../../testing';
|
|
11
10
|
import { Button } from '../Buttons';
|
|
12
11
|
import { Toolbar } from '../Toolbar';
|
|
13
12
|
|
|
13
|
+
import { AlertDialog } from './AlertDialog';
|
|
14
|
+
|
|
14
15
|
type StoryProps = Partial<{
|
|
15
16
|
title: string;
|
|
16
17
|
description: string;
|
|
@@ -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';
|
|
@@ -6,10 +6,11 @@ import '@dxos-theme';
|
|
|
6
6
|
|
|
7
7
|
import React from 'react';
|
|
8
8
|
|
|
9
|
-
import { Dialog } from './Dialog';
|
|
10
9
|
import { withTheme } from '../../testing';
|
|
11
10
|
import { Button } from '../Buttons';
|
|
12
11
|
|
|
12
|
+
import { Dialog } from './Dialog';
|
|
13
|
+
|
|
13
14
|
type StoryProps = Partial<{
|
|
14
15
|
title: string;
|
|
15
16
|
description: string;
|
|
@@ -4,24 +4,24 @@
|
|
|
4
4
|
|
|
5
5
|
import { createContext } from '@radix-ui/react-context';
|
|
6
6
|
import {
|
|
7
|
-
type DialogProps as DialogRootPrimitiveProps,
|
|
8
|
-
Root as DialogRootPrimitive,
|
|
9
|
-
DialogTrigger as DialogTriggerPrimitive,
|
|
10
|
-
type DialogTriggerProps as DialogTriggerPrimitiveProps,
|
|
11
|
-
DialogPortal as DialogPortalPrimitive,
|
|
12
|
-
type DialogPortalProps as DialogPortalPrimitiveProps,
|
|
13
|
-
DialogOverlay as DialogOverlayPrimitive,
|
|
14
|
-
type DialogOverlayProps as DialogOverlayPrimitiveProps,
|
|
15
|
-
DialogTitle as DialogTitlePrimitive,
|
|
16
|
-
type DialogTitleProps as DialogTitlePrimitiveProps,
|
|
17
|
-
DialogDescription as DialogDescriptionPrimitive,
|
|
18
|
-
type DialogDescriptionProps as DialogDescriptionPrimitiveProps,
|
|
19
7
|
DialogClose as DialogClosePrimitive,
|
|
20
8
|
type DialogCloseProps as DialogClosePrimitiveProps,
|
|
21
9
|
DialogContent as DialogContentPrimitive,
|
|
22
10
|
type DialogContentProps as DialogContentPrimitiveProps,
|
|
11
|
+
DialogDescription as DialogDescriptionPrimitive,
|
|
12
|
+
type DialogDescriptionProps as DialogDescriptionPrimitiveProps,
|
|
13
|
+
DialogOverlay as DialogOverlayPrimitive,
|
|
14
|
+
type DialogOverlayProps as DialogOverlayPrimitiveProps,
|
|
15
|
+
DialogPortal as DialogPortalPrimitive,
|
|
16
|
+
type DialogPortalProps as DialogPortalPrimitiveProps,
|
|
17
|
+
Root as DialogRootPrimitive,
|
|
18
|
+
type DialogProps as DialogRootPrimitiveProps,
|
|
19
|
+
DialogTitle as DialogTitlePrimitive,
|
|
20
|
+
type DialogTitleProps as DialogTitlePrimitiveProps,
|
|
21
|
+
DialogTrigger as DialogTriggerPrimitive,
|
|
22
|
+
type DialogTriggerProps as DialogTriggerPrimitiveProps,
|
|
23
23
|
} from '@radix-ui/react-dialog';
|
|
24
|
-
import React, {
|
|
24
|
+
import React, { type ForwardRefExoticComponent, type FunctionComponent, forwardRef } from 'react';
|
|
25
25
|
|
|
26
26
|
import { useThemeContext } from '../../hooks';
|
|
27
27
|
import { type ThemedClassName } from '../../util';
|
|
@@ -4,21 +4,22 @@
|
|
|
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 { baseSurface, modalSurface,
|
|
10
|
+
import { activeSurface, baseSurface, modalSurface, mx, surfaceShadow } from '@dxos/react-ui-theme';
|
|
11
11
|
import { type MessageValence } from '@dxos/react-ui-types';
|
|
12
12
|
|
|
13
|
+
import { withTheme } from '../../testing';
|
|
14
|
+
|
|
13
15
|
import {
|
|
14
16
|
type CheckboxProps,
|
|
15
17
|
Input,
|
|
16
18
|
type PinInputProps,
|
|
17
19
|
type SwitchProps,
|
|
18
|
-
type TextInputProps,
|
|
19
20
|
type TextAreaProps,
|
|
21
|
+
type TextInputProps,
|
|
20
22
|
} from './Input';
|
|
21
|
-
import { withTheme } from '../../testing';
|
|
22
23
|
|
|
23
24
|
type VariantMap = {
|
|
24
25
|
text: TextInputProps;
|
|
@@ -5,31 +5,31 @@
|
|
|
5
5
|
import { type IconWeight } from '@phosphor-icons/react';
|
|
6
6
|
import { Root as CheckboxPrimitive, type CheckboxProps as CheckboxPrimitiveProps } from '@radix-ui/react-checkbox';
|
|
7
7
|
import { useControllableState } from '@radix-ui/react-use-controllable-state';
|
|
8
|
-
import React, { type ComponentPropsWithRef,
|
|
8
|
+
import React, { type ComponentPropsWithRef, type ForwardRefExoticComponent, forwardRef, useCallback } from 'react';
|
|
9
9
|
|
|
10
10
|
import {
|
|
11
|
+
DescriptionAndValidation as DescriptionAndValidationPrimitive,
|
|
12
|
+
type DescriptionAndValidationProps as DescriptionAndValidationPrimitiveProps,
|
|
13
|
+
Description as DescriptionPrimitive,
|
|
14
|
+
type DescriptionProps as DescriptionPrimitiveProps,
|
|
15
|
+
INPUT_NAME,
|
|
11
16
|
InputRoot,
|
|
12
17
|
type InputRootProps,
|
|
18
|
+
type InputScopedProps,
|
|
19
|
+
Label as LabelPrimitive,
|
|
20
|
+
type LabelProps as LabelPrimitiveProps,
|
|
13
21
|
PinInput as PinInputPrimitive,
|
|
14
22
|
type PinInputProps as PinInputPrimitiveProps,
|
|
15
|
-
TextInput as TextInputPrimitive,
|
|
16
|
-
type TextInputProps as TextInputPrimitiveProps,
|
|
17
23
|
TextArea as TextAreaPrimitive,
|
|
18
24
|
type TextAreaProps as TextAreaPrimitiveProps,
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
type InputScopedProps,
|
|
22
|
-
Description as DescriptionPrimitive,
|
|
23
|
-
DescriptionAndValidation as DescriptionAndValidationPrimitive,
|
|
24
|
-
type DescriptionAndValidationProps as DescriptionAndValidationPrimitiveProps,
|
|
25
|
-
type DescriptionProps as DescriptionPrimitiveProps,
|
|
26
|
-
Label as LabelPrimitive,
|
|
27
|
-
type LabelProps as LabelPrimitiveProps,
|
|
25
|
+
TextInput as TextInputPrimitive,
|
|
26
|
+
type TextInputProps as TextInputPrimitiveProps,
|
|
28
27
|
Validation as ValidationPrimitive,
|
|
29
28
|
type ValidationProps as ValidationPrimitiveProps,
|
|
29
|
+
useInputContext,
|
|
30
30
|
} from '@dxos/react-input';
|
|
31
31
|
import { mx } from '@dxos/react-ui-theme';
|
|
32
|
-
import { type
|
|
32
|
+
import { type ClassNameValue, type Density, type Elevation, type Size } from '@dxos/react-ui-types';
|
|
33
33
|
|
|
34
34
|
import { useDensityContext, useElevationContext, useThemeContext } from '../../hooks';
|
|
35
35
|
import { type ThemedClassName } from '../../util';
|