@dxos/react-ui-stack 0.8.4-main.8342792842 → 0.8.4-main.8360d9e660
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 +91 -276
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/node-esm/index.mjs +91 -276
- package/dist/lib/node-esm/index.mjs.map +4 -4
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/types/src/components/Stack/Stack.d.ts +4 -4
- package/dist/types/src/components/Stack/Stack.d.ts.map +1 -1
- package/dist/types/src/components/StackItem/MenuSignifier.d.ts.map +1 -1
- package/dist/types/src/components/StackItem/StackItem.d.ts +2 -2
- package/dist/types/src/components/StackItem/StackItemDragHandle.d.ts.map +1 -1
- package/dist/types/src/components/StackItem/StackItemHeading.d.ts +1 -1
- package/dist/types/src/components/StackItem/StackItemHeading.d.ts.map +1 -1
- package/dist/types/src/components/StackItem/StackItemResizeHandle.d.ts +1 -1
- package/dist/types/src/components/StackItem/StackItemResizeHandle.d.ts.map +1 -1
- package/dist/types/src/components/StackItem/StackItemSigil.d.ts.map +1 -1
- package/dist/types/src/components/index.d.ts +0 -1
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +25 -25
- package/src/components/Stack/Stack.tsx +8 -8
- package/src/components/StackItem/MenuSignifier.tsx +2 -9
- package/src/components/StackItem/StackItem.stories.tsx +3 -3
- package/src/components/StackItem/StackItem.tsx +1 -1
- package/src/components/StackItem/StackItemContent.tsx +6 -6
- package/src/components/StackItem/StackItemDragHandle.tsx +4 -3
- package/src/components/StackItem/StackItemHeading.tsx +13 -12
- package/src/components/StackItem/StackItemResizeHandle.tsx +1 -1
- package/src/components/StackItem/StackItemSigil.tsx +6 -3
- package/src/components/index.ts +1 -1
- package/src/playwright/playwright.config.ts +1 -1
- package/dist/types/src/components/CardStack/CardStack.d.ts +0 -47
- package/dist/types/src/components/CardStack/CardStack.d.ts.map +0 -1
- package/dist/types/src/components/CardStack/CardStack.stories.d.ts +0 -15
- package/dist/types/src/components/CardStack/CardStack.stories.d.ts.map +0 -1
- package/dist/types/src/components/CardStack/CardStackDragPreview.d.ts +0 -12
- package/dist/types/src/components/CardStack/CardStackDragPreview.d.ts.map +0 -1
- package/dist/types/src/components/CardStack/index.d.ts +0 -3
- package/dist/types/src/components/CardStack/index.d.ts.map +0 -1
- package/dist/types/src/components/deprecated/LayoutControls.d.ts +0 -22
- package/dist/types/src/components/deprecated/LayoutControls.d.ts.map +0 -1
- package/src/components/CardStack/CardStack.stories.tsx +0 -173
- package/src/components/CardStack/CardStack.tsx +0 -195
- package/src/components/CardStack/CardStackDragPreview.tsx +0 -64
- package/src/components/CardStack/index.ts +0 -6
- package/src/components/deprecated/LayoutControls.tsx +0 -112
|
@@ -1,11 +1,5 @@
|
|
|
1
1
|
import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
|
|
2
2
|
|
|
3
|
-
// src/components/CardStack/CardStack.tsx
|
|
4
|
-
import { Slot } from "@radix-ui/react-slot";
|
|
5
|
-
import React2, { forwardRef as forwardRef2 } from "react";
|
|
6
|
-
import { Card } from "@dxos/react-ui-mosaic";
|
|
7
|
-
import { cardDefaultInlineSize, mx as mx2 } from "@dxos/ui-theme";
|
|
8
|
-
|
|
9
3
|
// src/components/Stack/Stack.tsx
|
|
10
4
|
import { composeRefs } from "@radix-ui/react-compose-refs";
|
|
11
5
|
import React, { Children, forwardRef, useCallback, useEffect, useMemo, useState as useState2 } from "react";
|
|
@@ -101,10 +95,10 @@ var StackItemContext = /* @__PURE__ */ createContext({
|
|
|
101
95
|
var useStackItem = () => useContext(StackItemContext);
|
|
102
96
|
|
|
103
97
|
// src/components/Stack/Stack.tsx
|
|
104
|
-
var railGridHorizontal = "grid-rows-[[rail-start]_var(--rail-size)_[content-start]_1fr_[content-end]]";
|
|
105
|
-
var railGridVertical = "grid-cols-[[rail-start]_var(--rail-size)_[content-start]_1fr_[content-end]]";
|
|
106
|
-
var railGridHorizontalContainFitContent = "grid-rows-[[rail-start]_var(--rail-size)_[content-start]_fit-content(calc(100%-var(--rail-size)*2+2px))_[content-end]]";
|
|
107
|
-
var railGridVerticalContainFitContent = "grid-cols-[[rail-start]_var(--rail-size)_[content-start]_fit-content(calc(100%-var(--rail-size)*2+2px))_[content-end]]";
|
|
98
|
+
var railGridHorizontal = "grid-rows-[[rail-start]_var(--dx-rail-size)_[content-start]_1fr_[content-end]]";
|
|
99
|
+
var railGridVertical = "grid-cols-[[rail-start]_var(--dx-rail-size)_[content-start]_1fr_[content-end]]";
|
|
100
|
+
var railGridHorizontalContainFitContent = "grid-rows-[[rail-start]_var(--dx-rail-size)_[content-start]_fit-content(calc(100%-var(--dx-rail-size)*2+2px))_[content-end]]";
|
|
101
|
+
var railGridVerticalContainFitContent = "grid-cols-[[rail-start]_var(--dx-rail-size)_[content-start]_fit-content(calc(100%-var(--dx-rail-size)*2+2px))_[content-end]]";
|
|
108
102
|
var autoScrollRootAttributes = {
|
|
109
103
|
"data-drag-autoscroll": "idle"
|
|
110
104
|
};
|
|
@@ -256,7 +250,7 @@ var Stack = /* @__PURE__ */ forwardRef(({ children, classNames, style, orientati
|
|
|
256
250
|
]);
|
|
257
251
|
const gridClasses = useMemo(() => {
|
|
258
252
|
if (!rail) {
|
|
259
|
-
return orientation === "horizontal" ? "grid-rows-1
|
|
253
|
+
return orientation === "horizontal" ? "grid-rows-1 px-(--stack-gap)" : "grid-cols-1 py-(--stack-gap)";
|
|
260
254
|
}
|
|
261
255
|
if (orientation === "horizontal") {
|
|
262
256
|
return railGridHorizontal;
|
|
@@ -296,7 +290,7 @@ var Stack = /* @__PURE__ */ forwardRef(({ children, classNames, style, orientati
|
|
|
296
290
|
}
|
|
297
291
|
}, /* @__PURE__ */ React.createElement("div", {
|
|
298
292
|
...props,
|
|
299
|
-
className: mx("grid relative [--stack-gap:var(--
|
|
293
|
+
className: mx("grid relative [--stack-gap:var(--spacing-trim-xs)]", gridClasses, size === "contain" && (orientation === "horizontal" ? "overflow-x-auto overscroll-x-contain min-h-0 max-h-full h-full" : "overflow-y-auto min-w-0 max-w-full w-full"), classNames),
|
|
300
294
|
onKeyDown: handleKeyDown,
|
|
301
295
|
onBlur: handleBlur,
|
|
302
296
|
"data-dx-stack": stackId,
|
|
@@ -317,198 +311,6 @@ var Stack = /* @__PURE__ */ forwardRef(({ children, classNames, style, orientati
|
|
|
317
311
|
})));
|
|
318
312
|
});
|
|
319
313
|
|
|
320
|
-
// src/components/CardStack/CardStack.tsx
|
|
321
|
-
var cardStackDefaultInlineSizeRem = cardDefaultInlineSize + 2.125;
|
|
322
|
-
var cardStackRoot = "flex flex-col";
|
|
323
|
-
var CardStackRoot = /* @__PURE__ */ forwardRef2(({ children, classNames, asChild, role = "none", ...props }, forwardedRef) => {
|
|
324
|
-
const Root = asChild ? Slot : "div";
|
|
325
|
-
const rootProps = asChild ? {
|
|
326
|
-
classNames: [
|
|
327
|
-
cardStackRoot,
|
|
328
|
-
classNames
|
|
329
|
-
]
|
|
330
|
-
} : {
|
|
331
|
-
className: mx2(cardStackRoot, classNames),
|
|
332
|
-
role
|
|
333
|
-
};
|
|
334
|
-
return /* @__PURE__ */ React2.createElement(Root, {
|
|
335
|
-
...props,
|
|
336
|
-
...rootProps,
|
|
337
|
-
ref: forwardedRef
|
|
338
|
-
}, children);
|
|
339
|
-
});
|
|
340
|
-
var cardStackContent = "shrink min-bs-0 grid dx-focus-ring-group-x-indicator bg-baseSurface";
|
|
341
|
-
var CardStackContent = /* @__PURE__ */ forwardRef2(({ children, classNames, asChild, role = "none", footer, ...props }, forwardedRef) => {
|
|
342
|
-
const Root = asChild ? Slot : "div";
|
|
343
|
-
const baseClassNames = footer ? [
|
|
344
|
-
cardStackContent,
|
|
345
|
-
railGridHorizontalContainFitContent
|
|
346
|
-
] : [
|
|
347
|
-
cardStackContent
|
|
348
|
-
];
|
|
349
|
-
const rootProps = asChild ? {
|
|
350
|
-
classNames: [
|
|
351
|
-
...baseClassNames,
|
|
352
|
-
classNames
|
|
353
|
-
]
|
|
354
|
-
} : {
|
|
355
|
-
className: mx2(...baseClassNames, classNames),
|
|
356
|
-
role
|
|
357
|
-
};
|
|
358
|
-
return /* @__PURE__ */ React2.createElement(Root, {
|
|
359
|
-
...props,
|
|
360
|
-
...rootProps,
|
|
361
|
-
"data-scroll-separator": "false",
|
|
362
|
-
ref: forwardedRef
|
|
363
|
-
}, children);
|
|
364
|
-
});
|
|
365
|
-
var CardStackStack = /* @__PURE__ */ forwardRef2(({ children, classNames, itemsCount = 0, ...props }, forwardedRef) => {
|
|
366
|
-
return /* @__PURE__ */ React2.createElement(Stack, {
|
|
367
|
-
orientation: "vertical",
|
|
368
|
-
size: "contain",
|
|
369
|
-
rail: false,
|
|
370
|
-
classNames: (
|
|
371
|
-
/* NOTE(thure): Do not let this element have zero intrinsic size, otherwise the drop indicator will not display. See #9035. */
|
|
372
|
-
[
|
|
373
|
-
"plb-2",
|
|
374
|
-
classNames
|
|
375
|
-
]
|
|
376
|
-
),
|
|
377
|
-
itemsCount,
|
|
378
|
-
separatorOnScroll: 9,
|
|
379
|
-
"data-density": "fine",
|
|
380
|
-
...props,
|
|
381
|
-
ref: forwardedRef
|
|
382
|
-
}, children);
|
|
383
|
-
});
|
|
384
|
-
var cardStackItem = "contain-layout pli-2 plb-1 first-of-type:pbs-0 last-of-type:pbe-0";
|
|
385
|
-
var CardStackItem = /* @__PURE__ */ forwardRef2(({ children, classNames, asChild, role = "none", ...props }, forwardedRef) => {
|
|
386
|
-
const Root = asChild ? Slot : "div";
|
|
387
|
-
const rootProps = asChild ? {
|
|
388
|
-
classNames: [
|
|
389
|
-
cardStackItem,
|
|
390
|
-
classNames
|
|
391
|
-
]
|
|
392
|
-
} : {
|
|
393
|
-
className: mx2(cardStackItem, classNames),
|
|
394
|
-
role
|
|
395
|
-
};
|
|
396
|
-
return /* @__PURE__ */ React2.createElement(Root, {
|
|
397
|
-
...props,
|
|
398
|
-
...rootProps,
|
|
399
|
-
ref: forwardedRef
|
|
400
|
-
}, children);
|
|
401
|
-
});
|
|
402
|
-
var cardStackHeading = "mli-2 order-first bg-transparent rounded-bs-md flex items-center";
|
|
403
|
-
var CardStackHeading = /* @__PURE__ */ forwardRef2(({ children, classNames, asChild, role = "heading", ...props }, forwardedRef) => {
|
|
404
|
-
const Root = asChild ? Slot : "div";
|
|
405
|
-
const rootProps = asChild ? {
|
|
406
|
-
classNames: [
|
|
407
|
-
cardStackHeading,
|
|
408
|
-
classNames
|
|
409
|
-
]
|
|
410
|
-
} : {
|
|
411
|
-
className: mx2(cardStackHeading, classNames),
|
|
412
|
-
role
|
|
413
|
-
};
|
|
414
|
-
return /* @__PURE__ */ React2.createElement(Root, {
|
|
415
|
-
...props,
|
|
416
|
-
...rootProps,
|
|
417
|
-
ref: forwardedRef
|
|
418
|
-
}, children);
|
|
419
|
-
});
|
|
420
|
-
var cardStackFooter = 'plb-2 mli-2 border-bs border-transparent [[data-scroll-separator-end="true"]_&]:border-subduedSeparator';
|
|
421
|
-
var CardStackFooter = /* @__PURE__ */ forwardRef2(({ children, classNames, asChild, role = "none", ...props }, forwardedRef) => {
|
|
422
|
-
const Root = asChild ? Slot : "div";
|
|
423
|
-
const rootProps = asChild ? {
|
|
424
|
-
classNames: [
|
|
425
|
-
cardStackFooter,
|
|
426
|
-
classNames
|
|
427
|
-
]
|
|
428
|
-
} : {
|
|
429
|
-
className: mx2(cardStackFooter, classNames),
|
|
430
|
-
role
|
|
431
|
-
};
|
|
432
|
-
return /* @__PURE__ */ React2.createElement(Root, {
|
|
433
|
-
...props,
|
|
434
|
-
...rootProps,
|
|
435
|
-
ref: forwardedRef
|
|
436
|
-
}, children);
|
|
437
|
-
});
|
|
438
|
-
var CardStackDragHandle = Card.DragHandle;
|
|
439
|
-
var CardStack = {
|
|
440
|
-
Root: CardStackRoot,
|
|
441
|
-
Content: CardStackContent,
|
|
442
|
-
Stack: CardStackStack,
|
|
443
|
-
Heading: CardStackHeading,
|
|
444
|
-
Footer: CardStackFooter,
|
|
445
|
-
DragHandle: CardStackDragHandle,
|
|
446
|
-
Item: CardStackItem
|
|
447
|
-
};
|
|
448
|
-
|
|
449
|
-
// src/components/CardStack/CardStackDragPreview.tsx
|
|
450
|
-
import React3 from "react";
|
|
451
|
-
import { IconButton, ScrollArea, useTranslation } from "@dxos/react-ui";
|
|
452
|
-
import { mx as mx3 } from "@dxos/ui-theme";
|
|
453
|
-
|
|
454
|
-
// src/translations.ts
|
|
455
|
-
var translationKey = "@dxos/react-ui-stack";
|
|
456
|
-
var translations = [
|
|
457
|
-
{
|
|
458
|
-
"en-US": {
|
|
459
|
-
[translationKey]: {
|
|
460
|
-
"resize label": "Drag to resize",
|
|
461
|
-
"drag handle label": "Drag to rearrange",
|
|
462
|
-
"pin start label": "Pin to the left sidebar",
|
|
463
|
-
"pin end label": "Pin to the right sidebar",
|
|
464
|
-
"increment start label": "Move to the left",
|
|
465
|
-
"increment end label": "Move to the right",
|
|
466
|
-
"close label": "Close",
|
|
467
|
-
"minify label": "Minify"
|
|
468
|
-
}
|
|
469
|
-
}
|
|
470
|
-
}
|
|
471
|
-
];
|
|
472
|
-
|
|
473
|
-
// src/components/CardStack/CardStackDragPreview.tsx
|
|
474
|
-
var CardStackDragPreviewRoot = ({ children }) => {
|
|
475
|
-
return /* @__PURE__ */ React3.createElement("div", {
|
|
476
|
-
className: "p-2"
|
|
477
|
-
}, /* @__PURE__ */ React3.createElement("div", {
|
|
478
|
-
className: "rounded-md max-bs-[calc(100dvh-1rem)] overflow-hidden bg-baseSurface border border-separator ring-focusLine ring-neutralFocusIndicator flex flex-col"
|
|
479
|
-
}, children));
|
|
480
|
-
};
|
|
481
|
-
var CardStackDragPreviewHeading = ({ children }) => {
|
|
482
|
-
const { t } = useTranslation(translationKey);
|
|
483
|
-
return /* @__PURE__ */ React3.createElement("div", {
|
|
484
|
-
className: "flex items-center p-2"
|
|
485
|
-
}, /* @__PURE__ */ React3.createElement(IconButton, {
|
|
486
|
-
iconOnly: true,
|
|
487
|
-
icon: "ph--dots-six-vertical--regular",
|
|
488
|
-
variant: "ghost",
|
|
489
|
-
label: t("column drag handle label"),
|
|
490
|
-
classNames: "pli-2"
|
|
491
|
-
}), children);
|
|
492
|
-
};
|
|
493
|
-
var CardStackDragPreviewContent = ({ children, itemsCount = 0 }) => {
|
|
494
|
-
return /* @__PURE__ */ React3.createElement(ScrollArea.Root, {
|
|
495
|
-
orientation: "vertical"
|
|
496
|
-
}, /* @__PURE__ */ React3.createElement(ScrollArea.Viewport, {
|
|
497
|
-
classNames: mx3("pli-2 plb-1 gap-2", itemsCount > 0 ? "plb-2" : "plb-1")
|
|
498
|
-
}, children));
|
|
499
|
-
};
|
|
500
|
-
var CardStackDragPreviewFooter = ({ children }) => {
|
|
501
|
-
return /* @__PURE__ */ React3.createElement("div", {
|
|
502
|
-
className: "p-2 border-bs border-separator"
|
|
503
|
-
}, children);
|
|
504
|
-
};
|
|
505
|
-
var CardStackDragPreview = {
|
|
506
|
-
Root: CardStackDragPreviewRoot,
|
|
507
|
-
Heading: CardStackDragPreviewHeading,
|
|
508
|
-
Content: CardStackDragPreviewContent,
|
|
509
|
-
Footer: CardStackDragPreviewFooter
|
|
510
|
-
};
|
|
511
|
-
|
|
512
314
|
// src/components/StackItem/StackItem.tsx
|
|
513
315
|
import { combine as combine2 } from "@atlaskit/pragmatic-drag-and-drop/combine";
|
|
514
316
|
import { draggable, dropTargetForElements as dropTargetForElements2 } from "@atlaskit/pragmatic-drag-and-drop/element/adapter";
|
|
@@ -517,33 +319,33 @@ import { setCustomNativeDragPreview } from "@atlaskit/pragmatic-drag-and-drop/el
|
|
|
517
319
|
import { attachClosestEdge as attachClosestEdge2, extractClosestEdge as extractClosestEdge2 } from "@atlaskit/pragmatic-drag-and-drop-hitbox/closest-edge";
|
|
518
320
|
import { useFocusableGroup } from "@fluentui/react-tabster";
|
|
519
321
|
import { composeRefs as composeRefs2 } from "@radix-ui/react-compose-refs";
|
|
520
|
-
import
|
|
322
|
+
import React8, { forwardRef as forwardRef5, useCallback as useCallback2, useLayoutEffect as useLayoutEffect2, useMemo as useMemo3, useState as useState4 } from "react";
|
|
521
323
|
import { createPortal } from "react-dom";
|
|
522
324
|
import { ListItem as ListItem2 } from "@dxos/react-ui";
|
|
523
325
|
import { resizeAttributes, sizeStyle } from "@dxos/react-ui-dnd";
|
|
524
|
-
import { mx as
|
|
326
|
+
import { mx as mx5 } from "@dxos/ui-theme";
|
|
525
327
|
|
|
526
328
|
// src/components/StackItem/StackItemContent.tsx
|
|
527
|
-
import
|
|
528
|
-
import { mx as
|
|
529
|
-
var StackItemContent = /* @__PURE__ */
|
|
329
|
+
import React2, { forwardRef as forwardRef2, useMemo as useMemo2 } from "react";
|
|
330
|
+
import { mx as mx2 } from "@dxos/ui-theme";
|
|
331
|
+
var StackItemContent = /* @__PURE__ */ forwardRef2(({ classNames, children, toolbar, statusbar, ...props }, forwardedRef) => {
|
|
530
332
|
const { size: stackItemSize } = useStack();
|
|
531
333
|
const { role } = useStackItem();
|
|
532
334
|
const style = useMemo2(() => ({
|
|
533
335
|
gridTemplateRows: [
|
|
534
|
-
toolbar && role === "section" ? "calc(var(--toolbar-size) - 1px)" : "var(--toolbar-size)",
|
|
336
|
+
toolbar && role === "section" ? "calc(var(--dx-toolbar-size) - 1px)" : "var(--dx-toolbar-size)",
|
|
535
337
|
"1fr",
|
|
536
|
-
statusbar && "var(--statusbar-size)"
|
|
338
|
+
statusbar && "var(--dx-statusbar-size)"
|
|
537
339
|
].filter(Boolean).join(" ")
|
|
538
340
|
}), [
|
|
539
341
|
toolbar,
|
|
540
342
|
statusbar
|
|
541
343
|
]);
|
|
542
|
-
return /* @__PURE__ */
|
|
344
|
+
return /* @__PURE__ */ React2.createElement("div", {
|
|
543
345
|
...props,
|
|
544
346
|
role: "none",
|
|
545
347
|
style,
|
|
546
|
-
className:
|
|
348
|
+
className: mx2("group grid grid-cols-[100%] dx-density-coarse", stackItemSize === "contain" && "min-h-0 overflow-hidden", toolbar && role === "section" && "[&_.dx-toolbar]:sticky [&_.dx-toolbar]:z-[1] [&_.dx-toolbar]:top-0 [&_.dx-toolbar]:-mb-px [&_.dx-toolbar]:min-w-0", toolbar && "[&>.dx-toolbar]:relative [&>.dx-toolbar]:border-b [&>.dx-toolbar]:border-subdued-separator", classNames),
|
|
547
349
|
"data-popover-collision-boundary": true,
|
|
548
350
|
ref: forwardedRef
|
|
549
351
|
}, children);
|
|
@@ -551,56 +353,58 @@ var StackItemContent = /* @__PURE__ */ forwardRef3(({ classNames, children, tool
|
|
|
551
353
|
StackItemContent.displayName = "StackItemContent";
|
|
552
354
|
|
|
553
355
|
// src/components/StackItem/StackItemDragHandle.tsx
|
|
554
|
-
import {
|
|
555
|
-
import
|
|
356
|
+
import { Primitive } from "@radix-ui/react-primitive";
|
|
357
|
+
import { Slot } from "@radix-ui/react-slot";
|
|
358
|
+
import React3 from "react";
|
|
556
359
|
var StackItemDragHandle = ({ asChild, children }) => {
|
|
557
360
|
const { selfDragHandleRef } = useStackItem();
|
|
558
|
-
const
|
|
559
|
-
return /* @__PURE__ */
|
|
361
|
+
const Comp = asChild ? Slot : Primitive.div;
|
|
362
|
+
return /* @__PURE__ */ React3.createElement(Comp, {
|
|
560
363
|
ref: selfDragHandleRef,
|
|
561
364
|
role: "button"
|
|
562
365
|
}, children);
|
|
563
366
|
};
|
|
564
367
|
|
|
565
368
|
// src/components/StackItem/StackItemHeading.tsx
|
|
566
|
-
import {
|
|
567
|
-
import
|
|
369
|
+
import { Primitive as Primitive2 } from "@radix-ui/react-primitive";
|
|
370
|
+
import { Slot as Slot2 } from "@radix-ui/react-slot";
|
|
371
|
+
import React4, { forwardRef as forwardRef3 } from "react";
|
|
568
372
|
import { useAttention } from "@dxos/react-ui-attention";
|
|
569
|
-
import { mx as
|
|
570
|
-
var StackItemHeading = ({ children, classNames, asChild, separateOnScroll, ...props }) => {
|
|
373
|
+
import { mx as mx3 } from "@dxos/ui-theme";
|
|
374
|
+
var StackItemHeading = ({ children, classNames, asChild, separateOnScroll, role, ...props }) => {
|
|
571
375
|
const { orientation } = useStack();
|
|
572
|
-
const
|
|
573
|
-
return /* @__PURE__ */
|
|
574
|
-
role: "heading",
|
|
376
|
+
const Comp = asChild ? Slot2 : Primitive2.div;
|
|
377
|
+
return /* @__PURE__ */ React4.createElement(Comp, {
|
|
575
378
|
...props,
|
|
576
|
-
|
|
379
|
+
role: role ?? "heading",
|
|
380
|
+
className: mx3("flex items-center border-x-0! bg-header-surface", separateOnScroll ? 'border-transparent [[data-scroll-separator="true"]_&]:border-subdued-separator' : "border-subdued-separator", orientation === "horizontal" ? "h-(--dx-rail-size)" : "w-(--dx-rail-size) flex-col", orientation === "horizontal" ? "border-b" : "border-e", classNames)
|
|
577
381
|
}, children);
|
|
578
382
|
};
|
|
579
383
|
var StackItemHeadingStickyContent = ({ children }) => {
|
|
580
|
-
return /* @__PURE__ */
|
|
384
|
+
return /* @__PURE__ */ React4.createElement("div", {
|
|
581
385
|
role: "none",
|
|
582
|
-
className: "sticky
|
|
386
|
+
className: "sticky top-0 bg-(--sticky-bg) p-1 w-full"
|
|
583
387
|
}, children);
|
|
584
388
|
};
|
|
585
|
-
var StackItemHeadingLabel = /* @__PURE__ */
|
|
389
|
+
var StackItemHeadingLabel = /* @__PURE__ */ forwardRef3(({ attendableId, related, classNames, ...props }, forwardedRef) => {
|
|
586
390
|
const { hasAttention, isAncestor, isRelated } = useAttention(attendableId);
|
|
587
|
-
return /* @__PURE__ */
|
|
391
|
+
return /* @__PURE__ */ React4.createElement("h1", {
|
|
588
392
|
...props,
|
|
589
393
|
"data-attention": (related && isRelated || hasAttention || isAncestor).toString(),
|
|
590
|
-
className:
|
|
394
|
+
className: mx3("px-1 min-w-0 w-0 grow truncate font-medium text-base-surface-text data-[attention=true]:text-accent-text self-center", classNames),
|
|
591
395
|
ref: forwardedRef
|
|
592
396
|
});
|
|
593
397
|
});
|
|
594
398
|
|
|
595
399
|
// src/components/StackItem/StackItemResizeHandle.tsx
|
|
596
|
-
import
|
|
400
|
+
import React5 from "react";
|
|
597
401
|
import { ResizeHandle } from "@dxos/react-ui-dnd";
|
|
598
402
|
var MIN_WIDTH = 20;
|
|
599
403
|
var MIN_HEIGHT = 3;
|
|
600
|
-
var StackItemResizeHandle = () => {
|
|
404
|
+
var StackItemResizeHandle = (_) => {
|
|
601
405
|
const { orientation } = useStack();
|
|
602
406
|
const { setSize, size } = useStackItem();
|
|
603
|
-
return /* @__PURE__ */
|
|
407
|
+
return /* @__PURE__ */ React5.createElement(ResizeHandle, {
|
|
604
408
|
side: orientation === "horizontal" ? "inline-end" : "block-end",
|
|
605
409
|
fallbackSize: DEFAULT_EXTRINSIC_SIZE,
|
|
606
410
|
minSize: orientation === "horizontal" ? MIN_WIDTH : MIN_HEIGHT,
|
|
@@ -610,23 +414,42 @@ var StackItemResizeHandle = () => {
|
|
|
610
414
|
};
|
|
611
415
|
|
|
612
416
|
// src/components/StackItem/StackItemSigil.tsx
|
|
613
|
-
import
|
|
417
|
+
import React7, { Fragment, forwardRef as forwardRef4, useState as useState3 } from "react";
|
|
614
418
|
import { keySymbols } from "@dxos/keyboard";
|
|
615
|
-
import { Button, DropdownMenu, Icon, toLocalizedString, useTranslation
|
|
419
|
+
import { Button, DropdownMenu, Icon, toLocalizedString, useTranslation } from "@dxos/react-ui";
|
|
616
420
|
import { useAttention as useAttention2 } from "@dxos/react-ui-attention";
|
|
617
|
-
import {
|
|
421
|
+
import { mx as mx4 } from "@dxos/ui-theme";
|
|
618
422
|
import { getHostPlatform } from "@dxos/util";
|
|
619
423
|
|
|
424
|
+
// src/translations.ts
|
|
425
|
+
var translationKey = "@dxos/react-ui-stack";
|
|
426
|
+
var translations = [
|
|
427
|
+
{
|
|
428
|
+
"en-US": {
|
|
429
|
+
[translationKey]: {
|
|
430
|
+
"resize label": "Drag to resize",
|
|
431
|
+
"drag handle label": "Drag to rearrange",
|
|
432
|
+
"pin start label": "Pin to the left sidebar",
|
|
433
|
+
"pin end label": "Pin to the right sidebar",
|
|
434
|
+
"increment start label": "Move to the left",
|
|
435
|
+
"increment end label": "Move to the right",
|
|
436
|
+
"close label": "Close",
|
|
437
|
+
"minify label": "Minify"
|
|
438
|
+
}
|
|
439
|
+
}
|
|
440
|
+
}
|
|
441
|
+
];
|
|
442
|
+
|
|
620
443
|
// src/components/StackItem/MenuSignifier.tsx
|
|
621
|
-
import
|
|
622
|
-
var MenuSignifierHorizontal = () => /* @__PURE__ */
|
|
623
|
-
className: "absolute
|
|
444
|
+
import React6 from "react";
|
|
445
|
+
var MenuSignifierHorizontal = () => /* @__PURE__ */ React6.createElement("svg", {
|
|
446
|
+
className: "absolute bottom-[7px]",
|
|
624
447
|
width: 20,
|
|
625
448
|
height: 2,
|
|
626
449
|
viewBox: "0 0 20 2",
|
|
627
450
|
stroke: "currentColor",
|
|
628
451
|
opacity: 0.5
|
|
629
|
-
}, /* @__PURE__ */
|
|
452
|
+
}, /* @__PURE__ */ React6.createElement("line", {
|
|
630
453
|
x1: 0.5,
|
|
631
454
|
y1: 0.75,
|
|
632
455
|
x2: 19,
|
|
@@ -638,56 +461,56 @@ var MenuSignifierHorizontal = () => /* @__PURE__ */ React8.createElement("svg",
|
|
|
638
461
|
}));
|
|
639
462
|
|
|
640
463
|
// src/components/StackItem/StackItemSigil.tsx
|
|
641
|
-
var StackItemSigilButton = /* @__PURE__ */
|
|
464
|
+
var StackItemSigilButton = /* @__PURE__ */ forwardRef4(({ attendableId, classNames, related, isMenu = true, children, ...props }, forwardedRef) => {
|
|
642
465
|
const { hasAttention, isAncestor, isRelated } = useAttention2(attendableId);
|
|
643
466
|
const variant = related && isRelated || hasAttention || isAncestor ? "primary" : "ghost";
|
|
644
|
-
return /* @__PURE__ */
|
|
467
|
+
return /* @__PURE__ */ React7.createElement(Button, {
|
|
645
468
|
...props,
|
|
646
469
|
variant,
|
|
647
470
|
classNames: [
|
|
648
|
-
"shrink-0
|
|
471
|
+
"shrink-0 px-0 min-h-0 w-(--dx-rail-action) h-(--dx-rail-action) relative dx-app-no-drag",
|
|
649
472
|
classNames
|
|
650
473
|
],
|
|
651
474
|
ref: forwardedRef
|
|
652
|
-
}, isMenu && /* @__PURE__ */
|
|
475
|
+
}, isMenu && /* @__PURE__ */ React7.createElement(MenuSignifierHorizontal, null), children);
|
|
653
476
|
});
|
|
654
|
-
var StackItemSigil = /* @__PURE__ */
|
|
655
|
-
const { t } =
|
|
477
|
+
var StackItemSigil = /* @__PURE__ */ forwardRef4(({ actions: actionGroups, onAction, triggerLabel, attendableId, icon, related, children }, forwardedRef) => {
|
|
478
|
+
const { t } = useTranslation(translationKey);
|
|
656
479
|
const [optionsMenuOpen, setOptionsMenuOpen] = useState3(false);
|
|
657
480
|
const hasActions = actionGroups && actionGroups.length > 0;
|
|
658
|
-
const button = /* @__PURE__ */
|
|
481
|
+
const button = /* @__PURE__ */ React7.createElement(StackItemSigilButton, {
|
|
659
482
|
attendableId,
|
|
660
483
|
related,
|
|
661
484
|
isMenu: hasActions,
|
|
662
485
|
// TODO(wittjosiah): Better disabling of interactive styles when no action are available.
|
|
663
486
|
// Remove underscore icon when no actions are available?
|
|
664
487
|
classNames: !hasActions && "cursor-default"
|
|
665
|
-
}, /* @__PURE__ */
|
|
488
|
+
}, /* @__PURE__ */ React7.createElement("span", {
|
|
666
489
|
className: "sr-only"
|
|
667
|
-
}, triggerLabel), /* @__PURE__ */
|
|
490
|
+
}, triggerLabel), /* @__PURE__ */ React7.createElement(Icon, {
|
|
668
491
|
icon,
|
|
669
492
|
size: 5
|
|
670
493
|
}));
|
|
671
494
|
if (!hasActions) {
|
|
672
495
|
return button;
|
|
673
496
|
}
|
|
674
|
-
return /* @__PURE__ */
|
|
497
|
+
return /* @__PURE__ */ React7.createElement(DropdownMenu.Root, {
|
|
675
498
|
open: optionsMenuOpen,
|
|
676
499
|
onOpenChange: setOptionsMenuOpen
|
|
677
|
-
}, /* @__PURE__ */
|
|
500
|
+
}, /* @__PURE__ */ React7.createElement(DropdownMenu.Trigger, {
|
|
678
501
|
asChild: true,
|
|
679
502
|
ref: forwardedRef
|
|
680
|
-
}, button), /* @__PURE__ */
|
|
503
|
+
}, button), /* @__PURE__ */ React7.createElement(DropdownMenu.Portal, null, /* @__PURE__ */ React7.createElement(DropdownMenu.Content, {
|
|
681
504
|
classNames: "z-[31]"
|
|
682
|
-
}, /* @__PURE__ */
|
|
683
|
-
const separator = index > 0 ? /* @__PURE__ */
|
|
684
|
-
return /* @__PURE__ */
|
|
505
|
+
}, /* @__PURE__ */ React7.createElement(DropdownMenu.Viewport, null, actionGroups?.map((actions, index) => {
|
|
506
|
+
const separator = index > 0 ? /* @__PURE__ */ React7.createElement(DropdownMenu.Separator, null) : null;
|
|
507
|
+
return /* @__PURE__ */ React7.createElement(Fragment, {
|
|
685
508
|
key: index
|
|
686
509
|
}, separator, actions.map((action) => {
|
|
687
510
|
const shortcut = typeof action.properties.keyBinding === "string" ? action.properties.keyBinding : action.properties.keyBinding?.[getHostPlatform()];
|
|
688
511
|
const menuItemType = action.properties.menuItemType;
|
|
689
512
|
const Root = menuItemType === "toggle" ? DropdownMenu.CheckboxItem : DropdownMenu.Item;
|
|
690
|
-
return /* @__PURE__ */
|
|
513
|
+
return /* @__PURE__ */ React7.createElement(Root, {
|
|
691
514
|
key: action.id,
|
|
692
515
|
onClick: (event) => {
|
|
693
516
|
if (action.properties.disabled) {
|
|
@@ -703,28 +526,28 @@ var StackItemSigil = /* @__PURE__ */ forwardRef5(({ actions: actionGroups, onAct
|
|
|
703
526
|
...action.properties?.testId && {
|
|
704
527
|
"data-testid": action.properties.testId
|
|
705
528
|
}
|
|
706
|
-
}, /* @__PURE__ */
|
|
529
|
+
}, /* @__PURE__ */ React7.createElement(Icon, {
|
|
707
530
|
icon: action.properties.icon ?? "ph--placeholder--regular",
|
|
708
531
|
size: 4
|
|
709
|
-
}), /* @__PURE__ */
|
|
532
|
+
}), /* @__PURE__ */ React7.createElement("span", {
|
|
710
533
|
className: "grow truncate"
|
|
711
|
-
}, toLocalizedString(action.properties.label ?? "", t)), menuItemType === "toggle" && /* @__PURE__ */
|
|
534
|
+
}, toLocalizedString(action.properties.label ?? "", t)), menuItemType === "toggle" && /* @__PURE__ */ React7.createElement(DropdownMenu.ItemIndicator, {
|
|
712
535
|
asChild: true
|
|
713
|
-
}, /* @__PURE__ */
|
|
536
|
+
}, /* @__PURE__ */ React7.createElement(Icon, {
|
|
714
537
|
icon: "ph--check--regular",
|
|
715
538
|
size: 4
|
|
716
|
-
})), shortcut && /* @__PURE__ */
|
|
717
|
-
className:
|
|
539
|
+
})), shortcut && /* @__PURE__ */ React7.createElement("span", {
|
|
540
|
+
className: mx4("shrink-0", "text-description")
|
|
718
541
|
}, keySymbols(shortcut).join("")));
|
|
719
542
|
}));
|
|
720
|
-
}), children), /* @__PURE__ */
|
|
543
|
+
}), children), /* @__PURE__ */ React7.createElement(DropdownMenu.Arrow, null))));
|
|
721
544
|
});
|
|
722
545
|
|
|
723
546
|
// src/components/StackItem/StackItem.tsx
|
|
724
547
|
var DEFAULT_HORIZONTAL_SIZE = 48;
|
|
725
548
|
var DEFAULT_VERTICAL_SIZE = "min-content";
|
|
726
549
|
var DEFAULT_EXTRINSIC_SIZE = DEFAULT_HORIZONTAL_SIZE;
|
|
727
|
-
var StackItemRoot = /* @__PURE__ */
|
|
550
|
+
var StackItemRoot = /* @__PURE__ */ forwardRef5(({ item, children, classNames, size: propsSize, onSizeChange, role, order, prevSiblingId, nextSiblingId, style, disableRearrange, focusIndicatorVariant = "over-all", ...props }, forwardedRef) => {
|
|
728
551
|
const [itemElement, itemRef] = useState4(null);
|
|
729
552
|
const composedItemRef = composeRefs2(itemRef, forwardedRef);
|
|
730
553
|
const [selfDragHandleElement, selfDragHandleRef] = useState4(null);
|
|
@@ -878,13 +701,13 @@ var StackItemRoot = /* @__PURE__ */ forwardRef6(({ item, children, classNames, s
|
|
|
878
701
|
setDragState,
|
|
879
702
|
role
|
|
880
703
|
]);
|
|
881
|
-
return /* @__PURE__ */
|
|
704
|
+
return /* @__PURE__ */ React8.createElement(StackItemContext.Provider, {
|
|
882
705
|
value: stackItemContextValue
|
|
883
|
-
}, /* @__PURE__ */
|
|
706
|
+
}, /* @__PURE__ */ React8.createElement(Root, {
|
|
884
707
|
...props,
|
|
885
708
|
tabIndex: 0,
|
|
886
709
|
...focusableGroupAttrs,
|
|
887
|
-
className:
|
|
710
|
+
className: mx5("group/stack-item grid relative", focusIndicatorVariant === "over-all" ? "dx-focus-ring-inset-over-all" : focusIndicatorVariant === "over-all-always" ? "dx-focus-ring-inset-over-all-always" : orientation === "horizontal" ? focusIndicatorVariant === "group-always" ? "dx-focus-ring-group-x-always" : "dx-focus-ring-group-x" : focusIndicatorVariant === "group-always" ? "dx-focus-ring-group-y-always" : "dx-focus-ring-group-y", orientation === "horizontal" ? "grid-rows-subgrid" : "grid-cols-subgrid", rail && (orientation === "horizontal" ? "row-span-2" : "col-span-2"), role === "section" && orientation !== "horizontal" && "border-b border-subdued-separator", classNames),
|
|
888
711
|
"data-dx-stack-item": stackId,
|
|
889
712
|
"data-dx-item-id": item.id,
|
|
890
713
|
...resizeAttributes,
|
|
@@ -896,7 +719,7 @@ var StackItemRoot = /* @__PURE__ */ forwardRef6(({ item, children, classNames, s
|
|
|
896
719
|
...style
|
|
897
720
|
},
|
|
898
721
|
ref: composedItemRef
|
|
899
|
-
}, children, shouldShowDropIndicator() && closestEdge && /* @__PURE__ */
|
|
722
|
+
}, children, shouldShowDropIndicator() && closestEdge && /* @__PURE__ */ React8.createElement(ListItem2.DropIndicator, {
|
|
900
723
|
lineInset: 8,
|
|
901
724
|
terminalInset: -8,
|
|
902
725
|
edge: closestEdge
|
|
@@ -921,8 +744,6 @@ var StackItem = {
|
|
|
921
744
|
SigilButton: StackItemSigilButton
|
|
922
745
|
};
|
|
923
746
|
export {
|
|
924
|
-
CardStack,
|
|
925
|
-
CardStackDragPreview,
|
|
926
747
|
DEFAULT_EXTRINSIC_SIZE,
|
|
927
748
|
DEFAULT_HORIZONTAL_SIZE,
|
|
928
749
|
DEFAULT_VERTICAL_SIZE,
|
|
@@ -930,12 +751,6 @@ export {
|
|
|
930
751
|
StackContext,
|
|
931
752
|
StackItem,
|
|
932
753
|
autoScrollRootAttributes,
|
|
933
|
-
cardStackContent,
|
|
934
|
-
cardStackDefaultInlineSizeRem,
|
|
935
|
-
cardStackFooter,
|
|
936
|
-
cardStackHeading,
|
|
937
|
-
cardStackItem,
|
|
938
|
-
cardStackRoot,
|
|
939
754
|
railGridHorizontal,
|
|
940
755
|
railGridHorizontalContainFitContent,
|
|
941
756
|
railGridVertical,
|