@algorithm-shift/design-system 1.2.25 → 1.2.27

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.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, Pick<InputProperties, 'placeholder'> { }
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 { }
@@ -96,6 +101,7 @@ interface LogoProps extends ElementProps {
96
101
 
97
102
  interface ButtonProps extends ElementProps {
98
103
  textContent?: string;
104
+ type?: 'button' | 'submit';
99
105
  }
100
106
 
101
107
  interface PieChartProps extends ElementProps {
@@ -157,7 +163,7 @@ declare const Grid: ({ children, className, style }: ElementProps) => react_jsx_
157
163
 
158
164
  declare const Container: ({ children, className, style }: ElementProps) => react_jsx_runtime.JSX.Element;
159
165
 
160
- declare const ButtonComponent: ({ className, style, textContent, }: ButtonProps) => react_jsx_runtime.JSX.Element;
166
+ declare const ButtonComponent: ({ className, style, textContent, type, ...props }: ButtonProps) => react_jsx_runtime.JSX.Element;
161
167
 
162
168
  declare const ImageControl: ({ className, style, imageUrl, imageUrlExternal, altText, }: ImageProps) => react_jsx_runtime.JSX.Element;
163
169
 
@@ -186,7 +192,7 @@ declare const RadioInput: ({ className, style, ...props }: RadioInputProps) => r
186
192
 
187
193
  declare const MultiCheckbox: ({ className, style, ...props }: MultiCheckboxInputProps) => react_jsx_runtime.JSX.Element;
188
194
 
189
- declare function RichText({ className, style }: RichTextInputProps): react_jsx_runtime.JSX.Element;
195
+ declare function RichText({ className, style, ...props }: RichTextInputProps): react_jsx_runtime.JSX.Element;
190
196
 
191
197
  declare const Dropdown: ({ className, style, ...props }: SelectDropdownInputProps) => react_jsx_runtime.JSX.Element;
192
198
 
@@ -234,4 +240,4 @@ declare function EmailComposer({ className, style, to, setTo, showCc, setShowCc,
234
240
 
235
241
  declare function cn(...inputs: ClassValue[]): string;
236
242
 
237
- export { ChartComponent as BarChart, ButtonComponent as Button, CheckboxInput as Checkbox, Container, DatePicker, DateRange, Dropdown, EmailComposer, EmailInput, FileInput, Flex as FlexLayout, Grid as GridLayout, ImageControl as Image, Logo, Modal, MultiCheckbox, Navbar, Notification, NumberInput, CustomPagination as Pagination, PasswordInput, PhoneInput, DonutChart as PieChart, Profile, RadioInput, RichText, SearchInput, Shape, Spacer, StagesComponent as Stages, SwitchToggle, Table, Tabs, TextInput, Textarea, Typography, UrlInput, cn };
243
+ 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
- PasswordInput: () => PasswordInput_default,
54
- PhoneInput: () => PhoneInput_default,
53
+ Password: () => PasswordInput_default,
54
+ Phone: () => PhoneInput_default,
55
55
  PieChart: () => PieChart_default,
56
56
  Profile: () => Profile_default,
57
- RadioInput: () => RadioInput_default,
57
+ RadioGroup: () => RadioInput_default,
58
58
  RichText: () => RichText,
59
- SearchInput: () => SearchInput_default,
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
- TextInput: () => TextInput_default,
66
+ Text: () => TextInput_default,
67
67
  Textarea: () => Textarea_default,
68
68
  Typography: () => Typography_default,
69
- UrlInput: () => UrlInput_default,
69
+ URL: () => UrlInput_default,
70
70
  cn: () => cn
71
71
  });
72
72
  module.exports = __toCommonJS(index_exports);
@@ -192,18 +192,16 @@ var import_jsx_runtime6 = require("react/jsx-runtime");
192
192
  var ButtonComponent = ({
193
193
  className,
194
194
  style,
195
- textContent = "Button"
195
+ textContent = "Button",
196
+ type = "button",
197
+ ...props
196
198
  }) => {
197
- const classNames = cn(
198
- "inline-flex items-center justify-center rounded-md px-4 py-2 text-sm font-medium",
199
- "bg-[#000000] text-white transition-colors disabled:opacity-50",
200
- className
201
- );
202
199
  return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
203
200
  Button,
204
201
  {
205
- type: "button",
206
- className: classNames,
202
+ ...props,
203
+ type,
204
+ className,
207
205
  style,
208
206
  children: textContent
209
207
  }
@@ -312,7 +310,15 @@ var TextInput = ({ className, style, ...props }) => {
312
310
  const isAutocomplete = props.isAutocomplete ?? false;
313
311
  const [value, setValue] = React2.useState("");
314
312
  const [error, setError] = React2.useState(null);
313
+ React2.useEffect(() => {
314
+ if (!props.validateOnMount) return;
315
+ setError(props.errorMessage || null);
316
+ }, [props.errorMessage, props.validateOnMount]);
315
317
  const handleChange = (e) => {
318
+ if (props.hasFormContainer) {
319
+ props.onChange?.(e);
320
+ return;
321
+ }
316
322
  const val = e.target.value;
317
323
  if (val.length > noOfCharacters) return;
318
324
  setValue(val);
@@ -329,9 +335,13 @@ var TextInput = ({ className, style, ...props }) => {
329
335
  Input,
330
336
  {
331
337
  type: "text",
332
- className,
333
- style,
334
- value,
338
+ name: props.name,
339
+ className: cn(className, error ? "border-red-500" : ""),
340
+ style: {
341
+ ...style,
342
+ borderColor: error ? "#f87171" : style?.borderColor
343
+ },
344
+ value: props.value || value,
335
345
  autoComplete: isAutocomplete ? "on" : "off",
336
346
  placeholder,
337
347
  onChange: handleChange,
@@ -548,6 +558,7 @@ var __iconNode14 = [
548
558
  var Search = createLucideIcon("search", __iconNode14);
549
559
 
550
560
  // src/components/Inputs/NumberInput/NumberInput.tsx
561
+ var import_react4 = require("react");
551
562
  var import_jsx_runtime11 = require("react/jsx-runtime");
552
563
  var NumberInput = ({ className, style, ...props }) => {
553
564
  const placeholder = props.placeholder ?? "Placeholder text";
@@ -561,7 +572,15 @@ var NumberInput = ({ className, style, ...props }) => {
561
572
  const isAutocomplete = props.isAutocomplete ?? false;
562
573
  const [value, setValue] = React3.useState("");
563
574
  const [error, setError] = React3.useState(null);
575
+ (0, import_react4.useEffect)(() => {
576
+ if (!props.validateOnMount) return;
577
+ setError(props.errorMessage || null);
578
+ }, [props.errorMessage, props.validateOnMount]);
564
579
  const handleChange = (e) => {
580
+ if (props.hasFormContainer) {
581
+ props.onChange?.(e);
582
+ return;
583
+ }
565
584
  const val = e.target.value;
566
585
  if (val.length > noOfCharacters) return;
567
586
  setValue(val);
@@ -581,9 +600,13 @@ var NumberInput = ({ className, style, ...props }) => {
581
600
  {
582
601
  type: "number",
583
602
  id: "number-field",
584
- value,
585
- className,
586
- style,
603
+ name: props.name,
604
+ value: props.value || value,
605
+ className: cn(className, error ? "border-red-500" : ""),
606
+ style: {
607
+ ...style,
608
+ borderColor: error ? "#f87171" : style?.borderColor
609
+ },
587
610
  autoComplete: isAutocomplete ? "on" : "off",
588
611
  placeholder,
589
612
  onChange: handleChange,
@@ -615,7 +638,15 @@ var EmailInput = ({ className, style, ...props }) => {
615
638
  const isAutocomplete = props.isAutocomplete ?? false;
616
639
  const [value, setValue] = React4.useState("");
617
640
  const [error, setError] = React4.useState(null);
641
+ React4.useEffect(() => {
642
+ if (!props.validateOnMount) return;
643
+ setError(props.errorMessage || null);
644
+ }, [props.errorMessage, props.validateOnMount]);
618
645
  const handleChange = (e) => {
646
+ if (props.hasFormContainer) {
647
+ props.onChange?.(e);
648
+ return;
649
+ }
619
650
  const val = e.target.value;
620
651
  if (val.length > noOfCharacters) return;
621
652
  setValue(val);
@@ -634,9 +665,13 @@ var EmailInput = ({ className, style, ...props }) => {
634
665
  Input,
635
666
  {
636
667
  type: "email",
637
- value,
638
- className,
639
- style,
668
+ name: props.name,
669
+ value: props.value || value,
670
+ className: cn(className, error ? "border-red-500" : ""),
671
+ style: {
672
+ ...style,
673
+ borderColor: error ? "#f87171" : style?.borderColor
674
+ },
640
675
  autoComplete: isAutocomplete ? "on" : "off",
641
676
  placeholder,
642
677
  onChange: handleChange,
@@ -668,7 +703,15 @@ var PasswordInput = ({ className, style, ...props }) => {
668
703
  const isAutocomplete = props.isAutocomplete ?? false;
669
704
  const [value, setValue] = React5.useState("");
670
705
  const [error, setError] = React5.useState(null);
706
+ React5.useEffect(() => {
707
+ if (!props.validateOnMount) return;
708
+ setError(props.errorMessage || null);
709
+ }, [props.errorMessage, props.validateOnMount]);
671
710
  const handleChange = (e) => {
711
+ if (props.hasFormContainer) {
712
+ props.onChange?.(e);
713
+ return;
714
+ }
672
715
  const val = e.target.value;
673
716
  if (val.length > noOfCharacters) return;
674
717
  setValue(val);
@@ -688,9 +731,13 @@ var PasswordInput = ({ className, style, ...props }) => {
688
731
  {
689
732
  type: "password",
690
733
  id: "password-field",
691
- className,
692
- style,
693
- value,
734
+ name: props.name,
735
+ value: props.value || value,
736
+ className: cn(className, error ? "border-red-500" : ""),
737
+ style: {
738
+ ...style,
739
+ borderColor: error ? "#f87171" : style?.borderColor
740
+ },
694
741
  autoComplete: isAutocomplete ? "on" : "off",
695
742
  placeholder,
696
743
  onChange: handleChange,
@@ -740,7 +787,15 @@ var Textarea2 = ({ className, style, ...props }) => {
740
787
  const isAutocomplete = props.isAutocomplete ?? false;
741
788
  const [value, setValue] = React6.useState("");
742
789
  const [error, setError] = React6.useState(null);
790
+ React6.useEffect(() => {
791
+ if (!props.validateOnMount) return;
792
+ setError(props.errorMessage || null);
793
+ }, [props.errorMessage, props.validateOnMount]);
743
794
  const handleChange = (e) => {
795
+ if (props.hasFormContainer) {
796
+ props.onChange?.(e);
797
+ return;
798
+ }
744
799
  const val = e.target.value;
745
800
  if (val.length > noOfCharacters) return;
746
801
  setValue(val);
@@ -757,9 +812,13 @@ var Textarea2 = ({ className, style, ...props }) => {
757
812
  Textarea,
758
813
  {
759
814
  id: "textarea-field",
760
- className,
761
- style,
762
- value,
815
+ name: props.name,
816
+ value: props.value || value,
817
+ className: cn(className, error ? "border-red-500" : ""),
818
+ style: {
819
+ ...style,
820
+ borderColor: error ? "#f87171" : style?.borderColor
821
+ },
763
822
  autoComplete: isAutocomplete ? "on" : "off",
764
823
  placeholder,
765
824
  onChange: handleChange,
@@ -789,7 +848,15 @@ var UrlInput = ({ className, style, ...props }) => {
789
848
  const isAutocomplete = props.isAutocomplete ?? false;
790
849
  const [value, setValue] = React7.useState("");
791
850
  const [error, setError] = React7.useState(null);
851
+ React7.useEffect(() => {
852
+ if (!props.validateOnMount) return;
853
+ setError(props.errorMessage || null);
854
+ }, [props.errorMessage, props.validateOnMount]);
792
855
  const handleChange = (e) => {
856
+ if (props.hasFormContainer) {
857
+ props.onChange?.(e);
858
+ return;
859
+ }
793
860
  const val = e.target.value;
794
861
  if (val.length > noOfCharacters) return;
795
862
  setValue(val);
@@ -807,11 +874,15 @@ var UrlInput = ({ className, style, ...props }) => {
807
874
  /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
808
875
  Input,
809
876
  {
810
- type: "url",
811
- className,
812
- style,
813
877
  id: "url-field",
814
- value,
878
+ type: "url",
879
+ name: props.name,
880
+ value: props.value || value,
881
+ className: cn(className, error ? "border-red-500" : ""),
882
+ style: {
883
+ ...style,
884
+ borderColor: error ? "#f87171" : style?.borderColor
885
+ },
815
886
  autoComplete: isAutocomplete ? "on" : "off",
816
887
  placeholder,
817
888
  onChange: handleChange,
@@ -958,8 +1029,11 @@ var MultiCheckbox = ({ className, style, ...props }) => {
958
1029
  };
959
1030
  var MultiCheckbox_default = MultiCheckbox;
960
1031
 
1032
+ // src/components/Inputs/RichText/RichText.tsx
1033
+ var import_react6 = require("react");
1034
+
961
1035
  // src/components/Global/TinyMceEditor.tsx
962
- var import_react4 = require("react");
1036
+ var import_react5 = require("react");
963
1037
  var import_tinymce_react = require("@tinymce/tinymce-react");
964
1038
  var import_jsx_runtime23 = require("react/jsx-runtime");
965
1039
  function MyEditor({
@@ -967,7 +1041,7 @@ function MyEditor({
967
1041
  onChange,
968
1042
  isDefault
969
1043
  }) {
970
- const editorRef = (0, import_react4.useRef)(null);
1044
+ const editorRef = (0, import_react5.useRef)(null);
971
1045
  function stripOuterP(html) {
972
1046
  const trimmedHtml = html.trim();
973
1047
  if (!trimmedHtml) return "";
@@ -979,7 +1053,7 @@ function MyEditor({
979
1053
  }
980
1054
  return trimmedHtml;
981
1055
  }
982
- const isDefaultToolbar = (0, import_react4.useMemo)(() => {
1056
+ const isDefaultToolbar = (0, import_react5.useMemo)(() => {
983
1057
  let toolbar = "undo redo | formatselect | bold italic forecolor";
984
1058
  if (isDefault) {
985
1059
  toolbar = "undo redo | blocks | bold italic forecolor | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | removeformat | help";
@@ -1031,8 +1105,26 @@ function MyEditor({
1031
1105
 
1032
1106
  // src/components/Inputs/RichText/RichText.tsx
1033
1107
  var import_jsx_runtime24 = require("react/jsx-runtime");
1034
- function RichText({ className, style }) {
1035
- return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className, style, children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(MyEditor, { isDefault: true }) });
1108
+ function RichText({ className, style, ...props }) {
1109
+ const [error, setError] = (0, import_react6.useState)(null);
1110
+ (0, import_react6.useEffect)(() => {
1111
+ if (!props.validateOnMount) return;
1112
+ setError(props.errorMessage || null);
1113
+ }, [props.errorMessage, props.validateOnMount]);
1114
+ return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
1115
+ "div",
1116
+ {
1117
+ className: cn(className, error ? "border-red-500" : ""),
1118
+ style: {
1119
+ ...style,
1120
+ borderColor: error ? "#f87171" : style?.borderColor
1121
+ },
1122
+ children: [
1123
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(MyEditor, { onChange: (content) => props.onChange?.(content), value: props.value, isDefault: true }),
1124
+ error && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("p", { className: "mt-1 text-xs text-red-500", children: error })
1125
+ ]
1126
+ }
1127
+ );
1036
1128
  }
1037
1129
 
1038
1130
  // src/components/Inputs/Dropdown/Dropdown.tsx
@@ -1175,9 +1267,10 @@ function SelectDropdown({
1175
1267
  id,
1176
1268
  disabled,
1177
1269
  readOnly,
1178
- style
1270
+ style,
1271
+ name
1179
1272
  }) {
1180
- return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(Select, { value, onValueChange: onChange, disabled, children: [
1273
+ return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(Select, { name, value, onValueChange: onChange, disabled, children: [
1181
1274
  /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
1182
1275
  SelectTrigger,
1183
1276
  {
@@ -1210,7 +1303,15 @@ var Dropdown = ({ className, style, ...props }) => {
1210
1303
  const isAutocomplete = props.isAutocomplete ?? false;
1211
1304
  const [value, setValue] = React8.useState("");
1212
1305
  const [error, setError] = React8.useState(null);
1306
+ React8.useEffect(() => {
1307
+ if (!props.validateOnMount) return;
1308
+ setError(props.errorMessage || null);
1309
+ }, [props.errorMessage, props.validateOnMount]);
1213
1310
  const handleChange = (val) => {
1311
+ if (props.hasFormContainer) {
1312
+ props.onChange?.(val);
1313
+ return;
1314
+ }
1214
1315
  setValue(val);
1215
1316
  if (isRequired && val.trim() === "") {
1216
1317
  setError(errorMessage);
@@ -1227,9 +1328,13 @@ var Dropdown = ({ className, style, ...props }) => {
1227
1328
  options: formatList,
1228
1329
  placeholder,
1229
1330
  id: "select-field",
1230
- value,
1231
- className,
1232
- style,
1331
+ name: props.name,
1332
+ value: props.value || value,
1333
+ className: cn(className, error ? "border-red-500" : ""),
1334
+ style: {
1335
+ ...style,
1336
+ borderColor: error ? "#f87171" : style?.borderColor
1337
+ },
1233
1338
  autoComplete: isAutocomplete ? "on" : "off",
1234
1339
  onChange: handleChange,
1235
1340
  disabled: isDisabled || !isEditable,
@@ -1298,7 +1403,15 @@ var PhoneInput = ({ className, style, ...props }) => {
1298
1403
  const isEditable = props.isEditable ?? true;
1299
1404
  const isDisabled = props.isDisabled ?? false;
1300
1405
  const [error, setError] = React9.useState(null);
1406
+ React9.useEffect(() => {
1407
+ if (!props.validateOnMount) return;
1408
+ setError(props.errorMessage || null);
1409
+ }, [props.errorMessage, props.validateOnMount]);
1301
1410
  const handleChange = (val) => {
1411
+ if (props.hasFormContainer) {
1412
+ props.onChange?.(val);
1413
+ return;
1414
+ }
1302
1415
  if (val.length > noOfCharacters) return;
1303
1416
  setValue(val);
1304
1417
  if (isRequired && val.trim() === "") {
@@ -1314,7 +1427,13 @@ var PhoneInput = ({ className, style, ...props }) => {
1314
1427
  import_react_international_phone.PhoneInput,
1315
1428
  {
1316
1429
  defaultCountry: "in",
1317
- value,
1430
+ name: props.name,
1431
+ value: props.value || value,
1432
+ className: cn(className, error ? "border-red-500" : ""),
1433
+ style: {
1434
+ ...style,
1435
+ borderColor: error ? "#f87171" : style?.borderColor
1436
+ },
1318
1437
  onChange: (phone) => handleChange(phone),
1319
1438
  inputProps: {
1320
1439
  id: "phone-field",
@@ -1322,9 +1441,7 @@ var PhoneInput = ({ className, style, ...props }) => {
1322
1441
  },
1323
1442
  placeholder,
1324
1443
  disabled: isDisabled || !isEditable,
1325
- required: isRequired,
1326
- className,
1327
- style
1444
+ required: isRequired
1328
1445
  }
1329
1446
  ),
1330
1447
  error && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("p", { className: "mt-1 text-xs text-red-500", children: error })
@@ -1347,7 +1464,15 @@ var SearchInput = ({ className, style, ...props }) => {
1347
1464
  const isAutocomplete = props.isAutocomplete ?? false;
1348
1465
  const [value, setValue] = React10.useState("");
1349
1466
  const [error, setError] = React10.useState(null);
1467
+ React10.useEffect(() => {
1468
+ if (!props.validateOnMount) return;
1469
+ setError(props.errorMessage || null);
1470
+ }, [props.errorMessage, props.validateOnMount]);
1350
1471
  const handleChange = (e) => {
1472
+ if (props.hasFormContainer) {
1473
+ props.onChange?.(e);
1474
+ return;
1475
+ }
1351
1476
  const val = e.target.value;
1352
1477
  if (val.length > noOfCharacters) return;
1353
1478
  setValue(val);
@@ -1367,9 +1492,13 @@ var SearchInput = ({ className, style, ...props }) => {
1367
1492
  {
1368
1493
  type: "text",
1369
1494
  id: "text-field",
1370
- className,
1371
- style,
1372
- value,
1495
+ name: props.name,
1496
+ value: props.value || value,
1497
+ className: cn(className, error ? "border-red-500" : ""),
1498
+ style: {
1499
+ ...style,
1500
+ borderColor: error ? "#f87171" : style?.borderColor
1501
+ },
1373
1502
  autoComplete: isAutocomplete ? "on" : "off",
1374
1503
  placeholder,
1375
1504
  onChange: handleChange,
@@ -1387,28 +1516,45 @@ var SearchInput = ({ className, style, ...props }) => {
1387
1516
  var SearchInput_default = SearchInput;
1388
1517
 
1389
1518
  // src/components/Inputs/FileInput/FileInput.tsx
1519
+ var import_react7 = require("react");
1390
1520
  var import_jsx_runtime32 = require("react/jsx-runtime");
1391
1521
  var FileInput = ({ className, style, ...props }) => {
1392
1522
  const placeholder = props.placeholder ?? "Placeholder text";
1523
+ const [error, setError] = (0, import_react7.useState)(null);
1524
+ (0, import_react7.useEffect)(() => {
1525
+ if (!props.validateOnMount) return;
1526
+ setError(props.errorMessage || null);
1527
+ }, [props.errorMessage, props.validateOnMount]);
1393
1528
  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
1529
  /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
1396
1530
  Input,
1397
1531
  {
1398
1532
  type: "file",
1399
1533
  id: "file",
1534
+ name: props.name,
1535
+ value: props.value,
1536
+ className: cn(className, error ? "border-red-500" : ""),
1537
+ style: {
1538
+ ...style,
1539
+ borderColor: error ? "#f87171" : style?.borderColor
1540
+ },
1400
1541
  autoComplete: "off",
1401
1542
  placeholder,
1402
- className,
1403
- style
1543
+ onChange: (e) => {
1544
+ if (props.hasFormContainer) {
1545
+ props.onChange?.(e);
1546
+ return;
1547
+ }
1548
+ }
1404
1549
  }
1405
- )
1550
+ ),
1551
+ error && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("p", { className: "mt-1 text-xs text-red-500", children: error })
1406
1552
  ] });
1407
1553
  };
1408
1554
  var FileInput_default = FileInput;
1409
1555
 
1410
1556
  // src/components/Inputs/DatePicker/DatePicker.tsx
1411
- var import_react5 = __toESM(require("react"));
1557
+ var import_react8 = __toESM(require("react"));
1412
1558
  var import_jsx_runtime33 = require("react/jsx-runtime");
1413
1559
  function DatePicker({ className, style, ...props }) {
1414
1560
  const placeholder = props.placeholder ?? "Placeholder text";
@@ -1422,8 +1568,8 @@ function DatePicker({ className, style, ...props }) {
1422
1568
  const isDisabled = props.isDisabled ?? false;
1423
1569
  const isReadonly = props.isReadonly ?? false;
1424
1570
  const isAutocomplete = props.isAutocomplete ?? false;
1425
- const [value, setValue] = import_react5.default.useState("");
1426
- const [error, setError] = import_react5.default.useState(null);
1571
+ const [value, setValue] = import_react8.default.useState("");
1572
+ const [error, setError] = import_react8.default.useState(null);
1427
1573
  const resolveDate = (option, customOption) => {
1428
1574
  if (!option) return void 0;
1429
1575
  switch (option) {
@@ -1438,7 +1584,15 @@ function DatePicker({ className, style, ...props }) {
1438
1584
  };
1439
1585
  const minDate = resolveDate(minimumDate, customMinimumDate);
1440
1586
  const maxDate = resolveDate(maximumDate, customMaximumDate);
1587
+ (0, import_react8.useEffect)(() => {
1588
+ if (!props.validateOnMount) return;
1589
+ setError(props.errorMessage || null);
1590
+ }, [props.errorMessage, props.validateOnMount]);
1441
1591
  const handleChange = (e) => {
1592
+ if (props.hasFormContainer) {
1593
+ props.onChange?.(e);
1594
+ return;
1595
+ }
1442
1596
  const val = e.target.value;
1443
1597
  setValue(val);
1444
1598
  if (isRequired && val.trim() === "") {
@@ -1458,14 +1612,18 @@ function DatePicker({ className, style, ...props }) {
1458
1612
  autoComplete: isAutocomplete ? "on" : "off",
1459
1613
  onChange: handleChange,
1460
1614
  disabled: isDisabled || !isEditable,
1461
- value,
1615
+ name: props.name,
1616
+ value: props.value || value,
1617
+ className: cn(className, error ? "border-red-500" : ""),
1618
+ style: {
1619
+ ...style,
1620
+ borderColor: error ? "#f87171" : style?.borderColor
1621
+ },
1462
1622
  readOnly: isReadonly,
1463
1623
  required: isRequired,
1464
1624
  placeholder,
1465
1625
  min: minDate,
1466
- max: maxDate,
1467
- className,
1468
- style
1626
+ max: maxDate
1469
1627
  }
1470
1628
  )
1471
1629
  ] }),
@@ -2065,13 +2223,13 @@ var CustomPagination = ({
2065
2223
  var Pagination_default = CustomPagination;
2066
2224
 
2067
2225
  // src/components/DataDisplay/Table/Table.tsx
2068
- var import_react6 = require("react");
2226
+ var import_react9 = require("react");
2069
2227
  var import_jsx_runtime41 = require("react/jsx-runtime");
2070
2228
  var Table2 = ({ columns, data, rowActions, className, style, pagination = false, itemsPerPage = 10, onPageChange }) => {
2071
2229
  const rawColumns = Array.isArray(columns) ? columns : [];
2072
2230
  const rawData = Array.isArray(data) ? data : [];
2073
2231
  const rawRowActions = Array.isArray(rowActions) ? rowActions : [];
2074
- const [currentPage, setCurrentPage] = (0, import_react6.useState)(1);
2232
+ const [currentPage, setCurrentPage] = (0, import_react9.useState)(1);
2075
2233
  const enablePagination = pagination && rawData.length > itemsPerPage;
2076
2234
  const handlePageChange = (page) => {
2077
2235
  setCurrentPage(page);
@@ -2236,12 +2394,12 @@ var Tabs = ({ tabs, className, style, pathname, LinkComponent }) => {
2236
2394
  var Tabs_default = Tabs;
2237
2395
 
2238
2396
  // src/components/Navigation/Stages/Stages.tsx
2239
- var import_react7 = __toESM(require("react"));
2397
+ var import_react10 = __toESM(require("react"));
2240
2398
  var import_jsx_runtime44 = require("react/jsx-runtime");
2241
2399
  var StagesComponent = ({ stages, isShowBtn, buttonText, className, style }) => {
2242
2400
  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: [
2243
2401
  /* @__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" }) }) }) }),
2244
- /* @__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_react7.default.Fragment, { children: [
2402
+ /* @__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: [
2245
2403
  /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
2246
2404
  "button",
2247
2405
  {
@@ -2669,8 +2827,8 @@ function EmailComposer({ className, style, to, setTo, showCc, setShowCc, showBcc
2669
2827
  DatePicker,
2670
2828
  DateRange,
2671
2829
  Dropdown,
2830
+ Email,
2672
2831
  EmailComposer,
2673
- EmailInput,
2674
2832
  FileInput,
2675
2833
  FlexLayout,
2676
2834
  GridLayout,
@@ -2682,23 +2840,23 @@ function EmailComposer({ className, style, to, setTo, showCc, setShowCc, showBcc
2682
2840
  Notification,
2683
2841
  NumberInput,
2684
2842
  Pagination,
2685
- PasswordInput,
2686
- PhoneInput,
2843
+ Password,
2844
+ Phone,
2687
2845
  PieChart,
2688
2846
  Profile,
2689
- RadioInput,
2847
+ RadioGroup,
2690
2848
  RichText,
2691
- SearchInput,
2849
+ Search,
2692
2850
  Shape,
2693
2851
  Spacer,
2694
2852
  Stages,
2695
2853
  SwitchToggle,
2696
2854
  Table,
2697
2855
  Tabs,
2698
- TextInput,
2856
+ Text,
2699
2857
  Textarea,
2700
2858
  Typography,
2701
- UrlInput,
2859
+ URL,
2702
2860
  cn
2703
2861
  });
2704
2862
  /*! Bundled license information: