@dxos/react-ui-stack 0.8.4-main.3c1ae3b → 0.8.4-main.3eb6e50203

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 (104) hide show
  1. package/dist/lib/browser/index.mjs +920 -57
  2. package/dist/lib/browser/index.mjs.map +4 -4
  3. package/dist/lib/browser/meta.json +1 -1
  4. package/dist/lib/node-esm/index.mjs +921 -57
  5. package/dist/lib/node-esm/index.mjs.map +4 -4
  6. package/dist/lib/node-esm/meta.json +1 -1
  7. package/dist/types/src/{exemplars → components}/CardStack/CardStack.d.ts +15 -10
  8. package/dist/types/src/components/CardStack/CardStack.d.ts.map +1 -0
  9. package/dist/types/src/components/CardStack/CardStack.stories.d.ts.map +1 -0
  10. package/dist/types/src/{exemplars → components}/CardStack/CardStackDragPreview.d.ts +4 -1
  11. package/dist/types/src/components/CardStack/CardStackDragPreview.d.ts.map +1 -0
  12. package/dist/types/src/components/CardStack/index.d.ts.map +1 -0
  13. package/dist/types/src/components/Stack/Stack.d.ts +1 -1
  14. package/dist/types/src/components/Stack/Stack.d.ts.map +1 -1
  15. package/dist/types/src/components/StackContext.d.ts +1 -1
  16. package/dist/types/src/components/StackContext.d.ts.map +1 -1
  17. package/dist/types/src/components/StackItem/StackItem.d.ts +5 -9
  18. package/dist/types/src/components/StackItem/StackItem.d.ts.map +1 -1
  19. package/dist/types/src/components/StackItem/StackItem.stories.d.ts.map +1 -1
  20. package/dist/types/src/components/StackItem/StackItemContent.d.ts +2 -45
  21. package/dist/types/src/components/StackItem/StackItemContent.d.ts.map +1 -1
  22. package/dist/types/src/components/StackItem/StackItemSigil.d.ts +2 -2
  23. package/dist/types/src/components/StackItem/StackItemSigil.d.ts.map +1 -1
  24. package/dist/types/src/components/deprecated/LayoutControls.d.ts +3 -0
  25. package/dist/types/src/components/deprecated/LayoutControls.d.ts.map +1 -1
  26. package/dist/types/src/components/index.d.ts +2 -2
  27. package/dist/types/src/components/index.d.ts.map +1 -1
  28. package/dist/types/src/components/{defs.d.ts → types.d.ts} +1 -1
  29. package/dist/types/src/components/types.d.ts.map +1 -0
  30. package/dist/types/src/hooks/useStackDropForElements.d.ts +7 -5
  31. package/dist/types/src/hooks/useStackDropForElements.d.ts.map +1 -1
  32. package/dist/types/src/index.d.ts +0 -1
  33. package/dist/types/src/index.d.ts.map +1 -1
  34. package/dist/types/src/translations.d.ts +2 -2
  35. package/dist/types/src/translations.d.ts.map +1 -1
  36. package/dist/types/tsconfig.tsbuildinfo +1 -1
  37. package/package.json +40 -37
  38. package/src/{exemplars → components}/CardStack/CardStack.stories.tsx +9 -9
  39. package/src/{exemplars → components}/CardStack/CardStack.tsx +19 -5
  40. package/src/{exemplars → components}/CardStack/CardStackDragPreview.tsx +12 -9
  41. package/src/components/Stack/Stack.stories.tsx +2 -2
  42. package/src/components/Stack/Stack.tsx +3 -2
  43. package/src/components/StackContext.tsx +1 -1
  44. package/src/components/StackItem/StackItem.stories.tsx +5 -3
  45. package/src/components/StackItem/StackItem.tsx +24 -12
  46. package/src/components/StackItem/StackItemContent.tsx +19 -50
  47. package/src/components/StackItem/StackItemHeading.tsx +1 -1
  48. package/src/components/StackItem/StackItemSigil.tsx +3 -3
  49. package/src/components/deprecated/LayoutControls.tsx +3 -0
  50. package/src/components/index.ts +2 -2
  51. package/src/hooks/useStackDropForElements.ts +17 -10
  52. package/src/index.ts +0 -3
  53. package/src/playwright/playwright.config.ts +1 -1
  54. package/src/translations.ts +1 -1
  55. package/dist/lib/browser/chunk-6YJ6CHWV.mjs +0 -1483
  56. package/dist/lib/browser/chunk-6YJ6CHWV.mjs.map +0 -7
  57. package/dist/lib/browser/testing/index.mjs +0 -31
  58. package/dist/lib/browser/testing/index.mjs.map +0 -7
  59. package/dist/lib/node-esm/chunk-KCFYDRBZ.mjs +0 -1485
  60. package/dist/lib/node-esm/chunk-KCFYDRBZ.mjs.map +0 -7
  61. package/dist/lib/node-esm/testing/index.mjs +0 -32
  62. package/dist/lib/node-esm/testing/index.mjs.map +0 -7
  63. package/dist/types/src/components/Image/Image.d.ts +0 -14
  64. package/dist/types/src/components/Image/Image.d.ts.map +0 -1
  65. package/dist/types/src/components/Image/Image.stories.d.ts +0 -33
  66. package/dist/types/src/components/Image/Image.stories.d.ts.map +0 -1
  67. package/dist/types/src/components/Image/index.d.ts +0 -2
  68. package/dist/types/src/components/Image/index.d.ts.map +0 -1
  69. package/dist/types/src/components/defs.d.ts.map +0 -1
  70. package/dist/types/src/exemplars/Card/Card.d.ts +0 -71
  71. package/dist/types/src/exemplars/Card/Card.d.ts.map +0 -1
  72. package/dist/types/src/exemplars/Card/Card.stories.d.ts +0 -21
  73. package/dist/types/src/exemplars/Card/Card.stories.d.ts.map +0 -1
  74. package/dist/types/src/exemplars/Card/CardDragPreview.d.ts +0 -6
  75. package/dist/types/src/exemplars/Card/CardDragPreview.d.ts.map +0 -1
  76. package/dist/types/src/exemplars/Card/fragments.d.ts +0 -13
  77. package/dist/types/src/exemplars/Card/fragments.d.ts.map +0 -1
  78. package/dist/types/src/exemplars/Card/index.d.ts +0 -4
  79. package/dist/types/src/exemplars/Card/index.d.ts.map +0 -1
  80. package/dist/types/src/exemplars/CardStack/CardStack.d.ts.map +0 -1
  81. package/dist/types/src/exemplars/CardStack/CardStack.stories.d.ts.map +0 -1
  82. package/dist/types/src/exemplars/CardStack/CardStackDragPreview.d.ts.map +0 -1
  83. package/dist/types/src/exemplars/CardStack/index.d.ts.map +0 -1
  84. package/dist/types/src/exemplars/index.d.ts +0 -3
  85. package/dist/types/src/exemplars/index.d.ts.map +0 -1
  86. package/dist/types/src/testing/CardContainer.d.ts +0 -6
  87. package/dist/types/src/testing/CardContainer.d.ts.map +0 -1
  88. package/dist/types/src/testing/index.d.ts +0 -2
  89. package/dist/types/src/testing/index.d.ts.map +0 -1
  90. package/src/components/Image/Image.stories.tsx +0 -84
  91. package/src/components/Image/Image.tsx +0 -222
  92. package/src/components/Image/index.ts +0 -5
  93. package/src/exemplars/Card/Card.stories.tsx +0 -64
  94. package/src/exemplars/Card/Card.tsx +0 -212
  95. package/src/exemplars/Card/CardDragPreview.tsx +0 -22
  96. package/src/exemplars/Card/fragments.ts +0 -24
  97. package/src/exemplars/Card/index.ts +0 -7
  98. package/src/exemplars/index.ts +0 -6
  99. package/src/testing/CardContainer.tsx +0 -37
  100. package/src/testing/index.ts +0 -5
  101. /package/dist/types/src/{exemplars → components}/CardStack/CardStack.stories.d.ts +0 -0
  102. /package/dist/types/src/{exemplars → components}/CardStack/index.d.ts +0 -0
  103. /package/src/{exemplars → components}/CardStack/index.ts +0 -0
  104. /package/src/components/{defs.ts → types.ts} +0 -0
package/package.json CHANGED
@@ -1,12 +1,16 @@
1
1
  {
2
2
  "name": "@dxos/react-ui-stack",
3
- "version": "0.8.4-main.3c1ae3b",
3
+ "version": "0.8.4-main.3eb6e50203",
4
4
  "description": "A stack component.",
5
5
  "homepage": "https://dxos.org",
6
6
  "bugs": "https://github.com/dxos/dxos/issues",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "https://github.com/dxos/dxos"
10
+ },
7
11
  "license": "MIT",
8
12
  "author": "DXOS.org",
9
- "sideEffects": true,
13
+ "sideEffects": false,
10
14
  "type": "module",
11
15
  "exports": {
12
16
  ".": {
@@ -18,11 +22,6 @@
18
22
  "types": "./dist/types/src/playwright/index.d.ts",
19
23
  "browser": "./dist/lib/browser/playwright/index.mjs",
20
24
  "node": "./dist/lib/node-esm/playwright/index.mjs"
21
- },
22
- "./testing": {
23
- "types": "./dist/types/src/testing/index.d.ts",
24
- "browser": "./dist/lib/browser/testing/index.mjs",
25
- "node": "./dist/lib/node-esm/testing/index.mjs"
26
25
  }
27
26
  },
28
27
  "types": "dist/types/src/index.d.ts",
@@ -41,11 +40,11 @@
41
40
  "src"
42
41
  ],
43
42
  "dependencies": {
44
- "@atlaskit/pragmatic-drag-and-drop": "^1.4.0",
45
- "@atlaskit/pragmatic-drag-and-drop-auto-scroll": "^2.1.0",
46
- "@atlaskit/pragmatic-drag-and-drop-hitbox": "^1.0.3",
47
- "@fluentui/react-tabster": "^9.24.2",
48
- "@preact-signals/safe-react": "^0.9.0",
43
+ "@atlaskit/pragmatic-drag-and-drop": "1.7.7",
44
+ "@atlaskit/pragmatic-drag-and-drop-auto-scroll": "^2.1.2",
45
+ "@atlaskit/pragmatic-drag-and-drop-hitbox": "1.1.0",
46
+ "@atlaskit/pragmatic-drag-and-drop-react-drop-indicator": "3.2.10",
47
+ "@fluentui/react-tabster": "9.26.11",
49
48
  "@radix-ui/primitive": "1.1.1",
50
49
  "@radix-ui/react-compose-refs": "1.1.1",
51
50
  "@radix-ui/react-context": "1.1.1",
@@ -54,36 +53,40 @@
54
53
  "@radix-ui/react-slot": "1.1.2",
55
54
  "@radix-ui/react-use-controllable-state": "1.1.0",
56
55
  "react-resize-detector": "^11.0.1",
57
- "@dxos/echo": "0.8.4-main.3c1ae3b",
58
- "@dxos/keyboard": "0.8.4-main.3c1ae3b",
59
- "@dxos/live-object": "0.8.4-main.3c1ae3b",
60
- "@dxos/react-ui-dnd": "0.8.4-main.3c1ae3b",
61
- "@dxos/util": "0.8.4-main.3c1ae3b",
62
- "@dxos/react-ui-attention": "0.8.4-main.3c1ae3b",
63
- "@dxos/storybook-utils": "0.8.4-main.3c1ae3b"
56
+ "@dxos/echo": "0.8.4-main.3eb6e50203",
57
+ "@dxos/keyboard": "0.8.4-main.3eb6e50203",
58
+ "@dxos/react-ui-attention": "0.8.4-main.3eb6e50203",
59
+ "@dxos/react-ui-dnd": "0.8.4-main.3eb6e50203",
60
+ "@dxos/react-ui-mosaic": "0.8.4-main.3eb6e50203",
61
+ "@dxos/util": "0.8.4-main.3eb6e50203"
64
62
  },
65
63
  "devDependencies": {
66
- "@types/react": "~19.2.2",
67
- "@types/react-dom": "~19.2.2",
68
- "react": "~19.2.0",
69
- "react-dom": "~19.2.0",
64
+ "@types/react": "~19.2.7",
65
+ "@types/react-dom": "~19.2.3",
66
+ "react": "~19.2.3",
67
+ "react-dom": "~19.2.3",
70
68
  "vite": "7.1.9",
71
- "@dxos/app-graph": "0.8.4-main.3c1ae3b",
72
- "@dxos/client": "0.8.4-main.3c1ae3b",
73
- "@dxos/echo": "0.8.4-main.3c1ae3b",
74
- "@dxos/random": "0.8.4-main.3c1ae3b",
75
- "@dxos/react-ui": "0.8.4-main.3c1ae3b",
76
- "@dxos/react-ui-theme": "0.8.4-main.3c1ae3b",
77
- "@dxos/storybook-utils": "0.8.4-main.3c1ae3b",
78
- "@dxos/test-utils": "0.8.4-main.3c1ae3b"
69
+ "@dxos/app-framework": "0.8.4-main.3eb6e50203",
70
+ "@dxos/app-graph": "0.8.4-main.3eb6e50203",
71
+ "@dxos/echo-db": "0.8.4-main.3eb6e50203",
72
+ "@dxos/echo": "0.8.4-main.3eb6e50203",
73
+ "@dxos/client": "0.8.4-main.3eb6e50203",
74
+ "@dxos/react-client": "0.8.4-main.3eb6e50203",
75
+ "@dxos/random": "0.8.4-main.3eb6e50203",
76
+ "@dxos/react-ui": "0.8.4-main.3eb6e50203",
77
+ "@dxos/storybook-utils": "0.8.4-main.3eb6e50203",
78
+ "@dxos/test-utils": "0.8.4-main.3eb6e50203",
79
+ "@dxos/schema": "0.8.4-main.3eb6e50203",
80
+ "@dxos/types": "0.8.4-main.3eb6e50203",
81
+ "@dxos/ui-theme": "0.8.4-main.3eb6e50203"
79
82
  },
80
83
  "peerDependencies": {
81
- "react": "^19.0.0",
82
- "react-dom": "^19.0.0",
83
- "@dxos/client": "0.8.4-main.3c1ae3b",
84
- "@dxos/random": "0.8.4-main.3c1ae3b",
85
- "@dxos/react-ui": "0.8.4-main.3c1ae3b",
86
- "@dxos/react-ui-theme": "0.8.4-main.3c1ae3b"
84
+ "react": "~19.2.3",
85
+ "react-dom": "~19.2.3",
86
+ "@dxos/client": "0.8.4-main.3eb6e50203",
87
+ "@dxos/ui-theme": "0.8.4-main.3eb6e50203",
88
+ "@dxos/random": "0.8.4-main.3eb6e50203",
89
+ "@dxos/react-ui": "0.8.4-main.3eb6e50203"
87
90
  },
88
91
  "publishConfig": {
89
92
  "access": "public"
@@ -9,9 +9,9 @@ import React, { useCallback, useState } from 'react';
9
9
  import { faker } from '@dxos/random';
10
10
  import { IconButton } from '@dxos/react-ui';
11
11
  import { withTheme } from '@dxos/react-ui/testing';
12
+ import { Card, CardDragPreview } from '@dxos/react-ui-mosaic';
12
13
 
13
- import { StackItem } from '../../components';
14
- import { Card, CardDragPreview } from '../Card';
14
+ import { StackItem } from '../StackItem';
15
15
 
16
16
  import { CardStack } from './CardStack';
17
17
 
@@ -109,10 +109,10 @@ const CardStackStory = () => {
109
109
  prevSiblingId={prevCardId}
110
110
  nextSiblingId={nextCardId}
111
111
  >
112
- <Card.StaticRoot>
112
+ <Card.Root>
113
113
  <Card.Toolbar>
114
114
  <StackItem.DragHandle asChild>
115
- <Card.DragHandle toolbarItem />
115
+ <Card.DragHandle />
116
116
  </StackItem.DragHandle>
117
117
  <Card.ToolbarSeparator variant='gap' />
118
118
  <Card.ToolbarIconButton
@@ -125,18 +125,18 @@ const CardStackStory = () => {
125
125
  </Card.Toolbar>
126
126
  <Card.Poster alt={card.title} image={card.image} />
127
127
  <Card.Heading>{card.title}</Card.Heading>
128
- <Card.Text classNames='line-clamp-2'>{card.description}</Card.Text>
129
- </Card.StaticRoot>
128
+ <Card.Text variant='description'>{card.description}</Card.Text>
129
+ </Card.Root>
130
130
  <StackItem.DragPreview>
131
131
  {() => (
132
132
  <CardDragPreview.Root>
133
133
  <CardDragPreview.Content>
134
134
  <Card.Toolbar>
135
- <Card.DragHandle toolbarItem />
135
+ <Card.DragHandle />
136
136
  </Card.Toolbar>
137
137
  <Card.Poster alt={card.title} image={card.image} />
138
138
  <Card.Heading>{card.title}</Card.Heading>
139
- <Card.Text classNames='line-clamp-2'>{card.description}</Card.Text>
139
+ <Card.Text variant='description'>{card.description}</Card.Text>
140
140
  </CardDragPreview.Content>
141
141
  </CardDragPreview.Root>
142
142
  )}
@@ -160,7 +160,7 @@ const CardStackStory = () => {
160
160
  const meta = {
161
161
  title: 'ui/react-ui-stack/CardStack',
162
162
  component: CardStackStory,
163
- decorators: [withTheme],
163
+ decorators: [withTheme()],
164
164
  parameters: {
165
165
  layout: 'fullscreen',
166
166
  },
@@ -6,10 +6,15 @@ import { Slot } from '@radix-ui/react-slot';
6
6
  import React, { type ComponentPropsWithoutRef, forwardRef } from 'react';
7
7
 
8
8
  import type { ThemedClassName } from '@dxos/react-ui';
9
- import { mx } from '@dxos/react-ui-theme';
9
+ import { Card } from '@dxos/react-ui-mosaic';
10
+ import { cardDefaultInlineSize, mx } from '@dxos/ui-theme';
10
11
 
11
- import { Stack, type StackProps, railGridHorizontalContainFitContent } from '../../components';
12
- import { Card } from '../Card';
12
+ import { Stack, type StackProps, railGridHorizontalContainFitContent } from '../Stack';
13
+
14
+ /**
15
+ * This is `cardDefaultInlineSize` plus 2 times the sum of the inner and outer spacing applied by CardStack on the inline axis.
16
+ */
17
+ const cardStackDefaultInlineSizeRem = cardDefaultInlineSize + 2.125;
13
18
 
14
19
  //
15
20
  // Root
@@ -17,7 +22,6 @@ import { Card } from '../Card';
17
22
 
18
23
  const cardStackRoot = 'flex flex-col';
19
24
 
20
- // TODO(burdon): Root should be headless.
21
25
  const CardStackRoot = forwardRef<HTMLDivElement, SharedCardStackProps>(
22
26
  ({ children, classNames, asChild, role = 'none', ...props }, forwardedRef) => {
23
27
  const Root = asChild ? Slot : 'div';
@@ -168,6 +172,9 @@ const CardStackDragHandle = Card.DragHandle;
168
172
  // CardStack
169
173
  //
170
174
 
175
+ /**
176
+ * @deprecated Replace with Mosaic.Stack.
177
+ */
171
178
  export const CardStack = {
172
179
  Root: CardStackRoot,
173
180
  Content: CardStackContent,
@@ -178,4 +185,11 @@ export const CardStack = {
178
185
  Item: CardStackItem,
179
186
  };
180
187
 
181
- export { cardStackRoot, cardStackFooter, cardStackHeading, cardStackContent, cardStackItem };
188
+ export {
189
+ cardStackRoot,
190
+ cardStackFooter,
191
+ cardStackHeading,
192
+ cardStackContent,
193
+ cardStackItem,
194
+ cardStackDefaultInlineSizeRem,
195
+ };
@@ -4,11 +4,11 @@
4
4
 
5
5
  import React, { type PropsWithChildren } from 'react';
6
6
 
7
- import { IconButton, useTranslation } from '@dxos/react-ui';
8
- import { mx } from '@dxos/react-ui-theme';
7
+ import { IconButton, ScrollArea, useTranslation } from '@dxos/react-ui';
8
+ import { mx } from '@dxos/ui-theme';
9
9
 
10
- import { type StackProps } from '../../components';
11
10
  import { translationKey } from '../../translations';
11
+ import { type StackProps } from '../Stack';
12
12
 
13
13
  const CardStackDragPreviewRoot = ({ children }: PropsWithChildren<{}>) => {
14
14
  return (
@@ -41,18 +41,21 @@ const CardStackDragPreviewContent = ({
41
41
  itemsCount = 0,
42
42
  }: PropsWithChildren<Pick<StackProps, 'itemsCount'>>) => {
43
43
  return (
44
- <div
45
- className={mx('overflow-y-auto flex-1 pli-2 flex flex-col gap-2', 'plb-1', itemsCount > 0 ? 'plb-2' : 'plb-1')}
46
- >
47
- {children}
48
- </div>
44
+ <ScrollArea.Root orientation='vertical'>
45
+ <ScrollArea.Viewport classNames={mx('pli-2 plb-1 gap-2', itemsCount > 0 ? 'plb-2' : 'plb-1')}>
46
+ {children}
47
+ </ScrollArea.Viewport>
48
+ </ScrollArea.Root>
49
49
  );
50
50
  };
51
51
 
52
52
  const CardStackDragPreviewFooter = ({ children }: PropsWithChildren<{}>) => {
53
- return <div className='p-2 border-t border-separator'>{children}</div>;
53
+ return <div className='p-2 border-bs border-separator'>{children}</div>;
54
54
  };
55
55
 
56
+ /**
57
+ * @deprecated
58
+ */
56
59
  export const CardStackDragPreview = {
57
60
  Root: CardStackDragPreviewRoot,
58
61
  Heading: CardStackDragPreviewHeading,
@@ -9,8 +9,8 @@ import React, { useCallback, useState } from 'react';
9
9
  import { faker } from '@dxos/random';
10
10
  import { withTheme } from '@dxos/react-ui/testing';
11
11
 
12
- import { type StackItemData } from '../defs';
13
12
  import { StackItem } from '../StackItem';
13
+ import { type StackItemData } from '../types';
14
14
 
15
15
  import { Stack } from './Stack';
16
16
 
@@ -132,7 +132,7 @@ const meta = {
132
132
  title: 'ui/react-ui-stack/Stack',
133
133
  component: DefaultStory,
134
134
  argTypes: { orientation: { control: 'radio', options: ['horizontal', 'vertical'] } },
135
- decorators: [withTheme],
135
+ decorators: [withTheme()],
136
136
  } satisfies Meta<typeof DefaultStory>;
137
137
 
138
138
  export default meta;
@@ -17,11 +17,11 @@ import React, {
17
17
  } from 'react';
18
18
 
19
19
  import { ListItem, type ThemedClassName, useId } from '@dxos/react-ui';
20
- import { mx } from '@dxos/react-ui-theme';
20
+ import { mx } from '@dxos/ui-theme';
21
21
 
22
22
  import { useStackDropForElements } from '../../hooks';
23
- import { type StackContextValue } from '../defs';
24
23
  import { StackContext } from '../StackContext';
24
+ import { type StackContextValue } from '../types';
25
25
 
26
26
  export type Orientation = 'horizontal' | 'vertical';
27
27
 
@@ -195,6 +195,7 @@ export const Stack = forwardRef<HTMLDivElement, StackProps>(
195
195
  scrollIntoViewAndFocus(adjacentItem, closestStackOrientation);
196
196
  }
197
197
  }
198
+
198
199
  if (perpendicularDelta !== 0) {
199
200
  if (ancestorStack && ancestorOrientation !== closestStackOrientation) {
200
201
  const siblingStacks = Array.from(
@@ -4,8 +4,8 @@
4
4
 
5
5
  import { createContext, useContext } from 'react';
6
6
 
7
- import { type StackItemRearrangeHandler, type StackItemSize } from './defs';
8
7
  import { type Orientation, type Size } from './Stack';
8
+ import { type StackItemRearrangeHandler, type StackItemSize } from './types';
9
9
 
10
10
  export type StackContextValue = {
11
11
  orientation: Orientation;
@@ -13,7 +13,7 @@ import { StackItem, type StackItemRootProps } from './StackItem';
13
13
  const DefaultStory = (props: StackItemRootProps) => {
14
14
  return (
15
15
  <StackItem.Root role='section' {...props} classNames='is-[20rem] border border-separator'>
16
- <StackItem.Heading>
16
+ <StackItem.Heading classNames='is-full border-be border-separator'>
17
17
  <span className='sr-only'>Title</span>
18
18
  <div role='none' className='sticky -block-start-px bg-[--sticky-bg] p-1 is-full'>
19
19
  <DropdownMenu.Root>
@@ -25,7 +25,9 @@ const DefaultStory = (props: StackItemRootProps) => {
25
25
  </DropdownMenu.Root>
26
26
  </div>
27
27
  </StackItem.Heading>
28
- <StackItem.Content>Content</StackItem.Content>
28
+ <StackItem.Content>
29
+ <div className='p-4 text-center'>Content</div>
30
+ </StackItem.Content>
29
31
  </StackItem.Root>
30
32
  );
31
33
  };
@@ -34,7 +36,7 @@ const meta = {
34
36
  title: 'ui/react-ui-stack/StackItem',
35
37
  component: StackItem.Root as any,
36
38
  render: DefaultStory,
37
- decorators: [withTheme],
39
+ decorators: [withTheme()],
38
40
  parameters: {
39
41
  layout: 'centered',
40
42
  },
@@ -26,10 +26,10 @@ import { createPortal } from 'react-dom';
26
26
 
27
27
  import { ListItem, type ThemedClassName } from '@dxos/react-ui';
28
28
  import { resizeAttributes, sizeStyle } from '@dxos/react-ui-dnd';
29
- import { mx } from '@dxos/react-ui-theme';
29
+ import { mx } from '@dxos/ui-theme';
30
30
 
31
- import { type StackItemData, type StackItemSize } from '../defs';
32
31
  import { type ItemDragState, StackItemContext, idle, useStack, useStackItem } from '../StackContext';
32
+ import { type StackItemData, type StackItemSize } from '../types';
33
33
 
34
34
  import { StackItemContent, type StackItemContentProps } from './StackItemContent';
35
35
  import { StackItemDragHandle, type StackItemDragHandleProps } from './StackItemDragHandle';
@@ -54,6 +54,10 @@ export const DEFAULT_HORIZONTAL_SIZE = 48 satisfies StackItemSize;
54
54
  export const DEFAULT_VERTICAL_SIZE = 'min-content' satisfies StackItemSize;
55
55
  export const DEFAULT_EXTRINSIC_SIZE = DEFAULT_HORIZONTAL_SIZE satisfies StackItemSize;
56
56
 
57
+ //
58
+ // StackItemRoot
59
+ //
60
+
57
61
  type StackItemRootProps = ThemedClassName<ComponentPropsWithRef<'div'>> & {
58
62
  item: Omit<StackItemData, 'type'>;
59
63
  order?: number;
@@ -86,6 +90,7 @@ const StackItemRoot = forwardRef<HTMLDivElement, StackItemRootProps>(
86
90
  forwardedRef,
87
91
  ) => {
88
92
  const [itemElement, itemRef] = useState<HTMLDivElement | null>(null);
93
+ const composedItemRef = composeRefs<HTMLDivElement>(itemRef, forwardedRef);
89
94
  const [selfDragHandleElement, selfDragHandleRef] = useState<HTMLDivElement | null>(null);
90
95
  const [closestEdge, setEdge] = useState<Edge | null>(null);
91
96
  const [sourceId, setSourceId] = useState<string | null>(null);
@@ -96,8 +101,6 @@ const StackItemRoot = forwardRef<HTMLDivElement, StackItemRootProps>(
96
101
 
97
102
  const Root = role ?? 'div';
98
103
 
99
- const composedItemRef = composeRefs<HTMLDivElement>(itemRef, forwardedRef);
100
-
101
104
  const setSize = useCallback(
102
105
  (nextSize: StackItemSize, commit?: boolean) => {
103
106
  setInternalSize(nextSize);
@@ -110,6 +113,7 @@ const StackItemRoot = forwardRef<HTMLDivElement, StackItemRootProps>(
110
113
 
111
114
  const type = orientation === 'horizontal' ? 'column' : 'card';
112
115
 
116
+ // TODO(burdon): Factor out?
113
117
  useLayoutEffect(() => {
114
118
  if (!itemElement || !onRearrange || disableRearrange) {
115
119
  return;
@@ -183,18 +187,18 @@ const StackItemRoot = forwardRef<HTMLDivElement, StackItemRootProps>(
183
187
 
184
188
  const focusableGroupAttrs = useFocusableGroup({ tabBehavior: 'limited' });
185
189
 
186
- // Determine if the drop would result in any changes
190
+ // Determine if the drop would result in any changes.
187
191
  const shouldShowDropIndicator = () => {
188
192
  if (!closestEdge || !sourceId) {
189
193
  return false;
190
194
  }
191
195
 
192
- // Don't show indicator when dragged item is over itself
196
+ // Don't show indicator when dragged item is over itself.
193
197
  if (sourceId === item.id) {
194
198
  return false;
195
199
  }
196
200
 
197
- // Don't show indicator when dragged item is over the trailing edge of its previous sibling
201
+ // Don't show indicator when dragged item is over the trailing edge of its previous sibling.
198
202
  const isTrailingEdgeOfPrevSibling =
199
203
  prevSiblingId !== undefined &&
200
204
  sourceId === prevSiblingId &&
@@ -268,37 +272,45 @@ const StackItemRoot = forwardRef<HTMLDivElement, StackItemRootProps>(
268
272
  },
269
273
  );
270
274
 
275
+ //
276
+ // StackItemDragPreview
277
+ //
278
+
271
279
  type StackItemDragPreviewProps = {
272
280
  children: ({ item }: { item: any }) => ReactNode;
273
281
  };
274
282
 
275
- export const StackItemDragPreview = ({ children }: StackItemDragPreviewProps) => {
283
+ const StackItemDragPreview = ({ children }: StackItemDragPreviewProps) => {
276
284
  const { state } = useStackItem();
277
285
  return state?.type === 'preview' ? createPortal(children({ item: state.item }), state.container) : null;
278
286
  };
279
287
 
288
+ //
289
+ // StackItem
290
+ //
291
+
280
292
  export const StackItem = {
281
293
  Root: StackItemRoot,
282
294
  Content: StackItemContent,
295
+ DragHandle: StackItemDragHandle,
296
+ DragPreview: StackItemDragPreview,
283
297
  Heading: StackItemHeading,
284
298
  HeadingLabel: StackItemHeadingLabel,
285
299
  HeadingStickyContent: StackItemHeadingStickyContent,
286
300
  ResizeHandle: StackItemResizeHandle,
287
- DragHandle: StackItemDragHandle,
288
301
  Sigil: StackItemSigil,
289
302
  SigilButton: StackItemSigilButton,
290
- DragPreview: StackItemDragPreview,
291
303
  };
292
304
 
293
305
  export type {
294
306
  StackItemRootProps,
295
307
  StackItemContentProps,
308
+ StackItemDragHandleProps,
309
+ StackItemDragPreviewProps,
296
310
  StackItemHeadingProps,
297
311
  StackItemHeadingLabelProps,
298
312
  StackItemResizeHandleProps,
299
- StackItemDragHandleProps,
300
313
  StackItemSigilProps,
301
314
  StackItemSigilButtonProps,
302
315
  StackItemSigilAction,
303
- StackItemDragPreviewProps,
304
316
  };
@@ -5,82 +5,49 @@
5
5
  import React, { type ComponentPropsWithoutRef, forwardRef, useMemo } from 'react';
6
6
 
7
7
  import { type ThemedClassName } from '@dxos/react-ui';
8
- import { mx } from '@dxos/react-ui-theme';
8
+ import { mx } from '@dxos/ui-theme';
9
9
 
10
10
  import { useStack, useStackItem } from '../StackContext';
11
11
 
12
- // TODO(burdon): Add prop for container-max-width?
13
12
  export type StackItemContentProps = ThemedClassName<Omit<ComponentPropsWithoutRef<'div'>, 'role' | 'scrollable'>> & {
14
- /**
15
- * This flag is required in order to clarify a developer experience that seemed like it needed extra boilerplate
16
- * (`row-span-2`) or was buggy. See the description of the StackItem.Content component itself for more information.
17
- */
18
13
  toolbar?: boolean;
19
-
20
- /**
21
- * Whether to provide for the layout of a statusbar after the content.
22
- */
23
14
  statusbar?: boolean;
24
-
25
- /**
26
- * Whether to support y-axis scrolling.
27
- */
28
- scrollable?: boolean;
29
-
30
- /**
31
- * Whether to set a certain aspect ratio on the content, including the toolbar and statusbar.
32
- * This is provided for convenience and consistency; it can instead be specified by the `classNames` or `style` props as needed.
33
- */
34
- size?: 'intrinsic' | 'video' | 'square';
35
-
36
- /**
37
- * Whether the consumer intends to do something custom and typical affordances should not apply.
38
- * @deprecated Replace with override for gridTempateRows.
39
- */
40
- layoutManaged?: boolean;
41
15
  };
42
16
 
43
17
  /**
44
- * This component should be used by plugins for rendering content within a stack item, a.k.a. a “plank” or “section”.
45
- * The `toolbar` flag must be provided since this component provides for the layout of content with the toolbar.
18
+ * This component should be used by plugins for rendering content within a stack item (i.e., a “plank” or “section”).
46
19
  */
47
20
  export const StackItemContent = forwardRef<HTMLDivElement, StackItemContentProps>(
48
- (
49
- { children, toolbar, statusbar, layoutManaged, classNames, size = 'intrinsic', scrollable, ...props },
50
- forwardedRef,
51
- ) => {
21
+ ({ classNames, children, toolbar, statusbar, ...props }, forwardedRef) => {
52
22
  const { size: stackItemSize } = useStack();
53
23
  const { role } = useStackItem();
54
24
  const style = useMemo(
55
- () =>
56
- layoutManaged
57
- ? {}
58
- : {
59
- gridTemplateRows: [
60
- ...(toolbar ? [role === 'section' ? 'calc(var(--toolbar-size) - 1px)' : 'var(--toolbar-size)'] : []),
61
- '1fr',
62
- ...(statusbar ? ['var(--statusbar-size)'] : []),
63
- ].join(' '),
64
- },
65
- [toolbar, statusbar, layoutManaged],
25
+ () => ({
26
+ gridTemplateRows: [
27
+ toolbar && role === 'section' ? 'calc(var(--toolbar-size) - 1px)' : 'var(--toolbar-size)',
28
+ '1fr',
29
+ statusbar && 'var(--statusbar-size)',
30
+ ]
31
+ .filter(Boolean)
32
+ .join(' '),
33
+ }),
34
+ [toolbar, statusbar],
66
35
  );
67
36
 
68
37
  return (
69
38
  <div
70
- role='none'
71
39
  {...props}
40
+ role='none'
41
+ style={style}
72
42
  className={mx(
73
43
  'group grid grid-cols-[100%] density-coarse',
74
- size === 'video' ? 'aspect-video' : size === 'square' && 'aspect-square',
75
44
  stackItemSize === 'contain' && 'min-bs-0 overflow-hidden',
76
- scrollable ? 'min-bs-0 overflow-y-auto scrollbar-thin contain-layout' : 'overflow-hidden',
77
- role === 'section' &&
78
- toolbar &&
45
+ toolbar &&
46
+ role === 'section' &&
79
47
  '[&_.dx-toolbar]:sticky [&_.dx-toolbar]:z-[1] [&_.dx-toolbar]:block-start-0 [&_.dx-toolbar]:-mbe-px [&_.dx-toolbar]:min-is-0',
80
48
  toolbar && '[&>.dx-toolbar]:relative [&>.dx-toolbar]:border-be [&>.dx-toolbar]:border-subduedSeparator',
81
49
  classNames,
82
50
  )}
83
- style={style}
84
51
  data-popover-collision-boundary={true}
85
52
  ref={forwardedRef}
86
53
  >
@@ -89,3 +56,5 @@ export const StackItemContent = forwardRef<HTMLDivElement, StackItemContentProps
89
56
  );
90
57
  },
91
58
  );
59
+
60
+ StackItemContent.displayName = 'StackItemContent';
@@ -12,7 +12,7 @@ import React, {
12
12
 
13
13
  import { type ThemedClassName } from '@dxos/react-ui';
14
14
  import { type AttendableId, type Related, useAttention } from '@dxos/react-ui-attention';
15
- import { mx } from '@dxos/react-ui-theme';
15
+ import { mx } from '@dxos/ui-theme';
16
16
 
17
17
  import { useStack } from '../StackContext';
18
18
 
@@ -4,11 +4,11 @@
4
4
 
5
5
  import React, { Fragment, type PropsWithChildren, forwardRef, useState } from 'react';
6
6
 
7
- import { type ActionLike } from '@dxos/app-graph';
7
+ import { type Node } from '@dxos/app-graph';
8
8
  import { keySymbols } from '@dxos/keyboard';
9
9
  import { Button, type ButtonProps, DropdownMenu, Icon, toLocalizedString, useTranslation } from '@dxos/react-ui';
10
10
  import { type AttendableId, type Related, useAttention } from '@dxos/react-ui-attention';
11
- import { descriptionText, mx } from '@dxos/react-ui-theme';
11
+ import { descriptionText, mx } from '@dxos/ui-theme';
12
12
  import { getHostPlatform } from '@dxos/util';
13
13
 
14
14
  import { translationKey } from '../../translations';
@@ -23,7 +23,7 @@ export type KeyBinding = {
23
23
  unknown?: string;
24
24
  };
25
25
 
26
- export type StackItemSigilAction = Pick<ActionLike, 'id' | 'properties' | 'data'>;
26
+ export type StackItemSigilAction = Pick<Node.ActionLike, 'id' | 'properties' | 'data'>;
27
27
 
28
28
  export type StackItemSigilButtonProps = Omit<ButtonProps, 'variant'> &
29
29
  AttendableId &
@@ -30,6 +30,9 @@ const LayoutControl = ({ icon, label, ...props }: Omit<ButtonProps, 'children'>
30
30
  return <IconButton iconOnly icon={icon} label={label} tooltipSide='bottom' variant='ghost' {...props} />;
31
31
  };
32
32
 
33
+ /**
34
+ * @deprecated
35
+ */
33
36
  export const LayoutControls = forwardRef<HTMLDivElement, LayoutControlsProps>(
34
37
  (
35
38
  { onClick, variant = 'default', capabilities: can, isSolo, pin, close = false, children, ...props },
@@ -2,8 +2,8 @@
2
2
  // Copyright 2024 DXOS.org
3
3
  //
4
4
 
5
- export type * from './defs';
5
+ export type * from './types';
6
6
 
7
- export * from './Image';
7
+ export * from './CardStack';
8
8
  export * from './Stack';
9
9
  export * from './StackItem';