@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
|
@@ -5,10 +5,9 @@
|
|
|
5
5
|
import '@dxos-theme';
|
|
6
6
|
|
|
7
7
|
import { DndContext, type DragEndEvent, type DragStartEvent } from '@dnd-kit/core';
|
|
8
|
-
import {
|
|
8
|
+
import { SortableContext, arrayMove, useSortable, verticalListSortingStrategy } from '@dnd-kit/sortable';
|
|
9
9
|
import { CSS } from '@dnd-kit/utilities';
|
|
10
10
|
import { useArrowNavigationGroup } from '@fluentui/react-tabster';
|
|
11
|
-
import { DotsSixVertical, PushPin } from '@phosphor-icons/react';
|
|
12
11
|
import React, { type ReactNode, useState } from 'react';
|
|
13
12
|
|
|
14
13
|
import {
|
|
@@ -20,8 +19,10 @@ import {
|
|
|
20
19
|
surfaceShadow,
|
|
21
20
|
} from '@dxos/react-ui-theme';
|
|
22
21
|
|
|
23
|
-
import { List, ListItem, type ListScopedProps } from './List';
|
|
24
22
|
import { withTheme } from '../../testing';
|
|
23
|
+
import { Icon } from '../Icon';
|
|
24
|
+
|
|
25
|
+
import { List, ListItem, type ListScopedProps } from './List';
|
|
25
26
|
|
|
26
27
|
export default {
|
|
27
28
|
title: 'ui/react-ui-core/List',
|
|
@@ -41,11 +42,11 @@ const UniformListItem = ({ id, text }: { id: string; text: string }) => {
|
|
|
41
42
|
style={{ transform: CSS.Transform.toString(transform) }}
|
|
42
43
|
>
|
|
43
44
|
<ListItem.Endcap>
|
|
44
|
-
<
|
|
45
|
+
<Icon icon='ph--dots-six-vertical--regular' classNames={mx(getSize(5), 'mbs-2.5')} />
|
|
45
46
|
</ListItem.Endcap>
|
|
46
47
|
<ListItem.Heading classNames='grow pbs-2'>{text}</ListItem.Heading>
|
|
47
48
|
<ListItem.Endcap>
|
|
48
|
-
<
|
|
49
|
+
<Icon icon='ph--push-pin--regular' classNames={mx(getSize(5), 'mbs-2.5')} />
|
|
49
50
|
</ListItem.Endcap>
|
|
50
51
|
</ListItem.Root>
|
|
51
52
|
);
|
|
@@ -103,13 +104,13 @@ const ManySizesDraggableListItem = ({
|
|
|
103
104
|
style={{ transform: CSS.Translate.toString(transform) }}
|
|
104
105
|
>
|
|
105
106
|
<ListItem.Endcap>
|
|
106
|
-
<
|
|
107
|
+
<Icon icon='ph--dots-six-vertical--regular' classNames={mx(getSize(5), 'mbs-2.5')} />
|
|
107
108
|
</ListItem.Endcap>
|
|
108
109
|
<ListItem.Heading classNames='grow pbs-2' asChild>
|
|
109
110
|
{text}
|
|
110
111
|
</ListItem.Heading>
|
|
111
112
|
<ListItem.Endcap>
|
|
112
|
-
<
|
|
113
|
+
<Icon icon='ph--push-pin--regular' classNames={mx(getSize(5), 'mbs-2.5')} />
|
|
113
114
|
</ListItem.Endcap>
|
|
114
115
|
</ListItem.Root>
|
|
115
116
|
);
|
|
@@ -181,7 +182,7 @@ export const Collapsible = {
|
|
|
181
182
|
{index !== 2 ? <ListItem.OpenTrigger /> : <ListItem.MockOpenTrigger />}
|
|
182
183
|
<ListItem.Heading classNames='grow pbs-2'>{text}</ListItem.Heading>
|
|
183
184
|
<ListItem.Endcap>
|
|
184
|
-
<
|
|
185
|
+
<Icon icon='ph--push-pin--regular' classNames={mx(getSize(5), 'mbs-2.5')} />
|
|
185
186
|
</ListItem.Endcap>
|
|
186
187
|
</div>
|
|
187
188
|
{index !== 2 && <ListItem.CollapsibleContent>{body}</ListItem.CollapsibleContent>}
|
|
@@ -2,34 +2,35 @@
|
|
|
2
2
|
// Copyright 2023 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import { CaretDown, CaretRight } from '@phosphor-icons/react';
|
|
6
5
|
import { Slot } from '@radix-ui/react-slot';
|
|
7
|
-
import React, { type ComponentPropsWithoutRef, type FC,
|
|
6
|
+
import React, { type ComponentPropsWithoutRef, type FC, type ForwardRefExoticComponent, forwardRef } from 'react';
|
|
8
7
|
|
|
9
8
|
import {
|
|
9
|
+
LIST_ITEM_NAME,
|
|
10
|
+
LIST_NAME,
|
|
11
|
+
ListItemCollapsibleContent,
|
|
12
|
+
type ListItemCollapsibleContentProps,
|
|
13
|
+
type ListItemScopedProps,
|
|
10
14
|
List as ListPrimitive,
|
|
11
|
-
|
|
12
|
-
type ListScopedProps,
|
|
15
|
+
ListItem as ListPrimitiveItem,
|
|
13
16
|
ListItemHeading as ListPrimitiveItemHeading,
|
|
14
17
|
type ListItemHeadingProps as ListPrimitiveItemHeadingProps,
|
|
15
18
|
ListItemOpenTrigger as ListPrimitiveItemOpenTrigger,
|
|
16
19
|
type ListItemOpenTriggerProps as ListPrimitiveItemOpenTriggerProps,
|
|
17
|
-
ListItemCollapsibleContent,
|
|
18
|
-
type ListItemCollapsibleContentProps,
|
|
19
|
-
ListItem as ListPrimitiveItem,
|
|
20
20
|
type ListItemProps as ListPrimitiveItemProps,
|
|
21
|
-
type
|
|
22
|
-
|
|
23
|
-
LIST_ITEM_NAME,
|
|
21
|
+
type ListProps as ListPrimitiveProps,
|
|
22
|
+
type ListScopedProps,
|
|
24
23
|
useListContext,
|
|
25
24
|
useListItemContext,
|
|
26
25
|
} from '@dxos/react-list';
|
|
27
26
|
import { type Density } from '@dxos/react-ui-types';
|
|
28
27
|
|
|
29
|
-
import { ListDropIndicator } from './ListDropIndicator';
|
|
30
28
|
import { useDensityContext, useThemeContext } from '../../hooks';
|
|
31
29
|
import { type ThemedClassName } from '../../util';
|
|
32
30
|
import { DensityProvider } from '../DensityProvider';
|
|
31
|
+
import { Icon } from '../Icon';
|
|
32
|
+
|
|
33
|
+
import { ListDropIndicator } from './ListDropIndicator';
|
|
33
34
|
|
|
34
35
|
type ListProps = ThemedClassName<ListPrimitiveProps> & { density?: Density };
|
|
35
36
|
|
|
@@ -106,7 +107,7 @@ const ListItemOpenTrigger = forwardRef<HTMLButtonElement, ListItemOpenTriggerPro
|
|
|
106
107
|
const { tx } = useThemeContext();
|
|
107
108
|
const density = useDensityContext();
|
|
108
109
|
const { open } = useListItemContext(LIST_ITEM_NAME, __listItemScope);
|
|
109
|
-
const
|
|
110
|
+
const iconName = open ? 'ph--caret-down--bold' : 'ph--caret-right--bold';
|
|
110
111
|
return (
|
|
111
112
|
<ListPrimitiveItemOpenTrigger
|
|
112
113
|
{...props}
|
|
@@ -114,12 +115,7 @@ const ListItemOpenTrigger = forwardRef<HTMLButtonElement, ListItemOpenTriggerPro
|
|
|
114
115
|
ref={forwardedRef}
|
|
115
116
|
>
|
|
116
117
|
{children || (
|
|
117
|
-
<Icon
|
|
118
|
-
{...{
|
|
119
|
-
weight: 'bold',
|
|
120
|
-
className: tx('list.item.openTriggerIcon', 'list__listItem__openTrigger__icon', {}),
|
|
121
|
-
}}
|
|
122
|
-
/>
|
|
118
|
+
<Icon icon={iconName} classNames={tx('list.item.openTriggerIcon', 'list__listItem__openTrigger__icon', {})} />
|
|
123
119
|
)}
|
|
124
120
|
</ListPrimitiveItemOpenTrigger>
|
|
125
121
|
);
|
|
@@ -2,9 +2,12 @@
|
|
|
2
2
|
// Copyright 2023 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import React, { type ComponentPropsWithoutRef, type FC,
|
|
5
|
+
import React, { type ComponentPropsWithoutRef, type FC, type ForwardRefExoticComponent, forwardRef } from 'react';
|
|
6
|
+
|
|
7
|
+
import { type ThemedClassName } from '../../util';
|
|
6
8
|
|
|
7
9
|
import {
|
|
10
|
+
LIST_ITEM_NAME,
|
|
8
11
|
List,
|
|
9
12
|
ListItem,
|
|
10
13
|
type ListItemCollapsibleContentProps,
|
|
@@ -13,11 +16,9 @@ import {
|
|
|
13
16
|
type ListItemRootProps,
|
|
14
17
|
type ListProps,
|
|
15
18
|
type ListScopedProps,
|
|
16
|
-
LIST_ITEM_NAME,
|
|
17
19
|
useListItemContext,
|
|
18
20
|
} from './List';
|
|
19
21
|
import { TreeDropIndicator } from './TreeDropIndicator';
|
|
20
|
-
import { type ThemedClassName } from '../../util';
|
|
21
22
|
|
|
22
23
|
type TreeRootProps = ListProps;
|
|
23
24
|
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
//
|
|
4
4
|
|
|
5
5
|
import { type Instruction } from '@atlaskit/pragmatic-drag-and-drop-hitbox/tree-item';
|
|
6
|
-
import React, { type
|
|
6
|
+
import React, { type CSSProperties, type HTMLAttributes } from 'react';
|
|
7
7
|
|
|
8
8
|
// Tree item hitbox
|
|
9
9
|
// https://github.com/atlassian/pragmatic-drag-and-drop/blob/main/packages/hitbox/constellation/index/about.mdx#tree-item
|
|
@@ -6,10 +6,11 @@ import React from 'react';
|
|
|
6
6
|
|
|
7
7
|
import { faker } from '@dxos/random';
|
|
8
8
|
|
|
9
|
-
import { Treegrid } from './Treegrid';
|
|
10
9
|
import { withTheme } from '../../testing';
|
|
11
10
|
import { Icon } from '../Icon';
|
|
12
11
|
|
|
12
|
+
import { Treegrid } from './Treegrid';
|
|
13
|
+
|
|
13
14
|
faker.seed(1234);
|
|
14
15
|
|
|
15
16
|
type StorybookNode = {
|
|
@@ -3,11 +3,11 @@
|
|
|
3
3
|
//
|
|
4
4
|
|
|
5
5
|
import { useArrowNavigationGroup, useFocusableGroup } from '@fluentui/react-tabster';
|
|
6
|
-
import {
|
|
6
|
+
import { type Scope, createContextScope } from '@radix-ui/react-context';
|
|
7
7
|
import { Primitive } from '@radix-ui/react-primitive';
|
|
8
8
|
import { Slot } from '@radix-ui/react-slot';
|
|
9
9
|
import { useControllableState } from '@radix-ui/react-use-controllable-state';
|
|
10
|
-
import React, { type
|
|
10
|
+
import React, { type CSSProperties, type ComponentPropsWithRef, forwardRef } from 'react';
|
|
11
11
|
|
|
12
12
|
import { useThemeContext } from '../../hooks';
|
|
13
13
|
import { type ThemedClassName } from '../../util';
|
|
@@ -6,10 +6,11 @@ import '@dxos-theme';
|
|
|
6
6
|
|
|
7
7
|
import React from 'react';
|
|
8
8
|
|
|
9
|
-
import { Main, useSidebars } from './Main';
|
|
10
9
|
import { withTheme } from '../../testing';
|
|
11
10
|
import { Button } from '../Buttons';
|
|
12
11
|
|
|
12
|
+
import { Main, useSidebars } from './Main';
|
|
13
|
+
|
|
13
14
|
type StoryMainArgs = {};
|
|
14
15
|
|
|
15
16
|
const NavigationSidebarToggle = () => {
|
|
@@ -3,32 +3,33 @@
|
|
|
3
3
|
//
|
|
4
4
|
|
|
5
5
|
import { createContext } from '@radix-ui/react-context';
|
|
6
|
-
import { Root as DialogRoot,
|
|
6
|
+
import { DialogContent, Root as DialogRoot, DialogTitle } from '@radix-ui/react-dialog';
|
|
7
7
|
import { Primitive } from '@radix-ui/react-primitive';
|
|
8
8
|
import { Slot } from '@radix-ui/react-slot';
|
|
9
9
|
import { useControllableState } from '@radix-ui/react-use-controllable-state';
|
|
10
10
|
import React, {
|
|
11
11
|
type ComponentPropsWithRef,
|
|
12
|
+
type ComponentPropsWithoutRef,
|
|
12
13
|
type Dispatch,
|
|
13
|
-
|
|
14
|
+
type KeyboardEvent,
|
|
14
15
|
type PropsWithChildren,
|
|
15
16
|
type SetStateAction,
|
|
17
|
+
forwardRef,
|
|
16
18
|
useCallback,
|
|
17
19
|
useEffect,
|
|
18
20
|
useRef,
|
|
19
21
|
useState,
|
|
20
|
-
type KeyboardEvent,
|
|
21
|
-
type ComponentPropsWithoutRef,
|
|
22
22
|
} from 'react';
|
|
23
23
|
|
|
24
24
|
import { log } from '@dxos/log';
|
|
25
|
-
import {
|
|
25
|
+
import { useForwardedRef, useMediaQuery } from '@dxos/react-hooks';
|
|
26
26
|
|
|
27
|
-
import { useSwipeToDismiss } from './useSwipeToDismiss';
|
|
28
27
|
import { useThemeContext } from '../../hooks';
|
|
29
28
|
import { type ThemedClassName } from '../../util';
|
|
30
29
|
import { type Label, toLocalizedString, useTranslation } from '../ThemeProvider';
|
|
31
30
|
|
|
31
|
+
import { useSwipeToDismiss } from './useSwipeToDismiss';
|
|
32
|
+
|
|
32
33
|
const MAIN_ROOT_NAME = 'MainRoot';
|
|
33
34
|
const NAVIGATION_SIDEBAR_NAME = 'NavigationSidebar';
|
|
34
35
|
const COMPLEMENTARY_SIDEBAR_NAME = 'ComplementarySidebar';
|
|
@@ -6,9 +6,10 @@ import '@dxos-theme';
|
|
|
6
6
|
|
|
7
7
|
import React from 'react';
|
|
8
8
|
|
|
9
|
-
import { ContextMenu } from './ContextMenu';
|
|
10
9
|
import { withTheme } from '../../testing';
|
|
11
10
|
|
|
11
|
+
import { ContextMenu } from './ContextMenu';
|
|
12
|
+
|
|
12
13
|
const DefaultStory = () => {
|
|
13
14
|
// NOTE(thure): Since long-tap will select text in some OSs, apply `select-none` to `ContextMenu.Trigger` where possible.
|
|
14
15
|
return (
|
|
@@ -6,10 +6,11 @@ import '@dxos-theme';
|
|
|
6
6
|
|
|
7
7
|
import React, { useRef, useState } from 'react';
|
|
8
8
|
|
|
9
|
-
import { DropdownMenu } from './DropdownMenu';
|
|
10
9
|
import { withTheme } from '../../testing';
|
|
11
10
|
import { Button } from '../Buttons';
|
|
12
11
|
|
|
12
|
+
import { DropdownMenu } from './DropdownMenu';
|
|
13
|
+
|
|
13
14
|
const DefaultStory = () => {
|
|
14
15
|
return (
|
|
15
16
|
<DropdownMenu.Root defaultOpen>
|
|
@@ -15,17 +15,17 @@ import { Primitive } from '@radix-ui/react-primitive';
|
|
|
15
15
|
import { Slot } from '@radix-ui/react-slot';
|
|
16
16
|
import { useControllableState } from '@radix-ui/react-use-controllable-state';
|
|
17
17
|
import React, {
|
|
18
|
-
type ReactNode,
|
|
19
|
-
type FC,
|
|
20
|
-
useRef,
|
|
21
|
-
type ElementRef,
|
|
22
|
-
useCallback,
|
|
23
|
-
type ComponentPropsWithoutRef,
|
|
24
|
-
forwardRef,
|
|
25
18
|
type ComponentPropsWithRef,
|
|
26
|
-
|
|
19
|
+
type ComponentPropsWithoutRef,
|
|
20
|
+
type ElementRef,
|
|
21
|
+
type FC,
|
|
27
22
|
type MutableRefObject,
|
|
23
|
+
type ReactNode,
|
|
28
24
|
type RefObject,
|
|
25
|
+
forwardRef,
|
|
26
|
+
useCallback,
|
|
27
|
+
useEffect,
|
|
28
|
+
useRef,
|
|
29
29
|
} from 'react';
|
|
30
30
|
|
|
31
31
|
import { useElevationContext, useThemeContext } from '../../hooks';
|
|
@@ -8,9 +8,10 @@ import React from 'react';
|
|
|
8
8
|
|
|
9
9
|
import { type MessageValence } from '@dxos/react-ui-types';
|
|
10
10
|
|
|
11
|
-
import { Callout } from './Message';
|
|
12
11
|
import { withTheme } from '../../testing';
|
|
13
12
|
|
|
13
|
+
import { Callout } from './Message';
|
|
14
|
+
|
|
14
15
|
type StoryProps = {
|
|
15
16
|
valence: MessageValence;
|
|
16
17
|
title: string;
|
|
@@ -8,7 +8,7 @@ import { Slot } from '@radix-ui/react-slot';
|
|
|
8
8
|
import React, { type ComponentPropsWithRef, forwardRef } from 'react';
|
|
9
9
|
|
|
10
10
|
import { useId } from '@dxos/react-hooks';
|
|
11
|
-
import { type
|
|
11
|
+
import { type Elevation, type MessageValence } from '@dxos/react-ui-types';
|
|
12
12
|
|
|
13
13
|
import { useElevationContext, useThemeContext } from '../../hooks';
|
|
14
14
|
import { type ThemedClassName } from '../../util';
|
|
@@ -8,10 +8,11 @@ import React, { type PropsWithChildren, type ReactNode, useRef, useState } from
|
|
|
8
8
|
|
|
9
9
|
import { faker } from '@dxos/random';
|
|
10
10
|
|
|
11
|
-
import { Popover } from './Popover';
|
|
12
11
|
import { withTheme } from '../../testing';
|
|
13
12
|
import { Button } from '../Buttons';
|
|
14
13
|
|
|
14
|
+
import { Popover } from './Popover';
|
|
15
|
+
|
|
15
16
|
faker.seed(1234);
|
|
16
17
|
|
|
17
18
|
const DefaultStory = ({ openTrigger, children }: PropsWithChildren<{ openTrigger: ReactNode }>) => {
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
import { composeEventHandlers } from '@radix-ui/primitive';
|
|
8
8
|
import { useComposedRefs } from '@radix-ui/react-compose-refs';
|
|
9
9
|
import { createContextScope } from '@radix-ui/react-context';
|
|
10
|
-
import type
|
|
10
|
+
import { type Scope } from '@radix-ui/react-context';
|
|
11
11
|
import { DismissableLayer } from '@radix-ui/react-dismissable-layer';
|
|
12
12
|
import { useFocusGuards } from '@radix-ui/react-focus-guards';
|
|
13
13
|
import { FocusScope } from '@radix-ui/react-focus-scope';
|
|
@@ -22,17 +22,17 @@ import { useControllableState } from '@radix-ui/react-use-controllable-state';
|
|
|
22
22
|
import { hideOthers } from 'aria-hidden';
|
|
23
23
|
import React, {
|
|
24
24
|
type ComponentPropsWithRef,
|
|
25
|
-
|
|
25
|
+
type ComponentPropsWithoutRef,
|
|
26
26
|
type ElementRef,
|
|
27
|
-
type
|
|
27
|
+
type FC,
|
|
28
|
+
type MutableRefObject,
|
|
28
29
|
type ReactNode,
|
|
29
|
-
|
|
30
|
+
type RefObject,
|
|
31
|
+
forwardRef,
|
|
30
32
|
useCallback,
|
|
31
|
-
type ComponentPropsWithoutRef,
|
|
32
|
-
type FC,
|
|
33
|
-
useState,
|
|
34
33
|
useEffect,
|
|
35
|
-
|
|
34
|
+
useRef,
|
|
35
|
+
useState,
|
|
36
36
|
} from 'react';
|
|
37
37
|
import { RemoveScroll } from 'react-remove-scroll';
|
|
38
38
|
|
|
@@ -9,9 +9,10 @@ import React, { type PropsWithChildren } from 'react';
|
|
|
9
9
|
import { faker } from '@dxos/random';
|
|
10
10
|
import { activeSurface, surfaceShadow } from '@dxos/react-ui-theme';
|
|
11
11
|
|
|
12
|
-
import { ScrollArea } from './ScrollArea';
|
|
13
12
|
import { withTheme } from '../../testing';
|
|
14
13
|
|
|
14
|
+
import { ScrollArea } from './ScrollArea';
|
|
15
|
+
|
|
15
16
|
faker.seed(1234);
|
|
16
17
|
|
|
17
18
|
const DefaultStory = ({ children }: PropsWithChildren<{}>) => {
|
|
@@ -3,16 +3,16 @@
|
|
|
3
3
|
//
|
|
4
4
|
|
|
5
5
|
import {
|
|
6
|
+
Corner as ScrollAreaPrimitiveCorner,
|
|
7
|
+
type ScrollAreaCornerProps as ScrollAreaPrimitiveCornerProps,
|
|
6
8
|
Root as ScrollAreaPrimitiveRoot,
|
|
7
9
|
type ScrollAreaProps as ScrollAreaPrimitiveRootProps,
|
|
8
|
-
Viewport as ScrollAreaPrimitiveViewport,
|
|
9
|
-
type ScrollAreaViewportProps as ScrollAreaPrimitiveViewportProps,
|
|
10
10
|
Scrollbar as ScrollAreaPrimitiveScrollbar,
|
|
11
11
|
type ScrollAreaScrollbarProps as ScrollAreaPrimitiveScrollbarProps,
|
|
12
12
|
Thumb as ScrollAreaPrimitiveThumb,
|
|
13
13
|
type ScrollAreaThumbProps as ScrollAreaPrimitiveThumbProps,
|
|
14
|
-
|
|
15
|
-
type
|
|
14
|
+
Viewport as ScrollAreaPrimitiveViewport,
|
|
15
|
+
type ScrollAreaViewportProps as ScrollAreaPrimitiveViewportProps,
|
|
16
16
|
} from '@radix-ui/react-scroll-area';
|
|
17
17
|
import React, { forwardRef } from 'react';
|
|
18
18
|
|
|
@@ -4,14 +4,15 @@
|
|
|
4
4
|
|
|
5
5
|
import '@dxos-theme';
|
|
6
6
|
|
|
7
|
-
import { type StoryObj } from '@storybook/react';
|
|
7
|
+
import { type StoryObj } from '@storybook/react-vite';
|
|
8
8
|
import React, { useState } from 'react';
|
|
9
9
|
|
|
10
10
|
import { faker } from '@dxos/random';
|
|
11
11
|
|
|
12
|
-
import { Select } from './Select';
|
|
13
12
|
import { withSurfaceVariantsLayout, withTheme } from '../../testing';
|
|
14
13
|
|
|
14
|
+
import { Select } from './Select';
|
|
15
|
+
|
|
15
16
|
faker.seed(1234);
|
|
16
17
|
|
|
17
18
|
type ItemProps = { id: string; text: string };
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
// Copyright 2023 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import { CaretDown, CaretUp } from '@phosphor-icons/react';
|
|
6
5
|
import * as SelectPrimitive from '@radix-ui/react-select';
|
|
7
6
|
import React, { forwardRef } from 'react';
|
|
8
7
|
|
|
@@ -43,7 +42,7 @@ const SelectTriggerButton = forwardRef<HTMLButtonElement, SelectTriggerButtonPro
|
|
|
43
42
|
<SelectPrimitive.Value placeholder={placeholder}>{children}</SelectPrimitive.Value>
|
|
44
43
|
<span className='w-1 flex-1' />
|
|
45
44
|
<SelectPrimitive.Icon asChild>
|
|
46
|
-
<
|
|
45
|
+
<Icon icon='ph--caret-down--bold' classNames={tx('select.triggerIcon', 'select__trigger__icon', {})} />
|
|
47
46
|
</SelectPrimitive.Icon>
|
|
48
47
|
</Button>
|
|
49
48
|
</SelectPrimitive.Trigger>
|
|
@@ -83,7 +82,7 @@ const SelectScrollUpButton = forwardRef<HTMLDivElement, SelectScrollUpButtonProp
|
|
|
83
82
|
className={tx('select.scrollButton', 'select__scroll-button--up', {}, classNames)}
|
|
84
83
|
ref={forwardedRef}
|
|
85
84
|
>
|
|
86
|
-
{children ?? <
|
|
85
|
+
{children ?? <Icon icon='ph--caret-up--bold' />}
|
|
87
86
|
</SelectPrimitive.SelectScrollUpButton>
|
|
88
87
|
);
|
|
89
88
|
},
|
|
@@ -100,7 +99,7 @@ const SelectScrollDownButton = forwardRef<HTMLDivElement, SelectScrollDownButton
|
|
|
100
99
|
className={tx('select.scrollButton', 'select__scroll-button--down', {}, classNames)}
|
|
101
100
|
ref={forwardedRef}
|
|
102
101
|
>
|
|
103
|
-
{children ?? <
|
|
102
|
+
{children ?? <Icon icon='ph--caret-down--bold' />}
|
|
104
103
|
</SelectPrimitive.SelectScrollDownButton>
|
|
105
104
|
);
|
|
106
105
|
},
|
|
@@ -6,9 +6,10 @@ import '@dxos-theme';
|
|
|
6
6
|
|
|
7
7
|
import React from 'react';
|
|
8
8
|
|
|
9
|
-
import { Status } from './Status';
|
|
10
9
|
import { withTheme } from '../../testing';
|
|
11
10
|
|
|
11
|
+
import { Status } from './Status';
|
|
12
|
+
|
|
12
13
|
export default {
|
|
13
14
|
title: 'ui/react-ui-core/Status',
|
|
14
15
|
component: Status,
|
|
@@ -7,9 +7,10 @@ import { hues } from '@dxos/react-ui-theme';
|
|
|
7
7
|
import '@dxos-theme';
|
|
8
8
|
import { type ChromaticPalette, type MessageValence } from '@dxos/react-ui-types';
|
|
9
9
|
|
|
10
|
-
import { Tag } from './Tag';
|
|
11
10
|
import { withTheme } from '../../testing';
|
|
12
11
|
|
|
12
|
+
import { Tag } from './Tag';
|
|
13
|
+
|
|
13
14
|
const palettes = ['neutral', 'success', 'info', 'warning', 'error', ...hues] as (ChromaticPalette | MessageValence)[];
|
|
14
15
|
|
|
15
16
|
export default {
|
|
@@ -3,17 +3,18 @@
|
|
|
3
3
|
//
|
|
4
4
|
|
|
5
5
|
import { createKeyborg } from 'keyborg';
|
|
6
|
-
import React, {
|
|
6
|
+
import React, { type PropsWithChildren, createContext, useEffect, useMemo } from 'react';
|
|
7
7
|
|
|
8
8
|
import { type Density, type Elevation, type ThemeFunction } from '@dxos/react-ui-types';
|
|
9
9
|
|
|
10
|
-
import { TranslationsProvider, type TranslationsProviderProps } from './TranslationsProvider';
|
|
11
10
|
import { type SafeAreaPadding, useSafeArea } from '../../hooks';
|
|
12
11
|
import { hasIosKeyboard } from '../../util';
|
|
13
12
|
import { DensityProvider } from '../DensityProvider';
|
|
14
13
|
import { ElevationProvider } from '../ElevationProvider';
|
|
15
14
|
|
|
16
|
-
|
|
15
|
+
import { TranslationsProvider, type TranslationsProviderProps } from './TranslationsProvider';
|
|
16
|
+
|
|
17
|
+
export type ThemeMode = 'dark' | 'light';
|
|
17
18
|
|
|
18
19
|
export type ThemeContextValue = {
|
|
19
20
|
tx: ThemeFunction<any>;
|
|
@@ -54,7 +55,6 @@ export const ThemeProvider = ({
|
|
|
54
55
|
}, []);
|
|
55
56
|
|
|
56
57
|
const safeAreaPadding = useSafeArea();
|
|
57
|
-
|
|
58
58
|
const contextValue = useMemo(
|
|
59
59
|
() => ({ tx, themeMode, hasIosKeyboard: hasIosKeyboard(), safeAreaPadding, ...rest }),
|
|
60
60
|
[tx, themeMode, safeAreaPadding, rest],
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
// Copyright 2022 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import { enUS as dtLocaleEnUs
|
|
6
|
-
import i18Next, { type
|
|
7
|
-
import React, { type ReactNode,
|
|
5
|
+
import { type Locale, enUS as dtLocaleEnUs } from 'date-fns/locale';
|
|
6
|
+
import i18Next, { type Resource, type TFunction } from 'i18next';
|
|
7
|
+
import React, { type ReactNode, Suspense, createContext, useContext, useEffect, useState } from 'react';
|
|
8
8
|
import { initReactI18next, useTranslation as useI18NextTranslation } from 'react-i18next';
|
|
9
9
|
|
|
10
10
|
const initialLng = 'en-US';
|
|
@@ -32,7 +32,7 @@ export const resources = {
|
|
|
32
32
|
'loading translations': 'Loading translations…',
|
|
33
33
|
},
|
|
34
34
|
},
|
|
35
|
-
} as const;
|
|
35
|
+
} as const satisfies Resource;
|
|
36
36
|
|
|
37
37
|
void i18Next.use(initReactI18next).init({
|
|
38
38
|
resources,
|
|
@@ -3,4 +3,6 @@
|
|
|
3
3
|
//
|
|
4
4
|
|
|
5
5
|
export * from './ThemeProvider';
|
|
6
|
-
export { type Label, toLocalizedString, useTranslation
|
|
6
|
+
export { type Label, isLabel, toLocalizedString, useTranslation } from './TranslationsProvider';
|
|
7
|
+
|
|
8
|
+
// TODO(burdon): Use `@internal` with barrel exports (rather than picking individual exports?)
|
|
@@ -6,10 +6,11 @@ import '@dxos-theme';
|
|
|
6
6
|
|
|
7
7
|
import React, { type ReactNode, useState } from 'react';
|
|
8
8
|
|
|
9
|
-
import { Toast } from './Toast';
|
|
10
9
|
import { withTheme } from '../../testing';
|
|
11
10
|
import { Button } from '../Buttons';
|
|
12
11
|
|
|
12
|
+
import { Toast } from './Toast';
|
|
13
|
+
|
|
13
14
|
type ActionTriggerProps = { altText: string; trigger: ReactNode };
|
|
14
15
|
|
|
15
16
|
type StorybookToastProps = Partial<{
|
|
@@ -5,22 +5,22 @@
|
|
|
5
5
|
import { Primitive } from '@radix-ui/react-primitive';
|
|
6
6
|
import { Slot } from '@radix-ui/react-slot';
|
|
7
7
|
import {
|
|
8
|
+
ToastAction as ToastActionPrimitive,
|
|
9
|
+
type ToastActionProps as ToastActionPrimitiveProps,
|
|
10
|
+
ToastClose as ToastClosePrimitive,
|
|
11
|
+
type ToastCloseProps as ToastClosePrimitiveProps,
|
|
12
|
+
ToastDescription as ToastDescriptionPrimitive,
|
|
13
|
+
type ToastDescriptionProps as ToastDescriptionPrimitiveProps,
|
|
8
14
|
ToastProvider as ToastProviderPrimitive,
|
|
9
15
|
type ToastProviderProps as ToastProviderPrimitiveProps,
|
|
10
|
-
ToastViewport as ToastViewportPrimitive,
|
|
11
|
-
type ToastViewportProps as ToastViewportPrimitiveProps,
|
|
12
16
|
Root as ToastRootPrimitive,
|
|
13
17
|
type ToastProps as ToastRootPrimitiveProps,
|
|
14
18
|
ToastTitle as ToastTitlePrimitive,
|
|
15
19
|
type ToastTitleProps as ToastTitlePrimitiveProps,
|
|
16
|
-
|
|
17
|
-
type
|
|
18
|
-
ToastAction as ToastActionPrimitive,
|
|
19
|
-
type ToastActionProps as ToastActionPrimitiveProps,
|
|
20
|
-
ToastClose as ToastClosePrimitive,
|
|
21
|
-
type ToastCloseProps as ToastClosePrimitiveProps,
|
|
20
|
+
ToastViewport as ToastViewportPrimitive,
|
|
21
|
+
type ToastViewportProps as ToastViewportPrimitiveProps,
|
|
22
22
|
} from '@radix-ui/react-toast';
|
|
23
|
-
import React, { type ComponentPropsWithRef,
|
|
23
|
+
import React, { type ComponentPropsWithRef, type FunctionComponent, forwardRef } from 'react';
|
|
24
24
|
|
|
25
25
|
import { useThemeContext } from '../../hooks';
|
|
26
26
|
import { type ThemedClassName } from '../../util';
|