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