@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.js
CHANGED
|
@@ -60,7 +60,6 @@ __export(index_exports, {
|
|
|
60
60
|
FormControl: () => FormControl,
|
|
61
61
|
FormControlLabel: () => FormControlLabel,
|
|
62
62
|
FormHelperText: () => FormHelperText,
|
|
63
|
-
Header: () => Header,
|
|
64
63
|
Input: () => Input,
|
|
65
64
|
Nav: () => Nav,
|
|
66
65
|
RadioGroup: () => RadioGroup,
|
|
@@ -71,6 +70,7 @@ __export(index_exports, {
|
|
|
71
70
|
Slider: () => Slider,
|
|
72
71
|
Spinner: () => Spinner,
|
|
73
72
|
Switch: () => Switch,
|
|
73
|
+
Textarea: () => Textarea,
|
|
74
74
|
ThemeProvider: () => ThemeProvider,
|
|
75
75
|
cn: () => cn,
|
|
76
76
|
themes: () => themes_default,
|
|
@@ -231,7 +231,10 @@ var Button = import_react.default.forwardRef(
|
|
|
231
231
|
Button.displayName = "Button";
|
|
232
232
|
|
|
233
233
|
// src/ui/input.tsx
|
|
234
|
-
var
|
|
234
|
+
var import_react5 = __toESM(require("react"));
|
|
235
|
+
|
|
236
|
+
// src/ui/hooks/useFormField.ts
|
|
237
|
+
var import_react4 = require("react");
|
|
235
238
|
|
|
236
239
|
// src/ui/form.tsx
|
|
237
240
|
var import_react2 = require("react");
|
|
@@ -754,9 +757,212 @@ function FormHelperText({
|
|
|
754
757
|
) });
|
|
755
758
|
}
|
|
756
759
|
|
|
760
|
+
// src/ui/hooks/useFormField.ts
|
|
761
|
+
function useFormField2(options) {
|
|
762
|
+
const {
|
|
763
|
+
name,
|
|
764
|
+
type = "text",
|
|
765
|
+
value: externalValue,
|
|
766
|
+
error: externalError,
|
|
767
|
+
id,
|
|
768
|
+
required = false,
|
|
769
|
+
disabled = false,
|
|
770
|
+
minLength,
|
|
771
|
+
maxLength,
|
|
772
|
+
min,
|
|
773
|
+
max,
|
|
774
|
+
pattern,
|
|
775
|
+
validate,
|
|
776
|
+
onValidationError,
|
|
777
|
+
errorMessages,
|
|
778
|
+
idPrefix = "field"
|
|
779
|
+
} = options;
|
|
780
|
+
const autoId = (0, import_react4.useId)();
|
|
781
|
+
const form = useForm();
|
|
782
|
+
const formControl = useFormControl();
|
|
783
|
+
const internalRef = (0, import_react4.useRef)(null);
|
|
784
|
+
const [validationError, setValidationError] = (0, import_react4.useState)();
|
|
785
|
+
const stableId = (0, import_react4.useRef)(void 0);
|
|
786
|
+
if (!stableId.current) {
|
|
787
|
+
stableId.current = id || formControl?.fieldId || `${idPrefix}-${autoId}`;
|
|
788
|
+
}
|
|
789
|
+
const fieldId = stableId.current;
|
|
790
|
+
const isDisabled = disabled || formControl?.isDisabled || false;
|
|
791
|
+
const isRequired = required || formControl?.isRequired || false;
|
|
792
|
+
let fieldValue;
|
|
793
|
+
let fieldError;
|
|
794
|
+
if (form && name) {
|
|
795
|
+
fieldError = form.shouldShowError(name) ? form.getFieldError(name) : void 0;
|
|
796
|
+
fieldValue = form.values[name] !== void 0 ? form.values[name] : externalValue ?? "";
|
|
797
|
+
} else if (formControl) {
|
|
798
|
+
fieldError = formControl.error || externalError || validationError;
|
|
799
|
+
fieldValue = formControl.value ?? externalValue;
|
|
800
|
+
} else {
|
|
801
|
+
fieldError = externalError || validationError;
|
|
802
|
+
fieldValue = externalValue;
|
|
803
|
+
}
|
|
804
|
+
const runBuiltInValidation = (value) => {
|
|
805
|
+
if (isRequired && !value) {
|
|
806
|
+
return errorMessages?.required || "This field is required";
|
|
807
|
+
}
|
|
808
|
+
if (value) {
|
|
809
|
+
if (type === "email" && !value.includes("@")) {
|
|
810
|
+
return errorMessages?.email || "Please enter a valid email address";
|
|
811
|
+
}
|
|
812
|
+
if (type === "url") {
|
|
813
|
+
try {
|
|
814
|
+
new URL(value);
|
|
815
|
+
} catch {
|
|
816
|
+
return errorMessages?.url || "Please enter a valid URL";
|
|
817
|
+
}
|
|
818
|
+
}
|
|
819
|
+
if (type === "number") {
|
|
820
|
+
const numValue = parseFloat(value);
|
|
821
|
+
if (min !== void 0 && numValue < Number(min)) {
|
|
822
|
+
return errorMessages?.min || `Minimum value is ${min}`;
|
|
823
|
+
}
|
|
824
|
+
if (max !== void 0 && numValue > Number(max)) {
|
|
825
|
+
return errorMessages?.max || `Maximum value is ${max}`;
|
|
826
|
+
}
|
|
827
|
+
}
|
|
828
|
+
if (minLength !== void 0 && value.length < minLength) {
|
|
829
|
+
return errorMessages?.minLength || `Minimum length is ${minLength} characters`;
|
|
830
|
+
}
|
|
831
|
+
if (maxLength !== void 0 && value.length > maxLength) {
|
|
832
|
+
return errorMessages?.maxLength || `Maximum length is ${maxLength} characters`;
|
|
833
|
+
}
|
|
834
|
+
if (pattern) {
|
|
835
|
+
const regex = typeof pattern === "string" ? new RegExp(pattern) : pattern;
|
|
836
|
+
if (!regex.test(value)) {
|
|
837
|
+
return errorMessages?.pattern || "Invalid format";
|
|
838
|
+
}
|
|
839
|
+
}
|
|
840
|
+
}
|
|
841
|
+
return void 0;
|
|
842
|
+
};
|
|
843
|
+
const runValidation = async (value) => {
|
|
844
|
+
const builtInError = runBuiltInValidation(value);
|
|
845
|
+
if (builtInError) {
|
|
846
|
+
setValidationError(builtInError);
|
|
847
|
+
onValidationError?.(builtInError);
|
|
848
|
+
return;
|
|
849
|
+
}
|
|
850
|
+
if (validate) {
|
|
851
|
+
const customError = await validate(value);
|
|
852
|
+
setValidationError(customError);
|
|
853
|
+
onValidationError?.(customError);
|
|
854
|
+
return;
|
|
855
|
+
}
|
|
856
|
+
setValidationError(void 0);
|
|
857
|
+
onValidationError?.(void 0);
|
|
858
|
+
};
|
|
859
|
+
(0, import_react4.useEffect)(() => {
|
|
860
|
+
if (form && name) {
|
|
861
|
+
const validator = async (value) => {
|
|
862
|
+
if (isRequired && !value) {
|
|
863
|
+
return errorMessages?.required || "This field is required";
|
|
864
|
+
}
|
|
865
|
+
if (value) {
|
|
866
|
+
if (type === "email" && !value.includes("@")) {
|
|
867
|
+
return errorMessages?.email || "Please enter a valid email address";
|
|
868
|
+
}
|
|
869
|
+
if (type === "url") {
|
|
870
|
+
try {
|
|
871
|
+
new URL(value);
|
|
872
|
+
} catch {
|
|
873
|
+
return errorMessages?.url || "Please enter a valid URL";
|
|
874
|
+
}
|
|
875
|
+
}
|
|
876
|
+
if (type === "number") {
|
|
877
|
+
const numValue = parseFloat(value);
|
|
878
|
+
if (min !== void 0 && numValue < Number(min)) {
|
|
879
|
+
return errorMessages?.min || `Minimum value is ${min}`;
|
|
880
|
+
}
|
|
881
|
+
if (max !== void 0 && numValue > Number(max)) {
|
|
882
|
+
return errorMessages?.max || `Maximum value is ${max}`;
|
|
883
|
+
}
|
|
884
|
+
}
|
|
885
|
+
if (minLength !== void 0 && value.length < minLength) {
|
|
886
|
+
return errorMessages?.minLength || `Minimum length is ${minLength} characters`;
|
|
887
|
+
}
|
|
888
|
+
if (maxLength !== void 0 && value.length > maxLength) {
|
|
889
|
+
return errorMessages?.maxLength || `Maximum length is ${maxLength} characters`;
|
|
890
|
+
}
|
|
891
|
+
if (pattern) {
|
|
892
|
+
const regex = typeof pattern === "string" ? new RegExp(pattern) : pattern;
|
|
893
|
+
if (!regex.test(value)) {
|
|
894
|
+
return errorMessages?.pattern || "Invalid format";
|
|
895
|
+
}
|
|
896
|
+
}
|
|
897
|
+
}
|
|
898
|
+
if (validate) {
|
|
899
|
+
return await validate(value);
|
|
900
|
+
}
|
|
901
|
+
return void 0;
|
|
902
|
+
};
|
|
903
|
+
form.registerField(name, validator);
|
|
904
|
+
return () => form.unregisterField(name);
|
|
905
|
+
} else if (formControl) {
|
|
906
|
+
const element = internalRef.current;
|
|
907
|
+
if (element) {
|
|
908
|
+
formControl.registerControl(element);
|
|
909
|
+
return () => formControl.unregisterControl(element);
|
|
910
|
+
}
|
|
911
|
+
}
|
|
912
|
+
}, [
|
|
913
|
+
form,
|
|
914
|
+
formControl,
|
|
915
|
+
name,
|
|
916
|
+
isRequired,
|
|
917
|
+
type,
|
|
918
|
+
min,
|
|
919
|
+
max,
|
|
920
|
+
minLength,
|
|
921
|
+
maxLength,
|
|
922
|
+
pattern,
|
|
923
|
+
validate,
|
|
924
|
+
errorMessages
|
|
925
|
+
]);
|
|
926
|
+
const handleChange = (value) => {
|
|
927
|
+
if (form && name) {
|
|
928
|
+
form.setFieldValue(name, value);
|
|
929
|
+
} else if (formControl) {
|
|
930
|
+
formControl.setValue(value);
|
|
931
|
+
} else {
|
|
932
|
+
runValidation(value);
|
|
933
|
+
}
|
|
934
|
+
};
|
|
935
|
+
const handleBlur = (value) => {
|
|
936
|
+
if (form && name) {
|
|
937
|
+
form.setFieldTouched(name, true);
|
|
938
|
+
form.validateField(name, value);
|
|
939
|
+
} else if (formControl) {
|
|
940
|
+
formControl.setTouched(true);
|
|
941
|
+
} else {
|
|
942
|
+
if (value) {
|
|
943
|
+
runValidation(value);
|
|
944
|
+
}
|
|
945
|
+
}
|
|
946
|
+
};
|
|
947
|
+
const shouldRenderLabel = !formControl;
|
|
948
|
+
const shouldRenderError = !!fieldError && !formControl;
|
|
949
|
+
return {
|
|
950
|
+
fieldId,
|
|
951
|
+
value: fieldValue,
|
|
952
|
+
error: fieldError,
|
|
953
|
+
isDisabled,
|
|
954
|
+
isRequired,
|
|
955
|
+
shouldRenderLabel,
|
|
956
|
+
shouldRenderError,
|
|
957
|
+
handleChange,
|
|
958
|
+
handleBlur,
|
|
959
|
+
internalRef
|
|
960
|
+
};
|
|
961
|
+
}
|
|
962
|
+
|
|
757
963
|
// src/ui/input.tsx
|
|
758
964
|
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
759
|
-
var Input =
|
|
965
|
+
var Input = import_react5.default.forwardRef(
|
|
760
966
|
({
|
|
761
967
|
className,
|
|
762
968
|
type = "text",
|
|
@@ -777,66 +983,186 @@ var Input = import_react4.default.forwardRef(
|
|
|
777
983
|
errorMessages,
|
|
778
984
|
...props
|
|
779
985
|
}, ref) => {
|
|
780
|
-
const
|
|
986
|
+
const {
|
|
987
|
+
fieldId,
|
|
988
|
+
value: inputValue,
|
|
989
|
+
error: inputError,
|
|
990
|
+
isDisabled,
|
|
991
|
+
isRequired,
|
|
992
|
+
shouldRenderLabel,
|
|
993
|
+
shouldRenderError,
|
|
994
|
+
handleChange: hookHandleChange,
|
|
995
|
+
handleBlur: hookHandleBlur,
|
|
996
|
+
internalRef
|
|
997
|
+
} = useFormField2({
|
|
998
|
+
name,
|
|
999
|
+
type,
|
|
1000
|
+
value: externalValue,
|
|
1001
|
+
error,
|
|
1002
|
+
id,
|
|
1003
|
+
required: props.required,
|
|
1004
|
+
disabled: props.disabled,
|
|
1005
|
+
minLength: props.minLength,
|
|
1006
|
+
maxLength: props.maxLength,
|
|
1007
|
+
min: props.min,
|
|
1008
|
+
max: props.max,
|
|
1009
|
+
pattern,
|
|
1010
|
+
validate,
|
|
1011
|
+
onValidationError,
|
|
1012
|
+
errorMessages,
|
|
1013
|
+
idPrefix: "input"
|
|
1014
|
+
});
|
|
1015
|
+
const handleChange = (e) => {
|
|
1016
|
+
hookHandleChange(e.target.value);
|
|
1017
|
+
onChange?.(e);
|
|
1018
|
+
};
|
|
1019
|
+
const handleBlur = (e) => {
|
|
1020
|
+
hookHandleBlur(e.target.value);
|
|
1021
|
+
onBlur?.(e);
|
|
1022
|
+
};
|
|
1023
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
1024
|
+
"div",
|
|
1025
|
+
{
|
|
1026
|
+
className: cn("flex flex-col", fullWidth && "w-full"),
|
|
1027
|
+
style: { marginBottom: "var(--form-control-spacing)" },
|
|
1028
|
+
children: [
|
|
1029
|
+
shouldRenderLabel && label && /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
1030
|
+
"label",
|
|
1031
|
+
{
|
|
1032
|
+
htmlFor: fieldId,
|
|
1033
|
+
className: "block text-small font-semibold text-(--color-muted-foreground) mb-1",
|
|
1034
|
+
children: [
|
|
1035
|
+
label,
|
|
1036
|
+
isRequired && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "ml-1", children: "*" })
|
|
1037
|
+
]
|
|
1038
|
+
}
|
|
1039
|
+
),
|
|
1040
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "relative", children: [
|
|
1041
|
+
leftIcon && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none text-(--color-placeholder)", children: leftIcon }),
|
|
1042
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
1043
|
+
"input",
|
|
1044
|
+
{
|
|
1045
|
+
ref: (node) => {
|
|
1046
|
+
if (typeof ref === "function") {
|
|
1047
|
+
ref(node);
|
|
1048
|
+
} else if (ref) {
|
|
1049
|
+
ref.current = node;
|
|
1050
|
+
}
|
|
1051
|
+
internalRef.current = node;
|
|
1052
|
+
},
|
|
1053
|
+
type,
|
|
1054
|
+
id: fieldId,
|
|
1055
|
+
value: inputValue,
|
|
1056
|
+
onChange: handleChange,
|
|
1057
|
+
onBlur: handleBlur,
|
|
1058
|
+
disabled: isDisabled,
|
|
1059
|
+
required: isRequired,
|
|
1060
|
+
pattern: pattern instanceof RegExp ? pattern.source : pattern,
|
|
1061
|
+
"aria-invalid": !!inputError,
|
|
1062
|
+
"aria-describedby": inputError ? `${fieldId}-error` : helperText ? `${fieldId}-helper` : void 0,
|
|
1063
|
+
className: cn(
|
|
1064
|
+
"w-full px-3 py-2 border rounded-md transition-colors",
|
|
1065
|
+
"text-(--color-muted-foreground) placeholder-gray-400",
|
|
1066
|
+
"focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent",
|
|
1067
|
+
"disabled:bg-(--color-muted) disabled:cursor-not-allowed disabled:text-(--color-muted-foreground)",
|
|
1068
|
+
inputError ? "border-error focus:ring-error" : "border-(--color-border)",
|
|
1069
|
+
leftIcon && "pl-10",
|
|
1070
|
+
rightIcon && "pr-10",
|
|
1071
|
+
className
|
|
1072
|
+
),
|
|
1073
|
+
...props
|
|
1074
|
+
}
|
|
1075
|
+
),
|
|
1076
|
+
rightIcon && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "absolute inset-y-0 right-0 pr-3 flex items-center pointer-events-none text-(--color-placeholder)", children: rightIcon })
|
|
1077
|
+
] }),
|
|
1078
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "h-5 mt-1.5", children: [
|
|
1079
|
+
shouldRenderError && inputError && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
1080
|
+
"p",
|
|
1081
|
+
{
|
|
1082
|
+
className: "text-small text-error",
|
|
1083
|
+
id: `${fieldId}-error`,
|
|
1084
|
+
role: "alert",
|
|
1085
|
+
children: inputError
|
|
1086
|
+
}
|
|
1087
|
+
),
|
|
1088
|
+
helperText && !inputError && shouldRenderLabel && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
1089
|
+
"p",
|
|
1090
|
+
{
|
|
1091
|
+
className: "text-small text-(--color-muted-foreground)",
|
|
1092
|
+
id: `${fieldId}-helper`,
|
|
1093
|
+
children: helperText
|
|
1094
|
+
}
|
|
1095
|
+
)
|
|
1096
|
+
] })
|
|
1097
|
+
]
|
|
1098
|
+
}
|
|
1099
|
+
);
|
|
1100
|
+
}
|
|
1101
|
+
);
|
|
1102
|
+
Input.displayName = "Input";
|
|
1103
|
+
|
|
1104
|
+
// src/ui/textarea.tsx
|
|
1105
|
+
var import_react6 = __toESM(require("react"));
|
|
1106
|
+
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
1107
|
+
var Textarea = import_react6.default.forwardRef(
|
|
1108
|
+
({
|
|
1109
|
+
className,
|
|
1110
|
+
name,
|
|
1111
|
+
label,
|
|
1112
|
+
error,
|
|
1113
|
+
helperText,
|
|
1114
|
+
fullWidth = false,
|
|
1115
|
+
id,
|
|
1116
|
+
onChange,
|
|
1117
|
+
onBlur,
|
|
1118
|
+
value: externalValue,
|
|
1119
|
+
validate,
|
|
1120
|
+
onValidationError,
|
|
1121
|
+
errorMessages,
|
|
1122
|
+
rows = 3,
|
|
1123
|
+
resize = "vertical",
|
|
1124
|
+
autoResize = false,
|
|
1125
|
+
showCharacterCount = false,
|
|
1126
|
+
maxHeight = 500,
|
|
1127
|
+
...props
|
|
1128
|
+
}, ref) => {
|
|
1129
|
+
const autoId = (0, import_react6.useId)();
|
|
781
1130
|
const form = useForm();
|
|
782
1131
|
const formControl = useFormControl();
|
|
783
|
-
const internalRef = (0,
|
|
784
|
-
const [validationError, setValidationError] = (0,
|
|
785
|
-
const stableId = (0,
|
|
1132
|
+
const internalRef = (0, import_react6.useRef)(null);
|
|
1133
|
+
const [validationError, setValidationError] = (0, import_react6.useState)();
|
|
1134
|
+
const stableId = (0, import_react6.useRef)(void 0);
|
|
786
1135
|
if (!stableId.current) {
|
|
787
|
-
stableId.current = id || formControl?.fieldId || `
|
|
1136
|
+
stableId.current = id || formControl?.fieldId || `textarea-${autoId}`;
|
|
788
1137
|
}
|
|
789
|
-
const
|
|
1138
|
+
const textareaId = stableId.current;
|
|
790
1139
|
const isDisabled = props.disabled || formControl?.isDisabled;
|
|
791
1140
|
const isRequired = props.required || formControl?.isRequired;
|
|
792
|
-
let
|
|
793
|
-
let
|
|
1141
|
+
let textareaError;
|
|
1142
|
+
let textareaValue;
|
|
794
1143
|
if (form && name) {
|
|
795
|
-
|
|
796
|
-
|
|
1144
|
+
textareaError = form.shouldShowError(name) ? form.getFieldError(name) : void 0;
|
|
1145
|
+
textareaValue = form.values[name] !== void 0 ? form.values[name] : externalValue ?? "";
|
|
797
1146
|
} else if (formControl) {
|
|
798
|
-
|
|
799
|
-
|
|
1147
|
+
textareaError = formControl.error || error || validationError;
|
|
1148
|
+
textareaValue = formControl.value ?? externalValue;
|
|
800
1149
|
} else {
|
|
801
|
-
|
|
802
|
-
|
|
1150
|
+
textareaError = error || validationError;
|
|
1151
|
+
textareaValue = externalValue;
|
|
803
1152
|
}
|
|
1153
|
+
const currentLength = typeof textareaValue === "string" ? textareaValue.length : 0;
|
|
1154
|
+
const maxLengthValue = props.maxLength;
|
|
804
1155
|
const runBuiltInValidation = (value) => {
|
|
805
1156
|
if (isRequired && !value) {
|
|
806
1157
|
return errorMessages?.required || "This field is required";
|
|
807
1158
|
}
|
|
808
1159
|
if (value) {
|
|
809
|
-
if (type === "email" && !value.includes("@")) {
|
|
810
|
-
return errorMessages?.email || "Please enter a valid email address";
|
|
811
|
-
}
|
|
812
|
-
if (type === "url") {
|
|
813
|
-
try {
|
|
814
|
-
new URL(value);
|
|
815
|
-
} catch {
|
|
816
|
-
return errorMessages?.url || "Please enter a valid URL";
|
|
817
|
-
}
|
|
818
|
-
}
|
|
819
|
-
if (type === "number") {
|
|
820
|
-
const numValue = parseFloat(value);
|
|
821
|
-
if (props.min !== void 0 && numValue < Number(props.min)) {
|
|
822
|
-
return errorMessages?.min || `Minimum value is ${props.min}`;
|
|
823
|
-
}
|
|
824
|
-
if (props.max !== void 0 && numValue > Number(props.max)) {
|
|
825
|
-
return errorMessages?.max || `Maximum value is ${props.max}`;
|
|
826
|
-
}
|
|
827
|
-
}
|
|
828
1160
|
if (props.minLength !== void 0 && value.length < props.minLength) {
|
|
829
1161
|
return errorMessages?.minLength || `Minimum length is ${props.minLength} characters`;
|
|
830
1162
|
}
|
|
831
1163
|
if (props.maxLength !== void 0 && value.length > props.maxLength) {
|
|
832
1164
|
return errorMessages?.maxLength || `Maximum length is ${props.maxLength} characters`;
|
|
833
1165
|
}
|
|
834
|
-
if (pattern) {
|
|
835
|
-
const regex = typeof pattern === "string" ? new RegExp(pattern) : pattern;
|
|
836
|
-
if (!regex.test(value)) {
|
|
837
|
-
return errorMessages?.pattern || "Invalid format";
|
|
838
|
-
}
|
|
839
|
-
}
|
|
840
1166
|
}
|
|
841
1167
|
return void 0;
|
|
842
1168
|
};
|
|
@@ -856,44 +1182,27 @@ var Input = import_react4.default.forwardRef(
|
|
|
856
1182
|
setValidationError(void 0);
|
|
857
1183
|
onValidationError?.(void 0);
|
|
858
1184
|
};
|
|
859
|
-
|
|
1185
|
+
const adjustHeight = () => {
|
|
1186
|
+
const textarea = internalRef.current;
|
|
1187
|
+
if (textarea && autoResize) {
|
|
1188
|
+
textarea.style.height = "auto";
|
|
1189
|
+
const newHeight = Math.min(textarea.scrollHeight, maxHeight);
|
|
1190
|
+
textarea.style.height = `${newHeight}px`;
|
|
1191
|
+
}
|
|
1192
|
+
};
|
|
1193
|
+
(0, import_react6.useEffect)(() => {
|
|
860
1194
|
if (form && name) {
|
|
861
1195
|
const validator = async (value) => {
|
|
862
1196
|
if (isRequired && !value) {
|
|
863
1197
|
return errorMessages?.required || "This field is required";
|
|
864
1198
|
}
|
|
865
1199
|
if (value) {
|
|
866
|
-
if (type === "email" && !value.includes("@")) {
|
|
867
|
-
return errorMessages?.email || "Please enter a valid email address";
|
|
868
|
-
}
|
|
869
|
-
if (type === "url") {
|
|
870
|
-
try {
|
|
871
|
-
new URL(value);
|
|
872
|
-
} catch {
|
|
873
|
-
return errorMessages?.url || "Please enter a valid URL";
|
|
874
|
-
}
|
|
875
|
-
}
|
|
876
|
-
if (type === "number") {
|
|
877
|
-
const numValue = parseFloat(value);
|
|
878
|
-
if (props.min !== void 0 && numValue < Number(props.min)) {
|
|
879
|
-
return errorMessages?.min || `Minimum value is ${props.min}`;
|
|
880
|
-
}
|
|
881
|
-
if (props.max !== void 0 && numValue > Number(props.max)) {
|
|
882
|
-
return errorMessages?.max || `Maximum value is ${props.max}`;
|
|
883
|
-
}
|
|
884
|
-
}
|
|
885
1200
|
if (props.minLength !== void 0 && value.length < props.minLength) {
|
|
886
1201
|
return errorMessages?.minLength || `Minimum length is ${props.minLength} characters`;
|
|
887
1202
|
}
|
|
888
1203
|
if (props.maxLength !== void 0 && value.length > props.maxLength) {
|
|
889
1204
|
return errorMessages?.maxLength || `Maximum length is ${props.maxLength} characters`;
|
|
890
1205
|
}
|
|
891
|
-
if (pattern) {
|
|
892
|
-
const regex = typeof pattern === "string" ? new RegExp(pattern) : pattern;
|
|
893
|
-
if (!regex.test(value)) {
|
|
894
|
-
return errorMessages?.pattern || "Invalid format";
|
|
895
|
-
}
|
|
896
|
-
}
|
|
897
1206
|
}
|
|
898
1207
|
if (validate) {
|
|
899
1208
|
return await validate(value);
|
|
@@ -903,13 +1212,18 @@ var Input = import_react4.default.forwardRef(
|
|
|
903
1212
|
form.registerField(name, validator);
|
|
904
1213
|
return () => form.unregisterField(name);
|
|
905
1214
|
} else if (formControl) {
|
|
906
|
-
const
|
|
907
|
-
if (
|
|
908
|
-
formControl.registerControl(
|
|
909
|
-
return () => formControl.unregisterControl(
|
|
1215
|
+
const textareaElement = internalRef.current;
|
|
1216
|
+
if (textareaElement) {
|
|
1217
|
+
formControl.registerControl(textareaElement);
|
|
1218
|
+
return () => formControl.unregisterControl(textareaElement);
|
|
910
1219
|
}
|
|
911
1220
|
}
|
|
912
1221
|
}, [form, formControl, name]);
|
|
1222
|
+
(0, import_react6.useEffect)(() => {
|
|
1223
|
+
if (autoResize) {
|
|
1224
|
+
adjustHeight();
|
|
1225
|
+
}
|
|
1226
|
+
}, [textareaValue, autoResize]);
|
|
913
1227
|
const handleChange = (e) => {
|
|
914
1228
|
const newValue = e.target.value;
|
|
915
1229
|
if (form && name) {
|
|
@@ -919,6 +1233,9 @@ var Input = import_react4.default.forwardRef(
|
|
|
919
1233
|
} else {
|
|
920
1234
|
runValidation(newValue);
|
|
921
1235
|
}
|
|
1236
|
+
if (autoResize) {
|
|
1237
|
+
adjustHeight();
|
|
1238
|
+
}
|
|
922
1239
|
onChange?.(e);
|
|
923
1240
|
};
|
|
924
1241
|
const handleBlur = (e) => {
|
|
@@ -935,103 +1252,90 @@ var Input = import_react4.default.forwardRef(
|
|
|
935
1252
|
onBlur?.(e);
|
|
936
1253
|
};
|
|
937
1254
|
const shouldRenderLabel = label && !formControl;
|
|
938
|
-
const shouldRenderError =
|
|
939
|
-
|
|
1255
|
+
const shouldRenderError = textareaError && !formControl;
|
|
1256
|
+
const resizeClasses = {
|
|
1257
|
+
none: "resize-none",
|
|
1258
|
+
vertical: "resize-y",
|
|
1259
|
+
horizontal: "resize-x",
|
|
1260
|
+
both: "resize"
|
|
1261
|
+
};
|
|
1262
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
940
1263
|
"div",
|
|
941
1264
|
{
|
|
942
1265
|
className: cn("flex flex-col", fullWidth && "w-full"),
|
|
943
1266
|
style: { marginBottom: "var(--form-control-spacing)" },
|
|
944
|
-
suppressHydrationWarning: true,
|
|
945
1267
|
children: [
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
1268
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "flex items-center justify-between mb-1", children: [
|
|
1269
|
+
shouldRenderLabel && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
1270
|
+
"label",
|
|
1271
|
+
{
|
|
1272
|
+
htmlFor: textareaId,
|
|
1273
|
+
className: "block text-small font-semibold text-(--color-muted-foreground)",
|
|
1274
|
+
children: [
|
|
1275
|
+
label,
|
|
1276
|
+
isRequired && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "ml-1", children: "*" })
|
|
1277
|
+
]
|
|
1278
|
+
}
|
|
1279
|
+
),
|
|
1280
|
+
showCharacterCount && maxLengthValue && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("span", { className: "text-small text-(--color-muted-foreground)", children: [
|
|
1281
|
+
currentLength,
|
|
1282
|
+
"/",
|
|
1283
|
+
maxLengthValue
|
|
1284
|
+
] })
|
|
1285
|
+
] }),
|
|
1286
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "relative", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
1287
|
+
"textarea",
|
|
960
1288
|
{
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
className: cn(
|
|
995
|
-
"w-full px-3 py-2 border rounded-md transition-colors",
|
|
996
|
-
"text-(--color-muted-foreground) placeholder-gray-400",
|
|
997
|
-
"focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent",
|
|
998
|
-
"disabled:bg-(--color-muted) disabled:cursor-not-allowed disabled:text-(--color-muted-foreground)",
|
|
999
|
-
inputError ? "border-error focus:ring-error" : "border-(--color-border)",
|
|
1000
|
-
leftIcon && "pl-10",
|
|
1001
|
-
rightIcon && "pr-10",
|
|
1002
|
-
className
|
|
1003
|
-
),
|
|
1004
|
-
...props
|
|
1005
|
-
}
|
|
1006
|
-
),
|
|
1007
|
-
rightIcon && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
1008
|
-
"div",
|
|
1009
|
-
{
|
|
1010
|
-
className: "absolute inset-y-0 right-0 pr-3 flex items-center pointer-events-none text-(--color-placeholder)",
|
|
1011
|
-
suppressHydrationWarning: true,
|
|
1012
|
-
children: rightIcon
|
|
1013
|
-
}
|
|
1014
|
-
)
|
|
1015
|
-
]
|
|
1289
|
+
ref: (node) => {
|
|
1290
|
+
if (typeof ref === "function") {
|
|
1291
|
+
ref(node);
|
|
1292
|
+
} else if (ref) {
|
|
1293
|
+
ref.current = node;
|
|
1294
|
+
}
|
|
1295
|
+
internalRef.current = node;
|
|
1296
|
+
},
|
|
1297
|
+
id: textareaId,
|
|
1298
|
+
value: textareaValue,
|
|
1299
|
+
onChange: handleChange,
|
|
1300
|
+
onBlur: handleBlur,
|
|
1301
|
+
disabled: isDisabled,
|
|
1302
|
+
required: isRequired,
|
|
1303
|
+
rows: autoResize ? void 0 : rows,
|
|
1304
|
+
"aria-invalid": !!textareaError,
|
|
1305
|
+
"aria-describedby": textareaError ? `${textareaId}-error` : helperText ? `${textareaId}-helper` : void 0,
|
|
1306
|
+
className: cn(
|
|
1307
|
+
"w-full px-3 py-2 border rounded-md transition-colors",
|
|
1308
|
+
"text-(--color-muted-foreground) placeholder-gray-400",
|
|
1309
|
+
"focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent",
|
|
1310
|
+
"disabled:bg-(--color-muted) disabled:cursor-not-allowed disabled:text-(--color-muted-foreground)",
|
|
1311
|
+
textareaError ? "border-error focus:ring-error" : "border-(--color-border)",
|
|
1312
|
+
resizeClasses[resize],
|
|
1313
|
+
autoResize && "overflow-hidden",
|
|
1314
|
+
!autoResize && "overflow-auto",
|
|
1315
|
+
className
|
|
1316
|
+
),
|
|
1317
|
+
style: autoResize ? {
|
|
1318
|
+
minHeight: `${rows * 1.5}em`,
|
|
1319
|
+
maxHeight: `${maxHeight}px`
|
|
1320
|
+
} : void 0,
|
|
1321
|
+
...props
|
|
1016
1322
|
}
|
|
1017
|
-
),
|
|
1018
|
-
/* @__PURE__ */ (0,
|
|
1019
|
-
shouldRenderError &&
|
|
1323
|
+
) }),
|
|
1324
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "h-5 mt-1.5", children: [
|
|
1325
|
+
shouldRenderError && textareaError && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
1020
1326
|
"p",
|
|
1021
1327
|
{
|
|
1022
1328
|
className: "text-small text-error",
|
|
1023
|
-
id: `${
|
|
1329
|
+
id: `${textareaId}-error`,
|
|
1024
1330
|
role: "alert",
|
|
1025
|
-
|
|
1026
|
-
children: inputError
|
|
1331
|
+
children: textareaError
|
|
1027
1332
|
}
|
|
1028
1333
|
),
|
|
1029
|
-
helperText && !
|
|
1334
|
+
helperText && !textareaError && !formControl && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
1030
1335
|
"p",
|
|
1031
1336
|
{
|
|
1032
1337
|
className: "text-small text-(--color-muted-foreground)",
|
|
1033
|
-
id: `${
|
|
1034
|
-
suppressHydrationWarning: true,
|
|
1338
|
+
id: `${textareaId}-helper`,
|
|
1035
1339
|
children: helperText
|
|
1036
1340
|
}
|
|
1037
1341
|
)
|
|
@@ -1041,12 +1345,12 @@ var Input = import_react4.default.forwardRef(
|
|
|
1041
1345
|
);
|
|
1042
1346
|
}
|
|
1043
1347
|
);
|
|
1044
|
-
|
|
1348
|
+
Textarea.displayName = "Textarea";
|
|
1045
1349
|
|
|
1046
1350
|
// src/ui/card.tsx
|
|
1047
|
-
var
|
|
1048
|
-
var
|
|
1049
|
-
var Card =
|
|
1351
|
+
var import_react7 = __toESM(require("react"));
|
|
1352
|
+
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
1353
|
+
var Card = import_react7.default.forwardRef(
|
|
1050
1354
|
({
|
|
1051
1355
|
className,
|
|
1052
1356
|
variant = "default",
|
|
@@ -1070,7 +1374,7 @@ var Card = import_react5.default.forwardRef(
|
|
|
1070
1374
|
lg: "p-6"
|
|
1071
1375
|
};
|
|
1072
1376
|
const hoverStyles = hoverable ? "hover:shadow-lg transition-shadow cursor-pointer" : "";
|
|
1073
|
-
return /* @__PURE__ */ (0,
|
|
1377
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
1074
1378
|
"div",
|
|
1075
1379
|
{
|
|
1076
1380
|
ref,
|
|
@@ -1086,7 +1390,7 @@ var Card = import_react5.default.forwardRef(
|
|
|
1086
1390
|
} : void 0,
|
|
1087
1391
|
...props,
|
|
1088
1392
|
children: [
|
|
1089
|
-
variant === "accent" && /* @__PURE__ */ (0,
|
|
1393
|
+
variant === "accent" && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
1090
1394
|
"div",
|
|
1091
1395
|
{
|
|
1092
1396
|
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",
|
|
@@ -1100,7 +1404,7 @@ var Card = import_react5.default.forwardRef(
|
|
|
1100
1404
|
}
|
|
1101
1405
|
);
|
|
1102
1406
|
Card.displayName = "Card";
|
|
1103
|
-
var CardHeader =
|
|
1407
|
+
var CardHeader = import_react7.default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
1104
1408
|
"div",
|
|
1105
1409
|
{
|
|
1106
1410
|
ref,
|
|
@@ -1109,7 +1413,7 @@ var CardHeader = import_react5.default.forwardRef(({ className, ...props }, ref)
|
|
|
1109
1413
|
}
|
|
1110
1414
|
));
|
|
1111
1415
|
CardHeader.displayName = "CardHeader";
|
|
1112
|
-
var CardTitle =
|
|
1416
|
+
var CardTitle = import_react7.default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
1113
1417
|
"h3",
|
|
1114
1418
|
{
|
|
1115
1419
|
ref,
|
|
@@ -1121,7 +1425,7 @@ var CardTitle = import_react5.default.forwardRef(({ className, ...props }, ref)
|
|
|
1121
1425
|
}
|
|
1122
1426
|
));
|
|
1123
1427
|
CardTitle.displayName = "CardTitle";
|
|
1124
|
-
var CardDescription =
|
|
1428
|
+
var CardDescription = import_react7.default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
1125
1429
|
"p",
|
|
1126
1430
|
{
|
|
1127
1431
|
ref,
|
|
@@ -1130,9 +1434,9 @@ var CardDescription = import_react5.default.forwardRef(({ className, ...props },
|
|
|
1130
1434
|
}
|
|
1131
1435
|
));
|
|
1132
1436
|
CardDescription.displayName = "CardDescription";
|
|
1133
|
-
var CardContent =
|
|
1437
|
+
var CardContent = import_react7.default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { ref, className: cn("pt-0", className), ...props }));
|
|
1134
1438
|
CardContent.displayName = "CardContent";
|
|
1135
|
-
var CardFooter =
|
|
1439
|
+
var CardFooter = import_react7.default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
1136
1440
|
"div",
|
|
1137
1441
|
{
|
|
1138
1442
|
ref,
|
|
@@ -1141,7 +1445,7 @@ var CardFooter = import_react5.default.forwardRef(({ className, ...props }, ref)
|
|
|
1141
1445
|
}
|
|
1142
1446
|
));
|
|
1143
1447
|
CardFooter.displayName = "CardFooter";
|
|
1144
|
-
var CardMedia =
|
|
1448
|
+
var CardMedia = import_react7.default.forwardRef(
|
|
1145
1449
|
({
|
|
1146
1450
|
className,
|
|
1147
1451
|
image,
|
|
@@ -1159,7 +1463,7 @@ var CardMedia = import_react5.default.forwardRef(
|
|
|
1159
1463
|
};
|
|
1160
1464
|
const objectFitClass = objectFit === "cover" ? "object-cover" : objectFit === "contain" ? "object-contain" : objectFit === "fill" ? "object-fill" : objectFit === "none" ? "object-none" : "object-scale-down";
|
|
1161
1465
|
if (component === "img" && image) {
|
|
1162
|
-
return /* @__PURE__ */ (0,
|
|
1466
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
1163
1467
|
"img",
|
|
1164
1468
|
{
|
|
1165
1469
|
ref,
|
|
@@ -1172,7 +1476,7 @@ var CardMedia = import_react5.default.forwardRef(
|
|
|
1172
1476
|
);
|
|
1173
1477
|
}
|
|
1174
1478
|
if (component === "video" && video) {
|
|
1175
|
-
return /* @__PURE__ */ (0,
|
|
1479
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
1176
1480
|
"video",
|
|
1177
1481
|
{
|
|
1178
1482
|
ref,
|
|
@@ -1183,7 +1487,7 @@ var CardMedia = import_react5.default.forwardRef(
|
|
|
1183
1487
|
}
|
|
1184
1488
|
);
|
|
1185
1489
|
}
|
|
1186
|
-
return /* @__PURE__ */ (0,
|
|
1490
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
1187
1491
|
"div",
|
|
1188
1492
|
{
|
|
1189
1493
|
ref,
|
|
@@ -1200,7 +1504,7 @@ var CardMedia = import_react5.default.forwardRef(
|
|
|
1200
1504
|
}
|
|
1201
1505
|
);
|
|
1202
1506
|
CardMedia.displayName = "CardMedia";
|
|
1203
|
-
var CardActions =
|
|
1507
|
+
var CardActions = import_react7.default.forwardRef(
|
|
1204
1508
|
({ className, disableSpacing = false, position = "left", ...props }, ref) => {
|
|
1205
1509
|
const justifyContent = {
|
|
1206
1510
|
left: "justify-start",
|
|
@@ -1212,7 +1516,7 @@ var CardActions = import_react5.default.forwardRef(
|
|
|
1212
1516
|
center: "px-4 py-4",
|
|
1213
1517
|
right: "pl-4 pr-4 py-4"
|
|
1214
1518
|
}[position];
|
|
1215
|
-
return /* @__PURE__ */ (0,
|
|
1519
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
1216
1520
|
"div",
|
|
1217
1521
|
{
|
|
1218
1522
|
ref,
|
|
@@ -1228,8 +1532,8 @@ var CardActions = import_react5.default.forwardRef(
|
|
|
1228
1532
|
}
|
|
1229
1533
|
);
|
|
1230
1534
|
CardActions.displayName = "CardActions";
|
|
1231
|
-
var CardActionArea =
|
|
1232
|
-
({ className, disabled = false, children, ...props }, ref) => /* @__PURE__ */ (0,
|
|
1535
|
+
var CardActionArea = import_react7.default.forwardRef(
|
|
1536
|
+
({ className, disabled = false, children, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
1233
1537
|
"div",
|
|
1234
1538
|
{
|
|
1235
1539
|
ref,
|
|
@@ -1251,9 +1555,9 @@ var CardActionArea = import_react5.default.forwardRef(
|
|
|
1251
1555
|
CardActionArea.displayName = "CardActionArea";
|
|
1252
1556
|
|
|
1253
1557
|
// src/ui/badge.tsx
|
|
1254
|
-
var
|
|
1255
|
-
var
|
|
1256
|
-
var Badge =
|
|
1558
|
+
var import_react8 = __toESM(require("react"));
|
|
1559
|
+
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
1560
|
+
var Badge = import_react8.default.forwardRef(
|
|
1257
1561
|
({
|
|
1258
1562
|
className,
|
|
1259
1563
|
variant = "default",
|
|
@@ -1300,7 +1604,7 @@ var Badge = import_react6.default.forwardRef(
|
|
|
1300
1604
|
lg: "w-4 h-4",
|
|
1301
1605
|
xl: "w-5 h-5"
|
|
1302
1606
|
};
|
|
1303
|
-
return /* @__PURE__ */ (0,
|
|
1607
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
|
1304
1608
|
"span",
|
|
1305
1609
|
{
|
|
1306
1610
|
ref,
|
|
@@ -1308,7 +1612,7 @@ var Badge = import_react6.default.forwardRef(
|
|
|
1308
1612
|
className: cn(baseStyles, sizes[size], className),
|
|
1309
1613
|
...props,
|
|
1310
1614
|
children: [
|
|
1311
|
-
leftIcon && /* @__PURE__ */ (0,
|
|
1615
|
+
leftIcon && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1312
1616
|
"span",
|
|
1313
1617
|
{
|
|
1314
1618
|
className: cn(
|
|
@@ -1319,7 +1623,7 @@ var Badge = import_react6.default.forwardRef(
|
|
|
1319
1623
|
}
|
|
1320
1624
|
),
|
|
1321
1625
|
children,
|
|
1322
|
-
rightIcon && /* @__PURE__ */ (0,
|
|
1626
|
+
rightIcon && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1323
1627
|
"span",
|
|
1324
1628
|
{
|
|
1325
1629
|
className: cn(
|
|
@@ -1337,8 +1641,8 @@ var Badge = import_react6.default.forwardRef(
|
|
|
1337
1641
|
Badge.displayName = "Badge";
|
|
1338
1642
|
|
|
1339
1643
|
// src/ui/checkbox.tsx
|
|
1340
|
-
var
|
|
1341
|
-
var
|
|
1644
|
+
var import_react9 = __toESM(require("react"));
|
|
1645
|
+
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
1342
1646
|
function Checkbox({
|
|
1343
1647
|
label,
|
|
1344
1648
|
name,
|
|
@@ -1354,13 +1658,13 @@ function Checkbox({
|
|
|
1354
1658
|
errorMessage
|
|
1355
1659
|
}) {
|
|
1356
1660
|
const form = useForm();
|
|
1357
|
-
const autoId = (0,
|
|
1358
|
-
const stableId = (0,
|
|
1661
|
+
const autoId = (0, import_react9.useId)();
|
|
1662
|
+
const stableId = (0, import_react9.useRef)(void 0);
|
|
1359
1663
|
if (!stableId.current) {
|
|
1360
1664
|
stableId.current = id || `checkbox-${autoId}`;
|
|
1361
1665
|
}
|
|
1362
1666
|
const checkboxId = stableId.current;
|
|
1363
|
-
const [validationError, setValidationError] = (0,
|
|
1667
|
+
const [validationError, setValidationError] = (0, import_react9.useState)();
|
|
1364
1668
|
let checked;
|
|
1365
1669
|
let displayError;
|
|
1366
1670
|
if (form && name) {
|
|
@@ -1376,7 +1680,7 @@ function Checkbox({
|
|
|
1376
1680
|
}
|
|
1377
1681
|
return void 0;
|
|
1378
1682
|
};
|
|
1379
|
-
(0,
|
|
1683
|
+
(0, import_react9.useEffect)(() => {
|
|
1380
1684
|
if (form && name) {
|
|
1381
1685
|
const validator = async (val) => {
|
|
1382
1686
|
if (required && !val) {
|
|
@@ -1425,10 +1729,10 @@ function Checkbox({
|
|
|
1425
1729
|
lg: "gap-2",
|
|
1426
1730
|
xl: "gap-2"
|
|
1427
1731
|
};
|
|
1428
|
-
return /* @__PURE__ */ (0,
|
|
1429
|
-
/* @__PURE__ */ (0,
|
|
1430
|
-
/* @__PURE__ */ (0,
|
|
1431
|
-
/* @__PURE__ */ (0,
|
|
1732
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: cn("flex flex-col", className), children: [
|
|
1733
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: cn("flex items-center", containerGapStyles[size]), children: [
|
|
1734
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "relative group/checkbox flex items-center shrink-0", children: [
|
|
1735
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 pointer-events-none", children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1432
1736
|
"div",
|
|
1433
1737
|
{
|
|
1434
1738
|
className: "rounded-full scale-0 group-hover/checkbox:scale-100 group-active/checkbox:scale-100 transition-transform duration-200 ease-out",
|
|
@@ -1439,7 +1743,7 @@ function Checkbox({
|
|
|
1439
1743
|
}
|
|
1440
1744
|
}
|
|
1441
1745
|
) }),
|
|
1442
|
-
/* @__PURE__ */ (0,
|
|
1746
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1443
1747
|
"input",
|
|
1444
1748
|
{
|
|
1445
1749
|
type: "checkbox",
|
|
@@ -1447,7 +1751,6 @@ function Checkbox({
|
|
|
1447
1751
|
checked,
|
|
1448
1752
|
onChange: handleChange,
|
|
1449
1753
|
disabled,
|
|
1450
|
-
suppressHydrationWarning: true,
|
|
1451
1754
|
className: cn(
|
|
1452
1755
|
"rounded focus:outline-none focus-visible:ring-2 focus-visible:ring-blue-500 focus-visible:ring-offset-2 transition-all relative z-10",
|
|
1453
1756
|
disabled && "cursor-not-allowed"
|
|
@@ -1463,7 +1766,7 @@ function Checkbox({
|
|
|
1463
1766
|
}
|
|
1464
1767
|
)
|
|
1465
1768
|
] }),
|
|
1466
|
-
label && /* @__PURE__ */ (0,
|
|
1769
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
|
1467
1770
|
"label",
|
|
1468
1771
|
{
|
|
1469
1772
|
htmlFor: checkboxId,
|
|
@@ -1472,7 +1775,6 @@ function Checkbox({
|
|
|
1472
1775
|
disabled && "cursor-not-allowed",
|
|
1473
1776
|
!disabled && "cursor-pointer"
|
|
1474
1777
|
),
|
|
1475
|
-
suppressHydrationWarning: true,
|
|
1476
1778
|
style: {
|
|
1477
1779
|
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)",
|
|
1478
1780
|
color: "var(--color-muted-foreground)",
|
|
@@ -1480,12 +1782,12 @@ function Checkbox({
|
|
|
1480
1782
|
},
|
|
1481
1783
|
children: [
|
|
1482
1784
|
label,
|
|
1483
|
-
required && /* @__PURE__ */ (0,
|
|
1785
|
+
required && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "ml-1", children: "*" })
|
|
1484
1786
|
]
|
|
1485
1787
|
}
|
|
1486
1788
|
)
|
|
1487
1789
|
] }),
|
|
1488
|
-
/* @__PURE__ */ (0,
|
|
1790
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "h-5 mt-1.5", children: displayError && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("p", { className: "text-small text-error", role: "alert", children: displayError }) })
|
|
1489
1791
|
] });
|
|
1490
1792
|
}
|
|
1491
1793
|
function CheckboxGroup({
|
|
@@ -1504,7 +1806,7 @@ function CheckboxGroup({
|
|
|
1504
1806
|
validate
|
|
1505
1807
|
}) {
|
|
1506
1808
|
const form = useForm();
|
|
1507
|
-
|
|
1809
|
+
import_react9.default.useEffect(() => {
|
|
1508
1810
|
if (form && name) {
|
|
1509
1811
|
const validator = validate || (required ? (value2) => {
|
|
1510
1812
|
if (!value2 || value2.length === 0) {
|
|
@@ -1535,24 +1837,24 @@ function CheckboxGroup({
|
|
|
1535
1837
|
lg: "gap-2",
|
|
1536
1838
|
xl: "gap-2"
|
|
1537
1839
|
};
|
|
1538
|
-
return /* @__PURE__ */ (0,
|
|
1840
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
|
1539
1841
|
"div",
|
|
1540
1842
|
{
|
|
1541
1843
|
className,
|
|
1542
1844
|
style: { marginBottom: "var(--form-control-spacing)" },
|
|
1543
1845
|
children: [
|
|
1544
|
-
label && /* @__PURE__ */ (0,
|
|
1846
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
|
1545
1847
|
"label",
|
|
1546
1848
|
{
|
|
1547
1849
|
className: "block text-small font-semibold mb-1",
|
|
1548
1850
|
style: { color: "var(--color-muted-foreground)" },
|
|
1549
1851
|
children: [
|
|
1550
1852
|
label,
|
|
1551
|
-
required && /* @__PURE__ */ (0,
|
|
1853
|
+
required && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "ml-1", children: "*" })
|
|
1552
1854
|
]
|
|
1553
1855
|
}
|
|
1554
1856
|
),
|
|
1555
|
-
/* @__PURE__ */ (0,
|
|
1857
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1556
1858
|
"div",
|
|
1557
1859
|
{
|
|
1558
1860
|
className: cn(
|
|
@@ -1560,7 +1862,7 @@ function CheckboxGroup({
|
|
|
1560
1862
|
),
|
|
1561
1863
|
children: options.map((option) => {
|
|
1562
1864
|
const isDisabled = disabled || option.disabled;
|
|
1563
|
-
return /* @__PURE__ */ (0,
|
|
1865
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
|
1564
1866
|
"div",
|
|
1565
1867
|
{
|
|
1566
1868
|
className: cn(
|
|
@@ -1568,8 +1870,8 @@ function CheckboxGroup({
|
|
|
1568
1870
|
containerGapStyles[size]
|
|
1569
1871
|
),
|
|
1570
1872
|
children: [
|
|
1571
|
-
/* @__PURE__ */ (0,
|
|
1572
|
-
/* @__PURE__ */ (0,
|
|
1873
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "relative group/checkbox flex items-center shrink-0", children: [
|
|
1874
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 pointer-events-none", children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1573
1875
|
"div",
|
|
1574
1876
|
{
|
|
1575
1877
|
className: "rounded-full scale-0 group-hover/checkbox:scale-100 group-active/checkbox:scale-100 transition-transform duration-200 ease-out",
|
|
@@ -1580,7 +1882,7 @@ function CheckboxGroup({
|
|
|
1580
1882
|
}
|
|
1581
1883
|
}
|
|
1582
1884
|
) }),
|
|
1583
|
-
/* @__PURE__ */ (0,
|
|
1885
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1584
1886
|
"input",
|
|
1585
1887
|
{
|
|
1586
1888
|
type: "checkbox",
|
|
@@ -1608,7 +1910,7 @@ function CheckboxGroup({
|
|
|
1608
1910
|
}
|
|
1609
1911
|
)
|
|
1610
1912
|
] }),
|
|
1611
|
-
/* @__PURE__ */ (0,
|
|
1913
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1612
1914
|
"label",
|
|
1613
1915
|
{
|
|
1614
1916
|
htmlFor: `${name}-${option.value}`,
|
|
@@ -1632,7 +1934,7 @@ function CheckboxGroup({
|
|
|
1632
1934
|
})
|
|
1633
1935
|
}
|
|
1634
1936
|
),
|
|
1635
|
-
/* @__PURE__ */ (0,
|
|
1937
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "h-5 mt-1.5", children: (error || helperText) && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1636
1938
|
"p",
|
|
1637
1939
|
{
|
|
1638
1940
|
className: `text-small ${error ? "text-error" : "text-(--color-muted-foreground)"}`,
|
|
@@ -1646,8 +1948,8 @@ function CheckboxGroup({
|
|
|
1646
1948
|
}
|
|
1647
1949
|
|
|
1648
1950
|
// src/ui/radio.tsx
|
|
1649
|
-
var
|
|
1650
|
-
var
|
|
1951
|
+
var import_react10 = require("react");
|
|
1952
|
+
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
1651
1953
|
function RadioGroup({
|
|
1652
1954
|
label,
|
|
1653
1955
|
name,
|
|
@@ -1665,8 +1967,8 @@ function RadioGroup({
|
|
|
1665
1967
|
validate
|
|
1666
1968
|
}) {
|
|
1667
1969
|
const form = useForm();
|
|
1668
|
-
const [validationError, setValidationError] = (0,
|
|
1669
|
-
const [touched, setTouched] = (0,
|
|
1970
|
+
const [validationError, setValidationError] = (0, import_react10.useState)();
|
|
1971
|
+
const [touched, setTouched] = (0, import_react10.useState)(false);
|
|
1670
1972
|
let value;
|
|
1671
1973
|
let displayError;
|
|
1672
1974
|
if (form && name) {
|
|
@@ -1676,7 +1978,7 @@ function RadioGroup({
|
|
|
1676
1978
|
value = externalValue;
|
|
1677
1979
|
displayError = error || validationError;
|
|
1678
1980
|
}
|
|
1679
|
-
(0,
|
|
1981
|
+
(0, import_react10.useEffect)(() => {
|
|
1680
1982
|
if (form && name) {
|
|
1681
1983
|
const validator = async (val) => {
|
|
1682
1984
|
if (required && !val) {
|
|
@@ -1691,7 +1993,7 @@ function RadioGroup({
|
|
|
1691
1993
|
return () => form.unregisterField(name);
|
|
1692
1994
|
}
|
|
1693
1995
|
}, [form, name]);
|
|
1694
|
-
(0,
|
|
1996
|
+
(0, import_react10.useEffect)(() => {
|
|
1695
1997
|
if (!form && touched && required && !value) {
|
|
1696
1998
|
setValidationError(errorMessage || "Please select an option");
|
|
1697
1999
|
} else if (!form) {
|
|
@@ -1716,24 +2018,24 @@ function RadioGroup({
|
|
|
1716
2018
|
lg: "gap-2",
|
|
1717
2019
|
xl: "gap-2"
|
|
1718
2020
|
};
|
|
1719
|
-
return /* @__PURE__ */ (0,
|
|
2021
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
1720
2022
|
"div",
|
|
1721
2023
|
{
|
|
1722
2024
|
className,
|
|
1723
2025
|
style: { marginBottom: "var(--form-control-spacing)" },
|
|
1724
2026
|
children: [
|
|
1725
|
-
label && /* @__PURE__ */ (0,
|
|
2027
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
1726
2028
|
"label",
|
|
1727
2029
|
{
|
|
1728
2030
|
className: "block text-small font-semibold mb-1",
|
|
1729
2031
|
style: { color: "var(--color-muted-foreground)" },
|
|
1730
2032
|
children: [
|
|
1731
2033
|
label,
|
|
1732
|
-
required && /* @__PURE__ */ (0,
|
|
2034
|
+
required && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "ml-1", children: "*" })
|
|
1733
2035
|
]
|
|
1734
2036
|
}
|
|
1735
2037
|
),
|
|
1736
|
-
/* @__PURE__ */ (0,
|
|
2038
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1737
2039
|
"div",
|
|
1738
2040
|
{
|
|
1739
2041
|
className: cn(
|
|
@@ -1742,7 +2044,7 @@ function RadioGroup({
|
|
|
1742
2044
|
),
|
|
1743
2045
|
children: options.map((option) => {
|
|
1744
2046
|
const isDisabled = disabled || option.disabled;
|
|
1745
|
-
return /* @__PURE__ */ (0,
|
|
2047
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
1746
2048
|
"div",
|
|
1747
2049
|
{
|
|
1748
2050
|
className: cn(
|
|
@@ -1750,8 +2052,8 @@ function RadioGroup({
|
|
|
1750
2052
|
containerGapStyles[size]
|
|
1751
2053
|
),
|
|
1752
2054
|
children: [
|
|
1753
|
-
/* @__PURE__ */ (0,
|
|
1754
|
-
/* @__PURE__ */ (0,
|
|
2055
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "relative group/radio flex items-center shrink-0", children: [
|
|
2056
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 pointer-events-none", children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1755
2057
|
"div",
|
|
1756
2058
|
{
|
|
1757
2059
|
className: "rounded-full scale-0 group-hover/radio:scale-100 group-active/radio:scale-100 transition-transform duration-200 ease-out",
|
|
@@ -1762,7 +2064,7 @@ function RadioGroup({
|
|
|
1762
2064
|
}
|
|
1763
2065
|
}
|
|
1764
2066
|
) }),
|
|
1765
|
-
/* @__PURE__ */ (0,
|
|
2067
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1766
2068
|
"input",
|
|
1767
2069
|
{
|
|
1768
2070
|
type: "radio",
|
|
@@ -1787,7 +2089,7 @@ function RadioGroup({
|
|
|
1787
2089
|
}
|
|
1788
2090
|
)
|
|
1789
2091
|
] }),
|
|
1790
|
-
/* @__PURE__ */ (0,
|
|
2092
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1791
2093
|
"label",
|
|
1792
2094
|
{
|
|
1793
2095
|
htmlFor: `${name}-${option.value}`,
|
|
@@ -1811,7 +2113,7 @@ function RadioGroup({
|
|
|
1811
2113
|
})
|
|
1812
2114
|
}
|
|
1813
2115
|
),
|
|
1814
|
-
/* @__PURE__ */ (0,
|
|
2116
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "h-5 mt-1.5", children: (displayError || helperText) && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1815
2117
|
"p",
|
|
1816
2118
|
{
|
|
1817
2119
|
className: `text-small ${displayError ? "text-error" : "text-(--color-muted-foreground)"}`,
|
|
@@ -1826,8 +2128,8 @@ function RadioGroup({
|
|
|
1826
2128
|
|
|
1827
2129
|
// src/ui/select.tsx
|
|
1828
2130
|
var import_lucide_react = require("lucide-react");
|
|
1829
|
-
var
|
|
1830
|
-
var
|
|
2131
|
+
var import_react11 = require("react");
|
|
2132
|
+
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
1831
2133
|
function Select({
|
|
1832
2134
|
name,
|
|
1833
2135
|
label,
|
|
@@ -1847,9 +2149,9 @@ function Select({
|
|
|
1847
2149
|
errorMessage
|
|
1848
2150
|
}) {
|
|
1849
2151
|
const form = useForm();
|
|
1850
|
-
const [isOpen, setIsOpen] = (0,
|
|
1851
|
-
const dropdownRef = (0,
|
|
1852
|
-
const [validationError, _setValidationError] = (0,
|
|
2152
|
+
const [isOpen, setIsOpen] = (0, import_react11.useState)(false);
|
|
2153
|
+
const dropdownRef = (0, import_react11.useRef)(null);
|
|
2154
|
+
const [validationError, _setValidationError] = (0, import_react11.useState)();
|
|
1853
2155
|
let value;
|
|
1854
2156
|
let displayError;
|
|
1855
2157
|
if (form && name) {
|
|
@@ -1859,7 +2161,7 @@ function Select({
|
|
|
1859
2161
|
value = externalValue;
|
|
1860
2162
|
displayError = error || validationError;
|
|
1861
2163
|
}
|
|
1862
|
-
(0,
|
|
2164
|
+
(0, import_react11.useEffect)(() => {
|
|
1863
2165
|
if (form && name) {
|
|
1864
2166
|
const validator = async (val) => {
|
|
1865
2167
|
if (required && (val === void 0 || val === null || val === "")) {
|
|
@@ -1900,7 +2202,7 @@ function Select({
|
|
|
1900
2202
|
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)]`,
|
|
1901
2203
|
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)]`
|
|
1902
2204
|
};
|
|
1903
|
-
(0,
|
|
2205
|
+
(0, import_react11.useEffect)(() => {
|
|
1904
2206
|
const handleClickOutside = (event) => {
|
|
1905
2207
|
if (dropdownRef.current && !dropdownRef.current.contains(event.target)) {
|
|
1906
2208
|
setIsOpen(false);
|
|
@@ -1939,25 +2241,25 @@ function Select({
|
|
|
1939
2241
|
setIsOpen(false);
|
|
1940
2242
|
}
|
|
1941
2243
|
};
|
|
1942
|
-
return /* @__PURE__ */ (0,
|
|
2244
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
|
|
1943
2245
|
"div",
|
|
1944
2246
|
{
|
|
1945
2247
|
className: `w-full ${className}`,
|
|
1946
2248
|
style: { marginBottom: "var(--form-control-spacing)" },
|
|
1947
2249
|
children: [
|
|
1948
|
-
label && /* @__PURE__ */ (0,
|
|
2250
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
|
|
1949
2251
|
"label",
|
|
1950
2252
|
{
|
|
1951
2253
|
className: "block text-small font-semibold mb-1",
|
|
1952
2254
|
style: { color: "var(--color-muted-foreground)" },
|
|
1953
2255
|
children: [
|
|
1954
2256
|
label,
|
|
1955
|
-
required && /* @__PURE__ */ (0,
|
|
2257
|
+
required && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "ml-1", children: "*" })
|
|
1956
2258
|
]
|
|
1957
2259
|
}
|
|
1958
2260
|
),
|
|
1959
|
-
/* @__PURE__ */ (0,
|
|
1960
|
-
/* @__PURE__ */ (0,
|
|
2261
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { ref: dropdownRef, className: "relative", children: [
|
|
2262
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
|
|
1961
2263
|
"button",
|
|
1962
2264
|
{
|
|
1963
2265
|
type: "button",
|
|
@@ -1973,9 +2275,9 @@ function Select({
|
|
|
1973
2275
|
${!value ? "text-(--color-placeholder)" : "text-(--color-foreground)"}
|
|
1974
2276
|
`,
|
|
1975
2277
|
children: [
|
|
1976
|
-
/* @__PURE__ */ (0,
|
|
1977
|
-
/* @__PURE__ */ (0,
|
|
1978
|
-
value && /* @__PURE__ */ (0,
|
|
2278
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "truncate", children: getSelectedLabel() }),
|
|
2279
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "flex items-center gap-1 ml-2", children: [
|
|
2280
|
+
value && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1979
2281
|
"div",
|
|
1980
2282
|
{
|
|
1981
2283
|
onClick: handleClear,
|
|
@@ -1983,7 +2285,7 @@ function Select({
|
|
|
1983
2285
|
role: "button",
|
|
1984
2286
|
"aria-label": "Clear selection",
|
|
1985
2287
|
tabIndex: -1,
|
|
1986
|
-
children: /* @__PURE__ */ (0,
|
|
2288
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1987
2289
|
import_lucide_react.X,
|
|
1988
2290
|
{
|
|
1989
2291
|
className: `${iconSizeStyles[size]} text-(--color-muted-foreground)`
|
|
@@ -1991,7 +2293,7 @@ function Select({
|
|
|
1991
2293
|
)
|
|
1992
2294
|
}
|
|
1993
2295
|
),
|
|
1994
|
-
/* @__PURE__ */ (0,
|
|
2296
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1995
2297
|
import_lucide_react.ChevronDown,
|
|
1996
2298
|
{
|
|
1997
2299
|
className: `${iconSizeStyles[size]} text-(--color-placeholder) transition-transform duration-200 shrink-0 ${isOpen ? "transform rotate-180" : ""}`
|
|
@@ -2001,18 +2303,18 @@ function Select({
|
|
|
2001
2303
|
]
|
|
2002
2304
|
}
|
|
2003
2305
|
),
|
|
2004
|
-
isOpen && !disabled && /* @__PURE__ */ (0,
|
|
2306
|
+
isOpen && !disabled && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
2005
2307
|
"div",
|
|
2006
2308
|
{
|
|
2007
2309
|
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",
|
|
2008
2310
|
role: "listbox",
|
|
2009
2311
|
children: children ? (
|
|
2010
2312
|
// Custom content
|
|
2011
|
-
/* @__PURE__ */ (0,
|
|
2313
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { onClick: () => setIsOpen(false), children })
|
|
2012
2314
|
) : (
|
|
2013
2315
|
// Standard options
|
|
2014
|
-
/* @__PURE__ */ (0,
|
|
2015
|
-
/* @__PURE__ */ (0,
|
|
2316
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("ul", { children: [
|
|
2317
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("li", { children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
2016
2318
|
"button",
|
|
2017
2319
|
{
|
|
2018
2320
|
type: "button",
|
|
@@ -2027,7 +2329,7 @@ function Select({
|
|
|
2027
2329
|
children: placeholder
|
|
2028
2330
|
}
|
|
2029
2331
|
) }, "__placeholder__"),
|
|
2030
|
-
options.map((option) => /* @__PURE__ */ (0,
|
|
2332
|
+
options.map((option) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("li", { children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
2031
2333
|
"button",
|
|
2032
2334
|
{
|
|
2033
2335
|
type: "button",
|
|
@@ -2049,7 +2351,7 @@ function Select({
|
|
|
2049
2351
|
}
|
|
2050
2352
|
)
|
|
2051
2353
|
] }),
|
|
2052
|
-
/* @__PURE__ */ (0,
|
|
2354
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "h-5 mt-1.5", children: (helperText || displayError) && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
2053
2355
|
"p",
|
|
2054
2356
|
{
|
|
2055
2357
|
className: `text-small ${displayError ? "text-error" : "text-(--color-muted-foreground)"}`,
|
|
@@ -2062,9 +2364,9 @@ function Select({
|
|
|
2062
2364
|
}
|
|
2063
2365
|
|
|
2064
2366
|
// src/ui/spinner.tsx
|
|
2065
|
-
var
|
|
2066
|
-
var
|
|
2067
|
-
var Spinner =
|
|
2367
|
+
var import_react12 = __toESM(require("react"));
|
|
2368
|
+
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
2369
|
+
var Spinner = import_react12.default.forwardRef(
|
|
2068
2370
|
({ className, size = "md", color = "primary", label, ...props }, ref) => {
|
|
2069
2371
|
const sizes = {
|
|
2070
2372
|
sm: "h-4 w-4",
|
|
@@ -2077,7 +2379,7 @@ var Spinner = import_react10.default.forwardRef(
|
|
|
2077
2379
|
secondary: "text-(--color-muted-foreground)",
|
|
2078
2380
|
white: "text-white"
|
|
2079
2381
|
};
|
|
2080
|
-
return /* @__PURE__ */ (0,
|
|
2382
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
|
|
2081
2383
|
"div",
|
|
2082
2384
|
{
|
|
2083
2385
|
ref,
|
|
@@ -2087,7 +2389,7 @@ var Spinner = import_react10.default.forwardRef(
|
|
|
2087
2389
|
),
|
|
2088
2390
|
...props,
|
|
2089
2391
|
children: [
|
|
2090
|
-
/* @__PURE__ */ (0,
|
|
2392
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
|
|
2091
2393
|
"svg",
|
|
2092
2394
|
{
|
|
2093
2395
|
className: cn("animate-spin", sizes[size], colors[color]),
|
|
@@ -2095,7 +2397,7 @@ var Spinner = import_react10.default.forwardRef(
|
|
|
2095
2397
|
fill: "none",
|
|
2096
2398
|
viewBox: "0 0 24 24",
|
|
2097
2399
|
children: [
|
|
2098
|
-
/* @__PURE__ */ (0,
|
|
2400
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
2099
2401
|
"circle",
|
|
2100
2402
|
{
|
|
2101
2403
|
className: "opacity-25",
|
|
@@ -2106,7 +2408,7 @@ var Spinner = import_react10.default.forwardRef(
|
|
|
2106
2408
|
strokeWidth: "4"
|
|
2107
2409
|
}
|
|
2108
2410
|
),
|
|
2109
|
-
/* @__PURE__ */ (0,
|
|
2411
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
2110
2412
|
"path",
|
|
2111
2413
|
{
|
|
2112
2414
|
className: "opacity-75",
|
|
@@ -2117,7 +2419,7 @@ var Spinner = import_react10.default.forwardRef(
|
|
|
2117
2419
|
]
|
|
2118
2420
|
}
|
|
2119
2421
|
),
|
|
2120
|
-
label && /* @__PURE__ */ (0,
|
|
2422
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("p", { className: "text-small text-(--color-muted-foreground)", children: label })
|
|
2121
2423
|
]
|
|
2122
2424
|
}
|
|
2123
2425
|
);
|
|
@@ -2127,8 +2429,8 @@ Spinner.displayName = "Spinner";
|
|
|
2127
2429
|
|
|
2128
2430
|
// src/ui/code-snippet.tsx
|
|
2129
2431
|
var import_prism_react_renderer = require("prism-react-renderer");
|
|
2130
|
-
var
|
|
2131
|
-
var
|
|
2432
|
+
var import_react13 = require("react");
|
|
2433
|
+
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
2132
2434
|
function CodeSnippet({
|
|
2133
2435
|
code,
|
|
2134
2436
|
language = "tsx",
|
|
@@ -2140,8 +2442,8 @@ function CodeSnippet({
|
|
|
2140
2442
|
body: "text-body",
|
|
2141
2443
|
h6: "text-h6"
|
|
2142
2444
|
};
|
|
2143
|
-
const [copied, setCopied] = (0,
|
|
2144
|
-
const [showTooltip, setShowTooltip] = (0,
|
|
2445
|
+
const [copied, setCopied] = (0, import_react13.useState)(false);
|
|
2446
|
+
const [showTooltip, setShowTooltip] = (0, import_react13.useState)(false);
|
|
2145
2447
|
const handleCopy = async () => {
|
|
2146
2448
|
try {
|
|
2147
2449
|
await navigator.clipboard.writeText(code);
|
|
@@ -2151,9 +2453,9 @@ function CodeSnippet({
|
|
|
2151
2453
|
console.error("Failed to copy:", err);
|
|
2152
2454
|
}
|
|
2153
2455
|
};
|
|
2154
|
-
return /* @__PURE__ */ (0,
|
|
2155
|
-
/* @__PURE__ */ (0,
|
|
2156
|
-
/* @__PURE__ */ (0,
|
|
2456
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "relative group w-full", children: [
|
|
2457
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "absolute right-3 top-3 [z-index:var(--z-index-code-button)]", children: [
|
|
2458
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
2157
2459
|
"button",
|
|
2158
2460
|
{
|
|
2159
2461
|
onClick: handleCopy,
|
|
@@ -2163,14 +2465,14 @@ function CodeSnippet({
|
|
|
2163
2465
|
"aria-label": "Copy code",
|
|
2164
2466
|
children: copied ? (
|
|
2165
2467
|
// Check icon
|
|
2166
|
-
/* @__PURE__ */ (0,
|
|
2468
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
2167
2469
|
"svg",
|
|
2168
2470
|
{
|
|
2169
2471
|
className: "w-4 h-4 text-green-400",
|
|
2170
2472
|
fill: "none",
|
|
2171
2473
|
stroke: "currentColor",
|
|
2172
2474
|
viewBox: "0 0 24 24",
|
|
2173
|
-
children: /* @__PURE__ */ (0,
|
|
2475
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
2174
2476
|
"path",
|
|
2175
2477
|
{
|
|
2176
2478
|
strokeLinecap: "round",
|
|
@@ -2183,14 +2485,14 @@ function CodeSnippet({
|
|
|
2183
2485
|
)
|
|
2184
2486
|
) : (
|
|
2185
2487
|
// Copy icon
|
|
2186
|
-
/* @__PURE__ */ (0,
|
|
2488
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
2187
2489
|
"svg",
|
|
2188
2490
|
{
|
|
2189
2491
|
className: "w-4 h-4",
|
|
2190
2492
|
fill: "none",
|
|
2191
2493
|
stroke: "currentColor",
|
|
2192
2494
|
viewBox: "0 0 24 24",
|
|
2193
|
-
children: /* @__PURE__ */ (0,
|
|
2495
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
2194
2496
|
"path",
|
|
2195
2497
|
{
|
|
2196
2498
|
strokeLinecap: "round",
|
|
@@ -2204,26 +2506,26 @@ function CodeSnippet({
|
|
|
2204
2506
|
)
|
|
2205
2507
|
}
|
|
2206
2508
|
),
|
|
2207
|
-
showTooltip && !copied && /* @__PURE__ */ (0,
|
|
2509
|
+
showTooltip && !copied && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("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: [
|
|
2208
2510
|
"Copy code",
|
|
2209
|
-
/* @__PURE__ */ (0,
|
|
2511
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "absolute -top-1 right-3 w-2 h-2 bg-[#1f2937] border-l border-t border-[#374151] transform rotate-45" })
|
|
2210
2512
|
] }),
|
|
2211
|
-
copied && /* @__PURE__ */ (0,
|
|
2513
|
+
copied && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("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: [
|
|
2212
2514
|
"Copied!",
|
|
2213
|
-
/* @__PURE__ */ (0,
|
|
2515
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "absolute -top-1 right-3 w-2 h-2 bg-green-600 transform rotate-45" })
|
|
2214
2516
|
] })
|
|
2215
2517
|
] }),
|
|
2216
|
-
/* @__PURE__ */ (0,
|
|
2518
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
2217
2519
|
"div",
|
|
2218
2520
|
{
|
|
2219
2521
|
className: `rounded-lg overflow-x-auto border border-[#1f2937] ${fontSizeClassMap[fontSize]} code-snippet-${fontSize}`,
|
|
2220
|
-
children: /* @__PURE__ */ (0,
|
|
2522
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
2221
2523
|
import_prism_react_renderer.Highlight,
|
|
2222
2524
|
{
|
|
2223
2525
|
theme: import_prism_react_renderer.themes.vsDark,
|
|
2224
2526
|
code,
|
|
2225
2527
|
language,
|
|
2226
|
-
children: ({ style, tokens, getLineProps, getTokenProps }) => /* @__PURE__ */ (0,
|
|
2528
|
+
children: ({ style, tokens, getLineProps, getTokenProps }) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
2227
2529
|
"pre",
|
|
2228
2530
|
{
|
|
2229
2531
|
style: {
|
|
@@ -2235,7 +2537,7 @@ function CodeSnippet({
|
|
|
2235
2537
|
whiteSpace: wrap ? "pre-wrap" : "pre",
|
|
2236
2538
|
wordBreak: wrap ? "break-word" : "normal"
|
|
2237
2539
|
},
|
|
2238
|
-
children: tokens.map((line, i) => /* @__PURE__ */ (0,
|
|
2540
|
+
children: tokens.map((line, i) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { ...getLineProps({ line }), children: line.map((token, key) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
2239
2541
|
"span",
|
|
2240
2542
|
{
|
|
2241
2543
|
...getTokenProps({ token })
|
|
@@ -2253,8 +2555,8 @@ function CodeSnippet({
|
|
|
2253
2555
|
|
|
2254
2556
|
// src/ui/rating.tsx
|
|
2255
2557
|
var import_lucide_react2 = require("lucide-react");
|
|
2256
|
-
var
|
|
2257
|
-
var
|
|
2558
|
+
var import_react14 = __toESM(require("react"));
|
|
2559
|
+
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
2258
2560
|
var Rating = ({
|
|
2259
2561
|
value,
|
|
2260
2562
|
max = 5,
|
|
@@ -2269,8 +2571,8 @@ var Rating = ({
|
|
|
2269
2571
|
valuePosition = "inline",
|
|
2270
2572
|
valueFormat = "decimal"
|
|
2271
2573
|
}) => {
|
|
2272
|
-
const uniqueId = (0,
|
|
2273
|
-
const [hoverValue, setHoverValue] =
|
|
2574
|
+
const uniqueId = (0, import_react14.useId)();
|
|
2575
|
+
const [hoverValue, setHoverValue] = import_react14.default.useState(null);
|
|
2274
2576
|
const handleStarClick = (starIndex) => {
|
|
2275
2577
|
if (interactive && onChange) {
|
|
2276
2578
|
onChange(starIndex);
|
|
@@ -2296,7 +2598,7 @@ var Rating = ({
|
|
|
2296
2598
|
const isHalf = displayValue >= i - 0.5 && displayValue < i;
|
|
2297
2599
|
const isEmpty = displayValue < i - 0.5;
|
|
2298
2600
|
stars.push(
|
|
2299
|
-
/* @__PURE__ */ (0,
|
|
2601
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
|
|
2300
2602
|
"span",
|
|
2301
2603
|
{
|
|
2302
2604
|
onClick: () => handleStarClick(i),
|
|
@@ -2329,7 +2631,7 @@ var Rating = ({
|
|
|
2329
2631
|
},
|
|
2330
2632
|
className: responsive ? "sm:w-(--star-size) sm:h-(--star-size) w-(--star-mobile-size) h-(--star-mobile-size)" : "",
|
|
2331
2633
|
children: [
|
|
2332
|
-
/* @__PURE__ */ (0,
|
|
2634
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
2333
2635
|
import_lucide_react2.Star,
|
|
2334
2636
|
{
|
|
2335
2637
|
size: displaySize,
|
|
@@ -2338,7 +2640,7 @@ var Rating = ({
|
|
|
2338
2640
|
style: { position: "absolute", left: 0, top: 0 }
|
|
2339
2641
|
}
|
|
2340
2642
|
),
|
|
2341
|
-
isFull && /* @__PURE__ */ (0,
|
|
2643
|
+
isFull && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
2342
2644
|
import_lucide_react2.Star,
|
|
2343
2645
|
{
|
|
2344
2646
|
size: displaySize,
|
|
@@ -2347,7 +2649,7 @@ var Rating = ({
|
|
|
2347
2649
|
style: { position: "absolute", left: 0, top: 0 }
|
|
2348
2650
|
}
|
|
2349
2651
|
),
|
|
2350
|
-
isHalf && /* @__PURE__ */ (0,
|
|
2652
|
+
isHalf && /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
|
|
2351
2653
|
"svg",
|
|
2352
2654
|
{
|
|
2353
2655
|
width: displaySize,
|
|
@@ -2355,7 +2657,7 @@ var Rating = ({
|
|
|
2355
2657
|
viewBox: `0 0 ${displaySize} ${displaySize}`,
|
|
2356
2658
|
style: { position: "absolute", left: 0, top: 0 },
|
|
2357
2659
|
children: [
|
|
2358
|
-
/* @__PURE__ */ (0,
|
|
2660
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("defs", { children: /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
|
|
2359
2661
|
"linearGradient",
|
|
2360
2662
|
{
|
|
2361
2663
|
id: `half-${uniqueId}-${i}`,
|
|
@@ -2364,12 +2666,12 @@ var Rating = ({
|
|
|
2364
2666
|
y1: "0",
|
|
2365
2667
|
y2: "0",
|
|
2366
2668
|
children: [
|
|
2367
|
-
/* @__PURE__ */ (0,
|
|
2368
|
-
/* @__PURE__ */ (0,
|
|
2669
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("stop", { offset: "50%", stopColor: color }),
|
|
2670
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("stop", { offset: "50%", stopColor: "transparent" })
|
|
2369
2671
|
]
|
|
2370
2672
|
}
|
|
2371
2673
|
) }),
|
|
2372
|
-
/* @__PURE__ */ (0,
|
|
2674
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
2373
2675
|
import_lucide_react2.Star,
|
|
2374
2676
|
{
|
|
2375
2677
|
size: displaySize,
|
|
@@ -2388,7 +2690,7 @@ var Rating = ({
|
|
|
2388
2690
|
}
|
|
2389
2691
|
const valueText = valueFormat === "fraction" ? `${value.toFixed(1)}/${max}` : value.toFixed(1);
|
|
2390
2692
|
if (showValue && valuePosition === "bottom") {
|
|
2391
|
-
return /* @__PURE__ */ (0,
|
|
2693
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
|
|
2392
2694
|
"div",
|
|
2393
2695
|
{
|
|
2394
2696
|
className,
|
|
@@ -2399,7 +2701,7 @@ var Rating = ({
|
|
|
2399
2701
|
gap: gap * 2
|
|
2400
2702
|
},
|
|
2401
2703
|
children: [
|
|
2402
|
-
/* @__PURE__ */ (0,
|
|
2704
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
2403
2705
|
"div",
|
|
2404
2706
|
{
|
|
2405
2707
|
style: {
|
|
@@ -2410,7 +2712,7 @@ var Rating = ({
|
|
|
2410
2712
|
children: stars
|
|
2411
2713
|
}
|
|
2412
2714
|
),
|
|
2413
|
-
/* @__PURE__ */ (0,
|
|
2715
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
2414
2716
|
"span",
|
|
2415
2717
|
{
|
|
2416
2718
|
style: {
|
|
@@ -2425,7 +2727,7 @@ var Rating = ({
|
|
|
2425
2727
|
}
|
|
2426
2728
|
);
|
|
2427
2729
|
}
|
|
2428
|
-
return /* @__PURE__ */ (0,
|
|
2730
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
|
|
2429
2731
|
"div",
|
|
2430
2732
|
{
|
|
2431
2733
|
className,
|
|
@@ -2438,7 +2740,7 @@ var Rating = ({
|
|
|
2438
2740
|
},
|
|
2439
2741
|
children: [
|
|
2440
2742
|
stars,
|
|
2441
|
-
showValue && /* @__PURE__ */ (0,
|
|
2743
|
+
showValue && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
2442
2744
|
"span",
|
|
2443
2745
|
{
|
|
2444
2746
|
style: {
|
|
@@ -2456,7 +2758,7 @@ var Rating = ({
|
|
|
2456
2758
|
};
|
|
2457
2759
|
|
|
2458
2760
|
// src/ui/divider.tsx
|
|
2459
|
-
var
|
|
2761
|
+
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
2460
2762
|
var Divider = ({
|
|
2461
2763
|
variant = "fullWidth",
|
|
2462
2764
|
orientation = "horizontal",
|
|
@@ -2486,21 +2788,21 @@ var Divider = ({
|
|
|
2486
2788
|
if (children) {
|
|
2487
2789
|
const leftLineClasses = textAlign === "left" ? `${baseClasses} ${orientationClasses}` : `flex-1 ${baseClasses} ${orientationClasses}`;
|
|
2488
2790
|
const rightLineClasses = textAlign === "right" ? `${baseClasses} ${orientationClasses}` : `flex-1 ${baseClasses} ${orientationClasses}`;
|
|
2489
|
-
return /* @__PURE__ */ (0,
|
|
2791
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
|
|
2490
2792
|
"div",
|
|
2491
2793
|
{
|
|
2492
2794
|
role: "presentation",
|
|
2493
2795
|
className: `flex items-center gap-3 ${variantClasses[variant]} ${className}`,
|
|
2494
2796
|
children: [
|
|
2495
|
-
textAlign !== "left" && /* @__PURE__ */ (0,
|
|
2797
|
+
textAlign !== "left" && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
2496
2798
|
"div",
|
|
2497
2799
|
{
|
|
2498
2800
|
style: { ...baseStyles, ...thicknessStyle },
|
|
2499
2801
|
className: leftLineClasses
|
|
2500
2802
|
}
|
|
2501
2803
|
),
|
|
2502
|
-
/* @__PURE__ */ (0,
|
|
2503
|
-
textAlign !== "right" && /* @__PURE__ */ (0,
|
|
2804
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { style: textStyles, className: "whitespace-nowrap", children }),
|
|
2805
|
+
textAlign !== "right" && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
2504
2806
|
"div",
|
|
2505
2807
|
{
|
|
2506
2808
|
style: { ...baseStyles, ...thicknessStyle },
|
|
@@ -2512,7 +2814,7 @@ var Divider = ({
|
|
|
2512
2814
|
);
|
|
2513
2815
|
}
|
|
2514
2816
|
if (isVertical) {
|
|
2515
|
-
return /* @__PURE__ */ (0,
|
|
2817
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
2516
2818
|
"div",
|
|
2517
2819
|
{
|
|
2518
2820
|
role: "separator",
|
|
@@ -2522,7 +2824,7 @@ var Divider = ({
|
|
|
2522
2824
|
}
|
|
2523
2825
|
);
|
|
2524
2826
|
}
|
|
2525
|
-
return /* @__PURE__ */ (0,
|
|
2827
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
2526
2828
|
"hr",
|
|
2527
2829
|
{
|
|
2528
2830
|
style: { ...baseStyles, ...thicknessStyle },
|
|
@@ -2532,8 +2834,8 @@ var Divider = ({
|
|
|
2532
2834
|
};
|
|
2533
2835
|
|
|
2534
2836
|
// src/ui/slider.tsx
|
|
2535
|
-
var
|
|
2536
|
-
var
|
|
2837
|
+
var import_react15 = require("react");
|
|
2838
|
+
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
2537
2839
|
var Slider = ({
|
|
2538
2840
|
value: controlledValue,
|
|
2539
2841
|
defaultValue = 0,
|
|
@@ -2557,21 +2859,21 @@ var Slider = ({
|
|
|
2557
2859
|
"aria-labelledby": ariaLabelledBy
|
|
2558
2860
|
}) => {
|
|
2559
2861
|
const isControlled = controlledValue !== void 0;
|
|
2560
|
-
const [internalValue, setInternalValue] = (0,
|
|
2862
|
+
const [internalValue, setInternalValue] = (0, import_react15.useState)(
|
|
2561
2863
|
controlledValue ?? defaultValue
|
|
2562
2864
|
);
|
|
2563
|
-
const [isDragging, setIsDragging] = (0,
|
|
2564
|
-
const [activeThumb, setActiveThumb] = (0,
|
|
2565
|
-
const sliderRef = (0,
|
|
2865
|
+
const [isDragging, setIsDragging] = (0, import_react15.useState)(false);
|
|
2866
|
+
const [activeThumb, setActiveThumb] = (0, import_react15.useState)(null);
|
|
2867
|
+
const sliderRef = (0, import_react15.useRef)(null);
|
|
2566
2868
|
const currentValue = isControlled ? controlledValue : internalValue;
|
|
2567
2869
|
const isRange = Array.isArray(currentValue);
|
|
2568
2870
|
const isVertical = orientation === "vertical";
|
|
2569
|
-
(0,
|
|
2871
|
+
(0, import_react15.useEffect)(() => {
|
|
2570
2872
|
if (isControlled) {
|
|
2571
2873
|
setInternalValue(controlledValue);
|
|
2572
2874
|
}
|
|
2573
2875
|
}, [isControlled, controlledValue]);
|
|
2574
|
-
(0,
|
|
2876
|
+
(0, import_react15.useEffect)(() => {
|
|
2575
2877
|
if (isRange && Array.isArray(currentValue)) {
|
|
2576
2878
|
const clampedValues = currentValue.map(
|
|
2577
2879
|
(v) => Math.max(min, Math.min(max, v))
|
|
@@ -2644,7 +2946,7 @@ var Slider = ({
|
|
|
2644
2946
|
updateValue(newValue);
|
|
2645
2947
|
}
|
|
2646
2948
|
};
|
|
2647
|
-
(0,
|
|
2949
|
+
(0, import_react15.useEffect)(() => {
|
|
2648
2950
|
if (!isDragging) return;
|
|
2649
2951
|
const handleGlobalMove = (e) => {
|
|
2650
2952
|
if (isVertical && "touches" in e) {
|
|
@@ -2771,7 +3073,7 @@ var Slider = ({
|
|
|
2771
3073
|
const showLabelAlways = valueLabelDisplay === "on";
|
|
2772
3074
|
const showLabelOnActiveOrHover = valueLabelDisplay === "auto";
|
|
2773
3075
|
const thumbStyle = isVertical ? { bottom: `${percent}%` } : { left: `${percent}%` };
|
|
2774
|
-
return /* @__PURE__ */ (0,
|
|
3076
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
|
|
2775
3077
|
"div",
|
|
2776
3078
|
{
|
|
2777
3079
|
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`,
|
|
@@ -2779,19 +3081,19 @@ var Slider = ({
|
|
|
2779
3081
|
onMouseDown: handleMouseDown(index),
|
|
2780
3082
|
onTouchStart: handleMouseDown(index),
|
|
2781
3083
|
children: [
|
|
2782
|
-
/* @__PURE__ */ (0,
|
|
3084
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
2783
3085
|
"div",
|
|
2784
3086
|
{
|
|
2785
3087
|
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" : ""}`
|
|
2786
3088
|
}
|
|
2787
3089
|
),
|
|
2788
|
-
showLabelAlways && /* @__PURE__ */ (0,
|
|
3090
|
+
showLabelAlways && /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
|
|
2789
3091
|
"div",
|
|
2790
3092
|
{
|
|
2791
3093
|
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)`,
|
|
2792
3094
|
children: [
|
|
2793
3095
|
valueLabelFormat(val),
|
|
2794
|
-
/* @__PURE__ */ (0,
|
|
3096
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
2795
3097
|
"div",
|
|
2796
3098
|
{
|
|
2797
3099
|
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"}`
|
|
@@ -2800,13 +3102,13 @@ var Slider = ({
|
|
|
2800
3102
|
]
|
|
2801
3103
|
}
|
|
2802
3104
|
),
|
|
2803
|
-
showLabelOnActiveOrHover && /* @__PURE__ */ (0,
|
|
3105
|
+
showLabelOnActiveOrHover && /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
|
|
2804
3106
|
"div",
|
|
2805
3107
|
{
|
|
2806
3108
|
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)`,
|
|
2807
3109
|
children: [
|
|
2808
3110
|
valueLabelFormat(val),
|
|
2809
|
-
/* @__PURE__ */ (0,
|
|
3111
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
2810
3112
|
"div",
|
|
2811
3113
|
{
|
|
2812
3114
|
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"}`
|
|
@@ -2824,13 +3126,13 @@ var Slider = ({
|
|
|
2824
3126
|
const hasMarkLabels = marksList.some((mark) => mark.label);
|
|
2825
3127
|
const containerClasses = isVertical ? "flex flex-col items-center py-4" : `flex items-center w-full px-2 ${hasMarkLabels ? "pb-6" : ""}`;
|
|
2826
3128
|
const railClasses = isVertical ? `${currentSizeStyles.rail} relative overflow-visible` : `w-full ${currentSizeStyles.rail} relative overflow-visible`;
|
|
2827
|
-
return /* @__PURE__ */ (0,
|
|
3129
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
|
|
2828
3130
|
"div",
|
|
2829
3131
|
{
|
|
2830
3132
|
className: `${containerClasses} ${className}`,
|
|
2831
3133
|
style: isVertical ? { minHeight: "200px", height: "200px" } : void 0,
|
|
2832
3134
|
children: [
|
|
2833
|
-
/* @__PURE__ */ (0,
|
|
3135
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
|
|
2834
3136
|
"div",
|
|
2835
3137
|
{
|
|
2836
3138
|
ref: sliderRef,
|
|
@@ -2848,13 +3150,13 @@ var Slider = ({
|
|
|
2848
3150
|
"aria-orientation": orientation,
|
|
2849
3151
|
tabIndex: disabled ? -1 : 0,
|
|
2850
3152
|
children: [
|
|
2851
|
-
/* @__PURE__ */ (0,
|
|
3153
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
2852
3154
|
"div",
|
|
2853
3155
|
{
|
|
2854
3156
|
className: `absolute ${isVertical ? "inset-x-0 h-full" : "inset-y-0 w-full"} bg-[#d1d5db] rounded-full ${disabled ? "opacity-50" : ""} z-0`
|
|
2855
3157
|
}
|
|
2856
3158
|
),
|
|
2857
|
-
track !== false && /* @__PURE__ */ (0,
|
|
3159
|
+
track !== false && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
2858
3160
|
"div",
|
|
2859
3161
|
{
|
|
2860
3162
|
className: `absolute ${isVertical ? "inset-x-0" : "inset-y-0"} ${currentColorStyles.track} rounded-full ${disabled ? "opacity-50" : ""} z-0`,
|
|
@@ -2877,32 +3179,32 @@ var Slider = ({
|
|
|
2877
3179
|
}
|
|
2878
3180
|
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]";
|
|
2879
3181
|
const labelColor = isInSelectedRange ? currentColorStyles.labelSelected : currentColorStyles.labelUnselected;
|
|
2880
|
-
return /* @__PURE__ */ (0,
|
|
3182
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
|
|
2881
3183
|
"div",
|
|
2882
3184
|
{
|
|
2883
3185
|
className: `group/mark absolute ${isVertical ? "left-1/2 -translate-x-1/2" : "top-1/2 -translate-y-1/2"} z-30`,
|
|
2884
3186
|
style: markStyle,
|
|
2885
3187
|
children: [
|
|
2886
|
-
/* @__PURE__ */ (0,
|
|
3188
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
2887
3189
|
"div",
|
|
2888
3190
|
{
|
|
2889
3191
|
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"}`
|
|
2890
3192
|
}
|
|
2891
3193
|
),
|
|
2892
|
-
mark.label && /* @__PURE__ */ (0,
|
|
3194
|
+
mark.label && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
2893
3195
|
"div",
|
|
2894
3196
|
{
|
|
2895
3197
|
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)`,
|
|
2896
3198
|
children: mark.label
|
|
2897
3199
|
}
|
|
2898
3200
|
),
|
|
2899
|
-
showMarkLabelsOnHover && !mark.label && /* @__PURE__ */ (0,
|
|
3201
|
+
showMarkLabelsOnHover && !mark.label && /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
|
|
2900
3202
|
"div",
|
|
2901
3203
|
{
|
|
2902
3204
|
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)`,
|
|
2903
3205
|
children: [
|
|
2904
3206
|
valueLabelFormat(mark.value),
|
|
2905
|
-
/* @__PURE__ */ (0,
|
|
3207
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
2906
3208
|
"div",
|
|
2907
3209
|
{
|
|
2908
3210
|
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"}`
|
|
@@ -2920,7 +3222,7 @@ var Slider = ({
|
|
|
2920
3222
|
]
|
|
2921
3223
|
}
|
|
2922
3224
|
),
|
|
2923
|
-
name && /* @__PURE__ */ (0,
|
|
3225
|
+
name && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
2924
3226
|
"input",
|
|
2925
3227
|
{
|
|
2926
3228
|
type: "hidden",
|
|
@@ -2935,8 +3237,8 @@ var Slider = ({
|
|
|
2935
3237
|
};
|
|
2936
3238
|
|
|
2937
3239
|
// src/ui/switch.tsx
|
|
2938
|
-
var
|
|
2939
|
-
var
|
|
3240
|
+
var import_react16 = require("react");
|
|
3241
|
+
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
2940
3242
|
function Switch({
|
|
2941
3243
|
checked: controlledChecked,
|
|
2942
3244
|
onChange,
|
|
@@ -2952,7 +3254,7 @@ function Switch({
|
|
|
2952
3254
|
errorMessage
|
|
2953
3255
|
}) {
|
|
2954
3256
|
const form = useForm();
|
|
2955
|
-
const [internalChecked, setInternalChecked] = (0,
|
|
3257
|
+
const [internalChecked, setInternalChecked] = (0, import_react16.useState)(false);
|
|
2956
3258
|
let checked;
|
|
2957
3259
|
if (form && name) {
|
|
2958
3260
|
checked = form.values[name] ?? controlledChecked ?? false;
|
|
@@ -2960,7 +3262,7 @@ function Switch({
|
|
|
2960
3262
|
const isControlled = controlledChecked !== void 0;
|
|
2961
3263
|
checked = isControlled ? controlledChecked : internalChecked;
|
|
2962
3264
|
}
|
|
2963
|
-
(0,
|
|
3265
|
+
(0, import_react16.useEffect)(() => {
|
|
2964
3266
|
if (form && name) {
|
|
2965
3267
|
const validator = async (val) => {
|
|
2966
3268
|
if (required && !val) {
|
|
@@ -3033,7 +3335,7 @@ function Switch({
|
|
|
3033
3335
|
top: "gap-2",
|
|
3034
3336
|
bottom: "gap-2"
|
|
3035
3337
|
};
|
|
3036
|
-
const switchElement = /* @__PURE__ */ (0,
|
|
3338
|
+
const switchElement = /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
3037
3339
|
"button",
|
|
3038
3340
|
{
|
|
3039
3341
|
type: "button",
|
|
@@ -3050,7 +3352,7 @@ function Switch({
|
|
|
3050
3352
|
disabled ? "opacity-50 cursor-not-allowed" : "cursor-pointer hover:opacity-90",
|
|
3051
3353
|
checked && !disabled && "focus:ring-blue-500"
|
|
3052
3354
|
),
|
|
3053
|
-
children: /* @__PURE__ */ (0,
|
|
3355
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
3054
3356
|
"span",
|
|
3055
3357
|
{
|
|
3056
3358
|
className: cn(
|
|
@@ -3063,9 +3365,9 @@ function Switch({
|
|
|
3063
3365
|
)
|
|
3064
3366
|
}
|
|
3065
3367
|
);
|
|
3066
|
-
const content = !label ? /* @__PURE__ */ (0,
|
|
3368
|
+
const content = !label ? /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(import_jsx_runtime16.Fragment, { children: [
|
|
3067
3369
|
switchElement,
|
|
3068
|
-
name && /* @__PURE__ */ (0,
|
|
3370
|
+
name && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
3069
3371
|
"input",
|
|
3070
3372
|
{
|
|
3071
3373
|
type: "checkbox",
|
|
@@ -3077,7 +3379,7 @@ function Switch({
|
|
|
3077
3379
|
required
|
|
3078
3380
|
}
|
|
3079
3381
|
)
|
|
3080
|
-
] }) : /* @__PURE__ */ (0,
|
|
3382
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
|
|
3081
3383
|
"label",
|
|
3082
3384
|
{
|
|
3083
3385
|
className: cn(
|
|
@@ -3088,7 +3390,7 @@ function Switch({
|
|
|
3088
3390
|
),
|
|
3089
3391
|
children: [
|
|
3090
3392
|
switchElement,
|
|
3091
|
-
/* @__PURE__ */ (0,
|
|
3393
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
|
|
3092
3394
|
"span",
|
|
3093
3395
|
{
|
|
3094
3396
|
className: cn(
|
|
@@ -3098,11 +3400,11 @@ function Switch({
|
|
|
3098
3400
|
style: !disabled ? { color: "var(--color-muted-foreground)" } : void 0,
|
|
3099
3401
|
children: [
|
|
3100
3402
|
label,
|
|
3101
|
-
required && /* @__PURE__ */ (0,
|
|
3403
|
+
required && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "ml-1", children: "*" })
|
|
3102
3404
|
]
|
|
3103
3405
|
}
|
|
3104
3406
|
),
|
|
3105
|
-
name && /* @__PURE__ */ (0,
|
|
3407
|
+
name && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
3106
3408
|
"input",
|
|
3107
3409
|
{
|
|
3108
3410
|
type: "checkbox",
|
|
@@ -3117,7 +3419,7 @@ function Switch({
|
|
|
3117
3419
|
]
|
|
3118
3420
|
}
|
|
3119
3421
|
);
|
|
3120
|
-
return /* @__PURE__ */ (0,
|
|
3422
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
3121
3423
|
"div",
|
|
3122
3424
|
{
|
|
3123
3425
|
className,
|
|
@@ -3130,8 +3432,8 @@ function Switch({
|
|
|
3130
3432
|
}
|
|
3131
3433
|
|
|
3132
3434
|
// src/ui/dialog.tsx
|
|
3133
|
-
var
|
|
3134
|
-
var
|
|
3435
|
+
var import_react17 = __toESM(require("react"));
|
|
3436
|
+
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
3135
3437
|
var Dialog = ({
|
|
3136
3438
|
open,
|
|
3137
3439
|
onClose,
|
|
@@ -3142,7 +3444,7 @@ var Dialog = ({
|
|
|
3142
3444
|
closeOnEscape = true,
|
|
3143
3445
|
children
|
|
3144
3446
|
}) => {
|
|
3145
|
-
(0,
|
|
3447
|
+
(0, import_react17.useEffect)(() => {
|
|
3146
3448
|
if (!open || !closeOnEscape) return;
|
|
3147
3449
|
const handleEscape = (e) => {
|
|
3148
3450
|
if (e.key === "Escape") {
|
|
@@ -3152,7 +3454,7 @@ var Dialog = ({
|
|
|
3152
3454
|
document.addEventListener("keydown", handleEscape);
|
|
3153
3455
|
return () => document.removeEventListener("keydown", handleEscape);
|
|
3154
3456
|
}, [open, closeOnEscape, onClose]);
|
|
3155
|
-
(0,
|
|
3457
|
+
(0, import_react17.useEffect)(() => {
|
|
3156
3458
|
if (open) {
|
|
3157
3459
|
document.body.style.overflow = "hidden";
|
|
3158
3460
|
} else {
|
|
@@ -3182,14 +3484,14 @@ var Dialog = ({
|
|
|
3182
3484
|
onClose();
|
|
3183
3485
|
}
|
|
3184
3486
|
};
|
|
3185
|
-
return /* @__PURE__ */ (0,
|
|
3487
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
3186
3488
|
"div",
|
|
3187
3489
|
{
|
|
3188
3490
|
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",
|
|
3189
3491
|
onClick: handleBackdropClick,
|
|
3190
3492
|
role: "dialog",
|
|
3191
3493
|
"aria-modal": "true",
|
|
3192
|
-
children: /* @__PURE__ */ (0,
|
|
3494
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
|
|
3193
3495
|
"div",
|
|
3194
3496
|
{
|
|
3195
3497
|
className: cn(
|
|
@@ -3197,7 +3499,7 @@ var Dialog = ({
|
|
|
3197
3499
|
sizes[size]
|
|
3198
3500
|
),
|
|
3199
3501
|
children: [
|
|
3200
|
-
showCloseButton && /* @__PURE__ */ (0,
|
|
3502
|
+
showCloseButton && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
3201
3503
|
"button",
|
|
3202
3504
|
{
|
|
3203
3505
|
onClick: onClose,
|
|
@@ -3240,14 +3542,14 @@ var Dialog = ({
|
|
|
3240
3542
|
},
|
|
3241
3543
|
className: "absolute right-2 top-2 p-1.5 rounded-full [z-index:var(--z-index-base)] focus:outline-none",
|
|
3242
3544
|
"aria-label": "Close dialog",
|
|
3243
|
-
children: /* @__PURE__ */ (0,
|
|
3545
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
3244
3546
|
"svg",
|
|
3245
3547
|
{
|
|
3246
3548
|
className: "w-5 h-5",
|
|
3247
3549
|
fill: "none",
|
|
3248
3550
|
stroke: "currentColor",
|
|
3249
3551
|
viewBox: "0 0 24 24",
|
|
3250
|
-
children: /* @__PURE__ */ (0,
|
|
3552
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
3251
3553
|
"path",
|
|
3252
3554
|
{
|
|
3253
3555
|
strokeLinecap: "round",
|
|
@@ -3260,7 +3562,7 @@ var Dialog = ({
|
|
|
3260
3562
|
)
|
|
3261
3563
|
}
|
|
3262
3564
|
),
|
|
3263
|
-
/* @__PURE__ */ (0,
|
|
3565
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(DialogContext.Provider, { value: { variant }, children })
|
|
3264
3566
|
]
|
|
3265
3567
|
}
|
|
3266
3568
|
)
|
|
@@ -3268,9 +3570,9 @@ var Dialog = ({
|
|
|
3268
3570
|
);
|
|
3269
3571
|
};
|
|
3270
3572
|
Dialog.displayName = "Dialog";
|
|
3271
|
-
var DialogContext =
|
|
3272
|
-
var DialogHeader =
|
|
3273
|
-
const { variant } =
|
|
3573
|
+
var DialogContext = import_react17.default.createContext({ variant: "default" });
|
|
3574
|
+
var DialogHeader = import_react17.default.forwardRef(({ className, children, ...props }, ref) => {
|
|
3575
|
+
const { variant } = import_react17.default.useContext(DialogContext);
|
|
3274
3576
|
const variantStyles = {
|
|
3275
3577
|
default: {
|
|
3276
3578
|
backgroundColor: "var(--color-background)",
|
|
@@ -3293,7 +3595,7 @@ var DialogHeader = import_react15.default.forwardRef(({ className, children, ...
|
|
|
3293
3595
|
borderColor: "var(--color-error-border)"
|
|
3294
3596
|
}
|
|
3295
3597
|
};
|
|
3296
|
-
return /* @__PURE__ */ (0,
|
|
3598
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
3297
3599
|
"div",
|
|
3298
3600
|
{
|
|
3299
3601
|
ref,
|
|
@@ -3308,7 +3610,7 @@ var DialogHeader = import_react15.default.forwardRef(({ className, children, ...
|
|
|
3308
3610
|
);
|
|
3309
3611
|
});
|
|
3310
3612
|
DialogHeader.displayName = "DialogHeader";
|
|
3311
|
-
var DialogTitle =
|
|
3613
|
+
var DialogTitle = import_react17.default.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
3312
3614
|
"h2",
|
|
3313
3615
|
{
|
|
3314
3616
|
ref,
|
|
@@ -3321,7 +3623,7 @@ var DialogTitle = import_react15.default.forwardRef(({ className, children, ...p
|
|
|
3321
3623
|
}
|
|
3322
3624
|
));
|
|
3323
3625
|
DialogTitle.displayName = "DialogTitle";
|
|
3324
|
-
var DialogDescription =
|
|
3626
|
+
var DialogDescription = import_react17.default.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
3325
3627
|
"p",
|
|
3326
3628
|
{
|
|
3327
3629
|
ref,
|
|
@@ -3331,9 +3633,9 @@ var DialogDescription = import_react15.default.forwardRef(({ className, children
|
|
|
3331
3633
|
}
|
|
3332
3634
|
));
|
|
3333
3635
|
DialogDescription.displayName = "DialogDescription";
|
|
3334
|
-
var DialogContent =
|
|
3636
|
+
var DialogContent = import_react17.default.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { ref, className: cn("px-6 py-4", className), ...props, children }));
|
|
3335
3637
|
DialogContent.displayName = "DialogContent";
|
|
3336
|
-
var DialogFooter =
|
|
3638
|
+
var DialogFooter = import_react17.default.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
3337
3639
|
"div",
|
|
3338
3640
|
{
|
|
3339
3641
|
ref,
|
|
@@ -3348,9 +3650,9 @@ var DialogFooter = import_react15.default.forwardRef(({ className, children, ...
|
|
|
3348
3650
|
DialogFooter.displayName = "DialogFooter";
|
|
3349
3651
|
|
|
3350
3652
|
// src/feedback/alert.tsx
|
|
3351
|
-
var
|
|
3352
|
-
var
|
|
3353
|
-
var Alert =
|
|
3653
|
+
var import_react18 = __toESM(require("react"));
|
|
3654
|
+
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
3655
|
+
var Alert = import_react18.default.forwardRef(
|
|
3354
3656
|
({
|
|
3355
3657
|
className,
|
|
3356
3658
|
variant = "info",
|
|
@@ -3390,7 +3692,7 @@ var Alert = import_react16.default.forwardRef(
|
|
|
3390
3692
|
error: { color: "var(--color-error-border)" }
|
|
3391
3693
|
};
|
|
3392
3694
|
const defaultIcons = {
|
|
3393
|
-
info: /* @__PURE__ */ (0,
|
|
3695
|
+
info: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("svg", { className: "w-5 h-5", fill: "currentColor", viewBox: "0 0 20 20", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
3394
3696
|
"path",
|
|
3395
3697
|
{
|
|
3396
3698
|
fillRule: "evenodd",
|
|
@@ -3398,7 +3700,7 @@ var Alert = import_react16.default.forwardRef(
|
|
|
3398
3700
|
clipRule: "evenodd"
|
|
3399
3701
|
}
|
|
3400
3702
|
) }),
|
|
3401
|
-
success: /* @__PURE__ */ (0,
|
|
3703
|
+
success: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("svg", { className: "w-5 h-5", fill: "currentColor", viewBox: "0 0 20 20", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
3402
3704
|
"path",
|
|
3403
3705
|
{
|
|
3404
3706
|
fillRule: "evenodd",
|
|
@@ -3406,7 +3708,7 @@ var Alert = import_react16.default.forwardRef(
|
|
|
3406
3708
|
clipRule: "evenodd"
|
|
3407
3709
|
}
|
|
3408
3710
|
) }),
|
|
3409
|
-
warning: /* @__PURE__ */ (0,
|
|
3711
|
+
warning: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("svg", { className: "w-5 h-5", fill: "currentColor", viewBox: "0 0 20 20", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
3410
3712
|
"path",
|
|
3411
3713
|
{
|
|
3412
3714
|
fillRule: "evenodd",
|
|
@@ -3414,7 +3716,7 @@ var Alert = import_react16.default.forwardRef(
|
|
|
3414
3716
|
clipRule: "evenodd"
|
|
3415
3717
|
}
|
|
3416
3718
|
) }),
|
|
3417
|
-
error: /* @__PURE__ */ (0,
|
|
3719
|
+
error: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("svg", { className: "w-5 h-5", fill: "currentColor", viewBox: "0 0 20 20", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
3418
3720
|
"path",
|
|
3419
3721
|
{
|
|
3420
3722
|
fillRule: "evenodd",
|
|
@@ -3423,7 +3725,7 @@ var Alert = import_react16.default.forwardRef(
|
|
|
3423
3725
|
}
|
|
3424
3726
|
) })
|
|
3425
3727
|
};
|
|
3426
|
-
return /* @__PURE__ */ (0,
|
|
3728
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
3427
3729
|
"div",
|
|
3428
3730
|
{
|
|
3429
3731
|
ref,
|
|
@@ -3431,13 +3733,13 @@ var Alert = import_react16.default.forwardRef(
|
|
|
3431
3733
|
className: cn("relative border rounded-lg p-4", className),
|
|
3432
3734
|
role: "alert",
|
|
3433
3735
|
...props,
|
|
3434
|
-
children: /* @__PURE__ */ (0,
|
|
3435
|
-
/* @__PURE__ */ (0,
|
|
3436
|
-
/* @__PURE__ */ (0,
|
|
3437
|
-
title && /* @__PURE__ */ (0,
|
|
3438
|
-
/* @__PURE__ */ (0,
|
|
3736
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex items-start gap-3", children: [
|
|
3737
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "shrink-0", style: iconStyles[variant], children: icon || defaultIcons[variant] }),
|
|
3738
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex-1", children: [
|
|
3739
|
+
title && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("h5", { className: "font-semibold mb-1", children: title }),
|
|
3740
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "text-sm", children })
|
|
3439
3741
|
] }),
|
|
3440
|
-
dismissible && onDismiss && /* @__PURE__ */ (0,
|
|
3742
|
+
dismissible && onDismiss && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
3441
3743
|
"button",
|
|
3442
3744
|
{
|
|
3443
3745
|
type: "button",
|
|
@@ -3471,7 +3773,7 @@ var Alert = import_react16.default.forwardRef(
|
|
|
3471
3773
|
},
|
|
3472
3774
|
className: "shrink-0 rounded-lg p-1.5 inline-flex focus:outline-none",
|
|
3473
3775
|
"aria-label": "Close",
|
|
3474
|
-
children: /* @__PURE__ */ (0,
|
|
3776
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("svg", { className: "w-4 h-4", fill: "currentColor", viewBox: "0 0 20 20", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
3475
3777
|
"path",
|
|
3476
3778
|
{
|
|
3477
3779
|
fillRule: "evenodd",
|
|
@@ -3489,9 +3791,9 @@ var Alert = import_react16.default.forwardRef(
|
|
|
3489
3791
|
Alert.displayName = "Alert";
|
|
3490
3792
|
|
|
3491
3793
|
// src/layout/container.tsx
|
|
3492
|
-
var
|
|
3493
|
-
var
|
|
3494
|
-
var Container =
|
|
3794
|
+
var import_react19 = __toESM(require("react"));
|
|
3795
|
+
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
3796
|
+
var Container = import_react19.default.forwardRef(
|
|
3495
3797
|
({
|
|
3496
3798
|
className,
|
|
3497
3799
|
maxWidth = "xl",
|
|
@@ -3508,7 +3810,7 @@ var Container = import_react17.default.forwardRef(
|
|
|
3508
3810
|
"2xl": "max-w-screen-2xl",
|
|
3509
3811
|
full: "max-w-full"
|
|
3510
3812
|
};
|
|
3511
|
-
return /* @__PURE__ */ (0,
|
|
3813
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
3512
3814
|
"div",
|
|
3513
3815
|
{
|
|
3514
3816
|
ref,
|
|
@@ -3528,32 +3830,32 @@ var Container = import_react17.default.forwardRef(
|
|
|
3528
3830
|
Container.displayName = "Container";
|
|
3529
3831
|
|
|
3530
3832
|
// src/layout/section-layout.tsx
|
|
3531
|
-
var
|
|
3532
|
-
var
|
|
3833
|
+
var import_react20 = __toESM(require("react"));
|
|
3834
|
+
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
3533
3835
|
function SectionLayout({
|
|
3534
3836
|
children,
|
|
3535
3837
|
hasStickyPreview = false
|
|
3536
3838
|
}) {
|
|
3537
3839
|
if (!hasStickyPreview) {
|
|
3538
|
-
return /* @__PURE__ */ (0,
|
|
3840
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_jsx_runtime20.Fragment, { children });
|
|
3539
3841
|
}
|
|
3540
|
-
const childArray =
|
|
3842
|
+
const childArray = import_react20.default.Children.toArray(children);
|
|
3541
3843
|
if (childArray.length === 0) {
|
|
3542
3844
|
return null;
|
|
3543
3845
|
}
|
|
3544
3846
|
const stickyPreview = childArray[0];
|
|
3545
3847
|
const scrollableContent = childArray.slice(1);
|
|
3546
|
-
return /* @__PURE__ */ (0,
|
|
3848
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(import_jsx_runtime20.Fragment, { children: [
|
|
3547
3849
|
stickyPreview,
|
|
3548
|
-
scrollableContent.length > 0 && /* @__PURE__ */ (0,
|
|
3850
|
+
scrollableContent.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: "space-y-8", children: scrollableContent })
|
|
3549
3851
|
] });
|
|
3550
3852
|
}
|
|
3551
3853
|
|
|
3552
3854
|
// src/layout/nav.tsx
|
|
3553
3855
|
var import_lucide_react3 = require("lucide-react");
|
|
3554
|
-
var
|
|
3555
|
-
var
|
|
3556
|
-
var Nav =
|
|
3856
|
+
var import_react21 = __toESM(require("react"));
|
|
3857
|
+
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
3858
|
+
var Nav = import_react21.default.forwardRef(
|
|
3557
3859
|
({
|
|
3558
3860
|
className,
|
|
3559
3861
|
items,
|
|
@@ -3567,16 +3869,42 @@ var Nav = import_react19.default.forwardRef(
|
|
|
3567
3869
|
sticky = false,
|
|
3568
3870
|
activeId,
|
|
3569
3871
|
onItemClick,
|
|
3570
|
-
|
|
3872
|
+
borderless = false,
|
|
3873
|
+
transparent = false,
|
|
3874
|
+
blur = false,
|
|
3875
|
+
position = "static",
|
|
3876
|
+
autoHideOnScroll = false,
|
|
3877
|
+
...htmlProps
|
|
3571
3878
|
}, ref) => {
|
|
3572
|
-
const [isMobileMenuOpen, setIsMobileMenuOpen] = (0,
|
|
3573
|
-
const [openDropdownId, setOpenDropdownId] = (0,
|
|
3879
|
+
const [isMobileMenuOpen, setIsMobileMenuOpen] = (0, import_react21.useState)(false);
|
|
3880
|
+
const [openDropdownId, setOpenDropdownId] = (0, import_react21.useState)(
|
|
3574
3881
|
null
|
|
3575
3882
|
);
|
|
3576
|
-
const dropdownRef = (0,
|
|
3577
|
-
const mobileMenuRef = (0,
|
|
3578
|
-
const [navElement, setNavElement] = (0,
|
|
3579
|
-
(0,
|
|
3883
|
+
const dropdownRef = (0, import_react21.useRef)(null);
|
|
3884
|
+
const mobileMenuRef = (0, import_react21.useRef)(null);
|
|
3885
|
+
const [navElement, setNavElement] = (0, import_react21.useState)(null);
|
|
3886
|
+
const [isNavVisible, setIsNavVisible] = (0, import_react21.useState)(true);
|
|
3887
|
+
const [lastScrollY, setLastScrollY] = (0, import_react21.useState)(0);
|
|
3888
|
+
(0, import_react21.useEffect)(() => {
|
|
3889
|
+
if (!autoHideOnScroll || position === "static") {
|
|
3890
|
+
setIsNavVisible(true);
|
|
3891
|
+
return;
|
|
3892
|
+
}
|
|
3893
|
+
const handleScroll = () => {
|
|
3894
|
+
const currentScrollY = window.scrollY;
|
|
3895
|
+
if (currentScrollY < 10) {
|
|
3896
|
+
setIsNavVisible(true);
|
|
3897
|
+
} else if (currentScrollY > lastScrollY) {
|
|
3898
|
+
setIsNavVisible(false);
|
|
3899
|
+
} else {
|
|
3900
|
+
setIsNavVisible(true);
|
|
3901
|
+
}
|
|
3902
|
+
setLastScrollY(currentScrollY);
|
|
3903
|
+
};
|
|
3904
|
+
window.addEventListener("scroll", handleScroll, { passive: true });
|
|
3905
|
+
return () => window.removeEventListener("scroll", handleScroll);
|
|
3906
|
+
}, [lastScrollY, autoHideOnScroll, position]);
|
|
3907
|
+
(0, import_react21.useEffect)(() => {
|
|
3580
3908
|
function handleClickOutside(event) {
|
|
3581
3909
|
if (dropdownRef.current && !dropdownRef.current.contains(event.target)) {
|
|
3582
3910
|
setOpenDropdownId(null);
|
|
@@ -3590,7 +3918,7 @@ var Nav = import_react19.default.forwardRef(
|
|
|
3590
3918
|
document.removeEventListener("mousedown", handleClickOutside);
|
|
3591
3919
|
};
|
|
3592
3920
|
}, [isMobileMenuOpen, mobileMenuDirection]);
|
|
3593
|
-
(0,
|
|
3921
|
+
(0, import_react21.useEffect)(() => {
|
|
3594
3922
|
function handleEscape(event) {
|
|
3595
3923
|
if (event.key === "Escape") {
|
|
3596
3924
|
setIsMobileMenuOpen(false);
|
|
@@ -3602,12 +3930,24 @@ var Nav = import_react19.default.forwardRef(
|
|
|
3602
3930
|
document.removeEventListener("keydown", handleEscape);
|
|
3603
3931
|
};
|
|
3604
3932
|
}, []);
|
|
3605
|
-
(0,
|
|
3933
|
+
(0, import_react21.useEffect)(() => {
|
|
3606
3934
|
setIsMobileMenuOpen(false);
|
|
3607
3935
|
}, [mobileMenuDirection]);
|
|
3936
|
+
const positionClass = position === "static" ? "" : position === "fixed" ? "fixed" : "sticky";
|
|
3937
|
+
const transformClass = autoHideOnScroll && position !== "static" ? `transition-transform duration-500 ease-in-out ${isNavVisible ? "translate-y-0" : "-translate-y-full"}` : "";
|
|
3938
|
+
const hasCustomPositioning = className?.match(/(left-|right-|inset-)/);
|
|
3608
3939
|
const baseStyles = cn(
|
|
3609
|
-
|
|
3610
|
-
|
|
3940
|
+
// Position
|
|
3941
|
+
positionClass && `${positionClass} [z-index:var(--z-index-nav)]`,
|
|
3942
|
+
// Default positioning only if not custom
|
|
3943
|
+
positionClass && !hasCustomPositioning && "top-0 left-0 right-0",
|
|
3944
|
+
// Transform for auto-hide
|
|
3945
|
+
transformClass,
|
|
3946
|
+
// Background
|
|
3947
|
+
!transparent && !blur && "bg-(--color-background)",
|
|
3948
|
+
transparent && "bg-transparent",
|
|
3949
|
+
// Blur effect (glassmorphism)
|
|
3950
|
+
blur && "backdrop-blur-md bg-transparent"
|
|
3611
3951
|
);
|
|
3612
3952
|
const containerStyles = cn(
|
|
3613
3953
|
"min-h-14 md:min-h-16",
|
|
@@ -3665,7 +4005,7 @@ var Nav = import_react19.default.forwardRef(
|
|
|
3665
4005
|
};
|
|
3666
4006
|
const renderNavItem = (item, isMobile = false) => {
|
|
3667
4007
|
if (item.type === "divider") {
|
|
3668
|
-
return /* @__PURE__ */ (0,
|
|
4008
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
3669
4009
|
"div",
|
|
3670
4010
|
{
|
|
3671
4011
|
className: cn(
|
|
@@ -3677,7 +4017,7 @@ var Nav = import_react19.default.forwardRef(
|
|
|
3677
4017
|
);
|
|
3678
4018
|
}
|
|
3679
4019
|
if (item.type === "custom" && item.render) {
|
|
3680
|
-
return /* @__PURE__ */ (0,
|
|
4020
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { children: item.render() }, item.id);
|
|
3681
4021
|
}
|
|
3682
4022
|
const isActive = activeId === item.id;
|
|
3683
4023
|
const isDropdownOpen = openDropdownId === item.id;
|
|
@@ -3691,11 +4031,11 @@ var Nav = import_react19.default.forwardRef(
|
|
|
3691
4031
|
orientation === "vertical" && "w-full",
|
|
3692
4032
|
item.disabled && "opacity-50 cursor-not-allowed"
|
|
3693
4033
|
);
|
|
3694
|
-
const content = /* @__PURE__ */ (0,
|
|
3695
|
-
item.icon && /* @__PURE__ */ (0,
|
|
3696
|
-
/* @__PURE__ */ (0,
|
|
3697
|
-
item.badge && /* @__PURE__ */ (0,
|
|
3698
|
-
hasChildren && /* @__PURE__ */ (0,
|
|
4034
|
+
const content = /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_jsx_runtime21.Fragment, { children: [
|
|
4035
|
+
item.icon && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "flex-shrink-0", children: item.icon }),
|
|
4036
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { children: item.label }),
|
|
4037
|
+
item.badge && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("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 }),
|
|
4038
|
+
hasChildren && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
3699
4039
|
import_lucide_react3.ChevronDown,
|
|
3700
4040
|
{
|
|
3701
4041
|
className: cn(
|
|
@@ -3706,8 +4046,8 @@ var Nav = import_react19.default.forwardRef(
|
|
|
3706
4046
|
)
|
|
3707
4047
|
] });
|
|
3708
4048
|
if (hasChildren) {
|
|
3709
|
-
return /* @__PURE__ */ (0,
|
|
3710
|
-
/* @__PURE__ */ (0,
|
|
4049
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "relative", ref: dropdownRef, children: [
|
|
4050
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
3711
4051
|
"button",
|
|
3712
4052
|
{
|
|
3713
4053
|
onClick: () => handleItemClick(item),
|
|
@@ -3716,14 +4056,14 @@ var Nav = import_react19.default.forwardRef(
|
|
|
3716
4056
|
children: content
|
|
3717
4057
|
}
|
|
3718
4058
|
),
|
|
3719
|
-
isDropdownOpen && /* @__PURE__ */ (0,
|
|
4059
|
+
isDropdownOpen && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
3720
4060
|
"div",
|
|
3721
4061
|
{
|
|
3722
4062
|
className: cn(
|
|
3723
4063
|
"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",
|
|
3724
4064
|
orientation === "vertical" && "left-full top-0 ml-2 mt-0"
|
|
3725
4065
|
),
|
|
3726
|
-
children: /* @__PURE__ */ (0,
|
|
4066
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "py-1", children: item.children.map((child) => /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
|
|
3727
4067
|
"button",
|
|
3728
4068
|
{
|
|
3729
4069
|
onClick: () => handleItemClick(child),
|
|
@@ -3734,9 +4074,9 @@ var Nav = import_react19.default.forwardRef(
|
|
|
3734
4074
|
activeId === child.id && "bg-(--color-primary)/10 text-(--color-primary) [font-weight:var(--font-semibold)]"
|
|
3735
4075
|
),
|
|
3736
4076
|
children: [
|
|
3737
|
-
child.icon && /* @__PURE__ */ (0,
|
|
3738
|
-
/* @__PURE__ */ (0,
|
|
3739
|
-
child.badge && /* @__PURE__ */ (0,
|
|
4077
|
+
child.icon && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "flex-shrink-0", children: child.icon }),
|
|
4078
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { children: child.label }),
|
|
4079
|
+
child.badge && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("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 })
|
|
3740
4080
|
]
|
|
3741
4081
|
},
|
|
3742
4082
|
child.id
|
|
@@ -3746,7 +4086,7 @@ var Nav = import_react19.default.forwardRef(
|
|
|
3746
4086
|
] }, item.id);
|
|
3747
4087
|
}
|
|
3748
4088
|
if (item.href) {
|
|
3749
|
-
return /* @__PURE__ */ (0,
|
|
4089
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
3750
4090
|
"a",
|
|
3751
4091
|
{
|
|
3752
4092
|
href: item.href,
|
|
@@ -3758,7 +4098,7 @@ var Nav = import_react19.default.forwardRef(
|
|
|
3758
4098
|
item.id
|
|
3759
4099
|
);
|
|
3760
4100
|
}
|
|
3761
|
-
return /* @__PURE__ */ (0,
|
|
4101
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
3762
4102
|
"button",
|
|
3763
4103
|
{
|
|
3764
4104
|
onClick: () => handleItemClick(item),
|
|
@@ -3769,7 +4109,7 @@ var Nav = import_react19.default.forwardRef(
|
|
|
3769
4109
|
item.id
|
|
3770
4110
|
);
|
|
3771
4111
|
};
|
|
3772
|
-
const desktopNav = /* @__PURE__ */ (0,
|
|
4112
|
+
const desktopNav = /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
3773
4113
|
"div",
|
|
3774
4114
|
{
|
|
3775
4115
|
className: cn(
|
|
@@ -3780,7 +4120,7 @@ var Nav = import_react19.default.forwardRef(
|
|
|
3780
4120
|
children: items.map((item) => renderNavItem(item))
|
|
3781
4121
|
}
|
|
3782
4122
|
);
|
|
3783
|
-
const setRefs =
|
|
4123
|
+
const setRefs = import_react21.default.useCallback(
|
|
3784
4124
|
(node) => {
|
|
3785
4125
|
setNavElement(node);
|
|
3786
4126
|
if (typeof ref === "function") {
|
|
@@ -3791,22 +4131,25 @@ var Nav = import_react19.default.forwardRef(
|
|
|
3791
4131
|
},
|
|
3792
4132
|
[ref]
|
|
3793
4133
|
);
|
|
3794
|
-
return /* @__PURE__ */ (0,
|
|
4134
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
|
|
3795
4135
|
"nav",
|
|
3796
4136
|
{
|
|
3797
4137
|
ref: setRefs,
|
|
3798
4138
|
className: cn(
|
|
3799
4139
|
baseStyles,
|
|
3800
|
-
"relative
|
|
4140
|
+
"relative",
|
|
4141
|
+
// Border styles
|
|
4142
|
+
!borderless && "border border-(--color-border)",
|
|
4143
|
+
borderless && "border-0",
|
|
3801
4144
|
className
|
|
3802
4145
|
),
|
|
3803
|
-
...
|
|
4146
|
+
...htmlProps,
|
|
3804
4147
|
children: [
|
|
3805
|
-
/* @__PURE__ */ (0,
|
|
3806
|
-
logo && /* @__PURE__ */ (0,
|
|
4148
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: containerStyles, children: [
|
|
4149
|
+
logo && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "shrink-0", children: logo }),
|
|
3807
4150
|
desktopNav,
|
|
3808
|
-
actions && /* @__PURE__ */ (0,
|
|
3809
|
-
/* @__PURE__ */ (0,
|
|
4151
|
+
actions && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "shrink-0 flex items-center gap-2", children: actions }),
|
|
4152
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
3810
4153
|
"button",
|
|
3811
4154
|
{
|
|
3812
4155
|
onClick: () => setIsMobileMenuOpen(!isMobileMenuOpen),
|
|
@@ -3815,11 +4158,11 @@ var Nav = import_react19.default.forwardRef(
|
|
|
3815
4158
|
breakpointClasses[mobileBreakpoint]
|
|
3816
4159
|
),
|
|
3817
4160
|
"aria-label": "Toggle menu",
|
|
3818
|
-
children: isMobileMenuOpen ? /* @__PURE__ */ (0,
|
|
4161
|
+
children: isMobileMenuOpen ? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react3.X, { className: "w-6 h-6" }) : /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react3.Menu, { className: "w-6 h-6" })
|
|
3819
4162
|
}
|
|
3820
4163
|
)
|
|
3821
4164
|
] }),
|
|
3822
|
-
mobileMenuDirection === "top" && /* @__PURE__ */ (0,
|
|
4165
|
+
mobileMenuDirection === "top" && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
3823
4166
|
"div",
|
|
3824
4167
|
{
|
|
3825
4168
|
ref: mobileMenuRef,
|
|
@@ -3828,26 +4171,29 @@ var Nav = import_react19.default.forwardRef(
|
|
|
3828
4171
|
breakpointClasses[mobileBreakpoint],
|
|
3829
4172
|
isMobileMenuOpen ? "max-h-96 opacity-100 border-(--color-border)" : "max-h-0 opacity-0 border-transparent"
|
|
3830
4173
|
),
|
|
3831
|
-
children: /* @__PURE__ */ (0,
|
|
4174
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "space-y-1 px-2 py-2", children: items.map((item) => renderNavItem(item, true)) })
|
|
3832
4175
|
}
|
|
3833
4176
|
),
|
|
3834
|
-
mobileMenuDirection !== "top" && /* @__PURE__ */ (0,
|
|
3835
|
-
isMobileMenuOpen && /* @__PURE__ */ (0,
|
|
4177
|
+
mobileMenuDirection !== "top" && /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_jsx_runtime21.Fragment, { children: [
|
|
4178
|
+
isMobileMenuOpen && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
3836
4179
|
"div",
|
|
3837
4180
|
{
|
|
3838
4181
|
className: cn(
|
|
3839
|
-
"fixed inset-0
|
|
4182
|
+
"fixed inset-0 [z-index:var(--z-index-nav-mobile-overlay)]",
|
|
3840
4183
|
breakpointClasses[mobileBreakpoint]
|
|
3841
4184
|
),
|
|
4185
|
+
style: {
|
|
4186
|
+
backgroundColor: "var(--overlay-background, rgba(0, 0, 0, 0.4))"
|
|
4187
|
+
},
|
|
3842
4188
|
onClick: () => setIsMobileMenuOpen(false)
|
|
3843
4189
|
}
|
|
3844
4190
|
),
|
|
3845
|
-
/* @__PURE__ */ (0,
|
|
4191
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
3846
4192
|
"div",
|
|
3847
4193
|
{
|
|
3848
4194
|
ref: mobileMenuRef,
|
|
3849
4195
|
className: cn(
|
|
3850
|
-
"fixed top-0 bottom-0 w-64 bg-(--color-background) [z-index:var(--z-index-nav-mobile-menu)] overflow-y-auto transition-transform
|
|
4196
|
+
"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",
|
|
3851
4197
|
breakpointClasses[mobileBreakpoint],
|
|
3852
4198
|
mobileMenuDirection === "left" && [
|
|
3853
4199
|
"left-0 border-r border-(--color-border)",
|
|
@@ -3859,7 +4205,10 @@ var Nav = import_react19.default.forwardRef(
|
|
|
3859
4205
|
],
|
|
3860
4206
|
!isMobileMenuOpen && "invisible"
|
|
3861
4207
|
),
|
|
3862
|
-
|
|
4208
|
+
style: {
|
|
4209
|
+
transitionDuration: "var(--transition-drawer-duration, 500ms)"
|
|
4210
|
+
},
|
|
4211
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "flex flex-col space-y-1 px-2 pt-2", children: items.map((item) => renderNavItem(item, true)) })
|
|
3863
4212
|
}
|
|
3864
4213
|
)
|
|
3865
4214
|
] })
|
|
@@ -3872,8 +4221,8 @@ Nav.displayName = "Nav";
|
|
|
3872
4221
|
|
|
3873
4222
|
// src/layout/drawer.tsx
|
|
3874
4223
|
var import_lucide_react4 = require("lucide-react");
|
|
3875
|
-
var
|
|
3876
|
-
var
|
|
4224
|
+
var import_react22 = require("react");
|
|
4225
|
+
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
3877
4226
|
function Drawer({
|
|
3878
4227
|
title,
|
|
3879
4228
|
subtitle,
|
|
@@ -3885,18 +4234,21 @@ function Drawer({
|
|
|
3885
4234
|
position = "right",
|
|
3886
4235
|
homeUrl,
|
|
3887
4236
|
autoHideOnScroll = true,
|
|
3888
|
-
headerActions
|
|
4237
|
+
headerActions,
|
|
4238
|
+
borderless = false,
|
|
4239
|
+
transparent = false,
|
|
4240
|
+
blur = false
|
|
3889
4241
|
}) {
|
|
3890
|
-
const [mobileMenuOpen, setMobileMenuOpen] = (0,
|
|
3891
|
-
const [isHeaderVisible, setIsHeaderVisible] = (0,
|
|
3892
|
-
const [lastScrollY, setLastScrollY] = (0,
|
|
4242
|
+
const [mobileMenuOpen, setMobileMenuOpen] = (0, import_react22.useState)(false);
|
|
4243
|
+
const [isHeaderVisible, setIsHeaderVisible] = (0, import_react22.useState)(true);
|
|
4244
|
+
const [lastScrollY, setLastScrollY] = (0, import_react22.useState)(0);
|
|
3893
4245
|
const isLeft = position === "left";
|
|
3894
4246
|
const handleItemClick = (itemId) => {
|
|
3895
4247
|
onItemClick(itemId);
|
|
3896
4248
|
setMobileMenuOpen(false);
|
|
3897
4249
|
};
|
|
3898
4250
|
const useSections = sections || (items ? [{ title: "", items }] : []);
|
|
3899
|
-
(0,
|
|
4251
|
+
(0, import_react22.useEffect)(() => {
|
|
3900
4252
|
if (!autoHideOnScroll) {
|
|
3901
4253
|
setIsHeaderVisible(true);
|
|
3902
4254
|
return;
|
|
@@ -3915,22 +4267,23 @@ function Drawer({
|
|
|
3915
4267
|
window.addEventListener("scroll", handleScroll, { passive: true });
|
|
3916
4268
|
return () => window.removeEventListener("scroll", handleScroll);
|
|
3917
4269
|
}, [lastScrollY, autoHideOnScroll]);
|
|
3918
|
-
return /* @__PURE__ */ (0,
|
|
3919
|
-
/* @__PURE__ */ (0,
|
|
4270
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(import_jsx_runtime22.Fragment, { children: [
|
|
4271
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
3920
4272
|
"div",
|
|
3921
4273
|
{
|
|
3922
|
-
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"}`,
|
|
4274
|
+
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"}`,
|
|
3923
4275
|
style: {
|
|
3924
|
-
|
|
3925
|
-
|
|
4276
|
+
backgroundColor: blur ? "var(--color-muted)" : transparent ? "transparent" : "var(--color-background)",
|
|
4277
|
+
opacity: blur ? 0.85 : 1,
|
|
4278
|
+
borderBottom: !borderless && !blur ? "1px solid var(--color-border)" : "none"
|
|
3926
4279
|
},
|
|
3927
|
-
children: /* @__PURE__ */ (0,
|
|
4280
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
|
|
3928
4281
|
"div",
|
|
3929
4282
|
{
|
|
3930
4283
|
className: `flex items-center ${isLeft ? "justify-between" : "justify-between flex-row-reverse"}`,
|
|
3931
4284
|
children: [
|
|
3932
|
-
/* @__PURE__ */ (0,
|
|
3933
|
-
homeUrl && /* @__PURE__ */ (0,
|
|
4285
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
4286
|
+
homeUrl && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
3934
4287
|
"a",
|
|
3935
4288
|
{
|
|
3936
4289
|
href: homeUrl,
|
|
@@ -3939,14 +4292,14 @@ function Drawer({
|
|
|
3939
4292
|
onMouseOver: (e) => e.currentTarget.style.background = "var(--color-muted)",
|
|
3940
4293
|
onMouseOut: (e) => e.currentTarget.style.background = "transparent",
|
|
3941
4294
|
"aria-label": "Go to home",
|
|
3942
|
-
children: /* @__PURE__ */ (0,
|
|
4295
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
3943
4296
|
"svg",
|
|
3944
4297
|
{
|
|
3945
4298
|
className: "w-5 h-5",
|
|
3946
4299
|
fill: "none",
|
|
3947
4300
|
stroke: "currentColor",
|
|
3948
4301
|
viewBox: "0 0 24 24",
|
|
3949
|
-
children: /* @__PURE__ */ (0,
|
|
4302
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
3950
4303
|
"path",
|
|
3951
4304
|
{
|
|
3952
4305
|
strokeLinecap: "round",
|
|
@@ -3959,7 +4312,7 @@ function Drawer({
|
|
|
3959
4312
|
)
|
|
3960
4313
|
}
|
|
3961
4314
|
),
|
|
3962
|
-
/* @__PURE__ */ (0,
|
|
4315
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
3963
4316
|
"button",
|
|
3964
4317
|
{
|
|
3965
4318
|
onClick: () => setMobileMenuOpen(!mobileMenuOpen),
|
|
@@ -3968,13 +4321,13 @@ function Drawer({
|
|
|
3968
4321
|
onMouseOver: (e) => e.currentTarget.style.background = "var(--color-muted)",
|
|
3969
4322
|
onMouseOut: (e) => e.currentTarget.style.background = "transparent",
|
|
3970
4323
|
"aria-label": "Toggle menu",
|
|
3971
|
-
children: mobileMenuOpen ? /* @__PURE__ */ (0,
|
|
4324
|
+
children: mobileMenuOpen ? /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_lucide_react4.X, { className: "w-6 h-6" }) : /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_lucide_react4.Menu, { className: "w-6 h-6" })
|
|
3972
4325
|
}
|
|
3973
4326
|
)
|
|
3974
4327
|
] }),
|
|
3975
|
-
headerActions && /* @__PURE__ */ (0,
|
|
3976
|
-
/* @__PURE__ */ (0,
|
|
3977
|
-
/* @__PURE__ */ (0,
|
|
4328
|
+
headerActions && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "flex items-center", children: headerActions }),
|
|
4329
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { children: [
|
|
4330
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
3978
4331
|
"h1",
|
|
3979
4332
|
{
|
|
3980
4333
|
className: "font-bold text-h5",
|
|
@@ -3984,7 +4337,7 @@ function Drawer({
|
|
|
3984
4337
|
children: title
|
|
3985
4338
|
}
|
|
3986
4339
|
),
|
|
3987
|
-
subtitle && /* @__PURE__ */ (0,
|
|
4340
|
+
subtitle && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
3988
4341
|
"p",
|
|
3989
4342
|
{
|
|
3990
4343
|
className: "text-caption",
|
|
@@ -4000,41 +4353,46 @@ function Drawer({
|
|
|
4000
4353
|
)
|
|
4001
4354
|
}
|
|
4002
4355
|
),
|
|
4003
|
-
mobileMenuOpen && /* @__PURE__ */ (0,
|
|
4356
|
+
mobileMenuOpen && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
4004
4357
|
"div",
|
|
4005
4358
|
{
|
|
4006
|
-
className: "fixed inset-0
|
|
4007
|
-
style: {
|
|
4359
|
+
className: "fixed inset-0 lg:hidden transition-opacity ease-in-out",
|
|
4360
|
+
style: {
|
|
4361
|
+
zIndex: 9998,
|
|
4362
|
+
transitionDuration: "var(--transition-drawer-duration, 500ms)",
|
|
4363
|
+
backgroundColor: "var(--overlay-background, rgba(0, 0, 0, 0.4))"
|
|
4364
|
+
},
|
|
4008
4365
|
onClick: () => setMobileMenuOpen(false)
|
|
4009
4366
|
}
|
|
4010
4367
|
),
|
|
4011
|
-
/* @__PURE__ */ (0,
|
|
4368
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
|
|
4012
4369
|
"aside",
|
|
4013
4370
|
{
|
|
4014
4371
|
className: `
|
|
4015
4372
|
fixed top-0 bottom-0 w-64
|
|
4016
|
-
transition-
|
|
4373
|
+
transition-all ease-out overflow-y-auto
|
|
4017
4374
|
${isLeft ? "left-0" : "right-0"}
|
|
4018
4375
|
lg:translate-x-0 lg:top-0
|
|
4019
4376
|
${mobileMenuOpen ? "translate-x-0 top-0" : `${isLeft ? "-translate-x-full" : "translate-x-full"} top-0`}
|
|
4020
4377
|
`,
|
|
4021
4378
|
style: {
|
|
4379
|
+
transitionDuration: "var(--transition-drawer-duration, 500ms)",
|
|
4022
4380
|
background: "var(--color-background)",
|
|
4023
4381
|
borderLeft: isLeft ? "none" : "1px solid var(--color-border)",
|
|
4024
4382
|
borderRight: isLeft ? "1px solid var(--color-border)" : "none",
|
|
4025
4383
|
...mobileMenuOpen && typeof window !== "undefined" && window.innerWidth < 1024 ? { zIndex: 9999 } : {}
|
|
4026
4384
|
},
|
|
4027
4385
|
children: [
|
|
4028
|
-
/* @__PURE__ */ (0,
|
|
4386
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
|
|
4029
4387
|
"div",
|
|
4030
4388
|
{
|
|
4031
4389
|
className: "hidden lg:block px-6 py-5",
|
|
4032
4390
|
style: {
|
|
4033
|
-
borderBottom: "
|
|
4034
|
-
background: "var(--color-
|
|
4391
|
+
borderBottom: "none",
|
|
4392
|
+
background: "var(--color-muted)"
|
|
4035
4393
|
},
|
|
4036
4394
|
children: [
|
|
4037
|
-
/* @__PURE__ */ (0,
|
|
4395
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
4038
4396
|
"h1",
|
|
4039
4397
|
{
|
|
4040
4398
|
className: "font-bold text-h5",
|
|
@@ -4044,7 +4402,7 @@ function Drawer({
|
|
|
4044
4402
|
children: title
|
|
4045
4403
|
}
|
|
4046
4404
|
),
|
|
4047
|
-
subtitle && /* @__PURE__ */ (0,
|
|
4405
|
+
subtitle && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
4048
4406
|
"p",
|
|
4049
4407
|
{
|
|
4050
4408
|
className: "mt-0.5 text-caption",
|
|
@@ -4057,14 +4415,14 @@ function Drawer({
|
|
|
4057
4415
|
]
|
|
4058
4416
|
}
|
|
4059
4417
|
),
|
|
4060
|
-
/* @__PURE__ */ (0,
|
|
4418
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
|
|
4061
4419
|
"div",
|
|
4062
4420
|
{
|
|
4063
4421
|
className: "lg:hidden p-4 flex items-center justify-between",
|
|
4064
4422
|
style: { borderBottom: "1px solid var(--color-border)" },
|
|
4065
4423
|
children: [
|
|
4066
|
-
/* @__PURE__ */ (0,
|
|
4067
|
-
/* @__PURE__ */ (0,
|
|
4424
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { children: [
|
|
4425
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
4068
4426
|
"h1",
|
|
4069
4427
|
{
|
|
4070
4428
|
className: "font-bold text-h5",
|
|
@@ -4074,7 +4432,7 @@ function Drawer({
|
|
|
4074
4432
|
children: title
|
|
4075
4433
|
}
|
|
4076
4434
|
),
|
|
4077
|
-
subtitle && /* @__PURE__ */ (0,
|
|
4435
|
+
subtitle && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
4078
4436
|
"p",
|
|
4079
4437
|
{
|
|
4080
4438
|
className: "mt-1 text-caption",
|
|
@@ -4085,7 +4443,7 @@ function Drawer({
|
|
|
4085
4443
|
}
|
|
4086
4444
|
)
|
|
4087
4445
|
] }),
|
|
4088
|
-
/* @__PURE__ */ (0,
|
|
4446
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
4089
4447
|
"button",
|
|
4090
4448
|
{
|
|
4091
4449
|
onClick: () => setMobileMenuOpen(false),
|
|
@@ -4094,20 +4452,20 @@ function Drawer({
|
|
|
4094
4452
|
onMouseOver: (e) => e.currentTarget.style.background = "var(--color-muted)",
|
|
4095
4453
|
onMouseOut: (e) => e.currentTarget.style.background = "transparent",
|
|
4096
4454
|
"aria-label": "Close menu",
|
|
4097
|
-
children: /* @__PURE__ */ (0,
|
|
4455
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_lucide_react4.X, { className: "w-5 h-5" })
|
|
4098
4456
|
}
|
|
4099
4457
|
)
|
|
4100
4458
|
]
|
|
4101
4459
|
}
|
|
4102
4460
|
),
|
|
4103
|
-
/* @__PURE__ */ (0,
|
|
4461
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("nav", { className: "px-3 py-4", children: useSections.map((section, sectionIndex) => /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
|
|
4104
4462
|
"div",
|
|
4105
4463
|
{
|
|
4106
4464
|
style: {
|
|
4107
4465
|
paddingTop: sectionIndex > 0 ? "var(--drawer-section-padding-y)" : "0"
|
|
4108
4466
|
},
|
|
4109
4467
|
children: [
|
|
4110
|
-
section.title && /* @__PURE__ */ (0,
|
|
4468
|
+
section.title && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
4111
4469
|
"h3",
|
|
4112
4470
|
{
|
|
4113
4471
|
className: "font-semibold uppercase tracking-wide text-caption",
|
|
@@ -4119,7 +4477,7 @@ function Drawer({
|
|
|
4119
4477
|
children: section.title
|
|
4120
4478
|
}
|
|
4121
4479
|
),
|
|
4122
|
-
/* @__PURE__ */ (0,
|
|
4480
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
4123
4481
|
"ul",
|
|
4124
4482
|
{
|
|
4125
4483
|
style: {
|
|
@@ -4127,7 +4485,7 @@ function Drawer({
|
|
|
4127
4485
|
flexDirection: "column",
|
|
4128
4486
|
gap: "var(--drawer-item-spacing)"
|
|
4129
4487
|
},
|
|
4130
|
-
children: section.items.map((item) => /* @__PURE__ */ (0,
|
|
4488
|
+
children: section.items.map((item) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("li", { children: /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
|
|
4131
4489
|
"button",
|
|
4132
4490
|
{
|
|
4133
4491
|
onClick: () => handleItemClick(item.id),
|
|
@@ -4155,8 +4513,8 @@ function Drawer({
|
|
|
4155
4513
|
boxShadow: activeItem === item.id ? "0 1px 3px rgba(0,0,0,0.1)" : "none"
|
|
4156
4514
|
},
|
|
4157
4515
|
children: [
|
|
4158
|
-
item.icon && /* @__PURE__ */ (0,
|
|
4159
|
-
/* @__PURE__ */ (0,
|
|
4516
|
+
item.icon && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "shrink-0 opacity-75", children: item.icon }),
|
|
4517
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { children: item.label })
|
|
4160
4518
|
]
|
|
4161
4519
|
}
|
|
4162
4520
|
) }, item.id))
|
|
@@ -4166,7 +4524,7 @@ function Drawer({
|
|
|
4166
4524
|
},
|
|
4167
4525
|
sectionIndex
|
|
4168
4526
|
)) }),
|
|
4169
|
-
footer && /* @__PURE__ */ (0,
|
|
4527
|
+
footer && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
4170
4528
|
"div",
|
|
4171
4529
|
{
|
|
4172
4530
|
className: "p-4 mt-auto",
|
|
@@ -4180,50 +4538,9 @@ function Drawer({
|
|
|
4180
4538
|
] });
|
|
4181
4539
|
}
|
|
4182
4540
|
|
|
4183
|
-
// src/layout/header.tsx
|
|
4184
|
-
var import_react21 = require("react");
|
|
4185
|
-
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
4186
|
-
function Header({
|
|
4187
|
-
children,
|
|
4188
|
-
autoHideOnScroll = true,
|
|
4189
|
-
className = "",
|
|
4190
|
-
position = "fixed"
|
|
4191
|
-
}) {
|
|
4192
|
-
const [isHeaderVisible, setIsHeaderVisible] = (0, import_react21.useState)(true);
|
|
4193
|
-
const [lastScrollY, setLastScrollY] = (0, import_react21.useState)(0);
|
|
4194
|
-
(0, import_react21.useEffect)(() => {
|
|
4195
|
-
if (!autoHideOnScroll || position === "static") {
|
|
4196
|
-
setIsHeaderVisible(true);
|
|
4197
|
-
return;
|
|
4198
|
-
}
|
|
4199
|
-
const handleScroll = () => {
|
|
4200
|
-
const currentScrollY = window.scrollY;
|
|
4201
|
-
if (currentScrollY < 10) {
|
|
4202
|
-
setIsHeaderVisible(true);
|
|
4203
|
-
} else if (currentScrollY > lastScrollY) {
|
|
4204
|
-
setIsHeaderVisible(false);
|
|
4205
|
-
} else {
|
|
4206
|
-
setIsHeaderVisible(true);
|
|
4207
|
-
}
|
|
4208
|
-
setLastScrollY(currentScrollY);
|
|
4209
|
-
};
|
|
4210
|
-
window.addEventListener("scroll", handleScroll, { passive: true });
|
|
4211
|
-
return () => window.removeEventListener("scroll", handleScroll);
|
|
4212
|
-
}, [lastScrollY, autoHideOnScroll, position]);
|
|
4213
|
-
const positionClass = position === "static" ? "" : position;
|
|
4214
|
-
const transformClass = autoHideOnScroll && position !== "static" ? `transition-transform duration-500 ease-in-out ${isHeaderVisible ? "translate-y-0" : "-translate-y-full"}` : "";
|
|
4215
|
-
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
4216
|
-
"header",
|
|
4217
|
-
{
|
|
4218
|
-
className: `${positionClass} top-0 left-0 right-0 ${transformClass} ${className}`,
|
|
4219
|
-
children
|
|
4220
|
-
}
|
|
4221
|
-
);
|
|
4222
|
-
}
|
|
4223
|
-
|
|
4224
4541
|
// src/layout/sidebar-nav.tsx
|
|
4225
4542
|
var import_lucide_react5 = require("lucide-react");
|
|
4226
|
-
var
|
|
4543
|
+
var import_react23 = require("react");
|
|
4227
4544
|
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
4228
4545
|
function SidebarNav({
|
|
4229
4546
|
title,
|
|
@@ -4235,7 +4552,7 @@ function SidebarNav({
|
|
|
4235
4552
|
footer,
|
|
4236
4553
|
position = "right"
|
|
4237
4554
|
}) {
|
|
4238
|
-
const [mobileMenuOpen, setMobileMenuOpen] = (0,
|
|
4555
|
+
const [mobileMenuOpen, setMobileMenuOpen] = (0, import_react23.useState)(false);
|
|
4239
4556
|
const isLeft = position === "left";
|
|
4240
4557
|
const handleItemClick = (itemId) => {
|
|
4241
4558
|
onItemClick(itemId);
|
|
@@ -4320,9 +4637,9 @@ function SidebarNav({
|
|
|
4320
4637
|
}
|
|
4321
4638
|
|
|
4322
4639
|
// src/shared/empty-state.tsx
|
|
4323
|
-
var
|
|
4640
|
+
var import_react24 = __toESM(require("react"));
|
|
4324
4641
|
var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
4325
|
-
var EmptyState =
|
|
4642
|
+
var EmptyState = import_react24.default.forwardRef(
|
|
4326
4643
|
({ className, icon, title, description, action, ...props }, ref) => {
|
|
4327
4644
|
return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
|
|
4328
4645
|
"div",
|
|
@@ -4346,7 +4663,7 @@ var EmptyState = import_react23.default.forwardRef(
|
|
|
4346
4663
|
EmptyState.displayName = "EmptyState";
|
|
4347
4664
|
|
|
4348
4665
|
// src/contexts/ThemeProvider.tsx
|
|
4349
|
-
var
|
|
4666
|
+
var import_react25 = require("react");
|
|
4350
4667
|
|
|
4351
4668
|
// src/themes/dark.json
|
|
4352
4669
|
var dark_default = {
|
|
@@ -4451,6 +4768,12 @@ var dark_default = {
|
|
|
4451
4768
|
"indigo-bg-hover": "#383570",
|
|
4452
4769
|
"indigo-text": "#a8a5e8"
|
|
4453
4770
|
}
|
|
4771
|
+
},
|
|
4772
|
+
transitions: {
|
|
4773
|
+
"drawer-duration": "500ms"
|
|
4774
|
+
},
|
|
4775
|
+
overlay: {
|
|
4776
|
+
background: "rgba(0, 0, 0, 0.5)"
|
|
4454
4777
|
}
|
|
4455
4778
|
};
|
|
4456
4779
|
|
|
@@ -4557,6 +4880,12 @@ var light_default = {
|
|
|
4557
4880
|
"indigo-bg-hover": "#c7d2fe",
|
|
4558
4881
|
"indigo-text": "#4f46e5"
|
|
4559
4882
|
}
|
|
4883
|
+
},
|
|
4884
|
+
transitions: {
|
|
4885
|
+
"drawer-duration": "500ms"
|
|
4886
|
+
},
|
|
4887
|
+
overlay: {
|
|
4888
|
+
background: "rgba(0, 0, 0, 0.4)"
|
|
4560
4889
|
}
|
|
4561
4890
|
};
|
|
4562
4891
|
|
|
@@ -4569,7 +4898,7 @@ var themes_default = themes2;
|
|
|
4569
4898
|
|
|
4570
4899
|
// src/contexts/ThemeProvider.tsx
|
|
4571
4900
|
var import_jsx_runtime25 = require("react/jsx-runtime");
|
|
4572
|
-
var ThemeContext = (0,
|
|
4901
|
+
var ThemeContext = (0, import_react25.createContext)(void 0);
|
|
4573
4902
|
var themeRegistry = themes_default;
|
|
4574
4903
|
var getInitialTheme = (defaultTheme = "dark") => {
|
|
4575
4904
|
if (typeof window === "undefined") return defaultTheme;
|
|
@@ -4586,10 +4915,10 @@ function ThemeProvider({
|
|
|
4586
4915
|
customTheme,
|
|
4587
4916
|
storageKey = "yomologic-theme"
|
|
4588
4917
|
}) {
|
|
4589
|
-
const [currentTheme, setCurrentTheme] = (0,
|
|
4918
|
+
const [currentTheme, setCurrentTheme] = (0, import_react25.useState)(
|
|
4590
4919
|
() => getInitialTheme(defaultTheme)
|
|
4591
4920
|
);
|
|
4592
|
-
const [availableThemes] = (0,
|
|
4921
|
+
const [availableThemes] = (0, import_react25.useState)(
|
|
4593
4922
|
Object.values(themeRegistry).map((t) => ({ id: t.id, name: t.name }))
|
|
4594
4923
|
);
|
|
4595
4924
|
const setCSSVariable = (name, value) => {
|
|
@@ -4628,6 +4957,16 @@ function ThemeProvider({
|
|
|
4628
4957
|
setCSSVariable(varName, value);
|
|
4629
4958
|
});
|
|
4630
4959
|
});
|
|
4960
|
+
if (theme.transitions) {
|
|
4961
|
+
Object.entries(theme.transitions).forEach(([key, value]) => {
|
|
4962
|
+
setCSSVariable(`--transition-${key}`, value);
|
|
4963
|
+
});
|
|
4964
|
+
}
|
|
4965
|
+
if (theme.overlay) {
|
|
4966
|
+
Object.entries(theme.overlay).forEach(([key, value]) => {
|
|
4967
|
+
setCSSVariable(`--overlay-${key}`, value);
|
|
4968
|
+
});
|
|
4969
|
+
}
|
|
4631
4970
|
setCSSVariable("--background", theme.colors.background);
|
|
4632
4971
|
setCSSVariable("--foreground", theme.colors.foreground);
|
|
4633
4972
|
};
|
|
@@ -4681,7 +5020,7 @@ function ThemeProvider({
|
|
|
4681
5020
|
`;
|
|
4682
5021
|
return css;
|
|
4683
5022
|
};
|
|
4684
|
-
(0,
|
|
5023
|
+
(0, import_react25.useEffect)(() => {
|
|
4685
5024
|
const theme = customTheme || themeRegistry[currentTheme];
|
|
4686
5025
|
if (theme) {
|
|
4687
5026
|
applyTheme(theme);
|
|
@@ -4703,7 +5042,7 @@ function ThemeProvider({
|
|
|
4703
5042
|
);
|
|
4704
5043
|
}
|
|
4705
5044
|
function useTheme() {
|
|
4706
|
-
const context = (0,
|
|
5045
|
+
const context = (0, import_react25.useContext)(ThemeContext);
|
|
4707
5046
|
if (context === void 0) {
|
|
4708
5047
|
throw new Error("useTheme must be used within a ThemeProvider");
|
|
4709
5048
|
}
|
|
@@ -4740,7 +5079,6 @@ function useTheme() {
|
|
|
4740
5079
|
FormControl,
|
|
4741
5080
|
FormControlLabel,
|
|
4742
5081
|
FormHelperText,
|
|
4743
|
-
Header,
|
|
4744
5082
|
Input,
|
|
4745
5083
|
Nav,
|
|
4746
5084
|
RadioGroup,
|
|
@@ -4751,6 +5089,7 @@ function useTheme() {
|
|
|
4751
5089
|
Slider,
|
|
4752
5090
|
Spinner,
|
|
4753
5091
|
Switch,
|
|
5092
|
+
Textarea,
|
|
4754
5093
|
ThemeProvider,
|
|
4755
5094
|
cn,
|
|
4756
5095
|
themes,
|