@platned/ui 0.9.7 → 0.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-O2Y4XUXQ.js → chunk-OVIRTNT4.js} +115 -117
- package/dist/chunk-OVIRTNT4.js.map +1 -0
- package/dist/data-table.cjs +18 -179
- package/dist/data-table.cjs.map +1 -1
- package/dist/data-table.js +1 -1
- package/dist/index.cjs +3270 -2589
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +602 -232
- package/dist/index.js +2449 -1756
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/dist/chunk-O2Y4XUXQ.js.map +0 -1
|
@@ -353,16 +353,33 @@ var IconButton = forwardRef4(function IconButton2({
|
|
|
353
353
|
|
|
354
354
|
// src/components/forms/field.tsx
|
|
355
355
|
import {
|
|
356
|
+
Children,
|
|
356
357
|
createContext as createContext2,
|
|
357
358
|
forwardRef as forwardRef5,
|
|
359
|
+
useCallback,
|
|
358
360
|
useContext as useContext2,
|
|
359
|
-
|
|
361
|
+
useEffect,
|
|
362
|
+
useId,
|
|
363
|
+
useLayoutEffect,
|
|
364
|
+
useMemo,
|
|
365
|
+
useState
|
|
360
366
|
} from "react";
|
|
361
367
|
import { jsx as jsx5 } from "react/jsx-runtime";
|
|
362
368
|
var FieldContext = createContext2(null);
|
|
363
369
|
function useFieldContext() {
|
|
364
370
|
return useContext2(FieldContext);
|
|
365
371
|
}
|
|
372
|
+
var useIsomorphicLayoutEffect = typeof window === "undefined" ? useEffect : useLayoutEffect;
|
|
373
|
+
function useRegisterPart(field, part, showing) {
|
|
374
|
+
const register = field?.register;
|
|
375
|
+
useIsomorphicLayoutEffect(() => {
|
|
376
|
+
if (!register || !showing) return;
|
|
377
|
+
return register(part);
|
|
378
|
+
}, [register, part, showing]);
|
|
379
|
+
}
|
|
380
|
+
function hasContent(children) {
|
|
381
|
+
return Children.toArray(children).some((child) => child !== "");
|
|
382
|
+
}
|
|
366
383
|
function useFieldControl() {
|
|
367
384
|
const field = useFieldContext();
|
|
368
385
|
if (!field) {
|
|
@@ -395,53 +412,56 @@ var GAP = {
|
|
|
395
412
|
function Field({
|
|
396
413
|
children,
|
|
397
414
|
id,
|
|
398
|
-
size:
|
|
415
|
+
size: sizeProp,
|
|
399
416
|
invalid = false,
|
|
400
417
|
required = false,
|
|
401
418
|
disabled = false,
|
|
402
419
|
orientation = "vertical",
|
|
403
|
-
hasDescription = false,
|
|
404
|
-
hasError = false,
|
|
405
|
-
hasHint = false,
|
|
406
420
|
className,
|
|
407
421
|
...rest
|
|
408
422
|
}) {
|
|
409
423
|
const generated = useId();
|
|
410
424
|
const controlId = id ?? generated;
|
|
411
|
-
|
|
412
|
-
|
|
425
|
+
const size2 = useControlSize(sizeProp);
|
|
426
|
+
const [parts2, setParts] = useState({ description: 0, error: 0, hint: 0 });
|
|
427
|
+
const register = useCallback((part) => {
|
|
428
|
+
setParts((p) => ({ ...p, [part]: p[part] + 1 }));
|
|
429
|
+
return () => setParts((p) => ({ ...p, [part]: p[part] - 1 }));
|
|
430
|
+
}, []);
|
|
431
|
+
const hasError = parts2.error > 0;
|
|
432
|
+
const value = useMemo(
|
|
433
|
+
() => ({
|
|
434
|
+
controlId,
|
|
435
|
+
labelId: `${controlId}-label`,
|
|
436
|
+
descriptionId: `${controlId}-description`,
|
|
437
|
+
errorId: `${controlId}-error`,
|
|
438
|
+
hintId: `${controlId}-hint`,
|
|
439
|
+
hasDescription: parts2.description > 0,
|
|
440
|
+
hasError,
|
|
441
|
+
hasHint: parts2.hint > 0,
|
|
442
|
+
invalid: invalid || hasError,
|
|
443
|
+
required,
|
|
444
|
+
disabled,
|
|
445
|
+
size: size2,
|
|
446
|
+
register
|
|
447
|
+
}),
|
|
448
|
+
[controlId, parts2, hasError, invalid, required, disabled, size2, register]
|
|
449
|
+
);
|
|
450
|
+
return /* @__PURE__ */ jsx5(FieldContext.Provider, { value, children: /* @__PURE__ */ jsx5(
|
|
451
|
+
"div",
|
|
413
452
|
{
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
required,
|
|
425
|
-
disabled,
|
|
426
|
-
size: size2
|
|
427
|
-
},
|
|
428
|
-
children: /* @__PURE__ */ jsx5(
|
|
429
|
-
"div",
|
|
430
|
-
{
|
|
431
|
-
role: orientation === "horizontal" ? "group" : void 0,
|
|
432
|
-
"data-slot": "field",
|
|
433
|
-
"data-invalid": invalid || hasError || void 0,
|
|
434
|
-
"data-disabled": disabled || void 0,
|
|
435
|
-
className: cn(
|
|
436
|
-
orientation === "horizontal" ? "flex flex-row items-center justify-between gap-3" : cn("flex flex-col", GAP[size2]),
|
|
437
|
-
className
|
|
438
|
-
),
|
|
439
|
-
...rest,
|
|
440
|
-
children
|
|
441
|
-
}
|
|
442
|
-
)
|
|
453
|
+
role: orientation === "horizontal" ? "group" : void 0,
|
|
454
|
+
"data-slot": "field",
|
|
455
|
+
"data-invalid": invalid || hasError || void 0,
|
|
456
|
+
"data-disabled": disabled || void 0,
|
|
457
|
+
className: cn(
|
|
458
|
+
orientation === "horizontal" ? "flex flex-row items-center justify-between gap-3" : cn("flex flex-col", GAP[size2]),
|
|
459
|
+
className
|
|
460
|
+
),
|
|
461
|
+
...rest,
|
|
462
|
+
children
|
|
443
463
|
}
|
|
444
|
-
);
|
|
464
|
+
) });
|
|
445
465
|
}
|
|
446
466
|
var LABEL_TEXT = {
|
|
447
467
|
lg: "text-body",
|
|
@@ -475,6 +495,9 @@ function FieldLabel({ children, className, htmlFor, ...rest }) {
|
|
|
475
495
|
}
|
|
476
496
|
function FieldDescription({ children, className, ...rest }) {
|
|
477
497
|
const field = useFieldContext();
|
|
498
|
+
const showing = hasContent(children);
|
|
499
|
+
useRegisterPart(field, "description", showing);
|
|
500
|
+
if (!showing) return null;
|
|
478
501
|
return /* @__PURE__ */ jsx5(
|
|
479
502
|
"p",
|
|
480
503
|
{
|
|
@@ -492,6 +515,9 @@ function FieldDescription({ children, className, ...rest }) {
|
|
|
492
515
|
}
|
|
493
516
|
function FieldError({ children, className, ...rest }) {
|
|
494
517
|
const field = useFieldContext();
|
|
518
|
+
const showing = hasContent(children);
|
|
519
|
+
useRegisterPart(field, "error", showing);
|
|
520
|
+
if (!showing) return null;
|
|
495
521
|
return /* @__PURE__ */ jsx5(
|
|
496
522
|
"p",
|
|
497
523
|
{
|
|
@@ -506,6 +532,9 @@ function FieldError({ children, className, ...rest }) {
|
|
|
506
532
|
}
|
|
507
533
|
function FieldHint({ children, className, ...rest }) {
|
|
508
534
|
const field = useFieldContext();
|
|
535
|
+
const showing = hasContent(children);
|
|
536
|
+
useRegisterPart(field, "hint", showing);
|
|
537
|
+
if (!showing || field?.hasError) return null;
|
|
509
538
|
return /* @__PURE__ */ jsx5(
|
|
510
539
|
"p",
|
|
511
540
|
{
|
|
@@ -578,11 +607,11 @@ var SCROLLBAR_CLASSES = clsx6(
|
|
|
578
607
|
);
|
|
579
608
|
|
|
580
609
|
// src/components/overlays/overlay.ts
|
|
581
|
-
import { useEffect as
|
|
610
|
+
import { useEffect as useEffect3, useRef as useRef2 } from "react";
|
|
582
611
|
import { tabbable } from "tabbable";
|
|
583
612
|
|
|
584
613
|
// src/components/overlays/overlay-stack.ts
|
|
585
|
-
import { useEffect, useRef, useState } from "react";
|
|
614
|
+
import { useEffect as useEffect2, useRef, useState as useState2 } from "react";
|
|
586
615
|
var layers = [];
|
|
587
616
|
var listeners = /* @__PURE__ */ new Set();
|
|
588
617
|
function notify() {
|
|
@@ -654,8 +683,8 @@ function useOverlayLayer(active, {
|
|
|
654
683
|
} = {}) {
|
|
655
684
|
const id = useRef();
|
|
656
685
|
if (!id.current) id.current = /* @__PURE__ */ Symbol("overlay-layer");
|
|
657
|
-
const [isTopmost, setIsTopmost] =
|
|
658
|
-
|
|
686
|
+
const [isTopmost, setIsTopmost] = useState2(false);
|
|
687
|
+
useEffect2(() => {
|
|
659
688
|
if (!active) return;
|
|
660
689
|
const self = id.current;
|
|
661
690
|
layers.push({ id: self });
|
|
@@ -672,7 +701,7 @@ function useOverlayLayer(active, {
|
|
|
672
701
|
if (shouldLockScroll) unlockScroll();
|
|
673
702
|
};
|
|
674
703
|
}, [active, shouldLockScroll]);
|
|
675
|
-
|
|
704
|
+
useEffect2(() => {
|
|
676
705
|
if (!active || !inertBackground) return;
|
|
677
706
|
if (inerted.size === 0) applyInert(panelRef?.current ?? null);
|
|
678
707
|
return () => {
|
|
@@ -708,7 +737,7 @@ function useOverlayDismiss({
|
|
|
708
737
|
handlers.current = { onDismiss, onEscapeKeyDown, onInteractOutside };
|
|
709
738
|
const isTopmostRef = useRef2(isTopmost);
|
|
710
739
|
isTopmostRef.current = isTopmost;
|
|
711
|
-
|
|
740
|
+
useEffect3(() => {
|
|
712
741
|
if (!active || !closeOnEscape) return;
|
|
713
742
|
function onKeyDown(event) {
|
|
714
743
|
if (event.key !== "Escape") return;
|
|
@@ -726,7 +755,7 @@ function useOverlayDismiss({
|
|
|
726
755
|
document.addEventListener("keydown", onKeyDown);
|
|
727
756
|
return () => document.removeEventListener("keydown", onKeyDown);
|
|
728
757
|
}, [active, closeOnEscape]);
|
|
729
|
-
|
|
758
|
+
useEffect3(() => {
|
|
730
759
|
if (!active || !closeOnOutsidePress) return;
|
|
731
760
|
function onPointerDown(event) {
|
|
732
761
|
if (!isTopmostRef.current) return;
|
|
@@ -739,7 +768,7 @@ function useOverlayDismiss({
|
|
|
739
768
|
document.addEventListener("pointerdown", onPointerDown);
|
|
740
769
|
return () => document.removeEventListener("pointerdown", onPointerDown);
|
|
741
770
|
}, [active, closeOnOutsidePress, panelRef]);
|
|
742
|
-
|
|
771
|
+
useEffect3(() => {
|
|
743
772
|
if (!active || !trapFocus) return;
|
|
744
773
|
function onKeyDown(event) {
|
|
745
774
|
if (event.key !== "Tab" || !isTopmostRef.current) return;
|
|
@@ -778,7 +807,7 @@ function useOverlayDismiss({
|
|
|
778
807
|
document.removeEventListener("focusin", onFocusIn);
|
|
779
808
|
};
|
|
780
809
|
}, [active, trapFocus, panelRef]);
|
|
781
|
-
|
|
810
|
+
useEffect3(() => {
|
|
782
811
|
if (!active) return;
|
|
783
812
|
const previouslyFocused = document.activeElement;
|
|
784
813
|
const panel = panelRef.current;
|
|
@@ -834,7 +863,7 @@ function vetoable(event, onVeto) {
|
|
|
834
863
|
}
|
|
835
864
|
|
|
836
865
|
// src/components/overlays/portal.tsx
|
|
837
|
-
import { createContext as createContext3, useContext as useContext3, useEffect as
|
|
866
|
+
import { createContext as createContext3, useContext as useContext3, useEffect as useEffect4, useState as useState3 } from "react";
|
|
838
867
|
import { createPortal } from "react-dom";
|
|
839
868
|
import { jsx as jsx6 } from "react/jsx-runtime";
|
|
840
869
|
var PortalContainerContext = createContext3(null);
|
|
@@ -848,9 +877,9 @@ function usePortalContainer() {
|
|
|
848
877
|
return useContext3(PortalContainerContext);
|
|
849
878
|
}
|
|
850
879
|
function Portal({ children, container }) {
|
|
851
|
-
const [mounted, setMounted] =
|
|
880
|
+
const [mounted, setMounted] = useState3(false);
|
|
852
881
|
const contextContainer = useContext3(PortalContainerContext);
|
|
853
|
-
|
|
882
|
+
useEffect4(() => setMounted(true), []);
|
|
854
883
|
if (!mounted) return null;
|
|
855
884
|
const target = container ?? contextContainer ?? (typeof document === "undefined" ? null : document.body);
|
|
856
885
|
if (!target) return null;
|
|
@@ -860,10 +889,10 @@ function Portal({ children, container }) {
|
|
|
860
889
|
// src/components/forms/select.tsx
|
|
861
890
|
import {
|
|
862
891
|
forwardRef as forwardRef6,
|
|
863
|
-
useEffect as
|
|
892
|
+
useEffect as useEffect6,
|
|
864
893
|
useId as useId2,
|
|
865
894
|
useRef as useRef6,
|
|
866
|
-
useState as
|
|
895
|
+
useState as useState6
|
|
867
896
|
} from "react";
|
|
868
897
|
import clsx8 from "clsx";
|
|
869
898
|
import { CheckIcon, ChevronDownIcon } from "lucide-react";
|
|
@@ -878,13 +907,13 @@ function devWarn(message) {
|
|
|
878
907
|
}
|
|
879
908
|
|
|
880
909
|
// src/lib/use-controllable-state.ts
|
|
881
|
-
import { useCallback, useRef as useRef3, useState as
|
|
910
|
+
import { useCallback as useCallback2, useRef as useRef3, useState as useState4 } from "react";
|
|
882
911
|
function useControllableState({
|
|
883
912
|
value,
|
|
884
913
|
defaultValue,
|
|
885
914
|
onChange
|
|
886
915
|
}) {
|
|
887
|
-
const [internal, setInternal] =
|
|
916
|
+
const [internal, setInternal] = useState4(defaultValue);
|
|
888
917
|
const isControlled = value !== void 0;
|
|
889
918
|
const current = isControlled ? value : internal;
|
|
890
919
|
const onChangeRef = useRef3(onChange);
|
|
@@ -893,7 +922,7 @@ function useControllableState({
|
|
|
893
922
|
currentRef.current = current;
|
|
894
923
|
const isControlledRef = useRef3(isControlled);
|
|
895
924
|
isControlledRef.current = isControlled;
|
|
896
|
-
const setValue =
|
|
925
|
+
const setValue = useCallback2((next) => {
|
|
897
926
|
const resolved = typeof next === "function" ? next(currentRef.current) : next;
|
|
898
927
|
if (resolved === currentRef.current) return;
|
|
899
928
|
if (!isControlledRef.current) setInternal(resolved);
|
|
@@ -903,7 +932,7 @@ function useControllableState({
|
|
|
903
932
|
}
|
|
904
933
|
|
|
905
934
|
// src/lib/use-roving-focus.ts
|
|
906
|
-
import { useCallback as
|
|
935
|
+
import { useCallback as useCallback3, useEffect as useEffect5, useRef as useRef4, useState as useState5 } from "react";
|
|
907
936
|
function useRovingFocus({
|
|
908
937
|
orientation = "horizontal",
|
|
909
938
|
loop = true,
|
|
@@ -911,24 +940,24 @@ function useRovingFocus({
|
|
|
911
940
|
defaultIndex = 0,
|
|
912
941
|
onEscape
|
|
913
942
|
} = {}) {
|
|
914
|
-
const [activeIndex, setActiveIndex] =
|
|
943
|
+
const [activeIndex, setActiveIndex] = useState5(defaultIndex);
|
|
915
944
|
const items = useRef4([]);
|
|
916
945
|
const meta = useRef4([]);
|
|
917
946
|
const search = useRef4("");
|
|
918
947
|
const searchTimer = useRef4(null);
|
|
919
|
-
|
|
948
|
+
useEffect5(
|
|
920
949
|
() => () => {
|
|
921
950
|
if (searchTimer.current) clearTimeout(searchTimer.current);
|
|
922
951
|
},
|
|
923
952
|
[]
|
|
924
953
|
);
|
|
925
|
-
const focusIndex =
|
|
954
|
+
const focusIndex = useCallback3((index) => {
|
|
926
955
|
const node = items.current[index];
|
|
927
956
|
if (!node) return;
|
|
928
957
|
setActiveIndex(index);
|
|
929
958
|
node.focus();
|
|
930
959
|
}, []);
|
|
931
|
-
const move =
|
|
960
|
+
const move = useCallback3(
|
|
932
961
|
(start, step) => {
|
|
933
962
|
const total = items.current.length;
|
|
934
963
|
if (total === 0) return;
|
|
@@ -947,7 +976,7 @@ function useRovingFocus({
|
|
|
947
976
|
},
|
|
948
977
|
[loop, focusIndex]
|
|
949
978
|
);
|
|
950
|
-
const moveToEdge =
|
|
979
|
+
const moveToEdge = useCallback3(
|
|
951
980
|
(from) => {
|
|
952
981
|
const total = items.current.length;
|
|
953
982
|
if (total === 0) return;
|
|
@@ -955,7 +984,7 @@ function useRovingFocus({
|
|
|
955
984
|
},
|
|
956
985
|
[move]
|
|
957
986
|
);
|
|
958
|
-
const runTypeahead =
|
|
987
|
+
const runTypeahead = useCallback3(
|
|
959
988
|
(char) => {
|
|
960
989
|
if (searchTimer.current) clearTimeout(searchTimer.current);
|
|
961
990
|
search.current += char.toLowerCase();
|
|
@@ -976,7 +1005,7 @@ function useRovingFocus({
|
|
|
976
1005
|
},
|
|
977
1006
|
[activeIndex, focusIndex]
|
|
978
1007
|
);
|
|
979
|
-
const onKeyDown =
|
|
1008
|
+
const onKeyDown = useCallback3(
|
|
980
1009
|
(event) => {
|
|
981
1010
|
const { key } = event;
|
|
982
1011
|
const vertical = orientation === "vertical" || orientation === "both";
|
|
@@ -1009,7 +1038,7 @@ function useRovingFocus({
|
|
|
1009
1038
|
},
|
|
1010
1039
|
[orientation, activeIndex, move, moveToEdge, onEscape, typeahead, runTypeahead]
|
|
1011
1040
|
);
|
|
1012
|
-
const itemProps =
|
|
1041
|
+
const itemProps = useCallback3(
|
|
1013
1042
|
(index, options = {}) => {
|
|
1014
1043
|
meta.current[index] = options;
|
|
1015
1044
|
return {
|
|
@@ -1142,8 +1171,8 @@ function isGroup(entry) {
|
|
|
1142
1171
|
function flatten(entries) {
|
|
1143
1172
|
return entries.flatMap((entry) => isGroup(entry) ? entry.options : [entry]);
|
|
1144
1173
|
}
|
|
1145
|
-
var
|
|
1146
|
-
function
|
|
1174
|
+
var Select = forwardRef6(
|
|
1175
|
+
function Select2({
|
|
1147
1176
|
options,
|
|
1148
1177
|
value: valueProp,
|
|
1149
1178
|
defaultValue = null,
|
|
@@ -1151,6 +1180,7 @@ var SelectControl = forwardRef6(
|
|
|
1151
1180
|
name,
|
|
1152
1181
|
size: sizeProp,
|
|
1153
1182
|
invalid = false,
|
|
1183
|
+
required = false,
|
|
1154
1184
|
placeholder = "Select\u2026",
|
|
1155
1185
|
className,
|
|
1156
1186
|
onKeyDown,
|
|
@@ -1164,23 +1194,23 @@ var SelectControl = forwardRef6(
|
|
|
1164
1194
|
defaultValue,
|
|
1165
1195
|
onChange: onValueChange
|
|
1166
1196
|
});
|
|
1167
|
-
const [open, setOpen] =
|
|
1197
|
+
const [open, setOpen] = useState6(false);
|
|
1168
1198
|
const baseId = useId2();
|
|
1169
1199
|
const listboxId = `${baseId}-listbox`;
|
|
1170
1200
|
const valueId = `${baseId}-value`;
|
|
1171
1201
|
const optionId = (index) => `${baseId}-option-${index}`;
|
|
1172
1202
|
const triggerRef = useRef6(null);
|
|
1173
1203
|
const panelRef = useRef6(null);
|
|
1174
|
-
const [panelNode, setPanelNode] =
|
|
1204
|
+
const [panelNode, setPanelNode] = useState6(null);
|
|
1175
1205
|
const pendingEdge = useRef6("start");
|
|
1176
1206
|
const flat = flatten(options);
|
|
1177
1207
|
const selected = flat.find((option) => option.value === value) ?? null;
|
|
1178
1208
|
const isInvalid = invalid || !!field["aria-invalid"];
|
|
1179
1209
|
const isDisabled = props.disabled ?? field.disabled;
|
|
1180
|
-
const isRequired = Boolean(field["aria-required"]) || Boolean(props["aria-required"]);
|
|
1210
|
+
const isRequired = required || Boolean(field["aria-required"]) || Boolean(props["aria-required"]);
|
|
1181
1211
|
if (!fieldContext && !props["aria-label"] && !props["aria-labelledby"]) {
|
|
1182
1212
|
devWarn(
|
|
1183
|
-
"
|
|
1213
|
+
"Select outside a Field needs aria-label or aria-labelledby; otherwise it is named only by its value."
|
|
1184
1214
|
);
|
|
1185
1215
|
}
|
|
1186
1216
|
const roving = useRovingFocus({ orientation: "vertical", loop: true, typeahead: true });
|
|
@@ -1192,7 +1222,7 @@ var SelectControl = forwardRef6(
|
|
|
1192
1222
|
sideOffset: 4,
|
|
1193
1223
|
matchAnchorWidth: true
|
|
1194
1224
|
});
|
|
1195
|
-
|
|
1225
|
+
useEffect6(() => {
|
|
1196
1226
|
refs.setReference(triggerRef.current);
|
|
1197
1227
|
}, [refs, open]);
|
|
1198
1228
|
useOverlayDismiss({
|
|
@@ -1209,7 +1239,7 @@ var SelectControl = forwardRef6(
|
|
|
1209
1239
|
autoFocus: false
|
|
1210
1240
|
});
|
|
1211
1241
|
const wasOpen = useRef6(false);
|
|
1212
|
-
|
|
1242
|
+
useEffect6(() => {
|
|
1213
1243
|
if (open && panelNode && !wasOpen.current) {
|
|
1214
1244
|
const index = selected ? flat.indexOf(selected) : -1;
|
|
1215
1245
|
if (index >= 0 && pendingEdge.current === "start") roving.focusIndex(index);
|
|
@@ -1287,6 +1317,8 @@ var SelectControl = forwardRef6(
|
|
|
1287
1317
|
"aria-labelledby": fieldContext ? `${fieldContext.labelId} ${valueId}` : void 0,
|
|
1288
1318
|
"data-size": size2,
|
|
1289
1319
|
...field,
|
|
1320
|
+
"aria-invalid": isInvalid || void 0,
|
|
1321
|
+
"aria-required": isRequired || void 0,
|
|
1290
1322
|
disabled: isDisabled,
|
|
1291
1323
|
onClick: () => setOpen(!open),
|
|
1292
1324
|
onKeyDown: triggerKeyDown,
|
|
@@ -1371,49 +1403,15 @@ var SelectControl = forwardRef6(
|
|
|
1371
1403
|
] });
|
|
1372
1404
|
}
|
|
1373
1405
|
);
|
|
1374
|
-
var
|
|
1375
|
-
label,
|
|
1376
|
-
description,
|
|
1377
|
-
error,
|
|
1378
|
-
hint,
|
|
1379
|
-
size: sizeProp,
|
|
1380
|
-
className,
|
|
1381
|
-
disabled,
|
|
1382
|
-
required,
|
|
1383
|
-
id,
|
|
1384
|
-
...props
|
|
1385
|
-
}, ref) {
|
|
1386
|
-
const size2 = useControlSize(sizeProp);
|
|
1387
|
-
const hasError = !!error;
|
|
1388
|
-
return /* @__PURE__ */ jsxs2(
|
|
1389
|
-
Field,
|
|
1390
|
-
{
|
|
1391
|
-
id,
|
|
1392
|
-
size: size2,
|
|
1393
|
-
disabled,
|
|
1394
|
-
required,
|
|
1395
|
-
hasDescription: !!description,
|
|
1396
|
-
hasError,
|
|
1397
|
-
hasHint: !!hint,
|
|
1398
|
-
className,
|
|
1399
|
-
children: [
|
|
1400
|
-
label && /* @__PURE__ */ jsx7(FieldLabel, { children: label }),
|
|
1401
|
-
description && /* @__PURE__ */ jsx7(FieldDescription, { children: description }),
|
|
1402
|
-
/* @__PURE__ */ jsx7(SelectControl, { ref, size: size2, invalid: hasError, disabled, ...props }),
|
|
1403
|
-
hasError && /* @__PURE__ */ jsx7(FieldError, { children: error }),
|
|
1404
|
-
!hasError && hint && /* @__PURE__ */ jsx7(FieldHint, { children: hint })
|
|
1405
|
-
]
|
|
1406
|
-
}
|
|
1407
|
-
);
|
|
1408
|
-
});
|
|
1406
|
+
var SelectControl = Select;
|
|
1409
1407
|
|
|
1410
1408
|
// src/lib/use-element-width.ts
|
|
1411
|
-
import { useEffect as
|
|
1412
|
-
var
|
|
1409
|
+
import { useEffect as useEffect7, useLayoutEffect as useLayoutEffect2, useState as useState7 } from "react";
|
|
1410
|
+
var useIsomorphicLayoutEffect2 = typeof window === "undefined" ? useEffect7 : useLayoutEffect2;
|
|
1413
1411
|
function useElementWidth() {
|
|
1414
|
-
const [node, setNode] =
|
|
1415
|
-
const [width, setWidth] =
|
|
1416
|
-
|
|
1412
|
+
const [node, setNode] = useState7(null);
|
|
1413
|
+
const [width, setWidth] = useState7(void 0);
|
|
1414
|
+
useIsomorphicLayoutEffect2(() => {
|
|
1417
1415
|
if (!node) return;
|
|
1418
1416
|
const apply = (next) => {
|
|
1419
1417
|
if (next <= 0) return;
|
|
@@ -1432,7 +1430,7 @@ function useElementWidth() {
|
|
|
1432
1430
|
}
|
|
1433
1431
|
|
|
1434
1432
|
// src/components/forms/checkbox.tsx
|
|
1435
|
-
import { forwardRef as forwardRef7, useEffect as
|
|
1433
|
+
import { forwardRef as forwardRef7, useEffect as useEffect8, useId as useId3, useRef as useRef7 } from "react";
|
|
1436
1434
|
import clsx10 from "clsx";
|
|
1437
1435
|
|
|
1438
1436
|
// src/components/forms/check-control.tsx
|
|
@@ -1500,7 +1498,7 @@ var Checkbox = forwardRef7(function Checkbox2({
|
|
|
1500
1498
|
const generatedId = useId3();
|
|
1501
1499
|
const controlId = id ?? generatedId;
|
|
1502
1500
|
const descriptionId = `${controlId}-description`;
|
|
1503
|
-
|
|
1501
|
+
useEffect8(() => {
|
|
1504
1502
|
if (inputRef.current) inputRef.current.indeterminate = indeterminate;
|
|
1505
1503
|
}, [indeterminate]);
|
|
1506
1504
|
return /* @__PURE__ */ jsxs3("div", { className: clsx10("flex flex-col", className), children: [
|
|
@@ -1689,7 +1687,7 @@ import {
|
|
|
1689
1687
|
createContext as createContext4,
|
|
1690
1688
|
forwardRef as forwardRef10,
|
|
1691
1689
|
useContext as useContext4,
|
|
1692
|
-
useMemo,
|
|
1690
|
+
useMemo as useMemo2,
|
|
1693
1691
|
useRef as useRef8
|
|
1694
1692
|
} from "react";
|
|
1695
1693
|
import { DropdownMenu as DropdownMenuPrimitive } from "radix-ui";
|
|
@@ -1972,7 +1970,7 @@ function DropdownMenu({
|
|
|
1972
1970
|
onChange: onOpenChange
|
|
1973
1971
|
});
|
|
1974
1972
|
const pendingEdge = useRef8("start");
|
|
1975
|
-
const state =
|
|
1973
|
+
const state = useMemo2(() => ({ setOpen, pendingEdge }), [setOpen]);
|
|
1976
1974
|
return /* @__PURE__ */ jsx12(DropdownMenuPrimitive.Root, { open, onOpenChange: setOpen, modal, children: /* @__PURE__ */ jsx12(DropdownMenuStateContext.Provider, { value: state, children: items ? /* @__PURE__ */ jsxs6(Fragment5, { children: [
|
|
1977
1975
|
/* @__PURE__ */ jsx12(DropdownMenuTrigger, { asChild: trigger != null, label, children: trigger }),
|
|
1978
1976
|
/* @__PURE__ */ jsx12(DropdownMenuContent, { side, align, children: /* @__PURE__ */ jsx12(DropdownMenuItems, { items }) })
|
|
@@ -2737,8 +2735,8 @@ export {
|
|
|
2737
2735
|
PortalContainerProvider,
|
|
2738
2736
|
usePortalContainer,
|
|
2739
2737
|
Portal,
|
|
2740
|
-
SelectControl,
|
|
2741
2738
|
Select,
|
|
2739
|
+
SelectControl,
|
|
2742
2740
|
useElementWidth,
|
|
2743
2741
|
composeEventHandlers,
|
|
2744
2742
|
CheckControl,
|
|
@@ -2786,4 +2784,4 @@ export {
|
|
|
2786
2784
|
EmptyState,
|
|
2787
2785
|
Skeleton
|
|
2788
2786
|
};
|
|
2789
|
-
//# sourceMappingURL=chunk-
|
|
2787
|
+
//# sourceMappingURL=chunk-OVIRTNT4.js.map
|