@dxos/react-ui-stack 0.8.4-main.f9ba587 → 0.8.4-main.fd6878d
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/lib/browser/chunk-FV7KWSG5.mjs +1198 -0
- package/dist/lib/browser/chunk-FV7KWSG5.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +37 -1158
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/playwright/index.mjs +61 -0
- package/dist/lib/browser/playwright/index.mjs.map +7 -0
- package/dist/lib/browser/testing/index.mjs +25 -51
- package/dist/lib/browser/testing/index.mjs.map +4 -4
- package/dist/lib/node-esm/chunk-ISLFXOAT.mjs +1200 -0
- package/dist/lib/node-esm/chunk-ISLFXOAT.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +37 -1159
- package/dist/lib/node-esm/index.mjs.map +4 -4
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/playwright/index.mjs +63 -0
- package/dist/lib/node-esm/playwright/index.mjs.map +7 -0
- package/dist/lib/node-esm/testing/index.mjs +24 -51
- package/dist/lib/node-esm/testing/index.mjs.map +4 -4
- 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/Stack/Stack.stories.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 +4 -4
- package/dist/types/src/components/StackItem/StackItem.d.ts.map +1 -1
- package/dist/types/src/components/StackItem/StackItemContent.d.ts +2 -2
- package/dist/types/src/components/StackItem/StackItemContent.d.ts.map +1 -1
- package/dist/types/src/components/StackItem/StackItemHeading.d.ts +1 -1
- package/dist/types/src/components/StackItem/StackItemHeading.d.ts.map +1 -1
- package/dist/types/src/components/StackItem/StackItemResizeHandle.d.ts.map +1 -1
- package/dist/types/src/components/StackItem/StackItemSigil.d.ts.map +1 -1
- package/dist/types/src/components/index.d.ts +1 -1
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/exemplars/Card/Card.d.ts +4 -3
- package/dist/types/src/exemplars/Card/Card.d.ts.map +1 -1
- package/dist/types/src/exemplars/CardStack/CardStack.d.ts.map +1 -1
- package/dist/types/src/exemplars/CardStack/CardStack.stories.d.ts.map +1 -1
- package/dist/types/src/hooks/useStackDropForElements.d.ts +1 -1
- package/dist/types/src/hooks/useStackDropForElements.d.ts.map +1 -1
- package/dist/types/src/playwright/index.d.ts +2 -0
- package/dist/types/src/playwright/index.d.ts.map +1 -0
- package/dist/types/src/playwright/stack-manager.d.ts.map +1 -0
- package/dist/types/src/testing/CardContainer.d.ts +6 -0
- package/dist/types/src/testing/CardContainer.d.ts.map +1 -0
- package/dist/types/src/testing/index.d.ts +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +29 -23
- package/src/components/Stack/Stack.stories.tsx +4 -3
- package/src/components/Stack/Stack.tsx +5 -5
- package/src/components/StackContext.tsx +1 -1
- package/src/components/StackItem/StackItem.stories.tsx +1 -1
- package/src/components/StackItem/StackItem.tsx +12 -11
- package/src/components/StackItem/StackItemContent.tsx +4 -3
- package/src/components/StackItem/StackItemHeading.tsx +3 -3
- package/src/components/StackItem/StackItemResizeHandle.tsx +2 -1
- package/src/components/StackItem/StackItemSigil.tsx +2 -1
- package/src/components/index.ts +1 -1
- package/src/exemplars/Card/Card.tsx +27 -7
- package/src/exemplars/CardStack/CardStack.stories.tsx +3 -2
- package/src/exemplars/CardStack/CardStack.tsx +1 -1
- package/src/hooks/useStackDropForElements.ts +1 -1
- package/src/playwright/index.ts +5 -0
- package/src/playwright/smoke.spec.ts +1 -1
- package/src/testing/CardContainer.tsx +37 -0
- package/src/testing/index.ts +1 -1
- package/dist/types/src/testing/stack-manager.d.ts.map +0 -1
- /package/dist/types/src/{testing → playwright}/stack-manager.d.ts +0 -0
- /package/src/{testing → playwright}/stack-manager.ts +0 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dxos/react-ui-stack",
|
|
3
|
-
"version": "0.8.4-main.
|
|
3
|
+
"version": "0.8.4-main.fd6878d",
|
|
4
4
|
"description": "A stack component.",
|
|
5
5
|
"homepage": "https://dxos.org",
|
|
6
6
|
"bugs": "https://github.com/dxos/dxos/issues",
|
|
@@ -14,18 +14,23 @@
|
|
|
14
14
|
"browser": "./dist/lib/browser/index.mjs",
|
|
15
15
|
"node": "./dist/lib/node-esm/index.mjs"
|
|
16
16
|
},
|
|
17
|
+
"./playwright": {
|
|
18
|
+
"types": "./dist/types/src/playwright/index.d.ts",
|
|
19
|
+
"browser": "./dist/lib/browser/playwright/index.mjs",
|
|
20
|
+
"node": "./dist/lib/node-esm/playwright/index.mjs"
|
|
21
|
+
},
|
|
17
22
|
"./testing": {
|
|
18
23
|
"types": "./dist/types/src/testing/index.d.ts",
|
|
19
24
|
"browser": "./dist/lib/browser/testing/index.mjs",
|
|
20
|
-
"node":
|
|
21
|
-
"require": "./dist/lib/node/testing/index.cjs",
|
|
22
|
-
"default": "./dist/lib/node-esm/testing/index.mjs"
|
|
23
|
-
}
|
|
25
|
+
"node": "./dist/lib/node-esm/testing/index.mjs"
|
|
24
26
|
}
|
|
25
27
|
},
|
|
26
28
|
"types": "dist/types/src/index.d.ts",
|
|
27
29
|
"typesVersions": {
|
|
28
30
|
"*": {
|
|
31
|
+
"playwright": [
|
|
32
|
+
"dist/types/src/playwright/index.d.ts"
|
|
33
|
+
],
|
|
29
34
|
"testing": [
|
|
30
35
|
"dist/types/src/testing/index.d.ts"
|
|
31
36
|
]
|
|
@@ -49,12 +54,13 @@
|
|
|
49
54
|
"@radix-ui/react-slot": "1.1.2",
|
|
50
55
|
"@radix-ui/react-use-controllable-state": "1.1.0",
|
|
51
56
|
"react-resize-detector": "^11.0.1",
|
|
52
|
-
"@dxos/echo-schema": "0.8.4-main.
|
|
53
|
-
"@dxos/keyboard": "0.8.4-main.
|
|
54
|
-
"@dxos/live-object": "0.8.4-main.
|
|
55
|
-
"@dxos/react-ui-attention": "0.8.4-main.
|
|
56
|
-
"@dxos/
|
|
57
|
-
"@dxos/
|
|
57
|
+
"@dxos/echo-schema": "0.8.4-main.fd6878d",
|
|
58
|
+
"@dxos/keyboard": "0.8.4-main.fd6878d",
|
|
59
|
+
"@dxos/live-object": "0.8.4-main.fd6878d",
|
|
60
|
+
"@dxos/react-ui-attention": "0.8.4-main.fd6878d",
|
|
61
|
+
"@dxos/react-ui-dnd": "0.8.4-main.fd6878d",
|
|
62
|
+
"@dxos/storybook-utils": "0.8.4-main.fd6878d",
|
|
63
|
+
"@dxos/util": "0.8.4-main.fd6878d"
|
|
58
64
|
},
|
|
59
65
|
"devDependencies": {
|
|
60
66
|
"@types/react": "~18.2.0",
|
|
@@ -62,22 +68,22 @@
|
|
|
62
68
|
"react": "~18.2.0",
|
|
63
69
|
"react-dom": "~18.2.0",
|
|
64
70
|
"vite": "5.4.7",
|
|
65
|
-
"@dxos/
|
|
66
|
-
"@dxos/
|
|
67
|
-
"@dxos/
|
|
68
|
-
"@dxos/
|
|
69
|
-
"@dxos/react-ui-theme": "0.8.4-main.
|
|
70
|
-
"@dxos/react-ui": "0.8.4-main.
|
|
71
|
-
"@dxos/storybook-utils": "0.8.4-main.
|
|
72
|
-
"@dxos/test-utils": "0.8.4-main.
|
|
71
|
+
"@dxos/client": "0.8.4-main.fd6878d",
|
|
72
|
+
"@dxos/app-graph": "0.8.4-main.fd6878d",
|
|
73
|
+
"@dxos/echo-schema": "0.8.4-main.fd6878d",
|
|
74
|
+
"@dxos/random": "0.8.4-main.fd6878d",
|
|
75
|
+
"@dxos/react-ui-theme": "0.8.4-main.fd6878d",
|
|
76
|
+
"@dxos/react-ui": "0.8.4-main.fd6878d",
|
|
77
|
+
"@dxos/storybook-utils": "0.8.4-main.fd6878d",
|
|
78
|
+
"@dxos/test-utils": "0.8.4-main.fd6878d"
|
|
73
79
|
},
|
|
74
80
|
"peerDependencies": {
|
|
75
81
|
"react": "~18.2.0",
|
|
76
82
|
"react-dom": "~18.2.0",
|
|
77
|
-
"@dxos/client": "0.8.4-main.
|
|
78
|
-
"@dxos/random": "0.8.4-main.
|
|
79
|
-
"@dxos/react-ui": "0.8.4-main.
|
|
80
|
-
"@dxos/react-ui-theme": "0.8.4-main.
|
|
83
|
+
"@dxos/client": "0.8.4-main.fd6878d",
|
|
84
|
+
"@dxos/random": "0.8.4-main.fd6878d",
|
|
85
|
+
"@dxos/react-ui": "0.8.4-main.fd6878d",
|
|
86
|
+
"@dxos/react-ui-theme": "0.8.4-main.fd6878d"
|
|
81
87
|
},
|
|
82
88
|
"publishConfig": {
|
|
83
89
|
"access": "public"
|
|
@@ -6,14 +6,15 @@ import '@dxos-theme';
|
|
|
6
6
|
|
|
7
7
|
import { type Edge } from '@atlaskit/pragmatic-drag-and-drop-hitbox/closest-edge';
|
|
8
8
|
import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
9
|
-
import React, {
|
|
9
|
+
import React, { useCallback, useState } from 'react';
|
|
10
10
|
|
|
11
11
|
import { faker } from '@dxos/random';
|
|
12
12
|
import { withTheme } from '@dxos/storybook-utils';
|
|
13
13
|
|
|
14
|
-
import { Stack } from './Stack';
|
|
15
|
-
import { StackItem } from '../StackItem';
|
|
16
14
|
import { type StackItemData } from '../defs';
|
|
15
|
+
import { StackItem } from '../StackItem';
|
|
16
|
+
|
|
17
|
+
import { Stack } from './Stack';
|
|
17
18
|
|
|
18
19
|
type StoryStackItem = {
|
|
19
20
|
id: string;
|
|
@@ -5,22 +5,22 @@
|
|
|
5
5
|
import { useArrowNavigationGroup } from '@fluentui/react-tabster';
|
|
6
6
|
import { composeRefs } from '@radix-ui/react-compose-refs';
|
|
7
7
|
import React, {
|
|
8
|
-
Children,
|
|
9
8
|
type CSSProperties,
|
|
9
|
+
Children,
|
|
10
10
|
type ComponentPropsWithRef,
|
|
11
11
|
forwardRef,
|
|
12
|
-
useState,
|
|
13
|
-
useMemo,
|
|
14
12
|
useCallback,
|
|
15
13
|
useEffect,
|
|
14
|
+
useMemo,
|
|
15
|
+
useState,
|
|
16
16
|
} from 'react';
|
|
17
17
|
|
|
18
|
-
import { type ThemedClassName
|
|
18
|
+
import { ListItem, type ThemedClassName } from '@dxos/react-ui';
|
|
19
19
|
import { mx } from '@dxos/react-ui-theme';
|
|
20
20
|
|
|
21
21
|
import { useStackDropForElements } from '../../hooks';
|
|
22
|
-
import { StackContext } from '../StackContext';
|
|
23
22
|
import { type StackContextValue } from '../defs';
|
|
23
|
+
import { StackContext } from '../StackContext';
|
|
24
24
|
|
|
25
25
|
export type Orientation = 'horizontal' | 'vertical';
|
|
26
26
|
export type Size = 'intrinsic' | 'contain' | 'contain-fit-content';
|
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
|
|
5
5
|
import { createContext, useContext } from 'react';
|
|
6
6
|
|
|
7
|
+
import { type StackItemRearrangeHandler, type StackItemSize } from './defs';
|
|
7
8
|
import { type Orientation, type Size } from './Stack';
|
|
8
|
-
import { type StackItemSize, type StackItemRearrangeHandler } from './defs';
|
|
9
9
|
|
|
10
10
|
export type StackContextValue = {
|
|
11
11
|
orientation: Orientation;
|
|
@@ -7,7 +7,7 @@ import '@dxos-theme';
|
|
|
7
7
|
import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
8
8
|
import React from 'react';
|
|
9
9
|
|
|
10
|
-
import {
|
|
10
|
+
import { DropdownMenu, Icon } from '@dxos/react-ui';
|
|
11
11
|
import { withTheme } from '@dxos/storybook-utils';
|
|
12
12
|
|
|
13
13
|
import { StackItem } from './StackItem';
|
|
@@ -7,46 +7,47 @@ import { draggable, dropTargetForElements } from '@atlaskit/pragmatic-drag-and-d
|
|
|
7
7
|
import { preserveOffsetOnSource } from '@atlaskit/pragmatic-drag-and-drop/element/preserve-offset-on-source';
|
|
8
8
|
import { setCustomNativeDragPreview } from '@atlaskit/pragmatic-drag-and-drop/element/set-custom-native-drag-preview';
|
|
9
9
|
import {
|
|
10
|
+
type Edge,
|
|
10
11
|
attachClosestEdge,
|
|
11
12
|
extractClosestEdge,
|
|
12
|
-
type Edge,
|
|
13
13
|
} from '@atlaskit/pragmatic-drag-and-drop-hitbox/closest-edge';
|
|
14
14
|
import { useFocusableGroup } from '@fluentui/react-tabster';
|
|
15
15
|
import { composeRefs } from '@radix-ui/react-compose-refs';
|
|
16
16
|
import React, {
|
|
17
|
-
forwardRef,
|
|
18
|
-
useLayoutEffect,
|
|
19
|
-
useState,
|
|
20
17
|
type ComponentPropsWithRef,
|
|
21
|
-
useCallback,
|
|
22
18
|
type ReactNode,
|
|
19
|
+
forwardRef,
|
|
20
|
+
useCallback,
|
|
21
|
+
useLayoutEffect,
|
|
23
22
|
useMemo,
|
|
23
|
+
useState,
|
|
24
24
|
} from 'react';
|
|
25
25
|
import { createPortal } from 'react-dom';
|
|
26
26
|
|
|
27
|
-
import { type ThemedClassName
|
|
27
|
+
import { ListItem, type ThemedClassName } from '@dxos/react-ui';
|
|
28
28
|
import { resizeAttributes, sizeStyle } from '@dxos/react-ui-dnd';
|
|
29
29
|
import { mx } from '@dxos/react-ui-theme';
|
|
30
30
|
|
|
31
|
+
import { type StackItemData, type StackItemSize } from '../defs';
|
|
32
|
+
import { type ItemDragState, StackItemContext, idle, useStack, useStackItem } from '../StackContext';
|
|
33
|
+
|
|
31
34
|
import { StackItemContent, type StackItemContentProps } from './StackItemContent';
|
|
32
35
|
import { StackItemDragHandle, type StackItemDragHandleProps } from './StackItemDragHandle';
|
|
33
36
|
import {
|
|
34
37
|
StackItemHeading,
|
|
35
38
|
StackItemHeadingLabel,
|
|
36
|
-
type StackItemHeadingProps,
|
|
37
39
|
type StackItemHeadingLabelProps,
|
|
40
|
+
type StackItemHeadingProps,
|
|
38
41
|
StackItemHeadingStickyContent,
|
|
39
42
|
} from './StackItemHeading';
|
|
40
43
|
import { StackItemResizeHandle, type StackItemResizeHandleProps } from './StackItemResizeHandle';
|
|
41
44
|
import {
|
|
42
45
|
StackItemSigil,
|
|
43
|
-
type StackItemSigilProps,
|
|
44
46
|
type StackItemSigilAction,
|
|
45
|
-
type StackItemSigilButtonProps,
|
|
46
47
|
StackItemSigilButton,
|
|
48
|
+
type StackItemSigilButtonProps,
|
|
49
|
+
type StackItemSigilProps,
|
|
47
50
|
} from './StackItemSigil';
|
|
48
|
-
import { useStack, StackItemContext, idle, type ItemDragState, useStackItem } from '../StackContext';
|
|
49
|
-
import { type StackItemSize, type StackItemData } from '../defs';
|
|
50
51
|
|
|
51
52
|
// NOTE: 48rem fills the screen on a MacbookPro with the sidebars closed.
|
|
52
53
|
export const DEFAULT_HORIZONTAL_SIZE = 48 satisfies StackItemSize;
|
|
@@ -9,7 +9,7 @@ import { mx } from '@dxos/react-ui-theme';
|
|
|
9
9
|
|
|
10
10
|
import { useStack, useStackItem } from '../StackContext';
|
|
11
11
|
|
|
12
|
-
export type StackItemContentProps = ThemedClassName<ComponentPropsWithoutRef<'div'>> & {
|
|
12
|
+
export type StackItemContentProps = ThemedClassName<Omit<ComponentPropsWithoutRef<'div'>, 'role'>> & {
|
|
13
13
|
/**
|
|
14
14
|
* This flag is required in order to clarify a developer experience that seemed like it needed extra boilerplate
|
|
15
15
|
* (`row-span-2`) or was buggy. See the description of the StackItem.Content component itself for more information.
|
|
@@ -54,15 +54,16 @@ export const StackItemContent = forwardRef<HTMLDivElement, StackItemContentProps
|
|
|
54
54
|
},
|
|
55
55
|
[toolbar, statusbar, layoutManaged],
|
|
56
56
|
);
|
|
57
|
+
|
|
57
58
|
return (
|
|
58
59
|
<div
|
|
59
60
|
role='none'
|
|
60
61
|
{...props}
|
|
61
62
|
className={mx(
|
|
62
|
-
'group grid grid-cols-[100%]',
|
|
63
|
+
'group grid grid-cols-[100%] density-coarse',
|
|
63
64
|
stackItemSize === 'contain' && 'min-bs-0 overflow-hidden',
|
|
64
65
|
size === 'video' ? 'aspect-video' : size === 'square' && 'aspect-square',
|
|
65
|
-
toolbar && '[
|
|
66
|
+
toolbar && '[&>.dx-toolbar]:relative [&>.dx-toolbar]:border-be [&>.dx-toolbar]:border-subduedSeparator',
|
|
66
67
|
role === 'section' &&
|
|
67
68
|
toolbar &&
|
|
68
69
|
'[&_.dx-toolbar]:sticky [&_.dx-toolbar]:z-[1] [&_.dx-toolbar]:block-start-0 [&_.dx-toolbar]:-mbe-px [&_.dx-toolbar]:min-is-0',
|
|
@@ -5,14 +5,14 @@
|
|
|
5
5
|
import { useFocusableGroup } from '@fluentui/react-tabster';
|
|
6
6
|
import { Slot } from '@radix-ui/react-slot';
|
|
7
7
|
import React, {
|
|
8
|
-
type ComponentPropsWithoutRef,
|
|
9
8
|
type ComponentPropsWithRef,
|
|
10
|
-
|
|
9
|
+
type ComponentPropsWithoutRef,
|
|
11
10
|
type PropsWithChildren,
|
|
11
|
+
forwardRef,
|
|
12
12
|
} from 'react';
|
|
13
13
|
|
|
14
14
|
import { type ThemedClassName } from '@dxos/react-ui';
|
|
15
|
-
import {
|
|
15
|
+
import { type AttendableId, type Related, useAttention } from '@dxos/react-ui-attention';
|
|
16
16
|
import { mx } from '@dxos/react-ui-theme';
|
|
17
17
|
|
|
18
18
|
import { useStack } from '../StackContext';
|
|
@@ -6,9 +6,10 @@ import React from 'react';
|
|
|
6
6
|
|
|
7
7
|
import { ResizeHandle } from '@dxos/react-ui-dnd';
|
|
8
8
|
|
|
9
|
-
import { DEFAULT_EXTRINSIC_SIZE } from './StackItem';
|
|
10
9
|
import { useStack, useStackItem } from '../StackContext';
|
|
11
10
|
|
|
11
|
+
import { DEFAULT_EXTRINSIC_SIZE } from './StackItem';
|
|
12
|
+
|
|
12
13
|
const MIN_WIDTH = 20;
|
|
13
14
|
const MIN_HEIGHT = 3;
|
|
14
15
|
|
|
@@ -11,9 +11,10 @@ import { type AttendableId, type Related, useAttention } from '@dxos/react-ui-at
|
|
|
11
11
|
import { descriptionText, mx } from '@dxos/react-ui-theme';
|
|
12
12
|
import { getHostPlatform } from '@dxos/util';
|
|
13
13
|
|
|
14
|
-
import { MenuSignifierHorizontal } from './MenuSignifier';
|
|
15
14
|
import { translationKey } from '../../translations';
|
|
16
15
|
|
|
16
|
+
import { MenuSignifierHorizontal } from './MenuSignifier';
|
|
17
|
+
|
|
17
18
|
export type KeyBinding = {
|
|
18
19
|
windows?: string;
|
|
19
20
|
macos?: string;
|
package/src/components/index.ts
CHANGED
|
@@ -5,20 +5,21 @@
|
|
|
5
5
|
import { Primitive } from '@radix-ui/react-primitive';
|
|
6
6
|
import { Slot } from '@radix-ui/react-slot';
|
|
7
7
|
import React, {
|
|
8
|
-
type ComponentPropsWithoutRef,
|
|
9
8
|
type ComponentPropsWithRef,
|
|
9
|
+
type ComponentPropsWithoutRef,
|
|
10
10
|
type FC,
|
|
11
|
-
forwardRef,
|
|
12
11
|
type PropsWithChildren,
|
|
12
|
+
forwardRef,
|
|
13
13
|
} from 'react';
|
|
14
14
|
|
|
15
15
|
import { Icon, IconButton, type ThemedClassName, Toolbar, type ToolbarRootProps, useTranslation } from '@dxos/react-ui';
|
|
16
16
|
import { hoverableControls, mx } from '@dxos/react-ui-theme';
|
|
17
17
|
|
|
18
|
-
import { cardChrome, cardRoot, cardHeading, cardText, cardSpacing } from './fragments';
|
|
19
18
|
import { StackItem } from '../../components';
|
|
20
19
|
import { translationKey } from '../../translations';
|
|
21
20
|
|
|
21
|
+
import { cardChrome, cardHeading, cardRoot, cardSpacing, cardText } from './fragments';
|
|
22
|
+
|
|
22
23
|
type SharedCardProps = ThemedClassName<ComponentPropsWithoutRef<'div'>> & { asChild?: boolean };
|
|
23
24
|
|
|
24
25
|
const CardStaticRoot = forwardRef<HTMLDivElement, SharedCardProps>(
|
|
@@ -38,16 +39,35 @@ const CardStaticRoot = forwardRef<HTMLDivElement, SharedCardProps>(
|
|
|
38
39
|
* in a Popover) and knows this based on the `role` it receives. This will render a `Card.StaticRoot` by default, otherwise
|
|
39
40
|
* it will render a `div` primitive with the appropriate styling for specific handled situations.
|
|
40
41
|
*/
|
|
41
|
-
const CardSurfaceRoot = ({
|
|
42
|
-
|
|
42
|
+
const CardSurfaceRoot = ({
|
|
43
|
+
role = 'never',
|
|
44
|
+
children,
|
|
45
|
+
classNames,
|
|
46
|
+
}: ThemedClassName<PropsWithChildren<{ role?: string }>>) => {
|
|
47
|
+
if (['card--popover', 'card--intrinsic', 'card--extrinsic'].includes(role)) {
|
|
43
48
|
return (
|
|
44
|
-
<div
|
|
49
|
+
<div
|
|
50
|
+
className={mx(
|
|
51
|
+
role === 'card--popover'
|
|
52
|
+
? 'popover-card-width'
|
|
53
|
+
: ['card--intrinsic', 'card--extrinsic'].includes(role)
|
|
54
|
+
? 'contents'
|
|
55
|
+
: '',
|
|
56
|
+
classNames,
|
|
57
|
+
)}
|
|
58
|
+
>
|
|
45
59
|
{children}
|
|
46
60
|
</div>
|
|
47
61
|
);
|
|
48
62
|
} else {
|
|
49
63
|
return (
|
|
50
|
-
<CardStaticRoot
|
|
64
|
+
<CardStaticRoot
|
|
65
|
+
classNames={[
|
|
66
|
+
role === 'card--transclusion' && 'mlb-[1em]',
|
|
67
|
+
role === 'card--transclusion' && hoverableControls,
|
|
68
|
+
classNames,
|
|
69
|
+
]}
|
|
70
|
+
>
|
|
51
71
|
{children}
|
|
52
72
|
</CardStaticRoot>
|
|
53
73
|
);
|
|
@@ -6,16 +6,17 @@ import '@dxos-theme';
|
|
|
6
6
|
|
|
7
7
|
import { type Edge } from '@atlaskit/pragmatic-drag-and-drop-hitbox/closest-edge';
|
|
8
8
|
import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
9
|
-
import React, {
|
|
9
|
+
import React, { useCallback, useState } from 'react';
|
|
10
10
|
|
|
11
11
|
import { faker } from '@dxos/random';
|
|
12
12
|
import { IconButton } from '@dxos/react-ui';
|
|
13
13
|
import { withLayout, withTheme } from '@dxos/storybook-utils';
|
|
14
14
|
|
|
15
|
-
import { CardStack } from './CardStack';
|
|
16
15
|
import { StackItem } from '../../components';
|
|
17
16
|
import { Card, CardDragPreview } from '../Card';
|
|
18
17
|
|
|
18
|
+
import { CardStack } from './CardStack';
|
|
19
|
+
|
|
19
20
|
// Set a seed for reproducible random values
|
|
20
21
|
faker.seed(0);
|
|
21
22
|
|
|
@@ -8,7 +8,7 @@ import React, { type ComponentPropsWithoutRef, forwardRef } from 'react';
|
|
|
8
8
|
import type { ThemedClassName } from '@dxos/react-ui';
|
|
9
9
|
import { mx } from '@dxos/react-ui-theme';
|
|
10
10
|
|
|
11
|
-
import {
|
|
11
|
+
import { Stack, type StackProps, railGridHorizontalContainFitContent } from '../../components';
|
|
12
12
|
import { Card } from '../Card';
|
|
13
13
|
|
|
14
14
|
type SharedCardStackProps = ThemedClassName<ComponentPropsWithoutRef<'div'>> & { asChild?: boolean };
|
|
@@ -8,7 +8,7 @@ import { autoScrollForElements } from '@atlaskit/pragmatic-drag-and-drop-auto-sc
|
|
|
8
8
|
import { attachClosestEdge, extractClosestEdge } from '@atlaskit/pragmatic-drag-and-drop-hitbox/closest-edge';
|
|
9
9
|
import { useLayoutEffect, useState } from 'react';
|
|
10
10
|
|
|
11
|
-
import { type
|
|
11
|
+
import { type Orientation, type StackItemData, type StackItemRearrangeHandler } from '../components';
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
14
|
* Hook to handle drag and drop functionality for Stack components.
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import React, { type PropsWithChildren } from 'react';
|
|
6
|
+
|
|
7
|
+
import { ExtrinsicCardContainer, IntrinsicCardContainer, PopoverCardContainer } from '@dxos/storybook-utils';
|
|
8
|
+
|
|
9
|
+
import { Card } from '../exemplars';
|
|
10
|
+
|
|
11
|
+
export const CardContainer = ({
|
|
12
|
+
children,
|
|
13
|
+
icon = 'ph--placeholder--regular',
|
|
14
|
+
role,
|
|
15
|
+
}: PropsWithChildren<{ icon?: string; role?: string }>) => {
|
|
16
|
+
switch (role) {
|
|
17
|
+
case 'card--popover':
|
|
18
|
+
return <PopoverCardContainer icon={icon}>{children}</PopoverCardContainer>;
|
|
19
|
+
|
|
20
|
+
case 'card--extrinsic':
|
|
21
|
+
return (
|
|
22
|
+
<ExtrinsicCardContainer>
|
|
23
|
+
<Card.StaticRoot>{children}</Card.StaticRoot>
|
|
24
|
+
</ExtrinsicCardContainer>
|
|
25
|
+
);
|
|
26
|
+
|
|
27
|
+
case 'card--intrinsic':
|
|
28
|
+
return (
|
|
29
|
+
<IntrinsicCardContainer>
|
|
30
|
+
<Card.StaticRoot>{children}</Card.StaticRoot>
|
|
31
|
+
</IntrinsicCardContainer>
|
|
32
|
+
);
|
|
33
|
+
|
|
34
|
+
default:
|
|
35
|
+
return <Card.StaticRoot>{children}</Card.StaticRoot>;
|
|
36
|
+
}
|
|
37
|
+
};
|
package/src/testing/index.ts
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"stack-manager.d.ts","sourceRoot":"","sources":["../../../../src/testing/stack-manager.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,OAAO,EAAQ,MAAM,kBAAkB,CAAC;AAEtD,qBAAa,YAAY;IAGX,QAAQ,CAAC,OAAO,EAAE,OAAO;IAFrC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAO;gBAER,OAAO,EAAE,OAAO;IAIrC,QAAQ,IAAI,OAAO;IAInB,KAAK;IAIL,OAAO,CAAC,KAAK,EAAE,MAAM,GAAG,cAAc;CAGvC;AAED,qBAAa,cAAc;IAGb,QAAQ,CAAC,OAAO,EAAE,OAAO;IAFrC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAO;gBAER,OAAO,EAAE,OAAO;IAI/B,EAAE,IAAI,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC;IAI5B,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC;IAKvB,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;IAK3B,MAAM,CAAC,MAAM,EAAE,OAAO,EAAE,MAAM,GAAE;QAAE,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAA;KAAmB,GAAG,OAAO,CAAC,IAAI,CAAC;CAehG"}
|
|
File without changes
|
|
File without changes
|