@dxos/react-ui-stack 0.8.4-main.bc674ce → 0.8.4-main.c351d160a8
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 +92 -279
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/node-esm/index.mjs +92 -279
- 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/StackItemContent.d.ts.map +1 -1
- 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.stories.tsx +1 -1
- package/src/components/Stack/Stack.tsx +8 -8
- package/src/components/StackItem/MenuSignifier.tsx +2 -9
- package/src/components/StackItem/StackItem.stories.tsx +4 -4
- package/src/components/StackItem/StackItem.tsx +1 -1
- package/src/components/StackItem/StackItemContent.tsx +11 -9
- 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 -9
- 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 -196
- package/src/components/CardStack/CardStackDragPreview.tsx +0 -61
- 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,196 +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, 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("div", {
|
|
493
|
-
className: mx3("overflow-y-auto flex-1 pli-2 flex flex-col gap-2", "plb-1", itemsCount > 0 ? "plb-2" : "plb-1")
|
|
494
|
-
}, children);
|
|
495
|
-
};
|
|
496
|
-
var CardStackDragPreviewFooter = ({ children }) => {
|
|
497
|
-
return /* @__PURE__ */ React3.createElement("div", {
|
|
498
|
-
className: "p-2 border-bs border-separator"
|
|
499
|
-
}, children);
|
|
500
|
-
};
|
|
501
|
-
var CardStackDragPreview = {
|
|
502
|
-
Root: CardStackDragPreviewRoot,
|
|
503
|
-
Heading: CardStackDragPreviewHeading,
|
|
504
|
-
Content: CardStackDragPreviewContent,
|
|
505
|
-
Footer: CardStackDragPreviewFooter
|
|
506
|
-
};
|
|
507
|
-
|
|
508
312
|
// src/components/StackItem/StackItem.tsx
|
|
509
313
|
import { combine as combine2 } from "@atlaskit/pragmatic-drag-and-drop/combine";
|
|
510
314
|
import { draggable, dropTargetForElements as dropTargetForElements2 } from "@atlaskit/pragmatic-drag-and-drop/element/adapter";
|
|
@@ -513,37 +317,33 @@ import { setCustomNativeDragPreview } from "@atlaskit/pragmatic-drag-and-drop/el
|
|
|
513
317
|
import { attachClosestEdge as attachClosestEdge2, extractClosestEdge as extractClosestEdge2 } from "@atlaskit/pragmatic-drag-and-drop-hitbox/closest-edge";
|
|
514
318
|
import { useFocusableGroup } from "@fluentui/react-tabster";
|
|
515
319
|
import { composeRefs as composeRefs2 } from "@radix-ui/react-compose-refs";
|
|
516
|
-
import
|
|
320
|
+
import React8, { forwardRef as forwardRef5, useCallback as useCallback2, useLayoutEffect as useLayoutEffect2, useMemo as useMemo3, useState as useState4 } from "react";
|
|
517
321
|
import { createPortal } from "react-dom";
|
|
518
322
|
import { ListItem as ListItem2 } from "@dxos/react-ui";
|
|
519
323
|
import { resizeAttributes, sizeStyle } from "@dxos/react-ui-dnd";
|
|
520
|
-
import { mx as
|
|
324
|
+
import { mx as mx5 } from "@dxos/ui-theme";
|
|
521
325
|
|
|
522
326
|
// src/components/StackItem/StackItemContent.tsx
|
|
523
|
-
import
|
|
524
|
-
import { mx as
|
|
525
|
-
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) => {
|
|
526
330
|
const { size: stackItemSize } = useStack();
|
|
527
331
|
const { role } = useStackItem();
|
|
528
332
|
const style = useMemo2(() => ({
|
|
529
333
|
gridTemplateRows: [
|
|
530
|
-
|
|
531
|
-
role === "section" ? "calc(var(--toolbar-size) - 1px)" : "var(--toolbar-size)"
|
|
532
|
-
] : [],
|
|
334
|
+
toolbar && role === "section" ? "calc(var(--dx-toolbar-size) - 1px)" : "var(--dx-toolbar-size)",
|
|
533
335
|
"1fr",
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
] : []
|
|
537
|
-
].join(" ")
|
|
336
|
+
statusbar && "var(--dx-statusbar-size)"
|
|
337
|
+
].filter(Boolean).join(" ")
|
|
538
338
|
}), [
|
|
539
339
|
toolbar,
|
|
540
340
|
statusbar
|
|
541
341
|
]);
|
|
542
|
-
return /* @__PURE__ */
|
|
342
|
+
return /* @__PURE__ */ React2.createElement("div", {
|
|
543
343
|
...props,
|
|
544
344
|
role: "none",
|
|
545
345
|
style,
|
|
546
|
-
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),
|
|
547
347
|
"data-popover-collision-boundary": true,
|
|
548
348
|
ref: forwardedRef
|
|
549
349
|
}, children);
|
|
@@ -551,56 +351,58 @@ var StackItemContent = /* @__PURE__ */ forwardRef3(({ classNames, children, tool
|
|
|
551
351
|
StackItemContent.displayName = "StackItemContent";
|
|
552
352
|
|
|
553
353
|
// src/components/StackItem/StackItemDragHandle.tsx
|
|
554
|
-
import {
|
|
555
|
-
import
|
|
354
|
+
import { Primitive } from "@radix-ui/react-primitive";
|
|
355
|
+
import { Slot } from "@radix-ui/react-slot";
|
|
356
|
+
import React3 from "react";
|
|
556
357
|
var StackItemDragHandle = ({ asChild, children }) => {
|
|
557
358
|
const { selfDragHandleRef } = useStackItem();
|
|
558
|
-
const
|
|
559
|
-
return /* @__PURE__ */
|
|
359
|
+
const Comp = asChild ? Slot : Primitive.div;
|
|
360
|
+
return /* @__PURE__ */ React3.createElement(Comp, {
|
|
560
361
|
ref: selfDragHandleRef,
|
|
561
362
|
role: "button"
|
|
562
363
|
}, children);
|
|
563
364
|
};
|
|
564
365
|
|
|
565
366
|
// src/components/StackItem/StackItemHeading.tsx
|
|
566
|
-
import {
|
|
567
|
-
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";
|
|
568
370
|
import { useAttention } from "@dxos/react-ui-attention";
|
|
569
|
-
import { mx as
|
|
570
|
-
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 }) => {
|
|
571
373
|
const { orientation } = useStack();
|
|
572
|
-
const
|
|
573
|
-
return /* @__PURE__ */
|
|
574
|
-
role: "heading",
|
|
374
|
+
const Comp = asChild ? Slot2 : Primitive2.div;
|
|
375
|
+
return /* @__PURE__ */ React4.createElement(Comp, {
|
|
575
376
|
...props,
|
|
576
|
-
|
|
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)
|
|
577
379
|
}, children);
|
|
578
380
|
};
|
|
579
381
|
var StackItemHeadingStickyContent = ({ children }) => {
|
|
580
|
-
return /* @__PURE__ */
|
|
382
|
+
return /* @__PURE__ */ React4.createElement("div", {
|
|
581
383
|
role: "none",
|
|
582
|
-
className: "sticky
|
|
384
|
+
className: "sticky top-0 bg-(--sticky-bg) p-1 w-full"
|
|
583
385
|
}, children);
|
|
584
386
|
};
|
|
585
|
-
var StackItemHeadingLabel = /* @__PURE__ */
|
|
387
|
+
var StackItemHeadingLabel = /* @__PURE__ */ forwardRef3(({ attendableId, related, classNames, ...props }, forwardedRef) => {
|
|
586
388
|
const { hasAttention, isAncestor, isRelated } = useAttention(attendableId);
|
|
587
|
-
return /* @__PURE__ */
|
|
389
|
+
return /* @__PURE__ */ React4.createElement("h1", {
|
|
588
390
|
...props,
|
|
589
391
|
"data-attention": (related && isRelated || hasAttention || isAncestor).toString(),
|
|
590
|
-
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),
|
|
591
393
|
ref: forwardedRef
|
|
592
394
|
});
|
|
593
395
|
});
|
|
594
396
|
|
|
595
397
|
// src/components/StackItem/StackItemResizeHandle.tsx
|
|
596
|
-
import
|
|
398
|
+
import React5 from "react";
|
|
597
399
|
import { ResizeHandle } from "@dxos/react-ui-dnd";
|
|
598
400
|
var MIN_WIDTH = 20;
|
|
599
401
|
var MIN_HEIGHT = 3;
|
|
600
|
-
var StackItemResizeHandle = () => {
|
|
402
|
+
var StackItemResizeHandle = (_) => {
|
|
601
403
|
const { orientation } = useStack();
|
|
602
404
|
const { setSize, size } = useStackItem();
|
|
603
|
-
return /* @__PURE__ */
|
|
405
|
+
return /* @__PURE__ */ React5.createElement(ResizeHandle, {
|
|
604
406
|
side: orientation === "horizontal" ? "inline-end" : "block-end",
|
|
605
407
|
fallbackSize: DEFAULT_EXTRINSIC_SIZE,
|
|
606
408
|
minSize: orientation === "horizontal" ? MIN_WIDTH : MIN_HEIGHT,
|
|
@@ -610,23 +412,42 @@ var StackItemResizeHandle = () => {
|
|
|
610
412
|
};
|
|
611
413
|
|
|
612
414
|
// src/components/StackItem/StackItemSigil.tsx
|
|
613
|
-
import
|
|
415
|
+
import React7, { Fragment, forwardRef as forwardRef4, useState as useState3 } from "react";
|
|
614
416
|
import { keySymbols } from "@dxos/keyboard";
|
|
615
|
-
import { Button, DropdownMenu, Icon, toLocalizedString, useTranslation
|
|
417
|
+
import { Button, DropdownMenu, Icon, toLocalizedString, useTranslation } from "@dxos/react-ui";
|
|
616
418
|
import { useAttention as useAttention2 } from "@dxos/react-ui-attention";
|
|
617
|
-
import {
|
|
419
|
+
import { mx as mx4 } from "@dxos/ui-theme";
|
|
618
420
|
import { getHostPlatform } from "@dxos/util";
|
|
619
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
|
+
|
|
620
441
|
// src/components/StackItem/MenuSignifier.tsx
|
|
621
|
-
import
|
|
622
|
-
var MenuSignifierHorizontal = () => /* @__PURE__ */
|
|
623
|
-
className: "absolute
|
|
442
|
+
import React6 from "react";
|
|
443
|
+
var MenuSignifierHorizontal = () => /* @__PURE__ */ React6.createElement("svg", {
|
|
444
|
+
className: "absolute bottom-[7px]",
|
|
624
445
|
width: 20,
|
|
625
446
|
height: 2,
|
|
626
447
|
viewBox: "0 0 20 2",
|
|
627
448
|
stroke: "currentColor",
|
|
628
449
|
opacity: 0.5
|
|
629
|
-
}, /* @__PURE__ */
|
|
450
|
+
}, /* @__PURE__ */ React6.createElement("line", {
|
|
630
451
|
x1: 0.5,
|
|
631
452
|
y1: 0.75,
|
|
632
453
|
x2: 19,
|
|
@@ -638,56 +459,56 @@ var MenuSignifierHorizontal = () => /* @__PURE__ */ React8.createElement("svg",
|
|
|
638
459
|
}));
|
|
639
460
|
|
|
640
461
|
// src/components/StackItem/StackItemSigil.tsx
|
|
641
|
-
var StackItemSigilButton = /* @__PURE__ */
|
|
462
|
+
var StackItemSigilButton = /* @__PURE__ */ forwardRef4(({ attendableId, classNames, related, isMenu = true, children, ...props }, forwardedRef) => {
|
|
642
463
|
const { hasAttention, isAncestor, isRelated } = useAttention2(attendableId);
|
|
643
464
|
const variant = related && isRelated || hasAttention || isAncestor ? "primary" : "ghost";
|
|
644
|
-
return /* @__PURE__ */
|
|
465
|
+
return /* @__PURE__ */ React7.createElement(Button, {
|
|
645
466
|
...props,
|
|
646
467
|
variant,
|
|
647
468
|
classNames: [
|
|
648
|
-
"shrink-0
|
|
469
|
+
"shrink-0 px-0 min-h-0 w-(--dx-rail-action) h-(--dx-rail-action) relative dx-app-no-drag",
|
|
649
470
|
classNames
|
|
650
471
|
],
|
|
651
472
|
ref: forwardedRef
|
|
652
|
-
}, isMenu && /* @__PURE__ */
|
|
473
|
+
}, isMenu && /* @__PURE__ */ React7.createElement(MenuSignifierHorizontal, null), children);
|
|
653
474
|
});
|
|
654
|
-
var StackItemSigil = /* @__PURE__ */
|
|
655
|
-
const { t } =
|
|
475
|
+
var StackItemSigil = /* @__PURE__ */ forwardRef4(({ actions: actionGroups, onAction, triggerLabel, attendableId, icon, related, children }, forwardedRef) => {
|
|
476
|
+
const { t } = useTranslation(translationKey);
|
|
656
477
|
const [optionsMenuOpen, setOptionsMenuOpen] = useState3(false);
|
|
657
478
|
const hasActions = actionGroups && actionGroups.length > 0;
|
|
658
|
-
const button = /* @__PURE__ */
|
|
479
|
+
const button = /* @__PURE__ */ React7.createElement(StackItemSigilButton, {
|
|
659
480
|
attendableId,
|
|
660
481
|
related,
|
|
661
482
|
isMenu: hasActions,
|
|
662
483
|
// TODO(wittjosiah): Better disabling of interactive styles when no action are available.
|
|
663
484
|
// Remove underscore icon when no actions are available?
|
|
664
485
|
classNames: !hasActions && "cursor-default"
|
|
665
|
-
}, /* @__PURE__ */
|
|
486
|
+
}, /* @__PURE__ */ React7.createElement("span", {
|
|
666
487
|
className: "sr-only"
|
|
667
|
-
}, triggerLabel), /* @__PURE__ */
|
|
488
|
+
}, triggerLabel), /* @__PURE__ */ React7.createElement(Icon, {
|
|
668
489
|
icon,
|
|
669
490
|
size: 5
|
|
670
491
|
}));
|
|
671
492
|
if (!hasActions) {
|
|
672
493
|
return button;
|
|
673
494
|
}
|
|
674
|
-
return /* @__PURE__ */
|
|
495
|
+
return /* @__PURE__ */ React7.createElement(DropdownMenu.Root, {
|
|
675
496
|
open: optionsMenuOpen,
|
|
676
497
|
onOpenChange: setOptionsMenuOpen
|
|
677
|
-
}, /* @__PURE__ */
|
|
498
|
+
}, /* @__PURE__ */ React7.createElement(DropdownMenu.Trigger, {
|
|
678
499
|
asChild: true,
|
|
679
500
|
ref: forwardedRef
|
|
680
|
-
}, button), /* @__PURE__ */
|
|
501
|
+
}, button), /* @__PURE__ */ React7.createElement(DropdownMenu.Portal, null, /* @__PURE__ */ React7.createElement(DropdownMenu.Content, {
|
|
681
502
|
classNames: "z-[31]"
|
|
682
|
-
}, /* @__PURE__ */
|
|
683
|
-
const separator = index > 0 ? /* @__PURE__ */
|
|
684
|
-
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, {
|
|
685
506
|
key: index
|
|
686
507
|
}, separator, actions.map((action) => {
|
|
687
508
|
const shortcut = typeof action.properties.keyBinding === "string" ? action.properties.keyBinding : action.properties.keyBinding?.[getHostPlatform()];
|
|
688
509
|
const menuItemType = action.properties.menuItemType;
|
|
689
510
|
const Root = menuItemType === "toggle" ? DropdownMenu.CheckboxItem : DropdownMenu.Item;
|
|
690
|
-
return /* @__PURE__ */
|
|
511
|
+
return /* @__PURE__ */ React7.createElement(Root, {
|
|
691
512
|
key: action.id,
|
|
692
513
|
onClick: (event) => {
|
|
693
514
|
if (action.properties.disabled) {
|
|
@@ -703,28 +524,28 @@ var StackItemSigil = /* @__PURE__ */ forwardRef5(({ actions: actionGroups, onAct
|
|
|
703
524
|
...action.properties?.testId && {
|
|
704
525
|
"data-testid": action.properties.testId
|
|
705
526
|
}
|
|
706
|
-
}, /* @__PURE__ */
|
|
527
|
+
}, /* @__PURE__ */ React7.createElement(Icon, {
|
|
707
528
|
icon: action.properties.icon ?? "ph--placeholder--regular",
|
|
708
529
|
size: 4
|
|
709
|
-
}), /* @__PURE__ */
|
|
530
|
+
}), /* @__PURE__ */ React7.createElement("span", {
|
|
710
531
|
className: "grow truncate"
|
|
711
|
-
}, toLocalizedString(action.properties.label ?? "", t)), menuItemType === "toggle" && /* @__PURE__ */
|
|
532
|
+
}, toLocalizedString(action.properties.label ?? "", t)), menuItemType === "toggle" && /* @__PURE__ */ React7.createElement(DropdownMenu.ItemIndicator, {
|
|
712
533
|
asChild: true
|
|
713
|
-
}, /* @__PURE__ */
|
|
534
|
+
}, /* @__PURE__ */ React7.createElement(Icon, {
|
|
714
535
|
icon: "ph--check--regular",
|
|
715
536
|
size: 4
|
|
716
|
-
})), shortcut && /* @__PURE__ */
|
|
717
|
-
className:
|
|
537
|
+
})), shortcut && /* @__PURE__ */ React7.createElement("span", {
|
|
538
|
+
className: mx4("shrink-0", "text-description")
|
|
718
539
|
}, keySymbols(shortcut).join("")));
|
|
719
540
|
}));
|
|
720
|
-
}), children), /* @__PURE__ */
|
|
541
|
+
}), children), /* @__PURE__ */ React7.createElement(DropdownMenu.Arrow, null))));
|
|
721
542
|
});
|
|
722
543
|
|
|
723
544
|
// src/components/StackItem/StackItem.tsx
|
|
724
545
|
var DEFAULT_HORIZONTAL_SIZE = 48;
|
|
725
546
|
var DEFAULT_VERTICAL_SIZE = "min-content";
|
|
726
547
|
var DEFAULT_EXTRINSIC_SIZE = DEFAULT_HORIZONTAL_SIZE;
|
|
727
|
-
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) => {
|
|
728
549
|
const [itemElement, itemRef] = useState4(null);
|
|
729
550
|
const composedItemRef = composeRefs2(itemRef, forwardedRef);
|
|
730
551
|
const [selfDragHandleElement, selfDragHandleRef] = useState4(null);
|
|
@@ -878,13 +699,13 @@ var StackItemRoot = /* @__PURE__ */ forwardRef6(({ item, children, classNames, s
|
|
|
878
699
|
setDragState,
|
|
879
700
|
role
|
|
880
701
|
]);
|
|
881
|
-
return /* @__PURE__ */
|
|
702
|
+
return /* @__PURE__ */ React8.createElement(StackItemContext.Provider, {
|
|
882
703
|
value: stackItemContextValue
|
|
883
|
-
}, /* @__PURE__ */
|
|
704
|
+
}, /* @__PURE__ */ React8.createElement(Root, {
|
|
884
705
|
...props,
|
|
885
706
|
tabIndex: 0,
|
|
886
707
|
...focusableGroupAttrs,
|
|
887
|
-
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),
|
|
888
709
|
"data-dx-stack-item": stackId,
|
|
889
710
|
"data-dx-item-id": item.id,
|
|
890
711
|
...resizeAttributes,
|
|
@@ -896,7 +717,7 @@ var StackItemRoot = /* @__PURE__ */ forwardRef6(({ item, children, classNames, s
|
|
|
896
717
|
...style
|
|
897
718
|
},
|
|
898
719
|
ref: composedItemRef
|
|
899
|
-
}, children, shouldShowDropIndicator() && closestEdge && /* @__PURE__ */
|
|
720
|
+
}, children, shouldShowDropIndicator() && closestEdge && /* @__PURE__ */ React8.createElement(ListItem2.DropIndicator, {
|
|
900
721
|
lineInset: 8,
|
|
901
722
|
terminalInset: -8,
|
|
902
723
|
edge: closestEdge
|
|
@@ -921,8 +742,6 @@ var StackItem = {
|
|
|
921
742
|
SigilButton: StackItemSigilButton
|
|
922
743
|
};
|
|
923
744
|
export {
|
|
924
|
-
CardStack,
|
|
925
|
-
CardStackDragPreview,
|
|
926
745
|
DEFAULT_EXTRINSIC_SIZE,
|
|
927
746
|
DEFAULT_HORIZONTAL_SIZE,
|
|
928
747
|
DEFAULT_VERTICAL_SIZE,
|
|
@@ -930,12 +749,6 @@ export {
|
|
|
930
749
|
StackContext,
|
|
931
750
|
StackItem,
|
|
932
751
|
autoScrollRootAttributes,
|
|
933
|
-
cardStackContent,
|
|
934
|
-
cardStackDefaultInlineSizeRem,
|
|
935
|
-
cardStackFooter,
|
|
936
|
-
cardStackHeading,
|
|
937
|
-
cardStackItem,
|
|
938
|
-
cardStackRoot,
|
|
939
752
|
railGridHorizontal,
|
|
940
753
|
railGridHorizontalContainFitContent,
|
|
941
754
|
railGridVertical,
|