@dxc-technology/halstack-react 0.0.0-9253572 → 0.0.0-9439a0d
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/BackgroundColorContext.js +8 -4
- package/ThemeContext.js +84 -88
- package/V3Select/V3Select.js +33 -127
- package/V3Textarea/V3Textarea.js +10 -14
- package/accordion/Accordion.d.ts +4 -0
- package/accordion/Accordion.js +35 -130
- package/accordion/types.d.ts +68 -0
- package/accordion/types.js +5 -0
- package/accordion-group/AccordionGroup.d.ts +7 -0
- package/accordion-group/AccordionGroup.js +65 -81
- package/accordion-group/types.d.ts +72 -0
- package/accordion-group/types.js +5 -0
- package/alert/Alert.d.ts +4 -0
- package/alert/Alert.js +38 -151
- package/alert/Alert.stories.tsx +170 -0
- package/alert/types.d.ts +49 -0
- package/alert/types.js +5 -0
- package/badge/Badge.js +9 -13
- package/box/Box.d.ts +4 -0
- package/box/Box.js +13 -43
- package/box/Box.stories.tsx +132 -0
- package/box/types.d.ts +43 -0
- package/box/types.js +5 -0
- package/button/Button.d.ts +4 -0
- package/button/Button.js +22 -83
- package/button/Button.stories.tsx +276 -0
- package/button/types.d.ts +57 -0
- package/button/types.js +5 -0
- package/card/Card.d.ts +4 -0
- package/card/Card.js +33 -123
- package/card/Card.stories.tsx +201 -0
- package/card/ice-cream.jpg +0 -0
- package/card/types.d.ts +69 -0
- package/card/types.js +5 -0
- package/checkbox/Checkbox.d.ts +4 -0
- package/checkbox/Checkbox.js +13 -59
- package/checkbox/Checkbox.stories.tsx +192 -0
- package/checkbox/types.d.ts +60 -0
- package/checkbox/types.js +5 -0
- package/chip/Chip.js +17 -61
- package/chip/Chip.stories.tsx +121 -0
- package/common/RequiredComponent.js +3 -11
- package/common/variables.js +33 -23
- package/date/Date.js +16 -22
- package/date-input/DateInput.d.ts +4 -0
- package/date-input/DateInput.js +22 -61
- package/date-input/DateInput.stories.tsx +138 -0
- package/date-input/types.d.ts +100 -0
- package/date-input/types.js +5 -0
- package/dialog/Dialog.d.ts +4 -0
- package/dialog/Dialog.js +20 -73
- package/dialog/Dialog.stories.tsx +212 -0
- package/dialog/types.d.ts +43 -0
- package/dialog/types.js +5 -0
- package/dropdown/Dropdown.d.ts +4 -0
- package/dropdown/Dropdown.js +44 -171
- package/dropdown/types.d.ts +89 -0
- package/dropdown/types.js +5 -0
- package/file-input/FileInput.d.ts +4 -0
- package/file-input/FileInput.js +55 -188
- package/file-input/FileItem.d.ts +14 -0
- package/file-input/FileItem.js +33 -138
- package/file-input/types.d.ts +87 -0
- package/file-input/types.js +5 -0
- package/footer/Footer.d.ts +4 -0
- package/footer/Footer.js +38 -193
- package/footer/Footer.stories.jsx +151 -0
- package/footer/Icons.js +13 -13
- package/footer/types.d.ts +61 -0
- package/footer/types.js +5 -0
- package/header/Header.d.ts +7 -0
- package/header/Header.js +60 -206
- package/header/Header.stories.tsx +162 -0
- package/header/Icons.js +7 -32
- package/header/types.d.ts +45 -0
- package/header/types.js +5 -0
- package/heading/Heading.d.ts +4 -0
- package/heading/Heading.js +24 -95
- package/heading/types.d.ts +33 -0
- package/heading/types.js +5 -0
- package/input-text/Icons.js +2 -2
- package/input-text/InputText.js +33 -127
- package/layout/ApplicationLayout.js +31 -123
- package/layout/Icons.js +7 -7
- package/link/Link.d.ts +3 -0
- package/link/Link.js +18 -94
- package/link/Link.stories.tsx +146 -0
- package/link/types.d.ts +74 -0
- package/link/types.js +5 -0
- package/main.d.ts +44 -40
- package/main.js +91 -87
- package/number-input/NumberInput.d.ts +4 -0
- package/number-input/NumberInput.js +7 -57
- package/number-input/NumberInput.stories.tsx +115 -0
- package/number-input/NumberInputContext.js +1 -1
- package/number-input/types.d.ts +117 -0
- package/number-input/types.js +5 -0
- package/package.json +15 -12
- package/paginator/Icons.js +9 -9
- package/paginator/Paginator.d.ts +4 -0
- package/paginator/Paginator.js +24 -131
- package/paginator/Paginator.stories.tsx +63 -0
- package/paginator/types.d.ts +38 -0
- package/paginator/types.js +5 -0
- package/password-input/PasswordInput.d.ts +4 -0
- package/password-input/PasswordInput.js +18 -59
- package/password-input/PasswordInput.stories.tsx +131 -0
- package/password-input/types.d.ts +100 -0
- package/password-input/types.js +5 -0
- package/progress-bar/ProgressBar.d.ts +4 -0
- package/progress-bar/ProgressBar.js +20 -92
- package/progress-bar/ProgressBar.stories.jsx +58 -0
- package/progress-bar/types.d.ts +37 -0
- package/progress-bar/types.js +5 -0
- package/radio/Radio.d.ts +4 -0
- package/radio/Radio.js +15 -50
- package/radio/Radio.stories.tsx +192 -0
- package/radio/types.d.ts +54 -0
- package/radio/types.js +5 -0
- package/resultsetTable/ResultsetTable.js +35 -119
- package/select/Select.js +161 -434
- package/select/Select.stories.tsx +572 -0
- package/select/index.d.ts +4 -4
- package/sidenav/Sidenav.d.ts +9 -0
- package/sidenav/Sidenav.js +19 -62
- package/sidenav/types.d.ts +50 -0
- package/sidenav/types.js +5 -0
- package/slider/Slider.d.ts +4 -0
- package/slider/Slider.js +71 -158
- package/slider/Slider.stories.tsx +177 -0
- package/slider/types.d.ts +78 -0
- package/slider/types.js +5 -0
- package/spinner/Spinner.d.ts +4 -0
- package/spinner/Spinner.js +43 -174
- package/spinner/Spinner.stories.jsx +102 -0
- package/spinner/types.d.ts +32 -0
- package/spinner/types.js +5 -0
- package/switch/Switch.d.ts +4 -0
- package/switch/Switch.js +26 -69
- package/switch/Switch.stories.tsx +160 -0
- package/switch/types.d.ts +58 -0
- package/switch/types.js +5 -0
- package/table/Table.d.ts +4 -0
- package/table/Table.js +10 -24
- package/table/Table.stories.jsx +276 -0
- package/table/types.d.ts +21 -0
- package/table/types.js +5 -0
- package/tabs/Tabs.d.ts +4 -0
- package/tabs/Tabs.js +29 -161
- package/tabs/types.d.ts +71 -0
- package/tabs/types.js +5 -0
- package/tag/Tag.d.ts +4 -0
- package/tag/Tag.js +37 -126
- package/tag/Tag.stories.tsx +145 -0
- package/tag/types.d.ts +60 -0
- package/tag/types.js +5 -0
- package/text-input/TextInput.js +104 -271
- package/text-input/index.d.ts +2 -2
- package/textarea/Textarea.js +20 -72
- package/textarea/Textarea.stories.jsx +135 -0
- package/toggle/Toggle.js +15 -49
- package/toggle-group/ToggleGroup.js +23 -107
- package/toggle-group/ToggleGroup.stories.tsx +178 -0
- package/upload/Upload.js +11 -15
- package/upload/buttons-upload/ButtonsUpload.js +13 -37
- package/upload/buttons-upload/Icons.js +7 -7
- package/upload/dragAndDropArea/DragAndDropArea.js +24 -128
- package/upload/dragAndDropArea/Icons.js +6 -6
- package/upload/file-upload/FileToUpload.js +16 -90
- package/upload/file-upload/Icons.js +13 -13
- package/upload/files-upload/FilesToUpload.js +12 -26
- package/upload/transaction/Icons.js +31 -31
- package/upload/transaction/Transaction.js +17 -61
- package/upload/transactions/Transactions.js +13 -57
- package/wizard/Icons.js +8 -8
- package/wizard/Wizard.d.ts +4 -0
- package/wizard/Wizard.js +32 -206
- package/wizard/Wizard.stories.jsx +224 -0
- package/wizard/types.d.ts +64 -0
- package/wizard/types.js +5 -0
- package/accordion/index.d.ts +0 -28
- package/accordion-group/index.d.ts +0 -16
- package/alert/index.d.ts +0 -51
- package/box/index.d.ts +0 -25
- package/button/Button.stories.js +0 -27
- package/button/index.d.ts +0 -24
- package/card/index.d.ts +0 -22
- package/checkbox/index.d.ts +0 -24
- package/date-input/index.d.ts +0 -95
- package/dialog/index.d.ts +0 -18
- package/dropdown/index.d.ts +0 -26
- package/file-input/index.d.ts +0 -81
- package/footer/index.d.ts +0 -25
- package/header/index.d.ts +0 -25
- package/heading/index.d.ts +0 -17
- package/link/index.d.ts +0 -23
- package/number-input/index.d.ts +0 -113
- package/paginator/index.d.ts +0 -20
- package/password-input/index.d.ts +0 -94
- package/progress-bar/index.d.ts +0 -18
- package/radio/index.d.ts +0 -23
- package/sidenav/index.d.ts +0 -13
- package/slider/index.d.ts +0 -29
- package/spinner/index.d.ts +0 -17
- package/switch/index.d.ts +0 -24
- package/table/index.d.ts +0 -13
- package/tabs/index.d.ts +0 -19
- package/tag/index.d.ts +0 -24
- package/wizard/index.d.ts +0 -18
package/file-input/FileItem.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard");
|
|
4
|
-
|
|
5
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
6
4
|
|
|
5
|
+
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
6
|
+
|
|
7
7
|
Object.defineProperty(exports, "__esModule", {
|
|
8
8
|
value: true
|
|
9
9
|
});
|
|
@@ -13,132 +13,36 @@ var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/hel
|
|
|
13
13
|
|
|
14
14
|
var _react = _interopRequireDefault(require("react"));
|
|
15
15
|
|
|
16
|
-
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
17
|
-
|
|
18
16
|
var _styledComponents = _interopRequireWildcard(require("styled-components"));
|
|
19
17
|
|
|
20
18
|
var _useTheme = _interopRequireDefault(require("../useTheme.js"));
|
|
21
19
|
|
|
22
|
-
|
|
23
|
-
var data = (0, _taggedTemplateLiteral2["default"])(["\n color: ", ";\n font-family: ", ";\n font-size: ", ";\n font-weight: ", ";\n line-height: ", ";\n"]);
|
|
24
|
-
|
|
25
|
-
_templateObject10 = function _templateObject10() {
|
|
26
|
-
return data;
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
return data;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
function _templateObject9() {
|
|
33
|
-
var data = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n flex-wrap: wrap;\n align-content: center;\n height: 24px;\n width: 24px;\n font-size: 1rem;\n font-family: ", ";\n border: 1px solid transparent;\n border-radius: 4px;\n margin-left: 4px;\n background-color: transparent;\n padding: 3px;\n cursor: pointer;\n svg {\n line-height: 18px;\n }\n &:hover {\n background-color: ", ";\n }\n &:focus {\n background-color: ", ";\n }\n &:active {\n background-color: ", ";\n }\n"]);
|
|
34
|
-
|
|
35
|
-
_templateObject9 = function _templateObject9() {
|
|
36
|
-
return data;
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
return data;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
function _templateObject8() {
|
|
43
|
-
var data = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n flex-wrap: wrap;\n align-content: center;\n padding: 3px;\n height: 18px;\n width: 18px;\n color: #d0011b;\n"]);
|
|
44
|
-
|
|
45
|
-
_templateObject8 = function _templateObject8() {
|
|
46
|
-
return data;
|
|
47
|
-
};
|
|
48
|
-
|
|
49
|
-
return data;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
function _templateObject7() {
|
|
53
|
-
var data = (0, _taggedTemplateLiteral2["default"])(["\n color: ", ";\n width: ", ";\n text-overflow: ellipsis;\n overflow: hidden;\n white-space: nowrap;\n font-family: ", ";\n font-size: ", ";\n font-weight: ", ";\n line-height: ", ";\n"]);
|
|
54
|
-
|
|
55
|
-
_templateObject7 = function _templateObject7() {
|
|
56
|
-
return data;
|
|
57
|
-
};
|
|
58
|
-
|
|
59
|
-
return data;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
function _templateObject6() {
|
|
63
|
-
var data = (0, _taggedTemplateLiteral2["default"])([""]);
|
|
64
|
-
|
|
65
|
-
_templateObject6 = function _templateObject6() {
|
|
66
|
-
return data;
|
|
67
|
-
};
|
|
20
|
+
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10;
|
|
68
21
|
|
|
69
|
-
|
|
70
|
-
}
|
|
22
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
71
23
|
|
|
72
|
-
function
|
|
73
|
-
var data = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n align-items: center;\n justify-content: center;\n margin-right: 12px;\n background-color: ", ";\n width: 48px;\n height: 48px;\n border-radius: 2px;\n color: ", ";\n"]);
|
|
24
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
74
25
|
|
|
75
|
-
|
|
76
|
-
return data;
|
|
77
|
-
};
|
|
78
|
-
|
|
79
|
-
return data;
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
function _templateObject4() {
|
|
83
|
-
var data = (0, _taggedTemplateLiteral2["default"])(["\n width: 48px;\n height: 48px;\n object-fit: contain;\n margin-right: 12px;\n border-radius: 2px;\n"]);
|
|
84
|
-
|
|
85
|
-
_templateObject4 = function _templateObject4() {
|
|
86
|
-
return data;
|
|
87
|
-
};
|
|
88
|
-
|
|
89
|
-
return data;
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
function _templateObject3() {
|
|
93
|
-
var data = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n flex-direction: row;\n align-items: center;\n"]);
|
|
94
|
-
|
|
95
|
-
_templateObject3 = function _templateObject3() {
|
|
96
|
-
return data;
|
|
97
|
-
};
|
|
98
|
-
|
|
99
|
-
return data;
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
function _templateObject2() {
|
|
103
|
-
var data = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n flex-direction: column;\n"]);
|
|
104
|
-
|
|
105
|
-
_templateObject2 = function _templateObject2() {
|
|
106
|
-
return data;
|
|
107
|
-
};
|
|
108
|
-
|
|
109
|
-
return data;
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
function _templateObject() {
|
|
113
|
-
var data = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n flex-direction: row;\n padding: ", ";\n background-color: ", ";\n border-radius: ", ";\n width: ", ";\n min-height: ", ";\n border-color: ", ";\n border-width: ", ";\n border-style: ", ";\n display: flex;\n justify-content: center;\n"]);
|
|
114
|
-
|
|
115
|
-
_templateObject = function _templateObject() {
|
|
116
|
-
return data;
|
|
117
|
-
};
|
|
118
|
-
|
|
119
|
-
return data;
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
var deleteIcon = _react["default"].createElement("svg", {
|
|
26
|
+
var deleteIcon = /*#__PURE__*/_react["default"].createElement("svg", {
|
|
123
27
|
xmlns: "http://www.w3.org/2000/svg",
|
|
124
28
|
width: "24",
|
|
125
29
|
height: "24",
|
|
126
30
|
viewBox: "0 0 24 24",
|
|
127
31
|
fill: "currentColor"
|
|
128
|
-
}, _react["default"].createElement("path", {
|
|
32
|
+
}, /*#__PURE__*/_react["default"].createElement("path", {
|
|
129
33
|
d: "M0 0h24v24H0V0z",
|
|
130
34
|
fill: "none"
|
|
131
|
-
}), _react["default"].createElement("path", {
|
|
35
|
+
}), /*#__PURE__*/_react["default"].createElement("path", {
|
|
132
36
|
d: "M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z"
|
|
133
37
|
}));
|
|
134
38
|
|
|
135
|
-
var errorIcon = _react["default"].createElement("svg", {
|
|
39
|
+
var errorIcon = /*#__PURE__*/_react["default"].createElement("svg", {
|
|
136
40
|
xmlns: "http://www.w3.org/2000/svg",
|
|
137
41
|
height: "24px",
|
|
138
42
|
viewBox: "0 0 24 24",
|
|
139
43
|
width: "24px",
|
|
140
44
|
fill: "currentColor"
|
|
141
|
-
}, _react["default"].createElement("path", {
|
|
45
|
+
}, /*#__PURE__*/_react["default"].createElement("path", {
|
|
142
46
|
d: "M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z"
|
|
143
47
|
}));
|
|
144
48
|
|
|
@@ -153,7 +57,8 @@ var FileItem = function FileItem(_ref) {
|
|
|
153
57
|
preview = _ref.preview,
|
|
154
58
|
type = _ref.type,
|
|
155
59
|
numFiles = _ref.numFiles,
|
|
156
|
-
onDelete = _ref.onDelete
|
|
60
|
+
onDelete = _ref.onDelete,
|
|
61
|
+
tabIndex = _ref.tabIndex;
|
|
157
62
|
var colorsTheme = (0, _useTheme["default"])();
|
|
158
63
|
var isImage = type.includes("image");
|
|
159
64
|
|
|
@@ -169,40 +74,41 @@ var FileItem = function FileItem(_ref) {
|
|
|
169
74
|
return "file";
|
|
170
75
|
};
|
|
171
76
|
|
|
172
|
-
return _react["default"].createElement(_styledComponents.ThemeProvider, {
|
|
77
|
+
return /*#__PURE__*/_react["default"].createElement(_styledComponents.ThemeProvider, {
|
|
173
78
|
theme: colorsTheme.fileInput
|
|
174
|
-
}, _react["default"].createElement(Container, {
|
|
79
|
+
}, /*#__PURE__*/_react["default"].createElement(Container, {
|
|
175
80
|
mode: mode,
|
|
176
81
|
multiple: multiple,
|
|
177
82
|
error: error,
|
|
178
83
|
showPreview: showPreview,
|
|
179
84
|
numFiles: numFiles
|
|
180
|
-
}, showPreview && (isImage ? _react["default"].createElement(ImagePreview, {
|
|
85
|
+
}, showPreview && (isImage ? /*#__PURE__*/_react["default"].createElement(ImagePreview, {
|
|
181
86
|
src: preview,
|
|
182
87
|
alt: name
|
|
183
|
-
}) : _react["default"].createElement(IconPreviewContainer, {
|
|
88
|
+
}) : /*#__PURE__*/_react["default"].createElement(IconPreviewContainer, {
|
|
184
89
|
error: error,
|
|
185
90
|
"aria-label": getIconAriaLabel()
|
|
186
|
-
}, _react["default"].createElement(IconPreview, {
|
|
91
|
+
}, /*#__PURE__*/_react["default"].createElement(IconPreview, {
|
|
187
92
|
error: error
|
|
188
|
-
}, preview))), _react["default"].createElement(FileItemContent, null, _react["default"].createElement(FileItemContainer, null, _react["default"].createElement(FileName, {
|
|
93
|
+
}, preview))), /*#__PURE__*/_react["default"].createElement(FileItemContent, null, /*#__PURE__*/_react["default"].createElement(FileItemContainer, null, /*#__PURE__*/_react["default"].createElement(FileName, {
|
|
189
94
|
mode: mode,
|
|
190
95
|
multiple: multiple,
|
|
191
96
|
error: error,
|
|
192
97
|
showPreview: showPreview,
|
|
193
98
|
numFiles: numFiles
|
|
194
|
-
}, name), error && _react["default"].createElement(ErrorIcon, {
|
|
99
|
+
}, name), error && /*#__PURE__*/_react["default"].createElement(ErrorIcon, {
|
|
195
100
|
"aria-label": "Error"
|
|
196
|
-
}, errorIcon), _react["default"].createElement(DeleteIcon, {
|
|
101
|
+
}, errorIcon), /*#__PURE__*/_react["default"].createElement(DeleteIcon, {
|
|
197
102
|
error: error,
|
|
198
103
|
onClick: function onClick() {
|
|
199
104
|
return onDelete(name);
|
|
200
105
|
},
|
|
201
|
-
"aria-label": "Remove ".concat(name)
|
|
202
|
-
|
|
106
|
+
"aria-label": "Remove ".concat(name),
|
|
107
|
+
tabIndex: tabIndex
|
|
108
|
+
}, deleteIcon)), error && (multiple || numFiles > 1) && /*#__PURE__*/_react["default"].createElement(ErrorMessage, null, error))));
|
|
203
109
|
};
|
|
204
110
|
|
|
205
|
-
var Container = _styledComponents["default"].div(_templateObject(), function (props) {
|
|
111
|
+
var Container = _styledComponents["default"].div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n flex-direction: row;\n padding: ", ";\n background-color: ", ";\n border-radius: ", ";\n width: ", ";\n min-height: ", ";\n border-color: ", ";\n border-width: ", ";\n border-style: ", ";\n display: flex;\n justify-content: center;\n"])), function (props) {
|
|
206
112
|
return props.showPreview ? "8px" : "8px 8px 8px 16px";
|
|
207
113
|
}, function (props) {
|
|
208
114
|
return props.error && props.theme.errorFileItemBackgroundColor;
|
|
@@ -220,21 +126,21 @@ var Container = _styledComponents["default"].div(_templateObject(), function (pr
|
|
|
220
126
|
return props.theme.fileItemBorderStyle;
|
|
221
127
|
});
|
|
222
128
|
|
|
223
|
-
var FileItemContent = _styledComponents["default"].div(_templateObject2());
|
|
129
|
+
var FileItemContent = _styledComponents["default"].div(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n flex-direction: column;\n"])));
|
|
224
130
|
|
|
225
|
-
var FileItemContainer = _styledComponents["default"].div(_templateObject3());
|
|
131
|
+
var FileItemContainer = _styledComponents["default"].div(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n flex-direction: row;\n align-items: center;\n"])));
|
|
226
132
|
|
|
227
|
-
var ImagePreview = _styledComponents["default"].img(_templateObject4());
|
|
133
|
+
var ImagePreview = _styledComponents["default"].img(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2["default"])(["\n width: 48px;\n height: 48px;\n object-fit: contain;\n margin-right: 12px;\n border-radius: 2px;\n"])));
|
|
228
134
|
|
|
229
|
-
var IconPreviewContainer = _styledComponents["default"].div(_templateObject5(), function (props) {
|
|
135
|
+
var IconPreviewContainer = _styledComponents["default"].div(_templateObject5 || (_templateObject5 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n align-items: center;\n justify-content: center;\n margin-right: 12px;\n background-color: ", ";\n width: 48px;\n height: 48px;\n border-radius: 2px;\n color: ", ";\n"])), function (props) {
|
|
230
136
|
return props.error ? props.theme.errorFileItemIconBackgroundColor : props.theme.fileItemIconBackgroundColor;
|
|
231
137
|
}, function (props) {
|
|
232
138
|
return props.error ? props.theme.errorFileItemIconColor : props.theme.fileItemIconColor;
|
|
233
139
|
});
|
|
234
140
|
|
|
235
|
-
var IconPreview = _styledComponents["default"].div(_templateObject6());
|
|
141
|
+
var IconPreview = _styledComponents["default"].div(_templateObject6 || (_templateObject6 = (0, _taggedTemplateLiteral2["default"])([""])));
|
|
236
142
|
|
|
237
|
-
var FileName = _styledComponents["default"].span(_templateObject7(), function (props) {
|
|
143
|
+
var FileName = _styledComponents["default"].span(_templateObject7 || (_templateObject7 = (0, _taggedTemplateLiteral2["default"])(["\n color: ", ";\n width: ", ";\n text-overflow: ellipsis;\n overflow: hidden;\n white-space: nowrap;\n font-family: ", ";\n font-size: ", ";\n font-weight: ", ";\n line-height: ", ";\n"])), function (props) {
|
|
238
144
|
return props.theme.fileNameFontColor;
|
|
239
145
|
}, function (props) {
|
|
240
146
|
return props.mode === "file" && !props.multiple && props.error && props.numFiles === 1 ? "calc(230px - 76px)" : props.mode === "file" && !props.multiple && !props.error && props.numFiles === 1 ? "calc(230px - 50px)" : !props.showPreview && !props.error ? "calc(320px - 52px)" : !props.showPreview && props.error ? "calc(320px - 76px)" : props.showPreview && props.error ? "calc(320px - 128px)" : props.showPreview && !props.error && "calc(320px - 102px)";
|
|
@@ -248,9 +154,9 @@ var FileName = _styledComponents["default"].span(_templateObject7(), function (p
|
|
|
248
154
|
return props.theme.fileItemLineHeight;
|
|
249
155
|
});
|
|
250
156
|
|
|
251
|
-
var ErrorIcon = _styledComponents["default"].span(_templateObject8());
|
|
157
|
+
var ErrorIcon = _styledComponents["default"].span(_templateObject8 || (_templateObject8 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n flex-wrap: wrap;\n align-content: center;\n padding: 3px;\n height: 18px;\n width: 18px;\n color: #d0011b;\n"])));
|
|
252
158
|
|
|
253
|
-
var DeleteIcon = _styledComponents["default"].button(_templateObject9(), function (props) {
|
|
159
|
+
var DeleteIcon = _styledComponents["default"].button(_templateObject9 || (_templateObject9 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n flex-wrap: wrap;\n align-content: center;\n height: 24px;\n width: 24px;\n font-size: 1rem;\n font-family: ", ";\n border: 1px solid transparent;\n border-radius: 4px;\n margin-left: 4px;\n background-color: transparent;\n padding: 3px;\n cursor: pointer;\n svg {\n line-height: 18px;\n }\n &:hover {\n background-color: ", ";\n }\n &:focus {\n background-color: ", ";\n }\n &:active {\n background-color: ", ";\n }\n"])), function (props) {
|
|
254
160
|
return props.theme.fontFamily;
|
|
255
161
|
}, function (props) {
|
|
256
162
|
return props.error ? props.theme.errorHoverDeleteFileItemBackgroundColor : props.theme.hoverDeleteFileItemBackgroundColor;
|
|
@@ -260,7 +166,7 @@ var DeleteIcon = _styledComponents["default"].button(_templateObject9(), functio
|
|
|
260
166
|
return props.error ? props.theme.errorActiveDeleteFileItemBackgroundColor : props.theme.activeDeleteFileItemBackgroundColor;
|
|
261
167
|
});
|
|
262
168
|
|
|
263
|
-
var ErrorMessage = _styledComponents["default"].span(_templateObject10(), function (props) {
|
|
169
|
+
var ErrorMessage = _styledComponents["default"].span(_templateObject10 || (_templateObject10 = (0, _taggedTemplateLiteral2["default"])(["\n color: ", ";\n font-family: ", ";\n font-size: ", ";\n font-weight: ", ";\n line-height: ", ";\n"])), function (props) {
|
|
264
170
|
return props.theme.errorMessageFontColor;
|
|
265
171
|
}, function (props) {
|
|
266
172
|
return props.theme.errorMessageFontFamily;
|
|
@@ -272,16 +178,5 @@ var ErrorMessage = _styledComponents["default"].span(_templateObject10(), functi
|
|
|
272
178
|
return props.theme.errorMessageLineHeight;
|
|
273
179
|
});
|
|
274
180
|
|
|
275
|
-
FileItem.propTypes = {
|
|
276
|
-
mode: _propTypes["default"].string,
|
|
277
|
-
multiple: _propTypes["default"].bool,
|
|
278
|
-
name: _propTypes["default"].string,
|
|
279
|
-
type: _propTypes["default"].string,
|
|
280
|
-
showPreview: _propTypes["default"]["boolean"],
|
|
281
|
-
numFiles: _propTypes["default"].number,
|
|
282
|
-
preview: _propTypes["default"].string,
|
|
283
|
-
error: _propTypes["default"].string,
|
|
284
|
-
onDelete: _propTypes["default"].func
|
|
285
|
-
};
|
|
286
181
|
var _default = FileItem;
|
|
287
182
|
exports["default"] = _default;
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
declare type Space = "xxsmall" | "xsmall" | "small" | "medium" | "large" | "xlarge" | "xxlarge";
|
|
2
|
+
declare type Margin = {
|
|
3
|
+
top?: Space;
|
|
4
|
+
bottom?: Space;
|
|
5
|
+
left?: Space;
|
|
6
|
+
right?: Space;
|
|
7
|
+
};
|
|
8
|
+
declare type FileData = {
|
|
9
|
+
/**
|
|
10
|
+
* Selected file.
|
|
11
|
+
*/
|
|
12
|
+
file: File;
|
|
13
|
+
/**
|
|
14
|
+
* Error of the file. If it is defined, it will be shown and the file item will be mark as invalid.
|
|
15
|
+
*/
|
|
16
|
+
error?: string;
|
|
17
|
+
/**
|
|
18
|
+
* Preview of the file.
|
|
19
|
+
*/
|
|
20
|
+
preview?: string;
|
|
21
|
+
};
|
|
22
|
+
declare type Props = {
|
|
23
|
+
/**
|
|
24
|
+
* Name attribute.
|
|
25
|
+
*/
|
|
26
|
+
name?: string;
|
|
27
|
+
/**
|
|
28
|
+
* Text to be placed above the component.
|
|
29
|
+
*/
|
|
30
|
+
label?: string;
|
|
31
|
+
/**
|
|
32
|
+
* Uses one of the available file input modes:
|
|
33
|
+
* 'file': Files are selected by clicking the button and selecting it through the file explorer.
|
|
34
|
+
* 'filedrop': Files can be selected by clicking the button and selecting it through the file explorer or by dropping them inside the drag and drop area.
|
|
35
|
+
* 'dropzone': Files can be selected by clicking the button and selecting it through the file explorer or by dropping them inside the drag and drop area.
|
|
36
|
+
* The drag and drop area of this mode is bigger than the one of the filedrop mode.
|
|
37
|
+
*/
|
|
38
|
+
mode?: "file" | "filedrop" | "dropzone";
|
|
39
|
+
/**
|
|
40
|
+
* Helper text to be placed above the component.
|
|
41
|
+
*/
|
|
42
|
+
helperText?: string;
|
|
43
|
+
/**
|
|
44
|
+
* The file types that the component accepts. Its value must be one of all the possible values of the HTML file input's accept attribute.
|
|
45
|
+
*/
|
|
46
|
+
accept?: string;
|
|
47
|
+
/**
|
|
48
|
+
* An array of files representing the selected files.
|
|
49
|
+
*/
|
|
50
|
+
value: FileData[];
|
|
51
|
+
/**
|
|
52
|
+
* The minimum file size (in bytes) allowed. If the size of the file does not comply the minSize, the file will have an error.
|
|
53
|
+
*/
|
|
54
|
+
minSize?: number;
|
|
55
|
+
/**
|
|
56
|
+
* The maximum file size (in bytes) allowed. If the size of the file does not comply the maxSize, the file will have an error.
|
|
57
|
+
*/
|
|
58
|
+
maxSize?: number;
|
|
59
|
+
/**
|
|
60
|
+
* If true, if the file is an image, a preview of it will be shown. If not, an icon refering to the file type will be shown.
|
|
61
|
+
*/
|
|
62
|
+
showPreview?: boolean;
|
|
63
|
+
/**
|
|
64
|
+
* If true, the component allows multiple file items and will show all of them. If false, only one file will be shown, and if there is already one
|
|
65
|
+
* file selected and a new one is chosen, it will be replaced by the new selected one.
|
|
66
|
+
*/
|
|
67
|
+
multiple?: boolean;
|
|
68
|
+
/**
|
|
69
|
+
* If true, the component will be disabled.
|
|
70
|
+
*/
|
|
71
|
+
disabled?: boolean;
|
|
72
|
+
/**
|
|
73
|
+
* This function will be called when the user selects or drops a file. The list of files will be sent as a parameter.
|
|
74
|
+
* In this function, the files can be updated or returned as they come. These files must be passed to the value in order to be shown.
|
|
75
|
+
*/
|
|
76
|
+
callbackFile: (files: FileData[]) => void;
|
|
77
|
+
/**
|
|
78
|
+
* Size of the margin to be applied to the component ('xxsmall' | 'xsmall' | 'small' | 'medium' | 'large' | 'xlarge' | 'xxlarge').
|
|
79
|
+
* You can pass an object with 'top', 'bottom', 'left' and 'right' properties in order to specify different margin sizes.
|
|
80
|
+
*/
|
|
81
|
+
margin?: Space | Margin;
|
|
82
|
+
/**
|
|
83
|
+
* Value of the tabindex attribute.
|
|
84
|
+
*/
|
|
85
|
+
tabIndex?: number;
|
|
86
|
+
};
|
|
87
|
+
export default Props;
|