conexys-elements 1.1.23 → 1.1.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.js CHANGED
@@ -41,8 +41,11 @@ var Checkboxmui = require('@mui/material/Checkbox');
41
41
  var FormControlLabel = require('@mui/material/FormControlLabel');
42
42
  var reactHookForm = require('react-hook-form');
43
43
  var Button$3 = require('@mui/material/Button');
44
+ var Visibility = require('@mui/icons-material/Visibility');
45
+ var VisibilityOff = require('@mui/icons-material/VisibilityOff');
44
46
  var TextField = require('@mui/material/TextField');
45
47
  var InputLabel = require('@mui/material/InputLabel');
48
+ var InputAdornment = require('@mui/material/InputAdornment');
46
49
  var JoditEditor = require('jodit-react');
47
50
  var Radio = require('@mui/material/Radio');
48
51
  var RadioGroup = require('@mui/material/RadioGroup');
@@ -4188,6 +4191,7 @@ function AppFormFields({
4188
4191
  maxLength: block.maxlength,
4189
4192
  pattern: block.pattern
4190
4193
  },
4194
+ showPasswordToggle: block.showPasswordToggle,
4191
4195
  items: block.items
4192
4196
  }, 'form')), additionalfields1.content.body.map(block => RenderForm({
4193
4197
  component: block.component,
@@ -4211,6 +4215,7 @@ function AppFormFields({
4211
4215
  maxLength: block.maxlength,
4212
4216
  pattern: block.pattern
4213
4217
  },
4218
+ showPasswordToggle: block.showPasswordToggle,
4214
4219
  items: block.items
4215
4220
  }, 'form')), children);
4216
4221
  }
@@ -4285,6 +4290,7 @@ function AppFormFieldsFromConfig({
4285
4290
  maxLength: block.maxlength || block.validate && block.validate.maxLength,
4286
4291
  pattern: block.pattern || block.validate && block.validate.pattern
4287
4292
  },
4293
+ showPasswordToggle: block.showPasswordToggle,
4288
4294
  items: block.items || []
4289
4295
  }, nouser || 'user')));
4290
4296
  }
@@ -4644,6 +4650,7 @@ function AppFormFieldsNoUser({
4644
4650
  maxLength: block.maxlength,
4645
4651
  pattern: block.pattern
4646
4652
  },
4653
+ showPasswordToggle: block.showPasswordToggle,
4647
4654
  items: block.items
4648
4655
  }, 'nouser')), additionalfields1.content.body.map(block => RenderForm({
4649
4656
  component: block.component,
@@ -4667,6 +4674,7 @@ function AppFormFieldsNoUser({
4667
4674
  maxLength: block.maxlength,
4668
4675
  pattern: block.pattern
4669
4676
  },
4677
+ showPasswordToggle: block.showPasswordToggle,
4670
4678
  items: block.items
4671
4679
  }, 'nouser')), children);
4672
4680
  }
@@ -4820,6 +4828,7 @@ function AppFormFieldsTable({
4820
4828
  maxLength: block.maxlength || block.validate && block.validate.maxLength,
4821
4829
  pattern: block.pattern || block.validate && block.validate.pattern
4822
4830
  },
4831
+ showPasswordToggle: block.showPasswordToggle,
4823
4832
  items: block.items || [],
4824
4833
  itemID: id1,
4825
4834
  adminCheck: show === 'admin'
@@ -4851,6 +4860,7 @@ function AppFormFieldsTable({
4851
4860
  maxLength: block.maxlength || block.validate && block.validate.maxLength,
4852
4861
  pattern: block.pattern || block.validate && block.validate.pattern
4853
4862
  },
4863
+ showPasswordToggle: block.showPasswordToggle,
4854
4864
  items: block.items || [],
4855
4865
  itemID: id1,
4856
4866
  adminCheck: show === 'admin'
@@ -10312,6 +10322,11 @@ const FormLogin = ({
10312
10322
  const [trigger1, setTrigger1] = React.useState(0);
10313
10323
  const [trigger2, setTrigger2] = React.useState(0);
10314
10324
  const [isChecked, setIsChecked] = React.useState(false);
10325
+ const showToggle = block.showPasswordToggle === true;
10326
+ const [showPassword, setShowPassword] = React.useState(false);
10327
+ const [showConfirmation, setShowConfirmation] = React.useState(false);
10328
+ const handleTogglePassword = () => setShowPassword(v => !v);
10329
+ const handleToggleConfirmation = () => setShowConfirmation(v => !v);
10315
10330
  const handleChange = () => {
10316
10331
  setIsChecked(current => !current);
10317
10332
  };
@@ -10360,7 +10375,7 @@ const FormLogin = ({
10360
10375
  }, block.label)), /*#__PURE__*/React.createElement("div", {
10361
10376
  className: "input-group"
10362
10377
  }, /*#__PURE__*/React.createElement("input", {
10363
- type: block.type,
10378
+ type: showToggle && showPassword ? 'text' : block.type,
10364
10379
  value: block.value || '',
10365
10380
  name: block.name,
10366
10381
  onChange: block.onChange,
@@ -10370,7 +10385,13 @@ const FormLogin = ({
10370
10385
  className: "input-group-text"
10371
10386
  }, /*#__PURE__*/React.createElement("i", {
10372
10387
  className: "bx bx-lock text-4"
10373
- }))), /*#__PURE__*/React.createElement(reactRouterDom.NavLink, {
10388
+ })), showToggle && (/*#__PURE__*/React.createElement("button", {
10389
+ type: "button",
10390
+ className: "input-group-text password-toggle-btn",
10391
+ onClick: handleTogglePassword,
10392
+ "aria-label": t('System.show_password'),
10393
+ tabIndex: -1
10394
+ }, showPassword ? /*#__PURE__*/React.createElement(VisibilityOff, null) : /*#__PURE__*/React.createElement(Visibility, null)))), /*#__PURE__*/React.createElement(reactRouterDom.NavLink, {
10374
10395
  to: forgot_passworddir,
10375
10396
  className: "float-end"
10376
10397
  }, t('login.recover_password')));
@@ -10474,15 +10495,23 @@ const FormLogin = ({
10474
10495
  className: "col-sm-6 mb-3"
10475
10496
  }, /*#__PURE__*/React.createElement("label", null, labels[1]), /*#__PURE__*/React.createElement("span", {
10476
10497
  className: "required"
10477
- }, "*"), /*#__PURE__*/React.createElement("input", {
10498
+ }, "*"), /*#__PURE__*/React.createElement("div", {
10499
+ className: "input-group"
10500
+ }, /*#__PURE__*/React.createElement("input", {
10478
10501
  id: ids[1],
10479
- type: "password",
10502
+ type: showToggle && showPassword ? 'text' : 'password',
10480
10503
  className: errors.password ? 'form-control form-control-lg is-invalid' : 'form-control form-control-lg',
10481
10504
  ...register('password', {
10482
10505
  required: true,
10483
10506
  minLength: 5
10484
10507
  })
10485
- }), errors.password?.type === 'required' && (/*#__PURE__*/React.createElement("em", {
10508
+ }), showToggle && (/*#__PURE__*/React.createElement("button", {
10509
+ type: "button",
10510
+ className: "input-group-text password-toggle-btn",
10511
+ onClick: handleTogglePassword,
10512
+ "aria-label": t('System.show_password'),
10513
+ tabIndex: -1
10514
+ }, showPassword ? /*#__PURE__*/React.createElement(VisibilityOff, null) : /*#__PURE__*/React.createElement(Visibility, null)))), errors.password?.type === 'required' && (/*#__PURE__*/React.createElement("em", {
10486
10515
  className: "error invalid-feedback"
10487
10516
  }, t('error.please_enter_password'))), errors.password?.type === 'minLength' && (/*#__PURE__*/React.createElement("em", {
10488
10517
  className: "error invalid-feedback"
@@ -10490,16 +10519,24 @@ const FormLogin = ({
10490
10519
  className: "col-sm-6 mb-3"
10491
10520
  }, /*#__PURE__*/React.createElement("label", null, labels[2]), /*#__PURE__*/React.createElement("span", {
10492
10521
  className: "required"
10493
- }, "*"), /*#__PURE__*/React.createElement("input", {
10522
+ }, "*"), /*#__PURE__*/React.createElement("div", {
10523
+ className: "input-group"
10524
+ }, /*#__PURE__*/React.createElement("input", {
10494
10525
  id: ids[2],
10495
- type: "password",
10526
+ type: showToggle && showConfirmation ? 'text' : 'password',
10496
10527
  className: errors.password_confirmation ? 'form-control form-control-lg is-invalid' : 'form-control form-control-lg',
10497
10528
  ...register('password_confirmation', {
10498
10529
  required: true,
10499
10530
  minLength: 5,
10500
10531
  validate: value => value === password.current || t('error.passwords_do_not_match')
10501
10532
  })
10502
- }), errors.password_confirmation?.type === 'required' && (/*#__PURE__*/React.createElement("em", {
10533
+ }), showToggle && (/*#__PURE__*/React.createElement("button", {
10534
+ type: "button",
10535
+ className: "input-group-text password-toggle-btn",
10536
+ onClick: handleToggleConfirmation,
10537
+ "aria-label": t('System.show_password'),
10538
+ tabIndex: -1
10539
+ }, showConfirmation ? /*#__PURE__*/React.createElement(VisibilityOff, null) : /*#__PURE__*/React.createElement(Visibility, null)))), errors.password_confirmation?.type === 'required' && (/*#__PURE__*/React.createElement("em", {
10503
10540
  className: "error invalid-feedback"
10504
10541
  }, t('error.repeat_password'))), errors.password_confirmation?.type === 'minLength' && (/*#__PURE__*/React.createElement("em", {
10505
10542
  className: "error invalid-feedback"
@@ -10783,6 +10820,11 @@ const InputPassword = ({
10783
10820
  inParagraph = false
10784
10821
  }) => {
10785
10822
  const [t] = reactI18next.useTranslation('global');
10823
+ const showToggle = block.showPasswordToggle === true;
10824
+ const [showPassword, setShowPassword] = React.useState(false);
10825
+ const [showConfirmation, setShowConfirmation] = React.useState(false);
10826
+ const handleTogglePassword = () => setShowPassword(v => !v);
10827
+ const handleToggleConfirmation = () => setShowConfirmation(v => !v);
10786
10828
  const {
10787
10829
  register,
10788
10830
  formState: {
@@ -10816,7 +10858,7 @@ const InputPassword = ({
10816
10858
  }, block.label, block.validate.required && /*#__PURE__*/React.createElement("span", {
10817
10859
  className: "required"
10818
10860
  }, "*")), /*#__PURE__*/React.createElement("input", {
10819
- type: "password",
10861
+ type: showToggle && showPassword ? 'text' : 'password',
10820
10862
  id: block.id,
10821
10863
  className: errors.password ? `${block.className} is-invalid` : block.className,
10822
10864
  ...register(block.name, {
@@ -10825,7 +10867,13 @@ const InputPassword = ({
10825
10867
  maxLength: block.validate.maxLength
10826
10868
  }),
10827
10869
  required: true
10828
- }), errors.password && (/*#__PURE__*/React.createElement("span", {
10870
+ }), showToggle && (/*#__PURE__*/React.createElement("button", {
10871
+ type: "button",
10872
+ className: "password-toggle-btn",
10873
+ onClick: handleTogglePassword,
10874
+ "aria-label": t('System.show_password'),
10875
+ tabIndex: -1
10876
+ }, showPassword ? /*#__PURE__*/React.createElement(VisibilityOff, null) : /*#__PURE__*/React.createElement(Visibility, null))), errors.password && (/*#__PURE__*/React.createElement("span", {
10829
10877
  className: "error invalid-feedback"
10830
10878
  }, errors.password.type === 'required' && t('error.please_enter_password'), errors.password.type === 'minLength' && `${t('error.password_minimum')} ${block.validate.minLength} ${t('characters')}`, errors.password.type === 'maxLength' && `${t('error.password_maximum')} ${block.validate.maxLength} ${t('characters')}`)))) : (/*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(InputLabel, {
10831
10879
  htmlFor: block.id
@@ -10835,7 +10883,7 @@ const InputPassword = ({
10835
10883
  hiddenLabel: true,
10836
10884
  size: "small",
10837
10885
  id: block.id,
10838
- type: "password",
10886
+ type: showToggle && showPassword ? 'text' : 'password',
10839
10887
  value: resetvalue,
10840
10888
  className: errors.password ? `${block.className} is-invalid` : block.className,
10841
10889
  ...register(block.name, {
@@ -10843,7 +10891,19 @@ const InputPassword = ({
10843
10891
  minLength: block.validate.minLength,
10844
10892
  maxLength: block.validate.maxLength
10845
10893
  }),
10846
- required: true
10894
+ required: true,
10895
+ slotProps: showToggle ? {
10896
+ input: {
10897
+ endAdornment: (/*#__PURE__*/React.createElement(InputAdornment, {
10898
+ position: "end"
10899
+ }, /*#__PURE__*/React.createElement(IconButton, {
10900
+ "aria-label": t('System.show_password'),
10901
+ onClick: handleTogglePassword,
10902
+ edge: "end",
10903
+ tabIndex: -1
10904
+ }, showPassword ? /*#__PURE__*/React.createElement(VisibilityOff, null) : /*#__PURE__*/React.createElement(Visibility, null))))
10905
+ }
10906
+ } : undefined
10847
10907
  }), errors.password?.type === 'required' && (/*#__PURE__*/React.createElement("em", {
10848
10908
  className: "error invalid-feedback"
10849
10909
  }, t('error.please_enter_password'))), errors.password?.type === 'minLength' && (/*#__PURE__*/React.createElement("em", {
@@ -10857,7 +10917,7 @@ const InputPassword = ({
10857
10917
  }, t('System.repeat'), " ", block.label, block.validate.required && /*#__PURE__*/React.createElement("span", {
10858
10918
  className: "required"
10859
10919
  }, "*")), /*#__PURE__*/React.createElement("input", {
10860
- type: "password",
10920
+ type: showToggle && showConfirmation ? 'text' : 'password',
10861
10921
  id: block.id + 100,
10862
10922
  className: errors.password_confirmation ? `${block.className} is-invalid` : block.className,
10863
10923
  ...register(`${block.name}_confirmation`, {
@@ -10867,7 +10927,13 @@ const InputPassword = ({
10867
10927
  validate: value => value === password.current || t('error.passwords_do_not_match')
10868
10928
  }),
10869
10929
  required: true
10870
- }), errors.password_confirmation && (/*#__PURE__*/React.createElement("span", {
10930
+ }), showToggle && (/*#__PURE__*/React.createElement("button", {
10931
+ type: "button",
10932
+ className: "password-toggle-btn",
10933
+ onClick: handleToggleConfirmation,
10934
+ "aria-label": t('System.show_password'),
10935
+ tabIndex: -1
10936
+ }, showConfirmation ? /*#__PURE__*/React.createElement(VisibilityOff, null) : /*#__PURE__*/React.createElement(Visibility, null))), errors.password_confirmation && (/*#__PURE__*/React.createElement("span", {
10871
10937
  className: "error invalid-feedback"
10872
10938
  }, errors.password_confirmation.type === 'required' && t('error.repeat_password'), errors.password_confirmation.type === 'minLength' && `${t('error.password_minimum')} ${block.validate.minLength} ${t('characters')}`, errors.password_confirmation.type === 'maxLength' && `${t('error.password_maximum')} ${block.validate.maxLength} ${t('characters')}`, errors.password_confirmation.type === 'validate' && t('error.password_not_match'))))) : (/*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(InputLabel, {
10873
10939
  htmlFor: block.id + 100
@@ -10877,7 +10943,7 @@ const InputPassword = ({
10877
10943
  hiddenLabel: true,
10878
10944
  size: "small",
10879
10945
  id: block.id + 100,
10880
- type: "password",
10946
+ type: showToggle && showConfirmation ? 'text' : 'password',
10881
10947
  value: resetvalue,
10882
10948
  className: errors.password_confirmation ? `${block.className} is-invalid` : block.className,
10883
10949
  ...register(`${block.name}_confirmation`, {
@@ -10886,7 +10952,19 @@ const InputPassword = ({
10886
10952
  maxLength: block.validate.maxLength,
10887
10953
  validate: value => value === password.current || t('error.passwords_do_not_match')
10888
10954
  }),
10889
- required: true
10955
+ required: true,
10956
+ slotProps: showToggle ? {
10957
+ input: {
10958
+ endAdornment: (/*#__PURE__*/React.createElement(InputAdornment, {
10959
+ position: "end"
10960
+ }, /*#__PURE__*/React.createElement(IconButton, {
10961
+ "aria-label": t('System.show_password'),
10962
+ onClick: handleToggleConfirmation,
10963
+ edge: "end",
10964
+ tabIndex: -1
10965
+ }, showConfirmation ? /*#__PURE__*/React.createElement(VisibilityOff, null) : /*#__PURE__*/React.createElement(Visibility, null))))
10966
+ }
10967
+ } : undefined
10890
10968
  }), errors.password_confirmation?.type === 'required' && (/*#__PURE__*/React.createElement("em", {
10891
10969
  className: "error invalid-feedback"
10892
10970
  }, t('error.repeat_password'))), errors.password_confirmation?.type === 'minLength' && (/*#__PURE__*/React.createElement("em", {
@@ -11039,6 +11117,9 @@ const InputText = /*#__PURE__*/React.memo(({
11039
11117
  const [t] = reactI18next.useTranslation('global');
11040
11118
  const [errors, setError] = React.useState(false);
11041
11119
  const [texterror, setTextError] = React.useState('');
11120
+ const showToggle = block.showPasswordToggle === true;
11121
+ const [showPassword, setShowPassword] = React.useState(false);
11122
+ const handleTogglePassword = () => setShowPassword(v => !v);
11042
11123
  const handleInputBlur = React.useCallback(async event => {
11043
11124
  const session = authStorage.getSessionId(configLogs) || '';
11044
11125
  const value = event.target.value;
@@ -11130,14 +11211,26 @@ const InputText = /*#__PURE__*/React.memo(({
11130
11211
  size: "small",
11131
11212
  name: block.name,
11132
11213
  id: block.id,
11133
- type: block.type,
11214
+ type: showToggle && showPassword ? 'text' : block.type,
11134
11215
  placeholder: block.placeholder,
11135
11216
  value: block.value || '',
11136
11217
  onChange: block.onChange,
11137
11218
  onBlur: handleInputBlur,
11138
11219
  autoComplete: block.autocomplete,
11139
11220
  className: errors ? `${block.className} is-invalid` : block.className,
11140
- required: block.validate.required
11221
+ required: block.validate.required,
11222
+ slotProps: showToggle ? {
11223
+ input: {
11224
+ endAdornment: (/*#__PURE__*/React.createElement(InputAdornment, {
11225
+ position: "end"
11226
+ }, /*#__PURE__*/React.createElement(IconButton, {
11227
+ "aria-label": t('System.show_password'),
11228
+ onClick: handleTogglePassword,
11229
+ edge: "end",
11230
+ tabIndex: -1
11231
+ }, showPassword ? /*#__PURE__*/React.createElement(VisibilityOff, null) : /*#__PURE__*/React.createElement(Visibility, null))))
11232
+ }
11233
+ } : undefined
11141
11234
  }));
11142
11235
  if (block.style === 'login') {
11143
11236
  return /*#__PURE__*/React.createElement("div", {