@itcase/forms 1.0.78 → 1.0.79

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.
@@ -1,15 +1,16 @@
1
1
  .form {
2
2
  &__group {
3
3
  width: 100%;
4
+ padding: var(--form-group-padding, 0);
4
5
  margin: 0 0 12px 0;
5
6
  &_hidden {
6
- visibility: hidden;
7
- display: none;
8
7
  position: absolute;
8
+ display: none;
9
+ visibility: hidden;
9
10
  z-index: -1;
10
11
  }
11
12
  &_type_row.&_hidden {
12
- visibility: hidden
13
+ visibility: hidden;
13
14
  }
14
15
  &-wrapper {
15
16
  display: flex;
@@ -31,5 +32,4 @@
31
32
  }
32
33
  }
33
34
  }
34
-
35
35
  }
@@ -0,0 +1,45 @@
1
+ .form {
2
+ &-maskedInput {
3
+ position: relative;
4
+ &&_state {
5
+ &_success {
6
+ & .input {
7
+ border: solid 1px var(--input-success-border, green);
8
+ &:hover {
9
+ border: solid 1px var(--input-success-border-hover);
10
+ }
11
+ }
12
+ }
13
+ &_disabled {
14
+ & .input {
15
+ background: var(--input-disabled-background, #ececec);
16
+ border: solid 1px var(--input-disabled-border, #747474);
17
+ &:hover {
18
+ background: var(--input-disabled-background, #ececec);
19
+ border: solid 1px var(--input-disabled-border, #747474);
20
+ }
21
+ }
22
+ }
23
+
24
+ &_error {
25
+ & .input {
26
+ border: solid 1px var(--input-error-border);
27
+ }
28
+ }
29
+ &_focus {
30
+ & .input {
31
+ background: var(--input-focus-background);
32
+ border: solid 1px var(--input-focus-border);
33
+ }
34
+ }
35
+ }
36
+ }
37
+ }
38
+
39
+ :root {
40
+ --input-success-border: var(--color-success-border-primary);
41
+ --input-success-border-hover: var(--color-surface-border-quaternary);
42
+ --input-error-border: var(--color-error-border-primary);
43
+ --input-focus-background: var(--color-surface-primary);
44
+ --input-focus-border: var(--color-surface-border-quaternary);
45
+ }
@@ -12,6 +12,7 @@
12
12
  &-item {
13
13
  height: var(--form-field-helptext-height, 20px);
14
14
  line-height: var(--form-field-helptext-line-height, 20px);
15
+ padding: var(--form-field-helptext-padding, 0);
15
16
  display: block;
16
17
  }
17
18
  }
@@ -37,10 +38,10 @@
37
38
 
38
39
  .form {
39
40
  &^&-field_type_float {
41
+ padding: var(--form-field_type_float-padding);
42
+ margin: var(--form-field_type_float-margin);
40
43
  position: relative;
41
44
  gap: var(--form-field_type_float-gap);
42
- margin: var(--form-field_type_float-margin);
43
- padding: var(--form-field_type_float-padding);
44
45
  &^&__item_state_focus,
45
46
  &^&__item_state_filled {
46
47
  & .form {
@@ -59,26 +60,26 @@
59
60
  & .form {
60
61
  &-field {
61
62
  &__label {
62
- pointer-events: none;
63
+ background: var(--color-surface-primary);
64
+ padding: 0 4px;
63
65
  position: absolute;
64
66
  display: flex;
65
67
  top: 0;
66
68
  z-index: 2;
67
69
  transform: scale(1) translate(8px, 20px);
68
70
  transition: all 150ms cubic-bezier(0.4, 0, 0.2, 1);
71
+ pointer-events: none;
69
72
  transform-origin: top left;
70
- background: var(--color-surface-primary);
71
- padding: 0 4px;
72
73
  }
73
74
  &__message {
74
- padding: 0 0 0 12px;
75
+ padding: var(--form-field-type-float-message-padding, 0 0 0 12px);
75
76
  }
76
77
  }
77
78
  }
78
79
  & .input {
79
80
  &::placeholder {
80
- opacity: 0%;
81
81
  transition: all 150ms cubic-bezier(0.4, 0, 0.2, 1);
82
+ opacity: 0%;
82
83
  }
83
84
  }
84
85
  }
@@ -14,6 +14,7 @@ var useStyles = require('@itcase/ui/hooks/useStyles');
14
14
  var camelCase = require('lodash/camelCase');
15
15
  var snakeCase = require('lodash/snakeCase');
16
16
  var Choice = require('@itcase/ui/components/Choice');
17
+ var Icon = require('@itcase/ui/components/Icon');
17
18
  var Code = require('@itcase/ui/components/Code');
18
19
  var DatePicker = require('@itcase/ui/components/DatePicker');
19
20
  var axios = require('axios');
@@ -23,7 +24,6 @@ var reactDropzone = require('react-dropzone');
23
24
  var common = require('@itcase/common');
24
25
  var Loader = require('@itcase/ui/components/Loader');
25
26
  var Title = require('@itcase/ui/components/Title');
26
- var Icon = require('@itcase/ui/components/Icon');
27
27
  var Input = require('@itcase/ui/components/Input');
28
28
  var Radio = require('@itcase/ui/components/Radio');
29
29
  var Segmented = require('@itcase/ui/components/Segmented');
@@ -126,11 +126,17 @@ function useYupValidationSchema(schema, language) {
126
126
 
127
127
  function FieldWrapperBase(props) {
128
128
  const {
129
+ id,
130
+ children,
131
+ isDisabled,
132
+ isErrorState,
133
+ isHidden,
134
+ isRequired,
135
+ isValidState,
129
136
  after,
130
137
  afterItem,
131
138
  before,
132
139
  beforeItem,
133
- children,
134
140
  className,
135
141
  dataTour,
136
142
  desc,
@@ -141,13 +147,17 @@ function FieldWrapperBase(props) {
141
147
  dividerFill,
142
148
  dividerSize,
143
149
  dividerWidth,
150
+ errorKey,
151
+ errorMessage,
144
152
  fieldClassName,
145
- id,
153
+ helpText,
154
+ helpTextColor,
155
+ helpTextColorSuccess,
156
+ helpTextSize,
157
+ helpTextSizeMobile,
158
+ helpTextWeight,
146
159
  inputName,
147
160
  inputValue,
148
- isDisabled,
149
- isHidden,
150
- isRequired,
151
161
  label,
152
162
  labelHidden,
153
163
  labelTextColor,
@@ -155,21 +165,12 @@ function FieldWrapperBase(props) {
155
165
  labelTextSizeMobile,
156
166
  labelTextSizeTablet,
157
167
  labelTextWeight,
158
- helpText,
159
- helpTextSize,
160
- helpTextSizeMobile,
161
- helpTextWeight,
162
- helpTextColor,
163
- isErrorState,
164
- isValidState,
165
- errorMessage,
166
168
  messageTextSize,
167
169
  metaActive,
168
170
  metaError,
169
171
  set,
170
172
  showDivider,
171
173
  showMessage,
172
- errorKey,
173
174
  tag: Tag,
174
175
  type
175
176
  } = props;
@@ -241,10 +242,10 @@ function FieldWrapperBase(props) {
241
242
  className: clsx__default.default('form-field__content-inner', fieldClass)
242
243
  }, beforeItem, children, afterItem), showDivider && /*#__PURE__*/React__default.default.createElement(Divider.Divider, {
243
244
  className: "form-field__item-divider",
244
- direction: dividerDirection,
245
+ width: dividerWidth,
245
246
  fill: dividerFill,
246
- size: dividerSize,
247
- width: dividerWidth
247
+ direction: dividerDirection,
248
+ size: dividerSize
248
249
  })), showMessage && /*#__PURE__*/React__default.default.createElement("div", {
249
250
  className: "form-field__message",
250
251
  "data-test-id": `${inputName}FieldMessage`
@@ -260,7 +261,7 @@ function FieldWrapperBase(props) {
260
261
  dataTestId: `${inputName}FieldMessageHelpText`,
261
262
  size: helpTextSize,
262
263
  sizeMobile: helpTextSizeMobile,
263
- textColor: helpTextColor,
264
+ textColor: isValidState ? helpTextColorSuccess : helpTextColor,
264
265
  textWeight: helpTextWeight
265
266
  }, helpText), (!isErrorState && !helpText || isErrorState && !helpText && !errorMessage) && /*#__PURE__*/React__default.default.createElement(Text.Text, {
266
267
  className: "form-field__message-item form-field__message-item_type_help-text",
@@ -269,20 +270,24 @@ function FieldWrapperBase(props) {
269
270
  }, '\u00A0')), after);
270
271
  }
271
272
  FieldWrapperBase.defaultProps = {
272
- requiredMessageTextSize: 's',
273
- requiredMessageTextColor: 'warningTextPrimary',
274
- errorMessageTextSize: 's',
275
273
  errorMessageTextColor: 'errorTextPrimary',
274
+ errorMessageTextSize: 's',
275
+ requiredMessageTextColor: 'warningTextPrimary',
276
+ requiredMessageTextSize: 's',
276
277
  tag: 'div',
277
278
  type: 'normal'
278
279
  };
279
280
  FieldWrapperBase.propTypes = {
281
+ id: PropTypes__default.default.string,
282
+ children: PropTypes__default.default.any,
283
+ isDisabled: PropTypes__default.default.bool,
284
+ isHidden: PropTypes__default.default.bool,
285
+ isRequired: PropTypes__default.default.bool,
280
286
  after: PropTypes__default.default.any,
281
287
  afterItem: PropTypes__default.default.any,
282
288
  autoComplete: PropTypes__default.default.string,
283
289
  before: PropTypes__default.default.any,
284
290
  beforeItem: PropTypes__default.default.any,
285
- children: PropTypes__default.default.any,
286
291
  className: PropTypes__default.default.string,
287
292
  dataTour: PropTypes__default.default.string,
288
293
  desc: PropTypes__default.default.string,
@@ -294,15 +299,11 @@ FieldWrapperBase.propTypes = {
294
299
  dividerSize: PropTypes__default.default.string,
295
300
  dividerWidth: PropTypes__default.default.string,
296
301
  fieldClassName: PropTypes__default.default.string,
297
- id: PropTypes__default.default.string,
298
302
  inputName: PropTypes__default.default.string,
299
303
  inputOnBlur: PropTypes__default.default.func,
300
304
  inputOnChange: PropTypes__default.default.func,
301
305
  inputOnFocus: PropTypes__default.default.func,
302
306
  inputValue: PropTypes__default.default.any,
303
- isDisabled: PropTypes__default.default.bool,
304
- isHidden: PropTypes__default.default.bool,
305
- isRequired: PropTypes__default.default.bool,
306
307
  itemType: PropTypes__default.default.string,
307
308
  label: PropTypes__default.default.any,
308
309
  labelHidden: PropTypes__default.default.bool,
@@ -659,7 +660,13 @@ const CustomField = /*#__PURE__*/React__default.default.memo(function CustomFiel
659
660
  initialValue,
660
661
  fieldProps,
661
662
  classNameGroupItem,
662
- showMessage
663
+ showMessage,
664
+ clearIcon,
665
+ clearIconFill,
666
+ clearIconFillHover,
667
+ clearIconShape,
668
+ clearIconSize,
669
+ onClickClearIcon
663
670
  } = props;
664
671
  return /*#__PURE__*/React__default.default.createElement(reactFinalForm.Field, {
665
672
  initialValue: initialValue,
@@ -708,7 +715,16 @@ const CustomField = /*#__PURE__*/React__default.default.memo(function CustomFiel
708
715
  input: input,
709
716
  isDisabled: isDisabled,
710
717
  meta: meta
711
- })));
718
+ })), clearIcon && /*#__PURE__*/React__default.default.createElement(Icon.Icon, {
719
+ className: "form-field__icon",
720
+ iconFill: clearIconFill,
721
+ iconFillHover: clearIconFillHover,
722
+ imageSrc: clearIcon,
723
+ shape: clearIconShape,
724
+ size: clearIconSize,
725
+ SvgImage: clearIcon,
726
+ onClick: onClickClearIcon
727
+ }));
712
728
  });
713
729
  });
714
730
  CustomField.defaultProps = {
@@ -1567,6 +1583,14 @@ const InputField = /*#__PURE__*/React__default.default.memo(function InputField(
1567
1583
  isRequired,
1568
1584
  isRevealable,
1569
1585
  classNameGroupItem,
1586
+ // dataTestId,
1587
+ // iconBorder,
1588
+ // iconBorderHover,
1589
+ clearIcon,
1590
+ clearIconFill,
1591
+ clearIconFillHover,
1592
+ clearIconShape,
1593
+ clearIconSize,
1570
1594
  fieldProps,
1571
1595
  iconFill,
1572
1596
  iconFillHover,
@@ -1579,10 +1603,8 @@ const InputField = /*#__PURE__*/React__default.default.memo(function InputField(
1579
1603
  name,
1580
1604
  parse,
1581
1605
  showMessage,
1582
- onChange
1583
- // dataTestId,
1584
- // iconBorder,
1585
- // iconBorderHover,
1606
+ onChange,
1607
+ onClickClearIcon
1586
1608
  } = props;
1587
1609
  const [isRevealed, setIsRevealed] = React.useState(false);
1588
1610
  const inputType = React.useMemo(() => {
@@ -1665,6 +1687,15 @@ const InputField = /*#__PURE__*/React__default.default.memo(function InputField(
1665
1687
  size: iconSize,
1666
1688
  SvgImage: isRevealed ? iconRevealableHide : iconRevealableShow,
1667
1689
  onClick: onClickIconReveal
1690
+ }), clearIcon && /*#__PURE__*/React__default.default.createElement(Icon.Icon, {
1691
+ className: "form-field__icon",
1692
+ iconFill: clearIconFill,
1693
+ iconFillHover: clearIconFillHover,
1694
+ imageSrc: clearIcon,
1695
+ shape: clearIconShape,
1696
+ size: clearIconSize,
1697
+ SvgImage: clearIcon,
1698
+ onClick: onClickClearIcon
1668
1699
  }));
1669
1700
  });
1670
1701
  });
@@ -2032,7 +2063,7 @@ const SelectField = /*#__PURE__*/React__default.default.memo(function SelectFiel
2032
2063
  fieldProps,
2033
2064
  initialValue,
2034
2065
  name,
2035
- options,
2066
+ options = [],
2036
2067
  selectProps,
2037
2068
  selectRef,
2038
2069
  showMessage,
@@ -2057,8 +2088,8 @@ const SelectField = /*#__PURE__*/React__default.default.memo(function SelectFiel
2057
2088
  const optionsValues = getDefaultValue(options, input.value);
2058
2089
  if (!optionsValues.length && input.value?.length) {
2059
2090
  optionsValues.push({
2060
- value: input.value,
2061
- label: input.value
2091
+ label: input.value,
2092
+ value: input.value
2062
2093
  });
2063
2094
  }
2064
2095
  return optionsValues;
@@ -2088,8 +2119,8 @@ const SelectField = /*#__PURE__*/React__default.default.memo(function SelectFiel
2088
2119
  meta: meta
2089
2120
  });
2090
2121
  const updatedSelectProps = useValidationAppearanceInputProps({
2091
- validationStateKey: isErrorState ? errorKey : 'success',
2092
- inputProps: selectProps
2122
+ inputProps: selectProps,
2123
+ validationStateKey: isErrorState ? errorKey : 'success'
2093
2124
  });
2094
2125
  return /*#__PURE__*/React__default.default.createElement(FieldWrapper, Object.assign({
2095
2126
  className: clsx__default.default('form-field_type_select', 'form__item_type_select', classNameGroupItem),
@@ -2098,33 +2129,33 @@ const SelectField = /*#__PURE__*/React__default.default.memo(function SelectFiel
2098
2129
  fieldClassName: 'form-select',
2099
2130
  inputName: input.name,
2100
2131
  inputValue: input.value,
2132
+ metaActive: meta.active,
2133
+ metaError: meta.error,
2134
+ showMessage: showMessage,
2101
2135
  isDisabled: isDisabled,
2102
2136
  isErrorState: isErrorState,
2103
2137
  isRequired: isRequired,
2104
- isValidState: isValidState,
2105
- metaActive: meta.active,
2106
- metaError: meta.error,
2107
- showMessage: showMessage
2138
+ isValidState: isValidState
2108
2139
  }, fieldProps), /*#__PURE__*/React__default.default.createElement(Select.Select, Object.assign({
2109
2140
  className: "form-select-item",
2141
+ ref: selectRef,
2110
2142
  instanceId: `id_${input.name}`,
2111
- isDisabled: isDisabled,
2112
2143
  options: options,
2113
- ref: selectRef,
2114
2144
  value: selectedOptions,
2145
+ isDisabled: isDisabled,
2115
2146
  onChange: onChangeValue,
2116
2147
  onInputChange: onInputChange
2117
2148
  }, updatedSelectProps)));
2118
2149
  });
2119
2150
  });
2120
2151
  SelectField.propTypes = {
2121
- name: PropTypes__default.default.string.isRequired,
2122
- classNameGroupItem: PropTypes__default.default.string,
2123
- fieldProps: PropTypes__default.default.object,
2124
2152
  isDisabled: PropTypes__default.default.bool,
2125
2153
  isRequired: PropTypes__default.default.bool,
2154
+ classNameGroupItem: PropTypes__default.default.string,
2155
+ fieldProps: PropTypes__default.default.object,
2126
2156
  label: PropTypes__default.default.any,
2127
2157
  messageType: PropTypes__default.default.string,
2158
+ name: PropTypes__default.default.string.isRequired,
2128
2159
  options: PropTypes__default.default.array,
2129
2160
  selectProps: PropTypes__default.default.object,
2130
2161
  selectRef: PropTypes__default.default.any,
@@ -2306,7 +2337,13 @@ const MaskedInputField = /*#__PURE__*/React__default.default.memo(function Maske
2306
2337
  showMessage,
2307
2338
  inputProps,
2308
2339
  optionsMask,
2309
- unmasked
2340
+ unmasked,
2341
+ clearIcon,
2342
+ clearIconFill,
2343
+ clearIconFillHover,
2344
+ clearIconShape,
2345
+ clearIconSize,
2346
+ onClickClearIcon
2310
2347
  } = props;
2311
2348
  return /*#__PURE__*/React__default.default.createElement(reactFinalForm.Field, {
2312
2349
  initialValue: initialValue,
@@ -2373,7 +2410,16 @@ const MaskedInputField = /*#__PURE__*/React__default.default.memo(function Maske
2373
2410
  value: value,
2374
2411
  onBlur: input.onBlur,
2375
2412
  onFocus: input.onFocus
2376
- }, updatedInputProps)));
2413
+ }, updatedInputProps)), clearIcon && /*#__PURE__*/React__default.default.createElement(Icon.Icon, {
2414
+ className: "form-field__icon",
2415
+ iconFill: clearIconFill,
2416
+ iconFillHover: clearIconFillHover,
2417
+ imageSrc: clearIcon,
2418
+ shape: clearIconShape,
2419
+ size: clearIconSize,
2420
+ SvgImage: clearIcon,
2421
+ onClick: onClickClearIcon
2422
+ }));
2377
2423
  });
2378
2424
  });
2379
2425
  MaskedInputField.defaultProps = {
@@ -13,6 +13,7 @@ import { useStyles } from '@itcase/ui/hooks/useStyles';
13
13
  import camelCase from 'lodash/camelCase';
14
14
  import snakeCase from 'lodash/snakeCase';
15
15
  import { Choice } from '@itcase/ui/components/Choice';
16
+ import { Icon } from '@itcase/ui/components/Icon';
16
17
  import { Code } from '@itcase/ui/components/Code';
17
18
  import { DatePickerInput } from '@itcase/ui/components/DatePicker';
18
19
  import axios from 'axios';
@@ -22,7 +23,6 @@ import { useDropzone, ErrorCode } from 'react-dropzone';
22
23
  import { createFileFromDataURL } from '@itcase/common';
23
24
  import { Loader } from '@itcase/ui/components/Loader';
24
25
  import { Title } from '@itcase/ui/components/Title';
25
- import { Icon } from '@itcase/ui/components/Icon';
26
26
  import { Input } from '@itcase/ui/components/Input';
27
27
  import { Radio } from '@itcase/ui/components/Radio';
28
28
  import { Segmented } from '@itcase/ui/components/Segmented';
@@ -114,11 +114,17 @@ function useYupValidationSchema(schema, language) {
114
114
 
115
115
  function FieldWrapperBase(props) {
116
116
  const {
117
+ id,
118
+ children,
119
+ isDisabled,
120
+ isErrorState,
121
+ isHidden,
122
+ isRequired,
123
+ isValidState,
117
124
  after,
118
125
  afterItem,
119
126
  before,
120
127
  beforeItem,
121
- children,
122
128
  className,
123
129
  dataTour,
124
130
  desc,
@@ -129,13 +135,17 @@ function FieldWrapperBase(props) {
129
135
  dividerFill,
130
136
  dividerSize,
131
137
  dividerWidth,
138
+ errorKey,
139
+ errorMessage,
132
140
  fieldClassName,
133
- id,
141
+ helpText,
142
+ helpTextColor,
143
+ helpTextColorSuccess,
144
+ helpTextSize,
145
+ helpTextSizeMobile,
146
+ helpTextWeight,
134
147
  inputName,
135
148
  inputValue,
136
- isDisabled,
137
- isHidden,
138
- isRequired,
139
149
  label,
140
150
  labelHidden,
141
151
  labelTextColor,
@@ -143,21 +153,12 @@ function FieldWrapperBase(props) {
143
153
  labelTextSizeMobile,
144
154
  labelTextSizeTablet,
145
155
  labelTextWeight,
146
- helpText,
147
- helpTextSize,
148
- helpTextSizeMobile,
149
- helpTextWeight,
150
- helpTextColor,
151
- isErrorState,
152
- isValidState,
153
- errorMessage,
154
156
  messageTextSize,
155
157
  metaActive,
156
158
  metaError,
157
159
  set,
158
160
  showDivider,
159
161
  showMessage,
160
- errorKey,
161
162
  tag: Tag,
162
163
  type
163
164
  } = props;
@@ -229,10 +230,10 @@ function FieldWrapperBase(props) {
229
230
  className: clsx('form-field__content-inner', fieldClass)
230
231
  }, beforeItem, children, afterItem), showDivider && /*#__PURE__*/React.createElement(Divider, {
231
232
  className: "form-field__item-divider",
232
- direction: dividerDirection,
233
+ width: dividerWidth,
233
234
  fill: dividerFill,
234
- size: dividerSize,
235
- width: dividerWidth
235
+ direction: dividerDirection,
236
+ size: dividerSize
236
237
  })), showMessage && /*#__PURE__*/React.createElement("div", {
237
238
  className: "form-field__message",
238
239
  "data-test-id": `${inputName}FieldMessage`
@@ -248,7 +249,7 @@ function FieldWrapperBase(props) {
248
249
  dataTestId: `${inputName}FieldMessageHelpText`,
249
250
  size: helpTextSize,
250
251
  sizeMobile: helpTextSizeMobile,
251
- textColor: helpTextColor,
252
+ textColor: isValidState ? helpTextColorSuccess : helpTextColor,
252
253
  textWeight: helpTextWeight
253
254
  }, helpText), (!isErrorState && !helpText || isErrorState && !helpText && !errorMessage) && /*#__PURE__*/React.createElement(Text, {
254
255
  className: "form-field__message-item form-field__message-item_type_help-text",
@@ -257,20 +258,24 @@ function FieldWrapperBase(props) {
257
258
  }, '\u00A0')), after);
258
259
  }
259
260
  FieldWrapperBase.defaultProps = {
260
- requiredMessageTextSize: 's',
261
- requiredMessageTextColor: 'warningTextPrimary',
262
- errorMessageTextSize: 's',
263
261
  errorMessageTextColor: 'errorTextPrimary',
262
+ errorMessageTextSize: 's',
263
+ requiredMessageTextColor: 'warningTextPrimary',
264
+ requiredMessageTextSize: 's',
264
265
  tag: 'div',
265
266
  type: 'normal'
266
267
  };
267
268
  FieldWrapperBase.propTypes = {
269
+ id: PropTypes.string,
270
+ children: PropTypes.any,
271
+ isDisabled: PropTypes.bool,
272
+ isHidden: PropTypes.bool,
273
+ isRequired: PropTypes.bool,
268
274
  after: PropTypes.any,
269
275
  afterItem: PropTypes.any,
270
276
  autoComplete: PropTypes.string,
271
277
  before: PropTypes.any,
272
278
  beforeItem: PropTypes.any,
273
- children: PropTypes.any,
274
279
  className: PropTypes.string,
275
280
  dataTour: PropTypes.string,
276
281
  desc: PropTypes.string,
@@ -282,15 +287,11 @@ FieldWrapperBase.propTypes = {
282
287
  dividerSize: PropTypes.string,
283
288
  dividerWidth: PropTypes.string,
284
289
  fieldClassName: PropTypes.string,
285
- id: PropTypes.string,
286
290
  inputName: PropTypes.string,
287
291
  inputOnBlur: PropTypes.func,
288
292
  inputOnChange: PropTypes.func,
289
293
  inputOnFocus: PropTypes.func,
290
294
  inputValue: PropTypes.any,
291
- isDisabled: PropTypes.bool,
292
- isHidden: PropTypes.bool,
293
- isRequired: PropTypes.bool,
294
295
  itemType: PropTypes.string,
295
296
  label: PropTypes.any,
296
297
  labelHidden: PropTypes.bool,
@@ -647,7 +648,13 @@ const CustomField = /*#__PURE__*/React.memo(function CustomField(props) {
647
648
  initialValue,
648
649
  fieldProps,
649
650
  classNameGroupItem,
650
- showMessage
651
+ showMessage,
652
+ clearIcon,
653
+ clearIconFill,
654
+ clearIconFillHover,
655
+ clearIconShape,
656
+ clearIconSize,
657
+ onClickClearIcon
651
658
  } = props;
652
659
  return /*#__PURE__*/React.createElement(Field, {
653
660
  initialValue: initialValue,
@@ -696,7 +703,16 @@ const CustomField = /*#__PURE__*/React.memo(function CustomField(props) {
696
703
  input: input,
697
704
  isDisabled: isDisabled,
698
705
  meta: meta
699
- })));
706
+ })), clearIcon && /*#__PURE__*/React.createElement(Icon, {
707
+ className: "form-field__icon",
708
+ iconFill: clearIconFill,
709
+ iconFillHover: clearIconFillHover,
710
+ imageSrc: clearIcon,
711
+ shape: clearIconShape,
712
+ size: clearIconSize,
713
+ SvgImage: clearIcon,
714
+ onClick: onClickClearIcon
715
+ }));
700
716
  });
701
717
  });
702
718
  CustomField.defaultProps = {
@@ -1555,6 +1571,14 @@ const InputField = /*#__PURE__*/React.memo(function InputField(props) {
1555
1571
  isRequired,
1556
1572
  isRevealable,
1557
1573
  classNameGroupItem,
1574
+ // dataTestId,
1575
+ // iconBorder,
1576
+ // iconBorderHover,
1577
+ clearIcon,
1578
+ clearIconFill,
1579
+ clearIconFillHover,
1580
+ clearIconShape,
1581
+ clearIconSize,
1558
1582
  fieldProps,
1559
1583
  iconFill,
1560
1584
  iconFillHover,
@@ -1567,10 +1591,8 @@ const InputField = /*#__PURE__*/React.memo(function InputField(props) {
1567
1591
  name,
1568
1592
  parse,
1569
1593
  showMessage,
1570
- onChange
1571
- // dataTestId,
1572
- // iconBorder,
1573
- // iconBorderHover,
1594
+ onChange,
1595
+ onClickClearIcon
1574
1596
  } = props;
1575
1597
  const [isRevealed, setIsRevealed] = useState(false);
1576
1598
  const inputType = useMemo(() => {
@@ -1653,6 +1675,15 @@ const InputField = /*#__PURE__*/React.memo(function InputField(props) {
1653
1675
  size: iconSize,
1654
1676
  SvgImage: isRevealed ? iconRevealableHide : iconRevealableShow,
1655
1677
  onClick: onClickIconReveal
1678
+ }), clearIcon && /*#__PURE__*/React.createElement(Icon, {
1679
+ className: "form-field__icon",
1680
+ iconFill: clearIconFill,
1681
+ iconFillHover: clearIconFillHover,
1682
+ imageSrc: clearIcon,
1683
+ shape: clearIconShape,
1684
+ size: clearIconSize,
1685
+ SvgImage: clearIcon,
1686
+ onClick: onClickClearIcon
1656
1687
  }));
1657
1688
  });
1658
1689
  });
@@ -2020,7 +2051,7 @@ const SelectField = /*#__PURE__*/React.memo(function SelectField(props) {
2020
2051
  fieldProps,
2021
2052
  initialValue,
2022
2053
  name,
2023
- options,
2054
+ options = [],
2024
2055
  selectProps,
2025
2056
  selectRef,
2026
2057
  showMessage,
@@ -2045,8 +2076,8 @@ const SelectField = /*#__PURE__*/React.memo(function SelectField(props) {
2045
2076
  const optionsValues = getDefaultValue(options, input.value);
2046
2077
  if (!optionsValues.length && input.value?.length) {
2047
2078
  optionsValues.push({
2048
- value: input.value,
2049
- label: input.value
2079
+ label: input.value,
2080
+ value: input.value
2050
2081
  });
2051
2082
  }
2052
2083
  return optionsValues;
@@ -2076,8 +2107,8 @@ const SelectField = /*#__PURE__*/React.memo(function SelectField(props) {
2076
2107
  meta: meta
2077
2108
  });
2078
2109
  const updatedSelectProps = useValidationAppearanceInputProps({
2079
- validationStateKey: isErrorState ? errorKey : 'success',
2080
- inputProps: selectProps
2110
+ inputProps: selectProps,
2111
+ validationStateKey: isErrorState ? errorKey : 'success'
2081
2112
  });
2082
2113
  return /*#__PURE__*/React.createElement(FieldWrapper, Object.assign({
2083
2114
  className: clsx('form-field_type_select', 'form__item_type_select', classNameGroupItem),
@@ -2086,33 +2117,33 @@ const SelectField = /*#__PURE__*/React.memo(function SelectField(props) {
2086
2117
  fieldClassName: 'form-select',
2087
2118
  inputName: input.name,
2088
2119
  inputValue: input.value,
2120
+ metaActive: meta.active,
2121
+ metaError: meta.error,
2122
+ showMessage: showMessage,
2089
2123
  isDisabled: isDisabled,
2090
2124
  isErrorState: isErrorState,
2091
2125
  isRequired: isRequired,
2092
- isValidState: isValidState,
2093
- metaActive: meta.active,
2094
- metaError: meta.error,
2095
- showMessage: showMessage
2126
+ isValidState: isValidState
2096
2127
  }, fieldProps), /*#__PURE__*/React.createElement(Select, Object.assign({
2097
2128
  className: "form-select-item",
2129
+ ref: selectRef,
2098
2130
  instanceId: `id_${input.name}`,
2099
- isDisabled: isDisabled,
2100
2131
  options: options,
2101
- ref: selectRef,
2102
2132
  value: selectedOptions,
2133
+ isDisabled: isDisabled,
2103
2134
  onChange: onChangeValue,
2104
2135
  onInputChange: onInputChange
2105
2136
  }, updatedSelectProps)));
2106
2137
  });
2107
2138
  });
2108
2139
  SelectField.propTypes = {
2109
- name: PropTypes.string.isRequired,
2110
- classNameGroupItem: PropTypes.string,
2111
- fieldProps: PropTypes.object,
2112
2140
  isDisabled: PropTypes.bool,
2113
2141
  isRequired: PropTypes.bool,
2142
+ classNameGroupItem: PropTypes.string,
2143
+ fieldProps: PropTypes.object,
2114
2144
  label: PropTypes.any,
2115
2145
  messageType: PropTypes.string,
2146
+ name: PropTypes.string.isRequired,
2116
2147
  options: PropTypes.array,
2117
2148
  selectProps: PropTypes.object,
2118
2149
  selectRef: PropTypes.any,
@@ -2294,7 +2325,13 @@ const MaskedInputField = /*#__PURE__*/React.memo(function MaskedInputField(props
2294
2325
  showMessage,
2295
2326
  inputProps,
2296
2327
  optionsMask,
2297
- unmasked
2328
+ unmasked,
2329
+ clearIcon,
2330
+ clearIconFill,
2331
+ clearIconFillHover,
2332
+ clearIconShape,
2333
+ clearIconSize,
2334
+ onClickClearIcon
2298
2335
  } = props;
2299
2336
  return /*#__PURE__*/React.createElement(Field, {
2300
2337
  initialValue: initialValue,
@@ -2361,7 +2398,16 @@ const MaskedInputField = /*#__PURE__*/React.memo(function MaskedInputField(props
2361
2398
  value: value,
2362
2399
  onBlur: input.onBlur,
2363
2400
  onFocus: input.onFocus
2364
- }, updatedInputProps)));
2401
+ }, updatedInputProps)), clearIcon && /*#__PURE__*/React.createElement(Icon, {
2402
+ className: "form-field__icon",
2403
+ iconFill: clearIconFill,
2404
+ iconFillHover: clearIconFillHover,
2405
+ imageSrc: clearIcon,
2406
+ shape: clearIconShape,
2407
+ size: clearIconSize,
2408
+ SvgImage: clearIcon,
2409
+ onClick: onClickClearIcon
2410
+ }));
2365
2411
  });
2366
2412
  });
2367
2413
  MaskedInputField.defaultProps = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@itcase/forms",
3
- "version": "1.0.78",
3
+ "version": "1.0.79",
4
4
  "description": "Forms fields, inputs, etc.",
5
5
  "keywords": [],
6
6
  "license": "MIT",
@@ -30,37 +30,34 @@
30
30
  "registry": "https://registry.npmjs.org/"
31
31
  },
32
32
  "dependencies": {
33
- "@itcase/common": "^1.2.17",
34
- "@itcase/ui": "^1.3.15",
33
+ "@itcase/common": "^1.2.18",
34
+ "@itcase/config": "^1.0.16",
35
+ "@itcase/ui": "^1.3.27",
35
36
  "axios": "^1.7.9",
36
37
  "clsx": "^2.1.1",
37
38
  "final-form": "^4.20.10",
38
39
  "final-form-focus": "^1.1.2",
39
- "libphonenumber-js": "^1.11.18",
40
+ "libphonenumber-js": "^1.11.20",
40
41
  "lodash": "^4.17.21",
41
42
  "luxon": "^3.5.0",
42
- "postcss": "^8.5.1",
43
43
  "prop-types": "^15.8.1",
44
44
  "react": "^18.3.1",
45
45
  "react-date-range": "^2.0.1",
46
- "react-datepicker": "^7.6.0",
46
+ "react-datepicker": "^8.1.0",
47
47
  "react-dom": "^18.3.1",
48
- "react-dropzone": "^14.3.5",
48
+ "react-dropzone": "^14.3.8",
49
49
  "react-final-form": "^6.5.9",
50
50
  "react-imask": "^7.6.1",
51
- "react-select": "^5.9.0"
51
+ "react-select": "^5.10.0"
52
52
  },
53
53
  "devDependencies": {
54
- "@itcase/lint": "^1.0.36",
55
- "@babel/core": "^7.26.0",
56
- "@babel/eslint-parser": "^7.26.5",
57
- "@babel/preset-env": "^7.26.0",
54
+ "@itcase/lint": "^1.0.41",
55
+ "@babel/core": "^7.26.9",
56
+ "@babel/eslint-parser": "^7.26.8",
57
+ "@babel/preset-env": "^7.26.9",
58
58
  "@babel/preset-react": "^7.26.3",
59
- "@commitlint/cli": "^19.6.1",
60
- "@commitlint/config-conventional": "^19.6.0",
61
- "@eslint/compat": "^1.2.5",
62
- "@eslint/eslintrc": "^3.2.0",
63
- "@ianvs/prettier-plugin-sort-imports": "^4.4.1",
59
+ "@commitlint/cli": "^19.7.1",
60
+ "@commitlint/config-conventional": "^19.7.1",
64
61
  "@rollup/plugin-babel": "^6.0.4",
65
62
  "@rollup/plugin-commonjs": "^28.0.2",
66
63
  "@rollup/plugin-json": "^6.1.0",
@@ -74,50 +71,15 @@
74
71
  "babel-plugin-inline-react-svg": "^2.0.2",
75
72
  "babel-plugin-transform-react-remove-prop-types": "^0.4.24",
76
73
  "conventional-changelog-conventionalcommits": "^8.0.0",
77
- "eslint": "9.18.0",
78
- "eslint-config-prettier": "10.0.1",
79
- "eslint-config-standard": "17.1.0",
80
- "eslint-plugin-babel": "5.3.1",
81
- "eslint-plugin-import": "2.31.0",
82
- "eslint-plugin-n": "17.15.1",
83
- "eslint-plugin-node": "11.1.0",
84
- "eslint-plugin-prettier": "5.2.3",
85
- "eslint-plugin-promise": "7.2.1",
86
- "eslint-plugin-react": "7.37.4",
87
- "eslint-plugin-react-hooks": "5.1.0",
88
- "eslint-plugin-standard": "5.0.0",
74
+ "eslint": "9.21.0",
89
75
  "husky": "^9.1.7",
90
- "lint-staged": "^15.4.1",
91
- "npm": "^11.0.0",
92
- "postcss-aspect-ratio-polyfill": "^2.0.0",
93
- "postcss-cli": "^11.0.0",
94
- "postcss-combine-duplicated-selectors": "^10.0.3",
95
- "postcss-dark-theme-class": "^1.3.0",
96
- "postcss-discard-duplicates": "^7.0.1",
97
- "postcss-each": "^1.1.0",
98
- "postcss-easings": "^4.0.0",
99
- "postcss-extend-rule": "^4.0.0",
100
- "postcss-flexbugs-fixes": "^5.0.2",
101
- "postcss-hexrgba": "^2.1.0",
102
- "postcss-import": "^16.1.0",
103
- "postcss-import-ext-glob": "^2.1.1",
104
- "postcss-mixins": "^11.0.3",
105
- "postcss-nested": "^7.0.2",
106
- "postcss-nested-ancestors": "^3.0.0",
107
- "postcss-normalize": "^13.0.1",
108
- "postcss-prepend-imports": "^1.0.1",
109
- "postcss-preset-env": "^10.1.3",
110
- "postcss-pxtorem": "^6.1.0",
111
- "postcss-responsive-type": "github:ITCase/postcss-responsive-type",
112
- "postcss-sort-media-queries": "^5.2.0",
113
- "prettier": "3.4.2",
114
- "rollup": "^4.31.0",
76
+ "lint-staged": "^15.4.3",
77
+ "postcss": "^8.5.3",
78
+ "prettier": "3.5.2",
79
+ "rollup": "^4.34.8",
115
80
  "rollup-plugin-peer-deps-external": "^2.2.4",
116
- "semantic-release": "^24.2.1",
117
- "stylelint": "^16.13.2",
118
- "stylelint-config-standard": "^37.0.0",
119
- "stylelint-no-unsupported-browser-features": "^8.0.2",
120
- "stylelint-order": "^6.0.4",
81
+ "semantic-release": "^24.2.3",
82
+ "stylelint": "^16.14.1",
121
83
  "typescript": "^5.7.3"
122
84
  }
123
85
  }