@dxos/react-ui-stack 0.8.4-main.e8ec1fe → 0.8.4-main.ef1bc66f44
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 +18 -13
- 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 +10 -10
- package/src/{exemplars → components}/CardStack/CardStack.tsx +113 -57
- package/src/{exemplars → components}/CardStack/CardStackDragPreview.tsx +12 -9
- package/src/components/Stack/Stack.stories.tsx +2 -2
- package/src/components/Stack/Stack.tsx +5 -3
- 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-3F2KBXLP.mjs +0 -1482
- package/dist/lib/browser/chunk-3F2KBXLP.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-SYKFLQGK.mjs +0 -1484
- package/dist/lib/node-esm/chunk-SYKFLQGK.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 -69
- 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 -210
- 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.ef1bc66f44",
|
|
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/
|
|
58
|
-
"@dxos/
|
|
59
|
-
"@dxos/
|
|
60
|
-
"@dxos/react-ui-dnd": "0.8.4-main.
|
|
61
|
-
"@dxos/util": "0.8.4-main.
|
|
62
|
-
"@dxos/
|
|
63
|
-
"@dxos/react-ui-attention": "0.8.4-main.e8ec1fe"
|
|
56
|
+
"@dxos/keyboard": "0.8.4-main.ef1bc66f44",
|
|
57
|
+
"@dxos/echo": "0.8.4-main.ef1bc66f44",
|
|
58
|
+
"@dxos/react-ui-attention": "0.8.4-main.ef1bc66f44",
|
|
59
|
+
"@dxos/react-ui-dnd": "0.8.4-main.ef1bc66f44",
|
|
60
|
+
"@dxos/util": "0.8.4-main.ef1bc66f44",
|
|
61
|
+
"@dxos/react-ui-mosaic": "0.8.4-main.ef1bc66f44"
|
|
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/
|
|
72
|
-
"@dxos/
|
|
73
|
-
"@dxos/
|
|
74
|
-
"@dxos/app-graph": "0.8.4-main.
|
|
75
|
-
"@dxos/
|
|
76
|
-
"@dxos/react-ui
|
|
77
|
-
"@dxos/
|
|
78
|
-
"@dxos/
|
|
69
|
+
"@dxos/client": "0.8.4-main.ef1bc66f44",
|
|
70
|
+
"@dxos/app-framework": "0.8.4-main.ef1bc66f44",
|
|
71
|
+
"@dxos/echo": "0.8.4-main.ef1bc66f44",
|
|
72
|
+
"@dxos/app-graph": "0.8.4-main.ef1bc66f44",
|
|
73
|
+
"@dxos/echo-db": "0.8.4-main.ef1bc66f44",
|
|
74
|
+
"@dxos/react-ui": "0.8.4-main.ef1bc66f44",
|
|
75
|
+
"@dxos/random": "0.8.4-main.ef1bc66f44",
|
|
76
|
+
"@dxos/react-client": "0.8.4-main.ef1bc66f44",
|
|
77
|
+
"@dxos/schema": "0.8.4-main.ef1bc66f44",
|
|
78
|
+
"@dxos/storybook-utils": "0.8.4-main.ef1bc66f44",
|
|
79
|
+
"@dxos/test-utils": "0.8.4-main.ef1bc66f44",
|
|
80
|
+
"@dxos/types": "0.8.4-main.ef1bc66f44",
|
|
81
|
+
"@dxos/ui-theme": "0.8.4-main.ef1bc66f44"
|
|
79
82
|
},
|
|
80
83
|
"peerDependencies": {
|
|
81
|
-
"react": "
|
|
82
|
-
"react-dom": "
|
|
83
|
-
"@dxos/
|
|
84
|
-
"@dxos/
|
|
85
|
-
"@dxos/react-ui": "0.8.4-main.
|
|
86
|
-
"@dxos/
|
|
84
|
+
"react": "~19.2.3",
|
|
85
|
+
"react-dom": "~19.2.3",
|
|
86
|
+
"@dxos/random": "0.8.4-main.ef1bc66f44",
|
|
87
|
+
"@dxos/client": "0.8.4-main.ef1bc66f44",
|
|
88
|
+
"@dxos/react-ui": "0.8.4-main.ef1bc66f44",
|
|
89
|
+
"@dxos/ui-theme": "0.8.4-main.ef1bc66f44"
|
|
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
|
|
|
@@ -94,7 +94,7 @@ const CardStackStory = () => {
|
|
|
94
94
|
|
|
95
95
|
return (
|
|
96
96
|
<CardStack.Root classNames='is-96'>
|
|
97
|
-
<CardStack.Content>
|
|
97
|
+
<CardStack.Content footer>
|
|
98
98
|
<CardStack.Stack id='story column' onRearrange={handleRearrange} itemsCount={column.length}>
|
|
99
99
|
{column.map((card, cardIndex, cardsArray) => {
|
|
100
100
|
const cardItem = { id: card.id, type: 'card' as const };
|
|
@@ -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,17 +6,78 @@ 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
|
-
import { Card } from '../Card';
|
|
12
|
+
import { Stack, type StackProps, railGridHorizontalContainFitContent } from '../Stack';
|
|
13
13
|
|
|
14
|
-
|
|
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;
|
|
18
|
+
|
|
19
|
+
//
|
|
20
|
+
// Root
|
|
21
|
+
//
|
|
22
|
+
|
|
23
|
+
const cardStackRoot = 'flex flex-col';
|
|
24
|
+
|
|
25
|
+
const CardStackRoot = forwardRef<HTMLDivElement, SharedCardStackProps>(
|
|
26
|
+
({ children, classNames, asChild, role = 'none', ...props }, forwardedRef) => {
|
|
27
|
+
const Root = asChild ? Slot : 'div';
|
|
28
|
+
const rootProps = asChild
|
|
29
|
+
? { classNames: [cardStackRoot, classNames] }
|
|
30
|
+
: { className: mx(cardStackRoot, classNames), role };
|
|
31
|
+
|
|
32
|
+
return (
|
|
33
|
+
<Root {...props} {...rootProps} ref={forwardedRef}>
|
|
34
|
+
{children}
|
|
35
|
+
</Root>
|
|
36
|
+
);
|
|
37
|
+
},
|
|
38
|
+
);
|
|
39
|
+
|
|
40
|
+
//
|
|
41
|
+
// Content
|
|
42
|
+
// TODO(burdon): Rename Viewport (should be the component that scrolls).
|
|
43
|
+
//
|
|
44
|
+
|
|
45
|
+
const cardStackContent = 'shrink min-bs-0 grid dx-focus-ring-group-x-indicator bg-baseSurface';
|
|
46
|
+
|
|
47
|
+
type CardStackContentProps = SharedCardStackProps & {
|
|
48
|
+
footer?: boolean;
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
const CardStackContent = forwardRef<HTMLDivElement, CardStackContentProps>(
|
|
52
|
+
({ children, classNames, asChild, role = 'none', footer, ...props }, forwardedRef) => {
|
|
53
|
+
const Root = asChild ? Slot : 'div';
|
|
54
|
+
const baseClassNames = footer ? [cardStackContent, railGridHorizontalContainFitContent] : [cardStackContent];
|
|
55
|
+
const rootProps = asChild
|
|
56
|
+
? { classNames: [...baseClassNames, classNames] }
|
|
57
|
+
: { className: mx(...baseClassNames, classNames), role };
|
|
58
|
+
|
|
59
|
+
return (
|
|
60
|
+
<Root {...props} {...rootProps} data-scroll-separator='false' ref={forwardedRef}>
|
|
61
|
+
{children}
|
|
62
|
+
</Root>
|
|
63
|
+
);
|
|
64
|
+
},
|
|
65
|
+
);
|
|
66
|
+
|
|
67
|
+
//
|
|
68
|
+
// Stack
|
|
69
|
+
// TODO(burdon): Rename Content.
|
|
70
|
+
//
|
|
71
|
+
|
|
72
|
+
type SharedCardStackProps = ThemedClassName<ComponentPropsWithoutRef<'div'>> & {
|
|
73
|
+
asChild?: boolean;
|
|
74
|
+
};
|
|
15
75
|
|
|
16
76
|
const CardStackStack = forwardRef<
|
|
17
77
|
HTMLDivElement,
|
|
18
78
|
Omit<StackProps, 'orientation' | 'size' | 'rail' | 'separatorOnScroll'>
|
|
19
79
|
>(({ children, classNames, itemsCount = 0, ...props }, forwardedRef) => {
|
|
80
|
+
// NOTE: Should not have horizontal padding since separatorOnScroll should be full width.
|
|
20
81
|
return (
|
|
21
82
|
<Stack
|
|
22
83
|
orientation='vertical'
|
|
@@ -24,7 +85,7 @@ const CardStackStack = forwardRef<
|
|
|
24
85
|
rail={false}
|
|
25
86
|
classNames={
|
|
26
87
|
/* NOTE(thure): Do not let this element have zero intrinsic size, otherwise the drop indicator will not display. See #9035. */
|
|
27
|
-
['plb-
|
|
88
|
+
['plb-2', classNames]
|
|
28
89
|
}
|
|
29
90
|
itemsCount={itemsCount}
|
|
30
91
|
separatorOnScroll={9}
|
|
@@ -37,33 +98,19 @@ const CardStackStack = forwardRef<
|
|
|
37
98
|
);
|
|
38
99
|
});
|
|
39
100
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
const CardStackHeading = forwardRef<HTMLDivElement, SharedCardStackProps>(
|
|
45
|
-
({ children, classNames, asChild, role = 'heading', ...props }, forwardedRef) => {
|
|
46
|
-
const Root = asChild ? Slot : 'div';
|
|
47
|
-
const rootProps = asChild
|
|
48
|
-
? { classNames: [cardStackHeading, classNames] }
|
|
49
|
-
: { className: mx(cardStackHeading, classNames), role };
|
|
50
|
-
return (
|
|
51
|
-
<Root {...props} {...rootProps} ref={forwardedRef}>
|
|
52
|
-
{children}
|
|
53
|
-
</Root>
|
|
54
|
-
);
|
|
55
|
-
},
|
|
56
|
-
);
|
|
101
|
+
//
|
|
102
|
+
// Item
|
|
103
|
+
//
|
|
57
104
|
|
|
58
|
-
const
|
|
59
|
-
'plb-2 mli-2 border-bs border-transparent [[data-scroll-separator-end="true"]_&]:border-subduedSeparator';
|
|
105
|
+
const cardStackItem = 'contain-layout pli-2 plb-1 first-of-type:pbs-0 last-of-type:pbe-0';
|
|
60
106
|
|
|
61
|
-
const
|
|
107
|
+
const CardStackItem = forwardRef<HTMLDivElement, SharedCardStackProps>(
|
|
62
108
|
({ children, classNames, asChild, role = 'none', ...props }, forwardedRef) => {
|
|
63
109
|
const Root = asChild ? Slot : 'div';
|
|
64
110
|
const rootProps = asChild
|
|
65
|
-
? { classNames: [
|
|
66
|
-
: { className: mx(
|
|
111
|
+
? { classNames: [cardStackItem, classNames] }
|
|
112
|
+
: { className: mx(cardStackItem, classNames), role };
|
|
113
|
+
|
|
67
114
|
return (
|
|
68
115
|
<Root {...props} {...rootProps} ref={forwardedRef}>
|
|
69
116
|
{children}
|
|
@@ -72,36 +119,19 @@ const CardStackFooter = forwardRef<HTMLDivElement, SharedCardStackProps>(
|
|
|
72
119
|
},
|
|
73
120
|
);
|
|
74
121
|
|
|
75
|
-
|
|
76
|
-
|
|
122
|
+
//
|
|
123
|
+
// Heading
|
|
124
|
+
//
|
|
77
125
|
|
|
78
|
-
|
|
79
|
-
footer?: boolean;
|
|
80
|
-
};
|
|
126
|
+
const cardStackHeading = 'mli-2 order-first bg-transparent rounded-bs-md flex items-center';
|
|
81
127
|
|
|
82
|
-
const
|
|
83
|
-
({ children, classNames, asChild, role = '
|
|
128
|
+
const CardStackHeading = forwardRef<HTMLDivElement, SharedCardStackProps>(
|
|
129
|
+
({ children, classNames, asChild, role = 'heading', ...props }, forwardedRef) => {
|
|
84
130
|
const Root = asChild ? Slot : 'div';
|
|
85
|
-
const baseClassNames = footer ? [cardStackContent, railGridHorizontalContainFitContent] : [cardStackContent];
|
|
86
131
|
const rootProps = asChild
|
|
87
|
-
? { classNames: [
|
|
88
|
-
: { className: mx(
|
|
89
|
-
return (
|
|
90
|
-
<Root {...props} {...rootProps} data-scroll-separator='false' ref={forwardedRef}>
|
|
91
|
-
{children}
|
|
92
|
-
</Root>
|
|
93
|
-
);
|
|
94
|
-
},
|
|
95
|
-
);
|
|
96
|
-
|
|
97
|
-
const cardStackRoot = 'flex flex-col pli-2 plb-2';
|
|
132
|
+
? { classNames: [cardStackHeading, classNames] }
|
|
133
|
+
: { className: mx(cardStackHeading, classNames), role };
|
|
98
134
|
|
|
99
|
-
const CardStackRoot = forwardRef<HTMLDivElement, SharedCardStackProps>(
|
|
100
|
-
({ children, classNames, asChild, role = 'none', ...props }, forwardedRef) => {
|
|
101
|
-
const Root = asChild ? Slot : 'div';
|
|
102
|
-
const rootProps = asChild
|
|
103
|
-
? { classNames: [cardStackRoot, classNames] }
|
|
104
|
-
: { className: mx(cardStackRoot, classNames), role };
|
|
105
135
|
return (
|
|
106
136
|
<Root {...props} {...rootProps} ref={forwardedRef}>
|
|
107
137
|
{children}
|
|
@@ -110,14 +140,20 @@ const CardStackRoot = forwardRef<HTMLDivElement, SharedCardStackProps>(
|
|
|
110
140
|
},
|
|
111
141
|
);
|
|
112
142
|
|
|
113
|
-
|
|
143
|
+
//
|
|
144
|
+
// Footer
|
|
145
|
+
//
|
|
114
146
|
|
|
115
|
-
const
|
|
147
|
+
const cardStackFooter =
|
|
148
|
+
'plb-2 mli-2 border-bs border-transparent [[data-scroll-separator-end="true"]_&]:border-subduedSeparator';
|
|
149
|
+
|
|
150
|
+
const CardStackFooter = forwardRef<HTMLDivElement, SharedCardStackProps>(
|
|
116
151
|
({ children, classNames, asChild, role = 'none', ...props }, forwardedRef) => {
|
|
117
152
|
const Root = asChild ? Slot : 'div';
|
|
118
153
|
const rootProps = asChild
|
|
119
|
-
? { classNames: [
|
|
120
|
-
: { className: mx(
|
|
154
|
+
? { classNames: [cardStackFooter, classNames] }
|
|
155
|
+
: { className: mx(cardStackFooter, classNames), role };
|
|
156
|
+
|
|
121
157
|
return (
|
|
122
158
|
<Root {...props} {...rootProps} ref={forwardedRef}>
|
|
123
159
|
{children}
|
|
@@ -126,6 +162,19 @@ const CardStackItem = forwardRef<HTMLDivElement, SharedCardStackProps>(
|
|
|
126
162
|
},
|
|
127
163
|
);
|
|
128
164
|
|
|
165
|
+
//
|
|
166
|
+
// DragHandle
|
|
167
|
+
//
|
|
168
|
+
|
|
169
|
+
const CardStackDragHandle = Card.DragHandle;
|
|
170
|
+
|
|
171
|
+
//
|
|
172
|
+
// CardStack
|
|
173
|
+
//
|
|
174
|
+
|
|
175
|
+
/**
|
|
176
|
+
* @deprecated Replace with Mosaic.Stack.
|
|
177
|
+
*/
|
|
129
178
|
export const CardStack = {
|
|
130
179
|
Root: CardStackRoot,
|
|
131
180
|
Content: CardStackContent,
|
|
@@ -136,4 +185,11 @@ export const CardStack = {
|
|
|
136
185
|
Item: CardStackItem,
|
|
137
186
|
};
|
|
138
187
|
|
|
139
|
-
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;
|
|
@@ -7,6 +7,7 @@ import React, {
|
|
|
7
7
|
type CSSProperties,
|
|
8
8
|
Children,
|
|
9
9
|
type ComponentPropsWithRef,
|
|
10
|
+
type FocusEvent,
|
|
10
11
|
type KeyboardEvent,
|
|
11
12
|
forwardRef,
|
|
12
13
|
useCallback,
|
|
@@ -16,11 +17,11 @@ import React, {
|
|
|
16
17
|
} from 'react';
|
|
17
18
|
|
|
18
19
|
import { ListItem, type ThemedClassName, useId } from '@dxos/react-ui';
|
|
19
|
-
import { mx } from '@dxos/
|
|
20
|
+
import { mx } from '@dxos/ui-theme';
|
|
20
21
|
|
|
21
22
|
import { useStackDropForElements } from '../../hooks';
|
|
22
|
-
import { type StackContextValue } from '../defs';
|
|
23
23
|
import { StackContext } from '../StackContext';
|
|
24
|
+
import { type StackContextValue } from '../types';
|
|
24
25
|
|
|
25
26
|
export type Orientation = 'horizontal' | 'vertical';
|
|
26
27
|
|
|
@@ -122,7 +123,7 @@ export const Stack = forwardRef<HTMLDivElement, StackProps>(
|
|
|
122
123
|
* Handles blur events to track the last focused item within this stack.
|
|
123
124
|
*/
|
|
124
125
|
const handleBlur = useCallback(
|
|
125
|
-
(event:
|
|
126
|
+
(event: FocusEvent<HTMLDivElement>) => {
|
|
126
127
|
if (event.target) {
|
|
127
128
|
const target = event.target as HTMLElement;
|
|
128
129
|
const closestStackItem = target.closest(`[data-dx-item-id]`) as HTMLElement | null;
|
|
@@ -194,6 +195,7 @@ export const Stack = forwardRef<HTMLDivElement, StackProps>(
|
|
|
194
195
|
scrollIntoViewAndFocus(adjacentItem, closestStackOrientation);
|
|
195
196
|
}
|
|
196
197
|
}
|
|
198
|
+
|
|
197
199
|
if (perpendicularDelta !== 0) {
|
|
198
200
|
if (ancestorStack && ancestorOrientation !== closestStackOrientation) {
|
|
199
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
|
},
|