@itcase/forms 1.1.18 → 1.1.20
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/css/form/FormField/FormField.css +20 -15
- package/dist/itcase-forms.cjs.js +19 -13
- package/dist/itcase-forms.esm.js +20 -14
- package/package.json +9 -9
|
@@ -6,11 +6,10 @@
|
|
|
6
6
|
}
|
|
7
7
|
}
|
|
8
8
|
&__message {
|
|
9
|
-
padding: 4px 0 0 0;
|
|
10
9
|
&-item {
|
|
11
10
|
height: var(--form-field-helptext-height);
|
|
12
11
|
line-height: var(--form-field-helptext-line-height);
|
|
13
|
-
padding: var(--form-field-helptext-padding
|
|
12
|
+
padding: var(--form-field-helptext-padding);
|
|
14
13
|
display: block;
|
|
15
14
|
}
|
|
16
15
|
}
|
|
@@ -75,16 +74,16 @@
|
|
|
75
74
|
&_type {
|
|
76
75
|
&_normal {
|
|
77
76
|
position: relative;
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
77
|
+
@each $size in xl, l, m, s {
|
|
78
|
+
&.form-field_size_$(size) {
|
|
79
|
+
gap: var(--form-field_type_normal_$(size)-gap);
|
|
80
|
+
padding: var(--form-field_type_normal_$(size)-padding);
|
|
81
|
+
margin: var(--form-field_type_normal_$(size)-margin);
|
|
82
|
+
^^^&__label {
|
|
83
|
+
padding: var(--form-field_type_normal_$(size)-label-padding);
|
|
84
|
+
}
|
|
85
|
+
^^^&__message {
|
|
86
|
+
padding: var(--form-field_type_normal_$(size)-message-padding);
|
|
88
87
|
}
|
|
89
88
|
}
|
|
90
89
|
}
|
|
@@ -94,10 +93,10 @@
|
|
|
94
93
|
.form-field {
|
|
95
94
|
&_type {
|
|
96
95
|
&_classic {
|
|
97
|
-
position: relative;
|
|
98
|
-
gap: var(--form-field_type_normal-gap, 4px);
|
|
99
|
-
margin: var(--form-field_type_normal-margin);
|
|
100
96
|
padding: var(--form-field_type_normal-padding);
|
|
97
|
+
margin: var(--form-field_type_normal-margin);
|
|
98
|
+
position: relative;
|
|
99
|
+
gap: var(--form-field_type_normal-gap);
|
|
101
100
|
}
|
|
102
101
|
}
|
|
103
102
|
}
|
|
@@ -163,3 +162,9 @@
|
|
|
163
162
|
}
|
|
164
163
|
}
|
|
165
164
|
}
|
|
165
|
+
:root {
|
|
166
|
+
--form-field_type_normal_m-gap: 0.5m;
|
|
167
|
+
--form-field_type_normal_m-padding: 1.5m 0;
|
|
168
|
+
--form-field_type_normal_m-label-padding: 0 0.5m;
|
|
169
|
+
--form-field_type_normal_m-message-padding: 0 1.5m;
|
|
170
|
+
}
|
package/dist/itcase-forms.cjs.js
CHANGED
|
@@ -23,7 +23,6 @@ var castArray = require('lodash/castArray');
|
|
|
23
23
|
var reactDropzone = require('react-dropzone');
|
|
24
24
|
var common = require('@itcase/common');
|
|
25
25
|
var Button = require('@itcase/ui/components/Button');
|
|
26
|
-
var Group$1 = require('@itcase/ui/components/Group');
|
|
27
26
|
var Loader = require('@itcase/ui/components/Loader');
|
|
28
27
|
var Title = require('@itcase/ui/components/Title');
|
|
29
28
|
var Input = require('@itcase/ui/components/Input');
|
|
@@ -34,6 +33,7 @@ var Switch = require('@itcase/ui/components/Switch');
|
|
|
34
33
|
var Textarea = require('@itcase/ui/components/Textarea');
|
|
35
34
|
var reactImask = require('react-imask');
|
|
36
35
|
var Chips = require('@itcase/ui/components/Chips');
|
|
36
|
+
var Group$1 = require('@itcase/ui/components/Group');
|
|
37
37
|
var Notification = require('@itcase/ui/components/Notification');
|
|
38
38
|
var createDecorator = require('final-form-focus');
|
|
39
39
|
|
|
@@ -130,15 +130,16 @@ function useYupValidationSchema(schema, language) {
|
|
|
130
130
|
const defaultFieldProps = {
|
|
131
131
|
width: 'fill',
|
|
132
132
|
direction: 'vertical',
|
|
133
|
+
size: 'm',
|
|
133
134
|
labelTextColor: 'surfaceTextPrimary',
|
|
134
|
-
labelTextSize: '
|
|
135
|
+
labelTextSize: 's',
|
|
136
|
+
messageTextColor: 'surfaceTextSecondary',
|
|
137
|
+
messageTextSize: 's',
|
|
135
138
|
errorMessageTextColor: 'errorTextSecondary',
|
|
136
139
|
errorMessageTextSize: 's',
|
|
137
140
|
dividerFill: 'errorPrimary',
|
|
138
141
|
helpTextColor: 'surfaceTextQuaternary',
|
|
139
142
|
helpTextSize: 's',
|
|
140
|
-
messageTextColor: 'surfaceTextSecondary',
|
|
141
|
-
messageTextSize: 's',
|
|
142
143
|
requiredMessageTextColor: 'warningTextSecondary',
|
|
143
144
|
requiredMessageTextSize: 's',
|
|
144
145
|
showMessage: true
|
|
@@ -1546,10 +1547,10 @@ const InputField = /*#__PURE__*/React__default.default.memo(function InputField(
|
|
|
1546
1547
|
}
|
|
1547
1548
|
}, [onChange, input.onChange]);
|
|
1548
1549
|
const {
|
|
1549
|
-
isErrorState,
|
|
1550
|
-
isValidState,
|
|
1551
1550
|
errorKey,
|
|
1552
|
-
errorMessage
|
|
1551
|
+
errorMessage,
|
|
1552
|
+
isErrorState,
|
|
1553
|
+
isValidState
|
|
1553
1554
|
} = useFieldValidationState({
|
|
1554
1555
|
fieldProps: fieldProps,
|
|
1555
1556
|
input: input,
|
|
@@ -1559,6 +1560,7 @@ const InputField = /*#__PURE__*/React__default.default.memo(function InputField(
|
|
|
1559
1560
|
inputProps: inputProps,
|
|
1560
1561
|
validationStateKey: isErrorState ? errorKey : 'success'
|
|
1561
1562
|
});
|
|
1563
|
+
const isIconRevealableString = typeof iconRevealableHide === 'string' && typeof iconRevealableShow === 'string';
|
|
1562
1564
|
return /*#__PURE__*/React__default.default.createElement(FieldWrapper, Object.assign({
|
|
1563
1565
|
className: clsx__default.default('form-field_type_input', 'form__item_type_input', classNameGroupItem),
|
|
1564
1566
|
errorKey: errorKey,
|
|
@@ -1589,18 +1591,18 @@ const InputField = /*#__PURE__*/React__default.default.memo(function InputField(
|
|
|
1589
1591
|
size: iconSize,
|
|
1590
1592
|
iconFill: iconFill,
|
|
1591
1593
|
iconFillHover: iconFillHover,
|
|
1592
|
-
imageSrc: isRevealed ? iconRevealableHide : iconRevealableShow,
|
|
1594
|
+
imageSrc: isRevealed && isIconRevealableString ? iconRevealableHide : iconRevealableShow,
|
|
1593
1595
|
shape: iconShape,
|
|
1594
|
-
SvgImage: isRevealed ? iconRevealableHide : iconRevealableShow,
|
|
1596
|
+
SvgImage: isRevealed && !isIconRevealableString ? iconRevealableHide : iconRevealableShow,
|
|
1595
1597
|
onClick: onClickIconReveal
|
|
1596
1598
|
}), clearIcon && /*#__PURE__*/React__default.default.createElement(Icon.Icon, {
|
|
1597
1599
|
className: "form-field__icon",
|
|
1598
1600
|
size: clearIconSize,
|
|
1599
1601
|
iconFill: clearIconFill,
|
|
1600
1602
|
iconFillHover: clearIconFillHover,
|
|
1601
|
-
imageSrc: clearIcon,
|
|
1603
|
+
imageSrc: typeof clearIcon === 'string' && clearIcon,
|
|
1602
1604
|
shape: clearIconShape,
|
|
1603
|
-
SvgImage: clearIcon,
|
|
1605
|
+
SvgImage: typeof clearIcon !== 'string' && clearIcon,
|
|
1604
1606
|
onClick: onClickClearIcon
|
|
1605
1607
|
}));
|
|
1606
1608
|
});
|
|
@@ -2383,7 +2385,11 @@ function ChipsField(props) {
|
|
|
2383
2385
|
showMessage: showMessage,
|
|
2384
2386
|
isRequired: isRequired,
|
|
2385
2387
|
isValidState: isValidState
|
|
2386
|
-
}, fieldProps), options.length ?
|
|
2388
|
+
}, fieldProps), options.length ? /*#__PURE__*/React__default.default.createElement(Chips.ChipsGroup, {
|
|
2389
|
+
direction: "horizontal",
|
|
2390
|
+
gap: "1m",
|
|
2391
|
+
wrap: "wrap"
|
|
2392
|
+
}, options.map(option => /*#__PURE__*/React__default.default.createElement(Chips.Chips, Object.assign({
|
|
2387
2393
|
className: clsx__default.default(meta.active && 'form-chips_state_focus', meta.error && meta.touched && `form-chips_state_${errorKey}`),
|
|
2388
2394
|
key: option.value,
|
|
2389
2395
|
label: option.label,
|
|
@@ -2391,7 +2397,7 @@ function ChipsField(props) {
|
|
|
2391
2397
|
value: option.value,
|
|
2392
2398
|
isActive: activeOptionsList.some(activeOption => activeOption.value === option.value),
|
|
2393
2399
|
onClick: () => onChangeSomeInput(input.value, option.value)
|
|
2394
|
-
}, updatedInputProps))) : /*#__PURE__*/React__default.default.createElement(Text.Text, {
|
|
2400
|
+
}, updatedInputProps)))) : /*#__PURE__*/React__default.default.createElement(Text.Text, {
|
|
2395
2401
|
size: emptyMessageTextSize,
|
|
2396
2402
|
textColor: emptyMessageTextColor
|
|
2397
2403
|
}, emptyMessage));
|
package/dist/itcase-forms.esm.js
CHANGED
|
@@ -22,7 +22,6 @@ import castArray from 'lodash/castArray';
|
|
|
22
22
|
import { useDropzone, ErrorCode } from 'react-dropzone';
|
|
23
23
|
import { createFileFromDataURL } from '@itcase/common';
|
|
24
24
|
import { Button } from '@itcase/ui/components/Button';
|
|
25
|
-
import { Group as Group$1 } from '@itcase/ui/components/Group';
|
|
26
25
|
import { Loader } from '@itcase/ui/components/Loader';
|
|
27
26
|
import { Title } from '@itcase/ui/components/Title';
|
|
28
27
|
import { Input } from '@itcase/ui/components/Input';
|
|
@@ -32,7 +31,8 @@ import { Select } from '@itcase/ui/components/Select';
|
|
|
32
31
|
import { Switch } from '@itcase/ui/components/Switch';
|
|
33
32
|
import { Textarea } from '@itcase/ui/components/Textarea';
|
|
34
33
|
import { useIMask } from 'react-imask';
|
|
35
|
-
import { Chips } from '@itcase/ui/components/Chips';
|
|
34
|
+
import { ChipsGroup, Chips } from '@itcase/ui/components/Chips';
|
|
35
|
+
import { Group as Group$1 } from '@itcase/ui/components/Group';
|
|
36
36
|
import { Notification } from '@itcase/ui/components/Notification';
|
|
37
37
|
import createDecorator from 'final-form-focus';
|
|
38
38
|
|
|
@@ -119,15 +119,16 @@ function useYupValidationSchema(schema, language) {
|
|
|
119
119
|
const defaultFieldProps = {
|
|
120
120
|
width: 'fill',
|
|
121
121
|
direction: 'vertical',
|
|
122
|
+
size: 'm',
|
|
122
123
|
labelTextColor: 'surfaceTextPrimary',
|
|
123
|
-
labelTextSize: '
|
|
124
|
+
labelTextSize: 's',
|
|
125
|
+
messageTextColor: 'surfaceTextSecondary',
|
|
126
|
+
messageTextSize: 's',
|
|
124
127
|
errorMessageTextColor: 'errorTextSecondary',
|
|
125
128
|
errorMessageTextSize: 's',
|
|
126
129
|
dividerFill: 'errorPrimary',
|
|
127
130
|
helpTextColor: 'surfaceTextQuaternary',
|
|
128
131
|
helpTextSize: 's',
|
|
129
|
-
messageTextColor: 'surfaceTextSecondary',
|
|
130
|
-
messageTextSize: 's',
|
|
131
132
|
requiredMessageTextColor: 'warningTextSecondary',
|
|
132
133
|
requiredMessageTextSize: 's',
|
|
133
134
|
showMessage: true
|
|
@@ -1535,10 +1536,10 @@ const InputField = /*#__PURE__*/React$1.memo(function InputField(props) {
|
|
|
1535
1536
|
}
|
|
1536
1537
|
}, [onChange, input.onChange]);
|
|
1537
1538
|
const {
|
|
1538
|
-
isErrorState,
|
|
1539
|
-
isValidState,
|
|
1540
1539
|
errorKey,
|
|
1541
|
-
errorMessage
|
|
1540
|
+
errorMessage,
|
|
1541
|
+
isErrorState,
|
|
1542
|
+
isValidState
|
|
1542
1543
|
} = useFieldValidationState({
|
|
1543
1544
|
fieldProps: fieldProps,
|
|
1544
1545
|
input: input,
|
|
@@ -1548,6 +1549,7 @@ const InputField = /*#__PURE__*/React$1.memo(function InputField(props) {
|
|
|
1548
1549
|
inputProps: inputProps,
|
|
1549
1550
|
validationStateKey: isErrorState ? errorKey : 'success'
|
|
1550
1551
|
});
|
|
1552
|
+
const isIconRevealableString = typeof iconRevealableHide === 'string' && typeof iconRevealableShow === 'string';
|
|
1551
1553
|
return /*#__PURE__*/React$1.createElement(FieldWrapper, Object.assign({
|
|
1552
1554
|
className: clsx('form-field_type_input', 'form__item_type_input', classNameGroupItem),
|
|
1553
1555
|
errorKey: errorKey,
|
|
@@ -1578,18 +1580,18 @@ const InputField = /*#__PURE__*/React$1.memo(function InputField(props) {
|
|
|
1578
1580
|
size: iconSize,
|
|
1579
1581
|
iconFill: iconFill,
|
|
1580
1582
|
iconFillHover: iconFillHover,
|
|
1581
|
-
imageSrc: isRevealed ? iconRevealableHide : iconRevealableShow,
|
|
1583
|
+
imageSrc: isRevealed && isIconRevealableString ? iconRevealableHide : iconRevealableShow,
|
|
1582
1584
|
shape: iconShape,
|
|
1583
|
-
SvgImage: isRevealed ? iconRevealableHide : iconRevealableShow,
|
|
1585
|
+
SvgImage: isRevealed && !isIconRevealableString ? iconRevealableHide : iconRevealableShow,
|
|
1584
1586
|
onClick: onClickIconReveal
|
|
1585
1587
|
}), clearIcon && /*#__PURE__*/React$1.createElement(Icon, {
|
|
1586
1588
|
className: "form-field__icon",
|
|
1587
1589
|
size: clearIconSize,
|
|
1588
1590
|
iconFill: clearIconFill,
|
|
1589
1591
|
iconFillHover: clearIconFillHover,
|
|
1590
|
-
imageSrc: clearIcon,
|
|
1592
|
+
imageSrc: typeof clearIcon === 'string' && clearIcon,
|
|
1591
1593
|
shape: clearIconShape,
|
|
1592
|
-
SvgImage: clearIcon,
|
|
1594
|
+
SvgImage: typeof clearIcon !== 'string' && clearIcon,
|
|
1593
1595
|
onClick: onClickClearIcon
|
|
1594
1596
|
}));
|
|
1595
1597
|
});
|
|
@@ -2372,7 +2374,11 @@ function ChipsField(props) {
|
|
|
2372
2374
|
showMessage: showMessage,
|
|
2373
2375
|
isRequired: isRequired,
|
|
2374
2376
|
isValidState: isValidState
|
|
2375
|
-
}, fieldProps), options.length ?
|
|
2377
|
+
}, fieldProps), options.length ? /*#__PURE__*/React$1.createElement(ChipsGroup, {
|
|
2378
|
+
direction: "horizontal",
|
|
2379
|
+
gap: "1m",
|
|
2380
|
+
wrap: "wrap"
|
|
2381
|
+
}, options.map(option => /*#__PURE__*/React$1.createElement(Chips, Object.assign({
|
|
2376
2382
|
className: clsx(meta.active && 'form-chips_state_focus', meta.error && meta.touched && `form-chips_state_${errorKey}`),
|
|
2377
2383
|
key: option.value,
|
|
2378
2384
|
label: option.label,
|
|
@@ -2380,7 +2386,7 @@ function ChipsField(props) {
|
|
|
2380
2386
|
value: option.value,
|
|
2381
2387
|
isActive: activeOptionsList.some(activeOption => activeOption.value === option.value),
|
|
2382
2388
|
onClick: () => onChangeSomeInput(input.value, option.value)
|
|
2383
|
-
}, updatedInputProps))) : /*#__PURE__*/React$1.createElement(Text, {
|
|
2389
|
+
}, updatedInputProps)))) : /*#__PURE__*/React$1.createElement(Text, {
|
|
2384
2390
|
size: emptyMessageTextSize,
|
|
2385
2391
|
textColor: emptyMessageTextColor
|
|
2386
2392
|
}, emptyMessage));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@itcase/forms",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.20",
|
|
4
4
|
"description": "Forms fields, inputs, etc.",
|
|
5
5
|
"keywords": [],
|
|
6
6
|
"license": "MIT",
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"@itcase/storybook-config": "^1.1.14",
|
|
39
39
|
"@itcase/tokens-am": "^1.1.9",
|
|
40
40
|
"@itcase/tokens-baikal": "^1.1.9",
|
|
41
|
-
"@itcase/ui": "^1.8.
|
|
41
|
+
"@itcase/ui": "^1.8.39",
|
|
42
42
|
"axios": "^1.10.0",
|
|
43
43
|
"clsx": "^2.1.1",
|
|
44
44
|
"final-form": "4.20.10",
|
|
@@ -57,9 +57,9 @@
|
|
|
57
57
|
},
|
|
58
58
|
"devDependencies": {
|
|
59
59
|
"@itcase/lint": "^1.1.19",
|
|
60
|
-
"@babel/core": "^7.
|
|
61
|
-
"@babel/eslint-parser": "^7.
|
|
62
|
-
"@babel/preset-env": "^7.
|
|
60
|
+
"@babel/core": "^7.28.0",
|
|
61
|
+
"@babel/eslint-parser": "^7.28.0",
|
|
62
|
+
"@babel/preset-env": "^7.28.0",
|
|
63
63
|
"@babel/preset-react": "^7.27.1",
|
|
64
64
|
"@commitlint/cli": "^19.8.1",
|
|
65
65
|
"@commitlint/config-conventional": "^19.8.1",
|
|
@@ -76,15 +76,15 @@
|
|
|
76
76
|
"babel-plugin-inline-react-svg": "^2.0.2",
|
|
77
77
|
"babel-plugin-transform-react-remove-prop-types": "^0.4.24",
|
|
78
78
|
"conventional-changelog-conventionalcommits": "^9.0.0",
|
|
79
|
-
"eslint": "9.
|
|
79
|
+
"eslint": "9.30.1",
|
|
80
80
|
"husky": "^9.1.7",
|
|
81
81
|
"lint-staged": "^16.1.2",
|
|
82
82
|
"postcss": "^8.5.6",
|
|
83
|
-
"prettier": "3.6.
|
|
83
|
+
"prettier": "3.6.2",
|
|
84
84
|
"rollup": "^4.44.1",
|
|
85
85
|
"rollup-plugin-peer-deps-external": "^2.2.4",
|
|
86
|
-
"semantic-release": "^24.2.
|
|
87
|
-
"stylelint": "^16.21.
|
|
86
|
+
"semantic-release": "^24.2.6",
|
|
87
|
+
"stylelint": "^16.21.1",
|
|
88
88
|
"typescript": "^5.8.3",
|
|
89
89
|
"yup": "^1.6.1"
|
|
90
90
|
}
|