dynamic-formik-form 1.0.7 → 1.0.8

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
@@ -166,6 +166,15 @@ interface UILibraryAdapter {
166
166
  helperText?: string;
167
167
  [key: string]: unknown;
168
168
  }>;
169
+ Password?: ComponentType<BaseUIComponentProps & {
170
+ name: string;
171
+ value: string | number;
172
+ placeholder?: string;
173
+ onChange: (e: React.ChangeEvent<HTMLInputElement>) => void;
174
+ onBlur: (e: React.FocusEvent<HTMLInputElement>) => void;
175
+ autoComplete?: string;
176
+ readOnly?: boolean;
177
+ }>;
169
178
  }
170
179
  /**
171
180
  * UI Library configuration
@@ -410,7 +419,9 @@ type MUIComponent = ComponentType<any>;
410
419
  * 2. Import actual MUI components
411
420
  * 3. Map them to the adapter interface
412
421
  */
413
- declare const createMUIAdapter: (Box: MUIComponent, Button: MUIComponent, Checkbox: MUIComponent, FormControl: MUIComponent, FormControlLabel: MUIComponent, FormHelperText: MUIComponent, IconButton: MUIComponent, MenuItem: MUIComponent, Paper: MUIComponent, Popover: MUIComponent, Radio: MUIComponent, RadioGroup: MUIComponent, Switch: MUIComponent, TextField: MUIComponent, Typography: MUIComponent, DatePicker?: MUIComponent, DateTimePicker?: MUIComponent) => UILibraryAdapter;
422
+ declare const createMUIAdapter: (Box: MUIComponent, Button: MUIComponent, Checkbox: MUIComponent, FormControl: MUIComponent, FormControlLabel: MUIComponent, FormHelperText: MUIComponent, IconButton: MUIComponent, InputAdornment: MUIComponent, MenuItem: MUIComponent, Paper: MUIComponent, Popover: MUIComponent, Radio: MUIComponent, RadioGroup: MUIComponent, Select: MUIComponent, Switch: MUIComponent, TextField: MUIComponent, Typography: MUIComponent, DatePicker?: MUIComponent, DateTimePicker?: MUIComponent) => UILibraryAdapter & {
423
+ InputAdornment?: MUIComponent;
424
+ };
414
425
 
415
426
  /**
416
427
  * Bootstrap React Adapter Example
package/dist/index.d.ts CHANGED
@@ -166,6 +166,15 @@ interface UILibraryAdapter {
166
166
  helperText?: string;
167
167
  [key: string]: unknown;
168
168
  }>;
169
+ Password?: ComponentType<BaseUIComponentProps & {
170
+ name: string;
171
+ value: string | number;
172
+ placeholder?: string;
173
+ onChange: (e: React.ChangeEvent<HTMLInputElement>) => void;
174
+ onBlur: (e: React.FocusEvent<HTMLInputElement>) => void;
175
+ autoComplete?: string;
176
+ readOnly?: boolean;
177
+ }>;
169
178
  }
170
179
  /**
171
180
  * UI Library configuration
@@ -410,7 +419,9 @@ type MUIComponent = ComponentType<any>;
410
419
  * 2. Import actual MUI components
411
420
  * 3. Map them to the adapter interface
412
421
  */
413
- declare const createMUIAdapter: (Box: MUIComponent, Button: MUIComponent, Checkbox: MUIComponent, FormControl: MUIComponent, FormControlLabel: MUIComponent, FormHelperText: MUIComponent, IconButton: MUIComponent, MenuItem: MUIComponent, Paper: MUIComponent, Popover: MUIComponent, Radio: MUIComponent, RadioGroup: MUIComponent, Switch: MUIComponent, TextField: MUIComponent, Typography: MUIComponent, DatePicker?: MUIComponent, DateTimePicker?: MUIComponent) => UILibraryAdapter;
422
+ declare const createMUIAdapter: (Box: MUIComponent, Button: MUIComponent, Checkbox: MUIComponent, FormControl: MUIComponent, FormControlLabel: MUIComponent, FormHelperText: MUIComponent, IconButton: MUIComponent, InputAdornment: MUIComponent, MenuItem: MUIComponent, Paper: MUIComponent, Popover: MUIComponent, Radio: MUIComponent, RadioGroup: MUIComponent, Select: MUIComponent, Switch: MUIComponent, TextField: MUIComponent, Typography: MUIComponent, DatePicker?: MUIComponent, DateTimePicker?: MUIComponent) => UILibraryAdapter & {
423
+ InputAdornment?: MUIComponent;
424
+ };
414
425
 
415
426
  /**
416
427
  * Bootstrap React Adapter Example
package/dist/index.js CHANGED
@@ -1,14 +1,14 @@
1
1
  'use strict';
2
2
 
3
- var React7 = require('react');
3
+ var React2 = require('react');
4
4
  var jsxRuntime = require('react/jsx-runtime');
5
5
 
6
6
  function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
7
7
 
8
- var React7__default = /*#__PURE__*/_interopDefault(React7);
8
+ var React2__default = /*#__PURE__*/_interopDefault(React2);
9
9
 
10
10
  // src/components/DynamicForm.tsx
11
- var FormContext = React7.createContext(null);
11
+ var FormContext = React2.createContext(null);
12
12
  var FormProvider = ({
13
13
  children,
14
14
  uiLibrary,
@@ -17,7 +17,7 @@ var FormProvider = ({
17
17
  return /* @__PURE__ */ jsxRuntime.jsx(FormContext.Provider, { value: { uiLibrary, formik }, children });
18
18
  };
19
19
  var useFormContext = () => {
20
- const context = React7.useContext(FormContext);
20
+ const context = React2.useContext(FormContext);
21
21
  if (!context) {
22
22
  throw new Error("useFormContext must be used within FormProvider");
23
23
  }
@@ -96,7 +96,7 @@ var defaultAdapter = {
96
96
  }
97
97
  )
98
98
  };
99
- var createMUIAdapter = (Box, Button, Checkbox, FormControl, FormControlLabel, FormHelperText, IconButton, MenuItem, Paper, Popover, Radio, RadioGroup, Switch, TextField2, Typography, DatePicker, DateTimePicker) => {
99
+ var createMUIAdapter = (Box, Button, Checkbox, FormControl, FormControlLabel, FormHelperText, IconButton, InputAdornment, MenuItem, Paper, Popover, Radio, RadioGroup, Select, Switch, TextField2, Typography, DatePicker, DateTimePicker) => {
100
100
  const filterMUIProps = (props) => {
101
101
  const filtered = { ...props };
102
102
  delete filtered.error;
@@ -106,19 +106,21 @@ var createMUIAdapter = (Box, Button, Checkbox, FormControl, FormControlLabel, Fo
106
106
  delete filtered.variant;
107
107
  return filtered;
108
108
  };
109
- return {
109
+ const adapterReturn = {
110
110
  Input: ({ className, disabled, error, type, ...props }) => {
111
111
  const filteredProps = filterMUIProps(props);
112
+ const { InputProps, ...restFilteredProps } = filteredProps;
112
113
  return /* @__PURE__ */ jsxRuntime.jsx(
113
114
  TextField2,
114
115
  {
115
- ...filteredProps,
116
+ ...restFilteredProps,
116
117
  type,
117
118
  disabled,
118
119
  ...error ? { error: true } : {},
119
120
  className,
120
121
  fullWidth: true,
121
- variant: "outlined"
122
+ variant: "outlined",
123
+ InputProps
122
124
  }
123
125
  );
124
126
  },
@@ -140,17 +142,41 @@ var createMUIAdapter = (Box, Button, Checkbox, FormControl, FormControlLabel, Fo
140
142
  },
141
143
  Select: ({ className, disabled, error, children, ...props }) => {
142
144
  const filteredProps = filterMUIProps(props);
145
+ const convertOptionsToMenuItems = (children2) => {
146
+ return React2__default.default.Children.map(children2, (child) => {
147
+ if (React2__default.default.isValidElement(child) && child.type === "option") {
148
+ const { value, children: optionChildren, ...optionProps } = child.props;
149
+ return /* @__PURE__ */ jsxRuntime.jsx(MenuItem, { value: value || "", ...optionProps, children: optionChildren }, value || optionChildren);
150
+ }
151
+ return child;
152
+ });
153
+ };
154
+ const menuItems = convertOptionsToMenuItems(children);
143
155
  return /* @__PURE__ */ jsxRuntime.jsx(
144
- TextField2,
156
+ Select,
145
157
  {
146
158
  ...filteredProps,
147
- select: true,
148
159
  disabled,
149
- ...error ? { error: true } : {},
150
- className,
160
+ value: props.value || "",
161
+ onChange: props.onChange,
162
+ onBlur: props.onBlur,
163
+ displayEmpty: !props.value,
151
164
  fullWidth: true,
152
- variant: "outlined",
153
- children
165
+ className,
166
+ sx: {
167
+ borderRadius: "10px",
168
+ "& .MuiOutlinedInput-notchedOutline": {
169
+ borderColor: error ? "#ef4444" : "#d1d5db"
170
+ },
171
+ "&:hover .MuiOutlinedInput-notchedOutline": {
172
+ borderColor: error ? "#ef4444" : "#6366f1"
173
+ },
174
+ "&.Mui-focused .MuiOutlinedInput-notchedOutline": {
175
+ borderColor: error ? "#ef4444" : "#6366f1",
176
+ borderWidth: 2
177
+ }
178
+ },
179
+ children: menuItems
154
180
  }
155
181
  );
156
182
  },
@@ -289,6 +315,8 @@ var createMUIAdapter = (Box, Button, Checkbox, FormControl, FormControlLabel, Fo
289
315
  );
290
316
  } : void 0
291
317
  };
318
+ adapterReturn.InputAdornment = InputAdornment;
319
+ return adapterReturn;
292
320
  };
293
321
  var createBootstrapAdapter = (Form, FormControl, FormLabel, FormText, FormCheck, FormSelect, ButtonComponent, InputGroup, OverlayTrigger, Popover, ListGroup, ListGroupItem) => {
294
322
  return {
@@ -439,9 +467,9 @@ var createBootstrapAdapter = (Form, FormControl, FormLabel, FormText, FormCheck,
439
467
  var createAntDesignAdapter = (Input, Button, Checkbox, Radio, Switch, Select, Form, Typography, Popover, DatePicker, DateTimePicker, Space, Card) => {
440
468
  const TextArea = Input.TextArea || Input;
441
469
  const { TextArea: AntDTextArea } = Input;
470
+ const Password = Input.Password || Input;
442
471
  const { Text: TypographyText } = Typography;
443
472
  const { Group: RadioGroup } = Radio;
444
- const SpaceComponent = Space || (({ children, ...props }) => /* @__PURE__ */ jsxRuntime.jsx("div", { ...props, children }));
445
473
  const CardComponent = Card || (({ children, className }) => /* @__PURE__ */ jsxRuntime.jsx("div", { className: `ant-card ${className || ""}`, children }));
446
474
  return {
447
475
  Input: ({ className, disabled, error, type, ...props }) => /* @__PURE__ */ jsxRuntime.jsx(
@@ -454,26 +482,49 @@ var createAntDesignAdapter = (Input, Button, Checkbox, Radio, Switch, Select, Fo
454
482
  className
455
483
  }
456
484
  ),
457
- Textarea: ({ className, disabled, error, rows, ...props }) => /* @__PURE__ */ jsxRuntime.jsx(
458
- TextArea,
485
+ Password: ({ className, disabled, error, ...props }) => /* @__PURE__ */ jsxRuntime.jsx(
486
+ Password,
459
487
  {
460
488
  ...props,
461
- rows: rows || 4,
462
489
  disabled,
463
490
  status: error ? "error" : void 0,
464
491
  className
465
492
  }
466
493
  ),
467
- Select: ({ className, disabled, error, children, ...props }) => /* @__PURE__ */ jsxRuntime.jsx(
468
- Select,
494
+ Textarea: ({ className, disabled, error, rows, ...props }) => /* @__PURE__ */ jsxRuntime.jsx(
495
+ TextArea,
469
496
  {
470
497
  ...props,
498
+ rows: rows || 4,
471
499
  disabled,
472
500
  status: error ? "error" : void 0,
473
- className,
474
- children
501
+ className
475
502
  }
476
503
  ),
504
+ Select: ({ className, disabled, error, children, ...props }) => {
505
+ const convertOptionsToSelectOptions = (children2) => {
506
+ const SelectComponent = Select;
507
+ const Option = SelectComponent.Option;
508
+ return React2__default.default.Children.map(children2, (child) => {
509
+ if (React2__default.default.isValidElement(child) && child.type === "option") {
510
+ const { value, children: optionChildren, ...optionProps } = child.props;
511
+ return /* @__PURE__ */ jsxRuntime.jsx(Option, { value: value || "", ...optionProps, children: optionChildren }, value || optionChildren);
512
+ }
513
+ return child;
514
+ });
515
+ };
516
+ const selectOptions = convertOptionsToSelectOptions(children);
517
+ return /* @__PURE__ */ jsxRuntime.jsx(
518
+ Select,
519
+ {
520
+ ...props,
521
+ disabled,
522
+ status: error ? "error" : void 0,
523
+ className,
524
+ children: selectOptions
525
+ }
526
+ );
527
+ },
477
528
  Checkbox: ({ className, disabled, label, ...props }) => /* @__PURE__ */ jsxRuntime.jsx(
478
529
  Checkbox,
479
530
  {
@@ -512,14 +563,34 @@ var createAntDesignAdapter = (Input, Button, Checkbox, Radio, Switch, Select, Fo
512
563
  children
513
564
  }
514
565
  ),
515
- FormControl: ({ className, children }) => {
566
+ FormControl: ({ className, children, required, error }) => {
516
567
  const FormComponent = Form;
517
568
  const FormItem = FormComponent.Item || FormComponent;
518
- return /* @__PURE__ */ jsxRuntime.jsx(FormItem, { className, children });
569
+ return /* @__PURE__ */ jsxRuntime.jsx(
570
+ FormItem,
571
+ {
572
+ className,
573
+ required,
574
+ validateStatus: error ? "error" : void 0,
575
+ style: { marginBottom: "24px" },
576
+ children
577
+ }
578
+ );
519
579
  },
520
580
  FormHelperText: ({ className, children }) => /* @__PURE__ */ jsxRuntime.jsx(TypographyText, { type: "secondary", className, children }),
521
581
  Label: ({ className, htmlFor, children }) => /* @__PURE__ */ jsxRuntime.jsx("label", { className, htmlFor, children }),
522
- Box: ({ className, children, ...props }) => /* @__PURE__ */ jsxRuntime.jsx(SpaceComponent, { className, ...props, children }),
582
+ Box: ({ className, children, ...props }) => {
583
+ const { style, ...restProps } = props;
584
+ return /* @__PURE__ */ jsxRuntime.jsx(
585
+ "div",
586
+ {
587
+ className,
588
+ style: { display: "flex", width: "100%", ...style },
589
+ ...restProps,
590
+ children
591
+ }
592
+ );
593
+ },
523
594
  Paper: ({ className, children }) => /* @__PURE__ */ jsxRuntime.jsx(CardComponent, { className, children }),
524
595
  Popover: ({ open, anchorEl, onClose, children, anchorOrigin, ...props }) => {
525
596
  if (!open) return null;
@@ -760,14 +831,17 @@ var FieldWrapper = ({
760
831
  index
761
832
  }) => {
762
833
  if (hidden) {
763
- return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "d-none", children });
834
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { style: { display: "none" }, children });
764
835
  }
836
+ const wrapperStyle = {
837
+ marginBottom: customClass ? void 0 : "16px",
838
+ paddingLeft: isChild && !noIndent ? "20px" : void 0
839
+ };
765
840
  const wrapperClasses = [
766
- customClass || "mb-4",
767
- isChild && !noIndent ? "ps-5" : "",
841
+ customClass,
768
842
  className || ""
769
843
  ].filter(Boolean).join(" ");
770
- return /* @__PURE__ */ jsxRuntime.jsx("div", { className: wrapperClasses, children }, index);
844
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: wrapperClasses, style: wrapperStyle, children }, index);
771
845
  };
772
846
  var IconRenderer = ({
773
847
  Icon,
@@ -775,7 +849,7 @@ var IconRenderer = ({
775
849
  className
776
850
  }) => {
777
851
  if (!Icon) return null;
778
- return React7__default.default.createElement(Icon, { size, className });
852
+ return React2__default.default.createElement(Icon, { size, className });
779
853
  };
780
854
  var FieldLabel = ({
781
855
  name,
@@ -1080,21 +1154,26 @@ var InputField = ({
1080
1154
  formik: formikProp
1081
1155
  }) => {
1082
1156
  const { uiLibrary, formik } = useFormContext();
1083
- const { adapter, icons } = uiLibrary;
1157
+ const { adapter, icons, name: uiLibraryName } = uiLibrary;
1084
1158
  const Input = adapter.Input;
1085
- adapter.IconButton;
1159
+ const Password = adapter.Password;
1160
+ const IconButton = adapter.IconButton;
1161
+ const Box = adapter.Box;
1086
1162
  const activeFormik = formikProp || formik;
1087
- const [showField, setShowField] = React7.useState({});
1163
+ const isMUI = uiLibraryName === "mui";
1164
+ const isAntD = uiLibraryName === "antd";
1165
+ const InputAdornment = isMUI ? adapter.InputAdornment : void 0;
1166
+ const [showField, setShowField] = React2.useState({});
1088
1167
  const fieldValue = getFieldValue(activeFormik, name);
1089
1168
  const fieldError = getFieldError(activeFormik, name);
1090
1169
  const fieldTouched = getFieldTouched(activeFormik, name);
1091
- const showFieldHandler = React7.useCallback((fieldName) => {
1170
+ const showFieldHandler = React2.useCallback((fieldName) => {
1092
1171
  setShowField((prev) => ({
1093
1172
  ...prev,
1094
1173
  [fieldName]: !prev[fieldName]
1095
1174
  }));
1096
1175
  }, []);
1097
- const handleCopy = React7.useCallback(() => {
1176
+ const handleCopy = React2.useCallback(() => {
1098
1177
  if (typeof window !== "undefined" && document) {
1099
1178
  const input = document.getElementById(name);
1100
1179
  if (input) {
@@ -1106,7 +1185,8 @@ var InputField = ({
1106
1185
  const VisibilityIcon = icons?.Visibility;
1107
1186
  const VisibilityOffIcon = icons?.VisibilityOff;
1108
1187
  const CopyIcon = icons?.Copy;
1109
- const inputType = fieldType === "password" ? !showField[name] ? "password" : "text" : fieldType;
1188
+ const usePasswordComponent = isAntD && fieldType === "password" && isVisibleEnable && Password;
1189
+ const inputType = fieldType === "password" && !usePasswordComponent ? !showField[name] ? "password" : "text" : fieldType;
1110
1190
  return /* @__PURE__ */ jsxRuntime.jsxs(
1111
1191
  FieldWrapper,
1112
1192
  {
@@ -1128,14 +1208,47 @@ var InputField = ({
1128
1208
  ),
1129
1209
  desc && /* @__PURE__ */ jsxRuntime.jsx(FieldDescription, { desc }),
1130
1210
  /* @__PURE__ */ jsxRuntime.jsxs(
1131
- "div",
1211
+ Box,
1132
1212
  {
1133
- className: `input-group ${isCopyEnable || isVisibleEnable ? "" : "rounded"}`,
1213
+ sx: isMUI ? {
1214
+ display: "flex",
1215
+ alignItems: "stretch",
1216
+ width: "100%"
1217
+ } : void 0,
1218
+ className: !isMUI ? `input-group ${isCopyEnable || isVisibleEnable ? "" : "rounded"}` : void 0,
1134
1219
  children: [
1135
- /* @__PURE__ */ jsxRuntime.jsx(
1220
+ usePasswordComponent ? /* @__PURE__ */ jsxRuntime.jsx(
1221
+ Password,
1222
+ {
1223
+ className: !isMUI ? `form-control font-14 ${isCopyEnable || customIcon ? "border border-end-0" : "rounded"} ${fieldError && fieldTouched ? "border-danger" : ""}` : void 0,
1224
+ id: name,
1225
+ "data-testid": dataTestId || `${formatString(name)}-input`,
1226
+ ref: inputRef,
1227
+ autoComplete: autocomplete || "new-password",
1228
+ disabled: disabled || false,
1229
+ name,
1230
+ placeholder,
1231
+ value: fieldValue || "",
1232
+ onChange: (event) => {
1233
+ if (customHandleChange) {
1234
+ customHandleChange(event, type);
1235
+ } else if (customFormChange) {
1236
+ customFormChange(event, type);
1237
+ } else {
1238
+ activeFormik.handleChange(event);
1239
+ }
1240
+ },
1241
+ onBlur: onBlur || activeFormik.handleBlur,
1242
+ readOnly: readonly || false,
1243
+ error: !!(fieldError && fieldTouched)
1244
+ }
1245
+ ) : /* @__PURE__ */ jsxRuntime.jsx(
1136
1246
  Input,
1137
1247
  {
1138
- className: `form-control font-14 ${isCopyEnable || isVisibleEnable || customIcon ? "border border-end-0" : "rounded"} ${fieldError && fieldTouched ? "border-danger" : ""}`,
1248
+ className: !isMUI ? `form-control font-14 ${isCopyEnable || isVisibleEnable || customIcon ? "border border-end-0" : "rounded"} ${fieldError && fieldTouched ? "border-danger" : ""}` : void 0,
1249
+ sx: isMUI ? {
1250
+ flex: 1
1251
+ } : void 0,
1139
1252
  id: name,
1140
1253
  "data-testid": dataTestId || `${formatString(name)}-input`,
1141
1254
  ref: inputRef,
@@ -1156,10 +1269,33 @@ var InputField = ({
1156
1269
  },
1157
1270
  onBlur: onBlur || activeFormik.handleBlur,
1158
1271
  readOnly: readonly || false,
1159
- error: !!(fieldError && fieldTouched)
1272
+ error: !!(fieldError && fieldTouched),
1273
+ InputProps: isMUI && isVisibleEnable && VisibilityIcon && VisibilityOffIcon && InputAdornment ? {
1274
+ endAdornment: /* @__PURE__ */ jsxRuntime.jsx(InputAdornment, { position: "end", children: /* @__PURE__ */ jsxRuntime.jsx(
1275
+ IconButton,
1276
+ {
1277
+ "aria-label": showField[name] ? "Hide password" : "Show password",
1278
+ onClick: () => showFieldHandler(name),
1279
+ edge: "end",
1280
+ "data-testid": `${formatString(name)}-visible-btn`,
1281
+ children: !showField[name] ? /* @__PURE__ */ jsxRuntime.jsx(IconRenderer, { Icon: VisibilityOffIcon, size: 20 }) : /* @__PURE__ */ jsxRuntime.jsx(IconRenderer, { Icon: VisibilityIcon, size: 20 })
1282
+ }
1283
+ ) })
1284
+ } : isMUI && isCopyEnable && CopyIcon && InputAdornment ? {
1285
+ endAdornment: /* @__PURE__ */ jsxRuntime.jsx(InputAdornment, { position: "end", children: /* @__PURE__ */ jsxRuntime.jsx(
1286
+ IconButton,
1287
+ {
1288
+ "aria-label": "copy",
1289
+ onClick: handleCopy,
1290
+ edge: "end",
1291
+ "data-testid": `${formatString(name)}-copy-btn`,
1292
+ children: /* @__PURE__ */ jsxRuntime.jsx(IconRenderer, { Icon: CopyIcon, size: 20 })
1293
+ }
1294
+ ) })
1295
+ } : void 0
1160
1296
  }
1161
1297
  ),
1162
- customIcon && /* @__PURE__ */ jsxRuntime.jsx(
1298
+ customIcon && !isMUI && /* @__PURE__ */ jsxRuntime.jsx(
1163
1299
  "div",
1164
1300
  {
1165
1301
  className: `z-0 bg-transparent btn btn-outline-secondary border-0 border-top border-bottom px-3 ${!isCopyEnable && !isVisibleEnable ? "border-end rounded-end" : ""} ${fieldError && fieldTouched ? "border-danger" : ""}`,
@@ -1167,7 +1303,7 @@ var InputField = ({
1167
1303
  children: customIcon
1168
1304
  }
1169
1305
  ),
1170
- isVisibleEnable && VisibilityIcon && VisibilityOffIcon && /* @__PURE__ */ jsxRuntime.jsx(
1306
+ isVisibleEnable && VisibilityIcon && VisibilityOffIcon && !isMUI && !usePasswordComponent && /* @__PURE__ */ jsxRuntime.jsx(
1171
1307
  "button",
1172
1308
  {
1173
1309
  className: `z-0 btn btn-outline-secondary border-0 rounded-0 border-top border-bottom ${!isCopyEnable ? "border-end rounded-end" : ""} ${fieldError && fieldTouched ? "border-danger" : ""}`,
@@ -1177,7 +1313,7 @@ var InputField = ({
1177
1313
  children: !showField[name] ? /* @__PURE__ */ jsxRuntime.jsx(IconRenderer, { Icon: VisibilityOffIcon, size: 16 }) : /* @__PURE__ */ jsxRuntime.jsx(IconRenderer, { Icon: VisibilityIcon, size: 16 })
1178
1314
  }
1179
1315
  ),
1180
- isCopyEnable && CopyIcon && /* @__PURE__ */ jsxRuntime.jsx(
1316
+ isCopyEnable && CopyIcon && !isMUI && /* @__PURE__ */ jsxRuntime.jsx(
1181
1317
  "button",
1182
1318
  {
1183
1319
  className: `z-0 btn btn-outline-secondary border border-start-0 border-end rounded-end ${fieldError && fieldTouched ? "border-danger" : ""}`,
@@ -2068,7 +2204,7 @@ var AsyncSelectField = ({
2068
2204
  const { adapter } = uiLibrary;
2069
2205
  const FormControl = adapter.FormControl;
2070
2206
  const activeFormik = formikProp || formik;
2071
- const [asyncLoading, setAsyncLoading] = React7.useState(false);
2207
+ const [asyncLoading, setAsyncLoading] = React2.useState(false);
2072
2208
  const fieldValue = getFieldValue(activeFormik, name);
2073
2209
  const fieldError = getFieldError(activeFormik, name);
2074
2210
  const fieldTouched = getFieldTouched(activeFormik, name);
@@ -2983,7 +3119,7 @@ var AttributeField = ({
2983
3119
  className: customAttrClass || "d-flex flex-row gap-3 mb-3",
2984
3120
  children: [
2985
3121
  transformedProperties.map((property, propIndex) => {
2986
- return /* @__PURE__ */ jsxRuntime.jsx(React7__default.default.Fragment, { children: renderPropertyField(property, propIndex) }, propIndex);
3122
+ return /* @__PURE__ */ jsxRuntime.jsx(React2__default.default.Fragment, { children: renderPropertyField(property, propIndex) }, propIndex);
2987
3123
  }),
2988
3124
  (minimumValuePresent ? valuesArray.length > 1 : true) && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "col-1 mt-4 pt-1", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: minimumValuePresent ? "mt-0" : "", children: IconButton && DeleteIcon ? /* @__PURE__ */ jsxRuntime.jsx(
2989
3125
  IconButton,
@@ -3057,28 +3193,28 @@ var EditableDivField = ({
3057
3193
  adapter.IconButton;
3058
3194
  const activeFormik = formikProp || formik;
3059
3195
  const { t } = useTranslation();
3060
- const [showPlaceholder, setShowPlaceholder] = React7.useState({});
3061
- const [anchorElEditableDiv, setAnchorElEditableDiv] = React7.useState(null);
3062
- const [activeSpan, setActiveSpan] = React7.useState(null);
3063
- const [prevKey, setPrevKey] = React7.useState("");
3064
- const [isTyping, setIsTyping] = React7.useState(false);
3065
- const editorRefEditableDiv = React7.useRef(null);
3066
- const fieldTimeoutRef = React7.useRef(null);
3067
- const isFieldFocusedRef = React7.useRef(false);
3196
+ const [showPlaceholder, setShowPlaceholder] = React2.useState({});
3197
+ const [anchorElEditableDiv, setAnchorElEditableDiv] = React2.useState(null);
3198
+ const [activeSpan, setActiveSpan] = React2.useState(null);
3199
+ const [prevKey, setPrevKey] = React2.useState("");
3200
+ const [isTyping, setIsTyping] = React2.useState(false);
3201
+ const editorRefEditableDiv = React2.useRef(null);
3202
+ const fieldTimeoutRef = React2.useRef(null);
3203
+ const isFieldFocusedRef = React2.useRef(false);
3068
3204
  getFieldValue(activeFormik, name);
3069
3205
  const fieldError = getFieldError(activeFormik, name);
3070
3206
  const fieldTouched = getFieldTouched(activeFormik, name);
3071
3207
  const CopyIcon = icons?.Copy;
3072
3208
  const VisibilityIcon = icons?.Visibility;
3073
3209
  const VisibilityOffIcon = icons?.VisibilityOff;
3074
- const checkPlaceholderVisibility = React7.useCallback((content, fieldName) => {
3210
+ const checkPlaceholderVisibility = React2.useCallback((content, fieldName) => {
3075
3211
  const isEmpty = !content || content.trim() === "" || content === "\u200B";
3076
3212
  setShowPlaceholder((prev) => ({
3077
3213
  ...prev,
3078
3214
  [fieldName]: isEmpty
3079
3215
  }));
3080
3216
  }, []);
3081
- const setCursorToEnd = React7.useCallback(() => {
3217
+ const setCursorToEnd = React2.useCallback(() => {
3082
3218
  if (editorRefEditableDiv.current) {
3083
3219
  const editor = editorRefEditableDiv.current;
3084
3220
  if (editor.childNodes.length > 0) {
@@ -3096,7 +3232,7 @@ var EditableDivField = ({
3096
3232
  }
3097
3233
  }
3098
3234
  }, []);
3099
- const setEditorContentWithSpans = React7.useCallback((expression, fields) => {
3235
+ const setEditorContentWithSpans = React2.useCallback((expression, fields) => {
3100
3236
  if (!editorRefEditableDiv.current) return;
3101
3237
  const editor = editorRefEditableDiv.current;
3102
3238
  editor.innerHTML = "";
@@ -3123,7 +3259,7 @@ var EditableDivField = ({
3123
3259
  }
3124
3260
  });
3125
3261
  }, [availableFields]);
3126
- const handleKeyDown = React7.useCallback((e) => {
3262
+ const handleKeyDown = React2.useCallback((e) => {
3127
3263
  if (e.key === "{" && prevKey === "{") {
3128
3264
  e.preventDefault();
3129
3265
  return;
@@ -3150,7 +3286,7 @@ var EditableDivField = ({
3150
3286
  }
3151
3287
  }
3152
3288
  }, [prevKey]);
3153
- const handleKeyUp = React7.useCallback((e) => {
3289
+ const handleKeyUp = React2.useCallback((e) => {
3154
3290
  const currentKey = e.key;
3155
3291
  if (currentKey === "{" && prevKey === "{" && !e.defaultPrevented) {
3156
3292
  const selection = window.getSelection();
@@ -3170,7 +3306,7 @@ var EditableDivField = ({
3170
3306
  }
3171
3307
  setPrevKey(currentKey);
3172
3308
  }, [prevKey]);
3173
- const handleFieldSelect = React7.useCallback((item) => {
3309
+ const handleFieldSelect = React2.useCallback((item) => {
3174
3310
  if (!editorRefEditableDiv.current) return;
3175
3311
  const newSpan = document.createElement("span");
3176
3312
  newSpan.className = "field-span";
@@ -3229,7 +3365,7 @@ var EditableDivField = ({
3229
3365
  setCursorToEnd();
3230
3366
  }, 0);
3231
3367
  }, [activeSpan, name, customHandleChange, customFormChange, activeFormik, setCursorToEnd]);
3232
- React7.useEffect(() => {
3368
+ React2.useEffect(() => {
3233
3369
  if (editorRefEditableDiv.current && activeFormik.values && !isTyping && availableFields.length > 0) {
3234
3370
  const fieldValue2 = getNestedProperty(activeFormik.values, name);
3235
3371
  checkPlaceholderVisibility(String(fieldValue2 || ""), name);
@@ -3238,7 +3374,7 @@ var EditableDivField = ({
3238
3374
  }, 0);
3239
3375
  }
3240
3376
  }, [activeFormik.values, name, isTyping, availableFields, checkPlaceholderVisibility, setEditorContentWithSpans]);
3241
- React7.useEffect(() => {
3377
+ React2.useEffect(() => {
3242
3378
  return () => {
3243
3379
  if (fieldTimeoutRef.current) {
3244
3380
  clearTimeout(fieldTimeoutRef.current);
@@ -3506,17 +3642,17 @@ var DynamicForm = ({
3506
3642
  RadiusTab = false,
3507
3643
  uiLibrary
3508
3644
  }) => {
3509
- const [formFields, setFormFields] = React7.useState([]);
3645
+ const [formFields, setFormFields] = React2.useState([]);
3510
3646
  const activeUILibrary = uiLibrary || {
3511
3647
  adapter: defaultAdapter,
3512
3648
  icons: defaultIcons,
3513
3649
  name: "default"
3514
3650
  };
3515
- React7.useEffect(() => {
3651
+ React2.useEffect(() => {
3516
3652
  const newFormFields = fields?.filter((item) => item !== false);
3517
3653
  setFormFields(newFormFields);
3518
3654
  }, [fields]);
3519
- const setFieldValuesRecursive = React7.useCallback(
3655
+ const setFieldValuesRecursive = React2.useCallback(
3520
3656
  (child, parentValue = null) => {
3521
3657
  if (!child) return;
3522
3658
  child.forEach((c) => {
@@ -3564,7 +3700,7 @@ var DynamicForm = ({
3564
3700
  if (field.child && field.child.length > 0) {
3565
3701
  const fieldValue = getFieldValue(formik, field.name);
3566
3702
  const valuePath = getNestedProperty(formik.values, field.name);
3567
- return /* @__PURE__ */ jsxRuntime.jsxs(React7__default.default.Fragment, { children: [
3703
+ return /* @__PURE__ */ jsxRuntime.jsxs(React2__default.default.Fragment, { children: [
3568
3704
  fieldElement,
3569
3705
  field.child.map((childField, childIndex) => {
3570
3706
  const shouldShowChild = fieldValue === childField.hiddenlabel || valuePath === childField.hiddenlabel || field.type === "checkbox" && fieldValue || field.type === "radiobtn" && (fieldValue === childField.targetType || String(fieldValue) === String(childField.targetType)) || field.type === "attribute" && true;
@@ -3595,7 +3731,7 @@ var DynamicForm = ({
3595
3731
  if (attributeFields !== void 0) {
3596
3732
  return /* @__PURE__ */ jsxRuntime.jsx(FormProvider, { uiLibrary: activeUILibrary, formik, children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "row", children: groupFormFieldsIntoRows().map((rowFields, rowIndex) => /* @__PURE__ */ jsxRuntime.jsx("div", { className: "row", children: rowFields.map((fieldValue, index) => {
3597
3733
  const uniqueKey = `${fieldValue?.label || fieldValue?.name}-${index}`;
3598
- return /* @__PURE__ */ jsxRuntime.jsx(React7__default.default.Fragment, { children: renderField(fieldValue, uniqueKey) }, uniqueKey);
3734
+ return /* @__PURE__ */ jsxRuntime.jsx(React2__default.default.Fragment, { children: renderField(fieldValue, uniqueKey) }, uniqueKey);
3599
3735
  }) }, rowIndex)) }) });
3600
3736
  }
3601
3737
  return /* @__PURE__ */ jsxRuntime.jsx(FormProvider, { uiLibrary: activeUILibrary, formik, children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "row mx-0", children: formFields.map((fieldValue, index) => {