@algorithm-shift/design-system 1.2.41 → 1.2.43
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 +13 -3
- package/dist/index.d.ts +13 -3
- package/dist/index.js +189 -193
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +179 -184
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -43,7 +43,8 @@ __export(index_exports, {
|
|
|
43
43
|
EmailComposer: () => EmailComposer,
|
|
44
44
|
FileInput: () => FileInput_default,
|
|
45
45
|
FlexLayout: () => Flex_default,
|
|
46
|
-
Form: () =>
|
|
46
|
+
Form: () => Form_default,
|
|
47
|
+
FormWrapper: () => Wrapper_default,
|
|
47
48
|
GridLayout: () => Grid_default,
|
|
48
49
|
Image: () => Image_default,
|
|
49
50
|
Modal: () => Modal_default,
|
|
@@ -677,9 +678,6 @@ function SplitButton({ style, textContent, className, list = [], LinkComponent }
|
|
|
677
678
|
] });
|
|
678
679
|
}
|
|
679
680
|
|
|
680
|
-
// src/components/Inputs/TextInput/TextInput.tsx
|
|
681
|
-
var React2 = __toESM(require("react"));
|
|
682
|
-
|
|
683
681
|
// src/components/ui/input.tsx
|
|
684
682
|
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
685
683
|
function Input({ className, type, ...props }) {
|
|
@@ -707,11 +705,6 @@ var TextInput = ({ className, style, ...props }) => {
|
|
|
707
705
|
const isDisabled = props.isDisabled ?? false;
|
|
708
706
|
const isReadonly = props.isReadonly ?? false;
|
|
709
707
|
const isAutocomplete = props.isAutocomplete ?? false;
|
|
710
|
-
const [error, setError] = React2.useState(null);
|
|
711
|
-
React2.useEffect(() => {
|
|
712
|
-
if (!props.validateOnMount) return;
|
|
713
|
-
setError(props.errorMessage || null);
|
|
714
|
-
}, [props.errorMessage, props.validateOnMount]);
|
|
715
708
|
const handleChange = (e) => {
|
|
716
709
|
props.onChange?.(e);
|
|
717
710
|
};
|
|
@@ -721,10 +714,10 @@ var TextInput = ({ className, style, ...props }) => {
|
|
|
721
714
|
{
|
|
722
715
|
type: "text",
|
|
723
716
|
name: props.name,
|
|
724
|
-
className: cn(className,
|
|
717
|
+
className: cn(className, props.errorMessage ? "border-red-500" : ""),
|
|
725
718
|
style: {
|
|
726
719
|
...style,
|
|
727
|
-
borderColor:
|
|
720
|
+
borderColor: props.errorMessage ? "#f87171" : style?.borderColor
|
|
728
721
|
},
|
|
729
722
|
value: props.value,
|
|
730
723
|
autoComplete: isAutocomplete ? "on" : "off",
|
|
@@ -734,14 +727,12 @@ var TextInput = ({ className, style, ...props }) => {
|
|
|
734
727
|
readOnly: isReadonly
|
|
735
728
|
}
|
|
736
729
|
),
|
|
737
|
-
|
|
730
|
+
props.errorMessage && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("p", { className: "mt-1 text-xs text-red-500", children: props.errorMessage })
|
|
738
731
|
] });
|
|
739
732
|
};
|
|
740
733
|
var TextInput_default = TextInput;
|
|
741
734
|
|
|
742
735
|
// src/components/Inputs/NumberInput/NumberInput.tsx
|
|
743
|
-
var React3 = __toESM(require("react"));
|
|
744
|
-
var import_react4 = require("react");
|
|
745
736
|
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
746
737
|
var NumberInput = ({ className, style, ...props }) => {
|
|
747
738
|
const placeholder = props.placeholder ?? "Placeholder text";
|
|
@@ -749,11 +740,6 @@ var NumberInput = ({ className, style, ...props }) => {
|
|
|
749
740
|
const isDisabled = props.isDisabled ?? false;
|
|
750
741
|
const isReadonly = props.isReadonly ?? false;
|
|
751
742
|
const isAutocomplete = props.isAutocomplete ?? false;
|
|
752
|
-
const [error, setError] = React3.useState(null);
|
|
753
|
-
(0, import_react4.useEffect)(() => {
|
|
754
|
-
if (!props.validateOnMount) return;
|
|
755
|
-
setError(props.errorMessage || null);
|
|
756
|
-
}, [props.errorMessage, props.validateOnMount]);
|
|
757
743
|
const handleChange = (e) => {
|
|
758
744
|
props.onChange?.(e);
|
|
759
745
|
};
|
|
@@ -767,10 +753,10 @@ var NumberInput = ({ className, style, ...props }) => {
|
|
|
767
753
|
id: props.name || "number-field",
|
|
768
754
|
name: props.name,
|
|
769
755
|
value: props.value,
|
|
770
|
-
className: cn(className,
|
|
756
|
+
className: cn(className, props.errorMessage ? "border-red-500" : ""),
|
|
771
757
|
style: {
|
|
772
758
|
...style,
|
|
773
|
-
borderColor:
|
|
759
|
+
borderColor: props.errorMessage ? "#f87171" : style?.borderColor
|
|
774
760
|
},
|
|
775
761
|
autoComplete: isAutocomplete ? "on" : "off",
|
|
776
762
|
placeholder,
|
|
@@ -780,13 +766,12 @@ var NumberInput = ({ className, style, ...props }) => {
|
|
|
780
766
|
}
|
|
781
767
|
)
|
|
782
768
|
] }),
|
|
783
|
-
|
|
769
|
+
props.errorMessage && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("p", { className: "mt-1 text-xs text-red-500", children: props.errorMessage })
|
|
784
770
|
] });
|
|
785
771
|
};
|
|
786
772
|
var NumberInput_default = NumberInput;
|
|
787
773
|
|
|
788
774
|
// src/components/Inputs/EmailInput/EmailInput.tsx
|
|
789
|
-
var React4 = __toESM(require("react"));
|
|
790
775
|
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
791
776
|
var EmailInput = ({ className, style, ...props }) => {
|
|
792
777
|
const placeholder = props.placeholder ?? "Placeholder text";
|
|
@@ -794,11 +779,6 @@ var EmailInput = ({ className, style, ...props }) => {
|
|
|
794
779
|
const isDisabled = props.isDisabled ?? false;
|
|
795
780
|
const isReadonly = props.isReadonly ?? false;
|
|
796
781
|
const isAutocomplete = props.isAutocomplete ?? false;
|
|
797
|
-
const [error, setError] = React4.useState(null);
|
|
798
|
-
React4.useEffect(() => {
|
|
799
|
-
if (!props.validateOnMount) return;
|
|
800
|
-
setError(props.errorMessage || null);
|
|
801
|
-
}, [props.errorMessage, props.validateOnMount]);
|
|
802
782
|
const handleChange = (e) => {
|
|
803
783
|
props.onChange?.(e);
|
|
804
784
|
};
|
|
@@ -811,10 +791,10 @@ var EmailInput = ({ className, style, ...props }) => {
|
|
|
811
791
|
type: "email",
|
|
812
792
|
name: props.name,
|
|
813
793
|
value: props.value,
|
|
814
|
-
className: cn(className,
|
|
794
|
+
className: cn(className, props.errorMessage ? "border-red-500" : ""),
|
|
815
795
|
style: {
|
|
816
796
|
...style,
|
|
817
|
-
borderColor:
|
|
797
|
+
borderColor: props.errorMessage ? "#f87171" : style?.borderColor
|
|
818
798
|
},
|
|
819
799
|
autoComplete: isAutocomplete ? "on" : "off",
|
|
820
800
|
placeholder,
|
|
@@ -824,13 +804,12 @@ var EmailInput = ({ className, style, ...props }) => {
|
|
|
824
804
|
}
|
|
825
805
|
)
|
|
826
806
|
] }),
|
|
827
|
-
|
|
807
|
+
props.errorMessage && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("p", { className: "mt-1 text-xs text-red-500", children: props.errorMessage })
|
|
828
808
|
] });
|
|
829
809
|
};
|
|
830
810
|
var EmailInput_default = EmailInput;
|
|
831
811
|
|
|
832
812
|
// src/components/Inputs/PasswordInput/PasswordInput.tsx
|
|
833
|
-
var React5 = __toESM(require("react"));
|
|
834
813
|
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
835
814
|
var PasswordInput = ({ className, style, ...props }) => {
|
|
836
815
|
const placeholder = props.placeholder ?? "Placeholder text";
|
|
@@ -838,11 +817,6 @@ var PasswordInput = ({ className, style, ...props }) => {
|
|
|
838
817
|
const isDisabled = props.isDisabled ?? false;
|
|
839
818
|
const isReadonly = props.isReadonly ?? false;
|
|
840
819
|
const isAutocomplete = props.isAutocomplete ?? false;
|
|
841
|
-
const [error, setError] = React5.useState(null);
|
|
842
|
-
React5.useEffect(() => {
|
|
843
|
-
if (!props.validateOnMount) return;
|
|
844
|
-
setError(props.errorMessage || null);
|
|
845
|
-
}, [props.errorMessage, props.validateOnMount]);
|
|
846
820
|
const handleChange = (e) => {
|
|
847
821
|
props.onChange?.(e);
|
|
848
822
|
};
|
|
@@ -856,10 +830,10 @@ var PasswordInput = ({ className, style, ...props }) => {
|
|
|
856
830
|
id: props.name || "password-field",
|
|
857
831
|
name: props.name,
|
|
858
832
|
value: props.value,
|
|
859
|
-
className: cn(className,
|
|
833
|
+
className: cn(className, props.errorMessage ? "border-red-500" : ""),
|
|
860
834
|
style: {
|
|
861
835
|
...style,
|
|
862
|
-
borderColor:
|
|
836
|
+
borderColor: props.errorMessage ? "#f87171" : style?.borderColor
|
|
863
837
|
},
|
|
864
838
|
autoComplete: isAutocomplete ? "on" : "off",
|
|
865
839
|
placeholder,
|
|
@@ -869,14 +843,11 @@ var PasswordInput = ({ className, style, ...props }) => {
|
|
|
869
843
|
}
|
|
870
844
|
)
|
|
871
845
|
] }),
|
|
872
|
-
|
|
846
|
+
props.errorMessage && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("p", { className: "mt-1 text-xs text-red-500", children: props.errorMessage })
|
|
873
847
|
] });
|
|
874
848
|
};
|
|
875
849
|
var PasswordInput_default = PasswordInput;
|
|
876
850
|
|
|
877
|
-
// src/components/Inputs/Textarea/Textarea.tsx
|
|
878
|
-
var React6 = __toESM(require("react"));
|
|
879
|
-
|
|
880
851
|
// src/components/ui/textarea.tsx
|
|
881
852
|
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
882
853
|
function Textarea({ className, ...props }) {
|
|
@@ -901,11 +872,6 @@ var Textarea2 = ({ className, style, ...props }) => {
|
|
|
901
872
|
const isDisabled = props.isDisabled ?? false;
|
|
902
873
|
const isReadonly = props.isReadonly ?? false;
|
|
903
874
|
const isAutocomplete = props.isAutocomplete ?? false;
|
|
904
|
-
const [error, setError] = React6.useState(null);
|
|
905
|
-
React6.useEffect(() => {
|
|
906
|
-
if (!props.validateOnMount) return;
|
|
907
|
-
setError(props.errorMessage || null);
|
|
908
|
-
}, [props.errorMessage, props.validateOnMount]);
|
|
909
875
|
const handleChange = (e) => {
|
|
910
876
|
props.onChange?.(e);
|
|
911
877
|
};
|
|
@@ -916,10 +882,10 @@ var Textarea2 = ({ className, style, ...props }) => {
|
|
|
916
882
|
id: "textarea-field",
|
|
917
883
|
name: props.name,
|
|
918
884
|
value: props.value,
|
|
919
|
-
className: cn(className,
|
|
885
|
+
className: cn(className, props.errorMessage ? "border-red-500" : ""),
|
|
920
886
|
style: {
|
|
921
887
|
...style,
|
|
922
|
-
borderColor:
|
|
888
|
+
borderColor: props.errorMessage ? "#f87171" : style?.borderColor
|
|
923
889
|
},
|
|
924
890
|
autoComplete: isAutocomplete ? "on" : "off",
|
|
925
891
|
placeholder,
|
|
@@ -928,13 +894,12 @@ var Textarea2 = ({ className, style, ...props }) => {
|
|
|
928
894
|
readOnly: isReadonly
|
|
929
895
|
}
|
|
930
896
|
),
|
|
931
|
-
|
|
897
|
+
props.errorMessage && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("p", { className: "mt-1 text-xs text-red-500", children: props.errorMessage })
|
|
932
898
|
] });
|
|
933
899
|
};
|
|
934
900
|
var Textarea_default = Textarea2;
|
|
935
901
|
|
|
936
902
|
// src/components/Inputs/UrlInput/UrlInput.tsx
|
|
937
|
-
var React7 = __toESM(require("react"));
|
|
938
903
|
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
939
904
|
var UrlInput = ({ className, style, ...props }) => {
|
|
940
905
|
const placeholder = props.placeholder ?? "Placeholder text";
|
|
@@ -942,11 +907,6 @@ var UrlInput = ({ className, style, ...props }) => {
|
|
|
942
907
|
const isDisabled = props.isDisabled ?? false;
|
|
943
908
|
const isReadonly = props.isReadonly ?? false;
|
|
944
909
|
const isAutocomplete = props.isAutocomplete ?? false;
|
|
945
|
-
const [error, setError] = React7.useState(null);
|
|
946
|
-
React7.useEffect(() => {
|
|
947
|
-
if (!props.validateOnMount) return;
|
|
948
|
-
setError(props.errorMessage || null);
|
|
949
|
-
}, [props.errorMessage, props.validateOnMount]);
|
|
950
910
|
const handleChange = (e) => {
|
|
951
911
|
props.onChange?.(e);
|
|
952
912
|
};
|
|
@@ -960,10 +920,10 @@ var UrlInput = ({ className, style, ...props }) => {
|
|
|
960
920
|
type: "url",
|
|
961
921
|
name: props.name,
|
|
962
922
|
value: props.value,
|
|
963
|
-
className: cn(className,
|
|
923
|
+
className: cn(className, props.errorMessage ? "border-red-500" : ""),
|
|
964
924
|
style: {
|
|
965
925
|
...style,
|
|
966
|
-
borderColor:
|
|
926
|
+
borderColor: props.errorMessage ? "#f87171" : style?.borderColor
|
|
967
927
|
},
|
|
968
928
|
autoComplete: isAutocomplete ? "on" : "off",
|
|
969
929
|
placeholder,
|
|
@@ -973,14 +933,11 @@ var UrlInput = ({ className, style, ...props }) => {
|
|
|
973
933
|
}
|
|
974
934
|
)
|
|
975
935
|
] }),
|
|
976
|
-
|
|
936
|
+
props.errorMessage && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("p", { className: "mt-1 text-xs text-red-500", children: props.errorMessage })
|
|
977
937
|
] });
|
|
978
938
|
};
|
|
979
939
|
var UrlInput_default = UrlInput;
|
|
980
940
|
|
|
981
|
-
// src/components/Inputs/Checkbox/Checkbox.tsx
|
|
982
|
-
var import_react5 = require("react");
|
|
983
|
-
|
|
984
941
|
// src/components/ui/checkbox.tsx
|
|
985
942
|
var CheckboxPrimitive = __toESM(require("@radix-ui/react-checkbox"));
|
|
986
943
|
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
@@ -1035,11 +992,6 @@ var CheckboxInput = ({ className, style, ...props }) => {
|
|
|
1035
992
|
const isEditable = props.isEditable ?? true;
|
|
1036
993
|
const isDisabled = props.isDisabled ?? false;
|
|
1037
994
|
const text = props.text ? props.text : "Subscribe";
|
|
1038
|
-
const [error, setError] = (0, import_react5.useState)(null);
|
|
1039
|
-
(0, import_react5.useEffect)(() => {
|
|
1040
|
-
if (!props.validateOnMount) return;
|
|
1041
|
-
setError(props.errorMessage || null);
|
|
1042
|
-
}, [props.errorMessage, props.validateOnMount]);
|
|
1043
995
|
const handleChange = (value) => {
|
|
1044
996
|
props.onChange?.(value);
|
|
1045
997
|
};
|
|
@@ -1056,14 +1008,11 @@ var CheckboxInput = ({ className, style, ...props }) => {
|
|
|
1056
1008
|
),
|
|
1057
1009
|
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Label2, { htmlFor: props.name || "checkbox", children: text })
|
|
1058
1010
|
] }) }),
|
|
1059
|
-
|
|
1011
|
+
props.errorMessage && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("p", { className: "mt-1 text-xs text-red-500", children: props.errorMessage })
|
|
1060
1012
|
] });
|
|
1061
1013
|
};
|
|
1062
1014
|
var Checkbox_default = CheckboxInput;
|
|
1063
1015
|
|
|
1064
|
-
// src/components/Inputs/RadioInput/RadioInput.tsx
|
|
1065
|
-
var import_react6 = require("react");
|
|
1066
|
-
|
|
1067
1016
|
// src/components/ui/radio-group.tsx
|
|
1068
1017
|
var RadioGroupPrimitive = __toESM(require("@radix-ui/react-radio-group"));
|
|
1069
1018
|
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
@@ -1117,11 +1066,6 @@ var RadioInput = ({
|
|
|
1117
1066
|
dataLabel,
|
|
1118
1067
|
...props
|
|
1119
1068
|
}) => {
|
|
1120
|
-
const [error, setError] = (0, import_react6.useState)(null);
|
|
1121
|
-
(0, import_react6.useEffect)(() => {
|
|
1122
|
-
if (!props.validateOnMount) return;
|
|
1123
|
-
setError(props.errorMessage || null);
|
|
1124
|
-
}, [props.errorMessage, props.validateOnMount]);
|
|
1125
1069
|
const options = (data || []).map((item) => ({
|
|
1126
1070
|
value: item[dataKey || "value"],
|
|
1127
1071
|
label: item[dataLabel || "label"]
|
|
@@ -1145,13 +1089,13 @@ var RadioInput = ({
|
|
|
1145
1089
|
]
|
|
1146
1090
|
}
|
|
1147
1091
|
) }),
|
|
1148
|
-
|
|
1092
|
+
props.errorMessage && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("p", { className: "mt-1 text-xs text-red-500", children: props.errorMessage })
|
|
1149
1093
|
] });
|
|
1150
1094
|
};
|
|
1151
1095
|
var RadioInput_default = RadioInput;
|
|
1152
1096
|
|
|
1153
1097
|
// src/components/Inputs/MultiCheckbox/MultiCheckbox.tsx
|
|
1154
|
-
var
|
|
1098
|
+
var import_react4 = require("react");
|
|
1155
1099
|
var import_jsx_runtime25 = require("react/jsx-runtime");
|
|
1156
1100
|
var MultiCheckbox = ({
|
|
1157
1101
|
className,
|
|
@@ -1164,12 +1108,12 @@ var MultiCheckbox = ({
|
|
|
1164
1108
|
isEditable = true,
|
|
1165
1109
|
isDisabled = false
|
|
1166
1110
|
}) => {
|
|
1167
|
-
const [value, setValue] = (0,
|
|
1111
|
+
const [value, setValue] = (0, import_react4.useState)(propValue);
|
|
1168
1112
|
const options = (data || []).map((item) => ({
|
|
1169
1113
|
value: item[dataKey || "value"],
|
|
1170
1114
|
label: item[dataLabel || "label"]
|
|
1171
1115
|
}));
|
|
1172
|
-
const handleChange = (0,
|
|
1116
|
+
const handleChange = (0, import_react4.useCallback)(
|
|
1173
1117
|
(key, checked) => {
|
|
1174
1118
|
setValue((prev) => {
|
|
1175
1119
|
const newValue = { ...prev, [key]: checked };
|
|
@@ -1204,11 +1148,8 @@ var MultiCheckbox = ({
|
|
|
1204
1148
|
};
|
|
1205
1149
|
var MultiCheckbox_default = MultiCheckbox;
|
|
1206
1150
|
|
|
1207
|
-
// src/components/Inputs/RichText/RichText.tsx
|
|
1208
|
-
var import_react9 = require("react");
|
|
1209
|
-
|
|
1210
1151
|
// src/components/Global/TinyMceEditor.tsx
|
|
1211
|
-
var
|
|
1152
|
+
var import_react5 = require("react");
|
|
1212
1153
|
var import_tinymce_react = require("@tinymce/tinymce-react");
|
|
1213
1154
|
var import_jsx_runtime26 = require("react/jsx-runtime");
|
|
1214
1155
|
function MyEditor({
|
|
@@ -1216,7 +1157,7 @@ function MyEditor({
|
|
|
1216
1157
|
onChange,
|
|
1217
1158
|
isDefault
|
|
1218
1159
|
}) {
|
|
1219
|
-
const editorRef = (0,
|
|
1160
|
+
const editorRef = (0, import_react5.useRef)(null);
|
|
1220
1161
|
function stripOuterP(html) {
|
|
1221
1162
|
const trimmedHtml = html.trim();
|
|
1222
1163
|
if (!trimmedHtml) return "";
|
|
@@ -1228,7 +1169,7 @@ function MyEditor({
|
|
|
1228
1169
|
}
|
|
1229
1170
|
return trimmedHtml;
|
|
1230
1171
|
}
|
|
1231
|
-
const isDefaultToolbar = (0,
|
|
1172
|
+
const isDefaultToolbar = (0, import_react5.useMemo)(() => {
|
|
1232
1173
|
let toolbar = "undo redo | formatselect | bold italic forecolor";
|
|
1233
1174
|
if (isDefault) {
|
|
1234
1175
|
toolbar = "undo redo | blocks | bold italic forecolor | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | removeformat | help";
|
|
@@ -1281,30 +1222,22 @@ function MyEditor({
|
|
|
1281
1222
|
// src/components/Inputs/RichText/RichText.tsx
|
|
1282
1223
|
var import_jsx_runtime27 = require("react/jsx-runtime");
|
|
1283
1224
|
function RichText({ className, style, ...props }) {
|
|
1284
|
-
const [error, setError] = (0, import_react9.useState)(null);
|
|
1285
|
-
(0, import_react9.useEffect)(() => {
|
|
1286
|
-
if (!props.validateOnMount) return;
|
|
1287
|
-
setError(props.errorMessage || null);
|
|
1288
|
-
}, [props.errorMessage, props.validateOnMount]);
|
|
1289
1225
|
return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
|
|
1290
1226
|
"div",
|
|
1291
1227
|
{
|
|
1292
|
-
className: cn(className,
|
|
1228
|
+
className: cn(className, props.errorMessage ? "border-red-500" : ""),
|
|
1293
1229
|
style: {
|
|
1294
1230
|
...style,
|
|
1295
|
-
borderColor:
|
|
1231
|
+
borderColor: props.errorMessage ? "#f87171" : style?.borderColor
|
|
1296
1232
|
},
|
|
1297
1233
|
children: [
|
|
1298
1234
|
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(MyEditor, { onChange: (content) => props.onChange?.(content), value: props.value, isDefault: true }),
|
|
1299
|
-
|
|
1235
|
+
props.errorMessage && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("p", { className: "mt-1 text-xs text-red-500", children: props.errorMessage })
|
|
1300
1236
|
]
|
|
1301
1237
|
}
|
|
1302
1238
|
);
|
|
1303
1239
|
}
|
|
1304
1240
|
|
|
1305
|
-
// src/components/Inputs/Dropdown/Dropdown.tsx
|
|
1306
|
-
var React8 = __toESM(require("react"));
|
|
1307
|
-
|
|
1308
1241
|
// src/components/ui/select.tsx
|
|
1309
1242
|
var SelectPrimitive = __toESM(require("@radix-ui/react-select"));
|
|
1310
1243
|
var import_jsx_runtime28 = require("react/jsx-runtime");
|
|
@@ -1439,11 +1372,6 @@ var Dropdown = ({ className, style, ...props }) => {
|
|
|
1439
1372
|
const isEditable = props.isEditable ?? true;
|
|
1440
1373
|
const isDisabled = props.isDisabled ?? false;
|
|
1441
1374
|
const isReadonly = props.isReadonly ?? false;
|
|
1442
|
-
const [error, setError] = React8.useState(null);
|
|
1443
|
-
React8.useEffect(() => {
|
|
1444
|
-
if (!props.validateOnMount) return;
|
|
1445
|
-
setError(props.errorMessage || null);
|
|
1446
|
-
}, [props.errorMessage, props.validateOnMount]);
|
|
1447
1375
|
const handleChange = (value) => {
|
|
1448
1376
|
props.onChange?.(value);
|
|
1449
1377
|
};
|
|
@@ -1459,10 +1387,10 @@ var Dropdown = ({ className, style, ...props }) => {
|
|
|
1459
1387
|
SelectTrigger,
|
|
1460
1388
|
{
|
|
1461
1389
|
id: props.name || "select-field",
|
|
1462
|
-
className: cn(className,
|
|
1390
|
+
className: cn(className, props.errorMessage ? "border-red-500" : ""),
|
|
1463
1391
|
style: {
|
|
1464
1392
|
...style,
|
|
1465
|
-
borderColor:
|
|
1393
|
+
borderColor: props.errorMessage ? "#f87171" : style?.borderColor
|
|
1466
1394
|
},
|
|
1467
1395
|
"aria-readonly": isReadonly,
|
|
1468
1396
|
children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(SelectValue, { placeholder })
|
|
@@ -1470,14 +1398,11 @@ var Dropdown = ({ className, style, ...props }) => {
|
|
|
1470
1398
|
),
|
|
1471
1399
|
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(SelectContent, { children: options.map((opt) => /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(SelectItem, { value: opt.value, children: opt.label }, opt.value)) })
|
|
1472
1400
|
] }),
|
|
1473
|
-
|
|
1401
|
+
props.errorMessage && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("p", { className: "mt-1 text-xs text-red-500", children: props.errorMessage })
|
|
1474
1402
|
] });
|
|
1475
1403
|
};
|
|
1476
1404
|
var Dropdown_default = Dropdown;
|
|
1477
1405
|
|
|
1478
|
-
// src/components/Inputs/SwitchToggle/SwitchToggle.tsx
|
|
1479
|
-
var import_react10 = require("react");
|
|
1480
|
-
|
|
1481
1406
|
// src/components/ui/switch.tsx
|
|
1482
1407
|
var SwitchPrimitive = __toESM(require("@radix-ui/react-switch"));
|
|
1483
1408
|
var import_jsx_runtime30 = require("react/jsx-runtime");
|
|
@@ -1512,11 +1437,6 @@ var import_jsx_runtime31 = require("react/jsx-runtime");
|
|
|
1512
1437
|
var SwitchToggle = ({ className, style, ...props }) => {
|
|
1513
1438
|
const isEditable = props.isEditable ?? true;
|
|
1514
1439
|
const isDisabled = props.isDisabled ?? false;
|
|
1515
|
-
const [error, setError] = (0, import_react10.useState)(null);
|
|
1516
|
-
(0, import_react10.useEffect)(() => {
|
|
1517
|
-
if (!props.validateOnMount) return;
|
|
1518
|
-
setError(props.errorMessage || null);
|
|
1519
|
-
}, [props.errorMessage, props.validateOnMount]);
|
|
1520
1440
|
const handleChange = (value) => {
|
|
1521
1441
|
props.onChange?.(value);
|
|
1522
1442
|
};
|
|
@@ -1533,13 +1453,12 @@ var SwitchToggle = ({ className, style, ...props }) => {
|
|
|
1533
1453
|
),
|
|
1534
1454
|
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(Label2, { htmlFor: props.name || "switch", children: props.text })
|
|
1535
1455
|
] }) }),
|
|
1536
|
-
|
|
1456
|
+
props.errorMessage && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("p", { className: "mt-1 text-xs text-red-500", children: props.errorMessage })
|
|
1537
1457
|
] });
|
|
1538
1458
|
};
|
|
1539
1459
|
var SwitchToggle_default = SwitchToggle;
|
|
1540
1460
|
|
|
1541
1461
|
// src/components/Inputs/PhoneInput/PhoneInput.tsx
|
|
1542
|
-
var React9 = __toESM(require("react"));
|
|
1543
1462
|
var import_react_international_phone = require("react-international-phone");
|
|
1544
1463
|
var import_style = require("react-international-phone/style.css");
|
|
1545
1464
|
var import_jsx_runtime32 = require("react/jsx-runtime");
|
|
@@ -1547,11 +1466,6 @@ var PhoneInput = ({ className, style, ...props }) => {
|
|
|
1547
1466
|
const placeholder = props.placeholder ?? "Enter phone number";
|
|
1548
1467
|
const isEditable = props.isEditable ?? true;
|
|
1549
1468
|
const isDisabled = props.isDisabled ?? false;
|
|
1550
|
-
const [error, setError] = React9.useState(null);
|
|
1551
|
-
React9.useEffect(() => {
|
|
1552
|
-
if (!props.validateOnMount) return;
|
|
1553
|
-
setError(props.errorMessage || null);
|
|
1554
|
-
}, [props.errorMessage, props.validateOnMount]);
|
|
1555
1469
|
const handleChange = (val) => {
|
|
1556
1470
|
props.onChange?.(val);
|
|
1557
1471
|
};
|
|
@@ -1562,10 +1476,10 @@ var PhoneInput = ({ className, style, ...props }) => {
|
|
|
1562
1476
|
defaultCountry: "in",
|
|
1563
1477
|
name: props.name,
|
|
1564
1478
|
value: props.value,
|
|
1565
|
-
className: cn(className,
|
|
1479
|
+
className: cn(className, props.errorMessage ? "border-red-500" : ""),
|
|
1566
1480
|
style: {
|
|
1567
1481
|
...style,
|
|
1568
|
-
borderColor:
|
|
1482
|
+
borderColor: props.errorMessage ? "#f87171" : style?.borderColor
|
|
1569
1483
|
},
|
|
1570
1484
|
onChange: (phone) => handleChange(phone),
|
|
1571
1485
|
inputProps: {
|
|
@@ -1575,13 +1489,12 @@ var PhoneInput = ({ className, style, ...props }) => {
|
|
|
1575
1489
|
disabled: isDisabled || !isEditable
|
|
1576
1490
|
}
|
|
1577
1491
|
),
|
|
1578
|
-
|
|
1492
|
+
props.errorMessage && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("p", { className: "mt-1 text-xs text-red-500", children: props.errorMessage })
|
|
1579
1493
|
] });
|
|
1580
1494
|
};
|
|
1581
1495
|
var PhoneInput_default = PhoneInput;
|
|
1582
1496
|
|
|
1583
1497
|
// src/components/Inputs/SearchInput/SearchInput.tsx
|
|
1584
|
-
var React10 = __toESM(require("react"));
|
|
1585
1498
|
var import_jsx_runtime33 = require("react/jsx-runtime");
|
|
1586
1499
|
var SearchInput = ({ className, style, ...props }) => {
|
|
1587
1500
|
const placeholder = props.placeholder ?? "Placeholder text";
|
|
@@ -1589,11 +1502,6 @@ var SearchInput = ({ className, style, ...props }) => {
|
|
|
1589
1502
|
const isDisabled = props.isDisabled ?? false;
|
|
1590
1503
|
const isReadonly = props.isReadonly ?? false;
|
|
1591
1504
|
const isAutocomplete = props.isAutocomplete ?? false;
|
|
1592
|
-
const [error, setError] = React10.useState(null);
|
|
1593
|
-
React10.useEffect(() => {
|
|
1594
|
-
if (!props.validateOnMount) return;
|
|
1595
|
-
setError(props.errorMessage || null);
|
|
1596
|
-
}, [props.errorMessage, props.validateOnMount]);
|
|
1597
1505
|
const handleChange = (e) => {
|
|
1598
1506
|
props.onChange?.(e);
|
|
1599
1507
|
};
|
|
@@ -1607,10 +1515,10 @@ var SearchInput = ({ className, style, ...props }) => {
|
|
|
1607
1515
|
id: props.name || "text-field",
|
|
1608
1516
|
name: props.name,
|
|
1609
1517
|
value: props.value,
|
|
1610
|
-
className: cn(className,
|
|
1518
|
+
className: cn(className, props.errorMessage ? "border-red-500" : ""),
|
|
1611
1519
|
style: {
|
|
1612
1520
|
...style,
|
|
1613
|
-
borderColor:
|
|
1521
|
+
borderColor: props.errorMessage ? "#f87171" : style?.borderColor
|
|
1614
1522
|
},
|
|
1615
1523
|
autoComplete: isAutocomplete ? "on" : "off",
|
|
1616
1524
|
placeholder,
|
|
@@ -1620,21 +1528,15 @@ var SearchInput = ({ className, style, ...props }) => {
|
|
|
1620
1528
|
}
|
|
1621
1529
|
)
|
|
1622
1530
|
] }),
|
|
1623
|
-
|
|
1531
|
+
props.errorMessage && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("p", { className: "mt-1 text-xs text-red-500", children: props.errorMessage })
|
|
1624
1532
|
] });
|
|
1625
1533
|
};
|
|
1626
1534
|
var SearchInput_default = SearchInput;
|
|
1627
1535
|
|
|
1628
1536
|
// src/components/Inputs/FileInput/FileInput.tsx
|
|
1629
|
-
var import_react11 = require("react");
|
|
1630
1537
|
var import_jsx_runtime34 = require("react/jsx-runtime");
|
|
1631
1538
|
var FileInput = ({ className, style, ...props }) => {
|
|
1632
1539
|
const placeholder = props.placeholder ?? "Placeholder text";
|
|
1633
|
-
const [error, setError] = (0, import_react11.useState)(null);
|
|
1634
|
-
(0, import_react11.useEffect)(() => {
|
|
1635
|
-
if (!props.validateOnMount) return;
|
|
1636
|
-
setError(props.errorMessage || null);
|
|
1637
|
-
}, [props.errorMessage, props.validateOnMount]);
|
|
1638
1540
|
return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "d-flex items-center relative align-middle", children: [
|
|
1639
1541
|
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
1640
1542
|
Input,
|
|
@@ -1643,10 +1545,10 @@ var FileInput = ({ className, style, ...props }) => {
|
|
|
1643
1545
|
id: "file",
|
|
1644
1546
|
name: props.name,
|
|
1645
1547
|
value: props.value,
|
|
1646
|
-
className: cn(className,
|
|
1548
|
+
className: cn(className, props.errorMessage ? "border-red-500" : ""),
|
|
1647
1549
|
style: {
|
|
1648
1550
|
...style,
|
|
1649
|
-
borderColor:
|
|
1551
|
+
borderColor: props.errorMessage ? "#f87171" : style?.borderColor
|
|
1650
1552
|
},
|
|
1651
1553
|
autoComplete: "off",
|
|
1652
1554
|
placeholder,
|
|
@@ -1655,13 +1557,12 @@ var FileInput = ({ className, style, ...props }) => {
|
|
|
1655
1557
|
}
|
|
1656
1558
|
}
|
|
1657
1559
|
),
|
|
1658
|
-
|
|
1560
|
+
props.errorMessage && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("p", { className: "mt-1 text-xs text-red-500", children: props.errorMessage })
|
|
1659
1561
|
] });
|
|
1660
1562
|
};
|
|
1661
1563
|
var FileInput_default = FileInput;
|
|
1662
1564
|
|
|
1663
1565
|
// src/components/Inputs/DatePicker/DatePicker.tsx
|
|
1664
|
-
var import_react12 = __toESM(require("react"));
|
|
1665
1566
|
var import_jsx_runtime35 = require("react/jsx-runtime");
|
|
1666
1567
|
function DatePicker({ className, style, ...props }) {
|
|
1667
1568
|
const placeholder = props.placeholder ?? "Placeholder text";
|
|
@@ -1673,7 +1574,6 @@ function DatePicker({ className, style, ...props }) {
|
|
|
1673
1574
|
const isDisabled = props.isDisabled ?? false;
|
|
1674
1575
|
const isReadonly = props.isReadonly ?? false;
|
|
1675
1576
|
const isAutocomplete = props.isAutocomplete ?? false;
|
|
1676
|
-
const [error, setError] = import_react12.default.useState(null);
|
|
1677
1577
|
const resolveDate = (option, customOption) => {
|
|
1678
1578
|
if (!option) return void 0;
|
|
1679
1579
|
switch (option) {
|
|
@@ -1688,10 +1588,6 @@ function DatePicker({ className, style, ...props }) {
|
|
|
1688
1588
|
};
|
|
1689
1589
|
const minDate = resolveDate(minimumDate, customMinimumDate);
|
|
1690
1590
|
const maxDate = resolveDate(maximumDate, customMaximumDate);
|
|
1691
|
-
(0, import_react12.useEffect)(() => {
|
|
1692
|
-
if (!props.validateOnMount) return;
|
|
1693
|
-
setError(props.errorMessage || null);
|
|
1694
|
-
}, [props.errorMessage, props.validateOnMount]);
|
|
1695
1591
|
const handleChange = (e) => {
|
|
1696
1592
|
props.onChange?.(e);
|
|
1697
1593
|
};
|
|
@@ -1710,12 +1606,12 @@ function DatePicker({ className, style, ...props }) {
|
|
|
1710
1606
|
value: props.value,
|
|
1711
1607
|
className: cn(
|
|
1712
1608
|
className,
|
|
1713
|
-
|
|
1609
|
+
props.errorMessage ? "border-red-500" : "",
|
|
1714
1610
|
"appearance-auto"
|
|
1715
1611
|
),
|
|
1716
1612
|
style: {
|
|
1717
1613
|
...style,
|
|
1718
|
-
borderColor:
|
|
1614
|
+
borderColor: props.errorMessage ? "#f87171" : style?.borderColor
|
|
1719
1615
|
},
|
|
1720
1616
|
readOnly: isReadonly,
|
|
1721
1617
|
placeholder,
|
|
@@ -1724,16 +1620,16 @@ function DatePicker({ className, style, ...props }) {
|
|
|
1724
1620
|
}
|
|
1725
1621
|
)
|
|
1726
1622
|
] }),
|
|
1727
|
-
|
|
1623
|
+
props.errorMessage && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("p", { className: "mt-1 text-xs text-red-500", children: props.errorMessage })
|
|
1728
1624
|
] });
|
|
1729
1625
|
}
|
|
1730
1626
|
|
|
1731
1627
|
// src/components/Inputs/DateRange/DateRange.tsx
|
|
1732
|
-
var
|
|
1628
|
+
var React3 = __toESM(require("react"));
|
|
1733
1629
|
var import_date_fns = require("date-fns");
|
|
1734
1630
|
|
|
1735
1631
|
// src/components/ui/calendar.tsx
|
|
1736
|
-
var
|
|
1632
|
+
var React2 = __toESM(require("react"));
|
|
1737
1633
|
var import_react_day_picker = require("react-day-picker");
|
|
1738
1634
|
var import_jsx_runtime36 = require("react/jsx-runtime");
|
|
1739
1635
|
function Calendar2({
|
|
@@ -1888,8 +1784,8 @@ function CalendarDayButton({
|
|
|
1888
1784
|
...props
|
|
1889
1785
|
}) {
|
|
1890
1786
|
const defaultClassNames = (0, import_react_day_picker.getDefaultClassNames)();
|
|
1891
|
-
const ref =
|
|
1892
|
-
|
|
1787
|
+
const ref = React2.useRef(null);
|
|
1788
|
+
React2.useEffect(() => {
|
|
1893
1789
|
if (modifiers.focused) ref.current?.focus();
|
|
1894
1790
|
}, [modifiers.focused]);
|
|
1895
1791
|
return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
@@ -1950,18 +1846,13 @@ function PopoverContent({
|
|
|
1950
1846
|
// src/components/Inputs/DateRange/DateRange.tsx
|
|
1951
1847
|
var import_jsx_runtime38 = require("react/jsx-runtime");
|
|
1952
1848
|
var DateRange = ({ className, style, ...props }) => {
|
|
1953
|
-
const [error, setError] = React13.useState(null);
|
|
1954
1849
|
const isDateRange = (val) => !!val && val.from instanceof Date;
|
|
1955
|
-
const [date, setDate] =
|
|
1850
|
+
const [date, setDate] = React3.useState(
|
|
1956
1851
|
isDateRange(props.value) ? props.value : {
|
|
1957
1852
|
from: /* @__PURE__ */ new Date(),
|
|
1958
1853
|
to: (0, import_date_fns.addDays)(/* @__PURE__ */ new Date(), 7)
|
|
1959
1854
|
}
|
|
1960
1855
|
);
|
|
1961
|
-
React13.useEffect(() => {
|
|
1962
|
-
if (!props.validateOnMount) return;
|
|
1963
|
-
setError(props.errorMessage || null);
|
|
1964
|
-
}, [props.errorMessage, props.validateOnMount]);
|
|
1965
1856
|
const handleChange = (value) => {
|
|
1966
1857
|
setDate(value);
|
|
1967
1858
|
if (value) {
|
|
@@ -1998,13 +1889,12 @@ var DateRange = ({ className, style, ...props }) => {
|
|
|
1998
1889
|
}
|
|
1999
1890
|
) })
|
|
2000
1891
|
] }) }),
|
|
2001
|
-
|
|
1892
|
+
props.errorMessage && /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("p", { className: "mt-1 text-xs text-red-500", children: props.errorMessage })
|
|
2002
1893
|
] });
|
|
2003
1894
|
};
|
|
2004
1895
|
var DateRange_default = DateRange;
|
|
2005
1896
|
|
|
2006
1897
|
// src/components/Inputs/TextInputGroup/TextInputGroup.tsx
|
|
2007
|
-
var React14 = __toESM(require("react"));
|
|
2008
1898
|
var import_jsx_runtime39 = require("react/jsx-runtime");
|
|
2009
1899
|
var TextInputGroup = ({ className, style, prepend, append, ...props }) => {
|
|
2010
1900
|
const placeholder = props.placeholder ?? "Placeholder text";
|
|
@@ -2012,11 +1902,6 @@ var TextInputGroup = ({ className, style, prepend, append, ...props }) => {
|
|
|
2012
1902
|
const isDisabled = props.isDisabled ?? false;
|
|
2013
1903
|
const isReadonly = props.isReadonly ?? false;
|
|
2014
1904
|
const isAutocomplete = props.isAutocomplete ?? false;
|
|
2015
|
-
const [error, setError] = React14.useState(null);
|
|
2016
|
-
React14.useEffect(() => {
|
|
2017
|
-
if (!props.validateOnMount) return;
|
|
2018
|
-
setError(props.errorMessage || null);
|
|
2019
|
-
}, [props.errorMessage, props.validateOnMount]);
|
|
2020
1905
|
const handleChange = (e) => {
|
|
2021
1906
|
props.onChange?.(e);
|
|
2022
1907
|
};
|
|
@@ -2028,7 +1913,7 @@ var TextInputGroup = ({ className, style, prepend, append, ...props }) => {
|
|
|
2028
1913
|
"flex justify-start items-center relative border border-input rounded-md bg-transparent focus-within:ring-2 focus-within:ring-ring focus-within:border-primary",
|
|
2029
1914
|
className,
|
|
2030
1915
|
"p-0 m-0",
|
|
2031
|
-
|
|
1916
|
+
props.errorMessage ? "border-red-500" : ""
|
|
2032
1917
|
),
|
|
2033
1918
|
children: [
|
|
2034
1919
|
prepend && /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("div", { className: "px-3 flex items-center bg-gray-500 text-white h-10 rounded-l-md", children: prepend }),
|
|
@@ -2045,7 +1930,7 @@ var TextInputGroup = ({ className, style, prepend, append, ...props }) => {
|
|
|
2045
1930
|
),
|
|
2046
1931
|
style: {
|
|
2047
1932
|
...style,
|
|
2048
|
-
borderColor:
|
|
1933
|
+
borderColor: props.errorMessage ? "#f87171" : style?.borderColor
|
|
2049
1934
|
},
|
|
2050
1935
|
autoComplete: isAutocomplete ? "on" : "off",
|
|
2051
1936
|
placeholder,
|
|
@@ -2058,7 +1943,7 @@ var TextInputGroup = ({ className, style, prepend, append, ...props }) => {
|
|
|
2058
1943
|
]
|
|
2059
1944
|
}
|
|
2060
1945
|
),
|
|
2061
|
-
|
|
1946
|
+
props.errorMessage && /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("p", { className: "mt-1 text-xs text-red-500", children: props.errorMessage })
|
|
2062
1947
|
] });
|
|
2063
1948
|
};
|
|
2064
1949
|
var TextInputGroup_default = TextInputGroup;
|
|
@@ -2397,7 +2282,7 @@ var CustomPagination = ({
|
|
|
2397
2282
|
var Pagination_default = CustomPagination;
|
|
2398
2283
|
|
|
2399
2284
|
// src/components/DataDisplay/Table/Table.tsx
|
|
2400
|
-
var
|
|
2285
|
+
var import_react6 = require("react");
|
|
2401
2286
|
var import_jsx_runtime44 = require("react/jsx-runtime");
|
|
2402
2287
|
var Table2 = ({
|
|
2403
2288
|
columns,
|
|
@@ -2414,7 +2299,7 @@ var Table2 = ({
|
|
|
2414
2299
|
const rawColumns = Array.isArray(columns) ? columns : [];
|
|
2415
2300
|
const rawData = Array.isArray(data) ? data : [];
|
|
2416
2301
|
const rawRowActions = Array.isArray(rowActions) ? rowActions : [];
|
|
2417
|
-
const [currentPage, setCurrentPage] = (0,
|
|
2302
|
+
const [currentPage, setCurrentPage] = (0, import_react6.useState)(1);
|
|
2418
2303
|
const enablePagination = pagination && rawData.length > itemsPerPage;
|
|
2419
2304
|
const handlePageChange = (page) => {
|
|
2420
2305
|
setCurrentPage(page);
|
|
@@ -2535,12 +2420,12 @@ var Tabs = ({ className, style, tabs, verticalMenu, LinkComponent, pathname, can
|
|
|
2535
2420
|
var Tabs_default = Tabs;
|
|
2536
2421
|
|
|
2537
2422
|
// src/components/Navigation/Stages/Stages.tsx
|
|
2538
|
-
var
|
|
2423
|
+
var import_react7 = __toESM(require("react"));
|
|
2539
2424
|
var import_jsx_runtime46 = require("react/jsx-runtime");
|
|
2540
2425
|
var StagesComponent = ({ stages, isShowBtn, buttonText, className, style }) => {
|
|
2541
2426
|
return /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("div", { className, style, children: /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("div", { className: "flex items-center justify-between bg-gray-50 p-2 rounded-lg border border-gray-200 w-full", children: [
|
|
2542
2427
|
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)("div", { className: "flex items-center", children: /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("button", { className: "p-2 hover:bg-gray-100 rounded", children: /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("svg", { className: "w-4 h-4 text-gray-600", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M19 9l-7 7-7-7" }) }) }) }),
|
|
2543
|
-
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)("div", { className: "flex items-center flex-1 px-2", children: stages?.length > 0 && stages?.map((stage, index) => /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(
|
|
2428
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)("div", { className: "flex items-center flex-1 px-2", children: stages?.length > 0 && stages?.map((stage, index) => /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(import_react7.default.Fragment, { children: [
|
|
2544
2429
|
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
|
|
2545
2430
|
"button",
|
|
2546
2431
|
{
|
|
@@ -2573,10 +2458,10 @@ var import_jsx_runtime49 = require("react/jsx-runtime");
|
|
|
2573
2458
|
var import_jsx_runtime50 = require("react/jsx-runtime");
|
|
2574
2459
|
|
|
2575
2460
|
// src/components/ui/avatar.tsx
|
|
2576
|
-
var
|
|
2461
|
+
var React5 = __toESM(require("react"));
|
|
2577
2462
|
var AvatarPrimitive = __toESM(require("@radix-ui/react-avatar"));
|
|
2578
2463
|
var import_jsx_runtime51 = require("react/jsx-runtime");
|
|
2579
|
-
var Avatar =
|
|
2464
|
+
var Avatar = React5.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
2580
2465
|
AvatarPrimitive.Root,
|
|
2581
2466
|
{
|
|
2582
2467
|
ref,
|
|
@@ -2588,7 +2473,7 @@ var Avatar = React16.forwardRef(({ className, ...props }, ref) => /* @__PURE__ *
|
|
|
2588
2473
|
}
|
|
2589
2474
|
));
|
|
2590
2475
|
Avatar.displayName = AvatarPrimitive.Root.displayName;
|
|
2591
|
-
var AvatarImage =
|
|
2476
|
+
var AvatarImage = React5.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
2592
2477
|
AvatarPrimitive.Image,
|
|
2593
2478
|
{
|
|
2594
2479
|
ref,
|
|
@@ -2597,7 +2482,7 @@ var AvatarImage = React16.forwardRef(({ className, ...props }, ref) => /* @__PUR
|
|
|
2597
2482
|
}
|
|
2598
2483
|
));
|
|
2599
2484
|
AvatarImage.displayName = AvatarPrimitive.Image.displayName;
|
|
2600
|
-
var AvatarFallback =
|
|
2485
|
+
var AvatarFallback = React5.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
2601
2486
|
AvatarPrimitive.Fallback,
|
|
2602
2487
|
{
|
|
2603
2488
|
ref,
|
|
@@ -2961,7 +2846,7 @@ function showSonnerToast({
|
|
|
2961
2846
|
}
|
|
2962
2847
|
|
|
2963
2848
|
// src/components/StateManagment/StateContext.tsx
|
|
2964
|
-
var
|
|
2849
|
+
var import_react8 = require("react");
|
|
2965
2850
|
|
|
2966
2851
|
// src/components/StateManagment/stateReducer.ts
|
|
2967
2852
|
function stateReducer(state, action) {
|
|
@@ -2975,17 +2860,17 @@ function stateReducer(state, action) {
|
|
|
2975
2860
|
|
|
2976
2861
|
// src/components/StateManagment/StateContext.tsx
|
|
2977
2862
|
var import_jsx_runtime56 = require("react/jsx-runtime");
|
|
2978
|
-
var StateContext = (0,
|
|
2863
|
+
var StateContext = (0, import_react8.createContext)(null);
|
|
2979
2864
|
function StateProvider({ children }) {
|
|
2980
|
-
const [state, dispatch] = (0,
|
|
2865
|
+
const [state, dispatch] = (0, import_react8.useReducer)(stateReducer, {});
|
|
2981
2866
|
return /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(StateContext.Provider, { value: { state, dispatch }, children });
|
|
2982
2867
|
}
|
|
2983
2868
|
function useAppState() {
|
|
2984
|
-
return (0,
|
|
2869
|
+
return (0, import_react8.useContext)(StateContext);
|
|
2985
2870
|
}
|
|
2986
2871
|
|
|
2987
|
-
// src/components/Form/
|
|
2988
|
-
var
|
|
2872
|
+
// src/components/Form/Form.tsx
|
|
2873
|
+
var import_react9 = __toESM(require("react"));
|
|
2989
2874
|
var import_zod = require("@hookform/resolvers/zod");
|
|
2990
2875
|
var import_react_hook_form = require("react-hook-form");
|
|
2991
2876
|
var import_zod2 = require("zod");
|
|
@@ -3058,14 +2943,14 @@ function generateZodSchema(data) {
|
|
|
3058
2943
|
}, {});
|
|
3059
2944
|
return import_zod2.z.object(fields);
|
|
3060
2945
|
}
|
|
3061
|
-
var
|
|
2946
|
+
var Form = ({
|
|
3062
2947
|
validation,
|
|
3063
2948
|
defaultValues,
|
|
3064
2949
|
children,
|
|
3065
2950
|
onSubmit,
|
|
3066
2951
|
onReset
|
|
3067
2952
|
}) => {
|
|
3068
|
-
const schema = (0,
|
|
2953
|
+
const schema = (0, import_react9.useMemo)(() => {
|
|
3069
2954
|
if (!validation || validation.length === 0) return null;
|
|
3070
2955
|
return generateZodSchema(validation);
|
|
3071
2956
|
}, [validation]);
|
|
@@ -3093,9 +2978,9 @@ var FormWrapper = ({
|
|
|
3093
2978
|
className: cn(
|
|
3094
2979
|
"space-y-4 min-h-[100px] h-auto flex justify-between flex-col"
|
|
3095
2980
|
),
|
|
3096
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime57.jsx)("div", { className: "min-h-[50px]", children:
|
|
2981
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime57.jsx)("div", { className: "min-h-[50px]", children: import_react9.default.Children.map(children, (child) => {
|
|
3097
2982
|
const processChild = (child2) => {
|
|
3098
|
-
if (
|
|
2983
|
+
if (import_react9.default.isValidElement(child2)) {
|
|
3099
2984
|
const node = child2.props?.node;
|
|
3100
2985
|
if (node?.category === "Form Controls") {
|
|
3101
2986
|
const name = node.properties?.name || "unnamed";
|
|
@@ -3106,7 +2991,7 @@ var FormWrapper = ({
|
|
|
3106
2991
|
control,
|
|
3107
2992
|
render: ({ field: controllerField }) => {
|
|
3108
2993
|
const childElement = child2;
|
|
3109
|
-
return
|
|
2994
|
+
return import_react9.default.cloneElement(childElement, {
|
|
3110
2995
|
input: {
|
|
3111
2996
|
...controllerField,
|
|
3112
2997
|
value: controllerField.value || "",
|
|
@@ -3122,11 +3007,11 @@ var FormWrapper = ({
|
|
|
3122
3007
|
}
|
|
3123
3008
|
if (child2.props?.children) {
|
|
3124
3009
|
const childElement = child2;
|
|
3125
|
-
return
|
|
3126
|
-
children:
|
|
3010
|
+
return import_react9.default.cloneElement(childElement, {
|
|
3011
|
+
children: import_react9.default.Children.map(childElement.props.children, processChild)
|
|
3127
3012
|
});
|
|
3128
3013
|
}
|
|
3129
|
-
return
|
|
3014
|
+
return import_react9.default.cloneElement(child2);
|
|
3130
3015
|
}
|
|
3131
3016
|
return child2;
|
|
3132
3017
|
};
|
|
@@ -3135,6 +3020,116 @@ var FormWrapper = ({
|
|
|
3135
3020
|
}
|
|
3136
3021
|
);
|
|
3137
3022
|
};
|
|
3023
|
+
var Form_default = Form;
|
|
3024
|
+
|
|
3025
|
+
// src/components/Form/Wrapper.tsx
|
|
3026
|
+
var import_react10 = require("react");
|
|
3027
|
+
var import_zod3 = require("@hookform/resolvers/zod");
|
|
3028
|
+
var import_react_hook_form2 = require("react-hook-form");
|
|
3029
|
+
var import_zod4 = require("zod");
|
|
3030
|
+
var import_jsx_runtime58 = require("react/jsx-runtime");
|
|
3031
|
+
function generateZodSchema2(data) {
|
|
3032
|
+
const fields = data.reduce((acc, f) => {
|
|
3033
|
+
const name = f.name || "unnamed";
|
|
3034
|
+
const message = f.message || `${name} is invalid`;
|
|
3035
|
+
const passwordLen = f.passwordLength;
|
|
3036
|
+
let fieldSchema = import_zod4.z.string({ message });
|
|
3037
|
+
switch (f.type) {
|
|
3038
|
+
case "Text":
|
|
3039
|
+
case "Search":
|
|
3040
|
+
fieldSchema = import_zod4.z.string({ message });
|
|
3041
|
+
if (f?.min && f?.min !== "") fieldSchema = fieldSchema.min(f.min);
|
|
3042
|
+
else if (f.isRequired) fieldSchema = fieldSchema.min(1, { message: `${message}. Cannot be empty` });
|
|
3043
|
+
if (f?.max && f?.max !== "") fieldSchema = fieldSchema.max(f.max);
|
|
3044
|
+
if (f?.email) fieldSchema = fieldSchema.email();
|
|
3045
|
+
if (f?.url) fieldSchema = fieldSchema.url();
|
|
3046
|
+
if (f?.regex) fieldSchema = fieldSchema.regex(new RegExp(f.regex));
|
|
3047
|
+
break;
|
|
3048
|
+
case "Email":
|
|
3049
|
+
fieldSchema = import_zod4.z.email({ message });
|
|
3050
|
+
break;
|
|
3051
|
+
case "Password":
|
|
3052
|
+
fieldSchema = import_zod4.z.string({ message }).min(passwordLen, { message: `Password must be at least ${passwordLen} characters long` });
|
|
3053
|
+
break;
|
|
3054
|
+
case "Phone":
|
|
3055
|
+
fieldSchema = import_zod4.z.string().transform((val) => val.replace(/\D/g, "")).transform((val) => val.slice(-10)).refine((val) => {
|
|
3056
|
+
return val.length === 10;
|
|
3057
|
+
}, {
|
|
3058
|
+
message: "Phone number must be 10 digits long"
|
|
3059
|
+
});
|
|
3060
|
+
break;
|
|
3061
|
+
case "DatePicker":
|
|
3062
|
+
fieldSchema = import_zod4.z.iso.date({ message });
|
|
3063
|
+
break;
|
|
3064
|
+
case "FileInput":
|
|
3065
|
+
fieldSchema = import_zod4.z.instanceof(File, { message: "Please select a file" });
|
|
3066
|
+
if (f?.maxSize) {
|
|
3067
|
+
fieldSchema = fieldSchema.refine(
|
|
3068
|
+
(file) => file.size <= f.maxSize,
|
|
3069
|
+
{ message: `File size must be less than ${f.maxSize / 1024 / 1024}MB` }
|
|
3070
|
+
);
|
|
3071
|
+
}
|
|
3072
|
+
if (f?.acceptedTypes) {
|
|
3073
|
+
fieldSchema = fieldSchema.refine(
|
|
3074
|
+
(file) => f.acceptedTypes.includes(file.type),
|
|
3075
|
+
{ message: `File type must be one of: ${f.acceptedTypes.join(", ")}` }
|
|
3076
|
+
);
|
|
3077
|
+
}
|
|
3078
|
+
break;
|
|
3079
|
+
case "Checkbox":
|
|
3080
|
+
fieldSchema = import_zod4.z.boolean({ message });
|
|
3081
|
+
break;
|
|
3082
|
+
case "Dropdown":
|
|
3083
|
+
fieldSchema = import_zod4.z.string({ message });
|
|
3084
|
+
break;
|
|
3085
|
+
case "NumberInput":
|
|
3086
|
+
fieldSchema = import_zod4.z.number({ message });
|
|
3087
|
+
if (f?.min !== void 0) fieldSchema = fieldSchema.min(f.min);
|
|
3088
|
+
if (f?.max !== void 0) fieldSchema = fieldSchema.max(f.max);
|
|
3089
|
+
break;
|
|
3090
|
+
default:
|
|
3091
|
+
fieldSchema = import_zod4.z.any();
|
|
3092
|
+
}
|
|
3093
|
+
if (!f.isRequired) fieldSchema = fieldSchema.optional();
|
|
3094
|
+
acc[name] = fieldSchema;
|
|
3095
|
+
return acc;
|
|
3096
|
+
}, {});
|
|
3097
|
+
return import_zod4.z.object(fields);
|
|
3098
|
+
}
|
|
3099
|
+
var FormWrapper = ({
|
|
3100
|
+
validation,
|
|
3101
|
+
defaultValues,
|
|
3102
|
+
children,
|
|
3103
|
+
onSubmit,
|
|
3104
|
+
onReset
|
|
3105
|
+
}) => {
|
|
3106
|
+
const schema = (0, import_react10.useMemo)(() => {
|
|
3107
|
+
if (!validation || validation.length === 0) return null;
|
|
3108
|
+
return generateZodSchema2(validation);
|
|
3109
|
+
}, [validation]);
|
|
3110
|
+
const form = (0, import_react_hook_form2.useForm)({
|
|
3111
|
+
resolver: schema ? (0, import_zod3.zodResolver)(schema) : void 0,
|
|
3112
|
+
defaultValues
|
|
3113
|
+
});
|
|
3114
|
+
const formSubmit = (data) => {
|
|
3115
|
+
if (onSubmit) onSubmit(data);
|
|
3116
|
+
};
|
|
3117
|
+
const handleReset = () => {
|
|
3118
|
+
form.reset();
|
|
3119
|
+
if (onReset) onReset();
|
|
3120
|
+
};
|
|
3121
|
+
return /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
|
|
3122
|
+
"form",
|
|
3123
|
+
{
|
|
3124
|
+
onSubmit: form.handleSubmit(formSubmit),
|
|
3125
|
+
onReset: handleReset,
|
|
3126
|
+
className: cn(
|
|
3127
|
+
"space-y-4 min-h-[100px] h-auto flex justify-between flex-col"
|
|
3128
|
+
),
|
|
3129
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime58.jsx)("div", { className: "min-h-[50px]", children: typeof children === "function" ? children(form) : children })
|
|
3130
|
+
}
|
|
3131
|
+
);
|
|
3132
|
+
};
|
|
3138
3133
|
var Wrapper_default = FormWrapper;
|
|
3139
3134
|
// Annotate the CommonJS export names for ESM import in node:
|
|
3140
3135
|
0 && (module.exports = {
|
|
@@ -3152,6 +3147,7 @@ var Wrapper_default = FormWrapper;
|
|
|
3152
3147
|
FileInput,
|
|
3153
3148
|
FlexLayout,
|
|
3154
3149
|
Form,
|
|
3150
|
+
FormWrapper,
|
|
3155
3151
|
GridLayout,
|
|
3156
3152
|
Image,
|
|
3157
3153
|
Modal,
|