@dxos/react-ui-stack 0.6.13 → 0.6.14-main.1366248
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 +9 -8
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/testing/index.mjs +1 -100
- package/dist/lib/browser/testing/index.mjs.map +4 -4
- package/dist/lib/node/index.cjs +7 -6
- package/dist/lib/node/index.cjs.map +3 -3
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node/testing/index.cjs +2 -104
- package/dist/lib/node/testing/index.cjs.map +4 -4
- package/dist/lib/node-esm/index.mjs +378 -0
- package/dist/lib/node-esm/index.mjs.map +7 -0
- package/dist/lib/node-esm/meta.json +1 -0
- package/dist/lib/node-esm/testing/index.mjs +62 -0
- package/dist/lib/node-esm/testing/index.mjs.map +7 -0
- package/dist/types/src/components/CaretDownUp.d.ts.map +1 -1
- package/dist/types/src/components/Deck.stories.d.ts.map +1 -1
- package/dist/types/src/components/Section.d.ts +2 -3
- package/dist/types/src/components/Section.d.ts.map +1 -1
- package/dist/types/src/components/Stack.d.ts +2 -2
- package/dist/types/src/components/Stack.d.ts.map +1 -1
- package/dist/types/src/next/Stack.d.ts +9 -0
- package/dist/types/src/next/Stack.d.ts.map +1 -0
- package/dist/types/src/next/Stack.stories.d.ts +8 -0
- package/dist/types/src/next/Stack.stories.d.ts.map +1 -0
- package/dist/types/src/next/StackItem.d.ts +14 -0
- package/dist/types/src/next/StackItem.d.ts.map +1 -0
- package/dist/types/src/next/index.d.ts +2 -0
- package/dist/types/src/next/index.d.ts.map +1 -0
- package/dist/types/src/playwright/playwright.config.d.ts +2 -2
- package/dist/types/src/playwright/playwright.config.d.ts.map +1 -1
- package/dist/types/src/testing/TableContent.d.ts.map +1 -1
- package/dist/types/src/testing/generator.d.ts +2 -2
- package/dist/types/src/testing/generator.d.ts.map +1 -1
- package/dist/types/src/testing/index.d.ts +0 -1
- package/dist/types/src/testing/index.d.ts.map +1 -1
- package/package.json +33 -26
- package/src/components/CaretDownUp.tsx +1 -0
- package/src/components/ContentTypes.stories.tsx +1 -1
- package/src/components/Deck.stories.tsx +14 -27
- package/src/components/Section.stories.tsx +1 -1
- package/src/components/Section.tsx +9 -18
- package/src/components/Stack.stories.tsx +2 -2
- package/src/components/Stack.tsx +2 -2
- package/src/next/Stack.stories.tsx +148 -0
- package/src/next/Stack.tsx +30 -0
- package/src/next/StackItem.tsx +78 -0
- package/src/next/index.ts +5 -0
- package/src/playwright/playwright.config.ts +13 -2
- package/src/playwright/smoke.spec.ts +11 -19
- package/src/testing/TableContent.tsx +1 -0
- package/src/testing/generator.ts +4 -4
- package/src/testing/index.ts +2 -1
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React, { type ComponentPropsWithoutRef } from 'react';
|
|
2
|
+
import { type ThemedClassName } from '@dxos/react-ui';
|
|
3
|
+
type Orientation = 'horizontal' | 'vertical';
|
|
4
|
+
export type StackProps = Omit<ThemedClassName<ComponentPropsWithoutRef<'div'>>, 'aria-orientation'> & {
|
|
5
|
+
orientation?: Orientation;
|
|
6
|
+
};
|
|
7
|
+
export declare const Stack: ({ children, classNames, style, orientation, ...props }: StackProps) => React.JSX.Element;
|
|
8
|
+
export {};
|
|
9
|
+
//# sourceMappingURL=Stack.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Stack.d.ts","sourceRoot":"","sources":["../../../../src/next/Stack.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,EAAgC,KAAK,wBAAwB,EAAE,MAAM,OAAO,CAAC;AAE3F,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAGtD,KAAK,WAAW,GAAG,YAAY,GAAG,UAAU,CAAC;AAE7C,MAAM,MAAM,UAAU,GAAG,IAAI,CAAC,eAAe,CAAC,wBAAwB,CAAC,KAAK,CAAC,CAAC,EAAE,kBAAkB,CAAC,GAAG;IACpG,WAAW,CAAC,EAAE,WAAW,CAAC;CAC3B,CAAC;AAEF,eAAO,MAAM,KAAK,2DAA4D,UAAU,sBAcvF,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type Meta, type StoryObj } from '@storybook/react';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
declare const StorybookStack: () => React.JSX.Element;
|
|
4
|
+
type Story = StoryObj<typeof StorybookStack>;
|
|
5
|
+
export declare const Default: Story;
|
|
6
|
+
declare const meta: Meta<typeof StorybookStack>;
|
|
7
|
+
export default meta;
|
|
8
|
+
//# sourceMappingURL=Stack.stories.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Stack.stories.d.ts","sourceRoot":"","sources":["../../../../src/next/Stack.stories.tsx"],"names":[],"mappings":"AAKA,OAAO,EAAE,KAAK,IAAI,EAAE,KAAK,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5D,OAAO,KAAgC,MAAM,OAAO,CAAC;AA4BrD,QAAA,MAAM,cAAc,yBAgGnB,CAAC;AAEF,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,cAAc,CAAC,CAAC;AAE7C,eAAO,MAAM,OAAO,EAAE,KAIrB,CAAC;AAEF,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,cAAc,CAKrC,CAAC;AAEF,eAAe,IAAI,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { type Edge } from '@atlaskit/pragmatic-drag-and-drop-hitbox/closest-edge';
|
|
2
|
+
import React, { type ComponentPropsWithoutRef } from 'react';
|
|
3
|
+
import { type ThemedClassName } from '@dxos/react-ui';
|
|
4
|
+
import { type StackProps } from './Stack';
|
|
5
|
+
export type StackItemProps = Omit<ThemedClassName<ComponentPropsWithoutRef<'div'>>, 'aria-orientation'> & {
|
|
6
|
+
item: {
|
|
7
|
+
id: string;
|
|
8
|
+
type: 'column' | 'card';
|
|
9
|
+
};
|
|
10
|
+
orientation?: StackProps['orientation'];
|
|
11
|
+
onReorder: (sourceId: string, targetId: string, closestEdge: Edge | null) => void;
|
|
12
|
+
};
|
|
13
|
+
export declare const StackItem: ({ item, children, classNames, orientation, onReorder, ...props }: StackItemProps) => React.JSX.Element;
|
|
14
|
+
//# sourceMappingURL=StackItem.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"StackItem.d.ts","sourceRoot":"","sources":["../../../../src/next/StackItem.tsx"],"names":[],"mappings":"AAMA,OAAO,EAEL,KAAK,IAAI,EAEV,MAAM,uDAAuD,CAAC;AAE/D,OAAO,KAAK,EAAE,EAA+B,KAAK,wBAAwB,EAAE,MAAM,OAAO,CAAC;AAE1F,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAGtD,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,SAAS,CAAC;AAE1C,MAAM,MAAM,cAAc,GAAG,IAAI,CAAC,eAAe,CAAC,wBAAwB,CAAC,KAAK,CAAC,CAAC,EAAE,kBAAkB,CAAC,GAAG;IACxG,IAAI,EAAE;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,QAAQ,GAAG,MAAM,CAAA;KAAE,CAAC;IAC9C,WAAW,CAAC,EAAE,UAAU,CAAC,aAAa,CAAC,CAAC;IACxC,SAAS,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,WAAW,EAAE,IAAI,GAAG,IAAI,KAAK,IAAI,CAAC;CACnF,CAAC;AAEF,eAAO,MAAM,SAAS,qEAAsE,cAAc,sBAoDzG,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/next/index.ts"],"names":[],"mappings":"AAIA,cAAc,SAAS,CAAC"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
export default
|
|
1
|
+
declare const _default: import("@playwright/test").PlaywrightTestConfig<{}, {}>;
|
|
2
|
+
export default _default;
|
|
3
3
|
//# sourceMappingURL=playwright.config.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"playwright.config.d.ts","sourceRoot":"","sources":["../../../../src/playwright/playwright.config.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"playwright.config.d.ts","sourceRoot":"","sources":["../../../../src/playwright/playwright.config.ts"],"names":[],"mappings":";AASA,wBAQG"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TableContent.d.ts","sourceRoot":"","sources":["../../../../src/testing/TableContent.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"TableContent.d.ts","sourceRoot":"","sources":["../../../../src/testing/TableContent.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAEvC,OAAO,EAIL,KAAK,cAAc,EACnB,KAAK,UAAU,EACf,KAAK,YAAY,EAClB,MAAM,sBAAsB,CAAC;AAE9B,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAEjE,KAAK,IAAI,GAAG;IACV,SAAS,EAAE,SAAS,CAAC;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,IAAI,CAAC;IACf,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,CAAC;AA8BF,eAAO,MAAM,WAAW,cAAe,YAAY,CAAC,IAAI,EAAE,GAAG,CAAC,KAAG,cAAc,CAAC,IAAI,EAAE,GAAG,CAAC,EAqCzF,CAAC;AAEF,eAAO,MAAM,WAAW,UAAW,MAAM,WAWtC,CAAC;AAEJ,MAAM,MAAM,iBAAiB,GAAG,mBAAmB,GAAG,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE,SAAS,GAAG,MAAM,CAAC,CAAC;AAEjG,eAAO,MAAM,YAAY,gCAAiC;IAAE,IAAI,EAAE,iBAAiB,CAAA;CAAE,sBAMpF,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { type ReactiveObject, S } from '@dxos/echo-schema';
|
|
2
2
|
export declare const range: <T>(fn: (i: number) => T | undefined, length: number) => T[];
|
|
3
3
|
export type TestItem = {
|
|
4
4
|
id: string;
|
|
@@ -8,7 +8,7 @@ type ObjectDataGenerator = {
|
|
|
8
8
|
createSchema?: () => S.Schema<any>;
|
|
9
9
|
createData: () => any;
|
|
10
10
|
};
|
|
11
|
-
type ObjectFactory<T extends
|
|
11
|
+
type ObjectFactory<T extends ReactiveObject<any>> = {
|
|
12
12
|
schema?: S.Schema<any>;
|
|
13
13
|
createObject: () => T;
|
|
14
14
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generator.d.ts","sourceRoot":"","sources":["../../../../src/testing/generator.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"generator.d.ts","sourceRoot":"","sources":["../../../../src/testing/generator.ts"],"names":[],"mappings":"AAIA,OAAO,EAAU,KAAK,cAAc,EAAE,CAAC,EAAE,MAAM,mBAAmB,CAAC;AAQnE,eAAO,MAAM,KAAK,GAAI,CAAC,MAAM,CAAC,CAAC,EAAE,MAAM,KAAK,CAAC,GAAG,SAAS,UAAU,MAAM,KAAG,CAAC,EAGlD,CAAC;AAG5B,MAAM,MAAM,QAAQ,GAAG;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;AAE1E,KAAK,mBAAmB,GAAG;IACzB,YAAY,CAAC,EAAE,MAAM,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;IACnC,UAAU,EAAE,MAAM,GAAG,CAAC;CACvB,CAAC;AAEF,KAAK,aAAa,CAAC,CAAC,SAAS,cAAc,CAAC,GAAG,CAAC,IAAI;IAClD,MAAM,CAAC,EAAE,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;IACvB,YAAY,EAAE,MAAM,CAAC,CAAC;CACvB,CAAC;AAEF,KAAK,gBAAgB,GAAG;IAAE,CAAC,IAAI,EAAE,MAAM,GAAG,aAAa,CAAC,GAAG,CAAC,CAAA;CAAE,CAAC;AAW/D,eAAO,MAAM,MAAM,UAAgC,CAAC;AACpD,eAAO,MAAM,QAAQ,UAAkB,CAAC;AAExC,eAAO,MAAM,iBAAiB,EAAE;IAAE,CAAC,IAAI,EAAE,MAAM,GAAG,mBAAmB,CAAA;CA+BpE,CAAC;AAEF;;;GAGG;AAEH,qBAAa,mBAAmB;IAC9B,SAAgB,SAAS,EAAE,gBAAgB,CAAC;gBAEhC,EAAE,KAAK,EAAE,SAAS,EAAE,GAAE;QAAE,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;QAAC,SAAS,CAAC,EAAE,gBAAgB,CAAA;KAAO;IASzF,IAAI,MAAM,IAAI,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,CAE5B;IAED,YAAY,CAAC,EAAE,KAAK,EAAE,GAAE;QAAE,KAAK,CAAC,EAAE,MAAM,EAAE,CAAA;KAAO;IAMjD,aAAa,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE;QAAE,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE;CAGtE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/testing/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/testing/index.ts"],"names":[],"mappings":"AAMA,cAAc,iBAAiB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dxos/react-ui-stack",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.14-main.1366248",
|
|
4
4
|
"description": "A stack component.",
|
|
5
5
|
"homepage": "https://dxos.org",
|
|
6
6
|
"bugs": "https://github.com/dxos/dxos/issues",
|
|
7
7
|
"license": "MIT",
|
|
8
8
|
"author": "DXOS.org",
|
|
9
|
+
"sideEffects": true,
|
|
9
10
|
"exports": {
|
|
10
11
|
".": {
|
|
12
|
+
"types": "./dist/types/src/index.d.ts",
|
|
11
13
|
"browser": "./dist/lib/browser/index.mjs",
|
|
12
|
-
"node":
|
|
13
|
-
"default": "./dist/lib/node/index.cjs"
|
|
14
|
-
},
|
|
15
|
-
"types": "./dist/types/src/index.d.ts"
|
|
14
|
+
"node": "./dist/lib/node-esm/index.mjs"
|
|
16
15
|
},
|
|
17
16
|
"./testing": {
|
|
17
|
+
"types": "./dist/types/src/testing/index.d.ts",
|
|
18
18
|
"browser": "./dist/lib/browser/testing/index.mjs",
|
|
19
19
|
"node": {
|
|
20
|
-
"
|
|
21
|
-
|
|
22
|
-
|
|
20
|
+
"require": "./dist/lib/node/testing/index.cjs",
|
|
21
|
+
"default": "./dist/lib/node-esm/testing/index.mjs"
|
|
22
|
+
}
|
|
23
23
|
}
|
|
24
24
|
},
|
|
25
25
|
"types": "dist/types/src/index.d.ts",
|
|
@@ -35,6 +35,10 @@
|
|
|
35
35
|
"src"
|
|
36
36
|
],
|
|
37
37
|
"dependencies": {
|
|
38
|
+
"@atlaskit/pragmatic-drag-and-drop": "^1.4.0",
|
|
39
|
+
"@atlaskit/pragmatic-drag-and-drop-hitbox": "^1.0.3",
|
|
40
|
+
"@atlaskit/pragmatic-drag-and-drop-react-drop-indicator": "^1.1.3",
|
|
41
|
+
"@effect/schema": "^0.75.1",
|
|
38
42
|
"@fluentui/react-tabster": "^9.19.0",
|
|
39
43
|
"@radix-ui/primitive": "^1.0.0",
|
|
40
44
|
"@radix-ui/react-collapsible": "^1.0.2",
|
|
@@ -43,11 +47,10 @@
|
|
|
43
47
|
"@radix-ui/react-menu": "^2.0.6",
|
|
44
48
|
"@radix-ui/react-use-controllable-state": "^1.0.0",
|
|
45
49
|
"react-resize-detector": "^11.0.1",
|
|
46
|
-
"@dxos/react-ui": "0.6.
|
|
47
|
-
"@dxos/react-ui-
|
|
48
|
-
"@dxos/
|
|
49
|
-
"@dxos/react-ui-
|
|
50
|
-
"@dxos/react-ui-theme": "0.6.13"
|
|
50
|
+
"@dxos/react-ui-attention": "0.6.14-main.1366248",
|
|
51
|
+
"@dxos/react-ui-mosaic": "0.6.14-main.1366248",
|
|
52
|
+
"@dxos/echo-schema": "0.6.14-main.1366248",
|
|
53
|
+
"@dxos/react-ui-deck": "0.6.14-main.1366248"
|
|
51
54
|
},
|
|
52
55
|
"devDependencies": {
|
|
53
56
|
"@phosphor-icons/react": "^2.1.5",
|
|
@@ -55,22 +58,26 @@
|
|
|
55
58
|
"@types/react-dom": "~18.2.0",
|
|
56
59
|
"react": "~18.2.0",
|
|
57
60
|
"react-dom": "~18.2.0",
|
|
58
|
-
"vite": "
|
|
59
|
-
"@dxos/client": "0.6.
|
|
60
|
-
"@dxos/echo-schema": "0.6.
|
|
61
|
-
"@dxos/random": "0.6.
|
|
62
|
-
"@dxos/react-ui
|
|
63
|
-
"@dxos/react-ui-
|
|
64
|
-
"@dxos/
|
|
65
|
-
"@dxos/storybook-utils": "0.6.
|
|
61
|
+
"vite": "5.4.7",
|
|
62
|
+
"@dxos/client": "0.6.14-main.1366248",
|
|
63
|
+
"@dxos/echo-schema": "0.6.14-main.1366248",
|
|
64
|
+
"@dxos/random": "0.6.14-main.1366248",
|
|
65
|
+
"@dxos/react-ui": "0.6.14-main.1366248",
|
|
66
|
+
"@dxos/react-ui-editor": "0.6.14-main.1366248",
|
|
67
|
+
"@dxos/react-ui-table": "0.6.14-main.1366248",
|
|
68
|
+
"@dxos/storybook-utils": "0.6.14-main.1366248",
|
|
69
|
+
"@dxos/react-ui-theme": "0.6.14-main.1366248",
|
|
70
|
+
"@dxos/test-utils": "0.6.14-main.1366248",
|
|
71
|
+
"@dxos/util": "0.6.14-main.1366248"
|
|
66
72
|
},
|
|
67
73
|
"peerDependencies": {
|
|
68
74
|
"@phosphor-icons/react": "^2.1.5",
|
|
69
|
-
"react": "
|
|
70
|
-
"react-dom": "
|
|
71
|
-
"@dxos/client": "0.6.
|
|
72
|
-
"@dxos/random": "0.6.
|
|
73
|
-
"@dxos/
|
|
75
|
+
"react": "~18.2.0",
|
|
76
|
+
"react-dom": "~18.2.0",
|
|
77
|
+
"@dxos/client": "0.6.14-main.1366248",
|
|
78
|
+
"@dxos/random": "0.6.14-main.1366248",
|
|
79
|
+
"@dxos/react-ui": "0.6.14-main.1366248",
|
|
80
|
+
"@dxos/react-ui-theme": "0.6.14-main.1366248"
|
|
74
81
|
},
|
|
75
82
|
"publishConfig": {
|
|
76
83
|
"access": "public"
|
|
@@ -42,7 +42,7 @@ const ContentTypesStoryStack = ({ items }: { items: StackSectionItem[] }) => {
|
|
|
42
42
|
};
|
|
43
43
|
|
|
44
44
|
export default {
|
|
45
|
-
title: 'react-ui-stack/ContentTypes',
|
|
45
|
+
title: 'ui/react-ui-stack/ContentTypes',
|
|
46
46
|
component: ContentTypesStoryStack,
|
|
47
47
|
decorators: [withTheme, withLayout({ tooltips: true })],
|
|
48
48
|
};
|
|
@@ -4,23 +4,13 @@
|
|
|
4
4
|
|
|
5
5
|
import '@dxos-theme';
|
|
6
6
|
|
|
7
|
-
import {
|
|
8
|
-
Books,
|
|
9
|
-
CardsThree,
|
|
10
|
-
CaretLeft,
|
|
11
|
-
CaretLineLeft,
|
|
12
|
-
CaretLineRight,
|
|
13
|
-
CaretRight,
|
|
14
|
-
SidebarSimple,
|
|
15
|
-
TextAa,
|
|
16
|
-
X,
|
|
17
|
-
} from '@phosphor-icons/react';
|
|
7
|
+
import { CaretLeft, CaretLineLeft, CaretLineRight, CaretRight, SidebarSimple, X } from '@phosphor-icons/react';
|
|
18
8
|
import React, { type PropsWithChildren, useState, type ComponentProps } from 'react';
|
|
19
9
|
|
|
20
10
|
import { faker } from '@dxos/random';
|
|
21
|
-
import { Button, Main } from '@dxos/react-ui';
|
|
22
|
-
import {
|
|
23
|
-
import { PlankHeading,
|
|
11
|
+
import { Button, Icon, Main } from '@dxos/react-ui';
|
|
12
|
+
import { RootAttentionProvider } from '@dxos/react-ui-attention';
|
|
13
|
+
import { PlankHeading, Deck as NaturalDeck, Plank } from '@dxos/react-ui-deck';
|
|
24
14
|
import { Mosaic, type MosaicDataItem } from '@dxos/react-ui-mosaic';
|
|
25
15
|
import { withTheme } from '@dxos/storybook-utils';
|
|
26
16
|
import { arrayMove } from '@dxos/util';
|
|
@@ -51,7 +41,7 @@ const SimpleContent = ({ data }: { data: MosaicDataItem & { title?: string; body
|
|
|
51
41
|
const rollItems = (n: number): StackSectionItem[] => {
|
|
52
42
|
return [...Array(n)].map(() => ({
|
|
53
43
|
id: faker.string.uuid(),
|
|
54
|
-
icon:
|
|
44
|
+
icon: 'ph--text-aa--regular',
|
|
55
45
|
isResizable: true,
|
|
56
46
|
object: {
|
|
57
47
|
id: faker.string.uuid(),
|
|
@@ -74,7 +64,7 @@ const StackPlank = ({ label, items, id, children }: PropsWithChildren<PlankProps
|
|
|
74
64
|
<>
|
|
75
65
|
<PlankHeading.Root classNames='pli-px'>
|
|
76
66
|
<PlankHeading.Button>
|
|
77
|
-
<
|
|
67
|
+
<Icon icon='ph--cards-three--regular' size={5} />
|
|
78
68
|
</PlankHeading.Button>
|
|
79
69
|
<PlankHeading.Label classNames='flex-1 truncate'>{label}</PlankHeading.Label>
|
|
80
70
|
{children}
|
|
@@ -103,7 +93,7 @@ const DemoStackPlank = (rootProps: Partial<ComponentProps<typeof Plank.Root>>) =
|
|
|
103
93
|
|
|
104
94
|
export default {
|
|
105
95
|
// NOTE(thure): This is intentionally organized under `react-ui-deck` so that related stories appear together in Storybook despite needing to live in separate packages based on dependencies.
|
|
106
|
-
title: 'react-ui-deck/Deck',
|
|
96
|
+
title: 'ui/react-ui-deck/Deck',
|
|
107
97
|
component: NaturalDeck.Root,
|
|
108
98
|
decorators: [withTheme],
|
|
109
99
|
args: {},
|
|
@@ -112,10 +102,9 @@ export default {
|
|
|
112
102
|
export const StaticBasicStacks = {
|
|
113
103
|
args: {},
|
|
114
104
|
render: () => {
|
|
115
|
-
const [attended] = useState(new Set<string>());
|
|
116
105
|
return (
|
|
117
106
|
<Mosaic.Root>
|
|
118
|
-
<
|
|
107
|
+
<RootAttentionProvider>
|
|
119
108
|
<Mosaic.DragOverlay />
|
|
120
109
|
<NaturalDeck.Root classNames='fixed inset-0 z-0'>
|
|
121
110
|
<DemoStackPlank />
|
|
@@ -126,7 +115,7 @@ export const StaticBasicStacks = {
|
|
|
126
115
|
<DemoStackPlank />
|
|
127
116
|
<DemoStackPlank />
|
|
128
117
|
</NaturalDeck.Root>
|
|
129
|
-
</
|
|
118
|
+
</RootAttentionProvider>
|
|
130
119
|
</Mosaic.Root>
|
|
131
120
|
);
|
|
132
121
|
},
|
|
@@ -135,10 +124,9 @@ export const StaticBasicStacks = {
|
|
|
135
124
|
export const StaticBasicStacksWithOverscrolling = {
|
|
136
125
|
args: {},
|
|
137
126
|
render: () => {
|
|
138
|
-
const [attended] = useState(new Set<string>());
|
|
139
127
|
return (
|
|
140
128
|
<Mosaic.Root>
|
|
141
|
-
<
|
|
129
|
+
<RootAttentionProvider>
|
|
142
130
|
<Mosaic.DragOverlay />
|
|
143
131
|
<NaturalDeck.Root classNames='fixed inset-0 z-0'>
|
|
144
132
|
<DemoStackPlank />
|
|
@@ -149,7 +137,7 @@ export const StaticBasicStacksWithOverscrolling = {
|
|
|
149
137
|
<DemoStackPlank />
|
|
150
138
|
<DemoStackPlank />
|
|
151
139
|
</NaturalDeck.Root>
|
|
152
|
-
</
|
|
140
|
+
</RootAttentionProvider>
|
|
153
141
|
</Mosaic.Root>
|
|
154
142
|
);
|
|
155
143
|
},
|
|
@@ -205,7 +193,6 @@ export const DynamicBasicStacks = () => {
|
|
|
205
193
|
return acc;
|
|
206
194
|
}, {}),
|
|
207
195
|
);
|
|
208
|
-
const [attended] = useState(new Set<string>());
|
|
209
196
|
|
|
210
197
|
const [navOpen, setNavOpen] = useState(true);
|
|
211
198
|
const [c11yOpen, setC11yOpen] = useState(false);
|
|
@@ -244,7 +231,7 @@ export const DynamicBasicStacks = () => {
|
|
|
244
231
|
<>
|
|
245
232
|
<PlankHeading.Root classNames='pli-px'>
|
|
246
233
|
<PlankHeading.Button>
|
|
247
|
-
<
|
|
234
|
+
<Icon icon='ph--books--regular' size={5} />
|
|
248
235
|
</PlankHeading.Button>
|
|
249
236
|
<PlankHeading.Label classNames='grow'>Menu</PlankHeading.Label>
|
|
250
237
|
{c11yContent === MENU ? (
|
|
@@ -295,7 +282,7 @@ export const DynamicBasicStacks = () => {
|
|
|
295
282
|
|
|
296
283
|
return (
|
|
297
284
|
<Mosaic.Root>
|
|
298
|
-
<
|
|
285
|
+
<RootAttentionProvider>
|
|
299
286
|
<Main.Root complementarySidebarOpen={c11yOpen} navigationSidebarOpen={navOpen}>
|
|
300
287
|
<Main.Overlay />
|
|
301
288
|
<Mosaic.DragOverlay />
|
|
@@ -369,7 +356,7 @@ export const DynamicBasicStacks = () => {
|
|
|
369
356
|
)}
|
|
370
357
|
</NaturalDeck.Root>
|
|
371
358
|
</Main.Root>
|
|
372
|
-
</
|
|
359
|
+
</RootAttentionProvider>
|
|
373
360
|
</Mosaic.Root>
|
|
374
361
|
);
|
|
375
362
|
};
|
|
@@ -13,7 +13,7 @@ import { withTheme } from '@dxos/storybook-utils';
|
|
|
13
13
|
import { Section, type SectionProps } from './Section';
|
|
14
14
|
|
|
15
15
|
export default {
|
|
16
|
-
title: 'react-ui-stack/Section',
|
|
16
|
+
title: 'ui/react-ui-stack/Section',
|
|
17
17
|
component: Section as any,
|
|
18
18
|
decorators: [withTheme],
|
|
19
19
|
args: {
|
|
@@ -3,15 +3,7 @@
|
|
|
3
3
|
//
|
|
4
4
|
|
|
5
5
|
import { useFocusableGroup, useTabsterAttributes } from '@fluentui/react-tabster';
|
|
6
|
-
import {
|
|
7
|
-
ArrowLineDown,
|
|
8
|
-
ArrowLineUp,
|
|
9
|
-
ArrowSquareOut,
|
|
10
|
-
CaretUpDown,
|
|
11
|
-
DotsNine,
|
|
12
|
-
type IconProps,
|
|
13
|
-
Trash,
|
|
14
|
-
} from '@phosphor-icons/react';
|
|
6
|
+
import { ArrowLineDown, ArrowLineUp, ArrowSquareOut, CaretUpDown, Trash } from '@phosphor-icons/react';
|
|
15
7
|
import * as CollapsiblePrimitive from '@radix-ui/react-collapsible';
|
|
16
8
|
import React, {
|
|
17
9
|
forwardRef,
|
|
@@ -26,6 +18,7 @@ import React, {
|
|
|
26
18
|
import {
|
|
27
19
|
Button,
|
|
28
20
|
DropdownMenu,
|
|
21
|
+
Icon,
|
|
29
22
|
type Label,
|
|
30
23
|
List,
|
|
31
24
|
ListItem,
|
|
@@ -35,7 +28,7 @@ import {
|
|
|
35
28
|
toLocalizedString,
|
|
36
29
|
useTranslation,
|
|
37
30
|
} from '@dxos/react-ui';
|
|
38
|
-
import {
|
|
31
|
+
import { useAttendableAttributes } from '@dxos/react-ui-attention';
|
|
39
32
|
import { DropDownMenuDragHandleTrigger, resizeHandle, resizeHandleHorizontal } from '@dxos/react-ui-deck';
|
|
40
33
|
import {
|
|
41
34
|
type MosaicActiveType,
|
|
@@ -92,14 +85,14 @@ export type StackSectionItem = MosaicDataItem & {
|
|
|
92
85
|
};
|
|
93
86
|
// TODO(wittjosiah): Common type? Factor out?
|
|
94
87
|
metadata?: {
|
|
95
|
-
icon?:
|
|
88
|
+
icon?: string;
|
|
96
89
|
placeholder?: Label;
|
|
97
90
|
viewActions?: (item: StackSectionItem) => StackAction;
|
|
98
91
|
};
|
|
99
92
|
};
|
|
100
93
|
|
|
101
94
|
export type StackAction = {
|
|
102
|
-
icon:
|
|
95
|
+
icon: string;
|
|
103
96
|
label: Label;
|
|
104
97
|
onClick: () => void;
|
|
105
98
|
};
|
|
@@ -133,7 +126,7 @@ export const Section: ForwardRefExoticComponent<SectionProps & RefAttributes<HTM
|
|
|
133
126
|
{
|
|
134
127
|
id,
|
|
135
128
|
title,
|
|
136
|
-
icon
|
|
129
|
+
icon = 'ph--placeholder--regular',
|
|
137
130
|
size = 'intrinsic',
|
|
138
131
|
collapsed,
|
|
139
132
|
active,
|
|
@@ -157,8 +150,7 @@ export const Section: ForwardRefExoticComponent<SectionProps & RefAttributes<HTM
|
|
|
157
150
|
mover: { cyclic: true, direction: 1, memorizeCurrent: false },
|
|
158
151
|
});
|
|
159
152
|
const sectionContentGroup = useFocusableGroup({});
|
|
160
|
-
const attendableAttrs =
|
|
161
|
-
const hasAttention = useHasAttention(id);
|
|
153
|
+
const attendableAttrs = useAttendableAttributes(id);
|
|
162
154
|
|
|
163
155
|
return (
|
|
164
156
|
<CollapsiblePrimitive.Root
|
|
@@ -180,10 +172,9 @@ export const Section: ForwardRefExoticComponent<SectionProps & RefAttributes<HTM
|
|
|
180
172
|
role='none'
|
|
181
173
|
className={mx(
|
|
182
174
|
'grid col-span-2 grid-cols-subgrid',
|
|
183
|
-
'bg-base
|
|
175
|
+
'bg-base attention-surface',
|
|
184
176
|
hoverableControls,
|
|
185
177
|
hoverableFocusedWithinControls,
|
|
186
|
-
(active || hasAttention) && 'attention-surface border-separator',
|
|
187
178
|
(active === 'origin' || active === 'rearrange' || active === 'destination') && 'opacity-0',
|
|
188
179
|
)}
|
|
189
180
|
>
|
|
@@ -206,7 +197,7 @@ export const Section: ForwardRefExoticComponent<SectionProps & RefAttributes<HTM
|
|
|
206
197
|
}}
|
|
207
198
|
>
|
|
208
199
|
<DropDownMenuDragHandleTrigger active={!!active} variant='ghost' classNames='m-0' {...draggableProps}>
|
|
209
|
-
<Icon
|
|
200
|
+
<Icon icon={icon} size={5} classNames='transition-opacity' />
|
|
210
201
|
</DropDownMenuDragHandleTrigger>
|
|
211
202
|
<DropdownMenu.Portal>
|
|
212
203
|
<DropdownMenu.Content>
|
|
@@ -15,7 +15,7 @@ import { withLayout, withTheme } from '@dxos/storybook-utils';
|
|
|
15
15
|
|
|
16
16
|
import { type StackSectionContent, type StackSectionItem } from './Section';
|
|
17
17
|
import { Stack, type StackProps } from './Stack';
|
|
18
|
-
import { TestObjectGenerator } from '../testing';
|
|
18
|
+
import { TestObjectGenerator } from '../testing/generator';
|
|
19
19
|
|
|
20
20
|
faker.seed(3);
|
|
21
21
|
|
|
@@ -39,7 +39,7 @@ const ComplexContent = ({
|
|
|
39
39
|
};
|
|
40
40
|
|
|
41
41
|
export default {
|
|
42
|
-
title: 'react-ui-stack/Stack',
|
|
42
|
+
title: 'ui/react-ui-stack/Stack',
|
|
43
43
|
component: Stack,
|
|
44
44
|
decorators: [withTheme],
|
|
45
45
|
render: ({ debug, ...args }: DemoStackProps & { debug: boolean }) => {
|
package/src/components/Stack.tsx
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
//
|
|
4
4
|
|
|
5
5
|
import { useArrowNavigationGroup, useFocusableGroup } from '@fluentui/react-tabster';
|
|
6
|
-
import React, { forwardRef, useCallback } from 'react';
|
|
6
|
+
import React, { type ReactNode, forwardRef, useCallback } from 'react';
|
|
7
7
|
import { useResizeDetector } from 'react-resize-detector';
|
|
8
8
|
|
|
9
9
|
import { List, useTranslation } from '@dxos/react-ui';
|
|
@@ -44,7 +44,7 @@ export type StackProps<TData extends StackSectionContent = StackSectionContent>
|
|
|
44
44
|
items?: StackSectionItem[];
|
|
45
45
|
separation?: boolean; // TODO(burdon): Style.
|
|
46
46
|
onCollapseSection?: (id: string, collapsed: boolean) => void;
|
|
47
|
-
emptyComponent?:
|
|
47
|
+
emptyComponent?: ReactNode;
|
|
48
48
|
};
|
|
49
49
|
|
|
50
50
|
export const Stack = ({
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2024 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { type Edge } from '@atlaskit/pragmatic-drag-and-drop-hitbox/closest-edge';
|
|
6
|
+
import { type Meta, type StoryObj } from '@storybook/react';
|
|
7
|
+
import React, { useState, useCallback } from 'react';
|
|
8
|
+
|
|
9
|
+
import { withTheme } from '@dxos/storybook-utils';
|
|
10
|
+
|
|
11
|
+
import { Stack } from './Stack';
|
|
12
|
+
import { StackItem } from './StackItem';
|
|
13
|
+
|
|
14
|
+
type CardItem = {
|
|
15
|
+
id: string;
|
|
16
|
+
type: 'card';
|
|
17
|
+
content: string;
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
type ColumnItem = {
|
|
21
|
+
id: string;
|
|
22
|
+
type: 'column';
|
|
23
|
+
title: string;
|
|
24
|
+
cards: CardItem[];
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
const KanbanBlock = ({ item }: { item: CardItem }) => {
|
|
28
|
+
return (
|
|
29
|
+
<div className='is-64 bs-24 bg-input rounded-lg border border-separator shadow-sm grid place-content-center'>
|
|
30
|
+
<span className='text-sm font-medium'>{item.content}</span>
|
|
31
|
+
</div>
|
|
32
|
+
);
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
const StorybookStack = () => {
|
|
36
|
+
const [columns, setColumns] = useState<ColumnItem[]>([
|
|
37
|
+
{
|
|
38
|
+
id: 'col-0',
|
|
39
|
+
type: 'column',
|
|
40
|
+
title: 'To Do',
|
|
41
|
+
cards: [
|
|
42
|
+
{ id: 'banana', type: 'card', content: 'Banana' },
|
|
43
|
+
{ id: 'pickle', type: 'card', content: 'Pickle' },
|
|
44
|
+
{ id: 'wombat', type: 'card', content: 'Wombat' },
|
|
45
|
+
{ id: 'kazoo', type: 'card', content: 'Kazoo' },
|
|
46
|
+
],
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
id: 'col-1',
|
|
50
|
+
type: 'column',
|
|
51
|
+
title: 'In Progress',
|
|
52
|
+
cards: [
|
|
53
|
+
{ id: 'noodle', type: 'card', content: 'Noodle' },
|
|
54
|
+
{ id: 'squish', type: 'card', content: 'Squish' },
|
|
55
|
+
{ id: 'wobble', type: 'card', content: 'Wobble' },
|
|
56
|
+
{ id: 'floof', type: 'card', content: 'Floof' },
|
|
57
|
+
],
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
id: 'col-2',
|
|
61
|
+
type: 'column',
|
|
62
|
+
title: 'Done',
|
|
63
|
+
cards: [
|
|
64
|
+
{ id: 'snorkel', type: 'card', content: 'Snorkel' },
|
|
65
|
+
{ id: 'bloop', type: 'card', content: 'Bloop' },
|
|
66
|
+
{ id: 'wiggle', type: 'card', content: 'Wiggle' },
|
|
67
|
+
{ id: 'zoop', type: 'card', content: 'Zoop' },
|
|
68
|
+
],
|
|
69
|
+
},
|
|
70
|
+
]);
|
|
71
|
+
|
|
72
|
+
const reorderItem = useCallback((sourceId: string, targetId: string, closestEdge: Edge | null) => {
|
|
73
|
+
setColumns((prevColumns) => {
|
|
74
|
+
const newColumns = [...prevColumns];
|
|
75
|
+
const sourceColumn = newColumns.find(
|
|
76
|
+
(col) => col.id === sourceId || col.cards.some((card) => card.id === sourceId),
|
|
77
|
+
);
|
|
78
|
+
const targetColumn = newColumns.find(
|
|
79
|
+
(col) => col.id === targetId || col.cards.some((card) => card.id === targetId),
|
|
80
|
+
);
|
|
81
|
+
|
|
82
|
+
if (sourceColumn && targetColumn) {
|
|
83
|
+
if (sourceId.startsWith('col-') && targetId.startsWith('col-')) {
|
|
84
|
+
// Reordering columns
|
|
85
|
+
const sourceIndex = newColumns.findIndex((col) => col.id === sourceId);
|
|
86
|
+
const targetIndex = newColumns.findIndex((col) => col.id === targetId);
|
|
87
|
+
const [movedColumn] = newColumns.splice(sourceIndex, 1);
|
|
88
|
+
const insertIndex = closestEdge === 'right' ? targetIndex + 1 : targetIndex;
|
|
89
|
+
newColumns.splice(insertIndex, 0, movedColumn);
|
|
90
|
+
} else {
|
|
91
|
+
// Reordering cards within a column
|
|
92
|
+
const sourceCardIndex = sourceColumn.cards.findIndex((card) => card.id === sourceId);
|
|
93
|
+
const targetCardIndex = targetColumn.cards.findIndex((card) => card.id === targetId);
|
|
94
|
+
const [movedCard] = sourceColumn.cards.splice(sourceCardIndex, 1);
|
|
95
|
+
|
|
96
|
+
let insertIndex;
|
|
97
|
+
if (sourceColumn === targetColumn && sourceCardIndex < targetCardIndex) {
|
|
98
|
+
insertIndex = closestEdge === 'bottom' ? targetCardIndex : targetCardIndex - 1;
|
|
99
|
+
} else {
|
|
100
|
+
insertIndex = closestEdge === 'bottom' ? targetCardIndex + 1 : targetCardIndex;
|
|
101
|
+
}
|
|
102
|
+
targetColumn.cards.splice(insertIndex, 0, movedCard);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
return newColumns;
|
|
107
|
+
});
|
|
108
|
+
}, []);
|
|
109
|
+
|
|
110
|
+
return (
|
|
111
|
+
<Stack orientation={'horizontal'} classNames='gap-1'>
|
|
112
|
+
{columns.map((column) => (
|
|
113
|
+
<StackItem
|
|
114
|
+
key={column.id}
|
|
115
|
+
item={column}
|
|
116
|
+
orientation={'horizontal'}
|
|
117
|
+
classNames='p-4 bg-deck rounded-md'
|
|
118
|
+
onReorder={reorderItem}
|
|
119
|
+
>
|
|
120
|
+
<Stack orientation={'vertical'} classNames='gap-1'>
|
|
121
|
+
{column.cards.map((card) => (
|
|
122
|
+
<StackItem key={card.id} item={card} orientation={'vertical'} onReorder={reorderItem}>
|
|
123
|
+
<KanbanBlock item={card} />
|
|
124
|
+
</StackItem>
|
|
125
|
+
))}
|
|
126
|
+
</Stack>
|
|
127
|
+
</StackItem>
|
|
128
|
+
))}
|
|
129
|
+
</Stack>
|
|
130
|
+
);
|
|
131
|
+
};
|
|
132
|
+
|
|
133
|
+
type Story = StoryObj<typeof StorybookStack>;
|
|
134
|
+
|
|
135
|
+
export const Default: Story = {
|
|
136
|
+
args: {
|
|
137
|
+
orientation: 'horizontal',
|
|
138
|
+
},
|
|
139
|
+
};
|
|
140
|
+
|
|
141
|
+
const meta: Meta<typeof StorybookStack> = {
|
|
142
|
+
title: 'ui/react-ui-stack-next/Stack',
|
|
143
|
+
component: StorybookStack,
|
|
144
|
+
decorators: [withTheme],
|
|
145
|
+
argTypes: { orientation: { control: 'radio', options: ['horizontal', 'vertical'] } },
|
|
146
|
+
};
|
|
147
|
+
|
|
148
|
+
export default meta;
|