@algorithm-shift/design-system 1.2.92 → 1.2.93

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 CHANGED
@@ -1,6 +1,7 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import * as React$1 from 'react';
3
3
  import React__default from 'react';
4
+ import * as axios from 'axios';
4
5
  import { ToasterProps } from 'sonner';
5
6
  import { ClassValue } from 'clsx';
6
7
 
@@ -46,7 +47,7 @@ type InputProperties = {
46
47
  text?: string;
47
48
  hasFormContainer?: boolean;
48
49
  defaultValue?: string | boolean;
49
- onChange?: (e: React.ChangeEvent<HTMLInputElement | HTMLTextAreaElement | HTMLSelectElement>) => void;
50
+ onChange?: (e: React.ChangeEvent<HTMLInputElement | HTMLTextAreaElement | HTMLSelectElement>, name: string) => void;
50
51
  };
51
52
 
52
53
  type InputSourceProperties = {
@@ -70,19 +71,19 @@ interface TextInputGroupProps extends ElementProps, InputProperties {
70
71
  }
71
72
  interface CheckboxInputProps extends ElementProps, InputProperties {
72
73
  value?: boolean | any;
73
- onChange?: (value: boolean) => void;
74
+ onChange?: (value: boolean, name: string) => void;
74
75
  }
75
76
  interface RadioInputProps extends ElementProps, InputSourceProperties, InputProperties {
76
77
  value?: string | any;
77
- onChange?: (value: string) => void;
78
+ onChange?: (value: string, name: string) => void;
78
79
  }
79
80
  interface MultiCheckboxInputProps extends ElementProps, InputSourceProperties, InputProperties {
80
81
  value?: Record<string, boolean> | any;
81
- onChange?: (value: Record<string, boolean>) => void;
82
+ onChange?: (value: Record<string, boolean>, name: string) => void;
82
83
  }
83
84
  interface RichTextInputProps extends ElementProps, InputProperties {
84
85
  value?: string | any;
85
- onChange?: (value: string) => void;
86
+ onChange?: (value: string, name: string) => void;
86
87
  }
87
88
  interface SelectDropdownInputProps extends ElementProps, InputProperties, InputSourceProperties {
88
89
  source?: string;
@@ -90,16 +91,18 @@ interface SelectDropdownInputProps extends ElementProps, InputProperties, InputS
90
91
  apiUrl?: string;
91
92
  pageSize?: number;
92
93
  value?: string | any;
93
- onChange?: (value: string) => void;
94
+ onChange?: (value: string, name: string) => void;
95
+ axiosInstance?: typeof axios.default;
94
96
  }
95
97
  interface SwitchToggleInputProps extends ElementProps, InputProperties {
96
98
  value?: boolean | any;
97
- onChange?: (value: boolean) => void;
99
+ onChange?: (value: boolean, name: string) => void;
98
100
  }
99
101
  interface PhoneInputProps extends ElementProps, InputProperties { }
100
102
  interface DateRangeInputProps extends ElementProps {
103
+ name?: string;
101
104
  value?: { from?: Date; to?: Date } | undefined;
102
- onChange?: (value: { from?: Date; to?: Date } | undefined) => void;
105
+ onChange?: (value: { from?: Date; to?: Date } | undefined, name: string) => void;
103
106
  errorMessage?: string;
104
107
  validateOnMount?: boolean;
105
108
  }
@@ -298,7 +301,7 @@ declare const CheckboxInput: ({ className, style, ...props }: CheckboxInputProps
298
301
 
299
302
  declare const RadioInput: ({ className, style, defaultValue, onChange, data, dataKey, dataLabel, ...props }: RadioInputProps) => react_jsx_runtime.JSX.Element;
300
303
 
301
- declare const MultiCheckbox: ({ className, style, data, dataKey, dataLabel, value: propValue, onChange, isEditable, isDisabled, }: MultiCheckboxInputProps) => react_jsx_runtime.JSX.Element;
304
+ declare const MultiCheckbox: ({ className, style, data, dataKey, dataLabel, value: propValue, onChange, isEditable, isDisabled, ...props }: MultiCheckboxInputProps) => react_jsx_runtime.JSX.Element;
302
305
 
303
306
  declare function RichText({ className, style, ...props }: RichTextInputProps): react_jsx_runtime.JSX.Element;
304
307
 
@@ -324,7 +327,7 @@ interface Option {
324
327
  }
325
328
  interface MultiSelectProps {
326
329
  value: string[];
327
- onChange: (value: string[]) => void;
330
+ onChange: (value: string[], name: string) => void;
328
331
  data: Option[];
329
332
  placeholder?: string;
330
333
  disabled?: boolean;
@@ -333,6 +336,7 @@ interface MultiSelectProps {
333
336
  errorMessage?: string;
334
337
  dataKey?: string;
335
338
  dataLabel?: string;
339
+ name: string;
336
340
  }
337
341
  declare const MultiSelect: React$1.FC<MultiSelectProps>;
338
342
 
package/dist/index.d.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import * as React$1 from 'react';
3
3
  import React__default from 'react';
4
+ import * as axios from 'axios';
4
5
  import { ToasterProps } from 'sonner';
5
6
  import { ClassValue } from 'clsx';
6
7
 
@@ -46,7 +47,7 @@ type InputProperties = {
46
47
  text?: string;
47
48
  hasFormContainer?: boolean;
48
49
  defaultValue?: string | boolean;
49
- onChange?: (e: React.ChangeEvent<HTMLInputElement | HTMLTextAreaElement | HTMLSelectElement>) => void;
50
+ onChange?: (e: React.ChangeEvent<HTMLInputElement | HTMLTextAreaElement | HTMLSelectElement>, name: string) => void;
50
51
  };
51
52
 
52
53
  type InputSourceProperties = {
@@ -70,19 +71,19 @@ interface TextInputGroupProps extends ElementProps, InputProperties {
70
71
  }
71
72
  interface CheckboxInputProps extends ElementProps, InputProperties {
72
73
  value?: boolean | any;
73
- onChange?: (value: boolean) => void;
74
+ onChange?: (value: boolean, name: string) => void;
74
75
  }
75
76
  interface RadioInputProps extends ElementProps, InputSourceProperties, InputProperties {
76
77
  value?: string | any;
77
- onChange?: (value: string) => void;
78
+ onChange?: (value: string, name: string) => void;
78
79
  }
79
80
  interface MultiCheckboxInputProps extends ElementProps, InputSourceProperties, InputProperties {
80
81
  value?: Record<string, boolean> | any;
81
- onChange?: (value: Record<string, boolean>) => void;
82
+ onChange?: (value: Record<string, boolean>, name: string) => void;
82
83
  }
83
84
  interface RichTextInputProps extends ElementProps, InputProperties {
84
85
  value?: string | any;
85
- onChange?: (value: string) => void;
86
+ onChange?: (value: string, name: string) => void;
86
87
  }
87
88
  interface SelectDropdownInputProps extends ElementProps, InputProperties, InputSourceProperties {
88
89
  source?: string;
@@ -90,16 +91,18 @@ interface SelectDropdownInputProps extends ElementProps, InputProperties, InputS
90
91
  apiUrl?: string;
91
92
  pageSize?: number;
92
93
  value?: string | any;
93
- onChange?: (value: string) => void;
94
+ onChange?: (value: string, name: string) => void;
95
+ axiosInstance?: typeof axios.default;
94
96
  }
95
97
  interface SwitchToggleInputProps extends ElementProps, InputProperties {
96
98
  value?: boolean | any;
97
- onChange?: (value: boolean) => void;
99
+ onChange?: (value: boolean, name: string) => void;
98
100
  }
99
101
  interface PhoneInputProps extends ElementProps, InputProperties { }
100
102
  interface DateRangeInputProps extends ElementProps {
103
+ name?: string;
101
104
  value?: { from?: Date; to?: Date } | undefined;
102
- onChange?: (value: { from?: Date; to?: Date } | undefined) => void;
105
+ onChange?: (value: { from?: Date; to?: Date } | undefined, name: string) => void;
103
106
  errorMessage?: string;
104
107
  validateOnMount?: boolean;
105
108
  }
@@ -298,7 +301,7 @@ declare const CheckboxInput: ({ className, style, ...props }: CheckboxInputProps
298
301
 
299
302
  declare const RadioInput: ({ className, style, defaultValue, onChange, data, dataKey, dataLabel, ...props }: RadioInputProps) => react_jsx_runtime.JSX.Element;
300
303
 
301
- declare const MultiCheckbox: ({ className, style, data, dataKey, dataLabel, value: propValue, onChange, isEditable, isDisabled, }: MultiCheckboxInputProps) => react_jsx_runtime.JSX.Element;
304
+ declare const MultiCheckbox: ({ className, style, data, dataKey, dataLabel, value: propValue, onChange, isEditable, isDisabled, ...props }: MultiCheckboxInputProps) => react_jsx_runtime.JSX.Element;
302
305
 
303
306
  declare function RichText({ className, style, ...props }: RichTextInputProps): react_jsx_runtime.JSX.Element;
304
307
 
@@ -324,7 +327,7 @@ interface Option {
324
327
  }
325
328
  interface MultiSelectProps {
326
329
  value: string[];
327
- onChange: (value: string[]) => void;
330
+ onChange: (value: string[], name: string) => void;
328
331
  data: Option[];
329
332
  placeholder?: string;
330
333
  disabled?: boolean;
@@ -333,6 +336,7 @@ interface MultiSelectProps {
333
336
  errorMessage?: string;
334
337
  dataKey?: string;
335
338
  dataLabel?: string;
339
+ name: string;
336
340
  }
337
341
  declare const MultiSelect: React$1.FC<MultiSelectProps>;
338
342
 
package/dist/index.js CHANGED
@@ -27012,7 +27012,7 @@ var TextInput = ({ className, style, ...props }) => {
27012
27012
  }
27013
27013
  }, []);
27014
27014
  const handleChange = (e) => {
27015
- props.onChange?.(e);
27015
+ props.onChange?.(e, e.target.name || "");
27016
27016
  };
27017
27017
  return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(import_jsx_runtime20.Fragment, { children: [
27018
27018
  /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
@@ -27054,7 +27054,7 @@ var NumberInput = ({ className, style, ...props }) => {
27054
27054
  }
27055
27055
  }, []);
27056
27056
  const handleChange = (e) => {
27057
- props.onChange?.(e);
27057
+ props.onChange?.(e, e.target.name || "");
27058
27058
  };
27059
27059
  return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_jsx_runtime21.Fragment, { children: [
27060
27060
  /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "flex justify-start items-center relative", children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
@@ -27097,7 +27097,7 @@ var EmailInput = ({ className, style, ...props }) => {
27097
27097
  }
27098
27098
  }, []);
27099
27099
  const handleChange = (e) => {
27100
- props.onChange?.(e);
27100
+ props.onChange?.(e, props.name || "");
27101
27101
  };
27102
27102
  return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(import_jsx_runtime22.Fragment, { children: [
27103
27103
  /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "flex justify-start items-center relative", children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
@@ -27139,7 +27139,7 @@ var PasswordInput = ({ className, style, ...props }) => {
27139
27139
  }
27140
27140
  }, []);
27141
27141
  const handleChange = (e) => {
27142
- props.onChange?.(e);
27142
+ props.onChange?.(e, e.target.name || "");
27143
27143
  };
27144
27144
  return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(import_jsx_runtime23.Fragment, { children: [
27145
27145
  /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "flex justify-start items-center relative", children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
@@ -27200,7 +27200,7 @@ var Textarea2 = ({ className, style, ...props }) => {
27200
27200
  }
27201
27201
  }, []);
27202
27202
  const handleChange = (e) => {
27203
- props.onChange?.(e);
27203
+ props.onChange?.(e, e.target.name || "");
27204
27204
  };
27205
27205
  return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(import_jsx_runtime25.Fragment, { children: [
27206
27206
  /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
@@ -27242,7 +27242,7 @@ var UrlInput = ({ className, style, ...props }) => {
27242
27242
  }
27243
27243
  }, []);
27244
27244
  const handleChange = (e) => {
27245
- props.onChange?.(e);
27245
+ props.onChange?.(e, e.target.name || "");
27246
27246
  };
27247
27247
  return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(import_jsx_runtime26.Fragment, { children: [
27248
27248
  /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "flex justify-start items-center relative", children: [
@@ -27335,7 +27335,7 @@ var CheckboxInput = ({ className, style, ...props }) => {
27335
27335
  }
27336
27336
  }, []);
27337
27337
  const handleChange = (value) => {
27338
- props.onChange?.(value);
27338
+ props.onChange?.(value, props.name || "");
27339
27339
  };
27340
27340
  return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(import_jsx_runtime29.Fragment, { children: [
27341
27341
  /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className, style, children: /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: "flex items-center space-x-2", children: [
@@ -27422,7 +27422,7 @@ var RadioInput = ({
27422
27422
  }
27423
27423
  }, []);
27424
27424
  const handleChange = (value) => {
27425
- onChange?.(value);
27425
+ onChange?.(value, props.name || "");
27426
27426
  };
27427
27427
  const resolvedDefaultValue = (typeof defaultValue === "string" ? defaultValue : void 0) ?? options[0]?.value;
27428
27428
  return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(import_jsx_runtime31.Fragment, { children: [
@@ -27457,7 +27457,8 @@ var MultiCheckbox = ({
27457
27457
  value: propValue = {},
27458
27458
  onChange,
27459
27459
  isEditable = true,
27460
- isDisabled = false
27460
+ isDisabled = false,
27461
+ ...props
27461
27462
  }) => {
27462
27463
  const list = Array.isArray(data) ? data : [];
27463
27464
  const [value, setValue] = (0, import_react16.useState)(propValue);
@@ -27467,14 +27468,14 @@ var MultiCheckbox = ({
27467
27468
  }));
27468
27469
  (0, import_react16.useEffect)(() => {
27469
27470
  if (propValue !== void 0) {
27470
- onChange?.(propValue);
27471
+ onChange?.(propValue, props.name || "");
27471
27472
  }
27472
27473
  }, []);
27473
27474
  const handleChange = (0, import_react16.useCallback)(
27474
27475
  (key, checked) => {
27475
27476
  setValue((prev) => {
27476
27477
  const newValue = { ...prev, [key]: checked };
27477
- onChange?.(newValue);
27478
+ onChange?.(newValue, props.name || "");
27478
27479
  return newValue;
27479
27480
  });
27480
27481
  },
@@ -27588,7 +27589,7 @@ function RichText({ className, style, ...props }) {
27588
27589
  }
27589
27590
  }, []);
27590
27591
  const handleChange = (content) => {
27591
- props.onChange?.(content);
27592
+ props.onChange?.(content, props.name || "");
27592
27593
  };
27593
27594
  return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(
27594
27595
  "div",
@@ -27861,8 +27862,7 @@ function useLazyDropdown(config) {
27861
27862
  const reset = (0, import_react19.useCallback)(() => {
27862
27863
  setSearchTerm("");
27863
27864
  setPage(1);
27864
- loadPage(1, "");
27865
- }, [loadPage]);
27865
+ }, []);
27866
27866
  (0, import_react19.useEffect)(() => {
27867
27867
  if (config.initialData?.length) {
27868
27868
  allDataRef.current = config.initialData;
@@ -27955,7 +27955,7 @@ function LazySelectDropdown({
27955
27955
  search(term);
27956
27956
  };
27957
27957
  const handleSelect = (optValue) => {
27958
- onChange?.(optValue);
27958
+ onChange?.(optValue, id || "");
27959
27959
  setIsOpen(false);
27960
27960
  setSearchTerm("");
27961
27961
  reset();
@@ -28044,7 +28044,7 @@ var Dropdown = ({ className, style, ...props }) => {
28044
28044
  }
28045
28045
  }, []);
28046
28046
  const handleChange = (value) => {
28047
- props.onChange?.(value);
28047
+ props.onChange?.(value, props.name ?? "");
28048
28048
  };
28049
28049
  const dataKey = props.dataKey || "value";
28050
28050
  const dataLabel = props.dataLabel || "label";
@@ -28139,7 +28139,7 @@ var SwitchToggle = ({ className, style, ...props }) => {
28139
28139
  }
28140
28140
  }, []);
28141
28141
  const handleChange = (value) => {
28142
- props.onChange?.(value);
28142
+ props.onChange?.(value, props.name || "");
28143
28143
  };
28144
28144
  return /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(import_jsx_runtime39.Fragment, { children: [
28145
28145
  /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("div", { className, style, children: /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("div", { className: "flex items-center space-x-2 mb-2", children: [
@@ -28174,7 +28174,7 @@ var PhoneInput = ({ className, style, ...props }) => {
28174
28174
  }
28175
28175
  }, []);
28176
28176
  const handleChange = (val) => {
28177
- props.onChange?.(val);
28177
+ props.onChange?.(val, props.name || "");
28178
28178
  };
28179
28179
  return /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(import_jsx_runtime40.Fragment, { children: [
28180
28180
  /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
@@ -28222,7 +28222,7 @@ var SearchInput = ({ className, style, ...props }) => {
28222
28222
  }
28223
28223
  }, []);
28224
28224
  const handleChange = (e) => {
28225
- props.onChange?.(e);
28225
+ props.onChange?.(e, e.target.name || "");
28226
28226
  };
28227
28227
  return /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(import_jsx_runtime41.Fragment, { children: [
28228
28228
  /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("div", { className: "flex justify-start items-center relative", children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
@@ -28261,7 +28261,7 @@ var FileInput2 = ({ className, style, ...props }) => {
28261
28261
  }
28262
28262
  }, []);
28263
28263
  const handleChange = (e) => {
28264
- props.onChange?.(e);
28264
+ props.onChange?.(e, props.name || "");
28265
28265
  };
28266
28266
  return /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { className: "d-flex items-center relative align-middle", children: [
28267
28267
  /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
@@ -28319,7 +28319,7 @@ function DatePicker({ className, style, ...props }) {
28319
28319
  }
28320
28320
  }, []);
28321
28321
  const handleChange = (e) => {
28322
- props.onChange?.(e);
28322
+ props.onChange?.(e, e.target.name || "");
28323
28323
  };
28324
28324
  const toDateInputValue = (value) => {
28325
28325
  if (!value) return "";
@@ -28592,7 +28592,7 @@ var DateRange = ({ className, style, ...props }) => {
28592
28592
  const handleChange = (value) => {
28593
28593
  setDate(value);
28594
28594
  if (value) {
28595
- props.onChange?.(value);
28595
+ props.onChange?.(value, props.name || "");
28596
28596
  }
28597
28597
  };
28598
28598
  return /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(import_jsx_runtime46.Fragment, { children: [
@@ -28646,7 +28646,7 @@ var TextInputGroup = ({ className, style, prepend, append, ...props }) => {
28646
28646
  }
28647
28647
  }, []);
28648
28648
  const handleChange = (e) => {
28649
- props.onChange?.(e);
28649
+ props.onChange?.(e, e.target.name || "");
28650
28650
  };
28651
28651
  return /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(import_jsx_runtime47.Fragment, { children: [
28652
28652
  /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(
@@ -28933,12 +28933,13 @@ var MultiSelect = ({
28933
28933
  const [open, setOpen] = React8.useState(false);
28934
28934
  React8.useEffect(() => {
28935
28935
  if (value) {
28936
- onChange(value);
28936
+ onChange(value, props.name || "");
28937
28937
  }
28938
28938
  }, []);
28939
28939
  const toggleOption = (val) => {
28940
28940
  onChange(
28941
- value?.includes(val) ? value.filter((v) => v !== val) : [...value || [], val]
28941
+ value?.includes(val) ? value.filter((v) => v !== val) : [...value || [], val],
28942
+ props.name || ""
28942
28943
  );
28943
28944
  };
28944
28945
  const selectedLabels = React8.useMemo(