@itcase/forms 1.1.50 → 1.1.52

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.
@@ -7,27 +7,81 @@
7
7
  text-align: center;
8
8
  }
9
9
  &^&_size {
10
- @each $size in xxl, xl, l, m, s, xs, xxs {
11
- &_$(size) {
12
- gap: var(--form-filed-code-size-$(size)-gap);
10
+ &_xxl {
11
+ gap: var(--form-filed-code-size-xxl-gap);
12
+ }
13
+ &_xl {
14
+ gap: var(--form-filed-code-size-xl-gap);
15
+ }
16
+ &_l {
17
+ gap: var(--form-filed-code-size-l-gap);
18
+ }
19
+ &_m {
20
+ gap: var(--form-filed-code-size-m-gap);
21
+ }
22
+ &_s {
23
+ gap: var(--form-filed-code-size-s-gap);
24
+ }
25
+ &_xs {
26
+ gap: var(--form-filed-code-size-xs-gap);
27
+ }
28
+ &_xxs {
29
+ gap: var(--form-filed-code-size-xxs-gap);
13
30
  }
14
- }
15
31
  }
16
32
  }
17
33
  }
18
34
  .form-field_type_code {
19
- @each $state in error, success, require, disabled, focus {
20
- &.form__item_state_$(state) {
35
+ &.form__item_state_error {
21
36
  & .form-field__label {
22
37
  & .text {
23
- color: var(--form-code-$(state)-label-color);
38
+ color: var(--form-code-error-label-color);
24
39
  }
25
40
  }
26
- & .form-field__message-item_type-$(state) {
27
- color: var(--form-code-$(state)-helptext-color);
41
+ & .form-field__message-item_type-error {
42
+ color: var(--form-code-error-helptext-color);
43
+ }
44
+ }
45
+ &.form__item_state_success {
46
+ & .form-field__label {
47
+ & .text {
48
+ color: var(--form-code-success-label-color);
49
+ }
50
+ }
51
+ & .form-field__message-item_type-success {
52
+ color: var(--form-code-success-helptext-color);
53
+ }
54
+ }
55
+ &.form__item_state_require {
56
+ & .form-field__label {
57
+ & .text {
58
+ color: var(--form-code-require-label-color);
59
+ }
60
+ }
61
+ & .form-field__message-item_type-require {
62
+ color: var(--form-code-require-helptext-color);
63
+ }
64
+ }
65
+ &.form__item_state_disabled {
66
+ & .form-field__label {
67
+ & .text {
68
+ color: var(--form-code-disabled-label-color);
69
+ }
70
+ }
71
+ & .form-field__message-item_type-disabled {
72
+ color: var(--form-code-disabled-helptext-color);
73
+ }
74
+ }
75
+ &.form__item_state_focus {
76
+ & .form-field__label {
77
+ & .text {
78
+ color: var(--form-code-focus-label-color);
79
+ }
80
+ }
81
+ & .form-field__message-item_type-focus {
82
+ color: var(--form-code-focus-helptext-color);
28
83
  }
29
84
  }
30
- }
31
85
  }
32
86
  :root {
33
87
  --form-filed-code-size-l-gap: 8px;
@@ -7,13 +7,26 @@
7
7
  outline: 0;
8
8
  @mixin easing easeOutQuart, all, 0.2s;
9
9
  &_size {
10
- @each $size in xl, l, m, s {
11
- &_$(size) {
10
+ &_xl {
12
11
  ^^&-wrapper {
13
- padding: var(--fileinput-size-$(size)-padding);
12
+ padding: var(--fileinput-size-xl-padding);
13
+ }
14
+ }
15
+ &_l {
16
+ ^^&-wrapper {
17
+ padding: var(--fileinput-size-l-padding);
18
+ }
19
+ }
20
+ &_m {
21
+ ^^&-wrapper {
22
+ padding: var(--fileinput-size-m-padding);
23
+ }
24
+ }
25
+ &_s {
26
+ ^^&-wrapper {
27
+ padding: var(--fileinput-size-s-padding);
14
28
  }
15
29
  }
16
- }
17
30
  }
18
31
  &-wrapper {
19
32
  display: grid;
@@ -117,13 +130,26 @@
117
130
  .form-dropzone {
118
131
  &_shape {
119
132
  &_rounded {
120
- @each $size in xl, l, m, s {
121
- &.form-dropzone__dropzone_size_$(size) {
133
+ &.form-dropzone__dropzone_size_xl {
122
134
  & .form-dropzone__dropzone-wrapper {
123
- border-radius: var(--fileinput-size-$(size)-shape-rounded);
135
+ border-radius: var(--fileinput-size-xl-shape-rounded);
136
+ }
137
+ }
138
+ &.form-dropzone__dropzone_size_l {
139
+ & .form-dropzone__dropzone-wrapper {
140
+ border-radius: var(--fileinput-size-l-shape-rounded);
141
+ }
142
+ }
143
+ &.form-dropzone__dropzone_size_m {
144
+ & .form-dropzone__dropzone-wrapper {
145
+ border-radius: var(--fileinput-size-m-shape-rounded);
146
+ }
147
+ }
148
+ &.form-dropzone__dropzone_size_s {
149
+ & .form-dropzone__dropzone-wrapper {
150
+ border-radius: var(--fileinput-size-s-shape-rounded);
124
151
  }
125
152
  }
126
- }
127
153
  }
128
154
  &_circular {
129
155
  border-radius: 50%;
@@ -144,14 +170,36 @@
144
170
  }
145
171
  }
146
172
  .form-dropzone__dropzone-wrapper_column {
147
- @each $count in 1, 2, 3, 4, 5 {
148
- &_$(count) {
149
- grid-template-columns: repeat($(count), minmax(0, 1fr));
173
+ &_1 {
174
+ grid-template-columns: repeat(1, minmax(0, 1fr));
150
175
  & .form-dropzone__hint {
151
- grid-column: span $(count);
176
+ grid-column: span 1;
177
+ }
178
+ }
179
+ &_2 {
180
+ grid-template-columns: repeat(2, minmax(0, 1fr));
181
+ & .form-dropzone__hint {
182
+ grid-column: span 2;
183
+ }
184
+ }
185
+ &_3 {
186
+ grid-template-columns: repeat(3, minmax(0, 1fr));
187
+ & .form-dropzone__hint {
188
+ grid-column: span 3;
189
+ }
190
+ }
191
+ &_4 {
192
+ grid-template-columns: repeat(4, minmax(0, 1fr));
193
+ & .form-dropzone__hint {
194
+ grid-column: span 4;
195
+ }
196
+ }
197
+ &_5 {
198
+ grid-template-columns: repeat(5, minmax(0, 1fr));
199
+ & .form-dropzone__hint {
200
+ grid-column: span 5;
152
201
  }
153
202
  }
154
- }
155
203
  }
156
204
  :root {
157
205
  --fileinput-size-normal-padding: 16px 16px;
@@ -13,16 +13,38 @@
13
13
  visibility: hidden;
14
14
  }
15
15
  &_column {
16
- @each $count in 2, 3, 4, 5 {
17
- &_$(count) {
16
+ &_2 {
18
17
  ^^&-items {
19
18
  display: grid;
20
19
  column-gap: 24px;
21
- grid-template-columns: repeat($(count), 1fr);
20
+ grid-template-columns: repeat(2, 1fr);
21
+ align-items: end;
22
+ }
23
+ }
24
+ &_3 {
25
+ ^^&-items {
26
+ display: grid;
27
+ column-gap: 24px;
28
+ grid-template-columns: repeat(3, 1fr);
29
+ align-items: end;
30
+ }
31
+ }
32
+ &_4 {
33
+ ^^&-items {
34
+ display: grid;
35
+ column-gap: 24px;
36
+ grid-template-columns: repeat(4, 1fr);
37
+ align-items: end;
38
+ }
39
+ }
40
+ &_5 {
41
+ ^^&-items {
42
+ display: grid;
43
+ column-gap: 24px;
44
+ grid-template-columns: repeat(5, 1fr);
22
45
  align-items: end;
23
46
  }
24
47
  }
25
- }
26
48
  }
27
49
  &-wrapper {
28
50
  display: flex;
@@ -14,13 +14,41 @@
14
14
  .form-field {
15
15
  &_radio {
16
16
  &.form-field_size {
17
- @each $size in xxl, xl, l, m, s, xs, xxs {
18
- &_$(size) {
17
+ &_xxl {
19
18
  & .form-radio {
20
- gap: var(--form-filed-radio-size-$(size)-gap);
19
+ gap: var(--form-filed-radio-size-xxl-gap);
20
+ }
21
+ }
22
+ &_xl {
23
+ & .form-radio {
24
+ gap: var(--form-filed-radio-size-xl-gap);
25
+ }
26
+ }
27
+ &_l {
28
+ & .form-radio {
29
+ gap: var(--form-filed-radio-size-l-gap);
30
+ }
31
+ }
32
+ &_m {
33
+ & .form-radio {
34
+ gap: var(--form-filed-radio-size-m-gap);
35
+ }
36
+ }
37
+ &_s {
38
+ & .form-radio {
39
+ gap: var(--form-filed-radio-size-s-gap);
40
+ }
41
+ }
42
+ &_xs {
43
+ & .form-radio {
44
+ gap: var(--form-filed-radio-size-xs-gap);
45
+ }
46
+ }
47
+ &_xxs {
48
+ & .form-radio {
49
+ gap: var(--form-filed-radio-size-xxs-gap);
21
50
  }
22
51
  }
23
- }
24
52
  }
25
53
  }
26
54
  }
@@ -299,8 +299,8 @@ const defaultFieldSizeXL = {
299
299
  function FieldWrapperBase(props) {
300
300
  const {
301
301
  id,
302
- dataTour,
303
302
  className,
303
+ dataTour,
304
304
  type,
305
305
  label,
306
306
  labelHidden,
@@ -314,32 +314,32 @@ function FieldWrapperBase(props) {
314
314
  descTextColor,
315
315
  descTextSize,
316
316
  descTextWeight,
317
- errorKey,
318
- errorMessage,
319
- isErrorState,
320
- metaError,
321
- helpTextColorSuccess,
322
- isDisabled,
323
317
  afterItem,
324
318
  beforeItem,
325
319
  dividerDirection,
326
320
  dividerFill,
327
321
  dividerSize,
328
322
  dividerWidth,
323
+ errorKey,
324
+ errorMessage,
329
325
  fieldClassName,
330
326
  helpText,
331
327
  helpTextColor,
328
+ helpTextColorSuccess,
332
329
  helpTextSize,
333
330
  helpTextSizeMobile,
334
331
  helpTextWeight,
335
332
  inputName,
336
333
  inputValue,
337
334
  metaActive,
335
+ metaError,
338
336
  showDivider,
339
337
  showMessage,
340
338
  tag: Tag = 'div',
341
339
  before,
342
340
  after,
341
+ isDisabled,
342
+ isErrorState,
343
343
  isHidden,
344
344
  isRequired,
345
345
  isValidState,
@@ -383,12 +383,12 @@ function FieldWrapperBase(props) {
383
383
  const errorTextWeight = props[`${errorKey}MessageTextWeight`];
384
384
  return /*#__PURE__*/React__default.default.createElement(Tag, {
385
385
  className: clsx__default.default(formFieldClass, 'form__item', 'form-field', type && `form-field_type_${type}`, sizeClass, fillClass, shapeClass, isDisabled && `form-field_state_disabled`, isHidden && `form-field_state_hidden`, directionClass, widthClass),
386
- "data-test-id": `${inputName}Field`,
386
+ "data-testid": `${inputName}-field`,
387
387
  "data-tour": dataTour,
388
388
  style: formFieldStyles
389
389
  }, before, (label || labelHidden) && /*#__PURE__*/React__default.default.createElement("div", {
390
390
  className: clsx__default.default('form-field__label'),
391
- "data-test-id": `${inputName}FieldLabel`,
391
+ "data-testid": `${inputName}-field-label`,
392
392
  htmlFor: id
393
393
  }, /*#__PURE__*/React__default.default.createElement(Text.Text, {
394
394
  size: labelTextSize,
@@ -398,7 +398,7 @@ function FieldWrapperBase(props) {
398
398
  sizeTablet: labelTextSizeTablet
399
399
  }, label, labelHidden && '\u00A0')), desc && /*#__PURE__*/React__default.default.createElement("div", {
400
400
  className: "form-field__desc",
401
- "data-test-id": `${inputName}FieldDesc`
401
+ "data-testid": `${inputName}-field-desc`
402
402
  }, /*#__PURE__*/React__default.default.createElement(Text.Text, {
403
403
  size: descTextSize,
404
404
  textColor: descTextColor,
@@ -415,24 +415,24 @@ function FieldWrapperBase(props) {
415
415
  fill: dividerFill
416
416
  })), showMessage && /*#__PURE__*/React__default.default.createElement("div", {
417
417
  className: "form-field__message",
418
- "data-test-id": `${inputName}FieldMessage`
418
+ "data-testid": `${inputName}-field-message`
419
419
  }, isErrorState && errorMessage && /*#__PURE__*/React__default.default.createElement(Text.Text, {
420
420
  id: `${inputName}-error`,
421
- dataTestId: `${inputName}FieldMessageError`,
422
421
  className: "form-field__message-item form-field__message-item_type-error",
422
+ dataTestId: `${inputName}-field-message-error`,
423
423
  size: errorTextSize,
424
424
  textColor: errorTextColor,
425
425
  textWeight: errorTextWeight
426
426
  }, errorMessage), Boolean(helpText) && (!isErrorState || !errorMessage) && /*#__PURE__*/React__default.default.createElement(Text.Text, {
427
- dataTestId: `${inputName}FieldMessageHelpText`,
428
427
  className: "form-field__message-item form-field__message-item_type_help-text",
428
+ dataTestId: `${inputName}-field-message-help-text`,
429
429
  size: helpTextSize,
430
430
  textColor: isValidState ? helpTextColorSuccess : helpTextColor,
431
431
  textWeight: helpTextWeight,
432
432
  sizeMobile: helpTextSizeMobile
433
433
  }, helpText), (!isErrorState && !helpText || isErrorState && !helpText && !errorMessage) && /*#__PURE__*/React__default.default.createElement(Text.Text, {
434
- dataTestId: `${inputName}FieldMessageHelpText`,
435
434
  className: "form-field__message-item form-field__message-item_type_help-text",
435
+ dataTestId: `${inputName}field-message-help-text`,
436
436
  size: messageTextSize
437
437
  }, '\u00A0')), after);
438
438
  }
@@ -1725,7 +1725,7 @@ const FormFieldInput = /*#__PURE__*/React__default.default.memo(function FormFie
1725
1725
  isValidState: isValidState
1726
1726
  }, fieldProps), /*#__PURE__*/React__default.default.createElement(Input.Input, Object.assign({
1727
1727
  className: clsx__default.default(meta.active && 'input_state_focus', meta.error && meta.touched && `input_state_${errorKey}`),
1728
- dataTestId: `${input.name}FieldInput`,
1728
+ dataTestId: `${input.name}-field-input`,
1729
1729
  type: "text",
1730
1730
  name: input.name,
1731
1731
  autoComplete: "nope",
@@ -1922,7 +1922,7 @@ const FormFieldPassword = /*#__PURE__*/React__default.default.memo(function Form
1922
1922
  isValidState: isValidState
1923
1923
  }, fieldProps), /*#__PURE__*/React__default.default.createElement(InputPassword.InputPassword, Object.assign({
1924
1924
  className: clsx__default.default(meta.active && 'input-password_state_focus', meta.error && meta.touched && `input-password_state_${errorKey}`),
1925
- dataTestId: `${input.name}FieldInputPassword`,
1925
+ dataTestId: `${input.name}-field-input-password`,
1926
1926
  name: input.name,
1927
1927
  autoComplete: "nope",
1928
1928
  value: input.value || '',
@@ -2348,11 +2348,11 @@ const defaultTextareaProps = {
2348
2348
  const FormFieldTextarea = /*#__PURE__*/React__default.default.memo(function FormFieldTextarea(props) {
2349
2349
  const {
2350
2350
  name,
2351
- isDisabled,
2352
2351
  classNameGroupItem,
2353
2352
  fieldProps = {},
2354
2353
  inputProps = {},
2355
2354
  showMessage,
2355
+ isDisabled,
2356
2356
  isRequired
2357
2357
  } = props;
2358
2358
  return /*#__PURE__*/React__default.default.createElement(reactFinalForm.Field, {
@@ -2371,8 +2371,8 @@ const FormFieldTextarea = /*#__PURE__*/React__default.default.memo(function Form
2371
2371
  const {
2372
2372
  errorKey,
2373
2373
  errorMessage,
2374
- isErrorState,
2375
2374
  successKey,
2375
+ isErrorState,
2376
2376
  isValidState
2377
2377
  } = useFieldValidationState({
2378
2378
  fieldProps: fieldProps,
@@ -2387,23 +2387,23 @@ const FormFieldTextarea = /*#__PURE__*/React__default.default.memo(function Form
2387
2387
  className: clsx__default.default('form-field_textarea', 'form__item_textarea', classNameGroupItem),
2388
2388
  errorKey: errorKey,
2389
2389
  errorMessage: errorMessage,
2390
- isErrorState: isErrorState,
2391
- metaError: meta.error,
2392
- isDisabled: isDisabled,
2393
2390
  fieldClassName: 'form-textarea',
2394
2391
  inputName: input.name,
2395
2392
  inputValue: input.value,
2396
2393
  metaActive: meta.active,
2394
+ metaError: meta.error,
2397
2395
  showMessage: showMessage,
2396
+ isDisabled: isDisabled,
2397
+ isErrorState: isErrorState,
2398
2398
  isRequired: isRequired,
2399
2399
  isValidState: isValidState
2400
2400
  }, fieldProps), /*#__PURE__*/React__default.default.createElement(Textarea.Textarea, Object.assign({
2401
- dataTestId: `${input.name}FieldTextarea`,
2402
2401
  className: clsx__default.default(meta.active && 'textarea_state_focus', meta.error && meta.touched && `textarea_state_${errorKey}`),
2402
+ dataTestId: `${input.name}-field-textarea`,
2403
2403
  name: input.name,
2404
- isDisabled: isDisabled,
2405
2404
  autoComplete: "nope",
2406
2405
  value: input.value || '',
2406
+ isDisabled: isDisabled,
2407
2407
  onBlur: input.onBlur,
2408
2408
  onChange: input.onChange,
2409
2409
  onFocus: input.onFocus
@@ -2762,6 +2762,7 @@ const FinalForm = /*#__PURE__*/React__default.default.forwardRef(function FinalF
2762
2762
  dataTestId,
2763
2763
  dataTour,
2764
2764
  type,
2765
+ name,
2765
2766
  initialValues,
2766
2767
  initialValuesEqual,
2767
2768
  config,
@@ -2812,6 +2813,7 @@ const FinalForm = /*#__PURE__*/React__default.default.forwardRef(function FinalF
2812
2813
  primaryButtonAppearance,
2813
2814
  primaryButtonFill,
2814
2815
  primaryButtonFillHover,
2816
+ primaryButtonHtmlType,
2815
2817
  primaryButtonIsDisabled,
2816
2818
  primaryButtonIsLoading,
2817
2819
  primaryButtonLabel,
@@ -2819,6 +2821,7 @@ const FinalForm = /*#__PURE__*/React__default.default.forwardRef(function FinalF
2819
2821
  primaryButtonLabelTextColor,
2820
2822
  primaryButtonLabelTextWeight,
2821
2823
  primaryButtonSize,
2824
+ primarySecondaryHtmlType,
2822
2825
  renderFieldsWrapper = wrapperChildren => wrapperChildren,
2823
2826
  secondaryButton,
2824
2827
  secondaryButtonAppearance,
@@ -2877,14 +2880,14 @@ const FinalForm = /*#__PURE__*/React__default.default.forwardRef(function FinalF
2877
2880
  }) => {
2878
2881
  return /*#__PURE__*/React__default.default.createElement("form", {
2879
2882
  className: clsx__default.default(className, 'form', type && `form_type_${type}`, widthClass && `width_${widthClass}`, heightClass && `height_${heightClass}`, titlePosition && `form_title-position_${titlePosition}`, buttonPosition && `form_button-position_${buttonPosition}`, directionClass && `direction_${directionClass}`, fillClass && `fill_${fillClass}`, shapeClass && `shape_${shapeClass}`, shapeStrengthClass && `shape-strength_${shapeStrengthClass}`, elevationClass && `elevation_${elevationClass}`),
2880
- name: formName
2883
+ name: formName || 'form'
2881
2884
  // We no need set reference to html element, we need reference to "final-form" instance
2882
2885
  ,
2883
2886
  ref: () => onRefFormInstance(form),
2884
2887
  autoCapitalize: disableFieldsAutoComplete ? 'off' : undefined,
2885
2888
  autoComplete: disableFieldsAutoComplete ? 'off' : undefined,
2886
2889
  autoCorrect: disableFieldsAutoComplete ? 'off' : undefined,
2887
- "data-test-id": dataTestId,
2890
+ "data-testid": dataTestId || name,
2888
2891
  "data-tour": dataTour,
2889
2892
  spellCheck: disableFieldsAutoComplete ? 'false' : undefined,
2890
2893
  style: formStyles,
@@ -2941,7 +2944,7 @@ const FinalForm = /*#__PURE__*/React__default.default.forwardRef(function FinalF
2941
2944
  }, primaryButtonLabel ? /*#__PURE__*/React__default.default.createElement(Button.Button, {
2942
2945
  appearance: primaryButtonAppearance,
2943
2946
  className: "form__button-item",
2944
- dataTestId: dataTestIdPrimaryButton,
2947
+ dataTestId: dataTestIdPrimaryButton || (name ? `${name}-primary` : 'form-primary'),
2945
2948
  dataTour: dataTourPrimaryButton,
2946
2949
  width: "fill",
2947
2950
  size: primaryButtonSize,
@@ -2951,12 +2954,13 @@ const FinalForm = /*#__PURE__*/React__default.default.forwardRef(function FinalF
2951
2954
  labelTextColor: primaryButtonLabelTextColor,
2952
2955
  labelTextSize: primaryButtonLabelSize,
2953
2956
  labelTextWeight: primaryButtonLabelTextWeight,
2957
+ htmlType: primaryButtonHtmlType || 'submit',
2954
2958
  loading: primaryButtonIsLoading,
2955
2959
  isDisabled: primaryButtonIsDisabled
2956
2960
  }) : primaryButton, secondaryButtonLabel ? /*#__PURE__*/React__default.default.createElement(Button.Button, {
2957
2961
  appearance: secondaryButtonAppearance,
2958
2962
  className: "form__button-item",
2959
- dataTestId: dataTestIdSecondaryButton,
2963
+ dataTestId: dataTestIdSecondaryButton || (name ? `${name}-secondary` : 'form-secondary'),
2960
2964
  dataTour: dataTourSecondaryButton,
2961
2965
  width: "fill",
2962
2966
  size: secondaryButtonSize,
@@ -2966,6 +2970,7 @@ const FinalForm = /*#__PURE__*/React__default.default.forwardRef(function FinalF
2966
2970
  labelTextColor: secondaryButtonLabelTextColor,
2967
2971
  labelTextSize: secondaryButtonLabelSize,
2968
2972
  labelTextWeight: secondaryButtonLabelTextWeight,
2973
+ htmlType: primarySecondaryHtmlType,
2969
2974
  loading: secondaryButtonIsLoading,
2970
2975
  isDisabled: secondaryButtonIsDisabled,
2971
2976
  onClick: onClickSecondaryButton
@@ -288,8 +288,8 @@ const defaultFieldSizeXL = {
288
288
  function FieldWrapperBase(props) {
289
289
  const {
290
290
  id,
291
- dataTour,
292
291
  className,
292
+ dataTour,
293
293
  type,
294
294
  label,
295
295
  labelHidden,
@@ -303,32 +303,32 @@ function FieldWrapperBase(props) {
303
303
  descTextColor,
304
304
  descTextSize,
305
305
  descTextWeight,
306
- errorKey,
307
- errorMessage,
308
- isErrorState,
309
- metaError,
310
- helpTextColorSuccess,
311
- isDisabled,
312
306
  afterItem,
313
307
  beforeItem,
314
308
  dividerDirection,
315
309
  dividerFill,
316
310
  dividerSize,
317
311
  dividerWidth,
312
+ errorKey,
313
+ errorMessage,
318
314
  fieldClassName,
319
315
  helpText,
320
316
  helpTextColor,
317
+ helpTextColorSuccess,
321
318
  helpTextSize,
322
319
  helpTextSizeMobile,
323
320
  helpTextWeight,
324
321
  inputName,
325
322
  inputValue,
326
323
  metaActive,
324
+ metaError,
327
325
  showDivider,
328
326
  showMessage,
329
327
  tag: Tag = 'div',
330
328
  before,
331
329
  after,
330
+ isDisabled,
331
+ isErrorState,
332
332
  isHidden,
333
333
  isRequired,
334
334
  isValidState,
@@ -372,12 +372,12 @@ function FieldWrapperBase(props) {
372
372
  const errorTextWeight = props[`${errorKey}MessageTextWeight`];
373
373
  return /*#__PURE__*/React.createElement(Tag, {
374
374
  className: clsx(formFieldClass, 'form__item', 'form-field', type && `form-field_type_${type}`, sizeClass, fillClass, shapeClass, isDisabled && `form-field_state_disabled`, isHidden && `form-field_state_hidden`, directionClass, widthClass),
375
- "data-test-id": `${inputName}Field`,
375
+ "data-testid": `${inputName}-field`,
376
376
  "data-tour": dataTour,
377
377
  style: formFieldStyles
378
378
  }, before, (label || labelHidden) && /*#__PURE__*/React.createElement("div", {
379
379
  className: clsx('form-field__label'),
380
- "data-test-id": `${inputName}FieldLabel`,
380
+ "data-testid": `${inputName}-field-label`,
381
381
  htmlFor: id
382
382
  }, /*#__PURE__*/React.createElement(Text, {
383
383
  size: labelTextSize,
@@ -387,7 +387,7 @@ function FieldWrapperBase(props) {
387
387
  sizeTablet: labelTextSizeTablet
388
388
  }, label, labelHidden && '\u00A0')), desc && /*#__PURE__*/React.createElement("div", {
389
389
  className: "form-field__desc",
390
- "data-test-id": `${inputName}FieldDesc`
390
+ "data-testid": `${inputName}-field-desc`
391
391
  }, /*#__PURE__*/React.createElement(Text, {
392
392
  size: descTextSize,
393
393
  textColor: descTextColor,
@@ -404,24 +404,24 @@ function FieldWrapperBase(props) {
404
404
  fill: dividerFill
405
405
  })), showMessage && /*#__PURE__*/React.createElement("div", {
406
406
  className: "form-field__message",
407
- "data-test-id": `${inputName}FieldMessage`
407
+ "data-testid": `${inputName}-field-message`
408
408
  }, isErrorState && errorMessage && /*#__PURE__*/React.createElement(Text, {
409
409
  id: `${inputName}-error`,
410
- dataTestId: `${inputName}FieldMessageError`,
411
410
  className: "form-field__message-item form-field__message-item_type-error",
411
+ dataTestId: `${inputName}-field-message-error`,
412
412
  size: errorTextSize,
413
413
  textColor: errorTextColor,
414
414
  textWeight: errorTextWeight
415
415
  }, errorMessage), Boolean(helpText) && (!isErrorState || !errorMessage) && /*#__PURE__*/React.createElement(Text, {
416
- dataTestId: `${inputName}FieldMessageHelpText`,
417
416
  className: "form-field__message-item form-field__message-item_type_help-text",
417
+ dataTestId: `${inputName}-field-message-help-text`,
418
418
  size: helpTextSize,
419
419
  textColor: isValidState ? helpTextColorSuccess : helpTextColor,
420
420
  textWeight: helpTextWeight,
421
421
  sizeMobile: helpTextSizeMobile
422
422
  }, helpText), (!isErrorState && !helpText || isErrorState && !helpText && !errorMessage) && /*#__PURE__*/React.createElement(Text, {
423
- dataTestId: `${inputName}FieldMessageHelpText`,
424
423
  className: "form-field__message-item form-field__message-item_type_help-text",
424
+ dataTestId: `${inputName}field-message-help-text`,
425
425
  size: messageTextSize
426
426
  }, '\u00A0')), after);
427
427
  }
@@ -1714,7 +1714,7 @@ const FormFieldInput = /*#__PURE__*/React.memo(function FormFieldInput(props) {
1714
1714
  isValidState: isValidState
1715
1715
  }, fieldProps), /*#__PURE__*/React.createElement(Input, Object.assign({
1716
1716
  className: clsx(meta.active && 'input_state_focus', meta.error && meta.touched && `input_state_${errorKey}`),
1717
- dataTestId: `${input.name}FieldInput`,
1717
+ dataTestId: `${input.name}-field-input`,
1718
1718
  type: "text",
1719
1719
  name: input.name,
1720
1720
  autoComplete: "nope",
@@ -1911,7 +1911,7 @@ const FormFieldPassword = /*#__PURE__*/React.memo(function FormFieldPassword(pro
1911
1911
  isValidState: isValidState
1912
1912
  }, fieldProps), /*#__PURE__*/React.createElement(InputPassword, Object.assign({
1913
1913
  className: clsx(meta.active && 'input-password_state_focus', meta.error && meta.touched && `input-password_state_${errorKey}`),
1914
- dataTestId: `${input.name}FieldInputPassword`,
1914
+ dataTestId: `${input.name}-field-input-password`,
1915
1915
  name: input.name,
1916
1916
  autoComplete: "nope",
1917
1917
  value: input.value || '',
@@ -2337,11 +2337,11 @@ const defaultTextareaProps = {
2337
2337
  const FormFieldTextarea = /*#__PURE__*/React.memo(function FormFieldTextarea(props) {
2338
2338
  const {
2339
2339
  name,
2340
- isDisabled,
2341
2340
  classNameGroupItem,
2342
2341
  fieldProps = {},
2343
2342
  inputProps = {},
2344
2343
  showMessage,
2344
+ isDisabled,
2345
2345
  isRequired
2346
2346
  } = props;
2347
2347
  return /*#__PURE__*/React.createElement(Field, {
@@ -2360,8 +2360,8 @@ const FormFieldTextarea = /*#__PURE__*/React.memo(function FormFieldTextarea(pro
2360
2360
  const {
2361
2361
  errorKey,
2362
2362
  errorMessage,
2363
- isErrorState,
2364
2363
  successKey,
2364
+ isErrorState,
2365
2365
  isValidState
2366
2366
  } = useFieldValidationState({
2367
2367
  fieldProps: fieldProps,
@@ -2376,23 +2376,23 @@ const FormFieldTextarea = /*#__PURE__*/React.memo(function FormFieldTextarea(pro
2376
2376
  className: clsx('form-field_textarea', 'form__item_textarea', classNameGroupItem),
2377
2377
  errorKey: errorKey,
2378
2378
  errorMessage: errorMessage,
2379
- isErrorState: isErrorState,
2380
- metaError: meta.error,
2381
- isDisabled: isDisabled,
2382
2379
  fieldClassName: 'form-textarea',
2383
2380
  inputName: input.name,
2384
2381
  inputValue: input.value,
2385
2382
  metaActive: meta.active,
2383
+ metaError: meta.error,
2386
2384
  showMessage: showMessage,
2385
+ isDisabled: isDisabled,
2386
+ isErrorState: isErrorState,
2387
2387
  isRequired: isRequired,
2388
2388
  isValidState: isValidState
2389
2389
  }, fieldProps), /*#__PURE__*/React.createElement(Textarea, Object.assign({
2390
- dataTestId: `${input.name}FieldTextarea`,
2391
2390
  className: clsx(meta.active && 'textarea_state_focus', meta.error && meta.touched && `textarea_state_${errorKey}`),
2391
+ dataTestId: `${input.name}-field-textarea`,
2392
2392
  name: input.name,
2393
- isDisabled: isDisabled,
2394
2393
  autoComplete: "nope",
2395
2394
  value: input.value || '',
2395
+ isDisabled: isDisabled,
2396
2396
  onBlur: input.onBlur,
2397
2397
  onChange: input.onChange,
2398
2398
  onFocus: input.onFocus
@@ -2751,6 +2751,7 @@ const FinalForm = /*#__PURE__*/React.forwardRef(function FinalForm(props, ref) {
2751
2751
  dataTestId,
2752
2752
  dataTour,
2753
2753
  type,
2754
+ name,
2754
2755
  initialValues,
2755
2756
  initialValuesEqual,
2756
2757
  config,
@@ -2801,6 +2802,7 @@ const FinalForm = /*#__PURE__*/React.forwardRef(function FinalForm(props, ref) {
2801
2802
  primaryButtonAppearance,
2802
2803
  primaryButtonFill,
2803
2804
  primaryButtonFillHover,
2805
+ primaryButtonHtmlType,
2804
2806
  primaryButtonIsDisabled,
2805
2807
  primaryButtonIsLoading,
2806
2808
  primaryButtonLabel,
@@ -2808,6 +2810,7 @@ const FinalForm = /*#__PURE__*/React.forwardRef(function FinalForm(props, ref) {
2808
2810
  primaryButtonLabelTextColor,
2809
2811
  primaryButtonLabelTextWeight,
2810
2812
  primaryButtonSize,
2813
+ primarySecondaryHtmlType,
2811
2814
  renderFieldsWrapper = wrapperChildren => wrapperChildren,
2812
2815
  secondaryButton,
2813
2816
  secondaryButtonAppearance,
@@ -2866,14 +2869,14 @@ const FinalForm = /*#__PURE__*/React.forwardRef(function FinalForm(props, ref) {
2866
2869
  }) => {
2867
2870
  return /*#__PURE__*/React.createElement("form", {
2868
2871
  className: clsx(className, 'form', type && `form_type_${type}`, widthClass && `width_${widthClass}`, heightClass && `height_${heightClass}`, titlePosition && `form_title-position_${titlePosition}`, buttonPosition && `form_button-position_${buttonPosition}`, directionClass && `direction_${directionClass}`, fillClass && `fill_${fillClass}`, shapeClass && `shape_${shapeClass}`, shapeStrengthClass && `shape-strength_${shapeStrengthClass}`, elevationClass && `elevation_${elevationClass}`),
2869
- name: formName
2872
+ name: formName || 'form'
2870
2873
  // We no need set reference to html element, we need reference to "final-form" instance
2871
2874
  ,
2872
2875
  ref: () => onRefFormInstance(form),
2873
2876
  autoCapitalize: disableFieldsAutoComplete ? 'off' : undefined,
2874
2877
  autoComplete: disableFieldsAutoComplete ? 'off' : undefined,
2875
2878
  autoCorrect: disableFieldsAutoComplete ? 'off' : undefined,
2876
- "data-test-id": dataTestId,
2879
+ "data-testid": dataTestId || name,
2877
2880
  "data-tour": dataTour,
2878
2881
  spellCheck: disableFieldsAutoComplete ? 'false' : undefined,
2879
2882
  style: formStyles,
@@ -2930,7 +2933,7 @@ const FinalForm = /*#__PURE__*/React.forwardRef(function FinalForm(props, ref) {
2930
2933
  }, primaryButtonLabel ? /*#__PURE__*/React.createElement(Button, {
2931
2934
  appearance: primaryButtonAppearance,
2932
2935
  className: "form__button-item",
2933
- dataTestId: dataTestIdPrimaryButton,
2936
+ dataTestId: dataTestIdPrimaryButton || (name ? `${name}-primary` : 'form-primary'),
2934
2937
  dataTour: dataTourPrimaryButton,
2935
2938
  width: "fill",
2936
2939
  size: primaryButtonSize,
@@ -2940,12 +2943,13 @@ const FinalForm = /*#__PURE__*/React.forwardRef(function FinalForm(props, ref) {
2940
2943
  labelTextColor: primaryButtonLabelTextColor,
2941
2944
  labelTextSize: primaryButtonLabelSize,
2942
2945
  labelTextWeight: primaryButtonLabelTextWeight,
2946
+ htmlType: primaryButtonHtmlType || 'submit',
2943
2947
  loading: primaryButtonIsLoading,
2944
2948
  isDisabled: primaryButtonIsDisabled
2945
2949
  }) : primaryButton, secondaryButtonLabel ? /*#__PURE__*/React.createElement(Button, {
2946
2950
  appearance: secondaryButtonAppearance,
2947
2951
  className: "form__button-item",
2948
- dataTestId: dataTestIdSecondaryButton,
2952
+ dataTestId: dataTestIdSecondaryButton || (name ? `${name}-secondary` : 'form-secondary'),
2949
2953
  dataTour: dataTourSecondaryButton,
2950
2954
  width: "fill",
2951
2955
  size: secondaryButtonSize,
@@ -2955,6 +2959,7 @@ const FinalForm = /*#__PURE__*/React.forwardRef(function FinalForm(props, ref) {
2955
2959
  labelTextColor: secondaryButtonLabelTextColor,
2956
2960
  labelTextSize: secondaryButtonLabelSize,
2957
2961
  labelTextWeight: secondaryButtonLabelTextWeight,
2962
+ htmlType: primarySecondaryHtmlType,
2958
2963
  loading: secondaryButtonIsLoading,
2959
2964
  isDisabled: secondaryButtonIsDisabled,
2960
2965
  onClick: onClickSecondaryButton
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@itcase/forms",
3
- "version": "1.1.50",
3
+ "version": "1.1.52",
4
4
  "description": "Forms fields, inputs, etc.",
5
5
  "keywords": [],
6
6
  "license": "MIT",
@@ -32,23 +32,23 @@
32
32
  "registry": "https://registry.npmjs.org/"
33
33
  },
34
34
  "dependencies": {
35
- "@itcase/common": "^1.2.32",
36
- "@itcase/config": "^1.0.57",
37
- "@itcase/icons": "^1.2.23",
38
- "@itcase/storybook-config": "^1.2.13",
39
- "@itcase/tokens-am": "^1.1.20",
40
- "@itcase/tokens-baikal": "^1.1.17",
41
- "@itcase/ui": "^1.8.147",
42
- "axios": "^1.12.2",
35
+ "@itcase/common": "^1.2.34",
36
+ "@itcase/config": "^1.0.72",
37
+ "@itcase/icons": "^1.2.28",
38
+ "@itcase/storybook-config": "^1.2.29",
39
+ "@itcase/tokens-am": "^1.1.37",
40
+ "@itcase/tokens-baikal": "^1.1.37",
41
+ "@itcase/ui": "^1.9.28",
42
+ "axios": "^1.13.2",
43
43
  "clsx": "^2.1.1",
44
44
  "final-form": "4.20.10",
45
45
  "final-form-focus": "1.1.2",
46
- "libphonenumber-js": "^1.12.23",
46
+ "libphonenumber-js": "^1.12.31",
47
47
  "lodash": "^4.17.21",
48
48
  "luxon": "^3.7.2",
49
49
  "react": "^18.3.1",
50
50
  "react-date-range": "^2.0.1",
51
- "react-datepicker": "^8.7.0",
51
+ "react-datepicker": "^8.10.0",
52
52
  "react-dom": "^18.3.1",
53
53
  "react-dropzone": "^14.3.8",
54
54
  "react-final-form": "6.5.9",
@@ -56,16 +56,16 @@
56
56
  "react-select": "^5.10.2"
57
57
  },
58
58
  "devDependencies": {
59
- "@babel/core": "^7.28.4",
60
- "@babel/preset-env": "^7.28.3",
61
- "@babel/preset-react": "^7.27.1",
62
- "@commitlint/cli": "^20.1.0",
63
- "@commitlint/config-conventional": "^20.0.0",
64
- "@itcase/lint": "^1.1.67",
65
- "@rollup/plugin-babel": "^6.0.4",
66
- "@rollup/plugin-commonjs": "^28.0.6",
59
+ "@babel/core": "^7.28.5",
60
+ "@babel/preset-env": "^7.28.5",
61
+ "@babel/preset-react": "^7.28.5",
62
+ "@commitlint/cli": "^20.2.0",
63
+ "@commitlint/config-conventional": "^20.2.0",
64
+ "@itcase/lint": "^1.1.69",
65
+ "@rollup/plugin-babel": "^6.1.0",
66
+ "@rollup/plugin-commonjs": "^29.0.0",
67
67
  "@rollup/plugin-json": "^6.1.0",
68
- "@rollup/plugin-node-resolve": "^16.0.2",
68
+ "@rollup/plugin-node-resolve": "^16.0.3",
69
69
  "@semantic-release/changelog": "^6.0.3",
70
70
  "@semantic-release/git": "^10.0.1",
71
71
  "@semantic-release/release-notes-generator": "14.1.0",
@@ -74,16 +74,16 @@
74
74
  "babel-plugin-inline-react-svg": "^2.0.2",
75
75
  "babel-plugin-transform-react-remove-prop-types": "^0.4.24",
76
76
  "conventional-changelog-conventionalcommits": "^9.1.0",
77
- "eslint": "9.37.0",
77
+ "eslint": "9.39.1",
78
78
  "husky": "^9.1.7",
79
- "lint-staged": "^16.2.3",
79
+ "lint-staged": "^16.2.7",
80
80
  "postcss": "^8.5.6",
81
- "prettier": "3.6.2",
82
- "rollup": "^4.52.4",
81
+ "prettier": "3.7.4",
82
+ "rollup": "^4.53.3",
83
83
  "rollup-plugin-peer-deps-external": "^2.2.4",
84
- "semantic-release": "^24.2.9",
85
- "storybook": "^9.1.10",
86
- "stylelint": "^16.25.0",
84
+ "semantic-release": "^25.0.2",
85
+ "storybook": "^10.1.4",
86
+ "stylelint": "^16.26.1",
87
87
  "typescript": "^5.9.3",
88
88
  "yup": "^1.7.1"
89
89
  }