@dxos/react-ui-stack 0.8.3-main.672df60 → 0.8.3-staging.0fa589b
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 +81 -30
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/node/index.cjs +85 -27
- package/dist/lib/node/index.cjs.map +3 -3
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node-esm/index.mjs +81 -30
- package/dist/lib/node-esm/index.mjs.map +3 -3
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/types/src/components/StackContext.d.ts +1 -0
- package/dist/types/src/components/StackContext.d.ts.map +1 -1
- package/dist/types/src/components/StackItem/StackItem.d.ts +3 -1
- package/dist/types/src/components/StackItem/StackItem.d.ts.map +1 -1
- package/dist/types/src/components/StackItem/StackItemContent.d.ts +8 -0
- package/dist/types/src/components/StackItem/StackItemContent.d.ts.map +1 -1
- package/dist/types/src/components/StackItem/StackItemHeading.d.ts +4 -2
- package/dist/types/src/components/StackItem/StackItemHeading.d.ts.map +1 -1
- package/dist/types/src/exemplars/Card/Card.d.ts +6 -2
- package/dist/types/src/exemplars/Card/Card.d.ts.map +1 -1
- package/dist/types/src/exemplars/Card/fragments.d.ts +9 -2
- package/dist/types/src/exemplars/Card/fragments.d.ts.map +1 -1
- package/dist/types/src/exemplars/Card/index.d.ts +1 -0
- package/dist/types/src/exemplars/Card/index.d.ts.map +1 -1
- package/dist/types/src/exemplars/CardStack/CardStack.d.ts.map +1 -1
- package/package.json +19 -20
- package/src/components/StackContext.tsx +1 -0
- package/src/components/StackItem/StackItem.stories.tsx +1 -1
- package/src/components/StackItem/StackItem.tsx +10 -1
- package/src/components/StackItem/StackItemContent.tsx +27 -11
- package/src/components/StackItem/StackItemHeading.tsx +29 -4
- package/src/exemplars/Card/Card.tsx +10 -6
- package/src/exemplars/Card/fragments.ts +13 -2
- package/src/exemplars/Card/index.ts +1 -0
- package/src/exemplars/CardStack/CardStack.tsx +1 -0
|
@@ -207,7 +207,7 @@ import { setCustomNativeDragPreview } from "@atlaskit/pragmatic-drag-and-drop/el
|
|
|
207
207
|
import { attachClosestEdge as attachClosestEdge2, extractClosestEdge as extractClosestEdge2 } from "@atlaskit/pragmatic-drag-and-drop-hitbox/closest-edge";
|
|
208
208
|
import { useFocusableGroup as useFocusableGroup2 } from "@fluentui/react-tabster";
|
|
209
209
|
import { composeRefs as composeRefs2 } from "@radix-ui/react-compose-refs";
|
|
210
|
-
import React8, { forwardRef as forwardRef5, useLayoutEffect as useLayoutEffect2, useState as useState4, useCallback as useCallback2 } from "react";
|
|
210
|
+
import React8, { forwardRef as forwardRef5, useLayoutEffect as useLayoutEffect2, useState as useState4, useCallback as useCallback2, useMemo as useMemo3 } from "react";
|
|
211
211
|
import { createPortal } from "react-dom";
|
|
212
212
|
import { ListItem as ListItem2 } from "@dxos/react-ui";
|
|
213
213
|
import { resizeAttributes, sizeStyle } from "@dxos/react-ui-dnd";
|
|
@@ -215,27 +215,33 @@ import { mx as mx5 } from "@dxos/react-ui-theme";
|
|
|
215
215
|
|
|
216
216
|
// packages/ui/react-ui-stack/src/components/StackItem/StackItemContent.tsx
|
|
217
217
|
import { useSignals as _useSignals2 } from "@preact-signals/safe-react/tracking";
|
|
218
|
-
import React2, { forwardRef as forwardRef2 } from "react";
|
|
218
|
+
import React2, { forwardRef as forwardRef2, useMemo as useMemo2 } from "react";
|
|
219
219
|
import { mx as mx2 } from "@dxos/react-ui-theme";
|
|
220
|
-
var StackItemContent = /* @__PURE__ */ forwardRef2(({ children, toolbar, statusbar, classNames, size = "intrinsic", ...props }, forwardedRef) => {
|
|
220
|
+
var StackItemContent = /* @__PURE__ */ forwardRef2(({ children, toolbar, statusbar, layoutManaged, classNames, size = "intrinsic", ...props }, forwardedRef) => {
|
|
221
221
|
var _effect = _useSignals2();
|
|
222
222
|
try {
|
|
223
223
|
const { size: stackItemSize } = useStack();
|
|
224
|
+
const { role } = useStackItem();
|
|
225
|
+
const style = useMemo2(() => layoutManaged ? {} : {
|
|
226
|
+
gridTemplateRows: [
|
|
227
|
+
...toolbar ? [
|
|
228
|
+
role === "section" ? "calc(var(--toolbar-size) - 1px)" : "var(--toolbar-size)"
|
|
229
|
+
] : [],
|
|
230
|
+
"1fr",
|
|
231
|
+
...statusbar ? [
|
|
232
|
+
"var(--statusbar-size)"
|
|
233
|
+
] : []
|
|
234
|
+
].join(" ")
|
|
235
|
+
}, [
|
|
236
|
+
toolbar,
|
|
237
|
+
statusbar,
|
|
238
|
+
layoutManaged
|
|
239
|
+
]);
|
|
224
240
|
return /* @__PURE__ */ React2.createElement("div", {
|
|
225
241
|
role: "none",
|
|
226
242
|
...props,
|
|
227
|
-
className: mx2("group grid grid-cols-[100%]", stackItemSize === "contain" && "min-bs-0 overflow-hidden", size === "video" ? "aspect-video" : size === "square" && "aspect-square", classNames),
|
|
228
|
-
style
|
|
229
|
-
gridTemplateRows: [
|
|
230
|
-
...toolbar ? [
|
|
231
|
-
"var(--rail-action)"
|
|
232
|
-
] : [],
|
|
233
|
-
"1fr",
|
|
234
|
-
...statusbar ? [
|
|
235
|
-
"var(--statusbar-size)"
|
|
236
|
-
] : []
|
|
237
|
-
].join(" ")
|
|
238
|
-
},
|
|
243
|
+
className: mx2("group grid grid-cols-[100%]", stackItemSize === "contain" && "min-bs-0 overflow-hidden", size === "video" ? "aspect-video" : size === "square" && "aspect-square", toolbar && "[&_.dx-toolbar]:relative [&_.dx-toolbar]:border-be [&_.dx-toolbar]:border-subduedSeparator", role === "section" && toolbar && "[&_.dx-toolbar]:sticky [&_.dx-toolbar]:z-[1] [&_.dx-toolbar]:block-start-0 [&_.dx-toolbar]:-mbe-px [&_.dx-toolbar]:min-is-0", classNames),
|
|
244
|
+
style,
|
|
239
245
|
"data-popover-collision-boundary": true,
|
|
240
246
|
ref: forwardedRef
|
|
241
247
|
}, children);
|
|
@@ -269,7 +275,7 @@ import { Slot as Slot2 } from "@radix-ui/react-slot";
|
|
|
269
275
|
import React4, { forwardRef as forwardRef3 } from "react";
|
|
270
276
|
import { useAttention } from "@dxos/react-ui-attention";
|
|
271
277
|
import { mx as mx3 } from "@dxos/react-ui-theme";
|
|
272
|
-
var StackItemHeading = ({ children, classNames, asChild, ...props }) => {
|
|
278
|
+
var StackItemHeading = ({ children, classNames, asChild, separateOnScroll, ...props }) => {
|
|
273
279
|
var _effect = _useSignals4();
|
|
274
280
|
try {
|
|
275
281
|
const { orientation } = useStack();
|
|
@@ -282,7 +288,18 @@ var StackItemHeading = ({ children, classNames, asChild, ...props }) => {
|
|
|
282
288
|
...props,
|
|
283
289
|
tabIndex: 0,
|
|
284
290
|
...focusableGroupAttrs,
|
|
285
|
-
className: mx3(
|
|
291
|
+
className: mx3("flex items-center dx-focus-ring-inset-over-all relative !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)
|
|
292
|
+
}, children);
|
|
293
|
+
} finally {
|
|
294
|
+
_effect.f();
|
|
295
|
+
}
|
|
296
|
+
};
|
|
297
|
+
var StackItemHeadingStickyContent = ({ children }) => {
|
|
298
|
+
var _effect = _useSignals4();
|
|
299
|
+
try {
|
|
300
|
+
return /* @__PURE__ */ React4.createElement("div", {
|
|
301
|
+
role: "none",
|
|
302
|
+
className: "sticky block-start-0 bg-[--sticky-bg] p-1 is-full"
|
|
286
303
|
}, children);
|
|
287
304
|
} finally {
|
|
288
305
|
_effect.f();
|
|
@@ -620,19 +637,28 @@ var StackItemRoot = /* @__PURE__ */ forwardRef5(({ item, children, classNames, s
|
|
|
620
637
|
}
|
|
621
638
|
return true;
|
|
622
639
|
};
|
|
640
|
+
const stackItemContextValue = useMemo3(() => ({
|
|
641
|
+
selfDragHandleRef,
|
|
642
|
+
size,
|
|
643
|
+
setSize,
|
|
644
|
+
state: dragState,
|
|
645
|
+
setState: setDragState,
|
|
646
|
+
role
|
|
647
|
+
}), [
|
|
648
|
+
selfDragHandleRef,
|
|
649
|
+
size,
|
|
650
|
+
setSize,
|
|
651
|
+
dragState,
|
|
652
|
+
setDragState,
|
|
653
|
+
role
|
|
654
|
+
]);
|
|
623
655
|
return /* @__PURE__ */ React8.createElement(StackItemContext.Provider, {
|
|
624
|
-
value:
|
|
625
|
-
selfDragHandleRef,
|
|
626
|
-
size,
|
|
627
|
-
setSize,
|
|
628
|
-
state: dragState,
|
|
629
|
-
setState: setDragState
|
|
630
|
-
}
|
|
656
|
+
value: stackItemContextValue
|
|
631
657
|
}, /* @__PURE__ */ React8.createElement(Root, {
|
|
632
658
|
...props,
|
|
633
659
|
tabIndex: 0,
|
|
634
660
|
...focusableGroupAttrs,
|
|
635
|
-
className: mx5("group/stack-item grid relative", focusIndicatorVariant === "over-all" ? "dx-focus-ring-inset-over-all" : orientation === "horizontal" ? "dx-focus-ring-group-x" : "dx-focus-ring-group-y", orientation === "horizontal" ? "grid-rows-subgrid" : "grid-cols-subgrid", rail && (orientation === "horizontal" ? "row-span-2" : "col-span-2"), classNames),
|
|
661
|
+
className: mx5("group/stack-item grid relative", focusIndicatorVariant === "over-all" ? "dx-focus-ring-inset-over-all" : orientation === "horizontal" ? "dx-focus-ring-group-x" : "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),
|
|
636
662
|
"data-dx-stack-item": true,
|
|
637
663
|
...resizeAttributes,
|
|
638
664
|
style: {
|
|
@@ -663,6 +689,7 @@ var StackItem = {
|
|
|
663
689
|
Content: StackItemContent,
|
|
664
690
|
Heading: StackItemHeading,
|
|
665
691
|
HeadingLabel: StackItemHeadingLabel,
|
|
692
|
+
HeadingStickyContent: StackItemHeadingStickyContent,
|
|
666
693
|
ResizeHandle: StackItemResizeHandle,
|
|
667
694
|
DragHandle: StackItemDragHandle,
|
|
668
695
|
Sigil: StackItemSigil,
|
|
@@ -676,14 +703,21 @@ import { Primitive } from "@radix-ui/react-primitive";
|
|
|
676
703
|
import { Slot as Slot3 } from "@radix-ui/react-slot";
|
|
677
704
|
import React9, { forwardRef as forwardRef6 } from "react";
|
|
678
705
|
import { Icon as Icon2, IconButton, Toolbar, useTranslation as useTranslation2 } from "@dxos/react-ui";
|
|
679
|
-
import { mx as mx6 } from "@dxos/react-ui-theme";
|
|
706
|
+
import { hoverableControls, mx as mx6 } from "@dxos/react-ui-theme";
|
|
680
707
|
|
|
681
708
|
// packages/ui/react-ui-stack/src/exemplars/Card/fragments.ts
|
|
682
709
|
var cardRoot = "contain-layout pli-2 plb-1 first-of-type:pbs-0 last-of-type:pbe-0";
|
|
683
710
|
var cardContent = "rounded overflow-hidden bg-cardSurface border border-separator dark:border-subduedSeparator dx-focus-ring-group-y-indicator relative min-bs-[--rail-item] group/card";
|
|
684
|
-
var
|
|
711
|
+
var cardSpacing = "pli-cardSpacingInline mlb-cardSpacingBlock";
|
|
712
|
+
var labelSpacing = "mbs-inputSpacingBlock mbe-labelSpacingBlock";
|
|
713
|
+
var cardDialogContent = "p-0 bs-content min-bs-[8rem] max-bs-full md:max-is-[32rem] overflow-hidden";
|
|
714
|
+
var cardDialogHeader = "pli-cardSpacingInline mbs-cardSpacingBlock flex justify-between";
|
|
715
|
+
var cardDialogOverflow = "overflow-y-auto min-bs-0 flex-1";
|
|
716
|
+
var cardDialogPaddedOverflow = `${cardDialogOverflow} plb-cardSpacingBlock`;
|
|
717
|
+
var cardDialogSearchListRoot = "pli-cardSpacingInline pbs-cardSpacingBlock [&>input]:mbe-0 min-bs-0 flex-1 flex flex-col";
|
|
718
|
+
var cardText = cardSpacing;
|
|
685
719
|
var cardHeading = "text-lg font-medium line-clamp-2";
|
|
686
|
-
var cardChrome = "pli-
|
|
720
|
+
var cardChrome = "pli-[--dx-cardSpacingChrome] mlb-[--dx-cardSpacingChrome] [&_.dx-button]:text-start [&_.dx-button]:is-full";
|
|
687
721
|
|
|
688
722
|
// packages/ui/react-ui-stack/src/exemplars/Card/Card.tsx
|
|
689
723
|
var CardRoot = /* @__PURE__ */ forwardRef6(({ children, classNames, asChild, role = "none", ...props }, forwardedRef) => {
|
|
@@ -741,7 +775,12 @@ var CardConditionalContent = ({ role, children }) => {
|
|
|
741
775
|
className: role === "popover" ? "popover-card-width" : role === "card--kanban" ? "contents" : ""
|
|
742
776
|
}, children);
|
|
743
777
|
} else {
|
|
744
|
-
return /* @__PURE__ */ React9.createElement(CardContent,
|
|
778
|
+
return /* @__PURE__ */ React9.createElement(CardContent, role === "card--document" && {
|
|
779
|
+
classNames: [
|
|
780
|
+
"mlb-[1em]",
|
|
781
|
+
hoverableControls
|
|
782
|
+
]
|
|
783
|
+
}, children);
|
|
745
784
|
}
|
|
746
785
|
} finally {
|
|
747
786
|
_effect.f();
|
|
@@ -770,11 +809,15 @@ var CardHeading = /* @__PURE__ */ forwardRef6(({ children, classNames, asChild,
|
|
|
770
809
|
_effect.f();
|
|
771
810
|
}
|
|
772
811
|
});
|
|
773
|
-
var CardToolbar = /* @__PURE__ */ forwardRef6(({ children, ...props }, forwardedRef) => {
|
|
812
|
+
var CardToolbar = /* @__PURE__ */ forwardRef6(({ children, classNames, ...props }, forwardedRef) => {
|
|
774
813
|
var _effect = _useSignals9();
|
|
775
814
|
try {
|
|
776
815
|
return /* @__PURE__ */ React9.createElement(Toolbar.Root, {
|
|
777
816
|
...props,
|
|
817
|
+
classNames: [
|
|
818
|
+
"bg-transparent",
|
|
819
|
+
classNames
|
|
820
|
+
],
|
|
778
821
|
ref: forwardedRef
|
|
779
822
|
}, children);
|
|
780
823
|
} finally {
|
|
@@ -938,6 +981,7 @@ var CardStackStack = /* @__PURE__ */ forwardRef7(({ children, classNames, itemsC
|
|
|
938
981
|
),
|
|
939
982
|
itemsCount,
|
|
940
983
|
separatorOnScroll: 9,
|
|
984
|
+
"data-density": "fine",
|
|
941
985
|
...props,
|
|
942
986
|
ref: forwardedRef
|
|
943
987
|
}, children);
|
|
@@ -1126,13 +1170,20 @@ export {
|
|
|
1126
1170
|
autoScrollRootAttributes,
|
|
1127
1171
|
cardChrome,
|
|
1128
1172
|
cardContent,
|
|
1173
|
+
cardDialogContent,
|
|
1174
|
+
cardDialogHeader,
|
|
1175
|
+
cardDialogOverflow,
|
|
1176
|
+
cardDialogPaddedOverflow,
|
|
1177
|
+
cardDialogSearchListRoot,
|
|
1129
1178
|
cardHeading,
|
|
1130
1179
|
cardRoot,
|
|
1180
|
+
cardSpacing,
|
|
1131
1181
|
cardStackContent,
|
|
1132
1182
|
cardStackFooter,
|
|
1133
1183
|
cardStackHeading,
|
|
1134
1184
|
cardStackRoot,
|
|
1135
1185
|
cardText,
|
|
1186
|
+
labelSpacing,
|
|
1136
1187
|
railGridHorizontal,
|
|
1137
1188
|
railGridHorizontalContainFitContent,
|
|
1138
1189
|
railGridVertical,
|