@dxc-technology/halstack-react 0.0.0-011babe → 0.0.0-0355f44
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/BackgroundColorContext.js +46 -0
- package/dist/ThemeContext.js +168 -105
- package/dist/accordion/Accordion.js +127 -48
- package/dist/accordion-group/AccordionGroup.js +34 -4
- package/dist/alert/Alert.js +178 -82
- package/dist/alert/index.d.ts +51 -0
- package/dist/badge/Badge.js +28 -7
- package/dist/box/Box.js +28 -19
- package/dist/button/Button.js +50 -21
- package/dist/card/Card.js +72 -35
- package/dist/checkbox/Checkbox.js +95 -26
- package/dist/chip/Chip.js +88 -32
- package/dist/common/utils.js +2 -22
- package/dist/common/variables.js +1376 -238
- package/dist/date/Date.js +70 -43
- package/dist/date-input/DateInput.js +400 -0
- package/dist/date-input/index.d.ts +95 -0
- package/dist/dialog/Dialog.js +51 -34
- package/dist/dropdown/Dropdown.js +169 -79
- 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/footer/Footer.js +70 -47
- package/dist/footer/dxc_logo.svg +15 -0
- package/dist/header/Header.js +89 -58
- package/dist/header/dxc_logo_black.svg +8 -0
- package/dist/heading/Heading.js +86 -23
- package/dist/input-text/InputText.js +234 -104
- package/dist/layout/ApplicationLayout.js +11 -10
- package/dist/link/Link.js +84 -36
- package/dist/main.d.ts +8 -0
- package/dist/main.js +68 -4
- package/dist/new-select/NewSelect.js +836 -0
- package/dist/new-select/index.d.ts +53 -0
- package/dist/new-textarea/NewTextarea.js +369 -0
- package/dist/new-textarea/index.d.ts +117 -0
- package/dist/number-input/NumberInput.js +136 -0
- package/dist/number-input/NumberInputContext.js +16 -0
- package/dist/number-input/index.d.ts +113 -0
- package/dist/paginator/Paginator.js +56 -18
- package/dist/password-input/PasswordInput.js +198 -0
- package/dist/password-input/index.d.ts +94 -0
- package/dist/progress-bar/ProgressBar.js +89 -37
- package/dist/radio/Radio.js +28 -11
- package/dist/resultsetTable/ResultsetTable.js +76 -44
- package/dist/select/Select.js +215 -151
- package/dist/sidenav/Sidenav.js +64 -12
- package/dist/slider/Slider.js +190 -63
- package/dist/spinner/Spinner.js +245 -60
- package/dist/switch/Switch.js +50 -20
- package/dist/table/Table.js +46 -10
- package/dist/tabs/Tabs.js +47 -15
- package/dist/tag/Tag.js +64 -33
- package/dist/text-input/TextInput.js +971 -0
- package/dist/text-input/index.d.ts +135 -0
- package/dist/textarea/Textarea.js +68 -36
- package/dist/toggle/Toggle.js +0 -2
- package/dist/toggle-group/ToggleGroup.js +148 -34
- package/dist/upload/Upload.js +16 -13
- package/dist/upload/buttons-upload/ButtonsUpload.js +28 -12
- package/dist/upload/dragAndDropArea/DragAndDropArea.js +63 -20
- package/dist/upload/file-upload/FileToUpload.js +43 -19
- package/dist/upload/files-upload/FilesToUpload.js +9 -8
- package/dist/upload/readme.md +2 -2
- package/dist/upload/transaction/Transaction.js +39 -18
- package/dist/upload/transactions/Transactions.js +27 -11
- package/dist/wizard/Wizard.js +120 -48
- package/dist/wizard/invalid_icon.svg +4 -5
- package/dist/wizard/valid_icon.svg +4 -5
- package/package.json +6 -4
- package/test/AccordionGroup.test.js +16 -0
- package/test/Date.test.js +49 -45
- package/test/DateInput.test.js +242 -0
- package/test/Dropdown.test.js +15 -0
- package/test/FileInput.test.js +201 -0
- package/test/InputText.test.js +24 -16
- package/test/Link.test.js +3 -2
- package/test/NewTextarea.test.js +195 -0
- package/test/NumberInput.test.js +259 -0
- 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 +44 -24
- package/test/Spinner.test.js +5 -0
- package/test/TextInput.test.js +732 -0
- package/test/ToggleGroup.test.js +5 -1
- package/test/Upload.test.js +5 -5
- 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/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/Footer.stories.js +0 -94
- 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/input-text/InputText.stories.js +0 -209
- 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/dist/table/Table.js
CHANGED
|
@@ -17,16 +17,16 @@ var _react = _interopRequireDefault(require("react"));
|
|
|
17
17
|
|
|
18
18
|
var _styledComponents = _interopRequireWildcard(require("styled-components"));
|
|
19
19
|
|
|
20
|
-
require("../common/OpenSans.css");
|
|
21
|
-
|
|
22
20
|
var _variables = require("../common/variables.js");
|
|
23
21
|
|
|
24
22
|
var _utils = require("../common/utils.js");
|
|
25
23
|
|
|
26
24
|
var _useTheme = _interopRequireDefault(require("../useTheme.js"));
|
|
27
25
|
|
|
26
|
+
var _BackgroundColorContext = require("../BackgroundColorContext.js");
|
|
27
|
+
|
|
28
28
|
function _templateObject2() {
|
|
29
|
-
var data = (0, _taggedTemplateLiteral2["default"])(["\n border-collapse: collapse;\n width: 100%;\n\n & tr {\n border-bottom:
|
|
29
|
+
var data = (0, _taggedTemplateLiteral2["default"])(["\n border-collapse: collapse;\n width: 100%;\n\n & tr {\n border-bottom: ", ";\n }\n & td {\n background-color: ", ";\n font-family: ", ";\n font-size: ", ";\n font-style: ", ";\n font-weight: ", ";\n color: ", ";\n text-transform: ", ";\n text-align: ", ";\n line-height: ", ";\n padding: ", ";\n }\n & th {\n background-color: ", ";\n font-family: ", ";\n font-size: ", ";\n font-style: ", ";\n font-weight: ", ";\n color: ", ";\n text-transform: ", ";\n text-align: ", ";\n line-height: ", ";\n padding: ", ";\n }\n & th:first-child {\n border-top-left-radius: ", ";\n }\n & th:last-child {\n border-top-right-radius: ", ";\n }\n"]);
|
|
30
30
|
|
|
31
31
|
_templateObject2 = function _templateObject2() {
|
|
32
32
|
return data;
|
|
@@ -36,7 +36,7 @@ function _templateObject2() {
|
|
|
36
36
|
}
|
|
37
37
|
|
|
38
38
|
function _templateObject() {
|
|
39
|
-
var data = (0, _taggedTemplateLiteral2["default"])(["\n
|
|
39
|
+
var data = (0, _taggedTemplateLiteral2["default"])(["\n width: ", ";\n margin: ", ";\n margin-top: ", ";\n margin-right: ", ";\n margin-bottom: ", ";\n margin-left: ", ";\n\n overflow: hidden auto;\n &::-webkit-scrollbar {\n width: 8px;\n }\n &::-webkit-scrollbar-thumb {\n background-color: ", ";\n border-radius: 6px;\n }\n &::-webkit-scrollbar-track {\n background-color: ", ";\n border-radius: 6px;\n }\n"]);
|
|
40
40
|
|
|
41
41
|
_templateObject = function _templateObject() {
|
|
42
42
|
return data;
|
|
@@ -53,7 +53,9 @@ var DxcTable = function DxcTable(_ref) {
|
|
|
53
53
|
theme: colorsTheme.table
|
|
54
54
|
}, _react["default"].createElement(DxcTableContainer, {
|
|
55
55
|
margin: margin
|
|
56
|
-
}, _react["default"].createElement(DxcTableContent, null,
|
|
56
|
+
}, _react["default"].createElement(DxcTableContent, null, _react["default"].createElement(_BackgroundColorContext.BackgroundColorProvider, {
|
|
57
|
+
color: colorsTheme.table.dataBackgroundColor
|
|
58
|
+
}, children))));
|
|
57
59
|
};
|
|
58
60
|
|
|
59
61
|
var calculateWidth = function calculateWidth(margin) {
|
|
@@ -62,8 +64,6 @@ var calculateWidth = function calculateWidth(margin) {
|
|
|
62
64
|
|
|
63
65
|
var DxcTableContainer = _styledComponents["default"].div(_templateObject(), function (props) {
|
|
64
66
|
return calculateWidth(props.margin);
|
|
65
|
-
}, function (props) {
|
|
66
|
-
return props.theme.fontFamily;
|
|
67
67
|
}, function (props) {
|
|
68
68
|
return props.margin && (0, _typeof2["default"])(props.margin) !== "object" ? _variables.spaces[props.margin] : "0px";
|
|
69
69
|
}, function (props) {
|
|
@@ -81,15 +81,51 @@ var DxcTableContainer = _styledComponents["default"].div(_templateObject(), func
|
|
|
81
81
|
});
|
|
82
82
|
|
|
83
83
|
var DxcTableContent = _styledComponents["default"].table(_templateObject2(), function (props) {
|
|
84
|
-
return props.theme.
|
|
84
|
+
return "".concat(props.theme.rowSeparatorThickness, " ").concat(props.theme.rowSeparatorStyle, " ").concat(props.theme.rowSeparatorColor);
|
|
85
|
+
}, function (props) {
|
|
86
|
+
return props.theme.dataBackgroundColor;
|
|
87
|
+
}, function (props) {
|
|
88
|
+
return props.theme.dataFontFamily;
|
|
89
|
+
}, function (props) {
|
|
90
|
+
return props.theme.dataFontSize;
|
|
91
|
+
}, function (props) {
|
|
92
|
+
return props.theme.dataFontStyle;
|
|
93
|
+
}, function (props) {
|
|
94
|
+
return props.theme.dataFontWeight;
|
|
95
|
+
}, function (props) {
|
|
96
|
+
return props.theme.dataFontColor;
|
|
97
|
+
}, function (props) {
|
|
98
|
+
return props.theme.dataFontTextTransform;
|
|
99
|
+
}, function (props) {
|
|
100
|
+
return props.theme.dataTextAlign;
|
|
85
101
|
}, function (props) {
|
|
86
|
-
return props.theme.
|
|
102
|
+
return props.theme.dataTextLineHeight;
|
|
87
103
|
}, function (props) {
|
|
88
|
-
return props.theme.
|
|
104
|
+
return "".concat(props.theme.dataPaddingTop, " ").concat(props.theme.dataPaddingRight, " ").concat(props.theme.dataPaddingBottom, " ").concat(props.theme.dataPaddingLeft);
|
|
89
105
|
}, function (props) {
|
|
90
106
|
return props.theme.headerBackgroundColor;
|
|
107
|
+
}, function (props) {
|
|
108
|
+
return props.theme.headerFontFamily;
|
|
109
|
+
}, function (props) {
|
|
110
|
+
return props.theme.headerFontSize;
|
|
111
|
+
}, function (props) {
|
|
112
|
+
return props.theme.headerFontStyle;
|
|
113
|
+
}, function (props) {
|
|
114
|
+
return props.theme.headerFontWeight;
|
|
91
115
|
}, function (props) {
|
|
92
116
|
return props.theme.headerFontColor;
|
|
117
|
+
}, function (props) {
|
|
118
|
+
return props.theme.headerFontTextTransform;
|
|
119
|
+
}, function (props) {
|
|
120
|
+
return props.theme.headerTextAlign;
|
|
121
|
+
}, function (props) {
|
|
122
|
+
return props.theme.headerTextLineHeight;
|
|
123
|
+
}, function (props) {
|
|
124
|
+
return "".concat(props.theme.headerPaddingTop, " ").concat(props.theme.headerPaddingRight, " ").concat(props.theme.headerPaddingBottom, " ").concat(props.theme.headerPaddingLeft);
|
|
125
|
+
}, function (props) {
|
|
126
|
+
return props.theme.headerBorderRadius;
|
|
127
|
+
}, function (props) {
|
|
128
|
+
return props.theme.headerBorderRadius;
|
|
93
129
|
});
|
|
94
130
|
|
|
95
131
|
var _default = DxcTable;
|
package/dist/tabs/Tabs.js
CHANGED
|
@@ -29,8 +29,6 @@ var _styledComponents = _interopRequireWildcard(require("styled-components"));
|
|
|
29
29
|
|
|
30
30
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
31
31
|
|
|
32
|
-
require("../common/OpenSans.css");
|
|
33
|
-
|
|
34
32
|
var _variables = require("../common/variables.js");
|
|
35
33
|
|
|
36
34
|
var _Badge = _interopRequireDefault(require("../badge/Badge"));
|
|
@@ -58,7 +56,7 @@ function _templateObject8() {
|
|
|
58
56
|
}
|
|
59
57
|
|
|
60
58
|
function _templateObject7() {
|
|
61
|
-
var data = (0, _taggedTemplateLiteral2["default"])(["\n position: relative;\n margin: ", ";\n margin-top: ", ";\n margin-right: ", ";\n margin-bottom: ", ";\n margin-left: ", ";\n .MuiTabs-root {\n background: white;\n .MuiTabs-scroller {\n .MuiTabs-flexContainer + span {\n z-index: 4;\n }\n }\n .MuiTab-root {\n text-transform:
|
|
59
|
+
var data = (0, _taggedTemplateLiteral2["default"])(["\n position: relative;\n margin: ", ";\n margin-top: ", ";\n margin-right: ", ";\n margin-bottom: ", ";\n margin-left: ", ";\n\n .MuiTabs-root {\n background: white;\n min-height: ", ";\n\n .MuiTabs-scroller {\n .MuiTabs-flexContainer + span {\n z-index: 4;\n }\n }\n .MuiTab-root {\n text-transform: ", " !important;\n }\n .MuiButtonBase-root {\n font-family: ", ";\n font-size: ", ";\n font-style: ", ";\n font-weight: ", ";\n\n padding: ", ";\n height: ", ";\n min-width: 90px;\n max-width: 360px;\n min-height: ", ";\n\n &:hover {\n background-color: ", ";\n }\n &:active {\n background-color: ", ";\n font-weight: ", ";\n }\n &:not(.Mui-selected) {\n background-color: ", ";\n color: ", ";\n svg {\n color: ", ";\n }\n }\n &.Mui-selected {\n background-color: ", ";\n color: ", ";\n svg {\n color: ", ";\n }\n }\n &.Mui-disabled {\n cursor: not-allowed !important;\n pointer-events: all;\n color: ", ";\n font-style: ", ";\n svg {\n color: ", ";\n }\n }\n &:focus {\n outline: ", " auto 1px;\n }\n }\n .MuiTabs-indicator {\n background-color: ", ";\n height: ", ";\n }\n .MuiTabs-scrollButtons {\n min-width: ", ";\n width: ", ";\n padding: 0;\n }\n @media (max-width: 599.95px) {\n .MuiTabs-scrollButtonsDesktop {\n display: flex;\n }\n }\n }\n"]);
|
|
62
60
|
|
|
63
61
|
_templateObject7 = function _templateObject7() {
|
|
64
62
|
return data;
|
|
@@ -68,7 +66,7 @@ function _templateObject7() {
|
|
|
68
66
|
}
|
|
69
67
|
|
|
70
68
|
function _templateObject6() {
|
|
71
|
-
var data = (0, _taggedTemplateLiteral2["default"])(["\n left: 0px;\n bottom: 0;\n width: 100%;\n height:
|
|
69
|
+
var data = (0, _taggedTemplateLiteral2["default"])(["\n left: 0px;\n bottom: 0;\n width: 100%;\n height: ", ";\n position: absolute;\n background-color: ", ";\n"]);
|
|
72
70
|
|
|
73
71
|
_templateObject6 = function _templateObject6() {
|
|
74
72
|
return data;
|
|
@@ -135,7 +133,9 @@ var DxcTabs = function DxcTabs(_ref) {
|
|
|
135
133
|
onTabHover = _ref.onTabHover,
|
|
136
134
|
margin = _ref.margin,
|
|
137
135
|
_ref$iconPosition = _ref.iconPosition,
|
|
138
|
-
iconPosition = _ref$iconPosition === void 0 ? "left" : _ref$iconPosition
|
|
136
|
+
iconPosition = _ref$iconPosition === void 0 ? "left" : _ref$iconPosition,
|
|
137
|
+
_ref$tabIndex = _ref.tabIndex,
|
|
138
|
+
tabIndex = _ref$tabIndex === void 0 ? 0 : _ref$tabIndex;
|
|
139
139
|
|
|
140
140
|
var _React$useState = _react["default"].useState(0),
|
|
141
141
|
_React$useState2 = (0, _slicedToArray2["default"])(_React$useState, 2),
|
|
@@ -157,6 +157,10 @@ var DxcTabs = function DxcTabs(_ref) {
|
|
|
157
157
|
}
|
|
158
158
|
};
|
|
159
159
|
|
|
160
|
+
var getTabIndex = function getTabIndex(index, disabled) {
|
|
161
|
+
return (activeTabIndex === index || innerActiveTabIndex === index) && !disabled ? tabIndex : -1;
|
|
162
|
+
};
|
|
163
|
+
|
|
160
164
|
var getLabelForTab = function getLabelForTab(tab) {
|
|
161
165
|
return _react["default"].createElement(ParentLabelSpan, null, _react["default"].createElement(MainLabelContainer, {
|
|
162
166
|
hasBadge: tab.notificationNumber
|
|
@@ -197,6 +201,7 @@ var DxcTabs = function DxcTabs(_ref) {
|
|
|
197
201
|
});
|
|
198
202
|
|
|
199
203
|
return _react["default"].createElement(_Tab["default"], {
|
|
204
|
+
tabIndex: (activeTabIndex === i || innerActiveTabIndex === i) && !tab.isDisabled ? tabIndex : -1,
|
|
200
205
|
key: "tab".concat(i).concat(tab.label),
|
|
201
206
|
label: getLabelForTab(tab),
|
|
202
207
|
disabled: tab.isDisabled,
|
|
@@ -230,7 +235,9 @@ var MainLabelContainer = _styledComponents["default"].div(_templateObject5(), fu
|
|
|
230
235
|
});
|
|
231
236
|
|
|
232
237
|
var Underline = _styledComponents["default"].div(_templateObject6(), function (props) {
|
|
233
|
-
return props.theme.
|
|
238
|
+
return props.theme.dividerThickness;
|
|
239
|
+
}, function (props) {
|
|
240
|
+
return props.theme.dividerColor;
|
|
234
241
|
});
|
|
235
242
|
|
|
236
243
|
var DxCTabs = _styledComponents["default"].div(_templateObject7(), function (props) {
|
|
@@ -243,34 +250,58 @@ var DxCTabs = _styledComponents["default"].div(_templateObject7(), function (pro
|
|
|
243
250
|
return props.margin && (0, _typeof2["default"])(props.margin) === "object" && props.margin.bottom ? _variables.spaces[props.margin.bottom] : "";
|
|
244
251
|
}, function (props) {
|
|
245
252
|
return props.margin && (0, _typeof2["default"])(props.margin) === "object" && props.margin.left ? _variables.spaces[props.margin.left] : "";
|
|
246
|
-
}, function (props) {
|
|
247
|
-
return (!props.hasLabelAndIcon || props.hasLabelAndIcon && props.iconPosition !== "top") && "12px 16px" || "8px 16px";
|
|
248
253
|
}, function (props) {
|
|
249
254
|
return (!props.hasLabelAndIcon || props.hasLabelAndIcon && props.iconPosition !== "top") && "48px" || "72px";
|
|
255
|
+
}, function (props) {
|
|
256
|
+
return props.theme.fontTextTransform;
|
|
250
257
|
}, function (props) {
|
|
251
258
|
return props.theme.fontFamily;
|
|
252
259
|
}, function (props) {
|
|
253
260
|
return props.theme.fontSize;
|
|
254
261
|
}, function (props) {
|
|
255
|
-
return props.theme.
|
|
262
|
+
return props.theme.fontStyle;
|
|
263
|
+
}, function (props) {
|
|
264
|
+
return props.theme.fontWeight;
|
|
265
|
+
}, function (props) {
|
|
266
|
+
return (!props.hasLabelAndIcon || props.hasLabelAndIcon && props.iconPosition !== "top") && "12px 16px" || "8px 16px";
|
|
267
|
+
}, function (props) {
|
|
268
|
+
return (!props.hasLabelAndIcon || props.hasLabelAndIcon && props.iconPosition !== "top") && "48px" || "72px";
|
|
269
|
+
}, function (props) {
|
|
270
|
+
return (!props.hasLabelAndIcon || props.hasLabelAndIcon && props.iconPosition !== "top") && "48px" || "72px";
|
|
256
271
|
}, function (props) {
|
|
257
272
|
return "".concat(props.theme.hoverBackgroundColor, " !important");
|
|
258
273
|
}, function (props) {
|
|
259
274
|
return "".concat(props.theme.pressedBackgroundColor, " !important");
|
|
260
275
|
}, function (props) {
|
|
261
|
-
return props.theme.
|
|
276
|
+
return "".concat(props.theme.pressedFontWeight, " !important");
|
|
262
277
|
}, function (props) {
|
|
263
|
-
return props.theme.
|
|
278
|
+
return props.theme.unselectedBackgroundColor;
|
|
264
279
|
}, function (props) {
|
|
265
|
-
return props.theme.
|
|
280
|
+
return props.theme.unselectedFontColor;
|
|
281
|
+
}, function (props) {
|
|
282
|
+
return props.theme.unselectedIconColor;
|
|
283
|
+
}, function (props) {
|
|
284
|
+
return props.theme.selectedBackgroundColor;
|
|
266
285
|
}, function (props) {
|
|
267
286
|
return props.theme.selectedFontColor;
|
|
287
|
+
}, function (props) {
|
|
288
|
+
return props.theme.selectedIconColor;
|
|
268
289
|
}, function (props) {
|
|
269
290
|
return props.theme.disabledFontColor;
|
|
291
|
+
}, function (props) {
|
|
292
|
+
return props.theme.disabledFontStyle;
|
|
293
|
+
}, function (props) {
|
|
294
|
+
return props.theme.disabledIconColor;
|
|
270
295
|
}, function (props) {
|
|
271
296
|
return props.theme.focusOutline;
|
|
272
297
|
}, function (props) {
|
|
273
298
|
return props.theme.selectedUnderlineColor;
|
|
299
|
+
}, function (props) {
|
|
300
|
+
return props.theme.selectedUnderlineThickness;
|
|
301
|
+
}, function (props) {
|
|
302
|
+
return props.theme.scrollButtonsWidth;
|
|
303
|
+
}, function (props) {
|
|
304
|
+
return props.theme.scrollButtonsWidth;
|
|
274
305
|
});
|
|
275
306
|
|
|
276
307
|
var TabIcon = _styledComponents["default"].img(_templateObject8());
|
|
@@ -289,8 +320,8 @@ DxcTabs.propTypes = {
|
|
|
289
320
|
label: _propTypes["default"].string,
|
|
290
321
|
icon: _propTypes["default"].oneOfType([_propTypes["default"].element, _propTypes["default"].func]),
|
|
291
322
|
iconSrc: _propTypes["default"].string,
|
|
292
|
-
isDisabled: _propTypes["default"]
|
|
293
|
-
notificationNumber: _propTypes["default"].oneOfType([_propTypes["default"]["
|
|
323
|
+
isDisabled: _propTypes["default"].bool,
|
|
324
|
+
notificationNumber: _propTypes["default"].oneOfType([_propTypes["default"].bool, _propTypes["default"].string, _propTypes["default"].number])
|
|
294
325
|
})),
|
|
295
326
|
margin: _propTypes["default"].oneOfType([_propTypes["default"].shape({
|
|
296
327
|
top: _propTypes["default"].oneOf(Object.keys(_variables.spaces)),
|
|
@@ -298,7 +329,8 @@ DxcTabs.propTypes = {
|
|
|
298
329
|
left: _propTypes["default"].oneOf(Object.keys(_variables.spaces)),
|
|
299
330
|
right: _propTypes["default"].oneOf(Object.keys(_variables.spaces))
|
|
300
331
|
}), _propTypes["default"].oneOf((0, _toConsumableArray2["default"])(Object.keys(_variables.spaces)))]),
|
|
301
|
-
iconPosition: _propTypes["default"].oneOf(["top", "left"])
|
|
332
|
+
iconPosition: _propTypes["default"].oneOf(["top", "left"]),
|
|
333
|
+
tabIndex: _propTypes["default"].number
|
|
302
334
|
};
|
|
303
335
|
DxcTabs.defaultProps = {
|
|
304
336
|
activeTabIndex: null,
|
package/dist/tag/Tag.js
CHANGED
|
@@ -19,16 +19,18 @@ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/sli
|
|
|
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
|
|
|
30
32
|
function _templateObject8() {
|
|
31
|
-
var data = (0, _taggedTemplateLiteral2["default"])(["\n
|
|
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"]);
|
|
32
34
|
|
|
33
35
|
_templateObject8 = function _templateObject8() {
|
|
34
36
|
return data;
|
|
@@ -38,7 +40,7 @@ function _templateObject8() {
|
|
|
38
40
|
}
|
|
39
41
|
|
|
40
42
|
function _templateObject7() {
|
|
41
|
-
var data = (0, _taggedTemplateLiteral2["default"])(["\n display: inline-flex;\n background: ", ";\n width:
|
|
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"]);
|
|
42
44
|
|
|
43
45
|
_templateObject7 = function _templateObject7() {
|
|
44
46
|
return data;
|
|
@@ -48,7 +50,7 @@ function _templateObject7() {
|
|
|
48
50
|
}
|
|
49
51
|
|
|
50
52
|
function _templateObject6() {
|
|
51
|
-
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"]);
|
|
52
54
|
|
|
53
55
|
_templateObject6 = function _templateObject6() {
|
|
54
56
|
return data;
|
|
@@ -58,7 +60,7 @@ function _templateObject6() {
|
|
|
58
60
|
}
|
|
59
61
|
|
|
60
62
|
function _templateObject5() {
|
|
61
|
-
var data = (0, _taggedTemplateLiteral2["default"])(["\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"]);
|
|
62
64
|
|
|
63
65
|
_templateObject5 = function _templateObject5() {
|
|
64
66
|
return data;
|
|
@@ -68,7 +70,7 @@ function _templateObject5() {
|
|
|
68
70
|
}
|
|
69
71
|
|
|
70
72
|
function _templateObject4() {
|
|
71
|
-
var data = (0, _taggedTemplateLiteral2["default"])(["\n background: none;\n border: none;\n padding: 0;\n cursor: pointer;\n
|
|
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"]);
|
|
72
74
|
|
|
73
75
|
_templateObject4 = function _templateObject4() {
|
|
74
76
|
return data;
|
|
@@ -78,7 +80,7 @@ function _templateObject4() {
|
|
|
78
80
|
}
|
|
79
81
|
|
|
80
82
|
function _templateObject3() {
|
|
81
|
-
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"]);
|
|
82
84
|
|
|
83
85
|
_templateObject3 = function _templateObject3() {
|
|
84
86
|
return data;
|
|
@@ -88,7 +90,7 @@ function _templateObject3() {
|
|
|
88
90
|
}
|
|
89
91
|
|
|
90
92
|
function _templateObject2() {
|
|
91
|
-
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"]);
|
|
92
94
|
|
|
93
95
|
_templateObject2 = function _templateObject2() {
|
|
94
96
|
return data;
|
|
@@ -115,13 +117,16 @@ var DxcTag = function DxcTag(_ref) {
|
|
|
115
117
|
linkHref = _ref.linkHref,
|
|
116
118
|
onClick = _ref.onClick,
|
|
117
119
|
_ref$iconBgColor = _ref.iconBgColor,
|
|
118
|
-
iconBgColor = _ref$iconBgColor === void 0 ? "
|
|
120
|
+
iconBgColor = _ref$iconBgColor === void 0 ? "#5f249f" : _ref$iconBgColor,
|
|
119
121
|
_ref$labelPosition = _ref.labelPosition,
|
|
120
122
|
labelPosition = _ref$labelPosition === void 0 ? "after" : _ref$labelPosition,
|
|
121
123
|
_ref$newWindow = _ref.newWindow,
|
|
122
124
|
newWindow = _ref$newWindow === void 0 ? false : _ref$newWindow,
|
|
123
125
|
_ref$size = _ref.size,
|
|
124
|
-
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"])();
|
|
125
130
|
|
|
126
131
|
var _useState = (0, _react.useState)(false),
|
|
127
132
|
_useState2 = (0, _slicedToArray2["default"])(_useState, 2),
|
|
@@ -129,9 +134,7 @@ var DxcTag = function DxcTag(_ref) {
|
|
|
129
134
|
changeIsHovered = _useState2[1];
|
|
130
135
|
|
|
131
136
|
var clickHandler = function clickHandler() {
|
|
132
|
-
|
|
133
|
-
onClick();
|
|
134
|
-
}
|
|
137
|
+
onClick && onClick();
|
|
135
138
|
};
|
|
136
139
|
|
|
137
140
|
var tagContent = _react["default"].createElement(_Box["default"], {
|
|
@@ -139,7 +142,6 @@ var DxcTag = function DxcTag(_ref) {
|
|
|
139
142
|
shadowDepth: isHovered && (onClick || linkHref) && 2 || 1
|
|
140
143
|
}, _react["default"].createElement(TagContent, {
|
|
141
144
|
labelPosition: labelPosition,
|
|
142
|
-
margin: margin,
|
|
143
145
|
size: size
|
|
144
146
|
}, _react["default"].createElement(IconContainer, {
|
|
145
147
|
iconBgColor: iconBgColor
|
|
@@ -147,7 +149,9 @@ var DxcTag = function DxcTag(_ref) {
|
|
|
147
149
|
src: iconSrc
|
|
148
150
|
})), size !== "small" && _react["default"].createElement(TagLabel, null, label)));
|
|
149
151
|
|
|
150
|
-
return _react["default"].createElement(
|
|
152
|
+
return _react["default"].createElement(_styledComponents.ThemeProvider, {
|
|
153
|
+
theme: colorsTheme.tag
|
|
154
|
+
}, _react["default"].createElement(StyledDxcTag, {
|
|
151
155
|
margin: margin,
|
|
152
156
|
onMouseEnter: function onMouseEnter() {
|
|
153
157
|
return changeIsHovered(true);
|
|
@@ -157,10 +161,13 @@ var DxcTag = function DxcTag(_ref) {
|
|
|
157
161
|
},
|
|
158
162
|
onClick: clickHandler,
|
|
159
163
|
hasAction: onClick || linkHref
|
|
160
|
-
}, onClick ? _react["default"].createElement(StyledButton,
|
|
164
|
+
}, onClick ? _react["default"].createElement(StyledButton, {
|
|
165
|
+
tabIndex: tabIndex
|
|
166
|
+
}, tagContent) : linkHref ? _react["default"].createElement(StyledLink, {
|
|
167
|
+
tabIndex: tabIndex,
|
|
161
168
|
href: linkHref,
|
|
162
169
|
target: newWindow ? "_blank" : "_self"
|
|
163
|
-
}, tagContent) : tagContent);
|
|
170
|
+
}, tagContent) : tagContent));
|
|
164
171
|
};
|
|
165
172
|
|
|
166
173
|
var sizes = {
|
|
@@ -200,23 +207,57 @@ var TagContent = _styledComponents["default"].div(_templateObject2(), function (
|
|
|
200
207
|
return labelPosition === "before" && "row-reverse" || "row";
|
|
201
208
|
}, function (props) {
|
|
202
209
|
return calculateWidth(props.size);
|
|
210
|
+
}, function (props) {
|
|
211
|
+
return props.theme.height;
|
|
203
212
|
});
|
|
204
213
|
|
|
205
|
-
var StyledLink = _styledComponents["default"].a(_templateObject3())
|
|
214
|
+
var StyledLink = _styledComponents["default"].a(_templateObject3(), function (props) {
|
|
215
|
+
return props.theme.focusColor;
|
|
216
|
+
});
|
|
206
217
|
|
|
207
|
-
var StyledButton = _styledComponents["default"].button(_templateObject4())
|
|
218
|
+
var StyledButton = _styledComponents["default"].button(_templateObject4(), function (props) {
|
|
219
|
+
return props.theme.focusColor;
|
|
220
|
+
});
|
|
208
221
|
|
|
209
|
-
var TagIcon = _styledComponents["default"].img(_templateObject5())
|
|
222
|
+
var TagIcon = _styledComponents["default"].img(_templateObject5(), function (props) {
|
|
223
|
+
return props.theme.iconWidth;
|
|
224
|
+
}, function (props) {
|
|
225
|
+
return props.theme.iconHeight;
|
|
226
|
+
});
|
|
210
227
|
|
|
211
|
-
var TagIconContainer = _styledComponents["default"].div(_templateObject6())
|
|
228
|
+
var TagIconContainer = _styledComponents["default"].div(_templateObject6(), function (props) {
|
|
229
|
+
return props.theme.iconWidth;
|
|
230
|
+
}, function (props) {
|
|
231
|
+
return props.theme.iconHeight;
|
|
232
|
+
});
|
|
212
233
|
|
|
213
234
|
var IconContainer = _styledComponents["default"].div(_templateObject7(), function (_ref9) {
|
|
214
235
|
var iconBgColor = _ref9.iconBgColor;
|
|
215
236
|
return iconBgColor;
|
|
237
|
+
}, function (props) {
|
|
238
|
+
return props.theme.iconSectionWidth;
|
|
239
|
+
}, function (props) {
|
|
240
|
+
return props.theme.iconColor;
|
|
216
241
|
});
|
|
217
242
|
|
|
218
243
|
var TagLabel = _styledComponents["default"].div(_templateObject8(), function (props) {
|
|
244
|
+
return props.theme.fontFamily;
|
|
245
|
+
}, function (props) {
|
|
219
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;
|
|
220
261
|
});
|
|
221
262
|
|
|
222
263
|
DxcTag.propTypes = {
|
|
@@ -234,18 +275,8 @@ DxcTag.propTypes = {
|
|
|
234
275
|
bottom: _propTypes["default"].oneOf(Object.keys(_variables.spaces)),
|
|
235
276
|
left: _propTypes["default"].oneOf(Object.keys(_variables.spaces)),
|
|
236
277
|
right: _propTypes["default"].oneOf(Object.keys(_variables.spaces))
|
|
237
|
-
}), _propTypes["default"].oneOf((0, _toConsumableArray2["default"])(Object.keys(_variables.spaces)))])
|
|
238
|
-
|
|
239
|
-
DxcTag.defaultProps = {
|
|
240
|
-
icon: null,
|
|
241
|
-
iconSrc: null,
|
|
242
|
-
label: null,
|
|
243
|
-
margin: null,
|
|
244
|
-
linkHref: null,
|
|
245
|
-
onClick: null,
|
|
246
|
-
iconBgColor: "black",
|
|
247
|
-
labelPosition: "after",
|
|
248
|
-
newWindow: false
|
|
278
|
+
}), _propTypes["default"].oneOf((0, _toConsumableArray2["default"])(Object.keys(_variables.spaces)))]),
|
|
279
|
+
tabIndex: _propTypes["default"].number
|
|
249
280
|
};
|
|
250
281
|
var _default = DxcTag;
|
|
251
282
|
exports["default"] = _default;
|