@refineui/react 0.0.9 → 0.0.11
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/index.cjs +693 -490
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +36 -25
- package/dist/index.d.ts +36 -25
- package/dist/index.js +641 -433
- package/dist/index.js.map +1 -1
- package/dist/spec/components/sidebar.json +3 -1
- package/dist/spec/contract-index.json +1 -1
- package/dist/spec/token-graph.json +73 -111
- package/dist/spec/token-trace-v2.json +35 -62
- package/package.json +1 -1
- package/refineui.css +36 -15
- package/spec/components/sidebar.json +3 -1
package/dist/index.cjs
CHANGED
|
@@ -209,7 +209,7 @@ __export(index_exports, {
|
|
|
209
209
|
ResizableHandle: () => ResizableHandle,
|
|
210
210
|
ResizablePanel: () => ResizablePanel,
|
|
211
211
|
ResizablePanelGroup: () => ResizablePanelGroup,
|
|
212
|
-
SEMANTIC_TEXT: () =>
|
|
212
|
+
SEMANTIC_TEXT: () => import_tokens39.SEMANTIC_TEXT,
|
|
213
213
|
ScrollArea: () => ScrollArea,
|
|
214
214
|
ScrollAreaScrollbar: () => ScrollAreaScrollbar,
|
|
215
215
|
ScrollAreaThumb: () => ScrollAreaThumb,
|
|
@@ -250,9 +250,11 @@ __export(index_exports, {
|
|
|
250
250
|
SidebarPeekInset: () => SidebarPeekInset,
|
|
251
251
|
SidebarPeekPanel: () => SidebarPeekPanel,
|
|
252
252
|
SidebarPeekPin: () => SidebarPeekPin,
|
|
253
|
+
SidebarProvider: () => SidebarProvider,
|
|
254
|
+
SidebarTrigger: () => SidebarTrigger,
|
|
253
255
|
Skeleton: () => Skeleton,
|
|
254
256
|
Slider: () => Slider,
|
|
255
|
-
Slot: () =>
|
|
257
|
+
Slot: () => import_react59.Slot,
|
|
256
258
|
Spacer: () => Spacer,
|
|
257
259
|
SpinButton: () => SpinButton,
|
|
258
260
|
Spinner: () => Spinner,
|
|
@@ -307,6 +309,7 @@ __export(index_exports, {
|
|
|
307
309
|
semanticTextClass: () => semanticTextClass,
|
|
308
310
|
sizedComponentTextClass: () => sizedComponentTextClass,
|
|
309
311
|
toast: () => toast,
|
|
312
|
+
useSidebar: () => useSidebar,
|
|
310
313
|
useSidebarPeek: () => useSidebarPeek
|
|
311
314
|
});
|
|
312
315
|
module.exports = __toCommonJS(index_exports);
|
|
@@ -348,14 +351,13 @@ var componentColorTokens = {
|
|
|
348
351
|
states: buttonPrimaryColorTokens.states
|
|
349
352
|
},
|
|
350
353
|
secondary: {
|
|
351
|
-
background: semanticToken("
|
|
354
|
+
background: semanticToken("backgroundSurfaceHover"),
|
|
352
355
|
foreground: semanticToken("foregroundPrimary"),
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
hoverBorder: semanticToken("borderStrong"),
|
|
356
|
+
hoverBackground: semanticToken("backgroundSurfaceActive"),
|
|
357
|
+
hoverForeground: semanticToken("foregroundPrimaryHover"),
|
|
356
358
|
activeBackground: semanticToken("backgroundSurfaceActive"),
|
|
359
|
+
activeForeground: semanticToken("foregroundPrimary"),
|
|
357
360
|
disabledBackground: semanticToken("backgroundSurfaceDisabled"),
|
|
358
|
-
disabledBorder: semanticToken("borderDisabled"),
|
|
359
361
|
disabledForeground: semanticToken("foregroundDisabled")
|
|
360
362
|
},
|
|
361
363
|
outline: {
|
|
@@ -454,16 +456,16 @@ var componentColorTokens = {
|
|
|
454
456
|
},
|
|
455
457
|
tooltip: {
|
|
456
458
|
default: {
|
|
457
|
-
/**
|
|
458
|
-
background: semanticToken("
|
|
459
|
+
/** Frosted floating panel — blur is applied by refineui.css */
|
|
460
|
+
background: semanticToken("surfaceFrosted"),
|
|
459
461
|
foreground: semanticToken("foregroundPrimary"),
|
|
460
462
|
border: semanticToken("borderDefault")
|
|
461
463
|
}
|
|
462
464
|
},
|
|
463
465
|
popover: {
|
|
464
466
|
default: {
|
|
465
|
-
/**
|
|
466
|
-
background: semanticToken("
|
|
467
|
+
/** Frosted floating panel — blur is applied by refineui.css */
|
|
468
|
+
background: semanticToken("surfaceFrosted"),
|
|
467
469
|
foreground: semanticToken("foregroundPrimary"),
|
|
468
470
|
border: semanticToken("borderDefault")
|
|
469
471
|
},
|
|
@@ -1384,7 +1386,7 @@ function buildSemanticTextClassMap(map) {
|
|
|
1384
1386
|
}
|
|
1385
1387
|
|
|
1386
1388
|
// src/index.ts
|
|
1387
|
-
var
|
|
1389
|
+
var import_tokens39 = require("@refineui/tokens");
|
|
1388
1390
|
|
|
1389
1391
|
// src/componentSizes.ts
|
|
1390
1392
|
var import_tokens3 = require("@refineui/tokens");
|
|
@@ -1504,7 +1506,7 @@ function resolveSlotClasses(recipe, slot, variants = {}) {
|
|
|
1504
1506
|
// src/recipes/button.recipe.ts
|
|
1505
1507
|
var buttonVariantClass = {
|
|
1506
1508
|
primary: "border-refineui-none border border-transparent bg-refineui-alias-background-brand text-refineui-alias-foreground-inversed",
|
|
1507
|
-
secondary: "border-refineui-
|
|
1509
|
+
secondary: "border-refineui-none border border-transparent bg-refineui-alias-background-surface-hover text-refineui-alias-foreground-primary",
|
|
1508
1510
|
outline: "border-refineui-thin border-refineui-alias-border-default bg-transparent text-refineui-alias-foreground-primary",
|
|
1509
1511
|
ghost: "border-refineui-none border border-transparent bg-transparent text-refineui-alias-foreground-primary"
|
|
1510
1512
|
};
|
|
@@ -1542,6 +1544,10 @@ var buttonRecipe = defineRecipe({
|
|
|
1542
1544
|
match: { layout: "icon", variant: "primary" },
|
|
1543
1545
|
className: "border-0"
|
|
1544
1546
|
},
|
|
1547
|
+
{
|
|
1548
|
+
match: { layout: "icon", variant: "secondary" },
|
|
1549
|
+
className: "border-0"
|
|
1550
|
+
},
|
|
1545
1551
|
{
|
|
1546
1552
|
match: { layout: "icon", variant: "ghost" },
|
|
1547
1553
|
className: "border-0"
|
|
@@ -1576,7 +1582,7 @@ var Button = (0, import_react.forwardRef)(function Button2({
|
|
|
1576
1582
|
const inactive = Boolean(disabled) || ariaDisabledProp === true || ariaDisabledProp === "true";
|
|
1577
1583
|
const variantStyles = variant === "ghost" && layout === "icon" ? buttonStyles.iconGhost : buttonVariantClass[variant];
|
|
1578
1584
|
const sizeStyles = layout === "icon" ? buttonIconSizeClass[size] : buttonLabelSizeClass[size];
|
|
1579
|
-
const iconNoStroke = layout === "icon" && (variant === "primary" || variant === "ghost") ? "border-0" : null;
|
|
1585
|
+
const iconNoStroke = layout === "icon" && (variant === "primary" || variant === "secondary" || variant === "ghost") ? "border-0" : null;
|
|
1580
1586
|
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
1581
1587
|
"button",
|
|
1582
1588
|
{
|
|
@@ -9701,8 +9707,12 @@ var menuStyles = {
|
|
|
9701
9707
|
row: "flex items-center gap-refineui-size-x-small",
|
|
9702
9708
|
iconWrap: "inline-flex shrink-0 items-center justify-center text-current [&>span]:leading-none",
|
|
9703
9709
|
textCol: "flex min-w-0 flex-1 flex-col gap-refineui-size-xxx-small px-refineui-size-xxx-small",
|
|
9704
|
-
|
|
9705
|
-
|
|
9710
|
+
/** Preserve labels and supporting copy by wrapping within the shared panel width. */
|
|
9711
|
+
title: (0, import_clsx75.clsx)(componentTextClass(componentTypographyTokens.menu.item), "break-words whitespace-normal"),
|
|
9712
|
+
description: (0, import_clsx75.clsx)(
|
|
9713
|
+
componentTextClass(componentTypographyTokens.menu.description),
|
|
9714
|
+
"break-words whitespace-normal"
|
|
9715
|
+
),
|
|
9706
9716
|
descriptionEnabled: "text-refineui-alias-foreground-tertiary",
|
|
9707
9717
|
descriptionDisabled: "text-refineui-alias-foreground-disabled",
|
|
9708
9718
|
rightWrap: "flex shrink-0 items-center gap-refineui-size-x-small",
|
|
@@ -10175,7 +10185,7 @@ function MenuSubContent({ className, children, style, ...props }) {
|
|
|
10175
10185
|
const [side, setSide] = (0, import_react36.useState)("right");
|
|
10176
10186
|
const gapPx = parseCssPx(import_tokens22.spacings.sizeXXXSmall, 2);
|
|
10177
10187
|
const z = (Number.parseInt(String(import_tokens22.zIndex.zIndexMessages), 10) || 1e4) + 100;
|
|
10178
|
-
const defaultW = parseCssPx(import_tokens3.componentSizes.menuPanelWidth,
|
|
10188
|
+
const defaultW = parseCssPx(import_tokens3.componentSizes.menuPanelWidth, 200);
|
|
10179
10189
|
const setPanelEl = (0, import_react36.useCallback)(
|
|
10180
10190
|
(el) => {
|
|
10181
10191
|
panelRef.current = el;
|
|
@@ -10273,6 +10283,7 @@ function MenuSubContent({ className, children, style, ...props }) {
|
|
|
10273
10283
|
// src/components/NavigationMenu/NavigationMenu.tsx
|
|
10274
10284
|
var import_clsx78 = require("clsx");
|
|
10275
10285
|
var import_react38 = require("react");
|
|
10286
|
+
var import_react_dom6 = require("react-dom");
|
|
10276
10287
|
var import_tokens23 = require("@refineui/tokens");
|
|
10277
10288
|
var import_animation5 = require("@refineui/utilities/animation");
|
|
10278
10289
|
|
|
@@ -10281,34 +10292,34 @@ var import_clsx77 = require("clsx");
|
|
|
10281
10292
|
var topLevelItem = (0, import_clsx77.clsx)(
|
|
10282
10293
|
componentTextClass(componentTypographyTokens.navigationMenu.trigger),
|
|
10283
10294
|
"box-border inline-flex h-refineui-button-min-height-md min-w-refineui-navigation-menu-item-min-width cursor-pointer items-center justify-center gap-refineui-size-x-small",
|
|
10284
|
-
"rounded-refineui-large border-none bg-transparent px-refineui-size-medium py-refineui-size-x-small",
|
|
10295
|
+
"rounded-refineui-x-large border-none bg-transparent px-refineui-size-medium py-refineui-size-x-small",
|
|
10285
10296
|
"text-refineui-alias-foreground-tertiary outline-none leading-none",
|
|
10286
|
-
"transition-[color,background-color] duration-[var(--refineui-motion-duration-fast)]"
|
|
10297
|
+
"transition-[color,background-color,box-shadow] duration-[var(--refineui-motion-duration-fast)] ease-[var(--refineui-motion-easing-ease-out)]"
|
|
10287
10298
|
);
|
|
10288
10299
|
var chevron = (0, import_clsx77.clsx)(
|
|
10289
10300
|
"shrink-0 transition-transform duration-[var(--refineui-motion-duration-fast)] ease-[var(--refineui-motion-easing-ease-out)]"
|
|
10290
10301
|
);
|
|
10291
10302
|
var navigationMenuStyles = {
|
|
10292
10303
|
root: "relative isolate z-refineui-messages flex w-full max-w-max items-center",
|
|
10293
|
-
list: "relative m-0 flex list-none flex-wrap items-center gap-refineui-size-
|
|
10304
|
+
list: "relative m-0 flex list-none flex-wrap items-center gap-refineui-size-xxx-small p-0",
|
|
10294
10305
|
item: "relative inline-flex items-center",
|
|
10295
10306
|
trigger: (0, import_clsx77.clsx)(topLevelItem, "m-0 appearance-none font-inherit"),
|
|
10296
|
-
triggerOpen: "text-refineui-alias-foreground-primary",
|
|
10307
|
+
triggerOpen: "bg-refineui-alias-background-primary-hover text-refineui-alias-foreground-primary",
|
|
10297
10308
|
triggerDisabled: "cursor-not-allowed text-refineui-alias-foreground-disabled",
|
|
10298
10309
|
chevron,
|
|
10299
10310
|
chevronOpen: "rotate-180",
|
|
10300
10311
|
content: (0, import_clsx77.clsx)(
|
|
10301
10312
|
/** Flush under trigger so pointer does not leave the item while moving into the panel. */
|
|
10302
10313
|
"absolute start-0 top-full z-refineui-messages pt-refineui-size-xx-small",
|
|
10303
|
-
"box-border min-w-refineui-menu-panel-width",
|
|
10314
|
+
"box-border min-w-refineui-navigation-menu-panel-width",
|
|
10304
10315
|
"outline-none"
|
|
10305
10316
|
),
|
|
10306
10317
|
contentPanel: (0, import_clsx77.clsx)(
|
|
10307
|
-
"box-border overflow-hidden rounded-refineui-large border-refineui-hairline border-refineui-alias-border-default",
|
|
10308
|
-
"
|
|
10318
|
+
"box-border flex flex-col gap-px overflow-hidden rounded-refineui-xx-large border-refineui-hairline border-refineui-alias-border-default",
|
|
10319
|
+
"p-refineui-size-xx-small shadow-refineui-2"
|
|
10309
10320
|
),
|
|
10310
10321
|
link: (0, import_clsx77.clsx)(topLevelItem, "no-underline"),
|
|
10311
|
-
linkActive: "text-refineui-alias-foreground-primary",
|
|
10322
|
+
linkActive: "bg-refineui-alias-background-primary-hover text-refineui-alias-foreground-primary",
|
|
10312
10323
|
linkDisabled: "cursor-not-allowed text-refineui-alias-foreground-disabled",
|
|
10313
10324
|
/** Dense row inside a content panel — same density as Menu item. */
|
|
10314
10325
|
linkInContent: (0, import_clsx77.clsx)(
|
|
@@ -10316,7 +10327,7 @@ var navigationMenuStyles = {
|
|
|
10316
10327
|
"box-border flex w-full cursor-pointer items-center gap-refineui-size-x-small",
|
|
10317
10328
|
"rounded-refineui-large border-none bg-transparent p-refineui-size-x-small text-start no-underline outline-none",
|
|
10318
10329
|
"text-refineui-alias-foreground-primary",
|
|
10319
|
-
"transition-[background-color,color] duration-[var(--refineui-motion-duration-fast)]"
|
|
10330
|
+
"transition-[background-color,color] duration-[var(--refineui-motion-duration-fast)] ease-[var(--refineui-motion-easing-ease-out)]"
|
|
10320
10331
|
),
|
|
10321
10332
|
/** Optional — prefer omitting; kept for API compatibility. */
|
|
10322
10333
|
indicator: "hidden"
|
|
@@ -10368,6 +10379,7 @@ function NavigationMenu({
|
|
|
10368
10379
|
const [value, setValue] = useControllableOpen(valueControlled, defaultValue, onValueChange);
|
|
10369
10380
|
const listRef = (0, import_react38.useRef)(null);
|
|
10370
10381
|
const triggerMapRef = (0, import_react38.useRef)(/* @__PURE__ */ new Map());
|
|
10382
|
+
const contentMapRef = (0, import_react38.useRef)(/* @__PURE__ */ new Map());
|
|
10371
10383
|
const openTimerRef = (0, import_react38.useRef)(null);
|
|
10372
10384
|
const closeTimerRef = (0, import_react38.useRef)(null);
|
|
10373
10385
|
const rootRef = (0, import_react38.useRef)(null);
|
|
@@ -10426,12 +10438,25 @@ function NavigationMenu({
|
|
|
10426
10438
|
triggerMapRef.current.delete(itemValue);
|
|
10427
10439
|
}
|
|
10428
10440
|
}, []);
|
|
10441
|
+
const registerContent = (0, import_react38.useCallback)((itemValue, el) => {
|
|
10442
|
+
if (el) {
|
|
10443
|
+
contentMapRef.current.set(itemValue, el);
|
|
10444
|
+
} else {
|
|
10445
|
+
contentMapRef.current.delete(itemValue);
|
|
10446
|
+
}
|
|
10447
|
+
}, []);
|
|
10448
|
+
const isContentTarget = (0, import_react38.useCallback)((itemValue, target) => {
|
|
10449
|
+
return target instanceof Node && contentMapRef.current.get(itemValue)?.contains(target) === true;
|
|
10450
|
+
}, []);
|
|
10451
|
+
const isMenuTarget = (0, import_react38.useCallback)((target) => {
|
|
10452
|
+
if (!(target instanceof Node)) return false;
|
|
10453
|
+
return rootRef.current?.contains(target) === true || Array.from(contentMapRef.current.values()).some((content) => content.contains(target));
|
|
10454
|
+
}, []);
|
|
10429
10455
|
(0, import_react38.useEffect)(() => () => clearTimers(), [clearTimers]);
|
|
10430
10456
|
(0, import_react38.useEffect)(() => {
|
|
10431
10457
|
if (!value) return;
|
|
10432
10458
|
const onPointerDown = (event) => {
|
|
10433
|
-
|
|
10434
|
-
if (rootRef.current?.contains(target)) return;
|
|
10459
|
+
if (isMenuTarget(event.target)) return;
|
|
10435
10460
|
setValueSafe("");
|
|
10436
10461
|
};
|
|
10437
10462
|
const onKeyDown = (event) => {
|
|
@@ -10447,7 +10472,7 @@ function NavigationMenu({
|
|
|
10447
10472
|
document.removeEventListener("pointerdown", onPointerDown);
|
|
10448
10473
|
document.removeEventListener("keydown", onKeyDown);
|
|
10449
10474
|
};
|
|
10450
|
-
}, [setValueSafe, value]);
|
|
10475
|
+
}, [isMenuTarget, setValueSafe, value]);
|
|
10451
10476
|
const ctx = (0, import_react38.useMemo)(
|
|
10452
10477
|
() => ({
|
|
10453
10478
|
value,
|
|
@@ -10458,9 +10483,23 @@ function NavigationMenu({
|
|
|
10458
10483
|
skipDelayDuration,
|
|
10459
10484
|
listRef,
|
|
10460
10485
|
registerTrigger,
|
|
10486
|
+
registerContent,
|
|
10487
|
+
isContentTarget,
|
|
10488
|
+
isMenuTarget,
|
|
10461
10489
|
isInsideContent: false
|
|
10462
10490
|
}),
|
|
10463
|
-
[
|
|
10491
|
+
[
|
|
10492
|
+
close,
|
|
10493
|
+
delayDuration,
|
|
10494
|
+
isContentTarget,
|
|
10495
|
+
isMenuTarget,
|
|
10496
|
+
openItem,
|
|
10497
|
+
registerContent,
|
|
10498
|
+
registerTrigger,
|
|
10499
|
+
setValueSafe,
|
|
10500
|
+
skipDelayDuration,
|
|
10501
|
+
value
|
|
10502
|
+
]
|
|
10464
10503
|
);
|
|
10465
10504
|
return /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(NavigationMenuContext.Provider, { value: ctx, children: /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
|
|
10466
10505
|
"nav",
|
|
@@ -10549,6 +10588,7 @@ function NavigationMenuItem({
|
|
|
10549
10588
|
onPointerLeave: (event) => {
|
|
10550
10589
|
onPointerLeave?.(event);
|
|
10551
10590
|
if (event.defaultPrevented) return;
|
|
10591
|
+
if (menu.isContentTarget(value, event.relatedTarget)) return;
|
|
10552
10592
|
menu.close();
|
|
10553
10593
|
},
|
|
10554
10594
|
...props,
|
|
@@ -10637,12 +10677,22 @@ function NavigationMenuContent({
|
|
|
10637
10677
|
children,
|
|
10638
10678
|
className,
|
|
10639
10679
|
onKeyDown,
|
|
10680
|
+
style,
|
|
10640
10681
|
...props
|
|
10641
10682
|
}) {
|
|
10642
10683
|
const menu = useNavigationMenu("NavigationMenuContent");
|
|
10643
10684
|
const item = useNavigationMenuItem("NavigationMenuContent");
|
|
10644
10685
|
const [shouldRender, setShouldRender] = (0, import_react38.useState)(item.open);
|
|
10645
10686
|
const [isClosing, setIsClosing] = (0, import_react38.useState)(false);
|
|
10687
|
+
const contentRef = (0, import_react38.useRef)(null);
|
|
10688
|
+
const [positionStyle, setPositionStyle] = (0, import_react38.useState)(null);
|
|
10689
|
+
const setContentRef = (0, import_react38.useCallback)(
|
|
10690
|
+
(el) => {
|
|
10691
|
+
contentRef.current = el;
|
|
10692
|
+
menu.registerContent(item.value, el);
|
|
10693
|
+
},
|
|
10694
|
+
[item.value, menu]
|
|
10695
|
+
);
|
|
10646
10696
|
(0, import_react38.useEffect)(() => {
|
|
10647
10697
|
if (item.open) {
|
|
10648
10698
|
setShouldRender(true);
|
|
@@ -10657,20 +10707,58 @@ function NavigationMenuContent({
|
|
|
10657
10707
|
}, (0, import_animation5.motionMsToNumber)(import_tokens23.semanticInteraction.duration.fast));
|
|
10658
10708
|
return () => window.clearTimeout(timeout);
|
|
10659
10709
|
}, [item.open, shouldRender]);
|
|
10710
|
+
useIsomorphicLayoutEffect5(() => {
|
|
10711
|
+
if (!shouldRender || !item.open || typeof document === "undefined") return;
|
|
10712
|
+
const trigger = document.getElementById(item.triggerId);
|
|
10713
|
+
if (!trigger) return;
|
|
10714
|
+
const updatePosition = () => {
|
|
10715
|
+
const content2 = contentRef.current;
|
|
10716
|
+
if (!content2) return;
|
|
10717
|
+
const triggerRect = trigger.getBoundingClientRect();
|
|
10718
|
+
const contentWidth = content2.offsetWidth;
|
|
10719
|
+
const edge = Number.parseFloat(import_tokens23.spacings.sizeMedium) || 8;
|
|
10720
|
+
const left = Math.max(
|
|
10721
|
+
edge,
|
|
10722
|
+
Math.min(triggerRect.left, window.innerWidth - contentWidth - edge)
|
|
10723
|
+
);
|
|
10724
|
+
setPositionStyle({
|
|
10725
|
+
position: "fixed",
|
|
10726
|
+
top: triggerRect.bottom,
|
|
10727
|
+
left,
|
|
10728
|
+
zIndex: Number.parseInt(String(import_tokens23.zIndex.zIndexMessages), 10) || 1e4
|
|
10729
|
+
});
|
|
10730
|
+
};
|
|
10731
|
+
updatePosition();
|
|
10732
|
+
const frame = requestAnimationFrame(updatePosition);
|
|
10733
|
+
window.addEventListener("resize", updatePosition);
|
|
10734
|
+
const unsubscribe = subscribeScrollAndScrollableAncestors2(trigger, updatePosition);
|
|
10735
|
+
return () => {
|
|
10736
|
+
cancelAnimationFrame(frame);
|
|
10737
|
+
window.removeEventListener("resize", updatePosition);
|
|
10738
|
+
unsubscribe();
|
|
10739
|
+
};
|
|
10740
|
+
}, [item.open, item.triggerId, shouldRender]);
|
|
10660
10741
|
const contentCtx = (0, import_react38.useMemo)(
|
|
10661
10742
|
() => ({ ...menu, isInsideContent: true }),
|
|
10662
10743
|
[menu]
|
|
10663
10744
|
);
|
|
10664
10745
|
if (!shouldRender) return null;
|
|
10665
|
-
|
|
10746
|
+
const content = /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(NavigationMenuContext.Provider, { value: contentCtx, children: /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
|
|
10666
10747
|
"div",
|
|
10667
10748
|
{
|
|
10749
|
+
ref: setContentRef,
|
|
10668
10750
|
id: item.contentId,
|
|
10669
10751
|
role: "region",
|
|
10670
10752
|
"aria-labelledby": item.triggerId,
|
|
10671
10753
|
"data-refineui": "navigation-menu-content",
|
|
10672
10754
|
"data-state": isClosing || !item.open ? "closed" : "open",
|
|
10673
10755
|
className: (0, import_clsx78.clsx)(navigationMenuStyles.content, className),
|
|
10756
|
+
style: { ...positionStyle, ...style },
|
|
10757
|
+
onPointerEnter: () => menu.openItem(item.value, { immediate: true }),
|
|
10758
|
+
onPointerLeave: (event) => {
|
|
10759
|
+
if (menu.isMenuTarget(event.relatedTarget)) return;
|
|
10760
|
+
menu.close();
|
|
10761
|
+
},
|
|
10674
10762
|
onKeyDown: (event) => {
|
|
10675
10763
|
onKeyDown?.(event);
|
|
10676
10764
|
if (event.defaultPrevented) return;
|
|
@@ -10683,6 +10771,7 @@ function NavigationMenuContent({
|
|
|
10683
10771
|
children: /* @__PURE__ */ (0, import_jsx_runtime59.jsx)("div", { "data-refineui": "navigation-menu-content-panel", className: navigationMenuStyles.contentPanel, children })
|
|
10684
10772
|
}
|
|
10685
10773
|
) });
|
|
10774
|
+
return typeof document === "undefined" ? content : (0, import_react_dom6.createPortal)(content, document.body);
|
|
10686
10775
|
}
|
|
10687
10776
|
function NavigationMenuLink({
|
|
10688
10777
|
children,
|
|
@@ -11209,6 +11298,81 @@ function useSidebarPeek() {
|
|
|
11209
11298
|
return useSidebarPeekContext("useSidebarPeek");
|
|
11210
11299
|
}
|
|
11211
11300
|
|
|
11301
|
+
// src/components/Sidebar/SidebarProvider.tsx
|
|
11302
|
+
var import_react40 = require("react");
|
|
11303
|
+
var import_react41 = require("@refineui/utilities/react");
|
|
11304
|
+
var import_jsx_runtime62 = require("react/jsx-runtime");
|
|
11305
|
+
var SidebarContext = (0, import_react40.createContext)(null);
|
|
11306
|
+
function useSidebarContext(component) {
|
|
11307
|
+
const value = (0, import_react40.useContext)(SidebarContext);
|
|
11308
|
+
if (!value) throw new Error(`${component} must be used within <SidebarProvider>.`);
|
|
11309
|
+
return value;
|
|
11310
|
+
}
|
|
11311
|
+
function useSidebar() {
|
|
11312
|
+
return useSidebarContext("useSidebar");
|
|
11313
|
+
}
|
|
11314
|
+
function SidebarProvider({
|
|
11315
|
+
open: openProp,
|
|
11316
|
+
defaultOpen = true,
|
|
11317
|
+
onOpenChange,
|
|
11318
|
+
id,
|
|
11319
|
+
children
|
|
11320
|
+
}) {
|
|
11321
|
+
const [uncontrolled, setUncontrolled] = (0, import_react40.useState)(defaultOpen);
|
|
11322
|
+
const open = openProp ?? uncontrolled;
|
|
11323
|
+
const generatedId = (0, import_react40.useId)();
|
|
11324
|
+
const sidebarId = id ?? generatedId;
|
|
11325
|
+
const toggle = (0, import_react40.useCallback)(() => {
|
|
11326
|
+
const next = !open;
|
|
11327
|
+
if (openProp === void 0) setUncontrolled(next);
|
|
11328
|
+
onOpenChange?.(next);
|
|
11329
|
+
}, [onOpenChange, open, openProp]);
|
|
11330
|
+
const value = (0, import_react40.useMemo)(
|
|
11331
|
+
() => ({ open, sidebarId, toggle }),
|
|
11332
|
+
[open, sidebarId, toggle]
|
|
11333
|
+
);
|
|
11334
|
+
return /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(SidebarContext.Provider, { value, children });
|
|
11335
|
+
}
|
|
11336
|
+
var SidebarTrigger = (0, import_react40.forwardRef)(function SidebarTrigger2({
|
|
11337
|
+
asChild = false,
|
|
11338
|
+
onClick,
|
|
11339
|
+
className,
|
|
11340
|
+
children,
|
|
11341
|
+
variant = "secondary",
|
|
11342
|
+
size,
|
|
11343
|
+
layout,
|
|
11344
|
+
fullWidth,
|
|
11345
|
+
type = "button",
|
|
11346
|
+
...props
|
|
11347
|
+
}, ref) {
|
|
11348
|
+
const { open, toggle, sidebarId } = useSidebarContext("SidebarTrigger");
|
|
11349
|
+
const shared = {
|
|
11350
|
+
...props,
|
|
11351
|
+
ref,
|
|
11352
|
+
"aria-expanded": open,
|
|
11353
|
+
"aria-controls": sidebarId,
|
|
11354
|
+
"data-state": open ? "open" : "closed",
|
|
11355
|
+
className,
|
|
11356
|
+
onClick: (event) => {
|
|
11357
|
+
onClick?.(event);
|
|
11358
|
+
if (!event.defaultPrevented) toggle();
|
|
11359
|
+
}
|
|
11360
|
+
};
|
|
11361
|
+
if (asChild) return /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(import_react41.Slot, { ...shared, children });
|
|
11362
|
+
return /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
|
|
11363
|
+
Button,
|
|
11364
|
+
{
|
|
11365
|
+
...shared,
|
|
11366
|
+
type,
|
|
11367
|
+
variant,
|
|
11368
|
+
size,
|
|
11369
|
+
layout,
|
|
11370
|
+
fullWidth,
|
|
11371
|
+
children
|
|
11372
|
+
}
|
|
11373
|
+
);
|
|
11374
|
+
});
|
|
11375
|
+
|
|
11212
11376
|
// src/components/Pagination/Pagination.tsx
|
|
11213
11377
|
var import_clsx84 = require("clsx");
|
|
11214
11378
|
var import_tokens25 = require("@refineui/tokens");
|
|
@@ -11229,18 +11393,18 @@ var paginationStyles = {
|
|
|
11229
11393
|
};
|
|
11230
11394
|
|
|
11231
11395
|
// src/components/Pagination/Pagination.tsx
|
|
11232
|
-
var
|
|
11396
|
+
var import_jsx_runtime63 = require("react/jsx-runtime");
|
|
11233
11397
|
function PaginationRoot({ className, ...props }) {
|
|
11234
|
-
return /* @__PURE__ */ (0,
|
|
11398
|
+
return /* @__PURE__ */ (0, import_jsx_runtime63.jsx)("nav", { "aria-label": "Pagination", className: (0, import_clsx84.clsx)(paginationStyles.root, className), ...props });
|
|
11235
11399
|
}
|
|
11236
11400
|
function PaginationContent({ className, ...props }) {
|
|
11237
|
-
return /* @__PURE__ */ (0,
|
|
11401
|
+
return /* @__PURE__ */ (0, import_jsx_runtime63.jsx)("ul", { className: (0, import_clsx84.clsx)(paginationStyles.listWrap, className), ...props });
|
|
11238
11402
|
}
|
|
11239
11403
|
function PaginationItem({ className, ...props }) {
|
|
11240
|
-
return /* @__PURE__ */ (0,
|
|
11404
|
+
return /* @__PURE__ */ (0, import_jsx_runtime63.jsx)("li", { className, ...props });
|
|
11241
11405
|
}
|
|
11242
11406
|
function PaginationLink({ className, isActive, ...props }) {
|
|
11243
|
-
return /* @__PURE__ */ (0,
|
|
11407
|
+
return /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
|
|
11244
11408
|
"a",
|
|
11245
11409
|
{
|
|
11246
11410
|
"data-refineui": "pagination",
|
|
@@ -11260,7 +11424,7 @@ function PaginationNavButton({
|
|
|
11260
11424
|
}) {
|
|
11261
11425
|
const isPrev = direction === "prev";
|
|
11262
11426
|
const iconColor = disabled ? (0, import_color10.resolveColorTokenValue)(componentColorTokens.pagination.navIcon.disabled) : (0, import_color10.resolveColorTokenValue)(componentColorTokens.pagination.navIcon.default);
|
|
11263
|
-
return /* @__PURE__ */ (0,
|
|
11427
|
+
return /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
|
|
11264
11428
|
"button",
|
|
11265
11429
|
{
|
|
11266
11430
|
type: "button",
|
|
@@ -11270,7 +11434,7 @@ function PaginationNavButton({
|
|
|
11270
11434
|
"aria-label": isPrev ? "Previous page" : "Next page",
|
|
11271
11435
|
className: (0, import_clsx84.clsx)(paginationStyles.itemShell, paginationStyles.nav, className),
|
|
11272
11436
|
...props,
|
|
11273
|
-
children: /* @__PURE__ */ (0,
|
|
11437
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
|
|
11274
11438
|
WebIcon,
|
|
11275
11439
|
{
|
|
11276
11440
|
name: isPrev ? "chevron-left" : "chevron-right",
|
|
@@ -11283,13 +11447,13 @@ function PaginationNavButton({
|
|
|
11283
11447
|
);
|
|
11284
11448
|
}
|
|
11285
11449
|
function PaginationPrevious(props) {
|
|
11286
|
-
return /* @__PURE__ */ (0,
|
|
11450
|
+
return /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(PaginationNavButton, { direction: "prev", ...props });
|
|
11287
11451
|
}
|
|
11288
11452
|
function PaginationNext(props) {
|
|
11289
|
-
return /* @__PURE__ */ (0,
|
|
11453
|
+
return /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(PaginationNavButton, { direction: "next", ...props });
|
|
11290
11454
|
}
|
|
11291
11455
|
function PaginationEllipsis({ className, ...props }) {
|
|
11292
|
-
return /* @__PURE__ */ (0,
|
|
11456
|
+
return /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
|
|
11293
11457
|
"span",
|
|
11294
11458
|
{
|
|
11295
11459
|
"aria-hidden": true,
|
|
@@ -11297,7 +11461,7 @@ function PaginationEllipsis({ className, ...props }) {
|
|
|
11297
11461
|
"data-ellipsis": "true",
|
|
11298
11462
|
className: (0, import_clsx84.clsx)(paginationStyles.itemShell, paginationStyles.ellipsis, className),
|
|
11299
11463
|
...props,
|
|
11300
|
-
children: /* @__PURE__ */ (0,
|
|
11464
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
|
|
11301
11465
|
WebIcon,
|
|
11302
11466
|
{
|
|
11303
11467
|
name: "more-horizontal",
|
|
@@ -11310,15 +11474,15 @@ function PaginationEllipsis({ className, ...props }) {
|
|
|
11310
11474
|
);
|
|
11311
11475
|
}
|
|
11312
11476
|
function Pagination(props) {
|
|
11313
|
-
return /* @__PURE__ */ (0,
|
|
11477
|
+
return /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(PaginationRoot, { ...props });
|
|
11314
11478
|
}
|
|
11315
11479
|
|
|
11316
11480
|
// src/components/PopOver/PopOver.tsx
|
|
11317
11481
|
var import_clsx85 = require("clsx");
|
|
11318
|
-
var
|
|
11482
|
+
var import_react42 = require("react");
|
|
11319
11483
|
var import_tokens26 = require("@refineui/tokens");
|
|
11320
11484
|
var import_color11 = require("@refineui/utilities/color");
|
|
11321
|
-
var
|
|
11485
|
+
var import_react43 = require("@refineui/utilities/react");
|
|
11322
11486
|
|
|
11323
11487
|
// src/components/PopOver/style.ts
|
|
11324
11488
|
var popoverStyles = {
|
|
@@ -11352,10 +11516,10 @@ function popoverFloatingClasses(placement, align) {
|
|
|
11352
11516
|
}
|
|
11353
11517
|
|
|
11354
11518
|
// src/components/PopOver/PopOver.tsx
|
|
11355
|
-
var
|
|
11356
|
-
var PopoverContext = (0,
|
|
11519
|
+
var import_jsx_runtime64 = require("react/jsx-runtime");
|
|
11520
|
+
var PopoverContext = (0, import_react42.createContext)(null);
|
|
11357
11521
|
function usePopoverContext(component) {
|
|
11358
|
-
const ctx = (0,
|
|
11522
|
+
const ctx = (0, import_react42.useContext)(PopoverContext);
|
|
11359
11523
|
if (!ctx) throw new Error(`${component} must be used within <Popover>`);
|
|
11360
11524
|
return ctx;
|
|
11361
11525
|
}
|
|
@@ -11411,35 +11575,35 @@ function floatingGapStyle(placement) {
|
|
|
11411
11575
|
return { marginLeft: POPOVER_GAP };
|
|
11412
11576
|
}
|
|
11413
11577
|
function Popover({ children, className, open: openProp, defaultOpen = false, onOpenChange, ...props }) {
|
|
11414
|
-
const [internalOpen, setInternalOpen] = (0,
|
|
11578
|
+
const [internalOpen, setInternalOpen] = (0, import_react42.useState)(defaultOpen);
|
|
11415
11579
|
const open = openProp ?? internalOpen;
|
|
11416
|
-
const setOpen = (0,
|
|
11580
|
+
const setOpen = (0, import_react42.useCallback)(
|
|
11417
11581
|
(next) => {
|
|
11418
11582
|
if (openProp === void 0) setInternalOpen(next);
|
|
11419
11583
|
onOpenChange?.(next);
|
|
11420
11584
|
},
|
|
11421
11585
|
[openProp, onOpenChange]
|
|
11422
11586
|
);
|
|
11423
|
-
const toggle = (0,
|
|
11424
|
-
const containerRef = (0,
|
|
11425
|
-
const contentRef = (0,
|
|
11426
|
-
const triggerRef = (0,
|
|
11427
|
-
const contentId = (0,
|
|
11428
|
-
(0,
|
|
11587
|
+
const toggle = (0, import_react42.useCallback)(() => setOpen(!open), [open, setOpen]);
|
|
11588
|
+
const containerRef = (0, import_react42.useRef)(null);
|
|
11589
|
+
const contentRef = (0, import_react42.useRef)(null);
|
|
11590
|
+
const triggerRef = (0, import_react42.useRef)(null);
|
|
11591
|
+
const contentId = (0, import_react42.useId)();
|
|
11592
|
+
(0, import_react42.useEffect)(() => {
|
|
11429
11593
|
const handler = (e) => {
|
|
11430
11594
|
if (containerRef.current && !containerRef.current.contains(e.target)) setOpen(false);
|
|
11431
11595
|
};
|
|
11432
11596
|
if (open) document.addEventListener("mousedown", handler);
|
|
11433
11597
|
return () => document.removeEventListener("mousedown", handler);
|
|
11434
11598
|
}, [open, setOpen]);
|
|
11435
|
-
(0,
|
|
11599
|
+
(0, import_react42.useEffect)(() => {
|
|
11436
11600
|
const onKey = (e) => {
|
|
11437
11601
|
if (e instanceof KeyboardEvent && e.key === "Escape") setOpen(false);
|
|
11438
11602
|
};
|
|
11439
11603
|
if (open) document.addEventListener("keydown", onKey);
|
|
11440
11604
|
return () => document.removeEventListener("keydown", onKey);
|
|
11441
11605
|
}, [open, setOpen]);
|
|
11442
|
-
const onTriggerKeyDown = (0,
|
|
11606
|
+
const onTriggerKeyDown = (0, import_react42.useCallback)(
|
|
11443
11607
|
(e) => {
|
|
11444
11608
|
if (e.key === "Enter" || e.key === " ") {
|
|
11445
11609
|
e.preventDefault();
|
|
@@ -11448,7 +11612,7 @@ function Popover({ children, className, open: openProp, defaultOpen = false, onO
|
|
|
11448
11612
|
},
|
|
11449
11613
|
[toggle]
|
|
11450
11614
|
);
|
|
11451
|
-
const value = (0,
|
|
11615
|
+
const value = (0, import_react42.useMemo)(
|
|
11452
11616
|
() => ({
|
|
11453
11617
|
open,
|
|
11454
11618
|
setOpen,
|
|
@@ -11461,7 +11625,7 @@ function Popover({ children, className, open: openProp, defaultOpen = false, onO
|
|
|
11461
11625
|
}),
|
|
11462
11626
|
[open, setOpen, toggle, contentId, onTriggerKeyDown]
|
|
11463
11627
|
);
|
|
11464
|
-
return /* @__PURE__ */ (0,
|
|
11628
|
+
return /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(PopoverContext.Provider, { value, children: /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
|
|
11465
11629
|
"div",
|
|
11466
11630
|
{
|
|
11467
11631
|
ref: containerRef,
|
|
@@ -11474,11 +11638,11 @@ function Popover({ children, className, open: openProp, defaultOpen = false, onO
|
|
|
11474
11638
|
}
|
|
11475
11639
|
function PopoverTrigger({ children, className, ...props }) {
|
|
11476
11640
|
const { open, toggle, triggerRef, contentId, onTriggerKeyDown } = usePopoverContext("PopoverTrigger");
|
|
11477
|
-
const mergeEl = (0,
|
|
11641
|
+
const mergeEl = (0, import_react43.getMergeableTriggerChild)(children);
|
|
11478
11642
|
if (mergeEl) {
|
|
11479
11643
|
const passthrough = props;
|
|
11480
|
-
return /* @__PURE__ */ (0,
|
|
11481
|
-
|
|
11644
|
+
return /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
|
|
11645
|
+
import_react43.Slot,
|
|
11482
11646
|
{
|
|
11483
11647
|
ref: triggerRef,
|
|
11484
11648
|
...props,
|
|
@@ -11499,7 +11663,7 @@ function PopoverTrigger({ children, className, ...props }) {
|
|
|
11499
11663
|
);
|
|
11500
11664
|
}
|
|
11501
11665
|
const passthroughBtn = props;
|
|
11502
|
-
return /* @__PURE__ */ (0,
|
|
11666
|
+
return /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
|
|
11503
11667
|
"button",
|
|
11504
11668
|
{
|
|
11505
11669
|
type: "button",
|
|
@@ -11542,7 +11706,7 @@ function PopoverContent({
|
|
|
11542
11706
|
const rot = beakRotateDeg(placement);
|
|
11543
11707
|
const gapStyle = floatingGapStyle(placement);
|
|
11544
11708
|
if (!open) return null;
|
|
11545
|
-
return /* @__PURE__ */ (0,
|
|
11709
|
+
return /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
|
|
11546
11710
|
"div",
|
|
11547
11711
|
{
|
|
11548
11712
|
className: (0, import_clsx85.clsx)(
|
|
@@ -11550,8 +11714,8 @@ function PopoverContent({
|
|
|
11550
11714
|
popoverFloatingClasses(placement, align)
|
|
11551
11715
|
),
|
|
11552
11716
|
style: gapStyle,
|
|
11553
|
-
children: /* @__PURE__ */ (0,
|
|
11554
|
-
/* @__PURE__ */ (0,
|
|
11717
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)("div", { className: popoverStyles.panelWrap, children: [
|
|
11718
|
+
/* @__PURE__ */ (0, import_jsx_runtime64.jsx)("div", { className: popoverStyles.beakWrap, style: { ...bw, width: BEAK_W, height: BEAK_H }, "aria-hidden": true, children: /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
|
|
11555
11719
|
"div",
|
|
11556
11720
|
{
|
|
11557
11721
|
style: {
|
|
@@ -11560,7 +11724,7 @@ function PopoverContent({
|
|
|
11560
11724
|
transform: `rotate(${rot}deg)`,
|
|
11561
11725
|
transformOrigin: "center center"
|
|
11562
11726
|
},
|
|
11563
|
-
children: /* @__PURE__ */ (0,
|
|
11727
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)(
|
|
11564
11728
|
"svg",
|
|
11565
11729
|
{
|
|
11566
11730
|
width: BEAK_W,
|
|
@@ -11570,14 +11734,14 @@ function PopoverContent({
|
|
|
11570
11734
|
xmlns: "http://www.w3.org/2000/svg",
|
|
11571
11735
|
style: { display: "block" },
|
|
11572
11736
|
children: [
|
|
11573
|
-
/* @__PURE__ */ (0,
|
|
11574
|
-
/* @__PURE__ */ (0,
|
|
11737
|
+
/* @__PURE__ */ (0, import_jsx_runtime64.jsx)("polygon", { points: "8,0 0,8 16,8", fill: borderCol }),
|
|
11738
|
+
/* @__PURE__ */ (0, import_jsx_runtime64.jsx)("polygon", { points: "8,2 2,8 14,8", fill: bg })
|
|
11575
11739
|
]
|
|
11576
11740
|
}
|
|
11577
11741
|
)
|
|
11578
11742
|
}
|
|
11579
11743
|
) }),
|
|
11580
|
-
/* @__PURE__ */ (0,
|
|
11744
|
+
/* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
|
|
11581
11745
|
"div",
|
|
11582
11746
|
{
|
|
11583
11747
|
ref: contentRef,
|
|
@@ -11617,9 +11781,9 @@ function PopOver({
|
|
|
11617
11781
|
className,
|
|
11618
11782
|
...props
|
|
11619
11783
|
}) {
|
|
11620
|
-
return /* @__PURE__ */ (0,
|
|
11621
|
-
/* @__PURE__ */ (0,
|
|
11622
|
-
/* @__PURE__ */ (0,
|
|
11784
|
+
return /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)(Popover, { className, ...props, children: [
|
|
11785
|
+
/* @__PURE__ */ (0, import_jsx_runtime64.jsx)(PopoverTrigger, { children: trigger }),
|
|
11786
|
+
/* @__PURE__ */ (0, import_jsx_runtime64.jsx)(PopoverContent, { placement, align, children: content })
|
|
11623
11787
|
] });
|
|
11624
11788
|
}
|
|
11625
11789
|
|
|
@@ -11635,7 +11799,7 @@ var skeletonStyles = {
|
|
|
11635
11799
|
};
|
|
11636
11800
|
|
|
11637
11801
|
// src/components/Skeleton/Skeleton.tsx
|
|
11638
|
-
var
|
|
11802
|
+
var import_jsx_runtime65 = require("react/jsx-runtime");
|
|
11639
11803
|
function Skeleton({
|
|
11640
11804
|
width,
|
|
11641
11805
|
height,
|
|
@@ -11667,7 +11831,7 @@ function Skeleton({
|
|
|
11667
11831
|
w = width ?? "100%";
|
|
11668
11832
|
}
|
|
11669
11833
|
const dimStyle = { width: w, height: h };
|
|
11670
|
-
return /* @__PURE__ */ (0,
|
|
11834
|
+
return /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
|
|
11671
11835
|
"div",
|
|
11672
11836
|
{
|
|
11673
11837
|
"data-refineui": "skeleton",
|
|
@@ -11685,7 +11849,7 @@ function Skeleton({
|
|
|
11685
11849
|
|
|
11686
11850
|
// src/components/Slider/Slider.tsx
|
|
11687
11851
|
var import_clsx87 = require("clsx");
|
|
11688
|
-
var
|
|
11852
|
+
var import_react44 = require("react");
|
|
11689
11853
|
|
|
11690
11854
|
// src/components/Slider/style.ts
|
|
11691
11855
|
var sliderStyles = {
|
|
@@ -11693,7 +11857,7 @@ var sliderStyles = {
|
|
|
11693
11857
|
};
|
|
11694
11858
|
|
|
11695
11859
|
// src/components/Slider/Slider.tsx
|
|
11696
|
-
var
|
|
11860
|
+
var import_jsx_runtime66 = require("react/jsx-runtime");
|
|
11697
11861
|
function clampPct(n) {
|
|
11698
11862
|
if (Number.isNaN(n)) return 0;
|
|
11699
11863
|
return Math.min(100, Math.max(0, n));
|
|
@@ -11711,12 +11875,12 @@ function Slider({
|
|
|
11711
11875
|
style,
|
|
11712
11876
|
...props
|
|
11713
11877
|
}) {
|
|
11714
|
-
const [internalFillPct, setInternalFillPct] = (0,
|
|
11878
|
+
const [internalFillPct, setInternalFillPct] = (0, import_react44.useState)(() => {
|
|
11715
11879
|
const v = defaultValue !== void 0 ? Number(defaultValue) : (min + max) / 2;
|
|
11716
11880
|
return clampPct((v - min) / (max - min) * 100);
|
|
11717
11881
|
});
|
|
11718
11882
|
const fillPct = value !== void 0 ? clampPct((Number(value) - min) / (max - min) * 100) : internalFillPct;
|
|
11719
|
-
return /* @__PURE__ */ (0,
|
|
11883
|
+
return /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
|
|
11720
11884
|
"input",
|
|
11721
11885
|
{
|
|
11722
11886
|
type: "range",
|
|
@@ -11753,7 +11917,7 @@ function Slider({
|
|
|
11753
11917
|
// src/components/Carousel/Carousel.tsx
|
|
11754
11918
|
var import_clsx89 = require("clsx");
|
|
11755
11919
|
var import_tokens27 = require("@refineui/tokens");
|
|
11756
|
-
var
|
|
11920
|
+
var import_react45 = require("react");
|
|
11757
11921
|
|
|
11758
11922
|
// src/components/Carousel/style.ts
|
|
11759
11923
|
var import_clsx88 = require("clsx");
|
|
@@ -11785,11 +11949,11 @@ var carouselStyles = {
|
|
|
11785
11949
|
};
|
|
11786
11950
|
|
|
11787
11951
|
// src/components/Carousel/Carousel.tsx
|
|
11788
|
-
var
|
|
11952
|
+
var import_jsx_runtime67 = require("react/jsx-runtime");
|
|
11789
11953
|
var DRAG_COMMIT_RATIO = 0.18;
|
|
11790
|
-
var CarouselContext = (0,
|
|
11954
|
+
var CarouselContext = (0, import_react45.createContext)(null);
|
|
11791
11955
|
function useCarouselContext(component) {
|
|
11792
|
-
const v = (0,
|
|
11956
|
+
const v = (0, import_react45.useContext)(CarouselContext);
|
|
11793
11957
|
if (!v) throw new Error(`${component} must be used within Carousel.`);
|
|
11794
11958
|
return v;
|
|
11795
11959
|
}
|
|
@@ -11808,13 +11972,13 @@ function Carousel({
|
|
|
11808
11972
|
...props
|
|
11809
11973
|
}) {
|
|
11810
11974
|
const isControlled = indexControlled !== void 0;
|
|
11811
|
-
const [internalIndex, setInternalIndex] = (0,
|
|
11812
|
-
const [count, setCount] = (0,
|
|
11813
|
-
const [trackIndex, setTrackIndex] = (0,
|
|
11814
|
-
const [instant, setInstant] = (0,
|
|
11975
|
+
const [internalIndex, setInternalIndex] = (0, import_react45.useState)(defaultIndex);
|
|
11976
|
+
const [count, setCount] = (0, import_react45.useState)(0);
|
|
11977
|
+
const [trackIndex, setTrackIndex] = (0, import_react45.useState)(defaultIndex);
|
|
11978
|
+
const [instant, setInstant] = (0, import_react45.useState)(false);
|
|
11815
11979
|
const index = isControlled ? indexControlled : internalIndex;
|
|
11816
11980
|
const loopActive = loop && count > 1;
|
|
11817
|
-
const commitLogical = (0,
|
|
11981
|
+
const commitLogical = (0, import_react45.useCallback)(
|
|
11818
11982
|
(next) => {
|
|
11819
11983
|
const normalized = clampIndex(next, Math.max(count, 1));
|
|
11820
11984
|
if (!isControlled) setInternalIndex(normalized);
|
|
@@ -11822,13 +11986,13 @@ function Carousel({
|
|
|
11822
11986
|
},
|
|
11823
11987
|
[count, isControlled, onIndexChange]
|
|
11824
11988
|
);
|
|
11825
|
-
(0,
|
|
11989
|
+
(0, import_react45.useLayoutEffect)(() => {
|
|
11826
11990
|
if (count <= 0) return;
|
|
11827
11991
|
const logical = clampIndex(index, count);
|
|
11828
11992
|
if (logical !== index) commitLogical(logical);
|
|
11829
11993
|
setTrackIndex(loopActive ? logical + 1 : logical);
|
|
11830
11994
|
}, [count, loopActive]);
|
|
11831
|
-
(0,
|
|
11995
|
+
(0, import_react45.useEffect)(() => {
|
|
11832
11996
|
if (count <= 0) return;
|
|
11833
11997
|
if (!loopActive) {
|
|
11834
11998
|
setTrackIndex(clampIndex(index, count));
|
|
@@ -11842,7 +12006,7 @@ function Carousel({
|
|
|
11842
12006
|
}, [index, count, loopActive]);
|
|
11843
12007
|
const canScrollPrev = loopActive ? true : index > 0;
|
|
11844
12008
|
const canScrollNext = loopActive ? true : index < count - 1;
|
|
11845
|
-
const scrollTo = (0,
|
|
12009
|
+
const scrollTo = (0, import_react45.useCallback)(
|
|
11846
12010
|
(i) => {
|
|
11847
12011
|
if (count <= 0) return;
|
|
11848
12012
|
const next = clampIndex(i, count);
|
|
@@ -11851,7 +12015,7 @@ function Carousel({
|
|
|
11851
12015
|
},
|
|
11852
12016
|
[commitLogical, count, loopActive]
|
|
11853
12017
|
);
|
|
11854
|
-
const scrollPrev = (0,
|
|
12018
|
+
const scrollPrev = (0, import_react45.useCallback)(() => {
|
|
11855
12019
|
if (count <= 0) return;
|
|
11856
12020
|
if (loopActive) {
|
|
11857
12021
|
if (trackIndex < 1 || trackIndex > count) return;
|
|
@@ -11864,7 +12028,7 @@ function Carousel({
|
|
|
11864
12028
|
setTrackIndex(index - 1);
|
|
11865
12029
|
}
|
|
11866
12030
|
}, [commitLogical, count, index, loopActive, trackIndex]);
|
|
11867
|
-
const scrollNext = (0,
|
|
12031
|
+
const scrollNext = (0, import_react45.useCallback)(() => {
|
|
11868
12032
|
if (count <= 0) return;
|
|
11869
12033
|
if (loopActive) {
|
|
11870
12034
|
if (trackIndex < 1 || trackIndex > count) return;
|
|
@@ -11877,7 +12041,7 @@ function Carousel({
|
|
|
11877
12041
|
setTrackIndex(index + 1);
|
|
11878
12042
|
}
|
|
11879
12043
|
}, [commitLogical, count, index, loopActive, trackIndex]);
|
|
11880
|
-
const onTrackSettled = (0,
|
|
12044
|
+
const onTrackSettled = (0, import_react45.useCallback)(() => {
|
|
11881
12045
|
if (!loopActive) return;
|
|
11882
12046
|
if (trackIndex === 0) {
|
|
11883
12047
|
setInstant(true);
|
|
@@ -11893,7 +12057,7 @@ function Carousel({
|
|
|
11893
12057
|
});
|
|
11894
12058
|
}
|
|
11895
12059
|
}, [count, loopActive, trackIndex]);
|
|
11896
|
-
const ctx = (0,
|
|
12060
|
+
const ctx = (0, import_react45.useMemo)(
|
|
11897
12061
|
() => ({
|
|
11898
12062
|
index,
|
|
11899
12063
|
count,
|
|
@@ -11948,7 +12112,7 @@ function Carousel({
|
|
|
11948
12112
|
break;
|
|
11949
12113
|
}
|
|
11950
12114
|
};
|
|
11951
|
-
return /* @__PURE__ */ (0,
|
|
12115
|
+
return /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(CarouselContext.Provider, { value: ctx, children: /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
|
|
11952
12116
|
"div",
|
|
11953
12117
|
{
|
|
11954
12118
|
"data-refineui": "carousel",
|
|
@@ -11972,21 +12136,21 @@ function CarouselContent({ className, children, ...props }) {
|
|
|
11972
12136
|
instant,
|
|
11973
12137
|
onTrackSettled
|
|
11974
12138
|
} = useCarouselContext("CarouselContent");
|
|
11975
|
-
const viewportRef = (0,
|
|
11976
|
-
const dragStartX = (0,
|
|
11977
|
-
const [dragPx, setDragPx] = (0,
|
|
11978
|
-
const [dragging, setDragging] = (0,
|
|
11979
|
-
const slides =
|
|
12139
|
+
const viewportRef = (0, import_react45.useRef)(null);
|
|
12140
|
+
const dragStartX = (0, import_react45.useRef)(null);
|
|
12141
|
+
const [dragPx, setDragPx] = (0, import_react45.useState)(0);
|
|
12142
|
+
const [dragging, setDragging] = (0, import_react45.useState)(false);
|
|
12143
|
+
const slides = import_react45.Children.toArray(children).filter(import_react45.isValidElement);
|
|
11980
12144
|
const slideCount = slides.length;
|
|
11981
|
-
(0,
|
|
12145
|
+
(0, import_react45.useEffect)(() => {
|
|
11982
12146
|
setCount(slideCount);
|
|
11983
12147
|
}, [setCount, slideCount]);
|
|
11984
12148
|
const trackSlides = loop && slides.length > 1 ? [
|
|
11985
|
-
(0,
|
|
12149
|
+
(0, import_react45.cloneElement)(slides[slides.length - 1], { key: "__carousel-clone-last" }),
|
|
11986
12150
|
...slides,
|
|
11987
|
-
(0,
|
|
12151
|
+
(0, import_react45.cloneElement)(slides[0], { key: "__carousel-clone-first" })
|
|
11988
12152
|
] : slides;
|
|
11989
|
-
const endDrag = (0,
|
|
12153
|
+
const endDrag = (0, import_react45.useCallback)(
|
|
11990
12154
|
(clientX) => {
|
|
11991
12155
|
if (dragStartX.current == null) return;
|
|
11992
12156
|
const width = viewportRef.current?.offsetWidth ?? 1;
|
|
@@ -12035,7 +12199,7 @@ function CarouselContent({ className, children, ...props }) {
|
|
|
12035
12199
|
};
|
|
12036
12200
|
const animated = !dragging && !instant;
|
|
12037
12201
|
const transform = dragPx !== 0 ? `translate3d(calc(-${trackIndex * 100}% + ${dragPx}px), 0, 0)` : `translate3d(-${trackIndex * 100}%, 0, 0)`;
|
|
12038
|
-
return /* @__PURE__ */ (0,
|
|
12202
|
+
return /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
|
|
12039
12203
|
"div",
|
|
12040
12204
|
{
|
|
12041
12205
|
ref: viewportRef,
|
|
@@ -12046,7 +12210,7 @@ function CarouselContent({ className, children, ...props }) {
|
|
|
12046
12210
|
onPointerMove,
|
|
12047
12211
|
onPointerUp,
|
|
12048
12212
|
onPointerCancel,
|
|
12049
|
-
children: /* @__PURE__ */ (0,
|
|
12213
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
|
|
12050
12214
|
"div",
|
|
12051
12215
|
{
|
|
12052
12216
|
"data-refineui": "carousel-track",
|
|
@@ -12061,9 +12225,9 @@ function CarouselContent({ className, children, ...props }) {
|
|
|
12061
12225
|
}
|
|
12062
12226
|
);
|
|
12063
12227
|
}
|
|
12064
|
-
var CarouselItem = (0,
|
|
12228
|
+
var CarouselItem = (0, import_react45.forwardRef)(function CarouselItem2({ className, children, ...props }, ref) {
|
|
12065
12229
|
useCarouselContext("CarouselItem");
|
|
12066
|
-
return /* @__PURE__ */ (0,
|
|
12230
|
+
return /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
|
|
12067
12231
|
"div",
|
|
12068
12232
|
{
|
|
12069
12233
|
ref,
|
|
@@ -12078,12 +12242,12 @@ var CarouselItem = (0, import_react43.forwardRef)(function CarouselItem2({ class
|
|
|
12078
12242
|
});
|
|
12079
12243
|
function CarouselControls({ className, children, ...props }) {
|
|
12080
12244
|
useCarouselContext("CarouselControls");
|
|
12081
|
-
return /* @__PURE__ */ (0,
|
|
12245
|
+
return /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("div", { "data-refineui": "carousel-controls", className: (0, import_clsx89.clsx)(carouselStyles.controls, className), ...props, children });
|
|
12082
12246
|
}
|
|
12083
12247
|
function CarouselPrevious({ className, disabled, onClick, ...props }) {
|
|
12084
12248
|
const { scrollPrev, canScrollPrev } = useCarouselContext("CarouselPrevious");
|
|
12085
12249
|
const isDisabled = disabled || !canScrollPrev;
|
|
12086
|
-
return /* @__PURE__ */ (0,
|
|
12250
|
+
return /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
|
|
12087
12251
|
Button,
|
|
12088
12252
|
{
|
|
12089
12253
|
variant: "outline",
|
|
@@ -12099,7 +12263,7 @@ function CarouselPrevious({ className, disabled, onClick, ...props }) {
|
|
|
12099
12263
|
onClick?.(e);
|
|
12100
12264
|
if (!e.defaultPrevented && !isDisabled) scrollPrev();
|
|
12101
12265
|
},
|
|
12102
|
-
children: /* @__PURE__ */ (0,
|
|
12266
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
|
|
12103
12267
|
WebIcon,
|
|
12104
12268
|
{
|
|
12105
12269
|
name: "chevron-left",
|
|
@@ -12115,7 +12279,7 @@ function CarouselPrevious({ className, disabled, onClick, ...props }) {
|
|
|
12115
12279
|
function CarouselNext({ className, disabled, onClick, ...props }) {
|
|
12116
12280
|
const { scrollNext, canScrollNext } = useCarouselContext("CarouselNext");
|
|
12117
12281
|
const isDisabled = disabled || !canScrollNext;
|
|
12118
|
-
return /* @__PURE__ */ (0,
|
|
12282
|
+
return /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
|
|
12119
12283
|
Button,
|
|
12120
12284
|
{
|
|
12121
12285
|
variant: "outline",
|
|
@@ -12131,7 +12295,7 @@ function CarouselNext({ className, disabled, onClick, ...props }) {
|
|
|
12131
12295
|
onClick?.(e);
|
|
12132
12296
|
if (!e.defaultPrevented && !isDisabled) scrollNext();
|
|
12133
12297
|
},
|
|
12134
|
-
children: /* @__PURE__ */ (0,
|
|
12298
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
|
|
12135
12299
|
WebIcon,
|
|
12136
12300
|
{
|
|
12137
12301
|
name: "chevron-right",
|
|
@@ -12146,9 +12310,9 @@ function CarouselNext({ className, disabled, onClick, ...props }) {
|
|
|
12146
12310
|
}
|
|
12147
12311
|
function CarouselIndicators({ className, ...props }) {
|
|
12148
12312
|
const { count, index, scrollTo } = useCarouselContext("CarouselIndicators");
|
|
12149
|
-
const trackRef = (0,
|
|
12150
|
-
const [thumb, setThumb] = (0,
|
|
12151
|
-
const updateThumb = (0,
|
|
12313
|
+
const trackRef = (0, import_react45.useRef)(null);
|
|
12314
|
+
const [thumb, setThumb] = (0, import_react45.useState)({ width: 0, x: 0, ready: false });
|
|
12315
|
+
const updateThumb = (0, import_react45.useCallback)(() => {
|
|
12152
12316
|
const el = trackRef.current;
|
|
12153
12317
|
if (!el || count <= 0) {
|
|
12154
12318
|
setThumb({ width: 0, x: 0, ready: false });
|
|
@@ -12163,10 +12327,10 @@ function CarouselIndicators({ className, ...props }) {
|
|
|
12163
12327
|
ready: true
|
|
12164
12328
|
});
|
|
12165
12329
|
}, [count, index]);
|
|
12166
|
-
(0,
|
|
12330
|
+
(0, import_react45.useLayoutEffect)(() => {
|
|
12167
12331
|
updateThumb();
|
|
12168
12332
|
}, [updateThumb]);
|
|
12169
|
-
(0,
|
|
12333
|
+
(0, import_react45.useEffect)(() => {
|
|
12170
12334
|
const el = trackRef.current;
|
|
12171
12335
|
if (!el) return;
|
|
12172
12336
|
const ro = new ResizeObserver(() => updateThumb());
|
|
@@ -12178,7 +12342,7 @@ function CarouselIndicators({ className, ...props }) {
|
|
|
12178
12342
|
width: thumb.width,
|
|
12179
12343
|
transform: `translate3d(${thumb.x}px, 0, 0)`
|
|
12180
12344
|
};
|
|
12181
|
-
return /* @__PURE__ */ (0,
|
|
12345
|
+
return /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)(
|
|
12182
12346
|
"div",
|
|
12183
12347
|
{
|
|
12184
12348
|
ref: trackRef,
|
|
@@ -12188,7 +12352,7 @@ function CarouselIndicators({ className, ...props }) {
|
|
|
12188
12352
|
className: (0, import_clsx89.clsx)(carouselStyles.indicators, className),
|
|
12189
12353
|
...props,
|
|
12190
12354
|
children: [
|
|
12191
|
-
/* @__PURE__ */ (0,
|
|
12355
|
+
/* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
|
|
12192
12356
|
"span",
|
|
12193
12357
|
{
|
|
12194
12358
|
"data-refineui": "carousel-indicator-thumb",
|
|
@@ -12198,7 +12362,7 @@ function CarouselIndicators({ className, ...props }) {
|
|
|
12198
12362
|
style: thumbStyle
|
|
12199
12363
|
}
|
|
12200
12364
|
),
|
|
12201
|
-
/* @__PURE__ */ (0,
|
|
12365
|
+
/* @__PURE__ */ (0, import_jsx_runtime67.jsx)("div", { "data-refineui": "carousel-indicator-hits", className: carouselStyles.indicatorHitRow, children: Array.from({ length: count }, (_, i) => /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
|
|
12202
12366
|
"button",
|
|
12203
12367
|
{
|
|
12204
12368
|
type: "button",
|
|
@@ -12219,7 +12383,7 @@ function CarouselIndicators({ className, ...props }) {
|
|
|
12219
12383
|
|
|
12220
12384
|
// src/components/Bubble/Bubble.tsx
|
|
12221
12385
|
var import_clsx91 = require("clsx");
|
|
12222
|
-
var
|
|
12386
|
+
var import_react46 = require("react");
|
|
12223
12387
|
|
|
12224
12388
|
// src/components/Bubble/style.ts
|
|
12225
12389
|
var import_clsx90 = require("clsx");
|
|
@@ -12284,21 +12448,21 @@ var bubbleContentVariantClass = {
|
|
|
12284
12448
|
};
|
|
12285
12449
|
|
|
12286
12450
|
// src/components/Bubble/Bubble.tsx
|
|
12287
|
-
var
|
|
12288
|
-
var BubbleContext = (0,
|
|
12451
|
+
var import_jsx_runtime68 = require("react/jsx-runtime");
|
|
12452
|
+
var BubbleContext = (0, import_react46.createContext)(null);
|
|
12289
12453
|
function useBubbleContext(component) {
|
|
12290
|
-
const value = (0,
|
|
12454
|
+
const value = (0, import_react46.useContext)(BubbleContext);
|
|
12291
12455
|
if (!value) throw new Error(`${component} must be used within Bubble.`);
|
|
12292
12456
|
return value;
|
|
12293
12457
|
}
|
|
12294
12458
|
function isBubbleReactionsElement(node) {
|
|
12295
|
-
return (0,
|
|
12459
|
+
return (0, import_react46.isValidElement)(node) && node.type === BubbleReactions;
|
|
12296
12460
|
}
|
|
12297
12461
|
function partitionBubbleChildren(children) {
|
|
12298
12462
|
const top = [];
|
|
12299
12463
|
const middle = [];
|
|
12300
12464
|
const bottom = [];
|
|
12301
|
-
|
|
12465
|
+
import_react46.Children.forEach(children, (child) => {
|
|
12302
12466
|
if (!isBubbleReactionsElement(child)) {
|
|
12303
12467
|
middle.push(child);
|
|
12304
12468
|
return;
|
|
@@ -12316,7 +12480,7 @@ function partitionBubbleChildren(children) {
|
|
|
12316
12480
|
};
|
|
12317
12481
|
}
|
|
12318
12482
|
function BubbleGroup({ className, ...props }) {
|
|
12319
|
-
return /* @__PURE__ */ (0,
|
|
12483
|
+
return /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(
|
|
12320
12484
|
"div",
|
|
12321
12485
|
{
|
|
12322
12486
|
"data-refineui": "bubble-group",
|
|
@@ -12335,7 +12499,7 @@ function Bubble({
|
|
|
12335
12499
|
}) {
|
|
12336
12500
|
const rootStyle = variant === "ghost" ? style : { maxWidth: BUBBLE_MAX_WIDTH, ...style };
|
|
12337
12501
|
const { top, middle, bottom, hasTop, hasBottom } = partitionBubbleChildren(children);
|
|
12338
|
-
return /* @__PURE__ */ (0,
|
|
12502
|
+
return /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(BubbleContext.Provider, { value: { variant, align }, children: /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(
|
|
12339
12503
|
"div",
|
|
12340
12504
|
{
|
|
12341
12505
|
"data-refineui": "bubble",
|
|
@@ -12350,7 +12514,7 @@ function Bubble({
|
|
|
12350
12514
|
),
|
|
12351
12515
|
style: rootStyle,
|
|
12352
12516
|
...props,
|
|
12353
|
-
children: /* @__PURE__ */ (0,
|
|
12517
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime68.jsxs)("div", { "data-refineui": "bubble-surface", className: bubbleStyles.surface, children: [
|
|
12354
12518
|
middle,
|
|
12355
12519
|
top,
|
|
12356
12520
|
bottom
|
|
@@ -12360,7 +12524,7 @@ function Bubble({
|
|
|
12360
12524
|
}
|
|
12361
12525
|
function BubbleContent({ className, ...props }) {
|
|
12362
12526
|
const { variant } = useBubbleContext("BubbleContent");
|
|
12363
|
-
return /* @__PURE__ */ (0,
|
|
12527
|
+
return /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(
|
|
12364
12528
|
"div",
|
|
12365
12529
|
{
|
|
12366
12530
|
"data-refineui": "bubble-content",
|
|
@@ -12381,7 +12545,7 @@ function BubbleReactions({
|
|
|
12381
12545
|
}) {
|
|
12382
12546
|
const { align: bubbleAlign } = useBubbleContext("BubbleReactions");
|
|
12383
12547
|
const align = alignProp ?? (bubbleAlign === "start" ? "end" : "start");
|
|
12384
|
-
return /* @__PURE__ */ (0,
|
|
12548
|
+
return /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(
|
|
12385
12549
|
"div",
|
|
12386
12550
|
{
|
|
12387
12551
|
"data-refineui": "bubble-reactions",
|
|
@@ -12401,7 +12565,7 @@ function BubbleReactions({
|
|
|
12401
12565
|
// src/components/Stepper/Stepper.tsx
|
|
12402
12566
|
var import_clsx93 = require("clsx");
|
|
12403
12567
|
var import_tokens28 = require("@refineui/tokens");
|
|
12404
|
-
var
|
|
12568
|
+
var import_react47 = require("react");
|
|
12405
12569
|
|
|
12406
12570
|
// src/components/Stepper/style.ts
|
|
12407
12571
|
var import_clsx92 = require("clsx");
|
|
@@ -12509,17 +12673,17 @@ var stepperConnectorVars = {
|
|
|
12509
12673
|
};
|
|
12510
12674
|
|
|
12511
12675
|
// src/components/Stepper/Stepper.tsx
|
|
12512
|
-
var
|
|
12513
|
-
var StepperContext = (0,
|
|
12514
|
-
var StepperItemContext = (0,
|
|
12515
|
-
var StepperListRegistryContext = (0,
|
|
12676
|
+
var import_jsx_runtime69 = require("react/jsx-runtime");
|
|
12677
|
+
var StepperContext = (0, import_react47.createContext)(null);
|
|
12678
|
+
var StepperItemContext = (0, import_react47.createContext)(null);
|
|
12679
|
+
var StepperListRegistryContext = (0, import_react47.createContext)(null);
|
|
12516
12680
|
function useStepperContext(component) {
|
|
12517
|
-
const v = (0,
|
|
12681
|
+
const v = (0, import_react47.useContext)(StepperContext);
|
|
12518
12682
|
if (!v) throw new Error(`${component} must be used within Stepper.`);
|
|
12519
12683
|
return v;
|
|
12520
12684
|
}
|
|
12521
12685
|
function useStepperItemContext(component) {
|
|
12522
|
-
const v = (0,
|
|
12686
|
+
const v = (0, import_react47.useContext)(StepperItemContext);
|
|
12523
12687
|
if (!v) throw new Error(`${component} must be used within StepperItem.`);
|
|
12524
12688
|
return v;
|
|
12525
12689
|
}
|
|
@@ -12539,16 +12703,16 @@ function Stepper({
|
|
|
12539
12703
|
...props
|
|
12540
12704
|
}) {
|
|
12541
12705
|
const isControlled = valueControlled !== void 0;
|
|
12542
|
-
const [internalValue, setInternalValue] = (0,
|
|
12706
|
+
const [internalValue, setInternalValue] = (0, import_react47.useState)(defaultValue);
|
|
12543
12707
|
const value = isControlled ? valueControlled : internalValue;
|
|
12544
|
-
const setValue = (0,
|
|
12708
|
+
const setValue = (0, import_react47.useCallback)(
|
|
12545
12709
|
(next) => {
|
|
12546
12710
|
if (!isControlled) setInternalValue(next);
|
|
12547
12711
|
onValueChange?.(next);
|
|
12548
12712
|
},
|
|
12549
12713
|
[isControlled, onValueChange]
|
|
12550
12714
|
);
|
|
12551
|
-
const ctx = (0,
|
|
12715
|
+
const ctx = (0, import_react47.useMemo)(
|
|
12552
12716
|
() => ({
|
|
12553
12717
|
value,
|
|
12554
12718
|
setValue,
|
|
@@ -12557,7 +12721,7 @@ function Stepper({
|
|
|
12557
12721
|
}),
|
|
12558
12722
|
[value, setValue, orientation, onValueChange, isControlled]
|
|
12559
12723
|
);
|
|
12560
|
-
return /* @__PURE__ */ (0,
|
|
12724
|
+
return /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(StepperContext.Provider, { value: ctx, children: /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(
|
|
12561
12725
|
"div",
|
|
12562
12726
|
{
|
|
12563
12727
|
"data-refineui": "stepper",
|
|
@@ -12571,9 +12735,9 @@ function Stepper({
|
|
|
12571
12735
|
}
|
|
12572
12736
|
function StepperList({ className, children, ...props }) {
|
|
12573
12737
|
const { orientation, value } = useStepperContext("StepperList");
|
|
12574
|
-
const cursorRef = (0,
|
|
12738
|
+
const cursorRef = (0, import_react47.useRef)(null);
|
|
12575
12739
|
cursorRef.current = null;
|
|
12576
|
-
const registry = (0,
|
|
12740
|
+
const registry = (0, import_react47.useMemo)(
|
|
12577
12741
|
() => ({
|
|
12578
12742
|
noteItem(itemValue) {
|
|
12579
12743
|
cursorRef.current = itemValue;
|
|
@@ -12585,7 +12749,7 @@ function StepperList({ className, children, ...props }) {
|
|
|
12585
12749
|
}),
|
|
12586
12750
|
[value]
|
|
12587
12751
|
);
|
|
12588
|
-
return /* @__PURE__ */ (0,
|
|
12752
|
+
return /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(StepperListRegistryContext.Provider, { value: registry, children: /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(
|
|
12589
12753
|
"ol",
|
|
12590
12754
|
{
|
|
12591
12755
|
"data-refineui": "stepper-list",
|
|
@@ -12610,7 +12774,7 @@ function StepperItem({
|
|
|
12610
12774
|
...props
|
|
12611
12775
|
}) {
|
|
12612
12776
|
const { value, setValue, orientation, interactive } = useStepperContext("StepperItem");
|
|
12613
|
-
const registry = (0,
|
|
12777
|
+
const registry = (0, import_react47.useContext)(StepperListRegistryContext);
|
|
12614
12778
|
registry?.noteItem(itemValue);
|
|
12615
12779
|
const state = resolveState2(itemValue, value);
|
|
12616
12780
|
const canActivate = interactive && !disabled;
|
|
@@ -12626,11 +12790,11 @@ function StepperItem({
|
|
|
12626
12790
|
activate();
|
|
12627
12791
|
}
|
|
12628
12792
|
};
|
|
12629
|
-
const itemCtx = (0,
|
|
12793
|
+
const itemCtx = (0, import_react47.useMemo)(
|
|
12630
12794
|
() => ({ state, disabled }),
|
|
12631
12795
|
[state, disabled]
|
|
12632
12796
|
);
|
|
12633
|
-
return /* @__PURE__ */ (0,
|
|
12797
|
+
return /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(StepperItemContext.Provider, { value: itemCtx, children: /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(
|
|
12634
12798
|
"li",
|
|
12635
12799
|
{
|
|
12636
12800
|
"data-refineui": "stepper-item",
|
|
@@ -12658,7 +12822,7 @@ function StepperItem({
|
|
|
12658
12822
|
function StepperIndicator({ className, children, ...props }) {
|
|
12659
12823
|
const { state } = useStepperItemContext("StepperIndicator");
|
|
12660
12824
|
const stateClass = state === "complete" ? stepperStyles.indicatorComplete : state === "current" ? stepperStyles.indicatorCurrent : stepperStyles.indicatorUpcoming;
|
|
12661
|
-
const content = state === "upcoming" ? children : /* @__PURE__ */ (0,
|
|
12825
|
+
const content = state === "upcoming" ? children : /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(
|
|
12662
12826
|
WebIcon,
|
|
12663
12827
|
{
|
|
12664
12828
|
name: "checkmark",
|
|
@@ -12669,7 +12833,7 @@ function StepperIndicator({ className, children, ...props }) {
|
|
|
12669
12833
|
className: "items-center justify-center"
|
|
12670
12834
|
}
|
|
12671
12835
|
);
|
|
12672
|
-
return /* @__PURE__ */ (0,
|
|
12836
|
+
return /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(
|
|
12673
12837
|
"span",
|
|
12674
12838
|
{
|
|
12675
12839
|
"data-refineui": "stepper-indicator",
|
|
@@ -12684,7 +12848,7 @@ function StepperIndicator({ className, children, ...props }) {
|
|
|
12684
12848
|
function StepperContent({ className, ...props }) {
|
|
12685
12849
|
const { orientation } = useStepperContext("StepperContent");
|
|
12686
12850
|
useStepperItemContext("StepperContent");
|
|
12687
|
-
return /* @__PURE__ */ (0,
|
|
12851
|
+
return /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(
|
|
12688
12852
|
"div",
|
|
12689
12853
|
{
|
|
12690
12854
|
"data-refineui": "stepper-content",
|
|
@@ -12700,7 +12864,7 @@ function StepperContent({ className, ...props }) {
|
|
|
12700
12864
|
function StepperTitle({ className, ...props }) {
|
|
12701
12865
|
const { state } = useStepperItemContext("StepperTitle");
|
|
12702
12866
|
const stateClass = state === "complete" ? stepperStyles.titleComplete : state === "current" ? stepperStyles.titleCurrent : stepperStyles.titleUpcoming;
|
|
12703
|
-
return /* @__PURE__ */ (0,
|
|
12867
|
+
return /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(
|
|
12704
12868
|
"span",
|
|
12705
12869
|
{
|
|
12706
12870
|
"data-refineui": "stepper-title",
|
|
@@ -12713,7 +12877,7 @@ function StepperTitle({ className, ...props }) {
|
|
|
12713
12877
|
function StepperDescription({ className, ...props }) {
|
|
12714
12878
|
const { state } = useStepperItemContext("StepperDescription");
|
|
12715
12879
|
const stateClass = state === "complete" ? stepperStyles.descriptionComplete : state === "current" ? stepperStyles.descriptionCurrent : stepperStyles.descriptionUpcoming;
|
|
12716
|
-
return /* @__PURE__ */ (0,
|
|
12880
|
+
return /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(
|
|
12717
12881
|
"span",
|
|
12718
12882
|
{
|
|
12719
12883
|
"data-refineui": "stepper-description",
|
|
@@ -12725,10 +12889,10 @@ function StepperDescription({ className, ...props }) {
|
|
|
12725
12889
|
}
|
|
12726
12890
|
function StepperSeparator({ className, ...props }) {
|
|
12727
12891
|
const { orientation } = useStepperContext("StepperSeparator");
|
|
12728
|
-
const registry = (0,
|
|
12892
|
+
const registry = (0, import_react47.useContext)(StepperListRegistryContext);
|
|
12729
12893
|
const state = registry?.takeSeparatorState() ?? "upcoming";
|
|
12730
12894
|
const vertical = orientation === "vertical";
|
|
12731
|
-
return /* @__PURE__ */ (0,
|
|
12895
|
+
return /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(
|
|
12732
12896
|
"li",
|
|
12733
12897
|
{
|
|
12734
12898
|
"data-refineui": "stepper-separator",
|
|
@@ -12742,7 +12906,7 @@ function StepperSeparator({ className, ...props }) {
|
|
|
12742
12906
|
className
|
|
12743
12907
|
),
|
|
12744
12908
|
...props,
|
|
12745
|
-
children: /* @__PURE__ */ (0,
|
|
12909
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime69.jsxs)(
|
|
12746
12910
|
"span",
|
|
12747
12911
|
{
|
|
12748
12912
|
"data-refineui": "stepper-separator-rail",
|
|
@@ -12751,14 +12915,14 @@ function StepperSeparator({ className, ...props }) {
|
|
|
12751
12915
|
vertical ? stepperStyles.separatorRailVertical : stepperStyles.separatorRailHorizontal
|
|
12752
12916
|
),
|
|
12753
12917
|
children: [
|
|
12754
|
-
/* @__PURE__ */ (0,
|
|
12918
|
+
/* @__PURE__ */ (0, import_jsx_runtime69.jsx)(
|
|
12755
12919
|
"span",
|
|
12756
12920
|
{
|
|
12757
12921
|
"data-refineui": "stepper-separator-track",
|
|
12758
12922
|
className: stepperStyles.separatorTrack
|
|
12759
12923
|
}
|
|
12760
12924
|
),
|
|
12761
|
-
/* @__PURE__ */ (0,
|
|
12925
|
+
/* @__PURE__ */ (0, import_jsx_runtime69.jsx)(
|
|
12762
12926
|
"span",
|
|
12763
12927
|
{
|
|
12764
12928
|
"data-refineui": "stepper-separator-fill",
|
|
@@ -12786,7 +12950,7 @@ StepperSeparator.displayName = "StepperSeparator";
|
|
|
12786
12950
|
|
|
12787
12951
|
// src/components/Resizable/Resizable.tsx
|
|
12788
12952
|
var import_clsx95 = require("clsx");
|
|
12789
|
-
var
|
|
12953
|
+
var import_react48 = require("react");
|
|
12790
12954
|
|
|
12791
12955
|
// src/components/Resizable/style.ts
|
|
12792
12956
|
var import_clsx94 = require("clsx");
|
|
@@ -12821,15 +12985,15 @@ var resizableStyles = {
|
|
|
12821
12985
|
};
|
|
12822
12986
|
|
|
12823
12987
|
// src/components/Resizable/Resizable.tsx
|
|
12824
|
-
var
|
|
12988
|
+
var import_jsx_runtime70 = require("react/jsx-runtime");
|
|
12825
12989
|
var KEYBOARD_STEP = 2;
|
|
12826
12990
|
var KEYBOARD_STEP_LARGE = 10;
|
|
12827
12991
|
var DEFAULT_SIZE = 50;
|
|
12828
12992
|
var DEFAULT_MIN_SIZE = 10;
|
|
12829
12993
|
var DEFAULT_MAX_SIZE = 100;
|
|
12830
|
-
var ResizableContext = (0,
|
|
12994
|
+
var ResizableContext = (0, import_react48.createContext)(null);
|
|
12831
12995
|
function useResizableContext(component) {
|
|
12832
|
-
const v = (0,
|
|
12996
|
+
const v = (0, import_react48.useContext)(ResizableContext);
|
|
12833
12997
|
if (!v) throw new Error(`${component} must be used within ResizablePanelGroup.`);
|
|
12834
12998
|
return v;
|
|
12835
12999
|
}
|
|
@@ -12888,13 +13052,13 @@ function ResizablePanelGroup({
|
|
|
12888
13052
|
onLayout,
|
|
12889
13053
|
...props
|
|
12890
13054
|
}) {
|
|
12891
|
-
const groupRef = (0,
|
|
12892
|
-
const panelsRef = (0,
|
|
12893
|
-
const orderCounterRef = (0,
|
|
12894
|
-
const [sizes, setSizes] = (0,
|
|
12895
|
-
const onLayoutRef = (0,
|
|
13055
|
+
const groupRef = (0, import_react48.useRef)(null);
|
|
13056
|
+
const panelsRef = (0, import_react48.useRef)(/* @__PURE__ */ new Map());
|
|
13057
|
+
const orderCounterRef = (0, import_react48.useRef)(0);
|
|
13058
|
+
const [sizes, setSizes] = (0, import_react48.useState)({});
|
|
13059
|
+
const onLayoutRef = (0, import_react48.useRef)(onLayout);
|
|
12896
13060
|
onLayoutRef.current = onLayout;
|
|
12897
|
-
const syncInitialSizes = (0,
|
|
13061
|
+
const syncInitialSizes = (0, import_react48.useCallback)(() => {
|
|
12898
13062
|
const panels = [...panelsRef.current.values()].sort((a, b) => a.order - b.order);
|
|
12899
13063
|
if (panels.length === 0) return;
|
|
12900
13064
|
setSizes((prev) => {
|
|
@@ -12929,7 +13093,7 @@ function ResizablePanelGroup({
|
|
|
12929
13093
|
return base;
|
|
12930
13094
|
});
|
|
12931
13095
|
}, []);
|
|
12932
|
-
const registerPanel = (0,
|
|
13096
|
+
const registerPanel = (0, import_react48.useCallback)(
|
|
12933
13097
|
(panel) => {
|
|
12934
13098
|
const existing = panelsRef.current.get(panel.id);
|
|
12935
13099
|
const order = existing?.order ?? orderCounterRef.current++;
|
|
@@ -12938,7 +13102,7 @@ function ResizablePanelGroup({
|
|
|
12938
13102
|
},
|
|
12939
13103
|
[syncInitialSizes]
|
|
12940
13104
|
);
|
|
12941
|
-
const unregisterPanel = (0,
|
|
13105
|
+
const unregisterPanel = (0, import_react48.useCallback)((id) => {
|
|
12942
13106
|
panelsRef.current.delete(id);
|
|
12943
13107
|
setSizes((prev) => {
|
|
12944
13108
|
if (!(id in prev)) return prev;
|
|
@@ -12947,13 +13111,13 @@ function ResizablePanelGroup({
|
|
|
12947
13111
|
return next;
|
|
12948
13112
|
});
|
|
12949
13113
|
}, []);
|
|
12950
|
-
const getPanel = (0,
|
|
12951
|
-
const emitPanelResize = (0,
|
|
13114
|
+
const getPanel = (0, import_react48.useCallback)((id) => panelsRef.current.get(id), []);
|
|
13115
|
+
const emitPanelResize = (0, import_react48.useCallback)((next) => {
|
|
12952
13116
|
for (const [id, size] of Object.entries(next)) {
|
|
12953
13117
|
panelsRef.current.get(id)?.onResize?.(size);
|
|
12954
13118
|
}
|
|
12955
13119
|
}, []);
|
|
12956
|
-
const resizeBetween = (0,
|
|
13120
|
+
const resizeBetween = (0, import_react48.useCallback)(
|
|
12957
13121
|
(leftId, rightId, deltaPct) => {
|
|
12958
13122
|
setSizes((prev) => {
|
|
12959
13123
|
const next = applyResize(
|
|
@@ -12970,7 +13134,7 @@ function ResizablePanelGroup({
|
|
|
12970
13134
|
},
|
|
12971
13135
|
[emitPanelResize]
|
|
12972
13136
|
);
|
|
12973
|
-
const setBetween = (0,
|
|
13137
|
+
const setBetween = (0, import_react48.useCallback)(
|
|
12974
13138
|
(leftId, rightId, leftSize) => {
|
|
12975
13139
|
setSizes((prev) => {
|
|
12976
13140
|
const left = panelsRef.current.get(leftId);
|
|
@@ -12995,13 +13159,13 @@ function ResizablePanelGroup({
|
|
|
12995
13159
|
},
|
|
12996
13160
|
[emitPanelResize]
|
|
12997
13161
|
);
|
|
12998
|
-
(0,
|
|
13162
|
+
(0, import_react48.useLayoutEffect)(() => {
|
|
12999
13163
|
const ids = orderedPanelIds(panelsRef.current);
|
|
13000
13164
|
if (ids.length === 0) return;
|
|
13001
13165
|
if (ids.some((id) => sizes[id] === void 0)) return;
|
|
13002
13166
|
onLayoutRef.current?.(ids.map((id) => sizes[id]));
|
|
13003
13167
|
}, [sizes]);
|
|
13004
|
-
const ctx = (0,
|
|
13168
|
+
const ctx = (0, import_react48.useMemo)(
|
|
13005
13169
|
() => ({
|
|
13006
13170
|
orientation,
|
|
13007
13171
|
groupRef,
|
|
@@ -13022,7 +13186,7 @@ function ResizablePanelGroup({
|
|
|
13022
13186
|
setBetween
|
|
13023
13187
|
]
|
|
13024
13188
|
);
|
|
13025
|
-
return /* @__PURE__ */ (0,
|
|
13189
|
+
return /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(ResizableContext.Provider, { value: ctx, children: /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
|
|
13026
13190
|
"div",
|
|
13027
13191
|
{
|
|
13028
13192
|
ref: groupRef,
|
|
@@ -13050,11 +13214,11 @@ function ResizablePanel({
|
|
|
13050
13214
|
onResize,
|
|
13051
13215
|
...props
|
|
13052
13216
|
}) {
|
|
13053
|
-
const id = (0,
|
|
13217
|
+
const id = (0, import_react48.useId)();
|
|
13054
13218
|
const { orientation, sizes, registerPanel, unregisterPanel } = useResizableContext("ResizablePanel");
|
|
13055
|
-
const onResizeRef = (0,
|
|
13219
|
+
const onResizeRef = (0, import_react48.useRef)(onResize);
|
|
13056
13220
|
onResizeRef.current = onResize;
|
|
13057
|
-
(0,
|
|
13221
|
+
(0, import_react48.useLayoutEffect)(() => {
|
|
13058
13222
|
registerPanel({
|
|
13059
13223
|
id,
|
|
13060
13224
|
defaultSize,
|
|
@@ -13081,7 +13245,7 @@ function ResizablePanel({
|
|
|
13081
13245
|
flexBasis: 0,
|
|
13082
13246
|
...orientation === "horizontal" ? { minWidth: `${minSize}%` } : { minHeight: `${minSize}%` }
|
|
13083
13247
|
};
|
|
13084
|
-
return /* @__PURE__ */ (0,
|
|
13248
|
+
return /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
|
|
13085
13249
|
"div",
|
|
13086
13250
|
{
|
|
13087
13251
|
"data-refineui": "resizable-panel",
|
|
@@ -13112,11 +13276,11 @@ function ResizableHandle({
|
|
|
13112
13276
|
resizeBetween,
|
|
13113
13277
|
setBetween
|
|
13114
13278
|
} = useResizableContext("ResizableHandle");
|
|
13115
|
-
const handleRef = (0,
|
|
13116
|
-
const [active, setActive] = (0,
|
|
13117
|
-
const [, setAdjacentReady] = (0,
|
|
13118
|
-
const dragRef = (0,
|
|
13119
|
-
(0,
|
|
13279
|
+
const handleRef = (0, import_react48.useRef)(null);
|
|
13280
|
+
const [active, setActive] = (0, import_react48.useState)(false);
|
|
13281
|
+
const [, setAdjacentReady] = (0, import_react48.useState)(false);
|
|
13282
|
+
const dragRef = (0, import_react48.useRef)(null);
|
|
13283
|
+
(0, import_react48.useLayoutEffect)(() => {
|
|
13120
13284
|
setAdjacentReady(true);
|
|
13121
13285
|
}, []);
|
|
13122
13286
|
const adjacent = handleRef.current ? findAdjacentPanelIds(handleRef.current) : { leftId: null, rightId: null };
|
|
@@ -13127,7 +13291,7 @@ function ResizableHandle({
|
|
|
13127
13291
|
const ariaMin = leftPanel?.minSize ?? 0;
|
|
13128
13292
|
const ariaMax = leftPanel?.maxSize ?? DEFAULT_MAX_SIZE;
|
|
13129
13293
|
const defaultKeyshortcuts = orientation === "horizontal" ? "ArrowLeft ArrowRight Home End" : "ArrowUp ArrowDown Home End";
|
|
13130
|
-
const keepFocus = (0,
|
|
13294
|
+
const keepFocus = (0, import_react48.useCallback)(() => {
|
|
13131
13295
|
const el = handleRef.current;
|
|
13132
13296
|
if (el && document.activeElement !== el) {
|
|
13133
13297
|
el.focus({ preventScroll: true });
|
|
@@ -13226,7 +13390,7 @@ function ResizableHandle({
|
|
|
13226
13390
|
resizeBetween(leftId, rightId, delta);
|
|
13227
13391
|
queueMicrotask(keepFocus);
|
|
13228
13392
|
};
|
|
13229
|
-
return /* @__PURE__ */ (0,
|
|
13393
|
+
return /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
|
|
13230
13394
|
"div",
|
|
13231
13395
|
{
|
|
13232
13396
|
ref: handleRef,
|
|
@@ -13256,7 +13420,7 @@ function ResizableHandle({
|
|
|
13256
13420
|
onPointerUp: handlePointerUp,
|
|
13257
13421
|
onPointerCancel: handlePointerUp,
|
|
13258
13422
|
onKeyDown: handleKeyDown,
|
|
13259
|
-
children: withHandle ? /* @__PURE__ */ (0,
|
|
13423
|
+
children: withHandle ? /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
|
|
13260
13424
|
"span",
|
|
13261
13425
|
{
|
|
13262
13426
|
"aria-hidden": true,
|
|
@@ -13272,7 +13436,7 @@ function ResizableHandle({
|
|
|
13272
13436
|
|
|
13273
13437
|
// src/components/SpinButton/SpinButton.tsx
|
|
13274
13438
|
var import_clsx96 = require("clsx");
|
|
13275
|
-
var
|
|
13439
|
+
var import_react49 = require("react");
|
|
13276
13440
|
var import_tokens29 = require("@refineui/tokens");
|
|
13277
13441
|
|
|
13278
13442
|
// src/components/SpinButton/style.ts
|
|
@@ -13296,7 +13460,7 @@ var spinButtonShellClass = formControlShellHeightClass;
|
|
|
13296
13460
|
var spinButtonValueTypo = formControlTypoClass;
|
|
13297
13461
|
|
|
13298
13462
|
// src/components/SpinButton/SpinButton.tsx
|
|
13299
|
-
var
|
|
13463
|
+
var import_jsx_runtime71 = require("react/jsx-runtime");
|
|
13300
13464
|
function SpinButton({
|
|
13301
13465
|
value,
|
|
13302
13466
|
onChange,
|
|
@@ -13310,8 +13474,8 @@ function SpinButton({
|
|
|
13310
13474
|
onKeyDown,
|
|
13311
13475
|
...props
|
|
13312
13476
|
}) {
|
|
13313
|
-
const [draftValue, setDraftValue] = (0,
|
|
13314
|
-
(0,
|
|
13477
|
+
const [draftValue, setDraftValue] = (0, import_react49.useState)(String(value));
|
|
13478
|
+
(0, import_react49.useEffect)(() => {
|
|
13315
13479
|
setDraftValue(String(value));
|
|
13316
13480
|
}, [value]);
|
|
13317
13481
|
const clampValue2 = (next) => {
|
|
@@ -13399,7 +13563,7 @@ function SpinButton({
|
|
|
13399
13563
|
const atMax = max !== void 0 && value >= max;
|
|
13400
13564
|
const atMin = min !== void 0 && value <= min;
|
|
13401
13565
|
const borderClass = disabled ? spinButtonStyles.borderDisabled : spinButtonStyles.borderDefault;
|
|
13402
|
-
return /* @__PURE__ */ (0,
|
|
13566
|
+
return /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)(
|
|
13403
13567
|
"div",
|
|
13404
13568
|
{
|
|
13405
13569
|
role: "spinbutton",
|
|
@@ -13422,7 +13586,7 @@ function SpinButton({
|
|
|
13422
13586
|
...props,
|
|
13423
13587
|
onKeyDown: handleKeyDown,
|
|
13424
13588
|
children: [
|
|
13425
|
-
/* @__PURE__ */ (0,
|
|
13589
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
|
|
13426
13590
|
"div",
|
|
13427
13591
|
{
|
|
13428
13592
|
"aria-live": "polite",
|
|
@@ -13433,7 +13597,7 @@ function SpinButton({
|
|
|
13433
13597
|
disabled ? spinButtonStyles.valueTextDisabled : spinButtonStyles.valueTextDefault,
|
|
13434
13598
|
disabled ? spinButtonStyles.bgDisabled : spinButtonStyles.bgDefault
|
|
13435
13599
|
),
|
|
13436
|
-
children: /* @__PURE__ */ (0,
|
|
13600
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
|
|
13437
13601
|
"input",
|
|
13438
13602
|
{
|
|
13439
13603
|
type: "text",
|
|
@@ -13458,7 +13622,7 @@ function SpinButton({
|
|
|
13458
13622
|
)
|
|
13459
13623
|
}
|
|
13460
13624
|
),
|
|
13461
|
-
/* @__PURE__ */ (0,
|
|
13625
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsxs)(
|
|
13462
13626
|
"div",
|
|
13463
13627
|
{
|
|
13464
13628
|
className: (0, import_clsx96.clsx)(
|
|
@@ -13466,7 +13630,7 @@ function SpinButton({
|
|
|
13466
13630
|
disabled ? spinButtonStyles.bgDisabled : spinButtonStyles.bgDefault
|
|
13467
13631
|
),
|
|
13468
13632
|
children: [
|
|
13469
|
-
/* @__PURE__ */ (0,
|
|
13633
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
|
|
13470
13634
|
"button",
|
|
13471
13635
|
{
|
|
13472
13636
|
type: "button",
|
|
@@ -13478,7 +13642,7 @@ function SpinButton({
|
|
|
13478
13642
|
spinButtonStyles.stepButtonBase,
|
|
13479
13643
|
disabled || atMax ? spinButtonStyles.stepButtonDisabled : spinButtonStyles.stepButtonEnabled
|
|
13480
13644
|
),
|
|
13481
|
-
children: /* @__PURE__ */ (0,
|
|
13645
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
|
|
13482
13646
|
WebIcon,
|
|
13483
13647
|
{
|
|
13484
13648
|
name: "chevron-up",
|
|
@@ -13490,7 +13654,7 @@ function SpinButton({
|
|
|
13490
13654
|
)
|
|
13491
13655
|
}
|
|
13492
13656
|
),
|
|
13493
|
-
/* @__PURE__ */ (0,
|
|
13657
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
|
|
13494
13658
|
"button",
|
|
13495
13659
|
{
|
|
13496
13660
|
type: "button",
|
|
@@ -13502,7 +13666,7 @@ function SpinButton({
|
|
|
13502
13666
|
spinButtonStyles.stepButtonBase,
|
|
13503
13667
|
disabled || atMin ? spinButtonStyles.stepButtonDisabled : spinButtonStyles.stepButtonEnabled
|
|
13504
13668
|
),
|
|
13505
|
-
children: /* @__PURE__ */ (0,
|
|
13669
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
|
|
13506
13670
|
WebIcon,
|
|
13507
13671
|
{
|
|
13508
13672
|
name: "chevron-down",
|
|
@@ -13524,8 +13688,8 @@ function SpinButton({
|
|
|
13524
13688
|
|
|
13525
13689
|
// src/components/Toast/Toast.tsx
|
|
13526
13690
|
var import_clsx98 = require("clsx");
|
|
13527
|
-
var
|
|
13528
|
-
var
|
|
13691
|
+
var import_react50 = require("react");
|
|
13692
|
+
var import_react_dom7 = require("react-dom");
|
|
13529
13693
|
var import_tokens30 = require("@refineui/tokens");
|
|
13530
13694
|
var import_animation7 = require("@refineui/utilities/animation");
|
|
13531
13695
|
var import_color12 = require("@refineui/utilities/color");
|
|
@@ -13561,8 +13725,8 @@ var toastStyles = {
|
|
|
13561
13725
|
};
|
|
13562
13726
|
|
|
13563
13727
|
// src/components/Toast/Toast.tsx
|
|
13564
|
-
var
|
|
13565
|
-
var useIsomorphicLayoutEffect6 = typeof document !== "undefined" ?
|
|
13728
|
+
var import_jsx_runtime72 = require("react/jsx-runtime");
|
|
13729
|
+
var useIsomorphicLayoutEffect6 = typeof document !== "undefined" ? import_react50.useLayoutEffect : import_react50.useEffect;
|
|
13566
13730
|
var ENTER_MS = 20;
|
|
13567
13731
|
var LEAVE_MS = (0, import_animation7.motionMsToNumber)(componentTokens.toast.motion.leave) + 60;
|
|
13568
13732
|
var DEFAULT_DURATION = 4200;
|
|
@@ -13598,7 +13762,7 @@ function subscribeToastStackGap(onChange) {
|
|
|
13598
13762
|
return () => mq.removeEventListener("change", onChange);
|
|
13599
13763
|
}
|
|
13600
13764
|
function useToastStackGapPx() {
|
|
13601
|
-
return (0,
|
|
13765
|
+
return (0, import_react50.useSyncExternalStore)(
|
|
13602
13766
|
subscribeToastStackGap,
|
|
13603
13767
|
readToastStackGapPx,
|
|
13604
13768
|
() => gapPxFromSpacingToken(String(import_tokens30.spacings.sizeLarge))
|
|
@@ -13740,7 +13904,7 @@ var variantIconNames = {
|
|
|
13740
13904
|
error: "error-circle",
|
|
13741
13905
|
warning: "warning"
|
|
13742
13906
|
};
|
|
13743
|
-
var Toast = (0,
|
|
13907
|
+
var Toast = (0, import_react50.forwardRef)(function Toast2(props, ref) {
|
|
13744
13908
|
const { variant = "default", message, iconName, icon, action, className, stackState, style, ...rest } = props;
|
|
13745
13909
|
const domProps = { ...rest };
|
|
13746
13910
|
delete domProps.iconName;
|
|
@@ -13749,7 +13913,7 @@ var Toast = (0, import_react48.forwardRef)(function Toast2(props, ref) {
|
|
|
13749
13913
|
const liveRole = variant === "error" ? "alert" : "status";
|
|
13750
13914
|
const ariaLive = variant === "error" ? void 0 : variant === "warning" ? "assertive" : "polite";
|
|
13751
13915
|
const resolvedIconName = iconName ?? variantIconNames[variant];
|
|
13752
|
-
const iconContent = icon ?? /* @__PURE__ */ (0,
|
|
13916
|
+
const iconContent = icon ?? /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
|
|
13753
13917
|
WebIcon,
|
|
13754
13918
|
{
|
|
13755
13919
|
name: resolvedIconName,
|
|
@@ -13759,7 +13923,7 @@ var Toast = (0, import_react48.forwardRef)(function Toast2(props, ref) {
|
|
|
13759
13923
|
}
|
|
13760
13924
|
);
|
|
13761
13925
|
const isPrimaryAction = !action || typeof action !== "object" || !("variant" in action) || action.variant === "primary";
|
|
13762
|
-
const actionEl = typeof action === "object" && action !== null && "label" in action ? /* @__PURE__ */ (0,
|
|
13926
|
+
const actionEl = typeof action === "object" && action !== null && "label" in action ? /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
|
|
13763
13927
|
Button,
|
|
13764
13928
|
{
|
|
13765
13929
|
variant: isPrimaryAction ? "primary" : "outline",
|
|
@@ -13775,7 +13939,7 @@ var Toast = (0, import_react48.forwardRef)(function Toast2(props, ref) {
|
|
|
13775
13939
|
borderColor: (0, import_color12.resolveColorTokenValue)(color.border),
|
|
13776
13940
|
color: (0, import_color12.resolveColorTokenValue)(color.message)
|
|
13777
13941
|
};
|
|
13778
|
-
return /* @__PURE__ */ (0,
|
|
13942
|
+
return /* @__PURE__ */ (0, import_jsx_runtime72.jsxs)(
|
|
13779
13943
|
"div",
|
|
13780
13944
|
{
|
|
13781
13945
|
ref,
|
|
@@ -13788,20 +13952,20 @@ var Toast = (0, import_react48.forwardRef)(function Toast2(props, ref) {
|
|
|
13788
13952
|
style: { ...tokenStyle, ...style },
|
|
13789
13953
|
className: (0, import_clsx98.clsx)(toastStyles.card, className),
|
|
13790
13954
|
children: [
|
|
13791
|
-
/* @__PURE__ */ (0,
|
|
13792
|
-
/* @__PURE__ */ (0,
|
|
13955
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsx)("div", { "data-refineui": "toast-icon", className: toastStyles.iconWrap, children: iconContent }),
|
|
13956
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsx)("div", { className: toastStyles.contentWrap, children: message != null && message !== "" ? /* @__PURE__ */ (0, import_jsx_runtime72.jsx)("div", { className: toastStyles.message, children: message }) : null }),
|
|
13793
13957
|
action != null && actionEl
|
|
13794
13958
|
]
|
|
13795
13959
|
}
|
|
13796
13960
|
);
|
|
13797
13961
|
});
|
|
13798
13962
|
function SwipeableToast({ record, index, swipeDirections, onSwipeStart, onSwipeEnd }) {
|
|
13799
|
-
const toastRef = (0,
|
|
13800
|
-
const dragStartRef = (0,
|
|
13801
|
-
const axisRef = (0,
|
|
13802
|
-
const offsetRef = (0,
|
|
13803
|
-
const [swiping, setSwiping] = (0,
|
|
13804
|
-
const clearSwipeOffset = (0,
|
|
13963
|
+
const toastRef = (0, import_react50.useRef)(null);
|
|
13964
|
+
const dragStartRef = (0, import_react50.useRef)(null);
|
|
13965
|
+
const axisRef = (0, import_react50.useRef)(null);
|
|
13966
|
+
const offsetRef = (0, import_react50.useRef)({ x: 0, y: 0 });
|
|
13967
|
+
const [swiping, setSwiping] = (0, import_react50.useState)(false);
|
|
13968
|
+
const clearSwipeOffset = (0, import_react50.useCallback)(() => {
|
|
13805
13969
|
const el = toastRef.current;
|
|
13806
13970
|
offsetRef.current = { x: 0, y: 0 };
|
|
13807
13971
|
if (!el) return;
|
|
@@ -13876,7 +14040,7 @@ function SwipeableToast({ record, index, swipeDirections, onSwipeStart, onSwipeE
|
|
|
13876
14040
|
clearSwipeOffset();
|
|
13877
14041
|
onSwipeEnd();
|
|
13878
14042
|
};
|
|
13879
|
-
return /* @__PURE__ */ (0,
|
|
14043
|
+
return /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
|
|
13880
14044
|
Toast,
|
|
13881
14045
|
{
|
|
13882
14046
|
ref: toastRef,
|
|
@@ -13902,8 +14066,8 @@ function Toaster({
|
|
|
13902
14066
|
swipeDirections,
|
|
13903
14067
|
className
|
|
13904
14068
|
}) {
|
|
13905
|
-
const toasterKeyRef = (0,
|
|
13906
|
-
const isPortalOwner = (0,
|
|
14069
|
+
const toasterKeyRef = (0, import_react50.useRef)(/* @__PURE__ */ Symbol("refineui-toaster"));
|
|
14070
|
+
const isPortalOwner = (0, import_react50.useSyncExternalStore)(
|
|
13907
14071
|
(onStoreChange) => {
|
|
13908
14072
|
toasterOwnerListeners.add(onStoreChange);
|
|
13909
14073
|
return () => toasterOwnerListeners.delete(onStoreChange);
|
|
@@ -13911,12 +14075,12 @@ function Toaster({
|
|
|
13911
14075
|
() => activeToasterKey === toasterKeyRef.current,
|
|
13912
14076
|
() => false
|
|
13913
14077
|
);
|
|
13914
|
-
const [records, setRecords] = (0,
|
|
13915
|
-
const timerMapRef = (0,
|
|
13916
|
-
const pausedRef = (0,
|
|
13917
|
-
const rootRef = (0,
|
|
13918
|
-
const itemRefs = (0,
|
|
13919
|
-
const [layoutTick, setLayoutTick] = (0,
|
|
14078
|
+
const [records, setRecords] = (0, import_react50.useState)([]);
|
|
14079
|
+
const timerMapRef = (0, import_react50.useRef)({});
|
|
14080
|
+
const pausedRef = (0, import_react50.useRef)(/* @__PURE__ */ new Set());
|
|
14081
|
+
const rootRef = (0, import_react50.useRef)(null);
|
|
14082
|
+
const itemRefs = (0, import_react50.useRef)({});
|
|
14083
|
+
const [layoutTick, setLayoutTick] = (0, import_react50.useState)(0);
|
|
13920
14084
|
const stackGapPx = useToastStackGapPx();
|
|
13921
14085
|
const resolvedSwipe = swipeDirections ?? DEFAULT_SWIPE_DIRECTIONS;
|
|
13922
14086
|
useIsomorphicLayoutEffect6(() => {
|
|
@@ -13930,13 +14094,13 @@ function Toaster({
|
|
|
13930
14094
|
}
|
|
13931
14095
|
};
|
|
13932
14096
|
}, []);
|
|
13933
|
-
(0,
|
|
14097
|
+
(0, import_react50.useEffect)(() => {
|
|
13934
14098
|
if (!isPortalOwner) return;
|
|
13935
14099
|
return subscribeToasts((next) => {
|
|
13936
14100
|
setRecords(next.slice(0, Math.max(1, maxToasts)));
|
|
13937
14101
|
});
|
|
13938
14102
|
}, [isPortalOwner, maxToasts]);
|
|
13939
|
-
(0,
|
|
14103
|
+
(0, import_react50.useEffect)(() => {
|
|
13940
14104
|
if (!isPortalOwner) return;
|
|
13941
14105
|
for (const rec of records) {
|
|
13942
14106
|
if (rec.phase === "leaving") continue;
|
|
@@ -13958,7 +14122,7 @@ function Toaster({
|
|
|
13958
14122
|
}
|
|
13959
14123
|
}
|
|
13960
14124
|
}, [isPortalOwner, records]);
|
|
13961
|
-
(0,
|
|
14125
|
+
(0, import_react50.useEffect)(() => {
|
|
13962
14126
|
return () => {
|
|
13963
14127
|
for (const handle of Object.values(timerMapRef.current)) {
|
|
13964
14128
|
clearTimeout(handle);
|
|
@@ -13984,7 +14148,7 @@ function Toaster({
|
|
|
13984
14148
|
li.style.height = `${slotHeight(idx)}px`;
|
|
13985
14149
|
}
|
|
13986
14150
|
}, [isPortalOwner, layoutTick, records, stackGapPx]);
|
|
13987
|
-
(0,
|
|
14151
|
+
(0, import_react50.useEffect)(() => {
|
|
13988
14152
|
if (!isPortalOwner) return;
|
|
13989
14153
|
const root = rootRef.current;
|
|
13990
14154
|
if (!root) return;
|
|
@@ -14017,8 +14181,8 @@ function Toaster({
|
|
|
14017
14181
|
if (typeof document === "undefined" || !isPortalOwner) {
|
|
14018
14182
|
return null;
|
|
14019
14183
|
}
|
|
14020
|
-
return (0,
|
|
14021
|
-
/* @__PURE__ */ (0,
|
|
14184
|
+
return (0, import_react_dom7.createPortal)(
|
|
14185
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
|
|
14022
14186
|
"ol",
|
|
14023
14187
|
{
|
|
14024
14188
|
ref: rootRef,
|
|
@@ -14029,7 +14193,7 @@ function Toaster({
|
|
|
14029
14193
|
style: {
|
|
14030
14194
|
["--refineui-toast-gap"]: `${stackGapPx}px`
|
|
14031
14195
|
},
|
|
14032
|
-
children: records.map((rec, index) => /* @__PURE__ */ (0,
|
|
14196
|
+
children: records.map((rec, index) => /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
|
|
14033
14197
|
"li",
|
|
14034
14198
|
{
|
|
14035
14199
|
ref: (node) => {
|
|
@@ -14043,7 +14207,7 @@ function Toaster({
|
|
|
14043
14207
|
["--refineui-toast-z-index"]: String(STACK_Z_BASE - index),
|
|
14044
14208
|
["--refineui-toast-stack-index"]: String(index)
|
|
14045
14209
|
},
|
|
14046
|
-
children: /* @__PURE__ */ (0,
|
|
14210
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime72.jsx)("div", { "data-refineui": "toast-scale-layer", children: /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
|
|
14047
14211
|
SwipeableToast,
|
|
14048
14212
|
{
|
|
14049
14213
|
record: rec,
|
|
@@ -14064,21 +14228,21 @@ function Toaster({
|
|
|
14064
14228
|
|
|
14065
14229
|
// src/components/Tree/Tree.tsx
|
|
14066
14230
|
var import_clsx100 = require("clsx");
|
|
14067
|
-
var
|
|
14231
|
+
var import_react52 = require("react");
|
|
14068
14232
|
|
|
14069
14233
|
// src/components/Tree/context.ts
|
|
14070
|
-
var
|
|
14234
|
+
var import_react51 = require("react");
|
|
14071
14235
|
var import_tokens31 = require("@refineui/tokens");
|
|
14072
14236
|
var import_animation8 = require("@refineui/utilities/animation");
|
|
14073
14237
|
var TREE_PANEL_MS = Number.parseFloat(import_tokens31.semanticInteraction.duration.accordionPanel) / 1e3;
|
|
14074
14238
|
var TREE_CONTENT_MS = Number.parseFloat(import_tokens31.semanticInteraction.duration.accordionContent) / 1e3;
|
|
14075
14239
|
var TREE_PANEL_EASE = import_tokens31.semanticInteraction.easing.panel;
|
|
14076
14240
|
var TREE_CONTENT_EASE = import_tokens31.semanticInteraction.easing.content;
|
|
14077
|
-
var TreeContext = (0,
|
|
14078
|
-
var TreeItemContext = (0,
|
|
14241
|
+
var TreeContext = (0, import_react51.createContext)(null);
|
|
14242
|
+
var TreeItemContext = (0, import_react51.createContext)(null);
|
|
14079
14243
|
function usePrefersReducedMotion2() {
|
|
14080
|
-
const [reduce, setReduce] = (0,
|
|
14081
|
-
(0,
|
|
14244
|
+
const [reduce, setReduce] = (0, import_react51.useState)(false);
|
|
14245
|
+
(0, import_react51.useEffect)(() => {
|
|
14082
14246
|
const mql = window.matchMedia((0, import_animation8.getReducedMotionQuery)().replace("@media ", ""));
|
|
14083
14247
|
const sync = () => setReduce(mql.matches);
|
|
14084
14248
|
sync();
|
|
@@ -14133,7 +14297,7 @@ var treeItemTypo = {
|
|
|
14133
14297
|
};
|
|
14134
14298
|
|
|
14135
14299
|
// src/components/Tree/Tree.tsx
|
|
14136
|
-
var
|
|
14300
|
+
var import_jsx_runtime73 = require("react/jsx-runtime");
|
|
14137
14301
|
function Tree({
|
|
14138
14302
|
size = "md",
|
|
14139
14303
|
defaultExpanded,
|
|
@@ -14147,29 +14311,29 @@ function Tree({
|
|
|
14147
14311
|
...props
|
|
14148
14312
|
}) {
|
|
14149
14313
|
const reduceMotion = usePrefersReducedMotion2();
|
|
14150
|
-
const [uncontrolledExpanded, setUncontrolledExpanded] = (0,
|
|
14151
|
-
const [uncontrolledSelected, setUncontrolledSelected] = (0,
|
|
14314
|
+
const [uncontrolledExpanded, setUncontrolledExpanded] = (0, import_react52.useState)(() => toExpandedSet(defaultExpanded));
|
|
14315
|
+
const [uncontrolledSelected, setUncontrolledSelected] = (0, import_react52.useState)(defaultSelected ?? null);
|
|
14152
14316
|
const expanded = expandedProp === void 0 ? uncontrolledExpanded : toExpandedSet(expandedProp);
|
|
14153
14317
|
const selected = selectedProp === void 0 ? uncontrolledSelected : selectedProp;
|
|
14154
|
-
const orderRef = (0,
|
|
14155
|
-
const elMapRef = (0,
|
|
14156
|
-
const metaMapRef = (0,
|
|
14157
|
-
const emitExpanded = (0,
|
|
14318
|
+
const orderRef = (0, import_react52.useRef)([]);
|
|
14319
|
+
const elMapRef = (0, import_react52.useRef)(/* @__PURE__ */ new Map());
|
|
14320
|
+
const metaMapRef = (0, import_react52.useRef)(/* @__PURE__ */ new Map());
|
|
14321
|
+
const emitExpanded = (0, import_react52.useCallback)(
|
|
14158
14322
|
(next) => {
|
|
14159
14323
|
if (expandedProp === void 0) setUncontrolledExpanded(next);
|
|
14160
14324
|
onExpandedChange?.(Array.from(next));
|
|
14161
14325
|
},
|
|
14162
14326
|
[expandedProp, onExpandedChange]
|
|
14163
14327
|
);
|
|
14164
|
-
const emitSelected = (0,
|
|
14328
|
+
const emitSelected = (0, import_react52.useCallback)(
|
|
14165
14329
|
(next) => {
|
|
14166
14330
|
if (selectedProp === void 0) setUncontrolledSelected(next);
|
|
14167
14331
|
onSelectedChange?.(next);
|
|
14168
14332
|
},
|
|
14169
14333
|
[onSelectedChange, selectedProp]
|
|
14170
14334
|
);
|
|
14171
|
-
const isExpanded = (0,
|
|
14172
|
-
const toggleExpanded = (0,
|
|
14335
|
+
const isExpanded = (0, import_react52.useCallback)((value) => expanded.has(value), [expanded]);
|
|
14336
|
+
const toggleExpanded = (0, import_react52.useCallback)(
|
|
14173
14337
|
(value) => {
|
|
14174
14338
|
const next = new Set(expanded);
|
|
14175
14339
|
if (next.has(value)) next.delete(value);
|
|
@@ -14178,7 +14342,7 @@ function Tree({
|
|
|
14178
14342
|
},
|
|
14179
14343
|
[emitExpanded, expanded]
|
|
14180
14344
|
);
|
|
14181
|
-
const expand = (0,
|
|
14345
|
+
const expand = (0, import_react52.useCallback)(
|
|
14182
14346
|
(value) => {
|
|
14183
14347
|
if (expanded.has(value)) return;
|
|
14184
14348
|
const next = new Set(expanded);
|
|
@@ -14187,7 +14351,7 @@ function Tree({
|
|
|
14187
14351
|
},
|
|
14188
14352
|
[emitExpanded, expanded]
|
|
14189
14353
|
);
|
|
14190
|
-
const collapse = (0,
|
|
14354
|
+
const collapse = (0, import_react52.useCallback)(
|
|
14191
14355
|
(value) => {
|
|
14192
14356
|
if (!expanded.has(value)) return;
|
|
14193
14357
|
const next = new Set(expanded);
|
|
@@ -14196,13 +14360,13 @@ function Tree({
|
|
|
14196
14360
|
},
|
|
14197
14361
|
[emitExpanded, expanded]
|
|
14198
14362
|
);
|
|
14199
|
-
const select = (0,
|
|
14363
|
+
const select = (0, import_react52.useCallback)(
|
|
14200
14364
|
(value) => {
|
|
14201
14365
|
emitSelected(value);
|
|
14202
14366
|
},
|
|
14203
14367
|
[emitSelected]
|
|
14204
14368
|
);
|
|
14205
|
-
const registerItem = (0,
|
|
14369
|
+
const registerItem = (0, import_react52.useCallback)((value, el, meta) => {
|
|
14206
14370
|
metaMapRef.current.set(value, meta);
|
|
14207
14371
|
if (!orderRef.current.includes(value)) {
|
|
14208
14372
|
orderRef.current.push(value);
|
|
@@ -14214,10 +14378,10 @@ function Tree({
|
|
|
14214
14378
|
orderRef.current = orderRef.current.filter((v) => v !== value);
|
|
14215
14379
|
}
|
|
14216
14380
|
}, []);
|
|
14217
|
-
const focusItem = (0,
|
|
14381
|
+
const focusItem = (0, import_react52.useCallback)((value) => {
|
|
14218
14382
|
elMapRef.current.get(value)?.focus();
|
|
14219
14383
|
}, []);
|
|
14220
|
-
const visibleValues = (0,
|
|
14384
|
+
const visibleValues = (0, import_react52.useCallback)(() => {
|
|
14221
14385
|
const result = [];
|
|
14222
14386
|
const walk = (parent) => {
|
|
14223
14387
|
for (const value of orderRef.current) {
|
|
@@ -14231,7 +14395,7 @@ function Tree({
|
|
|
14231
14395
|
walk(null);
|
|
14232
14396
|
return result;
|
|
14233
14397
|
}, [expanded]);
|
|
14234
|
-
const focusByDelta = (0,
|
|
14398
|
+
const focusByDelta = (0, import_react52.useCallback)(
|
|
14235
14399
|
(currentValue, delta) => {
|
|
14236
14400
|
const list = visibleValues();
|
|
14237
14401
|
const idx = list.indexOf(currentValue);
|
|
@@ -14241,17 +14405,17 @@ function Tree({
|
|
|
14241
14405
|
},
|
|
14242
14406
|
[focusItem, visibleValues]
|
|
14243
14407
|
);
|
|
14244
|
-
const focusFirst = (0,
|
|
14408
|
+
const focusFirst = (0, import_react52.useCallback)(() => {
|
|
14245
14409
|
const list = visibleValues();
|
|
14246
14410
|
if (list[0]) focusItem(list[0]);
|
|
14247
14411
|
}, [focusItem, visibleValues]);
|
|
14248
|
-
const focusLast = (0,
|
|
14412
|
+
const focusLast = (0, import_react52.useCallback)(() => {
|
|
14249
14413
|
const list = visibleValues();
|
|
14250
14414
|
const last = list[list.length - 1];
|
|
14251
14415
|
if (last) focusItem(last);
|
|
14252
14416
|
}, [focusItem, visibleValues]);
|
|
14253
|
-
const getParent = (0,
|
|
14254
|
-
const contextValue = (0,
|
|
14417
|
+
const getParent = (0, import_react52.useCallback)((value) => metaMapRef.current.get(value)?.parentValue ?? null, []);
|
|
14418
|
+
const contextValue = (0, import_react52.useMemo)(
|
|
14255
14419
|
() => ({
|
|
14256
14420
|
size,
|
|
14257
14421
|
isExpanded,
|
|
@@ -14285,7 +14449,7 @@ function Tree({
|
|
|
14285
14449
|
toggleExpanded
|
|
14286
14450
|
]
|
|
14287
14451
|
);
|
|
14288
|
-
return /* @__PURE__ */ (0,
|
|
14452
|
+
return /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(TreeContext.Provider, { value: contextValue, children: /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(
|
|
14289
14453
|
"ul",
|
|
14290
14454
|
{
|
|
14291
14455
|
"data-refineui": "tree",
|
|
@@ -14299,21 +14463,21 @@ function Tree({
|
|
|
14299
14463
|
|
|
14300
14464
|
// src/components/Tree/TreeItem.tsx
|
|
14301
14465
|
var import_clsx101 = require("clsx");
|
|
14302
|
-
var
|
|
14303
|
-
var
|
|
14466
|
+
var import_react53 = require("react");
|
|
14467
|
+
var import_jsx_runtime74 = require("react/jsx-runtime");
|
|
14304
14468
|
function TreeItem({ value, disabled = false, className, children, ...props }) {
|
|
14305
|
-
const tree = (0,
|
|
14306
|
-
const parent = (0,
|
|
14469
|
+
const tree = (0, import_react53.useContext)(TreeContext);
|
|
14470
|
+
const parent = (0, import_react53.useContext)(TreeItemContext);
|
|
14307
14471
|
if (!tree) throw new Error("TreeItem must be used within Tree.");
|
|
14308
|
-
const [hasBranch, setHasBranch] = (0,
|
|
14309
|
-
const uid = (0,
|
|
14472
|
+
const [hasBranch, setHasBranch] = (0, import_react53.useState)(false);
|
|
14473
|
+
const uid = (0, import_react53.useId)().replace(/:/g, "");
|
|
14310
14474
|
const depth = parent ? parent.depth + 1 : 0;
|
|
14311
14475
|
const parentValue = parent?.value ?? null;
|
|
14312
14476
|
const expanded = tree.isExpanded(value);
|
|
14313
14477
|
const selected = tree.selected === value;
|
|
14314
14478
|
const triggerId = `tree-trigger-${uid}-${value}`;
|
|
14315
14479
|
const groupId = `tree-group-${uid}-${value}`;
|
|
14316
|
-
const itemContext = (0,
|
|
14480
|
+
const itemContext = (0, import_react53.useMemo)(
|
|
14317
14481
|
() => ({
|
|
14318
14482
|
value,
|
|
14319
14483
|
depth,
|
|
@@ -14328,7 +14492,7 @@ function TreeItem({ value, disabled = false, className, children, ...props }) {
|
|
|
14328
14492
|
}),
|
|
14329
14493
|
[value, depth, parentValue, expanded, selected, disabled, hasBranch, triggerId, groupId]
|
|
14330
14494
|
);
|
|
14331
|
-
return /* @__PURE__ */ (0,
|
|
14495
|
+
return /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(TreeItemContext.Provider, { value: itemContext, children: /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
|
|
14332
14496
|
"li",
|
|
14333
14497
|
{
|
|
14334
14498
|
"data-refineui": "tree-item",
|
|
@@ -14349,18 +14513,18 @@ function TreeItem({ value, disabled = false, className, children, ...props }) {
|
|
|
14349
14513
|
|
|
14350
14514
|
// src/components/Tree/TreeItemTrigger.tsx
|
|
14351
14515
|
var import_clsx102 = require("clsx");
|
|
14352
|
-
var
|
|
14353
|
-
var
|
|
14516
|
+
var import_react54 = require("react");
|
|
14517
|
+
var import_jsx_runtime75 = require("react/jsx-runtime");
|
|
14354
14518
|
function TreeItemTrigger({ className, children, onClick, onKeyDown, ...props }) {
|
|
14355
|
-
const tree = (0,
|
|
14356
|
-
const item = (0,
|
|
14519
|
+
const tree = (0, import_react54.useContext)(TreeContext);
|
|
14520
|
+
const item = (0, import_react54.useContext)(TreeItemContext);
|
|
14357
14521
|
if (!tree || !item) throw new Error("TreeItemTrigger must be used within TreeItem.");
|
|
14358
14522
|
const iconSize = treeIconSize[tree.size];
|
|
14359
14523
|
const depthIndent = "calc(var(--refineui-spacing-size-large) + var(--refineui-spacing-size-x-small))";
|
|
14360
14524
|
const mainStyle = {
|
|
14361
14525
|
paddingInlineStart: item.depth > 0 ? `calc(${depthIndent} * ${item.depth})` : void 0
|
|
14362
14526
|
};
|
|
14363
|
-
(0,
|
|
14527
|
+
(0, import_react54.useEffect)(() => {
|
|
14364
14528
|
return () => {
|
|
14365
14529
|
tree.registerItem(item.value, null, {
|
|
14366
14530
|
parentValue: item.parentValue,
|
|
@@ -14436,7 +14600,7 @@ function TreeItemTrigger({ className, children, onClick, onKeyDown, ...props })
|
|
|
14436
14600
|
break;
|
|
14437
14601
|
}
|
|
14438
14602
|
};
|
|
14439
|
-
return /* @__PURE__ */ (0,
|
|
14603
|
+
return /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(
|
|
14440
14604
|
"div",
|
|
14441
14605
|
{
|
|
14442
14606
|
ref: setRowRef,
|
|
@@ -14455,8 +14619,8 @@ function TreeItemTrigger({ className, children, onClick, onKeyDown, ...props })
|
|
|
14455
14619
|
className
|
|
14456
14620
|
),
|
|
14457
14621
|
...props,
|
|
14458
|
-
children: /* @__PURE__ */ (0,
|
|
14459
|
-
item.hasBranch ? /* @__PURE__ */ (0,
|
|
14622
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime75.jsxs)("div", { "data-refineui": "tree-item-main", className: treeStyles.rowMain, style: mainStyle, children: [
|
|
14623
|
+
item.hasBranch ? /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(
|
|
14460
14624
|
"button",
|
|
14461
14625
|
{
|
|
14462
14626
|
type: "button",
|
|
@@ -14470,10 +14634,10 @@ function TreeItemTrigger({ className, children, onClick, onKeyDown, ...props })
|
|
|
14470
14634
|
item.expanded && treeStyles.chevronExpanded,
|
|
14471
14635
|
tree.reduceMotion && "transition-none"
|
|
14472
14636
|
),
|
|
14473
|
-
children: /* @__PURE__ */ (0,
|
|
14637
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(WebIcon, { name: "chevron-right", size: iconSize, color: "currentColor", fallback: "\u203A" })
|
|
14474
14638
|
}
|
|
14475
|
-
) : /* @__PURE__ */ (0,
|
|
14476
|
-
/* @__PURE__ */ (0,
|
|
14639
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime75.jsx)("span", { className: treeStyles.chevronSpacer, "aria-hidden": "true" }),
|
|
14640
|
+
/* @__PURE__ */ (0, import_jsx_runtime75.jsx)("span", { className: treeStyles.label, children })
|
|
14477
14641
|
] })
|
|
14478
14642
|
}
|
|
14479
14643
|
);
|
|
@@ -14481,14 +14645,14 @@ function TreeItemTrigger({ className, children, onClick, onKeyDown, ...props })
|
|
|
14481
14645
|
|
|
14482
14646
|
// src/components/Tree/TreeItemContent.tsx
|
|
14483
14647
|
var import_clsx103 = require("clsx");
|
|
14484
|
-
var
|
|
14485
|
-
var
|
|
14648
|
+
var import_react55 = require("react");
|
|
14649
|
+
var import_jsx_runtime76 = require("react/jsx-runtime");
|
|
14486
14650
|
function TreeItemContent({ className, children, ...props }) {
|
|
14487
|
-
const tree = (0,
|
|
14488
|
-
const item = (0,
|
|
14651
|
+
const tree = (0, import_react55.useContext)(TreeContext);
|
|
14652
|
+
const item = (0, import_react55.useContext)(TreeItemContext);
|
|
14489
14653
|
if (!tree || !item) throw new Error("TreeItemContent must be used within TreeItem.");
|
|
14490
14654
|
const { setHasBranch, expanded, groupId, triggerId } = item;
|
|
14491
|
-
(0,
|
|
14655
|
+
(0, import_react55.useLayoutEffect)(() => {
|
|
14492
14656
|
setHasBranch(true);
|
|
14493
14657
|
return () => setHasBranch(false);
|
|
14494
14658
|
}, [setHasBranch]);
|
|
@@ -14503,7 +14667,7 @@ function TreeItemContent({ className, children, ...props }) {
|
|
|
14503
14667
|
transition: tree.reduceMotion ? void 0 : `opacity ${TREE_CONTENT_MS}s ${TREE_CONTENT_EASE}, transform ${TREE_CONTENT_MS}s ${TREE_CONTENT_EASE}`,
|
|
14504
14668
|
pointerEvents: expanded ? void 0 : "none"
|
|
14505
14669
|
};
|
|
14506
|
-
return /* @__PURE__ */ (0,
|
|
14670
|
+
return /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(
|
|
14507
14671
|
"div",
|
|
14508
14672
|
{
|
|
14509
14673
|
ref: (el) => {
|
|
@@ -14514,7 +14678,7 @@ function TreeItemContent({ className, children, ...props }) {
|
|
|
14514
14678
|
"data-refineui": "tree-item-panel",
|
|
14515
14679
|
"aria-hidden": !expanded,
|
|
14516
14680
|
style: gridStyle,
|
|
14517
|
-
children: /* @__PURE__ */ (0,
|
|
14681
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime76.jsx)("div", { className: treeStyles.panel, children: /* @__PURE__ */ (0, import_jsx_runtime76.jsx)("div", { className: treeStyles.panelInner, style: innerMotionStyle, children: /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(
|
|
14518
14682
|
"ul",
|
|
14519
14683
|
{
|
|
14520
14684
|
id: groupId,
|
|
@@ -14532,19 +14696,72 @@ function TreeItemContent({ className, children, ...props }) {
|
|
|
14532
14696
|
|
|
14533
14697
|
// src/components/Tooltip/Tooltip.tsx
|
|
14534
14698
|
var import_clsx105 = require("clsx");
|
|
14535
|
-
var
|
|
14699
|
+
var import_react56 = require("react");
|
|
14536
14700
|
var import_color13 = require("@refineui/utilities/color");
|
|
14537
|
-
var
|
|
14701
|
+
var import_react57 = require("@refineui/utilities/react");
|
|
14538
14702
|
|
|
14539
|
-
// src/components/
|
|
14703
|
+
// src/components/shared/FrostedBeak.tsx
|
|
14540
14704
|
var import_tokens33 = require("@refineui/tokens");
|
|
14705
|
+
var import_jsx_runtime77 = require("react/jsx-runtime");
|
|
14706
|
+
var triangleClipPath = "polygon(50% 0, 0 100%, 100% 100%)";
|
|
14707
|
+
function FrostedBeak({ width, height, rotateDeg, borderColor }) {
|
|
14708
|
+
const surfaceStyle = {
|
|
14709
|
+
position: "absolute",
|
|
14710
|
+
inset: 0,
|
|
14711
|
+
clipPath: triangleClipPath
|
|
14712
|
+
};
|
|
14713
|
+
return /* @__PURE__ */ (0, import_jsx_runtime77.jsxs)(
|
|
14714
|
+
"div",
|
|
14715
|
+
{
|
|
14716
|
+
style: {
|
|
14717
|
+
position: "relative",
|
|
14718
|
+
width,
|
|
14719
|
+
height,
|
|
14720
|
+
transform: `rotate(${rotateDeg}deg)`,
|
|
14721
|
+
transformOrigin: "center center"
|
|
14722
|
+
},
|
|
14723
|
+
children: [
|
|
14724
|
+
/* @__PURE__ */ (0, import_jsx_runtime77.jsx)(
|
|
14725
|
+
"span",
|
|
14726
|
+
{
|
|
14727
|
+
"data-refineui": "floating-beak-surface",
|
|
14728
|
+
style: surfaceStyle
|
|
14729
|
+
}
|
|
14730
|
+
),
|
|
14731
|
+
/* @__PURE__ */ (0, import_jsx_runtime77.jsx)(
|
|
14732
|
+
"svg",
|
|
14733
|
+
{
|
|
14734
|
+
width,
|
|
14735
|
+
height,
|
|
14736
|
+
viewBox: "0 0 16 8",
|
|
14737
|
+
fill: "none",
|
|
14738
|
+
"aria-hidden": true,
|
|
14739
|
+
style: { position: "absolute", inset: 0, overflow: "visible" },
|
|
14740
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(
|
|
14741
|
+
"path",
|
|
14742
|
+
{
|
|
14743
|
+
d: "M0 8L8 0L16 8",
|
|
14744
|
+
stroke: borderColor,
|
|
14745
|
+
strokeWidth: import_tokens33.strokeWidths.strokeWidthThin,
|
|
14746
|
+
strokeLinejoin: "round"
|
|
14747
|
+
}
|
|
14748
|
+
)
|
|
14749
|
+
}
|
|
14750
|
+
)
|
|
14751
|
+
]
|
|
14752
|
+
}
|
|
14753
|
+
);
|
|
14754
|
+
}
|
|
14755
|
+
|
|
14756
|
+
// src/components/Tooltip/style.ts
|
|
14757
|
+
var import_tokens34 = require("@refineui/tokens");
|
|
14541
14758
|
var import_clsx104 = require("clsx");
|
|
14542
14759
|
var TOOLTIP_BEAK_W = import_tokens3.foundationSizes.foundationSize160;
|
|
14543
14760
|
var TOOLTIP_BEAK_H = import_tokens3.foundationSizes.foundationSize80;
|
|
14544
14761
|
var TOOLTIP_BEAK_OFFSET = import_tokens3.foundationSizes.foundationSize80;
|
|
14545
|
-
var BEAK_BORDER_OVERLAP2 =
|
|
14546
|
-
var gap =
|
|
14547
|
-
var edgeInset =
|
|
14762
|
+
var BEAK_BORDER_OVERLAP2 = import_tokens34.strokeWidths.strokeWidthThin;
|
|
14763
|
+
var gap = import_tokens34.spacings.sizeXSmall;
|
|
14764
|
+
var edgeInset = import_tokens34.spacings.sizeMedium;
|
|
14548
14765
|
var tooltipStyles = {
|
|
14549
14766
|
root: "relative inline-block",
|
|
14550
14767
|
fallbackTrigger: "inline-flex outline-none",
|
|
@@ -14638,7 +14855,7 @@ function tooltipBeakRotateDeg(position) {
|
|
|
14638
14855
|
}
|
|
14639
14856
|
|
|
14640
14857
|
// src/components/Tooltip/Tooltip.tsx
|
|
14641
|
-
var
|
|
14858
|
+
var import_jsx_runtime78 = require("react/jsx-runtime");
|
|
14642
14859
|
function Tooltip({
|
|
14643
14860
|
trigger,
|
|
14644
14861
|
content,
|
|
@@ -14651,10 +14868,10 @@ function Tooltip({
|
|
|
14651
14868
|
className,
|
|
14652
14869
|
...props
|
|
14653
14870
|
}) {
|
|
14654
|
-
const [innerOpen, setInnerOpen] = (0,
|
|
14871
|
+
const [innerOpen, setInnerOpen] = (0, import_react56.useState)(defaultOpen);
|
|
14655
14872
|
const open = ctrlOpen !== void 0 ? ctrlOpen : innerOpen;
|
|
14656
|
-
const tooltipId = (0,
|
|
14657
|
-
const showTimer = (0,
|
|
14873
|
+
const tooltipId = (0, import_react56.useId)();
|
|
14874
|
+
const showTimer = (0, import_react56.useRef)(null);
|
|
14658
14875
|
const setOpen = (next) => {
|
|
14659
14876
|
if (ctrlOpen === void 0) setInnerOpen(next);
|
|
14660
14877
|
onOpenChange?.(next);
|
|
@@ -14681,11 +14898,11 @@ function Tooltip({
|
|
|
14681
14898
|
const beakWrapStyle = tooltipBeakWrapperStyle(position, align);
|
|
14682
14899
|
const beakRot = tooltipBeakRotateDeg(position);
|
|
14683
14900
|
const describedBy = open ? tooltipId : void 0;
|
|
14684
|
-
const mergeEl = (0,
|
|
14901
|
+
const mergeEl = (0, import_react57.getMergeableTriggerChild)(trigger);
|
|
14685
14902
|
let triggerNode;
|
|
14686
14903
|
if (mergeEl != null) {
|
|
14687
|
-
triggerNode = /* @__PURE__ */ (0,
|
|
14688
|
-
|
|
14904
|
+
triggerNode = /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
|
|
14905
|
+
import_react57.Slot,
|
|
14689
14906
|
{
|
|
14690
14907
|
"aria-describedby": describedBy,
|
|
14691
14908
|
onMouseEnter: scheduleShow,
|
|
@@ -14701,7 +14918,7 @@ function Tooltip({
|
|
|
14701
14918
|
}
|
|
14702
14919
|
);
|
|
14703
14920
|
} else {
|
|
14704
|
-
triggerNode = /* @__PURE__ */ (0,
|
|
14921
|
+
triggerNode = /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
|
|
14705
14922
|
"span",
|
|
14706
14923
|
{
|
|
14707
14924
|
tabIndex: 0,
|
|
@@ -14718,44 +14935,27 @@ function Tooltip({
|
|
|
14718
14935
|
}
|
|
14719
14936
|
);
|
|
14720
14937
|
}
|
|
14721
|
-
return /* @__PURE__ */ (0,
|
|
14938
|
+
return /* @__PURE__ */ (0, import_jsx_runtime78.jsxs)("div", { "data-refineui": "tooltip", className: (0, import_clsx105.clsx)(tooltipStyles.root, className), ...props, children: [
|
|
14722
14939
|
triggerNode,
|
|
14723
|
-
open && /* @__PURE__ */ (0,
|
|
14724
|
-
/* @__PURE__ */ (0,
|
|
14940
|
+
open && /* @__PURE__ */ (0, import_jsx_runtime78.jsx)("div", { className: tooltipStyles.floating, style: floatingStyle, children: /* @__PURE__ */ (0, import_jsx_runtime78.jsxs)("div", { className: tooltipStyles.panelWrap, children: [
|
|
14941
|
+
/* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
|
|
14725
14942
|
"div",
|
|
14726
14943
|
{
|
|
14727
14944
|
className: tooltipStyles.beakWrap,
|
|
14728
14945
|
style: { ...beakWrapStyle, width: TOOLTIP_BEAK_W, height: TOOLTIP_BEAK_H },
|
|
14729
14946
|
"aria-hidden": true,
|
|
14730
|
-
children: /* @__PURE__ */ (0,
|
|
14731
|
-
|
|
14947
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
|
|
14948
|
+
FrostedBeak,
|
|
14732
14949
|
{
|
|
14733
|
-
|
|
14734
|
-
|
|
14735
|
-
|
|
14736
|
-
|
|
14737
|
-
transformOrigin: "center center"
|
|
14738
|
-
},
|
|
14739
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime76.jsxs)(
|
|
14740
|
-
"svg",
|
|
14741
|
-
{
|
|
14742
|
-
width: TOOLTIP_BEAK_W,
|
|
14743
|
-
height: TOOLTIP_BEAK_H,
|
|
14744
|
-
viewBox: "0 0 16 8",
|
|
14745
|
-
fill: "none",
|
|
14746
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
14747
|
-
style: { display: "block" },
|
|
14748
|
-
children: [
|
|
14749
|
-
/* @__PURE__ */ (0, import_jsx_runtime76.jsx)("polygon", { points: "8,0 0,8 16,8", fill: borderCol }),
|
|
14750
|
-
/* @__PURE__ */ (0, import_jsx_runtime76.jsx)("polygon", { points: "8,2 2,8 14,8", fill: bg })
|
|
14751
|
-
]
|
|
14752
|
-
}
|
|
14753
|
-
)
|
|
14950
|
+
width: TOOLTIP_BEAK_W,
|
|
14951
|
+
height: TOOLTIP_BEAK_H,
|
|
14952
|
+
rotateDeg: beakRot,
|
|
14953
|
+
borderColor: borderCol
|
|
14754
14954
|
}
|
|
14755
14955
|
)
|
|
14756
14956
|
}
|
|
14757
14957
|
),
|
|
14758
|
-
/* @__PURE__ */ (0,
|
|
14958
|
+
/* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
|
|
14759
14959
|
"div",
|
|
14760
14960
|
{
|
|
14761
14961
|
id: tooltipId,
|
|
@@ -14778,8 +14978,8 @@ function Tooltip({
|
|
|
14778
14978
|
|
|
14779
14979
|
// src/components/Chart/Chart.tsx
|
|
14780
14980
|
var import_clsx107 = require("clsx");
|
|
14781
|
-
var
|
|
14782
|
-
var
|
|
14981
|
+
var import_react58 = require("react");
|
|
14982
|
+
var import_tokens36 = require("@refineui/tokens");
|
|
14783
14983
|
var import_color14 = require("@refineui/utilities/color");
|
|
14784
14984
|
|
|
14785
14985
|
// src/components/Chart/style.ts
|
|
@@ -14824,16 +15024,16 @@ var chartStyles = {
|
|
|
14824
15024
|
};
|
|
14825
15025
|
|
|
14826
15026
|
// src/components/Chart/utils.ts
|
|
14827
|
-
var
|
|
15027
|
+
var import_tokens35 = require("@refineui/tokens");
|
|
14828
15028
|
var CHART_VIEWBOX_WIDTH = 800;
|
|
14829
15029
|
var CHART_VIEWBOX_HEIGHT = 320;
|
|
14830
|
-
var CHART_PLOT_PADDING_TOP = parseFloat(
|
|
14831
|
-
var CHART_PLOT_PADDING_BOTTOM = parseFloat(
|
|
14832
|
-
var CHART_PLOT_PADDING_X = parseFloat(
|
|
14833
|
-
var CHART_BAR_RADIUS = parseFloat(
|
|
15030
|
+
var CHART_PLOT_PADDING_TOP = parseFloat(import_tokens35.spacings.sizeMedium);
|
|
15031
|
+
var CHART_PLOT_PADDING_BOTTOM = parseFloat(import_tokens35.spacings.sizeXXSmall);
|
|
15032
|
+
var CHART_PLOT_PADDING_X = parseFloat(import_tokens35.spacings.sizeMedium);
|
|
15033
|
+
var CHART_BAR_RADIUS = parseFloat(import_tokens35.borderRadii.roundedXLarge);
|
|
14834
15034
|
var CHART_BAR_BAND_FILL = 0.5;
|
|
14835
|
-
var CHART_POINT_RADIUS = parseFloat(
|
|
14836
|
-
var CHART_POINT_STROKE = parseFloat(
|
|
15035
|
+
var CHART_POINT_RADIUS = parseFloat(import_tokens35.foundationSizes.foundationSize40);
|
|
15036
|
+
var CHART_POINT_STROKE = parseFloat(import_tokens35.foundationSizes.foundationSize20);
|
|
14837
15037
|
var CHART_TOOLTIP_FLIP_X = 0.75;
|
|
14838
15038
|
var CHART_TOOLTIP_FLIP_Y = 0.25;
|
|
14839
15039
|
function clampValue(n) {
|
|
@@ -15005,10 +15205,10 @@ function formatAxisTick(value) {
|
|
|
15005
15205
|
}
|
|
15006
15206
|
|
|
15007
15207
|
// src/components/Chart/Chart.tsx
|
|
15008
|
-
var
|
|
15009
|
-
var ChartContext = (0,
|
|
15208
|
+
var import_jsx_runtime79 = require("react/jsx-runtime");
|
|
15209
|
+
var ChartContext = (0, import_react58.createContext)(null);
|
|
15010
15210
|
function useChartContext(component) {
|
|
15011
|
-
const value = (0,
|
|
15211
|
+
const value = (0, import_react58.useContext)(ChartContext);
|
|
15012
15212
|
if (!value) throw new Error(`${component} must be used within Chart.`);
|
|
15013
15213
|
return value;
|
|
15014
15214
|
}
|
|
@@ -15038,15 +15238,15 @@ function itemState(index, hoverIndex, selectedIndex) {
|
|
|
15038
15238
|
return "default";
|
|
15039
15239
|
}
|
|
15040
15240
|
function isChartTooltipElement(node) {
|
|
15041
|
-
return (0,
|
|
15241
|
+
return (0, import_react58.isValidElement)(node) && node.type === ChartTooltip;
|
|
15042
15242
|
}
|
|
15043
15243
|
function Chart({ className, children, ...props }) {
|
|
15044
|
-
const [hoverIndex, setHoverIndex] = (0,
|
|
15045
|
-
const [selectedIndex, setSelectedIndex] = (0,
|
|
15046
|
-
const [pointer, setPointer] = (0,
|
|
15047
|
-
const [labels, setLabels] = (0,
|
|
15048
|
-
const [series, setSeries] = (0,
|
|
15049
|
-
const context = (0,
|
|
15244
|
+
const [hoverIndex, setHoverIndex] = (0, import_react58.useState)(null);
|
|
15245
|
+
const [selectedIndex, setSelectedIndex] = (0, import_react58.useState)(null);
|
|
15246
|
+
const [pointer, setPointer] = (0, import_react58.useState)(null);
|
|
15247
|
+
const [labels, setLabels] = (0, import_react58.useState)([]);
|
|
15248
|
+
const [series, setSeries] = (0, import_react58.useState)(null);
|
|
15249
|
+
const context = (0, import_react58.useMemo)(
|
|
15050
15250
|
() => ({
|
|
15051
15251
|
hoverIndex,
|
|
15052
15252
|
selectedIndex,
|
|
@@ -15061,7 +15261,7 @@ function Chart({ className, children, ...props }) {
|
|
|
15061
15261
|
}),
|
|
15062
15262
|
[hoverIndex, selectedIndex, pointer, labels, series]
|
|
15063
15263
|
);
|
|
15064
|
-
return /* @__PURE__ */ (0,
|
|
15264
|
+
return /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(ChartContext.Provider, { value: context, children: /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(
|
|
15065
15265
|
"div",
|
|
15066
15266
|
{
|
|
15067
15267
|
"data-refineui": "chart",
|
|
@@ -15072,7 +15272,7 @@ function Chart({ className, children, ...props }) {
|
|
|
15072
15272
|
) });
|
|
15073
15273
|
}
|
|
15074
15274
|
function ChartBody({ className, ...props }) {
|
|
15075
|
-
return /* @__PURE__ */ (0,
|
|
15275
|
+
return /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(
|
|
15076
15276
|
"div",
|
|
15077
15277
|
{
|
|
15078
15278
|
"data-refineui": "chart-body",
|
|
@@ -15082,7 +15282,7 @@ function ChartBody({ className, ...props }) {
|
|
|
15082
15282
|
);
|
|
15083
15283
|
}
|
|
15084
15284
|
function ChartContent({ className, ...props }) {
|
|
15085
|
-
return /* @__PURE__ */ (0,
|
|
15285
|
+
return /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(
|
|
15086
15286
|
"div",
|
|
15087
15287
|
{
|
|
15088
15288
|
"data-refineui": "chart-content",
|
|
@@ -15107,7 +15307,7 @@ function ChartHitArea() {
|
|
|
15107
15307
|
setHoverIndex(hoverIndexFromPlotX(next.x, count, series.align));
|
|
15108
15308
|
return next;
|
|
15109
15309
|
};
|
|
15110
|
-
return /* @__PURE__ */ (0,
|
|
15310
|
+
return /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(
|
|
15111
15311
|
"rect",
|
|
15112
15312
|
{
|
|
15113
15313
|
"data-refineui": "chart-hit-area",
|
|
@@ -15141,11 +15341,11 @@ function ChartPlot({
|
|
|
15141
15341
|
const { pointer, selectedIndex } = useChartContext("ChartPlot");
|
|
15142
15342
|
const svgChildren = [];
|
|
15143
15343
|
const tooltipNodes = [];
|
|
15144
|
-
|
|
15344
|
+
import_react58.Children.forEach(children, (child) => {
|
|
15145
15345
|
if (isChartTooltipElement(child)) tooltipNodes.push(child);
|
|
15146
15346
|
else svgChildren.push(child);
|
|
15147
15347
|
});
|
|
15148
|
-
return /* @__PURE__ */ (0,
|
|
15348
|
+
return /* @__PURE__ */ (0, import_jsx_runtime79.jsxs)(
|
|
15149
15349
|
"div",
|
|
15150
15350
|
{
|
|
15151
15351
|
"data-refineui": "chart-plot-frame",
|
|
@@ -15154,7 +15354,7 @@ function ChartPlot({
|
|
|
15154
15354
|
className: (0, import_clsx107.clsx)(chartStyles.plotFrame, className),
|
|
15155
15355
|
...props,
|
|
15156
15356
|
children: [
|
|
15157
|
-
/* @__PURE__ */ (0,
|
|
15357
|
+
/* @__PURE__ */ (0, import_jsx_runtime79.jsxs)(
|
|
15158
15358
|
"svg",
|
|
15159
15359
|
{
|
|
15160
15360
|
"data-refineui": "chart-plot",
|
|
@@ -15165,7 +15365,7 @@ function ChartPlot({
|
|
|
15165
15365
|
className: chartStyles.plot,
|
|
15166
15366
|
children: [
|
|
15167
15367
|
svgChildren,
|
|
15168
|
-
/* @__PURE__ */ (0,
|
|
15368
|
+
/* @__PURE__ */ (0, import_jsx_runtime79.jsx)(ChartHitArea, {})
|
|
15169
15369
|
]
|
|
15170
15370
|
}
|
|
15171
15371
|
),
|
|
@@ -15183,7 +15383,7 @@ function ChartTooltip({ className, children, style, ...props }) {
|
|
|
15183
15383
|
const flipY = pointer.y < CHART_PLOT_PADDING_TOP + plotHeight() * CHART_TOOLTIP_FLIP_Y;
|
|
15184
15384
|
const offsetX = flipX ? "calc(-100% - var(--refineui-spacing-size-small))" : "var(--refineui-spacing-size-small)";
|
|
15185
15385
|
const offsetY = flipY ? "var(--refineui-spacing-size-small)" : "calc(-100% - var(--refineui-spacing-size-x-small))";
|
|
15186
|
-
return /* @__PURE__ */ (0,
|
|
15386
|
+
return /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(
|
|
15187
15387
|
"div",
|
|
15188
15388
|
{
|
|
15189
15389
|
"data-refineui": "chart-tooltip",
|
|
@@ -15196,9 +15396,9 @@ function ChartTooltip({ className, children, style, ...props }) {
|
|
|
15196
15396
|
...style
|
|
15197
15397
|
},
|
|
15198
15398
|
...props,
|
|
15199
|
-
children: children ?? /* @__PURE__ */ (0,
|
|
15200
|
-
label ? /* @__PURE__ */ (0,
|
|
15201
|
-
/* @__PURE__ */ (0,
|
|
15399
|
+
children: children ?? /* @__PURE__ */ (0, import_jsx_runtime79.jsxs)(import_jsx_runtime79.Fragment, { children: [
|
|
15400
|
+
label ? /* @__PURE__ */ (0, import_jsx_runtime79.jsx)("span", { className: chartStyles.tooltipLabel, children: label }) : null,
|
|
15401
|
+
/* @__PURE__ */ (0, import_jsx_runtime79.jsx)("span", { className: chartStyles.tooltipValue, children: formatAxisTick(value) })
|
|
15202
15402
|
] })
|
|
15203
15403
|
}
|
|
15204
15404
|
);
|
|
@@ -15213,14 +15413,14 @@ function ChartYAxisLabels({
|
|
|
15213
15413
|
}) {
|
|
15214
15414
|
const scaleMax = resolveScale(values, max);
|
|
15215
15415
|
const ticks = yAxisTicks(scaleMax, lines).slice().reverse();
|
|
15216
|
-
return /* @__PURE__ */ (0,
|
|
15416
|
+
return /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(
|
|
15217
15417
|
"div",
|
|
15218
15418
|
{
|
|
15219
15419
|
"data-refineui": "chart-y-axis",
|
|
15220
15420
|
className: (0, import_clsx107.clsx)(chartStyles.yAxis, className),
|
|
15221
15421
|
"aria-hidden": true,
|
|
15222
15422
|
...props,
|
|
15223
|
-
children: ticks.map((tick) => /* @__PURE__ */ (0,
|
|
15423
|
+
children: ticks.map((tick) => /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(
|
|
15224
15424
|
"span",
|
|
15225
15425
|
{
|
|
15226
15426
|
className: chartStyles.yAxisTick,
|
|
@@ -15243,12 +15443,12 @@ function ChartGrid({
|
|
|
15243
15443
|
const ticks = yAxisTicks(scaleMax, lines);
|
|
15244
15444
|
const gridColor = gridStroke();
|
|
15245
15445
|
const baselineColor = gridBaselineStroke();
|
|
15246
|
-
return /* @__PURE__ */ (0,
|
|
15446
|
+
return /* @__PURE__ */ (0, import_jsx_runtime79.jsx)("g", { "data-refineui": "chart-grid", className, ...props, children: ticks.map((tick, index) => {
|
|
15247
15447
|
const y = gridLineY(scaleMax, tick);
|
|
15248
15448
|
const isBaseline = index === 0;
|
|
15249
15449
|
const isTop = index === ticks.length - 1;
|
|
15250
15450
|
if (isTop) return null;
|
|
15251
|
-
return /* @__PURE__ */ (0,
|
|
15451
|
+
return /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(
|
|
15252
15452
|
"line",
|
|
15253
15453
|
{
|
|
15254
15454
|
x1: CHART_PLOT_PADDING_X,
|
|
@@ -15257,7 +15457,7 @@ function ChartGrid({
|
|
|
15257
15457
|
y2: y,
|
|
15258
15458
|
stroke: isBaseline ? baselineColor : gridColor,
|
|
15259
15459
|
strokeWidth: "var(--refineui-stroke-width-thin)",
|
|
15260
|
-
strokeOpacity: isBaseline ?
|
|
15460
|
+
strokeOpacity: isBaseline ? import_tokens36.opacities.opacityFull : import_tokens36.opacities.opacityDisabled,
|
|
15261
15461
|
vectorEffect: "non-scaling-stroke"
|
|
15262
15462
|
},
|
|
15263
15463
|
tick
|
|
@@ -15280,13 +15480,13 @@ function ChartBars({
|
|
|
15280
15480
|
const barRadius = Math.min(CHART_BAR_RADIUS, barWidth / 2);
|
|
15281
15481
|
const baselineY = plotBaselineY();
|
|
15282
15482
|
const trackHeight = plotHeight();
|
|
15283
|
-
(0,
|
|
15483
|
+
(0, import_react58.useLayoutEffect)(() => {
|
|
15284
15484
|
setSeries({ values, seriesColor, max, align: "bar" });
|
|
15285
15485
|
}, [values, seriesColor, max, setSeries]);
|
|
15286
|
-
return /* @__PURE__ */ (0,
|
|
15486
|
+
return /* @__PURE__ */ (0, import_jsx_runtime79.jsxs)("g", { "data-refineui": "chart-bars", "data-series-color": seriesColor, className, ...props, children: [
|
|
15287
15487
|
showTrack ? values.map((_, index) => {
|
|
15288
15488
|
const x = barX(index, values.length);
|
|
15289
|
-
return /* @__PURE__ */ (0,
|
|
15489
|
+
return /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(
|
|
15290
15490
|
"path",
|
|
15291
15491
|
{
|
|
15292
15492
|
"data-refineui": "chart-bar-track",
|
|
@@ -15308,7 +15508,7 @@ function ChartBars({
|
|
|
15308
15508
|
const height = baselineY - y;
|
|
15309
15509
|
if (height <= 0) return null;
|
|
15310
15510
|
const state = itemState(index, hoverIndex, selectedIndex);
|
|
15311
|
-
return /* @__PURE__ */ (0,
|
|
15511
|
+
return /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(
|
|
15312
15512
|
"path",
|
|
15313
15513
|
{
|
|
15314
15514
|
"data-refineui": "chart-bar",
|
|
@@ -15331,30 +15531,30 @@ function ChartLine({
|
|
|
15331
15531
|
...props
|
|
15332
15532
|
}) {
|
|
15333
15533
|
const { hoverIndex, selectedIndex, setSeries } = useChartContext("ChartLine");
|
|
15334
|
-
const gradientId = (0,
|
|
15534
|
+
const gradientId = (0, import_react58.useId)().replace(/:/g, "");
|
|
15335
15535
|
const scaleMax = resolveChartScale(values, max);
|
|
15336
15536
|
const stroke = seriesColorToken(seriesColor);
|
|
15337
15537
|
const coords = linePointCoords(values, scaleMax);
|
|
15338
15538
|
const baselineY = plotBaselineY();
|
|
15339
15539
|
const pointRing = pointStrokeColor();
|
|
15340
15540
|
const linePath = monotoneLinePath(coords);
|
|
15341
|
-
(0,
|
|
15541
|
+
(0, import_react58.useLayoutEffect)(() => {
|
|
15342
15542
|
setSeries({ values, seriesColor, max, align: "line" });
|
|
15343
15543
|
}, [values, seriesColor, max, setSeries]);
|
|
15344
|
-
return /* @__PURE__ */ (0,
|
|
15345
|
-
showArea && coords.length > 1 ? /* @__PURE__ */ (0,
|
|
15346
|
-
/* @__PURE__ */ (0,
|
|
15347
|
-
/* @__PURE__ */ (0,
|
|
15544
|
+
return /* @__PURE__ */ (0, import_jsx_runtime79.jsxs)("g", { "data-refineui": "chart-line", "data-series-color": seriesColor, className, ...props, children: [
|
|
15545
|
+
showArea && coords.length > 1 ? /* @__PURE__ */ (0, import_jsx_runtime79.jsxs)(import_jsx_runtime79.Fragment, { children: [
|
|
15546
|
+
/* @__PURE__ */ (0, import_jsx_runtime79.jsx)("defs", { children: /* @__PURE__ */ (0, import_jsx_runtime79.jsxs)("linearGradient", { id: gradientId, x1: "0", y1: "0", x2: "0", y2: "1", children: [
|
|
15547
|
+
/* @__PURE__ */ (0, import_jsx_runtime79.jsx)(
|
|
15348
15548
|
"stop",
|
|
15349
15549
|
{
|
|
15350
15550
|
offset: "0%",
|
|
15351
15551
|
stopColor: stroke,
|
|
15352
|
-
stopOpacity:
|
|
15552
|
+
stopOpacity: import_tokens36.opacities.opacityDisabled
|
|
15353
15553
|
}
|
|
15354
15554
|
),
|
|
15355
|
-
/* @__PURE__ */ (0,
|
|
15555
|
+
/* @__PURE__ */ (0, import_jsx_runtime79.jsx)("stop", { offset: "100%", stopColor: stroke, stopOpacity: "0" })
|
|
15356
15556
|
] }) }),
|
|
15357
|
-
/* @__PURE__ */ (0,
|
|
15557
|
+
/* @__PURE__ */ (0, import_jsx_runtime79.jsx)(
|
|
15358
15558
|
"path",
|
|
15359
15559
|
{
|
|
15360
15560
|
"data-refineui": "chart-line-area",
|
|
@@ -15363,7 +15563,7 @@ function ChartLine({
|
|
|
15363
15563
|
}
|
|
15364
15564
|
)
|
|
15365
15565
|
] }) : null,
|
|
15366
|
-
/* @__PURE__ */ (0,
|
|
15566
|
+
/* @__PURE__ */ (0, import_jsx_runtime79.jsx)(
|
|
15367
15567
|
"path",
|
|
15368
15568
|
{
|
|
15369
15569
|
"data-refineui": "chart-line-stroke",
|
|
@@ -15381,7 +15581,7 @@ function ChartLine({
|
|
|
15381
15581
|
const state = itemState(index, hoverIndex, selectedIndex);
|
|
15382
15582
|
const visible = showPoints || state !== "default";
|
|
15383
15583
|
if (!visible) return null;
|
|
15384
|
-
return /* @__PURE__ */ (0,
|
|
15584
|
+
return /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(
|
|
15385
15585
|
"circle",
|
|
15386
15586
|
{
|
|
15387
15587
|
"data-refineui": "chart-point",
|
|
@@ -15407,10 +15607,10 @@ function ChartAxisLabels({
|
|
|
15407
15607
|
const { hoverIndex, selectedIndex, setLabels } = useChartContext("ChartAxisLabels");
|
|
15408
15608
|
const count = labels.length;
|
|
15409
15609
|
const centerAt = align === "line" ? linePointCenterRatio : barBandCenterRatio;
|
|
15410
|
-
(0,
|
|
15610
|
+
(0, import_react58.useLayoutEffect)(() => {
|
|
15411
15611
|
setLabels(labels);
|
|
15412
15612
|
}, [labels, setLabels]);
|
|
15413
|
-
return /* @__PURE__ */ (0,
|
|
15613
|
+
return /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(
|
|
15414
15614
|
"div",
|
|
15415
15615
|
{
|
|
15416
15616
|
"data-refineui": "chart-axis-labels",
|
|
@@ -15419,7 +15619,7 @@ function ChartAxisLabels({
|
|
|
15419
15619
|
...props,
|
|
15420
15620
|
children: labels.map((label, index) => {
|
|
15421
15621
|
const state = itemState(index, hoverIndex, selectedIndex);
|
|
15422
|
-
return /* @__PURE__ */ (0,
|
|
15622
|
+
return /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(
|
|
15423
15623
|
"span",
|
|
15424
15624
|
{
|
|
15425
15625
|
"data-state": state,
|
|
@@ -15437,7 +15637,7 @@ function ChartAxisLabels({
|
|
|
15437
15637
|
);
|
|
15438
15638
|
}
|
|
15439
15639
|
function ChartLegend({ className, ...props }) {
|
|
15440
|
-
return /* @__PURE__ */ (0,
|
|
15640
|
+
return /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(
|
|
15441
15641
|
"ul",
|
|
15442
15642
|
{
|
|
15443
15643
|
"data-refineui": "chart-legend",
|
|
@@ -15453,7 +15653,7 @@ function ChartLegendItem({
|
|
|
15453
15653
|
style,
|
|
15454
15654
|
...props
|
|
15455
15655
|
}) {
|
|
15456
|
-
return /* @__PURE__ */ (0,
|
|
15656
|
+
return /* @__PURE__ */ (0, import_jsx_runtime79.jsxs)(
|
|
15457
15657
|
"li",
|
|
15458
15658
|
{
|
|
15459
15659
|
"data-refineui": "chart-legend-item",
|
|
@@ -15461,7 +15661,7 @@ function ChartLegendItem({
|
|
|
15461
15661
|
className: (0, import_clsx107.clsx)(chartStyles.legendItem, className),
|
|
15462
15662
|
...props,
|
|
15463
15663
|
children: [
|
|
15464
|
-
/* @__PURE__ */ (0,
|
|
15664
|
+
/* @__PURE__ */ (0, import_jsx_runtime79.jsx)(
|
|
15465
15665
|
"span",
|
|
15466
15666
|
{
|
|
15467
15667
|
"aria-hidden": true,
|
|
@@ -15476,26 +15676,26 @@ function ChartLegendItem({
|
|
|
15476
15676
|
}
|
|
15477
15677
|
|
|
15478
15678
|
// src/components/Slot/Slot.tsx
|
|
15479
|
-
var
|
|
15679
|
+
var import_react59 = require("@refineui/utilities/react");
|
|
15480
15680
|
|
|
15481
15681
|
// src/components/Collapsible/Collapsible.tsx
|
|
15482
|
-
var
|
|
15682
|
+
var import_react61 = require("react");
|
|
15483
15683
|
var import_clsx108 = require("clsx");
|
|
15484
|
-
var
|
|
15684
|
+
var import_react62 = require("@refineui/utilities/react");
|
|
15485
15685
|
|
|
15486
15686
|
// src/components/Collapsible/context.ts
|
|
15487
|
-
var
|
|
15488
|
-
var
|
|
15687
|
+
var import_react60 = require("react");
|
|
15688
|
+
var import_tokens37 = require("@refineui/tokens");
|
|
15489
15689
|
var import_animation9 = require("@refineui/utilities/animation");
|
|
15490
|
-
var CollapsibleContext = (0,
|
|
15690
|
+
var CollapsibleContext = (0, import_react60.createContext)(null);
|
|
15491
15691
|
function useCollapsibleContext(part) {
|
|
15492
|
-
const value = (0,
|
|
15692
|
+
const value = (0, import_react60.useContext)(CollapsibleContext);
|
|
15493
15693
|
if (!value) throw new Error(`${part} must be used within Collapsible`);
|
|
15494
15694
|
return value;
|
|
15495
15695
|
}
|
|
15496
15696
|
function usePrefersReducedMotion3() {
|
|
15497
|
-
const [reduce, setReduce] = (0,
|
|
15498
|
-
(0,
|
|
15697
|
+
const [reduce, setReduce] = (0, import_react60.useState)(false);
|
|
15698
|
+
(0, import_react60.useEffect)(() => {
|
|
15499
15699
|
const mql = window.matchMedia((0, import_animation9.getReducedMotionQuery)().replace("@media ", ""));
|
|
15500
15700
|
const sync = () => setReduce(mql.matches);
|
|
15501
15701
|
sync();
|
|
@@ -15504,10 +15704,10 @@ function usePrefersReducedMotion3() {
|
|
|
15504
15704
|
}, []);
|
|
15505
15705
|
return reduce;
|
|
15506
15706
|
}
|
|
15507
|
-
var PANEL_HEIGHT_MS2 = Number.parseFloat(
|
|
15508
|
-
var PANEL_CONTENT_MS2 = Number.parseFloat(
|
|
15509
|
-
var PANEL_HEIGHT_EASE2 =
|
|
15510
|
-
var PANEL_CONTENT_EASE2 =
|
|
15707
|
+
var PANEL_HEIGHT_MS2 = Number.parseFloat(import_tokens37.semanticInteraction.duration.panel) / 1e3;
|
|
15708
|
+
var PANEL_CONTENT_MS2 = Number.parseFloat(import_tokens37.semanticInteraction.duration.normal) / 1e3;
|
|
15709
|
+
var PANEL_HEIGHT_EASE2 = import_tokens37.semanticInteraction.easing.panel;
|
|
15710
|
+
var PANEL_CONTENT_EASE2 = import_tokens37.semanticInteraction.easing.content;
|
|
15511
15711
|
|
|
15512
15712
|
// src/components/Collapsible/style.ts
|
|
15513
15713
|
var collapsibleStyles = {
|
|
@@ -15515,18 +15715,18 @@ var collapsibleStyles = {
|
|
|
15515
15715
|
};
|
|
15516
15716
|
|
|
15517
15717
|
// src/components/Collapsible/Collapsible.tsx
|
|
15518
|
-
var
|
|
15519
|
-
var Collapsible = (0,
|
|
15520
|
-
const [uncontrolled, setUncontrolled] = (0,
|
|
15718
|
+
var import_jsx_runtime80 = require("react/jsx-runtime");
|
|
15719
|
+
var Collapsible = (0, import_react61.forwardRef)(function Collapsible2({ open: openProp, defaultOpen = false, onOpenChange, asChild = false, className, children, ...props }, ref) {
|
|
15720
|
+
const [uncontrolled, setUncontrolled] = (0, import_react61.useState)(defaultOpen);
|
|
15521
15721
|
const open = openProp ?? uncontrolled;
|
|
15522
|
-
const reactId = (0,
|
|
15722
|
+
const reactId = (0, import_react61.useId)();
|
|
15523
15723
|
const reduceMotion = usePrefersReducedMotion3();
|
|
15524
|
-
const toggle = (0,
|
|
15724
|
+
const toggle = (0, import_react61.useCallback)(() => {
|
|
15525
15725
|
const next = !(openProp ?? uncontrolled);
|
|
15526
15726
|
if (openProp === void 0) setUncontrolled(next);
|
|
15527
15727
|
onOpenChange?.(next);
|
|
15528
15728
|
}, [onOpenChange, openProp, uncontrolled]);
|
|
15529
|
-
const contextValue = (0,
|
|
15729
|
+
const contextValue = (0, import_react61.useMemo)(
|
|
15530
15730
|
() => ({
|
|
15531
15731
|
open,
|
|
15532
15732
|
toggle,
|
|
@@ -15543,9 +15743,9 @@ var Collapsible = (0, import_react59.forwardRef)(function Collapsible2({ open: o
|
|
|
15543
15743
|
"data-refineui": "collapsible",
|
|
15544
15744
|
className
|
|
15545
15745
|
};
|
|
15546
|
-
return /* @__PURE__ */ (0,
|
|
15746
|
+
return /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(CollapsibleContext.Provider, { value: contextValue, children: asChild ? /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(import_react62.Slot, { ...shared, children }) : /* @__PURE__ */ (0, import_jsx_runtime80.jsx)("div", { ...shared, children }) });
|
|
15547
15747
|
});
|
|
15548
|
-
var CollapsibleTrigger = (0,
|
|
15748
|
+
var CollapsibleTrigger = (0, import_react61.forwardRef)(
|
|
15549
15749
|
function CollapsibleTrigger2({
|
|
15550
15750
|
asChild = false,
|
|
15551
15751
|
onClick,
|
|
@@ -15572,8 +15772,8 @@ var CollapsibleTrigger = (0, import_react59.forwardRef)(
|
|
|
15572
15772
|
if (!event.defaultPrevented) toggle();
|
|
15573
15773
|
}
|
|
15574
15774
|
};
|
|
15575
|
-
if (asChild) return /* @__PURE__ */ (0,
|
|
15576
|
-
return /* @__PURE__ */ (0,
|
|
15775
|
+
if (asChild) return /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(import_react62.Slot, { ...shared, children });
|
|
15776
|
+
return /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
|
|
15577
15777
|
Button,
|
|
15578
15778
|
{
|
|
15579
15779
|
...shared,
|
|
@@ -15587,7 +15787,7 @@ var CollapsibleTrigger = (0, import_react59.forwardRef)(
|
|
|
15587
15787
|
);
|
|
15588
15788
|
}
|
|
15589
15789
|
);
|
|
15590
|
-
var CollapsibleContent = (0,
|
|
15790
|
+
var CollapsibleContent = (0, import_react61.forwardRef)(
|
|
15591
15791
|
function CollapsibleContent2({ className, children, style, ...props }, ref) {
|
|
15592
15792
|
const { open, contentId, triggerId, reduceMotion } = useCollapsibleContext("CollapsibleContent");
|
|
15593
15793
|
const gridStyle = {
|
|
@@ -15602,7 +15802,7 @@ var CollapsibleContent = (0, import_react59.forwardRef)(
|
|
|
15602
15802
|
pointerEvents: open ? void 0 : "none",
|
|
15603
15803
|
...style
|
|
15604
15804
|
};
|
|
15605
|
-
return /* @__PURE__ */ (0,
|
|
15805
|
+
return /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
|
|
15606
15806
|
"div",
|
|
15607
15807
|
{
|
|
15608
15808
|
...props,
|
|
@@ -15614,26 +15814,26 @@ var CollapsibleContent = (0, import_react59.forwardRef)(
|
|
|
15614
15814
|
"data-state": open ? "open" : "closed",
|
|
15615
15815
|
"data-refineui": "collapsible-content",
|
|
15616
15816
|
style: gridStyle,
|
|
15617
|
-
children: /* @__PURE__ */ (0,
|
|
15817
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime80.jsx)("div", { className: collapsibleStyles.panelOuter, children: /* @__PURE__ */ (0, import_jsx_runtime80.jsx)("div", { className: (0, import_clsx108.clsx)(className), style: innerMotionStyle, children }) })
|
|
15618
15818
|
}
|
|
15619
15819
|
);
|
|
15620
15820
|
}
|
|
15621
15821
|
);
|
|
15622
15822
|
|
|
15623
15823
|
// src/components/ContextMenu/ContextMenu.tsx
|
|
15624
|
-
var
|
|
15625
|
-
var
|
|
15824
|
+
var import_react63 = require("react");
|
|
15825
|
+
var import_react_dom8 = require("react-dom");
|
|
15626
15826
|
var import_clsx109 = require("clsx");
|
|
15627
|
-
var
|
|
15827
|
+
var import_tokens38 = require("@refineui/tokens");
|
|
15628
15828
|
var import_animation10 = require("@refineui/utilities/animation");
|
|
15629
|
-
var
|
|
15630
|
-
var
|
|
15829
|
+
var import_react64 = require("@refineui/utilities/react");
|
|
15830
|
+
var import_jsx_runtime81 = require("react/jsx-runtime");
|
|
15631
15831
|
var MENU_ATTR = "data-refineui-context-menu";
|
|
15632
|
-
var CLOSE_MS = (0, import_animation10.motionMsToNumber)(
|
|
15633
|
-
var MenuContext2 = (0,
|
|
15634
|
-
var SubContext = (0,
|
|
15832
|
+
var CLOSE_MS = (0, import_animation10.motionMsToNumber)(import_tokens38.semanticInteraction.duration.normal);
|
|
15833
|
+
var MenuContext2 = (0, import_react63.createContext)(null);
|
|
15834
|
+
var SubContext = (0, import_react63.createContext)(null);
|
|
15635
15835
|
function useMenu() {
|
|
15636
|
-
const value = (0,
|
|
15836
|
+
const value = (0, import_react63.useContext)(MenuContext2);
|
|
15637
15837
|
if (!value) throw new Error("Context menu parts must be used within ContextMenu");
|
|
15638
15838
|
return value;
|
|
15639
15839
|
}
|
|
@@ -15650,29 +15850,29 @@ function placeInView(element, x, y) {
|
|
|
15650
15850
|
}
|
|
15651
15851
|
function ContextMenu({ modal = true, onOpenChange, children }) {
|
|
15652
15852
|
void modal;
|
|
15653
|
-
const [open, setOpen] = (0,
|
|
15654
|
-
const [point, setPoint] = (0,
|
|
15655
|
-
const openRef = (0,
|
|
15656
|
-
const onOpenChangeRef = (0,
|
|
15853
|
+
const [open, setOpen] = (0, import_react63.useState)(false);
|
|
15854
|
+
const [point, setPoint] = (0, import_react63.useState)({ x: 0, y: 0 });
|
|
15855
|
+
const openRef = (0, import_react63.useRef)(false);
|
|
15856
|
+
const onOpenChangeRef = (0, import_react63.useRef)(onOpenChange);
|
|
15657
15857
|
openRef.current = open;
|
|
15658
15858
|
onOpenChangeRef.current = onOpenChange;
|
|
15659
|
-
const close = (0,
|
|
15859
|
+
const close = (0, import_react63.useCallback)(() => {
|
|
15660
15860
|
if (!openRef.current) return;
|
|
15661
15861
|
openRef.current = false;
|
|
15662
15862
|
setOpen(false);
|
|
15663
15863
|
onOpenChangeRef.current?.(false);
|
|
15664
15864
|
}, []);
|
|
15665
|
-
const openAt = (0,
|
|
15865
|
+
const openAt = (0, import_react63.useCallback)((x, y) => {
|
|
15666
15866
|
setPoint({ x, y });
|
|
15667
15867
|
const wasOpen = openRef.current;
|
|
15668
15868
|
openRef.current = true;
|
|
15669
15869
|
setOpen(true);
|
|
15670
15870
|
if (!wasOpen) onOpenChangeRef.current?.(true);
|
|
15671
15871
|
}, []);
|
|
15672
|
-
const value = (0,
|
|
15673
|
-
return /* @__PURE__ */ (0,
|
|
15872
|
+
const value = (0, import_react63.useMemo)(() => ({ open, point, openAt, close }), [open, point, openAt, close]);
|
|
15873
|
+
return /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(MenuContext2.Provider, { value, children });
|
|
15674
15874
|
}
|
|
15675
|
-
var ContextMenuTrigger = (0,
|
|
15875
|
+
var ContextMenuTrigger = (0, import_react63.forwardRef)(function ContextMenuTrigger2({ asChild = false, onContextMenu, children, ...props }, ref) {
|
|
15676
15876
|
const { openAt } = useMenu();
|
|
15677
15877
|
const shared = {
|
|
15678
15878
|
...props,
|
|
@@ -15685,18 +15885,18 @@ var ContextMenuTrigger = (0, import_react61.forwardRef)(function ContextMenuTrig
|
|
|
15685
15885
|
openAt(event.clientX, event.clientY);
|
|
15686
15886
|
}
|
|
15687
15887
|
};
|
|
15688
|
-
if (asChild) return /* @__PURE__ */ (0,
|
|
15689
|
-
return /* @__PURE__ */ (0,
|
|
15888
|
+
if (asChild) return /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(import_react64.Slot, { ...shared, children });
|
|
15889
|
+
return /* @__PURE__ */ (0, import_jsx_runtime81.jsx)("span", { ...shared, className: (0, import_clsx109.clsx)(menuStyles.triggerFallback, props.className), children });
|
|
15690
15890
|
});
|
|
15691
15891
|
function ContextMenuPortal({ children }) {
|
|
15692
|
-
return /* @__PURE__ */ (0,
|
|
15892
|
+
return /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(import_jsx_runtime81.Fragment, { children });
|
|
15693
15893
|
}
|
|
15694
|
-
var ContextMenuContent = (0,
|
|
15894
|
+
var ContextMenuContent = (0, import_react63.forwardRef)(function ContextMenuContent2({ className, style, onPointerDown, children, ...props }, ref) {
|
|
15695
15895
|
const { open, point, close } = useMenu();
|
|
15696
|
-
const localRef = (0,
|
|
15697
|
-
const [shouldRender, setShouldRender] = (0,
|
|
15698
|
-
const [isClosing, setIsClosing] = (0,
|
|
15699
|
-
(0,
|
|
15896
|
+
const localRef = (0, import_react63.useRef)(null);
|
|
15897
|
+
const [shouldRender, setShouldRender] = (0, import_react63.useState)(open);
|
|
15898
|
+
const [isClosing, setIsClosing] = (0, import_react63.useState)(false);
|
|
15899
|
+
(0, import_react63.useEffect)(() => {
|
|
15700
15900
|
if (open) {
|
|
15701
15901
|
setShouldRender(true);
|
|
15702
15902
|
setIsClosing(false);
|
|
@@ -15710,11 +15910,11 @@ var ContextMenuContent = (0, import_react61.forwardRef)(function ContextMenuCont
|
|
|
15710
15910
|
}, CLOSE_MS);
|
|
15711
15911
|
return () => window.clearTimeout(timeout);
|
|
15712
15912
|
}, [open, shouldRender]);
|
|
15713
|
-
(0,
|
|
15913
|
+
(0, import_react63.useLayoutEffect)(() => {
|
|
15714
15914
|
if (!shouldRender || !localRef.current) return;
|
|
15715
15915
|
placeInView(localRef.current, point.x, point.y);
|
|
15716
15916
|
}, [shouldRender, point.x, point.y]);
|
|
15717
|
-
(0,
|
|
15917
|
+
(0, import_react63.useEffect)(() => {
|
|
15718
15918
|
if (!open) return;
|
|
15719
15919
|
const onKey = (event) => {
|
|
15720
15920
|
if (event.key === "Escape") close();
|
|
@@ -15732,8 +15932,8 @@ var ContextMenuContent = (0, import_react61.forwardRef)(function ContextMenuCont
|
|
|
15732
15932
|
};
|
|
15733
15933
|
}, [open, close]);
|
|
15734
15934
|
if (!shouldRender || typeof document === "undefined") return null;
|
|
15735
|
-
return (0,
|
|
15736
|
-
/* @__PURE__ */ (0,
|
|
15935
|
+
return (0, import_react_dom8.createPortal)(
|
|
15936
|
+
/* @__PURE__ */ (0, import_jsx_runtime81.jsx)(
|
|
15737
15937
|
"div",
|
|
15738
15938
|
{
|
|
15739
15939
|
...props,
|
|
@@ -15750,8 +15950,8 @@ var ContextMenuContent = (0, import_react61.forwardRef)(function ContextMenuCont
|
|
|
15750
15950
|
position: "fixed",
|
|
15751
15951
|
top: point.y,
|
|
15752
15952
|
left: point.x,
|
|
15753
|
-
width:
|
|
15754
|
-
minWidth:
|
|
15953
|
+
width: import_tokens38.componentSizes.menuPanelWidth,
|
|
15954
|
+
minWidth: import_tokens38.componentSizes.menuPanelWidth,
|
|
15755
15955
|
zIndex: 9999,
|
|
15756
15956
|
...style
|
|
15757
15957
|
},
|
|
@@ -15760,7 +15960,7 @@ var ContextMenuContent = (0, import_react61.forwardRef)(function ContextMenuCont
|
|
|
15760
15960
|
onPointerDown?.(event);
|
|
15761
15961
|
},
|
|
15762
15962
|
onContextMenu: (event) => event.preventDefault(),
|
|
15763
|
-
children: /* @__PURE__ */ (0,
|
|
15963
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime81.jsx)("div", { role: "menu", "data-refineui": "menu", className: (0, import_clsx109.clsx)(menuStyles.list, className), children })
|
|
15764
15964
|
}
|
|
15765
15965
|
),
|
|
15766
15966
|
document.body
|
|
@@ -15777,11 +15977,11 @@ function runSelect(onSelect, close, disabled) {
|
|
|
15777
15977
|
onSelect?.(selectEvent);
|
|
15778
15978
|
if (!selectEvent.defaultPrevented) close();
|
|
15779
15979
|
}
|
|
15780
|
-
var ContextMenuItem = (0,
|
|
15980
|
+
var ContextMenuItem = (0, import_react63.forwardRef)(function ContextMenuItem2({ disabled = false, description, shortcut, startIcon, endIcon, state = "default", onSelect, className, onClick, onKeyDown, children, ...props }, ref) {
|
|
15781
15981
|
const { close } = useMenu();
|
|
15782
15982
|
const isDisabled = disabled || state === "disabled";
|
|
15783
15983
|
const slotted = startIcon != null || description != null || shortcut != null || endIcon != null;
|
|
15784
|
-
return /* @__PURE__ */ (0,
|
|
15984
|
+
return /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(
|
|
15785
15985
|
"button",
|
|
15786
15986
|
{
|
|
15787
15987
|
ref,
|
|
@@ -15807,37 +16007,37 @@ var ContextMenuItem = (0, import_react61.forwardRef)(function ContextMenuItem2({
|
|
|
15807
16007
|
runSelect(onSelect, close, isDisabled);
|
|
15808
16008
|
}
|
|
15809
16009
|
},
|
|
15810
|
-
children: slotted ? /* @__PURE__ */ (0,
|
|
15811
|
-
startIcon ? /* @__PURE__ */ (0,
|
|
16010
|
+
children: slotted ? /* @__PURE__ */ (0, import_jsx_runtime81.jsxs)("span", { className: menuStyles.row, children: [
|
|
16011
|
+
startIcon ? /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(
|
|
15812
16012
|
"span",
|
|
15813
16013
|
{
|
|
15814
16014
|
className: menuStyles.iconWrap,
|
|
15815
|
-
style: { width:
|
|
16015
|
+
style: { width: import_tokens38.iconSizes.small, minWidth: import_tokens38.iconSizes.small, height: import_tokens38.iconSizes.small },
|
|
15816
16016
|
children: startIcon
|
|
15817
16017
|
}
|
|
15818
16018
|
) : null,
|
|
15819
|
-
/* @__PURE__ */ (0,
|
|
15820
|
-
/* @__PURE__ */ (0,
|
|
15821
|
-
description ? /* @__PURE__ */ (0,
|
|
16019
|
+
/* @__PURE__ */ (0, import_jsx_runtime81.jsxs)("span", { className: menuStyles.textCol, children: [
|
|
16020
|
+
/* @__PURE__ */ (0, import_jsx_runtime81.jsx)("span", { className: menuStyles.title, children }),
|
|
16021
|
+
description ? /* @__PURE__ */ (0, import_jsx_runtime81.jsx)("span", { className: (0, import_clsx109.clsx)(menuStyles.description, isDisabled ? menuStyles.descriptionDisabled : menuStyles.descriptionEnabled), children: description }) : null
|
|
15822
16022
|
] }),
|
|
15823
|
-
(shortcut || endIcon) && /* @__PURE__ */ (0,
|
|
15824
|
-
shortcut ? /* @__PURE__ */ (0,
|
|
15825
|
-
endIcon ? /* @__PURE__ */ (0,
|
|
16023
|
+
(shortcut || endIcon) && /* @__PURE__ */ (0, import_jsx_runtime81.jsxs)("span", { className: menuStyles.rightWrap, children: [
|
|
16024
|
+
shortcut ? /* @__PURE__ */ (0, import_jsx_runtime81.jsx)("span", { className: menuStyles.shortcut, children: shortcut }) : null,
|
|
16025
|
+
endIcon ? /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(
|
|
15826
16026
|
"span",
|
|
15827
16027
|
{
|
|
15828
16028
|
className: menuStyles.iconWrap,
|
|
15829
|
-
style: { width:
|
|
16029
|
+
style: { width: import_tokens38.iconSizes.small, minWidth: import_tokens38.iconSizes.small, height: import_tokens38.iconSizes.small },
|
|
15830
16030
|
children: endIcon
|
|
15831
16031
|
}
|
|
15832
16032
|
) : null
|
|
15833
16033
|
] })
|
|
15834
|
-
] }) : /* @__PURE__ */ (0,
|
|
16034
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime81.jsx)("span", { className: menuStyles.row, children })
|
|
15835
16035
|
}
|
|
15836
16036
|
);
|
|
15837
16037
|
});
|
|
15838
|
-
var ContextMenuSeparator = (0,
|
|
16038
|
+
var ContextMenuSeparator = (0, import_react63.forwardRef)(
|
|
15839
16039
|
function ContextMenuSeparator2({ className, ...props }, ref) {
|
|
15840
|
-
return /* @__PURE__ */ (0,
|
|
16040
|
+
return /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(
|
|
15841
16041
|
"div",
|
|
15842
16042
|
{
|
|
15843
16043
|
ref,
|
|
@@ -15847,24 +16047,24 @@ var ContextMenuSeparator = (0, import_react61.forwardRef)(
|
|
|
15847
16047
|
...{ [MENU_ATTR]: "" },
|
|
15848
16048
|
className: (0, import_clsx109.clsx)(menuStyles.dividerWrap, className),
|
|
15849
16049
|
...props,
|
|
15850
|
-
children: /* @__PURE__ */ (0,
|
|
16050
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime81.jsx)("div", { className: menuStyles.dividerLine })
|
|
15851
16051
|
}
|
|
15852
16052
|
);
|
|
15853
16053
|
}
|
|
15854
16054
|
);
|
|
15855
16055
|
function ContextMenuLabel({ className, children, ...props }) {
|
|
15856
|
-
return /* @__PURE__ */ (0,
|
|
16056
|
+
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 }) });
|
|
15857
16057
|
}
|
|
15858
16058
|
function ContextMenuSub({ children }) {
|
|
15859
|
-
const [open, setOpen] = (0,
|
|
15860
|
-
const triggerRef = (0,
|
|
15861
|
-
const timer = (0,
|
|
16059
|
+
const [open, setOpen] = (0, import_react63.useState)(false);
|
|
16060
|
+
const triggerRef = (0, import_react63.useRef)(null);
|
|
16061
|
+
const timer = (0, import_react63.useRef)(null);
|
|
15862
16062
|
const clear = () => {
|
|
15863
16063
|
if (timer.current != null) window.clearTimeout(timer.current);
|
|
15864
16064
|
timer.current = null;
|
|
15865
16065
|
};
|
|
15866
|
-
(0,
|
|
15867
|
-
const value = (0,
|
|
16066
|
+
(0, import_react63.useEffect)(() => clear, []);
|
|
16067
|
+
const value = (0, import_react63.useMemo)(
|
|
15868
16068
|
() => ({
|
|
15869
16069
|
open,
|
|
15870
16070
|
triggerRef,
|
|
@@ -15879,14 +16079,14 @@ function ContextMenuSub({ children }) {
|
|
|
15879
16079
|
}),
|
|
15880
16080
|
[open]
|
|
15881
16081
|
);
|
|
15882
|
-
return /* @__PURE__ */ (0,
|
|
16082
|
+
return /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(SubContext.Provider, { value, children });
|
|
15883
16083
|
}
|
|
15884
16084
|
function useSub2() {
|
|
15885
|
-
const value = (0,
|
|
16085
|
+
const value = (0, import_react63.useContext)(SubContext);
|
|
15886
16086
|
if (!value) throw new Error("ContextMenuSubTrigger must be used within ContextMenuSub");
|
|
15887
16087
|
return value;
|
|
15888
16088
|
}
|
|
15889
|
-
var ContextMenuSubTrigger = (0,
|
|
16089
|
+
var ContextMenuSubTrigger = (0, import_react63.forwardRef)(
|
|
15890
16090
|
function ContextMenuSubTrigger2({ asChild = false, description, startIcon, onMouseEnter, onMouseLeave, onClick, className, children, ...props }, ref) {
|
|
15891
16091
|
const sub = useSub2();
|
|
15892
16092
|
const shared = {
|
|
@@ -15922,37 +16122,37 @@ var ContextMenuSubTrigger = (0, import_react61.forwardRef)(
|
|
|
15922
16122
|
if (!event.defaultPrevented) sub.show();
|
|
15923
16123
|
}
|
|
15924
16124
|
};
|
|
15925
|
-
if (asChild) return /* @__PURE__ */ (0,
|
|
15926
|
-
return /* @__PURE__ */ (0,
|
|
15927
|
-
startIcon ? /* @__PURE__ */ (0,
|
|
16125
|
+
if (asChild) return /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(import_react64.Slot, { ...shared, children });
|
|
16126
|
+
return /* @__PURE__ */ (0, import_jsx_runtime81.jsx)("button", { ...shared, children: /* @__PURE__ */ (0, import_jsx_runtime81.jsxs)("span", { className: menuStyles.row, children: [
|
|
16127
|
+
startIcon ? /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(
|
|
15928
16128
|
"span",
|
|
15929
16129
|
{
|
|
15930
16130
|
className: menuStyles.iconWrap,
|
|
15931
|
-
style: { width:
|
|
16131
|
+
style: { width: import_tokens38.iconSizes.small, minWidth: import_tokens38.iconSizes.small, height: import_tokens38.iconSizes.small },
|
|
15932
16132
|
children: startIcon
|
|
15933
16133
|
}
|
|
15934
16134
|
) : null,
|
|
15935
|
-
/* @__PURE__ */ (0,
|
|
15936
|
-
/* @__PURE__ */ (0,
|
|
15937
|
-
description ? /* @__PURE__ */ (0,
|
|
16135
|
+
/* @__PURE__ */ (0, import_jsx_runtime81.jsxs)("span", { className: menuStyles.textCol, children: [
|
|
16136
|
+
/* @__PURE__ */ (0, import_jsx_runtime81.jsx)("span", { className: menuStyles.title, children }),
|
|
16137
|
+
description ? /* @__PURE__ */ (0, import_jsx_runtime81.jsx)("span", { className: (0, import_clsx109.clsx)(menuStyles.description, menuStyles.descriptionEnabled), children: description }) : null
|
|
15938
16138
|
] }),
|
|
15939
|
-
/* @__PURE__ */ (0,
|
|
16139
|
+
/* @__PURE__ */ (0, import_jsx_runtime81.jsx)("span", { className: menuStyles.rightWrap, children: /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(
|
|
15940
16140
|
"span",
|
|
15941
16141
|
{
|
|
15942
16142
|
className: menuStyles.iconWrap,
|
|
15943
|
-
style: { width:
|
|
15944
|
-
children: /* @__PURE__ */ (0,
|
|
16143
|
+
style: { width: import_tokens38.iconSizes.small, minWidth: import_tokens38.iconSizes.small, height: import_tokens38.iconSizes.small },
|
|
16144
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(WebIcon, { name: "chevron-right", size: import_tokens38.iconSizes.small, color: "currentColor", "aria-hidden": true })
|
|
15945
16145
|
}
|
|
15946
16146
|
) })
|
|
15947
16147
|
] }) });
|
|
15948
16148
|
}
|
|
15949
16149
|
);
|
|
15950
|
-
var ContextMenuSubContent = (0,
|
|
16150
|
+
var ContextMenuSubContent = (0, import_react63.forwardRef)(
|
|
15951
16151
|
function ContextMenuSubContent2({ className, style, onPointerDown, onMouseEnter, onMouseLeave, ...props }, ref) {
|
|
15952
16152
|
const sub = useSub2();
|
|
15953
|
-
const localRef = (0,
|
|
15954
|
-
const [side, setSide] = (0,
|
|
15955
|
-
(0,
|
|
16153
|
+
const localRef = (0, import_react63.useRef)(null);
|
|
16154
|
+
const [side, setSide] = (0, import_react63.useState)("right");
|
|
16155
|
+
(0, import_react63.useLayoutEffect)(() => {
|
|
15956
16156
|
const trigger = sub.triggerRef.current;
|
|
15957
16157
|
const element = localRef.current;
|
|
15958
16158
|
if (!sub.open || !trigger || !element) return;
|
|
@@ -15969,8 +16169,8 @@ var ContextMenuSubContent = (0, import_react61.forwardRef)(
|
|
|
15969
16169
|
placeInView(element, left, rect.top);
|
|
15970
16170
|
}, [sub.open, sub.triggerRef]);
|
|
15971
16171
|
if (!sub.open || typeof document === "undefined") return null;
|
|
15972
|
-
return (0,
|
|
15973
|
-
/* @__PURE__ */ (0,
|
|
16172
|
+
return (0, import_react_dom8.createPortal)(
|
|
16173
|
+
/* @__PURE__ */ (0, import_jsx_runtime81.jsx)(
|
|
15974
16174
|
"div",
|
|
15975
16175
|
{
|
|
15976
16176
|
...props,
|
|
@@ -16238,6 +16438,8 @@ var ContextMenuSubContent = (0, import_react61.forwardRef)(
|
|
|
16238
16438
|
SidebarPeekInset,
|
|
16239
16439
|
SidebarPeekPanel,
|
|
16240
16440
|
SidebarPeekPin,
|
|
16441
|
+
SidebarProvider,
|
|
16442
|
+
SidebarTrigger,
|
|
16241
16443
|
Skeleton,
|
|
16242
16444
|
Slider,
|
|
16243
16445
|
Slot,
|
|
@@ -16295,6 +16497,7 @@ var ContextMenuSubContent = (0, import_react61.forwardRef)(
|
|
|
16295
16497
|
semanticTextClass,
|
|
16296
16498
|
sizedComponentTextClass,
|
|
16297
16499
|
toast,
|
|
16500
|
+
useSidebar,
|
|
16298
16501
|
useSidebarPeek
|
|
16299
16502
|
});
|
|
16300
16503
|
//# sourceMappingURL=index.cjs.map
|