@dxc-technology/halstack-react 0.0.0-a9032ad → 0.0.0-a9c6846
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/babel.config.js +6 -2
- package/dist/BackgroundColorContext.js +46 -0
- package/dist/ThemeContext.js +235 -2
- package/dist/accordion/Accordion.js +170 -65
- package/dist/accordion-group/AccordionGroup.js +186 -0
- package/dist/alert/Alert.js +180 -81
- package/dist/alert/index.d.ts +51 -0
- package/dist/badge/Badge.js +63 -0
- package/dist/box/Box.js +31 -23
- package/dist/button/Button.js +83 -26
- package/dist/card/Card.js +72 -35
- package/dist/checkbox/Checkbox.js +98 -38
- package/dist/chip/Chip.js +128 -36
- package/dist/common/RequiredComponent.js +2 -8
- package/dist/common/utils.js +2 -22
- package/dist/common/variables.js +1311 -308
- package/dist/date/Date.js +75 -52
- package/dist/dialog/Dialog.js +58 -37
- package/dist/dropdown/Dropdown.js +199 -71
- package/dist/file-input/FileInput.js +641 -0
- package/dist/file-input/FileItem.js +280 -0
- package/dist/file-input/index.d.ts +81 -0
- package/dist/footer/Footer.js +85 -36
- package/dist/footer/dxc_logo.svg +15 -0
- package/dist/header/Header.js +111 -68
- package/dist/header/dxc_logo_black.svg +8 -0
- package/dist/heading/Heading.js +81 -16
- package/dist/input-text/InputText.js +288 -100
- package/dist/layout/ApplicationLayout.js +105 -50
- package/dist/link/Link.js +136 -35
- package/dist/main.d.ts +7 -0
- package/dist/main.js +81 -1
- package/dist/new-date/NewDate.js +400 -0
- package/dist/new-date/index.d.ts +95 -0
- package/dist/new-input-text/NewInputText.js +982 -0
- package/dist/new-input-text/index.d.ts +135 -0
- package/dist/new-textarea/NewTextarea.js +362 -0
- package/dist/new-textarea/index.d.ts +117 -0
- package/dist/number/Number.js +138 -0
- package/dist/number/NumberContext.js +16 -0
- package/dist/number/index.d.ts +113 -0
- package/dist/paginator/Paginator.js +149 -56
- package/dist/password/Password.js +200 -0
- package/dist/password/index.d.ts +94 -0
- package/dist/password/styles.css +3 -0
- package/dist/progress-bar/ProgressBar.js +95 -38
- package/dist/radio/Radio.js +31 -17
- package/dist/resultsetTable/ResultsetTable.js +93 -68
- package/dist/select/Select.js +244 -146
- package/dist/sidenav/Sidenav.js +86 -129
- package/dist/slider/Slider.js +125 -64
- package/dist/spinner/Spinner.js +247 -59
- package/dist/switch/Switch.js +50 -27
- package/dist/table/Table.js +52 -13
- package/dist/tabs/Tabs.js +206 -35
- package/dist/tabs-for-sections/TabsForSections.js +1 -16
- package/dist/tag/Tag.js +100 -35
- package/dist/textarea/Textarea.js +77 -40
- package/dist/toggle/Toggle.js +16 -19
- package/dist/toggle-group/ToggleGroup.js +64 -55
- package/dist/upload/Upload.js +13 -8
- package/dist/upload/buttons-upload/ButtonsUpload.js +31 -14
- package/dist/upload/dragAndDropArea/DragAndDropArea.js +78 -28
- package/dist/upload/file-upload/FileToUpload.js +50 -24
- package/dist/upload/files-upload/FilesToUpload.js +16 -16
- package/dist/upload/transaction/Transaction.js +44 -24
- package/dist/upload/transactions/Transactions.js +38 -20
- package/dist/useTheme.js +22 -0
- package/dist/wizard/Wizard.js +139 -55
- package/dist/wizard/invalid_icon.svg +4 -5
- package/dist/wizard/valid_icon.svg +4 -5
- package/package.json +13 -5
- package/test/AccordionGroup.test.js +125 -0
- package/test/Date.test.js +13 -13
- package/test/Dropdown.test.js +15 -0
- package/test/FileInput.test.js +201 -0
- package/test/InputText.test.js +30 -26
- package/test/Link.test.js +25 -7
- package/test/NewDate.test.js +232 -0
- package/test/NewInputText.test.js +734 -0
- package/test/NewTextarea.test.js +195 -0
- package/test/Number.test.js +257 -0
- package/test/Paginator.test.js +72 -60
- package/test/Password.test.js +83 -0
- package/test/ResultsetTable.test.js +66 -19
- package/test/Select.test.js +55 -34
- package/test/Sidenav.test.js +22 -64
- package/test/Slider.test.js +17 -0
- package/test/Spinner.test.js +5 -0
- package/test/Tabs.test.js +21 -0
- package/dist/accordion/Accordion.stories.js +0 -207
- package/dist/accordion/readme.md +0 -96
- 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/common/services/example-service.js +0 -10
- package/dist/common/services/example-service.test.js +0 -12
- package/dist/date/calendar.svg +0 -1
- package/dist/date/calendar_dark.svg +0 -1
- 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/dxc_logo_wht.png +0 -0
- package/dist/header/dxc_logo_black.png +0 -0
- package/dist/header/dxc_logo_blk_rgb.svg +0 -6
- package/dist/header/dxc_logo_white.png +0 -0
- package/dist/layout/SideNav.js +0 -67
- package/dist/select/Select.stories.js +0 -235
- package/dist/select/readme.md +0 -72
- package/dist/sidenav/arrow_icon.svg +0 -3
- package/dist/toggle-group/readme.md +0 -82
- package/test/Toggle.test.js +0 -43
package/dist/tag/Tag.js
CHANGED
|
@@ -11,24 +11,46 @@ exports["default"] = void 0;
|
|
|
11
11
|
|
|
12
12
|
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
13
13
|
|
|
14
|
-
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
|
|
15
|
-
|
|
16
14
|
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
|
|
17
15
|
|
|
16
|
+
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
|
|
17
|
+
|
|
18
18
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
19
19
|
|
|
20
20
|
var _react = _interopRequireWildcard(require("react"));
|
|
21
21
|
|
|
22
|
-
var _styledComponents =
|
|
22
|
+
var _styledComponents = _interopRequireWildcard(require("styled-components"));
|
|
23
23
|
|
|
24
24
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
25
25
|
|
|
26
26
|
var _variables = require("../common/variables.js");
|
|
27
27
|
|
|
28
|
+
var _useTheme = _interopRequireDefault(require("../useTheme.js"));
|
|
29
|
+
|
|
28
30
|
var _Box = _interopRequireDefault(require("../box/Box"));
|
|
29
31
|
|
|
32
|
+
function _templateObject8() {
|
|
33
|
+
var data = (0, _taggedTemplateLiteral2["default"])(["\n font-family: ", ";\n font-size: ", ";\n font-style: ", ";\n font-weight: ", ";\n color: ", ";\n padding-top: ", ";\n padding-bottom: ", ";\n padding-left: ", ";\n padding-right: ", ";\n flex-grow: 1;\n text-align: center;\n text-overflow: ellipsis;\n overflow: hidden;\n white-space: nowrap;\n"]);
|
|
34
|
+
|
|
35
|
+
_templateObject8 = function _templateObject8() {
|
|
36
|
+
return data;
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
return data;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
function _templateObject7() {
|
|
43
|
+
var data = (0, _taggedTemplateLiteral2["default"])(["\n display: inline-flex;\n background: ", ";\n width: ", ";\n height: 100%;\n justify-content: center;\n align-items: center;\n color: ", ";\n"]);
|
|
44
|
+
|
|
45
|
+
_templateObject7 = function _templateObject7() {
|
|
46
|
+
return data;
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
return data;
|
|
50
|
+
}
|
|
51
|
+
|
|
30
52
|
function _templateObject6() {
|
|
31
|
-
var data = (0, _taggedTemplateLiteral2["default"])(["\n
|
|
53
|
+
var data = (0, _taggedTemplateLiteral2["default"])(["\n display: inline-flex;\n justify-content: center;\n align-items: center;\n overflow: hidden;\n\n img,\n svg {\n width: ", ";\n height: ", ";\n }\n"]);
|
|
32
54
|
|
|
33
55
|
_templateObject6 = function _templateObject6() {
|
|
34
56
|
return data;
|
|
@@ -38,7 +60,7 @@ function _templateObject6() {
|
|
|
38
60
|
}
|
|
39
61
|
|
|
40
62
|
function _templateObject5() {
|
|
41
|
-
var data = (0, _taggedTemplateLiteral2["default"])(["\n display: inline-flex;\n
|
|
63
|
+
var data = (0, _taggedTemplateLiteral2["default"])(["\n display: inline-flex;\n justify-content: center;\n align-items: center;\n overflow: hidden;\n width: ", ";\n height: ", ";\n"]);
|
|
42
64
|
|
|
43
65
|
_templateObject5 = function _templateObject5() {
|
|
44
66
|
return data;
|
|
@@ -48,7 +70,7 @@ function _templateObject5() {
|
|
|
48
70
|
}
|
|
49
71
|
|
|
50
72
|
function _templateObject4() {
|
|
51
|
-
var data = (0, _taggedTemplateLiteral2["default"])(["\n padding:
|
|
73
|
+
var data = (0, _taggedTemplateLiteral2["default"])(["\n background: none;\n border-radius: 4px;\n border: none;\n padding: 0;\n cursor: pointer;\n font-family: inherit;\n\n :focus {\n outline: 2px solid ", ";\n }\n"]);
|
|
52
74
|
|
|
53
75
|
_templateObject4 = function _templateObject4() {
|
|
54
76
|
return data;
|
|
@@ -58,7 +80,7 @@ function _templateObject4() {
|
|
|
58
80
|
}
|
|
59
81
|
|
|
60
82
|
function _templateObject3() {
|
|
61
|
-
var data = (0, _taggedTemplateLiteral2["default"])(["\n text-decoration: none;\n"]);
|
|
83
|
+
var data = (0, _taggedTemplateLiteral2["default"])(["\n text-decoration: none;\n border-radius: 4px;\n\n :focus {\n outline: 2px solid ", ";\n outline-offset: 0px;\n }\n"]);
|
|
62
84
|
|
|
63
85
|
_templateObject3 = function _templateObject3() {
|
|
64
86
|
return data;
|
|
@@ -68,7 +90,7 @@ function _templateObject3() {
|
|
|
68
90
|
}
|
|
69
91
|
|
|
70
92
|
function _templateObject2() {
|
|
71
|
-
var data = (0, _taggedTemplateLiteral2["default"])(["\n display: inline-flex;\n align-items: center;\n flex-direction: ", ";\n width: ", ";\n"]);
|
|
93
|
+
var data = (0, _taggedTemplateLiteral2["default"])(["\n display: inline-flex;\n align-items: center;\n flex-direction: ", ";\n width: ", ";\n height: ", ";\n"]);
|
|
72
94
|
|
|
73
95
|
_templateObject2 = function _templateObject2() {
|
|
74
96
|
return data;
|
|
@@ -78,7 +100,7 @@ function _templateObject2() {
|
|
|
78
100
|
}
|
|
79
101
|
|
|
80
102
|
function _templateObject() {
|
|
81
|
-
var data = (0, _taggedTemplateLiteral2["default"])(["\n display: inline-flex;\n cursor: ", ";\n
|
|
103
|
+
var data = (0, _taggedTemplateLiteral2["default"])(["\n display: inline-flex;\n cursor: ", ";\n margin: ", ";\n margin-top: ", ";\n margin-right: ", ";\n margin-bottom: ", ";\n margin-left: ", ";\n"]);
|
|
82
104
|
|
|
83
105
|
_templateObject = function _templateObject() {
|
|
84
106
|
return data;
|
|
@@ -88,17 +110,23 @@ function _templateObject() {
|
|
|
88
110
|
}
|
|
89
111
|
|
|
90
112
|
var DxcTag = function DxcTag(_ref) {
|
|
91
|
-
var
|
|
113
|
+
var icon = _ref.icon,
|
|
114
|
+
iconSrc = _ref.iconSrc,
|
|
92
115
|
label = _ref.label,
|
|
93
116
|
margin = _ref.margin,
|
|
94
117
|
linkHref = _ref.linkHref,
|
|
95
118
|
onClick = _ref.onClick,
|
|
96
119
|
_ref$iconBgColor = _ref.iconBgColor,
|
|
97
|
-
iconBgColor = _ref$iconBgColor === void 0 ? "
|
|
120
|
+
iconBgColor = _ref$iconBgColor === void 0 ? "#5f249f" : _ref$iconBgColor,
|
|
98
121
|
_ref$labelPosition = _ref.labelPosition,
|
|
99
122
|
labelPosition = _ref$labelPosition === void 0 ? "after" : _ref$labelPosition,
|
|
123
|
+
_ref$newWindow = _ref.newWindow,
|
|
124
|
+
newWindow = _ref$newWindow === void 0 ? false : _ref$newWindow,
|
|
100
125
|
_ref$size = _ref.size,
|
|
101
|
-
size = _ref$size === void 0 ? "fitContent" : _ref$size
|
|
126
|
+
size = _ref$size === void 0 ? "fitContent" : _ref$size,
|
|
127
|
+
_ref$tabIndex = _ref.tabIndex,
|
|
128
|
+
tabIndex = _ref$tabIndex === void 0 ? 0 : _ref$tabIndex;
|
|
129
|
+
var colorsTheme = (0, _useTheme["default"])();
|
|
102
130
|
|
|
103
131
|
var _useState = (0, _react.useState)(false),
|
|
104
132
|
_useState2 = (0, _slicedToArray2["default"])(_useState, 2),
|
|
@@ -106,9 +134,7 @@ var DxcTag = function DxcTag(_ref) {
|
|
|
106
134
|
changeIsHovered = _useState2[1];
|
|
107
135
|
|
|
108
136
|
var clickHandler = function clickHandler() {
|
|
109
|
-
|
|
110
|
-
onClick();
|
|
111
|
-
}
|
|
137
|
+
onClick && onClick();
|
|
112
138
|
};
|
|
113
139
|
|
|
114
140
|
var tagContent = _react["default"].createElement(_Box["default"], {
|
|
@@ -116,15 +142,16 @@ var DxcTag = function DxcTag(_ref) {
|
|
|
116
142
|
shadowDepth: isHovered && (onClick || linkHref) && 2 || 1
|
|
117
143
|
}, _react["default"].createElement(TagContent, {
|
|
118
144
|
labelPosition: labelPosition,
|
|
119
|
-
margin: margin,
|
|
120
145
|
size: size
|
|
121
146
|
}, _react["default"].createElement(IconContainer, {
|
|
122
147
|
iconBgColor: iconBgColor
|
|
123
|
-
}, _react["default"].createElement(TagIcon, {
|
|
148
|
+
}, icon ? _react["default"].createElement(TagIconContainer, null, (0, _typeof2["default"])(icon) === "object" ? icon : _react["default"].createElement(icon)) : _react["default"].createElement(TagIcon, {
|
|
124
149
|
src: iconSrc
|
|
125
150
|
})), size !== "small" && _react["default"].createElement(TagLabel, null, label)));
|
|
126
151
|
|
|
127
|
-
return _react["default"].createElement(
|
|
152
|
+
return _react["default"].createElement(_styledComponents.ThemeProvider, {
|
|
153
|
+
theme: colorsTheme.tag
|
|
154
|
+
}, _react["default"].createElement(StyledDxcTag, {
|
|
128
155
|
margin: margin,
|
|
129
156
|
onMouseEnter: function onMouseEnter() {
|
|
130
157
|
return changeIsHovered(true);
|
|
@@ -134,9 +161,13 @@ var DxcTag = function DxcTag(_ref) {
|
|
|
134
161
|
},
|
|
135
162
|
onClick: clickHandler,
|
|
136
163
|
hasAction: onClick || linkHref
|
|
137
|
-
},
|
|
138
|
-
|
|
139
|
-
}, tagContent)
|
|
164
|
+
}, onClick ? _react["default"].createElement(StyledButton, {
|
|
165
|
+
tabIndex: tabIndex
|
|
166
|
+
}, tagContent) : linkHref ? _react["default"].createElement(StyledLink, {
|
|
167
|
+
tabIndex: tabIndex,
|
|
168
|
+
href: linkHref,
|
|
169
|
+
target: newWindow ? "_blank" : "_self"
|
|
170
|
+
}, tagContent) : tagContent));
|
|
140
171
|
};
|
|
141
172
|
|
|
142
173
|
var sizes = {
|
|
@@ -176,42 +207,76 @@ var TagContent = _styledComponents["default"].div(_templateObject2(), function (
|
|
|
176
207
|
return labelPosition === "before" && "row-reverse" || "row";
|
|
177
208
|
}, function (props) {
|
|
178
209
|
return calculateWidth(props.size);
|
|
210
|
+
}, function (props) {
|
|
211
|
+
return props.theme.height;
|
|
179
212
|
});
|
|
180
213
|
|
|
181
|
-
var StyledLink = _styledComponents["default"].a(_templateObject3())
|
|
214
|
+
var StyledLink = _styledComponents["default"].a(_templateObject3(), function (props) {
|
|
215
|
+
return props.theme.focusColor;
|
|
216
|
+
});
|
|
217
|
+
|
|
218
|
+
var StyledButton = _styledComponents["default"].button(_templateObject4(), function (props) {
|
|
219
|
+
return props.theme.focusColor;
|
|
220
|
+
});
|
|
221
|
+
|
|
222
|
+
var TagIcon = _styledComponents["default"].img(_templateObject5(), function (props) {
|
|
223
|
+
return props.theme.iconWidth;
|
|
224
|
+
}, function (props) {
|
|
225
|
+
return props.theme.iconHeight;
|
|
226
|
+
});
|
|
182
227
|
|
|
183
|
-
var
|
|
228
|
+
var TagIconContainer = _styledComponents["default"].div(_templateObject6(), function (props) {
|
|
229
|
+
return props.theme.iconWidth;
|
|
230
|
+
}, function (props) {
|
|
231
|
+
return props.theme.iconHeight;
|
|
232
|
+
});
|
|
184
233
|
|
|
185
|
-
var IconContainer = _styledComponents["default"].div(
|
|
234
|
+
var IconContainer = _styledComponents["default"].div(_templateObject7(), function (_ref9) {
|
|
186
235
|
var iconBgColor = _ref9.iconBgColor;
|
|
187
236
|
return iconBgColor;
|
|
237
|
+
}, function (props) {
|
|
238
|
+
return props.theme.iconSectionWidth;
|
|
239
|
+
}, function (props) {
|
|
240
|
+
return props.theme.iconColor;
|
|
188
241
|
});
|
|
189
242
|
|
|
190
|
-
var TagLabel = _styledComponents["default"].div(
|
|
243
|
+
var TagLabel = _styledComponents["default"].div(_templateObject8(), function (props) {
|
|
244
|
+
return props.theme.fontFamily;
|
|
245
|
+
}, function (props) {
|
|
246
|
+
return props.theme.fontSize;
|
|
247
|
+
}, function (props) {
|
|
248
|
+
return props.theme.fontStyle;
|
|
249
|
+
}, function (props) {
|
|
250
|
+
return props.theme.fontWeight;
|
|
251
|
+
}, function (props) {
|
|
252
|
+
return props.theme.fontColor;
|
|
253
|
+
}, function (props) {
|
|
254
|
+
return props.theme.labelPaddingTop;
|
|
255
|
+
}, function (props) {
|
|
256
|
+
return props.theme.labelPaddingBottom;
|
|
257
|
+
}, function (props) {
|
|
258
|
+
return props.theme.labelPaddingLeft;
|
|
259
|
+
}, function (props) {
|
|
260
|
+
return props.theme.labelPaddingRight;
|
|
261
|
+
});
|
|
191
262
|
|
|
192
263
|
DxcTag.propTypes = {
|
|
193
264
|
size: _propTypes["default"].oneOf((0, _toConsumableArray2["default"])(Object.keys(sizes))),
|
|
265
|
+
icon: _propTypes["default"].oneOfType([_propTypes["default"].element, _propTypes["default"].func]),
|
|
194
266
|
iconSrc: _propTypes["default"].string,
|
|
195
267
|
iconBgColor: _propTypes["default"].string,
|
|
196
268
|
label: _propTypes["default"].string,
|
|
197
269
|
labelPosition: _propTypes["default"].oneOf(["before", "after"]),
|
|
198
270
|
linkHref: _propTypes["default"].string,
|
|
199
271
|
onClick: _propTypes["default"].func,
|
|
272
|
+
newWindow: _propTypes["default"].bool,
|
|
200
273
|
margin: _propTypes["default"].oneOfType([_propTypes["default"].shape({
|
|
201
274
|
top: _propTypes["default"].oneOf(Object.keys(_variables.spaces)),
|
|
202
275
|
bottom: _propTypes["default"].oneOf(Object.keys(_variables.spaces)),
|
|
203
276
|
left: _propTypes["default"].oneOf(Object.keys(_variables.spaces)),
|
|
204
277
|
right: _propTypes["default"].oneOf(Object.keys(_variables.spaces))
|
|
205
|
-
}), _propTypes["default"].oneOf((0, _toConsumableArray2["default"])(Object.keys(_variables.spaces)))])
|
|
206
|
-
|
|
207
|
-
DxcTag.defaultProps = {
|
|
208
|
-
iconSrc: null,
|
|
209
|
-
label: null,
|
|
210
|
-
margin: null,
|
|
211
|
-
linkHref: null,
|
|
212
|
-
onClick: null,
|
|
213
|
-
iconBgColor: "black",
|
|
214
|
-
labelPosition: "after"
|
|
278
|
+
}), _propTypes["default"].oneOf((0, _toConsumableArray2["default"])(Object.keys(_variables.spaces)))]),
|
|
279
|
+
tabIndex: _propTypes["default"].number
|
|
215
280
|
};
|
|
216
281
|
var _default = DxcTag;
|
|
217
282
|
exports["default"] = _default;
|
|
@@ -25,18 +25,18 @@ var _TextField = _interopRequireDefault(require("@material-ui/core/TextField"));
|
|
|
25
25
|
|
|
26
26
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
27
27
|
|
|
28
|
-
require("../common/OpenSans.css");
|
|
29
|
-
|
|
30
28
|
var _variables = require("../common/variables.js");
|
|
31
29
|
|
|
32
30
|
var _utils = require("../common/utils.js");
|
|
33
31
|
|
|
34
|
-
var
|
|
32
|
+
var _useTheme = _interopRequireDefault(require("../useTheme.js"));
|
|
35
33
|
|
|
36
34
|
var _RequiredComponent = _interopRequireDefault(require("../common/RequiredComponent"));
|
|
37
35
|
|
|
36
|
+
var _BackgroundColorContext = _interopRequireDefault(require("../BackgroundColorContext.js"));
|
|
37
|
+
|
|
38
38
|
function _templateObject() {
|
|
39
|
-
var data = (0, _taggedTemplateLiteral2["default"])(["\n margin: ", ";\n margin-top: ", ";\n margin-right: ", ";\n margin-bottom: ", ";\n margin-left: ", ";\n
|
|
39
|
+
var data = (0, _taggedTemplateLiteral2["default"])(["\n margin: ", ";\n margin-top: ", ";\n margin-right: ", ";\n margin-bottom: ", ";\n margin-left: ", ";\n display: inline-block;\n position: relative;\n height: auto;\n width: ", ";\n\n .MuiTextField-root {\n width: 100%;\n\n .MuiFormHelperText-root {\n font-family: ", ";\n font-size: ", ";\n font-style: ", ";\n font-weight: ", ";\n letter-spacing: ", ";\n margin-top: 6px;\n }\n .MuiFormLabel-root {\n font-size: ", ";\n font-style: ", ";\n font-weight: ", ";\n letter-spacing: ", ";\n color: ", ";\n padding-left: \"inherit\";\n\n &.Mui-disabled {\n color: ", " !important;\n cursor: not-allowed;\n }\n\n &.Mui-focused {\n color: ", ";\n &.MuiInputLabel-shrink {\n transform: \"translate(0, 1.5px) scale(0.75);\";\n }\n }\n\n &.MuiInputLabel-shrink {\n font-family: ", ";\n transform: \"translate(0, 1.5px) scale(0.75)\";\n }\n\n &.Mui-error {\n color: ", ";\n }\n\n &:not(.MuiInputLabel-shrink) {\n font-family: ", ";\n color: ", ";\n & + div,\n & + div + p {\n color: ", ";\n }\n }\n\n &.MuiInputLabel-shrink {\n & + div::before {\n border-color: ", ";\n }\n & + div + p {\n color: ", ";\n }\n }\n }\n .MuiInputBase-root.MuiInput-root.MuiInput-underline {\n &::before {\n border-bottom: ", ";\n }\n\n &:not(.Mui-error)::before,\n &:not(&.Mui-focused)::before {\n border-bottom: ", ";\n }\n\n &::after {\n border-bottom: ", ";\n }\n\n .MuiInputBase-inputMultiline {\n overflow: auto !important;\n\n ::-webkit-scrollbar {\n width: 3px;\n }\n\n ::-webkit-scrollbar-track {\n background-color: ", ";\n border-radius: 3px;\n }\n\n ::-webkit-scrollbar-thumb {\n background-color: ", ";\n border-radius: 3px;\n }\n }\n\n &.Mui-error {\n &::before {\n border-width: ", ";\n border-color: ", ";\n }\n &::after {\n transform: scaleX(0);\n }\n }\n\n &.Mui-focused {\n &::after {\n border-width: calc(", " + 1px);\n border-color: ", ";\n }\n &.Mui-error::after {\n border-color: ", ";\n }\n }\n\n &.Mui-disabled {\n cursor: not-allowed;\n\n &::before {\n border-bottom: ", ";\n border-bottom-style: solid;\n }\n }\n\n .MuiInputBase-input {\n font-family: ", ";\n font-size: ", ";\n font-style: ", ";\n font-weight: ", ";\n letter-spacing: ", ";\n color: ", ";\n line-height: ", ";\n padding-left: \"inherit\";\n text-overflow: ellipsis;\n\n &.Mui-disabled {\n cursor: not-allowed;\n color: ", ";\n }\n }\n\n &:hover:not(.Mui-disabled):before &:hover:not(.Mui-error):before {\n border-bottom-color: ", ";\n }\n }\n\n & > p {\n &.Mui-error {\n color: ", ";\n }\n &.Mui-disabled {\n color: ", " !important;\n cursor: not-allowed;\n }\n }\n }\n"]);
|
|
40
40
|
|
|
41
41
|
_templateObject = function _templateObject() {
|
|
42
42
|
return data;
|
|
@@ -69,17 +69,17 @@ var DxcTextarea = function DxcTextarea(_ref) {
|
|
|
69
69
|
placeholder = _ref$placeholder === void 0 ? "" : _ref$placeholder,
|
|
70
70
|
margin = _ref.margin,
|
|
71
71
|
_ref$size = _ref.size,
|
|
72
|
-
size = _ref$size === void 0 ? "medium" : _ref$size
|
|
72
|
+
size = _ref$size === void 0 ? "medium" : _ref$size,
|
|
73
|
+
_ref$tabIndex = _ref.tabIndex,
|
|
74
|
+
tabIndex = _ref$tabIndex === void 0 ? 0 : _ref$tabIndex;
|
|
73
75
|
|
|
74
76
|
var _useState = (0, _react.useState)(""),
|
|
75
77
|
_useState2 = (0, _slicedToArray2["default"])(_useState, 2),
|
|
76
78
|
innerValue = _useState2[0],
|
|
77
79
|
setInnerValue = _useState2[1];
|
|
78
80
|
|
|
79
|
-
var
|
|
80
|
-
var
|
|
81
|
-
return (0, _utils.getCustomTheme)(_variables.theme, (0, _utils.getCustomTheme)(_variables.defaultTheme, customTheme));
|
|
82
|
-
}, [customTheme]);
|
|
81
|
+
var colorsTheme = (0, _useTheme["default"])();
|
|
82
|
+
var backgroundType = (0, _react.useContext)(_BackgroundColorContext["default"]);
|
|
83
83
|
|
|
84
84
|
var handlerTextareaChange = function handlerTextareaChange(event) {
|
|
85
85
|
if (value === null || value === undefined) {
|
|
@@ -112,7 +112,8 @@ var DxcTextarea = function DxcTextarea(_ref) {
|
|
|
112
112
|
required: required,
|
|
113
113
|
assistiveText: assistiveText,
|
|
114
114
|
margin: margin,
|
|
115
|
-
size: size
|
|
115
|
+
size: size,
|
|
116
|
+
backgroundType: backgroundType
|
|
116
117
|
}, _react["default"].createElement(_TextField["default"], {
|
|
117
118
|
error: invalid,
|
|
118
119
|
value: value !== null ? value : innerValue,
|
|
@@ -124,7 +125,10 @@ var DxcTextarea = function DxcTextarea(_ref) {
|
|
|
124
125
|
onChange: handlerTextareaChange,
|
|
125
126
|
onBlur: onBlur && handlerTextareaBlur || null,
|
|
126
127
|
rows: numRows,
|
|
127
|
-
placeholder: placeholder
|
|
128
|
+
placeholder: placeholder,
|
|
129
|
+
inputProps: {
|
|
130
|
+
tabIndex: tabIndex
|
|
131
|
+
}
|
|
128
132
|
})));
|
|
129
133
|
};
|
|
130
134
|
|
|
@@ -136,11 +140,7 @@ var sizes = {
|
|
|
136
140
|
};
|
|
137
141
|
|
|
138
142
|
var calculateWidth = function calculateWidth(margin, size) {
|
|
139
|
-
|
|
140
|
-
return "calc(".concat(sizes[size], " - ").concat((0, _utils.getMargin)(margin, "left"), " - ").concat((0, _utils.getMargin)(margin, "right"), ")");
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
return sizes[size];
|
|
143
|
+
return size === "fillParent" ? "calc(".concat(sizes[size], " - ").concat((0, _utils.getMargin)(margin, "left"), " - ").concat((0, _utils.getMargin)(margin, "right"), ")") : sizes[size];
|
|
144
144
|
};
|
|
145
145
|
|
|
146
146
|
var TextContainer = _styledComponents["default"].div(_templateObject(), function (props) {
|
|
@@ -156,51 +156,87 @@ var TextContainer = _styledComponents["default"].div(_templateObject(), function
|
|
|
156
156
|
}, function (props) {
|
|
157
157
|
return calculateWidth(props.margin, props.size);
|
|
158
158
|
}, function (props) {
|
|
159
|
-
return props.theme.
|
|
159
|
+
return props.theme.fontFamily;
|
|
160
|
+
}, function (props) {
|
|
161
|
+
return props.theme.assistiveTextFontSize;
|
|
162
|
+
}, function (props) {
|
|
163
|
+
return props.theme.assistiveTextFontStyle;
|
|
164
|
+
}, function (props) {
|
|
165
|
+
return props.theme.assistiveTextFontWeight;
|
|
166
|
+
}, function (props) {
|
|
167
|
+
return props.theme.assistiveTextLetterSpacing;
|
|
168
|
+
}, function (props) {
|
|
169
|
+
return props.theme.labelFontSize;
|
|
170
|
+
}, function (props) {
|
|
171
|
+
return props.theme.labelFontStyle;
|
|
172
|
+
}, function (props) {
|
|
173
|
+
return props.theme.labelFontWeight;
|
|
174
|
+
}, function (props) {
|
|
175
|
+
return props.theme.labelLetterSpacing;
|
|
176
|
+
}, function (props) {
|
|
177
|
+
return props.backgroundType === "dark" ? props.theme.labelFontColorOnDark : props.theme.labelFontColor;
|
|
178
|
+
}, function (props) {
|
|
179
|
+
return props.backgroundType === "dark" ? props.theme.disabledColorOnDark : props.theme.disabledColor;
|
|
180
|
+
}, function (props) {
|
|
181
|
+
return props.backgroundType === "dark" ? props.theme.labelFontColorOnDark : props.theme.labelFontColor;
|
|
182
|
+
}, function (props) {
|
|
183
|
+
return props.theme.fontFamily;
|
|
184
|
+
}, function (props) {
|
|
185
|
+
return props.backgroundType === "dark" ? props.theme.errorColorOnDark : props.theme.errorColor;
|
|
186
|
+
}, function (props) {
|
|
187
|
+
return props.theme.fontFamily;
|
|
188
|
+
}, function (props) {
|
|
189
|
+
return props.backgroundType === "dark" ? props.theme.labelFontColorOnDark : props.theme.labelFontColor;
|
|
190
|
+
}, function (props) {
|
|
191
|
+
return props.backgroundType === "dark" ? props.theme.assistiveTextFontColorOnDark : props.theme.assistiveTextFontColor;
|
|
192
|
+
}, function (props) {
|
|
193
|
+
return props.backgroundType ? props.theme.underlineColorOnDark : props.theme.underlineColor;
|
|
194
|
+
}, function (props) {
|
|
195
|
+
return props.backgroundType === "dark" ? props.theme.labelFontColorOnDark : props.theme.labelFontColor;
|
|
160
196
|
}, function (props) {
|
|
161
|
-
return props.theme.
|
|
197
|
+
return "".concat(props.theme.underlineThickness, " solid ").concat(props.backgroundType === "dark" ? props.theme.underlineColorOnDark : props.theme.underlineColor);
|
|
162
198
|
}, function (props) {
|
|
163
|
-
return props.theme.
|
|
199
|
+
return "".concat(props.theme.underlineThickness, " solid ").concat(props.backgroundType === "dark" ? props.theme.underlineColorOnDark : props.theme.underlineColor);
|
|
164
200
|
}, function (props) {
|
|
165
|
-
return props.theme.
|
|
201
|
+
return "calc(".concat(props.theme.underlineThickness, " + 1px) solid ").concat(props.backgroundType === "dark" ? props.theme.underlineFocusColorOnDark : props.theme.underlineFocusColor);
|
|
166
202
|
}, function (props) {
|
|
167
|
-
return props.theme.
|
|
203
|
+
return props.backgroundType === "dark" ? props.theme.scrollBarTrackColorOnDark : props.theme.scrollBarTrackColor;
|
|
168
204
|
}, function (props) {
|
|
169
|
-
return props.theme.
|
|
205
|
+
return props.backgroundType === "dark" ? props.theme.scrollBarThumbColorOnDark : props.theme.scrollBarThumbColor;
|
|
170
206
|
}, function (props) {
|
|
171
|
-
return props.theme.
|
|
207
|
+
return props.theme.underlineThickness;
|
|
172
208
|
}, function (props) {
|
|
173
|
-
return props.theme.
|
|
209
|
+
return props.backgroundType === "dark" ? props.theme.errorColorOnDark : props.theme.errorColor;
|
|
174
210
|
}, function (props) {
|
|
175
|
-
return
|
|
211
|
+
return props.theme.underlineThickness;
|
|
176
212
|
}, function (props) {
|
|
177
|
-
return "
|
|
213
|
+
return props.backgroundType === "dark" ? props.theme.underlineFocusColorOnDark : props.theme.underlineFocusColor;
|
|
178
214
|
}, function (props) {
|
|
179
|
-
return "
|
|
215
|
+
return props.backgroundType === "dark" ? props.theme.errorColorOnDark : props.theme.errorColor;
|
|
180
216
|
}, function (props) {
|
|
181
|
-
return props.theme.
|
|
217
|
+
return "".concat(props.theme.underlineThickness, " solid ").concat(props.backgroundType === "dark" ? props.theme.disabledColorOnDark : props.theme.disabledColor, " !important");
|
|
182
218
|
}, function (props) {
|
|
183
|
-
return props.theme.
|
|
219
|
+
return props.theme.fontFamily;
|
|
184
220
|
}, function (props) {
|
|
185
|
-
return props.theme.
|
|
221
|
+
return props.theme.valueFontSize;
|
|
186
222
|
}, function (props) {
|
|
187
|
-
return props.theme.
|
|
223
|
+
return props.theme.valueFontStyle;
|
|
188
224
|
}, function (props) {
|
|
189
|
-
return props.theme.
|
|
225
|
+
return props.theme.valueFontWeight;
|
|
190
226
|
}, function (props) {
|
|
191
|
-
return props.theme.
|
|
227
|
+
return props.theme.valueLetterSpacing;
|
|
192
228
|
}, function (props) {
|
|
193
|
-
return props.theme.
|
|
229
|
+
return props.backgroundType === "dark" ? props.theme.valueFontColorOnDark : props.theme.valueFontColor;
|
|
194
230
|
}, function (props) {
|
|
195
|
-
return
|
|
231
|
+
return props.theme.valueLineHeight;
|
|
196
232
|
}, function (props) {
|
|
197
|
-
return props.theme.
|
|
233
|
+
return props.backgroundType === "dark" ? props.theme.disabledColorOnDark : props.theme.disabledColor;
|
|
198
234
|
}, function (props) {
|
|
199
|
-
return props.theme.
|
|
235
|
+
return props.backgroundType === "dark" ? props.theme.underlineFocusColorOnDark : props.theme.underlineFocusColor;
|
|
200
236
|
}, function (props) {
|
|
201
|
-
return "".concat(props.theme.
|
|
237
|
+
return "".concat(props.backgroundType === "dark" ? props.theme.errorColorOnDark : props.theme.errorColor, " !important");
|
|
202
238
|
}, function (props) {
|
|
203
|
-
return props.theme.
|
|
239
|
+
return props.backgroundType === "dark" ? props.theme.disabledColorOnDark : props.theme.disabledColor;
|
|
204
240
|
});
|
|
205
241
|
|
|
206
242
|
DxcTextarea.propTypes = {
|
|
@@ -221,7 +257,8 @@ DxcTextarea.propTypes = {
|
|
|
221
257
|
bottom: _propTypes["default"].oneOf(Object.keys(_variables.spaces)),
|
|
222
258
|
left: _propTypes["default"].oneOf(Object.keys(_variables.spaces)),
|
|
223
259
|
right: _propTypes["default"].oneOf(Object.keys(_variables.spaces))
|
|
224
|
-
}), _propTypes["default"].oneOf((0, _toConsumableArray2["default"])(Object.keys(_variables.spaces)))])
|
|
260
|
+
}), _propTypes["default"].oneOf((0, _toConsumableArray2["default"])(Object.keys(_variables.spaces)))]),
|
|
261
|
+
tabIndex: _propTypes["default"].number
|
|
225
262
|
};
|
|
226
263
|
var _default = DxcTextarea;
|
|
227
264
|
exports["default"] = _default;
|
package/dist/toggle/Toggle.js
CHANGED
|
@@ -15,7 +15,7 @@ var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
|
|
|
15
15
|
|
|
16
16
|
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
|
|
17
17
|
|
|
18
|
-
var _react =
|
|
18
|
+
var _react = _interopRequireDefault(require("react"));
|
|
19
19
|
|
|
20
20
|
var _lab = require("@material-ui/lab");
|
|
21
21
|
|
|
@@ -23,13 +23,9 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
|
23
23
|
|
|
24
24
|
var _styledComponents = _interopRequireWildcard(require("styled-components"));
|
|
25
25
|
|
|
26
|
-
require("../common/OpenSans.css");
|
|
27
|
-
|
|
28
|
-
var _variables = require("../common/variables.js");
|
|
29
|
-
|
|
30
26
|
var _utils = require("../common/utils.js");
|
|
31
27
|
|
|
32
|
-
var
|
|
28
|
+
var _useTheme = _interopRequireDefault(require("../useTheme.js"));
|
|
33
29
|
|
|
34
30
|
function _templateObject4() {
|
|
35
31
|
var data = (0, _taggedTemplateLiteral2["default"])([""]);
|
|
@@ -62,7 +58,7 @@ function _templateObject2() {
|
|
|
62
58
|
}
|
|
63
59
|
|
|
64
60
|
function _templateObject() {
|
|
65
|
-
var data = (0, _taggedTemplateLiteral2["default"])(["\n & {\n margin: ", ";\n margin-top: ", ";\n margin-right: ", ";\n margin-bottom: ", ";\n margin-left: ", ";\n\n opacity: ", ";\n cursor: ", ";\n display: inline-block;\n width: ", ";\n }\n\n .MuiToggleButton-label {\n font-size: 14px;\n font-family:
|
|
61
|
+
var data = (0, _taggedTemplateLiteral2["default"])(["\n & {\n margin: ", ";\n margin-top: ", ";\n margin-right: ", ";\n margin-bottom: ", ";\n margin-left: ", ";\n\n opacity: ", ";\n cursor: ", ";\n display: inline-block;\n width: ", ";\n }\n\n .MuiToggleButton-label {\n font-size: 14px;\n font-family: ", ";\n color: ", ";\n }\n .MuiButtonBase-root {\n width: ", ";\n min-height: ", ";\n background-color: ", ";\n &:hover {\n background-color: ", ";\n .MuiToggleButton-label {\n color: ", ";\n }\n }\n }\n\n .MuiToggleButton-root {\n min-width: 42px;\n height: 43px;\n border: ", ";\n\n border-radius: 4px !important;\n }\n\n .MuiToggleButton-root.Mui-selected {\n background-color: ", ";\n &:hover {\n background-color: ", ";\n .MuiToggleButton-label {\n color: ", ";\n }\n }\n }\n\n .MuiToggleButton-root:last-child,\n .MuiToggleButton-root:first-child,\n .MuiToggleButton-root:not(:first-child) {\n padding: ", ";\n }\n\n .MuiTouchRipple-child {\n background-color: ", ";\n }\n"]);
|
|
66
62
|
|
|
67
63
|
_templateObject = function _templateObject() {
|
|
68
64
|
return data;
|
|
@@ -92,8 +88,7 @@ var DxcToggle = function DxcToggle(_ref) {
|
|
|
92
88
|
margin = _ref.margin,
|
|
93
89
|
_ref$size = _ref.size,
|
|
94
90
|
size = _ref$size === void 0 ? "fitContent" : _ref$size;
|
|
95
|
-
|
|
96
|
-
var colorsTheme = (0, _react.useContext)(_ThemeContext["default"]) || _variables.colors;
|
|
91
|
+
var colorsTheme = (0, _useTheme["default"])();
|
|
97
92
|
|
|
98
93
|
var handlerToggleClick = function handlerToggleClick() {
|
|
99
94
|
if (!disabled && typeof onClick === "function") {
|
|
@@ -149,21 +144,23 @@ var calculateWidth = function calculateWidth(margin, size) {
|
|
|
149
144
|
};
|
|
150
145
|
|
|
151
146
|
var DxcToggleContainer = _styledComponents["default"].div(_templateObject(), function (props) {
|
|
152
|
-
return props.margin && (0, _typeof2["default"])(props.margin) !== "object" ?
|
|
147
|
+
return props.margin && (0, _typeof2["default"])(props.margin) !== "object" ? spaces[props.margin] : "0px";
|
|
153
148
|
}, function (props) {
|
|
154
|
-
return props.margin && (0, _typeof2["default"])(props.margin) === "object" && props.margin.top ?
|
|
149
|
+
return props.margin && (0, _typeof2["default"])(props.margin) === "object" && props.margin.top ? spaces[props.margin.top] : "";
|
|
155
150
|
}, function (props) {
|
|
156
|
-
return props.margin && (0, _typeof2["default"])(props.margin) === "object" && props.margin.right ?
|
|
151
|
+
return props.margin && (0, _typeof2["default"])(props.margin) === "object" && props.margin.right ? spaces[props.margin.right] : "";
|
|
157
152
|
}, function (props) {
|
|
158
|
-
return props.margin && (0, _typeof2["default"])(props.margin) === "object" && props.margin.bottom ?
|
|
153
|
+
return props.margin && (0, _typeof2["default"])(props.margin) === "object" && props.margin.bottom ? spaces[props.margin.bottom] : "";
|
|
159
154
|
}, function (props) {
|
|
160
|
-
return props.margin && (0, _typeof2["default"])(props.margin) === "object" && props.margin.left ?
|
|
155
|
+
return props.margin && (0, _typeof2["default"])(props.margin) === "object" && props.margin.left ? spaces[props.margin.left] : "";
|
|
161
156
|
}, function (props) {
|
|
162
157
|
return props.disabled ? "0.5" : "1";
|
|
163
158
|
}, function (props) {
|
|
164
159
|
return props.disabled ? "not-allowed" : "pointer";
|
|
165
160
|
}, function (props) {
|
|
166
161
|
return calculateWidth(props.margin, props.size);
|
|
162
|
+
}, function (props) {
|
|
163
|
+
return props.theme.fontFamily;
|
|
167
164
|
}, function (props) {
|
|
168
165
|
return props.brightness === "dark" && props.mode === "outlined" ? props.theme.white : props.theme.black;
|
|
169
166
|
}, function (props) {
|
|
@@ -213,11 +210,11 @@ DxcToggle.propTypes = {
|
|
|
213
210
|
disableRipple: _propTypes["default"].bool,
|
|
214
211
|
onClick: _propTypes["default"].func,
|
|
215
212
|
margin: _propTypes["default"].oneOfType([_propTypes["default"].shape({
|
|
216
|
-
top: _propTypes["default"].oneOf(Object.keys(
|
|
217
|
-
bottom: _propTypes["default"].oneOf(Object.keys(
|
|
218
|
-
left: _propTypes["default"].oneOf(Object.keys(
|
|
219
|
-
right: _propTypes["default"].oneOf(Object.keys(
|
|
220
|
-
}), _propTypes["default"].oneOf((0, _toConsumableArray2["default"])(Object.keys(
|
|
213
|
+
top: _propTypes["default"].oneOf(Object.keys(spaces)),
|
|
214
|
+
bottom: _propTypes["default"].oneOf(Object.keys(spaces)),
|
|
215
|
+
left: _propTypes["default"].oneOf(Object.keys(spaces)),
|
|
216
|
+
right: _propTypes["default"].oneOf(Object.keys(spaces))
|
|
217
|
+
}), _propTypes["default"].oneOf((0, _toConsumableArray2["default"])(Object.keys(spaces)))])
|
|
221
218
|
};
|
|
222
219
|
var _default = DxcToggle;
|
|
223
220
|
exports["default"] = _default;
|