@dxc-technology/halstack-react 0.0.0-bd364ae → 0.0.0-bd47c58
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 +2 -2
- package/BackgroundColorContext.js +1 -1
- package/HalstackContext.d.ts +1337 -5
- package/HalstackContext.js +117 -77
- package/README.md +47 -0
- package/accordion/Accordion.d.ts +1 -1
- package/accordion/Accordion.js +110 -114
- package/accordion/Accordion.stories.tsx +105 -115
- package/accordion/Accordion.test.js +10 -11
- package/accordion/types.d.ts +1 -12
- package/accordion-group/AccordionGroup.d.ts +4 -3
- package/accordion-group/AccordionGroup.js +25 -65
- package/accordion-group/AccordionGroup.stories.tsx +93 -66
- package/accordion-group/AccordionGroup.test.js +27 -62
- package/accordion-group/AccordionGroupAccordion.d.ts +4 -0
- package/accordion-group/AccordionGroupAccordion.js +43 -0
- package/accordion-group/types.d.ts +7 -12
- package/alert/Alert.js +5 -9
- package/alert/Alert.stories.tsx +28 -0
- package/alert/Alert.test.js +1 -1
- package/bleed/Bleed.stories.tsx +64 -63
- package/box/Box.d.ts +1 -1
- package/box/Box.js +8 -27
- package/box/Box.stories.tsx +38 -51
- package/box/Box.test.js +1 -1
- package/box/types.d.ts +0 -11
- package/bulleted-list/BulletedList.d.ts +7 -0
- package/bulleted-list/BulletedList.js +125 -0
- package/bulleted-list/BulletedList.stories.tsx +206 -0
- package/bulleted-list/types.d.ts +38 -0
- package/button/Button.d.ts +1 -1
- package/button/Button.js +42 -72
- package/button/Button.stories.tsx +159 -8
- package/button/Button.test.js +12 -1
- package/button/types.d.ts +9 -5
- package/card/Card.d.ts +1 -1
- package/card/Card.js +27 -45
- package/card/Card.stories.tsx +12 -42
- package/card/Card.test.js +1 -1
- package/card/types.d.ts +1 -6
- package/checkbox/Checkbox.d.ts +2 -2
- package/checkbox/Checkbox.js +94 -101
- package/checkbox/Checkbox.stories.tsx +131 -59
- package/checkbox/Checkbox.test.js +94 -17
- package/checkbox/types.d.ts +4 -0
- package/chip/Chip.js +28 -49
- package/chip/Chip.stories.tsx +121 -26
- package/chip/Chip.test.js +3 -5
- package/chip/types.d.ts +1 -1
- package/common/OpenSans.css +68 -80
- package/common/coreTokens.d.ts +146 -0
- package/common/coreTokens.js +167 -0
- package/common/utils.d.ts +1 -0
- package/common/utils.js +4 -4
- package/common/variables.d.ts +1490 -0
- package/common/variables.js +1016 -1117
- package/date-input/Calendar.d.ts +4 -0
- package/date-input/Calendar.js +258 -0
- package/date-input/DateInput.js +134 -237
- package/date-input/DateInput.stories.tsx +199 -33
- package/date-input/DateInput.test.js +494 -138
- package/date-input/DatePicker.d.ts +4 -0
- package/date-input/DatePicker.js +146 -0
- package/date-input/Icons.d.ts +6 -0
- package/date-input/Icons.js +75 -0
- package/date-input/YearPicker.d.ts +4 -0
- package/date-input/YearPicker.js +126 -0
- package/date-input/types.d.ts +51 -0
- package/dialog/Dialog.d.ts +1 -1
- package/dialog/Dialog.js +72 -79
- package/dialog/Dialog.stories.tsx +154 -171
- package/dialog/Dialog.test.js +334 -5
- package/dialog/types.d.ts +0 -12
- package/dropdown/Dropdown.d.ts +1 -1
- package/dropdown/Dropdown.js +246 -249
- package/dropdown/Dropdown.stories.tsx +245 -56
- package/dropdown/Dropdown.test.js +507 -110
- package/dropdown/DropdownMenu.d.ts +4 -0
- package/dropdown/DropdownMenu.js +74 -0
- package/dropdown/DropdownMenuItem.d.ts +4 -0
- package/dropdown/DropdownMenuItem.js +79 -0
- package/dropdown/types.d.ts +23 -3
- package/file-input/FileInput.d.ts +2 -2
- package/file-input/FileInput.js +174 -220
- package/file-input/FileInput.stories.tsx +122 -11
- package/file-input/FileInput.test.js +14 -14
- package/file-input/FileItem.d.ts +4 -14
- package/file-input/FileItem.js +39 -63
- package/file-input/types.d.ts +18 -1
- package/flex/Flex.d.ts +4 -0
- package/flex/Flex.js +71 -0
- package/flex/Flex.stories.tsx +112 -0
- package/flex/types.d.ts +97 -0
- package/footer/Footer.d.ts +1 -1
- package/footer/Footer.js +44 -64
- package/footer/Footer.stories.tsx +37 -16
- package/footer/Footer.test.js +16 -26
- package/footer/Icons.js +1 -1
- package/footer/types.d.ts +11 -12
- package/grid/Grid.d.ts +7 -0
- package/grid/Grid.js +91 -0
- package/grid/Grid.stories.tsx +219 -0
- package/grid/types.d.ts +115 -0
- package/header/Header.d.ts +4 -3
- package/header/Header.js +83 -110
- package/header/Header.stories.tsx +118 -39
- package/header/Header.test.js +2 -2
- package/header/Icons.js +2 -2
- package/header/types.d.ts +0 -13
- package/heading/Heading.js +1 -1
- package/heading/Heading.test.js +1 -1
- package/image/Image.d.ts +4 -0
- package/image/Image.js +85 -0
- package/image/Image.stories.tsx +127 -0
- package/image/types.d.ts +72 -0
- package/inset/Inset.stories.tsx +5 -4
- package/layout/ApplicationLayout.d.ts +15 -6
- package/layout/ApplicationLayout.js +44 -69
- package/layout/ApplicationLayout.stories.tsx +80 -44
- package/layout/types.d.ts +18 -29
- package/link/Link.js +4 -4
- package/link/Link.stories.tsx +73 -6
- package/link/Link.test.js +2 -4
- package/link/types.d.ts +3 -3
- package/main.d.ts +8 -9
- package/main.js +41 -49
- package/{tabs-nav → nav-tabs}/NavTabs.d.ts +2 -2
- package/{tabs-nav → nav-tabs}/NavTabs.js +13 -16
- package/{tabs-nav → nav-tabs}/NavTabs.stories.tsx +110 -6
- package/{tabs-nav → nav-tabs}/NavTabs.test.js +1 -1
- package/{tabs-nav → nav-tabs}/Tab.js +51 -37
- package/{tabs-nav → nav-tabs}/types.d.ts +9 -10
- package/number-input/NumberInput.d.ts +7 -0
- package/number-input/NumberInput.js +6 -4
- package/number-input/NumberInput.test.js +317 -98
- package/package.json +18 -22
- package/paginator/Icons.d.ts +5 -0
- package/paginator/Icons.js +16 -28
- package/paginator/Paginator.js +8 -16
- package/paginator/Paginator.stories.tsx +24 -0
- package/paginator/Paginator.test.js +91 -39
- package/paragraph/Paragraph.d.ts +5 -0
- package/paragraph/Paragraph.js +38 -0
- package/paragraph/Paragraph.stories.tsx +44 -0
- package/password-input/Icons.d.ts +6 -0
- package/password-input/Icons.js +39 -0
- package/password-input/PasswordInput.js +35 -82
- package/password-input/PasswordInput.stories.tsx +1 -0
- package/password-input/PasswordInput.test.js +34 -40
- package/progress-bar/ProgressBar.js +60 -54
- package/progress-bar/ProgressBar.stories.jsx +38 -3
- package/progress-bar/ProgressBar.test.js +68 -23
- package/quick-nav/QuickNav.js +23 -18
- package/quick-nav/QuickNav.stories.tsx +145 -26
- package/radio-group/Radio.d.ts +1 -1
- package/radio-group/Radio.js +46 -31
- package/radio-group/RadioGroup.js +31 -32
- package/radio-group/RadioGroup.stories.tsx +132 -18
- package/radio-group/RadioGroup.test.js +124 -97
- package/radio-group/types.d.ts +2 -2
- package/resultsetTable/Icons.d.ts +7 -0
- package/resultsetTable/Icons.js +51 -0
- package/resultsetTable/ResultsetTable.js +49 -108
- package/resultsetTable/ResultsetTable.stories.tsx +50 -25
- package/resultsetTable/ResultsetTable.test.js +61 -42
- package/resultsetTable/types.d.ts +1 -1
- package/select/Listbox.d.ts +1 -1
- package/select/Listbox.js +33 -16
- package/select/Option.js +11 -24
- package/select/Select.js +92 -71
- package/select/Select.stories.tsx +513 -136
- package/select/Select.test.js +413 -305
- package/select/types.d.ts +3 -6
- package/sidenav/Icons.d.ts +7 -0
- package/sidenav/Icons.js +51 -0
- package/sidenav/Sidenav.d.ts +6 -5
- package/sidenav/Sidenav.js +139 -48
- package/sidenav/Sidenav.stories.tsx +251 -151
- package/sidenav/Sidenav.test.js +25 -37
- package/sidenav/types.d.ts +52 -26
- package/slider/Slider.d.ts +2 -2
- package/slider/Slider.js +121 -97
- package/slider/Slider.stories.tsx +64 -1
- package/slider/Slider.test.js +122 -22
- package/slider/types.d.ts +4 -0
- package/spinner/Spinner.js +17 -23
- package/spinner/Spinner.stories.jsx +53 -27
- package/spinner/Spinner.test.js +1 -1
- package/switch/Switch.d.ts +2 -2
- package/switch/Switch.js +137 -70
- package/switch/Switch.stories.tsx +41 -30
- package/switch/Switch.test.js +145 -18
- package/switch/types.d.ts +4 -0
- package/table/Table.js +3 -3
- package/table/Table.stories.jsx +80 -1
- package/table/Table.test.js +2 -2
- package/tabs/Tab.d.ts +4 -0
- package/tabs/Tab.js +132 -0
- package/tabs/Tabs.js +358 -108
- package/tabs/Tabs.stories.tsx +119 -5
- package/tabs/Tabs.test.js +220 -10
- package/tabs/types.d.ts +13 -3
- package/tag/Tag.js +8 -10
- package/tag/Tag.stories.tsx +14 -1
- package/tag/Tag.test.js +1 -1
- package/tag/types.d.ts +1 -1
- package/text-input/Icons.d.ts +8 -0
- package/text-input/Icons.js +60 -0
- package/text-input/Suggestion.js +40 -11
- package/text-input/Suggestions.d.ts +4 -0
- package/text-input/Suggestions.js +134 -0
- package/text-input/TextInput.js +235 -348
- package/text-input/TextInput.stories.tsx +280 -185
- package/text-input/TextInput.test.js +736 -725
- package/text-input/types.d.ts +22 -3
- package/textarea/Textarea.js +3 -4
- package/textarea/Textarea.stories.jsx +60 -1
- package/textarea/Textarea.test.js +2 -4
- package/toggle-group/ToggleGroup.d.ts +2 -2
- package/toggle-group/ToggleGroup.js +85 -59
- package/toggle-group/ToggleGroup.stories.tsx +45 -0
- package/toggle-group/ToggleGroup.test.js +38 -24
- package/toggle-group/types.d.ts +23 -14
- package/typography/Typography.d.ts +4 -0
- package/typography/Typography.js +32 -0
- package/typography/Typography.stories.tsx +198 -0
- package/typography/types.d.ts +18 -0
- package/typography/types.js +5 -0
- package/useTheme.d.ts +1242 -1
- package/useTheme.js +1 -1
- package/useTranslatedLabels.d.ts +84 -1
- package/utils/BaseTypography.d.ts +21 -0
- package/utils/BaseTypography.js +108 -0
- package/utils/FocusLock.d.ts +13 -0
- package/utils/FocusLock.js +138 -0
- package/wizard/Wizard.js +10 -17
- package/wizard/Wizard.stories.tsx +40 -1
- package/wizard/Wizard.test.js +1 -1
- package/wizard/types.d.ts +3 -3
- package/card/ice-cream.jpg +0 -0
- package/common/RequiredComponent.js +0 -32
- package/list/List.d.ts +0 -4
- package/list/List.js +0 -47
- package/list/List.stories.tsx +0 -95
- package/list/types.d.ts +0 -7
- package/number-input/NumberInputContext.d.ts +0 -4
- package/number-input/NumberInputContext.js +0 -19
- package/number-input/numberInputContextTypes.d.ts +0 -19
- package/row/Row.d.ts +0 -3
- package/row/Row.js +0 -127
- package/row/Row.stories.tsx +0 -237
- package/row/types.d.ts +0 -28
- package/stack/Stack.d.ts +0 -3
- package/stack/Stack.js +0 -97
- package/stack/Stack.stories.tsx +0 -164
- package/stack/types.d.ts +0 -24
- package/text/Text.d.ts +0 -7
- package/text/Text.js +0 -30
- package/text/Text.stories.tsx +0 -19
- /package/{list → bulleted-list}/types.js +0 -0
- /package/{row → flex}/types.js +0 -0
- /package/{stack → grid}/types.js +0 -0
- /package/{tabs-nav → image}/types.js +0 -0
- /package/{tabs-nav → nav-tabs}/Tab.d.ts +0 -0
- /package/{number-input/numberInputContextTypes.js → nav-tabs/types.js} +0 -0
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import Title from "../../.storybook/components/Title";
|
|
3
|
+
import DxcParagraph from "./Paragraph";
|
|
4
|
+
import { BackgroundColorProvider } from "../BackgroundColorContext";
|
|
5
|
+
import ExampleContainer from "../../.storybook/components/ExampleContainer";
|
|
6
|
+
import DarkContainer from "../../.storybook/components/DarkSection";
|
|
7
|
+
|
|
8
|
+
export default {
|
|
9
|
+
title: "Paragraph",
|
|
10
|
+
component: DxcParagraph,
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export const Chromatic = () => (
|
|
14
|
+
<>
|
|
15
|
+
<ExampleContainer>
|
|
16
|
+
<Title title="Default Paragraph" level={4} />
|
|
17
|
+
<DxcParagraph>
|
|
18
|
+
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla id tortor sit amet velit auctor cursus id eget
|
|
19
|
+
nisl. Vivamus luctus egestas eros, at mattis libero eleifend ac. Integer vel urna rutrum, pretium arcu
|
|
20
|
+
dignissim, fringilla turpis. Nullam luctus odio quis magna finibus, a pharetra magna euismod. Nullam efficitur
|
|
21
|
+
semper pellentesque. Nulla eget arcu ac diam fringilla vehicula. In imperdiet nisl hendrerit, elementum metus
|
|
22
|
+
eu, ornare risus. Aenean neque nibh, vestibulum vitae elit vel, imperdiet suscipit leo. Curabitur blandit
|
|
23
|
+
iaculis pretium. Fusce id imperdiet dui, ut laoreet justo. Sed maximus sollicitudin ipsum, et varius massa
|
|
24
|
+
condimentum eget. Vivamus id mauris et nisl mattis consequat et id lectus. Quisque mollis lacinia nisl.
|
|
25
|
+
Suspendisse sed quam tincidunt, commodo dolor vel, tincidunt nisl.
|
|
26
|
+
</DxcParagraph>
|
|
27
|
+
</ExampleContainer>
|
|
28
|
+
<BackgroundColorProvider color="#333333">
|
|
29
|
+
<DarkContainer>
|
|
30
|
+
<Title title="Default Paragraph" theme="dark" level={4} />
|
|
31
|
+
<DxcParagraph>
|
|
32
|
+
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla id tortor sit amet velit auctor cursus id eget
|
|
33
|
+
nisl. Vivamus luctus egestas eros, at mattis libero eleifend ac. Integer vel urna rutrum, pretium arcu
|
|
34
|
+
dignissim, fringilla turpis. Nullam luctus odio quis magna finibus, a pharetra magna euismod. Nullam efficitur
|
|
35
|
+
semper pellentesque. Nulla eget arcu ac diam fringilla vehicula. In imperdiet nisl hendrerit, elementum metus
|
|
36
|
+
eu, ornare risus. Aenean neque nibh, vestibulum vitae elit vel, imperdiet suscipit leo. Curabitur blandit
|
|
37
|
+
iaculis pretium. Fusce id imperdiet dui, ut laoreet justo. Sed maximus sollicitudin ipsum, et varius massa
|
|
38
|
+
condimentum eget. Vivamus id mauris et nisl mattis consequat et id lectus. Quisque mollis lacinia nisl.
|
|
39
|
+
Suspendisse sed quam tincidunt, commodo dolor vel, tincidunt nisl.
|
|
40
|
+
</DxcParagraph>
|
|
41
|
+
</DarkContainer>
|
|
42
|
+
</BackgroundColorProvider>
|
|
43
|
+
</>
|
|
44
|
+
);
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports["default"] = void 0;
|
|
9
|
+
|
|
10
|
+
var _react = _interopRequireDefault(require("react"));
|
|
11
|
+
|
|
12
|
+
var icons = {
|
|
13
|
+
showPassword: /*#__PURE__*/_react["default"].createElement("svg", {
|
|
14
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
15
|
+
height: "24px",
|
|
16
|
+
viewBox: "0 0 24 24",
|
|
17
|
+
width: "24px",
|
|
18
|
+
fill: "currentColor"
|
|
19
|
+
}, /*#__PURE__*/_react["default"].createElement("path", {
|
|
20
|
+
d: "M0 0h24v24H0V0z",
|
|
21
|
+
fill: "none"
|
|
22
|
+
}), /*#__PURE__*/_react["default"].createElement("path", {
|
|
23
|
+
d: "M12 6c3.79 0 7.17 2.13 8.82 5.5C19.17 14.87 15.79 17 12 17s-7.17-2.13-8.82-5.5C4.83 8.13 8.21 6 12 6m0-2C7 4 2.73 7.11 1 11.5 2.73 15.89 7 19 12 19s9.27-3.11 11-7.5C21.27 7.11 17 4 12 4zm0 5c1.38 0 2.5 1.12 2.5 2.5S13.38 14 12 14s-2.5-1.12-2.5-2.5S10.62 9 12 9m0-2c-2.48 0-4.5 2.02-4.5 4.5S9.52 16 12 16s4.5-2.02 4.5-4.5S14.48 7 12 7z"
|
|
24
|
+
})),
|
|
25
|
+
hidePassword: /*#__PURE__*/_react["default"].createElement("svg", {
|
|
26
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
27
|
+
height: "24px",
|
|
28
|
+
viewBox: "0 0 24 24",
|
|
29
|
+
width: "24px",
|
|
30
|
+
fill: "currentColor"
|
|
31
|
+
}, /*#__PURE__*/_react["default"].createElement("path", {
|
|
32
|
+
d: "M0 0h24v24H0V0zm0 0h24v24H0V0zm0 0h24v24H0V0zm0 0h24v24H0V0z",
|
|
33
|
+
fill: "none"
|
|
34
|
+
}), /*#__PURE__*/_react["default"].createElement("path", {
|
|
35
|
+
d: "M12 6c3.79 0 7.17 2.13 8.82 5.5-.59 1.22-1.42 2.27-2.41 3.12l1.41 1.41c1.39-1.23 2.49-2.77 3.18-4.53C21.27 7.11 17 4 12 4c-1.27 0-2.49.2-3.64.57l1.65 1.65C10.66 6.09 11.32 6 12 6zm-1.07 1.14L13 9.21c.57.25 1.03.71 1.28 1.28l2.07 2.07c.08-.34.14-.7.14-1.07C16.5 9.01 14.48 7 12 7c-.37 0-.72.05-1.07.14zM2.01 3.87l2.68 2.68C3.06 7.83 1.77 9.53 1 11.5 2.73 15.89 7 19 12 19c1.52 0 2.98-.29 4.32-.82l3.42 3.42 1.41-1.41L3.42 2.45 2.01 3.87zm7.5 7.5l2.61 2.61c-.04.01-.08.02-.12.02-1.38 0-2.5-1.12-2.5-2.5 0-.05.01-.08.01-.13zm-3.4-3.4l1.75 1.75c-.23.55-.36 1.15-.36 1.78 0 2.48 2.02 4.5 4.5 4.5.63 0 1.23-.13 1.77-.36l.98.98c-.88.24-1.8.38-2.75.38-3.79 0-7.17-2.13-8.82-5.5.7-1.43 1.72-2.61 2.93-3.53z"
|
|
36
|
+
}))
|
|
37
|
+
};
|
|
38
|
+
var _default = icons;
|
|
39
|
+
exports["default"] = _default;
|
|
@@ -19,7 +19,9 @@ var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
|
19
19
|
|
|
20
20
|
var _TextInput = _interopRequireDefault(require("../text-input/TextInput"));
|
|
21
21
|
|
|
22
|
-
var
|
|
22
|
+
var _useTranslatedLabels2 = _interopRequireDefault(require("../useTranslatedLabels"));
|
|
23
|
+
|
|
24
|
+
var _Icons = _interopRequireDefault(require("./Icons"));
|
|
23
25
|
|
|
24
26
|
var _templateObject;
|
|
25
27
|
|
|
@@ -27,6 +29,16 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
|
|
|
27
29
|
|
|
28
30
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
29
31
|
|
|
32
|
+
var setInputType = function setInputType(type, element) {
|
|
33
|
+
element === null || element === void 0 ? void 0 : element.getElementsByTagName("input")[0].setAttribute("type", type);
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
var setAriaAttributes = function setAriaAttributes(ariaExpanded, ariaLabel, element) {
|
|
37
|
+
var inputElement = element === null || element === void 0 ? void 0 : element.getElementsByTagName("input")[0];
|
|
38
|
+
inputElement === null || inputElement === void 0 ? void 0 : inputElement.setAttribute("aria-expanded", ariaExpanded);
|
|
39
|
+
inputElement === null || inputElement === void 0 ? void 0 : inputElement.setAttribute("aria-label", ariaLabel);
|
|
40
|
+
};
|
|
41
|
+
|
|
30
42
|
var DxcPasswordInput = /*#__PURE__*/_react["default"].forwardRef(function (_ref, ref) {
|
|
31
43
|
var label = _ref.label,
|
|
32
44
|
_ref$name = _ref.name,
|
|
@@ -55,97 +67,37 @@ var DxcPasswordInput = /*#__PURE__*/_react["default"].forwardRef(function (_ref,
|
|
|
55
67
|
setIsPasswordVisible = _useState2[1];
|
|
56
68
|
|
|
57
69
|
var inputRef = (0, _react.useRef)(null);
|
|
58
|
-
var translatedLabels = (0, _useTranslatedLabels["default"])();
|
|
59
|
-
|
|
60
|
-
var setInputType = function setInputType(type) {
|
|
61
|
-
var _inputRef$current, _inputRef$current$chi;
|
|
62
|
-
|
|
63
|
-
inputRef === null || inputRef === void 0 ? void 0 : (_inputRef$current = inputRef.current) === null || _inputRef$current === void 0 ? void 0 : (_inputRef$current$chi = _inputRef$current.children[label && helperText ? 2 : label || helperText ? 1 : 0]) === null || _inputRef$current$chi === void 0 ? void 0 : _inputRef$current$chi.children[0].setAttribute("type", type);
|
|
64
|
-
};
|
|
65
|
-
|
|
66
|
-
var setAriaAttributes = function setAriaAttributes(ariaExpanded, ariaLabel) {
|
|
67
|
-
var inputIndex = label && helperText ? 2 : label || helperText ? 1 : 0;
|
|
68
70
|
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
inputRef === null || inputRef === void 0 ? void 0 : (_inputRef$current2 = inputRef.current) === null || _inputRef$current2 === void 0 ? void 0 : (_inputRef$current2$ch = _inputRef$current2.children[inputIndex]) === null || _inputRef$current2$ch === void 0 ? void 0 : (_inputRef$current2$ch2 = _inputRef$current2$ch.children[3]) === null || _inputRef$current2$ch2 === void 0 ? void 0 : _inputRef$current2$ch2.setAttribute("aria-expanded", ariaExpanded);
|
|
73
|
-
inputRef === null || inputRef === void 0 ? void 0 : (_inputRef$current3 = inputRef.current) === null || _inputRef$current3 === void 0 ? void 0 : (_inputRef$current3$ch = _inputRef$current3.children[inputIndex]) === null || _inputRef$current3$ch === void 0 ? void 0 : (_inputRef$current3$ch2 = _inputRef$current3$ch.children[3]) === null || _inputRef$current3$ch2 === void 0 ? void 0 : _inputRef$current3$ch2.setAttribute("aria-label", ariaLabel);
|
|
74
|
-
} else if (error || clearable && !value) {
|
|
75
|
-
var _inputRef$current4, _inputRef$current4$ch, _inputRef$current4$ch2, _inputRef$current5, _inputRef$current5$ch, _inputRef$current5$ch2;
|
|
76
|
-
|
|
77
|
-
inputRef === null || inputRef === void 0 ? void 0 : (_inputRef$current4 = inputRef.current) === null || _inputRef$current4 === void 0 ? void 0 : (_inputRef$current4$ch = _inputRef$current4.children[inputIndex]) === null || _inputRef$current4$ch === void 0 ? void 0 : (_inputRef$current4$ch2 = _inputRef$current4$ch.children[2]) === null || _inputRef$current4$ch2 === void 0 ? void 0 : _inputRef$current4$ch2.setAttribute("aria-expanded", ariaExpanded);
|
|
78
|
-
inputRef === null || inputRef === void 0 ? void 0 : (_inputRef$current5 = inputRef.current) === null || _inputRef$current5 === void 0 ? void 0 : (_inputRef$current5$ch = _inputRef$current5.children[inputIndex]) === null || _inputRef$current5$ch === void 0 ? void 0 : (_inputRef$current5$ch2 = _inputRef$current5$ch.children[2]) === null || _inputRef$current5$ch2 === void 0 ? void 0 : _inputRef$current5$ch2.setAttribute("aria-label", ariaLabel);
|
|
79
|
-
} else {
|
|
80
|
-
var _inputRef$current6, _inputRef$current6$ch, _inputRef$current6$ch2, _inputRef$current7, _inputRef$current7$ch, _inputRef$current7$ch2;
|
|
81
|
-
|
|
82
|
-
inputRef === null || inputRef === void 0 ? void 0 : (_inputRef$current6 = inputRef.current) === null || _inputRef$current6 === void 0 ? void 0 : (_inputRef$current6$ch = _inputRef$current6.children[inputIndex]) === null || _inputRef$current6$ch === void 0 ? void 0 : (_inputRef$current6$ch2 = _inputRef$current6$ch.children[1]) === null || _inputRef$current6$ch2 === void 0 ? void 0 : _inputRef$current6$ch2.setAttribute("aria-expanded", ariaExpanded);
|
|
83
|
-
inputRef === null || inputRef === void 0 ? void 0 : (_inputRef$current7 = inputRef.current) === null || _inputRef$current7 === void 0 ? void 0 : (_inputRef$current7$ch = _inputRef$current7.children[inputIndex]) === null || _inputRef$current7$ch === void 0 ? void 0 : (_inputRef$current7$ch2 = _inputRef$current7$ch.children[1]) === null || _inputRef$current7$ch2 === void 0 ? void 0 : _inputRef$current7$ch2.setAttribute("aria-label", ariaLabel);
|
|
84
|
-
}
|
|
85
|
-
};
|
|
86
|
-
|
|
87
|
-
var getIconTitle = function getIconTitle() {
|
|
88
|
-
return isPasswordVisible ? translatedLabels.passwordInput.inputHidePasswordTitle : translatedLabels.passwordInput.inputShowPasswordTitle;
|
|
89
|
-
};
|
|
71
|
+
var _useTranslatedLabels = (0, _useTranslatedLabels2["default"])(),
|
|
72
|
+
passwordInput = _useTranslatedLabels.passwordInput;
|
|
90
73
|
|
|
91
74
|
(0, _react.useEffect)(function () {
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
}
|
|
101
|
-
}, [isPasswordVisible]);
|
|
102
|
-
|
|
103
|
-
var viewPassword = function viewPassword() {
|
|
104
|
-
setInputType("text");
|
|
105
|
-
setIsPasswordVisible(true);
|
|
106
|
-
};
|
|
107
|
-
|
|
108
|
-
var hidePassword = function hidePassword() {
|
|
109
|
-
setInputType("password");
|
|
110
|
-
setIsPasswordVisible(false);
|
|
111
|
-
};
|
|
112
|
-
|
|
113
|
-
var action = {
|
|
114
|
-
onClick: isPasswordVisible ? hidePassword : viewPassword,
|
|
115
|
-
icon: isPasswordVisible ? /*#__PURE__*/_react["default"].createElement("svg", {
|
|
116
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
117
|
-
height: "24px",
|
|
118
|
-
viewBox: "0 0 24 24",
|
|
119
|
-
width: "24px",
|
|
120
|
-
fill: "currentColor"
|
|
121
|
-
}, /*#__PURE__*/_react["default"].createElement("path", {
|
|
122
|
-
d: "M0 0h24v24H0V0zm0 0h24v24H0V0zm0 0h24v24H0V0zm0 0h24v24H0V0z",
|
|
123
|
-
fill: "none"
|
|
124
|
-
}), /*#__PURE__*/_react["default"].createElement("path", {
|
|
125
|
-
d: "M12 6c3.79 0 7.17 2.13 8.82 5.5-.59 1.22-1.42 2.27-2.41 3.12l1.41 1.41c1.39-1.23 2.49-2.77 3.18-4.53C21.27 7.11 17 4 12 4c-1.27 0-2.49.2-3.64.57l1.65 1.65C10.66 6.09 11.32 6 12 6zm-1.07 1.14L13 9.21c.57.25 1.03.71 1.28 1.28l2.07 2.07c.08-.34.14-.7.14-1.07C16.5 9.01 14.48 7 12 7c-.37 0-.72.05-1.07.14zM2.01 3.87l2.68 2.68C3.06 7.83 1.77 9.53 1 11.5 2.73 15.89 7 19 12 19c1.52 0 2.98-.29 4.32-.82l3.42 3.42 1.41-1.41L3.42 2.45 2.01 3.87zm7.5 7.5l2.61 2.61c-.04.01-.08.02-.12.02-1.38 0-2.5-1.12-2.5-2.5 0-.05.01-.08.01-.13zm-3.4-3.4l1.75 1.75c-.23.55-.36 1.15-.36 1.78 0 2.48 2.02 4.5 4.5 4.5.63 0 1.23-.13 1.77-.36l.98.98c-.88.24-1.8.38-2.75.38-3.79 0-7.17-2.13-8.82-5.5.7-1.43 1.72-2.61 2.93-3.53z"
|
|
126
|
-
})) : /*#__PURE__*/_react["default"].createElement("svg", {
|
|
127
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
128
|
-
height: "24px",
|
|
129
|
-
viewBox: "0 0 24 24",
|
|
130
|
-
width: "24px",
|
|
131
|
-
fill: "currentColor"
|
|
132
|
-
}, /*#__PURE__*/_react["default"].createElement("path", {
|
|
133
|
-
d: "M0 0h24v24H0V0z",
|
|
134
|
-
fill: "none"
|
|
135
|
-
}), /*#__PURE__*/_react["default"].createElement("path", {
|
|
136
|
-
d: "M12 6c3.79 0 7.17 2.13 8.82 5.5C19.17 14.87 15.79 17 12 17s-7.17-2.13-8.82-5.5C4.83 8.13 8.21 6 12 6m0-2C7 4 2.73 7.11 1 11.5 2.73 15.89 7 19 12 19s9.27-3.11 11-7.5C21.27 7.11 17 4 12 4zm0 5c1.38 0 2.5 1.12 2.5 2.5S13.38 14 12 14s-2.5-1.12-2.5-2.5S10.62 9 12 9m0-2c-2.48 0-4.5 2.02-4.5 4.5S9.52 16 12 16s4.5-2.02 4.5-4.5S14.48 7 12 7z"
|
|
137
|
-
})),
|
|
138
|
-
title: getIconTitle()
|
|
139
|
-
};
|
|
75
|
+
(function () {
|
|
76
|
+
if (isPasswordVisible) {
|
|
77
|
+
setInputType("text", inputRef.current);
|
|
78
|
+
setAriaAttributes("true", passwordInput.inputHidePasswordTitle, inputRef.current);
|
|
79
|
+
} else {
|
|
80
|
+
setInputType("password", inputRef.current);
|
|
81
|
+
setAriaAttributes("false", passwordInput.inputShowPasswordTitle, inputRef.current);
|
|
82
|
+
}
|
|
83
|
+
})();
|
|
84
|
+
}, [isPasswordVisible, passwordInput]);
|
|
140
85
|
return /*#__PURE__*/_react["default"].createElement(PasswordInput, {
|
|
141
86
|
ref: ref
|
|
142
87
|
}, /*#__PURE__*/_react["default"].createElement(_TextInput["default"], {
|
|
143
|
-
ref: inputRef,
|
|
144
88
|
label: label,
|
|
145
89
|
name: name,
|
|
146
90
|
value: value,
|
|
147
91
|
helperText: helperText,
|
|
148
|
-
action:
|
|
92
|
+
action: {
|
|
93
|
+
onClick: function onClick() {
|
|
94
|
+
setIsPasswordVisible(function (isPasswordVisible) {
|
|
95
|
+
return !isPasswordVisible;
|
|
96
|
+
});
|
|
97
|
+
},
|
|
98
|
+
icon: isPasswordVisible ? _Icons["default"].hidePassword : _Icons["default"].showPassword,
|
|
99
|
+
title: isPasswordVisible ? passwordInput.inputHidePasswordTitle : passwordInput.inputShowPasswordTitle
|
|
100
|
+
},
|
|
149
101
|
error: error,
|
|
150
102
|
clearable: clearable,
|
|
151
103
|
onChange: onChange,
|
|
@@ -156,6 +108,7 @@ var DxcPasswordInput = /*#__PURE__*/_react["default"].forwardRef(function (_ref,
|
|
|
156
108
|
minLength: minLength,
|
|
157
109
|
maxLength: maxLength,
|
|
158
110
|
autocomplete: autocomplete,
|
|
111
|
+
ref: inputRef,
|
|
159
112
|
tabIndex: tabIndex
|
|
160
113
|
}));
|
|
161
114
|
});
|
|
@@ -12,43 +12,37 @@ var _react2 = require("@testing-library/react");
|
|
|
12
12
|
|
|
13
13
|
var _userEvent = _interopRequireDefault(require("@testing-library/user-event"));
|
|
14
14
|
|
|
15
|
-
var _PasswordInput = _interopRequireDefault(require("./PasswordInput"));
|
|
15
|
+
var _PasswordInput = _interopRequireDefault(require("./PasswordInput.tsx"));
|
|
16
16
|
|
|
17
17
|
describe("Password input component tests", function () {
|
|
18
|
-
test("Password input renders with label", function () {
|
|
18
|
+
test("Password input renders with label and helper text", function () {
|
|
19
19
|
var _render = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_PasswordInput["default"], {
|
|
20
|
-
label: "Password input label"
|
|
20
|
+
label: "Password input label",
|
|
21
|
+
helperText: "Helper text"
|
|
21
22
|
})),
|
|
22
23
|
getByText = _render.getByText;
|
|
23
24
|
|
|
24
25
|
expect(getByText("Password input label")).toBeTruthy();
|
|
25
|
-
});
|
|
26
|
-
test("Password input renders with helper text", function () {
|
|
27
|
-
var _render2 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_PasswordInput["default"], {
|
|
28
|
-
helperText: "Helper text"
|
|
29
|
-
})),
|
|
30
|
-
getByText = _render2.getByText;
|
|
31
|
-
|
|
32
26
|
expect(getByText("Helper text")).toBeTruthy();
|
|
33
27
|
});
|
|
34
28
|
test("Password input renders error", function () {
|
|
35
|
-
var
|
|
29
|
+
var _render2 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_PasswordInput["default"], {
|
|
36
30
|
error: "Error message."
|
|
37
31
|
})),
|
|
38
|
-
getByText =
|
|
32
|
+
getByText = _render2.getByText;
|
|
39
33
|
|
|
40
34
|
expect(getByText("Error message.")).toBeTruthy();
|
|
41
35
|
});
|
|
42
36
|
test("onChange function is called correctly", function () {
|
|
43
37
|
var onChange = jest.fn();
|
|
44
38
|
|
|
45
|
-
var
|
|
39
|
+
var _render3 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_PasswordInput["default"], {
|
|
46
40
|
label: "Password input",
|
|
47
41
|
onChange: onChange
|
|
48
42
|
})),
|
|
49
|
-
|
|
43
|
+
getByLabelText = _render3.getByLabelText;
|
|
50
44
|
|
|
51
|
-
var passwordInput =
|
|
45
|
+
var passwordInput = getByLabelText("Password input");
|
|
52
46
|
|
|
53
47
|
_userEvent["default"].type(passwordInput, "Pa$$w0rd");
|
|
54
48
|
|
|
@@ -60,13 +54,13 @@ describe("Password input component tests", function () {
|
|
|
60
54
|
test("onBlur function is called correctly", function () {
|
|
61
55
|
var onBlur = jest.fn();
|
|
62
56
|
|
|
63
|
-
var
|
|
57
|
+
var _render4 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_PasswordInput["default"], {
|
|
64
58
|
label: "Password input",
|
|
65
59
|
onBlur: onBlur
|
|
66
60
|
})),
|
|
67
|
-
|
|
61
|
+
getByLabelText = _render4.getByLabelText;
|
|
68
62
|
|
|
69
|
-
var passwordInput =
|
|
63
|
+
var passwordInput = getByLabelText("Password input");
|
|
70
64
|
|
|
71
65
|
_userEvent["default"].type(passwordInput, "Pa$$w0rd");
|
|
72
66
|
|
|
@@ -78,14 +72,14 @@ describe("Password input component tests", function () {
|
|
|
78
72
|
expect(passwordInput.value).toBe("Pa$$w0rd");
|
|
79
73
|
});
|
|
80
74
|
test("Clear password input value", function () {
|
|
81
|
-
var
|
|
75
|
+
var _render5 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_PasswordInput["default"], {
|
|
82
76
|
label: "Password input",
|
|
83
77
|
clearable: true
|
|
84
78
|
})),
|
|
85
|
-
getAllByRole =
|
|
86
|
-
|
|
79
|
+
getAllByRole = _render5.getAllByRole,
|
|
80
|
+
getByLabelText = _render5.getByLabelText;
|
|
87
81
|
|
|
88
|
-
var passwordInput =
|
|
82
|
+
var passwordInput = getByLabelText("Password input");
|
|
89
83
|
|
|
90
84
|
_userEvent["default"].type(passwordInput, "Pa$$w0rd");
|
|
91
85
|
|
|
@@ -97,13 +91,13 @@ describe("Password input component tests", function () {
|
|
|
97
91
|
expect(passwordInput.value).toBe("");
|
|
98
92
|
});
|
|
99
93
|
test("Non clearable password input has no clear icon", function () {
|
|
100
|
-
var
|
|
94
|
+
var _render6 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_PasswordInput["default"], {
|
|
101
95
|
label: "Password input"
|
|
102
96
|
})),
|
|
103
|
-
getAllByRole =
|
|
104
|
-
|
|
97
|
+
getAllByRole = _render6.getAllByRole,
|
|
98
|
+
getByLabelText = _render6.getByLabelText;
|
|
105
99
|
|
|
106
|
-
var passwordInput =
|
|
100
|
+
var passwordInput = getByLabelText("Password input");
|
|
107
101
|
|
|
108
102
|
_userEvent["default"].type(passwordInput, "Pa$$w0rd");
|
|
109
103
|
|
|
@@ -112,14 +106,14 @@ describe("Password input component tests", function () {
|
|
|
112
106
|
expect(buttons.length).toBe(1);
|
|
113
107
|
});
|
|
114
108
|
test("Show/hide password input button works correctly", function () {
|
|
115
|
-
var
|
|
109
|
+
var _render7 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_PasswordInput["default"], {
|
|
116
110
|
label: "Password input",
|
|
117
111
|
clearable: true
|
|
118
112
|
})),
|
|
119
|
-
getAllByRole =
|
|
120
|
-
|
|
113
|
+
getAllByRole = _render7.getAllByRole,
|
|
114
|
+
getByLabelText = _render7.getByLabelText;
|
|
121
115
|
|
|
122
|
-
var passwordInput =
|
|
116
|
+
var passwordInput = getByLabelText("Password input");
|
|
123
117
|
|
|
124
118
|
_userEvent["default"].type(passwordInput, "Pa$$w0rd");
|
|
125
119
|
|
|
@@ -132,17 +126,17 @@ describe("Password input component tests", function () {
|
|
|
132
126
|
expect(passwordInput.type).toBe("text");
|
|
133
127
|
});
|
|
134
128
|
test("Password tooltip is correct", /*#__PURE__*/(0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee() {
|
|
135
|
-
var
|
|
129
|
+
var _render8, getAllByRole, getByTitle, queryByTitle, showButton;
|
|
136
130
|
|
|
137
131
|
return _regenerator["default"].wrap(function _callee$(_context) {
|
|
138
132
|
while (1) {
|
|
139
133
|
switch (_context.prev = _context.next) {
|
|
140
134
|
case 0:
|
|
141
|
-
|
|
135
|
+
_render8 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_PasswordInput["default"], {
|
|
142
136
|
label: "Password input",
|
|
143
137
|
clearable: true,
|
|
144
138
|
value: "Password"
|
|
145
|
-
})), getAllByRole =
|
|
139
|
+
})), getAllByRole = _render8.getAllByRole, getByTitle = _render8.getByTitle, queryByTitle = _render8.queryByTitle;
|
|
146
140
|
showButton = getAllByRole("button")[1];
|
|
147
141
|
|
|
148
142
|
_userEvent["default"].hover(showButton);
|
|
@@ -160,21 +154,21 @@ describe("Password input component tests", function () {
|
|
|
160
154
|
}
|
|
161
155
|
}, _callee);
|
|
162
156
|
})));
|
|
163
|
-
test("Password input has correct
|
|
164
|
-
var
|
|
157
|
+
test("Password input has correct accessibility attributes", function () {
|
|
158
|
+
var _render9 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_PasswordInput["default"], {
|
|
165
159
|
label: "Password input"
|
|
166
160
|
})),
|
|
167
|
-
getByRole =
|
|
161
|
+
getByRole = _render9.getByRole,
|
|
162
|
+
getByLabelText = _render9.getByLabelText;
|
|
168
163
|
|
|
169
|
-
var passwordInput =
|
|
170
|
-
expect(passwordInput.getAttribute("aria-autocomplete")).toBeNull();
|
|
171
|
-
expect(passwordInput.getAttribute("aria-controls")).toBeNull();
|
|
172
|
-
expect(passwordInput.getAttribute("aria-expanded")).toBeNull();
|
|
164
|
+
var passwordInput = getByLabelText("Password input");
|
|
173
165
|
var showButton = getByRole("button");
|
|
166
|
+
expect(passwordInput.getAttribute("aria-expanded")).toBe("false");
|
|
174
167
|
expect(showButton.getAttribute("aria-label")).toBe("Show password");
|
|
175
168
|
|
|
176
169
|
_userEvent["default"].click(showButton);
|
|
177
170
|
|
|
171
|
+
expect(passwordInput.getAttribute("aria-expanded")).toBe("true");
|
|
178
172
|
expect(showButton.getAttribute("aria-label")).toBe("Hide password");
|
|
179
173
|
});
|
|
180
174
|
});
|
|
@@ -13,19 +13,19 @@ var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
|
|
|
13
13
|
|
|
14
14
|
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
|
|
15
15
|
|
|
16
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
17
|
+
|
|
16
18
|
var _react = _interopRequireWildcard(require("react"));
|
|
17
19
|
|
|
18
20
|
var _styledComponents = _interopRequireWildcard(require("styled-components"));
|
|
19
21
|
|
|
20
|
-
var
|
|
21
|
-
|
|
22
|
-
var _variables = require("../common/variables.js");
|
|
22
|
+
var _variables = require("../common/variables");
|
|
23
23
|
|
|
24
24
|
var _useTheme = _interopRequireDefault(require("../useTheme"));
|
|
25
25
|
|
|
26
26
|
var _BackgroundColorContext = _interopRequireDefault(require("../BackgroundColorContext"));
|
|
27
27
|
|
|
28
|
-
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6;
|
|
28
|
+
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8;
|
|
29
29
|
|
|
30
30
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
31
31
|
|
|
@@ -44,72 +44,56 @@ var DxcProgressBar = function DxcProgressBar(_ref) {
|
|
|
44
44
|
margin = _ref.margin;
|
|
45
45
|
var colorsTheme = (0, _useTheme["default"])();
|
|
46
46
|
var backgroundType = (0, _react.useContext)(_BackgroundColorContext["default"]);
|
|
47
|
+
|
|
48
|
+
var _useState = (0, _react.useState)(0),
|
|
49
|
+
_useState2 = (0, _slicedToArray2["default"])(_useState, 2),
|
|
50
|
+
valueProgressBar = _useState2[0],
|
|
51
|
+
setValueProgressBar = _useState2[1];
|
|
52
|
+
|
|
53
|
+
(0, _react.useEffect)(function () {
|
|
54
|
+
setValueProgressBar(value === null || value === undefined || value < 0 ? 0 : value >= 0 && value <= 100 ? value : 100);
|
|
55
|
+
}, [value]);
|
|
47
56
|
return /*#__PURE__*/_react["default"].createElement(_styledComponents.ThemeProvider, {
|
|
48
57
|
theme: colorsTheme.progressBar
|
|
49
58
|
}, /*#__PURE__*/_react["default"].createElement(BackgroundProgressBar, {
|
|
50
59
|
overlay: overlay
|
|
51
|
-
}, /*#__PURE__*/_react["default"].createElement(
|
|
60
|
+
}, /*#__PURE__*/_react["default"].createElement(ProgressBarContainer, {
|
|
52
61
|
overlay: overlay,
|
|
53
|
-
margin: margin
|
|
54
|
-
backgroundType: backgroundType
|
|
62
|
+
margin: margin
|
|
55
63
|
}, /*#__PURE__*/_react["default"].createElement(InfoProgressBar, null, /*#__PURE__*/_react["default"].createElement(ProgressBarLabel, {
|
|
56
64
|
overlay: overlay,
|
|
57
|
-
backgroundType: backgroundType
|
|
65
|
+
backgroundType: backgroundType,
|
|
66
|
+
"aria-label": label || undefined
|
|
58
67
|
}, label), /*#__PURE__*/_react["default"].createElement(ProgressBarProgress, {
|
|
59
68
|
overlay: overlay,
|
|
60
69
|
showValue: showValue,
|
|
61
|
-
backgroundType: backgroundType
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
70
|
+
backgroundType: backgroundType,
|
|
71
|
+
value: valueProgressBar
|
|
72
|
+
}, valueProgressBar, " %")), /*#__PURE__*/_react["default"].createElement(LinearProgress, {
|
|
73
|
+
role: "progressbar",
|
|
74
|
+
helperText: helperText,
|
|
75
|
+
"aria-valuenow": showValue ? valueProgressBar : undefined
|
|
76
|
+
}, /*#__PURE__*/_react["default"].createElement(LinearProgressBar, {
|
|
77
|
+
backgroundType: backgroundType,
|
|
78
|
+
variant: value === null || value === undefined ? "indeterminate" : "determinate",
|
|
79
|
+
container: "first",
|
|
80
|
+
value: valueProgressBar
|
|
81
|
+
})), helperText && /*#__PURE__*/_react["default"].createElement(HelperText, {
|
|
66
82
|
overlay: overlay,
|
|
67
83
|
backgroundType: backgroundType
|
|
68
84
|
}, helperText))));
|
|
69
85
|
};
|
|
70
86
|
|
|
71
|
-
var BackgroundProgressBar = _styledComponents["default"].div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["\n
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
return
|
|
75
|
-
}, function (props) {
|
|
76
|
-
return props.overlay === true ? "100%" : "";
|
|
77
|
-
}, function (props) {
|
|
78
|
-
return props.overlay === true ? "center" : "";
|
|
79
|
-
}, function (props) {
|
|
80
|
-
return props.overlay === true ? "100vh" : "";
|
|
81
|
-
}, function (props) {
|
|
82
|
-
return props.overlay === true ? "center" : "";
|
|
83
|
-
}, function (props) {
|
|
84
|
-
return props.overlay === true ? "100%" : "";
|
|
85
|
-
}, function (props) {
|
|
86
|
-
return props.overlay === true ? "fixed" : "";
|
|
87
|
-
}, function (props) {
|
|
88
|
-
return props.overlay === true ? "0" : "";
|
|
89
|
-
}, function (props) {
|
|
90
|
-
return props.overlay === true ? "0" : "";
|
|
91
|
-
}, function (props) {
|
|
92
|
-
return props.overlay === true ? "0" : "";
|
|
93
|
-
}, function (props) {
|
|
94
|
-
return props.overlay === true ? "0" : "";
|
|
95
|
-
}, function (props) {
|
|
96
|
-
return props.overlay ? 1300 : "";
|
|
87
|
+
var BackgroundProgressBar = _styledComponents["default"].div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["\n ", "\n display: flex;\n flex-wrap: wrap;\n min-width: 100px;\n width: 100%;\n"])), function (_ref2) {
|
|
88
|
+
var overlay = _ref2.overlay,
|
|
89
|
+
theme = _ref2.theme;
|
|
90
|
+
return overlay ? "background-color: ".concat(theme.overlayColor, ";\n width: 100%;\n justify-content: center;\n height: 100vh;\n align-items: center;\n max-width: 100%;\n position: fixed;\n top: 0;\n bottom: 0;\n left: 0;\n right: 0;\n z-index: 1300;") : "background-color: \"transparent\";";
|
|
97
91
|
});
|
|
98
92
|
|
|
99
|
-
var
|
|
93
|
+
var ProgressBarContainer = _styledComponents["default"].div(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2["default"])(["\n z-index: ", ";\n width: ", ";\n margin: ", ";\n margin-top: ", ";\n margin-right: ", ";\n margin-bottom: ", ";\n margin-left: ", ";\n"])), function (props) {
|
|
100
94
|
return props.overlay === true && "100" || "0";
|
|
101
95
|
}, function (props) {
|
|
102
96
|
return props.overlay === true ? "80%" : "100%";
|
|
103
|
-
}, function (props) {
|
|
104
|
-
return props.theme.thickness;
|
|
105
|
-
}, function (props) {
|
|
106
|
-
return props.theme.totalLineColor;
|
|
107
|
-
}, function (props) {
|
|
108
|
-
return props.theme.borderRadius;
|
|
109
|
-
}, function (props) {
|
|
110
|
-
return props.helperText !== "" && "8px";
|
|
111
|
-
}, function (props) {
|
|
112
|
-
return props.backgroundType === "dark" ? props.theme.trackLineColorOnDark : props.theme.trackLineColor;
|
|
113
97
|
}, function (props) {
|
|
114
98
|
return props.margin && (0, _typeof2["default"])(props.margin) !== "object" ? _variables.spaces[props.margin] : "0px";
|
|
115
99
|
}, function (props) {
|
|
@@ -135,7 +119,7 @@ var ProgressBarLabel = _styledComponents["default"].div(_templateObject4 || (_te
|
|
|
135
119
|
}, function (props) {
|
|
136
120
|
return props.theme.labelFontTextTransform;
|
|
137
121
|
}, function (props) {
|
|
138
|
-
return props.backgroundType === "dark" ? props.theme.labelFontColorOnDark : props.overlay === true ?
|
|
122
|
+
return props.backgroundType === "dark" ? props.theme.labelFontColorOnDark : props.overlay === true ? props.theme.overlayFontColor : props.theme.labelFontColor;
|
|
139
123
|
});
|
|
140
124
|
|
|
141
125
|
var ProgressBarProgress = _styledComponents["default"].div(_templateObject5 || (_templateObject5 = (0, _taggedTemplateLiteral2["default"])(["\n font-family: ", ";\n font-style: ", ";\n font-size: ", ";\n font-weight: ", ";\n text-transform: ", ";\n color: ", ";\n display: ", ";\n flex-shrink: 0;\n"])), function (props) {
|
|
@@ -149,13 +133,13 @@ var ProgressBarProgress = _styledComponents["default"].div(_templateObject5 || (
|
|
|
149
133
|
}, function (props) {
|
|
150
134
|
return props.theme.valueFontTextTransform;
|
|
151
135
|
}, function (props) {
|
|
152
|
-
return props.backgroundType === "dark" ? props.theme.valueFontColorOnDark : props.overlay === true ?
|
|
136
|
+
return props.backgroundType === "dark" ? props.theme.valueFontColorOnDark : props.overlay === true ? props.theme.overlayFontColor : props.theme.valueFontColor;
|
|
153
137
|
}, function (props) {
|
|
154
|
-
return props.value !==
|
|
138
|
+
return props.value !== undefined && props.value !== null && props.showValue === true && "block" || "none";
|
|
155
139
|
});
|
|
156
140
|
|
|
157
141
|
var HelperText = _styledComponents["default"].span(_templateObject6 || (_templateObject6 = (0, _taggedTemplateLiteral2["default"])(["\n color: ", ";\n font-family: ", ";\n font-size: ", ";\n font-style: ", ";\n font-weight: ", ";\n line-height: 1.5em;\n"])), function (props) {
|
|
158
|
-
return props.backgroundType === "dark" ? props.theme.helperTextFontColorOnDark : props.overlay === true ?
|
|
142
|
+
return props.backgroundType === "dark" ? props.theme.helperTextFontColorOnDark : props.overlay === true ? props.theme.overlayFontColor : props.theme.helperTextFontColor;
|
|
159
143
|
}, function (props) {
|
|
160
144
|
return props.theme.helperTextFontFamily;
|
|
161
145
|
}, function (props) {
|
|
@@ -166,5 +150,27 @@ var HelperText = _styledComponents["default"].span(_templateObject6 || (_templat
|
|
|
166
150
|
return props.theme.helperTextFontWeight;
|
|
167
151
|
});
|
|
168
152
|
|
|
153
|
+
var LinearProgress = _styledComponents["default"].div(_templateObject7 || (_templateObject7 = (0, _taggedTemplateLiteral2["default"])(["\n height: ", ";\n background-color: ", ";\n border-radius: ", ";\n margin-bottom: ", ";\n overflow: hidden;\n position: relative;\n"])), function (props) {
|
|
154
|
+
return props.theme.thickness;
|
|
155
|
+
}, function (props) {
|
|
156
|
+
return props.theme.totalLineColor;
|
|
157
|
+
}, function (props) {
|
|
158
|
+
return props.theme.borderRadius;
|
|
159
|
+
}, function (props) {
|
|
160
|
+
return props.helperText !== "" && "8px";
|
|
161
|
+
});
|
|
162
|
+
|
|
163
|
+
var LinearProgressBar = _styledComponents["default"].span(_templateObject8 || (_templateObject8 = (0, _taggedTemplateLiteral2["default"])(["\n background-color: ", ";\n transform: ", ";\n top: 0;\n left: 0;\n width: 100%;\n bottom: 0;\n position: absolute;\n transition: ", ";\n transform-origin: left;\n ", ";\n ", ";\n\n @keyframes keyframes-indeterminate-first {\n 0% {\n left: -35%;\n right: 100%;\n }\n 60% {\n left: 100%;\n right: -90%;\n }\n 100% {\n left: 100%;\n right: -90%;\n }\n }\n\n @keyframes keyframes-indeterminate-second {\n 0% {\n left: -200%;\n right: 100%;\n }\n 60% {\n left: 107%;\n right: -8%;\n }\n 100% {\n left: 107%;\n right: -8%;\n }\n }\n"])), function (props) {
|
|
164
|
+
return props.backgroundType === "dark" ? props.theme.trackLineColorOnDark : props.theme.trackLineColor;
|
|
165
|
+
}, function (props) {
|
|
166
|
+
return "translateX(-".concat(props.variant === "determinate" ? 100 - props.value : 0, "%)");
|
|
167
|
+
}, function (props) {
|
|
168
|
+
return props.variant === "determinate" ? "transform .4s linear" : "transform 0.2s linear";
|
|
169
|
+
}, function (props) {
|
|
170
|
+
return props.variant === "indeterminate" && "width: auto;";
|
|
171
|
+
}, function (props) {
|
|
172
|
+
return props.variant === "indeterminate" ? props.container === "first" ? "animation: keyframes-indeterminate-first 2.1s cubic-bezier(0.65, 0.815, 0.735, 0.395) infinite;" : "animation: keyframes-indeterminate-second 2.1s cubic-bezier(0.165, 0.84, 0.44, 1) 1.15s infinite;" : "";
|
|
173
|
+
});
|
|
174
|
+
|
|
169
175
|
var _default = DxcProgressBar;
|
|
170
176
|
exports["default"] = _default;
|