@refineui/react 0.0.9 → 0.0.10
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 +500 -416
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +33 -22
- package/dist/index.d.ts +33 -22
- package/dist/index.js +447 -358
- 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 +71 -89
- package/dist/spec/token-trace-v2.json +29 -44
- package/package.json +1 -1
- package/refineui.css +2 -4
- package/spec/components/sidebar.json +3 -1
package/dist/index.cjs
CHANGED
|
@@ -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: {
|
|
@@ -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
|
{
|
|
@@ -11209,6 +11215,81 @@ function useSidebarPeek() {
|
|
|
11209
11215
|
return useSidebarPeekContext("useSidebarPeek");
|
|
11210
11216
|
}
|
|
11211
11217
|
|
|
11218
|
+
// src/components/Sidebar/SidebarProvider.tsx
|
|
11219
|
+
var import_react40 = require("react");
|
|
11220
|
+
var import_react41 = require("@refineui/utilities/react");
|
|
11221
|
+
var import_jsx_runtime62 = require("react/jsx-runtime");
|
|
11222
|
+
var SidebarContext = (0, import_react40.createContext)(null);
|
|
11223
|
+
function useSidebarContext(component) {
|
|
11224
|
+
const value = (0, import_react40.useContext)(SidebarContext);
|
|
11225
|
+
if (!value) throw new Error(`${component} must be used within <SidebarProvider>.`);
|
|
11226
|
+
return value;
|
|
11227
|
+
}
|
|
11228
|
+
function useSidebar() {
|
|
11229
|
+
return useSidebarContext("useSidebar");
|
|
11230
|
+
}
|
|
11231
|
+
function SidebarProvider({
|
|
11232
|
+
open: openProp,
|
|
11233
|
+
defaultOpen = true,
|
|
11234
|
+
onOpenChange,
|
|
11235
|
+
id,
|
|
11236
|
+
children
|
|
11237
|
+
}) {
|
|
11238
|
+
const [uncontrolled, setUncontrolled] = (0, import_react40.useState)(defaultOpen);
|
|
11239
|
+
const open = openProp ?? uncontrolled;
|
|
11240
|
+
const generatedId = (0, import_react40.useId)();
|
|
11241
|
+
const sidebarId = id ?? generatedId;
|
|
11242
|
+
const toggle = (0, import_react40.useCallback)(() => {
|
|
11243
|
+
const next = !open;
|
|
11244
|
+
if (openProp === void 0) setUncontrolled(next);
|
|
11245
|
+
onOpenChange?.(next);
|
|
11246
|
+
}, [onOpenChange, open, openProp]);
|
|
11247
|
+
const value = (0, import_react40.useMemo)(
|
|
11248
|
+
() => ({ open, sidebarId, toggle }),
|
|
11249
|
+
[open, sidebarId, toggle]
|
|
11250
|
+
);
|
|
11251
|
+
return /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(SidebarContext.Provider, { value, children });
|
|
11252
|
+
}
|
|
11253
|
+
var SidebarTrigger = (0, import_react40.forwardRef)(function SidebarTrigger2({
|
|
11254
|
+
asChild = false,
|
|
11255
|
+
onClick,
|
|
11256
|
+
className,
|
|
11257
|
+
children,
|
|
11258
|
+
variant = "secondary",
|
|
11259
|
+
size,
|
|
11260
|
+
layout,
|
|
11261
|
+
fullWidth,
|
|
11262
|
+
type = "button",
|
|
11263
|
+
...props
|
|
11264
|
+
}, ref) {
|
|
11265
|
+
const { open, toggle, sidebarId } = useSidebarContext("SidebarTrigger");
|
|
11266
|
+
const shared = {
|
|
11267
|
+
...props,
|
|
11268
|
+
ref,
|
|
11269
|
+
"aria-expanded": open,
|
|
11270
|
+
"aria-controls": sidebarId,
|
|
11271
|
+
"data-state": open ? "open" : "closed",
|
|
11272
|
+
className,
|
|
11273
|
+
onClick: (event) => {
|
|
11274
|
+
onClick?.(event);
|
|
11275
|
+
if (!event.defaultPrevented) toggle();
|
|
11276
|
+
}
|
|
11277
|
+
};
|
|
11278
|
+
if (asChild) return /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(import_react41.Slot, { ...shared, children });
|
|
11279
|
+
return /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
|
|
11280
|
+
Button,
|
|
11281
|
+
{
|
|
11282
|
+
...shared,
|
|
11283
|
+
type,
|
|
11284
|
+
variant,
|
|
11285
|
+
size,
|
|
11286
|
+
layout,
|
|
11287
|
+
fullWidth,
|
|
11288
|
+
children
|
|
11289
|
+
}
|
|
11290
|
+
);
|
|
11291
|
+
});
|
|
11292
|
+
|
|
11212
11293
|
// src/components/Pagination/Pagination.tsx
|
|
11213
11294
|
var import_clsx84 = require("clsx");
|
|
11214
11295
|
var import_tokens25 = require("@refineui/tokens");
|
|
@@ -11229,18 +11310,18 @@ var paginationStyles = {
|
|
|
11229
11310
|
};
|
|
11230
11311
|
|
|
11231
11312
|
// src/components/Pagination/Pagination.tsx
|
|
11232
|
-
var
|
|
11313
|
+
var import_jsx_runtime63 = require("react/jsx-runtime");
|
|
11233
11314
|
function PaginationRoot({ className, ...props }) {
|
|
11234
|
-
return /* @__PURE__ */ (0,
|
|
11315
|
+
return /* @__PURE__ */ (0, import_jsx_runtime63.jsx)("nav", { "aria-label": "Pagination", className: (0, import_clsx84.clsx)(paginationStyles.root, className), ...props });
|
|
11235
11316
|
}
|
|
11236
11317
|
function PaginationContent({ className, ...props }) {
|
|
11237
|
-
return /* @__PURE__ */ (0,
|
|
11318
|
+
return /* @__PURE__ */ (0, import_jsx_runtime63.jsx)("ul", { className: (0, import_clsx84.clsx)(paginationStyles.listWrap, className), ...props });
|
|
11238
11319
|
}
|
|
11239
11320
|
function PaginationItem({ className, ...props }) {
|
|
11240
|
-
return /* @__PURE__ */ (0,
|
|
11321
|
+
return /* @__PURE__ */ (0, import_jsx_runtime63.jsx)("li", { className, ...props });
|
|
11241
11322
|
}
|
|
11242
11323
|
function PaginationLink({ className, isActive, ...props }) {
|
|
11243
|
-
return /* @__PURE__ */ (0,
|
|
11324
|
+
return /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
|
|
11244
11325
|
"a",
|
|
11245
11326
|
{
|
|
11246
11327
|
"data-refineui": "pagination",
|
|
@@ -11260,7 +11341,7 @@ function PaginationNavButton({
|
|
|
11260
11341
|
}) {
|
|
11261
11342
|
const isPrev = direction === "prev";
|
|
11262
11343
|
const iconColor = disabled ? (0, import_color10.resolveColorTokenValue)(componentColorTokens.pagination.navIcon.disabled) : (0, import_color10.resolveColorTokenValue)(componentColorTokens.pagination.navIcon.default);
|
|
11263
|
-
return /* @__PURE__ */ (0,
|
|
11344
|
+
return /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
|
|
11264
11345
|
"button",
|
|
11265
11346
|
{
|
|
11266
11347
|
type: "button",
|
|
@@ -11270,7 +11351,7 @@ function PaginationNavButton({
|
|
|
11270
11351
|
"aria-label": isPrev ? "Previous page" : "Next page",
|
|
11271
11352
|
className: (0, import_clsx84.clsx)(paginationStyles.itemShell, paginationStyles.nav, className),
|
|
11272
11353
|
...props,
|
|
11273
|
-
children: /* @__PURE__ */ (0,
|
|
11354
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
|
|
11274
11355
|
WebIcon,
|
|
11275
11356
|
{
|
|
11276
11357
|
name: isPrev ? "chevron-left" : "chevron-right",
|
|
@@ -11283,13 +11364,13 @@ function PaginationNavButton({
|
|
|
11283
11364
|
);
|
|
11284
11365
|
}
|
|
11285
11366
|
function PaginationPrevious(props) {
|
|
11286
|
-
return /* @__PURE__ */ (0,
|
|
11367
|
+
return /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(PaginationNavButton, { direction: "prev", ...props });
|
|
11287
11368
|
}
|
|
11288
11369
|
function PaginationNext(props) {
|
|
11289
|
-
return /* @__PURE__ */ (0,
|
|
11370
|
+
return /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(PaginationNavButton, { direction: "next", ...props });
|
|
11290
11371
|
}
|
|
11291
11372
|
function PaginationEllipsis({ className, ...props }) {
|
|
11292
|
-
return /* @__PURE__ */ (0,
|
|
11373
|
+
return /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
|
|
11293
11374
|
"span",
|
|
11294
11375
|
{
|
|
11295
11376
|
"aria-hidden": true,
|
|
@@ -11297,7 +11378,7 @@ function PaginationEllipsis({ className, ...props }) {
|
|
|
11297
11378
|
"data-ellipsis": "true",
|
|
11298
11379
|
className: (0, import_clsx84.clsx)(paginationStyles.itemShell, paginationStyles.ellipsis, className),
|
|
11299
11380
|
...props,
|
|
11300
|
-
children: /* @__PURE__ */ (0,
|
|
11381
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
|
|
11301
11382
|
WebIcon,
|
|
11302
11383
|
{
|
|
11303
11384
|
name: "more-horizontal",
|
|
@@ -11310,15 +11391,15 @@ function PaginationEllipsis({ className, ...props }) {
|
|
|
11310
11391
|
);
|
|
11311
11392
|
}
|
|
11312
11393
|
function Pagination(props) {
|
|
11313
|
-
return /* @__PURE__ */ (0,
|
|
11394
|
+
return /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(PaginationRoot, { ...props });
|
|
11314
11395
|
}
|
|
11315
11396
|
|
|
11316
11397
|
// src/components/PopOver/PopOver.tsx
|
|
11317
11398
|
var import_clsx85 = require("clsx");
|
|
11318
|
-
var
|
|
11399
|
+
var import_react42 = require("react");
|
|
11319
11400
|
var import_tokens26 = require("@refineui/tokens");
|
|
11320
11401
|
var import_color11 = require("@refineui/utilities/color");
|
|
11321
|
-
var
|
|
11402
|
+
var import_react43 = require("@refineui/utilities/react");
|
|
11322
11403
|
|
|
11323
11404
|
// src/components/PopOver/style.ts
|
|
11324
11405
|
var popoverStyles = {
|
|
@@ -11352,10 +11433,10 @@ function popoverFloatingClasses(placement, align) {
|
|
|
11352
11433
|
}
|
|
11353
11434
|
|
|
11354
11435
|
// src/components/PopOver/PopOver.tsx
|
|
11355
|
-
var
|
|
11356
|
-
var PopoverContext = (0,
|
|
11436
|
+
var import_jsx_runtime64 = require("react/jsx-runtime");
|
|
11437
|
+
var PopoverContext = (0, import_react42.createContext)(null);
|
|
11357
11438
|
function usePopoverContext(component) {
|
|
11358
|
-
const ctx = (0,
|
|
11439
|
+
const ctx = (0, import_react42.useContext)(PopoverContext);
|
|
11359
11440
|
if (!ctx) throw new Error(`${component} must be used within <Popover>`);
|
|
11360
11441
|
return ctx;
|
|
11361
11442
|
}
|
|
@@ -11411,35 +11492,35 @@ function floatingGapStyle(placement) {
|
|
|
11411
11492
|
return { marginLeft: POPOVER_GAP };
|
|
11412
11493
|
}
|
|
11413
11494
|
function Popover({ children, className, open: openProp, defaultOpen = false, onOpenChange, ...props }) {
|
|
11414
|
-
const [internalOpen, setInternalOpen] = (0,
|
|
11495
|
+
const [internalOpen, setInternalOpen] = (0, import_react42.useState)(defaultOpen);
|
|
11415
11496
|
const open = openProp ?? internalOpen;
|
|
11416
|
-
const setOpen = (0,
|
|
11497
|
+
const setOpen = (0, import_react42.useCallback)(
|
|
11417
11498
|
(next) => {
|
|
11418
11499
|
if (openProp === void 0) setInternalOpen(next);
|
|
11419
11500
|
onOpenChange?.(next);
|
|
11420
11501
|
},
|
|
11421
11502
|
[openProp, onOpenChange]
|
|
11422
11503
|
);
|
|
11423
|
-
const toggle = (0,
|
|
11424
|
-
const containerRef = (0,
|
|
11425
|
-
const contentRef = (0,
|
|
11426
|
-
const triggerRef = (0,
|
|
11427
|
-
const contentId = (0,
|
|
11428
|
-
(0,
|
|
11504
|
+
const toggle = (0, import_react42.useCallback)(() => setOpen(!open), [open, setOpen]);
|
|
11505
|
+
const containerRef = (0, import_react42.useRef)(null);
|
|
11506
|
+
const contentRef = (0, import_react42.useRef)(null);
|
|
11507
|
+
const triggerRef = (0, import_react42.useRef)(null);
|
|
11508
|
+
const contentId = (0, import_react42.useId)();
|
|
11509
|
+
(0, import_react42.useEffect)(() => {
|
|
11429
11510
|
const handler = (e) => {
|
|
11430
11511
|
if (containerRef.current && !containerRef.current.contains(e.target)) setOpen(false);
|
|
11431
11512
|
};
|
|
11432
11513
|
if (open) document.addEventListener("mousedown", handler);
|
|
11433
11514
|
return () => document.removeEventListener("mousedown", handler);
|
|
11434
11515
|
}, [open, setOpen]);
|
|
11435
|
-
(0,
|
|
11516
|
+
(0, import_react42.useEffect)(() => {
|
|
11436
11517
|
const onKey = (e) => {
|
|
11437
11518
|
if (e instanceof KeyboardEvent && e.key === "Escape") setOpen(false);
|
|
11438
11519
|
};
|
|
11439
11520
|
if (open) document.addEventListener("keydown", onKey);
|
|
11440
11521
|
return () => document.removeEventListener("keydown", onKey);
|
|
11441
11522
|
}, [open, setOpen]);
|
|
11442
|
-
const onTriggerKeyDown = (0,
|
|
11523
|
+
const onTriggerKeyDown = (0, import_react42.useCallback)(
|
|
11443
11524
|
(e) => {
|
|
11444
11525
|
if (e.key === "Enter" || e.key === " ") {
|
|
11445
11526
|
e.preventDefault();
|
|
@@ -11448,7 +11529,7 @@ function Popover({ children, className, open: openProp, defaultOpen = false, onO
|
|
|
11448
11529
|
},
|
|
11449
11530
|
[toggle]
|
|
11450
11531
|
);
|
|
11451
|
-
const value = (0,
|
|
11532
|
+
const value = (0, import_react42.useMemo)(
|
|
11452
11533
|
() => ({
|
|
11453
11534
|
open,
|
|
11454
11535
|
setOpen,
|
|
@@ -11461,7 +11542,7 @@ function Popover({ children, className, open: openProp, defaultOpen = false, onO
|
|
|
11461
11542
|
}),
|
|
11462
11543
|
[open, setOpen, toggle, contentId, onTriggerKeyDown]
|
|
11463
11544
|
);
|
|
11464
|
-
return /* @__PURE__ */ (0,
|
|
11545
|
+
return /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(PopoverContext.Provider, { value, children: /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
|
|
11465
11546
|
"div",
|
|
11466
11547
|
{
|
|
11467
11548
|
ref: containerRef,
|
|
@@ -11474,11 +11555,11 @@ function Popover({ children, className, open: openProp, defaultOpen = false, onO
|
|
|
11474
11555
|
}
|
|
11475
11556
|
function PopoverTrigger({ children, className, ...props }) {
|
|
11476
11557
|
const { open, toggle, triggerRef, contentId, onTriggerKeyDown } = usePopoverContext("PopoverTrigger");
|
|
11477
|
-
const mergeEl = (0,
|
|
11558
|
+
const mergeEl = (0, import_react43.getMergeableTriggerChild)(children);
|
|
11478
11559
|
if (mergeEl) {
|
|
11479
11560
|
const passthrough = props;
|
|
11480
|
-
return /* @__PURE__ */ (0,
|
|
11481
|
-
|
|
11561
|
+
return /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
|
|
11562
|
+
import_react43.Slot,
|
|
11482
11563
|
{
|
|
11483
11564
|
ref: triggerRef,
|
|
11484
11565
|
...props,
|
|
@@ -11499,7 +11580,7 @@ function PopoverTrigger({ children, className, ...props }) {
|
|
|
11499
11580
|
);
|
|
11500
11581
|
}
|
|
11501
11582
|
const passthroughBtn = props;
|
|
11502
|
-
return /* @__PURE__ */ (0,
|
|
11583
|
+
return /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
|
|
11503
11584
|
"button",
|
|
11504
11585
|
{
|
|
11505
11586
|
type: "button",
|
|
@@ -11542,7 +11623,7 @@ function PopoverContent({
|
|
|
11542
11623
|
const rot = beakRotateDeg(placement);
|
|
11543
11624
|
const gapStyle = floatingGapStyle(placement);
|
|
11544
11625
|
if (!open) return null;
|
|
11545
|
-
return /* @__PURE__ */ (0,
|
|
11626
|
+
return /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
|
|
11546
11627
|
"div",
|
|
11547
11628
|
{
|
|
11548
11629
|
className: (0, import_clsx85.clsx)(
|
|
@@ -11550,8 +11631,8 @@ function PopoverContent({
|
|
|
11550
11631
|
popoverFloatingClasses(placement, align)
|
|
11551
11632
|
),
|
|
11552
11633
|
style: gapStyle,
|
|
11553
|
-
children: /* @__PURE__ */ (0,
|
|
11554
|
-
/* @__PURE__ */ (0,
|
|
11634
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)("div", { className: popoverStyles.panelWrap, children: [
|
|
11635
|
+
/* @__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
11636
|
"div",
|
|
11556
11637
|
{
|
|
11557
11638
|
style: {
|
|
@@ -11560,7 +11641,7 @@ function PopoverContent({
|
|
|
11560
11641
|
transform: `rotate(${rot}deg)`,
|
|
11561
11642
|
transformOrigin: "center center"
|
|
11562
11643
|
},
|
|
11563
|
-
children: /* @__PURE__ */ (0,
|
|
11644
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)(
|
|
11564
11645
|
"svg",
|
|
11565
11646
|
{
|
|
11566
11647
|
width: BEAK_W,
|
|
@@ -11570,14 +11651,14 @@ function PopoverContent({
|
|
|
11570
11651
|
xmlns: "http://www.w3.org/2000/svg",
|
|
11571
11652
|
style: { display: "block" },
|
|
11572
11653
|
children: [
|
|
11573
|
-
/* @__PURE__ */ (0,
|
|
11574
|
-
/* @__PURE__ */ (0,
|
|
11654
|
+
/* @__PURE__ */ (0, import_jsx_runtime64.jsx)("polygon", { points: "8,0 0,8 16,8", fill: borderCol }),
|
|
11655
|
+
/* @__PURE__ */ (0, import_jsx_runtime64.jsx)("polygon", { points: "8,2 2,8 14,8", fill: bg })
|
|
11575
11656
|
]
|
|
11576
11657
|
}
|
|
11577
11658
|
)
|
|
11578
11659
|
}
|
|
11579
11660
|
) }),
|
|
11580
|
-
/* @__PURE__ */ (0,
|
|
11661
|
+
/* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
|
|
11581
11662
|
"div",
|
|
11582
11663
|
{
|
|
11583
11664
|
ref: contentRef,
|
|
@@ -11617,9 +11698,9 @@ function PopOver({
|
|
|
11617
11698
|
className,
|
|
11618
11699
|
...props
|
|
11619
11700
|
}) {
|
|
11620
|
-
return /* @__PURE__ */ (0,
|
|
11621
|
-
/* @__PURE__ */ (0,
|
|
11622
|
-
/* @__PURE__ */ (0,
|
|
11701
|
+
return /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)(Popover, { className, ...props, children: [
|
|
11702
|
+
/* @__PURE__ */ (0, import_jsx_runtime64.jsx)(PopoverTrigger, { children: trigger }),
|
|
11703
|
+
/* @__PURE__ */ (0, import_jsx_runtime64.jsx)(PopoverContent, { placement, align, children: content })
|
|
11623
11704
|
] });
|
|
11624
11705
|
}
|
|
11625
11706
|
|
|
@@ -11635,7 +11716,7 @@ var skeletonStyles = {
|
|
|
11635
11716
|
};
|
|
11636
11717
|
|
|
11637
11718
|
// src/components/Skeleton/Skeleton.tsx
|
|
11638
|
-
var
|
|
11719
|
+
var import_jsx_runtime65 = require("react/jsx-runtime");
|
|
11639
11720
|
function Skeleton({
|
|
11640
11721
|
width,
|
|
11641
11722
|
height,
|
|
@@ -11667,7 +11748,7 @@ function Skeleton({
|
|
|
11667
11748
|
w = width ?? "100%";
|
|
11668
11749
|
}
|
|
11669
11750
|
const dimStyle = { width: w, height: h };
|
|
11670
|
-
return /* @__PURE__ */ (0,
|
|
11751
|
+
return /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
|
|
11671
11752
|
"div",
|
|
11672
11753
|
{
|
|
11673
11754
|
"data-refineui": "skeleton",
|
|
@@ -11685,7 +11766,7 @@ function Skeleton({
|
|
|
11685
11766
|
|
|
11686
11767
|
// src/components/Slider/Slider.tsx
|
|
11687
11768
|
var import_clsx87 = require("clsx");
|
|
11688
|
-
var
|
|
11769
|
+
var import_react44 = require("react");
|
|
11689
11770
|
|
|
11690
11771
|
// src/components/Slider/style.ts
|
|
11691
11772
|
var sliderStyles = {
|
|
@@ -11693,7 +11774,7 @@ var sliderStyles = {
|
|
|
11693
11774
|
};
|
|
11694
11775
|
|
|
11695
11776
|
// src/components/Slider/Slider.tsx
|
|
11696
|
-
var
|
|
11777
|
+
var import_jsx_runtime66 = require("react/jsx-runtime");
|
|
11697
11778
|
function clampPct(n) {
|
|
11698
11779
|
if (Number.isNaN(n)) return 0;
|
|
11699
11780
|
return Math.min(100, Math.max(0, n));
|
|
@@ -11711,12 +11792,12 @@ function Slider({
|
|
|
11711
11792
|
style,
|
|
11712
11793
|
...props
|
|
11713
11794
|
}) {
|
|
11714
|
-
const [internalFillPct, setInternalFillPct] = (0,
|
|
11795
|
+
const [internalFillPct, setInternalFillPct] = (0, import_react44.useState)(() => {
|
|
11715
11796
|
const v = defaultValue !== void 0 ? Number(defaultValue) : (min + max) / 2;
|
|
11716
11797
|
return clampPct((v - min) / (max - min) * 100);
|
|
11717
11798
|
});
|
|
11718
11799
|
const fillPct = value !== void 0 ? clampPct((Number(value) - min) / (max - min) * 100) : internalFillPct;
|
|
11719
|
-
return /* @__PURE__ */ (0,
|
|
11800
|
+
return /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
|
|
11720
11801
|
"input",
|
|
11721
11802
|
{
|
|
11722
11803
|
type: "range",
|
|
@@ -11753,7 +11834,7 @@ function Slider({
|
|
|
11753
11834
|
// src/components/Carousel/Carousel.tsx
|
|
11754
11835
|
var import_clsx89 = require("clsx");
|
|
11755
11836
|
var import_tokens27 = require("@refineui/tokens");
|
|
11756
|
-
var
|
|
11837
|
+
var import_react45 = require("react");
|
|
11757
11838
|
|
|
11758
11839
|
// src/components/Carousel/style.ts
|
|
11759
11840
|
var import_clsx88 = require("clsx");
|
|
@@ -11785,11 +11866,11 @@ var carouselStyles = {
|
|
|
11785
11866
|
};
|
|
11786
11867
|
|
|
11787
11868
|
// src/components/Carousel/Carousel.tsx
|
|
11788
|
-
var
|
|
11869
|
+
var import_jsx_runtime67 = require("react/jsx-runtime");
|
|
11789
11870
|
var DRAG_COMMIT_RATIO = 0.18;
|
|
11790
|
-
var CarouselContext = (0,
|
|
11871
|
+
var CarouselContext = (0, import_react45.createContext)(null);
|
|
11791
11872
|
function useCarouselContext(component) {
|
|
11792
|
-
const v = (0,
|
|
11873
|
+
const v = (0, import_react45.useContext)(CarouselContext);
|
|
11793
11874
|
if (!v) throw new Error(`${component} must be used within Carousel.`);
|
|
11794
11875
|
return v;
|
|
11795
11876
|
}
|
|
@@ -11808,13 +11889,13 @@ function Carousel({
|
|
|
11808
11889
|
...props
|
|
11809
11890
|
}) {
|
|
11810
11891
|
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,
|
|
11892
|
+
const [internalIndex, setInternalIndex] = (0, import_react45.useState)(defaultIndex);
|
|
11893
|
+
const [count, setCount] = (0, import_react45.useState)(0);
|
|
11894
|
+
const [trackIndex, setTrackIndex] = (0, import_react45.useState)(defaultIndex);
|
|
11895
|
+
const [instant, setInstant] = (0, import_react45.useState)(false);
|
|
11815
11896
|
const index = isControlled ? indexControlled : internalIndex;
|
|
11816
11897
|
const loopActive = loop && count > 1;
|
|
11817
|
-
const commitLogical = (0,
|
|
11898
|
+
const commitLogical = (0, import_react45.useCallback)(
|
|
11818
11899
|
(next) => {
|
|
11819
11900
|
const normalized = clampIndex(next, Math.max(count, 1));
|
|
11820
11901
|
if (!isControlled) setInternalIndex(normalized);
|
|
@@ -11822,13 +11903,13 @@ function Carousel({
|
|
|
11822
11903
|
},
|
|
11823
11904
|
[count, isControlled, onIndexChange]
|
|
11824
11905
|
);
|
|
11825
|
-
(0,
|
|
11906
|
+
(0, import_react45.useLayoutEffect)(() => {
|
|
11826
11907
|
if (count <= 0) return;
|
|
11827
11908
|
const logical = clampIndex(index, count);
|
|
11828
11909
|
if (logical !== index) commitLogical(logical);
|
|
11829
11910
|
setTrackIndex(loopActive ? logical + 1 : logical);
|
|
11830
11911
|
}, [count, loopActive]);
|
|
11831
|
-
(0,
|
|
11912
|
+
(0, import_react45.useEffect)(() => {
|
|
11832
11913
|
if (count <= 0) return;
|
|
11833
11914
|
if (!loopActive) {
|
|
11834
11915
|
setTrackIndex(clampIndex(index, count));
|
|
@@ -11842,7 +11923,7 @@ function Carousel({
|
|
|
11842
11923
|
}, [index, count, loopActive]);
|
|
11843
11924
|
const canScrollPrev = loopActive ? true : index > 0;
|
|
11844
11925
|
const canScrollNext = loopActive ? true : index < count - 1;
|
|
11845
|
-
const scrollTo = (0,
|
|
11926
|
+
const scrollTo = (0, import_react45.useCallback)(
|
|
11846
11927
|
(i) => {
|
|
11847
11928
|
if (count <= 0) return;
|
|
11848
11929
|
const next = clampIndex(i, count);
|
|
@@ -11851,7 +11932,7 @@ function Carousel({
|
|
|
11851
11932
|
},
|
|
11852
11933
|
[commitLogical, count, loopActive]
|
|
11853
11934
|
);
|
|
11854
|
-
const scrollPrev = (0,
|
|
11935
|
+
const scrollPrev = (0, import_react45.useCallback)(() => {
|
|
11855
11936
|
if (count <= 0) return;
|
|
11856
11937
|
if (loopActive) {
|
|
11857
11938
|
if (trackIndex < 1 || trackIndex > count) return;
|
|
@@ -11864,7 +11945,7 @@ function Carousel({
|
|
|
11864
11945
|
setTrackIndex(index - 1);
|
|
11865
11946
|
}
|
|
11866
11947
|
}, [commitLogical, count, index, loopActive, trackIndex]);
|
|
11867
|
-
const scrollNext = (0,
|
|
11948
|
+
const scrollNext = (0, import_react45.useCallback)(() => {
|
|
11868
11949
|
if (count <= 0) return;
|
|
11869
11950
|
if (loopActive) {
|
|
11870
11951
|
if (trackIndex < 1 || trackIndex > count) return;
|
|
@@ -11877,7 +11958,7 @@ function Carousel({
|
|
|
11877
11958
|
setTrackIndex(index + 1);
|
|
11878
11959
|
}
|
|
11879
11960
|
}, [commitLogical, count, index, loopActive, trackIndex]);
|
|
11880
|
-
const onTrackSettled = (0,
|
|
11961
|
+
const onTrackSettled = (0, import_react45.useCallback)(() => {
|
|
11881
11962
|
if (!loopActive) return;
|
|
11882
11963
|
if (trackIndex === 0) {
|
|
11883
11964
|
setInstant(true);
|
|
@@ -11893,7 +11974,7 @@ function Carousel({
|
|
|
11893
11974
|
});
|
|
11894
11975
|
}
|
|
11895
11976
|
}, [count, loopActive, trackIndex]);
|
|
11896
|
-
const ctx = (0,
|
|
11977
|
+
const ctx = (0, import_react45.useMemo)(
|
|
11897
11978
|
() => ({
|
|
11898
11979
|
index,
|
|
11899
11980
|
count,
|
|
@@ -11948,7 +12029,7 @@ function Carousel({
|
|
|
11948
12029
|
break;
|
|
11949
12030
|
}
|
|
11950
12031
|
};
|
|
11951
|
-
return /* @__PURE__ */ (0,
|
|
12032
|
+
return /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(CarouselContext.Provider, { value: ctx, children: /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
|
|
11952
12033
|
"div",
|
|
11953
12034
|
{
|
|
11954
12035
|
"data-refineui": "carousel",
|
|
@@ -11972,21 +12053,21 @@ function CarouselContent({ className, children, ...props }) {
|
|
|
11972
12053
|
instant,
|
|
11973
12054
|
onTrackSettled
|
|
11974
12055
|
} = useCarouselContext("CarouselContent");
|
|
11975
|
-
const viewportRef = (0,
|
|
11976
|
-
const dragStartX = (0,
|
|
11977
|
-
const [dragPx, setDragPx] = (0,
|
|
11978
|
-
const [dragging, setDragging] = (0,
|
|
11979
|
-
const slides =
|
|
12056
|
+
const viewportRef = (0, import_react45.useRef)(null);
|
|
12057
|
+
const dragStartX = (0, import_react45.useRef)(null);
|
|
12058
|
+
const [dragPx, setDragPx] = (0, import_react45.useState)(0);
|
|
12059
|
+
const [dragging, setDragging] = (0, import_react45.useState)(false);
|
|
12060
|
+
const slides = import_react45.Children.toArray(children).filter(import_react45.isValidElement);
|
|
11980
12061
|
const slideCount = slides.length;
|
|
11981
|
-
(0,
|
|
12062
|
+
(0, import_react45.useEffect)(() => {
|
|
11982
12063
|
setCount(slideCount);
|
|
11983
12064
|
}, [setCount, slideCount]);
|
|
11984
12065
|
const trackSlides = loop && slides.length > 1 ? [
|
|
11985
|
-
(0,
|
|
12066
|
+
(0, import_react45.cloneElement)(slides[slides.length - 1], { key: "__carousel-clone-last" }),
|
|
11986
12067
|
...slides,
|
|
11987
|
-
(0,
|
|
12068
|
+
(0, import_react45.cloneElement)(slides[0], { key: "__carousel-clone-first" })
|
|
11988
12069
|
] : slides;
|
|
11989
|
-
const endDrag = (0,
|
|
12070
|
+
const endDrag = (0, import_react45.useCallback)(
|
|
11990
12071
|
(clientX) => {
|
|
11991
12072
|
if (dragStartX.current == null) return;
|
|
11992
12073
|
const width = viewportRef.current?.offsetWidth ?? 1;
|
|
@@ -12035,7 +12116,7 @@ function CarouselContent({ className, children, ...props }) {
|
|
|
12035
12116
|
};
|
|
12036
12117
|
const animated = !dragging && !instant;
|
|
12037
12118
|
const transform = dragPx !== 0 ? `translate3d(calc(-${trackIndex * 100}% + ${dragPx}px), 0, 0)` : `translate3d(-${trackIndex * 100}%, 0, 0)`;
|
|
12038
|
-
return /* @__PURE__ */ (0,
|
|
12119
|
+
return /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
|
|
12039
12120
|
"div",
|
|
12040
12121
|
{
|
|
12041
12122
|
ref: viewportRef,
|
|
@@ -12046,7 +12127,7 @@ function CarouselContent({ className, children, ...props }) {
|
|
|
12046
12127
|
onPointerMove,
|
|
12047
12128
|
onPointerUp,
|
|
12048
12129
|
onPointerCancel,
|
|
12049
|
-
children: /* @__PURE__ */ (0,
|
|
12130
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
|
|
12050
12131
|
"div",
|
|
12051
12132
|
{
|
|
12052
12133
|
"data-refineui": "carousel-track",
|
|
@@ -12061,9 +12142,9 @@ function CarouselContent({ className, children, ...props }) {
|
|
|
12061
12142
|
}
|
|
12062
12143
|
);
|
|
12063
12144
|
}
|
|
12064
|
-
var CarouselItem = (0,
|
|
12145
|
+
var CarouselItem = (0, import_react45.forwardRef)(function CarouselItem2({ className, children, ...props }, ref) {
|
|
12065
12146
|
useCarouselContext("CarouselItem");
|
|
12066
|
-
return /* @__PURE__ */ (0,
|
|
12147
|
+
return /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
|
|
12067
12148
|
"div",
|
|
12068
12149
|
{
|
|
12069
12150
|
ref,
|
|
@@ -12078,12 +12159,12 @@ var CarouselItem = (0, import_react43.forwardRef)(function CarouselItem2({ class
|
|
|
12078
12159
|
});
|
|
12079
12160
|
function CarouselControls({ className, children, ...props }) {
|
|
12080
12161
|
useCarouselContext("CarouselControls");
|
|
12081
|
-
return /* @__PURE__ */ (0,
|
|
12162
|
+
return /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("div", { "data-refineui": "carousel-controls", className: (0, import_clsx89.clsx)(carouselStyles.controls, className), ...props, children });
|
|
12082
12163
|
}
|
|
12083
12164
|
function CarouselPrevious({ className, disabled, onClick, ...props }) {
|
|
12084
12165
|
const { scrollPrev, canScrollPrev } = useCarouselContext("CarouselPrevious");
|
|
12085
12166
|
const isDisabled = disabled || !canScrollPrev;
|
|
12086
|
-
return /* @__PURE__ */ (0,
|
|
12167
|
+
return /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
|
|
12087
12168
|
Button,
|
|
12088
12169
|
{
|
|
12089
12170
|
variant: "outline",
|
|
@@ -12099,7 +12180,7 @@ function CarouselPrevious({ className, disabled, onClick, ...props }) {
|
|
|
12099
12180
|
onClick?.(e);
|
|
12100
12181
|
if (!e.defaultPrevented && !isDisabled) scrollPrev();
|
|
12101
12182
|
},
|
|
12102
|
-
children: /* @__PURE__ */ (0,
|
|
12183
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
|
|
12103
12184
|
WebIcon,
|
|
12104
12185
|
{
|
|
12105
12186
|
name: "chevron-left",
|
|
@@ -12115,7 +12196,7 @@ function CarouselPrevious({ className, disabled, onClick, ...props }) {
|
|
|
12115
12196
|
function CarouselNext({ className, disabled, onClick, ...props }) {
|
|
12116
12197
|
const { scrollNext, canScrollNext } = useCarouselContext("CarouselNext");
|
|
12117
12198
|
const isDisabled = disabled || !canScrollNext;
|
|
12118
|
-
return /* @__PURE__ */ (0,
|
|
12199
|
+
return /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
|
|
12119
12200
|
Button,
|
|
12120
12201
|
{
|
|
12121
12202
|
variant: "outline",
|
|
@@ -12131,7 +12212,7 @@ function CarouselNext({ className, disabled, onClick, ...props }) {
|
|
|
12131
12212
|
onClick?.(e);
|
|
12132
12213
|
if (!e.defaultPrevented && !isDisabled) scrollNext();
|
|
12133
12214
|
},
|
|
12134
|
-
children: /* @__PURE__ */ (0,
|
|
12215
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
|
|
12135
12216
|
WebIcon,
|
|
12136
12217
|
{
|
|
12137
12218
|
name: "chevron-right",
|
|
@@ -12146,9 +12227,9 @@ function CarouselNext({ className, disabled, onClick, ...props }) {
|
|
|
12146
12227
|
}
|
|
12147
12228
|
function CarouselIndicators({ className, ...props }) {
|
|
12148
12229
|
const { count, index, scrollTo } = useCarouselContext("CarouselIndicators");
|
|
12149
|
-
const trackRef = (0,
|
|
12150
|
-
const [thumb, setThumb] = (0,
|
|
12151
|
-
const updateThumb = (0,
|
|
12230
|
+
const trackRef = (0, import_react45.useRef)(null);
|
|
12231
|
+
const [thumb, setThumb] = (0, import_react45.useState)({ width: 0, x: 0, ready: false });
|
|
12232
|
+
const updateThumb = (0, import_react45.useCallback)(() => {
|
|
12152
12233
|
const el = trackRef.current;
|
|
12153
12234
|
if (!el || count <= 0) {
|
|
12154
12235
|
setThumb({ width: 0, x: 0, ready: false });
|
|
@@ -12163,10 +12244,10 @@ function CarouselIndicators({ className, ...props }) {
|
|
|
12163
12244
|
ready: true
|
|
12164
12245
|
});
|
|
12165
12246
|
}, [count, index]);
|
|
12166
|
-
(0,
|
|
12247
|
+
(0, import_react45.useLayoutEffect)(() => {
|
|
12167
12248
|
updateThumb();
|
|
12168
12249
|
}, [updateThumb]);
|
|
12169
|
-
(0,
|
|
12250
|
+
(0, import_react45.useEffect)(() => {
|
|
12170
12251
|
const el = trackRef.current;
|
|
12171
12252
|
if (!el) return;
|
|
12172
12253
|
const ro = new ResizeObserver(() => updateThumb());
|
|
@@ -12178,7 +12259,7 @@ function CarouselIndicators({ className, ...props }) {
|
|
|
12178
12259
|
width: thumb.width,
|
|
12179
12260
|
transform: `translate3d(${thumb.x}px, 0, 0)`
|
|
12180
12261
|
};
|
|
12181
|
-
return /* @__PURE__ */ (0,
|
|
12262
|
+
return /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)(
|
|
12182
12263
|
"div",
|
|
12183
12264
|
{
|
|
12184
12265
|
ref: trackRef,
|
|
@@ -12188,7 +12269,7 @@ function CarouselIndicators({ className, ...props }) {
|
|
|
12188
12269
|
className: (0, import_clsx89.clsx)(carouselStyles.indicators, className),
|
|
12189
12270
|
...props,
|
|
12190
12271
|
children: [
|
|
12191
|
-
/* @__PURE__ */ (0,
|
|
12272
|
+
/* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
|
|
12192
12273
|
"span",
|
|
12193
12274
|
{
|
|
12194
12275
|
"data-refineui": "carousel-indicator-thumb",
|
|
@@ -12198,7 +12279,7 @@ function CarouselIndicators({ className, ...props }) {
|
|
|
12198
12279
|
style: thumbStyle
|
|
12199
12280
|
}
|
|
12200
12281
|
),
|
|
12201
|
-
/* @__PURE__ */ (0,
|
|
12282
|
+
/* @__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
12283
|
"button",
|
|
12203
12284
|
{
|
|
12204
12285
|
type: "button",
|
|
@@ -12219,7 +12300,7 @@ function CarouselIndicators({ className, ...props }) {
|
|
|
12219
12300
|
|
|
12220
12301
|
// src/components/Bubble/Bubble.tsx
|
|
12221
12302
|
var import_clsx91 = require("clsx");
|
|
12222
|
-
var
|
|
12303
|
+
var import_react46 = require("react");
|
|
12223
12304
|
|
|
12224
12305
|
// src/components/Bubble/style.ts
|
|
12225
12306
|
var import_clsx90 = require("clsx");
|
|
@@ -12284,21 +12365,21 @@ var bubbleContentVariantClass = {
|
|
|
12284
12365
|
};
|
|
12285
12366
|
|
|
12286
12367
|
// src/components/Bubble/Bubble.tsx
|
|
12287
|
-
var
|
|
12288
|
-
var BubbleContext = (0,
|
|
12368
|
+
var import_jsx_runtime68 = require("react/jsx-runtime");
|
|
12369
|
+
var BubbleContext = (0, import_react46.createContext)(null);
|
|
12289
12370
|
function useBubbleContext(component) {
|
|
12290
|
-
const value = (0,
|
|
12371
|
+
const value = (0, import_react46.useContext)(BubbleContext);
|
|
12291
12372
|
if (!value) throw new Error(`${component} must be used within Bubble.`);
|
|
12292
12373
|
return value;
|
|
12293
12374
|
}
|
|
12294
12375
|
function isBubbleReactionsElement(node) {
|
|
12295
|
-
return (0,
|
|
12376
|
+
return (0, import_react46.isValidElement)(node) && node.type === BubbleReactions;
|
|
12296
12377
|
}
|
|
12297
12378
|
function partitionBubbleChildren(children) {
|
|
12298
12379
|
const top = [];
|
|
12299
12380
|
const middle = [];
|
|
12300
12381
|
const bottom = [];
|
|
12301
|
-
|
|
12382
|
+
import_react46.Children.forEach(children, (child) => {
|
|
12302
12383
|
if (!isBubbleReactionsElement(child)) {
|
|
12303
12384
|
middle.push(child);
|
|
12304
12385
|
return;
|
|
@@ -12316,7 +12397,7 @@ function partitionBubbleChildren(children) {
|
|
|
12316
12397
|
};
|
|
12317
12398
|
}
|
|
12318
12399
|
function BubbleGroup({ className, ...props }) {
|
|
12319
|
-
return /* @__PURE__ */ (0,
|
|
12400
|
+
return /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(
|
|
12320
12401
|
"div",
|
|
12321
12402
|
{
|
|
12322
12403
|
"data-refineui": "bubble-group",
|
|
@@ -12335,7 +12416,7 @@ function Bubble({
|
|
|
12335
12416
|
}) {
|
|
12336
12417
|
const rootStyle = variant === "ghost" ? style : { maxWidth: BUBBLE_MAX_WIDTH, ...style };
|
|
12337
12418
|
const { top, middle, bottom, hasTop, hasBottom } = partitionBubbleChildren(children);
|
|
12338
|
-
return /* @__PURE__ */ (0,
|
|
12419
|
+
return /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(BubbleContext.Provider, { value: { variant, align }, children: /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(
|
|
12339
12420
|
"div",
|
|
12340
12421
|
{
|
|
12341
12422
|
"data-refineui": "bubble",
|
|
@@ -12350,7 +12431,7 @@ function Bubble({
|
|
|
12350
12431
|
),
|
|
12351
12432
|
style: rootStyle,
|
|
12352
12433
|
...props,
|
|
12353
|
-
children: /* @__PURE__ */ (0,
|
|
12434
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime68.jsxs)("div", { "data-refineui": "bubble-surface", className: bubbleStyles.surface, children: [
|
|
12354
12435
|
middle,
|
|
12355
12436
|
top,
|
|
12356
12437
|
bottom
|
|
@@ -12360,7 +12441,7 @@ function Bubble({
|
|
|
12360
12441
|
}
|
|
12361
12442
|
function BubbleContent({ className, ...props }) {
|
|
12362
12443
|
const { variant } = useBubbleContext("BubbleContent");
|
|
12363
|
-
return /* @__PURE__ */ (0,
|
|
12444
|
+
return /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(
|
|
12364
12445
|
"div",
|
|
12365
12446
|
{
|
|
12366
12447
|
"data-refineui": "bubble-content",
|
|
@@ -12381,7 +12462,7 @@ function BubbleReactions({
|
|
|
12381
12462
|
}) {
|
|
12382
12463
|
const { align: bubbleAlign } = useBubbleContext("BubbleReactions");
|
|
12383
12464
|
const align = alignProp ?? (bubbleAlign === "start" ? "end" : "start");
|
|
12384
|
-
return /* @__PURE__ */ (0,
|
|
12465
|
+
return /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(
|
|
12385
12466
|
"div",
|
|
12386
12467
|
{
|
|
12387
12468
|
"data-refineui": "bubble-reactions",
|
|
@@ -12401,7 +12482,7 @@ function BubbleReactions({
|
|
|
12401
12482
|
// src/components/Stepper/Stepper.tsx
|
|
12402
12483
|
var import_clsx93 = require("clsx");
|
|
12403
12484
|
var import_tokens28 = require("@refineui/tokens");
|
|
12404
|
-
var
|
|
12485
|
+
var import_react47 = require("react");
|
|
12405
12486
|
|
|
12406
12487
|
// src/components/Stepper/style.ts
|
|
12407
12488
|
var import_clsx92 = require("clsx");
|
|
@@ -12509,17 +12590,17 @@ var stepperConnectorVars = {
|
|
|
12509
12590
|
};
|
|
12510
12591
|
|
|
12511
12592
|
// src/components/Stepper/Stepper.tsx
|
|
12512
|
-
var
|
|
12513
|
-
var StepperContext = (0,
|
|
12514
|
-
var StepperItemContext = (0,
|
|
12515
|
-
var StepperListRegistryContext = (0,
|
|
12593
|
+
var import_jsx_runtime69 = require("react/jsx-runtime");
|
|
12594
|
+
var StepperContext = (0, import_react47.createContext)(null);
|
|
12595
|
+
var StepperItemContext = (0, import_react47.createContext)(null);
|
|
12596
|
+
var StepperListRegistryContext = (0, import_react47.createContext)(null);
|
|
12516
12597
|
function useStepperContext(component) {
|
|
12517
|
-
const v = (0,
|
|
12598
|
+
const v = (0, import_react47.useContext)(StepperContext);
|
|
12518
12599
|
if (!v) throw new Error(`${component} must be used within Stepper.`);
|
|
12519
12600
|
return v;
|
|
12520
12601
|
}
|
|
12521
12602
|
function useStepperItemContext(component) {
|
|
12522
|
-
const v = (0,
|
|
12603
|
+
const v = (0, import_react47.useContext)(StepperItemContext);
|
|
12523
12604
|
if (!v) throw new Error(`${component} must be used within StepperItem.`);
|
|
12524
12605
|
return v;
|
|
12525
12606
|
}
|
|
@@ -12539,16 +12620,16 @@ function Stepper({
|
|
|
12539
12620
|
...props
|
|
12540
12621
|
}) {
|
|
12541
12622
|
const isControlled = valueControlled !== void 0;
|
|
12542
|
-
const [internalValue, setInternalValue] = (0,
|
|
12623
|
+
const [internalValue, setInternalValue] = (0, import_react47.useState)(defaultValue);
|
|
12543
12624
|
const value = isControlled ? valueControlled : internalValue;
|
|
12544
|
-
const setValue = (0,
|
|
12625
|
+
const setValue = (0, import_react47.useCallback)(
|
|
12545
12626
|
(next) => {
|
|
12546
12627
|
if (!isControlled) setInternalValue(next);
|
|
12547
12628
|
onValueChange?.(next);
|
|
12548
12629
|
},
|
|
12549
12630
|
[isControlled, onValueChange]
|
|
12550
12631
|
);
|
|
12551
|
-
const ctx = (0,
|
|
12632
|
+
const ctx = (0, import_react47.useMemo)(
|
|
12552
12633
|
() => ({
|
|
12553
12634
|
value,
|
|
12554
12635
|
setValue,
|
|
@@ -12557,7 +12638,7 @@ function Stepper({
|
|
|
12557
12638
|
}),
|
|
12558
12639
|
[value, setValue, orientation, onValueChange, isControlled]
|
|
12559
12640
|
);
|
|
12560
|
-
return /* @__PURE__ */ (0,
|
|
12641
|
+
return /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(StepperContext.Provider, { value: ctx, children: /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(
|
|
12561
12642
|
"div",
|
|
12562
12643
|
{
|
|
12563
12644
|
"data-refineui": "stepper",
|
|
@@ -12571,9 +12652,9 @@ function Stepper({
|
|
|
12571
12652
|
}
|
|
12572
12653
|
function StepperList({ className, children, ...props }) {
|
|
12573
12654
|
const { orientation, value } = useStepperContext("StepperList");
|
|
12574
|
-
const cursorRef = (0,
|
|
12655
|
+
const cursorRef = (0, import_react47.useRef)(null);
|
|
12575
12656
|
cursorRef.current = null;
|
|
12576
|
-
const registry = (0,
|
|
12657
|
+
const registry = (0, import_react47.useMemo)(
|
|
12577
12658
|
() => ({
|
|
12578
12659
|
noteItem(itemValue) {
|
|
12579
12660
|
cursorRef.current = itemValue;
|
|
@@ -12585,7 +12666,7 @@ function StepperList({ className, children, ...props }) {
|
|
|
12585
12666
|
}),
|
|
12586
12667
|
[value]
|
|
12587
12668
|
);
|
|
12588
|
-
return /* @__PURE__ */ (0,
|
|
12669
|
+
return /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(StepperListRegistryContext.Provider, { value: registry, children: /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(
|
|
12589
12670
|
"ol",
|
|
12590
12671
|
{
|
|
12591
12672
|
"data-refineui": "stepper-list",
|
|
@@ -12610,7 +12691,7 @@ function StepperItem({
|
|
|
12610
12691
|
...props
|
|
12611
12692
|
}) {
|
|
12612
12693
|
const { value, setValue, orientation, interactive } = useStepperContext("StepperItem");
|
|
12613
|
-
const registry = (0,
|
|
12694
|
+
const registry = (0, import_react47.useContext)(StepperListRegistryContext);
|
|
12614
12695
|
registry?.noteItem(itemValue);
|
|
12615
12696
|
const state = resolveState2(itemValue, value);
|
|
12616
12697
|
const canActivate = interactive && !disabled;
|
|
@@ -12626,11 +12707,11 @@ function StepperItem({
|
|
|
12626
12707
|
activate();
|
|
12627
12708
|
}
|
|
12628
12709
|
};
|
|
12629
|
-
const itemCtx = (0,
|
|
12710
|
+
const itemCtx = (0, import_react47.useMemo)(
|
|
12630
12711
|
() => ({ state, disabled }),
|
|
12631
12712
|
[state, disabled]
|
|
12632
12713
|
);
|
|
12633
|
-
return /* @__PURE__ */ (0,
|
|
12714
|
+
return /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(StepperItemContext.Provider, { value: itemCtx, children: /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(
|
|
12634
12715
|
"li",
|
|
12635
12716
|
{
|
|
12636
12717
|
"data-refineui": "stepper-item",
|
|
@@ -12658,7 +12739,7 @@ function StepperItem({
|
|
|
12658
12739
|
function StepperIndicator({ className, children, ...props }) {
|
|
12659
12740
|
const { state } = useStepperItemContext("StepperIndicator");
|
|
12660
12741
|
const stateClass = state === "complete" ? stepperStyles.indicatorComplete : state === "current" ? stepperStyles.indicatorCurrent : stepperStyles.indicatorUpcoming;
|
|
12661
|
-
const content = state === "upcoming" ? children : /* @__PURE__ */ (0,
|
|
12742
|
+
const content = state === "upcoming" ? children : /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(
|
|
12662
12743
|
WebIcon,
|
|
12663
12744
|
{
|
|
12664
12745
|
name: "checkmark",
|
|
@@ -12669,7 +12750,7 @@ function StepperIndicator({ className, children, ...props }) {
|
|
|
12669
12750
|
className: "items-center justify-center"
|
|
12670
12751
|
}
|
|
12671
12752
|
);
|
|
12672
|
-
return /* @__PURE__ */ (0,
|
|
12753
|
+
return /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(
|
|
12673
12754
|
"span",
|
|
12674
12755
|
{
|
|
12675
12756
|
"data-refineui": "stepper-indicator",
|
|
@@ -12684,7 +12765,7 @@ function StepperIndicator({ className, children, ...props }) {
|
|
|
12684
12765
|
function StepperContent({ className, ...props }) {
|
|
12685
12766
|
const { orientation } = useStepperContext("StepperContent");
|
|
12686
12767
|
useStepperItemContext("StepperContent");
|
|
12687
|
-
return /* @__PURE__ */ (0,
|
|
12768
|
+
return /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(
|
|
12688
12769
|
"div",
|
|
12689
12770
|
{
|
|
12690
12771
|
"data-refineui": "stepper-content",
|
|
@@ -12700,7 +12781,7 @@ function StepperContent({ className, ...props }) {
|
|
|
12700
12781
|
function StepperTitle({ className, ...props }) {
|
|
12701
12782
|
const { state } = useStepperItemContext("StepperTitle");
|
|
12702
12783
|
const stateClass = state === "complete" ? stepperStyles.titleComplete : state === "current" ? stepperStyles.titleCurrent : stepperStyles.titleUpcoming;
|
|
12703
|
-
return /* @__PURE__ */ (0,
|
|
12784
|
+
return /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(
|
|
12704
12785
|
"span",
|
|
12705
12786
|
{
|
|
12706
12787
|
"data-refineui": "stepper-title",
|
|
@@ -12713,7 +12794,7 @@ function StepperTitle({ className, ...props }) {
|
|
|
12713
12794
|
function StepperDescription({ className, ...props }) {
|
|
12714
12795
|
const { state } = useStepperItemContext("StepperDescription");
|
|
12715
12796
|
const stateClass = state === "complete" ? stepperStyles.descriptionComplete : state === "current" ? stepperStyles.descriptionCurrent : stepperStyles.descriptionUpcoming;
|
|
12716
|
-
return /* @__PURE__ */ (0,
|
|
12797
|
+
return /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(
|
|
12717
12798
|
"span",
|
|
12718
12799
|
{
|
|
12719
12800
|
"data-refineui": "stepper-description",
|
|
@@ -12725,10 +12806,10 @@ function StepperDescription({ className, ...props }) {
|
|
|
12725
12806
|
}
|
|
12726
12807
|
function StepperSeparator({ className, ...props }) {
|
|
12727
12808
|
const { orientation } = useStepperContext("StepperSeparator");
|
|
12728
|
-
const registry = (0,
|
|
12809
|
+
const registry = (0, import_react47.useContext)(StepperListRegistryContext);
|
|
12729
12810
|
const state = registry?.takeSeparatorState() ?? "upcoming";
|
|
12730
12811
|
const vertical = orientation === "vertical";
|
|
12731
|
-
return /* @__PURE__ */ (0,
|
|
12812
|
+
return /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(
|
|
12732
12813
|
"li",
|
|
12733
12814
|
{
|
|
12734
12815
|
"data-refineui": "stepper-separator",
|
|
@@ -12742,7 +12823,7 @@ function StepperSeparator({ className, ...props }) {
|
|
|
12742
12823
|
className
|
|
12743
12824
|
),
|
|
12744
12825
|
...props,
|
|
12745
|
-
children: /* @__PURE__ */ (0,
|
|
12826
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime69.jsxs)(
|
|
12746
12827
|
"span",
|
|
12747
12828
|
{
|
|
12748
12829
|
"data-refineui": "stepper-separator-rail",
|
|
@@ -12751,14 +12832,14 @@ function StepperSeparator({ className, ...props }) {
|
|
|
12751
12832
|
vertical ? stepperStyles.separatorRailVertical : stepperStyles.separatorRailHorizontal
|
|
12752
12833
|
),
|
|
12753
12834
|
children: [
|
|
12754
|
-
/* @__PURE__ */ (0,
|
|
12835
|
+
/* @__PURE__ */ (0, import_jsx_runtime69.jsx)(
|
|
12755
12836
|
"span",
|
|
12756
12837
|
{
|
|
12757
12838
|
"data-refineui": "stepper-separator-track",
|
|
12758
12839
|
className: stepperStyles.separatorTrack
|
|
12759
12840
|
}
|
|
12760
12841
|
),
|
|
12761
|
-
/* @__PURE__ */ (0,
|
|
12842
|
+
/* @__PURE__ */ (0, import_jsx_runtime69.jsx)(
|
|
12762
12843
|
"span",
|
|
12763
12844
|
{
|
|
12764
12845
|
"data-refineui": "stepper-separator-fill",
|
|
@@ -12786,7 +12867,7 @@ StepperSeparator.displayName = "StepperSeparator";
|
|
|
12786
12867
|
|
|
12787
12868
|
// src/components/Resizable/Resizable.tsx
|
|
12788
12869
|
var import_clsx95 = require("clsx");
|
|
12789
|
-
var
|
|
12870
|
+
var import_react48 = require("react");
|
|
12790
12871
|
|
|
12791
12872
|
// src/components/Resizable/style.ts
|
|
12792
12873
|
var import_clsx94 = require("clsx");
|
|
@@ -12821,15 +12902,15 @@ var resizableStyles = {
|
|
|
12821
12902
|
};
|
|
12822
12903
|
|
|
12823
12904
|
// src/components/Resizable/Resizable.tsx
|
|
12824
|
-
var
|
|
12905
|
+
var import_jsx_runtime70 = require("react/jsx-runtime");
|
|
12825
12906
|
var KEYBOARD_STEP = 2;
|
|
12826
12907
|
var KEYBOARD_STEP_LARGE = 10;
|
|
12827
12908
|
var DEFAULT_SIZE = 50;
|
|
12828
12909
|
var DEFAULT_MIN_SIZE = 10;
|
|
12829
12910
|
var DEFAULT_MAX_SIZE = 100;
|
|
12830
|
-
var ResizableContext = (0,
|
|
12911
|
+
var ResizableContext = (0, import_react48.createContext)(null);
|
|
12831
12912
|
function useResizableContext(component) {
|
|
12832
|
-
const v = (0,
|
|
12913
|
+
const v = (0, import_react48.useContext)(ResizableContext);
|
|
12833
12914
|
if (!v) throw new Error(`${component} must be used within ResizablePanelGroup.`);
|
|
12834
12915
|
return v;
|
|
12835
12916
|
}
|
|
@@ -12888,13 +12969,13 @@ function ResizablePanelGroup({
|
|
|
12888
12969
|
onLayout,
|
|
12889
12970
|
...props
|
|
12890
12971
|
}) {
|
|
12891
|
-
const groupRef = (0,
|
|
12892
|
-
const panelsRef = (0,
|
|
12893
|
-
const orderCounterRef = (0,
|
|
12894
|
-
const [sizes, setSizes] = (0,
|
|
12895
|
-
const onLayoutRef = (0,
|
|
12972
|
+
const groupRef = (0, import_react48.useRef)(null);
|
|
12973
|
+
const panelsRef = (0, import_react48.useRef)(/* @__PURE__ */ new Map());
|
|
12974
|
+
const orderCounterRef = (0, import_react48.useRef)(0);
|
|
12975
|
+
const [sizes, setSizes] = (0, import_react48.useState)({});
|
|
12976
|
+
const onLayoutRef = (0, import_react48.useRef)(onLayout);
|
|
12896
12977
|
onLayoutRef.current = onLayout;
|
|
12897
|
-
const syncInitialSizes = (0,
|
|
12978
|
+
const syncInitialSizes = (0, import_react48.useCallback)(() => {
|
|
12898
12979
|
const panels = [...panelsRef.current.values()].sort((a, b) => a.order - b.order);
|
|
12899
12980
|
if (panels.length === 0) return;
|
|
12900
12981
|
setSizes((prev) => {
|
|
@@ -12929,7 +13010,7 @@ function ResizablePanelGroup({
|
|
|
12929
13010
|
return base;
|
|
12930
13011
|
});
|
|
12931
13012
|
}, []);
|
|
12932
|
-
const registerPanel = (0,
|
|
13013
|
+
const registerPanel = (0, import_react48.useCallback)(
|
|
12933
13014
|
(panel) => {
|
|
12934
13015
|
const existing = panelsRef.current.get(panel.id);
|
|
12935
13016
|
const order = existing?.order ?? orderCounterRef.current++;
|
|
@@ -12938,7 +13019,7 @@ function ResizablePanelGroup({
|
|
|
12938
13019
|
},
|
|
12939
13020
|
[syncInitialSizes]
|
|
12940
13021
|
);
|
|
12941
|
-
const unregisterPanel = (0,
|
|
13022
|
+
const unregisterPanel = (0, import_react48.useCallback)((id) => {
|
|
12942
13023
|
panelsRef.current.delete(id);
|
|
12943
13024
|
setSizes((prev) => {
|
|
12944
13025
|
if (!(id in prev)) return prev;
|
|
@@ -12947,13 +13028,13 @@ function ResizablePanelGroup({
|
|
|
12947
13028
|
return next;
|
|
12948
13029
|
});
|
|
12949
13030
|
}, []);
|
|
12950
|
-
const getPanel = (0,
|
|
12951
|
-
const emitPanelResize = (0,
|
|
13031
|
+
const getPanel = (0, import_react48.useCallback)((id) => panelsRef.current.get(id), []);
|
|
13032
|
+
const emitPanelResize = (0, import_react48.useCallback)((next) => {
|
|
12952
13033
|
for (const [id, size] of Object.entries(next)) {
|
|
12953
13034
|
panelsRef.current.get(id)?.onResize?.(size);
|
|
12954
13035
|
}
|
|
12955
13036
|
}, []);
|
|
12956
|
-
const resizeBetween = (0,
|
|
13037
|
+
const resizeBetween = (0, import_react48.useCallback)(
|
|
12957
13038
|
(leftId, rightId, deltaPct) => {
|
|
12958
13039
|
setSizes((prev) => {
|
|
12959
13040
|
const next = applyResize(
|
|
@@ -12970,7 +13051,7 @@ function ResizablePanelGroup({
|
|
|
12970
13051
|
},
|
|
12971
13052
|
[emitPanelResize]
|
|
12972
13053
|
);
|
|
12973
|
-
const setBetween = (0,
|
|
13054
|
+
const setBetween = (0, import_react48.useCallback)(
|
|
12974
13055
|
(leftId, rightId, leftSize) => {
|
|
12975
13056
|
setSizes((prev) => {
|
|
12976
13057
|
const left = panelsRef.current.get(leftId);
|
|
@@ -12995,13 +13076,13 @@ function ResizablePanelGroup({
|
|
|
12995
13076
|
},
|
|
12996
13077
|
[emitPanelResize]
|
|
12997
13078
|
);
|
|
12998
|
-
(0,
|
|
13079
|
+
(0, import_react48.useLayoutEffect)(() => {
|
|
12999
13080
|
const ids = orderedPanelIds(panelsRef.current);
|
|
13000
13081
|
if (ids.length === 0) return;
|
|
13001
13082
|
if (ids.some((id) => sizes[id] === void 0)) return;
|
|
13002
13083
|
onLayoutRef.current?.(ids.map((id) => sizes[id]));
|
|
13003
13084
|
}, [sizes]);
|
|
13004
|
-
const ctx = (0,
|
|
13085
|
+
const ctx = (0, import_react48.useMemo)(
|
|
13005
13086
|
() => ({
|
|
13006
13087
|
orientation,
|
|
13007
13088
|
groupRef,
|
|
@@ -13022,7 +13103,7 @@ function ResizablePanelGroup({
|
|
|
13022
13103
|
setBetween
|
|
13023
13104
|
]
|
|
13024
13105
|
);
|
|
13025
|
-
return /* @__PURE__ */ (0,
|
|
13106
|
+
return /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(ResizableContext.Provider, { value: ctx, children: /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
|
|
13026
13107
|
"div",
|
|
13027
13108
|
{
|
|
13028
13109
|
ref: groupRef,
|
|
@@ -13050,11 +13131,11 @@ function ResizablePanel({
|
|
|
13050
13131
|
onResize,
|
|
13051
13132
|
...props
|
|
13052
13133
|
}) {
|
|
13053
|
-
const id = (0,
|
|
13134
|
+
const id = (0, import_react48.useId)();
|
|
13054
13135
|
const { orientation, sizes, registerPanel, unregisterPanel } = useResizableContext("ResizablePanel");
|
|
13055
|
-
const onResizeRef = (0,
|
|
13136
|
+
const onResizeRef = (0, import_react48.useRef)(onResize);
|
|
13056
13137
|
onResizeRef.current = onResize;
|
|
13057
|
-
(0,
|
|
13138
|
+
(0, import_react48.useLayoutEffect)(() => {
|
|
13058
13139
|
registerPanel({
|
|
13059
13140
|
id,
|
|
13060
13141
|
defaultSize,
|
|
@@ -13081,7 +13162,7 @@ function ResizablePanel({
|
|
|
13081
13162
|
flexBasis: 0,
|
|
13082
13163
|
...orientation === "horizontal" ? { minWidth: `${minSize}%` } : { minHeight: `${minSize}%` }
|
|
13083
13164
|
};
|
|
13084
|
-
return /* @__PURE__ */ (0,
|
|
13165
|
+
return /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
|
|
13085
13166
|
"div",
|
|
13086
13167
|
{
|
|
13087
13168
|
"data-refineui": "resizable-panel",
|
|
@@ -13112,11 +13193,11 @@ function ResizableHandle({
|
|
|
13112
13193
|
resizeBetween,
|
|
13113
13194
|
setBetween
|
|
13114
13195
|
} = useResizableContext("ResizableHandle");
|
|
13115
|
-
const handleRef = (0,
|
|
13116
|
-
const [active, setActive] = (0,
|
|
13117
|
-
const [, setAdjacentReady] = (0,
|
|
13118
|
-
const dragRef = (0,
|
|
13119
|
-
(0,
|
|
13196
|
+
const handleRef = (0, import_react48.useRef)(null);
|
|
13197
|
+
const [active, setActive] = (0, import_react48.useState)(false);
|
|
13198
|
+
const [, setAdjacentReady] = (0, import_react48.useState)(false);
|
|
13199
|
+
const dragRef = (0, import_react48.useRef)(null);
|
|
13200
|
+
(0, import_react48.useLayoutEffect)(() => {
|
|
13120
13201
|
setAdjacentReady(true);
|
|
13121
13202
|
}, []);
|
|
13122
13203
|
const adjacent = handleRef.current ? findAdjacentPanelIds(handleRef.current) : { leftId: null, rightId: null };
|
|
@@ -13127,7 +13208,7 @@ function ResizableHandle({
|
|
|
13127
13208
|
const ariaMin = leftPanel?.minSize ?? 0;
|
|
13128
13209
|
const ariaMax = leftPanel?.maxSize ?? DEFAULT_MAX_SIZE;
|
|
13129
13210
|
const defaultKeyshortcuts = orientation === "horizontal" ? "ArrowLeft ArrowRight Home End" : "ArrowUp ArrowDown Home End";
|
|
13130
|
-
const keepFocus = (0,
|
|
13211
|
+
const keepFocus = (0, import_react48.useCallback)(() => {
|
|
13131
13212
|
const el = handleRef.current;
|
|
13132
13213
|
if (el && document.activeElement !== el) {
|
|
13133
13214
|
el.focus({ preventScroll: true });
|
|
@@ -13226,7 +13307,7 @@ function ResizableHandle({
|
|
|
13226
13307
|
resizeBetween(leftId, rightId, delta);
|
|
13227
13308
|
queueMicrotask(keepFocus);
|
|
13228
13309
|
};
|
|
13229
|
-
return /* @__PURE__ */ (0,
|
|
13310
|
+
return /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
|
|
13230
13311
|
"div",
|
|
13231
13312
|
{
|
|
13232
13313
|
ref: handleRef,
|
|
@@ -13256,7 +13337,7 @@ function ResizableHandle({
|
|
|
13256
13337
|
onPointerUp: handlePointerUp,
|
|
13257
13338
|
onPointerCancel: handlePointerUp,
|
|
13258
13339
|
onKeyDown: handleKeyDown,
|
|
13259
|
-
children: withHandle ? /* @__PURE__ */ (0,
|
|
13340
|
+
children: withHandle ? /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
|
|
13260
13341
|
"span",
|
|
13261
13342
|
{
|
|
13262
13343
|
"aria-hidden": true,
|
|
@@ -13272,7 +13353,7 @@ function ResizableHandle({
|
|
|
13272
13353
|
|
|
13273
13354
|
// src/components/SpinButton/SpinButton.tsx
|
|
13274
13355
|
var import_clsx96 = require("clsx");
|
|
13275
|
-
var
|
|
13356
|
+
var import_react49 = require("react");
|
|
13276
13357
|
var import_tokens29 = require("@refineui/tokens");
|
|
13277
13358
|
|
|
13278
13359
|
// src/components/SpinButton/style.ts
|
|
@@ -13296,7 +13377,7 @@ var spinButtonShellClass = formControlShellHeightClass;
|
|
|
13296
13377
|
var spinButtonValueTypo = formControlTypoClass;
|
|
13297
13378
|
|
|
13298
13379
|
// src/components/SpinButton/SpinButton.tsx
|
|
13299
|
-
var
|
|
13380
|
+
var import_jsx_runtime71 = require("react/jsx-runtime");
|
|
13300
13381
|
function SpinButton({
|
|
13301
13382
|
value,
|
|
13302
13383
|
onChange,
|
|
@@ -13310,8 +13391,8 @@ function SpinButton({
|
|
|
13310
13391
|
onKeyDown,
|
|
13311
13392
|
...props
|
|
13312
13393
|
}) {
|
|
13313
|
-
const [draftValue, setDraftValue] = (0,
|
|
13314
|
-
(0,
|
|
13394
|
+
const [draftValue, setDraftValue] = (0, import_react49.useState)(String(value));
|
|
13395
|
+
(0, import_react49.useEffect)(() => {
|
|
13315
13396
|
setDraftValue(String(value));
|
|
13316
13397
|
}, [value]);
|
|
13317
13398
|
const clampValue2 = (next) => {
|
|
@@ -13399,7 +13480,7 @@ function SpinButton({
|
|
|
13399
13480
|
const atMax = max !== void 0 && value >= max;
|
|
13400
13481
|
const atMin = min !== void 0 && value <= min;
|
|
13401
13482
|
const borderClass = disabled ? spinButtonStyles.borderDisabled : spinButtonStyles.borderDefault;
|
|
13402
|
-
return /* @__PURE__ */ (0,
|
|
13483
|
+
return /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)(
|
|
13403
13484
|
"div",
|
|
13404
13485
|
{
|
|
13405
13486
|
role: "spinbutton",
|
|
@@ -13422,7 +13503,7 @@ function SpinButton({
|
|
|
13422
13503
|
...props,
|
|
13423
13504
|
onKeyDown: handleKeyDown,
|
|
13424
13505
|
children: [
|
|
13425
|
-
/* @__PURE__ */ (0,
|
|
13506
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
|
|
13426
13507
|
"div",
|
|
13427
13508
|
{
|
|
13428
13509
|
"aria-live": "polite",
|
|
@@ -13433,7 +13514,7 @@ function SpinButton({
|
|
|
13433
13514
|
disabled ? spinButtonStyles.valueTextDisabled : spinButtonStyles.valueTextDefault,
|
|
13434
13515
|
disabled ? spinButtonStyles.bgDisabled : spinButtonStyles.bgDefault
|
|
13435
13516
|
),
|
|
13436
|
-
children: /* @__PURE__ */ (0,
|
|
13517
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
|
|
13437
13518
|
"input",
|
|
13438
13519
|
{
|
|
13439
13520
|
type: "text",
|
|
@@ -13458,7 +13539,7 @@ function SpinButton({
|
|
|
13458
13539
|
)
|
|
13459
13540
|
}
|
|
13460
13541
|
),
|
|
13461
|
-
/* @__PURE__ */ (0,
|
|
13542
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsxs)(
|
|
13462
13543
|
"div",
|
|
13463
13544
|
{
|
|
13464
13545
|
className: (0, import_clsx96.clsx)(
|
|
@@ -13466,7 +13547,7 @@ function SpinButton({
|
|
|
13466
13547
|
disabled ? spinButtonStyles.bgDisabled : spinButtonStyles.bgDefault
|
|
13467
13548
|
),
|
|
13468
13549
|
children: [
|
|
13469
|
-
/* @__PURE__ */ (0,
|
|
13550
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
|
|
13470
13551
|
"button",
|
|
13471
13552
|
{
|
|
13472
13553
|
type: "button",
|
|
@@ -13478,7 +13559,7 @@ function SpinButton({
|
|
|
13478
13559
|
spinButtonStyles.stepButtonBase,
|
|
13479
13560
|
disabled || atMax ? spinButtonStyles.stepButtonDisabled : spinButtonStyles.stepButtonEnabled
|
|
13480
13561
|
),
|
|
13481
|
-
children: /* @__PURE__ */ (0,
|
|
13562
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
|
|
13482
13563
|
WebIcon,
|
|
13483
13564
|
{
|
|
13484
13565
|
name: "chevron-up",
|
|
@@ -13490,7 +13571,7 @@ function SpinButton({
|
|
|
13490
13571
|
)
|
|
13491
13572
|
}
|
|
13492
13573
|
),
|
|
13493
|
-
/* @__PURE__ */ (0,
|
|
13574
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
|
|
13494
13575
|
"button",
|
|
13495
13576
|
{
|
|
13496
13577
|
type: "button",
|
|
@@ -13502,7 +13583,7 @@ function SpinButton({
|
|
|
13502
13583
|
spinButtonStyles.stepButtonBase,
|
|
13503
13584
|
disabled || atMin ? spinButtonStyles.stepButtonDisabled : spinButtonStyles.stepButtonEnabled
|
|
13504
13585
|
),
|
|
13505
|
-
children: /* @__PURE__ */ (0,
|
|
13586
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
|
|
13506
13587
|
WebIcon,
|
|
13507
13588
|
{
|
|
13508
13589
|
name: "chevron-down",
|
|
@@ -13524,7 +13605,7 @@ function SpinButton({
|
|
|
13524
13605
|
|
|
13525
13606
|
// src/components/Toast/Toast.tsx
|
|
13526
13607
|
var import_clsx98 = require("clsx");
|
|
13527
|
-
var
|
|
13608
|
+
var import_react50 = require("react");
|
|
13528
13609
|
var import_react_dom6 = require("react-dom");
|
|
13529
13610
|
var import_tokens30 = require("@refineui/tokens");
|
|
13530
13611
|
var import_animation7 = require("@refineui/utilities/animation");
|
|
@@ -13561,8 +13642,8 @@ var toastStyles = {
|
|
|
13561
13642
|
};
|
|
13562
13643
|
|
|
13563
13644
|
// src/components/Toast/Toast.tsx
|
|
13564
|
-
var
|
|
13565
|
-
var useIsomorphicLayoutEffect6 = typeof document !== "undefined" ?
|
|
13645
|
+
var import_jsx_runtime72 = require("react/jsx-runtime");
|
|
13646
|
+
var useIsomorphicLayoutEffect6 = typeof document !== "undefined" ? import_react50.useLayoutEffect : import_react50.useEffect;
|
|
13566
13647
|
var ENTER_MS = 20;
|
|
13567
13648
|
var LEAVE_MS = (0, import_animation7.motionMsToNumber)(componentTokens.toast.motion.leave) + 60;
|
|
13568
13649
|
var DEFAULT_DURATION = 4200;
|
|
@@ -13598,7 +13679,7 @@ function subscribeToastStackGap(onChange) {
|
|
|
13598
13679
|
return () => mq.removeEventListener("change", onChange);
|
|
13599
13680
|
}
|
|
13600
13681
|
function useToastStackGapPx() {
|
|
13601
|
-
return (0,
|
|
13682
|
+
return (0, import_react50.useSyncExternalStore)(
|
|
13602
13683
|
subscribeToastStackGap,
|
|
13603
13684
|
readToastStackGapPx,
|
|
13604
13685
|
() => gapPxFromSpacingToken(String(import_tokens30.spacings.sizeLarge))
|
|
@@ -13740,7 +13821,7 @@ var variantIconNames = {
|
|
|
13740
13821
|
error: "error-circle",
|
|
13741
13822
|
warning: "warning"
|
|
13742
13823
|
};
|
|
13743
|
-
var Toast = (0,
|
|
13824
|
+
var Toast = (0, import_react50.forwardRef)(function Toast2(props, ref) {
|
|
13744
13825
|
const { variant = "default", message, iconName, icon, action, className, stackState, style, ...rest } = props;
|
|
13745
13826
|
const domProps = { ...rest };
|
|
13746
13827
|
delete domProps.iconName;
|
|
@@ -13749,7 +13830,7 @@ var Toast = (0, import_react48.forwardRef)(function Toast2(props, ref) {
|
|
|
13749
13830
|
const liveRole = variant === "error" ? "alert" : "status";
|
|
13750
13831
|
const ariaLive = variant === "error" ? void 0 : variant === "warning" ? "assertive" : "polite";
|
|
13751
13832
|
const resolvedIconName = iconName ?? variantIconNames[variant];
|
|
13752
|
-
const iconContent = icon ?? /* @__PURE__ */ (0,
|
|
13833
|
+
const iconContent = icon ?? /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
|
|
13753
13834
|
WebIcon,
|
|
13754
13835
|
{
|
|
13755
13836
|
name: resolvedIconName,
|
|
@@ -13759,7 +13840,7 @@ var Toast = (0, import_react48.forwardRef)(function Toast2(props, ref) {
|
|
|
13759
13840
|
}
|
|
13760
13841
|
);
|
|
13761
13842
|
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,
|
|
13843
|
+
const actionEl = typeof action === "object" && action !== null && "label" in action ? /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
|
|
13763
13844
|
Button,
|
|
13764
13845
|
{
|
|
13765
13846
|
variant: isPrimaryAction ? "primary" : "outline",
|
|
@@ -13775,7 +13856,7 @@ var Toast = (0, import_react48.forwardRef)(function Toast2(props, ref) {
|
|
|
13775
13856
|
borderColor: (0, import_color12.resolveColorTokenValue)(color.border),
|
|
13776
13857
|
color: (0, import_color12.resolveColorTokenValue)(color.message)
|
|
13777
13858
|
};
|
|
13778
|
-
return /* @__PURE__ */ (0,
|
|
13859
|
+
return /* @__PURE__ */ (0, import_jsx_runtime72.jsxs)(
|
|
13779
13860
|
"div",
|
|
13780
13861
|
{
|
|
13781
13862
|
ref,
|
|
@@ -13788,20 +13869,20 @@ var Toast = (0, import_react48.forwardRef)(function Toast2(props, ref) {
|
|
|
13788
13869
|
style: { ...tokenStyle, ...style },
|
|
13789
13870
|
className: (0, import_clsx98.clsx)(toastStyles.card, className),
|
|
13790
13871
|
children: [
|
|
13791
|
-
/* @__PURE__ */ (0,
|
|
13792
|
-
/* @__PURE__ */ (0,
|
|
13872
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsx)("div", { "data-refineui": "toast-icon", className: toastStyles.iconWrap, children: iconContent }),
|
|
13873
|
+
/* @__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
13874
|
action != null && actionEl
|
|
13794
13875
|
]
|
|
13795
13876
|
}
|
|
13796
13877
|
);
|
|
13797
13878
|
});
|
|
13798
13879
|
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,
|
|
13880
|
+
const toastRef = (0, import_react50.useRef)(null);
|
|
13881
|
+
const dragStartRef = (0, import_react50.useRef)(null);
|
|
13882
|
+
const axisRef = (0, import_react50.useRef)(null);
|
|
13883
|
+
const offsetRef = (0, import_react50.useRef)({ x: 0, y: 0 });
|
|
13884
|
+
const [swiping, setSwiping] = (0, import_react50.useState)(false);
|
|
13885
|
+
const clearSwipeOffset = (0, import_react50.useCallback)(() => {
|
|
13805
13886
|
const el = toastRef.current;
|
|
13806
13887
|
offsetRef.current = { x: 0, y: 0 };
|
|
13807
13888
|
if (!el) return;
|
|
@@ -13876,7 +13957,7 @@ function SwipeableToast({ record, index, swipeDirections, onSwipeStart, onSwipeE
|
|
|
13876
13957
|
clearSwipeOffset();
|
|
13877
13958
|
onSwipeEnd();
|
|
13878
13959
|
};
|
|
13879
|
-
return /* @__PURE__ */ (0,
|
|
13960
|
+
return /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
|
|
13880
13961
|
Toast,
|
|
13881
13962
|
{
|
|
13882
13963
|
ref: toastRef,
|
|
@@ -13902,8 +13983,8 @@ function Toaster({
|
|
|
13902
13983
|
swipeDirections,
|
|
13903
13984
|
className
|
|
13904
13985
|
}) {
|
|
13905
|
-
const toasterKeyRef = (0,
|
|
13906
|
-
const isPortalOwner = (0,
|
|
13986
|
+
const toasterKeyRef = (0, import_react50.useRef)(/* @__PURE__ */ Symbol("refineui-toaster"));
|
|
13987
|
+
const isPortalOwner = (0, import_react50.useSyncExternalStore)(
|
|
13907
13988
|
(onStoreChange) => {
|
|
13908
13989
|
toasterOwnerListeners.add(onStoreChange);
|
|
13909
13990
|
return () => toasterOwnerListeners.delete(onStoreChange);
|
|
@@ -13911,12 +13992,12 @@ function Toaster({
|
|
|
13911
13992
|
() => activeToasterKey === toasterKeyRef.current,
|
|
13912
13993
|
() => false
|
|
13913
13994
|
);
|
|
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,
|
|
13995
|
+
const [records, setRecords] = (0, import_react50.useState)([]);
|
|
13996
|
+
const timerMapRef = (0, import_react50.useRef)({});
|
|
13997
|
+
const pausedRef = (0, import_react50.useRef)(/* @__PURE__ */ new Set());
|
|
13998
|
+
const rootRef = (0, import_react50.useRef)(null);
|
|
13999
|
+
const itemRefs = (0, import_react50.useRef)({});
|
|
14000
|
+
const [layoutTick, setLayoutTick] = (0, import_react50.useState)(0);
|
|
13920
14001
|
const stackGapPx = useToastStackGapPx();
|
|
13921
14002
|
const resolvedSwipe = swipeDirections ?? DEFAULT_SWIPE_DIRECTIONS;
|
|
13922
14003
|
useIsomorphicLayoutEffect6(() => {
|
|
@@ -13930,13 +14011,13 @@ function Toaster({
|
|
|
13930
14011
|
}
|
|
13931
14012
|
};
|
|
13932
14013
|
}, []);
|
|
13933
|
-
(0,
|
|
14014
|
+
(0, import_react50.useEffect)(() => {
|
|
13934
14015
|
if (!isPortalOwner) return;
|
|
13935
14016
|
return subscribeToasts((next) => {
|
|
13936
14017
|
setRecords(next.slice(0, Math.max(1, maxToasts)));
|
|
13937
14018
|
});
|
|
13938
14019
|
}, [isPortalOwner, maxToasts]);
|
|
13939
|
-
(0,
|
|
14020
|
+
(0, import_react50.useEffect)(() => {
|
|
13940
14021
|
if (!isPortalOwner) return;
|
|
13941
14022
|
for (const rec of records) {
|
|
13942
14023
|
if (rec.phase === "leaving") continue;
|
|
@@ -13958,7 +14039,7 @@ function Toaster({
|
|
|
13958
14039
|
}
|
|
13959
14040
|
}
|
|
13960
14041
|
}, [isPortalOwner, records]);
|
|
13961
|
-
(0,
|
|
14042
|
+
(0, import_react50.useEffect)(() => {
|
|
13962
14043
|
return () => {
|
|
13963
14044
|
for (const handle of Object.values(timerMapRef.current)) {
|
|
13964
14045
|
clearTimeout(handle);
|
|
@@ -13984,7 +14065,7 @@ function Toaster({
|
|
|
13984
14065
|
li.style.height = `${slotHeight(idx)}px`;
|
|
13985
14066
|
}
|
|
13986
14067
|
}, [isPortalOwner, layoutTick, records, stackGapPx]);
|
|
13987
|
-
(0,
|
|
14068
|
+
(0, import_react50.useEffect)(() => {
|
|
13988
14069
|
if (!isPortalOwner) return;
|
|
13989
14070
|
const root = rootRef.current;
|
|
13990
14071
|
if (!root) return;
|
|
@@ -14018,7 +14099,7 @@ function Toaster({
|
|
|
14018
14099
|
return null;
|
|
14019
14100
|
}
|
|
14020
14101
|
return (0, import_react_dom6.createPortal)(
|
|
14021
|
-
/* @__PURE__ */ (0,
|
|
14102
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
|
|
14022
14103
|
"ol",
|
|
14023
14104
|
{
|
|
14024
14105
|
ref: rootRef,
|
|
@@ -14029,7 +14110,7 @@ function Toaster({
|
|
|
14029
14110
|
style: {
|
|
14030
14111
|
["--refineui-toast-gap"]: `${stackGapPx}px`
|
|
14031
14112
|
},
|
|
14032
|
-
children: records.map((rec, index) => /* @__PURE__ */ (0,
|
|
14113
|
+
children: records.map((rec, index) => /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
|
|
14033
14114
|
"li",
|
|
14034
14115
|
{
|
|
14035
14116
|
ref: (node) => {
|
|
@@ -14043,7 +14124,7 @@ function Toaster({
|
|
|
14043
14124
|
["--refineui-toast-z-index"]: String(STACK_Z_BASE - index),
|
|
14044
14125
|
["--refineui-toast-stack-index"]: String(index)
|
|
14045
14126
|
},
|
|
14046
|
-
children: /* @__PURE__ */ (0,
|
|
14127
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime72.jsx)("div", { "data-refineui": "toast-scale-layer", children: /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
|
|
14047
14128
|
SwipeableToast,
|
|
14048
14129
|
{
|
|
14049
14130
|
record: rec,
|
|
@@ -14064,21 +14145,21 @@ function Toaster({
|
|
|
14064
14145
|
|
|
14065
14146
|
// src/components/Tree/Tree.tsx
|
|
14066
14147
|
var import_clsx100 = require("clsx");
|
|
14067
|
-
var
|
|
14148
|
+
var import_react52 = require("react");
|
|
14068
14149
|
|
|
14069
14150
|
// src/components/Tree/context.ts
|
|
14070
|
-
var
|
|
14151
|
+
var import_react51 = require("react");
|
|
14071
14152
|
var import_tokens31 = require("@refineui/tokens");
|
|
14072
14153
|
var import_animation8 = require("@refineui/utilities/animation");
|
|
14073
14154
|
var TREE_PANEL_MS = Number.parseFloat(import_tokens31.semanticInteraction.duration.accordionPanel) / 1e3;
|
|
14074
14155
|
var TREE_CONTENT_MS = Number.parseFloat(import_tokens31.semanticInteraction.duration.accordionContent) / 1e3;
|
|
14075
14156
|
var TREE_PANEL_EASE = import_tokens31.semanticInteraction.easing.panel;
|
|
14076
14157
|
var TREE_CONTENT_EASE = import_tokens31.semanticInteraction.easing.content;
|
|
14077
|
-
var TreeContext = (0,
|
|
14078
|
-
var TreeItemContext = (0,
|
|
14158
|
+
var TreeContext = (0, import_react51.createContext)(null);
|
|
14159
|
+
var TreeItemContext = (0, import_react51.createContext)(null);
|
|
14079
14160
|
function usePrefersReducedMotion2() {
|
|
14080
|
-
const [reduce, setReduce] = (0,
|
|
14081
|
-
(0,
|
|
14161
|
+
const [reduce, setReduce] = (0, import_react51.useState)(false);
|
|
14162
|
+
(0, import_react51.useEffect)(() => {
|
|
14082
14163
|
const mql = window.matchMedia((0, import_animation8.getReducedMotionQuery)().replace("@media ", ""));
|
|
14083
14164
|
const sync = () => setReduce(mql.matches);
|
|
14084
14165
|
sync();
|
|
@@ -14133,7 +14214,7 @@ var treeItemTypo = {
|
|
|
14133
14214
|
};
|
|
14134
14215
|
|
|
14135
14216
|
// src/components/Tree/Tree.tsx
|
|
14136
|
-
var
|
|
14217
|
+
var import_jsx_runtime73 = require("react/jsx-runtime");
|
|
14137
14218
|
function Tree({
|
|
14138
14219
|
size = "md",
|
|
14139
14220
|
defaultExpanded,
|
|
@@ -14147,29 +14228,29 @@ function Tree({
|
|
|
14147
14228
|
...props
|
|
14148
14229
|
}) {
|
|
14149
14230
|
const reduceMotion = usePrefersReducedMotion2();
|
|
14150
|
-
const [uncontrolledExpanded, setUncontrolledExpanded] = (0,
|
|
14151
|
-
const [uncontrolledSelected, setUncontrolledSelected] = (0,
|
|
14231
|
+
const [uncontrolledExpanded, setUncontrolledExpanded] = (0, import_react52.useState)(() => toExpandedSet(defaultExpanded));
|
|
14232
|
+
const [uncontrolledSelected, setUncontrolledSelected] = (0, import_react52.useState)(defaultSelected ?? null);
|
|
14152
14233
|
const expanded = expandedProp === void 0 ? uncontrolledExpanded : toExpandedSet(expandedProp);
|
|
14153
14234
|
const selected = selectedProp === void 0 ? uncontrolledSelected : selectedProp;
|
|
14154
|
-
const orderRef = (0,
|
|
14155
|
-
const elMapRef = (0,
|
|
14156
|
-
const metaMapRef = (0,
|
|
14157
|
-
const emitExpanded = (0,
|
|
14235
|
+
const orderRef = (0, import_react52.useRef)([]);
|
|
14236
|
+
const elMapRef = (0, import_react52.useRef)(/* @__PURE__ */ new Map());
|
|
14237
|
+
const metaMapRef = (0, import_react52.useRef)(/* @__PURE__ */ new Map());
|
|
14238
|
+
const emitExpanded = (0, import_react52.useCallback)(
|
|
14158
14239
|
(next) => {
|
|
14159
14240
|
if (expandedProp === void 0) setUncontrolledExpanded(next);
|
|
14160
14241
|
onExpandedChange?.(Array.from(next));
|
|
14161
14242
|
},
|
|
14162
14243
|
[expandedProp, onExpandedChange]
|
|
14163
14244
|
);
|
|
14164
|
-
const emitSelected = (0,
|
|
14245
|
+
const emitSelected = (0, import_react52.useCallback)(
|
|
14165
14246
|
(next) => {
|
|
14166
14247
|
if (selectedProp === void 0) setUncontrolledSelected(next);
|
|
14167
14248
|
onSelectedChange?.(next);
|
|
14168
14249
|
},
|
|
14169
14250
|
[onSelectedChange, selectedProp]
|
|
14170
14251
|
);
|
|
14171
|
-
const isExpanded = (0,
|
|
14172
|
-
const toggleExpanded = (0,
|
|
14252
|
+
const isExpanded = (0, import_react52.useCallback)((value) => expanded.has(value), [expanded]);
|
|
14253
|
+
const toggleExpanded = (0, import_react52.useCallback)(
|
|
14173
14254
|
(value) => {
|
|
14174
14255
|
const next = new Set(expanded);
|
|
14175
14256
|
if (next.has(value)) next.delete(value);
|
|
@@ -14178,7 +14259,7 @@ function Tree({
|
|
|
14178
14259
|
},
|
|
14179
14260
|
[emitExpanded, expanded]
|
|
14180
14261
|
);
|
|
14181
|
-
const expand = (0,
|
|
14262
|
+
const expand = (0, import_react52.useCallback)(
|
|
14182
14263
|
(value) => {
|
|
14183
14264
|
if (expanded.has(value)) return;
|
|
14184
14265
|
const next = new Set(expanded);
|
|
@@ -14187,7 +14268,7 @@ function Tree({
|
|
|
14187
14268
|
},
|
|
14188
14269
|
[emitExpanded, expanded]
|
|
14189
14270
|
);
|
|
14190
|
-
const collapse = (0,
|
|
14271
|
+
const collapse = (0, import_react52.useCallback)(
|
|
14191
14272
|
(value) => {
|
|
14192
14273
|
if (!expanded.has(value)) return;
|
|
14193
14274
|
const next = new Set(expanded);
|
|
@@ -14196,13 +14277,13 @@ function Tree({
|
|
|
14196
14277
|
},
|
|
14197
14278
|
[emitExpanded, expanded]
|
|
14198
14279
|
);
|
|
14199
|
-
const select = (0,
|
|
14280
|
+
const select = (0, import_react52.useCallback)(
|
|
14200
14281
|
(value) => {
|
|
14201
14282
|
emitSelected(value);
|
|
14202
14283
|
},
|
|
14203
14284
|
[emitSelected]
|
|
14204
14285
|
);
|
|
14205
|
-
const registerItem = (0,
|
|
14286
|
+
const registerItem = (0, import_react52.useCallback)((value, el, meta) => {
|
|
14206
14287
|
metaMapRef.current.set(value, meta);
|
|
14207
14288
|
if (!orderRef.current.includes(value)) {
|
|
14208
14289
|
orderRef.current.push(value);
|
|
@@ -14214,10 +14295,10 @@ function Tree({
|
|
|
14214
14295
|
orderRef.current = orderRef.current.filter((v) => v !== value);
|
|
14215
14296
|
}
|
|
14216
14297
|
}, []);
|
|
14217
|
-
const focusItem = (0,
|
|
14298
|
+
const focusItem = (0, import_react52.useCallback)((value) => {
|
|
14218
14299
|
elMapRef.current.get(value)?.focus();
|
|
14219
14300
|
}, []);
|
|
14220
|
-
const visibleValues = (0,
|
|
14301
|
+
const visibleValues = (0, import_react52.useCallback)(() => {
|
|
14221
14302
|
const result = [];
|
|
14222
14303
|
const walk = (parent) => {
|
|
14223
14304
|
for (const value of orderRef.current) {
|
|
@@ -14231,7 +14312,7 @@ function Tree({
|
|
|
14231
14312
|
walk(null);
|
|
14232
14313
|
return result;
|
|
14233
14314
|
}, [expanded]);
|
|
14234
|
-
const focusByDelta = (0,
|
|
14315
|
+
const focusByDelta = (0, import_react52.useCallback)(
|
|
14235
14316
|
(currentValue, delta) => {
|
|
14236
14317
|
const list = visibleValues();
|
|
14237
14318
|
const idx = list.indexOf(currentValue);
|
|
@@ -14241,17 +14322,17 @@ function Tree({
|
|
|
14241
14322
|
},
|
|
14242
14323
|
[focusItem, visibleValues]
|
|
14243
14324
|
);
|
|
14244
|
-
const focusFirst = (0,
|
|
14325
|
+
const focusFirst = (0, import_react52.useCallback)(() => {
|
|
14245
14326
|
const list = visibleValues();
|
|
14246
14327
|
if (list[0]) focusItem(list[0]);
|
|
14247
14328
|
}, [focusItem, visibleValues]);
|
|
14248
|
-
const focusLast = (0,
|
|
14329
|
+
const focusLast = (0, import_react52.useCallback)(() => {
|
|
14249
14330
|
const list = visibleValues();
|
|
14250
14331
|
const last = list[list.length - 1];
|
|
14251
14332
|
if (last) focusItem(last);
|
|
14252
14333
|
}, [focusItem, visibleValues]);
|
|
14253
|
-
const getParent = (0,
|
|
14254
|
-
const contextValue = (0,
|
|
14334
|
+
const getParent = (0, import_react52.useCallback)((value) => metaMapRef.current.get(value)?.parentValue ?? null, []);
|
|
14335
|
+
const contextValue = (0, import_react52.useMemo)(
|
|
14255
14336
|
() => ({
|
|
14256
14337
|
size,
|
|
14257
14338
|
isExpanded,
|
|
@@ -14285,7 +14366,7 @@ function Tree({
|
|
|
14285
14366
|
toggleExpanded
|
|
14286
14367
|
]
|
|
14287
14368
|
);
|
|
14288
|
-
return /* @__PURE__ */ (0,
|
|
14369
|
+
return /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(TreeContext.Provider, { value: contextValue, children: /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(
|
|
14289
14370
|
"ul",
|
|
14290
14371
|
{
|
|
14291
14372
|
"data-refineui": "tree",
|
|
@@ -14299,21 +14380,21 @@ function Tree({
|
|
|
14299
14380
|
|
|
14300
14381
|
// src/components/Tree/TreeItem.tsx
|
|
14301
14382
|
var import_clsx101 = require("clsx");
|
|
14302
|
-
var
|
|
14303
|
-
var
|
|
14383
|
+
var import_react53 = require("react");
|
|
14384
|
+
var import_jsx_runtime74 = require("react/jsx-runtime");
|
|
14304
14385
|
function TreeItem({ value, disabled = false, className, children, ...props }) {
|
|
14305
|
-
const tree = (0,
|
|
14306
|
-
const parent = (0,
|
|
14386
|
+
const tree = (0, import_react53.useContext)(TreeContext);
|
|
14387
|
+
const parent = (0, import_react53.useContext)(TreeItemContext);
|
|
14307
14388
|
if (!tree) throw new Error("TreeItem must be used within Tree.");
|
|
14308
|
-
const [hasBranch, setHasBranch] = (0,
|
|
14309
|
-
const uid = (0,
|
|
14389
|
+
const [hasBranch, setHasBranch] = (0, import_react53.useState)(false);
|
|
14390
|
+
const uid = (0, import_react53.useId)().replace(/:/g, "");
|
|
14310
14391
|
const depth = parent ? parent.depth + 1 : 0;
|
|
14311
14392
|
const parentValue = parent?.value ?? null;
|
|
14312
14393
|
const expanded = tree.isExpanded(value);
|
|
14313
14394
|
const selected = tree.selected === value;
|
|
14314
14395
|
const triggerId = `tree-trigger-${uid}-${value}`;
|
|
14315
14396
|
const groupId = `tree-group-${uid}-${value}`;
|
|
14316
|
-
const itemContext = (0,
|
|
14397
|
+
const itemContext = (0, import_react53.useMemo)(
|
|
14317
14398
|
() => ({
|
|
14318
14399
|
value,
|
|
14319
14400
|
depth,
|
|
@@ -14328,7 +14409,7 @@ function TreeItem({ value, disabled = false, className, children, ...props }) {
|
|
|
14328
14409
|
}),
|
|
14329
14410
|
[value, depth, parentValue, expanded, selected, disabled, hasBranch, triggerId, groupId]
|
|
14330
14411
|
);
|
|
14331
|
-
return /* @__PURE__ */ (0,
|
|
14412
|
+
return /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(TreeItemContext.Provider, { value: itemContext, children: /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
|
|
14332
14413
|
"li",
|
|
14333
14414
|
{
|
|
14334
14415
|
"data-refineui": "tree-item",
|
|
@@ -14349,18 +14430,18 @@ function TreeItem({ value, disabled = false, className, children, ...props }) {
|
|
|
14349
14430
|
|
|
14350
14431
|
// src/components/Tree/TreeItemTrigger.tsx
|
|
14351
14432
|
var import_clsx102 = require("clsx");
|
|
14352
|
-
var
|
|
14353
|
-
var
|
|
14433
|
+
var import_react54 = require("react");
|
|
14434
|
+
var import_jsx_runtime75 = require("react/jsx-runtime");
|
|
14354
14435
|
function TreeItemTrigger({ className, children, onClick, onKeyDown, ...props }) {
|
|
14355
|
-
const tree = (0,
|
|
14356
|
-
const item = (0,
|
|
14436
|
+
const tree = (0, import_react54.useContext)(TreeContext);
|
|
14437
|
+
const item = (0, import_react54.useContext)(TreeItemContext);
|
|
14357
14438
|
if (!tree || !item) throw new Error("TreeItemTrigger must be used within TreeItem.");
|
|
14358
14439
|
const iconSize = treeIconSize[tree.size];
|
|
14359
14440
|
const depthIndent = "calc(var(--refineui-spacing-size-large) + var(--refineui-spacing-size-x-small))";
|
|
14360
14441
|
const mainStyle = {
|
|
14361
14442
|
paddingInlineStart: item.depth > 0 ? `calc(${depthIndent} * ${item.depth})` : void 0
|
|
14362
14443
|
};
|
|
14363
|
-
(0,
|
|
14444
|
+
(0, import_react54.useEffect)(() => {
|
|
14364
14445
|
return () => {
|
|
14365
14446
|
tree.registerItem(item.value, null, {
|
|
14366
14447
|
parentValue: item.parentValue,
|
|
@@ -14436,7 +14517,7 @@ function TreeItemTrigger({ className, children, onClick, onKeyDown, ...props })
|
|
|
14436
14517
|
break;
|
|
14437
14518
|
}
|
|
14438
14519
|
};
|
|
14439
|
-
return /* @__PURE__ */ (0,
|
|
14520
|
+
return /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(
|
|
14440
14521
|
"div",
|
|
14441
14522
|
{
|
|
14442
14523
|
ref: setRowRef,
|
|
@@ -14455,8 +14536,8 @@ function TreeItemTrigger({ className, children, onClick, onKeyDown, ...props })
|
|
|
14455
14536
|
className
|
|
14456
14537
|
),
|
|
14457
14538
|
...props,
|
|
14458
|
-
children: /* @__PURE__ */ (0,
|
|
14459
|
-
item.hasBranch ? /* @__PURE__ */ (0,
|
|
14539
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime75.jsxs)("div", { "data-refineui": "tree-item-main", className: treeStyles.rowMain, style: mainStyle, children: [
|
|
14540
|
+
item.hasBranch ? /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(
|
|
14460
14541
|
"button",
|
|
14461
14542
|
{
|
|
14462
14543
|
type: "button",
|
|
@@ -14470,10 +14551,10 @@ function TreeItemTrigger({ className, children, onClick, onKeyDown, ...props })
|
|
|
14470
14551
|
item.expanded && treeStyles.chevronExpanded,
|
|
14471
14552
|
tree.reduceMotion && "transition-none"
|
|
14472
14553
|
),
|
|
14473
|
-
children: /* @__PURE__ */ (0,
|
|
14554
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(WebIcon, { name: "chevron-right", size: iconSize, color: "currentColor", fallback: "\u203A" })
|
|
14474
14555
|
}
|
|
14475
|
-
) : /* @__PURE__ */ (0,
|
|
14476
|
-
/* @__PURE__ */ (0,
|
|
14556
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime75.jsx)("span", { className: treeStyles.chevronSpacer, "aria-hidden": "true" }),
|
|
14557
|
+
/* @__PURE__ */ (0, import_jsx_runtime75.jsx)("span", { className: treeStyles.label, children })
|
|
14477
14558
|
] })
|
|
14478
14559
|
}
|
|
14479
14560
|
);
|
|
@@ -14481,14 +14562,14 @@ function TreeItemTrigger({ className, children, onClick, onKeyDown, ...props })
|
|
|
14481
14562
|
|
|
14482
14563
|
// src/components/Tree/TreeItemContent.tsx
|
|
14483
14564
|
var import_clsx103 = require("clsx");
|
|
14484
|
-
var
|
|
14485
|
-
var
|
|
14565
|
+
var import_react55 = require("react");
|
|
14566
|
+
var import_jsx_runtime76 = require("react/jsx-runtime");
|
|
14486
14567
|
function TreeItemContent({ className, children, ...props }) {
|
|
14487
|
-
const tree = (0,
|
|
14488
|
-
const item = (0,
|
|
14568
|
+
const tree = (0, import_react55.useContext)(TreeContext);
|
|
14569
|
+
const item = (0, import_react55.useContext)(TreeItemContext);
|
|
14489
14570
|
if (!tree || !item) throw new Error("TreeItemContent must be used within TreeItem.");
|
|
14490
14571
|
const { setHasBranch, expanded, groupId, triggerId } = item;
|
|
14491
|
-
(0,
|
|
14572
|
+
(0, import_react55.useLayoutEffect)(() => {
|
|
14492
14573
|
setHasBranch(true);
|
|
14493
14574
|
return () => setHasBranch(false);
|
|
14494
14575
|
}, [setHasBranch]);
|
|
@@ -14503,7 +14584,7 @@ function TreeItemContent({ className, children, ...props }) {
|
|
|
14503
14584
|
transition: tree.reduceMotion ? void 0 : `opacity ${TREE_CONTENT_MS}s ${TREE_CONTENT_EASE}, transform ${TREE_CONTENT_MS}s ${TREE_CONTENT_EASE}`,
|
|
14504
14585
|
pointerEvents: expanded ? void 0 : "none"
|
|
14505
14586
|
};
|
|
14506
|
-
return /* @__PURE__ */ (0,
|
|
14587
|
+
return /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(
|
|
14507
14588
|
"div",
|
|
14508
14589
|
{
|
|
14509
14590
|
ref: (el) => {
|
|
@@ -14514,7 +14595,7 @@ function TreeItemContent({ className, children, ...props }) {
|
|
|
14514
14595
|
"data-refineui": "tree-item-panel",
|
|
14515
14596
|
"aria-hidden": !expanded,
|
|
14516
14597
|
style: gridStyle,
|
|
14517
|
-
children: /* @__PURE__ */ (0,
|
|
14598
|
+
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
14599
|
"ul",
|
|
14519
14600
|
{
|
|
14520
14601
|
id: groupId,
|
|
@@ -14532,9 +14613,9 @@ function TreeItemContent({ className, children, ...props }) {
|
|
|
14532
14613
|
|
|
14533
14614
|
// src/components/Tooltip/Tooltip.tsx
|
|
14534
14615
|
var import_clsx105 = require("clsx");
|
|
14535
|
-
var
|
|
14616
|
+
var import_react56 = require("react");
|
|
14536
14617
|
var import_color13 = require("@refineui/utilities/color");
|
|
14537
|
-
var
|
|
14618
|
+
var import_react57 = require("@refineui/utilities/react");
|
|
14538
14619
|
|
|
14539
14620
|
// src/components/Tooltip/style.ts
|
|
14540
14621
|
var import_tokens33 = require("@refineui/tokens");
|
|
@@ -14638,7 +14719,7 @@ function tooltipBeakRotateDeg(position) {
|
|
|
14638
14719
|
}
|
|
14639
14720
|
|
|
14640
14721
|
// src/components/Tooltip/Tooltip.tsx
|
|
14641
|
-
var
|
|
14722
|
+
var import_jsx_runtime77 = require("react/jsx-runtime");
|
|
14642
14723
|
function Tooltip({
|
|
14643
14724
|
trigger,
|
|
14644
14725
|
content,
|
|
@@ -14651,10 +14732,10 @@ function Tooltip({
|
|
|
14651
14732
|
className,
|
|
14652
14733
|
...props
|
|
14653
14734
|
}) {
|
|
14654
|
-
const [innerOpen, setInnerOpen] = (0,
|
|
14735
|
+
const [innerOpen, setInnerOpen] = (0, import_react56.useState)(defaultOpen);
|
|
14655
14736
|
const open = ctrlOpen !== void 0 ? ctrlOpen : innerOpen;
|
|
14656
|
-
const tooltipId = (0,
|
|
14657
|
-
const showTimer = (0,
|
|
14737
|
+
const tooltipId = (0, import_react56.useId)();
|
|
14738
|
+
const showTimer = (0, import_react56.useRef)(null);
|
|
14658
14739
|
const setOpen = (next) => {
|
|
14659
14740
|
if (ctrlOpen === void 0) setInnerOpen(next);
|
|
14660
14741
|
onOpenChange?.(next);
|
|
@@ -14681,11 +14762,11 @@ function Tooltip({
|
|
|
14681
14762
|
const beakWrapStyle = tooltipBeakWrapperStyle(position, align);
|
|
14682
14763
|
const beakRot = tooltipBeakRotateDeg(position);
|
|
14683
14764
|
const describedBy = open ? tooltipId : void 0;
|
|
14684
|
-
const mergeEl = (0,
|
|
14765
|
+
const mergeEl = (0, import_react57.getMergeableTriggerChild)(trigger);
|
|
14685
14766
|
let triggerNode;
|
|
14686
14767
|
if (mergeEl != null) {
|
|
14687
|
-
triggerNode = /* @__PURE__ */ (0,
|
|
14688
|
-
|
|
14768
|
+
triggerNode = /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(
|
|
14769
|
+
import_react57.Slot,
|
|
14689
14770
|
{
|
|
14690
14771
|
"aria-describedby": describedBy,
|
|
14691
14772
|
onMouseEnter: scheduleShow,
|
|
@@ -14701,7 +14782,7 @@ function Tooltip({
|
|
|
14701
14782
|
}
|
|
14702
14783
|
);
|
|
14703
14784
|
} else {
|
|
14704
|
-
triggerNode = /* @__PURE__ */ (0,
|
|
14785
|
+
triggerNode = /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(
|
|
14705
14786
|
"span",
|
|
14706
14787
|
{
|
|
14707
14788
|
tabIndex: 0,
|
|
@@ -14718,16 +14799,16 @@ function Tooltip({
|
|
|
14718
14799
|
}
|
|
14719
14800
|
);
|
|
14720
14801
|
}
|
|
14721
|
-
return /* @__PURE__ */ (0,
|
|
14802
|
+
return /* @__PURE__ */ (0, import_jsx_runtime77.jsxs)("div", { "data-refineui": "tooltip", className: (0, import_clsx105.clsx)(tooltipStyles.root, className), ...props, children: [
|
|
14722
14803
|
triggerNode,
|
|
14723
|
-
open && /* @__PURE__ */ (0,
|
|
14724
|
-
/* @__PURE__ */ (0,
|
|
14804
|
+
open && /* @__PURE__ */ (0, import_jsx_runtime77.jsx)("div", { className: tooltipStyles.floating, style: floatingStyle, children: /* @__PURE__ */ (0, import_jsx_runtime77.jsxs)("div", { className: tooltipStyles.panelWrap, children: [
|
|
14805
|
+
/* @__PURE__ */ (0, import_jsx_runtime77.jsx)(
|
|
14725
14806
|
"div",
|
|
14726
14807
|
{
|
|
14727
14808
|
className: tooltipStyles.beakWrap,
|
|
14728
14809
|
style: { ...beakWrapStyle, width: TOOLTIP_BEAK_W, height: TOOLTIP_BEAK_H },
|
|
14729
14810
|
"aria-hidden": true,
|
|
14730
|
-
children: /* @__PURE__ */ (0,
|
|
14811
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(
|
|
14731
14812
|
"div",
|
|
14732
14813
|
{
|
|
14733
14814
|
style: {
|
|
@@ -14736,7 +14817,7 @@ function Tooltip({
|
|
|
14736
14817
|
transform: `rotate(${beakRot}deg)`,
|
|
14737
14818
|
transformOrigin: "center center"
|
|
14738
14819
|
},
|
|
14739
|
-
children: /* @__PURE__ */ (0,
|
|
14820
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime77.jsxs)(
|
|
14740
14821
|
"svg",
|
|
14741
14822
|
{
|
|
14742
14823
|
width: TOOLTIP_BEAK_W,
|
|
@@ -14746,8 +14827,8 @@ function Tooltip({
|
|
|
14746
14827
|
xmlns: "http://www.w3.org/2000/svg",
|
|
14747
14828
|
style: { display: "block" },
|
|
14748
14829
|
children: [
|
|
14749
|
-
/* @__PURE__ */ (0,
|
|
14750
|
-
/* @__PURE__ */ (0,
|
|
14830
|
+
/* @__PURE__ */ (0, import_jsx_runtime77.jsx)("polygon", { points: "8,0 0,8 16,8", fill: borderCol }),
|
|
14831
|
+
/* @__PURE__ */ (0, import_jsx_runtime77.jsx)("polygon", { points: "8,2 2,8 14,8", fill: bg })
|
|
14751
14832
|
]
|
|
14752
14833
|
}
|
|
14753
14834
|
)
|
|
@@ -14755,7 +14836,7 @@ function Tooltip({
|
|
|
14755
14836
|
)
|
|
14756
14837
|
}
|
|
14757
14838
|
),
|
|
14758
|
-
/* @__PURE__ */ (0,
|
|
14839
|
+
/* @__PURE__ */ (0, import_jsx_runtime77.jsx)(
|
|
14759
14840
|
"div",
|
|
14760
14841
|
{
|
|
14761
14842
|
id: tooltipId,
|
|
@@ -14778,7 +14859,7 @@ function Tooltip({
|
|
|
14778
14859
|
|
|
14779
14860
|
// src/components/Chart/Chart.tsx
|
|
14780
14861
|
var import_clsx107 = require("clsx");
|
|
14781
|
-
var
|
|
14862
|
+
var import_react58 = require("react");
|
|
14782
14863
|
var import_tokens35 = require("@refineui/tokens");
|
|
14783
14864
|
var import_color14 = require("@refineui/utilities/color");
|
|
14784
14865
|
|
|
@@ -15005,10 +15086,10 @@ function formatAxisTick(value) {
|
|
|
15005
15086
|
}
|
|
15006
15087
|
|
|
15007
15088
|
// src/components/Chart/Chart.tsx
|
|
15008
|
-
var
|
|
15009
|
-
var ChartContext = (0,
|
|
15089
|
+
var import_jsx_runtime78 = require("react/jsx-runtime");
|
|
15090
|
+
var ChartContext = (0, import_react58.createContext)(null);
|
|
15010
15091
|
function useChartContext(component) {
|
|
15011
|
-
const value = (0,
|
|
15092
|
+
const value = (0, import_react58.useContext)(ChartContext);
|
|
15012
15093
|
if (!value) throw new Error(`${component} must be used within Chart.`);
|
|
15013
15094
|
return value;
|
|
15014
15095
|
}
|
|
@@ -15038,15 +15119,15 @@ function itemState(index, hoverIndex, selectedIndex) {
|
|
|
15038
15119
|
return "default";
|
|
15039
15120
|
}
|
|
15040
15121
|
function isChartTooltipElement(node) {
|
|
15041
|
-
return (0,
|
|
15122
|
+
return (0, import_react58.isValidElement)(node) && node.type === ChartTooltip;
|
|
15042
15123
|
}
|
|
15043
15124
|
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,
|
|
15125
|
+
const [hoverIndex, setHoverIndex] = (0, import_react58.useState)(null);
|
|
15126
|
+
const [selectedIndex, setSelectedIndex] = (0, import_react58.useState)(null);
|
|
15127
|
+
const [pointer, setPointer] = (0, import_react58.useState)(null);
|
|
15128
|
+
const [labels, setLabels] = (0, import_react58.useState)([]);
|
|
15129
|
+
const [series, setSeries] = (0, import_react58.useState)(null);
|
|
15130
|
+
const context = (0, import_react58.useMemo)(
|
|
15050
15131
|
() => ({
|
|
15051
15132
|
hoverIndex,
|
|
15052
15133
|
selectedIndex,
|
|
@@ -15061,7 +15142,7 @@ function Chart({ className, children, ...props }) {
|
|
|
15061
15142
|
}),
|
|
15062
15143
|
[hoverIndex, selectedIndex, pointer, labels, series]
|
|
15063
15144
|
);
|
|
15064
|
-
return /* @__PURE__ */ (0,
|
|
15145
|
+
return /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(ChartContext.Provider, { value: context, children: /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
|
|
15065
15146
|
"div",
|
|
15066
15147
|
{
|
|
15067
15148
|
"data-refineui": "chart",
|
|
@@ -15072,7 +15153,7 @@ function Chart({ className, children, ...props }) {
|
|
|
15072
15153
|
) });
|
|
15073
15154
|
}
|
|
15074
15155
|
function ChartBody({ className, ...props }) {
|
|
15075
|
-
return /* @__PURE__ */ (0,
|
|
15156
|
+
return /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
|
|
15076
15157
|
"div",
|
|
15077
15158
|
{
|
|
15078
15159
|
"data-refineui": "chart-body",
|
|
@@ -15082,7 +15163,7 @@ function ChartBody({ className, ...props }) {
|
|
|
15082
15163
|
);
|
|
15083
15164
|
}
|
|
15084
15165
|
function ChartContent({ className, ...props }) {
|
|
15085
|
-
return /* @__PURE__ */ (0,
|
|
15166
|
+
return /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
|
|
15086
15167
|
"div",
|
|
15087
15168
|
{
|
|
15088
15169
|
"data-refineui": "chart-content",
|
|
@@ -15107,7 +15188,7 @@ function ChartHitArea() {
|
|
|
15107
15188
|
setHoverIndex(hoverIndexFromPlotX(next.x, count, series.align));
|
|
15108
15189
|
return next;
|
|
15109
15190
|
};
|
|
15110
|
-
return /* @__PURE__ */ (0,
|
|
15191
|
+
return /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
|
|
15111
15192
|
"rect",
|
|
15112
15193
|
{
|
|
15113
15194
|
"data-refineui": "chart-hit-area",
|
|
@@ -15141,11 +15222,11 @@ function ChartPlot({
|
|
|
15141
15222
|
const { pointer, selectedIndex } = useChartContext("ChartPlot");
|
|
15142
15223
|
const svgChildren = [];
|
|
15143
15224
|
const tooltipNodes = [];
|
|
15144
|
-
|
|
15225
|
+
import_react58.Children.forEach(children, (child) => {
|
|
15145
15226
|
if (isChartTooltipElement(child)) tooltipNodes.push(child);
|
|
15146
15227
|
else svgChildren.push(child);
|
|
15147
15228
|
});
|
|
15148
|
-
return /* @__PURE__ */ (0,
|
|
15229
|
+
return /* @__PURE__ */ (0, import_jsx_runtime78.jsxs)(
|
|
15149
15230
|
"div",
|
|
15150
15231
|
{
|
|
15151
15232
|
"data-refineui": "chart-plot-frame",
|
|
@@ -15154,7 +15235,7 @@ function ChartPlot({
|
|
|
15154
15235
|
className: (0, import_clsx107.clsx)(chartStyles.plotFrame, className),
|
|
15155
15236
|
...props,
|
|
15156
15237
|
children: [
|
|
15157
|
-
/* @__PURE__ */ (0,
|
|
15238
|
+
/* @__PURE__ */ (0, import_jsx_runtime78.jsxs)(
|
|
15158
15239
|
"svg",
|
|
15159
15240
|
{
|
|
15160
15241
|
"data-refineui": "chart-plot",
|
|
@@ -15165,7 +15246,7 @@ function ChartPlot({
|
|
|
15165
15246
|
className: chartStyles.plot,
|
|
15166
15247
|
children: [
|
|
15167
15248
|
svgChildren,
|
|
15168
|
-
/* @__PURE__ */ (0,
|
|
15249
|
+
/* @__PURE__ */ (0, import_jsx_runtime78.jsx)(ChartHitArea, {})
|
|
15169
15250
|
]
|
|
15170
15251
|
}
|
|
15171
15252
|
),
|
|
@@ -15183,7 +15264,7 @@ function ChartTooltip({ className, children, style, ...props }) {
|
|
|
15183
15264
|
const flipY = pointer.y < CHART_PLOT_PADDING_TOP + plotHeight() * CHART_TOOLTIP_FLIP_Y;
|
|
15184
15265
|
const offsetX = flipX ? "calc(-100% - var(--refineui-spacing-size-small))" : "var(--refineui-spacing-size-small)";
|
|
15185
15266
|
const offsetY = flipY ? "var(--refineui-spacing-size-small)" : "calc(-100% - var(--refineui-spacing-size-x-small))";
|
|
15186
|
-
return /* @__PURE__ */ (0,
|
|
15267
|
+
return /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
|
|
15187
15268
|
"div",
|
|
15188
15269
|
{
|
|
15189
15270
|
"data-refineui": "chart-tooltip",
|
|
@@ -15196,9 +15277,9 @@ function ChartTooltip({ className, children, style, ...props }) {
|
|
|
15196
15277
|
...style
|
|
15197
15278
|
},
|
|
15198
15279
|
...props,
|
|
15199
|
-
children: children ?? /* @__PURE__ */ (0,
|
|
15200
|
-
label ? /* @__PURE__ */ (0,
|
|
15201
|
-
/* @__PURE__ */ (0,
|
|
15280
|
+
children: children ?? /* @__PURE__ */ (0, import_jsx_runtime78.jsxs)(import_jsx_runtime78.Fragment, { children: [
|
|
15281
|
+
label ? /* @__PURE__ */ (0, import_jsx_runtime78.jsx)("span", { className: chartStyles.tooltipLabel, children: label }) : null,
|
|
15282
|
+
/* @__PURE__ */ (0, import_jsx_runtime78.jsx)("span", { className: chartStyles.tooltipValue, children: formatAxisTick(value) })
|
|
15202
15283
|
] })
|
|
15203
15284
|
}
|
|
15204
15285
|
);
|
|
@@ -15213,14 +15294,14 @@ function ChartYAxisLabels({
|
|
|
15213
15294
|
}) {
|
|
15214
15295
|
const scaleMax = resolveScale(values, max);
|
|
15215
15296
|
const ticks = yAxisTicks(scaleMax, lines).slice().reverse();
|
|
15216
|
-
return /* @__PURE__ */ (0,
|
|
15297
|
+
return /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
|
|
15217
15298
|
"div",
|
|
15218
15299
|
{
|
|
15219
15300
|
"data-refineui": "chart-y-axis",
|
|
15220
15301
|
className: (0, import_clsx107.clsx)(chartStyles.yAxis, className),
|
|
15221
15302
|
"aria-hidden": true,
|
|
15222
15303
|
...props,
|
|
15223
|
-
children: ticks.map((tick) => /* @__PURE__ */ (0,
|
|
15304
|
+
children: ticks.map((tick) => /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
|
|
15224
15305
|
"span",
|
|
15225
15306
|
{
|
|
15226
15307
|
className: chartStyles.yAxisTick,
|
|
@@ -15243,12 +15324,12 @@ function ChartGrid({
|
|
|
15243
15324
|
const ticks = yAxisTicks(scaleMax, lines);
|
|
15244
15325
|
const gridColor = gridStroke();
|
|
15245
15326
|
const baselineColor = gridBaselineStroke();
|
|
15246
|
-
return /* @__PURE__ */ (0,
|
|
15327
|
+
return /* @__PURE__ */ (0, import_jsx_runtime78.jsx)("g", { "data-refineui": "chart-grid", className, ...props, children: ticks.map((tick, index) => {
|
|
15247
15328
|
const y = gridLineY(scaleMax, tick);
|
|
15248
15329
|
const isBaseline = index === 0;
|
|
15249
15330
|
const isTop = index === ticks.length - 1;
|
|
15250
15331
|
if (isTop) return null;
|
|
15251
|
-
return /* @__PURE__ */ (0,
|
|
15332
|
+
return /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
|
|
15252
15333
|
"line",
|
|
15253
15334
|
{
|
|
15254
15335
|
x1: CHART_PLOT_PADDING_X,
|
|
@@ -15280,13 +15361,13 @@ function ChartBars({
|
|
|
15280
15361
|
const barRadius = Math.min(CHART_BAR_RADIUS, barWidth / 2);
|
|
15281
15362
|
const baselineY = plotBaselineY();
|
|
15282
15363
|
const trackHeight = plotHeight();
|
|
15283
|
-
(0,
|
|
15364
|
+
(0, import_react58.useLayoutEffect)(() => {
|
|
15284
15365
|
setSeries({ values, seriesColor, max, align: "bar" });
|
|
15285
15366
|
}, [values, seriesColor, max, setSeries]);
|
|
15286
|
-
return /* @__PURE__ */ (0,
|
|
15367
|
+
return /* @__PURE__ */ (0, import_jsx_runtime78.jsxs)("g", { "data-refineui": "chart-bars", "data-series-color": seriesColor, className, ...props, children: [
|
|
15287
15368
|
showTrack ? values.map((_, index) => {
|
|
15288
15369
|
const x = barX(index, values.length);
|
|
15289
|
-
return /* @__PURE__ */ (0,
|
|
15370
|
+
return /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
|
|
15290
15371
|
"path",
|
|
15291
15372
|
{
|
|
15292
15373
|
"data-refineui": "chart-bar-track",
|
|
@@ -15308,7 +15389,7 @@ function ChartBars({
|
|
|
15308
15389
|
const height = baselineY - y;
|
|
15309
15390
|
if (height <= 0) return null;
|
|
15310
15391
|
const state = itemState(index, hoverIndex, selectedIndex);
|
|
15311
|
-
return /* @__PURE__ */ (0,
|
|
15392
|
+
return /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
|
|
15312
15393
|
"path",
|
|
15313
15394
|
{
|
|
15314
15395
|
"data-refineui": "chart-bar",
|
|
@@ -15331,20 +15412,20 @@ function ChartLine({
|
|
|
15331
15412
|
...props
|
|
15332
15413
|
}) {
|
|
15333
15414
|
const { hoverIndex, selectedIndex, setSeries } = useChartContext("ChartLine");
|
|
15334
|
-
const gradientId = (0,
|
|
15415
|
+
const gradientId = (0, import_react58.useId)().replace(/:/g, "");
|
|
15335
15416
|
const scaleMax = resolveChartScale(values, max);
|
|
15336
15417
|
const stroke = seriesColorToken(seriesColor);
|
|
15337
15418
|
const coords = linePointCoords(values, scaleMax);
|
|
15338
15419
|
const baselineY = plotBaselineY();
|
|
15339
15420
|
const pointRing = pointStrokeColor();
|
|
15340
15421
|
const linePath = monotoneLinePath(coords);
|
|
15341
|
-
(0,
|
|
15422
|
+
(0, import_react58.useLayoutEffect)(() => {
|
|
15342
15423
|
setSeries({ values, seriesColor, max, align: "line" });
|
|
15343
15424
|
}, [values, seriesColor, max, setSeries]);
|
|
15344
|
-
return /* @__PURE__ */ (0,
|
|
15345
|
-
showArea && coords.length > 1 ? /* @__PURE__ */ (0,
|
|
15346
|
-
/* @__PURE__ */ (0,
|
|
15347
|
-
/* @__PURE__ */ (0,
|
|
15425
|
+
return /* @__PURE__ */ (0, import_jsx_runtime78.jsxs)("g", { "data-refineui": "chart-line", "data-series-color": seriesColor, className, ...props, children: [
|
|
15426
|
+
showArea && coords.length > 1 ? /* @__PURE__ */ (0, import_jsx_runtime78.jsxs)(import_jsx_runtime78.Fragment, { children: [
|
|
15427
|
+
/* @__PURE__ */ (0, import_jsx_runtime78.jsx)("defs", { children: /* @__PURE__ */ (0, import_jsx_runtime78.jsxs)("linearGradient", { id: gradientId, x1: "0", y1: "0", x2: "0", y2: "1", children: [
|
|
15428
|
+
/* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
|
|
15348
15429
|
"stop",
|
|
15349
15430
|
{
|
|
15350
15431
|
offset: "0%",
|
|
@@ -15352,9 +15433,9 @@ function ChartLine({
|
|
|
15352
15433
|
stopOpacity: import_tokens35.opacities.opacityDisabled
|
|
15353
15434
|
}
|
|
15354
15435
|
),
|
|
15355
|
-
/* @__PURE__ */ (0,
|
|
15436
|
+
/* @__PURE__ */ (0, import_jsx_runtime78.jsx)("stop", { offset: "100%", stopColor: stroke, stopOpacity: "0" })
|
|
15356
15437
|
] }) }),
|
|
15357
|
-
/* @__PURE__ */ (0,
|
|
15438
|
+
/* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
|
|
15358
15439
|
"path",
|
|
15359
15440
|
{
|
|
15360
15441
|
"data-refineui": "chart-line-area",
|
|
@@ -15363,7 +15444,7 @@ function ChartLine({
|
|
|
15363
15444
|
}
|
|
15364
15445
|
)
|
|
15365
15446
|
] }) : null,
|
|
15366
|
-
/* @__PURE__ */ (0,
|
|
15447
|
+
/* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
|
|
15367
15448
|
"path",
|
|
15368
15449
|
{
|
|
15369
15450
|
"data-refineui": "chart-line-stroke",
|
|
@@ -15381,7 +15462,7 @@ function ChartLine({
|
|
|
15381
15462
|
const state = itemState(index, hoverIndex, selectedIndex);
|
|
15382
15463
|
const visible = showPoints || state !== "default";
|
|
15383
15464
|
if (!visible) return null;
|
|
15384
|
-
return /* @__PURE__ */ (0,
|
|
15465
|
+
return /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
|
|
15385
15466
|
"circle",
|
|
15386
15467
|
{
|
|
15387
15468
|
"data-refineui": "chart-point",
|
|
@@ -15407,10 +15488,10 @@ function ChartAxisLabels({
|
|
|
15407
15488
|
const { hoverIndex, selectedIndex, setLabels } = useChartContext("ChartAxisLabels");
|
|
15408
15489
|
const count = labels.length;
|
|
15409
15490
|
const centerAt = align === "line" ? linePointCenterRatio : barBandCenterRatio;
|
|
15410
|
-
(0,
|
|
15491
|
+
(0, import_react58.useLayoutEffect)(() => {
|
|
15411
15492
|
setLabels(labels);
|
|
15412
15493
|
}, [labels, setLabels]);
|
|
15413
|
-
return /* @__PURE__ */ (0,
|
|
15494
|
+
return /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
|
|
15414
15495
|
"div",
|
|
15415
15496
|
{
|
|
15416
15497
|
"data-refineui": "chart-axis-labels",
|
|
@@ -15419,7 +15500,7 @@ function ChartAxisLabels({
|
|
|
15419
15500
|
...props,
|
|
15420
15501
|
children: labels.map((label, index) => {
|
|
15421
15502
|
const state = itemState(index, hoverIndex, selectedIndex);
|
|
15422
|
-
return /* @__PURE__ */ (0,
|
|
15503
|
+
return /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
|
|
15423
15504
|
"span",
|
|
15424
15505
|
{
|
|
15425
15506
|
"data-state": state,
|
|
@@ -15437,7 +15518,7 @@ function ChartAxisLabels({
|
|
|
15437
15518
|
);
|
|
15438
15519
|
}
|
|
15439
15520
|
function ChartLegend({ className, ...props }) {
|
|
15440
|
-
return /* @__PURE__ */ (0,
|
|
15521
|
+
return /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
|
|
15441
15522
|
"ul",
|
|
15442
15523
|
{
|
|
15443
15524
|
"data-refineui": "chart-legend",
|
|
@@ -15453,7 +15534,7 @@ function ChartLegendItem({
|
|
|
15453
15534
|
style,
|
|
15454
15535
|
...props
|
|
15455
15536
|
}) {
|
|
15456
|
-
return /* @__PURE__ */ (0,
|
|
15537
|
+
return /* @__PURE__ */ (0, import_jsx_runtime78.jsxs)(
|
|
15457
15538
|
"li",
|
|
15458
15539
|
{
|
|
15459
15540
|
"data-refineui": "chart-legend-item",
|
|
@@ -15461,7 +15542,7 @@ function ChartLegendItem({
|
|
|
15461
15542
|
className: (0, import_clsx107.clsx)(chartStyles.legendItem, className),
|
|
15462
15543
|
...props,
|
|
15463
15544
|
children: [
|
|
15464
|
-
/* @__PURE__ */ (0,
|
|
15545
|
+
/* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
|
|
15465
15546
|
"span",
|
|
15466
15547
|
{
|
|
15467
15548
|
"aria-hidden": true,
|
|
@@ -15476,26 +15557,26 @@ function ChartLegendItem({
|
|
|
15476
15557
|
}
|
|
15477
15558
|
|
|
15478
15559
|
// src/components/Slot/Slot.tsx
|
|
15479
|
-
var
|
|
15560
|
+
var import_react59 = require("@refineui/utilities/react");
|
|
15480
15561
|
|
|
15481
15562
|
// src/components/Collapsible/Collapsible.tsx
|
|
15482
|
-
var
|
|
15563
|
+
var import_react61 = require("react");
|
|
15483
15564
|
var import_clsx108 = require("clsx");
|
|
15484
|
-
var
|
|
15565
|
+
var import_react62 = require("@refineui/utilities/react");
|
|
15485
15566
|
|
|
15486
15567
|
// src/components/Collapsible/context.ts
|
|
15487
|
-
var
|
|
15568
|
+
var import_react60 = require("react");
|
|
15488
15569
|
var import_tokens36 = require("@refineui/tokens");
|
|
15489
15570
|
var import_animation9 = require("@refineui/utilities/animation");
|
|
15490
|
-
var CollapsibleContext = (0,
|
|
15571
|
+
var CollapsibleContext = (0, import_react60.createContext)(null);
|
|
15491
15572
|
function useCollapsibleContext(part) {
|
|
15492
|
-
const value = (0,
|
|
15573
|
+
const value = (0, import_react60.useContext)(CollapsibleContext);
|
|
15493
15574
|
if (!value) throw new Error(`${part} must be used within Collapsible`);
|
|
15494
15575
|
return value;
|
|
15495
15576
|
}
|
|
15496
15577
|
function usePrefersReducedMotion3() {
|
|
15497
|
-
const [reduce, setReduce] = (0,
|
|
15498
|
-
(0,
|
|
15578
|
+
const [reduce, setReduce] = (0, import_react60.useState)(false);
|
|
15579
|
+
(0, import_react60.useEffect)(() => {
|
|
15499
15580
|
const mql = window.matchMedia((0, import_animation9.getReducedMotionQuery)().replace("@media ", ""));
|
|
15500
15581
|
const sync = () => setReduce(mql.matches);
|
|
15501
15582
|
sync();
|
|
@@ -15515,18 +15596,18 @@ var collapsibleStyles = {
|
|
|
15515
15596
|
};
|
|
15516
15597
|
|
|
15517
15598
|
// src/components/Collapsible/Collapsible.tsx
|
|
15518
|
-
var
|
|
15519
|
-
var Collapsible = (0,
|
|
15520
|
-
const [uncontrolled, setUncontrolled] = (0,
|
|
15599
|
+
var import_jsx_runtime79 = require("react/jsx-runtime");
|
|
15600
|
+
var Collapsible = (0, import_react61.forwardRef)(function Collapsible2({ open: openProp, defaultOpen = false, onOpenChange, asChild = false, className, children, ...props }, ref) {
|
|
15601
|
+
const [uncontrolled, setUncontrolled] = (0, import_react61.useState)(defaultOpen);
|
|
15521
15602
|
const open = openProp ?? uncontrolled;
|
|
15522
|
-
const reactId = (0,
|
|
15603
|
+
const reactId = (0, import_react61.useId)();
|
|
15523
15604
|
const reduceMotion = usePrefersReducedMotion3();
|
|
15524
|
-
const toggle = (0,
|
|
15605
|
+
const toggle = (0, import_react61.useCallback)(() => {
|
|
15525
15606
|
const next = !(openProp ?? uncontrolled);
|
|
15526
15607
|
if (openProp === void 0) setUncontrolled(next);
|
|
15527
15608
|
onOpenChange?.(next);
|
|
15528
15609
|
}, [onOpenChange, openProp, uncontrolled]);
|
|
15529
|
-
const contextValue = (0,
|
|
15610
|
+
const contextValue = (0, import_react61.useMemo)(
|
|
15530
15611
|
() => ({
|
|
15531
15612
|
open,
|
|
15532
15613
|
toggle,
|
|
@@ -15543,9 +15624,9 @@ var Collapsible = (0, import_react59.forwardRef)(function Collapsible2({ open: o
|
|
|
15543
15624
|
"data-refineui": "collapsible",
|
|
15544
15625
|
className
|
|
15545
15626
|
};
|
|
15546
|
-
return /* @__PURE__ */ (0,
|
|
15627
|
+
return /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(CollapsibleContext.Provider, { value: contextValue, children: asChild ? /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(import_react62.Slot, { ...shared, children }) : /* @__PURE__ */ (0, import_jsx_runtime79.jsx)("div", { ...shared, children }) });
|
|
15547
15628
|
});
|
|
15548
|
-
var CollapsibleTrigger = (0,
|
|
15629
|
+
var CollapsibleTrigger = (0, import_react61.forwardRef)(
|
|
15549
15630
|
function CollapsibleTrigger2({
|
|
15550
15631
|
asChild = false,
|
|
15551
15632
|
onClick,
|
|
@@ -15572,8 +15653,8 @@ var CollapsibleTrigger = (0, import_react59.forwardRef)(
|
|
|
15572
15653
|
if (!event.defaultPrevented) toggle();
|
|
15573
15654
|
}
|
|
15574
15655
|
};
|
|
15575
|
-
if (asChild) return /* @__PURE__ */ (0,
|
|
15576
|
-
return /* @__PURE__ */ (0,
|
|
15656
|
+
if (asChild) return /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(import_react62.Slot, { ...shared, children });
|
|
15657
|
+
return /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(
|
|
15577
15658
|
Button,
|
|
15578
15659
|
{
|
|
15579
15660
|
...shared,
|
|
@@ -15587,7 +15668,7 @@ var CollapsibleTrigger = (0, import_react59.forwardRef)(
|
|
|
15587
15668
|
);
|
|
15588
15669
|
}
|
|
15589
15670
|
);
|
|
15590
|
-
var CollapsibleContent = (0,
|
|
15671
|
+
var CollapsibleContent = (0, import_react61.forwardRef)(
|
|
15591
15672
|
function CollapsibleContent2({ className, children, style, ...props }, ref) {
|
|
15592
15673
|
const { open, contentId, triggerId, reduceMotion } = useCollapsibleContext("CollapsibleContent");
|
|
15593
15674
|
const gridStyle = {
|
|
@@ -15602,7 +15683,7 @@ var CollapsibleContent = (0, import_react59.forwardRef)(
|
|
|
15602
15683
|
pointerEvents: open ? void 0 : "none",
|
|
15603
15684
|
...style
|
|
15604
15685
|
};
|
|
15605
|
-
return /* @__PURE__ */ (0,
|
|
15686
|
+
return /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(
|
|
15606
15687
|
"div",
|
|
15607
15688
|
{
|
|
15608
15689
|
...props,
|
|
@@ -15614,26 +15695,26 @@ var CollapsibleContent = (0, import_react59.forwardRef)(
|
|
|
15614
15695
|
"data-state": open ? "open" : "closed",
|
|
15615
15696
|
"data-refineui": "collapsible-content",
|
|
15616
15697
|
style: gridStyle,
|
|
15617
|
-
children: /* @__PURE__ */ (0,
|
|
15698
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime79.jsx)("div", { className: collapsibleStyles.panelOuter, children: /* @__PURE__ */ (0, import_jsx_runtime79.jsx)("div", { className: (0, import_clsx108.clsx)(className), style: innerMotionStyle, children }) })
|
|
15618
15699
|
}
|
|
15619
15700
|
);
|
|
15620
15701
|
}
|
|
15621
15702
|
);
|
|
15622
15703
|
|
|
15623
15704
|
// src/components/ContextMenu/ContextMenu.tsx
|
|
15624
|
-
var
|
|
15705
|
+
var import_react63 = require("react");
|
|
15625
15706
|
var import_react_dom7 = require("react-dom");
|
|
15626
15707
|
var import_clsx109 = require("clsx");
|
|
15627
15708
|
var import_tokens37 = require("@refineui/tokens");
|
|
15628
15709
|
var import_animation10 = require("@refineui/utilities/animation");
|
|
15629
|
-
var
|
|
15630
|
-
var
|
|
15710
|
+
var import_react64 = require("@refineui/utilities/react");
|
|
15711
|
+
var import_jsx_runtime80 = require("react/jsx-runtime");
|
|
15631
15712
|
var MENU_ATTR = "data-refineui-context-menu";
|
|
15632
15713
|
var CLOSE_MS = (0, import_animation10.motionMsToNumber)(import_tokens37.semanticInteraction.duration.normal);
|
|
15633
|
-
var MenuContext2 = (0,
|
|
15634
|
-
var SubContext = (0,
|
|
15714
|
+
var MenuContext2 = (0, import_react63.createContext)(null);
|
|
15715
|
+
var SubContext = (0, import_react63.createContext)(null);
|
|
15635
15716
|
function useMenu() {
|
|
15636
|
-
const value = (0,
|
|
15717
|
+
const value = (0, import_react63.useContext)(MenuContext2);
|
|
15637
15718
|
if (!value) throw new Error("Context menu parts must be used within ContextMenu");
|
|
15638
15719
|
return value;
|
|
15639
15720
|
}
|
|
@@ -15650,29 +15731,29 @@ function placeInView(element, x, y) {
|
|
|
15650
15731
|
}
|
|
15651
15732
|
function ContextMenu({ modal = true, onOpenChange, children }) {
|
|
15652
15733
|
void modal;
|
|
15653
|
-
const [open, setOpen] = (0,
|
|
15654
|
-
const [point, setPoint] = (0,
|
|
15655
|
-
const openRef = (0,
|
|
15656
|
-
const onOpenChangeRef = (0,
|
|
15734
|
+
const [open, setOpen] = (0, import_react63.useState)(false);
|
|
15735
|
+
const [point, setPoint] = (0, import_react63.useState)({ x: 0, y: 0 });
|
|
15736
|
+
const openRef = (0, import_react63.useRef)(false);
|
|
15737
|
+
const onOpenChangeRef = (0, import_react63.useRef)(onOpenChange);
|
|
15657
15738
|
openRef.current = open;
|
|
15658
15739
|
onOpenChangeRef.current = onOpenChange;
|
|
15659
|
-
const close = (0,
|
|
15740
|
+
const close = (0, import_react63.useCallback)(() => {
|
|
15660
15741
|
if (!openRef.current) return;
|
|
15661
15742
|
openRef.current = false;
|
|
15662
15743
|
setOpen(false);
|
|
15663
15744
|
onOpenChangeRef.current?.(false);
|
|
15664
15745
|
}, []);
|
|
15665
|
-
const openAt = (0,
|
|
15746
|
+
const openAt = (0, import_react63.useCallback)((x, y) => {
|
|
15666
15747
|
setPoint({ x, y });
|
|
15667
15748
|
const wasOpen = openRef.current;
|
|
15668
15749
|
openRef.current = true;
|
|
15669
15750
|
setOpen(true);
|
|
15670
15751
|
if (!wasOpen) onOpenChangeRef.current?.(true);
|
|
15671
15752
|
}, []);
|
|
15672
|
-
const value = (0,
|
|
15673
|
-
return /* @__PURE__ */ (0,
|
|
15753
|
+
const value = (0, import_react63.useMemo)(() => ({ open, point, openAt, close }), [open, point, openAt, close]);
|
|
15754
|
+
return /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(MenuContext2.Provider, { value, children });
|
|
15674
15755
|
}
|
|
15675
|
-
var ContextMenuTrigger = (0,
|
|
15756
|
+
var ContextMenuTrigger = (0, import_react63.forwardRef)(function ContextMenuTrigger2({ asChild = false, onContextMenu, children, ...props }, ref) {
|
|
15676
15757
|
const { openAt } = useMenu();
|
|
15677
15758
|
const shared = {
|
|
15678
15759
|
...props,
|
|
@@ -15685,18 +15766,18 @@ var ContextMenuTrigger = (0, import_react61.forwardRef)(function ContextMenuTrig
|
|
|
15685
15766
|
openAt(event.clientX, event.clientY);
|
|
15686
15767
|
}
|
|
15687
15768
|
};
|
|
15688
|
-
if (asChild) return /* @__PURE__ */ (0,
|
|
15689
|
-
return /* @__PURE__ */ (0,
|
|
15769
|
+
if (asChild) return /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(import_react64.Slot, { ...shared, children });
|
|
15770
|
+
return /* @__PURE__ */ (0, import_jsx_runtime80.jsx)("span", { ...shared, className: (0, import_clsx109.clsx)(menuStyles.triggerFallback, props.className), children });
|
|
15690
15771
|
});
|
|
15691
15772
|
function ContextMenuPortal({ children }) {
|
|
15692
|
-
return /* @__PURE__ */ (0,
|
|
15773
|
+
return /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(import_jsx_runtime80.Fragment, { children });
|
|
15693
15774
|
}
|
|
15694
|
-
var ContextMenuContent = (0,
|
|
15775
|
+
var ContextMenuContent = (0, import_react63.forwardRef)(function ContextMenuContent2({ className, style, onPointerDown, children, ...props }, ref) {
|
|
15695
15776
|
const { open, point, close } = useMenu();
|
|
15696
|
-
const localRef = (0,
|
|
15697
|
-
const [shouldRender, setShouldRender] = (0,
|
|
15698
|
-
const [isClosing, setIsClosing] = (0,
|
|
15699
|
-
(0,
|
|
15777
|
+
const localRef = (0, import_react63.useRef)(null);
|
|
15778
|
+
const [shouldRender, setShouldRender] = (0, import_react63.useState)(open);
|
|
15779
|
+
const [isClosing, setIsClosing] = (0, import_react63.useState)(false);
|
|
15780
|
+
(0, import_react63.useEffect)(() => {
|
|
15700
15781
|
if (open) {
|
|
15701
15782
|
setShouldRender(true);
|
|
15702
15783
|
setIsClosing(false);
|
|
@@ -15710,11 +15791,11 @@ var ContextMenuContent = (0, import_react61.forwardRef)(function ContextMenuCont
|
|
|
15710
15791
|
}, CLOSE_MS);
|
|
15711
15792
|
return () => window.clearTimeout(timeout);
|
|
15712
15793
|
}, [open, shouldRender]);
|
|
15713
|
-
(0,
|
|
15794
|
+
(0, import_react63.useLayoutEffect)(() => {
|
|
15714
15795
|
if (!shouldRender || !localRef.current) return;
|
|
15715
15796
|
placeInView(localRef.current, point.x, point.y);
|
|
15716
15797
|
}, [shouldRender, point.x, point.y]);
|
|
15717
|
-
(0,
|
|
15798
|
+
(0, import_react63.useEffect)(() => {
|
|
15718
15799
|
if (!open) return;
|
|
15719
15800
|
const onKey = (event) => {
|
|
15720
15801
|
if (event.key === "Escape") close();
|
|
@@ -15733,7 +15814,7 @@ var ContextMenuContent = (0, import_react61.forwardRef)(function ContextMenuCont
|
|
|
15733
15814
|
}, [open, close]);
|
|
15734
15815
|
if (!shouldRender || typeof document === "undefined") return null;
|
|
15735
15816
|
return (0, import_react_dom7.createPortal)(
|
|
15736
|
-
/* @__PURE__ */ (0,
|
|
15817
|
+
/* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
|
|
15737
15818
|
"div",
|
|
15738
15819
|
{
|
|
15739
15820
|
...props,
|
|
@@ -15760,7 +15841,7 @@ var ContextMenuContent = (0, import_react61.forwardRef)(function ContextMenuCont
|
|
|
15760
15841
|
onPointerDown?.(event);
|
|
15761
15842
|
},
|
|
15762
15843
|
onContextMenu: (event) => event.preventDefault(),
|
|
15763
|
-
children: /* @__PURE__ */ (0,
|
|
15844
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime80.jsx)("div", { role: "menu", "data-refineui": "menu", className: (0, import_clsx109.clsx)(menuStyles.list, className), children })
|
|
15764
15845
|
}
|
|
15765
15846
|
),
|
|
15766
15847
|
document.body
|
|
@@ -15777,11 +15858,11 @@ function runSelect(onSelect, close, disabled) {
|
|
|
15777
15858
|
onSelect?.(selectEvent);
|
|
15778
15859
|
if (!selectEvent.defaultPrevented) close();
|
|
15779
15860
|
}
|
|
15780
|
-
var ContextMenuItem = (0,
|
|
15861
|
+
var ContextMenuItem = (0, import_react63.forwardRef)(function ContextMenuItem2({ disabled = false, description, shortcut, startIcon, endIcon, state = "default", onSelect, className, onClick, onKeyDown, children, ...props }, ref) {
|
|
15781
15862
|
const { close } = useMenu();
|
|
15782
15863
|
const isDisabled = disabled || state === "disabled";
|
|
15783
15864
|
const slotted = startIcon != null || description != null || shortcut != null || endIcon != null;
|
|
15784
|
-
return /* @__PURE__ */ (0,
|
|
15865
|
+
return /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
|
|
15785
15866
|
"button",
|
|
15786
15867
|
{
|
|
15787
15868
|
ref,
|
|
@@ -15807,8 +15888,8 @@ var ContextMenuItem = (0, import_react61.forwardRef)(function ContextMenuItem2({
|
|
|
15807
15888
|
runSelect(onSelect, close, isDisabled);
|
|
15808
15889
|
}
|
|
15809
15890
|
},
|
|
15810
|
-
children: slotted ? /* @__PURE__ */ (0,
|
|
15811
|
-
startIcon ? /* @__PURE__ */ (0,
|
|
15891
|
+
children: slotted ? /* @__PURE__ */ (0, import_jsx_runtime80.jsxs)("span", { className: menuStyles.row, children: [
|
|
15892
|
+
startIcon ? /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
|
|
15812
15893
|
"span",
|
|
15813
15894
|
{
|
|
15814
15895
|
className: menuStyles.iconWrap,
|
|
@@ -15816,13 +15897,13 @@ var ContextMenuItem = (0, import_react61.forwardRef)(function ContextMenuItem2({
|
|
|
15816
15897
|
children: startIcon
|
|
15817
15898
|
}
|
|
15818
15899
|
) : null,
|
|
15819
|
-
/* @__PURE__ */ (0,
|
|
15820
|
-
/* @__PURE__ */ (0,
|
|
15821
|
-
description ? /* @__PURE__ */ (0,
|
|
15900
|
+
/* @__PURE__ */ (0, import_jsx_runtime80.jsxs)("span", { className: menuStyles.textCol, children: [
|
|
15901
|
+
/* @__PURE__ */ (0, import_jsx_runtime80.jsx)("span", { className: menuStyles.title, children }),
|
|
15902
|
+
description ? /* @__PURE__ */ (0, import_jsx_runtime80.jsx)("span", { className: (0, import_clsx109.clsx)(menuStyles.description, isDisabled ? menuStyles.descriptionDisabled : menuStyles.descriptionEnabled), children: description }) : null
|
|
15822
15903
|
] }),
|
|
15823
|
-
(shortcut || endIcon) && /* @__PURE__ */ (0,
|
|
15824
|
-
shortcut ? /* @__PURE__ */ (0,
|
|
15825
|
-
endIcon ? /* @__PURE__ */ (0,
|
|
15904
|
+
(shortcut || endIcon) && /* @__PURE__ */ (0, import_jsx_runtime80.jsxs)("span", { className: menuStyles.rightWrap, children: [
|
|
15905
|
+
shortcut ? /* @__PURE__ */ (0, import_jsx_runtime80.jsx)("span", { className: menuStyles.shortcut, children: shortcut }) : null,
|
|
15906
|
+
endIcon ? /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
|
|
15826
15907
|
"span",
|
|
15827
15908
|
{
|
|
15828
15909
|
className: menuStyles.iconWrap,
|
|
@@ -15831,13 +15912,13 @@ var ContextMenuItem = (0, import_react61.forwardRef)(function ContextMenuItem2({
|
|
|
15831
15912
|
}
|
|
15832
15913
|
) : null
|
|
15833
15914
|
] })
|
|
15834
|
-
] }) : /* @__PURE__ */ (0,
|
|
15915
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime80.jsx)("span", { className: menuStyles.row, children })
|
|
15835
15916
|
}
|
|
15836
15917
|
);
|
|
15837
15918
|
});
|
|
15838
|
-
var ContextMenuSeparator = (0,
|
|
15919
|
+
var ContextMenuSeparator = (0, import_react63.forwardRef)(
|
|
15839
15920
|
function ContextMenuSeparator2({ className, ...props }, ref) {
|
|
15840
|
-
return /* @__PURE__ */ (0,
|
|
15921
|
+
return /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
|
|
15841
15922
|
"div",
|
|
15842
15923
|
{
|
|
15843
15924
|
ref,
|
|
@@ -15847,24 +15928,24 @@ var ContextMenuSeparator = (0, import_react61.forwardRef)(
|
|
|
15847
15928
|
...{ [MENU_ATTR]: "" },
|
|
15848
15929
|
className: (0, import_clsx109.clsx)(menuStyles.dividerWrap, className),
|
|
15849
15930
|
...props,
|
|
15850
|
-
children: /* @__PURE__ */ (0,
|
|
15931
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime80.jsx)("div", { className: menuStyles.dividerLine })
|
|
15851
15932
|
}
|
|
15852
15933
|
);
|
|
15853
15934
|
}
|
|
15854
15935
|
);
|
|
15855
15936
|
function ContextMenuLabel({ className, children, ...props }) {
|
|
15856
|
-
return /* @__PURE__ */ (0,
|
|
15937
|
+
return /* @__PURE__ */ (0, import_jsx_runtime80.jsx)("div", { "data-refineui": "menu-label", className: (0, import_clsx109.clsx)(menuStyles.section, className), ...props, children: /* @__PURE__ */ (0, import_jsx_runtime80.jsx)("span", { className: menuStyles.sectionText, children }) });
|
|
15857
15938
|
}
|
|
15858
15939
|
function ContextMenuSub({ children }) {
|
|
15859
|
-
const [open, setOpen] = (0,
|
|
15860
|
-
const triggerRef = (0,
|
|
15861
|
-
const timer = (0,
|
|
15940
|
+
const [open, setOpen] = (0, import_react63.useState)(false);
|
|
15941
|
+
const triggerRef = (0, import_react63.useRef)(null);
|
|
15942
|
+
const timer = (0, import_react63.useRef)(null);
|
|
15862
15943
|
const clear = () => {
|
|
15863
15944
|
if (timer.current != null) window.clearTimeout(timer.current);
|
|
15864
15945
|
timer.current = null;
|
|
15865
15946
|
};
|
|
15866
|
-
(0,
|
|
15867
|
-
const value = (0,
|
|
15947
|
+
(0, import_react63.useEffect)(() => clear, []);
|
|
15948
|
+
const value = (0, import_react63.useMemo)(
|
|
15868
15949
|
() => ({
|
|
15869
15950
|
open,
|
|
15870
15951
|
triggerRef,
|
|
@@ -15879,14 +15960,14 @@ function ContextMenuSub({ children }) {
|
|
|
15879
15960
|
}),
|
|
15880
15961
|
[open]
|
|
15881
15962
|
);
|
|
15882
|
-
return /* @__PURE__ */ (0,
|
|
15963
|
+
return /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(SubContext.Provider, { value, children });
|
|
15883
15964
|
}
|
|
15884
15965
|
function useSub2() {
|
|
15885
|
-
const value = (0,
|
|
15966
|
+
const value = (0, import_react63.useContext)(SubContext);
|
|
15886
15967
|
if (!value) throw new Error("ContextMenuSubTrigger must be used within ContextMenuSub");
|
|
15887
15968
|
return value;
|
|
15888
15969
|
}
|
|
15889
|
-
var ContextMenuSubTrigger = (0,
|
|
15970
|
+
var ContextMenuSubTrigger = (0, import_react63.forwardRef)(
|
|
15890
15971
|
function ContextMenuSubTrigger2({ asChild = false, description, startIcon, onMouseEnter, onMouseLeave, onClick, className, children, ...props }, ref) {
|
|
15891
15972
|
const sub = useSub2();
|
|
15892
15973
|
const shared = {
|
|
@@ -15922,9 +16003,9 @@ var ContextMenuSubTrigger = (0, import_react61.forwardRef)(
|
|
|
15922
16003
|
if (!event.defaultPrevented) sub.show();
|
|
15923
16004
|
}
|
|
15924
16005
|
};
|
|
15925
|
-
if (asChild) return /* @__PURE__ */ (0,
|
|
15926
|
-
return /* @__PURE__ */ (0,
|
|
15927
|
-
startIcon ? /* @__PURE__ */ (0,
|
|
16006
|
+
if (asChild) return /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(import_react64.Slot, { ...shared, children });
|
|
16007
|
+
return /* @__PURE__ */ (0, import_jsx_runtime80.jsx)("button", { ...shared, children: /* @__PURE__ */ (0, import_jsx_runtime80.jsxs)("span", { className: menuStyles.row, children: [
|
|
16008
|
+
startIcon ? /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
|
|
15928
16009
|
"span",
|
|
15929
16010
|
{
|
|
15930
16011
|
className: menuStyles.iconWrap,
|
|
@@ -15932,27 +16013,27 @@ var ContextMenuSubTrigger = (0, import_react61.forwardRef)(
|
|
|
15932
16013
|
children: startIcon
|
|
15933
16014
|
}
|
|
15934
16015
|
) : null,
|
|
15935
|
-
/* @__PURE__ */ (0,
|
|
15936
|
-
/* @__PURE__ */ (0,
|
|
15937
|
-
description ? /* @__PURE__ */ (0,
|
|
16016
|
+
/* @__PURE__ */ (0, import_jsx_runtime80.jsxs)("span", { className: menuStyles.textCol, children: [
|
|
16017
|
+
/* @__PURE__ */ (0, import_jsx_runtime80.jsx)("span", { className: menuStyles.title, children }),
|
|
16018
|
+
description ? /* @__PURE__ */ (0, import_jsx_runtime80.jsx)("span", { className: (0, import_clsx109.clsx)(menuStyles.description, menuStyles.descriptionEnabled), children: description }) : null
|
|
15938
16019
|
] }),
|
|
15939
|
-
/* @__PURE__ */ (0,
|
|
16020
|
+
/* @__PURE__ */ (0, import_jsx_runtime80.jsx)("span", { className: menuStyles.rightWrap, children: /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
|
|
15940
16021
|
"span",
|
|
15941
16022
|
{
|
|
15942
16023
|
className: menuStyles.iconWrap,
|
|
15943
16024
|
style: { width: import_tokens37.iconSizes.small, minWidth: import_tokens37.iconSizes.small, height: import_tokens37.iconSizes.small },
|
|
15944
|
-
children: /* @__PURE__ */ (0,
|
|
16025
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(WebIcon, { name: "chevron-right", size: import_tokens37.iconSizes.small, color: "currentColor", "aria-hidden": true })
|
|
15945
16026
|
}
|
|
15946
16027
|
) })
|
|
15947
16028
|
] }) });
|
|
15948
16029
|
}
|
|
15949
16030
|
);
|
|
15950
|
-
var ContextMenuSubContent = (0,
|
|
16031
|
+
var ContextMenuSubContent = (0, import_react63.forwardRef)(
|
|
15951
16032
|
function ContextMenuSubContent2({ className, style, onPointerDown, onMouseEnter, onMouseLeave, ...props }, ref) {
|
|
15952
16033
|
const sub = useSub2();
|
|
15953
|
-
const localRef = (0,
|
|
15954
|
-
const [side, setSide] = (0,
|
|
15955
|
-
(0,
|
|
16034
|
+
const localRef = (0, import_react63.useRef)(null);
|
|
16035
|
+
const [side, setSide] = (0, import_react63.useState)("right");
|
|
16036
|
+
(0, import_react63.useLayoutEffect)(() => {
|
|
15956
16037
|
const trigger = sub.triggerRef.current;
|
|
15957
16038
|
const element = localRef.current;
|
|
15958
16039
|
if (!sub.open || !trigger || !element) return;
|
|
@@ -15970,7 +16051,7 @@ var ContextMenuSubContent = (0, import_react61.forwardRef)(
|
|
|
15970
16051
|
}, [sub.open, sub.triggerRef]);
|
|
15971
16052
|
if (!sub.open || typeof document === "undefined") return null;
|
|
15972
16053
|
return (0, import_react_dom7.createPortal)(
|
|
15973
|
-
/* @__PURE__ */ (0,
|
|
16054
|
+
/* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
|
|
15974
16055
|
"div",
|
|
15975
16056
|
{
|
|
15976
16057
|
...props,
|
|
@@ -16238,6 +16319,8 @@ var ContextMenuSubContent = (0, import_react61.forwardRef)(
|
|
|
16238
16319
|
SidebarPeekInset,
|
|
16239
16320
|
SidebarPeekPanel,
|
|
16240
16321
|
SidebarPeekPin,
|
|
16322
|
+
SidebarProvider,
|
|
16323
|
+
SidebarTrigger,
|
|
16241
16324
|
Skeleton,
|
|
16242
16325
|
Slider,
|
|
16243
16326
|
Slot,
|
|
@@ -16295,6 +16378,7 @@ var ContextMenuSubContent = (0, import_react61.forwardRef)(
|
|
|
16295
16378
|
semanticTextClass,
|
|
16296
16379
|
sizedComponentTextClass,
|
|
16297
16380
|
toast,
|
|
16381
|
+
useSidebar,
|
|
16298
16382
|
useSidebarPeek
|
|
16299
16383
|
});
|
|
16300
16384
|
//# sourceMappingURL=index.cjs.map
|