@itcase/forms 1.0.61 → 1.0.63

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.
@@ -138,7 +138,7 @@ function FieldWrapperBase(props) {
138
138
  desc,
139
139
  descTextColor,
140
140
  descTextSize,
141
- descTextWidth,
141
+ descTextWeight,
142
142
  dividerDirection,
143
143
  dividerFill,
144
144
  dividerSize,
@@ -154,7 +154,7 @@ function FieldWrapperBase(props) {
154
154
  labelHidden,
155
155
  labelTextColor,
156
156
  labelTextSize,
157
- labelTextWidth,
157
+ labelTextWeight,
158
158
  helpText,
159
159
  helpTextSize,
160
160
  helpTextWeight,
@@ -224,14 +224,14 @@ function FieldWrapperBase(props) {
224
224
  }, /*#__PURE__*/React__default.default.createElement(Text.Text, {
225
225
  size: labelTextSize,
226
226
  textColor: labelTextColor,
227
- textWeight: labelTextWidth
227
+ textWeight: labelTextWeight
228
228
  }, label, labelHidden && '\u00A0')), desc && /*#__PURE__*/React__default.default.createElement("div", {
229
229
  className: "form-field__desc",
230
230
  "data-test-id": `${inputName}FieldDesc`
231
231
  }, /*#__PURE__*/React__default.default.createElement(Text.Text, {
232
232
  size: descTextSize,
233
233
  textColor: descTextColor,
234
- textWeight: descTextWidth
234
+ textWeight: descTextWeight
235
235
  }, desc)), /*#__PURE__*/React__default.default.createElement("div", {
236
236
  className: clsx__default.default('form-field__content', inputFillClass, inputShapeClass)
237
237
  }, /*#__PURE__*/React__default.default.createElement("div", {
@@ -284,7 +284,7 @@ FieldWrapperBase.propTypes = {
284
284
  desc: PropTypes__default.default.string,
285
285
  descTextColor: PropTypes__default.default.string,
286
286
  descTextSize: PropTypes__default.default.string,
287
- descTextWidth: PropTypes__default.default.string,
287
+ descTextWeight: PropTypes__default.default.string,
288
288
  dividerDirection: PropTypes__default.default.string,
289
289
  dividerFill: PropTypes__default.default.string,
290
290
  dividerSize: PropTypes__default.default.string,
@@ -304,13 +304,12 @@ FieldWrapperBase.propTypes = {
304
304
  labelHidden: PropTypes__default.default.bool,
305
305
  labelTextColor: PropTypes__default.default.string,
306
306
  labelTextSize: PropTypes__default.default.string,
307
- labelTextWidth: PropTypes__default.default.string,
307
+ labelTextWeight: PropTypes__default.default.string,
308
308
  message: PropTypes__default.default.string,
309
309
  messageSize: PropTypes__default.default.string,
310
310
  messageTextColor: PropTypes__default.default.string,
311
311
  messageTextSize: PropTypes__default.default.oneOfType([PropTypes__default.default.string, PropTypes__default.default.number]),
312
312
  messageTextWeight: PropTypes__default.default.oneOfType([PropTypes__default.default.string, PropTypes__default.default.number]),
313
- messageTextWidth: PropTypes__default.default.string,
314
313
  metaActive: PropTypes__default.default.bool,
315
314
  metaError: PropTypes__default.default.oneOfType([PropTypes__default.default.string, PropTypes__default.default.bool]),
316
315
  set: PropTypes__default.default.string,
@@ -339,9 +338,9 @@ FieldWrapper.propTypes = FieldWrapperBase.propTypes;
339
338
  // Whether to display an error message based on "fieldProps" and meta-objects
340
339
  function useFieldValidationState(props) {
341
340
  const {
342
- fieldProps,
343
- meta,
344
- input
341
+ fieldProps = {},
342
+ meta = {},
343
+ input = {}
345
344
  } = props;
346
345
  // Determines if there's a submission error that hasn't been rectified since the last submission.
347
346
  const submitError = !meta.modifiedSinceLastSubmit && meta.submitError;
@@ -540,7 +539,7 @@ const ChoiceField = /*#__PURE__*/React__default.default.memo(function ChoiceFiel
540
539
  initialValue,
541
540
  inputProps,
542
541
  isDisabled,
543
- isMultiple,
542
+ isCheckbox,
544
543
  isRequired,
545
544
  label,
546
545
  messageType,
@@ -617,8 +616,8 @@ const ChoiceField = /*#__PURE__*/React__default.default.memo(function ChoiceFiel
617
616
  active: activeOption,
618
617
  className: clsx__default.default(meta.active && 'form-choice_state_focus', meta.error && meta.touched && `form-choice_state_${errorKey}`),
619
618
  inputValue: input.value || [],
619
+ isCheckbox: isCheckbox,
620
620
  isDisabled: isDisabled,
621
- isMultiple: isMultiple,
622
621
  isRequired: isRequired,
623
622
  name: input.name,
624
623
  options: options,
@@ -632,12 +631,16 @@ ChoiceField.propTypes = {
632
631
  fieldProps: PropTypes__default.default.object,
633
632
  initialValue: PropTypes__default.default.oneOfType([PropTypes__default.default.string, PropTypes__default.default.number, PropTypes__default.default.bool]),
634
633
  inputProps: PropTypes__default.default.object,
634
+ isCheckbox: PropTypes__default.default.bool,
635
635
  isDisabled: PropTypes__default.default.bool,
636
- isMultiple: PropTypes__default.default.bool,
637
636
  isRequired: PropTypes__default.default.bool,
638
637
  label: PropTypes__default.default.oneOfType([PropTypes__default.default.string, PropTypes__default.default.element]),
639
638
  messageType: PropTypes__default.default.string,
640
639
  name: PropTypes__default.default.string,
640
+ options: PropTypes__default.default.arrayOf(PropTypes__default.default.shape({
641
+ label: PropTypes__default.default.string,
642
+ value: PropTypes__default.default.oneOfType([PropTypes__default.default.string, PropTypes__default.default.number])
643
+ })),
641
644
  placeholder: PropTypes__default.default.string,
642
645
  showMessage: PropTypes__default.default.bool,
643
646
  onChange: PropTypes__default.default.func
@@ -1498,7 +1501,7 @@ const Group = /*#__PURE__*/React__default.default.memo(function Group(props) {
1498
1501
  "data-tour": dataTour
1499
1502
  }, /*#__PURE__*/React__default.default.createElement("div", {
1500
1503
  className: "form__group-wrapper"
1501
- }, before, /*#__PURE__*/React__default.default.createElement("div", {
1504
+ }, before, label && /*#__PURE__*/React__default.default.createElement("div", {
1502
1505
  className: "form__group-label"
1503
1506
  }, /*#__PURE__*/React__default.default.createElement(Title.Title, {
1504
1507
  size: labelTextSize,
@@ -2014,7 +2017,8 @@ const SelectField = /*#__PURE__*/React__default.default.memo(function SelectFiel
2014
2017
  selectProps,
2015
2018
  selectRef,
2016
2019
  showMessage,
2017
- onChange
2020
+ onChange,
2021
+ onInputChange
2018
2022
  } = props;
2019
2023
  return /*#__PURE__*/React__default.default.createElement(reactFinalForm.Field, {
2020
2024
  name: name
@@ -2086,7 +2090,8 @@ const SelectField = /*#__PURE__*/React__default.default.memo(function SelectFiel
2086
2090
  options: options,
2087
2091
  ref: selectRef,
2088
2092
  value: selectedOptions,
2089
- onChange: onChangeValue
2093
+ onChange: onChangeValue,
2094
+ onInputChange: onInputChange
2090
2095
  }, updatedSelectProps)));
2091
2096
  });
2092
2097
  });
@@ -124,7 +124,7 @@ function FieldWrapperBase(props) {
124
124
  desc,
125
125
  descTextColor,
126
126
  descTextSize,
127
- descTextWidth,
127
+ descTextWeight,
128
128
  dividerDirection,
129
129
  dividerFill,
130
130
  dividerSize,
@@ -140,7 +140,7 @@ function FieldWrapperBase(props) {
140
140
  labelHidden,
141
141
  labelTextColor,
142
142
  labelTextSize,
143
- labelTextWidth,
143
+ labelTextWeight,
144
144
  helpText,
145
145
  helpTextSize,
146
146
  helpTextWeight,
@@ -210,14 +210,14 @@ function FieldWrapperBase(props) {
210
210
  }, /*#__PURE__*/React.createElement(Text, {
211
211
  size: labelTextSize,
212
212
  textColor: labelTextColor,
213
- textWeight: labelTextWidth
213
+ textWeight: labelTextWeight
214
214
  }, label, labelHidden && '\u00A0')), desc && /*#__PURE__*/React.createElement("div", {
215
215
  className: "form-field__desc",
216
216
  "data-test-id": `${inputName}FieldDesc`
217
217
  }, /*#__PURE__*/React.createElement(Text, {
218
218
  size: descTextSize,
219
219
  textColor: descTextColor,
220
- textWeight: descTextWidth
220
+ textWeight: descTextWeight
221
221
  }, desc)), /*#__PURE__*/React.createElement("div", {
222
222
  className: clsx('form-field__content', inputFillClass, inputShapeClass)
223
223
  }, /*#__PURE__*/React.createElement("div", {
@@ -270,7 +270,7 @@ FieldWrapperBase.propTypes = {
270
270
  desc: PropTypes.string,
271
271
  descTextColor: PropTypes.string,
272
272
  descTextSize: PropTypes.string,
273
- descTextWidth: PropTypes.string,
273
+ descTextWeight: PropTypes.string,
274
274
  dividerDirection: PropTypes.string,
275
275
  dividerFill: PropTypes.string,
276
276
  dividerSize: PropTypes.string,
@@ -290,13 +290,12 @@ FieldWrapperBase.propTypes = {
290
290
  labelHidden: PropTypes.bool,
291
291
  labelTextColor: PropTypes.string,
292
292
  labelTextSize: PropTypes.string,
293
- labelTextWidth: PropTypes.string,
293
+ labelTextWeight: PropTypes.string,
294
294
  message: PropTypes.string,
295
295
  messageSize: PropTypes.string,
296
296
  messageTextColor: PropTypes.string,
297
297
  messageTextSize: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
298
298
  messageTextWeight: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
299
- messageTextWidth: PropTypes.string,
300
299
  metaActive: PropTypes.bool,
301
300
  metaError: PropTypes.oneOfType([PropTypes.string, PropTypes.bool]),
302
301
  set: PropTypes.string,
@@ -325,9 +324,9 @@ FieldWrapper.propTypes = FieldWrapperBase.propTypes;
325
324
  // Whether to display an error message based on "fieldProps" and meta-objects
326
325
  function useFieldValidationState(props) {
327
326
  const {
328
- fieldProps,
329
- meta,
330
- input
327
+ fieldProps = {},
328
+ meta = {},
329
+ input = {}
331
330
  } = props;
332
331
  // Determines if there's a submission error that hasn't been rectified since the last submission.
333
332
  const submitError = !meta.modifiedSinceLastSubmit && meta.submitError;
@@ -526,7 +525,7 @@ const ChoiceField = /*#__PURE__*/React.memo(function ChoiceField(props) {
526
525
  initialValue,
527
526
  inputProps,
528
527
  isDisabled,
529
- isMultiple,
528
+ isCheckbox,
530
529
  isRequired,
531
530
  label,
532
531
  messageType,
@@ -603,8 +602,8 @@ const ChoiceField = /*#__PURE__*/React.memo(function ChoiceField(props) {
603
602
  active: activeOption,
604
603
  className: clsx(meta.active && 'form-choice_state_focus', meta.error && meta.touched && `form-choice_state_${errorKey}`),
605
604
  inputValue: input.value || [],
605
+ isCheckbox: isCheckbox,
606
606
  isDisabled: isDisabled,
607
- isMultiple: isMultiple,
608
607
  isRequired: isRequired,
609
608
  name: input.name,
610
609
  options: options,
@@ -618,12 +617,16 @@ ChoiceField.propTypes = {
618
617
  fieldProps: PropTypes.object,
619
618
  initialValue: PropTypes.oneOfType([PropTypes.string, PropTypes.number, PropTypes.bool]),
620
619
  inputProps: PropTypes.object,
620
+ isCheckbox: PropTypes.bool,
621
621
  isDisabled: PropTypes.bool,
622
- isMultiple: PropTypes.bool,
623
622
  isRequired: PropTypes.bool,
624
623
  label: PropTypes.oneOfType([PropTypes.string, PropTypes.element]),
625
624
  messageType: PropTypes.string,
626
625
  name: PropTypes.string,
626
+ options: PropTypes.arrayOf(PropTypes.shape({
627
+ label: PropTypes.string,
628
+ value: PropTypes.oneOfType([PropTypes.string, PropTypes.number])
629
+ })),
627
630
  placeholder: PropTypes.string,
628
631
  showMessage: PropTypes.bool,
629
632
  onChange: PropTypes.func
@@ -1484,7 +1487,7 @@ const Group = /*#__PURE__*/React.memo(function Group(props) {
1484
1487
  "data-tour": dataTour
1485
1488
  }, /*#__PURE__*/React.createElement("div", {
1486
1489
  className: "form__group-wrapper"
1487
- }, before, /*#__PURE__*/React.createElement("div", {
1490
+ }, before, label && /*#__PURE__*/React.createElement("div", {
1488
1491
  className: "form__group-label"
1489
1492
  }, /*#__PURE__*/React.createElement(Title, {
1490
1493
  size: labelTextSize,
@@ -2000,7 +2003,8 @@ const SelectField = /*#__PURE__*/React.memo(function SelectField(props) {
2000
2003
  selectProps,
2001
2004
  selectRef,
2002
2005
  showMessage,
2003
- onChange
2006
+ onChange,
2007
+ onInputChange
2004
2008
  } = props;
2005
2009
  return /*#__PURE__*/React.createElement(Field, {
2006
2010
  name: name
@@ -2072,7 +2076,8 @@ const SelectField = /*#__PURE__*/React.memo(function SelectField(props) {
2072
2076
  options: options,
2073
2077
  ref: selectRef,
2074
2078
  value: selectedOptions,
2075
- onChange: onChangeValue
2079
+ onChange: onChangeValue,
2080
+ onInputChange: onInputChange
2076
2081
  }, updatedSelectProps)));
2077
2082
  });
2078
2083
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@itcase/forms",
3
- "version": "1.0.61",
3
+ "version": "1.0.63",
4
4
  "description": "Forms fields, inputs, etc.",
5
5
  "keywords": [],
6
6
  "license": "MIT",
@@ -30,20 +30,20 @@
30
30
  "registry": "https://registry.npmjs.org/"
31
31
  },
32
32
  "dependencies": {
33
- "@itcase/common": "^1.2.1",
34
- "@itcase/ui": "^1.1.10",
33
+ "@itcase/common": "^1.2.2",
34
+ "@itcase/ui": "^1.1.15",
35
35
  "axios": "^1.7.2",
36
36
  "clsx": "^2.1.1",
37
37
  "final-form": "^4.20.10",
38
38
  "final-form-focus": "^1.1.2",
39
- "libphonenumber-js": "^1.11.2",
39
+ "libphonenumber-js": "^1.11.4",
40
40
  "lodash": "^4.17.21",
41
41
  "luxon": "^3.4.4",
42
- "postcss": "^8.4.38",
42
+ "postcss": "^8.4.39",
43
43
  "prop-types": "^15.8.1",
44
44
  "react": "^18.3.1",
45
45
  "react-date-range": "^2.0.1",
46
- "react-datepicker": "^6.9.0",
46
+ "react-datepicker": "^7.3.0",
47
47
  "react-dom": "^18.3.1",
48
48
  "react-dropzone": "^14.2.3",
49
49
  "react-final-form": "^6.5.9",
@@ -51,38 +51,39 @@
51
51
  "react-select": "^5.8.0"
52
52
  },
53
53
  "devDependencies": {
54
- "@babel/core": "^7.24.6",
55
- "@babel/eslint-parser": "^7.24.6",
56
- "@babel/preset-env": "^7.24.6",
57
- "@babel/preset-react": "^7.24.6",
54
+ "@babel/core": "^7.24.9",
55
+ "@babel/eslint-parser": "^7.24.8",
56
+ "@babel/preset-env": "^7.24.8",
57
+ "@babel/preset-react": "^7.24.7",
58
58
  "@commitlint/cli": "^19.3.0",
59
59
  "@commitlint/config-conventional": "^19.2.2",
60
- "@eslint/compat": "^1.0.1",
60
+ "@eslint/compat": "^1.1.1",
61
61
  "@eslint/eslintrc": "^3.1.0",
62
- "@ianvs/prettier-plugin-sort-imports": "^4.2.1",
62
+ "@ianvs/prettier-plugin-sort-imports": "^4.3.1",
63
63
  "@rollup/plugin-babel": "^6.0.4",
64
- "@rollup/plugin-commonjs": "^25.0.8",
64
+ "@rollup/plugin-commonjs": "^26.0.1",
65
65
  "@rollup/plugin-json": "^6.1.0",
66
66
  "@rollup/plugin-node-resolve": "^15.2.3",
67
67
  "@rollup/plugin-terser": "^0.4.4",
68
68
  "@semantic-release/git": "^10.0.1",
69
69
  "babel-plugin-inline-react-svg": "^2.0.2",
70
70
  "babel-plugin-transform-react-remove-prop-types": "^0.4.24",
71
- "eslint": "9.3.0",
71
+ "conventional-changelog-conventionalcommits": "^8.0.0",
72
+ "eslint": "9.7.0",
72
73
  "eslint-config-prettier": "9.1.0",
73
74
  "eslint-config-standard": "17.1.0",
74
75
  "eslint-plugin-babel": "5.3.1",
75
76
  "eslint-plugin-import": "2.29.1",
76
- "eslint-plugin-n": "17.7.0",
77
+ "eslint-plugin-n": "17.9.0",
77
78
  "eslint-plugin-node": "11.1.0",
78
79
  "eslint-plugin-prettier": "5.1.3",
79
- "eslint-plugin-promise": "6.2.0",
80
- "eslint-plugin-react": "7.34.2",
80
+ "eslint-plugin-promise": "6.4.0",
81
+ "eslint-plugin-react": "7.34.4",
81
82
  "eslint-plugin-react-hooks": "4.6.2",
82
83
  "eslint-plugin-standard": "5.0.0",
83
84
  "husky": "^9.0.11",
84
- "lint-staged": "^15.2.5",
85
- "npm": "^10.8.0",
85
+ "lint-staged": "^15.2.7",
86
+ "npm": "^10.8.2",
86
87
  "postcss-aspect-ratio-polyfill": "^2.0.0",
87
88
  "postcss-cli": "^11.0.0",
88
89
  "postcss-combine-duplicated-selectors": "^10.0.3",
@@ -100,16 +101,16 @@
100
101
  "postcss-nested-ancestors": "^3.0.0",
101
102
  "postcss-normalize": "^10.0.1",
102
103
  "postcss-prepend-imports": "^1.0.1",
103
- "postcss-preset-env": "^9.5.14",
104
+ "postcss-preset-env": "^9.6.0",
104
105
  "postcss-pxtorem": "^6.1.0",
105
106
  "postcss-responsive-type": "github:ITCase/postcss-responsive-type",
106
107
  "postcss-sort-media-queries": "^5.2.0",
107
- "prettier": "3.2.5",
108
- "rollup": "^4.18.0",
108
+ "prettier": "3.3.3",
109
+ "rollup": "^4.18.1",
109
110
  "rollup-plugin-peer-deps-external": "^2.2.4",
110
- "semantic-release": "^23.1.1",
111
- "stylelint": "^16.6.1",
112
- "stylelint-config-standard": "^36.0.0",
111
+ "semantic-release": "^24.0.0",
112
+ "stylelint": "^16.7.0",
113
+ "stylelint-config-standard": "^36.0.1",
113
114
  "stylelint-no-unsupported-browser-features": "^8.0.1",
114
115
  "stylelint-order": "^6.0.4"
115
116
  }