@dxc-technology/halstack-react 0.0.0-4fd9593 → 0.0.0-51a5c42
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/ThemeContext.js +131 -99
- package/dist/V3Textarea/V3Textarea.js +264 -0
- package/dist/accordion/Accordion.js +44 -39
- package/dist/accordion-group/AccordionGroup.js +1 -3
- package/dist/alert/Alert.js +124 -113
- package/dist/alert/index.d.ts +51 -0
- package/dist/button/Button.js +31 -25
- package/dist/checkbox/Checkbox.js +19 -13
- package/dist/common/variables.js +590 -386
- package/dist/date/Date.js +11 -13
- package/dist/{new-date/NewDate.js → date-input/DateInput.js} +77 -72
- package/dist/date-input/index.d.ts +95 -0
- package/dist/dialog/Dialog.js +8 -30
- package/dist/dropdown/Dropdown.js +108 -68
- package/dist/file-input/FileInput.js +644 -0
- package/dist/file-input/FileItem.js +280 -0
- package/dist/file-input/index.d.ts +81 -0
- package/dist/header/Header.js +78 -67
- package/dist/header/Icons.js +59 -0
- package/dist/input-text/InputText.js +3 -3
- package/dist/layout/ApplicationLayout.js +1 -1
- package/dist/link/Link.js +4 -8
- package/dist/main.d.ts +8 -0
- package/dist/main.js +37 -21
- package/dist/new-select/NewSelect.js +836 -0
- package/dist/new-select/index.d.ts +53 -0
- package/dist/{number/Number.js → number-input/NumberInput.js} +13 -11
- package/dist/{number/NumberContext.js → number-input/NumberInputContext.js} +2 -2
- package/dist/number-input/index.d.ts +113 -0
- package/dist/{password/Password.js → password-input/PasswordInput.js} +15 -13
- package/dist/password-input/index.d.ts +94 -0
- package/dist/progress-bar/ProgressBar.js +62 -26
- package/dist/select/Select.js +122 -158
- package/dist/sidenav/Sidenav.js +6 -4
- package/dist/slider/Slider.js +141 -62
- package/dist/spinner/Spinner.js +217 -54
- package/dist/tag/Tag.js +26 -32
- package/dist/{new-input-text/NewInputText.js → text-input/TextInput.js} +185 -171
- package/dist/text-input/index.d.ts +135 -0
- package/dist/textarea/Textarea.js +227 -122
- package/dist/textarea/index.d.ts +117 -0
- package/dist/toggle-group/ToggleGroup.js +130 -44
- package/dist/upload/Upload.js +3 -3
- package/dist/upload/readme.md +2 -2
- package/dist/upload/transaction/Transaction.js +2 -2
- package/package.json +2 -1
- package/test/Date.test.js +48 -44
- package/test/{NewDate.test.js → DateInput.test.js} +71 -29
- package/test/FileInput.test.js +201 -0
- package/test/Header.test.js +5 -10
- package/test/InputText.test.js +24 -16
- package/test/{Number.test.js → NumberInput.test.js} +85 -67
- package/test/Paginator.test.js +1 -1
- package/test/PasswordInput.test.js +83 -0
- package/test/ResultsetTable.test.js +1 -2
- package/test/Select.test.js +40 -17
- package/test/Spinner.test.js +5 -0
- package/test/{NewInputText.test.js → TextInput.test.js} +147 -232
- package/test/Textarea.test.js +193 -0
- package/test/ToggleGroup.test.js +5 -1
- package/test/Upload.test.js +5 -5
- package/test/{TextArea.test.js → V3TextArea.test.js} +6 -7
- package/dist/accordion/Accordion.stories.js +0 -207
- package/dist/accordion/readme.md +0 -96
- package/dist/accordion-group/AccordionGroup.stories.js +0 -207
- package/dist/accordion-group/readme.md +0 -70
- package/dist/alert/Alert.stories.js +0 -158
- package/dist/alert/close.svg +0 -4
- package/dist/alert/error.svg +0 -4
- package/dist/alert/info.svg +0 -4
- package/dist/alert/readme.md +0 -43
- package/dist/alert/success.svg +0 -4
- package/dist/alert/warning.svg +0 -4
- package/dist/button/Button.stories.js +0 -224
- package/dist/button/readme.md +0 -93
- package/dist/dialog/Dialog.stories.js +0 -217
- package/dist/dialog/readme.md +0 -32
- package/dist/dropdown/Dropdown.stories.js +0 -249
- package/dist/dropdown/baseline-arrow_drop_down.svg +0 -1
- package/dist/dropdown/baseline-arrow_drop_down_wh.svg +0 -4
- package/dist/dropdown/baseline-arrow_drop_up.svg +0 -1
- package/dist/dropdown/baseline-arrow_drop_up_wh.svg +0 -4
- package/dist/dropdown/readme.md +0 -69
- package/dist/footer/Footer.stories.js +0 -94
- package/dist/header/Header.stories.js +0 -176
- package/dist/header/close_icon.svg +0 -1
- package/dist/header/dxc_logo_black.svg +0 -8
- package/dist/header/hamb_menu_black.svg +0 -1
- package/dist/header/hamb_menu_white.svg +0 -1
- package/dist/header/readme.md +0 -33
- package/dist/input-text/InputText.stories.js +0 -209
- package/dist/new-textarea/NewTextarea.js +0 -342
- package/dist/password/styles.css +0 -3
- package/dist/select/Select.stories.js +0 -235
- package/dist/select/readme.md +0 -72
- package/dist/slider/Slider.stories.js +0 -241
- package/dist/toggle-group/readme.md +0 -82
- package/test/NewTextarea.test.js +0 -201
- package/test/Password.test.js +0 -76
|
@@ -0,0 +1,280 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard");
|
|
4
|
+
|
|
5
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
6
|
+
|
|
7
|
+
Object.defineProperty(exports, "__esModule", {
|
|
8
|
+
value: true
|
|
9
|
+
});
|
|
10
|
+
exports["default"] = void 0;
|
|
11
|
+
|
|
12
|
+
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
|
|
13
|
+
|
|
14
|
+
var _react = _interopRequireDefault(require("react"));
|
|
15
|
+
|
|
16
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
17
|
+
|
|
18
|
+
var _styledComponents = _interopRequireWildcard(require("styled-components"));
|
|
19
|
+
|
|
20
|
+
var _useTheme = _interopRequireDefault(require("../useTheme.js"));
|
|
21
|
+
|
|
22
|
+
function _templateObject10() {
|
|
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"]);
|
|
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
|
+
};
|
|
68
|
+
|
|
69
|
+
return data;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
function _templateObject5() {
|
|
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"]);
|
|
74
|
+
|
|
75
|
+
_templateObject5 = function _templateObject5() {
|
|
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", {
|
|
123
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
124
|
+
width: "24",
|
|
125
|
+
height: "24",
|
|
126
|
+
viewBox: "0 0 24 24",
|
|
127
|
+
fill: "currentColor"
|
|
128
|
+
}, _react["default"].createElement("path", {
|
|
129
|
+
d: "M0 0h24v24H0V0z",
|
|
130
|
+
fill: "none"
|
|
131
|
+
}), _react["default"].createElement("path", {
|
|
132
|
+
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
|
+
}));
|
|
134
|
+
|
|
135
|
+
var errorIcon = _react["default"].createElement("svg", {
|
|
136
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
137
|
+
height: "24px",
|
|
138
|
+
viewBox: "0 0 24 24",
|
|
139
|
+
width: "24px",
|
|
140
|
+
fill: "currentColor"
|
|
141
|
+
}, _react["default"].createElement("path", {
|
|
142
|
+
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
|
+
}));
|
|
144
|
+
|
|
145
|
+
var FileItem = function FileItem(_ref) {
|
|
146
|
+
var mode = _ref.mode,
|
|
147
|
+
multiple = _ref.multiple,
|
|
148
|
+
_ref$name = _ref.name,
|
|
149
|
+
name = _ref$name === void 0 ? "" : _ref$name,
|
|
150
|
+
_ref$error = _ref.error,
|
|
151
|
+
error = _ref$error === void 0 ? "" : _ref$error,
|
|
152
|
+
showPreview = _ref.showPreview,
|
|
153
|
+
preview = _ref.preview,
|
|
154
|
+
type = _ref.type,
|
|
155
|
+
numFiles = _ref.numFiles,
|
|
156
|
+
onDelete = _ref.onDelete;
|
|
157
|
+
var colorsTheme = (0, _useTheme["default"])();
|
|
158
|
+
var isImage = type.includes("image");
|
|
159
|
+
|
|
160
|
+
var getIconAriaLabel = function getIconAriaLabel() {
|
|
161
|
+
if (type.includes("video")) {
|
|
162
|
+
return "video";
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
if (type.includes("audio")) {
|
|
166
|
+
return "audio";
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
return "file";
|
|
170
|
+
};
|
|
171
|
+
|
|
172
|
+
return _react["default"].createElement(_styledComponents.ThemeProvider, {
|
|
173
|
+
theme: colorsTheme.fileInput
|
|
174
|
+
}, _react["default"].createElement(Container, {
|
|
175
|
+
mode: mode,
|
|
176
|
+
multiple: multiple,
|
|
177
|
+
error: error,
|
|
178
|
+
showPreview: showPreview,
|
|
179
|
+
numFiles: numFiles
|
|
180
|
+
}, showPreview && (isImage ? _react["default"].createElement(ImagePreview, {
|
|
181
|
+
src: preview,
|
|
182
|
+
alt: name
|
|
183
|
+
}) : _react["default"].createElement(IconPreviewContainer, {
|
|
184
|
+
error: error,
|
|
185
|
+
"aria-label": getIconAriaLabel()
|
|
186
|
+
}, _react["default"].createElement(IconPreview, {
|
|
187
|
+
error: error
|
|
188
|
+
}, preview))), _react["default"].createElement(FileItemContent, null, _react["default"].createElement(FileItemContainer, null, _react["default"].createElement(FileName, {
|
|
189
|
+
mode: mode,
|
|
190
|
+
multiple: multiple,
|
|
191
|
+
error: error,
|
|
192
|
+
showPreview: showPreview,
|
|
193
|
+
numFiles: numFiles
|
|
194
|
+
}, name), error && _react["default"].createElement(ErrorIcon, {
|
|
195
|
+
"aria-label": "Error"
|
|
196
|
+
}, errorIcon), _react["default"].createElement(DeleteIcon, {
|
|
197
|
+
onClick: function onClick() {
|
|
198
|
+
return onDelete(name);
|
|
199
|
+
},
|
|
200
|
+
"aria-label": "Remove ".concat(name)
|
|
201
|
+
}, deleteIcon)), error && (multiple || numFiles > 1) && _react["default"].createElement(ErrorMessage, null, error))));
|
|
202
|
+
};
|
|
203
|
+
|
|
204
|
+
var Container = _styledComponents["default"].div(_templateObject(), function (props) {
|
|
205
|
+
return props.showPreview ? "8px" : "8px 8px 8px 16px";
|
|
206
|
+
}, function (props) {
|
|
207
|
+
return props.error && props.theme.errorFileItemBackgroundColor;
|
|
208
|
+
}, function (props) {
|
|
209
|
+
return props.theme.fileItemBorderRadius;
|
|
210
|
+
}, function (props) {
|
|
211
|
+
return props.mode === "file" && !props.multiple && props.numFiles === 1 ? "calc(230px - 26px)" : !props.showPreview ? "calc(320px - 26px)" : props.showPreview && "calc(320px - 18px)";
|
|
212
|
+
}, function (props) {
|
|
213
|
+
return props.mode === "file" && !props.multiple && props.numFiles === 1 || !props.showPreview && !props.error ? "calc(40px - 18px)" : !props.showPreview && props.error ? "calc(59px - 18px)" : "calc(64px - 18px)";
|
|
214
|
+
}, function (props) {
|
|
215
|
+
return props.error ? props.theme.errorFileItemBorderColor : props.theme.fileItemBorderColor;
|
|
216
|
+
}, function (props) {
|
|
217
|
+
return props.theme.fileItemBorderThickness;
|
|
218
|
+
}, function (props) {
|
|
219
|
+
return props.theme.fileItemBorderStyle;
|
|
220
|
+
});
|
|
221
|
+
|
|
222
|
+
var FileItemContent = _styledComponents["default"].div(_templateObject2());
|
|
223
|
+
|
|
224
|
+
var FileItemContainer = _styledComponents["default"].div(_templateObject3());
|
|
225
|
+
|
|
226
|
+
var ImagePreview = _styledComponents["default"].img(_templateObject4());
|
|
227
|
+
|
|
228
|
+
var IconPreviewContainer = _styledComponents["default"].div(_templateObject5(), function (props) {
|
|
229
|
+
return props.error ? props.theme.errorFileItemIconBackgroundColor : props.theme.fileItemIconBackgroundColor;
|
|
230
|
+
}, function (props) {
|
|
231
|
+
return props.error ? props.theme.errorFileItemIconColor : props.theme.fileItemIconColor;
|
|
232
|
+
});
|
|
233
|
+
|
|
234
|
+
var IconPreview = _styledComponents["default"].div(_templateObject6());
|
|
235
|
+
|
|
236
|
+
var FileName = _styledComponents["default"].span(_templateObject7(), function (props) {
|
|
237
|
+
return props.theme.fileNameFontColor;
|
|
238
|
+
}, function (props) {
|
|
239
|
+
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)";
|
|
240
|
+
}, function (props) {
|
|
241
|
+
return props.theme.fileItemFontFamily;
|
|
242
|
+
}, function (props) {
|
|
243
|
+
return props.theme.fileItemFontSize;
|
|
244
|
+
}, function (props) {
|
|
245
|
+
return props.theme.fileItemFontWeight;
|
|
246
|
+
}, function (props) {
|
|
247
|
+
return props.theme.fileItemLineHeight;
|
|
248
|
+
});
|
|
249
|
+
|
|
250
|
+
var ErrorIcon = _styledComponents["default"].span(_templateObject8());
|
|
251
|
+
|
|
252
|
+
var DeleteIcon = _styledComponents["default"].button(_templateObject9(), function (props) {
|
|
253
|
+
return props.theme.fontFamily;
|
|
254
|
+
});
|
|
255
|
+
|
|
256
|
+
var ErrorMessage = _styledComponents["default"].span(_templateObject10(), function (props) {
|
|
257
|
+
return props.theme.errorMessageFontColor;
|
|
258
|
+
}, function (props) {
|
|
259
|
+
return props.theme.errorMessageFontFamily;
|
|
260
|
+
}, function (props) {
|
|
261
|
+
return props.theme.errorMessageFontSize;
|
|
262
|
+
}, function (props) {
|
|
263
|
+
return props.theme.errorMessageFontWeight;
|
|
264
|
+
}, function (props) {
|
|
265
|
+
return props.theme.errorMessageLineHeight;
|
|
266
|
+
});
|
|
267
|
+
|
|
268
|
+
FileItem.propTypes = {
|
|
269
|
+
mode: _propTypes["default"].string,
|
|
270
|
+
multiple: _propTypes["default"].bool,
|
|
271
|
+
name: _propTypes["default"].string,
|
|
272
|
+
type: _propTypes["default"].string,
|
|
273
|
+
showPreview: _propTypes["default"]["boolean"],
|
|
274
|
+
numFiles: _propTypes["default"].number,
|
|
275
|
+
preview: _propTypes["default"].string,
|
|
276
|
+
error: _propTypes["default"].string,
|
|
277
|
+
onDelete: _propTypes["default"].func
|
|
278
|
+
};
|
|
279
|
+
var _default = FileItem;
|
|
280
|
+
exports["default"] = _default;
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
type Size = "small" | "medium" | "large" | "fillParent";
|
|
2
|
+
type Space = "xxsmall" | "xsmall" | "small" | "medium" | "large" | "xlarge" | "xxlarge";
|
|
3
|
+
type Margin = {
|
|
4
|
+
top?: Space;
|
|
5
|
+
bottom?: Space;
|
|
6
|
+
left?: Space;
|
|
7
|
+
right?: Space;
|
|
8
|
+
};
|
|
9
|
+
type FileData = {
|
|
10
|
+
error?: string;
|
|
11
|
+
file?: File;
|
|
12
|
+
preview?: string;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
type Props = {
|
|
16
|
+
/**
|
|
17
|
+
* Name attribute of the file input element.
|
|
18
|
+
*/
|
|
19
|
+
name?: string;
|
|
20
|
+
/**
|
|
21
|
+
* Text to be placed above the file input.
|
|
22
|
+
*/
|
|
23
|
+
label?: string;
|
|
24
|
+
/**
|
|
25
|
+
* Uses one of the available file input modes:
|
|
26
|
+
* 'file': Files are selected by clicking the button and selecting it through the file explorer.
|
|
27
|
+
* '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.
|
|
28
|
+
* '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.
|
|
29
|
+
* The drag and drop area of this mode is bigger than the one of the filedrop mode.
|
|
30
|
+
*/
|
|
31
|
+
mode?: "file" | "filedrop" | "dropzone";
|
|
32
|
+
/**
|
|
33
|
+
* Helper text to be placed above the file input.
|
|
34
|
+
*/
|
|
35
|
+
helperText?: string;
|
|
36
|
+
/**
|
|
37
|
+
* Defines the file types accepted by the component. It is not possible to select a file with a non valid type.
|
|
38
|
+
*/
|
|
39
|
+
accept?: string;
|
|
40
|
+
/**
|
|
41
|
+
* An array of FileData representing the selected files.
|
|
42
|
+
*/
|
|
43
|
+
value?: FileData[];
|
|
44
|
+
/**
|
|
45
|
+
* Minimum file size allowed (in bytes). If the file size does not comply the minSize, an error will be passed to the FileData.
|
|
46
|
+
*/
|
|
47
|
+
minSize?: number;
|
|
48
|
+
/**
|
|
49
|
+
* Maximum file size allowed (in bytes). If the file size does not comply the maxSize, an error will be passed to the FileData.
|
|
50
|
+
*/
|
|
51
|
+
maxSize?: number;
|
|
52
|
+
/**
|
|
53
|
+
* If true and if the file is an image, a preview of it will be shown. If it is not an image, an icon refering to the file's type will be shown.
|
|
54
|
+
* If mode is not multiple and there is one file already selected, the file will be replaced by the last selected one.
|
|
55
|
+
*/
|
|
56
|
+
showPreview?: boolean;
|
|
57
|
+
/**
|
|
58
|
+
* If true, more than one file can be selected. If false, only one file can be selected.
|
|
59
|
+
*/
|
|
60
|
+
multiple?: boolean;
|
|
61
|
+
/**
|
|
62
|
+
* If true, the component will be disabled.
|
|
63
|
+
*/
|
|
64
|
+
disabled?: boolean;
|
|
65
|
+
/**
|
|
66
|
+
* This function will be called when the user selects or drops a file. The list of files will be sent as a parameter.
|
|
67
|
+
* 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.
|
|
68
|
+
*/
|
|
69
|
+
callbackFile?: (files: FileData[]) => void;
|
|
70
|
+
/**
|
|
71
|
+
* Size of the margin to be applied to the component ('xxsmall' | 'xsmall' | 'small' | 'medium' | 'large' | 'xlarge' | 'xxlarge').
|
|
72
|
+
* You can pass an object with 'top', 'bottom', 'left' and 'right' properties in order to specify different margin sizes.
|
|
73
|
+
*/
|
|
74
|
+
margin?: Space | Margin;
|
|
75
|
+
/**
|
|
76
|
+
* Value of the tabindex attribute.
|
|
77
|
+
*/
|
|
78
|
+
tabIndex?: number;
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
export default function DxcTextInput(props: Props): JSX.Element;
|
package/dist/header/Header.js
CHANGED
|
@@ -27,7 +27,7 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
|
27
27
|
|
|
28
28
|
var _Dropdown = _interopRequireDefault(require("../dropdown/Dropdown"));
|
|
29
29
|
|
|
30
|
-
var
|
|
30
|
+
var _Icons = require("./Icons");
|
|
31
31
|
|
|
32
32
|
var _variables = require("../common/variables.js");
|
|
33
33
|
|
|
@@ -35,9 +35,29 @@ var _useTheme = _interopRequireDefault(require("../useTheme.js"));
|
|
|
35
35
|
|
|
36
36
|
var _BackgroundColorContext = require("../BackgroundColorContext.js");
|
|
37
37
|
|
|
38
|
-
function
|
|
38
|
+
function _templateObject14() {
|
|
39
39
|
var data = (0, _taggedTemplateLiteral2["default"])(["\n position: fixed;\n top: 0;\n left: 0;\n width: 100vw;\n height: 100vh;\n background-color: ", ";\n opacity: ", " !important;\n visibility: ", ";\n opacity: ", ";\n display: ", ";\n transition: opacity 0.2s 0.2s ease-in-out;\n z-index: ", ";\n"]);
|
|
40
40
|
|
|
41
|
+
_templateObject14 = function _templateObject14() {
|
|
42
|
+
return data;
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
return data;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
function _templateObject13() {
|
|
49
|
+
var data = (0, _taggedTemplateLiteral2["default"])(["\n height: 100%;\n margin-top: 40px;\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n"]);
|
|
50
|
+
|
|
51
|
+
_templateObject13 = function _templateObject13() {
|
|
52
|
+
return data;
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
return data;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
function _templateObject12() {
|
|
59
|
+
var data = (0, _taggedTemplateLiteral2["default"])(["\n cursor: pointer;\n :focus {\n outline: ", " auto 1px;\n }\n position: fixed;\n top: 23px;\n right: 20px;\n width: 24px;\n height: 24px;\n padding: ", ";\n"]);
|
|
60
|
+
|
|
41
61
|
_templateObject12 = function _templateObject12() {
|
|
42
62
|
return data;
|
|
43
63
|
};
|
|
@@ -46,7 +66,7 @@ function _templateObject12() {
|
|
|
46
66
|
}
|
|
47
67
|
|
|
48
68
|
function _templateObject11() {
|
|
49
|
-
var data = (0, _taggedTemplateLiteral2["default"])(["\n
|
|
69
|
+
var data = (0, _taggedTemplateLiteral2["default"])(["\n max-height: ", ";\n width: ", ";\n position: absolute;\n top: 23px;\n left: 20px;\n"]);
|
|
50
70
|
|
|
51
71
|
_templateObject11 = function _templateObject11() {
|
|
52
72
|
return data;
|
|
@@ -56,7 +76,7 @@ function _templateObject11() {
|
|
|
56
76
|
}
|
|
57
77
|
|
|
58
78
|
function _templateObject10() {
|
|
59
|
-
var data = (0, _taggedTemplateLiteral2["default"])(["\n
|
|
79
|
+
var data = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n justify-content: space-evenly;\n background-color: ", ";\n position: fixed;\n top: 0;\n right: 0;\n z-index: ", ";\n width: ", ";\n height: 100vh;\n padding: 20px;\n transform: ", ";\n opacity: ", ";\n transition-property: transform, opacity;\n transition-duration: 0.6s;\n transition-timing-function: ease-in-out;\n box-sizing: border-box;\n"]);
|
|
60
80
|
|
|
61
81
|
_templateObject10 = function _templateObject10() {
|
|
62
82
|
return data;
|
|
@@ -66,7 +86,7 @@ function _templateObject10() {
|
|
|
66
86
|
}
|
|
67
87
|
|
|
68
88
|
function _templateObject9() {
|
|
69
|
-
var data = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n flex-
|
|
89
|
+
var data = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n flex-grow: 1;\n"]);
|
|
70
90
|
|
|
71
91
|
_templateObject9 = function _templateObject9() {
|
|
72
92
|
return data;
|
|
@@ -76,7 +96,7 @@ function _templateObject9() {
|
|
|
76
96
|
}
|
|
77
97
|
|
|
78
98
|
function _templateObject8() {
|
|
79
|
-
var data = (0, _taggedTemplateLiteral2["default"])(["\n
|
|
99
|
+
var data = (0, _taggedTemplateLiteral2["default"])(["\n font-family: ", ";\n font-style: ", ";\n font-size: ", ";\n text-transform: ", ";\n font-weight: ", ";\n color: ", ";\n"]);
|
|
80
100
|
|
|
81
101
|
_templateObject8 = function _templateObject8() {
|
|
82
102
|
return data;
|
|
@@ -86,7 +106,7 @@ function _templateObject8() {
|
|
|
86
106
|
}
|
|
87
107
|
|
|
88
108
|
function _templateObject7() {
|
|
89
|
-
var data = (0, _taggedTemplateLiteral2["default"])(["\n
|
|
109
|
+
var data = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n flex-direction: column;\n justify-content: center;\n align-items: center;\n width: 54px;\n cursor: pointer;\n :hover {\n background-color: ", ";\n }\n &:focus {\n outline: ", " auto 1px;\n }\n & > svg {\n fill: ", ";\n }\n"]);
|
|
90
110
|
|
|
91
111
|
_templateObject7 = function _templateObject7() {
|
|
92
112
|
return data;
|
|
@@ -96,7 +116,7 @@ function _templateObject7() {
|
|
|
96
116
|
}
|
|
97
117
|
|
|
98
118
|
function _templateObject6() {
|
|
99
|
-
var data = (0, _taggedTemplateLiteral2["default"])(["\n
|
|
119
|
+
var data = (0, _taggedTemplateLiteral2["default"])(["\n width: calc(100% - 186px);\n display: flex;\n align-items: center;\n flex-grow: 1;\n justify-content: flex-end;\n padding: ", ";\n padding-top: ", ";\n padding-right: ", ";\n padding-bottom: ", ";\n padding-left: ", ";\n"]);
|
|
100
120
|
|
|
101
121
|
_templateObject6 = function _templateObject6() {
|
|
102
122
|
return data;
|
|
@@ -106,7 +126,7 @@ function _templateObject6() {
|
|
|
106
126
|
}
|
|
107
127
|
|
|
108
128
|
function _templateObject5() {
|
|
109
|
-
var data = (0, _taggedTemplateLiteral2["default"])(["\n
|
|
129
|
+
var data = (0, _taggedTemplateLiteral2["default"])(["\n max-height: ", ";\n width: ", ";\n vertical-align: middle;\n"]);
|
|
110
130
|
|
|
111
131
|
_templateObject5 = function _templateObject5() {
|
|
112
132
|
return data;
|
|
@@ -116,7 +136,7 @@ function _templateObject5() {
|
|
|
116
136
|
}
|
|
117
137
|
|
|
118
138
|
function _templateObject4() {
|
|
119
|
-
var data = (0, _taggedTemplateLiteral2["default"])(["\n max-height: ", ";\n width: ", ";\n
|
|
139
|
+
var data = (0, _taggedTemplateLiteral2["default"])(["\n max-height: ", ";\n width: ", ";\n"]);
|
|
120
140
|
|
|
121
141
|
_templateObject4 = function _templateObject4() {
|
|
122
142
|
return data;
|
|
@@ -161,11 +181,24 @@ var Dropdown = function Dropdown(props) {
|
|
|
161
181
|
|
|
162
182
|
var HeaderDropdown = _styledComponents["default"].div(_templateObject());
|
|
163
183
|
|
|
184
|
+
var getLogoElement = function getLogoElement(themeInput) {
|
|
185
|
+
if (!themeInput) {
|
|
186
|
+
return _Icons.dxcLogo;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
if (typeof themeInput === "string") {
|
|
190
|
+
return _react["default"].createElement(LogoImg, {
|
|
191
|
+
alt: "Logo",
|
|
192
|
+
src: themeInput
|
|
193
|
+
});
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
return themeInput;
|
|
197
|
+
};
|
|
198
|
+
|
|
164
199
|
var DxcHeader = function DxcHeader(_ref) {
|
|
165
200
|
var _ref$underlined = _ref.underlined,
|
|
166
201
|
underlined = _ref$underlined === void 0 ? false : _ref$underlined,
|
|
167
|
-
_ref$logoSrc = _ref.logoSrc,
|
|
168
|
-
logoSrc = _ref$logoSrc === void 0 ? "default" : _ref$logoSrc,
|
|
169
202
|
onClick = _ref.onClick,
|
|
170
203
|
content = _ref.content,
|
|
171
204
|
responsiveContent = _ref.responsiveContent,
|
|
@@ -211,12 +244,12 @@ var DxcHeader = function DxcHeader(_ref) {
|
|
|
211
244
|
}
|
|
212
245
|
};
|
|
213
246
|
|
|
214
|
-
var
|
|
215
|
-
return
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
};
|
|
247
|
+
var headerLogo = (0, _react.useMemo)(function () {
|
|
248
|
+
return getLogoElement(colorsTheme.header.logo);
|
|
249
|
+
}, [colorsTheme.header.logo]);
|
|
250
|
+
var headerResponsiveLogo = (0, _react.useMemo)(function () {
|
|
251
|
+
return getLogoElement(colorsTheme.header.logoResponsive);
|
|
252
|
+
}, [colorsTheme.header.logoResponsive]);
|
|
220
253
|
|
|
221
254
|
var handleEventListener = function handleEventListener() {
|
|
222
255
|
handleResize(ref.current.offsetWidth);
|
|
@@ -232,18 +265,6 @@ var DxcHeader = function DxcHeader(_ref) {
|
|
|
232
265
|
window.removeEventListener("resize", handleEventListener);
|
|
233
266
|
};
|
|
234
267
|
}, []);
|
|
235
|
-
|
|
236
|
-
var HamburgerIcon = function HamburgerIcon() {
|
|
237
|
-
return _react["default"].createElement("svg", {
|
|
238
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
239
|
-
viewBox: "0 0 24 24",
|
|
240
|
-
width: "24",
|
|
241
|
-
height: "24"
|
|
242
|
-
}, _react["default"].createElement("path", {
|
|
243
|
-
d: "M3,8H21a1,1,0,0,0,0-2H3A1,1,0,0,0,3,8Zm18,8H3a1,1,0,0,0,0,2H21a1,1,0,0,0,0-2Zm0-5H3a1,1,0,0,0,0,2H21a1,1,0,0,0,0-2Z"
|
|
244
|
-
}));
|
|
245
|
-
};
|
|
246
|
-
|
|
247
268
|
return _react["default"].createElement(_styledComponents.ThemeProvider, {
|
|
248
269
|
theme: colorsTheme.header
|
|
249
270
|
}, _react["default"].createElement(HeaderContainer, {
|
|
@@ -255,21 +276,20 @@ var DxcHeader = function DxcHeader(_ref) {
|
|
|
255
276
|
tabIndex: typeof onClick === "function" ? tabIndex : -1,
|
|
256
277
|
interactuable: typeof onClick === "function",
|
|
257
278
|
onClick: onClick
|
|
258
|
-
},
|
|
279
|
+
}, _react["default"].createElement(LogoContainer, null, headerLogo)), isResponsive && responsiveContent && _react["default"].createElement(MainContainer, null, _react["default"].createElement(ChildContainer, {
|
|
259
280
|
padding: padding
|
|
260
281
|
}, _react["default"].createElement(HamburguerItem, {
|
|
261
282
|
tabIndex: tabIndex,
|
|
262
283
|
underlined: underlined,
|
|
263
284
|
onClick: handleMenu
|
|
264
|
-
},
|
|
285
|
+
}, _Icons.hamburgerIcon, _react["default"].createElement(HamburguerTitle, null, "Menu"))), _react["default"].createElement("div", null, _react["default"].createElement(ResponsiveMenu, {
|
|
265
286
|
hasVisibility: isMenuVisible,
|
|
266
287
|
refSize: refSize
|
|
267
|
-
},
|
|
288
|
+
}, _react["default"].createElement(ResponsiveLogoContainer, null, headerResponsiveLogo), _react["default"].createElement(MenuContent, null, responsiveContent(handleMenu)), _react["default"].createElement(CloseContainer, {
|
|
268
289
|
tabIndex: tabIndex,
|
|
269
290
|
onClick: handleMenu,
|
|
270
|
-
src: _close_icon["default"],
|
|
271
291
|
className: "closeIcon"
|
|
272
|
-
})), _react["default"].createElement(Overlay, {
|
|
292
|
+
}, _Icons.closeIcon)), _react["default"].createElement(Overlay, {
|
|
273
293
|
onClick: handleMenu,
|
|
274
294
|
hasVisibility: isMenuVisible,
|
|
275
295
|
refSize: refSize
|
|
@@ -296,18 +316,24 @@ var HeaderContainer = (0, _styledComponents["default"])(_AppBar["default"])(_tem
|
|
|
296
316
|
var LogoAnchor = _styledComponents["default"].a(_templateObject3(), function (props) {
|
|
297
317
|
if (!props.interactuable) {
|
|
298
318
|
return "cursor: default; outline:none;";
|
|
299
|
-
} else {
|
|
300
|
-
return "cursor: pointer;";
|
|
301
319
|
}
|
|
320
|
+
|
|
321
|
+
return "cursor: pointer;";
|
|
302
322
|
});
|
|
303
323
|
|
|
304
|
-
var
|
|
324
|
+
var LogoImg = _styledComponents["default"].img(_templateObject4(), function (props) {
|
|
305
325
|
return props.theme.logoHeight;
|
|
306
326
|
}, function (props) {
|
|
307
327
|
return props.theme.logoWidth;
|
|
308
328
|
});
|
|
309
329
|
|
|
310
|
-
var
|
|
330
|
+
var LogoContainer = _styledComponents["default"].div(_templateObject5(), function (props) {
|
|
331
|
+
return props.theme.logoHeight;
|
|
332
|
+
}, function (props) {
|
|
333
|
+
return props.theme.logoWidth;
|
|
334
|
+
});
|
|
335
|
+
|
|
336
|
+
var ChildContainer = _styledComponents["default"].div(_templateObject6(), function (props) {
|
|
311
337
|
return props.padding && (0, _typeof2["default"])(props.padding) !== "object" ? _variables.spaces[props.padding] : "0px";
|
|
312
338
|
}, function (props) {
|
|
313
339
|
return props.padding && (0, _typeof2["default"])(props.padding) === "object" && props.padding.top ? _variables.spaces[props.padding.top] : "";
|
|
@@ -317,19 +343,9 @@ var ChildContainer = _styledComponents["default"].div(_templateObject5(), functi
|
|
|
317
343
|
return props.padding && (0, _typeof2["default"])(props.padding) === "object" && props.padding.bottom ? _variables.spaces[props.padding.bottom] : "";
|
|
318
344
|
}, function (props) {
|
|
319
345
|
return props.padding && (0, _typeof2["default"])(props.padding) === "object" && props.padding.left ? _variables.spaces[props.padding.left] : "";
|
|
320
|
-
}, function (props) {
|
|
321
|
-
return props.theme.customContentFontFamily;
|
|
322
|
-
}, function (props) {
|
|
323
|
-
return props.theme.customContentFontStyle;
|
|
324
|
-
}, function (props) {
|
|
325
|
-
return props.theme.customContentFontSize;
|
|
326
|
-
}, function (props) {
|
|
327
|
-
return props.theme.customContentFontWeight;
|
|
328
|
-
}, function (props) {
|
|
329
|
-
return props.theme.customContentFontColor;
|
|
330
346
|
});
|
|
331
347
|
|
|
332
|
-
var HamburguerItem = _styledComponents["default"].div(
|
|
348
|
+
var HamburguerItem = _styledComponents["default"].div(_templateObject7(), function (props) {
|
|
333
349
|
return props.theme.hamburguerHoverColor;
|
|
334
350
|
}, function (props) {
|
|
335
351
|
return props.theme.hamburguerFocusColor;
|
|
@@ -337,7 +353,7 @@ var HamburguerItem = _styledComponents["default"].div(_templateObject6(), functi
|
|
|
337
353
|
return props.theme.hamburguerIconColor;
|
|
338
354
|
});
|
|
339
355
|
|
|
340
|
-
var HamburguerTitle = _styledComponents["default"].span(
|
|
356
|
+
var HamburguerTitle = _styledComponents["default"].span(_templateObject8(), function (props) {
|
|
341
357
|
return props.theme.hamburguerFontFamily;
|
|
342
358
|
}, function (props) {
|
|
343
359
|
return props.theme.hamburguerFontStyle;
|
|
@@ -351,9 +367,9 @@ var HamburguerTitle = _styledComponents["default"].span(_templateObject7(), func
|
|
|
351
367
|
return props.theme.hamburguerFontColor;
|
|
352
368
|
});
|
|
353
369
|
|
|
354
|
-
var MainContainer = _styledComponents["default"].div(
|
|
370
|
+
var MainContainer = _styledComponents["default"].div(_templateObject9());
|
|
355
371
|
|
|
356
|
-
var ResponsiveMenu = _styledComponents["default"].div(
|
|
372
|
+
var ResponsiveMenu = _styledComponents["default"].div(_templateObject10(), function (props) {
|
|
357
373
|
return props.theme.menuBackgroundColor;
|
|
358
374
|
}, function (props) {
|
|
359
375
|
return props.theme.menuZindex;
|
|
@@ -367,25 +383,21 @@ var ResponsiveMenu = _styledComponents["default"].div(_templateObject9(), functi
|
|
|
367
383
|
return props.hasVisibility ? "translateX(0)" : "translateX(100vw)";
|
|
368
384
|
}, function (props) {
|
|
369
385
|
return props.hasVisibility ? "1" : "0.96";
|
|
370
|
-
}
|
|
386
|
+
});
|
|
371
387
|
|
|
372
|
-
var
|
|
373
|
-
return props.theme.
|
|
374
|
-
}, function (props) {
|
|
375
|
-
return props.theme.menuCustomContentFontStyle;
|
|
376
|
-
}, function (props) {
|
|
377
|
-
return props.theme.menuCustomContentFontSize;
|
|
378
|
-
}, function (props) {
|
|
379
|
-
return props.theme.menuCustomContentFontWeight;
|
|
388
|
+
var ResponsiveLogoContainer = _styledComponents["default"].div(_templateObject11(), function (props) {
|
|
389
|
+
return props.theme.logoHeight;
|
|
380
390
|
}, function (props) {
|
|
381
|
-
return props.theme.
|
|
391
|
+
return props.theme.logoWidth;
|
|
382
392
|
});
|
|
383
393
|
|
|
384
|
-
var CloseContainer = _styledComponents["default"].
|
|
394
|
+
var CloseContainer = _styledComponents["default"].div(_templateObject12(), function (props) {
|
|
385
395
|
return props.theme.hamburguerFocusColor;
|
|
386
|
-
});
|
|
396
|
+
}, _variables.spaces.xxsmall);
|
|
397
|
+
|
|
398
|
+
var MenuContent = _styledComponents["default"].div(_templateObject13());
|
|
387
399
|
|
|
388
|
-
var Overlay = _styledComponents["default"].div(
|
|
400
|
+
var Overlay = _styledComponents["default"].div(_templateObject14(), function (props) {
|
|
389
401
|
return props.theme.overlayColor;
|
|
390
402
|
}, function (props) {
|
|
391
403
|
return props.theme.overlayOpacity;
|
|
@@ -400,7 +412,6 @@ var Overlay = _styledComponents["default"].div(_templateObject12(), function (pr
|
|
|
400
412
|
});
|
|
401
413
|
|
|
402
414
|
DxcHeader.propTypes = {
|
|
403
|
-
logoSrc: _propTypes["default"].string,
|
|
404
415
|
underlined: _propTypes["default"].bool,
|
|
405
416
|
onClick: _propTypes["default"].func,
|
|
406
417
|
margin: _propTypes["default"].oneOfType([_propTypes["default"].shape({
|