@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
|
@@ -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 _Tag = _interopRequireDefault(require("./Tag
|
|
8
|
+
var _axeHelper = require("../../test/accessibility/axe-helper.js");
|
|
9
|
+
var _Tag = _interopRequireDefault(require("./Tag"));
|
|
10
10
|
var icon = /*#__PURE__*/_react["default"].createElement("svg", {
|
|
11
11
|
viewBox: "0 0 24 24",
|
|
12
12
|
fill: "currentColor"
|
|
@@ -31,7 +31,7 @@ describe("Tag component accessibility tests", function () {
|
|
|
31
31
|
labelPosition: "before"
|
|
32
32
|
})), container = _render.container;
|
|
33
33
|
_context.next = 3;
|
|
34
|
-
return (0,
|
|
34
|
+
return (0, _axeHelper.axe)(container);
|
|
35
35
|
case 3:
|
|
36
36
|
results = _context.sent;
|
|
37
37
|
expect(results).toHaveNoViolations();
|
|
@@ -56,7 +56,7 @@ describe("Tag component accessibility tests", function () {
|
|
|
56
56
|
newWindow: true
|
|
57
57
|
})), container = _render2.container;
|
|
58
58
|
_context2.next = 3;
|
|
59
|
-
return (0,
|
|
59
|
+
return (0, _axeHelper.axe)(container);
|
|
60
60
|
case 3:
|
|
61
61
|
results = _context2.sent;
|
|
62
62
|
expect(results).toHaveNoViolations();
|
package/tag/Tag.js
CHANGED
|
@@ -18,7 +18,7 @@ var _Box = _interopRequireDefault(require("../box/Box"));
|
|
|
18
18
|
var _Icon = _interopRequireDefault(require("../icon/Icon"));
|
|
19
19
|
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6;
|
|
20
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); }
|
|
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 &&
|
|
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; }
|
|
22
22
|
var DxcTag = function DxcTag(_ref) {
|
|
23
23
|
var icon = _ref.icon,
|
|
24
24
|
_ref$label = _ref.label,
|
package/tag/Tag.stories.tsx
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import { userEvent, within } from "@storybook/
|
|
2
|
+
import { userEvent, within } from "@storybook/test";
|
|
3
3
|
import Title from "../../.storybook/components/Title";
|
|
4
4
|
import ExampleContainer from "../../.storybook/components/ExampleContainer";
|
|
5
5
|
import DxcTag from "./Tag";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/tag/Tag.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 _Tag = _interopRequireDefault(require("./Tag
|
|
6
|
+
var _Tag = _interopRequireDefault(require("./Tag"));
|
|
7
7
|
describe("Tag component tests", function () {
|
|
8
8
|
test("Tag renders with correct label", function () {
|
|
9
9
|
var _render = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Tag["default"], {
|
package/text-input/Suggestion.js
CHANGED
|
@@ -11,7 +11,7 @@ var _react = _interopRequireWildcard(require("react"));
|
|
|
11
11
|
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
12
12
|
var _templateObject, _templateObject2;
|
|
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 transformSpecialChars = function transformSpecialChars(str) {
|
|
16
16
|
var specialCharsRegex = /[\\*()\[\]{}+?/]/;
|
|
17
17
|
var value = str;
|
|
@@ -14,7 +14,7 @@ var _Suggestion = _interopRequireDefault(require("./Suggestion"));
|
|
|
14
14
|
var _Icon = _interopRequireDefault(require("../icon/Icon"));
|
|
15
15
|
var _templateObject, _templateObject2, _templateObject3, _templateObject4;
|
|
16
16
|
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); }
|
|
17
|
-
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 &&
|
|
17
|
+
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; }
|
|
18
18
|
var Suggestions = function Suggestions(_ref) {
|
|
19
19
|
var id = _ref.id,
|
|
20
20
|
value = _ref.value,
|
|
@@ -43,11 +43,12 @@ var Suggestions = function Suggestions(_ref) {
|
|
|
43
43
|
},
|
|
44
44
|
ref: listboxRef,
|
|
45
45
|
role: "listbox",
|
|
46
|
-
style: styles
|
|
46
|
+
style: styles,
|
|
47
|
+
"aria-label": "Suggestions"
|
|
47
48
|
}, !isSearching && !searchHasErrors && suggestions.length > 0 && suggestions.map(function (suggestion, index) {
|
|
48
49
|
return /*#__PURE__*/_react["default"].createElement(_Suggestion["default"], {
|
|
49
|
-
key: "suggestion-".concat(index),
|
|
50
|
-
id: "suggestion-".concat(index),
|
|
50
|
+
key: "".concat(id, "-suggestion-").concat(index),
|
|
51
|
+
id: "".concat(id, "-suggestion-").concat(index),
|
|
51
52
|
value: value,
|
|
52
53
|
onClick: suggestionOnClick,
|
|
53
54
|
suggestion: suggestion,
|
|
@@ -55,9 +56,16 @@ var Suggestions = function Suggestions(_ref) {
|
|
|
55
56
|
visuallyFocused: visualFocusIndex === index,
|
|
56
57
|
highlighted: highlightedSuggestions
|
|
57
58
|
});
|
|
58
|
-
}), isSearching && /*#__PURE__*/_react["default"].createElement(SuggestionsSystemMessage,
|
|
59
|
+
}), isSearching && /*#__PURE__*/_react["default"].createElement(SuggestionsSystemMessage, {
|
|
60
|
+
role: "option"
|
|
61
|
+
}, translatedLabels.textInput.searchingMessage), searchHasErrors && /*#__PURE__*/_react["default"].createElement("span", {
|
|
62
|
+
role: "option"
|
|
63
|
+
}, /*#__PURE__*/_react["default"].createElement(SuggestionsError, {
|
|
64
|
+
role: "alert",
|
|
65
|
+
"aria-live": "assertive"
|
|
66
|
+
}, /*#__PURE__*/_react["default"].createElement(SuggestionsErrorIcon, null, /*#__PURE__*/_react["default"].createElement(_Icon["default"], {
|
|
59
67
|
icon: "filled_error"
|
|
60
|
-
})), translatedLabels.textInput.fetchingDataErrorMessage));
|
|
68
|
+
})), translatedLabels.textInput.fetchingDataErrorMessage)));
|
|
61
69
|
};
|
|
62
70
|
var SuggestionsContainer = _styledComponents["default"].ul(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["\n box-sizing: border-box;\n max-height: 304px;\n overflow-y: auto;\n margin: 0;\n padding: 0.25rem 0;\n background-color: ", ";\n border: 1px solid\n ", ";\n\n border-radius: 0.25rem;\n box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);\n color: ", ";\n font-family: ", ";\n font-size: ", ";\n font-style: ", ";\n font-weight: ", ";\n"])), function (props) {
|
|
63
71
|
return props.error ? props.theme.errorListDialogBackgroundColor : props.theme.listDialogBackgroundColor;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -7,8 +7,8 @@ var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/cl
|
|
|
7
7
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
8
8
|
var _react = _interopRequireDefault(require("react"));
|
|
9
9
|
var _react2 = require("@testing-library/react");
|
|
10
|
-
var
|
|
11
|
-
var _TextInput = _interopRequireDefault(require("./TextInput
|
|
10
|
+
var _axeHelper = require("../../test/accessibility/axe-helper.js");
|
|
11
|
+
var _TextInput = _interopRequireDefault(require("./TextInput"));
|
|
12
12
|
var countries = ["Afghanistan", "Albania", "Algeria", "Andorra", "Angola", "Antigua and Barbuda", "Bahamas", "Bahrain", "Bangladesh", "Barbados", "Cabo Verde", "Cambodia", "Cameroon", "Canada", "Cayman Islands, The", "Central African Republic", "Chad", "Democratic Republic of the Congo", "Dominican Republic", "Dominica", "Denmark", "Djibouti"];
|
|
13
13
|
var action = {
|
|
14
14
|
onClick: function onClick() {},
|
|
@@ -45,7 +45,7 @@ global.ResizeObserver = /*#__PURE__*/function () {
|
|
|
45
45
|
function ResizeObserver() {
|
|
46
46
|
(0, _classCallCheck2["default"])(this, ResizeObserver);
|
|
47
47
|
}
|
|
48
|
-
(0, _createClass2["default"])(ResizeObserver, [{
|
|
48
|
+
return (0, _createClass2["default"])(ResizeObserver, [{
|
|
49
49
|
key: "observe",
|
|
50
50
|
value: function observe() {}
|
|
51
51
|
}, {
|
|
@@ -55,7 +55,6 @@ global.ResizeObserver = /*#__PURE__*/function () {
|
|
|
55
55
|
key: "disconnect",
|
|
56
56
|
value: function disconnect() {}
|
|
57
57
|
}]);
|
|
58
|
-
return ResizeObserver;
|
|
59
58
|
}();
|
|
60
59
|
describe("TextInput component accessibility tests", function () {
|
|
61
60
|
it("Should not have basic accessibility issues", /*#__PURE__*/(0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee() {
|
|
@@ -80,7 +79,7 @@ describe("TextInput component accessibility tests", function () {
|
|
|
80
79
|
clearable: true
|
|
81
80
|
})), baseElement = _render.baseElement;
|
|
82
81
|
_context.next = 3;
|
|
83
|
-
return (0,
|
|
82
|
+
return (0, _axeHelper.axe)(baseElement);
|
|
84
83
|
case 3:
|
|
85
84
|
results = _context.sent;
|
|
86
85
|
expect(results).toHaveNoViolations();
|
|
@@ -113,7 +112,7 @@ describe("TextInput component accessibility tests", function () {
|
|
|
113
112
|
autocomplete: "on"
|
|
114
113
|
})), baseElement = _render2.baseElement;
|
|
115
114
|
_context2.next = 3;
|
|
116
|
-
return (0,
|
|
115
|
+
return (0, _axeHelper.axe)(baseElement);
|
|
117
116
|
case 3:
|
|
118
117
|
results = _context2.sent;
|
|
119
118
|
expect(results).toHaveNoViolations();
|
|
@@ -146,7 +145,7 @@ describe("TextInput component accessibility tests", function () {
|
|
|
146
145
|
suggestions: countries
|
|
147
146
|
})), baseElement = _render3.baseElement;
|
|
148
147
|
_context3.next = 3;
|
|
149
|
-
return (0,
|
|
148
|
+
return (0, _axeHelper.axe)(baseElement);
|
|
150
149
|
case 3:
|
|
151
150
|
results = _context3.sent;
|
|
152
151
|
expect(results).toHaveNoViolations();
|
|
@@ -179,7 +178,7 @@ describe("TextInput component accessibility tests", function () {
|
|
|
179
178
|
pattern: "^.*(?=.*[a-zA-Z])(?=.*\\d)(?=.*[!&$%&? \"]).*$"
|
|
180
179
|
})), baseElement = _render4.baseElement;
|
|
181
180
|
_context4.next = 3;
|
|
182
|
-
return (0,
|
|
181
|
+
return (0, _axeHelper.axe)(baseElement);
|
|
183
182
|
case 3:
|
|
184
183
|
results = _context4.sent;
|
|
185
184
|
expect(results).toHaveNoViolations();
|
|
@@ -212,7 +211,7 @@ describe("TextInput component accessibility tests", function () {
|
|
|
212
211
|
optional: true
|
|
213
212
|
})), baseElement = _render5.baseElement;
|
|
214
213
|
_context5.next = 3;
|
|
215
|
-
return (0,
|
|
214
|
+
return (0, _axeHelper.axe)(baseElement);
|
|
216
215
|
case 3:
|
|
217
216
|
results = _context5.sent;
|
|
218
217
|
expect(results).toHaveNoViolations();
|
|
@@ -245,7 +244,7 @@ describe("TextInput component accessibility tests", function () {
|
|
|
245
244
|
clearable: true
|
|
246
245
|
})), baseElement = _render6.baseElement;
|
|
247
246
|
_context6.next = 3;
|
|
248
|
-
return (0,
|
|
247
|
+
return (0, _axeHelper.axe)(baseElement);
|
|
249
248
|
case 3:
|
|
250
249
|
results = _context6.sent;
|
|
251
250
|
expect(results).toHaveNoViolations();
|
|
@@ -277,7 +276,7 @@ describe("TextInput component accessibility tests", function () {
|
|
|
277
276
|
readOnly: true
|
|
278
277
|
})), baseElement = _render7.baseElement;
|
|
279
278
|
_context7.next = 3;
|
|
280
|
-
return (0,
|
|
279
|
+
return (0, _axeHelper.axe)(baseElement);
|
|
281
280
|
case 3:
|
|
282
281
|
results = _context7.sent;
|
|
283
282
|
expect(results).toHaveNoViolations();
|
|
@@ -308,7 +307,7 @@ describe("TextInput component accessibility tests", function () {
|
|
|
308
307
|
disabled: true
|
|
309
308
|
})), baseElement = _render8.baseElement;
|
|
310
309
|
_context8.next = 3;
|
|
311
|
-
return (0,
|
|
310
|
+
return (0, _axeHelper.axe)(baseElement);
|
|
312
311
|
case 3:
|
|
313
312
|
results = _context8.sent;
|
|
314
313
|
expect(results).toHaveNoViolations();
|
package/text-input/TextInput.js
CHANGED
|
@@ -17,14 +17,14 @@ var _variables = require("../common/variables");
|
|
|
17
17
|
var _utils = require("../common/utils");
|
|
18
18
|
var _Suggestions = _interopRequireDefault(require("./Suggestions"));
|
|
19
19
|
var Popover = _interopRequireWildcard(require("@radix-ui/react-popover"));
|
|
20
|
-
var _uuid = require("uuid");
|
|
21
20
|
var _ActionIcon = _interopRequireDefault(require("../action-icon/ActionIcon"));
|
|
22
21
|
var _Flex = _interopRequireDefault(require("../flex/Flex"));
|
|
23
22
|
var _NumberInputContext = require("../number-input/NumberInputContext");
|
|
24
23
|
var _Icon = _interopRequireDefault(require("../icon/Icon"));
|
|
24
|
+
var _useWidth = _interopRequireDefault(require("../utils/useWidth"));
|
|
25
25
|
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10;
|
|
26
26
|
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); }
|
|
27
|
-
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 &&
|
|
27
|
+
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; }
|
|
28
28
|
var sizes = {
|
|
29
29
|
small: "240px",
|
|
30
30
|
medium: "360px",
|
|
@@ -75,26 +75,6 @@ var isNumberIncorrect = function isNumberIncorrect(value, minNumber, maxNumber)
|
|
|
75
75
|
var patternMismatch = function patternMismatch(pattern, value) {
|
|
76
76
|
return pattern != null && !new RegExp(pattern).test(value);
|
|
77
77
|
};
|
|
78
|
-
var useWidth = function useWidth(target) {
|
|
79
|
-
var _useState = (0, _react.useState)(0),
|
|
80
|
-
_useState2 = (0, _slicedToArray2["default"])(_useState, 2),
|
|
81
|
-
width = _useState2[0],
|
|
82
|
-
setWidth = _useState2[1];
|
|
83
|
-
(0, _react.useEffect)(function () {
|
|
84
|
-
if (target != null) {
|
|
85
|
-
setWidth(target.getBoundingClientRect().width);
|
|
86
|
-
var triggerObserver = new ResizeObserver(function (entries) {
|
|
87
|
-
var rect = entries[0].target.getBoundingClientRect();
|
|
88
|
-
setWidth(rect === null || rect === void 0 ? void 0 : rect.width);
|
|
89
|
-
});
|
|
90
|
-
triggerObserver.observe(target);
|
|
91
|
-
return function () {
|
|
92
|
-
triggerObserver.unobserve(target);
|
|
93
|
-
};
|
|
94
|
-
}
|
|
95
|
-
}, [target]);
|
|
96
|
-
return width;
|
|
97
|
-
};
|
|
98
78
|
var DxcTextInput = /*#__PURE__*/_react["default"].forwardRef(function (_ref2, ref) {
|
|
99
79
|
var label = _ref2.label,
|
|
100
80
|
_ref2$name = _ref2.name,
|
|
@@ -132,39 +112,37 @@ var DxcTextInput = /*#__PURE__*/_react["default"].forwardRef(function (_ref2, re
|
|
|
132
112
|
size = _ref2$size === void 0 ? "medium" : _ref2$size,
|
|
133
113
|
_ref2$tabIndex = _ref2.tabIndex,
|
|
134
114
|
tabIndex = _ref2$tabIndex === void 0 ? 0 : _ref2$tabIndex;
|
|
135
|
-
var
|
|
136
|
-
_useState4 = (0, _slicedToArray2["default"])(_useState3, 1),
|
|
137
|
-
inputId = _useState4[0];
|
|
115
|
+
var inputId = "input-".concat((0, _react.useId)());
|
|
138
116
|
var autosuggestId = "suggestions-".concat(inputId);
|
|
139
117
|
var errorId = "error-".concat(inputId);
|
|
140
|
-
var
|
|
118
|
+
var _useState = (0, _react.useState)(defaultValue),
|
|
119
|
+
_useState2 = (0, _slicedToArray2["default"])(_useState, 2),
|
|
120
|
+
innerValue = _useState2[0],
|
|
121
|
+
setInnerValue = _useState2[1];
|
|
122
|
+
var _useState3 = (0, _react.useState)(false),
|
|
123
|
+
_useState4 = (0, _slicedToArray2["default"])(_useState3, 2),
|
|
124
|
+
isOpen = _useState4[0],
|
|
125
|
+
changeIsOpen = _useState4[1];
|
|
126
|
+
var _useState5 = (0, _react.useState)(false),
|
|
141
127
|
_useState6 = (0, _slicedToArray2["default"])(_useState5, 2),
|
|
142
|
-
|
|
143
|
-
|
|
128
|
+
isSearching = _useState6[0],
|
|
129
|
+
changeIsSearching = _useState6[1];
|
|
144
130
|
var _useState7 = (0, _react.useState)(false),
|
|
145
131
|
_useState8 = (0, _slicedToArray2["default"])(_useState7, 2),
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
var _useState9 = (0, _react.useState)(
|
|
132
|
+
isAutosuggestError = _useState8[0],
|
|
133
|
+
changeIsAutosuggestError = _useState8[1];
|
|
134
|
+
var _useState9 = (0, _react.useState)([]),
|
|
149
135
|
_useState10 = (0, _slicedToArray2["default"])(_useState9, 2),
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
var _useState11 = (0, _react.useState)(
|
|
136
|
+
filteredSuggestions = _useState10[0],
|
|
137
|
+
changeFilteredSuggestions = _useState10[1];
|
|
138
|
+
var _useState11 = (0, _react.useState)(-1),
|
|
153
139
|
_useState12 = (0, _slicedToArray2["default"])(_useState11, 2),
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
var _useState13 = (0, _react.useState)([]),
|
|
157
|
-
_useState14 = (0, _slicedToArray2["default"])(_useState13, 2),
|
|
158
|
-
filteredSuggestions = _useState14[0],
|
|
159
|
-
changeFilteredSuggestions = _useState14[1];
|
|
160
|
-
var _useState15 = (0, _react.useState)(-1),
|
|
161
|
-
_useState16 = (0, _slicedToArray2["default"])(_useState15, 2),
|
|
162
|
-
visualFocusIndex = _useState16[0],
|
|
163
|
-
changeVisualFocusIndex = _useState16[1];
|
|
140
|
+
visualFocusIndex = _useState12[0],
|
|
141
|
+
changeVisualFocusIndex = _useState12[1];
|
|
164
142
|
var inputRef = (0, _react.useRef)(null);
|
|
165
143
|
var inputContainerRef = (0, _react.useRef)(null);
|
|
166
144
|
var actionRef = (0, _react.useRef)(null);
|
|
167
|
-
var width =
|
|
145
|
+
var width = (0, _useWidth["default"])(inputContainerRef.current);
|
|
168
146
|
var colorsTheme = (0, _useTheme["default"])();
|
|
169
147
|
var translatedLabels = (0, _useTranslatedLabels["default"])();
|
|
170
148
|
var numberInputContext = (0, _react.useContext)(_NumberInputContext.NumberInputContext);
|
|
@@ -281,6 +259,7 @@ var DxcTextInput = /*#__PURE__*/_react["default"].forwardRef(function (_ref2, re
|
|
|
281
259
|
case "Esc":
|
|
282
260
|
case "Escape":
|
|
283
261
|
event.preventDefault();
|
|
262
|
+
isOpen && event.stopPropagation();
|
|
284
263
|
if (hasSuggestions(suggestions)) {
|
|
285
264
|
changeValue("");
|
|
286
265
|
isOpen && closeSuggestions();
|
|
@@ -364,7 +343,10 @@ var DxcTextInput = /*#__PURE__*/_react["default"].forwardRef(function (_ref2, re
|
|
|
364
343
|
open: isOpen && (filteredSuggestions.length > 0 || isSearching || isAutosuggestError)
|
|
365
344
|
}, /*#__PURE__*/_react["default"].createElement(Popover.Trigger, {
|
|
366
345
|
asChild: true,
|
|
367
|
-
|
|
346
|
+
type: undefined,
|
|
347
|
+
"aria-controls": undefined,
|
|
348
|
+
"aria-haspopup": undefined,
|
|
349
|
+
"aria-expanded": undefined
|
|
368
350
|
}, children), /*#__PURE__*/_react["default"].createElement(Popover.Portal, null, /*#__PURE__*/_react["default"].createElement(Popover.Content, {
|
|
369
351
|
sideOffset: 5,
|
|
370
352
|
style: {
|
|
@@ -440,7 +422,7 @@ var DxcTextInput = /*#__PURE__*/_react["default"].forwardRef(function (_ref2, re
|
|
|
440
422
|
"aria-errormessage": error ? errorId : undefined,
|
|
441
423
|
"aria-required": !disabled && !optional
|
|
442
424
|
}), !disabled && error && /*#__PURE__*/_react["default"].createElement(ErrorIcon, {
|
|
443
|
-
"aria-
|
|
425
|
+
"aria-hidden": "true"
|
|
444
426
|
}, /*#__PURE__*/_react["default"].createElement(_Icon["default"], {
|
|
445
427
|
icon: "filled_error"
|
|
446
428
|
})), !disabled && !readOnly && clearable && (value !== null && value !== void 0 ? value : innerValue).length > 0 && /*#__PURE__*/_react["default"].createElement(_ActionIcon["default"], {
|
|
@@ -473,11 +455,14 @@ var DxcTextInput = /*#__PURE__*/_react["default"].forwardRef(function (_ref2, re
|
|
|
473
455
|
disabled: disabled
|
|
474
456
|
}, suffix))), !disabled && typeof error === "string" && /*#__PURE__*/_react["default"].createElement(Error, {
|
|
475
457
|
id: errorId,
|
|
458
|
+
role: "alert",
|
|
476
459
|
"aria-live": error ? "assertive" : "off"
|
|
477
460
|
}, error)));
|
|
478
461
|
});
|
|
479
|
-
var TextInputContainer = _styledComponents["default"].div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["\n box-sizing: border-box;\n display: flex;\n flex-direction: column;\n width: ", ";\n margin: ", ";\n margin-top: ", ";\n margin-right: ", ";\n margin-bottom: ", ";\n margin-left: ", ";\n"])), function (props) {
|
|
462
|
+
var TextInputContainer = _styledComponents["default"].div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["\n box-sizing: border-box;\n display: flex;\n flex-direction: column;\n width: ", ";\n ", ";\n margin: ", ";\n margin-top: ", ";\n margin-right: ", ";\n margin-bottom: ", ";\n margin-left: ", ";\n font-family: ", ";\n"])), function (props) {
|
|
480
463
|
return calculateWidth(props.margin, props.size);
|
|
464
|
+
}, function (props) {
|
|
465
|
+
return props.size !== "fillParent" && "min-width:" + calculateWidth(props.margin, props.size);
|
|
481
466
|
}, function (props) {
|
|
482
467
|
return props.margin && (0, _typeof2["default"])(props.margin) !== "object" ? _variables.spaces[props.margin] : "0px";
|
|
483
468
|
}, function (props) {
|
|
@@ -488,11 +473,11 @@ var TextInputContainer = _styledComponents["default"].div(_templateObject || (_t
|
|
|
488
473
|
return props.margin && (0, _typeof2["default"])(props.margin) === "object" && props.margin.bottom ? _variables.spaces[props.margin.bottom] : "";
|
|
489
474
|
}, function (props) {
|
|
490
475
|
return props.margin && (0, _typeof2["default"])(props.margin) === "object" && props.margin.left ? _variables.spaces[props.margin.left] : "";
|
|
491
|
-
});
|
|
492
|
-
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) {
|
|
493
|
-
return props.disabled ? props.theme.disabledLabelFontColor : props.theme.labelFontColor;
|
|
494
476
|
}, function (props) {
|
|
495
477
|
return props.theme.fontFamily;
|
|
478
|
+
});
|
|
479
|
+
var Label = _styledComponents["default"].label(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2["default"])(["\n color: ", ";\n font-size: ", ";\n font-style: ", ";\n font-weight: ", ";\n line-height: ", ";\n ", "\n"])), function (props) {
|
|
480
|
+
return props.disabled ? props.theme.disabledLabelFontColor : props.theme.labelFontColor;
|
|
496
481
|
}, function (props) {
|
|
497
482
|
return props.theme.labelFontSize;
|
|
498
483
|
}, function (props) {
|
|
@@ -507,10 +492,8 @@ var Label = _styledComponents["default"].label(_templateObject2 || (_templateObj
|
|
|
507
492
|
var OptionalLabel = _styledComponents["default"].span(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2["default"])(["\n font-weight: ", ";\n"])), function (props) {
|
|
508
493
|
return props.theme.optionalLabelFontWeight;
|
|
509
494
|
});
|
|
510
|
-
var HelperText = _styledComponents["default"].span(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2["default"])(["\n color: ", ";\n font-
|
|
495
|
+
var HelperText = _styledComponents["default"].span(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2["default"])(["\n color: ", ";\n font-size: ", ";\n font-style: ", ";\n font-weight: ", ";\n line-height: ", ";\n margin-bottom: 0.25rem;\n"])), function (props) {
|
|
511
496
|
return props.disabled ? props.theme.disabledHelperTextFontColor : props.theme.helperTextFontColor;
|
|
512
|
-
}, function (props) {
|
|
513
|
-
return props.theme.fontFamily;
|
|
514
497
|
}, function (props) {
|
|
515
498
|
return props.theme.helperTextFontSize;
|
|
516
499
|
}, function (props) {
|
|
@@ -520,7 +503,7 @@ var HelperText = _styledComponents["default"].span(_templateObject4 || (_templat
|
|
|
520
503
|
}, function (props) {
|
|
521
504
|
return props.theme.helperTextLineHeight;
|
|
522
505
|
});
|
|
523
|
-
var InputContainer = _styledComponents["default"].div(_templateObject5 || (_templateObject5 = (0, _taggedTemplateLiteral2["default"])(["\n position: relative;\n display: flex;\n align-items: center;\n height: calc(2.5rem - 2px);\n padding: 0 0.5rem;\n
|
|
506
|
+
var InputContainer = _styledComponents["default"].div(_templateObject5 || (_templateObject5 = (0, _taggedTemplateLiteral2["default"])(["\n position: relative;\n display: flex;\n align-items: center;\n height: calc(2.5rem - 2px);\n padding: 0 0.5rem;\n ", "\n box-shadow: 0 0 0 2px transparent;\n border-radius: 4px;\n border: 1px solid\n ", ";\n ", "\n ", ";\n"])), function (props) {
|
|
524
507
|
if (props.disabled) return "background-color: ".concat(props.theme.disabledContainerFillColor, ";");
|
|
525
508
|
}, function (props) {
|
|
526
509
|
if (props.disabled) return props.theme.disabledBorderColor;else if (props.readOnly) return props.theme.readOnlyBorderColor;else return props.theme.enabledBorderColor;
|
|
@@ -529,7 +512,7 @@ var InputContainer = _styledComponents["default"].div(_templateObject5 || (_temp
|
|
|
529
512
|
}, function (props) {
|
|
530
513
|
return !props.disabled ? "\n &: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-within {\n border-color: transparent;\n box-shadow: 0 0 0 2px ").concat(props.theme.focusBorderColor, ";\n }\n ") : "cursor: not-allowed;";
|
|
531
514
|
});
|
|
532
|
-
var Input = _styledComponents["default"].input(_templateObject6 || (_templateObject6 = (0, _taggedTemplateLiteral2["default"])(["\n height: calc(2.5rem - 2px);\n width: 100%;\n background: none;\n border: none;\n outline: none;\n padding: 0 0.5rem;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n
|
|
515
|
+
var Input = _styledComponents["default"].input(_templateObject6 || (_templateObject6 = (0, _taggedTemplateLiteral2["default"])(["\n height: calc(2.5rem - 2px);\n width: 100%;\n background: none;\n border: none;\n outline: none;\n padding: 0 0.5rem;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n color: ", ";\n font-family: ", ";\n font-size: ", ";\n font-style: ", ";\n font-weight: ", ";\n line-height: 1.5em;\n ", "\n\n ::placeholder {\n color: ", ";\n }\n"])), function (props) {
|
|
533
516
|
return props.disabled ? props.theme.disabledValueFontColor : props.theme.valueFontColor;
|
|
534
517
|
}, function (props) {
|
|
535
518
|
return props.theme.fontFamily;
|
|
@@ -544,24 +527,22 @@ var Input = _styledComponents["default"].input(_templateObject6 || (_templateObj
|
|
|
544
527
|
}, function (props) {
|
|
545
528
|
return props.disabled ? props.theme.disabledPlaceholderFontColor : props.theme.placeholderFontColor;
|
|
546
529
|
});
|
|
547
|
-
var Prefix = _styledComponents["default"].span(_templateObject7 || (_templateObject7 = (0, _taggedTemplateLiteral2["default"])(["\n height: 1.5rem;\n
|
|
548
|
-
|
|
549
|
-
return "color: ".concat(color, "; border-right: 1px solid ").concat(color, ";");
|
|
530
|
+
var Prefix = _styledComponents["default"].span(_templateObject7 || (_templateObject7 = (0, _taggedTemplateLiteral2["default"])(["\n height: 1.5rem;\n margin-left: 0.25rem;\n padding-right: ", ";\n ", ";\n font-size: 1rem;\n line-height: 1.5rem;\n pointer-events: none;\n"])), function (props) {
|
|
531
|
+
return props.theme.prefixDividerPaddingRight;
|
|
550
532
|
}, function (props) {
|
|
551
|
-
|
|
533
|
+
var color = props.disabled ? props.theme.disabledPrefixColor : props.theme.prefixColor;
|
|
534
|
+
return "color: ".concat(color, "; border-right: ").concat(props.theme.prefixDividerBorderWidth, " ").concat(props.theme.prefixDividerBorderStyle, " ").concat(color, ";");
|
|
552
535
|
});
|
|
553
|
-
var Suffix = _styledComponents["default"].span(_templateObject8 || (_templateObject8 = (0, _taggedTemplateLiteral2["default"])(["\n height: 1.5rem;\n
|
|
554
|
-
|
|
555
|
-
return "color: ".concat(color, "; border-left: 1px solid ").concat(color, ";");
|
|
536
|
+
var Suffix = _styledComponents["default"].span(_templateObject8 || (_templateObject8 = (0, _taggedTemplateLiteral2["default"])(["\n height: 1.5rem;\n margin: 0 0.25rem;\n padding-left: ", ";\n ", ";\n font-size: 1rem;\n line-height: 1.5rem;\n pointer-events: none;\n"])), function (props) {
|
|
537
|
+
return props.theme.suffixDividerPaddingLeft;
|
|
556
538
|
}, function (props) {
|
|
557
|
-
|
|
539
|
+
var color = props.disabled ? props.theme.disabledSuffixColor : props.theme.suffixColor;
|
|
540
|
+
return "color: ".concat(color, "; border-left: ").concat(props.theme.suffixDividerBorderWidth, " ").concat(props.theme.suffixDividerBorderStyle, " ").concat(color, ";");
|
|
558
541
|
});
|
|
559
|
-
var ErrorIcon = _styledComponents["default"].span(_templateObject9 || (_templateObject9 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n flex-wrap: wrap;\n align-content: center;\n padding: 3px;\n height: 18px;\n width: 18px;\n font-size: 18px;\n color: ", ";\n
|
|
542
|
+
var ErrorIcon = _styledComponents["default"].span(_templateObject9 || (_templateObject9 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n flex-wrap: wrap;\n align-content: center;\n padding: 3px;\n height: 18px;\n width: 18px;\n font-size: 18px;\n color: ", ";\n"])), function (props) {
|
|
560
543
|
return props.theme.errorIconColor;
|
|
561
544
|
});
|
|
562
|
-
var Error = _styledComponents["default"].span(_templateObject10 || (_templateObject10 = (0, _taggedTemplateLiteral2["default"])(["\n min-height: 1.5em;\n color: ", ";\n font-
|
|
545
|
+
var Error = _styledComponents["default"].span(_templateObject10 || (_templateObject10 = (0, _taggedTemplateLiteral2["default"])(["\n min-height: 1.5em;\n color: ", ";\n font-size: 0.75rem;\n font-weight: 400;\n line-height: 1.5em;\n margin-top: 0.25rem;\n"])), function (props) {
|
|
563
546
|
return props.theme.errorMessageColor;
|
|
564
|
-
}, function (props) {
|
|
565
|
-
return props.theme.fontFamily;
|
|
566
547
|
});
|
|
567
548
|
var _default = exports["default"] = DxcTextInput;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import { userEvent, within } from "@storybook/
|
|
2
|
+
import { userEvent, within } from "@storybook/test";
|
|
3
3
|
import Title from "../../.storybook/components/Title";
|
|
4
4
|
import ExampleContainer from "../../.storybook/components/ExampleContainer";
|
|
5
5
|
import DxcTextInput from "./TextInput";
|
|
@@ -7,6 +7,7 @@ import Suggestions from "./Suggestions";
|
|
|
7
7
|
import { ThemeProvider } from "styled-components";
|
|
8
8
|
import useTheme from "../useTheme";
|
|
9
9
|
import { HalstackProvider } from "../HalstackContext";
|
|
10
|
+
import DxcFlex from "../flex/Flex";
|
|
10
11
|
|
|
11
12
|
export default {
|
|
12
13
|
title: "Text Input",
|
|
@@ -21,6 +22,7 @@ const action = {
|
|
|
21
22
|
<path d="M16 1H4c-1.1 0-2 .9-2 2v14h2V3h12V1zm3 4H8c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h11c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2zm0 16H8V7h11v14z" />
|
|
22
23
|
</svg>
|
|
23
24
|
),
|
|
25
|
+
title: "Copy",
|
|
24
26
|
};
|
|
25
27
|
|
|
26
28
|
const actionLargeIconSVG = {
|
|
@@ -31,11 +33,13 @@ const actionLargeIconSVG = {
|
|
|
31
33
|
<path d="M11.99 2C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2zM12 20c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8zm.5-13H11v6l5.25 3.15.75-1.23-4.5-2.67z" />
|
|
32
34
|
</svg>
|
|
33
35
|
),
|
|
36
|
+
title: "Clock",
|
|
34
37
|
};
|
|
35
38
|
|
|
36
39
|
const actionLargeIconURL = {
|
|
37
40
|
onClick: () => {},
|
|
38
41
|
icon: "search",
|
|
42
|
+
title: "Search",
|
|
39
43
|
};
|
|
40
44
|
|
|
41
45
|
const country = ["Afghanistan"];
|
|
@@ -265,6 +269,14 @@ export const Chromatic = () => (
|
|
|
265
269
|
<Title title="FillParent size" theme="light" level={4} />
|
|
266
270
|
<DxcTextInput label="FillParent" size="fillParent" />
|
|
267
271
|
</ExampleContainer>
|
|
272
|
+
<ExampleContainer>
|
|
273
|
+
<Title title="Different sizes inside a flex" theme="light" level={4} />
|
|
274
|
+
<DxcFlex justifyContent="space-between" gap="1.5rem">
|
|
275
|
+
<DxcTextInput label="Text input" size="fillParent" />
|
|
276
|
+
<DxcTextInput label="Text input" size="medium" />
|
|
277
|
+
<DxcTextInput label="Text input" size="large" />
|
|
278
|
+
</DxcFlex>
|
|
279
|
+
</ExampleContainer>
|
|
268
280
|
<Title title="Opinionated theme" theme="light" level={2} />
|
|
269
281
|
<ExampleContainer>
|
|
270
282
|
<HalstackProvider theme={opinionatedTheme}>
|
|
@@ -371,7 +383,7 @@ const AutosuggestListbox = () => {
|
|
|
371
383
|
<ExampleContainer pseudoState="pseudo-hover">
|
|
372
384
|
<Title title="Hovered suggestion" theme="light" level={4} />
|
|
373
385
|
<Suggestions
|
|
374
|
-
id="
|
|
386
|
+
id="x1"
|
|
375
387
|
value=""
|
|
376
388
|
suggestions={country}
|
|
377
389
|
visualFocusIndex={-1}
|
|
@@ -385,7 +397,7 @@ const AutosuggestListbox = () => {
|
|
|
385
397
|
<ExampleContainer pseudoState="pseudo-active">
|
|
386
398
|
<Title title="Active suggestion" theme="light" level={4} />
|
|
387
399
|
<Suggestions
|
|
388
|
-
id="
|
|
400
|
+
id="x2"
|
|
389
401
|
value=""
|
|
390
402
|
suggestions={country}
|
|
391
403
|
visualFocusIndex={-1}
|
|
@@ -399,7 +411,7 @@ const AutosuggestListbox = () => {
|
|
|
399
411
|
<ExampleContainer>
|
|
400
412
|
<Title title="Focused suggestion" theme="light" level={4} />
|
|
401
413
|
<Suggestions
|
|
402
|
-
id="
|
|
414
|
+
id="x3"
|
|
403
415
|
value=""
|
|
404
416
|
suggestions={country}
|
|
405
417
|
visualFocusIndex={0}
|
|
@@ -413,7 +425,7 @@ const AutosuggestListbox = () => {
|
|
|
413
425
|
<ExampleContainer>
|
|
414
426
|
<Title title="Highlighted suggestion" theme="light" level={4} />
|
|
415
427
|
<Suggestions
|
|
416
|
-
id="
|
|
428
|
+
id="x4"
|
|
417
429
|
value="Afgh"
|
|
418
430
|
suggestions={country}
|
|
419
431
|
visualFocusIndex={-1}
|
|
@@ -428,7 +440,7 @@ const AutosuggestListbox = () => {
|
|
|
428
440
|
<ExampleContainer>
|
|
429
441
|
<Title title="Autosuggest Error" theme="light" level={3} />
|
|
430
442
|
<Suggestions
|
|
431
|
-
id="
|
|
443
|
+
id="x5"
|
|
432
444
|
value=""
|
|
433
445
|
suggestions={country}
|
|
434
446
|
visualFocusIndex={-1}
|
|
@@ -442,7 +454,7 @@ const AutosuggestListbox = () => {
|
|
|
442
454
|
<ExampleContainer>
|
|
443
455
|
<Title title="Autosuggest Searching message" theme="light" level={3} />
|
|
444
456
|
<Suggestions
|
|
445
|
-
id="
|
|
457
|
+
id="x6"
|
|
446
458
|
value=""
|
|
447
459
|
suggestions={country}
|
|
448
460
|
visualFocusIndex={-1}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -8,7 +8,7 @@ var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/creat
|
|
|
8
8
|
var _react = _interopRequireDefault(require("react"));
|
|
9
9
|
var _react2 = require("@testing-library/react");
|
|
10
10
|
var _userEvent = _interopRequireDefault(require("@testing-library/user-event"));
|
|
11
|
-
var _TextInput = _interopRequireDefault(require("./TextInput
|
|
11
|
+
var _TextInput = _interopRequireDefault(require("./TextInput"));
|
|
12
12
|
// Mocking DOMRect for Radix Primitive Popover
|
|
13
13
|
global.globalThis = global;
|
|
14
14
|
global.DOMRect = {
|
|
@@ -27,7 +27,7 @@ global.ResizeObserver = /*#__PURE__*/function () {
|
|
|
27
27
|
function ResizeObserver() {
|
|
28
28
|
(0, _classCallCheck2["default"])(this, ResizeObserver);
|
|
29
29
|
}
|
|
30
|
-
(0, _createClass2["default"])(ResizeObserver, [{
|
|
30
|
+
return (0, _createClass2["default"])(ResizeObserver, [{
|
|
31
31
|
key: "observe",
|
|
32
32
|
value: function observe() {}
|
|
33
33
|
}, {
|
|
@@ -37,7 +37,6 @@ global.ResizeObserver = /*#__PURE__*/function () {
|
|
|
37
37
|
key: "disconnect",
|
|
38
38
|
value: function disconnect() {}
|
|
39
39
|
}]);
|
|
40
|
-
return ResizeObserver;
|
|
41
40
|
}();
|
|
42
41
|
var countries = ["Afghanistan", "Albania", "Algeria", "Andorra", "Angola", "Antigua and Barbuda", "Bahamas", "Bahrain", "Bangladesh", "Barbados", "Cabo Verde", "Cambodia", "Cameroon", "Canada", "Cayman Islands, The", "Central African Republic", "Chad", "Democratic Republic of the Congo", "Dominican Republic", "Dominica", "Denmark", "Djibouti"];
|
|
43
42
|
var specialCharacters = ["/", "\\", "*", "(", ")", "[", "]", "+", "?", "*{[]}|"];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|