@dxos/react-ui-stack 0.8.2 → 0.8.3-main.672df60

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 (58) hide show
  1. package/dist/lib/browser/index.mjs +483 -5
  2. package/dist/lib/browser/index.mjs.map +4 -4
  3. package/dist/lib/browser/meta.json +1 -1
  4. package/dist/lib/node/index.cjs +483 -4
  5. package/dist/lib/node/index.cjs.map +4 -4
  6. package/dist/lib/node/meta.json +1 -1
  7. package/dist/lib/node-esm/index.mjs +483 -5
  8. package/dist/lib/node-esm/index.mjs.map +4 -4
  9. package/dist/lib/node-esm/meta.json +1 -1
  10. package/dist/types/src/components/Stack/Stack.d.ts.map +1 -1
  11. package/dist/types/src/components/StackItem/StackItem.d.ts +1 -1
  12. package/dist/types/src/components/StackItem/StackItemDragHandle.d.ts +1 -1
  13. package/dist/types/src/components/StackItem/StackItemDragHandle.d.ts.map +1 -1
  14. package/dist/types/src/components/StackItem/StackItemHeading.d.ts +4 -2
  15. package/dist/types/src/components/StackItem/StackItemHeading.d.ts.map +1 -1
  16. package/dist/types/src/exemplars/Card/Card.d.ts +58 -0
  17. package/dist/types/src/exemplars/Card/Card.d.ts.map +1 -0
  18. package/dist/types/src/exemplars/Card/Card.stories-todo.d.ts +1 -0
  19. package/dist/types/src/exemplars/Card/Card.stories-todo.d.ts.map +1 -0
  20. package/dist/types/src/exemplars/Card/CardDragPreview.d.ts +6 -0
  21. package/dist/types/src/exemplars/Card/CardDragPreview.d.ts.map +1 -0
  22. package/dist/types/src/exemplars/Card/fragments.d.ts +6 -0
  23. package/dist/types/src/exemplars/Card/fragments.d.ts.map +1 -0
  24. package/dist/types/src/exemplars/Card/index.d.ts +3 -0
  25. package/dist/types/src/exemplars/Card/index.d.ts.map +1 -0
  26. package/dist/types/src/exemplars/CardStack/CardStack.d.ts +34 -0
  27. package/dist/types/src/exemplars/CardStack/CardStack.d.ts.map +1 -0
  28. package/dist/types/src/exemplars/CardStack/CardStack.stories-todo.d.ts +1 -0
  29. package/dist/types/src/exemplars/CardStack/CardStack.stories-todo.d.ts.map +1 -0
  30. package/dist/types/src/exemplars/CardStack/CardStackDragPreview.d.ts +9 -0
  31. package/dist/types/src/exemplars/CardStack/CardStackDragPreview.d.ts.map +1 -0
  32. package/dist/types/src/exemplars/CardStack/index.d.ts +3 -0
  33. package/dist/types/src/exemplars/CardStack/index.d.ts.map +1 -0
  34. package/dist/types/src/exemplars/index.d.ts +3 -0
  35. package/dist/types/src/exemplars/index.d.ts.map +1 -0
  36. package/dist/types/src/hooks/useStackDropForElements.d.ts +2 -1
  37. package/dist/types/src/hooks/useStackDropForElements.d.ts.map +1 -1
  38. package/dist/types/src/index.d.ts +1 -0
  39. package/dist/types/src/index.d.ts.map +1 -1
  40. package/dist/types/src/translations.d.ts +1 -0
  41. package/dist/types/src/translations.d.ts.map +1 -1
  42. package/package.json +21 -20
  43. package/src/components/Stack/Stack.tsx +18 -0
  44. package/src/components/StackItem/StackItemDragHandle.tsx +1 -1
  45. package/src/components/StackItem/StackItemHeading.tsx +7 -4
  46. package/src/exemplars/Card/Card.stories-todo.tsx +135 -0
  47. package/src/exemplars/Card/Card.tsx +178 -0
  48. package/src/exemplars/Card/CardDragPreview.tsx +22 -0
  49. package/src/exemplars/Card/fragments.ts +14 -0
  50. package/src/exemplars/Card/index.ts +6 -0
  51. package/src/exemplars/CardStack/CardStack.stories-todo.tsx +80 -0
  52. package/src/exemplars/CardStack/CardStack.tsx +118 -0
  53. package/src/exemplars/CardStack/CardStackDragPreview.tsx +61 -0
  54. package/src/exemplars/CardStack/index.ts +6 -0
  55. package/src/exemplars/index.ts +6 -0
  56. package/src/hooks/useStackDropForElements.ts +4 -2
  57. package/src/index.ts +4 -0
  58. package/src/translations.ts +1 -0
@@ -0,0 +1,178 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ import { Primitive } from '@radix-ui/react-primitive';
6
+ import { Slot } from '@radix-ui/react-slot';
7
+ import React, {
8
+ type ComponentPropsWithoutRef,
9
+ type ComponentPropsWithRef,
10
+ type FC,
11
+ forwardRef,
12
+ type PropsWithChildren,
13
+ } from 'react';
14
+
15
+ import { Icon, IconButton, type ThemedClassName, Toolbar, type ToolbarRootProps, useTranslation } from '@dxos/react-ui';
16
+ import { mx } from '@dxos/react-ui-theme';
17
+
18
+ import { cardChrome, cardContent, cardHeading, cardRoot, cardText } from './fragments';
19
+ import { StackItem } from '../../components';
20
+ import { translationKey } from '../../translations';
21
+
22
+ type SharedCardProps = ThemedClassName<ComponentPropsWithoutRef<'div'>> & { asChild?: boolean };
23
+
24
+ const CardRoot = forwardRef<HTMLDivElement, SharedCardProps>(
25
+ ({ children, classNames, asChild, role = 'none', ...props }, forwardedRef) => {
26
+ const Root = asChild ? Slot : 'div';
27
+ const rootProps = asChild ? { classNames: [cardRoot, classNames] } : { className: mx(cardRoot, classNames), role };
28
+ return (
29
+ <Root {...props} {...rootProps} ref={forwardedRef}>
30
+ {children}
31
+ </Root>
32
+ );
33
+ },
34
+ );
35
+
36
+ const CardContent = forwardRef<HTMLDivElement, SharedCardProps>(
37
+ ({ children, classNames, asChild, role = 'group', ...props }, forwardedRef) => {
38
+ const Root = asChild ? Slot : 'div';
39
+ const rootProps = asChild
40
+ ? { classNames: [cardContent, classNames] }
41
+ : { className: mx(cardContent, classNames), role };
42
+ return (
43
+ <Root {...props} {...rootProps} ref={forwardedRef}>
44
+ {children}
45
+ </Root>
46
+ );
47
+ },
48
+ );
49
+
50
+ /**
51
+ * This should be used by Surface fulfillments in cases where the content may or may not already be encapsulated (e.g.
52
+ * in a Popover) and knows this based on the `role` it receives. This will render a `Card.Content` by default, otherwise
53
+ * it will render a `div` primitive with the appropriate styling for specific handled situations.
54
+ */
55
+ const CardConditionalContent = ({ role, children }: PropsWithChildren<{ role?: string }>) => {
56
+ if (['popover', 'card--kanban'].includes(role ?? 'never')) {
57
+ return (
58
+ <div className={role === 'popover' ? 'popover-card-width' : role === 'card--kanban' ? 'contents' : ''}>
59
+ {children}
60
+ </div>
61
+ );
62
+ } else {
63
+ return <CardContent>{children}</CardContent>;
64
+ }
65
+ };
66
+
67
+ const CardHeading = forwardRef<HTMLDivElement, SharedCardProps>(
68
+ ({ children, classNames, asChild, role = 'heading', ...props }, forwardedRef) => {
69
+ const Root = asChild ? Slot : 'div';
70
+ const rootProps = asChild
71
+ ? { classNames: [cardHeading, cardText, classNames] }
72
+ : { className: mx(cardHeading, cardText, classNames), role };
73
+ return (
74
+ <Root {...props} {...rootProps} ref={forwardedRef}>
75
+ {children}
76
+ </Root>
77
+ );
78
+ },
79
+ );
80
+
81
+ const CardToolbar = forwardRef<HTMLDivElement, ToolbarRootProps>(({ children, ...props }, forwardedRef) => {
82
+ return (
83
+ <Toolbar.Root {...props} ref={forwardedRef}>
84
+ {children}
85
+ </Toolbar.Root>
86
+ );
87
+ });
88
+
89
+ const CardToolbarIconButton = Toolbar.IconButton;
90
+ const CardToolbarSeparator = Toolbar.Separator;
91
+
92
+ const CardDragHandle = forwardRef<HTMLButtonElement, { toolbarItem?: boolean }>(({ toolbarItem }, forwardedRef) => {
93
+ const { t } = useTranslation(translationKey);
94
+ const Root = toolbarItem ? Toolbar.IconButton : IconButton;
95
+ return (
96
+ <Root
97
+ iconOnly
98
+ icon='ph--dots-six-vertical--regular'
99
+ variant='ghost'
100
+ label={t('card drag handle label')}
101
+ classNames='pli-2'
102
+ ref={forwardedRef}
103
+ />
104
+ );
105
+ });
106
+
107
+ const CardDragPreview = StackItem.DragPreview;
108
+
109
+ const CardMenu = Primitive.div as FC<ComponentPropsWithRef<'div'>>;
110
+
111
+ type CardPosterProps = {
112
+ alt: string;
113
+ aspect?: 'video' | 'auto';
114
+ } & Partial<{ image: string; icon: string }>;
115
+
116
+ const CardPoster = (props: CardPosterProps) => {
117
+ const aspect = props.aspect === 'auto' ? 'aspect-auto' : 'aspect-video';
118
+ if (props.image) {
119
+ return (
120
+ <img className={`dx-card__poster ${aspect} object-cover is-full bs-auto`} src={props.image} alt={props.alt} />
121
+ );
122
+ }
123
+ if (props.icon) {
124
+ return (
125
+ <div
126
+ role='image'
127
+ className={`dx-card__poster grid ${aspect} place-items-center bg-inputSurface text-subdued`}
128
+ aria-label={props.alt}
129
+ >
130
+ <Icon icon={props.icon} size={10} />
131
+ </div>
132
+ );
133
+ }
134
+ };
135
+
136
+ const CardChrome = forwardRef<HTMLDivElement, SharedCardProps>(
137
+ ({ children, classNames, asChild, role = 'none', ...props }, forwardedRef) => {
138
+ const Root = asChild ? Slot : 'div';
139
+ const rootProps = asChild
140
+ ? { classNames: [cardChrome, classNames] }
141
+ : { className: mx(cardChrome, classNames), role };
142
+ return (
143
+ <Root {...props} {...rootProps} ref={forwardedRef}>
144
+ {children}
145
+ </Root>
146
+ );
147
+ },
148
+ );
149
+
150
+ const CardText = forwardRef<HTMLParagraphElement, SharedCardProps>(
151
+ ({ children, classNames, asChild, role = 'none', ...props }, forwardedRef) => {
152
+ const Root = asChild ? Slot : 'p';
153
+ const rootProps = asChild ? { classNames: [cardText, classNames] } : { className: mx(cardText, classNames), role };
154
+ return (
155
+ <Root {...props} {...rootProps} ref={forwardedRef}>
156
+ {children}
157
+ </Root>
158
+ );
159
+ },
160
+ );
161
+
162
+ export const Card = {
163
+ Root: CardRoot,
164
+ Content: CardContent,
165
+ Container: CardConditionalContent,
166
+ Heading: CardHeading,
167
+ Toolbar: CardToolbar,
168
+ ToolbarIconButton: CardToolbarIconButton,
169
+ ToolbarSeparator: CardToolbarSeparator,
170
+ DragHandle: CardDragHandle,
171
+ DragPreview: CardDragPreview,
172
+ Menu: CardMenu,
173
+ Poster: CardPoster,
174
+ Chrome: CardChrome,
175
+ Text: CardText,
176
+ };
177
+
178
+ export { cardRoot, cardContent, cardHeading, cardText, cardChrome };
@@ -0,0 +1,22 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ import React, { type PropsWithChildren } from 'react';
6
+
7
+ import { mx } from '@dxos/react-ui-theme';
8
+
9
+ import { cardContent } from './fragments';
10
+
11
+ const CardDragPreviewRoot = ({ children }: PropsWithChildren<{}>) => {
12
+ return <div className='p-2'>{children}</div>;
13
+ };
14
+
15
+ const CardDragPreviewContent = ({ children }: PropsWithChildren<{}>) => {
16
+ return <div className={mx(cardContent, 'ring-focusLine ring-neutralFocusIndicator')}>{children}</div>;
17
+ };
18
+
19
+ export const CardDragPreview = {
20
+ Root: CardDragPreviewRoot,
21
+ Content: CardDragPreviewContent,
22
+ };
@@ -0,0 +1,14 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ export const cardRoot = 'contain-layout pli-2 plb-1 first-of-type:pbs-0 last-of-type:pbe-0';
6
+
7
+ export const cardContent =
8
+ 'rounded overflow-hidden bg-cardSurface border border-separator dark:border-subduedSeparator dx-focus-ring-group-y-indicator relative min-bs-[--rail-item] group/card';
9
+
10
+ export const cardText = 'pli-3 mlb-3';
11
+
12
+ export const cardHeading = 'text-lg font-medium line-clamp-2';
13
+
14
+ export const cardChrome = 'pli-1.5 mlb-1.5 [&_.dx-button]:pli-1.5 [&_.dx-button]:text-start [&_.dx-button]:is-full';
@@ -0,0 +1,6 @@
1
+ //
2
+ // Copyright 2023 DXOS.org
3
+ //
4
+
5
+ export * from './Card';
6
+ export * from './CardDragPreview';
@@ -0,0 +1,80 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ // type CardData = {
6
+ // id: string;
7
+ // title: string;
8
+ // body: string;
9
+ // image?: string;
10
+ // };
11
+
12
+ // const DraggableCard: FC<{ data: CardData; onDelete: (id: string) => void }> = ({ data, onDelete }) => {
13
+ // const { id, title, body, image } = data;
14
+ // const { attributes, listeners, setNodeRef, transform } = useSortable({ id });
15
+ // const t = transform ? Object.assign(transform, { scaleY: 1 }) : null;
16
+ //
17
+ // return (
18
+ // <Card.Root ref={setNodeRef} item={data} style={{ transform: CSS.Transform.toString(t) }}>
19
+ // <Card.Heading>
20
+ // <Card.DragHandle {...listeners} {...attributes} />
21
+ // <Card.Title title={title} />
22
+ // <DropdownMenu.Root>
23
+ // <DropdownMenu.Trigger asChild>
24
+ // <Card.Menu />
25
+ // </DropdownMenu.Trigger>
26
+ // <DropdownMenu.Content>
27
+ // <DropdownMenu.Viewport>
28
+ // <DropdownMenu.Item onClick={() => onDelete(id)}>Delete</DropdownMenu.Item>
29
+ // </DropdownMenu.Viewport>
30
+ // </DropdownMenu.Content>
31
+ // </DropdownMenu.Root>
32
+ // </Card.Heading>
33
+ // <Card.Content classNames={'text-sm'} gutter>
34
+ // <p>{body}</p>
35
+ // </Card.Content>
36
+ // {image && <Card.Media src={image} classNames={'h-[160px]'} />}
37
+ // </Card.Root>
38
+ // );
39
+ // };
40
+ //
41
+ // const DraggableStory: FC<PropsWithChildren> = ({ children }) => {
42
+ // const [cards, setCards] = useState<CardData[]>(
43
+ // Array.from({ length: 7 }).map(() => ({
44
+ // id: faker.string.uuid(),
45
+ // title: faker.lorem.sentence(3),
46
+ // body: faker.lorem.sentences(),
47
+ // image: faker.datatype.boolean() ? faker.helpers.arrayElement(testImages) : undefined,
48
+ // })),
49
+ // );
50
+ //
51
+ // const handleDelete = (id: string) => {
52
+ // setCards((cards) => cards.filter((card) => card.id !== id));
53
+ // };
54
+ //
55
+ // const handleDragEnd = (event: DragEndEvent) => {
56
+ // const { active, over } = event;
57
+ // if (active.id !== over?.id) {
58
+ // setCards((cards) => {
59
+ // const oldIndex = cards.findIndex((card) => card.id === active.id);
60
+ // const newIndex = cards.findIndex((card) => card.id === over?.id);
61
+ // return arrayMove(cards, oldIndex, newIndex);
62
+ // });
63
+ // }
64
+ // };
65
+ //
66
+ // return (
67
+ // <DndContext onDragEnd={handleDragEnd}>
68
+ // <SortableContext items={cards.map(({ id }) => id)} strategy={verticalListSortingStrategy}>
69
+ // <div className='flex flex-col overflow-y-scroll'>
70
+ // <div className='flex flex-col gap-4'>
71
+ // {cards.map((card) => (
72
+ // <DraggableCard key={card.id} data={card} onDelete={handleDelete} />
73
+ // ))}
74
+ // </div>
75
+ // </div>
76
+ // </SortableContext>
77
+ // </DndContext>
78
+ // );
79
+ // };
80
+ // export const Draggable = () => <DraggableStory />;
@@ -0,0 +1,118 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ import { Slot } from '@radix-ui/react-slot';
6
+ import React, { type ComponentPropsWithoutRef, forwardRef } from 'react';
7
+
8
+ import type { ThemedClassName } from '@dxos/react-ui';
9
+ import { mx } from '@dxos/react-ui-theme';
10
+
11
+ import { railGridHorizontalContainFitContent, Stack, type StackProps } from '../../components';
12
+ import { Card } from '../Card';
13
+
14
+ type SharedCardStackProps = ThemedClassName<ComponentPropsWithoutRef<'div'>> & { asChild?: boolean };
15
+
16
+ const CardStackStack = forwardRef<
17
+ HTMLDivElement,
18
+ Omit<StackProps, 'orientation' | 'size' | 'rail' | 'separatorOnScroll'>
19
+ >(({ children, classNames, itemsCount = 0, ...props }, forwardedRef) => {
20
+ return (
21
+ <Stack
22
+ orientation='vertical'
23
+ size='contain'
24
+ rail={false}
25
+ classNames={
26
+ /* NOTE(thure): Do not let this element have zero intrinsic size, otherwise the drop indicator will not display. See #9035. */
27
+ ['plb-1', itemsCount > 0 && 'plb-2', classNames]
28
+ }
29
+ itemsCount={itemsCount}
30
+ separatorOnScroll={9}
31
+ {...props}
32
+ ref={forwardedRef}
33
+ >
34
+ {children}
35
+ </Stack>
36
+ );
37
+ });
38
+
39
+ const CardStackDragHandle = Card.DragHandle;
40
+
41
+ const cardStackHeading = 'mli-2 order-first bg-transparent rounded-bs-md flex items-center';
42
+
43
+ const CardStackHeading = forwardRef<HTMLDivElement, SharedCardStackProps>(
44
+ ({ children, classNames, asChild, role = 'heading', ...props }, forwardedRef) => {
45
+ const Root = asChild ? Slot : 'div';
46
+ const rootProps = asChild
47
+ ? { classNames: [cardStackHeading, classNames] }
48
+ : { className: mx(cardStackHeading, classNames), role };
49
+ return (
50
+ <Root {...props} {...rootProps} ref={forwardedRef}>
51
+ {children}
52
+ </Root>
53
+ );
54
+ },
55
+ );
56
+
57
+ const cardStackFooter =
58
+ 'plb-2 mli-2 border-bs border-transparent [[data-scroll-separator-end="true"]_&]:border-subduedSeparator';
59
+
60
+ const CardStackFooter = forwardRef<HTMLDivElement, SharedCardStackProps>(
61
+ ({ children, classNames, asChild, role = 'none', ...props }, forwardedRef) => {
62
+ const Root = asChild ? Slot : 'div';
63
+ const rootProps = asChild
64
+ ? { classNames: [cardStackFooter, classNames] }
65
+ : { className: mx(cardStackFooter, classNames), role };
66
+ return (
67
+ <Root {...props} {...rootProps} ref={forwardedRef}>
68
+ {children}
69
+ </Root>
70
+ );
71
+ },
72
+ );
73
+
74
+ const cardStackContent = [
75
+ 'shrink min-bs-0 bg-baseSurface border border-separator rounded-md grid dx-focus-ring-group-x-indicator kanban-drop',
76
+ railGridHorizontalContainFitContent,
77
+ ];
78
+
79
+ const CardStackContent = forwardRef<HTMLDivElement, SharedCardStackProps>(
80
+ ({ children, classNames, asChild, role = 'none', ...props }, forwardedRef) => {
81
+ const Root = asChild ? Slot : 'div';
82
+ const rootProps = asChild
83
+ ? { classNames: [...cardStackContent, classNames] }
84
+ : { className: mx(...cardStackContent, classNames), role };
85
+ return (
86
+ <Root {...props} {...rootProps} data-scroll-separator='false' ref={forwardedRef}>
87
+ {children}
88
+ </Root>
89
+ );
90
+ },
91
+ );
92
+
93
+ const cardStackRoot = 'flex flex-col pli-2 plb-2';
94
+
95
+ const CardStackRoot = forwardRef<HTMLDivElement, SharedCardStackProps>(
96
+ ({ children, classNames, asChild, role = 'none', ...props }, forwardedRef) => {
97
+ const Root = asChild ? Slot : 'div';
98
+ const rootProps = asChild
99
+ ? { classNames: [cardStackRoot, classNames] }
100
+ : { className: mx(cardStackRoot, classNames), role };
101
+ return (
102
+ <Root {...props} {...rootProps} ref={forwardedRef}>
103
+ {children}
104
+ </Root>
105
+ );
106
+ },
107
+ );
108
+
109
+ export const CardStack = {
110
+ Root: CardStackRoot,
111
+ Content: CardStackContent,
112
+ Stack: CardStackStack,
113
+ Heading: CardStackHeading,
114
+ Footer: CardStackFooter,
115
+ DragHandle: CardStackDragHandle,
116
+ };
117
+
118
+ export { cardStackRoot, cardStackFooter, cardStackHeading, cardStackContent };
@@ -0,0 +1,61 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ import React, { type PropsWithChildren } from 'react';
6
+
7
+ import { IconButton, useTranslation } from '@dxos/react-ui';
8
+ import { mx } from '@dxos/react-ui-theme';
9
+
10
+ import { type StackProps } from '../../components';
11
+ import { translationKey } from '../../translations';
12
+
13
+ const CardStackDragPreviewRoot = ({ children }: PropsWithChildren<{}>) => {
14
+ return (
15
+ <div className='p-2'>
16
+ <div className='rounded-md max-bs-[calc(100dvh-1rem)] overflow-hidden bg-baseSurface border border-separator ring-focusLine ring-neutralFocusIndicator flex flex-col'>
17
+ {children}
18
+ </div>
19
+ </div>
20
+ );
21
+ };
22
+
23
+ const CardStackDragPreviewHeading = ({ children }: PropsWithChildren<{}>) => {
24
+ const { t } = useTranslation(translationKey);
25
+ return (
26
+ <div className='flex items-center p-2'>
27
+ <IconButton
28
+ iconOnly
29
+ icon='ph--dots-six-vertical--regular'
30
+ variant='ghost'
31
+ label={t('column drag handle label')}
32
+ classNames='pli-2'
33
+ />
34
+ {children}
35
+ </div>
36
+ );
37
+ };
38
+
39
+ const CardStackDragPreviewContent = ({
40
+ children,
41
+ itemsCount = 0,
42
+ }: PropsWithChildren<Pick<StackProps, 'itemsCount'>>) => {
43
+ return (
44
+ <div
45
+ className={mx('overflow-y-auto flex-1 pli-2 flex flex-col gap-2', 'plb-1', itemsCount > 0 ? 'plb-2' : 'plb-1')}
46
+ >
47
+ {children}
48
+ </div>
49
+ );
50
+ };
51
+
52
+ const CardStackDragPreviewFooter = ({ children }: PropsWithChildren<{}>) => {
53
+ return <div className='p-2 border-t border-separator'>{children}</div>;
54
+ };
55
+
56
+ export const CardStackDragPreview = {
57
+ Root: CardStackDragPreviewRoot,
58
+ Heading: CardStackDragPreviewHeading,
59
+ Content: CardStackDragPreviewContent,
60
+ Footer: CardStackDragPreviewFooter,
61
+ };
@@ -0,0 +1,6 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ export * from './CardStack';
6
+ export * from './CardStackDragPreview';
@@ -0,0 +1,6 @@
1
+ //
2
+ // Copyright 2023 DXOS.org
3
+ //
4
+
5
+ export * from './Card';
6
+ export * from './CardStack';
@@ -16,12 +16,14 @@ import { type StackItemRearrangeHandler, type StackItemData, type Orientation }
16
16
  export const useStackDropForElements = ({
17
17
  id,
18
18
  element,
19
+ scrollElement = element,
19
20
  selfDroppable,
20
21
  orientation,
21
22
  onRearrange,
22
23
  }: {
23
24
  id?: string;
24
25
  element: HTMLDivElement | null;
26
+ scrollElement?: HTMLDivElement | null;
25
27
  selfDroppable: boolean;
26
28
  orientation: Orientation;
27
29
  onRearrange?: StackItemRearrangeHandler;
@@ -64,9 +66,9 @@ export const useStackDropForElements = ({
64
66
  }
65
67
  },
66
68
  }),
67
- autoScrollForElements({ element, getAllowedAxis: () => orientation }),
69
+ autoScrollForElements({ element: scrollElement as Element, getAllowedAxis: () => orientation }),
68
70
  );
69
- }, [element, selfDroppable, orientation, id, onRearrange]);
71
+ }, [element, scrollElement, selfDroppable, orientation, id, onRearrange]);
70
72
 
71
73
  return { dropping };
72
74
  };
package/src/index.ts CHANGED
@@ -3,4 +3,8 @@
3
3
  //
4
4
 
5
5
  export * from './components';
6
+
7
+ // TODO(thure): Consider exporting exemplars from separate endpoints.
8
+ export * from './exemplars';
9
+
6
10
  export { default as translations } from './translations';
@@ -9,6 +9,7 @@ export default [
9
9
  'en-US': {
10
10
  [translationKey]: {
11
11
  'resize label': 'Drag to resize',
12
+ 'drag handle label': 'Drag to rearrange',
12
13
  'pin start label': 'Pin to the left sidebar',
13
14
  'pin end label': 'Pin to the right sidebar',
14
15
  'increment start label': 'Move to the left',