@dxos/react-ui-stack 0.8.4-main.70d3990 → 0.8.4-main.74a063c4e0

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 (110) hide show
  1. package/dist/lib/browser/index.mjs +723 -68
  2. package/dist/lib/browser/index.mjs.map +4 -4
  3. package/dist/lib/browser/meta.json +1 -1
  4. package/dist/lib/node-esm/index.mjs +724 -68
  5. package/dist/lib/node-esm/index.mjs.map +4 -4
  6. package/dist/lib/node-esm/meta.json +1 -1
  7. package/dist/types/src/components/Stack/Stack.d.ts +5 -10
  8. package/dist/types/src/components/Stack/Stack.d.ts.map +1 -1
  9. package/dist/types/src/components/Stack/Stack.stories.d.ts.map +1 -1
  10. package/dist/types/src/components/StackContext.d.ts +1 -1
  11. package/dist/types/src/components/StackContext.d.ts.map +1 -1
  12. package/dist/types/src/components/StackItem/MenuSignifier.d.ts.map +1 -1
  13. package/dist/types/src/components/StackItem/StackItem.d.ts +7 -11
  14. package/dist/types/src/components/StackItem/StackItem.d.ts.map +1 -1
  15. package/dist/types/src/components/StackItem/StackItem.stories.d.ts.map +1 -1
  16. package/dist/types/src/components/StackItem/StackItemContent.d.ts +2 -45
  17. package/dist/types/src/components/StackItem/StackItemContent.d.ts.map +1 -1
  18. package/dist/types/src/components/StackItem/StackItemDragHandle.d.ts.map +1 -1
  19. package/dist/types/src/components/StackItem/StackItemHeading.d.ts +1 -1
  20. package/dist/types/src/components/StackItem/StackItemHeading.d.ts.map +1 -1
  21. package/dist/types/src/components/StackItem/StackItemResizeHandle.d.ts +1 -1
  22. package/dist/types/src/components/StackItem/StackItemResizeHandle.d.ts.map +1 -1
  23. package/dist/types/src/components/StackItem/StackItemSigil.d.ts +2 -2
  24. package/dist/types/src/components/StackItem/StackItemSigil.d.ts.map +1 -1
  25. package/dist/types/src/components/index.d.ts +1 -2
  26. package/dist/types/src/components/index.d.ts.map +1 -1
  27. package/dist/types/src/components/{defs.d.ts → types.d.ts} +1 -1
  28. package/dist/types/src/components/types.d.ts.map +1 -0
  29. package/dist/types/src/hooks/useStackDropForElements.d.ts +7 -5
  30. package/dist/types/src/hooks/useStackDropForElements.d.ts.map +1 -1
  31. package/dist/types/src/index.d.ts +0 -1
  32. package/dist/types/src/index.d.ts.map +1 -1
  33. package/dist/types/src/translations.d.ts +10 -10
  34. package/dist/types/src/translations.d.ts.map +1 -1
  35. package/dist/types/tsconfig.tsbuildinfo +1 -1
  36. package/package.json +41 -38
  37. package/src/components/Stack/Stack.stories.tsx +10 -12
  38. package/src/components/Stack/Stack.tsx +201 -212
  39. package/src/components/StackContext.tsx +1 -1
  40. package/src/components/StackItem/MenuSignifier.tsx +2 -9
  41. package/src/components/StackItem/StackItem.stories.tsx +8 -6
  42. package/src/components/StackItem/StackItem.tsx +29 -18
  43. package/src/components/StackItem/StackItemContent.tsx +23 -54
  44. package/src/components/StackItem/StackItemDragHandle.tsx +4 -3
  45. package/src/components/StackItem/StackItemHeading.tsx +14 -13
  46. package/src/components/StackItem/StackItemResizeHandle.tsx +1 -2
  47. package/src/components/StackItem/StackItemSigil.tsx +9 -7
  48. package/src/components/index.ts +2 -2
  49. package/src/hooks/useStackDropForElements.ts +19 -12
  50. package/src/index.ts +0 -3
  51. package/src/playwright/playwright.config.ts +1 -1
  52. package/src/translations.ts +9 -9
  53. package/dist/lib/browser/chunk-3F2KBXLP.mjs +0 -1482
  54. package/dist/lib/browser/chunk-3F2KBXLP.mjs.map +0 -7
  55. package/dist/lib/browser/testing/index.mjs +0 -31
  56. package/dist/lib/browser/testing/index.mjs.map +0 -7
  57. package/dist/lib/node-esm/chunk-SYKFLQGK.mjs +0 -1484
  58. package/dist/lib/node-esm/chunk-SYKFLQGK.mjs.map +0 -7
  59. package/dist/lib/node-esm/testing/index.mjs +0 -32
  60. package/dist/lib/node-esm/testing/index.mjs.map +0 -7
  61. package/dist/types/src/components/Image/Image.d.ts +0 -14
  62. package/dist/types/src/components/Image/Image.d.ts.map +0 -1
  63. package/dist/types/src/components/Image/Image.stories.d.ts +0 -33
  64. package/dist/types/src/components/Image/Image.stories.d.ts.map +0 -1
  65. package/dist/types/src/components/Image/index.d.ts +0 -2
  66. package/dist/types/src/components/Image/index.d.ts.map +0 -1
  67. package/dist/types/src/components/defs.d.ts.map +0 -1
  68. package/dist/types/src/components/deprecated/LayoutControls.d.ts +0 -19
  69. package/dist/types/src/components/deprecated/LayoutControls.d.ts.map +0 -1
  70. package/dist/types/src/exemplars/Card/Card.d.ts +0 -69
  71. package/dist/types/src/exemplars/Card/Card.d.ts.map +0 -1
  72. package/dist/types/src/exemplars/Card/Card.stories.d.ts +0 -21
  73. package/dist/types/src/exemplars/Card/Card.stories.d.ts.map +0 -1
  74. package/dist/types/src/exemplars/Card/CardDragPreview.d.ts +0 -6
  75. package/dist/types/src/exemplars/Card/CardDragPreview.d.ts.map +0 -1
  76. package/dist/types/src/exemplars/Card/fragments.d.ts +0 -13
  77. package/dist/types/src/exemplars/Card/fragments.d.ts.map +0 -1
  78. package/dist/types/src/exemplars/Card/index.d.ts +0 -4
  79. package/dist/types/src/exemplars/Card/index.d.ts.map +0 -1
  80. package/dist/types/src/exemplars/CardStack/CardStack.d.ts +0 -42
  81. package/dist/types/src/exemplars/CardStack/CardStack.d.ts.map +0 -1
  82. package/dist/types/src/exemplars/CardStack/CardStack.stories.d.ts +0 -15
  83. package/dist/types/src/exemplars/CardStack/CardStack.stories.d.ts.map +0 -1
  84. package/dist/types/src/exemplars/CardStack/CardStackDragPreview.d.ts +0 -9
  85. package/dist/types/src/exemplars/CardStack/CardStackDragPreview.d.ts.map +0 -1
  86. package/dist/types/src/exemplars/CardStack/index.d.ts +0 -3
  87. package/dist/types/src/exemplars/CardStack/index.d.ts.map +0 -1
  88. package/dist/types/src/exemplars/index.d.ts +0 -3
  89. package/dist/types/src/exemplars/index.d.ts.map +0 -1
  90. package/dist/types/src/testing/CardContainer.d.ts +0 -6
  91. package/dist/types/src/testing/CardContainer.d.ts.map +0 -1
  92. package/dist/types/src/testing/index.d.ts +0 -2
  93. package/dist/types/src/testing/index.d.ts.map +0 -1
  94. package/src/components/Image/Image.stories.tsx +0 -84
  95. package/src/components/Image/Image.tsx +0 -222
  96. package/src/components/Image/index.ts +0 -5
  97. package/src/components/deprecated/LayoutControls.tsx +0 -109
  98. package/src/exemplars/Card/Card.stories.tsx +0 -64
  99. package/src/exemplars/Card/Card.tsx +0 -210
  100. package/src/exemplars/Card/CardDragPreview.tsx +0 -22
  101. package/src/exemplars/Card/fragments.ts +0 -24
  102. package/src/exemplars/Card/index.ts +0 -7
  103. package/src/exemplars/CardStack/CardStack.stories.tsx +0 -173
  104. package/src/exemplars/CardStack/CardStack.tsx +0 -139
  105. package/src/exemplars/CardStack/CardStackDragPreview.tsx +0 -61
  106. package/src/exemplars/CardStack/index.ts +0 -6
  107. package/src/exemplars/index.ts +0 -6
  108. package/src/testing/CardContainer.tsx +0 -37
  109. package/src/testing/index.ts +0 -5
  110. /package/src/components/{defs.ts → types.ts} +0 -0
@@ -2,15 +2,15 @@
2
2
  // Copyright 2024 DXOS.org
3
3
  //
4
4
 
5
- import { combine } from '@atlaskit/pragmatic-drag-and-drop/combine';
6
- import { draggable, dropTargetForElements } from '@atlaskit/pragmatic-drag-and-drop/element/adapter';
7
- import { preserveOffsetOnSource } from '@atlaskit/pragmatic-drag-and-drop/element/preserve-offset-on-source';
8
- import { setCustomNativeDragPreview } from '@atlaskit/pragmatic-drag-and-drop/element/set-custom-native-drag-preview';
9
5
  import {
10
6
  type Edge,
11
7
  attachClosestEdge,
12
8
  extractClosestEdge,
13
9
  } from '@atlaskit/pragmatic-drag-and-drop-hitbox/closest-edge';
10
+ import { combine } from '@atlaskit/pragmatic-drag-and-drop/combine';
11
+ import { draggable, dropTargetForElements } from '@atlaskit/pragmatic-drag-and-drop/element/adapter';
12
+ import { preserveOffsetOnSource } from '@atlaskit/pragmatic-drag-and-drop/element/preserve-offset-on-source';
13
+ import { setCustomNativeDragPreview } from '@atlaskit/pragmatic-drag-and-drop/element/set-custom-native-drag-preview';
14
14
  import { useFocusableGroup } from '@fluentui/react-tabster';
15
15
  import { composeRefs } from '@radix-ui/react-compose-refs';
16
16
  import React, {
@@ -26,11 +26,10 @@ import { createPortal } from 'react-dom';
26
26
 
27
27
  import { ListItem, type ThemedClassName } from '@dxos/react-ui';
28
28
  import { resizeAttributes, sizeStyle } from '@dxos/react-ui-dnd';
29
- import { mx } from '@dxos/react-ui-theme';
29
+ import { mx } from '@dxos/ui-theme';
30
30
 
31
- import { type StackItemData, type StackItemSize } from '../defs';
32
31
  import { type ItemDragState, StackItemContext, idle, useStack, useStackItem } from '../StackContext';
33
-
32
+ import { type StackItemData, type StackItemSize } from '../types';
34
33
  import { StackItemContent, type StackItemContentProps } from './StackItemContent';
35
34
  import { StackItemDragHandle, type StackItemDragHandleProps } from './StackItemDragHandle';
36
35
  import {
@@ -54,6 +53,10 @@ export const DEFAULT_HORIZONTAL_SIZE = 48 satisfies StackItemSize;
54
53
  export const DEFAULT_VERTICAL_SIZE = 'min-content' satisfies StackItemSize;
55
54
  export const DEFAULT_EXTRINSIC_SIZE = DEFAULT_HORIZONTAL_SIZE satisfies StackItemSize;
56
55
 
56
+ //
57
+ // StackItemRoot
58
+ //
59
+
57
60
  type StackItemRootProps = ThemedClassName<ComponentPropsWithRef<'div'>> & {
58
61
  item: Omit<StackItemData, 'type'>;
59
62
  order?: number;
@@ -86,6 +89,7 @@ const StackItemRoot = forwardRef<HTMLDivElement, StackItemRootProps>(
86
89
  forwardedRef,
87
90
  ) => {
88
91
  const [itemElement, itemRef] = useState<HTMLDivElement | null>(null);
92
+ const composedItemRef = composeRefs<HTMLDivElement>(itemRef, forwardedRef);
89
93
  const [selfDragHandleElement, selfDragHandleRef] = useState<HTMLDivElement | null>(null);
90
94
  const [closestEdge, setEdge] = useState<Edge | null>(null);
91
95
  const [sourceId, setSourceId] = useState<string | null>(null);
@@ -96,8 +100,6 @@ const StackItemRoot = forwardRef<HTMLDivElement, StackItemRootProps>(
96
100
 
97
101
  const Root = role ?? 'div';
98
102
 
99
- const composedItemRef = composeRefs<HTMLDivElement>(itemRef, forwardedRef);
100
-
101
103
  const setSize = useCallback(
102
104
  (nextSize: StackItemSize, commit?: boolean) => {
103
105
  setInternalSize(nextSize);
@@ -110,6 +112,7 @@ const StackItemRoot = forwardRef<HTMLDivElement, StackItemRootProps>(
110
112
 
111
113
  const type = orientation === 'horizontal' ? 'column' : 'card';
112
114
 
115
+ // TODO(burdon): Factor out?
113
116
  useLayoutEffect(() => {
114
117
  if (!itemElement || !onRearrange || disableRearrange) {
115
118
  return;
@@ -183,18 +186,18 @@ const StackItemRoot = forwardRef<HTMLDivElement, StackItemRootProps>(
183
186
 
184
187
  const focusableGroupAttrs = useFocusableGroup({ tabBehavior: 'limited' });
185
188
 
186
- // Determine if the drop would result in any changes
189
+ // Determine if the drop would result in any changes.
187
190
  const shouldShowDropIndicator = () => {
188
191
  if (!closestEdge || !sourceId) {
189
192
  return false;
190
193
  }
191
194
 
192
- // Don't show indicator when dragged item is over itself
195
+ // Don't show indicator when dragged item is over itself.
193
196
  if (sourceId === item.id) {
194
197
  return false;
195
198
  }
196
199
 
197
- // Don't show indicator when dragged item is over the trailing edge of its previous sibling
200
+ // Don't show indicator when dragged item is over the trailing edge of its previous sibling.
198
201
  const isTrailingEdgeOfPrevSibling =
199
202
  prevSiblingId !== undefined &&
200
203
  sourceId === prevSiblingId &&
@@ -243,7 +246,7 @@ const StackItemRoot = forwardRef<HTMLDivElement, StackItemRootProps>(
243
246
  : 'dx-focus-ring-group-y',
244
247
  orientation === 'horizontal' ? 'grid-rows-subgrid' : 'grid-cols-subgrid',
245
248
  rail && (orientation === 'horizontal' ? 'row-span-2' : 'col-span-2'),
246
- role === 'section' && orientation !== 'horizontal' && 'border-be border-subduedSeparator',
249
+ role === 'section' && orientation !== 'horizontal' && 'border-b border-subdued-separator',
247
250
  classNames,
248
251
  )}
249
252
  data-dx-stack-item={stackId}
@@ -268,37 +271,45 @@ const StackItemRoot = forwardRef<HTMLDivElement, StackItemRootProps>(
268
271
  },
269
272
  );
270
273
 
274
+ //
275
+ // StackItemDragPreview
276
+ //
277
+
271
278
  type StackItemDragPreviewProps = {
272
279
  children: ({ item }: { item: any }) => ReactNode;
273
280
  };
274
281
 
275
- export const StackItemDragPreview = ({ children }: StackItemDragPreviewProps) => {
282
+ const StackItemDragPreview = ({ children }: StackItemDragPreviewProps) => {
276
283
  const { state } = useStackItem();
277
284
  return state?.type === 'preview' ? createPortal(children({ item: state.item }), state.container) : null;
278
285
  };
279
286
 
287
+ //
288
+ // StackItem
289
+ //
290
+
280
291
  export const StackItem = {
281
292
  Root: StackItemRoot,
282
293
  Content: StackItemContent,
294
+ DragHandle: StackItemDragHandle,
295
+ DragPreview: StackItemDragPreview,
283
296
  Heading: StackItemHeading,
284
297
  HeadingLabel: StackItemHeadingLabel,
285
298
  HeadingStickyContent: StackItemHeadingStickyContent,
286
299
  ResizeHandle: StackItemResizeHandle,
287
- DragHandle: StackItemDragHandle,
288
300
  Sigil: StackItemSigil,
289
301
  SigilButton: StackItemSigilButton,
290
- DragPreview: StackItemDragPreview,
291
302
  };
292
303
 
293
304
  export type {
294
305
  StackItemRootProps,
295
306
  StackItemContentProps,
307
+ StackItemDragHandleProps,
308
+ StackItemDragPreviewProps,
296
309
  StackItemHeadingProps,
297
310
  StackItemHeadingLabelProps,
298
311
  StackItemResizeHandleProps,
299
- StackItemDragHandleProps,
300
312
  StackItemSigilProps,
301
313
  StackItemSigilButtonProps,
302
314
  StackItemSigilAction,
303
- StackItemDragPreviewProps,
304
315
  };
@@ -5,82 +5,49 @@
5
5
  import React, { type ComponentPropsWithoutRef, forwardRef, useMemo } from 'react';
6
6
 
7
7
  import { type ThemedClassName } from '@dxos/react-ui';
8
- import { mx } from '@dxos/react-ui-theme';
8
+ import { mx } from '@dxos/ui-theme';
9
9
 
10
10
  import { useStack, useStackItem } from '../StackContext';
11
11
 
12
- // TODO(burdon): Add prop for container-max-width?
13
12
  export type StackItemContentProps = ThemedClassName<Omit<ComponentPropsWithoutRef<'div'>, 'role' | 'scrollable'>> & {
14
- /**
15
- * This flag is required in order to clarify a developer experience that seemed like it needed extra boilerplate
16
- * (`row-span-2`) or was buggy. See the description of the StackItem.Content component itself for more information.
17
- */
18
13
  toolbar?: boolean;
19
-
20
- /**
21
- * Whether to provide for the layout of a statusbar after the content.
22
- */
23
14
  statusbar?: boolean;
24
-
25
- /**
26
- * Whether to support y-axis scrolling.
27
- */
28
- scrollable?: boolean;
29
-
30
- /**
31
- * Whether to set a certain aspect ratio on the content, including the toolbar and statusbar.
32
- * This is provided for convenience and consistency; it can instead be specified by the `classNames` or `style` props as needed.
33
- */
34
- size?: 'intrinsic' | 'video' | 'square';
35
-
36
- /**
37
- * Whether the consumer intends to do something custom and typical affordances should not apply.
38
- * @deprecated Replace with override for gridTempateRows.
39
- */
40
- layoutManaged?: boolean;
41
15
  };
42
16
 
43
17
  /**
44
- * This component should be used by plugins for rendering content within a stack item, a.k.a. a “plank” or “section”.
45
- * The `toolbar` flag must be provided since this component provides for the layout of content with the toolbar.
18
+ * This component should be used by plugins for rendering content within a stack item (i.e., a “plank” or “section”).
46
19
  */
47
20
  export const StackItemContent = forwardRef<HTMLDivElement, StackItemContentProps>(
48
- (
49
- { children, toolbar, statusbar, layoutManaged, classNames, size = 'intrinsic', scrollable, ...props },
50
- forwardedRef,
51
- ) => {
21
+ ({ classNames, children, toolbar, statusbar, ...props }, forwardedRef) => {
52
22
  const { size: stackItemSize } = useStack();
53
23
  const { role } = useStackItem();
54
24
  const style = useMemo(
55
- () =>
56
- layoutManaged
57
- ? {}
58
- : {
59
- gridTemplateRows: [
60
- ...(toolbar ? [role === 'section' ? 'calc(var(--toolbar-size) - 1px)' : 'var(--toolbar-size)'] : []),
61
- '1fr',
62
- ...(statusbar ? ['var(--statusbar-size)'] : []),
63
- ].join(' '),
64
- },
65
- [toolbar, statusbar, layoutManaged],
25
+ () => ({
26
+ gridTemplateRows: [
27
+ toolbar && role === 'section' ? 'calc(var(--dx-toolbar-size) - 1px)' : 'var(--dx-toolbar-size)',
28
+ '1fr',
29
+ statusbar && 'var(--dx-statusbar-size)',
30
+ ]
31
+ .filter(Boolean)
32
+ .join(' '),
33
+ }),
34
+ [toolbar, statusbar],
66
35
  );
67
36
 
68
37
  return (
69
38
  <div
70
- role='none'
71
39
  {...props}
40
+ role='none'
41
+ style={style}
72
42
  className={mx(
73
- 'group grid grid-cols-[100%] density-coarse',
74
- size === 'video' ? 'aspect-video' : size === 'square' && 'aspect-square',
75
- stackItemSize === 'contain' && 'min-bs-0 overflow-hidden',
76
- scrollable ? 'min-bs-0 overflow-y-auto scrollbar-thin contain-layout' : 'overflow-hidden',
77
- role === 'section' &&
78
- toolbar &&
79
- '[&_.dx-toolbar]:sticky [&_.dx-toolbar]:z-[1] [&_.dx-toolbar]:block-start-0 [&_.dx-toolbar]:-mbe-px [&_.dx-toolbar]:min-is-0',
80
- toolbar && '[&>.dx-toolbar]:relative [&>.dx-toolbar]:border-be [&>.dx-toolbar]:border-subduedSeparator',
43
+ 'group grid grid-cols-[100%] dx-density-coarse',
44
+ stackItemSize === 'contain' && 'min-h-0 overflow-hidden',
45
+ toolbar &&
46
+ role === 'section' &&
47
+ '[&_.dx-toolbar]:sticky [&_.dx-toolbar]:z-[1] [&_.dx-toolbar]:top-0 [&_.dx-toolbar]:-mb-px [&_.dx-toolbar]:min-w-0',
48
+ toolbar && '[&>.dx-toolbar]:relative [&>.dx-toolbar]:border-b [&>.dx-toolbar]:border-subdued-separator',
81
49
  classNames,
82
50
  )}
83
- style={style}
84
51
  data-popover-collision-boundary={true}
85
52
  ref={forwardedRef}
86
53
  >
@@ -89,3 +56,5 @@ export const StackItemContent = forwardRef<HTMLDivElement, StackItemContentProps
89
56
  );
90
57
  },
91
58
  );
59
+
60
+ StackItemContent.displayName = 'StackItemContent';
@@ -2,6 +2,7 @@
2
2
  // Copyright 2024 DXOS.org
3
3
  //
4
4
 
5
+ import { Primitive } from '@radix-ui/react-primitive';
5
6
  import { Slot } from '@radix-ui/react-slot';
6
7
  import React, { type ComponentPropsWithoutRef } from 'react';
7
8
 
@@ -12,11 +13,11 @@ export type StackItemDragHandleProps = ComponentPropsWithoutRef<'button'> & { as
12
13
  export const StackItemDragHandle = ({ asChild, children }: StackItemDragHandleProps) => {
13
14
  const { selfDragHandleRef } = useStackItem();
14
15
 
15
- const Root = asChild ? Slot : 'div';
16
+ const Comp = asChild ? Slot : Primitive.div;
16
17
 
17
18
  return (
18
- <Root ref={selfDragHandleRef} role='button'>
19
+ <Comp ref={selfDragHandleRef} role='button'>
19
20
  {children}
20
- </Root>
21
+ </Comp>
21
22
  );
22
23
  };
@@ -2,6 +2,7 @@
2
2
  // Copyright 2024 DXOS.org
3
3
  //
4
4
 
5
+ import { Primitive } from '@radix-ui/react-primitive';
5
6
  import { Slot } from '@radix-ui/react-slot';
6
7
  import React, {
7
8
  type ComponentPropsWithRef,
@@ -12,7 +13,7 @@ import React, {
12
13
 
13
14
  import { type ThemedClassName } from '@dxos/react-ui';
14
15
  import { type AttendableId, type Related, useAttention } from '@dxos/react-ui-attention';
15
- import { mx } from '@dxos/react-ui-theme';
16
+ import { mx } from '@dxos/ui-theme';
16
17
 
17
18
  import { useStack } from '../StackContext';
18
19
 
@@ -26,34 +27,34 @@ export const StackItemHeading = ({
26
27
  classNames,
27
28
  asChild,
28
29
  separateOnScroll,
30
+ role,
29
31
  ...props
30
32
  }: StackItemHeadingProps) => {
31
33
  const { orientation } = useStack();
32
-
33
- const Root = asChild ? Slot : 'div';
34
+ const Comp = asChild ? Slot : Primitive.div;
34
35
 
35
36
  return (
36
- <Root
37
- role='heading'
37
+ <Comp
38
38
  {...props}
39
+ role={role ?? 'heading'}
39
40
  className={mx(
40
- 'flex items-center !border-is-0 bg-headerSurface',
41
+ 'flex items-center border-x-0! bg-header-surface',
41
42
  separateOnScroll
42
- ? 'border-transparent [[data-scroll-separator="true"]_&]:border-subduedSeparator'
43
- : 'border-subduedSeparator',
44
- orientation === 'horizontal' ? 'bs-[--rail-size]' : 'is-[--rail-size] flex-col',
45
- orientation === 'horizontal' ? 'border-be' : 'border-ie',
43
+ ? 'border-transparent [[data-scroll-separator="true"]_&]:border-subdued-separator'
44
+ : 'border-subdued-separator',
45
+ orientation === 'horizontal' ? 'h-(--dx-rail-size)' : 'w-(--dx-rail-size) flex-col',
46
+ orientation === 'horizontal' ? 'border-b' : 'border-e',
46
47
  classNames,
47
48
  )}
48
49
  >
49
50
  {children}
50
- </Root>
51
+ </Comp>
51
52
  );
52
53
  };
53
54
 
54
55
  export const StackItemHeadingStickyContent = ({ children }: PropsWithChildren<{}>) => {
55
56
  return (
56
- <div role='none' className='sticky block-start-0 bg-[--sticky-bg] p-1 is-full'>
57
+ <div role='none' className='sticky top-0 bg-(--sticky-bg) p-1 w-full'>
57
58
  {children}
58
59
  </div>
59
60
  );
@@ -70,7 +71,7 @@ export const StackItemHeadingLabel = forwardRef<HTMLHeadingElement, StackItemHea
70
71
  {...props}
71
72
  data-attention={((related && isRelated) || hasAttention || isAncestor).toString()}
72
73
  className={mx(
73
- 'pli-1 min-is-0 is-0 grow truncate font-medium text-baseText data-[attention=true]:text-accentText self-center',
74
+ 'px-1 min-w-0 w-0 grow truncate font-medium text-base-surface-text data-[attention=true]:text-accent-text self-center',
74
75
  classNames,
75
76
  )}
76
77
  ref={forwardedRef}
@@ -7,7 +7,6 @@ import React from 'react';
7
7
  import { ResizeHandle } from '@dxos/react-ui-dnd';
8
8
 
9
9
  import { useStack, useStackItem } from '../StackContext';
10
-
11
10
  import { DEFAULT_EXTRINSIC_SIZE } from './StackItem';
12
11
 
13
12
  const MIN_WIDTH = 20;
@@ -15,7 +14,7 @@ const MIN_HEIGHT = 3;
15
14
 
16
15
  export type StackItemResizeHandleProps = {};
17
16
 
18
- export const StackItemResizeHandle = () => {
17
+ export const StackItemResizeHandle = (_: StackItemResizeHandleProps) => {
19
18
  const { orientation } = useStack();
20
19
  const { setSize, size } = useStackItem();
21
20
 
@@ -4,15 +4,14 @@
4
4
 
5
5
  import React, { Fragment, type PropsWithChildren, forwardRef, useState } from 'react';
6
6
 
7
- import { type ActionLike } from '@dxos/app-graph';
7
+ import { type Node } from '@dxos/app-graph';
8
8
  import { keySymbols } from '@dxos/keyboard';
9
9
  import { Button, type ButtonProps, DropdownMenu, Icon, toLocalizedString, useTranslation } from '@dxos/react-ui';
10
10
  import { type AttendableId, type Related, useAttention } from '@dxos/react-ui-attention';
11
- import { descriptionText, mx } from '@dxos/react-ui-theme';
11
+ import { mx } from '@dxos/ui-theme';
12
12
  import { getHostPlatform } from '@dxos/util';
13
13
 
14
14
  import { translationKey } from '../../translations';
15
-
16
15
  import { MenuSignifierHorizontal } from './MenuSignifier';
17
16
 
18
17
  export type KeyBinding = {
@@ -23,7 +22,7 @@ export type KeyBinding = {
23
22
  unknown?: string;
24
23
  };
25
24
 
26
- export type StackItemSigilAction = Pick<ActionLike, 'id' | 'properties' | 'data'>;
25
+ export type StackItemSigilAction = Pick<Node.ActionLike, 'id' | 'properties' | 'data'>;
27
26
 
28
27
  export type StackItemSigilButtonProps = Omit<ButtonProps, 'variant'> &
29
28
  AttendableId &
@@ -40,7 +39,10 @@ export const StackItemSigilButton = forwardRef<HTMLButtonElement, StackItemSigil
40
39
  <Button
41
40
  {...props}
42
41
  variant={variant}
43
- classNames={['shrink-0 pli-0 min-bs-0 is-[--rail-action] bs-[--rail-action] relative app-no-drag', classNames]}
42
+ classNames={[
43
+ 'shrink-0 px-0 min-h-0 w-(--dx-rail-action) h-(--dx-rail-action) relative dx-app-no-drag',
44
+ classNames,
45
+ ]}
44
46
  ref={forwardedRef}
45
47
  >
46
48
  {isMenu && <MenuSignifierHorizontal />}
@@ -78,7 +80,7 @@ export const StackItemSigil = forwardRef<HTMLButtonElement, StackItemSigilProps>
78
80
  classNames={!hasActions && 'cursor-default'}
79
81
  >
80
82
  <span className='sr-only'>{triggerLabel}</span>
81
- <Icon icon={icon} size={5} />
83
+ <Icon icon={icon} />
82
84
  </StackItemSigilButton>
83
85
  );
84
86
 
@@ -133,7 +135,7 @@ export const StackItemSigil = forwardRef<HTMLButtonElement, StackItemSigilProps>
133
135
  </DropdownMenu.ItemIndicator>
134
136
  )}
135
137
  {shortcut && (
136
- <span className={mx('shrink-0', descriptionText)}>{keySymbols(shortcut).join('')}</span>
138
+ <span className={mx('shrink-0', 'text-description')}>{keySymbols(shortcut).join('')}</span>
137
139
  )}
138
140
  </Root>
139
141
  );
@@ -2,8 +2,8 @@
2
2
  // Copyright 2024 DXOS.org
3
3
  //
4
4
 
5
- export type * from './defs';
5
+ export type * from './types';
6
6
 
7
- export * from './Image';
8
7
  export * from './Stack';
8
+
9
9
  export * from './StackItem';
@@ -2,18 +2,31 @@
2
2
  // Copyright 2025 DXOS.org
3
3
  //
4
4
 
5
- import { combine } from '@atlaskit/pragmatic-drag-and-drop/combine';
6
- import { dropTargetForElements } from '@atlaskit/pragmatic-drag-and-drop/element/adapter';
7
5
  import { autoScrollForElements } from '@atlaskit/pragmatic-drag-and-drop-auto-scroll/element';
8
6
  import { attachClosestEdge, extractClosestEdge } from '@atlaskit/pragmatic-drag-and-drop-hitbox/closest-edge';
7
+ import { combine } from '@atlaskit/pragmatic-drag-and-drop/combine';
8
+ import { dropTargetForElements } from '@atlaskit/pragmatic-drag-and-drop/element/adapter';
9
9
  import { useLayoutEffect, useState } from 'react';
10
10
 
11
11
  import { type Orientation, type StackItemData, type StackItemRearrangeHandler } from '../components';
12
12
 
13
13
  const noop = () => {};
14
14
 
15
+ export type UseStackDropForElementsProps = {
16
+ id?: string;
17
+ element: HTMLDivElement | null;
18
+ scrollElement?: HTMLDivElement | null;
19
+ orientation: Orientation;
20
+ selfDroppable: boolean;
21
+ onRearrange?: StackItemRearrangeHandler;
22
+ };
23
+
24
+ export type UseStackDropForElements = {
25
+ dropping: boolean;
26
+ };
27
+
15
28
  /**
16
- * Hook to handle drag and drop functionality for Stack components.
29
+ * Hook to handle drag-and-drop functionality for Stack components.
17
30
  */
18
31
  export const useStackDropForElements = ({
19
32
  id,
@@ -22,14 +35,7 @@ export const useStackDropForElements = ({
22
35
  orientation,
23
36
  selfDroppable,
24
37
  onRearrange,
25
- }: {
26
- id?: string;
27
- element: HTMLDivElement | null;
28
- scrollElement?: HTMLDivElement | null;
29
- orientation: Orientation;
30
- selfDroppable: boolean;
31
- onRearrange?: StackItemRearrangeHandler;
32
- }) => {
38
+ }: UseStackDropForElementsProps): UseStackDropForElements => {
33
39
  const [dropping, setDropping] = useState(false);
34
40
 
35
41
  useLayoutEffect(() => {
@@ -39,6 +45,7 @@ export const useStackDropForElements = ({
39
45
 
40
46
  const acceptSourceType = orientation === 'horizontal' ? 'column' : 'card';
41
47
 
48
+ // TODO(burdon): Use monitor?
42
49
  return combine(
43
50
  selfDroppable
44
51
  ? dropTargetForElements({
@@ -78,7 +85,7 @@ export const useStackDropForElements = ({
78
85
  })
79
86
  : noop,
80
87
  );
81
- }, [element, scrollElement, selfDroppable, orientation, id, onRearrange]);
88
+ }, [id, element, scrollElement, selfDroppable, orientation, onRearrange]);
82
89
 
83
90
  return { dropping };
84
91
  };
package/src/index.ts CHANGED
@@ -2,8 +2,5 @@
2
2
  // Copyright 2022 DXOS.org
3
3
  //
4
4
 
5
- // TODO(thure): Consider exporting exemplars from separate endpoints.
6
-
7
5
  export * from './components';
8
- export * from './exemplars';
9
6
  export * from './translations';
@@ -10,7 +10,7 @@ export default defineConfig({
10
10
  ...e2ePreset(import.meta.dirname),
11
11
  // TODO(wittjosiah): Avoid hard-coding ports.
12
12
  webServer: {
13
- command: 'moon run storybook:serve-e2e -- --port=9003',
13
+ command: 'pnpm storybook dev --ci --quiet --port=9003 --config-dir=.storybook',
14
14
  port: 9003,
15
15
  reuseExistingServer: false,
16
16
  },
@@ -4,20 +4,20 @@
4
4
 
5
5
  import { type Resource } from '@dxos/react-ui';
6
6
 
7
- export const translationKey = 'react-ui-stack';
7
+ export const translationKey = '@dxos/react-ui-stack';
8
8
 
9
9
  export const translations = [
10
10
  {
11
11
  'en-US': {
12
12
  [translationKey]: {
13
- 'resize label': 'Drag to resize',
14
- 'drag handle label': 'Drag to rearrange',
15
- 'pin start label': 'Pin to the left sidebar',
16
- 'pin end label': 'Pin to the right sidebar',
17
- 'increment start label': 'Move to the left',
18
- 'increment end label': 'Move to the right',
19
- 'close label': 'Close',
20
- 'minify label': 'Minify',
13
+ 'resize.label': 'Drag to resize',
14
+ 'drag-handle.label': 'Drag to rearrange',
15
+ 'pin-start.label': 'Pin to the left sidebar',
16
+ 'pin-end.label': 'Pin to the right sidebar',
17
+ 'increment-start.label': 'Move to the left',
18
+ 'increment-end.label': 'Move to the right',
19
+ 'close.label': 'Close',
20
+ 'minify.label': 'Minify',
21
21
  },
22
22
  },
23
23
  },