@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.
- package/dist/lib/browser/index.mjs +920 -57
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/node-esm/index.mjs +921 -57
- package/dist/lib/node-esm/index.mjs.map +4 -4
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/types/src/{exemplars → components}/CardStack/CardStack.d.ts +15 -10
- package/dist/types/src/components/CardStack/CardStack.d.ts.map +1 -0
- package/dist/types/src/components/CardStack/CardStack.stories.d.ts.map +1 -0
- package/dist/types/src/{exemplars → components}/CardStack/CardStackDragPreview.d.ts +4 -1
- package/dist/types/src/components/CardStack/CardStackDragPreview.d.ts.map +1 -0
- package/dist/types/src/components/CardStack/index.d.ts.map +1 -0
- package/dist/types/src/components/Stack/Stack.d.ts +1 -1
- package/dist/types/src/components/Stack/Stack.d.ts.map +1 -1
- package/dist/types/src/components/StackContext.d.ts +1 -1
- package/dist/types/src/components/StackContext.d.ts.map +1 -1
- package/dist/types/src/components/StackItem/StackItem.d.ts +5 -9
- package/dist/types/src/components/StackItem/StackItem.d.ts.map +1 -1
- package/dist/types/src/components/StackItem/StackItem.stories.d.ts.map +1 -1
- package/dist/types/src/components/StackItem/StackItemContent.d.ts +2 -45
- package/dist/types/src/components/StackItem/StackItemContent.d.ts.map +1 -1
- package/dist/types/src/components/StackItem/StackItemSigil.d.ts +2 -2
- package/dist/types/src/components/StackItem/StackItemSigil.d.ts.map +1 -1
- package/dist/types/src/components/deprecated/LayoutControls.d.ts +3 -0
- package/dist/types/src/components/deprecated/LayoutControls.d.ts.map +1 -1
- package/dist/types/src/components/index.d.ts +2 -2
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/components/{defs.d.ts → types.d.ts} +1 -1
- package/dist/types/src/components/types.d.ts.map +1 -0
- package/dist/types/src/hooks/useStackDropForElements.d.ts +7 -5
- package/dist/types/src/hooks/useStackDropForElements.d.ts.map +1 -1
- package/dist/types/src/index.d.ts +0 -1
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/translations.d.ts +2 -2
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +40 -37
- package/src/{exemplars → components}/CardStack/CardStack.stories.tsx +9 -9
- package/src/{exemplars → components}/CardStack/CardStack.tsx +19 -5
- package/src/{exemplars → components}/CardStack/CardStackDragPreview.tsx +12 -9
- package/src/components/Stack/Stack.stories.tsx +2 -2
- package/src/components/Stack/Stack.tsx +3 -2
- package/src/components/StackContext.tsx +1 -1
- package/src/components/StackItem/StackItem.stories.tsx +5 -3
- package/src/components/StackItem/StackItem.tsx +24 -12
- package/src/components/StackItem/StackItemContent.tsx +19 -50
- package/src/components/StackItem/StackItemHeading.tsx +1 -1
- package/src/components/StackItem/StackItemSigil.tsx +3 -3
- package/src/components/deprecated/LayoutControls.tsx +3 -0
- package/src/components/index.ts +2 -2
- package/src/hooks/useStackDropForElements.ts +17 -10
- package/src/index.ts +0 -3
- package/src/playwright/playwright.config.ts +1 -1
- package/src/translations.ts +1 -1
- package/dist/lib/browser/chunk-6YJ6CHWV.mjs +0 -1483
- package/dist/lib/browser/chunk-6YJ6CHWV.mjs.map +0 -7
- package/dist/lib/browser/testing/index.mjs +0 -31
- package/dist/lib/browser/testing/index.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-KCFYDRBZ.mjs +0 -1485
- package/dist/lib/node-esm/chunk-KCFYDRBZ.mjs.map +0 -7
- package/dist/lib/node-esm/testing/index.mjs +0 -32
- package/dist/lib/node-esm/testing/index.mjs.map +0 -7
- package/dist/types/src/components/Image/Image.d.ts +0 -14
- package/dist/types/src/components/Image/Image.d.ts.map +0 -1
- package/dist/types/src/components/Image/Image.stories.d.ts +0 -33
- package/dist/types/src/components/Image/Image.stories.d.ts.map +0 -1
- package/dist/types/src/components/Image/index.d.ts +0 -2
- package/dist/types/src/components/Image/index.d.ts.map +0 -1
- package/dist/types/src/components/defs.d.ts.map +0 -1
- package/dist/types/src/exemplars/Card/Card.d.ts +0 -71
- package/dist/types/src/exemplars/Card/Card.d.ts.map +0 -1
- package/dist/types/src/exemplars/Card/Card.stories.d.ts +0 -21
- package/dist/types/src/exemplars/Card/Card.stories.d.ts.map +0 -1
- package/dist/types/src/exemplars/Card/CardDragPreview.d.ts +0 -6
- package/dist/types/src/exemplars/Card/CardDragPreview.d.ts.map +0 -1
- package/dist/types/src/exemplars/Card/fragments.d.ts +0 -13
- package/dist/types/src/exemplars/Card/fragments.d.ts.map +0 -1
- package/dist/types/src/exemplars/Card/index.d.ts +0 -4
- package/dist/types/src/exemplars/Card/index.d.ts.map +0 -1
- package/dist/types/src/exemplars/CardStack/CardStack.d.ts.map +0 -1
- package/dist/types/src/exemplars/CardStack/CardStack.stories.d.ts.map +0 -1
- package/dist/types/src/exemplars/CardStack/CardStackDragPreview.d.ts.map +0 -1
- package/dist/types/src/exemplars/CardStack/index.d.ts.map +0 -1
- package/dist/types/src/exemplars/index.d.ts +0 -3
- package/dist/types/src/exemplars/index.d.ts.map +0 -1
- package/dist/types/src/testing/CardContainer.d.ts +0 -6
- package/dist/types/src/testing/CardContainer.d.ts.map +0 -1
- package/dist/types/src/testing/index.d.ts +0 -2
- package/dist/types/src/testing/index.d.ts.map +0 -1
- package/src/components/Image/Image.stories.tsx +0 -84
- package/src/components/Image/Image.tsx +0 -222
- package/src/components/Image/index.ts +0 -5
- package/src/exemplars/Card/Card.stories.tsx +0 -64
- package/src/exemplars/Card/Card.tsx +0 -212
- package/src/exemplars/Card/CardDragPreview.tsx +0 -22
- package/src/exemplars/Card/fragments.ts +0 -24
- package/src/exemplars/Card/index.ts +0 -7
- package/src/exemplars/index.ts +0 -6
- package/src/testing/CardContainer.tsx +0 -37
- package/src/testing/index.ts +0 -5
- /package/dist/types/src/{exemplars → components}/CardStack/CardStack.stories.d.ts +0 -0
- /package/dist/types/src/{exemplars → components}/CardStack/index.d.ts +0 -0
- /package/src/{exemplars → components}/CardStack/index.ts +0 -0
- /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.
|
|
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":
|
|
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": "
|
|
45
|
-
"@atlaskit/pragmatic-drag-and-drop-auto-scroll": "^2.1.
|
|
46
|
-
"@atlaskit/pragmatic-drag-and-drop-hitbox": "
|
|
47
|
-
"@
|
|
48
|
-
"@
|
|
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.
|
|
58
|
-
"@dxos/keyboard": "0.8.4-main.
|
|
59
|
-
"@dxos/
|
|
60
|
-
"@dxos/react-ui-dnd": "0.8.4-main.
|
|
61
|
-
"@dxos/
|
|
62
|
-
"@dxos/
|
|
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.
|
|
67
|
-
"@types/react-dom": "~19.2.
|
|
68
|
-
"react": "~19.2.
|
|
69
|
-
"react-dom": "~19.2.
|
|
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-
|
|
72
|
-
"@dxos/
|
|
73
|
-
"@dxos/echo": "0.8.4-main.
|
|
74
|
-
"@dxos/
|
|
75
|
-
"@dxos/
|
|
76
|
-
"@dxos/react-
|
|
77
|
-
"@dxos/
|
|
78
|
-
"@dxos/
|
|
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": "
|
|
82
|
-
"react-dom": "
|
|
83
|
-
"@dxos/client": "0.8.4-main.
|
|
84
|
-
"@dxos/
|
|
85
|
-
"@dxos/
|
|
86
|
-
"@dxos/react-ui
|
|
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 '
|
|
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.
|
|
112
|
+
<Card.Root>
|
|
113
113
|
<Card.Toolbar>
|
|
114
114
|
<StackItem.DragHandle asChild>
|
|
115
|
-
<Card.DragHandle
|
|
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
|
|
129
|
-
</Card.
|
|
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
|
|
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
|
|
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 {
|
|
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 '
|
|
12
|
-
|
|
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 {
|
|
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/
|
|
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
|
-
<
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
</
|
|
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-
|
|
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/
|
|
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>
|
|
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/
|
|
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
|
-
|
|
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/
|
|
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
|
|
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
|
-
|
|
57
|
-
?
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
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
|
-
|
|
77
|
-
|
|
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/
|
|
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
|
|
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/
|
|
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 },
|