prime-ui-kit 0.7.3 → 0.7.4
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/components/index.js +571 -497
- package/dist/components/index.js.map +4 -4
- package/dist/index.js +571 -497
- package/dist/index.js.map +4 -4
- package/dist/layout/index.d.ts +1 -0
- package/dist/layout/index.d.ts.map +1 -1
- package/dist/layout/sidebar/Sidebar.d.ts +2 -0
- package/dist/layout/sidebar/Sidebar.d.ts.map +1 -1
- package/dist/layout/sidebar/SidebarRoot.d.ts +10 -0
- package/dist/layout/sidebar/SidebarRoot.d.ts.map +1 -1
- package/dist/layout/sidebar/sidebarDesktopStorage.d.ts +5 -0
- package/dist/layout/sidebar/sidebarDesktopStorage.d.ts.map +1 -0
- package/dist/layout/sidebar/useSidebarNarrowViewport.d.ts +6 -0
- package/dist/layout/sidebar/useSidebarNarrowViewport.d.ts.map +1 -0
- package/package.json +1 -1
package/dist/components/index.js
CHANGED
|
@@ -207,7 +207,7 @@ import {
|
|
|
207
207
|
PanelRightClose,
|
|
208
208
|
PanelRightOpen
|
|
209
209
|
} from "lucide-react";
|
|
210
|
-
import * as
|
|
210
|
+
import * as React18 from "react";
|
|
211
211
|
import { NavLink } from "react-router-dom";
|
|
212
212
|
|
|
213
213
|
// src/components/divider/Divider.tsx
|
|
@@ -612,7 +612,7 @@ var Sidebar_default = {
|
|
|
612
612
|
|
|
613
613
|
// src/layout/sidebar/SidebarRoot.tsx
|
|
614
614
|
import { animate, useMotionValue, useMotionValueEvent, useReducedMotion } from "framer-motion";
|
|
615
|
-
import * as
|
|
615
|
+
import * as React17 from "react";
|
|
616
616
|
|
|
617
617
|
// src/hooks/useEscapeKey.ts
|
|
618
618
|
import * as React13 from "react";
|
|
@@ -736,6 +736,34 @@ function useOverlayModal(enabled, onClose) {
|
|
|
736
736
|
// src/layout/sidebar/sidebar-context.tsx
|
|
737
737
|
var [SidebarProvider, useSidebarContext] = createComponentContext("Sidebar");
|
|
738
738
|
|
|
739
|
+
// src/layout/sidebar/sidebarDesktopStorage.ts
|
|
740
|
+
var STORAGE_VERSION = 1;
|
|
741
|
+
function isStoredPayload(value) {
|
|
742
|
+
if (value === null || typeof value !== "object") return false;
|
|
743
|
+
const o = value;
|
|
744
|
+
return o.v === STORAGE_VERSION && (o.desktop === "expanded" || o.desktop === "compact");
|
|
745
|
+
}
|
|
746
|
+
function readStoredDesktopMode(key) {
|
|
747
|
+
if (typeof window === "undefined") return null;
|
|
748
|
+
try {
|
|
749
|
+
const raw = window.localStorage.getItem(key);
|
|
750
|
+
if (raw === null) return null;
|
|
751
|
+
const parsed = JSON.parse(raw);
|
|
752
|
+
if (!isStoredPayload(parsed)) return null;
|
|
753
|
+
return parsed.desktop;
|
|
754
|
+
} catch {
|
|
755
|
+
return null;
|
|
756
|
+
}
|
|
757
|
+
}
|
|
758
|
+
function writeStoredDesktopMode(key, mode) {
|
|
759
|
+
if (typeof window === "undefined") return;
|
|
760
|
+
try {
|
|
761
|
+
const payload = { v: STORAGE_VERSION, desktop: mode };
|
|
762
|
+
window.localStorage.setItem(key, JSON.stringify(payload));
|
|
763
|
+
} catch {
|
|
764
|
+
}
|
|
765
|
+
}
|
|
766
|
+
|
|
739
767
|
// src/layout/sidebar/sidebarLayout.ts
|
|
740
768
|
var SIDEBAR_LAYOUT_BREAKPOINT_MAX = "47.999rem";
|
|
741
769
|
var SIDEBAR_MEDIA_QUERY_NARROW = `(max-width: ${SIDEBAR_LAYOUT_BREAKPOINT_MAX})`;
|
|
@@ -745,18 +773,53 @@ function normalizeSidebarMode(mode) {
|
|
|
745
773
|
return mode === "expand" ? "expanded" : mode;
|
|
746
774
|
}
|
|
747
775
|
|
|
776
|
+
// src/layout/sidebar/useSidebarNarrowViewport.ts
|
|
777
|
+
import * as React16 from "react";
|
|
778
|
+
function useSidebarNarrowViewport(enabled) {
|
|
779
|
+
const subscribe = React16.useCallback(
|
|
780
|
+
(onStoreChange) => {
|
|
781
|
+
if (!enabled || typeof window === "undefined" || typeof window.matchMedia !== "function") {
|
|
782
|
+
return () => {
|
|
783
|
+
};
|
|
784
|
+
}
|
|
785
|
+
const mq = window.matchMedia(SIDEBAR_MEDIA_QUERY_NARROW);
|
|
786
|
+
mq.addEventListener("change", onStoreChange);
|
|
787
|
+
return () => mq.removeEventListener("change", onStoreChange);
|
|
788
|
+
},
|
|
789
|
+
[enabled]
|
|
790
|
+
);
|
|
791
|
+
const getSnapshot = React16.useCallback(() => {
|
|
792
|
+
if (!enabled || typeof window === "undefined" || typeof window.matchMedia !== "function") {
|
|
793
|
+
return false;
|
|
794
|
+
}
|
|
795
|
+
return window.matchMedia(SIDEBAR_MEDIA_QUERY_NARROW).matches;
|
|
796
|
+
}, [enabled]);
|
|
797
|
+
const getServerSnapshot = React16.useCallback(() => false, []);
|
|
798
|
+
return React16.useSyncExternalStore(subscribe, getSnapshot, getServerSnapshot);
|
|
799
|
+
}
|
|
800
|
+
|
|
748
801
|
// src/layout/sidebar/SidebarRoot.tsx
|
|
749
802
|
import { jsx as jsx9, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
750
|
-
function
|
|
751
|
-
|
|
752
|
-
if (
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
803
|
+
function computeInitialLayoutState(args) {
|
|
804
|
+
const isNarrow = args.responsive && typeof window !== "undefined" && typeof window.matchMedia === "function" && window.matchMedia(SIDEBAR_MEDIA_QUERY_NARROW).matches;
|
|
805
|
+
if (args.defaultState !== void 0) {
|
|
806
|
+
const normalized = normalizeSidebarMode(args.defaultState);
|
|
807
|
+
if (args.responsive && isNarrow) return "hidden";
|
|
808
|
+
return normalized;
|
|
809
|
+
}
|
|
810
|
+
if (args.modeDefault !== void 0) {
|
|
811
|
+
const normalized = normalizeSidebarMode(args.modeDefault);
|
|
812
|
+
if (args.responsive && isNarrow) return "hidden";
|
|
813
|
+
return normalized;
|
|
814
|
+
}
|
|
815
|
+
if (args.responsive && isNarrow) return "hidden";
|
|
816
|
+
if (args.persistStateKey && typeof window !== "undefined") {
|
|
817
|
+
const stored = readStoredDesktopMode(args.persistStateKey);
|
|
818
|
+
if (stored) return stored;
|
|
819
|
+
}
|
|
820
|
+
return args.defaultOpen ? "expanded" : "hidden";
|
|
758
821
|
}
|
|
759
|
-
var SidebarRoot =
|
|
822
|
+
var SidebarRoot = React17.forwardRef(function SidebarRoot2({
|
|
760
823
|
children,
|
|
761
824
|
className,
|
|
762
825
|
size = "m",
|
|
@@ -771,14 +834,14 @@ var SidebarRoot = React16.forwardRef(function SidebarRoot2({
|
|
|
771
834
|
defaultOpen = true,
|
|
772
835
|
onOpenChange,
|
|
773
836
|
responsive = true,
|
|
837
|
+
persistStateKey,
|
|
774
838
|
sidebarSlot,
|
|
775
839
|
"aria-label": ariaLabel = "Sidebar",
|
|
776
840
|
...rest
|
|
777
841
|
}, ref) {
|
|
778
|
-
const rootRef =
|
|
842
|
+
const rootRef = React17.useRef(null);
|
|
779
843
|
const reducedMotion = useReducedMotion();
|
|
780
|
-
const
|
|
781
|
-
const setRootRef = React16.useCallback(
|
|
844
|
+
const setRootRef = React17.useCallback(
|
|
782
845
|
(node) => {
|
|
783
846
|
rootRef.current = node;
|
|
784
847
|
if (typeof ref === "function") {
|
|
@@ -791,11 +854,24 @@ var SidebarRoot = React16.forwardRef(function SidebarRoot2({
|
|
|
791
854
|
},
|
|
792
855
|
[ref]
|
|
793
856
|
);
|
|
794
|
-
const initialMobile = initialMobileMatch(Boolean(responsive));
|
|
795
857
|
const modeControlled = mode === void 0 ? void 0 : normalizeSidebarMode(mode);
|
|
796
858
|
const modeDefault = defaultMode === void 0 ? void 0 : normalizeSidebarMode(defaultMode);
|
|
797
859
|
const controlledState = state ?? modeControlled ?? (open === void 0 ? void 0 : open ? "expanded" : "hidden");
|
|
798
|
-
const
|
|
860
|
+
const initialLayoutDefaultRef = React17.useRef(null);
|
|
861
|
+
if (initialLayoutDefaultRef.current === null) {
|
|
862
|
+
initialLayoutDefaultRef.current = computeInitialLayoutState({
|
|
863
|
+
responsive: Boolean(responsive),
|
|
864
|
+
defaultOpen: Boolean(defaultOpen),
|
|
865
|
+
persistStateKey,
|
|
866
|
+
defaultState,
|
|
867
|
+
modeDefault
|
|
868
|
+
});
|
|
869
|
+
}
|
|
870
|
+
const resolvedDefaultState = initialLayoutDefaultRef.current;
|
|
871
|
+
const initialLayoutForProgress = controlledState ?? resolvedDefaultState;
|
|
872
|
+
const isMobile = useSidebarNarrowViewport(Boolean(responsive));
|
|
873
|
+
const compactProgressInitial = !isMobile && initialLayoutForProgress === "compact" ? 1 : 0;
|
|
874
|
+
const compactProgress = useMotionValue(compactProgressInitial);
|
|
799
875
|
const [layoutState, setLayoutState] = useControllableState({
|
|
800
876
|
value: controlledState,
|
|
801
877
|
defaultValue: resolvedDefaultState,
|
|
@@ -805,25 +881,8 @@ var SidebarRoot = React16.forwardRef(function SidebarRoot2({
|
|
|
805
881
|
onOpenChange?.(next !== "hidden");
|
|
806
882
|
}
|
|
807
883
|
});
|
|
808
|
-
const
|
|
809
|
-
|
|
810
|
-
React16.useEffect(() => {
|
|
811
|
-
if (!responsive || typeof window === "undefined" || typeof window.matchMedia !== "function") {
|
|
812
|
-
setIsMobile(false);
|
|
813
|
-
previousMobileRef.current = false;
|
|
814
|
-
return;
|
|
815
|
-
}
|
|
816
|
-
const query = window.matchMedia(SIDEBAR_MEDIA_QUERY_NARROW);
|
|
817
|
-
const update = () => setIsMobile(query.matches);
|
|
818
|
-
update();
|
|
819
|
-
if (typeof query.addEventListener === "function") {
|
|
820
|
-
query.addEventListener("change", update);
|
|
821
|
-
return () => query.removeEventListener("change", update);
|
|
822
|
-
}
|
|
823
|
-
query.addListener(update);
|
|
824
|
-
return () => query.removeListener(update);
|
|
825
|
-
}, [responsive]);
|
|
826
|
-
React16.useEffect(() => {
|
|
884
|
+
const previousMobileRef = React17.useRef(isMobile);
|
|
885
|
+
React17.useEffect(() => {
|
|
827
886
|
const wasMobile = previousMobileRef.current;
|
|
828
887
|
if (wasMobile === isMobile || !responsive) return;
|
|
829
888
|
previousMobileRef.current = isMobile;
|
|
@@ -831,23 +890,35 @@ var SidebarRoot = React16.forwardRef(function SidebarRoot2({
|
|
|
831
890
|
setLayoutState("hidden");
|
|
832
891
|
return;
|
|
833
892
|
}
|
|
893
|
+
const stored = persistStateKey ? readStoredDesktopMode(persistStateKey) : null;
|
|
894
|
+
if (stored === "expanded" || stored === "compact") {
|
|
895
|
+
setLayoutState(stored);
|
|
896
|
+
return;
|
|
897
|
+
}
|
|
834
898
|
if (layoutState === "hidden" && defaultOpen) {
|
|
835
899
|
setLayoutState("expanded");
|
|
836
900
|
}
|
|
837
|
-
}, [defaultOpen, isMobile, layoutState, responsive, setLayoutState]);
|
|
838
|
-
|
|
901
|
+
}, [defaultOpen, isMobile, layoutState, persistStateKey, responsive, setLayoutState]);
|
|
902
|
+
React17.useEffect(() => {
|
|
903
|
+
if (!persistStateKey || controlledState !== void 0) return;
|
|
904
|
+
if (isMobile) return;
|
|
905
|
+
if (layoutState === "expanded" || layoutState === "compact") {
|
|
906
|
+
writeStoredDesktopMode(persistStateKey, layoutState);
|
|
907
|
+
}
|
|
908
|
+
}, [controlledState, isMobile, layoutState, persistStateKey]);
|
|
909
|
+
const setState = React17.useCallback(
|
|
839
910
|
(next) => {
|
|
840
911
|
setLayoutState(next);
|
|
841
912
|
},
|
|
842
913
|
[setLayoutState]
|
|
843
914
|
);
|
|
844
|
-
const setOpen =
|
|
915
|
+
const setOpen = React17.useCallback(
|
|
845
916
|
(next) => {
|
|
846
917
|
setLayoutState(next ? "expanded" : "hidden");
|
|
847
918
|
},
|
|
848
919
|
[setLayoutState]
|
|
849
920
|
);
|
|
850
|
-
const toggleOpen =
|
|
921
|
+
const toggleOpen = React17.useCallback(() => {
|
|
851
922
|
setLayoutState((prev) => {
|
|
852
923
|
if (isMobile) {
|
|
853
924
|
return prev === "hidden" ? "expanded" : "hidden";
|
|
@@ -860,14 +931,17 @@ var SidebarRoot = React16.forwardRef(function SidebarRoot2({
|
|
|
860
931
|
const openState = layoutState !== "hidden";
|
|
861
932
|
const mobileOpen = Boolean(responsive) && isMobile && openState;
|
|
862
933
|
const compactProgressTarget = !isMobile && layoutState === "compact" ? 1 : 0;
|
|
863
|
-
|
|
934
|
+
React17.useEffect(() => {
|
|
935
|
+
if (compactProgress.get() === compactProgressTarget) {
|
|
936
|
+
return;
|
|
937
|
+
}
|
|
864
938
|
const controls = animate(compactProgress, compactProgressTarget, {
|
|
865
939
|
duration: reducedMotion ? 0 : 0.24,
|
|
866
940
|
ease: [0.4, 0, 0.2, 1]
|
|
867
941
|
});
|
|
868
942
|
return () => controls.stop();
|
|
869
943
|
}, [compactProgress, compactProgressTarget, reducedMotion]);
|
|
870
|
-
|
|
944
|
+
React17.useLayoutEffect(() => {
|
|
871
945
|
const root = rootRef.current;
|
|
872
946
|
if (root == null) return;
|
|
873
947
|
root.style.setProperty("--sb-progress", compactProgress.get().toString());
|
|
@@ -877,12 +951,12 @@ var SidebarRoot = React16.forwardRef(function SidebarRoot2({
|
|
|
877
951
|
if (root == null) return;
|
|
878
952
|
root.style.setProperty("--sb-progress", value.toString());
|
|
879
953
|
});
|
|
880
|
-
const closeMobile =
|
|
954
|
+
const closeMobile = React17.useCallback(() => {
|
|
881
955
|
setLayoutState("hidden");
|
|
882
956
|
}, [setLayoutState]);
|
|
883
957
|
const navAreaRef = useOverlayModal(mobileOpen, closeMobile);
|
|
884
|
-
const navPanelId =
|
|
885
|
-
const contextValue =
|
|
958
|
+
const navPanelId = React17.useId();
|
|
959
|
+
const contextValue = React17.useMemo(
|
|
886
960
|
() => ({
|
|
887
961
|
size,
|
|
888
962
|
side,
|
|
@@ -945,7 +1019,7 @@ function iconForToggle(state, side) {
|
|
|
945
1019
|
}
|
|
946
1020
|
return state === "hidden" ? /* @__PURE__ */ jsx10(PanelRightOpen, { size: "1em" }) : /* @__PURE__ */ jsx10(PanelRightClose, { size: "1em" });
|
|
947
1021
|
}
|
|
948
|
-
var SidebarToggleButton =
|
|
1022
|
+
var SidebarToggleButton = React18.forwardRef(
|
|
949
1023
|
({
|
|
950
1024
|
className,
|
|
951
1025
|
openLabel = "\u0421\u043A\u0440\u044B\u0442\u044C \u0441\u0430\u0439\u0434\u0431\u0430\u0440",
|
|
@@ -1039,7 +1113,7 @@ function SidebarText({ className, ...rest }) {
|
|
|
1039
1113
|
return /* @__PURE__ */ jsx10("span", { ...rest, className: cx(Sidebar_default.text, className) });
|
|
1040
1114
|
}
|
|
1041
1115
|
SidebarText.displayName = "SidebarText";
|
|
1042
|
-
var SidebarIdentityButton =
|
|
1116
|
+
var SidebarIdentityButton = React18.forwardRef(
|
|
1043
1117
|
({ className, type = "button", leading, title, subtitle, trailing, disabled, onClick, ...rest }, ref) => {
|
|
1044
1118
|
const { size: _size } = useSidebarContext();
|
|
1045
1119
|
void _size;
|
|
@@ -1082,10 +1156,10 @@ function parseLengthToPx(value, baseFontSize) {
|
|
|
1082
1156
|
}
|
|
1083
1157
|
function SidebarHeadingText({ children }) {
|
|
1084
1158
|
const { isMobile } = useSidebarContext();
|
|
1085
|
-
const trackRef =
|
|
1086
|
-
const textRef =
|
|
1087
|
-
const previousOffsetRef =
|
|
1088
|
-
const measureOffset =
|
|
1159
|
+
const trackRef = React18.useRef(null);
|
|
1160
|
+
const textRef = React18.useRef(null);
|
|
1161
|
+
const previousOffsetRef = React18.useRef(0);
|
|
1162
|
+
const measureOffset = React18.useCallback(() => {
|
|
1089
1163
|
const track = trackRef.current;
|
|
1090
1164
|
const text = textRef.current;
|
|
1091
1165
|
if (track == null || text == null) return;
|
|
@@ -1128,10 +1202,10 @@ function SidebarHeadingText({ children }) {
|
|
|
1128
1202
|
const targetCompactOffset = Math.max(0, (compactTrackWidth - compactTextWidth) / 2);
|
|
1129
1203
|
applyOffset(targetCompactOffset * progress);
|
|
1130
1204
|
}, [isMobile]);
|
|
1131
|
-
|
|
1205
|
+
React18.useLayoutEffect(() => {
|
|
1132
1206
|
measureOffset();
|
|
1133
1207
|
}, [measureOffset]);
|
|
1134
|
-
|
|
1208
|
+
React18.useLayoutEffect(() => {
|
|
1135
1209
|
if (typeof window === "undefined") return;
|
|
1136
1210
|
const track = trackRef.current;
|
|
1137
1211
|
const text = textRef.current;
|
|
@@ -1201,7 +1275,7 @@ function SidebarMenuTrailing({ className, ...rest }) {
|
|
|
1201
1275
|
return /* @__PURE__ */ jsx10("span", { ...rest, className: cx(Sidebar_default.menuTrailing, className), "aria-hidden": "true" });
|
|
1202
1276
|
}
|
|
1203
1277
|
SidebarMenuTrailing.displayName = "SidebarMenuTrailing";
|
|
1204
|
-
var SidebarMenuAction =
|
|
1278
|
+
var SidebarMenuAction = React18.forwardRef(
|
|
1205
1279
|
({ className, children, type = "button", ...rest }, ref) => {
|
|
1206
1280
|
return /* @__PURE__ */ jsx10("button", { ...rest, ref, type, className: cx(Sidebar_default.menuAction, className), children });
|
|
1207
1281
|
}
|
|
@@ -1214,7 +1288,7 @@ function extractTextFromNode(node) {
|
|
|
1214
1288
|
if (Array.isArray(node)) {
|
|
1215
1289
|
return node.map((item) => extractTextFromNode(item)).join(" ");
|
|
1216
1290
|
}
|
|
1217
|
-
if (
|
|
1291
|
+
if (React18.isValidElement(node)) {
|
|
1218
1292
|
return extractTextFromNode(node.props.children);
|
|
1219
1293
|
}
|
|
1220
1294
|
return "";
|
|
@@ -1244,7 +1318,7 @@ function SidebarCompactTooltip({
|
|
|
1244
1318
|
/* @__PURE__ */ jsx10(Tooltip.Content, { side: "right", size: "l", children: content })
|
|
1245
1319
|
] }) });
|
|
1246
1320
|
}
|
|
1247
|
-
var SidebarMenuButton =
|
|
1321
|
+
var SidebarMenuButton = React18.forwardRef(
|
|
1248
1322
|
({
|
|
1249
1323
|
className,
|
|
1250
1324
|
active,
|
|
@@ -1291,11 +1365,11 @@ var SidebarMenuButton = React17.forwardRef(
|
|
|
1291
1365
|
}
|
|
1292
1366
|
);
|
|
1293
1367
|
SidebarMenuButton.displayName = "SidebarMenuButton";
|
|
1294
|
-
var SidebarMenuLink =
|
|
1368
|
+
var SidebarMenuLink = React18.forwardRef(
|
|
1295
1369
|
({ active, className, ...rest }, ref) => /* @__PURE__ */ jsx10(SidebarMenuButton, { asChild: true, active, className, children: /* @__PURE__ */ jsx10("a", { ...rest, ref }) })
|
|
1296
1370
|
);
|
|
1297
1371
|
SidebarMenuLink.displayName = "SidebarMenuLink";
|
|
1298
|
-
var SidebarMenuRouterLink =
|
|
1372
|
+
var SidebarMenuRouterLink = React18.forwardRef(
|
|
1299
1373
|
({ className, tooltip, ...rest }, ref) => {
|
|
1300
1374
|
const tooltipContent = resolveMenuTooltipContent(tooltip, rest["aria-label"] ?? rest.children);
|
|
1301
1375
|
if (typeof className === "function") {
|
|
@@ -1339,7 +1413,7 @@ function SidebarNavCategory({ className, ...rest }) {
|
|
|
1339
1413
|
return /* @__PURE__ */ jsx10("div", { ...rest, className: cx(Sidebar_default.navCategory, className) });
|
|
1340
1414
|
}
|
|
1341
1415
|
SidebarNavCategory.displayName = "SidebarNavCategory";
|
|
1342
|
-
var SidebarNavCategoryTrigger =
|
|
1416
|
+
var SidebarNavCategoryTrigger = React18.forwardRef(({ className, type = "button", children, ...rest }, ref) => /* @__PURE__ */ jsx10("button", { ref, type, className: cx(Sidebar_default.navCategoryTrigger, className), ...rest, children }));
|
|
1343
1417
|
SidebarNavCategoryTrigger.displayName = "SidebarNavCategoryTrigger";
|
|
1344
1418
|
function SidebarNavCategoryLabel({ className, ...rest }) {
|
|
1345
1419
|
return /* @__PURE__ */ jsx10("span", { ...rest, className: cx(Sidebar_default.navCategoryLabel, className) });
|
|
@@ -1353,7 +1427,7 @@ function SidebarNavCategoryPanel({ className, ...rest }) {
|
|
|
1353
1427
|
return /* @__PURE__ */ jsx10("div", { ...rest, className: cx(Sidebar_default.navCategoryPanel, className) });
|
|
1354
1428
|
}
|
|
1355
1429
|
SidebarNavCategoryPanel.displayName = "SidebarNavCategoryPanel";
|
|
1356
|
-
var SidebarMenuSlotButton =
|
|
1430
|
+
var SidebarMenuSlotButton = React18.forwardRef(
|
|
1357
1431
|
(props, ref) => /* @__PURE__ */ jsx10(SidebarMenuButton, { ...props, ref })
|
|
1358
1432
|
);
|
|
1359
1433
|
SidebarMenuSlotButton.displayName = "SidebarMenuSlotButton";
|
|
@@ -1393,7 +1467,7 @@ var Sidebar = Object.assign(SidebarComposedRoot, {
|
|
|
1393
1467
|
|
|
1394
1468
|
// src/components/accordion/Accordion.tsx
|
|
1395
1469
|
import { ChevronDown } from "lucide-react";
|
|
1396
|
-
import * as
|
|
1470
|
+
import * as React19 from "react";
|
|
1397
1471
|
|
|
1398
1472
|
// src/components/accordion/Accordion.module.css
|
|
1399
1473
|
var Accordion_default = {
|
|
@@ -1439,7 +1513,7 @@ function multipleDefaultValue(defaultValue) {
|
|
|
1439
1513
|
function normalizeValues(values) {
|
|
1440
1514
|
return Array.from(new Set(values.filter((value) => value !== "")));
|
|
1441
1515
|
}
|
|
1442
|
-
var AccordionRoot =
|
|
1516
|
+
var AccordionRoot = React19.forwardRef(function AccordionRoot2({
|
|
1443
1517
|
type = "single",
|
|
1444
1518
|
value,
|
|
1445
1519
|
defaultValue,
|
|
@@ -1451,23 +1525,23 @@ var AccordionRoot = React18.forwardRef(function AccordionRoot2({
|
|
|
1451
1525
|
children,
|
|
1452
1526
|
...rest
|
|
1453
1527
|
}, ref) {
|
|
1454
|
-
const contextValue =
|
|
1528
|
+
const contextValue = React19.useMemo(() => ({ size }), [size]);
|
|
1455
1529
|
const isMultiple = type === "multiple";
|
|
1456
1530
|
const isControlled = value !== void 0;
|
|
1457
|
-
const initialUncontrolledValues =
|
|
1531
|
+
const initialUncontrolledValues = React19.useMemo(() => {
|
|
1458
1532
|
if (isMultiple) return normalizeValues(multipleDefaultValue(defaultValue) ?? []);
|
|
1459
1533
|
const initialSingle = singleDefaultValue(defaultValue);
|
|
1460
1534
|
return initialSingle ? [initialSingle] : [];
|
|
1461
1535
|
}, [defaultValue, isMultiple]);
|
|
1462
|
-
const [uncontrolledValues, setUncontrolledValues] =
|
|
1463
|
-
const controlledValues =
|
|
1536
|
+
const [uncontrolledValues, setUncontrolledValues] = React19.useState(initialUncontrolledValues);
|
|
1537
|
+
const controlledValues = React19.useMemo(() => {
|
|
1464
1538
|
if (!isControlled) return void 0;
|
|
1465
1539
|
if (isMultiple) return normalizeValues(multipleControlledValue(value) ?? []);
|
|
1466
1540
|
const singleValue = singleControlledValue(value);
|
|
1467
1541
|
return singleValue ? [singleValue] : [];
|
|
1468
1542
|
}, [isControlled, isMultiple, value]);
|
|
1469
1543
|
const openValues = controlledValues ?? uncontrolledValues;
|
|
1470
|
-
const updateValues =
|
|
1544
|
+
const updateValues = React19.useCallback(
|
|
1471
1545
|
(nextValues) => {
|
|
1472
1546
|
if (!isControlled) {
|
|
1473
1547
|
setUncontrolledValues(nextValues);
|
|
@@ -1480,7 +1554,7 @@ var AccordionRoot = React18.forwardRef(function AccordionRoot2({
|
|
|
1480
1554
|
},
|
|
1481
1555
|
[isControlled, isMultiple, onValueChange]
|
|
1482
1556
|
);
|
|
1483
|
-
const toggleItem =
|
|
1557
|
+
const toggleItem = React19.useCallback(
|
|
1484
1558
|
(itemValue, disabledItem) => {
|
|
1485
1559
|
if (disabledItem) return;
|
|
1486
1560
|
if (isMultiple) {
|
|
@@ -1501,7 +1575,7 @@ var AccordionRoot = React18.forwardRef(function AccordionRoot2({
|
|
|
1501
1575
|
},
|
|
1502
1576
|
[collapsible, isMultiple, openValues, updateValues]
|
|
1503
1577
|
);
|
|
1504
|
-
const stateContextValue =
|
|
1578
|
+
const stateContextValue = React19.useMemo(
|
|
1505
1579
|
() => ({
|
|
1506
1580
|
type,
|
|
1507
1581
|
collapsible,
|
|
@@ -1524,13 +1598,13 @@ var AccordionRoot = React18.forwardRef(function AccordionRoot2({
|
|
|
1524
1598
|
) }) });
|
|
1525
1599
|
});
|
|
1526
1600
|
AccordionRoot.displayName = "Accordion.Root";
|
|
1527
|
-
var AccordionItem =
|
|
1601
|
+
var AccordionItem = React19.forwardRef(function AccordionItem2({ className, value, disabled = false, children, ...rest }, ref) {
|
|
1528
1602
|
const state = useAccordionState();
|
|
1529
1603
|
const open = state.openValues.includes(value);
|
|
1530
|
-
const reactId =
|
|
1604
|
+
const reactId = React19.useId();
|
|
1531
1605
|
const triggerId = `prime-accordion-trigger-${reactId}`;
|
|
1532
1606
|
const contentId = `prime-accordion-content-${reactId}`;
|
|
1533
|
-
const itemContextValue =
|
|
1607
|
+
const itemContextValue = React19.useMemo(
|
|
1534
1608
|
() => ({
|
|
1535
1609
|
value,
|
|
1536
1610
|
disabled,
|
|
@@ -1553,13 +1627,13 @@ var AccordionItem = React18.forwardRef(function AccordionItem2({ className, valu
|
|
|
1553
1627
|
) });
|
|
1554
1628
|
});
|
|
1555
1629
|
AccordionItem.displayName = "Accordion.Item";
|
|
1556
|
-
var AccordionHeader =
|
|
1630
|
+
var AccordionHeader = React19.forwardRef(
|
|
1557
1631
|
function AccordionHeader2({ className, ...rest }, ref) {
|
|
1558
1632
|
return /* @__PURE__ */ jsx11("h3", { ref, className: cx(Accordion_default.header, className), ...rest });
|
|
1559
1633
|
}
|
|
1560
1634
|
);
|
|
1561
1635
|
AccordionHeader.displayName = "Accordion.Header";
|
|
1562
|
-
var AccordionTrigger =
|
|
1636
|
+
var AccordionTrigger = React19.forwardRef(
|
|
1563
1637
|
function AccordionTrigger2({ className, children, ...rest }, ref) {
|
|
1564
1638
|
const { size } = useAccordionContext();
|
|
1565
1639
|
const state = useAccordionState();
|
|
@@ -1589,13 +1663,13 @@ var AccordionTrigger = React18.forwardRef(
|
|
|
1589
1663
|
}
|
|
1590
1664
|
);
|
|
1591
1665
|
AccordionTrigger.displayName = "Accordion.Trigger";
|
|
1592
|
-
var AccordionContent =
|
|
1666
|
+
var AccordionContent = React19.forwardRef(
|
|
1593
1667
|
function AccordionContent2({ className, children, style, ...rest }, ref) {
|
|
1594
1668
|
const { size } = useAccordionContext();
|
|
1595
1669
|
const item = useAccordionItem();
|
|
1596
|
-
const innerRef =
|
|
1597
|
-
const [contentHeight, setContentHeight] =
|
|
1598
|
-
|
|
1670
|
+
const innerRef = React19.useRef(null);
|
|
1671
|
+
const [contentHeight, setContentHeight] = React19.useState(0);
|
|
1672
|
+
React19.useLayoutEffect(() => {
|
|
1599
1673
|
if (!innerRef.current) return;
|
|
1600
1674
|
const target = innerRef.current;
|
|
1601
1675
|
setContentHeight(target.scrollHeight);
|
|
@@ -1606,7 +1680,7 @@ var AccordionContent = React18.forwardRef(
|
|
|
1606
1680
|
observer.observe(target);
|
|
1607
1681
|
return () => observer.disconnect();
|
|
1608
1682
|
}, []);
|
|
1609
|
-
const combinedStyle =
|
|
1683
|
+
const combinedStyle = React19.useMemo(
|
|
1610
1684
|
() => ({
|
|
1611
1685
|
...style,
|
|
1612
1686
|
"--prime-accordion-content-height": `${contentHeight}px`
|
|
@@ -1695,7 +1769,7 @@ var Accordion = {
|
|
|
1695
1769
|
};
|
|
1696
1770
|
|
|
1697
1771
|
// src/components/avatar/Avatar.tsx
|
|
1698
|
-
import * as
|
|
1772
|
+
import * as React20 from "react";
|
|
1699
1773
|
|
|
1700
1774
|
// src/components/avatar/Avatar.module.css
|
|
1701
1775
|
var Avatar_default = {
|
|
@@ -1709,10 +1783,10 @@ var Avatar_default = {
|
|
|
1709
1783
|
// src/components/avatar/Avatar.tsx
|
|
1710
1784
|
import { jsx as jsx12 } from "react/jsx-runtime";
|
|
1711
1785
|
var [AvatarProvider, useAvatarContext] = createComponentContext("Avatar");
|
|
1712
|
-
var AvatarRoot =
|
|
1786
|
+
var AvatarRoot = React20.forwardRef(
|
|
1713
1787
|
({ size = "m", className, children, ...rest }, ref) => {
|
|
1714
|
-
const [imageStatus, setImageStatus] =
|
|
1715
|
-
const value =
|
|
1788
|
+
const [imageStatus, setImageStatus] = React20.useState("idle");
|
|
1789
|
+
const value = React20.useMemo(
|
|
1716
1790
|
() => ({
|
|
1717
1791
|
size,
|
|
1718
1792
|
imageStatus,
|
|
@@ -1733,16 +1807,16 @@ var AvatarRoot = React19.forwardRef(
|
|
|
1733
1807
|
}
|
|
1734
1808
|
);
|
|
1735
1809
|
AvatarRoot.displayName = "AvatarRoot";
|
|
1736
|
-
var AvatarImageInner =
|
|
1810
|
+
var AvatarImageInner = React20.forwardRef(
|
|
1737
1811
|
({ setImageStatus, src, alt = "", className, onLoad, onError, ...rest }, ref) => {
|
|
1738
|
-
const [status, setStatus] =
|
|
1739
|
-
|
|
1812
|
+
const [status, setStatus] = React20.useState("loading");
|
|
1813
|
+
React20.useLayoutEffect(() => {
|
|
1740
1814
|
setImageStatus("loading");
|
|
1741
1815
|
return () => {
|
|
1742
1816
|
setImageStatus("idle");
|
|
1743
1817
|
};
|
|
1744
1818
|
}, [setImageStatus]);
|
|
1745
|
-
const handleLoad =
|
|
1819
|
+
const handleLoad = React20.useCallback(
|
|
1746
1820
|
(event) => {
|
|
1747
1821
|
setStatus("loaded");
|
|
1748
1822
|
setImageStatus("loaded");
|
|
@@ -1750,7 +1824,7 @@ var AvatarImageInner = React19.forwardRef(
|
|
|
1750
1824
|
},
|
|
1751
1825
|
[onLoad, setImageStatus]
|
|
1752
1826
|
);
|
|
1753
|
-
const handleError =
|
|
1827
|
+
const handleError = React20.useCallback(
|
|
1754
1828
|
(event) => {
|
|
1755
1829
|
setStatus("error");
|
|
1756
1830
|
setImageStatus("error");
|
|
@@ -1774,7 +1848,7 @@ var AvatarImageInner = React19.forwardRef(
|
|
|
1774
1848
|
}
|
|
1775
1849
|
);
|
|
1776
1850
|
AvatarImageInner.displayName = "AvatarImageInner";
|
|
1777
|
-
var AvatarImage =
|
|
1851
|
+
var AvatarImage = React20.forwardRef((props, ref) => {
|
|
1778
1852
|
const { setImageStatus } = useAvatarContext();
|
|
1779
1853
|
return /* @__PURE__ */ jsx12(AvatarImageInner, { ref, setImageStatus, ...props }, props.src);
|
|
1780
1854
|
});
|
|
@@ -1803,7 +1877,7 @@ function getComponentDisplayName(type) {
|
|
|
1803
1877
|
function isAvatarRootElement(child) {
|
|
1804
1878
|
return child.type === AvatarRoot || getComponentDisplayName(child.type) === AVATAR_ROOT_DISPLAY;
|
|
1805
1879
|
}
|
|
1806
|
-
var AvatarGroupOverflow =
|
|
1880
|
+
var AvatarGroupOverflow = React20.forwardRef(
|
|
1807
1881
|
({ size = "m", className, children, ...rest }, ref) => /* @__PURE__ */ jsx12(
|
|
1808
1882
|
"div",
|
|
1809
1883
|
{
|
|
@@ -1820,12 +1894,12 @@ function isAvatarGroupOverflowElement(child) {
|
|
|
1820
1894
|
return child.type === AvatarGroupOverflow || getComponentDisplayName(child.type) === AVATAR_GROUP_OVERFLOW_DISPLAY;
|
|
1821
1895
|
}
|
|
1822
1896
|
function injectAvatarGroupSize(children, size) {
|
|
1823
|
-
return
|
|
1824
|
-
if (!
|
|
1897
|
+
return React20.Children.map(children, (child) => {
|
|
1898
|
+
if (!React20.isValidElement(child)) {
|
|
1825
1899
|
return child;
|
|
1826
1900
|
}
|
|
1827
|
-
if (child.type ===
|
|
1828
|
-
return
|
|
1901
|
+
if (child.type === React20.Fragment) {
|
|
1902
|
+
return React20.cloneElement(
|
|
1829
1903
|
child,
|
|
1830
1904
|
{},
|
|
1831
1905
|
injectAvatarGroupSize(child.props.children, size)
|
|
@@ -1836,19 +1910,19 @@ function injectAvatarGroupSize(children, size) {
|
|
|
1836
1910
|
if (props.size !== void 0) {
|
|
1837
1911
|
return child;
|
|
1838
1912
|
}
|
|
1839
|
-
return
|
|
1913
|
+
return React20.cloneElement(child, { size });
|
|
1840
1914
|
}
|
|
1841
1915
|
if (isAvatarGroupOverflowElement(child)) {
|
|
1842
1916
|
const props = child.props;
|
|
1843
1917
|
if (props.size !== void 0) {
|
|
1844
1918
|
return child;
|
|
1845
1919
|
}
|
|
1846
|
-
return
|
|
1920
|
+
return React20.cloneElement(child, { size });
|
|
1847
1921
|
}
|
|
1848
1922
|
return child;
|
|
1849
1923
|
});
|
|
1850
1924
|
}
|
|
1851
|
-
var AvatarGroupRoot =
|
|
1925
|
+
var AvatarGroupRoot = React20.forwardRef(
|
|
1852
1926
|
({ size = "m", className, children, ...rest }, ref) => /* @__PURE__ */ jsx12(
|
|
1853
1927
|
"div",
|
|
1854
1928
|
{
|
|
@@ -1872,7 +1946,7 @@ var Avatar = {
|
|
|
1872
1946
|
};
|
|
1873
1947
|
|
|
1874
1948
|
// src/components/badge/Badge.tsx
|
|
1875
|
-
import * as
|
|
1949
|
+
import * as React21 from "react";
|
|
1876
1950
|
|
|
1877
1951
|
// src/components/badge/Badge.module.css
|
|
1878
1952
|
var Badge_default = {
|
|
@@ -1884,7 +1958,7 @@ var Badge_default = {
|
|
|
1884
1958
|
|
|
1885
1959
|
// src/components/badge/Badge.tsx
|
|
1886
1960
|
import { jsx as jsx13, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
1887
|
-
var BadgeRoot =
|
|
1961
|
+
var BadgeRoot = React21.forwardRef(
|
|
1888
1962
|
({
|
|
1889
1963
|
color = "gray",
|
|
1890
1964
|
variant = "light",
|
|
@@ -1944,10 +2018,10 @@ var Badge = { Root: BadgeRoot, Icon: BadgeIcon, Dot: BadgeDot };
|
|
|
1944
2018
|
|
|
1945
2019
|
// src/components/banner/Banner.tsx
|
|
1946
2020
|
import { X } from "lucide-react";
|
|
1947
|
-
import * as
|
|
2021
|
+
import * as React23 from "react";
|
|
1948
2022
|
|
|
1949
2023
|
// src/components/button/Button.tsx
|
|
1950
|
-
import * as
|
|
2024
|
+
import * as React22 from "react";
|
|
1951
2025
|
|
|
1952
2026
|
// src/components/button/Button.module.css
|
|
1953
2027
|
var Button_default = {
|
|
@@ -1960,7 +2034,7 @@ var Button_default = {
|
|
|
1960
2034
|
// src/components/button/Button.tsx
|
|
1961
2035
|
import { jsx as jsx14 } from "react/jsx-runtime";
|
|
1962
2036
|
var [ButtonProvider, useButtonContext] = createComponentContext("Button");
|
|
1963
|
-
var ButtonRoot =
|
|
2037
|
+
var ButtonRoot = React22.forwardRef(
|
|
1964
2038
|
({
|
|
1965
2039
|
children,
|
|
1966
2040
|
className,
|
|
@@ -1977,7 +2051,7 @@ var ButtonRoot = React21.forwardRef(
|
|
|
1977
2051
|
...rest
|
|
1978
2052
|
}, ref) => {
|
|
1979
2053
|
const isDisabled = disabled || loading;
|
|
1980
|
-
const contextValue =
|
|
2054
|
+
const contextValue = React22.useMemo(() => ({ loading }), [loading]);
|
|
1981
2055
|
const dataAttrs = toDataAttributes({ variant, mode, size, loading, "full-width": fullWidth });
|
|
1982
2056
|
if (asChild) {
|
|
1983
2057
|
const { onClick: userOnClick, ...restWithoutClick } = rest;
|
|
@@ -2043,11 +2117,11 @@ var Banner_default = {
|
|
|
2043
2117
|
// src/components/banner/Banner.tsx
|
|
2044
2118
|
import { jsx as jsx15, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
2045
2119
|
function childHasCloseButton(children) {
|
|
2046
|
-
return
|
|
2047
|
-
(c) =>
|
|
2120
|
+
return React23.Children.toArray(children).some(
|
|
2121
|
+
(c) => React23.isValidElement(c) && c.type === BannerCloseButton
|
|
2048
2122
|
);
|
|
2049
2123
|
}
|
|
2050
|
-
var BannerRoot =
|
|
2124
|
+
var BannerRoot = React23.forwardRef(function BannerRoot2({
|
|
2051
2125
|
variant = "filled",
|
|
2052
2126
|
status = "information",
|
|
2053
2127
|
size = "m",
|
|
@@ -2098,7 +2172,7 @@ function BannerActions({ className, children, ...rest }) {
|
|
|
2098
2172
|
return /* @__PURE__ */ jsx15("div", { className: cx(Banner_default.actions, className), ...rest, children });
|
|
2099
2173
|
}
|
|
2100
2174
|
BannerActions.displayName = "BannerActions";
|
|
2101
|
-
var BannerCloseButton =
|
|
2175
|
+
var BannerCloseButton = React23.forwardRef(
|
|
2102
2176
|
function BannerCloseButton2({ className, children, type = "button", ...rest }, forwardedRef) {
|
|
2103
2177
|
const controlSize = useOptionalControlSize() ?? "m";
|
|
2104
2178
|
const buttonSize = controlSize === "xs" ? "s" : controlSize;
|
|
@@ -2129,7 +2203,7 @@ var Banner = {
|
|
|
2129
2203
|
};
|
|
2130
2204
|
|
|
2131
2205
|
// src/components/breadcrumb/Breadcrumb.tsx
|
|
2132
|
-
import * as
|
|
2206
|
+
import * as React27 from "react";
|
|
2133
2207
|
|
|
2134
2208
|
// src/icons/index.ts
|
|
2135
2209
|
import {
|
|
@@ -2150,10 +2224,10 @@ import {
|
|
|
2150
2224
|
Sun,
|
|
2151
2225
|
X as X2
|
|
2152
2226
|
} from "lucide-react";
|
|
2153
|
-
import * as
|
|
2227
|
+
import * as React25 from "react";
|
|
2154
2228
|
|
|
2155
2229
|
// src/icons/Icon.tsx
|
|
2156
|
-
import * as
|
|
2230
|
+
import * as React24 from "react";
|
|
2157
2231
|
|
|
2158
2232
|
// src/icons/Icon.module.css
|
|
2159
2233
|
var Icon_default = {
|
|
@@ -2179,10 +2253,10 @@ var SIZE_CLASS = {
|
|
|
2179
2253
|
xl: Icon_default.sizeXl
|
|
2180
2254
|
};
|
|
2181
2255
|
function createIcon(IconGlyph) {
|
|
2182
|
-
const WrappedIcon =
|
|
2256
|
+
const WrappedIcon = React24.forwardRef(
|
|
2183
2257
|
({ className, size: sizeProp, tone = "default", strokeWidth = 1.9, style, ...rest }, ref) => {
|
|
2184
2258
|
const controlSize = useOptionalControlSize();
|
|
2185
|
-
const insideDividerContent =
|
|
2259
|
+
const insideDividerContent = React24.useContext(DividerContentContext);
|
|
2186
2260
|
const resolvedSize = sizeProp ?? controlSize ?? "m";
|
|
2187
2261
|
const sizeClass = insideDividerContent ? void 0 : SIZE_CLASS[resolvedSize];
|
|
2188
2262
|
const toneClassName = tone === "default" ? Icon_default.toneDefault : tone === "subtle" ? Icon_default.toneSubtle : tone === "accent" ? Icon_default.toneAccent : Icon_default.toneDanger;
|
|
@@ -2235,14 +2309,14 @@ var iconRegistry = {
|
|
|
2235
2309
|
"theme.dark": IconMoon,
|
|
2236
2310
|
"theme.light": IconSun
|
|
2237
2311
|
};
|
|
2238
|
-
var Icon =
|
|
2312
|
+
var Icon = React25.forwardRef(({ name, ...rest }, ref) => {
|
|
2239
2313
|
const IconGlyph = iconRegistry[name];
|
|
2240
|
-
return
|
|
2314
|
+
return React25.createElement(IconGlyph, { ref, ...rest });
|
|
2241
2315
|
});
|
|
2242
2316
|
Icon.displayName = "Icon";
|
|
2243
2317
|
|
|
2244
2318
|
// src/components/link-button/LinkButton.tsx
|
|
2245
|
-
import * as
|
|
2319
|
+
import * as React26 from "react";
|
|
2246
2320
|
|
|
2247
2321
|
// src/components/link-button/LinkButton.module.css
|
|
2248
2322
|
var LinkButton_default = {
|
|
@@ -2251,7 +2325,7 @@ var LinkButton_default = {
|
|
|
2251
2325
|
|
|
2252
2326
|
// src/components/link-button/LinkButton.tsx
|
|
2253
2327
|
import { jsx as jsx17 } from "react/jsx-runtime";
|
|
2254
|
-
var LinkButtonRoot =
|
|
2328
|
+
var LinkButtonRoot = React26.forwardRef(
|
|
2255
2329
|
({
|
|
2256
2330
|
size = "m",
|
|
2257
2331
|
disabled = false,
|
|
@@ -2315,10 +2389,10 @@ var Breadcrumb_default = {
|
|
|
2315
2389
|
|
|
2316
2390
|
// src/components/breadcrumb/Breadcrumb.tsx
|
|
2317
2391
|
import { jsx as jsx18 } from "react/jsx-runtime";
|
|
2318
|
-
var BreadcrumbSizeContext =
|
|
2392
|
+
var BreadcrumbSizeContext = React27.createContext("m");
|
|
2319
2393
|
BreadcrumbSizeContext.displayName = "BreadcrumbSizeContext";
|
|
2320
2394
|
function useBreadcrumbSize() {
|
|
2321
|
-
return
|
|
2395
|
+
return React27.useContext(BreadcrumbSizeContext);
|
|
2322
2396
|
}
|
|
2323
2397
|
function BreadcrumbRoot({ children, className, size = "m", ...rest }) {
|
|
2324
2398
|
return /* @__PURE__ */ jsx18(BreadcrumbSizeContext.Provider, { value: size, children: /* @__PURE__ */ jsx18(ControlSizeProvider, { value: size, children: /* @__PURE__ */ jsx18(
|
|
@@ -2377,7 +2451,7 @@ var Breadcrumb = {
|
|
|
2377
2451
|
};
|
|
2378
2452
|
|
|
2379
2453
|
// src/components/button-group/ButtonGroup.tsx
|
|
2380
|
-
import * as
|
|
2454
|
+
import * as React28 from "react";
|
|
2381
2455
|
|
|
2382
2456
|
// src/components/button-group/ButtonGroup.module.css
|
|
2383
2457
|
var ButtonGroup_default = {
|
|
@@ -2389,9 +2463,9 @@ var ButtonGroup_default = {
|
|
|
2389
2463
|
// src/components/button-group/ButtonGroup.tsx
|
|
2390
2464
|
import { jsx as jsx19 } from "react/jsx-runtime";
|
|
2391
2465
|
var [ButtonGroupProvider, useButtonGroupContext] = createComponentContext("ButtonGroup");
|
|
2392
|
-
var ButtonGroupRoot =
|
|
2466
|
+
var ButtonGroupRoot = React28.forwardRef(
|
|
2393
2467
|
({ orientation = "horizontal", size = "m", children, className, ...rest }, ref) => {
|
|
2394
|
-
const value =
|
|
2468
|
+
const value = React28.useMemo(() => ({ size }), [size]);
|
|
2395
2469
|
return /* @__PURE__ */ jsx19(ButtonGroupProvider, { value, children: /* @__PURE__ */ jsx19(
|
|
2396
2470
|
"div",
|
|
2397
2471
|
{
|
|
@@ -2406,7 +2480,7 @@ var ButtonGroupRoot = React27.forwardRef(
|
|
|
2406
2480
|
}
|
|
2407
2481
|
);
|
|
2408
2482
|
ButtonGroupRoot.displayName = "ButtonGroupRoot";
|
|
2409
|
-
var ButtonGroupItem =
|
|
2483
|
+
var ButtonGroupItem = React28.forwardRef(
|
|
2410
2484
|
({ className, pressed, type = "button", ...rest }, ref) => {
|
|
2411
2485
|
useButtonGroupContext();
|
|
2412
2486
|
return /* @__PURE__ */ jsx19(
|
|
@@ -2431,7 +2505,7 @@ ButtonGroupIcon.displayName = "ButtonGroupIcon";
|
|
|
2431
2505
|
var ButtonGroup = { Root: ButtonGroupRoot, Item: ButtonGroupItem, Icon: ButtonGroupIcon };
|
|
2432
2506
|
|
|
2433
2507
|
// src/components/card/Card.tsx
|
|
2434
|
-
import * as
|
|
2508
|
+
import * as React29 from "react";
|
|
2435
2509
|
|
|
2436
2510
|
// src/components/card/Card.module.css
|
|
2437
2511
|
var Card_default = {
|
|
@@ -2463,7 +2537,7 @@ var Card_default = {
|
|
|
2463
2537
|
|
|
2464
2538
|
// src/components/card/Card.tsx
|
|
2465
2539
|
import { jsx as jsx20 } from "react/jsx-runtime";
|
|
2466
|
-
var CardRoot =
|
|
2540
|
+
var CardRoot = React29.forwardRef(function CardRoot2({ variant, flat = false, className, children, ...rest }, forwardedRef) {
|
|
2467
2541
|
return /* @__PURE__ */ jsx20(
|
|
2468
2542
|
"div",
|
|
2469
2543
|
{
|
|
@@ -2548,11 +2622,11 @@ function CardListHeader({ className, children, ...rest }) {
|
|
|
2548
2622
|
return /* @__PURE__ */ jsx20("div", { className: cx(Card_default.listHeader, className), ...rest, children });
|
|
2549
2623
|
}
|
|
2550
2624
|
CardListHeader.displayName = "CardListHeader";
|
|
2551
|
-
var CardList =
|
|
2625
|
+
var CardList = React29.forwardRef(function CardList2({ className, children, ...rest }, forwardedRef) {
|
|
2552
2626
|
return /* @__PURE__ */ jsx20("ul", { ref: forwardedRef, className: cx(Card_default.list, className), ...rest, children });
|
|
2553
2627
|
});
|
|
2554
2628
|
CardList.displayName = "CardList";
|
|
2555
|
-
var CardListItem =
|
|
2629
|
+
var CardListItem = React29.forwardRef(function CardListItem2({ className, children, ...rest }, forwardedRef) {
|
|
2556
2630
|
return /* @__PURE__ */ jsx20("li", { ref: forwardedRef, className: cx(Card_default.listItem, className), ...rest, children });
|
|
2557
2631
|
});
|
|
2558
2632
|
CardListItem.displayName = "CardListItem";
|
|
@@ -2604,7 +2678,7 @@ var Card = {
|
|
|
2604
2678
|
};
|
|
2605
2679
|
|
|
2606
2680
|
// src/components/checkbox/Checkbox.tsx
|
|
2607
|
-
import * as
|
|
2681
|
+
import * as React32 from "react";
|
|
2608
2682
|
|
|
2609
2683
|
// src/components/hint/Hint.module.css
|
|
2610
2684
|
var Hint_default = {
|
|
@@ -2631,7 +2705,7 @@ HintIcon.displayName = "HintIcon";
|
|
|
2631
2705
|
var Hint = { Root: HintRoot, Icon: HintIcon };
|
|
2632
2706
|
|
|
2633
2707
|
// src/components/label/Label.tsx
|
|
2634
|
-
import * as
|
|
2708
|
+
import * as React30 from "react";
|
|
2635
2709
|
|
|
2636
2710
|
// src/components/label/Label.module.css
|
|
2637
2711
|
var Label_default = {
|
|
@@ -2643,8 +2717,8 @@ var Label_default = {
|
|
|
2643
2717
|
|
|
2644
2718
|
// src/components/label/Label.tsx
|
|
2645
2719
|
import { jsx as jsx22 } from "react/jsx-runtime";
|
|
2646
|
-
var LabelSizeContext =
|
|
2647
|
-
var LabelRoot =
|
|
2720
|
+
var LabelSizeContext = React30.createContext("m");
|
|
2721
|
+
var LabelRoot = React30.forwardRef(
|
|
2648
2722
|
({ className, disabled, children, size = "m", ...rest }, ref) => {
|
|
2649
2723
|
return (
|
|
2650
2724
|
// biome-ignore lint/a11y/noLabelWithoutControl: field label primitive; association via htmlFor or wrapping control is caller responsibility
|
|
@@ -2664,7 +2738,7 @@ var LabelRoot = React29.forwardRef(
|
|
|
2664
2738
|
);
|
|
2665
2739
|
LabelRoot.displayName = "LabelRoot";
|
|
2666
2740
|
function LabelIcon({ className, children, ...rest }) {
|
|
2667
|
-
const size =
|
|
2741
|
+
const size = React30.useContext(LabelSizeContext);
|
|
2668
2742
|
return /* @__PURE__ */ jsx22("span", { className: cx(Label_default.iconSlot, className), ...rest, children: /* @__PURE__ */ jsx22(ControlSizeProvider, { value: size, children }) });
|
|
2669
2743
|
}
|
|
2670
2744
|
LabelIcon.displayName = "LabelIcon";
|
|
@@ -2679,7 +2753,7 @@ LabelSub.displayName = "LabelSub";
|
|
|
2679
2753
|
var Label = { Root: LabelRoot, Icon: LabelIcon, Asterisk: LabelAsterisk, Sub: LabelSub };
|
|
2680
2754
|
|
|
2681
2755
|
// src/hooks/useMergedRefs.ts
|
|
2682
|
-
import * as
|
|
2756
|
+
import * as React31 from "react";
|
|
2683
2757
|
function assignRef(ref, value) {
|
|
2684
2758
|
if (typeof ref === "function") {
|
|
2685
2759
|
ref(value);
|
|
@@ -2690,7 +2764,7 @@ function assignRef(ref, value) {
|
|
|
2690
2764
|
}
|
|
2691
2765
|
}
|
|
2692
2766
|
function useMergedRefs(...refs) {
|
|
2693
|
-
return
|
|
2767
|
+
return React31.useCallback(
|
|
2694
2768
|
(value) => {
|
|
2695
2769
|
for (const ref of refs) {
|
|
2696
2770
|
assignRef(ref, value);
|
|
@@ -2718,7 +2792,7 @@ var Checkbox_default = {
|
|
|
2718
2792
|
// src/components/checkbox/Checkbox.tsx
|
|
2719
2793
|
import { jsx as jsx23, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
2720
2794
|
var [CheckboxProvider, useCheckboxContext] = createComponentContext("Checkbox");
|
|
2721
|
-
var CheckboxRoot =
|
|
2795
|
+
var CheckboxRoot = React32.forwardRef(
|
|
2722
2796
|
({
|
|
2723
2797
|
id,
|
|
2724
2798
|
variant = "default",
|
|
@@ -2733,33 +2807,33 @@ var CheckboxRoot = React31.forwardRef(
|
|
|
2733
2807
|
children,
|
|
2734
2808
|
...inputRest
|
|
2735
2809
|
}, ref) => {
|
|
2736
|
-
const rawId =
|
|
2810
|
+
const rawId = React32.useId();
|
|
2737
2811
|
const inputId = id ?? rawId;
|
|
2738
2812
|
const hintId = `${inputId}-hint`;
|
|
2739
2813
|
const errorId = `${inputId}-error`;
|
|
2740
|
-
const [hasHint, setHasHint] =
|
|
2741
|
-
const [hasError, setHasError] =
|
|
2814
|
+
const [hasHint, setHasHint] = React32.useState(false);
|
|
2815
|
+
const [hasError, setHasError] = React32.useState(false);
|
|
2742
2816
|
const invalid = variant === "error" || hasError;
|
|
2743
2817
|
const [isChecked, setIsChecked] = useControllableState({
|
|
2744
2818
|
value: checked,
|
|
2745
2819
|
defaultValue: Boolean(defaultChecked),
|
|
2746
2820
|
onChange: void 0
|
|
2747
2821
|
});
|
|
2748
|
-
const internalRef =
|
|
2822
|
+
const internalRef = React32.useRef(null);
|
|
2749
2823
|
const mergedRef = useMergedRefs(internalRef, ref);
|
|
2750
|
-
|
|
2824
|
+
React32.useEffect(() => {
|
|
2751
2825
|
if (internalRef.current) {
|
|
2752
2826
|
internalRef.current.indeterminate = indeterminate;
|
|
2753
2827
|
}
|
|
2754
2828
|
}, [indeterminate]);
|
|
2755
|
-
const handleChange =
|
|
2829
|
+
const handleChange = React32.useCallback(
|
|
2756
2830
|
(e) => {
|
|
2757
2831
|
setIsChecked(e.target.checked);
|
|
2758
2832
|
onChange?.(e);
|
|
2759
2833
|
},
|
|
2760
2834
|
[onChange, setIsChecked]
|
|
2761
2835
|
);
|
|
2762
|
-
const restInputPropsRef =
|
|
2836
|
+
const restInputPropsRef = React32.useRef(inputRest);
|
|
2763
2837
|
restInputPropsRef.current = inputRest;
|
|
2764
2838
|
const parts = [
|
|
2765
2839
|
ariaDescribedBy,
|
|
@@ -2767,12 +2841,12 @@ var CheckboxRoot = React31.forwardRef(
|
|
|
2767
2841
|
hasError ? errorId : void 0
|
|
2768
2842
|
].filter(Boolean);
|
|
2769
2843
|
const describedBy = parts.length > 0 ? parts.join(" ") : void 0;
|
|
2770
|
-
const registerHint =
|
|
2771
|
-
const unregisterHint =
|
|
2772
|
-
const registerError =
|
|
2773
|
-
const unregisterError =
|
|
2844
|
+
const registerHint = React32.useCallback(() => setHasHint(true), []);
|
|
2845
|
+
const unregisterHint = React32.useCallback(() => setHasHint(false), []);
|
|
2846
|
+
const registerError = React32.useCallback(() => setHasError(true), []);
|
|
2847
|
+
const unregisterError = React32.useCallback(() => setHasError(false), []);
|
|
2774
2848
|
const showChecked = isChecked && !indeterminate;
|
|
2775
|
-
const ctxValue =
|
|
2849
|
+
const ctxValue = React32.useMemo(
|
|
2776
2850
|
() => ({
|
|
2777
2851
|
inputId,
|
|
2778
2852
|
hintId,
|
|
@@ -2827,7 +2901,7 @@ var CheckboxRoot = React31.forwardRef(
|
|
|
2827
2901
|
}
|
|
2828
2902
|
);
|
|
2829
2903
|
CheckboxRoot.displayName = "CheckboxRoot";
|
|
2830
|
-
var CheckboxLabel =
|
|
2904
|
+
var CheckboxLabel = React32.forwardRef(function CheckboxLabel2({ children, className, ...rest }, ref) {
|
|
2831
2905
|
const {
|
|
2832
2906
|
inputId,
|
|
2833
2907
|
inputRef,
|
|
@@ -2839,7 +2913,7 @@ var CheckboxLabel = React31.forwardRef(function CheckboxLabel2({ children, class
|
|
|
2839
2913
|
restInputPropsRef,
|
|
2840
2914
|
size
|
|
2841
2915
|
} = useCheckboxContext();
|
|
2842
|
-
const filterId =
|
|
2916
|
+
const filterId = React32.useId();
|
|
2843
2917
|
const svgFilterId = `es-cb-${filterId.replace(/:/g, "")}`;
|
|
2844
2918
|
return /* @__PURE__ */ jsxs7(
|
|
2845
2919
|
Label.Root,
|
|
@@ -2893,7 +2967,7 @@ var CheckboxLabel = React31.forwardRef(function CheckboxLabel2({ children, class
|
|
|
2893
2967
|
CheckboxLabel.displayName = "CheckboxLabel";
|
|
2894
2968
|
function CheckboxHint({ children, className, ...rest }) {
|
|
2895
2969
|
const { hintId, registerHint, unregisterHint, size, disabled } = useCheckboxContext();
|
|
2896
|
-
|
|
2970
|
+
React32.useLayoutEffect(() => {
|
|
2897
2971
|
registerHint();
|
|
2898
2972
|
return () => {
|
|
2899
2973
|
unregisterHint();
|
|
@@ -2914,7 +2988,7 @@ function CheckboxHint({ children, className, ...rest }) {
|
|
|
2914
2988
|
CheckboxHint.displayName = "CheckboxHint";
|
|
2915
2989
|
function CheckboxError({ children, className, ...rest }) {
|
|
2916
2990
|
const { errorId, registerError, unregisterError, size } = useCheckboxContext();
|
|
2917
|
-
|
|
2991
|
+
React32.useLayoutEffect(() => {
|
|
2918
2992
|
registerError();
|
|
2919
2993
|
return () => {
|
|
2920
2994
|
unregisterError();
|
|
@@ -2941,7 +3015,7 @@ var Checkbox = {
|
|
|
2941
3015
|
};
|
|
2942
3016
|
|
|
2943
3017
|
// src/components/code-block/CodeBlock.tsx
|
|
2944
|
-
import * as
|
|
3018
|
+
import * as React33 from "react";
|
|
2945
3019
|
|
|
2946
3020
|
// src/internal/highlightTsxHtml.ts
|
|
2947
3021
|
var KW = new Set(
|
|
@@ -3066,8 +3140,8 @@ var CodeBlock_default = {
|
|
|
3066
3140
|
|
|
3067
3141
|
// src/components/code-block/CodeBlock.tsx
|
|
3068
3142
|
import { jsx as jsx24 } from "react/jsx-runtime";
|
|
3069
|
-
var CodeBlockRoot =
|
|
3070
|
-
const html =
|
|
3143
|
+
var CodeBlockRoot = React33.forwardRef(function CodeBlockRoot2({ code, colorScheme = "light", className, ...rest }, ref) {
|
|
3144
|
+
const html = React33.useMemo(() => highlightTsxHtml(code.trimEnd()), [code]);
|
|
3071
3145
|
return /* @__PURE__ */ jsx24(
|
|
3072
3146
|
"pre",
|
|
3073
3147
|
{
|
|
@@ -3085,7 +3159,7 @@ var CodeBlock = {
|
|
|
3085
3159
|
};
|
|
3086
3160
|
|
|
3087
3161
|
// src/components/color-picker/ColorPicker.tsx
|
|
3088
|
-
import * as
|
|
3162
|
+
import * as React39 from "react";
|
|
3089
3163
|
import {
|
|
3090
3164
|
ColorArea as AriaColorArea,
|
|
3091
3165
|
ColorField as AriaColorField,
|
|
@@ -3103,12 +3177,12 @@ import {
|
|
|
3103
3177
|
} from "react-aria-components";
|
|
3104
3178
|
|
|
3105
3179
|
// src/components/input/Input.tsx
|
|
3106
|
-
import * as
|
|
3180
|
+
import * as React35 from "react";
|
|
3107
3181
|
|
|
3108
3182
|
// src/hooks/useFieldIds.ts
|
|
3109
|
-
import * as
|
|
3183
|
+
import * as React34 from "react";
|
|
3110
3184
|
function useFieldIds(explicitId, options = {}) {
|
|
3111
|
-
const generated =
|
|
3185
|
+
const generated = React34.useId();
|
|
3112
3186
|
const inputId = explicitId ?? generated;
|
|
3113
3187
|
const hintId = `${inputId}-hint`;
|
|
3114
3188
|
const errorId = `${inputId}-error`;
|
|
@@ -3197,7 +3271,7 @@ function InputWrapper({ children, className }) {
|
|
|
3197
3271
|
);
|
|
3198
3272
|
}
|
|
3199
3273
|
InputWrapper.displayName = "Input.Wrapper";
|
|
3200
|
-
var InputField =
|
|
3274
|
+
var InputField = React35.forwardRef(
|
|
3201
3275
|
({ className, "aria-describedby": ariaDescribedBy, ...rest }, ref) => {
|
|
3202
3276
|
const { inputId, hasError, describedBy } = useInputContext();
|
|
3203
3277
|
const resolvedDescribedBy = [ariaDescribedBy, describedBy].filter(Boolean).join(" ") || void 0;
|
|
@@ -3245,10 +3319,10 @@ var Input = {
|
|
|
3245
3319
|
};
|
|
3246
3320
|
|
|
3247
3321
|
// src/components/select/Select.tsx
|
|
3248
|
-
import * as
|
|
3322
|
+
import * as React38 from "react";
|
|
3249
3323
|
|
|
3250
3324
|
// src/hooks/useOutsideClick.ts
|
|
3251
|
-
import * as
|
|
3325
|
+
import * as React36 from "react";
|
|
3252
3326
|
function isPortaledSelectListboxOwnedByContainer(target, container) {
|
|
3253
3327
|
if (!(target instanceof Element) || !container) {
|
|
3254
3328
|
return false;
|
|
@@ -3270,9 +3344,9 @@ function useOutsideClick({
|
|
|
3270
3344
|
onOutsideClick,
|
|
3271
3345
|
shouldSuppressOutsideClick
|
|
3272
3346
|
}) {
|
|
3273
|
-
const suppressRef =
|
|
3347
|
+
const suppressRef = React36.useRef(shouldSuppressOutsideClick);
|
|
3274
3348
|
suppressRef.current = shouldSuppressOutsideClick;
|
|
3275
|
-
|
|
3349
|
+
React36.useEffect(() => {
|
|
3276
3350
|
if (!enabled) {
|
|
3277
3351
|
return;
|
|
3278
3352
|
}
|
|
@@ -3298,7 +3372,7 @@ function useOutsideClick({
|
|
|
3298
3372
|
}
|
|
3299
3373
|
|
|
3300
3374
|
// src/hooks/usePosition.ts
|
|
3301
|
-
import * as
|
|
3375
|
+
import * as React37 from "react";
|
|
3302
3376
|
|
|
3303
3377
|
// tokens/primitives.ts
|
|
3304
3378
|
var primitiveTokens = {
|
|
@@ -3753,8 +3827,8 @@ function usePosition(anchorRef, contentRef, options = {}) {
|
|
|
3753
3827
|
flip = true,
|
|
3754
3828
|
matchTriggerMinWidth = true
|
|
3755
3829
|
} = options;
|
|
3756
|
-
const [resolvedSide, setResolvedSide] =
|
|
3757
|
-
const applyPositionStyle =
|
|
3830
|
+
const [resolvedSide, setResolvedSide] = React37.useState(preferredSide);
|
|
3831
|
+
const applyPositionStyle = React37.useCallback(
|
|
3758
3832
|
(pos) => {
|
|
3759
3833
|
const content = contentRef.current;
|
|
3760
3834
|
if (!content) return;
|
|
@@ -3766,7 +3840,7 @@ function usePosition(anchorRef, contentRef, options = {}) {
|
|
|
3766
3840
|
},
|
|
3767
3841
|
[contentRef]
|
|
3768
3842
|
);
|
|
3769
|
-
const update =
|
|
3843
|
+
const update = React37.useCallback(() => {
|
|
3770
3844
|
const anchor = anchorRef.current;
|
|
3771
3845
|
const content = contentRef.current;
|
|
3772
3846
|
if (!anchor) return void 0;
|
|
@@ -3903,7 +3977,7 @@ function SelectComboboxRoot({
|
|
|
3903
3977
|
hasError = false,
|
|
3904
3978
|
children
|
|
3905
3979
|
}) {
|
|
3906
|
-
const handleChange =
|
|
3980
|
+
const handleChange = React38.useCallback(
|
|
3907
3981
|
(v) => {
|
|
3908
3982
|
if (v !== void 0) onChange?.(v);
|
|
3909
3983
|
},
|
|
@@ -3914,21 +3988,21 @@ function SelectComboboxRoot({
|
|
|
3914
3988
|
defaultValue,
|
|
3915
3989
|
onChange: handleChange
|
|
3916
3990
|
});
|
|
3917
|
-
const [selectedLabelBinding, setSelectedLabelBinding] =
|
|
3918
|
-
const [isOpen, setIsOpen] =
|
|
3919
|
-
const [highlightedValue, setHighlightedValue] =
|
|
3920
|
-
const generatedId =
|
|
3991
|
+
const [selectedLabelBinding, setSelectedLabelBinding] = React38.useState(void 0);
|
|
3992
|
+
const [isOpen, setIsOpen] = React38.useState(false);
|
|
3993
|
+
const [highlightedValue, setHighlightedValue] = React38.useState(void 0);
|
|
3994
|
+
const generatedId = React38.useId();
|
|
3921
3995
|
const triggerId = `${generatedId}-trigger`;
|
|
3922
3996
|
const listboxId = `${generatedId}-listbox`;
|
|
3923
|
-
const triggerRef =
|
|
3924
|
-
const selectedValueRef =
|
|
3997
|
+
const triggerRef = React38.useRef(null);
|
|
3998
|
+
const selectedValueRef = React38.useRef(selectedValue);
|
|
3925
3999
|
selectedValueRef.current = selectedValue;
|
|
3926
|
-
const onInitLabel =
|
|
4000
|
+
const onInitLabel = React38.useCallback((val, label) => {
|
|
3927
4001
|
if (val === selectedValueRef.current) {
|
|
3928
4002
|
setSelectedLabelBinding({ value: val, label });
|
|
3929
4003
|
}
|
|
3930
4004
|
}, []);
|
|
3931
|
-
const onSelect =
|
|
4005
|
+
const onSelect = React38.useCallback(
|
|
3932
4006
|
(val, label) => {
|
|
3933
4007
|
setSelectedValue(val);
|
|
3934
4008
|
setSelectedLabelBinding({ value: val, label });
|
|
@@ -3936,8 +4010,8 @@ function SelectComboboxRoot({
|
|
|
3936
4010
|
},
|
|
3937
4011
|
[setSelectedValue]
|
|
3938
4012
|
);
|
|
3939
|
-
const onClose =
|
|
3940
|
-
const onOpen =
|
|
4013
|
+
const onClose = React38.useCallback(() => setIsOpen(false), []);
|
|
4014
|
+
const onOpen = React38.useCallback(() => setIsOpen(true), []);
|
|
3941
4015
|
return /* @__PURE__ */ jsx26(
|
|
3942
4016
|
SelectProvider,
|
|
3943
4017
|
{
|
|
@@ -3964,10 +4038,10 @@ function SelectComboboxRoot({
|
|
|
3964
4038
|
);
|
|
3965
4039
|
}
|
|
3966
4040
|
SelectComboboxRoot.displayName = "SelectComboboxRoot";
|
|
3967
|
-
var SelectTrigger =
|
|
4041
|
+
var SelectTrigger = React38.forwardRef(
|
|
3968
4042
|
({ className, children, onClick, onKeyDown, ...rest }, forwardedRef) => {
|
|
3969
4043
|
const { isOpen, onOpen, onClose, triggerId, listboxId, disabled, size, hasError, triggerRef } = useSelectContext();
|
|
3970
|
-
const setRefs =
|
|
4044
|
+
const setRefs = React38.useCallback(
|
|
3971
4045
|
(el) => {
|
|
3972
4046
|
triggerRef.current = el;
|
|
3973
4047
|
if (typeof forwardedRef === "function") {
|
|
@@ -4048,19 +4122,19 @@ function SelectContent({ className, children }) {
|
|
|
4048
4122
|
size
|
|
4049
4123
|
} = useSelectContext();
|
|
4050
4124
|
const overlayPortalLayer = useOverlayPortalLayer();
|
|
4051
|
-
const contentRef =
|
|
4125
|
+
const contentRef = React38.useRef(null);
|
|
4052
4126
|
const { resolvedSide, update } = usePosition(triggerRef, contentRef, {
|
|
4053
4127
|
side: "bottom",
|
|
4054
4128
|
align: "start"
|
|
4055
4129
|
});
|
|
4056
|
-
const getItems =
|
|
4057
|
-
|
|
4130
|
+
const getItems = React38.useCallback(() => queryEnabledSelectOptions(contentRef.current), []);
|
|
4131
|
+
React38.useLayoutEffect(() => {
|
|
4058
4132
|
if (!isOpen) return;
|
|
4059
4133
|
update();
|
|
4060
4134
|
const rafId = requestAnimationFrame(() => update());
|
|
4061
4135
|
return () => cancelAnimationFrame(rafId);
|
|
4062
4136
|
}, [isOpen, update]);
|
|
4063
|
-
|
|
4137
|
+
React38.useEffect(() => {
|
|
4064
4138
|
if (!isOpen) {
|
|
4065
4139
|
setHighlightedValue(void 0);
|
|
4066
4140
|
return;
|
|
@@ -4137,8 +4211,8 @@ function selectItemTextFromRest(rest) {
|
|
|
4137
4211
|
function partitionSelectItemChildren(children) {
|
|
4138
4212
|
const icons = [];
|
|
4139
4213
|
const rest = [];
|
|
4140
|
-
|
|
4141
|
-
if (
|
|
4214
|
+
React38.Children.forEach(children, (child) => {
|
|
4215
|
+
if (React38.isValidElement(child) && child.type === SelectItemIcon) {
|
|
4142
4216
|
icons.push(child);
|
|
4143
4217
|
} else if (child != null && child !== false) {
|
|
4144
4218
|
rest.push(child);
|
|
@@ -4146,14 +4220,14 @@ function partitionSelectItemChildren(children) {
|
|
|
4146
4220
|
});
|
|
4147
4221
|
return { icons, rest };
|
|
4148
4222
|
}
|
|
4149
|
-
var SelectItem =
|
|
4223
|
+
var SelectItem = React38.forwardRef(
|
|
4150
4224
|
({ value, label, disabled, className, children }, ref) => {
|
|
4151
4225
|
const { selectedValue, highlightedValue, setHighlightedValue, onSelect, onInitLabel } = useSelectContext();
|
|
4152
4226
|
const { icons, rest } = partitionSelectItemChildren(children);
|
|
4153
4227
|
const isSelected = selectedValue === value;
|
|
4154
4228
|
const isHighlighted = highlightedValue === value;
|
|
4155
4229
|
const resolvedLabel = label ?? selectItemTextFromRest(rest) ?? (typeof children === "string" ? children : void 0) ?? value;
|
|
4156
|
-
|
|
4230
|
+
React38.useEffect(() => {
|
|
4157
4231
|
onInitLabel(value, resolvedLabel);
|
|
4158
4232
|
}, [value, resolvedLabel, onInitLabel, selectedValue]);
|
|
4159
4233
|
const handleClick = () => {
|
|
@@ -4189,7 +4263,7 @@ var SelectItem = React37.forwardRef(
|
|
|
4189
4263
|
}),
|
|
4190
4264
|
children: [
|
|
4191
4265
|
icons.map(
|
|
4192
|
-
(icon, index) =>
|
|
4266
|
+
(icon, index) => React38.cloneElement(icon, {
|
|
4193
4267
|
key: icon.key ?? `prime-select-item-icon-${String(index)}`
|
|
4194
4268
|
})
|
|
4195
4269
|
),
|
|
@@ -4217,7 +4291,7 @@ function extractPlainTextFromNode(node) {
|
|
|
4217
4291
|
if (node == null || typeof node === "boolean") return "";
|
|
4218
4292
|
if (typeof node === "string" || typeof node === "number") return String(node);
|
|
4219
4293
|
if (Array.isArray(node)) return node.map(extractPlainTextFromNode).join("");
|
|
4220
|
-
if (
|
|
4294
|
+
if (React38.isValidElement(node)) {
|
|
4221
4295
|
const p = node.props;
|
|
4222
4296
|
if (p != null && typeof p === "object" && "children" in p) {
|
|
4223
4297
|
return extractPlainTextFromNode(p.children);
|
|
@@ -4236,10 +4310,10 @@ function walkNativeOptions(node) {
|
|
|
4236
4310
|
let firstEnabledValue;
|
|
4237
4311
|
let keyIndex = 0;
|
|
4238
4312
|
const visit = (n) => {
|
|
4239
|
-
|
|
4313
|
+
React38.Children.forEach(n, (child) => {
|
|
4240
4314
|
if (child == null || child === false) return;
|
|
4241
|
-
if (!
|
|
4242
|
-
if (child.type ===
|
|
4315
|
+
if (!React38.isValidElement(child)) return;
|
|
4316
|
+
if (child.type === React38.Fragment) {
|
|
4243
4317
|
visit(child.props.children);
|
|
4244
4318
|
return;
|
|
4245
4319
|
}
|
|
@@ -4258,8 +4332,8 @@ function walkNativeOptions(node) {
|
|
|
4258
4332
|
const ogKey = keyIndex;
|
|
4259
4333
|
let groupLabel = "";
|
|
4260
4334
|
const groupNodes = [];
|
|
4261
|
-
|
|
4262
|
-
if (!
|
|
4335
|
+
React38.Children.forEach(child.props.children, (gc) => {
|
|
4336
|
+
if (!React38.isValidElement(gc)) return;
|
|
4263
4337
|
if (gc.type === SelectGroupLabel) {
|
|
4264
4338
|
groupLabel = extractPlainTextFromNode(
|
|
4265
4339
|
gc.props.children
|
|
@@ -4302,7 +4376,7 @@ function SelectNativeRoot({
|
|
|
4302
4376
|
hasError = false,
|
|
4303
4377
|
children
|
|
4304
4378
|
}) {
|
|
4305
|
-
const handleChange =
|
|
4379
|
+
const handleChange = React38.useCallback(
|
|
4306
4380
|
(v) => {
|
|
4307
4381
|
if (v !== void 0) onChange?.(v);
|
|
4308
4382
|
},
|
|
@@ -4313,13 +4387,13 @@ function SelectNativeRoot({
|
|
|
4313
4387
|
defaultValue,
|
|
4314
4388
|
onChange: handleChange
|
|
4315
4389
|
});
|
|
4316
|
-
const { nodes: optionNodes, firstEnabledValue } =
|
|
4390
|
+
const { nodes: optionNodes, firstEnabledValue } = React38.useMemo(
|
|
4317
4391
|
() => walkNativeOptions(children),
|
|
4318
4392
|
[children]
|
|
4319
4393
|
);
|
|
4320
4394
|
const hasPlaceholder = placeholder != null && placeholder !== "";
|
|
4321
4395
|
const selectValue = selectedValue === void 0 ? hasPlaceholder ? "" : firstEnabledValue ?? "" : selectedValue;
|
|
4322
|
-
const handleNativeChange =
|
|
4396
|
+
const handleNativeChange = React38.useCallback(
|
|
4323
4397
|
(e) => {
|
|
4324
4398
|
const v = e.target.value;
|
|
4325
4399
|
setSelectedValue(v === "" ? void 0 : v);
|
|
@@ -4396,9 +4470,9 @@ var CHANNEL_ARIA = {
|
|
|
4396
4470
|
green: "\u0417\u0435\u043B\u0451\u043D\u044B\u0439, 0\u2013255",
|
|
4397
4471
|
blue: "\u0421\u0438\u043D\u0438\u0439, 0\u2013255"
|
|
4398
4472
|
};
|
|
4399
|
-
var ColorValueFormatContext =
|
|
4473
|
+
var ColorValueFormatContext = React39.createContext(null);
|
|
4400
4474
|
function useColorValueFormat() {
|
|
4401
|
-
const v =
|
|
4475
|
+
const v = React39.useContext(ColorValueFormatContext);
|
|
4402
4476
|
if (!v) {
|
|
4403
4477
|
throw new Error(
|
|
4404
4478
|
"ColorPicker: \u043E\u0431\u0435\u0440\u043D\u0438\u0442\u0435 \u0440\u0430\u0437\u043C\u0435\u0442\u043A\u0443 \u0432 ColorPicker.FormatProvider \u0434\u043B\u044F \u0444\u043E\u0440\u043C\u0430\u0442\u0430 \u0438 \u043F\u043E\u043B\u043E\u0441\u044B \u043A\u0430\u043D\u0430\u043B\u043E\u0432."
|
|
@@ -4407,8 +4481,8 @@ function useColorValueFormat() {
|
|
|
4407
4481
|
return v;
|
|
4408
4482
|
}
|
|
4409
4483
|
function FormatProvider({ children, defaultFormat = "hsl" }) {
|
|
4410
|
-
const [format, setFormat] =
|
|
4411
|
-
const value =
|
|
4484
|
+
const [format, setFormat] = React39.useState(defaultFormat);
|
|
4485
|
+
const value = React39.useMemo(() => ({ format, setFormat }), [format]);
|
|
4412
4486
|
return /* @__PURE__ */ jsx27(ColorValueFormatContext.Provider, { value, children });
|
|
4413
4487
|
}
|
|
4414
4488
|
var FORMAT_SELECT_LABEL = {
|
|
@@ -4417,7 +4491,7 @@ var FORMAT_SELECT_LABEL = {
|
|
|
4417
4491
|
hex: "Hex"
|
|
4418
4492
|
};
|
|
4419
4493
|
function FormatSelect({ className }) {
|
|
4420
|
-
const ctx =
|
|
4494
|
+
const ctx = React39.useContext(ColorValueFormatContext);
|
|
4421
4495
|
if (!ctx) {
|
|
4422
4496
|
return null;
|
|
4423
4497
|
}
|
|
@@ -4471,13 +4545,13 @@ function ChannelField({
|
|
|
4471
4545
|
space,
|
|
4472
4546
|
suffix
|
|
4473
4547
|
}) {
|
|
4474
|
-
const state =
|
|
4475
|
-
const inputRef =
|
|
4476
|
-
const [text, setText] =
|
|
4548
|
+
const state = React39.useContext(ColorPickerStateContext);
|
|
4549
|
+
const inputRef = React39.useRef(null);
|
|
4550
|
+
const [text, setText] = React39.useState(
|
|
4477
4551
|
() => state ? displayChannelValue(state.color, channel, space) : ""
|
|
4478
4552
|
);
|
|
4479
4553
|
const fingerprint = state ? state.color.toString("hexa") : "";
|
|
4480
|
-
|
|
4554
|
+
React39.useEffect(() => {
|
|
4481
4555
|
if (!state) {
|
|
4482
4556
|
return;
|
|
4483
4557
|
}
|
|
@@ -4517,9 +4591,9 @@ function ChannelField({
|
|
|
4517
4591
|
] });
|
|
4518
4592
|
}
|
|
4519
4593
|
function StripHexField() {
|
|
4520
|
-
const state =
|
|
4521
|
-
const inputRef =
|
|
4522
|
-
const [text, setText] =
|
|
4594
|
+
const state = React39.useContext(ColorPickerStateContext);
|
|
4595
|
+
const inputRef = React39.useRef(null);
|
|
4596
|
+
const [text, setText] = React39.useState(() => {
|
|
4523
4597
|
if (!state) {
|
|
4524
4598
|
return "";
|
|
4525
4599
|
}
|
|
@@ -4528,7 +4602,7 @@ function StripHexField() {
|
|
|
4528
4602
|
return c.toString(a < 1 ? "hexa" : "hex");
|
|
4529
4603
|
});
|
|
4530
4604
|
const fingerprint = state ? state.color.toString("hexa") : "";
|
|
4531
|
-
|
|
4605
|
+
React39.useEffect(() => {
|
|
4532
4606
|
if (!state) {
|
|
4533
4607
|
return;
|
|
4534
4608
|
}
|
|
@@ -4713,9 +4787,9 @@ function SliderMeta({ label }) {
|
|
|
4713
4787
|
] });
|
|
4714
4788
|
}
|
|
4715
4789
|
function HexInput({ size = "m", label = "Hex", className }) {
|
|
4716
|
-
const state =
|
|
4717
|
-
const inputRef =
|
|
4718
|
-
const [text, setText] =
|
|
4790
|
+
const state = React39.useContext(ColorPickerStateContext);
|
|
4791
|
+
const inputRef = React39.useRef(null);
|
|
4792
|
+
const [text, setText] = React39.useState(() => {
|
|
4719
4793
|
if (!state) {
|
|
4720
4794
|
return "";
|
|
4721
4795
|
}
|
|
@@ -4724,7 +4798,7 @@ function HexInput({ size = "m", label = "Hex", className }) {
|
|
|
4724
4798
|
return c.toString(a < 1 ? "hexa" : "hex");
|
|
4725
4799
|
});
|
|
4726
4800
|
const colorFingerprint = state ? state.color.toString("hexa") : "";
|
|
4727
|
-
|
|
4801
|
+
React39.useEffect(() => {
|
|
4728
4802
|
if (!state) {
|
|
4729
4803
|
return;
|
|
4730
4804
|
}
|
|
@@ -4767,8 +4841,8 @@ function HexInput({ size = "m", label = "Hex", className }) {
|
|
|
4767
4841
|
}
|
|
4768
4842
|
) }) });
|
|
4769
4843
|
}
|
|
4770
|
-
var EyeDropperButton =
|
|
4771
|
-
const state =
|
|
4844
|
+
var EyeDropperButton = React39.forwardRef(function EyeDropperButton2({ children, onClick, type = "button", "aria-label": ariaLabel, className, ...rest }, forwardedRef) {
|
|
4845
|
+
const state = React39.useContext(ColorPickerStateContext);
|
|
4772
4846
|
const EyeDropperApi = typeof globalThis !== "undefined" ? globalThis.EyeDropper : void 0;
|
|
4773
4847
|
if (!state) {
|
|
4774
4848
|
return null;
|
|
@@ -4814,7 +4888,7 @@ var EyeDropperButton = React38.forwardRef(function EyeDropperButton2({ children,
|
|
|
4814
4888
|
});
|
|
4815
4889
|
EyeDropperButton.displayName = "EyeDropperButton";
|
|
4816
4890
|
function TriggerSwatch({ className }) {
|
|
4817
|
-
const state =
|
|
4891
|
+
const state = React39.useContext(ColorPickerStateContext);
|
|
4818
4892
|
const colorCss = state != null ? state.color.toString("css") : TRIGGER_SWATCH_FALLBACK_FILL;
|
|
4819
4893
|
return /* @__PURE__ */ jsx27("span", { "aria-hidden": true, className: cx(ColorPicker_default.triggerSwatch, className), children: /* @__PURE__ */ jsx27(
|
|
4820
4894
|
"svg",
|
|
@@ -4850,13 +4924,13 @@ var ColorPicker = {
|
|
|
4850
4924
|
};
|
|
4851
4925
|
|
|
4852
4926
|
// src/components/command-menu/CommandMenu.tsx
|
|
4853
|
-
import * as
|
|
4927
|
+
import * as React42 from "react";
|
|
4854
4928
|
|
|
4855
4929
|
// src/components/modal/Modal.tsx
|
|
4856
|
-
import * as
|
|
4930
|
+
import * as React41 from "react";
|
|
4857
4931
|
|
|
4858
4932
|
// src/hooks/useModalKeyboard.ts
|
|
4859
|
-
import * as
|
|
4933
|
+
import * as React40 from "react";
|
|
4860
4934
|
function shouldBlockEnterConfirm(target) {
|
|
4861
4935
|
if (!target || !(target instanceof HTMLElement)) {
|
|
4862
4936
|
return false;
|
|
@@ -4891,7 +4965,7 @@ function useModalKeyboard({
|
|
|
4891
4965
|
primaryRef
|
|
4892
4966
|
}) {
|
|
4893
4967
|
useEscapeKey({ enabled: closeOnEscape && open, onEscape: onClose });
|
|
4894
|
-
|
|
4968
|
+
React40.useEffect(() => {
|
|
4895
4969
|
if (!open || !confirmOnEnter) {
|
|
4896
4970
|
return;
|
|
4897
4971
|
}
|
|
@@ -4957,9 +5031,9 @@ var Modal_default = {
|
|
|
4957
5031
|
import { jsx as jsx28, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
4958
5032
|
var MODAL_SHELL_SIZE = "m";
|
|
4959
5033
|
var [ModalProvider, useModalContext] = createComponentContext("Modal");
|
|
4960
|
-
var ModalContentShellContext =
|
|
5034
|
+
var ModalContentShellContext = React41.createContext(null);
|
|
4961
5035
|
function useModalContentShell() {
|
|
4962
|
-
const value =
|
|
5036
|
+
const value = React41.useContext(ModalContentShellContext);
|
|
4963
5037
|
if (value === null) {
|
|
4964
5038
|
throw new Error(
|
|
4965
5039
|
"[prime-ui-kit] Modal header block must be used inside the dialog panel (internal)."
|
|
@@ -4982,9 +5056,9 @@ function ModalRoot({
|
|
|
4982
5056
|
defaultValue: defaultOpen,
|
|
4983
5057
|
onChange: onOpenChange
|
|
4984
5058
|
});
|
|
4985
|
-
const primaryActionRef =
|
|
4986
|
-
const onOpen =
|
|
4987
|
-
const onClose =
|
|
5059
|
+
const primaryActionRef = React41.useRef(null);
|
|
5060
|
+
const onOpen = React41.useCallback(() => setIsOpen(true), [setIsOpen]);
|
|
5061
|
+
const onClose = React41.useCallback(() => setIsOpen(false), [setIsOpen]);
|
|
4988
5062
|
return /* @__PURE__ */ jsx28(
|
|
4989
5063
|
ModalProvider,
|
|
4990
5064
|
{
|
|
@@ -5004,8 +5078,8 @@ function ModalRoot({
|
|
|
5004
5078
|
}
|
|
5005
5079
|
function ModalTrigger({ children }) {
|
|
5006
5080
|
const { onOpen } = useModalContext();
|
|
5007
|
-
const child =
|
|
5008
|
-
return
|
|
5081
|
+
const child = React41.Children.only(children);
|
|
5082
|
+
return React41.cloneElement(child, {
|
|
5009
5083
|
onClick: (event) => {
|
|
5010
5084
|
child.props.onClick?.(event);
|
|
5011
5085
|
if (!event.defaultPrevented) {
|
|
@@ -5014,12 +5088,12 @@ function ModalTrigger({ children }) {
|
|
|
5014
5088
|
}
|
|
5015
5089
|
});
|
|
5016
5090
|
}
|
|
5017
|
-
var ModalClose =
|
|
5091
|
+
var ModalClose = React41.forwardRef(function ModalClose2({ children }, forwardedRef) {
|
|
5018
5092
|
const { onClose } = useModalContext();
|
|
5019
|
-
const child =
|
|
5093
|
+
const child = React41.Children.only(children);
|
|
5020
5094
|
const childRef = child.ref;
|
|
5021
5095
|
const mergedRef = mergeRefs(childRef, forwardedRef);
|
|
5022
|
-
return
|
|
5096
|
+
return React41.cloneElement(child, {
|
|
5023
5097
|
ref: mergedRef,
|
|
5024
5098
|
onClick: (event) => {
|
|
5025
5099
|
child.props.onClick?.(event);
|
|
@@ -5033,12 +5107,12 @@ function FooterPrimarySlot({
|
|
|
5033
5107
|
children
|
|
5034
5108
|
}) {
|
|
5035
5109
|
const { primaryActionRef } = useModalContext();
|
|
5036
|
-
const child =
|
|
5110
|
+
const child = React41.Children.only(children);
|
|
5037
5111
|
const childRef = child.ref;
|
|
5038
5112
|
const mergedRef = mergeRefs(childRef, (node) => {
|
|
5039
5113
|
primaryActionRef.current = node;
|
|
5040
5114
|
});
|
|
5041
|
-
return
|
|
5115
|
+
return React41.cloneElement(child, { ref: mergedRef });
|
|
5042
5116
|
}
|
|
5043
5117
|
function ModalFooter({ primary, secondary, extra, className, ...rest }) {
|
|
5044
5118
|
return /* @__PURE__ */ jsxs11("footer", { className: cx(Modal_default.footer, className), "data-prime-modal-footer": "", ...rest, children: [
|
|
@@ -5087,15 +5161,15 @@ function ModalContent({
|
|
|
5087
5161
|
...rest
|
|
5088
5162
|
}) {
|
|
5089
5163
|
const { open, onClose, closeOnEscape, confirmOnEnter, onEnterConfirm, primaryActionRef } = useModalContext();
|
|
5090
|
-
const internalTitleId =
|
|
5091
|
-
const internalDescId =
|
|
5164
|
+
const internalTitleId = React41.useId();
|
|
5165
|
+
const internalDescId = React41.useId();
|
|
5092
5166
|
const titleId = ariaLabelledByProp ?? internalTitleId;
|
|
5093
5167
|
const descId = ariaDescribedByProp ?? internalDescId;
|
|
5094
|
-
const [headerState, setHeaderState] =
|
|
5095
|
-
const registerHeader =
|
|
5168
|
+
const [headerState, setHeaderState] = React41.useState(null);
|
|
5169
|
+
const registerHeader = React41.useCallback((state) => {
|
|
5096
5170
|
setHeaderState(state);
|
|
5097
5171
|
}, []);
|
|
5098
|
-
const shellValue =
|
|
5172
|
+
const shellValue = React41.useMemo(
|
|
5099
5173
|
() => ({ titleId, descId, registerHeader }),
|
|
5100
5174
|
[titleId, descId, registerHeader]
|
|
5101
5175
|
);
|
|
@@ -5112,7 +5186,7 @@ function ModalContent({
|
|
|
5112
5186
|
onEnterConfirm,
|
|
5113
5187
|
primaryRef: primaryActionRef
|
|
5114
5188
|
});
|
|
5115
|
-
|
|
5189
|
+
React41.useEffect(() => {
|
|
5116
5190
|
if (!open) return;
|
|
5117
5191
|
const container = trapRef.current;
|
|
5118
5192
|
if (!container) return;
|
|
@@ -5169,7 +5243,7 @@ function ModalHeader({
|
|
|
5169
5243
|
const { onClose } = useModalContext();
|
|
5170
5244
|
const { titleId, descId, registerHeader } = useModalContentShell();
|
|
5171
5245
|
const hasDescription = description != null && description !== "";
|
|
5172
|
-
|
|
5246
|
+
React41.useLayoutEffect(() => {
|
|
5173
5247
|
registerHeader({
|
|
5174
5248
|
hasDescription
|
|
5175
5249
|
});
|
|
@@ -5233,7 +5307,7 @@ function ModalPanel({
|
|
|
5233
5307
|
...rest
|
|
5234
5308
|
}) {
|
|
5235
5309
|
const hasHeader = title != null && title !== "";
|
|
5236
|
-
const footerNode = footer != null ?
|
|
5310
|
+
const footerNode = footer != null ? React41.isValidElement(footer) && footer.type === ModalFooter ? React41.cloneElement(footer, {
|
|
5237
5311
|
className: cx(footer.props.className, footerClassName)
|
|
5238
5312
|
}) : /* @__PURE__ */ jsx28("footer", { className: cx(Modal_default.footer, footerClassName), children: footer }) : null;
|
|
5239
5313
|
return /* @__PURE__ */ jsx28(ModalLayer, { className: overlayClassName, container, children: /* @__PURE__ */ jsxs11(
|
|
@@ -5314,27 +5388,27 @@ function matchesQuery(entry, query) {
|
|
|
5314
5388
|
return hay.includes(q);
|
|
5315
5389
|
}
|
|
5316
5390
|
var [CommandMenuProvider, useCommandMenuContext] = createComponentContext("CommandMenu");
|
|
5317
|
-
var CommandMenuGroupContext =
|
|
5391
|
+
var CommandMenuGroupContext = React42.createContext("");
|
|
5318
5392
|
function CommandMenuRootProvider({ children }) {
|
|
5319
|
-
const listboxId =
|
|
5320
|
-
const inputRef =
|
|
5321
|
-
const itemsRef =
|
|
5322
|
-
const orderSeqRef =
|
|
5323
|
-
const orderMapRef =
|
|
5324
|
-
const [version, bump] =
|
|
5325
|
-
const [search, setSearch] =
|
|
5326
|
-
const [activeId, setActiveId] =
|
|
5327
|
-
|
|
5393
|
+
const listboxId = React42.useId();
|
|
5394
|
+
const inputRef = React42.useRef(null);
|
|
5395
|
+
const itemsRef = React42.useRef(/* @__PURE__ */ new Map());
|
|
5396
|
+
const orderSeqRef = React42.useRef(0);
|
|
5397
|
+
const orderMapRef = React42.useRef(/* @__PURE__ */ new Map());
|
|
5398
|
+
const [version, bump] = React42.useReducer((n) => n + 1, 0);
|
|
5399
|
+
const [search, setSearch] = React42.useState("");
|
|
5400
|
+
const [activeId, setActiveId] = React42.useState(null);
|
|
5401
|
+
React42.useLayoutEffect(() => {
|
|
5328
5402
|
orderSeqRef.current = 0;
|
|
5329
5403
|
orderMapRef.current.clear();
|
|
5330
5404
|
}, []);
|
|
5331
|
-
|
|
5405
|
+
React42.useEffect(() => {
|
|
5332
5406
|
setSearch("");
|
|
5333
5407
|
setActiveId(null);
|
|
5334
5408
|
const id = requestAnimationFrame(() => inputRef.current?.focus());
|
|
5335
5409
|
return () => cancelAnimationFrame(id);
|
|
5336
5410
|
}, []);
|
|
5337
|
-
const registerItem =
|
|
5411
|
+
const registerItem = React42.useCallback(
|
|
5338
5412
|
(id, patch) => {
|
|
5339
5413
|
let order = orderMapRef.current.get(id);
|
|
5340
5414
|
if (order === void 0) {
|
|
@@ -5350,20 +5424,20 @@ function CommandMenuRootProvider({ children }) {
|
|
|
5350
5424
|
},
|
|
5351
5425
|
[]
|
|
5352
5426
|
);
|
|
5353
|
-
const visibleIds =
|
|
5427
|
+
const visibleIds = React42.useMemo(() => {
|
|
5354
5428
|
void version;
|
|
5355
5429
|
const list = [...itemsRef.current.values()].sort((a, b) => a.order - b.order);
|
|
5356
5430
|
return list.filter((e) => matchesQuery(e, search)).filter((e) => !e.disabled).map((e) => e.id);
|
|
5357
5431
|
}, [search, version]);
|
|
5358
|
-
const itemGet =
|
|
5359
|
-
|
|
5432
|
+
const itemGet = React42.useCallback((id) => itemsRef.current.get(id), []);
|
|
5433
|
+
React42.useLayoutEffect(() => {
|
|
5360
5434
|
setActiveId((prev) => {
|
|
5361
5435
|
if (visibleIds.length === 0) return null;
|
|
5362
5436
|
if (prev && visibleIds.includes(prev)) return prev;
|
|
5363
5437
|
return visibleIds[0] ?? null;
|
|
5364
5438
|
});
|
|
5365
5439
|
}, [visibleIds]);
|
|
5366
|
-
const moveActive =
|
|
5440
|
+
const moveActive = React42.useCallback(
|
|
5367
5441
|
(delta) => {
|
|
5368
5442
|
if (visibleIds.length === 0) return;
|
|
5369
5443
|
setActiveId((prev) => {
|
|
@@ -5374,11 +5448,11 @@ function CommandMenuRootProvider({ children }) {
|
|
|
5374
5448
|
},
|
|
5375
5449
|
[visibleIds]
|
|
5376
5450
|
);
|
|
5377
|
-
const activateSelected =
|
|
5451
|
+
const activateSelected = React42.useCallback(() => {
|
|
5378
5452
|
if (!activeId) return;
|
|
5379
5453
|
itemsRef.current.get(activeId)?.onSelectRef.current?.();
|
|
5380
5454
|
}, [activeId]);
|
|
5381
|
-
const value =
|
|
5455
|
+
const value = React42.useMemo(
|
|
5382
5456
|
() => ({
|
|
5383
5457
|
search,
|
|
5384
5458
|
setSearch,
|
|
@@ -5472,7 +5546,7 @@ function CommandMenuInputRow({
|
|
|
5472
5546
|
}
|
|
5473
5547
|
);
|
|
5474
5548
|
}
|
|
5475
|
-
var CommandMenuInput =
|
|
5549
|
+
var CommandMenuInput = React42.forwardRef(
|
|
5476
5550
|
({ className, onKeyDown, value: valueProp, onChange, ...rest }, forwardedRef) => {
|
|
5477
5551
|
const {
|
|
5478
5552
|
search,
|
|
@@ -5486,12 +5560,12 @@ var CommandMenuInput = React41.forwardRef(
|
|
|
5486
5560
|
visibleIds
|
|
5487
5561
|
} = useCommandMenuContext();
|
|
5488
5562
|
const isControlled = valueProp !== void 0;
|
|
5489
|
-
|
|
5563
|
+
React42.useEffect(() => {
|
|
5490
5564
|
if (isControlled) {
|
|
5491
5565
|
setSearch(valueProp !== void 0 && valueProp !== null ? String(valueProp) : "");
|
|
5492
5566
|
}
|
|
5493
5567
|
}, [isControlled, valueProp, setSearch]);
|
|
5494
|
-
const setRefs =
|
|
5568
|
+
const setRefs = React42.useCallback(
|
|
5495
5569
|
(node) => {
|
|
5496
5570
|
inputRef.current = node;
|
|
5497
5571
|
if (typeof forwardedRef === "function") {
|
|
@@ -5559,7 +5633,7 @@ var CommandMenuInput = React41.forwardRef(
|
|
|
5559
5633
|
}
|
|
5560
5634
|
);
|
|
5561
5635
|
CommandMenuInput.displayName = "CommandMenu.Input";
|
|
5562
|
-
var CommandMenuList =
|
|
5636
|
+
var CommandMenuList = React42.forwardRef(
|
|
5563
5637
|
({ className, children, ...rest }, ref) => {
|
|
5564
5638
|
const { listboxId } = useCommandMenuContext();
|
|
5565
5639
|
return /* @__PURE__ */ jsx29(
|
|
@@ -5578,7 +5652,7 @@ var CommandMenuList = React41.forwardRef(
|
|
|
5578
5652
|
);
|
|
5579
5653
|
CommandMenuList.displayName = "CommandMenu.List";
|
|
5580
5654
|
function CommandMenuGroup({ heading, className, children, ...rest }) {
|
|
5581
|
-
const groupId =
|
|
5655
|
+
const groupId = React42.useId();
|
|
5582
5656
|
const { visibleIds, itemGet } = useCommandMenuContext();
|
|
5583
5657
|
const hasVisible = visibleIds.some((id) => itemGet(id)?.groupId === groupId);
|
|
5584
5658
|
return /* @__PURE__ */ jsx29(CommandMenuGroupContext.Provider, { value: groupId, children: /* @__PURE__ */ jsxs12("div", { className: cx(CommandMenu_default.group, className), hidden: hasVisible ? void 0 : true, ...rest, children: [
|
|
@@ -5586,7 +5660,7 @@ function CommandMenuGroup({ heading, className, children, ...rest }) {
|
|
|
5586
5660
|
children
|
|
5587
5661
|
] }) });
|
|
5588
5662
|
}
|
|
5589
|
-
var CommandMenuItem =
|
|
5663
|
+
var CommandMenuItem = React42.forwardRef(
|
|
5590
5664
|
({
|
|
5591
5665
|
className,
|
|
5592
5666
|
value,
|
|
@@ -5598,15 +5672,15 @@ var CommandMenuItem = React41.forwardRef(
|
|
|
5598
5672
|
onPointerMove,
|
|
5599
5673
|
...rest
|
|
5600
5674
|
}, forwardedRef) => {
|
|
5601
|
-
const id =
|
|
5675
|
+
const id = React42.useId();
|
|
5602
5676
|
const optionId = `${id}-option`;
|
|
5603
|
-
const groupId =
|
|
5677
|
+
const groupId = React42.useContext(CommandMenuGroupContext);
|
|
5604
5678
|
const { registerItem, activeId, setActiveId, visibleIds } = useCommandMenuContext();
|
|
5605
|
-
const onSelectRef =
|
|
5606
|
-
|
|
5679
|
+
const onSelectRef = React42.useRef(onSelect);
|
|
5680
|
+
React42.useEffect(() => {
|
|
5607
5681
|
onSelectRef.current = onSelect;
|
|
5608
5682
|
}, [onSelect]);
|
|
5609
|
-
|
|
5683
|
+
React42.useLayoutEffect(() => {
|
|
5610
5684
|
return registerItem(id, {
|
|
5611
5685
|
value,
|
|
5612
5686
|
keywords,
|
|
@@ -5617,8 +5691,8 @@ var CommandMenuItem = React41.forwardRef(
|
|
|
5617
5691
|
}, [id, value, keywords, disabled, groupId, registerItem]);
|
|
5618
5692
|
const filteredIn = visibleIds.includes(id);
|
|
5619
5693
|
const selected = activeId === id;
|
|
5620
|
-
const listRef =
|
|
5621
|
-
const setRefs =
|
|
5694
|
+
const listRef = React42.useRef(null);
|
|
5695
|
+
const setRefs = React42.useCallback(
|
|
5622
5696
|
(node) => {
|
|
5623
5697
|
listRef.current = node;
|
|
5624
5698
|
if (typeof forwardedRef === "function") {
|
|
@@ -5629,7 +5703,7 @@ var CommandMenuItem = React41.forwardRef(
|
|
|
5629
5703
|
},
|
|
5630
5704
|
[forwardedRef]
|
|
5631
5705
|
);
|
|
5632
|
-
|
|
5706
|
+
React42.useEffect(() => {
|
|
5633
5707
|
if (selected && listRef.current) {
|
|
5634
5708
|
listRef.current.scrollIntoView?.({ block: "nearest" });
|
|
5635
5709
|
}
|
|
@@ -5691,7 +5765,7 @@ function CommandMenuTagRow({ className, ...rest }) {
|
|
|
5691
5765
|
function CommandMenuFooter({ className, ...rest }) {
|
|
5692
5766
|
return /* @__PURE__ */ jsx29("div", { className: cx(CommandMenu_default.footer, className), ...rest });
|
|
5693
5767
|
}
|
|
5694
|
-
var CommandMenuFooterKeyBox =
|
|
5768
|
+
var CommandMenuFooterKeyBox = React42.forwardRef(
|
|
5695
5769
|
({ className, children, tone = "default", ...rest }, ref) => {
|
|
5696
5770
|
const variant = tone === "muted" ? "lighter" : "stroke";
|
|
5697
5771
|
return /* @__PURE__ */ jsx29(
|
|
@@ -5728,7 +5802,7 @@ var CommandMenu = {
|
|
|
5728
5802
|
|
|
5729
5803
|
// src/components/data-table/DataTable.tsx
|
|
5730
5804
|
import { ArrowDown, ArrowUp, ArrowUpDown } from "lucide-react";
|
|
5731
|
-
import * as
|
|
5805
|
+
import * as React43 from "react";
|
|
5732
5806
|
|
|
5733
5807
|
// src/internal/runtimeUnits.ts
|
|
5734
5808
|
var CSS_PX_SUFFIX = "px";
|
|
@@ -5944,11 +6018,11 @@ function DataTableRoot({
|
|
|
5944
6018
|
highlightColumnOnHover = false,
|
|
5945
6019
|
striped = false
|
|
5946
6020
|
}) {
|
|
5947
|
-
const [hoveredColumnId, setHoveredColumnId] =
|
|
5948
|
-
const clearHoveredColumn =
|
|
6021
|
+
const [hoveredColumnId, setHoveredColumnId] = React43.useState(null);
|
|
6022
|
+
const clearHoveredColumn = React43.useCallback(() => {
|
|
5949
6023
|
setHoveredColumnId(null);
|
|
5950
6024
|
}, []);
|
|
5951
|
-
const setHoveredColumn =
|
|
6025
|
+
const setHoveredColumn = React43.useCallback(
|
|
5952
6026
|
(columnId) => {
|
|
5953
6027
|
if (highlightColumnOnHover) setHoveredColumnId(columnId);
|
|
5954
6028
|
},
|
|
@@ -5965,19 +6039,19 @@ function DataTableRoot({
|
|
|
5965
6039
|
onChange: onPageChange
|
|
5966
6040
|
});
|
|
5967
6041
|
const initialVisible = Math.max(1, initialVisibleRows ?? pageSize);
|
|
5968
|
-
const [visibleRowCount, setVisibleRowCount] =
|
|
5969
|
-
const scrollRef =
|
|
5970
|
-
const sentinelRef =
|
|
5971
|
-
|
|
6042
|
+
const [visibleRowCount, setVisibleRowCount] = React43.useState(initialVisible);
|
|
6043
|
+
const scrollRef = React43.useRef(null);
|
|
6044
|
+
const sentinelRef = React43.useRef(null);
|
|
6045
|
+
React43.useLayoutEffect(() => {
|
|
5972
6046
|
const viewport = scrollRef.current;
|
|
5973
6047
|
if (!viewport) return;
|
|
5974
6048
|
viewport.style.maxHeight = infiniteScroll ? typeof scrollHeight === "number" ? `${scrollHeight}px` : scrollHeight : "";
|
|
5975
6049
|
}, [infiniteScroll, scrollHeight]);
|
|
5976
|
-
const sortableColumns =
|
|
6050
|
+
const sortableColumns = React43.useMemo(
|
|
5977
6051
|
() => new Set(columns.filter((c) => c.sortable).map((c) => c.id)),
|
|
5978
6052
|
[columns]
|
|
5979
6053
|
);
|
|
5980
|
-
const sortedRows =
|
|
6054
|
+
const sortedRows = React43.useMemo(() => {
|
|
5981
6055
|
if (!sortState || !sortableColumns.has(sortState.columnId)) return rows;
|
|
5982
6056
|
const column = columns.find((item) => item.id === sortState.columnId);
|
|
5983
6057
|
if (!column) return rows;
|
|
@@ -5992,21 +6066,21 @@ function DataTableRoot({
|
|
|
5992
6066
|
const safePageSize = Math.max(1, pageSize);
|
|
5993
6067
|
const totalPages = Math.max(1, Math.ceil(totalRows / safePageSize));
|
|
5994
6068
|
const safePage = clamp(pageState, 1, totalPages);
|
|
5995
|
-
|
|
6069
|
+
React43.useEffect(() => {
|
|
5996
6070
|
if (safePage !== pageState) setPageState(safePage);
|
|
5997
6071
|
}, [pageState, safePage, setPageState]);
|
|
5998
|
-
|
|
6072
|
+
React43.useEffect(() => {
|
|
5999
6073
|
if (infiniteScroll) {
|
|
6000
6074
|
setVisibleRowCount(initialVisible);
|
|
6001
6075
|
return;
|
|
6002
6076
|
}
|
|
6003
6077
|
setPageState(1);
|
|
6004
6078
|
}, [infiniteScroll, initialVisible, setPageState]);
|
|
6005
|
-
|
|
6079
|
+
React43.useEffect(() => {
|
|
6006
6080
|
if (!infiniteScroll) return;
|
|
6007
6081
|
setVisibleRowCount((prev) => clamp(prev, initialVisible, Math.max(initialVisible, totalRows)));
|
|
6008
6082
|
}, [infiniteScroll, initialVisible, totalRows]);
|
|
6009
|
-
const displayedRows =
|
|
6083
|
+
const displayedRows = React43.useMemo(() => {
|
|
6010
6084
|
if (infiniteScroll) {
|
|
6011
6085
|
return sortedRows.slice(0, visibleRowCount);
|
|
6012
6086
|
}
|
|
@@ -6016,7 +6090,7 @@ function DataTableRoot({
|
|
|
6016
6090
|
}, [infiniteScroll, safePage, safePageSize, sortedRows, visibleRowCount]);
|
|
6017
6091
|
const hasInternalMore = infiniteScroll && displayedRows.length < totalRows;
|
|
6018
6092
|
const canRequestMore = infiniteScroll && Boolean(onLoadMore) && hasMore && !loadingMore;
|
|
6019
|
-
const handleReachEnd =
|
|
6093
|
+
const handleReachEnd = React43.useCallback(() => {
|
|
6020
6094
|
if (!infiniteScroll) return;
|
|
6021
6095
|
if (hasInternalMore) {
|
|
6022
6096
|
setVisibleRowCount((prev) => Math.min(prev + Math.max(1, infiniteBatchSize), totalRows));
|
|
@@ -6026,7 +6100,7 @@ function DataTableRoot({
|
|
|
6026
6100
|
void onLoadMore();
|
|
6027
6101
|
}
|
|
6028
6102
|
}, [canRequestMore, hasInternalMore, infiniteBatchSize, infiniteScroll, onLoadMore, totalRows]);
|
|
6029
|
-
|
|
6103
|
+
React43.useEffect(() => {
|
|
6030
6104
|
if (!infiniteScroll) return;
|
|
6031
6105
|
const root = scrollRef.current;
|
|
6032
6106
|
const target = sentinelRef.current;
|
|
@@ -6203,7 +6277,7 @@ var DataTable = {
|
|
|
6203
6277
|
|
|
6204
6278
|
// src/components/datepicker/Datepicker.tsx
|
|
6205
6279
|
import { ChevronDown as ChevronDown2, ChevronLeft as ChevronLeft2, ChevronRight as ChevronRight3 } from "lucide-react";
|
|
6206
|
-
import * as
|
|
6280
|
+
import * as React45 from "react";
|
|
6207
6281
|
import {
|
|
6208
6282
|
DayPicker,
|
|
6209
6283
|
getDefaultClassNames,
|
|
@@ -6211,14 +6285,14 @@ import {
|
|
|
6211
6285
|
} from "react-day-picker";
|
|
6212
6286
|
|
|
6213
6287
|
// src/hooks/useResponsiveMonths.ts
|
|
6214
|
-
import * as
|
|
6288
|
+
import * as React44 from "react";
|
|
6215
6289
|
var DEFAULT_BREAKPOINTS = {
|
|
6216
6290
|
twoColumns: 520
|
|
6217
6291
|
};
|
|
6218
6292
|
function useResponsiveMonths(breakpoints = DEFAULT_BREAKPOINTS, container = null) {
|
|
6219
6293
|
const { twoColumns } = breakpoints;
|
|
6220
|
-
const [count, setCount] =
|
|
6221
|
-
|
|
6294
|
+
const [count, setCount] = React44.useState(1);
|
|
6295
|
+
React44.useEffect(() => {
|
|
6222
6296
|
if (!container) return;
|
|
6223
6297
|
let rafId = null;
|
|
6224
6298
|
const syncByWidth = (width) => {
|
|
@@ -6282,9 +6356,9 @@ var Datepicker_default = {
|
|
|
6282
6356
|
// src/components/datepicker/Datepicker.tsx
|
|
6283
6357
|
import { jsx as jsx32, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
6284
6358
|
var DEFAULT_RESPONSIVE = { twoColumns: 500 };
|
|
6285
|
-
var DatepickerSizeContext =
|
|
6359
|
+
var DatepickerSizeContext = React45.createContext(void 0);
|
|
6286
6360
|
DatepickerSizeContext.displayName = "DatepickerSizeContext";
|
|
6287
|
-
var DatepickerMonthContext =
|
|
6361
|
+
var DatepickerMonthContext = React45.createContext(
|
|
6288
6362
|
void 0
|
|
6289
6363
|
);
|
|
6290
6364
|
DatepickerMonthContext.displayName = "DatepickerMonthContext";
|
|
@@ -6347,7 +6421,7 @@ function DatepickerMonthCaption({
|
|
|
6347
6421
|
displayIndex,
|
|
6348
6422
|
...rest
|
|
6349
6423
|
}) {
|
|
6350
|
-
const inheritedSize =
|
|
6424
|
+
const inheritedSize = React45.useContext(DatepickerSizeContext);
|
|
6351
6425
|
const size = inheritedSize ?? "m";
|
|
6352
6426
|
const { dayPickerProps, goToMonth, previousMonth, nextMonth } = useDayPicker();
|
|
6353
6427
|
const monthsCount = dayPickerProps.numberOfMonths ?? 1;
|
|
@@ -6399,20 +6473,20 @@ function Calendar({
|
|
|
6399
6473
|
size: sizeProp,
|
|
6400
6474
|
...rest
|
|
6401
6475
|
}) {
|
|
6402
|
-
const inheritedSize =
|
|
6403
|
-
const monthContext =
|
|
6476
|
+
const inheritedSize = React45.useContext(DatepickerSizeContext);
|
|
6477
|
+
const monthContext = React45.useContext(DatepickerMonthContext);
|
|
6404
6478
|
const size = sizeProp ?? inheritedSize ?? "m";
|
|
6405
6479
|
const breakpoints = responsiveBreakpoints ?? DEFAULT_RESPONSIVE;
|
|
6406
|
-
const [containerEl, setContainerEl] =
|
|
6407
|
-
const callbackRef =
|
|
6480
|
+
const [containerEl, setContainerEl] = React45.useState(null);
|
|
6481
|
+
const callbackRef = React45.useCallback((node) => {
|
|
6408
6482
|
setContainerEl(node);
|
|
6409
6483
|
}, []);
|
|
6410
6484
|
const responsiveN = useResponsiveMonths(breakpoints, containerEl);
|
|
6411
6485
|
const numberOfMonths = responsiveMonths === true ? responsiveN : numberOfMonthsProp ?? 1;
|
|
6412
|
-
const [localMonth, setLocalMonth] =
|
|
6486
|
+
const [localMonth, setLocalMonth] = React45.useState(() => {
|
|
6413
6487
|
return monthProp ?? monthContext?.requestedMonth;
|
|
6414
6488
|
});
|
|
6415
|
-
|
|
6489
|
+
React45.useEffect(() => {
|
|
6416
6490
|
if (monthProp === void 0 && monthContext?.requestedMonth) {
|
|
6417
6491
|
setLocalMonth(monthContext.requestedMonth);
|
|
6418
6492
|
}
|
|
@@ -6430,7 +6504,7 @@ function Calendar({
|
|
|
6430
6504
|
};
|
|
6431
6505
|
const mergedStyle = style && typeof style === "object" ? { ...style } : {};
|
|
6432
6506
|
const resolvedMonth = monthProp ?? localMonth;
|
|
6433
|
-
const handleMonthChange =
|
|
6507
|
+
const handleMonthChange = React45.useCallback(
|
|
6434
6508
|
(next) => {
|
|
6435
6509
|
if (monthProp === void 0) {
|
|
6436
6510
|
setLocalMonth(next);
|
|
@@ -6463,7 +6537,7 @@ function Calendar({
|
|
|
6463
6537
|
Calendar.displayName = "Datepicker.Calendar";
|
|
6464
6538
|
function Shell({ children, className, presets, size = "m" }) {
|
|
6465
6539
|
const has = presets != null;
|
|
6466
|
-
const [requestedMonth, requestMonth] =
|
|
6540
|
+
const [requestedMonth, requestMonth] = React45.useState();
|
|
6467
6541
|
return /* @__PURE__ */ jsx32(DatepickerSizeContext.Provider, { value: size, children: /* @__PURE__ */ jsx32(DatepickerMonthContext.Provider, { value: { requestedMonth, requestMonth }, children: /* @__PURE__ */ jsxs15(
|
|
6468
6542
|
"div",
|
|
6469
6543
|
{
|
|
@@ -6479,8 +6553,8 @@ function Shell({ children, className, presets, size = "m" }) {
|
|
|
6479
6553
|
}
|
|
6480
6554
|
Shell.displayName = "Datepicker.Shell";
|
|
6481
6555
|
function Presets(props) {
|
|
6482
|
-
const inheritedSize =
|
|
6483
|
-
const monthContext =
|
|
6556
|
+
const inheritedSize = React45.useContext(DatepickerSizeContext);
|
|
6557
|
+
const monthContext = React45.useContext(DatepickerMonthContext);
|
|
6484
6558
|
const { className, size: sizeProp } = props;
|
|
6485
6559
|
const size = sizeProp ?? inheritedSize ?? "m";
|
|
6486
6560
|
return /* @__PURE__ */ jsx32("div", { className: cx(Datepicker_default.presetsBlock, className), "data-size": size, children: /* @__PURE__ */ jsx32(ButtonGroup.Root, { className: Datepicker_default.presetsGroup, size, children: props.mode === "single" ? props.presets.map((p) => /* @__PURE__ */ jsx32(
|
|
@@ -6509,8 +6583,8 @@ function Presets(props) {
|
|
|
6509
6583
|
}
|
|
6510
6584
|
Presets.displayName = "Datepicker.Presets";
|
|
6511
6585
|
function Time(props) {
|
|
6512
|
-
const baseId =
|
|
6513
|
-
const inheritedSize =
|
|
6586
|
+
const baseId = React45.useId();
|
|
6587
|
+
const inheritedSize = React45.useContext(DatepickerSizeContext);
|
|
6514
6588
|
if (props.mode === "range") {
|
|
6515
6589
|
const { from, to, onFromChange, onToChange, labels: labels2, size: sizeProp2 } = props;
|
|
6516
6590
|
const size2 = sizeProp2 ?? inheritedSize ?? "m";
|
|
@@ -6594,7 +6668,7 @@ function Time(props) {
|
|
|
6594
6668
|
}
|
|
6595
6669
|
Time.displayName = "Datepicker.Time";
|
|
6596
6670
|
function Value({ className, size: sizeProp, tone = "muted", ...rest }) {
|
|
6597
|
-
const inheritedSize =
|
|
6671
|
+
const inheritedSize = React45.useContext(DatepickerSizeContext);
|
|
6598
6672
|
const size = sizeProp ?? inheritedSize ?? "m";
|
|
6599
6673
|
return /* @__PURE__ */ jsx32(
|
|
6600
6674
|
Typography.Root,
|
|
@@ -6616,7 +6690,7 @@ var Datepicker = {
|
|
|
6616
6690
|
};
|
|
6617
6691
|
|
|
6618
6692
|
// src/components/digit-input/DigitInput.tsx
|
|
6619
|
-
import * as
|
|
6693
|
+
import * as React46 from "react";
|
|
6620
6694
|
|
|
6621
6695
|
// src/components/digit-input/DigitInput.module.css
|
|
6622
6696
|
var DigitInput_default = {
|
|
@@ -6652,7 +6726,7 @@ function DigitInputRoot({
|
|
|
6652
6726
|
className
|
|
6653
6727
|
}) {
|
|
6654
6728
|
const length = lengthProp;
|
|
6655
|
-
const slotKeysRef =
|
|
6729
|
+
const slotKeysRef = React46.useRef(null);
|
|
6656
6730
|
if (!slotKeysRef.current || slotKeysRef.current.length !== length) {
|
|
6657
6731
|
slotKeysRef.current = createSlotKeys(length);
|
|
6658
6732
|
}
|
|
@@ -6663,11 +6737,11 @@ function DigitInputRoot({
|
|
|
6663
6737
|
defaultValue: defaultNormalized,
|
|
6664
6738
|
onChange
|
|
6665
6739
|
});
|
|
6666
|
-
const prevLenRef =
|
|
6667
|
-
|
|
6740
|
+
const prevLenRef = React46.useRef(0);
|
|
6741
|
+
React46.useEffect(() => {
|
|
6668
6742
|
prevLenRef.current = normalizeDigits(value, length).length;
|
|
6669
6743
|
}, [length, value]);
|
|
6670
|
-
const commit =
|
|
6744
|
+
const commit = React46.useCallback(
|
|
6671
6745
|
(nextRaw) => {
|
|
6672
6746
|
const next = normalizeDigits(nextRaw, length);
|
|
6673
6747
|
const prevLen = prevLenRef.current;
|
|
@@ -6680,11 +6754,11 @@ function DigitInputRoot({
|
|
|
6680
6754
|
[length, onComplete, setValue]
|
|
6681
6755
|
);
|
|
6682
6756
|
const cells = toCells(value, length);
|
|
6683
|
-
const inputRefs =
|
|
6684
|
-
const setInputRef =
|
|
6757
|
+
const inputRefs = React46.useRef([]);
|
|
6758
|
+
const setInputRef = React46.useCallback((el, index) => {
|
|
6685
6759
|
inputRefs.current[index] = el;
|
|
6686
6760
|
}, []);
|
|
6687
|
-
const focusAt =
|
|
6761
|
+
const focusAt = React46.useCallback((index) => {
|
|
6688
6762
|
const el = inputRefs.current[index];
|
|
6689
6763
|
if (el) {
|
|
6690
6764
|
queueMicrotask(() => el.focus());
|
|
@@ -6772,7 +6846,7 @@ DigitInputRoot.displayName = "DigitInputRoot";
|
|
|
6772
6846
|
var DigitInput = { Root: DigitInputRoot };
|
|
6773
6847
|
|
|
6774
6848
|
// src/components/drawer/Drawer.tsx
|
|
6775
|
-
import * as
|
|
6849
|
+
import * as React47 from "react";
|
|
6776
6850
|
|
|
6777
6851
|
// src/components/drawer/Drawer.module.css
|
|
6778
6852
|
var Drawer_default = {
|
|
@@ -6810,9 +6884,9 @@ function Drawer({
|
|
|
6810
6884
|
className,
|
|
6811
6885
|
overlayClassName
|
|
6812
6886
|
}) {
|
|
6813
|
-
const [isMounted, setIsMounted] =
|
|
6814
|
-
const [isClosing, setIsClosing] =
|
|
6815
|
-
|
|
6887
|
+
const [isMounted, setIsMounted] = React47.useState(open);
|
|
6888
|
+
const [isClosing, setIsClosing] = React47.useState(false);
|
|
6889
|
+
React47.useEffect(() => {
|
|
6816
6890
|
if (open) {
|
|
6817
6891
|
setIsMounted(true);
|
|
6818
6892
|
setIsClosing(false);
|
|
@@ -6835,7 +6909,7 @@ function Drawer({
|
|
|
6835
6909
|
const trapRef = useFocusTrap({ enabled: open });
|
|
6836
6910
|
useScrollLock(open);
|
|
6837
6911
|
useEscapeKey({ enabled: open, onEscape: () => onOpenChange(false) });
|
|
6838
|
-
|
|
6912
|
+
React47.useEffect(() => {
|
|
6839
6913
|
if (!open) return;
|
|
6840
6914
|
const container = trapRef.current;
|
|
6841
6915
|
if (!container) return;
|
|
@@ -6864,7 +6938,7 @@ function Drawer({
|
|
|
6864
6938
|
}
|
|
6865
6939
|
};
|
|
6866
6940
|
}, [open, trapRef]);
|
|
6867
|
-
const generatedId =
|
|
6941
|
+
const generatedId = React47.useId();
|
|
6868
6942
|
const titleId = `${generatedId}-title`;
|
|
6869
6943
|
const descriptionId = `${generatedId}-description`;
|
|
6870
6944
|
const hasDescription = description != null && description !== "";
|
|
@@ -6931,7 +7005,7 @@ function Drawer({
|
|
|
6931
7005
|
}
|
|
6932
7006
|
|
|
6933
7007
|
// src/components/dropdown/Dropdown.tsx
|
|
6934
|
-
import * as
|
|
7008
|
+
import * as React49 from "react";
|
|
6935
7009
|
|
|
6936
7010
|
// src/components/dropdown/Dropdown.module.css
|
|
6937
7011
|
var Dropdown_default = {
|
|
@@ -6992,7 +7066,7 @@ function handleMenuNavigationKeyDown(e, container) {
|
|
|
6992
7066
|
}
|
|
6993
7067
|
|
|
6994
7068
|
// src/components/dropdown/useDropdownPosition.ts
|
|
6995
|
-
import * as
|
|
7069
|
+
import * as React48 from "react";
|
|
6996
7070
|
|
|
6997
7071
|
// src/internal/scrollAncestors.ts
|
|
6998
7072
|
var SCROLLABLE = /^(auto|scroll|overlay)$/;
|
|
@@ -7034,8 +7108,8 @@ function useDropdownPosition({
|
|
|
7034
7108
|
align,
|
|
7035
7109
|
sameMinWidthAsTrigger
|
|
7036
7110
|
}) {
|
|
7037
|
-
const [layout, setLayout] =
|
|
7038
|
-
const commit =
|
|
7111
|
+
const [layout, setLayout] = React48.useState(null);
|
|
7112
|
+
const commit = React48.useCallback(() => {
|
|
7039
7113
|
const trigger = triggerRef.current;
|
|
7040
7114
|
const panel = contentRef.current;
|
|
7041
7115
|
if (!trigger || !panel) return;
|
|
@@ -7070,7 +7144,7 @@ function useDropdownPosition({
|
|
|
7070
7144
|
};
|
|
7071
7145
|
setLayout((prev) => prev && layoutEqual(prev, next) ? prev : next);
|
|
7072
7146
|
}, [triggerRef, contentRef, side, align, sameMinWidthAsTrigger]);
|
|
7073
|
-
|
|
7147
|
+
React48.useLayoutEffect(() => {
|
|
7074
7148
|
if (!open) {
|
|
7075
7149
|
setLayout(null);
|
|
7076
7150
|
return;
|
|
@@ -7108,9 +7182,9 @@ function useDropdownPosition({
|
|
|
7108
7182
|
|
|
7109
7183
|
// src/components/dropdown/Dropdown.tsx
|
|
7110
7184
|
import { jsx as jsx35 } from "react/jsx-runtime";
|
|
7111
|
-
var DropdownContentSizeContext =
|
|
7185
|
+
var DropdownContentSizeContext = React49.createContext("m");
|
|
7112
7186
|
function useDropdownContentSize() {
|
|
7113
|
-
return
|
|
7187
|
+
return React49.useContext(DropdownContentSizeContext);
|
|
7114
7188
|
}
|
|
7115
7189
|
function dropdownItemIconPx(menuSize) {
|
|
7116
7190
|
return remToPx(primitiveTokens.icon[menuSize]);
|
|
@@ -7122,13 +7196,13 @@ function DropdownRoot({ open, defaultOpen = false, onOpenChange, children }) {
|
|
|
7122
7196
|
defaultValue: defaultOpen,
|
|
7123
7197
|
onChange: onOpenChange
|
|
7124
7198
|
});
|
|
7125
|
-
const id =
|
|
7199
|
+
const id = React49.useId();
|
|
7126
7200
|
const triggerId = `${id}-trigger`;
|
|
7127
7201
|
const menuId = `${id}-menu`;
|
|
7128
|
-
const triggerRef =
|
|
7129
|
-
const onClose =
|
|
7130
|
-
const onToggle =
|
|
7131
|
-
const value =
|
|
7202
|
+
const triggerRef = React49.useRef(null);
|
|
7203
|
+
const onClose = React49.useCallback(() => setIsOpen(false), [setIsOpen]);
|
|
7204
|
+
const onToggle = React49.useCallback(() => setIsOpen((v) => !v), [setIsOpen]);
|
|
7205
|
+
const value = React49.useMemo(
|
|
7132
7206
|
() => ({ isOpen, onClose, onToggle, triggerId, menuId, triggerRef }),
|
|
7133
7207
|
[isOpen, onClose, onToggle, triggerId, menuId]
|
|
7134
7208
|
);
|
|
@@ -7138,9 +7212,9 @@ DropdownRoot.displayName = "DropdownRoot";
|
|
|
7138
7212
|
function DropdownTrigger({ children, asChild: _asChild = true }) {
|
|
7139
7213
|
void _asChild;
|
|
7140
7214
|
const { isOpen, onToggle, triggerId, menuId, triggerRef } = useDropdownContext();
|
|
7141
|
-
const toggleRef =
|
|
7215
|
+
const toggleRef = React49.useRef(onToggle);
|
|
7142
7216
|
toggleRef.current = onToggle;
|
|
7143
|
-
const setNode =
|
|
7217
|
+
const setNode = React49.useCallback(
|
|
7144
7218
|
(el) => {
|
|
7145
7219
|
triggerRef.current = el;
|
|
7146
7220
|
},
|
|
@@ -7148,9 +7222,9 @@ function DropdownTrigger({ children, asChild: _asChild = true }) {
|
|
|
7148
7222
|
);
|
|
7149
7223
|
const child = children;
|
|
7150
7224
|
const childRef = child.props.ref ?? child.ref;
|
|
7151
|
-
const mergedRef =
|
|
7225
|
+
const mergedRef = React49.useMemo(() => mergeRefs(childRef, setNode), [childRef, setNode]);
|
|
7152
7226
|
const userClick = child.props?.onClick;
|
|
7153
|
-
return
|
|
7227
|
+
return React49.cloneElement(child, {
|
|
7154
7228
|
ref: mergedRef,
|
|
7155
7229
|
id: triggerId,
|
|
7156
7230
|
"aria-expanded": isOpen,
|
|
@@ -7173,7 +7247,7 @@ function DropdownContent({
|
|
|
7173
7247
|
}) {
|
|
7174
7248
|
const { isOpen, onClose, triggerRef, menuId, triggerId } = useDropdownContext();
|
|
7175
7249
|
const overlayPortalLayer = useOverlayPortalLayer();
|
|
7176
|
-
const contentRef =
|
|
7250
|
+
const contentRef = React49.useRef(null);
|
|
7177
7251
|
const layout = useDropdownPosition({
|
|
7178
7252
|
open: isOpen,
|
|
7179
7253
|
triggerRef,
|
|
@@ -7183,7 +7257,7 @@ function DropdownContent({
|
|
|
7183
7257
|
sameMinWidthAsTrigger
|
|
7184
7258
|
});
|
|
7185
7259
|
const trapRef = useFocusTrap({ enabled: isOpen, restoreFocus: true });
|
|
7186
|
-
const ref =
|
|
7260
|
+
const ref = React49.useMemo(() => mergeRefs(contentRef, trapRef), [trapRef]);
|
|
7187
7261
|
useEscapeKey({ enabled: isOpen, onEscape: onClose });
|
|
7188
7262
|
useOutsideClick({
|
|
7189
7263
|
refs: [triggerRef, contentRef],
|
|
@@ -7240,7 +7314,7 @@ function DropdownItem({ onSelect, disabled, destructive, children, className })
|
|
|
7240
7314
|
);
|
|
7241
7315
|
}
|
|
7242
7316
|
DropdownItem.displayName = "DropdownItem";
|
|
7243
|
-
var DropdownItemIcon =
|
|
7317
|
+
var DropdownItemIcon = React49.forwardRef(
|
|
7244
7318
|
({ as: As = "span", className, children, "aria-hidden": ariaHidden, ...rest }, ref) => {
|
|
7245
7319
|
const menuSize = useDropdownContentSize();
|
|
7246
7320
|
const { size: explicitSize, ...iconRest } = rest;
|
|
@@ -7349,7 +7423,7 @@ var Dropdown = {
|
|
|
7349
7423
|
};
|
|
7350
7424
|
|
|
7351
7425
|
// src/components/empty-page/EmptyPage.tsx
|
|
7352
|
-
import * as
|
|
7426
|
+
import * as React50 from "react";
|
|
7353
7427
|
|
|
7354
7428
|
// src/components/empty-page/EmptyPage.module.css
|
|
7355
7429
|
var EmptyPage_default = {
|
|
@@ -7362,7 +7436,7 @@ var EmptyPage_default = {
|
|
|
7362
7436
|
|
|
7363
7437
|
// src/components/empty-page/EmptyPage.tsx
|
|
7364
7438
|
import { jsx as jsx36 } from "react/jsx-runtime";
|
|
7365
|
-
var EmptyPageRoot =
|
|
7439
|
+
var EmptyPageRoot = React50.forwardRef(function EmptyPageRoot2({ size = "m", layout = "default", className, children, ...rest }, forwardedRef) {
|
|
7366
7440
|
return /* @__PURE__ */ jsx36(
|
|
7367
7441
|
"div",
|
|
7368
7442
|
{
|
|
@@ -7382,13 +7456,13 @@ function EmptyPageIcon({ className, children, ...rest }) {
|
|
|
7382
7456
|
return /* @__PURE__ */ jsx36("div", { className: cx(EmptyPage_default.iconWrap, className), ...rest, children });
|
|
7383
7457
|
}
|
|
7384
7458
|
EmptyPageIcon.displayName = "EmptyPage.Icon";
|
|
7385
|
-
var EmptyPageTitle =
|
|
7459
|
+
var EmptyPageTitle = React50.forwardRef(
|
|
7386
7460
|
function EmptyPageTitle2({ className, children, ...rest }, forwardedRef) {
|
|
7387
7461
|
return /* @__PURE__ */ jsx36("h2", { ref: forwardedRef, className: cx(EmptyPage_default.title, className), ...rest, children });
|
|
7388
7462
|
}
|
|
7389
7463
|
);
|
|
7390
7464
|
EmptyPageTitle.displayName = "EmptyPage.Title";
|
|
7391
|
-
var EmptyPageDescription =
|
|
7465
|
+
var EmptyPageDescription = React50.forwardRef(
|
|
7392
7466
|
function EmptyPageDescription2({ className, children, ...rest }, forwardedRef) {
|
|
7393
7467
|
return /* @__PURE__ */ jsx36("p", { ref: forwardedRef, className: cx(EmptyPage_default.description, className), ...rest, children });
|
|
7394
7468
|
}
|
|
@@ -7408,10 +7482,10 @@ var EmptyPage = {
|
|
|
7408
7482
|
|
|
7409
7483
|
// src/components/example-frame/ExampleFrame.tsx
|
|
7410
7484
|
import { Code2, Eye as Eye2, Monitor, Smartphone, Tablet } from "lucide-react";
|
|
7411
|
-
import * as
|
|
7485
|
+
import * as React52 from "react";
|
|
7412
7486
|
|
|
7413
7487
|
// src/components/segmented-control/SegmentedControl.tsx
|
|
7414
|
-
import * as
|
|
7488
|
+
import * as React51 from "react";
|
|
7415
7489
|
|
|
7416
7490
|
// src/components/segmented-control/SegmentedControl.module.css
|
|
7417
7491
|
var SegmentedControl_default = {
|
|
@@ -7450,23 +7524,23 @@ function SegmentedControlRoot({
|
|
|
7450
7524
|
defaultValue,
|
|
7451
7525
|
onChange: onValueChange
|
|
7452
7526
|
});
|
|
7453
|
-
const [indicator, setIndicator] =
|
|
7527
|
+
const [indicator, setIndicator] = React51.useState({
|
|
7454
7528
|
left: 0,
|
|
7455
7529
|
top: 0,
|
|
7456
7530
|
width: 0,
|
|
7457
7531
|
height: 0
|
|
7458
7532
|
});
|
|
7459
|
-
const [animate2, setAnimate] =
|
|
7460
|
-
const containerRef =
|
|
7461
|
-
const indicatorRef =
|
|
7462
|
-
const onSelect =
|
|
7533
|
+
const [animate2, setAnimate] = React51.useState(false);
|
|
7534
|
+
const containerRef = React51.useRef(null);
|
|
7535
|
+
const indicatorRef = React51.useRef(null);
|
|
7536
|
+
const onSelect = React51.useCallback(
|
|
7463
7537
|
(nextValue) => {
|
|
7464
7538
|
setAnimate(true);
|
|
7465
7539
|
setSelectedValue(nextValue);
|
|
7466
7540
|
},
|
|
7467
7541
|
[setSelectedValue]
|
|
7468
7542
|
);
|
|
7469
|
-
|
|
7543
|
+
React51.useLayoutEffect(() => {
|
|
7470
7544
|
const root = containerRef.current;
|
|
7471
7545
|
if (!root) return;
|
|
7472
7546
|
const update = () => {
|
|
@@ -7503,12 +7577,12 @@ function SegmentedControlRoot({
|
|
|
7503
7577
|
ro?.disconnect();
|
|
7504
7578
|
};
|
|
7505
7579
|
}, []);
|
|
7506
|
-
|
|
7580
|
+
React51.useEffect(() => {
|
|
7507
7581
|
if (!animate2) return;
|
|
7508
7582
|
const id = window.setTimeout(() => setAnimate(false), 320);
|
|
7509
7583
|
return () => window.clearTimeout(id);
|
|
7510
7584
|
}, [animate2]);
|
|
7511
|
-
|
|
7585
|
+
React51.useLayoutEffect(() => {
|
|
7512
7586
|
const indicatorEl = indicatorRef.current;
|
|
7513
7587
|
if (!indicatorEl) return;
|
|
7514
7588
|
indicatorEl.style.transform = `translate3d(${indicator.left}px, ${indicator.top}px, 0)`;
|
|
@@ -7634,14 +7708,14 @@ function ExampleFrameRoot({
|
|
|
7634
7708
|
previewLayout = "default",
|
|
7635
7709
|
themePreset
|
|
7636
7710
|
}) {
|
|
7637
|
-
const [pane, setPane] =
|
|
7638
|
-
const [uncontrolledViewport, setUncontrolledViewport] =
|
|
7639
|
-
const [uncontrolledScheme, setUncontrolledScheme] =
|
|
7711
|
+
const [pane, setPane] = React52.useState("preview");
|
|
7712
|
+
const [uncontrolledViewport, setUncontrolledViewport] = React52.useState(defaultViewport);
|
|
7713
|
+
const [uncontrolledScheme, setUncontrolledScheme] = React52.useState(defaultColorScheme);
|
|
7640
7714
|
const isSchemeControlled = colorSchemeProp !== void 0;
|
|
7641
7715
|
const colorScheme = isSchemeControlled ? colorSchemeProp : uncontrolledScheme;
|
|
7642
7716
|
const isViewportControlled = viewportProp !== void 0;
|
|
7643
7717
|
const viewport = isViewportControlled ? viewportProp : uncontrolledViewport;
|
|
7644
|
-
const setColorScheme =
|
|
7718
|
+
const setColorScheme = React52.useCallback(
|
|
7645
7719
|
(next) => {
|
|
7646
7720
|
if (!isSchemeControlled) {
|
|
7647
7721
|
setUncontrolledScheme(next);
|
|
@@ -7650,7 +7724,7 @@ function ExampleFrameRoot({
|
|
|
7650
7724
|
},
|
|
7651
7725
|
[isSchemeControlled, onColorSchemeChange]
|
|
7652
7726
|
);
|
|
7653
|
-
const setViewport =
|
|
7727
|
+
const setViewport = React52.useCallback(
|
|
7654
7728
|
(next) => {
|
|
7655
7729
|
if (!isViewportControlled) {
|
|
7656
7730
|
setUncontrolledViewport(next);
|
|
@@ -7659,7 +7733,7 @@ function ExampleFrameRoot({
|
|
|
7659
7733
|
},
|
|
7660
7734
|
[isViewportControlled, onViewportChange]
|
|
7661
7735
|
);
|
|
7662
|
-
const ctxValue =
|
|
7736
|
+
const ctxValue = React52.useMemo(
|
|
7663
7737
|
() => ({
|
|
7664
7738
|
code,
|
|
7665
7739
|
language,
|
|
@@ -7685,8 +7759,8 @@ function ExampleFrameRoot({
|
|
|
7685
7759
|
]
|
|
7686
7760
|
);
|
|
7687
7761
|
let previewChildren = null;
|
|
7688
|
-
|
|
7689
|
-
if (
|
|
7762
|
+
React52.Children.forEach(children, (child) => {
|
|
7763
|
+
if (React52.isValidElement(child) && child.type === ExampleFrameStage) {
|
|
7690
7764
|
previewChildren = child.props.children ?? null;
|
|
7691
7765
|
}
|
|
7692
7766
|
});
|
|
@@ -7710,8 +7784,8 @@ function ExampleFrameRoot({
|
|
|
7710
7784
|
ExampleFrameRoot.displayName = "ExampleFrame.Root";
|
|
7711
7785
|
function ExampleFrameToolbar() {
|
|
7712
7786
|
const ctx = useExampleFrameContext();
|
|
7713
|
-
const [copyState, setCopyState] =
|
|
7714
|
-
const handleCopy =
|
|
7787
|
+
const [copyState, setCopyState] = React52.useState("idle");
|
|
7788
|
+
const handleCopy = React52.useCallback(async () => {
|
|
7715
7789
|
try {
|
|
7716
7790
|
await navigator.clipboard.writeText(ctx.code);
|
|
7717
7791
|
setCopyState("copied");
|
|
@@ -7817,10 +7891,10 @@ var ExampleFrame = {
|
|
|
7817
7891
|
};
|
|
7818
7892
|
|
|
7819
7893
|
// src/components/file-upload/FileUpload.tsx
|
|
7820
|
-
import * as
|
|
7894
|
+
import * as React54 from "react";
|
|
7821
7895
|
|
|
7822
7896
|
// src/components/progress-bar/ProgressBar.tsx
|
|
7823
|
-
import * as
|
|
7897
|
+
import * as React53 from "react";
|
|
7824
7898
|
|
|
7825
7899
|
// src/components/progress-bar/ProgressBar.module.css
|
|
7826
7900
|
var ProgressBar_default = {
|
|
@@ -7834,11 +7908,11 @@ import { jsx as jsx39, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
|
7834
7908
|
function clampProgress(value, max) {
|
|
7835
7909
|
return Math.min(max, Math.max(value, 0));
|
|
7836
7910
|
}
|
|
7837
|
-
var ProgressBarRoot =
|
|
7911
|
+
var ProgressBarRoot = React53.forwardRef(
|
|
7838
7912
|
({ value, max = 100, label, size = "m", className }, ref) => {
|
|
7839
7913
|
const safeMax = max > 0 ? max : 100;
|
|
7840
7914
|
const safeValue = clampProgress(value, safeMax);
|
|
7841
|
-
const labelId =
|
|
7915
|
+
const labelId = React53.useId();
|
|
7842
7916
|
return /* @__PURE__ */ jsxs19("div", { className: cx(ProgressBar_default.root, className), ...toDataAttributes({ size }), children: [
|
|
7843
7917
|
label ? /* @__PURE__ */ jsx39("span", { className: ProgressBar_default.label, id: labelId, children: label }) : null,
|
|
7844
7918
|
/* @__PURE__ */ jsx39(
|
|
@@ -7911,7 +7985,7 @@ function FileUploadBrowseLabel({ className, children, ...rest }) {
|
|
|
7911
7985
|
return /* @__PURE__ */ jsx40("span", { className: cx(FileUpload_default.browse, className), ...rest, children });
|
|
7912
7986
|
}
|
|
7913
7987
|
FileUploadBrowseLabel.displayName = "FileUpload.BrowseLabel";
|
|
7914
|
-
var FileUploadBrowseLink =
|
|
7988
|
+
var FileUploadBrowseLink = React54.forwardRef(
|
|
7915
7989
|
({ className, type = "button", onClick, ...rest }, ref) => /* @__PURE__ */ jsx40(
|
|
7916
7990
|
"button",
|
|
7917
7991
|
{
|
|
@@ -7936,7 +8010,7 @@ function FileUploadActionsRow({ className, children, ...rest }) {
|
|
|
7936
8010
|
return /* @__PURE__ */ jsx40("div", { className: cx(FileUpload_default.actionsRow, className), ...rest, children });
|
|
7937
8011
|
}
|
|
7938
8012
|
FileUploadActionsRow.displayName = "FileUpload.ActionsRow";
|
|
7939
|
-
var FileUploadChip =
|
|
8013
|
+
var FileUploadChip = React54.forwardRef(
|
|
7940
8014
|
({ className, type = "button", onClick, ...rest }, ref) => /* @__PURE__ */ jsx40(
|
|
7941
8015
|
"button",
|
|
7942
8016
|
{
|
|
@@ -8002,7 +8076,7 @@ function FileUploadItemTextGroup({ className, children, ...rest }) {
|
|
|
8002
8076
|
return /* @__PURE__ */ jsx40("div", { className: cx(FileUpload_default.itemTextGroup, className), ...rest, children });
|
|
8003
8077
|
}
|
|
8004
8078
|
FileUploadItemTextGroup.displayName = "FileUpload.ItemTextGroup";
|
|
8005
|
-
var FileUploadItemTryAgain =
|
|
8079
|
+
var FileUploadItemTryAgain = React54.forwardRef(
|
|
8006
8080
|
({ className, type = "button", ...rest }, ref) => /* @__PURE__ */ jsx40("button", { ref, type, className: cx(FileUpload_default.itemTryAgain, className), ...rest })
|
|
8007
8081
|
);
|
|
8008
8082
|
FileUploadItemTryAgain.displayName = "FileUpload.ItemTryAgain";
|
|
@@ -8030,7 +8104,7 @@ function FileUploadItemProgress({ value, max, className, children }) {
|
|
|
8030
8104
|
return /* @__PURE__ */ jsx40("div", { className: cx(FileUpload_default.itemProgress, className), children: children ?? (value !== void 0 ? /* @__PURE__ */ jsx40(ProgressBar.Root, { value, max }) : null) });
|
|
8031
8105
|
}
|
|
8032
8106
|
FileUploadItemProgress.displayName = "FileUpload.ItemProgress";
|
|
8033
|
-
var FileUploadRoot =
|
|
8107
|
+
var FileUploadRoot = React54.forwardRef(
|
|
8034
8108
|
({
|
|
8035
8109
|
size = "m",
|
|
8036
8110
|
appearance = "dashed",
|
|
@@ -8043,7 +8117,7 @@ var FileUploadRoot = React53.forwardRef(
|
|
|
8043
8117
|
children,
|
|
8044
8118
|
...rest
|
|
8045
8119
|
}, ref) => {
|
|
8046
|
-
const [isDragOver, setIsDragOver] =
|
|
8120
|
+
const [isDragOver, setIsDragOver] = React54.useState(false);
|
|
8047
8121
|
const mergeInputRef = useMergedRefs(inputRefProp);
|
|
8048
8122
|
const handleChange = (e) => {
|
|
8049
8123
|
const list = e.target.files;
|
|
@@ -8139,7 +8213,7 @@ var FileUpload = {
|
|
|
8139
8213
|
};
|
|
8140
8214
|
|
|
8141
8215
|
// src/components/kbd/Kbd.tsx
|
|
8142
|
-
import * as
|
|
8216
|
+
import * as React55 from "react";
|
|
8143
8217
|
|
|
8144
8218
|
// src/components/kbd/Kbd.module.css
|
|
8145
8219
|
var Kbd_default = {
|
|
@@ -8148,7 +8222,7 @@ var Kbd_default = {
|
|
|
8148
8222
|
|
|
8149
8223
|
// src/components/kbd/Kbd.tsx
|
|
8150
8224
|
import { jsx as jsx41 } from "react/jsx-runtime";
|
|
8151
|
-
var KbdRoot =
|
|
8225
|
+
var KbdRoot = React55.forwardRef(
|
|
8152
8226
|
({ children, className, size: sizeProp, ...rest }, ref) => {
|
|
8153
8227
|
const controlSurface = useOptionalControlSize();
|
|
8154
8228
|
const size = sizeProp ?? (controlSurface !== void 0 ? controlSurfaceToInputSize(controlSurface) : "m");
|
|
@@ -8169,7 +8243,7 @@ var Kbd = { Root: KbdRoot };
|
|
|
8169
8243
|
|
|
8170
8244
|
// src/components/notification/Notification.tsx
|
|
8171
8245
|
import { AlertTriangle, CheckCircle2, Info, X as X3, XCircle } from "lucide-react";
|
|
8172
|
-
import * as
|
|
8246
|
+
import * as React56 from "react";
|
|
8173
8247
|
|
|
8174
8248
|
// src/components/notification/Notification.module.css
|
|
8175
8249
|
var Notification_default = {
|
|
@@ -8200,14 +8274,14 @@ var Notification_default = {
|
|
|
8200
8274
|
// src/components/notification/Notification.tsx
|
|
8201
8275
|
import { jsx as jsx42, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
8202
8276
|
function useCountdown(item, paused, onExpire) {
|
|
8203
|
-
const [progress, setProgress] =
|
|
8204
|
-
const remainingRef =
|
|
8205
|
-
const lastTsRef =
|
|
8206
|
-
const pausedRef =
|
|
8207
|
-
const onExpireRef =
|
|
8277
|
+
const [progress, setProgress] = React56.useState(1);
|
|
8278
|
+
const remainingRef = React56.useRef(item.duration);
|
|
8279
|
+
const lastTsRef = React56.useRef(null);
|
|
8280
|
+
const pausedRef = React56.useRef(paused);
|
|
8281
|
+
const onExpireRef = React56.useRef(onExpire);
|
|
8208
8282
|
pausedRef.current = paused;
|
|
8209
8283
|
onExpireRef.current = onExpire;
|
|
8210
|
-
|
|
8284
|
+
React56.useEffect(() => {
|
|
8211
8285
|
if (item.persistent || item.duration <= 0) return;
|
|
8212
8286
|
remainingRef.current = item.duration;
|
|
8213
8287
|
lastTsRef.current = null;
|
|
@@ -8309,7 +8383,7 @@ function NotificationCard({
|
|
|
8309
8383
|
|
|
8310
8384
|
// src/components/notification/NotificationStore.tsx
|
|
8311
8385
|
import { AnimatePresence, LayoutGroup, motion } from "framer-motion";
|
|
8312
|
-
import * as
|
|
8386
|
+
import * as React57 from "react";
|
|
8313
8387
|
import { jsx as jsx43, jsxs as jsxs22 } from "react/jsx-runtime";
|
|
8314
8388
|
var DEFAULT_DURATION = 5e3;
|
|
8315
8389
|
var PEEK_VISIBLE = 3;
|
|
@@ -8337,7 +8411,7 @@ var POSITIONS = [
|
|
|
8337
8411
|
"bottom-right"
|
|
8338
8412
|
];
|
|
8339
8413
|
var TYPES = ["success", "error", "warning", "info"];
|
|
8340
|
-
var StoreContext =
|
|
8414
|
+
var StoreContext = React57.createContext(null);
|
|
8341
8415
|
function newId() {
|
|
8342
8416
|
return globalThis.crypto?.randomUUID?.() ?? `ntf-${Date.now()}-${Math.random().toString(16).slice(2)}`;
|
|
8343
8417
|
}
|
|
@@ -8349,10 +8423,10 @@ function NotificationStack({
|
|
|
8349
8423
|
items,
|
|
8350
8424
|
onDismiss
|
|
8351
8425
|
}) {
|
|
8352
|
-
const [expanded, setExpanded] =
|
|
8353
|
-
const collapseTimerRef =
|
|
8426
|
+
const [expanded, setExpanded] = React57.useState(false);
|
|
8427
|
+
const collapseTimerRef = React57.useRef(null);
|
|
8354
8428
|
const top = isTop(position);
|
|
8355
|
-
const handleHover =
|
|
8429
|
+
const handleHover = React57.useCallback((hovered) => {
|
|
8356
8430
|
if (collapseTimerRef.current !== null) {
|
|
8357
8431
|
clearTimeout(collapseTimerRef.current);
|
|
8358
8432
|
collapseTimerRef.current = null;
|
|
@@ -8363,7 +8437,7 @@ function NotificationStack({
|
|
|
8363
8437
|
collapseTimerRef.current = window.setTimeout(() => setExpanded(false), 100);
|
|
8364
8438
|
}
|
|
8365
8439
|
}, []);
|
|
8366
|
-
|
|
8440
|
+
React57.useEffect(
|
|
8367
8441
|
() => () => {
|
|
8368
8442
|
if (collapseTimerRef.current !== null) clearTimeout(collapseTimerRef.current);
|
|
8369
8443
|
},
|
|
@@ -8397,7 +8471,7 @@ function NotificationStack({
|
|
|
8397
8471
|
}
|
|
8398
8472
|
);
|
|
8399
8473
|
}
|
|
8400
|
-
var NotificationStackItem =
|
|
8474
|
+
var NotificationStackItem = React57.memo(function NotificationStackItem2({
|
|
8401
8475
|
item,
|
|
8402
8476
|
index,
|
|
8403
8477
|
expanded,
|
|
@@ -8465,7 +8539,7 @@ function NotificationToaster({
|
|
|
8465
8539
|
entries,
|
|
8466
8540
|
onDismiss
|
|
8467
8541
|
}) {
|
|
8468
|
-
const grouped =
|
|
8542
|
+
const grouped = React57.useMemo(() => {
|
|
8469
8543
|
const map = /* @__PURE__ */ new Map();
|
|
8470
8544
|
for (const entry of entries) {
|
|
8471
8545
|
if (!map.has(entry.position)) map.set(entry.position, /* @__PURE__ */ new Map());
|
|
@@ -8511,18 +8585,18 @@ function NotificationProvider({
|
|
|
8511
8585
|
position = "top-right",
|
|
8512
8586
|
max = 5
|
|
8513
8587
|
}) {
|
|
8514
|
-
const [entries, setEntries] =
|
|
8515
|
-
const dismiss =
|
|
8588
|
+
const [entries, setEntries] = React57.useState([]);
|
|
8589
|
+
const dismiss = React57.useCallback((id) => {
|
|
8516
8590
|
setEntries((prev) => prev.map((n) => n.id === id ? { ...n, dismissing: true } : n));
|
|
8517
8591
|
window.setTimeout(() => {
|
|
8518
8592
|
setEntries((prev) => prev.filter((n) => n.id !== id));
|
|
8519
8593
|
}, DISMISS_CLEANUP_MS);
|
|
8520
8594
|
}, []);
|
|
8521
|
-
const dismissAll =
|
|
8595
|
+
const dismissAll = React57.useCallback(() => {
|
|
8522
8596
|
setEntries((prev) => prev.map((n) => ({ ...n, dismissing: true })));
|
|
8523
8597
|
window.setTimeout(() => setEntries([]), DISMISS_CLEANUP_MS);
|
|
8524
8598
|
}, []);
|
|
8525
|
-
const notify =
|
|
8599
|
+
const notify = React57.useCallback(
|
|
8526
8600
|
(options) => {
|
|
8527
8601
|
const id = newId();
|
|
8528
8602
|
const record = {
|
|
@@ -8548,8 +8622,8 @@ function NotificationProvider({
|
|
|
8548
8622
|
},
|
|
8549
8623
|
[position, max]
|
|
8550
8624
|
);
|
|
8551
|
-
const publicItems =
|
|
8552
|
-
const value =
|
|
8625
|
+
const publicItems = React57.useMemo(() => entries.filter((n) => !n.dismissing), [entries]);
|
|
8626
|
+
const value = React57.useMemo(
|
|
8553
8627
|
() => ({ items: publicItems, notify, dismiss, dismissAll }),
|
|
8554
8628
|
[publicItems, notify, dismiss, dismissAll]
|
|
8555
8629
|
);
|
|
@@ -8559,18 +8633,18 @@ function NotificationProvider({
|
|
|
8559
8633
|
] });
|
|
8560
8634
|
}
|
|
8561
8635
|
function useNotifications() {
|
|
8562
|
-
const ctx =
|
|
8636
|
+
const ctx = React57.useContext(StoreContext);
|
|
8563
8637
|
if (!ctx) throw new Error("useNotifications must be used within NotificationProvider");
|
|
8564
8638
|
return { notify: ctx.notify, dismiss: ctx.dismiss, dismissAll: ctx.dismissAll };
|
|
8565
8639
|
}
|
|
8566
8640
|
function useNotificationStore() {
|
|
8567
|
-
const ctx =
|
|
8641
|
+
const ctx = React57.useContext(StoreContext);
|
|
8568
8642
|
if (!ctx) throw new Error("useNotificationStore must be used within NotificationProvider");
|
|
8569
8643
|
return ctx;
|
|
8570
8644
|
}
|
|
8571
8645
|
|
|
8572
8646
|
// src/components/page-content/PageContent.tsx
|
|
8573
|
-
import * as
|
|
8647
|
+
import * as React58 from "react";
|
|
8574
8648
|
|
|
8575
8649
|
// src/components/page-content/PageContent.module.css
|
|
8576
8650
|
var PageContent_default = {
|
|
@@ -8584,7 +8658,7 @@ var PageContent_default = {
|
|
|
8584
8658
|
|
|
8585
8659
|
// src/components/page-content/PageContent.tsx
|
|
8586
8660
|
import { jsx as jsx44 } from "react/jsx-runtime";
|
|
8587
|
-
var PageContentRoot =
|
|
8661
|
+
var PageContentRoot = React58.forwardRef(
|
|
8588
8662
|
function PageContentRoot2({ maxWidth = "full", className, children, ...rest }, forwardedRef) {
|
|
8589
8663
|
return /* @__PURE__ */ jsx44(
|
|
8590
8664
|
"div",
|
|
@@ -8601,7 +8675,7 @@ var PageContentRoot = React57.forwardRef(
|
|
|
8601
8675
|
}
|
|
8602
8676
|
);
|
|
8603
8677
|
PageContentRoot.displayName = "PageContent.Root";
|
|
8604
|
-
var PageContentSection =
|
|
8678
|
+
var PageContentSection = React58.forwardRef(
|
|
8605
8679
|
function PageContentSection2({ className, children, ...rest }, forwardedRef) {
|
|
8606
8680
|
return /* @__PURE__ */ jsx44("section", { ref: forwardedRef, className: cx(PageContent_default.section, className), ...rest, children });
|
|
8607
8681
|
}
|
|
@@ -8611,13 +8685,13 @@ function PageContentHeader({ className, children, ...rest }) {
|
|
|
8611
8685
|
return /* @__PURE__ */ jsx44("div", { className: cx(PageContent_default.header, className), ...rest, children });
|
|
8612
8686
|
}
|
|
8613
8687
|
PageContentHeader.displayName = "PageContent.Header";
|
|
8614
|
-
var PageContentTitle =
|
|
8688
|
+
var PageContentTitle = React58.forwardRef(
|
|
8615
8689
|
function PageContentTitle2({ className, children, ...rest }, forwardedRef) {
|
|
8616
8690
|
return /* @__PURE__ */ jsx44("h1", { ref: forwardedRef, className: cx(PageContent_default.title, className), ...rest, children });
|
|
8617
8691
|
}
|
|
8618
8692
|
);
|
|
8619
8693
|
PageContentTitle.displayName = "PageContent.Title";
|
|
8620
|
-
var PageContentDescription =
|
|
8694
|
+
var PageContentDescription = React58.forwardRef(
|
|
8621
8695
|
function PageContentDescription2({ className, children, measure = "readable", ...rest }, forwardedRef) {
|
|
8622
8696
|
return /* @__PURE__ */ jsx44(
|
|
8623
8697
|
"p",
|
|
@@ -8648,7 +8722,7 @@ var PageContent = {
|
|
|
8648
8722
|
};
|
|
8649
8723
|
|
|
8650
8724
|
// src/components/popover/Popover.tsx
|
|
8651
|
-
import * as
|
|
8725
|
+
import * as React60 from "react";
|
|
8652
8726
|
|
|
8653
8727
|
// src/components/popover/Popover.module.css
|
|
8654
8728
|
var Popover_default = {
|
|
@@ -8658,7 +8732,7 @@ var Popover_default = {
|
|
|
8658
8732
|
};
|
|
8659
8733
|
|
|
8660
8734
|
// src/components/popover/usePopoverPosition.ts
|
|
8661
|
-
import * as
|
|
8735
|
+
import * as React59 from "react";
|
|
8662
8736
|
|
|
8663
8737
|
// src/components/popover/popoverGeometry.ts
|
|
8664
8738
|
var POPOVER_MIN_MAX_HEIGHT = 120;
|
|
@@ -8685,8 +8759,8 @@ function usePopoverPosition({
|
|
|
8685
8759
|
align,
|
|
8686
8760
|
sameMinWidthAsTrigger
|
|
8687
8761
|
}) {
|
|
8688
|
-
const [layout, setLayout] =
|
|
8689
|
-
const commit =
|
|
8762
|
+
const [layout, setLayout] = React59.useState(null);
|
|
8763
|
+
const commit = React59.useCallback(() => {
|
|
8690
8764
|
const trigger = triggerRef.current;
|
|
8691
8765
|
const panel = contentRef.current;
|
|
8692
8766
|
if (!trigger || !panel) return;
|
|
@@ -8723,7 +8797,7 @@ function usePopoverPosition({
|
|
|
8723
8797
|
};
|
|
8724
8798
|
setLayout((prev) => prev && layoutEqual2(prev, next) ? prev : next);
|
|
8725
8799
|
}, [triggerRef, contentRef, side, align, sameMinWidthAsTrigger]);
|
|
8726
|
-
|
|
8800
|
+
React59.useLayoutEffect(() => {
|
|
8727
8801
|
if (!open) {
|
|
8728
8802
|
setLayout(null);
|
|
8729
8803
|
return;
|
|
@@ -8768,13 +8842,13 @@ function PopoverRoot({ open, defaultOpen = false, onOpenChange, children }) {
|
|
|
8768
8842
|
defaultValue: defaultOpen,
|
|
8769
8843
|
onChange: onOpenChange
|
|
8770
8844
|
});
|
|
8771
|
-
const id =
|
|
8845
|
+
const id = React60.useId();
|
|
8772
8846
|
const triggerId = `${id}-trigger`;
|
|
8773
8847
|
const contentId = `${id}-content`;
|
|
8774
|
-
const triggerRef =
|
|
8775
|
-
const onClose =
|
|
8776
|
-
const onToggle =
|
|
8777
|
-
const value =
|
|
8848
|
+
const triggerRef = React60.useRef(null);
|
|
8849
|
+
const onClose = React60.useCallback(() => setIsOpen(false), [setIsOpen]);
|
|
8850
|
+
const onToggle = React60.useCallback(() => setIsOpen((v) => !v), [setIsOpen]);
|
|
8851
|
+
const value = React60.useMemo(
|
|
8778
8852
|
() => ({ isOpen, onClose, onToggle, triggerId, contentId, triggerRef }),
|
|
8779
8853
|
[isOpen, onClose, onToggle, triggerId, contentId]
|
|
8780
8854
|
);
|
|
@@ -8784,9 +8858,9 @@ PopoverRoot.displayName = "PopoverRoot";
|
|
|
8784
8858
|
function PopoverTrigger({ children, asChild: _asChild = true }) {
|
|
8785
8859
|
void _asChild;
|
|
8786
8860
|
const { isOpen, onToggle, triggerId, contentId, triggerRef } = usePopoverContext();
|
|
8787
|
-
const toggleRef =
|
|
8861
|
+
const toggleRef = React60.useRef(onToggle);
|
|
8788
8862
|
toggleRef.current = onToggle;
|
|
8789
|
-
const setNode =
|
|
8863
|
+
const setNode = React60.useCallback(
|
|
8790
8864
|
(el) => {
|
|
8791
8865
|
triggerRef.current = el;
|
|
8792
8866
|
},
|
|
@@ -8794,9 +8868,9 @@ function PopoverTrigger({ children, asChild: _asChild = true }) {
|
|
|
8794
8868
|
);
|
|
8795
8869
|
const child = children;
|
|
8796
8870
|
const childRef = child.props.ref ?? child.ref;
|
|
8797
|
-
const mergedRef =
|
|
8871
|
+
const mergedRef = React60.useMemo(() => mergeRefs(childRef, setNode), [childRef, setNode]);
|
|
8798
8872
|
const userClick = child.props?.onClick;
|
|
8799
|
-
return
|
|
8873
|
+
return React60.cloneElement(child, {
|
|
8800
8874
|
ref: mergedRef,
|
|
8801
8875
|
id: triggerId,
|
|
8802
8876
|
"aria-expanded": isOpen,
|
|
@@ -8822,7 +8896,7 @@ function PopoverContent({
|
|
|
8822
8896
|
}) {
|
|
8823
8897
|
const { isOpen, onClose, triggerRef, contentId, triggerId } = usePopoverContext();
|
|
8824
8898
|
const overlayPortalLayer = useOverlayPortalLayer();
|
|
8825
|
-
const contentRef =
|
|
8899
|
+
const contentRef = React60.useRef(null);
|
|
8826
8900
|
const layout = usePopoverPosition({
|
|
8827
8901
|
open: isOpen,
|
|
8828
8902
|
triggerRef,
|
|
@@ -8835,7 +8909,7 @@ function PopoverContent({
|
|
|
8835
8909
|
enabled: isOpen && trapFocus,
|
|
8836
8910
|
restoreFocus: true
|
|
8837
8911
|
});
|
|
8838
|
-
const ref =
|
|
8912
|
+
const ref = React60.useMemo(() => mergeRefs(contentRef, trapRef), [trapRef]);
|
|
8839
8913
|
useEscapeKey({ enabled: isOpen, onEscape: onClose });
|
|
8840
8914
|
useOutsideClick({
|
|
8841
8915
|
refs: [triggerRef, contentRef],
|
|
@@ -8872,7 +8946,7 @@ var Popover = {
|
|
|
8872
8946
|
};
|
|
8873
8947
|
|
|
8874
8948
|
// src/components/progress-circle/ProgressCircle.tsx
|
|
8875
|
-
import * as
|
|
8949
|
+
import * as React61 from "react";
|
|
8876
8950
|
|
|
8877
8951
|
// src/components/progress-circle/ProgressCircle.module.css
|
|
8878
8952
|
var ProgressCircle_default = {
|
|
@@ -8888,7 +8962,7 @@ var pc = primitiveTokens.progressCircle;
|
|
|
8888
8962
|
function clampProgress2(value, max) {
|
|
8889
8963
|
return Math.min(max, Math.max(value, 0));
|
|
8890
8964
|
}
|
|
8891
|
-
var ProgressCircleRoot =
|
|
8965
|
+
var ProgressCircleRoot = React61.forwardRef(
|
|
8892
8966
|
({ value, max = 100, size = "m", label, children, className }, ref) => {
|
|
8893
8967
|
const safeMax = max > 0 ? max : 100;
|
|
8894
8968
|
const safeValue = clampProgress2(value, safeMax);
|
|
@@ -8960,7 +9034,7 @@ ProgressCircleRoot.displayName = "ProgressCircleRoot";
|
|
|
8960
9034
|
var ProgressCircle = { Root: ProgressCircleRoot };
|
|
8961
9035
|
|
|
8962
9036
|
// src/components/radio/Radio.tsx
|
|
8963
|
-
import * as
|
|
9037
|
+
import * as React62 from "react";
|
|
8964
9038
|
|
|
8965
9039
|
// src/components/radio/Radio.module.css
|
|
8966
9040
|
var Radio_default = {
|
|
@@ -8978,7 +9052,7 @@ var Radio_default = {
|
|
|
8978
9052
|
// src/components/radio/Radio.tsx
|
|
8979
9053
|
import { jsx as jsx47, jsxs as jsxs24 } from "react/jsx-runtime";
|
|
8980
9054
|
var [RadioProvider, useRadioContext] = createComponentContext("Radio");
|
|
8981
|
-
var RadioRoot =
|
|
9055
|
+
var RadioRoot = React62.forwardRef(
|
|
8982
9056
|
({
|
|
8983
9057
|
id,
|
|
8984
9058
|
variant = "default",
|
|
@@ -8989,14 +9063,14 @@ var RadioRoot = React61.forwardRef(
|
|
|
8989
9063
|
children,
|
|
8990
9064
|
...inputRest
|
|
8991
9065
|
}, ref) => {
|
|
8992
|
-
const rawId =
|
|
9066
|
+
const rawId = React62.useId();
|
|
8993
9067
|
const inputId = id ?? rawId;
|
|
8994
9068
|
const hintId = `${inputId}-hint`;
|
|
8995
9069
|
const errorId = `${inputId}-error`;
|
|
8996
|
-
const [hasHint, setHasHint] =
|
|
8997
|
-
const [hasError, setHasError] =
|
|
9070
|
+
const [hasHint, setHasHint] = React62.useState(false);
|
|
9071
|
+
const [hasError, setHasError] = React62.useState(false);
|
|
8998
9072
|
const invalid = variant === "error" || hasError;
|
|
8999
|
-
const restInputPropsRef =
|
|
9073
|
+
const restInputPropsRef = React62.useRef(inputRest);
|
|
9000
9074
|
restInputPropsRef.current = inputRest;
|
|
9001
9075
|
const parts = [
|
|
9002
9076
|
ariaDescribedBy,
|
|
@@ -9004,11 +9078,11 @@ var RadioRoot = React61.forwardRef(
|
|
|
9004
9078
|
hasError ? errorId : void 0
|
|
9005
9079
|
].filter(Boolean);
|
|
9006
9080
|
const describedBy = parts.length > 0 ? parts.join(" ") : void 0;
|
|
9007
|
-
const registerHint =
|
|
9008
|
-
const unregisterHint =
|
|
9009
|
-
const registerError =
|
|
9010
|
-
const unregisterError =
|
|
9011
|
-
const ctxValue =
|
|
9081
|
+
const registerHint = React62.useCallback(() => setHasHint(true), []);
|
|
9082
|
+
const unregisterHint = React62.useCallback(() => setHasHint(false), []);
|
|
9083
|
+
const registerError = React62.useCallback(() => setHasError(true), []);
|
|
9084
|
+
const unregisterError = React62.useCallback(() => setHasError(false), []);
|
|
9085
|
+
const ctxValue = React62.useMemo(
|
|
9012
9086
|
() => ({
|
|
9013
9087
|
inputId,
|
|
9014
9088
|
hintId,
|
|
@@ -9055,9 +9129,9 @@ var RadioRoot = React61.forwardRef(
|
|
|
9055
9129
|
}
|
|
9056
9130
|
);
|
|
9057
9131
|
RadioRoot.displayName = "RadioRoot";
|
|
9058
|
-
var RadioLabel =
|
|
9132
|
+
var RadioLabel = React62.forwardRef(function RadioLabel2({ children, className, ...rest }, ref) {
|
|
9059
9133
|
const { inputId, inputRef, invalid, disabled, describedBy, restInputPropsRef, size } = useRadioContext();
|
|
9060
|
-
const filterId =
|
|
9134
|
+
const filterId = React62.useId();
|
|
9061
9135
|
const svgFilterId = `es-radio-${filterId.replace(/:/g, "")}`;
|
|
9062
9136
|
return /* @__PURE__ */ jsxs24(
|
|
9063
9137
|
Label.Root,
|
|
@@ -9106,7 +9180,7 @@ var RadioLabel = React61.forwardRef(function RadioLabel2({ children, className,
|
|
|
9106
9180
|
RadioLabel.displayName = "RadioLabel";
|
|
9107
9181
|
function RadioHint({ children, className, ...rest }) {
|
|
9108
9182
|
const { hintId, registerHint, unregisterHint, size, disabled } = useRadioContext();
|
|
9109
|
-
|
|
9183
|
+
React62.useLayoutEffect(() => {
|
|
9110
9184
|
registerHint();
|
|
9111
9185
|
return () => {
|
|
9112
9186
|
unregisterHint();
|
|
@@ -9127,7 +9201,7 @@ function RadioHint({ children, className, ...rest }) {
|
|
|
9127
9201
|
RadioHint.displayName = "RadioHint";
|
|
9128
9202
|
function RadioError({ children, className, ...rest }) {
|
|
9129
9203
|
const { errorId, registerError, unregisterError, size } = useRadioContext();
|
|
9130
|
-
|
|
9204
|
+
React62.useLayoutEffect(() => {
|
|
9131
9205
|
registerError();
|
|
9132
9206
|
return () => {
|
|
9133
9207
|
unregisterError();
|
|
@@ -9154,7 +9228,7 @@ var Radio = {
|
|
|
9154
9228
|
};
|
|
9155
9229
|
|
|
9156
9230
|
// src/components/segmented-progress-bar/SegmentedProgressBar.tsx
|
|
9157
|
-
import * as
|
|
9231
|
+
import * as React63 from "react";
|
|
9158
9232
|
|
|
9159
9233
|
// src/components/segmented-progress-bar/SegmentedProgressBar.module.css
|
|
9160
9234
|
var SegmentedProgressBar_default = {
|
|
@@ -9183,15 +9257,15 @@ function buildDistributionDescription(segments, total) {
|
|
|
9183
9257
|
});
|
|
9184
9258
|
return parts.join(", ");
|
|
9185
9259
|
}
|
|
9186
|
-
var SegmentedProgressBarRoot =
|
|
9260
|
+
var SegmentedProgressBarRoot = React63.forwardRef(
|
|
9187
9261
|
({ segments, label, size = "m", segmentGap = "none", className }, ref) => {
|
|
9188
|
-
const labelId =
|
|
9189
|
-
const descriptionId =
|
|
9190
|
-
const safe =
|
|
9262
|
+
const labelId = React63.useId();
|
|
9263
|
+
const descriptionId = React63.useId();
|
|
9264
|
+
const safe = React63.useMemo(
|
|
9191
9265
|
() => segments.map((s) => ({ ...s, value: clampNonNegative(s.value) })),
|
|
9192
9266
|
[segments]
|
|
9193
9267
|
);
|
|
9194
|
-
const total =
|
|
9268
|
+
const total = React63.useMemo(() => safe.reduce((acc, s) => acc + s.value, 0), [safe]);
|
|
9195
9269
|
const distributionText = buildDistributionDescription(safe, total);
|
|
9196
9270
|
const trackA11y = label ? { "aria-labelledby": labelId, "aria-describedby": descriptionId } : { "aria-label": distributionText };
|
|
9197
9271
|
return /* @__PURE__ */ jsxs25(
|
|
@@ -9223,7 +9297,7 @@ SegmentedProgressBarRoot.displayName = "SegmentedProgressBarRoot";
|
|
|
9223
9297
|
var SegmentedProgressBar = { Root: SegmentedProgressBarRoot };
|
|
9224
9298
|
|
|
9225
9299
|
// src/components/slider/Slider.tsx
|
|
9226
|
-
import * as
|
|
9300
|
+
import * as React64 from "react";
|
|
9227
9301
|
|
|
9228
9302
|
// src/components/slider/Slider.module.css
|
|
9229
9303
|
var Slider_default = {
|
|
@@ -9259,7 +9333,7 @@ function SliderRoot({
|
|
|
9259
9333
|
defaultValue: clamp2(initialDefault, min, max),
|
|
9260
9334
|
onChange
|
|
9261
9335
|
});
|
|
9262
|
-
const id =
|
|
9336
|
+
const id = React64.useId();
|
|
9263
9337
|
const safeValue = clamp2(value, min, max);
|
|
9264
9338
|
const applyValueFromInput = (el) => {
|
|
9265
9339
|
const next = Number.parseFloat(el.value);
|
|
@@ -9298,7 +9372,7 @@ SliderRoot.displayName = "SliderRoot";
|
|
|
9298
9372
|
var Slider2 = { Root: SliderRoot };
|
|
9299
9373
|
|
|
9300
9374
|
// src/components/stepper/HorizontalStepper.tsx
|
|
9301
|
-
import * as
|
|
9375
|
+
import * as React65 from "react";
|
|
9302
9376
|
|
|
9303
9377
|
// src/components/stepper/StepperAlign.module.css
|
|
9304
9378
|
var StepperAlign_default = {
|
|
@@ -9358,7 +9432,7 @@ function HorizontalStepperSeparatorIcon({
|
|
|
9358
9432
|
return /* @__PURE__ */ jsx51("span", { className: StepperAlign_default.hSeparator, "aria-hidden": "true", children: /* @__PURE__ */ jsx51(Component, { className: cx(StepperAlign_default.hSeparatorIcon, className), strokeWidth: 2, ...rest }) });
|
|
9359
9433
|
}
|
|
9360
9434
|
HorizontalStepperSeparatorIcon.displayName = "HorizontalStepper.SeparatorIcon";
|
|
9361
|
-
var HorizontalStepperItem =
|
|
9435
|
+
var HorizontalStepperItem = React65.forwardRef(
|
|
9362
9436
|
function HorizontalStepperItem2({ state = "default", className, type = "button", children, ...rest }, ref) {
|
|
9363
9437
|
return /* @__PURE__ */ jsx51(StepperAlignItemProvider, { value: { state }, children: /* @__PURE__ */ jsx51(
|
|
9364
9438
|
"button",
|
|
@@ -9396,7 +9470,7 @@ var HorizontalStepper = {
|
|
|
9396
9470
|
};
|
|
9397
9471
|
|
|
9398
9472
|
// src/components/stepper/Stepper.tsx
|
|
9399
|
-
import * as
|
|
9473
|
+
import * as React67 from "react";
|
|
9400
9474
|
|
|
9401
9475
|
// src/components/stepper/Stepper.module.css
|
|
9402
9476
|
var Stepper_default = {
|
|
@@ -9409,7 +9483,7 @@ var Stepper_default = {
|
|
|
9409
9483
|
};
|
|
9410
9484
|
|
|
9411
9485
|
// src/components/stepper/VerticalStepper.tsx
|
|
9412
|
-
import * as
|
|
9486
|
+
import * as React66 from "react";
|
|
9413
9487
|
import { jsx as jsx52 } from "react/jsx-runtime";
|
|
9414
9488
|
function VerticalStepperRoot({
|
|
9415
9489
|
className,
|
|
@@ -9429,7 +9503,7 @@ function VerticalStepperArrow({
|
|
|
9429
9503
|
return /* @__PURE__ */ jsx52(Component, { className: cx(StepperAlign_default.vArrow, className), strokeWidth: 2, ...rest });
|
|
9430
9504
|
}
|
|
9431
9505
|
VerticalStepperArrow.displayName = "VerticalStepper.Arrow";
|
|
9432
|
-
var VerticalStepperItem =
|
|
9506
|
+
var VerticalStepperItem = React66.forwardRef(
|
|
9433
9507
|
function VerticalStepperItem2({ state = "default", className, type = "button", children, ...rest }, ref) {
|
|
9434
9508
|
return /* @__PURE__ */ jsx52(StepperAlignItemProvider, { value: { state }, children: /* @__PURE__ */ jsx52(
|
|
9435
9509
|
"button",
|
|
@@ -9487,14 +9561,14 @@ function StepperRoot({
|
|
|
9487
9561
|
children,
|
|
9488
9562
|
className
|
|
9489
9563
|
}) {
|
|
9490
|
-
const indexRef =
|
|
9564
|
+
const indexRef = React67.useRef(0);
|
|
9491
9565
|
indexRef.current = 0;
|
|
9492
|
-
const getNextStepIndex =
|
|
9566
|
+
const getNextStepIndex = React67.useCallback(() => {
|
|
9493
9567
|
const idx = indexRef.current;
|
|
9494
9568
|
indexRef.current += 1;
|
|
9495
9569
|
return idx;
|
|
9496
9570
|
}, []);
|
|
9497
|
-
const value =
|
|
9571
|
+
const value = React67.useMemo(
|
|
9498
9572
|
() => ({ orientation, currentStep, getNextStepIndex }),
|
|
9499
9573
|
[orientation, currentStep, getNextStepIndex]
|
|
9500
9574
|
);
|
|
@@ -9546,7 +9620,7 @@ function StepperContent({ title, description, className }) {
|
|
|
9546
9620
|
] });
|
|
9547
9621
|
}
|
|
9548
9622
|
StepperContent.displayName = "Stepper.Content";
|
|
9549
|
-
var StepperStep =
|
|
9623
|
+
var StepperStep = React67.forwardRef(function StepperStep2({ index: indexProp, status: statusProp, children, className, disabled, type = "button", ...rest }, ref) {
|
|
9550
9624
|
const { currentStep, orientation, getNextStepIndex } = useStepperRootContext();
|
|
9551
9625
|
const index = indexProp ?? getNextStepIndex();
|
|
9552
9626
|
const status = statusProp ?? computeStepStatus(index, currentStep);
|
|
@@ -9580,7 +9654,7 @@ var Stepper = {
|
|
|
9580
9654
|
};
|
|
9581
9655
|
|
|
9582
9656
|
// src/components/switch/Switch.tsx
|
|
9583
|
-
import * as
|
|
9657
|
+
import * as React68 from "react";
|
|
9584
9658
|
|
|
9585
9659
|
// src/components/switch/Switch.module.css
|
|
9586
9660
|
var Switch_default = {
|
|
@@ -9596,7 +9670,7 @@ var Switch_default = {
|
|
|
9596
9670
|
// src/components/switch/Switch.tsx
|
|
9597
9671
|
import { jsx as jsx54, jsxs as jsxs28 } from "react/jsx-runtime";
|
|
9598
9672
|
var [SwitchProvider, useSwitchContext] = createComponentContext("Switch");
|
|
9599
|
-
var SwitchRoot =
|
|
9673
|
+
var SwitchRoot = React68.forwardRef(
|
|
9600
9674
|
({
|
|
9601
9675
|
id,
|
|
9602
9676
|
checked,
|
|
@@ -9611,19 +9685,19 @@ var SwitchRoot = React67.forwardRef(
|
|
|
9611
9685
|
children,
|
|
9612
9686
|
...inputRest
|
|
9613
9687
|
}, ref) => {
|
|
9614
|
-
const rawId =
|
|
9688
|
+
const rawId = React68.useId();
|
|
9615
9689
|
const inputId = id ?? rawId;
|
|
9616
9690
|
const hintId = `${inputId}-hint`;
|
|
9617
9691
|
const errorId = `${inputId}-error`;
|
|
9618
|
-
const [hasHint, setHasHint] =
|
|
9619
|
-
const [hasError, setHasError] =
|
|
9692
|
+
const [hasHint, setHasHint] = React68.useState(false);
|
|
9693
|
+
const [hasError, setHasError] = React68.useState(false);
|
|
9620
9694
|
const invalid = variant === "error" || hasError;
|
|
9621
9695
|
const [isChecked, setChecked] = useControllableState({
|
|
9622
9696
|
value: checked,
|
|
9623
9697
|
defaultValue: defaultChecked,
|
|
9624
9698
|
onChange: onCheckedChange
|
|
9625
9699
|
});
|
|
9626
|
-
const handleChange =
|
|
9700
|
+
const handleChange = React68.useCallback(
|
|
9627
9701
|
(e) => {
|
|
9628
9702
|
if (readOnly) {
|
|
9629
9703
|
e.preventDefault();
|
|
@@ -9633,7 +9707,7 @@ var SwitchRoot = React67.forwardRef(
|
|
|
9633
9707
|
},
|
|
9634
9708
|
[readOnly, setChecked]
|
|
9635
9709
|
);
|
|
9636
|
-
const restInputPropsRef =
|
|
9710
|
+
const restInputPropsRef = React68.useRef(inputRest);
|
|
9637
9711
|
restInputPropsRef.current = inputRest;
|
|
9638
9712
|
const parts = [
|
|
9639
9713
|
ariaDescribedBy,
|
|
@@ -9641,11 +9715,11 @@ var SwitchRoot = React67.forwardRef(
|
|
|
9641
9715
|
hasError ? errorId : void 0
|
|
9642
9716
|
].filter(Boolean);
|
|
9643
9717
|
const describedBy = parts.length > 0 ? parts.join(" ") : void 0;
|
|
9644
|
-
const registerHint =
|
|
9645
|
-
const unregisterHint =
|
|
9646
|
-
const registerError =
|
|
9647
|
-
const unregisterError =
|
|
9648
|
-
const ctxValue =
|
|
9718
|
+
const registerHint = React68.useCallback(() => setHasHint(true), []);
|
|
9719
|
+
const unregisterHint = React68.useCallback(() => setHasHint(false), []);
|
|
9720
|
+
const registerError = React68.useCallback(() => setHasError(true), []);
|
|
9721
|
+
const unregisterError = React68.useCallback(() => setHasError(false), []);
|
|
9722
|
+
const ctxValue = React68.useMemo(
|
|
9649
9723
|
() => ({
|
|
9650
9724
|
inputId,
|
|
9651
9725
|
hintId,
|
|
@@ -9700,7 +9774,7 @@ var SwitchRoot = React67.forwardRef(
|
|
|
9700
9774
|
}
|
|
9701
9775
|
);
|
|
9702
9776
|
SwitchRoot.displayName = "SwitchRoot";
|
|
9703
|
-
var SwitchLabel =
|
|
9777
|
+
var SwitchLabel = React68.forwardRef(function SwitchLabel2({ children, className, ...rest }, ref) {
|
|
9704
9778
|
const {
|
|
9705
9779
|
inputId,
|
|
9706
9780
|
inputRef,
|
|
@@ -9752,7 +9826,7 @@ var SwitchLabel = React67.forwardRef(function SwitchLabel2({ children, className
|
|
|
9752
9826
|
SwitchLabel.displayName = "SwitchLabel";
|
|
9753
9827
|
function SwitchHint({ children, className, ...rest }) {
|
|
9754
9828
|
const { hintId, registerHint, unregisterHint, size, disabled } = useSwitchContext();
|
|
9755
|
-
|
|
9829
|
+
React68.useLayoutEffect(() => {
|
|
9756
9830
|
registerHint();
|
|
9757
9831
|
return () => {
|
|
9758
9832
|
unregisterHint();
|
|
@@ -9773,7 +9847,7 @@ function SwitchHint({ children, className, ...rest }) {
|
|
|
9773
9847
|
SwitchHint.displayName = "SwitchHint";
|
|
9774
9848
|
function SwitchError({ children, className, ...rest }) {
|
|
9775
9849
|
const { errorId, registerError, unregisterError, size } = useSwitchContext();
|
|
9776
|
-
|
|
9850
|
+
React68.useLayoutEffect(() => {
|
|
9777
9851
|
registerError();
|
|
9778
9852
|
return () => {
|
|
9779
9853
|
unregisterError();
|
|
@@ -9800,7 +9874,7 @@ var Switch = {
|
|
|
9800
9874
|
};
|
|
9801
9875
|
|
|
9802
9876
|
// src/components/tabs/Tabs.tsx
|
|
9803
|
-
import * as
|
|
9877
|
+
import * as React69 from "react";
|
|
9804
9878
|
|
|
9805
9879
|
// src/components/tabs/Tabs.module.css
|
|
9806
9880
|
var Tabs_default = {
|
|
@@ -9827,13 +9901,13 @@ function TabsRoot({
|
|
|
9827
9901
|
children,
|
|
9828
9902
|
className
|
|
9829
9903
|
}) {
|
|
9830
|
-
const rootId =
|
|
9904
|
+
const rootId = React69.useId();
|
|
9831
9905
|
const [activeValue, setActiveValue] = useControllableState({
|
|
9832
9906
|
value,
|
|
9833
9907
|
defaultValue,
|
|
9834
9908
|
onChange: onValueChange
|
|
9835
9909
|
});
|
|
9836
|
-
const contextValue =
|
|
9910
|
+
const contextValue = React69.useMemo(
|
|
9837
9911
|
() => ({ activeValue, onSelect: setActiveValue, orientation, rootId, size }),
|
|
9838
9912
|
[activeValue, setActiveValue, orientation, rootId, size]
|
|
9839
9913
|
);
|
|
@@ -9842,14 +9916,14 @@ function TabsRoot({
|
|
|
9842
9916
|
TabsRoot.displayName = "TabsRoot";
|
|
9843
9917
|
function TabsList({ children, className }) {
|
|
9844
9918
|
const { orientation, rootId, activeValue, onSelect, size } = useTabsContext();
|
|
9845
|
-
const listRef =
|
|
9846
|
-
const [indicator, setIndicator] =
|
|
9919
|
+
const listRef = React69.useRef(null);
|
|
9920
|
+
const [indicator, setIndicator] = React69.useState({
|
|
9847
9921
|
left: 0,
|
|
9848
9922
|
top: 0,
|
|
9849
9923
|
width: 0,
|
|
9850
9924
|
height: 0
|
|
9851
9925
|
});
|
|
9852
|
-
const updateIndicator =
|
|
9926
|
+
const updateIndicator = React69.useCallback(() => {
|
|
9853
9927
|
const list = listRef.current;
|
|
9854
9928
|
if (!list) return;
|
|
9855
9929
|
const active = list.querySelector('[role="tab"][aria-selected="true"]');
|
|
@@ -9864,7 +9938,7 @@ function TabsList({ children, className }) {
|
|
|
9864
9938
|
height: active.offsetHeight
|
|
9865
9939
|
});
|
|
9866
9940
|
}, []);
|
|
9867
|
-
|
|
9941
|
+
React69.useLayoutEffect(() => {
|
|
9868
9942
|
const list = listRef.current;
|
|
9869
9943
|
if (!list) return;
|
|
9870
9944
|
updateIndicator();
|
|
@@ -10011,7 +10085,7 @@ var Tabs = {
|
|
|
10011
10085
|
};
|
|
10012
10086
|
|
|
10013
10087
|
// src/components/tag/Tag.tsx
|
|
10014
|
-
import * as
|
|
10088
|
+
import * as React70 from "react";
|
|
10015
10089
|
|
|
10016
10090
|
// src/components/tag/Tag.module.css
|
|
10017
10091
|
var Tag_default = {
|
|
@@ -10024,7 +10098,7 @@ var Tag_default = {
|
|
|
10024
10098
|
|
|
10025
10099
|
// src/components/tag/Tag.tsx
|
|
10026
10100
|
import { jsx as jsx56, jsxs as jsxs30 } from "react/jsx-runtime";
|
|
10027
|
-
var TagRoot =
|
|
10101
|
+
var TagRoot = React70.forwardRef(
|
|
10028
10102
|
({ size: sizeProp, onRemove, disabled, children, className, ...rest }, ref) => {
|
|
10029
10103
|
const controlSurface = useOptionalControlSize();
|
|
10030
10104
|
const size = sizeProp ?? (controlSurface !== void 0 ? controlSurfaceToInputSize(controlSurface) : "m");
|
|
@@ -10073,7 +10147,7 @@ TagIcon.displayName = "TagIcon";
|
|
|
10073
10147
|
var Tag = { Root: TagRoot, Icon: TagIcon };
|
|
10074
10148
|
|
|
10075
10149
|
// src/components/textarea/Textarea.tsx
|
|
10076
|
-
import * as
|
|
10150
|
+
import * as React71 from "react";
|
|
10077
10151
|
|
|
10078
10152
|
// src/components/textarea/Textarea.module.css
|
|
10079
10153
|
var Textarea_default = {
|
|
@@ -10112,8 +10186,8 @@ TextareaCharCounter.displayName = "Textarea.CharCounter";
|
|
|
10112
10186
|
function partitionTextareaChildren(children) {
|
|
10113
10187
|
const counters = [];
|
|
10114
10188
|
const rest = [];
|
|
10115
|
-
|
|
10116
|
-
if (
|
|
10189
|
+
React71.Children.forEach(children, (child) => {
|
|
10190
|
+
if (React71.isValidElement(child) && child.type === TextareaCharCounter) {
|
|
10117
10191
|
counters.push(child);
|
|
10118
10192
|
} else if (child != null && child !== false) {
|
|
10119
10193
|
rest.push(child);
|
|
@@ -10121,7 +10195,7 @@ function partitionTextareaChildren(children) {
|
|
|
10121
10195
|
});
|
|
10122
10196
|
return { counters, rest };
|
|
10123
10197
|
}
|
|
10124
|
-
var TextareaRoot =
|
|
10198
|
+
var TextareaRoot = React71.forwardRef(
|
|
10125
10199
|
({
|
|
10126
10200
|
id,
|
|
10127
10201
|
className,
|
|
@@ -10138,12 +10212,12 @@ var TextareaRoot = React70.forwardRef(
|
|
|
10138
10212
|
children,
|
|
10139
10213
|
...rest
|
|
10140
10214
|
}, ref) => {
|
|
10141
|
-
const rawId =
|
|
10215
|
+
const rawId = React71.useId();
|
|
10142
10216
|
const inputId = id ?? rawId;
|
|
10143
10217
|
const hintId = `${inputId}-hint`;
|
|
10144
10218
|
const errorId = `${inputId}-error`;
|
|
10145
|
-
const [hasHint, setHasHint] =
|
|
10146
|
-
const [hasError, setHasError] =
|
|
10219
|
+
const [hasHint, setHasHint] = React71.useState(false);
|
|
10220
|
+
const [hasError, setHasError] = React71.useState(false);
|
|
10147
10221
|
const invalid = variant === "error" || hasError;
|
|
10148
10222
|
const resolvedAriaInvalid = ariaInvalid ?? (invalid || void 0);
|
|
10149
10223
|
const parts = [
|
|
@@ -10152,25 +10226,25 @@ var TextareaRoot = React70.forwardRef(
|
|
|
10152
10226
|
hasError ? errorId : void 0
|
|
10153
10227
|
].filter(Boolean);
|
|
10154
10228
|
const describedBy = parts.length > 0 ? parts.join(" ") : void 0;
|
|
10155
|
-
const registerHint =
|
|
10156
|
-
const unregisterHint =
|
|
10157
|
-
const registerError =
|
|
10158
|
-
const unregisterError =
|
|
10159
|
-
const wrapperRef =
|
|
10229
|
+
const registerHint = React71.useCallback(() => setHasHint(true), []);
|
|
10230
|
+
const unregisterHint = React71.useCallback(() => setHasHint(false), []);
|
|
10231
|
+
const registerError = React71.useCallback(() => setHasError(true), []);
|
|
10232
|
+
const unregisterError = React71.useCallback(() => setHasError(false), []);
|
|
10233
|
+
const wrapperRef = React71.useRef(null);
|
|
10160
10234
|
const { counters: counterChildren, rest: otherChildren } = partitionTextareaChildren(children);
|
|
10161
10235
|
const showFooter = counterChildren.length > 0;
|
|
10162
|
-
|
|
10236
|
+
React71.useLayoutEffect(() => {
|
|
10163
10237
|
if (!autoResize || !wrapperRef.current) return;
|
|
10164
10238
|
const textarea = wrapperRef.current.querySelector("textarea");
|
|
10165
10239
|
if (textarea) {
|
|
10166
10240
|
wrapperRef.current.dataset.value = textarea.value;
|
|
10167
10241
|
}
|
|
10168
10242
|
}, [autoResize]);
|
|
10169
|
-
|
|
10243
|
+
React71.useEffect(() => {
|
|
10170
10244
|
if (!autoResize || !wrapperRef.current || typeof value !== "string") return;
|
|
10171
10245
|
wrapperRef.current.dataset.value = value;
|
|
10172
10246
|
}, [autoResize, value]);
|
|
10173
|
-
const handleInput =
|
|
10247
|
+
const handleInput = React71.useCallback(
|
|
10174
10248
|
(e) => {
|
|
10175
10249
|
if (autoResize && wrapperRef.current) {
|
|
10176
10250
|
wrapperRef.current.dataset.value = e.currentTarget.value;
|
|
@@ -10179,7 +10253,7 @@ var TextareaRoot = React70.forwardRef(
|
|
|
10179
10253
|
},
|
|
10180
10254
|
[autoResize, onInput]
|
|
10181
10255
|
);
|
|
10182
|
-
const ctxValue =
|
|
10256
|
+
const ctxValue = React71.useMemo(
|
|
10183
10257
|
() => ({
|
|
10184
10258
|
hintId,
|
|
10185
10259
|
errorId,
|
|
@@ -10245,7 +10319,7 @@ var TextareaRoot = React70.forwardRef(
|
|
|
10245
10319
|
TextareaRoot.displayName = "Textarea.Root";
|
|
10246
10320
|
function TextareaHint({ children, className, ...rest }) {
|
|
10247
10321
|
const { hintId, registerHint, unregisterHint, size, disabled, readOnly } = useTextareaContext();
|
|
10248
|
-
|
|
10322
|
+
React71.useLayoutEffect(() => {
|
|
10249
10323
|
registerHint();
|
|
10250
10324
|
return () => {
|
|
10251
10325
|
unregisterHint();
|
|
@@ -10266,7 +10340,7 @@ function TextareaHint({ children, className, ...rest }) {
|
|
|
10266
10340
|
TextareaHint.displayName = "Textarea.Hint";
|
|
10267
10341
|
function TextareaError({ children, className, ...rest }) {
|
|
10268
10342
|
const { errorId, registerError, unregisterError, size } = useTextareaContext();
|
|
10269
|
-
|
|
10343
|
+
React71.useLayoutEffect(() => {
|
|
10270
10344
|
registerError();
|
|
10271
10345
|
return () => {
|
|
10272
10346
|
unregisterError();
|