@itcase/forms 1.0.25 → 1.0.26
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
.form-dropzone {
|
|
2
|
+
flex-direction: column;
|
|
2
3
|
&__dropzone {
|
|
3
4
|
width: 100%;
|
|
4
5
|
box-shadow: none;
|
|
@@ -6,10 +7,9 @@
|
|
|
6
7
|
outline: 0;
|
|
7
8
|
@mixin easing easeOutQuart, all, 0.2s;
|
|
8
9
|
&-wrapper {
|
|
9
|
-
display:
|
|
10
|
-
gap:
|
|
11
|
-
|
|
12
|
-
flex-flow: row wrap;
|
|
10
|
+
display: grid;
|
|
11
|
+
gap: 16px;
|
|
12
|
+
grid-template-columns: repeat(3, minmax(0, 1fr));
|
|
13
13
|
}
|
|
14
14
|
&_size {
|
|
15
15
|
@each $size in normal, compact {
|
|
@@ -29,6 +29,7 @@
|
|
|
29
29
|
align-content: center;
|
|
30
30
|
align-items: center;
|
|
31
31
|
cursor: pointer;
|
|
32
|
+
grid-column: span 3;
|
|
32
33
|
&-title {
|
|
33
34
|
padding: 0 0 8px 0;
|
|
34
35
|
margin: 0;
|
|
@@ -48,13 +49,20 @@
|
|
|
48
49
|
}
|
|
49
50
|
}
|
|
50
51
|
&__thumb {
|
|
51
|
-
flex: 30%;
|
|
52
52
|
display: grid;
|
|
53
53
|
column-gap: 8px;
|
|
54
54
|
grid-template-columns: min-content 1fr;
|
|
55
55
|
grid-template-rows: auto 1fr;
|
|
56
|
-
margin: 0 0 16px 0;
|
|
57
56
|
padding: 8px 16px 8px 8px;
|
|
57
|
+
position: relative;
|
|
58
|
+
&-loader {
|
|
59
|
+
position: absolute;
|
|
60
|
+
left: 0;
|
|
61
|
+
top: 0;
|
|
62
|
+
width: 100%;
|
|
63
|
+
height: 100%;
|
|
64
|
+
display: flex;
|
|
65
|
+
}
|
|
58
66
|
&-image {
|
|
59
67
|
width: 160px;
|
|
60
68
|
height: 160px;
|
package/dist/itcase-forms.cjs.js
CHANGED
|
@@ -19,6 +19,7 @@ var reactDropzone = require('react-dropzone');
|
|
|
19
19
|
var fileSelector = require('file-selector');
|
|
20
20
|
var castArray = require('lodash/castArray');
|
|
21
21
|
var common = require('@itcase/common');
|
|
22
|
+
var Loader = require('@itcase/ui/components/Loader');
|
|
22
23
|
var Title = require('@itcase/ui/components/Title');
|
|
23
24
|
var Input = require('@itcase/ui/components/Input');
|
|
24
25
|
var Icon = require('@itcase/ui/components/Icon');
|
|
@@ -29,7 +30,6 @@ var Switch = require('@itcase/ui/components/Switch');
|
|
|
29
30
|
var Textarea = require('@itcase/ui/components/Textarea');
|
|
30
31
|
var Button = require('@itcase/ui/components/Button');
|
|
31
32
|
var Group$1 = require('@itcase/ui/components/Group');
|
|
32
|
-
var Loader = require('@itcase/ui/components/Loader');
|
|
33
33
|
var Notification = require('@itcase/ui/components/Notification');
|
|
34
34
|
var createDecorator = require('final-form-focus');
|
|
35
35
|
|
|
@@ -1204,6 +1204,9 @@ var FileInputDropzone = /*#__PURE__*/React__default.default.memo(function FileIn
|
|
|
1204
1204
|
hintDescriptionTextColor = props.hintDescriptionTextColor,
|
|
1205
1205
|
hintDescriptionTextWrap = props.hintDescriptionTextWrap,
|
|
1206
1206
|
hintDescriptionTextWeight = props.hintDescriptionTextWeight,
|
|
1207
|
+
errorMessageTextSize = props.errorMessageTextSize,
|
|
1208
|
+
errorMessageTextWeight = props.errorMessageTextWeight,
|
|
1209
|
+
errorMessageTextColor = props.errorMessageTextColor,
|
|
1207
1210
|
inputValue = props.inputValue,
|
|
1208
1211
|
removeThumbText = props.removeThumbText,
|
|
1209
1212
|
hintTitle = props.hintTitle,
|
|
@@ -1371,20 +1374,6 @@ var FileInputDropzone = /*#__PURE__*/React__default.default.memo(function FileIn
|
|
|
1371
1374
|
};
|
|
1372
1375
|
}, []); // eslint-disable-line
|
|
1373
1376
|
|
|
1374
|
-
// prettier-ignore
|
|
1375
|
-
/*
|
|
1376
|
-
const itemClass = useMemo(
|
|
1377
|
-
() => clsx(
|
|
1378
|
-
'form__item',
|
|
1379
|
-
'form__item_type_dropzone',
|
|
1380
|
-
// itemClassName,
|
|
1381
|
-
// metaError || fileError && 'form__item_state_error',
|
|
1382
|
-
files.length && 'form__item_state_success'
|
|
1383
|
-
),
|
|
1384
|
-
[files.length]
|
|
1385
|
-
)
|
|
1386
|
-
*/
|
|
1387
|
-
|
|
1388
1377
|
var fillClass = useDeviceTargetClass.useDeviceTargetClass(props, {
|
|
1389
1378
|
prefix: 'fill_',
|
|
1390
1379
|
propsKey: 'fill'
|
|
@@ -1439,7 +1428,9 @@ var FileInputDropzone = /*#__PURE__*/React__default.default.memo(function FileIn
|
|
|
1439
1428
|
return /*#__PURE__*/React__default.default.createElement("aside", {
|
|
1440
1429
|
className: clsx__default.default('form-dropzone__thumb', fillClass, thumbBorderWidthClass, thumbBorderColorClass, thumbBorderColorHoverClass, thumbBorderTypeClass),
|
|
1441
1430
|
key: "" + (file.id || file.name + "_" + i || 'i' + i)
|
|
1442
|
-
},
|
|
1431
|
+
}, /*#__PURE__*/React__default.default.createElement("div", {
|
|
1432
|
+
className: "form-dropzone__thumb-loading"
|
|
1433
|
+
}, fileIsLoading && (loadingText || 'Loading...')), isPreviews && /*#__PURE__*/React__default.default.createElement("div", {
|
|
1443
1434
|
className: "form-dropzone__thumb-image"
|
|
1444
1435
|
}, /*#__PURE__*/React__default.default.createElement("img", {
|
|
1445
1436
|
className: "form-dropzone__thumb-image-inner",
|
|
@@ -1457,8 +1448,14 @@ var FileInputDropzone = /*#__PURE__*/React__default.default.memo(function FileIn
|
|
|
1457
1448
|
textWeight: thumbNameTextWeight,
|
|
1458
1449
|
className: "form-dropzone__thumb-name-inner"
|
|
1459
1450
|
}, file.name)), fileIsLoading && /*#__PURE__*/React__default.default.createElement("div", {
|
|
1460
|
-
className: "form-dropzone__thumb-
|
|
1461
|
-
},
|
|
1451
|
+
className: "form-dropzone__thumb-loader"
|
|
1452
|
+
}, /*#__PURE__*/React__default.default.createElement(Loader.Loader, {
|
|
1453
|
+
fill: "surfacePrimary",
|
|
1454
|
+
height: "fill",
|
|
1455
|
+
itemFill: "surfaceItemAccent",
|
|
1456
|
+
set: "simple",
|
|
1457
|
+
width: "fill"
|
|
1458
|
+
})), /*#__PURE__*/React__default.default.createElement("div", {
|
|
1462
1459
|
className: "form-dropzone__thumb-remove",
|
|
1463
1460
|
onClick: function onClick(event) {
|
|
1464
1461
|
return removeFile(event, i);
|
|
@@ -1499,8 +1496,13 @@ var FileInputDropzone = /*#__PURE__*/React__default.default.memo(function FileIn
|
|
|
1499
1496
|
textWeight: hintDescriptionTextWeight,
|
|
1500
1497
|
className: "form-dropzone__hint-text"
|
|
1501
1498
|
}, hintDescription)))), fileError && /*#__PURE__*/React__default.default.createElement("div", {
|
|
1502
|
-
className: "
|
|
1503
|
-
},
|
|
1499
|
+
className: "form-field__message"
|
|
1500
|
+
}, /*#__PURE__*/React__default.default.createElement(Text.Text, {
|
|
1501
|
+
className: "form-field__message-item form-field__message-item_type_message",
|
|
1502
|
+
size: errorMessageTextSize,
|
|
1503
|
+
textWeight: errorMessageTextWeight,
|
|
1504
|
+
textColor: errorMessageTextColor
|
|
1505
|
+
}, fileError)));
|
|
1504
1506
|
});
|
|
1505
1507
|
FileInputDropzone.propTypes = {
|
|
1506
1508
|
dropzoneProps: PropTypes__default.default.object,
|
|
@@ -1545,6 +1547,9 @@ var FileInput = /*#__PURE__*/React__default.default.memo(function FileInput(prop
|
|
|
1545
1547
|
removeThumbTextColor = props.removeThumbTextColor,
|
|
1546
1548
|
removeThumbTextWeight = props.removeThumbTextWeight,
|
|
1547
1549
|
hintTitle = props.hintTitle,
|
|
1550
|
+
errorMessageTextSize = props.errorMessageTextSize,
|
|
1551
|
+
errorMessageTextWeight = props.errorMessageTextWeight,
|
|
1552
|
+
errorMessageTextColor = props.errorMessageTextColor,
|
|
1548
1553
|
fieldProps = props.fieldProps,
|
|
1549
1554
|
hintTitleTextSize = props.hintTitleTextSize,
|
|
1550
1555
|
hintTitleTextColor = props.hintTitleTextColor,
|
|
@@ -1618,6 +1623,9 @@ var FileInput = /*#__PURE__*/React__default.default.memo(function FileInput(prop
|
|
|
1618
1623
|
hintDescriptionTextColor: hintDescriptionTextColor,
|
|
1619
1624
|
hintDescriptionTextWrap: hintDescriptionTextWrap,
|
|
1620
1625
|
hintDescriptionTextWeight: hintDescriptionTextWeight,
|
|
1626
|
+
errorMessageTextSize: errorMessageTextSize,
|
|
1627
|
+
errorMessageWeight: errorMessageTextWeight,
|
|
1628
|
+
errorMessageTextColor: errorMessageTextColor,
|
|
1621
1629
|
isPreviews: isPreviews,
|
|
1622
1630
|
shape: shape,
|
|
1623
1631
|
isShowFilename: isShowFilename,
|
|
@@ -1629,6 +1637,10 @@ var FileInput = /*#__PURE__*/React__default.default.memo(function FileInput(prop
|
|
|
1629
1637
|
}));
|
|
1630
1638
|
});
|
|
1631
1639
|
});
|
|
1640
|
+
FileInput.defaultProps = {
|
|
1641
|
+
errorMessageTextSize: 's',
|
|
1642
|
+
errorMessageTextColor: 'errorTextPrimary'
|
|
1643
|
+
};
|
|
1632
1644
|
FileInput.propTypes = {
|
|
1633
1645
|
name: PropTypes__default.default.string.isRequired,
|
|
1634
1646
|
className: PropTypes__default.default.string,
|
package/dist/itcase-forms.esm.js
CHANGED
|
@@ -18,6 +18,7 @@ import { useDropzone } from 'react-dropzone';
|
|
|
18
18
|
import { fromEvent } from 'file-selector';
|
|
19
19
|
import castArray from 'lodash/castArray';
|
|
20
20
|
import { createFileFromDataURL } from '@itcase/common';
|
|
21
|
+
import { Loader } from '@itcase/ui/components/Loader';
|
|
21
22
|
import { Title } from '@itcase/ui/components/Title';
|
|
22
23
|
import { Input } from '@itcase/ui/components/Input';
|
|
23
24
|
import { Icon } from '@itcase/ui/components/Icon';
|
|
@@ -28,7 +29,6 @@ import { Switch } from '@itcase/ui/components/Switch';
|
|
|
28
29
|
import { Textarea } from '@itcase/ui/components/Textarea';
|
|
29
30
|
import { Button } from '@itcase/ui/components/Button';
|
|
30
31
|
import { Group as Group$1 } from '@itcase/ui/components/Group';
|
|
31
|
-
import { Loader } from '@itcase/ui/components/Loader';
|
|
32
32
|
import { NotificationItem } from '@itcase/ui/components/Notification';
|
|
33
33
|
import createDecorator from 'final-form-focus';
|
|
34
34
|
|
|
@@ -1194,6 +1194,9 @@ var FileInputDropzone = /*#__PURE__*/React.memo(function FileInputDropzone(props
|
|
|
1194
1194
|
hintDescriptionTextColor = props.hintDescriptionTextColor,
|
|
1195
1195
|
hintDescriptionTextWrap = props.hintDescriptionTextWrap,
|
|
1196
1196
|
hintDescriptionTextWeight = props.hintDescriptionTextWeight,
|
|
1197
|
+
errorMessageTextSize = props.errorMessageTextSize,
|
|
1198
|
+
errorMessageTextWeight = props.errorMessageTextWeight,
|
|
1199
|
+
errorMessageTextColor = props.errorMessageTextColor,
|
|
1197
1200
|
inputValue = props.inputValue,
|
|
1198
1201
|
removeThumbText = props.removeThumbText,
|
|
1199
1202
|
hintTitle = props.hintTitle,
|
|
@@ -1361,20 +1364,6 @@ var FileInputDropzone = /*#__PURE__*/React.memo(function FileInputDropzone(props
|
|
|
1361
1364
|
};
|
|
1362
1365
|
}, []); // eslint-disable-line
|
|
1363
1366
|
|
|
1364
|
-
// prettier-ignore
|
|
1365
|
-
/*
|
|
1366
|
-
const itemClass = useMemo(
|
|
1367
|
-
() => clsx(
|
|
1368
|
-
'form__item',
|
|
1369
|
-
'form__item_type_dropzone',
|
|
1370
|
-
// itemClassName,
|
|
1371
|
-
// metaError || fileError && 'form__item_state_error',
|
|
1372
|
-
files.length && 'form__item_state_success'
|
|
1373
|
-
),
|
|
1374
|
-
[files.length]
|
|
1375
|
-
)
|
|
1376
|
-
*/
|
|
1377
|
-
|
|
1378
1367
|
var fillClass = useDeviceTargetClass(props, {
|
|
1379
1368
|
prefix: 'fill_',
|
|
1380
1369
|
propsKey: 'fill'
|
|
@@ -1429,7 +1418,9 @@ var FileInputDropzone = /*#__PURE__*/React.memo(function FileInputDropzone(props
|
|
|
1429
1418
|
return /*#__PURE__*/React.createElement("aside", {
|
|
1430
1419
|
className: clsx('form-dropzone__thumb', fillClass, thumbBorderWidthClass, thumbBorderColorClass, thumbBorderColorHoverClass, thumbBorderTypeClass),
|
|
1431
1420
|
key: "" + (file.id || file.name + "_" + i || 'i' + i)
|
|
1432
|
-
},
|
|
1421
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
1422
|
+
className: "form-dropzone__thumb-loading"
|
|
1423
|
+
}, fileIsLoading && (loadingText || 'Loading...')), isPreviews && /*#__PURE__*/React.createElement("div", {
|
|
1433
1424
|
className: "form-dropzone__thumb-image"
|
|
1434
1425
|
}, /*#__PURE__*/React.createElement("img", {
|
|
1435
1426
|
className: "form-dropzone__thumb-image-inner",
|
|
@@ -1447,8 +1438,14 @@ var FileInputDropzone = /*#__PURE__*/React.memo(function FileInputDropzone(props
|
|
|
1447
1438
|
textWeight: thumbNameTextWeight,
|
|
1448
1439
|
className: "form-dropzone__thumb-name-inner"
|
|
1449
1440
|
}, file.name)), fileIsLoading && /*#__PURE__*/React.createElement("div", {
|
|
1450
|
-
className: "form-dropzone__thumb-
|
|
1451
|
-
},
|
|
1441
|
+
className: "form-dropzone__thumb-loader"
|
|
1442
|
+
}, /*#__PURE__*/React.createElement(Loader, {
|
|
1443
|
+
fill: "surfacePrimary",
|
|
1444
|
+
height: "fill",
|
|
1445
|
+
itemFill: "surfaceItemAccent",
|
|
1446
|
+
set: "simple",
|
|
1447
|
+
width: "fill"
|
|
1448
|
+
})), /*#__PURE__*/React.createElement("div", {
|
|
1452
1449
|
className: "form-dropzone__thumb-remove",
|
|
1453
1450
|
onClick: function onClick(event) {
|
|
1454
1451
|
return removeFile(event, i);
|
|
@@ -1489,8 +1486,13 @@ var FileInputDropzone = /*#__PURE__*/React.memo(function FileInputDropzone(props
|
|
|
1489
1486
|
textWeight: hintDescriptionTextWeight,
|
|
1490
1487
|
className: "form-dropzone__hint-text"
|
|
1491
1488
|
}, hintDescription)))), fileError && /*#__PURE__*/React.createElement("div", {
|
|
1492
|
-
className: "
|
|
1493
|
-
},
|
|
1489
|
+
className: "form-field__message"
|
|
1490
|
+
}, /*#__PURE__*/React.createElement(Text, {
|
|
1491
|
+
className: "form-field__message-item form-field__message-item_type_message",
|
|
1492
|
+
size: errorMessageTextSize,
|
|
1493
|
+
textWeight: errorMessageTextWeight,
|
|
1494
|
+
textColor: errorMessageTextColor
|
|
1495
|
+
}, fileError)));
|
|
1494
1496
|
});
|
|
1495
1497
|
FileInputDropzone.propTypes = {
|
|
1496
1498
|
dropzoneProps: PropTypes.object,
|
|
@@ -1535,6 +1537,9 @@ var FileInput = /*#__PURE__*/React.memo(function FileInput(props) {
|
|
|
1535
1537
|
removeThumbTextColor = props.removeThumbTextColor,
|
|
1536
1538
|
removeThumbTextWeight = props.removeThumbTextWeight,
|
|
1537
1539
|
hintTitle = props.hintTitle,
|
|
1540
|
+
errorMessageTextSize = props.errorMessageTextSize,
|
|
1541
|
+
errorMessageTextWeight = props.errorMessageTextWeight,
|
|
1542
|
+
errorMessageTextColor = props.errorMessageTextColor,
|
|
1538
1543
|
fieldProps = props.fieldProps,
|
|
1539
1544
|
hintTitleTextSize = props.hintTitleTextSize,
|
|
1540
1545
|
hintTitleTextColor = props.hintTitleTextColor,
|
|
@@ -1608,6 +1613,9 @@ var FileInput = /*#__PURE__*/React.memo(function FileInput(props) {
|
|
|
1608
1613
|
hintDescriptionTextColor: hintDescriptionTextColor,
|
|
1609
1614
|
hintDescriptionTextWrap: hintDescriptionTextWrap,
|
|
1610
1615
|
hintDescriptionTextWeight: hintDescriptionTextWeight,
|
|
1616
|
+
errorMessageTextSize: errorMessageTextSize,
|
|
1617
|
+
errorMessageWeight: errorMessageTextWeight,
|
|
1618
|
+
errorMessageTextColor: errorMessageTextColor,
|
|
1611
1619
|
isPreviews: isPreviews,
|
|
1612
1620
|
shape: shape,
|
|
1613
1621
|
isShowFilename: isShowFilename,
|
|
@@ -1619,6 +1627,10 @@ var FileInput = /*#__PURE__*/React.memo(function FileInput(props) {
|
|
|
1619
1627
|
}));
|
|
1620
1628
|
});
|
|
1621
1629
|
});
|
|
1630
|
+
FileInput.defaultProps = {
|
|
1631
|
+
errorMessageTextSize: 's',
|
|
1632
|
+
errorMessageTextColor: 'errorTextPrimary'
|
|
1633
|
+
};
|
|
1622
1634
|
FileInput.propTypes = {
|
|
1623
1635
|
name: PropTypes.string.isRequired,
|
|
1624
1636
|
className: PropTypes.string,
|