@refineui/react 0.1.0 → 0.1.2
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/authoring-manifest.cjs +1 -1
- package/dist/authoring-manifest.cjs.map +1 -1
- package/dist/authoring-manifest.js +1 -1
- package/dist/authoring-manifest.js.map +1 -1
- package/dist/index.cjs +633 -581
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +0 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.js +451 -399
- package/dist/index.js.map +1 -1
- package/dist/spec/authoring/manifest.json +1 -1
- package/dist/spec/contract-index.json +1 -1
- package/dist/spec/token-trace-v2.json +1 -1
- package/package.json +1 -1
- package/refineui.css +24 -16
- package/spec/authoring/manifest.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -209,7 +209,7 @@ __export(src_exports, {
|
|
|
209
209
|
ResizableHandle: () => ResizableHandle,
|
|
210
210
|
ResizablePanel: () => ResizablePanel,
|
|
211
211
|
ResizablePanelGroup: () => ResizablePanelGroup,
|
|
212
|
-
SEMANTIC_TEXT: () =>
|
|
212
|
+
SEMANTIC_TEXT: () => import_tokens40.SEMANTIC_TEXT,
|
|
213
213
|
ScrollArea: () => ScrollArea,
|
|
214
214
|
ScrollAreaScrollbar: () => ScrollAreaScrollbar,
|
|
215
215
|
ScrollAreaThumb: () => ScrollAreaThumb,
|
|
@@ -254,7 +254,7 @@ __export(src_exports, {
|
|
|
254
254
|
SidebarTrigger: () => SidebarTrigger,
|
|
255
255
|
Skeleton: () => Skeleton,
|
|
256
256
|
Slider: () => Slider,
|
|
257
|
-
Slot: () =>
|
|
257
|
+
Slot: () => import_react60.Slot,
|
|
258
258
|
Spacer: () => Spacer,
|
|
259
259
|
SpinButton: () => SpinButton,
|
|
260
260
|
Spinner: () => Spinner,
|
|
@@ -1114,7 +1114,7 @@ var componentTypographyTokens = {
|
|
|
1114
1114
|
shortcut: role("bodyXs")
|
|
1115
1115
|
},
|
|
1116
1116
|
dialog: {
|
|
1117
|
-
title: role("
|
|
1117
|
+
title: role("subtitleLg"),
|
|
1118
1118
|
description: role("bodyXs")
|
|
1119
1119
|
},
|
|
1120
1120
|
drawer: {
|
|
@@ -1261,7 +1261,6 @@ var componentTokens = {
|
|
|
1261
1261
|
color: componentColorTokens.toast,
|
|
1262
1262
|
typography: componentTypographyTokens.toast,
|
|
1263
1263
|
size: {
|
|
1264
|
-
minWidth: import_tokens.componentSizes.toastMinWidth,
|
|
1265
1264
|
maxWidth: import_tokens.componentSizes.toastMaxWidth
|
|
1266
1265
|
},
|
|
1267
1266
|
elevation: {
|
|
@@ -1387,7 +1386,7 @@ function buildSemanticTextClassMap(map) {
|
|
|
1387
1386
|
}
|
|
1388
1387
|
|
|
1389
1388
|
// src/index.ts
|
|
1390
|
-
var
|
|
1389
|
+
var import_tokens40 = require("@refineui/tokens");
|
|
1391
1390
|
|
|
1392
1391
|
// src/componentSizes.ts
|
|
1393
1392
|
var import_tokens3 = require("@refineui/tokens");
|
|
@@ -11484,10 +11483,208 @@ function Pagination(props) {
|
|
|
11484
11483
|
|
|
11485
11484
|
// src/components/PopOver/PopOver.tsx
|
|
11486
11485
|
var import_clsx85 = require("clsx");
|
|
11486
|
+
var import_react43 = require("react");
|
|
11487
|
+
var import_tokens27 = require("@refineui/tokens");
|
|
11488
|
+
var import_color11 = require("@refineui/utilities/color");
|
|
11489
|
+
var import_react44 = require("@refineui/utilities/react");
|
|
11490
|
+
|
|
11491
|
+
// src/components/shared/FloatingSurface.tsx
|
|
11487
11492
|
var import_react42 = require("react");
|
|
11488
11493
|
var import_tokens26 = require("@refineui/tokens");
|
|
11489
|
-
|
|
11490
|
-
|
|
11494
|
+
|
|
11495
|
+
// src/components/shared/floatingOutline.ts
|
|
11496
|
+
var PATH_PRECISION = 100;
|
|
11497
|
+
function fmt(n) {
|
|
11498
|
+
return String(Math.round(n * PATH_PRECISION) / PATH_PRECISION);
|
|
11499
|
+
}
|
|
11500
|
+
function pt(p) {
|
|
11501
|
+
return `${fmt(p.x)} ${fmt(p.y)}`;
|
|
11502
|
+
}
|
|
11503
|
+
function towards(from, to, distance) {
|
|
11504
|
+
const length = Math.hypot(to.x - from.x, to.y - from.y);
|
|
11505
|
+
if (length === 0) return from;
|
|
11506
|
+
const t = distance / length;
|
|
11507
|
+
return { x: from.x + (to.x - from.x) * t, y: from.y + (to.y - from.y) * t };
|
|
11508
|
+
}
|
|
11509
|
+
function floatingShapeSize(panelWidth, panelHeight, side, beakHeight) {
|
|
11510
|
+
const vertical = side === "top" || side === "bottom";
|
|
11511
|
+
return {
|
|
11512
|
+
width: vertical ? panelWidth : panelWidth + beakHeight,
|
|
11513
|
+
height: vertical ? panelHeight + beakHeight : panelHeight
|
|
11514
|
+
};
|
|
11515
|
+
}
|
|
11516
|
+
function resolveBeakCenter(edgeLength, align, beakWidth, radius2, insetStart, insetEnd) {
|
|
11517
|
+
const half = beakWidth / 2;
|
|
11518
|
+
const min = radius2 + half;
|
|
11519
|
+
const max = edgeLength - radius2 - half;
|
|
11520
|
+
if (max < min) return edgeLength / 2;
|
|
11521
|
+
const wanted = align === "center" ? edgeLength / 2 : align === "start" ? insetStart + half : edgeLength - insetEnd - half;
|
|
11522
|
+
return Math.min(max, Math.max(min, wanted));
|
|
11523
|
+
}
|
|
11524
|
+
function buildFloatingOutline({
|
|
11525
|
+
panelWidth,
|
|
11526
|
+
panelHeight,
|
|
11527
|
+
radius: radius2,
|
|
11528
|
+
side,
|
|
11529
|
+
beakCenter,
|
|
11530
|
+
beakWidth,
|
|
11531
|
+
beakHeight,
|
|
11532
|
+
tipRadius,
|
|
11533
|
+
inset = 0
|
|
11534
|
+
}) {
|
|
11535
|
+
const offsetX = side === "left" ? beakHeight : 0;
|
|
11536
|
+
const offsetY = side === "top" ? beakHeight : 0;
|
|
11537
|
+
const x0 = offsetX + inset;
|
|
11538
|
+
const y0 = offsetY + inset;
|
|
11539
|
+
const x1 = offsetX + panelWidth - inset;
|
|
11540
|
+
const y1 = offsetY + panelHeight - inset;
|
|
11541
|
+
const r = Math.max(0, Math.min(radius2 - inset, (x1 - x0) / 2, (y1 - y0) / 2));
|
|
11542
|
+
const half = beakWidth / 2;
|
|
11543
|
+
const sinHalfAngle = half / Math.hypot(half, beakHeight);
|
|
11544
|
+
const reach = beakHeight + inset - inset / sinHalfAngle;
|
|
11545
|
+
const spread = half * reach / beakHeight;
|
|
11546
|
+
const edgeCenter = (side === "top" || side === "bottom" ? offsetX : offsetY) + beakCenter;
|
|
11547
|
+
const beak = (first, tip, second) => {
|
|
11548
|
+
const before = towards(tip, first, tipRadius);
|
|
11549
|
+
const after = towards(tip, second, tipRadius);
|
|
11550
|
+
return ` L ${pt(first)} L ${pt(before)} Q ${pt(tip)} ${pt(after)} L ${pt(second)}`;
|
|
11551
|
+
};
|
|
11552
|
+
let d = `M ${pt({ x: x0 + r, y: y0 })}`;
|
|
11553
|
+
if (side === "top") {
|
|
11554
|
+
d += beak(
|
|
11555
|
+
{ x: edgeCenter - spread, y: y0 },
|
|
11556
|
+
{ x: edgeCenter, y: y0 - reach },
|
|
11557
|
+
{ x: edgeCenter + spread, y: y0 }
|
|
11558
|
+
);
|
|
11559
|
+
}
|
|
11560
|
+
d += ` L ${pt({ x: x1 - r, y: y0 })} A ${fmt(r)} ${fmt(r)} 0 0 1 ${pt({ x: x1, y: y0 + r })}`;
|
|
11561
|
+
if (side === "right") {
|
|
11562
|
+
d += beak(
|
|
11563
|
+
{ x: x1, y: edgeCenter - spread },
|
|
11564
|
+
{ x: x1 + reach, y: edgeCenter },
|
|
11565
|
+
{ x: x1, y: edgeCenter + spread }
|
|
11566
|
+
);
|
|
11567
|
+
}
|
|
11568
|
+
d += ` L ${pt({ x: x1, y: y1 - r })} A ${fmt(r)} ${fmt(r)} 0 0 1 ${pt({ x: x1 - r, y: y1 })}`;
|
|
11569
|
+
if (side === "bottom") {
|
|
11570
|
+
d += beak(
|
|
11571
|
+
{ x: edgeCenter + spread, y: y1 },
|
|
11572
|
+
{ x: edgeCenter, y: y1 + reach },
|
|
11573
|
+
{ x: edgeCenter - spread, y: y1 }
|
|
11574
|
+
);
|
|
11575
|
+
}
|
|
11576
|
+
d += ` L ${pt({ x: x0 + r, y: y1 })} A ${fmt(r)} ${fmt(r)} 0 0 1 ${pt({ x: x0, y: y1 - r })}`;
|
|
11577
|
+
if (side === "left") {
|
|
11578
|
+
d += beak(
|
|
11579
|
+
{ x: x0, y: edgeCenter + spread },
|
|
11580
|
+
{ x: x0 - reach, y: edgeCenter },
|
|
11581
|
+
{ x: x0, y: edgeCenter - spread }
|
|
11582
|
+
);
|
|
11583
|
+
}
|
|
11584
|
+
d += ` L ${pt({ x: x0, y: y0 + r })} A ${fmt(r)} ${fmt(r)} 0 0 1 ${pt({ x: x0 + r, y: y0 })} Z`;
|
|
11585
|
+
return d;
|
|
11586
|
+
}
|
|
11587
|
+
|
|
11588
|
+
// src/components/shared/FloatingSurface.tsx
|
|
11589
|
+
var import_jsx_runtime64 = require("react/jsx-runtime");
|
|
11590
|
+
var useIsomorphicLayoutEffect6 = typeof document !== "undefined" ? import_react42.useLayoutEffect : import_react42.useEffect;
|
|
11591
|
+
var SHADOW_BLEED = parseFloat(import_tokens26.spacings.sizeXXXLarge);
|
|
11592
|
+
var STROKE = parseFloat(import_tokens26.strokeWidths.strokeWidthThin);
|
|
11593
|
+
function usePanelSize(panelRef) {
|
|
11594
|
+
const [size, setSize] = (0, import_react42.useState)(null);
|
|
11595
|
+
useIsomorphicLayoutEffect6(() => {
|
|
11596
|
+
const panel = panelRef.current;
|
|
11597
|
+
if (!panel) return;
|
|
11598
|
+
const measure = () => {
|
|
11599
|
+
const style = getComputedStyle(panel);
|
|
11600
|
+
const next = { width: parseFloat(style.width), height: parseFloat(style.height) };
|
|
11601
|
+
setSize((prev) => prev && prev.width === next.width && prev.height === next.height ? prev : next);
|
|
11602
|
+
};
|
|
11603
|
+
measure();
|
|
11604
|
+
if (typeof ResizeObserver === "undefined") return;
|
|
11605
|
+
const observer = new ResizeObserver(measure);
|
|
11606
|
+
observer.observe(panel);
|
|
11607
|
+
return () => observer.disconnect();
|
|
11608
|
+
}, [panelRef]);
|
|
11609
|
+
return size;
|
|
11610
|
+
}
|
|
11611
|
+
function FloatingSurface({
|
|
11612
|
+
panelRef,
|
|
11613
|
+
side,
|
|
11614
|
+
align,
|
|
11615
|
+
radius: radius2,
|
|
11616
|
+
beakWidth,
|
|
11617
|
+
beakHeight,
|
|
11618
|
+
tipRadius,
|
|
11619
|
+
beakInsetStart,
|
|
11620
|
+
beakInsetEnd,
|
|
11621
|
+
backgroundColor,
|
|
11622
|
+
borderColor
|
|
11623
|
+
}) {
|
|
11624
|
+
const size = usePanelSize(panelRef);
|
|
11625
|
+
if (!size) return null;
|
|
11626
|
+
const r = parseFloat(radius2);
|
|
11627
|
+
const bw = parseFloat(beakWidth);
|
|
11628
|
+
const bh = parseFloat(beakHeight);
|
|
11629
|
+
const vertical = side === "top" || side === "bottom";
|
|
11630
|
+
const beakCenter = resolveBeakCenter(
|
|
11631
|
+
vertical ? size.width : size.height,
|
|
11632
|
+
align,
|
|
11633
|
+
bw,
|
|
11634
|
+
r,
|
|
11635
|
+
parseFloat(beakInsetStart),
|
|
11636
|
+
parseFloat(beakInsetEnd)
|
|
11637
|
+
);
|
|
11638
|
+
const geometry = {
|
|
11639
|
+
panelWidth: size.width,
|
|
11640
|
+
panelHeight: size.height,
|
|
11641
|
+
radius: r,
|
|
11642
|
+
side,
|
|
11643
|
+
beakCenter,
|
|
11644
|
+
beakWidth: bw,
|
|
11645
|
+
beakHeight: bh,
|
|
11646
|
+
tipRadius: parseFloat(tipRadius)
|
|
11647
|
+
};
|
|
11648
|
+
const shape = buildFloatingOutline(geometry);
|
|
11649
|
+
const outline = buildFloatingOutline({ ...geometry, inset: STROKE / 2 });
|
|
11650
|
+
const box = floatingShapeSize(size.width, size.height, side, bh);
|
|
11651
|
+
const holeSvg = `<svg xmlns="http://www.w3.org/2000/svg" width="${box.width + SHADOW_BLEED * 2}" height="${box.height + SHADOW_BLEED * 2}"><path transform="translate(${SHADOW_BLEED} ${SHADOW_BLEED})" d="${shape}"/></svg>`;
|
|
11652
|
+
const holeMask = `linear-gradient(#000 0 0), url("data:image/svg+xml,${encodeURIComponent(holeSvg)}")`;
|
|
11653
|
+
const rootStyle = {
|
|
11654
|
+
width: box.width,
|
|
11655
|
+
height: box.height,
|
|
11656
|
+
top: side === "top" ? -bh : 0,
|
|
11657
|
+
left: side === "left" ? -bh : 0
|
|
11658
|
+
};
|
|
11659
|
+
const shadowStyle = {
|
|
11660
|
+
inset: -SHADOW_BLEED,
|
|
11661
|
+
maskImage: holeMask,
|
|
11662
|
+
WebkitMaskImage: holeMask,
|
|
11663
|
+
maskComposite: "exclude",
|
|
11664
|
+
WebkitMaskComposite: "xor",
|
|
11665
|
+
maskSize: "100% 100%",
|
|
11666
|
+
WebkitMaskSize: "100% 100%",
|
|
11667
|
+
maskRepeat: "no-repeat",
|
|
11668
|
+
WebkitMaskRepeat: "no-repeat"
|
|
11669
|
+
};
|
|
11670
|
+
const clip = `path("${shape}")`;
|
|
11671
|
+
return /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)("div", { "data-refineui": "floating-chrome", "aria-hidden": true, className: "pointer-events-none absolute -z-1", style: rootStyle, children: [
|
|
11672
|
+
/* @__PURE__ */ (0, import_jsx_runtime64.jsx)("div", { className: "absolute", style: shadowStyle, children: /* @__PURE__ */ (0, import_jsx_runtime64.jsx)("div", { "data-refineui": "floating-shadow", className: "absolute", style: { inset: SHADOW_BLEED }, children: /* @__PURE__ */ (0, import_jsx_runtime64.jsx)("div", { className: "absolute inset-0", style: { clipPath: clip, backgroundColor: borderColor } }) }) }),
|
|
11673
|
+
/* @__PURE__ */ (0, import_jsx_runtime64.jsx)("div", { "data-refineui": "floating-surface", className: "absolute inset-0", style: { clipPath: clip, backgroundColor } }),
|
|
11674
|
+
/* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
|
|
11675
|
+
"svg",
|
|
11676
|
+
{
|
|
11677
|
+
"data-refineui": "floating-outline",
|
|
11678
|
+
className: "absolute inset-0 overflow-visible",
|
|
11679
|
+
width: box.width,
|
|
11680
|
+
height: box.height,
|
|
11681
|
+
viewBox: `0 0 ${box.width} ${box.height}`,
|
|
11682
|
+
fill: "none",
|
|
11683
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime64.jsx)("path", { d: outline, stroke: borderColor, strokeWidth: STROKE, strokeLinejoin: "round" })
|
|
11684
|
+
}
|
|
11685
|
+
)
|
|
11686
|
+
] });
|
|
11687
|
+
}
|
|
11491
11688
|
|
|
11492
11689
|
// src/components/PopOver/style.ts
|
|
11493
11690
|
var popoverStyles = {
|
|
@@ -11495,9 +11692,8 @@ var popoverStyles = {
|
|
|
11495
11692
|
fallbackTrigger: "cursor-pointer border-none bg-transparent p-0 font-inherit text-inherit",
|
|
11496
11693
|
floatingRoot: "absolute z-refineui-popup",
|
|
11497
11694
|
panelWrap: "relative inline-block min-w-refineui-popover-panel-width",
|
|
11498
|
-
|
|
11499
|
-
panel: "relative z-0 box-border min-w-refineui-popover-panel-width rounded-refineui-xx-large border-refineui-thin outline-none"
|
|
11500
|
-
panelShadowDefault: "shadow-refineui-8"
|
|
11695
|
+
/** Fill, stroke, and shadow come from `FloatingSurface`; the transparent border keeps the box size. */
|
|
11696
|
+
panel: "relative z-0 box-border min-w-refineui-popover-panel-width rounded-refineui-xx-large border-refineui-thin border-transparent outline-none"
|
|
11501
11697
|
};
|
|
11502
11698
|
function popoverFloatingClasses(placement, align) {
|
|
11503
11699
|
if (placement === "bottom") {
|
|
@@ -11521,58 +11717,22 @@ function popoverFloatingClasses(placement, align) {
|
|
|
11521
11717
|
}
|
|
11522
11718
|
|
|
11523
11719
|
// src/components/PopOver/PopOver.tsx
|
|
11524
|
-
var
|
|
11525
|
-
var PopoverContext = (0,
|
|
11720
|
+
var import_jsx_runtime65 = require("react/jsx-runtime");
|
|
11721
|
+
var PopoverContext = (0, import_react43.createContext)(null);
|
|
11526
11722
|
function usePopoverContext(component) {
|
|
11527
|
-
const ctx = (0,
|
|
11723
|
+
const ctx = (0, import_react43.useContext)(PopoverContext);
|
|
11528
11724
|
if (!ctx) throw new Error(`${component} must be used within <Popover>`);
|
|
11529
11725
|
return ctx;
|
|
11530
11726
|
}
|
|
11531
|
-
var
|
|
11532
|
-
var
|
|
11533
|
-
var
|
|
11534
|
-
var
|
|
11535
|
-
|
|
11536
|
-
|
|
11537
|
-
|
|
11538
|
-
|
|
11539
|
-
|
|
11540
|
-
const overlapOffset = `calc(-1 * ${BEAK_OFFSET} + ${BEAK_BORDER_OVERLAP})`;
|
|
11541
|
-
switch (placement) {
|
|
11542
|
-
case "bottom":
|
|
11543
|
-
if (align === "center") return { top: overlapOffset, left: `calc(50% - ${BEAK_W} / 2)` };
|
|
11544
|
-
if (align === "start") return { top: overlapOffset, left: insetStart };
|
|
11545
|
-
return { top: overlapOffset, right: insetEnd };
|
|
11546
|
-
case "top":
|
|
11547
|
-
if (align === "center") return { bottom: overlapOffset, left: `calc(50% - ${BEAK_W} / 2)` };
|
|
11548
|
-
if (align === "start") return { bottom: overlapOffset, left: insetStart };
|
|
11549
|
-
return { bottom: overlapOffset, right: insetEnd };
|
|
11550
|
-
case "left":
|
|
11551
|
-
if (align === "center") return { right: overlapOffset, top: `calc(50% - ${BEAK_W} / 2)` };
|
|
11552
|
-
if (align === "start") return { right: overlapOffset, top: edge };
|
|
11553
|
-
return { right: overlapOffset, bottom: edge };
|
|
11554
|
-
case "right":
|
|
11555
|
-
if (align === "center") return { left: overlapOffset, top: `calc(50% - ${BEAK_W} / 2)` };
|
|
11556
|
-
if (align === "start") return { left: overlapOffset, top: edge };
|
|
11557
|
-
return { left: overlapOffset, bottom: edge };
|
|
11558
|
-
default:
|
|
11559
|
-
return {};
|
|
11560
|
-
}
|
|
11561
|
-
}
|
|
11562
|
-
function beakRotateDeg(placement) {
|
|
11563
|
-
switch (placement) {
|
|
11564
|
-
case "bottom":
|
|
11565
|
-
return 0;
|
|
11566
|
-
case "top":
|
|
11567
|
-
return 180;
|
|
11568
|
-
case "left":
|
|
11569
|
-
return -90;
|
|
11570
|
-
case "right":
|
|
11571
|
-
return 90;
|
|
11572
|
-
default:
|
|
11573
|
-
return 0;
|
|
11574
|
-
}
|
|
11575
|
-
}
|
|
11727
|
+
var BEAK_TIP_GAP = import_tokens27.spacings.sizeXXSmall;
|
|
11728
|
+
var POPOVER_GAP = `calc(${import_tokens3.componentSizes.popoverBeakHeight} + ${BEAK_TIP_GAP})`;
|
|
11729
|
+
var SIDE_BEAK_INSET = import_tokens27.spacings.sizeMedium;
|
|
11730
|
+
var beakSideByPlacement = {
|
|
11731
|
+
bottom: "top",
|
|
11732
|
+
top: "bottom",
|
|
11733
|
+
left: "right",
|
|
11734
|
+
right: "left"
|
|
11735
|
+
};
|
|
11576
11736
|
function floatingGapStyle(placement) {
|
|
11577
11737
|
if (placement === "top") return { marginBottom: POPOVER_GAP };
|
|
11578
11738
|
if (placement === "bottom") return { marginTop: POPOVER_GAP };
|
|
@@ -11580,35 +11740,35 @@ function floatingGapStyle(placement) {
|
|
|
11580
11740
|
return { marginLeft: POPOVER_GAP };
|
|
11581
11741
|
}
|
|
11582
11742
|
function Popover({ children, className, open: openProp, defaultOpen = false, onOpenChange, ...props }) {
|
|
11583
|
-
const [internalOpen, setInternalOpen] = (0,
|
|
11743
|
+
const [internalOpen, setInternalOpen] = (0, import_react43.useState)(defaultOpen);
|
|
11584
11744
|
const open = openProp ?? internalOpen;
|
|
11585
|
-
const setOpen = (0,
|
|
11745
|
+
const setOpen = (0, import_react43.useCallback)(
|
|
11586
11746
|
(next) => {
|
|
11587
11747
|
if (openProp === void 0) setInternalOpen(next);
|
|
11588
11748
|
onOpenChange?.(next);
|
|
11589
11749
|
},
|
|
11590
11750
|
[openProp, onOpenChange]
|
|
11591
11751
|
);
|
|
11592
|
-
const toggle = (0,
|
|
11593
|
-
const containerRef = (0,
|
|
11594
|
-
const contentRef = (0,
|
|
11595
|
-
const triggerRef = (0,
|
|
11596
|
-
const contentId = (0,
|
|
11597
|
-
(0,
|
|
11752
|
+
const toggle = (0, import_react43.useCallback)(() => setOpen(!open), [open, setOpen]);
|
|
11753
|
+
const containerRef = (0, import_react43.useRef)(null);
|
|
11754
|
+
const contentRef = (0, import_react43.useRef)(null);
|
|
11755
|
+
const triggerRef = (0, import_react43.useRef)(null);
|
|
11756
|
+
const contentId = (0, import_react43.useId)();
|
|
11757
|
+
(0, import_react43.useEffect)(() => {
|
|
11598
11758
|
const handler = (e) => {
|
|
11599
11759
|
if (containerRef.current && !containerRef.current.contains(e.target)) setOpen(false);
|
|
11600
11760
|
};
|
|
11601
11761
|
if (open) document.addEventListener("mousedown", handler);
|
|
11602
11762
|
return () => document.removeEventListener("mousedown", handler);
|
|
11603
11763
|
}, [open, setOpen]);
|
|
11604
|
-
(0,
|
|
11764
|
+
(0, import_react43.useEffect)(() => {
|
|
11605
11765
|
const onKey = (e) => {
|
|
11606
11766
|
if (e instanceof KeyboardEvent && e.key === "Escape") setOpen(false);
|
|
11607
11767
|
};
|
|
11608
11768
|
if (open) document.addEventListener("keydown", onKey);
|
|
11609
11769
|
return () => document.removeEventListener("keydown", onKey);
|
|
11610
11770
|
}, [open, setOpen]);
|
|
11611
|
-
const onTriggerKeyDown = (0,
|
|
11771
|
+
const onTriggerKeyDown = (0, import_react43.useCallback)(
|
|
11612
11772
|
(e) => {
|
|
11613
11773
|
if (e.key === "Enter" || e.key === " ") {
|
|
11614
11774
|
e.preventDefault();
|
|
@@ -11617,7 +11777,7 @@ function Popover({ children, className, open: openProp, defaultOpen = false, onO
|
|
|
11617
11777
|
},
|
|
11618
11778
|
[toggle]
|
|
11619
11779
|
);
|
|
11620
|
-
const value = (0,
|
|
11780
|
+
const value = (0, import_react43.useMemo)(
|
|
11621
11781
|
() => ({
|
|
11622
11782
|
open,
|
|
11623
11783
|
setOpen,
|
|
@@ -11630,7 +11790,7 @@ function Popover({ children, className, open: openProp, defaultOpen = false, onO
|
|
|
11630
11790
|
}),
|
|
11631
11791
|
[open, setOpen, toggle, contentId, onTriggerKeyDown]
|
|
11632
11792
|
);
|
|
11633
|
-
return /* @__PURE__ */ (0,
|
|
11793
|
+
return /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(PopoverContext.Provider, { value, children: /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
|
|
11634
11794
|
"div",
|
|
11635
11795
|
{
|
|
11636
11796
|
ref: containerRef,
|
|
@@ -11643,11 +11803,11 @@ function Popover({ children, className, open: openProp, defaultOpen = false, onO
|
|
|
11643
11803
|
}
|
|
11644
11804
|
function PopoverTrigger({ children, className, ...props }) {
|
|
11645
11805
|
const { open, toggle, triggerRef, contentId, onTriggerKeyDown } = usePopoverContext("PopoverTrigger");
|
|
11646
|
-
const mergeEl = (0,
|
|
11806
|
+
const mergeEl = (0, import_react44.getMergeableTriggerChild)(children);
|
|
11647
11807
|
if (mergeEl) {
|
|
11648
11808
|
const passthrough = props;
|
|
11649
|
-
return /* @__PURE__ */ (0,
|
|
11650
|
-
|
|
11809
|
+
return /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
|
|
11810
|
+
import_react44.Slot,
|
|
11651
11811
|
{
|
|
11652
11812
|
ref: triggerRef,
|
|
11653
11813
|
...props,
|
|
@@ -11668,7 +11828,7 @@ function PopoverTrigger({ children, className, ...props }) {
|
|
|
11668
11828
|
);
|
|
11669
11829
|
}
|
|
11670
11830
|
const passthroughBtn = props;
|
|
11671
|
-
return /* @__PURE__ */ (0,
|
|
11831
|
+
return /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
|
|
11672
11832
|
"button",
|
|
11673
11833
|
{
|
|
11674
11834
|
type: "button",
|
|
@@ -11707,11 +11867,10 @@ function PopoverContent({
|
|
|
11707
11867
|
const palette = componentColorTokens.popover.default;
|
|
11708
11868
|
const bg = (0, import_color11.resolveColorTokenValue)(palette.background);
|
|
11709
11869
|
const borderCol = (0, import_color11.resolveColorTokenValue)(palette.border);
|
|
11710
|
-
const bw = beakWrapperStyle(placement, align);
|
|
11711
|
-
const rot = beakRotateDeg(placement);
|
|
11712
11870
|
const gapStyle = floatingGapStyle(placement);
|
|
11871
|
+
const vertical = placement === "top" || placement === "bottom";
|
|
11713
11872
|
if (!open) return null;
|
|
11714
|
-
return /* @__PURE__ */ (0,
|
|
11873
|
+
return /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
|
|
11715
11874
|
"div",
|
|
11716
11875
|
{
|
|
11717
11876
|
className: (0, import_clsx85.clsx)(
|
|
@@ -11719,34 +11878,8 @@ function PopoverContent({
|
|
|
11719
11878
|
popoverFloatingClasses(placement, align)
|
|
11720
11879
|
),
|
|
11721
11880
|
style: gapStyle,
|
|
11722
|
-
children: /* @__PURE__ */ (0,
|
|
11723
|
-
/* @__PURE__ */ (0,
|
|
11724
|
-
"div",
|
|
11725
|
-
{
|
|
11726
|
-
style: {
|
|
11727
|
-
width: BEAK_W,
|
|
11728
|
-
height: BEAK_H,
|
|
11729
|
-
transform: `rotate(${rot}deg)`,
|
|
11730
|
-
transformOrigin: "center center"
|
|
11731
|
-
},
|
|
11732
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)(
|
|
11733
|
-
"svg",
|
|
11734
|
-
{
|
|
11735
|
-
width: BEAK_W,
|
|
11736
|
-
height: BEAK_H,
|
|
11737
|
-
viewBox: "0 0 16 8",
|
|
11738
|
-
fill: "none",
|
|
11739
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
11740
|
-
style: { display: "block" },
|
|
11741
|
-
children: [
|
|
11742
|
-
/* @__PURE__ */ (0, import_jsx_runtime64.jsx)("polygon", { points: "8,0 0,8 16,8", fill: borderCol }),
|
|
11743
|
-
/* @__PURE__ */ (0, import_jsx_runtime64.jsx)("polygon", { points: "8,2 2,8 14,8", fill: bg })
|
|
11744
|
-
]
|
|
11745
|
-
}
|
|
11746
|
-
)
|
|
11747
|
-
}
|
|
11748
|
-
) }),
|
|
11749
|
-
/* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
|
|
11881
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)("div", { className: popoverStyles.panelWrap, children: [
|
|
11882
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
|
|
11750
11883
|
"div",
|
|
11751
11884
|
{
|
|
11752
11885
|
ref: contentRef,
|
|
@@ -11757,22 +11890,32 @@ function PopoverContent({
|
|
|
11757
11890
|
"data-refineui": "popover",
|
|
11758
11891
|
"data-placement": placement,
|
|
11759
11892
|
"data-align": align,
|
|
11760
|
-
className: (0, import_clsx85.clsx)(
|
|
11761
|
-
popoverStyles.panel,
|
|
11762
|
-
popoverStyles.panelShadowDefault,
|
|
11763
|
-
className
|
|
11764
|
-
),
|
|
11893
|
+
className: (0, import_clsx85.clsx)(popoverStyles.panel, className),
|
|
11765
11894
|
style: {
|
|
11766
11895
|
...styleProp && typeof styleProp === "object" ? styleProp : {},
|
|
11767
11896
|
minWidth: import_tokens3.componentSizes.popoverPanelWidth,
|
|
11768
|
-
padding:
|
|
11769
|
-
|
|
11770
|
-
color: (0, import_color11.resolveColorTokenValue)(palette.foreground),
|
|
11771
|
-
borderColor: borderCol
|
|
11897
|
+
padding: import_tokens27.spacings.sizeLarge,
|
|
11898
|
+
color: (0, import_color11.resolveColorTokenValue)(palette.foreground)
|
|
11772
11899
|
},
|
|
11773
11900
|
...props,
|
|
11774
11901
|
children
|
|
11775
11902
|
}
|
|
11903
|
+
),
|
|
11904
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
|
|
11905
|
+
FloatingSurface,
|
|
11906
|
+
{
|
|
11907
|
+
panelRef: contentRef,
|
|
11908
|
+
side: beakSideByPlacement[placement],
|
|
11909
|
+
align,
|
|
11910
|
+
radius: import_tokens27.borderRadii.roundedXXLarge,
|
|
11911
|
+
beakWidth: import_tokens3.componentSizes.popoverBeakWidth,
|
|
11912
|
+
beakHeight: import_tokens3.componentSizes.popoverBeakHeight,
|
|
11913
|
+
tipRadius: import_tokens3.componentSizes.popoverBeakTipRadius,
|
|
11914
|
+
beakInsetStart: vertical ? import_tokens3.componentSizes.popoverBeakInsetFromStartEdge : SIDE_BEAK_INSET,
|
|
11915
|
+
beakInsetEnd: vertical ? import_tokens3.componentSizes.popoverBeakInsetFromEndEdge : SIDE_BEAK_INSET,
|
|
11916
|
+
backgroundColor: bg,
|
|
11917
|
+
borderColor: borderCol
|
|
11918
|
+
}
|
|
11776
11919
|
)
|
|
11777
11920
|
] })
|
|
11778
11921
|
}
|
|
@@ -11786,9 +11929,9 @@ function PopOver({
|
|
|
11786
11929
|
className,
|
|
11787
11930
|
...props
|
|
11788
11931
|
}) {
|
|
11789
|
-
return /* @__PURE__ */ (0,
|
|
11790
|
-
/* @__PURE__ */ (0,
|
|
11791
|
-
/* @__PURE__ */ (0,
|
|
11932
|
+
return /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)(Popover, { className, ...props, children: [
|
|
11933
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsx)(PopoverTrigger, { children: trigger }),
|
|
11934
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsx)(PopoverContent, { placement, align, children: content })
|
|
11792
11935
|
] });
|
|
11793
11936
|
}
|
|
11794
11937
|
|
|
@@ -11804,7 +11947,7 @@ var skeletonStyles = {
|
|
|
11804
11947
|
};
|
|
11805
11948
|
|
|
11806
11949
|
// src/components/Skeleton/Skeleton.tsx
|
|
11807
|
-
var
|
|
11950
|
+
var import_jsx_runtime66 = require("react/jsx-runtime");
|
|
11808
11951
|
function Skeleton({
|
|
11809
11952
|
width,
|
|
11810
11953
|
height,
|
|
@@ -11836,7 +11979,7 @@ function Skeleton({
|
|
|
11836
11979
|
w = width ?? "100%";
|
|
11837
11980
|
}
|
|
11838
11981
|
const dimStyle = { width: w, height: h };
|
|
11839
|
-
return /* @__PURE__ */ (0,
|
|
11982
|
+
return /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
|
|
11840
11983
|
"div",
|
|
11841
11984
|
{
|
|
11842
11985
|
"data-refineui": "skeleton",
|
|
@@ -11854,7 +11997,7 @@ function Skeleton({
|
|
|
11854
11997
|
|
|
11855
11998
|
// src/components/Slider/Slider.tsx
|
|
11856
11999
|
var import_clsx87 = require("clsx");
|
|
11857
|
-
var
|
|
12000
|
+
var import_react45 = require("react");
|
|
11858
12001
|
|
|
11859
12002
|
// src/components/Slider/style.ts
|
|
11860
12003
|
var sliderStyles = {
|
|
@@ -11862,7 +12005,7 @@ var sliderStyles = {
|
|
|
11862
12005
|
};
|
|
11863
12006
|
|
|
11864
12007
|
// src/components/Slider/Slider.tsx
|
|
11865
|
-
var
|
|
12008
|
+
var import_jsx_runtime67 = require("react/jsx-runtime");
|
|
11866
12009
|
function clampPct(n) {
|
|
11867
12010
|
if (Number.isNaN(n)) return 0;
|
|
11868
12011
|
return Math.min(100, Math.max(0, n));
|
|
@@ -11880,12 +12023,12 @@ function Slider({
|
|
|
11880
12023
|
style,
|
|
11881
12024
|
...props
|
|
11882
12025
|
}) {
|
|
11883
|
-
const [internalFillPct, setInternalFillPct] = (0,
|
|
12026
|
+
const [internalFillPct, setInternalFillPct] = (0, import_react45.useState)(() => {
|
|
11884
12027
|
const v = defaultValue !== void 0 ? Number(defaultValue) : (min + max) / 2;
|
|
11885
12028
|
return clampPct((v - min) / (max - min) * 100);
|
|
11886
12029
|
});
|
|
11887
12030
|
const fillPct = value !== void 0 ? clampPct((Number(value) - min) / (max - min) * 100) : internalFillPct;
|
|
11888
|
-
return /* @__PURE__ */ (0,
|
|
12031
|
+
return /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
|
|
11889
12032
|
"input",
|
|
11890
12033
|
{
|
|
11891
12034
|
type: "range",
|
|
@@ -11921,8 +12064,8 @@ function Slider({
|
|
|
11921
12064
|
|
|
11922
12065
|
// src/components/Carousel/Carousel.tsx
|
|
11923
12066
|
var import_clsx89 = require("clsx");
|
|
11924
|
-
var
|
|
11925
|
-
var
|
|
12067
|
+
var import_tokens28 = require("@refineui/tokens");
|
|
12068
|
+
var import_react46 = require("react");
|
|
11926
12069
|
|
|
11927
12070
|
// src/components/Carousel/style.ts
|
|
11928
12071
|
var import_clsx88 = require("clsx");
|
|
@@ -11954,11 +12097,11 @@ var carouselStyles = {
|
|
|
11954
12097
|
};
|
|
11955
12098
|
|
|
11956
12099
|
// src/components/Carousel/Carousel.tsx
|
|
11957
|
-
var
|
|
12100
|
+
var import_jsx_runtime68 = require("react/jsx-runtime");
|
|
11958
12101
|
var DRAG_COMMIT_RATIO = 0.18;
|
|
11959
|
-
var CarouselContext = (0,
|
|
12102
|
+
var CarouselContext = (0, import_react46.createContext)(null);
|
|
11960
12103
|
function useCarouselContext(component) {
|
|
11961
|
-
const v = (0,
|
|
12104
|
+
const v = (0, import_react46.useContext)(CarouselContext);
|
|
11962
12105
|
if (!v) throw new Error(`${component} must be used within Carousel.`);
|
|
11963
12106
|
return v;
|
|
11964
12107
|
}
|
|
@@ -11977,13 +12120,13 @@ function Carousel({
|
|
|
11977
12120
|
...props
|
|
11978
12121
|
}) {
|
|
11979
12122
|
const isControlled = indexControlled !== void 0;
|
|
11980
|
-
const [internalIndex, setInternalIndex] = (0,
|
|
11981
|
-
const [count, setCount] = (0,
|
|
11982
|
-
const [trackIndex, setTrackIndex] = (0,
|
|
11983
|
-
const [instant, setInstant] = (0,
|
|
12123
|
+
const [internalIndex, setInternalIndex] = (0, import_react46.useState)(defaultIndex);
|
|
12124
|
+
const [count, setCount] = (0, import_react46.useState)(0);
|
|
12125
|
+
const [trackIndex, setTrackIndex] = (0, import_react46.useState)(defaultIndex);
|
|
12126
|
+
const [instant, setInstant] = (0, import_react46.useState)(false);
|
|
11984
12127
|
const index = isControlled ? indexControlled : internalIndex;
|
|
11985
12128
|
const loopActive = loop && count > 1;
|
|
11986
|
-
const commitLogical = (0,
|
|
12129
|
+
const commitLogical = (0, import_react46.useCallback)(
|
|
11987
12130
|
(next) => {
|
|
11988
12131
|
const normalized = clampIndex(next, Math.max(count, 1));
|
|
11989
12132
|
if (!isControlled) setInternalIndex(normalized);
|
|
@@ -11991,13 +12134,13 @@ function Carousel({
|
|
|
11991
12134
|
},
|
|
11992
12135
|
[count, isControlled, onIndexChange]
|
|
11993
12136
|
);
|
|
11994
|
-
(0,
|
|
12137
|
+
(0, import_react46.useLayoutEffect)(() => {
|
|
11995
12138
|
if (count <= 0) return;
|
|
11996
12139
|
const logical = clampIndex(index, count);
|
|
11997
12140
|
if (logical !== index) commitLogical(logical);
|
|
11998
12141
|
setTrackIndex(loopActive ? logical + 1 : logical);
|
|
11999
12142
|
}, [count, loopActive]);
|
|
12000
|
-
(0,
|
|
12143
|
+
(0, import_react46.useEffect)(() => {
|
|
12001
12144
|
if (count <= 0) return;
|
|
12002
12145
|
if (!loopActive) {
|
|
12003
12146
|
setTrackIndex(clampIndex(index, count));
|
|
@@ -12011,7 +12154,7 @@ function Carousel({
|
|
|
12011
12154
|
}, [index, count, loopActive]);
|
|
12012
12155
|
const canScrollPrev = loopActive ? true : index > 0;
|
|
12013
12156
|
const canScrollNext = loopActive ? true : index < count - 1;
|
|
12014
|
-
const scrollTo = (0,
|
|
12157
|
+
const scrollTo = (0, import_react46.useCallback)(
|
|
12015
12158
|
(i) => {
|
|
12016
12159
|
if (count <= 0) return;
|
|
12017
12160
|
const next = clampIndex(i, count);
|
|
@@ -12020,7 +12163,7 @@ function Carousel({
|
|
|
12020
12163
|
},
|
|
12021
12164
|
[commitLogical, count, loopActive]
|
|
12022
12165
|
);
|
|
12023
|
-
const scrollPrev = (0,
|
|
12166
|
+
const scrollPrev = (0, import_react46.useCallback)(() => {
|
|
12024
12167
|
if (count <= 0) return;
|
|
12025
12168
|
if (loopActive) {
|
|
12026
12169
|
if (trackIndex < 1 || trackIndex > count) return;
|
|
@@ -12033,7 +12176,7 @@ function Carousel({
|
|
|
12033
12176
|
setTrackIndex(index - 1);
|
|
12034
12177
|
}
|
|
12035
12178
|
}, [commitLogical, count, index, loopActive, trackIndex]);
|
|
12036
|
-
const scrollNext = (0,
|
|
12179
|
+
const scrollNext = (0, import_react46.useCallback)(() => {
|
|
12037
12180
|
if (count <= 0) return;
|
|
12038
12181
|
if (loopActive) {
|
|
12039
12182
|
if (trackIndex < 1 || trackIndex > count) return;
|
|
@@ -12046,7 +12189,7 @@ function Carousel({
|
|
|
12046
12189
|
setTrackIndex(index + 1);
|
|
12047
12190
|
}
|
|
12048
12191
|
}, [commitLogical, count, index, loopActive, trackIndex]);
|
|
12049
|
-
const onTrackSettled = (0,
|
|
12192
|
+
const onTrackSettled = (0, import_react46.useCallback)(() => {
|
|
12050
12193
|
if (!loopActive) return;
|
|
12051
12194
|
if (trackIndex === 0) {
|
|
12052
12195
|
setInstant(true);
|
|
@@ -12062,7 +12205,7 @@ function Carousel({
|
|
|
12062
12205
|
});
|
|
12063
12206
|
}
|
|
12064
12207
|
}, [count, loopActive, trackIndex]);
|
|
12065
|
-
const ctx = (0,
|
|
12208
|
+
const ctx = (0, import_react46.useMemo)(
|
|
12066
12209
|
() => ({
|
|
12067
12210
|
index,
|
|
12068
12211
|
count,
|
|
@@ -12117,7 +12260,7 @@ function Carousel({
|
|
|
12117
12260
|
break;
|
|
12118
12261
|
}
|
|
12119
12262
|
};
|
|
12120
|
-
return /* @__PURE__ */ (0,
|
|
12263
|
+
return /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(CarouselContext.Provider, { value: ctx, children: /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(
|
|
12121
12264
|
"div",
|
|
12122
12265
|
{
|
|
12123
12266
|
"data-refineui": "carousel",
|
|
@@ -12141,21 +12284,21 @@ function CarouselContent({ className, children, ...props }) {
|
|
|
12141
12284
|
instant,
|
|
12142
12285
|
onTrackSettled
|
|
12143
12286
|
} = useCarouselContext("CarouselContent");
|
|
12144
|
-
const viewportRef = (0,
|
|
12145
|
-
const dragStartX = (0,
|
|
12146
|
-
const [dragPx, setDragPx] = (0,
|
|
12147
|
-
const [dragging, setDragging] = (0,
|
|
12148
|
-
const slides =
|
|
12287
|
+
const viewportRef = (0, import_react46.useRef)(null);
|
|
12288
|
+
const dragStartX = (0, import_react46.useRef)(null);
|
|
12289
|
+
const [dragPx, setDragPx] = (0, import_react46.useState)(0);
|
|
12290
|
+
const [dragging, setDragging] = (0, import_react46.useState)(false);
|
|
12291
|
+
const slides = import_react46.Children.toArray(children).filter(import_react46.isValidElement);
|
|
12149
12292
|
const slideCount = slides.length;
|
|
12150
|
-
(0,
|
|
12293
|
+
(0, import_react46.useEffect)(() => {
|
|
12151
12294
|
setCount(slideCount);
|
|
12152
12295
|
}, [setCount, slideCount]);
|
|
12153
12296
|
const trackSlides = loop && slides.length > 1 ? [
|
|
12154
|
-
(0,
|
|
12297
|
+
(0, import_react46.cloneElement)(slides[slides.length - 1], { key: "__carousel-clone-last" }),
|
|
12155
12298
|
...slides,
|
|
12156
|
-
(0,
|
|
12299
|
+
(0, import_react46.cloneElement)(slides[0], { key: "__carousel-clone-first" })
|
|
12157
12300
|
] : slides;
|
|
12158
|
-
const endDrag = (0,
|
|
12301
|
+
const endDrag = (0, import_react46.useCallback)(
|
|
12159
12302
|
(clientX) => {
|
|
12160
12303
|
if (dragStartX.current == null) return;
|
|
12161
12304
|
const width = viewportRef.current?.offsetWidth ?? 1;
|
|
@@ -12204,7 +12347,7 @@ function CarouselContent({ className, children, ...props }) {
|
|
|
12204
12347
|
};
|
|
12205
12348
|
const animated = !dragging && !instant;
|
|
12206
12349
|
const transform = dragPx !== 0 ? `translate3d(calc(-${trackIndex * 100}% + ${dragPx}px), 0, 0)` : `translate3d(-${trackIndex * 100}%, 0, 0)`;
|
|
12207
|
-
return /* @__PURE__ */ (0,
|
|
12350
|
+
return /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(
|
|
12208
12351
|
"div",
|
|
12209
12352
|
{
|
|
12210
12353
|
ref: viewportRef,
|
|
@@ -12215,7 +12358,7 @@ function CarouselContent({ className, children, ...props }) {
|
|
|
12215
12358
|
onPointerMove,
|
|
12216
12359
|
onPointerUp,
|
|
12217
12360
|
onPointerCancel,
|
|
12218
|
-
children: /* @__PURE__ */ (0,
|
|
12361
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(
|
|
12219
12362
|
"div",
|
|
12220
12363
|
{
|
|
12221
12364
|
"data-refineui": "carousel-track",
|
|
@@ -12230,9 +12373,9 @@ function CarouselContent({ className, children, ...props }) {
|
|
|
12230
12373
|
}
|
|
12231
12374
|
);
|
|
12232
12375
|
}
|
|
12233
|
-
var CarouselItem = (0,
|
|
12376
|
+
var CarouselItem = (0, import_react46.forwardRef)(function CarouselItem2({ className, children, ...props }, ref) {
|
|
12234
12377
|
useCarouselContext("CarouselItem");
|
|
12235
|
-
return /* @__PURE__ */ (0,
|
|
12378
|
+
return /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(
|
|
12236
12379
|
"div",
|
|
12237
12380
|
{
|
|
12238
12381
|
ref,
|
|
@@ -12247,12 +12390,12 @@ var CarouselItem = (0, import_react45.forwardRef)(function CarouselItem2({ class
|
|
|
12247
12390
|
});
|
|
12248
12391
|
function CarouselControls({ className, children, ...props }) {
|
|
12249
12392
|
useCarouselContext("CarouselControls");
|
|
12250
|
-
return /* @__PURE__ */ (0,
|
|
12393
|
+
return /* @__PURE__ */ (0, import_jsx_runtime68.jsx)("div", { "data-refineui": "carousel-controls", className: (0, import_clsx89.clsx)(carouselStyles.controls, className), ...props, children });
|
|
12251
12394
|
}
|
|
12252
12395
|
function CarouselPrevious({ className, disabled, onClick, ...props }) {
|
|
12253
12396
|
const { scrollPrev, canScrollPrev } = useCarouselContext("CarouselPrevious");
|
|
12254
12397
|
const isDisabled = disabled || !canScrollPrev;
|
|
12255
|
-
return /* @__PURE__ */ (0,
|
|
12398
|
+
return /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(
|
|
12256
12399
|
Button,
|
|
12257
12400
|
{
|
|
12258
12401
|
variant: "outline",
|
|
@@ -12268,11 +12411,11 @@ function CarouselPrevious({ className, disabled, onClick, ...props }) {
|
|
|
12268
12411
|
onClick?.(e);
|
|
12269
12412
|
if (!e.defaultPrevented && !isDisabled) scrollPrev();
|
|
12270
12413
|
},
|
|
12271
|
-
children: /* @__PURE__ */ (0,
|
|
12414
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(
|
|
12272
12415
|
WebIcon,
|
|
12273
12416
|
{
|
|
12274
12417
|
name: "chevron-left",
|
|
12275
|
-
size:
|
|
12418
|
+
size: import_tokens28.iconSizes.small,
|
|
12276
12419
|
color: "currentColor",
|
|
12277
12420
|
iconStyle: "filled",
|
|
12278
12421
|
fallback: "\u2039"
|
|
@@ -12284,7 +12427,7 @@ function CarouselPrevious({ className, disabled, onClick, ...props }) {
|
|
|
12284
12427
|
function CarouselNext({ className, disabled, onClick, ...props }) {
|
|
12285
12428
|
const { scrollNext, canScrollNext } = useCarouselContext("CarouselNext");
|
|
12286
12429
|
const isDisabled = disabled || !canScrollNext;
|
|
12287
|
-
return /* @__PURE__ */ (0,
|
|
12430
|
+
return /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(
|
|
12288
12431
|
Button,
|
|
12289
12432
|
{
|
|
12290
12433
|
variant: "outline",
|
|
@@ -12300,11 +12443,11 @@ function CarouselNext({ className, disabled, onClick, ...props }) {
|
|
|
12300
12443
|
onClick?.(e);
|
|
12301
12444
|
if (!e.defaultPrevented && !isDisabled) scrollNext();
|
|
12302
12445
|
},
|
|
12303
|
-
children: /* @__PURE__ */ (0,
|
|
12446
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(
|
|
12304
12447
|
WebIcon,
|
|
12305
12448
|
{
|
|
12306
12449
|
name: "chevron-right",
|
|
12307
|
-
size:
|
|
12450
|
+
size: import_tokens28.iconSizes.small,
|
|
12308
12451
|
color: "currentColor",
|
|
12309
12452
|
iconStyle: "filled",
|
|
12310
12453
|
fallback: "\u203A"
|
|
@@ -12315,9 +12458,9 @@ function CarouselNext({ className, disabled, onClick, ...props }) {
|
|
|
12315
12458
|
}
|
|
12316
12459
|
function CarouselIndicators({ className, ...props }) {
|
|
12317
12460
|
const { count, index, scrollTo } = useCarouselContext("CarouselIndicators");
|
|
12318
|
-
const trackRef = (0,
|
|
12319
|
-
const [thumb, setThumb] = (0,
|
|
12320
|
-
const updateThumb = (0,
|
|
12461
|
+
const trackRef = (0, import_react46.useRef)(null);
|
|
12462
|
+
const [thumb, setThumb] = (0, import_react46.useState)({ width: 0, x: 0, ready: false });
|
|
12463
|
+
const updateThumb = (0, import_react46.useCallback)(() => {
|
|
12321
12464
|
const el = trackRef.current;
|
|
12322
12465
|
if (!el || count <= 0) {
|
|
12323
12466
|
setThumb({ width: 0, x: 0, ready: false });
|
|
@@ -12332,10 +12475,10 @@ function CarouselIndicators({ className, ...props }) {
|
|
|
12332
12475
|
ready: true
|
|
12333
12476
|
});
|
|
12334
12477
|
}, [count, index]);
|
|
12335
|
-
(0,
|
|
12478
|
+
(0, import_react46.useLayoutEffect)(() => {
|
|
12336
12479
|
updateThumb();
|
|
12337
12480
|
}, [updateThumb]);
|
|
12338
|
-
(0,
|
|
12481
|
+
(0, import_react46.useEffect)(() => {
|
|
12339
12482
|
const el = trackRef.current;
|
|
12340
12483
|
if (!el) return;
|
|
12341
12484
|
const ro = new ResizeObserver(() => updateThumb());
|
|
@@ -12347,7 +12490,7 @@ function CarouselIndicators({ className, ...props }) {
|
|
|
12347
12490
|
width: thumb.width,
|
|
12348
12491
|
transform: `translate3d(${thumb.x}px, 0, 0)`
|
|
12349
12492
|
};
|
|
12350
|
-
return /* @__PURE__ */ (0,
|
|
12493
|
+
return /* @__PURE__ */ (0, import_jsx_runtime68.jsxs)(
|
|
12351
12494
|
"div",
|
|
12352
12495
|
{
|
|
12353
12496
|
ref: trackRef,
|
|
@@ -12357,7 +12500,7 @@ function CarouselIndicators({ className, ...props }) {
|
|
|
12357
12500
|
className: (0, import_clsx89.clsx)(carouselStyles.indicators, className),
|
|
12358
12501
|
...props,
|
|
12359
12502
|
children: [
|
|
12360
|
-
/* @__PURE__ */ (0,
|
|
12503
|
+
/* @__PURE__ */ (0, import_jsx_runtime68.jsx)(
|
|
12361
12504
|
"span",
|
|
12362
12505
|
{
|
|
12363
12506
|
"data-refineui": "carousel-indicator-thumb",
|
|
@@ -12367,7 +12510,7 @@ function CarouselIndicators({ className, ...props }) {
|
|
|
12367
12510
|
style: thumbStyle
|
|
12368
12511
|
}
|
|
12369
12512
|
),
|
|
12370
|
-
/* @__PURE__ */ (0,
|
|
12513
|
+
/* @__PURE__ */ (0, import_jsx_runtime68.jsx)("div", { "data-refineui": "carousel-indicator-hits", className: carouselStyles.indicatorHitRow, children: Array.from({ length: count }, (_, i) => /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(
|
|
12371
12514
|
"button",
|
|
12372
12515
|
{
|
|
12373
12516
|
type: "button",
|
|
@@ -12388,7 +12531,7 @@ function CarouselIndicators({ className, ...props }) {
|
|
|
12388
12531
|
|
|
12389
12532
|
// src/components/Bubble/Bubble.tsx
|
|
12390
12533
|
var import_clsx91 = require("clsx");
|
|
12391
|
-
var
|
|
12534
|
+
var import_react47 = require("react");
|
|
12392
12535
|
|
|
12393
12536
|
// src/components/Bubble/style.ts
|
|
12394
12537
|
var import_clsx90 = require("clsx");
|
|
@@ -12453,21 +12596,21 @@ var bubbleContentVariantClass = {
|
|
|
12453
12596
|
};
|
|
12454
12597
|
|
|
12455
12598
|
// src/components/Bubble/Bubble.tsx
|
|
12456
|
-
var
|
|
12457
|
-
var BubbleContext = (0,
|
|
12599
|
+
var import_jsx_runtime69 = require("react/jsx-runtime");
|
|
12600
|
+
var BubbleContext = (0, import_react47.createContext)(null);
|
|
12458
12601
|
function useBubbleContext(component) {
|
|
12459
|
-
const value = (0,
|
|
12602
|
+
const value = (0, import_react47.useContext)(BubbleContext);
|
|
12460
12603
|
if (!value) throw new Error(`${component} must be used within Bubble.`);
|
|
12461
12604
|
return value;
|
|
12462
12605
|
}
|
|
12463
12606
|
function isBubbleReactionsElement(node) {
|
|
12464
|
-
return (0,
|
|
12607
|
+
return (0, import_react47.isValidElement)(node) && node.type === BubbleReactions;
|
|
12465
12608
|
}
|
|
12466
12609
|
function partitionBubbleChildren(children) {
|
|
12467
12610
|
const top = [];
|
|
12468
12611
|
const middle = [];
|
|
12469
12612
|
const bottom = [];
|
|
12470
|
-
|
|
12613
|
+
import_react47.Children.forEach(children, (child) => {
|
|
12471
12614
|
if (!isBubbleReactionsElement(child)) {
|
|
12472
12615
|
middle.push(child);
|
|
12473
12616
|
return;
|
|
@@ -12485,7 +12628,7 @@ function partitionBubbleChildren(children) {
|
|
|
12485
12628
|
};
|
|
12486
12629
|
}
|
|
12487
12630
|
function BubbleGroup({ className, ...props }) {
|
|
12488
|
-
return /* @__PURE__ */ (0,
|
|
12631
|
+
return /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(
|
|
12489
12632
|
"div",
|
|
12490
12633
|
{
|
|
12491
12634
|
"data-refineui": "bubble-group",
|
|
@@ -12504,7 +12647,7 @@ function Bubble({
|
|
|
12504
12647
|
}) {
|
|
12505
12648
|
const rootStyle = variant === "ghost" ? style : { maxWidth: BUBBLE_MAX_WIDTH, ...style };
|
|
12506
12649
|
const { top, middle, bottom, hasTop, hasBottom } = partitionBubbleChildren(children);
|
|
12507
|
-
return /* @__PURE__ */ (0,
|
|
12650
|
+
return /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(BubbleContext.Provider, { value: { variant, align }, children: /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(
|
|
12508
12651
|
"div",
|
|
12509
12652
|
{
|
|
12510
12653
|
"data-refineui": "bubble",
|
|
@@ -12519,7 +12662,7 @@ function Bubble({
|
|
|
12519
12662
|
),
|
|
12520
12663
|
style: rootStyle,
|
|
12521
12664
|
...props,
|
|
12522
|
-
children: /* @__PURE__ */ (0,
|
|
12665
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime69.jsxs)("div", { "data-refineui": "bubble-surface", className: bubbleStyles.surface, children: [
|
|
12523
12666
|
middle,
|
|
12524
12667
|
top,
|
|
12525
12668
|
bottom
|
|
@@ -12529,7 +12672,7 @@ function Bubble({
|
|
|
12529
12672
|
}
|
|
12530
12673
|
function BubbleContent({ className, ...props }) {
|
|
12531
12674
|
const { variant } = useBubbleContext("BubbleContent");
|
|
12532
|
-
return /* @__PURE__ */ (0,
|
|
12675
|
+
return /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(
|
|
12533
12676
|
"div",
|
|
12534
12677
|
{
|
|
12535
12678
|
"data-refineui": "bubble-content",
|
|
@@ -12550,7 +12693,7 @@ function BubbleReactions({
|
|
|
12550
12693
|
}) {
|
|
12551
12694
|
const { align: bubbleAlign } = useBubbleContext("BubbleReactions");
|
|
12552
12695
|
const align = alignProp ?? (bubbleAlign === "start" ? "end" : "start");
|
|
12553
|
-
return /* @__PURE__ */ (0,
|
|
12696
|
+
return /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(
|
|
12554
12697
|
"div",
|
|
12555
12698
|
{
|
|
12556
12699
|
"data-refineui": "bubble-reactions",
|
|
@@ -12569,8 +12712,8 @@ function BubbleReactions({
|
|
|
12569
12712
|
|
|
12570
12713
|
// src/components/Stepper/Stepper.tsx
|
|
12571
12714
|
var import_clsx93 = require("clsx");
|
|
12572
|
-
var
|
|
12573
|
-
var
|
|
12715
|
+
var import_tokens29 = require("@refineui/tokens");
|
|
12716
|
+
var import_react48 = require("react");
|
|
12574
12717
|
|
|
12575
12718
|
// src/components/Stepper/style.ts
|
|
12576
12719
|
var import_clsx92 = require("clsx");
|
|
@@ -12678,17 +12821,17 @@ var stepperConnectorVars = {
|
|
|
12678
12821
|
};
|
|
12679
12822
|
|
|
12680
12823
|
// src/components/Stepper/Stepper.tsx
|
|
12681
|
-
var
|
|
12682
|
-
var StepperContext = (0,
|
|
12683
|
-
var StepperItemContext = (0,
|
|
12684
|
-
var StepperListRegistryContext = (0,
|
|
12824
|
+
var import_jsx_runtime70 = require("react/jsx-runtime");
|
|
12825
|
+
var StepperContext = (0, import_react48.createContext)(null);
|
|
12826
|
+
var StepperItemContext = (0, import_react48.createContext)(null);
|
|
12827
|
+
var StepperListRegistryContext = (0, import_react48.createContext)(null);
|
|
12685
12828
|
function useStepperContext(component) {
|
|
12686
|
-
const v = (0,
|
|
12829
|
+
const v = (0, import_react48.useContext)(StepperContext);
|
|
12687
12830
|
if (!v) throw new Error(`${component} must be used within Stepper.`);
|
|
12688
12831
|
return v;
|
|
12689
12832
|
}
|
|
12690
12833
|
function useStepperItemContext(component) {
|
|
12691
|
-
const v = (0,
|
|
12834
|
+
const v = (0, import_react48.useContext)(StepperItemContext);
|
|
12692
12835
|
if (!v) throw new Error(`${component} must be used within StepperItem.`);
|
|
12693
12836
|
return v;
|
|
12694
12837
|
}
|
|
@@ -12708,16 +12851,16 @@ function Stepper({
|
|
|
12708
12851
|
...props
|
|
12709
12852
|
}) {
|
|
12710
12853
|
const isControlled = valueControlled !== void 0;
|
|
12711
|
-
const [internalValue, setInternalValue] = (0,
|
|
12854
|
+
const [internalValue, setInternalValue] = (0, import_react48.useState)(defaultValue);
|
|
12712
12855
|
const value = isControlled ? valueControlled : internalValue;
|
|
12713
|
-
const setValue = (0,
|
|
12856
|
+
const setValue = (0, import_react48.useCallback)(
|
|
12714
12857
|
(next) => {
|
|
12715
12858
|
if (!isControlled) setInternalValue(next);
|
|
12716
12859
|
onValueChange?.(next);
|
|
12717
12860
|
},
|
|
12718
12861
|
[isControlled, onValueChange]
|
|
12719
12862
|
);
|
|
12720
|
-
const ctx = (0,
|
|
12863
|
+
const ctx = (0, import_react48.useMemo)(
|
|
12721
12864
|
() => ({
|
|
12722
12865
|
value,
|
|
12723
12866
|
setValue,
|
|
@@ -12726,7 +12869,7 @@ function Stepper({
|
|
|
12726
12869
|
}),
|
|
12727
12870
|
[value, setValue, orientation, onValueChange, isControlled]
|
|
12728
12871
|
);
|
|
12729
|
-
return /* @__PURE__ */ (0,
|
|
12872
|
+
return /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(StepperContext.Provider, { value: ctx, children: /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
|
|
12730
12873
|
"div",
|
|
12731
12874
|
{
|
|
12732
12875
|
"data-refineui": "stepper",
|
|
@@ -12740,9 +12883,9 @@ function Stepper({
|
|
|
12740
12883
|
}
|
|
12741
12884
|
function StepperList({ className, children, ...props }) {
|
|
12742
12885
|
const { orientation, value } = useStepperContext("StepperList");
|
|
12743
|
-
const cursorRef = (0,
|
|
12886
|
+
const cursorRef = (0, import_react48.useRef)(null);
|
|
12744
12887
|
cursorRef.current = null;
|
|
12745
|
-
const registry = (0,
|
|
12888
|
+
const registry = (0, import_react48.useMemo)(
|
|
12746
12889
|
() => ({
|
|
12747
12890
|
noteItem(itemValue) {
|
|
12748
12891
|
cursorRef.current = itemValue;
|
|
@@ -12754,7 +12897,7 @@ function StepperList({ className, children, ...props }) {
|
|
|
12754
12897
|
}),
|
|
12755
12898
|
[value]
|
|
12756
12899
|
);
|
|
12757
|
-
return /* @__PURE__ */ (0,
|
|
12900
|
+
return /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(StepperListRegistryContext.Provider, { value: registry, children: /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
|
|
12758
12901
|
"ol",
|
|
12759
12902
|
{
|
|
12760
12903
|
"data-refineui": "stepper-list",
|
|
@@ -12779,7 +12922,7 @@ function StepperItem({
|
|
|
12779
12922
|
...props
|
|
12780
12923
|
}) {
|
|
12781
12924
|
const { value, setValue, orientation, interactive } = useStepperContext("StepperItem");
|
|
12782
|
-
const registry = (0,
|
|
12925
|
+
const registry = (0, import_react48.useContext)(StepperListRegistryContext);
|
|
12783
12926
|
registry?.noteItem(itemValue);
|
|
12784
12927
|
const state = resolveState2(itemValue, value);
|
|
12785
12928
|
const canActivate = interactive && !disabled;
|
|
@@ -12795,11 +12938,11 @@ function StepperItem({
|
|
|
12795
12938
|
activate();
|
|
12796
12939
|
}
|
|
12797
12940
|
};
|
|
12798
|
-
const itemCtx = (0,
|
|
12941
|
+
const itemCtx = (0, import_react48.useMemo)(
|
|
12799
12942
|
() => ({ state, disabled }),
|
|
12800
12943
|
[state, disabled]
|
|
12801
12944
|
);
|
|
12802
|
-
return /* @__PURE__ */ (0,
|
|
12945
|
+
return /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(StepperItemContext.Provider, { value: itemCtx, children: /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
|
|
12803
12946
|
"li",
|
|
12804
12947
|
{
|
|
12805
12948
|
"data-refineui": "stepper-item",
|
|
@@ -12827,18 +12970,18 @@ function StepperItem({
|
|
|
12827
12970
|
function StepperIndicator({ className, children, ...props }) {
|
|
12828
12971
|
const { state } = useStepperItemContext("StepperIndicator");
|
|
12829
12972
|
const stateClass = state === "complete" ? stepperStyles.indicatorComplete : state === "current" ? stepperStyles.indicatorCurrent : stepperStyles.indicatorUpcoming;
|
|
12830
|
-
const content = state === "upcoming" ? children : /* @__PURE__ */ (0,
|
|
12973
|
+
const content = state === "upcoming" ? children : /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
|
|
12831
12974
|
WebIcon,
|
|
12832
12975
|
{
|
|
12833
12976
|
name: "checkmark",
|
|
12834
|
-
size:
|
|
12977
|
+
size: import_tokens29.iconSizes.xsmall,
|
|
12835
12978
|
color: "currentColor",
|
|
12836
12979
|
iconStyle: "filled",
|
|
12837
12980
|
fallback: "\u2713",
|
|
12838
12981
|
className: "items-center justify-center"
|
|
12839
12982
|
}
|
|
12840
12983
|
);
|
|
12841
|
-
return /* @__PURE__ */ (0,
|
|
12984
|
+
return /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
|
|
12842
12985
|
"span",
|
|
12843
12986
|
{
|
|
12844
12987
|
"data-refineui": "stepper-indicator",
|
|
@@ -12853,7 +12996,7 @@ function StepperIndicator({ className, children, ...props }) {
|
|
|
12853
12996
|
function StepperContent({ className, ...props }) {
|
|
12854
12997
|
const { orientation } = useStepperContext("StepperContent");
|
|
12855
12998
|
useStepperItemContext("StepperContent");
|
|
12856
|
-
return /* @__PURE__ */ (0,
|
|
12999
|
+
return /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
|
|
12857
13000
|
"div",
|
|
12858
13001
|
{
|
|
12859
13002
|
"data-refineui": "stepper-content",
|
|
@@ -12869,7 +13012,7 @@ function StepperContent({ className, ...props }) {
|
|
|
12869
13012
|
function StepperTitle({ className, ...props }) {
|
|
12870
13013
|
const { state } = useStepperItemContext("StepperTitle");
|
|
12871
13014
|
const stateClass = state === "complete" ? stepperStyles.titleComplete : state === "current" ? stepperStyles.titleCurrent : stepperStyles.titleUpcoming;
|
|
12872
|
-
return /* @__PURE__ */ (0,
|
|
13015
|
+
return /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
|
|
12873
13016
|
"span",
|
|
12874
13017
|
{
|
|
12875
13018
|
"data-refineui": "stepper-title",
|
|
@@ -12882,7 +13025,7 @@ function StepperTitle({ className, ...props }) {
|
|
|
12882
13025
|
function StepperDescription({ className, ...props }) {
|
|
12883
13026
|
const { state } = useStepperItemContext("StepperDescription");
|
|
12884
13027
|
const stateClass = state === "complete" ? stepperStyles.descriptionComplete : state === "current" ? stepperStyles.descriptionCurrent : stepperStyles.descriptionUpcoming;
|
|
12885
|
-
return /* @__PURE__ */ (0,
|
|
13028
|
+
return /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
|
|
12886
13029
|
"span",
|
|
12887
13030
|
{
|
|
12888
13031
|
"data-refineui": "stepper-description",
|
|
@@ -12894,10 +13037,10 @@ function StepperDescription({ className, ...props }) {
|
|
|
12894
13037
|
}
|
|
12895
13038
|
function StepperSeparator({ className, ...props }) {
|
|
12896
13039
|
const { orientation } = useStepperContext("StepperSeparator");
|
|
12897
|
-
const registry = (0,
|
|
13040
|
+
const registry = (0, import_react48.useContext)(StepperListRegistryContext);
|
|
12898
13041
|
const state = registry?.takeSeparatorState() ?? "upcoming";
|
|
12899
13042
|
const vertical = orientation === "vertical";
|
|
12900
|
-
return /* @__PURE__ */ (0,
|
|
13043
|
+
return /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
|
|
12901
13044
|
"li",
|
|
12902
13045
|
{
|
|
12903
13046
|
"data-refineui": "stepper-separator",
|
|
@@ -12911,7 +13054,7 @@ function StepperSeparator({ className, ...props }) {
|
|
|
12911
13054
|
className
|
|
12912
13055
|
),
|
|
12913
13056
|
...props,
|
|
12914
|
-
children: /* @__PURE__ */ (0,
|
|
13057
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)(
|
|
12915
13058
|
"span",
|
|
12916
13059
|
{
|
|
12917
13060
|
"data-refineui": "stepper-separator-rail",
|
|
@@ -12920,14 +13063,14 @@ function StepperSeparator({ className, ...props }) {
|
|
|
12920
13063
|
vertical ? stepperStyles.separatorRailVertical : stepperStyles.separatorRailHorizontal
|
|
12921
13064
|
),
|
|
12922
13065
|
children: [
|
|
12923
|
-
/* @__PURE__ */ (0,
|
|
13066
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
|
|
12924
13067
|
"span",
|
|
12925
13068
|
{
|
|
12926
13069
|
"data-refineui": "stepper-separator-track",
|
|
12927
13070
|
className: stepperStyles.separatorTrack
|
|
12928
13071
|
}
|
|
12929
13072
|
),
|
|
12930
|
-
/* @__PURE__ */ (0,
|
|
13073
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
|
|
12931
13074
|
"span",
|
|
12932
13075
|
{
|
|
12933
13076
|
"data-refineui": "stepper-separator-fill",
|
|
@@ -12955,7 +13098,7 @@ StepperSeparator.displayName = "StepperSeparator";
|
|
|
12955
13098
|
|
|
12956
13099
|
// src/components/Resizable/Resizable.tsx
|
|
12957
13100
|
var import_clsx95 = require("clsx");
|
|
12958
|
-
var
|
|
13101
|
+
var import_react49 = require("react");
|
|
12959
13102
|
|
|
12960
13103
|
// src/components/Resizable/style.ts
|
|
12961
13104
|
var import_clsx94 = require("clsx");
|
|
@@ -12990,15 +13133,15 @@ var resizableStyles = {
|
|
|
12990
13133
|
};
|
|
12991
13134
|
|
|
12992
13135
|
// src/components/Resizable/Resizable.tsx
|
|
12993
|
-
var
|
|
13136
|
+
var import_jsx_runtime71 = require("react/jsx-runtime");
|
|
12994
13137
|
var KEYBOARD_STEP = 2;
|
|
12995
13138
|
var KEYBOARD_STEP_LARGE = 10;
|
|
12996
13139
|
var DEFAULT_SIZE = 50;
|
|
12997
13140
|
var DEFAULT_MIN_SIZE = 10;
|
|
12998
13141
|
var DEFAULT_MAX_SIZE = 100;
|
|
12999
|
-
var ResizableContext = (0,
|
|
13142
|
+
var ResizableContext = (0, import_react49.createContext)(null);
|
|
13000
13143
|
function useResizableContext(component) {
|
|
13001
|
-
const v = (0,
|
|
13144
|
+
const v = (0, import_react49.useContext)(ResizableContext);
|
|
13002
13145
|
if (!v) throw new Error(`${component} must be used within ResizablePanelGroup.`);
|
|
13003
13146
|
return v;
|
|
13004
13147
|
}
|
|
@@ -13057,13 +13200,13 @@ function ResizablePanelGroup({
|
|
|
13057
13200
|
onLayout,
|
|
13058
13201
|
...props
|
|
13059
13202
|
}) {
|
|
13060
|
-
const groupRef = (0,
|
|
13061
|
-
const panelsRef = (0,
|
|
13062
|
-
const orderCounterRef = (0,
|
|
13063
|
-
const [sizes, setSizes] = (0,
|
|
13064
|
-
const onLayoutRef = (0,
|
|
13203
|
+
const groupRef = (0, import_react49.useRef)(null);
|
|
13204
|
+
const panelsRef = (0, import_react49.useRef)(/* @__PURE__ */ new Map());
|
|
13205
|
+
const orderCounterRef = (0, import_react49.useRef)(0);
|
|
13206
|
+
const [sizes, setSizes] = (0, import_react49.useState)({});
|
|
13207
|
+
const onLayoutRef = (0, import_react49.useRef)(onLayout);
|
|
13065
13208
|
onLayoutRef.current = onLayout;
|
|
13066
|
-
const syncInitialSizes = (0,
|
|
13209
|
+
const syncInitialSizes = (0, import_react49.useCallback)(() => {
|
|
13067
13210
|
const panels = [...panelsRef.current.values()].sort((a, b) => a.order - b.order);
|
|
13068
13211
|
if (panels.length === 0) return;
|
|
13069
13212
|
setSizes((prev) => {
|
|
@@ -13098,7 +13241,7 @@ function ResizablePanelGroup({
|
|
|
13098
13241
|
return base;
|
|
13099
13242
|
});
|
|
13100
13243
|
}, []);
|
|
13101
|
-
const registerPanel = (0,
|
|
13244
|
+
const registerPanel = (0, import_react49.useCallback)(
|
|
13102
13245
|
(panel) => {
|
|
13103
13246
|
const existing = panelsRef.current.get(panel.id);
|
|
13104
13247
|
const order = existing?.order ?? orderCounterRef.current++;
|
|
@@ -13107,7 +13250,7 @@ function ResizablePanelGroup({
|
|
|
13107
13250
|
},
|
|
13108
13251
|
[syncInitialSizes]
|
|
13109
13252
|
);
|
|
13110
|
-
const unregisterPanel = (0,
|
|
13253
|
+
const unregisterPanel = (0, import_react49.useCallback)((id) => {
|
|
13111
13254
|
panelsRef.current.delete(id);
|
|
13112
13255
|
setSizes((prev) => {
|
|
13113
13256
|
if (!(id in prev)) return prev;
|
|
@@ -13116,13 +13259,13 @@ function ResizablePanelGroup({
|
|
|
13116
13259
|
return next;
|
|
13117
13260
|
});
|
|
13118
13261
|
}, []);
|
|
13119
|
-
const getPanel = (0,
|
|
13120
|
-
const emitPanelResize = (0,
|
|
13262
|
+
const getPanel = (0, import_react49.useCallback)((id) => panelsRef.current.get(id), []);
|
|
13263
|
+
const emitPanelResize = (0, import_react49.useCallback)((next) => {
|
|
13121
13264
|
for (const [id, size] of Object.entries(next)) {
|
|
13122
13265
|
panelsRef.current.get(id)?.onResize?.(size);
|
|
13123
13266
|
}
|
|
13124
13267
|
}, []);
|
|
13125
|
-
const resizeBetween = (0,
|
|
13268
|
+
const resizeBetween = (0, import_react49.useCallback)(
|
|
13126
13269
|
(leftId, rightId, deltaPct) => {
|
|
13127
13270
|
setSizes((prev) => {
|
|
13128
13271
|
const next = applyResize(
|
|
@@ -13139,7 +13282,7 @@ function ResizablePanelGroup({
|
|
|
13139
13282
|
},
|
|
13140
13283
|
[emitPanelResize]
|
|
13141
13284
|
);
|
|
13142
|
-
const setBetween = (0,
|
|
13285
|
+
const setBetween = (0, import_react49.useCallback)(
|
|
13143
13286
|
(leftId, rightId, leftSize) => {
|
|
13144
13287
|
setSizes((prev) => {
|
|
13145
13288
|
const left = panelsRef.current.get(leftId);
|
|
@@ -13164,13 +13307,13 @@ function ResizablePanelGroup({
|
|
|
13164
13307
|
},
|
|
13165
13308
|
[emitPanelResize]
|
|
13166
13309
|
);
|
|
13167
|
-
(0,
|
|
13310
|
+
(0, import_react49.useLayoutEffect)(() => {
|
|
13168
13311
|
const ids = orderedPanelIds(panelsRef.current);
|
|
13169
13312
|
if (ids.length === 0) return;
|
|
13170
13313
|
if (ids.some((id) => sizes[id] === void 0)) return;
|
|
13171
13314
|
onLayoutRef.current?.(ids.map((id) => sizes[id]));
|
|
13172
13315
|
}, [sizes]);
|
|
13173
|
-
const ctx = (0,
|
|
13316
|
+
const ctx = (0, import_react49.useMemo)(
|
|
13174
13317
|
() => ({
|
|
13175
13318
|
orientation,
|
|
13176
13319
|
groupRef,
|
|
@@ -13191,7 +13334,7 @@ function ResizablePanelGroup({
|
|
|
13191
13334
|
setBetween
|
|
13192
13335
|
]
|
|
13193
13336
|
);
|
|
13194
|
-
return /* @__PURE__ */ (0,
|
|
13337
|
+
return /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(ResizableContext.Provider, { value: ctx, children: /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
|
|
13195
13338
|
"div",
|
|
13196
13339
|
{
|
|
13197
13340
|
ref: groupRef,
|
|
@@ -13219,11 +13362,11 @@ function ResizablePanel({
|
|
|
13219
13362
|
onResize,
|
|
13220
13363
|
...props
|
|
13221
13364
|
}) {
|
|
13222
|
-
const id = (0,
|
|
13365
|
+
const id = (0, import_react49.useId)();
|
|
13223
13366
|
const { orientation, sizes, registerPanel, unregisterPanel } = useResizableContext("ResizablePanel");
|
|
13224
|
-
const onResizeRef = (0,
|
|
13367
|
+
const onResizeRef = (0, import_react49.useRef)(onResize);
|
|
13225
13368
|
onResizeRef.current = onResize;
|
|
13226
|
-
(0,
|
|
13369
|
+
(0, import_react49.useLayoutEffect)(() => {
|
|
13227
13370
|
registerPanel({
|
|
13228
13371
|
id,
|
|
13229
13372
|
defaultSize,
|
|
@@ -13250,7 +13393,7 @@ function ResizablePanel({
|
|
|
13250
13393
|
flexBasis: 0,
|
|
13251
13394
|
...orientation === "horizontal" ? { minWidth: `${minSize}%` } : { minHeight: `${minSize}%` }
|
|
13252
13395
|
};
|
|
13253
|
-
return /* @__PURE__ */ (0,
|
|
13396
|
+
return /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
|
|
13254
13397
|
"div",
|
|
13255
13398
|
{
|
|
13256
13399
|
"data-refineui": "resizable-panel",
|
|
@@ -13281,11 +13424,11 @@ function ResizableHandle({
|
|
|
13281
13424
|
resizeBetween,
|
|
13282
13425
|
setBetween
|
|
13283
13426
|
} = useResizableContext("ResizableHandle");
|
|
13284
|
-
const handleRef = (0,
|
|
13285
|
-
const [active, setActive] = (0,
|
|
13286
|
-
const [, setAdjacentReady] = (0,
|
|
13287
|
-
const dragRef = (0,
|
|
13288
|
-
(0,
|
|
13427
|
+
const handleRef = (0, import_react49.useRef)(null);
|
|
13428
|
+
const [active, setActive] = (0, import_react49.useState)(false);
|
|
13429
|
+
const [, setAdjacentReady] = (0, import_react49.useState)(false);
|
|
13430
|
+
const dragRef = (0, import_react49.useRef)(null);
|
|
13431
|
+
(0, import_react49.useLayoutEffect)(() => {
|
|
13289
13432
|
setAdjacentReady(true);
|
|
13290
13433
|
}, []);
|
|
13291
13434
|
const adjacent = handleRef.current ? findAdjacentPanelIds(handleRef.current) : { leftId: null, rightId: null };
|
|
@@ -13296,7 +13439,7 @@ function ResizableHandle({
|
|
|
13296
13439
|
const ariaMin = leftPanel?.minSize ?? 0;
|
|
13297
13440
|
const ariaMax = leftPanel?.maxSize ?? DEFAULT_MAX_SIZE;
|
|
13298
13441
|
const defaultKeyshortcuts = orientation === "horizontal" ? "ArrowLeft ArrowRight Home End" : "ArrowUp ArrowDown Home End";
|
|
13299
|
-
const keepFocus = (0,
|
|
13442
|
+
const keepFocus = (0, import_react49.useCallback)(() => {
|
|
13300
13443
|
const el = handleRef.current;
|
|
13301
13444
|
if (el && document.activeElement !== el) {
|
|
13302
13445
|
el.focus({ preventScroll: true });
|
|
@@ -13395,7 +13538,7 @@ function ResizableHandle({
|
|
|
13395
13538
|
resizeBetween(leftId, rightId, delta);
|
|
13396
13539
|
queueMicrotask(keepFocus);
|
|
13397
13540
|
};
|
|
13398
|
-
return /* @__PURE__ */ (0,
|
|
13541
|
+
return /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
|
|
13399
13542
|
"div",
|
|
13400
13543
|
{
|
|
13401
13544
|
ref: handleRef,
|
|
@@ -13425,7 +13568,7 @@ function ResizableHandle({
|
|
|
13425
13568
|
onPointerUp: handlePointerUp,
|
|
13426
13569
|
onPointerCancel: handlePointerUp,
|
|
13427
13570
|
onKeyDown: handleKeyDown,
|
|
13428
|
-
children: withHandle ? /* @__PURE__ */ (0,
|
|
13571
|
+
children: withHandle ? /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
|
|
13429
13572
|
"span",
|
|
13430
13573
|
{
|
|
13431
13574
|
"aria-hidden": true,
|
|
@@ -13441,8 +13584,8 @@ function ResizableHandle({
|
|
|
13441
13584
|
|
|
13442
13585
|
// src/components/SpinButton/SpinButton.tsx
|
|
13443
13586
|
var import_clsx96 = require("clsx");
|
|
13444
|
-
var
|
|
13445
|
-
var
|
|
13587
|
+
var import_react50 = require("react");
|
|
13588
|
+
var import_tokens30 = require("@refineui/tokens");
|
|
13446
13589
|
|
|
13447
13590
|
// src/components/SpinButton/style.ts
|
|
13448
13591
|
var spinButtonStyles = {
|
|
@@ -13465,7 +13608,7 @@ var spinButtonShellClass = formControlShellHeightClass;
|
|
|
13465
13608
|
var spinButtonValueTypo = formControlTypoClass;
|
|
13466
13609
|
|
|
13467
13610
|
// src/components/SpinButton/SpinButton.tsx
|
|
13468
|
-
var
|
|
13611
|
+
var import_jsx_runtime72 = require("react/jsx-runtime");
|
|
13469
13612
|
function SpinButton({
|
|
13470
13613
|
value,
|
|
13471
13614
|
onChange,
|
|
@@ -13479,8 +13622,8 @@ function SpinButton({
|
|
|
13479
13622
|
onKeyDown,
|
|
13480
13623
|
...props
|
|
13481
13624
|
}) {
|
|
13482
|
-
const [draftValue, setDraftValue] = (0,
|
|
13483
|
-
(0,
|
|
13625
|
+
const [draftValue, setDraftValue] = (0, import_react50.useState)(String(value));
|
|
13626
|
+
(0, import_react50.useEffect)(() => {
|
|
13484
13627
|
setDraftValue(String(value));
|
|
13485
13628
|
}, [value]);
|
|
13486
13629
|
const clampValue2 = (next) => {
|
|
@@ -13568,7 +13711,7 @@ function SpinButton({
|
|
|
13568
13711
|
const atMax = max !== void 0 && value >= max;
|
|
13569
13712
|
const atMin = min !== void 0 && value <= min;
|
|
13570
13713
|
const borderClass = disabled ? spinButtonStyles.borderDisabled : spinButtonStyles.borderDefault;
|
|
13571
|
-
return /* @__PURE__ */ (0,
|
|
13714
|
+
return /* @__PURE__ */ (0, import_jsx_runtime72.jsxs)(
|
|
13572
13715
|
"div",
|
|
13573
13716
|
{
|
|
13574
13717
|
role: "spinbutton",
|
|
@@ -13591,7 +13734,7 @@ function SpinButton({
|
|
|
13591
13734
|
...props,
|
|
13592
13735
|
onKeyDown: handleKeyDown,
|
|
13593
13736
|
children: [
|
|
13594
|
-
/* @__PURE__ */ (0,
|
|
13737
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
|
|
13595
13738
|
"div",
|
|
13596
13739
|
{
|
|
13597
13740
|
"aria-live": "polite",
|
|
@@ -13602,7 +13745,7 @@ function SpinButton({
|
|
|
13602
13745
|
disabled ? spinButtonStyles.valueTextDisabled : spinButtonStyles.valueTextDefault,
|
|
13603
13746
|
disabled ? spinButtonStyles.bgDisabled : spinButtonStyles.bgDefault
|
|
13604
13747
|
),
|
|
13605
|
-
children: /* @__PURE__ */ (0,
|
|
13748
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
|
|
13606
13749
|
"input",
|
|
13607
13750
|
{
|
|
13608
13751
|
type: "text",
|
|
@@ -13627,7 +13770,7 @@ function SpinButton({
|
|
|
13627
13770
|
)
|
|
13628
13771
|
}
|
|
13629
13772
|
),
|
|
13630
|
-
/* @__PURE__ */ (0,
|
|
13773
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsxs)(
|
|
13631
13774
|
"div",
|
|
13632
13775
|
{
|
|
13633
13776
|
className: (0, import_clsx96.clsx)(
|
|
@@ -13635,7 +13778,7 @@ function SpinButton({
|
|
|
13635
13778
|
disabled ? spinButtonStyles.bgDisabled : spinButtonStyles.bgDefault
|
|
13636
13779
|
),
|
|
13637
13780
|
children: [
|
|
13638
|
-
/* @__PURE__ */ (0,
|
|
13781
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
|
|
13639
13782
|
"button",
|
|
13640
13783
|
{
|
|
13641
13784
|
type: "button",
|
|
@@ -13647,11 +13790,11 @@ function SpinButton({
|
|
|
13647
13790
|
spinButtonStyles.stepButtonBase,
|
|
13648
13791
|
disabled || atMax ? spinButtonStyles.stepButtonDisabled : spinButtonStyles.stepButtonEnabled
|
|
13649
13792
|
),
|
|
13650
|
-
children: /* @__PURE__ */ (0,
|
|
13793
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
|
|
13651
13794
|
WebIcon,
|
|
13652
13795
|
{
|
|
13653
13796
|
name: "chevron-up",
|
|
13654
|
-
size:
|
|
13797
|
+
size: import_tokens30.iconSizes.xsmall,
|
|
13655
13798
|
color: "currentColor",
|
|
13656
13799
|
iconStyle: "filled",
|
|
13657
13800
|
fallback: "\u25B2"
|
|
@@ -13659,7 +13802,7 @@ function SpinButton({
|
|
|
13659
13802
|
)
|
|
13660
13803
|
}
|
|
13661
13804
|
),
|
|
13662
|
-
/* @__PURE__ */ (0,
|
|
13805
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
|
|
13663
13806
|
"button",
|
|
13664
13807
|
{
|
|
13665
13808
|
type: "button",
|
|
@@ -13671,11 +13814,11 @@ function SpinButton({
|
|
|
13671
13814
|
spinButtonStyles.stepButtonBase,
|
|
13672
13815
|
disabled || atMin ? spinButtonStyles.stepButtonDisabled : spinButtonStyles.stepButtonEnabled
|
|
13673
13816
|
),
|
|
13674
|
-
children: /* @__PURE__ */ (0,
|
|
13817
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
|
|
13675
13818
|
WebIcon,
|
|
13676
13819
|
{
|
|
13677
13820
|
name: "chevron-down",
|
|
13678
|
-
size:
|
|
13821
|
+
size: import_tokens30.iconSizes.xsmall,
|
|
13679
13822
|
color: "currentColor",
|
|
13680
13823
|
iconStyle: "filled",
|
|
13681
13824
|
fallback: "\u25BC"
|
|
@@ -13693,9 +13836,9 @@ function SpinButton({
|
|
|
13693
13836
|
|
|
13694
13837
|
// src/components/Toast/Toast.tsx
|
|
13695
13838
|
var import_clsx98 = require("clsx");
|
|
13696
|
-
var
|
|
13839
|
+
var import_react51 = require("react");
|
|
13697
13840
|
var import_react_dom7 = require("react-dom");
|
|
13698
|
-
var
|
|
13841
|
+
var import_tokens31 = require("@refineui/tokens");
|
|
13699
13842
|
var import_animation7 = require("@refineui/utilities/animation");
|
|
13700
13843
|
var import_color12 = require("@refineui/utilities/color");
|
|
13701
13844
|
|
|
@@ -13703,7 +13846,7 @@ var import_color12 = require("@refineui/utilities/color");
|
|
|
13703
13846
|
var import_clsx97 = require("clsx");
|
|
13704
13847
|
var toastRecipe = defineRecipe({
|
|
13705
13848
|
name: "toast",
|
|
13706
|
-
base: "relative isolate box-border flex w-fit
|
|
13849
|
+
base: "relative isolate box-border flex w-fit max-w-refineui-toast-max-width cursor-grab items-center gap-refineui-size-small rounded-refineui-x-large border-refineui-hairline border-refineui-alias-border-default bg-refineui-alias-background-primary py-refineui-size-medium ps-refineui-size-medium pe-refineui-size-large select-none",
|
|
13707
13850
|
variants: {
|
|
13708
13851
|
variant: {
|
|
13709
13852
|
default: "",
|
|
@@ -13730,8 +13873,8 @@ var toastStyles = {
|
|
|
13730
13873
|
};
|
|
13731
13874
|
|
|
13732
13875
|
// src/components/Toast/Toast.tsx
|
|
13733
|
-
var
|
|
13734
|
-
var
|
|
13876
|
+
var import_jsx_runtime73 = require("react/jsx-runtime");
|
|
13877
|
+
var useIsomorphicLayoutEffect7 = typeof document !== "undefined" ? import_react51.useLayoutEffect : import_react51.useEffect;
|
|
13735
13878
|
var ENTER_MS = 20;
|
|
13736
13879
|
var LEAVE_MS = (0, import_animation7.motionMsToNumber)(componentTokens.toast.motion.leave) + 60;
|
|
13737
13880
|
var DEFAULT_DURATION = 4200;
|
|
@@ -13754,10 +13897,10 @@ function gapPxFromSpacingToken(token) {
|
|
|
13754
13897
|
var TOAST_NARROW_STACK_MQ = "(max-width: 480px), (hover: none)";
|
|
13755
13898
|
function readToastStackGapPx() {
|
|
13756
13899
|
if (typeof globalThis.matchMedia === "undefined") {
|
|
13757
|
-
return gapPxFromSpacingToken(String(
|
|
13900
|
+
return gapPxFromSpacingToken(String(import_tokens31.spacings.sizeLarge));
|
|
13758
13901
|
}
|
|
13759
13902
|
const mq = globalThis.matchMedia(TOAST_NARROW_STACK_MQ);
|
|
13760
|
-
return gapPxFromSpacingToken(mq.matches ? String(
|
|
13903
|
+
return gapPxFromSpacingToken(mq.matches ? String(import_tokens31.spacings.sizeMedium) : String(import_tokens31.spacings.sizeLarge));
|
|
13761
13904
|
}
|
|
13762
13905
|
function subscribeToastStackGap(onChange) {
|
|
13763
13906
|
if (typeof globalThis.matchMedia === "undefined") return () => {
|
|
@@ -13767,10 +13910,10 @@ function subscribeToastStackGap(onChange) {
|
|
|
13767
13910
|
return () => mq.removeEventListener("change", onChange);
|
|
13768
13911
|
}
|
|
13769
13912
|
function useToastStackGapPx() {
|
|
13770
|
-
return (0,
|
|
13913
|
+
return (0, import_react51.useSyncExternalStore)(
|
|
13771
13914
|
subscribeToastStackGap,
|
|
13772
13915
|
readToastStackGapPx,
|
|
13773
|
-
() => gapPxFromSpacingToken(String(
|
|
13916
|
+
() => gapPxFromSpacingToken(String(import_tokens31.spacings.sizeLarge))
|
|
13774
13917
|
);
|
|
13775
13918
|
}
|
|
13776
13919
|
function readToastNaturalHeight(li) {
|
|
@@ -13909,7 +14052,7 @@ var variantIconNames = {
|
|
|
13909
14052
|
error: "error-circle",
|
|
13910
14053
|
warning: "warning"
|
|
13911
14054
|
};
|
|
13912
|
-
var Toast = (0,
|
|
14055
|
+
var Toast = (0, import_react51.forwardRef)(function Toast2(props, ref) {
|
|
13913
14056
|
const { variant = "default", message, iconName, icon, action, className, stackState, style, ...rest } = props;
|
|
13914
14057
|
const domProps = { ...rest };
|
|
13915
14058
|
delete domProps.iconName;
|
|
@@ -13918,17 +14061,17 @@ var Toast = (0, import_react50.forwardRef)(function Toast2(props, ref) {
|
|
|
13918
14061
|
const liveRole = variant === "error" ? "alert" : "status";
|
|
13919
14062
|
const ariaLive = variant === "error" ? void 0 : variant === "warning" ? "assertive" : "polite";
|
|
13920
14063
|
const resolvedIconName = iconName ?? variantIconNames[variant];
|
|
13921
|
-
const iconContent = icon ?? /* @__PURE__ */ (0,
|
|
14064
|
+
const iconContent = icon ?? /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(
|
|
13922
14065
|
WebIcon,
|
|
13923
14066
|
{
|
|
13924
14067
|
name: resolvedIconName,
|
|
13925
|
-
size:
|
|
14068
|
+
size: import_tokens31.iconSizes.medium,
|
|
13926
14069
|
color: "currentColor",
|
|
13927
14070
|
iconStyle: "filled"
|
|
13928
14071
|
}
|
|
13929
14072
|
);
|
|
13930
14073
|
const isPrimaryAction = !action || typeof action !== "object" || !("variant" in action) || action.variant === "primary";
|
|
13931
|
-
const actionEl = typeof action === "object" && action !== null && "label" in action ? /* @__PURE__ */ (0,
|
|
14074
|
+
const actionEl = typeof action === "object" && action !== null && "label" in action ? /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(
|
|
13932
14075
|
Button,
|
|
13933
14076
|
{
|
|
13934
14077
|
variant: isPrimaryAction ? "primary" : "outline",
|
|
@@ -13944,7 +14087,7 @@ var Toast = (0, import_react50.forwardRef)(function Toast2(props, ref) {
|
|
|
13944
14087
|
borderColor: (0, import_color12.resolveColorTokenValue)(color.border),
|
|
13945
14088
|
color: (0, import_color12.resolveColorTokenValue)(color.message)
|
|
13946
14089
|
};
|
|
13947
|
-
return /* @__PURE__ */ (0,
|
|
14090
|
+
return /* @__PURE__ */ (0, import_jsx_runtime73.jsxs)(
|
|
13948
14091
|
"div",
|
|
13949
14092
|
{
|
|
13950
14093
|
ref,
|
|
@@ -13957,20 +14100,20 @@ var Toast = (0, import_react50.forwardRef)(function Toast2(props, ref) {
|
|
|
13957
14100
|
style: { ...tokenStyle, ...style },
|
|
13958
14101
|
className: (0, import_clsx98.clsx)(toastStyles.card, className),
|
|
13959
14102
|
children: [
|
|
13960
|
-
/* @__PURE__ */ (0,
|
|
13961
|
-
/* @__PURE__ */ (0,
|
|
14103
|
+
/* @__PURE__ */ (0, import_jsx_runtime73.jsx)("div", { "data-refineui": "toast-icon", className: toastStyles.iconWrap, children: iconContent }),
|
|
14104
|
+
/* @__PURE__ */ (0, import_jsx_runtime73.jsx)("div", { className: toastStyles.contentWrap, children: message != null && message !== "" ? /* @__PURE__ */ (0, import_jsx_runtime73.jsx)("div", { className: toastStyles.message, children: message }) : null }),
|
|
13962
14105
|
action != null && actionEl
|
|
13963
14106
|
]
|
|
13964
14107
|
}
|
|
13965
14108
|
);
|
|
13966
14109
|
});
|
|
13967
14110
|
function SwipeableToast({ record, index, swipeDirections, onSwipeStart, onSwipeEnd }) {
|
|
13968
|
-
const toastRef = (0,
|
|
13969
|
-
const dragStartRef = (0,
|
|
13970
|
-
const axisRef = (0,
|
|
13971
|
-
const offsetRef = (0,
|
|
13972
|
-
const [swiping, setSwiping] = (0,
|
|
13973
|
-
const clearSwipeOffset = (0,
|
|
14111
|
+
const toastRef = (0, import_react51.useRef)(null);
|
|
14112
|
+
const dragStartRef = (0, import_react51.useRef)(null);
|
|
14113
|
+
const axisRef = (0, import_react51.useRef)(null);
|
|
14114
|
+
const offsetRef = (0, import_react51.useRef)({ x: 0, y: 0 });
|
|
14115
|
+
const [swiping, setSwiping] = (0, import_react51.useState)(false);
|
|
14116
|
+
const clearSwipeOffset = (0, import_react51.useCallback)(() => {
|
|
13974
14117
|
const el = toastRef.current;
|
|
13975
14118
|
offsetRef.current = { x: 0, y: 0 };
|
|
13976
14119
|
if (!el) return;
|
|
@@ -14045,7 +14188,7 @@ function SwipeableToast({ record, index, swipeDirections, onSwipeStart, onSwipeE
|
|
|
14045
14188
|
clearSwipeOffset();
|
|
14046
14189
|
onSwipeEnd();
|
|
14047
14190
|
};
|
|
14048
|
-
return /* @__PURE__ */ (0,
|
|
14191
|
+
return /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(
|
|
14049
14192
|
Toast,
|
|
14050
14193
|
{
|
|
14051
14194
|
ref: toastRef,
|
|
@@ -14071,8 +14214,8 @@ function Toaster({
|
|
|
14071
14214
|
swipeDirections,
|
|
14072
14215
|
className
|
|
14073
14216
|
}) {
|
|
14074
|
-
const toasterKeyRef = (0,
|
|
14075
|
-
const isPortalOwner = (0,
|
|
14217
|
+
const toasterKeyRef = (0, import_react51.useRef)(/* @__PURE__ */ Symbol("refineui-toaster"));
|
|
14218
|
+
const isPortalOwner = (0, import_react51.useSyncExternalStore)(
|
|
14076
14219
|
(onStoreChange) => {
|
|
14077
14220
|
toasterOwnerListeners.add(onStoreChange);
|
|
14078
14221
|
return () => toasterOwnerListeners.delete(onStoreChange);
|
|
@@ -14080,15 +14223,15 @@ function Toaster({
|
|
|
14080
14223
|
() => activeToasterKey === toasterKeyRef.current,
|
|
14081
14224
|
() => false
|
|
14082
14225
|
);
|
|
14083
|
-
const [records, setRecords] = (0,
|
|
14084
|
-
const timerMapRef = (0,
|
|
14085
|
-
const pausedRef = (0,
|
|
14086
|
-
const rootRef = (0,
|
|
14087
|
-
const itemRefs = (0,
|
|
14088
|
-
const [layoutTick, setLayoutTick] = (0,
|
|
14226
|
+
const [records, setRecords] = (0, import_react51.useState)([]);
|
|
14227
|
+
const timerMapRef = (0, import_react51.useRef)({});
|
|
14228
|
+
const pausedRef = (0, import_react51.useRef)(/* @__PURE__ */ new Set());
|
|
14229
|
+
const rootRef = (0, import_react51.useRef)(null);
|
|
14230
|
+
const itemRefs = (0, import_react51.useRef)({});
|
|
14231
|
+
const [layoutTick, setLayoutTick] = (0, import_react51.useState)(0);
|
|
14089
14232
|
const stackGapPx = useToastStackGapPx();
|
|
14090
14233
|
const resolvedSwipe = swipeDirections ?? DEFAULT_SWIPE_DIRECTIONS;
|
|
14091
|
-
|
|
14234
|
+
useIsomorphicLayoutEffect7(() => {
|
|
14092
14235
|
const key = toasterKeyRef.current;
|
|
14093
14236
|
activeToasterKey = key;
|
|
14094
14237
|
notifyToasterOwners();
|
|
@@ -14099,13 +14242,13 @@ function Toaster({
|
|
|
14099
14242
|
}
|
|
14100
14243
|
};
|
|
14101
14244
|
}, []);
|
|
14102
|
-
(0,
|
|
14245
|
+
(0, import_react51.useEffect)(() => {
|
|
14103
14246
|
if (!isPortalOwner) return;
|
|
14104
14247
|
return subscribeToasts((next) => {
|
|
14105
14248
|
setRecords(next.slice(0, Math.max(1, maxToasts)));
|
|
14106
14249
|
});
|
|
14107
14250
|
}, [isPortalOwner, maxToasts]);
|
|
14108
|
-
(0,
|
|
14251
|
+
(0, import_react51.useEffect)(() => {
|
|
14109
14252
|
if (!isPortalOwner) return;
|
|
14110
14253
|
for (const rec of records) {
|
|
14111
14254
|
if (rec.phase === "leaving") continue;
|
|
@@ -14127,7 +14270,7 @@ function Toaster({
|
|
|
14127
14270
|
}
|
|
14128
14271
|
}
|
|
14129
14272
|
}, [isPortalOwner, records]);
|
|
14130
|
-
(0,
|
|
14273
|
+
(0, import_react51.useEffect)(() => {
|
|
14131
14274
|
return () => {
|
|
14132
14275
|
for (const handle of Object.values(timerMapRef.current)) {
|
|
14133
14276
|
clearTimeout(handle);
|
|
@@ -14135,7 +14278,7 @@ function Toaster({
|
|
|
14135
14278
|
timerMapRef.current = {};
|
|
14136
14279
|
};
|
|
14137
14280
|
}, []);
|
|
14138
|
-
|
|
14281
|
+
useIsomorphicLayoutEffect7(() => {
|
|
14139
14282
|
if (!isPortalOwner) return;
|
|
14140
14283
|
const root = rootRef.current;
|
|
14141
14284
|
if (!root) return;
|
|
@@ -14153,7 +14296,7 @@ function Toaster({
|
|
|
14153
14296
|
li.style.height = `${slotHeight(idx)}px`;
|
|
14154
14297
|
}
|
|
14155
14298
|
}, [isPortalOwner, layoutTick, records, stackGapPx]);
|
|
14156
|
-
(0,
|
|
14299
|
+
(0, import_react51.useEffect)(() => {
|
|
14157
14300
|
if (!isPortalOwner) return;
|
|
14158
14301
|
const root = rootRef.current;
|
|
14159
14302
|
if (!root) return;
|
|
@@ -14187,7 +14330,7 @@ function Toaster({
|
|
|
14187
14330
|
return null;
|
|
14188
14331
|
}
|
|
14189
14332
|
return (0, import_react_dom7.createPortal)(
|
|
14190
|
-
/* @__PURE__ */ (0,
|
|
14333
|
+
/* @__PURE__ */ (0, import_jsx_runtime73.jsx)(
|
|
14191
14334
|
"ol",
|
|
14192
14335
|
{
|
|
14193
14336
|
ref: rootRef,
|
|
@@ -14198,7 +14341,7 @@ function Toaster({
|
|
|
14198
14341
|
style: {
|
|
14199
14342
|
["--refineui-toast-gap"]: `${stackGapPx}px`
|
|
14200
14343
|
},
|
|
14201
|
-
children: records.map((rec, index) => /* @__PURE__ */ (0,
|
|
14344
|
+
children: records.map((rec, index) => /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(
|
|
14202
14345
|
"li",
|
|
14203
14346
|
{
|
|
14204
14347
|
ref: (node) => {
|
|
@@ -14212,7 +14355,7 @@ function Toaster({
|
|
|
14212
14355
|
["--refineui-toast-z-index"]: String(STACK_Z_BASE - index),
|
|
14213
14356
|
["--refineui-toast-stack-index"]: String(index)
|
|
14214
14357
|
},
|
|
14215
|
-
children: /* @__PURE__ */ (0,
|
|
14358
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime73.jsx)("div", { "data-refineui": "toast-scale-layer", children: /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(
|
|
14216
14359
|
SwipeableToast,
|
|
14217
14360
|
{
|
|
14218
14361
|
record: rec,
|
|
@@ -14233,21 +14376,21 @@ function Toaster({
|
|
|
14233
14376
|
|
|
14234
14377
|
// src/components/Tree/Tree.tsx
|
|
14235
14378
|
var import_clsx100 = require("clsx");
|
|
14236
|
-
var
|
|
14379
|
+
var import_react53 = require("react");
|
|
14237
14380
|
|
|
14238
14381
|
// src/components/Tree/context.ts
|
|
14239
|
-
var
|
|
14240
|
-
var
|
|
14382
|
+
var import_react52 = require("react");
|
|
14383
|
+
var import_tokens32 = require("@refineui/tokens");
|
|
14241
14384
|
var import_animation8 = require("@refineui/utilities/animation");
|
|
14242
|
-
var TREE_PANEL_MS = Number.parseFloat(
|
|
14243
|
-
var TREE_CONTENT_MS = Number.parseFloat(
|
|
14244
|
-
var TREE_PANEL_EASE =
|
|
14245
|
-
var TREE_CONTENT_EASE =
|
|
14246
|
-
var TreeContext = (0,
|
|
14247
|
-
var TreeItemContext = (0,
|
|
14385
|
+
var TREE_PANEL_MS = Number.parseFloat(import_tokens32.semanticInteraction.duration.accordionPanel) / 1e3;
|
|
14386
|
+
var TREE_CONTENT_MS = Number.parseFloat(import_tokens32.semanticInteraction.duration.accordionContent) / 1e3;
|
|
14387
|
+
var TREE_PANEL_EASE = import_tokens32.semanticInteraction.easing.panel;
|
|
14388
|
+
var TREE_CONTENT_EASE = import_tokens32.semanticInteraction.easing.content;
|
|
14389
|
+
var TreeContext = (0, import_react52.createContext)(null);
|
|
14390
|
+
var TreeItemContext = (0, import_react52.createContext)(null);
|
|
14248
14391
|
function usePrefersReducedMotion2() {
|
|
14249
|
-
const [reduce, setReduce] = (0,
|
|
14250
|
-
(0,
|
|
14392
|
+
const [reduce, setReduce] = (0, import_react52.useState)(false);
|
|
14393
|
+
(0, import_react52.useEffect)(() => {
|
|
14251
14394
|
const mql = window.matchMedia((0, import_animation8.getReducedMotionQuery)().replace("@media ", ""));
|
|
14252
14395
|
const sync = () => setReduce(mql.matches);
|
|
14253
14396
|
sync();
|
|
@@ -14263,7 +14406,7 @@ function toExpandedSet(value) {
|
|
|
14263
14406
|
|
|
14264
14407
|
// src/components/Tree/style.ts
|
|
14265
14408
|
var import_clsx99 = require("clsx");
|
|
14266
|
-
var
|
|
14409
|
+
var import_tokens33 = require("@refineui/tokens");
|
|
14267
14410
|
var treeStyles = {
|
|
14268
14411
|
root: "m-0 flex list-none flex-col gap-px p-0",
|
|
14269
14412
|
item: "m-0 list-none p-0",
|
|
@@ -14291,9 +14434,9 @@ var treeStyles = {
|
|
|
14291
14434
|
label: "min-w-0 flex-1 truncate text-start"
|
|
14292
14435
|
};
|
|
14293
14436
|
var treeIconSize = {
|
|
14294
|
-
sm:
|
|
14295
|
-
md:
|
|
14296
|
-
lg:
|
|
14437
|
+
sm: import_tokens33.iconSizes.xxsmall,
|
|
14438
|
+
md: import_tokens33.iconSizes.xsmall,
|
|
14439
|
+
lg: import_tokens33.iconSizes.xsmall
|
|
14297
14440
|
};
|
|
14298
14441
|
var treeItemTypo = {
|
|
14299
14442
|
sm: sizedComponentTextClass(componentTypographyTokens.tree.item, "sm"),
|
|
@@ -14302,7 +14445,7 @@ var treeItemTypo = {
|
|
|
14302
14445
|
};
|
|
14303
14446
|
|
|
14304
14447
|
// src/components/Tree/Tree.tsx
|
|
14305
|
-
var
|
|
14448
|
+
var import_jsx_runtime74 = require("react/jsx-runtime");
|
|
14306
14449
|
function Tree({
|
|
14307
14450
|
size = "md",
|
|
14308
14451
|
defaultExpanded,
|
|
@@ -14316,29 +14459,29 @@ function Tree({
|
|
|
14316
14459
|
...props
|
|
14317
14460
|
}) {
|
|
14318
14461
|
const reduceMotion = usePrefersReducedMotion2();
|
|
14319
|
-
const [uncontrolledExpanded, setUncontrolledExpanded] = (0,
|
|
14320
|
-
const [uncontrolledSelected, setUncontrolledSelected] = (0,
|
|
14462
|
+
const [uncontrolledExpanded, setUncontrolledExpanded] = (0, import_react53.useState)(() => toExpandedSet(defaultExpanded));
|
|
14463
|
+
const [uncontrolledSelected, setUncontrolledSelected] = (0, import_react53.useState)(defaultSelected ?? null);
|
|
14321
14464
|
const expanded = expandedProp === void 0 ? uncontrolledExpanded : toExpandedSet(expandedProp);
|
|
14322
14465
|
const selected = selectedProp === void 0 ? uncontrolledSelected : selectedProp;
|
|
14323
|
-
const orderRef = (0,
|
|
14324
|
-
const elMapRef = (0,
|
|
14325
|
-
const metaMapRef = (0,
|
|
14326
|
-
const emitExpanded = (0,
|
|
14466
|
+
const orderRef = (0, import_react53.useRef)([]);
|
|
14467
|
+
const elMapRef = (0, import_react53.useRef)(/* @__PURE__ */ new Map());
|
|
14468
|
+
const metaMapRef = (0, import_react53.useRef)(/* @__PURE__ */ new Map());
|
|
14469
|
+
const emitExpanded = (0, import_react53.useCallback)(
|
|
14327
14470
|
(next) => {
|
|
14328
14471
|
if (expandedProp === void 0) setUncontrolledExpanded(next);
|
|
14329
14472
|
onExpandedChange?.(Array.from(next));
|
|
14330
14473
|
},
|
|
14331
14474
|
[expandedProp, onExpandedChange]
|
|
14332
14475
|
);
|
|
14333
|
-
const emitSelected = (0,
|
|
14476
|
+
const emitSelected = (0, import_react53.useCallback)(
|
|
14334
14477
|
(next) => {
|
|
14335
14478
|
if (selectedProp === void 0) setUncontrolledSelected(next);
|
|
14336
14479
|
onSelectedChange?.(next);
|
|
14337
14480
|
},
|
|
14338
14481
|
[onSelectedChange, selectedProp]
|
|
14339
14482
|
);
|
|
14340
|
-
const isExpanded = (0,
|
|
14341
|
-
const toggleExpanded = (0,
|
|
14483
|
+
const isExpanded = (0, import_react53.useCallback)((value) => expanded.has(value), [expanded]);
|
|
14484
|
+
const toggleExpanded = (0, import_react53.useCallback)(
|
|
14342
14485
|
(value) => {
|
|
14343
14486
|
const next = new Set(expanded);
|
|
14344
14487
|
if (next.has(value)) next.delete(value);
|
|
@@ -14347,7 +14490,7 @@ function Tree({
|
|
|
14347
14490
|
},
|
|
14348
14491
|
[emitExpanded, expanded]
|
|
14349
14492
|
);
|
|
14350
|
-
const expand = (0,
|
|
14493
|
+
const expand = (0, import_react53.useCallback)(
|
|
14351
14494
|
(value) => {
|
|
14352
14495
|
if (expanded.has(value)) return;
|
|
14353
14496
|
const next = new Set(expanded);
|
|
@@ -14356,7 +14499,7 @@ function Tree({
|
|
|
14356
14499
|
},
|
|
14357
14500
|
[emitExpanded, expanded]
|
|
14358
14501
|
);
|
|
14359
|
-
const collapse = (0,
|
|
14502
|
+
const collapse = (0, import_react53.useCallback)(
|
|
14360
14503
|
(value) => {
|
|
14361
14504
|
if (!expanded.has(value)) return;
|
|
14362
14505
|
const next = new Set(expanded);
|
|
@@ -14365,13 +14508,13 @@ function Tree({
|
|
|
14365
14508
|
},
|
|
14366
14509
|
[emitExpanded, expanded]
|
|
14367
14510
|
);
|
|
14368
|
-
const select = (0,
|
|
14511
|
+
const select = (0, import_react53.useCallback)(
|
|
14369
14512
|
(value) => {
|
|
14370
14513
|
emitSelected(value);
|
|
14371
14514
|
},
|
|
14372
14515
|
[emitSelected]
|
|
14373
14516
|
);
|
|
14374
|
-
const registerItem = (0,
|
|
14517
|
+
const registerItem = (0, import_react53.useCallback)((value, el, meta) => {
|
|
14375
14518
|
metaMapRef.current.set(value, meta);
|
|
14376
14519
|
if (!orderRef.current.includes(value)) {
|
|
14377
14520
|
orderRef.current.push(value);
|
|
@@ -14383,10 +14526,10 @@ function Tree({
|
|
|
14383
14526
|
orderRef.current = orderRef.current.filter((v) => v !== value);
|
|
14384
14527
|
}
|
|
14385
14528
|
}, []);
|
|
14386
|
-
const focusItem = (0,
|
|
14529
|
+
const focusItem = (0, import_react53.useCallback)((value) => {
|
|
14387
14530
|
elMapRef.current.get(value)?.focus();
|
|
14388
14531
|
}, []);
|
|
14389
|
-
const visibleValues = (0,
|
|
14532
|
+
const visibleValues = (0, import_react53.useCallback)(() => {
|
|
14390
14533
|
const result = [];
|
|
14391
14534
|
const walk = (parent) => {
|
|
14392
14535
|
for (const value of orderRef.current) {
|
|
@@ -14400,7 +14543,7 @@ function Tree({
|
|
|
14400
14543
|
walk(null);
|
|
14401
14544
|
return result;
|
|
14402
14545
|
}, [expanded]);
|
|
14403
|
-
const focusByDelta = (0,
|
|
14546
|
+
const focusByDelta = (0, import_react53.useCallback)(
|
|
14404
14547
|
(currentValue, delta) => {
|
|
14405
14548
|
const list = visibleValues();
|
|
14406
14549
|
const idx = list.indexOf(currentValue);
|
|
@@ -14410,17 +14553,17 @@ function Tree({
|
|
|
14410
14553
|
},
|
|
14411
14554
|
[focusItem, visibleValues]
|
|
14412
14555
|
);
|
|
14413
|
-
const focusFirst = (0,
|
|
14556
|
+
const focusFirst = (0, import_react53.useCallback)(() => {
|
|
14414
14557
|
const list = visibleValues();
|
|
14415
14558
|
if (list[0]) focusItem(list[0]);
|
|
14416
14559
|
}, [focusItem, visibleValues]);
|
|
14417
|
-
const focusLast = (0,
|
|
14560
|
+
const focusLast = (0, import_react53.useCallback)(() => {
|
|
14418
14561
|
const list = visibleValues();
|
|
14419
14562
|
const last = list[list.length - 1];
|
|
14420
14563
|
if (last) focusItem(last);
|
|
14421
14564
|
}, [focusItem, visibleValues]);
|
|
14422
|
-
const getParent = (0,
|
|
14423
|
-
const contextValue = (0,
|
|
14565
|
+
const getParent = (0, import_react53.useCallback)((value) => metaMapRef.current.get(value)?.parentValue ?? null, []);
|
|
14566
|
+
const contextValue = (0, import_react53.useMemo)(
|
|
14424
14567
|
() => ({
|
|
14425
14568
|
size,
|
|
14426
14569
|
isExpanded,
|
|
@@ -14454,7 +14597,7 @@ function Tree({
|
|
|
14454
14597
|
toggleExpanded
|
|
14455
14598
|
]
|
|
14456
14599
|
);
|
|
14457
|
-
return /* @__PURE__ */ (0,
|
|
14600
|
+
return /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(TreeContext.Provider, { value: contextValue, children: /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
|
|
14458
14601
|
"ul",
|
|
14459
14602
|
{
|
|
14460
14603
|
"data-refineui": "tree",
|
|
@@ -14468,21 +14611,21 @@ function Tree({
|
|
|
14468
14611
|
|
|
14469
14612
|
// src/components/Tree/TreeItem.tsx
|
|
14470
14613
|
var import_clsx101 = require("clsx");
|
|
14471
|
-
var
|
|
14472
|
-
var
|
|
14614
|
+
var import_react54 = require("react");
|
|
14615
|
+
var import_jsx_runtime75 = require("react/jsx-runtime");
|
|
14473
14616
|
function TreeItem({ value, disabled = false, className, children, ...props }) {
|
|
14474
|
-
const tree = (0,
|
|
14475
|
-
const parent = (0,
|
|
14617
|
+
const tree = (0, import_react54.useContext)(TreeContext);
|
|
14618
|
+
const parent = (0, import_react54.useContext)(TreeItemContext);
|
|
14476
14619
|
if (!tree) throw new Error("TreeItem must be used within Tree.");
|
|
14477
|
-
const [hasBranch, setHasBranch] = (0,
|
|
14478
|
-
const uid = (0,
|
|
14620
|
+
const [hasBranch, setHasBranch] = (0, import_react54.useState)(false);
|
|
14621
|
+
const uid = (0, import_react54.useId)().replace(/:/g, "");
|
|
14479
14622
|
const depth = parent ? parent.depth + 1 : 0;
|
|
14480
14623
|
const parentValue = parent?.value ?? null;
|
|
14481
14624
|
const expanded = tree.isExpanded(value);
|
|
14482
14625
|
const selected = tree.selected === value;
|
|
14483
14626
|
const triggerId = `tree-trigger-${uid}-${value}`;
|
|
14484
14627
|
const groupId = `tree-group-${uid}-${value}`;
|
|
14485
|
-
const itemContext = (0,
|
|
14628
|
+
const itemContext = (0, import_react54.useMemo)(
|
|
14486
14629
|
() => ({
|
|
14487
14630
|
value,
|
|
14488
14631
|
depth,
|
|
@@ -14497,7 +14640,7 @@ function TreeItem({ value, disabled = false, className, children, ...props }) {
|
|
|
14497
14640
|
}),
|
|
14498
14641
|
[value, depth, parentValue, expanded, selected, disabled, hasBranch, triggerId, groupId]
|
|
14499
14642
|
);
|
|
14500
|
-
return /* @__PURE__ */ (0,
|
|
14643
|
+
return /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(TreeItemContext.Provider, { value: itemContext, children: /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(
|
|
14501
14644
|
"li",
|
|
14502
14645
|
{
|
|
14503
14646
|
"data-refineui": "tree-item",
|
|
@@ -14518,18 +14661,18 @@ function TreeItem({ value, disabled = false, className, children, ...props }) {
|
|
|
14518
14661
|
|
|
14519
14662
|
// src/components/Tree/TreeItemTrigger.tsx
|
|
14520
14663
|
var import_clsx102 = require("clsx");
|
|
14521
|
-
var
|
|
14522
|
-
var
|
|
14664
|
+
var import_react55 = require("react");
|
|
14665
|
+
var import_jsx_runtime76 = require("react/jsx-runtime");
|
|
14523
14666
|
function TreeItemTrigger({ className, children, onClick, onKeyDown, ...props }) {
|
|
14524
|
-
const tree = (0,
|
|
14525
|
-
const item = (0,
|
|
14667
|
+
const tree = (0, import_react55.useContext)(TreeContext);
|
|
14668
|
+
const item = (0, import_react55.useContext)(TreeItemContext);
|
|
14526
14669
|
if (!tree || !item) throw new Error("TreeItemTrigger must be used within TreeItem.");
|
|
14527
14670
|
const iconSize = treeIconSize[tree.size];
|
|
14528
14671
|
const depthIndent = "calc(var(--refineui-spacing-size-large) + var(--refineui-spacing-size-x-small))";
|
|
14529
14672
|
const mainStyle = {
|
|
14530
14673
|
paddingInlineStart: item.depth > 0 ? `calc(${depthIndent} * ${item.depth})` : void 0
|
|
14531
14674
|
};
|
|
14532
|
-
(0,
|
|
14675
|
+
(0, import_react55.useEffect)(() => {
|
|
14533
14676
|
return () => {
|
|
14534
14677
|
tree.registerItem(item.value, null, {
|
|
14535
14678
|
parentValue: item.parentValue,
|
|
@@ -14605,7 +14748,7 @@ function TreeItemTrigger({ className, children, onClick, onKeyDown, ...props })
|
|
|
14605
14748
|
break;
|
|
14606
14749
|
}
|
|
14607
14750
|
};
|
|
14608
|
-
return /* @__PURE__ */ (0,
|
|
14751
|
+
return /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(
|
|
14609
14752
|
"div",
|
|
14610
14753
|
{
|
|
14611
14754
|
ref: setRowRef,
|
|
@@ -14624,8 +14767,8 @@ function TreeItemTrigger({ className, children, onClick, onKeyDown, ...props })
|
|
|
14624
14767
|
className
|
|
14625
14768
|
),
|
|
14626
14769
|
...props,
|
|
14627
|
-
children: /* @__PURE__ */ (0,
|
|
14628
|
-
item.hasBranch ? /* @__PURE__ */ (0,
|
|
14770
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime76.jsxs)("div", { "data-refineui": "tree-item-main", className: treeStyles.rowMain, style: mainStyle, children: [
|
|
14771
|
+
item.hasBranch ? /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(
|
|
14629
14772
|
"button",
|
|
14630
14773
|
{
|
|
14631
14774
|
type: "button",
|
|
@@ -14639,10 +14782,10 @@ function TreeItemTrigger({ className, children, onClick, onKeyDown, ...props })
|
|
|
14639
14782
|
item.expanded && treeStyles.chevronExpanded,
|
|
14640
14783
|
tree.reduceMotion && "transition-none"
|
|
14641
14784
|
),
|
|
14642
|
-
children: /* @__PURE__ */ (0,
|
|
14785
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(WebIcon, { name: "chevron-right", size: iconSize, color: "currentColor", fallback: "\u203A" })
|
|
14643
14786
|
}
|
|
14644
|
-
) : /* @__PURE__ */ (0,
|
|
14645
|
-
/* @__PURE__ */ (0,
|
|
14787
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime76.jsx)("span", { className: treeStyles.chevronSpacer, "aria-hidden": "true" }),
|
|
14788
|
+
/* @__PURE__ */ (0, import_jsx_runtime76.jsx)("span", { className: treeStyles.label, children })
|
|
14646
14789
|
] })
|
|
14647
14790
|
}
|
|
14648
14791
|
);
|
|
@@ -14650,14 +14793,14 @@ function TreeItemTrigger({ className, children, onClick, onKeyDown, ...props })
|
|
|
14650
14793
|
|
|
14651
14794
|
// src/components/Tree/TreeItemContent.tsx
|
|
14652
14795
|
var import_clsx103 = require("clsx");
|
|
14653
|
-
var
|
|
14654
|
-
var
|
|
14796
|
+
var import_react56 = require("react");
|
|
14797
|
+
var import_jsx_runtime77 = require("react/jsx-runtime");
|
|
14655
14798
|
function TreeItemContent({ className, children, ...props }) {
|
|
14656
|
-
const tree = (0,
|
|
14657
|
-
const item = (0,
|
|
14799
|
+
const tree = (0, import_react56.useContext)(TreeContext);
|
|
14800
|
+
const item = (0, import_react56.useContext)(TreeItemContext);
|
|
14658
14801
|
if (!tree || !item) throw new Error("TreeItemContent must be used within TreeItem.");
|
|
14659
14802
|
const { setHasBranch, expanded, groupId, triggerId } = item;
|
|
14660
|
-
(0,
|
|
14803
|
+
(0, import_react56.useLayoutEffect)(() => {
|
|
14661
14804
|
setHasBranch(true);
|
|
14662
14805
|
return () => setHasBranch(false);
|
|
14663
14806
|
}, [setHasBranch]);
|
|
@@ -14672,7 +14815,7 @@ function TreeItemContent({ className, children, ...props }) {
|
|
|
14672
14815
|
transition: tree.reduceMotion ? void 0 : `opacity ${TREE_CONTENT_MS}s ${TREE_CONTENT_EASE}, transform ${TREE_CONTENT_MS}s ${TREE_CONTENT_EASE}`,
|
|
14673
14816
|
pointerEvents: expanded ? void 0 : "none"
|
|
14674
14817
|
};
|
|
14675
|
-
return /* @__PURE__ */ (0,
|
|
14818
|
+
return /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(
|
|
14676
14819
|
"div",
|
|
14677
14820
|
{
|
|
14678
14821
|
ref: (el) => {
|
|
@@ -14683,7 +14826,7 @@ function TreeItemContent({ className, children, ...props }) {
|
|
|
14683
14826
|
"data-refineui": "tree-item-panel",
|
|
14684
14827
|
"aria-hidden": !expanded,
|
|
14685
14828
|
style: gridStyle,
|
|
14686
|
-
children: /* @__PURE__ */ (0,
|
|
14829
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime77.jsx)("div", { className: treeStyles.panel, children: /* @__PURE__ */ (0, import_jsx_runtime77.jsx)("div", { className: treeStyles.panelInner, style: innerMotionStyle, children: /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(
|
|
14687
14830
|
"ul",
|
|
14688
14831
|
{
|
|
14689
14832
|
id: groupId,
|
|
@@ -14701,82 +14844,26 @@ function TreeItemContent({ className, children, ...props }) {
|
|
|
14701
14844
|
|
|
14702
14845
|
// src/components/Tooltip/Tooltip.tsx
|
|
14703
14846
|
var import_clsx105 = require("clsx");
|
|
14704
|
-
var
|
|
14847
|
+
var import_react57 = require("react");
|
|
14848
|
+
var import_tokens35 = require("@refineui/tokens");
|
|
14705
14849
|
var import_color13 = require("@refineui/utilities/color");
|
|
14706
|
-
var
|
|
14707
|
-
|
|
14708
|
-
// src/components/shared/FrostedBeak.tsx
|
|
14709
|
-
var import_tokens33 = require("@refineui/tokens");
|
|
14710
|
-
var import_jsx_runtime77 = require("react/jsx-runtime");
|
|
14711
|
-
var triangleClipPath = "polygon(50% 0, 0 100%, 100% 100%)";
|
|
14712
|
-
function FrostedBeak({ width, height, rotateDeg, borderColor }) {
|
|
14713
|
-
const surfaceStyle = {
|
|
14714
|
-
position: "absolute",
|
|
14715
|
-
inset: 0,
|
|
14716
|
-
clipPath: triangleClipPath
|
|
14717
|
-
};
|
|
14718
|
-
return /* @__PURE__ */ (0, import_jsx_runtime77.jsxs)(
|
|
14719
|
-
"div",
|
|
14720
|
-
{
|
|
14721
|
-
style: {
|
|
14722
|
-
position: "relative",
|
|
14723
|
-
width,
|
|
14724
|
-
height,
|
|
14725
|
-
transform: `rotate(${rotateDeg}deg)`,
|
|
14726
|
-
transformOrigin: "center center"
|
|
14727
|
-
},
|
|
14728
|
-
children: [
|
|
14729
|
-
/* @__PURE__ */ (0, import_jsx_runtime77.jsx)(
|
|
14730
|
-
"span",
|
|
14731
|
-
{
|
|
14732
|
-
"data-refineui": "floating-beak-surface",
|
|
14733
|
-
style: surfaceStyle
|
|
14734
|
-
}
|
|
14735
|
-
),
|
|
14736
|
-
/* @__PURE__ */ (0, import_jsx_runtime77.jsx)(
|
|
14737
|
-
"svg",
|
|
14738
|
-
{
|
|
14739
|
-
width,
|
|
14740
|
-
height,
|
|
14741
|
-
viewBox: "0 0 16 8",
|
|
14742
|
-
fill: "none",
|
|
14743
|
-
"aria-hidden": true,
|
|
14744
|
-
style: { position: "absolute", inset: 0, overflow: "visible" },
|
|
14745
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(
|
|
14746
|
-
"path",
|
|
14747
|
-
{
|
|
14748
|
-
d: "M0 8L8 0L16 8",
|
|
14749
|
-
stroke: borderColor,
|
|
14750
|
-
strokeWidth: import_tokens33.strokeWidths.strokeWidthThin,
|
|
14751
|
-
strokeLinejoin: "round"
|
|
14752
|
-
}
|
|
14753
|
-
)
|
|
14754
|
-
}
|
|
14755
|
-
)
|
|
14756
|
-
]
|
|
14757
|
-
}
|
|
14758
|
-
);
|
|
14759
|
-
}
|
|
14850
|
+
var import_react58 = require("@refineui/utilities/react");
|
|
14760
14851
|
|
|
14761
14852
|
// src/components/Tooltip/style.ts
|
|
14762
14853
|
var import_tokens34 = require("@refineui/tokens");
|
|
14763
14854
|
var import_clsx104 = require("clsx");
|
|
14764
|
-
var
|
|
14765
|
-
var
|
|
14766
|
-
var TOOLTIP_BEAK_OFFSET = import_tokens3.foundationSizes.foundationSize80;
|
|
14767
|
-
var BEAK_BORDER_OVERLAP2 = import_tokens34.strokeWidths.strokeWidthThin;
|
|
14768
|
-
var gap = import_tokens34.spacings.sizeXSmall;
|
|
14769
|
-
var edgeInset = import_tokens34.spacings.sizeMedium;
|
|
14855
|
+
var gap = `calc(${import_tokens3.componentSizes.tooltipBeakHeight} + ${import_tokens34.spacings.sizeXXSmall})`;
|
|
14856
|
+
var TOOLTIP_BEAK_INSET = import_tokens34.spacings.sizeMedium;
|
|
14770
14857
|
var tooltipStyles = {
|
|
14771
14858
|
root: "relative inline-block",
|
|
14772
14859
|
fallbackTrigger: "inline-flex outline-none",
|
|
14773
|
-
/** Positions the floating stack (
|
|
14860
|
+
/** Positions the floating stack (surface + panel), like PopOver `floatingRoot`. */
|
|
14774
14861
|
floating: "pointer-events-none absolute z-refineui-popup",
|
|
14775
14862
|
panelWrap: "relative inline-block max-w-refineui-tooltip-max-width",
|
|
14776
|
-
|
|
14863
|
+
/** Fill, stroke, and shadow come from `FloatingSurface`; the transparent border keeps the box size. */
|
|
14777
14864
|
panel: (0, import_clsx104.clsx)(
|
|
14778
14865
|
componentTextClass(componentTypographyTokens.tooltip),
|
|
14779
|
-
"relative z-0 box-border max-w-refineui-tooltip-max-width whitespace-nowrap rounded-refineui-medium border-refineui-thin px-refineui-size-medium py-refineui-size-small
|
|
14866
|
+
"relative z-0 box-border max-w-refineui-tooltip-max-width whitespace-nowrap rounded-refineui-medium border-refineui-thin border-transparent px-refineui-size-medium py-refineui-size-small"
|
|
14780
14867
|
)
|
|
14781
14868
|
};
|
|
14782
14869
|
function tooltipPlacement(position) {
|
|
@@ -14797,6 +14884,15 @@ function tooltipAlignKey(align) {
|
|
|
14797
14884
|
if (align === "End") return "end";
|
|
14798
14885
|
return "center";
|
|
14799
14886
|
}
|
|
14887
|
+
var beakSideByPlacement2 = {
|
|
14888
|
+
bottom: "top",
|
|
14889
|
+
top: "bottom",
|
|
14890
|
+
left: "right",
|
|
14891
|
+
right: "left"
|
|
14892
|
+
};
|
|
14893
|
+
function tooltipBeakSide(position) {
|
|
14894
|
+
return beakSideByPlacement2[tooltipPlacement(position)];
|
|
14895
|
+
}
|
|
14800
14896
|
function tooltipFloatingStyle(position, align) {
|
|
14801
14897
|
switch (position) {
|
|
14802
14898
|
case "Top":
|
|
@@ -14819,45 +14915,6 @@ function tooltipFloatingStyle(position, align) {
|
|
|
14819
14915
|
return {};
|
|
14820
14916
|
}
|
|
14821
14917
|
}
|
|
14822
|
-
function tooltipBeakWrapperStyle(position, align) {
|
|
14823
|
-
const overlapOffset = `calc(-1 * ${TOOLTIP_BEAK_OFFSET} + ${BEAK_BORDER_OVERLAP2})`;
|
|
14824
|
-
const placement = tooltipPlacement(position);
|
|
14825
|
-
const a = tooltipAlignKey(align);
|
|
14826
|
-
switch (placement) {
|
|
14827
|
-
case "bottom":
|
|
14828
|
-
if (a === "center") return { top: overlapOffset, left: `calc(50% - ${TOOLTIP_BEAK_W} / 2)` };
|
|
14829
|
-
if (a === "start") return { top: overlapOffset, left: edgeInset };
|
|
14830
|
-
return { top: overlapOffset, right: edgeInset };
|
|
14831
|
-
case "top":
|
|
14832
|
-
if (a === "center") return { bottom: overlapOffset, left: `calc(50% - ${TOOLTIP_BEAK_W} / 2)` };
|
|
14833
|
-
if (a === "start") return { bottom: overlapOffset, left: edgeInset };
|
|
14834
|
-
return { bottom: overlapOffset, right: edgeInset };
|
|
14835
|
-
case "left":
|
|
14836
|
-
if (a === "center") return { right: overlapOffset, top: `calc(50% - ${TOOLTIP_BEAK_W} / 2)` };
|
|
14837
|
-
if (a === "start") return { right: overlapOffset, top: edgeInset };
|
|
14838
|
-
return { right: overlapOffset, bottom: edgeInset };
|
|
14839
|
-
case "right":
|
|
14840
|
-
if (a === "center") return { left: overlapOffset, top: `calc(50% - ${TOOLTIP_BEAK_W} / 2)` };
|
|
14841
|
-
if (a === "start") return { left: overlapOffset, top: edgeInset };
|
|
14842
|
-
return { left: overlapOffset, bottom: edgeInset };
|
|
14843
|
-
default:
|
|
14844
|
-
return {};
|
|
14845
|
-
}
|
|
14846
|
-
}
|
|
14847
|
-
function tooltipBeakRotateDeg(position) {
|
|
14848
|
-
switch (tooltipPlacement(position)) {
|
|
14849
|
-
case "bottom":
|
|
14850
|
-
return 0;
|
|
14851
|
-
case "top":
|
|
14852
|
-
return 180;
|
|
14853
|
-
case "left":
|
|
14854
|
-
return -90;
|
|
14855
|
-
case "right":
|
|
14856
|
-
return 90;
|
|
14857
|
-
default:
|
|
14858
|
-
return 0;
|
|
14859
|
-
}
|
|
14860
|
-
}
|
|
14861
14918
|
|
|
14862
14919
|
// src/components/Tooltip/Tooltip.tsx
|
|
14863
14920
|
var import_jsx_runtime78 = require("react/jsx-runtime");
|
|
@@ -14873,10 +14930,11 @@ function Tooltip({
|
|
|
14873
14930
|
className,
|
|
14874
14931
|
...props
|
|
14875
14932
|
}) {
|
|
14876
|
-
const [innerOpen, setInnerOpen] = (0,
|
|
14933
|
+
const [innerOpen, setInnerOpen] = (0, import_react57.useState)(defaultOpen);
|
|
14877
14934
|
const open = ctrlOpen !== void 0 ? ctrlOpen : innerOpen;
|
|
14878
|
-
const tooltipId = (0,
|
|
14879
|
-
const showTimer = (0,
|
|
14935
|
+
const tooltipId = (0, import_react57.useId)();
|
|
14936
|
+
const showTimer = (0, import_react57.useRef)(null);
|
|
14937
|
+
const panelRef = (0, import_react57.useRef)(null);
|
|
14880
14938
|
const setOpen = (next) => {
|
|
14881
14939
|
if (ctrlOpen === void 0) setInnerOpen(next);
|
|
14882
14940
|
onOpenChange?.(next);
|
|
@@ -14900,14 +14958,12 @@ function Tooltip({
|
|
|
14900
14958
|
setOpen(false);
|
|
14901
14959
|
};
|
|
14902
14960
|
const floatingStyle = tooltipFloatingStyle(position, align);
|
|
14903
|
-
const beakWrapStyle = tooltipBeakWrapperStyle(position, align);
|
|
14904
|
-
const beakRot = tooltipBeakRotateDeg(position);
|
|
14905
14961
|
const describedBy = open ? tooltipId : void 0;
|
|
14906
|
-
const mergeEl = (0,
|
|
14962
|
+
const mergeEl = (0, import_react58.getMergeableTriggerChild)(trigger);
|
|
14907
14963
|
let triggerNode;
|
|
14908
14964
|
if (mergeEl != null) {
|
|
14909
14965
|
triggerNode = /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
|
|
14910
|
-
|
|
14966
|
+
import_react58.Slot,
|
|
14911
14967
|
{
|
|
14912
14968
|
"aria-describedby": describedBy,
|
|
14913
14969
|
onMouseEnter: scheduleShow,
|
|
@@ -14946,36 +15002,32 @@ function Tooltip({
|
|
|
14946
15002
|
/* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
|
|
14947
15003
|
"div",
|
|
14948
15004
|
{
|
|
14949
|
-
|
|
14950
|
-
style: { ...beakWrapStyle, width: TOOLTIP_BEAK_W, height: TOOLTIP_BEAK_H },
|
|
14951
|
-
"aria-hidden": true,
|
|
14952
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
|
|
14953
|
-
FrostedBeak,
|
|
14954
|
-
{
|
|
14955
|
-
width: TOOLTIP_BEAK_W,
|
|
14956
|
-
height: TOOLTIP_BEAK_H,
|
|
14957
|
-
rotateDeg: beakRot,
|
|
14958
|
-
borderColor: borderCol
|
|
14959
|
-
}
|
|
14960
|
-
)
|
|
14961
|
-
}
|
|
14962
|
-
),
|
|
14963
|
-
/* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
|
|
14964
|
-
"div",
|
|
14965
|
-
{
|
|
15005
|
+
ref: panelRef,
|
|
14966
15006
|
id: tooltipId,
|
|
14967
15007
|
role: "tooltip",
|
|
14968
15008
|
"data-refineui": "tooltip-panel",
|
|
14969
15009
|
"data-position": position,
|
|
14970
15010
|
"data-align": align,
|
|
14971
15011
|
className: tooltipStyles.panel,
|
|
14972
|
-
style: {
|
|
14973
|
-
backgroundColor: bg,
|
|
14974
|
-
color: fg,
|
|
14975
|
-
borderColor: borderCol
|
|
14976
|
-
},
|
|
15012
|
+
style: { color: fg },
|
|
14977
15013
|
children: content
|
|
14978
15014
|
}
|
|
15015
|
+
),
|
|
15016
|
+
/* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
|
|
15017
|
+
FloatingSurface,
|
|
15018
|
+
{
|
|
15019
|
+
panelRef,
|
|
15020
|
+
side: tooltipBeakSide(position),
|
|
15021
|
+
align: tooltipAlignKey(align),
|
|
15022
|
+
radius: import_tokens35.borderRadii.roundedMedium,
|
|
15023
|
+
beakWidth: import_tokens3.componentSizes.tooltipBeakWidth,
|
|
15024
|
+
beakHeight: import_tokens3.componentSizes.tooltipBeakHeight,
|
|
15025
|
+
tipRadius: import_tokens3.componentSizes.tooltipBeakTipRadius,
|
|
15026
|
+
beakInsetStart: TOOLTIP_BEAK_INSET,
|
|
15027
|
+
beakInsetEnd: TOOLTIP_BEAK_INSET,
|
|
15028
|
+
backgroundColor: bg,
|
|
15029
|
+
borderColor: borderCol
|
|
15030
|
+
}
|
|
14979
15031
|
)
|
|
14980
15032
|
] }) })
|
|
14981
15033
|
] });
|
|
@@ -14983,8 +15035,8 @@ function Tooltip({
|
|
|
14983
15035
|
|
|
14984
15036
|
// src/components/Chart/Chart.tsx
|
|
14985
15037
|
var import_clsx107 = require("clsx");
|
|
14986
|
-
var
|
|
14987
|
-
var
|
|
15038
|
+
var import_react59 = require("react");
|
|
15039
|
+
var import_tokens37 = require("@refineui/tokens");
|
|
14988
15040
|
var import_color14 = require("@refineui/utilities/color");
|
|
14989
15041
|
|
|
14990
15042
|
// src/components/Chart/style.ts
|
|
@@ -15029,16 +15081,16 @@ var chartStyles = {
|
|
|
15029
15081
|
};
|
|
15030
15082
|
|
|
15031
15083
|
// src/components/Chart/utils.ts
|
|
15032
|
-
var
|
|
15084
|
+
var import_tokens36 = require("@refineui/tokens");
|
|
15033
15085
|
var CHART_VIEWBOX_WIDTH = 800;
|
|
15034
15086
|
var CHART_VIEWBOX_HEIGHT = 320;
|
|
15035
|
-
var CHART_PLOT_PADDING_TOP = parseFloat(
|
|
15036
|
-
var CHART_PLOT_PADDING_BOTTOM = parseFloat(
|
|
15037
|
-
var CHART_PLOT_PADDING_X = parseFloat(
|
|
15038
|
-
var CHART_BAR_RADIUS = parseFloat(
|
|
15087
|
+
var CHART_PLOT_PADDING_TOP = parseFloat(import_tokens36.spacings.sizeMedium);
|
|
15088
|
+
var CHART_PLOT_PADDING_BOTTOM = parseFloat(import_tokens36.spacings.sizeXXSmall);
|
|
15089
|
+
var CHART_PLOT_PADDING_X = parseFloat(import_tokens36.spacings.sizeMedium);
|
|
15090
|
+
var CHART_BAR_RADIUS = parseFloat(import_tokens36.borderRadii.roundedXLarge);
|
|
15039
15091
|
var CHART_BAR_BAND_FILL = 0.5;
|
|
15040
|
-
var CHART_POINT_RADIUS = parseFloat(
|
|
15041
|
-
var CHART_POINT_STROKE = parseFloat(
|
|
15092
|
+
var CHART_POINT_RADIUS = parseFloat(import_tokens36.foundationSizes.foundationSize40);
|
|
15093
|
+
var CHART_POINT_STROKE = parseFloat(import_tokens36.foundationSizes.foundationSize20);
|
|
15042
15094
|
var CHART_TOOLTIP_FLIP_X = 0.75;
|
|
15043
15095
|
var CHART_TOOLTIP_FLIP_Y = 0.25;
|
|
15044
15096
|
function clampValue(n) {
|
|
@@ -15211,9 +15263,9 @@ function formatAxisTick(value) {
|
|
|
15211
15263
|
|
|
15212
15264
|
// src/components/Chart/Chart.tsx
|
|
15213
15265
|
var import_jsx_runtime79 = require("react/jsx-runtime");
|
|
15214
|
-
var ChartContext = (0,
|
|
15266
|
+
var ChartContext = (0, import_react59.createContext)(null);
|
|
15215
15267
|
function useChartContext(component) {
|
|
15216
|
-
const value = (0,
|
|
15268
|
+
const value = (0, import_react59.useContext)(ChartContext);
|
|
15217
15269
|
if (!value) throw new Error(`${component} must be used within Chart.`);
|
|
15218
15270
|
return value;
|
|
15219
15271
|
}
|
|
@@ -15243,15 +15295,15 @@ function itemState(index, hoverIndex, selectedIndex) {
|
|
|
15243
15295
|
return "default";
|
|
15244
15296
|
}
|
|
15245
15297
|
function isChartTooltipElement(node) {
|
|
15246
|
-
return (0,
|
|
15298
|
+
return (0, import_react59.isValidElement)(node) && node.type === ChartTooltip;
|
|
15247
15299
|
}
|
|
15248
15300
|
function Chart({ className, children, ...props }) {
|
|
15249
|
-
const [hoverIndex, setHoverIndex] = (0,
|
|
15250
|
-
const [selectedIndex, setSelectedIndex] = (0,
|
|
15251
|
-
const [pointer, setPointer] = (0,
|
|
15252
|
-
const [labels, setLabels] = (0,
|
|
15253
|
-
const [series, setSeries] = (0,
|
|
15254
|
-
const context = (0,
|
|
15301
|
+
const [hoverIndex, setHoverIndex] = (0, import_react59.useState)(null);
|
|
15302
|
+
const [selectedIndex, setSelectedIndex] = (0, import_react59.useState)(null);
|
|
15303
|
+
const [pointer, setPointer] = (0, import_react59.useState)(null);
|
|
15304
|
+
const [labels, setLabels] = (0, import_react59.useState)([]);
|
|
15305
|
+
const [series, setSeries] = (0, import_react59.useState)(null);
|
|
15306
|
+
const context = (0, import_react59.useMemo)(
|
|
15255
15307
|
() => ({
|
|
15256
15308
|
hoverIndex,
|
|
15257
15309
|
selectedIndex,
|
|
@@ -15346,7 +15398,7 @@ function ChartPlot({
|
|
|
15346
15398
|
const { pointer, selectedIndex } = useChartContext("ChartPlot");
|
|
15347
15399
|
const svgChildren = [];
|
|
15348
15400
|
const tooltipNodes = [];
|
|
15349
|
-
|
|
15401
|
+
import_react59.Children.forEach(children, (child) => {
|
|
15350
15402
|
if (isChartTooltipElement(child)) tooltipNodes.push(child);
|
|
15351
15403
|
else svgChildren.push(child);
|
|
15352
15404
|
});
|
|
@@ -15462,7 +15514,7 @@ function ChartGrid({
|
|
|
15462
15514
|
y2: y,
|
|
15463
15515
|
stroke: isBaseline ? baselineColor : gridColor,
|
|
15464
15516
|
strokeWidth: "var(--refineui-stroke-width-thin)",
|
|
15465
|
-
strokeOpacity: isBaseline ?
|
|
15517
|
+
strokeOpacity: isBaseline ? import_tokens37.opacities.opacityFull : import_tokens37.opacities.opacityDisabled,
|
|
15466
15518
|
vectorEffect: "non-scaling-stroke"
|
|
15467
15519
|
},
|
|
15468
15520
|
tick
|
|
@@ -15485,7 +15537,7 @@ function ChartBars({
|
|
|
15485
15537
|
const barRadius = Math.min(CHART_BAR_RADIUS, barWidth / 2);
|
|
15486
15538
|
const baselineY = plotBaselineY();
|
|
15487
15539
|
const trackHeight = plotHeight();
|
|
15488
|
-
(0,
|
|
15540
|
+
(0, import_react59.useLayoutEffect)(() => {
|
|
15489
15541
|
setSeries({ values, seriesColor, max, align: "bar" });
|
|
15490
15542
|
}, [values, seriesColor, max, setSeries]);
|
|
15491
15543
|
return /* @__PURE__ */ (0, import_jsx_runtime79.jsxs)("g", { "data-refineui": "chart-bars", "data-series-color": seriesColor, className, ...props, children: [
|
|
@@ -15536,14 +15588,14 @@ function ChartLine({
|
|
|
15536
15588
|
...props
|
|
15537
15589
|
}) {
|
|
15538
15590
|
const { hoverIndex, selectedIndex, setSeries } = useChartContext("ChartLine");
|
|
15539
|
-
const gradientId = (0,
|
|
15591
|
+
const gradientId = (0, import_react59.useId)().replace(/:/g, "");
|
|
15540
15592
|
const scaleMax = resolveChartScale(values, max);
|
|
15541
15593
|
const stroke = seriesColorToken(seriesColor);
|
|
15542
15594
|
const coords = linePointCoords(values, scaleMax);
|
|
15543
15595
|
const baselineY = plotBaselineY();
|
|
15544
15596
|
const pointRing = pointStrokeColor();
|
|
15545
15597
|
const linePath = monotoneLinePath(coords);
|
|
15546
|
-
(0,
|
|
15598
|
+
(0, import_react59.useLayoutEffect)(() => {
|
|
15547
15599
|
setSeries({ values, seriesColor, max, align: "line" });
|
|
15548
15600
|
}, [values, seriesColor, max, setSeries]);
|
|
15549
15601
|
return /* @__PURE__ */ (0, import_jsx_runtime79.jsxs)("g", { "data-refineui": "chart-line", "data-series-color": seriesColor, className, ...props, children: [
|
|
@@ -15554,7 +15606,7 @@ function ChartLine({
|
|
|
15554
15606
|
{
|
|
15555
15607
|
offset: "0%",
|
|
15556
15608
|
stopColor: stroke,
|
|
15557
|
-
stopOpacity:
|
|
15609
|
+
stopOpacity: import_tokens37.opacities.opacityDisabled
|
|
15558
15610
|
}
|
|
15559
15611
|
),
|
|
15560
15612
|
/* @__PURE__ */ (0, import_jsx_runtime79.jsx)("stop", { offset: "100%", stopColor: stroke, stopOpacity: "0" })
|
|
@@ -15612,7 +15664,7 @@ function ChartAxisLabels({
|
|
|
15612
15664
|
const { hoverIndex, selectedIndex, setLabels } = useChartContext("ChartAxisLabels");
|
|
15613
15665
|
const count = labels.length;
|
|
15614
15666
|
const centerAt = align === "line" ? linePointCenterRatio : barBandCenterRatio;
|
|
15615
|
-
(0,
|
|
15667
|
+
(0, import_react59.useLayoutEffect)(() => {
|
|
15616
15668
|
setLabels(labels);
|
|
15617
15669
|
}, [labels, setLabels]);
|
|
15618
15670
|
return /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(
|
|
@@ -15681,26 +15733,26 @@ function ChartLegendItem({
|
|
|
15681
15733
|
}
|
|
15682
15734
|
|
|
15683
15735
|
// src/components/Slot/Slot.tsx
|
|
15684
|
-
var
|
|
15736
|
+
var import_react60 = require("@refineui/utilities/react");
|
|
15685
15737
|
|
|
15686
15738
|
// src/components/Collapsible/Collapsible.tsx
|
|
15687
|
-
var
|
|
15739
|
+
var import_react62 = require("react");
|
|
15688
15740
|
var import_clsx108 = require("clsx");
|
|
15689
|
-
var
|
|
15741
|
+
var import_react63 = require("@refineui/utilities/react");
|
|
15690
15742
|
|
|
15691
15743
|
// src/components/Collapsible/context.ts
|
|
15692
|
-
var
|
|
15693
|
-
var
|
|
15744
|
+
var import_react61 = require("react");
|
|
15745
|
+
var import_tokens38 = require("@refineui/tokens");
|
|
15694
15746
|
var import_animation9 = require("@refineui/utilities/animation");
|
|
15695
|
-
var CollapsibleContext = (0,
|
|
15747
|
+
var CollapsibleContext = (0, import_react61.createContext)(null);
|
|
15696
15748
|
function useCollapsibleContext(part) {
|
|
15697
|
-
const value = (0,
|
|
15749
|
+
const value = (0, import_react61.useContext)(CollapsibleContext);
|
|
15698
15750
|
if (!value) throw new Error(`${part} must be used within Collapsible`);
|
|
15699
15751
|
return value;
|
|
15700
15752
|
}
|
|
15701
15753
|
function usePrefersReducedMotion3() {
|
|
15702
|
-
const [reduce, setReduce] = (0,
|
|
15703
|
-
(0,
|
|
15754
|
+
const [reduce, setReduce] = (0, import_react61.useState)(false);
|
|
15755
|
+
(0, import_react61.useEffect)(() => {
|
|
15704
15756
|
const mql = window.matchMedia((0, import_animation9.getReducedMotionQuery)().replace("@media ", ""));
|
|
15705
15757
|
const sync = () => setReduce(mql.matches);
|
|
15706
15758
|
sync();
|
|
@@ -15709,10 +15761,10 @@ function usePrefersReducedMotion3() {
|
|
|
15709
15761
|
}, []);
|
|
15710
15762
|
return reduce;
|
|
15711
15763
|
}
|
|
15712
|
-
var PANEL_HEIGHT_MS2 = Number.parseFloat(
|
|
15713
|
-
var PANEL_CONTENT_MS2 = Number.parseFloat(
|
|
15714
|
-
var PANEL_HEIGHT_EASE2 =
|
|
15715
|
-
var PANEL_CONTENT_EASE2 =
|
|
15764
|
+
var PANEL_HEIGHT_MS2 = Number.parseFloat(import_tokens38.semanticInteraction.duration.panel) / 1e3;
|
|
15765
|
+
var PANEL_CONTENT_MS2 = Number.parseFloat(import_tokens38.semanticInteraction.duration.normal) / 1e3;
|
|
15766
|
+
var PANEL_HEIGHT_EASE2 = import_tokens38.semanticInteraction.easing.panel;
|
|
15767
|
+
var PANEL_CONTENT_EASE2 = import_tokens38.semanticInteraction.easing.content;
|
|
15716
15768
|
|
|
15717
15769
|
// src/components/Collapsible/style.ts
|
|
15718
15770
|
var collapsibleStyles = {
|
|
@@ -15721,17 +15773,17 @@ var collapsibleStyles = {
|
|
|
15721
15773
|
|
|
15722
15774
|
// src/components/Collapsible/Collapsible.tsx
|
|
15723
15775
|
var import_jsx_runtime80 = require("react/jsx-runtime");
|
|
15724
|
-
var Collapsible = (0,
|
|
15725
|
-
const [uncontrolled, setUncontrolled] = (0,
|
|
15776
|
+
var Collapsible = (0, import_react62.forwardRef)(function Collapsible2({ open: openProp, defaultOpen = false, onOpenChange, asChild = false, className, children, ...props }, ref) {
|
|
15777
|
+
const [uncontrolled, setUncontrolled] = (0, import_react62.useState)(defaultOpen);
|
|
15726
15778
|
const open = openProp ?? uncontrolled;
|
|
15727
|
-
const reactId = (0,
|
|
15779
|
+
const reactId = (0, import_react62.useId)();
|
|
15728
15780
|
const reduceMotion = usePrefersReducedMotion3();
|
|
15729
|
-
const toggle = (0,
|
|
15781
|
+
const toggle = (0, import_react62.useCallback)(() => {
|
|
15730
15782
|
const next = !(openProp ?? uncontrolled);
|
|
15731
15783
|
if (openProp === void 0) setUncontrolled(next);
|
|
15732
15784
|
onOpenChange?.(next);
|
|
15733
15785
|
}, [onOpenChange, openProp, uncontrolled]);
|
|
15734
|
-
const contextValue = (0,
|
|
15786
|
+
const contextValue = (0, import_react62.useMemo)(
|
|
15735
15787
|
() => ({
|
|
15736
15788
|
open,
|
|
15737
15789
|
toggle,
|
|
@@ -15748,9 +15800,9 @@ var Collapsible = (0, import_react61.forwardRef)(function Collapsible2({ open: o
|
|
|
15748
15800
|
"data-refineui": "collapsible",
|
|
15749
15801
|
className
|
|
15750
15802
|
};
|
|
15751
|
-
return /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(CollapsibleContext.Provider, { value: contextValue, children: asChild ? /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
|
|
15803
|
+
return /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(CollapsibleContext.Provider, { value: contextValue, children: asChild ? /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(import_react63.Slot, { ...shared, children }) : /* @__PURE__ */ (0, import_jsx_runtime80.jsx)("div", { ...shared, children }) });
|
|
15752
15804
|
});
|
|
15753
|
-
var CollapsibleTrigger = (0,
|
|
15805
|
+
var CollapsibleTrigger = (0, import_react62.forwardRef)(
|
|
15754
15806
|
function CollapsibleTrigger2({
|
|
15755
15807
|
asChild = false,
|
|
15756
15808
|
onClick,
|
|
@@ -15777,7 +15829,7 @@ var CollapsibleTrigger = (0, import_react61.forwardRef)(
|
|
|
15777
15829
|
if (!event.defaultPrevented) toggle();
|
|
15778
15830
|
}
|
|
15779
15831
|
};
|
|
15780
|
-
if (asChild) return /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
|
|
15832
|
+
if (asChild) return /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(import_react63.Slot, { ...shared, children });
|
|
15781
15833
|
return /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
|
|
15782
15834
|
Button,
|
|
15783
15835
|
{
|
|
@@ -15792,7 +15844,7 @@ var CollapsibleTrigger = (0, import_react61.forwardRef)(
|
|
|
15792
15844
|
);
|
|
15793
15845
|
}
|
|
15794
15846
|
);
|
|
15795
|
-
var CollapsibleContent = (0,
|
|
15847
|
+
var CollapsibleContent = (0, import_react62.forwardRef)(
|
|
15796
15848
|
function CollapsibleContent2({ className, children, style, ...props }, ref) {
|
|
15797
15849
|
const { open, contentId, triggerId, reduceMotion } = useCollapsibleContext("CollapsibleContent");
|
|
15798
15850
|
const gridStyle = {
|
|
@@ -15826,19 +15878,19 @@ var CollapsibleContent = (0, import_react61.forwardRef)(
|
|
|
15826
15878
|
);
|
|
15827
15879
|
|
|
15828
15880
|
// src/components/ContextMenu/ContextMenu.tsx
|
|
15829
|
-
var
|
|
15881
|
+
var import_react64 = require("react");
|
|
15830
15882
|
var import_react_dom8 = require("react-dom");
|
|
15831
15883
|
var import_clsx109 = require("clsx");
|
|
15832
|
-
var
|
|
15884
|
+
var import_tokens39 = require("@refineui/tokens");
|
|
15833
15885
|
var import_animation10 = require("@refineui/utilities/animation");
|
|
15834
|
-
var
|
|
15886
|
+
var import_react65 = require("@refineui/utilities/react");
|
|
15835
15887
|
var import_jsx_runtime81 = require("react/jsx-runtime");
|
|
15836
15888
|
var MENU_ATTR = "data-refineui-context-menu";
|
|
15837
|
-
var CLOSE_MS = (0, import_animation10.motionMsToNumber)(
|
|
15838
|
-
var MenuContext2 = (0,
|
|
15839
|
-
var SubContext = (0,
|
|
15889
|
+
var CLOSE_MS = (0, import_animation10.motionMsToNumber)(import_tokens39.semanticInteraction.duration.normal);
|
|
15890
|
+
var MenuContext2 = (0, import_react64.createContext)(null);
|
|
15891
|
+
var SubContext = (0, import_react64.createContext)(null);
|
|
15840
15892
|
function useMenu() {
|
|
15841
|
-
const value = (0,
|
|
15893
|
+
const value = (0, import_react64.useContext)(MenuContext2);
|
|
15842
15894
|
if (!value) throw new Error("Context menu parts must be used within ContextMenu");
|
|
15843
15895
|
return value;
|
|
15844
15896
|
}
|
|
@@ -15855,29 +15907,29 @@ function placeInView(element, x, y) {
|
|
|
15855
15907
|
}
|
|
15856
15908
|
function ContextMenu({ modal = true, onOpenChange, children }) {
|
|
15857
15909
|
void modal;
|
|
15858
|
-
const [open, setOpen] = (0,
|
|
15859
|
-
const [point, setPoint] = (0,
|
|
15860
|
-
const openRef = (0,
|
|
15861
|
-
const onOpenChangeRef = (0,
|
|
15910
|
+
const [open, setOpen] = (0, import_react64.useState)(false);
|
|
15911
|
+
const [point, setPoint] = (0, import_react64.useState)({ x: 0, y: 0 });
|
|
15912
|
+
const openRef = (0, import_react64.useRef)(false);
|
|
15913
|
+
const onOpenChangeRef = (0, import_react64.useRef)(onOpenChange);
|
|
15862
15914
|
openRef.current = open;
|
|
15863
15915
|
onOpenChangeRef.current = onOpenChange;
|
|
15864
|
-
const close = (0,
|
|
15916
|
+
const close = (0, import_react64.useCallback)(() => {
|
|
15865
15917
|
if (!openRef.current) return;
|
|
15866
15918
|
openRef.current = false;
|
|
15867
15919
|
setOpen(false);
|
|
15868
15920
|
onOpenChangeRef.current?.(false);
|
|
15869
15921
|
}, []);
|
|
15870
|
-
const openAt = (0,
|
|
15922
|
+
const openAt = (0, import_react64.useCallback)((x, y) => {
|
|
15871
15923
|
setPoint({ x, y });
|
|
15872
15924
|
const wasOpen = openRef.current;
|
|
15873
15925
|
openRef.current = true;
|
|
15874
15926
|
setOpen(true);
|
|
15875
15927
|
if (!wasOpen) onOpenChangeRef.current?.(true);
|
|
15876
15928
|
}, []);
|
|
15877
|
-
const value = (0,
|
|
15929
|
+
const value = (0, import_react64.useMemo)(() => ({ open, point, openAt, close }), [open, point, openAt, close]);
|
|
15878
15930
|
return /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(MenuContext2.Provider, { value, children });
|
|
15879
15931
|
}
|
|
15880
|
-
var ContextMenuTrigger = (0,
|
|
15932
|
+
var ContextMenuTrigger = (0, import_react64.forwardRef)(function ContextMenuTrigger2({ asChild = false, onContextMenu, children, ...props }, ref) {
|
|
15881
15933
|
const { openAt } = useMenu();
|
|
15882
15934
|
const shared = {
|
|
15883
15935
|
...props,
|
|
@@ -15890,18 +15942,18 @@ var ContextMenuTrigger = (0, import_react63.forwardRef)(function ContextMenuTrig
|
|
|
15890
15942
|
openAt(event.clientX, event.clientY);
|
|
15891
15943
|
}
|
|
15892
15944
|
};
|
|
15893
|
-
if (asChild) return /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(
|
|
15945
|
+
if (asChild) return /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(import_react65.Slot, { ...shared, children });
|
|
15894
15946
|
return /* @__PURE__ */ (0, import_jsx_runtime81.jsx)("span", { ...shared, className: (0, import_clsx109.clsx)(menuStyles.triggerFallback, props.className), children });
|
|
15895
15947
|
});
|
|
15896
15948
|
function ContextMenuPortal({ children }) {
|
|
15897
15949
|
return /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(import_jsx_runtime81.Fragment, { children });
|
|
15898
15950
|
}
|
|
15899
|
-
var ContextMenuContent = (0,
|
|
15951
|
+
var ContextMenuContent = (0, import_react64.forwardRef)(function ContextMenuContent2({ className, style, onPointerDown, children, ...props }, ref) {
|
|
15900
15952
|
const { open, point, close } = useMenu();
|
|
15901
|
-
const localRef = (0,
|
|
15902
|
-
const [shouldRender, setShouldRender] = (0,
|
|
15903
|
-
const [isClosing, setIsClosing] = (0,
|
|
15904
|
-
(0,
|
|
15953
|
+
const localRef = (0, import_react64.useRef)(null);
|
|
15954
|
+
const [shouldRender, setShouldRender] = (0, import_react64.useState)(open);
|
|
15955
|
+
const [isClosing, setIsClosing] = (0, import_react64.useState)(false);
|
|
15956
|
+
(0, import_react64.useEffect)(() => {
|
|
15905
15957
|
if (open) {
|
|
15906
15958
|
setShouldRender(true);
|
|
15907
15959
|
setIsClosing(false);
|
|
@@ -15915,11 +15967,11 @@ var ContextMenuContent = (0, import_react63.forwardRef)(function ContextMenuCont
|
|
|
15915
15967
|
}, CLOSE_MS);
|
|
15916
15968
|
return () => window.clearTimeout(timeout);
|
|
15917
15969
|
}, [open, shouldRender]);
|
|
15918
|
-
(0,
|
|
15970
|
+
(0, import_react64.useLayoutEffect)(() => {
|
|
15919
15971
|
if (!shouldRender || !localRef.current) return;
|
|
15920
15972
|
placeInView(localRef.current, point.x, point.y);
|
|
15921
15973
|
}, [shouldRender, point.x, point.y]);
|
|
15922
|
-
(0,
|
|
15974
|
+
(0, import_react64.useEffect)(() => {
|
|
15923
15975
|
if (!open) return;
|
|
15924
15976
|
const onKey = (event) => {
|
|
15925
15977
|
if (event.key === "Escape") close();
|
|
@@ -15955,8 +16007,8 @@ var ContextMenuContent = (0, import_react63.forwardRef)(function ContextMenuCont
|
|
|
15955
16007
|
position: "fixed",
|
|
15956
16008
|
top: point.y,
|
|
15957
16009
|
left: point.x,
|
|
15958
|
-
width:
|
|
15959
|
-
minWidth:
|
|
16010
|
+
width: import_tokens39.componentSizes.menuPanelWidth,
|
|
16011
|
+
minWidth: import_tokens39.componentSizes.menuPanelWidth,
|
|
15960
16012
|
zIndex: 9999,
|
|
15961
16013
|
...style
|
|
15962
16014
|
},
|
|
@@ -15982,7 +16034,7 @@ function runSelect(onSelect, close, disabled) {
|
|
|
15982
16034
|
onSelect?.(selectEvent);
|
|
15983
16035
|
if (!selectEvent.defaultPrevented) close();
|
|
15984
16036
|
}
|
|
15985
|
-
var ContextMenuItem = (0,
|
|
16037
|
+
var ContextMenuItem = (0, import_react64.forwardRef)(function ContextMenuItem2({ disabled = false, description, shortcut, startIcon, endIcon, state = "default", onSelect, className, onClick, onKeyDown, children, ...props }, ref) {
|
|
15986
16038
|
const { close } = useMenu();
|
|
15987
16039
|
const isDisabled = disabled || state === "disabled";
|
|
15988
16040
|
const slotted = startIcon != null || description != null || shortcut != null || endIcon != null;
|
|
@@ -16017,7 +16069,7 @@ var ContextMenuItem = (0, import_react63.forwardRef)(function ContextMenuItem2({
|
|
|
16017
16069
|
"span",
|
|
16018
16070
|
{
|
|
16019
16071
|
className: menuStyles.iconWrap,
|
|
16020
|
-
style: { width:
|
|
16072
|
+
style: { width: import_tokens39.iconSizes.small, minWidth: import_tokens39.iconSizes.small, height: import_tokens39.iconSizes.small },
|
|
16021
16073
|
children: startIcon
|
|
16022
16074
|
}
|
|
16023
16075
|
) : null,
|
|
@@ -16031,7 +16083,7 @@ var ContextMenuItem = (0, import_react63.forwardRef)(function ContextMenuItem2({
|
|
|
16031
16083
|
"span",
|
|
16032
16084
|
{
|
|
16033
16085
|
className: menuStyles.iconWrap,
|
|
16034
|
-
style: { width:
|
|
16086
|
+
style: { width: import_tokens39.iconSizes.small, minWidth: import_tokens39.iconSizes.small, height: import_tokens39.iconSizes.small },
|
|
16035
16087
|
children: endIcon
|
|
16036
16088
|
}
|
|
16037
16089
|
) : null
|
|
@@ -16040,7 +16092,7 @@ var ContextMenuItem = (0, import_react63.forwardRef)(function ContextMenuItem2({
|
|
|
16040
16092
|
}
|
|
16041
16093
|
);
|
|
16042
16094
|
});
|
|
16043
|
-
var ContextMenuSeparator = (0,
|
|
16095
|
+
var ContextMenuSeparator = (0, import_react64.forwardRef)(
|
|
16044
16096
|
function ContextMenuSeparator2({ className, ...props }, ref) {
|
|
16045
16097
|
return /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(
|
|
16046
16098
|
"div",
|
|
@@ -16061,15 +16113,15 @@ function ContextMenuLabel({ className, children, ...props }) {
|
|
|
16061
16113
|
return /* @__PURE__ */ (0, import_jsx_runtime81.jsx)("div", { "data-refineui": "menu-label", className: (0, import_clsx109.clsx)(menuStyles.section, className), ...props, children: /* @__PURE__ */ (0, import_jsx_runtime81.jsx)("span", { className: menuStyles.sectionText, children }) });
|
|
16062
16114
|
}
|
|
16063
16115
|
function ContextMenuSub({ children }) {
|
|
16064
|
-
const [open, setOpen] = (0,
|
|
16065
|
-
const triggerRef = (0,
|
|
16066
|
-
const timer = (0,
|
|
16116
|
+
const [open, setOpen] = (0, import_react64.useState)(false);
|
|
16117
|
+
const triggerRef = (0, import_react64.useRef)(null);
|
|
16118
|
+
const timer = (0, import_react64.useRef)(null);
|
|
16067
16119
|
const clear = () => {
|
|
16068
16120
|
if (timer.current != null) window.clearTimeout(timer.current);
|
|
16069
16121
|
timer.current = null;
|
|
16070
16122
|
};
|
|
16071
|
-
(0,
|
|
16072
|
-
const value = (0,
|
|
16123
|
+
(0, import_react64.useEffect)(() => clear, []);
|
|
16124
|
+
const value = (0, import_react64.useMemo)(
|
|
16073
16125
|
() => ({
|
|
16074
16126
|
open,
|
|
16075
16127
|
triggerRef,
|
|
@@ -16087,11 +16139,11 @@ function ContextMenuSub({ children }) {
|
|
|
16087
16139
|
return /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(SubContext.Provider, { value, children });
|
|
16088
16140
|
}
|
|
16089
16141
|
function useSub2() {
|
|
16090
|
-
const value = (0,
|
|
16142
|
+
const value = (0, import_react64.useContext)(SubContext);
|
|
16091
16143
|
if (!value) throw new Error("ContextMenuSubTrigger must be used within ContextMenuSub");
|
|
16092
16144
|
return value;
|
|
16093
16145
|
}
|
|
16094
|
-
var ContextMenuSubTrigger = (0,
|
|
16146
|
+
var ContextMenuSubTrigger = (0, import_react64.forwardRef)(
|
|
16095
16147
|
function ContextMenuSubTrigger2({ asChild = false, description, startIcon, onMouseEnter, onMouseLeave, onClick, className, children, ...props }, ref) {
|
|
16096
16148
|
const sub = useSub2();
|
|
16097
16149
|
const shared = {
|
|
@@ -16127,13 +16179,13 @@ var ContextMenuSubTrigger = (0, import_react63.forwardRef)(
|
|
|
16127
16179
|
if (!event.defaultPrevented) sub.show();
|
|
16128
16180
|
}
|
|
16129
16181
|
};
|
|
16130
|
-
if (asChild) return /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(
|
|
16182
|
+
if (asChild) return /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(import_react65.Slot, { ...shared, children });
|
|
16131
16183
|
return /* @__PURE__ */ (0, import_jsx_runtime81.jsx)("button", { ...shared, children: /* @__PURE__ */ (0, import_jsx_runtime81.jsxs)("span", { className: menuStyles.row, children: [
|
|
16132
16184
|
startIcon ? /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(
|
|
16133
16185
|
"span",
|
|
16134
16186
|
{
|
|
16135
16187
|
className: menuStyles.iconWrap,
|
|
16136
|
-
style: { width:
|
|
16188
|
+
style: { width: import_tokens39.iconSizes.small, minWidth: import_tokens39.iconSizes.small, height: import_tokens39.iconSizes.small },
|
|
16137
16189
|
children: startIcon
|
|
16138
16190
|
}
|
|
16139
16191
|
) : null,
|
|
@@ -16145,19 +16197,19 @@ var ContextMenuSubTrigger = (0, import_react63.forwardRef)(
|
|
|
16145
16197
|
"span",
|
|
16146
16198
|
{
|
|
16147
16199
|
className: menuStyles.iconWrap,
|
|
16148
|
-
style: { width:
|
|
16149
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(WebIcon, { name: "chevron-right", size:
|
|
16200
|
+
style: { width: import_tokens39.iconSizes.small, minWidth: import_tokens39.iconSizes.small, height: import_tokens39.iconSizes.small },
|
|
16201
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(WebIcon, { name: "chevron-right", size: import_tokens39.iconSizes.small, color: "currentColor", "aria-hidden": true })
|
|
16150
16202
|
}
|
|
16151
16203
|
) })
|
|
16152
16204
|
] }) });
|
|
16153
16205
|
}
|
|
16154
16206
|
);
|
|
16155
|
-
var ContextMenuSubContent = (0,
|
|
16207
|
+
var ContextMenuSubContent = (0, import_react64.forwardRef)(
|
|
16156
16208
|
function ContextMenuSubContent2({ className, style, onPointerDown, onMouseEnter, onMouseLeave, ...props }, ref) {
|
|
16157
16209
|
const sub = useSub2();
|
|
16158
|
-
const localRef = (0,
|
|
16159
|
-
const [side, setSide] = (0,
|
|
16160
|
-
(0,
|
|
16210
|
+
const localRef = (0, import_react64.useRef)(null);
|
|
16211
|
+
const [side, setSide] = (0, import_react64.useState)("right");
|
|
16212
|
+
(0, import_react64.useLayoutEffect)(() => {
|
|
16161
16213
|
const trigger = sub.triggerRef.current;
|
|
16162
16214
|
const element = localRef.current;
|
|
16163
16215
|
if (!sub.open || !trigger || !element) return;
|