@dxc-technology/halstack-react 0.0.0-9bd9511 → 0.0.0-9c20370
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/BackgroundColorContext.d.ts +3 -3
- package/BackgroundColorContext.js +12 -2
- package/HalstackContext.d.ts +1330 -7
- package/HalstackContext.js +84 -67
- package/accordion/Accordion.d.ts +1 -1
- package/accordion/Accordion.js +74 -55
- package/accordion/Accordion.stories.tsx +3 -101
- package/accordion/Accordion.test.js +34 -19
- package/accordion/types.d.ts +4 -16
- package/accordion-group/AccordionGroup.d.ts +4 -3
- package/accordion-group/AccordionGroup.js +49 -42
- package/accordion-group/AccordionGroup.stories.tsx +77 -76
- package/accordion-group/AccordionGroup.test.js +62 -54
- package/accordion-group/AccordionGroupAccordion.d.ts +4 -0
- package/accordion-group/AccordionGroupAccordion.js +43 -0
- package/accordion-group/types.d.ts +6 -18
- package/alert/Alert.js +47 -20
- package/alert/Alert.test.js +46 -29
- package/alert/types.d.ts +3 -3
- package/badge/Badge.js +14 -2
- package/badge/types.d.ts +1 -1
- package/bleed/Bleed.js +21 -13
- package/bleed/Bleed.stories.tsx +1 -0
- package/bleed/types.d.ts +2 -2
- package/box/Box.d.ts +1 -1
- package/box/Box.js +33 -33
- package/box/Box.stories.tsx +25 -53
- package/box/Box.test.js +7 -2
- package/box/types.d.ts +3 -15
- package/bulleted-list/BulletedList.js +36 -9
- package/bulleted-list/BulletedList.stories.tsx +7 -1
- package/bulleted-list/types.d.ts +32 -5
- package/button/Button.d.ts +1 -1
- package/button/Button.js +83 -71
- package/button/Button.stories.tsx +4 -4
- package/button/Button.test.js +28 -8
- package/button/types.d.ts +8 -4
- package/card/Card.d.ts +1 -1
- package/card/Card.js +67 -62
- package/card/Card.stories.tsx +12 -42
- package/card/Card.test.js +22 -11
- package/card/types.d.ts +4 -10
- package/checkbox/Checkbox.js +71 -27
- package/checkbox/Checkbox.test.js +60 -33
- package/checkbox/types.d.ts +4 -4
- package/chip/Chip.js +51 -48
- package/chip/Chip.stories.tsx +25 -17
- package/chip/Chip.test.js +29 -17
- package/chip/types.d.ts +4 -4
- package/common/OpenSans.css +68 -80
- package/common/coreTokens.d.ts +146 -0
- package/common/coreTokens.js +167 -0
- package/common/utils.d.ts +1 -0
- package/common/utils.js +8 -3
- package/common/variables.d.ts +226 -175
- package/common/variables.js +956 -1133
- package/date-input/Calendar.js +55 -12
- package/date-input/DateInput.js +82 -35
- package/date-input/DateInput.test.js +351 -164
- package/date-input/DatePicker.js +38 -8
- package/date-input/Icons.js +12 -0
- package/date-input/YearPicker.js +30 -5
- package/date-input/types.d.ts +7 -7
- package/dialog/Dialog.d.ts +1 -1
- package/dialog/Dialog.js +83 -86
- package/dialog/Dialog.stories.tsx +127 -221
- package/dialog/Dialog.test.js +331 -18
- package/dialog/types.d.ts +1 -14
- package/dropdown/Dropdown.js +86 -32
- package/dropdown/Dropdown.test.js +211 -104
- package/dropdown/DropdownMenu.js +22 -8
- package/dropdown/DropdownMenuItem.js +15 -6
- package/dropdown/types.d.ts +8 -8
- package/file-input/FileInput.js +218 -134
- package/file-input/FileInput.test.js +343 -331
- package/file-input/FileItem.js +39 -12
- package/file-input/types.d.ts +10 -10
- package/flex/Flex.js +39 -25
- package/flex/Flex.stories.tsx +35 -26
- package/flex/types.d.ts +74 -9
- package/footer/Footer.d.ts +1 -1
- package/footer/Footer.js +80 -68
- package/footer/Footer.stories.tsx +12 -89
- package/footer/Footer.test.js +47 -40
- package/footer/Icons.js +4 -0
- package/footer/types.d.ts +15 -17
- package/grid/Grid.d.ts +7 -0
- package/grid/Grid.js +91 -0
- package/grid/Grid.stories.tsx +219 -0
- package/grid/types.d.ts +115 -0
- package/header/Header.d.ts +4 -3
- package/header/Header.js +72 -55
- package/header/Header.stories.tsx +7 -71
- package/header/Header.test.js +26 -13
- package/header/Icons.js +4 -0
- package/header/types.d.ts +2 -16
- package/heading/Heading.js +28 -7
- package/heading/Heading.test.js +88 -71
- package/heading/types.d.ts +3 -3
- package/inset/Inset.js +21 -13
- package/inset/Inset.stories.tsx +2 -1
- package/inset/types.d.ts +2 -2
- package/layout/ApplicationLayout.d.ts +5 -5
- package/layout/ApplicationLayout.js +57 -15
- package/layout/Icons.js +10 -0
- package/layout/SidenavContext.d.ts +1 -1
- package/layout/SidenavContext.js +4 -0
- package/layout/types.d.ts +5 -6
- package/link/Link.js +41 -21
- package/link/Link.test.js +42 -26
- package/link/types.d.ts +4 -4
- package/main.d.ts +2 -1
- package/main.js +55 -0
- package/nav-tabs/NavTabs.d.ts +2 -2
- package/nav-tabs/NavTabs.js +43 -16
- package/nav-tabs/NavTabs.stories.tsx +14 -0
- package/nav-tabs/NavTabs.test.js +44 -37
- package/nav-tabs/Tab.js +71 -45
- package/nav-tabs/types.d.ts +10 -11
- package/number-input/NumberInput.js +30 -20
- package/number-input/NumberInput.test.js +249 -113
- package/number-input/NumberInputContext.js +5 -0
- package/number-input/numberInputContextTypes.d.ts +1 -1
- package/number-input/types.d.ts +4 -4
- package/package.json +7 -7
- package/paginator/Icons.js +10 -0
- package/paginator/Paginator.js +39 -17
- package/paginator/Paginator.test.js +156 -104
- package/paginator/types.d.ts +1 -1
- package/paragraph/Paragraph.d.ts +3 -4
- package/paragraph/Paragraph.js +18 -8
- package/password-input/PasswordInput.js +51 -22
- package/password-input/PasswordInput.test.js +94 -51
- package/password-input/types.d.ts +4 -4
- package/progress-bar/ProgressBar.d.ts +2 -2
- package/progress-bar/ProgressBar.js +39 -14
- package/progress-bar/ProgressBar.test.js +53 -36
- package/progress-bar/types.d.ts +4 -3
- package/quick-nav/QuickNav.js +24 -2
- package/quick-nav/types.d.ts +2 -2
- package/radio-group/Radio.js +53 -22
- package/radio-group/RadioGroup.js +84 -41
- package/radio-group/RadioGroup.test.js +288 -186
- package/radio-group/types.d.ts +4 -4
- package/resultsetTable/Icons.js +3 -0
- package/resultsetTable/ResultsetTable.js +56 -21
- package/resultsetTable/ResultsetTable.test.js +75 -42
- package/resultsetTable/types.d.ts +5 -5
- package/select/Icons.js +3 -0
- package/select/Listbox.js +35 -10
- package/select/Option.js +24 -8
- package/select/Select.js +143 -56
- package/select/Select.test.js +839 -456
- package/select/types.d.ts +12 -12
- package/sidenav/Icons.d.ts +7 -0
- package/sidenav/Icons.js +51 -0
- package/sidenav/Sidenav.d.ts +2 -2
- package/sidenav/Sidenav.js +116 -104
- package/sidenav/Sidenav.stories.tsx +60 -60
- package/sidenav/Sidenav.test.js +10 -3
- package/sidenav/types.d.ts +26 -23
- package/slider/Slider.js +84 -38
- package/slider/Slider.test.js +104 -76
- package/slider/types.d.ts +4 -4
- package/spinner/Spinner.js +51 -28
- package/spinner/Spinner.stories.jsx +28 -28
- package/spinner/Spinner.test.js +35 -26
- package/spinner/types.d.ts +3 -3
- package/switch/Switch.js +66 -24
- package/switch/Switch.test.js +97 -52
- package/switch/types.d.ts +4 -4
- package/table/Table.js +22 -4
- package/table/Table.test.js +7 -2
- package/table/types.d.ts +3 -3
- package/tabs/Tab.js +39 -22
- package/tabs/Tabs.js +131 -62
- package/tabs/Tabs.test.js +122 -67
- package/tabs/types.d.ts +8 -8
- package/tag/Tag.js +54 -27
- package/tag/Tag.test.js +31 -20
- package/tag/types.d.ts +7 -7
- package/text-input/Icons.js +3 -0
- package/text-input/Suggestion.js +24 -8
- package/text-input/Suggestions.js +36 -11
- package/text-input/TextInput.js +144 -59
- package/text-input/TextInput.stories.tsx +1 -1
- package/text-input/TextInput.test.js +858 -539
- package/text-input/types.d.ts +9 -9
- package/textarea/Textarea.js +73 -38
- package/textarea/Textarea.test.js +173 -98
- package/textarea/types.d.ts +4 -4
- package/toggle-group/ToggleGroup.d.ts +2 -2
- package/toggle-group/ToggleGroup.js +59 -21
- package/toggle-group/ToggleGroup.test.js +72 -40
- package/toggle-group/types.d.ts +11 -11
- package/typography/Typography.d.ts +2 -2
- package/typography/Typography.js +23 -110
- package/typography/Typography.stories.tsx +1 -1
- package/typography/types.d.ts +1 -1
- package/useTheme.d.ts +1234 -1
- package/useTheme.js +6 -0
- package/useTranslatedLabels.d.ts +84 -2
- package/useTranslatedLabels.js +5 -0
- package/utils/BaseTypography.d.ts +21 -0
- package/utils/BaseTypography.js +108 -0
- package/utils/FocusLock.d.ts +13 -0
- package/utils/FocusLock.js +138 -0
- package/wizard/Wizard.js +47 -13
- package/wizard/Wizard.test.js +81 -54
- package/wizard/types.d.ts +7 -8
- package/card/ice-cream.jpg +0 -0
- package/translatedLabelsType.d.ts +0 -82
- /package/{translatedLabelsType.js → grid/types.js} +0 -0
|
@@ -176,6 +176,20 @@ export const Chromatic = () => (
|
|
|
176
176
|
</DxcNavTabs.Tab>
|
|
177
177
|
</DxcNavTabs>
|
|
178
178
|
</ExampleContainer>
|
|
179
|
+
<ExampleContainer>
|
|
180
|
+
<Title title="With long label and left icon alignment" theme="light" level={4} />
|
|
181
|
+
<DxcNavTabs iconPosition="left">
|
|
182
|
+
<DxcNavTabs.Tab href="#" active>
|
|
183
|
+
Lorem ipsum dolor sit amet, consectetur adipiscing elit
|
|
184
|
+
</DxcNavTabs.Tab>
|
|
185
|
+
<DxcNavTabs.Tab href="#" icon={iconSVG} disabled notificationNumber={3}>
|
|
186
|
+
Tab 2
|
|
187
|
+
</DxcNavTabs.Tab>
|
|
188
|
+
<DxcNavTabs.Tab href="#" icon={iconSVG}>
|
|
189
|
+
Tab 3
|
|
190
|
+
</DxcNavTabs.Tab>
|
|
191
|
+
</DxcNavTabs>
|
|
192
|
+
</ExampleContainer>
|
|
179
193
|
<Title title="Opinionated theme" theme="light" level={2} />
|
|
180
194
|
<ExampleContainer>
|
|
181
195
|
<Title title="Only label" theme="light" level={4} />
|
package/nav-tabs/NavTabs.test.js
CHANGED
|
@@ -1,23 +1,28 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
4
5
|
var _react = _interopRequireDefault(require("react"));
|
|
6
|
+
|
|
5
7
|
var _react2 = require("@testing-library/react");
|
|
6
|
-
|
|
8
|
+
|
|
9
|
+
var _NavTabs = _interopRequireDefault(require("./NavTabs.tsx"));
|
|
10
|
+
|
|
7
11
|
describe("Tabs component tests", function () {
|
|
8
12
|
test("Tabs render with correct labels and attributes", function () {
|
|
9
13
|
var _render = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_NavTabs["default"], null, /*#__PURE__*/_react["default"].createElement(_NavTabs["default"].Tab, {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
14
|
+
href: "/test1",
|
|
15
|
+
active: true
|
|
16
|
+
}, "Tab 1"), /*#__PURE__*/_react["default"].createElement(_NavTabs["default"].Tab, {
|
|
17
|
+
href: "/test2",
|
|
18
|
+
disabled: true
|
|
19
|
+
}, "Tab 2"), /*#__PURE__*/_react["default"].createElement(_NavTabs["default"].Tab, {
|
|
20
|
+
href: "/test3"
|
|
21
|
+
}, "Tab 3"))),
|
|
22
|
+
getByText = _render.getByText,
|
|
23
|
+
getAllByRole = _render.getAllByRole,
|
|
24
|
+
getByRole = _render.getByRole;
|
|
25
|
+
|
|
21
26
|
expect(getByRole("tablist")).toBeTruthy();
|
|
22
27
|
expect(getByRole("tablist").getAttribute("aria-label")).toBe("Navigation tabs");
|
|
23
28
|
expect(getByText("Tab 1")).toBeTruthy();
|
|
@@ -36,20 +41,21 @@ describe("Tabs component tests", function () {
|
|
|
36
41
|
});
|
|
37
42
|
test("Tabs render with correct labels, badges and icons", function () {
|
|
38
43
|
var _render2 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_NavTabs["default"], null, /*#__PURE__*/_react["default"].createElement(_NavTabs["default"].Tab, {
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
44
|
+
href: "/test1",
|
|
45
|
+
active: true,
|
|
46
|
+
notificationNumber: 10
|
|
47
|
+
}, "Tab 1"), /*#__PURE__*/_react["default"].createElement(_NavTabs["default"].Tab, {
|
|
48
|
+
href: "/test2",
|
|
49
|
+
disabled: true,
|
|
50
|
+
notificationNumber: 20
|
|
51
|
+
}, "Tab 2"), /*#__PURE__*/_react["default"].createElement(_NavTabs["default"].Tab, {
|
|
52
|
+
href: "/test3",
|
|
53
|
+
notificationNumber: 1000,
|
|
54
|
+
icon: "/testIcon.png"
|
|
55
|
+
}, "Tab 3"))),
|
|
56
|
+
getByText = _render2.getByText,
|
|
57
|
+
getByRole = _render2.getByRole;
|
|
58
|
+
|
|
53
59
|
expect(getByText("10")).toBeTruthy();
|
|
54
60
|
expect(getByText("20")).toBeTruthy();
|
|
55
61
|
expect(getByText("+99")).toBeTruthy();
|
|
@@ -57,17 +63,18 @@ describe("Tabs component tests", function () {
|
|
|
57
63
|
});
|
|
58
64
|
test("Tabs render with correct tab index", function () {
|
|
59
65
|
var _render3 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_NavTabs["default"], {
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
66
|
+
tabIndex: 3
|
|
67
|
+
}, /*#__PURE__*/_react["default"].createElement(_NavTabs["default"].Tab, {
|
|
68
|
+
href: "/test1"
|
|
69
|
+
}, "Tab 1"), /*#__PURE__*/_react["default"].createElement(_NavTabs["default"].Tab, {
|
|
70
|
+
href: "/test2",
|
|
71
|
+
disabled: true
|
|
72
|
+
}, "Tab 2"), /*#__PURE__*/_react["default"].createElement(_NavTabs["default"].Tab, {
|
|
73
|
+
href: "/test3",
|
|
74
|
+
active: true
|
|
75
|
+
}, "Tab 3"))),
|
|
76
|
+
getAllByRole = _render3.getAllByRole;
|
|
77
|
+
|
|
71
78
|
var tabs = getAllByRole("link");
|
|
72
79
|
expect(tabs[0].getAttribute("tabindex")).toBe("-1");
|
|
73
80
|
expect(tabs[1].getAttribute("tabindex")).toBe("3");
|
package/nav-tabs/Tab.js
CHANGED
|
@@ -1,72 +1,95 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
4
5
|
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
6
|
+
|
|
5
7
|
Object.defineProperty(exports, "__esModule", {
|
|
6
8
|
value: true
|
|
7
9
|
});
|
|
8
10
|
exports["default"] = void 0;
|
|
11
|
+
|
|
9
12
|
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
|
|
13
|
+
|
|
10
14
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
15
|
+
|
|
11
16
|
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
17
|
+
|
|
12
18
|
var _react = _interopRequireWildcard(require("react"));
|
|
19
|
+
|
|
13
20
|
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
21
|
+
|
|
14
22
|
var _Badge = _interopRequireDefault(require("../badge/Badge"));
|
|
23
|
+
|
|
24
|
+
var _Flex = _interopRequireDefault(require("../flex/Flex"));
|
|
25
|
+
|
|
15
26
|
var _NavTabs = require("./NavTabs");
|
|
16
|
-
|
|
27
|
+
|
|
28
|
+
var _BaseTypography = _interopRequireDefault(require("../utils/BaseTypography"));
|
|
29
|
+
|
|
17
30
|
var _useTheme = _interopRequireDefault(require("../useTheme"));
|
|
18
|
-
|
|
31
|
+
|
|
32
|
+
var _templateObject, _templateObject2, _templateObject3;
|
|
33
|
+
|
|
19
34
|
var _excluded = ["href", "active", "icon", "disabled", "notificationNumber", "children"];
|
|
35
|
+
|
|
20
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
|
+
|
|
21
38
|
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; }
|
|
39
|
+
|
|
22
40
|
var DxcTab = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, _ref2) {
|
|
23
41
|
var href = _ref.href,
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
var tabRef =
|
|
34
|
-
var _useContext = (0, _react.useContext)(_NavTabs.NavTabsContext),
|
|
35
|
-
iconPosition = _useContext.iconPosition,
|
|
36
|
-
tabIndex = _useContext.tabIndex,
|
|
37
|
-
hasIcons = _useContext.hasIcons,
|
|
38
|
-
focusedLabel = _useContext.focusedLabel;
|
|
42
|
+
_ref$active = _ref.active,
|
|
43
|
+
active = _ref$active === void 0 ? false : _ref$active,
|
|
44
|
+
icon = _ref.icon,
|
|
45
|
+
_ref$disabled = _ref.disabled,
|
|
46
|
+
disabled = _ref$disabled === void 0 ? false : _ref$disabled,
|
|
47
|
+
_ref$notificationNumb = _ref.notificationNumber,
|
|
48
|
+
notificationNumber = _ref$notificationNumb === void 0 ? false : _ref$notificationNumb,
|
|
49
|
+
children = _ref.children,
|
|
50
|
+
otherProps = (0, _objectWithoutProperties2["default"])(_ref, _excluded);
|
|
51
|
+
var tabRef = (0, _react.useRef)();
|
|
39
52
|
var colorsTheme = (0, _useTheme["default"])();
|
|
40
|
-
|
|
53
|
+
|
|
54
|
+
var _useContext = (0, _react.useContext)(_NavTabs.NavTabsContext),
|
|
55
|
+
iconPosition = _useContext.iconPosition,
|
|
56
|
+
tabIndex = _useContext.tabIndex,
|
|
57
|
+
focusedLabel = _useContext.focusedLabel;
|
|
58
|
+
|
|
59
|
+
(0, _react.useEffect)(function () {
|
|
41
60
|
var _tabRef$current;
|
|
61
|
+
|
|
42
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());
|
|
43
63
|
}, [focusedLabel]);
|
|
64
|
+
|
|
44
65
|
var handleOnKeyDown = function handleOnKeyDown(event) {
|
|
45
66
|
var _tabRef$current2;
|
|
67
|
+
|
|
46
68
|
switch (event.key) {
|
|
47
69
|
case " ":
|
|
48
70
|
case "Enter":
|
|
49
|
-
tabRef === null || tabRef === void 0 ? void 0 : (_tabRef$current2 = tabRef.current) === null || _tabRef$current2 === void 0 ? void 0 : _tabRef$current2.click();
|
|
50
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();
|
|
51
73
|
break;
|
|
52
74
|
}
|
|
53
75
|
};
|
|
76
|
+
|
|
54
77
|
return /*#__PURE__*/_react["default"].createElement(TabContainer, {
|
|
55
78
|
active: active,
|
|
56
79
|
role: "tab",
|
|
57
80
|
"aria-selected": active,
|
|
58
81
|
"aria-disabled": disabled
|
|
59
82
|
}, /*#__PURE__*/_react["default"].createElement(Tab, (0, _extends2["default"])({
|
|
60
|
-
href: !disabled
|
|
83
|
+
href: !disabled ? href : undefined,
|
|
61
84
|
disabled: disabled,
|
|
85
|
+
active: active,
|
|
62
86
|
iconPosition: iconPosition,
|
|
63
|
-
hasIcon:
|
|
87
|
+
hasIcon: icon != null ? true : false,
|
|
64
88
|
ref: function ref(anchorRef) {
|
|
65
89
|
tabRef.current = anchorRef;
|
|
90
|
+
|
|
66
91
|
if (_ref2) {
|
|
67
|
-
if (typeof _ref2 === "function") _ref2(anchorRef);else
|
|
68
|
-
_ref2.current = anchorRef;
|
|
69
|
-
}
|
|
92
|
+
if (typeof _ref2 === "function") _ref2(anchorRef);else _ref2.current = anchorRef;
|
|
70
93
|
}
|
|
71
94
|
},
|
|
72
95
|
onKeyDown: handleOnKeyDown,
|
|
@@ -75,21 +98,25 @@ var DxcTab = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, _ref2) {
|
|
|
75
98
|
iconPosition: iconPosition
|
|
76
99
|
}, typeof icon === "string" ? /*#__PURE__*/_react["default"].createElement("img", {
|
|
77
100
|
src: icon
|
|
78
|
-
}) : icon), /*#__PURE__*/_react["default"].createElement(
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
101
|
+
}) : icon), /*#__PURE__*/_react["default"].createElement(_Flex["default"], {
|
|
102
|
+
alignItems: "center",
|
|
103
|
+
gap: "0.5rem"
|
|
104
|
+
}, /*#__PURE__*/_react["default"].createElement(_BaseTypography["default"], {
|
|
105
|
+
color: disabled ? colorsTheme.navTabs.disabledFontColor : active ? colorsTheme.navTabs.selectedFontColor : colorsTheme.navTabs.unselectedFontColor,
|
|
106
|
+
fontFamily: colorsTheme.navTabs.fontFamily,
|
|
107
|
+
fontSize: colorsTheme.navTabs.fontSize,
|
|
108
|
+
fontStyle: colorsTheme.navTabs.fontStyle,
|
|
109
|
+
fontWeight: colorsTheme.navTabs.fontWeight,
|
|
84
110
|
textAlign: "center",
|
|
85
111
|
letterSpacing: "0.025em",
|
|
86
112
|
lineHeight: "1.715em"
|
|
87
|
-
}, children), notificationNumber && /*#__PURE__*/_react["default"].createElement(
|
|
88
|
-
notificationText: notificationNumber > 99 ? "+99" : notificationNumber,
|
|
113
|
+
}, children), notificationNumber && /*#__PURE__*/_react["default"].createElement(_Badge["default"], {
|
|
114
|
+
notificationText: typeof notificationNumber === "number" && notificationNumber > 99 ? "+99" : notificationNumber,
|
|
89
115
|
disabled: disabled
|
|
90
|
-
}))))
|
|
116
|
+
}))));
|
|
91
117
|
});
|
|
92
|
-
|
|
118
|
+
|
|
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) {
|
|
93
120
|
return props.active ? props.theme.selectedUnderlineColor : props.theme.dividerColor;
|
|
94
121
|
}, function (props) {
|
|
95
122
|
return props.theme.unselectedIconColor;
|
|
@@ -98,23 +125,22 @@ var TabContainer = _styledComponents["default"].div(_templateObject || (_templat
|
|
|
98
125
|
}, function (props) {
|
|
99
126
|
return props.theme.disabledIconColor;
|
|
100
127
|
});
|
|
101
|
-
|
|
128
|
+
|
|
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) {
|
|
102
130
|
return props.hasIcon && props.iconPosition === "top" ? "column" : "row";
|
|
103
131
|
}, function (props) {
|
|
104
|
-
return props.
|
|
132
|
+
return props.hasIcon && props.iconPosition === "top" ? "0.375rem" : "0.625rem";
|
|
105
133
|
}, function (props) {
|
|
106
|
-
return props.
|
|
134
|
+
return props.hasIcon && props.iconPosition === "top" ? "78px" : "100%";
|
|
107
135
|
}, function (props) {
|
|
108
|
-
return props.
|
|
136
|
+
return props.active ? props.theme.selectedBackgroundColor : props.theme.unselectedBackgroundColor;
|
|
109
137
|
}, function (props) {
|
|
110
|
-
return
|
|
111
|
-
});
|
|
112
|
-
var TabIconContainer = _styledComponents["default"].div(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n margin-bottom: ", ";\n margin-right: ", ";\n\n img,\n svg {\n height: 24px;\n width: 24px;\n }\n"])), function (props) {
|
|
113
|
-
return props.iconPosition === "top" && "0.375rem";
|
|
138
|
+
return props.disabled ? "not-allowed" : "pointer";
|
|
114
139
|
}, function (props) {
|
|
115
|
-
return props.
|
|
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 ");
|
|
116
141
|
});
|
|
117
|
-
|
|
118
|
-
var
|
|
142
|
+
|
|
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"])));
|
|
144
|
+
|
|
119
145
|
var _default = DxcTab;
|
|
120
146
|
exports["default"] = _default;
|
package/nav-tabs/types.d.ts
CHANGED
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
type SVG = React.ReactNode & React.SVGProps<SVGSVGElement>;
|
|
3
|
-
export type
|
|
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
|
+
};
|
|
8
|
+
export declare type TabProps = {
|
|
4
9
|
/**
|
|
5
10
|
* Whether the tab is active or not.
|
|
6
11
|
*/
|
|
@@ -26,11 +31,11 @@ export 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 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;
|
|
@@ -1,38 +1,46 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
4
5
|
Object.defineProperty(exports, "__esModule", {
|
|
5
6
|
value: true
|
|
6
7
|
});
|
|
7
8
|
exports["default"] = void 0;
|
|
9
|
+
|
|
8
10
|
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
|
|
11
|
+
|
|
9
12
|
var _react = _interopRequireDefault(require("react"));
|
|
13
|
+
|
|
10
14
|
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
15
|
+
|
|
11
16
|
var _TextInput = _interopRequireDefault(require("../text-input/TextInput"));
|
|
17
|
+
|
|
12
18
|
var _NumberInputContext = _interopRequireDefault(require("./NumberInputContext"));
|
|
19
|
+
|
|
13
20
|
var _templateObject;
|
|
21
|
+
|
|
14
22
|
var DxcNumberInput = /*#__PURE__*/_react["default"].forwardRef(function (_ref, ref) {
|
|
15
23
|
var label = _ref.label,
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
24
|
+
name = _ref.name,
|
|
25
|
+
defaultValue = _ref.defaultValue,
|
|
26
|
+
value = _ref.value,
|
|
27
|
+
helperText = _ref.helperText,
|
|
28
|
+
placeholder = _ref.placeholder,
|
|
29
|
+
disabled = _ref.disabled,
|
|
30
|
+
optional = _ref.optional,
|
|
31
|
+
prefix = _ref.prefix,
|
|
32
|
+
suffix = _ref.suffix,
|
|
33
|
+
min = _ref.min,
|
|
34
|
+
max = _ref.max,
|
|
35
|
+
_ref$step = _ref.step,
|
|
36
|
+
step = _ref$step === void 0 ? 1 : _ref$step,
|
|
37
|
+
onChange = _ref.onChange,
|
|
38
|
+
onBlur = _ref.onBlur,
|
|
39
|
+
error = _ref.error,
|
|
40
|
+
autocomplete = _ref.autocomplete,
|
|
41
|
+
margin = _ref.margin,
|
|
42
|
+
size = _ref.size,
|
|
43
|
+
tabIndex = _ref.tabIndex;
|
|
36
44
|
return /*#__PURE__*/_react["default"].createElement(_NumberInputContext["default"].Provider, {
|
|
37
45
|
value: {
|
|
38
46
|
typeNumber: "number",
|
|
@@ -61,6 +69,8 @@ var DxcNumberInput = /*#__PURE__*/_react["default"].forwardRef(function (_ref, r
|
|
|
61
69
|
ref: ref
|
|
62
70
|
})));
|
|
63
71
|
});
|
|
72
|
+
|
|
64
73
|
var NumberInputContainer = _styledComponents["default"].div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["\n // Chrome, Safari, Edge, Opera\n input::-webkit-outer-spin-button,\n input::-webkit-inner-spin-button {\n -webkit-appearance: none;\n margin: 0;\n }\n\n // Firefox\n input[type=\"number\"] {\n -moz-appearance: textfield;\n }\n"])));
|
|
74
|
+
|
|
65
75
|
var _default = DxcNumberInput;
|
|
66
76
|
exports["default"] = _default;
|