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