prime-ui-kit 0.7.3 → 0.7.7
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.css +326 -34
- package/dist/components/index.css.map +4 -4
- package/dist/components/index.d.ts +2 -0
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/index.js +1363 -588
- package/dist/components/index.js.map +4 -4
- package/dist/components/select/Select.d.ts +26 -9
- package/dist/components/select/Select.d.ts.map +1 -1
- package/dist/components/select/examples/pattern-multiple.d.ts +3 -0
- package/dist/components/select/examples/pattern-multiple.d.ts.map +1 -0
- package/dist/components/tag-select/TagSelect.d.ts +43 -0
- package/dist/components/tag-select/TagSelect.d.ts.map +1 -0
- package/dist/components/tag-select/examples/pattern-canonical.d.ts +3 -0
- package/dist/components/tag-select/examples/pattern-canonical.d.ts.map +1 -0
- package/dist/components/tag-select/examples/pattern-features.d.ts +3 -0
- package/dist/components/tag-select/examples/pattern-features.d.ts.map +1 -0
- package/dist/hooks/usePosition.d.ts.map +1 -1
- package/dist/index.css +328 -36
- package/dist/index.css.map +4 -4
- package/dist/index.js +1363 -588
- 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/dist/tokens/semantic.d.ts +1 -1
- package/package.json +1 -1
- package/src/components/select/COMPONENT.md +91 -32
- package/src/components/select/examples/pattern-multiple.tsx +30 -0
- package/src/components/tag-select/COMPONENT.md +108 -0
- package/src/components/tag-select/examples/examples.module.css +14 -0
- package/src/components/tag-select/examples/pattern-canonical.tsx +28 -0
- package/src/components/tag-select/examples/pattern-features.tsx +32 -0
- package/src/styles/theme-dark.css +1 -1
- package/src/styles/theme-light.css +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,20 +3827,24 @@ 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;
|
|
3761
|
-
|
|
3762
|
-
|
|
3763
|
-
|
|
3764
|
-
|
|
3765
|
-
content.style.
|
|
3835
|
+
const nextTop = `${pos.top}px`;
|
|
3836
|
+
const nextLeft = `${pos.left}px`;
|
|
3837
|
+
const nextMinW = pos.minWidth !== void 0 ? `${pos.minWidth}px` : "";
|
|
3838
|
+
const nextMaxH = pos.maxHeight !== void 0 ? `${pos.maxHeight}px` : "";
|
|
3839
|
+
if (content.style.position !== pos.position) content.style.position = pos.position;
|
|
3840
|
+
if (content.style.top !== nextTop) content.style.top = nextTop;
|
|
3841
|
+
if (content.style.left !== nextLeft) content.style.left = nextLeft;
|
|
3842
|
+
if (content.style.minWidth !== nextMinW) content.style.minWidth = nextMinW;
|
|
3843
|
+
if (content.style.maxHeight !== nextMaxH) content.style.maxHeight = nextMaxH;
|
|
3766
3844
|
},
|
|
3767
3845
|
[contentRef]
|
|
3768
3846
|
);
|
|
3769
|
-
const update =
|
|
3847
|
+
const update = React37.useCallback(() => {
|
|
3770
3848
|
const anchor = anchorRef.current;
|
|
3771
3849
|
const content = contentRef.current;
|
|
3772
3850
|
if (!anchor) return void 0;
|
|
@@ -3780,7 +3858,7 @@ function usePosition(anchorRef, contentRef, options = {}) {
|
|
|
3780
3858
|
window.innerHeight,
|
|
3781
3859
|
{ preferredSide, align, offset, viewportPad, flip, matchTriggerMinWidth }
|
|
3782
3860
|
);
|
|
3783
|
-
setResolvedSide(pos.resolvedSide);
|
|
3861
|
+
setResolvedSide((prev) => pos.resolvedSide === prev ? prev : pos.resolvedSide);
|
|
3784
3862
|
applyPositionStyle({
|
|
3785
3863
|
position: "fixed",
|
|
3786
3864
|
top: pos.top,
|
|
@@ -3803,6 +3881,21 @@ function usePosition(anchorRef, contentRef, options = {}) {
|
|
|
3803
3881
|
return { resolvedSide, update };
|
|
3804
3882
|
}
|
|
3805
3883
|
|
|
3884
|
+
// src/internal/scrollAncestors.ts
|
|
3885
|
+
var SCROLLABLE = /^(auto|scroll|overlay)$/;
|
|
3886
|
+
function getScrollContainers(node) {
|
|
3887
|
+
const out = [window];
|
|
3888
|
+
if (!node || typeof window === "undefined") return out;
|
|
3889
|
+
for (let el = node.parentElement; el; el = el.parentElement) {
|
|
3890
|
+
const { overflowX, overflowY } = window.getComputedStyle(el);
|
|
3891
|
+
if (SCROLLABLE.test(overflowY) || SCROLLABLE.test(overflowX)) {
|
|
3892
|
+
out.push(el);
|
|
3893
|
+
}
|
|
3894
|
+
}
|
|
3895
|
+
if (window.visualViewport) out.push(window.visualViewport);
|
|
3896
|
+
return out;
|
|
3897
|
+
}
|
|
3898
|
+
|
|
3806
3899
|
// src/components/select/Select.module.css
|
|
3807
3900
|
var Select_default = {
|
|
3808
3901
|
trigger: "Select_trigger2",
|
|
@@ -3884,13 +3977,22 @@ function handleSelectListboxKeyDown(e, ctx) {
|
|
|
3884
3977
|
|
|
3885
3978
|
// src/components/select/Select.tsx
|
|
3886
3979
|
import { jsx as jsx26, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
3980
|
+
var SELECT_LISTBOX_POSITION_OPTS = {
|
|
3981
|
+
side: "bottom",
|
|
3982
|
+
align: "start"
|
|
3983
|
+
};
|
|
3887
3984
|
var [SelectProvider, useSelectContext] = createComponentContext("Select");
|
|
3888
3985
|
function SelectRoot(props) {
|
|
3889
|
-
|
|
3890
|
-
|
|
3891
|
-
|
|
3986
|
+
if (props.multiple === true) {
|
|
3987
|
+
if (props.native === true) {
|
|
3988
|
+
return /* @__PURE__ */ jsx26(SelectNativeMultiRoot, { ...props });
|
|
3989
|
+
}
|
|
3990
|
+
return /* @__PURE__ */ jsx26(SelectComboboxMultiRoot, { ...props });
|
|
3892
3991
|
}
|
|
3893
|
-
|
|
3992
|
+
if (props.native === true) {
|
|
3993
|
+
return /* @__PURE__ */ jsx26(SelectNativeRoot, { ...props });
|
|
3994
|
+
}
|
|
3995
|
+
return /* @__PURE__ */ jsx26(SelectComboboxRoot, { ...props });
|
|
3894
3996
|
}
|
|
3895
3997
|
SelectRoot.displayName = "SelectRoot";
|
|
3896
3998
|
function SelectComboboxRoot({
|
|
@@ -3903,7 +4005,7 @@ function SelectComboboxRoot({
|
|
|
3903
4005
|
hasError = false,
|
|
3904
4006
|
children
|
|
3905
4007
|
}) {
|
|
3906
|
-
const handleChange =
|
|
4008
|
+
const handleChange = React38.useCallback(
|
|
3907
4009
|
(v) => {
|
|
3908
4010
|
if (v !== void 0) onChange?.(v);
|
|
3909
4011
|
},
|
|
@@ -3914,21 +4016,21 @@ function SelectComboboxRoot({
|
|
|
3914
4016
|
defaultValue,
|
|
3915
4017
|
onChange: handleChange
|
|
3916
4018
|
});
|
|
3917
|
-
const [selectedLabelBinding, setSelectedLabelBinding] =
|
|
3918
|
-
const [isOpen, setIsOpen] =
|
|
3919
|
-
const [highlightedValue, setHighlightedValue] =
|
|
3920
|
-
const generatedId =
|
|
4019
|
+
const [selectedLabelBinding, setSelectedLabelBinding] = React38.useState(void 0);
|
|
4020
|
+
const [isOpen, setIsOpen] = React38.useState(false);
|
|
4021
|
+
const [highlightedValue, setHighlightedValue] = React38.useState(void 0);
|
|
4022
|
+
const generatedId = React38.useId();
|
|
3921
4023
|
const triggerId = `${generatedId}-trigger`;
|
|
3922
4024
|
const listboxId = `${generatedId}-listbox`;
|
|
3923
|
-
const triggerRef =
|
|
3924
|
-
const selectedValueRef =
|
|
4025
|
+
const triggerRef = React38.useRef(null);
|
|
4026
|
+
const selectedValueRef = React38.useRef(selectedValue);
|
|
3925
4027
|
selectedValueRef.current = selectedValue;
|
|
3926
|
-
const onInitLabel =
|
|
4028
|
+
const onInitLabel = React38.useCallback((val, label) => {
|
|
3927
4029
|
if (val === selectedValueRef.current) {
|
|
3928
4030
|
setSelectedLabelBinding({ value: val, label });
|
|
3929
4031
|
}
|
|
3930
4032
|
}, []);
|
|
3931
|
-
const onSelect =
|
|
4033
|
+
const onSelect = React38.useCallback(
|
|
3932
4034
|
(val, label) => {
|
|
3933
4035
|
setSelectedValue(val);
|
|
3934
4036
|
setSelectedLabelBinding({ value: val, label });
|
|
@@ -3936,38 +4038,144 @@ function SelectComboboxRoot({
|
|
|
3936
4038
|
},
|
|
3937
4039
|
[setSelectedValue]
|
|
3938
4040
|
);
|
|
3939
|
-
const onClose =
|
|
3940
|
-
const onOpen =
|
|
3941
|
-
|
|
3942
|
-
|
|
3943
|
-
|
|
3944
|
-
|
|
3945
|
-
|
|
3946
|
-
|
|
3947
|
-
|
|
3948
|
-
|
|
3949
|
-
|
|
3950
|
-
|
|
3951
|
-
|
|
3952
|
-
|
|
3953
|
-
|
|
3954
|
-
|
|
3955
|
-
|
|
3956
|
-
|
|
3957
|
-
|
|
3958
|
-
|
|
3959
|
-
|
|
3960
|
-
|
|
3961
|
-
|
|
3962
|
-
|
|
3963
|
-
|
|
4041
|
+
const onClose = React38.useCallback(() => setIsOpen(false), []);
|
|
4042
|
+
const onOpen = React38.useCallback(() => setIsOpen(true), []);
|
|
4043
|
+
const contextValue = React38.useMemo(
|
|
4044
|
+
() => ({
|
|
4045
|
+
size,
|
|
4046
|
+
hasError,
|
|
4047
|
+
isOpen,
|
|
4048
|
+
multiple: false,
|
|
4049
|
+
selectedValue,
|
|
4050
|
+
selectedLabelBinding,
|
|
4051
|
+
selectedValues: [],
|
|
4052
|
+
labelsByValue: {},
|
|
4053
|
+
onSelect,
|
|
4054
|
+
onClose,
|
|
4055
|
+
onOpen,
|
|
4056
|
+
highlightedValue,
|
|
4057
|
+
setHighlightedValue,
|
|
4058
|
+
triggerId,
|
|
4059
|
+
listboxId,
|
|
4060
|
+
triggerRef,
|
|
4061
|
+
disabled,
|
|
4062
|
+
placeholder,
|
|
4063
|
+
onInitLabel
|
|
4064
|
+
}),
|
|
4065
|
+
[
|
|
4066
|
+
size,
|
|
4067
|
+
hasError,
|
|
4068
|
+
isOpen,
|
|
4069
|
+
selectedValue,
|
|
4070
|
+
selectedLabelBinding,
|
|
4071
|
+
onSelect,
|
|
4072
|
+
onClose,
|
|
4073
|
+
onOpen,
|
|
4074
|
+
highlightedValue,
|
|
4075
|
+
triggerId,
|
|
4076
|
+
listboxId,
|
|
4077
|
+
disabled,
|
|
4078
|
+
placeholder,
|
|
4079
|
+
onInitLabel
|
|
4080
|
+
]
|
|
3964
4081
|
);
|
|
4082
|
+
return /* @__PURE__ */ jsx26(SelectProvider, { value: contextValue, children: /* @__PURE__ */ jsx26(ControlSizeProvider, { value: size, children }) });
|
|
3965
4083
|
}
|
|
3966
4084
|
SelectComboboxRoot.displayName = "SelectComboboxRoot";
|
|
3967
|
-
|
|
4085
|
+
function SelectComboboxMultiRoot({
|
|
4086
|
+
size = "m",
|
|
4087
|
+
value,
|
|
4088
|
+
defaultValue,
|
|
4089
|
+
onChange,
|
|
4090
|
+
disabled,
|
|
4091
|
+
placeholder,
|
|
4092
|
+
hasError = false,
|
|
4093
|
+
children
|
|
4094
|
+
}) {
|
|
4095
|
+
const handleChange = React38.useCallback(
|
|
4096
|
+
(next) => {
|
|
4097
|
+
onChange?.(next);
|
|
4098
|
+
},
|
|
4099
|
+
[onChange]
|
|
4100
|
+
);
|
|
4101
|
+
const [selectedValues, setSelectedValues] = useControllableState({
|
|
4102
|
+
value,
|
|
4103
|
+
defaultValue: defaultValue ?? [],
|
|
4104
|
+
onChange: handleChange
|
|
4105
|
+
});
|
|
4106
|
+
const [labelsByValue, setLabelsByValue] = React38.useState({});
|
|
4107
|
+
const [isOpen, setIsOpen] = React38.useState(false);
|
|
4108
|
+
const [highlightedValue, setHighlightedValue] = React38.useState(void 0);
|
|
4109
|
+
const generatedId = React38.useId();
|
|
4110
|
+
const triggerId = `${generatedId}-trigger`;
|
|
4111
|
+
const listboxId = `${generatedId}-listbox`;
|
|
4112
|
+
const triggerRef = React38.useRef(null);
|
|
4113
|
+
const onInitLabel = React38.useCallback((val, label) => {
|
|
4114
|
+
setLabelsByValue((prev) => {
|
|
4115
|
+
if (prev[val] === label) return prev;
|
|
4116
|
+
return { ...prev, [val]: label };
|
|
4117
|
+
});
|
|
4118
|
+
}, []);
|
|
4119
|
+
const onSelect = React38.useCallback(
|
|
4120
|
+
(val, label) => {
|
|
4121
|
+
setLabelsByValue((prev) => ({ ...prev, [val]: label }));
|
|
4122
|
+
setSelectedValues((prev) => {
|
|
4123
|
+
if (prev.includes(val)) {
|
|
4124
|
+
return prev.filter((x) => x !== val);
|
|
4125
|
+
}
|
|
4126
|
+
return [...prev, val];
|
|
4127
|
+
});
|
|
4128
|
+
},
|
|
4129
|
+
[setSelectedValues]
|
|
4130
|
+
);
|
|
4131
|
+
const onClose = React38.useCallback(() => setIsOpen(false), []);
|
|
4132
|
+
const onOpen = React38.useCallback(() => setIsOpen(true), []);
|
|
4133
|
+
const contextValue = React38.useMemo(
|
|
4134
|
+
() => ({
|
|
4135
|
+
size,
|
|
4136
|
+
hasError,
|
|
4137
|
+
isOpen,
|
|
4138
|
+
multiple: true,
|
|
4139
|
+
selectedValue: void 0,
|
|
4140
|
+
selectedLabelBinding: void 0,
|
|
4141
|
+
selectedValues,
|
|
4142
|
+
labelsByValue,
|
|
4143
|
+
onSelect,
|
|
4144
|
+
onClose,
|
|
4145
|
+
onOpen,
|
|
4146
|
+
highlightedValue,
|
|
4147
|
+
setHighlightedValue,
|
|
4148
|
+
triggerId,
|
|
4149
|
+
listboxId,
|
|
4150
|
+
triggerRef,
|
|
4151
|
+
disabled,
|
|
4152
|
+
placeholder,
|
|
4153
|
+
onInitLabel
|
|
4154
|
+
}),
|
|
4155
|
+
[
|
|
4156
|
+
size,
|
|
4157
|
+
hasError,
|
|
4158
|
+
isOpen,
|
|
4159
|
+
selectedValues,
|
|
4160
|
+
labelsByValue,
|
|
4161
|
+
onSelect,
|
|
4162
|
+
onClose,
|
|
4163
|
+
onOpen,
|
|
4164
|
+
highlightedValue,
|
|
4165
|
+
triggerId,
|
|
4166
|
+
listboxId,
|
|
4167
|
+
disabled,
|
|
4168
|
+
placeholder,
|
|
4169
|
+
onInitLabel
|
|
4170
|
+
]
|
|
4171
|
+
);
|
|
4172
|
+
return /* @__PURE__ */ jsx26(SelectProvider, { value: contextValue, children: /* @__PURE__ */ jsx26(ControlSizeProvider, { value: size, children }) });
|
|
4173
|
+
}
|
|
4174
|
+
SelectComboboxMultiRoot.displayName = "SelectComboboxMultiRoot";
|
|
4175
|
+
var SelectTrigger = React38.forwardRef(
|
|
3968
4176
|
({ className, children, onClick, onKeyDown, ...rest }, forwardedRef) => {
|
|
3969
4177
|
const { isOpen, onOpen, onClose, triggerId, listboxId, disabled, size, hasError, triggerRef } = useSelectContext();
|
|
3970
|
-
const setRefs =
|
|
4178
|
+
const setRefs = React38.useCallback(
|
|
3971
4179
|
(el) => {
|
|
3972
4180
|
triggerRef.current = el;
|
|
3973
4181
|
if (typeof forwardedRef === "function") {
|
|
@@ -4018,7 +4226,20 @@ var SelectTrigger = React37.forwardRef(
|
|
|
4018
4226
|
);
|
|
4019
4227
|
SelectTrigger.displayName = "SelectTrigger";
|
|
4020
4228
|
function SelectValue({ className }) {
|
|
4021
|
-
const
|
|
4229
|
+
const ctx = useSelectContext();
|
|
4230
|
+
if (ctx.multiple) {
|
|
4231
|
+
const { selectedValues, labelsByValue, placeholder: placeholder2 } = ctx;
|
|
4232
|
+
const display2 = selectedValues.length === 0 ? placeholder2 : selectedValues.map((v) => labelsByValue[v] ?? v).join(", ");
|
|
4233
|
+
return /* @__PURE__ */ jsx26(
|
|
4234
|
+
"span",
|
|
4235
|
+
{
|
|
4236
|
+
className: cx(Select_default.triggerValue, className),
|
|
4237
|
+
...toDataAttributes({ placeholder: display2 == null || display2 === "" }),
|
|
4238
|
+
children: display2
|
|
4239
|
+
}
|
|
4240
|
+
);
|
|
4241
|
+
}
|
|
4242
|
+
const { selectedLabelBinding, selectedValue, placeholder } = ctx;
|
|
4022
4243
|
const display = selectedLabelBinding && selectedLabelBinding.value === selectedValue ? selectedLabelBinding.label : selectedValue ?? placeholder;
|
|
4023
4244
|
return /* @__PURE__ */ jsx26(
|
|
4024
4245
|
"span",
|
|
@@ -4045,67 +4266,109 @@ function SelectContent({ className, children }) {
|
|
|
4045
4266
|
highlightedValue,
|
|
4046
4267
|
setHighlightedValue,
|
|
4047
4268
|
selectedValue,
|
|
4269
|
+
selectedValues,
|
|
4270
|
+
multiple,
|
|
4048
4271
|
size
|
|
4049
4272
|
} = useSelectContext();
|
|
4273
|
+
const selectedValueRef = React38.useRef(selectedValue);
|
|
4274
|
+
selectedValueRef.current = selectedValue;
|
|
4275
|
+
const selectedValuesRef = React38.useRef(selectedValues);
|
|
4276
|
+
selectedValuesRef.current = selectedValues;
|
|
4277
|
+
const multipleRef = React38.useRef(multiple);
|
|
4278
|
+
multipleRef.current = multiple;
|
|
4050
4279
|
const overlayPortalLayer = useOverlayPortalLayer();
|
|
4051
|
-
const contentRef =
|
|
4052
|
-
const { resolvedSide, update } = usePosition(
|
|
4053
|
-
|
|
4054
|
-
|
|
4055
|
-
|
|
4056
|
-
|
|
4057
|
-
|
|
4280
|
+
const contentRef = React38.useRef(null);
|
|
4281
|
+
const { resolvedSide, update } = usePosition(
|
|
4282
|
+
triggerRef,
|
|
4283
|
+
contentRef,
|
|
4284
|
+
SELECT_LISTBOX_POSITION_OPTS
|
|
4285
|
+
);
|
|
4286
|
+
const updateRef = React38.useRef(update);
|
|
4287
|
+
updateRef.current = update;
|
|
4288
|
+
const getItems = React38.useCallback(() => queryEnabledSelectOptions(contentRef.current), []);
|
|
4289
|
+
React38.useLayoutEffect(() => {
|
|
4058
4290
|
if (!isOpen) return;
|
|
4059
|
-
|
|
4060
|
-
const rafId = requestAnimationFrame(() =>
|
|
4291
|
+
updateRef.current();
|
|
4292
|
+
const rafId = requestAnimationFrame(() => updateRef.current());
|
|
4061
4293
|
return () => cancelAnimationFrame(rafId);
|
|
4062
|
-
}, [isOpen
|
|
4063
|
-
|
|
4294
|
+
}, [isOpen]);
|
|
4295
|
+
React38.useEffect(() => {
|
|
4064
4296
|
if (!isOpen) {
|
|
4065
4297
|
setHighlightedValue(void 0);
|
|
4066
4298
|
return;
|
|
4067
4299
|
}
|
|
4068
|
-
const reposition = () => {
|
|
4069
|
-
requestAnimationFrame(() => update());
|
|
4070
|
-
};
|
|
4071
4300
|
const bootstrap = () => {
|
|
4072
4301
|
requestAnimationFrame(() => {
|
|
4073
4302
|
const el = contentRef.current;
|
|
4074
4303
|
if (!el) return;
|
|
4075
4304
|
el.focus({ preventScroll: true });
|
|
4076
4305
|
const items = queryEnabledSelectOptions(el);
|
|
4077
|
-
|
|
4078
|
-
|
|
4079
|
-
|
|
4306
|
+
if (multipleRef.current) {
|
|
4307
|
+
const sv = selectedValuesRef.current;
|
|
4308
|
+
const firstSelected = sv.find((v) => items.some((i) => i.dataset.value === v));
|
|
4309
|
+
setHighlightedValue(firstSelected ?? void 0);
|
|
4310
|
+
} else {
|
|
4311
|
+
const sv = selectedValueRef.current;
|
|
4312
|
+
const selectedIndex = items.findIndex((i) => i.dataset.value === sv);
|
|
4313
|
+
if (selectedIndex >= 0 && sv) {
|
|
4314
|
+
setHighlightedValue(sv);
|
|
4315
|
+
}
|
|
4080
4316
|
}
|
|
4081
4317
|
});
|
|
4082
4318
|
};
|
|
4083
4319
|
bootstrap();
|
|
4084
|
-
|
|
4320
|
+
}, [isOpen, setHighlightedValue]);
|
|
4321
|
+
React38.useEffect(() => {
|
|
4322
|
+
if (!isOpen) return;
|
|
4323
|
+
let rafCoalesce = 0;
|
|
4324
|
+
const schedule = () => {
|
|
4325
|
+
cancelAnimationFrame(rafCoalesce);
|
|
4326
|
+
rafCoalesce = requestAnimationFrame(() => updateRef.current());
|
|
4327
|
+
};
|
|
4328
|
+
window.addEventListener("resize", schedule);
|
|
4329
|
+
const scrollTargets = getScrollContainers(triggerRef.current);
|
|
4330
|
+
for (const t of scrollTargets) {
|
|
4331
|
+
t.addEventListener("scroll", schedule, { passive: true });
|
|
4332
|
+
}
|
|
4085
4333
|
const vv = window.visualViewport;
|
|
4086
|
-
vv?.addEventListener("resize",
|
|
4334
|
+
vv?.addEventListener("resize", schedule);
|
|
4335
|
+
const panel = contentRef.current;
|
|
4336
|
+
let ro = null;
|
|
4337
|
+
if (typeof ResizeObserver !== "undefined" && panel) {
|
|
4338
|
+
ro = new ResizeObserver(schedule);
|
|
4339
|
+
ro.observe(panel);
|
|
4340
|
+
}
|
|
4087
4341
|
return () => {
|
|
4088
|
-
|
|
4089
|
-
|
|
4342
|
+
cancelAnimationFrame(rafCoalesce);
|
|
4343
|
+
window.removeEventListener("resize", schedule);
|
|
4344
|
+
for (const t of scrollTargets) {
|
|
4345
|
+
t.removeEventListener("scroll", schedule);
|
|
4346
|
+
}
|
|
4347
|
+
vv?.removeEventListener("resize", schedule);
|
|
4348
|
+
ro?.disconnect();
|
|
4090
4349
|
};
|
|
4091
|
-
}, [isOpen,
|
|
4350
|
+
}, [isOpen, triggerRef]);
|
|
4092
4351
|
useEscapeKey({ enabled: isOpen, onEscape: onClose });
|
|
4093
4352
|
useOutsideClick({ refs: [triggerRef, contentRef], enabled: isOpen, onOutsideClick: onClose });
|
|
4094
|
-
const handleKeyDown = (
|
|
4095
|
-
|
|
4096
|
-
|
|
4097
|
-
|
|
4098
|
-
|
|
4099
|
-
|
|
4100
|
-
|
|
4101
|
-
|
|
4102
|
-
|
|
4353
|
+
const handleKeyDown = React38.useCallback(
|
|
4354
|
+
(e) => {
|
|
4355
|
+
handleSelectListboxKeyDown(e, {
|
|
4356
|
+
items: getItems(),
|
|
4357
|
+
highlightedValue,
|
|
4358
|
+
setHighlightedValue,
|
|
4359
|
+
onSelect,
|
|
4360
|
+
onClose
|
|
4361
|
+
});
|
|
4362
|
+
},
|
|
4363
|
+
[getItems, highlightedValue, setHighlightedValue, onSelect, onClose]
|
|
4364
|
+
);
|
|
4103
4365
|
return /* @__PURE__ */ jsx26(Portal, { children: /* @__PURE__ */ jsx26(
|
|
4104
4366
|
ScrollContainer,
|
|
4105
4367
|
{
|
|
4106
4368
|
ref: contentRef,
|
|
4107
4369
|
id: listboxId,
|
|
4108
4370
|
role: "listbox",
|
|
4371
|
+
"aria-multiselectable": multiple ? true : void 0,
|
|
4109
4372
|
"aria-labelledby": triggerId,
|
|
4110
4373
|
"aria-hidden": !isOpen,
|
|
4111
4374
|
tabIndex: -1,
|
|
@@ -4124,6 +4387,17 @@ function SelectItemIcon({ className, children, ...rest }) {
|
|
|
4124
4387
|
return /* @__PURE__ */ jsx26("span", { className: cx(Select_default.itemIcon, className), ...rest, children });
|
|
4125
4388
|
}
|
|
4126
4389
|
SelectItemIcon.displayName = "SelectItemIcon";
|
|
4390
|
+
var SELECT_ITEM_ICON_MARKER = "__primeSelectItemIcon";
|
|
4391
|
+
Object.assign(SelectItemIcon, { [SELECT_ITEM_ICON_MARKER]: true });
|
|
4392
|
+
function isSelectItemIconType(type) {
|
|
4393
|
+
if (type === SelectItemIcon) return true;
|
|
4394
|
+
if (typeof type === "function") {
|
|
4395
|
+
const fn = type;
|
|
4396
|
+
if (fn[SELECT_ITEM_ICON_MARKER] === true) return true;
|
|
4397
|
+
if (fn.displayName === "SelectItemIcon") return true;
|
|
4398
|
+
}
|
|
4399
|
+
return false;
|
|
4400
|
+
}
|
|
4127
4401
|
function selectItemTextFromRest(rest) {
|
|
4128
4402
|
const parts = [];
|
|
4129
4403
|
for (const node of rest) {
|
|
@@ -4137,8 +4411,8 @@ function selectItemTextFromRest(rest) {
|
|
|
4137
4411
|
function partitionSelectItemChildren(children) {
|
|
4138
4412
|
const icons = [];
|
|
4139
4413
|
const rest = [];
|
|
4140
|
-
|
|
4141
|
-
if (
|
|
4414
|
+
React38.Children.forEach(children, (child) => {
|
|
4415
|
+
if (React38.isValidElement(child) && isSelectItemIconType(child.type)) {
|
|
4142
4416
|
icons.push(child);
|
|
4143
4417
|
} else if (child != null && child !== false) {
|
|
4144
4418
|
rest.push(child);
|
|
@@ -4146,14 +4420,23 @@ function partitionSelectItemChildren(children) {
|
|
|
4146
4420
|
});
|
|
4147
4421
|
return { icons, rest };
|
|
4148
4422
|
}
|
|
4149
|
-
var SelectItem =
|
|
4423
|
+
var SelectItem = React38.forwardRef(
|
|
4150
4424
|
({ value, label, disabled, className, children }, ref) => {
|
|
4151
|
-
const {
|
|
4425
|
+
const {
|
|
4426
|
+
multiple,
|
|
4427
|
+
size,
|
|
4428
|
+
selectedValue,
|
|
4429
|
+
selectedValues,
|
|
4430
|
+
highlightedValue,
|
|
4431
|
+
setHighlightedValue,
|
|
4432
|
+
onSelect,
|
|
4433
|
+
onInitLabel
|
|
4434
|
+
} = useSelectContext();
|
|
4152
4435
|
const { icons, rest } = partitionSelectItemChildren(children);
|
|
4153
|
-
const isSelected = selectedValue === value;
|
|
4436
|
+
const isSelected = multiple ? selectedValues.includes(value) : selectedValue === value;
|
|
4154
4437
|
const isHighlighted = highlightedValue === value;
|
|
4155
4438
|
const resolvedLabel = label ?? selectItemTextFromRest(rest) ?? (typeof children === "string" ? children : void 0) ?? value;
|
|
4156
|
-
|
|
4439
|
+
React38.useEffect(() => {
|
|
4157
4440
|
onInitLabel(value, resolvedLabel);
|
|
4158
4441
|
}, [value, resolvedLabel, onInitLabel, selectedValue]);
|
|
4159
4442
|
const handleClick = () => {
|
|
@@ -4185,11 +4468,12 @@ var SelectItem = React37.forwardRef(
|
|
|
4185
4468
|
label: resolvedLabel,
|
|
4186
4469
|
selected: isSelected,
|
|
4187
4470
|
highlighted: isHighlighted,
|
|
4188
|
-
disabled: Boolean(disabled)
|
|
4471
|
+
disabled: Boolean(disabled),
|
|
4472
|
+
size
|
|
4189
4473
|
}),
|
|
4190
4474
|
children: [
|
|
4191
4475
|
icons.map(
|
|
4192
|
-
(icon, index) =>
|
|
4476
|
+
(icon, index) => React38.cloneElement(icon, {
|
|
4193
4477
|
key: icon.key ?? `prime-select-item-icon-${String(index)}`
|
|
4194
4478
|
})
|
|
4195
4479
|
),
|
|
@@ -4206,7 +4490,8 @@ function SelectGroup({ className, ...rest }) {
|
|
|
4206
4490
|
}
|
|
4207
4491
|
SelectGroup.displayName = "SelectGroup";
|
|
4208
4492
|
function SelectGroupLabel({ className, ...rest }) {
|
|
4209
|
-
|
|
4493
|
+
const { size } = useSelectContext();
|
|
4494
|
+
return /* @__PURE__ */ jsx26("div", { className: cx(Select_default.groupLabel, className), ...rest, ...toDataAttributes({ size }) });
|
|
4210
4495
|
}
|
|
4211
4496
|
SelectGroupLabel.displayName = "SelectGroupLabel";
|
|
4212
4497
|
function SelectSeparator({ className, ...rest }) {
|
|
@@ -4217,7 +4502,7 @@ function extractPlainTextFromNode(node) {
|
|
|
4217
4502
|
if (node == null || typeof node === "boolean") return "";
|
|
4218
4503
|
if (typeof node === "string" || typeof node === "number") return String(node);
|
|
4219
4504
|
if (Array.isArray(node)) return node.map(extractPlainTextFromNode).join("");
|
|
4220
|
-
if (
|
|
4505
|
+
if (React38.isValidElement(node)) {
|
|
4221
4506
|
const p = node.props;
|
|
4222
4507
|
if (p != null && typeof p === "object" && "children" in p) {
|
|
4223
4508
|
return extractPlainTextFromNode(p.children);
|
|
@@ -4236,10 +4521,10 @@ function walkNativeOptions(node) {
|
|
|
4236
4521
|
let firstEnabledValue;
|
|
4237
4522
|
let keyIndex = 0;
|
|
4238
4523
|
const visit = (n) => {
|
|
4239
|
-
|
|
4524
|
+
React38.Children.forEach(n, (child) => {
|
|
4240
4525
|
if (child == null || child === false) return;
|
|
4241
|
-
if (!
|
|
4242
|
-
if (child.type ===
|
|
4526
|
+
if (!React38.isValidElement(child)) return;
|
|
4527
|
+
if (child.type === React38.Fragment) {
|
|
4243
4528
|
visit(child.props.children);
|
|
4244
4529
|
return;
|
|
4245
4530
|
}
|
|
@@ -4258,8 +4543,8 @@ function walkNativeOptions(node) {
|
|
|
4258
4543
|
const ogKey = keyIndex;
|
|
4259
4544
|
let groupLabel = "";
|
|
4260
4545
|
const groupNodes = [];
|
|
4261
|
-
|
|
4262
|
-
if (!
|
|
4546
|
+
React38.Children.forEach(child.props.children, (gc) => {
|
|
4547
|
+
if (!React38.isValidElement(gc)) return;
|
|
4263
4548
|
if (gc.type === SelectGroupLabel) {
|
|
4264
4549
|
groupLabel = extractPlainTextFromNode(
|
|
4265
4550
|
gc.props.children
|
|
@@ -4302,7 +4587,7 @@ function SelectNativeRoot({
|
|
|
4302
4587
|
hasError = false,
|
|
4303
4588
|
children
|
|
4304
4589
|
}) {
|
|
4305
|
-
const handleChange =
|
|
4590
|
+
const handleChange = React38.useCallback(
|
|
4306
4591
|
(v) => {
|
|
4307
4592
|
if (v !== void 0) onChange?.(v);
|
|
4308
4593
|
},
|
|
@@ -4313,13 +4598,13 @@ function SelectNativeRoot({
|
|
|
4313
4598
|
defaultValue,
|
|
4314
4599
|
onChange: handleChange
|
|
4315
4600
|
});
|
|
4316
|
-
const { nodes: optionNodes, firstEnabledValue } =
|
|
4601
|
+
const { nodes: optionNodes, firstEnabledValue } = React38.useMemo(
|
|
4317
4602
|
() => walkNativeOptions(children),
|
|
4318
4603
|
[children]
|
|
4319
4604
|
);
|
|
4320
4605
|
const hasPlaceholder = placeholder != null && placeholder !== "";
|
|
4321
4606
|
const selectValue = selectedValue === void 0 ? hasPlaceholder ? "" : firstEnabledValue ?? "" : selectedValue;
|
|
4322
|
-
const handleNativeChange =
|
|
4607
|
+
const handleNativeChange = React38.useCallback(
|
|
4323
4608
|
(e) => {
|
|
4324
4609
|
const v = e.target.value;
|
|
4325
4610
|
setSelectedValue(v === "" ? void 0 : v);
|
|
@@ -4342,6 +4627,49 @@ function SelectNativeRoot({
|
|
|
4342
4627
|
) });
|
|
4343
4628
|
}
|
|
4344
4629
|
SelectNativeRoot.displayName = "SelectNativeRoot";
|
|
4630
|
+
function SelectNativeMultiRoot({
|
|
4631
|
+
size = "m",
|
|
4632
|
+
value,
|
|
4633
|
+
defaultValue,
|
|
4634
|
+
onChange,
|
|
4635
|
+
disabled,
|
|
4636
|
+
hasError = false,
|
|
4637
|
+
children
|
|
4638
|
+
}) {
|
|
4639
|
+
const handleChange = React38.useCallback(
|
|
4640
|
+
(next) => {
|
|
4641
|
+
onChange?.(next);
|
|
4642
|
+
},
|
|
4643
|
+
[onChange]
|
|
4644
|
+
);
|
|
4645
|
+
const [selectedValues, setSelectedValues] = useControllableState({
|
|
4646
|
+
value,
|
|
4647
|
+
defaultValue: defaultValue ?? [],
|
|
4648
|
+
onChange: handleChange
|
|
4649
|
+
});
|
|
4650
|
+
const { nodes: optionNodes } = React38.useMemo(() => walkNativeOptions(children), [children]);
|
|
4651
|
+
const handleNativeChange = React38.useCallback(
|
|
4652
|
+
(e) => {
|
|
4653
|
+
const next = Array.from(e.target.selectedOptions, (o) => o.value);
|
|
4654
|
+
setSelectedValues(next);
|
|
4655
|
+
},
|
|
4656
|
+
[setSelectedValues]
|
|
4657
|
+
);
|
|
4658
|
+
return /* @__PURE__ */ jsx26(ControlSizeProvider, { value: size, children: /* @__PURE__ */ jsx26(
|
|
4659
|
+
"select",
|
|
4660
|
+
{
|
|
4661
|
+
className: Select_default.nativeSelect,
|
|
4662
|
+
"data-multiple": "true",
|
|
4663
|
+
disabled,
|
|
4664
|
+
multiple: true,
|
|
4665
|
+
value: selectedValues,
|
|
4666
|
+
onChange: handleNativeChange,
|
|
4667
|
+
...toDataAttributes({ size, "has-error": hasError }),
|
|
4668
|
+
children: optionNodes
|
|
4669
|
+
}
|
|
4670
|
+
) });
|
|
4671
|
+
}
|
|
4672
|
+
SelectNativeMultiRoot.displayName = "SelectNativeMultiRoot";
|
|
4345
4673
|
var Select = {
|
|
4346
4674
|
Root: SelectRoot,
|
|
4347
4675
|
Trigger: SelectTrigger,
|
|
@@ -4396,9 +4724,9 @@ var CHANNEL_ARIA = {
|
|
|
4396
4724
|
green: "\u0417\u0435\u043B\u0451\u043D\u044B\u0439, 0\u2013255",
|
|
4397
4725
|
blue: "\u0421\u0438\u043D\u0438\u0439, 0\u2013255"
|
|
4398
4726
|
};
|
|
4399
|
-
var ColorValueFormatContext =
|
|
4727
|
+
var ColorValueFormatContext = React39.createContext(null);
|
|
4400
4728
|
function useColorValueFormat() {
|
|
4401
|
-
const v =
|
|
4729
|
+
const v = React39.useContext(ColorValueFormatContext);
|
|
4402
4730
|
if (!v) {
|
|
4403
4731
|
throw new Error(
|
|
4404
4732
|
"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 +4735,8 @@ function useColorValueFormat() {
|
|
|
4407
4735
|
return v;
|
|
4408
4736
|
}
|
|
4409
4737
|
function FormatProvider({ children, defaultFormat = "hsl" }) {
|
|
4410
|
-
const [format, setFormat] =
|
|
4411
|
-
const value =
|
|
4738
|
+
const [format, setFormat] = React39.useState(defaultFormat);
|
|
4739
|
+
const value = React39.useMemo(() => ({ format, setFormat }), [format]);
|
|
4412
4740
|
return /* @__PURE__ */ jsx27(ColorValueFormatContext.Provider, { value, children });
|
|
4413
4741
|
}
|
|
4414
4742
|
var FORMAT_SELECT_LABEL = {
|
|
@@ -4417,7 +4745,7 @@ var FORMAT_SELECT_LABEL = {
|
|
|
4417
4745
|
hex: "Hex"
|
|
4418
4746
|
};
|
|
4419
4747
|
function FormatSelect({ className }) {
|
|
4420
|
-
const ctx =
|
|
4748
|
+
const ctx = React39.useContext(ColorValueFormatContext);
|
|
4421
4749
|
if (!ctx) {
|
|
4422
4750
|
return null;
|
|
4423
4751
|
}
|
|
@@ -4471,13 +4799,13 @@ function ChannelField({
|
|
|
4471
4799
|
space,
|
|
4472
4800
|
suffix
|
|
4473
4801
|
}) {
|
|
4474
|
-
const state =
|
|
4475
|
-
const inputRef =
|
|
4476
|
-
const [text, setText] =
|
|
4802
|
+
const state = React39.useContext(ColorPickerStateContext);
|
|
4803
|
+
const inputRef = React39.useRef(null);
|
|
4804
|
+
const [text, setText] = React39.useState(
|
|
4477
4805
|
() => state ? displayChannelValue(state.color, channel, space) : ""
|
|
4478
4806
|
);
|
|
4479
4807
|
const fingerprint = state ? state.color.toString("hexa") : "";
|
|
4480
|
-
|
|
4808
|
+
React39.useEffect(() => {
|
|
4481
4809
|
if (!state) {
|
|
4482
4810
|
return;
|
|
4483
4811
|
}
|
|
@@ -4517,9 +4845,9 @@ function ChannelField({
|
|
|
4517
4845
|
] });
|
|
4518
4846
|
}
|
|
4519
4847
|
function StripHexField() {
|
|
4520
|
-
const state =
|
|
4521
|
-
const inputRef =
|
|
4522
|
-
const [text, setText] =
|
|
4848
|
+
const state = React39.useContext(ColorPickerStateContext);
|
|
4849
|
+
const inputRef = React39.useRef(null);
|
|
4850
|
+
const [text, setText] = React39.useState(() => {
|
|
4523
4851
|
if (!state) {
|
|
4524
4852
|
return "";
|
|
4525
4853
|
}
|
|
@@ -4528,7 +4856,7 @@ function StripHexField() {
|
|
|
4528
4856
|
return c.toString(a < 1 ? "hexa" : "hex");
|
|
4529
4857
|
});
|
|
4530
4858
|
const fingerprint = state ? state.color.toString("hexa") : "";
|
|
4531
|
-
|
|
4859
|
+
React39.useEffect(() => {
|
|
4532
4860
|
if (!state) {
|
|
4533
4861
|
return;
|
|
4534
4862
|
}
|
|
@@ -4713,9 +5041,9 @@ function SliderMeta({ label }) {
|
|
|
4713
5041
|
] });
|
|
4714
5042
|
}
|
|
4715
5043
|
function HexInput({ size = "m", label = "Hex", className }) {
|
|
4716
|
-
const state =
|
|
4717
|
-
const inputRef =
|
|
4718
|
-
const [text, setText] =
|
|
5044
|
+
const state = React39.useContext(ColorPickerStateContext);
|
|
5045
|
+
const inputRef = React39.useRef(null);
|
|
5046
|
+
const [text, setText] = React39.useState(() => {
|
|
4719
5047
|
if (!state) {
|
|
4720
5048
|
return "";
|
|
4721
5049
|
}
|
|
@@ -4724,7 +5052,7 @@ function HexInput({ size = "m", label = "Hex", className }) {
|
|
|
4724
5052
|
return c.toString(a < 1 ? "hexa" : "hex");
|
|
4725
5053
|
});
|
|
4726
5054
|
const colorFingerprint = state ? state.color.toString("hexa") : "";
|
|
4727
|
-
|
|
5055
|
+
React39.useEffect(() => {
|
|
4728
5056
|
if (!state) {
|
|
4729
5057
|
return;
|
|
4730
5058
|
}
|
|
@@ -4767,8 +5095,8 @@ function HexInput({ size = "m", label = "Hex", className }) {
|
|
|
4767
5095
|
}
|
|
4768
5096
|
) }) });
|
|
4769
5097
|
}
|
|
4770
|
-
var EyeDropperButton =
|
|
4771
|
-
const state =
|
|
5098
|
+
var EyeDropperButton = React39.forwardRef(function EyeDropperButton2({ children, onClick, type = "button", "aria-label": ariaLabel, className, ...rest }, forwardedRef) {
|
|
5099
|
+
const state = React39.useContext(ColorPickerStateContext);
|
|
4772
5100
|
const EyeDropperApi = typeof globalThis !== "undefined" ? globalThis.EyeDropper : void 0;
|
|
4773
5101
|
if (!state) {
|
|
4774
5102
|
return null;
|
|
@@ -4814,7 +5142,7 @@ var EyeDropperButton = React38.forwardRef(function EyeDropperButton2({ children,
|
|
|
4814
5142
|
});
|
|
4815
5143
|
EyeDropperButton.displayName = "EyeDropperButton";
|
|
4816
5144
|
function TriggerSwatch({ className }) {
|
|
4817
|
-
const state =
|
|
5145
|
+
const state = React39.useContext(ColorPickerStateContext);
|
|
4818
5146
|
const colorCss = state != null ? state.color.toString("css") : TRIGGER_SWATCH_FALLBACK_FILL;
|
|
4819
5147
|
return /* @__PURE__ */ jsx27("span", { "aria-hidden": true, className: cx(ColorPicker_default.triggerSwatch, className), children: /* @__PURE__ */ jsx27(
|
|
4820
5148
|
"svg",
|
|
@@ -4850,13 +5178,13 @@ var ColorPicker = {
|
|
|
4850
5178
|
};
|
|
4851
5179
|
|
|
4852
5180
|
// src/components/command-menu/CommandMenu.tsx
|
|
4853
|
-
import * as
|
|
5181
|
+
import * as React42 from "react";
|
|
4854
5182
|
|
|
4855
5183
|
// src/components/modal/Modal.tsx
|
|
4856
|
-
import * as
|
|
5184
|
+
import * as React41 from "react";
|
|
4857
5185
|
|
|
4858
5186
|
// src/hooks/useModalKeyboard.ts
|
|
4859
|
-
import * as
|
|
5187
|
+
import * as React40 from "react";
|
|
4860
5188
|
function shouldBlockEnterConfirm(target) {
|
|
4861
5189
|
if (!target || !(target instanceof HTMLElement)) {
|
|
4862
5190
|
return false;
|
|
@@ -4891,7 +5219,7 @@ function useModalKeyboard({
|
|
|
4891
5219
|
primaryRef
|
|
4892
5220
|
}) {
|
|
4893
5221
|
useEscapeKey({ enabled: closeOnEscape && open, onEscape: onClose });
|
|
4894
|
-
|
|
5222
|
+
React40.useEffect(() => {
|
|
4895
5223
|
if (!open || !confirmOnEnter) {
|
|
4896
5224
|
return;
|
|
4897
5225
|
}
|
|
@@ -4957,9 +5285,9 @@ var Modal_default = {
|
|
|
4957
5285
|
import { jsx as jsx28, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
4958
5286
|
var MODAL_SHELL_SIZE = "m";
|
|
4959
5287
|
var [ModalProvider, useModalContext] = createComponentContext("Modal");
|
|
4960
|
-
var ModalContentShellContext =
|
|
5288
|
+
var ModalContentShellContext = React41.createContext(null);
|
|
4961
5289
|
function useModalContentShell() {
|
|
4962
|
-
const value =
|
|
5290
|
+
const value = React41.useContext(ModalContentShellContext);
|
|
4963
5291
|
if (value === null) {
|
|
4964
5292
|
throw new Error(
|
|
4965
5293
|
"[prime-ui-kit] Modal header block must be used inside the dialog panel (internal)."
|
|
@@ -4982,9 +5310,9 @@ function ModalRoot({
|
|
|
4982
5310
|
defaultValue: defaultOpen,
|
|
4983
5311
|
onChange: onOpenChange
|
|
4984
5312
|
});
|
|
4985
|
-
const primaryActionRef =
|
|
4986
|
-
const onOpen =
|
|
4987
|
-
const onClose =
|
|
5313
|
+
const primaryActionRef = React41.useRef(null);
|
|
5314
|
+
const onOpen = React41.useCallback(() => setIsOpen(true), [setIsOpen]);
|
|
5315
|
+
const onClose = React41.useCallback(() => setIsOpen(false), [setIsOpen]);
|
|
4988
5316
|
return /* @__PURE__ */ jsx28(
|
|
4989
5317
|
ModalProvider,
|
|
4990
5318
|
{
|
|
@@ -5004,8 +5332,8 @@ function ModalRoot({
|
|
|
5004
5332
|
}
|
|
5005
5333
|
function ModalTrigger({ children }) {
|
|
5006
5334
|
const { onOpen } = useModalContext();
|
|
5007
|
-
const child =
|
|
5008
|
-
return
|
|
5335
|
+
const child = React41.Children.only(children);
|
|
5336
|
+
return React41.cloneElement(child, {
|
|
5009
5337
|
onClick: (event) => {
|
|
5010
5338
|
child.props.onClick?.(event);
|
|
5011
5339
|
if (!event.defaultPrevented) {
|
|
@@ -5014,12 +5342,12 @@ function ModalTrigger({ children }) {
|
|
|
5014
5342
|
}
|
|
5015
5343
|
});
|
|
5016
5344
|
}
|
|
5017
|
-
var ModalClose =
|
|
5345
|
+
var ModalClose = React41.forwardRef(function ModalClose2({ children }, forwardedRef) {
|
|
5018
5346
|
const { onClose } = useModalContext();
|
|
5019
|
-
const child =
|
|
5347
|
+
const child = React41.Children.only(children);
|
|
5020
5348
|
const childRef = child.ref;
|
|
5021
5349
|
const mergedRef = mergeRefs(childRef, forwardedRef);
|
|
5022
|
-
return
|
|
5350
|
+
return React41.cloneElement(child, {
|
|
5023
5351
|
ref: mergedRef,
|
|
5024
5352
|
onClick: (event) => {
|
|
5025
5353
|
child.props.onClick?.(event);
|
|
@@ -5033,12 +5361,12 @@ function FooterPrimarySlot({
|
|
|
5033
5361
|
children
|
|
5034
5362
|
}) {
|
|
5035
5363
|
const { primaryActionRef } = useModalContext();
|
|
5036
|
-
const child =
|
|
5364
|
+
const child = React41.Children.only(children);
|
|
5037
5365
|
const childRef = child.ref;
|
|
5038
5366
|
const mergedRef = mergeRefs(childRef, (node) => {
|
|
5039
5367
|
primaryActionRef.current = node;
|
|
5040
5368
|
});
|
|
5041
|
-
return
|
|
5369
|
+
return React41.cloneElement(child, { ref: mergedRef });
|
|
5042
5370
|
}
|
|
5043
5371
|
function ModalFooter({ primary, secondary, extra, className, ...rest }) {
|
|
5044
5372
|
return /* @__PURE__ */ jsxs11("footer", { className: cx(Modal_default.footer, className), "data-prime-modal-footer": "", ...rest, children: [
|
|
@@ -5087,15 +5415,15 @@ function ModalContent({
|
|
|
5087
5415
|
...rest
|
|
5088
5416
|
}) {
|
|
5089
5417
|
const { open, onClose, closeOnEscape, confirmOnEnter, onEnterConfirm, primaryActionRef } = useModalContext();
|
|
5090
|
-
const internalTitleId =
|
|
5091
|
-
const internalDescId =
|
|
5418
|
+
const internalTitleId = React41.useId();
|
|
5419
|
+
const internalDescId = React41.useId();
|
|
5092
5420
|
const titleId = ariaLabelledByProp ?? internalTitleId;
|
|
5093
5421
|
const descId = ariaDescribedByProp ?? internalDescId;
|
|
5094
|
-
const [headerState, setHeaderState] =
|
|
5095
|
-
const registerHeader =
|
|
5422
|
+
const [headerState, setHeaderState] = React41.useState(null);
|
|
5423
|
+
const registerHeader = React41.useCallback((state) => {
|
|
5096
5424
|
setHeaderState(state);
|
|
5097
5425
|
}, []);
|
|
5098
|
-
const shellValue =
|
|
5426
|
+
const shellValue = React41.useMemo(
|
|
5099
5427
|
() => ({ titleId, descId, registerHeader }),
|
|
5100
5428
|
[titleId, descId, registerHeader]
|
|
5101
5429
|
);
|
|
@@ -5112,7 +5440,7 @@ function ModalContent({
|
|
|
5112
5440
|
onEnterConfirm,
|
|
5113
5441
|
primaryRef: primaryActionRef
|
|
5114
5442
|
});
|
|
5115
|
-
|
|
5443
|
+
React41.useEffect(() => {
|
|
5116
5444
|
if (!open) return;
|
|
5117
5445
|
const container = trapRef.current;
|
|
5118
5446
|
if (!container) return;
|
|
@@ -5169,7 +5497,7 @@ function ModalHeader({
|
|
|
5169
5497
|
const { onClose } = useModalContext();
|
|
5170
5498
|
const { titleId, descId, registerHeader } = useModalContentShell();
|
|
5171
5499
|
const hasDescription = description != null && description !== "";
|
|
5172
|
-
|
|
5500
|
+
React41.useLayoutEffect(() => {
|
|
5173
5501
|
registerHeader({
|
|
5174
5502
|
hasDescription
|
|
5175
5503
|
});
|
|
@@ -5233,7 +5561,7 @@ function ModalPanel({
|
|
|
5233
5561
|
...rest
|
|
5234
5562
|
}) {
|
|
5235
5563
|
const hasHeader = title != null && title !== "";
|
|
5236
|
-
const footerNode = footer != null ?
|
|
5564
|
+
const footerNode = footer != null ? React41.isValidElement(footer) && footer.type === ModalFooter ? React41.cloneElement(footer, {
|
|
5237
5565
|
className: cx(footer.props.className, footerClassName)
|
|
5238
5566
|
}) : /* @__PURE__ */ jsx28("footer", { className: cx(Modal_default.footer, footerClassName), children: footer }) : null;
|
|
5239
5567
|
return /* @__PURE__ */ jsx28(ModalLayer, { className: overlayClassName, container, children: /* @__PURE__ */ jsxs11(
|
|
@@ -5314,27 +5642,27 @@ function matchesQuery(entry, query) {
|
|
|
5314
5642
|
return hay.includes(q);
|
|
5315
5643
|
}
|
|
5316
5644
|
var [CommandMenuProvider, useCommandMenuContext] = createComponentContext("CommandMenu");
|
|
5317
|
-
var CommandMenuGroupContext =
|
|
5645
|
+
var CommandMenuGroupContext = React42.createContext("");
|
|
5318
5646
|
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
|
-
|
|
5647
|
+
const listboxId = React42.useId();
|
|
5648
|
+
const inputRef = React42.useRef(null);
|
|
5649
|
+
const itemsRef = React42.useRef(/* @__PURE__ */ new Map());
|
|
5650
|
+
const orderSeqRef = React42.useRef(0);
|
|
5651
|
+
const orderMapRef = React42.useRef(/* @__PURE__ */ new Map());
|
|
5652
|
+
const [version, bump] = React42.useReducer((n) => n + 1, 0);
|
|
5653
|
+
const [search, setSearch] = React42.useState("");
|
|
5654
|
+
const [activeId, setActiveId] = React42.useState(null);
|
|
5655
|
+
React42.useLayoutEffect(() => {
|
|
5328
5656
|
orderSeqRef.current = 0;
|
|
5329
5657
|
orderMapRef.current.clear();
|
|
5330
5658
|
}, []);
|
|
5331
|
-
|
|
5659
|
+
React42.useEffect(() => {
|
|
5332
5660
|
setSearch("");
|
|
5333
5661
|
setActiveId(null);
|
|
5334
5662
|
const id = requestAnimationFrame(() => inputRef.current?.focus());
|
|
5335
5663
|
return () => cancelAnimationFrame(id);
|
|
5336
5664
|
}, []);
|
|
5337
|
-
const registerItem =
|
|
5665
|
+
const registerItem = React42.useCallback(
|
|
5338
5666
|
(id, patch) => {
|
|
5339
5667
|
let order = orderMapRef.current.get(id);
|
|
5340
5668
|
if (order === void 0) {
|
|
@@ -5350,20 +5678,20 @@ function CommandMenuRootProvider({ children }) {
|
|
|
5350
5678
|
},
|
|
5351
5679
|
[]
|
|
5352
5680
|
);
|
|
5353
|
-
const visibleIds =
|
|
5681
|
+
const visibleIds = React42.useMemo(() => {
|
|
5354
5682
|
void version;
|
|
5355
5683
|
const list = [...itemsRef.current.values()].sort((a, b) => a.order - b.order);
|
|
5356
5684
|
return list.filter((e) => matchesQuery(e, search)).filter((e) => !e.disabled).map((e) => e.id);
|
|
5357
5685
|
}, [search, version]);
|
|
5358
|
-
const itemGet =
|
|
5359
|
-
|
|
5686
|
+
const itemGet = React42.useCallback((id) => itemsRef.current.get(id), []);
|
|
5687
|
+
React42.useLayoutEffect(() => {
|
|
5360
5688
|
setActiveId((prev) => {
|
|
5361
5689
|
if (visibleIds.length === 0) return null;
|
|
5362
5690
|
if (prev && visibleIds.includes(prev)) return prev;
|
|
5363
5691
|
return visibleIds[0] ?? null;
|
|
5364
5692
|
});
|
|
5365
5693
|
}, [visibleIds]);
|
|
5366
|
-
const moveActive =
|
|
5694
|
+
const moveActive = React42.useCallback(
|
|
5367
5695
|
(delta) => {
|
|
5368
5696
|
if (visibleIds.length === 0) return;
|
|
5369
5697
|
setActiveId((prev) => {
|
|
@@ -5374,11 +5702,11 @@ function CommandMenuRootProvider({ children }) {
|
|
|
5374
5702
|
},
|
|
5375
5703
|
[visibleIds]
|
|
5376
5704
|
);
|
|
5377
|
-
const activateSelected =
|
|
5705
|
+
const activateSelected = React42.useCallback(() => {
|
|
5378
5706
|
if (!activeId) return;
|
|
5379
5707
|
itemsRef.current.get(activeId)?.onSelectRef.current?.();
|
|
5380
5708
|
}, [activeId]);
|
|
5381
|
-
const value =
|
|
5709
|
+
const value = React42.useMemo(
|
|
5382
5710
|
() => ({
|
|
5383
5711
|
search,
|
|
5384
5712
|
setSearch,
|
|
@@ -5472,7 +5800,7 @@ function CommandMenuInputRow({
|
|
|
5472
5800
|
}
|
|
5473
5801
|
);
|
|
5474
5802
|
}
|
|
5475
|
-
var CommandMenuInput =
|
|
5803
|
+
var CommandMenuInput = React42.forwardRef(
|
|
5476
5804
|
({ className, onKeyDown, value: valueProp, onChange, ...rest }, forwardedRef) => {
|
|
5477
5805
|
const {
|
|
5478
5806
|
search,
|
|
@@ -5486,12 +5814,12 @@ var CommandMenuInput = React41.forwardRef(
|
|
|
5486
5814
|
visibleIds
|
|
5487
5815
|
} = useCommandMenuContext();
|
|
5488
5816
|
const isControlled = valueProp !== void 0;
|
|
5489
|
-
|
|
5817
|
+
React42.useEffect(() => {
|
|
5490
5818
|
if (isControlled) {
|
|
5491
5819
|
setSearch(valueProp !== void 0 && valueProp !== null ? String(valueProp) : "");
|
|
5492
5820
|
}
|
|
5493
5821
|
}, [isControlled, valueProp, setSearch]);
|
|
5494
|
-
const setRefs =
|
|
5822
|
+
const setRefs = React42.useCallback(
|
|
5495
5823
|
(node) => {
|
|
5496
5824
|
inputRef.current = node;
|
|
5497
5825
|
if (typeof forwardedRef === "function") {
|
|
@@ -5559,7 +5887,7 @@ var CommandMenuInput = React41.forwardRef(
|
|
|
5559
5887
|
}
|
|
5560
5888
|
);
|
|
5561
5889
|
CommandMenuInput.displayName = "CommandMenu.Input";
|
|
5562
|
-
var CommandMenuList =
|
|
5890
|
+
var CommandMenuList = React42.forwardRef(
|
|
5563
5891
|
({ className, children, ...rest }, ref) => {
|
|
5564
5892
|
const { listboxId } = useCommandMenuContext();
|
|
5565
5893
|
return /* @__PURE__ */ jsx29(
|
|
@@ -5578,7 +5906,7 @@ var CommandMenuList = React41.forwardRef(
|
|
|
5578
5906
|
);
|
|
5579
5907
|
CommandMenuList.displayName = "CommandMenu.List";
|
|
5580
5908
|
function CommandMenuGroup({ heading, className, children, ...rest }) {
|
|
5581
|
-
const groupId =
|
|
5909
|
+
const groupId = React42.useId();
|
|
5582
5910
|
const { visibleIds, itemGet } = useCommandMenuContext();
|
|
5583
5911
|
const hasVisible = visibleIds.some((id) => itemGet(id)?.groupId === groupId);
|
|
5584
5912
|
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 +5914,7 @@ function CommandMenuGroup({ heading, className, children, ...rest }) {
|
|
|
5586
5914
|
children
|
|
5587
5915
|
] }) });
|
|
5588
5916
|
}
|
|
5589
|
-
var CommandMenuItem =
|
|
5917
|
+
var CommandMenuItem = React42.forwardRef(
|
|
5590
5918
|
({
|
|
5591
5919
|
className,
|
|
5592
5920
|
value,
|
|
@@ -5598,15 +5926,15 @@ var CommandMenuItem = React41.forwardRef(
|
|
|
5598
5926
|
onPointerMove,
|
|
5599
5927
|
...rest
|
|
5600
5928
|
}, forwardedRef) => {
|
|
5601
|
-
const id =
|
|
5929
|
+
const id = React42.useId();
|
|
5602
5930
|
const optionId = `${id}-option`;
|
|
5603
|
-
const groupId =
|
|
5931
|
+
const groupId = React42.useContext(CommandMenuGroupContext);
|
|
5604
5932
|
const { registerItem, activeId, setActiveId, visibleIds } = useCommandMenuContext();
|
|
5605
|
-
const onSelectRef =
|
|
5606
|
-
|
|
5933
|
+
const onSelectRef = React42.useRef(onSelect);
|
|
5934
|
+
React42.useEffect(() => {
|
|
5607
5935
|
onSelectRef.current = onSelect;
|
|
5608
5936
|
}, [onSelect]);
|
|
5609
|
-
|
|
5937
|
+
React42.useLayoutEffect(() => {
|
|
5610
5938
|
return registerItem(id, {
|
|
5611
5939
|
value,
|
|
5612
5940
|
keywords,
|
|
@@ -5617,8 +5945,8 @@ var CommandMenuItem = React41.forwardRef(
|
|
|
5617
5945
|
}, [id, value, keywords, disabled, groupId, registerItem]);
|
|
5618
5946
|
const filteredIn = visibleIds.includes(id);
|
|
5619
5947
|
const selected = activeId === id;
|
|
5620
|
-
const listRef =
|
|
5621
|
-
const setRefs =
|
|
5948
|
+
const listRef = React42.useRef(null);
|
|
5949
|
+
const setRefs = React42.useCallback(
|
|
5622
5950
|
(node) => {
|
|
5623
5951
|
listRef.current = node;
|
|
5624
5952
|
if (typeof forwardedRef === "function") {
|
|
@@ -5629,7 +5957,7 @@ var CommandMenuItem = React41.forwardRef(
|
|
|
5629
5957
|
},
|
|
5630
5958
|
[forwardedRef]
|
|
5631
5959
|
);
|
|
5632
|
-
|
|
5960
|
+
React42.useEffect(() => {
|
|
5633
5961
|
if (selected && listRef.current) {
|
|
5634
5962
|
listRef.current.scrollIntoView?.({ block: "nearest" });
|
|
5635
5963
|
}
|
|
@@ -5691,7 +6019,7 @@ function CommandMenuTagRow({ className, ...rest }) {
|
|
|
5691
6019
|
function CommandMenuFooter({ className, ...rest }) {
|
|
5692
6020
|
return /* @__PURE__ */ jsx29("div", { className: cx(CommandMenu_default.footer, className), ...rest });
|
|
5693
6021
|
}
|
|
5694
|
-
var CommandMenuFooterKeyBox =
|
|
6022
|
+
var CommandMenuFooterKeyBox = React42.forwardRef(
|
|
5695
6023
|
({ className, children, tone = "default", ...rest }, ref) => {
|
|
5696
6024
|
const variant = tone === "muted" ? "lighter" : "stroke";
|
|
5697
6025
|
return /* @__PURE__ */ jsx29(
|
|
@@ -5728,7 +6056,7 @@ var CommandMenu = {
|
|
|
5728
6056
|
|
|
5729
6057
|
// src/components/data-table/DataTable.tsx
|
|
5730
6058
|
import { ArrowDown, ArrowUp, ArrowUpDown } from "lucide-react";
|
|
5731
|
-
import * as
|
|
6059
|
+
import * as React43 from "react";
|
|
5732
6060
|
|
|
5733
6061
|
// src/internal/runtimeUnits.ts
|
|
5734
6062
|
var CSS_PX_SUFFIX = "px";
|
|
@@ -5944,11 +6272,11 @@ function DataTableRoot({
|
|
|
5944
6272
|
highlightColumnOnHover = false,
|
|
5945
6273
|
striped = false
|
|
5946
6274
|
}) {
|
|
5947
|
-
const [hoveredColumnId, setHoveredColumnId] =
|
|
5948
|
-
const clearHoveredColumn =
|
|
6275
|
+
const [hoveredColumnId, setHoveredColumnId] = React43.useState(null);
|
|
6276
|
+
const clearHoveredColumn = React43.useCallback(() => {
|
|
5949
6277
|
setHoveredColumnId(null);
|
|
5950
6278
|
}, []);
|
|
5951
|
-
const setHoveredColumn =
|
|
6279
|
+
const setHoveredColumn = React43.useCallback(
|
|
5952
6280
|
(columnId) => {
|
|
5953
6281
|
if (highlightColumnOnHover) setHoveredColumnId(columnId);
|
|
5954
6282
|
},
|
|
@@ -5965,19 +6293,19 @@ function DataTableRoot({
|
|
|
5965
6293
|
onChange: onPageChange
|
|
5966
6294
|
});
|
|
5967
6295
|
const initialVisible = Math.max(1, initialVisibleRows ?? pageSize);
|
|
5968
|
-
const [visibleRowCount, setVisibleRowCount] =
|
|
5969
|
-
const scrollRef =
|
|
5970
|
-
const sentinelRef =
|
|
5971
|
-
|
|
6296
|
+
const [visibleRowCount, setVisibleRowCount] = React43.useState(initialVisible);
|
|
6297
|
+
const scrollRef = React43.useRef(null);
|
|
6298
|
+
const sentinelRef = React43.useRef(null);
|
|
6299
|
+
React43.useLayoutEffect(() => {
|
|
5972
6300
|
const viewport = scrollRef.current;
|
|
5973
6301
|
if (!viewport) return;
|
|
5974
6302
|
viewport.style.maxHeight = infiniteScroll ? typeof scrollHeight === "number" ? `${scrollHeight}px` : scrollHeight : "";
|
|
5975
6303
|
}, [infiniteScroll, scrollHeight]);
|
|
5976
|
-
const sortableColumns =
|
|
6304
|
+
const sortableColumns = React43.useMemo(
|
|
5977
6305
|
() => new Set(columns.filter((c) => c.sortable).map((c) => c.id)),
|
|
5978
6306
|
[columns]
|
|
5979
6307
|
);
|
|
5980
|
-
const sortedRows =
|
|
6308
|
+
const sortedRows = React43.useMemo(() => {
|
|
5981
6309
|
if (!sortState || !sortableColumns.has(sortState.columnId)) return rows;
|
|
5982
6310
|
const column = columns.find((item) => item.id === sortState.columnId);
|
|
5983
6311
|
if (!column) return rows;
|
|
@@ -5992,21 +6320,21 @@ function DataTableRoot({
|
|
|
5992
6320
|
const safePageSize = Math.max(1, pageSize);
|
|
5993
6321
|
const totalPages = Math.max(1, Math.ceil(totalRows / safePageSize));
|
|
5994
6322
|
const safePage = clamp(pageState, 1, totalPages);
|
|
5995
|
-
|
|
6323
|
+
React43.useEffect(() => {
|
|
5996
6324
|
if (safePage !== pageState) setPageState(safePage);
|
|
5997
6325
|
}, [pageState, safePage, setPageState]);
|
|
5998
|
-
|
|
6326
|
+
React43.useEffect(() => {
|
|
5999
6327
|
if (infiniteScroll) {
|
|
6000
6328
|
setVisibleRowCount(initialVisible);
|
|
6001
6329
|
return;
|
|
6002
6330
|
}
|
|
6003
6331
|
setPageState(1);
|
|
6004
6332
|
}, [infiniteScroll, initialVisible, setPageState]);
|
|
6005
|
-
|
|
6333
|
+
React43.useEffect(() => {
|
|
6006
6334
|
if (!infiniteScroll) return;
|
|
6007
6335
|
setVisibleRowCount((prev) => clamp(prev, initialVisible, Math.max(initialVisible, totalRows)));
|
|
6008
6336
|
}, [infiniteScroll, initialVisible, totalRows]);
|
|
6009
|
-
const displayedRows =
|
|
6337
|
+
const displayedRows = React43.useMemo(() => {
|
|
6010
6338
|
if (infiniteScroll) {
|
|
6011
6339
|
return sortedRows.slice(0, visibleRowCount);
|
|
6012
6340
|
}
|
|
@@ -6016,7 +6344,7 @@ function DataTableRoot({
|
|
|
6016
6344
|
}, [infiniteScroll, safePage, safePageSize, sortedRows, visibleRowCount]);
|
|
6017
6345
|
const hasInternalMore = infiniteScroll && displayedRows.length < totalRows;
|
|
6018
6346
|
const canRequestMore = infiniteScroll && Boolean(onLoadMore) && hasMore && !loadingMore;
|
|
6019
|
-
const handleReachEnd =
|
|
6347
|
+
const handleReachEnd = React43.useCallback(() => {
|
|
6020
6348
|
if (!infiniteScroll) return;
|
|
6021
6349
|
if (hasInternalMore) {
|
|
6022
6350
|
setVisibleRowCount((prev) => Math.min(prev + Math.max(1, infiniteBatchSize), totalRows));
|
|
@@ -6026,7 +6354,7 @@ function DataTableRoot({
|
|
|
6026
6354
|
void onLoadMore();
|
|
6027
6355
|
}
|
|
6028
6356
|
}, [canRequestMore, hasInternalMore, infiniteBatchSize, infiniteScroll, onLoadMore, totalRows]);
|
|
6029
|
-
|
|
6357
|
+
React43.useEffect(() => {
|
|
6030
6358
|
if (!infiniteScroll) return;
|
|
6031
6359
|
const root = scrollRef.current;
|
|
6032
6360
|
const target = sentinelRef.current;
|
|
@@ -6203,7 +6531,7 @@ var DataTable = {
|
|
|
6203
6531
|
|
|
6204
6532
|
// src/components/datepicker/Datepicker.tsx
|
|
6205
6533
|
import { ChevronDown as ChevronDown2, ChevronLeft as ChevronLeft2, ChevronRight as ChevronRight3 } from "lucide-react";
|
|
6206
|
-
import * as
|
|
6534
|
+
import * as React45 from "react";
|
|
6207
6535
|
import {
|
|
6208
6536
|
DayPicker,
|
|
6209
6537
|
getDefaultClassNames,
|
|
@@ -6211,14 +6539,14 @@ import {
|
|
|
6211
6539
|
} from "react-day-picker";
|
|
6212
6540
|
|
|
6213
6541
|
// src/hooks/useResponsiveMonths.ts
|
|
6214
|
-
import * as
|
|
6542
|
+
import * as React44 from "react";
|
|
6215
6543
|
var DEFAULT_BREAKPOINTS = {
|
|
6216
6544
|
twoColumns: 520
|
|
6217
6545
|
};
|
|
6218
6546
|
function useResponsiveMonths(breakpoints = DEFAULT_BREAKPOINTS, container = null) {
|
|
6219
6547
|
const { twoColumns } = breakpoints;
|
|
6220
|
-
const [count, setCount] =
|
|
6221
|
-
|
|
6548
|
+
const [count, setCount] = React44.useState(1);
|
|
6549
|
+
React44.useEffect(() => {
|
|
6222
6550
|
if (!container) return;
|
|
6223
6551
|
let rafId = null;
|
|
6224
6552
|
const syncByWidth = (width) => {
|
|
@@ -6282,9 +6610,9 @@ var Datepicker_default = {
|
|
|
6282
6610
|
// src/components/datepicker/Datepicker.tsx
|
|
6283
6611
|
import { jsx as jsx32, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
6284
6612
|
var DEFAULT_RESPONSIVE = { twoColumns: 500 };
|
|
6285
|
-
var DatepickerSizeContext =
|
|
6613
|
+
var DatepickerSizeContext = React45.createContext(void 0);
|
|
6286
6614
|
DatepickerSizeContext.displayName = "DatepickerSizeContext";
|
|
6287
|
-
var DatepickerMonthContext =
|
|
6615
|
+
var DatepickerMonthContext = React45.createContext(
|
|
6288
6616
|
void 0
|
|
6289
6617
|
);
|
|
6290
6618
|
DatepickerMonthContext.displayName = "DatepickerMonthContext";
|
|
@@ -6347,7 +6675,7 @@ function DatepickerMonthCaption({
|
|
|
6347
6675
|
displayIndex,
|
|
6348
6676
|
...rest
|
|
6349
6677
|
}) {
|
|
6350
|
-
const inheritedSize =
|
|
6678
|
+
const inheritedSize = React45.useContext(DatepickerSizeContext);
|
|
6351
6679
|
const size = inheritedSize ?? "m";
|
|
6352
6680
|
const { dayPickerProps, goToMonth, previousMonth, nextMonth } = useDayPicker();
|
|
6353
6681
|
const monthsCount = dayPickerProps.numberOfMonths ?? 1;
|
|
@@ -6399,20 +6727,20 @@ function Calendar({
|
|
|
6399
6727
|
size: sizeProp,
|
|
6400
6728
|
...rest
|
|
6401
6729
|
}) {
|
|
6402
|
-
const inheritedSize =
|
|
6403
|
-
const monthContext =
|
|
6730
|
+
const inheritedSize = React45.useContext(DatepickerSizeContext);
|
|
6731
|
+
const monthContext = React45.useContext(DatepickerMonthContext);
|
|
6404
6732
|
const size = sizeProp ?? inheritedSize ?? "m";
|
|
6405
6733
|
const breakpoints = responsiveBreakpoints ?? DEFAULT_RESPONSIVE;
|
|
6406
|
-
const [containerEl, setContainerEl] =
|
|
6407
|
-
const callbackRef =
|
|
6734
|
+
const [containerEl, setContainerEl] = React45.useState(null);
|
|
6735
|
+
const callbackRef = React45.useCallback((node) => {
|
|
6408
6736
|
setContainerEl(node);
|
|
6409
6737
|
}, []);
|
|
6410
6738
|
const responsiveN = useResponsiveMonths(breakpoints, containerEl);
|
|
6411
6739
|
const numberOfMonths = responsiveMonths === true ? responsiveN : numberOfMonthsProp ?? 1;
|
|
6412
|
-
const [localMonth, setLocalMonth] =
|
|
6740
|
+
const [localMonth, setLocalMonth] = React45.useState(() => {
|
|
6413
6741
|
return monthProp ?? monthContext?.requestedMonth;
|
|
6414
6742
|
});
|
|
6415
|
-
|
|
6743
|
+
React45.useEffect(() => {
|
|
6416
6744
|
if (monthProp === void 0 && monthContext?.requestedMonth) {
|
|
6417
6745
|
setLocalMonth(monthContext.requestedMonth);
|
|
6418
6746
|
}
|
|
@@ -6430,7 +6758,7 @@ function Calendar({
|
|
|
6430
6758
|
};
|
|
6431
6759
|
const mergedStyle = style && typeof style === "object" ? { ...style } : {};
|
|
6432
6760
|
const resolvedMonth = monthProp ?? localMonth;
|
|
6433
|
-
const handleMonthChange =
|
|
6761
|
+
const handleMonthChange = React45.useCallback(
|
|
6434
6762
|
(next) => {
|
|
6435
6763
|
if (monthProp === void 0) {
|
|
6436
6764
|
setLocalMonth(next);
|
|
@@ -6463,7 +6791,7 @@ function Calendar({
|
|
|
6463
6791
|
Calendar.displayName = "Datepicker.Calendar";
|
|
6464
6792
|
function Shell({ children, className, presets, size = "m" }) {
|
|
6465
6793
|
const has = presets != null;
|
|
6466
|
-
const [requestedMonth, requestMonth] =
|
|
6794
|
+
const [requestedMonth, requestMonth] = React45.useState();
|
|
6467
6795
|
return /* @__PURE__ */ jsx32(DatepickerSizeContext.Provider, { value: size, children: /* @__PURE__ */ jsx32(DatepickerMonthContext.Provider, { value: { requestedMonth, requestMonth }, children: /* @__PURE__ */ jsxs15(
|
|
6468
6796
|
"div",
|
|
6469
6797
|
{
|
|
@@ -6479,8 +6807,8 @@ function Shell({ children, className, presets, size = "m" }) {
|
|
|
6479
6807
|
}
|
|
6480
6808
|
Shell.displayName = "Datepicker.Shell";
|
|
6481
6809
|
function Presets(props) {
|
|
6482
|
-
const inheritedSize =
|
|
6483
|
-
const monthContext =
|
|
6810
|
+
const inheritedSize = React45.useContext(DatepickerSizeContext);
|
|
6811
|
+
const monthContext = React45.useContext(DatepickerMonthContext);
|
|
6484
6812
|
const { className, size: sizeProp } = props;
|
|
6485
6813
|
const size = sizeProp ?? inheritedSize ?? "m";
|
|
6486
6814
|
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 +6837,8 @@ function Presets(props) {
|
|
|
6509
6837
|
}
|
|
6510
6838
|
Presets.displayName = "Datepicker.Presets";
|
|
6511
6839
|
function Time(props) {
|
|
6512
|
-
const baseId =
|
|
6513
|
-
const inheritedSize =
|
|
6840
|
+
const baseId = React45.useId();
|
|
6841
|
+
const inheritedSize = React45.useContext(DatepickerSizeContext);
|
|
6514
6842
|
if (props.mode === "range") {
|
|
6515
6843
|
const { from, to, onFromChange, onToChange, labels: labels2, size: sizeProp2 } = props;
|
|
6516
6844
|
const size2 = sizeProp2 ?? inheritedSize ?? "m";
|
|
@@ -6594,7 +6922,7 @@ function Time(props) {
|
|
|
6594
6922
|
}
|
|
6595
6923
|
Time.displayName = "Datepicker.Time";
|
|
6596
6924
|
function Value({ className, size: sizeProp, tone = "muted", ...rest }) {
|
|
6597
|
-
const inheritedSize =
|
|
6925
|
+
const inheritedSize = React45.useContext(DatepickerSizeContext);
|
|
6598
6926
|
const size = sizeProp ?? inheritedSize ?? "m";
|
|
6599
6927
|
return /* @__PURE__ */ jsx32(
|
|
6600
6928
|
Typography.Root,
|
|
@@ -6616,7 +6944,7 @@ var Datepicker = {
|
|
|
6616
6944
|
};
|
|
6617
6945
|
|
|
6618
6946
|
// src/components/digit-input/DigitInput.tsx
|
|
6619
|
-
import * as
|
|
6947
|
+
import * as React46 from "react";
|
|
6620
6948
|
|
|
6621
6949
|
// src/components/digit-input/DigitInput.module.css
|
|
6622
6950
|
var DigitInput_default = {
|
|
@@ -6652,7 +6980,7 @@ function DigitInputRoot({
|
|
|
6652
6980
|
className
|
|
6653
6981
|
}) {
|
|
6654
6982
|
const length = lengthProp;
|
|
6655
|
-
const slotKeysRef =
|
|
6983
|
+
const slotKeysRef = React46.useRef(null);
|
|
6656
6984
|
if (!slotKeysRef.current || slotKeysRef.current.length !== length) {
|
|
6657
6985
|
slotKeysRef.current = createSlotKeys(length);
|
|
6658
6986
|
}
|
|
@@ -6663,11 +6991,11 @@ function DigitInputRoot({
|
|
|
6663
6991
|
defaultValue: defaultNormalized,
|
|
6664
6992
|
onChange
|
|
6665
6993
|
});
|
|
6666
|
-
const prevLenRef =
|
|
6667
|
-
|
|
6994
|
+
const prevLenRef = React46.useRef(0);
|
|
6995
|
+
React46.useEffect(() => {
|
|
6668
6996
|
prevLenRef.current = normalizeDigits(value, length).length;
|
|
6669
6997
|
}, [length, value]);
|
|
6670
|
-
const commit =
|
|
6998
|
+
const commit = React46.useCallback(
|
|
6671
6999
|
(nextRaw) => {
|
|
6672
7000
|
const next = normalizeDigits(nextRaw, length);
|
|
6673
7001
|
const prevLen = prevLenRef.current;
|
|
@@ -6680,11 +7008,11 @@ function DigitInputRoot({
|
|
|
6680
7008
|
[length, onComplete, setValue]
|
|
6681
7009
|
);
|
|
6682
7010
|
const cells = toCells(value, length);
|
|
6683
|
-
const inputRefs =
|
|
6684
|
-
const setInputRef =
|
|
7011
|
+
const inputRefs = React46.useRef([]);
|
|
7012
|
+
const setInputRef = React46.useCallback((el, index) => {
|
|
6685
7013
|
inputRefs.current[index] = el;
|
|
6686
7014
|
}, []);
|
|
6687
|
-
const focusAt =
|
|
7015
|
+
const focusAt = React46.useCallback((index) => {
|
|
6688
7016
|
const el = inputRefs.current[index];
|
|
6689
7017
|
if (el) {
|
|
6690
7018
|
queueMicrotask(() => el.focus());
|
|
@@ -6772,7 +7100,7 @@ DigitInputRoot.displayName = "DigitInputRoot";
|
|
|
6772
7100
|
var DigitInput = { Root: DigitInputRoot };
|
|
6773
7101
|
|
|
6774
7102
|
// src/components/drawer/Drawer.tsx
|
|
6775
|
-
import * as
|
|
7103
|
+
import * as React47 from "react";
|
|
6776
7104
|
|
|
6777
7105
|
// src/components/drawer/Drawer.module.css
|
|
6778
7106
|
var Drawer_default = {
|
|
@@ -6810,9 +7138,9 @@ function Drawer({
|
|
|
6810
7138
|
className,
|
|
6811
7139
|
overlayClassName
|
|
6812
7140
|
}) {
|
|
6813
|
-
const [isMounted, setIsMounted] =
|
|
6814
|
-
const [isClosing, setIsClosing] =
|
|
6815
|
-
|
|
7141
|
+
const [isMounted, setIsMounted] = React47.useState(open);
|
|
7142
|
+
const [isClosing, setIsClosing] = React47.useState(false);
|
|
7143
|
+
React47.useEffect(() => {
|
|
6816
7144
|
if (open) {
|
|
6817
7145
|
setIsMounted(true);
|
|
6818
7146
|
setIsClosing(false);
|
|
@@ -6835,7 +7163,7 @@ function Drawer({
|
|
|
6835
7163
|
const trapRef = useFocusTrap({ enabled: open });
|
|
6836
7164
|
useScrollLock(open);
|
|
6837
7165
|
useEscapeKey({ enabled: open, onEscape: () => onOpenChange(false) });
|
|
6838
|
-
|
|
7166
|
+
React47.useEffect(() => {
|
|
6839
7167
|
if (!open) return;
|
|
6840
7168
|
const container = trapRef.current;
|
|
6841
7169
|
if (!container) return;
|
|
@@ -6864,7 +7192,7 @@ function Drawer({
|
|
|
6864
7192
|
}
|
|
6865
7193
|
};
|
|
6866
7194
|
}, [open, trapRef]);
|
|
6867
|
-
const generatedId =
|
|
7195
|
+
const generatedId = React47.useId();
|
|
6868
7196
|
const titleId = `${generatedId}-title`;
|
|
6869
7197
|
const descriptionId = `${generatedId}-description`;
|
|
6870
7198
|
const hasDescription = description != null && description !== "";
|
|
@@ -6931,7 +7259,7 @@ function Drawer({
|
|
|
6931
7259
|
}
|
|
6932
7260
|
|
|
6933
7261
|
// src/components/dropdown/Dropdown.tsx
|
|
6934
|
-
import * as
|
|
7262
|
+
import * as React49 from "react";
|
|
6935
7263
|
|
|
6936
7264
|
// src/components/dropdown/Dropdown.module.css
|
|
6937
7265
|
var Dropdown_default = {
|
|
@@ -6992,22 +7320,7 @@ function handleMenuNavigationKeyDown(e, container) {
|
|
|
6992
7320
|
}
|
|
6993
7321
|
|
|
6994
7322
|
// src/components/dropdown/useDropdownPosition.ts
|
|
6995
|
-
import * as
|
|
6996
|
-
|
|
6997
|
-
// src/internal/scrollAncestors.ts
|
|
6998
|
-
var SCROLLABLE = /^(auto|scroll|overlay)$/;
|
|
6999
|
-
function getScrollContainers(node) {
|
|
7000
|
-
const out = [window];
|
|
7001
|
-
if (!node || typeof window === "undefined") return out;
|
|
7002
|
-
for (let el = node.parentElement; el; el = el.parentElement) {
|
|
7003
|
-
const { overflowX, overflowY } = window.getComputedStyle(el);
|
|
7004
|
-
if (SCROLLABLE.test(overflowY) || SCROLLABLE.test(overflowX)) {
|
|
7005
|
-
out.push(el);
|
|
7006
|
-
}
|
|
7007
|
-
}
|
|
7008
|
-
if (window.visualViewport) out.push(window.visualViewport);
|
|
7009
|
-
return out;
|
|
7010
|
-
}
|
|
7323
|
+
import * as React48 from "react";
|
|
7011
7324
|
|
|
7012
7325
|
// src/components/dropdown/dropdownGeometry.ts
|
|
7013
7326
|
var DROPDOWN_MIN_MAX_HEIGHT = 120;
|
|
@@ -7034,8 +7347,8 @@ function useDropdownPosition({
|
|
|
7034
7347
|
align,
|
|
7035
7348
|
sameMinWidthAsTrigger
|
|
7036
7349
|
}) {
|
|
7037
|
-
const [layout, setLayout] =
|
|
7038
|
-
const commit =
|
|
7350
|
+
const [layout, setLayout] = React48.useState(null);
|
|
7351
|
+
const commit = React48.useCallback(() => {
|
|
7039
7352
|
const trigger = triggerRef.current;
|
|
7040
7353
|
const panel = contentRef.current;
|
|
7041
7354
|
if (!trigger || !panel) return;
|
|
@@ -7070,7 +7383,7 @@ function useDropdownPosition({
|
|
|
7070
7383
|
};
|
|
7071
7384
|
setLayout((prev) => prev && layoutEqual(prev, next) ? prev : next);
|
|
7072
7385
|
}, [triggerRef, contentRef, side, align, sameMinWidthAsTrigger]);
|
|
7073
|
-
|
|
7386
|
+
React48.useLayoutEffect(() => {
|
|
7074
7387
|
if (!open) {
|
|
7075
7388
|
setLayout(null);
|
|
7076
7389
|
return;
|
|
@@ -7108,9 +7421,9 @@ function useDropdownPosition({
|
|
|
7108
7421
|
|
|
7109
7422
|
// src/components/dropdown/Dropdown.tsx
|
|
7110
7423
|
import { jsx as jsx35 } from "react/jsx-runtime";
|
|
7111
|
-
var DropdownContentSizeContext =
|
|
7424
|
+
var DropdownContentSizeContext = React49.createContext("m");
|
|
7112
7425
|
function useDropdownContentSize() {
|
|
7113
|
-
return
|
|
7426
|
+
return React49.useContext(DropdownContentSizeContext);
|
|
7114
7427
|
}
|
|
7115
7428
|
function dropdownItemIconPx(menuSize) {
|
|
7116
7429
|
return remToPx(primitiveTokens.icon[menuSize]);
|
|
@@ -7122,13 +7435,13 @@ function DropdownRoot({ open, defaultOpen = false, onOpenChange, children }) {
|
|
|
7122
7435
|
defaultValue: defaultOpen,
|
|
7123
7436
|
onChange: onOpenChange
|
|
7124
7437
|
});
|
|
7125
|
-
const id =
|
|
7438
|
+
const id = React49.useId();
|
|
7126
7439
|
const triggerId = `${id}-trigger`;
|
|
7127
7440
|
const menuId = `${id}-menu`;
|
|
7128
|
-
const triggerRef =
|
|
7129
|
-
const onClose =
|
|
7130
|
-
const onToggle =
|
|
7131
|
-
const value =
|
|
7441
|
+
const triggerRef = React49.useRef(null);
|
|
7442
|
+
const onClose = React49.useCallback(() => setIsOpen(false), [setIsOpen]);
|
|
7443
|
+
const onToggle = React49.useCallback(() => setIsOpen((v) => !v), [setIsOpen]);
|
|
7444
|
+
const value = React49.useMemo(
|
|
7132
7445
|
() => ({ isOpen, onClose, onToggle, triggerId, menuId, triggerRef }),
|
|
7133
7446
|
[isOpen, onClose, onToggle, triggerId, menuId]
|
|
7134
7447
|
);
|
|
@@ -7138,9 +7451,9 @@ DropdownRoot.displayName = "DropdownRoot";
|
|
|
7138
7451
|
function DropdownTrigger({ children, asChild: _asChild = true }) {
|
|
7139
7452
|
void _asChild;
|
|
7140
7453
|
const { isOpen, onToggle, triggerId, menuId, triggerRef } = useDropdownContext();
|
|
7141
|
-
const toggleRef =
|
|
7454
|
+
const toggleRef = React49.useRef(onToggle);
|
|
7142
7455
|
toggleRef.current = onToggle;
|
|
7143
|
-
const setNode =
|
|
7456
|
+
const setNode = React49.useCallback(
|
|
7144
7457
|
(el) => {
|
|
7145
7458
|
triggerRef.current = el;
|
|
7146
7459
|
},
|
|
@@ -7148,9 +7461,9 @@ function DropdownTrigger({ children, asChild: _asChild = true }) {
|
|
|
7148
7461
|
);
|
|
7149
7462
|
const child = children;
|
|
7150
7463
|
const childRef = child.props.ref ?? child.ref;
|
|
7151
|
-
const mergedRef =
|
|
7464
|
+
const mergedRef = React49.useMemo(() => mergeRefs(childRef, setNode), [childRef, setNode]);
|
|
7152
7465
|
const userClick = child.props?.onClick;
|
|
7153
|
-
return
|
|
7466
|
+
return React49.cloneElement(child, {
|
|
7154
7467
|
ref: mergedRef,
|
|
7155
7468
|
id: triggerId,
|
|
7156
7469
|
"aria-expanded": isOpen,
|
|
@@ -7173,7 +7486,7 @@ function DropdownContent({
|
|
|
7173
7486
|
}) {
|
|
7174
7487
|
const { isOpen, onClose, triggerRef, menuId, triggerId } = useDropdownContext();
|
|
7175
7488
|
const overlayPortalLayer = useOverlayPortalLayer();
|
|
7176
|
-
const contentRef =
|
|
7489
|
+
const contentRef = React49.useRef(null);
|
|
7177
7490
|
const layout = useDropdownPosition({
|
|
7178
7491
|
open: isOpen,
|
|
7179
7492
|
triggerRef,
|
|
@@ -7183,7 +7496,7 @@ function DropdownContent({
|
|
|
7183
7496
|
sameMinWidthAsTrigger
|
|
7184
7497
|
});
|
|
7185
7498
|
const trapRef = useFocusTrap({ enabled: isOpen, restoreFocus: true });
|
|
7186
|
-
const ref =
|
|
7499
|
+
const ref = React49.useMemo(() => mergeRefs(contentRef, trapRef), [trapRef]);
|
|
7187
7500
|
useEscapeKey({ enabled: isOpen, onEscape: onClose });
|
|
7188
7501
|
useOutsideClick({
|
|
7189
7502
|
refs: [triggerRef, contentRef],
|
|
@@ -7240,7 +7553,7 @@ function DropdownItem({ onSelect, disabled, destructive, children, className })
|
|
|
7240
7553
|
);
|
|
7241
7554
|
}
|
|
7242
7555
|
DropdownItem.displayName = "DropdownItem";
|
|
7243
|
-
var DropdownItemIcon =
|
|
7556
|
+
var DropdownItemIcon = React49.forwardRef(
|
|
7244
7557
|
({ as: As = "span", className, children, "aria-hidden": ariaHidden, ...rest }, ref) => {
|
|
7245
7558
|
const menuSize = useDropdownContentSize();
|
|
7246
7559
|
const { size: explicitSize, ...iconRest } = rest;
|
|
@@ -7349,7 +7662,7 @@ var Dropdown = {
|
|
|
7349
7662
|
};
|
|
7350
7663
|
|
|
7351
7664
|
// src/components/empty-page/EmptyPage.tsx
|
|
7352
|
-
import * as
|
|
7665
|
+
import * as React50 from "react";
|
|
7353
7666
|
|
|
7354
7667
|
// src/components/empty-page/EmptyPage.module.css
|
|
7355
7668
|
var EmptyPage_default = {
|
|
@@ -7362,7 +7675,7 @@ var EmptyPage_default = {
|
|
|
7362
7675
|
|
|
7363
7676
|
// src/components/empty-page/EmptyPage.tsx
|
|
7364
7677
|
import { jsx as jsx36 } from "react/jsx-runtime";
|
|
7365
|
-
var EmptyPageRoot =
|
|
7678
|
+
var EmptyPageRoot = React50.forwardRef(function EmptyPageRoot2({ size = "m", layout = "default", className, children, ...rest }, forwardedRef) {
|
|
7366
7679
|
return /* @__PURE__ */ jsx36(
|
|
7367
7680
|
"div",
|
|
7368
7681
|
{
|
|
@@ -7382,13 +7695,13 @@ function EmptyPageIcon({ className, children, ...rest }) {
|
|
|
7382
7695
|
return /* @__PURE__ */ jsx36("div", { className: cx(EmptyPage_default.iconWrap, className), ...rest, children });
|
|
7383
7696
|
}
|
|
7384
7697
|
EmptyPageIcon.displayName = "EmptyPage.Icon";
|
|
7385
|
-
var EmptyPageTitle =
|
|
7698
|
+
var EmptyPageTitle = React50.forwardRef(
|
|
7386
7699
|
function EmptyPageTitle2({ className, children, ...rest }, forwardedRef) {
|
|
7387
7700
|
return /* @__PURE__ */ jsx36("h2", { ref: forwardedRef, className: cx(EmptyPage_default.title, className), ...rest, children });
|
|
7388
7701
|
}
|
|
7389
7702
|
);
|
|
7390
7703
|
EmptyPageTitle.displayName = "EmptyPage.Title";
|
|
7391
|
-
var EmptyPageDescription =
|
|
7704
|
+
var EmptyPageDescription = React50.forwardRef(
|
|
7392
7705
|
function EmptyPageDescription2({ className, children, ...rest }, forwardedRef) {
|
|
7393
7706
|
return /* @__PURE__ */ jsx36("p", { ref: forwardedRef, className: cx(EmptyPage_default.description, className), ...rest, children });
|
|
7394
7707
|
}
|
|
@@ -7408,10 +7721,10 @@ var EmptyPage = {
|
|
|
7408
7721
|
|
|
7409
7722
|
// src/components/example-frame/ExampleFrame.tsx
|
|
7410
7723
|
import { Code2, Eye as Eye2, Monitor, Smartphone, Tablet } from "lucide-react";
|
|
7411
|
-
import * as
|
|
7724
|
+
import * as React52 from "react";
|
|
7412
7725
|
|
|
7413
7726
|
// src/components/segmented-control/SegmentedControl.tsx
|
|
7414
|
-
import * as
|
|
7727
|
+
import * as React51 from "react";
|
|
7415
7728
|
|
|
7416
7729
|
// src/components/segmented-control/SegmentedControl.module.css
|
|
7417
7730
|
var SegmentedControl_default = {
|
|
@@ -7450,23 +7763,23 @@ function SegmentedControlRoot({
|
|
|
7450
7763
|
defaultValue,
|
|
7451
7764
|
onChange: onValueChange
|
|
7452
7765
|
});
|
|
7453
|
-
const [indicator, setIndicator] =
|
|
7766
|
+
const [indicator, setIndicator] = React51.useState({
|
|
7454
7767
|
left: 0,
|
|
7455
7768
|
top: 0,
|
|
7456
7769
|
width: 0,
|
|
7457
7770
|
height: 0
|
|
7458
7771
|
});
|
|
7459
|
-
const [animate2, setAnimate] =
|
|
7460
|
-
const containerRef =
|
|
7461
|
-
const indicatorRef =
|
|
7462
|
-
const onSelect =
|
|
7772
|
+
const [animate2, setAnimate] = React51.useState(false);
|
|
7773
|
+
const containerRef = React51.useRef(null);
|
|
7774
|
+
const indicatorRef = React51.useRef(null);
|
|
7775
|
+
const onSelect = React51.useCallback(
|
|
7463
7776
|
(nextValue) => {
|
|
7464
7777
|
setAnimate(true);
|
|
7465
7778
|
setSelectedValue(nextValue);
|
|
7466
7779
|
},
|
|
7467
7780
|
[setSelectedValue]
|
|
7468
7781
|
);
|
|
7469
|
-
|
|
7782
|
+
React51.useLayoutEffect(() => {
|
|
7470
7783
|
const root = containerRef.current;
|
|
7471
7784
|
if (!root) return;
|
|
7472
7785
|
const update = () => {
|
|
@@ -7503,12 +7816,12 @@ function SegmentedControlRoot({
|
|
|
7503
7816
|
ro?.disconnect();
|
|
7504
7817
|
};
|
|
7505
7818
|
}, []);
|
|
7506
|
-
|
|
7819
|
+
React51.useEffect(() => {
|
|
7507
7820
|
if (!animate2) return;
|
|
7508
7821
|
const id = window.setTimeout(() => setAnimate(false), 320);
|
|
7509
7822
|
return () => window.clearTimeout(id);
|
|
7510
7823
|
}, [animate2]);
|
|
7511
|
-
|
|
7824
|
+
React51.useLayoutEffect(() => {
|
|
7512
7825
|
const indicatorEl = indicatorRef.current;
|
|
7513
7826
|
if (!indicatorEl) return;
|
|
7514
7827
|
indicatorEl.style.transform = `translate3d(${indicator.left}px, ${indicator.top}px, 0)`;
|
|
@@ -7634,14 +7947,14 @@ function ExampleFrameRoot({
|
|
|
7634
7947
|
previewLayout = "default",
|
|
7635
7948
|
themePreset
|
|
7636
7949
|
}) {
|
|
7637
|
-
const [pane, setPane] =
|
|
7638
|
-
const [uncontrolledViewport, setUncontrolledViewport] =
|
|
7639
|
-
const [uncontrolledScheme, setUncontrolledScheme] =
|
|
7950
|
+
const [pane, setPane] = React52.useState("preview");
|
|
7951
|
+
const [uncontrolledViewport, setUncontrolledViewport] = React52.useState(defaultViewport);
|
|
7952
|
+
const [uncontrolledScheme, setUncontrolledScheme] = React52.useState(defaultColorScheme);
|
|
7640
7953
|
const isSchemeControlled = colorSchemeProp !== void 0;
|
|
7641
7954
|
const colorScheme = isSchemeControlled ? colorSchemeProp : uncontrolledScheme;
|
|
7642
7955
|
const isViewportControlled = viewportProp !== void 0;
|
|
7643
7956
|
const viewport = isViewportControlled ? viewportProp : uncontrolledViewport;
|
|
7644
|
-
const setColorScheme =
|
|
7957
|
+
const setColorScheme = React52.useCallback(
|
|
7645
7958
|
(next) => {
|
|
7646
7959
|
if (!isSchemeControlled) {
|
|
7647
7960
|
setUncontrolledScheme(next);
|
|
@@ -7650,7 +7963,7 @@ function ExampleFrameRoot({
|
|
|
7650
7963
|
},
|
|
7651
7964
|
[isSchemeControlled, onColorSchemeChange]
|
|
7652
7965
|
);
|
|
7653
|
-
const setViewport =
|
|
7966
|
+
const setViewport = React52.useCallback(
|
|
7654
7967
|
(next) => {
|
|
7655
7968
|
if (!isViewportControlled) {
|
|
7656
7969
|
setUncontrolledViewport(next);
|
|
@@ -7659,7 +7972,7 @@ function ExampleFrameRoot({
|
|
|
7659
7972
|
},
|
|
7660
7973
|
[isViewportControlled, onViewportChange]
|
|
7661
7974
|
);
|
|
7662
|
-
const ctxValue =
|
|
7975
|
+
const ctxValue = React52.useMemo(
|
|
7663
7976
|
() => ({
|
|
7664
7977
|
code,
|
|
7665
7978
|
language,
|
|
@@ -7685,8 +7998,8 @@ function ExampleFrameRoot({
|
|
|
7685
7998
|
]
|
|
7686
7999
|
);
|
|
7687
8000
|
let previewChildren = null;
|
|
7688
|
-
|
|
7689
|
-
if (
|
|
8001
|
+
React52.Children.forEach(children, (child) => {
|
|
8002
|
+
if (React52.isValidElement(child) && child.type === ExampleFrameStage) {
|
|
7690
8003
|
previewChildren = child.props.children ?? null;
|
|
7691
8004
|
}
|
|
7692
8005
|
});
|
|
@@ -7710,8 +8023,8 @@ function ExampleFrameRoot({
|
|
|
7710
8023
|
ExampleFrameRoot.displayName = "ExampleFrame.Root";
|
|
7711
8024
|
function ExampleFrameToolbar() {
|
|
7712
8025
|
const ctx = useExampleFrameContext();
|
|
7713
|
-
const [copyState, setCopyState] =
|
|
7714
|
-
const handleCopy =
|
|
8026
|
+
const [copyState, setCopyState] = React52.useState("idle");
|
|
8027
|
+
const handleCopy = React52.useCallback(async () => {
|
|
7715
8028
|
try {
|
|
7716
8029
|
await navigator.clipboard.writeText(ctx.code);
|
|
7717
8030
|
setCopyState("copied");
|
|
@@ -7817,10 +8130,10 @@ var ExampleFrame = {
|
|
|
7817
8130
|
};
|
|
7818
8131
|
|
|
7819
8132
|
// src/components/file-upload/FileUpload.tsx
|
|
7820
|
-
import * as
|
|
8133
|
+
import * as React54 from "react";
|
|
7821
8134
|
|
|
7822
8135
|
// src/components/progress-bar/ProgressBar.tsx
|
|
7823
|
-
import * as
|
|
8136
|
+
import * as React53 from "react";
|
|
7824
8137
|
|
|
7825
8138
|
// src/components/progress-bar/ProgressBar.module.css
|
|
7826
8139
|
var ProgressBar_default = {
|
|
@@ -7834,11 +8147,11 @@ import { jsx as jsx39, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
|
7834
8147
|
function clampProgress(value, max) {
|
|
7835
8148
|
return Math.min(max, Math.max(value, 0));
|
|
7836
8149
|
}
|
|
7837
|
-
var ProgressBarRoot =
|
|
8150
|
+
var ProgressBarRoot = React53.forwardRef(
|
|
7838
8151
|
({ value, max = 100, label, size = "m", className }, ref) => {
|
|
7839
8152
|
const safeMax = max > 0 ? max : 100;
|
|
7840
8153
|
const safeValue = clampProgress(value, safeMax);
|
|
7841
|
-
const labelId =
|
|
8154
|
+
const labelId = React53.useId();
|
|
7842
8155
|
return /* @__PURE__ */ jsxs19("div", { className: cx(ProgressBar_default.root, className), ...toDataAttributes({ size }), children: [
|
|
7843
8156
|
label ? /* @__PURE__ */ jsx39("span", { className: ProgressBar_default.label, id: labelId, children: label }) : null,
|
|
7844
8157
|
/* @__PURE__ */ jsx39(
|
|
@@ -7911,7 +8224,7 @@ function FileUploadBrowseLabel({ className, children, ...rest }) {
|
|
|
7911
8224
|
return /* @__PURE__ */ jsx40("span", { className: cx(FileUpload_default.browse, className), ...rest, children });
|
|
7912
8225
|
}
|
|
7913
8226
|
FileUploadBrowseLabel.displayName = "FileUpload.BrowseLabel";
|
|
7914
|
-
var FileUploadBrowseLink =
|
|
8227
|
+
var FileUploadBrowseLink = React54.forwardRef(
|
|
7915
8228
|
({ className, type = "button", onClick, ...rest }, ref) => /* @__PURE__ */ jsx40(
|
|
7916
8229
|
"button",
|
|
7917
8230
|
{
|
|
@@ -7936,7 +8249,7 @@ function FileUploadActionsRow({ className, children, ...rest }) {
|
|
|
7936
8249
|
return /* @__PURE__ */ jsx40("div", { className: cx(FileUpload_default.actionsRow, className), ...rest, children });
|
|
7937
8250
|
}
|
|
7938
8251
|
FileUploadActionsRow.displayName = "FileUpload.ActionsRow";
|
|
7939
|
-
var FileUploadChip =
|
|
8252
|
+
var FileUploadChip = React54.forwardRef(
|
|
7940
8253
|
({ className, type = "button", onClick, ...rest }, ref) => /* @__PURE__ */ jsx40(
|
|
7941
8254
|
"button",
|
|
7942
8255
|
{
|
|
@@ -8002,7 +8315,7 @@ function FileUploadItemTextGroup({ className, children, ...rest }) {
|
|
|
8002
8315
|
return /* @__PURE__ */ jsx40("div", { className: cx(FileUpload_default.itemTextGroup, className), ...rest, children });
|
|
8003
8316
|
}
|
|
8004
8317
|
FileUploadItemTextGroup.displayName = "FileUpload.ItemTextGroup";
|
|
8005
|
-
var FileUploadItemTryAgain =
|
|
8318
|
+
var FileUploadItemTryAgain = React54.forwardRef(
|
|
8006
8319
|
({ className, type = "button", ...rest }, ref) => /* @__PURE__ */ jsx40("button", { ref, type, className: cx(FileUpload_default.itemTryAgain, className), ...rest })
|
|
8007
8320
|
);
|
|
8008
8321
|
FileUploadItemTryAgain.displayName = "FileUpload.ItemTryAgain";
|
|
@@ -8030,7 +8343,7 @@ function FileUploadItemProgress({ value, max, className, children }) {
|
|
|
8030
8343
|
return /* @__PURE__ */ jsx40("div", { className: cx(FileUpload_default.itemProgress, className), children: children ?? (value !== void 0 ? /* @__PURE__ */ jsx40(ProgressBar.Root, { value, max }) : null) });
|
|
8031
8344
|
}
|
|
8032
8345
|
FileUploadItemProgress.displayName = "FileUpload.ItemProgress";
|
|
8033
|
-
var FileUploadRoot =
|
|
8346
|
+
var FileUploadRoot = React54.forwardRef(
|
|
8034
8347
|
({
|
|
8035
8348
|
size = "m",
|
|
8036
8349
|
appearance = "dashed",
|
|
@@ -8043,7 +8356,7 @@ var FileUploadRoot = React53.forwardRef(
|
|
|
8043
8356
|
children,
|
|
8044
8357
|
...rest
|
|
8045
8358
|
}, ref) => {
|
|
8046
|
-
const [isDragOver, setIsDragOver] =
|
|
8359
|
+
const [isDragOver, setIsDragOver] = React54.useState(false);
|
|
8047
8360
|
const mergeInputRef = useMergedRefs(inputRefProp);
|
|
8048
8361
|
const handleChange = (e) => {
|
|
8049
8362
|
const list = e.target.files;
|
|
@@ -8139,7 +8452,7 @@ var FileUpload = {
|
|
|
8139
8452
|
};
|
|
8140
8453
|
|
|
8141
8454
|
// src/components/kbd/Kbd.tsx
|
|
8142
|
-
import * as
|
|
8455
|
+
import * as React55 from "react";
|
|
8143
8456
|
|
|
8144
8457
|
// src/components/kbd/Kbd.module.css
|
|
8145
8458
|
var Kbd_default = {
|
|
@@ -8148,7 +8461,7 @@ var Kbd_default = {
|
|
|
8148
8461
|
|
|
8149
8462
|
// src/components/kbd/Kbd.tsx
|
|
8150
8463
|
import { jsx as jsx41 } from "react/jsx-runtime";
|
|
8151
|
-
var KbdRoot =
|
|
8464
|
+
var KbdRoot = React55.forwardRef(
|
|
8152
8465
|
({ children, className, size: sizeProp, ...rest }, ref) => {
|
|
8153
8466
|
const controlSurface = useOptionalControlSize();
|
|
8154
8467
|
const size = sizeProp ?? (controlSurface !== void 0 ? controlSurfaceToInputSize(controlSurface) : "m");
|
|
@@ -8169,7 +8482,7 @@ var Kbd = { Root: KbdRoot };
|
|
|
8169
8482
|
|
|
8170
8483
|
// src/components/notification/Notification.tsx
|
|
8171
8484
|
import { AlertTriangle, CheckCircle2, Info, X as X3, XCircle } from "lucide-react";
|
|
8172
|
-
import * as
|
|
8485
|
+
import * as React56 from "react";
|
|
8173
8486
|
|
|
8174
8487
|
// src/components/notification/Notification.module.css
|
|
8175
8488
|
var Notification_default = {
|
|
@@ -8200,14 +8513,14 @@ var Notification_default = {
|
|
|
8200
8513
|
// src/components/notification/Notification.tsx
|
|
8201
8514
|
import { jsx as jsx42, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
8202
8515
|
function useCountdown(item, paused, onExpire) {
|
|
8203
|
-
const [progress, setProgress] =
|
|
8204
|
-
const remainingRef =
|
|
8205
|
-
const lastTsRef =
|
|
8206
|
-
const pausedRef =
|
|
8207
|
-
const onExpireRef =
|
|
8516
|
+
const [progress, setProgress] = React56.useState(1);
|
|
8517
|
+
const remainingRef = React56.useRef(item.duration);
|
|
8518
|
+
const lastTsRef = React56.useRef(null);
|
|
8519
|
+
const pausedRef = React56.useRef(paused);
|
|
8520
|
+
const onExpireRef = React56.useRef(onExpire);
|
|
8208
8521
|
pausedRef.current = paused;
|
|
8209
8522
|
onExpireRef.current = onExpire;
|
|
8210
|
-
|
|
8523
|
+
React56.useEffect(() => {
|
|
8211
8524
|
if (item.persistent || item.duration <= 0) return;
|
|
8212
8525
|
remainingRef.current = item.duration;
|
|
8213
8526
|
lastTsRef.current = null;
|
|
@@ -8309,7 +8622,7 @@ function NotificationCard({
|
|
|
8309
8622
|
|
|
8310
8623
|
// src/components/notification/NotificationStore.tsx
|
|
8311
8624
|
import { AnimatePresence, LayoutGroup, motion } from "framer-motion";
|
|
8312
|
-
import * as
|
|
8625
|
+
import * as React57 from "react";
|
|
8313
8626
|
import { jsx as jsx43, jsxs as jsxs22 } from "react/jsx-runtime";
|
|
8314
8627
|
var DEFAULT_DURATION = 5e3;
|
|
8315
8628
|
var PEEK_VISIBLE = 3;
|
|
@@ -8337,7 +8650,7 @@ var POSITIONS = [
|
|
|
8337
8650
|
"bottom-right"
|
|
8338
8651
|
];
|
|
8339
8652
|
var TYPES = ["success", "error", "warning", "info"];
|
|
8340
|
-
var StoreContext =
|
|
8653
|
+
var StoreContext = React57.createContext(null);
|
|
8341
8654
|
function newId() {
|
|
8342
8655
|
return globalThis.crypto?.randomUUID?.() ?? `ntf-${Date.now()}-${Math.random().toString(16).slice(2)}`;
|
|
8343
8656
|
}
|
|
@@ -8349,10 +8662,10 @@ function NotificationStack({
|
|
|
8349
8662
|
items,
|
|
8350
8663
|
onDismiss
|
|
8351
8664
|
}) {
|
|
8352
|
-
const [expanded, setExpanded] =
|
|
8353
|
-
const collapseTimerRef =
|
|
8665
|
+
const [expanded, setExpanded] = React57.useState(false);
|
|
8666
|
+
const collapseTimerRef = React57.useRef(null);
|
|
8354
8667
|
const top = isTop(position);
|
|
8355
|
-
const handleHover =
|
|
8668
|
+
const handleHover = React57.useCallback((hovered) => {
|
|
8356
8669
|
if (collapseTimerRef.current !== null) {
|
|
8357
8670
|
clearTimeout(collapseTimerRef.current);
|
|
8358
8671
|
collapseTimerRef.current = null;
|
|
@@ -8363,7 +8676,7 @@ function NotificationStack({
|
|
|
8363
8676
|
collapseTimerRef.current = window.setTimeout(() => setExpanded(false), 100);
|
|
8364
8677
|
}
|
|
8365
8678
|
}, []);
|
|
8366
|
-
|
|
8679
|
+
React57.useEffect(
|
|
8367
8680
|
() => () => {
|
|
8368
8681
|
if (collapseTimerRef.current !== null) clearTimeout(collapseTimerRef.current);
|
|
8369
8682
|
},
|
|
@@ -8397,7 +8710,7 @@ function NotificationStack({
|
|
|
8397
8710
|
}
|
|
8398
8711
|
);
|
|
8399
8712
|
}
|
|
8400
|
-
var NotificationStackItem =
|
|
8713
|
+
var NotificationStackItem = React57.memo(function NotificationStackItem2({
|
|
8401
8714
|
item,
|
|
8402
8715
|
index,
|
|
8403
8716
|
expanded,
|
|
@@ -8465,7 +8778,7 @@ function NotificationToaster({
|
|
|
8465
8778
|
entries,
|
|
8466
8779
|
onDismiss
|
|
8467
8780
|
}) {
|
|
8468
|
-
const grouped =
|
|
8781
|
+
const grouped = React57.useMemo(() => {
|
|
8469
8782
|
const map = /* @__PURE__ */ new Map();
|
|
8470
8783
|
for (const entry of entries) {
|
|
8471
8784
|
if (!map.has(entry.position)) map.set(entry.position, /* @__PURE__ */ new Map());
|
|
@@ -8511,18 +8824,18 @@ function NotificationProvider({
|
|
|
8511
8824
|
position = "top-right",
|
|
8512
8825
|
max = 5
|
|
8513
8826
|
}) {
|
|
8514
|
-
const [entries, setEntries] =
|
|
8515
|
-
const dismiss =
|
|
8827
|
+
const [entries, setEntries] = React57.useState([]);
|
|
8828
|
+
const dismiss = React57.useCallback((id) => {
|
|
8516
8829
|
setEntries((prev) => prev.map((n) => n.id === id ? { ...n, dismissing: true } : n));
|
|
8517
8830
|
window.setTimeout(() => {
|
|
8518
8831
|
setEntries((prev) => prev.filter((n) => n.id !== id));
|
|
8519
8832
|
}, DISMISS_CLEANUP_MS);
|
|
8520
8833
|
}, []);
|
|
8521
|
-
const dismissAll =
|
|
8834
|
+
const dismissAll = React57.useCallback(() => {
|
|
8522
8835
|
setEntries((prev) => prev.map((n) => ({ ...n, dismissing: true })));
|
|
8523
8836
|
window.setTimeout(() => setEntries([]), DISMISS_CLEANUP_MS);
|
|
8524
8837
|
}, []);
|
|
8525
|
-
const notify =
|
|
8838
|
+
const notify = React57.useCallback(
|
|
8526
8839
|
(options) => {
|
|
8527
8840
|
const id = newId();
|
|
8528
8841
|
const record = {
|
|
@@ -8548,8 +8861,8 @@ function NotificationProvider({
|
|
|
8548
8861
|
},
|
|
8549
8862
|
[position, max]
|
|
8550
8863
|
);
|
|
8551
|
-
const publicItems =
|
|
8552
|
-
const value =
|
|
8864
|
+
const publicItems = React57.useMemo(() => entries.filter((n) => !n.dismissing), [entries]);
|
|
8865
|
+
const value = React57.useMemo(
|
|
8553
8866
|
() => ({ items: publicItems, notify, dismiss, dismissAll }),
|
|
8554
8867
|
[publicItems, notify, dismiss, dismissAll]
|
|
8555
8868
|
);
|
|
@@ -8559,18 +8872,18 @@ function NotificationProvider({
|
|
|
8559
8872
|
] });
|
|
8560
8873
|
}
|
|
8561
8874
|
function useNotifications() {
|
|
8562
|
-
const ctx =
|
|
8875
|
+
const ctx = React57.useContext(StoreContext);
|
|
8563
8876
|
if (!ctx) throw new Error("useNotifications must be used within NotificationProvider");
|
|
8564
8877
|
return { notify: ctx.notify, dismiss: ctx.dismiss, dismissAll: ctx.dismissAll };
|
|
8565
8878
|
}
|
|
8566
8879
|
function useNotificationStore() {
|
|
8567
|
-
const ctx =
|
|
8880
|
+
const ctx = React57.useContext(StoreContext);
|
|
8568
8881
|
if (!ctx) throw new Error("useNotificationStore must be used within NotificationProvider");
|
|
8569
8882
|
return ctx;
|
|
8570
8883
|
}
|
|
8571
8884
|
|
|
8572
8885
|
// src/components/page-content/PageContent.tsx
|
|
8573
|
-
import * as
|
|
8886
|
+
import * as React58 from "react";
|
|
8574
8887
|
|
|
8575
8888
|
// src/components/page-content/PageContent.module.css
|
|
8576
8889
|
var PageContent_default = {
|
|
@@ -8584,7 +8897,7 @@ var PageContent_default = {
|
|
|
8584
8897
|
|
|
8585
8898
|
// src/components/page-content/PageContent.tsx
|
|
8586
8899
|
import { jsx as jsx44 } from "react/jsx-runtime";
|
|
8587
|
-
var PageContentRoot =
|
|
8900
|
+
var PageContentRoot = React58.forwardRef(
|
|
8588
8901
|
function PageContentRoot2({ maxWidth = "full", className, children, ...rest }, forwardedRef) {
|
|
8589
8902
|
return /* @__PURE__ */ jsx44(
|
|
8590
8903
|
"div",
|
|
@@ -8601,7 +8914,7 @@ var PageContentRoot = React57.forwardRef(
|
|
|
8601
8914
|
}
|
|
8602
8915
|
);
|
|
8603
8916
|
PageContentRoot.displayName = "PageContent.Root";
|
|
8604
|
-
var PageContentSection =
|
|
8917
|
+
var PageContentSection = React58.forwardRef(
|
|
8605
8918
|
function PageContentSection2({ className, children, ...rest }, forwardedRef) {
|
|
8606
8919
|
return /* @__PURE__ */ jsx44("section", { ref: forwardedRef, className: cx(PageContent_default.section, className), ...rest, children });
|
|
8607
8920
|
}
|
|
@@ -8611,13 +8924,13 @@ function PageContentHeader({ className, children, ...rest }) {
|
|
|
8611
8924
|
return /* @__PURE__ */ jsx44("div", { className: cx(PageContent_default.header, className), ...rest, children });
|
|
8612
8925
|
}
|
|
8613
8926
|
PageContentHeader.displayName = "PageContent.Header";
|
|
8614
|
-
var PageContentTitle =
|
|
8927
|
+
var PageContentTitle = React58.forwardRef(
|
|
8615
8928
|
function PageContentTitle2({ className, children, ...rest }, forwardedRef) {
|
|
8616
8929
|
return /* @__PURE__ */ jsx44("h1", { ref: forwardedRef, className: cx(PageContent_default.title, className), ...rest, children });
|
|
8617
8930
|
}
|
|
8618
8931
|
);
|
|
8619
8932
|
PageContentTitle.displayName = "PageContent.Title";
|
|
8620
|
-
var PageContentDescription =
|
|
8933
|
+
var PageContentDescription = React58.forwardRef(
|
|
8621
8934
|
function PageContentDescription2({ className, children, measure = "readable", ...rest }, forwardedRef) {
|
|
8622
8935
|
return /* @__PURE__ */ jsx44(
|
|
8623
8936
|
"p",
|
|
@@ -8648,7 +8961,7 @@ var PageContent = {
|
|
|
8648
8961
|
};
|
|
8649
8962
|
|
|
8650
8963
|
// src/components/popover/Popover.tsx
|
|
8651
|
-
import * as
|
|
8964
|
+
import * as React60 from "react";
|
|
8652
8965
|
|
|
8653
8966
|
// src/components/popover/Popover.module.css
|
|
8654
8967
|
var Popover_default = {
|
|
@@ -8658,7 +8971,7 @@ var Popover_default = {
|
|
|
8658
8971
|
};
|
|
8659
8972
|
|
|
8660
8973
|
// src/components/popover/usePopoverPosition.ts
|
|
8661
|
-
import * as
|
|
8974
|
+
import * as React59 from "react";
|
|
8662
8975
|
|
|
8663
8976
|
// src/components/popover/popoverGeometry.ts
|
|
8664
8977
|
var POPOVER_MIN_MAX_HEIGHT = 120;
|
|
@@ -8685,8 +8998,8 @@ function usePopoverPosition({
|
|
|
8685
8998
|
align,
|
|
8686
8999
|
sameMinWidthAsTrigger
|
|
8687
9000
|
}) {
|
|
8688
|
-
const [layout, setLayout] =
|
|
8689
|
-
const commit =
|
|
9001
|
+
const [layout, setLayout] = React59.useState(null);
|
|
9002
|
+
const commit = React59.useCallback(() => {
|
|
8690
9003
|
const trigger = triggerRef.current;
|
|
8691
9004
|
const panel = contentRef.current;
|
|
8692
9005
|
if (!trigger || !panel) return;
|
|
@@ -8723,7 +9036,7 @@ function usePopoverPosition({
|
|
|
8723
9036
|
};
|
|
8724
9037
|
setLayout((prev) => prev && layoutEqual2(prev, next) ? prev : next);
|
|
8725
9038
|
}, [triggerRef, contentRef, side, align, sameMinWidthAsTrigger]);
|
|
8726
|
-
|
|
9039
|
+
React59.useLayoutEffect(() => {
|
|
8727
9040
|
if (!open) {
|
|
8728
9041
|
setLayout(null);
|
|
8729
9042
|
return;
|
|
@@ -8768,13 +9081,13 @@ function PopoverRoot({ open, defaultOpen = false, onOpenChange, children }) {
|
|
|
8768
9081
|
defaultValue: defaultOpen,
|
|
8769
9082
|
onChange: onOpenChange
|
|
8770
9083
|
});
|
|
8771
|
-
const id =
|
|
9084
|
+
const id = React60.useId();
|
|
8772
9085
|
const triggerId = `${id}-trigger`;
|
|
8773
9086
|
const contentId = `${id}-content`;
|
|
8774
|
-
const triggerRef =
|
|
8775
|
-
const onClose =
|
|
8776
|
-
const onToggle =
|
|
8777
|
-
const value =
|
|
9087
|
+
const triggerRef = React60.useRef(null);
|
|
9088
|
+
const onClose = React60.useCallback(() => setIsOpen(false), [setIsOpen]);
|
|
9089
|
+
const onToggle = React60.useCallback(() => setIsOpen((v) => !v), [setIsOpen]);
|
|
9090
|
+
const value = React60.useMemo(
|
|
8778
9091
|
() => ({ isOpen, onClose, onToggle, triggerId, contentId, triggerRef }),
|
|
8779
9092
|
[isOpen, onClose, onToggle, triggerId, contentId]
|
|
8780
9093
|
);
|
|
@@ -8784,9 +9097,9 @@ PopoverRoot.displayName = "PopoverRoot";
|
|
|
8784
9097
|
function PopoverTrigger({ children, asChild: _asChild = true }) {
|
|
8785
9098
|
void _asChild;
|
|
8786
9099
|
const { isOpen, onToggle, triggerId, contentId, triggerRef } = usePopoverContext();
|
|
8787
|
-
const toggleRef =
|
|
9100
|
+
const toggleRef = React60.useRef(onToggle);
|
|
8788
9101
|
toggleRef.current = onToggle;
|
|
8789
|
-
const setNode =
|
|
9102
|
+
const setNode = React60.useCallback(
|
|
8790
9103
|
(el) => {
|
|
8791
9104
|
triggerRef.current = el;
|
|
8792
9105
|
},
|
|
@@ -8794,9 +9107,9 @@ function PopoverTrigger({ children, asChild: _asChild = true }) {
|
|
|
8794
9107
|
);
|
|
8795
9108
|
const child = children;
|
|
8796
9109
|
const childRef = child.props.ref ?? child.ref;
|
|
8797
|
-
const mergedRef =
|
|
9110
|
+
const mergedRef = React60.useMemo(() => mergeRefs(childRef, setNode), [childRef, setNode]);
|
|
8798
9111
|
const userClick = child.props?.onClick;
|
|
8799
|
-
return
|
|
9112
|
+
return React60.cloneElement(child, {
|
|
8800
9113
|
ref: mergedRef,
|
|
8801
9114
|
id: triggerId,
|
|
8802
9115
|
"aria-expanded": isOpen,
|
|
@@ -8822,7 +9135,7 @@ function PopoverContent({
|
|
|
8822
9135
|
}) {
|
|
8823
9136
|
const { isOpen, onClose, triggerRef, contentId, triggerId } = usePopoverContext();
|
|
8824
9137
|
const overlayPortalLayer = useOverlayPortalLayer();
|
|
8825
|
-
const contentRef =
|
|
9138
|
+
const contentRef = React60.useRef(null);
|
|
8826
9139
|
const layout = usePopoverPosition({
|
|
8827
9140
|
open: isOpen,
|
|
8828
9141
|
triggerRef,
|
|
@@ -8835,7 +9148,7 @@ function PopoverContent({
|
|
|
8835
9148
|
enabled: isOpen && trapFocus,
|
|
8836
9149
|
restoreFocus: true
|
|
8837
9150
|
});
|
|
8838
|
-
const ref =
|
|
9151
|
+
const ref = React60.useMemo(() => mergeRefs(contentRef, trapRef), [trapRef]);
|
|
8839
9152
|
useEscapeKey({ enabled: isOpen, onEscape: onClose });
|
|
8840
9153
|
useOutsideClick({
|
|
8841
9154
|
refs: [triggerRef, contentRef],
|
|
@@ -8872,7 +9185,7 @@ var Popover = {
|
|
|
8872
9185
|
};
|
|
8873
9186
|
|
|
8874
9187
|
// src/components/progress-circle/ProgressCircle.tsx
|
|
8875
|
-
import * as
|
|
9188
|
+
import * as React61 from "react";
|
|
8876
9189
|
|
|
8877
9190
|
// src/components/progress-circle/ProgressCircle.module.css
|
|
8878
9191
|
var ProgressCircle_default = {
|
|
@@ -8888,7 +9201,7 @@ var pc = primitiveTokens.progressCircle;
|
|
|
8888
9201
|
function clampProgress2(value, max) {
|
|
8889
9202
|
return Math.min(max, Math.max(value, 0));
|
|
8890
9203
|
}
|
|
8891
|
-
var ProgressCircleRoot =
|
|
9204
|
+
var ProgressCircleRoot = React61.forwardRef(
|
|
8892
9205
|
({ value, max = 100, size = "m", label, children, className }, ref) => {
|
|
8893
9206
|
const safeMax = max > 0 ? max : 100;
|
|
8894
9207
|
const safeValue = clampProgress2(value, safeMax);
|
|
@@ -8960,7 +9273,7 @@ ProgressCircleRoot.displayName = "ProgressCircleRoot";
|
|
|
8960
9273
|
var ProgressCircle = { Root: ProgressCircleRoot };
|
|
8961
9274
|
|
|
8962
9275
|
// src/components/radio/Radio.tsx
|
|
8963
|
-
import * as
|
|
9276
|
+
import * as React62 from "react";
|
|
8964
9277
|
|
|
8965
9278
|
// src/components/radio/Radio.module.css
|
|
8966
9279
|
var Radio_default = {
|
|
@@ -8978,7 +9291,7 @@ var Radio_default = {
|
|
|
8978
9291
|
// src/components/radio/Radio.tsx
|
|
8979
9292
|
import { jsx as jsx47, jsxs as jsxs24 } from "react/jsx-runtime";
|
|
8980
9293
|
var [RadioProvider, useRadioContext] = createComponentContext("Radio");
|
|
8981
|
-
var RadioRoot =
|
|
9294
|
+
var RadioRoot = React62.forwardRef(
|
|
8982
9295
|
({
|
|
8983
9296
|
id,
|
|
8984
9297
|
variant = "default",
|
|
@@ -8989,14 +9302,14 @@ var RadioRoot = React61.forwardRef(
|
|
|
8989
9302
|
children,
|
|
8990
9303
|
...inputRest
|
|
8991
9304
|
}, ref) => {
|
|
8992
|
-
const rawId =
|
|
9305
|
+
const rawId = React62.useId();
|
|
8993
9306
|
const inputId = id ?? rawId;
|
|
8994
9307
|
const hintId = `${inputId}-hint`;
|
|
8995
9308
|
const errorId = `${inputId}-error`;
|
|
8996
|
-
const [hasHint, setHasHint] =
|
|
8997
|
-
const [hasError, setHasError] =
|
|
9309
|
+
const [hasHint, setHasHint] = React62.useState(false);
|
|
9310
|
+
const [hasError, setHasError] = React62.useState(false);
|
|
8998
9311
|
const invalid = variant === "error" || hasError;
|
|
8999
|
-
const restInputPropsRef =
|
|
9312
|
+
const restInputPropsRef = React62.useRef(inputRest);
|
|
9000
9313
|
restInputPropsRef.current = inputRest;
|
|
9001
9314
|
const parts = [
|
|
9002
9315
|
ariaDescribedBy,
|
|
@@ -9004,11 +9317,11 @@ var RadioRoot = React61.forwardRef(
|
|
|
9004
9317
|
hasError ? errorId : void 0
|
|
9005
9318
|
].filter(Boolean);
|
|
9006
9319
|
const describedBy = parts.length > 0 ? parts.join(" ") : void 0;
|
|
9007
|
-
const registerHint =
|
|
9008
|
-
const unregisterHint =
|
|
9009
|
-
const registerError =
|
|
9010
|
-
const unregisterError =
|
|
9011
|
-
const ctxValue =
|
|
9320
|
+
const registerHint = React62.useCallback(() => setHasHint(true), []);
|
|
9321
|
+
const unregisterHint = React62.useCallback(() => setHasHint(false), []);
|
|
9322
|
+
const registerError = React62.useCallback(() => setHasError(true), []);
|
|
9323
|
+
const unregisterError = React62.useCallback(() => setHasError(false), []);
|
|
9324
|
+
const ctxValue = React62.useMemo(
|
|
9012
9325
|
() => ({
|
|
9013
9326
|
inputId,
|
|
9014
9327
|
hintId,
|
|
@@ -9055,9 +9368,9 @@ var RadioRoot = React61.forwardRef(
|
|
|
9055
9368
|
}
|
|
9056
9369
|
);
|
|
9057
9370
|
RadioRoot.displayName = "RadioRoot";
|
|
9058
|
-
var RadioLabel =
|
|
9371
|
+
var RadioLabel = React62.forwardRef(function RadioLabel2({ children, className, ...rest }, ref) {
|
|
9059
9372
|
const { inputId, inputRef, invalid, disabled, describedBy, restInputPropsRef, size } = useRadioContext();
|
|
9060
|
-
const filterId =
|
|
9373
|
+
const filterId = React62.useId();
|
|
9061
9374
|
const svgFilterId = `es-radio-${filterId.replace(/:/g, "")}`;
|
|
9062
9375
|
return /* @__PURE__ */ jsxs24(
|
|
9063
9376
|
Label.Root,
|
|
@@ -9106,7 +9419,7 @@ var RadioLabel = React61.forwardRef(function RadioLabel2({ children, className,
|
|
|
9106
9419
|
RadioLabel.displayName = "RadioLabel";
|
|
9107
9420
|
function RadioHint({ children, className, ...rest }) {
|
|
9108
9421
|
const { hintId, registerHint, unregisterHint, size, disabled } = useRadioContext();
|
|
9109
|
-
|
|
9422
|
+
React62.useLayoutEffect(() => {
|
|
9110
9423
|
registerHint();
|
|
9111
9424
|
return () => {
|
|
9112
9425
|
unregisterHint();
|
|
@@ -9127,7 +9440,7 @@ function RadioHint({ children, className, ...rest }) {
|
|
|
9127
9440
|
RadioHint.displayName = "RadioHint";
|
|
9128
9441
|
function RadioError({ children, className, ...rest }) {
|
|
9129
9442
|
const { errorId, registerError, unregisterError, size } = useRadioContext();
|
|
9130
|
-
|
|
9443
|
+
React62.useLayoutEffect(() => {
|
|
9131
9444
|
registerError();
|
|
9132
9445
|
return () => {
|
|
9133
9446
|
unregisterError();
|
|
@@ -9154,7 +9467,7 @@ var Radio = {
|
|
|
9154
9467
|
};
|
|
9155
9468
|
|
|
9156
9469
|
// src/components/segmented-progress-bar/SegmentedProgressBar.tsx
|
|
9157
|
-
import * as
|
|
9470
|
+
import * as React63 from "react";
|
|
9158
9471
|
|
|
9159
9472
|
// src/components/segmented-progress-bar/SegmentedProgressBar.module.css
|
|
9160
9473
|
var SegmentedProgressBar_default = {
|
|
@@ -9183,15 +9496,15 @@ function buildDistributionDescription(segments, total) {
|
|
|
9183
9496
|
});
|
|
9184
9497
|
return parts.join(", ");
|
|
9185
9498
|
}
|
|
9186
|
-
var SegmentedProgressBarRoot =
|
|
9499
|
+
var SegmentedProgressBarRoot = React63.forwardRef(
|
|
9187
9500
|
({ segments, label, size = "m", segmentGap = "none", className }, ref) => {
|
|
9188
|
-
const labelId =
|
|
9189
|
-
const descriptionId =
|
|
9190
|
-
const safe =
|
|
9501
|
+
const labelId = React63.useId();
|
|
9502
|
+
const descriptionId = React63.useId();
|
|
9503
|
+
const safe = React63.useMemo(
|
|
9191
9504
|
() => segments.map((s) => ({ ...s, value: clampNonNegative(s.value) })),
|
|
9192
9505
|
[segments]
|
|
9193
9506
|
);
|
|
9194
|
-
const total =
|
|
9507
|
+
const total = React63.useMemo(() => safe.reduce((acc, s) => acc + s.value, 0), [safe]);
|
|
9195
9508
|
const distributionText = buildDistributionDescription(safe, total);
|
|
9196
9509
|
const trackA11y = label ? { "aria-labelledby": labelId, "aria-describedby": descriptionId } : { "aria-label": distributionText };
|
|
9197
9510
|
return /* @__PURE__ */ jsxs25(
|
|
@@ -9223,7 +9536,7 @@ SegmentedProgressBarRoot.displayName = "SegmentedProgressBarRoot";
|
|
|
9223
9536
|
var SegmentedProgressBar = { Root: SegmentedProgressBarRoot };
|
|
9224
9537
|
|
|
9225
9538
|
// src/components/slider/Slider.tsx
|
|
9226
|
-
import * as
|
|
9539
|
+
import * as React64 from "react";
|
|
9227
9540
|
|
|
9228
9541
|
// src/components/slider/Slider.module.css
|
|
9229
9542
|
var Slider_default = {
|
|
@@ -9259,7 +9572,7 @@ function SliderRoot({
|
|
|
9259
9572
|
defaultValue: clamp2(initialDefault, min, max),
|
|
9260
9573
|
onChange
|
|
9261
9574
|
});
|
|
9262
|
-
const id =
|
|
9575
|
+
const id = React64.useId();
|
|
9263
9576
|
const safeValue = clamp2(value, min, max);
|
|
9264
9577
|
const applyValueFromInput = (el) => {
|
|
9265
9578
|
const next = Number.parseFloat(el.value);
|
|
@@ -9298,7 +9611,7 @@ SliderRoot.displayName = "SliderRoot";
|
|
|
9298
9611
|
var Slider2 = { Root: SliderRoot };
|
|
9299
9612
|
|
|
9300
9613
|
// src/components/stepper/HorizontalStepper.tsx
|
|
9301
|
-
import * as
|
|
9614
|
+
import * as React65 from "react";
|
|
9302
9615
|
|
|
9303
9616
|
// src/components/stepper/StepperAlign.module.css
|
|
9304
9617
|
var StepperAlign_default = {
|
|
@@ -9358,7 +9671,7 @@ function HorizontalStepperSeparatorIcon({
|
|
|
9358
9671
|
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
9672
|
}
|
|
9360
9673
|
HorizontalStepperSeparatorIcon.displayName = "HorizontalStepper.SeparatorIcon";
|
|
9361
|
-
var HorizontalStepperItem =
|
|
9674
|
+
var HorizontalStepperItem = React65.forwardRef(
|
|
9362
9675
|
function HorizontalStepperItem2({ state = "default", className, type = "button", children, ...rest }, ref) {
|
|
9363
9676
|
return /* @__PURE__ */ jsx51(StepperAlignItemProvider, { value: { state }, children: /* @__PURE__ */ jsx51(
|
|
9364
9677
|
"button",
|
|
@@ -9396,7 +9709,7 @@ var HorizontalStepper = {
|
|
|
9396
9709
|
};
|
|
9397
9710
|
|
|
9398
9711
|
// src/components/stepper/Stepper.tsx
|
|
9399
|
-
import * as
|
|
9712
|
+
import * as React67 from "react";
|
|
9400
9713
|
|
|
9401
9714
|
// src/components/stepper/Stepper.module.css
|
|
9402
9715
|
var Stepper_default = {
|
|
@@ -9409,7 +9722,7 @@ var Stepper_default = {
|
|
|
9409
9722
|
};
|
|
9410
9723
|
|
|
9411
9724
|
// src/components/stepper/VerticalStepper.tsx
|
|
9412
|
-
import * as
|
|
9725
|
+
import * as React66 from "react";
|
|
9413
9726
|
import { jsx as jsx52 } from "react/jsx-runtime";
|
|
9414
9727
|
function VerticalStepperRoot({
|
|
9415
9728
|
className,
|
|
@@ -9429,7 +9742,7 @@ function VerticalStepperArrow({
|
|
|
9429
9742
|
return /* @__PURE__ */ jsx52(Component, { className: cx(StepperAlign_default.vArrow, className), strokeWidth: 2, ...rest });
|
|
9430
9743
|
}
|
|
9431
9744
|
VerticalStepperArrow.displayName = "VerticalStepper.Arrow";
|
|
9432
|
-
var VerticalStepperItem =
|
|
9745
|
+
var VerticalStepperItem = React66.forwardRef(
|
|
9433
9746
|
function VerticalStepperItem2({ state = "default", className, type = "button", children, ...rest }, ref) {
|
|
9434
9747
|
return /* @__PURE__ */ jsx52(StepperAlignItemProvider, { value: { state }, children: /* @__PURE__ */ jsx52(
|
|
9435
9748
|
"button",
|
|
@@ -9487,14 +9800,14 @@ function StepperRoot({
|
|
|
9487
9800
|
children,
|
|
9488
9801
|
className
|
|
9489
9802
|
}) {
|
|
9490
|
-
const indexRef =
|
|
9803
|
+
const indexRef = React67.useRef(0);
|
|
9491
9804
|
indexRef.current = 0;
|
|
9492
|
-
const getNextStepIndex =
|
|
9805
|
+
const getNextStepIndex = React67.useCallback(() => {
|
|
9493
9806
|
const idx = indexRef.current;
|
|
9494
9807
|
indexRef.current += 1;
|
|
9495
9808
|
return idx;
|
|
9496
9809
|
}, []);
|
|
9497
|
-
const value =
|
|
9810
|
+
const value = React67.useMemo(
|
|
9498
9811
|
() => ({ orientation, currentStep, getNextStepIndex }),
|
|
9499
9812
|
[orientation, currentStep, getNextStepIndex]
|
|
9500
9813
|
);
|
|
@@ -9546,7 +9859,7 @@ function StepperContent({ title, description, className }) {
|
|
|
9546
9859
|
] });
|
|
9547
9860
|
}
|
|
9548
9861
|
StepperContent.displayName = "Stepper.Content";
|
|
9549
|
-
var StepperStep =
|
|
9862
|
+
var StepperStep = React67.forwardRef(function StepperStep2({ index: indexProp, status: statusProp, children, className, disabled, type = "button", ...rest }, ref) {
|
|
9550
9863
|
const { currentStep, orientation, getNextStepIndex } = useStepperRootContext();
|
|
9551
9864
|
const index = indexProp ?? getNextStepIndex();
|
|
9552
9865
|
const status = statusProp ?? computeStepStatus(index, currentStep);
|
|
@@ -9580,7 +9893,7 @@ var Stepper = {
|
|
|
9580
9893
|
};
|
|
9581
9894
|
|
|
9582
9895
|
// src/components/switch/Switch.tsx
|
|
9583
|
-
import * as
|
|
9896
|
+
import * as React68 from "react";
|
|
9584
9897
|
|
|
9585
9898
|
// src/components/switch/Switch.module.css
|
|
9586
9899
|
var Switch_default = {
|
|
@@ -9596,7 +9909,7 @@ var Switch_default = {
|
|
|
9596
9909
|
// src/components/switch/Switch.tsx
|
|
9597
9910
|
import { jsx as jsx54, jsxs as jsxs28 } from "react/jsx-runtime";
|
|
9598
9911
|
var [SwitchProvider, useSwitchContext] = createComponentContext("Switch");
|
|
9599
|
-
var SwitchRoot =
|
|
9912
|
+
var SwitchRoot = React68.forwardRef(
|
|
9600
9913
|
({
|
|
9601
9914
|
id,
|
|
9602
9915
|
checked,
|
|
@@ -9611,19 +9924,19 @@ var SwitchRoot = React67.forwardRef(
|
|
|
9611
9924
|
children,
|
|
9612
9925
|
...inputRest
|
|
9613
9926
|
}, ref) => {
|
|
9614
|
-
const rawId =
|
|
9927
|
+
const rawId = React68.useId();
|
|
9615
9928
|
const inputId = id ?? rawId;
|
|
9616
9929
|
const hintId = `${inputId}-hint`;
|
|
9617
9930
|
const errorId = `${inputId}-error`;
|
|
9618
|
-
const [hasHint, setHasHint] =
|
|
9619
|
-
const [hasError, setHasError] =
|
|
9931
|
+
const [hasHint, setHasHint] = React68.useState(false);
|
|
9932
|
+
const [hasError, setHasError] = React68.useState(false);
|
|
9620
9933
|
const invalid = variant === "error" || hasError;
|
|
9621
9934
|
const [isChecked, setChecked] = useControllableState({
|
|
9622
9935
|
value: checked,
|
|
9623
9936
|
defaultValue: defaultChecked,
|
|
9624
9937
|
onChange: onCheckedChange
|
|
9625
9938
|
});
|
|
9626
|
-
const handleChange =
|
|
9939
|
+
const handleChange = React68.useCallback(
|
|
9627
9940
|
(e) => {
|
|
9628
9941
|
if (readOnly) {
|
|
9629
9942
|
e.preventDefault();
|
|
@@ -9633,7 +9946,7 @@ var SwitchRoot = React67.forwardRef(
|
|
|
9633
9946
|
},
|
|
9634
9947
|
[readOnly, setChecked]
|
|
9635
9948
|
);
|
|
9636
|
-
const restInputPropsRef =
|
|
9949
|
+
const restInputPropsRef = React68.useRef(inputRest);
|
|
9637
9950
|
restInputPropsRef.current = inputRest;
|
|
9638
9951
|
const parts = [
|
|
9639
9952
|
ariaDescribedBy,
|
|
@@ -9641,11 +9954,11 @@ var SwitchRoot = React67.forwardRef(
|
|
|
9641
9954
|
hasError ? errorId : void 0
|
|
9642
9955
|
].filter(Boolean);
|
|
9643
9956
|
const describedBy = parts.length > 0 ? parts.join(" ") : void 0;
|
|
9644
|
-
const registerHint =
|
|
9645
|
-
const unregisterHint =
|
|
9646
|
-
const registerError =
|
|
9647
|
-
const unregisterError =
|
|
9648
|
-
const ctxValue =
|
|
9957
|
+
const registerHint = React68.useCallback(() => setHasHint(true), []);
|
|
9958
|
+
const unregisterHint = React68.useCallback(() => setHasHint(false), []);
|
|
9959
|
+
const registerError = React68.useCallback(() => setHasError(true), []);
|
|
9960
|
+
const unregisterError = React68.useCallback(() => setHasError(false), []);
|
|
9961
|
+
const ctxValue = React68.useMemo(
|
|
9649
9962
|
() => ({
|
|
9650
9963
|
inputId,
|
|
9651
9964
|
hintId,
|
|
@@ -9700,7 +10013,7 @@ var SwitchRoot = React67.forwardRef(
|
|
|
9700
10013
|
}
|
|
9701
10014
|
);
|
|
9702
10015
|
SwitchRoot.displayName = "SwitchRoot";
|
|
9703
|
-
var SwitchLabel =
|
|
10016
|
+
var SwitchLabel = React68.forwardRef(function SwitchLabel2({ children, className, ...rest }, ref) {
|
|
9704
10017
|
const {
|
|
9705
10018
|
inputId,
|
|
9706
10019
|
inputRef,
|
|
@@ -9752,7 +10065,7 @@ var SwitchLabel = React67.forwardRef(function SwitchLabel2({ children, className
|
|
|
9752
10065
|
SwitchLabel.displayName = "SwitchLabel";
|
|
9753
10066
|
function SwitchHint({ children, className, ...rest }) {
|
|
9754
10067
|
const { hintId, registerHint, unregisterHint, size, disabled } = useSwitchContext();
|
|
9755
|
-
|
|
10068
|
+
React68.useLayoutEffect(() => {
|
|
9756
10069
|
registerHint();
|
|
9757
10070
|
return () => {
|
|
9758
10071
|
unregisterHint();
|
|
@@ -9773,7 +10086,7 @@ function SwitchHint({ children, className, ...rest }) {
|
|
|
9773
10086
|
SwitchHint.displayName = "SwitchHint";
|
|
9774
10087
|
function SwitchError({ children, className, ...rest }) {
|
|
9775
10088
|
const { errorId, registerError, unregisterError, size } = useSwitchContext();
|
|
9776
|
-
|
|
10089
|
+
React68.useLayoutEffect(() => {
|
|
9777
10090
|
registerError();
|
|
9778
10091
|
return () => {
|
|
9779
10092
|
unregisterError();
|
|
@@ -9800,7 +10113,7 @@ var Switch = {
|
|
|
9800
10113
|
};
|
|
9801
10114
|
|
|
9802
10115
|
// src/components/tabs/Tabs.tsx
|
|
9803
|
-
import * as
|
|
10116
|
+
import * as React69 from "react";
|
|
9804
10117
|
|
|
9805
10118
|
// src/components/tabs/Tabs.module.css
|
|
9806
10119
|
var Tabs_default = {
|
|
@@ -9827,13 +10140,13 @@ function TabsRoot({
|
|
|
9827
10140
|
children,
|
|
9828
10141
|
className
|
|
9829
10142
|
}) {
|
|
9830
|
-
const rootId =
|
|
10143
|
+
const rootId = React69.useId();
|
|
9831
10144
|
const [activeValue, setActiveValue] = useControllableState({
|
|
9832
10145
|
value,
|
|
9833
10146
|
defaultValue,
|
|
9834
10147
|
onChange: onValueChange
|
|
9835
10148
|
});
|
|
9836
|
-
const contextValue =
|
|
10149
|
+
const contextValue = React69.useMemo(
|
|
9837
10150
|
() => ({ activeValue, onSelect: setActiveValue, orientation, rootId, size }),
|
|
9838
10151
|
[activeValue, setActiveValue, orientation, rootId, size]
|
|
9839
10152
|
);
|
|
@@ -9842,14 +10155,14 @@ function TabsRoot({
|
|
|
9842
10155
|
TabsRoot.displayName = "TabsRoot";
|
|
9843
10156
|
function TabsList({ children, className }) {
|
|
9844
10157
|
const { orientation, rootId, activeValue, onSelect, size } = useTabsContext();
|
|
9845
|
-
const listRef =
|
|
9846
|
-
const [indicator, setIndicator] =
|
|
10158
|
+
const listRef = React69.useRef(null);
|
|
10159
|
+
const [indicator, setIndicator] = React69.useState({
|
|
9847
10160
|
left: 0,
|
|
9848
10161
|
top: 0,
|
|
9849
10162
|
width: 0,
|
|
9850
10163
|
height: 0
|
|
9851
10164
|
});
|
|
9852
|
-
const updateIndicator =
|
|
10165
|
+
const updateIndicator = React69.useCallback(() => {
|
|
9853
10166
|
const list = listRef.current;
|
|
9854
10167
|
if (!list) return;
|
|
9855
10168
|
const active = list.querySelector('[role="tab"][aria-selected="true"]');
|
|
@@ -9864,7 +10177,7 @@ function TabsList({ children, className }) {
|
|
|
9864
10177
|
height: active.offsetHeight
|
|
9865
10178
|
});
|
|
9866
10179
|
}, []);
|
|
9867
|
-
|
|
10180
|
+
React69.useLayoutEffect(() => {
|
|
9868
10181
|
const list = listRef.current;
|
|
9869
10182
|
if (!list) return;
|
|
9870
10183
|
updateIndicator();
|
|
@@ -10011,7 +10324,7 @@ var Tabs = {
|
|
|
10011
10324
|
};
|
|
10012
10325
|
|
|
10013
10326
|
// src/components/tag/Tag.tsx
|
|
10014
|
-
import * as
|
|
10327
|
+
import * as React70 from "react";
|
|
10015
10328
|
|
|
10016
10329
|
// src/components/tag/Tag.module.css
|
|
10017
10330
|
var Tag_default = {
|
|
@@ -10024,7 +10337,7 @@ var Tag_default = {
|
|
|
10024
10337
|
|
|
10025
10338
|
// src/components/tag/Tag.tsx
|
|
10026
10339
|
import { jsx as jsx56, jsxs as jsxs30 } from "react/jsx-runtime";
|
|
10027
|
-
var TagRoot =
|
|
10340
|
+
var TagRoot = React70.forwardRef(
|
|
10028
10341
|
({ size: sizeProp, onRemove, disabled, children, className, ...rest }, ref) => {
|
|
10029
10342
|
const controlSurface = useOptionalControlSize();
|
|
10030
10343
|
const size = sizeProp ?? (controlSurface !== void 0 ? controlSurfaceToInputSize(controlSurface) : "m");
|
|
@@ -10072,8 +10385,469 @@ function TagIcon({ children, className }) {
|
|
|
10072
10385
|
TagIcon.displayName = "TagIcon";
|
|
10073
10386
|
var Tag = { Root: TagRoot, Icon: TagIcon };
|
|
10074
10387
|
|
|
10388
|
+
// src/components/tag-select/TagSelect.tsx
|
|
10389
|
+
import * as React71 from "react";
|
|
10390
|
+
|
|
10391
|
+
// src/components/tag-select/TagSelect.module.css
|
|
10392
|
+
var TagSelect_default = {
|
|
10393
|
+
control: "TagSelect_control2",
|
|
10394
|
+
chips: "TagSelect_chips2",
|
|
10395
|
+
chip: "TagSelect_chip2",
|
|
10396
|
+
chipBadge: "TagSelect_chipBadge2",
|
|
10397
|
+
chipLabel: "TagSelect_chipLabel2",
|
|
10398
|
+
chipRemove: "TagSelect_chipRemove2",
|
|
10399
|
+
removeIcon: "TagSelect_removeIcon2",
|
|
10400
|
+
input: "TagSelect_input2",
|
|
10401
|
+
inputCollapsed: "TagSelect_inputCollapsed2",
|
|
10402
|
+
chevronSlot: "TagSelect_chevronSlot2",
|
|
10403
|
+
chevron: "TagSelect_chevron2",
|
|
10404
|
+
panelInner: "TagSelect_panelInner2",
|
|
10405
|
+
hint: "TagSelect_hint2",
|
|
10406
|
+
optionRow: "TagSelect_optionRow2",
|
|
10407
|
+
createRow: "TagSelect_createRow2",
|
|
10408
|
+
createLabel: "TagSelect_createLabel2"
|
|
10409
|
+
};
|
|
10410
|
+
|
|
10411
|
+
// src/components/tag-select/TagSelect.tsx
|
|
10412
|
+
import { jsx as jsx57, jsxs as jsxs31 } from "react/jsx-runtime";
|
|
10413
|
+
var CREATE_VALUE = "__prime_tag_select_create__";
|
|
10414
|
+
function normalizeList(selected, options, defaultTagColor) {
|
|
10415
|
+
return selected.map((v) => {
|
|
10416
|
+
const o = options.find((x) => x.value === v);
|
|
10417
|
+
return {
|
|
10418
|
+
value: v,
|
|
10419
|
+
label: o?.label ?? v,
|
|
10420
|
+
color: o?.color ?? defaultTagColor
|
|
10421
|
+
};
|
|
10422
|
+
});
|
|
10423
|
+
}
|
|
10424
|
+
function filterOptions(options, query) {
|
|
10425
|
+
const q = query.trim().toLowerCase();
|
|
10426
|
+
if (q.length === 0) return options;
|
|
10427
|
+
return options.filter((o) => {
|
|
10428
|
+
if (o.disabled) return false;
|
|
10429
|
+
return o.label.toLowerCase().includes(q) || o.value.toLowerCase().includes(q);
|
|
10430
|
+
});
|
|
10431
|
+
}
|
|
10432
|
+
function optionsForList(options, query, selected) {
|
|
10433
|
+
return filterOptions(options, query).filter((o) => !selected.includes(o.value));
|
|
10434
|
+
}
|
|
10435
|
+
function shouldShowCreate(creatable, inputTrim, selected, options) {
|
|
10436
|
+
if (!creatable || inputTrim.length === 0) return false;
|
|
10437
|
+
if (selected.includes(inputTrim)) return false;
|
|
10438
|
+
const lower = inputTrim.toLowerCase();
|
|
10439
|
+
const exists = options.some(
|
|
10440
|
+
(o) => o.value === inputTrim || o.label.toLowerCase() === lower || o.value.toLowerCase() === lower
|
|
10441
|
+
);
|
|
10442
|
+
return !exists;
|
|
10443
|
+
}
|
|
10444
|
+
function TagSelectRoot({
|
|
10445
|
+
options,
|
|
10446
|
+
value: valueProp,
|
|
10447
|
+
defaultValue = [],
|
|
10448
|
+
onValueChange,
|
|
10449
|
+
creatable = false,
|
|
10450
|
+
onCreated,
|
|
10451
|
+
defaultTagColor = "gray",
|
|
10452
|
+
hint = "Select an option or create one",
|
|
10453
|
+
createActionLabel = "Create",
|
|
10454
|
+
disabled = false,
|
|
10455
|
+
placeholder = "",
|
|
10456
|
+
hasError = false,
|
|
10457
|
+
size = "m",
|
|
10458
|
+
id: idProp,
|
|
10459
|
+
className,
|
|
10460
|
+
"aria-label": ariaLabel,
|
|
10461
|
+
"aria-labelledby": ariaLabelledBy
|
|
10462
|
+
}) {
|
|
10463
|
+
const generatedId = React71.useId();
|
|
10464
|
+
const rootId = idProp ?? generatedId;
|
|
10465
|
+
const listboxId = `${rootId}-listbox`;
|
|
10466
|
+
const inputId = `${rootId}-input`;
|
|
10467
|
+
const [selected, setSelected] = useControllableState({
|
|
10468
|
+
value: valueProp,
|
|
10469
|
+
defaultValue,
|
|
10470
|
+
onChange: onValueChange
|
|
10471
|
+
});
|
|
10472
|
+
const [inputValue, setInputValue] = React71.useState("");
|
|
10473
|
+
const [inputFocused, setInputFocused] = React71.useState(false);
|
|
10474
|
+
const [open, setOpen] = React71.useState(false);
|
|
10475
|
+
const [highlightedValue, setHighlightedValue] = React71.useState(void 0);
|
|
10476
|
+
const triggerRef = React71.useRef(null);
|
|
10477
|
+
const inputRef = React71.useRef(null);
|
|
10478
|
+
const listboxRef = React71.useRef(null);
|
|
10479
|
+
const overlayPortalLayer = useOverlayPortalLayer();
|
|
10480
|
+
const { resolvedSide, update } = usePosition(triggerRef, listboxRef, {
|
|
10481
|
+
side: "bottom",
|
|
10482
|
+
align: "start"
|
|
10483
|
+
});
|
|
10484
|
+
const updateRef = React71.useRef(update);
|
|
10485
|
+
updateRef.current = update;
|
|
10486
|
+
const inputTrim = inputValue.trim();
|
|
10487
|
+
const filtered = React71.useMemo(
|
|
10488
|
+
() => optionsForList(options, inputValue, selected),
|
|
10489
|
+
[options, inputValue, selected]
|
|
10490
|
+
);
|
|
10491
|
+
const showCreate = shouldShowCreate(creatable, inputTrim, selected, options);
|
|
10492
|
+
const hasPanelContent = filtered.length > 0 || showCreate;
|
|
10493
|
+
const flatOptionValues = React71.useMemo(() => {
|
|
10494
|
+
const v = [];
|
|
10495
|
+
if (showCreate) v.push(CREATE_VALUE);
|
|
10496
|
+
for (const o of filtered) {
|
|
10497
|
+
if (!o.disabled) v.push(o.value);
|
|
10498
|
+
}
|
|
10499
|
+
return v;
|
|
10500
|
+
}, [filtered, showCreate]);
|
|
10501
|
+
React71.useLayoutEffect(() => {
|
|
10502
|
+
if (!open) return;
|
|
10503
|
+
updateRef.current();
|
|
10504
|
+
const raf = requestAnimationFrame(() => updateRef.current());
|
|
10505
|
+
return () => cancelAnimationFrame(raf);
|
|
10506
|
+
}, [open]);
|
|
10507
|
+
React71.useEffect(() => {
|
|
10508
|
+
if (!open) return;
|
|
10509
|
+
let rafCoalesce = 0;
|
|
10510
|
+
const schedule = () => {
|
|
10511
|
+
cancelAnimationFrame(rafCoalesce);
|
|
10512
|
+
rafCoalesce = requestAnimationFrame(() => updateRef.current());
|
|
10513
|
+
};
|
|
10514
|
+
window.addEventListener("resize", schedule);
|
|
10515
|
+
const scrollTargets = getScrollContainers(triggerRef.current);
|
|
10516
|
+
for (const t of scrollTargets) {
|
|
10517
|
+
t.addEventListener("scroll", schedule, { passive: true });
|
|
10518
|
+
}
|
|
10519
|
+
const vv = window.visualViewport;
|
|
10520
|
+
vv?.addEventListener("resize", schedule);
|
|
10521
|
+
const panel = listboxRef.current;
|
|
10522
|
+
let ro = null;
|
|
10523
|
+
if (typeof ResizeObserver !== "undefined" && panel) {
|
|
10524
|
+
ro = new ResizeObserver(schedule);
|
|
10525
|
+
ro.observe(panel);
|
|
10526
|
+
}
|
|
10527
|
+
return () => {
|
|
10528
|
+
cancelAnimationFrame(rafCoalesce);
|
|
10529
|
+
window.removeEventListener("resize", schedule);
|
|
10530
|
+
for (const t of scrollTargets) {
|
|
10531
|
+
t.removeEventListener("scroll", schedule);
|
|
10532
|
+
}
|
|
10533
|
+
vv?.removeEventListener("resize", schedule);
|
|
10534
|
+
ro?.disconnect();
|
|
10535
|
+
};
|
|
10536
|
+
}, [open]);
|
|
10537
|
+
React71.useEffect(() => {
|
|
10538
|
+
if (!open) {
|
|
10539
|
+
setHighlightedValue(void 0);
|
|
10540
|
+
return;
|
|
10541
|
+
}
|
|
10542
|
+
if (flatOptionValues.length === 0) {
|
|
10543
|
+
setHighlightedValue(void 0);
|
|
10544
|
+
return;
|
|
10545
|
+
}
|
|
10546
|
+
setHighlightedValue(
|
|
10547
|
+
(prev) => prev && flatOptionValues.includes(prev) ? prev : flatOptionValues[0]
|
|
10548
|
+
);
|
|
10549
|
+
}, [open, flatOptionValues]);
|
|
10550
|
+
React71.useEffect(() => {
|
|
10551
|
+
if (!open) return;
|
|
10552
|
+
if (!hasPanelContent) setOpen(false);
|
|
10553
|
+
}, [open, hasPanelContent]);
|
|
10554
|
+
useEscapeKey({ enabled: open, onEscape: () => setOpen(false) });
|
|
10555
|
+
useOutsideClick({
|
|
10556
|
+
refs: [triggerRef, listboxRef],
|
|
10557
|
+
enabled: open,
|
|
10558
|
+
onOutsideClick: () => setOpen(false)
|
|
10559
|
+
});
|
|
10560
|
+
const toggleValue = React71.useCallback(
|
|
10561
|
+
(value) => {
|
|
10562
|
+
setSelected((prev) => {
|
|
10563
|
+
if (prev.includes(value)) {
|
|
10564
|
+
return prev.filter((x) => x !== value);
|
|
10565
|
+
}
|
|
10566
|
+
return [...prev, value];
|
|
10567
|
+
});
|
|
10568
|
+
},
|
|
10569
|
+
[setSelected]
|
|
10570
|
+
);
|
|
10571
|
+
const handleSelectFromList = React71.useCallback(
|
|
10572
|
+
(rawValue) => {
|
|
10573
|
+
if (rawValue === CREATE_VALUE) {
|
|
10574
|
+
const v = inputTrim;
|
|
10575
|
+
if (v.length === 0) return;
|
|
10576
|
+
setSelected((prev) => {
|
|
10577
|
+
if (prev.includes(v)) return prev;
|
|
10578
|
+
onCreated?.(v);
|
|
10579
|
+
return [...prev, v];
|
|
10580
|
+
});
|
|
10581
|
+
setInputValue("");
|
|
10582
|
+
return;
|
|
10583
|
+
}
|
|
10584
|
+
toggleValue(rawValue);
|
|
10585
|
+
setInputValue("");
|
|
10586
|
+
},
|
|
10587
|
+
[inputTrim, onCreated, setSelected, toggleValue]
|
|
10588
|
+
);
|
|
10589
|
+
const getItems = React71.useCallback(() => queryEnabledSelectOptions(listboxRef.current), []);
|
|
10590
|
+
const onListboxKeyDown = (e) => {
|
|
10591
|
+
handleSelectListboxKeyDown(e, {
|
|
10592
|
+
items: getItems(),
|
|
10593
|
+
highlightedValue,
|
|
10594
|
+
setHighlightedValue,
|
|
10595
|
+
onSelect: (v) => {
|
|
10596
|
+
handleSelectFromList(v);
|
|
10597
|
+
},
|
|
10598
|
+
onClose: () => setOpen(false)
|
|
10599
|
+
});
|
|
10600
|
+
};
|
|
10601
|
+
const onInputKeyDown = (e) => {
|
|
10602
|
+
if (disabled) return;
|
|
10603
|
+
if (e.key === "Backspace" && inputValue.length === 0 && selected.length > 0) {
|
|
10604
|
+
e.preventDefault();
|
|
10605
|
+
setSelected((prev) => prev.slice(0, -1));
|
|
10606
|
+
return;
|
|
10607
|
+
}
|
|
10608
|
+
if (e.key === "Escape") {
|
|
10609
|
+
if (open) {
|
|
10610
|
+
e.preventDefault();
|
|
10611
|
+
setOpen(false);
|
|
10612
|
+
}
|
|
10613
|
+
return;
|
|
10614
|
+
}
|
|
10615
|
+
if (e.key === "ArrowDown" || e.key === "ArrowUp" || e.key === "Enter" || e.key === " ") {
|
|
10616
|
+
if (!open) {
|
|
10617
|
+
if (e.key === "ArrowDown" || e.key === "ArrowUp") {
|
|
10618
|
+
e.preventDefault();
|
|
10619
|
+
if (filtered.length > 0 || showCreate) setOpen(true);
|
|
10620
|
+
}
|
|
10621
|
+
return;
|
|
10622
|
+
}
|
|
10623
|
+
if (flatOptionValues.length === 0) return;
|
|
10624
|
+
if (e.key === "Enter" || e.key === " ") {
|
|
10625
|
+
e.preventDefault();
|
|
10626
|
+
const hv = highlightedValue ?? flatOptionValues[0];
|
|
10627
|
+
if (hv === CREATE_VALUE) {
|
|
10628
|
+
handleSelectFromList(CREATE_VALUE);
|
|
10629
|
+
} else if (hv) {
|
|
10630
|
+
const o = options.find((x) => x.value === hv);
|
|
10631
|
+
if (o && !o.disabled) {
|
|
10632
|
+
handleSelectFromList(o.value);
|
|
10633
|
+
}
|
|
10634
|
+
}
|
|
10635
|
+
return;
|
|
10636
|
+
}
|
|
10637
|
+
handleSelectListboxKeyDown(e, {
|
|
10638
|
+
items: getItems(),
|
|
10639
|
+
highlightedValue,
|
|
10640
|
+
setHighlightedValue,
|
|
10641
|
+
onSelect: (v) => handleSelectFromList(v),
|
|
10642
|
+
onClose: () => setOpen(false)
|
|
10643
|
+
});
|
|
10644
|
+
}
|
|
10645
|
+
};
|
|
10646
|
+
const chips = normalizeList(selected, options, defaultTagColor);
|
|
10647
|
+
const isEmpty = selected.length === 0 && inputTrim.length === 0;
|
|
10648
|
+
const inputCollapsed = !inputFocused && inputTrim.length === 0 && selected.length > 0;
|
|
10649
|
+
const focusInput = () => {
|
|
10650
|
+
inputRef.current?.focus();
|
|
10651
|
+
};
|
|
10652
|
+
const handleInputBlur = React71.useCallback((e) => {
|
|
10653
|
+
const next = e.relatedTarget;
|
|
10654
|
+
if (next instanceof Node && triggerRef.current?.contains(next)) {
|
|
10655
|
+
return;
|
|
10656
|
+
}
|
|
10657
|
+
window.requestAnimationFrame(() => {
|
|
10658
|
+
if (triggerRef.current?.contains(document.activeElement)) {
|
|
10659
|
+
return;
|
|
10660
|
+
}
|
|
10661
|
+
setInputFocused(false);
|
|
10662
|
+
setInputValue("");
|
|
10663
|
+
});
|
|
10664
|
+
}, []);
|
|
10665
|
+
return /* @__PURE__ */ jsxs31(ControlSizeProvider, { value: size, children: [
|
|
10666
|
+
/* @__PURE__ */ jsxs31(
|
|
10667
|
+
"div",
|
|
10668
|
+
{
|
|
10669
|
+
ref: triggerRef,
|
|
10670
|
+
className: cx(TagSelect_default.control, className),
|
|
10671
|
+
onClick: () => {
|
|
10672
|
+
if (!disabled) {
|
|
10673
|
+
focusInput();
|
|
10674
|
+
if (hasPanelContent) setOpen(true);
|
|
10675
|
+
}
|
|
10676
|
+
},
|
|
10677
|
+
...toDataAttributes({
|
|
10678
|
+
size,
|
|
10679
|
+
open,
|
|
10680
|
+
empty: isEmpty ? true : void 0,
|
|
10681
|
+
disabled: disabled ? true : void 0,
|
|
10682
|
+
"has-error": hasError ? true : void 0
|
|
10683
|
+
}),
|
|
10684
|
+
children: [
|
|
10685
|
+
/* @__PURE__ */ jsxs31("div", { className: TagSelect_default.chips, children: [
|
|
10686
|
+
chips.map((c) => /* @__PURE__ */ jsx57("span", { className: TagSelect_default.chip, children: /* @__PURE__ */ jsxs31(Badge.Root, { color: c.color, variant: "filled", className: TagSelect_default.chipBadge, children: [
|
|
10687
|
+
/* @__PURE__ */ jsx57("span", { className: TagSelect_default.chipLabel, children: c.label }),
|
|
10688
|
+
/* @__PURE__ */ jsx57(
|
|
10689
|
+
"button",
|
|
10690
|
+
{
|
|
10691
|
+
type: "button",
|
|
10692
|
+
className: TagSelect_default.chipRemove,
|
|
10693
|
+
"aria-label": `Remove ${c.label}`,
|
|
10694
|
+
disabled,
|
|
10695
|
+
onMouseDown: (e) => {
|
|
10696
|
+
e.preventDefault();
|
|
10697
|
+
},
|
|
10698
|
+
onClick: (e) => {
|
|
10699
|
+
e.stopPropagation();
|
|
10700
|
+
setSelected((prev) => prev.filter((x) => x !== c.value));
|
|
10701
|
+
},
|
|
10702
|
+
children: /* @__PURE__ */ jsx57(
|
|
10703
|
+
"svg",
|
|
10704
|
+
{
|
|
10705
|
+
className: TagSelect_default.removeIcon,
|
|
10706
|
+
viewBox: "0 0 12 12",
|
|
10707
|
+
fill: "none",
|
|
10708
|
+
"aria-hidden": "true",
|
|
10709
|
+
children: /* @__PURE__ */ jsx57(
|
|
10710
|
+
"path",
|
|
10711
|
+
{
|
|
10712
|
+
d: "M2 2l8 8M10 2l-8 8",
|
|
10713
|
+
stroke: "currentColor",
|
|
10714
|
+
strokeWidth: "1.5",
|
|
10715
|
+
strokeLinecap: "round"
|
|
10716
|
+
}
|
|
10717
|
+
)
|
|
10718
|
+
}
|
|
10719
|
+
)
|
|
10720
|
+
}
|
|
10721
|
+
)
|
|
10722
|
+
] }) }, c.value)),
|
|
10723
|
+
/* @__PURE__ */ jsx57(
|
|
10724
|
+
"input",
|
|
10725
|
+
{
|
|
10726
|
+
ref: inputRef,
|
|
10727
|
+
id: inputId,
|
|
10728
|
+
type: "text",
|
|
10729
|
+
role: "combobox",
|
|
10730
|
+
"aria-expanded": open,
|
|
10731
|
+
"aria-controls": listboxId,
|
|
10732
|
+
"aria-autocomplete": "list",
|
|
10733
|
+
"aria-label": ariaLabel,
|
|
10734
|
+
"aria-labelledby": ariaLabelledBy,
|
|
10735
|
+
disabled,
|
|
10736
|
+
placeholder: selected.length === 0 ? placeholder : void 0,
|
|
10737
|
+
className: cx(TagSelect_default.input, inputCollapsed && TagSelect_default.inputCollapsed),
|
|
10738
|
+
value: inputValue,
|
|
10739
|
+
onChange: (e) => {
|
|
10740
|
+
const next = e.target.value;
|
|
10741
|
+
setInputValue(next);
|
|
10742
|
+
const nextTrim = next.trim();
|
|
10743
|
+
const nextFiltered = optionsForList(options, next, selected);
|
|
10744
|
+
const nextShowCreate = shouldShowCreate(creatable, nextTrim, selected, options);
|
|
10745
|
+
if (nextFiltered.length > 0 || nextShowCreate) {
|
|
10746
|
+
setOpen(true);
|
|
10747
|
+
} else {
|
|
10748
|
+
setOpen(false);
|
|
10749
|
+
}
|
|
10750
|
+
},
|
|
10751
|
+
onKeyDown: onInputKeyDown,
|
|
10752
|
+
onFocus: () => {
|
|
10753
|
+
setInputFocused(true);
|
|
10754
|
+
if (!disabled && hasPanelContent) setOpen(true);
|
|
10755
|
+
},
|
|
10756
|
+
onBlur: handleInputBlur
|
|
10757
|
+
}
|
|
10758
|
+
)
|
|
10759
|
+
] }),
|
|
10760
|
+
/* @__PURE__ */ jsx57("span", { className: TagSelect_default.chevronSlot, "aria-hidden": true, children: /* @__PURE__ */ jsx57("span", { className: TagSelect_default.chevron }) })
|
|
10761
|
+
]
|
|
10762
|
+
}
|
|
10763
|
+
),
|
|
10764
|
+
/* @__PURE__ */ jsx57(Portal, { children: /* @__PURE__ */ jsxs31(
|
|
10765
|
+
ScrollContainer,
|
|
10766
|
+
{
|
|
10767
|
+
ref: listboxRef,
|
|
10768
|
+
id: listboxId,
|
|
10769
|
+
role: "listbox",
|
|
10770
|
+
"aria-multiselectable": "true",
|
|
10771
|
+
"aria-hidden": !open,
|
|
10772
|
+
tabIndex: -1,
|
|
10773
|
+
"data-react-aria-top-layer": "true",
|
|
10774
|
+
"data-overlay-portal-layer": overlayPortalLayer,
|
|
10775
|
+
className: cx(Select_default.content, TagSelect_default.panelInner),
|
|
10776
|
+
onKeyDown: onListboxKeyDown,
|
|
10777
|
+
style: { display: open ? void 0 : "none" },
|
|
10778
|
+
...toDataAttributes({ side: resolvedSide, size }),
|
|
10779
|
+
children: [
|
|
10780
|
+
hint ? /* @__PURE__ */ jsx57("div", { className: TagSelect_default.hint, children: /* @__PURE__ */ jsx57(Typography.Root, { as: "div", variant: "body-small", tone: "muted", children: hint }) }) : null,
|
|
10781
|
+
showCreate ? /* @__PURE__ */ jsxs31(
|
|
10782
|
+
"button",
|
|
10783
|
+
{
|
|
10784
|
+
type: "button",
|
|
10785
|
+
role: "option",
|
|
10786
|
+
"aria-selected": false,
|
|
10787
|
+
className: TagSelect_default.createRow,
|
|
10788
|
+
...toDataAttributes({
|
|
10789
|
+
value: CREATE_VALUE,
|
|
10790
|
+
label: inputTrim,
|
|
10791
|
+
highlighted: highlightedValue === CREATE_VALUE,
|
|
10792
|
+
disabled: false
|
|
10793
|
+
}),
|
|
10794
|
+
onMouseDown: (e) => {
|
|
10795
|
+
e.preventDefault();
|
|
10796
|
+
},
|
|
10797
|
+
onMouseEnter: () => setHighlightedValue(CREATE_VALUE),
|
|
10798
|
+
onClick: () => handleSelectFromList(CREATE_VALUE),
|
|
10799
|
+
children: [
|
|
10800
|
+
/* @__PURE__ */ jsx57(
|
|
10801
|
+
Typography.Root,
|
|
10802
|
+
{
|
|
10803
|
+
as: "span",
|
|
10804
|
+
variant: "body-small",
|
|
10805
|
+
tone: "muted",
|
|
10806
|
+
className: TagSelect_default.createLabel,
|
|
10807
|
+
children: createActionLabel
|
|
10808
|
+
}
|
|
10809
|
+
),
|
|
10810
|
+
/* @__PURE__ */ jsx57(Badge.Root, { color: defaultTagColor, variant: "filled", children: inputTrim })
|
|
10811
|
+
]
|
|
10812
|
+
},
|
|
10813
|
+
CREATE_VALUE
|
|
10814
|
+
) : null,
|
|
10815
|
+
filtered.map((o) => /* @__PURE__ */ jsx57(
|
|
10816
|
+
"button",
|
|
10817
|
+
{
|
|
10818
|
+
type: "button",
|
|
10819
|
+
role: "option",
|
|
10820
|
+
"aria-selected": false,
|
|
10821
|
+
disabled: o.disabled,
|
|
10822
|
+
className: TagSelect_default.optionRow,
|
|
10823
|
+
...toDataAttributes({
|
|
10824
|
+
value: o.value,
|
|
10825
|
+
label: o.label,
|
|
10826
|
+
highlighted: highlightedValue === o.value,
|
|
10827
|
+
selected: false,
|
|
10828
|
+
disabled: Boolean(o.disabled)
|
|
10829
|
+
}),
|
|
10830
|
+
onMouseDown: (e) => {
|
|
10831
|
+
if (!o.disabled) e.preventDefault();
|
|
10832
|
+
},
|
|
10833
|
+
onMouseEnter: () => !o.disabled && setHighlightedValue(o.value),
|
|
10834
|
+
onClick: () => !o.disabled && handleSelectFromList(o.value),
|
|
10835
|
+
children: /* @__PURE__ */ jsx57(Badge.Root, { color: o.color ?? defaultTagColor, variant: "filled", children: o.label })
|
|
10836
|
+
},
|
|
10837
|
+
o.value
|
|
10838
|
+
))
|
|
10839
|
+
]
|
|
10840
|
+
}
|
|
10841
|
+
) })
|
|
10842
|
+
] });
|
|
10843
|
+
}
|
|
10844
|
+
TagSelectRoot.displayName = "TagSelectRoot";
|
|
10845
|
+
var TagSelect = {
|
|
10846
|
+
Root: TagSelectRoot
|
|
10847
|
+
};
|
|
10848
|
+
|
|
10075
10849
|
// src/components/textarea/Textarea.tsx
|
|
10076
|
-
import * as
|
|
10850
|
+
import * as React72 from "react";
|
|
10077
10851
|
|
|
10078
10852
|
// src/components/textarea/Textarea.module.css
|
|
10079
10853
|
var Textarea_default = {
|
|
@@ -10090,11 +10864,11 @@ var Textarea_default = {
|
|
|
10090
10864
|
};
|
|
10091
10865
|
|
|
10092
10866
|
// src/components/textarea/Textarea.tsx
|
|
10093
|
-
import { jsx as
|
|
10867
|
+
import { jsx as jsx58, jsxs as jsxs32 } from "react/jsx-runtime";
|
|
10094
10868
|
var [TextareaProvider, useTextareaContext] = createComponentContext("Textarea");
|
|
10095
10869
|
function TextareaCharCounter({ current, max }) {
|
|
10096
10870
|
const overflow = current > max;
|
|
10097
|
-
return /* @__PURE__ */
|
|
10871
|
+
return /* @__PURE__ */ jsxs32(
|
|
10098
10872
|
"span",
|
|
10099
10873
|
{
|
|
10100
10874
|
className: Textarea_default.charCounter,
|
|
@@ -10112,8 +10886,8 @@ TextareaCharCounter.displayName = "Textarea.CharCounter";
|
|
|
10112
10886
|
function partitionTextareaChildren(children) {
|
|
10113
10887
|
const counters = [];
|
|
10114
10888
|
const rest = [];
|
|
10115
|
-
|
|
10116
|
-
if (
|
|
10889
|
+
React72.Children.forEach(children, (child) => {
|
|
10890
|
+
if (React72.isValidElement(child) && child.type === TextareaCharCounter) {
|
|
10117
10891
|
counters.push(child);
|
|
10118
10892
|
} else if (child != null && child !== false) {
|
|
10119
10893
|
rest.push(child);
|
|
@@ -10121,7 +10895,7 @@ function partitionTextareaChildren(children) {
|
|
|
10121
10895
|
});
|
|
10122
10896
|
return { counters, rest };
|
|
10123
10897
|
}
|
|
10124
|
-
var TextareaRoot =
|
|
10898
|
+
var TextareaRoot = React72.forwardRef(
|
|
10125
10899
|
({
|
|
10126
10900
|
id,
|
|
10127
10901
|
className,
|
|
@@ -10138,12 +10912,12 @@ var TextareaRoot = React70.forwardRef(
|
|
|
10138
10912
|
children,
|
|
10139
10913
|
...rest
|
|
10140
10914
|
}, ref) => {
|
|
10141
|
-
const rawId =
|
|
10915
|
+
const rawId = React72.useId();
|
|
10142
10916
|
const inputId = id ?? rawId;
|
|
10143
10917
|
const hintId = `${inputId}-hint`;
|
|
10144
10918
|
const errorId = `${inputId}-error`;
|
|
10145
|
-
const [hasHint, setHasHint] =
|
|
10146
|
-
const [hasError, setHasError] =
|
|
10919
|
+
const [hasHint, setHasHint] = React72.useState(false);
|
|
10920
|
+
const [hasError, setHasError] = React72.useState(false);
|
|
10147
10921
|
const invalid = variant === "error" || hasError;
|
|
10148
10922
|
const resolvedAriaInvalid = ariaInvalid ?? (invalid || void 0);
|
|
10149
10923
|
const parts = [
|
|
@@ -10152,25 +10926,25 @@ var TextareaRoot = React70.forwardRef(
|
|
|
10152
10926
|
hasError ? errorId : void 0
|
|
10153
10927
|
].filter(Boolean);
|
|
10154
10928
|
const describedBy = parts.length > 0 ? parts.join(" ") : void 0;
|
|
10155
|
-
const registerHint =
|
|
10156
|
-
const unregisterHint =
|
|
10157
|
-
const registerError =
|
|
10158
|
-
const unregisterError =
|
|
10159
|
-
const wrapperRef =
|
|
10929
|
+
const registerHint = React72.useCallback(() => setHasHint(true), []);
|
|
10930
|
+
const unregisterHint = React72.useCallback(() => setHasHint(false), []);
|
|
10931
|
+
const registerError = React72.useCallback(() => setHasError(true), []);
|
|
10932
|
+
const unregisterError = React72.useCallback(() => setHasError(false), []);
|
|
10933
|
+
const wrapperRef = React72.useRef(null);
|
|
10160
10934
|
const { counters: counterChildren, rest: otherChildren } = partitionTextareaChildren(children);
|
|
10161
10935
|
const showFooter = counterChildren.length > 0;
|
|
10162
|
-
|
|
10936
|
+
React72.useLayoutEffect(() => {
|
|
10163
10937
|
if (!autoResize || !wrapperRef.current) return;
|
|
10164
10938
|
const textarea = wrapperRef.current.querySelector("textarea");
|
|
10165
10939
|
if (textarea) {
|
|
10166
10940
|
wrapperRef.current.dataset.value = textarea.value;
|
|
10167
10941
|
}
|
|
10168
10942
|
}, [autoResize]);
|
|
10169
|
-
|
|
10943
|
+
React72.useEffect(() => {
|
|
10170
10944
|
if (!autoResize || !wrapperRef.current || typeof value !== "string") return;
|
|
10171
10945
|
wrapperRef.current.dataset.value = value;
|
|
10172
10946
|
}, [autoResize, value]);
|
|
10173
|
-
const handleInput =
|
|
10947
|
+
const handleInput = React72.useCallback(
|
|
10174
10948
|
(e) => {
|
|
10175
10949
|
if (autoResize && wrapperRef.current) {
|
|
10176
10950
|
wrapperRef.current.dataset.value = e.currentTarget.value;
|
|
@@ -10179,7 +10953,7 @@ var TextareaRoot = React70.forwardRef(
|
|
|
10179
10953
|
},
|
|
10180
10954
|
[autoResize, onInput]
|
|
10181
10955
|
);
|
|
10182
|
-
const ctxValue =
|
|
10956
|
+
const ctxValue = React72.useMemo(
|
|
10183
10957
|
() => ({
|
|
10184
10958
|
hintId,
|
|
10185
10959
|
errorId,
|
|
@@ -10203,7 +10977,7 @@ var TextareaRoot = React70.forwardRef(
|
|
|
10203
10977
|
unregisterError
|
|
10204
10978
|
]
|
|
10205
10979
|
);
|
|
10206
|
-
const textareaEl = /* @__PURE__ */
|
|
10980
|
+
const textareaEl = /* @__PURE__ */ jsx58(
|
|
10207
10981
|
"textarea",
|
|
10208
10982
|
{
|
|
10209
10983
|
ref,
|
|
@@ -10219,9 +10993,9 @@ var TextareaRoot = React70.forwardRef(
|
|
|
10219
10993
|
...rest
|
|
10220
10994
|
}
|
|
10221
10995
|
);
|
|
10222
|
-
const textareaBlock = autoResize ? /* @__PURE__ */
|
|
10223
|
-
return /* @__PURE__ */
|
|
10224
|
-
/* @__PURE__ */
|
|
10996
|
+
const textareaBlock = autoResize ? /* @__PURE__ */ jsx58("div", { ref: wrapperRef, className: Textarea_default.autoResize, children: textareaEl }) : textareaEl;
|
|
10997
|
+
return /* @__PURE__ */ jsx58(TextareaProvider, { value: ctxValue, children: /* @__PURE__ */ jsx58(ControlSizeProvider, { value: size, children: /* @__PURE__ */ jsxs32("div", { className: Textarea_default.field, ...toDataAttributes({ size }), children: [
|
|
10998
|
+
/* @__PURE__ */ jsx58(
|
|
10225
10999
|
"label",
|
|
10226
11000
|
{
|
|
10227
11001
|
htmlFor: inputId,
|
|
@@ -10232,9 +11006,9 @@ var TextareaRoot = React70.forwardRef(
|
|
|
10232
11006
|
readonly: Boolean(readOnly),
|
|
10233
11007
|
size
|
|
10234
11008
|
}),
|
|
10235
|
-
children: /* @__PURE__ */
|
|
10236
|
-
/* @__PURE__ */
|
|
10237
|
-
showFooter ? /* @__PURE__ */
|
|
11009
|
+
children: /* @__PURE__ */ jsxs32("div", { className: Textarea_default.controlStack, children: [
|
|
11010
|
+
/* @__PURE__ */ jsx58("div", { className: Textarea_default.textareaRegion, children: textareaBlock }),
|
|
11011
|
+
showFooter ? /* @__PURE__ */ jsx58("div", { className: Textarea_default.controlFooter, children: counterChildren }) : null
|
|
10238
11012
|
] })
|
|
10239
11013
|
}
|
|
10240
11014
|
),
|
|
@@ -10245,13 +11019,13 @@ var TextareaRoot = React70.forwardRef(
|
|
|
10245
11019
|
TextareaRoot.displayName = "Textarea.Root";
|
|
10246
11020
|
function TextareaHint({ children, className, ...rest }) {
|
|
10247
11021
|
const { hintId, registerHint, unregisterHint, size, disabled, readOnly } = useTextareaContext();
|
|
10248
|
-
|
|
11022
|
+
React72.useLayoutEffect(() => {
|
|
10249
11023
|
registerHint();
|
|
10250
11024
|
return () => {
|
|
10251
11025
|
unregisterHint();
|
|
10252
11026
|
};
|
|
10253
11027
|
}, [registerHint, unregisterHint]);
|
|
10254
|
-
return /* @__PURE__ */
|
|
11028
|
+
return /* @__PURE__ */ jsx58(
|
|
10255
11029
|
Hint.Root,
|
|
10256
11030
|
{
|
|
10257
11031
|
id: hintId,
|
|
@@ -10266,13 +11040,13 @@ function TextareaHint({ children, className, ...rest }) {
|
|
|
10266
11040
|
TextareaHint.displayName = "Textarea.Hint";
|
|
10267
11041
|
function TextareaError({ children, className, ...rest }) {
|
|
10268
11042
|
const { errorId, registerError, unregisterError, size } = useTextareaContext();
|
|
10269
|
-
|
|
11043
|
+
React72.useLayoutEffect(() => {
|
|
10270
11044
|
registerError();
|
|
10271
11045
|
return () => {
|
|
10272
11046
|
unregisterError();
|
|
10273
11047
|
};
|
|
10274
11048
|
}, [registerError, unregisterError]);
|
|
10275
|
-
return /* @__PURE__ */
|
|
11049
|
+
return /* @__PURE__ */ jsx58(
|
|
10276
11050
|
Hint.Root,
|
|
10277
11051
|
{
|
|
10278
11052
|
id: errorId,
|
|
@@ -10345,6 +11119,7 @@ export {
|
|
|
10345
11119
|
Switch,
|
|
10346
11120
|
Tabs,
|
|
10347
11121
|
Tag,
|
|
11122
|
+
TagSelect,
|
|
10348
11123
|
Textarea,
|
|
10349
11124
|
Tooltip,
|
|
10350
11125
|
Typography,
|