@dxc-technology/halstack-react 9.1.0 → 10.0.0
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.d.ts +3 -6
- package/HalstackContext.js +1 -1
- package/accordion/Accordion.d.ts +1 -1
- package/accordion/Accordion.js +2 -14
- package/accordion/Accordion.stories.tsx +2 -100
- package/accordion/types.d.ts +0 -12
- package/accordion-group/AccordionGroup.d.ts +4 -3
- package/accordion-group/AccordionGroup.js +21 -42
- package/accordion-group/AccordionGroup.stories.tsx +77 -76
- package/accordion-group/AccordionGroup.test.js +6 -16
- package/accordion-group/AccordionGroupAccordion.d.ts +4 -0
- package/accordion-group/AccordionGroupAccordion.js +43 -0
- package/accordion-group/types.d.ts +0 -12
- package/alert/Alert.js +1 -3
- package/box/Box.d.ts +1 -1
- package/box/Box.js +5 -22
- package/box/Box.stories.tsx +25 -53
- package/box/types.d.ts +0 -12
- package/bulleted-list/BulletedList.js +4 -2
- package/bulleted-list/BulletedList.stories.tsx +7 -1
- package/bulleted-list/types.d.ts +31 -4
- package/button/Button.d.ts +1 -1
- package/button/Button.js +45 -54
- package/button/Button.stories.tsx +3 -3
- package/button/Button.test.js +11 -0
- package/button/types.d.ts +4 -0
- package/card/Card.d.ts +1 -1
- package/card/Card.js +18 -35
- package/card/Card.stories.tsx +0 -29
- package/card/types.d.ts +1 -7
- package/chip/Chip.js +23 -36
- package/chip/Chip.stories.tsx +25 -17
- package/common/OpenSans.css +68 -80
- package/common/coreTokens.d.ts +146 -0
- package/common/coreTokens.js +167 -0
- package/common/variables.d.ts +1 -144
- package/common/variables.js +952 -1095
- package/date-input/Calendar.js +2 -2
- package/dialog/Dialog.d.ts +1 -1
- package/dialog/Dialog.js +4 -22
- package/dialog/Dialog.stories.tsx +52 -176
- package/dialog/types.d.ts +0 -13
- package/dropdown/DropdownMenu.js +5 -1
- package/file-input/FileItem.js +2 -2
- package/file-input/types.d.ts +1 -1
- package/flex/Flex.js +4 -2
- package/flex/Flex.stories.tsx +24 -10
- package/flex/types.d.ts +70 -5
- package/footer/Footer.d.ts +1 -1
- package/footer/Footer.js +43 -61
- package/footer/Footer.stories.tsx +12 -89
- package/footer/Footer.test.js +3 -1
- package/footer/types.d.ts +10 -12
- package/grid/Grid.d.ts +1 -1
- package/grid/Grid.js +1 -1
- package/grid/Grid.stories.tsx +38 -38
- package/header/Header.d.ts +1 -1
- package/header/Header.js +3 -30
- package/header/Header.stories.tsx +7 -71
- package/header/types.d.ts +0 -14
- package/inset/Inset.stories.tsx +1 -1
- package/layout/ApplicationLayout.d.ts +2 -2
- package/layout/ApplicationLayout.js +7 -4
- package/link/Link.js +1 -1
- package/nav-tabs/NavTabs.d.ts +2 -2
- package/nav-tabs/NavTabs.js +7 -10
- package/nav-tabs/NavTabs.stories.tsx +14 -0
- package/nav-tabs/Tab.js +22 -26
- package/nav-tabs/types.d.ts +8 -9
- package/package.json +1 -1
- package/paginator/Paginator.js +1 -1
- package/paginator/Paginator.test.js +13 -0
- package/radio-group/Radio.js +10 -10
- package/radio-group/RadioGroup.js +8 -10
- package/sidenav/Sidenav.js +21 -23
- package/text-input/TextInput.js +1 -1
- package/text-input/TextInput.stories.tsx +1 -1
- package/toggle-group/ToggleGroup.d.ts +2 -2
- package/useTheme.d.ts +1 -1
- package/utils/FocusLock.js +2 -3
- package/card/ice-cream.jpg +0 -0
package/nav-tabs/Tab.js
CHANGED
|
@@ -21,13 +21,15 @@ var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
|
21
21
|
|
|
22
22
|
var _Badge = _interopRequireDefault(require("../badge/Badge"));
|
|
23
23
|
|
|
24
|
+
var _Flex = _interopRequireDefault(require("../flex/Flex"));
|
|
25
|
+
|
|
24
26
|
var _NavTabs = require("./NavTabs");
|
|
25
27
|
|
|
26
28
|
var _BaseTypography = _interopRequireDefault(require("../utils/BaseTypography"));
|
|
27
29
|
|
|
28
30
|
var _useTheme = _interopRequireDefault(require("../useTheme"));
|
|
29
31
|
|
|
30
|
-
var _templateObject, _templateObject2, _templateObject3
|
|
32
|
+
var _templateObject, _templateObject2, _templateObject3;
|
|
31
33
|
|
|
32
34
|
var _excluded = ["href", "active", "icon", "disabled", "notificationNumber", "children"];
|
|
33
35
|
|
|
@@ -46,16 +48,15 @@ var DxcTab = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, _ref2) {
|
|
|
46
48
|
notificationNumber = _ref$notificationNumb === void 0 ? false : _ref$notificationNumb,
|
|
47
49
|
children = _ref.children,
|
|
48
50
|
otherProps = (0, _objectWithoutProperties2["default"])(_ref, _excluded);
|
|
49
|
-
var tabRef =
|
|
51
|
+
var tabRef = (0, _react.useRef)();
|
|
52
|
+
var colorsTheme = (0, _useTheme["default"])();
|
|
50
53
|
|
|
51
54
|
var _useContext = (0, _react.useContext)(_NavTabs.NavTabsContext),
|
|
52
55
|
iconPosition = _useContext.iconPosition,
|
|
53
56
|
tabIndex = _useContext.tabIndex,
|
|
54
|
-
hasIcons = _useContext.hasIcons,
|
|
55
57
|
focusedLabel = _useContext.focusedLabel;
|
|
56
58
|
|
|
57
|
-
|
|
58
|
-
(0, _react.useLayoutEffect)(function () {
|
|
59
|
+
(0, _react.useEffect)(function () {
|
|
59
60
|
var _tabRef$current;
|
|
60
61
|
|
|
61
62
|
focusedLabel === children.toString() && (tabRef === null || tabRef === void 0 ? void 0 : (_tabRef$current = tabRef.current) === null || _tabRef$current === void 0 ? void 0 : _tabRef$current.focus());
|
|
@@ -67,8 +68,8 @@ var DxcTab = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, _ref2) {
|
|
|
67
68
|
switch (event.key) {
|
|
68
69
|
case " ":
|
|
69
70
|
case "Enter":
|
|
70
|
-
tabRef === null || tabRef === void 0 ? void 0 : (_tabRef$current2 = tabRef.current) === null || _tabRef$current2 === void 0 ? void 0 : _tabRef$current2.click();
|
|
71
71
|
event.preventDefault();
|
|
72
|
+
tabRef === null || tabRef === void 0 ? void 0 : (_tabRef$current2 = tabRef.current) === null || _tabRef$current2 === void 0 ? void 0 : _tabRef$current2.click();
|
|
72
73
|
break;
|
|
73
74
|
}
|
|
74
75
|
};
|
|
@@ -79,18 +80,16 @@ var DxcTab = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, _ref2) {
|
|
|
79
80
|
"aria-selected": active,
|
|
80
81
|
"aria-disabled": disabled
|
|
81
82
|
}, /*#__PURE__*/_react["default"].createElement(Tab, (0, _extends2["default"])({
|
|
82
|
-
href: !disabled
|
|
83
|
+
href: !disabled ? href : undefined,
|
|
83
84
|
disabled: disabled,
|
|
84
85
|
active: active,
|
|
85
86
|
iconPosition: iconPosition,
|
|
86
|
-
hasIcon:
|
|
87
|
+
hasIcon: icon != null ? true : false,
|
|
87
88
|
ref: function ref(anchorRef) {
|
|
88
89
|
tabRef.current = anchorRef;
|
|
89
90
|
|
|
90
91
|
if (_ref2) {
|
|
91
|
-
if (typeof _ref2 === "function") _ref2(anchorRef);else
|
|
92
|
-
_ref2.current = anchorRef;
|
|
93
|
-
}
|
|
92
|
+
if (typeof _ref2 === "function") _ref2(anchorRef);else _ref2.current = anchorRef;
|
|
94
93
|
}
|
|
95
94
|
},
|
|
96
95
|
onKeyDown: handleOnKeyDown,
|
|
@@ -99,7 +98,10 @@ var DxcTab = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, _ref2) {
|
|
|
99
98
|
iconPosition: iconPosition
|
|
100
99
|
}, typeof icon === "string" ? /*#__PURE__*/_react["default"].createElement("img", {
|
|
101
100
|
src: icon
|
|
102
|
-
}) : icon), /*#__PURE__*/_react["default"].createElement(
|
|
101
|
+
}) : icon), /*#__PURE__*/_react["default"].createElement(_Flex["default"], {
|
|
102
|
+
alignItems: "center",
|
|
103
|
+
gap: "0.5rem"
|
|
104
|
+
}, /*#__PURE__*/_react["default"].createElement(_BaseTypography["default"], {
|
|
103
105
|
color: disabled ? colorsTheme.navTabs.disabledFontColor : active ? colorsTheme.navTabs.selectedFontColor : colorsTheme.navTabs.unselectedFontColor,
|
|
104
106
|
fontFamily: colorsTheme.navTabs.fontFamily,
|
|
105
107
|
fontSize: colorsTheme.navTabs.fontSize,
|
|
@@ -108,13 +110,13 @@ var DxcTab = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, _ref2) {
|
|
|
108
110
|
textAlign: "center",
|
|
109
111
|
letterSpacing: "0.025em",
|
|
110
112
|
lineHeight: "1.715em"
|
|
111
|
-
}, children), notificationNumber && /*#__PURE__*/_react["default"].createElement(
|
|
113
|
+
}, children), notificationNumber && /*#__PURE__*/_react["default"].createElement(_Badge["default"], {
|
|
112
114
|
notificationText: typeof notificationNumber === "number" && notificationNumber > 99 ? "+99" : notificationNumber,
|
|
113
115
|
disabled: disabled
|
|
114
|
-
}))))
|
|
116
|
+
}))));
|
|
115
117
|
});
|
|
116
118
|
|
|
117
|
-
var TabContainer = _styledComponents["default"].div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["\n border-bottom: 2px solid ", ";\n svg {\n color: ", ";\n }\n
|
|
119
|
+
var TabContainer = _styledComponents["default"].div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["\n align-items: stretch;\n border-bottom: 2px solid ", ";\n padding: 0.5rem;\n\n svg {\n color: ", ";\n }\n &[aria-selected=\"true\"] {\n svg {\n color: ", ";\n }\n }\n &[aria-disabled=\"true\"] {\n svg {\n color: ", ";\n }\n }\n"])), function (props) {
|
|
118
120
|
return props.active ? props.theme.selectedUnderlineColor : props.theme.dividerColor;
|
|
119
121
|
}, function (props) {
|
|
120
122
|
return props.theme.unselectedIconColor;
|
|
@@ -124,10 +126,12 @@ var TabContainer = _styledComponents["default"].div(_templateObject || (_templat
|
|
|
124
126
|
return props.theme.disabledIconColor;
|
|
125
127
|
});
|
|
126
128
|
|
|
127
|
-
var Tab = _styledComponents["default"].a(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n flex-direction: ", ";\n justify-content: center;\n align-items: center;\n height: ", ";\n min-width:
|
|
129
|
+
var Tab = _styledComponents["default"].a(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2["default"])(["\n box-sizing: border-box;\n display: flex;\n flex-direction: ", ";\n justify-content: center;\n align-items: center;\n gap: ", ";\n height: ", ";\n min-width: 176px;\n min-height: 44px;\n padding: 0.375rem;\n border-radius: 4px;\n background: ", ";\n text-decoration-color: transparent;\n cursor: ", ";\n\n ", "\n"])), function (props) {
|
|
128
130
|
return props.hasIcon && props.iconPosition === "top" ? "column" : "row";
|
|
129
131
|
}, function (props) {
|
|
130
|
-
return props.hasIcon && props.iconPosition === "top" ? "
|
|
132
|
+
return props.hasIcon && props.iconPosition === "top" ? "0.375rem" : "0.625rem";
|
|
133
|
+
}, function (props) {
|
|
134
|
+
return props.hasIcon && props.iconPosition === "top" ? "78px" : "100%";
|
|
131
135
|
}, function (props) {
|
|
132
136
|
return props.active ? props.theme.selectedBackgroundColor : props.theme.unselectedBackgroundColor;
|
|
133
137
|
}, function (props) {
|
|
@@ -136,15 +140,7 @@ var Tab = _styledComponents["default"].a(_templateObject2 || (_templateObject2 =
|
|
|
136
140
|
return !props.disabled && "\n :hover {\n background: ".concat(props.theme.hoverBackgroundColor, ";\n }\n :focus {\n outline: 2px solid ").concat(props.theme.focusOutline, ";\n }\n :active {\n background: ").concat(props.theme.pressedBackgroundColor, ";\n outline: 2px solid #33aaff};\n }\n ");
|
|
137
141
|
});
|
|
138
142
|
|
|
139
|
-
var TabIconContainer = _styledComponents["default"].div(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n
|
|
140
|
-
return props.iconPosition === "top" && "0.375rem";
|
|
141
|
-
}, function (props) {
|
|
142
|
-
return props.iconPosition === "left" && "0.625rem";
|
|
143
|
-
});
|
|
144
|
-
|
|
145
|
-
var LabelContainer = _styledComponents["default"].div(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n align-items: center;\n"])));
|
|
146
|
-
|
|
147
|
-
var BadgeContainer = _styledComponents["default"].div(_templateObject5 || (_templateObject5 = (0, _taggedTemplateLiteral2["default"])(["\n margin-left: 0.5rem;\n"])));
|
|
143
|
+
var TabIconContainer = _styledComponents["default"].div(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n\n img,\n svg {\n height: 24px;\n width: 24px;\n }\n"])));
|
|
148
144
|
|
|
149
145
|
var _default = DxcTab;
|
|
150
146
|
exports["default"] = _default;
|
package/nav-tabs/types.d.ts
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
declare type SVG = React.ReactNode & React.SVGProps<SVGSVGElement>;
|
|
3
|
+
export declare type NavTabsContextProps = {
|
|
4
|
+
iconPosition: "top" | "left";
|
|
5
|
+
tabIndex: number;
|
|
6
|
+
focusedLabel: string;
|
|
7
|
+
};
|
|
3
8
|
export declare type TabProps = {
|
|
4
9
|
/**
|
|
5
10
|
* Whether the tab is active or not.
|
|
@@ -26,11 +31,11 @@ export declare type TabProps = {
|
|
|
26
31
|
*/
|
|
27
32
|
notificationNumber?: boolean | number;
|
|
28
33
|
/**
|
|
29
|
-
*
|
|
34
|
+
* Contains one or more DxcNavTabs.Tab.
|
|
30
35
|
*/
|
|
31
36
|
children: string;
|
|
32
37
|
};
|
|
33
|
-
|
|
38
|
+
declare type Props = {
|
|
34
39
|
/**
|
|
35
40
|
* Whether the icon should appear above or to the left of the label.
|
|
36
41
|
*/
|
|
@@ -44,10 +49,4 @@ export declare type NavTabsProps = {
|
|
|
44
49
|
*/
|
|
45
50
|
children: React.ReactNode;
|
|
46
51
|
};
|
|
47
|
-
export
|
|
48
|
-
iconPosition: "top" | "left";
|
|
49
|
-
tabIndex: number;
|
|
50
|
-
hasIcons: boolean;
|
|
51
|
-
focusedLabel: string;
|
|
52
|
-
};
|
|
53
|
-
export {};
|
|
52
|
+
export default Props;
|
package/package.json
CHANGED
package/paginator/Paginator.js
CHANGED
|
@@ -46,7 +46,7 @@ var DxcPaginator = function DxcPaginator(_ref) {
|
|
|
46
46
|
itemsPerPageFunction = _ref.itemsPerPageFunction,
|
|
47
47
|
_ref$tabIndex = _ref.tabIndex,
|
|
48
48
|
tabIndex = _ref$tabIndex === void 0 ? 0 : _ref$tabIndex;
|
|
49
|
-
var totalPages = Math.ceil(totalItems / itemsPerPage);
|
|
49
|
+
var totalPages = itemsPerPage > 0 && Math.ceil(totalItems / itemsPerPage);
|
|
50
50
|
var currentPageInternal = currentPage === -1 ? totalPages : currentPage;
|
|
51
51
|
var minItemsPerPage = currentPageInternal === 1 || currentPageInternal === 0 ? currentPageInternal : (currentPageInternal - 1) * itemsPerPage + 1;
|
|
52
52
|
var maxItemsPerPage = minItemsPerPage - 1 + itemsPerPage > totalItems ? totalItems : minItemsPerPage - 1 + itemsPerPage;
|
|
@@ -302,4 +302,17 @@ describe("Paginator component tests", function () {
|
|
|
302
302
|
expect(nextButton.hasAttribute("disabled")).toBeFalsy();
|
|
303
303
|
expect(lastButton.hasAttribute("disabled")).toBeFalsy();
|
|
304
304
|
});
|
|
305
|
+
test("itemsPerPage is 0 and showGoToPage is true", function () {
|
|
306
|
+
var _render16 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Paginator["default"], {
|
|
307
|
+
itemsPerPage: 0,
|
|
308
|
+
itemsPerPageOptions: [5, 10, 15],
|
|
309
|
+
totalItems: 27,
|
|
310
|
+
showGoToPage: true
|
|
311
|
+
})),
|
|
312
|
+
getByText = _render16.getByText,
|
|
313
|
+
getAllByRole = _render16.getAllByRole;
|
|
314
|
+
|
|
315
|
+
expect(getByText("Items per page:")).toBeTruthy();
|
|
316
|
+
expect(getAllByRole("combobox")).toBeTruthy();
|
|
317
|
+
});
|
|
305
318
|
});
|
package/radio-group/Radio.js
CHANGED
|
@@ -21,7 +21,9 @@ var _uuid = require("uuid");
|
|
|
21
21
|
|
|
22
22
|
var _useTheme = _interopRequireDefault(require("../useTheme"));
|
|
23
23
|
|
|
24
|
-
var
|
|
24
|
+
var _Flex = _interopRequireDefault(require("../flex/Flex"));
|
|
25
|
+
|
|
26
|
+
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5;
|
|
25
27
|
|
|
26
28
|
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); }
|
|
27
29
|
|
|
@@ -56,7 +58,7 @@ var DxcRadio = function DxcRadio(_ref) {
|
|
|
56
58
|
firstUpdate = _useState4[0],
|
|
57
59
|
setFirstUpdate = _useState4[1];
|
|
58
60
|
|
|
59
|
-
(0, _react.
|
|
61
|
+
(0, _react.useEffect)(function () {
|
|
60
62
|
var _ref$current2;
|
|
61
63
|
|
|
62
64
|
// Don't apply in the first render
|
|
@@ -69,7 +71,7 @@ var DxcRadio = function DxcRadio(_ref) {
|
|
|
69
71
|
}, [focused]);
|
|
70
72
|
return /*#__PURE__*/_react["default"].createElement(_styledComponents.ThemeProvider, {
|
|
71
73
|
theme: colorsTheme.radioGroup
|
|
72
|
-
}, /*#__PURE__*/_react["default"].createElement(
|
|
74
|
+
}, /*#__PURE__*/_react["default"].createElement(_Flex["default"], null, /*#__PURE__*/_react["default"].createElement(RadioContainer, {
|
|
73
75
|
error: error,
|
|
74
76
|
disabled: disabled,
|
|
75
77
|
readonly: readonly,
|
|
@@ -107,11 +109,9 @@ var getRadioInputStateColor = function getRadioInputStateColor(props, state) {
|
|
|
107
109
|
}
|
|
108
110
|
};
|
|
109
111
|
|
|
110
|
-
var
|
|
111
|
-
|
|
112
|
-
var RadioInputContainer = _styledComponents["default"].span(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n align-items: center;\n justify-content: center;\n height: 24px;\n width: 24px;\n"])));
|
|
112
|
+
var RadioInputContainer = _styledComponents["default"].span(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n align-items: center;\n justify-content: center;\n height: 24px;\n width: 24px;\n"])));
|
|
113
113
|
|
|
114
|
-
var RadioInput = _styledComponents["default"].span(
|
|
114
|
+
var RadioInput = _styledComponents["default"].span(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2["default"])(["\n box-sizing: border-box;\n display: flex;\n align-items: center;\n justify-content: center;\n width: 18px;\n height: 18px;\n border: 2px solid ", ";\n border-radius: 50%;\n\n &:focus {\n outline: 2px solid ", ";\n outline-offset: 1px;\n }\n ", "\n"])), function (props) {
|
|
115
115
|
return getRadioInputStateColor(props, "enabled");
|
|
116
116
|
}, function (props) {
|
|
117
117
|
return props.theme.focusBorderColor;
|
|
@@ -119,11 +119,11 @@ var RadioInput = _styledComponents["default"].span(_templateObject3 || (_templat
|
|
|
119
119
|
return props.disabled && "pointer-events: none;";
|
|
120
120
|
});
|
|
121
121
|
|
|
122
|
-
var Dot = _styledComponents["default"].span(
|
|
122
|
+
var Dot = _styledComponents["default"].span(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2["default"])(["\n height: 10px;\n width: 10px;\n border-radius: 50%;\n background-color: ", ";\n"])), function (props) {
|
|
123
123
|
return getRadioInputStateColor(props, "enabled");
|
|
124
124
|
});
|
|
125
125
|
|
|
126
|
-
var Label = _styledComponents["default"].span(
|
|
126
|
+
var Label = _styledComponents["default"].span(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2["default"])(["\n margin-left: ", ";\n font-family: ", ";\n font-size: ", ";\n font-style: ", ";\n font-weight: ", ";\n line-height: ", ";\n ", "\n"])), function (props) {
|
|
127
127
|
return props.theme.radioInputLabelMargin;
|
|
128
128
|
}, function (props) {
|
|
129
129
|
return props.theme.fontFamily;
|
|
@@ -139,7 +139,7 @@ var Label = _styledComponents["default"].span(_templateObject5 || (_templateObje
|
|
|
139
139
|
return props.disabled ? "color: ".concat(props.theme.disabledRadioInputLabelFontColor, ";") : "color: ".concat(props.theme.radioInputLabelFontColor);
|
|
140
140
|
});
|
|
141
141
|
|
|
142
|
-
var RadioContainer = _styledComponents["default"].span(
|
|
142
|
+
var RadioContainer = _styledComponents["default"].span(_templateObject5 || (_templateObject5 = (0, _taggedTemplateLiteral2["default"])(["\n display: inline-flex;\n align-items: center;\n cursor: ", ";\n\n &:hover {\n ", " {\n border-color: ", ";\n }\n ", " {\n background-color: ", ";\n }\n }\n &:active {\n ", " {\n border-color: ", ";\n }\n ", " {\n background-color: ", ";\n }\n }\n"])), function (props) {
|
|
143
143
|
return props.disabled ? "not-allowed" : props.readonly ? "default" : "pointer";
|
|
144
144
|
}, RadioInput, function (props) {
|
|
145
145
|
return !props.disabled && getRadioInputStateColor(props, "hover");
|
|
@@ -83,14 +83,13 @@ var DxcRadioGroup = /*#__PURE__*/_react["default"].forwardRef(function (_ref, re
|
|
|
83
83
|
|
|
84
84
|
var colorsTheme = (0, _useTheme["default"])();
|
|
85
85
|
var translatedLabels = (0, _useTranslatedLabels["default"])();
|
|
86
|
-
var optionalItem = {
|
|
87
|
-
label: optionalItemLabel || translatedLabels.radioGroup.optionalItemLabelDefault,
|
|
88
|
-
value: "",
|
|
89
|
-
disabled: disabled
|
|
90
|
-
};
|
|
91
86
|
var innerOptions = (0, _react.useMemo)(function () {
|
|
92
|
-
return optional ? [].concat((0, _toConsumableArray2["default"])(options), [
|
|
93
|
-
|
|
87
|
+
return optional ? [].concat((0, _toConsumableArray2["default"])(options), [{
|
|
88
|
+
label: optionalItemLabel !== null && optionalItemLabel !== void 0 ? optionalItemLabel : translatedLabels.radioGroup.optionalItemLabelDefault,
|
|
89
|
+
value: "",
|
|
90
|
+
disabled: disabled
|
|
91
|
+
}]) : options;
|
|
92
|
+
}, [optional, options, optionalItemLabel, translatedLabels]);
|
|
94
93
|
|
|
95
94
|
var _useState7 = (0, _react.useState)(getInitialFocusIndex(innerOptions, value !== null && value !== void 0 ? value : innerValue)),
|
|
96
95
|
_useState8 = (0, _slicedToArray2["default"])(_useState7, 2),
|
|
@@ -202,8 +201,7 @@ var DxcRadioGroup = /*#__PURE__*/_react["default"].forwardRef(function (_ref, re
|
|
|
202
201
|
name: name,
|
|
203
202
|
disabled: disabled,
|
|
204
203
|
value: (_ref2 = value !== null && value !== void 0 ? value : innerValue) !== null && _ref2 !== void 0 ? _ref2 : "",
|
|
205
|
-
readOnly: true
|
|
206
|
-
"aria-hidden": "true"
|
|
204
|
+
readOnly: true
|
|
207
205
|
}), innerOptions.map(function (option, index) {
|
|
208
206
|
return /*#__PURE__*/_react["default"].createElement(_Radio["default"], {
|
|
209
207
|
key: "radio-".concat(index),
|
|
@@ -225,7 +223,7 @@ var DxcRadioGroup = /*#__PURE__*/_react["default"].forwardRef(function (_ref, re
|
|
|
225
223
|
}, error)));
|
|
226
224
|
});
|
|
227
225
|
|
|
228
|
-
var RadioGroupContainer = _styledComponents["default"].div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["\n display: inline-flex;\n flex-direction: column;\n
|
|
226
|
+
var RadioGroupContainer = _styledComponents["default"].div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["\n box-sizing: border-box;\n display: inline-flex;\n flex-direction: column;\n"])));
|
|
229
227
|
|
|
230
228
|
var Label = _styledComponents["default"].span(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2["default"])(["\n color: ", ";\n font-family: ", ";\n font-size: ", ";\n font-style: ", ";\n font-weight: ", ";\n line-height: ", ";\n ", "\n"])), function (props) {
|
|
231
229
|
return props.disabled ? props.theme.disabledLabelFontColor : props.theme.labelFontColor;
|
package/sidenav/Sidenav.js
CHANGED
|
@@ -54,9 +54,7 @@ var DxcSidenav = function DxcSidenav(_ref) {
|
|
|
54
54
|
}, title, /*#__PURE__*/_react["default"].createElement(_Flex["default"], {
|
|
55
55
|
direction: "column",
|
|
56
56
|
gap: "1rem"
|
|
57
|
-
},
|
|
58
|
-
return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, child, index !== _react["default"].Children.count(children) - 1 && /*#__PURE__*/_react["default"].createElement(Divider, null));
|
|
59
|
-
})))));
|
|
57
|
+
}, children))));
|
|
60
58
|
};
|
|
61
59
|
|
|
62
60
|
var Title = function Title(_ref2) {
|
|
@@ -68,11 +66,11 @@ var Title = function Title(_ref2) {
|
|
|
68
66
|
|
|
69
67
|
var Section = function Section(_ref3) {
|
|
70
68
|
var children = _ref3.children;
|
|
71
|
-
return /*#__PURE__*/_react["default"].createElement(_Bleed["default"], {
|
|
69
|
+
return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement(_Bleed["default"], {
|
|
72
70
|
horizontal: "1rem"
|
|
73
71
|
}, /*#__PURE__*/_react["default"].createElement(_Flex["default"], {
|
|
74
72
|
direction: "column"
|
|
75
|
-
}, children));
|
|
73
|
+
}, children)), /*#__PURE__*/_react["default"].createElement(Divider, null));
|
|
76
74
|
};
|
|
77
75
|
|
|
78
76
|
var GroupContext = /*#__PURE__*/_react["default"].createContext(null);
|
|
@@ -152,15 +150,15 @@ var Link = /*#__PURE__*/(0, _react.forwardRef)(function (_ref5, ref) {
|
|
|
152
150
|
}) : icon, children), newWindow && _Icons["default"].externalLinkIcon);
|
|
153
151
|
});
|
|
154
152
|
|
|
155
|
-
var SidenavContainer = _styledComponents["default"].div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["\n box-sizing: border-box;\n display: flex;\n flex-direction: column;\n
|
|
153
|
+
var SidenavContainer = _styledComponents["default"].div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["\n box-sizing: border-box;\n display: flex;\n flex-direction: column;\n width: 280px;\n @media (max-width: ", "rem) {\n width: 100vw;\n }\n padding: 2rem 1rem;\n background-color: ", ";\n\n overflow-y: auto;\n overflow-x: hidden;\n ::-webkit-scrollbar {\n width: 2px;\n }\n ::-webkit-scrollbar-track {\n background-color: ", ";\n border-radius: 3px;\n }\n ::-webkit-scrollbar-thumb {\n background-color: ", ";\n border-radius: 3px;\n }\n"])), _variables.responsiveSizes.medium, function (props) {
|
|
156
154
|
return props.theme.backgroundColor;
|
|
157
|
-
},
|
|
155
|
+
}, function (props) {
|
|
158
156
|
return props.theme.scrollBarTrackColor;
|
|
159
157
|
}, function (props) {
|
|
160
158
|
return props.theme.scrollBarThumbColor;
|
|
161
159
|
});
|
|
162
160
|
|
|
163
|
-
var SidenavTitle = _styledComponents["default"].div(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n align-items: center;\n padding: 0.5rem 1.2rem;\n font-family: ", ";\n font-style: ", ";\n font-weight: ", ";\n font-size: ", ";\n color: ", ";\n
|
|
161
|
+
var SidenavTitle = _styledComponents["default"].div(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n align-items: center;\n padding: 0.5rem 1.2rem;\n font-family: ", ";\n font-style: ", ";\n font-weight: ", ";\n font-size: ", ";\n color: ", ";\n letter-spacing: ", ";\n text-transform: ", ";\n"])), function (props) {
|
|
164
162
|
return props.theme.titleFontFamily;
|
|
165
163
|
}, function (props) {
|
|
166
164
|
return props.theme.titleFontStyle;
|
|
@@ -170,15 +168,15 @@ var SidenavTitle = _styledComponents["default"].div(_templateObject2 || (_templa
|
|
|
170
168
|
return props.theme.titleFontSize;
|
|
171
169
|
}, function (props) {
|
|
172
170
|
return props.theme.titleFontColor;
|
|
173
|
-
}, function (props) {
|
|
174
|
-
return props.theme.titleFontTextTransform;
|
|
175
171
|
}, function (props) {
|
|
176
172
|
return props.theme.titleFontLetterSpacing;
|
|
173
|
+
}, function (props) {
|
|
174
|
+
return props.theme.titleFontTextTransform;
|
|
177
175
|
});
|
|
178
176
|
|
|
179
|
-
var Divider = _styledComponents["default"].div(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2["default"])(["\n width: 100%;\n height: 1px;\n background-color: #999999;\n"])));
|
|
177
|
+
var Divider = _styledComponents["default"].div(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2["default"])(["\n width: 100%;\n height: 1px;\n background-color: #999999;\n\n &:last-child {\n display: none;\n }\n"])));
|
|
180
178
|
|
|
181
|
-
var SidenavGroup = _styledComponents["default"].div(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2["default"])(["\n
|
|
179
|
+
var SidenavGroup = _styledComponents["default"].div(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2["default"])(["\n a {\n padding: 0.5rem 1.2rem 0.5rem 2.25rem;\n }\n"])));
|
|
182
180
|
|
|
183
181
|
var SidenavGroupTitle = _styledComponents["default"].span(_templateObject5 || (_templateObject5 = (0, _taggedTemplateLiteral2["default"])(["\n box-sizing: border-box;\n display: flex;\n align-items: center;\n gap: 0.5rem;\n padding: 0.5rem 1.2rem;\n font-family: ", ";\n font-style: ", ";\n font-weight: ", ";\n font-size: ", ";\n\n img,\n svg {\n height: 16px;\n width: 16px;\n }\n"])), function (props) {
|
|
184
182
|
return props.theme.groupTitleFontFamily;
|
|
@@ -190,7 +188,7 @@ var SidenavGroupTitle = _styledComponents["default"].span(_templateObject5 || (_
|
|
|
190
188
|
return props.theme.groupTitleFontSize;
|
|
191
189
|
});
|
|
192
190
|
|
|
193
|
-
var SidenavGroupTitleButton = _styledComponents["default"].button(_templateObject6 || (_templateObject6 = (0, _taggedTemplateLiteral2["default"])(["\n all: unset;\n box-sizing: border-box;\n display: flex;\n align-items: center;\n justify-content: space-between;\n width: 100%;\n padding: 0.5rem 1.2rem;\n font-family: ", ";\n font-style: ", ";\n font-weight: ", ";\n font-size: ", ";\n cursor: pointer;\n\n ", "\n\n &:focus, &:focus-visible {\n outline: 2px solid ", ";\n outline-offset: -2px;\n }\n &:hover {\n ", "\n }\n &:active {\n
|
|
191
|
+
var SidenavGroupTitleButton = _styledComponents["default"].button(_templateObject6 || (_templateObject6 = (0, _taggedTemplateLiteral2["default"])(["\n all: unset;\n box-sizing: border-box;\n display: flex;\n align-items: center;\n justify-content: space-between;\n width: 100%;\n padding: 0.5rem 1.2rem;\n font-family: ", ";\n font-style: ", ";\n font-weight: ", ";\n font-size: ", ";\n cursor: pointer;\n\n ", "\n\n &:focus, &:focus-visible {\n outline: 2px solid ", ";\n outline-offset: -2px;\n }\n &:hover {\n ", "\n }\n &:active {\n color: #fff;\n background-color: ", ";\n }\n\n img,\n svg {\n height: 16px;\n width: 16px;\n }\n"])), function (props) {
|
|
194
192
|
return props.theme.groupTitleFontFamily;
|
|
195
193
|
}, function (props) {
|
|
196
194
|
return props.theme.groupTitleFontStyle;
|
|
@@ -205,18 +203,10 @@ var SidenavGroupTitleButton = _styledComponents["default"].button(_templateObjec
|
|
|
205
203
|
}, function (props) {
|
|
206
204
|
return props.selectedGroup ? "color: ".concat(props.theme.groupTitleSelectedHoverFontColor, "; background-color: ").concat(props.theme.groupTitleSelectedHoverBackgroundColor, ";") : "color: ".concat(props.theme.groupTitleFontColor, "; background-color: ").concat(props.theme.groupTitleHoverBackgroundColor, ";");
|
|
207
205
|
}, function (props) {
|
|
208
|
-
return props.theme.groupTitleActiveBackgroundColor;
|
|
209
|
-
}, function (props) {
|
|
210
|
-
return props.theme.groupTitleFontColor;
|
|
206
|
+
return props.selectedGroup ? "#333" : props.theme.groupTitleActiveBackgroundColor;
|
|
211
207
|
});
|
|
212
208
|
|
|
213
|
-
var SidenavLink = _styledComponents["default"].a(_templateObject7 || (_templateObject7 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n align-items: center;\n justify-content: space-between;\n gap: 0.5rem;\n padding: 0.5rem 1.2rem;\n box-shadow: 0 0 0 2px transparent;\n
|
|
214
|
-
return props.theme.linkFontLetterSpacing;
|
|
215
|
-
}, function (props) {
|
|
216
|
-
return props.theme.linkFontTextTransform;
|
|
217
|
-
}, function (props) {
|
|
218
|
-
return props.theme.linkTextDecoration;
|
|
219
|
-
}, function (props) {
|
|
209
|
+
var SidenavLink = _styledComponents["default"].a(_templateObject7 || (_templateObject7 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n align-items: center;\n justify-content: space-between;\n gap: 0.5rem;\n padding: 0.5rem 1.2rem;\n box-shadow: 0 0 0 2px transparent;\n font-family: ", ";\n font-style: ", ";\n font-weight: ", ";\n font-size: ", ";\n letter-spacing: ", ";\n text-transform: ", ";\n text-decoration: ", ";\n cursor: pointer;\n\n ", "\n\n &:focus, &:focus-visible {\n outline: 2px solid ", ";\n outline-offset: -2px;\n }\n &:hover {\n ", "\n }\n &:active {\n color: #fff;\n background-color: ", ";\n outline: 2px solid #0095ff;\n outline-offset: -2px;\n }\n\n img,\n svg {\n height: 16px;\n width: 16px;\n }\n"])), function (props) {
|
|
220
210
|
return props.theme.linkFontFamily;
|
|
221
211
|
}, function (props) {
|
|
222
212
|
return props.theme.linkFontStyle;
|
|
@@ -224,12 +214,20 @@ var SidenavLink = _styledComponents["default"].a(_templateObject7 || (_templateO
|
|
|
224
214
|
return props.theme.linkFontWeight;
|
|
225
215
|
}, function (props) {
|
|
226
216
|
return props.theme.linkFontSize;
|
|
217
|
+
}, function (props) {
|
|
218
|
+
return props.theme.linkFontLetterSpacing;
|
|
219
|
+
}, function (props) {
|
|
220
|
+
return props.theme.linkFontTextTransform;
|
|
221
|
+
}, function (props) {
|
|
222
|
+
return props.theme.linkTextDecoration;
|
|
227
223
|
}, function (props) {
|
|
228
224
|
return props.selected ? "color: ".concat(props.theme.linkSelectedFontColor, "; background-color: ").concat(props.theme.linkSelectedBackgroundColor, ";") : "color: ".concat(props.theme.linkFontColor, "; background-color: transparent;");
|
|
229
225
|
}, function (props) {
|
|
230
226
|
return props.theme.linkFocusColor;
|
|
231
227
|
}, function (props) {
|
|
232
228
|
return props.selected ? "color: ".concat(props.theme.linkSelectedHoverFontColor, "; background-color: ").concat(props.theme.linkSelectedHoverBackgroundColor, ";") : "color: ".concat(props.theme.linkFontColor, "; background-color: ").concat(props.theme.linkHoverBackgroundColor, ";");
|
|
229
|
+
}, function (props) {
|
|
230
|
+
return props.selected ? "#333" : "#4d4d4d";
|
|
233
231
|
});
|
|
234
232
|
|
|
235
233
|
DxcSidenav.Section = Section;
|
package/text-input/TextInput.js
CHANGED
|
@@ -642,7 +642,7 @@ var Action = _styledComponents["default"].button(_templateObject7 || (_templateO
|
|
|
642
642
|
}, function (props) {
|
|
643
643
|
return props.disabled ? props.backgroundType === "dark" ? props.theme.disabledActionIconColorOnDark : props.theme.disabledActionIconColor : props.backgroundType === "dark" ? props.theme.actionIconColorOnDark : props.theme.actionIconColor;
|
|
644
644
|
}, function (props) {
|
|
645
|
-
return !props.disabled && "\n &:focus
|
|
645
|
+
return !props.disabled && "\n &:focus, \n &:focus-visible {\n outline: none;\n box-shadow: 0 0 0 2px ".concat(props.backgroundType === "dark" ? props.theme.focusActionBorderColorOnDark : props.theme.focusActionBorderColor, ";\n color: ").concat(props.backgroundType === "dark" ? props.theme.focusActionIconColorOnDark : props.theme.focusActionIconColor, ";\n }\n &:hover {\n background-color: ").concat(props.backgroundType === "dark" ? props.theme.hoverActionBackgroundColorOnDark : props.theme.hoverActionBackgroundColor, ";\n color: ").concat(props.backgroundType === "dark" ? props.theme.hoverActionIconColorOnDark : props.theme.hoverActionIconColor, ";\n }\n &:active {\n background-color: ").concat(props.backgroundType === "dark" ? props.theme.activeActionBackgroundColorOnDark : props.theme.activeActionBackgroundColor, ";\n color: ").concat(props.backgroundType === "dark" ? props.theme.activeActionIconColorOnDark : props.theme.activeActionIconColor, ";\n }\n ");
|
|
646
646
|
});
|
|
647
647
|
|
|
648
648
|
var Prefix = _styledComponents["default"].span(_templateObject8 || (_templateObject8 = (0, _taggedTemplateLiteral2["default"])(["\n height: 1.5rem;\n line-height: 1.5rem;\n margin-left: 0.25rem;\n padding: 0 0.5rem 0 0;\n ", ";\n font-family: ", ";\n font-size: 1rem;\n pointer-events: none;\n"])), function (props) {
|
|
@@ -522,7 +522,7 @@ const DarkAutosuggestListbox = () => {
|
|
|
522
522
|
<Title title="Dark theme" theme="dark" level={2} />
|
|
523
523
|
<ExampleContainer>
|
|
524
524
|
<Title title="Default with opened suggestions" theme="dark" level={3} />
|
|
525
|
-
<DxcFlex direction="column" gap="
|
|
525
|
+
<DxcFlex direction="column" gap="5rem">
|
|
526
526
|
<DxcTextInput label="Label" suggestions={countries} optional placeholder="Choose an option" />
|
|
527
527
|
<DxcCheckbox
|
|
528
528
|
label="You understand the selection and give your consent"
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import
|
|
3
|
-
declare const DxcToggleGroup: ({ label, helperText, defaultValue, value, onChange, disabled, options, margin, multiple, tabIndex, }:
|
|
2
|
+
import ToggleGroupPropsType from "./types";
|
|
3
|
+
declare const DxcToggleGroup: ({ label, helperText, defaultValue, value, onChange, disabled, options, margin, multiple, tabIndex, }: ToggleGroupPropsType) => JSX.Element;
|
|
4
4
|
export default DxcToggleGroup;
|
package/useTheme.d.ts
CHANGED
|
@@ -499,7 +499,7 @@ declare const useTheme: () => {
|
|
|
499
499
|
underlineSpacing: string;
|
|
500
500
|
underlineStyle: string;
|
|
501
501
|
underlineThickness: string;
|
|
502
|
-
|
|
502
|
+
disabledFontColor: string;
|
|
503
503
|
hoverFontColor: string;
|
|
504
504
|
hoverUnderlineColor: string;
|
|
505
505
|
visitedFontColor: string;
|
package/utils/FocusLock.js
CHANGED
|
@@ -18,11 +18,10 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
|
|
|
18
18
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
19
19
|
|
|
20
20
|
var not = {
|
|
21
|
-
inert: ":not([inert]):not([inert] *)",
|
|
22
21
|
negTabIndex: ':not([tabindex^="-"])',
|
|
23
22
|
disabled: ":not(:disabled)"
|
|
24
23
|
};
|
|
25
|
-
var focusableQuery = ["a[href]".concat(not.
|
|
24
|
+
var focusableQuery = ["a[href]".concat(not.negTabIndex), "area[href]".concat(not.negTabIndex), "input:not([type=\"hidden\"])".concat(not.negTabIndex).concat(not.disabled), "select".concat(not.negTabIndex).concat(not.disabled), "textarea".concat(not.negTabIndex).concat(not.disabled), "button".concat(not.negTabIndex).concat(not.disabled), "details > summary:first-of-type".concat(not.negTabIndex), "iframe".concat(not.negTabIndex), "audio[controls]".concat(not.negTabIndex), "video[controls]".concat(not.negTabIndex), "[contenteditable]".concat(not.negTabIndex), "[tabindex]".concat(not.negTabIndex).concat(not.disabled)].join(",");
|
|
26
25
|
|
|
27
26
|
var getFocusableElements = function getFocusableElements(container) {
|
|
28
27
|
return Array.prototype.slice.call(container.querySelectorAll(focusableQuery)).filter(function (element) {
|
|
@@ -44,7 +43,7 @@ var attempFocus = function attempFocus(element) {
|
|
|
44
43
|
};
|
|
45
44
|
/**
|
|
46
45
|
* @param element: HTMLElement
|
|
47
|
-
* @returns boolean: true if element is contained inside a Radix Portal, false otherwise.
|
|
46
|
+
* @returns boolean: true if element is contained inside a Radix Portal, false otherwise.
|
|
48
47
|
*/
|
|
49
48
|
|
|
50
49
|
|
package/card/ice-cream.jpg
DELETED
|
Binary file
|