@refineui/react 0.1.1 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/authoring-manifest.cjs +29 -2
- package/dist/authoring-manifest.cjs.map +1 -1
- package/dist/authoring-manifest.js +29 -2
- package/dist/authoring-manifest.js.map +1 -1
- package/dist/index.cjs +976 -716
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +50 -12
- package/dist/index.d.ts +50 -12
- package/dist/index.js +781 -521
- package/dist/index.js.map +1 -1
- package/dist/spec/authoring/components/command.json +15 -1
- package/dist/spec/authoring/components/search-field.json +13 -0
- package/dist/spec/authoring/manifest.json +29 -2
- package/dist/spec/components/command.json +8 -0
- package/dist/spec/components/search-field.json +5 -0
- package/dist/spec/contract-index.json +1 -1
- package/dist/spec/token-trace-v2.json +1 -1
- package/package.json +1 -1
- package/refineui.css +175 -27
- package/spec/authoring/components/command.json +15 -1
- package/spec/authoring/components/search-field.json +13 -0
- package/spec/authoring/manifest.json +29 -2
- package/spec/components/command.json +8 -0
- package/spec/components/search-field.json +5 -0
package/dist/index.js
CHANGED
|
@@ -787,7 +787,12 @@ var componentTypographyTokens = {
|
|
|
787
787
|
/** Command palette — same scale as Menu (list / section / shortcut). */
|
|
788
788
|
command: {
|
|
789
789
|
group: role("captionLg"),
|
|
790
|
-
|
|
790
|
+
/** Row text follows the Command size, like Tree rows. */
|
|
791
|
+
item: {
|
|
792
|
+
sm: role("bodySm"),
|
|
793
|
+
md: role("bodyMd"),
|
|
794
|
+
lg: role("bodyLg")
|
|
795
|
+
},
|
|
791
796
|
empty: role("bodyXs"),
|
|
792
797
|
shortcut: role("bodyXs"),
|
|
793
798
|
input: role("bodyMd")
|
|
@@ -1319,10 +1324,20 @@ var radius = {
|
|
|
1319
1324
|
md: "rounded-refineui-x-large",
|
|
1320
1325
|
lg: "rounded-refineui-xx-large"
|
|
1321
1326
|
};
|
|
1327
|
+
var paddingInline = {
|
|
1328
|
+
sm: "px-refineui-size-medium",
|
|
1329
|
+
md: "px-refineui-size-large",
|
|
1330
|
+
lg: "px-refineui-size-x-large"
|
|
1331
|
+
};
|
|
1332
|
+
var paddingBlock = {
|
|
1333
|
+
sm: "py-refineui-size-x-small",
|
|
1334
|
+
md: "py-refineui-size-medium",
|
|
1335
|
+
lg: "py-refineui-size-large"
|
|
1336
|
+
};
|
|
1322
1337
|
var padding = {
|
|
1323
|
-
sm: "
|
|
1324
|
-
md: "
|
|
1325
|
-
lg: "
|
|
1338
|
+
sm: [paddingInline.sm, paddingBlock.sm].join(" "),
|
|
1339
|
+
md: [paddingInline.md, paddingBlock.md].join(" "),
|
|
1340
|
+
lg: [paddingInline.lg, paddingBlock.lg].join(" ")
|
|
1326
1341
|
};
|
|
1327
1342
|
var typography = {
|
|
1328
1343
|
sm: sizedComponentTextClass(componentTypographyTokens.formControl, "sm"),
|
|
@@ -1340,6 +1355,11 @@ var formControlShellSizeClass = {
|
|
|
1340
1355
|
md: [fixedHeight.md, radius.md, padding.md, typography.md].join(" "),
|
|
1341
1356
|
lg: [fixedHeight.lg, radius.lg, padding.lg, typography.lg].join(" ")
|
|
1342
1357
|
};
|
|
1358
|
+
var formControlRowShellSizeClass = {
|
|
1359
|
+
sm: [fixedHeight.sm, radius.sm, paddingInline.sm].join(" "),
|
|
1360
|
+
md: [fixedHeight.md, radius.md, paddingInline.md].join(" "),
|
|
1361
|
+
lg: [fixedHeight.lg, radius.lg, paddingInline.lg].join(" ")
|
|
1362
|
+
};
|
|
1343
1363
|
var formControlShellHeightClass = {
|
|
1344
1364
|
sm: [fixedHeight.sm, radius.sm].join(" "),
|
|
1345
1365
|
md: [fixedHeight.md, radius.md].join(" "),
|
|
@@ -1429,7 +1449,7 @@ var inputOtpStyles = {
|
|
|
1429
1449
|
"inline-flex shrink-0 cursor-text items-center justify-center",
|
|
1430
1450
|
"border-refineui-thin border-transparent",
|
|
1431
1451
|
// Soft grey tile (not white) so cells read on light preview / page.
|
|
1432
|
-
"bg-refineui-alias-background-surface-
|
|
1452
|
+
"bg-refineui-alias-background-surface-hover",
|
|
1433
1453
|
"text-center tabular-nums",
|
|
1434
1454
|
"text-refineui-alias-foreground-primary",
|
|
1435
1455
|
"transition-[background-color,border-color]",
|
|
@@ -1719,22 +1739,27 @@ import {
|
|
|
1719
1739
|
|
|
1720
1740
|
// src/components/SearchField/style.ts
|
|
1721
1741
|
import { iconSizes as iconSizes2 } from "@refineui/tokens";
|
|
1722
|
-
var searchFieldLeadingIconSize =
|
|
1723
|
-
|
|
1742
|
+
var searchFieldLeadingIconSize = {
|
|
1743
|
+
sm: iconSizes2.small,
|
|
1744
|
+
md: iconSizes2.medium,
|
|
1745
|
+
lg: iconSizes2.large
|
|
1746
|
+
};
|
|
1747
|
+
var searchFieldClearIconSize = {
|
|
1748
|
+
sm: iconSizes2.xsmall,
|
|
1749
|
+
md: iconSizes2.small,
|
|
1750
|
+
lg: iconSizes2.small
|
|
1751
|
+
};
|
|
1724
1752
|
var searchFieldStyles = {
|
|
1725
1753
|
root: [
|
|
1726
1754
|
"box-border flex w-full min-w-0 items-center gap-refineui-size-x-small overflow-hidden outline-none",
|
|
1727
|
-
formControlTypoClass.md,
|
|
1728
1755
|
"transition-[background-color,border-color]",
|
|
1729
1756
|
"duration-[var(--refineui-motion-duration-fast)]",
|
|
1730
1757
|
"ease-[var(--refineui-motion-easing-emphasized)]"
|
|
1731
1758
|
].join(" "),
|
|
1732
1759
|
rootFilled: [
|
|
1733
|
-
"h-refineui-control-height-md min-h-refineui-control-height-md",
|
|
1734
|
-
"rounded-refineui-x-large px-refineui-size-large",
|
|
1735
1760
|
"border-refineui-thin border-transparent",
|
|
1736
1761
|
/** Same soft plate as InputOTP slots */
|
|
1737
|
-
"bg-refineui-alias-background-surface-
|
|
1762
|
+
"bg-refineui-alias-background-surface-hover"
|
|
1738
1763
|
].join(" "),
|
|
1739
1764
|
rootPlain: [
|
|
1740
1765
|
"h-auto min-h-0 rounded-none border-none bg-transparent px-0 py-0"
|
|
@@ -1747,6 +1772,8 @@ var searchFieldStyles = {
|
|
|
1747
1772
|
clear: "inline-flex shrink-0 cursor-pointer items-center justify-center border-none bg-transparent p-0 leading-none text-refineui-alias-foreground-tertiary",
|
|
1748
1773
|
clearDisabled: "cursor-not-allowed text-refineui-alias-foreground-disabled"
|
|
1749
1774
|
};
|
|
1775
|
+
var searchFieldFilledSizeClass = formControlRowShellSizeClass;
|
|
1776
|
+
var searchFieldTypoClass = formControlTypoClass;
|
|
1750
1777
|
|
|
1751
1778
|
// src/components/SearchField/SearchField.tsx
|
|
1752
1779
|
import { jsx as jsx5 } from "react/jsx-runtime";
|
|
@@ -1777,6 +1804,7 @@ function SearchField({
|
|
|
1777
1804
|
onValueChange,
|
|
1778
1805
|
disabled = false,
|
|
1779
1806
|
appearance = "filled",
|
|
1807
|
+
size: sizeProp,
|
|
1780
1808
|
className,
|
|
1781
1809
|
children,
|
|
1782
1810
|
id,
|
|
@@ -1784,6 +1812,8 @@ function SearchField({
|
|
|
1784
1812
|
"aria-label": ariaLabel = "Search",
|
|
1785
1813
|
...props
|
|
1786
1814
|
}) {
|
|
1815
|
+
const fieldSize = useOptionalFieldSize();
|
|
1816
|
+
const size = sizeProp ?? fieldSize ?? "md";
|
|
1787
1817
|
const [query, setQuery] = useControllableString(value, defaultValue, onValueChange);
|
|
1788
1818
|
const inputRef = useRef2(null);
|
|
1789
1819
|
const reactId = useId2();
|
|
@@ -1798,11 +1828,12 @@ function SearchField({
|
|
|
1798
1828
|
setValue: setQuery,
|
|
1799
1829
|
clear,
|
|
1800
1830
|
disabled,
|
|
1831
|
+
size,
|
|
1801
1832
|
inputId,
|
|
1802
1833
|
inputLabel: ariaLabel,
|
|
1803
1834
|
inputRef
|
|
1804
1835
|
}),
|
|
1805
|
-
[ariaLabel, clear, disabled, inputId, query, setQuery]
|
|
1836
|
+
[ariaLabel, clear, disabled, size, inputId, query, setQuery]
|
|
1806
1837
|
);
|
|
1807
1838
|
const handlePointerDown = (event) => {
|
|
1808
1839
|
onPointerDown?.(event);
|
|
@@ -1818,10 +1849,12 @@ function SearchField({
|
|
|
1818
1849
|
{
|
|
1819
1850
|
"data-refineui": "search-field",
|
|
1820
1851
|
"data-appearance": appearance,
|
|
1852
|
+
"data-size": size,
|
|
1821
1853
|
"data-disabled": disabled || void 0,
|
|
1822
1854
|
className: clsx6(
|
|
1823
1855
|
searchFieldStyles.root,
|
|
1824
|
-
|
|
1856
|
+
searchFieldTypoClass[size],
|
|
1857
|
+
appearance === "plain" ? searchFieldStyles.rootPlain : [searchFieldStyles.rootFilled, searchFieldFilledSizeClass[size]],
|
|
1825
1858
|
disabled && (appearance === "plain" ? searchFieldStyles.rootPlainDisabled : searchFieldStyles.rootDisabled),
|
|
1826
1859
|
className
|
|
1827
1860
|
),
|
|
@@ -1832,7 +1865,7 @@ function SearchField({
|
|
|
1832
1865
|
) });
|
|
1833
1866
|
}
|
|
1834
1867
|
function SearchFieldIcon({ children, className, ...props }) {
|
|
1835
|
-
const { disabled } = useSearchFieldContext("SearchFieldIcon");
|
|
1868
|
+
const { disabled, size } = useSearchFieldContext("SearchFieldIcon");
|
|
1836
1869
|
return /* @__PURE__ */ jsx5(
|
|
1837
1870
|
"span",
|
|
1838
1871
|
{
|
|
@@ -1848,7 +1881,7 @@ function SearchFieldIcon({ children, className, ...props }) {
|
|
|
1848
1881
|
WebIcon,
|
|
1849
1882
|
{
|
|
1850
1883
|
name: "search",
|
|
1851
|
-
size: searchFieldLeadingIconSize,
|
|
1884
|
+
size: searchFieldLeadingIconSize[size],
|
|
1852
1885
|
color: "currentColor",
|
|
1853
1886
|
"aria-hidden": true
|
|
1854
1887
|
}
|
|
@@ -1911,7 +1944,7 @@ function SearchFieldClear({
|
|
|
1911
1944
|
"aria-label": ariaLabel = "Clear search",
|
|
1912
1945
|
...props
|
|
1913
1946
|
}) {
|
|
1914
|
-
const { value, clear, disabled } = useSearchFieldContext("SearchFieldClear");
|
|
1947
|
+
const { value, clear, disabled, size } = useSearchFieldContext("SearchFieldClear");
|
|
1915
1948
|
const isDisabled = disabledProp ?? disabled;
|
|
1916
1949
|
if (value.length === 0) return null;
|
|
1917
1950
|
return /* @__PURE__ */ jsx5(
|
|
@@ -1936,7 +1969,7 @@ function SearchFieldClear({
|
|
|
1936
1969
|
WebIcon,
|
|
1937
1970
|
{
|
|
1938
1971
|
name: "dismiss",
|
|
1939
|
-
size: searchFieldClearIconSize,
|
|
1972
|
+
size: searchFieldClearIconSize[size],
|
|
1940
1973
|
color: "currentColor",
|
|
1941
1974
|
iconStyle: "filled",
|
|
1942
1975
|
"aria-hidden": true
|
|
@@ -2504,6 +2537,7 @@ import { useComposedRefs } from "@refineui/utilities/react";
|
|
|
2504
2537
|
import { clsx as clsx24 } from "clsx";
|
|
2505
2538
|
import { spacings } from "@refineui/tokens";
|
|
2506
2539
|
var SCROLL_AREA_THUMB_MIN_PX = Number.parseFloat(spacings.sizeXLarge);
|
|
2540
|
+
var SCROLL_EDGE_FALLOFF_RATIO = 0.25;
|
|
2507
2541
|
var scrollAreaStyles = {
|
|
2508
2542
|
root: "box-border min-h-0 min-w-0 overflow-hidden outline-none",
|
|
2509
2543
|
/**
|
|
@@ -2579,6 +2613,15 @@ function readMetrics(viewport) {
|
|
|
2579
2613
|
function isScrollable(metrics) {
|
|
2580
2614
|
return metrics.scrollSize > metrics.clientSize + 1;
|
|
2581
2615
|
}
|
|
2616
|
+
function resolveEdgeFactors(metrics) {
|
|
2617
|
+
const zone = metrics.clientSize * SCROLL_EDGE_FALLOFF_RATIO;
|
|
2618
|
+
if (!isScrollable(metrics) || zone <= 0) return { top: 0, bottom: 0 };
|
|
2619
|
+
const hiddenBelow = metrics.scrollSize - metrics.clientSize - metrics.scrollOffset;
|
|
2620
|
+
return {
|
|
2621
|
+
top: Math.min(1, Math.max(0, metrics.scrollOffset / zone)),
|
|
2622
|
+
bottom: Math.min(1, Math.max(0, hiddenBelow / zone))
|
|
2623
|
+
};
|
|
2624
|
+
}
|
|
2582
2625
|
function resolveThumbGeometry(metrics, trackSize, minThumb) {
|
|
2583
2626
|
if (trackSize <= 0 || metrics.scrollSize <= 0) {
|
|
2584
2627
|
return { thumbSize: 0, offset: 0 };
|
|
@@ -2599,6 +2642,8 @@ var ScrollArea = forwardRef4(function ScrollArea2({
|
|
|
2599
2642
|
children,
|
|
2600
2643
|
...props
|
|
2601
2644
|
}, ref) {
|
|
2645
|
+
const rootRef = useRef4(null);
|
|
2646
|
+
const composedRootRef = useComposedRefs(rootRef, ref);
|
|
2602
2647
|
const viewportRef = useRef4(null);
|
|
2603
2648
|
const [viewportEpoch, setViewportEpoch] = useState4(0);
|
|
2604
2649
|
const [vertical, setVertical] = useState4(EMPTY_METRICS);
|
|
@@ -2626,6 +2671,12 @@ var ScrollArea = forwardRef4(function ScrollArea2({
|
|
|
2626
2671
|
const next = readMetrics(viewport);
|
|
2627
2672
|
setVertical(next.vertical);
|
|
2628
2673
|
setHorizontal(next.horizontal);
|
|
2674
|
+
const root = rootRef.current;
|
|
2675
|
+
if (root) {
|
|
2676
|
+
const edges = resolveEdgeFactors(next.vertical);
|
|
2677
|
+
root.style.setProperty("--refineui-scroll-edge-top", String(edges.top));
|
|
2678
|
+
root.style.setProperty("--refineui-scroll-edge-bottom", String(edges.bottom));
|
|
2679
|
+
}
|
|
2629
2680
|
}, []);
|
|
2630
2681
|
const markScrolling = useCallback3(() => {
|
|
2631
2682
|
setScrolling(true);
|
|
@@ -2692,7 +2743,7 @@ var ScrollArea = forwardRef4(function ScrollArea2({
|
|
|
2692
2743
|
return /* @__PURE__ */ jsx20(ScrollAreaContext.Provider, { value: ctx, children: /* @__PURE__ */ jsx20(
|
|
2693
2744
|
"div",
|
|
2694
2745
|
{
|
|
2695
|
-
ref,
|
|
2746
|
+
ref: composedRootRef,
|
|
2696
2747
|
"data-refineui": "scroll-area",
|
|
2697
2748
|
"data-type": type,
|
|
2698
2749
|
"data-scrolling": scrolling || void 0,
|
|
@@ -3658,7 +3709,7 @@ function SelectGroup({ children, className, ...props }) {
|
|
|
3658
3709
|
return /* @__PURE__ */ jsx22("div", { role: "group", className: clsx28(selectStyles.group, className), ...props, children });
|
|
3659
3710
|
}
|
|
3660
3711
|
function SelectLabel({ children, className, ...props }) {
|
|
3661
|
-
return /* @__PURE__ */ jsx22("div", { className: clsx28(selectStyles.label, className), ...props, children });
|
|
3712
|
+
return /* @__PURE__ */ jsx22("div", { "data-scroll-edge-item": true, className: clsx28(selectStyles.label, className), ...props, children });
|
|
3662
3713
|
}
|
|
3663
3714
|
function SelectSeparator({ className, ...props }) {
|
|
3664
3715
|
return /* @__PURE__ */ jsx22("div", { role: "separator", className: clsx28(selectStyles.separator, className), ...props });
|
|
@@ -3705,6 +3756,7 @@ function SelectItem({
|
|
|
3705
3756
|
"aria-selected": isSelected,
|
|
3706
3757
|
"aria-disabled": disabled,
|
|
3707
3758
|
"data-refineui": "select-item",
|
|
3759
|
+
"data-scroll-edge-item": true,
|
|
3708
3760
|
"data-selected": isSelected ? true : void 0,
|
|
3709
3761
|
"data-state": pressed ? "pressed" : isSelected ? "selected" : void 0,
|
|
3710
3762
|
"data-highlighted": isHighlighted ? "" : void 0,
|
|
@@ -3968,7 +4020,6 @@ import {
|
|
|
3968
4020
|
useRef as useRef8,
|
|
3969
4021
|
useState as useState7
|
|
3970
4022
|
} from "react";
|
|
3971
|
-
import { iconSizes as iconSizes7 } from "@refineui/tokens";
|
|
3972
4023
|
|
|
3973
4024
|
// src/components/Dialog/Dialog.tsx
|
|
3974
4025
|
import { clsx as clsx32 } from "clsx";
|
|
@@ -4302,37 +4353,45 @@ function DialogClose({ className, onClick, type = "button", ...props }) {
|
|
|
4302
4353
|
|
|
4303
4354
|
// src/components/Command/style.ts
|
|
4304
4355
|
import { clsx as clsx33 } from "clsx";
|
|
4305
|
-
import { foundationSizes as foundationSizes2 } from "@refineui/tokens";
|
|
4356
|
+
import { foundationSizes as foundationSizes2, iconSizes as iconSizes7 } from "@refineui/tokens";
|
|
4306
4357
|
var COMMAND_LIST_MAX_HEIGHT = `min(60vh, ${foundationSizes2.foundationSize3200})`;
|
|
4307
4358
|
var commandStyles = {
|
|
4308
|
-
|
|
4309
|
-
|
|
4310
|
-
|
|
4311
|
-
|
|
4312
|
-
"shadow-refineui-2"
|
|
4313
|
-
),
|
|
4314
|
-
/** Nested inside Dialog panel — Dialog already supplies radius / elevation */
|
|
4315
|
-
rootInDialog: "min-h-0 w-full flex-col overflow-hidden rounded-none border-none shadow-none",
|
|
4359
|
+
/** Detached layout: the search field and the results panel are separate surfaces, so the root has none. */
|
|
4360
|
+
root: "flex w-full flex-col gap-refineui-size-small text-refineui-alias-foreground-primary outline-none",
|
|
4361
|
+
rootInDialog: "min-h-0 w-full",
|
|
4362
|
+
/** Dialog panel stays transparent — the field and results panel float on the scrim themselves. */
|
|
4316
4363
|
dialogContentPanel: {
|
|
4317
4364
|
padding: 0,
|
|
4318
|
-
overflow: "
|
|
4365
|
+
overflow: "visible",
|
|
4366
|
+
backgroundColor: "transparent",
|
|
4367
|
+
boxShadow: "none",
|
|
4368
|
+
borderRadius: 0
|
|
4319
4369
|
},
|
|
4320
|
-
dialogBody: "flex min-h-0 w-full flex-col
|
|
4321
|
-
inputWrap: "shrink-0
|
|
4322
|
-
/**
|
|
4323
|
-
|
|
4370
|
+
dialogBody: "flex min-h-0 w-full flex-col",
|
|
4371
|
+
inputWrap: "shrink-0",
|
|
4372
|
+
/**
|
|
4373
|
+
* Results surface. Height is measured from the results (animated in refineui.css), capped by `maxHeight`.
|
|
4374
|
+
* Radius comes from `--refineui-command-list-radius` (per size, refineui.css) so the scrollbar inset can share it.
|
|
4375
|
+
*/
|
|
4376
|
+
listShell: clsx33(
|
|
4377
|
+
"box-border w-full overflow-hidden",
|
|
4378
|
+
"border-refineui-hairline border-refineui-alias-border-default",
|
|
4379
|
+
"bg-refineui-alias-background-primary shadow-refineui-2"
|
|
4380
|
+
),
|
|
4324
4381
|
list: "h-full min-h-0 w-full",
|
|
4325
|
-
|
|
4326
|
-
height: COMMAND_LIST_MAX_HEIGHT,
|
|
4382
|
+
listShellMaxHeight: {
|
|
4327
4383
|
maxHeight: COMMAND_LIST_MAX_HEIGHT
|
|
4328
4384
|
},
|
|
4329
4385
|
listViewport: "outline-none",
|
|
4330
|
-
listInner: "flex flex-col gap-refineui-size-xxx-small px-refineui-size-medium py-refineui-size-small",
|
|
4386
|
+
listInner: "relative flex flex-col gap-refineui-size-xxx-small px-refineui-size-medium py-refineui-size-small",
|
|
4387
|
+
/** Sliding highlight behind the selected item; geometry is measured, so physical `left`/`top` (inline) are intentional. */
|
|
4388
|
+
indicator: "pointer-events-none absolute rounded-refineui-large bg-refineui-alias-background-surface-hover",
|
|
4331
4389
|
empty: clsx33(
|
|
4332
4390
|
componentTextClass(componentTypographyTokens.command.empty),
|
|
4333
4391
|
"px-refineui-size-medium py-refineui-size-xx-large text-center text-refineui-alias-foreground-tertiary"
|
|
4334
4392
|
),
|
|
4335
|
-
|
|
4393
|
+
/** `overflow-clip`, not hidden: a hidden group would become the scroll container the edge effect tracks. */
|
|
4394
|
+
group: "flex flex-col gap-refineui-size-xxx-small overflow-clip",
|
|
4336
4395
|
groupHeading: clsx33(
|
|
4337
4396
|
componentTextClass(componentTypographyTokens.command.group),
|
|
4338
4397
|
"flex w-full items-center overflow-hidden px-refineui-size-x-small py-refineui-size-xxx-small text-refineui-alias-foreground-tertiary"
|
|
@@ -4340,9 +4399,8 @@ var commandStyles = {
|
|
|
4340
4399
|
separatorWrap: "flex w-full items-center px-refineui-size-x-small py-refineui-size-x-small",
|
|
4341
4400
|
separatorLine: "h-px w-full shrink-0 bg-refineui-alias-border-default",
|
|
4342
4401
|
itemBase: clsx33(
|
|
4343
|
-
|
|
4344
|
-
"
|
|
4345
|
-
"px-refineui-size-x-small py-refineui-size-small text-start outline-none"
|
|
4402
|
+
"relative flex w-full items-center gap-refineui-size-x-small rounded-refineui-large border-none bg-transparent",
|
|
4403
|
+
"px-refineui-size-x-small text-start outline-none"
|
|
4346
4404
|
),
|
|
4347
4405
|
itemDisabled: "cursor-not-allowed text-refineui-alias-foreground-disabled",
|
|
4348
4406
|
itemEnabled: "cursor-pointer text-refineui-alias-foreground-primary",
|
|
@@ -4354,6 +4412,16 @@ var commandStyles = {
|
|
|
4354
4412
|
"shrink-0 tracking-wide text-refineui-alias-foreground-tertiary"
|
|
4355
4413
|
)
|
|
4356
4414
|
};
|
|
4415
|
+
var commandItemSizeClass = {
|
|
4416
|
+
sm: clsx33(sizedComponentTextClass(componentTypographyTokens.command.item, "sm"), "py-refineui-size-xx-small"),
|
|
4417
|
+
md: clsx33(sizedComponentTextClass(componentTypographyTokens.command.item, "md"), "py-refineui-size-small"),
|
|
4418
|
+
lg: clsx33(sizedComponentTextClass(componentTypographyTokens.command.item, "lg"), "py-refineui-size-medium")
|
|
4419
|
+
};
|
|
4420
|
+
var commandItemIconSize = {
|
|
4421
|
+
sm: iconSizes7.xsmall,
|
|
4422
|
+
md: iconSizes7.small,
|
|
4423
|
+
lg: iconSizes7.medium
|
|
4424
|
+
};
|
|
4357
4425
|
|
|
4358
4426
|
// src/components/Command/Command.tsx
|
|
4359
4427
|
import { jsx as jsx26, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
@@ -4389,6 +4457,7 @@ function useControllableString2(controlled, defaultValue, onChange) {
|
|
|
4389
4457
|
function Command({
|
|
4390
4458
|
children,
|
|
4391
4459
|
className,
|
|
4460
|
+
size = "md",
|
|
4392
4461
|
value,
|
|
4393
4462
|
defaultValue,
|
|
4394
4463
|
onValueChange,
|
|
@@ -4507,6 +4576,7 @@ function Command({
|
|
|
4507
4576
|
);
|
|
4508
4577
|
const ctx = useMemo6(
|
|
4509
4578
|
() => ({
|
|
4579
|
+
size,
|
|
4510
4580
|
search,
|
|
4511
4581
|
setSearch,
|
|
4512
4582
|
shouldFilter,
|
|
@@ -4524,6 +4594,7 @@ function Command({
|
|
|
4524
4594
|
groupHasVisibleItems
|
|
4525
4595
|
}),
|
|
4526
4596
|
[
|
|
4597
|
+
size,
|
|
4527
4598
|
search,
|
|
4528
4599
|
setSearch,
|
|
4529
4600
|
shouldFilter,
|
|
@@ -4545,6 +4616,7 @@ function Command({
|
|
|
4545
4616
|
"div",
|
|
4546
4617
|
{
|
|
4547
4618
|
"data-refineui": "command",
|
|
4619
|
+
"data-size": size,
|
|
4548
4620
|
role: "presentation",
|
|
4549
4621
|
className: clsx34(commandStyles.root, className),
|
|
4550
4622
|
onKeyDown: (event) => {
|
|
@@ -4596,17 +4668,19 @@ function CommandDialog({
|
|
|
4596
4668
|
Command,
|
|
4597
4669
|
{
|
|
4598
4670
|
...commandProps,
|
|
4671
|
+
size: commandProps?.size ?? "lg",
|
|
4599
4672
|
className: clsx34(commandStyles.rootInDialog, commandProps?.className),
|
|
4600
4673
|
children
|
|
4601
4674
|
}
|
|
4602
4675
|
) }) }) });
|
|
4603
4676
|
}
|
|
4604
4677
|
var CommandInput = forwardRef8(function CommandInput2({ className, startIcon, placeholder = "Type a command or search\u2026", disabled, onKeyDown, ...props }, ref) {
|
|
4605
|
-
const { search, setSearch, listId, label, selectedValue } = useCommandContext("CommandInput");
|
|
4678
|
+
const { size, search, setSearch, listId, label, selectedValue } = useCommandContext("CommandInput");
|
|
4606
4679
|
const activeDescendantId = selectedValue ? `${listId}-item-${cssEscape(selectedValue)}` : void 0;
|
|
4607
4680
|
return /* @__PURE__ */ jsx26("div", { "data-refineui": "command-input", className: commandStyles.inputWrap, children: /* @__PURE__ */ jsxs7(
|
|
4608
4681
|
SearchField,
|
|
4609
4682
|
{
|
|
4683
|
+
size,
|
|
4610
4684
|
value: search,
|
|
4611
4685
|
onValueChange: setSearch,
|
|
4612
4686
|
disabled,
|
|
@@ -4635,14 +4709,90 @@ var CommandInput = forwardRef8(function CommandInput2({ className, startIcon, pl
|
|
|
4635
4709
|
}
|
|
4636
4710
|
) });
|
|
4637
4711
|
});
|
|
4712
|
+
var HIDDEN_INDICATOR = { top: 0, left: 0, width: 0, height: 0, ready: false };
|
|
4713
|
+
var SELECTED_ITEM_SELECTOR = '[data-refineui="command-item"][data-selected="true"]';
|
|
4714
|
+
function sameIndicatorBox(a, b) {
|
|
4715
|
+
return a.ready === b.ready && a.top === b.top && a.left === b.left && a.width === b.width && a.height === b.height;
|
|
4716
|
+
}
|
|
4638
4717
|
function CommandList({ className, children, ...props }) {
|
|
4639
|
-
const { listId } = useCommandContext("CommandList");
|
|
4718
|
+
const { listId, selectedValue, search, visibleCount } = useCommandContext("CommandList");
|
|
4719
|
+
const shellRef = useRef8(null);
|
|
4720
|
+
const innerRef = useRef8(null);
|
|
4721
|
+
const [contentHeight, setContentHeight] = useState7(null);
|
|
4722
|
+
const [indicator, setIndicator] = useState7(HIDDEN_INDICATOR);
|
|
4723
|
+
const [animate, setAnimate] = useState7(false);
|
|
4724
|
+
const [snap, setSnap] = useState7(false);
|
|
4725
|
+
const lastSearchRef = useRef8(search);
|
|
4726
|
+
const measure = useCallback6(() => {
|
|
4727
|
+
const inner = innerRef.current;
|
|
4728
|
+
const shell = shellRef.current;
|
|
4729
|
+
if (!inner || !shell) return;
|
|
4730
|
+
const shellStyle = getComputedStyle(shell);
|
|
4731
|
+
const height = inner.offsetHeight + parseFloat(shellStyle.borderTopWidth) + parseFloat(shellStyle.borderBottomWidth);
|
|
4732
|
+
setContentHeight((prev) => prev === height ? prev : height);
|
|
4733
|
+
const selected = inner.querySelector(SELECTED_ITEM_SELECTOR);
|
|
4734
|
+
setIndicator((prev) => {
|
|
4735
|
+
const next = selected ? {
|
|
4736
|
+
top: selected.offsetTop,
|
|
4737
|
+
left: selected.offsetLeft,
|
|
4738
|
+
width: selected.offsetWidth,
|
|
4739
|
+
height: selected.offsetHeight,
|
|
4740
|
+
ready: true
|
|
4741
|
+
} : { ...prev, ready: false };
|
|
4742
|
+
return sameIndicatorBox(prev, next) ? prev : next;
|
|
4743
|
+
});
|
|
4744
|
+
}, []);
|
|
4745
|
+
useIsomorphicLayoutEffect2(() => {
|
|
4746
|
+
if (lastSearchRef.current !== search) {
|
|
4747
|
+
lastSearchRef.current = search;
|
|
4748
|
+
setSnap(true);
|
|
4749
|
+
}
|
|
4750
|
+
measure();
|
|
4751
|
+
}, [measure, selectedValue, search, visibleCount, children]);
|
|
4752
|
+
useEffect5(() => {
|
|
4753
|
+
if (!snap) return;
|
|
4754
|
+
let raf2 = 0;
|
|
4755
|
+
const raf1 = requestAnimationFrame(() => {
|
|
4756
|
+
raf2 = requestAnimationFrame(() => setSnap(false));
|
|
4757
|
+
});
|
|
4758
|
+
return () => {
|
|
4759
|
+
cancelAnimationFrame(raf1);
|
|
4760
|
+
cancelAnimationFrame(raf2);
|
|
4761
|
+
};
|
|
4762
|
+
}, [snap]);
|
|
4763
|
+
useEffect5(() => {
|
|
4764
|
+
const inner = innerRef.current;
|
|
4765
|
+
if (!inner || typeof ResizeObserver === "undefined") return;
|
|
4766
|
+
const observer = new ResizeObserver(measure);
|
|
4767
|
+
observer.observe(inner);
|
|
4768
|
+
return () => observer.disconnect();
|
|
4769
|
+
}, [measure]);
|
|
4770
|
+
const measured = contentHeight !== null;
|
|
4771
|
+
useEffect5(() => {
|
|
4772
|
+
if (!measured || animate) return;
|
|
4773
|
+
let raf2 = 0;
|
|
4774
|
+
const raf1 = requestAnimationFrame(() => {
|
|
4775
|
+
raf2 = requestAnimationFrame(() => setAnimate(true));
|
|
4776
|
+
});
|
|
4777
|
+
return () => {
|
|
4778
|
+
cancelAnimationFrame(raf1);
|
|
4779
|
+
cancelAnimationFrame(raf2);
|
|
4780
|
+
};
|
|
4781
|
+
}, [measured, animate]);
|
|
4782
|
+
const indicatorStyle = {
|
|
4783
|
+
top: indicator.top,
|
|
4784
|
+
left: indicator.left,
|
|
4785
|
+
width: indicator.width,
|
|
4786
|
+
height: indicator.height
|
|
4787
|
+
};
|
|
4640
4788
|
return /* @__PURE__ */ jsx26(
|
|
4641
4789
|
"div",
|
|
4642
4790
|
{
|
|
4791
|
+
ref: shellRef,
|
|
4643
4792
|
"data-refineui": "command-list",
|
|
4793
|
+
"data-animate": animate ? "true" : void 0,
|
|
4644
4794
|
className: commandStyles.listShell,
|
|
4645
|
-
style: commandStyles.
|
|
4795
|
+
style: { ...commandStyles.listShellMaxHeight, height: contentHeight ?? void 0 },
|
|
4646
4796
|
children: /* @__PURE__ */ jsx26(
|
|
4647
4797
|
ScrollAreaRegion,
|
|
4648
4798
|
{
|
|
@@ -4650,7 +4800,21 @@ function CommandList({ className, children, ...props }) {
|
|
|
4650
4800
|
className: clsx34(commandStyles.list, className),
|
|
4651
4801
|
viewportClassName: commandStyles.listViewport,
|
|
4652
4802
|
...props,
|
|
4653
|
-
children: /* @__PURE__ */
|
|
4803
|
+
children: /* @__PURE__ */ jsxs7("div", { ref: innerRef, id: listId, role: "listbox", className: commandStyles.listInner, children: [
|
|
4804
|
+
/* @__PURE__ */ jsx26(
|
|
4805
|
+
"div",
|
|
4806
|
+
{
|
|
4807
|
+
"data-refineui": "command-indicator",
|
|
4808
|
+
"data-ready": indicator.ready ? "true" : void 0,
|
|
4809
|
+
"data-animate": animate && !snap ? "true" : void 0,
|
|
4810
|
+
"data-scroll-edge-item": true,
|
|
4811
|
+
"aria-hidden": true,
|
|
4812
|
+
className: commandStyles.indicator,
|
|
4813
|
+
style: indicatorStyle
|
|
4814
|
+
}
|
|
4815
|
+
),
|
|
4816
|
+
children
|
|
4817
|
+
] })
|
|
4654
4818
|
}
|
|
4655
4819
|
)
|
|
4656
4820
|
}
|
|
@@ -4695,6 +4859,7 @@ function CommandGroupHeading({ className, children, ...props }) {
|
|
|
4695
4859
|
"div",
|
|
4696
4860
|
{
|
|
4697
4861
|
"data-refineui": "command-group-heading",
|
|
4862
|
+
"data-scroll-edge-item": true,
|
|
4698
4863
|
className: clsx34(commandStyles.groupHeading, className),
|
|
4699
4864
|
...props,
|
|
4700
4865
|
children
|
|
@@ -4778,6 +4943,7 @@ var CommandItem = forwardRef8(function CommandItem2({
|
|
|
4778
4943
|
...props
|
|
4779
4944
|
}, forwardedRef) {
|
|
4780
4945
|
const {
|
|
4946
|
+
size,
|
|
4781
4947
|
selectedValue,
|
|
4782
4948
|
setSelectedValue,
|
|
4783
4949
|
listId,
|
|
@@ -4785,6 +4951,7 @@ var CommandItem = forwardRef8(function CommandItem2({
|
|
|
4785
4951
|
isItemVisible,
|
|
4786
4952
|
selectById
|
|
4787
4953
|
} = useCommandContext("CommandItem");
|
|
4954
|
+
const iconSize = commandItemIconSize[size];
|
|
4788
4955
|
const group = useContext7(CommandGroupContext);
|
|
4789
4956
|
const itemId = useId6();
|
|
4790
4957
|
const nodeRef = useRef8(null);
|
|
@@ -4828,11 +4995,13 @@ var CommandItem = forwardRef8(function CommandItem2({
|
|
|
4828
4995
|
"aria-selected": isSelected,
|
|
4829
4996
|
disabled,
|
|
4830
4997
|
"data-refineui": "command-item",
|
|
4998
|
+
"data-scroll-edge-item": true,
|
|
4831
4999
|
"data-state": disabled ? "disabled" : isSelected ? "active" : "default",
|
|
4832
5000
|
"data-selected": isSelected || void 0,
|
|
4833
5001
|
"data-disabled": disabled || void 0,
|
|
4834
5002
|
className: clsx34(
|
|
4835
5003
|
commandStyles.itemBase,
|
|
5004
|
+
commandItemSizeClass[size],
|
|
4836
5005
|
disabled ? commandStyles.itemDisabled : commandStyles.itemEnabled,
|
|
4837
5006
|
className
|
|
4838
5007
|
),
|
|
@@ -4852,9 +5021,9 @@ var CommandItem = forwardRef8(function CommandItem2({
|
|
|
4852
5021
|
{
|
|
4853
5022
|
className: commandStyles.iconWrap,
|
|
4854
5023
|
style: {
|
|
4855
|
-
width:
|
|
4856
|
-
minWidth:
|
|
4857
|
-
height:
|
|
5024
|
+
width: iconSize,
|
|
5025
|
+
minWidth: iconSize,
|
|
5026
|
+
height: iconSize
|
|
4858
5027
|
},
|
|
4859
5028
|
children: startIcon
|
|
4860
5029
|
}
|
|
@@ -4868,9 +5037,9 @@ var CommandItem = forwardRef8(function CommandItem2({
|
|
|
4868
5037
|
{
|
|
4869
5038
|
className: commandStyles.iconWrap,
|
|
4870
5039
|
style: {
|
|
4871
|
-
width:
|
|
4872
|
-
minWidth:
|
|
4873
|
-
height:
|
|
5040
|
+
width: iconSize,
|
|
5041
|
+
minWidth: iconSize,
|
|
5042
|
+
height: iconSize
|
|
4874
5043
|
},
|
|
4875
5044
|
children: endIcon
|
|
4876
5045
|
}
|
|
@@ -8981,6 +9150,7 @@ function DropdownLabel({ className, ...props }) {
|
|
|
8981
9150
|
{
|
|
8982
9151
|
role: "presentation",
|
|
8983
9152
|
"data-refineui": "dropdown-menu-label",
|
|
9153
|
+
"data-scroll-edge-item": true,
|
|
8984
9154
|
className: clsx70(dropdownStyles.label, className),
|
|
8985
9155
|
...props
|
|
8986
9156
|
}
|
|
@@ -9010,6 +9180,7 @@ function DropdownItem({
|
|
|
9010
9180
|
type: "button",
|
|
9011
9181
|
role: "menuitem",
|
|
9012
9182
|
"data-refineui": "dropdown-item",
|
|
9183
|
+
"data-scroll-edge-item": true,
|
|
9013
9184
|
"data-selected": selected || void 0,
|
|
9014
9185
|
"data-state": pressed ? "pressed" : selected ? "selected" : void 0,
|
|
9015
9186
|
disabled,
|
|
@@ -9187,6 +9358,7 @@ function DropdownSubTrigger({
|
|
|
9187
9358
|
"aria-expanded": open,
|
|
9188
9359
|
disabled: isDisabled,
|
|
9189
9360
|
"data-refineui": "dropdown-item",
|
|
9361
|
+
"data-scroll-edge-item": true,
|
|
9190
9362
|
"data-slot": "dropdown-menu-sub-trigger",
|
|
9191
9363
|
tabIndex: -1,
|
|
9192
9364
|
className: clsx70(
|
|
@@ -10692,6 +10864,7 @@ function NavigationMenuIndicator({ className, style, ...props }) {
|
|
|
10692
10864
|
|
|
10693
10865
|
// src/components/Sidebar/Sidebar.tsx
|
|
10694
10866
|
import { clsx as clsx80 } from "clsx";
|
|
10867
|
+
import { createContext as createContext19, useContext as useContext21 } from "react";
|
|
10695
10868
|
|
|
10696
10869
|
// src/components/Sidebar/style.ts
|
|
10697
10870
|
import { clsx as clsx79 } from "clsx";
|
|
@@ -10710,7 +10883,9 @@ var sidebarStyles = {
|
|
|
10710
10883
|
componentTextClass(componentTypographyTokens.sidebar.brand),
|
|
10711
10884
|
"m-0 flex min-w-0 items-center gap-refineui-size-small text-refineui-alias-foreground-primary"
|
|
10712
10885
|
),
|
|
10713
|
-
|
|
10886
|
+
/** Scrolls through a built-in ScrollArea; padding sits inside the viewport so rows scroll under the edges. */
|
|
10887
|
+
content: "flex min-h-0 flex-1 flex-col",
|
|
10888
|
+
contentViewport: "box-border px-refineui-size-medium py-refineui-size-medium",
|
|
10714
10889
|
nav: "flex min-h-0 flex-col gap-refineui-size-x-large",
|
|
10715
10890
|
group: "flex min-w-0 flex-col gap-refineui-size-xx-small",
|
|
10716
10891
|
groupLabel: clsx79(
|
|
@@ -10735,6 +10910,7 @@ var sidebarStyles = {
|
|
|
10735
10910
|
|
|
10736
10911
|
// src/components/Sidebar/Sidebar.tsx
|
|
10737
10912
|
import { jsx as jsx60 } from "react/jsx-runtime";
|
|
10913
|
+
var SidebarScrollContext = createContext19(false);
|
|
10738
10914
|
function Sidebar({ className, ...props }) {
|
|
10739
10915
|
return /* @__PURE__ */ jsx60(
|
|
10740
10916
|
"aside",
|
|
@@ -10765,13 +10941,14 @@ function SidebarBrand({ className, ...props }) {
|
|
|
10765
10941
|
}
|
|
10766
10942
|
);
|
|
10767
10943
|
}
|
|
10768
|
-
function SidebarContent({ className, ...props }) {
|
|
10944
|
+
function SidebarContent({ className, children, ...props }) {
|
|
10769
10945
|
return /* @__PURE__ */ jsx60(
|
|
10770
10946
|
"div",
|
|
10771
10947
|
{
|
|
10772
10948
|
"data-refineui": "sidebar-content",
|
|
10773
10949
|
className: clsx80(sidebarStyles.content, className),
|
|
10774
|
-
...props
|
|
10950
|
+
...props,
|
|
10951
|
+
children: /* @__PURE__ */ jsx60(ScrollAreaRegion, { type: "hover", viewportClassName: sidebarStyles.contentViewport, children: /* @__PURE__ */ jsx60(SidebarScrollContext.Provider, { value: true, children }) })
|
|
10775
10952
|
}
|
|
10776
10953
|
);
|
|
10777
10954
|
}
|
|
@@ -10797,10 +10974,12 @@ function SidebarGroup({ className, ...props }) {
|
|
|
10797
10974
|
);
|
|
10798
10975
|
}
|
|
10799
10976
|
function SidebarGroupLabel({ className, ...props }) {
|
|
10977
|
+
const inScroll = useContext21(SidebarScrollContext);
|
|
10800
10978
|
return /* @__PURE__ */ jsx60(
|
|
10801
10979
|
"p",
|
|
10802
10980
|
{
|
|
10803
10981
|
"data-refineui": "sidebar-group-label",
|
|
10982
|
+
"data-scroll-edge-item": inScroll || void 0,
|
|
10804
10983
|
className: clsx80(sidebarStyles.groupLabel, className),
|
|
10805
10984
|
...props
|
|
10806
10985
|
}
|
|
@@ -10813,10 +10992,12 @@ function SidebarLink({
|
|
|
10813
10992
|
...props
|
|
10814
10993
|
}) {
|
|
10815
10994
|
const disabled = ariaDisabled === true || ariaDisabled === "true";
|
|
10995
|
+
const inScroll = useContext21(SidebarScrollContext);
|
|
10816
10996
|
return /* @__PURE__ */ jsx60(
|
|
10817
10997
|
"a",
|
|
10818
10998
|
{
|
|
10819
10999
|
"data-refineui": "sidebar-link",
|
|
11000
|
+
"data-scroll-edge-item": inScroll || void 0,
|
|
10820
11001
|
"data-active": active || void 0,
|
|
10821
11002
|
"aria-current": active ? "page" : void 0,
|
|
10822
11003
|
"aria-disabled": disabled || void 0,
|
|
@@ -10845,9 +11026,9 @@ function SidebarFooter({ className, ...props }) {
|
|
|
10845
11026
|
// src/components/Sidebar/SidebarPeek.tsx
|
|
10846
11027
|
import { clsx as clsx82 } from "clsx";
|
|
10847
11028
|
import {
|
|
10848
|
-
createContext as
|
|
11029
|
+
createContext as createContext20,
|
|
10849
11030
|
useCallback as useCallback15,
|
|
10850
|
-
useContext as
|
|
11031
|
+
useContext as useContext22,
|
|
10851
11032
|
useEffect as useEffect14,
|
|
10852
11033
|
useMemo as useMemo15,
|
|
10853
11034
|
useRef as useRef16,
|
|
@@ -10882,9 +11063,9 @@ import { jsx as jsx61 } from "react/jsx-runtime";
|
|
|
10882
11063
|
var PEEK_OPEN_DELAY_MS = motionMsToNumber5(semanticInteraction7.duration.medium);
|
|
10883
11064
|
var PEEK_CLOSE_DELAY_MS = motionMsToNumber5(semanticInteraction7.duration.medium);
|
|
10884
11065
|
var PEEK_BRIDGE_DELAY_MS = motionMsToNumber5(semanticInteraction7.duration.slow);
|
|
10885
|
-
var SidebarPeekContext =
|
|
11066
|
+
var SidebarPeekContext = createContext20(null);
|
|
10886
11067
|
function useSidebarPeekContext(component) {
|
|
10887
|
-
const ctx =
|
|
11068
|
+
const ctx = useContext22(SidebarPeekContext);
|
|
10888
11069
|
if (!ctx) throw new Error(`${component} must be used within <SidebarPeek>.`);
|
|
10889
11070
|
return ctx;
|
|
10890
11071
|
}
|
|
@@ -11133,19 +11314,19 @@ function useSidebarPeek() {
|
|
|
11133
11314
|
|
|
11134
11315
|
// src/components/Sidebar/SidebarProvider.tsx
|
|
11135
11316
|
import {
|
|
11136
|
-
createContext as
|
|
11317
|
+
createContext as createContext21,
|
|
11137
11318
|
forwardRef as forwardRef14,
|
|
11138
11319
|
useCallback as useCallback16,
|
|
11139
|
-
useContext as
|
|
11320
|
+
useContext as useContext23,
|
|
11140
11321
|
useId as useId13,
|
|
11141
11322
|
useMemo as useMemo16,
|
|
11142
11323
|
useState as useState20
|
|
11143
11324
|
} from "react";
|
|
11144
11325
|
import { Slot as Slot3 } from "@refineui/utilities/react";
|
|
11145
11326
|
import { jsx as jsx62 } from "react/jsx-runtime";
|
|
11146
|
-
var SidebarContext =
|
|
11327
|
+
var SidebarContext = createContext21(null);
|
|
11147
11328
|
function useSidebarContext(component) {
|
|
11148
|
-
const value =
|
|
11329
|
+
const value = useContext23(SidebarContext);
|
|
11149
11330
|
if (!value) throw new Error(`${component} must be used within <SidebarProvider>.`);
|
|
11150
11331
|
return value;
|
|
11151
11332
|
}
|
|
@@ -11321,28 +11502,238 @@ function Pagination(props) {
|
|
|
11321
11502
|
// src/components/PopOver/PopOver.tsx
|
|
11322
11503
|
import { clsx as clsx85 } from "clsx";
|
|
11323
11504
|
import {
|
|
11324
|
-
createContext as
|
|
11505
|
+
createContext as createContext22,
|
|
11325
11506
|
useCallback as useCallback17,
|
|
11326
|
-
useContext as
|
|
11327
|
-
useEffect as
|
|
11507
|
+
useContext as useContext24,
|
|
11508
|
+
useEffect as useEffect16,
|
|
11328
11509
|
useId as useId14,
|
|
11329
11510
|
useMemo as useMemo17,
|
|
11330
11511
|
useRef as useRef17,
|
|
11331
|
-
useState as
|
|
11512
|
+
useState as useState22
|
|
11332
11513
|
} from "react";
|
|
11333
|
-
import {
|
|
11514
|
+
import { borderRadii, spacings as spacings6 } from "@refineui/tokens";
|
|
11334
11515
|
import { resolveColorTokenValue as resolveColorTokenValue10 } from "@refineui/utilities/color";
|
|
11335
11516
|
import { Slot as Slot4, getMergeableTriggerChild as getMergeableTriggerChild3 } from "@refineui/utilities/react";
|
|
11336
11517
|
|
|
11518
|
+
// src/components/shared/FloatingSurface.tsx
|
|
11519
|
+
import { useEffect as useEffect15, useLayoutEffect as useLayoutEffect9, useState as useState21 } from "react";
|
|
11520
|
+
import { spacings as spacings5, strokeWidths as strokeWidths2 } from "@refineui/tokens";
|
|
11521
|
+
|
|
11522
|
+
// src/components/shared/floatingOutline.ts
|
|
11523
|
+
var PATH_PRECISION = 100;
|
|
11524
|
+
function fmt(n) {
|
|
11525
|
+
return String(Math.round(n * PATH_PRECISION) / PATH_PRECISION);
|
|
11526
|
+
}
|
|
11527
|
+
function pt(p) {
|
|
11528
|
+
return `${fmt(p.x)} ${fmt(p.y)}`;
|
|
11529
|
+
}
|
|
11530
|
+
function towards(from, to, distance) {
|
|
11531
|
+
const length = Math.hypot(to.x - from.x, to.y - from.y);
|
|
11532
|
+
if (length === 0) return from;
|
|
11533
|
+
const t = distance / length;
|
|
11534
|
+
return { x: from.x + (to.x - from.x) * t, y: from.y + (to.y - from.y) * t };
|
|
11535
|
+
}
|
|
11536
|
+
function floatingShapeSize(panelWidth, panelHeight, side, beakHeight) {
|
|
11537
|
+
const vertical = side === "top" || side === "bottom";
|
|
11538
|
+
return {
|
|
11539
|
+
width: vertical ? panelWidth : panelWidth + beakHeight,
|
|
11540
|
+
height: vertical ? panelHeight + beakHeight : panelHeight
|
|
11541
|
+
};
|
|
11542
|
+
}
|
|
11543
|
+
function resolveBeakCenter(edgeLength, align, beakWidth, radius2, insetStart, insetEnd) {
|
|
11544
|
+
const half = beakWidth / 2;
|
|
11545
|
+
const min = radius2 + half;
|
|
11546
|
+
const max = edgeLength - radius2 - half;
|
|
11547
|
+
if (max < min) return edgeLength / 2;
|
|
11548
|
+
const wanted = align === "center" ? edgeLength / 2 : align === "start" ? insetStart + half : edgeLength - insetEnd - half;
|
|
11549
|
+
return Math.min(max, Math.max(min, wanted));
|
|
11550
|
+
}
|
|
11551
|
+
function buildFloatingOutline({
|
|
11552
|
+
panelWidth,
|
|
11553
|
+
panelHeight,
|
|
11554
|
+
radius: radius2,
|
|
11555
|
+
side,
|
|
11556
|
+
beakCenter,
|
|
11557
|
+
beakWidth,
|
|
11558
|
+
beakHeight,
|
|
11559
|
+
tipRadius,
|
|
11560
|
+
inset = 0
|
|
11561
|
+
}) {
|
|
11562
|
+
const offsetX = side === "left" ? beakHeight : 0;
|
|
11563
|
+
const offsetY = side === "top" ? beakHeight : 0;
|
|
11564
|
+
const x0 = offsetX + inset;
|
|
11565
|
+
const y0 = offsetY + inset;
|
|
11566
|
+
const x1 = offsetX + panelWidth - inset;
|
|
11567
|
+
const y1 = offsetY + panelHeight - inset;
|
|
11568
|
+
const r = Math.max(0, Math.min(radius2 - inset, (x1 - x0) / 2, (y1 - y0) / 2));
|
|
11569
|
+
const half = beakWidth / 2;
|
|
11570
|
+
const sinHalfAngle = half / Math.hypot(half, beakHeight);
|
|
11571
|
+
const reach = beakHeight + inset - inset / sinHalfAngle;
|
|
11572
|
+
const spread = half * reach / beakHeight;
|
|
11573
|
+
const edgeCenter = (side === "top" || side === "bottom" ? offsetX : offsetY) + beakCenter;
|
|
11574
|
+
const beak = (first, tip, second) => {
|
|
11575
|
+
const before = towards(tip, first, tipRadius);
|
|
11576
|
+
const after = towards(tip, second, tipRadius);
|
|
11577
|
+
return ` L ${pt(first)} L ${pt(before)} Q ${pt(tip)} ${pt(after)} L ${pt(second)}`;
|
|
11578
|
+
};
|
|
11579
|
+
let d = `M ${pt({ x: x0 + r, y: y0 })}`;
|
|
11580
|
+
if (side === "top") {
|
|
11581
|
+
d += beak(
|
|
11582
|
+
{ x: edgeCenter - spread, y: y0 },
|
|
11583
|
+
{ x: edgeCenter, y: y0 - reach },
|
|
11584
|
+
{ x: edgeCenter + spread, y: y0 }
|
|
11585
|
+
);
|
|
11586
|
+
}
|
|
11587
|
+
d += ` L ${pt({ x: x1 - r, y: y0 })} A ${fmt(r)} ${fmt(r)} 0 0 1 ${pt({ x: x1, y: y0 + r })}`;
|
|
11588
|
+
if (side === "right") {
|
|
11589
|
+
d += beak(
|
|
11590
|
+
{ x: x1, y: edgeCenter - spread },
|
|
11591
|
+
{ x: x1 + reach, y: edgeCenter },
|
|
11592
|
+
{ x: x1, y: edgeCenter + spread }
|
|
11593
|
+
);
|
|
11594
|
+
}
|
|
11595
|
+
d += ` L ${pt({ x: x1, y: y1 - r })} A ${fmt(r)} ${fmt(r)} 0 0 1 ${pt({ x: x1 - r, y: y1 })}`;
|
|
11596
|
+
if (side === "bottom") {
|
|
11597
|
+
d += beak(
|
|
11598
|
+
{ x: edgeCenter + spread, y: y1 },
|
|
11599
|
+
{ x: edgeCenter, y: y1 + reach },
|
|
11600
|
+
{ x: edgeCenter - spread, y: y1 }
|
|
11601
|
+
);
|
|
11602
|
+
}
|
|
11603
|
+
d += ` L ${pt({ x: x0 + r, y: y1 })} A ${fmt(r)} ${fmt(r)} 0 0 1 ${pt({ x: x0, y: y1 - r })}`;
|
|
11604
|
+
if (side === "left") {
|
|
11605
|
+
d += beak(
|
|
11606
|
+
{ x: x0, y: edgeCenter + spread },
|
|
11607
|
+
{ x: x0 - reach, y: edgeCenter },
|
|
11608
|
+
{ x: x0, y: edgeCenter - spread }
|
|
11609
|
+
);
|
|
11610
|
+
}
|
|
11611
|
+
d += ` L ${pt({ x: x0, y: y0 + r })} A ${fmt(r)} ${fmt(r)} 0 0 1 ${pt({ x: x0 + r, y: y0 })} Z`;
|
|
11612
|
+
return d;
|
|
11613
|
+
}
|
|
11614
|
+
|
|
11615
|
+
// src/components/shared/FloatingSurface.tsx
|
|
11616
|
+
import { jsx as jsx64, jsxs as jsxs24 } from "react/jsx-runtime";
|
|
11617
|
+
var useIsomorphicLayoutEffect6 = typeof document !== "undefined" ? useLayoutEffect9 : useEffect15;
|
|
11618
|
+
var SHADOW_BLEED = parseFloat(spacings5.sizeXXXLarge);
|
|
11619
|
+
var STROKE = parseFloat(strokeWidths2.strokeWidthHairline);
|
|
11620
|
+
function svgPathMask(shape, width, height, bleed) {
|
|
11621
|
+
const svg = `<svg xmlns="http://www.w3.org/2000/svg" width="${width + bleed * 2}" height="${height + bleed * 2}"><path transform="translate(${bleed} ${bleed})" d="${shape}"/></svg>`;
|
|
11622
|
+
return `url("data:image/svg+xml,${encodeURIComponent(svg)}")`;
|
|
11623
|
+
}
|
|
11624
|
+
function usePanelSize(panelRef) {
|
|
11625
|
+
const [size, setSize] = useState21(null);
|
|
11626
|
+
useIsomorphicLayoutEffect6(() => {
|
|
11627
|
+
const panel = panelRef.current;
|
|
11628
|
+
if (!panel) return;
|
|
11629
|
+
const measure = () => {
|
|
11630
|
+
const style = getComputedStyle(panel);
|
|
11631
|
+
const next = { width: parseFloat(style.width), height: parseFloat(style.height) };
|
|
11632
|
+
setSize((prev) => prev && prev.width === next.width && prev.height === next.height ? prev : next);
|
|
11633
|
+
};
|
|
11634
|
+
measure();
|
|
11635
|
+
if (typeof ResizeObserver === "undefined") return;
|
|
11636
|
+
const observer = new ResizeObserver(measure);
|
|
11637
|
+
observer.observe(panel);
|
|
11638
|
+
return () => observer.disconnect();
|
|
11639
|
+
}, [panelRef]);
|
|
11640
|
+
return size;
|
|
11641
|
+
}
|
|
11642
|
+
function FloatingSurface({
|
|
11643
|
+
panelRef,
|
|
11644
|
+
side,
|
|
11645
|
+
align,
|
|
11646
|
+
radius: radius2,
|
|
11647
|
+
beakWidth,
|
|
11648
|
+
beakHeight,
|
|
11649
|
+
tipRadius,
|
|
11650
|
+
beakInsetStart,
|
|
11651
|
+
beakInsetEnd,
|
|
11652
|
+
backgroundColor,
|
|
11653
|
+
borderColor
|
|
11654
|
+
}) {
|
|
11655
|
+
const size = usePanelSize(panelRef);
|
|
11656
|
+
if (!size) return null;
|
|
11657
|
+
const r = parseFloat(radius2);
|
|
11658
|
+
const bw = parseFloat(beakWidth);
|
|
11659
|
+
const bh = parseFloat(beakHeight);
|
|
11660
|
+
const vertical = side === "top" || side === "bottom";
|
|
11661
|
+
const beakCenter = resolveBeakCenter(
|
|
11662
|
+
vertical ? size.width : size.height,
|
|
11663
|
+
align,
|
|
11664
|
+
bw,
|
|
11665
|
+
r,
|
|
11666
|
+
parseFloat(beakInsetStart),
|
|
11667
|
+
parseFloat(beakInsetEnd)
|
|
11668
|
+
);
|
|
11669
|
+
const geometry = {
|
|
11670
|
+
panelWidth: size.width,
|
|
11671
|
+
panelHeight: size.height,
|
|
11672
|
+
radius: r,
|
|
11673
|
+
side,
|
|
11674
|
+
beakCenter,
|
|
11675
|
+
beakWidth: bw,
|
|
11676
|
+
beakHeight: bh,
|
|
11677
|
+
tipRadius: parseFloat(tipRadius)
|
|
11678
|
+
};
|
|
11679
|
+
const shape = buildFloatingOutline(geometry);
|
|
11680
|
+
const outline = buildFloatingOutline({ ...geometry, inset: STROKE / 2 });
|
|
11681
|
+
const box = floatingShapeSize(size.width, size.height, side, bh);
|
|
11682
|
+
const holeMask = `linear-gradient(black 0 0), ${svgPathMask(shape, box.width, box.height, SHADOW_BLEED)}`;
|
|
11683
|
+
const surfaceMask = svgPathMask(shape, box.width, box.height, 0);
|
|
11684
|
+
const rootStyle = {
|
|
11685
|
+
width: box.width,
|
|
11686
|
+
height: box.height,
|
|
11687
|
+
top: side === "top" ? -bh : 0,
|
|
11688
|
+
left: side === "left" ? -bh : 0
|
|
11689
|
+
};
|
|
11690
|
+
const shadowStyle = {
|
|
11691
|
+
inset: -SHADOW_BLEED,
|
|
11692
|
+
maskImage: holeMask,
|
|
11693
|
+
WebkitMaskImage: holeMask,
|
|
11694
|
+
maskComposite: "exclude",
|
|
11695
|
+
WebkitMaskComposite: "xor",
|
|
11696
|
+
maskSize: "100% 100%",
|
|
11697
|
+
WebkitMaskSize: "100% 100%",
|
|
11698
|
+
maskRepeat: "no-repeat",
|
|
11699
|
+
WebkitMaskRepeat: "no-repeat"
|
|
11700
|
+
};
|
|
11701
|
+
const surfaceStyle = {
|
|
11702
|
+
backgroundColor,
|
|
11703
|
+
maskImage: surfaceMask,
|
|
11704
|
+
WebkitMaskImage: surfaceMask,
|
|
11705
|
+
maskSize: "100% 100%",
|
|
11706
|
+
WebkitMaskSize: "100% 100%",
|
|
11707
|
+
maskRepeat: "no-repeat",
|
|
11708
|
+
WebkitMaskRepeat: "no-repeat"
|
|
11709
|
+
};
|
|
11710
|
+
const clip = `path("${shape}")`;
|
|
11711
|
+
return /* @__PURE__ */ jsxs24("div", { "data-refineui": "floating-chrome", "aria-hidden": true, className: "pointer-events-none absolute -z-1", style: rootStyle, children: [
|
|
11712
|
+
/* @__PURE__ */ jsx64("div", { className: "absolute", style: shadowStyle, children: /* @__PURE__ */ jsx64("div", { "data-refineui": "floating-shadow", className: "absolute", style: { inset: SHADOW_BLEED }, children: /* @__PURE__ */ jsx64("div", { className: "absolute inset-0", style: { clipPath: clip, backgroundColor: borderColor } }) }) }),
|
|
11713
|
+
/* @__PURE__ */ jsx64("div", { "data-refineui": "floating-surface", className: "absolute inset-0", style: surfaceStyle }),
|
|
11714
|
+
/* @__PURE__ */ jsx64(
|
|
11715
|
+
"svg",
|
|
11716
|
+
{
|
|
11717
|
+
"data-refineui": "floating-outline",
|
|
11718
|
+
className: "absolute inset-0 overflow-visible",
|
|
11719
|
+
width: box.width,
|
|
11720
|
+
height: box.height,
|
|
11721
|
+
viewBox: `0 0 ${box.width} ${box.height}`,
|
|
11722
|
+
fill: "none",
|
|
11723
|
+
children: /* @__PURE__ */ jsx64("path", { d: outline, stroke: borderColor, strokeWidth: STROKE, strokeLinejoin: "round" })
|
|
11724
|
+
}
|
|
11725
|
+
)
|
|
11726
|
+
] });
|
|
11727
|
+
}
|
|
11728
|
+
|
|
11337
11729
|
// src/components/PopOver/style.ts
|
|
11338
11730
|
var popoverStyles = {
|
|
11339
11731
|
root: "relative inline-block",
|
|
11340
11732
|
fallbackTrigger: "cursor-pointer border-none bg-transparent p-0 font-inherit text-inherit",
|
|
11341
11733
|
floatingRoot: "absolute z-refineui-popup",
|
|
11342
11734
|
panelWrap: "relative inline-block min-w-refineui-popover-panel-width",
|
|
11343
|
-
|
|
11344
|
-
panel: "relative z-0 box-border min-w-refineui-popover-panel-width rounded-refineui-xx-large border-refineui-
|
|
11345
|
-
panelShadowDefault: "shadow-refineui-8"
|
|
11735
|
+
/** Fill, stroke, and shadow come from `FloatingSurface`; the transparent border keeps the box size. */
|
|
11736
|
+
panel: "relative z-0 box-border min-w-refineui-popover-panel-width rounded-refineui-xx-large border-refineui-hairline border-transparent outline-none"
|
|
11346
11737
|
};
|
|
11347
11738
|
function popoverFloatingClasses(placement, align) {
|
|
11348
11739
|
if (placement === "bottom") {
|
|
@@ -11366,58 +11757,22 @@ function popoverFloatingClasses(placement, align) {
|
|
|
11366
11757
|
}
|
|
11367
11758
|
|
|
11368
11759
|
// src/components/PopOver/PopOver.tsx
|
|
11369
|
-
import { jsx as
|
|
11370
|
-
var PopoverContext =
|
|
11760
|
+
import { jsx as jsx65, jsxs as jsxs25 } from "react/jsx-runtime";
|
|
11761
|
+
var PopoverContext = createContext22(null);
|
|
11371
11762
|
function usePopoverContext(component) {
|
|
11372
|
-
const ctx =
|
|
11763
|
+
const ctx = useContext24(PopoverContext);
|
|
11373
11764
|
if (!ctx) throw new Error(`${component} must be used within <Popover>`);
|
|
11374
11765
|
return ctx;
|
|
11375
11766
|
}
|
|
11376
|
-
var
|
|
11377
|
-
var
|
|
11378
|
-
var
|
|
11379
|
-
var
|
|
11380
|
-
|
|
11381
|
-
|
|
11382
|
-
|
|
11383
|
-
|
|
11384
|
-
|
|
11385
|
-
const overlapOffset = `calc(-1 * ${BEAK_OFFSET} + ${BEAK_BORDER_OVERLAP})`;
|
|
11386
|
-
switch (placement) {
|
|
11387
|
-
case "bottom":
|
|
11388
|
-
if (align === "center") return { top: overlapOffset, left: `calc(50% - ${BEAK_W} / 2)` };
|
|
11389
|
-
if (align === "start") return { top: overlapOffset, left: insetStart };
|
|
11390
|
-
return { top: overlapOffset, right: insetEnd };
|
|
11391
|
-
case "top":
|
|
11392
|
-
if (align === "center") return { bottom: overlapOffset, left: `calc(50% - ${BEAK_W} / 2)` };
|
|
11393
|
-
if (align === "start") return { bottom: overlapOffset, left: insetStart };
|
|
11394
|
-
return { bottom: overlapOffset, right: insetEnd };
|
|
11395
|
-
case "left":
|
|
11396
|
-
if (align === "center") return { right: overlapOffset, top: `calc(50% - ${BEAK_W} / 2)` };
|
|
11397
|
-
if (align === "start") return { right: overlapOffset, top: edge };
|
|
11398
|
-
return { right: overlapOffset, bottom: edge };
|
|
11399
|
-
case "right":
|
|
11400
|
-
if (align === "center") return { left: overlapOffset, top: `calc(50% - ${BEAK_W} / 2)` };
|
|
11401
|
-
if (align === "start") return { left: overlapOffset, top: edge };
|
|
11402
|
-
return { left: overlapOffset, bottom: edge };
|
|
11403
|
-
default:
|
|
11404
|
-
return {};
|
|
11405
|
-
}
|
|
11406
|
-
}
|
|
11407
|
-
function beakRotateDeg(placement) {
|
|
11408
|
-
switch (placement) {
|
|
11409
|
-
case "bottom":
|
|
11410
|
-
return 0;
|
|
11411
|
-
case "top":
|
|
11412
|
-
return 180;
|
|
11413
|
-
case "left":
|
|
11414
|
-
return -90;
|
|
11415
|
-
case "right":
|
|
11416
|
-
return 90;
|
|
11417
|
-
default:
|
|
11418
|
-
return 0;
|
|
11419
|
-
}
|
|
11420
|
-
}
|
|
11767
|
+
var BEAK_TIP_GAP = spacings6.sizeXXSmall;
|
|
11768
|
+
var POPOVER_GAP = `calc(${componentSizes2.popoverBeakHeight} + ${BEAK_TIP_GAP})`;
|
|
11769
|
+
var SIDE_BEAK_INSET = spacings6.sizeMedium;
|
|
11770
|
+
var beakSideByPlacement = {
|
|
11771
|
+
bottom: "top",
|
|
11772
|
+
top: "bottom",
|
|
11773
|
+
left: "right",
|
|
11774
|
+
right: "left"
|
|
11775
|
+
};
|
|
11421
11776
|
function floatingGapStyle(placement) {
|
|
11422
11777
|
if (placement === "top") return { marginBottom: POPOVER_GAP };
|
|
11423
11778
|
if (placement === "bottom") return { marginTop: POPOVER_GAP };
|
|
@@ -11425,7 +11780,7 @@ function floatingGapStyle(placement) {
|
|
|
11425
11780
|
return { marginLeft: POPOVER_GAP };
|
|
11426
11781
|
}
|
|
11427
11782
|
function Popover({ children, className, open: openProp, defaultOpen = false, onOpenChange, ...props }) {
|
|
11428
|
-
const [internalOpen, setInternalOpen] =
|
|
11783
|
+
const [internalOpen, setInternalOpen] = useState22(defaultOpen);
|
|
11429
11784
|
const open = openProp ?? internalOpen;
|
|
11430
11785
|
const setOpen = useCallback17(
|
|
11431
11786
|
(next) => {
|
|
@@ -11439,14 +11794,14 @@ function Popover({ children, className, open: openProp, defaultOpen = false, onO
|
|
|
11439
11794
|
const contentRef = useRef17(null);
|
|
11440
11795
|
const triggerRef = useRef17(null);
|
|
11441
11796
|
const contentId = useId14();
|
|
11442
|
-
|
|
11797
|
+
useEffect16(() => {
|
|
11443
11798
|
const handler = (e) => {
|
|
11444
11799
|
if (containerRef.current && !containerRef.current.contains(e.target)) setOpen(false);
|
|
11445
11800
|
};
|
|
11446
11801
|
if (open) document.addEventListener("mousedown", handler);
|
|
11447
11802
|
return () => document.removeEventListener("mousedown", handler);
|
|
11448
11803
|
}, [open, setOpen]);
|
|
11449
|
-
|
|
11804
|
+
useEffect16(() => {
|
|
11450
11805
|
const onKey = (e) => {
|
|
11451
11806
|
if (e instanceof KeyboardEvent && e.key === "Escape") setOpen(false);
|
|
11452
11807
|
};
|
|
@@ -11475,7 +11830,7 @@ function Popover({ children, className, open: openProp, defaultOpen = false, onO
|
|
|
11475
11830
|
}),
|
|
11476
11831
|
[open, setOpen, toggle, contentId, onTriggerKeyDown]
|
|
11477
11832
|
);
|
|
11478
|
-
return /* @__PURE__ */
|
|
11833
|
+
return /* @__PURE__ */ jsx65(PopoverContext.Provider, { value, children: /* @__PURE__ */ jsx65(
|
|
11479
11834
|
"div",
|
|
11480
11835
|
{
|
|
11481
11836
|
ref: containerRef,
|
|
@@ -11491,7 +11846,7 @@ function PopoverTrigger({ children, className, ...props }) {
|
|
|
11491
11846
|
const mergeEl = getMergeableTriggerChild3(children);
|
|
11492
11847
|
if (mergeEl) {
|
|
11493
11848
|
const passthrough = props;
|
|
11494
|
-
return /* @__PURE__ */
|
|
11849
|
+
return /* @__PURE__ */ jsx65(
|
|
11495
11850
|
Slot4,
|
|
11496
11851
|
{
|
|
11497
11852
|
ref: triggerRef,
|
|
@@ -11513,7 +11868,7 @@ function PopoverTrigger({ children, className, ...props }) {
|
|
|
11513
11868
|
);
|
|
11514
11869
|
}
|
|
11515
11870
|
const passthroughBtn = props;
|
|
11516
|
-
return /* @__PURE__ */
|
|
11871
|
+
return /* @__PURE__ */ jsx65(
|
|
11517
11872
|
"button",
|
|
11518
11873
|
{
|
|
11519
11874
|
type: "button",
|
|
@@ -11552,11 +11907,10 @@ function PopoverContent({
|
|
|
11552
11907
|
const palette = componentColorTokens.popover.default;
|
|
11553
11908
|
const bg = resolveColorTokenValue10(palette.background);
|
|
11554
11909
|
const borderCol = resolveColorTokenValue10(palette.border);
|
|
11555
|
-
const bw = beakWrapperStyle(placement, align);
|
|
11556
|
-
const rot = beakRotateDeg(placement);
|
|
11557
11910
|
const gapStyle = floatingGapStyle(placement);
|
|
11911
|
+
const vertical = placement === "top" || placement === "bottom";
|
|
11558
11912
|
if (!open) return null;
|
|
11559
|
-
return /* @__PURE__ */
|
|
11913
|
+
return /* @__PURE__ */ jsx65(
|
|
11560
11914
|
"div",
|
|
11561
11915
|
{
|
|
11562
11916
|
className: clsx85(
|
|
@@ -11564,34 +11918,8 @@ function PopoverContent({
|
|
|
11564
11918
|
popoverFloatingClasses(placement, align)
|
|
11565
11919
|
),
|
|
11566
11920
|
style: gapStyle,
|
|
11567
|
-
children: /* @__PURE__ */
|
|
11568
|
-
/* @__PURE__ */
|
|
11569
|
-
"div",
|
|
11570
|
-
{
|
|
11571
|
-
style: {
|
|
11572
|
-
width: BEAK_W,
|
|
11573
|
-
height: BEAK_H,
|
|
11574
|
-
transform: `rotate(${rot}deg)`,
|
|
11575
|
-
transformOrigin: "center center"
|
|
11576
|
-
},
|
|
11577
|
-
children: /* @__PURE__ */ jsxs24(
|
|
11578
|
-
"svg",
|
|
11579
|
-
{
|
|
11580
|
-
width: BEAK_W,
|
|
11581
|
-
height: BEAK_H,
|
|
11582
|
-
viewBox: "0 0 16 8",
|
|
11583
|
-
fill: "none",
|
|
11584
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
11585
|
-
style: { display: "block" },
|
|
11586
|
-
children: [
|
|
11587
|
-
/* @__PURE__ */ jsx64("polygon", { points: "8,0 0,8 16,8", fill: borderCol }),
|
|
11588
|
-
/* @__PURE__ */ jsx64("polygon", { points: "8,2 2,8 14,8", fill: bg })
|
|
11589
|
-
]
|
|
11590
|
-
}
|
|
11591
|
-
)
|
|
11592
|
-
}
|
|
11593
|
-
) }),
|
|
11594
|
-
/* @__PURE__ */ jsx64(
|
|
11921
|
+
children: /* @__PURE__ */ jsxs25("div", { className: popoverStyles.panelWrap, children: [
|
|
11922
|
+
/* @__PURE__ */ jsx65(
|
|
11595
11923
|
"div",
|
|
11596
11924
|
{
|
|
11597
11925
|
ref: contentRef,
|
|
@@ -11602,22 +11930,32 @@ function PopoverContent({
|
|
|
11602
11930
|
"data-refineui": "popover",
|
|
11603
11931
|
"data-placement": placement,
|
|
11604
11932
|
"data-align": align,
|
|
11605
|
-
className: clsx85(
|
|
11606
|
-
popoverStyles.panel,
|
|
11607
|
-
popoverStyles.panelShadowDefault,
|
|
11608
|
-
className
|
|
11609
|
-
),
|
|
11933
|
+
className: clsx85(popoverStyles.panel, className),
|
|
11610
11934
|
style: {
|
|
11611
11935
|
...styleProp && typeof styleProp === "object" ? styleProp : {},
|
|
11612
11936
|
minWidth: componentSizes2.popoverPanelWidth,
|
|
11613
|
-
padding:
|
|
11614
|
-
|
|
11615
|
-
color: resolveColorTokenValue10(palette.foreground),
|
|
11616
|
-
borderColor: borderCol
|
|
11937
|
+
padding: spacings6.sizeLarge,
|
|
11938
|
+
color: resolveColorTokenValue10(palette.foreground)
|
|
11617
11939
|
},
|
|
11618
11940
|
...props,
|
|
11619
11941
|
children
|
|
11620
11942
|
}
|
|
11943
|
+
),
|
|
11944
|
+
/* @__PURE__ */ jsx65(
|
|
11945
|
+
FloatingSurface,
|
|
11946
|
+
{
|
|
11947
|
+
panelRef: contentRef,
|
|
11948
|
+
side: beakSideByPlacement[placement],
|
|
11949
|
+
align,
|
|
11950
|
+
radius: borderRadii.roundedXXLarge,
|
|
11951
|
+
beakWidth: componentSizes2.popoverBeakWidth,
|
|
11952
|
+
beakHeight: componentSizes2.popoverBeakHeight,
|
|
11953
|
+
tipRadius: componentSizes2.popoverBeakTipRadius,
|
|
11954
|
+
beakInsetStart: vertical ? componentSizes2.popoverBeakInsetFromStartEdge : SIDE_BEAK_INSET,
|
|
11955
|
+
beakInsetEnd: vertical ? componentSizes2.popoverBeakInsetFromEndEdge : SIDE_BEAK_INSET,
|
|
11956
|
+
backgroundColor: bg,
|
|
11957
|
+
borderColor: borderCol
|
|
11958
|
+
}
|
|
11621
11959
|
)
|
|
11622
11960
|
] })
|
|
11623
11961
|
}
|
|
@@ -11631,9 +11969,9 @@ function PopOver({
|
|
|
11631
11969
|
className,
|
|
11632
11970
|
...props
|
|
11633
11971
|
}) {
|
|
11634
|
-
return /* @__PURE__ */
|
|
11635
|
-
/* @__PURE__ */
|
|
11636
|
-
/* @__PURE__ */
|
|
11972
|
+
return /* @__PURE__ */ jsxs25(Popover, { className, ...props, children: [
|
|
11973
|
+
/* @__PURE__ */ jsx65(PopoverTrigger, { children: trigger }),
|
|
11974
|
+
/* @__PURE__ */ jsx65(PopoverContent, { placement, align, children: content })
|
|
11637
11975
|
] });
|
|
11638
11976
|
}
|
|
11639
11977
|
|
|
@@ -11649,7 +11987,7 @@ var skeletonStyles = {
|
|
|
11649
11987
|
};
|
|
11650
11988
|
|
|
11651
11989
|
// src/components/Skeleton/Skeleton.tsx
|
|
11652
|
-
import { jsx as
|
|
11990
|
+
import { jsx as jsx66 } from "react/jsx-runtime";
|
|
11653
11991
|
function Skeleton({
|
|
11654
11992
|
width,
|
|
11655
11993
|
height,
|
|
@@ -11681,7 +12019,7 @@ function Skeleton({
|
|
|
11681
12019
|
w = width ?? "100%";
|
|
11682
12020
|
}
|
|
11683
12021
|
const dimStyle = { width: w, height: h };
|
|
11684
|
-
return /* @__PURE__ */
|
|
12022
|
+
return /* @__PURE__ */ jsx66(
|
|
11685
12023
|
"div",
|
|
11686
12024
|
{
|
|
11687
12025
|
"data-refineui": "skeleton",
|
|
@@ -11699,7 +12037,7 @@ function Skeleton({
|
|
|
11699
12037
|
|
|
11700
12038
|
// src/components/Slider/Slider.tsx
|
|
11701
12039
|
import { clsx as clsx87 } from "clsx";
|
|
11702
|
-
import { useState as
|
|
12040
|
+
import { useState as useState23 } from "react";
|
|
11703
12041
|
|
|
11704
12042
|
// src/components/Slider/style.ts
|
|
11705
12043
|
var sliderStyles = {
|
|
@@ -11707,7 +12045,7 @@ var sliderStyles = {
|
|
|
11707
12045
|
};
|
|
11708
12046
|
|
|
11709
12047
|
// src/components/Slider/Slider.tsx
|
|
11710
|
-
import { jsx as
|
|
12048
|
+
import { jsx as jsx67 } from "react/jsx-runtime";
|
|
11711
12049
|
function clampPct(n) {
|
|
11712
12050
|
if (Number.isNaN(n)) return 0;
|
|
11713
12051
|
return Math.min(100, Math.max(0, n));
|
|
@@ -11725,12 +12063,12 @@ function Slider({
|
|
|
11725
12063
|
style,
|
|
11726
12064
|
...props
|
|
11727
12065
|
}) {
|
|
11728
|
-
const [internalFillPct, setInternalFillPct] =
|
|
12066
|
+
const [internalFillPct, setInternalFillPct] = useState23(() => {
|
|
11729
12067
|
const v = defaultValue !== void 0 ? Number(defaultValue) : (min + max) / 2;
|
|
11730
12068
|
return clampPct((v - min) / (max - min) * 100);
|
|
11731
12069
|
});
|
|
11732
12070
|
const fillPct = value !== void 0 ? clampPct((Number(value) - min) / (max - min) * 100) : internalFillPct;
|
|
11733
|
-
return /* @__PURE__ */
|
|
12071
|
+
return /* @__PURE__ */ jsx67(
|
|
11734
12072
|
"input",
|
|
11735
12073
|
{
|
|
11736
12074
|
type: "range",
|
|
@@ -11770,16 +12108,16 @@ import { iconSizes as iconSizes18 } from "@refineui/tokens";
|
|
|
11770
12108
|
import {
|
|
11771
12109
|
Children as Children6,
|
|
11772
12110
|
cloneElement as cloneElement2,
|
|
11773
|
-
createContext as
|
|
12111
|
+
createContext as createContext23,
|
|
11774
12112
|
forwardRef as forwardRef15,
|
|
11775
12113
|
isValidElement as isValidElement5,
|
|
11776
12114
|
useCallback as useCallback18,
|
|
11777
|
-
useContext as
|
|
11778
|
-
useEffect as
|
|
11779
|
-
useLayoutEffect as
|
|
12115
|
+
useContext as useContext25,
|
|
12116
|
+
useEffect as useEffect17,
|
|
12117
|
+
useLayoutEffect as useLayoutEffect10,
|
|
11780
12118
|
useMemo as useMemo18,
|
|
11781
12119
|
useRef as useRef18,
|
|
11782
|
-
useState as
|
|
12120
|
+
useState as useState24
|
|
11783
12121
|
} from "react";
|
|
11784
12122
|
|
|
11785
12123
|
// src/components/Carousel/style.ts
|
|
@@ -11804,19 +12142,19 @@ var carouselStyles = {
|
|
|
11804
12142
|
),
|
|
11805
12143
|
indicatorThumb: clsx88(
|
|
11806
12144
|
"pointer-events-none absolute top-refineui-size-xxx-small bottom-refineui-size-xxx-small start-refineui-size-xxx-small z-0",
|
|
11807
|
-
|
|
11808
|
-
"
|
|
12145
|
+
/* Motion lives in refineui.css, gated by `data-animate`. */
|
|
12146
|
+
"rounded-refineui-circle bg-refineui-alias-background-brand shadow-refineui-2"
|
|
11809
12147
|
),
|
|
11810
12148
|
indicatorHitRow: "relative z-[1] flex h-full w-full",
|
|
11811
12149
|
indicatorHit: "h-full min-w-0 flex-1 cursor-pointer border-none bg-transparent p-0 outline-none"
|
|
11812
12150
|
};
|
|
11813
12151
|
|
|
11814
12152
|
// src/components/Carousel/Carousel.tsx
|
|
11815
|
-
import { jsx as
|
|
12153
|
+
import { jsx as jsx68, jsxs as jsxs26 } from "react/jsx-runtime";
|
|
11816
12154
|
var DRAG_COMMIT_RATIO = 0.18;
|
|
11817
|
-
var CarouselContext =
|
|
12155
|
+
var CarouselContext = createContext23(null);
|
|
11818
12156
|
function useCarouselContext(component) {
|
|
11819
|
-
const v =
|
|
12157
|
+
const v = useContext25(CarouselContext);
|
|
11820
12158
|
if (!v) throw new Error(`${component} must be used within Carousel.`);
|
|
11821
12159
|
return v;
|
|
11822
12160
|
}
|
|
@@ -11835,10 +12173,10 @@ function Carousel({
|
|
|
11835
12173
|
...props
|
|
11836
12174
|
}) {
|
|
11837
12175
|
const isControlled = indexControlled !== void 0;
|
|
11838
|
-
const [internalIndex, setInternalIndex] =
|
|
11839
|
-
const [count, setCount] =
|
|
11840
|
-
const [trackIndex, setTrackIndex] =
|
|
11841
|
-
const [instant, setInstant] =
|
|
12176
|
+
const [internalIndex, setInternalIndex] = useState24(defaultIndex);
|
|
12177
|
+
const [count, setCount] = useState24(0);
|
|
12178
|
+
const [trackIndex, setTrackIndex] = useState24(defaultIndex);
|
|
12179
|
+
const [instant, setInstant] = useState24(false);
|
|
11842
12180
|
const index = isControlled ? indexControlled : internalIndex;
|
|
11843
12181
|
const loopActive = loop && count > 1;
|
|
11844
12182
|
const commitLogical = useCallback18(
|
|
@@ -11849,13 +12187,20 @@ function Carousel({
|
|
|
11849
12187
|
},
|
|
11850
12188
|
[count, isControlled, onIndexChange]
|
|
11851
12189
|
);
|
|
11852
|
-
|
|
12190
|
+
const snapTrackTo = useCallback18((next) => {
|
|
12191
|
+
setInstant(true);
|
|
12192
|
+
setTrackIndex(next);
|
|
12193
|
+
requestAnimationFrame(() => {
|
|
12194
|
+
requestAnimationFrame(() => setInstant(false));
|
|
12195
|
+
});
|
|
12196
|
+
}, []);
|
|
12197
|
+
useLayoutEffect10(() => {
|
|
11853
12198
|
if (count <= 0) return;
|
|
11854
12199
|
const logical = clampIndex(index, count);
|
|
11855
12200
|
if (logical !== index) commitLogical(logical);
|
|
11856
|
-
|
|
12201
|
+
snapTrackTo(loopActive ? logical + 1 : logical);
|
|
11857
12202
|
}, [count, loopActive]);
|
|
11858
|
-
|
|
12203
|
+
useEffect17(() => {
|
|
11859
12204
|
if (count <= 0) return;
|
|
11860
12205
|
if (!loopActive) {
|
|
11861
12206
|
setTrackIndex(clampIndex(index, count));
|
|
@@ -11906,20 +12251,9 @@ function Carousel({
|
|
|
11906
12251
|
}, [commitLogical, count, index, loopActive, trackIndex]);
|
|
11907
12252
|
const onTrackSettled = useCallback18(() => {
|
|
11908
12253
|
if (!loopActive) return;
|
|
11909
|
-
if (trackIndex === 0)
|
|
11910
|
-
|
|
11911
|
-
|
|
11912
|
-
requestAnimationFrame(() => {
|
|
11913
|
-
requestAnimationFrame(() => setInstant(false));
|
|
11914
|
-
});
|
|
11915
|
-
} else if (trackIndex === count + 1) {
|
|
11916
|
-
setInstant(true);
|
|
11917
|
-
setTrackIndex(1);
|
|
11918
|
-
requestAnimationFrame(() => {
|
|
11919
|
-
requestAnimationFrame(() => setInstant(false));
|
|
11920
|
-
});
|
|
11921
|
-
}
|
|
11922
|
-
}, [count, loopActive, trackIndex]);
|
|
12254
|
+
if (trackIndex === 0) snapTrackTo(count);
|
|
12255
|
+
else if (trackIndex === count + 1) snapTrackTo(1);
|
|
12256
|
+
}, [count, loopActive, snapTrackTo, trackIndex]);
|
|
11923
12257
|
const ctx = useMemo18(
|
|
11924
12258
|
() => ({
|
|
11925
12259
|
index,
|
|
@@ -11975,7 +12309,7 @@ function Carousel({
|
|
|
11975
12309
|
break;
|
|
11976
12310
|
}
|
|
11977
12311
|
};
|
|
11978
|
-
return /* @__PURE__ */
|
|
12312
|
+
return /* @__PURE__ */ jsx68(CarouselContext.Provider, { value: ctx, children: /* @__PURE__ */ jsx68(
|
|
11979
12313
|
"div",
|
|
11980
12314
|
{
|
|
11981
12315
|
"data-refineui": "carousel",
|
|
@@ -12001,11 +12335,11 @@ function CarouselContent({ className, children, ...props }) {
|
|
|
12001
12335
|
} = useCarouselContext("CarouselContent");
|
|
12002
12336
|
const viewportRef = useRef18(null);
|
|
12003
12337
|
const dragStartX = useRef18(null);
|
|
12004
|
-
const [dragPx, setDragPx] =
|
|
12005
|
-
const [dragging, setDragging] =
|
|
12338
|
+
const [dragPx, setDragPx] = useState24(0);
|
|
12339
|
+
const [dragging, setDragging] = useState24(false);
|
|
12006
12340
|
const slides = Children6.toArray(children).filter(isValidElement5);
|
|
12007
12341
|
const slideCount = slides.length;
|
|
12008
|
-
|
|
12342
|
+
useEffect17(() => {
|
|
12009
12343
|
setCount(slideCount);
|
|
12010
12344
|
}, [setCount, slideCount]);
|
|
12011
12345
|
const trackSlides = loop && slides.length > 1 ? [
|
|
@@ -12062,7 +12396,7 @@ function CarouselContent({ className, children, ...props }) {
|
|
|
12062
12396
|
};
|
|
12063
12397
|
const animated = !dragging && !instant;
|
|
12064
12398
|
const transform = dragPx !== 0 ? `translate3d(calc(-${trackIndex * 100}% + ${dragPx}px), 0, 0)` : `translate3d(-${trackIndex * 100}%, 0, 0)`;
|
|
12065
|
-
return /* @__PURE__ */
|
|
12399
|
+
return /* @__PURE__ */ jsx68(
|
|
12066
12400
|
"div",
|
|
12067
12401
|
{
|
|
12068
12402
|
ref: viewportRef,
|
|
@@ -12073,7 +12407,7 @@ function CarouselContent({ className, children, ...props }) {
|
|
|
12073
12407
|
onPointerMove,
|
|
12074
12408
|
onPointerUp,
|
|
12075
12409
|
onPointerCancel,
|
|
12076
|
-
children: /* @__PURE__ */
|
|
12410
|
+
children: /* @__PURE__ */ jsx68(
|
|
12077
12411
|
"div",
|
|
12078
12412
|
{
|
|
12079
12413
|
"data-refineui": "carousel-track",
|
|
@@ -12090,7 +12424,7 @@ function CarouselContent({ className, children, ...props }) {
|
|
|
12090
12424
|
}
|
|
12091
12425
|
var CarouselItem = forwardRef15(function CarouselItem2({ className, children, ...props }, ref) {
|
|
12092
12426
|
useCarouselContext("CarouselItem");
|
|
12093
|
-
return /* @__PURE__ */
|
|
12427
|
+
return /* @__PURE__ */ jsx68(
|
|
12094
12428
|
"div",
|
|
12095
12429
|
{
|
|
12096
12430
|
ref,
|
|
@@ -12105,12 +12439,12 @@ var CarouselItem = forwardRef15(function CarouselItem2({ className, children, ..
|
|
|
12105
12439
|
});
|
|
12106
12440
|
function CarouselControls({ className, children, ...props }) {
|
|
12107
12441
|
useCarouselContext("CarouselControls");
|
|
12108
|
-
return /* @__PURE__ */
|
|
12442
|
+
return /* @__PURE__ */ jsx68("div", { "data-refineui": "carousel-controls", className: clsx89(carouselStyles.controls, className), ...props, children });
|
|
12109
12443
|
}
|
|
12110
12444
|
function CarouselPrevious({ className, disabled, onClick, ...props }) {
|
|
12111
12445
|
const { scrollPrev, canScrollPrev } = useCarouselContext("CarouselPrevious");
|
|
12112
12446
|
const isDisabled = disabled || !canScrollPrev;
|
|
12113
|
-
return /* @__PURE__ */
|
|
12447
|
+
return /* @__PURE__ */ jsx68(
|
|
12114
12448
|
Button,
|
|
12115
12449
|
{
|
|
12116
12450
|
variant: "outline",
|
|
@@ -12126,7 +12460,7 @@ function CarouselPrevious({ className, disabled, onClick, ...props }) {
|
|
|
12126
12460
|
onClick?.(e);
|
|
12127
12461
|
if (!e.defaultPrevented && !isDisabled) scrollPrev();
|
|
12128
12462
|
},
|
|
12129
|
-
children: /* @__PURE__ */
|
|
12463
|
+
children: /* @__PURE__ */ jsx68(
|
|
12130
12464
|
WebIcon,
|
|
12131
12465
|
{
|
|
12132
12466
|
name: "chevron-left",
|
|
@@ -12142,7 +12476,7 @@ function CarouselPrevious({ className, disabled, onClick, ...props }) {
|
|
|
12142
12476
|
function CarouselNext({ className, disabled, onClick, ...props }) {
|
|
12143
12477
|
const { scrollNext, canScrollNext } = useCarouselContext("CarouselNext");
|
|
12144
12478
|
const isDisabled = disabled || !canScrollNext;
|
|
12145
|
-
return /* @__PURE__ */
|
|
12479
|
+
return /* @__PURE__ */ jsx68(
|
|
12146
12480
|
Button,
|
|
12147
12481
|
{
|
|
12148
12482
|
variant: "outline",
|
|
@@ -12158,7 +12492,7 @@ function CarouselNext({ className, disabled, onClick, ...props }) {
|
|
|
12158
12492
|
onClick?.(e);
|
|
12159
12493
|
if (!e.defaultPrevented && !isDisabled) scrollNext();
|
|
12160
12494
|
},
|
|
12161
|
-
children: /* @__PURE__ */
|
|
12495
|
+
children: /* @__PURE__ */ jsx68(
|
|
12162
12496
|
WebIcon,
|
|
12163
12497
|
{
|
|
12164
12498
|
name: "chevron-right",
|
|
@@ -12174,7 +12508,8 @@ function CarouselNext({ className, disabled, onClick, ...props }) {
|
|
|
12174
12508
|
function CarouselIndicators({ className, ...props }) {
|
|
12175
12509
|
const { count, index, scrollTo } = useCarouselContext("CarouselIndicators");
|
|
12176
12510
|
const trackRef = useRef18(null);
|
|
12177
|
-
const [thumb, setThumb] =
|
|
12511
|
+
const [thumb, setThumb] = useState24({ width: 0, x: 0, ready: false });
|
|
12512
|
+
const [animate, setAnimate] = useState24(false);
|
|
12178
12513
|
const updateThumb = useCallback18(() => {
|
|
12179
12514
|
const el = trackRef.current;
|
|
12180
12515
|
if (!el || count <= 0) {
|
|
@@ -12190,10 +12525,25 @@ function CarouselIndicators({ className, ...props }) {
|
|
|
12190
12525
|
ready: true
|
|
12191
12526
|
});
|
|
12192
12527
|
}, [count, index]);
|
|
12193
|
-
|
|
12528
|
+
useLayoutEffect10(() => {
|
|
12194
12529
|
updateThumb();
|
|
12195
12530
|
}, [updateThumb]);
|
|
12196
|
-
|
|
12531
|
+
useEffect17(() => {
|
|
12532
|
+
if (!thumb.ready) {
|
|
12533
|
+
setAnimate(false);
|
|
12534
|
+
return;
|
|
12535
|
+
}
|
|
12536
|
+
if (animate) return;
|
|
12537
|
+
let raf2 = 0;
|
|
12538
|
+
const raf1 = requestAnimationFrame(() => {
|
|
12539
|
+
raf2 = requestAnimationFrame(() => setAnimate(true));
|
|
12540
|
+
});
|
|
12541
|
+
return () => {
|
|
12542
|
+
cancelAnimationFrame(raf1);
|
|
12543
|
+
cancelAnimationFrame(raf2);
|
|
12544
|
+
};
|
|
12545
|
+
}, [thumb.ready, animate]);
|
|
12546
|
+
useEffect17(() => {
|
|
12197
12547
|
const el = trackRef.current;
|
|
12198
12548
|
if (!el) return;
|
|
12199
12549
|
const ro = new ResizeObserver(() => updateThumb());
|
|
@@ -12205,7 +12555,7 @@ function CarouselIndicators({ className, ...props }) {
|
|
|
12205
12555
|
width: thumb.width,
|
|
12206
12556
|
transform: `translate3d(${thumb.x}px, 0, 0)`
|
|
12207
12557
|
};
|
|
12208
|
-
return /* @__PURE__ */
|
|
12558
|
+
return /* @__PURE__ */ jsxs26(
|
|
12209
12559
|
"div",
|
|
12210
12560
|
{
|
|
12211
12561
|
ref: trackRef,
|
|
@@ -12215,17 +12565,18 @@ function CarouselIndicators({ className, ...props }) {
|
|
|
12215
12565
|
className: clsx89(carouselStyles.indicators, className),
|
|
12216
12566
|
...props,
|
|
12217
12567
|
children: [
|
|
12218
|
-
/* @__PURE__ */
|
|
12568
|
+
/* @__PURE__ */ jsx68(
|
|
12219
12569
|
"span",
|
|
12220
12570
|
{
|
|
12221
12571
|
"data-refineui": "carousel-indicator-thumb",
|
|
12222
12572
|
"data-ready": thumb.ready ? "true" : void 0,
|
|
12573
|
+
"data-animate": animate ? "true" : void 0,
|
|
12223
12574
|
"aria-hidden": true,
|
|
12224
12575
|
className: carouselStyles.indicatorThumb,
|
|
12225
12576
|
style: thumbStyle
|
|
12226
12577
|
}
|
|
12227
12578
|
),
|
|
12228
|
-
/* @__PURE__ */
|
|
12579
|
+
/* @__PURE__ */ jsx68("div", { "data-refineui": "carousel-indicator-hits", className: carouselStyles.indicatorHitRow, children: Array.from({ length: count }, (_, i) => /* @__PURE__ */ jsx68(
|
|
12229
12580
|
"button",
|
|
12230
12581
|
{
|
|
12231
12582
|
type: "button",
|
|
@@ -12248,9 +12599,9 @@ function CarouselIndicators({ className, ...props }) {
|
|
|
12248
12599
|
import { clsx as clsx91 } from "clsx";
|
|
12249
12600
|
import {
|
|
12250
12601
|
Children as Children7,
|
|
12251
|
-
createContext as
|
|
12602
|
+
createContext as createContext24,
|
|
12252
12603
|
isValidElement as isValidElement6,
|
|
12253
|
-
useContext as
|
|
12604
|
+
useContext as useContext26
|
|
12254
12605
|
} from "react";
|
|
12255
12606
|
|
|
12256
12607
|
// src/components/Bubble/style.ts
|
|
@@ -12316,10 +12667,10 @@ var bubbleContentVariantClass = {
|
|
|
12316
12667
|
};
|
|
12317
12668
|
|
|
12318
12669
|
// src/components/Bubble/Bubble.tsx
|
|
12319
|
-
import { jsx as
|
|
12320
|
-
var BubbleContext =
|
|
12670
|
+
import { jsx as jsx69, jsxs as jsxs27 } from "react/jsx-runtime";
|
|
12671
|
+
var BubbleContext = createContext24(null);
|
|
12321
12672
|
function useBubbleContext(component) {
|
|
12322
|
-
const value =
|
|
12673
|
+
const value = useContext26(BubbleContext);
|
|
12323
12674
|
if (!value) throw new Error(`${component} must be used within Bubble.`);
|
|
12324
12675
|
return value;
|
|
12325
12676
|
}
|
|
@@ -12348,7 +12699,7 @@ function partitionBubbleChildren(children) {
|
|
|
12348
12699
|
};
|
|
12349
12700
|
}
|
|
12350
12701
|
function BubbleGroup({ className, ...props }) {
|
|
12351
|
-
return /* @__PURE__ */
|
|
12702
|
+
return /* @__PURE__ */ jsx69(
|
|
12352
12703
|
"div",
|
|
12353
12704
|
{
|
|
12354
12705
|
"data-refineui": "bubble-group",
|
|
@@ -12367,7 +12718,7 @@ function Bubble({
|
|
|
12367
12718
|
}) {
|
|
12368
12719
|
const rootStyle = variant === "ghost" ? style : { maxWidth: BUBBLE_MAX_WIDTH, ...style };
|
|
12369
12720
|
const { top, middle, bottom, hasTop, hasBottom } = partitionBubbleChildren(children);
|
|
12370
|
-
return /* @__PURE__ */
|
|
12721
|
+
return /* @__PURE__ */ jsx69(BubbleContext.Provider, { value: { variant, align }, children: /* @__PURE__ */ jsx69(
|
|
12371
12722
|
"div",
|
|
12372
12723
|
{
|
|
12373
12724
|
"data-refineui": "bubble",
|
|
@@ -12382,7 +12733,7 @@ function Bubble({
|
|
|
12382
12733
|
),
|
|
12383
12734
|
style: rootStyle,
|
|
12384
12735
|
...props,
|
|
12385
|
-
children: /* @__PURE__ */
|
|
12736
|
+
children: /* @__PURE__ */ jsxs27("div", { "data-refineui": "bubble-surface", className: bubbleStyles.surface, children: [
|
|
12386
12737
|
middle,
|
|
12387
12738
|
top,
|
|
12388
12739
|
bottom
|
|
@@ -12392,7 +12743,7 @@ function Bubble({
|
|
|
12392
12743
|
}
|
|
12393
12744
|
function BubbleContent({ className, ...props }) {
|
|
12394
12745
|
const { variant } = useBubbleContext("BubbleContent");
|
|
12395
|
-
return /* @__PURE__ */
|
|
12746
|
+
return /* @__PURE__ */ jsx69(
|
|
12396
12747
|
"div",
|
|
12397
12748
|
{
|
|
12398
12749
|
"data-refineui": "bubble-content",
|
|
@@ -12413,7 +12764,7 @@ function BubbleReactions({
|
|
|
12413
12764
|
}) {
|
|
12414
12765
|
const { align: bubbleAlign } = useBubbleContext("BubbleReactions");
|
|
12415
12766
|
const align = alignProp ?? (bubbleAlign === "start" ? "end" : "start");
|
|
12416
|
-
return /* @__PURE__ */
|
|
12767
|
+
return /* @__PURE__ */ jsx69(
|
|
12417
12768
|
"div",
|
|
12418
12769
|
{
|
|
12419
12770
|
"data-refineui": "bubble-reactions",
|
|
@@ -12434,12 +12785,12 @@ function BubbleReactions({
|
|
|
12434
12785
|
import { clsx as clsx93 } from "clsx";
|
|
12435
12786
|
import { iconSizes as iconSizes19 } from "@refineui/tokens";
|
|
12436
12787
|
import {
|
|
12437
|
-
createContext as
|
|
12788
|
+
createContext as createContext25,
|
|
12438
12789
|
useCallback as useCallback19,
|
|
12439
|
-
useContext as
|
|
12790
|
+
useContext as useContext27,
|
|
12440
12791
|
useMemo as useMemo19,
|
|
12441
12792
|
useRef as useRef19,
|
|
12442
|
-
useState as
|
|
12793
|
+
useState as useState25
|
|
12443
12794
|
} from "react";
|
|
12444
12795
|
|
|
12445
12796
|
// src/components/Stepper/style.ts
|
|
@@ -12548,17 +12899,17 @@ var stepperConnectorVars = {
|
|
|
12548
12899
|
};
|
|
12549
12900
|
|
|
12550
12901
|
// src/components/Stepper/Stepper.tsx
|
|
12551
|
-
import { jsx as
|
|
12552
|
-
var StepperContext =
|
|
12553
|
-
var StepperItemContext =
|
|
12554
|
-
var StepperListRegistryContext =
|
|
12902
|
+
import { jsx as jsx70, jsxs as jsxs28 } from "react/jsx-runtime";
|
|
12903
|
+
var StepperContext = createContext25(null);
|
|
12904
|
+
var StepperItemContext = createContext25(null);
|
|
12905
|
+
var StepperListRegistryContext = createContext25(null);
|
|
12555
12906
|
function useStepperContext(component) {
|
|
12556
|
-
const v =
|
|
12907
|
+
const v = useContext27(StepperContext);
|
|
12557
12908
|
if (!v) throw new Error(`${component} must be used within Stepper.`);
|
|
12558
12909
|
return v;
|
|
12559
12910
|
}
|
|
12560
12911
|
function useStepperItemContext(component) {
|
|
12561
|
-
const v =
|
|
12912
|
+
const v = useContext27(StepperItemContext);
|
|
12562
12913
|
if (!v) throw new Error(`${component} must be used within StepperItem.`);
|
|
12563
12914
|
return v;
|
|
12564
12915
|
}
|
|
@@ -12578,7 +12929,7 @@ function Stepper({
|
|
|
12578
12929
|
...props
|
|
12579
12930
|
}) {
|
|
12580
12931
|
const isControlled = valueControlled !== void 0;
|
|
12581
|
-
const [internalValue, setInternalValue] =
|
|
12932
|
+
const [internalValue, setInternalValue] = useState25(defaultValue);
|
|
12582
12933
|
const value = isControlled ? valueControlled : internalValue;
|
|
12583
12934
|
const setValue = useCallback19(
|
|
12584
12935
|
(next) => {
|
|
@@ -12596,7 +12947,7 @@ function Stepper({
|
|
|
12596
12947
|
}),
|
|
12597
12948
|
[value, setValue, orientation, onValueChange, isControlled]
|
|
12598
12949
|
);
|
|
12599
|
-
return /* @__PURE__ */
|
|
12950
|
+
return /* @__PURE__ */ jsx70(StepperContext.Provider, { value: ctx, children: /* @__PURE__ */ jsx70(
|
|
12600
12951
|
"div",
|
|
12601
12952
|
{
|
|
12602
12953
|
"data-refineui": "stepper",
|
|
@@ -12624,7 +12975,7 @@ function StepperList({ className, children, ...props }) {
|
|
|
12624
12975
|
}),
|
|
12625
12976
|
[value]
|
|
12626
12977
|
);
|
|
12627
|
-
return /* @__PURE__ */
|
|
12978
|
+
return /* @__PURE__ */ jsx70(StepperListRegistryContext.Provider, { value: registry, children: /* @__PURE__ */ jsx70(
|
|
12628
12979
|
"ol",
|
|
12629
12980
|
{
|
|
12630
12981
|
"data-refineui": "stepper-list",
|
|
@@ -12649,7 +13000,7 @@ function StepperItem({
|
|
|
12649
13000
|
...props
|
|
12650
13001
|
}) {
|
|
12651
13002
|
const { value, setValue, orientation, interactive } = useStepperContext("StepperItem");
|
|
12652
|
-
const registry =
|
|
13003
|
+
const registry = useContext27(StepperListRegistryContext);
|
|
12653
13004
|
registry?.noteItem(itemValue);
|
|
12654
13005
|
const state = resolveState2(itemValue, value);
|
|
12655
13006
|
const canActivate = interactive && !disabled;
|
|
@@ -12669,7 +13020,7 @@ function StepperItem({
|
|
|
12669
13020
|
() => ({ state, disabled }),
|
|
12670
13021
|
[state, disabled]
|
|
12671
13022
|
);
|
|
12672
|
-
return /* @__PURE__ */
|
|
13023
|
+
return /* @__PURE__ */ jsx70(StepperItemContext.Provider, { value: itemCtx, children: /* @__PURE__ */ jsx70(
|
|
12673
13024
|
"li",
|
|
12674
13025
|
{
|
|
12675
13026
|
"data-refineui": "stepper-item",
|
|
@@ -12697,7 +13048,7 @@ function StepperItem({
|
|
|
12697
13048
|
function StepperIndicator({ className, children, ...props }) {
|
|
12698
13049
|
const { state } = useStepperItemContext("StepperIndicator");
|
|
12699
13050
|
const stateClass = state === "complete" ? stepperStyles.indicatorComplete : state === "current" ? stepperStyles.indicatorCurrent : stepperStyles.indicatorUpcoming;
|
|
12700
|
-
const content = state === "upcoming" ? children : /* @__PURE__ */
|
|
13051
|
+
const content = state === "upcoming" ? children : /* @__PURE__ */ jsx70(
|
|
12701
13052
|
WebIcon,
|
|
12702
13053
|
{
|
|
12703
13054
|
name: "checkmark",
|
|
@@ -12708,7 +13059,7 @@ function StepperIndicator({ className, children, ...props }) {
|
|
|
12708
13059
|
className: "items-center justify-center"
|
|
12709
13060
|
}
|
|
12710
13061
|
);
|
|
12711
|
-
return /* @__PURE__ */
|
|
13062
|
+
return /* @__PURE__ */ jsx70(
|
|
12712
13063
|
"span",
|
|
12713
13064
|
{
|
|
12714
13065
|
"data-refineui": "stepper-indicator",
|
|
@@ -12723,7 +13074,7 @@ function StepperIndicator({ className, children, ...props }) {
|
|
|
12723
13074
|
function StepperContent({ className, ...props }) {
|
|
12724
13075
|
const { orientation } = useStepperContext("StepperContent");
|
|
12725
13076
|
useStepperItemContext("StepperContent");
|
|
12726
|
-
return /* @__PURE__ */
|
|
13077
|
+
return /* @__PURE__ */ jsx70(
|
|
12727
13078
|
"div",
|
|
12728
13079
|
{
|
|
12729
13080
|
"data-refineui": "stepper-content",
|
|
@@ -12739,7 +13090,7 @@ function StepperContent({ className, ...props }) {
|
|
|
12739
13090
|
function StepperTitle({ className, ...props }) {
|
|
12740
13091
|
const { state } = useStepperItemContext("StepperTitle");
|
|
12741
13092
|
const stateClass = state === "complete" ? stepperStyles.titleComplete : state === "current" ? stepperStyles.titleCurrent : stepperStyles.titleUpcoming;
|
|
12742
|
-
return /* @__PURE__ */
|
|
13093
|
+
return /* @__PURE__ */ jsx70(
|
|
12743
13094
|
"span",
|
|
12744
13095
|
{
|
|
12745
13096
|
"data-refineui": "stepper-title",
|
|
@@ -12752,7 +13103,7 @@ function StepperTitle({ className, ...props }) {
|
|
|
12752
13103
|
function StepperDescription({ className, ...props }) {
|
|
12753
13104
|
const { state } = useStepperItemContext("StepperDescription");
|
|
12754
13105
|
const stateClass = state === "complete" ? stepperStyles.descriptionComplete : state === "current" ? stepperStyles.descriptionCurrent : stepperStyles.descriptionUpcoming;
|
|
12755
|
-
return /* @__PURE__ */
|
|
13106
|
+
return /* @__PURE__ */ jsx70(
|
|
12756
13107
|
"span",
|
|
12757
13108
|
{
|
|
12758
13109
|
"data-refineui": "stepper-description",
|
|
@@ -12764,10 +13115,10 @@ function StepperDescription({ className, ...props }) {
|
|
|
12764
13115
|
}
|
|
12765
13116
|
function StepperSeparator({ className, ...props }) {
|
|
12766
13117
|
const { orientation } = useStepperContext("StepperSeparator");
|
|
12767
|
-
const registry =
|
|
13118
|
+
const registry = useContext27(StepperListRegistryContext);
|
|
12768
13119
|
const state = registry?.takeSeparatorState() ?? "upcoming";
|
|
12769
13120
|
const vertical = orientation === "vertical";
|
|
12770
|
-
return /* @__PURE__ */
|
|
13121
|
+
return /* @__PURE__ */ jsx70(
|
|
12771
13122
|
"li",
|
|
12772
13123
|
{
|
|
12773
13124
|
"data-refineui": "stepper-separator",
|
|
@@ -12781,7 +13132,7 @@ function StepperSeparator({ className, ...props }) {
|
|
|
12781
13132
|
className
|
|
12782
13133
|
),
|
|
12783
13134
|
...props,
|
|
12784
|
-
children: /* @__PURE__ */
|
|
13135
|
+
children: /* @__PURE__ */ jsxs28(
|
|
12785
13136
|
"span",
|
|
12786
13137
|
{
|
|
12787
13138
|
"data-refineui": "stepper-separator-rail",
|
|
@@ -12790,14 +13141,14 @@ function StepperSeparator({ className, ...props }) {
|
|
|
12790
13141
|
vertical ? stepperStyles.separatorRailVertical : stepperStyles.separatorRailHorizontal
|
|
12791
13142
|
),
|
|
12792
13143
|
children: [
|
|
12793
|
-
/* @__PURE__ */
|
|
13144
|
+
/* @__PURE__ */ jsx70(
|
|
12794
13145
|
"span",
|
|
12795
13146
|
{
|
|
12796
13147
|
"data-refineui": "stepper-separator-track",
|
|
12797
13148
|
className: stepperStyles.separatorTrack
|
|
12798
13149
|
}
|
|
12799
13150
|
),
|
|
12800
|
-
/* @__PURE__ */
|
|
13151
|
+
/* @__PURE__ */ jsx70(
|
|
12801
13152
|
"span",
|
|
12802
13153
|
{
|
|
12803
13154
|
"data-refineui": "stepper-separator-fill",
|
|
@@ -12826,14 +13177,14 @@ StepperSeparator.displayName = "StepperSeparator";
|
|
|
12826
13177
|
// src/components/Resizable/Resizable.tsx
|
|
12827
13178
|
import { clsx as clsx95 } from "clsx";
|
|
12828
13179
|
import {
|
|
12829
|
-
createContext as
|
|
13180
|
+
createContext as createContext26,
|
|
12830
13181
|
useCallback as useCallback20,
|
|
12831
|
-
useContext as
|
|
13182
|
+
useContext as useContext28,
|
|
12832
13183
|
useId as useId15,
|
|
12833
|
-
useLayoutEffect as
|
|
13184
|
+
useLayoutEffect as useLayoutEffect11,
|
|
12834
13185
|
useMemo as useMemo20,
|
|
12835
13186
|
useRef as useRef20,
|
|
12836
|
-
useState as
|
|
13187
|
+
useState as useState26
|
|
12837
13188
|
} from "react";
|
|
12838
13189
|
|
|
12839
13190
|
// src/components/Resizable/style.ts
|
|
@@ -12869,15 +13220,15 @@ var resizableStyles = {
|
|
|
12869
13220
|
};
|
|
12870
13221
|
|
|
12871
13222
|
// src/components/Resizable/Resizable.tsx
|
|
12872
|
-
import { jsx as
|
|
13223
|
+
import { jsx as jsx71 } from "react/jsx-runtime";
|
|
12873
13224
|
var KEYBOARD_STEP = 2;
|
|
12874
13225
|
var KEYBOARD_STEP_LARGE = 10;
|
|
12875
13226
|
var DEFAULT_SIZE = 50;
|
|
12876
13227
|
var DEFAULT_MIN_SIZE = 10;
|
|
12877
13228
|
var DEFAULT_MAX_SIZE = 100;
|
|
12878
|
-
var ResizableContext =
|
|
13229
|
+
var ResizableContext = createContext26(null);
|
|
12879
13230
|
function useResizableContext(component) {
|
|
12880
|
-
const v =
|
|
13231
|
+
const v = useContext28(ResizableContext);
|
|
12881
13232
|
if (!v) throw new Error(`${component} must be used within ResizablePanelGroup.`);
|
|
12882
13233
|
return v;
|
|
12883
13234
|
}
|
|
@@ -12939,7 +13290,7 @@ function ResizablePanelGroup({
|
|
|
12939
13290
|
const groupRef = useRef20(null);
|
|
12940
13291
|
const panelsRef = useRef20(/* @__PURE__ */ new Map());
|
|
12941
13292
|
const orderCounterRef = useRef20(0);
|
|
12942
|
-
const [sizes, setSizes] =
|
|
13293
|
+
const [sizes, setSizes] = useState26({});
|
|
12943
13294
|
const onLayoutRef = useRef20(onLayout);
|
|
12944
13295
|
onLayoutRef.current = onLayout;
|
|
12945
13296
|
const syncInitialSizes = useCallback20(() => {
|
|
@@ -13043,7 +13394,7 @@ function ResizablePanelGroup({
|
|
|
13043
13394
|
},
|
|
13044
13395
|
[emitPanelResize]
|
|
13045
13396
|
);
|
|
13046
|
-
|
|
13397
|
+
useLayoutEffect11(() => {
|
|
13047
13398
|
const ids = orderedPanelIds(panelsRef.current);
|
|
13048
13399
|
if (ids.length === 0) return;
|
|
13049
13400
|
if (ids.some((id) => sizes[id] === void 0)) return;
|
|
@@ -13070,7 +13421,7 @@ function ResizablePanelGroup({
|
|
|
13070
13421
|
setBetween
|
|
13071
13422
|
]
|
|
13072
13423
|
);
|
|
13073
|
-
return /* @__PURE__ */
|
|
13424
|
+
return /* @__PURE__ */ jsx71(ResizableContext.Provider, { value: ctx, children: /* @__PURE__ */ jsx71(
|
|
13074
13425
|
"div",
|
|
13075
13426
|
{
|
|
13076
13427
|
ref: groupRef,
|
|
@@ -13102,7 +13453,7 @@ function ResizablePanel({
|
|
|
13102
13453
|
const { orientation, sizes, registerPanel, unregisterPanel } = useResizableContext("ResizablePanel");
|
|
13103
13454
|
const onResizeRef = useRef20(onResize);
|
|
13104
13455
|
onResizeRef.current = onResize;
|
|
13105
|
-
|
|
13456
|
+
useLayoutEffect11(() => {
|
|
13106
13457
|
registerPanel({
|
|
13107
13458
|
id,
|
|
13108
13459
|
defaultSize,
|
|
@@ -13129,7 +13480,7 @@ function ResizablePanel({
|
|
|
13129
13480
|
flexBasis: 0,
|
|
13130
13481
|
...orientation === "horizontal" ? { minWidth: `${minSize}%` } : { minHeight: `${minSize}%` }
|
|
13131
13482
|
};
|
|
13132
|
-
return /* @__PURE__ */
|
|
13483
|
+
return /* @__PURE__ */ jsx71(
|
|
13133
13484
|
"div",
|
|
13134
13485
|
{
|
|
13135
13486
|
"data-refineui": "resizable-panel",
|
|
@@ -13161,10 +13512,10 @@ function ResizableHandle({
|
|
|
13161
13512
|
setBetween
|
|
13162
13513
|
} = useResizableContext("ResizableHandle");
|
|
13163
13514
|
const handleRef = useRef20(null);
|
|
13164
|
-
const [active, setActive] =
|
|
13165
|
-
const [, setAdjacentReady] =
|
|
13515
|
+
const [active, setActive] = useState26(false);
|
|
13516
|
+
const [, setAdjacentReady] = useState26(false);
|
|
13166
13517
|
const dragRef = useRef20(null);
|
|
13167
|
-
|
|
13518
|
+
useLayoutEffect11(() => {
|
|
13168
13519
|
setAdjacentReady(true);
|
|
13169
13520
|
}, []);
|
|
13170
13521
|
const adjacent = handleRef.current ? findAdjacentPanelIds(handleRef.current) : { leftId: null, rightId: null };
|
|
@@ -13274,7 +13625,7 @@ function ResizableHandle({
|
|
|
13274
13625
|
resizeBetween(leftId, rightId, delta);
|
|
13275
13626
|
queueMicrotask(keepFocus);
|
|
13276
13627
|
};
|
|
13277
|
-
return /* @__PURE__ */
|
|
13628
|
+
return /* @__PURE__ */ jsx71(
|
|
13278
13629
|
"div",
|
|
13279
13630
|
{
|
|
13280
13631
|
ref: handleRef,
|
|
@@ -13304,7 +13655,7 @@ function ResizableHandle({
|
|
|
13304
13655
|
onPointerUp: handlePointerUp,
|
|
13305
13656
|
onPointerCancel: handlePointerUp,
|
|
13306
13657
|
onKeyDown: handleKeyDown,
|
|
13307
|
-
children: withHandle ? /* @__PURE__ */
|
|
13658
|
+
children: withHandle ? /* @__PURE__ */ jsx71(
|
|
13308
13659
|
"span",
|
|
13309
13660
|
{
|
|
13310
13661
|
"aria-hidden": true,
|
|
@@ -13320,7 +13671,7 @@ function ResizableHandle({
|
|
|
13320
13671
|
|
|
13321
13672
|
// src/components/SpinButton/SpinButton.tsx
|
|
13322
13673
|
import { clsx as clsx96 } from "clsx";
|
|
13323
|
-
import { useEffect as
|
|
13674
|
+
import { useEffect as useEffect18, useState as useState27 } from "react";
|
|
13324
13675
|
import { iconSizes as iconSizes20 } from "@refineui/tokens";
|
|
13325
13676
|
|
|
13326
13677
|
// src/components/SpinButton/style.ts
|
|
@@ -13344,7 +13695,7 @@ var spinButtonShellClass = formControlShellHeightClass;
|
|
|
13344
13695
|
var spinButtonValueTypo = formControlTypoClass;
|
|
13345
13696
|
|
|
13346
13697
|
// src/components/SpinButton/SpinButton.tsx
|
|
13347
|
-
import { jsx as
|
|
13698
|
+
import { jsx as jsx72, jsxs as jsxs29 } from "react/jsx-runtime";
|
|
13348
13699
|
function SpinButton({
|
|
13349
13700
|
value,
|
|
13350
13701
|
onChange,
|
|
@@ -13358,8 +13709,8 @@ function SpinButton({
|
|
|
13358
13709
|
onKeyDown,
|
|
13359
13710
|
...props
|
|
13360
13711
|
}) {
|
|
13361
|
-
const [draftValue, setDraftValue] =
|
|
13362
|
-
|
|
13712
|
+
const [draftValue, setDraftValue] = useState27(String(value));
|
|
13713
|
+
useEffect18(() => {
|
|
13363
13714
|
setDraftValue(String(value));
|
|
13364
13715
|
}, [value]);
|
|
13365
13716
|
const clampValue2 = (next) => {
|
|
@@ -13447,7 +13798,7 @@ function SpinButton({
|
|
|
13447
13798
|
const atMax = max !== void 0 && value >= max;
|
|
13448
13799
|
const atMin = min !== void 0 && value <= min;
|
|
13449
13800
|
const borderClass = disabled ? spinButtonStyles.borderDisabled : spinButtonStyles.borderDefault;
|
|
13450
|
-
return /* @__PURE__ */
|
|
13801
|
+
return /* @__PURE__ */ jsxs29(
|
|
13451
13802
|
"div",
|
|
13452
13803
|
{
|
|
13453
13804
|
role: "spinbutton",
|
|
@@ -13470,7 +13821,7 @@ function SpinButton({
|
|
|
13470
13821
|
...props,
|
|
13471
13822
|
onKeyDown: handleKeyDown,
|
|
13472
13823
|
children: [
|
|
13473
|
-
/* @__PURE__ */
|
|
13824
|
+
/* @__PURE__ */ jsx72(
|
|
13474
13825
|
"div",
|
|
13475
13826
|
{
|
|
13476
13827
|
"aria-live": "polite",
|
|
@@ -13481,7 +13832,7 @@ function SpinButton({
|
|
|
13481
13832
|
disabled ? spinButtonStyles.valueTextDisabled : spinButtonStyles.valueTextDefault,
|
|
13482
13833
|
disabled ? spinButtonStyles.bgDisabled : spinButtonStyles.bgDefault
|
|
13483
13834
|
),
|
|
13484
|
-
children: /* @__PURE__ */
|
|
13835
|
+
children: /* @__PURE__ */ jsx72(
|
|
13485
13836
|
"input",
|
|
13486
13837
|
{
|
|
13487
13838
|
type: "text",
|
|
@@ -13506,7 +13857,7 @@ function SpinButton({
|
|
|
13506
13857
|
)
|
|
13507
13858
|
}
|
|
13508
13859
|
),
|
|
13509
|
-
/* @__PURE__ */
|
|
13860
|
+
/* @__PURE__ */ jsxs29(
|
|
13510
13861
|
"div",
|
|
13511
13862
|
{
|
|
13512
13863
|
className: clsx96(
|
|
@@ -13514,7 +13865,7 @@ function SpinButton({
|
|
|
13514
13865
|
disabled ? spinButtonStyles.bgDisabled : spinButtonStyles.bgDefault
|
|
13515
13866
|
),
|
|
13516
13867
|
children: [
|
|
13517
|
-
/* @__PURE__ */
|
|
13868
|
+
/* @__PURE__ */ jsx72(
|
|
13518
13869
|
"button",
|
|
13519
13870
|
{
|
|
13520
13871
|
type: "button",
|
|
@@ -13526,7 +13877,7 @@ function SpinButton({
|
|
|
13526
13877
|
spinButtonStyles.stepButtonBase,
|
|
13527
13878
|
disabled || atMax ? spinButtonStyles.stepButtonDisabled : spinButtonStyles.stepButtonEnabled
|
|
13528
13879
|
),
|
|
13529
|
-
children: /* @__PURE__ */
|
|
13880
|
+
children: /* @__PURE__ */ jsx72(
|
|
13530
13881
|
WebIcon,
|
|
13531
13882
|
{
|
|
13532
13883
|
name: "chevron-up",
|
|
@@ -13538,7 +13889,7 @@ function SpinButton({
|
|
|
13538
13889
|
)
|
|
13539
13890
|
}
|
|
13540
13891
|
),
|
|
13541
|
-
/* @__PURE__ */
|
|
13892
|
+
/* @__PURE__ */ jsx72(
|
|
13542
13893
|
"button",
|
|
13543
13894
|
{
|
|
13544
13895
|
type: "button",
|
|
@@ -13550,7 +13901,7 @@ function SpinButton({
|
|
|
13550
13901
|
spinButtonStyles.stepButtonBase,
|
|
13551
13902
|
disabled || atMin ? spinButtonStyles.stepButtonDisabled : spinButtonStyles.stepButtonEnabled
|
|
13552
13903
|
),
|
|
13553
|
-
children: /* @__PURE__ */
|
|
13904
|
+
children: /* @__PURE__ */ jsx72(
|
|
13554
13905
|
WebIcon,
|
|
13555
13906
|
{
|
|
13556
13907
|
name: "chevron-down",
|
|
@@ -13575,14 +13926,14 @@ import { clsx as clsx98 } from "clsx";
|
|
|
13575
13926
|
import {
|
|
13576
13927
|
forwardRef as forwardRef16,
|
|
13577
13928
|
useCallback as useCallback21,
|
|
13578
|
-
useEffect as
|
|
13579
|
-
useLayoutEffect as
|
|
13929
|
+
useEffect as useEffect19,
|
|
13930
|
+
useLayoutEffect as useLayoutEffect12,
|
|
13580
13931
|
useRef as useRef21,
|
|
13581
|
-
useState as
|
|
13932
|
+
useState as useState28,
|
|
13582
13933
|
useSyncExternalStore
|
|
13583
13934
|
} from "react";
|
|
13584
13935
|
import { createPortal as createPortal7 } from "react-dom";
|
|
13585
|
-
import { iconSizes as iconSizes21, spacings as
|
|
13936
|
+
import { iconSizes as iconSizes21, spacings as spacings7 } from "@refineui/tokens";
|
|
13586
13937
|
import { motionMsToNumber as motionMsToNumber6 } from "@refineui/utilities/animation";
|
|
13587
13938
|
import { resolveColorTokenValue as resolveColorTokenValue11 } from "@refineui/utilities/color";
|
|
13588
13939
|
|
|
@@ -13617,8 +13968,8 @@ var toastStyles = {
|
|
|
13617
13968
|
};
|
|
13618
13969
|
|
|
13619
13970
|
// src/components/Toast/Toast.tsx
|
|
13620
|
-
import { jsx as
|
|
13621
|
-
var
|
|
13971
|
+
import { jsx as jsx73, jsxs as jsxs30 } from "react/jsx-runtime";
|
|
13972
|
+
var useIsomorphicLayoutEffect7 = typeof document !== "undefined" ? useLayoutEffect12 : useEffect19;
|
|
13622
13973
|
var ENTER_MS = 20;
|
|
13623
13974
|
var LEAVE_MS = motionMsToNumber6(componentTokens.toast.motion.leave) + 60;
|
|
13624
13975
|
var DEFAULT_DURATION = 4200;
|
|
@@ -13641,10 +13992,10 @@ function gapPxFromSpacingToken(token) {
|
|
|
13641
13992
|
var TOAST_NARROW_STACK_MQ = "(max-width: 480px), (hover: none)";
|
|
13642
13993
|
function readToastStackGapPx() {
|
|
13643
13994
|
if (typeof globalThis.matchMedia === "undefined") {
|
|
13644
|
-
return gapPxFromSpacingToken(String(
|
|
13995
|
+
return gapPxFromSpacingToken(String(spacings7.sizeLarge));
|
|
13645
13996
|
}
|
|
13646
13997
|
const mq = globalThis.matchMedia(TOAST_NARROW_STACK_MQ);
|
|
13647
|
-
return gapPxFromSpacingToken(mq.matches ? String(
|
|
13998
|
+
return gapPxFromSpacingToken(mq.matches ? String(spacings7.sizeMedium) : String(spacings7.sizeLarge));
|
|
13648
13999
|
}
|
|
13649
14000
|
function subscribeToastStackGap(onChange) {
|
|
13650
14001
|
if (typeof globalThis.matchMedia === "undefined") return () => {
|
|
@@ -13657,7 +14008,7 @@ function useToastStackGapPx() {
|
|
|
13657
14008
|
return useSyncExternalStore(
|
|
13658
14009
|
subscribeToastStackGap,
|
|
13659
14010
|
readToastStackGapPx,
|
|
13660
|
-
() => gapPxFromSpacingToken(String(
|
|
14011
|
+
() => gapPxFromSpacingToken(String(spacings7.sizeLarge))
|
|
13661
14012
|
);
|
|
13662
14013
|
}
|
|
13663
14014
|
function readToastNaturalHeight(li) {
|
|
@@ -13805,7 +14156,7 @@ var Toast = forwardRef16(function Toast2(props, ref) {
|
|
|
13805
14156
|
const liveRole = variant === "error" ? "alert" : "status";
|
|
13806
14157
|
const ariaLive = variant === "error" ? void 0 : variant === "warning" ? "assertive" : "polite";
|
|
13807
14158
|
const resolvedIconName = iconName ?? variantIconNames[variant];
|
|
13808
|
-
const iconContent = icon ?? /* @__PURE__ */
|
|
14159
|
+
const iconContent = icon ?? /* @__PURE__ */ jsx73(
|
|
13809
14160
|
WebIcon,
|
|
13810
14161
|
{
|
|
13811
14162
|
name: resolvedIconName,
|
|
@@ -13815,7 +14166,7 @@ var Toast = forwardRef16(function Toast2(props, ref) {
|
|
|
13815
14166
|
}
|
|
13816
14167
|
);
|
|
13817
14168
|
const isPrimaryAction = !action || typeof action !== "object" || !("variant" in action) || action.variant === "primary";
|
|
13818
|
-
const actionEl = typeof action === "object" && action !== null && "label" in action ? /* @__PURE__ */
|
|
14169
|
+
const actionEl = typeof action === "object" && action !== null && "label" in action ? /* @__PURE__ */ jsx73(
|
|
13819
14170
|
Button,
|
|
13820
14171
|
{
|
|
13821
14172
|
variant: isPrimaryAction ? "primary" : "outline",
|
|
@@ -13831,7 +14182,7 @@ var Toast = forwardRef16(function Toast2(props, ref) {
|
|
|
13831
14182
|
borderColor: resolveColorTokenValue11(color.border),
|
|
13832
14183
|
color: resolveColorTokenValue11(color.message)
|
|
13833
14184
|
};
|
|
13834
|
-
return /* @__PURE__ */
|
|
14185
|
+
return /* @__PURE__ */ jsxs30(
|
|
13835
14186
|
"div",
|
|
13836
14187
|
{
|
|
13837
14188
|
ref,
|
|
@@ -13844,8 +14195,8 @@ var Toast = forwardRef16(function Toast2(props, ref) {
|
|
|
13844
14195
|
style: { ...tokenStyle, ...style },
|
|
13845
14196
|
className: clsx98(toastStyles.card, className),
|
|
13846
14197
|
children: [
|
|
13847
|
-
/* @__PURE__ */
|
|
13848
|
-
/* @__PURE__ */
|
|
14198
|
+
/* @__PURE__ */ jsx73("div", { "data-refineui": "toast-icon", className: toastStyles.iconWrap, children: iconContent }),
|
|
14199
|
+
/* @__PURE__ */ jsx73("div", { className: toastStyles.contentWrap, children: message != null && message !== "" ? /* @__PURE__ */ jsx73("div", { className: toastStyles.message, children: message }) : null }),
|
|
13849
14200
|
action != null && actionEl
|
|
13850
14201
|
]
|
|
13851
14202
|
}
|
|
@@ -13856,7 +14207,7 @@ function SwipeableToast({ record, index, swipeDirections, onSwipeStart, onSwipeE
|
|
|
13856
14207
|
const dragStartRef = useRef21(null);
|
|
13857
14208
|
const axisRef = useRef21(null);
|
|
13858
14209
|
const offsetRef = useRef21({ x: 0, y: 0 });
|
|
13859
|
-
const [swiping, setSwiping] =
|
|
14210
|
+
const [swiping, setSwiping] = useState28(false);
|
|
13860
14211
|
const clearSwipeOffset = useCallback21(() => {
|
|
13861
14212
|
const el = toastRef.current;
|
|
13862
14213
|
offsetRef.current = { x: 0, y: 0 };
|
|
@@ -13932,7 +14283,7 @@ function SwipeableToast({ record, index, swipeDirections, onSwipeStart, onSwipeE
|
|
|
13932
14283
|
clearSwipeOffset();
|
|
13933
14284
|
onSwipeEnd();
|
|
13934
14285
|
};
|
|
13935
|
-
return /* @__PURE__ */
|
|
14286
|
+
return /* @__PURE__ */ jsx73(
|
|
13936
14287
|
Toast,
|
|
13937
14288
|
{
|
|
13938
14289
|
ref: toastRef,
|
|
@@ -13967,15 +14318,15 @@ function Toaster({
|
|
|
13967
14318
|
() => activeToasterKey === toasterKeyRef.current,
|
|
13968
14319
|
() => false
|
|
13969
14320
|
);
|
|
13970
|
-
const [records, setRecords] =
|
|
14321
|
+
const [records, setRecords] = useState28([]);
|
|
13971
14322
|
const timerMapRef = useRef21({});
|
|
13972
14323
|
const pausedRef = useRef21(/* @__PURE__ */ new Set());
|
|
13973
14324
|
const rootRef = useRef21(null);
|
|
13974
14325
|
const itemRefs = useRef21({});
|
|
13975
|
-
const [layoutTick, setLayoutTick] =
|
|
14326
|
+
const [layoutTick, setLayoutTick] = useState28(0);
|
|
13976
14327
|
const stackGapPx = useToastStackGapPx();
|
|
13977
14328
|
const resolvedSwipe = swipeDirections ?? DEFAULT_SWIPE_DIRECTIONS;
|
|
13978
|
-
|
|
14329
|
+
useIsomorphicLayoutEffect7(() => {
|
|
13979
14330
|
const key = toasterKeyRef.current;
|
|
13980
14331
|
activeToasterKey = key;
|
|
13981
14332
|
notifyToasterOwners();
|
|
@@ -13986,13 +14337,13 @@ function Toaster({
|
|
|
13986
14337
|
}
|
|
13987
14338
|
};
|
|
13988
14339
|
}, []);
|
|
13989
|
-
|
|
14340
|
+
useEffect19(() => {
|
|
13990
14341
|
if (!isPortalOwner) return;
|
|
13991
14342
|
return subscribeToasts((next) => {
|
|
13992
14343
|
setRecords(next.slice(0, Math.max(1, maxToasts)));
|
|
13993
14344
|
});
|
|
13994
14345
|
}, [isPortalOwner, maxToasts]);
|
|
13995
|
-
|
|
14346
|
+
useEffect19(() => {
|
|
13996
14347
|
if (!isPortalOwner) return;
|
|
13997
14348
|
for (const rec of records) {
|
|
13998
14349
|
if (rec.phase === "leaving") continue;
|
|
@@ -14014,7 +14365,7 @@ function Toaster({
|
|
|
14014
14365
|
}
|
|
14015
14366
|
}
|
|
14016
14367
|
}, [isPortalOwner, records]);
|
|
14017
|
-
|
|
14368
|
+
useEffect19(() => {
|
|
14018
14369
|
return () => {
|
|
14019
14370
|
for (const handle of Object.values(timerMapRef.current)) {
|
|
14020
14371
|
clearTimeout(handle);
|
|
@@ -14022,7 +14373,7 @@ function Toaster({
|
|
|
14022
14373
|
timerMapRef.current = {};
|
|
14023
14374
|
};
|
|
14024
14375
|
}, []);
|
|
14025
|
-
|
|
14376
|
+
useIsomorphicLayoutEffect7(() => {
|
|
14026
14377
|
if (!isPortalOwner) return;
|
|
14027
14378
|
const root = rootRef.current;
|
|
14028
14379
|
if (!root) return;
|
|
@@ -14040,7 +14391,7 @@ function Toaster({
|
|
|
14040
14391
|
li.style.height = `${slotHeight(idx)}px`;
|
|
14041
14392
|
}
|
|
14042
14393
|
}, [isPortalOwner, layoutTick, records, stackGapPx]);
|
|
14043
|
-
|
|
14394
|
+
useEffect19(() => {
|
|
14044
14395
|
if (!isPortalOwner) return;
|
|
14045
14396
|
const root = rootRef.current;
|
|
14046
14397
|
if (!root) return;
|
|
@@ -14074,7 +14425,7 @@ function Toaster({
|
|
|
14074
14425
|
return null;
|
|
14075
14426
|
}
|
|
14076
14427
|
return createPortal7(
|
|
14077
|
-
/* @__PURE__ */
|
|
14428
|
+
/* @__PURE__ */ jsx73(
|
|
14078
14429
|
"ol",
|
|
14079
14430
|
{
|
|
14080
14431
|
ref: rootRef,
|
|
@@ -14085,7 +14436,7 @@ function Toaster({
|
|
|
14085
14436
|
style: {
|
|
14086
14437
|
["--refineui-toast-gap"]: `${stackGapPx}px`
|
|
14087
14438
|
},
|
|
14088
|
-
children: records.map((rec, index) => /* @__PURE__ */
|
|
14439
|
+
children: records.map((rec, index) => /* @__PURE__ */ jsx73(
|
|
14089
14440
|
"li",
|
|
14090
14441
|
{
|
|
14091
14442
|
ref: (node) => {
|
|
@@ -14099,7 +14450,7 @@ function Toaster({
|
|
|
14099
14450
|
["--refineui-toast-z-index"]: String(STACK_Z_BASE - index),
|
|
14100
14451
|
["--refineui-toast-stack-index"]: String(index)
|
|
14101
14452
|
},
|
|
14102
|
-
children: /* @__PURE__ */
|
|
14453
|
+
children: /* @__PURE__ */ jsx73("div", { "data-refineui": "toast-scale-layer", children: /* @__PURE__ */ jsx73(
|
|
14103
14454
|
SwipeableToast,
|
|
14104
14455
|
{
|
|
14105
14456
|
record: rec,
|
|
@@ -14124,22 +14475,22 @@ import {
|
|
|
14124
14475
|
useCallback as useCallback22,
|
|
14125
14476
|
useMemo as useMemo21,
|
|
14126
14477
|
useRef as useRef22,
|
|
14127
|
-
useState as
|
|
14478
|
+
useState as useState30
|
|
14128
14479
|
} from "react";
|
|
14129
14480
|
|
|
14130
14481
|
// src/components/Tree/context.ts
|
|
14131
|
-
import { createContext as
|
|
14482
|
+
import { createContext as createContext27, useEffect as useEffect20, useState as useState29 } from "react";
|
|
14132
14483
|
import { semanticInteraction as semanticInteraction8 } from "@refineui/tokens";
|
|
14133
14484
|
import { getReducedMotionQuery as getReducedMotionQuery2 } from "@refineui/utilities/animation";
|
|
14134
14485
|
var TREE_PANEL_MS = Number.parseFloat(semanticInteraction8.duration.accordionPanel) / 1e3;
|
|
14135
14486
|
var TREE_CONTENT_MS = Number.parseFloat(semanticInteraction8.duration.accordionContent) / 1e3;
|
|
14136
14487
|
var TREE_PANEL_EASE = semanticInteraction8.easing.panel;
|
|
14137
14488
|
var TREE_CONTENT_EASE = semanticInteraction8.easing.content;
|
|
14138
|
-
var TreeContext =
|
|
14139
|
-
var TreeItemContext =
|
|
14489
|
+
var TreeContext = createContext27(null);
|
|
14490
|
+
var TreeItemContext = createContext27(null);
|
|
14140
14491
|
function usePrefersReducedMotion2() {
|
|
14141
|
-
const [reduce, setReduce] =
|
|
14142
|
-
|
|
14492
|
+
const [reduce, setReduce] = useState29(false);
|
|
14493
|
+
useEffect20(() => {
|
|
14143
14494
|
const mql = window.matchMedia(getReducedMotionQuery2().replace("@media ", ""));
|
|
14144
14495
|
const sync = () => setReduce(mql.matches);
|
|
14145
14496
|
sync();
|
|
@@ -14194,7 +14545,7 @@ var treeItemTypo = {
|
|
|
14194
14545
|
};
|
|
14195
14546
|
|
|
14196
14547
|
// src/components/Tree/Tree.tsx
|
|
14197
|
-
import { jsx as
|
|
14548
|
+
import { jsx as jsx74 } from "react/jsx-runtime";
|
|
14198
14549
|
function Tree({
|
|
14199
14550
|
size = "md",
|
|
14200
14551
|
defaultExpanded,
|
|
@@ -14208,8 +14559,8 @@ function Tree({
|
|
|
14208
14559
|
...props
|
|
14209
14560
|
}) {
|
|
14210
14561
|
const reduceMotion = usePrefersReducedMotion2();
|
|
14211
|
-
const [uncontrolledExpanded, setUncontrolledExpanded] =
|
|
14212
|
-
const [uncontrolledSelected, setUncontrolledSelected] =
|
|
14562
|
+
const [uncontrolledExpanded, setUncontrolledExpanded] = useState30(() => toExpandedSet(defaultExpanded));
|
|
14563
|
+
const [uncontrolledSelected, setUncontrolledSelected] = useState30(defaultSelected ?? null);
|
|
14213
14564
|
const expanded = expandedProp === void 0 ? uncontrolledExpanded : toExpandedSet(expandedProp);
|
|
14214
14565
|
const selected = selectedProp === void 0 ? uncontrolledSelected : selectedProp;
|
|
14215
14566
|
const orderRef = useRef22([]);
|
|
@@ -14346,7 +14697,7 @@ function Tree({
|
|
|
14346
14697
|
toggleExpanded
|
|
14347
14698
|
]
|
|
14348
14699
|
);
|
|
14349
|
-
return /* @__PURE__ */
|
|
14700
|
+
return /* @__PURE__ */ jsx74(TreeContext.Provider, { value: contextValue, children: /* @__PURE__ */ jsx74(
|
|
14350
14701
|
"ul",
|
|
14351
14702
|
{
|
|
14352
14703
|
"data-refineui": "tree",
|
|
@@ -14360,13 +14711,13 @@ function Tree({
|
|
|
14360
14711
|
|
|
14361
14712
|
// src/components/Tree/TreeItem.tsx
|
|
14362
14713
|
import { clsx as clsx101 } from "clsx";
|
|
14363
|
-
import { useContext as
|
|
14364
|
-
import { jsx as
|
|
14714
|
+
import { useContext as useContext29, useId as useId16, useMemo as useMemo22, useState as useState31 } from "react";
|
|
14715
|
+
import { jsx as jsx75 } from "react/jsx-runtime";
|
|
14365
14716
|
function TreeItem({ value, disabled = false, className, children, ...props }) {
|
|
14366
|
-
const tree =
|
|
14367
|
-
const parent =
|
|
14717
|
+
const tree = useContext29(TreeContext);
|
|
14718
|
+
const parent = useContext29(TreeItemContext);
|
|
14368
14719
|
if (!tree) throw new Error("TreeItem must be used within Tree.");
|
|
14369
|
-
const [hasBranch, setHasBranch] =
|
|
14720
|
+
const [hasBranch, setHasBranch] = useState31(false);
|
|
14370
14721
|
const uid = useId16().replace(/:/g, "");
|
|
14371
14722
|
const depth = parent ? parent.depth + 1 : 0;
|
|
14372
14723
|
const parentValue = parent?.value ?? null;
|
|
@@ -14389,7 +14740,7 @@ function TreeItem({ value, disabled = false, className, children, ...props }) {
|
|
|
14389
14740
|
}),
|
|
14390
14741
|
[value, depth, parentValue, expanded, selected, disabled, hasBranch, triggerId, groupId]
|
|
14391
14742
|
);
|
|
14392
|
-
return /* @__PURE__ */
|
|
14743
|
+
return /* @__PURE__ */ jsx75(TreeItemContext.Provider, { value: itemContext, children: /* @__PURE__ */ jsx75(
|
|
14393
14744
|
"li",
|
|
14394
14745
|
{
|
|
14395
14746
|
"data-refineui": "tree-item",
|
|
@@ -14411,20 +14762,20 @@ function TreeItem({ value, disabled = false, className, children, ...props }) {
|
|
|
14411
14762
|
// src/components/Tree/TreeItemTrigger.tsx
|
|
14412
14763
|
import { clsx as clsx102 } from "clsx";
|
|
14413
14764
|
import {
|
|
14414
|
-
useContext as
|
|
14415
|
-
useEffect as
|
|
14765
|
+
useContext as useContext30,
|
|
14766
|
+
useEffect as useEffect21
|
|
14416
14767
|
} from "react";
|
|
14417
|
-
import { jsx as
|
|
14768
|
+
import { jsx as jsx76, jsxs as jsxs31 } from "react/jsx-runtime";
|
|
14418
14769
|
function TreeItemTrigger({ className, children, onClick, onKeyDown, ...props }) {
|
|
14419
|
-
const tree =
|
|
14420
|
-
const item =
|
|
14770
|
+
const tree = useContext30(TreeContext);
|
|
14771
|
+
const item = useContext30(TreeItemContext);
|
|
14421
14772
|
if (!tree || !item) throw new Error("TreeItemTrigger must be used within TreeItem.");
|
|
14422
14773
|
const iconSize = treeIconSize[tree.size];
|
|
14423
14774
|
const depthIndent = "calc(var(--refineui-spacing-size-large) + var(--refineui-spacing-size-x-small))";
|
|
14424
14775
|
const mainStyle = {
|
|
14425
14776
|
paddingInlineStart: item.depth > 0 ? `calc(${depthIndent} * ${item.depth})` : void 0
|
|
14426
14777
|
};
|
|
14427
|
-
|
|
14778
|
+
useEffect21(() => {
|
|
14428
14779
|
return () => {
|
|
14429
14780
|
tree.registerItem(item.value, null, {
|
|
14430
14781
|
parentValue: item.parentValue,
|
|
@@ -14500,7 +14851,7 @@ function TreeItemTrigger({ className, children, onClick, onKeyDown, ...props })
|
|
|
14500
14851
|
break;
|
|
14501
14852
|
}
|
|
14502
14853
|
};
|
|
14503
|
-
return /* @__PURE__ */
|
|
14854
|
+
return /* @__PURE__ */ jsx76(
|
|
14504
14855
|
"div",
|
|
14505
14856
|
{
|
|
14506
14857
|
ref: setRowRef,
|
|
@@ -14519,8 +14870,8 @@ function TreeItemTrigger({ className, children, onClick, onKeyDown, ...props })
|
|
|
14519
14870
|
className
|
|
14520
14871
|
),
|
|
14521
14872
|
...props,
|
|
14522
|
-
children: /* @__PURE__ */
|
|
14523
|
-
item.hasBranch ? /* @__PURE__ */
|
|
14873
|
+
children: /* @__PURE__ */ jsxs31("div", { "data-refineui": "tree-item-main", className: treeStyles.rowMain, style: mainStyle, children: [
|
|
14874
|
+
item.hasBranch ? /* @__PURE__ */ jsx76(
|
|
14524
14875
|
"button",
|
|
14525
14876
|
{
|
|
14526
14877
|
type: "button",
|
|
@@ -14534,10 +14885,10 @@ function TreeItemTrigger({ className, children, onClick, onKeyDown, ...props })
|
|
|
14534
14885
|
item.expanded && treeStyles.chevronExpanded,
|
|
14535
14886
|
tree.reduceMotion && "transition-none"
|
|
14536
14887
|
),
|
|
14537
|
-
children: /* @__PURE__ */
|
|
14888
|
+
children: /* @__PURE__ */ jsx76(WebIcon, { name: "chevron-right", size: iconSize, color: "currentColor", fallback: "\u203A" })
|
|
14538
14889
|
}
|
|
14539
|
-
) : /* @__PURE__ */
|
|
14540
|
-
/* @__PURE__ */
|
|
14890
|
+
) : /* @__PURE__ */ jsx76("span", { className: treeStyles.chevronSpacer, "aria-hidden": "true" }),
|
|
14891
|
+
/* @__PURE__ */ jsx76("span", { className: treeStyles.label, children })
|
|
14541
14892
|
] })
|
|
14542
14893
|
}
|
|
14543
14894
|
);
|
|
@@ -14545,14 +14896,14 @@ function TreeItemTrigger({ className, children, onClick, onKeyDown, ...props })
|
|
|
14545
14896
|
|
|
14546
14897
|
// src/components/Tree/TreeItemContent.tsx
|
|
14547
14898
|
import { clsx as clsx103 } from "clsx";
|
|
14548
|
-
import { useContext as
|
|
14549
|
-
import { jsx as
|
|
14899
|
+
import { useContext as useContext31, useLayoutEffect as useLayoutEffect13 } from "react";
|
|
14900
|
+
import { jsx as jsx77 } from "react/jsx-runtime";
|
|
14550
14901
|
function TreeItemContent({ className, children, ...props }) {
|
|
14551
|
-
const tree =
|
|
14552
|
-
const item =
|
|
14902
|
+
const tree = useContext31(TreeContext);
|
|
14903
|
+
const item = useContext31(TreeItemContext);
|
|
14553
14904
|
if (!tree || !item) throw new Error("TreeItemContent must be used within TreeItem.");
|
|
14554
14905
|
const { setHasBranch, expanded, groupId, triggerId } = item;
|
|
14555
|
-
|
|
14906
|
+
useLayoutEffect13(() => {
|
|
14556
14907
|
setHasBranch(true);
|
|
14557
14908
|
return () => setHasBranch(false);
|
|
14558
14909
|
}, [setHasBranch]);
|
|
@@ -14567,7 +14918,7 @@ function TreeItemContent({ className, children, ...props }) {
|
|
|
14567
14918
|
transition: tree.reduceMotion ? void 0 : `opacity ${TREE_CONTENT_MS}s ${TREE_CONTENT_EASE}, transform ${TREE_CONTENT_MS}s ${TREE_CONTENT_EASE}`,
|
|
14568
14919
|
pointerEvents: expanded ? void 0 : "none"
|
|
14569
14920
|
};
|
|
14570
|
-
return /* @__PURE__ */
|
|
14921
|
+
return /* @__PURE__ */ jsx77(
|
|
14571
14922
|
"div",
|
|
14572
14923
|
{
|
|
14573
14924
|
ref: (el) => {
|
|
@@ -14578,7 +14929,7 @@ function TreeItemContent({ className, children, ...props }) {
|
|
|
14578
14929
|
"data-refineui": "tree-item-panel",
|
|
14579
14930
|
"aria-hidden": !expanded,
|
|
14580
14931
|
style: gridStyle,
|
|
14581
|
-
children: /* @__PURE__ */
|
|
14932
|
+
children: /* @__PURE__ */ jsx77("div", { className: treeStyles.panel, children: /* @__PURE__ */ jsx77("div", { className: treeStyles.panelInner, style: innerMotionStyle, children: /* @__PURE__ */ jsx77(
|
|
14582
14933
|
"ul",
|
|
14583
14934
|
{
|
|
14584
14935
|
id: groupId,
|
|
@@ -14596,82 +14947,26 @@ function TreeItemContent({ className, children, ...props }) {
|
|
|
14596
14947
|
|
|
14597
14948
|
// src/components/Tooltip/Tooltip.tsx
|
|
14598
14949
|
import { clsx as clsx105 } from "clsx";
|
|
14599
|
-
import { useId as useId17, useRef as useRef23, useState as
|
|
14950
|
+
import { useId as useId17, useRef as useRef23, useState as useState32 } from "react";
|
|
14951
|
+
import { borderRadii as borderRadii2 } from "@refineui/tokens";
|
|
14600
14952
|
import { resolveColorTokenValue as resolveColorTokenValue12 } from "@refineui/utilities/color";
|
|
14601
14953
|
import { Slot as Slot5, getMergeableTriggerChild as getMergeableTriggerChild4 } from "@refineui/utilities/react";
|
|
14602
14954
|
|
|
14603
|
-
// src/components/shared/FrostedBeak.tsx
|
|
14604
|
-
import { strokeWidths as strokeWidths3 } from "@refineui/tokens";
|
|
14605
|
-
import { jsx as jsx77, jsxs as jsxs31 } from "react/jsx-runtime";
|
|
14606
|
-
var triangleClipPath = "polygon(50% 0, 0 100%, 100% 100%)";
|
|
14607
|
-
function FrostedBeak({ width, height, rotateDeg, borderColor }) {
|
|
14608
|
-
const surfaceStyle = {
|
|
14609
|
-
position: "absolute",
|
|
14610
|
-
inset: 0,
|
|
14611
|
-
clipPath: triangleClipPath
|
|
14612
|
-
};
|
|
14613
|
-
return /* @__PURE__ */ jsxs31(
|
|
14614
|
-
"div",
|
|
14615
|
-
{
|
|
14616
|
-
style: {
|
|
14617
|
-
position: "relative",
|
|
14618
|
-
width,
|
|
14619
|
-
height,
|
|
14620
|
-
transform: `rotate(${rotateDeg}deg)`,
|
|
14621
|
-
transformOrigin: "center center"
|
|
14622
|
-
},
|
|
14623
|
-
children: [
|
|
14624
|
-
/* @__PURE__ */ jsx77(
|
|
14625
|
-
"span",
|
|
14626
|
-
{
|
|
14627
|
-
"data-refineui": "floating-beak-surface",
|
|
14628
|
-
style: surfaceStyle
|
|
14629
|
-
}
|
|
14630
|
-
),
|
|
14631
|
-
/* @__PURE__ */ jsx77(
|
|
14632
|
-
"svg",
|
|
14633
|
-
{
|
|
14634
|
-
width,
|
|
14635
|
-
height,
|
|
14636
|
-
viewBox: "0 0 16 8",
|
|
14637
|
-
fill: "none",
|
|
14638
|
-
"aria-hidden": true,
|
|
14639
|
-
style: { position: "absolute", inset: 0, overflow: "visible" },
|
|
14640
|
-
children: /* @__PURE__ */ jsx77(
|
|
14641
|
-
"path",
|
|
14642
|
-
{
|
|
14643
|
-
d: "M0 8L8 0L16 8",
|
|
14644
|
-
stroke: borderColor,
|
|
14645
|
-
strokeWidth: strokeWidths3.strokeWidthThin,
|
|
14646
|
-
strokeLinejoin: "round"
|
|
14647
|
-
}
|
|
14648
|
-
)
|
|
14649
|
-
}
|
|
14650
|
-
)
|
|
14651
|
-
]
|
|
14652
|
-
}
|
|
14653
|
-
);
|
|
14654
|
-
}
|
|
14655
|
-
|
|
14656
14955
|
// src/components/Tooltip/style.ts
|
|
14657
|
-
import { spacings as
|
|
14956
|
+
import { spacings as spacings8 } from "@refineui/tokens";
|
|
14658
14957
|
import { clsx as clsx104 } from "clsx";
|
|
14659
|
-
var
|
|
14660
|
-
var
|
|
14661
|
-
var TOOLTIP_BEAK_OFFSET = foundationSizes.foundationSize80;
|
|
14662
|
-
var BEAK_BORDER_OVERLAP2 = strokeWidths4.strokeWidthThin;
|
|
14663
|
-
var gap = spacings7.sizeXSmall;
|
|
14664
|
-
var edgeInset = spacings7.sizeMedium;
|
|
14958
|
+
var gap = `calc(${componentSizes2.tooltipBeakHeight} + ${spacings8.sizeXXSmall})`;
|
|
14959
|
+
var TOOLTIP_BEAK_INSET = spacings8.sizeMedium;
|
|
14665
14960
|
var tooltipStyles = {
|
|
14666
14961
|
root: "relative inline-block",
|
|
14667
14962
|
fallbackTrigger: "inline-flex outline-none",
|
|
14668
|
-
/** Positions the floating stack (
|
|
14963
|
+
/** Positions the floating stack (surface + panel), like PopOver `floatingRoot`. */
|
|
14669
14964
|
floating: "pointer-events-none absolute z-refineui-popup",
|
|
14670
14965
|
panelWrap: "relative inline-block max-w-refineui-tooltip-max-width",
|
|
14671
|
-
|
|
14966
|
+
/** Fill, stroke, and shadow come from `FloatingSurface`; the transparent border keeps the box size. */
|
|
14672
14967
|
panel: clsx104(
|
|
14673
14968
|
componentTextClass(componentTypographyTokens.tooltip),
|
|
14674
|
-
"relative z-0 box-border max-w-refineui-tooltip-max-width whitespace-nowrap rounded-refineui-medium border-refineui-
|
|
14969
|
+
"relative z-0 box-border max-w-refineui-tooltip-max-width whitespace-nowrap rounded-refineui-medium border-refineui-hairline border-transparent px-refineui-size-medium py-refineui-size-small"
|
|
14675
14970
|
)
|
|
14676
14971
|
};
|
|
14677
14972
|
function tooltipPlacement(position) {
|
|
@@ -14692,6 +14987,15 @@ function tooltipAlignKey(align) {
|
|
|
14692
14987
|
if (align === "End") return "end";
|
|
14693
14988
|
return "center";
|
|
14694
14989
|
}
|
|
14990
|
+
var beakSideByPlacement2 = {
|
|
14991
|
+
bottom: "top",
|
|
14992
|
+
top: "bottom",
|
|
14993
|
+
left: "right",
|
|
14994
|
+
right: "left"
|
|
14995
|
+
};
|
|
14996
|
+
function tooltipBeakSide(position) {
|
|
14997
|
+
return beakSideByPlacement2[tooltipPlacement(position)];
|
|
14998
|
+
}
|
|
14695
14999
|
function tooltipFloatingStyle(position, align) {
|
|
14696
15000
|
switch (position) {
|
|
14697
15001
|
case "Top":
|
|
@@ -14714,45 +15018,6 @@ function tooltipFloatingStyle(position, align) {
|
|
|
14714
15018
|
return {};
|
|
14715
15019
|
}
|
|
14716
15020
|
}
|
|
14717
|
-
function tooltipBeakWrapperStyle(position, align) {
|
|
14718
|
-
const overlapOffset = `calc(-1 * ${TOOLTIP_BEAK_OFFSET} + ${BEAK_BORDER_OVERLAP2})`;
|
|
14719
|
-
const placement = tooltipPlacement(position);
|
|
14720
|
-
const a = tooltipAlignKey(align);
|
|
14721
|
-
switch (placement) {
|
|
14722
|
-
case "bottom":
|
|
14723
|
-
if (a === "center") return { top: overlapOffset, left: `calc(50% - ${TOOLTIP_BEAK_W} / 2)` };
|
|
14724
|
-
if (a === "start") return { top: overlapOffset, left: edgeInset };
|
|
14725
|
-
return { top: overlapOffset, right: edgeInset };
|
|
14726
|
-
case "top":
|
|
14727
|
-
if (a === "center") return { bottom: overlapOffset, left: `calc(50% - ${TOOLTIP_BEAK_W} / 2)` };
|
|
14728
|
-
if (a === "start") return { bottom: overlapOffset, left: edgeInset };
|
|
14729
|
-
return { bottom: overlapOffset, right: edgeInset };
|
|
14730
|
-
case "left":
|
|
14731
|
-
if (a === "center") return { right: overlapOffset, top: `calc(50% - ${TOOLTIP_BEAK_W} / 2)` };
|
|
14732
|
-
if (a === "start") return { right: overlapOffset, top: edgeInset };
|
|
14733
|
-
return { right: overlapOffset, bottom: edgeInset };
|
|
14734
|
-
case "right":
|
|
14735
|
-
if (a === "center") return { left: overlapOffset, top: `calc(50% - ${TOOLTIP_BEAK_W} / 2)` };
|
|
14736
|
-
if (a === "start") return { left: overlapOffset, top: edgeInset };
|
|
14737
|
-
return { left: overlapOffset, bottom: edgeInset };
|
|
14738
|
-
default:
|
|
14739
|
-
return {};
|
|
14740
|
-
}
|
|
14741
|
-
}
|
|
14742
|
-
function tooltipBeakRotateDeg(position) {
|
|
14743
|
-
switch (tooltipPlacement(position)) {
|
|
14744
|
-
case "bottom":
|
|
14745
|
-
return 0;
|
|
14746
|
-
case "top":
|
|
14747
|
-
return 180;
|
|
14748
|
-
case "left":
|
|
14749
|
-
return -90;
|
|
14750
|
-
case "right":
|
|
14751
|
-
return 90;
|
|
14752
|
-
default:
|
|
14753
|
-
return 0;
|
|
14754
|
-
}
|
|
14755
|
-
}
|
|
14756
15021
|
|
|
14757
15022
|
// src/components/Tooltip/Tooltip.tsx
|
|
14758
15023
|
import { jsx as jsx78, jsxs as jsxs32 } from "react/jsx-runtime";
|
|
@@ -14768,10 +15033,11 @@ function Tooltip({
|
|
|
14768
15033
|
className,
|
|
14769
15034
|
...props
|
|
14770
15035
|
}) {
|
|
14771
|
-
const [innerOpen, setInnerOpen] =
|
|
15036
|
+
const [innerOpen, setInnerOpen] = useState32(defaultOpen);
|
|
14772
15037
|
const open = ctrlOpen !== void 0 ? ctrlOpen : innerOpen;
|
|
14773
15038
|
const tooltipId = useId17();
|
|
14774
15039
|
const showTimer = useRef23(null);
|
|
15040
|
+
const panelRef = useRef23(null);
|
|
14775
15041
|
const setOpen = (next) => {
|
|
14776
15042
|
if (ctrlOpen === void 0) setInnerOpen(next);
|
|
14777
15043
|
onOpenChange?.(next);
|
|
@@ -14795,8 +15061,6 @@ function Tooltip({
|
|
|
14795
15061
|
setOpen(false);
|
|
14796
15062
|
};
|
|
14797
15063
|
const floatingStyle = tooltipFloatingStyle(position, align);
|
|
14798
|
-
const beakWrapStyle = tooltipBeakWrapperStyle(position, align);
|
|
14799
|
-
const beakRot = tooltipBeakRotateDeg(position);
|
|
14800
15064
|
const describedBy = open ? tooltipId : void 0;
|
|
14801
15065
|
const mergeEl = getMergeableTriggerChild4(trigger);
|
|
14802
15066
|
let triggerNode;
|
|
@@ -14841,36 +15105,32 @@ function Tooltip({
|
|
|
14841
15105
|
/* @__PURE__ */ jsx78(
|
|
14842
15106
|
"div",
|
|
14843
15107
|
{
|
|
14844
|
-
|
|
14845
|
-
style: { ...beakWrapStyle, width: TOOLTIP_BEAK_W, height: TOOLTIP_BEAK_H },
|
|
14846
|
-
"aria-hidden": true,
|
|
14847
|
-
children: /* @__PURE__ */ jsx78(
|
|
14848
|
-
FrostedBeak,
|
|
14849
|
-
{
|
|
14850
|
-
width: TOOLTIP_BEAK_W,
|
|
14851
|
-
height: TOOLTIP_BEAK_H,
|
|
14852
|
-
rotateDeg: beakRot,
|
|
14853
|
-
borderColor: borderCol
|
|
14854
|
-
}
|
|
14855
|
-
)
|
|
14856
|
-
}
|
|
14857
|
-
),
|
|
14858
|
-
/* @__PURE__ */ jsx78(
|
|
14859
|
-
"div",
|
|
14860
|
-
{
|
|
15108
|
+
ref: panelRef,
|
|
14861
15109
|
id: tooltipId,
|
|
14862
15110
|
role: "tooltip",
|
|
14863
15111
|
"data-refineui": "tooltip-panel",
|
|
14864
15112
|
"data-position": position,
|
|
14865
15113
|
"data-align": align,
|
|
14866
15114
|
className: tooltipStyles.panel,
|
|
14867
|
-
style: {
|
|
14868
|
-
backgroundColor: bg,
|
|
14869
|
-
color: fg,
|
|
14870
|
-
borderColor: borderCol
|
|
14871
|
-
},
|
|
15115
|
+
style: { color: fg },
|
|
14872
15116
|
children: content
|
|
14873
15117
|
}
|
|
15118
|
+
),
|
|
15119
|
+
/* @__PURE__ */ jsx78(
|
|
15120
|
+
FloatingSurface,
|
|
15121
|
+
{
|
|
15122
|
+
panelRef,
|
|
15123
|
+
side: tooltipBeakSide(position),
|
|
15124
|
+
align: tooltipAlignKey(align),
|
|
15125
|
+
radius: borderRadii2.roundedMedium,
|
|
15126
|
+
beakWidth: componentSizes2.tooltipBeakWidth,
|
|
15127
|
+
beakHeight: componentSizes2.tooltipBeakHeight,
|
|
15128
|
+
tipRadius: componentSizes2.tooltipBeakTipRadius,
|
|
15129
|
+
beakInsetStart: TOOLTIP_BEAK_INSET,
|
|
15130
|
+
beakInsetEnd: TOOLTIP_BEAK_INSET,
|
|
15131
|
+
backgroundColor: bg,
|
|
15132
|
+
borderColor: borderCol
|
|
15133
|
+
}
|
|
14874
15134
|
)
|
|
14875
15135
|
] }) })
|
|
14876
15136
|
] });
|
|
@@ -14880,13 +15140,13 @@ function Tooltip({
|
|
|
14880
15140
|
import { clsx as clsx107 } from "clsx";
|
|
14881
15141
|
import {
|
|
14882
15142
|
Children as Children8,
|
|
14883
|
-
createContext as
|
|
15143
|
+
createContext as createContext28,
|
|
14884
15144
|
isValidElement as isValidElement7,
|
|
14885
|
-
useContext as
|
|
15145
|
+
useContext as useContext32,
|
|
14886
15146
|
useId as useId18,
|
|
14887
|
-
useLayoutEffect as
|
|
15147
|
+
useLayoutEffect as useLayoutEffect14,
|
|
14888
15148
|
useMemo as useMemo23,
|
|
14889
|
-
useState as
|
|
15149
|
+
useState as useState33
|
|
14890
15150
|
} from "react";
|
|
14891
15151
|
import { opacities } from "@refineui/tokens";
|
|
14892
15152
|
import { resolveColorTokenValue as resolveColorTokenValue13 } from "@refineui/utilities/color";
|
|
@@ -14933,13 +15193,13 @@ var chartStyles = {
|
|
|
14933
15193
|
};
|
|
14934
15194
|
|
|
14935
15195
|
// src/components/Chart/utils.ts
|
|
14936
|
-
import { borderRadii, foundationSizes as foundationSizes3, spacings as
|
|
15196
|
+
import { borderRadii as borderRadii3, foundationSizes as foundationSizes3, spacings as spacings9 } from "@refineui/tokens";
|
|
14937
15197
|
var CHART_VIEWBOX_WIDTH = 800;
|
|
14938
15198
|
var CHART_VIEWBOX_HEIGHT = 320;
|
|
14939
|
-
var CHART_PLOT_PADDING_TOP = parseFloat(
|
|
14940
|
-
var CHART_PLOT_PADDING_BOTTOM = parseFloat(
|
|
14941
|
-
var CHART_PLOT_PADDING_X = parseFloat(
|
|
14942
|
-
var CHART_BAR_RADIUS = parseFloat(
|
|
15199
|
+
var CHART_PLOT_PADDING_TOP = parseFloat(spacings9.sizeMedium);
|
|
15200
|
+
var CHART_PLOT_PADDING_BOTTOM = parseFloat(spacings9.sizeXXSmall);
|
|
15201
|
+
var CHART_PLOT_PADDING_X = parseFloat(spacings9.sizeMedium);
|
|
15202
|
+
var CHART_BAR_RADIUS = parseFloat(borderRadii3.roundedXLarge);
|
|
14943
15203
|
var CHART_BAR_BAND_FILL = 0.5;
|
|
14944
15204
|
var CHART_POINT_RADIUS = parseFloat(foundationSizes3.foundationSize40);
|
|
14945
15205
|
var CHART_POINT_STROKE = parseFloat(foundationSizes3.foundationSize20);
|
|
@@ -15115,9 +15375,9 @@ function formatAxisTick(value) {
|
|
|
15115
15375
|
|
|
15116
15376
|
// src/components/Chart/Chart.tsx
|
|
15117
15377
|
import { Fragment as Fragment4, jsx as jsx79, jsxs as jsxs33 } from "react/jsx-runtime";
|
|
15118
|
-
var ChartContext =
|
|
15378
|
+
var ChartContext = createContext28(null);
|
|
15119
15379
|
function useChartContext(component) {
|
|
15120
|
-
const value =
|
|
15380
|
+
const value = useContext32(ChartContext);
|
|
15121
15381
|
if (!value) throw new Error(`${component} must be used within Chart.`);
|
|
15122
15382
|
return value;
|
|
15123
15383
|
}
|
|
@@ -15150,11 +15410,11 @@ function isChartTooltipElement(node) {
|
|
|
15150
15410
|
return isValidElement7(node) && node.type === ChartTooltip;
|
|
15151
15411
|
}
|
|
15152
15412
|
function Chart({ className, children, ...props }) {
|
|
15153
|
-
const [hoverIndex, setHoverIndex] =
|
|
15154
|
-
const [selectedIndex, setSelectedIndex] =
|
|
15155
|
-
const [pointer, setPointer] =
|
|
15156
|
-
const [labels, setLabels] =
|
|
15157
|
-
const [series, setSeries] =
|
|
15413
|
+
const [hoverIndex, setHoverIndex] = useState33(null);
|
|
15414
|
+
const [selectedIndex, setSelectedIndex] = useState33(null);
|
|
15415
|
+
const [pointer, setPointer] = useState33(null);
|
|
15416
|
+
const [labels, setLabels] = useState33([]);
|
|
15417
|
+
const [series, setSeries] = useState33(null);
|
|
15158
15418
|
const context = useMemo23(
|
|
15159
15419
|
() => ({
|
|
15160
15420
|
hoverIndex,
|
|
@@ -15389,7 +15649,7 @@ function ChartBars({
|
|
|
15389
15649
|
const barRadius = Math.min(CHART_BAR_RADIUS, barWidth / 2);
|
|
15390
15650
|
const baselineY = plotBaselineY();
|
|
15391
15651
|
const trackHeight = plotHeight();
|
|
15392
|
-
|
|
15652
|
+
useLayoutEffect14(() => {
|
|
15393
15653
|
setSeries({ values, seriesColor, max, align: "bar" });
|
|
15394
15654
|
}, [values, seriesColor, max, setSeries]);
|
|
15395
15655
|
return /* @__PURE__ */ jsxs33("g", { "data-refineui": "chart-bars", "data-series-color": seriesColor, className, ...props, children: [
|
|
@@ -15447,7 +15707,7 @@ function ChartLine({
|
|
|
15447
15707
|
const baselineY = plotBaselineY();
|
|
15448
15708
|
const pointRing = pointStrokeColor();
|
|
15449
15709
|
const linePath = monotoneLinePath(coords);
|
|
15450
|
-
|
|
15710
|
+
useLayoutEffect14(() => {
|
|
15451
15711
|
setSeries({ values, seriesColor, max, align: "line" });
|
|
15452
15712
|
}, [values, seriesColor, max, setSeries]);
|
|
15453
15713
|
return /* @__PURE__ */ jsxs33("g", { "data-refineui": "chart-line", "data-series-color": seriesColor, className, ...props, children: [
|
|
@@ -15516,7 +15776,7 @@ function ChartAxisLabels({
|
|
|
15516
15776
|
const { hoverIndex, selectedIndex, setLabels } = useChartContext("ChartAxisLabels");
|
|
15517
15777
|
const count = labels.length;
|
|
15518
15778
|
const centerAt = align === "line" ? linePointCenterRatio : barBandCenterRatio;
|
|
15519
|
-
|
|
15779
|
+
useLayoutEffect14(() => {
|
|
15520
15780
|
setLabels(labels);
|
|
15521
15781
|
}, [labels, setLabels]);
|
|
15522
15782
|
return /* @__PURE__ */ jsx79(
|
|
@@ -15593,24 +15853,24 @@ import {
|
|
|
15593
15853
|
useCallback as useCallback23,
|
|
15594
15854
|
useId as useId19,
|
|
15595
15855
|
useMemo as useMemo24,
|
|
15596
|
-
useState as
|
|
15856
|
+
useState as useState35
|
|
15597
15857
|
} from "react";
|
|
15598
15858
|
import { clsx as clsx108 } from "clsx";
|
|
15599
15859
|
import { Slot as Slot7 } from "@refineui/utilities/react";
|
|
15600
15860
|
|
|
15601
15861
|
// src/components/Collapsible/context.ts
|
|
15602
|
-
import { createContext as
|
|
15862
|
+
import { createContext as createContext29, useContext as useContext33, useEffect as useEffect22, useState as useState34 } from "react";
|
|
15603
15863
|
import { semanticInteraction as semanticInteraction9 } from "@refineui/tokens";
|
|
15604
15864
|
import { getReducedMotionQuery as getReducedMotionQuery3 } from "@refineui/utilities/animation";
|
|
15605
|
-
var CollapsibleContext =
|
|
15865
|
+
var CollapsibleContext = createContext29(null);
|
|
15606
15866
|
function useCollapsibleContext(part) {
|
|
15607
|
-
const value =
|
|
15867
|
+
const value = useContext33(CollapsibleContext);
|
|
15608
15868
|
if (!value) throw new Error(`${part} must be used within Collapsible`);
|
|
15609
15869
|
return value;
|
|
15610
15870
|
}
|
|
15611
15871
|
function usePrefersReducedMotion3() {
|
|
15612
|
-
const [reduce, setReduce] =
|
|
15613
|
-
|
|
15872
|
+
const [reduce, setReduce] = useState34(false);
|
|
15873
|
+
useEffect22(() => {
|
|
15614
15874
|
const mql = window.matchMedia(getReducedMotionQuery3().replace("@media ", ""));
|
|
15615
15875
|
const sync = () => setReduce(mql.matches);
|
|
15616
15876
|
sync();
|
|
@@ -15632,7 +15892,7 @@ var collapsibleStyles = {
|
|
|
15632
15892
|
// src/components/Collapsible/Collapsible.tsx
|
|
15633
15893
|
import { jsx as jsx80 } from "react/jsx-runtime";
|
|
15634
15894
|
var Collapsible = forwardRef17(function Collapsible2({ open: openProp, defaultOpen = false, onOpenChange, asChild = false, className, children, ...props }, ref) {
|
|
15635
|
-
const [uncontrolled, setUncontrolled] =
|
|
15895
|
+
const [uncontrolled, setUncontrolled] = useState35(defaultOpen);
|
|
15636
15896
|
const open = openProp ?? uncontrolled;
|
|
15637
15897
|
const reactId = useId19();
|
|
15638
15898
|
const reduceMotion = usePrefersReducedMotion3();
|
|
@@ -15737,15 +15997,15 @@ var CollapsibleContent = forwardRef17(
|
|
|
15737
15997
|
|
|
15738
15998
|
// src/components/ContextMenu/ContextMenu.tsx
|
|
15739
15999
|
import {
|
|
15740
|
-
createContext as
|
|
16000
|
+
createContext as createContext30,
|
|
15741
16001
|
forwardRef as forwardRef18,
|
|
15742
16002
|
useCallback as useCallback24,
|
|
15743
|
-
useContext as
|
|
15744
|
-
useEffect as
|
|
15745
|
-
useLayoutEffect as
|
|
16003
|
+
useContext as useContext34,
|
|
16004
|
+
useEffect as useEffect23,
|
|
16005
|
+
useLayoutEffect as useLayoutEffect15,
|
|
15746
16006
|
useMemo as useMemo25,
|
|
15747
16007
|
useRef as useRef24,
|
|
15748
|
-
useState as
|
|
16008
|
+
useState as useState36
|
|
15749
16009
|
} from "react";
|
|
15750
16010
|
import { createPortal as createPortal8 } from "react-dom";
|
|
15751
16011
|
import { clsx as clsx109 } from "clsx";
|
|
@@ -15755,10 +16015,10 @@ import { Slot as Slot8 } from "@refineui/utilities/react";
|
|
|
15755
16015
|
import { Fragment as Fragment5, jsx as jsx81, jsxs as jsxs34 } from "react/jsx-runtime";
|
|
15756
16016
|
var MENU_ATTR = "data-refineui-context-menu";
|
|
15757
16017
|
var CLOSE_MS = motionMsToNumber7(semanticInteraction10.duration.normal);
|
|
15758
|
-
var MenuContext2 =
|
|
15759
|
-
var SubContext =
|
|
16018
|
+
var MenuContext2 = createContext30(null);
|
|
16019
|
+
var SubContext = createContext30(null);
|
|
15760
16020
|
function useMenu() {
|
|
15761
|
-
const value =
|
|
16021
|
+
const value = useContext34(MenuContext2);
|
|
15762
16022
|
if (!value) throw new Error("Context menu parts must be used within ContextMenu");
|
|
15763
16023
|
return value;
|
|
15764
16024
|
}
|
|
@@ -15775,8 +16035,8 @@ function placeInView(element, x, y) {
|
|
|
15775
16035
|
}
|
|
15776
16036
|
function ContextMenu({ modal = true, onOpenChange, children }) {
|
|
15777
16037
|
void modal;
|
|
15778
|
-
const [open, setOpen] =
|
|
15779
|
-
const [point, setPoint] =
|
|
16038
|
+
const [open, setOpen] = useState36(false);
|
|
16039
|
+
const [point, setPoint] = useState36({ x: 0, y: 0 });
|
|
15780
16040
|
const openRef = useRef24(false);
|
|
15781
16041
|
const onOpenChangeRef = useRef24(onOpenChange);
|
|
15782
16042
|
openRef.current = open;
|
|
@@ -15819,9 +16079,9 @@ function ContextMenuPortal({ children }) {
|
|
|
15819
16079
|
var ContextMenuContent = forwardRef18(function ContextMenuContent2({ className, style, onPointerDown, children, ...props }, ref) {
|
|
15820
16080
|
const { open, point, close } = useMenu();
|
|
15821
16081
|
const localRef = useRef24(null);
|
|
15822
|
-
const [shouldRender, setShouldRender] =
|
|
15823
|
-
const [isClosing, setIsClosing] =
|
|
15824
|
-
|
|
16082
|
+
const [shouldRender, setShouldRender] = useState36(open);
|
|
16083
|
+
const [isClosing, setIsClosing] = useState36(false);
|
|
16084
|
+
useEffect23(() => {
|
|
15825
16085
|
if (open) {
|
|
15826
16086
|
setShouldRender(true);
|
|
15827
16087
|
setIsClosing(false);
|
|
@@ -15835,11 +16095,11 @@ var ContextMenuContent = forwardRef18(function ContextMenuContent2({ className,
|
|
|
15835
16095
|
}, CLOSE_MS);
|
|
15836
16096
|
return () => window.clearTimeout(timeout);
|
|
15837
16097
|
}, [open, shouldRender]);
|
|
15838
|
-
|
|
16098
|
+
useLayoutEffect15(() => {
|
|
15839
16099
|
if (!shouldRender || !localRef.current) return;
|
|
15840
16100
|
placeInView(localRef.current, point.x, point.y);
|
|
15841
16101
|
}, [shouldRender, point.x, point.y]);
|
|
15842
|
-
|
|
16102
|
+
useEffect23(() => {
|
|
15843
16103
|
if (!open) return;
|
|
15844
16104
|
const onKey = (event) => {
|
|
15845
16105
|
if (event.key === "Escape") close();
|
|
@@ -15981,14 +16241,14 @@ function ContextMenuLabel({ className, children, ...props }) {
|
|
|
15981
16241
|
return /* @__PURE__ */ jsx81("div", { "data-refineui": "menu-label", className: clsx109(menuStyles.section, className), ...props, children: /* @__PURE__ */ jsx81("span", { className: menuStyles.sectionText, children }) });
|
|
15982
16242
|
}
|
|
15983
16243
|
function ContextMenuSub({ children }) {
|
|
15984
|
-
const [open, setOpen] =
|
|
16244
|
+
const [open, setOpen] = useState36(false);
|
|
15985
16245
|
const triggerRef = useRef24(null);
|
|
15986
16246
|
const timer = useRef24(null);
|
|
15987
16247
|
const clear = () => {
|
|
15988
16248
|
if (timer.current != null) window.clearTimeout(timer.current);
|
|
15989
16249
|
timer.current = null;
|
|
15990
16250
|
};
|
|
15991
|
-
|
|
16251
|
+
useEffect23(() => clear, []);
|
|
15992
16252
|
const value = useMemo25(
|
|
15993
16253
|
() => ({
|
|
15994
16254
|
open,
|
|
@@ -16007,7 +16267,7 @@ function ContextMenuSub({ children }) {
|
|
|
16007
16267
|
return /* @__PURE__ */ jsx81(SubContext.Provider, { value, children });
|
|
16008
16268
|
}
|
|
16009
16269
|
function useSub2() {
|
|
16010
|
-
const value =
|
|
16270
|
+
const value = useContext34(SubContext);
|
|
16011
16271
|
if (!value) throw new Error("ContextMenuSubTrigger must be used within ContextMenuSub");
|
|
16012
16272
|
return value;
|
|
16013
16273
|
}
|
|
@@ -16076,8 +16336,8 @@ var ContextMenuSubContent = forwardRef18(
|
|
|
16076
16336
|
function ContextMenuSubContent2({ className, style, onPointerDown, onMouseEnter, onMouseLeave, ...props }, ref) {
|
|
16077
16337
|
const sub = useSub2();
|
|
16078
16338
|
const localRef = useRef24(null);
|
|
16079
|
-
const [side, setSide] =
|
|
16080
|
-
|
|
16339
|
+
const [side, setSide] = useState36("right");
|
|
16340
|
+
useLayoutEffect15(() => {
|
|
16081
16341
|
const trigger = sub.triggerRef.current;
|
|
16082
16342
|
const element = localRef.current;
|
|
16083
16343
|
if (!sub.open || !trigger || !element) return;
|