@dxos/react-ui-stack 0.8.4-main.c85a9c8dae → 0.8.4-main.cb12b3f963

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 (42) hide show
  1. package/dist/lib/browser/index.mjs +129 -172
  2. package/dist/lib/browser/index.mjs.map +4 -4
  3. package/dist/lib/browser/meta.json +1 -1
  4. package/dist/lib/browser/translations.mjs +23 -0
  5. package/dist/lib/browser/translations.mjs.map +7 -0
  6. package/dist/lib/node-esm/index.mjs +129 -172
  7. package/dist/lib/node-esm/index.mjs.map +4 -4
  8. package/dist/lib/node-esm/meta.json +1 -1
  9. package/dist/lib/node-esm/translations.mjs +25 -0
  10. package/dist/lib/node-esm/translations.mjs.map +7 -0
  11. package/dist/types/src/components/Stack/Stack.d.ts +2 -7
  12. package/dist/types/src/components/Stack/Stack.d.ts.map +1 -1
  13. package/dist/types/src/components/Stack/Stack.stories.d.ts.map +1 -1
  14. package/dist/types/src/components/StackContext.d.ts +1 -1
  15. package/dist/types/src/components/StackContext.d.ts.map +1 -1
  16. package/dist/types/src/components/StackItem/StackItem.d.ts +4 -4
  17. package/dist/types/src/components/StackItem/StackItem.d.ts.map +1 -1
  18. package/dist/types/src/components/StackItem/StackItem.stories.d.ts.map +1 -1
  19. package/dist/types/src/components/StackItem/StackItemDragHandle.d.ts.map +1 -1
  20. package/dist/types/src/components/StackItem/StackItemHeading.d.ts +1 -1
  21. package/dist/types/src/components/StackItem/StackItemHeading.d.ts.map +1 -1
  22. package/dist/types/src/components/StackItem/StackItemResizeHandle.d.ts.map +1 -1
  23. package/dist/types/src/hooks/useStackDropForElements.d.ts.map +1 -1
  24. package/dist/types/src/index.d.ts +0 -1
  25. package/dist/types/src/index.d.ts.map +1 -1
  26. package/dist/types/src/playwright/playwright.config.d.ts.map +1 -1
  27. package/dist/types/src/playwright/stack-manager.d.ts.map +1 -1
  28. package/dist/types/src/translations.d.ts +8 -8
  29. package/dist/types/src/translations.d.ts.map +1 -1
  30. package/dist/types/tsconfig.tsbuildinfo +1 -1
  31. package/package.json +34 -35
  32. package/src/components/Stack/Stack.stories.tsx +8 -10
  33. package/src/components/Stack/Stack.tsx +193 -206
  34. package/src/components/StackContext.tsx +1 -1
  35. package/src/components/StackItem/StackItem.stories.tsx +1 -1
  36. package/src/components/StackItem/StackItem.tsx +13 -15
  37. package/src/components/StackItem/StackItemHeading.tsx +2 -2
  38. package/src/components/StackItem/StackItemResizeHandle.tsx +0 -1
  39. package/src/components/StackItem/StackItemSigil.tsx +2 -2
  40. package/src/hooks/useStackDropForElements.ts +2 -2
  41. package/src/index.ts +0 -1
  42. package/src/translations.ts +8 -8
@@ -19,7 +19,7 @@ const DefaultStory = (props: StackItemRootProps) => {
19
19
  <DropdownMenu.Root>
20
20
  <DropdownMenu.Trigger asChild>
21
21
  <StackItem.SigilButton>
22
- <Icon icon='ph--dots-three--regular' size={5} />
22
+ <Icon icon='ph--dots-three--regular' />
23
23
  </StackItem.SigilButton>
24
24
  </DropdownMenu.Trigger>
25
25
  </DropdownMenu.Root>
@@ -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, {
@@ -30,7 +30,6 @@ import { mx } from '@dxos/ui-theme';
30
30
 
31
31
  import { type ItemDragState, StackItemContext, idle, useStack, useStackItem } from '../StackContext';
32
32
  import { type StackItemData, type StackItemSize } from '../types';
33
-
34
33
  import { StackItemContent, type StackItemContentProps } from './StackItemContent';
35
34
  import { StackItemDragHandle, type StackItemDragHandleProps } from './StackItemDragHandle';
36
35
  import {
@@ -49,9 +48,8 @@ import {
49
48
  type StackItemSigilProps,
50
49
  } from './StackItemSigil';
51
50
 
52
- // NOTE: 48rem fills the screen on a MacbookPro with the sidebars closed.
53
- export const DEFAULT_HORIZONTAL_SIZE = 48 satisfies StackItemSize;
54
51
  export const DEFAULT_VERTICAL_SIZE = 'min-content' satisfies StackItemSize;
52
+ export const DEFAULT_HORIZONTAL_SIZE = 50 satisfies StackItemSize;
55
53
  export const DEFAULT_EXTRINSIC_SIZE = DEFAULT_HORIZONTAL_SIZE satisfies StackItemSize;
56
54
 
57
55
  //
@@ -59,13 +57,13 @@ export const DEFAULT_EXTRINSIC_SIZE = DEFAULT_HORIZONTAL_SIZE satisfies StackIte
59
57
  //
60
58
 
61
59
  type StackItemRootProps = ThemedClassName<ComponentPropsWithRef<'div'>> & {
60
+ role?: 'article' | 'section';
62
61
  item: Omit<StackItemData, 'type'>;
63
62
  order?: number;
64
63
  prevSiblingId?: string;
65
64
  nextSiblingId?: string;
66
65
  size?: StackItemSize;
67
66
  onSizeChange?: (nextSize: StackItemSize) => void;
68
- role?: 'article' | 'section';
69
67
  disableRearrange?: boolean;
70
68
  focusIndicatorVariant?: 'over-all' | 'group' | 'over-all-always' | 'group-always';
71
69
  };
@@ -73,16 +71,16 @@ type StackItemRootProps = ThemedClassName<ComponentPropsWithRef<'div'>> & {
73
71
  const StackItemRoot = forwardRef<HTMLDivElement, StackItemRootProps>(
74
72
  (
75
73
  {
76
- item,
77
- children,
78
74
  classNames,
79
- size: propsSize,
80
- onSizeChange,
75
+ children,
76
+ style,
81
77
  role,
78
+ item,
82
79
  order,
83
80
  prevSiblingId,
84
81
  nextSiblingId,
85
- style,
82
+ size: sizeProp,
83
+ onSizeChange,
86
84
  disableRearrange,
87
85
  focusIndicatorVariant = 'over-all',
88
86
  ...props
@@ -97,7 +95,7 @@ const StackItemRoot = forwardRef<HTMLDivElement, StackItemRootProps>(
97
95
  const [dragState, setDragState] = useState<ItemDragState>(idle);
98
96
  const { orientation, rail, onRearrange, size: stackSize, stackId } = useStack();
99
97
  const [size = orientation === 'horizontal' ? DEFAULT_HORIZONTAL_SIZE : DEFAULT_VERTICAL_SIZE, setInternalSize] =
100
- useState(propsSize);
98
+ useState(sizeProp);
101
99
 
102
100
  const Root = role ?? 'div';
103
101
 
@@ -143,7 +141,7 @@ const StackItemRoot = forwardRef<HTMLDivElement, StackItemRootProps>(
143
141
  onDragStart: () => {
144
142
  document.body.removeAttribute('data-drag-preview');
145
143
  itemElement?.closest('[data-drag-autoscroll]')?.setAttribute('data-drag-autoscroll', 'active');
146
- setDragState({ type: 'w-dragging', item });
144
+ setDragState({ type: 'is-dragging', item });
147
145
  },
148
146
  onDrop: () => {
149
147
  itemElement?.closest('[data-drag-autoscroll]')?.setAttribute('data-drag-autoscroll', 'idle');
@@ -27,16 +27,16 @@ export const StackItemHeading = ({
27
27
  classNames,
28
28
  asChild,
29
29
  separateOnScroll,
30
+ role,
30
31
  ...props
31
32
  }: StackItemHeadingProps) => {
32
33
  const { orientation } = useStack();
33
-
34
34
  const Comp = asChild ? Slot : Primitive.div;
35
35
 
36
36
  return (
37
37
  <Comp
38
- role='heading'
39
38
  {...props}
39
+ role={role ?? 'heading'}
40
40
  className={mx(
41
41
  'flex items-center border-x-0! bg-header-surface',
42
42
  separateOnScroll
@@ -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;
@@ -11,7 +11,7 @@ import { type AttendableId, type Related, useAttention } from '@dxos/react-ui-at
11
11
  import { mx } from '@dxos/ui-theme';
12
12
  import { getHostPlatform } from '@dxos/util';
13
13
 
14
- import { translationKey } from '../../translations';
14
+ import { translationKey } from '#translations';
15
15
 
16
16
  import { MenuSignifierHorizontal } from './MenuSignifier';
17
17
 
@@ -81,7 +81,7 @@ export const StackItemSigil = forwardRef<HTMLButtonElement, StackItemSigilProps>
81
81
  classNames={!hasActions && 'cursor-default'}
82
82
  >
83
83
  <span className='sr-only'>{triggerLabel}</span>
84
- <Icon icon={icon} size={5} />
84
+ <Icon icon={icon} />
85
85
  </StackItemSigilButton>
86
86
  );
87
87
 
@@ -2,10 +2,10 @@
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';
package/src/index.ts CHANGED
@@ -3,4 +3,3 @@
3
3
  //
4
4
 
5
5
  export * from './components';
6
- export * from './translations';
@@ -10,14 +10,14 @@ 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
  },