@dxc-technology/halstack-react 0.0.0-1b3d457 → 0.0.0-1b8b460
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/HalstackContext.js +7 -8
- package/accordion/types.d.ts +1 -0
- package/accordion-group/types.d.ts +1 -0
- package/box/types.d.ts +1 -0
- package/card/types.d.ts +1 -0
- package/checkbox/Checkbox.d.ts +2 -2
- package/checkbox/Checkbox.js +16 -16
- package/checkbox/Checkbox.stories.tsx +79 -59
- package/checkbox/types.d.ts +4 -0
- package/common/variables.js +129 -125
- package/date-input/Calendar.d.ts +4 -0
- package/date-input/Calendar.js +258 -0
- package/date-input/DateInput.js +77 -222
- package/date-input/DateInput.stories.tsx +30 -17
- package/date-input/DateInput.test.js +411 -138
- package/date-input/DatePicker.d.ts +4 -0
- package/date-input/DatePicker.js +160 -0
- package/date-input/YearPicker.d.ts +4 -0
- package/date-input/YearPicker.js +115 -0
- package/date-input/types.d.ts +53 -0
- package/dialog/Dialog.js +4 -4
- package/dialog/Dialog.stories.tsx +56 -0
- package/dialog/types.d.ts +1 -0
- package/dropdown/Dropdown.js +37 -33
- package/dropdown/Dropdown.test.js +19 -25
- package/dropdown/DropdownMenuItem.js +1 -1
- package/file-input/FileInput.d.ts +2 -2
- package/file-input/FileInput.js +177 -219
- package/file-input/FileInput.stories.tsx +38 -10
- package/file-input/FileInput.test.js +53 -12
- package/file-input/FileItem.d.ts +4 -14
- package/file-input/FileItem.js +38 -63
- package/file-input/types.d.ts +17 -0
- package/flex/Flex.d.ts +1 -1
- package/flex/Flex.js +31 -19
- package/flex/types.d.ts +14 -3
- package/footer/types.d.ts +1 -0
- package/header/types.d.ts +1 -0
- package/link/Link.js +1 -1
- package/number-input/NumberInput.test.js +43 -7
- package/package.json +7 -12
- package/paginator/Paginator.js +2 -2
- package/paginator/Paginator.test.js +1 -1
- package/password-input/PasswordInput.test.js +13 -12
- package/quick-nav/QuickNav.js +11 -12
- package/quick-nav/QuickNav.stories.tsx +97 -19
- package/radio-group/Radio.d.ts +1 -1
- package/radio-group/Radio.js +43 -28
- package/radio-group/RadioGroup.js +15 -13
- package/radio-group/RadioGroup.stories.tsx +1 -0
- package/radio-group/RadioGroup.test.js +123 -96
- package/radio-group/types.d.ts +2 -2
- package/resultsetTable/Icons.d.ts +7 -0
- package/resultsetTable/Icons.js +51 -0
- package/resultsetTable/ResultsetTable.js +48 -107
- package/resultsetTable/ResultsetTable.stories.tsx +50 -25
- package/resultsetTable/ResultsetTable.test.js +23 -41
- package/resultsetTable/types.d.ts +2 -2
- package/select/Select.js +3 -1
- package/select/Select.stories.tsx +2 -5
- package/select/Select.test.js +267 -209
- package/slider/Slider.d.ts +2 -2
- package/slider/Slider.js +15 -11
- package/slider/types.d.ts +4 -0
- package/spinner/Spinner.js +2 -2
- package/switch/Switch.d.ts +3 -3
- package/switch/Switch.js +93 -82
- package/switch/Switch.test.js +26 -13
- package/switch/types.d.ts +6 -1
- package/table/Table.js +1 -1
- package/table/Table.test.js +1 -1
- package/tabs/Tabs.js +3 -3
- package/tabs/Tabs.stories.tsx +0 -1
- package/tabs-nav/Tab.js +1 -1
- package/text-input/Suggestion.js +32 -5
- package/text-input/TextInput.js +165 -151
- package/text-input/TextInput.stories.tsx +6 -1
- package/text-input/TextInput.test.js +658 -647
- package/text-input/types.d.ts +5 -0
- package/common/RequiredComponent.js +0 -32
package/slider/Slider.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
import React from "react";
|
|
2
2
|
import SliderPropsType from "./types";
|
|
3
|
-
declare const DxcSlider:
|
|
3
|
+
declare const DxcSlider: React.ForwardRefExoticComponent<SliderPropsType & React.RefAttributes<HTMLDivElement>>;
|
|
4
4
|
export default DxcSlider;
|
package/slider/Slider.js
CHANGED
|
@@ -37,7 +37,7 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
|
|
|
37
37
|
|
|
38
38
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof3(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
39
39
|
|
|
40
|
-
var DxcSlider = function
|
|
40
|
+
var DxcSlider = /*#__PURE__*/_react["default"].forwardRef(function (_ref, ref) {
|
|
41
41
|
var _ref$label = _ref.label,
|
|
42
42
|
label = _ref$label === void 0 ? "" : _ref$label,
|
|
43
43
|
_ref$name = _ref.name,
|
|
@@ -100,8 +100,9 @@ var DxcSlider = function DxcSlider(_ref) {
|
|
|
100
100
|
while (index <= numberOfMarks) {
|
|
101
101
|
ticks.push( /*#__PURE__*/_react["default"].createElement(TickMark, {
|
|
102
102
|
disabled: disabled,
|
|
103
|
-
stepPosition: step * index / range
|
|
104
|
-
backgroundType: backgroundType
|
|
103
|
+
stepPosition: step * index / range,
|
|
104
|
+
backgroundType: backgroundType,
|
|
105
|
+
stepValue: (value !== null && value !== void 0 ? value : innerValue) / maxValue
|
|
105
106
|
}));
|
|
106
107
|
index++;
|
|
107
108
|
}
|
|
@@ -110,7 +111,7 @@ var DxcSlider = function DxcSlider(_ref) {
|
|
|
110
111
|
} else {
|
|
111
112
|
return null;
|
|
112
113
|
}
|
|
113
|
-
}, [minValue, maxValue, step]);
|
|
114
|
+
}, [minValue, maxValue, step, value, innerValue]);
|
|
114
115
|
|
|
115
116
|
var handleSliderChange = function handleSliderChange(event) {
|
|
116
117
|
var valueToCheck = event.target.value;
|
|
@@ -146,7 +147,8 @@ var DxcSlider = function DxcSlider(_ref) {
|
|
|
146
147
|
theme: colorsTheme.slider
|
|
147
148
|
}, /*#__PURE__*/_react["default"].createElement(Container, {
|
|
148
149
|
margin: margin,
|
|
149
|
-
size: size
|
|
150
|
+
size: size,
|
|
151
|
+
ref: ref
|
|
150
152
|
}, /*#__PURE__*/_react["default"].createElement(Label, {
|
|
151
153
|
id: labelId,
|
|
152
154
|
disabled: disabled,
|
|
@@ -188,7 +190,7 @@ var DxcSlider = function DxcSlider(_ref) {
|
|
|
188
190
|
onChange: handlerInputChange,
|
|
189
191
|
size: "fillParent"
|
|
190
192
|
})))));
|
|
191
|
-
};
|
|
193
|
+
});
|
|
192
194
|
|
|
193
195
|
var sizes = {
|
|
194
196
|
medium: "360px",
|
|
@@ -250,10 +252,10 @@ var HelperText = _styledComponents["default"].span(_templateObject3 || (_templat
|
|
|
250
252
|
return props.theme.helperTextLineHeight;
|
|
251
253
|
});
|
|
252
254
|
|
|
253
|
-
var SliderInput = _styledComponents["default"].input(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2["default"])(["\n width: 100%;\n min-width: 240px;\n height: ", ";\n display: inline-block;\n vertical-align: middle;\n -webkit-appearance: none;\n background-color: ", ";\n background-image: ", ";\n background-repeat: no-repeat;\n background-size: ", ";\n border-radius: 5px;\n
|
|
255
|
+
var SliderInput = _styledComponents["default"].input(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2["default"])(["\n width: 100%;\n min-width: 240px;\n height: ", ";\n display: inline-block;\n vertical-align: middle;\n -webkit-appearance: none;\n background-color: ", ";\n background-image: ", ";\n background-repeat: no-repeat;\n background-size: ", ";\n border-radius: 5px;\n cursor: ", ";\n &::-webkit-slider-runnable-track {\n -webkit-appearance: none;\n box-shadow: none;\n border: none;\n background: transparent;\n margin: 0px -8px;\n }\n\n &::-webkit-slider-thumb {\n -webkit-appearance: none;\n border: none;\n height: ", ";\n width: ", ";\n border-radius: 25px;\n background: ", ";\n &:active {\n ", "\n }\n &:hover {\n ", "\n }\n }\n &::-moz-range-track {\n -webkit-appearance: none;\n box-shadow: none;\n border: none;\n background: transparent;\n }\n &::-moz-range-thumb {\n -webkit-appearance: none;\n border: none;\n height: ", ";\n width: ", ";\n border-radius: 25px;\n background: ", ";\n &:active {\n background: ", ";\n transform: scale(1.16667);\n }\n &:hover {\n ", "\n }\n }\n &:focus {\n outline: none;\n &::-webkit-slider-thumb {\n outline: ", "\n auto 1px;\n outline-offset: 2px;\n }\n &::-moz-range-thumb {\n outline: ", "\n auto 1px;\n outline-offset: 2px;\n }\n }\n"])), function (props) {
|
|
254
256
|
return props.theme.trackLineThickness;
|
|
255
257
|
}, function (props) {
|
|
256
|
-
return props.disabled ? props.backgroundType === "dark" ? props.theme.disabledTotalLineColorOnDark + "61" : props.theme.disabledTotalLineColor + "61" : props.backgroundType === "dark" ? props.theme.totalLineColorOnDark + "61" : props.theme.totalLineColor
|
|
258
|
+
return props.disabled ? props.backgroundType === "dark" ? props.theme.disabledTotalLineColorOnDark + "61" : props.theme.disabledTotalLineColor + "61" : props.backgroundType === "dark" ? props.theme.totalLineColorOnDark + "61" : props.theme.totalLineColor;
|
|
257
259
|
}, function (props) {
|
|
258
260
|
return props.disabled ? props.backgroundType === "dark" ? "linear-gradient(".concat(props.theme.disabledTrackLineColorOnDark, ", ").concat(props.theme.disabledTrackLineColorOnDark, ")") : "linear-gradient(".concat(props.theme.disabledTrackLineColor, ", ").concat(props.theme.disabledTrackLineColor, ")") : props.backgroundType === "dark" ? "linear-gradient(".concat(props.theme.trackLineColorOnDark, ", ").concat(props.theme.trackLineColorOnDark, ")") : "linear-gradient(".concat(props.theme.trackLineColor, ", ").concat(props.theme.trackLineColor, ")");
|
|
259
261
|
}, function (props) {
|
|
@@ -315,20 +317,22 @@ var MaxLabelContainer = (0, _styledComponents["default"])(LimitLabelContainer)(_
|
|
|
315
317
|
return props.step === 1 ? props.theme.ceilLabelMarginLeft : "1.25rem";
|
|
316
318
|
});
|
|
317
319
|
|
|
318
|
-
var SliderInputContainer = _styledComponents["default"].div(_templateObject9 || (_templateObject9 = (0, _taggedTemplateLiteral2["default"])(["\n position: relative;\n width: 100%;\n height: 24px;\n display: flex;\n align-items: center;\n justify-content: center;\n margin-right: -2px;\n padding-top: 1px;\n"])));
|
|
320
|
+
var SliderInputContainer = _styledComponents["default"].div(_templateObject9 || (_templateObject9 = (0, _taggedTemplateLiteral2["default"])(["\n position: relative;\n width: 100%;\n height: 24px;\n display: flex;\n align-items: center;\n justify-content: center;\n margin-right: -2px;\n padding-top: 1px;\n z-index: 0;\n"])));
|
|
319
321
|
|
|
320
322
|
var MarksContainer = _styledComponents["default"].div(_templateObject10 || (_templateObject10 = (0, _taggedTemplateLiteral2["default"])(["\n ", "\n position: absolute;\n pointer-events: none;\n height: 100%;\n display: flex;\n align-items: center;\n"])), function (props) {
|
|
321
323
|
return props.isFirefox ? getFireFoxStyles() : getChromeStyles();
|
|
322
324
|
});
|
|
323
325
|
|
|
324
|
-
var TickMark = _styledComponents["default"].span(_templateObject11 || (_templateObject11 = (0, _taggedTemplateLiteral2["default"])(["\n position: absolute;\n background: ", ";\n height: ", ";\n width: ", ";\n border-radius: 18px;\n left: ", ";\n"])), function (props) {
|
|
326
|
+
var TickMark = _styledComponents["default"].span(_templateObject11 || (_templateObject11 = (0, _taggedTemplateLiteral2["default"])(["\n position: absolute;\n background: ", ";\n height: ", ";\n width: ", ";\n border-radius: 18px;\n left: ", ";\n z-index: ", ";\n"])), function (props) {
|
|
325
327
|
return props.disabled ? props.backgroundType === "dark" ? props.theme.disabledTickBackgroundColorOnDark : props.theme.disabledTickBackgroundColor : props.backgroundType === "dark" ? props.theme.tickBackgroundColorOnDark : props.theme.tickBackgroundColor;
|
|
326
328
|
}, function (props) {
|
|
327
329
|
return props.theme.tickHeight;
|
|
328
330
|
}, function (props) {
|
|
329
331
|
return props.theme.tickWidth;
|
|
330
332
|
}, function (props) {
|
|
331
|
-
return "".concat(props.stepPosition, "%");
|
|
333
|
+
return "calc(".concat(props.stepPosition, " * 100%)");
|
|
334
|
+
}, function (props) {
|
|
335
|
+
return "".concat(props.stepPosition <= props.stepValue ? "-1" : "0");
|
|
332
336
|
});
|
|
333
337
|
|
|
334
338
|
var StyledTextInput = _styledComponents["default"].div(_templateObject12 || (_templateObject12 = (0, _taggedTemplateLiteral2["default"])(["\n margin-left: ", ";\n max-width: 70px;\n"])), function (props) {
|
package/slider/types.d.ts
CHANGED
package/spinner/Spinner.js
CHANGED
|
@@ -178,7 +178,7 @@ var BackOverlay = _styledComponents["default"].div(_templateObject3 || (_templat
|
|
|
178
178
|
return "".concat(props.theme.overlayOpacity);
|
|
179
179
|
});
|
|
180
180
|
|
|
181
|
-
var BackgroundSpinner = _styledComponents["default"].div(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2["default"])(["\n height: inherit;\n width: inherit;\n position: absolute;\n
|
|
181
|
+
var BackgroundSpinner = _styledComponents["default"].div(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2["default"])(["\n height: inherit;\n width: inherit;\n position: absolute;\n"])));
|
|
182
182
|
|
|
183
183
|
var SVGBackground = _styledComponents["default"].svg(_templateObject5 || (_templateObject5 = (0, _taggedTemplateLiteral2["default"])(["\n height: inherit;\n width: inherit;\n"])));
|
|
184
184
|
|
|
@@ -190,7 +190,7 @@ var CircleBackground = _styledComponents["default"].circle(_templateObject6 || (
|
|
|
190
190
|
return props.mode !== "small" ? "8.5px" : "2px";
|
|
191
191
|
});
|
|
192
192
|
|
|
193
|
-
var Spinner = _styledComponents["default"].div(_templateObject7 || (_templateObject7 = (0, _taggedTemplateLiteral2["default"])(["\n height: inherit;\n width: inherit;\n position: relative;\n
|
|
193
|
+
var Spinner = _styledComponents["default"].div(_templateObject7 || (_templateObject7 = (0, _taggedTemplateLiteral2["default"])(["\n height: inherit;\n width: inherit;\n position: relative;\n"])));
|
|
194
194
|
|
|
195
195
|
var SVGSpinner = _styledComponents["default"].svg(_templateObject8 || (_templateObject8 = (0, _taggedTemplateLiteral2["default"])(["\n height: inherit;\n width: inherit;\n transform: rotate(-90deg);\n top: 0;\n left: 0;\n transform-origin: center;\n overflow: visible;\n animation: ", ";\n"])), function (props) {
|
|
196
196
|
return !props.isDeterminated ? "1.4s linear infinite both spinner-svg" : "";
|
package/switch/Switch.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
import
|
|
3
|
-
declare const DxcSwitch:
|
|
1
|
+
import React from "react";
|
|
2
|
+
import SwitchPropsType from "./types";
|
|
3
|
+
declare const DxcSwitch: React.ForwardRefExoticComponent<SwitchPropsType & React.RefAttributes<HTMLDivElement>>;
|
|
4
4
|
export default DxcSwitch;
|
package/switch/Switch.js
CHANGED
|
@@ -31,15 +31,13 @@ var _useTranslatedLabels = _interopRequireDefault(require("../useTranslatedLabel
|
|
|
31
31
|
|
|
32
32
|
var _BackgroundColorContext = _interopRequireDefault(require("../BackgroundColorContext"));
|
|
33
33
|
|
|
34
|
-
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5
|
|
34
|
+
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5;
|
|
35
35
|
|
|
36
36
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
37
37
|
|
|
38
38
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof3(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
39
39
|
|
|
40
|
-
var DxcSwitch = function
|
|
41
|
-
var _ref2;
|
|
42
|
-
|
|
40
|
+
var DxcSwitch = /*#__PURE__*/_react["default"].forwardRef(function (_ref, ref) {
|
|
43
41
|
var defaultChecked = _ref.defaultChecked,
|
|
44
42
|
checked = _ref.checked,
|
|
45
43
|
value = _ref.value,
|
|
@@ -71,10 +69,6 @@ var DxcSwitch = function DxcSwitch(_ref) {
|
|
|
71
69
|
innerChecked = _useState4[0],
|
|
72
70
|
setInnerChecked = _useState4[1];
|
|
73
71
|
|
|
74
|
-
var _useState5 = (0, _react.useState)((_ref2 = label !== "" && label !== null && label !== undefined) !== null && _ref2 !== void 0 ? _ref2 : false),
|
|
75
|
-
_useState6 = (0, _slicedToArray2["default"])(_useState5, 1),
|
|
76
|
-
hasLabel = _useState6[0];
|
|
77
|
-
|
|
78
72
|
var colorsTheme = (0, _useTheme["default"])();
|
|
79
73
|
var translatedLabels = (0, _useTranslatedLabels["default"])();
|
|
80
74
|
var backgroundType = (0, _react.useContext)(_BackgroundColorContext["default"]);
|
|
@@ -89,30 +83,16 @@ var DxcSwitch = function DxcSwitch(_ref) {
|
|
|
89
83
|
refTrack.current.focus();
|
|
90
84
|
var isChecked = !(checked !== null && checked !== void 0 ? checked : innerChecked);
|
|
91
85
|
setInnerChecked(isChecked);
|
|
92
|
-
|
|
93
|
-
if (typeof onChange === "function") {
|
|
94
|
-
onChange(isChecked);
|
|
95
|
-
}
|
|
96
|
-
|
|
86
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(isChecked);
|
|
97
87
|
break;
|
|
98
88
|
}
|
|
99
89
|
};
|
|
100
90
|
|
|
101
91
|
var handlerSwitchChange = function handlerSwitchChange(event) {
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
setInnerChecked(isChecked);
|
|
107
|
-
|
|
108
|
-
if (typeof onChange === "function") {
|
|
109
|
-
onChange(isChecked);
|
|
110
|
-
}
|
|
111
|
-
} else {
|
|
112
|
-
if (typeof onChange === "function") {
|
|
113
|
-
onChange(!checked);
|
|
114
|
-
}
|
|
115
|
-
}
|
|
92
|
+
checked !== null && checked !== void 0 ? checked : setInnerChecked(function (innerChecked) {
|
|
93
|
+
return !innerChecked;
|
|
94
|
+
});
|
|
95
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(checked ? !checked : !innerChecked);
|
|
116
96
|
};
|
|
117
97
|
|
|
118
98
|
return /*#__PURE__*/_react["default"].createElement(_styledComponents.ThemeProvider, {
|
|
@@ -120,49 +100,41 @@ var DxcSwitch = function DxcSwitch(_ref) {
|
|
|
120
100
|
}, /*#__PURE__*/_react["default"].createElement(SwitchContainer, {
|
|
121
101
|
margin: margin,
|
|
122
102
|
size: size,
|
|
123
|
-
onKeyDown: handleOnKeyDown
|
|
124
|
-
|
|
103
|
+
onKeyDown: handleOnKeyDown,
|
|
104
|
+
disabled: disabled,
|
|
105
|
+
onClick: !disabled ? handlerSwitchChange : undefined,
|
|
106
|
+
ref: ref
|
|
107
|
+
}, labelPosition === "before" && label && /*#__PURE__*/_react["default"].createElement(LabelContainer, {
|
|
125
108
|
id: labelId,
|
|
126
109
|
labelPosition: labelPosition,
|
|
127
|
-
onClick: !disabled ? handlerSwitchChange : undefined,
|
|
128
110
|
disabled: disabled,
|
|
129
111
|
backgroundType: backgroundType,
|
|
130
|
-
|
|
131
|
-
}, label, " ", optional && /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, translatedLabels.formFields.optionalLabel)), /*#__PURE__*/_react["default"].createElement(
|
|
132
|
-
labelPosition: labelPosition,
|
|
133
|
-
hasLabel: hasLabel,
|
|
134
|
-
htmlFor: labelId,
|
|
135
|
-
onClick: disabled === true ? function () {} : handlerSwitchChange
|
|
136
|
-
}, /*#__PURE__*/_react["default"].createElement(SwitchInput, {
|
|
112
|
+
label: label
|
|
113
|
+
}, label, " ", optional && /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, translatedLabels.formFields.optionalLabel)), /*#__PURE__*/_react["default"].createElement(ValueInput, {
|
|
137
114
|
type: "checkbox",
|
|
138
|
-
role: "switch",
|
|
139
115
|
name: name,
|
|
140
|
-
|
|
141
|
-
disabled: disabled,
|
|
116
|
+
"aria-hidden": true,
|
|
142
117
|
value: value,
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
}), disabled ? /*#__PURE__*/_react["default"].createElement(DisabledSwitchTrack, {
|
|
149
|
-
backgroundType: backgroundType,
|
|
150
|
-
"data-checked": checked !== null && checked !== void 0 ? checked : innerChecked ? innerChecked : undefined,
|
|
151
|
-
tabIndex: -1
|
|
152
|
-
}) : /*#__PURE__*/_react["default"].createElement(SwitchTrack, {
|
|
118
|
+
disabled: disabled,
|
|
119
|
+
checked: checked !== null && checked !== void 0 ? checked : innerChecked,
|
|
120
|
+
readOnly: true
|
|
121
|
+
}), /*#__PURE__*/_react["default"].createElement(SwitchBase, null, /*#__PURE__*/_react["default"].createElement(SwitchTrack, {
|
|
122
|
+
role: "switch",
|
|
153
123
|
backgroundType: backgroundType,
|
|
154
|
-
"
|
|
155
|
-
|
|
124
|
+
"aria-checked": checked !== null && checked !== void 0 ? checked : innerChecked,
|
|
125
|
+
"aria-disabled": disabled,
|
|
126
|
+
disabled: disabled,
|
|
127
|
+
"aria-labelledby": labelId,
|
|
128
|
+
tabIndex: !disabled ? tabIndex : -1,
|
|
156
129
|
ref: refTrack
|
|
157
|
-
})), labelPosition === "after" &&
|
|
130
|
+
})), labelPosition === "after" && label && /*#__PURE__*/_react["default"].createElement(LabelContainer, {
|
|
158
131
|
id: labelId,
|
|
159
132
|
labelPosition: labelPosition,
|
|
160
|
-
onClick: !disabled ? handlerSwitchChange : undefined,
|
|
161
133
|
disabled: disabled,
|
|
162
134
|
backgroundType: backgroundType,
|
|
163
|
-
|
|
135
|
+
label: label
|
|
164
136
|
}, optional && /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, translatedLabels.formFields.optionalLabel), " ", label)));
|
|
165
|
-
};
|
|
137
|
+
});
|
|
166
138
|
|
|
167
139
|
var sizes = {
|
|
168
140
|
small: "60px",
|
|
@@ -176,8 +148,60 @@ var calculateWidth = function calculateWidth(margin, size) {
|
|
|
176
148
|
return size === "fillParent" ? "calc(".concat(sizes[size], " - ").concat((0, _utils.getMargin)(margin, "left"), " - ").concat((0, _utils.getMargin)(margin, "right"), ")") : sizes[size];
|
|
177
149
|
};
|
|
178
150
|
|
|
179
|
-
var
|
|
151
|
+
var getDisabledColor = function getDisabledColor(props, element, subelement) {
|
|
152
|
+
switch (element) {
|
|
153
|
+
case "track":
|
|
154
|
+
switch (subelement) {
|
|
155
|
+
case "check":
|
|
156
|
+
return props.backgroundType && props.backgroundType === "dark" ? props.theme.disabledCheckedTrackBackgroundColorOnDark : props.theme.disabledCheckedTrackBackgroundColor;
|
|
157
|
+
|
|
158
|
+
case "uncheck":
|
|
159
|
+
return props.backgroundType && props.backgroundType === "dark" ? props.theme.disabledUncheckedTrackBackgroundColorOnDark : props.theme.disabledUncheckedTrackBackgroundColor;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
case "thumb":
|
|
163
|
+
switch (subelement) {
|
|
164
|
+
case "check":
|
|
165
|
+
return props.backgroundType && props.backgroundType === "dark" ? props.theme.disabledCheckedThumbBackgroundColorOnDark : props.theme.disabledCheckedThumbBackgroundColor;
|
|
166
|
+
|
|
167
|
+
case "uncheck":
|
|
168
|
+
return props.backgroundType && props.backgroundType === "dark" ? props.theme.disabledUncheckedThumbBackgroundColorOnDark : props.theme.disabledUncheckedThumbBackgroundColor;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
case "label":
|
|
172
|
+
return props.backgroundType && props.backgroundType === "dark" ? props.theme.disabledLabelFontColorOnDark : props.theme.disabledLabelFontColor;
|
|
173
|
+
}
|
|
174
|
+
};
|
|
175
|
+
|
|
176
|
+
var getNotDisabledColor = function getNotDisabledColor(props, element, subelement) {
|
|
177
|
+
switch (element) {
|
|
178
|
+
case "track":
|
|
179
|
+
switch (subelement) {
|
|
180
|
+
case "check":
|
|
181
|
+
return props.backgroundType && props.backgroundType === "dark" ? props.theme.checkedTrackBackgroundColorOnDark : props.theme.checkedTrackBackgroundColor;
|
|
182
|
+
|
|
183
|
+
case "uncheck":
|
|
184
|
+
return props.backgroundType && props.backgroundType === "dark" ? props.theme.uncheckedTrackBackgroundColorOnDark : props.theme.uncheckedTrackBackgroundColor;
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
case "thumb":
|
|
188
|
+
switch (subelement) {
|
|
189
|
+
case "check":
|
|
190
|
+
return props.backgroundType && props.backgroundType === "dark" ? props.theme.checkedThumbBackgroundColorOnDark : props.theme.checkedThumbBackgroundColor;
|
|
191
|
+
|
|
192
|
+
case "uncheck":
|
|
193
|
+
return props.backgroundType && props.backgroundType === "dark" ? props.theme.uncheckedThumbBackgroundColorOnDark : props.theme.uncheckedThumbBackgroundColor;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
case "label":
|
|
197
|
+
return props.backgroundType && props.backgroundType === "dark" ? props.theme.labelFontColorOnDark : props.theme.labelFontColor;
|
|
198
|
+
}
|
|
199
|
+
};
|
|
200
|
+
|
|
201
|
+
var SwitchContainer = _styledComponents["default"].div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["\n display: inline-flex;\n align-items: center;\n width: ", ";\n height: 40px;\n cursor: ", ";\n\n margin: ", ";\n margin-top: ", ";\n margin-right: ", ";\n margin-bottom: ", ";\n margin-left: ", ";\n"])), function (props) {
|
|
180
202
|
return calculateWidth(props.margin, props.size);
|
|
203
|
+
}, function (props) {
|
|
204
|
+
return props.disabled === true ? "not-allowed" : "pointer";
|
|
181
205
|
}, function (props) {
|
|
182
206
|
return props.margin && (0, _typeof2["default"])(props.margin) !== "object" ? _variables.spaces[props.margin] : "0px";
|
|
183
207
|
}, function (props) {
|
|
@@ -190,8 +214,8 @@ var SwitchContainer = _styledComponents["default"].div(_templateObject || (_temp
|
|
|
190
214
|
return props.margin && (0, _typeof2["default"])(props.margin) === "object" && props.margin.left ? _variables.spaces[props.margin.left] : "";
|
|
191
215
|
});
|
|
192
216
|
|
|
193
|
-
var LabelContainer = _styledComponents["default"].span(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2["default"])(["\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n color: ", ";\n opacity: 1;\n font-family: ", ";\n font-size: ", ";\n font-style: ", ";\n font-weight: ", ";\n
|
|
194
|
-
return props.disabled ? props
|
|
217
|
+
var LabelContainer = _styledComponents["default"].span(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2["default"])(["\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n color: ", ";\n opacity: 1;\n font-family: ", ";\n font-size: ", ";\n font-style: ", ";\n font-weight: ", ";\n\n ", ";\n\n ", "\n"])), function (props) {
|
|
218
|
+
return props.disabled ? getDisabledColor(props, "label") : getNotDisabledColor(props, "label");
|
|
195
219
|
}, function (props) {
|
|
196
220
|
return props.theme.labelFontFamily;
|
|
197
221
|
}, function (props) {
|
|
@@ -201,23 +225,21 @@ var LabelContainer = _styledComponents["default"].span(_templateObject2 || (_tem
|
|
|
201
225
|
}, function (props) {
|
|
202
226
|
return props.theme.labelFontWeight;
|
|
203
227
|
}, function (props) {
|
|
204
|
-
return props.
|
|
205
|
-
}, function (props) {
|
|
206
|
-
return !props.hasLabel ? "margin: 0px;" : props.labelPosition === "after" ? "margin-left: ".concat(props.theme.spaceBetweenLabelSwitch, ";") : "margin-right: ".concat(props.theme.spaceBetweenLabelSwitch, ";");
|
|
228
|
+
return !props.label ? "margin: 0px;" : props.labelPosition === "after" ? "margin-left: ".concat(props.theme.spaceBetweenLabelSwitch, ";") : "margin-right: ".concat(props.theme.spaceBetweenLabelSwitch, ";");
|
|
207
229
|
}, function (props) {
|
|
208
230
|
return props.labelPosition === "before" && "order: -1";
|
|
209
231
|
});
|
|
210
232
|
|
|
211
|
-
var SwitchBase = _styledComponents["default"].label(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n align-items: center;\n justify-content: space-between;\n cursor: pointer;\n margin:
|
|
212
|
-
return !props.hasLabel ? "0px 4px" : props.labelPosition === "before" ? "0 4px 0 12px" : "0 12px 0 4px";
|
|
213
|
-
});
|
|
233
|
+
var SwitchBase = _styledComponents["default"].label(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n align-items: center;\n justify-content: space-between;\n cursor: pointer;\n margin: 0px 12px;\n"])));
|
|
214
234
|
|
|
215
|
-
var
|
|
235
|
+
var ValueInput = _styledComponents["default"].input(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2["default"])(["\n display: none;\n"])));
|
|
216
236
|
|
|
217
|
-
var SwitchTrack = _styledComponents["default"].span(_templateObject5 || (_templateObject5 = (0, _taggedTemplateLiteral2["default"])(["\n border-radius: 15px;\n width: ", ";\n height: ", ";\n position: relative;\n
|
|
237
|
+
var SwitchTrack = _styledComponents["default"].span(_templateObject5 || (_templateObject5 = (0, _taggedTemplateLiteral2["default"])(["\n border-radius: 15px;\n width: ", ";\n height: ", ";\n position: relative;\n cursor: ", ";\n\n &:focus-visible {\n outline: none;\n ::before {\n outline: ", ";\n outline-offset: 6px;\n }\n }\n\n /* Thumb element */\n ::before {\n content: \"\";\n transform: initial;\n position: absolute;\n width: ", ";\n height: ", ";\n border-radius: 50%;\n box-shadow: 0px 2px 1px -1px rgb(0 0 0 / 20%), 0px 1px 1px 0px rgb(0 0 0 / 14%), 0px 1px 3px 0px rgb(0 0 0 / 12%);\n bottom: -6px;\n left: -4px;\n transform: translateX(0px);\n background-color: ", ";\n }\n\n /* Unchecked */\n background-color: ", ";\n\n /* Checked */\n &[aria-checked=\"true\"] {\n background-color: ", ";\n ::before {\n transform: translateX(", ");\n background-color: ", ";\n }\n }\n"])), function (props) {
|
|
218
238
|
return props.theme.trackWidth;
|
|
219
239
|
}, function (props) {
|
|
220
240
|
return props.theme.trackHeight;
|
|
241
|
+
}, function (props) {
|
|
242
|
+
return props.disabled ? "not-allowed" : "pointer";
|
|
221
243
|
}, function (props) {
|
|
222
244
|
return "".concat(props.backgroundType === "dark" ? props.theme.thumbFocusColorOnDark : props.theme.thumbFocusColor, " solid 2px");
|
|
223
245
|
}, function (props) {
|
|
@@ -225,27 +247,16 @@ var SwitchTrack = _styledComponents["default"].span(_templateObject5 || (_templa
|
|
|
225
247
|
}, function (props) {
|
|
226
248
|
return props.theme.thumbHeight;
|
|
227
249
|
}, function (props) {
|
|
228
|
-
return props.
|
|
250
|
+
return props.disabled ? getDisabledColor(props, "thumb", "uncheck") : getNotDisabledColor(props, "thumb", "uncheck");
|
|
229
251
|
}, function (props) {
|
|
230
|
-
return props.
|
|
252
|
+
return props.disabled ? getDisabledColor(props, "track", "uncheck") : getNotDisabledColor(props, "track", "uncheck");
|
|
231
253
|
}, function (props) {
|
|
232
|
-
return props.
|
|
254
|
+
return props.disabled ? getDisabledColor(props, "track", "check") : getNotDisabledColor(props, "track", "check");
|
|
233
255
|
}, function (props) {
|
|
234
256
|
return props.theme.thumbShift;
|
|
235
257
|
}, function (props) {
|
|
236
|
-
return props.
|
|
258
|
+
return props.disabled ? getDisabledColor(props, "thumb", "check") : getNotDisabledColor(props, "thumb", "check");
|
|
237
259
|
});
|
|
238
260
|
|
|
239
|
-
var DisabledSwitchTrack = (0, _styledComponents["default"])(SwitchTrack)(_templateObject6 || (_templateObject6 = (0, _taggedTemplateLiteral2["default"])(["\n cursor: not-allowed;\n\n /* Unchecked */\n background-color: ", ";\n\n ::before {\n background-color: ", ";\n }\n\n /* Checked */\n &[data-checked=\"true\"] {\n background-color: ", ";\n\n ::before {\n transform: translateX(", ");\n background-color: ", ";\n }\n }\n"])), function (props) {
|
|
240
|
-
return props.backgroundType === "dark" ? props.theme.disabledUncheckedTrackBackgroundColorOnDark : props.theme.disabledUncheckedTrackBackgroundColor;
|
|
241
|
-
}, function (props) {
|
|
242
|
-
return props.backgroundType === "dark" ? props.theme.disabledUncheckedThumbBackgroundColorOnDark : props.theme.disabledUncheckedThumbBackgroundColor;
|
|
243
|
-
}, function (props) {
|
|
244
|
-
return props.backgroundType === "dark" ? props.theme.disabledCheckedTrackBackgroundColorOnDark : props.theme.disabledCheckedTrackBackgroundColor;
|
|
245
|
-
}, function (props) {
|
|
246
|
-
return props.theme.thumbShift;
|
|
247
|
-
}, function (props) {
|
|
248
|
-
return props.backgroundType === "dark" ? props.theme.disabledCheckedThumbBackgroundColorOnDark : props.theme.disabledCheckedThumbBackgroundColor;
|
|
249
|
-
});
|
|
250
261
|
var _default = DxcSwitch;
|
|
251
262
|
exports["default"] = _default;
|
package/switch/Switch.test.js
CHANGED
|
@@ -185,28 +185,41 @@ describe("Switch component tests", function () {
|
|
|
185
185
|
expect(onChange.mock.calls[1][0]).toBe(false);
|
|
186
186
|
});
|
|
187
187
|
test("Renders with correct initial value and initial state when it is uncontrolled", function () {
|
|
188
|
-
var
|
|
188
|
+
var component = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Switch["default"], {
|
|
189
189
|
label: "Default label",
|
|
190
190
|
defaultChecked: true,
|
|
191
|
-
value: "test-defaultChecked"
|
|
191
|
+
value: "test-defaultChecked",
|
|
192
|
+
name: "test"
|
|
193
|
+
}));
|
|
194
|
+
var switchEl = component.getByRole("switch");
|
|
195
|
+
var inputEl = component.container.querySelector("input[name=\"test\"]");
|
|
196
|
+
expect(inputEl.value).toBe("test-defaultChecked");
|
|
197
|
+
expect(switchEl.getAttribute("aria-checked")).toBe("true");
|
|
198
|
+
});
|
|
199
|
+
test("Renders with correct aria attributes", function () {
|
|
200
|
+
var _render10 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Switch["default"], {
|
|
201
|
+
label: "Default label"
|
|
192
202
|
})),
|
|
203
|
+
getByText = _render10.getByText,
|
|
193
204
|
getByRole = _render10.getByRole;
|
|
194
205
|
|
|
195
|
-
var
|
|
196
|
-
|
|
197
|
-
expect(
|
|
198
|
-
expect(
|
|
206
|
+
var switchEl = getByRole("switch");
|
|
207
|
+
var label = getByText("Default label");
|
|
208
|
+
expect(switchEl.getAttribute("aria-labelledby")).toBe(label.id);
|
|
209
|
+
expect(switchEl.getAttribute("aria-checked")).toBe("false");
|
|
199
210
|
});
|
|
200
|
-
test("Renders
|
|
211
|
+
test("Renders disabled switch correctly", function () {
|
|
201
212
|
var _render11 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Switch["default"], {
|
|
202
|
-
label: "Default label"
|
|
213
|
+
label: "Default label",
|
|
214
|
+
disabled: true
|
|
203
215
|
})),
|
|
204
|
-
|
|
205
|
-
|
|
216
|
+
getByText = _render11.getByText,
|
|
217
|
+
getByRole = _render11.getByRole;
|
|
206
218
|
|
|
207
|
-
var
|
|
219
|
+
var switchEl = getByRole("switch");
|
|
208
220
|
var label = getByText("Default label");
|
|
209
|
-
expect(
|
|
210
|
-
expect(
|
|
221
|
+
expect(switchEl.getAttribute("aria-labelledby")).toBe(label.id);
|
|
222
|
+
expect(switchEl.getAttribute("aria-checked")).toBe("false");
|
|
223
|
+
expect(switchEl.getAttribute("aria-disabled")).toBe("true");
|
|
211
224
|
});
|
|
212
225
|
});
|
package/switch/types.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ export declare type Margin = {
|
|
|
5
5
|
left?: Space;
|
|
6
6
|
right?: Space;
|
|
7
7
|
};
|
|
8
|
-
|
|
8
|
+
declare type Props = {
|
|
9
9
|
/**
|
|
10
10
|
* Initial state of the switch, only when it is uncontrolled.
|
|
11
11
|
*/
|
|
@@ -59,3 +59,8 @@ export declare type SwitchPropsType = {
|
|
|
59
59
|
*/
|
|
60
60
|
tabIndex?: number;
|
|
61
61
|
};
|
|
62
|
+
/**
|
|
63
|
+
* Reference to the component.
|
|
64
|
+
*/
|
|
65
|
+
export declare type RefType = HTMLDivElement;
|
|
66
|
+
export default Props;
|
package/table/Table.js
CHANGED
|
@@ -66,7 +66,7 @@ var DxcTableContainer = _styledComponents["default"].div(_templateObject || (_te
|
|
|
66
66
|
return props.theme.scrollBarTrackColor;
|
|
67
67
|
});
|
|
68
68
|
|
|
69
|
-
var DxcTableContent = _styledComponents["default"].table(_templateObject2 || (_templateObject2 = (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"])), function (props) {
|
|
69
|
+
var DxcTableContent = _styledComponents["default"].table(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2["default"])(["\n border-collapse: collapse;\n width: 100%;\n\n & tr {\n border-bottom: ", ";\n height: 60px;\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 & td:last-child {\n padding-right: 40px;\n }\n"])), function (props) {
|
|
70
70
|
return "".concat(props.theme.rowSeparatorThickness, " ").concat(props.theme.rowSeparatorStyle, " ").concat(props.theme.rowSeparatorColor);
|
|
71
71
|
}, function (props) {
|
|
72
72
|
return props.theme.dataBackgroundColor;
|
package/table/Table.test.js
CHANGED
|
@@ -10,7 +10,7 @@ var _Table = _interopRequireDefault(require("./Table"));
|
|
|
10
10
|
|
|
11
11
|
describe("Table component tests", function () {
|
|
12
12
|
test("Table renders with correct content", function () {
|
|
13
|
-
var _render = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Table["default"], null, /*#__PURE__*/_react["default"].createElement("tr", null, /*#__PURE__*/_react["default"].createElement("th", null, "header-1"), /*#__PURE__*/_react["default"].createElement("th", null, "header-2"), /*#__PURE__*/_react["default"].createElement("th", null, "header-3")), /*#__PURE__*/_react["default"].createElement("tr", null, /*#__PURE__*/_react["default"].createElement("td", null, "cell-1"), /*#__PURE__*/_react["default"].createElement("td", null, "cell-2"), /*#__PURE__*/_react["default"].createElement("td", null, "cell-3")), /*#__PURE__*/_react["default"].createElement("tr", null, /*#__PURE__*/_react["default"].createElement("td", null, "cell-4"), /*#__PURE__*/_react["default"].createElement("td", null, "cell-5"), /*#__PURE__*/_react["default"].createElement("td", null, "cell-6")))),
|
|
13
|
+
var _render = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Table["default"], null, /*#__PURE__*/_react["default"].createElement("thead", null, /*#__PURE__*/_react["default"].createElement("tr", null, /*#__PURE__*/_react["default"].createElement("th", null, "header-1"), /*#__PURE__*/_react["default"].createElement("th", null, "header-2"), /*#__PURE__*/_react["default"].createElement("th", null, "header-3"))), /*#__PURE__*/_react["default"].createElement("tbody", null, /*#__PURE__*/_react["default"].createElement("tr", null, /*#__PURE__*/_react["default"].createElement("td", null, "cell-1"), /*#__PURE__*/_react["default"].createElement("td", null, "cell-2"), /*#__PURE__*/_react["default"].createElement("td", null, "cell-3")), /*#__PURE__*/_react["default"].createElement("tr", null, /*#__PURE__*/_react["default"].createElement("td", null, "cell-4"), /*#__PURE__*/_react["default"].createElement("td", null, "cell-5"), /*#__PURE__*/_react["default"].createElement("td", null, "cell-6"))))),
|
|
14
14
|
getByText = _render.getByText;
|
|
15
15
|
|
|
16
16
|
expect(getByText("header-1")).toBeTruthy();
|
package/tabs/Tabs.js
CHANGED
|
@@ -395,7 +395,7 @@ var DxcTabs = function DxcTabs(_ref) {
|
|
|
395
395
|
}, arrowIcons.right))));
|
|
396
396
|
};
|
|
397
397
|
|
|
398
|
-
var Underline = _styledComponents["default"].div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["\n left: 0;\n bottom: 0;\n width: 100%;\n position: absolute;\n height: ", ";\n background-color: ", ";\n
|
|
398
|
+
var Underline = _styledComponents["default"].div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["\n left: 0;\n bottom: 0;\n width: 100%;\n position: absolute;\n height: ", ";\n background-color: ", ";\n"])), function (props) {
|
|
399
399
|
return props.theme.dividerThickness;
|
|
400
400
|
}, function (props) {
|
|
401
401
|
return props.theme.dividerColor;
|
|
@@ -441,7 +441,7 @@ var ScrollIndicator = _styledComponents["default"].button(_templateObject4 || (_
|
|
|
441
441
|
return props.theme.unselectedFontColor;
|
|
442
442
|
});
|
|
443
443
|
|
|
444
|
-
var ActiveIndicator = _styledComponents["default"].span(_templateObject5 || (_templateObject5 = (0, _taggedTemplateLiteral2["default"])(["\n left: ", ";\n width: ", ";\n
|
|
444
|
+
var ActiveIndicator = _styledComponents["default"].span(_templateObject5 || (_templateObject5 = (0, _taggedTemplateLiteral2["default"])(["\n left: ", ";\n width: ", ";\n background-color: ", ";\n bottom: 0;\n height: ", ";\n position: absolute;\n &[aria-disabled=\"true\"] {\n background-color: ", ";\n display: none;\n }\n"])), function (props) {
|
|
445
445
|
return "".concat(props.tabLeft, "px");
|
|
446
446
|
}, function (props) {
|
|
447
447
|
return "".concat(props.tabWidth, "px");
|
|
@@ -453,7 +453,7 @@ var ActiveIndicator = _styledComponents["default"].span(_templateObject5 || (_te
|
|
|
453
453
|
return props.theme.disabledFontColor;
|
|
454
454
|
});
|
|
455
455
|
|
|
456
|
-
var TabsContent = _styledComponents["default"].div(_templateObject6 || (_templateObject6 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n
|
|
456
|
+
var TabsContent = _styledComponents["default"].div(_templateObject6 || (_templateObject6 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n flex: 1 1 auto;\n display: inline-block;\n position: relative;\n white-space: nowrap;\n overflow-x: scroll;\n ::-webkit-scrollbar {\n display: none;\n }\n"])));
|
|
457
457
|
|
|
458
458
|
var TabList = _styledComponents["default"].div(_templateObject7 || (_templateObject7 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n min-height: ", "px;\n"])), function (props) {
|
|
459
459
|
return props.minHeightTabs;
|
package/tabs/Tabs.stories.tsx
CHANGED
package/tabs-nav/Tab.js
CHANGED
|
@@ -60,8 +60,8 @@ var DxcTab = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, _ref2) {
|
|
|
60
60
|
var _tabRef$current2;
|
|
61
61
|
|
|
62
62
|
switch (event.key) {
|
|
63
|
+
case " ":
|
|
63
64
|
case "Enter":
|
|
64
|
-
case "Space":
|
|
65
65
|
tabRef === null || tabRef === void 0 ? void 0 : (_tabRef$current2 = tabRef.current) === null || _tabRef$current2 === void 0 ? void 0 : _tabRef$current2.click();
|
|
66
66
|
event.preventDefault();
|
|
67
67
|
break;
|