@algorithm-shift/design-system 1.2.24 → 1.2.26
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.css +3 -0
- package/dist/index.css.map +1 -1
- package/dist/index.d.mts +9 -4
- package/dist/index.d.ts +9 -4
- package/dist/index.js +227 -66
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +283 -122
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -20,6 +20,8 @@ interface ImageProps extends ElementProps {
|
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
type InputProperties = {
|
|
23
|
+
name?: string;
|
|
24
|
+
value?: string;
|
|
23
25
|
placeholder?: string;
|
|
24
26
|
regexPattern?: string;
|
|
25
27
|
errorMessage?: string;
|
|
@@ -31,6 +33,9 @@ type InputProperties = {
|
|
|
31
33
|
isAutocomplete?: boolean;
|
|
32
34
|
label?: string;
|
|
33
35
|
text?: string;
|
|
36
|
+
hasFormContainer?: boolean;
|
|
37
|
+
validateOnMount?: boolean;
|
|
38
|
+
onChange?: (e: React.ChangeEvent<HTMLInputElement | HTMLTextAreaElement | HTMLSelectElement> | string) => void;
|
|
34
39
|
};
|
|
35
40
|
|
|
36
41
|
interface TextInputProps extends ElementProps, InputProperties { }
|
|
@@ -40,11 +45,11 @@ interface NumberInputProps extends ElementProps, InputProperties { }
|
|
|
40
45
|
interface TextAreaProps extends ElementProps, InputProperties { }
|
|
41
46
|
interface UrlInputProps extends ElementProps, InputProperties { }
|
|
42
47
|
interface SearchInputProps extends ElementProps, InputProperties { }
|
|
43
|
-
interface FileInputProps extends ElementProps,
|
|
48
|
+
interface FileInputProps extends ElementProps, InputProperties { }
|
|
44
49
|
interface CheckboxInputProps extends ElementProps, Pick<InputProperties, 'text'> { }
|
|
45
50
|
interface RadioInputProps extends ElementProps, Pick<InputProperties, 'text'> { }
|
|
46
51
|
interface MultiCheckboxInputProps extends ElementProps, Pick<InputProperties, 'text'> { }
|
|
47
|
-
interface RichTextInputProps extends ElementProps { }
|
|
52
|
+
interface RichTextInputProps extends ElementProps, InputProperties { }
|
|
48
53
|
interface SelectDropdownInputProps extends ElementProps, InputProperties { }
|
|
49
54
|
interface SwitchToggleInputProps extends ElementProps, Pick<InputProperties, 'text'> { }
|
|
50
55
|
interface PhoneInputProps extends ElementProps, InputProperties { }
|
|
@@ -186,7 +191,7 @@ declare const RadioInput: ({ className, style, ...props }: RadioInputProps) => r
|
|
|
186
191
|
|
|
187
192
|
declare const MultiCheckbox: ({ className, style, ...props }: MultiCheckboxInputProps) => react_jsx_runtime.JSX.Element;
|
|
188
193
|
|
|
189
|
-
declare function RichText({ className, style }: RichTextInputProps): react_jsx_runtime.JSX.Element;
|
|
194
|
+
declare function RichText({ className, style, ...props }: RichTextInputProps): react_jsx_runtime.JSX.Element;
|
|
190
195
|
|
|
191
196
|
declare const Dropdown: ({ className, style, ...props }: SelectDropdownInputProps) => react_jsx_runtime.JSX.Element;
|
|
192
197
|
|
|
@@ -234,4 +239,4 @@ declare function EmailComposer({ className, style, to, setTo, showCc, setShowCc,
|
|
|
234
239
|
|
|
235
240
|
declare function cn(...inputs: ClassValue[]): string;
|
|
236
241
|
|
|
237
|
-
export { ChartComponent as BarChart, ButtonComponent as Button, CheckboxInput as Checkbox, Container, DatePicker, DateRange, Dropdown,
|
|
242
|
+
export { ChartComponent as BarChart, ButtonComponent as Button, CheckboxInput as Checkbox, Container, DatePicker, DateRange, Dropdown, EmailInput as Email, EmailComposer, FileInput, Flex as FlexLayout, Grid as GridLayout, ImageControl as Image, Logo, Modal, MultiCheckbox, Navbar, Notification, NumberInput, CustomPagination as Pagination, PasswordInput as Password, PhoneInput as Phone, DonutChart as PieChart, Profile, RadioInput as RadioGroup, RichText, SearchInput as Search, Shape, Spacer, StagesComponent as Stages, SwitchToggle, Table, Tabs, TextInput as Text, Textarea, Typography, UrlInput as URL, cn };
|
package/dist/index.js
CHANGED
|
@@ -37,8 +37,8 @@ __export(index_exports, {
|
|
|
37
37
|
DatePicker: () => DatePicker,
|
|
38
38
|
DateRange: () => DateRange_default,
|
|
39
39
|
Dropdown: () => Dropdown_default,
|
|
40
|
+
Email: () => EmailInput_default,
|
|
40
41
|
EmailComposer: () => EmailComposer,
|
|
41
|
-
EmailInput: () => EmailInput_default,
|
|
42
42
|
FileInput: () => FileInput_default,
|
|
43
43
|
FlexLayout: () => Flex_default,
|
|
44
44
|
GridLayout: () => Grid_default,
|
|
@@ -50,23 +50,23 @@ __export(index_exports, {
|
|
|
50
50
|
Notification: () => Notification_default,
|
|
51
51
|
NumberInput: () => NumberInput_default,
|
|
52
52
|
Pagination: () => Pagination_default,
|
|
53
|
-
|
|
54
|
-
|
|
53
|
+
Password: () => PasswordInput_default,
|
|
54
|
+
Phone: () => PhoneInput_default,
|
|
55
55
|
PieChart: () => PieChart_default,
|
|
56
56
|
Profile: () => Profile_default,
|
|
57
|
-
|
|
57
|
+
RadioGroup: () => RadioInput_default,
|
|
58
58
|
RichText: () => RichText,
|
|
59
|
-
|
|
59
|
+
Search: () => SearchInput_default,
|
|
60
60
|
Shape: () => Shape_default,
|
|
61
61
|
Spacer: () => Spacer_default,
|
|
62
62
|
Stages: () => Stages_default,
|
|
63
63
|
SwitchToggle: () => SwitchToggle_default,
|
|
64
64
|
Table: () => Table_default,
|
|
65
65
|
Tabs: () => Tabs_default,
|
|
66
|
-
|
|
66
|
+
Text: () => TextInput_default,
|
|
67
67
|
Textarea: () => Textarea_default,
|
|
68
68
|
Typography: () => Typography_default,
|
|
69
|
-
|
|
69
|
+
URL: () => UrlInput_default,
|
|
70
70
|
cn: () => cn
|
|
71
71
|
});
|
|
72
72
|
module.exports = __toCommonJS(index_exports);
|
|
@@ -312,7 +312,15 @@ var TextInput = ({ className, style, ...props }) => {
|
|
|
312
312
|
const isAutocomplete = props.isAutocomplete ?? false;
|
|
313
313
|
const [value, setValue] = React2.useState("");
|
|
314
314
|
const [error, setError] = React2.useState(null);
|
|
315
|
+
React2.useEffect(() => {
|
|
316
|
+
if (!props.validateOnMount) return;
|
|
317
|
+
setError(props.errorMessage || null);
|
|
318
|
+
}, [props.errorMessage, props.validateOnMount]);
|
|
315
319
|
const handleChange = (e) => {
|
|
320
|
+
if (props.hasFormContainer) {
|
|
321
|
+
props.onChange?.(e);
|
|
322
|
+
return;
|
|
323
|
+
}
|
|
316
324
|
const val = e.target.value;
|
|
317
325
|
if (val.length > noOfCharacters) return;
|
|
318
326
|
setValue(val);
|
|
@@ -329,9 +337,13 @@ var TextInput = ({ className, style, ...props }) => {
|
|
|
329
337
|
Input,
|
|
330
338
|
{
|
|
331
339
|
type: "text",
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
340
|
+
name: props.name,
|
|
341
|
+
className: cn(className, error ? "border-red-500" : ""),
|
|
342
|
+
style: {
|
|
343
|
+
...style,
|
|
344
|
+
borderColor: error ? "#f87171" : style?.borderColor
|
|
345
|
+
},
|
|
346
|
+
value: props.value || value,
|
|
335
347
|
autoComplete: isAutocomplete ? "on" : "off",
|
|
336
348
|
placeholder,
|
|
337
349
|
onChange: handleChange,
|
|
@@ -548,6 +560,7 @@ var __iconNode14 = [
|
|
|
548
560
|
var Search = createLucideIcon("search", __iconNode14);
|
|
549
561
|
|
|
550
562
|
// src/components/Inputs/NumberInput/NumberInput.tsx
|
|
563
|
+
var import_react4 = require("react");
|
|
551
564
|
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
552
565
|
var NumberInput = ({ className, style, ...props }) => {
|
|
553
566
|
const placeholder = props.placeholder ?? "Placeholder text";
|
|
@@ -561,7 +574,15 @@ var NumberInput = ({ className, style, ...props }) => {
|
|
|
561
574
|
const isAutocomplete = props.isAutocomplete ?? false;
|
|
562
575
|
const [value, setValue] = React3.useState("");
|
|
563
576
|
const [error, setError] = React3.useState(null);
|
|
577
|
+
(0, import_react4.useEffect)(() => {
|
|
578
|
+
if (!props.validateOnMount) return;
|
|
579
|
+
setError(props.errorMessage || null);
|
|
580
|
+
}, [props.errorMessage, props.validateOnMount]);
|
|
564
581
|
const handleChange = (e) => {
|
|
582
|
+
if (props.hasFormContainer) {
|
|
583
|
+
props.onChange?.(e);
|
|
584
|
+
return;
|
|
585
|
+
}
|
|
565
586
|
const val = e.target.value;
|
|
566
587
|
if (val.length > noOfCharacters) return;
|
|
567
588
|
setValue(val);
|
|
@@ -581,9 +602,13 @@ var NumberInput = ({ className, style, ...props }) => {
|
|
|
581
602
|
{
|
|
582
603
|
type: "number",
|
|
583
604
|
id: "number-field",
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
605
|
+
name: props.name,
|
|
606
|
+
value: props.value || value,
|
|
607
|
+
className: cn(className, error ? "border-red-500" : ""),
|
|
608
|
+
style: {
|
|
609
|
+
...style,
|
|
610
|
+
borderColor: error ? "#f87171" : style?.borderColor
|
|
611
|
+
},
|
|
587
612
|
autoComplete: isAutocomplete ? "on" : "off",
|
|
588
613
|
placeholder,
|
|
589
614
|
onChange: handleChange,
|
|
@@ -615,7 +640,15 @@ var EmailInput = ({ className, style, ...props }) => {
|
|
|
615
640
|
const isAutocomplete = props.isAutocomplete ?? false;
|
|
616
641
|
const [value, setValue] = React4.useState("");
|
|
617
642
|
const [error, setError] = React4.useState(null);
|
|
643
|
+
React4.useEffect(() => {
|
|
644
|
+
if (!props.validateOnMount) return;
|
|
645
|
+
setError(props.errorMessage || null);
|
|
646
|
+
}, [props.errorMessage, props.validateOnMount]);
|
|
618
647
|
const handleChange = (e) => {
|
|
648
|
+
if (props.hasFormContainer) {
|
|
649
|
+
props.onChange?.(e);
|
|
650
|
+
return;
|
|
651
|
+
}
|
|
619
652
|
const val = e.target.value;
|
|
620
653
|
if (val.length > noOfCharacters) return;
|
|
621
654
|
setValue(val);
|
|
@@ -634,9 +667,13 @@ var EmailInput = ({ className, style, ...props }) => {
|
|
|
634
667
|
Input,
|
|
635
668
|
{
|
|
636
669
|
type: "email",
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
670
|
+
name: props.name,
|
|
671
|
+
value: props.value || value,
|
|
672
|
+
className: cn(className, error ? "border-red-500" : ""),
|
|
673
|
+
style: {
|
|
674
|
+
...style,
|
|
675
|
+
borderColor: error ? "#f87171" : style?.borderColor
|
|
676
|
+
},
|
|
640
677
|
autoComplete: isAutocomplete ? "on" : "off",
|
|
641
678
|
placeholder,
|
|
642
679
|
onChange: handleChange,
|
|
@@ -668,7 +705,15 @@ var PasswordInput = ({ className, style, ...props }) => {
|
|
|
668
705
|
const isAutocomplete = props.isAutocomplete ?? false;
|
|
669
706
|
const [value, setValue] = React5.useState("");
|
|
670
707
|
const [error, setError] = React5.useState(null);
|
|
708
|
+
React5.useEffect(() => {
|
|
709
|
+
if (!props.validateOnMount) return;
|
|
710
|
+
setError(props.errorMessage || null);
|
|
711
|
+
}, [props.errorMessage, props.validateOnMount]);
|
|
671
712
|
const handleChange = (e) => {
|
|
713
|
+
if (props.hasFormContainer) {
|
|
714
|
+
props.onChange?.(e);
|
|
715
|
+
return;
|
|
716
|
+
}
|
|
672
717
|
const val = e.target.value;
|
|
673
718
|
if (val.length > noOfCharacters) return;
|
|
674
719
|
setValue(val);
|
|
@@ -688,9 +733,13 @@ var PasswordInput = ({ className, style, ...props }) => {
|
|
|
688
733
|
{
|
|
689
734
|
type: "password",
|
|
690
735
|
id: "password-field",
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
736
|
+
name: props.name,
|
|
737
|
+
value: props.value || value,
|
|
738
|
+
className: cn(className, error ? "border-red-500" : ""),
|
|
739
|
+
style: {
|
|
740
|
+
...style,
|
|
741
|
+
borderColor: error ? "#f87171" : style?.borderColor
|
|
742
|
+
},
|
|
694
743
|
autoComplete: isAutocomplete ? "on" : "off",
|
|
695
744
|
placeholder,
|
|
696
745
|
onChange: handleChange,
|
|
@@ -740,7 +789,15 @@ var Textarea2 = ({ className, style, ...props }) => {
|
|
|
740
789
|
const isAutocomplete = props.isAutocomplete ?? false;
|
|
741
790
|
const [value, setValue] = React6.useState("");
|
|
742
791
|
const [error, setError] = React6.useState(null);
|
|
792
|
+
React6.useEffect(() => {
|
|
793
|
+
if (!props.validateOnMount) return;
|
|
794
|
+
setError(props.errorMessage || null);
|
|
795
|
+
}, [props.errorMessage, props.validateOnMount]);
|
|
743
796
|
const handleChange = (e) => {
|
|
797
|
+
if (props.hasFormContainer) {
|
|
798
|
+
props.onChange?.(e);
|
|
799
|
+
return;
|
|
800
|
+
}
|
|
744
801
|
const val = e.target.value;
|
|
745
802
|
if (val.length > noOfCharacters) return;
|
|
746
803
|
setValue(val);
|
|
@@ -757,9 +814,13 @@ var Textarea2 = ({ className, style, ...props }) => {
|
|
|
757
814
|
Textarea,
|
|
758
815
|
{
|
|
759
816
|
id: "textarea-field",
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
817
|
+
name: props.name,
|
|
818
|
+
value: props.value || value,
|
|
819
|
+
className: cn(className, error ? "border-red-500" : ""),
|
|
820
|
+
style: {
|
|
821
|
+
...style,
|
|
822
|
+
borderColor: error ? "#f87171" : style?.borderColor
|
|
823
|
+
},
|
|
763
824
|
autoComplete: isAutocomplete ? "on" : "off",
|
|
764
825
|
placeholder,
|
|
765
826
|
onChange: handleChange,
|
|
@@ -789,7 +850,15 @@ var UrlInput = ({ className, style, ...props }) => {
|
|
|
789
850
|
const isAutocomplete = props.isAutocomplete ?? false;
|
|
790
851
|
const [value, setValue] = React7.useState("");
|
|
791
852
|
const [error, setError] = React7.useState(null);
|
|
853
|
+
React7.useEffect(() => {
|
|
854
|
+
if (!props.validateOnMount) return;
|
|
855
|
+
setError(props.errorMessage || null);
|
|
856
|
+
}, [props.errorMessage, props.validateOnMount]);
|
|
792
857
|
const handleChange = (e) => {
|
|
858
|
+
if (props.hasFormContainer) {
|
|
859
|
+
props.onChange?.(e);
|
|
860
|
+
return;
|
|
861
|
+
}
|
|
793
862
|
const val = e.target.value;
|
|
794
863
|
if (val.length > noOfCharacters) return;
|
|
795
864
|
setValue(val);
|
|
@@ -807,11 +876,15 @@ var UrlInput = ({ className, style, ...props }) => {
|
|
|
807
876
|
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
808
877
|
Input,
|
|
809
878
|
{
|
|
810
|
-
type: "url",
|
|
811
|
-
className,
|
|
812
|
-
style,
|
|
813
879
|
id: "url-field",
|
|
814
|
-
|
|
880
|
+
type: "url",
|
|
881
|
+
name: props.name,
|
|
882
|
+
value: props.value || value,
|
|
883
|
+
className: cn(className, error ? "border-red-500" : ""),
|
|
884
|
+
style: {
|
|
885
|
+
...style,
|
|
886
|
+
borderColor: error ? "#f87171" : style?.borderColor
|
|
887
|
+
},
|
|
815
888
|
autoComplete: isAutocomplete ? "on" : "off",
|
|
816
889
|
placeholder,
|
|
817
890
|
onChange: handleChange,
|
|
@@ -958,8 +1031,11 @@ var MultiCheckbox = ({ className, style, ...props }) => {
|
|
|
958
1031
|
};
|
|
959
1032
|
var MultiCheckbox_default = MultiCheckbox;
|
|
960
1033
|
|
|
1034
|
+
// src/components/Inputs/RichText/RichText.tsx
|
|
1035
|
+
var import_react6 = require("react");
|
|
1036
|
+
|
|
961
1037
|
// src/components/Global/TinyMceEditor.tsx
|
|
962
|
-
var
|
|
1038
|
+
var import_react5 = require("react");
|
|
963
1039
|
var import_tinymce_react = require("@tinymce/tinymce-react");
|
|
964
1040
|
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
965
1041
|
function MyEditor({
|
|
@@ -967,7 +1043,7 @@ function MyEditor({
|
|
|
967
1043
|
onChange,
|
|
968
1044
|
isDefault
|
|
969
1045
|
}) {
|
|
970
|
-
const editorRef = (0,
|
|
1046
|
+
const editorRef = (0, import_react5.useRef)(null);
|
|
971
1047
|
function stripOuterP(html) {
|
|
972
1048
|
const trimmedHtml = html.trim();
|
|
973
1049
|
if (!trimmedHtml) return "";
|
|
@@ -979,7 +1055,7 @@ function MyEditor({
|
|
|
979
1055
|
}
|
|
980
1056
|
return trimmedHtml;
|
|
981
1057
|
}
|
|
982
|
-
const isDefaultToolbar = (0,
|
|
1058
|
+
const isDefaultToolbar = (0, import_react5.useMemo)(() => {
|
|
983
1059
|
let toolbar = "undo redo | formatselect | bold italic forecolor";
|
|
984
1060
|
if (isDefault) {
|
|
985
1061
|
toolbar = "undo redo | blocks | bold italic forecolor | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | removeformat | help";
|
|
@@ -1031,8 +1107,26 @@ function MyEditor({
|
|
|
1031
1107
|
|
|
1032
1108
|
// src/components/Inputs/RichText/RichText.tsx
|
|
1033
1109
|
var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
1034
|
-
function RichText({ className, style }) {
|
|
1035
|
-
|
|
1110
|
+
function RichText({ className, style, ...props }) {
|
|
1111
|
+
const [error, setError] = (0, import_react6.useState)(null);
|
|
1112
|
+
(0, import_react6.useEffect)(() => {
|
|
1113
|
+
if (!props.validateOnMount) return;
|
|
1114
|
+
setError(props.errorMessage || null);
|
|
1115
|
+
}, [props.errorMessage, props.validateOnMount]);
|
|
1116
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
|
|
1117
|
+
"div",
|
|
1118
|
+
{
|
|
1119
|
+
className: cn(className, error ? "border-red-500" : ""),
|
|
1120
|
+
style: {
|
|
1121
|
+
...style,
|
|
1122
|
+
borderColor: error ? "#f87171" : style?.borderColor
|
|
1123
|
+
},
|
|
1124
|
+
children: [
|
|
1125
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(MyEditor, { onChange: (content) => props.onChange?.(content), value: props.value, isDefault: true }),
|
|
1126
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("p", { className: "mt-1 text-xs text-red-500", children: error })
|
|
1127
|
+
]
|
|
1128
|
+
}
|
|
1129
|
+
);
|
|
1036
1130
|
}
|
|
1037
1131
|
|
|
1038
1132
|
// src/components/Inputs/Dropdown/Dropdown.tsx
|
|
@@ -1175,9 +1269,10 @@ function SelectDropdown({
|
|
|
1175
1269
|
id,
|
|
1176
1270
|
disabled,
|
|
1177
1271
|
readOnly,
|
|
1178
|
-
style
|
|
1272
|
+
style,
|
|
1273
|
+
name
|
|
1179
1274
|
}) {
|
|
1180
|
-
return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(Select, { value, onValueChange: onChange, disabled, children: [
|
|
1275
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(Select, { name, value, onValueChange: onChange, disabled, children: [
|
|
1181
1276
|
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
1182
1277
|
SelectTrigger,
|
|
1183
1278
|
{
|
|
@@ -1210,7 +1305,15 @@ var Dropdown = ({ className, style, ...props }) => {
|
|
|
1210
1305
|
const isAutocomplete = props.isAutocomplete ?? false;
|
|
1211
1306
|
const [value, setValue] = React8.useState("");
|
|
1212
1307
|
const [error, setError] = React8.useState(null);
|
|
1308
|
+
React8.useEffect(() => {
|
|
1309
|
+
if (!props.validateOnMount) return;
|
|
1310
|
+
setError(props.errorMessage || null);
|
|
1311
|
+
}, [props.errorMessage, props.validateOnMount]);
|
|
1213
1312
|
const handleChange = (val) => {
|
|
1313
|
+
if (props.hasFormContainer) {
|
|
1314
|
+
props.onChange?.(val);
|
|
1315
|
+
return;
|
|
1316
|
+
}
|
|
1214
1317
|
setValue(val);
|
|
1215
1318
|
if (isRequired && val.trim() === "") {
|
|
1216
1319
|
setError(errorMessage);
|
|
@@ -1227,9 +1330,13 @@ var Dropdown = ({ className, style, ...props }) => {
|
|
|
1227
1330
|
options: formatList,
|
|
1228
1331
|
placeholder,
|
|
1229
1332
|
id: "select-field",
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1333
|
+
name: props.name,
|
|
1334
|
+
value: props.value || value,
|
|
1335
|
+
className: cn(className, error ? "border-red-500" : ""),
|
|
1336
|
+
style: {
|
|
1337
|
+
...style,
|
|
1338
|
+
borderColor: error ? "#f87171" : style?.borderColor
|
|
1339
|
+
},
|
|
1233
1340
|
autoComplete: isAutocomplete ? "on" : "off",
|
|
1234
1341
|
onChange: handleChange,
|
|
1235
1342
|
disabled: isDisabled || !isEditable,
|
|
@@ -1298,7 +1405,15 @@ var PhoneInput = ({ className, style, ...props }) => {
|
|
|
1298
1405
|
const isEditable = props.isEditable ?? true;
|
|
1299
1406
|
const isDisabled = props.isDisabled ?? false;
|
|
1300
1407
|
const [error, setError] = React9.useState(null);
|
|
1408
|
+
React9.useEffect(() => {
|
|
1409
|
+
if (!props.validateOnMount) return;
|
|
1410
|
+
setError(props.errorMessage || null);
|
|
1411
|
+
}, [props.errorMessage, props.validateOnMount]);
|
|
1301
1412
|
const handleChange = (val) => {
|
|
1413
|
+
if (props.hasFormContainer) {
|
|
1414
|
+
props.onChange?.(val);
|
|
1415
|
+
return;
|
|
1416
|
+
}
|
|
1302
1417
|
if (val.length > noOfCharacters) return;
|
|
1303
1418
|
setValue(val);
|
|
1304
1419
|
if (isRequired && val.trim() === "") {
|
|
@@ -1314,7 +1429,13 @@ var PhoneInput = ({ className, style, ...props }) => {
|
|
|
1314
1429
|
import_react_international_phone.PhoneInput,
|
|
1315
1430
|
{
|
|
1316
1431
|
defaultCountry: "in",
|
|
1317
|
-
|
|
1432
|
+
name: props.name,
|
|
1433
|
+
value: props.value || value,
|
|
1434
|
+
className: cn(className, error ? "border-red-500" : ""),
|
|
1435
|
+
style: {
|
|
1436
|
+
...style,
|
|
1437
|
+
borderColor: error ? "#f87171" : style?.borderColor
|
|
1438
|
+
},
|
|
1318
1439
|
onChange: (phone) => handleChange(phone),
|
|
1319
1440
|
inputProps: {
|
|
1320
1441
|
id: "phone-field",
|
|
@@ -1322,9 +1443,7 @@ var PhoneInput = ({ className, style, ...props }) => {
|
|
|
1322
1443
|
},
|
|
1323
1444
|
placeholder,
|
|
1324
1445
|
disabled: isDisabled || !isEditable,
|
|
1325
|
-
required: isRequired
|
|
1326
|
-
className,
|
|
1327
|
-
style
|
|
1446
|
+
required: isRequired
|
|
1328
1447
|
}
|
|
1329
1448
|
),
|
|
1330
1449
|
error && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("p", { className: "mt-1 text-xs text-red-500", children: error })
|
|
@@ -1347,7 +1466,15 @@ var SearchInput = ({ className, style, ...props }) => {
|
|
|
1347
1466
|
const isAutocomplete = props.isAutocomplete ?? false;
|
|
1348
1467
|
const [value, setValue] = React10.useState("");
|
|
1349
1468
|
const [error, setError] = React10.useState(null);
|
|
1469
|
+
React10.useEffect(() => {
|
|
1470
|
+
if (!props.validateOnMount) return;
|
|
1471
|
+
setError(props.errorMessage || null);
|
|
1472
|
+
}, [props.errorMessage, props.validateOnMount]);
|
|
1350
1473
|
const handleChange = (e) => {
|
|
1474
|
+
if (props.hasFormContainer) {
|
|
1475
|
+
props.onChange?.(e);
|
|
1476
|
+
return;
|
|
1477
|
+
}
|
|
1351
1478
|
const val = e.target.value;
|
|
1352
1479
|
if (val.length > noOfCharacters) return;
|
|
1353
1480
|
setValue(val);
|
|
@@ -1367,9 +1494,13 @@ var SearchInput = ({ className, style, ...props }) => {
|
|
|
1367
1494
|
{
|
|
1368
1495
|
type: "text",
|
|
1369
1496
|
id: "text-field",
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1497
|
+
name: props.name,
|
|
1498
|
+
value: props.value || value,
|
|
1499
|
+
className: cn(className, error ? "border-red-500" : ""),
|
|
1500
|
+
style: {
|
|
1501
|
+
...style,
|
|
1502
|
+
borderColor: error ? "#f87171" : style?.borderColor
|
|
1503
|
+
},
|
|
1373
1504
|
autoComplete: isAutocomplete ? "on" : "off",
|
|
1374
1505
|
placeholder,
|
|
1375
1506
|
onChange: handleChange,
|
|
@@ -1387,28 +1518,45 @@ var SearchInput = ({ className, style, ...props }) => {
|
|
|
1387
1518
|
var SearchInput_default = SearchInput;
|
|
1388
1519
|
|
|
1389
1520
|
// src/components/Inputs/FileInput/FileInput.tsx
|
|
1521
|
+
var import_react7 = require("react");
|
|
1390
1522
|
var import_jsx_runtime32 = require("react/jsx-runtime");
|
|
1391
1523
|
var FileInput = ({ className, style, ...props }) => {
|
|
1392
1524
|
const placeholder = props.placeholder ?? "Placeholder text";
|
|
1525
|
+
const [error, setError] = (0, import_react7.useState)(null);
|
|
1526
|
+
(0, import_react7.useEffect)(() => {
|
|
1527
|
+
if (!props.validateOnMount) return;
|
|
1528
|
+
setError(props.errorMessage || null);
|
|
1529
|
+
}, [props.errorMessage, props.validateOnMount]);
|
|
1393
1530
|
return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "d-flex items-center relative align-middle", children: [
|
|
1394
|
-
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: "bg-[#E9E9E9] absolute px-10 text-center top-1/2 h-full justify-center items-center flex w-10 -translate-y-1/2 text-[#383838] font-[500] text-[11px]", children: "Browse" }),
|
|
1395
1531
|
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
1396
1532
|
Input,
|
|
1397
1533
|
{
|
|
1398
1534
|
type: "file",
|
|
1399
1535
|
id: "file",
|
|
1536
|
+
name: props.name,
|
|
1537
|
+
value: props.value,
|
|
1538
|
+
className: cn(className, error ? "border-red-500" : ""),
|
|
1539
|
+
style: {
|
|
1540
|
+
...style,
|
|
1541
|
+
borderColor: error ? "#f87171" : style?.borderColor
|
|
1542
|
+
},
|
|
1400
1543
|
autoComplete: "off",
|
|
1401
1544
|
placeholder,
|
|
1402
|
-
|
|
1403
|
-
|
|
1545
|
+
onChange: (e) => {
|
|
1546
|
+
if (props.hasFormContainer) {
|
|
1547
|
+
props.onChange?.(e);
|
|
1548
|
+
return;
|
|
1549
|
+
}
|
|
1550
|
+
}
|
|
1404
1551
|
}
|
|
1405
|
-
)
|
|
1552
|
+
),
|
|
1553
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("p", { className: "mt-1 text-xs text-red-500", children: error })
|
|
1406
1554
|
] });
|
|
1407
1555
|
};
|
|
1408
1556
|
var FileInput_default = FileInput;
|
|
1409
1557
|
|
|
1410
1558
|
// src/components/Inputs/DatePicker/DatePicker.tsx
|
|
1411
|
-
var
|
|
1559
|
+
var import_react8 = __toESM(require("react"));
|
|
1412
1560
|
var import_jsx_runtime33 = require("react/jsx-runtime");
|
|
1413
1561
|
function DatePicker({ className, style, ...props }) {
|
|
1414
1562
|
const placeholder = props.placeholder ?? "Placeholder text";
|
|
@@ -1422,8 +1570,8 @@ function DatePicker({ className, style, ...props }) {
|
|
|
1422
1570
|
const isDisabled = props.isDisabled ?? false;
|
|
1423
1571
|
const isReadonly = props.isReadonly ?? false;
|
|
1424
1572
|
const isAutocomplete = props.isAutocomplete ?? false;
|
|
1425
|
-
const [value, setValue] =
|
|
1426
|
-
const [error, setError] =
|
|
1573
|
+
const [value, setValue] = import_react8.default.useState("");
|
|
1574
|
+
const [error, setError] = import_react8.default.useState(null);
|
|
1427
1575
|
const resolveDate = (option, customOption) => {
|
|
1428
1576
|
if (!option) return void 0;
|
|
1429
1577
|
switch (option) {
|
|
@@ -1438,7 +1586,15 @@ function DatePicker({ className, style, ...props }) {
|
|
|
1438
1586
|
};
|
|
1439
1587
|
const minDate = resolveDate(minimumDate, customMinimumDate);
|
|
1440
1588
|
const maxDate = resolveDate(maximumDate, customMaximumDate);
|
|
1589
|
+
(0, import_react8.useEffect)(() => {
|
|
1590
|
+
if (!props.validateOnMount) return;
|
|
1591
|
+
setError(props.errorMessage || null);
|
|
1592
|
+
}, [props.errorMessage, props.validateOnMount]);
|
|
1441
1593
|
const handleChange = (e) => {
|
|
1594
|
+
if (props.hasFormContainer) {
|
|
1595
|
+
props.onChange?.(e);
|
|
1596
|
+
return;
|
|
1597
|
+
}
|
|
1442
1598
|
const val = e.target.value;
|
|
1443
1599
|
setValue(val);
|
|
1444
1600
|
if (isRequired && val.trim() === "") {
|
|
@@ -1458,14 +1614,18 @@ function DatePicker({ className, style, ...props }) {
|
|
|
1458
1614
|
autoComplete: isAutocomplete ? "on" : "off",
|
|
1459
1615
|
onChange: handleChange,
|
|
1460
1616
|
disabled: isDisabled || !isEditable,
|
|
1461
|
-
|
|
1617
|
+
name: props.name,
|
|
1618
|
+
value: props.value || value,
|
|
1619
|
+
className: cn(className, error ? "border-red-500" : ""),
|
|
1620
|
+
style: {
|
|
1621
|
+
...style,
|
|
1622
|
+
borderColor: error ? "#f87171" : style?.borderColor
|
|
1623
|
+
},
|
|
1462
1624
|
readOnly: isReadonly,
|
|
1463
1625
|
required: isRequired,
|
|
1464
1626
|
placeholder,
|
|
1465
1627
|
min: minDate,
|
|
1466
|
-
max: maxDate
|
|
1467
|
-
className,
|
|
1468
|
-
style
|
|
1628
|
+
max: maxDate
|
|
1469
1629
|
}
|
|
1470
1630
|
)
|
|
1471
1631
|
] }),
|
|
@@ -2065,20 +2225,21 @@ var CustomPagination = ({
|
|
|
2065
2225
|
var Pagination_default = CustomPagination;
|
|
2066
2226
|
|
|
2067
2227
|
// src/components/DataDisplay/Table/Table.tsx
|
|
2068
|
-
var
|
|
2228
|
+
var import_react9 = require("react");
|
|
2069
2229
|
var import_jsx_runtime41 = require("react/jsx-runtime");
|
|
2070
2230
|
var Table2 = ({ columns, data, rowActions, className, style, pagination = false, itemsPerPage = 10, onPageChange }) => {
|
|
2071
2231
|
const rawColumns = Array.isArray(columns) ? columns : [];
|
|
2072
2232
|
const rawData = Array.isArray(data) ? data : [];
|
|
2073
2233
|
const rawRowActions = Array.isArray(rowActions) ? rowActions : [];
|
|
2074
|
-
const [currentPage, setCurrentPage] = (0,
|
|
2234
|
+
const [currentPage, setCurrentPage] = (0, import_react9.useState)(1);
|
|
2075
2235
|
const enablePagination = pagination && rawData.length > itemsPerPage;
|
|
2076
2236
|
const handlePageChange = (page) => {
|
|
2077
2237
|
setCurrentPage(page);
|
|
2078
2238
|
onPageChange?.(page);
|
|
2079
2239
|
};
|
|
2240
|
+
const paginatedData = enablePagination ? rawData.slice((currentPage - 1) * itemsPerPage, currentPage * itemsPerPage) : rawData;
|
|
2080
2241
|
return /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("div", { className: `${className} space-y-3`, style, children: [
|
|
2081
|
-
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(DataTable, { columns: rawColumns, data:
|
|
2242
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(DataTable, { columns: rawColumns, data: paginatedData, rowActions: rawRowActions }),
|
|
2082
2243
|
enablePagination && /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
2083
2244
|
Pagination_default,
|
|
2084
2245
|
{
|
|
@@ -2235,12 +2396,12 @@ var Tabs = ({ tabs, className, style, pathname, LinkComponent }) => {
|
|
|
2235
2396
|
var Tabs_default = Tabs;
|
|
2236
2397
|
|
|
2237
2398
|
// src/components/Navigation/Stages/Stages.tsx
|
|
2238
|
-
var
|
|
2399
|
+
var import_react10 = __toESM(require("react"));
|
|
2239
2400
|
var import_jsx_runtime44 = require("react/jsx-runtime");
|
|
2240
2401
|
var StagesComponent = ({ stages, isShowBtn, buttonText, className, style }) => {
|
|
2241
2402
|
return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("div", { className, style, children: /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("div", { className: "flex items-center justify-between bg-gray-50 p-2 rounded-lg border border-gray-200 w-full", children: [
|
|
2242
2403
|
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)("div", { className: "flex items-center", children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("button", { className: "p-2 hover:bg-gray-100 rounded", children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("svg", { className: "w-4 h-4 text-gray-600", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M19 9l-7 7-7-7" }) }) }) }),
|
|
2243
|
-
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)("div", { className: "flex items-center flex-1 px-2", children: stages?.length > 0 && stages?.map((stage, index) => /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(
|
|
2404
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)("div", { className: "flex items-center flex-1 px-2", children: stages?.length > 0 && stages?.map((stage, index) => /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(import_react10.default.Fragment, { children: [
|
|
2244
2405
|
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
2245
2406
|
"button",
|
|
2246
2407
|
{
|
|
@@ -2668,8 +2829,8 @@ function EmailComposer({ className, style, to, setTo, showCc, setShowCc, showBcc
|
|
|
2668
2829
|
DatePicker,
|
|
2669
2830
|
DateRange,
|
|
2670
2831
|
Dropdown,
|
|
2832
|
+
Email,
|
|
2671
2833
|
EmailComposer,
|
|
2672
|
-
EmailInput,
|
|
2673
2834
|
FileInput,
|
|
2674
2835
|
FlexLayout,
|
|
2675
2836
|
GridLayout,
|
|
@@ -2681,23 +2842,23 @@ function EmailComposer({ className, style, to, setTo, showCc, setShowCc, showBcc
|
|
|
2681
2842
|
Notification,
|
|
2682
2843
|
NumberInput,
|
|
2683
2844
|
Pagination,
|
|
2684
|
-
|
|
2685
|
-
|
|
2845
|
+
Password,
|
|
2846
|
+
Phone,
|
|
2686
2847
|
PieChart,
|
|
2687
2848
|
Profile,
|
|
2688
|
-
|
|
2849
|
+
RadioGroup,
|
|
2689
2850
|
RichText,
|
|
2690
|
-
|
|
2851
|
+
Search,
|
|
2691
2852
|
Shape,
|
|
2692
2853
|
Spacer,
|
|
2693
2854
|
Stages,
|
|
2694
2855
|
SwitchToggle,
|
|
2695
2856
|
Table,
|
|
2696
2857
|
Tabs,
|
|
2697
|
-
|
|
2858
|
+
Text,
|
|
2698
2859
|
Textarea,
|
|
2699
2860
|
Typography,
|
|
2700
|
-
|
|
2861
|
+
URL,
|
|
2701
2862
|
cn
|
|
2702
2863
|
});
|
|
2703
2864
|
/*! Bundled license information:
|