@dxc-technology/halstack-react 0.0.0-3de3cec → 0.0.0-3def5d3
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.js +0 -1
- package/button/Button.stories.tsx +2 -2
- 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 +4 -4
- package/layout/ApplicationLayout.js +7 -4
- package/layout/types.d.ts +2 -3
- 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/Icons.d.ts +7 -0
- package/sidenav/Icons.js +51 -0
- package/sidenav/Sidenav.d.ts +2 -2
- package/sidenav/Sidenav.js +65 -93
- package/sidenav/Sidenav.stories.tsx +60 -60
- package/sidenav/types.d.ts +21 -18
- package/tabs/Tab.js +1 -2
- package/tabs/Tabs.js +10 -14
- package/text-input/TextInput.js +1 -1
- package/text-input/TextInput.stories.tsx +1 -1
- package/textarea/Textarea.js +0 -1
- package/textarea/Textarea.test.js +1 -3
- package/toggle-group/ToggleGroup.d.ts +2 -2
- package/useTheme.d.ts +1 -1
- package/utils/FocusLock.js +3 -4
- 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/Icons.js
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports["default"] = void 0;
|
|
9
|
+
|
|
10
|
+
var _react = _interopRequireDefault(require("react"));
|
|
11
|
+
|
|
12
|
+
var icons = {
|
|
13
|
+
collapsedIcon: /*#__PURE__*/_react["default"].createElement("svg", {
|
|
14
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
15
|
+
height: "24px",
|
|
16
|
+
viewBox: "0 0 24 24",
|
|
17
|
+
width: "24px",
|
|
18
|
+
fill: "currentColor"
|
|
19
|
+
}, /*#__PURE__*/_react["default"].createElement("path", {
|
|
20
|
+
d: "M0 0h24v24H0z",
|
|
21
|
+
fill: "none"
|
|
22
|
+
}), /*#__PURE__*/_react["default"].createElement("path", {
|
|
23
|
+
d: "M16.59 8.59L12 13.17 7.41 8.59 6 10l6 6 6-6z"
|
|
24
|
+
})),
|
|
25
|
+
collapsableIcon: /*#__PURE__*/_react["default"].createElement("svg", {
|
|
26
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
27
|
+
height: "24px",
|
|
28
|
+
viewBox: "0 0 24 24",
|
|
29
|
+
width: "24px",
|
|
30
|
+
fill: "currentColor"
|
|
31
|
+
}, /*#__PURE__*/_react["default"].createElement("path", {
|
|
32
|
+
d: "M0 0h24v24H0z",
|
|
33
|
+
fill: "none"
|
|
34
|
+
}), /*#__PURE__*/_react["default"].createElement("path", {
|
|
35
|
+
d: "M12 8l-6 6 1.41 1.41L12 10.83l4.59 4.58L18 14z"
|
|
36
|
+
})),
|
|
37
|
+
externalLinkIcon: /*#__PURE__*/_react["default"].createElement("svg", {
|
|
38
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
39
|
+
height: "24",
|
|
40
|
+
viewBox: "0 0 24 24",
|
|
41
|
+
width: "24",
|
|
42
|
+
fill: "currentColor"
|
|
43
|
+
}, /*#__PURE__*/_react["default"].createElement("path", {
|
|
44
|
+
d: "M0 0h24v24H0z",
|
|
45
|
+
fill: "none"
|
|
46
|
+
}), /*#__PURE__*/_react["default"].createElement("path", {
|
|
47
|
+
d: "M19 19H5V5h7V3H5c-1.11 0-2 .9-2 2v14c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2v-7h-2v7zM14 3v2h3.59l-9.83 9.83 1.41 1.41L19 6.41V10h2V3h-7z"
|
|
48
|
+
}))
|
|
49
|
+
};
|
|
50
|
+
var _default = icons;
|
|
51
|
+
exports["default"] = _default;
|
package/sidenav/Sidenav.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import SidenavPropsType, { SidenavGroupPropsType, SidenavLinkPropsType, SidenavSectionPropsType, SidenavTitlePropsType } from "./types.js";
|
|
3
3
|
declare const DxcSidenav: {
|
|
4
|
-
({
|
|
4
|
+
({ title, children }: SidenavPropsType): JSX.Element;
|
|
5
5
|
Section: ({ children }: SidenavSectionPropsType) => JSX.Element;
|
|
6
|
-
Group: ({
|
|
6
|
+
Group: ({ title, collapsable, icon, children }: SidenavGroupPropsType) => JSX.Element;
|
|
7
7
|
Link: React.ForwardRefExoticComponent<SidenavLinkPropsType & React.RefAttributes<HTMLAnchorElement>>;
|
|
8
8
|
Title: ({ children }: SidenavTitlePropsType) => JSX.Element;
|
|
9
9
|
};
|