@dxos/react-ui-stack 0.8.2-main.f11618f → 0.8.2-staging.42af850

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (78) hide show
  1. package/dist/lib/browser/index.mjs +484 -422
  2. package/dist/lib/browser/index.mjs.map +4 -4
  3. package/dist/lib/browser/meta.json +1 -1
  4. package/dist/lib/browser/testing/index.mjs.map +3 -3
  5. package/dist/lib/node/index.cjs +472 -411
  6. package/dist/lib/node/index.cjs.map +4 -4
  7. package/dist/lib/node/meta.json +1 -1
  8. package/dist/lib/node/testing/index.cjs.map +3 -3
  9. package/dist/lib/node-esm/index.mjs +484 -422
  10. package/dist/lib/node-esm/index.mjs.map +4 -4
  11. package/dist/lib/node-esm/meta.json +1 -1
  12. package/dist/lib/node-esm/testing/index.mjs.map +3 -3
  13. package/dist/types/src/components/{Stack.d.ts → Stack/Stack.d.ts} +4 -1
  14. package/dist/types/src/components/Stack/Stack.d.ts.map +1 -0
  15. package/dist/types/src/components/Stack/Stack.stories.d.ts +9 -0
  16. package/dist/types/src/components/Stack/Stack.stories.d.ts.map +1 -0
  17. package/dist/types/src/components/Stack/index.d.ts +2 -0
  18. package/dist/types/src/components/Stack/index.d.ts.map +1 -0
  19. package/dist/types/src/components/StackContext.d.ts +14 -10
  20. package/dist/types/src/components/StackContext.d.ts.map +1 -1
  21. package/dist/types/src/components/StackItem/MenuSignifier.d.ts.map +1 -0
  22. package/dist/types/src/components/{StackItem.d.ts → StackItem/StackItem.d.ts} +14 -5
  23. package/dist/types/src/components/StackItem/StackItem.d.ts.map +1 -0
  24. package/dist/types/src/components/StackItem/StackItem.stories.d.ts +8 -0
  25. package/dist/types/src/components/StackItem/StackItem.stories.d.ts.map +1 -0
  26. package/dist/types/src/components/StackItem/StackItemContent.d.ts.map +1 -0
  27. package/dist/types/src/components/StackItem/StackItemDragHandle.d.ts.map +1 -0
  28. package/dist/types/src/components/StackItem/StackItemHeading.d.ts.map +1 -0
  29. package/dist/types/src/components/StackItem/StackItemResizeHandle.d.ts.map +1 -0
  30. package/dist/types/src/components/StackItem/StackItemSigil.d.ts.map +1 -0
  31. package/dist/types/src/components/StackItem/index.d.ts +2 -0
  32. package/dist/types/src/components/StackItem/index.d.ts.map +1 -0
  33. package/dist/types/src/components/defs.d.ts +18 -0
  34. package/dist/types/src/components/defs.d.ts.map +1 -0
  35. package/dist/types/src/components/deprecated/LayoutControls.d.ts.map +1 -0
  36. package/dist/types/src/components/index.d.ts +1 -2
  37. package/dist/types/src/components/index.d.ts.map +1 -1
  38. package/dist/types/src/hooks/useStackDropForElements.d.ts +3 -4
  39. package/dist/types/src/hooks/useStackDropForElements.d.ts.map +1 -1
  40. package/dist/types/src/testing/stack-manager.d.ts.map +1 -1
  41. package/dist/types/tsconfig.tsbuildinfo +1 -1
  42. package/package.json +21 -20
  43. package/src/components/{Stack.stories.tsx → Stack/Stack.stories.tsx} +29 -17
  44. package/src/components/{Stack.tsx → Stack/Stack.tsx} +37 -5
  45. package/src/components/Stack/index.ts +5 -0
  46. package/src/components/StackContext.tsx +21 -13
  47. package/src/components/StackItem/StackItem.stories.tsx +49 -0
  48. package/src/components/{StackItem.tsx → StackItem/StackItem.tsx} +90 -11
  49. package/src/components/{StackItemContent.tsx → StackItem/StackItemContent.tsx} +1 -1
  50. package/src/components/{StackItemDragHandle.tsx → StackItem/StackItemDragHandle.tsx} +1 -1
  51. package/src/components/{StackItemHeading.tsx → StackItem/StackItemHeading.tsx} +3 -2
  52. package/src/components/{StackItemResizeHandle.tsx → StackItem/StackItemResizeHandle.tsx} +1 -1
  53. package/src/components/{StackItemSigil.tsx → StackItem/StackItemSigil.tsx} +3 -15
  54. package/src/components/StackItem/index.ts +5 -0
  55. package/src/components/defs.ts +26 -0
  56. package/src/components/{LayoutControls.tsx → deprecated/LayoutControls.tsx} +3 -23
  57. package/src/components/index.ts +2 -2
  58. package/src/hooks/useStackDropForElements.ts +3 -4
  59. package/src/testing/stack-manager.ts +6 -6
  60. package/dist/types/src/components/LayoutControls.d.ts.map +0 -1
  61. package/dist/types/src/components/MenuSignifier.d.ts.map +0 -1
  62. package/dist/types/src/components/Stack.d.ts.map +0 -1
  63. package/dist/types/src/components/Stack.stories.d.ts +0 -8
  64. package/dist/types/src/components/Stack.stories.d.ts.map +0 -1
  65. package/dist/types/src/components/StackItem.d.ts.map +0 -1
  66. package/dist/types/src/components/StackItemContent.d.ts.map +0 -1
  67. package/dist/types/src/components/StackItemDragHandle.d.ts.map +0 -1
  68. package/dist/types/src/components/StackItemHeading.d.ts.map +0 -1
  69. package/dist/types/src/components/StackItemResizeHandle.d.ts.map +0 -1
  70. package/dist/types/src/components/StackItemSigil.d.ts.map +0 -1
  71. /package/dist/types/src/components/{MenuSignifier.d.ts → StackItem/MenuSignifier.d.ts} +0 -0
  72. /package/dist/types/src/components/{StackItemContent.d.ts → StackItem/StackItemContent.d.ts} +0 -0
  73. /package/dist/types/src/components/{StackItemDragHandle.d.ts → StackItem/StackItemDragHandle.d.ts} +0 -0
  74. /package/dist/types/src/components/{StackItemHeading.d.ts → StackItem/StackItemHeading.d.ts} +0 -0
  75. /package/dist/types/src/components/{StackItemResizeHandle.d.ts → StackItem/StackItemResizeHandle.d.ts} +0 -0
  76. /package/dist/types/src/components/{StackItemSigil.d.ts → StackItem/StackItemSigil.d.ts} +0 -0
  77. /package/dist/types/src/components/{LayoutControls.d.ts → deprecated/LayoutControls.d.ts} +0 -0
  78. /package/src/components/{MenuSignifier.tsx → StackItem/MenuSignifier.tsx} +0 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"StackItem.d.ts","sourceRoot":"","sources":["../../../../../src/components/StackItem/StackItem.tsx"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAE,EAIZ,KAAK,qBAAqB,EAE1B,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AAGf,OAAO,EAAE,KAAK,eAAe,EAAY,MAAM,gBAAgB,CAAC;AAIhE,OAAO,EAAoB,KAAK,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G3E,CAAC;AAEF,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;gCAL6B,yBAAyB;CAe3E,CAAC;AAEF,YAAY,EACV,kBAAkB,EAClB,qBAAqB,EACrB,qBAAqB,EACrB,0BAA0B,EAC1B,0BAA0B,EAC1B,wBAAwB,EACxB,mBAAmB,EACnB,yBAAyB,EACzB,oBAAoB,EACpB,yBAAyB,GAC1B,CAAC"}
@@ -0,0 +1,8 @@
1
+ import '@dxos-theme';
2
+ import { type Meta, type StoryObj } from '@storybook/react';
3
+ import { StackItem } from './StackItem';
4
+ declare const meta: Meta<typeof StackItem.Root>;
5
+ export default meta;
6
+ type Story = StoryObj<typeof StackItem.Root>;
7
+ export declare const Default: Story;
8
+ //# sourceMappingURL=StackItem.stories.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"StackItem.stories.d.ts","sourceRoot":"","sources":["../../../../../src/components/StackItem/StackItem.stories.tsx"],"names":[],"mappings":"AAIA,OAAO,aAAa,CAAC;AAErB,OAAO,EAAE,KAAK,IAAI,EAAE,KAAK,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAM5D,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,SAAS,CAAC,IAAI,CAwBrC,CAAC;AAEF,eAAe,IAAI,CAAC;AAEpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,SAAS,CAAC,IAAI,CAAC,CAAC;AAE7C,eAAO,MAAM,OAAO,EAAE,KAIrB,CAAC"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"StackItemContent.d.ts","sourceRoot":"","sources":["../../../../../src/components/StackItem/StackItemContent.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,EAAE,KAAK,wBAAwB,EAAc,MAAM,OAAO,CAAC;AAEzE,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAKtD,MAAM,MAAM,qBAAqB,GAAG,eAAe,CAAC,wBAAwB,CAAC,KAAK,CAAC,CAAC,GAAG;IACrF;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAElB;;OAEG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IAEpB;;;OAGG;IACH,IAAI,CAAC,EAAE,WAAW,GAAG,OAAO,GAAG,QAAQ,CAAC;CACzC,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,gBAAgB;;;IAtB3B;;;OAGG;cACO,OAAO;IAEjB;;OAEG;gBACS,OAAO;IAEnB;;;OAGG;WACI,WAAW,GAAG,OAAO,GAAG,QAAQ;wCAmCxC,CAAC"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"StackItemDragHandle.d.ts","sourceRoot":"","sources":["../../../../../src/components/StackItem/StackItemDragHandle.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,EAAE,KAAK,wBAAwB,EAAE,MAAM,OAAO,CAAC;AAI7D,MAAM,MAAM,wBAAwB,GAAG,wBAAwB,CAAC,QAAQ,CAAC,GAAG;IAAE,OAAO,EAAE,OAAO,CAAA;CAAE,CAAC;AAEjG,eAAO,MAAM,mBAAmB,GAAI,uBAAuB,wBAAwB,sBAUlF,CAAC"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"StackItemHeading.d.ts","sourceRoot":"","sources":["../../../../../src/components/StackItem/StackItemHeading.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,EAAE,KAAK,wBAAwB,EAAE,KAAK,qBAAqB,EAAc,MAAM,OAAO,CAAC;AAErG,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,gBAAgB,CAAC;AACtD,OAAO,EAAgB,KAAK,YAAY,EAAE,KAAK,OAAO,EAAE,MAAM,0BAA0B,CAAC;AAKzF,MAAM,MAAM,qBAAqB,GAAG,eAAe,CAAC,wBAAwB,CAAC,KAAK,CAAC,CAAC,CAAC;AAErF,eAAO,MAAM,gBAAgB,GAAI,oCAAoC,qBAAqB,sBAoBzF,CAAC;AAEF,MAAM,MAAM,0BAA0B,GAAG,eAAe,CAAC,qBAAqB,CAAC,IAAI,CAAC,CAAC,GAAG,YAAY,GAAG,OAAO,CAAC;AAE/G,eAAO,MAAM,qBAAqB,oHAgBjC,CAAC"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"StackItemResizeHandle.d.ts","sourceRoot":"","sources":["../../../../../src/components/StackItem/StackItemResizeHandle.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,MAAM,OAAO,CAAC;AAU1B,MAAM,MAAM,0BAA0B,GAAG,EAAE,CAAC;AAE5C,eAAO,MAAM,qBAAqB,yBAajC,CAAC"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"StackItemSigil.d.ts","sourceRoot":"","sources":["../../../../../src/components/StackItem/StackItemSigil.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,EAAY,KAAK,iBAAiB,EAAwB,MAAM,OAAO,CAAC;AAEtF,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAElD,OAAO,EAAU,KAAK,WAAW,EAAyD,MAAM,gBAAgB,CAAC;AACjH,OAAO,EAAE,KAAK,YAAY,EAAE,KAAK,OAAO,EAAgB,MAAM,0BAA0B,CAAC;AAOzF,MAAM,MAAM,UAAU,GAAG;IACvB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAAG,IAAI,CAAC,UAAU,EAAE,IAAI,GAAG,YAAY,GAAG,MAAM,CAAC,CAAC;AAElF,MAAM,MAAM,yBAAyB,GAAG,IAAI,CAAC,WAAW,EAAE,SAAS,CAAC,GAClE,YAAY,GACZ,OAAO,GAAG;IACR,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB,CAAC;AAEJ,eAAO,MAAM,oBAAoB,kHAiBhC,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG,iBAAiB,CACjD;IACE,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,YAAY,EAAE,MAAM,CAAC;IACrB,OAAO,CAAC,EAAE,oBAAoB,EAAE,EAAE,CAAC;IACnC,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,CAAC,MAAM,EAAE,oBAAoB,KAAK,IAAI,CAAC;CACnD,GAAG,OAAO,CACZ,CAAC;AAEF,eAAO,MAAM,cAAc;mBARR,MAAM;kBACP,MAAM;cACV,oBAAoB,EAAE,EAAE;UAC5B,MAAM;eACD,CAAC,MAAM,EAAE,oBAAoB,KAAK,IAAI;;;2CA6FpD,CAAC"}
@@ -0,0 +1,2 @@
1
+ export * from './StackItem';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/StackItem/index.ts"],"names":[],"mappings":"AAIA,cAAc,aAAa,CAAC"}
@@ -0,0 +1,18 @@
1
+ import type { Edge } from '@atlaskit/pragmatic-drag-and-drop-hitbox/closest-edge';
2
+ import { type Size as DndSize } from '@dxos/react-ui-dnd';
3
+ import { type Orientation, type Size } from './Stack';
4
+ export type StackItemSize = DndSize;
5
+ export type StackItemData = {
6
+ id: string;
7
+ type: 'column' | 'card';
8
+ };
9
+ export type StackItemRearrangeHandler<Data extends {
10
+ id: string;
11
+ } = StackItemData> = (source: Data, target: Data, closestEdge: Edge | null) => void;
12
+ export type StackContextValue = {
13
+ orientation: Orientation;
14
+ rail: boolean;
15
+ size: Size;
16
+ onRearrange?: StackItemRearrangeHandler;
17
+ };
18
+ //# sourceMappingURL=defs.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"defs.d.ts","sourceRoot":"","sources":["../../../../src/components/defs.ts"],"names":[],"mappings":"AAIA,OAAO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;IACvB,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG,IAAI,CAAC,gBAAgB,EAAE,SAAS,CAAC,GAAG;IACpE,OAAO,CAAC,EAAE,oBAAoB,CAAC;IAC/B,OAAO,CAAC,EAAE,eAAe,GAAG,SAAS,CAAC;IACtC,KAAK,CAAC,EAAE,OAAO,GAAG,cAAc,GAAG,YAAY,CAAC;IAChD,YAAY,EAAE,kBAAkB,CAAC;IACjC,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,GAAG,CAAC,EAAE,OAAO,GAAG,KAAK,GAAG,MAAM,CAAC;CAChC,CAAC;AAMF,eAAO,MAAM,cAAc,yGA4E1B,CAAC"}
@@ -1,5 +1,4 @@
1
+ export * from './defs';
1
2
  export * from './Stack';
2
3
  export * from './StackItem';
3
- export * from './LayoutControls';
4
- export * from './StackContext';
5
4
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/index.ts"],"names":[],"mappings":"AAIA,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC;AAC5B,cAAc,kBAAkB,CAAC;AACjC,cAAc,gBAAgB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/index.ts"],"names":[],"mappings":"AAIA,cAAc,QAAQ,CAAC;AAEvB,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC"}
@@ -1,13 +1,12 @@
1
- import { type Orientation } from '../components/Stack';
2
- import { type StackItemRearrangeHandler } from '../components/StackContext';
1
+ import { type StackItemRearrangeHandler, type Orientation } from '../components';
3
2
  /**
4
3
  * Hook to handle drag and drop functionality for Stack components.
5
4
  */
6
- export declare const useStackDropForElements: ({ element, selfDroppable, orientation, id, onRearrange, }: {
5
+ export declare const useStackDropForElements: ({ id, element, selfDroppable, orientation, onRearrange, }: {
6
+ id?: string;
7
7
  element: HTMLDivElement | null;
8
8
  selfDroppable: boolean;
9
9
  orientation: Orientation;
10
- id?: string;
11
10
  onRearrange?: StackItemRearrangeHandler;
12
11
  }) => {
13
12
  dropping: boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"useStackDropForElements.d.ts","sourceRoot":"","sources":["../../../../src/hooks/useStackDropForElements.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAAE,KAAK,yBAAyB,EAAsB,MAAM,4BAA4B,CAAC;AAEhG;;GAEG;AACH,eAAO,MAAM,uBAAuB,8DAMjC;IACD,OAAO,EAAE,cAAc,GAAG,IAAI,CAAC;IAC/B,aAAa,EAAE,OAAO,CAAC;IACvB,WAAW,EAAE,WAAW,CAAC;IACzB,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,WAAW,CAAC,EAAE,yBAAyB,CAAC;CACzC;;CA4CA,CAAC"}
1
+ {"version":3,"file":"useStackDropForElements.d.ts","sourceRoot":"","sources":["../../../../src/hooks/useStackDropForElements.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,KAAK,yBAAyB,EAAsB,KAAK,WAAW,EAAE,MAAM,eAAe,CAAC;AAErG;;GAEG;AACH,eAAO,MAAM,uBAAuB,GAAI,2DAMrC;IACD,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,OAAO,EAAE,cAAc,GAAG,IAAI,CAAC;IAC/B,aAAa,EAAE,OAAO,CAAC;IACvB,WAAW,EAAE,WAAW,CAAC;IACzB,WAAW,CAAC,EAAE,yBAAyB,CAAC;CACzC;;CA4CA,CAAC"}
@@ -1 +1 @@
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,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
+ {"version":"5.8.3"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dxos/react-ui-stack",
3
- "version": "0.8.2-main.f11618f",
3
+ "version": "0.8.2-staging.42af850",
4
4
  "description": "A stack component.",
5
5
  "homepage": "https://dxos.org",
6
6
  "bugs": "https://github.com/dxos/dxos/issues",
@@ -40,6 +40,7 @@
40
40
  "@atlaskit/pragmatic-drag-and-drop-auto-scroll": "^2.1.0",
41
41
  "@atlaskit/pragmatic-drag-and-drop-hitbox": "^1.0.3",
42
42
  "@fluentui/react-tabster": "^9.24.2",
43
+ "@preact-signals/safe-react": "^0.9.0",
43
44
  "@radix-ui/primitive": "1.1.1",
44
45
  "@radix-ui/react-compose-refs": "1.1.1",
45
46
  "@radix-ui/react-context": "1.1.1",
@@ -47,12 +48,12 @@
47
48
  "@radix-ui/react-slot": "1.1.2",
48
49
  "@radix-ui/react-use-controllable-state": "1.1.0",
49
50
  "react-resize-detector": "^11.0.1",
50
- "@dxos/echo-schema": "0.8.2-main.f11618f",
51
- "@dxos/keyboard": "0.8.2-main.f11618f",
52
- "@dxos/live-object": "0.8.2-main.f11618f",
53
- "@dxos/react-ui-dnd": "0.8.2-main.f11618f",
54
- "@dxos/util": "0.8.2-main.f11618f",
55
- "@dxos/react-ui-attention": "0.8.2-main.f11618f"
51
+ "@dxos/echo-schema": "0.8.2-staging.42af850",
52
+ "@dxos/live-object": "0.8.2-staging.42af850",
53
+ "@dxos/keyboard": "0.8.2-staging.42af850",
54
+ "@dxos/react-ui-attention": "0.8.2-staging.42af850",
55
+ "@dxos/react-ui-dnd": "0.8.2-staging.42af850",
56
+ "@dxos/util": "0.8.2-staging.42af850"
56
57
  },
57
58
  "devDependencies": {
58
59
  "@phosphor-icons/react": "^2.1.5",
@@ -61,24 +62,24 @@
61
62
  "react": "~18.2.0",
62
63
  "react-dom": "~18.2.0",
63
64
  "vite": "5.4.7",
64
- "@dxos/app-graph": "0.8.2-main.f11618f",
65
- "@dxos/client": "0.8.2-main.f11618f",
66
- "@dxos/echo-schema": "0.8.2-main.f11618f",
67
- "@dxos/react-ui": "0.8.2-main.f11618f",
68
- "@dxos/random": "0.8.2-main.f11618f",
69
- "@dxos/react-ui-editor": "0.8.2-main.f11618f",
70
- "@dxos/react-ui-theme": "0.8.2-main.f11618f",
71
- "@dxos/storybook-utils": "0.8.2-main.f11618f",
72
- "@dxos/test-utils": "0.8.2-main.f11618f"
65
+ "@dxos/app-graph": "0.8.2-staging.42af850",
66
+ "@dxos/client": "0.8.2-staging.42af850",
67
+ "@dxos/random": "0.8.2-staging.42af850",
68
+ "@dxos/react-ui": "0.8.2-staging.42af850",
69
+ "@dxos/react-ui-theme": "0.8.2-staging.42af850",
70
+ "@dxos/storybook-utils": "0.8.2-staging.42af850",
71
+ "@dxos/react-ui-editor": "0.8.2-staging.42af850",
72
+ "@dxos/echo-schema": "0.8.2-staging.42af850",
73
+ "@dxos/test-utils": "0.8.2-staging.42af850"
73
74
  },
74
75
  "peerDependencies": {
75
76
  "@phosphor-icons/react": "^2.1.5",
76
77
  "react": "~18.2.0",
77
78
  "react-dom": "~18.2.0",
78
- "@dxos/client": "0.8.2-main.f11618f",
79
- "@dxos/random": "0.8.2-main.f11618f",
80
- "@dxos/react-ui-theme": "0.8.2-main.f11618f",
81
- "@dxos/react-ui": "0.8.2-main.f11618f"
79
+ "@dxos/client": "0.8.2-staging.42af850",
80
+ "@dxos/random": "0.8.2-staging.42af850",
81
+ "@dxos/react-ui": "0.8.2-staging.42af850",
82
+ "@dxos/react-ui-theme": "0.8.2-staging.42af850"
82
83
  },
83
84
  "publishConfig": {
84
85
  "access": "public"
@@ -2,6 +2,8 @@
2
2
  // Copyright 2024 DXOS.org
3
3
  //
4
4
 
5
+ import '@dxos-theme';
6
+
5
7
  import { type Edge } from '@atlaskit/pragmatic-drag-and-drop-hitbox/closest-edge';
6
8
  import { type Meta, type StoryObj } from '@storybook/react';
7
9
  import React, { useState, useCallback } from 'react';
@@ -10,8 +12,8 @@ import { faker } from '@dxos/random';
10
12
  import { withTheme } from '@dxos/storybook-utils';
11
13
 
12
14
  import { Stack } from './Stack';
13
- import { type StackItemData } from './StackContext';
14
- import { StackItem } from './StackItem';
15
+ import { StackItem } from '../StackItem';
16
+ import { type StackItemData } from '../defs';
15
17
 
16
18
  type StoryStackItem = {
17
19
  id: string;
@@ -27,7 +29,7 @@ const KanbanBlock = ({ item }: { item: StoryStackItem }) => {
27
29
  );
28
30
  };
29
31
 
30
- const StorybookStack = () => {
32
+ const DefaultStory = () => {
31
33
  const [columns, setColumns] = useState<StoryStackItem[]>(
32
34
  faker.helpers.multiple(
33
35
  () =>
@@ -95,14 +97,24 @@ const StorybookStack = () => {
95
97
  return (
96
98
  <main className='fixed inset-0'>
97
99
  <Stack orientation='horizontal' size='contain' onRearrange={reorderItem}>
98
- {columns.map((column) => (
99
- <StackItem.Root key={column.id} item={column}>
100
+ {columns.map((column, columnIndex, columnsArray) => (
101
+ <StackItem.Root
102
+ key={column.id}
103
+ item={column}
104
+ prevSiblingId={columnIndex > 0 ? columnsArray[columnIndex - 1].id : undefined}
105
+ nextSiblingId={columnIndex < columnsArray.length - 1 ? columnsArray[columnIndex + 1].id : undefined}
106
+ >
100
107
  <StackItem.Heading>
101
108
  <StackItem.ResizeHandle />
102
109
  </StackItem.Heading>
103
110
  <Stack orientation='vertical' size='contain'>
104
- {column.items?.map((card) => (
105
- <StackItem.Root key={card.id} item={card}>
111
+ {column.items?.map((card, cardIndex, cardsArray) => (
112
+ <StackItem.Root
113
+ key={card.id}
114
+ item={card}
115
+ prevSiblingId={cardIndex > 0 ? cardsArray[cardIndex - 1].id : undefined}
116
+ nextSiblingId={cardIndex < cardsArray.length - 1 ? cardsArray[cardIndex + 1].id : undefined}
117
+ >
106
118
  <StackItem.Heading>
107
119
  <StackItem.ResizeHandle />
108
120
  </StackItem.Heading>
@@ -117,19 +129,19 @@ const StorybookStack = () => {
117
129
  );
118
130
  };
119
131
 
120
- type Story = StoryObj<typeof StorybookStack>;
121
-
122
- export const Default: Story = {
123
- args: {
124
- orientation: 'horizontal',
125
- },
126
- };
127
-
128
- const meta: Meta<typeof StorybookStack> = {
132
+ const meta: Meta<typeof DefaultStory> = {
129
133
  title: 'ui/react-ui-stack/Stack',
130
- component: StorybookStack,
134
+ component: DefaultStory,
131
135
  decorators: [withTheme],
132
136
  argTypes: { orientation: { control: 'radio', options: ['horizontal', 'vertical'] } },
133
137
  };
134
138
 
135
139
  export default meta;
140
+
141
+ type Story = StoryObj<typeof DefaultStory>;
142
+
143
+ export const Default: Story = {
144
+ args: {
145
+ orientation: 'horizontal',
146
+ },
147
+ };
@@ -4,19 +4,32 @@
4
4
 
5
5
  import { useArrowNavigationGroup } from '@fluentui/react-tabster';
6
6
  import { composeRefs } from '@radix-ui/react-compose-refs';
7
- import React, { Children, type CSSProperties, type ComponentPropsWithRef, forwardRef, useState, useMemo } from 'react';
7
+ import React, {
8
+ Children,
9
+ type CSSProperties,
10
+ type ComponentPropsWithRef,
11
+ forwardRef,
12
+ useState,
13
+ useMemo,
14
+ useCallback,
15
+ } from 'react';
8
16
 
9
17
  import { type ThemedClassName, ListItem } from '@dxos/react-ui';
10
18
  import { mx } from '@dxos/react-ui-theme';
11
19
 
12
- import { type StackContextValue, StackContext } from './StackContext';
13
- import { useStackDropForElements } from '../hooks';
20
+ import { useStackDropForElements } from '../../hooks';
21
+ import { StackContext } from '../StackContext';
22
+ import { type StackContextValue } from '../defs';
14
23
 
15
24
  export type Orientation = 'horizontal' | 'vertical';
16
25
  export type Size = 'intrinsic' | 'contain' | 'contain-fit-content';
17
26
 
18
27
  export type StackProps = Omit<ThemedClassName<ComponentPropsWithRef<'div'>>, 'aria-orientation'> &
19
- Partial<StackContextValue> & { itemsCount?: number };
28
+ Partial<StackContextValue> & {
29
+ itemsCount?: number;
30
+ getDropElement?: (stackElement: HTMLDivElement) => HTMLDivElement;
31
+ separatorOnScroll?: number;
32
+ };
20
33
 
21
34
  export const railGridHorizontal = 'grid-rows-[[rail-start]_var(--rail-size)_[content-start]_1fr_[content-end]]';
22
35
  export const railGridVertical = 'grid-cols-[[rail-start]_var(--rail-size)_[content-start]_1fr_[content-end]]';
@@ -40,6 +53,8 @@ export const Stack = forwardRef<HTMLDivElement, StackProps>(
40
53
  size = 'intrinsic',
41
54
  onRearrange,
42
55
  itemsCount = Children.count(children),
56
+ getDropElement,
57
+ separatorOnScroll,
43
58
  ...props
44
59
  },
45
60
  forwardedRef,
@@ -58,12 +73,28 @@ export const Stack = forwardRef<HTMLDivElement, StackProps>(
58
73
 
59
74
  const { dropping } = useStackDropForElements({
60
75
  id: props.id,
61
- element: stackElement,
76
+ element: getDropElement && stackElement ? getDropElement(stackElement) : stackElement,
62
77
  selfDroppable,
63
78
  orientation,
64
79
  onRearrange,
65
80
  });
66
81
 
82
+ const handleScroll = useCallback(() => {
83
+ if (stackElement && Number.isFinite(separatorOnScroll)) {
84
+ const scrollPosition = orientation === 'horizontal' ? stackElement.scrollLeft : stackElement.scrollTop;
85
+ const scrollSize = orientation === 'horizontal' ? stackElement.scrollWidth : stackElement.scrollHeight;
86
+ const clientSize = orientation === 'horizontal' ? stackElement.clientWidth : stackElement.clientHeight;
87
+ const separatorHost = stackElement.closest('[data-scroll-separator]');
88
+ if (separatorHost) {
89
+ separatorHost.setAttribute('data-scroll-separator', String(scrollPosition > separatorOnScroll!));
90
+ separatorHost.setAttribute(
91
+ 'data-scroll-separator-end',
92
+ String(scrollSize - (scrollPosition + clientSize) > separatorOnScroll!),
93
+ );
94
+ }
95
+ }
96
+ }, [stackElement, separatorOnScroll, orientation]);
97
+
67
98
  const gridClasses = useMemo(() => {
68
99
  if (!rail) {
69
100
  return orientation === 'horizontal' ? 'grid-rows-1 pli-1' : 'grid-cols-1 plb-1';
@@ -93,6 +124,7 @@ export const Stack = forwardRef<HTMLDivElement, StackProps>(
93
124
  aria-orientation={orientation}
94
125
  style={styles}
95
126
  ref={composedItemRef}
127
+ {...(Number.isFinite(separatorOnScroll) && { onScroll: handleScroll })}
96
128
  >
97
129
  {children}
98
130
  {selfDroppable && dropping && (
@@ -0,0 +1,5 @@
1
+ //
2
+ // Copyright 2024 DXOS.org
3
+ //
4
+
5
+ export * from './Stack';
@@ -2,22 +2,10 @@
2
2
  // Copyright 2024 DXOS.org
3
3
  //
4
4
 
5
- import type { Edge } from '@atlaskit/pragmatic-drag-and-drop-hitbox/closest-edge';
6
5
  import { createContext, useContext } from 'react';
7
6
 
8
- import { type Size as DndSize } from '@dxos/react-ui-dnd';
9
-
10
7
  import { type Orientation, type Size } from './Stack';
11
-
12
- export type StackItemSize = DndSize;
13
-
14
- export type StackItemData = { id: string; type: 'column' | 'card' };
15
-
16
- export type StackItemRearrangeHandler<Data extends { id: string } = StackItemData> = (
17
- source: Data,
18
- target: Data,
19
- closestEdge: Edge | null,
20
- ) => void;
8
+ import { type StackItemSize, type StackItemRearrangeHandler } from './defs';
21
9
 
22
10
  export type StackContextValue = {
23
11
  orientation: Orientation;
@@ -34,16 +22,36 @@ export const StackContext = createContext<StackContextValue>({
34
22
 
35
23
  export const useStack = () => useContext(StackContext);
36
24
 
25
+ export type ItemDragState =
26
+ | {
27
+ type: 'idle';
28
+ }
29
+ | {
30
+ type: 'preview';
31
+ container: HTMLElement;
32
+ item: any;
33
+ }
34
+ | {
35
+ type: 'is-dragging';
36
+ item: any;
37
+ };
38
+
39
+ export const idle: ItemDragState = { type: 'idle' };
40
+
37
41
  export type StackItemContextValue = {
38
42
  selfDragHandleRef: (element: HTMLDivElement | null) => void;
39
43
  size: StackItemSize;
40
44
  setSize: (nextSize: StackItemSize, commit?: boolean) => void;
45
+ state: ItemDragState;
46
+ setState: (state: ItemDragState) => void;
41
47
  };
42
48
 
43
49
  export const StackItemContext = createContext<StackItemContextValue>({
44
50
  selfDragHandleRef: () => {},
45
51
  size: 'min-content',
46
52
  setSize: () => {},
53
+ state: idle,
54
+ setState: () => {},
47
55
  });
48
56
 
49
57
  export const useStackItem = () => useContext(StackItemContext);
@@ -0,0 +1,49 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ import '@dxos-theme';
6
+
7
+ import { type Meta, type StoryObj } from '@storybook/react';
8
+ import React from 'react';
9
+
10
+ import { Icon, DropdownMenu } from '@dxos/react-ui';
11
+ import { withTheme } from '@dxos/storybook-utils';
12
+
13
+ import { StackItem } from './StackItem';
14
+
15
+ const meta: Meta<typeof StackItem.Root> = {
16
+ title: 'ui/react-ui-stack/StackItem',
17
+ component: StackItem.Root,
18
+ render: (args) => (
19
+ <StackItem.Root role='section' {...args} classNames='w-[20rem] border border-separator'>
20
+ <StackItem.Heading>
21
+ <span className='sr-only'>Title</span>
22
+ <div role='none' className='sticky -block-start-px bg-[--sticky-bg] p-1 is-full'>
23
+ <DropdownMenu.Root>
24
+ <DropdownMenu.Trigger asChild>
25
+ <StackItem.SigilButton>
26
+ <Icon icon={'ph--dots-three--regular'} size={5} />
27
+ </StackItem.SigilButton>
28
+ </DropdownMenu.Trigger>
29
+ </DropdownMenu.Root>
30
+ </div>
31
+ </StackItem.Heading>
32
+ <StackItem.Content classNames='p-2'>Content</StackItem.Content>
33
+ </StackItem.Root>
34
+ ),
35
+ decorators: [withTheme],
36
+ parameters: {
37
+ layout: 'centered',
38
+ },
39
+ };
40
+
41
+ export default meta;
42
+
43
+ type Story = StoryObj<typeof StackItem.Root>;
44
+
45
+ export const Default: Story = {
46
+ args: {
47
+ item: { id: '1' },
48
+ },
49
+ };