@refineui/react 0.0.3 → 0.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +1107 -361
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3779 -245
- package/dist/index.d.ts +3779 -245
- package/dist/index.js +995 -250
- package/dist/index.js.map +1 -1
- package/dist/spec/contract-index.json +1 -1
- package/dist/spec/token-graph.json +143 -35
- package/dist/spec/token-trace-v2.json +109 -19
- package/package.json +1 -1
- package/refineui.css +19 -16
package/dist/index.js
CHANGED
|
@@ -137,13 +137,16 @@ var componentColorTokens = {
|
|
|
137
137
|
},
|
|
138
138
|
tooltip: {
|
|
139
139
|
default: {
|
|
140
|
-
|
|
141
|
-
|
|
140
|
+
/** Menu / Select floating panel semantic */
|
|
141
|
+
background: semanticToken("backgroundPrimary"),
|
|
142
|
+
foreground: semanticToken("foregroundPrimary"),
|
|
143
|
+
border: semanticToken("borderDefault")
|
|
142
144
|
}
|
|
143
145
|
},
|
|
144
146
|
popover: {
|
|
145
147
|
default: {
|
|
146
|
-
|
|
148
|
+
/** Menu / Select floating panel semantic */
|
|
149
|
+
background: semanticToken("backgroundPrimary"),
|
|
147
150
|
foreground: semanticToken("foregroundPrimary"),
|
|
148
151
|
border: semanticToken("borderDefault")
|
|
149
152
|
},
|
|
@@ -322,8 +325,8 @@ var componentColorTokens = {
|
|
|
322
325
|
foreground: semanticToken("foregroundOnSuccess")
|
|
323
326
|
},
|
|
324
327
|
warning: {
|
|
325
|
-
background:
|
|
326
|
-
foreground:
|
|
328
|
+
background: semanticToken("backgroundWarning"),
|
|
329
|
+
foreground: semanticToken("foregroundOnWarning")
|
|
327
330
|
},
|
|
328
331
|
danger: {
|
|
329
332
|
background: semanticToken("backgroundError"),
|
|
@@ -392,7 +395,7 @@ var componentColorTokens = {
|
|
|
392
395
|
pointStroke: semanticToken("backgroundPrimary"),
|
|
393
396
|
cursor: semanticToken("backgroundSurfaceHover"),
|
|
394
397
|
tooltip: {
|
|
395
|
-
background: semanticToken("
|
|
398
|
+
background: semanticToken("backgroundPrimary"),
|
|
396
399
|
foreground: semanticToken("foregroundPrimary"),
|
|
397
400
|
muted: semanticToken("foregroundSecondary"),
|
|
398
401
|
border: semanticToken("borderDefault")
|
|
@@ -445,8 +448,10 @@ var componentColorTokens = {
|
|
|
445
448
|
}
|
|
446
449
|
},
|
|
447
450
|
toast: {
|
|
448
|
-
|
|
451
|
+
/** Menu / Select panel semantic — solid, not frosted */
|
|
452
|
+
background: semanticToken("backgroundPrimary"),
|
|
449
453
|
message: semanticToken("foregroundPrimary"),
|
|
454
|
+
border: semanticToken("borderDefault"),
|
|
450
455
|
accent: {
|
|
451
456
|
default: semanticToken("foregroundPrimary"),
|
|
452
457
|
success: semanticToken("foregroundSuccess"),
|
|
@@ -514,14 +519,15 @@ var componentColorTokens = {
|
|
|
514
519
|
},
|
|
515
520
|
menu: {
|
|
516
521
|
panel: {
|
|
517
|
-
|
|
522
|
+
/** Matches Menu.style panel classes */
|
|
523
|
+
background: semanticToken("backgroundPrimary"),
|
|
518
524
|
border: semanticToken("borderDefault")
|
|
519
525
|
},
|
|
520
526
|
popover: {
|
|
521
527
|
background: "transparent"
|
|
522
528
|
},
|
|
523
529
|
list: {
|
|
524
|
-
background: semanticToken("
|
|
530
|
+
background: semanticToken("backgroundPrimary"),
|
|
525
531
|
border: semanticToken("borderDefault")
|
|
526
532
|
},
|
|
527
533
|
section: semanticToken("foregroundPrimary"),
|
|
@@ -625,8 +631,8 @@ var componentColorTokens = {
|
|
|
625
631
|
},
|
|
626
632
|
divider: {
|
|
627
633
|
line: semanticToken("borderDefault"),
|
|
628
|
-
label:
|
|
629
|
-
icon:
|
|
634
|
+
label: semanticToken("foregroundPrimary"),
|
|
635
|
+
icon: semanticToken("foregroundPrimary")
|
|
630
636
|
},
|
|
631
637
|
avatar: {
|
|
632
638
|
image: {
|
|
@@ -910,6 +916,129 @@ var componentTypographyTokens = {
|
|
|
910
916
|
}
|
|
911
917
|
};
|
|
912
918
|
|
|
919
|
+
// src/tokens/componentTokens.ts
|
|
920
|
+
import { componentSizes, semanticElevations, semanticInteraction } from "@refineui/tokens";
|
|
921
|
+
var motion = {
|
|
922
|
+
fast: {
|
|
923
|
+
duration: semanticInteraction.duration.fast,
|
|
924
|
+
easing: semanticInteraction.easing.easeOut
|
|
925
|
+
},
|
|
926
|
+
indicator: {
|
|
927
|
+
duration: semanticInteraction.duration.medium,
|
|
928
|
+
easing: semanticInteraction.easing.emphasized
|
|
929
|
+
},
|
|
930
|
+
panel: {
|
|
931
|
+
duration: semanticInteraction.duration.panel,
|
|
932
|
+
easing: semanticInteraction.easing.panel
|
|
933
|
+
}
|
|
934
|
+
};
|
|
935
|
+
var componentTokens = {
|
|
936
|
+
color: componentColorTokens,
|
|
937
|
+
typography: componentTypographyTokens,
|
|
938
|
+
motion,
|
|
939
|
+
elevation: semanticElevations,
|
|
940
|
+
toast: {
|
|
941
|
+
color: componentColorTokens.toast,
|
|
942
|
+
typography: componentTypographyTokens.toast,
|
|
943
|
+
size: {
|
|
944
|
+
minWidth: componentSizes.toastMinWidth,
|
|
945
|
+
maxWidth: componentSizes.toastMaxWidth
|
|
946
|
+
},
|
|
947
|
+
elevation: {
|
|
948
|
+
role: "toast",
|
|
949
|
+
foundation: semanticElevations.toast
|
|
950
|
+
},
|
|
951
|
+
motion: {
|
|
952
|
+
enter: semanticInteraction.duration.toastEnter,
|
|
953
|
+
leave: semanticInteraction.duration.toastLeave,
|
|
954
|
+
easing: semanticInteraction.easing.emphasized
|
|
955
|
+
}
|
|
956
|
+
},
|
|
957
|
+
segmentedControl: {
|
|
958
|
+
color: componentColorTokens.segmentedControl,
|
|
959
|
+
typography: componentTypographyTokens.segmentedControl,
|
|
960
|
+
elevation: {
|
|
961
|
+
/** Selected thumb — recipe `shadow-refineui-2` / surface */
|
|
962
|
+
role: "surface",
|
|
963
|
+
foundation: semanticElevations.surface
|
|
964
|
+
},
|
|
965
|
+
motion: {
|
|
966
|
+
/** Indicator slide after first layout */
|
|
967
|
+
indicator: motion.indicator,
|
|
968
|
+
/** Item label color fade */
|
|
969
|
+
itemColor: motion.fast
|
|
970
|
+
}
|
|
971
|
+
},
|
|
972
|
+
button: {
|
|
973
|
+
color: componentColorTokens.button,
|
|
974
|
+
typography: componentTypographyTokens.button,
|
|
975
|
+
motion: {
|
|
976
|
+
pressScale: semanticInteraction.scale.press,
|
|
977
|
+
color: motion.fast
|
|
978
|
+
}
|
|
979
|
+
},
|
|
980
|
+
chip: {
|
|
981
|
+
color: componentColorTokens.chip,
|
|
982
|
+
typography: componentTypographyTokens.chip
|
|
983
|
+
},
|
|
984
|
+
badge: {
|
|
985
|
+
color: componentColorTokens.badge
|
|
986
|
+
},
|
|
987
|
+
alert: {
|
|
988
|
+
color: componentColorTokens.alert,
|
|
989
|
+
typography: componentTypographyTokens.alert
|
|
990
|
+
},
|
|
991
|
+
dialog: {
|
|
992
|
+
color: componentColorTokens.dialog,
|
|
993
|
+
typography: componentTypographyTokens.dialog,
|
|
994
|
+
elevation: {
|
|
995
|
+
role: "modal",
|
|
996
|
+
foundation: semanticElevations.modal
|
|
997
|
+
},
|
|
998
|
+
motion: {
|
|
999
|
+
enterScale: semanticInteraction.scale.dialogEnter,
|
|
1000
|
+
panel: motion.panel
|
|
1001
|
+
}
|
|
1002
|
+
},
|
|
1003
|
+
drawer: {
|
|
1004
|
+
color: componentColorTokens.drawer,
|
|
1005
|
+
typography: componentTypographyTokens.drawer,
|
|
1006
|
+
motion: {
|
|
1007
|
+
panel: motion.panel
|
|
1008
|
+
}
|
|
1009
|
+
},
|
|
1010
|
+
accordion: {
|
|
1011
|
+
color: componentColorTokens.accordion,
|
|
1012
|
+
typography: componentTypographyTokens.accordion,
|
|
1013
|
+
motion: {
|
|
1014
|
+
panel: semanticInteraction.duration.accordionPanel,
|
|
1015
|
+
content: semanticInteraction.duration.accordionContent
|
|
1016
|
+
}
|
|
1017
|
+
},
|
|
1018
|
+
tabs: {
|
|
1019
|
+
// underline indicator shares the same mount/slide motion contract
|
|
1020
|
+
motion: {
|
|
1021
|
+
indicator: motion.indicator
|
|
1022
|
+
}
|
|
1023
|
+
},
|
|
1024
|
+
input: {
|
|
1025
|
+
color: componentColorTokens.input,
|
|
1026
|
+
typography: componentTypographyTokens.formControl
|
|
1027
|
+
},
|
|
1028
|
+
checkbox: {
|
|
1029
|
+
color: componentColorTokens.checkbox
|
|
1030
|
+
},
|
|
1031
|
+
radio: {
|
|
1032
|
+
color: componentColorTokens.radio
|
|
1033
|
+
},
|
|
1034
|
+
switch: {
|
|
1035
|
+
color: componentColorTokens.switch
|
|
1036
|
+
},
|
|
1037
|
+
toggle: {
|
|
1038
|
+
color: componentColorTokens.toggle
|
|
1039
|
+
}
|
|
1040
|
+
};
|
|
1041
|
+
|
|
913
1042
|
// src/typography.ts
|
|
914
1043
|
import { SEMANTIC_TEXT } from "@refineui/tokens";
|
|
915
1044
|
import {
|
|
@@ -942,7 +1071,7 @@ import { SEMANTIC_TEXT as SEMANTIC_TEXT2 } from "@refineui/tokens";
|
|
|
942
1071
|
|
|
943
1072
|
// src/componentSizes.ts
|
|
944
1073
|
import {
|
|
945
|
-
componentSizes,
|
|
1074
|
+
componentSizes as componentSizes2,
|
|
946
1075
|
componentSizeFoundationKeys,
|
|
947
1076
|
foundationSizes
|
|
948
1077
|
} from "@refineui/tokens";
|
|
@@ -3271,7 +3400,7 @@ var SelectContent = forwardRef6(function SelectContent2(props, forwardedRef) {
|
|
|
3271
3400
|
const triggerRect = triggerRef.current.getBoundingClientRect();
|
|
3272
3401
|
const vw = window.innerWidth;
|
|
3273
3402
|
const vh = window.innerHeight;
|
|
3274
|
-
const minW = parsePx(
|
|
3403
|
+
const minW = parsePx(componentSizes2.dropdownMenuWidth, 180);
|
|
3275
3404
|
const width = Math.min(Math.max(triggerRect.width, minW), vw - 2 * CONTENT_MARGIN);
|
|
3276
3405
|
const left = clampNumber(triggerRect.left, [CONTENT_MARGIN, Math.max(CONTENT_MARGIN, vw - width - CONTENT_MARGIN)]);
|
|
3277
3406
|
const gap2 = SIDE_OFFSET;
|
|
@@ -3801,7 +3930,7 @@ import {
|
|
|
3801
3930
|
useState as useState6
|
|
3802
3931
|
} from "react";
|
|
3803
3932
|
import { createPortal as createPortal2 } from "react-dom";
|
|
3804
|
-
import { iconSizes as iconSizes6, semanticInteraction } from "@refineui/tokens";
|
|
3933
|
+
import { iconSizes as iconSizes6, semanticInteraction as semanticInteraction2 } from "@refineui/tokens";
|
|
3805
3934
|
import { motionMsToNumber } from "@refineui/utilities/animation";
|
|
3806
3935
|
import { resolveColorTokenValue as resolveColorTokenValue2 } from "@refineui/utilities/color";
|
|
3807
3936
|
|
|
@@ -3899,9 +4028,9 @@ var dialogStyles = {
|
|
|
3899
4028
|
|
|
3900
4029
|
// src/components/Dialog/Dialog.tsx
|
|
3901
4030
|
import { jsx as jsx25, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
3902
|
-
var PANEL_MS = motionMsToNumber(
|
|
3903
|
-
var SCRIM_MS = motionMsToNumber(
|
|
3904
|
-
var EASING =
|
|
4031
|
+
var PANEL_MS = motionMsToNumber(semanticInteraction2.duration.panel);
|
|
4032
|
+
var SCRIM_MS = motionMsToNumber(semanticInteraction2.duration.overlay);
|
|
4033
|
+
var EASING = semanticInteraction2.easing.panel;
|
|
3905
4034
|
var DialogContext = createContext6(null);
|
|
3906
4035
|
function useDialogContext(component) {
|
|
3907
4036
|
const ctx = useContext6(DialogContext);
|
|
@@ -3994,7 +4123,7 @@ function DialogContent({ className, style, container, scrollable = true, childre
|
|
|
3994
4123
|
transform: entered ? "scale(1) translateY(0)" : "scale(var(--refineui-motion-scale-enter)) translateY(var(--refineui-spacing-size-small))",
|
|
3995
4124
|
transition: `opacity ${PANEL_MS}ms ${EASING}, transform ${PANEL_MS}ms ${EASING}`,
|
|
3996
4125
|
willChange: "opacity, transform",
|
|
3997
|
-
maxWidth: size === "lg" ?
|
|
4126
|
+
maxWidth: size === "lg" ? componentSizes2.dialogMaxWidth : componentSizes2.dialogWidthSm
|
|
3998
4127
|
};
|
|
3999
4128
|
const panelBody = scrollable ? /* @__PURE__ */ jsx25(
|
|
4000
4129
|
ScrollAreaRegion,
|
|
@@ -6030,11 +6159,15 @@ function TabsList({ className, children, ...props }) {
|
|
|
6030
6159
|
width: 0,
|
|
6031
6160
|
ready: false
|
|
6032
6161
|
});
|
|
6162
|
+
const [animate, setAnimate] = useState10(false);
|
|
6163
|
+
const hasMeasuredRef = useRef9(false);
|
|
6033
6164
|
const updateIndicator = useCallback8(() => {
|
|
6034
6165
|
const list = tabListRef.current;
|
|
6035
6166
|
if (!list) return;
|
|
6036
6167
|
const selected = list.querySelector(`${TRIGGER_SELECTOR}[data-selected="true"]`);
|
|
6037
6168
|
if (!selected) {
|
|
6169
|
+
hasMeasuredRef.current = false;
|
|
6170
|
+
setAnimate(false);
|
|
6038
6171
|
setIndicator((prev) => ({ ...prev, width: 0, ready: false }));
|
|
6039
6172
|
return;
|
|
6040
6173
|
}
|
|
@@ -6047,6 +6180,18 @@ function TabsList({ className, children, ...props }) {
|
|
|
6047
6180
|
useLayoutEffect4(() => {
|
|
6048
6181
|
updateIndicator();
|
|
6049
6182
|
}, [updateIndicator, selectedValue, children]);
|
|
6183
|
+
useEffect6(() => {
|
|
6184
|
+
if (!indicator.ready || hasMeasuredRef.current) return;
|
|
6185
|
+
hasMeasuredRef.current = true;
|
|
6186
|
+
let raf2 = 0;
|
|
6187
|
+
const raf1 = requestAnimationFrame(() => {
|
|
6188
|
+
raf2 = requestAnimationFrame(() => setAnimate(true));
|
|
6189
|
+
});
|
|
6190
|
+
return () => {
|
|
6191
|
+
cancelAnimationFrame(raf1);
|
|
6192
|
+
cancelAnimationFrame(raf2);
|
|
6193
|
+
};
|
|
6194
|
+
}, [indicator.ready]);
|
|
6050
6195
|
useEffect6(() => {
|
|
6051
6196
|
const list = tabListRef.current;
|
|
6052
6197
|
if (!list) return;
|
|
@@ -6082,6 +6227,7 @@ function TabsList({ className, children, ...props }) {
|
|
|
6082
6227
|
{
|
|
6083
6228
|
"data-refineui": "tabs-indicator",
|
|
6084
6229
|
"data-ready": indicator.ready ? "true" : void 0,
|
|
6230
|
+
"data-animate": animate ? "true" : void 0,
|
|
6085
6231
|
"aria-hidden": true,
|
|
6086
6232
|
className: tabsStyles.indicator,
|
|
6087
6233
|
style: indicatorStyle
|
|
@@ -6299,6 +6445,8 @@ function SegmentedControl({
|
|
|
6299
6445
|
width: 0,
|
|
6300
6446
|
ready: false
|
|
6301
6447
|
});
|
|
6448
|
+
const [animate, setAnimate] = useState11(false);
|
|
6449
|
+
const hasMeasuredRef = useRef10(false);
|
|
6302
6450
|
const updateIndicator = useCallback9(() => {
|
|
6303
6451
|
const group = groupRef.current;
|
|
6304
6452
|
if (!group) return;
|
|
@@ -6306,6 +6454,8 @@ function SegmentedControl({
|
|
|
6306
6454
|
`${ITEM_SELECTOR}[data-selected="true"]`
|
|
6307
6455
|
);
|
|
6308
6456
|
if (!selected) {
|
|
6457
|
+
hasMeasuredRef.current = false;
|
|
6458
|
+
setAnimate(false);
|
|
6309
6459
|
setIndicator((prev) => ({ ...prev, width: 0, ready: false }));
|
|
6310
6460
|
return;
|
|
6311
6461
|
}
|
|
@@ -6318,6 +6468,18 @@ function SegmentedControl({
|
|
|
6318
6468
|
useLayoutEffect5(() => {
|
|
6319
6469
|
updateIndicator();
|
|
6320
6470
|
}, [updateIndicator, selectedValue, children]);
|
|
6471
|
+
useEffect7(() => {
|
|
6472
|
+
if (!indicator.ready || hasMeasuredRef.current) return;
|
|
6473
|
+
hasMeasuredRef.current = true;
|
|
6474
|
+
let raf2 = 0;
|
|
6475
|
+
const raf1 = requestAnimationFrame(() => {
|
|
6476
|
+
raf2 = requestAnimationFrame(() => setAnimate(true));
|
|
6477
|
+
});
|
|
6478
|
+
return () => {
|
|
6479
|
+
cancelAnimationFrame(raf1);
|
|
6480
|
+
cancelAnimationFrame(raf2);
|
|
6481
|
+
};
|
|
6482
|
+
}, [indicator.ready]);
|
|
6321
6483
|
useEffect7(() => {
|
|
6322
6484
|
const group = groupRef.current;
|
|
6323
6485
|
if (!group) return;
|
|
@@ -6353,6 +6515,7 @@ function SegmentedControl({
|
|
|
6353
6515
|
{
|
|
6354
6516
|
"data-refineui": "segmented-control-indicator",
|
|
6355
6517
|
"data-ready": indicator.ready ? "true" : void 0,
|
|
6518
|
+
"data-animate": animate ? "true" : void 0,
|
|
6356
6519
|
"aria-hidden": true,
|
|
6357
6520
|
className: segmentedControlStyles.indicator,
|
|
6358
6521
|
style: indicatorStyle
|
|
@@ -6524,14 +6687,14 @@ import { clsx as clsx51 } from "clsx";
|
|
|
6524
6687
|
|
|
6525
6688
|
// src/components/Accordion/context.ts
|
|
6526
6689
|
import { createContext as createContext13, useEffect as useEffect8, useState as useState12 } from "react";
|
|
6527
|
-
import { semanticInteraction as
|
|
6690
|
+
import { semanticInteraction as semanticInteraction3 } from "@refineui/tokens";
|
|
6528
6691
|
import { getReducedMotionQuery } from "@refineui/utilities/animation";
|
|
6529
6692
|
var AccordionContext = createContext13(null);
|
|
6530
6693
|
var AccordionItemContext = createContext13(null);
|
|
6531
|
-
var PANEL_HEIGHT_MS = Number.parseFloat(
|
|
6532
|
-
var PANEL_CONTENT_MS = Number.parseFloat(
|
|
6533
|
-
var PANEL_HEIGHT_EASE =
|
|
6534
|
-
var PANEL_CONTENT_EASE =
|
|
6694
|
+
var PANEL_HEIGHT_MS = Number.parseFloat(semanticInteraction3.duration.accordionPanel) / 1e3;
|
|
6695
|
+
var PANEL_CONTENT_MS = Number.parseFloat(semanticInteraction3.duration.accordionContent) / 1e3;
|
|
6696
|
+
var PANEL_HEIGHT_EASE = semanticInteraction3.easing.panel;
|
|
6697
|
+
var PANEL_CONTENT_EASE = semanticInteraction3.easing.content;
|
|
6535
6698
|
function usePrefersReducedMotion() {
|
|
6536
6699
|
const [reduce, setReduce] = useState12(false);
|
|
6537
6700
|
useEffect8(() => {
|
|
@@ -7640,8 +7803,8 @@ function DividerCircleGlyph() {
|
|
|
7640
7803
|
"aria-hidden": true,
|
|
7641
7804
|
className: dividerStyles.iconCircle,
|
|
7642
7805
|
style: {
|
|
7643
|
-
width:
|
|
7644
|
-
height:
|
|
7806
|
+
width: componentSizes2.dividerIconCircleDiameter,
|
|
7807
|
+
height: componentSizes2.dividerIconCircleDiameter
|
|
7645
7808
|
}
|
|
7646
7809
|
}
|
|
7647
7810
|
);
|
|
@@ -8025,7 +8188,7 @@ import {
|
|
|
8025
8188
|
useState as useState15
|
|
8026
8189
|
} from "react";
|
|
8027
8190
|
import { createPortal as createPortal3 } from "react-dom";
|
|
8028
|
-
import { iconSizes as iconSizes13, semanticInteraction as
|
|
8191
|
+
import { iconSizes as iconSizes13, semanticInteraction as semanticInteraction4 } from "@refineui/tokens";
|
|
8029
8192
|
import { motionMsToNumber as motionMsToNumber2 } from "@refineui/utilities/animation";
|
|
8030
8193
|
import { resolveColorTokenValue as resolveColorTokenValue6 } from "@refineui/utilities/color";
|
|
8031
8194
|
import { acquireBodyScrollLock as acquireBodyScrollLock2 } from "@refineui/utilities/react";
|
|
@@ -8066,9 +8229,9 @@ var drawerStyles = {
|
|
|
8066
8229
|
|
|
8067
8230
|
// src/components/Drawer/Drawer.tsx
|
|
8068
8231
|
import { jsx as jsx52, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
8069
|
-
var PANEL_MS2 = motionMsToNumber2(
|
|
8070
|
-
var SCRIM_MS2 = motionMsToNumber2(
|
|
8071
|
-
var EASING2 =
|
|
8232
|
+
var PANEL_MS2 = motionMsToNumber2(semanticInteraction4.duration.panel);
|
|
8233
|
+
var SCRIM_MS2 = motionMsToNumber2(semanticInteraction4.duration.overlay);
|
|
8234
|
+
var EASING2 = semanticInteraction4.easing.panel;
|
|
8072
8235
|
var DrawerContext = createContext15(null);
|
|
8073
8236
|
function useDrawerContext(component) {
|
|
8074
8237
|
const ctx = useContext17(DrawerContext);
|
|
@@ -8091,11 +8254,11 @@ function useDrawerOpenState(openProp, defaultOpen, onOpenChange) {
|
|
|
8091
8254
|
function widthToken(s) {
|
|
8092
8255
|
switch (s) {
|
|
8093
8256
|
case "md":
|
|
8094
|
-
return
|
|
8257
|
+
return componentSizes2.drawerWidthMd;
|
|
8095
8258
|
case "lg":
|
|
8096
|
-
return
|
|
8259
|
+
return componentSizes2.drawerWidthLg;
|
|
8097
8260
|
default:
|
|
8098
|
-
return
|
|
8261
|
+
return componentSizes2.drawerWidthSm;
|
|
8099
8262
|
}
|
|
8100
8263
|
}
|
|
8101
8264
|
function Drawer({
|
|
@@ -8409,7 +8572,6 @@ function DrawerClose({
|
|
|
8409
8572
|
// src/components/Dropdown/Dropdown.tsx
|
|
8410
8573
|
import { clsx as clsx70 } from "clsx";
|
|
8411
8574
|
import {
|
|
8412
|
-
cloneElement as cloneElement2,
|
|
8413
8575
|
createContext as createContext16,
|
|
8414
8576
|
useCallback as useCallback12,
|
|
8415
8577
|
useContext as useContext18,
|
|
@@ -8444,7 +8606,7 @@ var dropdownStyles = {
|
|
|
8444
8606
|
};
|
|
8445
8607
|
|
|
8446
8608
|
// src/components/Dropdown/Dropdown.tsx
|
|
8447
|
-
import { acquireBodyScrollLock as acquireBodyScrollLock3,
|
|
8609
|
+
import { Slot, acquireBodyScrollLock as acquireBodyScrollLock3, getMergeableTriggerChild } from "@refineui/utilities/react";
|
|
8448
8610
|
|
|
8449
8611
|
// src/components/Dropdown/positioning.ts
|
|
8450
8612
|
import { useEffect as useEffect10, useLayoutEffect as useLayoutEffect6 } from "react";
|
|
@@ -8628,27 +8790,27 @@ function DropdownTrigger({ children, className, ...props }) {
|
|
|
8628
8790
|
};
|
|
8629
8791
|
const mergeEl = getMergeableTriggerChild(children);
|
|
8630
8792
|
if (mergeEl) {
|
|
8631
|
-
const el = mergeEl;
|
|
8632
8793
|
const passthrough = props;
|
|
8633
|
-
|
|
8634
|
-
|
|
8635
|
-
|
|
8636
|
-
|
|
8637
|
-
|
|
8638
|
-
|
|
8639
|
-
|
|
8640
|
-
|
|
8641
|
-
|
|
8642
|
-
|
|
8643
|
-
|
|
8644
|
-
|
|
8645
|
-
|
|
8646
|
-
|
|
8647
|
-
|
|
8648
|
-
|
|
8649
|
-
|
|
8794
|
+
return /* @__PURE__ */ jsx53(
|
|
8795
|
+
Slot,
|
|
8796
|
+
{
|
|
8797
|
+
ref: triggerRef,
|
|
8798
|
+
...props,
|
|
8799
|
+
className,
|
|
8800
|
+
"aria-expanded": open,
|
|
8801
|
+
"aria-haspopup": "menu",
|
|
8802
|
+
"aria-controls": menuId,
|
|
8803
|
+
onClick: (event) => {
|
|
8804
|
+
passthrough.onClick?.(event);
|
|
8805
|
+
toggle();
|
|
8806
|
+
},
|
|
8807
|
+
onKeyDown: (event) => {
|
|
8808
|
+
passthrough.onKeyDown?.(event);
|
|
8809
|
+
onTriggerKeyDown(event);
|
|
8810
|
+
},
|
|
8811
|
+
children: mergeEl
|
|
8650
8812
|
}
|
|
8651
|
-
|
|
8813
|
+
);
|
|
8652
8814
|
}
|
|
8653
8815
|
const passthroughBtn = props;
|
|
8654
8816
|
return /* @__PURE__ */ jsx53(
|
|
@@ -8690,7 +8852,7 @@ function DropdownContent({
|
|
|
8690
8852
|
const [fixedStyle, setFixedStyle] = useState16(null);
|
|
8691
8853
|
const [menuSide, setMenuSide] = useState16("bottom");
|
|
8692
8854
|
const gapPx = sideOffset ?? parseCssPxLen(spacings2.sizeXXSmall, 4);
|
|
8693
|
-
const defaultMenuW = parseCssPxLen(
|
|
8855
|
+
const defaultMenuW = parseCssPxLen(componentSizes2.dropdownMenuWidth, 180);
|
|
8694
8856
|
const z = Number.parseInt(String(zIndex.zIndexMessages), 10) || 1e4;
|
|
8695
8857
|
useIsomorphicLayoutEffect3(() => {
|
|
8696
8858
|
if (!open) {
|
|
@@ -8718,7 +8880,7 @@ function DropdownContent({
|
|
|
8718
8880
|
position: "fixed",
|
|
8719
8881
|
top: pos.top,
|
|
8720
8882
|
left: pos.left,
|
|
8721
|
-
minWidth:
|
|
8883
|
+
minWidth: componentSizes2.dropdownMenuWidth,
|
|
8722
8884
|
zIndex: z,
|
|
8723
8885
|
maxHeight: "min(60vh, 20rem)"
|
|
8724
8886
|
};
|
|
@@ -9055,7 +9217,7 @@ function DropdownSubContent({ className, children, style, ...props }) {
|
|
|
9055
9217
|
const panelRef = useRef13(null);
|
|
9056
9218
|
const [fixedStyle, setFixedStyle] = useState16(null);
|
|
9057
9219
|
const [side, setSide] = useState16("right");
|
|
9058
|
-
const defaultMenuW = parseCssPxLen(
|
|
9220
|
+
const defaultMenuW = parseCssPxLen(componentSizes2.dropdownMenuWidth, 180);
|
|
9059
9221
|
const gapPx = parseCssPxLen(spacings2.sizeXXXSmall, 2);
|
|
9060
9222
|
const setPanelEl = useCallback12(
|
|
9061
9223
|
(el) => {
|
|
@@ -9093,7 +9255,7 @@ function DropdownSubContent({ className, children, style, ...props }) {
|
|
|
9093
9255
|
position: "fixed",
|
|
9094
9256
|
top: pos.top,
|
|
9095
9257
|
left: pos.left,
|
|
9096
|
-
minWidth:
|
|
9258
|
+
minWidth: componentSizes2.dropdownMenuWidth,
|
|
9097
9259
|
zIndex: (Number.parseInt(String(zIndex.zIndexMessages), 10) || 1e4) + 100,
|
|
9098
9260
|
maxHeight: "min(60vh, 20rem)"
|
|
9099
9261
|
});
|
|
@@ -9294,7 +9456,6 @@ function Link({
|
|
|
9294
9456
|
// src/components/Menu/Menu.tsx
|
|
9295
9457
|
import { clsx as clsx76 } from "clsx";
|
|
9296
9458
|
import {
|
|
9297
|
-
cloneElement as cloneElement3,
|
|
9298
9459
|
createContext as createContext17,
|
|
9299
9460
|
useCallback as useCallback13,
|
|
9300
9461
|
useContext as useContext19,
|
|
@@ -9305,9 +9466,9 @@ import {
|
|
|
9305
9466
|
useState as useState17
|
|
9306
9467
|
} from "react";
|
|
9307
9468
|
import { createPortal as createPortal5 } from "react-dom";
|
|
9308
|
-
import { iconSizes as iconSizes16, semanticInteraction as
|
|
9469
|
+
import { iconSizes as iconSizes16, semanticInteraction as semanticInteraction5, spacings as spacings3, zIndex as zIndex2 } from "@refineui/tokens";
|
|
9309
9470
|
import { motionMsToNumber as motionMsToNumber3 } from "@refineui/utilities/animation";
|
|
9310
|
-
import { getMergeableTriggerChild as getMergeableTriggerChild2 } from "@refineui/utilities/react";
|
|
9471
|
+
import { Slot as Slot2, getMergeableTriggerChild as getMergeableTriggerChild2 } from "@refineui/utilities/react";
|
|
9311
9472
|
|
|
9312
9473
|
// src/components/Menu/style.ts
|
|
9313
9474
|
import { clsx as clsx75 } from "clsx";
|
|
@@ -9407,15 +9568,7 @@ function MenuTrigger({ children }) {
|
|
|
9407
9568
|
const { open, setOpen } = useMenuContext("MenuTrigger");
|
|
9408
9569
|
const mergeEl = getMergeableTriggerChild2(children);
|
|
9409
9570
|
if (mergeEl) {
|
|
9410
|
-
|
|
9411
|
-
return cloneElement3(el, {
|
|
9412
|
-
"aria-expanded": open,
|
|
9413
|
-
"aria-haspopup": "menu",
|
|
9414
|
-
onClick: (e) => {
|
|
9415
|
-
el.props.onClick?.(e);
|
|
9416
|
-
setOpen(!open);
|
|
9417
|
-
}
|
|
9418
|
-
});
|
|
9571
|
+
return /* @__PURE__ */ jsx58(Slot2, { "aria-expanded": open, "aria-haspopup": "menu", onClick: () => setOpen(!open), children: mergeEl });
|
|
9419
9572
|
}
|
|
9420
9573
|
return /* @__PURE__ */ jsx58(
|
|
9421
9574
|
"button",
|
|
@@ -9450,7 +9603,7 @@ function MenuPopover({ className, children, style, ...props }) {
|
|
|
9450
9603
|
setShouldRender(false);
|
|
9451
9604
|
setIsClosing(false);
|
|
9452
9605
|
setFixedStyle(null);
|
|
9453
|
-
}, motionMsToNumber3(
|
|
9606
|
+
}, motionMsToNumber3(semanticInteraction5.duration.normal));
|
|
9454
9607
|
return () => window.clearTimeout(timeout);
|
|
9455
9608
|
}, [open, shouldRender]);
|
|
9456
9609
|
useIsomorphicLayoutEffect4(() => {
|
|
@@ -9465,7 +9618,7 @@ function MenuPopover({ className, children, style, ...props }) {
|
|
|
9465
9618
|
position: "fixed",
|
|
9466
9619
|
top: rect.bottom + gapPx,
|
|
9467
9620
|
left: rect.left,
|
|
9468
|
-
minWidth:
|
|
9621
|
+
minWidth: componentSizes2.menuPanelWidth,
|
|
9469
9622
|
width: positioning?.autoSize ? "max-content" : void 0,
|
|
9470
9623
|
maxWidth: "min(100vw - 16px, 24rem)",
|
|
9471
9624
|
zIndex: z
|
|
@@ -9815,7 +9968,7 @@ function MenuSubContent({ className, children, style, ...props }) {
|
|
|
9815
9968
|
const [side, setSide] = useState17("right");
|
|
9816
9969
|
const gapPx = parseCssPx(spacings3.sizeXXXSmall, 2);
|
|
9817
9970
|
const z = (Number.parseInt(String(zIndex2.zIndexMessages), 10) || 1e4) + 100;
|
|
9818
|
-
const defaultW = parseCssPx(
|
|
9971
|
+
const defaultW = parseCssPx(componentSizes2.menuPanelWidth, 244);
|
|
9819
9972
|
const setPanelEl = useCallback13(
|
|
9820
9973
|
(el) => {
|
|
9821
9974
|
panelRef.current = el;
|
|
@@ -9854,7 +10007,7 @@ function MenuSubContent({ className, children, style, ...props }) {
|
|
|
9854
10007
|
position: "fixed",
|
|
9855
10008
|
top: pos.top,
|
|
9856
10009
|
left: pos.left,
|
|
9857
|
-
minWidth:
|
|
10010
|
+
minWidth: componentSizes2.menuPanelWidth,
|
|
9858
10011
|
zIndex: z,
|
|
9859
10012
|
maxHeight: "min(60vh, 20rem)"
|
|
9860
10013
|
});
|
|
@@ -9923,14 +10076,14 @@ import {
|
|
|
9923
10076
|
useRef as useRef15,
|
|
9924
10077
|
useState as useState18
|
|
9925
10078
|
} from "react";
|
|
9926
|
-
import { iconSizes as iconSizes17, semanticInteraction as
|
|
10079
|
+
import { iconSizes as iconSizes17, semanticInteraction as semanticInteraction6 } from "@refineui/tokens";
|
|
9927
10080
|
import { motionMsToNumber as motionMsToNumber4 } from "@refineui/utilities/animation";
|
|
9928
10081
|
|
|
9929
10082
|
// src/components/NavigationMenu/style.ts
|
|
9930
10083
|
import { clsx as clsx77 } from "clsx";
|
|
9931
10084
|
var topLevelItem = clsx77(
|
|
9932
10085
|
componentTextClass(componentTypographyTokens.navigationMenu.trigger),
|
|
9933
|
-
"box-border inline-flex cursor-pointer items-center justify-center gap-refineui-size-x-small",
|
|
10086
|
+
"box-border inline-flex h-refineui-button-min-height-md min-w-refineui-navigation-menu-item-min-width cursor-pointer items-center justify-center gap-refineui-size-x-small",
|
|
9934
10087
|
"rounded-refineui-large border-none bg-transparent px-refineui-size-medium py-refineui-size-x-small",
|
|
9935
10088
|
"text-refineui-alias-foreground-tertiary outline-none leading-none",
|
|
9936
10089
|
"transition-[color,background-color] duration-[var(--refineui-motion-duration-fast)]"
|
|
@@ -9947,8 +10100,6 @@ var navigationMenuStyles = {
|
|
|
9947
10100
|
triggerDisabled: "cursor-not-allowed text-refineui-alias-foreground-disabled",
|
|
9948
10101
|
chevron,
|
|
9949
10102
|
chevronOpen: "rotate-180",
|
|
9950
|
-
/** Matches trigger chevron box so direct top-level links align with dropdown triggers. */
|
|
9951
|
-
linkChevronSpacer: clsx77(chevron, "inline-block size-refineui-icon-xsmall shrink-0 pointer-events-none invisible"),
|
|
9952
10103
|
content: clsx77(
|
|
9953
10104
|
/** Flush under trigger so pointer does not leave the item while moving into the panel. */
|
|
9954
10105
|
"absolute start-0 top-full z-refineui-messages pt-refineui-size-xx-small",
|
|
@@ -10023,8 +10174,8 @@ function NavigationMenu({
|
|
|
10023
10174
|
const openTimerRef = useRef15(null);
|
|
10024
10175
|
const closeTimerRef = useRef15(null);
|
|
10025
10176
|
const rootRef = useRef15(null);
|
|
10026
|
-
const delayDuration = delayDurationProp ?? motionMsToNumber4(
|
|
10027
|
-
const skipDelayDuration = skipDelayDurationProp ?? motionMsToNumber4(
|
|
10177
|
+
const delayDuration = delayDurationProp ?? motionMsToNumber4(semanticInteraction6.duration.normal);
|
|
10178
|
+
const skipDelayDuration = skipDelayDurationProp ?? motionMsToNumber4(semanticInteraction6.duration.fast);
|
|
10028
10179
|
const clearTimers = useCallback14(() => {
|
|
10029
10180
|
if (openTimerRef.current != null) {
|
|
10030
10181
|
window.clearTimeout(openTimerRef.current);
|
|
@@ -10189,10 +10340,12 @@ function NavigationMenuItem({
|
|
|
10189
10340
|
onPointerEnter: (event) => {
|
|
10190
10341
|
onPointerEnter?.(event);
|
|
10191
10342
|
if (event.defaultPrevented) return;
|
|
10192
|
-
const
|
|
10193
|
-
event.currentTarget.querySelector(
|
|
10343
|
+
const hasEnabledTrigger = Boolean(
|
|
10344
|
+
event.currentTarget.querySelector(
|
|
10345
|
+
'[data-refineui="navigation-menu-trigger"]:not(:disabled)'
|
|
10346
|
+
)
|
|
10194
10347
|
);
|
|
10195
|
-
if (
|
|
10348
|
+
if (hasEnabledTrigger) {
|
|
10196
10349
|
menu.openItem(value);
|
|
10197
10350
|
}
|
|
10198
10351
|
},
|
|
@@ -10304,7 +10457,7 @@ function NavigationMenuContent({
|
|
|
10304
10457
|
const timeout = window.setTimeout(() => {
|
|
10305
10458
|
setShouldRender(false);
|
|
10306
10459
|
setIsClosing(false);
|
|
10307
|
-
}, motionMsToNumber4(
|
|
10460
|
+
}, motionMsToNumber4(semanticInteraction6.duration.fast));
|
|
10308
10461
|
return () => window.clearTimeout(timeout);
|
|
10309
10462
|
}, [item.open, shouldRender]);
|
|
10310
10463
|
const contentCtx = useMemo14(
|
|
@@ -10346,7 +10499,7 @@ function NavigationMenuLink({
|
|
|
10346
10499
|
const menu = useContext20(NavigationMenuContext);
|
|
10347
10500
|
const inContent = menu?.isInsideContent ?? false;
|
|
10348
10501
|
const disabled = ariaDisabled === true || ariaDisabled === "true";
|
|
10349
|
-
return /* @__PURE__ */
|
|
10502
|
+
return /* @__PURE__ */ jsx59(
|
|
10350
10503
|
"a",
|
|
10351
10504
|
{
|
|
10352
10505
|
"data-refineui": "navigation-menu-link",
|
|
@@ -10362,7 +10515,11 @@ function NavigationMenuLink({
|
|
|
10362
10515
|
),
|
|
10363
10516
|
onClick: (event) => {
|
|
10364
10517
|
onClick?.(event);
|
|
10365
|
-
if (event.defaultPrevented
|
|
10518
|
+
if (event.defaultPrevented) return;
|
|
10519
|
+
if (disabled) {
|
|
10520
|
+
event.preventDefault();
|
|
10521
|
+
return;
|
|
10522
|
+
}
|
|
10366
10523
|
menu?.setValue("");
|
|
10367
10524
|
},
|
|
10368
10525
|
onFocus: (event) => {
|
|
@@ -10372,10 +10529,7 @@ function NavigationMenuLink({
|
|
|
10372
10529
|
}
|
|
10373
10530
|
},
|
|
10374
10531
|
...props,
|
|
10375
|
-
children
|
|
10376
|
-
children,
|
|
10377
|
-
!inContent ? /* @__PURE__ */ jsx59("span", { "aria-hidden": true, className: navigationMenuStyles.linkChevronSpacer }) : null
|
|
10378
|
-
]
|
|
10532
|
+
children
|
|
10379
10533
|
}
|
|
10380
10534
|
);
|
|
10381
10535
|
}
|
|
@@ -10588,7 +10742,7 @@ import {
|
|
|
10588
10742
|
useRef as useRef16,
|
|
10589
10743
|
useState as useState19
|
|
10590
10744
|
} from "react";
|
|
10591
|
-
import { semanticInteraction as
|
|
10745
|
+
import { semanticInteraction as semanticInteraction7 } from "@refineui/tokens";
|
|
10592
10746
|
import { motionMsToNumber as motionMsToNumber5 } from "@refineui/utilities/animation";
|
|
10593
10747
|
|
|
10594
10748
|
// src/components/Sidebar/peekStyle.ts
|
|
@@ -10614,9 +10768,9 @@ var sidebarPeekStyles = {
|
|
|
10614
10768
|
|
|
10615
10769
|
// src/components/Sidebar/SidebarPeek.tsx
|
|
10616
10770
|
import { jsx as jsx61 } from "react/jsx-runtime";
|
|
10617
|
-
var PEEK_OPEN_DELAY_MS = motionMsToNumber5(
|
|
10618
|
-
var PEEK_CLOSE_DELAY_MS = motionMsToNumber5(
|
|
10619
|
-
var PEEK_BRIDGE_DELAY_MS = motionMsToNumber5(
|
|
10771
|
+
var PEEK_OPEN_DELAY_MS = motionMsToNumber5(semanticInteraction7.duration.medium);
|
|
10772
|
+
var PEEK_CLOSE_DELAY_MS = motionMsToNumber5(semanticInteraction7.duration.medium);
|
|
10773
|
+
var PEEK_BRIDGE_DELAY_MS = motionMsToNumber5(semanticInteraction7.duration.slow);
|
|
10620
10774
|
var SidebarPeekContext = createContext19(null);
|
|
10621
10775
|
function useSidebarPeekContext(component) {
|
|
10622
10776
|
const ctx = useContext21(SidebarPeekContext);
|
|
@@ -10973,7 +11127,6 @@ function Pagination(props) {
|
|
|
10973
11127
|
// src/components/PopOver/PopOver.tsx
|
|
10974
11128
|
import { clsx as clsx85 } from "clsx";
|
|
10975
11129
|
import {
|
|
10976
|
-
cloneElement as cloneElement4,
|
|
10977
11130
|
createContext as createContext20,
|
|
10978
11131
|
useCallback as useCallback16,
|
|
10979
11132
|
useContext as useContext22,
|
|
@@ -10985,7 +11138,7 @@ import {
|
|
|
10985
11138
|
} from "react";
|
|
10986
11139
|
import { spacings as spacings4, strokeWidths as strokeWidths2 } from "@refineui/tokens";
|
|
10987
11140
|
import { resolveColorTokenValue as resolveColorTokenValue10 } from "@refineui/utilities/color";
|
|
10988
|
-
import {
|
|
11141
|
+
import { Slot as Slot3, getMergeableTriggerChild as getMergeableTriggerChild3 } from "@refineui/utilities/react";
|
|
10989
11142
|
|
|
10990
11143
|
// src/components/PopOver/style.ts
|
|
10991
11144
|
var popoverStyles = {
|
|
@@ -11032,8 +11185,8 @@ var BEAK_OFFSET = foundationSizes.foundationSize80;
|
|
|
11032
11185
|
var BEAK_BORDER_OVERLAP = strokeWidths2.strokeWidthThin;
|
|
11033
11186
|
var POPOVER_GAP = spacings4.sizeMedium;
|
|
11034
11187
|
function beakWrapperStyle(placement, align) {
|
|
11035
|
-
const insetStart =
|
|
11036
|
-
const insetEnd =
|
|
11188
|
+
const insetStart = componentSizes2.popoverBeakInsetFromStartEdge;
|
|
11189
|
+
const insetEnd = componentSizes2.popoverBeakInsetFromEndEdge;
|
|
11037
11190
|
const edge = spacings4.sizeMedium;
|
|
11038
11191
|
const overlapOffset = `calc(-1 * ${BEAK_OFFSET} + ${BEAK_BORDER_OVERLAP})`;
|
|
11039
11192
|
switch (placement) {
|
|
@@ -11143,27 +11296,27 @@ function PopoverTrigger({ children, className, ...props }) {
|
|
|
11143
11296
|
const { open, toggle, triggerRef, contentId, onTriggerKeyDown } = usePopoverContext("PopoverTrigger");
|
|
11144
11297
|
const mergeEl = getMergeableTriggerChild3(children);
|
|
11145
11298
|
if (mergeEl) {
|
|
11146
|
-
const el = mergeEl;
|
|
11147
11299
|
const passthrough = props;
|
|
11148
|
-
|
|
11149
|
-
|
|
11150
|
-
|
|
11151
|
-
|
|
11152
|
-
|
|
11153
|
-
|
|
11154
|
-
|
|
11155
|
-
|
|
11156
|
-
|
|
11157
|
-
|
|
11158
|
-
|
|
11159
|
-
|
|
11160
|
-
|
|
11161
|
-
|
|
11162
|
-
|
|
11163
|
-
|
|
11164
|
-
|
|
11300
|
+
return /* @__PURE__ */ jsx63(
|
|
11301
|
+
Slot3,
|
|
11302
|
+
{
|
|
11303
|
+
ref: triggerRef,
|
|
11304
|
+
...props,
|
|
11305
|
+
className,
|
|
11306
|
+
"aria-expanded": open,
|
|
11307
|
+
"aria-haspopup": "dialog",
|
|
11308
|
+
"aria-controls": contentId,
|
|
11309
|
+
onClick: (event) => {
|
|
11310
|
+
passthrough.onClick?.(event);
|
|
11311
|
+
toggle();
|
|
11312
|
+
},
|
|
11313
|
+
onKeyDown: (event) => {
|
|
11314
|
+
passthrough.onKeyDown?.(event);
|
|
11315
|
+
onTriggerKeyDown(event);
|
|
11316
|
+
},
|
|
11317
|
+
children: mergeEl
|
|
11165
11318
|
}
|
|
11166
|
-
|
|
11319
|
+
);
|
|
11167
11320
|
}
|
|
11168
11321
|
const passthroughBtn = props;
|
|
11169
11322
|
return /* @__PURE__ */ jsx63(
|
|
@@ -11262,7 +11415,7 @@ function PopoverContent({
|
|
|
11262
11415
|
),
|
|
11263
11416
|
style: {
|
|
11264
11417
|
...styleProp && typeof styleProp === "object" ? styleProp : {},
|
|
11265
|
-
minWidth:
|
|
11418
|
+
minWidth: componentSizes2.popoverPanelWidth,
|
|
11266
11419
|
padding: spacings4.sizeLarge,
|
|
11267
11420
|
backgroundColor: bg,
|
|
11268
11421
|
color: resolveColorTokenValue10(palette.foreground),
|
|
@@ -11422,7 +11575,7 @@ import { clsx as clsx89 } from "clsx";
|
|
|
11422
11575
|
import { iconSizes as iconSizes19 } from "@refineui/tokens";
|
|
11423
11576
|
import {
|
|
11424
11577
|
Children as Children6,
|
|
11425
|
-
cloneElement as
|
|
11578
|
+
cloneElement as cloneElement2,
|
|
11426
11579
|
createContext as createContext21,
|
|
11427
11580
|
forwardRef as forwardRef14,
|
|
11428
11581
|
isValidElement as isValidElement5,
|
|
@@ -11662,9 +11815,9 @@ function CarouselContent({ className, children, ...props }) {
|
|
|
11662
11815
|
setCount(slideCount);
|
|
11663
11816
|
}, [setCount, slideCount]);
|
|
11664
11817
|
const trackSlides = loop && slides.length > 1 ? [
|
|
11665
|
-
|
|
11818
|
+
cloneElement2(slides[slides.length - 1], { key: "__carousel-clone-last" }),
|
|
11666
11819
|
...slides,
|
|
11667
|
-
|
|
11820
|
+
cloneElement2(slides[0], { key: "__carousel-clone-first" })
|
|
11668
11821
|
] : slides;
|
|
11669
11822
|
const endDrag = useCallback17(
|
|
11670
11823
|
(clientX) => {
|
|
@@ -13235,14 +13388,15 @@ import {
|
|
|
13235
13388
|
useSyncExternalStore
|
|
13236
13389
|
} from "react";
|
|
13237
13390
|
import { createPortal as createPortal6 } from "react-dom";
|
|
13238
|
-
import { iconSizes as iconSizes22,
|
|
13391
|
+
import { iconSizes as iconSizes22, spacings as spacings5 } from "@refineui/tokens";
|
|
13239
13392
|
import { motionMsToNumber as motionMsToNumber6 } from "@refineui/utilities/animation";
|
|
13393
|
+
import { resolveColorTokenValue as resolveColorTokenValue11 } from "@refineui/utilities/color";
|
|
13240
13394
|
|
|
13241
13395
|
// src/recipes/toast.recipe.ts
|
|
13242
13396
|
import { clsx as clsx97 } from "clsx";
|
|
13243
13397
|
var toastRecipe = defineRecipe({
|
|
13244
13398
|
name: "toast",
|
|
13245
|
-
base: "relative isolate box-border flex w-fit max-w-refineui-toast-max-width cursor-grab items-center gap-refineui-size-small rounded-refineui-
|
|
13399
|
+
base: "relative isolate box-border flex w-fit min-w-refineui-toast-min-width max-w-refineui-toast-max-width cursor-grab items-center gap-refineui-size-small rounded-refineui-x-large border-refineui-hairline border-refineui-alias-border-default bg-refineui-alias-background-primary py-refineui-size-medium ps-refineui-size-medium pe-refineui-size-large select-none",
|
|
13246
13400
|
variants: {
|
|
13247
13401
|
variant: {
|
|
13248
13402
|
default: "",
|
|
@@ -13272,7 +13426,7 @@ var toastStyles = {
|
|
|
13272
13426
|
import { jsx as jsx71, jsxs as jsxs29 } from "react/jsx-runtime";
|
|
13273
13427
|
var useIsomorphicLayoutEffect6 = typeof document !== "undefined" ? useLayoutEffect11 : useEffect18;
|
|
13274
13428
|
var ENTER_MS = 20;
|
|
13275
|
-
var LEAVE_MS = motionMsToNumber6(
|
|
13429
|
+
var LEAVE_MS = motionMsToNumber6(componentTokens.toast.motion.leave) + 60;
|
|
13276
13430
|
var DEFAULT_DURATION = 4200;
|
|
13277
13431
|
var DEFAULT_MAX_TOASTS = 1;
|
|
13278
13432
|
var STACK_Z_BASE = 100;
|
|
@@ -13477,6 +13631,12 @@ var Toast = forwardRef15(function Toast2(props, ref) {
|
|
|
13477
13631
|
children: action.label
|
|
13478
13632
|
}
|
|
13479
13633
|
) : action;
|
|
13634
|
+
const color = componentColorTokens.toast;
|
|
13635
|
+
const tokenStyle = {
|
|
13636
|
+
backgroundColor: resolveColorTokenValue11(color.background),
|
|
13637
|
+
borderColor: resolveColorTokenValue11(color.border),
|
|
13638
|
+
color: resolveColorTokenValue11(color.message)
|
|
13639
|
+
};
|
|
13480
13640
|
return /* @__PURE__ */ jsxs29(
|
|
13481
13641
|
"div",
|
|
13482
13642
|
{
|
|
@@ -13487,7 +13647,7 @@ var Toast = forwardRef15(function Toast2(props, ref) {
|
|
|
13487
13647
|
role: liveRole,
|
|
13488
13648
|
"aria-live": ariaLive,
|
|
13489
13649
|
...domProps,
|
|
13490
|
-
style,
|
|
13650
|
+
style: { ...tokenStyle, ...style },
|
|
13491
13651
|
className: clsx98(toastStyles.card, className),
|
|
13492
13652
|
children: [
|
|
13493
13653
|
/* @__PURE__ */ jsx71("div", { "data-refineui": "toast-icon", className: toastStyles.iconWrap, children: iconContent }),
|
|
@@ -14242,37 +14402,50 @@ function TreeItemContent({ className, children, ...props }) {
|
|
|
14242
14402
|
|
|
14243
14403
|
// src/components/Tooltip/Tooltip.tsx
|
|
14244
14404
|
import { clsx as clsx105 } from "clsx";
|
|
14245
|
-
import {
|
|
14246
|
-
import {
|
|
14247
|
-
import {
|
|
14248
|
-
import { getMergeableTriggerChild as getMergeableTriggerChild4 } from "@refineui/utilities/react";
|
|
14405
|
+
import { useId as useId16, useRef as useRef23, useState as useState30 } from "react";
|
|
14406
|
+
import { resolveColorTokenValue as resolveColorTokenValue12 } from "@refineui/utilities/color";
|
|
14407
|
+
import { Slot as Slot4, getMergeableTriggerChild as getMergeableTriggerChild4 } from "@refineui/utilities/react";
|
|
14249
14408
|
|
|
14250
14409
|
// src/components/Tooltip/style.ts
|
|
14251
|
-
import {
|
|
14410
|
+
import { spacings as spacings6, strokeWidths as strokeWidths3 } from "@refineui/tokens";
|
|
14252
14411
|
import { clsx as clsx104 } from "clsx";
|
|
14412
|
+
var TOOLTIP_BEAK_W = foundationSizes.foundationSize160;
|
|
14413
|
+
var TOOLTIP_BEAK_H = foundationSizes.foundationSize80;
|
|
14414
|
+
var TOOLTIP_BEAK_OFFSET = foundationSizes.foundationSize80;
|
|
14415
|
+
var BEAK_BORDER_OVERLAP2 = strokeWidths3.strokeWidthThin;
|
|
14416
|
+
var gap = spacings6.sizeXSmall;
|
|
14417
|
+
var edgeInset = spacings6.sizeMedium;
|
|
14253
14418
|
var tooltipStyles = {
|
|
14254
14419
|
root: "relative inline-block",
|
|
14255
14420
|
fallbackTrigger: "inline-flex outline-none",
|
|
14421
|
+
/** Positions the floating stack (beak + panel), like PopOver `floatingRoot`. */
|
|
14422
|
+
floating: "pointer-events-none absolute z-refineui-popup",
|
|
14423
|
+
panelWrap: "relative inline-block max-w-refineui-tooltip-max-width",
|
|
14424
|
+
beakWrap: "pointer-events-none absolute z-[1]",
|
|
14256
14425
|
panel: clsx104(
|
|
14257
14426
|
componentTextClass(componentTypographyTokens.tooltip),
|
|
14258
|
-
"
|
|
14427
|
+
"relative z-0 box-border max-w-refineui-tooltip-max-width whitespace-nowrap rounded-refineui-medium border-refineui-thin px-refineui-size-medium py-refineui-size-small shadow-refineui-8"
|
|
14259
14428
|
)
|
|
14260
14429
|
};
|
|
14261
|
-
|
|
14262
|
-
|
|
14263
|
-
|
|
14264
|
-
|
|
14265
|
-
|
|
14266
|
-
|
|
14267
|
-
|
|
14268
|
-
|
|
14269
|
-
|
|
14430
|
+
function tooltipPlacement(position) {
|
|
14431
|
+
switch (position) {
|
|
14432
|
+
case "Top":
|
|
14433
|
+
return "top";
|
|
14434
|
+
case "Left":
|
|
14435
|
+
return "left";
|
|
14436
|
+
case "Right":
|
|
14437
|
+
return "right";
|
|
14438
|
+
case "Bottom":
|
|
14439
|
+
default:
|
|
14440
|
+
return "bottom";
|
|
14441
|
+
}
|
|
14270
14442
|
}
|
|
14271
|
-
function
|
|
14272
|
-
|
|
14443
|
+
function tooltipAlignKey(align) {
|
|
14444
|
+
if (align === "Start") return "start";
|
|
14445
|
+
if (align === "End") return "end";
|
|
14446
|
+
return "center";
|
|
14273
14447
|
}
|
|
14274
|
-
|
|
14275
|
-
function tooltipPanelStyle(position, align) {
|
|
14448
|
+
function tooltipFloatingStyle(position, align) {
|
|
14276
14449
|
switch (position) {
|
|
14277
14450
|
case "Top":
|
|
14278
14451
|
if (align === "Start") return { bottom: "100%", left: 0, marginBottom: gap };
|
|
@@ -14294,55 +14467,44 @@ function tooltipPanelStyle(position, align) {
|
|
|
14294
14467
|
return {};
|
|
14295
14468
|
}
|
|
14296
14469
|
}
|
|
14297
|
-
function
|
|
14298
|
-
const
|
|
14299
|
-
const
|
|
14300
|
-
|
|
14301
|
-
|
|
14302
|
-
|
|
14303
|
-
|
|
14304
|
-
|
|
14305
|
-
|
|
14306
|
-
|
|
14307
|
-
|
|
14308
|
-
|
|
14309
|
-
|
|
14310
|
-
|
|
14311
|
-
|
|
14312
|
-
|
|
14313
|
-
|
|
14314
|
-
|
|
14315
|
-
top:
|
|
14316
|
-
|
|
14317
|
-
|
|
14318
|
-
|
|
14319
|
-
|
|
14320
|
-
if (align === "Start") return { ...tri2, left: edgeInset, marginLeft: 0 };
|
|
14321
|
-
if (align === "End") return { ...tri2, right: edgeInset, left: "auto", marginLeft: 0 };
|
|
14322
|
-
return { ...tri2, left: "50%", marginLeft: -b };
|
|
14470
|
+
function tooltipBeakWrapperStyle(position, align) {
|
|
14471
|
+
const overlapOffset = `calc(-1 * ${TOOLTIP_BEAK_OFFSET} + ${BEAK_BORDER_OVERLAP2})`;
|
|
14472
|
+
const placement = tooltipPlacement(position);
|
|
14473
|
+
const a = tooltipAlignKey(align);
|
|
14474
|
+
switch (placement) {
|
|
14475
|
+
case "bottom":
|
|
14476
|
+
if (a === "center") return { top: overlapOffset, left: `calc(50% - ${TOOLTIP_BEAK_W} / 2)` };
|
|
14477
|
+
if (a === "start") return { top: overlapOffset, left: edgeInset };
|
|
14478
|
+
return { top: overlapOffset, right: edgeInset };
|
|
14479
|
+
case "top":
|
|
14480
|
+
if (a === "center") return { bottom: overlapOffset, left: `calc(50% - ${TOOLTIP_BEAK_W} / 2)` };
|
|
14481
|
+
if (a === "start") return { bottom: overlapOffset, left: edgeInset };
|
|
14482
|
+
return { bottom: overlapOffset, right: edgeInset };
|
|
14483
|
+
case "left":
|
|
14484
|
+
if (a === "center") return { right: overlapOffset, top: `calc(50% - ${TOOLTIP_BEAK_W} / 2)` };
|
|
14485
|
+
if (a === "start") return { right: overlapOffset, top: edgeInset };
|
|
14486
|
+
return { right: overlapOffset, bottom: edgeInset };
|
|
14487
|
+
case "right":
|
|
14488
|
+
if (a === "center") return { left: overlapOffset, top: `calc(50% - ${TOOLTIP_BEAK_W} / 2)` };
|
|
14489
|
+
if (a === "start") return { left: overlapOffset, top: edgeInset };
|
|
14490
|
+
return { left: overlapOffset, bottom: edgeInset };
|
|
14491
|
+
default:
|
|
14492
|
+
return {};
|
|
14323
14493
|
}
|
|
14324
|
-
|
|
14325
|
-
|
|
14326
|
-
|
|
14327
|
-
|
|
14328
|
-
|
|
14329
|
-
|
|
14330
|
-
|
|
14331
|
-
|
|
14332
|
-
|
|
14333
|
-
|
|
14334
|
-
|
|
14494
|
+
}
|
|
14495
|
+
function tooltipBeakRotateDeg(position) {
|
|
14496
|
+
switch (tooltipPlacement(position)) {
|
|
14497
|
+
case "bottom":
|
|
14498
|
+
return 0;
|
|
14499
|
+
case "top":
|
|
14500
|
+
return 180;
|
|
14501
|
+
case "left":
|
|
14502
|
+
return -90;
|
|
14503
|
+
case "right":
|
|
14504
|
+
return 90;
|
|
14505
|
+
default:
|
|
14506
|
+
return 0;
|
|
14335
14507
|
}
|
|
14336
|
-
const tri = {
|
|
14337
|
-
...baseBox,
|
|
14338
|
-
left: outset,
|
|
14339
|
-
borderTop: `${b}px solid transparent`,
|
|
14340
|
-
borderBottom: `${b}px solid transparent`,
|
|
14341
|
-
borderRight: `${b}px solid ${bg}`
|
|
14342
|
-
};
|
|
14343
|
-
if (align === "Start") return { ...tri, top: edgeInset, marginTop: 0 };
|
|
14344
|
-
if (align === "End") return { ...tri, bottom: edgeInset, top: "auto", marginTop: 0 };
|
|
14345
|
-
return { ...tri, top: "50%", marginTop: -b };
|
|
14346
14508
|
}
|
|
14347
14509
|
|
|
14348
14510
|
// src/components/Tooltip/Tooltip.tsx
|
|
@@ -14367,8 +14529,10 @@ function Tooltip({
|
|
|
14367
14529
|
if (ctrlOpen === void 0) setInnerOpen(next);
|
|
14368
14530
|
onOpenChange?.(next);
|
|
14369
14531
|
};
|
|
14370
|
-
const
|
|
14371
|
-
const
|
|
14532
|
+
const tipColor = componentColorTokens.tooltip.default;
|
|
14533
|
+
const bg = resolveColorTokenValue12(tipColor.background);
|
|
14534
|
+
const fg = resolveColorTokenValue12(tipColor.foreground);
|
|
14535
|
+
const borderCol = resolveColorTokenValue12(tipColor.border);
|
|
14372
14536
|
const clearTimer = () => {
|
|
14373
14537
|
if (showTimer.current != null) {
|
|
14374
14538
|
clearTimeout(showTimer.current);
|
|
@@ -14383,38 +14547,29 @@ function Tooltip({
|
|
|
14383
14547
|
clearTimer();
|
|
14384
14548
|
setOpen(false);
|
|
14385
14549
|
};
|
|
14386
|
-
const
|
|
14387
|
-
const
|
|
14388
|
-
const
|
|
14550
|
+
const floatingStyle = tooltipFloatingStyle(position, align);
|
|
14551
|
+
const beakWrapStyle = tooltipBeakWrapperStyle(position, align);
|
|
14552
|
+
const beakRot = tooltipBeakRotateDeg(position);
|
|
14389
14553
|
const describedBy = open ? tooltipId : void 0;
|
|
14390
14554
|
const mergeEl = getMergeableTriggerChild4(trigger);
|
|
14391
14555
|
let triggerNode;
|
|
14392
14556
|
if (mergeEl != null) {
|
|
14393
|
-
|
|
14394
|
-
|
|
14395
|
-
|
|
14396
|
-
|
|
14397
|
-
|
|
14398
|
-
|
|
14399
|
-
scheduleShow
|
|
14400
|
-
|
|
14401
|
-
|
|
14402
|
-
|
|
14403
|
-
|
|
14404
|
-
|
|
14405
|
-
|
|
14406
|
-
|
|
14407
|
-
scheduleShow();
|
|
14408
|
-
},
|
|
14409
|
-
onBlur: (e) => {
|
|
14410
|
-
el.props.onBlur?.(e);
|
|
14411
|
-
if (!e.currentTarget.contains(e.relatedTarget)) hide();
|
|
14412
|
-
},
|
|
14413
|
-
onKeyDown: (e) => {
|
|
14414
|
-
el.props.onKeyDown?.(e);
|
|
14415
|
-
if (e.key === "Escape") hide();
|
|
14557
|
+
triggerNode = /* @__PURE__ */ jsx76(
|
|
14558
|
+
Slot4,
|
|
14559
|
+
{
|
|
14560
|
+
"aria-describedby": describedBy,
|
|
14561
|
+
onMouseEnter: scheduleShow,
|
|
14562
|
+
onMouseLeave: hide,
|
|
14563
|
+
onFocus: scheduleShow,
|
|
14564
|
+
onBlur: (event) => {
|
|
14565
|
+
if (!event.currentTarget.contains(event.relatedTarget)) hide();
|
|
14566
|
+
},
|
|
14567
|
+
onKeyDown: (event) => {
|
|
14568
|
+
if (event.key === "Escape") hide();
|
|
14569
|
+
},
|
|
14570
|
+
children: mergeEl
|
|
14416
14571
|
}
|
|
14417
|
-
|
|
14572
|
+
);
|
|
14418
14573
|
} else {
|
|
14419
14574
|
triggerNode = /* @__PURE__ */ jsx76(
|
|
14420
14575
|
"span",
|
|
@@ -14435,26 +14590,59 @@ function Tooltip({
|
|
|
14435
14590
|
}
|
|
14436
14591
|
return /* @__PURE__ */ jsxs31("div", { "data-refineui": "tooltip", className: clsx105(tooltipStyles.root, className), ...props, children: [
|
|
14437
14592
|
triggerNode,
|
|
14438
|
-
open && /* @__PURE__ */ jsxs31(
|
|
14439
|
-
|
|
14440
|
-
|
|
14441
|
-
|
|
14442
|
-
|
|
14443
|
-
|
|
14444
|
-
|
|
14445
|
-
|
|
14446
|
-
|
|
14447
|
-
|
|
14448
|
-
|
|
14449
|
-
|
|
14450
|
-
|
|
14451
|
-
|
|
14452
|
-
|
|
14453
|
-
|
|
14454
|
-
|
|
14455
|
-
|
|
14456
|
-
|
|
14457
|
-
|
|
14593
|
+
open && /* @__PURE__ */ jsx76("div", { className: tooltipStyles.floating, style: floatingStyle, children: /* @__PURE__ */ jsxs31("div", { className: tooltipStyles.panelWrap, children: [
|
|
14594
|
+
/* @__PURE__ */ jsx76(
|
|
14595
|
+
"div",
|
|
14596
|
+
{
|
|
14597
|
+
className: tooltipStyles.beakWrap,
|
|
14598
|
+
style: { ...beakWrapStyle, width: TOOLTIP_BEAK_W, height: TOOLTIP_BEAK_H },
|
|
14599
|
+
"aria-hidden": true,
|
|
14600
|
+
children: /* @__PURE__ */ jsx76(
|
|
14601
|
+
"div",
|
|
14602
|
+
{
|
|
14603
|
+
style: {
|
|
14604
|
+
width: TOOLTIP_BEAK_W,
|
|
14605
|
+
height: TOOLTIP_BEAK_H,
|
|
14606
|
+
transform: `rotate(${beakRot}deg)`,
|
|
14607
|
+
transformOrigin: "center center"
|
|
14608
|
+
},
|
|
14609
|
+
children: /* @__PURE__ */ jsxs31(
|
|
14610
|
+
"svg",
|
|
14611
|
+
{
|
|
14612
|
+
width: TOOLTIP_BEAK_W,
|
|
14613
|
+
height: TOOLTIP_BEAK_H,
|
|
14614
|
+
viewBox: "0 0 16 8",
|
|
14615
|
+
fill: "none",
|
|
14616
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
14617
|
+
style: { display: "block" },
|
|
14618
|
+
children: [
|
|
14619
|
+
/* @__PURE__ */ jsx76("polygon", { points: "8,0 0,8 16,8", fill: borderCol }),
|
|
14620
|
+
/* @__PURE__ */ jsx76("polygon", { points: "8,2 2,8 14,8", fill: bg })
|
|
14621
|
+
]
|
|
14622
|
+
}
|
|
14623
|
+
)
|
|
14624
|
+
}
|
|
14625
|
+
)
|
|
14626
|
+
}
|
|
14627
|
+
),
|
|
14628
|
+
/* @__PURE__ */ jsx76(
|
|
14629
|
+
"div",
|
|
14630
|
+
{
|
|
14631
|
+
id: tooltipId,
|
|
14632
|
+
role: "tooltip",
|
|
14633
|
+
"data-refineui": "tooltip-panel",
|
|
14634
|
+
"data-position": position,
|
|
14635
|
+
"data-align": align,
|
|
14636
|
+
className: tooltipStyles.panel,
|
|
14637
|
+
style: {
|
|
14638
|
+
backgroundColor: bg,
|
|
14639
|
+
color: fg,
|
|
14640
|
+
borderColor: borderCol
|
|
14641
|
+
},
|
|
14642
|
+
children: content
|
|
14643
|
+
}
|
|
14644
|
+
)
|
|
14645
|
+
] }) })
|
|
14458
14646
|
] });
|
|
14459
14647
|
}
|
|
14460
14648
|
|
|
@@ -14471,7 +14659,7 @@ import {
|
|
|
14471
14659
|
useState as useState31
|
|
14472
14660
|
} from "react";
|
|
14473
14661
|
import { opacities } from "@refineui/tokens";
|
|
14474
|
-
import { resolveColorTokenValue as
|
|
14662
|
+
import { resolveColorTokenValue as resolveColorTokenValue13 } from "@refineui/utilities/color";
|
|
14475
14663
|
|
|
14476
14664
|
// src/components/Chart/style.ts
|
|
14477
14665
|
import { clsx as clsx106 } from "clsx";
|
|
@@ -14515,12 +14703,12 @@ var chartStyles = {
|
|
|
14515
14703
|
};
|
|
14516
14704
|
|
|
14517
14705
|
// src/components/Chart/utils.ts
|
|
14518
|
-
import { borderRadii, foundationSizes as foundationSizes3, spacings as
|
|
14706
|
+
import { borderRadii, foundationSizes as foundationSizes3, spacings as spacings7 } from "@refineui/tokens";
|
|
14519
14707
|
var CHART_VIEWBOX_WIDTH = 800;
|
|
14520
14708
|
var CHART_VIEWBOX_HEIGHT = 320;
|
|
14521
|
-
var CHART_PLOT_PADDING_TOP = parseFloat(
|
|
14522
|
-
var CHART_PLOT_PADDING_BOTTOM = parseFloat(
|
|
14523
|
-
var CHART_PLOT_PADDING_X = parseFloat(
|
|
14709
|
+
var CHART_PLOT_PADDING_TOP = parseFloat(spacings7.sizeMedium);
|
|
14710
|
+
var CHART_PLOT_PADDING_BOTTOM = parseFloat(spacings7.sizeXXSmall);
|
|
14711
|
+
var CHART_PLOT_PADDING_X = parseFloat(spacings7.sizeMedium);
|
|
14524
14712
|
var CHART_BAR_RADIUS = parseFloat(borderRadii.roundedMedium);
|
|
14525
14713
|
var CHART_BAR_BAND_FILL = 0.5;
|
|
14526
14714
|
var CHART_POINT_RADIUS = parseFloat(foundationSizes3.foundationSize40);
|
|
@@ -14704,19 +14892,19 @@ function useChartContext(component) {
|
|
|
14704
14892
|
return value;
|
|
14705
14893
|
}
|
|
14706
14894
|
function seriesColorToken(color) {
|
|
14707
|
-
return
|
|
14895
|
+
return resolveColorTokenValue13(componentColorTokens.chart.series[color]);
|
|
14708
14896
|
}
|
|
14709
14897
|
function seriesSubtleToken(color) {
|
|
14710
|
-
return
|
|
14898
|
+
return resolveColorTokenValue13(componentColorTokens.chart.seriesSubtle[color]);
|
|
14711
14899
|
}
|
|
14712
14900
|
function gridStroke() {
|
|
14713
|
-
return
|
|
14901
|
+
return resolveColorTokenValue13(componentColorTokens.chart.grid);
|
|
14714
14902
|
}
|
|
14715
14903
|
function gridBaselineStroke() {
|
|
14716
|
-
return
|
|
14904
|
+
return resolveColorTokenValue13(componentColorTokens.chart.gridBaseline);
|
|
14717
14905
|
}
|
|
14718
14906
|
function pointStrokeColor() {
|
|
14719
|
-
return
|
|
14907
|
+
return resolveColorTokenValue13(componentColorTokens.chart.pointStroke);
|
|
14720
14908
|
}
|
|
14721
14909
|
function resolveScale(values, max, fallbackMax = 100) {
|
|
14722
14910
|
if (max !== void 0 && max > 0) return max;
|
|
@@ -15165,6 +15353,546 @@ function ChartLegendItem({
|
|
|
15165
15353
|
}
|
|
15166
15354
|
);
|
|
15167
15355
|
}
|
|
15356
|
+
|
|
15357
|
+
// src/components/Slot/Slot.tsx
|
|
15358
|
+
import { Slot as Slot5 } from "@refineui/utilities/react";
|
|
15359
|
+
|
|
15360
|
+
// src/components/Collapsible/Collapsible.tsx
|
|
15361
|
+
import {
|
|
15362
|
+
createContext as createContext27,
|
|
15363
|
+
forwardRef as forwardRef16,
|
|
15364
|
+
useContext as useContext31,
|
|
15365
|
+
useEffect as useEffect21,
|
|
15366
|
+
useId as useId18,
|
|
15367
|
+
useLayoutEffect as useLayoutEffect14,
|
|
15368
|
+
useRef as useRef24,
|
|
15369
|
+
useState as useState32
|
|
15370
|
+
} from "react";
|
|
15371
|
+
import { clsx as clsx108 } from "clsx";
|
|
15372
|
+
import { semanticInteraction as semanticInteraction9 } from "@refineui/tokens";
|
|
15373
|
+
import { Slot as Slot6 } from "@refineui/utilities/react";
|
|
15374
|
+
import { jsx as jsx78 } from "react/jsx-runtime";
|
|
15375
|
+
var CollapsibleContext = createContext27(null);
|
|
15376
|
+
function useCollapsible() {
|
|
15377
|
+
const value = useContext31(CollapsibleContext);
|
|
15378
|
+
if (!value) throw new Error("Collapsible parts must be used inside Collapsible.Root");
|
|
15379
|
+
return value;
|
|
15380
|
+
}
|
|
15381
|
+
function usePrefersReducedMotion3() {
|
|
15382
|
+
const [reduce, setReduce] = useState32(false);
|
|
15383
|
+
useEffect21(() => {
|
|
15384
|
+
const query = window.matchMedia("(prefers-reduced-motion: reduce)");
|
|
15385
|
+
const sync = () => setReduce(query.matches);
|
|
15386
|
+
sync();
|
|
15387
|
+
query.addEventListener("change", sync);
|
|
15388
|
+
return () => query.removeEventListener("change", sync);
|
|
15389
|
+
}, []);
|
|
15390
|
+
return reduce;
|
|
15391
|
+
}
|
|
15392
|
+
var CollapsibleRoot = forwardRef16(function CollapsibleRoot2({ open: openProp, defaultOpen = false, onOpenChange, asChild = false, className, children, ...props }, ref) {
|
|
15393
|
+
const [uncontrolled, setUncontrolled] = useState32(defaultOpen);
|
|
15394
|
+
const open = openProp ?? uncontrolled;
|
|
15395
|
+
const openRef = useRef24(open);
|
|
15396
|
+
openRef.current = open;
|
|
15397
|
+
const reactId = useId18();
|
|
15398
|
+
const reduceMotion = usePrefersReducedMotion3();
|
|
15399
|
+
const toggle = () => {
|
|
15400
|
+
const next = !openRef.current;
|
|
15401
|
+
if (openProp === void 0) setUncontrolled(next);
|
|
15402
|
+
onOpenChange?.(next);
|
|
15403
|
+
};
|
|
15404
|
+
const shared = {
|
|
15405
|
+
...props,
|
|
15406
|
+
ref,
|
|
15407
|
+
"data-state": open ? "open" : "closed",
|
|
15408
|
+
"data-refineui": "collapsible",
|
|
15409
|
+
className
|
|
15410
|
+
};
|
|
15411
|
+
return /* @__PURE__ */ jsx78(
|
|
15412
|
+
CollapsibleContext.Provider,
|
|
15413
|
+
{
|
|
15414
|
+
value: {
|
|
15415
|
+
open,
|
|
15416
|
+
toggle,
|
|
15417
|
+
contentId: `${reactId}-content`,
|
|
15418
|
+
triggerId: `${reactId}-trigger`,
|
|
15419
|
+
reduceMotion
|
|
15420
|
+
},
|
|
15421
|
+
children: asChild ? /* @__PURE__ */ jsx78(Slot6, { ...shared, children }) : /* @__PURE__ */ jsx78("div", { ...shared, children })
|
|
15422
|
+
}
|
|
15423
|
+
);
|
|
15424
|
+
});
|
|
15425
|
+
var CollapsibleTrigger = forwardRef16(function CollapsibleTrigger2({ asChild = false, onClick, className, children, ...props }, ref) {
|
|
15426
|
+
const { open, toggle, contentId, triggerId } = useCollapsible();
|
|
15427
|
+
const shared = {
|
|
15428
|
+
...props,
|
|
15429
|
+
ref,
|
|
15430
|
+
id: triggerId,
|
|
15431
|
+
"aria-expanded": open,
|
|
15432
|
+
"aria-controls": contentId,
|
|
15433
|
+
"data-state": open ? "open" : "closed",
|
|
15434
|
+
"data-refineui": "collapsible-trigger",
|
|
15435
|
+
className,
|
|
15436
|
+
onClick: (event) => {
|
|
15437
|
+
onClick?.(event);
|
|
15438
|
+
if (!event.defaultPrevented) toggle();
|
|
15439
|
+
}
|
|
15440
|
+
};
|
|
15441
|
+
if (asChild) return /* @__PURE__ */ jsx78(Slot6, { ...shared, children });
|
|
15442
|
+
return /* @__PURE__ */ jsx78("button", { ...shared, type: "button", children });
|
|
15443
|
+
});
|
|
15444
|
+
var CollapsibleContent = forwardRef16(function CollapsibleContent2({ className, children, style, ...props }, ref) {
|
|
15445
|
+
const { open, contentId, triggerId, reduceMotion } = useCollapsible();
|
|
15446
|
+
const innerRef = useRef24(null);
|
|
15447
|
+
const [size, setSize] = useState32({ height: 0, width: 0 });
|
|
15448
|
+
useLayoutEffect14(() => {
|
|
15449
|
+
const node = innerRef.current;
|
|
15450
|
+
if (!node) return;
|
|
15451
|
+
const measure = () => {
|
|
15452
|
+
setSize({ height: node.scrollHeight, width: node.scrollWidth });
|
|
15453
|
+
};
|
|
15454
|
+
measure();
|
|
15455
|
+
const observer = new ResizeObserver(measure);
|
|
15456
|
+
observer.observe(node);
|
|
15457
|
+
return () => observer.disconnect();
|
|
15458
|
+
}, [children, open]);
|
|
15459
|
+
const clipStyle = {
|
|
15460
|
+
["--refineui-collapsible-content-height"]: `${size.height}px`,
|
|
15461
|
+
["--refineui-collapsible-content-width"]: `${size.width}px`,
|
|
15462
|
+
height: open ? size.height : 0,
|
|
15463
|
+
overflow: "hidden",
|
|
15464
|
+
transition: reduceMotion ? void 0 : `height ${semanticInteraction9.duration.panel} ${semanticInteraction9.easing.panel}`
|
|
15465
|
+
};
|
|
15466
|
+
return /* @__PURE__ */ jsx78(
|
|
15467
|
+
"div",
|
|
15468
|
+
{
|
|
15469
|
+
...props,
|
|
15470
|
+
ref,
|
|
15471
|
+
id: contentId,
|
|
15472
|
+
role: "region",
|
|
15473
|
+
"aria-labelledby": triggerId,
|
|
15474
|
+
"aria-hidden": !open,
|
|
15475
|
+
"data-state": open ? "open" : "closed",
|
|
15476
|
+
"data-refineui": "collapsible-content",
|
|
15477
|
+
style: clipStyle,
|
|
15478
|
+
children: /* @__PURE__ */ jsx78("div", { ref: innerRef, className: clsx108(className), style, children })
|
|
15479
|
+
}
|
|
15480
|
+
);
|
|
15481
|
+
});
|
|
15482
|
+
var Collapsible = Object.assign(CollapsibleRoot, {
|
|
15483
|
+
Root: CollapsibleRoot,
|
|
15484
|
+
Trigger: CollapsibleTrigger,
|
|
15485
|
+
Content: CollapsibleContent
|
|
15486
|
+
});
|
|
15487
|
+
|
|
15488
|
+
// src/components/ContextMenu/ContextMenu.tsx
|
|
15489
|
+
import {
|
|
15490
|
+
createContext as createContext28,
|
|
15491
|
+
forwardRef as forwardRef17,
|
|
15492
|
+
useCallback as useCallback22,
|
|
15493
|
+
useContext as useContext32,
|
|
15494
|
+
useEffect as useEffect22,
|
|
15495
|
+
useLayoutEffect as useLayoutEffect15,
|
|
15496
|
+
useMemo as useMemo23,
|
|
15497
|
+
useRef as useRef25,
|
|
15498
|
+
useState as useState33
|
|
15499
|
+
} from "react";
|
|
15500
|
+
import { createPortal as createPortal7 } from "react-dom";
|
|
15501
|
+
import { clsx as clsx109 } from "clsx";
|
|
15502
|
+
import { componentSizes as componentSizes3, iconSizes as iconSizes24, semanticInteraction as semanticInteraction10 } from "@refineui/tokens";
|
|
15503
|
+
import { motionMsToNumber as motionMsToNumber7 } from "@refineui/utilities/animation";
|
|
15504
|
+
import { Slot as Slot7 } from "@refineui/utilities/react";
|
|
15505
|
+
import { Fragment as Fragment5, jsx as jsx79, jsxs as jsxs33 } from "react/jsx-runtime";
|
|
15506
|
+
var MENU_ATTR = "data-refineui-context-menu";
|
|
15507
|
+
var CLOSE_MS = motionMsToNumber7(semanticInteraction10.duration.normal);
|
|
15508
|
+
var MenuContext2 = createContext28(null);
|
|
15509
|
+
var SubContext = createContext28(null);
|
|
15510
|
+
function useMenu() {
|
|
15511
|
+
const value = useContext32(MenuContext2);
|
|
15512
|
+
if (!value) throw new Error("Context menu parts must be used inside ContextMenu.Root");
|
|
15513
|
+
return value;
|
|
15514
|
+
}
|
|
15515
|
+
function placeInView(element, x, y) {
|
|
15516
|
+
const width = element.offsetWidth;
|
|
15517
|
+
const height = element.offsetHeight;
|
|
15518
|
+
const pad = 4;
|
|
15519
|
+
let left = x;
|
|
15520
|
+
let top = y;
|
|
15521
|
+
if (left + width > window.innerWidth - pad) left = Math.max(pad, window.innerWidth - width - pad);
|
|
15522
|
+
if (top + height > window.innerHeight - pad) top = Math.max(pad, window.innerHeight - height - pad);
|
|
15523
|
+
element.style.left = `${left}px`;
|
|
15524
|
+
element.style.top = `${top}px`;
|
|
15525
|
+
}
|
|
15526
|
+
function ContextMenuRoot({ modal = true, onOpenChange, children }) {
|
|
15527
|
+
void modal;
|
|
15528
|
+
const [open, setOpen] = useState33(false);
|
|
15529
|
+
const [point, setPoint] = useState33({ x: 0, y: 0 });
|
|
15530
|
+
const openRef = useRef25(false);
|
|
15531
|
+
const onOpenChangeRef = useRef25(onOpenChange);
|
|
15532
|
+
openRef.current = open;
|
|
15533
|
+
onOpenChangeRef.current = onOpenChange;
|
|
15534
|
+
const close = useCallback22(() => {
|
|
15535
|
+
if (!openRef.current) return;
|
|
15536
|
+
openRef.current = false;
|
|
15537
|
+
setOpen(false);
|
|
15538
|
+
onOpenChangeRef.current?.(false);
|
|
15539
|
+
}, []);
|
|
15540
|
+
const openAt = useCallback22((x, y) => {
|
|
15541
|
+
setPoint({ x, y });
|
|
15542
|
+
const wasOpen = openRef.current;
|
|
15543
|
+
openRef.current = true;
|
|
15544
|
+
setOpen(true);
|
|
15545
|
+
if (!wasOpen) onOpenChangeRef.current?.(true);
|
|
15546
|
+
}, []);
|
|
15547
|
+
const value = useMemo23(() => ({ open, point, openAt, close }), [open, point, openAt, close]);
|
|
15548
|
+
return /* @__PURE__ */ jsx79(MenuContext2.Provider, { value, children });
|
|
15549
|
+
}
|
|
15550
|
+
var ContextMenuTrigger = forwardRef17(function ContextMenuTrigger2({ asChild = false, onContextMenu, children, ...props }, ref) {
|
|
15551
|
+
const { openAt } = useMenu();
|
|
15552
|
+
const shared = {
|
|
15553
|
+
...props,
|
|
15554
|
+
ref,
|
|
15555
|
+
[MENU_ATTR]: "",
|
|
15556
|
+
onContextMenu: (event) => {
|
|
15557
|
+
onContextMenu?.(event);
|
|
15558
|
+
if (event.defaultPrevented) return;
|
|
15559
|
+
event.preventDefault();
|
|
15560
|
+
openAt(event.clientX, event.clientY);
|
|
15561
|
+
}
|
|
15562
|
+
};
|
|
15563
|
+
if (asChild) return /* @__PURE__ */ jsx79(Slot7, { ...shared, children });
|
|
15564
|
+
return /* @__PURE__ */ jsx79("span", { ...shared, className: clsx109(menuStyles.triggerFallback, props.className), children });
|
|
15565
|
+
});
|
|
15566
|
+
function ContextMenuPortal({ children }) {
|
|
15567
|
+
return /* @__PURE__ */ jsx79(Fragment5, { children });
|
|
15568
|
+
}
|
|
15569
|
+
var ContextMenuContent = forwardRef17(function ContextMenuContent2({ className, style, onPointerDown, children, ...props }, ref) {
|
|
15570
|
+
const { open, point, close } = useMenu();
|
|
15571
|
+
const localRef = useRef25(null);
|
|
15572
|
+
const [shouldRender, setShouldRender] = useState33(open);
|
|
15573
|
+
const [isClosing, setIsClosing] = useState33(false);
|
|
15574
|
+
useEffect22(() => {
|
|
15575
|
+
if (open) {
|
|
15576
|
+
setShouldRender(true);
|
|
15577
|
+
setIsClosing(false);
|
|
15578
|
+
return;
|
|
15579
|
+
}
|
|
15580
|
+
if (!shouldRender) return;
|
|
15581
|
+
setIsClosing(true);
|
|
15582
|
+
const timeout = window.setTimeout(() => {
|
|
15583
|
+
setShouldRender(false);
|
|
15584
|
+
setIsClosing(false);
|
|
15585
|
+
}, CLOSE_MS);
|
|
15586
|
+
return () => window.clearTimeout(timeout);
|
|
15587
|
+
}, [open, shouldRender]);
|
|
15588
|
+
useLayoutEffect15(() => {
|
|
15589
|
+
if (!shouldRender || !localRef.current) return;
|
|
15590
|
+
placeInView(localRef.current, point.x, point.y);
|
|
15591
|
+
}, [shouldRender, point.x, point.y]);
|
|
15592
|
+
useEffect22(() => {
|
|
15593
|
+
if (!open) return;
|
|
15594
|
+
const onKey = (event) => {
|
|
15595
|
+
if (event.key === "Escape") close();
|
|
15596
|
+
};
|
|
15597
|
+
const onPointer = (event) => {
|
|
15598
|
+
const target = event.target;
|
|
15599
|
+
if (target instanceof Element && target.closest(`[${MENU_ATTR}]`)) return;
|
|
15600
|
+
close();
|
|
15601
|
+
};
|
|
15602
|
+
document.addEventListener("keydown", onKey);
|
|
15603
|
+
document.addEventListener("pointerdown", onPointer);
|
|
15604
|
+
return () => {
|
|
15605
|
+
document.removeEventListener("keydown", onKey);
|
|
15606
|
+
document.removeEventListener("pointerdown", onPointer);
|
|
15607
|
+
};
|
|
15608
|
+
}, [open, close]);
|
|
15609
|
+
if (!shouldRender || typeof document === "undefined") return null;
|
|
15610
|
+
return createPortal7(
|
|
15611
|
+
/* @__PURE__ */ jsx79(
|
|
15612
|
+
"div",
|
|
15613
|
+
{
|
|
15614
|
+
...props,
|
|
15615
|
+
ref: (node) => {
|
|
15616
|
+
localRef.current = node;
|
|
15617
|
+
if (typeof ref === "function") ref(node);
|
|
15618
|
+
else if (ref) ref.current = node;
|
|
15619
|
+
},
|
|
15620
|
+
"data-refineui": "menu-popover",
|
|
15621
|
+
"data-state": isClosing ? "closed" : "open",
|
|
15622
|
+
...{ [MENU_ATTR]: "" },
|
|
15623
|
+
className: menuStyles.popover,
|
|
15624
|
+
style: {
|
|
15625
|
+
position: "fixed",
|
|
15626
|
+
top: point.y,
|
|
15627
|
+
left: point.x,
|
|
15628
|
+
width: componentSizes3.menuPanelWidth,
|
|
15629
|
+
minWidth: componentSizes3.menuPanelWidth,
|
|
15630
|
+
zIndex: 9999,
|
|
15631
|
+
...style
|
|
15632
|
+
},
|
|
15633
|
+
onPointerDown: (event) => {
|
|
15634
|
+
event.preventDefault();
|
|
15635
|
+
onPointerDown?.(event);
|
|
15636
|
+
},
|
|
15637
|
+
onContextMenu: (event) => event.preventDefault(),
|
|
15638
|
+
children: /* @__PURE__ */ jsx79("div", { role: "menu", "data-refineui": "menu", className: clsx109(menuStyles.list, className), children })
|
|
15639
|
+
}
|
|
15640
|
+
),
|
|
15641
|
+
document.body
|
|
15642
|
+
);
|
|
15643
|
+
});
|
|
15644
|
+
function runSelect(onSelect, close, disabled) {
|
|
15645
|
+
if (disabled) return;
|
|
15646
|
+
const selectEvent = {
|
|
15647
|
+
defaultPrevented: false,
|
|
15648
|
+
preventDefault() {
|
|
15649
|
+
selectEvent.defaultPrevented = true;
|
|
15650
|
+
}
|
|
15651
|
+
};
|
|
15652
|
+
onSelect?.(selectEvent);
|
|
15653
|
+
if (!selectEvent.defaultPrevented) close();
|
|
15654
|
+
}
|
|
15655
|
+
var ContextMenuItem = forwardRef17(function ContextMenuItem2({ disabled = false, description, shortcut, startIcon, endIcon, state = "default", onSelect, className, onClick, onKeyDown, children, ...props }, ref) {
|
|
15656
|
+
const { close } = useMenu();
|
|
15657
|
+
const isDisabled = disabled || state === "disabled";
|
|
15658
|
+
const slotted = startIcon != null || description != null || shortcut != null || endIcon != null;
|
|
15659
|
+
return /* @__PURE__ */ jsx79(
|
|
15660
|
+
"button",
|
|
15661
|
+
{
|
|
15662
|
+
ref,
|
|
15663
|
+
type: "button",
|
|
15664
|
+
role: "menuitem",
|
|
15665
|
+
disabled: isDisabled,
|
|
15666
|
+
"aria-disabled": isDisabled || void 0,
|
|
15667
|
+
"data-refineui": "menu-item",
|
|
15668
|
+
"data-state": isDisabled ? "disabled" : state,
|
|
15669
|
+
...{ [MENU_ATTR]: "" },
|
|
15670
|
+
className: clsx109(menuStyles.itemBase, isDisabled ? menuStyles.itemDisabled : menuStyles.itemEnabled, className),
|
|
15671
|
+
...props,
|
|
15672
|
+
onClick: (event) => {
|
|
15673
|
+
onClick?.(event);
|
|
15674
|
+
if (event.defaultPrevented) return;
|
|
15675
|
+
runSelect(onSelect, close, isDisabled);
|
|
15676
|
+
},
|
|
15677
|
+
onKeyDown: (event) => {
|
|
15678
|
+
onKeyDown?.(event);
|
|
15679
|
+
if (event.defaultPrevented) return;
|
|
15680
|
+
if (event.key === "Enter" || event.key === " ") {
|
|
15681
|
+
event.preventDefault();
|
|
15682
|
+
runSelect(onSelect, close, isDisabled);
|
|
15683
|
+
}
|
|
15684
|
+
},
|
|
15685
|
+
children: slotted ? /* @__PURE__ */ jsxs33("span", { className: menuStyles.row, children: [
|
|
15686
|
+
startIcon ? /* @__PURE__ */ jsx79(
|
|
15687
|
+
"span",
|
|
15688
|
+
{
|
|
15689
|
+
className: menuStyles.iconWrap,
|
|
15690
|
+
style: { width: iconSizes24.small, minWidth: iconSizes24.small, height: iconSizes24.small },
|
|
15691
|
+
children: startIcon
|
|
15692
|
+
}
|
|
15693
|
+
) : null,
|
|
15694
|
+
/* @__PURE__ */ jsxs33("span", { className: menuStyles.textCol, children: [
|
|
15695
|
+
/* @__PURE__ */ jsx79("span", { className: menuStyles.title, children }),
|
|
15696
|
+
description ? /* @__PURE__ */ jsx79("span", { className: clsx109(menuStyles.description, isDisabled ? menuStyles.descriptionDisabled : menuStyles.descriptionEnabled), children: description }) : null
|
|
15697
|
+
] }),
|
|
15698
|
+
(shortcut || endIcon) && /* @__PURE__ */ jsxs33("span", { className: menuStyles.rightWrap, children: [
|
|
15699
|
+
shortcut ? /* @__PURE__ */ jsx79("span", { className: menuStyles.shortcut, children: shortcut }) : null,
|
|
15700
|
+
endIcon ? /* @__PURE__ */ jsx79(
|
|
15701
|
+
"span",
|
|
15702
|
+
{
|
|
15703
|
+
className: menuStyles.iconWrap,
|
|
15704
|
+
style: { width: iconSizes24.small, minWidth: iconSizes24.small, height: iconSizes24.small },
|
|
15705
|
+
children: endIcon
|
|
15706
|
+
}
|
|
15707
|
+
) : null
|
|
15708
|
+
] })
|
|
15709
|
+
] }) : /* @__PURE__ */ jsx79("span", { className: menuStyles.row, children })
|
|
15710
|
+
}
|
|
15711
|
+
);
|
|
15712
|
+
});
|
|
15713
|
+
var ContextMenuSeparator = forwardRef17(
|
|
15714
|
+
function ContextMenuSeparator2({ className, ...props }, ref) {
|
|
15715
|
+
return /* @__PURE__ */ jsx79(
|
|
15716
|
+
"div",
|
|
15717
|
+
{
|
|
15718
|
+
ref,
|
|
15719
|
+
role: "separator",
|
|
15720
|
+
"aria-orientation": "horizontal",
|
|
15721
|
+
"data-refineui": "menu-divider",
|
|
15722
|
+
...{ [MENU_ATTR]: "" },
|
|
15723
|
+
className: clsx109(menuStyles.dividerWrap, className),
|
|
15724
|
+
...props,
|
|
15725
|
+
children: /* @__PURE__ */ jsx79("div", { className: menuStyles.dividerLine })
|
|
15726
|
+
}
|
|
15727
|
+
);
|
|
15728
|
+
}
|
|
15729
|
+
);
|
|
15730
|
+
function ContextMenuSection({ className, children, ...props }) {
|
|
15731
|
+
return /* @__PURE__ */ jsx79("div", { "data-refineui": "menu-section", className: clsx109(menuStyles.section, className), ...props, children: /* @__PURE__ */ jsx79("span", { className: menuStyles.sectionText, children }) });
|
|
15732
|
+
}
|
|
15733
|
+
function ContextMenuSub({ children }) {
|
|
15734
|
+
const [open, setOpen] = useState33(false);
|
|
15735
|
+
const triggerRef = useRef25(null);
|
|
15736
|
+
const timer = useRef25(null);
|
|
15737
|
+
const clear = () => {
|
|
15738
|
+
if (timer.current != null) window.clearTimeout(timer.current);
|
|
15739
|
+
timer.current = null;
|
|
15740
|
+
};
|
|
15741
|
+
useEffect22(() => clear, []);
|
|
15742
|
+
const value = useMemo23(
|
|
15743
|
+
() => ({
|
|
15744
|
+
open,
|
|
15745
|
+
triggerRef,
|
|
15746
|
+
show: () => {
|
|
15747
|
+
clear();
|
|
15748
|
+
setOpen(true);
|
|
15749
|
+
},
|
|
15750
|
+
hideSoon: () => {
|
|
15751
|
+
clear();
|
|
15752
|
+
timer.current = window.setTimeout(() => setOpen(false), 150);
|
|
15753
|
+
}
|
|
15754
|
+
}),
|
|
15755
|
+
[open]
|
|
15756
|
+
);
|
|
15757
|
+
return /* @__PURE__ */ jsx79(SubContext.Provider, { value, children });
|
|
15758
|
+
}
|
|
15759
|
+
function useSub2() {
|
|
15760
|
+
const value = useContext32(SubContext);
|
|
15761
|
+
if (!value) throw new Error("ContextMenu.SubTrigger must be used inside ContextMenu.Sub");
|
|
15762
|
+
return value;
|
|
15763
|
+
}
|
|
15764
|
+
var ContextMenuSubTrigger = forwardRef17(
|
|
15765
|
+
function ContextMenuSubTrigger2({ asChild = false, description, startIcon, onMouseEnter, onMouseLeave, onClick, className, children, ...props }, ref) {
|
|
15766
|
+
const sub = useSub2();
|
|
15767
|
+
const shared = {
|
|
15768
|
+
...props,
|
|
15769
|
+
type: "button",
|
|
15770
|
+
role: "menuitem",
|
|
15771
|
+
"aria-haspopup": "menu",
|
|
15772
|
+
"aria-expanded": sub.open,
|
|
15773
|
+
"data-state": sub.open ? "active" : "default",
|
|
15774
|
+
"data-refineui": "menu-item",
|
|
15775
|
+
[MENU_ATTR]: "",
|
|
15776
|
+
className: clsx109(
|
|
15777
|
+
menuStyles.itemBase,
|
|
15778
|
+
menuStyles.itemEnabled,
|
|
15779
|
+
sub.open && "bg-refineui-alias-background-primary-hover",
|
|
15780
|
+
className
|
|
15781
|
+
),
|
|
15782
|
+
ref: (node) => {
|
|
15783
|
+
sub.triggerRef.current = node;
|
|
15784
|
+
if (typeof ref === "function") ref(node);
|
|
15785
|
+
else if (ref) ref.current = node;
|
|
15786
|
+
},
|
|
15787
|
+
onMouseEnter: (event) => {
|
|
15788
|
+
onMouseEnter?.(event);
|
|
15789
|
+
sub.show();
|
|
15790
|
+
},
|
|
15791
|
+
onMouseLeave: (event) => {
|
|
15792
|
+
onMouseLeave?.(event);
|
|
15793
|
+
sub.hideSoon();
|
|
15794
|
+
},
|
|
15795
|
+
onClick: (event) => {
|
|
15796
|
+
onClick?.(event);
|
|
15797
|
+
if (!event.defaultPrevented) sub.show();
|
|
15798
|
+
}
|
|
15799
|
+
};
|
|
15800
|
+
if (asChild) return /* @__PURE__ */ jsx79(Slot7, { ...shared, children });
|
|
15801
|
+
return /* @__PURE__ */ jsx79("button", { ...shared, children: /* @__PURE__ */ jsxs33("span", { className: menuStyles.row, children: [
|
|
15802
|
+
startIcon ? /* @__PURE__ */ jsx79(
|
|
15803
|
+
"span",
|
|
15804
|
+
{
|
|
15805
|
+
className: menuStyles.iconWrap,
|
|
15806
|
+
style: { width: iconSizes24.small, minWidth: iconSizes24.small, height: iconSizes24.small },
|
|
15807
|
+
children: startIcon
|
|
15808
|
+
}
|
|
15809
|
+
) : null,
|
|
15810
|
+
/* @__PURE__ */ jsxs33("span", { className: menuStyles.textCol, children: [
|
|
15811
|
+
/* @__PURE__ */ jsx79("span", { className: menuStyles.title, children }),
|
|
15812
|
+
description ? /* @__PURE__ */ jsx79("span", { className: clsx109(menuStyles.description, menuStyles.descriptionEnabled), children: description }) : null
|
|
15813
|
+
] }),
|
|
15814
|
+
/* @__PURE__ */ jsx79("span", { className: menuStyles.rightWrap, children: /* @__PURE__ */ jsx79(
|
|
15815
|
+
"span",
|
|
15816
|
+
{
|
|
15817
|
+
className: menuStyles.iconWrap,
|
|
15818
|
+
style: { width: iconSizes24.small, minWidth: iconSizes24.small, height: iconSizes24.small },
|
|
15819
|
+
children: /* @__PURE__ */ jsx79(WebIcon, { name: "chevron-right", size: iconSizes24.small, color: "currentColor", "aria-hidden": true })
|
|
15820
|
+
}
|
|
15821
|
+
) })
|
|
15822
|
+
] }) });
|
|
15823
|
+
}
|
|
15824
|
+
);
|
|
15825
|
+
var ContextMenuSubContent = forwardRef17(
|
|
15826
|
+
function ContextMenuSubContent2({ className, style, onPointerDown, onMouseEnter, onMouseLeave, ...props }, ref) {
|
|
15827
|
+
const sub = useSub2();
|
|
15828
|
+
const localRef = useRef25(null);
|
|
15829
|
+
const [side, setSide] = useState33("right");
|
|
15830
|
+
useLayoutEffect15(() => {
|
|
15831
|
+
const trigger = sub.triggerRef.current;
|
|
15832
|
+
const element = localRef.current;
|
|
15833
|
+
if (!sub.open || !trigger || !element) return;
|
|
15834
|
+
const rect = trigger.getBoundingClientRect();
|
|
15835
|
+
const width = element.offsetWidth;
|
|
15836
|
+
const pad = 4;
|
|
15837
|
+
let left = rect.right;
|
|
15838
|
+
let nextSide = "right";
|
|
15839
|
+
if (left + width > window.innerWidth - pad) {
|
|
15840
|
+
left = Math.max(pad, rect.left - width);
|
|
15841
|
+
nextSide = "left";
|
|
15842
|
+
}
|
|
15843
|
+
setSide(nextSide);
|
|
15844
|
+
placeInView(element, left, rect.top);
|
|
15845
|
+
}, [sub.open, sub.triggerRef]);
|
|
15846
|
+
if (!sub.open || typeof document === "undefined") return null;
|
|
15847
|
+
return createPortal7(
|
|
15848
|
+
/* @__PURE__ */ jsx79(
|
|
15849
|
+
"div",
|
|
15850
|
+
{
|
|
15851
|
+
...props,
|
|
15852
|
+
ref: (node) => {
|
|
15853
|
+
localRef.current = node;
|
|
15854
|
+
if (typeof ref === "function") ref(node);
|
|
15855
|
+
else if (ref) ref.current = node;
|
|
15856
|
+
},
|
|
15857
|
+
role: "menu",
|
|
15858
|
+
"data-refineui": "menu",
|
|
15859
|
+
"data-submenu": "true",
|
|
15860
|
+
"data-state": "open",
|
|
15861
|
+
"data-side": side,
|
|
15862
|
+
...{ [MENU_ATTR]: "" },
|
|
15863
|
+
className: clsx109(menuStyles.subPanel, className),
|
|
15864
|
+
style: { position: "fixed", zIndex: 1e4, ...style },
|
|
15865
|
+
onPointerDown: (event) => {
|
|
15866
|
+
event.preventDefault();
|
|
15867
|
+
onPointerDown?.(event);
|
|
15868
|
+
},
|
|
15869
|
+
onMouseEnter: (event) => {
|
|
15870
|
+
onMouseEnter?.(event);
|
|
15871
|
+
sub.show();
|
|
15872
|
+
},
|
|
15873
|
+
onMouseLeave: (event) => {
|
|
15874
|
+
onMouseLeave?.(event);
|
|
15875
|
+
sub.hideSoon();
|
|
15876
|
+
},
|
|
15877
|
+
onContextMenu: (event) => event.preventDefault()
|
|
15878
|
+
}
|
|
15879
|
+
),
|
|
15880
|
+
document.body
|
|
15881
|
+
);
|
|
15882
|
+
}
|
|
15883
|
+
);
|
|
15884
|
+
var ContextMenu = Object.assign(ContextMenuRoot, {
|
|
15885
|
+
Root: ContextMenuRoot,
|
|
15886
|
+
Trigger: ContextMenuTrigger,
|
|
15887
|
+
Portal: ContextMenuPortal,
|
|
15888
|
+
Content: ContextMenuContent,
|
|
15889
|
+
Item: ContextMenuItem,
|
|
15890
|
+
Section: ContextMenuSection,
|
|
15891
|
+
Separator: ContextMenuSeparator,
|
|
15892
|
+
Sub: ContextMenuSub,
|
|
15893
|
+
SubTrigger: ContextMenuSubTrigger,
|
|
15894
|
+
SubContent: ContextMenuSubContent
|
|
15895
|
+
});
|
|
15168
15896
|
export {
|
|
15169
15897
|
Accordion,
|
|
15170
15898
|
AccordionContent,
|
|
@@ -15234,6 +15962,10 @@ export {
|
|
|
15234
15962
|
ChartYAxisLabels,
|
|
15235
15963
|
Checkbox,
|
|
15236
15964
|
Chip,
|
|
15965
|
+
Collapsible,
|
|
15966
|
+
CollapsibleContent,
|
|
15967
|
+
CollapsibleRoot,
|
|
15968
|
+
CollapsibleTrigger,
|
|
15237
15969
|
Command,
|
|
15238
15970
|
CommandDialog,
|
|
15239
15971
|
CommandEmpty,
|
|
@@ -15245,6 +15977,17 @@ export {
|
|
|
15245
15977
|
CommandSeparator,
|
|
15246
15978
|
CommandShortcut,
|
|
15247
15979
|
Container,
|
|
15980
|
+
ContextMenu,
|
|
15981
|
+
ContextMenuContent,
|
|
15982
|
+
ContextMenuItem,
|
|
15983
|
+
ContextMenuPortal,
|
|
15984
|
+
ContextMenuRoot,
|
|
15985
|
+
ContextMenuSection,
|
|
15986
|
+
ContextMenuSeparator,
|
|
15987
|
+
ContextMenuSub,
|
|
15988
|
+
ContextMenuSubContent,
|
|
15989
|
+
ContextMenuSubTrigger,
|
|
15990
|
+
ContextMenuTrigger,
|
|
15248
15991
|
Dialog,
|
|
15249
15992
|
DialogClose,
|
|
15250
15993
|
DialogContent,
|
|
@@ -15387,6 +16130,7 @@ export {
|
|
|
15387
16130
|
SidebarPeekPin,
|
|
15388
16131
|
Skeleton,
|
|
15389
16132
|
Slider,
|
|
16133
|
+
Slot5 as Slot,
|
|
15390
16134
|
Spacer,
|
|
15391
16135
|
SpinButton,
|
|
15392
16136
|
Spinner,
|
|
@@ -15427,8 +16171,9 @@ export {
|
|
|
15427
16171
|
breadcrumbLinkClassName,
|
|
15428
16172
|
componentColorTokens,
|
|
15429
16173
|
componentSizeFoundationKeys,
|
|
15430
|
-
componentSizes,
|
|
16174
|
+
componentSizes2 as componentSizes,
|
|
15431
16175
|
componentTextClass,
|
|
16176
|
+
componentTokens,
|
|
15432
16177
|
componentTypographyTokens,
|
|
15433
16178
|
defaultCommandFilter,
|
|
15434
16179
|
dismissToast,
|