@dxc-technology/halstack-react 0.0.0-c9c1158 → 0.0.0-c9efd3e
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/BackgroundColorContext.d.ts +1 -10
- package/BackgroundColorContext.js +2 -7
- package/HalstackContext.d.ts +29 -133
- package/HalstackContext.js +1 -1
- package/accordion/Accordion.accessibility.test.js +71 -0
- package/accordion/Accordion.js +10 -26
- package/accordion/Accordion.stories.tsx +4 -36
- package/accordion/types.d.ts +1 -1
- package/accordion-group/AccordionGroup.accessibility.test.js +88 -0
- package/accordion-group/AccordionGroup.d.ts +2 -3
- package/accordion-group/AccordionGroup.js +3 -3
- package/accordion-group/AccordionGroupAccordion.js +2 -2
- package/accordion-group/AccordionGroupContext.d.ts +3 -0
- package/accordion-group/AccordionGroupContext.js +8 -0
- package/accordion-group/types.d.ts +1 -1
- package/action-icon/ActionIcon.accessibility.test.js +63 -0
- package/action-icon/ActionIcon.d.ts +4 -0
- package/action-icon/ActionIcon.js +48 -0
- package/action-icon/ActionIcon.stories.tsx +41 -0
- package/action-icon/ActionIcon.test.js +64 -0
- package/action-icon/types.d.ts +26 -0
- package/action-icon/types.js +5 -0
- package/alert/Alert.accessibility.test.js +95 -0
- package/alert/Alert.js +15 -72
- package/badge/Badge.accessibility.test.js +129 -0
- package/badge/Badge.d.ts +1 -1
- package/badge/Badge.js +141 -28
- package/badge/Badge.stories.tsx +210 -0
- package/badge/Badge.test.js +30 -0
- package/badge/types.d.ts +52 -3
- package/box/Box.accessibility.test.js +33 -0
- package/box/Box.js +1 -4
- package/bulleted-list/BulletedList.accessibility.test.js +107 -0
- package/bulleted-list/BulletedList.js +15 -22
- package/bulleted-list/BulletedList.stories.tsx +1 -2
- package/button/Button.accessibility.test.js +127 -0
- package/button/Button.js +15 -15
- package/button/Button.stories.tsx +32 -51
- package/button/Button.test.js +3 -1
- package/button/types.d.ts +1 -1
- package/card/Card.accessibility.test.js +36 -0
- package/checkbox/Checkbox.accessibility.test.js +87 -0
- package/checkbox/Checkbox.js +26 -31
- package/chip/Chip.accessibility.test.js +67 -0
- package/chip/Chip.js +8 -5
- package/chip/Chip.stories.tsx +5 -24
- package/chip/Chip.test.js +4 -4
- package/common/coreTokens.d.ts +1 -1
- package/common/coreTokens.js +3 -3
- package/common/variables.d.ts +29 -133
- package/common/variables.js +38 -142
- package/container/Container.js +3 -7
- package/container/Container.stories.tsx +10 -25
- package/contextual-menu/ContextualMenu.accessibility.test.js +86 -0
- package/contextual-menu/ContextualMenu.d.ts +7 -0
- package/contextual-menu/ContextualMenu.js +71 -0
- package/contextual-menu/ContextualMenu.stories.tsx +182 -0
- package/contextual-menu/ContextualMenu.test.js +71 -0
- package/contextual-menu/MenuItemAction.d.ts +4 -0
- package/contextual-menu/MenuItemAction.js +46 -0
- package/contextual-menu/types.d.ts +22 -0
- package/contextual-menu/types.js +5 -0
- package/date-input/DateInput.accessibility.test.js +216 -0
- package/date-input/types.d.ts +2 -2
- package/dialog/Dialog.accessibility.test.js +69 -0
- package/dialog/Dialog.js +2 -5
- package/dialog/Dialog.stories.tsx +170 -0
- package/dialog/Dialog.test.js +1 -1
- package/divider/Divider.accessibility.test.js +33 -0
- package/divider/Divider.d.ts +4 -0
- package/divider/Divider.js +36 -0
- package/divider/Divider.stories.tsx +223 -0
- package/divider/Divider.test.js +38 -0
- package/divider/types.d.ts +21 -0
- package/divider/types.js +5 -0
- package/dropdown/Dropdown.accessibility.test.js +180 -0
- package/dropdown/Dropdown.js +21 -36
- package/dropdown/Dropdown.stories.tsx +5 -16
- package/dropdown/DropdownMenuItem.js +6 -3
- package/dropdown/types.d.ts +3 -5
- package/file-input/FileInput.accessibility.test.js +160 -0
- package/file-input/FileInput.js +3 -39
- package/file-input/FileInput.test.js +7 -84
- package/file-input/FileItem.js +13 -27
- package/footer/Footer.accessibility.test.js +117 -0
- package/footer/Footer.d.ts +1 -1
- package/footer/Footer.js +36 -31
- package/footer/Footer.stories.tsx +46 -2
- package/footer/Icons.d.ts +1 -0
- package/footer/Icons.js +65 -1
- package/footer/types.d.ts +8 -8
- package/header/Header.accessibility.test.js +84 -0
- package/header/Header.js +18 -40
- package/header/types.d.ts +4 -3
- package/heading/Heading.accessibility.test.js +33 -0
- package/icon/Icon.accessibility.test.js +30 -0
- package/icon/Icon.d.ts +4 -0
- package/icon/Icon.js +33 -0
- package/icon/Icon.stories.tsx +28 -0
- package/icon/types.d.ts +4 -0
- package/icon/types.js +5 -0
- package/image/Image.accessibility.test.js +56 -0
- package/image/Image.stories.tsx +3 -1
- package/layout/ApplicationLayout.d.ts +1 -1
- package/layout/ApplicationLayout.js +1 -1
- package/layout/Icons.js +0 -2
- package/link/Link.accessibility.test.js +112 -0
- package/link/Link.js +7 -5
- package/link/Link.stories.tsx +2 -2
- package/link/types.d.ts +1 -1
- package/main.d.ts +5 -3
- package/main.js +22 -8
- package/nav-tabs/NavTabs.accessibility.test.js +52 -0
- package/nav-tabs/NavTabs.d.ts +1 -2
- package/nav-tabs/NavTabs.js +9 -6
- package/nav-tabs/NavTabs.stories.tsx +6 -4
- package/nav-tabs/NavTabs.test.js +3 -2
- package/nav-tabs/NavTabsContext.d.ts +3 -0
- package/nav-tabs/NavTabsContext.js +8 -0
- package/nav-tabs/Tab.js +8 -7
- package/number-input/NumberInput.accessibility.test.js +228 -0
- package/number-input/NumberInput.d.ts +0 -7
- package/number-input/NumberInput.js +24 -5
- package/number-input/NumberInput.test.js +165 -6
- package/number-input/NumberInputContext.d.ts +3 -0
- package/number-input/NumberInputContext.js +8 -0
- package/number-input/types.d.ts +6 -0
- package/package.json +12 -12
- package/paginator/Paginator.accessibility.test.js +79 -0
- package/paginator/Paginator.js +1 -4
- package/paragraph/Paragraph.accessibility.test.js +28 -0
- package/paragraph/Paragraph.js +2 -7
- package/password-input/PasswordInput.accessibility.test.js +153 -0
- package/password-input/PasswordInput.stories.tsx +0 -1
- package/progress-bar/ProgressBar.accessibility.test.js +35 -0
- package/progress-bar/ProgressBar.js +5 -11
- package/quick-nav/QuickNav.accessibility.test.js +57 -0
- package/radio-group/RadioGroup.accessibility.test.js +97 -0
- package/radio-group/RadioGroup.js +1 -1
- package/resultset-table/ResultsetTable.accessibility.test.js +274 -0
- package/resultset-table/ResultsetTable.d.ts +4 -1
- package/resultset-table/ResultsetTable.js +23 -12
- package/resultset-table/ResultsetTable.stories.tsx +106 -5
- package/resultset-table/ResultsetTable.test.js +76 -0
- package/resultset-table/types.d.ts +40 -7
- package/select/Option.js +8 -1
- package/select/Select.accessibility.test.js +217 -0
- package/select/Select.js +35 -27
- package/select/Select.stories.tsx +0 -1
- package/select/Select.test.js +498 -462
- package/select/types.d.ts +2 -2
- package/sidenav/Sidenav.accessibility.test.js +59 -0
- package/sidenav/Sidenav.js +20 -18
- package/sidenav/Sidenav.stories.tsx +4 -9
- package/sidenav/types.d.ts +2 -2
- package/slider/Slider.accessibility.test.js +104 -0
- package/slider/Slider.js +37 -46
- package/spinner/Spinner.accessibility.test.js +96 -0
- package/spinner/Spinner.js +6 -14
- package/status-light/StatusLight.accessibility.test.js +157 -0
- package/status-light/StatusLight.d.ts +4 -0
- package/status-light/StatusLight.js +51 -0
- package/status-light/StatusLight.stories.tsx +74 -0
- package/status-light/StatusLight.test.js +25 -0
- package/status-light/types.d.ts +17 -0
- package/status-light/types.js +5 -0
- package/switch/Switch.accessibility.test.js +89 -0
- package/switch/Switch.js +23 -28
- package/table/DropdownTheme.js +62 -0
- package/table/Table.accessibility.test.js +82 -0
- package/table/Table.d.ts +6 -2
- package/table/Table.js +73 -11
- package/table/Table.stories.tsx +297 -2
- package/table/Table.test.js +92 -0
- package/table/types.d.ts +28 -0
- package/tabs/Tab.js +7 -4
- package/tabs/Tabs.accessibility.test.js +56 -0
- package/tabs/Tabs.js +4 -5
- package/tabs/Tabs.stories.tsx +1 -1
- package/tag/Tag.accessibility.test.js +69 -0
- package/tag/Tag.js +6 -6
- package/tag/Tag.stories.tsx +4 -7
- package/tag/Tag.test.js +4 -12
- package/tag/types.d.ts +2 -2
- package/text-input/Suggestions.js +7 -10
- package/text-input/TextInput.accessibility.test.js +321 -0
- package/text-input/TextInput.js +77 -102
- package/text-input/TextInput.stories.tsx +1 -1
- package/text-input/TextInput.test.js +96 -79
- package/textarea/Textarea.accessibility.test.js +155 -0
- package/textarea/Textarea.js +10 -16
- package/textarea/Textarea.stories.tsx +0 -1
- package/toggle-group/ToggleGroup.accessibility.test.js +107 -0
- package/toggle-group/ToggleGroup.js +1 -4
- package/typography/Typography.accessibility.test.js +339 -0
- package/useTheme.d.ts +29 -133
- package/utils/FocusLock.js +15 -5
- package/wizard/Wizard.accessibility.test.js +55 -0
- package/wizard/types.d.ts +1 -1
- package/common/OpenSans.css +0 -69
- package/common/fonts/OpenSans-Bold.ttf +0 -0
- package/common/fonts/OpenSans-BoldItalic.ttf +0 -0
- package/common/fonts/OpenSans-ExtraBold.ttf +0 -0
- package/common/fonts/OpenSans-ExtraBoldItalic.ttf +0 -0
- package/common/fonts/OpenSans-Italic.ttf +0 -0
- package/common/fonts/OpenSans-Light.ttf +0 -0
- package/common/fonts/OpenSans-LightItalic.ttf +0 -0
- package/common/fonts/OpenSans-Regular.ttf +0 -0
- package/common/fonts/OpenSans-SemiBold.ttf +0 -0
- package/common/fonts/OpenSans-SemiBoldItalic.ttf +0 -0
- 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/{layout → sidenav}/SidenavContext.d.ts +0 -0
- /package/{layout → sidenav}/SidenavContext.js +0 -0
|
@@ -0,0 +1,155 @@
|
|
|
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 _jestAxe = require("jest-axe");
|
|
9
|
+
var _Textarea = _interopRequireDefault(require("./Textarea.tsx"));
|
|
10
|
+
describe("Textarea component accessibility tests", function () {
|
|
11
|
+
it("Should not have basic accessibility issues", /*#__PURE__*/(0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee() {
|
|
12
|
+
var _render, container, results;
|
|
13
|
+
return _regenerator["default"].wrap(function _callee$(_context) {
|
|
14
|
+
while (1) switch (_context.prev = _context.next) {
|
|
15
|
+
case 0:
|
|
16
|
+
_render = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Textarea["default"], {
|
|
17
|
+
label: "Example label",
|
|
18
|
+
helperText: "Helper Text",
|
|
19
|
+
defaultValue: "Value",
|
|
20
|
+
margin: "medium",
|
|
21
|
+
placeholder: "Placeholder",
|
|
22
|
+
verticalGrow: "manual",
|
|
23
|
+
name: "Name",
|
|
24
|
+
autocomplete: "on",
|
|
25
|
+
minLength: 0,
|
|
26
|
+
maxLength: 100,
|
|
27
|
+
optional: true
|
|
28
|
+
})), container = _render.container;
|
|
29
|
+
_context.next = 3;
|
|
30
|
+
return (0, _jestAxe.axe)(container);
|
|
31
|
+
case 3:
|
|
32
|
+
results = _context.sent;
|
|
33
|
+
expect(results).toHaveNoViolations();
|
|
34
|
+
case 5:
|
|
35
|
+
case "end":
|
|
36
|
+
return _context.stop();
|
|
37
|
+
}
|
|
38
|
+
}, _callee);
|
|
39
|
+
})));
|
|
40
|
+
it("Should not have basic accessibility issues for pattern mode", /*#__PURE__*/(0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee2() {
|
|
41
|
+
var _render2, container, results;
|
|
42
|
+
return _regenerator["default"].wrap(function _callee2$(_context2) {
|
|
43
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
44
|
+
case 0:
|
|
45
|
+
_render2 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Textarea["default"], {
|
|
46
|
+
label: "Example label",
|
|
47
|
+
helperText: "Helper Text",
|
|
48
|
+
defaultValue: "Value",
|
|
49
|
+
margin: "medium",
|
|
50
|
+
placeholder: "Placeholder",
|
|
51
|
+
verticalGrow: "manual",
|
|
52
|
+
name: "Name",
|
|
53
|
+
autocomplete: "on",
|
|
54
|
+
minLength: 0,
|
|
55
|
+
maxLength: 100,
|
|
56
|
+
pattern: "^.*(?=.*[a-zA-Z])(?=.*)(?=.*[!&$%&? \"]).*$"
|
|
57
|
+
})), container = _render2.container;
|
|
58
|
+
_context2.next = 3;
|
|
59
|
+
return (0, _jestAxe.axe)(container);
|
|
60
|
+
case 3:
|
|
61
|
+
results = _context2.sent;
|
|
62
|
+
expect(results).toHaveNoViolations();
|
|
63
|
+
case 5:
|
|
64
|
+
case "end":
|
|
65
|
+
return _context2.stop();
|
|
66
|
+
}
|
|
67
|
+
}, _callee2);
|
|
68
|
+
})));
|
|
69
|
+
it("Should not have basic accessibility issues for error mode", /*#__PURE__*/(0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee3() {
|
|
70
|
+
var _render3, container, results;
|
|
71
|
+
return _regenerator["default"].wrap(function _callee3$(_context3) {
|
|
72
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
73
|
+
case 0:
|
|
74
|
+
_render3 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Textarea["default"], {
|
|
75
|
+
label: "Example label",
|
|
76
|
+
helperText: "Helper Text",
|
|
77
|
+
defaultValue: "Value",
|
|
78
|
+
margin: "medium",
|
|
79
|
+
placeholder: "Placeholder",
|
|
80
|
+
verticalGrow: "manual",
|
|
81
|
+
name: "Name",
|
|
82
|
+
error: "Error message.",
|
|
83
|
+
minLength: 0,
|
|
84
|
+
maxLength: 100
|
|
85
|
+
})), container = _render3.container;
|
|
86
|
+
_context3.next = 3;
|
|
87
|
+
return (0, _jestAxe.axe)(container);
|
|
88
|
+
case 3:
|
|
89
|
+
results = _context3.sent;
|
|
90
|
+
expect(results).toHaveNoViolations();
|
|
91
|
+
case 5:
|
|
92
|
+
case "end":
|
|
93
|
+
return _context3.stop();
|
|
94
|
+
}
|
|
95
|
+
}, _callee3);
|
|
96
|
+
})));
|
|
97
|
+
it("Should not have basic accessibility issues for disabled mode", /*#__PURE__*/(0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee4() {
|
|
98
|
+
var _render4, container, results;
|
|
99
|
+
return _regenerator["default"].wrap(function _callee4$(_context4) {
|
|
100
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
101
|
+
case 0:
|
|
102
|
+
_render4 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Textarea["default"], {
|
|
103
|
+
label: "Example label",
|
|
104
|
+
helperText: "Helper Text",
|
|
105
|
+
defaultValue: "Value",
|
|
106
|
+
margin: "medium",
|
|
107
|
+
placeholder: "Placeholder",
|
|
108
|
+
verticalGrow: "manual",
|
|
109
|
+
name: "Name",
|
|
110
|
+
autocomplete: "on",
|
|
111
|
+
minLength: 0,
|
|
112
|
+
maxLength: 100,
|
|
113
|
+
disabled: true
|
|
114
|
+
})), container = _render4.container;
|
|
115
|
+
_context4.next = 3;
|
|
116
|
+
return (0, _jestAxe.axe)(container);
|
|
117
|
+
case 3:
|
|
118
|
+
results = _context4.sent;
|
|
119
|
+
expect(results).toHaveNoViolations();
|
|
120
|
+
case 5:
|
|
121
|
+
case "end":
|
|
122
|
+
return _context4.stop();
|
|
123
|
+
}
|
|
124
|
+
}, _callee4);
|
|
125
|
+
})));
|
|
126
|
+
it("Should not have basic accessibility issues for read-only mode", /*#__PURE__*/(0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee5() {
|
|
127
|
+
var _render5, container, results;
|
|
128
|
+
return _regenerator["default"].wrap(function _callee5$(_context5) {
|
|
129
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
130
|
+
case 0:
|
|
131
|
+
_render5 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Textarea["default"], {
|
|
132
|
+
label: "Example label",
|
|
133
|
+
helperText: "Helper Text",
|
|
134
|
+
defaultValue: "Value",
|
|
135
|
+
margin: "medium",
|
|
136
|
+
placeholder: "Placeholder",
|
|
137
|
+
verticalGrow: "manual",
|
|
138
|
+
name: "Name",
|
|
139
|
+
autocomplete: "on",
|
|
140
|
+
minLength: 0,
|
|
141
|
+
maxLength: 100,
|
|
142
|
+
readOnly: true
|
|
143
|
+
})), container = _render5.container;
|
|
144
|
+
_context5.next = 3;
|
|
145
|
+
return (0, _jestAxe.axe)(container);
|
|
146
|
+
case 3:
|
|
147
|
+
results = _context5.sent;
|
|
148
|
+
expect(results).toHaveNoViolations();
|
|
149
|
+
case 5:
|
|
150
|
+
case "end":
|
|
151
|
+
return _context5.stop();
|
|
152
|
+
}
|
|
153
|
+
}, _callee5);
|
|
154
|
+
})));
|
|
155
|
+
});
|
package/textarea/Textarea.js
CHANGED
|
@@ -16,7 +16,6 @@ var _useTheme = _interopRequireDefault(require("../useTheme"));
|
|
|
16
16
|
var _useTranslatedLabels = _interopRequireDefault(require("../useTranslatedLabels"));
|
|
17
17
|
var _variables = require("../common/variables");
|
|
18
18
|
var _uuid = require("uuid");
|
|
19
|
-
var _BackgroundColorContext = _interopRequireDefault(require("../BackgroundColorContext"));
|
|
20
19
|
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6;
|
|
21
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); }
|
|
22
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 && Object.prototype.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; }
|
|
@@ -64,7 +63,6 @@ var DxcTextarea = /*#__PURE__*/_react["default"].forwardRef(function (_ref, ref)
|
|
|
64
63
|
_useState4 = (0, _slicedToArray2["default"])(_useState3, 1),
|
|
65
64
|
textareaId = _useState4[0];
|
|
66
65
|
var colorsTheme = (0, _useTheme["default"])();
|
|
67
|
-
var backgroundType = (0, _react.useContext)(_BackgroundColorContext["default"]);
|
|
68
66
|
var translatedLabels = (0, _useTranslatedLabels["default"])();
|
|
69
67
|
var textareaRef = (0, _react.useRef)(null);
|
|
70
68
|
var errorId = "error-".concat(textareaId);
|
|
@@ -123,11 +121,9 @@ var DxcTextarea = /*#__PURE__*/_react["default"].forwardRef(function (_ref, ref)
|
|
|
123
121
|
}, label && /*#__PURE__*/_react["default"].createElement(Label, {
|
|
124
122
|
htmlFor: textareaId,
|
|
125
123
|
disabled: disabled,
|
|
126
|
-
backgroundType: backgroundType,
|
|
127
124
|
helperText: helperText
|
|
128
125
|
}, label, " ", optional && /*#__PURE__*/_react["default"].createElement(OptionalLabel, null, translatedLabels.formFields.optionalLabel)), helperText && /*#__PURE__*/_react["default"].createElement(HelperText, {
|
|
129
|
-
disabled: disabled
|
|
130
|
-
backgroundType: backgroundType
|
|
126
|
+
disabled: disabled
|
|
131
127
|
}, helperText), /*#__PURE__*/_react["default"].createElement(Textarea, {
|
|
132
128
|
id: textareaId,
|
|
133
129
|
name: name,
|
|
@@ -143,7 +139,6 @@ var DxcTextarea = /*#__PURE__*/_react["default"].forwardRef(function (_ref, ref)
|
|
|
143
139
|
minLength: minLength,
|
|
144
140
|
maxLength: maxLength,
|
|
145
141
|
autoComplete: autocomplete,
|
|
146
|
-
backgroundType: backgroundType,
|
|
147
142
|
ref: textareaRef,
|
|
148
143
|
tabIndex: tabIndex,
|
|
149
144
|
"aria-invalid": error ? true : false,
|
|
@@ -151,7 +146,6 @@ var DxcTextarea = /*#__PURE__*/_react["default"].forwardRef(function (_ref, ref)
|
|
|
151
146
|
"aria-required": !disabled && !optional
|
|
152
147
|
}), !disabled && typeof error === "string" && /*#__PURE__*/_react["default"].createElement(Error, {
|
|
153
148
|
id: errorId,
|
|
154
|
-
backgroundType: backgroundType,
|
|
155
149
|
"aria-live": error ? "assertive" : "off"
|
|
156
150
|
}, error)));
|
|
157
151
|
});
|
|
@@ -178,7 +172,7 @@ var TextareaContainer = _styledComponents["default"].div(_templateObject || (_te
|
|
|
178
172
|
return props.margin && (0, _typeof2["default"])(props.margin) === "object" && props.margin.left ? _variables.spaces[props.margin.left] : "";
|
|
179
173
|
});
|
|
180
174
|
var Label = _styledComponents["default"].label(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2["default"])(["\n color: ", ";\n\n font-family: ", ";\n font-size: ", ";\n font-style: ", ";\n font-weight: ", ";\n line-height: ", ";\n ", "\n"])), function (props) {
|
|
181
|
-
return props.disabled ? props.
|
|
175
|
+
return props.disabled ? props.theme.disabledLabelFontColor : props.theme.labelFontColor;
|
|
182
176
|
}, function (props) {
|
|
183
177
|
return props.theme.fontFamily;
|
|
184
178
|
}, function (props) {
|
|
@@ -196,7 +190,7 @@ var OptionalLabel = _styledComponents["default"].span(_templateObject3 || (_temp
|
|
|
196
190
|
return props.theme.optionalLabelFontWeight;
|
|
197
191
|
});
|
|
198
192
|
var HelperText = _styledComponents["default"].span(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2["default"])(["\n color: ", ";\n\n font-family: ", ";\n font-size: ", ";\n font-style: ", ";\n font-weight: ", ";\n line-height: ", ";\n margin-bottom: 0.25rem;\n"])), function (props) {
|
|
199
|
-
return props.disabled ? props.
|
|
193
|
+
return props.disabled ? props.theme.disabledHelperTextFontColor : props.theme.helperTextFontColor;
|
|
200
194
|
}, function (props) {
|
|
201
195
|
return props.theme.fontFamily;
|
|
202
196
|
}, function (props) {
|
|
@@ -212,15 +206,15 @@ var Textarea = _styledComponents["default"].textarea(_templateObject5 || (_templ
|
|
|
212
206
|
var verticalGrow = _ref2.verticalGrow;
|
|
213
207
|
if (verticalGrow === "none") return "resize: none;";else if (verticalGrow === "auto") return "resize: none; overflow: hidden;";else if (verticalGrow === "manual") return "resize: vertical;";else return "resize: none;";
|
|
214
208
|
}, function (props) {
|
|
215
|
-
|
|
209
|
+
return props.disabled ? "background-color: ".concat(props.theme.disabledContainerFillColor, ";") : "background-color: transparent;";
|
|
216
210
|
}, function (props) {
|
|
217
|
-
if (props.disabled) return props.
|
|
211
|
+
if (props.disabled) return props.theme.disabledBorderColor;else if (props.error) return "transparent";else if (props.readOnly) return props.theme.readOnlyBorderColor;else props.theme.enabledBorderColor;
|
|
218
212
|
}, function (props) {
|
|
219
|
-
return props.error && !props.disabled && "box-shadow: 0 0 0 2px ".concat(props.
|
|
213
|
+
return props.error && !props.disabled && "box-shadow: 0 0 0 2px ".concat(props.theme.errorBorderColor, ";\n ");
|
|
220
214
|
}, function (props) {
|
|
221
|
-
return !props.disabled ? "&:hover {\n border-color: ".concat(props.error ? "transparent" : props.readOnly ? props.theme.hoverReadOnlyBorderColor : props.
|
|
215
|
+
return !props.disabled ? "&:hover {\n border-color: ".concat(props.error ? "transparent" : props.readOnly ? props.theme.hoverReadOnlyBorderColor : props.theme.hoverBorderColor, ";\n ").concat(props.error && "box-shadow: 0 0 0 2px ".concat(props.theme.hoverErrorBorderColor, ";"), "\n }\n &:focus, &:focus-within {\n outline: none;\n border-color: transparent;\n box-shadow: 0 0 0 2px ").concat(props.theme.focusBorderColor, ";\n }") : "cursor: not-allowed;";
|
|
222
216
|
}, function (props) {
|
|
223
|
-
return props.disabled ? props.
|
|
217
|
+
return props.disabled ? props.theme.disabledValueFontColor : props.theme.valueFontColor;
|
|
224
218
|
}, function (props) {
|
|
225
219
|
return props.theme.fontFamily;
|
|
226
220
|
}, function (props) {
|
|
@@ -230,10 +224,10 @@ var Textarea = _styledComponents["default"].textarea(_templateObject5 || (_templ
|
|
|
230
224
|
}, function (props) {
|
|
231
225
|
return props.theme.valueFontWeight;
|
|
232
226
|
}, function (props) {
|
|
233
|
-
return props.disabled ? props.
|
|
227
|
+
return props.disabled ? props.theme.disabledPlaceholderFontColor : props.theme.placeholderFontColor;
|
|
234
228
|
});
|
|
235
229
|
var Error = _styledComponents["default"].span(_templateObject6 || (_templateObject6 = (0, _taggedTemplateLiteral2["default"])(["\n color: ", ";\n font-family: ", ";\n font-size: 0.75rem;\n font-weight: 400;\n min-height: 1.5em;\n line-height: 1.5em;\n margin-top: 0.25rem;\n"])), function (props) {
|
|
236
|
-
return props.
|
|
230
|
+
return props.theme.errorMessageColor;
|
|
237
231
|
}, function (props) {
|
|
238
232
|
return props.theme.fontFamily;
|
|
239
233
|
});
|
|
@@ -2,7 +2,6 @@ import React from "react";
|
|
|
2
2
|
import DxcTextarea from "./Textarea";
|
|
3
3
|
import Title from "../../.storybook/components/Title";
|
|
4
4
|
import ExampleContainer from "../../.storybook/components/ExampleContainer";
|
|
5
|
-
import { BackgroundColorProvider } from "../BackgroundColorContext";
|
|
6
5
|
import { HalstackProvider } from "../HalstackContext";
|
|
7
6
|
|
|
8
7
|
export default {
|
|
@@ -0,0 +1,107 @@
|
|
|
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 _jestAxe = require("jest-axe");
|
|
9
|
+
var _ToggleGroup = _interopRequireDefault(require("./ToggleGroup.tsx"));
|
|
10
|
+
var ethernetSVG = /*#__PURE__*/_react["default"].createElement("svg", {
|
|
11
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
12
|
+
height: "24px",
|
|
13
|
+
viewBox: "0 0 24 24",
|
|
14
|
+
width: "24px",
|
|
15
|
+
fill: "currentColor"
|
|
16
|
+
}, /*#__PURE__*/_react["default"].createElement("path", {
|
|
17
|
+
d: "M0 0h24v24H0V0z",
|
|
18
|
+
fill: "none"
|
|
19
|
+
}), /*#__PURE__*/_react["default"].createElement("path", {
|
|
20
|
+
d: "M7.77 6.76L6.23 5.48.82 12l5.41 6.52 1.54-1.28L3.42 12l4.35-5.24zM7 13h2v-2H7v2zm10-2h-2v2h2v-2zm-6 2h2v-2h-2v2zm6.77-7.52l-1.54 1.28L20.58 12l-4.35 5.24 1.54 1.28L23.18 12l-5.41-6.52z"
|
|
21
|
+
}));
|
|
22
|
+
var gMobileSVG = /*#__PURE__*/_react["default"].createElement("svg", {
|
|
23
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
24
|
+
height: "24px",
|
|
25
|
+
viewBox: "0 0 24 24",
|
|
26
|
+
width: "24px",
|
|
27
|
+
fill: "currentColor"
|
|
28
|
+
}, /*#__PURE__*/_react["default"].createElement("g", null, /*#__PURE__*/_react["default"].createElement("path", {
|
|
29
|
+
d: "M0,0h24v24H0V0z",
|
|
30
|
+
fill: "none"
|
|
31
|
+
})), /*#__PURE__*/_react["default"].createElement("g", null, /*#__PURE__*/_react["default"].createElement("g", null, /*#__PURE__*/_react["default"].createElement("path", {
|
|
32
|
+
d: "M3,7v2h5v2H4v2h4v2H3v2h5c1.1,0,2-0.9,2-2v-1.5c0-0.83-0.67-1.5-1.5-1.5c0.83,0,1.5-0.67,1.5-1.5V9c0-1.1-0.9-2-2-2H3z M21,11v4c0,1.1-0.9,2-2,2h-5c-1.1,0-2-0.9-2-2V9c0-1.1,0.9-2,2-2h5c1.1,0,2,0.9,2,2h-7v6h5v-2h-2.5v-2H21z"
|
|
33
|
+
}))));
|
|
34
|
+
var wifiSVG = /*#__PURE__*/_react["default"].createElement("svg", {
|
|
35
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
36
|
+
height: "24px",
|
|
37
|
+
viewBox: "0 0 24 24",
|
|
38
|
+
width: "24px",
|
|
39
|
+
fill: "currentColor"
|
|
40
|
+
}, /*#__PURE__*/_react["default"].createElement("path", {
|
|
41
|
+
d: "M0 0h24v24H0V0zm0 0h24v24H0V0z",
|
|
42
|
+
fill: "none"
|
|
43
|
+
}), /*#__PURE__*/_react["default"].createElement("path", {
|
|
44
|
+
d: "M1 9l2 2c4.97-4.97 13.03-4.97 18 0l2-2C16.93 2.93 7.08 2.93 1 9zm8 8l3 3 3-3c-1.65-1.66-4.34-1.66-6 0zm-4-4l2 2c2.76-2.76 7.24-2.76 10 0l2-2C15.14 9.14 8.87 9.14 5 13z"
|
|
45
|
+
}));
|
|
46
|
+
var options = [{
|
|
47
|
+
value: 1,
|
|
48
|
+
icon: wifiSVG,
|
|
49
|
+
title: "WiFi connection"
|
|
50
|
+
}, {
|
|
51
|
+
value: 2,
|
|
52
|
+
icon: ethernetSVG,
|
|
53
|
+
title: "Ethernet connection"
|
|
54
|
+
}, {
|
|
55
|
+
value: 3,
|
|
56
|
+
icon: gMobileSVG,
|
|
57
|
+
title: "3G Mobile data connection"
|
|
58
|
+
}];
|
|
59
|
+
describe("Toggle group component accessibility tests", function () {
|
|
60
|
+
it("Should not have basic accessibility issues", /*#__PURE__*/(0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee() {
|
|
61
|
+
var _render, container, results;
|
|
62
|
+
return _regenerator["default"].wrap(function _callee$(_context) {
|
|
63
|
+
while (1) switch (_context.prev = _context.next) {
|
|
64
|
+
case 0:
|
|
65
|
+
_render = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_ToggleGroup["default"], {
|
|
66
|
+
label: "Toggle group label",
|
|
67
|
+
helperText: "Toggle group helper text",
|
|
68
|
+
options: options,
|
|
69
|
+
margin: "medium",
|
|
70
|
+
defaultValue: 2,
|
|
71
|
+
multiple: true
|
|
72
|
+
})), container = _render.container;
|
|
73
|
+
_context.next = 3;
|
|
74
|
+
return (0, _jestAxe.axe)(container);
|
|
75
|
+
case 3:
|
|
76
|
+
results = _context.sent;
|
|
77
|
+
expect(results).toHaveNoViolations();
|
|
78
|
+
case 5:
|
|
79
|
+
case "end":
|
|
80
|
+
return _context.stop();
|
|
81
|
+
}
|
|
82
|
+
}, _callee);
|
|
83
|
+
})));
|
|
84
|
+
it("Should not have basic accessibility issues for disabled mode", /*#__PURE__*/(0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee2() {
|
|
85
|
+
var _render2, container, results;
|
|
86
|
+
return _regenerator["default"].wrap(function _callee2$(_context2) {
|
|
87
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
88
|
+
case 0:
|
|
89
|
+
_render2 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_ToggleGroup["default"], {
|
|
90
|
+
label: "Toggle group label",
|
|
91
|
+
helperText: "Toggle group helper text",
|
|
92
|
+
options: options,
|
|
93
|
+
margin: "medium",
|
|
94
|
+
disabled: true
|
|
95
|
+
})), container = _render2.container;
|
|
96
|
+
_context2.next = 3;
|
|
97
|
+
return (0, _jestAxe.axe)(container);
|
|
98
|
+
case 3:
|
|
99
|
+
results = _context2.sent;
|
|
100
|
+
expect(results).toHaveNoViolations();
|
|
101
|
+
case 5:
|
|
102
|
+
case "end":
|
|
103
|
+
return _context2.stop();
|
|
104
|
+
}
|
|
105
|
+
}, _callee2);
|
|
106
|
+
})));
|
|
107
|
+
});
|
|
@@ -14,7 +14,6 @@ var _styledComponents = _interopRequireWildcard(require("styled-components"));
|
|
|
14
14
|
var _uuid = require("uuid");
|
|
15
15
|
var _variables = require("../common/variables");
|
|
16
16
|
var _useTheme = _interopRequireDefault(require("../useTheme"));
|
|
17
|
-
var _BackgroundColorContext = _interopRequireDefault(require("../BackgroundColorContext"));
|
|
18
17
|
var _Flex = _interopRequireDefault(require("../flex/Flex"));
|
|
19
18
|
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7;
|
|
20
19
|
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); }
|
|
@@ -41,7 +40,6 @@ var DxcToggleGroup = function DxcToggleGroup(_ref) {
|
|
|
41
40
|
selectedValue = _useState4[0],
|
|
42
41
|
setSelectedValue = _useState4[1];
|
|
43
42
|
var colorsTheme = (0, _useTheme["default"])();
|
|
44
|
-
var backgroundType = (0, _react.useContext)(_BackgroundColorContext["default"]);
|
|
45
43
|
var handleToggleChange = function handleToggleChange(selectedOption) {
|
|
46
44
|
var newSelectedOptions;
|
|
47
45
|
if (value == null) {
|
|
@@ -101,7 +99,6 @@ var DxcToggleGroup = function DxcToggleGroup(_ref) {
|
|
|
101
99
|
},
|
|
102
100
|
tabIndex: !disabled ? tabIndex : -1,
|
|
103
101
|
title: option.title,
|
|
104
|
-
backgroundType: backgroundType,
|
|
105
102
|
hasIcon: option.icon,
|
|
106
103
|
optionLabel: option.label,
|
|
107
104
|
selected: multiple ? value ? Array.isArray(value) && value.includes(option.value) : Array.isArray(selectedValue) && selectedValue.includes(option.value) : value ? option.value === value : option.value === selectedValue
|
|
@@ -183,7 +180,7 @@ var ToggleButton = _styledComponents["default"].button(_templateObject5 || (_tem
|
|
|
183
180
|
}, function (props) {
|
|
184
181
|
return props.selected ? props.theme.selectedActiveBackgroundColor : props.theme.unselectedActiveBackgroundColor;
|
|
185
182
|
}, function (props) {
|
|
186
|
-
return "0 0 0 ".concat(props.theme.optionFocusBorderThickness, " ").concat(props.
|
|
183
|
+
return "0 0 0 ".concat(props.theme.optionFocusBorderThickness, " ").concat(props.theme.focusColor);
|
|
187
184
|
}, function (props) {
|
|
188
185
|
return props.selected ? props.theme.selectedDisabledBackgroundColor : props.theme.unselectedDisabledBackgroundColor;
|
|
189
186
|
}, function (props) {
|