shadcn-glass-ui 2.0.11 → 2.1.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/CHANGELOG.md +109 -5
- package/README.md +132 -43
- package/context7.json +2 -1
- package/dist/cli/index.cjs +1 -1
- package/dist/components.cjs +4 -4
- package/dist/components.d.ts +103 -29
- package/dist/components.js +1 -1
- package/dist/demo-screenshot-aurora.png +0 -0
- package/dist/demo-screenshot.png +0 -0
- package/dist/demo-screenshot.png.zip +0 -0
- package/dist/hooks.cjs +2 -2
- package/dist/index.cjs +5 -5
- package/dist/index.js +28 -28
- package/dist/index.js.map +1 -1
- package/dist/r/ai-card-glass.json +1 -1
- package/dist/r/avatar-glass.json +1 -1
- package/dist/r/badge-glass.json +1 -1
- package/dist/r/button-glass.json +1 -1
- package/dist/r/combobox-glass.json +1 -1
- package/dist/r/registry.json +2 -2
- package/dist/r/repository-card-glass.json +2 -1
- package/dist/r/slider-glass.json +4 -5
- package/dist/r/toggle-glass.json +2 -2
- package/dist/r/year-card-glass.json +1 -1
- package/dist/shadcn-glass-ui.css +1 -1
- package/dist/{theme-context-DNe_2vWJ.cjs → theme-context-BHXYJ4RE.cjs} +2 -2
- package/dist/{theme-context-DNe_2vWJ.cjs.map → theme-context-BHXYJ4RE.cjs.map} +1 -1
- package/dist/themes.cjs +1 -1
- package/dist/{trust-score-card-glass-Dgu46oWI.cjs → trust-score-card-glass-CGXmOIfq.cjs} +850 -150
- package/dist/trust-score-card-glass-CGXmOIfq.cjs.map +1 -0
- package/dist/{trust-score-card-glass-A7kas5OS.js → trust-score-card-glass-L9g0qamo.js} +1182 -482
- package/dist/trust-score-card-glass-L9g0qamo.js.map +1 -0
- package/dist/{use-focus-BRkQtQCj.cjs → use-focus-CeNHOiBa.cjs} +2 -2
- package/dist/{use-focus-BRkQtQCj.cjs.map → use-focus-CeNHOiBa.cjs.map} +1 -1
- package/dist/{use-wallpaper-tint-CfShPBo2.cjs → use-wallpaper-tint-Bt2G3g1v.cjs} +2 -2
- package/dist/{use-wallpaper-tint-CfShPBo2.cjs.map → use-wallpaper-tint-Bt2G3g1v.cjs.map} +1 -1
- package/dist/{utils-BXN7AcRu.cjs → utils-LYxxWvUn.cjs} +2 -2
- package/dist/{utils-BXN7AcRu.cjs.map → utils-LYxxWvUn.cjs.map} +1 -1
- package/dist/utils.cjs +1 -1
- package/docs/ADVANCED_PATTERNS.md +584 -0
- package/docs/AI_USAGE.md +135 -611
- package/docs/BEST_PRACTICES.md +2 -2
- package/docs/BREAKING_CHANGES.md +239 -0
- package/docs/COMPONENTS_CATALOG.md +8 -8
- package/docs/EXPORTS_STRUCTURE.md +3 -3
- package/docs/GETTING_STARTED.md +13 -8
- package/docs/PUBLISHING.md +1 -1
- package/docs/REGISTRY_SUMMARY.md +2 -2
- package/docs/REGISTRY_USAGE.md +1 -1
- package/docs/api/README.md +11 -11
- package/docs/api/interfaces/BadgeGlassProps.md +21 -14
- package/docs/api/interfaces/ButtonGlassProps.md +37 -30
- package/package.json +4 -3
- package/dist/trust-score-card-glass-A7kas5OS.js.map +0 -1
- package/dist/trust-score-card-glass-Dgu46oWI.cjs.map +0 -1
- package/dist/vite.svg +0 -1
- package/docs/migration/modal-glass-compound-api.md +0 -458
- package/docs/migration/select-to-combobox.md +0 -386
- package/docs/migration/tabs-glass-compound-api.md +0 -579
|
@@ -27,9 +27,9 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
27
27
|
value: mod,
|
|
28
28
|
enumerable: true
|
|
29
29
|
}) : target, mod));
|
|
30
|
-
const require_utils = require("./utils-
|
|
31
|
-
const require_use_focus = require("./use-focus-
|
|
32
|
-
const require_theme_context = require("./theme-context-
|
|
30
|
+
const require_utils = require("./utils-LYxxWvUn.cjs");
|
|
31
|
+
const require_use_focus = require("./use-focus-CeNHOiBa.cjs");
|
|
32
|
+
const require_theme_context = require("./theme-context-BHXYJ4RE.cjs");
|
|
33
33
|
let react = require("react");
|
|
34
34
|
react = __toESM(react);
|
|
35
35
|
let lucide_react = require("lucide-react");
|
|
@@ -412,29 +412,30 @@ BadgeGlass.displayName = "BadgeGlass";
|
|
|
412
412
|
const buttonGlassVariants = (0, class_variance_authority.cva)("relative overflow-hidden font-medium inline-flex items-center justify-center transition-all duration-300 ease-out cursor-pointer disabled:opacity-50 disabled:cursor-not-allowed", {
|
|
413
413
|
variants: {
|
|
414
414
|
variant: {
|
|
415
|
-
|
|
415
|
+
default: "",
|
|
416
416
|
secondary: "",
|
|
417
417
|
ghost: "",
|
|
418
418
|
destructive: "",
|
|
419
|
+
outline: "",
|
|
419
420
|
success: "",
|
|
420
|
-
|
|
421
|
+
link: ""
|
|
421
422
|
},
|
|
422
423
|
size: {
|
|
423
424
|
sm: "px-3 py-1.5 text-sm gap-1.5 min-h-[44px] rounded-xl",
|
|
424
|
-
|
|
425
|
+
default: "px-4 py-2.5 text-sm gap-2 min-h-[44px] rounded-xl",
|
|
425
426
|
lg: "px-6 py-3 text-base gap-2.5 min-h-[48px] rounded-xl",
|
|
426
427
|
xl: "px-8 py-4 text-lg gap-3 min-h-[56px] rounded-xl",
|
|
427
428
|
icon: "p-2.5 min-h-[44px] min-w-[44px] rounded-xl"
|
|
428
429
|
}
|
|
429
430
|
},
|
|
430
431
|
defaultVariants: {
|
|
431
|
-
variant: "
|
|
432
|
-
size: "
|
|
432
|
+
variant: "default",
|
|
433
|
+
size: "default"
|
|
433
434
|
}
|
|
434
435
|
});
|
|
435
436
|
var getVariantStyles = (variant, isHovered, isFocusVisible) => {
|
|
436
437
|
return {
|
|
437
|
-
|
|
438
|
+
default: {
|
|
438
439
|
background: isHovered ? "var(--btn-primary-hover-bg)" : "var(--btn-primary-bg)",
|
|
439
440
|
color: "var(--btn-primary-text)",
|
|
440
441
|
border: "none",
|
|
@@ -458,21 +459,28 @@ var getVariantStyles = (variant, isHovered, isFocusVisible) => {
|
|
|
458
459
|
border: "none",
|
|
459
460
|
boxShadow: isFocusVisible ? "var(--focus-glow)" : isHovered ? "var(--btn-destructive-glow)" : "var(--btn-destructive-shadow)"
|
|
460
461
|
},
|
|
462
|
+
outline: {
|
|
463
|
+
background: isHovered ? "var(--btn-outline-hover-bg)" : "transparent",
|
|
464
|
+
color: "var(--btn-outline-text)",
|
|
465
|
+
border: "1px solid var(--btn-outline-border)",
|
|
466
|
+
boxShadow: isFocusVisible ? "var(--focus-glow)" : isHovered ? "var(--btn-outline-glow)" : "none"
|
|
467
|
+
},
|
|
461
468
|
success: {
|
|
462
469
|
background: "var(--btn-success-bg)",
|
|
463
470
|
color: "var(--btn-success-text)",
|
|
464
471
|
border: "none",
|
|
465
472
|
boxShadow: isFocusVisible ? "var(--focus-glow)" : isHovered ? "var(--btn-success-glow)" : "var(--btn-success-shadow)"
|
|
466
473
|
},
|
|
467
|
-
|
|
474
|
+
link: {
|
|
468
475
|
background: "transparent",
|
|
469
|
-
color: "var(--text
|
|
476
|
+
color: "var(--btn-link-text)",
|
|
470
477
|
border: "none",
|
|
471
|
-
boxShadow: isFocusVisible ? "var(--focus-glow)" : "none"
|
|
478
|
+
boxShadow: isFocusVisible ? "var(--focus-glow)" : "none",
|
|
479
|
+
textDecoration: isHovered ? "underline" : "none"
|
|
472
480
|
}
|
|
473
481
|
}[variant];
|
|
474
482
|
};
|
|
475
|
-
const ButtonGlass = (0, react.forwardRef)(({ asChild = false, className, variant = "
|
|
483
|
+
const ButtonGlass = (0, react.forwardRef)(({ asChild = false, className, variant = "default", size: size$3 = "default", children, loading = false, disabled, icon: Icon, iconPosition = "left", onClick, ...props }, ref) => {
|
|
476
484
|
const { isHovered, hoverProps } = require_use_focus.useHover();
|
|
477
485
|
const { isFocusVisible, focusProps } = require_use_focus.useFocus({ focusVisible: true });
|
|
478
486
|
const [ripple, setRipple] = (0, react.useState)(null);
|
|
@@ -516,7 +524,7 @@ const ButtonGlass = (0, react.forwardRef)(({ asChild = false, className, variant
|
|
|
516
524
|
onBlur: focusProps.onBlur,
|
|
517
525
|
...props,
|
|
518
526
|
children: asChild ? children : /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
|
|
519
|
-
isHovered && variant === "
|
|
527
|
+
isHovered && variant === "default" && !isDisabled && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
520
528
|
className: "absolute inset-0 overflow-hidden pointer-events-none",
|
|
521
529
|
style: { borderRadius: "inherit" },
|
|
522
530
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
@@ -535,7 +543,7 @@ const ButtonGlass = (0, react.forwardRef)(({ asChild = false, className, variant
|
|
|
535
543
|
animation: "ripple 0.6s ease-out"
|
|
536
544
|
}
|
|
537
545
|
}),
|
|
538
|
-
isHovered && variant === "
|
|
546
|
+
isHovered && variant === "default" && !isDisabled && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
539
547
|
className: "absolute inset-0 rounded-xl animate-glow-pulse pointer-events-none",
|
|
540
548
|
style: { background: "var(--btn-glow-radial)" }
|
|
541
549
|
}),
|
|
@@ -787,7 +795,7 @@ function composeRefs(...refs) {
|
|
|
787
795
|
function useComposedRefs(...refs) {
|
|
788
796
|
return react.useCallback(composeRefs(...refs), refs);
|
|
789
797
|
}
|
|
790
|
-
function createContextScope(scopeName, createContextScopeDeps = []) {
|
|
798
|
+
function createContextScope$2(scopeName, createContextScopeDeps = []) {
|
|
791
799
|
let defaultContexts = [];
|
|
792
800
|
function createContext3(rootComponentName, defaultContext) {
|
|
793
801
|
const BaseContext = react.createContext(defaultContext);
|
|
@@ -825,9 +833,9 @@ function createContextScope(scopeName, createContextScopeDeps = []) {
|
|
|
825
833
|
};
|
|
826
834
|
};
|
|
827
835
|
createScope$2.scopeName = scopeName;
|
|
828
|
-
return [createContext3, composeContextScopes$
|
|
836
|
+
return [createContext3, composeContextScopes$3(createScope$2, ...createContextScopeDeps)];
|
|
829
837
|
}
|
|
830
|
-
function composeContextScopes$
|
|
838
|
+
function composeContextScopes$3(...scopes) {
|
|
831
839
|
const baseScope = scopes[0];
|
|
832
840
|
if (scopes.length === 1) return baseScope;
|
|
833
841
|
const createScope$2 = () => {
|
|
@@ -849,7 +857,7 @@ function composeContextScopes$1(...scopes) {
|
|
|
849
857
|
createScope$2.scopeName = baseScope.scopeName;
|
|
850
858
|
return createScope$2;
|
|
851
859
|
}
|
|
852
|
-
var Primitive$
|
|
860
|
+
var Primitive$7 = [
|
|
853
861
|
"a",
|
|
854
862
|
"button",
|
|
855
863
|
"div",
|
|
@@ -983,7 +991,7 @@ var DismissableLayer = react.forwardRef((props, forwardedRef) => {
|
|
|
983
991
|
document.addEventListener(CONTEXT_UPDATE, handleUpdate);
|
|
984
992
|
return () => document.removeEventListener(CONTEXT_UPDATE, handleUpdate);
|
|
985
993
|
}, []);
|
|
986
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Primitive$
|
|
994
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Primitive$7.div, {
|
|
987
995
|
...layerProps,
|
|
988
996
|
ref: composedRefs,
|
|
989
997
|
style: {
|
|
@@ -1010,7 +1018,7 @@ var DismissableLayerBranch = react.forwardRef((props, forwardedRef) => {
|
|
|
1010
1018
|
};
|
|
1011
1019
|
}
|
|
1012
1020
|
}, [context.branches]);
|
|
1013
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Primitive$
|
|
1021
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Primitive$7.div, {
|
|
1014
1022
|
...props,
|
|
1015
1023
|
ref: composedRefs
|
|
1016
1024
|
});
|
|
@@ -1099,7 +1107,7 @@ function createFocusGuard() {
|
|
|
1099
1107
|
element.style.pointerEvents = "none";
|
|
1100
1108
|
return element;
|
|
1101
1109
|
}
|
|
1102
|
-
var Primitive$
|
|
1110
|
+
var Primitive$6 = [
|
|
1103
1111
|
"a",
|
|
1104
1112
|
"button",
|
|
1105
1113
|
"div",
|
|
@@ -1245,7 +1253,7 @@ var FocusScope = react.forwardRef((props, forwardedRef) => {
|
|
|
1245
1253
|
trapped,
|
|
1246
1254
|
focusScope.paused
|
|
1247
1255
|
]);
|
|
1248
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Primitive$
|
|
1256
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Primitive$6.div, {
|
|
1249
1257
|
tabIndex: -1,
|
|
1250
1258
|
...scopeProps,
|
|
1251
1259
|
ref: composedRefs,
|
|
@@ -1355,7 +1363,7 @@ var oppositeAlignmentMap = {
|
|
|
1355
1363
|
start: "end",
|
|
1356
1364
|
end: "start"
|
|
1357
1365
|
};
|
|
1358
|
-
function clamp(start, value, end) {
|
|
1366
|
+
function clamp$1(start, value, end) {
|
|
1359
1367
|
return max$1(start, min$1(value, end));
|
|
1360
1368
|
}
|
|
1361
1369
|
function evaluate(value, param) {
|
|
@@ -1639,7 +1647,7 @@ var arrow$2 = (options$1) => ({
|
|
|
1639
1647
|
const min$1$1 = minPadding;
|
|
1640
1648
|
const max$2 = clientSize - arrowDimensions[length] - maxPadding;
|
|
1641
1649
|
const center = clientSize / 2 - arrowDimensions[length] / 2 + centerToReference;
|
|
1642
|
-
const offset$3 = clamp(min$1$1, center, max$2);
|
|
1650
|
+
const offset$3 = clamp$1(min$1$1, center, max$2);
|
|
1643
1651
|
const shouldAddOffset = !middlewareData.arrow && getAlignment(placement) != null && center !== offset$3 && rects.reference[length] / 2 - (center < min$1$1 ? minPadding : maxPadding) - arrowDimensions[length] / 2 < 0;
|
|
1644
1652
|
const alignmentOffset = shouldAddOffset ? center < min$1$1 ? center - min$1$1 : center - max$2 : 0;
|
|
1645
1653
|
return {
|
|
@@ -1842,14 +1850,14 @@ var shift$2 = function(options$1) {
|
|
|
1842
1850
|
const maxSide = mainAxis === "y" ? "bottom" : "right";
|
|
1843
1851
|
const min$2 = mainAxisCoord + overflow[minSide];
|
|
1844
1852
|
const max$2 = mainAxisCoord - overflow[maxSide];
|
|
1845
|
-
mainAxisCoord = clamp(min$2, mainAxisCoord, max$2);
|
|
1853
|
+
mainAxisCoord = clamp$1(min$2, mainAxisCoord, max$2);
|
|
1846
1854
|
}
|
|
1847
1855
|
if (checkCrossAxis) {
|
|
1848
1856
|
const minSide = crossAxis === "y" ? "top" : "left";
|
|
1849
1857
|
const maxSide = crossAxis === "y" ? "bottom" : "right";
|
|
1850
1858
|
const min$2 = crossAxisCoord + overflow[minSide];
|
|
1851
1859
|
const max$2 = crossAxisCoord - overflow[maxSide];
|
|
1852
|
-
crossAxisCoord = clamp(min$2, crossAxisCoord, max$2);
|
|
1860
|
+
crossAxisCoord = clamp$1(min$2, crossAxisCoord, max$2);
|
|
1853
1861
|
}
|
|
1854
1862
|
const limitedCoords = limiter.fn({
|
|
1855
1863
|
...state,
|
|
@@ -2823,7 +2831,7 @@ var arrow = (options$1, deps) => ({
|
|
|
2823
2831
|
...arrow$1$1(options$1),
|
|
2824
2832
|
options: [options$1, deps]
|
|
2825
2833
|
});
|
|
2826
|
-
var Primitive$
|
|
2834
|
+
var Primitive$5 = [
|
|
2827
2835
|
"a",
|
|
2828
2836
|
"button",
|
|
2829
2837
|
"div",
|
|
@@ -2861,7 +2869,7 @@ var Primitive$4 = [
|
|
|
2861
2869
|
var NAME = "Arrow";
|
|
2862
2870
|
var Arrow$1 = react.forwardRef((props, forwardedRef) => {
|
|
2863
2871
|
const { children, width = 10, height = 5, ...arrowProps } = props;
|
|
2864
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Primitive$
|
|
2872
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Primitive$5.svg, {
|
|
2865
2873
|
...arrowProps,
|
|
2866
2874
|
ref: forwardedRef,
|
|
2867
2875
|
width,
|
|
@@ -2872,8 +2880,8 @@ var Arrow$1 = react.forwardRef((props, forwardedRef) => {
|
|
|
2872
2880
|
});
|
|
2873
2881
|
});
|
|
2874
2882
|
Arrow$1.displayName = NAME;
|
|
2875
|
-
var Root = Arrow$1;
|
|
2876
|
-
function createContextScope$
|
|
2883
|
+
var Root$1 = Arrow$1;
|
|
2884
|
+
function createContextScope$3(scopeName, createContextScopeDeps = []) {
|
|
2877
2885
|
let defaultContexts = [];
|
|
2878
2886
|
function createContext3(rootComponentName, defaultContext) {
|
|
2879
2887
|
const BaseContext = react.createContext(defaultContext);
|
|
@@ -2911,9 +2919,9 @@ function createContextScope$1(scopeName, createContextScopeDeps = []) {
|
|
|
2911
2919
|
};
|
|
2912
2920
|
};
|
|
2913
2921
|
createScope$2.scopeName = scopeName;
|
|
2914
|
-
return [createContext3, composeContextScopes(createScope$2, ...createContextScopeDeps)];
|
|
2922
|
+
return [createContext3, composeContextScopes$2(createScope$2, ...createContextScopeDeps)];
|
|
2915
2923
|
}
|
|
2916
|
-
function composeContextScopes(...scopes) {
|
|
2924
|
+
function composeContextScopes$2(...scopes) {
|
|
2917
2925
|
const baseScope = scopes[0];
|
|
2918
2926
|
if (scopes.length === 1) return baseScope;
|
|
2919
2927
|
const createScope$2 = () => {
|
|
@@ -2935,7 +2943,7 @@ function composeContextScopes(...scopes) {
|
|
|
2935
2943
|
createScope$2.scopeName = baseScope.scopeName;
|
|
2936
2944
|
return createScope$2;
|
|
2937
2945
|
}
|
|
2938
|
-
var Primitive$
|
|
2946
|
+
var Primitive$4 = [
|
|
2939
2947
|
"a",
|
|
2940
2948
|
"button",
|
|
2941
2949
|
"div",
|
|
@@ -3005,7 +3013,7 @@ function useSize(element) {
|
|
|
3005
3013
|
return size$3;
|
|
3006
3014
|
}
|
|
3007
3015
|
var POPPER_NAME = "Popper";
|
|
3008
|
-
var [createPopperContext, createPopperScope] = createContextScope$
|
|
3016
|
+
var [createPopperContext, createPopperScope] = createContextScope$3(POPPER_NAME);
|
|
3009
3017
|
var [PopperProvider, usePopperContext] = createPopperContext(POPPER_NAME);
|
|
3010
3018
|
var Popper = (props) => {
|
|
3011
3019
|
const { __scopePopper, children } = props;
|
|
@@ -3030,7 +3038,7 @@ var PopperAnchor = react.forwardRef((props, forwardedRef) => {
|
|
|
3030
3038
|
anchorRef.current = virtualRef?.current || ref.current;
|
|
3031
3039
|
if (previousAnchor !== anchorRef.current) context.onAnchorChange(anchorRef.current);
|
|
3032
3040
|
});
|
|
3033
|
-
return virtualRef ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Primitive$
|
|
3041
|
+
return virtualRef ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Primitive$4.div, {
|
|
3034
3042
|
...anchorProps,
|
|
3035
3043
|
ref: composedRefs
|
|
3036
3044
|
});
|
|
@@ -3140,7 +3148,7 @@ var PopperContent = react.forwardRef((props, forwardedRef) => {
|
|
|
3140
3148
|
arrowX,
|
|
3141
3149
|
arrowY,
|
|
3142
3150
|
shouldHideArrow: cannotCenterArrow,
|
|
3143
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Primitive$
|
|
3151
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Primitive$4.div, {
|
|
3144
3152
|
"data-side": placedSide,
|
|
3145
3153
|
"data-align": placedAlign,
|
|
3146
3154
|
...contentProps,
|
|
@@ -3186,7 +3194,7 @@ var PopperArrow = react.forwardRef(function PopperArrow2(props, forwardedRef) {
|
|
|
3186
3194
|
}[contentContext.placedSide],
|
|
3187
3195
|
visibility: contentContext.shouldHideArrow ? "hidden" : void 0
|
|
3188
3196
|
},
|
|
3189
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Root, {
|
|
3197
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Root$1, {
|
|
3190
3198
|
...arrowProps,
|
|
3191
3199
|
ref: forwardedRef,
|
|
3192
3200
|
style: {
|
|
@@ -3245,7 +3253,7 @@ var Root2$1 = Popper;
|
|
|
3245
3253
|
var Anchor = PopperAnchor;
|
|
3246
3254
|
var Content = PopperContent;
|
|
3247
3255
|
var Arrow = PopperArrow;
|
|
3248
|
-
var Primitive$
|
|
3256
|
+
var Primitive$3 = [
|
|
3249
3257
|
"a",
|
|
3250
3258
|
"button",
|
|
3251
3259
|
"div",
|
|
@@ -3286,7 +3294,7 @@ var Portal = react.forwardRef((props, forwardedRef) => {
|
|
|
3286
3294
|
const [mounted, setMounted] = react.useState(false);
|
|
3287
3295
|
useLayoutEffect2(() => setMounted(true), []);
|
|
3288
3296
|
const container = containerProp || mounted && globalThis?.document?.body;
|
|
3289
|
-
return container ? react_dom.default.createPortal(/* @__PURE__ */ (0, react_jsx_runtime.jsx)(Primitive$
|
|
3297
|
+
return container ? react_dom.default.createPortal(/* @__PURE__ */ (0, react_jsx_runtime.jsx)(Primitive$3.div, {
|
|
3290
3298
|
...portalProps,
|
|
3291
3299
|
ref: forwardedRef
|
|
3292
3300
|
}), container) : null;
|
|
@@ -3389,7 +3397,7 @@ function getElementRef(element) {
|
|
|
3389
3397
|
if (mayWarn) return element.props.ref;
|
|
3390
3398
|
return element.props.ref || element.ref;
|
|
3391
3399
|
}
|
|
3392
|
-
var Primitive$
|
|
3400
|
+
var Primitive$2 = [
|
|
3393
3401
|
"a",
|
|
3394
3402
|
"button",
|
|
3395
3403
|
"div",
|
|
@@ -4168,7 +4176,7 @@ var ReactRemoveScroll = react.forwardRef(function(props, ref) {
|
|
|
4168
4176
|
ReactRemoveScroll.classNames = RemoveScroll.classNames;
|
|
4169
4177
|
var Combination_default = ReactRemoveScroll;
|
|
4170
4178
|
var POPOVER_NAME = "Popover";
|
|
4171
|
-
var [createPopoverContext, createPopoverScope] = createContextScope(POPOVER_NAME, [createPopperScope]);
|
|
4179
|
+
var [createPopoverContext, createPopoverScope] = createContextScope$2(POPOVER_NAME, [createPopperScope]);
|
|
4172
4180
|
var usePopperScope = createPopperScope();
|
|
4173
4181
|
var [PopoverProvider, usePopoverContext] = createPopoverContext(POPOVER_NAME);
|
|
4174
4182
|
var Popover$1 = (props) => {
|
|
@@ -4223,7 +4231,7 @@ var PopoverTrigger$1 = react.forwardRef((props, forwardedRef) => {
|
|
|
4223
4231
|
const context = usePopoverContext(TRIGGER_NAME, __scopePopover);
|
|
4224
4232
|
const popperScope = usePopperScope(__scopePopover);
|
|
4225
4233
|
const composedTriggerRef = useComposedRefs(forwardedRef, context.triggerRef);
|
|
4226
|
-
const trigger = /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Primitive$
|
|
4234
|
+
const trigger = /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Primitive$2.button, {
|
|
4227
4235
|
type: "button",
|
|
4228
4236
|
"aria-haspopup": "dialog",
|
|
4229
4237
|
"aria-expanded": context.open,
|
|
@@ -4379,7 +4387,7 @@ var CLOSE_NAME = "PopoverClose";
|
|
|
4379
4387
|
var PopoverClose = react.forwardRef((props, forwardedRef) => {
|
|
4380
4388
|
const { __scopePopover, ...closeProps } = props;
|
|
4381
4389
|
const context = usePopoverContext(CLOSE_NAME, __scopePopover);
|
|
4382
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Primitive$
|
|
4390
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Primitive$2.button, {
|
|
4383
4391
|
type: "button",
|
|
4384
4392
|
...closeProps,
|
|
4385
4393
|
ref: forwardedRef,
|
|
@@ -4443,7 +4451,7 @@ function D(_) {
|
|
|
4443
4451
|
function W(_, C, h$1) {
|
|
4444
4452
|
return _ = h$1 && h$1.length > 0 ? `${_ + " " + h$1.join(" ")}` : _, G(_, C, D(_), D(C), 0, 0, {});
|
|
4445
4453
|
}
|
|
4446
|
-
var Primitive = [
|
|
4454
|
+
var Primitive$1 = [
|
|
4447
4455
|
"a",
|
|
4448
4456
|
"button",
|
|
4449
4457
|
"div",
|
|
@@ -4640,7 +4648,7 @@ var N = "[cmdk-group=\"\"]", Y = "[cmdk-group-items=\"\"]", be = "[cmdk-group-he
|
|
|
4640
4648
|
}, se = (e$1) => {
|
|
4641
4649
|
e$1.preventDefault(), e$1.metaKey ? X$4(0) : e$1.altKey ? re$1(-1) : Q(-1);
|
|
4642
4650
|
};
|
|
4643
|
-
return react.createElement(Primitive.div, {
|
|
4651
|
+
return react.createElement(Primitive$1.div, {
|
|
4644
4652
|
ref: o,
|
|
4645
4653
|
tabIndex: -1,
|
|
4646
4654
|
...O$1,
|
|
@@ -4714,7 +4722,7 @@ var N = "[cmdk-group=\"\"]", Y = "[cmdk-group-items=\"\"]", be = "[cmdk-group-he
|
|
|
4714
4722
|
}
|
|
4715
4723
|
if (!x$2) return null;
|
|
4716
4724
|
let { disabled: A, value: ge, onSelect: j, forceMount: O$1, keywords: $$1, ...q$1 } = r$1;
|
|
4717
|
-
return react.createElement(Primitive.div, {
|
|
4725
|
+
return react.createElement(Primitive$1.div, {
|
|
4718
4726
|
ref: composeRefs(u$2, o),
|
|
4719
4727
|
...q$1,
|
|
4720
4728
|
id: n$1,
|
|
@@ -4738,7 +4746,7 @@ var N = "[cmdk-group=\"\"]", Y = "[cmdk-group-items=\"\"]", be = "[cmdk-group-he
|
|
|
4738
4746
|
id: f$1,
|
|
4739
4747
|
forceMount: c$2
|
|
4740
4748
|
}), [c$2]);
|
|
4741
|
-
return react.createElement(Primitive.div, {
|
|
4749
|
+
return react.createElement(Primitive$1.div, {
|
|
4742
4750
|
ref: composeRefs(p$2, o),
|
|
4743
4751
|
...d$1,
|
|
4744
4752
|
"cmdk-group": "",
|
|
@@ -4756,7 +4764,7 @@ var N = "[cmdk-group=\"\"]", Y = "[cmdk-group-items=\"\"]", be = "[cmdk-group-he
|
|
|
4756
4764
|
}, react.createElement(fe.Provider, { value: C }, S))));
|
|
4757
4765
|
}), ye = react.forwardRef((r$1, o) => {
|
|
4758
4766
|
let { alwaysRender: n$1, ...u$2 } = r$1, c$2 = react.useRef(null), d$1 = P((f$1) => !f$1.search);
|
|
4759
|
-
return !n$1 && !d$1 ? null : react.createElement(Primitive.div, {
|
|
4767
|
+
return !n$1 && !d$1 ? null : react.createElement(Primitive$1.div, {
|
|
4760
4768
|
ref: composeRefs(c$2, o),
|
|
4761
4769
|
...u$2,
|
|
4762
4770
|
"cmdk-separator": "",
|
|
@@ -4766,7 +4774,7 @@ var N = "[cmdk-group=\"\"]", Y = "[cmdk-group-items=\"\"]", be = "[cmdk-group-he
|
|
|
4766
4774
|
let { onValueChange: n$1, ...u$2 } = r$1, c$2 = r$1.value != null, d$1 = ee(), f$1 = P((m$2) => m$2.search), p$2 = P((m$2) => m$2.selectedItemId), b$1 = K();
|
|
4767
4775
|
return react.useEffect(() => {
|
|
4768
4776
|
r$1.value != null && d$1.setState("search", r$1.value);
|
|
4769
|
-
}, [r$1.value]), react.createElement(Primitive.input, {
|
|
4777
|
+
}, [r$1.value]), react.createElement(Primitive$1.input, {
|
|
4770
4778
|
ref: o,
|
|
4771
4779
|
...u$2,
|
|
4772
4780
|
"cmdk-input": "",
|
|
@@ -4800,7 +4808,7 @@ var N = "[cmdk-group=\"\"]", Y = "[cmdk-group-items=\"\"]", be = "[cmdk-group-he
|
|
|
4800
4808
|
cancelAnimationFrame(x$2), C.unobserve(m$2);
|
|
4801
4809
|
};
|
|
4802
4810
|
}
|
|
4803
|
-
}, []), react.createElement(Primitive.div, {
|
|
4811
|
+
}, []), react.createElement(Primitive$1.div, {
|
|
4804
4812
|
ref: composeRefs(d$1, o),
|
|
4805
4813
|
...c$2,
|
|
4806
4814
|
"cmdk-list": "",
|
|
@@ -4829,14 +4837,14 @@ var N = "[cmdk-group=\"\"]", Y = "[cmdk-group-items=\"\"]", be = "[cmdk-group-he
|
|
|
4829
4837
|
ref: o,
|
|
4830
4838
|
...p$2
|
|
4831
4839
|
}))));
|
|
4832
|
-
}), Ie = react.forwardRef((r$1, o) => P((u$2) => u$2.filtered.count === 0) ? react.createElement(Primitive.div, {
|
|
4840
|
+
}), Ie = react.forwardRef((r$1, o) => P((u$2) => u$2.filtered.count === 0) ? react.createElement(Primitive$1.div, {
|
|
4833
4841
|
ref: o,
|
|
4834
4842
|
...r$1,
|
|
4835
4843
|
"cmdk-empty": "",
|
|
4836
4844
|
role: "presentation"
|
|
4837
4845
|
}) : null), Pe = react.forwardRef((r$1, o) => {
|
|
4838
4846
|
let { progress: n$1, children: u$2, label: c$2 = "Loading...", ...d$1 } = r$1;
|
|
4839
|
-
return react.createElement(Primitive.div, {
|
|
4847
|
+
return react.createElement(Primitive$1.div, {
|
|
4840
4848
|
ref: o,
|
|
4841
4849
|
...d$1,
|
|
4842
4850
|
"cmdk-loading": "",
|
|
@@ -4995,7 +5003,7 @@ function getDropdownItemClasses(options$1) {
|
|
|
4995
5003
|
}
|
|
4996
5004
|
const dropdownSeparatorClasses = require_utils.cn("h-px my-1", "bg-[var(--dropdown-border)]");
|
|
4997
5005
|
const dropdownLabelClasses = require_utils.cn("px-3 py-1.5 md:px-4 md:py-2", "text-xs font-medium", "text-[var(--text-muted)]");
|
|
4998
|
-
function ComboBoxGlassInner({ options: options$1, value,
|
|
5006
|
+
function ComboBoxGlassInner({ options: options$1, value, onValueChange, placeholder = "Select option...", emptyText = "No results found.", searchPlaceholder = "Search...", glassVariant = "glass", disabled = false, className, popoverClassName, clearable = false, side = "bottom", align = "start", label, error, success, required = false, size: size$3 = "md", searchable = true, icon: TriggerIcon }, ref) {
|
|
4999
5007
|
const [open, setOpen] = (0, react.useState)(false);
|
|
5000
5008
|
const [search, setSearch] = (0, react.useState)("");
|
|
5001
5009
|
const fieldId = (0, react.useId)();
|
|
@@ -5006,13 +5014,13 @@ function ComboBoxGlassInner({ options: options$1, value, onChange, placeholder =
|
|
|
5006
5014
|
return options$1.filter((opt) => opt.label.toLowerCase().includes(searchLower));
|
|
5007
5015
|
}, [options$1, search]);
|
|
5008
5016
|
const handleSelect = (0, react.useCallback)((optionValue) => {
|
|
5009
|
-
if (clearable && value === optionValue)
|
|
5010
|
-
else
|
|
5017
|
+
if (clearable && value === optionValue) onValueChange?.(void 0);
|
|
5018
|
+
else onValueChange?.(optionValue);
|
|
5011
5019
|
setOpen(false);
|
|
5012
5020
|
setSearch("");
|
|
5013
5021
|
}, [
|
|
5014
5022
|
value,
|
|
5015
|
-
|
|
5023
|
+
onValueChange,
|
|
5016
5024
|
clearable
|
|
5017
5025
|
]);
|
|
5018
5026
|
const getGlassClass = () => {
|
|
@@ -5683,23 +5691,704 @@ const SkeletonGlass = (0, react.forwardRef)(({ className, variant = "text", widt
|
|
|
5683
5691
|
});
|
|
5684
5692
|
});
|
|
5685
5693
|
SkeletonGlass.displayName = "SkeletonGlass";
|
|
5686
|
-
|
|
5687
|
-
|
|
5688
|
-
|
|
5689
|
-
|
|
5690
|
-
|
|
5691
|
-
|
|
5692
|
-
|
|
5693
|
-
|
|
5694
|
-
|
|
5695
|
-
|
|
5694
|
+
function clamp(value, [min$2, max$2]) {
|
|
5695
|
+
return Math.min(max$2, Math.max(min$2, value));
|
|
5696
|
+
}
|
|
5697
|
+
function createContextScope(scopeName, createContextScopeDeps = []) {
|
|
5698
|
+
let defaultContexts = [];
|
|
5699
|
+
function createContext3(rootComponentName, defaultContext) {
|
|
5700
|
+
const BaseContext = react.createContext(defaultContext);
|
|
5701
|
+
const index$1 = defaultContexts.length;
|
|
5702
|
+
defaultContexts = [...defaultContexts, defaultContext];
|
|
5703
|
+
const Provider$1 = (props) => {
|
|
5704
|
+
const { scope, children, ...context } = props;
|
|
5705
|
+
const Context = scope?.[scopeName]?.[index$1] || BaseContext;
|
|
5706
|
+
const value = react.useMemo(() => context, Object.values(context));
|
|
5707
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Context.Provider, {
|
|
5708
|
+
value,
|
|
5709
|
+
children
|
|
5710
|
+
});
|
|
5711
|
+
};
|
|
5712
|
+
Provider$1.displayName = rootComponentName + "Provider";
|
|
5713
|
+
function useContext2(consumerName, scope) {
|
|
5714
|
+
const Context = scope?.[scopeName]?.[index$1] || BaseContext;
|
|
5715
|
+
const context = react.useContext(Context);
|
|
5716
|
+
if (context) return context;
|
|
5717
|
+
if (defaultContext !== void 0) return defaultContext;
|
|
5718
|
+
throw new Error(`\`${consumerName}\` must be used within \`${rootComponentName}\``);
|
|
5719
|
+
}
|
|
5720
|
+
return [Provider$1, useContext2];
|
|
5721
|
+
}
|
|
5722
|
+
const createScope$2 = () => {
|
|
5723
|
+
const scopeContexts = defaultContexts.map((defaultContext) => {
|
|
5724
|
+
return react.createContext(defaultContext);
|
|
5725
|
+
});
|
|
5726
|
+
return function useScope(scope) {
|
|
5727
|
+
const contexts = scope?.[scopeName] || scopeContexts;
|
|
5728
|
+
return react.useMemo(() => ({ [`__scope${scopeName}`]: {
|
|
5729
|
+
...scope,
|
|
5730
|
+
[scopeName]: contexts
|
|
5731
|
+
} }), [scope, contexts]);
|
|
5732
|
+
};
|
|
5733
|
+
};
|
|
5734
|
+
createScope$2.scopeName = scopeName;
|
|
5735
|
+
return [createContext3, composeContextScopes$1(createScope$2, ...createContextScopeDeps)];
|
|
5736
|
+
}
|
|
5737
|
+
function composeContextScopes$1(...scopes) {
|
|
5738
|
+
const baseScope = scopes[0];
|
|
5739
|
+
if (scopes.length === 1) return baseScope;
|
|
5740
|
+
const createScope$2 = () => {
|
|
5741
|
+
const scopeHooks = scopes.map((createScope2) => ({
|
|
5742
|
+
useScope: createScope2(),
|
|
5743
|
+
scopeName: createScope2.scopeName
|
|
5744
|
+
}));
|
|
5745
|
+
return function useComposedScopes(overrideScopes) {
|
|
5746
|
+
const nextScopes = scopeHooks.reduce((nextScopes2, { useScope, scopeName }) => {
|
|
5747
|
+
const currentScope$2 = useScope(overrideScopes)[`__scope${scopeName}`];
|
|
5748
|
+
return {
|
|
5749
|
+
...nextScopes2,
|
|
5750
|
+
...currentScope$2
|
|
5751
|
+
};
|
|
5752
|
+
}, {});
|
|
5753
|
+
return react.useMemo(() => ({ [`__scope${baseScope.scopeName}`]: nextScopes }), [nextScopes]);
|
|
5754
|
+
};
|
|
5755
|
+
};
|
|
5756
|
+
createScope$2.scopeName = baseScope.scopeName;
|
|
5757
|
+
return createScope$2;
|
|
5758
|
+
}
|
|
5759
|
+
var DirectionContext = react.createContext(void 0);
|
|
5760
|
+
function useDirection(localDir) {
|
|
5761
|
+
const globalDir = react.useContext(DirectionContext);
|
|
5762
|
+
return localDir || globalDir || "ltr";
|
|
5763
|
+
}
|
|
5764
|
+
function usePrevious(value) {
|
|
5765
|
+
const ref = react.useRef({
|
|
5766
|
+
value,
|
|
5767
|
+
previous: value
|
|
5768
|
+
});
|
|
5769
|
+
return react.useMemo(() => {
|
|
5770
|
+
if (ref.current.value !== value) {
|
|
5771
|
+
ref.current.previous = ref.current.value;
|
|
5772
|
+
ref.current.value = value;
|
|
5773
|
+
}
|
|
5774
|
+
return ref.current.previous;
|
|
5775
|
+
}, [value]);
|
|
5776
|
+
}
|
|
5777
|
+
var Primitive = [
|
|
5778
|
+
"a",
|
|
5779
|
+
"button",
|
|
5780
|
+
"div",
|
|
5781
|
+
"form",
|
|
5782
|
+
"h2",
|
|
5783
|
+
"h3",
|
|
5784
|
+
"img",
|
|
5785
|
+
"input",
|
|
5786
|
+
"label",
|
|
5787
|
+
"li",
|
|
5788
|
+
"nav",
|
|
5789
|
+
"ol",
|
|
5790
|
+
"p",
|
|
5791
|
+
"select",
|
|
5792
|
+
"span",
|
|
5793
|
+
"svg",
|
|
5794
|
+
"ul"
|
|
5795
|
+
].reduce((primitive, node) => {
|
|
5796
|
+
const Slot$3 = (0, __radix_ui_react_slot.createSlot)(`Primitive.${node}`);
|
|
5797
|
+
const Node$1 = react.forwardRef((props, forwardedRef) => {
|
|
5798
|
+
const { asChild, ...primitiveProps } = props;
|
|
5799
|
+
const Comp = asChild ? Slot$3 : node;
|
|
5800
|
+
if (typeof window !== "undefined") window[Symbol.for("radix-ui")] = true;
|
|
5801
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Comp, {
|
|
5802
|
+
...primitiveProps,
|
|
5803
|
+
ref: forwardedRef
|
|
5804
|
+
});
|
|
5805
|
+
});
|
|
5806
|
+
Node$1.displayName = `Primitive.${node}`;
|
|
5807
|
+
return {
|
|
5808
|
+
...primitive,
|
|
5809
|
+
[node]: Node$1
|
|
5696
5810
|
};
|
|
5811
|
+
}, {});
|
|
5812
|
+
function createContextScope$1(scopeName, createContextScopeDeps = []) {
|
|
5813
|
+
let defaultContexts = [];
|
|
5814
|
+
function createContext3(rootComponentName, defaultContext) {
|
|
5815
|
+
const BaseContext = react.createContext(defaultContext);
|
|
5816
|
+
const index$1 = defaultContexts.length;
|
|
5817
|
+
defaultContexts = [...defaultContexts, defaultContext];
|
|
5818
|
+
const Provider$1 = (props) => {
|
|
5819
|
+
const { scope, children, ...context } = props;
|
|
5820
|
+
const Context = scope?.[scopeName]?.[index$1] || BaseContext;
|
|
5821
|
+
const value = react.useMemo(() => context, Object.values(context));
|
|
5822
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Context.Provider, {
|
|
5823
|
+
value,
|
|
5824
|
+
children
|
|
5825
|
+
});
|
|
5826
|
+
};
|
|
5827
|
+
Provider$1.displayName = rootComponentName + "Provider";
|
|
5828
|
+
function useContext2(consumerName, scope) {
|
|
5829
|
+
const Context = scope?.[scopeName]?.[index$1] || BaseContext;
|
|
5830
|
+
const context = react.useContext(Context);
|
|
5831
|
+
if (context) return context;
|
|
5832
|
+
if (defaultContext !== void 0) return defaultContext;
|
|
5833
|
+
throw new Error(`\`${consumerName}\` must be used within \`${rootComponentName}\``);
|
|
5834
|
+
}
|
|
5835
|
+
return [Provider$1, useContext2];
|
|
5836
|
+
}
|
|
5837
|
+
const createScope$2 = () => {
|
|
5838
|
+
const scopeContexts = defaultContexts.map((defaultContext) => {
|
|
5839
|
+
return react.createContext(defaultContext);
|
|
5840
|
+
});
|
|
5841
|
+
return function useScope(scope) {
|
|
5842
|
+
const contexts = scope?.[scopeName] || scopeContexts;
|
|
5843
|
+
return react.useMemo(() => ({ [`__scope${scopeName}`]: {
|
|
5844
|
+
...scope,
|
|
5845
|
+
[scopeName]: contexts
|
|
5846
|
+
} }), [scope, contexts]);
|
|
5847
|
+
};
|
|
5848
|
+
};
|
|
5849
|
+
createScope$2.scopeName = scopeName;
|
|
5850
|
+
return [createContext3, composeContextScopes(createScope$2, ...createContextScopeDeps)];
|
|
5851
|
+
}
|
|
5852
|
+
function composeContextScopes(...scopes) {
|
|
5853
|
+
const baseScope = scopes[0];
|
|
5854
|
+
if (scopes.length === 1) return baseScope;
|
|
5855
|
+
const createScope$2 = () => {
|
|
5856
|
+
const scopeHooks = scopes.map((createScope2) => ({
|
|
5857
|
+
useScope: createScope2(),
|
|
5858
|
+
scopeName: createScope2.scopeName
|
|
5859
|
+
}));
|
|
5860
|
+
return function useComposedScopes(overrideScopes) {
|
|
5861
|
+
const nextScopes = scopeHooks.reduce((nextScopes2, { useScope, scopeName }) => {
|
|
5862
|
+
const currentScope$2 = useScope(overrideScopes)[`__scope${scopeName}`];
|
|
5863
|
+
return {
|
|
5864
|
+
...nextScopes2,
|
|
5865
|
+
...currentScope$2
|
|
5866
|
+
};
|
|
5867
|
+
}, {});
|
|
5868
|
+
return react.useMemo(() => ({ [`__scope${baseScope.scopeName}`]: nextScopes }), [nextScopes]);
|
|
5869
|
+
};
|
|
5870
|
+
};
|
|
5871
|
+
createScope$2.scopeName = baseScope.scopeName;
|
|
5872
|
+
return createScope$2;
|
|
5873
|
+
}
|
|
5874
|
+
function createCollection(name) {
|
|
5875
|
+
const PROVIDER_NAME = name + "CollectionProvider";
|
|
5876
|
+
const [createCollectionContext, createCollectionScope$1] = createContextScope$1(PROVIDER_NAME);
|
|
5877
|
+
const [CollectionProviderImpl, useCollectionContext] = createCollectionContext(PROVIDER_NAME, {
|
|
5878
|
+
collectionRef: { current: null },
|
|
5879
|
+
itemMap: /* @__PURE__ */ new Map()
|
|
5880
|
+
});
|
|
5881
|
+
const CollectionProvider = (props) => {
|
|
5882
|
+
const { scope, children } = props;
|
|
5883
|
+
const ref = react.default.useRef(null);
|
|
5884
|
+
const itemMap = react.default.useRef(/* @__PURE__ */ new Map()).current;
|
|
5885
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CollectionProviderImpl, {
|
|
5886
|
+
scope,
|
|
5887
|
+
itemMap,
|
|
5888
|
+
collectionRef: ref,
|
|
5889
|
+
children
|
|
5890
|
+
});
|
|
5891
|
+
};
|
|
5892
|
+
CollectionProvider.displayName = PROVIDER_NAME;
|
|
5893
|
+
const COLLECTION_SLOT_NAME = name + "CollectionSlot";
|
|
5894
|
+
const CollectionSlotImpl = (0, __radix_ui_react_slot.createSlot)(COLLECTION_SLOT_NAME);
|
|
5895
|
+
const CollectionSlot = react.default.forwardRef((props, forwardedRef) => {
|
|
5896
|
+
const { scope, children } = props;
|
|
5897
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CollectionSlotImpl, {
|
|
5898
|
+
ref: useComposedRefs(forwardedRef, useCollectionContext(COLLECTION_SLOT_NAME, scope).collectionRef),
|
|
5899
|
+
children
|
|
5900
|
+
});
|
|
5901
|
+
});
|
|
5902
|
+
CollectionSlot.displayName = COLLECTION_SLOT_NAME;
|
|
5903
|
+
const ITEM_SLOT_NAME = name + "CollectionItemSlot";
|
|
5904
|
+
const ITEM_DATA_ATTR = "data-radix-collection-item";
|
|
5905
|
+
const CollectionItemSlotImpl = (0, __radix_ui_react_slot.createSlot)(ITEM_SLOT_NAME);
|
|
5906
|
+
const CollectionItemSlot = react.default.forwardRef((props, forwardedRef) => {
|
|
5907
|
+
const { scope, children, ...itemData } = props;
|
|
5908
|
+
const ref = react.default.useRef(null);
|
|
5909
|
+
const composedRefs = useComposedRefs(forwardedRef, ref);
|
|
5910
|
+
const context = useCollectionContext(ITEM_SLOT_NAME, scope);
|
|
5911
|
+
react.default.useEffect(() => {
|
|
5912
|
+
context.itemMap.set(ref, {
|
|
5913
|
+
ref,
|
|
5914
|
+
...itemData
|
|
5915
|
+
});
|
|
5916
|
+
return () => void context.itemMap.delete(ref);
|
|
5917
|
+
});
|
|
5918
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CollectionItemSlotImpl, {
|
|
5919
|
+
[ITEM_DATA_ATTR]: "",
|
|
5920
|
+
ref: composedRefs,
|
|
5921
|
+
children
|
|
5922
|
+
});
|
|
5923
|
+
});
|
|
5924
|
+
CollectionItemSlot.displayName = ITEM_SLOT_NAME;
|
|
5925
|
+
function useCollection$1(scope) {
|
|
5926
|
+
const context = useCollectionContext(name + "CollectionConsumer", scope);
|
|
5927
|
+
return react.default.useCallback(() => {
|
|
5928
|
+
const collectionNode = context.collectionRef.current;
|
|
5929
|
+
if (!collectionNode) return [];
|
|
5930
|
+
const orderedNodes = Array.from(collectionNode.querySelectorAll(`[${ITEM_DATA_ATTR}]`));
|
|
5931
|
+
return Array.from(context.itemMap.values()).sort((a$1, b$1) => orderedNodes.indexOf(a$1.ref.current) - orderedNodes.indexOf(b$1.ref.current));
|
|
5932
|
+
}, [context.collectionRef, context.itemMap]);
|
|
5933
|
+
}
|
|
5934
|
+
return [
|
|
5935
|
+
{
|
|
5936
|
+
Provider: CollectionProvider,
|
|
5937
|
+
Slot: CollectionSlot,
|
|
5938
|
+
ItemSlot: CollectionItemSlot
|
|
5939
|
+
},
|
|
5940
|
+
useCollection$1,
|
|
5941
|
+
createCollectionScope$1
|
|
5942
|
+
];
|
|
5943
|
+
}
|
|
5944
|
+
var PAGE_KEYS = ["PageUp", "PageDown"];
|
|
5945
|
+
var ARROW_KEYS = [
|
|
5946
|
+
"ArrowUp",
|
|
5947
|
+
"ArrowDown",
|
|
5948
|
+
"ArrowLeft",
|
|
5949
|
+
"ArrowRight"
|
|
5950
|
+
];
|
|
5951
|
+
var BACK_KEYS = {
|
|
5952
|
+
"from-left": [
|
|
5953
|
+
"Home",
|
|
5954
|
+
"PageDown",
|
|
5955
|
+
"ArrowDown",
|
|
5956
|
+
"ArrowLeft"
|
|
5957
|
+
],
|
|
5958
|
+
"from-right": [
|
|
5959
|
+
"Home",
|
|
5960
|
+
"PageDown",
|
|
5961
|
+
"ArrowDown",
|
|
5962
|
+
"ArrowRight"
|
|
5963
|
+
],
|
|
5964
|
+
"from-bottom": [
|
|
5965
|
+
"Home",
|
|
5966
|
+
"PageDown",
|
|
5967
|
+
"ArrowDown",
|
|
5968
|
+
"ArrowLeft"
|
|
5969
|
+
],
|
|
5970
|
+
"from-top": [
|
|
5971
|
+
"Home",
|
|
5972
|
+
"PageDown",
|
|
5973
|
+
"ArrowUp",
|
|
5974
|
+
"ArrowLeft"
|
|
5975
|
+
]
|
|
5976
|
+
};
|
|
5977
|
+
var SLIDER_NAME = "Slider";
|
|
5978
|
+
var [Collection, useCollection, createCollectionScope] = createCollection(SLIDER_NAME);
|
|
5979
|
+
var [createSliderContext, createSliderScope] = createContextScope(SLIDER_NAME, [createCollectionScope]);
|
|
5980
|
+
var [SliderProvider, useSliderContext] = createSliderContext(SLIDER_NAME);
|
|
5981
|
+
var Slider = react.forwardRef((props, forwardedRef) => {
|
|
5982
|
+
const { name, min: min$2 = 0, max: max$2 = 100, step = 1, orientation = "horizontal", disabled = false, minStepsBetweenThumbs = 0, defaultValue = [min$2], value, onValueChange = () => {}, onValueCommit = () => {}, inverted = false, form, ...sliderProps } = props;
|
|
5983
|
+
const thumbRefs = react.useRef(/* @__PURE__ */ new Set());
|
|
5984
|
+
const valueIndexToChangeRef = react.useRef(0);
|
|
5985
|
+
const SliderOrientation = orientation === "horizontal" ? SliderHorizontal : SliderVertical;
|
|
5986
|
+
const [values = [], setValues] = useControllableState({
|
|
5987
|
+
prop: value,
|
|
5988
|
+
defaultProp: defaultValue,
|
|
5989
|
+
onChange: (value2) => {
|
|
5990
|
+
[...thumbRefs.current][valueIndexToChangeRef.current]?.focus();
|
|
5991
|
+
onValueChange(value2);
|
|
5992
|
+
}
|
|
5993
|
+
});
|
|
5994
|
+
const valuesBeforeSlideStartRef = react.useRef(values);
|
|
5995
|
+
function handleSlideStart(value2) {
|
|
5996
|
+
updateValues(value2, getClosestValueIndex(values, value2));
|
|
5997
|
+
}
|
|
5998
|
+
function handleSlideMove(value2) {
|
|
5999
|
+
updateValues(value2, valueIndexToChangeRef.current);
|
|
6000
|
+
}
|
|
6001
|
+
function handleSlideEnd() {
|
|
6002
|
+
const prevValue = valuesBeforeSlideStartRef.current[valueIndexToChangeRef.current];
|
|
6003
|
+
if (values[valueIndexToChangeRef.current] !== prevValue) onValueCommit(values);
|
|
6004
|
+
}
|
|
6005
|
+
function updateValues(value2, atIndex, { commit } = { commit: false }) {
|
|
6006
|
+
const decimalCount = getDecimalCount(step);
|
|
6007
|
+
const nextValue = clamp(roundValue(Math.round((value2 - min$2) / step) * step + min$2, decimalCount), [min$2, max$2]);
|
|
6008
|
+
setValues((prevValues = []) => {
|
|
6009
|
+
const nextValues = getNextSortedValues(prevValues, nextValue, atIndex);
|
|
6010
|
+
if (hasMinStepsBetweenValues(nextValues, minStepsBetweenThumbs * step)) {
|
|
6011
|
+
valueIndexToChangeRef.current = nextValues.indexOf(nextValue);
|
|
6012
|
+
const hasChanged = String(nextValues) !== String(prevValues);
|
|
6013
|
+
if (hasChanged && commit) onValueCommit(nextValues);
|
|
6014
|
+
return hasChanged ? nextValues : prevValues;
|
|
6015
|
+
} else return prevValues;
|
|
6016
|
+
});
|
|
6017
|
+
}
|
|
6018
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SliderProvider, {
|
|
6019
|
+
scope: props.__scopeSlider,
|
|
6020
|
+
name,
|
|
6021
|
+
disabled,
|
|
6022
|
+
min: min$2,
|
|
6023
|
+
max: max$2,
|
|
6024
|
+
valueIndexToChangeRef,
|
|
6025
|
+
thumbs: thumbRefs.current,
|
|
6026
|
+
values,
|
|
6027
|
+
orientation,
|
|
6028
|
+
form,
|
|
6029
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Collection.Provider, {
|
|
6030
|
+
scope: props.__scopeSlider,
|
|
6031
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Collection.Slot, {
|
|
6032
|
+
scope: props.__scopeSlider,
|
|
6033
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SliderOrientation, {
|
|
6034
|
+
"aria-disabled": disabled,
|
|
6035
|
+
"data-disabled": disabled ? "" : void 0,
|
|
6036
|
+
...sliderProps,
|
|
6037
|
+
ref: forwardedRef,
|
|
6038
|
+
onPointerDown: composeEventHandlers(sliderProps.onPointerDown, () => {
|
|
6039
|
+
if (!disabled) valuesBeforeSlideStartRef.current = values;
|
|
6040
|
+
}),
|
|
6041
|
+
min: min$2,
|
|
6042
|
+
max: max$2,
|
|
6043
|
+
inverted,
|
|
6044
|
+
onSlideStart: disabled ? void 0 : handleSlideStart,
|
|
6045
|
+
onSlideMove: disabled ? void 0 : handleSlideMove,
|
|
6046
|
+
onSlideEnd: disabled ? void 0 : handleSlideEnd,
|
|
6047
|
+
onHomeKeyDown: () => !disabled && updateValues(min$2, 0, { commit: true }),
|
|
6048
|
+
onEndKeyDown: () => !disabled && updateValues(max$2, values.length - 1, { commit: true }),
|
|
6049
|
+
onStepKeyDown: ({ event, direction: stepDirection }) => {
|
|
6050
|
+
if (!disabled) {
|
|
6051
|
+
const multiplier = PAGE_KEYS.includes(event.key) || event.shiftKey && ARROW_KEYS.includes(event.key) ? 10 : 1;
|
|
6052
|
+
const atIndex = valueIndexToChangeRef.current;
|
|
6053
|
+
const value2 = values[atIndex];
|
|
6054
|
+
updateValues(value2 + step * multiplier * stepDirection, atIndex, { commit: true });
|
|
6055
|
+
}
|
|
6056
|
+
}
|
|
6057
|
+
})
|
|
6058
|
+
})
|
|
6059
|
+
})
|
|
6060
|
+
});
|
|
6061
|
+
});
|
|
6062
|
+
Slider.displayName = SLIDER_NAME;
|
|
6063
|
+
var [SliderOrientationProvider, useSliderOrientationContext] = createSliderContext(SLIDER_NAME, {
|
|
6064
|
+
startEdge: "left",
|
|
6065
|
+
endEdge: "right",
|
|
6066
|
+
size: "width",
|
|
6067
|
+
direction: 1
|
|
6068
|
+
});
|
|
6069
|
+
var SliderHorizontal = react.forwardRef((props, forwardedRef) => {
|
|
6070
|
+
const { min: min$2, max: max$2, dir, inverted, onSlideStart, onSlideMove, onSlideEnd, onStepKeyDown, ...sliderProps } = props;
|
|
6071
|
+
const [slider, setSlider] = react.useState(null);
|
|
6072
|
+
const composedRefs = useComposedRefs(forwardedRef, (node) => setSlider(node));
|
|
6073
|
+
const rectRef = react.useRef(void 0);
|
|
6074
|
+
const direction = useDirection(dir);
|
|
6075
|
+
const isDirectionLTR = direction === "ltr";
|
|
6076
|
+
const isSlidingFromLeft = isDirectionLTR && !inverted || !isDirectionLTR && inverted;
|
|
6077
|
+
function getValueFromPointer(pointerPosition) {
|
|
6078
|
+
const rect = rectRef.current || slider.getBoundingClientRect();
|
|
6079
|
+
const value = linearScale([0, rect.width], isSlidingFromLeft ? [min$2, max$2] : [max$2, min$2]);
|
|
6080
|
+
rectRef.current = rect;
|
|
6081
|
+
return value(pointerPosition - rect.left);
|
|
6082
|
+
}
|
|
6083
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SliderOrientationProvider, {
|
|
6084
|
+
scope: props.__scopeSlider,
|
|
6085
|
+
startEdge: isSlidingFromLeft ? "left" : "right",
|
|
6086
|
+
endEdge: isSlidingFromLeft ? "right" : "left",
|
|
6087
|
+
direction: isSlidingFromLeft ? 1 : -1,
|
|
6088
|
+
size: "width",
|
|
6089
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SliderImpl, {
|
|
6090
|
+
dir: direction,
|
|
6091
|
+
"data-orientation": "horizontal",
|
|
6092
|
+
...sliderProps,
|
|
6093
|
+
ref: composedRefs,
|
|
6094
|
+
style: {
|
|
6095
|
+
...sliderProps.style,
|
|
6096
|
+
["--radix-slider-thumb-transform"]: "translateX(-50%)"
|
|
6097
|
+
},
|
|
6098
|
+
onSlideStart: (event) => {
|
|
6099
|
+
const value = getValueFromPointer(event.clientX);
|
|
6100
|
+
onSlideStart?.(value);
|
|
6101
|
+
},
|
|
6102
|
+
onSlideMove: (event) => {
|
|
6103
|
+
const value = getValueFromPointer(event.clientX);
|
|
6104
|
+
onSlideMove?.(value);
|
|
6105
|
+
},
|
|
6106
|
+
onSlideEnd: () => {
|
|
6107
|
+
rectRef.current = void 0;
|
|
6108
|
+
onSlideEnd?.();
|
|
6109
|
+
},
|
|
6110
|
+
onStepKeyDown: (event) => {
|
|
6111
|
+
const isBackKey = BACK_KEYS[isSlidingFromLeft ? "from-left" : "from-right"].includes(event.key);
|
|
6112
|
+
onStepKeyDown?.({
|
|
6113
|
+
event,
|
|
6114
|
+
direction: isBackKey ? -1 : 1
|
|
6115
|
+
});
|
|
6116
|
+
}
|
|
6117
|
+
})
|
|
6118
|
+
});
|
|
6119
|
+
});
|
|
6120
|
+
var SliderVertical = react.forwardRef((props, forwardedRef) => {
|
|
6121
|
+
const { min: min$2, max: max$2, inverted, onSlideStart, onSlideMove, onSlideEnd, onStepKeyDown, ...sliderProps } = props;
|
|
6122
|
+
const sliderRef = react.useRef(null);
|
|
6123
|
+
const ref = useComposedRefs(forwardedRef, sliderRef);
|
|
6124
|
+
const rectRef = react.useRef(void 0);
|
|
6125
|
+
const isSlidingFromBottom = !inverted;
|
|
6126
|
+
function getValueFromPointer(pointerPosition) {
|
|
6127
|
+
const rect = rectRef.current || sliderRef.current.getBoundingClientRect();
|
|
6128
|
+
const value = linearScale([0, rect.height], isSlidingFromBottom ? [max$2, min$2] : [min$2, max$2]);
|
|
6129
|
+
rectRef.current = rect;
|
|
6130
|
+
return value(pointerPosition - rect.top);
|
|
6131
|
+
}
|
|
6132
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SliderOrientationProvider, {
|
|
6133
|
+
scope: props.__scopeSlider,
|
|
6134
|
+
startEdge: isSlidingFromBottom ? "bottom" : "top",
|
|
6135
|
+
endEdge: isSlidingFromBottom ? "top" : "bottom",
|
|
6136
|
+
size: "height",
|
|
6137
|
+
direction: isSlidingFromBottom ? 1 : -1,
|
|
6138
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SliderImpl, {
|
|
6139
|
+
"data-orientation": "vertical",
|
|
6140
|
+
...sliderProps,
|
|
6141
|
+
ref,
|
|
6142
|
+
style: {
|
|
6143
|
+
...sliderProps.style,
|
|
6144
|
+
["--radix-slider-thumb-transform"]: "translateY(50%)"
|
|
6145
|
+
},
|
|
6146
|
+
onSlideStart: (event) => {
|
|
6147
|
+
const value = getValueFromPointer(event.clientY);
|
|
6148
|
+
onSlideStart?.(value);
|
|
6149
|
+
},
|
|
6150
|
+
onSlideMove: (event) => {
|
|
6151
|
+
const value = getValueFromPointer(event.clientY);
|
|
6152
|
+
onSlideMove?.(value);
|
|
6153
|
+
},
|
|
6154
|
+
onSlideEnd: () => {
|
|
6155
|
+
rectRef.current = void 0;
|
|
6156
|
+
onSlideEnd?.();
|
|
6157
|
+
},
|
|
6158
|
+
onStepKeyDown: (event) => {
|
|
6159
|
+
const isBackKey = BACK_KEYS[isSlidingFromBottom ? "from-bottom" : "from-top"].includes(event.key);
|
|
6160
|
+
onStepKeyDown?.({
|
|
6161
|
+
event,
|
|
6162
|
+
direction: isBackKey ? -1 : 1
|
|
6163
|
+
});
|
|
6164
|
+
}
|
|
6165
|
+
})
|
|
6166
|
+
});
|
|
6167
|
+
});
|
|
6168
|
+
var SliderImpl = react.forwardRef((props, forwardedRef) => {
|
|
6169
|
+
const { __scopeSlider, onSlideStart, onSlideMove, onSlideEnd, onHomeKeyDown, onEndKeyDown, onStepKeyDown, ...sliderProps } = props;
|
|
6170
|
+
const context = useSliderContext(SLIDER_NAME, __scopeSlider);
|
|
6171
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Primitive.span, {
|
|
6172
|
+
...sliderProps,
|
|
6173
|
+
ref: forwardedRef,
|
|
6174
|
+
onKeyDown: composeEventHandlers(props.onKeyDown, (event) => {
|
|
6175
|
+
if (event.key === "Home") {
|
|
6176
|
+
onHomeKeyDown(event);
|
|
6177
|
+
event.preventDefault();
|
|
6178
|
+
} else if (event.key === "End") {
|
|
6179
|
+
onEndKeyDown(event);
|
|
6180
|
+
event.preventDefault();
|
|
6181
|
+
} else if (PAGE_KEYS.concat(ARROW_KEYS).includes(event.key)) {
|
|
6182
|
+
onStepKeyDown(event);
|
|
6183
|
+
event.preventDefault();
|
|
6184
|
+
}
|
|
6185
|
+
}),
|
|
6186
|
+
onPointerDown: composeEventHandlers(props.onPointerDown, (event) => {
|
|
6187
|
+
const target = event.target;
|
|
6188
|
+
target.setPointerCapture(event.pointerId);
|
|
6189
|
+
event.preventDefault();
|
|
6190
|
+
if (context.thumbs.has(target)) target.focus();
|
|
6191
|
+
else onSlideStart(event);
|
|
6192
|
+
}),
|
|
6193
|
+
onPointerMove: composeEventHandlers(props.onPointerMove, (event) => {
|
|
6194
|
+
if (event.target.hasPointerCapture(event.pointerId)) onSlideMove(event);
|
|
6195
|
+
}),
|
|
6196
|
+
onPointerUp: composeEventHandlers(props.onPointerUp, (event) => {
|
|
6197
|
+
const target = event.target;
|
|
6198
|
+
if (target.hasPointerCapture(event.pointerId)) {
|
|
6199
|
+
target.releasePointerCapture(event.pointerId);
|
|
6200
|
+
onSlideEnd(event);
|
|
6201
|
+
}
|
|
6202
|
+
})
|
|
6203
|
+
});
|
|
6204
|
+
});
|
|
6205
|
+
var TRACK_NAME = "SliderTrack";
|
|
6206
|
+
var SliderTrack = react.forwardRef((props, forwardedRef) => {
|
|
6207
|
+
const { __scopeSlider, ...trackProps } = props;
|
|
6208
|
+
const context = useSliderContext(TRACK_NAME, __scopeSlider);
|
|
6209
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Primitive.span, {
|
|
6210
|
+
"data-disabled": context.disabled ? "" : void 0,
|
|
6211
|
+
"data-orientation": context.orientation,
|
|
6212
|
+
...trackProps,
|
|
6213
|
+
ref: forwardedRef
|
|
6214
|
+
});
|
|
6215
|
+
});
|
|
6216
|
+
SliderTrack.displayName = TRACK_NAME;
|
|
6217
|
+
var RANGE_NAME = "SliderRange";
|
|
6218
|
+
var SliderRange = react.forwardRef((props, forwardedRef) => {
|
|
6219
|
+
const { __scopeSlider, ...rangeProps } = props;
|
|
6220
|
+
const context = useSliderContext(RANGE_NAME, __scopeSlider);
|
|
6221
|
+
const orientation = useSliderOrientationContext(RANGE_NAME, __scopeSlider);
|
|
6222
|
+
const composedRefs = useComposedRefs(forwardedRef, react.useRef(null));
|
|
6223
|
+
const valuesCount = context.values.length;
|
|
6224
|
+
const percentages = context.values.map((value) => convertValueToPercentage(value, context.min, context.max));
|
|
6225
|
+
const offsetStart = valuesCount > 1 ? Math.min(...percentages) : 0;
|
|
6226
|
+
const offsetEnd = 100 - Math.max(...percentages);
|
|
6227
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Primitive.span, {
|
|
6228
|
+
"data-orientation": context.orientation,
|
|
6229
|
+
"data-disabled": context.disabled ? "" : void 0,
|
|
6230
|
+
...rangeProps,
|
|
6231
|
+
ref: composedRefs,
|
|
6232
|
+
style: {
|
|
6233
|
+
...props.style,
|
|
6234
|
+
[orientation.startEdge]: offsetStart + "%",
|
|
6235
|
+
[orientation.endEdge]: offsetEnd + "%"
|
|
6236
|
+
}
|
|
6237
|
+
});
|
|
6238
|
+
});
|
|
6239
|
+
SliderRange.displayName = RANGE_NAME;
|
|
6240
|
+
var THUMB_NAME = "SliderThumb";
|
|
6241
|
+
var SliderThumb = react.forwardRef((props, forwardedRef) => {
|
|
6242
|
+
const getItems = useCollection(props.__scopeSlider);
|
|
6243
|
+
const [thumb, setThumb] = react.useState(null);
|
|
6244
|
+
const composedRefs = useComposedRefs(forwardedRef, (node) => setThumb(node));
|
|
6245
|
+
const index$1 = react.useMemo(() => thumb ? getItems().findIndex((item) => item.ref.current === thumb) : -1, [getItems, thumb]);
|
|
6246
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SliderThumbImpl, {
|
|
6247
|
+
...props,
|
|
6248
|
+
ref: composedRefs,
|
|
6249
|
+
index: index$1
|
|
6250
|
+
});
|
|
6251
|
+
});
|
|
6252
|
+
var SliderThumbImpl = react.forwardRef((props, forwardedRef) => {
|
|
6253
|
+
const { __scopeSlider, index: index$1, name, ...thumbProps } = props;
|
|
6254
|
+
const context = useSliderContext(THUMB_NAME, __scopeSlider);
|
|
6255
|
+
const orientation = useSliderOrientationContext(THUMB_NAME, __scopeSlider);
|
|
6256
|
+
const [thumb, setThumb] = react.useState(null);
|
|
6257
|
+
const composedRefs = useComposedRefs(forwardedRef, (node) => setThumb(node));
|
|
6258
|
+
const isFormControl = thumb ? context.form || !!thumb.closest("form") : true;
|
|
6259
|
+
const size$3 = useSize(thumb);
|
|
6260
|
+
const value = context.values[index$1];
|
|
6261
|
+
const percent = value === void 0 ? 0 : convertValueToPercentage(value, context.min, context.max);
|
|
6262
|
+
const label = getLabel$1(index$1, context.values.length);
|
|
6263
|
+
const orientationSize = size$3?.[orientation.size];
|
|
6264
|
+
const thumbInBoundsOffset = orientationSize ? getThumbInBoundsOffset(orientationSize, percent, orientation.direction) : 0;
|
|
6265
|
+
react.useEffect(() => {
|
|
6266
|
+
if (thumb) {
|
|
6267
|
+
context.thumbs.add(thumb);
|
|
6268
|
+
return () => {
|
|
6269
|
+
context.thumbs.delete(thumb);
|
|
6270
|
+
};
|
|
6271
|
+
}
|
|
6272
|
+
}, [thumb, context.thumbs]);
|
|
6273
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
|
|
6274
|
+
style: {
|
|
6275
|
+
transform: "var(--radix-slider-thumb-transform)",
|
|
6276
|
+
position: "absolute",
|
|
6277
|
+
[orientation.startEdge]: `calc(${percent}% + ${thumbInBoundsOffset}px)`
|
|
6278
|
+
},
|
|
6279
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(Collection.ItemSlot, {
|
|
6280
|
+
scope: props.__scopeSlider,
|
|
6281
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Primitive.span, {
|
|
6282
|
+
role: "slider",
|
|
6283
|
+
"aria-label": props["aria-label"] || label,
|
|
6284
|
+
"aria-valuemin": context.min,
|
|
6285
|
+
"aria-valuenow": value,
|
|
6286
|
+
"aria-valuemax": context.max,
|
|
6287
|
+
"aria-orientation": context.orientation,
|
|
6288
|
+
"data-orientation": context.orientation,
|
|
6289
|
+
"data-disabled": context.disabled ? "" : void 0,
|
|
6290
|
+
tabIndex: context.disabled ? void 0 : 0,
|
|
6291
|
+
...thumbProps,
|
|
6292
|
+
ref: composedRefs,
|
|
6293
|
+
style: value === void 0 ? { display: "none" } : props.style,
|
|
6294
|
+
onFocus: composeEventHandlers(props.onFocus, () => {
|
|
6295
|
+
context.valueIndexToChangeRef.current = index$1;
|
|
6296
|
+
})
|
|
6297
|
+
})
|
|
6298
|
+
}), isFormControl && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SliderBubbleInput, {
|
|
6299
|
+
name: name ?? (context.name ? context.name + (context.values.length > 1 ? "[]" : "") : void 0),
|
|
6300
|
+
form: context.form,
|
|
6301
|
+
value
|
|
6302
|
+
}, index$1)]
|
|
6303
|
+
});
|
|
6304
|
+
});
|
|
6305
|
+
SliderThumb.displayName = THUMB_NAME;
|
|
6306
|
+
var BUBBLE_INPUT_NAME = "RadioBubbleInput";
|
|
6307
|
+
var SliderBubbleInput = react.forwardRef(({ __scopeSlider, value, ...props }, forwardedRef) => {
|
|
6308
|
+
const ref = react.useRef(null);
|
|
6309
|
+
const composedRefs = useComposedRefs(ref, forwardedRef);
|
|
6310
|
+
const prevValue = usePrevious(value);
|
|
6311
|
+
react.useEffect(() => {
|
|
6312
|
+
const input = ref.current;
|
|
6313
|
+
if (!input) return;
|
|
6314
|
+
const inputProto = window.HTMLInputElement.prototype;
|
|
6315
|
+
const setValue = Object.getOwnPropertyDescriptor(inputProto, "value").set;
|
|
6316
|
+
if (prevValue !== value && setValue) {
|
|
6317
|
+
const event = new Event("input", { bubbles: true });
|
|
6318
|
+
setValue.call(input, value);
|
|
6319
|
+
input.dispatchEvent(event);
|
|
6320
|
+
}
|
|
6321
|
+
}, [prevValue, value]);
|
|
6322
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Primitive.input, {
|
|
6323
|
+
style: { display: "none" },
|
|
6324
|
+
...props,
|
|
6325
|
+
ref: composedRefs,
|
|
6326
|
+
defaultValue: value
|
|
6327
|
+
});
|
|
6328
|
+
});
|
|
6329
|
+
SliderBubbleInput.displayName = BUBBLE_INPUT_NAME;
|
|
6330
|
+
function getNextSortedValues(prevValues = [], nextValue, atIndex) {
|
|
6331
|
+
const nextValues = [...prevValues];
|
|
6332
|
+
nextValues[atIndex] = nextValue;
|
|
6333
|
+
return nextValues.sort((a$1, b$1) => a$1 - b$1);
|
|
6334
|
+
}
|
|
6335
|
+
function convertValueToPercentage(value, min$2, max$2) {
|
|
6336
|
+
return clamp(100 / (max$2 - min$2) * (value - min$2), [0, 100]);
|
|
6337
|
+
}
|
|
6338
|
+
function getLabel$1(index$1, totalValues) {
|
|
6339
|
+
if (totalValues > 2) return `Value ${index$1 + 1} of ${totalValues}`;
|
|
6340
|
+
else if (totalValues === 2) return ["Minimum", "Maximum"][index$1];
|
|
6341
|
+
else return;
|
|
6342
|
+
}
|
|
6343
|
+
function getClosestValueIndex(values, nextValue) {
|
|
6344
|
+
if (values.length === 1) return 0;
|
|
6345
|
+
const distances = values.map((value) => Math.abs(value - nextValue));
|
|
6346
|
+
const closestDistance = Math.min(...distances);
|
|
6347
|
+
return distances.indexOf(closestDistance);
|
|
6348
|
+
}
|
|
6349
|
+
function getThumbInBoundsOffset(width, left, direction) {
|
|
6350
|
+
const halfWidth = width / 2;
|
|
6351
|
+
return (halfWidth - linearScale([0, 50], [0, halfWidth])(left) * direction) * direction;
|
|
6352
|
+
}
|
|
6353
|
+
function getStepsBetweenValues(values) {
|
|
6354
|
+
return values.slice(0, -1).map((value, index$1) => values[index$1 + 1] - value);
|
|
6355
|
+
}
|
|
6356
|
+
function hasMinStepsBetweenValues(values, minStepsBetweenValues) {
|
|
6357
|
+
if (minStepsBetweenValues > 0) {
|
|
6358
|
+
const stepsBetweenValues = getStepsBetweenValues(values);
|
|
6359
|
+
return Math.min(...stepsBetweenValues) >= minStepsBetweenValues;
|
|
6360
|
+
}
|
|
6361
|
+
return true;
|
|
6362
|
+
}
|
|
6363
|
+
function linearScale(input, output) {
|
|
6364
|
+
return (value) => {
|
|
6365
|
+
if (input[0] === input[1] || output[0] === output[1]) return output[0];
|
|
6366
|
+
const ratio = (output[1] - output[0]) / (input[1] - input[0]);
|
|
6367
|
+
return output[0] + ratio * (value - input[0]);
|
|
6368
|
+
};
|
|
6369
|
+
}
|
|
6370
|
+
function getDecimalCount(value) {
|
|
6371
|
+
return (String(value).split(".")[1] || "").length;
|
|
6372
|
+
}
|
|
6373
|
+
function roundValue(value, decimalCount) {
|
|
6374
|
+
const rounder = Math.pow(10, decimalCount);
|
|
6375
|
+
return Math.round(value * rounder) / rounder;
|
|
6376
|
+
}
|
|
6377
|
+
var Root = Slider;
|
|
6378
|
+
var Track = SliderTrack;
|
|
6379
|
+
var Range = SliderRange;
|
|
6380
|
+
var Thumb = SliderThumb;
|
|
6381
|
+
const SliderGlass = (0, react.forwardRef)(({ className, value, defaultValue, onValueChange, onValueCommit, min: min$2 = 0, max: max$2 = 100, step = 1, showValue, label, error, success, disabled, orientation = "horizontal", ...props }, ref) => {
|
|
6382
|
+
const currentValue = value ?? defaultValue ?? [min$2];
|
|
6383
|
+
const formatValueDisplay = (values) => {
|
|
6384
|
+
if (values.length === 1) return `${values[0]}`;
|
|
6385
|
+
return `${values[0]} - ${values[values.length - 1]}`;
|
|
6386
|
+
};
|
|
6387
|
+
const trackStyles = { background: "var(--slider-track)" };
|
|
6388
|
+
const rangeStyles = { background: "var(--slider-fill)" };
|
|
5697
6389
|
const thumbStyles = {
|
|
5698
|
-
left: `calc(${percentage}% - 10px)`,
|
|
5699
6390
|
background: "var(--slider-thumb)",
|
|
5700
|
-
border: "2px solid var(--slider-thumb-border)"
|
|
5701
|
-
boxShadow: isFocusVisible ? "var(--focus-glow)" : isHovered || isDragging ? "var(--slider-thumb-glow)" : "var(--slider-thumb-shadow)",
|
|
5702
|
-
transform: isDragging ? "scale(1.15)" : isHovered ? "scale(1.05)" : "scale(1)"
|
|
6391
|
+
border: "2px solid var(--slider-thumb-border)"
|
|
5703
6392
|
};
|
|
5704
6393
|
const customLabel = label && showValue || !label && showValue ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
5705
6394
|
className: "flex justify-between mb-1.5 md:mb-2",
|
|
@@ -5710,7 +6399,7 @@ const SliderGlass = (0, react.forwardRef)(({ className, value, onChange, min: mi
|
|
|
5710
6399
|
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
5711
6400
|
className: "text-xs md:text-sm font-medium tabular-nums",
|
|
5712
6401
|
style: { color: "var(--text-secondary)" },
|
|
5713
|
-
children:
|
|
6402
|
+
children: formatValueDisplay(currentValue)
|
|
5714
6403
|
})]
|
|
5715
6404
|
}) : void 0;
|
|
5716
6405
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(FormFieldWrapper, {
|
|
@@ -5718,48 +6407,31 @@ const SliderGlass = (0, react.forwardRef)(({ className, value, onChange, min: mi
|
|
|
5718
6407
|
error,
|
|
5719
6408
|
success,
|
|
5720
6409
|
className: require_utils.cn("w-full", className),
|
|
5721
|
-
children: [customLabel, /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(
|
|
5722
|
-
|
|
5723
|
-
|
|
5724
|
-
|
|
5725
|
-
|
|
5726
|
-
|
|
5727
|
-
|
|
5728
|
-
|
|
5729
|
-
|
|
5730
|
-
|
|
5731
|
-
|
|
5732
|
-
|
|
5733
|
-
|
|
5734
|
-
|
|
5735
|
-
|
|
5736
|
-
|
|
5737
|
-
|
|
5738
|
-
|
|
5739
|
-
|
|
5740
|
-
onMouseUp: () => setIsDragging(false),
|
|
5741
|
-
onTouchStart: () => setIsDragging(true),
|
|
5742
|
-
onTouchEnd: () => setIsDragging(false),
|
|
5743
|
-
onFocus: focusProps.onFocus,
|
|
5744
|
-
onBlur: focusProps.onBlur,
|
|
5745
|
-
min: min$2,
|
|
5746
|
-
max: max$2,
|
|
5747
|
-
step,
|
|
5748
|
-
disabled,
|
|
5749
|
-
"aria-label": label || `Slider: ${value} (${min$2}-${max$2})`,
|
|
5750
|
-
"aria-valuemin": min$2,
|
|
5751
|
-
"aria-valuemax": max$2,
|
|
5752
|
-
"aria-valuenow": value,
|
|
5753
|
-
"aria-valuetext": `${value}`,
|
|
5754
|
-
className: "absolute w-full h-8 md:h-6 opacity-0 cursor-pointer disabled:cursor-not-allowed z-10",
|
|
5755
|
-
style: { outline: "none" },
|
|
5756
|
-
...props
|
|
5757
|
-
}),
|
|
5758
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
5759
|
-
className: "absolute w-6 h-6 md:w-5 md:h-5 rounded-full transition-all duration-150 pointer-events-none",
|
|
5760
|
-
style: thumbStyles
|
|
6410
|
+
children: [customLabel, /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(Root, {
|
|
6411
|
+
ref,
|
|
6412
|
+
value,
|
|
6413
|
+
defaultValue,
|
|
6414
|
+
onValueChange,
|
|
6415
|
+
onValueCommit,
|
|
6416
|
+
min: min$2,
|
|
6417
|
+
max: max$2,
|
|
6418
|
+
step,
|
|
6419
|
+
disabled,
|
|
6420
|
+
orientation,
|
|
6421
|
+
className: require_utils.cn("relative flex touch-none select-none", orientation === "horizontal" ? "w-full h-8 md:h-6 items-center" : "flex-col h-full w-8 md:w-6 justify-center", disabled && "opacity-50 cursor-not-allowed", "group"),
|
|
6422
|
+
...props,
|
|
6423
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(Track, {
|
|
6424
|
+
className: require_utils.cn("relative grow rounded-full", orientation === "horizontal" ? "h-2.5 md:h-2 w-full" : "w-2.5 md:w-2 h-full"),
|
|
6425
|
+
style: trackStyles,
|
|
6426
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Range, {
|
|
6427
|
+
className: require_utils.cn("absolute rounded-full transition-shadow duration-150", orientation === "horizontal" ? "h-full" : "w-full", "group-hover:shadow-(--slider-fill-glow)", "group-active:shadow-(--slider-fill-glow)"),
|
|
6428
|
+
style: rangeStyles
|
|
5761
6429
|
})
|
|
5762
|
-
|
|
6430
|
+
}), currentValue.map((_, index$1) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Thumb, {
|
|
6431
|
+
className: require_utils.cn("block rounded-full shadow-md transition-all duration-150", "w-6 h-6 md:w-5 md:h-5", "hover:scale-105", "focus-visible:outline-none focus-visible:shadow-(--focus-glow)", "active:scale-110", disabled && "pointer-events-none"),
|
|
6432
|
+
style: thumbStyles,
|
|
6433
|
+
"aria-label": label ? currentValue.length > 1 ? `${label} thumb ${index$1 + 1}` : label : `Slider thumb ${index$1 + 1}`
|
|
6434
|
+
}, index$1))]
|
|
5763
6435
|
})]
|
|
5764
6436
|
});
|
|
5765
6437
|
});
|
|
@@ -5876,12 +6548,21 @@ const TabsGlass = {
|
|
|
5876
6548
|
Content: TabsContent
|
|
5877
6549
|
};
|
|
5878
6550
|
const toggleSizes = (0, class_variance_authority.cva)("relative rounded-full transition-all duration-300", {
|
|
5879
|
-
variants: {
|
|
5880
|
-
|
|
5881
|
-
|
|
5882
|
-
|
|
5883
|
-
|
|
5884
|
-
|
|
6551
|
+
variants: {
|
|
6552
|
+
size: {
|
|
6553
|
+
sm: "w-8 h-4",
|
|
6554
|
+
default: "w-11 h-6",
|
|
6555
|
+
lg: "w-14 h-7"
|
|
6556
|
+
},
|
|
6557
|
+
variant: {
|
|
6558
|
+
default: "",
|
|
6559
|
+
outline: "border-2"
|
|
6560
|
+
}
|
|
6561
|
+
},
|
|
6562
|
+
defaultVariants: {
|
|
6563
|
+
size: "default",
|
|
6564
|
+
variant: "default"
|
|
6565
|
+
}
|
|
5885
6566
|
});
|
|
5886
6567
|
var sizesConfig = {
|
|
5887
6568
|
sm: {
|
|
@@ -5889,7 +6570,7 @@ var sizesConfig = {
|
|
|
5889
6570
|
knob: "w-3 h-3",
|
|
5890
6571
|
translate: "translate-x-4"
|
|
5891
6572
|
},
|
|
5892
|
-
|
|
6573
|
+
default: {
|
|
5893
6574
|
track: "w-11 h-6",
|
|
5894
6575
|
knob: "w-5 h-5",
|
|
5895
6576
|
translate: "translate-x-5"
|
|
@@ -5900,12 +6581,28 @@ var sizesConfig = {
|
|
|
5900
6581
|
translate: "translate-x-7"
|
|
5901
6582
|
}
|
|
5902
6583
|
};
|
|
5903
|
-
const ToggleGlass = (0, react.forwardRef)(({ className, size: size$3 = "
|
|
6584
|
+
const ToggleGlass = (0, react.forwardRef)(({ className, size: size$3 = "default", variant = "default", pressed: controlledPressed, defaultPressed = false, onPressedChange, disabled, label, ...props }, ref) => {
|
|
6585
|
+
const [uncontrolledPressed, setUncontrolledPressed] = (0, react.useState)(defaultPressed);
|
|
6586
|
+
const isControlled = controlledPressed !== void 0;
|
|
6587
|
+
const isPressed = isControlled ? controlledPressed : uncontrolledPressed;
|
|
5904
6588
|
const { isFocusVisible, focusProps } = require_use_focus.useFocus({ focusVisible: true });
|
|
5905
|
-
const s$1 = sizesConfig[size$3 ?? "
|
|
5906
|
-
const
|
|
5907
|
-
|
|
5908
|
-
|
|
6589
|
+
const s$1 = sizesConfig[size$3 ?? "default"];
|
|
6590
|
+
const handleToggle = () => {
|
|
6591
|
+
if (disabled) return;
|
|
6592
|
+
const newValue = !isPressed;
|
|
6593
|
+
if (!isControlled) setUncontrolledPressed(newValue);
|
|
6594
|
+
onPressedChange?.(newValue);
|
|
6595
|
+
};
|
|
6596
|
+
const getTrackStyles = () => {
|
|
6597
|
+
if (variant === "outline") return {
|
|
6598
|
+
background: isPressed ? "var(--toggle-outline-active-bg)" : "transparent",
|
|
6599
|
+
borderColor: isPressed ? "var(--toggle-outline-active-border)" : "var(--toggle-outline-border)",
|
|
6600
|
+
boxShadow: isFocusVisible && !disabled ? "var(--focus-glow)" : "none"
|
|
6601
|
+
};
|
|
6602
|
+
return {
|
|
6603
|
+
background: isPressed ? "var(--toggle-active-bg)" : "var(--toggle-bg)",
|
|
6604
|
+
boxShadow: isFocusVisible && !disabled ? "var(--focus-glow)" : isPressed ? "var(--toggle-glow)" : "none"
|
|
6605
|
+
};
|
|
5909
6606
|
};
|
|
5910
6607
|
const knobStyles = { background: "var(--toggle-knob)" };
|
|
5911
6608
|
const toggle = /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
@@ -5914,17 +6611,20 @@ const ToggleGlass = (0, react.forwardRef)(({ className, size: size$3 = "md", che
|
|
|
5914
6611
|
ref,
|
|
5915
6612
|
type: "button",
|
|
5916
6613
|
role: "switch",
|
|
5917
|
-
"aria-
|
|
6614
|
+
"aria-pressed": isPressed,
|
|
5918
6615
|
"aria-label": label || "Toggle switch",
|
|
5919
6616
|
disabled,
|
|
5920
|
-
className: require_utils.cn(toggleSizes({
|
|
5921
|
-
|
|
5922
|
-
|
|
6617
|
+
className: require_utils.cn(toggleSizes({
|
|
6618
|
+
size: size$3,
|
|
6619
|
+
variant
|
|
6620
|
+
}), disabled ? "opacity-50 cursor-not-allowed" : "cursor-pointer", !label && className),
|
|
6621
|
+
style: getTrackStyles(),
|
|
6622
|
+
onClick: handleToggle,
|
|
5923
6623
|
onFocus: focusProps.onFocus,
|
|
5924
6624
|
onBlur: focusProps.onBlur,
|
|
5925
6625
|
...props,
|
|
5926
6626
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
5927
|
-
className: require_utils.cn("absolute top-0.5 left-0.5 rounded-full shadow-md transition-all duration-300", s$1.knob,
|
|
6627
|
+
className: require_utils.cn("absolute top-0.5 left-0.5 rounded-full shadow-md transition-all duration-300", s$1.knob, isPressed && s$1.translate),
|
|
5928
6628
|
style: knobStyles
|
|
5929
6629
|
})
|
|
5930
6630
|
})
|
|
@@ -9232,7 +9932,7 @@ var require_use_sync_external_store_shim_development = /* @__PURE__ */ __commonJ
|
|
|
9232
9932
|
return x$2 === y$2 && (0 !== x$2 || 1 / x$2 === 1 / y$2) || x$2 !== x$2 && y$2 !== y$2;
|
|
9233
9933
|
}
|
|
9234
9934
|
function useSyncExternalStore$2$1(subscribe, getSnapshot) {
|
|
9235
|
-
didWarnOld18Alpha || void 0 === React$
|
|
9935
|
+
didWarnOld18Alpha || void 0 === React$5.startTransition || (didWarnOld18Alpha = !0, console.error("You are using an outdated, pre-release alpha of React 18 that does not support useSyncExternalStore. The use-sync-external-store shim will not work correctly. Upgrade to a newer pre-release."));
|
|
9236
9936
|
var value = getSnapshot();
|
|
9237
9937
|
if (!didWarnUncachedGetSnapshot) {
|
|
9238
9938
|
var cachedValue = getSnapshot();
|
|
@@ -9275,8 +9975,8 @@ var require_use_sync_external_store_shim_development = /* @__PURE__ */ __commonJ
|
|
|
9275
9975
|
return getSnapshot();
|
|
9276
9976
|
}
|
|
9277
9977
|
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());
|
|
9278
|
-
var React$
|
|
9279
|
-
exports.useSyncExternalStore = void 0 !== React$
|
|
9978
|
+
var React$5 = require("react"), objectIs$3 = "function" === typeof Object.is ? Object.is : is$6, useState$20 = React$5.useState, useEffect$18 = React$5.useEffect, useLayoutEffect$7 = React$5.useLayoutEffect, useDebugValue$3 = React$5.useDebugValue, didWarnOld18Alpha = !1, didWarnUncachedGetSnapshot = !1, shim$2 = "undefined" === typeof window || "undefined" === typeof window.document || "undefined" === typeof window.document.createElement ? useSyncExternalStore$1$2 : useSyncExternalStore$2$1;
|
|
9979
|
+
exports.useSyncExternalStore = void 0 !== React$5.useSyncExternalStore ? React$5.useSyncExternalStore : shim$2;
|
|
9280
9980
|
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error());
|
|
9281
9981
|
})();
|
|
9282
9982
|
}));
|
|
@@ -9363,7 +10063,7 @@ var require_with_selector_development = /* @__PURE__ */ __commonJSMin(((exports)
|
|
|
9363
10063
|
return x$2 === y$2 && (0 !== x$2 || 1 / x$2 === 1 / y$2) || x$2 !== x$2 && y$2 !== y$2;
|
|
9364
10064
|
}
|
|
9365
10065
|
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());
|
|
9366
|
-
var React$
|
|
10066
|
+
var React$5 = require("react"), shim$2 = require_shim(), objectIs$3 = "function" === typeof Object.is ? Object.is : is$6, useSyncExternalStore$3 = shim$2.useSyncExternalStore, useRef$15 = React$5.useRef, useEffect$18 = React$5.useEffect, useMemo$12 = React$5.useMemo, useDebugValue$3 = React$5.useDebugValue;
|
|
9367
10067
|
exports.useSyncExternalStoreWithSelector = function(subscribe, getSnapshot, getServerSnapshot, selector, isEqual) {
|
|
9368
10068
|
var instRef = useRef$15(null);
|
|
9369
10069
|
if (null === instRef.current) {
|
|
@@ -15697,19 +16397,19 @@ function copy$1(source, target) {
|
|
|
15697
16397
|
return target.domain(source.domain()).range(source.range()).interpolate(source.interpolate()).clamp(source.clamp()).unknown(source.unknown());
|
|
15698
16398
|
}
|
|
15699
16399
|
function transformer$2() {
|
|
15700
|
-
var domain = unit, range$4 = unit, interpolate$1 = value_default, transform, untransform, unknown, clamp$
|
|
16400
|
+
var domain = unit, range$4 = unit, interpolate$1 = value_default, transform, untransform, unknown, clamp$2 = identity$1, piecewise$1, output, input;
|
|
15701
16401
|
function rescale() {
|
|
15702
16402
|
var n$1 = Math.min(domain.length, range$4.length);
|
|
15703
|
-
if (clamp$
|
|
16403
|
+
if (clamp$2 !== identity$1) clamp$2 = clamper(domain[0], domain[n$1 - 1]);
|
|
15704
16404
|
piecewise$1 = n$1 > 2 ? polymap : bimap;
|
|
15705
16405
|
output = input = null;
|
|
15706
16406
|
return scale;
|
|
15707
16407
|
}
|
|
15708
16408
|
function scale(x$2) {
|
|
15709
|
-
return x$2 == null || isNaN(x$2 = +x$2) ? unknown : (output || (output = piecewise$1(domain.map(transform), range$4, interpolate$1)))(transform(clamp$
|
|
16409
|
+
return x$2 == null || isNaN(x$2 = +x$2) ? unknown : (output || (output = piecewise$1(domain.map(transform), range$4, interpolate$1)))(transform(clamp$2(x$2)));
|
|
15710
16410
|
}
|
|
15711
16411
|
scale.invert = function(y$2) {
|
|
15712
|
-
return clamp$
|
|
16412
|
+
return clamp$2(untransform((input || (input = piecewise$1(range$4, domain.map(transform), number_default)))(y$2)));
|
|
15713
16413
|
};
|
|
15714
16414
|
scale.domain = function(_) {
|
|
15715
16415
|
return arguments.length ? (domain = Array.from(_, number$1), rescale()) : domain.slice();
|
|
@@ -15721,7 +16421,7 @@ function transformer$2() {
|
|
|
15721
16421
|
return range$4 = Array.from(_), interpolate$1 = round_default, rescale();
|
|
15722
16422
|
};
|
|
15723
16423
|
scale.clamp = function(_) {
|
|
15724
|
-
return arguments.length ? (clamp$
|
|
16424
|
+
return arguments.length ? (clamp$2 = _ ? true : identity$1, rescale()) : clamp$2 !== identity$1;
|
|
15725
16425
|
};
|
|
15726
16426
|
scale.interpolate = function(_) {
|
|
15727
16427
|
return arguments.length ? (interpolate$1 = _, rescale()) : interpolate$1;
|
|
@@ -17369,15 +18069,15 @@ function utcTime() {
|
|
|
17369
18069
|
return initRange.apply(calendar(utcTicks, utcTickInterval, utcYear, utcMonth, utcSunday, utcDay, utcHour, utcMinute, second, utcFormat).domain([Date.UTC(2e3, 0, 1), Date.UTC(2e3, 0, 2)]), arguments);
|
|
17370
18070
|
}
|
|
17371
18071
|
function transformer$1() {
|
|
17372
|
-
var x0 = 0, x1 = 1, t0$1, t1$1, k10, transform, interpolator = identity$1, clamp$
|
|
18072
|
+
var x0 = 0, x1 = 1, t0$1, t1$1, k10, transform, interpolator = identity$1, clamp$2 = false, unknown;
|
|
17373
18073
|
function scale(x$2) {
|
|
17374
|
-
return x$2 == null || isNaN(x$2 = +x$2) ? unknown : interpolator(k10 === 0 ? .5 : (x$2 = (transform(x$2) - t0$1) * k10, clamp$
|
|
18074
|
+
return x$2 == null || isNaN(x$2 = +x$2) ? unknown : interpolator(k10 === 0 ? .5 : (x$2 = (transform(x$2) - t0$1) * k10, clamp$2 ? Math.max(0, Math.min(1, x$2)) : x$2));
|
|
17375
18075
|
}
|
|
17376
18076
|
scale.domain = function(_) {
|
|
17377
18077
|
return arguments.length ? ([x0, x1] = _, t0$1 = transform(x0 = +x0), t1$1 = transform(x1 = +x1), k10 = t0$1 === t1$1 ? 0 : 1 / (t1$1 - t0$1), scale) : [x0, x1];
|
|
17378
18078
|
};
|
|
17379
18079
|
scale.clamp = function(_) {
|
|
17380
|
-
return arguments.length ? (clamp$
|
|
18080
|
+
return arguments.length ? (clamp$2 = !!_, scale) : clamp$2;
|
|
17381
18081
|
};
|
|
17382
18082
|
scale.interpolator = function(_) {
|
|
17383
18083
|
return arguments.length ? (interpolator = _, scale) : interpolator;
|
|
@@ -17459,9 +18159,9 @@ function sequentialQuantile() {
|
|
|
17459
18159
|
return initInterpolator.apply(scale, arguments);
|
|
17460
18160
|
}
|
|
17461
18161
|
function transformer() {
|
|
17462
|
-
var x0 = 0, x1 = .5, x2 = 1, s$1 = 1, t0$1, t1$1, t2, k10, k21, interpolator = identity$1, transform, clamp$
|
|
18162
|
+
var x0 = 0, x1 = .5, x2 = 1, s$1 = 1, t0$1, t1$1, t2, k10, k21, interpolator = identity$1, transform, clamp$2 = false, unknown;
|
|
17463
18163
|
function scale(x$2) {
|
|
17464
|
-
return isNaN(x$2 = +x$2) ? unknown : (x$2 = .5 + ((x$2 = +transform(x$2)) - t1$1) * (s$1 * x$2 < s$1 * t1$1 ? k10 : k21), interpolator(clamp$
|
|
18164
|
+
return isNaN(x$2 = +x$2) ? unknown : (x$2 = .5 + ((x$2 = +transform(x$2)) - t1$1) * (s$1 * x$2 < s$1 * t1$1 ? k10 : k21), interpolator(clamp$2 ? Math.max(0, Math.min(1, x$2)) : x$2));
|
|
17465
18165
|
}
|
|
17466
18166
|
scale.domain = function(_) {
|
|
17467
18167
|
return arguments.length ? ([x0, x1, x2] = _, t0$1 = transform(x0 = +x0), t1$1 = transform(x1 = +x1), t2 = transform(x2 = +x2), k10 = t0$1 === t1$1 ? 0 : .5 / (t1$1 - t0$1), k21 = t1$1 === t2 ? 0 : .5 / (t2 - t1$1), s$1 = t1$1 < t0$1 ? -1 : 1, scale) : [
|
|
@@ -17471,7 +18171,7 @@ function transformer() {
|
|
|
17471
18171
|
];
|
|
17472
18172
|
};
|
|
17473
18173
|
scale.clamp = function(_) {
|
|
17474
|
-
return arguments.length ? (clamp$
|
|
18174
|
+
return arguments.length ? (clamp$2 = !!_, scale) : clamp$2;
|
|
17475
18175
|
};
|
|
17476
18176
|
scale.interpolator = function(_) {
|
|
17477
18177
|
return arguments.length ? (interpolator = _, scale) : interpolator;
|
|
@@ -23572,7 +24272,7 @@ var require_use_sync_external_store_with_selector_development = /* @__PURE__ */
|
|
|
23572
24272
|
return x$2 === y$2 && (0 !== x$2 || 1 / x$2 === 1 / y$2) || x$2 !== x$2 && y$2 !== y$2;
|
|
23573
24273
|
}
|
|
23574
24274
|
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());
|
|
23575
|
-
var React$
|
|
24275
|
+
var React$5 = require("react"), objectIs$3 = "function" === typeof Object.is ? Object.is : is$6, useSyncExternalStore$3 = React$5.useSyncExternalStore, useRef$15 = React$5.useRef, useEffect$18 = React$5.useEffect, useMemo$12 = React$5.useMemo, useDebugValue$3 = React$5.useDebugValue;
|
|
23576
24276
|
exports.useSyncExternalStoreWithSelector = function(subscribe, getSnapshot, getServerSnapshot, selector, isEqual) {
|
|
23577
24277
|
var instRef = useRef$15(null);
|
|
23578
24278
|
if (null === instRef.current) {
|
|
@@ -25791,7 +26491,7 @@ const AICardGlass = (0, react.forwardRef)(({ onGenerate, features = defaultFeatu
|
|
|
25791
26491
|
}, `feature-${i}`))
|
|
25792
26492
|
}),
|
|
25793
26493
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(ButtonGlass, {
|
|
25794
|
-
variant: "
|
|
26494
|
+
variant: "default",
|
|
25795
26495
|
size: "sm",
|
|
25796
26496
|
icon: lucide_react.Zap,
|
|
25797
26497
|
onClick: onGenerate,
|
|
@@ -26321,7 +27021,7 @@ const RepositoryCardGlass = (0, react.forwardRef)(({ name, languages, commits, c
|
|
|
26321
27021
|
className: "flex-1",
|
|
26322
27022
|
children: "GitHub"
|
|
26323
27023
|
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ButtonGlass, {
|
|
26324
|
-
variant: "
|
|
27024
|
+
variant: "default",
|
|
26325
27025
|
size: "sm",
|
|
26326
27026
|
icon: lucide_react.Sparkles,
|
|
26327
27027
|
onClick: (e$1) => {
|
|
@@ -26658,7 +27358,7 @@ const YearCardGlass = (0, react.forwardRef)(({ year, emoji, label, commits, prog
|
|
|
26658
27358
|
}),
|
|
26659
27359
|
children,
|
|
26660
27360
|
onShowYear && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ButtonGlass, {
|
|
26661
|
-
variant: "
|
|
27361
|
+
variant: "default",
|
|
26662
27362
|
size: "sm",
|
|
26663
27363
|
onClick: (e$1) => {
|
|
26664
27364
|
e$1.stopPropagation();
|
|
@@ -27924,4 +28624,4 @@ Object.defineProperty(exports, "useMargin", {
|
|
|
27924
28624
|
}
|
|
27925
28625
|
});
|
|
27926
28626
|
|
|
27927
|
-
//# sourceMappingURL=trust-score-card-glass-
|
|
28627
|
+
//# sourceMappingURL=trust-score-card-glass-CGXmOIfq.cjs.map
|