@dxc-technology/halstack-react 0.0.0-4e1277a → 0.0.0-4e3dbad
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.js +1 -1
- package/HalstackContext.d.ts +42 -5
- package/HalstackContext.js +28 -18
- package/accordion/Accordion.accessibility.test.d.ts +1 -0
- package/accordion/Accordion.accessibility.test.js +71 -0
- package/accordion/Accordion.js +16 -30
- package/accordion/Accordion.stories.tsx +7 -49
- package/accordion/Accordion.test.d.ts +1 -0
- package/accordion/Accordion.test.js +3 -3
- package/accordion/types.d.ts +1 -1
- package/accordion-group/AccordionGroup.accessibility.test.d.ts +1 -0
- package/accordion-group/AccordionGroup.accessibility.test.js +82 -0
- package/accordion-group/AccordionGroup.js +1 -1
- package/accordion-group/AccordionGroup.stories.tsx +23 -23
- package/accordion-group/AccordionGroup.test.d.ts +1 -0
- package/accordion-group/AccordionGroup.test.js +5 -9
- package/accordion-group/AccordionGroupAccordion.js +1 -1
- package/accordion-group/types.d.ts +1 -1
- package/action-icon/ActionIcon.accessibility.test.d.ts +1 -0
- package/action-icon/ActionIcon.accessibility.test.js +63 -0
- package/action-icon/ActionIcon.js +4 -3
- package/action-icon/ActionIcon.stories.tsx +3 -3
- package/action-icon/ActionIcon.test.d.ts +1 -0
- package/action-icon/ActionIcon.test.js +1 -1
- package/action-icon/types.d.ts +1 -1
- package/alert/Alert.accessibility.test.d.ts +1 -0
- package/alert/Alert.accessibility.test.js +95 -0
- package/alert/Alert.js +21 -72
- package/alert/Alert.test.d.ts +1 -0
- package/alert/Alert.test.js +1 -1
- package/badge/Badge.accessibility.test.d.ts +1 -0
- package/badge/Badge.accessibility.test.js +129 -0
- package/badge/Badge.js +6 -4
- package/badge/Badge.stories.tsx +11 -11
- package/badge/Badge.test.d.ts +1 -0
- package/badge/Badge.test.js +2 -2
- package/badge/types.d.ts +1 -1
- package/bar-chart/BarChart.d.ts +4 -0
- package/bar-chart/BarChart.js +152 -0
- package/bar-chart/BarChart.stories.tsx +281 -0
- package/bar-chart/BarChart.test.d.ts +1 -0
- package/bar-chart/BarChart.test.js +194 -0
- package/bar-chart/theme.d.ts +3 -0
- package/bar-chart/theme.js +31 -0
- package/bar-chart/types.d.ts +118 -0
- package/bar-chart/types.js +5 -0
- package/bleed/Bleed.stories.tsx +0 -1
- package/box/Box.accessibility.test.d.ts +1 -0
- package/box/Box.accessibility.test.js +33 -0
- package/box/Box.js +1 -1
- package/box/Box.test.d.ts +1 -0
- package/box/Box.test.js +1 -1
- package/breadcrumbs/Breadcrumbs.accessibility.test.d.ts +1 -0
- package/breadcrumbs/Breadcrumbs.accessibility.test.js +96 -0
- package/breadcrumbs/Breadcrumbs.d.ts +4 -0
- package/breadcrumbs/Breadcrumbs.js +79 -0
- package/breadcrumbs/Breadcrumbs.stories.tsx +194 -0
- package/breadcrumbs/Breadcrumbs.test.d.ts +1 -0
- package/breadcrumbs/Breadcrumbs.test.js +168 -0
- package/breadcrumbs/Item.d.ts +4 -0
- package/breadcrumbs/Item.js +52 -0
- package/breadcrumbs/dropdownTheme.d.ts +53 -0
- package/breadcrumbs/dropdownTheme.js +62 -0
- package/breadcrumbs/types.d.ts +40 -0
- package/breadcrumbs/types.js +5 -0
- package/bulleted-list/BulletedList.accessibility.test.d.ts +1 -0
- package/bulleted-list/BulletedList.accessibility.test.js +119 -0
- package/bulleted-list/BulletedList.js +7 -4
- package/bulleted-list/BulletedList.stories.tsx +1 -1
- package/button/Button.accessibility.test.d.ts +1 -0
- package/button/Button.accessibility.test.js +127 -0
- package/button/Button.js +2 -2
- package/button/Button.stories.tsx +3 -4
- package/button/Button.test.d.ts +1 -0
- package/button/Button.test.js +1 -1
- package/card/Card.accessibility.test.d.ts +1 -0
- package/card/Card.accessibility.test.js +36 -0
- package/card/Card.js +3 -2
- package/card/Card.stories.tsx +1 -1
- package/card/Card.test.d.ts +1 -0
- package/card/Card.test.js +1 -1
- package/checkbox/Checkbox.accessibility.test.d.ts +1 -0
- package/checkbox/Checkbox.accessibility.test.js +87 -0
- package/checkbox/Checkbox.js +10 -13
- package/checkbox/Checkbox.test.d.ts +1 -0
- package/checkbox/Checkbox.test.js +1 -1
- package/chip/Chip.accessibility.test.d.ts +1 -0
- package/chip/Chip.accessibility.test.js +67 -0
- package/chip/Chip.js +11 -6
- package/chip/Chip.stories.tsx +6 -25
- package/chip/Chip.test.d.ts +1 -0
- package/chip/Chip.test.js +5 -5
- package/common/coreTokens.d.ts +0 -1
- package/common/coreTokens.js +3 -4
- package/common/variables.d.ts +48 -5
- package/common/variables.js +110 -73
- package/container/Container.stories.tsx +3 -3
- package/container/types.d.ts +113 -11
- package/contextual-menu/ContextualMenu.accessibility.test.d.ts +1 -0
- package/contextual-menu/ContextualMenu.accessibility.test.js +98 -0
- package/contextual-menu/ContextualMenu.d.ts +3 -5
- package/contextual-menu/ContextualMenu.js +118 -53
- package/contextual-menu/ContextualMenu.stories.tsx +124 -75
- package/contextual-menu/ContextualMenu.test.d.ts +1 -0
- package/contextual-menu/ContextualMenu.test.js +200 -24
- package/contextual-menu/GroupItem.d.ts +4 -0
- package/contextual-menu/GroupItem.js +67 -0
- package/contextual-menu/ItemAction.d.ts +4 -0
- package/contextual-menu/ItemAction.js +88 -0
- package/contextual-menu/MenuItem.d.ts +4 -0
- package/contextual-menu/MenuItem.js +29 -0
- package/contextual-menu/SingleItem.d.ts +4 -0
- package/contextual-menu/SingleItem.js +38 -0
- package/contextual-menu/types.d.ts +54 -11
- package/date-input/Calendar.js +47 -31
- package/date-input/DateInput.accessibility.test.d.ts +1 -0
- package/date-input/DateInput.accessibility.test.js +229 -0
- package/date-input/DateInput.js +28 -23
- package/date-input/DateInput.stories.tsx +18 -12
- package/date-input/DateInput.test.d.ts +1 -0
- package/date-input/DateInput.test.js +39 -39
- package/date-input/DatePicker.js +13 -7
- package/date-input/YearPicker.js +10 -5
- package/dialog/Dialog.accessibility.test.d.ts +1 -0
- package/dialog/Dialog.accessibility.test.js +69 -0
- package/dialog/Dialog.js +9 -20
- package/dialog/Dialog.stories.tsx +8 -4
- package/dialog/Dialog.test.d.ts +1 -0
- package/dialog/Dialog.test.js +112 -49
- package/divider/Divider.accessibility.test.d.ts +1 -0
- package/divider/Divider.accessibility.test.js +33 -0
- package/divider/Divider.stories.tsx +2 -1
- package/divider/Divider.test.d.ts +1 -0
- package/dropdown/Dropdown.accessibility.test.d.ts +1 -0
- package/dropdown/Dropdown.accessibility.test.js +183 -0
- package/dropdown/Dropdown.js +31 -66
- package/dropdown/Dropdown.stories.tsx +16 -27
- package/dropdown/Dropdown.test.d.ts +1 -0
- package/dropdown/Dropdown.test.js +101 -72
- package/dropdown/DropdownMenu.js +4 -4
- package/dropdown/DropdownMenuItem.js +8 -4
- package/dropdown/types.d.ts +2 -4
- package/file-input/FileInput.accessibility.test.d.ts +1 -0
- package/file-input/FileInput.accessibility.test.js +167 -0
- package/file-input/FileInput.js +6 -47
- package/file-input/FileInput.test.d.ts +1 -0
- package/file-input/FileInput.test.js +51 -106
- package/file-input/FileItem.js +18 -28
- package/file-input/types.d.ts +0 -4
- package/footer/Footer.accessibility.test.d.ts +1 -0
- package/footer/Footer.accessibility.test.js +125 -0
- package/footer/Footer.js +8 -6
- package/footer/Footer.stories.tsx +40 -3
- package/footer/Footer.test.d.ts +1 -0
- package/footer/Footer.test.js +1 -1
- package/footer/Icons.js +2 -30
- package/footer/types.d.ts +1 -1
- package/grid/Grid.stories.tsx +3 -1
- package/header/Header.accessibility.test.d.ts +1 -0
- package/header/Header.accessibility.test.js +94 -0
- package/header/Header.js +12 -22
- package/header/Header.stories.tsx +17 -1
- package/header/Header.test.d.ts +1 -0
- package/header/Header.test.js +1 -1
- package/header/Icons.js +1 -6
- package/heading/Heading.accessibility.test.d.ts +1 -0
- package/heading/Heading.accessibility.test.js +33 -0
- package/heading/Heading.js +1 -1
- package/heading/Heading.test.d.ts +1 -0
- package/heading/Heading.test.js +1 -14
- package/icon/Icon.accessibility.test.d.ts +1 -0
- package/icon/Icon.accessibility.test.js +30 -0
- package/icon/Icon.js +1 -1
- package/icon/Icon.stories.tsx +6 -4
- package/image/Image.accessibility.test.d.ts +1 -0
- package/image/Image.accessibility.test.js +56 -0
- package/image/Image.js +1 -1
- package/layout/ApplicationLayout.js +9 -6
- package/layout/Icons.d.ts +0 -1
- package/layout/Icons.js +1 -11
- package/link/Link.accessibility.test.d.ts +1 -0
- package/link/Link.accessibility.test.js +108 -0
- package/link/Link.js +8 -6
- package/link/Link.stories.tsx +4 -4
- package/link/Link.test.d.ts +1 -0
- package/link/Link.test.js +1 -1
- package/link/types.d.ts +1 -1
- package/main.d.ts +3 -1
- package/main.js +15 -1
- package/nav-tabs/NavTabs.accessibility.test.d.ts +1 -0
- package/nav-tabs/NavTabs.accessibility.test.js +44 -0
- package/nav-tabs/NavTabs.js +19 -4
- package/nav-tabs/NavTabs.stories.tsx +41 -23
- package/nav-tabs/NavTabs.test.d.ts +1 -0
- package/nav-tabs/NavTabs.test.js +10 -9
- package/nav-tabs/Tab.js +17 -18
- package/nav-tabs/types.d.ts +1 -1
- package/number-input/NumberInput.accessibility.test.d.ts +1 -0
- package/number-input/NumberInput.accessibility.test.js +227 -0
- package/number-input/NumberInput.js +6 -3
- package/number-input/NumberInput.stories.tsx +11 -16
- package/number-input/NumberInput.test.d.ts +1 -0
- package/number-input/NumberInput.test.js +6 -7
- package/package.json +34 -28
- package/paginator/Paginator.accessibility.test.d.ts +1 -0
- package/paginator/Paginator.accessibility.test.js +78 -0
- package/paginator/Paginator.js +13 -10
- package/paginator/Paginator.test.d.ts +1 -0
- package/paginator/Paginator.test.js +2 -3
- package/paragraph/Paragraph.accessibility.test.d.ts +1 -0
- package/paragraph/Paragraph.accessibility.test.js +28 -0
- package/password-input/PasswordInput.accessibility.test.d.ts +1 -0
- package/password-input/PasswordInput.accessibility.test.js +152 -0
- package/password-input/PasswordInput.js +11 -8
- package/password-input/PasswordInput.stories.tsx +10 -1
- package/password-input/PasswordInput.test.d.ts +1 -0
- package/password-input/PasswordInput.test.js +6 -7
- package/progress-bar/ProgressBar.accessibility.test.d.ts +1 -0
- package/progress-bar/ProgressBar.accessibility.test.js +35 -0
- package/progress-bar/ProgressBar.js +6 -4
- package/progress-bar/ProgressBar.test.d.ts +1 -0
- package/progress-bar/ProgressBar.test.js +1 -1
- package/quick-nav/QuickNav.accessibility.test.d.ts +1 -0
- package/quick-nav/QuickNav.accessibility.test.js +57 -0
- package/quick-nav/QuickNav.js +1 -1
- package/radio-group/Radio.js +6 -9
- package/radio-group/RadioGroup.accessibility.test.d.ts +1 -0
- package/radio-group/RadioGroup.accessibility.test.js +97 -0
- package/radio-group/RadioGroup.js +14 -16
- package/radio-group/RadioGroup.test.d.ts +1 -0
- package/radio-group/RadioGroup.test.js +3 -5
- package/resultset-table/ResultsetTable.accessibility.test.d.ts +1 -0
- package/resultset-table/ResultsetTable.accessibility.test.js +284 -0
- package/resultset-table/ResultsetTable.d.ts +1 -1
- package/resultset-table/ResultsetTable.js +47 -15
- package/resultset-table/ResultsetTable.stories.tsx +19 -3
- package/resultset-table/ResultsetTable.test.d.ts +1 -0
- package/resultset-table/ResultsetTable.test.js +111 -32
- package/resultset-table/types.d.ts +41 -13
- package/select/Listbox.d.ts +3 -3
- package/select/Listbox.js +33 -29
- package/select/Option.d.ts +3 -3
- package/select/Option.js +21 -15
- package/select/Select.accessibility.test.d.ts +1 -0
- package/select/Select.accessibility.test.js +227 -0
- package/select/Select.js +85 -192
- package/select/Select.stories.tsx +74 -117
- package/select/Select.test.d.ts +1 -0
- package/select/Select.test.js +348 -550
- package/select/selectUtils.d.ts +41 -0
- package/select/selectUtils.js +129 -0
- package/select/types.d.ts +1 -1
- package/sidenav/Sidenav.accessibility.test.d.ts +1 -0
- package/sidenav/Sidenav.accessibility.test.js +59 -0
- package/sidenav/Sidenav.js +16 -12
- package/sidenav/Sidenav.stories.tsx +5 -10
- package/sidenav/Sidenav.test.d.ts +1 -0
- package/sidenav/Sidenav.test.js +1 -1
- package/sidenav/types.d.ts +2 -2
- package/slider/Slider.accessibility.test.d.ts +1 -0
- package/slider/Slider.accessibility.test.js +103 -0
- package/slider/Slider.js +11 -13
- package/slider/Slider.stories.tsx +180 -0
- package/slider/Slider.test.d.ts +1 -0
- package/slider/Slider.test.js +13 -11
- package/spinner/Spinner.accessibility.test.d.ts +1 -0
- package/spinner/Spinner.accessibility.test.js +96 -0
- package/spinner/Spinner.d.ts +1 -1
- package/spinner/Spinner.js +32 -47
- package/spinner/Spinner.test.d.ts +1 -0
- package/spinner/Spinner.test.js +1 -1
- package/status-light/StatusLight.accessibility.test.d.ts +1 -0
- package/status-light/StatusLight.accessibility.test.js +157 -0
- package/status-light/StatusLight.test.d.ts +1 -0
- package/status-light/StatusLight.test.js +1 -1
- package/switch/Switch.accessibility.test.d.ts +1 -0
- package/switch/Switch.accessibility.test.js +98 -0
- package/switch/Switch.js +6 -9
- package/switch/Switch.stories.tsx +12 -0
- package/switch/Switch.test.d.ts +1 -0
- package/switch/Switch.test.js +1 -1
- package/table/Table.accessibility.test.d.ts +1 -0
- package/table/Table.accessibility.test.js +92 -0
- package/table/Table.js +2 -11
- package/table/Table.stories.tsx +15 -10
- package/table/Table.test.d.ts +1 -0
- package/table/Table.test.js +2 -4
- package/table/types.d.ts +1 -15
- package/tabs/Tab.js +6 -5
- package/tabs/Tabs.accessibility.test.d.ts +1 -0
- package/tabs/Tabs.accessibility.test.js +56 -0
- package/tabs/Tabs.js +9 -20
- package/tabs/Tabs.stories.tsx +7 -3
- package/tabs/Tabs.test.d.ts +1 -0
- package/tabs/Tabs.test.js +20 -38
- package/tabs/types.d.ts +2 -2
- package/tag/Tag.accessibility.test.d.ts +1 -0
- package/tag/Tag.accessibility.test.js +69 -0
- package/tag/Tag.js +7 -7
- package/tag/Tag.stories.tsx +5 -8
- package/tag/Tag.test.d.ts +1 -0
- package/tag/Tag.test.js +5 -13
- package/tag/types.d.ts +2 -2
- package/text-input/Suggestion.js +1 -1
- package/text-input/Suggestions.js +17 -7
- package/text-input/TextInput.accessibility.test.d.ts +1 -0
- package/text-input/TextInput.accessibility.test.js +320 -0
- package/text-input/TextInput.js +56 -73
- package/text-input/TextInput.stories.tsx +20 -8
- package/text-input/TextInput.test.d.ts +1 -0
- package/text-input/TextInput.test.js +2 -3
- package/textarea/Textarea.accessibility.test.d.ts +1 -0
- package/textarea/Textarea.accessibility.test.js +155 -0
- package/textarea/Textarea.js +14 -13
- package/textarea/Textarea.test.d.ts +1 -0
- package/textarea/Textarea.test.js +1 -1
- package/toggle-group/ToggleGroup.accessibility.test.d.ts +1 -0
- package/toggle-group/ToggleGroup.accessibility.test.js +107 -0
- package/toggle-group/ToggleGroup.js +10 -12
- package/toggle-group/ToggleGroup.stories.tsx +4 -4
- package/toggle-group/ToggleGroup.test.d.ts +1 -0
- package/toggle-group/ToggleGroup.test.js +1 -1
- package/toggle-group/types.d.ts +2 -2
- package/tooltip/Tooltip.accessibility.test.d.ts +1 -0
- package/tooltip/Tooltip.accessibility.test.js +144 -0
- package/tooltip/Tooltip.d.ts +4 -0
- package/tooltip/Tooltip.js +50 -0
- package/tooltip/Tooltip.stories.tsx +111 -0
- package/tooltip/Tooltip.test.d.ts +1 -0
- package/tooltip/Tooltip.test.js +112 -0
- package/tooltip/types.d.ts +16 -0
- package/tooltip/types.js +5 -0
- package/typography/Typography.accessibility.test.d.ts +1 -0
- package/typography/Typography.accessibility.test.js +339 -0
- package/typography/Typography.stories.tsx +1 -3
- package/typography/Typography.test.js +23 -0
- package/useTheme.d.ts +31 -5
- package/useTranslatedLabels.d.ts +11 -0
- package/utils/BaseTypography.js +45 -41
- package/utils/FocusLock.js +3 -2
- package/utils/useWidth.d.ts +2 -0
- package/utils/useWidth.js +30 -0
- package/wizard/Wizard.accessibility.test.d.ts +1 -0
- package/wizard/Wizard.accessibility.test.js +55 -0
- package/wizard/Wizard.js +14 -25
- package/wizard/Wizard.stories.tsx +20 -1
- package/wizard/Wizard.test.d.ts +1 -0
- package/wizard/Wizard.test.js +1 -1
- package/wizard/types.d.ts +1 -1
- package/contextual-menu/MenuItemAction.d.ts +0 -4
- package/contextual-menu/MenuItemAction.js +0 -46
- package/date-input/Icons.d.ts +0 -6
- package/date-input/Icons.js +0 -58
- package/paginator/Icons.d.ts +0 -5
- package/paginator/Icons.js +0 -40
- package/password-input/Icons.d.ts +0 -6
- package/password-input/Icons.js +0 -35
- package/select/Icons.d.ts +0 -10
- package/select/Icons.js +0 -89
- package/sidenav/Icons.d.ts +0 -7
- package/sidenav/Icons.js +0 -47
- package/text-input/Icons.d.ts +0 -8
- package/text-input/Icons.js +0 -56
package/link/Link.js
CHANGED
|
@@ -14,18 +14,19 @@ var _react = _interopRequireWildcard(require("react"));
|
|
|
14
14
|
var _styledComponents = _interopRequireWildcard(require("styled-components"));
|
|
15
15
|
var _variables = require("../common/variables");
|
|
16
16
|
var _useTheme = _interopRequireDefault(require("../useTheme"));
|
|
17
|
-
var
|
|
17
|
+
var _Icon = _interopRequireDefault(require("../icon/Icon"));
|
|
18
|
+
var _templateObject, _templateObject2;
|
|
18
19
|
var _excluded = ["inheritColor", "disabled", "icon", "iconPosition", "href", "newWindow", "onClick", "margin", "tabIndex", "children"];
|
|
19
20
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
20
|
-
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof3(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u &&
|
|
21
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof3(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
|
|
21
22
|
var LinkContent = /*#__PURE__*/_react["default"].memo(function (_ref) {
|
|
22
23
|
var iconPosition = _ref.iconPosition,
|
|
23
24
|
icon = _ref.icon,
|
|
24
25
|
children = _ref.children;
|
|
25
26
|
return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, iconPosition === "after" && children, icon && /*#__PURE__*/_react["default"].createElement(LinkIconContainer, {
|
|
26
27
|
iconPosition: iconPosition
|
|
27
|
-
}, typeof icon === "string" ? /*#__PURE__*/_react["default"].createElement(
|
|
28
|
-
|
|
28
|
+
}, typeof icon === "string" ? /*#__PURE__*/_react["default"].createElement(_Icon["default"], {
|
|
29
|
+
icon: icon
|
|
29
30
|
}) : icon), iconPosition === "before" && children);
|
|
30
31
|
});
|
|
31
32
|
var DxcLink = /*#__PURE__*/(0, _react.forwardRef)(function (_ref2, ref) {
|
|
@@ -104,12 +105,13 @@ var StyledLink = _styledComponents["default"].div(_templateObject || (_templateO
|
|
|
104
105
|
}, function (props) {
|
|
105
106
|
return "color: ".concat(props.theme.activeFontColor, " !important;\n border-bottom-color: ").concat(props.theme.activeUnderlineColor, " !important;");
|
|
106
107
|
});
|
|
107
|
-
var
|
|
108
|
-
var LinkIconContainer = _styledComponents["default"].div(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2["default"])(["\n width: ", ";\n height: ", ";\n ", ";\n overflow: hidden;\n align-self: center;\n\n img,\n svg {\n height: 100%;\n width: 100%;\n }\n"])), function (props) {
|
|
108
|
+
var LinkIconContainer = _styledComponents["default"].div(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2["default"])(["\n width: ", ";\n height: ", ";\n ", ";\n overflow: hidden;\n align-self: center;\n\n font-size: ", ";\n svg {\n height: 100%;\n width: 100%;\n }\n"])), function (props) {
|
|
109
109
|
return props.theme.iconSize;
|
|
110
110
|
}, function (props) {
|
|
111
111
|
return props.theme.iconSize;
|
|
112
112
|
}, function (props) {
|
|
113
113
|
return "".concat(props.iconPosition === "before" ? "margin-right" : "margin-left", ": ").concat(props.theme.iconSpacing);
|
|
114
|
+
}, function (props) {
|
|
115
|
+
return props.theme.iconSize;
|
|
114
116
|
});
|
|
115
117
|
var _default = exports["default"] = DxcLink;
|
package/link/Link.stories.tsx
CHANGED
|
@@ -11,10 +11,10 @@ export default {
|
|
|
11
11
|
|
|
12
12
|
const icon = (
|
|
13
13
|
<svg viewBox="0 0 24 24" enableBackground="new 0 0 24 24" fill="currentColor">
|
|
14
|
-
<g
|
|
14
|
+
<g>
|
|
15
15
|
<rect fill="none" width="24" height="24" />
|
|
16
16
|
</g>
|
|
17
|
-
<g
|
|
17
|
+
<g>
|
|
18
18
|
<path d="M19,9.3V4h-3v2.6L12,3L2,12h3v8h5v-6h4v6h5v-8h3L19,9.3z M10,10c0-1.1,0.9-2,2-2s2,0.9,2,2H10z" />
|
|
19
19
|
</g>
|
|
20
20
|
</svg>
|
|
@@ -33,7 +33,7 @@ export const Chromatic = () => (
|
|
|
33
33
|
<Title title="Disabled" theme="light" level={4} />
|
|
34
34
|
<DxcLink disabled>Test</DxcLink>
|
|
35
35
|
<Title title="Icon before" theme="light" level={4} />
|
|
36
|
-
<DxcLink href="https://www.google.com" icon=
|
|
36
|
+
<DxcLink href="https://www.google.com" icon="lock" iconPosition="before">
|
|
37
37
|
Test
|
|
38
38
|
</DxcLink>
|
|
39
39
|
<Title title="Icon after" theme="light" level={4} />
|
|
@@ -76,7 +76,7 @@ export const Chromatic = () => (
|
|
|
76
76
|
<ExampleContainer pseudoState="pseudo-hover">
|
|
77
77
|
<Title title="Long text with hover" theme="light" level={4} />
|
|
78
78
|
Lorem{" "}
|
|
79
|
-
<DxcLink href="https://www.google.com" icon=
|
|
79
|
+
<DxcLink href="https://www.google.com" icon="filled_home">
|
|
80
80
|
Test
|
|
81
81
|
</DxcLink>{" "}
|
|
82
82
|
ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/link/Link.test.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
4
|
var _react = _interopRequireDefault(require("react"));
|
|
5
5
|
var _react2 = require("@testing-library/react");
|
|
6
|
-
var _Link = _interopRequireDefault(require("./Link
|
|
6
|
+
var _Link = _interopRequireDefault(require("./Link"));
|
|
7
7
|
describe("Link component tests", function () {
|
|
8
8
|
test("Link renders with correct text", function () {
|
|
9
9
|
var _render = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Link["default"], null, "Link")),
|
package/link/types.d.ts
CHANGED
|
@@ -17,7 +17,7 @@ export type LinkProps = {
|
|
|
17
17
|
*/
|
|
18
18
|
inheritColor?: boolean;
|
|
19
19
|
/**
|
|
20
|
-
*
|
|
20
|
+
* Material Symbol name or SVG element as the icon that will be placed next to the link text.
|
|
21
21
|
*/
|
|
22
22
|
icon?: string | SVG;
|
|
23
23
|
/**
|
package/main.d.ts
CHANGED
|
@@ -45,5 +45,7 @@ import DxcBadge from "./badge/Badge";
|
|
|
45
45
|
import DxcStatusLight from "./status-light/StatusLight";
|
|
46
46
|
import DxcContextualMenu from "./contextual-menu/ContextualMenu";
|
|
47
47
|
import DxcDivider from "./divider/Divider";
|
|
48
|
+
import DxcBreadcrumbs from "./breadcrumbs/Breadcrumbs";
|
|
49
|
+
import DxcBarChart from "./bar-chart/BarChart";
|
|
48
50
|
import HalstackContext, { HalstackProvider, HalstackLanguageContext } from "./HalstackContext";
|
|
49
|
-
export { DxcAlert, DxcButton, DxcCheckbox, DxcTextInput, DxcDropdown, DxcSwitch, DxcSlider, DxcTable, DxcTabs, DxcToggleGroup, DxcDialog, DxcCard, DxcProgressBar, DxcAccordion, DxcSpinner, DxcBox, DxcTag, DxcPaginator, DxcWizard, DxcLink, DxcHeading, DxcResultsetTable, DxcChip, DxcApplicationLayout, HalstackContext, HalstackLanguageContext, HalstackProvider, DxcAccordionGroup, DxcPasswordInput, DxcDateInput, DxcNumberInput, DxcTextarea, DxcSelect, DxcFileInput, DxcRadioGroup, DxcBleed, DxcInset, DxcQuickNav, DxcNavTabs, DxcFlex, DxcTypography, DxcParagraph, DxcBulletedList, DxcGrid, DxcImage, DxcContainer, DxcBadge, DxcStatusLight, DxcContextualMenu, DxcDivider, };
|
|
51
|
+
export { DxcAlert, DxcButton, DxcCheckbox, DxcTextInput, DxcDropdown, DxcSwitch, DxcSlider, DxcTable, DxcTabs, DxcToggleGroup, DxcDialog, DxcCard, DxcProgressBar, DxcAccordion, DxcSpinner, DxcBox, DxcTag, DxcPaginator, DxcWizard, DxcLink, DxcHeading, DxcResultsetTable, DxcChip, DxcApplicationLayout, HalstackContext, HalstackLanguageContext, HalstackProvider, DxcAccordionGroup, DxcPasswordInput, DxcDateInput, DxcNumberInput, DxcTextarea, DxcSelect, DxcFileInput, DxcRadioGroup, DxcBleed, DxcInset, DxcQuickNav, DxcNavTabs, DxcFlex, DxcTypography, DxcParagraph, DxcBulletedList, DxcGrid, DxcImage, DxcContainer, DxcBadge, DxcStatusLight, DxcContextualMenu, DxcDivider, DxcBreadcrumbs, DxcBarChart, };
|
package/main.js
CHANGED
|
@@ -35,6 +35,12 @@ Object.defineProperty(exports, "DxcBadge", {
|
|
|
35
35
|
return _Badge["default"];
|
|
36
36
|
}
|
|
37
37
|
});
|
|
38
|
+
Object.defineProperty(exports, "DxcBarChart", {
|
|
39
|
+
enumerable: true,
|
|
40
|
+
get: function get() {
|
|
41
|
+
return _BarChart["default"];
|
|
42
|
+
}
|
|
43
|
+
});
|
|
38
44
|
Object.defineProperty(exports, "DxcBleed", {
|
|
39
45
|
enumerable: true,
|
|
40
46
|
get: function get() {
|
|
@@ -47,6 +53,12 @@ Object.defineProperty(exports, "DxcBox", {
|
|
|
47
53
|
return _Box["default"];
|
|
48
54
|
}
|
|
49
55
|
});
|
|
56
|
+
Object.defineProperty(exports, "DxcBreadcrumbs", {
|
|
57
|
+
enumerable: true,
|
|
58
|
+
get: function get() {
|
|
59
|
+
return _Breadcrumbs["default"];
|
|
60
|
+
}
|
|
61
|
+
});
|
|
50
62
|
Object.defineProperty(exports, "DxcBulletedList", {
|
|
51
63
|
enumerable: true,
|
|
52
64
|
get: function get() {
|
|
@@ -352,6 +364,8 @@ var _Badge = _interopRequireDefault(require("./badge/Badge"));
|
|
|
352
364
|
var _StatusLight = _interopRequireDefault(require("./status-light/StatusLight"));
|
|
353
365
|
var _ContextualMenu = _interopRequireDefault(require("./contextual-menu/ContextualMenu"));
|
|
354
366
|
var _Divider = _interopRequireDefault(require("./divider/Divider"));
|
|
367
|
+
var _Breadcrumbs = _interopRequireDefault(require("./breadcrumbs/Breadcrumbs"));
|
|
368
|
+
var _BarChart = _interopRequireDefault(require("./bar-chart/BarChart"));
|
|
355
369
|
var _HalstackContext = _interopRequireWildcard(require("./HalstackContext"));
|
|
356
370
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
357
|
-
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u &&
|
|
371
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
5
|
+
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
6
|
+
var _react = _interopRequireDefault(require("react"));
|
|
7
|
+
var _react2 = require("@testing-library/react");
|
|
8
|
+
var _axeHelper = require("../../test/accessibility/axe-helper.js");
|
|
9
|
+
var _NavTabs = _interopRequireDefault(require("./NavTabs"));
|
|
10
|
+
var favoriteIcon = 'filled_Favorite';
|
|
11
|
+
var pinIcon = 'Location_On';
|
|
12
|
+
describe("Tabs component accessibility tests", function () {
|
|
13
|
+
it("Should not have basic accessibility issues", /*#__PURE__*/(0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee() {
|
|
14
|
+
var _render, container, results;
|
|
15
|
+
return _regenerator["default"].wrap(function _callee$(_context) {
|
|
16
|
+
while (1) switch (_context.prev = _context.next) {
|
|
17
|
+
case 0:
|
|
18
|
+
_render = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_NavTabs["default"], {
|
|
19
|
+
iconPosition: "left"
|
|
20
|
+
}, /*#__PURE__*/_react["default"].createElement(_NavTabs["default"].Tab, {
|
|
21
|
+
href: "/test1",
|
|
22
|
+
icon: favoriteIcon,
|
|
23
|
+
active: true
|
|
24
|
+
}, "Tab 1"), /*#__PURE__*/_react["default"].createElement(_NavTabs["default"].Tab, {
|
|
25
|
+
href: "/test2",
|
|
26
|
+
icon: favoriteIcon,
|
|
27
|
+
disabled: true
|
|
28
|
+
}, "Tab 2"), /*#__PURE__*/_react["default"].createElement(_NavTabs["default"].Tab, {
|
|
29
|
+
href: "/test3",
|
|
30
|
+
icon: pinIcon,
|
|
31
|
+
notificationNumber: 12
|
|
32
|
+
}, "Tab 3"))), container = _render.container;
|
|
33
|
+
_context.next = 3;
|
|
34
|
+
return (0, _axeHelper.axe)(container);
|
|
35
|
+
case 3:
|
|
36
|
+
results = _context.sent;
|
|
37
|
+
expect(results).toHaveNoViolations();
|
|
38
|
+
case 5:
|
|
39
|
+
case "end":
|
|
40
|
+
return _context.stop();
|
|
41
|
+
}
|
|
42
|
+
}, _callee);
|
|
43
|
+
})));
|
|
44
|
+
});
|
package/nav-tabs/NavTabs.js
CHANGED
|
@@ -15,7 +15,7 @@ var _Tab = _interopRequireDefault(require("./Tab"));
|
|
|
15
15
|
var _NavTabsContext = require("./NavTabsContext");
|
|
16
16
|
var _templateObject, _templateObject2;
|
|
17
17
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
18
|
-
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u &&
|
|
18
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
|
|
19
19
|
var getPropInChild = function getPropInChild(child, propName) {
|
|
20
20
|
return child.props ? child.props[propName] ? child.props[propName] : child.props.children ? getPropInChild(child.props.children, propName) : undefined : undefined;
|
|
21
21
|
};
|
|
@@ -50,7 +50,17 @@ var DxcNavTabs = function DxcNavTabs(_ref) {
|
|
|
50
50
|
_useState2 = (0, _slicedToArray2["default"])(_useState, 2),
|
|
51
51
|
innerFocusIndex = _useState2[0],
|
|
52
52
|
setInnerFocusIndex = _useState2[1];
|
|
53
|
+
var _useState3 = (0, _react.useState)(null),
|
|
54
|
+
_useState4 = (0, _slicedToArray2["default"])(_useState3, 2),
|
|
55
|
+
underlineWidth = _useState4[0],
|
|
56
|
+
setUnderlineWidth = _useState4[1];
|
|
57
|
+
var refNavTabList = (0, _react.useRef)(null);
|
|
53
58
|
var colorsTheme = (0, _useTheme["default"])();
|
|
59
|
+
(0, _react.useEffect)(function () {
|
|
60
|
+
var _refNavTabList$curren, _refNavTabList$curren2;
|
|
61
|
+
console.log(refNavTabList === null || refNavTabList === void 0 ? void 0 : (_refNavTabList$curren = refNavTabList.current) === null || _refNavTabList$curren === void 0 ? void 0 : _refNavTabList$curren.scrollWidth);
|
|
62
|
+
setUnderlineWidth(refNavTabList === null || refNavTabList === void 0 ? void 0 : (_refNavTabList$curren2 = refNavTabList.current) === null || _refNavTabList$curren2 === void 0 ? void 0 : _refNavTabList$curren2.scrollWidth);
|
|
63
|
+
}, [children]);
|
|
54
64
|
var contextValue = (0, _react.useMemo)(function () {
|
|
55
65
|
return {
|
|
56
66
|
iconPosition: iconPosition,
|
|
@@ -79,15 +89,20 @@ var DxcNavTabs = function DxcNavTabs(_ref) {
|
|
|
79
89
|
theme: colorsTheme.navTabs
|
|
80
90
|
}, /*#__PURE__*/_react["default"].createElement(NavTabsContainer, {
|
|
81
91
|
onKeyDown: handleOnKeyDown,
|
|
92
|
+
ref: refNavTabList,
|
|
82
93
|
role: "tablist",
|
|
83
94
|
"aria-label": "Navigation tabs"
|
|
84
95
|
}, /*#__PURE__*/_react["default"].createElement(_NavTabsContext.NavTabsContext.Provider, {
|
|
85
96
|
value: contextValue
|
|
86
|
-
}, children), /*#__PURE__*/_react["default"].createElement(Underline,
|
|
97
|
+
}, children), /*#__PURE__*/_react["default"].createElement(Underline, {
|
|
98
|
+
underlineWidth: underlineWidth
|
|
99
|
+
})));
|
|
87
100
|
};
|
|
88
|
-
var Underline = _styledComponents["default"].div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["\n position: absolute;\n bottom: 0;\n left: 0;\n
|
|
101
|
+
var Underline = _styledComponents["default"].div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["\n position: absolute;\n bottom: 0;\n left: 0;\n height: 2px;\n background-color: ", ";\n z-index: -1;\n width: ", "px;\n"])), function (props) {
|
|
89
102
|
return props.theme.dividerColor;
|
|
103
|
+
}, function (props) {
|
|
104
|
+
return props.underlineWidth;
|
|
90
105
|
});
|
|
91
106
|
DxcNavTabs.Tab = _Tab["default"];
|
|
92
|
-
var NavTabsContainer = _styledComponents["default"].div(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n position: relative;\n"])));
|
|
107
|
+
var NavTabsContainer = _styledComponents["default"].div(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n position: relative;\n overflow: auto;\n z-index: 0;\n"])));
|
|
93
108
|
var _default = exports["default"] = DxcNavTabs;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import DxcNavTabs from "./NavTabs";
|
|
3
|
+
import DxcContainer from "../container/Container";
|
|
3
4
|
import Title from "../../.storybook/components/Title";
|
|
4
5
|
import ExampleContainer from "../../.storybook/components/ExampleContainer";
|
|
5
6
|
import { HalstackProvider } from "../HalstackContext";
|
|
@@ -16,7 +17,9 @@ const iconSVG = (
|
|
|
16
17
|
</svg>
|
|
17
18
|
);
|
|
18
19
|
|
|
19
|
-
const
|
|
20
|
+
const favoriteIcon = "filled_Favorite";
|
|
21
|
+
|
|
22
|
+
const pinIcon = "Location_On";
|
|
20
23
|
|
|
21
24
|
const opinionatedTheme = {
|
|
22
25
|
navTabs: {
|
|
@@ -105,10 +108,10 @@ export const Chromatic = () => (
|
|
|
105
108
|
<DxcNavTabs.Tab href="#" disabled icon={iconSVG}>
|
|
106
109
|
Tab 2
|
|
107
110
|
</DxcNavTabs.Tab>
|
|
108
|
-
<DxcNavTabs.Tab href="#" icon={
|
|
111
|
+
<DxcNavTabs.Tab href="#" icon={pinIcon}>
|
|
109
112
|
Tab 3
|
|
110
113
|
</DxcNavTabs.Tab>
|
|
111
|
-
<DxcNavTabs.Tab href="#" icon={
|
|
114
|
+
<DxcNavTabs.Tab href="#" icon={pinIcon}>
|
|
112
115
|
Tab 4
|
|
113
116
|
</DxcNavTabs.Tab>
|
|
114
117
|
</DxcNavTabs>
|
|
@@ -116,16 +119,16 @@ export const Chromatic = () => (
|
|
|
116
119
|
<ExampleContainer>
|
|
117
120
|
<Title title="With icon position left" theme="light" level={4} />
|
|
118
121
|
<DxcNavTabs iconPosition="left">
|
|
119
|
-
<DxcNavTabs.Tab href="#" active icon={
|
|
122
|
+
<DxcNavTabs.Tab href="#" active icon={pinIcon}>
|
|
120
123
|
Tab 1
|
|
121
124
|
</DxcNavTabs.Tab>
|
|
122
|
-
<DxcNavTabs.Tab href="#" disabled icon={
|
|
125
|
+
<DxcNavTabs.Tab href="#" disabled icon={favoriteIcon}>
|
|
123
126
|
Tab 2
|
|
124
127
|
</DxcNavTabs.Tab>
|
|
125
|
-
<DxcNavTabs.Tab href="#" icon={
|
|
128
|
+
<DxcNavTabs.Tab href="#" icon={favoriteIcon}>
|
|
126
129
|
Tab 3
|
|
127
130
|
</DxcNavTabs.Tab>
|
|
128
|
-
<DxcNavTabs.Tab href="#" icon={
|
|
131
|
+
<DxcNavTabs.Tab href="#" icon={favoriteIcon}>
|
|
129
132
|
Tab 4
|
|
130
133
|
</DxcNavTabs.Tab>
|
|
131
134
|
</DxcNavTabs>
|
|
@@ -133,16 +136,16 @@ export const Chromatic = () => (
|
|
|
133
136
|
<ExampleContainer>
|
|
134
137
|
<Title title="With icon and notification number" theme="light" level={4} />
|
|
135
138
|
<DxcNavTabs>
|
|
136
|
-
<DxcNavTabs.Tab href="#" active icon={
|
|
139
|
+
<DxcNavTabs.Tab href="#" active icon={pinIcon} notificationNumber>
|
|
137
140
|
Tab 1
|
|
138
141
|
</DxcNavTabs.Tab>
|
|
139
|
-
<DxcNavTabs.Tab href="#" disabled icon={
|
|
142
|
+
<DxcNavTabs.Tab href="#" disabled icon={favoriteIcon} notificationNumber={5}>
|
|
140
143
|
Tab 2
|
|
141
144
|
</DxcNavTabs.Tab>
|
|
142
|
-
<DxcNavTabs.Tab href="#" icon={
|
|
145
|
+
<DxcNavTabs.Tab href="#" icon={favoriteIcon} notificationNumber={120}>
|
|
143
146
|
Tab 3
|
|
144
147
|
</DxcNavTabs.Tab>
|
|
145
|
-
<DxcNavTabs.Tab href="#" icon={
|
|
148
|
+
<DxcNavTabs.Tab href="#" icon={pinIcon} notificationNumber={12}>
|
|
146
149
|
Tab 4
|
|
147
150
|
</DxcNavTabs.Tab>
|
|
148
151
|
</DxcNavTabs>
|
|
@@ -150,16 +153,16 @@ export const Chromatic = () => (
|
|
|
150
153
|
<ExampleContainer>
|
|
151
154
|
<Title title="With icon on the left and notification number" theme="light" level={4} />
|
|
152
155
|
<DxcNavTabs iconPosition="left">
|
|
153
|
-
<DxcNavTabs.Tab href="#" active icon={
|
|
156
|
+
<DxcNavTabs.Tab href="#" active icon={favoriteIcon} notificationNumber>
|
|
154
157
|
Tab 1
|
|
155
158
|
</DxcNavTabs.Tab>
|
|
156
|
-
<DxcNavTabs.Tab href="#" disabled icon={
|
|
159
|
+
<DxcNavTabs.Tab href="#" disabled icon={favoriteIcon} notificationNumber={5}>
|
|
157
160
|
Tab 2
|
|
158
161
|
</DxcNavTabs.Tab>
|
|
159
|
-
<DxcNavTabs.Tab href="#" icon={
|
|
162
|
+
<DxcNavTabs.Tab href="#" icon={pinIcon} notificationNumber={120}>
|
|
160
163
|
Tab 3
|
|
161
164
|
</DxcNavTabs.Tab>
|
|
162
|
-
<DxcNavTabs.Tab href="#" icon={
|
|
165
|
+
<DxcNavTabs.Tab href="#" icon={favoriteIcon} notificationNumber={12}>
|
|
163
166
|
Tab 4
|
|
164
167
|
</DxcNavTabs.Tab>
|
|
165
168
|
</DxcNavTabs>
|
|
@@ -170,10 +173,10 @@ export const Chromatic = () => (
|
|
|
170
173
|
<DxcNavTabs.Tab href="#" active>
|
|
171
174
|
Lorem ipsum dolor sit amet, consectetur adipiscing elit
|
|
172
175
|
</DxcNavTabs.Tab>
|
|
173
|
-
<DxcNavTabs.Tab href="#" icon={
|
|
176
|
+
<DxcNavTabs.Tab href="#" icon={favoriteIcon} disabled notificationNumber={3}>
|
|
174
177
|
Tab 2
|
|
175
178
|
</DxcNavTabs.Tab>
|
|
176
|
-
<DxcNavTabs.Tab href="#" icon={
|
|
179
|
+
<DxcNavTabs.Tab href="#" icon={favoriteIcon}>
|
|
177
180
|
Tab 3
|
|
178
181
|
</DxcNavTabs.Tab>
|
|
179
182
|
</DxcNavTabs>
|
|
@@ -184,10 +187,10 @@ export const Chromatic = () => (
|
|
|
184
187
|
<DxcNavTabs.Tab href="#" active>
|
|
185
188
|
Lorem ipsum dolor sit amet, consectetur adipiscing elit
|
|
186
189
|
</DxcNavTabs.Tab>
|
|
187
|
-
<DxcNavTabs.Tab href="#" icon={
|
|
190
|
+
<DxcNavTabs.Tab href="#" icon={favoriteIcon} disabled notificationNumber={3}>
|
|
188
191
|
Tab 2
|
|
189
192
|
</DxcNavTabs.Tab>
|
|
190
|
-
<DxcNavTabs.Tab href="#" icon={
|
|
193
|
+
<DxcNavTabs.Tab href="#" icon={favoriteIcon}>
|
|
191
194
|
Tab 3
|
|
192
195
|
</DxcNavTabs.Tab>
|
|
193
196
|
</DxcNavTabs>
|
|
@@ -257,20 +260,35 @@ export const Chromatic = () => (
|
|
|
257
260
|
<Title title="With icon and notification number" theme="light" level={4} />
|
|
258
261
|
<HalstackProvider theme={opinionatedTheme}>
|
|
259
262
|
<DxcNavTabs>
|
|
260
|
-
<DxcNavTabs.Tab href="#" active icon={
|
|
263
|
+
<DxcNavTabs.Tab href="#" active icon={favoriteIcon} notificationNumber>
|
|
261
264
|
Tab 1
|
|
262
265
|
</DxcNavTabs.Tab>
|
|
263
|
-
<DxcNavTabs.Tab href="#" disabled icon={
|
|
266
|
+
<DxcNavTabs.Tab href="#" disabled icon={favoriteIcon} notificationNumber={5}>
|
|
264
267
|
Tab 2
|
|
265
268
|
</DxcNavTabs.Tab>
|
|
266
|
-
<DxcNavTabs.Tab href="#" icon={
|
|
269
|
+
<DxcNavTabs.Tab href="#" icon={favoriteIcon} notificationNumber={120}>
|
|
267
270
|
Tab 3
|
|
268
271
|
</DxcNavTabs.Tab>
|
|
269
|
-
<DxcNavTabs.Tab href="#" icon={
|
|
272
|
+
<DxcNavTabs.Tab href="#" icon={favoriteIcon} notificationNumber={12}>
|
|
270
273
|
Tab 4
|
|
271
274
|
</DxcNavTabs.Tab>
|
|
272
275
|
</DxcNavTabs>
|
|
273
276
|
</HalstackProvider>
|
|
274
277
|
</ExampleContainer>
|
|
278
|
+
<ExampleContainer>
|
|
279
|
+
<Title title="NavTabs in a limited space container" theme="light" level={4} />
|
|
280
|
+
<DxcContainer width="500px">
|
|
281
|
+
<DxcNavTabs>
|
|
282
|
+
<DxcNavTabs.Tab href="#" active>
|
|
283
|
+
Tab 1
|
|
284
|
+
</DxcNavTabs.Tab>
|
|
285
|
+
<DxcNavTabs.Tab href="#" disabled>
|
|
286
|
+
Tab 2
|
|
287
|
+
</DxcNavTabs.Tab>
|
|
288
|
+
<DxcNavTabs.Tab href="#">Tab 3</DxcNavTabs.Tab>
|
|
289
|
+
<DxcNavTabs.Tab href="#">Tab 4</DxcNavTabs.Tab>
|
|
290
|
+
</DxcNavTabs>
|
|
291
|
+
</DxcContainer>
|
|
292
|
+
</ExampleContainer>
|
|
275
293
|
</>
|
|
276
294
|
);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/nav-tabs/NavTabs.test.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
4
|
var _react = _interopRequireDefault(require("react"));
|
|
5
5
|
var _react2 = require("@testing-library/react");
|
|
6
|
-
var _NavTabs = _interopRequireDefault(require("./NavTabs
|
|
6
|
+
var _NavTabs = _interopRequireDefault(require("./NavTabs"));
|
|
7
7
|
describe("Tabs component tests", function () {
|
|
8
8
|
test("Tabs render with correct labels and attributes", function () {
|
|
9
9
|
var _render = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_NavTabs["default"], null, /*#__PURE__*/_react["default"].createElement(_NavTabs["default"].Tab, {
|
|
@@ -27,12 +27,14 @@ describe("Tabs component tests", function () {
|
|
|
27
27
|
tabs.forEach(function (tab, index) {
|
|
28
28
|
expect(tab.getAttribute("aria-selected")).toBe((index === 0).toString());
|
|
29
29
|
});
|
|
30
|
-
var anchors = getAllByRole("
|
|
31
|
-
expect(anchors.length).toBe(
|
|
30
|
+
var anchors = getAllByRole("tab");
|
|
31
|
+
expect(anchors.length).toBe(3);
|
|
32
32
|
expect(anchors[0].getAttribute("href")).toBe("/test1");
|
|
33
|
-
expect(anchors[1].getAttribute("href")).
|
|
33
|
+
expect(anchors[1].getAttribute("href")).toBeFalsy();
|
|
34
|
+
expect(anchors[2].getAttribute("href")).toBe("/test3");
|
|
34
35
|
expect(anchors[0].getAttribute("tabindex")).toBe("0");
|
|
35
36
|
expect(anchors[1].getAttribute("tabindex")).toBe("-1");
|
|
37
|
+
expect(anchors[2].getAttribute("tabindex")).toBe("-1");
|
|
36
38
|
});
|
|
37
39
|
test("Tabs render with correct labels, badges and icons", function () {
|
|
38
40
|
var _render2 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_NavTabs["default"], null, /*#__PURE__*/_react["default"].createElement(_NavTabs["default"].Tab, {
|
|
@@ -46,15 +48,13 @@ describe("Tabs component tests", function () {
|
|
|
46
48
|
}, "Tab 2"), /*#__PURE__*/_react["default"].createElement(_NavTabs["default"].Tab, {
|
|
47
49
|
href: "/test3",
|
|
48
50
|
notificationNumber: 1000,
|
|
49
|
-
icon: "
|
|
51
|
+
icon: "Settings"
|
|
50
52
|
}, "Tab 3"))),
|
|
51
53
|
getByText = _render2.getByText,
|
|
52
|
-
getByRole = _render2.getByRole,
|
|
53
54
|
queryByText = _render2.queryByText;
|
|
54
55
|
expect(getByText("10")).toBeTruthy();
|
|
55
56
|
expect(queryByText("20")).toBeFalsy();
|
|
56
57
|
expect(getByText("+99")).toBeTruthy();
|
|
57
|
-
expect(getByRole("img")).toBeTruthy();
|
|
58
58
|
});
|
|
59
59
|
test("Tabs render with correct tab index", function () {
|
|
60
60
|
var _render3 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_NavTabs["default"], {
|
|
@@ -69,8 +69,9 @@ describe("Tabs component tests", function () {
|
|
|
69
69
|
active: true
|
|
70
70
|
}, "Tab 3"))),
|
|
71
71
|
getAllByRole = _render3.getAllByRole;
|
|
72
|
-
var tabs = getAllByRole("
|
|
72
|
+
var tabs = getAllByRole("tab");
|
|
73
73
|
expect(tabs[0].getAttribute("tabindex")).toBe("-1");
|
|
74
|
-
expect(tabs[1].getAttribute("tabindex")).toBe("
|
|
74
|
+
expect(tabs[1].getAttribute("tabindex")).toBe("-1");
|
|
75
|
+
expect(tabs[2].getAttribute("tabindex")).toBe("3");
|
|
75
76
|
});
|
|
76
77
|
});
|
package/nav-tabs/Tab.js
CHANGED
|
@@ -16,10 +16,11 @@ var _Flex = _interopRequireDefault(require("../flex/Flex"));
|
|
|
16
16
|
var _BaseTypography = _interopRequireDefault(require("../utils/BaseTypography"));
|
|
17
17
|
var _useTheme = _interopRequireDefault(require("../useTheme"));
|
|
18
18
|
var _NavTabsContext = require("./NavTabsContext");
|
|
19
|
+
var _Icon = _interopRequireDefault(require("../icon/Icon"));
|
|
19
20
|
var _templateObject, _templateObject2, _templateObject3;
|
|
20
21
|
var _excluded = ["href", "active", "icon", "disabled", "notificationNumber", "children"];
|
|
21
22
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
22
|
-
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u &&
|
|
23
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
|
|
23
24
|
var DxcTab = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, _ref2) {
|
|
24
25
|
var href = _ref.href,
|
|
25
26
|
_ref$active = _ref.active,
|
|
@@ -52,10 +53,7 @@ var DxcTab = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, _ref2) {
|
|
|
52
53
|
}
|
|
53
54
|
};
|
|
54
55
|
return /*#__PURE__*/_react["default"].createElement(TabContainer, {
|
|
55
|
-
active: active
|
|
56
|
-
role: "tab",
|
|
57
|
-
"aria-selected": active,
|
|
58
|
-
"aria-disabled": disabled
|
|
56
|
+
active: active
|
|
59
57
|
}, /*#__PURE__*/_react["default"].createElement(Tab, (0, _extends2["default"])({
|
|
60
58
|
href: !disabled ? href : undefined,
|
|
61
59
|
disabled: disabled,
|
|
@@ -69,11 +67,16 @@ var DxcTab = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, _ref2) {
|
|
|
69
67
|
}
|
|
70
68
|
},
|
|
71
69
|
onKeyDown: handleOnKeyDown,
|
|
72
|
-
tabIndex: active ? tabIndex : -1
|
|
70
|
+
tabIndex: active ? tabIndex : -1,
|
|
71
|
+
role: "tab",
|
|
72
|
+
"aria-selected": active,
|
|
73
|
+
"aria-disabled": disabled
|
|
73
74
|
}, otherProps), icon && /*#__PURE__*/_react["default"].createElement(TabIconContainer, {
|
|
74
|
-
iconPosition: iconPosition
|
|
75
|
-
|
|
76
|
-
|
|
75
|
+
iconPosition: iconPosition,
|
|
76
|
+
active: active,
|
|
77
|
+
disabled: disabled
|
|
78
|
+
}, typeof icon === "string" ? /*#__PURE__*/_react["default"].createElement(_Icon["default"], {
|
|
79
|
+
icon: icon
|
|
77
80
|
}) : icon), /*#__PURE__*/_react["default"].createElement(_Flex["default"], {
|
|
78
81
|
alignItems: "center",
|
|
79
82
|
gap: "0.5rem"
|
|
@@ -92,14 +95,8 @@ var DxcTab = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, _ref2) {
|
|
|
92
95
|
label: typeof notificationNumber === "number" && notificationNumber
|
|
93
96
|
}))));
|
|
94
97
|
});
|
|
95
|
-
var TabContainer = _styledComponents["default"].div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["\n align-items: stretch;\n border-bottom: 2px solid ", ";\n padding: 0.5rem;\n
|
|
96
|
-
return props.active ? props.theme.selectedUnderlineColor :
|
|
97
|
-
}, function (props) {
|
|
98
|
-
return props.theme.unselectedIconColor;
|
|
99
|
-
}, function (props) {
|
|
100
|
-
return props.theme.selectedIconColor;
|
|
101
|
-
}, function (props) {
|
|
102
|
-
return props.theme.disabledIconColor;
|
|
98
|
+
var TabContainer = _styledComponents["default"].div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["\n align-items: stretch;\n border-bottom: 2px solid ", ";\n padding: 0.5rem;\n"])), function (props) {
|
|
99
|
+
return props.active ? props.theme.selectedUnderlineColor : "transparent";
|
|
103
100
|
});
|
|
104
101
|
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 text-decoration-line: none;\n cursor: ", ";\n\n ", "\n"])), function (props) {
|
|
105
102
|
return props.hasIcon && props.iconPosition === "top" ? "column" : "row";
|
|
@@ -114,5 +111,7 @@ var Tab = _styledComponents["default"].a(_templateObject2 || (_templateObject2 =
|
|
|
114
111
|
}, function (props) {
|
|
115
112
|
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
113
|
});
|
|
117
|
-
var TabIconContainer = _styledComponents["default"].div(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n
|
|
114
|
+
var TabIconContainer = _styledComponents["default"].div(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n font-size: 24px;\n color: ", ";\n svg {\n height: 24px;\n width: 24px;\n }\n"])), function (props) {
|
|
115
|
+
return props.active ? props.theme.selectedIconColor : props.disabled ? props.theme.disabledIconColor : props.theme.unselectedIconColor;
|
|
116
|
+
});
|
|
118
117
|
var _default = exports["default"] = DxcTab;
|
package/nav-tabs/types.d.ts
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|