@yomologic/react-ui 0.5.2 → 0.5.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +62 -10
- package/dist/index.d.ts +62 -10
- package/dist/index.js +861 -522
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +859 -520
- package/dist/index.mjs.map +1 -1
- package/dist/styles.css +66 -15
- package/dist/styles.css.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -148,7 +148,10 @@ var Button = React.forwardRef(
|
|
|
148
148
|
Button.displayName = "Button";
|
|
149
149
|
|
|
150
150
|
// src/ui/input.tsx
|
|
151
|
-
import React2
|
|
151
|
+
import React2 from "react";
|
|
152
|
+
|
|
153
|
+
// src/ui/hooks/useFormField.ts
|
|
154
|
+
import { useEffect, useId as useId2, useRef as useRef2, useState as useState3 } from "react";
|
|
152
155
|
|
|
153
156
|
// src/ui/form.tsx
|
|
154
157
|
import {
|
|
@@ -686,6 +689,209 @@ function FormHelperText({
|
|
|
686
689
|
) });
|
|
687
690
|
}
|
|
688
691
|
|
|
692
|
+
// src/ui/hooks/useFormField.ts
|
|
693
|
+
function useFormField2(options) {
|
|
694
|
+
const {
|
|
695
|
+
name,
|
|
696
|
+
type = "text",
|
|
697
|
+
value: externalValue,
|
|
698
|
+
error: externalError,
|
|
699
|
+
id,
|
|
700
|
+
required = false,
|
|
701
|
+
disabled = false,
|
|
702
|
+
minLength,
|
|
703
|
+
maxLength,
|
|
704
|
+
min,
|
|
705
|
+
max,
|
|
706
|
+
pattern,
|
|
707
|
+
validate,
|
|
708
|
+
onValidationError,
|
|
709
|
+
errorMessages,
|
|
710
|
+
idPrefix = "field"
|
|
711
|
+
} = options;
|
|
712
|
+
const autoId = useId2();
|
|
713
|
+
const form = useForm();
|
|
714
|
+
const formControl = useFormControl();
|
|
715
|
+
const internalRef = useRef2(null);
|
|
716
|
+
const [validationError, setValidationError] = useState3();
|
|
717
|
+
const stableId = useRef2(void 0);
|
|
718
|
+
if (!stableId.current) {
|
|
719
|
+
stableId.current = id || formControl?.fieldId || `${idPrefix}-${autoId}`;
|
|
720
|
+
}
|
|
721
|
+
const fieldId = stableId.current;
|
|
722
|
+
const isDisabled = disabled || formControl?.isDisabled || false;
|
|
723
|
+
const isRequired = required || formControl?.isRequired || false;
|
|
724
|
+
let fieldValue;
|
|
725
|
+
let fieldError;
|
|
726
|
+
if (form && name) {
|
|
727
|
+
fieldError = form.shouldShowError(name) ? form.getFieldError(name) : void 0;
|
|
728
|
+
fieldValue = form.values[name] !== void 0 ? form.values[name] : externalValue ?? "";
|
|
729
|
+
} else if (formControl) {
|
|
730
|
+
fieldError = formControl.error || externalError || validationError;
|
|
731
|
+
fieldValue = formControl.value ?? externalValue;
|
|
732
|
+
} else {
|
|
733
|
+
fieldError = externalError || validationError;
|
|
734
|
+
fieldValue = externalValue;
|
|
735
|
+
}
|
|
736
|
+
const runBuiltInValidation = (value) => {
|
|
737
|
+
if (isRequired && !value) {
|
|
738
|
+
return errorMessages?.required || "This field is required";
|
|
739
|
+
}
|
|
740
|
+
if (value) {
|
|
741
|
+
if (type === "email" && !value.includes("@")) {
|
|
742
|
+
return errorMessages?.email || "Please enter a valid email address";
|
|
743
|
+
}
|
|
744
|
+
if (type === "url") {
|
|
745
|
+
try {
|
|
746
|
+
new URL(value);
|
|
747
|
+
} catch {
|
|
748
|
+
return errorMessages?.url || "Please enter a valid URL";
|
|
749
|
+
}
|
|
750
|
+
}
|
|
751
|
+
if (type === "number") {
|
|
752
|
+
const numValue = parseFloat(value);
|
|
753
|
+
if (min !== void 0 && numValue < Number(min)) {
|
|
754
|
+
return errorMessages?.min || `Minimum value is ${min}`;
|
|
755
|
+
}
|
|
756
|
+
if (max !== void 0 && numValue > Number(max)) {
|
|
757
|
+
return errorMessages?.max || `Maximum value is ${max}`;
|
|
758
|
+
}
|
|
759
|
+
}
|
|
760
|
+
if (minLength !== void 0 && value.length < minLength) {
|
|
761
|
+
return errorMessages?.minLength || `Minimum length is ${minLength} characters`;
|
|
762
|
+
}
|
|
763
|
+
if (maxLength !== void 0 && value.length > maxLength) {
|
|
764
|
+
return errorMessages?.maxLength || `Maximum length is ${maxLength} characters`;
|
|
765
|
+
}
|
|
766
|
+
if (pattern) {
|
|
767
|
+
const regex = typeof pattern === "string" ? new RegExp(pattern) : pattern;
|
|
768
|
+
if (!regex.test(value)) {
|
|
769
|
+
return errorMessages?.pattern || "Invalid format";
|
|
770
|
+
}
|
|
771
|
+
}
|
|
772
|
+
}
|
|
773
|
+
return void 0;
|
|
774
|
+
};
|
|
775
|
+
const runValidation = async (value) => {
|
|
776
|
+
const builtInError = runBuiltInValidation(value);
|
|
777
|
+
if (builtInError) {
|
|
778
|
+
setValidationError(builtInError);
|
|
779
|
+
onValidationError?.(builtInError);
|
|
780
|
+
return;
|
|
781
|
+
}
|
|
782
|
+
if (validate) {
|
|
783
|
+
const customError = await validate(value);
|
|
784
|
+
setValidationError(customError);
|
|
785
|
+
onValidationError?.(customError);
|
|
786
|
+
return;
|
|
787
|
+
}
|
|
788
|
+
setValidationError(void 0);
|
|
789
|
+
onValidationError?.(void 0);
|
|
790
|
+
};
|
|
791
|
+
useEffect(() => {
|
|
792
|
+
if (form && name) {
|
|
793
|
+
const validator = async (value) => {
|
|
794
|
+
if (isRequired && !value) {
|
|
795
|
+
return errorMessages?.required || "This field is required";
|
|
796
|
+
}
|
|
797
|
+
if (value) {
|
|
798
|
+
if (type === "email" && !value.includes("@")) {
|
|
799
|
+
return errorMessages?.email || "Please enter a valid email address";
|
|
800
|
+
}
|
|
801
|
+
if (type === "url") {
|
|
802
|
+
try {
|
|
803
|
+
new URL(value);
|
|
804
|
+
} catch {
|
|
805
|
+
return errorMessages?.url || "Please enter a valid URL";
|
|
806
|
+
}
|
|
807
|
+
}
|
|
808
|
+
if (type === "number") {
|
|
809
|
+
const numValue = parseFloat(value);
|
|
810
|
+
if (min !== void 0 && numValue < Number(min)) {
|
|
811
|
+
return errorMessages?.min || `Minimum value is ${min}`;
|
|
812
|
+
}
|
|
813
|
+
if (max !== void 0 && numValue > Number(max)) {
|
|
814
|
+
return errorMessages?.max || `Maximum value is ${max}`;
|
|
815
|
+
}
|
|
816
|
+
}
|
|
817
|
+
if (minLength !== void 0 && value.length < minLength) {
|
|
818
|
+
return errorMessages?.minLength || `Minimum length is ${minLength} characters`;
|
|
819
|
+
}
|
|
820
|
+
if (maxLength !== void 0 && value.length > maxLength) {
|
|
821
|
+
return errorMessages?.maxLength || `Maximum length is ${maxLength} characters`;
|
|
822
|
+
}
|
|
823
|
+
if (pattern) {
|
|
824
|
+
const regex = typeof pattern === "string" ? new RegExp(pattern) : pattern;
|
|
825
|
+
if (!regex.test(value)) {
|
|
826
|
+
return errorMessages?.pattern || "Invalid format";
|
|
827
|
+
}
|
|
828
|
+
}
|
|
829
|
+
}
|
|
830
|
+
if (validate) {
|
|
831
|
+
return await validate(value);
|
|
832
|
+
}
|
|
833
|
+
return void 0;
|
|
834
|
+
};
|
|
835
|
+
form.registerField(name, validator);
|
|
836
|
+
return () => form.unregisterField(name);
|
|
837
|
+
} else if (formControl) {
|
|
838
|
+
const element = internalRef.current;
|
|
839
|
+
if (element) {
|
|
840
|
+
formControl.registerControl(element);
|
|
841
|
+
return () => formControl.unregisterControl(element);
|
|
842
|
+
}
|
|
843
|
+
}
|
|
844
|
+
}, [
|
|
845
|
+
form,
|
|
846
|
+
formControl,
|
|
847
|
+
name,
|
|
848
|
+
isRequired,
|
|
849
|
+
type,
|
|
850
|
+
min,
|
|
851
|
+
max,
|
|
852
|
+
minLength,
|
|
853
|
+
maxLength,
|
|
854
|
+
pattern,
|
|
855
|
+
validate,
|
|
856
|
+
errorMessages
|
|
857
|
+
]);
|
|
858
|
+
const handleChange = (value) => {
|
|
859
|
+
if (form && name) {
|
|
860
|
+
form.setFieldValue(name, value);
|
|
861
|
+
} else if (formControl) {
|
|
862
|
+
formControl.setValue(value);
|
|
863
|
+
} else {
|
|
864
|
+
runValidation(value);
|
|
865
|
+
}
|
|
866
|
+
};
|
|
867
|
+
const handleBlur = (value) => {
|
|
868
|
+
if (form && name) {
|
|
869
|
+
form.setFieldTouched(name, true);
|
|
870
|
+
form.validateField(name, value);
|
|
871
|
+
} else if (formControl) {
|
|
872
|
+
formControl.setTouched(true);
|
|
873
|
+
} else {
|
|
874
|
+
if (value) {
|
|
875
|
+
runValidation(value);
|
|
876
|
+
}
|
|
877
|
+
}
|
|
878
|
+
};
|
|
879
|
+
const shouldRenderLabel = !formControl;
|
|
880
|
+
const shouldRenderError = !!fieldError && !formControl;
|
|
881
|
+
return {
|
|
882
|
+
fieldId,
|
|
883
|
+
value: fieldValue,
|
|
884
|
+
error: fieldError,
|
|
885
|
+
isDisabled,
|
|
886
|
+
isRequired,
|
|
887
|
+
shouldRenderLabel,
|
|
888
|
+
shouldRenderError,
|
|
889
|
+
handleChange,
|
|
890
|
+
handleBlur,
|
|
891
|
+
internalRef
|
|
892
|
+
};
|
|
893
|
+
}
|
|
894
|
+
|
|
689
895
|
// src/ui/input.tsx
|
|
690
896
|
import { jsx as jsx4, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
691
897
|
var Input = React2.forwardRef(
|
|
@@ -709,66 +915,186 @@ var Input = React2.forwardRef(
|
|
|
709
915
|
errorMessages,
|
|
710
916
|
...props
|
|
711
917
|
}, ref) => {
|
|
712
|
-
const
|
|
918
|
+
const {
|
|
919
|
+
fieldId,
|
|
920
|
+
value: inputValue,
|
|
921
|
+
error: inputError,
|
|
922
|
+
isDisabled,
|
|
923
|
+
isRequired,
|
|
924
|
+
shouldRenderLabel,
|
|
925
|
+
shouldRenderError,
|
|
926
|
+
handleChange: hookHandleChange,
|
|
927
|
+
handleBlur: hookHandleBlur,
|
|
928
|
+
internalRef
|
|
929
|
+
} = useFormField2({
|
|
930
|
+
name,
|
|
931
|
+
type,
|
|
932
|
+
value: externalValue,
|
|
933
|
+
error,
|
|
934
|
+
id,
|
|
935
|
+
required: props.required,
|
|
936
|
+
disabled: props.disabled,
|
|
937
|
+
minLength: props.minLength,
|
|
938
|
+
maxLength: props.maxLength,
|
|
939
|
+
min: props.min,
|
|
940
|
+
max: props.max,
|
|
941
|
+
pattern,
|
|
942
|
+
validate,
|
|
943
|
+
onValidationError,
|
|
944
|
+
errorMessages,
|
|
945
|
+
idPrefix: "input"
|
|
946
|
+
});
|
|
947
|
+
const handleChange = (e) => {
|
|
948
|
+
hookHandleChange(e.target.value);
|
|
949
|
+
onChange?.(e);
|
|
950
|
+
};
|
|
951
|
+
const handleBlur = (e) => {
|
|
952
|
+
hookHandleBlur(e.target.value);
|
|
953
|
+
onBlur?.(e);
|
|
954
|
+
};
|
|
955
|
+
return /* @__PURE__ */ jsxs3(
|
|
956
|
+
"div",
|
|
957
|
+
{
|
|
958
|
+
className: cn("flex flex-col", fullWidth && "w-full"),
|
|
959
|
+
style: { marginBottom: "var(--form-control-spacing)" },
|
|
960
|
+
children: [
|
|
961
|
+
shouldRenderLabel && label && /* @__PURE__ */ jsxs3(
|
|
962
|
+
"label",
|
|
963
|
+
{
|
|
964
|
+
htmlFor: fieldId,
|
|
965
|
+
className: "block text-small font-semibold text-(--color-muted-foreground) mb-1",
|
|
966
|
+
children: [
|
|
967
|
+
label,
|
|
968
|
+
isRequired && /* @__PURE__ */ jsx4("span", { className: "ml-1", children: "*" })
|
|
969
|
+
]
|
|
970
|
+
}
|
|
971
|
+
),
|
|
972
|
+
/* @__PURE__ */ jsxs3("div", { className: "relative", children: [
|
|
973
|
+
leftIcon && /* @__PURE__ */ jsx4("div", { className: "absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none text-(--color-placeholder)", children: leftIcon }),
|
|
974
|
+
/* @__PURE__ */ jsx4(
|
|
975
|
+
"input",
|
|
976
|
+
{
|
|
977
|
+
ref: (node) => {
|
|
978
|
+
if (typeof ref === "function") {
|
|
979
|
+
ref(node);
|
|
980
|
+
} else if (ref) {
|
|
981
|
+
ref.current = node;
|
|
982
|
+
}
|
|
983
|
+
internalRef.current = node;
|
|
984
|
+
},
|
|
985
|
+
type,
|
|
986
|
+
id: fieldId,
|
|
987
|
+
value: inputValue,
|
|
988
|
+
onChange: handleChange,
|
|
989
|
+
onBlur: handleBlur,
|
|
990
|
+
disabled: isDisabled,
|
|
991
|
+
required: isRequired,
|
|
992
|
+
pattern: pattern instanceof RegExp ? pattern.source : pattern,
|
|
993
|
+
"aria-invalid": !!inputError,
|
|
994
|
+
"aria-describedby": inputError ? `${fieldId}-error` : helperText ? `${fieldId}-helper` : void 0,
|
|
995
|
+
className: cn(
|
|
996
|
+
"w-full px-3 py-2 border rounded-md transition-colors",
|
|
997
|
+
"text-(--color-muted-foreground) placeholder-gray-400",
|
|
998
|
+
"focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent",
|
|
999
|
+
"disabled:bg-(--color-muted) disabled:cursor-not-allowed disabled:text-(--color-muted-foreground)",
|
|
1000
|
+
inputError ? "border-error focus:ring-error" : "border-(--color-border)",
|
|
1001
|
+
leftIcon && "pl-10",
|
|
1002
|
+
rightIcon && "pr-10",
|
|
1003
|
+
className
|
|
1004
|
+
),
|
|
1005
|
+
...props
|
|
1006
|
+
}
|
|
1007
|
+
),
|
|
1008
|
+
rightIcon && /* @__PURE__ */ jsx4("div", { className: "absolute inset-y-0 right-0 pr-3 flex items-center pointer-events-none text-(--color-placeholder)", children: rightIcon })
|
|
1009
|
+
] }),
|
|
1010
|
+
/* @__PURE__ */ jsxs3("div", { className: "h-5 mt-1.5", children: [
|
|
1011
|
+
shouldRenderError && inputError && /* @__PURE__ */ jsx4(
|
|
1012
|
+
"p",
|
|
1013
|
+
{
|
|
1014
|
+
className: "text-small text-error",
|
|
1015
|
+
id: `${fieldId}-error`,
|
|
1016
|
+
role: "alert",
|
|
1017
|
+
children: inputError
|
|
1018
|
+
}
|
|
1019
|
+
),
|
|
1020
|
+
helperText && !inputError && shouldRenderLabel && /* @__PURE__ */ jsx4(
|
|
1021
|
+
"p",
|
|
1022
|
+
{
|
|
1023
|
+
className: "text-small text-(--color-muted-foreground)",
|
|
1024
|
+
id: `${fieldId}-helper`,
|
|
1025
|
+
children: helperText
|
|
1026
|
+
}
|
|
1027
|
+
)
|
|
1028
|
+
] })
|
|
1029
|
+
]
|
|
1030
|
+
}
|
|
1031
|
+
);
|
|
1032
|
+
}
|
|
1033
|
+
);
|
|
1034
|
+
Input.displayName = "Input";
|
|
1035
|
+
|
|
1036
|
+
// src/ui/textarea.tsx
|
|
1037
|
+
import React3, { useId as useId3, useEffect as useEffect2, useRef as useRef3, useState as useState4 } from "react";
|
|
1038
|
+
import { jsx as jsx5, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
1039
|
+
var Textarea = React3.forwardRef(
|
|
1040
|
+
({
|
|
1041
|
+
className,
|
|
1042
|
+
name,
|
|
1043
|
+
label,
|
|
1044
|
+
error,
|
|
1045
|
+
helperText,
|
|
1046
|
+
fullWidth = false,
|
|
1047
|
+
id,
|
|
1048
|
+
onChange,
|
|
1049
|
+
onBlur,
|
|
1050
|
+
value: externalValue,
|
|
1051
|
+
validate,
|
|
1052
|
+
onValidationError,
|
|
1053
|
+
errorMessages,
|
|
1054
|
+
rows = 3,
|
|
1055
|
+
resize = "vertical",
|
|
1056
|
+
autoResize = false,
|
|
1057
|
+
showCharacterCount = false,
|
|
1058
|
+
maxHeight = 500,
|
|
1059
|
+
...props
|
|
1060
|
+
}, ref) => {
|
|
1061
|
+
const autoId = useId3();
|
|
713
1062
|
const form = useForm();
|
|
714
1063
|
const formControl = useFormControl();
|
|
715
|
-
const internalRef =
|
|
716
|
-
const [validationError, setValidationError] =
|
|
717
|
-
const stableId =
|
|
1064
|
+
const internalRef = useRef3(null);
|
|
1065
|
+
const [validationError, setValidationError] = useState4();
|
|
1066
|
+
const stableId = useRef3(void 0);
|
|
718
1067
|
if (!stableId.current) {
|
|
719
|
-
stableId.current = id || formControl?.fieldId || `
|
|
1068
|
+
stableId.current = id || formControl?.fieldId || `textarea-${autoId}`;
|
|
720
1069
|
}
|
|
721
|
-
const
|
|
1070
|
+
const textareaId = stableId.current;
|
|
722
1071
|
const isDisabled = props.disabled || formControl?.isDisabled;
|
|
723
1072
|
const isRequired = props.required || formControl?.isRequired;
|
|
724
|
-
let
|
|
725
|
-
let
|
|
1073
|
+
let textareaError;
|
|
1074
|
+
let textareaValue;
|
|
726
1075
|
if (form && name) {
|
|
727
|
-
|
|
728
|
-
|
|
1076
|
+
textareaError = form.shouldShowError(name) ? form.getFieldError(name) : void 0;
|
|
1077
|
+
textareaValue = form.values[name] !== void 0 ? form.values[name] : externalValue ?? "";
|
|
729
1078
|
} else if (formControl) {
|
|
730
|
-
|
|
731
|
-
|
|
1079
|
+
textareaError = formControl.error || error || validationError;
|
|
1080
|
+
textareaValue = formControl.value ?? externalValue;
|
|
732
1081
|
} else {
|
|
733
|
-
|
|
734
|
-
|
|
1082
|
+
textareaError = error || validationError;
|
|
1083
|
+
textareaValue = externalValue;
|
|
735
1084
|
}
|
|
1085
|
+
const currentLength = typeof textareaValue === "string" ? textareaValue.length : 0;
|
|
1086
|
+
const maxLengthValue = props.maxLength;
|
|
736
1087
|
const runBuiltInValidation = (value) => {
|
|
737
1088
|
if (isRequired && !value) {
|
|
738
1089
|
return errorMessages?.required || "This field is required";
|
|
739
1090
|
}
|
|
740
1091
|
if (value) {
|
|
741
|
-
if (type === "email" && !value.includes("@")) {
|
|
742
|
-
return errorMessages?.email || "Please enter a valid email address";
|
|
743
|
-
}
|
|
744
|
-
if (type === "url") {
|
|
745
|
-
try {
|
|
746
|
-
new URL(value);
|
|
747
|
-
} catch {
|
|
748
|
-
return errorMessages?.url || "Please enter a valid URL";
|
|
749
|
-
}
|
|
750
|
-
}
|
|
751
|
-
if (type === "number") {
|
|
752
|
-
const numValue = parseFloat(value);
|
|
753
|
-
if (props.min !== void 0 && numValue < Number(props.min)) {
|
|
754
|
-
return errorMessages?.min || `Minimum value is ${props.min}`;
|
|
755
|
-
}
|
|
756
|
-
if (props.max !== void 0 && numValue > Number(props.max)) {
|
|
757
|
-
return errorMessages?.max || `Maximum value is ${props.max}`;
|
|
758
|
-
}
|
|
759
|
-
}
|
|
760
1092
|
if (props.minLength !== void 0 && value.length < props.minLength) {
|
|
761
1093
|
return errorMessages?.minLength || `Minimum length is ${props.minLength} characters`;
|
|
762
1094
|
}
|
|
763
1095
|
if (props.maxLength !== void 0 && value.length > props.maxLength) {
|
|
764
1096
|
return errorMessages?.maxLength || `Maximum length is ${props.maxLength} characters`;
|
|
765
1097
|
}
|
|
766
|
-
if (pattern) {
|
|
767
|
-
const regex = typeof pattern === "string" ? new RegExp(pattern) : pattern;
|
|
768
|
-
if (!regex.test(value)) {
|
|
769
|
-
return errorMessages?.pattern || "Invalid format";
|
|
770
|
-
}
|
|
771
|
-
}
|
|
772
1098
|
}
|
|
773
1099
|
return void 0;
|
|
774
1100
|
};
|
|
@@ -788,44 +1114,27 @@ var Input = React2.forwardRef(
|
|
|
788
1114
|
setValidationError(void 0);
|
|
789
1115
|
onValidationError?.(void 0);
|
|
790
1116
|
};
|
|
791
|
-
|
|
1117
|
+
const adjustHeight = () => {
|
|
1118
|
+
const textarea = internalRef.current;
|
|
1119
|
+
if (textarea && autoResize) {
|
|
1120
|
+
textarea.style.height = "auto";
|
|
1121
|
+
const newHeight = Math.min(textarea.scrollHeight, maxHeight);
|
|
1122
|
+
textarea.style.height = `${newHeight}px`;
|
|
1123
|
+
}
|
|
1124
|
+
};
|
|
1125
|
+
useEffect2(() => {
|
|
792
1126
|
if (form && name) {
|
|
793
1127
|
const validator = async (value) => {
|
|
794
1128
|
if (isRequired && !value) {
|
|
795
1129
|
return errorMessages?.required || "This field is required";
|
|
796
1130
|
}
|
|
797
1131
|
if (value) {
|
|
798
|
-
if (type === "email" && !value.includes("@")) {
|
|
799
|
-
return errorMessages?.email || "Please enter a valid email address";
|
|
800
|
-
}
|
|
801
|
-
if (type === "url") {
|
|
802
|
-
try {
|
|
803
|
-
new URL(value);
|
|
804
|
-
} catch {
|
|
805
|
-
return errorMessages?.url || "Please enter a valid URL";
|
|
806
|
-
}
|
|
807
|
-
}
|
|
808
|
-
if (type === "number") {
|
|
809
|
-
const numValue = parseFloat(value);
|
|
810
|
-
if (props.min !== void 0 && numValue < Number(props.min)) {
|
|
811
|
-
return errorMessages?.min || `Minimum value is ${props.min}`;
|
|
812
|
-
}
|
|
813
|
-
if (props.max !== void 0 && numValue > Number(props.max)) {
|
|
814
|
-
return errorMessages?.max || `Maximum value is ${props.max}`;
|
|
815
|
-
}
|
|
816
|
-
}
|
|
817
1132
|
if (props.minLength !== void 0 && value.length < props.minLength) {
|
|
818
1133
|
return errorMessages?.minLength || `Minimum length is ${props.minLength} characters`;
|
|
819
1134
|
}
|
|
820
1135
|
if (props.maxLength !== void 0 && value.length > props.maxLength) {
|
|
821
1136
|
return errorMessages?.maxLength || `Maximum length is ${props.maxLength} characters`;
|
|
822
1137
|
}
|
|
823
|
-
if (pattern) {
|
|
824
|
-
const regex = typeof pattern === "string" ? new RegExp(pattern) : pattern;
|
|
825
|
-
if (!regex.test(value)) {
|
|
826
|
-
return errorMessages?.pattern || "Invalid format";
|
|
827
|
-
}
|
|
828
|
-
}
|
|
829
1138
|
}
|
|
830
1139
|
if (validate) {
|
|
831
1140
|
return await validate(value);
|
|
@@ -835,13 +1144,18 @@ var Input = React2.forwardRef(
|
|
|
835
1144
|
form.registerField(name, validator);
|
|
836
1145
|
return () => form.unregisterField(name);
|
|
837
1146
|
} else if (formControl) {
|
|
838
|
-
const
|
|
839
|
-
if (
|
|
840
|
-
formControl.registerControl(
|
|
841
|
-
return () => formControl.unregisterControl(
|
|
1147
|
+
const textareaElement = internalRef.current;
|
|
1148
|
+
if (textareaElement) {
|
|
1149
|
+
formControl.registerControl(textareaElement);
|
|
1150
|
+
return () => formControl.unregisterControl(textareaElement);
|
|
842
1151
|
}
|
|
843
1152
|
}
|
|
844
1153
|
}, [form, formControl, name]);
|
|
1154
|
+
useEffect2(() => {
|
|
1155
|
+
if (autoResize) {
|
|
1156
|
+
adjustHeight();
|
|
1157
|
+
}
|
|
1158
|
+
}, [textareaValue, autoResize]);
|
|
845
1159
|
const handleChange = (e) => {
|
|
846
1160
|
const newValue = e.target.value;
|
|
847
1161
|
if (form && name) {
|
|
@@ -851,6 +1165,9 @@ var Input = React2.forwardRef(
|
|
|
851
1165
|
} else {
|
|
852
1166
|
runValidation(newValue);
|
|
853
1167
|
}
|
|
1168
|
+
if (autoResize) {
|
|
1169
|
+
adjustHeight();
|
|
1170
|
+
}
|
|
854
1171
|
onChange?.(e);
|
|
855
1172
|
};
|
|
856
1173
|
const handleBlur = (e) => {
|
|
@@ -867,103 +1184,90 @@ var Input = React2.forwardRef(
|
|
|
867
1184
|
onBlur?.(e);
|
|
868
1185
|
};
|
|
869
1186
|
const shouldRenderLabel = label && !formControl;
|
|
870
|
-
const shouldRenderError =
|
|
871
|
-
|
|
1187
|
+
const shouldRenderError = textareaError && !formControl;
|
|
1188
|
+
const resizeClasses = {
|
|
1189
|
+
none: "resize-none",
|
|
1190
|
+
vertical: "resize-y",
|
|
1191
|
+
horizontal: "resize-x",
|
|
1192
|
+
both: "resize"
|
|
1193
|
+
};
|
|
1194
|
+
return /* @__PURE__ */ jsxs4(
|
|
872
1195
|
"div",
|
|
873
1196
|
{
|
|
874
1197
|
className: cn("flex flex-col", fullWidth && "w-full"),
|
|
875
1198
|
style: { marginBottom: "var(--form-control-spacing)" },
|
|
876
|
-
suppressHydrationWarning: true,
|
|
877
1199
|
children: [
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
1200
|
+
/* @__PURE__ */ jsxs4("div", { className: "flex items-center justify-between mb-1", children: [
|
|
1201
|
+
shouldRenderLabel && /* @__PURE__ */ jsxs4(
|
|
1202
|
+
"label",
|
|
1203
|
+
{
|
|
1204
|
+
htmlFor: textareaId,
|
|
1205
|
+
className: "block text-small font-semibold text-(--color-muted-foreground)",
|
|
1206
|
+
children: [
|
|
1207
|
+
label,
|
|
1208
|
+
isRequired && /* @__PURE__ */ jsx5("span", { className: "ml-1", children: "*" })
|
|
1209
|
+
]
|
|
1210
|
+
}
|
|
1211
|
+
),
|
|
1212
|
+
showCharacterCount && maxLengthValue && /* @__PURE__ */ jsxs4("span", { className: "text-small text-(--color-muted-foreground)", children: [
|
|
1213
|
+
currentLength,
|
|
1214
|
+
"/",
|
|
1215
|
+
maxLengthValue
|
|
1216
|
+
] })
|
|
1217
|
+
] }),
|
|
1218
|
+
/* @__PURE__ */ jsx5("div", { className: "relative", children: /* @__PURE__ */ jsx5(
|
|
1219
|
+
"textarea",
|
|
892
1220
|
{
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
className: cn(
|
|
927
|
-
"w-full px-3 py-2 border rounded-md transition-colors",
|
|
928
|
-
"text-(--color-muted-foreground) placeholder-gray-400",
|
|
929
|
-
"focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent",
|
|
930
|
-
"disabled:bg-(--color-muted) disabled:cursor-not-allowed disabled:text-(--color-muted-foreground)",
|
|
931
|
-
inputError ? "border-error focus:ring-error" : "border-(--color-border)",
|
|
932
|
-
leftIcon && "pl-10",
|
|
933
|
-
rightIcon && "pr-10",
|
|
934
|
-
className
|
|
935
|
-
),
|
|
936
|
-
...props
|
|
937
|
-
}
|
|
938
|
-
),
|
|
939
|
-
rightIcon && /* @__PURE__ */ jsx4(
|
|
940
|
-
"div",
|
|
941
|
-
{
|
|
942
|
-
className: "absolute inset-y-0 right-0 pr-3 flex items-center pointer-events-none text-(--color-placeholder)",
|
|
943
|
-
suppressHydrationWarning: true,
|
|
944
|
-
children: rightIcon
|
|
945
|
-
}
|
|
946
|
-
)
|
|
947
|
-
]
|
|
1221
|
+
ref: (node) => {
|
|
1222
|
+
if (typeof ref === "function") {
|
|
1223
|
+
ref(node);
|
|
1224
|
+
} else if (ref) {
|
|
1225
|
+
ref.current = node;
|
|
1226
|
+
}
|
|
1227
|
+
internalRef.current = node;
|
|
1228
|
+
},
|
|
1229
|
+
id: textareaId,
|
|
1230
|
+
value: textareaValue,
|
|
1231
|
+
onChange: handleChange,
|
|
1232
|
+
onBlur: handleBlur,
|
|
1233
|
+
disabled: isDisabled,
|
|
1234
|
+
required: isRequired,
|
|
1235
|
+
rows: autoResize ? void 0 : rows,
|
|
1236
|
+
"aria-invalid": !!textareaError,
|
|
1237
|
+
"aria-describedby": textareaError ? `${textareaId}-error` : helperText ? `${textareaId}-helper` : void 0,
|
|
1238
|
+
className: cn(
|
|
1239
|
+
"w-full px-3 py-2 border rounded-md transition-colors",
|
|
1240
|
+
"text-(--color-muted-foreground) placeholder-gray-400",
|
|
1241
|
+
"focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent",
|
|
1242
|
+
"disabled:bg-(--color-muted) disabled:cursor-not-allowed disabled:text-(--color-muted-foreground)",
|
|
1243
|
+
textareaError ? "border-error focus:ring-error" : "border-(--color-border)",
|
|
1244
|
+
resizeClasses[resize],
|
|
1245
|
+
autoResize && "overflow-hidden",
|
|
1246
|
+
!autoResize && "overflow-auto",
|
|
1247
|
+
className
|
|
1248
|
+
),
|
|
1249
|
+
style: autoResize ? {
|
|
1250
|
+
minHeight: `${rows * 1.5}em`,
|
|
1251
|
+
maxHeight: `${maxHeight}px`
|
|
1252
|
+
} : void 0,
|
|
1253
|
+
...props
|
|
948
1254
|
}
|
|
949
|
-
),
|
|
950
|
-
/* @__PURE__ */
|
|
951
|
-
shouldRenderError &&
|
|
1255
|
+
) }),
|
|
1256
|
+
/* @__PURE__ */ jsxs4("div", { className: "h-5 mt-1.5", children: [
|
|
1257
|
+
shouldRenderError && textareaError && /* @__PURE__ */ jsx5(
|
|
952
1258
|
"p",
|
|
953
1259
|
{
|
|
954
1260
|
className: "text-small text-error",
|
|
955
|
-
id: `${
|
|
1261
|
+
id: `${textareaId}-error`,
|
|
956
1262
|
role: "alert",
|
|
957
|
-
|
|
958
|
-
children: inputError
|
|
1263
|
+
children: textareaError
|
|
959
1264
|
}
|
|
960
1265
|
),
|
|
961
|
-
helperText && !
|
|
1266
|
+
helperText && !textareaError && !formControl && /* @__PURE__ */ jsx5(
|
|
962
1267
|
"p",
|
|
963
1268
|
{
|
|
964
1269
|
className: "text-small text-(--color-muted-foreground)",
|
|
965
|
-
id: `${
|
|
966
|
-
suppressHydrationWarning: true,
|
|
1270
|
+
id: `${textareaId}-helper`,
|
|
967
1271
|
children: helperText
|
|
968
1272
|
}
|
|
969
1273
|
)
|
|
@@ -973,12 +1277,12 @@ var Input = React2.forwardRef(
|
|
|
973
1277
|
);
|
|
974
1278
|
}
|
|
975
1279
|
);
|
|
976
|
-
|
|
1280
|
+
Textarea.displayName = "Textarea";
|
|
977
1281
|
|
|
978
1282
|
// src/ui/card.tsx
|
|
979
|
-
import
|
|
980
|
-
import { jsx as
|
|
981
|
-
var Card =
|
|
1283
|
+
import React4 from "react";
|
|
1284
|
+
import { jsx as jsx6, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
1285
|
+
var Card = React4.forwardRef(
|
|
982
1286
|
({
|
|
983
1287
|
className,
|
|
984
1288
|
variant = "default",
|
|
@@ -1002,7 +1306,7 @@ var Card = React3.forwardRef(
|
|
|
1002
1306
|
lg: "p-6"
|
|
1003
1307
|
};
|
|
1004
1308
|
const hoverStyles = hoverable ? "hover:shadow-lg transition-shadow cursor-pointer" : "";
|
|
1005
|
-
return /* @__PURE__ */
|
|
1309
|
+
return /* @__PURE__ */ jsxs5(
|
|
1006
1310
|
"div",
|
|
1007
1311
|
{
|
|
1008
1312
|
ref,
|
|
@@ -1018,7 +1322,7 @@ var Card = React3.forwardRef(
|
|
|
1018
1322
|
} : void 0,
|
|
1019
1323
|
...props,
|
|
1020
1324
|
children: [
|
|
1021
|
-
variant === "accent" && /* @__PURE__ */
|
|
1325
|
+
variant === "accent" && /* @__PURE__ */ jsx6(
|
|
1022
1326
|
"div",
|
|
1023
1327
|
{
|
|
1024
1328
|
className: "absolute top-0 left-0 w-full h-1 bg-linear-to-r from-transparent via-current to-transparent opacity-0 group-hover:opacity-100 group-active:opacity-100 transition-opacity",
|
|
@@ -1032,7 +1336,7 @@ var Card = React3.forwardRef(
|
|
|
1032
1336
|
}
|
|
1033
1337
|
);
|
|
1034
1338
|
Card.displayName = "Card";
|
|
1035
|
-
var CardHeader =
|
|
1339
|
+
var CardHeader = React4.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx6(
|
|
1036
1340
|
"div",
|
|
1037
1341
|
{
|
|
1038
1342
|
ref,
|
|
@@ -1041,7 +1345,7 @@ var CardHeader = React3.forwardRef(({ className, ...props }, ref) => /* @__PURE_
|
|
|
1041
1345
|
}
|
|
1042
1346
|
));
|
|
1043
1347
|
CardHeader.displayName = "CardHeader";
|
|
1044
|
-
var CardTitle =
|
|
1348
|
+
var CardTitle = React4.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx6(
|
|
1045
1349
|
"h3",
|
|
1046
1350
|
{
|
|
1047
1351
|
ref,
|
|
@@ -1053,7 +1357,7 @@ var CardTitle = React3.forwardRef(({ className, ...props }, ref) => /* @__PURE__
|
|
|
1053
1357
|
}
|
|
1054
1358
|
));
|
|
1055
1359
|
CardTitle.displayName = "CardTitle";
|
|
1056
|
-
var CardDescription =
|
|
1360
|
+
var CardDescription = React4.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx6(
|
|
1057
1361
|
"p",
|
|
1058
1362
|
{
|
|
1059
1363
|
ref,
|
|
@@ -1062,9 +1366,9 @@ var CardDescription = React3.forwardRef(({ className, ...props }, ref) => /* @__
|
|
|
1062
1366
|
}
|
|
1063
1367
|
));
|
|
1064
1368
|
CardDescription.displayName = "CardDescription";
|
|
1065
|
-
var CardContent =
|
|
1369
|
+
var CardContent = React4.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx6("div", { ref, className: cn("pt-0", className), ...props }));
|
|
1066
1370
|
CardContent.displayName = "CardContent";
|
|
1067
|
-
var CardFooter =
|
|
1371
|
+
var CardFooter = React4.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx6(
|
|
1068
1372
|
"div",
|
|
1069
1373
|
{
|
|
1070
1374
|
ref,
|
|
@@ -1073,7 +1377,7 @@ var CardFooter = React3.forwardRef(({ className, ...props }, ref) => /* @__PURE_
|
|
|
1073
1377
|
}
|
|
1074
1378
|
));
|
|
1075
1379
|
CardFooter.displayName = "CardFooter";
|
|
1076
|
-
var CardMedia =
|
|
1380
|
+
var CardMedia = React4.forwardRef(
|
|
1077
1381
|
({
|
|
1078
1382
|
className,
|
|
1079
1383
|
image,
|
|
@@ -1091,7 +1395,7 @@ var CardMedia = React3.forwardRef(
|
|
|
1091
1395
|
};
|
|
1092
1396
|
const objectFitClass = objectFit === "cover" ? "object-cover" : objectFit === "contain" ? "object-contain" : objectFit === "fill" ? "object-fill" : objectFit === "none" ? "object-none" : "object-scale-down";
|
|
1093
1397
|
if (component === "img" && image) {
|
|
1094
|
-
return /* @__PURE__ */
|
|
1398
|
+
return /* @__PURE__ */ jsx6(
|
|
1095
1399
|
"img",
|
|
1096
1400
|
{
|
|
1097
1401
|
ref,
|
|
@@ -1104,7 +1408,7 @@ var CardMedia = React3.forwardRef(
|
|
|
1104
1408
|
);
|
|
1105
1409
|
}
|
|
1106
1410
|
if (component === "video" && video) {
|
|
1107
|
-
return /* @__PURE__ */
|
|
1411
|
+
return /* @__PURE__ */ jsx6(
|
|
1108
1412
|
"video",
|
|
1109
1413
|
{
|
|
1110
1414
|
ref,
|
|
@@ -1115,7 +1419,7 @@ var CardMedia = React3.forwardRef(
|
|
|
1115
1419
|
}
|
|
1116
1420
|
);
|
|
1117
1421
|
}
|
|
1118
|
-
return /* @__PURE__ */
|
|
1422
|
+
return /* @__PURE__ */ jsx6(
|
|
1119
1423
|
"div",
|
|
1120
1424
|
{
|
|
1121
1425
|
ref,
|
|
@@ -1132,7 +1436,7 @@ var CardMedia = React3.forwardRef(
|
|
|
1132
1436
|
}
|
|
1133
1437
|
);
|
|
1134
1438
|
CardMedia.displayName = "CardMedia";
|
|
1135
|
-
var CardActions =
|
|
1439
|
+
var CardActions = React4.forwardRef(
|
|
1136
1440
|
({ className, disableSpacing = false, position = "left", ...props }, ref) => {
|
|
1137
1441
|
const justifyContent = {
|
|
1138
1442
|
left: "justify-start",
|
|
@@ -1144,7 +1448,7 @@ var CardActions = React3.forwardRef(
|
|
|
1144
1448
|
center: "px-4 py-4",
|
|
1145
1449
|
right: "pl-4 pr-4 py-4"
|
|
1146
1450
|
}[position];
|
|
1147
|
-
return /* @__PURE__ */
|
|
1451
|
+
return /* @__PURE__ */ jsx6(
|
|
1148
1452
|
"div",
|
|
1149
1453
|
{
|
|
1150
1454
|
ref,
|
|
@@ -1160,8 +1464,8 @@ var CardActions = React3.forwardRef(
|
|
|
1160
1464
|
}
|
|
1161
1465
|
);
|
|
1162
1466
|
CardActions.displayName = "CardActions";
|
|
1163
|
-
var CardActionArea =
|
|
1164
|
-
({ className, disabled = false, children, ...props }, ref) => /* @__PURE__ */
|
|
1467
|
+
var CardActionArea = React4.forwardRef(
|
|
1468
|
+
({ className, disabled = false, children, ...props }, ref) => /* @__PURE__ */ jsx6(
|
|
1165
1469
|
"div",
|
|
1166
1470
|
{
|
|
1167
1471
|
ref,
|
|
@@ -1183,9 +1487,9 @@ var CardActionArea = React3.forwardRef(
|
|
|
1183
1487
|
CardActionArea.displayName = "CardActionArea";
|
|
1184
1488
|
|
|
1185
1489
|
// src/ui/badge.tsx
|
|
1186
|
-
import
|
|
1187
|
-
import { jsx as
|
|
1188
|
-
var Badge =
|
|
1490
|
+
import React5 from "react";
|
|
1491
|
+
import { jsx as jsx7, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
1492
|
+
var Badge = React5.forwardRef(
|
|
1189
1493
|
({
|
|
1190
1494
|
className,
|
|
1191
1495
|
variant = "default",
|
|
@@ -1232,7 +1536,7 @@ var Badge = React4.forwardRef(
|
|
|
1232
1536
|
lg: "w-4 h-4",
|
|
1233
1537
|
xl: "w-5 h-5"
|
|
1234
1538
|
};
|
|
1235
|
-
return /* @__PURE__ */
|
|
1539
|
+
return /* @__PURE__ */ jsxs6(
|
|
1236
1540
|
"span",
|
|
1237
1541
|
{
|
|
1238
1542
|
ref,
|
|
@@ -1240,7 +1544,7 @@ var Badge = React4.forwardRef(
|
|
|
1240
1544
|
className: cn(baseStyles, sizes[size], className),
|
|
1241
1545
|
...props,
|
|
1242
1546
|
children: [
|
|
1243
|
-
leftIcon && /* @__PURE__ */
|
|
1547
|
+
leftIcon && /* @__PURE__ */ jsx7(
|
|
1244
1548
|
"span",
|
|
1245
1549
|
{
|
|
1246
1550
|
className: cn(
|
|
@@ -1251,7 +1555,7 @@ var Badge = React4.forwardRef(
|
|
|
1251
1555
|
}
|
|
1252
1556
|
),
|
|
1253
1557
|
children,
|
|
1254
|
-
rightIcon && /* @__PURE__ */
|
|
1558
|
+
rightIcon && /* @__PURE__ */ jsx7(
|
|
1255
1559
|
"span",
|
|
1256
1560
|
{
|
|
1257
1561
|
className: cn(
|
|
@@ -1269,8 +1573,8 @@ var Badge = React4.forwardRef(
|
|
|
1269
1573
|
Badge.displayName = "Badge";
|
|
1270
1574
|
|
|
1271
1575
|
// src/ui/checkbox.tsx
|
|
1272
|
-
import
|
|
1273
|
-
import { jsx as
|
|
1576
|
+
import React6, { useId as useId4, useState as useState5, useRef as useRef4, useEffect as useEffect3 } from "react";
|
|
1577
|
+
import { jsx as jsx8, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
1274
1578
|
function Checkbox({
|
|
1275
1579
|
label,
|
|
1276
1580
|
name,
|
|
@@ -1286,13 +1590,13 @@ function Checkbox({
|
|
|
1286
1590
|
errorMessage
|
|
1287
1591
|
}) {
|
|
1288
1592
|
const form = useForm();
|
|
1289
|
-
const autoId =
|
|
1290
|
-
const stableId =
|
|
1593
|
+
const autoId = useId4();
|
|
1594
|
+
const stableId = useRef4(void 0);
|
|
1291
1595
|
if (!stableId.current) {
|
|
1292
1596
|
stableId.current = id || `checkbox-${autoId}`;
|
|
1293
1597
|
}
|
|
1294
1598
|
const checkboxId = stableId.current;
|
|
1295
|
-
const [validationError, setValidationError] =
|
|
1599
|
+
const [validationError, setValidationError] = useState5();
|
|
1296
1600
|
let checked;
|
|
1297
1601
|
let displayError;
|
|
1298
1602
|
if (form && name) {
|
|
@@ -1308,7 +1612,7 @@ function Checkbox({
|
|
|
1308
1612
|
}
|
|
1309
1613
|
return void 0;
|
|
1310
1614
|
};
|
|
1311
|
-
|
|
1615
|
+
useEffect3(() => {
|
|
1312
1616
|
if (form && name) {
|
|
1313
1617
|
const validator = async (val) => {
|
|
1314
1618
|
if (required && !val) {
|
|
@@ -1357,10 +1661,10 @@ function Checkbox({
|
|
|
1357
1661
|
lg: "gap-2",
|
|
1358
1662
|
xl: "gap-2"
|
|
1359
1663
|
};
|
|
1360
|
-
return /* @__PURE__ */
|
|
1361
|
-
/* @__PURE__ */
|
|
1362
|
-
/* @__PURE__ */
|
|
1363
|
-
/* @__PURE__ */
|
|
1664
|
+
return /* @__PURE__ */ jsxs7("div", { className: cn("flex flex-col", className), children: [
|
|
1665
|
+
/* @__PURE__ */ jsxs7("div", { className: cn("flex items-center", containerGapStyles[size]), children: [
|
|
1666
|
+
/* @__PURE__ */ jsxs7("div", { className: "relative group/checkbox flex items-center shrink-0", children: [
|
|
1667
|
+
/* @__PURE__ */ jsx8("div", { className: "absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 pointer-events-none", children: /* @__PURE__ */ jsx8(
|
|
1364
1668
|
"div",
|
|
1365
1669
|
{
|
|
1366
1670
|
className: "rounded-full scale-0 group-hover/checkbox:scale-100 group-active/checkbox:scale-100 transition-transform duration-200 ease-out",
|
|
@@ -1371,7 +1675,7 @@ function Checkbox({
|
|
|
1371
1675
|
}
|
|
1372
1676
|
}
|
|
1373
1677
|
) }),
|
|
1374
|
-
/* @__PURE__ */
|
|
1678
|
+
/* @__PURE__ */ jsx8(
|
|
1375
1679
|
"input",
|
|
1376
1680
|
{
|
|
1377
1681
|
type: "checkbox",
|
|
@@ -1379,7 +1683,6 @@ function Checkbox({
|
|
|
1379
1683
|
checked,
|
|
1380
1684
|
onChange: handleChange,
|
|
1381
1685
|
disabled,
|
|
1382
|
-
suppressHydrationWarning: true,
|
|
1383
1686
|
className: cn(
|
|
1384
1687
|
"rounded focus:outline-none focus-visible:ring-2 focus-visible:ring-blue-500 focus-visible:ring-offset-2 transition-all relative z-10",
|
|
1385
1688
|
disabled && "cursor-not-allowed"
|
|
@@ -1395,7 +1698,7 @@ function Checkbox({
|
|
|
1395
1698
|
}
|
|
1396
1699
|
)
|
|
1397
1700
|
] }),
|
|
1398
|
-
label && /* @__PURE__ */
|
|
1701
|
+
label && /* @__PURE__ */ jsxs7(
|
|
1399
1702
|
"label",
|
|
1400
1703
|
{
|
|
1401
1704
|
htmlFor: checkboxId,
|
|
@@ -1404,7 +1707,6 @@ function Checkbox({
|
|
|
1404
1707
|
disabled && "cursor-not-allowed",
|
|
1405
1708
|
!disabled && "cursor-pointer"
|
|
1406
1709
|
),
|
|
1407
|
-
suppressHydrationWarning: true,
|
|
1408
1710
|
style: {
|
|
1409
1711
|
fontSize: size === "xs" ? "var(--checkbox-label-font-size-xs)" : size === "sm" ? "var(--checkbox-label-font-size-sm)" : size === "lg" ? "var(--checkbox-label-font-size-lg)" : size === "xl" ? "var(--checkbox-label-font-size-xl)" : "var(--checkbox-label-font-size-md)",
|
|
1410
1712
|
color: "var(--color-muted-foreground)",
|
|
@@ -1412,12 +1714,12 @@ function Checkbox({
|
|
|
1412
1714
|
},
|
|
1413
1715
|
children: [
|
|
1414
1716
|
label,
|
|
1415
|
-
required && /* @__PURE__ */
|
|
1717
|
+
required && /* @__PURE__ */ jsx8("span", { className: "ml-1", children: "*" })
|
|
1416
1718
|
]
|
|
1417
1719
|
}
|
|
1418
1720
|
)
|
|
1419
1721
|
] }),
|
|
1420
|
-
/* @__PURE__ */
|
|
1722
|
+
/* @__PURE__ */ jsx8("div", { className: "h-5 mt-1.5", children: displayError && /* @__PURE__ */ jsx8("p", { className: "text-small text-error", role: "alert", children: displayError }) })
|
|
1421
1723
|
] });
|
|
1422
1724
|
}
|
|
1423
1725
|
function CheckboxGroup({
|
|
@@ -1436,7 +1738,7 @@ function CheckboxGroup({
|
|
|
1436
1738
|
validate
|
|
1437
1739
|
}) {
|
|
1438
1740
|
const form = useForm();
|
|
1439
|
-
|
|
1741
|
+
React6.useEffect(() => {
|
|
1440
1742
|
if (form && name) {
|
|
1441
1743
|
const validator = validate || (required ? (value2) => {
|
|
1442
1744
|
if (!value2 || value2.length === 0) {
|
|
@@ -1467,24 +1769,24 @@ function CheckboxGroup({
|
|
|
1467
1769
|
lg: "gap-2",
|
|
1468
1770
|
xl: "gap-2"
|
|
1469
1771
|
};
|
|
1470
|
-
return /* @__PURE__ */
|
|
1772
|
+
return /* @__PURE__ */ jsxs7(
|
|
1471
1773
|
"div",
|
|
1472
1774
|
{
|
|
1473
1775
|
className,
|
|
1474
1776
|
style: { marginBottom: "var(--form-control-spacing)" },
|
|
1475
1777
|
children: [
|
|
1476
|
-
label && /* @__PURE__ */
|
|
1778
|
+
label && /* @__PURE__ */ jsxs7(
|
|
1477
1779
|
"label",
|
|
1478
1780
|
{
|
|
1479
1781
|
className: "block text-small font-semibold mb-1",
|
|
1480
1782
|
style: { color: "var(--color-muted-foreground)" },
|
|
1481
1783
|
children: [
|
|
1482
1784
|
label,
|
|
1483
|
-
required && /* @__PURE__ */
|
|
1785
|
+
required && /* @__PURE__ */ jsx8("span", { className: "ml-1", children: "*" })
|
|
1484
1786
|
]
|
|
1485
1787
|
}
|
|
1486
1788
|
),
|
|
1487
|
-
/* @__PURE__ */
|
|
1789
|
+
/* @__PURE__ */ jsx8(
|
|
1488
1790
|
"div",
|
|
1489
1791
|
{
|
|
1490
1792
|
className: cn(
|
|
@@ -1492,7 +1794,7 @@ function CheckboxGroup({
|
|
|
1492
1794
|
),
|
|
1493
1795
|
children: options.map((option) => {
|
|
1494
1796
|
const isDisabled = disabled || option.disabled;
|
|
1495
|
-
return /* @__PURE__ */
|
|
1797
|
+
return /* @__PURE__ */ jsxs7(
|
|
1496
1798
|
"div",
|
|
1497
1799
|
{
|
|
1498
1800
|
className: cn(
|
|
@@ -1500,8 +1802,8 @@ function CheckboxGroup({
|
|
|
1500
1802
|
containerGapStyles[size]
|
|
1501
1803
|
),
|
|
1502
1804
|
children: [
|
|
1503
|
-
/* @__PURE__ */
|
|
1504
|
-
/* @__PURE__ */
|
|
1805
|
+
/* @__PURE__ */ jsxs7("div", { className: "relative group/checkbox flex items-center shrink-0", children: [
|
|
1806
|
+
/* @__PURE__ */ jsx8("div", { className: "absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 pointer-events-none", children: /* @__PURE__ */ jsx8(
|
|
1505
1807
|
"div",
|
|
1506
1808
|
{
|
|
1507
1809
|
className: "rounded-full scale-0 group-hover/checkbox:scale-100 group-active/checkbox:scale-100 transition-transform duration-200 ease-out",
|
|
@@ -1512,7 +1814,7 @@ function CheckboxGroup({
|
|
|
1512
1814
|
}
|
|
1513
1815
|
}
|
|
1514
1816
|
) }),
|
|
1515
|
-
/* @__PURE__ */
|
|
1817
|
+
/* @__PURE__ */ jsx8(
|
|
1516
1818
|
"input",
|
|
1517
1819
|
{
|
|
1518
1820
|
type: "checkbox",
|
|
@@ -1540,7 +1842,7 @@ function CheckboxGroup({
|
|
|
1540
1842
|
}
|
|
1541
1843
|
)
|
|
1542
1844
|
] }),
|
|
1543
|
-
/* @__PURE__ */
|
|
1845
|
+
/* @__PURE__ */ jsx8(
|
|
1544
1846
|
"label",
|
|
1545
1847
|
{
|
|
1546
1848
|
htmlFor: `${name}-${option.value}`,
|
|
@@ -1564,7 +1866,7 @@ function CheckboxGroup({
|
|
|
1564
1866
|
})
|
|
1565
1867
|
}
|
|
1566
1868
|
),
|
|
1567
|
-
/* @__PURE__ */
|
|
1869
|
+
/* @__PURE__ */ jsx8("div", { className: "h-5 mt-1.5", children: (error || helperText) && /* @__PURE__ */ jsx8(
|
|
1568
1870
|
"p",
|
|
1569
1871
|
{
|
|
1570
1872
|
className: `text-small ${error ? "text-error" : "text-(--color-muted-foreground)"}`,
|
|
@@ -1578,8 +1880,8 @@ function CheckboxGroup({
|
|
|
1578
1880
|
}
|
|
1579
1881
|
|
|
1580
1882
|
// src/ui/radio.tsx
|
|
1581
|
-
import { useState as
|
|
1582
|
-
import { jsx as
|
|
1883
|
+
import { useState as useState6, useEffect as useEffect4 } from "react";
|
|
1884
|
+
import { jsx as jsx9, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
1583
1885
|
function RadioGroup({
|
|
1584
1886
|
label,
|
|
1585
1887
|
name,
|
|
@@ -1597,8 +1899,8 @@ function RadioGroup({
|
|
|
1597
1899
|
validate
|
|
1598
1900
|
}) {
|
|
1599
1901
|
const form = useForm();
|
|
1600
|
-
const [validationError, setValidationError] =
|
|
1601
|
-
const [touched, setTouched] =
|
|
1902
|
+
const [validationError, setValidationError] = useState6();
|
|
1903
|
+
const [touched, setTouched] = useState6(false);
|
|
1602
1904
|
let value;
|
|
1603
1905
|
let displayError;
|
|
1604
1906
|
if (form && name) {
|
|
@@ -1608,7 +1910,7 @@ function RadioGroup({
|
|
|
1608
1910
|
value = externalValue;
|
|
1609
1911
|
displayError = error || validationError;
|
|
1610
1912
|
}
|
|
1611
|
-
|
|
1913
|
+
useEffect4(() => {
|
|
1612
1914
|
if (form && name) {
|
|
1613
1915
|
const validator = async (val) => {
|
|
1614
1916
|
if (required && !val) {
|
|
@@ -1623,7 +1925,7 @@ function RadioGroup({
|
|
|
1623
1925
|
return () => form.unregisterField(name);
|
|
1624
1926
|
}
|
|
1625
1927
|
}, [form, name]);
|
|
1626
|
-
|
|
1928
|
+
useEffect4(() => {
|
|
1627
1929
|
if (!form && touched && required && !value) {
|
|
1628
1930
|
setValidationError(errorMessage || "Please select an option");
|
|
1629
1931
|
} else if (!form) {
|
|
@@ -1648,24 +1950,24 @@ function RadioGroup({
|
|
|
1648
1950
|
lg: "gap-2",
|
|
1649
1951
|
xl: "gap-2"
|
|
1650
1952
|
};
|
|
1651
|
-
return /* @__PURE__ */
|
|
1953
|
+
return /* @__PURE__ */ jsxs8(
|
|
1652
1954
|
"div",
|
|
1653
1955
|
{
|
|
1654
1956
|
className,
|
|
1655
1957
|
style: { marginBottom: "var(--form-control-spacing)" },
|
|
1656
1958
|
children: [
|
|
1657
|
-
label && /* @__PURE__ */
|
|
1959
|
+
label && /* @__PURE__ */ jsxs8(
|
|
1658
1960
|
"label",
|
|
1659
1961
|
{
|
|
1660
1962
|
className: "block text-small font-semibold mb-1",
|
|
1661
1963
|
style: { color: "var(--color-muted-foreground)" },
|
|
1662
1964
|
children: [
|
|
1663
1965
|
label,
|
|
1664
|
-
required && /* @__PURE__ */
|
|
1966
|
+
required && /* @__PURE__ */ jsx9("span", { className: "ml-1", children: "*" })
|
|
1665
1967
|
]
|
|
1666
1968
|
}
|
|
1667
1969
|
),
|
|
1668
|
-
/* @__PURE__ */
|
|
1970
|
+
/* @__PURE__ */ jsx9(
|
|
1669
1971
|
"div",
|
|
1670
1972
|
{
|
|
1671
1973
|
className: cn(
|
|
@@ -1674,7 +1976,7 @@ function RadioGroup({
|
|
|
1674
1976
|
),
|
|
1675
1977
|
children: options.map((option) => {
|
|
1676
1978
|
const isDisabled = disabled || option.disabled;
|
|
1677
|
-
return /* @__PURE__ */
|
|
1979
|
+
return /* @__PURE__ */ jsxs8(
|
|
1678
1980
|
"div",
|
|
1679
1981
|
{
|
|
1680
1982
|
className: cn(
|
|
@@ -1682,8 +1984,8 @@ function RadioGroup({
|
|
|
1682
1984
|
containerGapStyles[size]
|
|
1683
1985
|
),
|
|
1684
1986
|
children: [
|
|
1685
|
-
/* @__PURE__ */
|
|
1686
|
-
/* @__PURE__ */
|
|
1987
|
+
/* @__PURE__ */ jsxs8("div", { className: "relative group/radio flex items-center shrink-0", children: [
|
|
1988
|
+
/* @__PURE__ */ jsx9("div", { className: "absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 pointer-events-none", children: /* @__PURE__ */ jsx9(
|
|
1687
1989
|
"div",
|
|
1688
1990
|
{
|
|
1689
1991
|
className: "rounded-full scale-0 group-hover/radio:scale-100 group-active/radio:scale-100 transition-transform duration-200 ease-out",
|
|
@@ -1694,7 +1996,7 @@ function RadioGroup({
|
|
|
1694
1996
|
}
|
|
1695
1997
|
}
|
|
1696
1998
|
) }),
|
|
1697
|
-
/* @__PURE__ */
|
|
1999
|
+
/* @__PURE__ */ jsx9(
|
|
1698
2000
|
"input",
|
|
1699
2001
|
{
|
|
1700
2002
|
type: "radio",
|
|
@@ -1719,7 +2021,7 @@ function RadioGroup({
|
|
|
1719
2021
|
}
|
|
1720
2022
|
)
|
|
1721
2023
|
] }),
|
|
1722
|
-
/* @__PURE__ */
|
|
2024
|
+
/* @__PURE__ */ jsx9(
|
|
1723
2025
|
"label",
|
|
1724
2026
|
{
|
|
1725
2027
|
htmlFor: `${name}-${option.value}`,
|
|
@@ -1743,7 +2045,7 @@ function RadioGroup({
|
|
|
1743
2045
|
})
|
|
1744
2046
|
}
|
|
1745
2047
|
),
|
|
1746
|
-
/* @__PURE__ */
|
|
2048
|
+
/* @__PURE__ */ jsx9("div", { className: "h-5 mt-1.5", children: (displayError || helperText) && /* @__PURE__ */ jsx9(
|
|
1747
2049
|
"p",
|
|
1748
2050
|
{
|
|
1749
2051
|
className: `text-small ${displayError ? "text-error" : "text-(--color-muted-foreground)"}`,
|
|
@@ -1758,8 +2060,8 @@ function RadioGroup({
|
|
|
1758
2060
|
|
|
1759
2061
|
// src/ui/select.tsx
|
|
1760
2062
|
import { ChevronDown, X } from "lucide-react";
|
|
1761
|
-
import { useState as
|
|
1762
|
-
import { jsx as
|
|
2063
|
+
import { useState as useState7, useRef as useRef5, useEffect as useEffect5 } from "react";
|
|
2064
|
+
import { jsx as jsx10, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
1763
2065
|
function Select({
|
|
1764
2066
|
name,
|
|
1765
2067
|
label,
|
|
@@ -1779,9 +2081,9 @@ function Select({
|
|
|
1779
2081
|
errorMessage
|
|
1780
2082
|
}) {
|
|
1781
2083
|
const form = useForm();
|
|
1782
|
-
const [isOpen, setIsOpen] =
|
|
1783
|
-
const dropdownRef =
|
|
1784
|
-
const [validationError, _setValidationError] =
|
|
2084
|
+
const [isOpen, setIsOpen] = useState7(false);
|
|
2085
|
+
const dropdownRef = useRef5(null);
|
|
2086
|
+
const [validationError, _setValidationError] = useState7();
|
|
1785
2087
|
let value;
|
|
1786
2088
|
let displayError;
|
|
1787
2089
|
if (form && name) {
|
|
@@ -1791,7 +2093,7 @@ function Select({
|
|
|
1791
2093
|
value = externalValue;
|
|
1792
2094
|
displayError = error || validationError;
|
|
1793
2095
|
}
|
|
1794
|
-
|
|
2096
|
+
useEffect5(() => {
|
|
1795
2097
|
if (form && name) {
|
|
1796
2098
|
const validator = async (val) => {
|
|
1797
2099
|
if (required && (val === void 0 || val === null || val === "")) {
|
|
@@ -1832,7 +2134,7 @@ function Select({
|
|
|
1832
2134
|
lg: `[padding-left:var(--dropdown-option-padding-lg-x)] [padding-right:var(--dropdown-option-padding-lg-x)] [padding-top:var(--dropdown-option-padding-lg-y)] [padding-bottom:var(--dropdown-option-padding-lg-y)] [font-size:var(--dropdown-option-font-size-lg)]`,
|
|
1833
2135
|
xl: `[padding-left:var(--dropdown-option-padding-xl-x)] [padding-right:var(--dropdown-option-padding-xl-x)] [padding-top:var(--dropdown-option-padding-xl-y)] [padding-bottom:var(--dropdown-option-padding-xl-y)] [font-size:var(--dropdown-option-font-size-xl)]`
|
|
1834
2136
|
};
|
|
1835
|
-
|
|
2137
|
+
useEffect5(() => {
|
|
1836
2138
|
const handleClickOutside = (event) => {
|
|
1837
2139
|
if (dropdownRef.current && !dropdownRef.current.contains(event.target)) {
|
|
1838
2140
|
setIsOpen(false);
|
|
@@ -1871,25 +2173,25 @@ function Select({
|
|
|
1871
2173
|
setIsOpen(false);
|
|
1872
2174
|
}
|
|
1873
2175
|
};
|
|
1874
|
-
return /* @__PURE__ */
|
|
2176
|
+
return /* @__PURE__ */ jsxs9(
|
|
1875
2177
|
"div",
|
|
1876
2178
|
{
|
|
1877
2179
|
className: `w-full ${className}`,
|
|
1878
2180
|
style: { marginBottom: "var(--form-control-spacing)" },
|
|
1879
2181
|
children: [
|
|
1880
|
-
label && /* @__PURE__ */
|
|
2182
|
+
label && /* @__PURE__ */ jsxs9(
|
|
1881
2183
|
"label",
|
|
1882
2184
|
{
|
|
1883
2185
|
className: "block text-small font-semibold mb-1",
|
|
1884
2186
|
style: { color: "var(--color-muted-foreground)" },
|
|
1885
2187
|
children: [
|
|
1886
2188
|
label,
|
|
1887
|
-
required && /* @__PURE__ */
|
|
2189
|
+
required && /* @__PURE__ */ jsx10("span", { className: "ml-1", children: "*" })
|
|
1888
2190
|
]
|
|
1889
2191
|
}
|
|
1890
2192
|
),
|
|
1891
|
-
/* @__PURE__ */
|
|
1892
|
-
/* @__PURE__ */
|
|
2193
|
+
/* @__PURE__ */ jsxs9("div", { ref: dropdownRef, className: "relative", children: [
|
|
2194
|
+
/* @__PURE__ */ jsxs9(
|
|
1893
2195
|
"button",
|
|
1894
2196
|
{
|
|
1895
2197
|
type: "button",
|
|
@@ -1905,9 +2207,9 @@ function Select({
|
|
|
1905
2207
|
${!value ? "text-(--color-placeholder)" : "text-(--color-foreground)"}
|
|
1906
2208
|
`,
|
|
1907
2209
|
children: [
|
|
1908
|
-
/* @__PURE__ */
|
|
1909
|
-
/* @__PURE__ */
|
|
1910
|
-
value && /* @__PURE__ */
|
|
2210
|
+
/* @__PURE__ */ jsx10("span", { className: "truncate", children: getSelectedLabel() }),
|
|
2211
|
+
/* @__PURE__ */ jsxs9("div", { className: "flex items-center gap-1 ml-2", children: [
|
|
2212
|
+
value && /* @__PURE__ */ jsx10(
|
|
1911
2213
|
"div",
|
|
1912
2214
|
{
|
|
1913
2215
|
onClick: handleClear,
|
|
@@ -1915,7 +2217,7 @@ function Select({
|
|
|
1915
2217
|
role: "button",
|
|
1916
2218
|
"aria-label": "Clear selection",
|
|
1917
2219
|
tabIndex: -1,
|
|
1918
|
-
children: /* @__PURE__ */
|
|
2220
|
+
children: /* @__PURE__ */ jsx10(
|
|
1919
2221
|
X,
|
|
1920
2222
|
{
|
|
1921
2223
|
className: `${iconSizeStyles[size]} text-(--color-muted-foreground)`
|
|
@@ -1923,7 +2225,7 @@ function Select({
|
|
|
1923
2225
|
)
|
|
1924
2226
|
}
|
|
1925
2227
|
),
|
|
1926
|
-
/* @__PURE__ */
|
|
2228
|
+
/* @__PURE__ */ jsx10(
|
|
1927
2229
|
ChevronDown,
|
|
1928
2230
|
{
|
|
1929
2231
|
className: `${iconSizeStyles[size]} text-(--color-placeholder) transition-transform duration-200 shrink-0 ${isOpen ? "transform rotate-180" : ""}`
|
|
@@ -1933,18 +2235,18 @@ function Select({
|
|
|
1933
2235
|
]
|
|
1934
2236
|
}
|
|
1935
2237
|
),
|
|
1936
|
-
isOpen && !disabled && /* @__PURE__ */
|
|
2238
|
+
isOpen && !disabled && /* @__PURE__ */ jsx10(
|
|
1937
2239
|
"div",
|
|
1938
2240
|
{
|
|
1939
2241
|
className: "absolute z-(--z-index-dropdown) w-full mt-1 bg-(--color-background) border border-(--color-border) rounded-lg shadow-lg max-h-60 overflow-auto",
|
|
1940
2242
|
role: "listbox",
|
|
1941
2243
|
children: children ? (
|
|
1942
2244
|
// Custom content
|
|
1943
|
-
/* @__PURE__ */
|
|
2245
|
+
/* @__PURE__ */ jsx10("div", { onClick: () => setIsOpen(false), children })
|
|
1944
2246
|
) : (
|
|
1945
2247
|
// Standard options
|
|
1946
|
-
/* @__PURE__ */
|
|
1947
|
-
/* @__PURE__ */
|
|
2248
|
+
/* @__PURE__ */ jsxs9("ul", { children: [
|
|
2249
|
+
/* @__PURE__ */ jsx10("li", { children: /* @__PURE__ */ jsx10(
|
|
1948
2250
|
"button",
|
|
1949
2251
|
{
|
|
1950
2252
|
type: "button",
|
|
@@ -1959,7 +2261,7 @@ function Select({
|
|
|
1959
2261
|
children: placeholder
|
|
1960
2262
|
}
|
|
1961
2263
|
) }, "__placeholder__"),
|
|
1962
|
-
options.map((option) => /* @__PURE__ */
|
|
2264
|
+
options.map((option) => /* @__PURE__ */ jsx10("li", { children: /* @__PURE__ */ jsx10(
|
|
1963
2265
|
"button",
|
|
1964
2266
|
{
|
|
1965
2267
|
type: "button",
|
|
@@ -1981,7 +2283,7 @@ function Select({
|
|
|
1981
2283
|
}
|
|
1982
2284
|
)
|
|
1983
2285
|
] }),
|
|
1984
|
-
/* @__PURE__ */
|
|
2286
|
+
/* @__PURE__ */ jsx10("div", { className: "h-5 mt-1.5", children: (helperText || displayError) && /* @__PURE__ */ jsx10(
|
|
1985
2287
|
"p",
|
|
1986
2288
|
{
|
|
1987
2289
|
className: `text-small ${displayError ? "text-error" : "text-(--color-muted-foreground)"}`,
|
|
@@ -1994,9 +2296,9 @@ function Select({
|
|
|
1994
2296
|
}
|
|
1995
2297
|
|
|
1996
2298
|
// src/ui/spinner.tsx
|
|
1997
|
-
import
|
|
1998
|
-
import { jsx as
|
|
1999
|
-
var Spinner =
|
|
2299
|
+
import React7 from "react";
|
|
2300
|
+
import { jsx as jsx11, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
2301
|
+
var Spinner = React7.forwardRef(
|
|
2000
2302
|
({ className, size = "md", color = "primary", label, ...props }, ref) => {
|
|
2001
2303
|
const sizes = {
|
|
2002
2304
|
sm: "h-4 w-4",
|
|
@@ -2009,7 +2311,7 @@ var Spinner = React6.forwardRef(
|
|
|
2009
2311
|
secondary: "text-(--color-muted-foreground)",
|
|
2010
2312
|
white: "text-white"
|
|
2011
2313
|
};
|
|
2012
|
-
return /* @__PURE__ */
|
|
2314
|
+
return /* @__PURE__ */ jsxs10(
|
|
2013
2315
|
"div",
|
|
2014
2316
|
{
|
|
2015
2317
|
ref,
|
|
@@ -2019,7 +2321,7 @@ var Spinner = React6.forwardRef(
|
|
|
2019
2321
|
),
|
|
2020
2322
|
...props,
|
|
2021
2323
|
children: [
|
|
2022
|
-
/* @__PURE__ */
|
|
2324
|
+
/* @__PURE__ */ jsxs10(
|
|
2023
2325
|
"svg",
|
|
2024
2326
|
{
|
|
2025
2327
|
className: cn("animate-spin", sizes[size], colors[color]),
|
|
@@ -2027,7 +2329,7 @@ var Spinner = React6.forwardRef(
|
|
|
2027
2329
|
fill: "none",
|
|
2028
2330
|
viewBox: "0 0 24 24",
|
|
2029
2331
|
children: [
|
|
2030
|
-
/* @__PURE__ */
|
|
2332
|
+
/* @__PURE__ */ jsx11(
|
|
2031
2333
|
"circle",
|
|
2032
2334
|
{
|
|
2033
2335
|
className: "opacity-25",
|
|
@@ -2038,7 +2340,7 @@ var Spinner = React6.forwardRef(
|
|
|
2038
2340
|
strokeWidth: "4"
|
|
2039
2341
|
}
|
|
2040
2342
|
),
|
|
2041
|
-
/* @__PURE__ */
|
|
2343
|
+
/* @__PURE__ */ jsx11(
|
|
2042
2344
|
"path",
|
|
2043
2345
|
{
|
|
2044
2346
|
className: "opacity-75",
|
|
@@ -2049,7 +2351,7 @@ var Spinner = React6.forwardRef(
|
|
|
2049
2351
|
]
|
|
2050
2352
|
}
|
|
2051
2353
|
),
|
|
2052
|
-
label && /* @__PURE__ */
|
|
2354
|
+
label && /* @__PURE__ */ jsx11("p", { className: "text-small text-(--color-muted-foreground)", children: label })
|
|
2053
2355
|
]
|
|
2054
2356
|
}
|
|
2055
2357
|
);
|
|
@@ -2059,8 +2361,8 @@ Spinner.displayName = "Spinner";
|
|
|
2059
2361
|
|
|
2060
2362
|
// src/ui/code-snippet.tsx
|
|
2061
2363
|
import { Highlight, themes } from "prism-react-renderer";
|
|
2062
|
-
import { useState as
|
|
2063
|
-
import { jsx as
|
|
2364
|
+
import { useState as useState8 } from "react";
|
|
2365
|
+
import { jsx as jsx12, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
2064
2366
|
function CodeSnippet({
|
|
2065
2367
|
code,
|
|
2066
2368
|
language = "tsx",
|
|
@@ -2072,8 +2374,8 @@ function CodeSnippet({
|
|
|
2072
2374
|
body: "text-body",
|
|
2073
2375
|
h6: "text-h6"
|
|
2074
2376
|
};
|
|
2075
|
-
const [copied, setCopied] =
|
|
2076
|
-
const [showTooltip, setShowTooltip] =
|
|
2377
|
+
const [copied, setCopied] = useState8(false);
|
|
2378
|
+
const [showTooltip, setShowTooltip] = useState8(false);
|
|
2077
2379
|
const handleCopy = async () => {
|
|
2078
2380
|
try {
|
|
2079
2381
|
await navigator.clipboard.writeText(code);
|
|
@@ -2083,9 +2385,9 @@ function CodeSnippet({
|
|
|
2083
2385
|
console.error("Failed to copy:", err);
|
|
2084
2386
|
}
|
|
2085
2387
|
};
|
|
2086
|
-
return /* @__PURE__ */
|
|
2087
|
-
/* @__PURE__ */
|
|
2088
|
-
/* @__PURE__ */
|
|
2388
|
+
return /* @__PURE__ */ jsxs11("div", { className: "relative group w-full", children: [
|
|
2389
|
+
/* @__PURE__ */ jsxs11("div", { className: "absolute right-3 top-3 [z-index:var(--z-index-code-button)]", children: [
|
|
2390
|
+
/* @__PURE__ */ jsx12(
|
|
2089
2391
|
"button",
|
|
2090
2392
|
{
|
|
2091
2393
|
onClick: handleCopy,
|
|
@@ -2095,14 +2397,14 @@ function CodeSnippet({
|
|
|
2095
2397
|
"aria-label": "Copy code",
|
|
2096
2398
|
children: copied ? (
|
|
2097
2399
|
// Check icon
|
|
2098
|
-
/* @__PURE__ */
|
|
2400
|
+
/* @__PURE__ */ jsx12(
|
|
2099
2401
|
"svg",
|
|
2100
2402
|
{
|
|
2101
2403
|
className: "w-4 h-4 text-green-400",
|
|
2102
2404
|
fill: "none",
|
|
2103
2405
|
stroke: "currentColor",
|
|
2104
2406
|
viewBox: "0 0 24 24",
|
|
2105
|
-
children: /* @__PURE__ */
|
|
2407
|
+
children: /* @__PURE__ */ jsx12(
|
|
2106
2408
|
"path",
|
|
2107
2409
|
{
|
|
2108
2410
|
strokeLinecap: "round",
|
|
@@ -2115,14 +2417,14 @@ function CodeSnippet({
|
|
|
2115
2417
|
)
|
|
2116
2418
|
) : (
|
|
2117
2419
|
// Copy icon
|
|
2118
|
-
/* @__PURE__ */
|
|
2420
|
+
/* @__PURE__ */ jsx12(
|
|
2119
2421
|
"svg",
|
|
2120
2422
|
{
|
|
2121
2423
|
className: "w-4 h-4",
|
|
2122
2424
|
fill: "none",
|
|
2123
2425
|
stroke: "currentColor",
|
|
2124
2426
|
viewBox: "0 0 24 24",
|
|
2125
|
-
children: /* @__PURE__ */
|
|
2427
|
+
children: /* @__PURE__ */ jsx12(
|
|
2126
2428
|
"path",
|
|
2127
2429
|
{
|
|
2128
2430
|
strokeLinecap: "round",
|
|
@@ -2136,26 +2438,26 @@ function CodeSnippet({
|
|
|
2136
2438
|
)
|
|
2137
2439
|
}
|
|
2138
2440
|
),
|
|
2139
|
-
showTooltip && !copied && /* @__PURE__ */
|
|
2441
|
+
showTooltip && !copied && /* @__PURE__ */ jsxs11("div", { className: "absolute right-0 top-full mt-2 px-2 py-1 bg-[#1f2937] text-white text-caption rounded shadow-lg whitespace-nowrap border border-[#374151]", children: [
|
|
2140
2442
|
"Copy code",
|
|
2141
|
-
/* @__PURE__ */
|
|
2443
|
+
/* @__PURE__ */ jsx12("div", { className: "absolute -top-1 right-3 w-2 h-2 bg-[#1f2937] border-l border-t border-[#374151] transform rotate-45" })
|
|
2142
2444
|
] }),
|
|
2143
|
-
copied && /* @__PURE__ */
|
|
2445
|
+
copied && /* @__PURE__ */ jsxs11("div", { className: "absolute right-0 top-full mt-2 px-2 py-1 bg-green-600 text-white text-caption rounded shadow-lg whitespace-nowrap", children: [
|
|
2144
2446
|
"Copied!",
|
|
2145
|
-
/* @__PURE__ */
|
|
2447
|
+
/* @__PURE__ */ jsx12("div", { className: "absolute -top-1 right-3 w-2 h-2 bg-green-600 transform rotate-45" })
|
|
2146
2448
|
] })
|
|
2147
2449
|
] }),
|
|
2148
|
-
/* @__PURE__ */
|
|
2450
|
+
/* @__PURE__ */ jsx12(
|
|
2149
2451
|
"div",
|
|
2150
2452
|
{
|
|
2151
2453
|
className: `rounded-lg overflow-x-auto border border-[#1f2937] ${fontSizeClassMap[fontSize]} code-snippet-${fontSize}`,
|
|
2152
|
-
children: /* @__PURE__ */
|
|
2454
|
+
children: /* @__PURE__ */ jsx12(
|
|
2153
2455
|
Highlight,
|
|
2154
2456
|
{
|
|
2155
2457
|
theme: themes.vsDark,
|
|
2156
2458
|
code,
|
|
2157
2459
|
language,
|
|
2158
|
-
children: ({ style, tokens, getLineProps, getTokenProps }) => /* @__PURE__ */
|
|
2460
|
+
children: ({ style, tokens, getLineProps, getTokenProps }) => /* @__PURE__ */ jsx12(
|
|
2159
2461
|
"pre",
|
|
2160
2462
|
{
|
|
2161
2463
|
style: {
|
|
@@ -2167,7 +2469,7 @@ function CodeSnippet({
|
|
|
2167
2469
|
whiteSpace: wrap ? "pre-wrap" : "pre",
|
|
2168
2470
|
wordBreak: wrap ? "break-word" : "normal"
|
|
2169
2471
|
},
|
|
2170
|
-
children: tokens.map((line, i) => /* @__PURE__ */
|
|
2472
|
+
children: tokens.map((line, i) => /* @__PURE__ */ jsx12("div", { ...getLineProps({ line }), children: line.map((token, key) => /* @__PURE__ */ jsx12(
|
|
2171
2473
|
"span",
|
|
2172
2474
|
{
|
|
2173
2475
|
...getTokenProps({ token })
|
|
@@ -2185,8 +2487,8 @@ function CodeSnippet({
|
|
|
2185
2487
|
|
|
2186
2488
|
// src/ui/rating.tsx
|
|
2187
2489
|
import { Star } from "lucide-react";
|
|
2188
|
-
import
|
|
2189
|
-
import { jsx as
|
|
2490
|
+
import React8, { useId as useId5 } from "react";
|
|
2491
|
+
import { jsx as jsx13, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
2190
2492
|
var Rating = ({
|
|
2191
2493
|
value,
|
|
2192
2494
|
max = 5,
|
|
@@ -2201,8 +2503,8 @@ var Rating = ({
|
|
|
2201
2503
|
valuePosition = "inline",
|
|
2202
2504
|
valueFormat = "decimal"
|
|
2203
2505
|
}) => {
|
|
2204
|
-
const uniqueId =
|
|
2205
|
-
const [hoverValue, setHoverValue] =
|
|
2506
|
+
const uniqueId = useId5();
|
|
2507
|
+
const [hoverValue, setHoverValue] = React8.useState(null);
|
|
2206
2508
|
const handleStarClick = (starIndex) => {
|
|
2207
2509
|
if (interactive && onChange) {
|
|
2208
2510
|
onChange(starIndex);
|
|
@@ -2228,7 +2530,7 @@ var Rating = ({
|
|
|
2228
2530
|
const isHalf = displayValue >= i - 0.5 && displayValue < i;
|
|
2229
2531
|
const isEmpty = displayValue < i - 0.5;
|
|
2230
2532
|
stars.push(
|
|
2231
|
-
/* @__PURE__ */
|
|
2533
|
+
/* @__PURE__ */ jsxs12(
|
|
2232
2534
|
"span",
|
|
2233
2535
|
{
|
|
2234
2536
|
onClick: () => handleStarClick(i),
|
|
@@ -2261,7 +2563,7 @@ var Rating = ({
|
|
|
2261
2563
|
},
|
|
2262
2564
|
className: responsive ? "sm:w-(--star-size) sm:h-(--star-size) w-(--star-mobile-size) h-(--star-mobile-size)" : "",
|
|
2263
2565
|
children: [
|
|
2264
|
-
/* @__PURE__ */
|
|
2566
|
+
/* @__PURE__ */ jsx13(
|
|
2265
2567
|
Star,
|
|
2266
2568
|
{
|
|
2267
2569
|
size: displaySize,
|
|
@@ -2270,7 +2572,7 @@ var Rating = ({
|
|
|
2270
2572
|
style: { position: "absolute", left: 0, top: 0 }
|
|
2271
2573
|
}
|
|
2272
2574
|
),
|
|
2273
|
-
isFull && /* @__PURE__ */
|
|
2575
|
+
isFull && /* @__PURE__ */ jsx13(
|
|
2274
2576
|
Star,
|
|
2275
2577
|
{
|
|
2276
2578
|
size: displaySize,
|
|
@@ -2279,7 +2581,7 @@ var Rating = ({
|
|
|
2279
2581
|
style: { position: "absolute", left: 0, top: 0 }
|
|
2280
2582
|
}
|
|
2281
2583
|
),
|
|
2282
|
-
isHalf && /* @__PURE__ */
|
|
2584
|
+
isHalf && /* @__PURE__ */ jsxs12(
|
|
2283
2585
|
"svg",
|
|
2284
2586
|
{
|
|
2285
2587
|
width: displaySize,
|
|
@@ -2287,7 +2589,7 @@ var Rating = ({
|
|
|
2287
2589
|
viewBox: `0 0 ${displaySize} ${displaySize}`,
|
|
2288
2590
|
style: { position: "absolute", left: 0, top: 0 },
|
|
2289
2591
|
children: [
|
|
2290
|
-
/* @__PURE__ */
|
|
2592
|
+
/* @__PURE__ */ jsx13("defs", { children: /* @__PURE__ */ jsxs12(
|
|
2291
2593
|
"linearGradient",
|
|
2292
2594
|
{
|
|
2293
2595
|
id: `half-${uniqueId}-${i}`,
|
|
@@ -2296,12 +2598,12 @@ var Rating = ({
|
|
|
2296
2598
|
y1: "0",
|
|
2297
2599
|
y2: "0",
|
|
2298
2600
|
children: [
|
|
2299
|
-
/* @__PURE__ */
|
|
2300
|
-
/* @__PURE__ */
|
|
2601
|
+
/* @__PURE__ */ jsx13("stop", { offset: "50%", stopColor: color }),
|
|
2602
|
+
/* @__PURE__ */ jsx13("stop", { offset: "50%", stopColor: "transparent" })
|
|
2301
2603
|
]
|
|
2302
2604
|
}
|
|
2303
2605
|
) }),
|
|
2304
|
-
/* @__PURE__ */
|
|
2606
|
+
/* @__PURE__ */ jsx13(
|
|
2305
2607
|
Star,
|
|
2306
2608
|
{
|
|
2307
2609
|
size: displaySize,
|
|
@@ -2320,7 +2622,7 @@ var Rating = ({
|
|
|
2320
2622
|
}
|
|
2321
2623
|
const valueText = valueFormat === "fraction" ? `${value.toFixed(1)}/${max}` : value.toFixed(1);
|
|
2322
2624
|
if (showValue && valuePosition === "bottom") {
|
|
2323
|
-
return /* @__PURE__ */
|
|
2625
|
+
return /* @__PURE__ */ jsxs12(
|
|
2324
2626
|
"div",
|
|
2325
2627
|
{
|
|
2326
2628
|
className,
|
|
@@ -2331,7 +2633,7 @@ var Rating = ({
|
|
|
2331
2633
|
gap: gap * 2
|
|
2332
2634
|
},
|
|
2333
2635
|
children: [
|
|
2334
|
-
/* @__PURE__ */
|
|
2636
|
+
/* @__PURE__ */ jsx13(
|
|
2335
2637
|
"div",
|
|
2336
2638
|
{
|
|
2337
2639
|
style: {
|
|
@@ -2342,7 +2644,7 @@ var Rating = ({
|
|
|
2342
2644
|
children: stars
|
|
2343
2645
|
}
|
|
2344
2646
|
),
|
|
2345
|
-
/* @__PURE__ */
|
|
2647
|
+
/* @__PURE__ */ jsx13(
|
|
2346
2648
|
"span",
|
|
2347
2649
|
{
|
|
2348
2650
|
style: {
|
|
@@ -2357,7 +2659,7 @@ var Rating = ({
|
|
|
2357
2659
|
}
|
|
2358
2660
|
);
|
|
2359
2661
|
}
|
|
2360
|
-
return /* @__PURE__ */
|
|
2662
|
+
return /* @__PURE__ */ jsxs12(
|
|
2361
2663
|
"div",
|
|
2362
2664
|
{
|
|
2363
2665
|
className,
|
|
@@ -2370,7 +2672,7 @@ var Rating = ({
|
|
|
2370
2672
|
},
|
|
2371
2673
|
children: [
|
|
2372
2674
|
stars,
|
|
2373
|
-
showValue && /* @__PURE__ */
|
|
2675
|
+
showValue && /* @__PURE__ */ jsx13(
|
|
2374
2676
|
"span",
|
|
2375
2677
|
{
|
|
2376
2678
|
style: {
|
|
@@ -2388,7 +2690,7 @@ var Rating = ({
|
|
|
2388
2690
|
};
|
|
2389
2691
|
|
|
2390
2692
|
// src/ui/divider.tsx
|
|
2391
|
-
import { jsx as
|
|
2693
|
+
import { jsx as jsx14, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
2392
2694
|
var Divider = ({
|
|
2393
2695
|
variant = "fullWidth",
|
|
2394
2696
|
orientation = "horizontal",
|
|
@@ -2418,21 +2720,21 @@ var Divider = ({
|
|
|
2418
2720
|
if (children) {
|
|
2419
2721
|
const leftLineClasses = textAlign === "left" ? `${baseClasses} ${orientationClasses}` : `flex-1 ${baseClasses} ${orientationClasses}`;
|
|
2420
2722
|
const rightLineClasses = textAlign === "right" ? `${baseClasses} ${orientationClasses}` : `flex-1 ${baseClasses} ${orientationClasses}`;
|
|
2421
|
-
return /* @__PURE__ */
|
|
2723
|
+
return /* @__PURE__ */ jsxs13(
|
|
2422
2724
|
"div",
|
|
2423
2725
|
{
|
|
2424
2726
|
role: "presentation",
|
|
2425
2727
|
className: `flex items-center gap-3 ${variantClasses[variant]} ${className}`,
|
|
2426
2728
|
children: [
|
|
2427
|
-
textAlign !== "left" && /* @__PURE__ */
|
|
2729
|
+
textAlign !== "left" && /* @__PURE__ */ jsx14(
|
|
2428
2730
|
"div",
|
|
2429
2731
|
{
|
|
2430
2732
|
style: { ...baseStyles, ...thicknessStyle },
|
|
2431
2733
|
className: leftLineClasses
|
|
2432
2734
|
}
|
|
2433
2735
|
),
|
|
2434
|
-
/* @__PURE__ */
|
|
2435
|
-
textAlign !== "right" && /* @__PURE__ */
|
|
2736
|
+
/* @__PURE__ */ jsx14("div", { style: textStyles, className: "whitespace-nowrap", children }),
|
|
2737
|
+
textAlign !== "right" && /* @__PURE__ */ jsx14(
|
|
2436
2738
|
"div",
|
|
2437
2739
|
{
|
|
2438
2740
|
style: { ...baseStyles, ...thicknessStyle },
|
|
@@ -2444,7 +2746,7 @@ var Divider = ({
|
|
|
2444
2746
|
);
|
|
2445
2747
|
}
|
|
2446
2748
|
if (isVertical) {
|
|
2447
|
-
return /* @__PURE__ */
|
|
2749
|
+
return /* @__PURE__ */ jsx14(
|
|
2448
2750
|
"div",
|
|
2449
2751
|
{
|
|
2450
2752
|
role: "separator",
|
|
@@ -2454,7 +2756,7 @@ var Divider = ({
|
|
|
2454
2756
|
}
|
|
2455
2757
|
);
|
|
2456
2758
|
}
|
|
2457
|
-
return /* @__PURE__ */
|
|
2759
|
+
return /* @__PURE__ */ jsx14(
|
|
2458
2760
|
"hr",
|
|
2459
2761
|
{
|
|
2460
2762
|
style: { ...baseStyles, ...thicknessStyle },
|
|
@@ -2464,8 +2766,8 @@ var Divider = ({
|
|
|
2464
2766
|
};
|
|
2465
2767
|
|
|
2466
2768
|
// src/ui/slider.tsx
|
|
2467
|
-
import { useState as
|
|
2468
|
-
import { jsx as
|
|
2769
|
+
import { useState as useState9, useRef as useRef6, useEffect as useEffect6 } from "react";
|
|
2770
|
+
import { jsx as jsx15, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
2469
2771
|
var Slider = ({
|
|
2470
2772
|
value: controlledValue,
|
|
2471
2773
|
defaultValue = 0,
|
|
@@ -2489,21 +2791,21 @@ var Slider = ({
|
|
|
2489
2791
|
"aria-labelledby": ariaLabelledBy
|
|
2490
2792
|
}) => {
|
|
2491
2793
|
const isControlled = controlledValue !== void 0;
|
|
2492
|
-
const [internalValue, setInternalValue] =
|
|
2794
|
+
const [internalValue, setInternalValue] = useState9(
|
|
2493
2795
|
controlledValue ?? defaultValue
|
|
2494
2796
|
);
|
|
2495
|
-
const [isDragging, setIsDragging] =
|
|
2496
|
-
const [activeThumb, setActiveThumb] =
|
|
2497
|
-
const sliderRef =
|
|
2797
|
+
const [isDragging, setIsDragging] = useState9(false);
|
|
2798
|
+
const [activeThumb, setActiveThumb] = useState9(null);
|
|
2799
|
+
const sliderRef = useRef6(null);
|
|
2498
2800
|
const currentValue = isControlled ? controlledValue : internalValue;
|
|
2499
2801
|
const isRange = Array.isArray(currentValue);
|
|
2500
2802
|
const isVertical = orientation === "vertical";
|
|
2501
|
-
|
|
2803
|
+
useEffect6(() => {
|
|
2502
2804
|
if (isControlled) {
|
|
2503
2805
|
setInternalValue(controlledValue);
|
|
2504
2806
|
}
|
|
2505
2807
|
}, [isControlled, controlledValue]);
|
|
2506
|
-
|
|
2808
|
+
useEffect6(() => {
|
|
2507
2809
|
if (isRange && Array.isArray(currentValue)) {
|
|
2508
2810
|
const clampedValues = currentValue.map(
|
|
2509
2811
|
(v) => Math.max(min, Math.min(max, v))
|
|
@@ -2576,7 +2878,7 @@ var Slider = ({
|
|
|
2576
2878
|
updateValue(newValue);
|
|
2577
2879
|
}
|
|
2578
2880
|
};
|
|
2579
|
-
|
|
2881
|
+
useEffect6(() => {
|
|
2580
2882
|
if (!isDragging) return;
|
|
2581
2883
|
const handleGlobalMove = (e) => {
|
|
2582
2884
|
if (isVertical && "touches" in e) {
|
|
@@ -2703,7 +3005,7 @@ var Slider = ({
|
|
|
2703
3005
|
const showLabelAlways = valueLabelDisplay === "on";
|
|
2704
3006
|
const showLabelOnActiveOrHover = valueLabelDisplay === "auto";
|
|
2705
3007
|
const thumbStyle = isVertical ? { bottom: `${percent}%` } : { left: `${percent}%` };
|
|
2706
|
-
return /* @__PURE__ */
|
|
3008
|
+
return /* @__PURE__ */ jsxs14(
|
|
2707
3009
|
"div",
|
|
2708
3010
|
{
|
|
2709
3011
|
className: `absolute ${isVertical ? "left-1/2 -translate-x-1/2" : "top-1/2 -translate-y-1/2"} cursor-pointer ${disabled ? "cursor-not-allowed opacity-50" : ""} group/thumb z-20`,
|
|
@@ -2711,19 +3013,19 @@ var Slider = ({
|
|
|
2711
3013
|
onMouseDown: handleMouseDown(index),
|
|
2712
3014
|
onTouchStart: handleMouseDown(index),
|
|
2713
3015
|
children: [
|
|
2714
|
-
/* @__PURE__ */
|
|
3016
|
+
/* @__PURE__ */ jsx15(
|
|
2715
3017
|
"div",
|
|
2716
3018
|
{
|
|
2717
3019
|
className: `absolute left-0 top-0 -translate-x-1/2 -translate-y-1/2 ${isActive ? currentSizeStyles.thumbActive : currentSizeStyles.thumb} ${currentColorStyles.thumb} ${!isActive && currentColorStyles.thumbHover} rounded-full shadow-md transition-all ${isActive ? `${currentSizeStyles.ringActive} ${currentColorStyles.thumbRing}` : `group-hover/thumb:shadow-lg ${currentSizeStyles.ringHover} ${currentColorStyles.thumbRingHover}`} ${disabled ? "pointer-events-none" : ""}`
|
|
2718
3020
|
}
|
|
2719
3021
|
),
|
|
2720
|
-
showLabelAlways && /* @__PURE__ */
|
|
3022
|
+
showLabelAlways && /* @__PURE__ */ jsxs14(
|
|
2721
3023
|
"div",
|
|
2722
3024
|
{
|
|
2723
3025
|
className: `absolute ${isVertical ? "left-6" : "-top-10"} ${isVertical ? "top-1/2 -translate-y-1/2" : "left-1/2 -translate-x-1/2"} px-2 py-1 text-caption font-semibold text-white ${color === "primary" ? "bg-(--color-primary)" : "bg-purple-500"} rounded shadow-lg whitespace-nowrap z-(--z-index-tooltip)`,
|
|
2724
3026
|
children: [
|
|
2725
3027
|
valueLabelFormat(val),
|
|
2726
|
-
/* @__PURE__ */
|
|
3028
|
+
/* @__PURE__ */ jsx15(
|
|
2727
3029
|
"div",
|
|
2728
3030
|
{
|
|
2729
3031
|
className: `absolute ${isVertical ? "left-0 top-1/2 -translate-y-1/2 -translate-x-full" : "left-1/2 -translate-x-1/2 top-full"} w-0 h-0 ${isVertical ? "border-t-4 border-t-transparent border-b-4 border-b-transparent" : "border-l-4 border-l-transparent border-r-4 border-r-transparent"} ${isVertical ? color === "primary" ? "border-r-4 border-r-[var(--color-primary)]" : "border-r-4 border-r-purple-500" : color === "primary" ? "border-t-4 border-t-[var(--color-primary)]" : "border-t-4 border-t-purple-500"}`
|
|
@@ -2732,13 +3034,13 @@ var Slider = ({
|
|
|
2732
3034
|
]
|
|
2733
3035
|
}
|
|
2734
3036
|
),
|
|
2735
|
-
showLabelOnActiveOrHover && /* @__PURE__ */
|
|
3037
|
+
showLabelOnActiveOrHover && /* @__PURE__ */ jsxs14(
|
|
2736
3038
|
"div",
|
|
2737
3039
|
{
|
|
2738
3040
|
className: `absolute ${isVertical ? "left-6" : "-top-10"} ${isVertical ? "top-1/2 -translate-y-1/2" : "left-1/2 -translate-x-1/2"} px-2 py-1 text-caption font-semibold text-white ${color === "primary" ? "bg-(--color-primary)" : "bg-purple-500"} rounded shadow-lg whitespace-nowrap opacity-0 scale-90 ${isActive ? "opacity-100 scale-100" : "group-hover/thumb:opacity-100 group-hover/thumb:scale-100"} transition-all duration-300 ease-out pointer-events-none z-(--z-index-tooltip)`,
|
|
2739
3041
|
children: [
|
|
2740
3042
|
valueLabelFormat(val),
|
|
2741
|
-
/* @__PURE__ */
|
|
3043
|
+
/* @__PURE__ */ jsx15(
|
|
2742
3044
|
"div",
|
|
2743
3045
|
{
|
|
2744
3046
|
className: `absolute ${isVertical ? "left-0 top-1/2 -translate-y-1/2 -translate-x-full" : "left-1/2 -translate-x-1/2 top-full"} w-0 h-0 ${isVertical ? "border-t-4 border-t-transparent border-b-4 border-b-transparent" : "border-l-4 border-l-transparent border-r-4 border-r-transparent"} ${isVertical ? color === "primary" ? "border-r-4 border-r-[var(--color-primary)]" : "border-r-4 border-r-purple-500" : color === "primary" ? "border-t-4 border-t-[var(--color-primary)]" : "border-t-4 border-t-purple-500"}`
|
|
@@ -2756,13 +3058,13 @@ var Slider = ({
|
|
|
2756
3058
|
const hasMarkLabels = marksList.some((mark) => mark.label);
|
|
2757
3059
|
const containerClasses = isVertical ? "flex flex-col items-center py-4" : `flex items-center w-full px-2 ${hasMarkLabels ? "pb-6" : ""}`;
|
|
2758
3060
|
const railClasses = isVertical ? `${currentSizeStyles.rail} relative overflow-visible` : `w-full ${currentSizeStyles.rail} relative overflow-visible`;
|
|
2759
|
-
return /* @__PURE__ */
|
|
3061
|
+
return /* @__PURE__ */ jsxs14(
|
|
2760
3062
|
"div",
|
|
2761
3063
|
{
|
|
2762
3064
|
className: `${containerClasses} ${className}`,
|
|
2763
3065
|
style: isVertical ? { minHeight: "200px", height: "200px" } : void 0,
|
|
2764
3066
|
children: [
|
|
2765
|
-
/* @__PURE__ */
|
|
3067
|
+
/* @__PURE__ */ jsxs14(
|
|
2766
3068
|
"div",
|
|
2767
3069
|
{
|
|
2768
3070
|
ref: sliderRef,
|
|
@@ -2780,13 +3082,13 @@ var Slider = ({
|
|
|
2780
3082
|
"aria-orientation": orientation,
|
|
2781
3083
|
tabIndex: disabled ? -1 : 0,
|
|
2782
3084
|
children: [
|
|
2783
|
-
/* @__PURE__ */
|
|
3085
|
+
/* @__PURE__ */ jsx15(
|
|
2784
3086
|
"div",
|
|
2785
3087
|
{
|
|
2786
3088
|
className: `absolute ${isVertical ? "inset-x-0 h-full" : "inset-y-0 w-full"} bg-[#d1d5db] rounded-full ${disabled ? "opacity-50" : ""} z-0`
|
|
2787
3089
|
}
|
|
2788
3090
|
),
|
|
2789
|
-
track !== false && /* @__PURE__ */
|
|
3091
|
+
track !== false && /* @__PURE__ */ jsx15(
|
|
2790
3092
|
"div",
|
|
2791
3093
|
{
|
|
2792
3094
|
className: `absolute ${isVertical ? "inset-x-0" : "inset-y-0"} ${currentColorStyles.track} rounded-full ${disabled ? "opacity-50" : ""} z-0`,
|
|
@@ -2809,32 +3111,32 @@ var Slider = ({
|
|
|
2809
3111
|
}
|
|
2810
3112
|
const markColor = isInSelectedRange ? "bg-(--color-background) shadow-sm group-hover/mark:bg-(--color-background) group-hover/mark:shadow-md" : "bg-[#4b5563] group-hover/mark:bg-[#1f2937]";
|
|
2811
3113
|
const labelColor = isInSelectedRange ? currentColorStyles.labelSelected : currentColorStyles.labelUnselected;
|
|
2812
|
-
return /* @__PURE__ */
|
|
3114
|
+
return /* @__PURE__ */ jsxs14(
|
|
2813
3115
|
"div",
|
|
2814
3116
|
{
|
|
2815
3117
|
className: `group/mark absolute ${isVertical ? "left-1/2 -translate-x-1/2" : "top-1/2 -translate-y-1/2"} z-30`,
|
|
2816
3118
|
style: markStyle,
|
|
2817
3119
|
children: [
|
|
2818
|
-
/* @__PURE__ */
|
|
3120
|
+
/* @__PURE__ */ jsx15(
|
|
2819
3121
|
"div",
|
|
2820
3122
|
{
|
|
2821
3123
|
className: `absolute left-0 top-0 -translate-x-1/2 -translate-y-1/2 w-1.5 h-1.5 ${markColor} rounded-full transition-all duration-200 cursor-pointer group-hover/mark:w-2 group-hover/mark:h-2 ${!disabled ? "" : "cursor-not-allowed"}`
|
|
2822
3124
|
}
|
|
2823
3125
|
),
|
|
2824
|
-
mark.label && /* @__PURE__ */
|
|
3126
|
+
mark.label && /* @__PURE__ */ jsx15(
|
|
2825
3127
|
"div",
|
|
2826
3128
|
{
|
|
2827
3129
|
className: `absolute ${isVertical ? "left-4 top-1/2 -translate-y-1/2" : "top-3 left-1/2 -translate-x-1/2"} text-caption font-medium ${labelColor} transition-colors duration-200 whitespace-nowrap pointer-events-none z-(--z-index-base)`,
|
|
2828
3130
|
children: mark.label
|
|
2829
3131
|
}
|
|
2830
3132
|
),
|
|
2831
|
-
showMarkLabelsOnHover && !mark.label && /* @__PURE__ */
|
|
3133
|
+
showMarkLabelsOnHover && !mark.label && /* @__PURE__ */ jsxs14(
|
|
2832
3134
|
"div",
|
|
2833
3135
|
{
|
|
2834
3136
|
className: `absolute ${isVertical ? "left-6 top-1/2 -translate-y-1/2" : "-top-8 left-1/2 -translate-x-1/2"} px-2 py-1 text-caption font-semibold text-white ${color === "primary" ? "bg-(--color-primary)" : "bg-purple-500"} rounded shadow-lg whitespace-nowrap opacity-0 scale-90 group-hover/mark:opacity-100 group-hover/mark:scale-100 transition-all duration-300 ease-out pointer-events-none z-(--z-index-tooltip)`,
|
|
2835
3137
|
children: [
|
|
2836
3138
|
valueLabelFormat(mark.value),
|
|
2837
|
-
/* @__PURE__ */
|
|
3139
|
+
/* @__PURE__ */ jsx15(
|
|
2838
3140
|
"div",
|
|
2839
3141
|
{
|
|
2840
3142
|
className: `absolute ${isVertical ? "right-full top-1/2 -translate-y-1/2 border-y-4 border-y-transparent border-r-4" : "top-full left-1/2 -translate-x-1/2 border-x-4 border-x-transparent border-t-4"} ${color === "primary" ? isVertical ? "border-r-[var(--color-primary)]" : "border-t-[var(--color-primary)]" : isVertical ? "border-r-purple-500" : "border-t-purple-500"}`
|
|
@@ -2852,7 +3154,7 @@ var Slider = ({
|
|
|
2852
3154
|
]
|
|
2853
3155
|
}
|
|
2854
3156
|
),
|
|
2855
|
-
name && /* @__PURE__ */
|
|
3157
|
+
name && /* @__PURE__ */ jsx15(
|
|
2856
3158
|
"input",
|
|
2857
3159
|
{
|
|
2858
3160
|
type: "hidden",
|
|
@@ -2867,8 +3169,8 @@ var Slider = ({
|
|
|
2867
3169
|
};
|
|
2868
3170
|
|
|
2869
3171
|
// src/ui/switch.tsx
|
|
2870
|
-
import { useState as
|
|
2871
|
-
import { Fragment as Fragment2, jsx as
|
|
3172
|
+
import { useState as useState10, useEffect as useEffect7 } from "react";
|
|
3173
|
+
import { Fragment as Fragment2, jsx as jsx16, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
2872
3174
|
function Switch({
|
|
2873
3175
|
checked: controlledChecked,
|
|
2874
3176
|
onChange,
|
|
@@ -2884,7 +3186,7 @@ function Switch({
|
|
|
2884
3186
|
errorMessage
|
|
2885
3187
|
}) {
|
|
2886
3188
|
const form = useForm();
|
|
2887
|
-
const [internalChecked, setInternalChecked] =
|
|
3189
|
+
const [internalChecked, setInternalChecked] = useState10(false);
|
|
2888
3190
|
let checked;
|
|
2889
3191
|
if (form && name) {
|
|
2890
3192
|
checked = form.values[name] ?? controlledChecked ?? false;
|
|
@@ -2892,7 +3194,7 @@ function Switch({
|
|
|
2892
3194
|
const isControlled = controlledChecked !== void 0;
|
|
2893
3195
|
checked = isControlled ? controlledChecked : internalChecked;
|
|
2894
3196
|
}
|
|
2895
|
-
|
|
3197
|
+
useEffect7(() => {
|
|
2896
3198
|
if (form && name) {
|
|
2897
3199
|
const validator = async (val) => {
|
|
2898
3200
|
if (required && !val) {
|
|
@@ -2965,7 +3267,7 @@ function Switch({
|
|
|
2965
3267
|
top: "gap-2",
|
|
2966
3268
|
bottom: "gap-2"
|
|
2967
3269
|
};
|
|
2968
|
-
const switchElement = /* @__PURE__ */
|
|
3270
|
+
const switchElement = /* @__PURE__ */ jsx16(
|
|
2969
3271
|
"button",
|
|
2970
3272
|
{
|
|
2971
3273
|
type: "button",
|
|
@@ -2982,7 +3284,7 @@ function Switch({
|
|
|
2982
3284
|
disabled ? "opacity-50 cursor-not-allowed" : "cursor-pointer hover:opacity-90",
|
|
2983
3285
|
checked && !disabled && "focus:ring-blue-500"
|
|
2984
3286
|
),
|
|
2985
|
-
children: /* @__PURE__ */
|
|
3287
|
+
children: /* @__PURE__ */ jsx16(
|
|
2986
3288
|
"span",
|
|
2987
3289
|
{
|
|
2988
3290
|
className: cn(
|
|
@@ -2995,9 +3297,9 @@ function Switch({
|
|
|
2995
3297
|
)
|
|
2996
3298
|
}
|
|
2997
3299
|
);
|
|
2998
|
-
const content = !label ? /* @__PURE__ */
|
|
3300
|
+
const content = !label ? /* @__PURE__ */ jsxs15(Fragment2, { children: [
|
|
2999
3301
|
switchElement,
|
|
3000
|
-
name && /* @__PURE__ */
|
|
3302
|
+
name && /* @__PURE__ */ jsx16(
|
|
3001
3303
|
"input",
|
|
3002
3304
|
{
|
|
3003
3305
|
type: "checkbox",
|
|
@@ -3009,7 +3311,7 @@ function Switch({
|
|
|
3009
3311
|
required
|
|
3010
3312
|
}
|
|
3011
3313
|
)
|
|
3012
|
-
] }) : /* @__PURE__ */
|
|
3314
|
+
] }) : /* @__PURE__ */ jsxs15(
|
|
3013
3315
|
"label",
|
|
3014
3316
|
{
|
|
3015
3317
|
className: cn(
|
|
@@ -3020,7 +3322,7 @@ function Switch({
|
|
|
3020
3322
|
),
|
|
3021
3323
|
children: [
|
|
3022
3324
|
switchElement,
|
|
3023
|
-
/* @__PURE__ */
|
|
3325
|
+
/* @__PURE__ */ jsxs15(
|
|
3024
3326
|
"span",
|
|
3025
3327
|
{
|
|
3026
3328
|
className: cn(
|
|
@@ -3030,11 +3332,11 @@ function Switch({
|
|
|
3030
3332
|
style: !disabled ? { color: "var(--color-muted-foreground)" } : void 0,
|
|
3031
3333
|
children: [
|
|
3032
3334
|
label,
|
|
3033
|
-
required && /* @__PURE__ */
|
|
3335
|
+
required && /* @__PURE__ */ jsx16("span", { className: "ml-1", children: "*" })
|
|
3034
3336
|
]
|
|
3035
3337
|
}
|
|
3036
3338
|
),
|
|
3037
|
-
name && /* @__PURE__ */
|
|
3339
|
+
name && /* @__PURE__ */ jsx16(
|
|
3038
3340
|
"input",
|
|
3039
3341
|
{
|
|
3040
3342
|
type: "checkbox",
|
|
@@ -3049,7 +3351,7 @@ function Switch({
|
|
|
3049
3351
|
]
|
|
3050
3352
|
}
|
|
3051
3353
|
);
|
|
3052
|
-
return /* @__PURE__ */
|
|
3354
|
+
return /* @__PURE__ */ jsx16(
|
|
3053
3355
|
"div",
|
|
3054
3356
|
{
|
|
3055
3357
|
className,
|
|
@@ -3062,8 +3364,8 @@ function Switch({
|
|
|
3062
3364
|
}
|
|
3063
3365
|
|
|
3064
3366
|
// src/ui/dialog.tsx
|
|
3065
|
-
import
|
|
3066
|
-
import { jsx as
|
|
3367
|
+
import React10, { useEffect as useEffect8 } from "react";
|
|
3368
|
+
import { jsx as jsx17, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
3067
3369
|
var Dialog = ({
|
|
3068
3370
|
open,
|
|
3069
3371
|
onClose,
|
|
@@ -3074,7 +3376,7 @@ var Dialog = ({
|
|
|
3074
3376
|
closeOnEscape = true,
|
|
3075
3377
|
children
|
|
3076
3378
|
}) => {
|
|
3077
|
-
|
|
3379
|
+
useEffect8(() => {
|
|
3078
3380
|
if (!open || !closeOnEscape) return;
|
|
3079
3381
|
const handleEscape = (e) => {
|
|
3080
3382
|
if (e.key === "Escape") {
|
|
@@ -3084,7 +3386,7 @@ var Dialog = ({
|
|
|
3084
3386
|
document.addEventListener("keydown", handleEscape);
|
|
3085
3387
|
return () => document.removeEventListener("keydown", handleEscape);
|
|
3086
3388
|
}, [open, closeOnEscape, onClose]);
|
|
3087
|
-
|
|
3389
|
+
useEffect8(() => {
|
|
3088
3390
|
if (open) {
|
|
3089
3391
|
document.body.style.overflow = "hidden";
|
|
3090
3392
|
} else {
|
|
@@ -3114,14 +3416,14 @@ var Dialog = ({
|
|
|
3114
3416
|
onClose();
|
|
3115
3417
|
}
|
|
3116
3418
|
};
|
|
3117
|
-
return /* @__PURE__ */
|
|
3419
|
+
return /* @__PURE__ */ jsx17(
|
|
3118
3420
|
"div",
|
|
3119
3421
|
{
|
|
3120
3422
|
className: "fixed inset-0 [z-index:var(--z-index-modal)] flex items-center justify-center p-4 bg-black/50 backdrop-blur-sm animate-in fade-in duration-200",
|
|
3121
3423
|
onClick: handleBackdropClick,
|
|
3122
3424
|
role: "dialog",
|
|
3123
3425
|
"aria-modal": "true",
|
|
3124
|
-
children: /* @__PURE__ */
|
|
3426
|
+
children: /* @__PURE__ */ jsxs16(
|
|
3125
3427
|
"div",
|
|
3126
3428
|
{
|
|
3127
3429
|
className: cn(
|
|
@@ -3129,7 +3431,7 @@ var Dialog = ({
|
|
|
3129
3431
|
sizes[size]
|
|
3130
3432
|
),
|
|
3131
3433
|
children: [
|
|
3132
|
-
showCloseButton && /* @__PURE__ */
|
|
3434
|
+
showCloseButton && /* @__PURE__ */ jsx17(
|
|
3133
3435
|
"button",
|
|
3134
3436
|
{
|
|
3135
3437
|
onClick: onClose,
|
|
@@ -3172,14 +3474,14 @@ var Dialog = ({
|
|
|
3172
3474
|
},
|
|
3173
3475
|
className: "absolute right-2 top-2 p-1.5 rounded-full [z-index:var(--z-index-base)] focus:outline-none",
|
|
3174
3476
|
"aria-label": "Close dialog",
|
|
3175
|
-
children: /* @__PURE__ */
|
|
3477
|
+
children: /* @__PURE__ */ jsx17(
|
|
3176
3478
|
"svg",
|
|
3177
3479
|
{
|
|
3178
3480
|
className: "w-5 h-5",
|
|
3179
3481
|
fill: "none",
|
|
3180
3482
|
stroke: "currentColor",
|
|
3181
3483
|
viewBox: "0 0 24 24",
|
|
3182
|
-
children: /* @__PURE__ */
|
|
3484
|
+
children: /* @__PURE__ */ jsx17(
|
|
3183
3485
|
"path",
|
|
3184
3486
|
{
|
|
3185
3487
|
strokeLinecap: "round",
|
|
@@ -3192,7 +3494,7 @@ var Dialog = ({
|
|
|
3192
3494
|
)
|
|
3193
3495
|
}
|
|
3194
3496
|
),
|
|
3195
|
-
/* @__PURE__ */
|
|
3497
|
+
/* @__PURE__ */ jsx17(DialogContext.Provider, { value: { variant }, children })
|
|
3196
3498
|
]
|
|
3197
3499
|
}
|
|
3198
3500
|
)
|
|
@@ -3200,9 +3502,9 @@ var Dialog = ({
|
|
|
3200
3502
|
);
|
|
3201
3503
|
};
|
|
3202
3504
|
Dialog.displayName = "Dialog";
|
|
3203
|
-
var DialogContext =
|
|
3204
|
-
var DialogHeader =
|
|
3205
|
-
const { variant } =
|
|
3505
|
+
var DialogContext = React10.createContext({ variant: "default" });
|
|
3506
|
+
var DialogHeader = React10.forwardRef(({ className, children, ...props }, ref) => {
|
|
3507
|
+
const { variant } = React10.useContext(DialogContext);
|
|
3206
3508
|
const variantStyles = {
|
|
3207
3509
|
default: {
|
|
3208
3510
|
backgroundColor: "var(--color-background)",
|
|
@@ -3225,7 +3527,7 @@ var DialogHeader = React9.forwardRef(({ className, children, ...props }, ref) =>
|
|
|
3225
3527
|
borderColor: "var(--color-error-border)"
|
|
3226
3528
|
}
|
|
3227
3529
|
};
|
|
3228
|
-
return /* @__PURE__ */
|
|
3530
|
+
return /* @__PURE__ */ jsx17(
|
|
3229
3531
|
"div",
|
|
3230
3532
|
{
|
|
3231
3533
|
ref,
|
|
@@ -3240,7 +3542,7 @@ var DialogHeader = React9.forwardRef(({ className, children, ...props }, ref) =>
|
|
|
3240
3542
|
);
|
|
3241
3543
|
});
|
|
3242
3544
|
DialogHeader.displayName = "DialogHeader";
|
|
3243
|
-
var DialogTitle =
|
|
3545
|
+
var DialogTitle = React10.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsx17(
|
|
3244
3546
|
"h2",
|
|
3245
3547
|
{
|
|
3246
3548
|
ref,
|
|
@@ -3253,7 +3555,7 @@ var DialogTitle = React9.forwardRef(({ className, children, ...props }, ref) =>
|
|
|
3253
3555
|
}
|
|
3254
3556
|
));
|
|
3255
3557
|
DialogTitle.displayName = "DialogTitle";
|
|
3256
|
-
var DialogDescription =
|
|
3558
|
+
var DialogDescription = React10.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsx17(
|
|
3257
3559
|
"p",
|
|
3258
3560
|
{
|
|
3259
3561
|
ref,
|
|
@@ -3263,9 +3565,9 @@ var DialogDescription = React9.forwardRef(({ className, children, ...props }, re
|
|
|
3263
3565
|
}
|
|
3264
3566
|
));
|
|
3265
3567
|
DialogDescription.displayName = "DialogDescription";
|
|
3266
|
-
var DialogContent =
|
|
3568
|
+
var DialogContent = React10.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsx17("div", { ref, className: cn("px-6 py-4", className), ...props, children }));
|
|
3267
3569
|
DialogContent.displayName = "DialogContent";
|
|
3268
|
-
var DialogFooter =
|
|
3570
|
+
var DialogFooter = React10.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsx17(
|
|
3269
3571
|
"div",
|
|
3270
3572
|
{
|
|
3271
3573
|
ref,
|
|
@@ -3280,9 +3582,9 @@ var DialogFooter = React9.forwardRef(({ className, children, ...props }, ref) =>
|
|
|
3280
3582
|
DialogFooter.displayName = "DialogFooter";
|
|
3281
3583
|
|
|
3282
3584
|
// src/feedback/alert.tsx
|
|
3283
|
-
import
|
|
3284
|
-
import { jsx as
|
|
3285
|
-
var Alert =
|
|
3585
|
+
import React11 from "react";
|
|
3586
|
+
import { jsx as jsx18, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
3587
|
+
var Alert = React11.forwardRef(
|
|
3286
3588
|
({
|
|
3287
3589
|
className,
|
|
3288
3590
|
variant = "info",
|
|
@@ -3322,7 +3624,7 @@ var Alert = React10.forwardRef(
|
|
|
3322
3624
|
error: { color: "var(--color-error-border)" }
|
|
3323
3625
|
};
|
|
3324
3626
|
const defaultIcons = {
|
|
3325
|
-
info: /* @__PURE__ */
|
|
3627
|
+
info: /* @__PURE__ */ jsx18("svg", { className: "w-5 h-5", fill: "currentColor", viewBox: "0 0 20 20", children: /* @__PURE__ */ jsx18(
|
|
3326
3628
|
"path",
|
|
3327
3629
|
{
|
|
3328
3630
|
fillRule: "evenodd",
|
|
@@ -3330,7 +3632,7 @@ var Alert = React10.forwardRef(
|
|
|
3330
3632
|
clipRule: "evenodd"
|
|
3331
3633
|
}
|
|
3332
3634
|
) }),
|
|
3333
|
-
success: /* @__PURE__ */
|
|
3635
|
+
success: /* @__PURE__ */ jsx18("svg", { className: "w-5 h-5", fill: "currentColor", viewBox: "0 0 20 20", children: /* @__PURE__ */ jsx18(
|
|
3334
3636
|
"path",
|
|
3335
3637
|
{
|
|
3336
3638
|
fillRule: "evenodd",
|
|
@@ -3338,7 +3640,7 @@ var Alert = React10.forwardRef(
|
|
|
3338
3640
|
clipRule: "evenodd"
|
|
3339
3641
|
}
|
|
3340
3642
|
) }),
|
|
3341
|
-
warning: /* @__PURE__ */
|
|
3643
|
+
warning: /* @__PURE__ */ jsx18("svg", { className: "w-5 h-5", fill: "currentColor", viewBox: "0 0 20 20", children: /* @__PURE__ */ jsx18(
|
|
3342
3644
|
"path",
|
|
3343
3645
|
{
|
|
3344
3646
|
fillRule: "evenodd",
|
|
@@ -3346,7 +3648,7 @@ var Alert = React10.forwardRef(
|
|
|
3346
3648
|
clipRule: "evenodd"
|
|
3347
3649
|
}
|
|
3348
3650
|
) }),
|
|
3349
|
-
error: /* @__PURE__ */
|
|
3651
|
+
error: /* @__PURE__ */ jsx18("svg", { className: "w-5 h-5", fill: "currentColor", viewBox: "0 0 20 20", children: /* @__PURE__ */ jsx18(
|
|
3350
3652
|
"path",
|
|
3351
3653
|
{
|
|
3352
3654
|
fillRule: "evenodd",
|
|
@@ -3355,7 +3657,7 @@ var Alert = React10.forwardRef(
|
|
|
3355
3657
|
}
|
|
3356
3658
|
) })
|
|
3357
3659
|
};
|
|
3358
|
-
return /* @__PURE__ */
|
|
3660
|
+
return /* @__PURE__ */ jsx18(
|
|
3359
3661
|
"div",
|
|
3360
3662
|
{
|
|
3361
3663
|
ref,
|
|
@@ -3363,13 +3665,13 @@ var Alert = React10.forwardRef(
|
|
|
3363
3665
|
className: cn("relative border rounded-lg p-4", className),
|
|
3364
3666
|
role: "alert",
|
|
3365
3667
|
...props,
|
|
3366
|
-
children: /* @__PURE__ */
|
|
3367
|
-
/* @__PURE__ */
|
|
3368
|
-
/* @__PURE__ */
|
|
3369
|
-
title && /* @__PURE__ */
|
|
3370
|
-
/* @__PURE__ */
|
|
3668
|
+
children: /* @__PURE__ */ jsxs17("div", { className: "flex items-start gap-3", children: [
|
|
3669
|
+
/* @__PURE__ */ jsx18("div", { className: "shrink-0", style: iconStyles[variant], children: icon || defaultIcons[variant] }),
|
|
3670
|
+
/* @__PURE__ */ jsxs17("div", { className: "flex-1", children: [
|
|
3671
|
+
title && /* @__PURE__ */ jsx18("h5", { className: "font-semibold mb-1", children: title }),
|
|
3672
|
+
/* @__PURE__ */ jsx18("div", { className: "text-sm", children })
|
|
3371
3673
|
] }),
|
|
3372
|
-
dismissible && onDismiss && /* @__PURE__ */
|
|
3674
|
+
dismissible && onDismiss && /* @__PURE__ */ jsx18(
|
|
3373
3675
|
"button",
|
|
3374
3676
|
{
|
|
3375
3677
|
type: "button",
|
|
@@ -3403,7 +3705,7 @@ var Alert = React10.forwardRef(
|
|
|
3403
3705
|
},
|
|
3404
3706
|
className: "shrink-0 rounded-lg p-1.5 inline-flex focus:outline-none",
|
|
3405
3707
|
"aria-label": "Close",
|
|
3406
|
-
children: /* @__PURE__ */
|
|
3708
|
+
children: /* @__PURE__ */ jsx18("svg", { className: "w-4 h-4", fill: "currentColor", viewBox: "0 0 20 20", children: /* @__PURE__ */ jsx18(
|
|
3407
3709
|
"path",
|
|
3408
3710
|
{
|
|
3409
3711
|
fillRule: "evenodd",
|
|
@@ -3421,9 +3723,9 @@ var Alert = React10.forwardRef(
|
|
|
3421
3723
|
Alert.displayName = "Alert";
|
|
3422
3724
|
|
|
3423
3725
|
// src/layout/container.tsx
|
|
3424
|
-
import
|
|
3425
|
-
import { jsx as
|
|
3426
|
-
var Container =
|
|
3726
|
+
import React12 from "react";
|
|
3727
|
+
import { jsx as jsx19 } from "react/jsx-runtime";
|
|
3728
|
+
var Container = React12.forwardRef(
|
|
3427
3729
|
({
|
|
3428
3730
|
className,
|
|
3429
3731
|
maxWidth = "xl",
|
|
@@ -3440,7 +3742,7 @@ var Container = React11.forwardRef(
|
|
|
3440
3742
|
"2xl": "max-w-screen-2xl",
|
|
3441
3743
|
full: "max-w-full"
|
|
3442
3744
|
};
|
|
3443
|
-
return /* @__PURE__ */
|
|
3745
|
+
return /* @__PURE__ */ jsx19(
|
|
3444
3746
|
"div",
|
|
3445
3747
|
{
|
|
3446
3748
|
ref,
|
|
@@ -3460,32 +3762,32 @@ var Container = React11.forwardRef(
|
|
|
3460
3762
|
Container.displayName = "Container";
|
|
3461
3763
|
|
|
3462
3764
|
// src/layout/section-layout.tsx
|
|
3463
|
-
import
|
|
3464
|
-
import { Fragment as Fragment3, jsx as
|
|
3765
|
+
import React13 from "react";
|
|
3766
|
+
import { Fragment as Fragment3, jsx as jsx20, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
3465
3767
|
function SectionLayout({
|
|
3466
3768
|
children,
|
|
3467
3769
|
hasStickyPreview = false
|
|
3468
3770
|
}) {
|
|
3469
3771
|
if (!hasStickyPreview) {
|
|
3470
|
-
return /* @__PURE__ */
|
|
3772
|
+
return /* @__PURE__ */ jsx20(Fragment3, { children });
|
|
3471
3773
|
}
|
|
3472
|
-
const childArray =
|
|
3774
|
+
const childArray = React13.Children.toArray(children);
|
|
3473
3775
|
if (childArray.length === 0) {
|
|
3474
3776
|
return null;
|
|
3475
3777
|
}
|
|
3476
3778
|
const stickyPreview = childArray[0];
|
|
3477
3779
|
const scrollableContent = childArray.slice(1);
|
|
3478
|
-
return /* @__PURE__ */
|
|
3780
|
+
return /* @__PURE__ */ jsxs18(Fragment3, { children: [
|
|
3479
3781
|
stickyPreview,
|
|
3480
|
-
scrollableContent.length > 0 && /* @__PURE__ */
|
|
3782
|
+
scrollableContent.length > 0 && /* @__PURE__ */ jsx20("div", { className: "space-y-8", children: scrollableContent })
|
|
3481
3783
|
] });
|
|
3482
3784
|
}
|
|
3483
3785
|
|
|
3484
3786
|
// src/layout/nav.tsx
|
|
3485
3787
|
import { Menu, X as X2, ChevronDown as ChevronDown2 } from "lucide-react";
|
|
3486
|
-
import
|
|
3487
|
-
import { Fragment as Fragment4, jsx as
|
|
3488
|
-
var Nav =
|
|
3788
|
+
import React14, { useState as useState11, useEffect as useEffect9, useRef as useRef7 } from "react";
|
|
3789
|
+
import { Fragment as Fragment4, jsx as jsx21, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
3790
|
+
var Nav = React14.forwardRef(
|
|
3489
3791
|
({
|
|
3490
3792
|
className,
|
|
3491
3793
|
items,
|
|
@@ -3499,16 +3801,42 @@ var Nav = React13.forwardRef(
|
|
|
3499
3801
|
sticky = false,
|
|
3500
3802
|
activeId,
|
|
3501
3803
|
onItemClick,
|
|
3502
|
-
|
|
3804
|
+
borderless = false,
|
|
3805
|
+
transparent = false,
|
|
3806
|
+
blur = false,
|
|
3807
|
+
position = "static",
|
|
3808
|
+
autoHideOnScroll = false,
|
|
3809
|
+
...htmlProps
|
|
3503
3810
|
}, ref) => {
|
|
3504
|
-
const [isMobileMenuOpen, setIsMobileMenuOpen] =
|
|
3505
|
-
const [openDropdownId, setOpenDropdownId] =
|
|
3811
|
+
const [isMobileMenuOpen, setIsMobileMenuOpen] = useState11(false);
|
|
3812
|
+
const [openDropdownId, setOpenDropdownId] = useState11(
|
|
3506
3813
|
null
|
|
3507
3814
|
);
|
|
3508
|
-
const dropdownRef =
|
|
3509
|
-
const mobileMenuRef =
|
|
3510
|
-
const [navElement, setNavElement] =
|
|
3511
|
-
|
|
3815
|
+
const dropdownRef = useRef7(null);
|
|
3816
|
+
const mobileMenuRef = useRef7(null);
|
|
3817
|
+
const [navElement, setNavElement] = useState11(null);
|
|
3818
|
+
const [isNavVisible, setIsNavVisible] = useState11(true);
|
|
3819
|
+
const [lastScrollY, setLastScrollY] = useState11(0);
|
|
3820
|
+
useEffect9(() => {
|
|
3821
|
+
if (!autoHideOnScroll || position === "static") {
|
|
3822
|
+
setIsNavVisible(true);
|
|
3823
|
+
return;
|
|
3824
|
+
}
|
|
3825
|
+
const handleScroll = () => {
|
|
3826
|
+
const currentScrollY = window.scrollY;
|
|
3827
|
+
if (currentScrollY < 10) {
|
|
3828
|
+
setIsNavVisible(true);
|
|
3829
|
+
} else if (currentScrollY > lastScrollY) {
|
|
3830
|
+
setIsNavVisible(false);
|
|
3831
|
+
} else {
|
|
3832
|
+
setIsNavVisible(true);
|
|
3833
|
+
}
|
|
3834
|
+
setLastScrollY(currentScrollY);
|
|
3835
|
+
};
|
|
3836
|
+
window.addEventListener("scroll", handleScroll, { passive: true });
|
|
3837
|
+
return () => window.removeEventListener("scroll", handleScroll);
|
|
3838
|
+
}, [lastScrollY, autoHideOnScroll, position]);
|
|
3839
|
+
useEffect9(() => {
|
|
3512
3840
|
function handleClickOutside(event) {
|
|
3513
3841
|
if (dropdownRef.current && !dropdownRef.current.contains(event.target)) {
|
|
3514
3842
|
setOpenDropdownId(null);
|
|
@@ -3522,7 +3850,7 @@ var Nav = React13.forwardRef(
|
|
|
3522
3850
|
document.removeEventListener("mousedown", handleClickOutside);
|
|
3523
3851
|
};
|
|
3524
3852
|
}, [isMobileMenuOpen, mobileMenuDirection]);
|
|
3525
|
-
|
|
3853
|
+
useEffect9(() => {
|
|
3526
3854
|
function handleEscape(event) {
|
|
3527
3855
|
if (event.key === "Escape") {
|
|
3528
3856
|
setIsMobileMenuOpen(false);
|
|
@@ -3534,12 +3862,24 @@ var Nav = React13.forwardRef(
|
|
|
3534
3862
|
document.removeEventListener("keydown", handleEscape);
|
|
3535
3863
|
};
|
|
3536
3864
|
}, []);
|
|
3537
|
-
|
|
3865
|
+
useEffect9(() => {
|
|
3538
3866
|
setIsMobileMenuOpen(false);
|
|
3539
3867
|
}, [mobileMenuDirection]);
|
|
3868
|
+
const positionClass = position === "static" ? "" : position === "fixed" ? "fixed" : "sticky";
|
|
3869
|
+
const transformClass = autoHideOnScroll && position !== "static" ? `transition-transform duration-500 ease-in-out ${isNavVisible ? "translate-y-0" : "-translate-y-full"}` : "";
|
|
3870
|
+
const hasCustomPositioning = className?.match(/(left-|right-|inset-)/);
|
|
3540
3871
|
const baseStyles = cn(
|
|
3541
|
-
|
|
3542
|
-
|
|
3872
|
+
// Position
|
|
3873
|
+
positionClass && `${positionClass} [z-index:var(--z-index-nav)]`,
|
|
3874
|
+
// Default positioning only if not custom
|
|
3875
|
+
positionClass && !hasCustomPositioning && "top-0 left-0 right-0",
|
|
3876
|
+
// Transform for auto-hide
|
|
3877
|
+
transformClass,
|
|
3878
|
+
// Background
|
|
3879
|
+
!transparent && !blur && "bg-(--color-background)",
|
|
3880
|
+
transparent && "bg-transparent",
|
|
3881
|
+
// Blur effect (glassmorphism)
|
|
3882
|
+
blur && "backdrop-blur-md bg-transparent"
|
|
3543
3883
|
);
|
|
3544
3884
|
const containerStyles = cn(
|
|
3545
3885
|
"min-h-14 md:min-h-16",
|
|
@@ -3597,7 +3937,7 @@ var Nav = React13.forwardRef(
|
|
|
3597
3937
|
};
|
|
3598
3938
|
const renderNavItem = (item, isMobile = false) => {
|
|
3599
3939
|
if (item.type === "divider") {
|
|
3600
|
-
return /* @__PURE__ */
|
|
3940
|
+
return /* @__PURE__ */ jsx21(
|
|
3601
3941
|
"div",
|
|
3602
3942
|
{
|
|
3603
3943
|
className: cn(
|
|
@@ -3609,7 +3949,7 @@ var Nav = React13.forwardRef(
|
|
|
3609
3949
|
);
|
|
3610
3950
|
}
|
|
3611
3951
|
if (item.type === "custom" && item.render) {
|
|
3612
|
-
return /* @__PURE__ */
|
|
3952
|
+
return /* @__PURE__ */ jsx21("div", { children: item.render() }, item.id);
|
|
3613
3953
|
}
|
|
3614
3954
|
const isActive = activeId === item.id;
|
|
3615
3955
|
const isDropdownOpen = openDropdownId === item.id;
|
|
@@ -3623,11 +3963,11 @@ var Nav = React13.forwardRef(
|
|
|
3623
3963
|
orientation === "vertical" && "w-full",
|
|
3624
3964
|
item.disabled && "opacity-50 cursor-not-allowed"
|
|
3625
3965
|
);
|
|
3626
|
-
const content = /* @__PURE__ */
|
|
3627
|
-
item.icon && /* @__PURE__ */
|
|
3628
|
-
/* @__PURE__ */
|
|
3629
|
-
item.badge && /* @__PURE__ */
|
|
3630
|
-
hasChildren && /* @__PURE__ */
|
|
3966
|
+
const content = /* @__PURE__ */ jsxs19(Fragment4, { children: [
|
|
3967
|
+
item.icon && /* @__PURE__ */ jsx21("span", { className: "flex-shrink-0", children: item.icon }),
|
|
3968
|
+
/* @__PURE__ */ jsx21("span", { children: item.label }),
|
|
3969
|
+
item.badge && /* @__PURE__ */ jsx21("span", { className: "ml-auto inline-flex items-center rounded-full bg-(--color-primary) px-2 py-0.5 text-caption font-medium text-white", children: item.badge }),
|
|
3970
|
+
hasChildren && /* @__PURE__ */ jsx21(
|
|
3631
3971
|
ChevronDown2,
|
|
3632
3972
|
{
|
|
3633
3973
|
className: cn(
|
|
@@ -3638,8 +3978,8 @@ var Nav = React13.forwardRef(
|
|
|
3638
3978
|
)
|
|
3639
3979
|
] });
|
|
3640
3980
|
if (hasChildren) {
|
|
3641
|
-
return /* @__PURE__ */
|
|
3642
|
-
/* @__PURE__ */
|
|
3981
|
+
return /* @__PURE__ */ jsxs19("div", { className: "relative", ref: dropdownRef, children: [
|
|
3982
|
+
/* @__PURE__ */ jsx21(
|
|
3643
3983
|
"button",
|
|
3644
3984
|
{
|
|
3645
3985
|
onClick: () => handleItemClick(item),
|
|
@@ -3648,14 +3988,14 @@ var Nav = React13.forwardRef(
|
|
|
3648
3988
|
children: content
|
|
3649
3989
|
}
|
|
3650
3990
|
),
|
|
3651
|
-
isDropdownOpen && /* @__PURE__ */
|
|
3991
|
+
isDropdownOpen && /* @__PURE__ */ jsx21(
|
|
3652
3992
|
"div",
|
|
3653
3993
|
{
|
|
3654
3994
|
className: cn(
|
|
3655
3995
|
"absolute left-0 mt-[var(--nav-gap)] min-w-[200px] bg-(--color-background) border border-(--color-border) rounded-[var(--nav-border-radius)] shadow-xl [z-index:var(--z-index-dropdown)] animate-in fade-in-0 zoom-in-95 duration-200",
|
|
3656
3996
|
orientation === "vertical" && "left-full top-0 ml-2 mt-0"
|
|
3657
3997
|
),
|
|
3658
|
-
children: /* @__PURE__ */
|
|
3998
|
+
children: /* @__PURE__ */ jsx21("div", { className: "py-1", children: item.children.map((child) => /* @__PURE__ */ jsxs19(
|
|
3659
3999
|
"button",
|
|
3660
4000
|
{
|
|
3661
4001
|
onClick: () => handleItemClick(child),
|
|
@@ -3666,9 +4006,9 @@ var Nav = React13.forwardRef(
|
|
|
3666
4006
|
activeId === child.id && "bg-(--color-primary)/10 text-(--color-primary) [font-weight:var(--font-semibold)]"
|
|
3667
4007
|
),
|
|
3668
4008
|
children: [
|
|
3669
|
-
child.icon && /* @__PURE__ */
|
|
3670
|
-
/* @__PURE__ */
|
|
3671
|
-
child.badge && /* @__PURE__ */
|
|
4009
|
+
child.icon && /* @__PURE__ */ jsx21("span", { className: "flex-shrink-0", children: child.icon }),
|
|
4010
|
+
/* @__PURE__ */ jsx21("span", { children: child.label }),
|
|
4011
|
+
child.badge && /* @__PURE__ */ jsx21("span", { className: "ml-auto px-2 py-0.5 [font-size:var(--text-xs)] font-semibold bg-(--color-primary) text-white rounded-[var(--radius-full)]", children: child.badge })
|
|
3672
4012
|
]
|
|
3673
4013
|
},
|
|
3674
4014
|
child.id
|
|
@@ -3678,7 +4018,7 @@ var Nav = React13.forwardRef(
|
|
|
3678
4018
|
] }, item.id);
|
|
3679
4019
|
}
|
|
3680
4020
|
if (item.href) {
|
|
3681
|
-
return /* @__PURE__ */
|
|
4021
|
+
return /* @__PURE__ */ jsx21(
|
|
3682
4022
|
"a",
|
|
3683
4023
|
{
|
|
3684
4024
|
href: item.href,
|
|
@@ -3690,7 +4030,7 @@ var Nav = React13.forwardRef(
|
|
|
3690
4030
|
item.id
|
|
3691
4031
|
);
|
|
3692
4032
|
}
|
|
3693
|
-
return /* @__PURE__ */
|
|
4033
|
+
return /* @__PURE__ */ jsx21(
|
|
3694
4034
|
"button",
|
|
3695
4035
|
{
|
|
3696
4036
|
onClick: () => handleItemClick(item),
|
|
@@ -3701,7 +4041,7 @@ var Nav = React13.forwardRef(
|
|
|
3701
4041
|
item.id
|
|
3702
4042
|
);
|
|
3703
4043
|
};
|
|
3704
|
-
const desktopNav = /* @__PURE__ */
|
|
4044
|
+
const desktopNav = /* @__PURE__ */ jsx21(
|
|
3705
4045
|
"div",
|
|
3706
4046
|
{
|
|
3707
4047
|
className: cn(
|
|
@@ -3712,7 +4052,7 @@ var Nav = React13.forwardRef(
|
|
|
3712
4052
|
children: items.map((item) => renderNavItem(item))
|
|
3713
4053
|
}
|
|
3714
4054
|
);
|
|
3715
|
-
const setRefs =
|
|
4055
|
+
const setRefs = React14.useCallback(
|
|
3716
4056
|
(node) => {
|
|
3717
4057
|
setNavElement(node);
|
|
3718
4058
|
if (typeof ref === "function") {
|
|
@@ -3723,22 +4063,25 @@ var Nav = React13.forwardRef(
|
|
|
3723
4063
|
},
|
|
3724
4064
|
[ref]
|
|
3725
4065
|
);
|
|
3726
|
-
return /* @__PURE__ */
|
|
4066
|
+
return /* @__PURE__ */ jsxs19(
|
|
3727
4067
|
"nav",
|
|
3728
4068
|
{
|
|
3729
4069
|
ref: setRefs,
|
|
3730
4070
|
className: cn(
|
|
3731
4071
|
baseStyles,
|
|
3732
|
-
"relative
|
|
4072
|
+
"relative",
|
|
4073
|
+
// Border styles
|
|
4074
|
+
!borderless && "border border-(--color-border)",
|
|
4075
|
+
borderless && "border-0",
|
|
3733
4076
|
className
|
|
3734
4077
|
),
|
|
3735
|
-
...
|
|
4078
|
+
...htmlProps,
|
|
3736
4079
|
children: [
|
|
3737
|
-
/* @__PURE__ */
|
|
3738
|
-
logo && /* @__PURE__ */
|
|
4080
|
+
/* @__PURE__ */ jsxs19("div", { className: containerStyles, children: [
|
|
4081
|
+
logo && /* @__PURE__ */ jsx21("div", { className: "shrink-0", children: logo }),
|
|
3739
4082
|
desktopNav,
|
|
3740
|
-
actions && /* @__PURE__ */
|
|
3741
|
-
/* @__PURE__ */
|
|
4083
|
+
actions && /* @__PURE__ */ jsx21("div", { className: "shrink-0 flex items-center gap-2", children: actions }),
|
|
4084
|
+
/* @__PURE__ */ jsx21(
|
|
3742
4085
|
"button",
|
|
3743
4086
|
{
|
|
3744
4087
|
onClick: () => setIsMobileMenuOpen(!isMobileMenuOpen),
|
|
@@ -3747,11 +4090,11 @@ var Nav = React13.forwardRef(
|
|
|
3747
4090
|
breakpointClasses[mobileBreakpoint]
|
|
3748
4091
|
),
|
|
3749
4092
|
"aria-label": "Toggle menu",
|
|
3750
|
-
children: isMobileMenuOpen ? /* @__PURE__ */
|
|
4093
|
+
children: isMobileMenuOpen ? /* @__PURE__ */ jsx21(X2, { className: "w-6 h-6" }) : /* @__PURE__ */ jsx21(Menu, { className: "w-6 h-6" })
|
|
3751
4094
|
}
|
|
3752
4095
|
)
|
|
3753
4096
|
] }),
|
|
3754
|
-
mobileMenuDirection === "top" && /* @__PURE__ */
|
|
4097
|
+
mobileMenuDirection === "top" && /* @__PURE__ */ jsx21(
|
|
3755
4098
|
"div",
|
|
3756
4099
|
{
|
|
3757
4100
|
ref: mobileMenuRef,
|
|
@@ -3760,26 +4103,29 @@ var Nav = React13.forwardRef(
|
|
|
3760
4103
|
breakpointClasses[mobileBreakpoint],
|
|
3761
4104
|
isMobileMenuOpen ? "max-h-96 opacity-100 border-(--color-border)" : "max-h-0 opacity-0 border-transparent"
|
|
3762
4105
|
),
|
|
3763
|
-
children: /* @__PURE__ */
|
|
4106
|
+
children: /* @__PURE__ */ jsx21("div", { className: "space-y-1 px-2 py-2", children: items.map((item) => renderNavItem(item, true)) })
|
|
3764
4107
|
}
|
|
3765
4108
|
),
|
|
3766
|
-
mobileMenuDirection !== "top" && /* @__PURE__ */
|
|
3767
|
-
isMobileMenuOpen && /* @__PURE__ */
|
|
4109
|
+
mobileMenuDirection !== "top" && /* @__PURE__ */ jsxs19(Fragment4, { children: [
|
|
4110
|
+
isMobileMenuOpen && /* @__PURE__ */ jsx21(
|
|
3768
4111
|
"div",
|
|
3769
4112
|
{
|
|
3770
4113
|
className: cn(
|
|
3771
|
-
"fixed inset-0
|
|
4114
|
+
"fixed inset-0 [z-index:var(--z-index-nav-mobile-overlay)]",
|
|
3772
4115
|
breakpointClasses[mobileBreakpoint]
|
|
3773
4116
|
),
|
|
4117
|
+
style: {
|
|
4118
|
+
backgroundColor: "var(--overlay-background, rgba(0, 0, 0, 0.4))"
|
|
4119
|
+
},
|
|
3774
4120
|
onClick: () => setIsMobileMenuOpen(false)
|
|
3775
4121
|
}
|
|
3776
4122
|
),
|
|
3777
|
-
/* @__PURE__ */
|
|
4123
|
+
/* @__PURE__ */ jsx21(
|
|
3778
4124
|
"div",
|
|
3779
4125
|
{
|
|
3780
4126
|
ref: mobileMenuRef,
|
|
3781
4127
|
className: cn(
|
|
3782
|
-
"fixed top-0 bottom-0 w-64 bg-(--color-background) [z-index:var(--z-index-nav-mobile-menu)] overflow-y-auto transition-transform
|
|
4128
|
+
"fixed top-0 bottom-0 w-64 bg-(--color-background) [z-index:var(--z-index-nav-mobile-menu)] overflow-y-auto transition-transform ease-in-out shadow-lg",
|
|
3783
4129
|
breakpointClasses[mobileBreakpoint],
|
|
3784
4130
|
mobileMenuDirection === "left" && [
|
|
3785
4131
|
"left-0 border-r border-(--color-border)",
|
|
@@ -3791,7 +4137,10 @@ var Nav = React13.forwardRef(
|
|
|
3791
4137
|
],
|
|
3792
4138
|
!isMobileMenuOpen && "invisible"
|
|
3793
4139
|
),
|
|
3794
|
-
|
|
4140
|
+
style: {
|
|
4141
|
+
transitionDuration: "var(--transition-drawer-duration, 500ms)"
|
|
4142
|
+
},
|
|
4143
|
+
children: /* @__PURE__ */ jsx21("div", { className: "flex flex-col space-y-1 px-2 pt-2", children: items.map((item) => renderNavItem(item, true)) })
|
|
3795
4144
|
}
|
|
3796
4145
|
)
|
|
3797
4146
|
] })
|
|
@@ -3804,8 +4153,8 @@ Nav.displayName = "Nav";
|
|
|
3804
4153
|
|
|
3805
4154
|
// src/layout/drawer.tsx
|
|
3806
4155
|
import { Menu as Menu2, X as X3 } from "lucide-react";
|
|
3807
|
-
import { useState as
|
|
3808
|
-
import { Fragment as Fragment5, jsx as
|
|
4156
|
+
import { useState as useState12, useEffect as useEffect10 } from "react";
|
|
4157
|
+
import { Fragment as Fragment5, jsx as jsx22, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
3809
4158
|
function Drawer({
|
|
3810
4159
|
title,
|
|
3811
4160
|
subtitle,
|
|
@@ -3817,18 +4166,21 @@ function Drawer({
|
|
|
3817
4166
|
position = "right",
|
|
3818
4167
|
homeUrl,
|
|
3819
4168
|
autoHideOnScroll = true,
|
|
3820
|
-
headerActions
|
|
4169
|
+
headerActions,
|
|
4170
|
+
borderless = false,
|
|
4171
|
+
transparent = false,
|
|
4172
|
+
blur = false
|
|
3821
4173
|
}) {
|
|
3822
|
-
const [mobileMenuOpen, setMobileMenuOpen] =
|
|
3823
|
-
const [isHeaderVisible, setIsHeaderVisible] =
|
|
3824
|
-
const [lastScrollY, setLastScrollY] =
|
|
4174
|
+
const [mobileMenuOpen, setMobileMenuOpen] = useState12(false);
|
|
4175
|
+
const [isHeaderVisible, setIsHeaderVisible] = useState12(true);
|
|
4176
|
+
const [lastScrollY, setLastScrollY] = useState12(0);
|
|
3825
4177
|
const isLeft = position === "left";
|
|
3826
4178
|
const handleItemClick = (itemId) => {
|
|
3827
4179
|
onItemClick(itemId);
|
|
3828
4180
|
setMobileMenuOpen(false);
|
|
3829
4181
|
};
|
|
3830
4182
|
const useSections = sections || (items ? [{ title: "", items }] : []);
|
|
3831
|
-
|
|
4183
|
+
useEffect10(() => {
|
|
3832
4184
|
if (!autoHideOnScroll) {
|
|
3833
4185
|
setIsHeaderVisible(true);
|
|
3834
4186
|
return;
|
|
@@ -3847,22 +4199,23 @@ function Drawer({
|
|
|
3847
4199
|
window.addEventListener("scroll", handleScroll, { passive: true });
|
|
3848
4200
|
return () => window.removeEventListener("scroll", handleScroll);
|
|
3849
4201
|
}, [lastScrollY, autoHideOnScroll]);
|
|
3850
|
-
return /* @__PURE__ */
|
|
3851
|
-
/* @__PURE__ */
|
|
4202
|
+
return /* @__PURE__ */ jsxs20(Fragment5, { children: [
|
|
4203
|
+
/* @__PURE__ */ jsx22(
|
|
3852
4204
|
"div",
|
|
3853
4205
|
{
|
|
3854
|
-
className: `lg:hidden fixed top-0 left-0 right-0 px-4 py-3 z-(--z-index-drawer-header) transition-transform duration-500 ease-in-out ${isHeaderVisible ? "translate-y-0" : "-translate-y-full"}`,
|
|
4206
|
+
className: `lg:hidden fixed top-0 left-0 right-0 px-4 py-3 z-(--z-index-drawer-header) transition-transform duration-500 ease-in-out ${blur ? "backdrop-blur-md backdrop-saturate-150" : ""} ${borderless ? "border-b-0" : ""} ${isHeaderVisible ? "translate-y-0" : "-translate-y-full"}`,
|
|
3855
4207
|
style: {
|
|
3856
|
-
|
|
3857
|
-
|
|
4208
|
+
backgroundColor: blur ? "var(--color-muted)" : transparent ? "transparent" : "var(--color-background)",
|
|
4209
|
+
opacity: blur ? 0.85 : 1,
|
|
4210
|
+
borderBottom: !borderless && !blur ? "1px solid var(--color-border)" : "none"
|
|
3858
4211
|
},
|
|
3859
|
-
children: /* @__PURE__ */
|
|
4212
|
+
children: /* @__PURE__ */ jsxs20(
|
|
3860
4213
|
"div",
|
|
3861
4214
|
{
|
|
3862
4215
|
className: `flex items-center ${isLeft ? "justify-between" : "justify-between flex-row-reverse"}`,
|
|
3863
4216
|
children: [
|
|
3864
|
-
/* @__PURE__ */
|
|
3865
|
-
homeUrl && /* @__PURE__ */
|
|
4217
|
+
/* @__PURE__ */ jsxs20("div", { className: "flex items-center gap-2", children: [
|
|
4218
|
+
homeUrl && /* @__PURE__ */ jsx22(
|
|
3866
4219
|
"a",
|
|
3867
4220
|
{
|
|
3868
4221
|
href: homeUrl,
|
|
@@ -3871,14 +4224,14 @@ function Drawer({
|
|
|
3871
4224
|
onMouseOver: (e) => e.currentTarget.style.background = "var(--color-muted)",
|
|
3872
4225
|
onMouseOut: (e) => e.currentTarget.style.background = "transparent",
|
|
3873
4226
|
"aria-label": "Go to home",
|
|
3874
|
-
children: /* @__PURE__ */
|
|
4227
|
+
children: /* @__PURE__ */ jsx22(
|
|
3875
4228
|
"svg",
|
|
3876
4229
|
{
|
|
3877
4230
|
className: "w-5 h-5",
|
|
3878
4231
|
fill: "none",
|
|
3879
4232
|
stroke: "currentColor",
|
|
3880
4233
|
viewBox: "0 0 24 24",
|
|
3881
|
-
children: /* @__PURE__ */
|
|
4234
|
+
children: /* @__PURE__ */ jsx22(
|
|
3882
4235
|
"path",
|
|
3883
4236
|
{
|
|
3884
4237
|
strokeLinecap: "round",
|
|
@@ -3891,7 +4244,7 @@ function Drawer({
|
|
|
3891
4244
|
)
|
|
3892
4245
|
}
|
|
3893
4246
|
),
|
|
3894
|
-
/* @__PURE__ */
|
|
4247
|
+
/* @__PURE__ */ jsx22(
|
|
3895
4248
|
"button",
|
|
3896
4249
|
{
|
|
3897
4250
|
onClick: () => setMobileMenuOpen(!mobileMenuOpen),
|
|
@@ -3900,13 +4253,13 @@ function Drawer({
|
|
|
3900
4253
|
onMouseOver: (e) => e.currentTarget.style.background = "var(--color-muted)",
|
|
3901
4254
|
onMouseOut: (e) => e.currentTarget.style.background = "transparent",
|
|
3902
4255
|
"aria-label": "Toggle menu",
|
|
3903
|
-
children: mobileMenuOpen ? /* @__PURE__ */
|
|
4256
|
+
children: mobileMenuOpen ? /* @__PURE__ */ jsx22(X3, { className: "w-6 h-6" }) : /* @__PURE__ */ jsx22(Menu2, { className: "w-6 h-6" })
|
|
3904
4257
|
}
|
|
3905
4258
|
)
|
|
3906
4259
|
] }),
|
|
3907
|
-
headerActions && /* @__PURE__ */
|
|
3908
|
-
/* @__PURE__ */
|
|
3909
|
-
/* @__PURE__ */
|
|
4260
|
+
headerActions && /* @__PURE__ */ jsx22("div", { className: "flex items-center", children: headerActions }),
|
|
4261
|
+
/* @__PURE__ */ jsxs20("div", { children: [
|
|
4262
|
+
/* @__PURE__ */ jsx22(
|
|
3910
4263
|
"h1",
|
|
3911
4264
|
{
|
|
3912
4265
|
className: "font-bold text-h5",
|
|
@@ -3916,7 +4269,7 @@ function Drawer({
|
|
|
3916
4269
|
children: title
|
|
3917
4270
|
}
|
|
3918
4271
|
),
|
|
3919
|
-
subtitle && /* @__PURE__ */
|
|
4272
|
+
subtitle && /* @__PURE__ */ jsx22(
|
|
3920
4273
|
"p",
|
|
3921
4274
|
{
|
|
3922
4275
|
className: "text-caption",
|
|
@@ -3932,41 +4285,46 @@ function Drawer({
|
|
|
3932
4285
|
)
|
|
3933
4286
|
}
|
|
3934
4287
|
),
|
|
3935
|
-
mobileMenuOpen && /* @__PURE__ */
|
|
4288
|
+
mobileMenuOpen && /* @__PURE__ */ jsx22(
|
|
3936
4289
|
"div",
|
|
3937
4290
|
{
|
|
3938
|
-
className: "fixed inset-0
|
|
3939
|
-
style: {
|
|
4291
|
+
className: "fixed inset-0 lg:hidden transition-opacity ease-in-out",
|
|
4292
|
+
style: {
|
|
4293
|
+
zIndex: 9998,
|
|
4294
|
+
transitionDuration: "var(--transition-drawer-duration, 500ms)",
|
|
4295
|
+
backgroundColor: "var(--overlay-background, rgba(0, 0, 0, 0.4))"
|
|
4296
|
+
},
|
|
3940
4297
|
onClick: () => setMobileMenuOpen(false)
|
|
3941
4298
|
}
|
|
3942
4299
|
),
|
|
3943
|
-
/* @__PURE__ */
|
|
4300
|
+
/* @__PURE__ */ jsxs20(
|
|
3944
4301
|
"aside",
|
|
3945
4302
|
{
|
|
3946
4303
|
className: `
|
|
3947
4304
|
fixed top-0 bottom-0 w-64
|
|
3948
|
-
transition-
|
|
4305
|
+
transition-all ease-out overflow-y-auto
|
|
3949
4306
|
${isLeft ? "left-0" : "right-0"}
|
|
3950
4307
|
lg:translate-x-0 lg:top-0
|
|
3951
4308
|
${mobileMenuOpen ? "translate-x-0 top-0" : `${isLeft ? "-translate-x-full" : "translate-x-full"} top-0`}
|
|
3952
4309
|
`,
|
|
3953
4310
|
style: {
|
|
4311
|
+
transitionDuration: "var(--transition-drawer-duration, 500ms)",
|
|
3954
4312
|
background: "var(--color-background)",
|
|
3955
4313
|
borderLeft: isLeft ? "none" : "1px solid var(--color-border)",
|
|
3956
4314
|
borderRight: isLeft ? "1px solid var(--color-border)" : "none",
|
|
3957
4315
|
...mobileMenuOpen && typeof window !== "undefined" && window.innerWidth < 1024 ? { zIndex: 9999 } : {}
|
|
3958
4316
|
},
|
|
3959
4317
|
children: [
|
|
3960
|
-
/* @__PURE__ */
|
|
4318
|
+
/* @__PURE__ */ jsxs20(
|
|
3961
4319
|
"div",
|
|
3962
4320
|
{
|
|
3963
4321
|
className: "hidden lg:block px-6 py-5",
|
|
3964
4322
|
style: {
|
|
3965
|
-
borderBottom: "
|
|
3966
|
-
background: "var(--color-
|
|
4323
|
+
borderBottom: "none",
|
|
4324
|
+
background: "var(--color-muted)"
|
|
3967
4325
|
},
|
|
3968
4326
|
children: [
|
|
3969
|
-
/* @__PURE__ */
|
|
4327
|
+
/* @__PURE__ */ jsx22(
|
|
3970
4328
|
"h1",
|
|
3971
4329
|
{
|
|
3972
4330
|
className: "font-bold text-h5",
|
|
@@ -3976,7 +4334,7 @@ function Drawer({
|
|
|
3976
4334
|
children: title
|
|
3977
4335
|
}
|
|
3978
4336
|
),
|
|
3979
|
-
subtitle && /* @__PURE__ */
|
|
4337
|
+
subtitle && /* @__PURE__ */ jsx22(
|
|
3980
4338
|
"p",
|
|
3981
4339
|
{
|
|
3982
4340
|
className: "mt-0.5 text-caption",
|
|
@@ -3989,14 +4347,14 @@ function Drawer({
|
|
|
3989
4347
|
]
|
|
3990
4348
|
}
|
|
3991
4349
|
),
|
|
3992
|
-
/* @__PURE__ */
|
|
4350
|
+
/* @__PURE__ */ jsxs20(
|
|
3993
4351
|
"div",
|
|
3994
4352
|
{
|
|
3995
4353
|
className: "lg:hidden p-4 flex items-center justify-between",
|
|
3996
4354
|
style: { borderBottom: "1px solid var(--color-border)" },
|
|
3997
4355
|
children: [
|
|
3998
|
-
/* @__PURE__ */
|
|
3999
|
-
/* @__PURE__ */
|
|
4356
|
+
/* @__PURE__ */ jsxs20("div", { children: [
|
|
4357
|
+
/* @__PURE__ */ jsx22(
|
|
4000
4358
|
"h1",
|
|
4001
4359
|
{
|
|
4002
4360
|
className: "font-bold text-h5",
|
|
@@ -4006,7 +4364,7 @@ function Drawer({
|
|
|
4006
4364
|
children: title
|
|
4007
4365
|
}
|
|
4008
4366
|
),
|
|
4009
|
-
subtitle && /* @__PURE__ */
|
|
4367
|
+
subtitle && /* @__PURE__ */ jsx22(
|
|
4010
4368
|
"p",
|
|
4011
4369
|
{
|
|
4012
4370
|
className: "mt-1 text-caption",
|
|
@@ -4017,7 +4375,7 @@ function Drawer({
|
|
|
4017
4375
|
}
|
|
4018
4376
|
)
|
|
4019
4377
|
] }),
|
|
4020
|
-
/* @__PURE__ */
|
|
4378
|
+
/* @__PURE__ */ jsx22(
|
|
4021
4379
|
"button",
|
|
4022
4380
|
{
|
|
4023
4381
|
onClick: () => setMobileMenuOpen(false),
|
|
@@ -4026,20 +4384,20 @@ function Drawer({
|
|
|
4026
4384
|
onMouseOver: (e) => e.currentTarget.style.background = "var(--color-muted)",
|
|
4027
4385
|
onMouseOut: (e) => e.currentTarget.style.background = "transparent",
|
|
4028
4386
|
"aria-label": "Close menu",
|
|
4029
|
-
children: /* @__PURE__ */
|
|
4387
|
+
children: /* @__PURE__ */ jsx22(X3, { className: "w-5 h-5" })
|
|
4030
4388
|
}
|
|
4031
4389
|
)
|
|
4032
4390
|
]
|
|
4033
4391
|
}
|
|
4034
4392
|
),
|
|
4035
|
-
/* @__PURE__ */
|
|
4393
|
+
/* @__PURE__ */ jsx22("nav", { className: "px-3 py-4", children: useSections.map((section, sectionIndex) => /* @__PURE__ */ jsxs20(
|
|
4036
4394
|
"div",
|
|
4037
4395
|
{
|
|
4038
4396
|
style: {
|
|
4039
4397
|
paddingTop: sectionIndex > 0 ? "var(--drawer-section-padding-y)" : "0"
|
|
4040
4398
|
},
|
|
4041
4399
|
children: [
|
|
4042
|
-
section.title && /* @__PURE__ */
|
|
4400
|
+
section.title && /* @__PURE__ */ jsx22(
|
|
4043
4401
|
"h3",
|
|
4044
4402
|
{
|
|
4045
4403
|
className: "font-semibold uppercase tracking-wide text-caption",
|
|
@@ -4051,7 +4409,7 @@ function Drawer({
|
|
|
4051
4409
|
children: section.title
|
|
4052
4410
|
}
|
|
4053
4411
|
),
|
|
4054
|
-
/* @__PURE__ */
|
|
4412
|
+
/* @__PURE__ */ jsx22(
|
|
4055
4413
|
"ul",
|
|
4056
4414
|
{
|
|
4057
4415
|
style: {
|
|
@@ -4059,7 +4417,7 @@ function Drawer({
|
|
|
4059
4417
|
flexDirection: "column",
|
|
4060
4418
|
gap: "var(--drawer-item-spacing)"
|
|
4061
4419
|
},
|
|
4062
|
-
children: section.items.map((item) => /* @__PURE__ */
|
|
4420
|
+
children: section.items.map((item) => /* @__PURE__ */ jsx22("li", { children: /* @__PURE__ */ jsxs20(
|
|
4063
4421
|
"button",
|
|
4064
4422
|
{
|
|
4065
4423
|
onClick: () => handleItemClick(item.id),
|
|
@@ -4087,8 +4445,8 @@ function Drawer({
|
|
|
4087
4445
|
boxShadow: activeItem === item.id ? "0 1px 3px rgba(0,0,0,0.1)" : "none"
|
|
4088
4446
|
},
|
|
4089
4447
|
children: [
|
|
4090
|
-
item.icon && /* @__PURE__ */
|
|
4091
|
-
/* @__PURE__ */
|
|
4448
|
+
item.icon && /* @__PURE__ */ jsx22("span", { className: "shrink-0 opacity-75", children: item.icon }),
|
|
4449
|
+
/* @__PURE__ */ jsx22("span", { children: item.label })
|
|
4092
4450
|
]
|
|
4093
4451
|
}
|
|
4094
4452
|
) }, item.id))
|
|
@@ -4098,7 +4456,7 @@ function Drawer({
|
|
|
4098
4456
|
},
|
|
4099
4457
|
sectionIndex
|
|
4100
4458
|
)) }),
|
|
4101
|
-
footer && /* @__PURE__ */
|
|
4459
|
+
footer && /* @__PURE__ */ jsx22(
|
|
4102
4460
|
"div",
|
|
4103
4461
|
{
|
|
4104
4462
|
className: "p-4 mt-auto",
|
|
@@ -4112,51 +4470,10 @@ function Drawer({
|
|
|
4112
4470
|
] });
|
|
4113
4471
|
}
|
|
4114
4472
|
|
|
4115
|
-
// src/layout/header.tsx
|
|
4116
|
-
import { useState as useState12, useEffect as useEffect10 } from "react";
|
|
4117
|
-
import { jsx as jsx22 } from "react/jsx-runtime";
|
|
4118
|
-
function Header({
|
|
4119
|
-
children,
|
|
4120
|
-
autoHideOnScroll = true,
|
|
4121
|
-
className = "",
|
|
4122
|
-
position = "fixed"
|
|
4123
|
-
}) {
|
|
4124
|
-
const [isHeaderVisible, setIsHeaderVisible] = useState12(true);
|
|
4125
|
-
const [lastScrollY, setLastScrollY] = useState12(0);
|
|
4126
|
-
useEffect10(() => {
|
|
4127
|
-
if (!autoHideOnScroll || position === "static") {
|
|
4128
|
-
setIsHeaderVisible(true);
|
|
4129
|
-
return;
|
|
4130
|
-
}
|
|
4131
|
-
const handleScroll = () => {
|
|
4132
|
-
const currentScrollY = window.scrollY;
|
|
4133
|
-
if (currentScrollY < 10) {
|
|
4134
|
-
setIsHeaderVisible(true);
|
|
4135
|
-
} else if (currentScrollY > lastScrollY) {
|
|
4136
|
-
setIsHeaderVisible(false);
|
|
4137
|
-
} else {
|
|
4138
|
-
setIsHeaderVisible(true);
|
|
4139
|
-
}
|
|
4140
|
-
setLastScrollY(currentScrollY);
|
|
4141
|
-
};
|
|
4142
|
-
window.addEventListener("scroll", handleScroll, { passive: true });
|
|
4143
|
-
return () => window.removeEventListener("scroll", handleScroll);
|
|
4144
|
-
}, [lastScrollY, autoHideOnScroll, position]);
|
|
4145
|
-
const positionClass = position === "static" ? "" : position;
|
|
4146
|
-
const transformClass = autoHideOnScroll && position !== "static" ? `transition-transform duration-500 ease-in-out ${isHeaderVisible ? "translate-y-0" : "-translate-y-full"}` : "";
|
|
4147
|
-
return /* @__PURE__ */ jsx22(
|
|
4148
|
-
"header",
|
|
4149
|
-
{
|
|
4150
|
-
className: `${positionClass} top-0 left-0 right-0 ${transformClass} ${className}`,
|
|
4151
|
-
children
|
|
4152
|
-
}
|
|
4153
|
-
);
|
|
4154
|
-
}
|
|
4155
|
-
|
|
4156
4473
|
// src/layout/sidebar-nav.tsx
|
|
4157
4474
|
import { Menu as Menu3, X as X4 } from "lucide-react";
|
|
4158
4475
|
import { useState as useState13 } from "react";
|
|
4159
|
-
import { Fragment as Fragment6, jsx as jsx23, jsxs as
|
|
4476
|
+
import { Fragment as Fragment6, jsx as jsx23, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
4160
4477
|
function SidebarNav({
|
|
4161
4478
|
title,
|
|
4162
4479
|
subtitle,
|
|
@@ -4174,8 +4491,8 @@ function SidebarNav({
|
|
|
4174
4491
|
setMobileMenuOpen(false);
|
|
4175
4492
|
};
|
|
4176
4493
|
const useSections = sections || (items ? [{ title: "", items }] : []);
|
|
4177
|
-
return /* @__PURE__ */
|
|
4178
|
-
/* @__PURE__ */ jsx23("div", { className: "lg:hidden fixed top-0 left-0 right-0 [z-index:var(--z-index-nav)] bg-(--color-background) border-b border-(--color-border) px-4 py-3", children: /* @__PURE__ */
|
|
4494
|
+
return /* @__PURE__ */ jsxs21(Fragment6, { children: [
|
|
4495
|
+
/* @__PURE__ */ jsx23("div", { className: "lg:hidden fixed top-0 left-0 right-0 [z-index:var(--z-index-nav)] bg-(--color-background) border-b border-(--color-border) px-4 py-3", children: /* @__PURE__ */ jsxs21(
|
|
4179
4496
|
"div",
|
|
4180
4497
|
{
|
|
4181
4498
|
className: `flex items-center ${isLeft ? "justify-between" : "justify-between flex-row-reverse"}`,
|
|
@@ -4189,7 +4506,7 @@ function SidebarNav({
|
|
|
4189
4506
|
children: mobileMenuOpen ? /* @__PURE__ */ jsx23(X4, { className: "w-6 h-6 text-(--color-muted-foreground)" }) : /* @__PURE__ */ jsx23(Menu3, { className: "w-6 h-6 text-(--color-muted-foreground)" })
|
|
4190
4507
|
}
|
|
4191
4508
|
),
|
|
4192
|
-
/* @__PURE__ */
|
|
4509
|
+
/* @__PURE__ */ jsxs21("div", { children: [
|
|
4193
4510
|
/* @__PURE__ */ jsx23("h1", { className: "text-h4 font-bold text-(--color-foreground)", children: title }),
|
|
4194
4511
|
subtitle && /* @__PURE__ */ jsx23("p", { className: "text-caption text-(--color-muted-foreground)", children: subtitle })
|
|
4195
4512
|
] })
|
|
@@ -4204,7 +4521,7 @@ function SidebarNav({
|
|
|
4204
4521
|
onClick: () => setMobileMenuOpen(false)
|
|
4205
4522
|
}
|
|
4206
4523
|
),
|
|
4207
|
-
/* @__PURE__ */
|
|
4524
|
+
/* @__PURE__ */ jsxs21(
|
|
4208
4525
|
"aside",
|
|
4209
4526
|
{
|
|
4210
4527
|
className: `
|
|
@@ -4215,18 +4532,18 @@ function SidebarNav({
|
|
|
4215
4532
|
${mobileMenuOpen ? "translate-x-0" : `${isLeft ? "-translate-x-full" : "translate-x-full"} lg:translate-x-0`}
|
|
4216
4533
|
`,
|
|
4217
4534
|
children: [
|
|
4218
|
-
/* @__PURE__ */
|
|
4535
|
+
/* @__PURE__ */ jsxs21("div", { className: "hidden lg:block p-6 border-b border-(--color-border)", children: [
|
|
4219
4536
|
/* @__PURE__ */ jsx23("h1", { className: "text-h3 font-bold text-(--color-foreground)", children: title }),
|
|
4220
4537
|
subtitle && /* @__PURE__ */ jsx23("p", { className: "text-caption text-(--color-muted-foreground) mt-1", children: subtitle })
|
|
4221
4538
|
] }),
|
|
4222
4539
|
/* @__PURE__ */ jsx23("div", { className: "lg:hidden h-[57px]", "aria-hidden": "true" }),
|
|
4223
|
-
/* @__PURE__ */ jsx23("nav", { className: "p-4", children: useSections.map((section, sectionIndex) => /* @__PURE__ */
|
|
4540
|
+
/* @__PURE__ */ jsx23("nav", { className: "p-4", children: useSections.map((section, sectionIndex) => /* @__PURE__ */ jsxs21(
|
|
4224
4541
|
"div",
|
|
4225
4542
|
{
|
|
4226
4543
|
className: sectionIndex > 0 ? "mt-6" : "",
|
|
4227
4544
|
children: [
|
|
4228
4545
|
section.title && /* @__PURE__ */ jsx23("h3", { className: "px-4 mb-2 text-caption font-semibold text-(--color-muted-foreground) uppercase tracking-wider", children: section.title }),
|
|
4229
|
-
/* @__PURE__ */ jsx23("ul", { className: "space-y-1", children: section.items.map((item) => /* @__PURE__ */ jsx23("li", { children: /* @__PURE__ */
|
|
4546
|
+
/* @__PURE__ */ jsx23("ul", { className: "space-y-1", children: section.items.map((item) => /* @__PURE__ */ jsx23("li", { children: /* @__PURE__ */ jsxs21(
|
|
4230
4547
|
"button",
|
|
4231
4548
|
{
|
|
4232
4549
|
onClick: () => handleItemClick(item.id),
|
|
@@ -4253,10 +4570,10 @@ function SidebarNav({
|
|
|
4253
4570
|
|
|
4254
4571
|
// src/shared/empty-state.tsx
|
|
4255
4572
|
import React17 from "react";
|
|
4256
|
-
import { jsx as jsx24, jsxs as
|
|
4573
|
+
import { jsx as jsx24, jsxs as jsxs22 } from "react/jsx-runtime";
|
|
4257
4574
|
var EmptyState = React17.forwardRef(
|
|
4258
4575
|
({ className, icon, title, description, action, ...props }, ref) => {
|
|
4259
|
-
return /* @__PURE__ */
|
|
4576
|
+
return /* @__PURE__ */ jsxs22(
|
|
4260
4577
|
"div",
|
|
4261
4578
|
{
|
|
4262
4579
|
ref,
|
|
@@ -4388,6 +4705,12 @@ var dark_default = {
|
|
|
4388
4705
|
"indigo-bg-hover": "#383570",
|
|
4389
4706
|
"indigo-text": "#a8a5e8"
|
|
4390
4707
|
}
|
|
4708
|
+
},
|
|
4709
|
+
transitions: {
|
|
4710
|
+
"drawer-duration": "500ms"
|
|
4711
|
+
},
|
|
4712
|
+
overlay: {
|
|
4713
|
+
background: "rgba(0, 0, 0, 0.5)"
|
|
4391
4714
|
}
|
|
4392
4715
|
};
|
|
4393
4716
|
|
|
@@ -4494,6 +4817,12 @@ var light_default = {
|
|
|
4494
4817
|
"indigo-bg-hover": "#c7d2fe",
|
|
4495
4818
|
"indigo-text": "#4f46e5"
|
|
4496
4819
|
}
|
|
4820
|
+
},
|
|
4821
|
+
transitions: {
|
|
4822
|
+
"drawer-duration": "500ms"
|
|
4823
|
+
},
|
|
4824
|
+
overlay: {
|
|
4825
|
+
background: "rgba(0, 0, 0, 0.4)"
|
|
4497
4826
|
}
|
|
4498
4827
|
};
|
|
4499
4828
|
|
|
@@ -4565,6 +4894,16 @@ function ThemeProvider({
|
|
|
4565
4894
|
setCSSVariable(varName, value);
|
|
4566
4895
|
});
|
|
4567
4896
|
});
|
|
4897
|
+
if (theme.transitions) {
|
|
4898
|
+
Object.entries(theme.transitions).forEach(([key, value]) => {
|
|
4899
|
+
setCSSVariable(`--transition-${key}`, value);
|
|
4900
|
+
});
|
|
4901
|
+
}
|
|
4902
|
+
if (theme.overlay) {
|
|
4903
|
+
Object.entries(theme.overlay).forEach(([key, value]) => {
|
|
4904
|
+
setCSSVariable(`--overlay-${key}`, value);
|
|
4905
|
+
});
|
|
4906
|
+
}
|
|
4568
4907
|
setCSSVariable("--background", theme.colors.background);
|
|
4569
4908
|
setCSSVariable("--foreground", theme.colors.foreground);
|
|
4570
4909
|
};
|
|
@@ -4676,7 +5015,6 @@ export {
|
|
|
4676
5015
|
FormControl,
|
|
4677
5016
|
FormControlLabel,
|
|
4678
5017
|
FormHelperText,
|
|
4679
|
-
Header,
|
|
4680
5018
|
Input,
|
|
4681
5019
|
Nav,
|
|
4682
5020
|
RadioGroup,
|
|
@@ -4687,6 +5025,7 @@ export {
|
|
|
4687
5025
|
Slider,
|
|
4688
5026
|
Spinner,
|
|
4689
5027
|
Switch,
|
|
5028
|
+
Textarea,
|
|
4690
5029
|
ThemeProvider,
|
|
4691
5030
|
cn,
|
|
4692
5031
|
themes_default as themes,
|