@dxc-technology/halstack-react 0.0.0-59b9187 → 0.0.0-5a4d834
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 +41 -3
- package/HalstackContext.js +28 -18
- package/accordion/Accordion.accessibility.test.d.ts +1 -0
- package/accordion/Accordion.accessibility.test.js +4 -4
- package/accordion/Accordion.js +6 -9
- package/accordion/Accordion.stories.tsx +4 -14
- package/accordion/Accordion.test.d.ts +1 -0
- package/accordion/Accordion.test.js +3 -3
- package/accordion-group/AccordionGroup.accessibility.test.d.ts +1 -0
- package/accordion-group/AccordionGroup.accessibility.test.js +11 -17
- 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/action-icon/ActionIcon.accessibility.test.d.ts +1 -0
- package/action-icon/ActionIcon.accessibility.test.js +4 -4
- package/action-icon/ActionIcon.test.d.ts +1 -0
- package/action-icon/ActionIcon.test.js +1 -1
- package/alert/Alert.accessibility.test.d.ts +1 -0
- package/alert/Alert.accessibility.test.js +6 -6
- package/alert/Alert.js +7 -4
- 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 +5 -5
- package/badge/Badge.test.d.ts +1 -0
- package/badge/Badge.test.js +2 -2
- 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 +137 -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 +3 -3
- 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 +18 -6
- package/bulleted-list/BulletedList.js +1 -1
- package/button/Button.accessibility.test.d.ts +1 -0
- package/button/Button.accessibility.test.js +6 -6
- package/button/Button.js +1 -1
- package/button/Button.stories.tsx +3 -3
- 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 +3 -3
- 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 +5 -5
- 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 +4 -4
- package/chip/Chip.js +3 -1
- package/chip/Chip.stories.tsx +1 -1
- package/chip/Chip.test.d.ts +1 -0
- package/chip/Chip.test.js +1 -1
- package/common/coreTokens.d.ts +0 -1
- package/common/coreTokens.js +3 -4
- package/common/variables.d.ts +47 -3
- package/common/variables.js +109 -71
- 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 +15 -3
- 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 +24 -11
- package/date-input/DateInput.js +27 -21
- 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 +1 -1
- package/date-input/YearPicker.js +10 -5
- package/dialog/Dialog.accessibility.test.d.ts +1 -0
- package/dialog/Dialog.accessibility.test.js +5 -5
- package/dialog/Dialog.js +3 -2
- package/dialog/Dialog.stories.tsx +8 -4
- package/dialog/Dialog.test.d.ts +1 -0
- package/dialog/Dialog.test.js +111 -48
- package/divider/Divider.accessibility.test.d.ts +1 -0
- package/divider/Divider.accessibility.test.js +2 -2
- 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 +12 -9
- package/dropdown/Dropdown.js +19 -37
- package/dropdown/Dropdown.stories.tsx +11 -11
- 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 +2 -1
- package/file-input/FileInput.accessibility.test.d.ts +1 -0
- package/file-input/FileInput.accessibility.test.js +30 -23
- package/file-input/FileInput.js +3 -8
- package/file-input/FileInput.test.d.ts +1 -0
- package/file-input/FileInput.test.js +44 -22
- package/file-input/FileItem.js +7 -3
- package/file-input/types.d.ts +0 -4
- package/footer/Footer.accessibility.test.d.ts +1 -0
- package/footer/Footer.accessibility.test.js +13 -5
- package/footer/Footer.js +1 -1
- package/footer/Footer.stories.tsx +12 -0
- package/footer/Footer.test.d.ts +1 -0
- package/footer/Footer.test.js +1 -1
- package/footer/Icons.js +2 -30
- package/grid/Grid.stories.tsx +3 -1
- package/header/Header.accessibility.test.d.ts +1 -0
- package/header/Header.accessibility.test.js +16 -6
- package/header/Header.js +3 -2
- 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 +3 -3
- 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 +2 -2
- package/icon/Icon.js +1 -1
- package/icon/Icon.stories.tsx +1 -1
- package/image/Image.accessibility.test.d.ts +1 -0
- package/image/Image.accessibility.test.js +3 -3
- package/image/Image.js +1 -1
- package/layout/ApplicationLayout.js +4 -4
- package/link/Link.accessibility.test.d.ts +1 -0
- package/link/Link.accessibility.test.js +8 -12
- package/link/Link.js +1 -1
- package/link/Link.stories.tsx +2 -2
- package/link/Link.test.d.ts +1 -0
- package/link/Link.test.js +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 +3 -3
- package/nav-tabs/NavTabs.js +19 -4
- package/nav-tabs/NavTabs.stories.tsx +18 -3
- package/nav-tabs/NavTabs.test.d.ts +1 -0
- package/nav-tabs/NavTabs.test.js +9 -7
- package/nav-tabs/Tab.js +7 -7
- package/number-input/NumberInput.accessibility.test.d.ts +1 -0
- package/number-input/NumberInput.accessibility.test.js +9 -10
- 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 +27 -21
- package/paginator/Paginator.accessibility.test.d.ts +1 -0
- package/paginator/Paginator.accessibility.test.js +4 -5
- package/paginator/Paginator.js +9 -5
- 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 +2 -2
- package/password-input/PasswordInput.accessibility.test.d.ts +1 -0
- package/password-input/PasswordInput.accessibility.test.js +7 -8
- package/password-input/PasswordInput.js +11 -7
- 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 +3 -3
- 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 +2 -2
- 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 +4 -4
- 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 +16 -6
- package/resultset-table/ResultsetTable.js +41 -13
- package/resultset-table/ResultsetTable.stories.tsx +14 -2
- package/resultset-table/ResultsetTable.test.d.ts +1 -0
- package/resultset-table/ResultsetTable.test.js +103 -34
- package/resultset-table/types.d.ts +4 -3
- package/select/Listbox.d.ts +3 -3
- package/select/Listbox.js +29 -27
- package/select/Option.d.ts +3 -3
- package/select/Option.js +13 -8
- package/select/Select.accessibility.test.d.ts +1 -0
- package/select/Select.accessibility.test.js +18 -8
- package/select/Select.js +75 -190
- package/select/Select.stories.tsx +41 -20
- package/select/Select.test.d.ts +1 -0
- package/select/Select.test.js +42 -150
- package/select/selectUtils.d.ts +41 -0
- package/select/selectUtils.js +129 -0
- package/sidenav/Sidenav.accessibility.test.d.ts +1 -0
- package/sidenav/Sidenav.accessibility.test.js +3 -3
- package/sidenav/Sidenav.js +1 -1
- package/sidenav/Sidenav.stories.tsx +1 -1
- package/sidenav/Sidenav.test.d.ts +1 -0
- package/sidenav/Sidenav.test.js +1 -1
- package/slider/Slider.accessibility.test.d.ts +1 -0
- package/slider/Slider.accessibility.test.js +5 -6
- 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 +6 -6
- 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 +8 -8
- 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 +14 -5
- 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 +16 -6
- package/table/Table.js +1 -1
- package/table/Table.stories.tsx +13 -1
- package/table/Table.test.d.ts +1 -0
- package/table/Table.test.js +2 -4
- package/tabs/Tab.js +1 -1
- package/tabs/Tabs.accessibility.test.d.ts +1 -0
- package/tabs/Tabs.accessibility.test.js +3 -3
- package/tabs/Tabs.js +1 -1
- package/tabs/Tabs.stories.tsx +7 -1
- package/tabs/Tabs.test.d.ts +1 -0
- package/tabs/Tabs.test.js +1 -1
- package/tag/Tag.accessibility.test.d.ts +1 -0
- package/tag/Tag.accessibility.test.js +4 -4
- package/tag/Tag.js +1 -1
- package/tag/Tag.stories.tsx +1 -1
- package/tag/Tag.test.d.ts +1 -0
- package/tag/Tag.test.js +1 -1
- package/text-input/Suggestion.js +1 -1
- package/text-input/Suggestions.js +14 -6
- package/text-input/TextInput.accessibility.test.d.ts +1 -0
- package/text-input/TextInput.accessibility.test.js +11 -12
- package/text-input/TextInput.js +49 -68
- package/text-input/TextInput.stories.tsx +19 -7
- 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 +7 -7
- 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 +5 -5
- package/toggle-group/ToggleGroup.js +6 -9
- package/toggle-group/ToggleGroup.stories.tsx +1 -1
- package/toggle-group/ToggleGroup.test.d.ts +1 -0
- package/toggle-group/ToggleGroup.test.js +1 -1
- 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 +12 -12
- package/typography/Typography.stories.tsx +1 -3
- package/typography/Typography.test.js +23 -0
- package/useTheme.d.ts +30 -3
- 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 +3 -3
- package/wizard/Wizard.js +1 -9
- package/wizard/Wizard.stories.tsx +1 -1
- package/wizard/Wizard.test.d.ts +1 -0
- package/wizard/Wizard.test.js +1 -1
- package/contextual-menu/MenuItemAction.d.ts +0 -4
- package/contextual-menu/MenuItemAction.js +0 -46
|
@@ -0,0 +1,112 @@
|
|
|
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 _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
7
|
+
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
var _react2 = require("@testing-library/react");
|
|
10
|
+
var _Tooltip = _interopRequireDefault(require("./Tooltip"));
|
|
11
|
+
var _Button = _interopRequireDefault(require("../button/Button"));
|
|
12
|
+
var _userEvent = _interopRequireDefault(require("@testing-library/user-event"));
|
|
13
|
+
require("@testing-library/jest-dom");
|
|
14
|
+
global.globalThis = global;
|
|
15
|
+
global.DOMRect = {
|
|
16
|
+
fromRect: function fromRect() {
|
|
17
|
+
return {
|
|
18
|
+
top: 0,
|
|
19
|
+
left: 0,
|
|
20
|
+
bottom: 0,
|
|
21
|
+
right: 0,
|
|
22
|
+
width: 0,
|
|
23
|
+
height: 0,
|
|
24
|
+
x: 0,
|
|
25
|
+
y: 0
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
global.ResizeObserver = /*#__PURE__*/function () {
|
|
30
|
+
function ResizeObserver() {
|
|
31
|
+
(0, _classCallCheck2["default"])(this, ResizeObserver);
|
|
32
|
+
}
|
|
33
|
+
return (0, _createClass2["default"])(ResizeObserver, [{
|
|
34
|
+
key: "observe",
|
|
35
|
+
value: function observe() {}
|
|
36
|
+
}, {
|
|
37
|
+
key: "unobserve",
|
|
38
|
+
value: function unobserve() {}
|
|
39
|
+
}, {
|
|
40
|
+
key: "disconnect",
|
|
41
|
+
value: function disconnect() {}
|
|
42
|
+
}]);
|
|
43
|
+
}();
|
|
44
|
+
describe("Tooltip component tests", function () {
|
|
45
|
+
test("Tooltip does not render by default", /*#__PURE__*/(0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee() {
|
|
46
|
+
var _render, queryByRole;
|
|
47
|
+
return _regenerator["default"].wrap(function _callee$(_context) {
|
|
48
|
+
while (1) switch (_context.prev = _context.next) {
|
|
49
|
+
case 0:
|
|
50
|
+
_render = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Tooltip["default"], {
|
|
51
|
+
label: "Tooltip Test"
|
|
52
|
+
}, /*#__PURE__*/_react["default"].createElement(_Button["default"], {
|
|
53
|
+
label: "Hoverable button"
|
|
54
|
+
}))), queryByRole = _render.queryByRole;
|
|
55
|
+
_context.next = 3;
|
|
56
|
+
return (0, _react2.waitFor)(function () {
|
|
57
|
+
var tooltipElement = queryByRole("tooltip");
|
|
58
|
+
expect(tooltipElement).toBeFalsy();
|
|
59
|
+
});
|
|
60
|
+
case 3:
|
|
61
|
+
case "end":
|
|
62
|
+
return _context.stop();
|
|
63
|
+
}
|
|
64
|
+
}, _callee);
|
|
65
|
+
})));
|
|
66
|
+
test("Tooltip renders with correct label on hover", /*#__PURE__*/(0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee2() {
|
|
67
|
+
var _render2, getByText, triggerElement;
|
|
68
|
+
return _regenerator["default"].wrap(function _callee2$(_context2) {
|
|
69
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
70
|
+
case 0:
|
|
71
|
+
_render2 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Tooltip["default"], {
|
|
72
|
+
label: "Tooltip Test"
|
|
73
|
+
}, /*#__PURE__*/_react["default"].createElement(_Button["default"], {
|
|
74
|
+
label: "Hoverable button"
|
|
75
|
+
}))), getByText = _render2.getByText;
|
|
76
|
+
triggerElement = getByText("Hoverable button");
|
|
77
|
+
_userEvent["default"].hover(triggerElement);
|
|
78
|
+
_context2.next = 5;
|
|
79
|
+
return _react2.screen.findByRole("tooltip", {
|
|
80
|
+
name: "Tooltip Test"
|
|
81
|
+
});
|
|
82
|
+
case 5:
|
|
83
|
+
case "end":
|
|
84
|
+
return _context2.stop();
|
|
85
|
+
}
|
|
86
|
+
}, _callee2);
|
|
87
|
+
})));
|
|
88
|
+
test("Tooltip stops being rendered when hover is stopped", /*#__PURE__*/(0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee3() {
|
|
89
|
+
var _render3, getByText, queryByRole, triggerElement;
|
|
90
|
+
return _regenerator["default"].wrap(function _callee3$(_context3) {
|
|
91
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
92
|
+
case 0:
|
|
93
|
+
_render3 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Tooltip["default"], {
|
|
94
|
+
label: "Tooltip Test"
|
|
95
|
+
}, /*#__PURE__*/_react["default"].createElement(_Button["default"], {
|
|
96
|
+
label: "Hoverable button"
|
|
97
|
+
}))), getByText = _render3.getByText, queryByRole = _render3.queryByRole;
|
|
98
|
+
triggerElement = getByText("Hoverable button");
|
|
99
|
+
_userEvent["default"].hover(triggerElement);
|
|
100
|
+
_userEvent["default"].unhover(triggerElement);
|
|
101
|
+
_context3.next = 6;
|
|
102
|
+
return (0, _react2.waitFor)(function () {
|
|
103
|
+
var tooltipElement = queryByRole("tooltip");
|
|
104
|
+
expect(tooltipElement).toBeFalsy();
|
|
105
|
+
});
|
|
106
|
+
case 6:
|
|
107
|
+
case "end":
|
|
108
|
+
return _context3.stop();
|
|
109
|
+
}
|
|
110
|
+
}, _callee3);
|
|
111
|
+
})));
|
|
112
|
+
});
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
type Props = {
|
|
3
|
+
/**
|
|
4
|
+
* Preferred position for displaying the tooltip. It may adjust automatically based on available space.
|
|
5
|
+
*/
|
|
6
|
+
position?: "bottom" | "top" | "left" | "right";
|
|
7
|
+
/**
|
|
8
|
+
* Text to be displayed inside the tooltip.
|
|
9
|
+
*/
|
|
10
|
+
label: string;
|
|
11
|
+
/**
|
|
12
|
+
* Content in which the Tooltip will be displayed.
|
|
13
|
+
*/
|
|
14
|
+
children: React.ReactNode;
|
|
15
|
+
};
|
|
16
|
+
export default Props;
|
package/tooltip/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -5,7 +5,7 @@ var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"))
|
|
|
5
5
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
6
6
|
var _react = _interopRequireDefault(require("react"));
|
|
7
7
|
var _react2 = require("@testing-library/react");
|
|
8
|
-
var
|
|
8
|
+
var _axeHelper = require("../../test/accessibility/axe-helper.js");
|
|
9
9
|
var _Typography = _interopRequireDefault(require("./Typography"));
|
|
10
10
|
var _Flex = _interopRequireDefault(require("../flex/Flex"));
|
|
11
11
|
describe("Typography component accessibility tests", function () {
|
|
@@ -40,7 +40,7 @@ describe("Typography component accessibility tests", function () {
|
|
|
40
40
|
fontSize: "0.75rem"
|
|
41
41
|
}, "0.75rem."))), container = _render.container;
|
|
42
42
|
_context.next = 3;
|
|
43
|
-
return (0,
|
|
43
|
+
return (0, _axeHelper.axe)(container);
|
|
44
44
|
case 3:
|
|
45
45
|
results = _context.sent;
|
|
46
46
|
expect(results).toHaveNoViolations();
|
|
@@ -75,7 +75,7 @@ describe("Typography component accessibility tests", function () {
|
|
|
75
75
|
letterSpacing: "0.1em"
|
|
76
76
|
}, "0.1em."))), container = _render2.container;
|
|
77
77
|
_context2.next = 3;
|
|
78
|
-
return (0,
|
|
78
|
+
return (0, _axeHelper.axe)(container);
|
|
79
79
|
case 3:
|
|
80
80
|
results = _context2.sent;
|
|
81
81
|
expect(results).toHaveNoViolations();
|
|
@@ -110,7 +110,7 @@ describe("Typography component accessibility tests", function () {
|
|
|
110
110
|
lineHeight: "2em"
|
|
111
111
|
}, "2em."))), container = _render3.container;
|
|
112
112
|
_context3.next = 3;
|
|
113
|
-
return (0,
|
|
113
|
+
return (0, _axeHelper.axe)(container);
|
|
114
114
|
case 3:
|
|
115
115
|
results = _context3.sent;
|
|
116
116
|
expect(results).toHaveNoViolations();
|
|
@@ -139,7 +139,7 @@ describe("Typography component accessibility tests", function () {
|
|
|
139
139
|
fontWeight: "700"
|
|
140
140
|
}, "700."))), container = _render4.container;
|
|
141
141
|
_context4.next = 3;
|
|
142
|
-
return (0,
|
|
142
|
+
return (0, _axeHelper.axe)(container);
|
|
143
143
|
case 3:
|
|
144
144
|
results = _context4.sent;
|
|
145
145
|
expect(results).toHaveNoViolations();
|
|
@@ -162,7 +162,7 @@ describe("Typography component accessibility tests", function () {
|
|
|
162
162
|
textDecoration: "line-through"
|
|
163
163
|
}, "Line-through."))), container = _render5.container;
|
|
164
164
|
_context5.next = 3;
|
|
165
|
-
return (0,
|
|
165
|
+
return (0, _axeHelper.axe)(container);
|
|
166
166
|
case 3:
|
|
167
167
|
results = _context5.sent;
|
|
168
168
|
expect(results).toHaveNoViolations();
|
|
@@ -185,7 +185,7 @@ describe("Typography component accessibility tests", function () {
|
|
|
185
185
|
fontFamily: "Source Code Pro, monospace"
|
|
186
186
|
}, "Source Code Pro, monospace."))), container = _render6.container;
|
|
187
187
|
_context6.next = 3;
|
|
188
|
-
return (0,
|
|
188
|
+
return (0, _axeHelper.axe)(container);
|
|
189
189
|
case 3:
|
|
190
190
|
results = _context6.sent;
|
|
191
191
|
expect(results).toHaveNoViolations();
|
|
@@ -208,7 +208,7 @@ describe("Typography component accessibility tests", function () {
|
|
|
208
208
|
fontStyle: "normal"
|
|
209
209
|
}, "Normal."))), container = _render7.container;
|
|
210
210
|
_context7.next = 3;
|
|
211
|
-
return (0,
|
|
211
|
+
return (0, _axeHelper.axe)(container);
|
|
212
212
|
case 3:
|
|
213
213
|
results = _context7.sent;
|
|
214
214
|
expect(results).toHaveNoViolations();
|
|
@@ -234,7 +234,7 @@ describe("Typography component accessibility tests", function () {
|
|
|
234
234
|
textAlign: "right"
|
|
235
235
|
}, "Right."))), container = _render8.container;
|
|
236
236
|
_context8.next = 3;
|
|
237
|
-
return (0,
|
|
237
|
+
return (0, _axeHelper.axe)(container);
|
|
238
238
|
case 3:
|
|
239
239
|
results = _context8.sent;
|
|
240
240
|
expect(results).toHaveNoViolations();
|
|
@@ -265,7 +265,7 @@ describe("Typography component accessibility tests", function () {
|
|
|
265
265
|
fontSize: "2rem"
|
|
266
266
|
}, " ", " pre-wrap: A bunch of words you see."))), container = _render9.container;
|
|
267
267
|
_context9.next = 3;
|
|
268
|
-
return (0,
|
|
268
|
+
return (0, _axeHelper.axe)(container);
|
|
269
269
|
case 3:
|
|
270
270
|
results = _context9.sent;
|
|
271
271
|
expect(results).toHaveNoViolations();
|
|
@@ -288,7 +288,7 @@ describe("Typography component accessibility tests", function () {
|
|
|
288
288
|
textAlign: "left"
|
|
289
289
|
}, "Display Inline.", /*#__PURE__*/_react["default"].createElement(_Typography["default"], null, "A different text.")))), container = _render10.container;
|
|
290
290
|
_context10.next = 3;
|
|
291
|
-
return (0,
|
|
291
|
+
return (0, _axeHelper.axe)(container);
|
|
292
292
|
case 3:
|
|
293
293
|
results = _context10.sent;
|
|
294
294
|
expect(results).toHaveNoViolations();
|
|
@@ -326,7 +326,7 @@ describe("Typography component accessibility tests", function () {
|
|
|
326
326
|
textOverflow: "unset"
|
|
327
327
|
}, "Overflow unset.")))), container = _render11.container;
|
|
328
328
|
_context11.next = 3;
|
|
329
|
-
return (0,
|
|
329
|
+
return (0, _axeHelper.axe)(container);
|
|
330
330
|
case 3:
|
|
331
331
|
results = _context11.sent;
|
|
332
332
|
expect(results).toHaveNoViolations();
|
|
@@ -140,9 +140,7 @@ export const Chromatic = () => (
|
|
|
140
140
|
<ExampleContainer>
|
|
141
141
|
<Title title="Typography whitespace" theme="light" level={4} />
|
|
142
142
|
<div style={{ margin: "50px", border: "1px solid red", width: "125px" }}>
|
|
143
|
-
<DxcTypography fontSize="2rem">
|
|
144
|
-
{" "} Normal: A bunch of words you see.
|
|
145
|
-
</DxcTypography>
|
|
143
|
+
<DxcTypography fontSize="2rem">{" "} Normal: A bunch of words you see.</DxcTypography>
|
|
146
144
|
</div>
|
|
147
145
|
<div style={{ margin: "50px", border: "1px solid red", width: "125px" }}>
|
|
148
146
|
<DxcTypography whiteSpace="nowrap" fontSize="2rem">
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
var _react = _interopRequireDefault(require("react"));
|
|
5
|
+
var _react2 = require("@testing-library/react");
|
|
6
|
+
var _Typography = _interopRequireDefault(require("./Typography"));
|
|
7
|
+
describe("Typography component tests", function () {
|
|
8
|
+
test("Renders as the selected component", function () {
|
|
9
|
+
var _render = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Typography["default"], {
|
|
10
|
+
as: "h1"
|
|
11
|
+
}, "Test H1 Text")),
|
|
12
|
+
container = _render.container;
|
|
13
|
+
expect(container.querySelector('h1')).not.toBeNull();
|
|
14
|
+
});
|
|
15
|
+
test("Renders as span if it receives invalid tag", function () {
|
|
16
|
+
var _render2 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Typography["default"], {
|
|
17
|
+
as: "br"
|
|
18
|
+
}, "Test BR Text")),
|
|
19
|
+
container = _render2.container;
|
|
20
|
+
expect(container.querySelector('br')).toBeNull();
|
|
21
|
+
expect(container.querySelector('span')).not.toBeNull();
|
|
22
|
+
});
|
|
23
|
+
});
|
package/useTheme.d.ts
CHANGED
|
@@ -217,6 +217,29 @@ declare const useTheme: () => {
|
|
|
217
217
|
focusBorderThickness: string;
|
|
218
218
|
focusBorderRadius: string;
|
|
219
219
|
}>;
|
|
220
|
+
contextualMenu?: Partial<{
|
|
221
|
+
fontFamily: string;
|
|
222
|
+
backgroundColor: string;
|
|
223
|
+
borderColor: string;
|
|
224
|
+
menuItemFontColor: string;
|
|
225
|
+
menuItemFontSize: string;
|
|
226
|
+
menuItemFontStyle: string;
|
|
227
|
+
menuItemFontWeight: string;
|
|
228
|
+
menuItemLineHeight: string;
|
|
229
|
+
hoverMenuItemBackgroundColor: string;
|
|
230
|
+
activeMenuItemBackgroundColor: string;
|
|
231
|
+
selectedMenuItemBackgroundColor: string;
|
|
232
|
+
hoverSelectedMenuItemBackgroundColor: string;
|
|
233
|
+
activeSelectedMenuItemBackgroundColor: string;
|
|
234
|
+
selectedMenuItemFontWeight: string;
|
|
235
|
+
sectionTitleFontColor: string;
|
|
236
|
+
sectionTitleFontSize: string;
|
|
237
|
+
sectionTitleFontStyle: string;
|
|
238
|
+
sectionTitleFontWeight: string;
|
|
239
|
+
sectionTitleLineHeight: string;
|
|
240
|
+
iconColor: string;
|
|
241
|
+
iconSize: string;
|
|
242
|
+
}>;
|
|
220
243
|
dateInput?: Partial<{
|
|
221
244
|
pickerBackgroundColor: string;
|
|
222
245
|
pickerFontColor: string;
|
|
@@ -289,7 +312,6 @@ declare const useTheme: () => {
|
|
|
289
312
|
disabledColor: string;
|
|
290
313
|
disabledButtonBackgroundColor: string;
|
|
291
314
|
disabledButtonBorderColor: string;
|
|
292
|
-
disabledBorderColor: string;
|
|
293
315
|
optionBackgroundColor: string;
|
|
294
316
|
hoverOptionBackgroundColor: string;
|
|
295
317
|
activeOptionBackgroundColor: string;
|
|
@@ -329,7 +351,6 @@ declare const useTheme: () => {
|
|
|
329
351
|
focusDropBorderColor: string;
|
|
330
352
|
disabledDropBorderColor: string;
|
|
331
353
|
dragoverDropBackgroundColor: string;
|
|
332
|
-
activeFileItemIconBackgrounColor: string;
|
|
333
354
|
errorFileItemBorderColor: string;
|
|
334
355
|
errorFileItemBackgroundColor: string;
|
|
335
356
|
errorFilePreviewBackgroundColor: string;
|
|
@@ -530,8 +551,8 @@ declare const useTheme: () => {
|
|
|
530
551
|
totalItemsContainerMarginLeft: string;
|
|
531
552
|
}>;
|
|
532
553
|
paragraph?: Partial<{
|
|
533
|
-
fontColor: string;
|
|
534
554
|
display: string;
|
|
555
|
+
fontColor: string;
|
|
535
556
|
fontSize: string;
|
|
536
557
|
fontWeight: string;
|
|
537
558
|
}>;
|
|
@@ -999,7 +1020,13 @@ declare const useTheme: () => {
|
|
|
999
1020
|
helperTextLineHeight: string;
|
|
1000
1021
|
disabledHelperTextFontColor: string;
|
|
1001
1022
|
prefixColor: string;
|
|
1023
|
+
prefixDividerBorderWidth: string;
|
|
1024
|
+
prefixDividerBorderStyle: string;
|
|
1025
|
+
prefixDividerPaddingRight: string;
|
|
1002
1026
|
suffixColor: string;
|
|
1027
|
+
suffixDividerBorderStyle: string;
|
|
1028
|
+
suffixDividerBorderWidth: string;
|
|
1029
|
+
suffixDividerPaddingLeft: string;
|
|
1003
1030
|
disabledPrefixColor: string;
|
|
1004
1031
|
disabledSuffixColor: string;
|
|
1005
1032
|
placeholderFontColor: string;
|
package/useTranslatedLabels.d.ts
CHANGED
|
@@ -16,6 +16,17 @@ declare const useTranslatedLabels: () => {
|
|
|
16
16
|
warningTitleText: string;
|
|
17
17
|
errorTitleText: string;
|
|
18
18
|
}>;
|
|
19
|
+
barChart?: Partial<{
|
|
20
|
+
ariaLabel: string;
|
|
21
|
+
filterLabel: string;
|
|
22
|
+
filterPlaceholder: string;
|
|
23
|
+
loadingDataMessage: string;
|
|
24
|
+
noDataMessageBody: string;
|
|
25
|
+
noDataMessageTitle: string;
|
|
26
|
+
noMatchesMessageBody: string;
|
|
27
|
+
noMatchesMessageTitle: string;
|
|
28
|
+
retryButtonLabel: string;
|
|
29
|
+
}>;
|
|
19
30
|
dateInput?: Partial<{
|
|
20
31
|
invalidDateErrorMessage: string;
|
|
21
32
|
}>;
|
package/utils/BaseTypography.js
CHANGED
|
@@ -11,8 +11,12 @@ var _react = _interopRequireWildcard(require("react"));
|
|
|
11
11
|
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
12
12
|
var _templateObject;
|
|
13
13
|
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); }
|
|
14
|
-
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 &&
|
|
14
|
+
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; }
|
|
15
15
|
var TypographyContext = /*#__PURE__*/_react["default"].createContext(null);
|
|
16
|
+
var ValidTypographyTags = ["a", "blockquote", "cite", "code", "div", "em", "figcaption", "h1", "h2", "h3", "h4", "h5", "h6", "p", "pre", "small", "span", "strong"];
|
|
17
|
+
var isValidTypography = function isValidTypography(tag) {
|
|
18
|
+
return ValidTypographyTags.includes(tag);
|
|
19
|
+
};
|
|
16
20
|
var BaseTypography = function BaseTypography(_ref) {
|
|
17
21
|
var as = _ref.as,
|
|
18
22
|
display = _ref.display,
|
|
@@ -30,65 +34,65 @@ var BaseTypography = function BaseTypography(_ref) {
|
|
|
30
34
|
children = _ref.children;
|
|
31
35
|
var componentContext = (0, _react.useContext)(TypographyContext);
|
|
32
36
|
var contextValue = (0, _react.useMemo)(function () {
|
|
33
|
-
var _ref2, _ref3, _ref4, _ref5, _ref6, _ref7, _ref8, _ref9, _ref10, _ref11, _ref12, _ref13
|
|
37
|
+
var _ref2, _ref3, _ref4, _ref5, _ref6, _ref7, _ref8, _ref9, _ref10, _ref11, _ref12, _ref13;
|
|
34
38
|
return {
|
|
35
|
-
as: (
|
|
36
|
-
display: (
|
|
37
|
-
fontFamily: (
|
|
38
|
-
fontSize: (
|
|
39
|
-
fontStyle: (
|
|
40
|
-
fontWeight: (
|
|
41
|
-
letterSpacing: (
|
|
42
|
-
lineHeight: (
|
|
43
|
-
textAlign: (
|
|
44
|
-
color: (
|
|
45
|
-
textDecoration: (
|
|
46
|
-
textOverflow: (
|
|
47
|
-
whiteSpace: (
|
|
39
|
+
as: isValidTypography(as) ? as : isValidTypography(componentContext === null || componentContext === void 0 ? void 0 : componentContext.as) ? componentContext === null || componentContext === void 0 ? void 0 : componentContext.as : "span",
|
|
40
|
+
display: (_ref2 = display !== null && display !== void 0 ? display : componentContext === null || componentContext === void 0 ? void 0 : componentContext.display) !== null && _ref2 !== void 0 ? _ref2 : "inline",
|
|
41
|
+
fontFamily: (_ref3 = fontFamily !== null && fontFamily !== void 0 ? fontFamily : componentContext === null || componentContext === void 0 ? void 0 : componentContext.fontFamily) !== null && _ref3 !== void 0 ? _ref3 : "Open Sans, sans-serif",
|
|
42
|
+
fontSize: (_ref4 = fontSize !== null && fontSize !== void 0 ? fontSize : componentContext === null || componentContext === void 0 ? void 0 : componentContext.fontSize) !== null && _ref4 !== void 0 ? _ref4 : "1rem",
|
|
43
|
+
fontStyle: (_ref5 = fontStyle !== null && fontStyle !== void 0 ? fontStyle : componentContext === null || componentContext === void 0 ? void 0 : componentContext.fontStyle) !== null && _ref5 !== void 0 ? _ref5 : "normal",
|
|
44
|
+
fontWeight: (_ref6 = fontWeight !== null && fontWeight !== void 0 ? fontWeight : componentContext === null || componentContext === void 0 ? void 0 : componentContext.fontWeight) !== null && _ref6 !== void 0 ? _ref6 : "400",
|
|
45
|
+
letterSpacing: (_ref7 = letterSpacing !== null && letterSpacing !== void 0 ? letterSpacing : componentContext === null || componentContext === void 0 ? void 0 : componentContext.letterSpacing) !== null && _ref7 !== void 0 ? _ref7 : "0em",
|
|
46
|
+
lineHeight: (_ref8 = lineHeight !== null && lineHeight !== void 0 ? lineHeight : componentContext === null || componentContext === void 0 ? void 0 : componentContext.lineHeight) !== null && _ref8 !== void 0 ? _ref8 : "1.5em",
|
|
47
|
+
textAlign: (_ref9 = textAlign !== null && textAlign !== void 0 ? textAlign : componentContext === null || componentContext === void 0 ? void 0 : componentContext.textAlign) !== null && _ref9 !== void 0 ? _ref9 : "left",
|
|
48
|
+
color: (_ref10 = color !== null && color !== void 0 ? color : componentContext === null || componentContext === void 0 ? void 0 : componentContext.color) !== null && _ref10 !== void 0 ? _ref10 : "#000000",
|
|
49
|
+
textDecoration: (_ref11 = textDecoration !== null && textDecoration !== void 0 ? textDecoration : componentContext === null || componentContext === void 0 ? void 0 : componentContext.textDecoration) !== null && _ref11 !== void 0 ? _ref11 : "none",
|
|
50
|
+
textOverflow: (_ref12 = textOverflow !== null && textOverflow !== void 0 ? textOverflow : componentContext === null || componentContext === void 0 ? void 0 : componentContext.textOverflow) !== null && _ref12 !== void 0 ? _ref12 : "unset",
|
|
51
|
+
whiteSpace: (_ref13 = whiteSpace !== null && whiteSpace !== void 0 ? whiteSpace : componentContext === null || componentContext === void 0 ? void 0 : componentContext.whiteSpace) !== null && _ref13 !== void 0 ? _ref13 : "normal"
|
|
48
52
|
};
|
|
49
53
|
}, [as, display, fontFamily, fontSize, fontStyle, fontWeight, letterSpacing, lineHeight, textAlign, color, textDecoration, textOverflow, whiteSpace]);
|
|
50
54
|
return /*#__PURE__*/_react["default"].createElement(TypographyContext.Provider, {
|
|
51
55
|
value: contextValue
|
|
52
56
|
}, /*#__PURE__*/_react["default"].createElement(StyledTypography, contextValue, children));
|
|
53
57
|
};
|
|
54
|
-
var StyledTypography = _styledComponents["default"].span(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["\n display: ", ";\n color: ", ";\n font-family: ", ";\n font-size: ", ";\n font-style: ", ";\n font-weight: ", ";\n letter-spacing: ", ";\n line-height: ", ";\n text-align: ", ";\n text-decoration: ", ";\n text-overflow: ", ";\n white-space: ", ";\n overflow: ", ";\n margin: 0;\n"])), function (
|
|
55
|
-
var display =
|
|
58
|
+
var StyledTypography = _styledComponents["default"].span(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["\n display: ", ";\n color: ", ";\n font-family: ", ";\n font-size: ", ";\n font-style: ", ";\n font-weight: ", ";\n letter-spacing: ", ";\n line-height: ", ";\n text-align: ", ";\n text-decoration: ", ";\n text-overflow: ", ";\n white-space: ", ";\n overflow: ", ";\n margin: 0;\n"])), function (_ref14) {
|
|
59
|
+
var display = _ref14.display;
|
|
56
60
|
return display;
|
|
57
|
-
}, function (
|
|
58
|
-
var color =
|
|
61
|
+
}, function (_ref15) {
|
|
62
|
+
var color = _ref15.color;
|
|
59
63
|
return color;
|
|
60
|
-
}, function (
|
|
61
|
-
var fontFamily =
|
|
64
|
+
}, function (_ref16) {
|
|
65
|
+
var fontFamily = _ref16.fontFamily;
|
|
62
66
|
return fontFamily;
|
|
63
|
-
}, function (
|
|
64
|
-
var fontSize =
|
|
67
|
+
}, function (_ref17) {
|
|
68
|
+
var fontSize = _ref17.fontSize;
|
|
65
69
|
return fontSize;
|
|
66
|
-
}, function (
|
|
67
|
-
var fontStyle =
|
|
70
|
+
}, function (_ref18) {
|
|
71
|
+
var fontStyle = _ref18.fontStyle;
|
|
68
72
|
return fontStyle;
|
|
69
|
-
}, function (
|
|
70
|
-
var fontWeight =
|
|
73
|
+
}, function (_ref19) {
|
|
74
|
+
var fontWeight = _ref19.fontWeight;
|
|
71
75
|
return fontWeight;
|
|
72
|
-
}, function (
|
|
73
|
-
var letterSpacing =
|
|
76
|
+
}, function (_ref20) {
|
|
77
|
+
var letterSpacing = _ref20.letterSpacing;
|
|
74
78
|
return letterSpacing;
|
|
75
|
-
}, function (
|
|
76
|
-
var lineHeight =
|
|
79
|
+
}, function (_ref21) {
|
|
80
|
+
var lineHeight = _ref21.lineHeight;
|
|
77
81
|
return lineHeight;
|
|
78
|
-
}, function (
|
|
79
|
-
var textAlign =
|
|
82
|
+
}, function (_ref22) {
|
|
83
|
+
var textAlign = _ref22.textAlign;
|
|
80
84
|
return textAlign;
|
|
81
|
-
}, function (
|
|
82
|
-
var textDecoration =
|
|
85
|
+
}, function (_ref23) {
|
|
86
|
+
var textDecoration = _ref23.textDecoration;
|
|
83
87
|
return textDecoration;
|
|
84
|
-
}, function (
|
|
85
|
-
var textOverflow =
|
|
88
|
+
}, function (_ref24) {
|
|
89
|
+
var textOverflow = _ref24.textOverflow;
|
|
86
90
|
return textOverflow;
|
|
87
|
-
}, function (
|
|
88
|
-
var whiteSpace =
|
|
91
|
+
}, function (_ref25) {
|
|
92
|
+
var whiteSpace = _ref25.whiteSpace;
|
|
89
93
|
return whiteSpace;
|
|
90
|
-
}, function (
|
|
91
|
-
var textOverflow =
|
|
94
|
+
}, function (_ref26) {
|
|
95
|
+
var textOverflow = _ref26.textOverflow;
|
|
92
96
|
return textOverflow !== "unset" ? "hidden" : "visible";
|
|
93
97
|
});
|
|
94
98
|
var _default = exports["default"] = BaseTypography;
|
package/utils/FocusLock.js
CHANGED
|
@@ -9,7 +9,7 @@ exports["default"] = void 0;
|
|
|
9
9
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
10
10
|
var _react = _interopRequireWildcard(require("react"));
|
|
11
11
|
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); }
|
|
12
|
-
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 &&
|
|
12
|
+
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; }
|
|
13
13
|
var not = {
|
|
14
14
|
negTabIndex: ':not([tabindex^="-"])',
|
|
15
15
|
disabled: ":not(:disabled)"
|
|
@@ -95,7 +95,8 @@ var FocusLock = function FocusLock(_ref) {
|
|
|
95
95
|
});
|
|
96
96
|
}, [focusableElements]);
|
|
97
97
|
var focusLast = function focusLast() {
|
|
98
|
-
|
|
98
|
+
var _focusableElements$re;
|
|
99
|
+
focusableElements === null || focusableElements === void 0 ? void 0 : (_focusableElements$re = focusableElements.reverse()) === null || _focusableElements$re === void 0 ? void 0 : _focusableElements$re.some(function (element) {
|
|
99
100
|
return attemptFocus(element);
|
|
100
101
|
});
|
|
101
102
|
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports["default"] = void 0;
|
|
8
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
9
|
+
var _react = require("react");
|
|
10
|
+
var useWidth = function useWidth(target) {
|
|
11
|
+
var _useState = (0, _react.useState)(0),
|
|
12
|
+
_useState2 = (0, _slicedToArray2["default"])(_useState, 2),
|
|
13
|
+
width = _useState2[0],
|
|
14
|
+
setWidth = _useState2[1];
|
|
15
|
+
(0, _react.useLayoutEffect)(function () {
|
|
16
|
+
if (target != null) {
|
|
17
|
+
setWidth(target.getBoundingClientRect().width);
|
|
18
|
+
var triggerObserver = new ResizeObserver(function (entries) {
|
|
19
|
+
var rect = entries[0].target.getBoundingClientRect();
|
|
20
|
+
setWidth(rect === null || rect === void 0 ? void 0 : rect.width);
|
|
21
|
+
});
|
|
22
|
+
triggerObserver.observe(target);
|
|
23
|
+
return function () {
|
|
24
|
+
triggerObserver.unobserve(target);
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
}, [target]);
|
|
28
|
+
return width;
|
|
29
|
+
};
|
|
30
|
+
var _default = exports["default"] = useWidth;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -5,8 +5,8 @@ var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"))
|
|
|
5
5
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
6
6
|
var _react = _interopRequireDefault(require("react"));
|
|
7
7
|
var _react2 = require("@testing-library/react");
|
|
8
|
-
var
|
|
9
|
-
var _Wizard = _interopRequireDefault(require("./Wizard
|
|
8
|
+
var _axeHelper = require("../../test/accessibility/axe-helper.js");
|
|
9
|
+
var _Wizard = _interopRequireDefault(require("./Wizard"));
|
|
10
10
|
var favoriteSVG = /*#__PURE__*/_react["default"].createElement("svg", {
|
|
11
11
|
viewBox: "0 0 24 24",
|
|
12
12
|
fill: "currentColor"
|
|
@@ -42,7 +42,7 @@ describe("Wizard component accessibility tests", function () {
|
|
|
42
42
|
margin: "medium"
|
|
43
43
|
})), container = _render.container;
|
|
44
44
|
_context.next = 3;
|
|
45
|
-
return (0,
|
|
45
|
+
return (0, _axeHelper.axe)(container);
|
|
46
46
|
case 3:
|
|
47
47
|
results = _context.sent;
|
|
48
48
|
expect(results).toHaveNoViolations();
|
package/wizard/Wizard.js
CHANGED
|
@@ -16,52 +16,44 @@ var _useTheme = _interopRequireDefault(require("../useTheme"));
|
|
|
16
16
|
var _Icon = _interopRequireDefault(require("../icon/Icon"));
|
|
17
17
|
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10, _templateObject11;
|
|
18
18
|
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); }
|
|
19
|
-
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 &&
|
|
19
|
+
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; }
|
|
20
20
|
var icons = {
|
|
21
21
|
validIcon: /*#__PURE__*/_react["default"].createElement("svg", {
|
|
22
|
-
id: "check_circle_black_18dp",
|
|
23
22
|
xmlns: "http://www.w3.org/2000/svg",
|
|
24
23
|
width: "18",
|
|
25
24
|
height: "18",
|
|
26
25
|
viewBox: "0 0 18 18"
|
|
27
26
|
}, /*#__PURE__*/_react["default"].createElement("path", {
|
|
28
|
-
id: "Path_2946",
|
|
29
27
|
"data-name": "Path 2946",
|
|
30
28
|
d: "M0,0H18V18H0Z",
|
|
31
29
|
fill: "none"
|
|
32
30
|
}), /*#__PURE__*/_react["default"].createElement("path", {
|
|
33
|
-
id: "Path_2947",
|
|
34
31
|
"data-name": "Path 2947",
|
|
35
32
|
d: "M9.986,4a5.986,5.986,0,1,0,5.986,5.986A5.994,5.994,0,0,0,9.986,4Zm-1.5,9.727L5.5,10.734,6.551,9.679l1.938,1.93L13.42,6.679l1.055,1.063Z",
|
|
36
33
|
transform: "translate(-0.986 -0.986)",
|
|
37
34
|
fill: "#eafaef",
|
|
38
35
|
opacity: "0.999"
|
|
39
36
|
}), /*#__PURE__*/_react["default"].createElement("path", {
|
|
40
|
-
id: "Path_2948",
|
|
41
37
|
"data-name": "Path 2948",
|
|
42
38
|
d: "M9.493,2a7.493,7.493,0,1,0,7.493,7.493A7.5,7.5,0,0,0,9.493,2Zm0,13.487a5.994,5.994,0,1,1,5.994-5.994A6,6,0,0,1,9.493,15.487Zm3.439-9.306L7.994,11.119,6.054,9.186,5,10.242l3,3,5.994-5.994Z",
|
|
43
39
|
transform: "translate(-0.493 -0.493)",
|
|
44
40
|
fill: "#24a148"
|
|
45
41
|
})),
|
|
46
42
|
invalidIcon: /*#__PURE__*/_react["default"].createElement("svg", {
|
|
47
|
-
id: "highlight_off_black_18dp",
|
|
48
43
|
xmlns: "http://www.w3.org/2000/svg",
|
|
49
44
|
width: "18",
|
|
50
45
|
height: "18",
|
|
51
46
|
viewBox: "0 0 18 18"
|
|
52
47
|
}, /*#__PURE__*/_react["default"].createElement("path", {
|
|
53
|
-
id: "Path_2943",
|
|
54
48
|
"data-name": "Path 2943",
|
|
55
49
|
d: "M0,0H18V18H0Z",
|
|
56
50
|
fill: "none"
|
|
57
51
|
}), /*#__PURE__*/_react["default"].createElement("path", {
|
|
58
|
-
id: "Path_2944",
|
|
59
52
|
"data-name": "Path 2944",
|
|
60
53
|
d: "M10,4a6,6,0,1,0,6,6A6.01,6.01,0,0,0,10,4Zm3,7.945L11.945,13,10,11.06,8.059,13,7,11.945,8.944,10,7,8.059,8.059,7,10,8.944,11.945,7,13,8.059,11.06,10Z",
|
|
61
54
|
transform: "translate(-1.002 -1.002)",
|
|
62
55
|
fill: "#ffe6e9"
|
|
63
56
|
}), /*#__PURE__*/_react["default"].createElement("path", {
|
|
64
|
-
id: "Path_2945",
|
|
65
57
|
"data-name": "Path 2945",
|
|
66
58
|
d: "M11.444,6.5,9.5,8.443,7.558,6.5,6.5,7.558,8.443,9.5,6.5,11.444,7.558,12.5,9.5,10.558,11.444,12.5,12.5,11.444,10.558,9.5,12.5,7.558ZM9.5,2A7.5,7.5,0,1,0,17,9.5,7.494,7.494,0,0,0,9.5,2Zm0,13.5a6,6,0,1,1,6-6A6.009,6.009,0,0,1,9.5,15.5Z",
|
|
67
59
|
transform: "translate(-0.501 -0.501)",
|