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