@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.cjs
CHANGED
|
@@ -254,7 +254,7 @@ __export(src_exports, {
|
|
|
254
254
|
SidebarTrigger: () => SidebarTrigger,
|
|
255
255
|
Skeleton: () => Skeleton,
|
|
256
256
|
Slider: () => Slider,
|
|
257
|
-
Slot: () =>
|
|
257
|
+
Slot: () => import_react61.Slot,
|
|
258
258
|
Spacer: () => Spacer,
|
|
259
259
|
SpinButton: () => SpinButton,
|
|
260
260
|
Spinner: () => Spinner,
|
|
@@ -1103,7 +1103,12 @@ var componentTypographyTokens = {
|
|
|
1103
1103
|
/** Command palette — same scale as Menu (list / section / shortcut). */
|
|
1104
1104
|
command: {
|
|
1105
1105
|
group: role("captionLg"),
|
|
1106
|
-
|
|
1106
|
+
/** Row text follows the Command size, like Tree rows. */
|
|
1107
|
+
item: {
|
|
1108
|
+
sm: role("bodySm"),
|
|
1109
|
+
md: role("bodyMd"),
|
|
1110
|
+
lg: role("bodyLg")
|
|
1111
|
+
},
|
|
1107
1112
|
empty: role("bodyXs"),
|
|
1108
1113
|
shortcut: role("bodyXs"),
|
|
1109
1114
|
input: role("bodyMd")
|
|
@@ -1628,10 +1633,20 @@ var radius = {
|
|
|
1628
1633
|
md: "rounded-refineui-x-large",
|
|
1629
1634
|
lg: "rounded-refineui-xx-large"
|
|
1630
1635
|
};
|
|
1636
|
+
var paddingInline = {
|
|
1637
|
+
sm: "px-refineui-size-medium",
|
|
1638
|
+
md: "px-refineui-size-large",
|
|
1639
|
+
lg: "px-refineui-size-x-large"
|
|
1640
|
+
};
|
|
1641
|
+
var paddingBlock = {
|
|
1642
|
+
sm: "py-refineui-size-x-small",
|
|
1643
|
+
md: "py-refineui-size-medium",
|
|
1644
|
+
lg: "py-refineui-size-large"
|
|
1645
|
+
};
|
|
1631
1646
|
var padding = {
|
|
1632
|
-
sm: "
|
|
1633
|
-
md: "
|
|
1634
|
-
lg: "
|
|
1647
|
+
sm: [paddingInline.sm, paddingBlock.sm].join(" "),
|
|
1648
|
+
md: [paddingInline.md, paddingBlock.md].join(" "),
|
|
1649
|
+
lg: [paddingInline.lg, paddingBlock.lg].join(" ")
|
|
1635
1650
|
};
|
|
1636
1651
|
var typography = {
|
|
1637
1652
|
sm: sizedComponentTextClass(componentTypographyTokens.formControl, "sm"),
|
|
@@ -1649,6 +1664,11 @@ var formControlShellSizeClass = {
|
|
|
1649
1664
|
md: [fixedHeight.md, radius.md, padding.md, typography.md].join(" "),
|
|
1650
1665
|
lg: [fixedHeight.lg, radius.lg, padding.lg, typography.lg].join(" ")
|
|
1651
1666
|
};
|
|
1667
|
+
var formControlRowShellSizeClass = {
|
|
1668
|
+
sm: [fixedHeight.sm, radius.sm, paddingInline.sm].join(" "),
|
|
1669
|
+
md: [fixedHeight.md, radius.md, paddingInline.md].join(" "),
|
|
1670
|
+
lg: [fixedHeight.lg, radius.lg, paddingInline.lg].join(" ")
|
|
1671
|
+
};
|
|
1652
1672
|
var formControlShellHeightClass = {
|
|
1653
1673
|
sm: [fixedHeight.sm, radius.sm].join(" "),
|
|
1654
1674
|
md: [fixedHeight.md, radius.md].join(" "),
|
|
@@ -1730,7 +1750,7 @@ var inputOtpStyles = {
|
|
|
1730
1750
|
"inline-flex shrink-0 cursor-text items-center justify-center",
|
|
1731
1751
|
"border-refineui-thin border-transparent",
|
|
1732
1752
|
// Soft grey tile (not white) so cells read on light preview / page.
|
|
1733
|
-
"bg-refineui-alias-background-surface-
|
|
1753
|
+
"bg-refineui-alias-background-surface-hover",
|
|
1734
1754
|
"text-center tabular-nums",
|
|
1735
1755
|
"text-refineui-alias-foreground-primary",
|
|
1736
1756
|
"transition-[background-color,border-color]",
|
|
@@ -2011,22 +2031,27 @@ var import_react4 = require("react");
|
|
|
2011
2031
|
|
|
2012
2032
|
// src/components/SearchField/style.ts
|
|
2013
2033
|
var import_tokens5 = require("@refineui/tokens");
|
|
2014
|
-
var searchFieldLeadingIconSize =
|
|
2015
|
-
|
|
2034
|
+
var searchFieldLeadingIconSize = {
|
|
2035
|
+
sm: import_tokens5.iconSizes.small,
|
|
2036
|
+
md: import_tokens5.iconSizes.medium,
|
|
2037
|
+
lg: import_tokens5.iconSizes.large
|
|
2038
|
+
};
|
|
2039
|
+
var searchFieldClearIconSize = {
|
|
2040
|
+
sm: import_tokens5.iconSizes.xsmall,
|
|
2041
|
+
md: import_tokens5.iconSizes.small,
|
|
2042
|
+
lg: import_tokens5.iconSizes.small
|
|
2043
|
+
};
|
|
2016
2044
|
var searchFieldStyles = {
|
|
2017
2045
|
root: [
|
|
2018
2046
|
"box-border flex w-full min-w-0 items-center gap-refineui-size-x-small overflow-hidden outline-none",
|
|
2019
|
-
formControlTypoClass.md,
|
|
2020
2047
|
"transition-[background-color,border-color]",
|
|
2021
2048
|
"duration-[var(--refineui-motion-duration-fast)]",
|
|
2022
2049
|
"ease-[var(--refineui-motion-easing-emphasized)]"
|
|
2023
2050
|
].join(" "),
|
|
2024
2051
|
rootFilled: [
|
|
2025
|
-
"h-refineui-control-height-md min-h-refineui-control-height-md",
|
|
2026
|
-
"rounded-refineui-x-large px-refineui-size-large",
|
|
2027
2052
|
"border-refineui-thin border-transparent",
|
|
2028
2053
|
/** Same soft plate as InputOTP slots */
|
|
2029
|
-
"bg-refineui-alias-background-surface-
|
|
2054
|
+
"bg-refineui-alias-background-surface-hover"
|
|
2030
2055
|
].join(" "),
|
|
2031
2056
|
rootPlain: [
|
|
2032
2057
|
"h-auto min-h-0 rounded-none border-none bg-transparent px-0 py-0"
|
|
@@ -2039,6 +2064,8 @@ var searchFieldStyles = {
|
|
|
2039
2064
|
clear: "inline-flex shrink-0 cursor-pointer items-center justify-center border-none bg-transparent p-0 leading-none text-refineui-alias-foreground-tertiary",
|
|
2040
2065
|
clearDisabled: "cursor-not-allowed text-refineui-alias-foreground-disabled"
|
|
2041
2066
|
};
|
|
2067
|
+
var searchFieldFilledSizeClass = formControlRowShellSizeClass;
|
|
2068
|
+
var searchFieldTypoClass = formControlTypoClass;
|
|
2042
2069
|
|
|
2043
2070
|
// src/components/SearchField/SearchField.tsx
|
|
2044
2071
|
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
@@ -2069,6 +2096,7 @@ function SearchField({
|
|
|
2069
2096
|
onValueChange,
|
|
2070
2097
|
disabled = false,
|
|
2071
2098
|
appearance = "filled",
|
|
2099
|
+
size: sizeProp,
|
|
2072
2100
|
className,
|
|
2073
2101
|
children,
|
|
2074
2102
|
id,
|
|
@@ -2076,6 +2104,8 @@ function SearchField({
|
|
|
2076
2104
|
"aria-label": ariaLabel = "Search",
|
|
2077
2105
|
...props
|
|
2078
2106
|
}) {
|
|
2107
|
+
const fieldSize = useOptionalFieldSize();
|
|
2108
|
+
const size = sizeProp ?? fieldSize ?? "md";
|
|
2079
2109
|
const [query, setQuery] = useControllableString(value, defaultValue, onValueChange);
|
|
2080
2110
|
const inputRef = (0, import_react4.useRef)(null);
|
|
2081
2111
|
const reactId = (0, import_react4.useId)();
|
|
@@ -2090,11 +2120,12 @@ function SearchField({
|
|
|
2090
2120
|
setValue: setQuery,
|
|
2091
2121
|
clear,
|
|
2092
2122
|
disabled,
|
|
2123
|
+
size,
|
|
2093
2124
|
inputId,
|
|
2094
2125
|
inputLabel: ariaLabel,
|
|
2095
2126
|
inputRef
|
|
2096
2127
|
}),
|
|
2097
|
-
[ariaLabel, clear, disabled, inputId, query, setQuery]
|
|
2128
|
+
[ariaLabel, clear, disabled, size, inputId, query, setQuery]
|
|
2098
2129
|
);
|
|
2099
2130
|
const handlePointerDown = (event) => {
|
|
2100
2131
|
onPointerDown?.(event);
|
|
@@ -2110,10 +2141,12 @@ function SearchField({
|
|
|
2110
2141
|
{
|
|
2111
2142
|
"data-refineui": "search-field",
|
|
2112
2143
|
"data-appearance": appearance,
|
|
2144
|
+
"data-size": size,
|
|
2113
2145
|
"data-disabled": disabled || void 0,
|
|
2114
2146
|
className: (0, import_clsx6.clsx)(
|
|
2115
2147
|
searchFieldStyles.root,
|
|
2116
|
-
|
|
2148
|
+
searchFieldTypoClass[size],
|
|
2149
|
+
appearance === "plain" ? searchFieldStyles.rootPlain : [searchFieldStyles.rootFilled, searchFieldFilledSizeClass[size]],
|
|
2117
2150
|
disabled && (appearance === "plain" ? searchFieldStyles.rootPlainDisabled : searchFieldStyles.rootDisabled),
|
|
2118
2151
|
className
|
|
2119
2152
|
),
|
|
@@ -2124,7 +2157,7 @@ function SearchField({
|
|
|
2124
2157
|
) });
|
|
2125
2158
|
}
|
|
2126
2159
|
function SearchFieldIcon({ children, className, ...props }) {
|
|
2127
|
-
const { disabled } = useSearchFieldContext("SearchFieldIcon");
|
|
2160
|
+
const { disabled, size } = useSearchFieldContext("SearchFieldIcon");
|
|
2128
2161
|
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
2129
2162
|
"span",
|
|
2130
2163
|
{
|
|
@@ -2140,7 +2173,7 @@ function SearchFieldIcon({ children, className, ...props }) {
|
|
|
2140
2173
|
WebIcon,
|
|
2141
2174
|
{
|
|
2142
2175
|
name: "search",
|
|
2143
|
-
size: searchFieldLeadingIconSize,
|
|
2176
|
+
size: searchFieldLeadingIconSize[size],
|
|
2144
2177
|
color: "currentColor",
|
|
2145
2178
|
"aria-hidden": true
|
|
2146
2179
|
}
|
|
@@ -2203,7 +2236,7 @@ function SearchFieldClear({
|
|
|
2203
2236
|
"aria-label": ariaLabel = "Clear search",
|
|
2204
2237
|
...props
|
|
2205
2238
|
}) {
|
|
2206
|
-
const { value, clear, disabled } = useSearchFieldContext("SearchFieldClear");
|
|
2239
|
+
const { value, clear, disabled, size } = useSearchFieldContext("SearchFieldClear");
|
|
2207
2240
|
const isDisabled = disabledProp ?? disabled;
|
|
2208
2241
|
if (value.length === 0) return null;
|
|
2209
2242
|
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
@@ -2228,7 +2261,7 @@ function SearchFieldClear({
|
|
|
2228
2261
|
WebIcon,
|
|
2229
2262
|
{
|
|
2230
2263
|
name: "dismiss",
|
|
2231
|
-
size: searchFieldClearIconSize,
|
|
2264
|
+
size: searchFieldClearIconSize[size],
|
|
2232
2265
|
color: "currentColor",
|
|
2233
2266
|
iconStyle: "filled",
|
|
2234
2267
|
"aria-hidden": true
|
|
@@ -2774,6 +2807,7 @@ var import_react9 = require("@refineui/utilities/react");
|
|
|
2774
2807
|
var import_clsx24 = require("clsx");
|
|
2775
2808
|
var import_tokens7 = require("@refineui/tokens");
|
|
2776
2809
|
var SCROLL_AREA_THUMB_MIN_PX = Number.parseFloat(import_tokens7.spacings.sizeXLarge);
|
|
2810
|
+
var SCROLL_EDGE_FALLOFF_RATIO = 0.25;
|
|
2777
2811
|
var scrollAreaStyles = {
|
|
2778
2812
|
root: "box-border min-h-0 min-w-0 overflow-hidden outline-none",
|
|
2779
2813
|
/**
|
|
@@ -2849,6 +2883,15 @@ function readMetrics(viewport) {
|
|
|
2849
2883
|
function isScrollable(metrics) {
|
|
2850
2884
|
return metrics.scrollSize > metrics.clientSize + 1;
|
|
2851
2885
|
}
|
|
2886
|
+
function resolveEdgeFactors(metrics) {
|
|
2887
|
+
const zone = metrics.clientSize * SCROLL_EDGE_FALLOFF_RATIO;
|
|
2888
|
+
if (!isScrollable(metrics) || zone <= 0) return { top: 0, bottom: 0 };
|
|
2889
|
+
const hiddenBelow = metrics.scrollSize - metrics.clientSize - metrics.scrollOffset;
|
|
2890
|
+
return {
|
|
2891
|
+
top: Math.min(1, Math.max(0, metrics.scrollOffset / zone)),
|
|
2892
|
+
bottom: Math.min(1, Math.max(0, hiddenBelow / zone))
|
|
2893
|
+
};
|
|
2894
|
+
}
|
|
2852
2895
|
function resolveThumbGeometry(metrics, trackSize, minThumb) {
|
|
2853
2896
|
if (trackSize <= 0 || metrics.scrollSize <= 0) {
|
|
2854
2897
|
return { thumbSize: 0, offset: 0 };
|
|
@@ -2869,6 +2912,8 @@ var ScrollArea = (0, import_react8.forwardRef)(function ScrollArea2({
|
|
|
2869
2912
|
children,
|
|
2870
2913
|
...props
|
|
2871
2914
|
}, ref) {
|
|
2915
|
+
const rootRef = (0, import_react8.useRef)(null);
|
|
2916
|
+
const composedRootRef = (0, import_react9.useComposedRefs)(rootRef, ref);
|
|
2872
2917
|
const viewportRef = (0, import_react8.useRef)(null);
|
|
2873
2918
|
const [viewportEpoch, setViewportEpoch] = (0, import_react8.useState)(0);
|
|
2874
2919
|
const [vertical, setVertical] = (0, import_react8.useState)(EMPTY_METRICS);
|
|
@@ -2896,6 +2941,12 @@ var ScrollArea = (0, import_react8.forwardRef)(function ScrollArea2({
|
|
|
2896
2941
|
const next = readMetrics(viewport);
|
|
2897
2942
|
setVertical(next.vertical);
|
|
2898
2943
|
setHorizontal(next.horizontal);
|
|
2944
|
+
const root = rootRef.current;
|
|
2945
|
+
if (root) {
|
|
2946
|
+
const edges = resolveEdgeFactors(next.vertical);
|
|
2947
|
+
root.style.setProperty("--refineui-scroll-edge-top", String(edges.top));
|
|
2948
|
+
root.style.setProperty("--refineui-scroll-edge-bottom", String(edges.bottom));
|
|
2949
|
+
}
|
|
2899
2950
|
}, []);
|
|
2900
2951
|
const markScrolling = (0, import_react8.useCallback)(() => {
|
|
2901
2952
|
setScrolling(true);
|
|
@@ -2962,7 +3013,7 @@ var ScrollArea = (0, import_react8.forwardRef)(function ScrollArea2({
|
|
|
2962
3013
|
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(ScrollAreaContext.Provider, { value: ctx, children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
2963
3014
|
"div",
|
|
2964
3015
|
{
|
|
2965
|
-
ref,
|
|
3016
|
+
ref: composedRootRef,
|
|
2966
3017
|
"data-refineui": "scroll-area",
|
|
2967
3018
|
"data-type": type,
|
|
2968
3019
|
"data-scrolling": scrolling || void 0,
|
|
@@ -3928,7 +3979,7 @@ function SelectGroup({ children, className, ...props }) {
|
|
|
3928
3979
|
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { role: "group", className: (0, import_clsx28.clsx)(selectStyles.group, className), ...props, children });
|
|
3929
3980
|
}
|
|
3930
3981
|
function SelectLabel({ children, className, ...props }) {
|
|
3931
|
-
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: (0, import_clsx28.clsx)(selectStyles.label, className), ...props, children });
|
|
3982
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { "data-scroll-edge-item": true, className: (0, import_clsx28.clsx)(selectStyles.label, className), ...props, children });
|
|
3932
3983
|
}
|
|
3933
3984
|
function SelectSeparator({ className, ...props }) {
|
|
3934
3985
|
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { role: "separator", className: (0, import_clsx28.clsx)(selectStyles.separator, className), ...props });
|
|
@@ -3975,6 +4026,7 @@ function SelectItem({
|
|
|
3975
4026
|
"aria-selected": isSelected,
|
|
3976
4027
|
"aria-disabled": disabled,
|
|
3977
4028
|
"data-refineui": "select-item",
|
|
4029
|
+
"data-scroll-edge-item": true,
|
|
3978
4030
|
"data-selected": isSelected ? true : void 0,
|
|
3979
4031
|
"data-state": pressed ? "pressed" : isSelected ? "selected" : void 0,
|
|
3980
4032
|
"data-highlighted": isHighlighted ? "" : void 0,
|
|
@@ -4225,7 +4277,6 @@ function Chip({
|
|
|
4225
4277
|
// src/components/Command/Command.tsx
|
|
4226
4278
|
var import_clsx34 = require("clsx");
|
|
4227
4279
|
var import_react15 = require("react");
|
|
4228
|
-
var import_tokens12 = require("@refineui/tokens");
|
|
4229
4280
|
|
|
4230
4281
|
// src/components/Dialog/Dialog.tsx
|
|
4231
4282
|
var import_clsx32 = require("clsx");
|
|
@@ -4552,34 +4603,42 @@ var import_clsx33 = require("clsx");
|
|
|
4552
4603
|
var import_tokens11 = require("@refineui/tokens");
|
|
4553
4604
|
var COMMAND_LIST_MAX_HEIGHT = `min(60vh, ${import_tokens11.foundationSizes.foundationSize3200})`;
|
|
4554
4605
|
var commandStyles = {
|
|
4555
|
-
|
|
4556
|
-
|
|
4557
|
-
|
|
4558
|
-
|
|
4559
|
-
"shadow-refineui-2"
|
|
4560
|
-
),
|
|
4561
|
-
/** Nested inside Dialog panel — Dialog already supplies radius / elevation */
|
|
4562
|
-
rootInDialog: "min-h-0 w-full flex-col overflow-hidden rounded-none border-none shadow-none",
|
|
4606
|
+
/** Detached layout: the search field and the results panel are separate surfaces, so the root has none. */
|
|
4607
|
+
root: "flex w-full flex-col gap-refineui-size-small text-refineui-alias-foreground-primary outline-none",
|
|
4608
|
+
rootInDialog: "min-h-0 w-full",
|
|
4609
|
+
/** Dialog panel stays transparent — the field and results panel float on the scrim themselves. */
|
|
4563
4610
|
dialogContentPanel: {
|
|
4564
4611
|
padding: 0,
|
|
4565
|
-
overflow: "
|
|
4612
|
+
overflow: "visible",
|
|
4613
|
+
backgroundColor: "transparent",
|
|
4614
|
+
boxShadow: "none",
|
|
4615
|
+
borderRadius: 0
|
|
4566
4616
|
},
|
|
4567
|
-
dialogBody: "flex min-h-0 w-full flex-col
|
|
4568
|
-
inputWrap: "shrink-0
|
|
4569
|
-
/**
|
|
4570
|
-
|
|
4617
|
+
dialogBody: "flex min-h-0 w-full flex-col",
|
|
4618
|
+
inputWrap: "shrink-0",
|
|
4619
|
+
/**
|
|
4620
|
+
* Results surface. Height is measured from the results (animated in refineui.css), capped by `maxHeight`.
|
|
4621
|
+
* Radius comes from `--refineui-command-list-radius` (per size, refineui.css) so the scrollbar inset can share it.
|
|
4622
|
+
*/
|
|
4623
|
+
listShell: (0, import_clsx33.clsx)(
|
|
4624
|
+
"box-border w-full overflow-hidden",
|
|
4625
|
+
"border-refineui-hairline border-refineui-alias-border-default",
|
|
4626
|
+
"bg-refineui-alias-background-primary shadow-refineui-2"
|
|
4627
|
+
),
|
|
4571
4628
|
list: "h-full min-h-0 w-full",
|
|
4572
|
-
|
|
4573
|
-
height: COMMAND_LIST_MAX_HEIGHT,
|
|
4629
|
+
listShellMaxHeight: {
|
|
4574
4630
|
maxHeight: COMMAND_LIST_MAX_HEIGHT
|
|
4575
4631
|
},
|
|
4576
4632
|
listViewport: "outline-none",
|
|
4577
|
-
listInner: "flex flex-col gap-refineui-size-xxx-small px-refineui-size-medium py-refineui-size-small",
|
|
4633
|
+
listInner: "relative flex flex-col gap-refineui-size-xxx-small px-refineui-size-medium py-refineui-size-small",
|
|
4634
|
+
/** Sliding highlight behind the selected item; geometry is measured, so physical `left`/`top` (inline) are intentional. */
|
|
4635
|
+
indicator: "pointer-events-none absolute rounded-refineui-large bg-refineui-alias-background-surface-hover",
|
|
4578
4636
|
empty: (0, import_clsx33.clsx)(
|
|
4579
4637
|
componentTextClass(componentTypographyTokens.command.empty),
|
|
4580
4638
|
"px-refineui-size-medium py-refineui-size-xx-large text-center text-refineui-alias-foreground-tertiary"
|
|
4581
4639
|
),
|
|
4582
|
-
|
|
4640
|
+
/** `overflow-clip`, not hidden: a hidden group would become the scroll container the edge effect tracks. */
|
|
4641
|
+
group: "flex flex-col gap-refineui-size-xxx-small overflow-clip",
|
|
4583
4642
|
groupHeading: (0, import_clsx33.clsx)(
|
|
4584
4643
|
componentTextClass(componentTypographyTokens.command.group),
|
|
4585
4644
|
"flex w-full items-center overflow-hidden px-refineui-size-x-small py-refineui-size-xxx-small text-refineui-alias-foreground-tertiary"
|
|
@@ -4587,9 +4646,8 @@ var commandStyles = {
|
|
|
4587
4646
|
separatorWrap: "flex w-full items-center px-refineui-size-x-small py-refineui-size-x-small",
|
|
4588
4647
|
separatorLine: "h-px w-full shrink-0 bg-refineui-alias-border-default",
|
|
4589
4648
|
itemBase: (0, import_clsx33.clsx)(
|
|
4590
|
-
|
|
4591
|
-
"
|
|
4592
|
-
"px-refineui-size-x-small py-refineui-size-small text-start outline-none"
|
|
4649
|
+
"relative flex w-full items-center gap-refineui-size-x-small rounded-refineui-large border-none bg-transparent",
|
|
4650
|
+
"px-refineui-size-x-small text-start outline-none"
|
|
4593
4651
|
),
|
|
4594
4652
|
itemDisabled: "cursor-not-allowed text-refineui-alias-foreground-disabled",
|
|
4595
4653
|
itemEnabled: "cursor-pointer text-refineui-alias-foreground-primary",
|
|
@@ -4601,6 +4659,16 @@ var commandStyles = {
|
|
|
4601
4659
|
"shrink-0 tracking-wide text-refineui-alias-foreground-tertiary"
|
|
4602
4660
|
)
|
|
4603
4661
|
};
|
|
4662
|
+
var commandItemSizeClass = {
|
|
4663
|
+
sm: (0, import_clsx33.clsx)(sizedComponentTextClass(componentTypographyTokens.command.item, "sm"), "py-refineui-size-xx-small"),
|
|
4664
|
+
md: (0, import_clsx33.clsx)(sizedComponentTextClass(componentTypographyTokens.command.item, "md"), "py-refineui-size-small"),
|
|
4665
|
+
lg: (0, import_clsx33.clsx)(sizedComponentTextClass(componentTypographyTokens.command.item, "lg"), "py-refineui-size-medium")
|
|
4666
|
+
};
|
|
4667
|
+
var commandItemIconSize = {
|
|
4668
|
+
sm: import_tokens11.iconSizes.xsmall,
|
|
4669
|
+
md: import_tokens11.iconSizes.small,
|
|
4670
|
+
lg: import_tokens11.iconSizes.medium
|
|
4671
|
+
};
|
|
4604
4672
|
|
|
4605
4673
|
// src/components/Command/Command.tsx
|
|
4606
4674
|
var import_jsx_runtime26 = require("react/jsx-runtime");
|
|
@@ -4636,6 +4704,7 @@ function useControllableString2(controlled, defaultValue, onChange) {
|
|
|
4636
4704
|
function Command({
|
|
4637
4705
|
children,
|
|
4638
4706
|
className,
|
|
4707
|
+
size = "md",
|
|
4639
4708
|
value,
|
|
4640
4709
|
defaultValue,
|
|
4641
4710
|
onValueChange,
|
|
@@ -4754,6 +4823,7 @@ function Command({
|
|
|
4754
4823
|
);
|
|
4755
4824
|
const ctx = (0, import_react15.useMemo)(
|
|
4756
4825
|
() => ({
|
|
4826
|
+
size,
|
|
4757
4827
|
search,
|
|
4758
4828
|
setSearch,
|
|
4759
4829
|
shouldFilter,
|
|
@@ -4771,6 +4841,7 @@ function Command({
|
|
|
4771
4841
|
groupHasVisibleItems
|
|
4772
4842
|
}),
|
|
4773
4843
|
[
|
|
4844
|
+
size,
|
|
4774
4845
|
search,
|
|
4775
4846
|
setSearch,
|
|
4776
4847
|
shouldFilter,
|
|
@@ -4792,6 +4863,7 @@ function Command({
|
|
|
4792
4863
|
"div",
|
|
4793
4864
|
{
|
|
4794
4865
|
"data-refineui": "command",
|
|
4866
|
+
"data-size": size,
|
|
4795
4867
|
role: "presentation",
|
|
4796
4868
|
className: (0, import_clsx34.clsx)(commandStyles.root, className),
|
|
4797
4869
|
onKeyDown: (event) => {
|
|
@@ -4843,17 +4915,19 @@ function CommandDialog({
|
|
|
4843
4915
|
Command,
|
|
4844
4916
|
{
|
|
4845
4917
|
...commandProps,
|
|
4918
|
+
size: commandProps?.size ?? "lg",
|
|
4846
4919
|
className: (0, import_clsx34.clsx)(commandStyles.rootInDialog, commandProps?.className),
|
|
4847
4920
|
children
|
|
4848
4921
|
}
|
|
4849
4922
|
) }) }) });
|
|
4850
4923
|
}
|
|
4851
4924
|
var CommandInput = (0, import_react15.forwardRef)(function CommandInput2({ className, startIcon, placeholder = "Type a command or search\u2026", disabled, onKeyDown, ...props }, ref) {
|
|
4852
|
-
const { search, setSearch, listId, label, selectedValue } = useCommandContext("CommandInput");
|
|
4925
|
+
const { size, search, setSearch, listId, label, selectedValue } = useCommandContext("CommandInput");
|
|
4853
4926
|
const activeDescendantId = selectedValue ? `${listId}-item-${cssEscape(selectedValue)}` : void 0;
|
|
4854
4927
|
return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { "data-refineui": "command-input", className: commandStyles.inputWrap, children: /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(
|
|
4855
4928
|
SearchField,
|
|
4856
4929
|
{
|
|
4930
|
+
size,
|
|
4857
4931
|
value: search,
|
|
4858
4932
|
onValueChange: setSearch,
|
|
4859
4933
|
disabled,
|
|
@@ -4882,14 +4956,90 @@ var CommandInput = (0, import_react15.forwardRef)(function CommandInput2({ class
|
|
|
4882
4956
|
}
|
|
4883
4957
|
) });
|
|
4884
4958
|
});
|
|
4959
|
+
var HIDDEN_INDICATOR = { top: 0, left: 0, width: 0, height: 0, ready: false };
|
|
4960
|
+
var SELECTED_ITEM_SELECTOR = '[data-refineui="command-item"][data-selected="true"]';
|
|
4961
|
+
function sameIndicatorBox(a, b) {
|
|
4962
|
+
return a.ready === b.ready && a.top === b.top && a.left === b.left && a.width === b.width && a.height === b.height;
|
|
4963
|
+
}
|
|
4885
4964
|
function CommandList({ className, children, ...props }) {
|
|
4886
|
-
const { listId } = useCommandContext("CommandList");
|
|
4965
|
+
const { listId, selectedValue, search, visibleCount } = useCommandContext("CommandList");
|
|
4966
|
+
const shellRef = (0, import_react15.useRef)(null);
|
|
4967
|
+
const innerRef = (0, import_react15.useRef)(null);
|
|
4968
|
+
const [contentHeight, setContentHeight] = (0, import_react15.useState)(null);
|
|
4969
|
+
const [indicator, setIndicator] = (0, import_react15.useState)(HIDDEN_INDICATOR);
|
|
4970
|
+
const [animate, setAnimate] = (0, import_react15.useState)(false);
|
|
4971
|
+
const [snap, setSnap] = (0, import_react15.useState)(false);
|
|
4972
|
+
const lastSearchRef = (0, import_react15.useRef)(search);
|
|
4973
|
+
const measure = (0, import_react15.useCallback)(() => {
|
|
4974
|
+
const inner = innerRef.current;
|
|
4975
|
+
const shell = shellRef.current;
|
|
4976
|
+
if (!inner || !shell) return;
|
|
4977
|
+
const shellStyle = getComputedStyle(shell);
|
|
4978
|
+
const height = inner.offsetHeight + parseFloat(shellStyle.borderTopWidth) + parseFloat(shellStyle.borderBottomWidth);
|
|
4979
|
+
setContentHeight((prev) => prev === height ? prev : height);
|
|
4980
|
+
const selected = inner.querySelector(SELECTED_ITEM_SELECTOR);
|
|
4981
|
+
setIndicator((prev) => {
|
|
4982
|
+
const next = selected ? {
|
|
4983
|
+
top: selected.offsetTop,
|
|
4984
|
+
left: selected.offsetLeft,
|
|
4985
|
+
width: selected.offsetWidth,
|
|
4986
|
+
height: selected.offsetHeight,
|
|
4987
|
+
ready: true
|
|
4988
|
+
} : { ...prev, ready: false };
|
|
4989
|
+
return sameIndicatorBox(prev, next) ? prev : next;
|
|
4990
|
+
});
|
|
4991
|
+
}, []);
|
|
4992
|
+
useIsomorphicLayoutEffect2(() => {
|
|
4993
|
+
if (lastSearchRef.current !== search) {
|
|
4994
|
+
lastSearchRef.current = search;
|
|
4995
|
+
setSnap(true);
|
|
4996
|
+
}
|
|
4997
|
+
measure();
|
|
4998
|
+
}, [measure, selectedValue, search, visibleCount, children]);
|
|
4999
|
+
(0, import_react15.useEffect)(() => {
|
|
5000
|
+
if (!snap) return;
|
|
5001
|
+
let raf2 = 0;
|
|
5002
|
+
const raf1 = requestAnimationFrame(() => {
|
|
5003
|
+
raf2 = requestAnimationFrame(() => setSnap(false));
|
|
5004
|
+
});
|
|
5005
|
+
return () => {
|
|
5006
|
+
cancelAnimationFrame(raf1);
|
|
5007
|
+
cancelAnimationFrame(raf2);
|
|
5008
|
+
};
|
|
5009
|
+
}, [snap]);
|
|
5010
|
+
(0, import_react15.useEffect)(() => {
|
|
5011
|
+
const inner = innerRef.current;
|
|
5012
|
+
if (!inner || typeof ResizeObserver === "undefined") return;
|
|
5013
|
+
const observer = new ResizeObserver(measure);
|
|
5014
|
+
observer.observe(inner);
|
|
5015
|
+
return () => observer.disconnect();
|
|
5016
|
+
}, [measure]);
|
|
5017
|
+
const measured = contentHeight !== null;
|
|
5018
|
+
(0, import_react15.useEffect)(() => {
|
|
5019
|
+
if (!measured || animate) return;
|
|
5020
|
+
let raf2 = 0;
|
|
5021
|
+
const raf1 = requestAnimationFrame(() => {
|
|
5022
|
+
raf2 = requestAnimationFrame(() => setAnimate(true));
|
|
5023
|
+
});
|
|
5024
|
+
return () => {
|
|
5025
|
+
cancelAnimationFrame(raf1);
|
|
5026
|
+
cancelAnimationFrame(raf2);
|
|
5027
|
+
};
|
|
5028
|
+
}, [measured, animate]);
|
|
5029
|
+
const indicatorStyle = {
|
|
5030
|
+
top: indicator.top,
|
|
5031
|
+
left: indicator.left,
|
|
5032
|
+
width: indicator.width,
|
|
5033
|
+
height: indicator.height
|
|
5034
|
+
};
|
|
4887
5035
|
return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
4888
5036
|
"div",
|
|
4889
5037
|
{
|
|
5038
|
+
ref: shellRef,
|
|
4890
5039
|
"data-refineui": "command-list",
|
|
5040
|
+
"data-animate": animate ? "true" : void 0,
|
|
4891
5041
|
className: commandStyles.listShell,
|
|
4892
|
-
style: commandStyles.
|
|
5042
|
+
style: { ...commandStyles.listShellMaxHeight, height: contentHeight ?? void 0 },
|
|
4893
5043
|
children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
4894
5044
|
ScrollAreaRegion,
|
|
4895
5045
|
{
|
|
@@ -4897,7 +5047,21 @@ function CommandList({ className, children, ...props }) {
|
|
|
4897
5047
|
className: (0, import_clsx34.clsx)(commandStyles.list, className),
|
|
4898
5048
|
viewportClassName: commandStyles.listViewport,
|
|
4899
5049
|
...props,
|
|
4900
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime26.
|
|
5050
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { ref: innerRef, id: listId, role: "listbox", className: commandStyles.listInner, children: [
|
|
5051
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
5052
|
+
"div",
|
|
5053
|
+
{
|
|
5054
|
+
"data-refineui": "command-indicator",
|
|
5055
|
+
"data-ready": indicator.ready ? "true" : void 0,
|
|
5056
|
+
"data-animate": animate && !snap ? "true" : void 0,
|
|
5057
|
+
"data-scroll-edge-item": true,
|
|
5058
|
+
"aria-hidden": true,
|
|
5059
|
+
className: commandStyles.indicator,
|
|
5060
|
+
style: indicatorStyle
|
|
5061
|
+
}
|
|
5062
|
+
),
|
|
5063
|
+
children
|
|
5064
|
+
] })
|
|
4901
5065
|
}
|
|
4902
5066
|
)
|
|
4903
5067
|
}
|
|
@@ -4942,6 +5106,7 @@ function CommandGroupHeading({ className, children, ...props }) {
|
|
|
4942
5106
|
"div",
|
|
4943
5107
|
{
|
|
4944
5108
|
"data-refineui": "command-group-heading",
|
|
5109
|
+
"data-scroll-edge-item": true,
|
|
4945
5110
|
className: (0, import_clsx34.clsx)(commandStyles.groupHeading, className),
|
|
4946
5111
|
...props,
|
|
4947
5112
|
children
|
|
@@ -5025,6 +5190,7 @@ var CommandItem = (0, import_react15.forwardRef)(function CommandItem2({
|
|
|
5025
5190
|
...props
|
|
5026
5191
|
}, forwardedRef) {
|
|
5027
5192
|
const {
|
|
5193
|
+
size,
|
|
5028
5194
|
selectedValue,
|
|
5029
5195
|
setSelectedValue,
|
|
5030
5196
|
listId,
|
|
@@ -5032,6 +5198,7 @@ var CommandItem = (0, import_react15.forwardRef)(function CommandItem2({
|
|
|
5032
5198
|
isItemVisible,
|
|
5033
5199
|
selectById
|
|
5034
5200
|
} = useCommandContext("CommandItem");
|
|
5201
|
+
const iconSize = commandItemIconSize[size];
|
|
5035
5202
|
const group = (0, import_react15.useContext)(CommandGroupContext);
|
|
5036
5203
|
const itemId = (0, import_react15.useId)();
|
|
5037
5204
|
const nodeRef = (0, import_react15.useRef)(null);
|
|
@@ -5075,11 +5242,13 @@ var CommandItem = (0, import_react15.forwardRef)(function CommandItem2({
|
|
|
5075
5242
|
"aria-selected": isSelected,
|
|
5076
5243
|
disabled,
|
|
5077
5244
|
"data-refineui": "command-item",
|
|
5245
|
+
"data-scroll-edge-item": true,
|
|
5078
5246
|
"data-state": disabled ? "disabled" : isSelected ? "active" : "default",
|
|
5079
5247
|
"data-selected": isSelected || void 0,
|
|
5080
5248
|
"data-disabled": disabled || void 0,
|
|
5081
5249
|
className: (0, import_clsx34.clsx)(
|
|
5082
5250
|
commandStyles.itemBase,
|
|
5251
|
+
commandItemSizeClass[size],
|
|
5083
5252
|
disabled ? commandStyles.itemDisabled : commandStyles.itemEnabled,
|
|
5084
5253
|
className
|
|
5085
5254
|
),
|
|
@@ -5099,9 +5268,9 @@ var CommandItem = (0, import_react15.forwardRef)(function CommandItem2({
|
|
|
5099
5268
|
{
|
|
5100
5269
|
className: commandStyles.iconWrap,
|
|
5101
5270
|
style: {
|
|
5102
|
-
width:
|
|
5103
|
-
minWidth:
|
|
5104
|
-
height:
|
|
5271
|
+
width: iconSize,
|
|
5272
|
+
minWidth: iconSize,
|
|
5273
|
+
height: iconSize
|
|
5105
5274
|
},
|
|
5106
5275
|
children: startIcon
|
|
5107
5276
|
}
|
|
@@ -5115,9 +5284,9 @@ var CommandItem = (0, import_react15.forwardRef)(function CommandItem2({
|
|
|
5115
5284
|
{
|
|
5116
5285
|
className: commandStyles.iconWrap,
|
|
5117
5286
|
style: {
|
|
5118
|
-
width:
|
|
5119
|
-
minWidth:
|
|
5120
|
-
height:
|
|
5287
|
+
width: iconSize,
|
|
5288
|
+
minWidth: iconSize,
|
|
5289
|
+
height: iconSize
|
|
5121
5290
|
},
|
|
5122
5291
|
children: endIcon
|
|
5123
5292
|
}
|
|
@@ -5137,7 +5306,7 @@ var import_react17 = require("react");
|
|
|
5137
5306
|
var import_color6 = require("@refineui/utilities/color");
|
|
5138
5307
|
|
|
5139
5308
|
// src/components/Avatar/avatarStyles.ts
|
|
5140
|
-
var
|
|
5309
|
+
var import_tokens12 = require("@refineui/tokens");
|
|
5141
5310
|
var import_color4 = require("@refineui/utilities/color");
|
|
5142
5311
|
var avatarSizeAliasMap = {
|
|
5143
5312
|
"3xs": "xxxsmall",
|
|
@@ -5202,15 +5371,15 @@ var avatarTypoNeutral = buildSemanticTextClassMap(
|
|
|
5202
5371
|
componentTypographyTokens.avatar.initialsNeutral
|
|
5203
5372
|
);
|
|
5204
5373
|
var avatarIconSlotSize = {
|
|
5205
|
-
xxxsmall:
|
|
5206
|
-
xxsmall:
|
|
5207
|
-
xsmall:
|
|
5208
|
-
small:
|
|
5209
|
-
medium:
|
|
5210
|
-
large:
|
|
5211
|
-
xlarge:
|
|
5212
|
-
xxlarge:
|
|
5213
|
-
xxxlarge:
|
|
5374
|
+
xxxsmall: import_tokens12.iconSizes.xxsmall,
|
|
5375
|
+
xxsmall: import_tokens12.iconSizes.xsmall,
|
|
5376
|
+
xsmall: import_tokens12.iconSizes.small,
|
|
5377
|
+
small: import_tokens12.iconSizes.small,
|
|
5378
|
+
medium: import_tokens12.iconSizes.medium,
|
|
5379
|
+
large: import_tokens12.iconSizes.medium,
|
|
5380
|
+
xlarge: import_tokens12.iconSizes.large,
|
|
5381
|
+
xxlarge: import_tokens12.iconSizes.xlarge,
|
|
5382
|
+
xxxlarge: import_tokens12.iconSizes.xxlarge
|
|
5214
5383
|
};
|
|
5215
5384
|
var AVATAR_INNER_MASK = "relative flex size-full min-h-0 min-w-0 items-center justify-center overflow-hidden rounded-refineui-circle";
|
|
5216
5385
|
function initialsAccentTypo(size) {
|
|
@@ -5278,15 +5447,15 @@ var defaultPersonIconColor = {
|
|
|
5278
5447
|
yellow: (0, import_color4.resolveColorTokenValue)(componentColorTokens.avatar.icon.yellow)
|
|
5279
5448
|
};
|
|
5280
5449
|
var avatarOverflowIconSize = {
|
|
5281
|
-
xxxsmall:
|
|
5282
|
-
xxsmall:
|
|
5283
|
-
xsmall:
|
|
5284
|
-
small:
|
|
5285
|
-
medium:
|
|
5286
|
-
large:
|
|
5287
|
-
xlarge:
|
|
5288
|
-
xxlarge:
|
|
5289
|
-
xxxlarge:
|
|
5450
|
+
xxxsmall: import_tokens12.iconSizes.xsmall,
|
|
5451
|
+
xxsmall: import_tokens12.iconSizes.xsmall,
|
|
5452
|
+
xsmall: import_tokens12.iconSizes.small,
|
|
5453
|
+
small: import_tokens12.iconSizes.small,
|
|
5454
|
+
medium: import_tokens12.iconSizes.medium,
|
|
5455
|
+
large: import_tokens12.iconSizes.medium,
|
|
5456
|
+
xlarge: import_tokens12.iconSizes.large,
|
|
5457
|
+
xxlarge: import_tokens12.iconSizes.xlarge,
|
|
5458
|
+
xxxlarge: import_tokens12.iconSizes.xxlarge
|
|
5290
5459
|
};
|
|
5291
5460
|
var avatarSpreadGap = {
|
|
5292
5461
|
xxxsmall: "gap-refineui-size-xx-small",
|
|
@@ -5692,7 +5861,7 @@ function Avatars({
|
|
|
5692
5861
|
|
|
5693
5862
|
// src/components/Alert/Alert.tsx
|
|
5694
5863
|
var import_clsx38 = require("clsx");
|
|
5695
|
-
var
|
|
5864
|
+
var import_tokens13 = require("@refineui/tokens");
|
|
5696
5865
|
|
|
5697
5866
|
// src/components/Alert/context.ts
|
|
5698
5867
|
var import_react18 = require("react");
|
|
@@ -5817,7 +5986,7 @@ function AlertIcon({ className, name, children, ...props }) {
|
|
|
5817
5986
|
"data-refineui": "alert-icon",
|
|
5818
5987
|
className: (0, import_clsx38.clsx)(resolveAlertSlotClasses("icon", variant), className),
|
|
5819
5988
|
...props,
|
|
5820
|
-
children: children ?? /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(WebIcon, { name: iconName, size:
|
|
5989
|
+
children: children ?? /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(WebIcon, { name: iconName, size: import_tokens13.iconSizes.medium, color: "currentColor", fallback: "\u25CF", "aria-hidden": true })
|
|
5821
5990
|
}
|
|
5822
5991
|
);
|
|
5823
5992
|
}
|
|
@@ -5894,7 +6063,7 @@ function AlertClose({ className, type = "button", children, ...props }) {
|
|
|
5894
6063
|
WebIcon,
|
|
5895
6064
|
{
|
|
5896
6065
|
name: "dismiss",
|
|
5897
|
-
size:
|
|
6066
|
+
size: import_tokens13.iconSizes.small,
|
|
5898
6067
|
color: "currentColor",
|
|
5899
6068
|
iconStyle: "regular",
|
|
5900
6069
|
fallback: "\xD7",
|
|
@@ -6963,14 +7132,14 @@ var import_clsx51 = require("clsx");
|
|
|
6963
7132
|
|
|
6964
7133
|
// src/components/Accordion/context.ts
|
|
6965
7134
|
var import_react23 = require("react");
|
|
6966
|
-
var
|
|
7135
|
+
var import_tokens14 = require("@refineui/tokens");
|
|
6967
7136
|
var import_animation2 = require("@refineui/utilities/animation");
|
|
6968
7137
|
var AccordionContext = (0, import_react23.createContext)(null);
|
|
6969
7138
|
var AccordionItemContext = (0, import_react23.createContext)(null);
|
|
6970
|
-
var PANEL_HEIGHT_MS = Number.parseFloat(
|
|
6971
|
-
var PANEL_CONTENT_MS = Number.parseFloat(
|
|
6972
|
-
var PANEL_HEIGHT_EASE =
|
|
6973
|
-
var PANEL_CONTENT_EASE =
|
|
7139
|
+
var PANEL_HEIGHT_MS = Number.parseFloat(import_tokens14.semanticInteraction.duration.accordionPanel) / 1e3;
|
|
7140
|
+
var PANEL_CONTENT_MS = Number.parseFloat(import_tokens14.semanticInteraction.duration.accordionContent) / 1e3;
|
|
7141
|
+
var PANEL_HEIGHT_EASE = import_tokens14.semanticInteraction.easing.panel;
|
|
7142
|
+
var PANEL_CONTENT_EASE = import_tokens14.semanticInteraction.easing.content;
|
|
6974
7143
|
function usePrefersReducedMotion() {
|
|
6975
7144
|
const [reduce, setReduce] = (0, import_react23.useState)(false);
|
|
6976
7145
|
(0, import_react23.useEffect)(() => {
|
|
@@ -6989,7 +7158,7 @@ function toSet(value, type) {
|
|
|
6989
7158
|
}
|
|
6990
7159
|
|
|
6991
7160
|
// src/recipes/accordion.recipe.ts
|
|
6992
|
-
var
|
|
7161
|
+
var import_tokens15 = require("@refineui/tokens");
|
|
6993
7162
|
var accordionRecipe = defineSlotRecipe({
|
|
6994
7163
|
name: "accordion",
|
|
6995
7164
|
slots: ["root", "item", "trigger", "triggerRow", "chevron", "panel", "panelPad", "content"],
|
|
@@ -7028,9 +7197,9 @@ var accordionStyles = {
|
|
|
7028
7197
|
panelBody: accordionRecipe.base.content
|
|
7029
7198
|
};
|
|
7030
7199
|
var accordionIconSize = {
|
|
7031
|
-
sm:
|
|
7032
|
-
md:
|
|
7033
|
-
lg:
|
|
7200
|
+
sm: import_tokens15.iconSizes.xsmall,
|
|
7201
|
+
md: import_tokens15.iconSizes.small,
|
|
7202
|
+
lg: import_tokens15.iconSizes.medium
|
|
7034
7203
|
};
|
|
7035
7204
|
var triggerTypo = {
|
|
7036
7205
|
sm: sizedComponentTextClass(componentTypographyTokens.accordion.trigger, "sm"),
|
|
@@ -7264,7 +7433,7 @@ function AccordionContent({ className, children, ...props }) {
|
|
|
7264
7433
|
// src/components/Breadcrumb/Breadcrumb.tsx
|
|
7265
7434
|
var import_clsx55 = require("clsx");
|
|
7266
7435
|
var import_react28 = require("react");
|
|
7267
|
-
var
|
|
7436
|
+
var import_tokens16 = require("@refineui/tokens");
|
|
7268
7437
|
|
|
7269
7438
|
// src/components/Breadcrumb/style.ts
|
|
7270
7439
|
var ellipsisChip = "box-border inline-flex min-h-refineui-button-min-height-sm min-w-refineui-button-min-height-sm shrink-0 items-center justify-center rounded-refineui-large p-refineui-size-xx-small leading-none";
|
|
@@ -7357,7 +7526,7 @@ function EllipsisIcon() {
|
|
|
7357
7526
|
WebIcon,
|
|
7358
7527
|
{
|
|
7359
7528
|
name: "more-horizontal",
|
|
7360
|
-
size:
|
|
7529
|
+
size: import_tokens16.iconSizes.small,
|
|
7361
7530
|
color: "currentColor",
|
|
7362
7531
|
fallback: "\u22EF",
|
|
7363
7532
|
className: "items-center justify-center"
|
|
@@ -7643,7 +7812,7 @@ function FooterSocial({ className, ...props }) {
|
|
|
7643
7812
|
// src/components/Calendar/Calendar.tsx
|
|
7644
7813
|
var import_clsx59 = require("clsx");
|
|
7645
7814
|
var import_react30 = require("react");
|
|
7646
|
-
var
|
|
7815
|
+
var import_tokens17 = require("@refineui/tokens");
|
|
7647
7816
|
|
|
7648
7817
|
// src/components/Calendar/style.ts
|
|
7649
7818
|
var import_clsx58 = require("clsx");
|
|
@@ -7972,7 +8141,7 @@ function Calendar({
|
|
|
7972
8141
|
"aria-label": "Previous month",
|
|
7973
8142
|
className: calendarStyles.navButton,
|
|
7974
8143
|
onClick: () => setView(new Date(year, month - 1)),
|
|
7975
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(WebIcon, { name: "chevron-left", size:
|
|
8144
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(WebIcon, { name: "chevron-left", size: import_tokens17.iconSizes.small, color: "currentColor", fallback: "\u2039" })
|
|
7976
8145
|
}
|
|
7977
8146
|
),
|
|
7978
8147
|
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
|
|
@@ -8012,7 +8181,7 @@ function Calendar({
|
|
|
8012
8181
|
"aria-label": "Next month",
|
|
8013
8182
|
className: calendarStyles.navButton,
|
|
8014
8183
|
onClick: () => setView(new Date(year, month + 1)),
|
|
8015
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(WebIcon, { name: "chevron-right", size:
|
|
8184
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(WebIcon, { name: "chevron-right", size: import_tokens17.iconSizes.small, color: "currentColor", fallback: "\u203A" })
|
|
8016
8185
|
}
|
|
8017
8186
|
)
|
|
8018
8187
|
] }),
|
|
@@ -8446,7 +8615,7 @@ function Spacer({ className, ...props }) {
|
|
|
8446
8615
|
var import_clsx68 = require("clsx");
|
|
8447
8616
|
var import_react31 = require("react");
|
|
8448
8617
|
var import_react_dom3 = require("react-dom");
|
|
8449
|
-
var
|
|
8618
|
+
var import_tokens18 = require("@refineui/tokens");
|
|
8450
8619
|
var import_animation3 = require("@refineui/utilities/animation");
|
|
8451
8620
|
var import_color7 = require("@refineui/utilities/color");
|
|
8452
8621
|
var import_react32 = require("@refineui/utilities/react");
|
|
@@ -8487,9 +8656,9 @@ var drawerStyles = {
|
|
|
8487
8656
|
|
|
8488
8657
|
// src/components/Drawer/Drawer.tsx
|
|
8489
8658
|
var import_jsx_runtime52 = require("react/jsx-runtime");
|
|
8490
|
-
var PANEL_MS2 = (0, import_animation3.motionMsToNumber)(
|
|
8491
|
-
var SCRIM_MS2 = (0, import_animation3.motionMsToNumber)(
|
|
8492
|
-
var EASING2 =
|
|
8659
|
+
var PANEL_MS2 = (0, import_animation3.motionMsToNumber)(import_tokens18.semanticInteraction.duration.panel);
|
|
8660
|
+
var SCRIM_MS2 = (0, import_animation3.motionMsToNumber)(import_tokens18.semanticInteraction.duration.overlay);
|
|
8661
|
+
var EASING2 = import_tokens18.semanticInteraction.easing.panel;
|
|
8493
8662
|
var DrawerContext = (0, import_react31.createContext)(null);
|
|
8494
8663
|
function useDrawerContext(component) {
|
|
8495
8664
|
const ctx = (0, import_react31.useContext)(DrawerContext);
|
|
@@ -8799,7 +8968,7 @@ function DrawerFooter({ className, ...props }) {
|
|
|
8799
8968
|
var import_clsx70 = require("clsx");
|
|
8800
8969
|
var import_react34 = require("react");
|
|
8801
8970
|
var import_react_dom4 = require("react-dom");
|
|
8802
|
-
var
|
|
8971
|
+
var import_tokens19 = require("@refineui/tokens");
|
|
8803
8972
|
var import_color8 = require("@refineui/utilities/color");
|
|
8804
8973
|
|
|
8805
8974
|
// src/components/Dropdown/style.ts
|
|
@@ -9072,9 +9241,9 @@ function DropdownContent({
|
|
|
9072
9241
|
const { open, setOpen, close, triggerRef, menuRef, menuId } = useDropdownRoot("DropdownContent");
|
|
9073
9242
|
const [fixedStyle, setFixedStyle] = (0, import_react34.useState)(null);
|
|
9074
9243
|
const [menuSide, setMenuSide] = (0, import_react34.useState)("bottom");
|
|
9075
|
-
const gapPx = sideOffset ?? parseCssPxLen(
|
|
9244
|
+
const gapPx = sideOffset ?? parseCssPxLen(import_tokens19.spacings.sizeXXSmall, 4);
|
|
9076
9245
|
const defaultMenuW = parseCssPxLen(import_tokens3.componentSizes.dropdownMenuWidth, 180);
|
|
9077
|
-
const z = Number.parseInt(String(
|
|
9246
|
+
const z = Number.parseInt(String(import_tokens19.zIndex.zIndexMessages), 10) || 1e4;
|
|
9078
9247
|
useIsomorphicLayoutEffect3(() => {
|
|
9079
9248
|
if (!open) {
|
|
9080
9249
|
setFixedStyle(null);
|
|
@@ -9179,6 +9348,7 @@ function DropdownLabel({ className, ...props }) {
|
|
|
9179
9348
|
{
|
|
9180
9349
|
role: "presentation",
|
|
9181
9350
|
"data-refineui": "dropdown-menu-label",
|
|
9351
|
+
"data-scroll-edge-item": true,
|
|
9182
9352
|
className: (0, import_clsx70.clsx)(dropdownStyles.label, className),
|
|
9183
9353
|
...props
|
|
9184
9354
|
}
|
|
@@ -9208,6 +9378,7 @@ function DropdownItem({
|
|
|
9208
9378
|
type: "button",
|
|
9209
9379
|
role: "menuitem",
|
|
9210
9380
|
"data-refineui": "dropdown-item",
|
|
9381
|
+
"data-scroll-edge-item": true,
|
|
9211
9382
|
"data-selected": selected || void 0,
|
|
9212
9383
|
"data-state": pressed ? "pressed" : selected ? "selected" : void 0,
|
|
9213
9384
|
disabled,
|
|
@@ -9385,6 +9556,7 @@ function DropdownSubTrigger({
|
|
|
9385
9556
|
"aria-expanded": open,
|
|
9386
9557
|
disabled: isDisabled,
|
|
9387
9558
|
"data-refineui": "dropdown-item",
|
|
9559
|
+
"data-scroll-edge-item": true,
|
|
9388
9560
|
"data-slot": "dropdown-menu-sub-trigger",
|
|
9389
9561
|
tabIndex: -1,
|
|
9390
9562
|
className: (0, import_clsx70.clsx)(
|
|
@@ -9422,7 +9594,7 @@ function DropdownSubTrigger({
|
|
|
9422
9594
|
WebIcon,
|
|
9423
9595
|
{
|
|
9424
9596
|
name: "chevron-right",
|
|
9425
|
-
size:
|
|
9597
|
+
size: import_tokens19.iconSizes.small,
|
|
9426
9598
|
color: "currentColor",
|
|
9427
9599
|
"aria-hidden": true,
|
|
9428
9600
|
className: "ms-auto shrink-0"
|
|
@@ -9439,7 +9611,7 @@ function DropdownSubContent({ className, children, style, ...props }) {
|
|
|
9439
9611
|
const [fixedStyle, setFixedStyle] = (0, import_react34.useState)(null);
|
|
9440
9612
|
const [side, setSide] = (0, import_react34.useState)("right");
|
|
9441
9613
|
const defaultMenuW = parseCssPxLen(import_tokens3.componentSizes.dropdownMenuWidth, 180);
|
|
9442
|
-
const gapPx = parseCssPxLen(
|
|
9614
|
+
const gapPx = parseCssPxLen(import_tokens19.spacings.sizeXXXSmall, 2);
|
|
9443
9615
|
const setPanelEl = (0, import_react34.useCallback)(
|
|
9444
9616
|
(el) => {
|
|
9445
9617
|
panelRef.current = el;
|
|
@@ -9477,7 +9649,7 @@ function DropdownSubContent({ className, children, style, ...props }) {
|
|
|
9477
9649
|
top: pos.top,
|
|
9478
9650
|
left: pos.left,
|
|
9479
9651
|
minWidth: import_tokens3.componentSizes.dropdownMenuWidth,
|
|
9480
|
-
zIndex: (Number.parseInt(String(
|
|
9652
|
+
zIndex: (Number.parseInt(String(import_tokens19.zIndex.zIndexMessages), 10) || 1e4) + 100,
|
|
9481
9653
|
maxHeight: "min(60vh, 20rem)"
|
|
9482
9654
|
});
|
|
9483
9655
|
};
|
|
@@ -9630,7 +9802,7 @@ function FieldError({ className, ...props }) {
|
|
|
9630
9802
|
|
|
9631
9803
|
// src/components/Link/Link.tsx
|
|
9632
9804
|
var import_clsx74 = require("clsx");
|
|
9633
|
-
var
|
|
9805
|
+
var import_tokens20 = require("@refineui/tokens");
|
|
9634
9806
|
|
|
9635
9807
|
// src/components/Link/style.ts
|
|
9636
9808
|
var linkStyles = {
|
|
@@ -9668,7 +9840,7 @@ function Link({
|
|
|
9668
9840
|
...props,
|
|
9669
9841
|
children: [
|
|
9670
9842
|
children,
|
|
9671
|
-
showOpen && /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(WebIcon, { name: "open", size:
|
|
9843
|
+
showOpen && /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(WebIcon, { name: "open", size: import_tokens20.iconSizes.large, color: "currentColor" })
|
|
9672
9844
|
]
|
|
9673
9845
|
}
|
|
9674
9846
|
);
|
|
@@ -9678,7 +9850,7 @@ function Link({
|
|
|
9678
9850
|
var import_clsx76 = require("clsx");
|
|
9679
9851
|
var import_react36 = require("react");
|
|
9680
9852
|
var import_react_dom5 = require("react-dom");
|
|
9681
|
-
var
|
|
9853
|
+
var import_tokens21 = require("@refineui/tokens");
|
|
9682
9854
|
var import_animation4 = require("@refineui/utilities/animation");
|
|
9683
9855
|
var import_react37 = require("@refineui/utilities/react");
|
|
9684
9856
|
|
|
@@ -9808,8 +9980,8 @@ function MenuPopover({ className, children, style, ...props }) {
|
|
|
9808
9980
|
const [shouldRender, setShouldRender] = (0, import_react36.useState)(open);
|
|
9809
9981
|
const [isClosing, setIsClosing] = (0, import_react36.useState)(false);
|
|
9810
9982
|
const [fixedStyle, setFixedStyle] = (0, import_react36.useState)(null);
|
|
9811
|
-
const gapPx = parseCssPx(
|
|
9812
|
-
const z = Number.parseInt(String(
|
|
9983
|
+
const gapPx = parseCssPx(import_tokens21.spacings.sizeXXSmall, 4);
|
|
9984
|
+
const z = Number.parseInt(String(import_tokens21.zIndex.zIndexMessages), 10) || 1e4;
|
|
9813
9985
|
(0, import_react36.useEffect)(() => {
|
|
9814
9986
|
if (open) {
|
|
9815
9987
|
setShouldRender(true);
|
|
@@ -9824,7 +9996,7 @@ function MenuPopover({ className, children, style, ...props }) {
|
|
|
9824
9996
|
setShouldRender(false);
|
|
9825
9997
|
setIsClosing(false);
|
|
9826
9998
|
setFixedStyle(null);
|
|
9827
|
-
}, (0, import_animation4.motionMsToNumber)(
|
|
9999
|
+
}, (0, import_animation4.motionMsToNumber)(import_tokens21.semanticInteraction.duration.normal));
|
|
9828
10000
|
return () => window.clearTimeout(timeout);
|
|
9829
10001
|
}, [open, shouldRender]);
|
|
9830
10002
|
useIsomorphicLayoutEffect4(() => {
|
|
@@ -9964,9 +10136,9 @@ function MenuItem({
|
|
|
9964
10136
|
{
|
|
9965
10137
|
className: menuStyles.iconWrap,
|
|
9966
10138
|
style: {
|
|
9967
|
-
width:
|
|
9968
|
-
minWidth:
|
|
9969
|
-
height:
|
|
10139
|
+
width: import_tokens21.iconSizes.small,
|
|
10140
|
+
minWidth: import_tokens21.iconSizes.small,
|
|
10141
|
+
height: import_tokens21.iconSizes.small
|
|
9970
10142
|
},
|
|
9971
10143
|
children: startIcon
|
|
9972
10144
|
}
|
|
@@ -9991,9 +10163,9 @@ function MenuItem({
|
|
|
9991
10163
|
{
|
|
9992
10164
|
className: menuStyles.iconWrap,
|
|
9993
10165
|
style: {
|
|
9994
|
-
width:
|
|
9995
|
-
minWidth:
|
|
9996
|
-
height:
|
|
10166
|
+
width: import_tokens21.iconSizes.small,
|
|
10167
|
+
minWidth: import_tokens21.iconSizes.small,
|
|
10168
|
+
height: import_tokens21.iconSizes.small
|
|
9997
10169
|
},
|
|
9998
10170
|
children: endIcon
|
|
9999
10171
|
}
|
|
@@ -10145,9 +10317,9 @@ function MenuSubTrigger({
|
|
|
10145
10317
|
{
|
|
10146
10318
|
className: menuStyles.iconWrap,
|
|
10147
10319
|
style: {
|
|
10148
|
-
width:
|
|
10149
|
-
minWidth:
|
|
10150
|
-
height:
|
|
10320
|
+
width: import_tokens21.iconSizes.small,
|
|
10321
|
+
minWidth: import_tokens21.iconSizes.small,
|
|
10322
|
+
height: import_tokens21.iconSizes.small
|
|
10151
10323
|
},
|
|
10152
10324
|
children: startIcon
|
|
10153
10325
|
}
|
|
@@ -10170,11 +10342,11 @@ function MenuSubTrigger({
|
|
|
10170
10342
|
{
|
|
10171
10343
|
className: menuStyles.iconWrap,
|
|
10172
10344
|
style: {
|
|
10173
|
-
width:
|
|
10174
|
-
minWidth:
|
|
10175
|
-
height:
|
|
10345
|
+
width: import_tokens21.iconSizes.small,
|
|
10346
|
+
minWidth: import_tokens21.iconSizes.small,
|
|
10347
|
+
height: import_tokens21.iconSizes.small
|
|
10176
10348
|
},
|
|
10177
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(WebIcon, { name: "chevron-right", size:
|
|
10349
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(WebIcon, { name: "chevron-right", size: import_tokens21.iconSizes.small, color: "currentColor", "aria-hidden": true })
|
|
10178
10350
|
}
|
|
10179
10351
|
) })
|
|
10180
10352
|
] })
|
|
@@ -10187,8 +10359,8 @@ function MenuSubContent({ className, children, style, ...props }) {
|
|
|
10187
10359
|
const panelRef = (0, import_react36.useRef)(null);
|
|
10188
10360
|
const [fixedStyle, setFixedStyle] = (0, import_react36.useState)(null);
|
|
10189
10361
|
const [side, setSide] = (0, import_react36.useState)("right");
|
|
10190
|
-
const gapPx = parseCssPx(
|
|
10191
|
-
const z = (Number.parseInt(String(
|
|
10362
|
+
const gapPx = parseCssPx(import_tokens21.spacings.sizeXXXSmall, 2);
|
|
10363
|
+
const z = (Number.parseInt(String(import_tokens21.zIndex.zIndexMessages), 10) || 1e4) + 100;
|
|
10192
10364
|
const defaultW = parseCssPx(import_tokens3.componentSizes.menuPanelWidth, 200);
|
|
10193
10365
|
const setPanelEl = (0, import_react36.useCallback)(
|
|
10194
10366
|
(el) => {
|
|
@@ -10288,7 +10460,7 @@ function MenuSubContent({ className, children, style, ...props }) {
|
|
|
10288
10460
|
var import_clsx78 = require("clsx");
|
|
10289
10461
|
var import_react38 = require("react");
|
|
10290
10462
|
var import_react_dom6 = require("react-dom");
|
|
10291
|
-
var
|
|
10463
|
+
var import_tokens22 = require("@refineui/tokens");
|
|
10292
10464
|
var import_animation5 = require("@refineui/utilities/animation");
|
|
10293
10465
|
|
|
10294
10466
|
// src/components/NavigationMenu/style.ts
|
|
@@ -10387,8 +10559,8 @@ function NavigationMenu({
|
|
|
10387
10559
|
const openTimerRef = (0, import_react38.useRef)(null);
|
|
10388
10560
|
const closeTimerRef = (0, import_react38.useRef)(null);
|
|
10389
10561
|
const rootRef = (0, import_react38.useRef)(null);
|
|
10390
|
-
const delayDuration = delayDurationProp ?? (0, import_animation5.motionMsToNumber)(
|
|
10391
|
-
const skipDelayDuration = skipDelayDurationProp ?? (0, import_animation5.motionMsToNumber)(
|
|
10562
|
+
const delayDuration = delayDurationProp ?? (0, import_animation5.motionMsToNumber)(import_tokens22.semanticInteraction.duration.normal);
|
|
10563
|
+
const skipDelayDuration = skipDelayDurationProp ?? (0, import_animation5.motionMsToNumber)(import_tokens22.semanticInteraction.duration.fast);
|
|
10392
10564
|
const clearTimers = (0, import_react38.useCallback)(() => {
|
|
10393
10565
|
if (openTimerRef.current != null) {
|
|
10394
10566
|
window.clearTimeout(openTimerRef.current);
|
|
@@ -10665,7 +10837,7 @@ function NavigationMenuTrigger({
|
|
|
10665
10837
|
WebIcon,
|
|
10666
10838
|
{
|
|
10667
10839
|
name: "chevron-down",
|
|
10668
|
-
size:
|
|
10840
|
+
size: import_tokens22.iconSizes.xsmall,
|
|
10669
10841
|
color: "currentColor",
|
|
10670
10842
|
className: (0, import_clsx78.clsx)(
|
|
10671
10843
|
navigationMenuStyles.chevron,
|
|
@@ -10708,7 +10880,7 @@ function NavigationMenuContent({
|
|
|
10708
10880
|
const timeout = window.setTimeout(() => {
|
|
10709
10881
|
setShouldRender(false);
|
|
10710
10882
|
setIsClosing(false);
|
|
10711
|
-
}, (0, import_animation5.motionMsToNumber)(
|
|
10883
|
+
}, (0, import_animation5.motionMsToNumber)(import_tokens22.semanticInteraction.duration.fast));
|
|
10712
10884
|
return () => window.clearTimeout(timeout);
|
|
10713
10885
|
}, [item.open, shouldRender]);
|
|
10714
10886
|
useIsomorphicLayoutEffect5(() => {
|
|
@@ -10720,7 +10892,7 @@ function NavigationMenuContent({
|
|
|
10720
10892
|
if (!content2) return;
|
|
10721
10893
|
const triggerRect = trigger.getBoundingClientRect();
|
|
10722
10894
|
const contentWidth = content2.offsetWidth;
|
|
10723
|
-
const edge = Number.parseFloat(
|
|
10895
|
+
const edge = Number.parseFloat(import_tokens22.spacings.sizeMedium) || 8;
|
|
10724
10896
|
const left = Math.max(
|
|
10725
10897
|
edge,
|
|
10726
10898
|
Math.min(triggerRect.left, window.innerWidth - contentWidth - edge)
|
|
@@ -10729,7 +10901,7 @@ function NavigationMenuContent({
|
|
|
10729
10901
|
position: "fixed",
|
|
10730
10902
|
top: triggerRect.bottom,
|
|
10731
10903
|
left,
|
|
10732
|
-
zIndex: Number.parseInt(String(
|
|
10904
|
+
zIndex: Number.parseInt(String(import_tokens22.zIndex.zIndexMessages), 10) || 1e4
|
|
10733
10905
|
});
|
|
10734
10906
|
};
|
|
10735
10907
|
updatePosition();
|
|
@@ -10871,6 +11043,7 @@ function NavigationMenuIndicator({ className, style, ...props }) {
|
|
|
10871
11043
|
|
|
10872
11044
|
// src/components/Sidebar/Sidebar.tsx
|
|
10873
11045
|
var import_clsx80 = require("clsx");
|
|
11046
|
+
var import_react39 = require("react");
|
|
10874
11047
|
|
|
10875
11048
|
// src/components/Sidebar/style.ts
|
|
10876
11049
|
var import_clsx79 = require("clsx");
|
|
@@ -10889,7 +11062,9 @@ var sidebarStyles = {
|
|
|
10889
11062
|
componentTextClass(componentTypographyTokens.sidebar.brand),
|
|
10890
11063
|
"m-0 flex min-w-0 items-center gap-refineui-size-small text-refineui-alias-foreground-primary"
|
|
10891
11064
|
),
|
|
10892
|
-
|
|
11065
|
+
/** Scrolls through a built-in ScrollArea; padding sits inside the viewport so rows scroll under the edges. */
|
|
11066
|
+
content: "flex min-h-0 flex-1 flex-col",
|
|
11067
|
+
contentViewport: "box-border px-refineui-size-medium py-refineui-size-medium",
|
|
10893
11068
|
nav: "flex min-h-0 flex-col gap-refineui-size-x-large",
|
|
10894
11069
|
group: "flex min-w-0 flex-col gap-refineui-size-xx-small",
|
|
10895
11070
|
groupLabel: (0, import_clsx79.clsx)(
|
|
@@ -10914,6 +11089,7 @@ var sidebarStyles = {
|
|
|
10914
11089
|
|
|
10915
11090
|
// src/components/Sidebar/Sidebar.tsx
|
|
10916
11091
|
var import_jsx_runtime60 = require("react/jsx-runtime");
|
|
11092
|
+
var SidebarScrollContext = (0, import_react39.createContext)(false);
|
|
10917
11093
|
function Sidebar({ className, ...props }) {
|
|
10918
11094
|
return /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
|
|
10919
11095
|
"aside",
|
|
@@ -10944,13 +11120,14 @@ function SidebarBrand({ className, ...props }) {
|
|
|
10944
11120
|
}
|
|
10945
11121
|
);
|
|
10946
11122
|
}
|
|
10947
|
-
function SidebarContent({ className, ...props }) {
|
|
11123
|
+
function SidebarContent({ className, children, ...props }) {
|
|
10948
11124
|
return /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
|
|
10949
11125
|
"div",
|
|
10950
11126
|
{
|
|
10951
11127
|
"data-refineui": "sidebar-content",
|
|
10952
11128
|
className: (0, import_clsx80.clsx)(sidebarStyles.content, className),
|
|
10953
|
-
...props
|
|
11129
|
+
...props,
|
|
11130
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(ScrollAreaRegion, { type: "hover", viewportClassName: sidebarStyles.contentViewport, children: /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(SidebarScrollContext.Provider, { value: true, children }) })
|
|
10954
11131
|
}
|
|
10955
11132
|
);
|
|
10956
11133
|
}
|
|
@@ -10976,10 +11153,12 @@ function SidebarGroup({ className, ...props }) {
|
|
|
10976
11153
|
);
|
|
10977
11154
|
}
|
|
10978
11155
|
function SidebarGroupLabel({ className, ...props }) {
|
|
11156
|
+
const inScroll = (0, import_react39.useContext)(SidebarScrollContext);
|
|
10979
11157
|
return /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
|
|
10980
11158
|
"p",
|
|
10981
11159
|
{
|
|
10982
11160
|
"data-refineui": "sidebar-group-label",
|
|
11161
|
+
"data-scroll-edge-item": inScroll || void 0,
|
|
10983
11162
|
className: (0, import_clsx80.clsx)(sidebarStyles.groupLabel, className),
|
|
10984
11163
|
...props
|
|
10985
11164
|
}
|
|
@@ -10992,10 +11171,12 @@ function SidebarLink({
|
|
|
10992
11171
|
...props
|
|
10993
11172
|
}) {
|
|
10994
11173
|
const disabled = ariaDisabled === true || ariaDisabled === "true";
|
|
11174
|
+
const inScroll = (0, import_react39.useContext)(SidebarScrollContext);
|
|
10995
11175
|
return /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
|
|
10996
11176
|
"a",
|
|
10997
11177
|
{
|
|
10998
11178
|
"data-refineui": "sidebar-link",
|
|
11179
|
+
"data-scroll-edge-item": inScroll || void 0,
|
|
10999
11180
|
"data-active": active || void 0,
|
|
11000
11181
|
"aria-current": active ? "page" : void 0,
|
|
11001
11182
|
"aria-disabled": disabled || void 0,
|
|
@@ -11023,8 +11204,8 @@ function SidebarFooter({ className, ...props }) {
|
|
|
11023
11204
|
|
|
11024
11205
|
// src/components/Sidebar/SidebarPeek.tsx
|
|
11025
11206
|
var import_clsx82 = require("clsx");
|
|
11026
|
-
var
|
|
11027
|
-
var
|
|
11207
|
+
var import_react40 = require("react");
|
|
11208
|
+
var import_tokens23 = require("@refineui/tokens");
|
|
11028
11209
|
var import_animation6 = require("@refineui/utilities/animation");
|
|
11029
11210
|
|
|
11030
11211
|
// src/components/Sidebar/peekStyle.ts
|
|
@@ -11050,12 +11231,12 @@ var sidebarPeekStyles = {
|
|
|
11050
11231
|
|
|
11051
11232
|
// src/components/Sidebar/SidebarPeek.tsx
|
|
11052
11233
|
var import_jsx_runtime61 = require("react/jsx-runtime");
|
|
11053
|
-
var PEEK_OPEN_DELAY_MS = (0, import_animation6.motionMsToNumber)(
|
|
11054
|
-
var PEEK_CLOSE_DELAY_MS = (0, import_animation6.motionMsToNumber)(
|
|
11055
|
-
var PEEK_BRIDGE_DELAY_MS = (0, import_animation6.motionMsToNumber)(
|
|
11056
|
-
var SidebarPeekContext = (0,
|
|
11234
|
+
var PEEK_OPEN_DELAY_MS = (0, import_animation6.motionMsToNumber)(import_tokens23.semanticInteraction.duration.medium);
|
|
11235
|
+
var PEEK_CLOSE_DELAY_MS = (0, import_animation6.motionMsToNumber)(import_tokens23.semanticInteraction.duration.medium);
|
|
11236
|
+
var PEEK_BRIDGE_DELAY_MS = (0, import_animation6.motionMsToNumber)(import_tokens23.semanticInteraction.duration.slow);
|
|
11237
|
+
var SidebarPeekContext = (0, import_react40.createContext)(null);
|
|
11057
11238
|
function useSidebarPeekContext(component) {
|
|
11058
|
-
const ctx = (0,
|
|
11239
|
+
const ctx = (0, import_react40.useContext)(SidebarPeekContext);
|
|
11059
11240
|
if (!ctx) throw new Error(`${component} must be used within <SidebarPeek>.`);
|
|
11060
11241
|
return ctx;
|
|
11061
11242
|
}
|
|
@@ -11069,38 +11250,38 @@ function SidebarPeek({
|
|
|
11069
11250
|
children,
|
|
11070
11251
|
...props
|
|
11071
11252
|
}) {
|
|
11072
|
-
const rootRef = (0,
|
|
11073
|
-
const widthPercentRef = (0,
|
|
11253
|
+
const rootRef = (0, import_react40.useRef)(null);
|
|
11254
|
+
const widthPercentRef = (0, import_react40.useRef)(widthPercent);
|
|
11074
11255
|
widthPercentRef.current = widthPercent;
|
|
11075
|
-
const [peekOpen, setPeekOpen] = (0,
|
|
11076
|
-
const [flyoutWidthPx, setFlyoutWidthPx] = (0,
|
|
11077
|
-
const peekOpenTimerRef = (0,
|
|
11078
|
-
const peekCloseTimerRef = (0,
|
|
11079
|
-
const clearPeekOpenTimer = (0,
|
|
11256
|
+
const [peekOpen, setPeekOpen] = (0, import_react40.useState)(false);
|
|
11257
|
+
const [flyoutWidthPx, setFlyoutWidthPx] = (0, import_react40.useState)();
|
|
11258
|
+
const peekOpenTimerRef = (0, import_react40.useRef)(null);
|
|
11259
|
+
const peekCloseTimerRef = (0, import_react40.useRef)(null);
|
|
11260
|
+
const clearPeekOpenTimer = (0, import_react40.useCallback)(() => {
|
|
11080
11261
|
if (peekOpenTimerRef.current != null) {
|
|
11081
11262
|
window.clearTimeout(peekOpenTimerRef.current);
|
|
11082
11263
|
peekOpenTimerRef.current = null;
|
|
11083
11264
|
}
|
|
11084
11265
|
}, []);
|
|
11085
|
-
const clearPeekCloseTimer = (0,
|
|
11266
|
+
const clearPeekCloseTimer = (0, import_react40.useCallback)(() => {
|
|
11086
11267
|
if (peekCloseTimerRef.current != null) {
|
|
11087
11268
|
window.clearTimeout(peekCloseTimerRef.current);
|
|
11088
11269
|
peekCloseTimerRef.current = null;
|
|
11089
11270
|
}
|
|
11090
11271
|
}, []);
|
|
11091
|
-
const closePeekImmediate = (0,
|
|
11272
|
+
const closePeekImmediate = (0, import_react40.useCallback)(() => {
|
|
11092
11273
|
clearPeekOpenTimer();
|
|
11093
11274
|
clearPeekCloseTimer();
|
|
11094
11275
|
setPeekOpen(false);
|
|
11095
11276
|
}, [clearPeekCloseTimer, clearPeekOpenTimer]);
|
|
11096
|
-
const closePeek = (0,
|
|
11277
|
+
const closePeek = (0, import_react40.useCallback)(() => {
|
|
11097
11278
|
closePeekImmediate();
|
|
11098
11279
|
}, [closePeekImmediate]);
|
|
11099
|
-
(0,
|
|
11280
|
+
(0, import_react40.useEffect)(() => {
|
|
11100
11281
|
if (enabled) return;
|
|
11101
11282
|
closePeek();
|
|
11102
11283
|
}, [closePeek, enabled]);
|
|
11103
|
-
(0,
|
|
11284
|
+
(0, import_react40.useEffect)(() => {
|
|
11104
11285
|
const el = rootRef.current;
|
|
11105
11286
|
if (!el) return;
|
|
11106
11287
|
const syncFlyoutWidth = () => {
|
|
@@ -11111,8 +11292,8 @@ function SidebarPeek({
|
|
|
11111
11292
|
observer.observe(el);
|
|
11112
11293
|
return () => observer.disconnect();
|
|
11113
11294
|
}, []);
|
|
11114
|
-
const pointerRef = (0,
|
|
11115
|
-
(0,
|
|
11295
|
+
const pointerRef = (0, import_react40.useRef)({ x: 0, y: 0 });
|
|
11296
|
+
(0, import_react40.useEffect)(() => {
|
|
11116
11297
|
if (!enabled) return;
|
|
11117
11298
|
const onPointerMove = (event) => {
|
|
11118
11299
|
pointerRef.current = { x: event.clientX, y: event.clientY };
|
|
@@ -11120,7 +11301,7 @@ function SidebarPeek({
|
|
|
11120
11301
|
document.addEventListener("pointermove", onPointerMove, { passive: true });
|
|
11121
11302
|
return () => document.removeEventListener("pointermove", onPointerMove);
|
|
11122
11303
|
}, [enabled]);
|
|
11123
|
-
(0,
|
|
11304
|
+
(0, import_react40.useEffect)(() => {
|
|
11124
11305
|
if (!peekOpen) return;
|
|
11125
11306
|
const onKeyDown = (event) => {
|
|
11126
11307
|
if (event.key === "Escape") closePeek();
|
|
@@ -11128,17 +11309,17 @@ function SidebarPeek({
|
|
|
11128
11309
|
window.addEventListener("keydown", onKeyDown);
|
|
11129
11310
|
return () => window.removeEventListener("keydown", onKeyDown);
|
|
11130
11311
|
}, [closePeek, peekOpen]);
|
|
11131
|
-
(0,
|
|
11312
|
+
(0, import_react40.useEffect)(
|
|
11132
11313
|
() => () => {
|
|
11133
11314
|
clearPeekOpenTimer();
|
|
11134
11315
|
clearPeekCloseTimer();
|
|
11135
11316
|
},
|
|
11136
11317
|
[clearPeekCloseTimer, clearPeekOpenTimer]
|
|
11137
11318
|
);
|
|
11138
|
-
const cancelPeekOpen = (0,
|
|
11319
|
+
const cancelPeekOpen = (0, import_react40.useCallback)(() => {
|
|
11139
11320
|
clearPeekOpenTimer();
|
|
11140
11321
|
}, [clearPeekOpenTimer]);
|
|
11141
|
-
const schedulePeekOpen = (0,
|
|
11322
|
+
const schedulePeekOpen = (0, import_react40.useCallback)(() => {
|
|
11142
11323
|
if (!enabled || peekOpen) return;
|
|
11143
11324
|
clearPeekCloseTimer();
|
|
11144
11325
|
clearPeekOpenTimer();
|
|
@@ -11147,7 +11328,7 @@ function SidebarPeek({
|
|
|
11147
11328
|
peekOpenTimerRef.current = null;
|
|
11148
11329
|
}, PEEK_OPEN_DELAY_MS);
|
|
11149
11330
|
}, [clearPeekCloseTimer, clearPeekOpenTimer, enabled, peekOpen]);
|
|
11150
|
-
const schedulePeekClose = (0,
|
|
11331
|
+
const schedulePeekClose = (0, import_react40.useCallback)(
|
|
11151
11332
|
(delay = PEEK_CLOSE_DELAY_MS) => {
|
|
11152
11333
|
clearPeekOpenTimer();
|
|
11153
11334
|
if (!peekOpen) return;
|
|
@@ -11159,10 +11340,10 @@ function SidebarPeek({
|
|
|
11159
11340
|
},
|
|
11160
11341
|
[clearPeekCloseTimer, clearPeekOpenTimer, closePeekImmediate, peekOpen]
|
|
11161
11342
|
);
|
|
11162
|
-
const cancelPeekClose = (0,
|
|
11343
|
+
const cancelPeekClose = (0, import_react40.useCallback)(() => {
|
|
11163
11344
|
clearPeekCloseTimer();
|
|
11164
11345
|
}, [clearPeekCloseTimer]);
|
|
11165
|
-
(0,
|
|
11346
|
+
(0, import_react40.useEffect)(() => {
|
|
11166
11347
|
if (!peekOpen || !enabled) return;
|
|
11167
11348
|
const frame = requestAnimationFrame(() => {
|
|
11168
11349
|
const root = rootRef.current;
|
|
@@ -11184,7 +11365,7 @@ function SidebarPeek({
|
|
|
11184
11365
|
});
|
|
11185
11366
|
return () => cancelAnimationFrame(frame);
|
|
11186
11367
|
}, [cancelPeekClose, enabled, peekOpen]);
|
|
11187
|
-
const contextValue = (0,
|
|
11368
|
+
const contextValue = (0, import_react40.useMemo)(
|
|
11188
11369
|
() => ({
|
|
11189
11370
|
enabled,
|
|
11190
11371
|
mode,
|
|
@@ -11303,12 +11484,12 @@ function useSidebarPeek() {
|
|
|
11303
11484
|
}
|
|
11304
11485
|
|
|
11305
11486
|
// src/components/Sidebar/SidebarProvider.tsx
|
|
11306
|
-
var
|
|
11307
|
-
var
|
|
11487
|
+
var import_react41 = require("react");
|
|
11488
|
+
var import_react42 = require("@refineui/utilities/react");
|
|
11308
11489
|
var import_jsx_runtime62 = require("react/jsx-runtime");
|
|
11309
|
-
var SidebarContext = (0,
|
|
11490
|
+
var SidebarContext = (0, import_react41.createContext)(null);
|
|
11310
11491
|
function useSidebarContext(component) {
|
|
11311
|
-
const value = (0,
|
|
11492
|
+
const value = (0, import_react41.useContext)(SidebarContext);
|
|
11312
11493
|
if (!value) throw new Error(`${component} must be used within <SidebarProvider>.`);
|
|
11313
11494
|
return value;
|
|
11314
11495
|
}
|
|
@@ -11322,22 +11503,22 @@ function SidebarProvider({
|
|
|
11322
11503
|
id,
|
|
11323
11504
|
children
|
|
11324
11505
|
}) {
|
|
11325
|
-
const [uncontrolled, setUncontrolled] = (0,
|
|
11506
|
+
const [uncontrolled, setUncontrolled] = (0, import_react41.useState)(defaultOpen);
|
|
11326
11507
|
const open = openProp ?? uncontrolled;
|
|
11327
|
-
const generatedId = (0,
|
|
11508
|
+
const generatedId = (0, import_react41.useId)();
|
|
11328
11509
|
const sidebarId = id ?? generatedId;
|
|
11329
|
-
const toggle = (0,
|
|
11510
|
+
const toggle = (0, import_react41.useCallback)(() => {
|
|
11330
11511
|
const next = !open;
|
|
11331
11512
|
if (openProp === void 0) setUncontrolled(next);
|
|
11332
11513
|
onOpenChange?.(next);
|
|
11333
11514
|
}, [onOpenChange, open, openProp]);
|
|
11334
|
-
const value = (0,
|
|
11515
|
+
const value = (0, import_react41.useMemo)(
|
|
11335
11516
|
() => ({ open, sidebarId, toggle }),
|
|
11336
11517
|
[open, sidebarId, toggle]
|
|
11337
11518
|
);
|
|
11338
11519
|
return /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(SidebarContext.Provider, { value, children });
|
|
11339
11520
|
}
|
|
11340
|
-
var SidebarTrigger = (0,
|
|
11521
|
+
var SidebarTrigger = (0, import_react41.forwardRef)(function SidebarTrigger2({
|
|
11341
11522
|
asChild = false,
|
|
11342
11523
|
onClick,
|
|
11343
11524
|
className,
|
|
@@ -11362,7 +11543,7 @@ var SidebarTrigger = (0, import_react40.forwardRef)(function SidebarTrigger2({
|
|
|
11362
11543
|
if (!event.defaultPrevented) toggle();
|
|
11363
11544
|
}
|
|
11364
11545
|
};
|
|
11365
|
-
if (asChild) return /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
|
|
11546
|
+
if (asChild) return /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(import_react42.Slot, { ...shared, children });
|
|
11366
11547
|
return /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
|
|
11367
11548
|
Button,
|
|
11368
11549
|
{
|
|
@@ -11379,7 +11560,7 @@ var SidebarTrigger = (0, import_react40.forwardRef)(function SidebarTrigger2({
|
|
|
11379
11560
|
|
|
11380
11561
|
// src/components/Pagination/Pagination.tsx
|
|
11381
11562
|
var import_clsx84 = require("clsx");
|
|
11382
|
-
var
|
|
11563
|
+
var import_tokens24 = require("@refineui/tokens");
|
|
11383
11564
|
var import_color10 = require("@refineui/utilities/color");
|
|
11384
11565
|
|
|
11385
11566
|
// src/components/Pagination/style.ts
|
|
@@ -11442,7 +11623,7 @@ function PaginationNavButton({
|
|
|
11442
11623
|
WebIcon,
|
|
11443
11624
|
{
|
|
11444
11625
|
name: isPrev ? "chevron-left" : "chevron-right",
|
|
11445
|
-
size:
|
|
11626
|
+
size: import_tokens24.iconSizes.medium,
|
|
11446
11627
|
color: iconColor,
|
|
11447
11628
|
fallback: isPrev ? "\u2039" : "\u203A"
|
|
11448
11629
|
}
|
|
@@ -11469,7 +11650,7 @@ function PaginationEllipsis({ className, ...props }) {
|
|
|
11469
11650
|
WebIcon,
|
|
11470
11651
|
{
|
|
11471
11652
|
name: "more-horizontal",
|
|
11472
|
-
size:
|
|
11653
|
+
size: import_tokens24.iconSizes.medium,
|
|
11473
11654
|
color: (0, import_color10.resolveColorTokenValue)(componentColorTokens.pagination.navIcon.default),
|
|
11474
11655
|
fallback: "\u2026"
|
|
11475
11656
|
}
|
|
@@ -11483,10 +11664,221 @@ function Pagination(props) {
|
|
|
11483
11664
|
|
|
11484
11665
|
// src/components/PopOver/PopOver.tsx
|
|
11485
11666
|
var import_clsx85 = require("clsx");
|
|
11486
|
-
var
|
|
11667
|
+
var import_react44 = require("react");
|
|
11487
11668
|
var import_tokens26 = require("@refineui/tokens");
|
|
11488
11669
|
var import_color11 = require("@refineui/utilities/color");
|
|
11489
|
-
var
|
|
11670
|
+
var import_react45 = require("@refineui/utilities/react");
|
|
11671
|
+
|
|
11672
|
+
// src/components/shared/FloatingSurface.tsx
|
|
11673
|
+
var import_react43 = require("react");
|
|
11674
|
+
var import_tokens25 = require("@refineui/tokens");
|
|
11675
|
+
|
|
11676
|
+
// src/components/shared/floatingOutline.ts
|
|
11677
|
+
var PATH_PRECISION = 100;
|
|
11678
|
+
function fmt(n) {
|
|
11679
|
+
return String(Math.round(n * PATH_PRECISION) / PATH_PRECISION);
|
|
11680
|
+
}
|
|
11681
|
+
function pt(p) {
|
|
11682
|
+
return `${fmt(p.x)} ${fmt(p.y)}`;
|
|
11683
|
+
}
|
|
11684
|
+
function towards(from, to, distance) {
|
|
11685
|
+
const length = Math.hypot(to.x - from.x, to.y - from.y);
|
|
11686
|
+
if (length === 0) return from;
|
|
11687
|
+
const t = distance / length;
|
|
11688
|
+
return { x: from.x + (to.x - from.x) * t, y: from.y + (to.y - from.y) * t };
|
|
11689
|
+
}
|
|
11690
|
+
function floatingShapeSize(panelWidth, panelHeight, side, beakHeight) {
|
|
11691
|
+
const vertical = side === "top" || side === "bottom";
|
|
11692
|
+
return {
|
|
11693
|
+
width: vertical ? panelWidth : panelWidth + beakHeight,
|
|
11694
|
+
height: vertical ? panelHeight + beakHeight : panelHeight
|
|
11695
|
+
};
|
|
11696
|
+
}
|
|
11697
|
+
function resolveBeakCenter(edgeLength, align, beakWidth, radius2, insetStart, insetEnd) {
|
|
11698
|
+
const half = beakWidth / 2;
|
|
11699
|
+
const min = radius2 + half;
|
|
11700
|
+
const max = edgeLength - radius2 - half;
|
|
11701
|
+
if (max < min) return edgeLength / 2;
|
|
11702
|
+
const wanted = align === "center" ? edgeLength / 2 : align === "start" ? insetStart + half : edgeLength - insetEnd - half;
|
|
11703
|
+
return Math.min(max, Math.max(min, wanted));
|
|
11704
|
+
}
|
|
11705
|
+
function buildFloatingOutline({
|
|
11706
|
+
panelWidth,
|
|
11707
|
+
panelHeight,
|
|
11708
|
+
radius: radius2,
|
|
11709
|
+
side,
|
|
11710
|
+
beakCenter,
|
|
11711
|
+
beakWidth,
|
|
11712
|
+
beakHeight,
|
|
11713
|
+
tipRadius,
|
|
11714
|
+
inset = 0
|
|
11715
|
+
}) {
|
|
11716
|
+
const offsetX = side === "left" ? beakHeight : 0;
|
|
11717
|
+
const offsetY = side === "top" ? beakHeight : 0;
|
|
11718
|
+
const x0 = offsetX + inset;
|
|
11719
|
+
const y0 = offsetY + inset;
|
|
11720
|
+
const x1 = offsetX + panelWidth - inset;
|
|
11721
|
+
const y1 = offsetY + panelHeight - inset;
|
|
11722
|
+
const r = Math.max(0, Math.min(radius2 - inset, (x1 - x0) / 2, (y1 - y0) / 2));
|
|
11723
|
+
const half = beakWidth / 2;
|
|
11724
|
+
const sinHalfAngle = half / Math.hypot(half, beakHeight);
|
|
11725
|
+
const reach = beakHeight + inset - inset / sinHalfAngle;
|
|
11726
|
+
const spread = half * reach / beakHeight;
|
|
11727
|
+
const edgeCenter = (side === "top" || side === "bottom" ? offsetX : offsetY) + beakCenter;
|
|
11728
|
+
const beak = (first, tip, second) => {
|
|
11729
|
+
const before = towards(tip, first, tipRadius);
|
|
11730
|
+
const after = towards(tip, second, tipRadius);
|
|
11731
|
+
return ` L ${pt(first)} L ${pt(before)} Q ${pt(tip)} ${pt(after)} L ${pt(second)}`;
|
|
11732
|
+
};
|
|
11733
|
+
let d = `M ${pt({ x: x0 + r, y: y0 })}`;
|
|
11734
|
+
if (side === "top") {
|
|
11735
|
+
d += beak(
|
|
11736
|
+
{ x: edgeCenter - spread, y: y0 },
|
|
11737
|
+
{ x: edgeCenter, y: y0 - reach },
|
|
11738
|
+
{ x: edgeCenter + spread, y: y0 }
|
|
11739
|
+
);
|
|
11740
|
+
}
|
|
11741
|
+
d += ` L ${pt({ x: x1 - r, y: y0 })} A ${fmt(r)} ${fmt(r)} 0 0 1 ${pt({ x: x1, y: y0 + r })}`;
|
|
11742
|
+
if (side === "right") {
|
|
11743
|
+
d += beak(
|
|
11744
|
+
{ x: x1, y: edgeCenter - spread },
|
|
11745
|
+
{ x: x1 + reach, y: edgeCenter },
|
|
11746
|
+
{ x: x1, y: edgeCenter + spread }
|
|
11747
|
+
);
|
|
11748
|
+
}
|
|
11749
|
+
d += ` L ${pt({ x: x1, y: y1 - r })} A ${fmt(r)} ${fmt(r)} 0 0 1 ${pt({ x: x1 - r, y: y1 })}`;
|
|
11750
|
+
if (side === "bottom") {
|
|
11751
|
+
d += beak(
|
|
11752
|
+
{ x: edgeCenter + spread, y: y1 },
|
|
11753
|
+
{ x: edgeCenter, y: y1 + reach },
|
|
11754
|
+
{ x: edgeCenter - spread, y: y1 }
|
|
11755
|
+
);
|
|
11756
|
+
}
|
|
11757
|
+
d += ` L ${pt({ x: x0 + r, y: y1 })} A ${fmt(r)} ${fmt(r)} 0 0 1 ${pt({ x: x0, y: y1 - r })}`;
|
|
11758
|
+
if (side === "left") {
|
|
11759
|
+
d += beak(
|
|
11760
|
+
{ x: x0, y: edgeCenter + spread },
|
|
11761
|
+
{ x: x0 - reach, y: edgeCenter },
|
|
11762
|
+
{ x: x0, y: edgeCenter - spread }
|
|
11763
|
+
);
|
|
11764
|
+
}
|
|
11765
|
+
d += ` L ${pt({ x: x0, y: y0 + r })} A ${fmt(r)} ${fmt(r)} 0 0 1 ${pt({ x: x0 + r, y: y0 })} Z`;
|
|
11766
|
+
return d;
|
|
11767
|
+
}
|
|
11768
|
+
|
|
11769
|
+
// src/components/shared/FloatingSurface.tsx
|
|
11770
|
+
var import_jsx_runtime64 = require("react/jsx-runtime");
|
|
11771
|
+
var useIsomorphicLayoutEffect6 = typeof document !== "undefined" ? import_react43.useLayoutEffect : import_react43.useEffect;
|
|
11772
|
+
var SHADOW_BLEED = parseFloat(import_tokens25.spacings.sizeXXXLarge);
|
|
11773
|
+
var STROKE = parseFloat(import_tokens25.strokeWidths.strokeWidthHairline);
|
|
11774
|
+
function svgPathMask(shape, width, height, bleed) {
|
|
11775
|
+
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>`;
|
|
11776
|
+
return `url("data:image/svg+xml,${encodeURIComponent(svg)}")`;
|
|
11777
|
+
}
|
|
11778
|
+
function usePanelSize(panelRef) {
|
|
11779
|
+
const [size, setSize] = (0, import_react43.useState)(null);
|
|
11780
|
+
useIsomorphicLayoutEffect6(() => {
|
|
11781
|
+
const panel = panelRef.current;
|
|
11782
|
+
if (!panel) return;
|
|
11783
|
+
const measure = () => {
|
|
11784
|
+
const style = getComputedStyle(panel);
|
|
11785
|
+
const next = { width: parseFloat(style.width), height: parseFloat(style.height) };
|
|
11786
|
+
setSize((prev) => prev && prev.width === next.width && prev.height === next.height ? prev : next);
|
|
11787
|
+
};
|
|
11788
|
+
measure();
|
|
11789
|
+
if (typeof ResizeObserver === "undefined") return;
|
|
11790
|
+
const observer = new ResizeObserver(measure);
|
|
11791
|
+
observer.observe(panel);
|
|
11792
|
+
return () => observer.disconnect();
|
|
11793
|
+
}, [panelRef]);
|
|
11794
|
+
return size;
|
|
11795
|
+
}
|
|
11796
|
+
function FloatingSurface({
|
|
11797
|
+
panelRef,
|
|
11798
|
+
side,
|
|
11799
|
+
align,
|
|
11800
|
+
radius: radius2,
|
|
11801
|
+
beakWidth,
|
|
11802
|
+
beakHeight,
|
|
11803
|
+
tipRadius,
|
|
11804
|
+
beakInsetStart,
|
|
11805
|
+
beakInsetEnd,
|
|
11806
|
+
backgroundColor,
|
|
11807
|
+
borderColor
|
|
11808
|
+
}) {
|
|
11809
|
+
const size = usePanelSize(panelRef);
|
|
11810
|
+
if (!size) return null;
|
|
11811
|
+
const r = parseFloat(radius2);
|
|
11812
|
+
const bw = parseFloat(beakWidth);
|
|
11813
|
+
const bh = parseFloat(beakHeight);
|
|
11814
|
+
const vertical = side === "top" || side === "bottom";
|
|
11815
|
+
const beakCenter = resolveBeakCenter(
|
|
11816
|
+
vertical ? size.width : size.height,
|
|
11817
|
+
align,
|
|
11818
|
+
bw,
|
|
11819
|
+
r,
|
|
11820
|
+
parseFloat(beakInsetStart),
|
|
11821
|
+
parseFloat(beakInsetEnd)
|
|
11822
|
+
);
|
|
11823
|
+
const geometry = {
|
|
11824
|
+
panelWidth: size.width,
|
|
11825
|
+
panelHeight: size.height,
|
|
11826
|
+
radius: r,
|
|
11827
|
+
side,
|
|
11828
|
+
beakCenter,
|
|
11829
|
+
beakWidth: bw,
|
|
11830
|
+
beakHeight: bh,
|
|
11831
|
+
tipRadius: parseFloat(tipRadius)
|
|
11832
|
+
};
|
|
11833
|
+
const shape = buildFloatingOutline(geometry);
|
|
11834
|
+
const outline = buildFloatingOutline({ ...geometry, inset: STROKE / 2 });
|
|
11835
|
+
const box = floatingShapeSize(size.width, size.height, side, bh);
|
|
11836
|
+
const holeMask = `linear-gradient(black 0 0), ${svgPathMask(shape, box.width, box.height, SHADOW_BLEED)}`;
|
|
11837
|
+
const surfaceMask = svgPathMask(shape, box.width, box.height, 0);
|
|
11838
|
+
const rootStyle = {
|
|
11839
|
+
width: box.width,
|
|
11840
|
+
height: box.height,
|
|
11841
|
+
top: side === "top" ? -bh : 0,
|
|
11842
|
+
left: side === "left" ? -bh : 0
|
|
11843
|
+
};
|
|
11844
|
+
const shadowStyle = {
|
|
11845
|
+
inset: -SHADOW_BLEED,
|
|
11846
|
+
maskImage: holeMask,
|
|
11847
|
+
WebkitMaskImage: holeMask,
|
|
11848
|
+
maskComposite: "exclude",
|
|
11849
|
+
WebkitMaskComposite: "xor",
|
|
11850
|
+
maskSize: "100% 100%",
|
|
11851
|
+
WebkitMaskSize: "100% 100%",
|
|
11852
|
+
maskRepeat: "no-repeat",
|
|
11853
|
+
WebkitMaskRepeat: "no-repeat"
|
|
11854
|
+
};
|
|
11855
|
+
const surfaceStyle = {
|
|
11856
|
+
backgroundColor,
|
|
11857
|
+
maskImage: surfaceMask,
|
|
11858
|
+
WebkitMaskImage: surfaceMask,
|
|
11859
|
+
maskSize: "100% 100%",
|
|
11860
|
+
WebkitMaskSize: "100% 100%",
|
|
11861
|
+
maskRepeat: "no-repeat",
|
|
11862
|
+
WebkitMaskRepeat: "no-repeat"
|
|
11863
|
+
};
|
|
11864
|
+
const clip = `path("${shape}")`;
|
|
11865
|
+
return /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)("div", { "data-refineui": "floating-chrome", "aria-hidden": true, className: "pointer-events-none absolute -z-1", style: rootStyle, children: [
|
|
11866
|
+
/* @__PURE__ */ (0, import_jsx_runtime64.jsx)("div", { className: "absolute", style: shadowStyle, children: /* @__PURE__ */ (0, import_jsx_runtime64.jsx)("div", { "data-refineui": "floating-shadow", className: "absolute", style: { inset: SHADOW_BLEED }, children: /* @__PURE__ */ (0, import_jsx_runtime64.jsx)("div", { className: "absolute inset-0", style: { clipPath: clip, backgroundColor: borderColor } }) }) }),
|
|
11867
|
+
/* @__PURE__ */ (0, import_jsx_runtime64.jsx)("div", { "data-refineui": "floating-surface", className: "absolute inset-0", style: surfaceStyle }),
|
|
11868
|
+
/* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
|
|
11869
|
+
"svg",
|
|
11870
|
+
{
|
|
11871
|
+
"data-refineui": "floating-outline",
|
|
11872
|
+
className: "absolute inset-0 overflow-visible",
|
|
11873
|
+
width: box.width,
|
|
11874
|
+
height: box.height,
|
|
11875
|
+
viewBox: `0 0 ${box.width} ${box.height}`,
|
|
11876
|
+
fill: "none",
|
|
11877
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime64.jsx)("path", { d: outline, stroke: borderColor, strokeWidth: STROKE, strokeLinejoin: "round" })
|
|
11878
|
+
}
|
|
11879
|
+
)
|
|
11880
|
+
] });
|
|
11881
|
+
}
|
|
11490
11882
|
|
|
11491
11883
|
// src/components/PopOver/style.ts
|
|
11492
11884
|
var popoverStyles = {
|
|
@@ -11494,9 +11886,8 @@ var popoverStyles = {
|
|
|
11494
11886
|
fallbackTrigger: "cursor-pointer border-none bg-transparent p-0 font-inherit text-inherit",
|
|
11495
11887
|
floatingRoot: "absolute z-refineui-popup",
|
|
11496
11888
|
panelWrap: "relative inline-block min-w-refineui-popover-panel-width",
|
|
11497
|
-
|
|
11498
|
-
panel: "relative z-0 box-border min-w-refineui-popover-panel-width rounded-refineui-xx-large border-refineui-
|
|
11499
|
-
panelShadowDefault: "shadow-refineui-8"
|
|
11889
|
+
/** Fill, stroke, and shadow come from `FloatingSurface`; the transparent border keeps the box size. */
|
|
11890
|
+
panel: "relative z-0 box-border min-w-refineui-popover-panel-width rounded-refineui-xx-large border-refineui-hairline border-transparent outline-none"
|
|
11500
11891
|
};
|
|
11501
11892
|
function popoverFloatingClasses(placement, align) {
|
|
11502
11893
|
if (placement === "bottom") {
|
|
@@ -11520,58 +11911,22 @@ function popoverFloatingClasses(placement, align) {
|
|
|
11520
11911
|
}
|
|
11521
11912
|
|
|
11522
11913
|
// src/components/PopOver/PopOver.tsx
|
|
11523
|
-
var
|
|
11524
|
-
var PopoverContext = (0,
|
|
11914
|
+
var import_jsx_runtime65 = require("react/jsx-runtime");
|
|
11915
|
+
var PopoverContext = (0, import_react44.createContext)(null);
|
|
11525
11916
|
function usePopoverContext(component) {
|
|
11526
|
-
const ctx = (0,
|
|
11917
|
+
const ctx = (0, import_react44.useContext)(PopoverContext);
|
|
11527
11918
|
if (!ctx) throw new Error(`${component} must be used within <Popover>`);
|
|
11528
11919
|
return ctx;
|
|
11529
11920
|
}
|
|
11530
|
-
var
|
|
11531
|
-
var
|
|
11532
|
-
var
|
|
11533
|
-
var
|
|
11534
|
-
|
|
11535
|
-
|
|
11536
|
-
|
|
11537
|
-
|
|
11538
|
-
|
|
11539
|
-
const overlapOffset = `calc(-1 * ${BEAK_OFFSET} + ${BEAK_BORDER_OVERLAP})`;
|
|
11540
|
-
switch (placement) {
|
|
11541
|
-
case "bottom":
|
|
11542
|
-
if (align === "center") return { top: overlapOffset, left: `calc(50% - ${BEAK_W} / 2)` };
|
|
11543
|
-
if (align === "start") return { top: overlapOffset, left: insetStart };
|
|
11544
|
-
return { top: overlapOffset, right: insetEnd };
|
|
11545
|
-
case "top":
|
|
11546
|
-
if (align === "center") return { bottom: overlapOffset, left: `calc(50% - ${BEAK_W} / 2)` };
|
|
11547
|
-
if (align === "start") return { bottom: overlapOffset, left: insetStart };
|
|
11548
|
-
return { bottom: overlapOffset, right: insetEnd };
|
|
11549
|
-
case "left":
|
|
11550
|
-
if (align === "center") return { right: overlapOffset, top: `calc(50% - ${BEAK_W} / 2)` };
|
|
11551
|
-
if (align === "start") return { right: overlapOffset, top: edge };
|
|
11552
|
-
return { right: overlapOffset, bottom: edge };
|
|
11553
|
-
case "right":
|
|
11554
|
-
if (align === "center") return { left: overlapOffset, top: `calc(50% - ${BEAK_W} / 2)` };
|
|
11555
|
-
if (align === "start") return { left: overlapOffset, top: edge };
|
|
11556
|
-
return { left: overlapOffset, bottom: edge };
|
|
11557
|
-
default:
|
|
11558
|
-
return {};
|
|
11559
|
-
}
|
|
11560
|
-
}
|
|
11561
|
-
function beakRotateDeg(placement) {
|
|
11562
|
-
switch (placement) {
|
|
11563
|
-
case "bottom":
|
|
11564
|
-
return 0;
|
|
11565
|
-
case "top":
|
|
11566
|
-
return 180;
|
|
11567
|
-
case "left":
|
|
11568
|
-
return -90;
|
|
11569
|
-
case "right":
|
|
11570
|
-
return 90;
|
|
11571
|
-
default:
|
|
11572
|
-
return 0;
|
|
11573
|
-
}
|
|
11574
|
-
}
|
|
11921
|
+
var BEAK_TIP_GAP = import_tokens26.spacings.sizeXXSmall;
|
|
11922
|
+
var POPOVER_GAP = `calc(${import_tokens3.componentSizes.popoverBeakHeight} + ${BEAK_TIP_GAP})`;
|
|
11923
|
+
var SIDE_BEAK_INSET = import_tokens26.spacings.sizeMedium;
|
|
11924
|
+
var beakSideByPlacement = {
|
|
11925
|
+
bottom: "top",
|
|
11926
|
+
top: "bottom",
|
|
11927
|
+
left: "right",
|
|
11928
|
+
right: "left"
|
|
11929
|
+
};
|
|
11575
11930
|
function floatingGapStyle(placement) {
|
|
11576
11931
|
if (placement === "top") return { marginBottom: POPOVER_GAP };
|
|
11577
11932
|
if (placement === "bottom") return { marginTop: POPOVER_GAP };
|
|
@@ -11579,35 +11934,35 @@ function floatingGapStyle(placement) {
|
|
|
11579
11934
|
return { marginLeft: POPOVER_GAP };
|
|
11580
11935
|
}
|
|
11581
11936
|
function Popover({ children, className, open: openProp, defaultOpen = false, onOpenChange, ...props }) {
|
|
11582
|
-
const [internalOpen, setInternalOpen] = (0,
|
|
11937
|
+
const [internalOpen, setInternalOpen] = (0, import_react44.useState)(defaultOpen);
|
|
11583
11938
|
const open = openProp ?? internalOpen;
|
|
11584
|
-
const setOpen = (0,
|
|
11939
|
+
const setOpen = (0, import_react44.useCallback)(
|
|
11585
11940
|
(next) => {
|
|
11586
11941
|
if (openProp === void 0) setInternalOpen(next);
|
|
11587
11942
|
onOpenChange?.(next);
|
|
11588
11943
|
},
|
|
11589
11944
|
[openProp, onOpenChange]
|
|
11590
11945
|
);
|
|
11591
|
-
const toggle = (0,
|
|
11592
|
-
const containerRef = (0,
|
|
11593
|
-
const contentRef = (0,
|
|
11594
|
-
const triggerRef = (0,
|
|
11595
|
-
const contentId = (0,
|
|
11596
|
-
(0,
|
|
11946
|
+
const toggle = (0, import_react44.useCallback)(() => setOpen(!open), [open, setOpen]);
|
|
11947
|
+
const containerRef = (0, import_react44.useRef)(null);
|
|
11948
|
+
const contentRef = (0, import_react44.useRef)(null);
|
|
11949
|
+
const triggerRef = (0, import_react44.useRef)(null);
|
|
11950
|
+
const contentId = (0, import_react44.useId)();
|
|
11951
|
+
(0, import_react44.useEffect)(() => {
|
|
11597
11952
|
const handler = (e) => {
|
|
11598
11953
|
if (containerRef.current && !containerRef.current.contains(e.target)) setOpen(false);
|
|
11599
11954
|
};
|
|
11600
11955
|
if (open) document.addEventListener("mousedown", handler);
|
|
11601
11956
|
return () => document.removeEventListener("mousedown", handler);
|
|
11602
11957
|
}, [open, setOpen]);
|
|
11603
|
-
(0,
|
|
11958
|
+
(0, import_react44.useEffect)(() => {
|
|
11604
11959
|
const onKey = (e) => {
|
|
11605
11960
|
if (e instanceof KeyboardEvent && e.key === "Escape") setOpen(false);
|
|
11606
11961
|
};
|
|
11607
11962
|
if (open) document.addEventListener("keydown", onKey);
|
|
11608
11963
|
return () => document.removeEventListener("keydown", onKey);
|
|
11609
11964
|
}, [open, setOpen]);
|
|
11610
|
-
const onTriggerKeyDown = (0,
|
|
11965
|
+
const onTriggerKeyDown = (0, import_react44.useCallback)(
|
|
11611
11966
|
(e) => {
|
|
11612
11967
|
if (e.key === "Enter" || e.key === " ") {
|
|
11613
11968
|
e.preventDefault();
|
|
@@ -11616,7 +11971,7 @@ function Popover({ children, className, open: openProp, defaultOpen = false, onO
|
|
|
11616
11971
|
},
|
|
11617
11972
|
[toggle]
|
|
11618
11973
|
);
|
|
11619
|
-
const value = (0,
|
|
11974
|
+
const value = (0, import_react44.useMemo)(
|
|
11620
11975
|
() => ({
|
|
11621
11976
|
open,
|
|
11622
11977
|
setOpen,
|
|
@@ -11629,7 +11984,7 @@ function Popover({ children, className, open: openProp, defaultOpen = false, onO
|
|
|
11629
11984
|
}),
|
|
11630
11985
|
[open, setOpen, toggle, contentId, onTriggerKeyDown]
|
|
11631
11986
|
);
|
|
11632
|
-
return /* @__PURE__ */ (0,
|
|
11987
|
+
return /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(PopoverContext.Provider, { value, children: /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
|
|
11633
11988
|
"div",
|
|
11634
11989
|
{
|
|
11635
11990
|
ref: containerRef,
|
|
@@ -11642,11 +11997,11 @@ function Popover({ children, className, open: openProp, defaultOpen = false, onO
|
|
|
11642
11997
|
}
|
|
11643
11998
|
function PopoverTrigger({ children, className, ...props }) {
|
|
11644
11999
|
const { open, toggle, triggerRef, contentId, onTriggerKeyDown } = usePopoverContext("PopoverTrigger");
|
|
11645
|
-
const mergeEl = (0,
|
|
12000
|
+
const mergeEl = (0, import_react45.getMergeableTriggerChild)(children);
|
|
11646
12001
|
if (mergeEl) {
|
|
11647
12002
|
const passthrough = props;
|
|
11648
|
-
return /* @__PURE__ */ (0,
|
|
11649
|
-
|
|
12003
|
+
return /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
|
|
12004
|
+
import_react45.Slot,
|
|
11650
12005
|
{
|
|
11651
12006
|
ref: triggerRef,
|
|
11652
12007
|
...props,
|
|
@@ -11667,7 +12022,7 @@ function PopoverTrigger({ children, className, ...props }) {
|
|
|
11667
12022
|
);
|
|
11668
12023
|
}
|
|
11669
12024
|
const passthroughBtn = props;
|
|
11670
|
-
return /* @__PURE__ */ (0,
|
|
12025
|
+
return /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
|
|
11671
12026
|
"button",
|
|
11672
12027
|
{
|
|
11673
12028
|
type: "button",
|
|
@@ -11706,11 +12061,10 @@ function PopoverContent({
|
|
|
11706
12061
|
const palette = componentColorTokens.popover.default;
|
|
11707
12062
|
const bg = (0, import_color11.resolveColorTokenValue)(palette.background);
|
|
11708
12063
|
const borderCol = (0, import_color11.resolveColorTokenValue)(palette.border);
|
|
11709
|
-
const bw = beakWrapperStyle(placement, align);
|
|
11710
|
-
const rot = beakRotateDeg(placement);
|
|
11711
12064
|
const gapStyle = floatingGapStyle(placement);
|
|
12065
|
+
const vertical = placement === "top" || placement === "bottom";
|
|
11712
12066
|
if (!open) return null;
|
|
11713
|
-
return /* @__PURE__ */ (0,
|
|
12067
|
+
return /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
|
|
11714
12068
|
"div",
|
|
11715
12069
|
{
|
|
11716
12070
|
className: (0, import_clsx85.clsx)(
|
|
@@ -11718,34 +12072,8 @@ function PopoverContent({
|
|
|
11718
12072
|
popoverFloatingClasses(placement, align)
|
|
11719
12073
|
),
|
|
11720
12074
|
style: gapStyle,
|
|
11721
|
-
children: /* @__PURE__ */ (0,
|
|
11722
|
-
/* @__PURE__ */ (0,
|
|
11723
|
-
"div",
|
|
11724
|
-
{
|
|
11725
|
-
style: {
|
|
11726
|
-
width: BEAK_W,
|
|
11727
|
-
height: BEAK_H,
|
|
11728
|
-
transform: `rotate(${rot}deg)`,
|
|
11729
|
-
transformOrigin: "center center"
|
|
11730
|
-
},
|
|
11731
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)(
|
|
11732
|
-
"svg",
|
|
11733
|
-
{
|
|
11734
|
-
width: BEAK_W,
|
|
11735
|
-
height: BEAK_H,
|
|
11736
|
-
viewBox: "0 0 16 8",
|
|
11737
|
-
fill: "none",
|
|
11738
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
11739
|
-
style: { display: "block" },
|
|
11740
|
-
children: [
|
|
11741
|
-
/* @__PURE__ */ (0, import_jsx_runtime64.jsx)("polygon", { points: "8,0 0,8 16,8", fill: borderCol }),
|
|
11742
|
-
/* @__PURE__ */ (0, import_jsx_runtime64.jsx)("polygon", { points: "8,2 2,8 14,8", fill: bg })
|
|
11743
|
-
]
|
|
11744
|
-
}
|
|
11745
|
-
)
|
|
11746
|
-
}
|
|
11747
|
-
) }),
|
|
11748
|
-
/* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
|
|
12075
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)("div", { className: popoverStyles.panelWrap, children: [
|
|
12076
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
|
|
11749
12077
|
"div",
|
|
11750
12078
|
{
|
|
11751
12079
|
ref: contentRef,
|
|
@@ -11756,22 +12084,32 @@ function PopoverContent({
|
|
|
11756
12084
|
"data-refineui": "popover",
|
|
11757
12085
|
"data-placement": placement,
|
|
11758
12086
|
"data-align": align,
|
|
11759
|
-
className: (0, import_clsx85.clsx)(
|
|
11760
|
-
popoverStyles.panel,
|
|
11761
|
-
popoverStyles.panelShadowDefault,
|
|
11762
|
-
className
|
|
11763
|
-
),
|
|
12087
|
+
className: (0, import_clsx85.clsx)(popoverStyles.panel, className),
|
|
11764
12088
|
style: {
|
|
11765
12089
|
...styleProp && typeof styleProp === "object" ? styleProp : {},
|
|
11766
12090
|
minWidth: import_tokens3.componentSizes.popoverPanelWidth,
|
|
11767
12091
|
padding: import_tokens26.spacings.sizeLarge,
|
|
11768
|
-
|
|
11769
|
-
color: (0, import_color11.resolveColorTokenValue)(palette.foreground),
|
|
11770
|
-
borderColor: borderCol
|
|
12092
|
+
color: (0, import_color11.resolveColorTokenValue)(palette.foreground)
|
|
11771
12093
|
},
|
|
11772
12094
|
...props,
|
|
11773
12095
|
children
|
|
11774
12096
|
}
|
|
12097
|
+
),
|
|
12098
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
|
|
12099
|
+
FloatingSurface,
|
|
12100
|
+
{
|
|
12101
|
+
panelRef: contentRef,
|
|
12102
|
+
side: beakSideByPlacement[placement],
|
|
12103
|
+
align,
|
|
12104
|
+
radius: import_tokens26.borderRadii.roundedXXLarge,
|
|
12105
|
+
beakWidth: import_tokens3.componentSizes.popoverBeakWidth,
|
|
12106
|
+
beakHeight: import_tokens3.componentSizes.popoverBeakHeight,
|
|
12107
|
+
tipRadius: import_tokens3.componentSizes.popoverBeakTipRadius,
|
|
12108
|
+
beakInsetStart: vertical ? import_tokens3.componentSizes.popoverBeakInsetFromStartEdge : SIDE_BEAK_INSET,
|
|
12109
|
+
beakInsetEnd: vertical ? import_tokens3.componentSizes.popoverBeakInsetFromEndEdge : SIDE_BEAK_INSET,
|
|
12110
|
+
backgroundColor: bg,
|
|
12111
|
+
borderColor: borderCol
|
|
12112
|
+
}
|
|
11775
12113
|
)
|
|
11776
12114
|
] })
|
|
11777
12115
|
}
|
|
@@ -11785,9 +12123,9 @@ function PopOver({
|
|
|
11785
12123
|
className,
|
|
11786
12124
|
...props
|
|
11787
12125
|
}) {
|
|
11788
|
-
return /* @__PURE__ */ (0,
|
|
11789
|
-
/* @__PURE__ */ (0,
|
|
11790
|
-
/* @__PURE__ */ (0,
|
|
12126
|
+
return /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)(Popover, { className, ...props, children: [
|
|
12127
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsx)(PopoverTrigger, { children: trigger }),
|
|
12128
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsx)(PopoverContent, { placement, align, children: content })
|
|
11791
12129
|
] });
|
|
11792
12130
|
}
|
|
11793
12131
|
|
|
@@ -11803,7 +12141,7 @@ var skeletonStyles = {
|
|
|
11803
12141
|
};
|
|
11804
12142
|
|
|
11805
12143
|
// src/components/Skeleton/Skeleton.tsx
|
|
11806
|
-
var
|
|
12144
|
+
var import_jsx_runtime66 = require("react/jsx-runtime");
|
|
11807
12145
|
function Skeleton({
|
|
11808
12146
|
width,
|
|
11809
12147
|
height,
|
|
@@ -11835,7 +12173,7 @@ function Skeleton({
|
|
|
11835
12173
|
w = width ?? "100%";
|
|
11836
12174
|
}
|
|
11837
12175
|
const dimStyle = { width: w, height: h };
|
|
11838
|
-
return /* @__PURE__ */ (0,
|
|
12176
|
+
return /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
|
|
11839
12177
|
"div",
|
|
11840
12178
|
{
|
|
11841
12179
|
"data-refineui": "skeleton",
|
|
@@ -11853,7 +12191,7 @@ function Skeleton({
|
|
|
11853
12191
|
|
|
11854
12192
|
// src/components/Slider/Slider.tsx
|
|
11855
12193
|
var import_clsx87 = require("clsx");
|
|
11856
|
-
var
|
|
12194
|
+
var import_react46 = require("react");
|
|
11857
12195
|
|
|
11858
12196
|
// src/components/Slider/style.ts
|
|
11859
12197
|
var sliderStyles = {
|
|
@@ -11861,7 +12199,7 @@ var sliderStyles = {
|
|
|
11861
12199
|
};
|
|
11862
12200
|
|
|
11863
12201
|
// src/components/Slider/Slider.tsx
|
|
11864
|
-
var
|
|
12202
|
+
var import_jsx_runtime67 = require("react/jsx-runtime");
|
|
11865
12203
|
function clampPct(n) {
|
|
11866
12204
|
if (Number.isNaN(n)) return 0;
|
|
11867
12205
|
return Math.min(100, Math.max(0, n));
|
|
@@ -11879,12 +12217,12 @@ function Slider({
|
|
|
11879
12217
|
style,
|
|
11880
12218
|
...props
|
|
11881
12219
|
}) {
|
|
11882
|
-
const [internalFillPct, setInternalFillPct] = (0,
|
|
12220
|
+
const [internalFillPct, setInternalFillPct] = (0, import_react46.useState)(() => {
|
|
11883
12221
|
const v = defaultValue !== void 0 ? Number(defaultValue) : (min + max) / 2;
|
|
11884
12222
|
return clampPct((v - min) / (max - min) * 100);
|
|
11885
12223
|
});
|
|
11886
12224
|
const fillPct = value !== void 0 ? clampPct((Number(value) - min) / (max - min) * 100) : internalFillPct;
|
|
11887
|
-
return /* @__PURE__ */ (0,
|
|
12225
|
+
return /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
|
|
11888
12226
|
"input",
|
|
11889
12227
|
{
|
|
11890
12228
|
type: "range",
|
|
@@ -11921,7 +12259,7 @@ function Slider({
|
|
|
11921
12259
|
// src/components/Carousel/Carousel.tsx
|
|
11922
12260
|
var import_clsx89 = require("clsx");
|
|
11923
12261
|
var import_tokens27 = require("@refineui/tokens");
|
|
11924
|
-
var
|
|
12262
|
+
var import_react47 = require("react");
|
|
11925
12263
|
|
|
11926
12264
|
// src/components/Carousel/style.ts
|
|
11927
12265
|
var import_clsx88 = require("clsx");
|
|
@@ -11945,19 +12283,19 @@ var carouselStyles = {
|
|
|
11945
12283
|
),
|
|
11946
12284
|
indicatorThumb: (0, import_clsx88.clsx)(
|
|
11947
12285
|
"pointer-events-none absolute top-refineui-size-xxx-small bottom-refineui-size-xxx-small start-refineui-size-xxx-small z-0",
|
|
11948
|
-
|
|
11949
|
-
"
|
|
12286
|
+
/* Motion lives in refineui.css, gated by `data-animate`. */
|
|
12287
|
+
"rounded-refineui-circle bg-refineui-alias-background-brand shadow-refineui-2"
|
|
11950
12288
|
),
|
|
11951
12289
|
indicatorHitRow: "relative z-[1] flex h-full w-full",
|
|
11952
12290
|
indicatorHit: "h-full min-w-0 flex-1 cursor-pointer border-none bg-transparent p-0 outline-none"
|
|
11953
12291
|
};
|
|
11954
12292
|
|
|
11955
12293
|
// src/components/Carousel/Carousel.tsx
|
|
11956
|
-
var
|
|
12294
|
+
var import_jsx_runtime68 = require("react/jsx-runtime");
|
|
11957
12295
|
var DRAG_COMMIT_RATIO = 0.18;
|
|
11958
|
-
var CarouselContext = (0,
|
|
12296
|
+
var CarouselContext = (0, import_react47.createContext)(null);
|
|
11959
12297
|
function useCarouselContext(component) {
|
|
11960
|
-
const v = (0,
|
|
12298
|
+
const v = (0, import_react47.useContext)(CarouselContext);
|
|
11961
12299
|
if (!v) throw new Error(`${component} must be used within Carousel.`);
|
|
11962
12300
|
return v;
|
|
11963
12301
|
}
|
|
@@ -11976,13 +12314,13 @@ function Carousel({
|
|
|
11976
12314
|
...props
|
|
11977
12315
|
}) {
|
|
11978
12316
|
const isControlled = indexControlled !== void 0;
|
|
11979
|
-
const [internalIndex, setInternalIndex] = (0,
|
|
11980
|
-
const [count, setCount] = (0,
|
|
11981
|
-
const [trackIndex, setTrackIndex] = (0,
|
|
11982
|
-
const [instant, setInstant] = (0,
|
|
12317
|
+
const [internalIndex, setInternalIndex] = (0, import_react47.useState)(defaultIndex);
|
|
12318
|
+
const [count, setCount] = (0, import_react47.useState)(0);
|
|
12319
|
+
const [trackIndex, setTrackIndex] = (0, import_react47.useState)(defaultIndex);
|
|
12320
|
+
const [instant, setInstant] = (0, import_react47.useState)(false);
|
|
11983
12321
|
const index = isControlled ? indexControlled : internalIndex;
|
|
11984
12322
|
const loopActive = loop && count > 1;
|
|
11985
|
-
const commitLogical = (0,
|
|
12323
|
+
const commitLogical = (0, import_react47.useCallback)(
|
|
11986
12324
|
(next) => {
|
|
11987
12325
|
const normalized = clampIndex(next, Math.max(count, 1));
|
|
11988
12326
|
if (!isControlled) setInternalIndex(normalized);
|
|
@@ -11990,13 +12328,20 @@ function Carousel({
|
|
|
11990
12328
|
},
|
|
11991
12329
|
[count, isControlled, onIndexChange]
|
|
11992
12330
|
);
|
|
11993
|
-
(0,
|
|
12331
|
+
const snapTrackTo = (0, import_react47.useCallback)((next) => {
|
|
12332
|
+
setInstant(true);
|
|
12333
|
+
setTrackIndex(next);
|
|
12334
|
+
requestAnimationFrame(() => {
|
|
12335
|
+
requestAnimationFrame(() => setInstant(false));
|
|
12336
|
+
});
|
|
12337
|
+
}, []);
|
|
12338
|
+
(0, import_react47.useLayoutEffect)(() => {
|
|
11994
12339
|
if (count <= 0) return;
|
|
11995
12340
|
const logical = clampIndex(index, count);
|
|
11996
12341
|
if (logical !== index) commitLogical(logical);
|
|
11997
|
-
|
|
12342
|
+
snapTrackTo(loopActive ? logical + 1 : logical);
|
|
11998
12343
|
}, [count, loopActive]);
|
|
11999
|
-
(0,
|
|
12344
|
+
(0, import_react47.useEffect)(() => {
|
|
12000
12345
|
if (count <= 0) return;
|
|
12001
12346
|
if (!loopActive) {
|
|
12002
12347
|
setTrackIndex(clampIndex(index, count));
|
|
@@ -12010,7 +12355,7 @@ function Carousel({
|
|
|
12010
12355
|
}, [index, count, loopActive]);
|
|
12011
12356
|
const canScrollPrev = loopActive ? true : index > 0;
|
|
12012
12357
|
const canScrollNext = loopActive ? true : index < count - 1;
|
|
12013
|
-
const scrollTo = (0,
|
|
12358
|
+
const scrollTo = (0, import_react47.useCallback)(
|
|
12014
12359
|
(i) => {
|
|
12015
12360
|
if (count <= 0) return;
|
|
12016
12361
|
const next = clampIndex(i, count);
|
|
@@ -12019,7 +12364,7 @@ function Carousel({
|
|
|
12019
12364
|
},
|
|
12020
12365
|
[commitLogical, count, loopActive]
|
|
12021
12366
|
);
|
|
12022
|
-
const scrollPrev = (0,
|
|
12367
|
+
const scrollPrev = (0, import_react47.useCallback)(() => {
|
|
12023
12368
|
if (count <= 0) return;
|
|
12024
12369
|
if (loopActive) {
|
|
12025
12370
|
if (trackIndex < 1 || trackIndex > count) return;
|
|
@@ -12032,7 +12377,7 @@ function Carousel({
|
|
|
12032
12377
|
setTrackIndex(index - 1);
|
|
12033
12378
|
}
|
|
12034
12379
|
}, [commitLogical, count, index, loopActive, trackIndex]);
|
|
12035
|
-
const scrollNext = (0,
|
|
12380
|
+
const scrollNext = (0, import_react47.useCallback)(() => {
|
|
12036
12381
|
if (count <= 0) return;
|
|
12037
12382
|
if (loopActive) {
|
|
12038
12383
|
if (trackIndex < 1 || trackIndex > count) return;
|
|
@@ -12045,23 +12390,12 @@ function Carousel({
|
|
|
12045
12390
|
setTrackIndex(index + 1);
|
|
12046
12391
|
}
|
|
12047
12392
|
}, [commitLogical, count, index, loopActive, trackIndex]);
|
|
12048
|
-
const onTrackSettled = (0,
|
|
12393
|
+
const onTrackSettled = (0, import_react47.useCallback)(() => {
|
|
12049
12394
|
if (!loopActive) return;
|
|
12050
|
-
if (trackIndex === 0)
|
|
12051
|
-
|
|
12052
|
-
|
|
12053
|
-
|
|
12054
|
-
requestAnimationFrame(() => setInstant(false));
|
|
12055
|
-
});
|
|
12056
|
-
} else if (trackIndex === count + 1) {
|
|
12057
|
-
setInstant(true);
|
|
12058
|
-
setTrackIndex(1);
|
|
12059
|
-
requestAnimationFrame(() => {
|
|
12060
|
-
requestAnimationFrame(() => setInstant(false));
|
|
12061
|
-
});
|
|
12062
|
-
}
|
|
12063
|
-
}, [count, loopActive, trackIndex]);
|
|
12064
|
-
const ctx = (0, import_react45.useMemo)(
|
|
12395
|
+
if (trackIndex === 0) snapTrackTo(count);
|
|
12396
|
+
else if (trackIndex === count + 1) snapTrackTo(1);
|
|
12397
|
+
}, [count, loopActive, snapTrackTo, trackIndex]);
|
|
12398
|
+
const ctx = (0, import_react47.useMemo)(
|
|
12065
12399
|
() => ({
|
|
12066
12400
|
index,
|
|
12067
12401
|
count,
|
|
@@ -12116,7 +12450,7 @@ function Carousel({
|
|
|
12116
12450
|
break;
|
|
12117
12451
|
}
|
|
12118
12452
|
};
|
|
12119
|
-
return /* @__PURE__ */ (0,
|
|
12453
|
+
return /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(CarouselContext.Provider, { value: ctx, children: /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(
|
|
12120
12454
|
"div",
|
|
12121
12455
|
{
|
|
12122
12456
|
"data-refineui": "carousel",
|
|
@@ -12140,21 +12474,21 @@ function CarouselContent({ className, children, ...props }) {
|
|
|
12140
12474
|
instant,
|
|
12141
12475
|
onTrackSettled
|
|
12142
12476
|
} = useCarouselContext("CarouselContent");
|
|
12143
|
-
const viewportRef = (0,
|
|
12144
|
-
const dragStartX = (0,
|
|
12145
|
-
const [dragPx, setDragPx] = (0,
|
|
12146
|
-
const [dragging, setDragging] = (0,
|
|
12147
|
-
const slides =
|
|
12477
|
+
const viewportRef = (0, import_react47.useRef)(null);
|
|
12478
|
+
const dragStartX = (0, import_react47.useRef)(null);
|
|
12479
|
+
const [dragPx, setDragPx] = (0, import_react47.useState)(0);
|
|
12480
|
+
const [dragging, setDragging] = (0, import_react47.useState)(false);
|
|
12481
|
+
const slides = import_react47.Children.toArray(children).filter(import_react47.isValidElement);
|
|
12148
12482
|
const slideCount = slides.length;
|
|
12149
|
-
(0,
|
|
12483
|
+
(0, import_react47.useEffect)(() => {
|
|
12150
12484
|
setCount(slideCount);
|
|
12151
12485
|
}, [setCount, slideCount]);
|
|
12152
12486
|
const trackSlides = loop && slides.length > 1 ? [
|
|
12153
|
-
(0,
|
|
12487
|
+
(0, import_react47.cloneElement)(slides[slides.length - 1], { key: "__carousel-clone-last" }),
|
|
12154
12488
|
...slides,
|
|
12155
|
-
(0,
|
|
12489
|
+
(0, import_react47.cloneElement)(slides[0], { key: "__carousel-clone-first" })
|
|
12156
12490
|
] : slides;
|
|
12157
|
-
const endDrag = (0,
|
|
12491
|
+
const endDrag = (0, import_react47.useCallback)(
|
|
12158
12492
|
(clientX) => {
|
|
12159
12493
|
if (dragStartX.current == null) return;
|
|
12160
12494
|
const width = viewportRef.current?.offsetWidth ?? 1;
|
|
@@ -12203,7 +12537,7 @@ function CarouselContent({ className, children, ...props }) {
|
|
|
12203
12537
|
};
|
|
12204
12538
|
const animated = !dragging && !instant;
|
|
12205
12539
|
const transform = dragPx !== 0 ? `translate3d(calc(-${trackIndex * 100}% + ${dragPx}px), 0, 0)` : `translate3d(-${trackIndex * 100}%, 0, 0)`;
|
|
12206
|
-
return /* @__PURE__ */ (0,
|
|
12540
|
+
return /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(
|
|
12207
12541
|
"div",
|
|
12208
12542
|
{
|
|
12209
12543
|
ref: viewportRef,
|
|
@@ -12214,7 +12548,7 @@ function CarouselContent({ className, children, ...props }) {
|
|
|
12214
12548
|
onPointerMove,
|
|
12215
12549
|
onPointerUp,
|
|
12216
12550
|
onPointerCancel,
|
|
12217
|
-
children: /* @__PURE__ */ (0,
|
|
12551
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(
|
|
12218
12552
|
"div",
|
|
12219
12553
|
{
|
|
12220
12554
|
"data-refineui": "carousel-track",
|
|
@@ -12229,9 +12563,9 @@ function CarouselContent({ className, children, ...props }) {
|
|
|
12229
12563
|
}
|
|
12230
12564
|
);
|
|
12231
12565
|
}
|
|
12232
|
-
var CarouselItem = (0,
|
|
12566
|
+
var CarouselItem = (0, import_react47.forwardRef)(function CarouselItem2({ className, children, ...props }, ref) {
|
|
12233
12567
|
useCarouselContext("CarouselItem");
|
|
12234
|
-
return /* @__PURE__ */ (0,
|
|
12568
|
+
return /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(
|
|
12235
12569
|
"div",
|
|
12236
12570
|
{
|
|
12237
12571
|
ref,
|
|
@@ -12246,12 +12580,12 @@ var CarouselItem = (0, import_react45.forwardRef)(function CarouselItem2({ class
|
|
|
12246
12580
|
});
|
|
12247
12581
|
function CarouselControls({ className, children, ...props }) {
|
|
12248
12582
|
useCarouselContext("CarouselControls");
|
|
12249
|
-
return /* @__PURE__ */ (0,
|
|
12583
|
+
return /* @__PURE__ */ (0, import_jsx_runtime68.jsx)("div", { "data-refineui": "carousel-controls", className: (0, import_clsx89.clsx)(carouselStyles.controls, className), ...props, children });
|
|
12250
12584
|
}
|
|
12251
12585
|
function CarouselPrevious({ className, disabled, onClick, ...props }) {
|
|
12252
12586
|
const { scrollPrev, canScrollPrev } = useCarouselContext("CarouselPrevious");
|
|
12253
12587
|
const isDisabled = disabled || !canScrollPrev;
|
|
12254
|
-
return /* @__PURE__ */ (0,
|
|
12588
|
+
return /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(
|
|
12255
12589
|
Button,
|
|
12256
12590
|
{
|
|
12257
12591
|
variant: "outline",
|
|
@@ -12267,7 +12601,7 @@ function CarouselPrevious({ className, disabled, onClick, ...props }) {
|
|
|
12267
12601
|
onClick?.(e);
|
|
12268
12602
|
if (!e.defaultPrevented && !isDisabled) scrollPrev();
|
|
12269
12603
|
},
|
|
12270
|
-
children: /* @__PURE__ */ (0,
|
|
12604
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(
|
|
12271
12605
|
WebIcon,
|
|
12272
12606
|
{
|
|
12273
12607
|
name: "chevron-left",
|
|
@@ -12283,7 +12617,7 @@ function CarouselPrevious({ className, disabled, onClick, ...props }) {
|
|
|
12283
12617
|
function CarouselNext({ className, disabled, onClick, ...props }) {
|
|
12284
12618
|
const { scrollNext, canScrollNext } = useCarouselContext("CarouselNext");
|
|
12285
12619
|
const isDisabled = disabled || !canScrollNext;
|
|
12286
|
-
return /* @__PURE__ */ (0,
|
|
12620
|
+
return /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(
|
|
12287
12621
|
Button,
|
|
12288
12622
|
{
|
|
12289
12623
|
variant: "outline",
|
|
@@ -12299,7 +12633,7 @@ function CarouselNext({ className, disabled, onClick, ...props }) {
|
|
|
12299
12633
|
onClick?.(e);
|
|
12300
12634
|
if (!e.defaultPrevented && !isDisabled) scrollNext();
|
|
12301
12635
|
},
|
|
12302
|
-
children: /* @__PURE__ */ (0,
|
|
12636
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(
|
|
12303
12637
|
WebIcon,
|
|
12304
12638
|
{
|
|
12305
12639
|
name: "chevron-right",
|
|
@@ -12314,9 +12648,10 @@ function CarouselNext({ className, disabled, onClick, ...props }) {
|
|
|
12314
12648
|
}
|
|
12315
12649
|
function CarouselIndicators({ className, ...props }) {
|
|
12316
12650
|
const { count, index, scrollTo } = useCarouselContext("CarouselIndicators");
|
|
12317
|
-
const trackRef = (0,
|
|
12318
|
-
const [thumb, setThumb] = (0,
|
|
12319
|
-
const
|
|
12651
|
+
const trackRef = (0, import_react47.useRef)(null);
|
|
12652
|
+
const [thumb, setThumb] = (0, import_react47.useState)({ width: 0, x: 0, ready: false });
|
|
12653
|
+
const [animate, setAnimate] = (0, import_react47.useState)(false);
|
|
12654
|
+
const updateThumb = (0, import_react47.useCallback)(() => {
|
|
12320
12655
|
const el = trackRef.current;
|
|
12321
12656
|
if (!el || count <= 0) {
|
|
12322
12657
|
setThumb({ width: 0, x: 0, ready: false });
|
|
@@ -12331,10 +12666,25 @@ function CarouselIndicators({ className, ...props }) {
|
|
|
12331
12666
|
ready: true
|
|
12332
12667
|
});
|
|
12333
12668
|
}, [count, index]);
|
|
12334
|
-
(0,
|
|
12669
|
+
(0, import_react47.useLayoutEffect)(() => {
|
|
12335
12670
|
updateThumb();
|
|
12336
12671
|
}, [updateThumb]);
|
|
12337
|
-
(0,
|
|
12672
|
+
(0, import_react47.useEffect)(() => {
|
|
12673
|
+
if (!thumb.ready) {
|
|
12674
|
+
setAnimate(false);
|
|
12675
|
+
return;
|
|
12676
|
+
}
|
|
12677
|
+
if (animate) return;
|
|
12678
|
+
let raf2 = 0;
|
|
12679
|
+
const raf1 = requestAnimationFrame(() => {
|
|
12680
|
+
raf2 = requestAnimationFrame(() => setAnimate(true));
|
|
12681
|
+
});
|
|
12682
|
+
return () => {
|
|
12683
|
+
cancelAnimationFrame(raf1);
|
|
12684
|
+
cancelAnimationFrame(raf2);
|
|
12685
|
+
};
|
|
12686
|
+
}, [thumb.ready, animate]);
|
|
12687
|
+
(0, import_react47.useEffect)(() => {
|
|
12338
12688
|
const el = trackRef.current;
|
|
12339
12689
|
if (!el) return;
|
|
12340
12690
|
const ro = new ResizeObserver(() => updateThumb());
|
|
@@ -12346,7 +12696,7 @@ function CarouselIndicators({ className, ...props }) {
|
|
|
12346
12696
|
width: thumb.width,
|
|
12347
12697
|
transform: `translate3d(${thumb.x}px, 0, 0)`
|
|
12348
12698
|
};
|
|
12349
|
-
return /* @__PURE__ */ (0,
|
|
12699
|
+
return /* @__PURE__ */ (0, import_jsx_runtime68.jsxs)(
|
|
12350
12700
|
"div",
|
|
12351
12701
|
{
|
|
12352
12702
|
ref: trackRef,
|
|
@@ -12356,17 +12706,18 @@ function CarouselIndicators({ className, ...props }) {
|
|
|
12356
12706
|
className: (0, import_clsx89.clsx)(carouselStyles.indicators, className),
|
|
12357
12707
|
...props,
|
|
12358
12708
|
children: [
|
|
12359
|
-
/* @__PURE__ */ (0,
|
|
12709
|
+
/* @__PURE__ */ (0, import_jsx_runtime68.jsx)(
|
|
12360
12710
|
"span",
|
|
12361
12711
|
{
|
|
12362
12712
|
"data-refineui": "carousel-indicator-thumb",
|
|
12363
12713
|
"data-ready": thumb.ready ? "true" : void 0,
|
|
12714
|
+
"data-animate": animate ? "true" : void 0,
|
|
12364
12715
|
"aria-hidden": true,
|
|
12365
12716
|
className: carouselStyles.indicatorThumb,
|
|
12366
12717
|
style: thumbStyle
|
|
12367
12718
|
}
|
|
12368
12719
|
),
|
|
12369
|
-
/* @__PURE__ */ (0,
|
|
12720
|
+
/* @__PURE__ */ (0, import_jsx_runtime68.jsx)("div", { "data-refineui": "carousel-indicator-hits", className: carouselStyles.indicatorHitRow, children: Array.from({ length: count }, (_, i) => /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(
|
|
12370
12721
|
"button",
|
|
12371
12722
|
{
|
|
12372
12723
|
type: "button",
|
|
@@ -12387,7 +12738,7 @@ function CarouselIndicators({ className, ...props }) {
|
|
|
12387
12738
|
|
|
12388
12739
|
// src/components/Bubble/Bubble.tsx
|
|
12389
12740
|
var import_clsx91 = require("clsx");
|
|
12390
|
-
var
|
|
12741
|
+
var import_react48 = require("react");
|
|
12391
12742
|
|
|
12392
12743
|
// src/components/Bubble/style.ts
|
|
12393
12744
|
var import_clsx90 = require("clsx");
|
|
@@ -12452,21 +12803,21 @@ var bubbleContentVariantClass = {
|
|
|
12452
12803
|
};
|
|
12453
12804
|
|
|
12454
12805
|
// src/components/Bubble/Bubble.tsx
|
|
12455
|
-
var
|
|
12456
|
-
var BubbleContext = (0,
|
|
12806
|
+
var import_jsx_runtime69 = require("react/jsx-runtime");
|
|
12807
|
+
var BubbleContext = (0, import_react48.createContext)(null);
|
|
12457
12808
|
function useBubbleContext(component) {
|
|
12458
|
-
const value = (0,
|
|
12809
|
+
const value = (0, import_react48.useContext)(BubbleContext);
|
|
12459
12810
|
if (!value) throw new Error(`${component} must be used within Bubble.`);
|
|
12460
12811
|
return value;
|
|
12461
12812
|
}
|
|
12462
12813
|
function isBubbleReactionsElement(node) {
|
|
12463
|
-
return (0,
|
|
12814
|
+
return (0, import_react48.isValidElement)(node) && node.type === BubbleReactions;
|
|
12464
12815
|
}
|
|
12465
12816
|
function partitionBubbleChildren(children) {
|
|
12466
12817
|
const top = [];
|
|
12467
12818
|
const middle = [];
|
|
12468
12819
|
const bottom = [];
|
|
12469
|
-
|
|
12820
|
+
import_react48.Children.forEach(children, (child) => {
|
|
12470
12821
|
if (!isBubbleReactionsElement(child)) {
|
|
12471
12822
|
middle.push(child);
|
|
12472
12823
|
return;
|
|
@@ -12484,7 +12835,7 @@ function partitionBubbleChildren(children) {
|
|
|
12484
12835
|
};
|
|
12485
12836
|
}
|
|
12486
12837
|
function BubbleGroup({ className, ...props }) {
|
|
12487
|
-
return /* @__PURE__ */ (0,
|
|
12838
|
+
return /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(
|
|
12488
12839
|
"div",
|
|
12489
12840
|
{
|
|
12490
12841
|
"data-refineui": "bubble-group",
|
|
@@ -12503,7 +12854,7 @@ function Bubble({
|
|
|
12503
12854
|
}) {
|
|
12504
12855
|
const rootStyle = variant === "ghost" ? style : { maxWidth: BUBBLE_MAX_WIDTH, ...style };
|
|
12505
12856
|
const { top, middle, bottom, hasTop, hasBottom } = partitionBubbleChildren(children);
|
|
12506
|
-
return /* @__PURE__ */ (0,
|
|
12857
|
+
return /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(BubbleContext.Provider, { value: { variant, align }, children: /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(
|
|
12507
12858
|
"div",
|
|
12508
12859
|
{
|
|
12509
12860
|
"data-refineui": "bubble",
|
|
@@ -12518,7 +12869,7 @@ function Bubble({
|
|
|
12518
12869
|
),
|
|
12519
12870
|
style: rootStyle,
|
|
12520
12871
|
...props,
|
|
12521
|
-
children: /* @__PURE__ */ (0,
|
|
12872
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime69.jsxs)("div", { "data-refineui": "bubble-surface", className: bubbleStyles.surface, children: [
|
|
12522
12873
|
middle,
|
|
12523
12874
|
top,
|
|
12524
12875
|
bottom
|
|
@@ -12528,7 +12879,7 @@ function Bubble({
|
|
|
12528
12879
|
}
|
|
12529
12880
|
function BubbleContent({ className, ...props }) {
|
|
12530
12881
|
const { variant } = useBubbleContext("BubbleContent");
|
|
12531
|
-
return /* @__PURE__ */ (0,
|
|
12882
|
+
return /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(
|
|
12532
12883
|
"div",
|
|
12533
12884
|
{
|
|
12534
12885
|
"data-refineui": "bubble-content",
|
|
@@ -12549,7 +12900,7 @@ function BubbleReactions({
|
|
|
12549
12900
|
}) {
|
|
12550
12901
|
const { align: bubbleAlign } = useBubbleContext("BubbleReactions");
|
|
12551
12902
|
const align = alignProp ?? (bubbleAlign === "start" ? "end" : "start");
|
|
12552
|
-
return /* @__PURE__ */ (0,
|
|
12903
|
+
return /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(
|
|
12553
12904
|
"div",
|
|
12554
12905
|
{
|
|
12555
12906
|
"data-refineui": "bubble-reactions",
|
|
@@ -12569,7 +12920,7 @@ function BubbleReactions({
|
|
|
12569
12920
|
// src/components/Stepper/Stepper.tsx
|
|
12570
12921
|
var import_clsx93 = require("clsx");
|
|
12571
12922
|
var import_tokens28 = require("@refineui/tokens");
|
|
12572
|
-
var
|
|
12923
|
+
var import_react49 = require("react");
|
|
12573
12924
|
|
|
12574
12925
|
// src/components/Stepper/style.ts
|
|
12575
12926
|
var import_clsx92 = require("clsx");
|
|
@@ -12677,17 +13028,17 @@ var stepperConnectorVars = {
|
|
|
12677
13028
|
};
|
|
12678
13029
|
|
|
12679
13030
|
// src/components/Stepper/Stepper.tsx
|
|
12680
|
-
var
|
|
12681
|
-
var StepperContext = (0,
|
|
12682
|
-
var StepperItemContext = (0,
|
|
12683
|
-
var StepperListRegistryContext = (0,
|
|
13031
|
+
var import_jsx_runtime70 = require("react/jsx-runtime");
|
|
13032
|
+
var StepperContext = (0, import_react49.createContext)(null);
|
|
13033
|
+
var StepperItemContext = (0, import_react49.createContext)(null);
|
|
13034
|
+
var StepperListRegistryContext = (0, import_react49.createContext)(null);
|
|
12684
13035
|
function useStepperContext(component) {
|
|
12685
|
-
const v = (0,
|
|
13036
|
+
const v = (0, import_react49.useContext)(StepperContext);
|
|
12686
13037
|
if (!v) throw new Error(`${component} must be used within Stepper.`);
|
|
12687
13038
|
return v;
|
|
12688
13039
|
}
|
|
12689
13040
|
function useStepperItemContext(component) {
|
|
12690
|
-
const v = (0,
|
|
13041
|
+
const v = (0, import_react49.useContext)(StepperItemContext);
|
|
12691
13042
|
if (!v) throw new Error(`${component} must be used within StepperItem.`);
|
|
12692
13043
|
return v;
|
|
12693
13044
|
}
|
|
@@ -12707,16 +13058,16 @@ function Stepper({
|
|
|
12707
13058
|
...props
|
|
12708
13059
|
}) {
|
|
12709
13060
|
const isControlled = valueControlled !== void 0;
|
|
12710
|
-
const [internalValue, setInternalValue] = (0,
|
|
13061
|
+
const [internalValue, setInternalValue] = (0, import_react49.useState)(defaultValue);
|
|
12711
13062
|
const value = isControlled ? valueControlled : internalValue;
|
|
12712
|
-
const setValue = (0,
|
|
13063
|
+
const setValue = (0, import_react49.useCallback)(
|
|
12713
13064
|
(next) => {
|
|
12714
13065
|
if (!isControlled) setInternalValue(next);
|
|
12715
13066
|
onValueChange?.(next);
|
|
12716
13067
|
},
|
|
12717
13068
|
[isControlled, onValueChange]
|
|
12718
13069
|
);
|
|
12719
|
-
const ctx = (0,
|
|
13070
|
+
const ctx = (0, import_react49.useMemo)(
|
|
12720
13071
|
() => ({
|
|
12721
13072
|
value,
|
|
12722
13073
|
setValue,
|
|
@@ -12725,7 +13076,7 @@ function Stepper({
|
|
|
12725
13076
|
}),
|
|
12726
13077
|
[value, setValue, orientation, onValueChange, isControlled]
|
|
12727
13078
|
);
|
|
12728
|
-
return /* @__PURE__ */ (0,
|
|
13079
|
+
return /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(StepperContext.Provider, { value: ctx, children: /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
|
|
12729
13080
|
"div",
|
|
12730
13081
|
{
|
|
12731
13082
|
"data-refineui": "stepper",
|
|
@@ -12739,9 +13090,9 @@ function Stepper({
|
|
|
12739
13090
|
}
|
|
12740
13091
|
function StepperList({ className, children, ...props }) {
|
|
12741
13092
|
const { orientation, value } = useStepperContext("StepperList");
|
|
12742
|
-
const cursorRef = (0,
|
|
13093
|
+
const cursorRef = (0, import_react49.useRef)(null);
|
|
12743
13094
|
cursorRef.current = null;
|
|
12744
|
-
const registry = (0,
|
|
13095
|
+
const registry = (0, import_react49.useMemo)(
|
|
12745
13096
|
() => ({
|
|
12746
13097
|
noteItem(itemValue) {
|
|
12747
13098
|
cursorRef.current = itemValue;
|
|
@@ -12753,7 +13104,7 @@ function StepperList({ className, children, ...props }) {
|
|
|
12753
13104
|
}),
|
|
12754
13105
|
[value]
|
|
12755
13106
|
);
|
|
12756
|
-
return /* @__PURE__ */ (0,
|
|
13107
|
+
return /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(StepperListRegistryContext.Provider, { value: registry, children: /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
|
|
12757
13108
|
"ol",
|
|
12758
13109
|
{
|
|
12759
13110
|
"data-refineui": "stepper-list",
|
|
@@ -12778,7 +13129,7 @@ function StepperItem({
|
|
|
12778
13129
|
...props
|
|
12779
13130
|
}) {
|
|
12780
13131
|
const { value, setValue, orientation, interactive } = useStepperContext("StepperItem");
|
|
12781
|
-
const registry = (0,
|
|
13132
|
+
const registry = (0, import_react49.useContext)(StepperListRegistryContext);
|
|
12782
13133
|
registry?.noteItem(itemValue);
|
|
12783
13134
|
const state = resolveState2(itemValue, value);
|
|
12784
13135
|
const canActivate = interactive && !disabled;
|
|
@@ -12794,11 +13145,11 @@ function StepperItem({
|
|
|
12794
13145
|
activate();
|
|
12795
13146
|
}
|
|
12796
13147
|
};
|
|
12797
|
-
const itemCtx = (0,
|
|
13148
|
+
const itemCtx = (0, import_react49.useMemo)(
|
|
12798
13149
|
() => ({ state, disabled }),
|
|
12799
13150
|
[state, disabled]
|
|
12800
13151
|
);
|
|
12801
|
-
return /* @__PURE__ */ (0,
|
|
13152
|
+
return /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(StepperItemContext.Provider, { value: itemCtx, children: /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
|
|
12802
13153
|
"li",
|
|
12803
13154
|
{
|
|
12804
13155
|
"data-refineui": "stepper-item",
|
|
@@ -12826,7 +13177,7 @@ function StepperItem({
|
|
|
12826
13177
|
function StepperIndicator({ className, children, ...props }) {
|
|
12827
13178
|
const { state } = useStepperItemContext("StepperIndicator");
|
|
12828
13179
|
const stateClass = state === "complete" ? stepperStyles.indicatorComplete : state === "current" ? stepperStyles.indicatorCurrent : stepperStyles.indicatorUpcoming;
|
|
12829
|
-
const content = state === "upcoming" ? children : /* @__PURE__ */ (0,
|
|
13180
|
+
const content = state === "upcoming" ? children : /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
|
|
12830
13181
|
WebIcon,
|
|
12831
13182
|
{
|
|
12832
13183
|
name: "checkmark",
|
|
@@ -12837,7 +13188,7 @@ function StepperIndicator({ className, children, ...props }) {
|
|
|
12837
13188
|
className: "items-center justify-center"
|
|
12838
13189
|
}
|
|
12839
13190
|
);
|
|
12840
|
-
return /* @__PURE__ */ (0,
|
|
13191
|
+
return /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
|
|
12841
13192
|
"span",
|
|
12842
13193
|
{
|
|
12843
13194
|
"data-refineui": "stepper-indicator",
|
|
@@ -12852,7 +13203,7 @@ function StepperIndicator({ className, children, ...props }) {
|
|
|
12852
13203
|
function StepperContent({ className, ...props }) {
|
|
12853
13204
|
const { orientation } = useStepperContext("StepperContent");
|
|
12854
13205
|
useStepperItemContext("StepperContent");
|
|
12855
|
-
return /* @__PURE__ */ (0,
|
|
13206
|
+
return /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
|
|
12856
13207
|
"div",
|
|
12857
13208
|
{
|
|
12858
13209
|
"data-refineui": "stepper-content",
|
|
@@ -12868,7 +13219,7 @@ function StepperContent({ className, ...props }) {
|
|
|
12868
13219
|
function StepperTitle({ className, ...props }) {
|
|
12869
13220
|
const { state } = useStepperItemContext("StepperTitle");
|
|
12870
13221
|
const stateClass = state === "complete" ? stepperStyles.titleComplete : state === "current" ? stepperStyles.titleCurrent : stepperStyles.titleUpcoming;
|
|
12871
|
-
return /* @__PURE__ */ (0,
|
|
13222
|
+
return /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
|
|
12872
13223
|
"span",
|
|
12873
13224
|
{
|
|
12874
13225
|
"data-refineui": "stepper-title",
|
|
@@ -12881,7 +13232,7 @@ function StepperTitle({ className, ...props }) {
|
|
|
12881
13232
|
function StepperDescription({ className, ...props }) {
|
|
12882
13233
|
const { state } = useStepperItemContext("StepperDescription");
|
|
12883
13234
|
const stateClass = state === "complete" ? stepperStyles.descriptionComplete : state === "current" ? stepperStyles.descriptionCurrent : stepperStyles.descriptionUpcoming;
|
|
12884
|
-
return /* @__PURE__ */ (0,
|
|
13235
|
+
return /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
|
|
12885
13236
|
"span",
|
|
12886
13237
|
{
|
|
12887
13238
|
"data-refineui": "stepper-description",
|
|
@@ -12893,10 +13244,10 @@ function StepperDescription({ className, ...props }) {
|
|
|
12893
13244
|
}
|
|
12894
13245
|
function StepperSeparator({ className, ...props }) {
|
|
12895
13246
|
const { orientation } = useStepperContext("StepperSeparator");
|
|
12896
|
-
const registry = (0,
|
|
13247
|
+
const registry = (0, import_react49.useContext)(StepperListRegistryContext);
|
|
12897
13248
|
const state = registry?.takeSeparatorState() ?? "upcoming";
|
|
12898
13249
|
const vertical = orientation === "vertical";
|
|
12899
|
-
return /* @__PURE__ */ (0,
|
|
13250
|
+
return /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
|
|
12900
13251
|
"li",
|
|
12901
13252
|
{
|
|
12902
13253
|
"data-refineui": "stepper-separator",
|
|
@@ -12910,7 +13261,7 @@ function StepperSeparator({ className, ...props }) {
|
|
|
12910
13261
|
className
|
|
12911
13262
|
),
|
|
12912
13263
|
...props,
|
|
12913
|
-
children: /* @__PURE__ */ (0,
|
|
13264
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)(
|
|
12914
13265
|
"span",
|
|
12915
13266
|
{
|
|
12916
13267
|
"data-refineui": "stepper-separator-rail",
|
|
@@ -12919,14 +13270,14 @@ function StepperSeparator({ className, ...props }) {
|
|
|
12919
13270
|
vertical ? stepperStyles.separatorRailVertical : stepperStyles.separatorRailHorizontal
|
|
12920
13271
|
),
|
|
12921
13272
|
children: [
|
|
12922
|
-
/* @__PURE__ */ (0,
|
|
13273
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
|
|
12923
13274
|
"span",
|
|
12924
13275
|
{
|
|
12925
13276
|
"data-refineui": "stepper-separator-track",
|
|
12926
13277
|
className: stepperStyles.separatorTrack
|
|
12927
13278
|
}
|
|
12928
13279
|
),
|
|
12929
|
-
/* @__PURE__ */ (0,
|
|
13280
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
|
|
12930
13281
|
"span",
|
|
12931
13282
|
{
|
|
12932
13283
|
"data-refineui": "stepper-separator-fill",
|
|
@@ -12954,7 +13305,7 @@ StepperSeparator.displayName = "StepperSeparator";
|
|
|
12954
13305
|
|
|
12955
13306
|
// src/components/Resizable/Resizable.tsx
|
|
12956
13307
|
var import_clsx95 = require("clsx");
|
|
12957
|
-
var
|
|
13308
|
+
var import_react50 = require("react");
|
|
12958
13309
|
|
|
12959
13310
|
// src/components/Resizable/style.ts
|
|
12960
13311
|
var import_clsx94 = require("clsx");
|
|
@@ -12989,15 +13340,15 @@ var resizableStyles = {
|
|
|
12989
13340
|
};
|
|
12990
13341
|
|
|
12991
13342
|
// src/components/Resizable/Resizable.tsx
|
|
12992
|
-
var
|
|
13343
|
+
var import_jsx_runtime71 = require("react/jsx-runtime");
|
|
12993
13344
|
var KEYBOARD_STEP = 2;
|
|
12994
13345
|
var KEYBOARD_STEP_LARGE = 10;
|
|
12995
13346
|
var DEFAULT_SIZE = 50;
|
|
12996
13347
|
var DEFAULT_MIN_SIZE = 10;
|
|
12997
13348
|
var DEFAULT_MAX_SIZE = 100;
|
|
12998
|
-
var ResizableContext = (0,
|
|
13349
|
+
var ResizableContext = (0, import_react50.createContext)(null);
|
|
12999
13350
|
function useResizableContext(component) {
|
|
13000
|
-
const v = (0,
|
|
13351
|
+
const v = (0, import_react50.useContext)(ResizableContext);
|
|
13001
13352
|
if (!v) throw new Error(`${component} must be used within ResizablePanelGroup.`);
|
|
13002
13353
|
return v;
|
|
13003
13354
|
}
|
|
@@ -13056,13 +13407,13 @@ function ResizablePanelGroup({
|
|
|
13056
13407
|
onLayout,
|
|
13057
13408
|
...props
|
|
13058
13409
|
}) {
|
|
13059
|
-
const groupRef = (0,
|
|
13060
|
-
const panelsRef = (0,
|
|
13061
|
-
const orderCounterRef = (0,
|
|
13062
|
-
const [sizes, setSizes] = (0,
|
|
13063
|
-
const onLayoutRef = (0,
|
|
13410
|
+
const groupRef = (0, import_react50.useRef)(null);
|
|
13411
|
+
const panelsRef = (0, import_react50.useRef)(/* @__PURE__ */ new Map());
|
|
13412
|
+
const orderCounterRef = (0, import_react50.useRef)(0);
|
|
13413
|
+
const [sizes, setSizes] = (0, import_react50.useState)({});
|
|
13414
|
+
const onLayoutRef = (0, import_react50.useRef)(onLayout);
|
|
13064
13415
|
onLayoutRef.current = onLayout;
|
|
13065
|
-
const syncInitialSizes = (0,
|
|
13416
|
+
const syncInitialSizes = (0, import_react50.useCallback)(() => {
|
|
13066
13417
|
const panels = [...panelsRef.current.values()].sort((a, b) => a.order - b.order);
|
|
13067
13418
|
if (panels.length === 0) return;
|
|
13068
13419
|
setSizes((prev) => {
|
|
@@ -13097,7 +13448,7 @@ function ResizablePanelGroup({
|
|
|
13097
13448
|
return base;
|
|
13098
13449
|
});
|
|
13099
13450
|
}, []);
|
|
13100
|
-
const registerPanel = (0,
|
|
13451
|
+
const registerPanel = (0, import_react50.useCallback)(
|
|
13101
13452
|
(panel) => {
|
|
13102
13453
|
const existing = panelsRef.current.get(panel.id);
|
|
13103
13454
|
const order = existing?.order ?? orderCounterRef.current++;
|
|
@@ -13106,7 +13457,7 @@ function ResizablePanelGroup({
|
|
|
13106
13457
|
},
|
|
13107
13458
|
[syncInitialSizes]
|
|
13108
13459
|
);
|
|
13109
|
-
const unregisterPanel = (0,
|
|
13460
|
+
const unregisterPanel = (0, import_react50.useCallback)((id) => {
|
|
13110
13461
|
panelsRef.current.delete(id);
|
|
13111
13462
|
setSizes((prev) => {
|
|
13112
13463
|
if (!(id in prev)) return prev;
|
|
@@ -13115,13 +13466,13 @@ function ResizablePanelGroup({
|
|
|
13115
13466
|
return next;
|
|
13116
13467
|
});
|
|
13117
13468
|
}, []);
|
|
13118
|
-
const getPanel = (0,
|
|
13119
|
-
const emitPanelResize = (0,
|
|
13469
|
+
const getPanel = (0, import_react50.useCallback)((id) => panelsRef.current.get(id), []);
|
|
13470
|
+
const emitPanelResize = (0, import_react50.useCallback)((next) => {
|
|
13120
13471
|
for (const [id, size] of Object.entries(next)) {
|
|
13121
13472
|
panelsRef.current.get(id)?.onResize?.(size);
|
|
13122
13473
|
}
|
|
13123
13474
|
}, []);
|
|
13124
|
-
const resizeBetween = (0,
|
|
13475
|
+
const resizeBetween = (0, import_react50.useCallback)(
|
|
13125
13476
|
(leftId, rightId, deltaPct) => {
|
|
13126
13477
|
setSizes((prev) => {
|
|
13127
13478
|
const next = applyResize(
|
|
@@ -13138,7 +13489,7 @@ function ResizablePanelGroup({
|
|
|
13138
13489
|
},
|
|
13139
13490
|
[emitPanelResize]
|
|
13140
13491
|
);
|
|
13141
|
-
const setBetween = (0,
|
|
13492
|
+
const setBetween = (0, import_react50.useCallback)(
|
|
13142
13493
|
(leftId, rightId, leftSize) => {
|
|
13143
13494
|
setSizes((prev) => {
|
|
13144
13495
|
const left = panelsRef.current.get(leftId);
|
|
@@ -13163,13 +13514,13 @@ function ResizablePanelGroup({
|
|
|
13163
13514
|
},
|
|
13164
13515
|
[emitPanelResize]
|
|
13165
13516
|
);
|
|
13166
|
-
(0,
|
|
13517
|
+
(0, import_react50.useLayoutEffect)(() => {
|
|
13167
13518
|
const ids = orderedPanelIds(panelsRef.current);
|
|
13168
13519
|
if (ids.length === 0) return;
|
|
13169
13520
|
if (ids.some((id) => sizes[id] === void 0)) return;
|
|
13170
13521
|
onLayoutRef.current?.(ids.map((id) => sizes[id]));
|
|
13171
13522
|
}, [sizes]);
|
|
13172
|
-
const ctx = (0,
|
|
13523
|
+
const ctx = (0, import_react50.useMemo)(
|
|
13173
13524
|
() => ({
|
|
13174
13525
|
orientation,
|
|
13175
13526
|
groupRef,
|
|
@@ -13190,7 +13541,7 @@ function ResizablePanelGroup({
|
|
|
13190
13541
|
setBetween
|
|
13191
13542
|
]
|
|
13192
13543
|
);
|
|
13193
|
-
return /* @__PURE__ */ (0,
|
|
13544
|
+
return /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(ResizableContext.Provider, { value: ctx, children: /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
|
|
13194
13545
|
"div",
|
|
13195
13546
|
{
|
|
13196
13547
|
ref: groupRef,
|
|
@@ -13218,11 +13569,11 @@ function ResizablePanel({
|
|
|
13218
13569
|
onResize,
|
|
13219
13570
|
...props
|
|
13220
13571
|
}) {
|
|
13221
|
-
const id = (0,
|
|
13572
|
+
const id = (0, import_react50.useId)();
|
|
13222
13573
|
const { orientation, sizes, registerPanel, unregisterPanel } = useResizableContext("ResizablePanel");
|
|
13223
|
-
const onResizeRef = (0,
|
|
13574
|
+
const onResizeRef = (0, import_react50.useRef)(onResize);
|
|
13224
13575
|
onResizeRef.current = onResize;
|
|
13225
|
-
(0,
|
|
13576
|
+
(0, import_react50.useLayoutEffect)(() => {
|
|
13226
13577
|
registerPanel({
|
|
13227
13578
|
id,
|
|
13228
13579
|
defaultSize,
|
|
@@ -13249,7 +13600,7 @@ function ResizablePanel({
|
|
|
13249
13600
|
flexBasis: 0,
|
|
13250
13601
|
...orientation === "horizontal" ? { minWidth: `${minSize}%` } : { minHeight: `${minSize}%` }
|
|
13251
13602
|
};
|
|
13252
|
-
return /* @__PURE__ */ (0,
|
|
13603
|
+
return /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
|
|
13253
13604
|
"div",
|
|
13254
13605
|
{
|
|
13255
13606
|
"data-refineui": "resizable-panel",
|
|
@@ -13280,11 +13631,11 @@ function ResizableHandle({
|
|
|
13280
13631
|
resizeBetween,
|
|
13281
13632
|
setBetween
|
|
13282
13633
|
} = useResizableContext("ResizableHandle");
|
|
13283
|
-
const handleRef = (0,
|
|
13284
|
-
const [active, setActive] = (0,
|
|
13285
|
-
const [, setAdjacentReady] = (0,
|
|
13286
|
-
const dragRef = (0,
|
|
13287
|
-
(0,
|
|
13634
|
+
const handleRef = (0, import_react50.useRef)(null);
|
|
13635
|
+
const [active, setActive] = (0, import_react50.useState)(false);
|
|
13636
|
+
const [, setAdjacentReady] = (0, import_react50.useState)(false);
|
|
13637
|
+
const dragRef = (0, import_react50.useRef)(null);
|
|
13638
|
+
(0, import_react50.useLayoutEffect)(() => {
|
|
13288
13639
|
setAdjacentReady(true);
|
|
13289
13640
|
}, []);
|
|
13290
13641
|
const adjacent = handleRef.current ? findAdjacentPanelIds(handleRef.current) : { leftId: null, rightId: null };
|
|
@@ -13295,7 +13646,7 @@ function ResizableHandle({
|
|
|
13295
13646
|
const ariaMin = leftPanel?.minSize ?? 0;
|
|
13296
13647
|
const ariaMax = leftPanel?.maxSize ?? DEFAULT_MAX_SIZE;
|
|
13297
13648
|
const defaultKeyshortcuts = orientation === "horizontal" ? "ArrowLeft ArrowRight Home End" : "ArrowUp ArrowDown Home End";
|
|
13298
|
-
const keepFocus = (0,
|
|
13649
|
+
const keepFocus = (0, import_react50.useCallback)(() => {
|
|
13299
13650
|
const el = handleRef.current;
|
|
13300
13651
|
if (el && document.activeElement !== el) {
|
|
13301
13652
|
el.focus({ preventScroll: true });
|
|
@@ -13394,7 +13745,7 @@ function ResizableHandle({
|
|
|
13394
13745
|
resizeBetween(leftId, rightId, delta);
|
|
13395
13746
|
queueMicrotask(keepFocus);
|
|
13396
13747
|
};
|
|
13397
|
-
return /* @__PURE__ */ (0,
|
|
13748
|
+
return /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
|
|
13398
13749
|
"div",
|
|
13399
13750
|
{
|
|
13400
13751
|
ref: handleRef,
|
|
@@ -13424,7 +13775,7 @@ function ResizableHandle({
|
|
|
13424
13775
|
onPointerUp: handlePointerUp,
|
|
13425
13776
|
onPointerCancel: handlePointerUp,
|
|
13426
13777
|
onKeyDown: handleKeyDown,
|
|
13427
|
-
children: withHandle ? /* @__PURE__ */ (0,
|
|
13778
|
+
children: withHandle ? /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
|
|
13428
13779
|
"span",
|
|
13429
13780
|
{
|
|
13430
13781
|
"aria-hidden": true,
|
|
@@ -13440,7 +13791,7 @@ function ResizableHandle({
|
|
|
13440
13791
|
|
|
13441
13792
|
// src/components/SpinButton/SpinButton.tsx
|
|
13442
13793
|
var import_clsx96 = require("clsx");
|
|
13443
|
-
var
|
|
13794
|
+
var import_react51 = require("react");
|
|
13444
13795
|
var import_tokens29 = require("@refineui/tokens");
|
|
13445
13796
|
|
|
13446
13797
|
// src/components/SpinButton/style.ts
|
|
@@ -13464,7 +13815,7 @@ var spinButtonShellClass = formControlShellHeightClass;
|
|
|
13464
13815
|
var spinButtonValueTypo = formControlTypoClass;
|
|
13465
13816
|
|
|
13466
13817
|
// src/components/SpinButton/SpinButton.tsx
|
|
13467
|
-
var
|
|
13818
|
+
var import_jsx_runtime72 = require("react/jsx-runtime");
|
|
13468
13819
|
function SpinButton({
|
|
13469
13820
|
value,
|
|
13470
13821
|
onChange,
|
|
@@ -13478,8 +13829,8 @@ function SpinButton({
|
|
|
13478
13829
|
onKeyDown,
|
|
13479
13830
|
...props
|
|
13480
13831
|
}) {
|
|
13481
|
-
const [draftValue, setDraftValue] = (0,
|
|
13482
|
-
(0,
|
|
13832
|
+
const [draftValue, setDraftValue] = (0, import_react51.useState)(String(value));
|
|
13833
|
+
(0, import_react51.useEffect)(() => {
|
|
13483
13834
|
setDraftValue(String(value));
|
|
13484
13835
|
}, [value]);
|
|
13485
13836
|
const clampValue2 = (next) => {
|
|
@@ -13567,7 +13918,7 @@ function SpinButton({
|
|
|
13567
13918
|
const atMax = max !== void 0 && value >= max;
|
|
13568
13919
|
const atMin = min !== void 0 && value <= min;
|
|
13569
13920
|
const borderClass = disabled ? spinButtonStyles.borderDisabled : spinButtonStyles.borderDefault;
|
|
13570
|
-
return /* @__PURE__ */ (0,
|
|
13921
|
+
return /* @__PURE__ */ (0, import_jsx_runtime72.jsxs)(
|
|
13571
13922
|
"div",
|
|
13572
13923
|
{
|
|
13573
13924
|
role: "spinbutton",
|
|
@@ -13590,7 +13941,7 @@ function SpinButton({
|
|
|
13590
13941
|
...props,
|
|
13591
13942
|
onKeyDown: handleKeyDown,
|
|
13592
13943
|
children: [
|
|
13593
|
-
/* @__PURE__ */ (0,
|
|
13944
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
|
|
13594
13945
|
"div",
|
|
13595
13946
|
{
|
|
13596
13947
|
"aria-live": "polite",
|
|
@@ -13601,7 +13952,7 @@ function SpinButton({
|
|
|
13601
13952
|
disabled ? spinButtonStyles.valueTextDisabled : spinButtonStyles.valueTextDefault,
|
|
13602
13953
|
disabled ? spinButtonStyles.bgDisabled : spinButtonStyles.bgDefault
|
|
13603
13954
|
),
|
|
13604
|
-
children: /* @__PURE__ */ (0,
|
|
13955
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
|
|
13605
13956
|
"input",
|
|
13606
13957
|
{
|
|
13607
13958
|
type: "text",
|
|
@@ -13626,7 +13977,7 @@ function SpinButton({
|
|
|
13626
13977
|
)
|
|
13627
13978
|
}
|
|
13628
13979
|
),
|
|
13629
|
-
/* @__PURE__ */ (0,
|
|
13980
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsxs)(
|
|
13630
13981
|
"div",
|
|
13631
13982
|
{
|
|
13632
13983
|
className: (0, import_clsx96.clsx)(
|
|
@@ -13634,7 +13985,7 @@ function SpinButton({
|
|
|
13634
13985
|
disabled ? spinButtonStyles.bgDisabled : spinButtonStyles.bgDefault
|
|
13635
13986
|
),
|
|
13636
13987
|
children: [
|
|
13637
|
-
/* @__PURE__ */ (0,
|
|
13988
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
|
|
13638
13989
|
"button",
|
|
13639
13990
|
{
|
|
13640
13991
|
type: "button",
|
|
@@ -13646,7 +13997,7 @@ function SpinButton({
|
|
|
13646
13997
|
spinButtonStyles.stepButtonBase,
|
|
13647
13998
|
disabled || atMax ? spinButtonStyles.stepButtonDisabled : spinButtonStyles.stepButtonEnabled
|
|
13648
13999
|
),
|
|
13649
|
-
children: /* @__PURE__ */ (0,
|
|
14000
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
|
|
13650
14001
|
WebIcon,
|
|
13651
14002
|
{
|
|
13652
14003
|
name: "chevron-up",
|
|
@@ -13658,7 +14009,7 @@ function SpinButton({
|
|
|
13658
14009
|
)
|
|
13659
14010
|
}
|
|
13660
14011
|
),
|
|
13661
|
-
/* @__PURE__ */ (0,
|
|
14012
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
|
|
13662
14013
|
"button",
|
|
13663
14014
|
{
|
|
13664
14015
|
type: "button",
|
|
@@ -13670,7 +14021,7 @@ function SpinButton({
|
|
|
13670
14021
|
spinButtonStyles.stepButtonBase,
|
|
13671
14022
|
disabled || atMin ? spinButtonStyles.stepButtonDisabled : spinButtonStyles.stepButtonEnabled
|
|
13672
14023
|
),
|
|
13673
|
-
children: /* @__PURE__ */ (0,
|
|
14024
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
|
|
13674
14025
|
WebIcon,
|
|
13675
14026
|
{
|
|
13676
14027
|
name: "chevron-down",
|
|
@@ -13692,7 +14043,7 @@ function SpinButton({
|
|
|
13692
14043
|
|
|
13693
14044
|
// src/components/Toast/Toast.tsx
|
|
13694
14045
|
var import_clsx98 = require("clsx");
|
|
13695
|
-
var
|
|
14046
|
+
var import_react52 = require("react");
|
|
13696
14047
|
var import_react_dom7 = require("react-dom");
|
|
13697
14048
|
var import_tokens30 = require("@refineui/tokens");
|
|
13698
14049
|
var import_animation7 = require("@refineui/utilities/animation");
|
|
@@ -13729,8 +14080,8 @@ var toastStyles = {
|
|
|
13729
14080
|
};
|
|
13730
14081
|
|
|
13731
14082
|
// src/components/Toast/Toast.tsx
|
|
13732
|
-
var
|
|
13733
|
-
var
|
|
14083
|
+
var import_jsx_runtime73 = require("react/jsx-runtime");
|
|
14084
|
+
var useIsomorphicLayoutEffect7 = typeof document !== "undefined" ? import_react52.useLayoutEffect : import_react52.useEffect;
|
|
13734
14085
|
var ENTER_MS = 20;
|
|
13735
14086
|
var LEAVE_MS = (0, import_animation7.motionMsToNumber)(componentTokens.toast.motion.leave) + 60;
|
|
13736
14087
|
var DEFAULT_DURATION = 4200;
|
|
@@ -13766,7 +14117,7 @@ function subscribeToastStackGap(onChange) {
|
|
|
13766
14117
|
return () => mq.removeEventListener("change", onChange);
|
|
13767
14118
|
}
|
|
13768
14119
|
function useToastStackGapPx() {
|
|
13769
|
-
return (0,
|
|
14120
|
+
return (0, import_react52.useSyncExternalStore)(
|
|
13770
14121
|
subscribeToastStackGap,
|
|
13771
14122
|
readToastStackGapPx,
|
|
13772
14123
|
() => gapPxFromSpacingToken(String(import_tokens30.spacings.sizeLarge))
|
|
@@ -13908,7 +14259,7 @@ var variantIconNames = {
|
|
|
13908
14259
|
error: "error-circle",
|
|
13909
14260
|
warning: "warning"
|
|
13910
14261
|
};
|
|
13911
|
-
var Toast = (0,
|
|
14262
|
+
var Toast = (0, import_react52.forwardRef)(function Toast2(props, ref) {
|
|
13912
14263
|
const { variant = "default", message, iconName, icon, action, className, stackState, style, ...rest } = props;
|
|
13913
14264
|
const domProps = { ...rest };
|
|
13914
14265
|
delete domProps.iconName;
|
|
@@ -13917,7 +14268,7 @@ var Toast = (0, import_react50.forwardRef)(function Toast2(props, ref) {
|
|
|
13917
14268
|
const liveRole = variant === "error" ? "alert" : "status";
|
|
13918
14269
|
const ariaLive = variant === "error" ? void 0 : variant === "warning" ? "assertive" : "polite";
|
|
13919
14270
|
const resolvedIconName = iconName ?? variantIconNames[variant];
|
|
13920
|
-
const iconContent = icon ?? /* @__PURE__ */ (0,
|
|
14271
|
+
const iconContent = icon ?? /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(
|
|
13921
14272
|
WebIcon,
|
|
13922
14273
|
{
|
|
13923
14274
|
name: resolvedIconName,
|
|
@@ -13927,7 +14278,7 @@ var Toast = (0, import_react50.forwardRef)(function Toast2(props, ref) {
|
|
|
13927
14278
|
}
|
|
13928
14279
|
);
|
|
13929
14280
|
const isPrimaryAction = !action || typeof action !== "object" || !("variant" in action) || action.variant === "primary";
|
|
13930
|
-
const actionEl = typeof action === "object" && action !== null && "label" in action ? /* @__PURE__ */ (0,
|
|
14281
|
+
const actionEl = typeof action === "object" && action !== null && "label" in action ? /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(
|
|
13931
14282
|
Button,
|
|
13932
14283
|
{
|
|
13933
14284
|
variant: isPrimaryAction ? "primary" : "outline",
|
|
@@ -13943,7 +14294,7 @@ var Toast = (0, import_react50.forwardRef)(function Toast2(props, ref) {
|
|
|
13943
14294
|
borderColor: (0, import_color12.resolveColorTokenValue)(color.border),
|
|
13944
14295
|
color: (0, import_color12.resolveColorTokenValue)(color.message)
|
|
13945
14296
|
};
|
|
13946
|
-
return /* @__PURE__ */ (0,
|
|
14297
|
+
return /* @__PURE__ */ (0, import_jsx_runtime73.jsxs)(
|
|
13947
14298
|
"div",
|
|
13948
14299
|
{
|
|
13949
14300
|
ref,
|
|
@@ -13956,20 +14307,20 @@ var Toast = (0, import_react50.forwardRef)(function Toast2(props, ref) {
|
|
|
13956
14307
|
style: { ...tokenStyle, ...style },
|
|
13957
14308
|
className: (0, import_clsx98.clsx)(toastStyles.card, className),
|
|
13958
14309
|
children: [
|
|
13959
|
-
/* @__PURE__ */ (0,
|
|
13960
|
-
/* @__PURE__ */ (0,
|
|
14310
|
+
/* @__PURE__ */ (0, import_jsx_runtime73.jsx)("div", { "data-refineui": "toast-icon", className: toastStyles.iconWrap, children: iconContent }),
|
|
14311
|
+
/* @__PURE__ */ (0, import_jsx_runtime73.jsx)("div", { className: toastStyles.contentWrap, children: message != null && message !== "" ? /* @__PURE__ */ (0, import_jsx_runtime73.jsx)("div", { className: toastStyles.message, children: message }) : null }),
|
|
13961
14312
|
action != null && actionEl
|
|
13962
14313
|
]
|
|
13963
14314
|
}
|
|
13964
14315
|
);
|
|
13965
14316
|
});
|
|
13966
14317
|
function SwipeableToast({ record, index, swipeDirections, onSwipeStart, onSwipeEnd }) {
|
|
13967
|
-
const toastRef = (0,
|
|
13968
|
-
const dragStartRef = (0,
|
|
13969
|
-
const axisRef = (0,
|
|
13970
|
-
const offsetRef = (0,
|
|
13971
|
-
const [swiping, setSwiping] = (0,
|
|
13972
|
-
const clearSwipeOffset = (0,
|
|
14318
|
+
const toastRef = (0, import_react52.useRef)(null);
|
|
14319
|
+
const dragStartRef = (0, import_react52.useRef)(null);
|
|
14320
|
+
const axisRef = (0, import_react52.useRef)(null);
|
|
14321
|
+
const offsetRef = (0, import_react52.useRef)({ x: 0, y: 0 });
|
|
14322
|
+
const [swiping, setSwiping] = (0, import_react52.useState)(false);
|
|
14323
|
+
const clearSwipeOffset = (0, import_react52.useCallback)(() => {
|
|
13973
14324
|
const el = toastRef.current;
|
|
13974
14325
|
offsetRef.current = { x: 0, y: 0 };
|
|
13975
14326
|
if (!el) return;
|
|
@@ -14044,7 +14395,7 @@ function SwipeableToast({ record, index, swipeDirections, onSwipeStart, onSwipeE
|
|
|
14044
14395
|
clearSwipeOffset();
|
|
14045
14396
|
onSwipeEnd();
|
|
14046
14397
|
};
|
|
14047
|
-
return /* @__PURE__ */ (0,
|
|
14398
|
+
return /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(
|
|
14048
14399
|
Toast,
|
|
14049
14400
|
{
|
|
14050
14401
|
ref: toastRef,
|
|
@@ -14070,8 +14421,8 @@ function Toaster({
|
|
|
14070
14421
|
swipeDirections,
|
|
14071
14422
|
className
|
|
14072
14423
|
}) {
|
|
14073
|
-
const toasterKeyRef = (0,
|
|
14074
|
-
const isPortalOwner = (0,
|
|
14424
|
+
const toasterKeyRef = (0, import_react52.useRef)(/* @__PURE__ */ Symbol("refineui-toaster"));
|
|
14425
|
+
const isPortalOwner = (0, import_react52.useSyncExternalStore)(
|
|
14075
14426
|
(onStoreChange) => {
|
|
14076
14427
|
toasterOwnerListeners.add(onStoreChange);
|
|
14077
14428
|
return () => toasterOwnerListeners.delete(onStoreChange);
|
|
@@ -14079,15 +14430,15 @@ function Toaster({
|
|
|
14079
14430
|
() => activeToasterKey === toasterKeyRef.current,
|
|
14080
14431
|
() => false
|
|
14081
14432
|
);
|
|
14082
|
-
const [records, setRecords] = (0,
|
|
14083
|
-
const timerMapRef = (0,
|
|
14084
|
-
const pausedRef = (0,
|
|
14085
|
-
const rootRef = (0,
|
|
14086
|
-
const itemRefs = (0,
|
|
14087
|
-
const [layoutTick, setLayoutTick] = (0,
|
|
14433
|
+
const [records, setRecords] = (0, import_react52.useState)([]);
|
|
14434
|
+
const timerMapRef = (0, import_react52.useRef)({});
|
|
14435
|
+
const pausedRef = (0, import_react52.useRef)(/* @__PURE__ */ new Set());
|
|
14436
|
+
const rootRef = (0, import_react52.useRef)(null);
|
|
14437
|
+
const itemRefs = (0, import_react52.useRef)({});
|
|
14438
|
+
const [layoutTick, setLayoutTick] = (0, import_react52.useState)(0);
|
|
14088
14439
|
const stackGapPx = useToastStackGapPx();
|
|
14089
14440
|
const resolvedSwipe = swipeDirections ?? DEFAULT_SWIPE_DIRECTIONS;
|
|
14090
|
-
|
|
14441
|
+
useIsomorphicLayoutEffect7(() => {
|
|
14091
14442
|
const key = toasterKeyRef.current;
|
|
14092
14443
|
activeToasterKey = key;
|
|
14093
14444
|
notifyToasterOwners();
|
|
@@ -14098,13 +14449,13 @@ function Toaster({
|
|
|
14098
14449
|
}
|
|
14099
14450
|
};
|
|
14100
14451
|
}, []);
|
|
14101
|
-
(0,
|
|
14452
|
+
(0, import_react52.useEffect)(() => {
|
|
14102
14453
|
if (!isPortalOwner) return;
|
|
14103
14454
|
return subscribeToasts((next) => {
|
|
14104
14455
|
setRecords(next.slice(0, Math.max(1, maxToasts)));
|
|
14105
14456
|
});
|
|
14106
14457
|
}, [isPortalOwner, maxToasts]);
|
|
14107
|
-
(0,
|
|
14458
|
+
(0, import_react52.useEffect)(() => {
|
|
14108
14459
|
if (!isPortalOwner) return;
|
|
14109
14460
|
for (const rec of records) {
|
|
14110
14461
|
if (rec.phase === "leaving") continue;
|
|
@@ -14126,7 +14477,7 @@ function Toaster({
|
|
|
14126
14477
|
}
|
|
14127
14478
|
}
|
|
14128
14479
|
}, [isPortalOwner, records]);
|
|
14129
|
-
(0,
|
|
14480
|
+
(0, import_react52.useEffect)(() => {
|
|
14130
14481
|
return () => {
|
|
14131
14482
|
for (const handle of Object.values(timerMapRef.current)) {
|
|
14132
14483
|
clearTimeout(handle);
|
|
@@ -14134,7 +14485,7 @@ function Toaster({
|
|
|
14134
14485
|
timerMapRef.current = {};
|
|
14135
14486
|
};
|
|
14136
14487
|
}, []);
|
|
14137
|
-
|
|
14488
|
+
useIsomorphicLayoutEffect7(() => {
|
|
14138
14489
|
if (!isPortalOwner) return;
|
|
14139
14490
|
const root = rootRef.current;
|
|
14140
14491
|
if (!root) return;
|
|
@@ -14152,7 +14503,7 @@ function Toaster({
|
|
|
14152
14503
|
li.style.height = `${slotHeight(idx)}px`;
|
|
14153
14504
|
}
|
|
14154
14505
|
}, [isPortalOwner, layoutTick, records, stackGapPx]);
|
|
14155
|
-
(0,
|
|
14506
|
+
(0, import_react52.useEffect)(() => {
|
|
14156
14507
|
if (!isPortalOwner) return;
|
|
14157
14508
|
const root = rootRef.current;
|
|
14158
14509
|
if (!root) return;
|
|
@@ -14186,7 +14537,7 @@ function Toaster({
|
|
|
14186
14537
|
return null;
|
|
14187
14538
|
}
|
|
14188
14539
|
return (0, import_react_dom7.createPortal)(
|
|
14189
|
-
/* @__PURE__ */ (0,
|
|
14540
|
+
/* @__PURE__ */ (0, import_jsx_runtime73.jsx)(
|
|
14190
14541
|
"ol",
|
|
14191
14542
|
{
|
|
14192
14543
|
ref: rootRef,
|
|
@@ -14197,7 +14548,7 @@ function Toaster({
|
|
|
14197
14548
|
style: {
|
|
14198
14549
|
["--refineui-toast-gap"]: `${stackGapPx}px`
|
|
14199
14550
|
},
|
|
14200
|
-
children: records.map((rec, index) => /* @__PURE__ */ (0,
|
|
14551
|
+
children: records.map((rec, index) => /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(
|
|
14201
14552
|
"li",
|
|
14202
14553
|
{
|
|
14203
14554
|
ref: (node) => {
|
|
@@ -14211,7 +14562,7 @@ function Toaster({
|
|
|
14211
14562
|
["--refineui-toast-z-index"]: String(STACK_Z_BASE - index),
|
|
14212
14563
|
["--refineui-toast-stack-index"]: String(index)
|
|
14213
14564
|
},
|
|
14214
|
-
children: /* @__PURE__ */ (0,
|
|
14565
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime73.jsx)("div", { "data-refineui": "toast-scale-layer", children: /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(
|
|
14215
14566
|
SwipeableToast,
|
|
14216
14567
|
{
|
|
14217
14568
|
record: rec,
|
|
@@ -14232,21 +14583,21 @@ function Toaster({
|
|
|
14232
14583
|
|
|
14233
14584
|
// src/components/Tree/Tree.tsx
|
|
14234
14585
|
var import_clsx100 = require("clsx");
|
|
14235
|
-
var
|
|
14586
|
+
var import_react54 = require("react");
|
|
14236
14587
|
|
|
14237
14588
|
// src/components/Tree/context.ts
|
|
14238
|
-
var
|
|
14589
|
+
var import_react53 = require("react");
|
|
14239
14590
|
var import_tokens31 = require("@refineui/tokens");
|
|
14240
14591
|
var import_animation8 = require("@refineui/utilities/animation");
|
|
14241
14592
|
var TREE_PANEL_MS = Number.parseFloat(import_tokens31.semanticInteraction.duration.accordionPanel) / 1e3;
|
|
14242
14593
|
var TREE_CONTENT_MS = Number.parseFloat(import_tokens31.semanticInteraction.duration.accordionContent) / 1e3;
|
|
14243
14594
|
var TREE_PANEL_EASE = import_tokens31.semanticInteraction.easing.panel;
|
|
14244
14595
|
var TREE_CONTENT_EASE = import_tokens31.semanticInteraction.easing.content;
|
|
14245
|
-
var TreeContext = (0,
|
|
14246
|
-
var TreeItemContext = (0,
|
|
14596
|
+
var TreeContext = (0, import_react53.createContext)(null);
|
|
14597
|
+
var TreeItemContext = (0, import_react53.createContext)(null);
|
|
14247
14598
|
function usePrefersReducedMotion2() {
|
|
14248
|
-
const [reduce, setReduce] = (0,
|
|
14249
|
-
(0,
|
|
14599
|
+
const [reduce, setReduce] = (0, import_react53.useState)(false);
|
|
14600
|
+
(0, import_react53.useEffect)(() => {
|
|
14250
14601
|
const mql = window.matchMedia((0, import_animation8.getReducedMotionQuery)().replace("@media ", ""));
|
|
14251
14602
|
const sync = () => setReduce(mql.matches);
|
|
14252
14603
|
sync();
|
|
@@ -14301,7 +14652,7 @@ var treeItemTypo = {
|
|
|
14301
14652
|
};
|
|
14302
14653
|
|
|
14303
14654
|
// src/components/Tree/Tree.tsx
|
|
14304
|
-
var
|
|
14655
|
+
var import_jsx_runtime74 = require("react/jsx-runtime");
|
|
14305
14656
|
function Tree({
|
|
14306
14657
|
size = "md",
|
|
14307
14658
|
defaultExpanded,
|
|
@@ -14315,29 +14666,29 @@ function Tree({
|
|
|
14315
14666
|
...props
|
|
14316
14667
|
}) {
|
|
14317
14668
|
const reduceMotion = usePrefersReducedMotion2();
|
|
14318
|
-
const [uncontrolledExpanded, setUncontrolledExpanded] = (0,
|
|
14319
|
-
const [uncontrolledSelected, setUncontrolledSelected] = (0,
|
|
14669
|
+
const [uncontrolledExpanded, setUncontrolledExpanded] = (0, import_react54.useState)(() => toExpandedSet(defaultExpanded));
|
|
14670
|
+
const [uncontrolledSelected, setUncontrolledSelected] = (0, import_react54.useState)(defaultSelected ?? null);
|
|
14320
14671
|
const expanded = expandedProp === void 0 ? uncontrolledExpanded : toExpandedSet(expandedProp);
|
|
14321
14672
|
const selected = selectedProp === void 0 ? uncontrolledSelected : selectedProp;
|
|
14322
|
-
const orderRef = (0,
|
|
14323
|
-
const elMapRef = (0,
|
|
14324
|
-
const metaMapRef = (0,
|
|
14325
|
-
const emitExpanded = (0,
|
|
14673
|
+
const orderRef = (0, import_react54.useRef)([]);
|
|
14674
|
+
const elMapRef = (0, import_react54.useRef)(/* @__PURE__ */ new Map());
|
|
14675
|
+
const metaMapRef = (0, import_react54.useRef)(/* @__PURE__ */ new Map());
|
|
14676
|
+
const emitExpanded = (0, import_react54.useCallback)(
|
|
14326
14677
|
(next) => {
|
|
14327
14678
|
if (expandedProp === void 0) setUncontrolledExpanded(next);
|
|
14328
14679
|
onExpandedChange?.(Array.from(next));
|
|
14329
14680
|
},
|
|
14330
14681
|
[expandedProp, onExpandedChange]
|
|
14331
14682
|
);
|
|
14332
|
-
const emitSelected = (0,
|
|
14683
|
+
const emitSelected = (0, import_react54.useCallback)(
|
|
14333
14684
|
(next) => {
|
|
14334
14685
|
if (selectedProp === void 0) setUncontrolledSelected(next);
|
|
14335
14686
|
onSelectedChange?.(next);
|
|
14336
14687
|
},
|
|
14337
14688
|
[onSelectedChange, selectedProp]
|
|
14338
14689
|
);
|
|
14339
|
-
const isExpanded = (0,
|
|
14340
|
-
const toggleExpanded = (0,
|
|
14690
|
+
const isExpanded = (0, import_react54.useCallback)((value) => expanded.has(value), [expanded]);
|
|
14691
|
+
const toggleExpanded = (0, import_react54.useCallback)(
|
|
14341
14692
|
(value) => {
|
|
14342
14693
|
const next = new Set(expanded);
|
|
14343
14694
|
if (next.has(value)) next.delete(value);
|
|
@@ -14346,7 +14697,7 @@ function Tree({
|
|
|
14346
14697
|
},
|
|
14347
14698
|
[emitExpanded, expanded]
|
|
14348
14699
|
);
|
|
14349
|
-
const expand = (0,
|
|
14700
|
+
const expand = (0, import_react54.useCallback)(
|
|
14350
14701
|
(value) => {
|
|
14351
14702
|
if (expanded.has(value)) return;
|
|
14352
14703
|
const next = new Set(expanded);
|
|
@@ -14355,7 +14706,7 @@ function Tree({
|
|
|
14355
14706
|
},
|
|
14356
14707
|
[emitExpanded, expanded]
|
|
14357
14708
|
);
|
|
14358
|
-
const collapse = (0,
|
|
14709
|
+
const collapse = (0, import_react54.useCallback)(
|
|
14359
14710
|
(value) => {
|
|
14360
14711
|
if (!expanded.has(value)) return;
|
|
14361
14712
|
const next = new Set(expanded);
|
|
@@ -14364,13 +14715,13 @@ function Tree({
|
|
|
14364
14715
|
},
|
|
14365
14716
|
[emitExpanded, expanded]
|
|
14366
14717
|
);
|
|
14367
|
-
const select = (0,
|
|
14718
|
+
const select = (0, import_react54.useCallback)(
|
|
14368
14719
|
(value) => {
|
|
14369
14720
|
emitSelected(value);
|
|
14370
14721
|
},
|
|
14371
14722
|
[emitSelected]
|
|
14372
14723
|
);
|
|
14373
|
-
const registerItem = (0,
|
|
14724
|
+
const registerItem = (0, import_react54.useCallback)((value, el, meta) => {
|
|
14374
14725
|
metaMapRef.current.set(value, meta);
|
|
14375
14726
|
if (!orderRef.current.includes(value)) {
|
|
14376
14727
|
orderRef.current.push(value);
|
|
@@ -14382,10 +14733,10 @@ function Tree({
|
|
|
14382
14733
|
orderRef.current = orderRef.current.filter((v) => v !== value);
|
|
14383
14734
|
}
|
|
14384
14735
|
}, []);
|
|
14385
|
-
const focusItem = (0,
|
|
14736
|
+
const focusItem = (0, import_react54.useCallback)((value) => {
|
|
14386
14737
|
elMapRef.current.get(value)?.focus();
|
|
14387
14738
|
}, []);
|
|
14388
|
-
const visibleValues = (0,
|
|
14739
|
+
const visibleValues = (0, import_react54.useCallback)(() => {
|
|
14389
14740
|
const result = [];
|
|
14390
14741
|
const walk = (parent) => {
|
|
14391
14742
|
for (const value of orderRef.current) {
|
|
@@ -14399,7 +14750,7 @@ function Tree({
|
|
|
14399
14750
|
walk(null);
|
|
14400
14751
|
return result;
|
|
14401
14752
|
}, [expanded]);
|
|
14402
|
-
const focusByDelta = (0,
|
|
14753
|
+
const focusByDelta = (0, import_react54.useCallback)(
|
|
14403
14754
|
(currentValue, delta) => {
|
|
14404
14755
|
const list = visibleValues();
|
|
14405
14756
|
const idx = list.indexOf(currentValue);
|
|
@@ -14409,17 +14760,17 @@ function Tree({
|
|
|
14409
14760
|
},
|
|
14410
14761
|
[focusItem, visibleValues]
|
|
14411
14762
|
);
|
|
14412
|
-
const focusFirst = (0,
|
|
14763
|
+
const focusFirst = (0, import_react54.useCallback)(() => {
|
|
14413
14764
|
const list = visibleValues();
|
|
14414
14765
|
if (list[0]) focusItem(list[0]);
|
|
14415
14766
|
}, [focusItem, visibleValues]);
|
|
14416
|
-
const focusLast = (0,
|
|
14767
|
+
const focusLast = (0, import_react54.useCallback)(() => {
|
|
14417
14768
|
const list = visibleValues();
|
|
14418
14769
|
const last = list[list.length - 1];
|
|
14419
14770
|
if (last) focusItem(last);
|
|
14420
14771
|
}, [focusItem, visibleValues]);
|
|
14421
|
-
const getParent = (0,
|
|
14422
|
-
const contextValue = (0,
|
|
14772
|
+
const getParent = (0, import_react54.useCallback)((value) => metaMapRef.current.get(value)?.parentValue ?? null, []);
|
|
14773
|
+
const contextValue = (0, import_react54.useMemo)(
|
|
14423
14774
|
() => ({
|
|
14424
14775
|
size,
|
|
14425
14776
|
isExpanded,
|
|
@@ -14453,7 +14804,7 @@ function Tree({
|
|
|
14453
14804
|
toggleExpanded
|
|
14454
14805
|
]
|
|
14455
14806
|
);
|
|
14456
|
-
return /* @__PURE__ */ (0,
|
|
14807
|
+
return /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(TreeContext.Provider, { value: contextValue, children: /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
|
|
14457
14808
|
"ul",
|
|
14458
14809
|
{
|
|
14459
14810
|
"data-refineui": "tree",
|
|
@@ -14467,21 +14818,21 @@ function Tree({
|
|
|
14467
14818
|
|
|
14468
14819
|
// src/components/Tree/TreeItem.tsx
|
|
14469
14820
|
var import_clsx101 = require("clsx");
|
|
14470
|
-
var
|
|
14471
|
-
var
|
|
14821
|
+
var import_react55 = require("react");
|
|
14822
|
+
var import_jsx_runtime75 = require("react/jsx-runtime");
|
|
14472
14823
|
function TreeItem({ value, disabled = false, className, children, ...props }) {
|
|
14473
|
-
const tree = (0,
|
|
14474
|
-
const parent = (0,
|
|
14824
|
+
const tree = (0, import_react55.useContext)(TreeContext);
|
|
14825
|
+
const parent = (0, import_react55.useContext)(TreeItemContext);
|
|
14475
14826
|
if (!tree) throw new Error("TreeItem must be used within Tree.");
|
|
14476
|
-
const [hasBranch, setHasBranch] = (0,
|
|
14477
|
-
const uid = (0,
|
|
14827
|
+
const [hasBranch, setHasBranch] = (0, import_react55.useState)(false);
|
|
14828
|
+
const uid = (0, import_react55.useId)().replace(/:/g, "");
|
|
14478
14829
|
const depth = parent ? parent.depth + 1 : 0;
|
|
14479
14830
|
const parentValue = parent?.value ?? null;
|
|
14480
14831
|
const expanded = tree.isExpanded(value);
|
|
14481
14832
|
const selected = tree.selected === value;
|
|
14482
14833
|
const triggerId = `tree-trigger-${uid}-${value}`;
|
|
14483
14834
|
const groupId = `tree-group-${uid}-${value}`;
|
|
14484
|
-
const itemContext = (0,
|
|
14835
|
+
const itemContext = (0, import_react55.useMemo)(
|
|
14485
14836
|
() => ({
|
|
14486
14837
|
value,
|
|
14487
14838
|
depth,
|
|
@@ -14496,7 +14847,7 @@ function TreeItem({ value, disabled = false, className, children, ...props }) {
|
|
|
14496
14847
|
}),
|
|
14497
14848
|
[value, depth, parentValue, expanded, selected, disabled, hasBranch, triggerId, groupId]
|
|
14498
14849
|
);
|
|
14499
|
-
return /* @__PURE__ */ (0,
|
|
14850
|
+
return /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(TreeItemContext.Provider, { value: itemContext, children: /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(
|
|
14500
14851
|
"li",
|
|
14501
14852
|
{
|
|
14502
14853
|
"data-refineui": "tree-item",
|
|
@@ -14517,18 +14868,18 @@ function TreeItem({ value, disabled = false, className, children, ...props }) {
|
|
|
14517
14868
|
|
|
14518
14869
|
// src/components/Tree/TreeItemTrigger.tsx
|
|
14519
14870
|
var import_clsx102 = require("clsx");
|
|
14520
|
-
var
|
|
14521
|
-
var
|
|
14871
|
+
var import_react56 = require("react");
|
|
14872
|
+
var import_jsx_runtime76 = require("react/jsx-runtime");
|
|
14522
14873
|
function TreeItemTrigger({ className, children, onClick, onKeyDown, ...props }) {
|
|
14523
|
-
const tree = (0,
|
|
14524
|
-
const item = (0,
|
|
14874
|
+
const tree = (0, import_react56.useContext)(TreeContext);
|
|
14875
|
+
const item = (0, import_react56.useContext)(TreeItemContext);
|
|
14525
14876
|
if (!tree || !item) throw new Error("TreeItemTrigger must be used within TreeItem.");
|
|
14526
14877
|
const iconSize = treeIconSize[tree.size];
|
|
14527
14878
|
const depthIndent = "calc(var(--refineui-spacing-size-large) + var(--refineui-spacing-size-x-small))";
|
|
14528
14879
|
const mainStyle = {
|
|
14529
14880
|
paddingInlineStart: item.depth > 0 ? `calc(${depthIndent} * ${item.depth})` : void 0
|
|
14530
14881
|
};
|
|
14531
|
-
(0,
|
|
14882
|
+
(0, import_react56.useEffect)(() => {
|
|
14532
14883
|
return () => {
|
|
14533
14884
|
tree.registerItem(item.value, null, {
|
|
14534
14885
|
parentValue: item.parentValue,
|
|
@@ -14604,7 +14955,7 @@ function TreeItemTrigger({ className, children, onClick, onKeyDown, ...props })
|
|
|
14604
14955
|
break;
|
|
14605
14956
|
}
|
|
14606
14957
|
};
|
|
14607
|
-
return /* @__PURE__ */ (0,
|
|
14958
|
+
return /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(
|
|
14608
14959
|
"div",
|
|
14609
14960
|
{
|
|
14610
14961
|
ref: setRowRef,
|
|
@@ -14623,8 +14974,8 @@ function TreeItemTrigger({ className, children, onClick, onKeyDown, ...props })
|
|
|
14623
14974
|
className
|
|
14624
14975
|
),
|
|
14625
14976
|
...props,
|
|
14626
|
-
children: /* @__PURE__ */ (0,
|
|
14627
|
-
item.hasBranch ? /* @__PURE__ */ (0,
|
|
14977
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime76.jsxs)("div", { "data-refineui": "tree-item-main", className: treeStyles.rowMain, style: mainStyle, children: [
|
|
14978
|
+
item.hasBranch ? /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(
|
|
14628
14979
|
"button",
|
|
14629
14980
|
{
|
|
14630
14981
|
type: "button",
|
|
@@ -14638,10 +14989,10 @@ function TreeItemTrigger({ className, children, onClick, onKeyDown, ...props })
|
|
|
14638
14989
|
item.expanded && treeStyles.chevronExpanded,
|
|
14639
14990
|
tree.reduceMotion && "transition-none"
|
|
14640
14991
|
),
|
|
14641
|
-
children: /* @__PURE__ */ (0,
|
|
14992
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(WebIcon, { name: "chevron-right", size: iconSize, color: "currentColor", fallback: "\u203A" })
|
|
14642
14993
|
}
|
|
14643
|
-
) : /* @__PURE__ */ (0,
|
|
14644
|
-
/* @__PURE__ */ (0,
|
|
14994
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime76.jsx)("span", { className: treeStyles.chevronSpacer, "aria-hidden": "true" }),
|
|
14995
|
+
/* @__PURE__ */ (0, import_jsx_runtime76.jsx)("span", { className: treeStyles.label, children })
|
|
14645
14996
|
] })
|
|
14646
14997
|
}
|
|
14647
14998
|
);
|
|
@@ -14649,14 +15000,14 @@ function TreeItemTrigger({ className, children, onClick, onKeyDown, ...props })
|
|
|
14649
15000
|
|
|
14650
15001
|
// src/components/Tree/TreeItemContent.tsx
|
|
14651
15002
|
var import_clsx103 = require("clsx");
|
|
14652
|
-
var
|
|
14653
|
-
var
|
|
15003
|
+
var import_react57 = require("react");
|
|
15004
|
+
var import_jsx_runtime77 = require("react/jsx-runtime");
|
|
14654
15005
|
function TreeItemContent({ className, children, ...props }) {
|
|
14655
|
-
const tree = (0,
|
|
14656
|
-
const item = (0,
|
|
15006
|
+
const tree = (0, import_react57.useContext)(TreeContext);
|
|
15007
|
+
const item = (0, import_react57.useContext)(TreeItemContext);
|
|
14657
15008
|
if (!tree || !item) throw new Error("TreeItemContent must be used within TreeItem.");
|
|
14658
15009
|
const { setHasBranch, expanded, groupId, triggerId } = item;
|
|
14659
|
-
(0,
|
|
15010
|
+
(0, import_react57.useLayoutEffect)(() => {
|
|
14660
15011
|
setHasBranch(true);
|
|
14661
15012
|
return () => setHasBranch(false);
|
|
14662
15013
|
}, [setHasBranch]);
|
|
@@ -14671,7 +15022,7 @@ function TreeItemContent({ className, children, ...props }) {
|
|
|
14671
15022
|
transition: tree.reduceMotion ? void 0 : `opacity ${TREE_CONTENT_MS}s ${TREE_CONTENT_EASE}, transform ${TREE_CONTENT_MS}s ${TREE_CONTENT_EASE}`,
|
|
14672
15023
|
pointerEvents: expanded ? void 0 : "none"
|
|
14673
15024
|
};
|
|
14674
|
-
return /* @__PURE__ */ (0,
|
|
15025
|
+
return /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(
|
|
14675
15026
|
"div",
|
|
14676
15027
|
{
|
|
14677
15028
|
ref: (el) => {
|
|
@@ -14682,7 +15033,7 @@ function TreeItemContent({ className, children, ...props }) {
|
|
|
14682
15033
|
"data-refineui": "tree-item-panel",
|
|
14683
15034
|
"aria-hidden": !expanded,
|
|
14684
15035
|
style: gridStyle,
|
|
14685
|
-
children: /* @__PURE__ */ (0,
|
|
15036
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime77.jsx)("div", { className: treeStyles.panel, children: /* @__PURE__ */ (0, import_jsx_runtime77.jsx)("div", { className: treeStyles.panelInner, style: innerMotionStyle, children: /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(
|
|
14686
15037
|
"ul",
|
|
14687
15038
|
{
|
|
14688
15039
|
id: groupId,
|
|
@@ -14700,82 +15051,26 @@ function TreeItemContent({ className, children, ...props }) {
|
|
|
14700
15051
|
|
|
14701
15052
|
// src/components/Tooltip/Tooltip.tsx
|
|
14702
15053
|
var import_clsx105 = require("clsx");
|
|
14703
|
-
var
|
|
15054
|
+
var import_react58 = require("react");
|
|
15055
|
+
var import_tokens34 = require("@refineui/tokens");
|
|
14704
15056
|
var import_color13 = require("@refineui/utilities/color");
|
|
14705
|
-
var
|
|
14706
|
-
|
|
14707
|
-
// src/components/shared/FrostedBeak.tsx
|
|
14708
|
-
var import_tokens33 = require("@refineui/tokens");
|
|
14709
|
-
var import_jsx_runtime77 = require("react/jsx-runtime");
|
|
14710
|
-
var triangleClipPath = "polygon(50% 0, 0 100%, 100% 100%)";
|
|
14711
|
-
function FrostedBeak({ width, height, rotateDeg, borderColor }) {
|
|
14712
|
-
const surfaceStyle = {
|
|
14713
|
-
position: "absolute",
|
|
14714
|
-
inset: 0,
|
|
14715
|
-
clipPath: triangleClipPath
|
|
14716
|
-
};
|
|
14717
|
-
return /* @__PURE__ */ (0, import_jsx_runtime77.jsxs)(
|
|
14718
|
-
"div",
|
|
14719
|
-
{
|
|
14720
|
-
style: {
|
|
14721
|
-
position: "relative",
|
|
14722
|
-
width,
|
|
14723
|
-
height,
|
|
14724
|
-
transform: `rotate(${rotateDeg}deg)`,
|
|
14725
|
-
transformOrigin: "center center"
|
|
14726
|
-
},
|
|
14727
|
-
children: [
|
|
14728
|
-
/* @__PURE__ */ (0, import_jsx_runtime77.jsx)(
|
|
14729
|
-
"span",
|
|
14730
|
-
{
|
|
14731
|
-
"data-refineui": "floating-beak-surface",
|
|
14732
|
-
style: surfaceStyle
|
|
14733
|
-
}
|
|
14734
|
-
),
|
|
14735
|
-
/* @__PURE__ */ (0, import_jsx_runtime77.jsx)(
|
|
14736
|
-
"svg",
|
|
14737
|
-
{
|
|
14738
|
-
width,
|
|
14739
|
-
height,
|
|
14740
|
-
viewBox: "0 0 16 8",
|
|
14741
|
-
fill: "none",
|
|
14742
|
-
"aria-hidden": true,
|
|
14743
|
-
style: { position: "absolute", inset: 0, overflow: "visible" },
|
|
14744
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(
|
|
14745
|
-
"path",
|
|
14746
|
-
{
|
|
14747
|
-
d: "M0 8L8 0L16 8",
|
|
14748
|
-
stroke: borderColor,
|
|
14749
|
-
strokeWidth: import_tokens33.strokeWidths.strokeWidthThin,
|
|
14750
|
-
strokeLinejoin: "round"
|
|
14751
|
-
}
|
|
14752
|
-
)
|
|
14753
|
-
}
|
|
14754
|
-
)
|
|
14755
|
-
]
|
|
14756
|
-
}
|
|
14757
|
-
);
|
|
14758
|
-
}
|
|
15057
|
+
var import_react59 = require("@refineui/utilities/react");
|
|
14759
15058
|
|
|
14760
15059
|
// src/components/Tooltip/style.ts
|
|
14761
|
-
var
|
|
15060
|
+
var import_tokens33 = require("@refineui/tokens");
|
|
14762
15061
|
var import_clsx104 = require("clsx");
|
|
14763
|
-
var
|
|
14764
|
-
var
|
|
14765
|
-
var TOOLTIP_BEAK_OFFSET = import_tokens3.foundationSizes.foundationSize80;
|
|
14766
|
-
var BEAK_BORDER_OVERLAP2 = import_tokens34.strokeWidths.strokeWidthThin;
|
|
14767
|
-
var gap = import_tokens34.spacings.sizeXSmall;
|
|
14768
|
-
var edgeInset = import_tokens34.spacings.sizeMedium;
|
|
15062
|
+
var gap = `calc(${import_tokens3.componentSizes.tooltipBeakHeight} + ${import_tokens33.spacings.sizeXXSmall})`;
|
|
15063
|
+
var TOOLTIP_BEAK_INSET = import_tokens33.spacings.sizeMedium;
|
|
14769
15064
|
var tooltipStyles = {
|
|
14770
15065
|
root: "relative inline-block",
|
|
14771
15066
|
fallbackTrigger: "inline-flex outline-none",
|
|
14772
|
-
/** Positions the floating stack (
|
|
15067
|
+
/** Positions the floating stack (surface + panel), like PopOver `floatingRoot`. */
|
|
14773
15068
|
floating: "pointer-events-none absolute z-refineui-popup",
|
|
14774
15069
|
panelWrap: "relative inline-block max-w-refineui-tooltip-max-width",
|
|
14775
|
-
|
|
15070
|
+
/** Fill, stroke, and shadow come from `FloatingSurface`; the transparent border keeps the box size. */
|
|
14776
15071
|
panel: (0, import_clsx104.clsx)(
|
|
14777
15072
|
componentTextClass(componentTypographyTokens.tooltip),
|
|
14778
|
-
"relative z-0 box-border max-w-refineui-tooltip-max-width whitespace-nowrap rounded-refineui-medium border-refineui-
|
|
15073
|
+
"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"
|
|
14779
15074
|
)
|
|
14780
15075
|
};
|
|
14781
15076
|
function tooltipPlacement(position) {
|
|
@@ -14796,6 +15091,15 @@ function tooltipAlignKey(align) {
|
|
|
14796
15091
|
if (align === "End") return "end";
|
|
14797
15092
|
return "center";
|
|
14798
15093
|
}
|
|
15094
|
+
var beakSideByPlacement2 = {
|
|
15095
|
+
bottom: "top",
|
|
15096
|
+
top: "bottom",
|
|
15097
|
+
left: "right",
|
|
15098
|
+
right: "left"
|
|
15099
|
+
};
|
|
15100
|
+
function tooltipBeakSide(position) {
|
|
15101
|
+
return beakSideByPlacement2[tooltipPlacement(position)];
|
|
15102
|
+
}
|
|
14799
15103
|
function tooltipFloatingStyle(position, align) {
|
|
14800
15104
|
switch (position) {
|
|
14801
15105
|
case "Top":
|
|
@@ -14818,45 +15122,6 @@ function tooltipFloatingStyle(position, align) {
|
|
|
14818
15122
|
return {};
|
|
14819
15123
|
}
|
|
14820
15124
|
}
|
|
14821
|
-
function tooltipBeakWrapperStyle(position, align) {
|
|
14822
|
-
const overlapOffset = `calc(-1 * ${TOOLTIP_BEAK_OFFSET} + ${BEAK_BORDER_OVERLAP2})`;
|
|
14823
|
-
const placement = tooltipPlacement(position);
|
|
14824
|
-
const a = tooltipAlignKey(align);
|
|
14825
|
-
switch (placement) {
|
|
14826
|
-
case "bottom":
|
|
14827
|
-
if (a === "center") return { top: overlapOffset, left: `calc(50% - ${TOOLTIP_BEAK_W} / 2)` };
|
|
14828
|
-
if (a === "start") return { top: overlapOffset, left: edgeInset };
|
|
14829
|
-
return { top: overlapOffset, right: edgeInset };
|
|
14830
|
-
case "top":
|
|
14831
|
-
if (a === "center") return { bottom: overlapOffset, left: `calc(50% - ${TOOLTIP_BEAK_W} / 2)` };
|
|
14832
|
-
if (a === "start") return { bottom: overlapOffset, left: edgeInset };
|
|
14833
|
-
return { bottom: overlapOffset, right: edgeInset };
|
|
14834
|
-
case "left":
|
|
14835
|
-
if (a === "center") return { right: overlapOffset, top: `calc(50% - ${TOOLTIP_BEAK_W} / 2)` };
|
|
14836
|
-
if (a === "start") return { right: overlapOffset, top: edgeInset };
|
|
14837
|
-
return { right: overlapOffset, bottom: edgeInset };
|
|
14838
|
-
case "right":
|
|
14839
|
-
if (a === "center") return { left: overlapOffset, top: `calc(50% - ${TOOLTIP_BEAK_W} / 2)` };
|
|
14840
|
-
if (a === "start") return { left: overlapOffset, top: edgeInset };
|
|
14841
|
-
return { left: overlapOffset, bottom: edgeInset };
|
|
14842
|
-
default:
|
|
14843
|
-
return {};
|
|
14844
|
-
}
|
|
14845
|
-
}
|
|
14846
|
-
function tooltipBeakRotateDeg(position) {
|
|
14847
|
-
switch (tooltipPlacement(position)) {
|
|
14848
|
-
case "bottom":
|
|
14849
|
-
return 0;
|
|
14850
|
-
case "top":
|
|
14851
|
-
return 180;
|
|
14852
|
-
case "left":
|
|
14853
|
-
return -90;
|
|
14854
|
-
case "right":
|
|
14855
|
-
return 90;
|
|
14856
|
-
default:
|
|
14857
|
-
return 0;
|
|
14858
|
-
}
|
|
14859
|
-
}
|
|
14860
15125
|
|
|
14861
15126
|
// src/components/Tooltip/Tooltip.tsx
|
|
14862
15127
|
var import_jsx_runtime78 = require("react/jsx-runtime");
|
|
@@ -14872,10 +15137,11 @@ function Tooltip({
|
|
|
14872
15137
|
className,
|
|
14873
15138
|
...props
|
|
14874
15139
|
}) {
|
|
14875
|
-
const [innerOpen, setInnerOpen] = (0,
|
|
15140
|
+
const [innerOpen, setInnerOpen] = (0, import_react58.useState)(defaultOpen);
|
|
14876
15141
|
const open = ctrlOpen !== void 0 ? ctrlOpen : innerOpen;
|
|
14877
|
-
const tooltipId = (0,
|
|
14878
|
-
const showTimer = (0,
|
|
15142
|
+
const tooltipId = (0, import_react58.useId)();
|
|
15143
|
+
const showTimer = (0, import_react58.useRef)(null);
|
|
15144
|
+
const panelRef = (0, import_react58.useRef)(null);
|
|
14879
15145
|
const setOpen = (next) => {
|
|
14880
15146
|
if (ctrlOpen === void 0) setInnerOpen(next);
|
|
14881
15147
|
onOpenChange?.(next);
|
|
@@ -14899,14 +15165,12 @@ function Tooltip({
|
|
|
14899
15165
|
setOpen(false);
|
|
14900
15166
|
};
|
|
14901
15167
|
const floatingStyle = tooltipFloatingStyle(position, align);
|
|
14902
|
-
const beakWrapStyle = tooltipBeakWrapperStyle(position, align);
|
|
14903
|
-
const beakRot = tooltipBeakRotateDeg(position);
|
|
14904
15168
|
const describedBy = open ? tooltipId : void 0;
|
|
14905
|
-
const mergeEl = (0,
|
|
15169
|
+
const mergeEl = (0, import_react59.getMergeableTriggerChild)(trigger);
|
|
14906
15170
|
let triggerNode;
|
|
14907
15171
|
if (mergeEl != null) {
|
|
14908
15172
|
triggerNode = /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
|
|
14909
|
-
|
|
15173
|
+
import_react59.Slot,
|
|
14910
15174
|
{
|
|
14911
15175
|
"aria-describedby": describedBy,
|
|
14912
15176
|
onMouseEnter: scheduleShow,
|
|
@@ -14945,36 +15209,32 @@ function Tooltip({
|
|
|
14945
15209
|
/* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
|
|
14946
15210
|
"div",
|
|
14947
15211
|
{
|
|
14948
|
-
|
|
14949
|
-
style: { ...beakWrapStyle, width: TOOLTIP_BEAK_W, height: TOOLTIP_BEAK_H },
|
|
14950
|
-
"aria-hidden": true,
|
|
14951
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
|
|
14952
|
-
FrostedBeak,
|
|
14953
|
-
{
|
|
14954
|
-
width: TOOLTIP_BEAK_W,
|
|
14955
|
-
height: TOOLTIP_BEAK_H,
|
|
14956
|
-
rotateDeg: beakRot,
|
|
14957
|
-
borderColor: borderCol
|
|
14958
|
-
}
|
|
14959
|
-
)
|
|
14960
|
-
}
|
|
14961
|
-
),
|
|
14962
|
-
/* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
|
|
14963
|
-
"div",
|
|
14964
|
-
{
|
|
15212
|
+
ref: panelRef,
|
|
14965
15213
|
id: tooltipId,
|
|
14966
15214
|
role: "tooltip",
|
|
14967
15215
|
"data-refineui": "tooltip-panel",
|
|
14968
15216
|
"data-position": position,
|
|
14969
15217
|
"data-align": align,
|
|
14970
15218
|
className: tooltipStyles.panel,
|
|
14971
|
-
style: {
|
|
14972
|
-
backgroundColor: bg,
|
|
14973
|
-
color: fg,
|
|
14974
|
-
borderColor: borderCol
|
|
14975
|
-
},
|
|
15219
|
+
style: { color: fg },
|
|
14976
15220
|
children: content
|
|
14977
15221
|
}
|
|
15222
|
+
),
|
|
15223
|
+
/* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
|
|
15224
|
+
FloatingSurface,
|
|
15225
|
+
{
|
|
15226
|
+
panelRef,
|
|
15227
|
+
side: tooltipBeakSide(position),
|
|
15228
|
+
align: tooltipAlignKey(align),
|
|
15229
|
+
radius: import_tokens34.borderRadii.roundedMedium,
|
|
15230
|
+
beakWidth: import_tokens3.componentSizes.tooltipBeakWidth,
|
|
15231
|
+
beakHeight: import_tokens3.componentSizes.tooltipBeakHeight,
|
|
15232
|
+
tipRadius: import_tokens3.componentSizes.tooltipBeakTipRadius,
|
|
15233
|
+
beakInsetStart: TOOLTIP_BEAK_INSET,
|
|
15234
|
+
beakInsetEnd: TOOLTIP_BEAK_INSET,
|
|
15235
|
+
backgroundColor: bg,
|
|
15236
|
+
borderColor: borderCol
|
|
15237
|
+
}
|
|
14978
15238
|
)
|
|
14979
15239
|
] }) })
|
|
14980
15240
|
] });
|
|
@@ -14982,7 +15242,7 @@ function Tooltip({
|
|
|
14982
15242
|
|
|
14983
15243
|
// src/components/Chart/Chart.tsx
|
|
14984
15244
|
var import_clsx107 = require("clsx");
|
|
14985
|
-
var
|
|
15245
|
+
var import_react60 = require("react");
|
|
14986
15246
|
var import_tokens36 = require("@refineui/tokens");
|
|
14987
15247
|
var import_color14 = require("@refineui/utilities/color");
|
|
14988
15248
|
|
|
@@ -15210,9 +15470,9 @@ function formatAxisTick(value) {
|
|
|
15210
15470
|
|
|
15211
15471
|
// src/components/Chart/Chart.tsx
|
|
15212
15472
|
var import_jsx_runtime79 = require("react/jsx-runtime");
|
|
15213
|
-
var ChartContext = (0,
|
|
15473
|
+
var ChartContext = (0, import_react60.createContext)(null);
|
|
15214
15474
|
function useChartContext(component) {
|
|
15215
|
-
const value = (0,
|
|
15475
|
+
const value = (0, import_react60.useContext)(ChartContext);
|
|
15216
15476
|
if (!value) throw new Error(`${component} must be used within Chart.`);
|
|
15217
15477
|
return value;
|
|
15218
15478
|
}
|
|
@@ -15242,15 +15502,15 @@ function itemState(index, hoverIndex, selectedIndex) {
|
|
|
15242
15502
|
return "default";
|
|
15243
15503
|
}
|
|
15244
15504
|
function isChartTooltipElement(node) {
|
|
15245
|
-
return (0,
|
|
15505
|
+
return (0, import_react60.isValidElement)(node) && node.type === ChartTooltip;
|
|
15246
15506
|
}
|
|
15247
15507
|
function Chart({ className, children, ...props }) {
|
|
15248
|
-
const [hoverIndex, setHoverIndex] = (0,
|
|
15249
|
-
const [selectedIndex, setSelectedIndex] = (0,
|
|
15250
|
-
const [pointer, setPointer] = (0,
|
|
15251
|
-
const [labels, setLabels] = (0,
|
|
15252
|
-
const [series, setSeries] = (0,
|
|
15253
|
-
const context = (0,
|
|
15508
|
+
const [hoverIndex, setHoverIndex] = (0, import_react60.useState)(null);
|
|
15509
|
+
const [selectedIndex, setSelectedIndex] = (0, import_react60.useState)(null);
|
|
15510
|
+
const [pointer, setPointer] = (0, import_react60.useState)(null);
|
|
15511
|
+
const [labels, setLabels] = (0, import_react60.useState)([]);
|
|
15512
|
+
const [series, setSeries] = (0, import_react60.useState)(null);
|
|
15513
|
+
const context = (0, import_react60.useMemo)(
|
|
15254
15514
|
() => ({
|
|
15255
15515
|
hoverIndex,
|
|
15256
15516
|
selectedIndex,
|
|
@@ -15345,7 +15605,7 @@ function ChartPlot({
|
|
|
15345
15605
|
const { pointer, selectedIndex } = useChartContext("ChartPlot");
|
|
15346
15606
|
const svgChildren = [];
|
|
15347
15607
|
const tooltipNodes = [];
|
|
15348
|
-
|
|
15608
|
+
import_react60.Children.forEach(children, (child) => {
|
|
15349
15609
|
if (isChartTooltipElement(child)) tooltipNodes.push(child);
|
|
15350
15610
|
else svgChildren.push(child);
|
|
15351
15611
|
});
|
|
@@ -15484,7 +15744,7 @@ function ChartBars({
|
|
|
15484
15744
|
const barRadius = Math.min(CHART_BAR_RADIUS, barWidth / 2);
|
|
15485
15745
|
const baselineY = plotBaselineY();
|
|
15486
15746
|
const trackHeight = plotHeight();
|
|
15487
|
-
(0,
|
|
15747
|
+
(0, import_react60.useLayoutEffect)(() => {
|
|
15488
15748
|
setSeries({ values, seriesColor, max, align: "bar" });
|
|
15489
15749
|
}, [values, seriesColor, max, setSeries]);
|
|
15490
15750
|
return /* @__PURE__ */ (0, import_jsx_runtime79.jsxs)("g", { "data-refineui": "chart-bars", "data-series-color": seriesColor, className, ...props, children: [
|
|
@@ -15535,14 +15795,14 @@ function ChartLine({
|
|
|
15535
15795
|
...props
|
|
15536
15796
|
}) {
|
|
15537
15797
|
const { hoverIndex, selectedIndex, setSeries } = useChartContext("ChartLine");
|
|
15538
|
-
const gradientId = (0,
|
|
15798
|
+
const gradientId = (0, import_react60.useId)().replace(/:/g, "");
|
|
15539
15799
|
const scaleMax = resolveChartScale(values, max);
|
|
15540
15800
|
const stroke = seriesColorToken(seriesColor);
|
|
15541
15801
|
const coords = linePointCoords(values, scaleMax);
|
|
15542
15802
|
const baselineY = plotBaselineY();
|
|
15543
15803
|
const pointRing = pointStrokeColor();
|
|
15544
15804
|
const linePath = monotoneLinePath(coords);
|
|
15545
|
-
(0,
|
|
15805
|
+
(0, import_react60.useLayoutEffect)(() => {
|
|
15546
15806
|
setSeries({ values, seriesColor, max, align: "line" });
|
|
15547
15807
|
}, [values, seriesColor, max, setSeries]);
|
|
15548
15808
|
return /* @__PURE__ */ (0, import_jsx_runtime79.jsxs)("g", { "data-refineui": "chart-line", "data-series-color": seriesColor, className, ...props, children: [
|
|
@@ -15611,7 +15871,7 @@ function ChartAxisLabels({
|
|
|
15611
15871
|
const { hoverIndex, selectedIndex, setLabels } = useChartContext("ChartAxisLabels");
|
|
15612
15872
|
const count = labels.length;
|
|
15613
15873
|
const centerAt = align === "line" ? linePointCenterRatio : barBandCenterRatio;
|
|
15614
|
-
(0,
|
|
15874
|
+
(0, import_react60.useLayoutEffect)(() => {
|
|
15615
15875
|
setLabels(labels);
|
|
15616
15876
|
}, [labels, setLabels]);
|
|
15617
15877
|
return /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(
|
|
@@ -15680,26 +15940,26 @@ function ChartLegendItem({
|
|
|
15680
15940
|
}
|
|
15681
15941
|
|
|
15682
15942
|
// src/components/Slot/Slot.tsx
|
|
15683
|
-
var
|
|
15943
|
+
var import_react61 = require("@refineui/utilities/react");
|
|
15684
15944
|
|
|
15685
15945
|
// src/components/Collapsible/Collapsible.tsx
|
|
15686
|
-
var
|
|
15946
|
+
var import_react63 = require("react");
|
|
15687
15947
|
var import_clsx108 = require("clsx");
|
|
15688
|
-
var
|
|
15948
|
+
var import_react64 = require("@refineui/utilities/react");
|
|
15689
15949
|
|
|
15690
15950
|
// src/components/Collapsible/context.ts
|
|
15691
|
-
var
|
|
15951
|
+
var import_react62 = require("react");
|
|
15692
15952
|
var import_tokens37 = require("@refineui/tokens");
|
|
15693
15953
|
var import_animation9 = require("@refineui/utilities/animation");
|
|
15694
|
-
var CollapsibleContext = (0,
|
|
15954
|
+
var CollapsibleContext = (0, import_react62.createContext)(null);
|
|
15695
15955
|
function useCollapsibleContext(part) {
|
|
15696
|
-
const value = (0,
|
|
15956
|
+
const value = (0, import_react62.useContext)(CollapsibleContext);
|
|
15697
15957
|
if (!value) throw new Error(`${part} must be used within Collapsible`);
|
|
15698
15958
|
return value;
|
|
15699
15959
|
}
|
|
15700
15960
|
function usePrefersReducedMotion3() {
|
|
15701
|
-
const [reduce, setReduce] = (0,
|
|
15702
|
-
(0,
|
|
15961
|
+
const [reduce, setReduce] = (0, import_react62.useState)(false);
|
|
15962
|
+
(0, import_react62.useEffect)(() => {
|
|
15703
15963
|
const mql = window.matchMedia((0, import_animation9.getReducedMotionQuery)().replace("@media ", ""));
|
|
15704
15964
|
const sync = () => setReduce(mql.matches);
|
|
15705
15965
|
sync();
|
|
@@ -15720,17 +15980,17 @@ var collapsibleStyles = {
|
|
|
15720
15980
|
|
|
15721
15981
|
// src/components/Collapsible/Collapsible.tsx
|
|
15722
15982
|
var import_jsx_runtime80 = require("react/jsx-runtime");
|
|
15723
|
-
var Collapsible = (0,
|
|
15724
|
-
const [uncontrolled, setUncontrolled] = (0,
|
|
15983
|
+
var Collapsible = (0, import_react63.forwardRef)(function Collapsible2({ open: openProp, defaultOpen = false, onOpenChange, asChild = false, className, children, ...props }, ref) {
|
|
15984
|
+
const [uncontrolled, setUncontrolled] = (0, import_react63.useState)(defaultOpen);
|
|
15725
15985
|
const open = openProp ?? uncontrolled;
|
|
15726
|
-
const reactId = (0,
|
|
15986
|
+
const reactId = (0, import_react63.useId)();
|
|
15727
15987
|
const reduceMotion = usePrefersReducedMotion3();
|
|
15728
|
-
const toggle = (0,
|
|
15988
|
+
const toggle = (0, import_react63.useCallback)(() => {
|
|
15729
15989
|
const next = !(openProp ?? uncontrolled);
|
|
15730
15990
|
if (openProp === void 0) setUncontrolled(next);
|
|
15731
15991
|
onOpenChange?.(next);
|
|
15732
15992
|
}, [onOpenChange, openProp, uncontrolled]);
|
|
15733
|
-
const contextValue = (0,
|
|
15993
|
+
const contextValue = (0, import_react63.useMemo)(
|
|
15734
15994
|
() => ({
|
|
15735
15995
|
open,
|
|
15736
15996
|
toggle,
|
|
@@ -15747,9 +16007,9 @@ var Collapsible = (0, import_react61.forwardRef)(function Collapsible2({ open: o
|
|
|
15747
16007
|
"data-refineui": "collapsible",
|
|
15748
16008
|
className
|
|
15749
16009
|
};
|
|
15750
|
-
return /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(CollapsibleContext.Provider, { value: contextValue, children: asChild ? /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
|
|
16010
|
+
return /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(CollapsibleContext.Provider, { value: contextValue, children: asChild ? /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(import_react64.Slot, { ...shared, children }) : /* @__PURE__ */ (0, import_jsx_runtime80.jsx)("div", { ...shared, children }) });
|
|
15751
16011
|
});
|
|
15752
|
-
var CollapsibleTrigger = (0,
|
|
16012
|
+
var CollapsibleTrigger = (0, import_react63.forwardRef)(
|
|
15753
16013
|
function CollapsibleTrigger2({
|
|
15754
16014
|
asChild = false,
|
|
15755
16015
|
onClick,
|
|
@@ -15776,7 +16036,7 @@ var CollapsibleTrigger = (0, import_react61.forwardRef)(
|
|
|
15776
16036
|
if (!event.defaultPrevented) toggle();
|
|
15777
16037
|
}
|
|
15778
16038
|
};
|
|
15779
|
-
if (asChild) return /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
|
|
16039
|
+
if (asChild) return /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(import_react64.Slot, { ...shared, children });
|
|
15780
16040
|
return /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
|
|
15781
16041
|
Button,
|
|
15782
16042
|
{
|
|
@@ -15791,7 +16051,7 @@ var CollapsibleTrigger = (0, import_react61.forwardRef)(
|
|
|
15791
16051
|
);
|
|
15792
16052
|
}
|
|
15793
16053
|
);
|
|
15794
|
-
var CollapsibleContent = (0,
|
|
16054
|
+
var CollapsibleContent = (0, import_react63.forwardRef)(
|
|
15795
16055
|
function CollapsibleContent2({ className, children, style, ...props }, ref) {
|
|
15796
16056
|
const { open, contentId, triggerId, reduceMotion } = useCollapsibleContext("CollapsibleContent");
|
|
15797
16057
|
const gridStyle = {
|
|
@@ -15825,19 +16085,19 @@ var CollapsibleContent = (0, import_react61.forwardRef)(
|
|
|
15825
16085
|
);
|
|
15826
16086
|
|
|
15827
16087
|
// src/components/ContextMenu/ContextMenu.tsx
|
|
15828
|
-
var
|
|
16088
|
+
var import_react65 = require("react");
|
|
15829
16089
|
var import_react_dom8 = require("react-dom");
|
|
15830
16090
|
var import_clsx109 = require("clsx");
|
|
15831
16091
|
var import_tokens38 = require("@refineui/tokens");
|
|
15832
16092
|
var import_animation10 = require("@refineui/utilities/animation");
|
|
15833
|
-
var
|
|
16093
|
+
var import_react66 = require("@refineui/utilities/react");
|
|
15834
16094
|
var import_jsx_runtime81 = require("react/jsx-runtime");
|
|
15835
16095
|
var MENU_ATTR = "data-refineui-context-menu";
|
|
15836
16096
|
var CLOSE_MS = (0, import_animation10.motionMsToNumber)(import_tokens38.semanticInteraction.duration.normal);
|
|
15837
|
-
var MenuContext2 = (0,
|
|
15838
|
-
var SubContext = (0,
|
|
16097
|
+
var MenuContext2 = (0, import_react65.createContext)(null);
|
|
16098
|
+
var SubContext = (0, import_react65.createContext)(null);
|
|
15839
16099
|
function useMenu() {
|
|
15840
|
-
const value = (0,
|
|
16100
|
+
const value = (0, import_react65.useContext)(MenuContext2);
|
|
15841
16101
|
if (!value) throw new Error("Context menu parts must be used within ContextMenu");
|
|
15842
16102
|
return value;
|
|
15843
16103
|
}
|
|
@@ -15854,29 +16114,29 @@ function placeInView(element, x, y) {
|
|
|
15854
16114
|
}
|
|
15855
16115
|
function ContextMenu({ modal = true, onOpenChange, children }) {
|
|
15856
16116
|
void modal;
|
|
15857
|
-
const [open, setOpen] = (0,
|
|
15858
|
-
const [point, setPoint] = (0,
|
|
15859
|
-
const openRef = (0,
|
|
15860
|
-
const onOpenChangeRef = (0,
|
|
16117
|
+
const [open, setOpen] = (0, import_react65.useState)(false);
|
|
16118
|
+
const [point, setPoint] = (0, import_react65.useState)({ x: 0, y: 0 });
|
|
16119
|
+
const openRef = (0, import_react65.useRef)(false);
|
|
16120
|
+
const onOpenChangeRef = (0, import_react65.useRef)(onOpenChange);
|
|
15861
16121
|
openRef.current = open;
|
|
15862
16122
|
onOpenChangeRef.current = onOpenChange;
|
|
15863
|
-
const close = (0,
|
|
16123
|
+
const close = (0, import_react65.useCallback)(() => {
|
|
15864
16124
|
if (!openRef.current) return;
|
|
15865
16125
|
openRef.current = false;
|
|
15866
16126
|
setOpen(false);
|
|
15867
16127
|
onOpenChangeRef.current?.(false);
|
|
15868
16128
|
}, []);
|
|
15869
|
-
const openAt = (0,
|
|
16129
|
+
const openAt = (0, import_react65.useCallback)((x, y) => {
|
|
15870
16130
|
setPoint({ x, y });
|
|
15871
16131
|
const wasOpen = openRef.current;
|
|
15872
16132
|
openRef.current = true;
|
|
15873
16133
|
setOpen(true);
|
|
15874
16134
|
if (!wasOpen) onOpenChangeRef.current?.(true);
|
|
15875
16135
|
}, []);
|
|
15876
|
-
const value = (0,
|
|
16136
|
+
const value = (0, import_react65.useMemo)(() => ({ open, point, openAt, close }), [open, point, openAt, close]);
|
|
15877
16137
|
return /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(MenuContext2.Provider, { value, children });
|
|
15878
16138
|
}
|
|
15879
|
-
var ContextMenuTrigger = (0,
|
|
16139
|
+
var ContextMenuTrigger = (0, import_react65.forwardRef)(function ContextMenuTrigger2({ asChild = false, onContextMenu, children, ...props }, ref) {
|
|
15880
16140
|
const { openAt } = useMenu();
|
|
15881
16141
|
const shared = {
|
|
15882
16142
|
...props,
|
|
@@ -15889,18 +16149,18 @@ var ContextMenuTrigger = (0, import_react63.forwardRef)(function ContextMenuTrig
|
|
|
15889
16149
|
openAt(event.clientX, event.clientY);
|
|
15890
16150
|
}
|
|
15891
16151
|
};
|
|
15892
|
-
if (asChild) return /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(
|
|
16152
|
+
if (asChild) return /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(import_react66.Slot, { ...shared, children });
|
|
15893
16153
|
return /* @__PURE__ */ (0, import_jsx_runtime81.jsx)("span", { ...shared, className: (0, import_clsx109.clsx)(menuStyles.triggerFallback, props.className), children });
|
|
15894
16154
|
});
|
|
15895
16155
|
function ContextMenuPortal({ children }) {
|
|
15896
16156
|
return /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(import_jsx_runtime81.Fragment, { children });
|
|
15897
16157
|
}
|
|
15898
|
-
var ContextMenuContent = (0,
|
|
16158
|
+
var ContextMenuContent = (0, import_react65.forwardRef)(function ContextMenuContent2({ className, style, onPointerDown, children, ...props }, ref) {
|
|
15899
16159
|
const { open, point, close } = useMenu();
|
|
15900
|
-
const localRef = (0,
|
|
15901
|
-
const [shouldRender, setShouldRender] = (0,
|
|
15902
|
-
const [isClosing, setIsClosing] = (0,
|
|
15903
|
-
(0,
|
|
16160
|
+
const localRef = (0, import_react65.useRef)(null);
|
|
16161
|
+
const [shouldRender, setShouldRender] = (0, import_react65.useState)(open);
|
|
16162
|
+
const [isClosing, setIsClosing] = (0, import_react65.useState)(false);
|
|
16163
|
+
(0, import_react65.useEffect)(() => {
|
|
15904
16164
|
if (open) {
|
|
15905
16165
|
setShouldRender(true);
|
|
15906
16166
|
setIsClosing(false);
|
|
@@ -15914,11 +16174,11 @@ var ContextMenuContent = (0, import_react63.forwardRef)(function ContextMenuCont
|
|
|
15914
16174
|
}, CLOSE_MS);
|
|
15915
16175
|
return () => window.clearTimeout(timeout);
|
|
15916
16176
|
}, [open, shouldRender]);
|
|
15917
|
-
(0,
|
|
16177
|
+
(0, import_react65.useLayoutEffect)(() => {
|
|
15918
16178
|
if (!shouldRender || !localRef.current) return;
|
|
15919
16179
|
placeInView(localRef.current, point.x, point.y);
|
|
15920
16180
|
}, [shouldRender, point.x, point.y]);
|
|
15921
|
-
(0,
|
|
16181
|
+
(0, import_react65.useEffect)(() => {
|
|
15922
16182
|
if (!open) return;
|
|
15923
16183
|
const onKey = (event) => {
|
|
15924
16184
|
if (event.key === "Escape") close();
|
|
@@ -15981,7 +16241,7 @@ function runSelect(onSelect, close, disabled) {
|
|
|
15981
16241
|
onSelect?.(selectEvent);
|
|
15982
16242
|
if (!selectEvent.defaultPrevented) close();
|
|
15983
16243
|
}
|
|
15984
|
-
var ContextMenuItem = (0,
|
|
16244
|
+
var ContextMenuItem = (0, import_react65.forwardRef)(function ContextMenuItem2({ disabled = false, description, shortcut, startIcon, endIcon, state = "default", onSelect, className, onClick, onKeyDown, children, ...props }, ref) {
|
|
15985
16245
|
const { close } = useMenu();
|
|
15986
16246
|
const isDisabled = disabled || state === "disabled";
|
|
15987
16247
|
const slotted = startIcon != null || description != null || shortcut != null || endIcon != null;
|
|
@@ -16039,7 +16299,7 @@ var ContextMenuItem = (0, import_react63.forwardRef)(function ContextMenuItem2({
|
|
|
16039
16299
|
}
|
|
16040
16300
|
);
|
|
16041
16301
|
});
|
|
16042
|
-
var ContextMenuSeparator = (0,
|
|
16302
|
+
var ContextMenuSeparator = (0, import_react65.forwardRef)(
|
|
16043
16303
|
function ContextMenuSeparator2({ className, ...props }, ref) {
|
|
16044
16304
|
return /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(
|
|
16045
16305
|
"div",
|
|
@@ -16060,15 +16320,15 @@ function ContextMenuLabel({ className, children, ...props }) {
|
|
|
16060
16320
|
return /* @__PURE__ */ (0, import_jsx_runtime81.jsx)("div", { "data-refineui": "menu-label", className: (0, import_clsx109.clsx)(menuStyles.section, className), ...props, children: /* @__PURE__ */ (0, import_jsx_runtime81.jsx)("span", { className: menuStyles.sectionText, children }) });
|
|
16061
16321
|
}
|
|
16062
16322
|
function ContextMenuSub({ children }) {
|
|
16063
|
-
const [open, setOpen] = (0,
|
|
16064
|
-
const triggerRef = (0,
|
|
16065
|
-
const timer = (0,
|
|
16323
|
+
const [open, setOpen] = (0, import_react65.useState)(false);
|
|
16324
|
+
const triggerRef = (0, import_react65.useRef)(null);
|
|
16325
|
+
const timer = (0, import_react65.useRef)(null);
|
|
16066
16326
|
const clear = () => {
|
|
16067
16327
|
if (timer.current != null) window.clearTimeout(timer.current);
|
|
16068
16328
|
timer.current = null;
|
|
16069
16329
|
};
|
|
16070
|
-
(0,
|
|
16071
|
-
const value = (0,
|
|
16330
|
+
(0, import_react65.useEffect)(() => clear, []);
|
|
16331
|
+
const value = (0, import_react65.useMemo)(
|
|
16072
16332
|
() => ({
|
|
16073
16333
|
open,
|
|
16074
16334
|
triggerRef,
|
|
@@ -16086,11 +16346,11 @@ function ContextMenuSub({ children }) {
|
|
|
16086
16346
|
return /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(SubContext.Provider, { value, children });
|
|
16087
16347
|
}
|
|
16088
16348
|
function useSub2() {
|
|
16089
|
-
const value = (0,
|
|
16349
|
+
const value = (0, import_react65.useContext)(SubContext);
|
|
16090
16350
|
if (!value) throw new Error("ContextMenuSubTrigger must be used within ContextMenuSub");
|
|
16091
16351
|
return value;
|
|
16092
16352
|
}
|
|
16093
|
-
var ContextMenuSubTrigger = (0,
|
|
16353
|
+
var ContextMenuSubTrigger = (0, import_react65.forwardRef)(
|
|
16094
16354
|
function ContextMenuSubTrigger2({ asChild = false, description, startIcon, onMouseEnter, onMouseLeave, onClick, className, children, ...props }, ref) {
|
|
16095
16355
|
const sub = useSub2();
|
|
16096
16356
|
const shared = {
|
|
@@ -16126,7 +16386,7 @@ var ContextMenuSubTrigger = (0, import_react63.forwardRef)(
|
|
|
16126
16386
|
if (!event.defaultPrevented) sub.show();
|
|
16127
16387
|
}
|
|
16128
16388
|
};
|
|
16129
|
-
if (asChild) return /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(
|
|
16389
|
+
if (asChild) return /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(import_react66.Slot, { ...shared, children });
|
|
16130
16390
|
return /* @__PURE__ */ (0, import_jsx_runtime81.jsx)("button", { ...shared, children: /* @__PURE__ */ (0, import_jsx_runtime81.jsxs)("span", { className: menuStyles.row, children: [
|
|
16131
16391
|
startIcon ? /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(
|
|
16132
16392
|
"span",
|
|
@@ -16151,12 +16411,12 @@ var ContextMenuSubTrigger = (0, import_react63.forwardRef)(
|
|
|
16151
16411
|
] }) });
|
|
16152
16412
|
}
|
|
16153
16413
|
);
|
|
16154
|
-
var ContextMenuSubContent = (0,
|
|
16414
|
+
var ContextMenuSubContent = (0, import_react65.forwardRef)(
|
|
16155
16415
|
function ContextMenuSubContent2({ className, style, onPointerDown, onMouseEnter, onMouseLeave, ...props }, ref) {
|
|
16156
16416
|
const sub = useSub2();
|
|
16157
|
-
const localRef = (0,
|
|
16158
|
-
const [side, setSide] = (0,
|
|
16159
|
-
(0,
|
|
16417
|
+
const localRef = (0, import_react65.useRef)(null);
|
|
16418
|
+
const [side, setSide] = (0, import_react65.useState)("right");
|
|
16419
|
+
(0, import_react65.useLayoutEffect)(() => {
|
|
16160
16420
|
const trigger = sub.triggerRef.current;
|
|
16161
16421
|
const element = localRef.current;
|
|
16162
16422
|
if (!sub.open || !trigger || !element) return;
|