@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.
Files changed (176) hide show
  1. package/dist/lib/browser/{chunk-WXW6KSRL.mjs → chunk-BKNGMGOK.mjs} +150 -153
  2. package/dist/lib/browser/chunk-BKNGMGOK.mjs.map +7 -0
  3. package/dist/lib/browser/index.mjs +2 -3
  4. package/dist/lib/browser/index.mjs.map +2 -2
  5. package/dist/lib/browser/meta.json +1 -1
  6. package/dist/lib/browser/testing/index.mjs +6 -7
  7. package/dist/lib/browser/testing/index.mjs.map +3 -3
  8. package/dist/lib/node-esm/{chunk-EQ7EG74H.mjs → chunk-D2HZS6F4.mjs} +150 -153
  9. package/dist/lib/node-esm/chunk-D2HZS6F4.mjs.map +7 -0
  10. package/dist/lib/node-esm/index.mjs +2 -3
  11. package/dist/lib/node-esm/index.mjs.map +2 -2
  12. package/dist/lib/node-esm/meta.json +1 -1
  13. package/dist/lib/node-esm/testing/index.mjs +6 -7
  14. package/dist/lib/node-esm/testing/index.mjs.map +3 -3
  15. package/dist/types/src/components/Avatars/Avatar.d.ts +1 -1
  16. package/dist/types/src/components/Avatars/Avatar.d.ts.map +1 -1
  17. package/dist/types/src/components/Avatars/Avatar.stories.d.ts +1 -1
  18. package/dist/types/src/components/Avatars/Avatar.stories.d.ts.map +1 -1
  19. package/dist/types/src/components/Avatars/AvatarGroup.stories.d.ts.map +1 -1
  20. package/dist/types/src/components/Breadcrumb/Breadcrumb.d.ts +1 -1
  21. package/dist/types/src/components/Breadcrumb/Breadcrumb.d.ts.map +1 -1
  22. package/dist/types/src/components/Breadcrumb/Breadcrumb.stories.d.ts.map +1 -1
  23. package/dist/types/src/components/Buttons/Button.d.ts.map +1 -1
  24. package/dist/types/src/components/Buttons/Button.stories.d.ts +1 -1
  25. package/dist/types/src/components/Buttons/Button.stories.d.ts.map +1 -1
  26. package/dist/types/src/components/Buttons/IconButton.d.ts +1 -1
  27. package/dist/types/src/components/Buttons/IconButton.d.ts.map +1 -1
  28. package/dist/types/src/components/Buttons/IconButton.stories.d.ts.map +1 -1
  29. package/dist/types/src/components/Buttons/Toggle.stories.d.ts.map +1 -1
  30. package/dist/types/src/components/Buttons/ToggleGroup.d.ts +1 -1
  31. package/dist/types/src/components/Buttons/ToggleGroup.d.ts.map +1 -1
  32. package/dist/types/src/components/Buttons/ToggleGroup.stories.d.ts.map +1 -1
  33. package/dist/types/src/components/Clipboard/ClipboardProvider.d.ts.map +1 -1
  34. package/dist/types/src/components/Clipboard/CopyButton.d.ts +4 -5
  35. package/dist/types/src/components/Clipboard/CopyButton.d.ts.map +1 -1
  36. package/dist/types/src/components/Clipboard/index.d.ts +2 -3
  37. package/dist/types/src/components/Clipboard/index.d.ts.map +1 -1
  38. package/dist/types/src/components/DensityProvider/DensityProvider.d.ts.map +1 -1
  39. package/dist/types/src/components/Dialogs/AlertDialog.d.ts +1 -1
  40. package/dist/types/src/components/Dialogs/AlertDialog.d.ts.map +1 -1
  41. package/dist/types/src/components/Dialogs/AlertDialog.stories.d.ts.map +1 -1
  42. package/dist/types/src/components/Dialogs/Dialog.d.ts +1 -1
  43. package/dist/types/src/components/Dialogs/Dialog.d.ts.map +1 -1
  44. package/dist/types/src/components/Dialogs/Dialog.stories.d.ts.map +1 -1
  45. package/dist/types/src/components/ElevationProvider/ElevationProvider.d.ts.map +1 -1
  46. package/dist/types/src/components/Input/Input.d.ts +2 -2
  47. package/dist/types/src/components/Input/Input.d.ts.map +1 -1
  48. package/dist/types/src/components/Input/Input.stories.d.ts +2 -2
  49. package/dist/types/src/components/Input/Input.stories.d.ts.map +1 -1
  50. package/dist/types/src/components/Link/Link.stories.d.ts.map +1 -1
  51. package/dist/types/src/components/Lists/List.d.ts +2 -2
  52. package/dist/types/src/components/Lists/List.d.ts.map +1 -1
  53. package/dist/types/src/components/Lists/List.stories.d.ts.map +1 -1
  54. package/dist/types/src/components/Lists/Tree.d.ts +1 -1
  55. package/dist/types/src/components/Lists/Tree.d.ts.map +1 -1
  56. package/dist/types/src/components/Lists/Tree.stories.d.ts.map +1 -1
  57. package/dist/types/src/components/Lists/Treegrid.d.ts +1 -1
  58. package/dist/types/src/components/Lists/Treegrid.d.ts.map +1 -1
  59. package/dist/types/src/components/Lists/Treegrid.stories.d.ts.map +1 -1
  60. package/dist/types/src/components/Main/Main.d.ts +1 -1
  61. package/dist/types/src/components/Main/Main.d.ts.map +1 -1
  62. package/dist/types/src/components/Main/Main.stories.d.ts.map +1 -1
  63. package/dist/types/src/components/Menus/ContextMenu.stories.d.ts.map +1 -1
  64. package/dist/types/src/components/Menus/DropdownMenu.d.ts +1 -1
  65. package/dist/types/src/components/Menus/DropdownMenu.d.ts.map +1 -1
  66. package/dist/types/src/components/Menus/DropdownMenu.stories.d.ts.map +1 -1
  67. package/dist/types/src/components/Message/Message.d.ts +1 -1
  68. package/dist/types/src/components/Message/Message.d.ts.map +1 -1
  69. package/dist/types/src/components/Message/Message.stories.d.ts.map +1 -1
  70. package/dist/types/src/components/Popover/Popover.d.ts +2 -2
  71. package/dist/types/src/components/Popover/Popover.d.ts.map +1 -1
  72. package/dist/types/src/components/Popover/Popover.stories.d.ts.map +1 -1
  73. package/dist/types/src/components/ScrollArea/ScrollArea.d.ts +1 -1
  74. package/dist/types/src/components/ScrollArea/ScrollArea.d.ts.map +1 -1
  75. package/dist/types/src/components/ScrollArea/ScrollArea.stories.d.ts.map +1 -1
  76. package/dist/types/src/components/Select/Select.d.ts.map +1 -1
  77. package/dist/types/src/components/Select/Select.stories.d.ts +1 -1
  78. package/dist/types/src/components/Select/Select.stories.d.ts.map +1 -1
  79. package/dist/types/src/components/Status/Status.stories.d.ts.map +1 -1
  80. package/dist/types/src/components/Tag/Tag.stories.d.ts.map +1 -1
  81. package/dist/types/src/components/ThemeProvider/ThemeProvider.d.ts +2 -2
  82. package/dist/types/src/components/ThemeProvider/ThemeProvider.d.ts.map +1 -1
  83. package/dist/types/src/components/ThemeProvider/TranslationsProvider.d.ts +1 -1
  84. package/dist/types/src/components/ThemeProvider/TranslationsProvider.d.ts.map +1 -1
  85. package/dist/types/src/components/ThemeProvider/index.d.ts +1 -1
  86. package/dist/types/src/components/ThemeProvider/index.d.ts.map +1 -1
  87. package/dist/types/src/components/Toast/Toast.d.ts +1 -1
  88. package/dist/types/src/components/Toast/Toast.d.ts.map +1 -1
  89. package/dist/types/src/components/Toast/Toast.stories.d.ts.map +1 -1
  90. package/dist/types/src/components/Toolbar/Toolbar.d.ts +1 -1
  91. package/dist/types/src/components/Toolbar/Toolbar.d.ts.map +1 -1
  92. package/dist/types/src/components/Toolbar/Toolbar.stories.d.ts.map +1 -1
  93. package/dist/types/src/components/Tooltip/Tooltip.d.ts +1 -1
  94. package/dist/types/src/components/Tooltip/Tooltip.d.ts.map +1 -1
  95. package/dist/types/src/components/Tooltip/Tooltip.stories.d.ts.map +1 -1
  96. package/dist/types/src/index.d.ts +2 -2
  97. package/dist/types/src/index.d.ts.map +1 -1
  98. package/dist/types/src/playground/Controls.stories.d.ts.map +1 -1
  99. package/dist/types/src/playground/Custom.stories.d.ts +1 -1
  100. package/dist/types/src/playground/Custom.stories.d.ts.map +1 -1
  101. package/dist/types/src/testing/decorators/withTheme.d.ts.map +1 -1
  102. package/dist/types/src/util/index.d.ts +1 -1
  103. package/dist/types/src/util/index.d.ts.map +1 -1
  104. package/dist/types/tsconfig.tsbuildinfo +1 -1
  105. package/package.json +16 -14
  106. package/src/components/Avatars/Avatar.stories.tsx +2 -1
  107. package/src/components/Avatars/Avatar.tsx +3 -3
  108. package/src/components/Avatars/AvatarGroup.stories.tsx +2 -1
  109. package/src/components/Breadcrumb/Breadcrumb.stories.tsx +2 -1
  110. package/src/components/Breadcrumb/Breadcrumb.tsx +3 -3
  111. package/src/components/Buttons/Button.stories.tsx +6 -5
  112. package/src/components/Buttons/Button.tsx +1 -0
  113. package/src/components/Buttons/IconButton.stories.tsx +2 -1
  114. package/src/components/Buttons/IconButton.tsx +3 -2
  115. package/src/components/Buttons/Toggle.stories.tsx +4 -3
  116. package/src/components/Buttons/ToggleGroup.stories.tsx +5 -4
  117. package/src/components/Buttons/ToggleGroup.tsx +3 -3
  118. package/src/components/Clipboard/ClipboardProvider.tsx +1 -1
  119. package/src/components/Clipboard/CopyButton.tsx +13 -14
  120. package/src/components/DensityProvider/DensityProvider.tsx +1 -1
  121. package/src/components/Dialogs/AlertDialog.stories.tsx +2 -1
  122. package/src/components/Dialogs/AlertDialog.tsx +13 -13
  123. package/src/components/Dialogs/Dialog.stories.tsx +2 -1
  124. package/src/components/Dialogs/Dialog.tsx +13 -13
  125. package/src/components/ElevationProvider/ElevationProvider.tsx +1 -1
  126. package/src/components/Input/Input.stories.tsx +5 -4
  127. package/src/components/Input/Input.tsx +13 -13
  128. package/src/components/Link/Link.stories.tsx +2 -1
  129. package/src/components/Lists/List.stories.tsx +9 -8
  130. package/src/components/Lists/List.tsx +14 -18
  131. package/src/components/Lists/Tree.stories.tsx +2 -1
  132. package/src/components/Lists/Tree.tsx +4 -3
  133. package/src/components/Lists/TreeDropIndicator.tsx +1 -1
  134. package/src/components/Lists/Treegrid.stories.tsx +2 -1
  135. package/src/components/Lists/Treegrid.tsx +2 -2
  136. package/src/components/Main/Main.stories.tsx +2 -1
  137. package/src/components/Main/Main.tsx +7 -6
  138. package/src/components/Menus/ContextMenu.stories.tsx +2 -1
  139. package/src/components/Menus/DropdownMenu.stories.tsx +2 -1
  140. package/src/components/Menus/DropdownMenu.tsx +8 -8
  141. package/src/components/Message/Message.stories.tsx +2 -1
  142. package/src/components/Message/Message.tsx +1 -1
  143. package/src/components/Popover/Popover.stories.tsx +2 -1
  144. package/src/components/Popover/Popover.tsx +8 -8
  145. package/src/components/ScrollArea/ScrollArea.stories.tsx +2 -1
  146. package/src/components/ScrollArea/ScrollArea.tsx +4 -4
  147. package/src/components/Select/Select.stories.tsx +3 -2
  148. package/src/components/Select/Select.tsx +3 -4
  149. package/src/components/Status/Status.stories.tsx +2 -1
  150. package/src/components/Tag/Tag.stories.tsx +2 -1
  151. package/src/components/ThemeProvider/ThemeProvider.tsx +4 -4
  152. package/src/components/ThemeProvider/TranslationsProvider.tsx +4 -4
  153. package/src/components/ThemeProvider/index.ts +3 -1
  154. package/src/components/Toast/Toast.stories.tsx +2 -1
  155. package/src/components/Toast/Toast.tsx +9 -9
  156. package/src/components/Toolbar/Toolbar.stories.tsx +10 -9
  157. package/src/components/Toolbar/Toolbar.tsx +2 -2
  158. package/src/components/Tooltip/Tooltip.stories.tsx +2 -1
  159. package/src/components/Tooltip/Tooltip.tsx +3 -3
  160. package/src/hooks/useSafeCollisionPadding.ts +1 -1
  161. package/src/index.ts +2 -2
  162. package/src/playground/Controls.stories.tsx +9 -10
  163. package/src/playground/Custom.stories.tsx +2 -2
  164. package/src/testing/decorators/withSurfaceVariantsLayout.tsx +1 -1
  165. package/src/testing/decorators/withTheme.ts +8 -5
  166. package/src/util/index.ts +1 -1
  167. package/README.yml +0 -1
  168. package/dist/lib/browser/chunk-WXW6KSRL.mjs.map +0 -7
  169. package/dist/lib/node/chunk-3E3QKWX4.cjs +0 -4363
  170. package/dist/lib/node/chunk-3E3QKWX4.cjs.map +0 -7
  171. package/dist/lib/node/index.cjs +0 -175
  172. package/dist/lib/node/index.cjs.map +0 -7
  173. package/dist/lib/node/meta.json +0 -1
  174. package/dist/lib/node/testing/index.cjs +0 -114
  175. package/dist/lib/node/testing/index.cjs.map +0 -7
  176. 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 { arrayMove, SortableContext, useSortable, verticalListSortingStrategy } from '@dnd-kit/sortable';
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
- <DotsSixVertical className={mx(getSize(5), 'mbs-2.5')} />
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
- <PushPin className={mx(getSize(5), 'mbs-2.5')} />
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
- <DotsSixVertical className={mx(getSize(5), 'mbs-2.5')} />
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
- <PushPin className={mx(getSize(5), 'mbs-2.5')} />
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
- <PushPin className={mx(getSize(5), 'mbs-2.5')} />
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, forwardRef, type ForwardRefExoticComponent } from 'react';
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
- type ListProps as ListPrimitiveProps,
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 ListItemScopedProps,
22
- LIST_NAME,
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 Icon = open ? CaretDown : CaretRight;
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
  );
@@ -6,9 +6,10 @@ import '@dxos-theme';
6
6
 
7
7
  import React from 'react';
8
8
 
9
- import { Tree, TreeItem } from './Tree';
10
9
  import { withTheme } from '../../testing';
11
10
 
11
+ import { Tree, TreeItem } from './Tree';
12
+
12
13
  type StorybookTreeProps = {
13
14
  data: any;
14
15
  };
@@ -2,9 +2,12 @@
2
2
  // Copyright 2023 DXOS.org
3
3
  //
4
4
 
5
- import React, { type ComponentPropsWithoutRef, type FC, forwardRef, type ForwardRefExoticComponent } from 'react';
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 HTMLAttributes, type CSSProperties } from 'react';
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 { createContextScope, type Scope } from '@radix-ui/react-context';
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 ComponentPropsWithRef, type CSSProperties, forwardRef } from 'react';
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, DialogContent, DialogTitle } from '@radix-ui/react-dialog';
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
- forwardRef,
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 { useMediaQuery, useForwardedRef } from '@dxos/react-hooks';
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
- useEffect,
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 MessageValence, type Elevation } from '@dxos/react-ui-types';
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 { Scope } from '@radix-ui/react-context';
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
- forwardRef,
25
+ type ComponentPropsWithoutRef,
26
26
  type ElementRef,
27
- type RefObject,
27
+ type FC,
28
+ type MutableRefObject,
28
29
  type ReactNode,
29
- useRef,
30
+ type RefObject,
31
+ forwardRef,
30
32
  useCallback,
31
- type ComponentPropsWithoutRef,
32
- type FC,
33
- useState,
34
33
  useEffect,
35
- type MutableRefObject,
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
- Corner as ScrollAreaPrimitiveCorner,
15
- type ScrollAreaCornerProps as ScrollAreaPrimitiveCornerProps,
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
- <CaretDown className={tx('select.triggerIcon', 'select__trigger__icon', {})} weight='bold' />
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 ?? <CaretUp weight='bold' />}
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 ?? <CaretDown weight='bold' />}
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, { createContext, type PropsWithChildren, useEffect, useMemo } from '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
- export type ThemeMode = 'light' | 'dark';
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, type Locale } from 'date-fns/locale';
6
- import i18Next, { type TFunction, type Resource } from 'i18next';
7
- import React, { type ReactNode, useEffect, createContext, useState, Suspense, useContext } from 'react';
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, isLabel } from './TranslationsProvider';
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
- ToastDescription as ToastDescriptionPrimitive,
17
- type ToastDescriptionProps as ToastDescriptionPrimitiveProps,
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, forwardRef, type FunctionComponent } from 'react';
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';