@dxc-technology/halstack-react 0.0.0-dfd09f9 → 0.0.0-e01c6f9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/BackgroundColorContext.d.ts +1 -10
- package/BackgroundColorContext.js +5 -22
- package/HalstackContext.d.ts +1235 -0
- package/HalstackContext.js +310 -0
- package/README.md +47 -0
- package/accordion/Accordion.d.ts +1 -1
- package/accordion/Accordion.js +116 -160
- package/accordion/Accordion.stories.tsx +103 -127
- package/accordion/Accordion.test.js +25 -41
- package/accordion/types.d.ts +5 -16
- package/accordion-group/AccordionGroup.d.ts +4 -3
- package/accordion-group/AccordionGroup.js +31 -98
- package/accordion-group/AccordionGroup.stories.tsx +94 -67
- package/accordion-group/AccordionGroup.test.js +52 -105
- package/accordion-group/AccordionGroupAccordion.d.ts +4 -0
- package/accordion-group/AccordionGroupAccordion.js +31 -0
- package/accordion-group/types.d.ts +11 -16
- package/action-icon/ActionIcon.d.ts +4 -0
- package/action-icon/ActionIcon.js +43 -0
- package/action-icon/types.d.ts +26 -0
- package/alert/Alert.js +23 -59
- package/alert/Alert.stories.tsx +28 -0
- package/alert/Alert.test.js +29 -46
- package/alert/types.d.ts +5 -5
- package/badge/Badge.d.ts +1 -1
- package/badge/Badge.js +8 -19
- package/badge/types.d.ts +2 -1
- package/bleed/Bleed.js +14 -55
- package/bleed/Bleed.stories.tsx +95 -95
- package/bleed/types.d.ts +2 -2
- package/box/Box.d.ts +1 -1
- package/box/Box.js +30 -81
- package/box/Box.stories.tsx +38 -51
- package/box/Box.test.js +2 -7
- package/box/types.d.ts +3 -14
- package/bulleted-list/BulletedList.d.ts +7 -0
- package/bulleted-list/BulletedList.js +89 -0
- package/bulleted-list/BulletedList.stories.tsx +115 -0
- package/bulleted-list/types.d.ts +38 -0
- package/button/Button.d.ts +1 -1
- package/button/Button.js +62 -113
- package/button/Button.stories.tsx +160 -90
- package/button/Button.test.js +18 -17
- package/button/types.d.ts +12 -8
- package/card/Card.d.ts +1 -1
- package/card/Card.js +58 -102
- package/card/Card.stories.tsx +12 -42
- package/card/Card.test.js +11 -22
- package/card/types.d.ts +6 -11
- package/checkbox/Checkbox.d.ts +2 -2
- package/checkbox/Checkbox.js +141 -180
- package/checkbox/Checkbox.stories.tsx +128 -94
- package/checkbox/Checkbox.test.js +160 -39
- package/checkbox/types.d.ts +12 -6
- package/chip/Chip.js +39 -79
- package/chip/Chip.stories.tsx +121 -26
- package/chip/Chip.test.js +16 -31
- package/chip/types.d.ts +4 -4
- package/common/OpenSans.css +68 -80
- package/common/coreTokens.d.ts +237 -0
- package/common/coreTokens.js +184 -0
- package/common/utils.d.ts +1 -0
- package/common/utils.js +6 -12
- package/common/variables.d.ts +1381 -0
- package/common/variables.js +998 -1117
- package/container/Container.d.ts +4 -0
- package/container/Container.js +194 -0
- package/container/Container.stories.tsx +214 -0
- package/container/types.d.ts +74 -0
- package/date-input/Calendar.d.ts +4 -0
- package/date-input/Calendar.js +214 -0
- package/date-input/DateInput.js +153 -299
- package/date-input/DateInput.stories.tsx +203 -56
- package/date-input/DateInput.test.js +700 -371
- package/date-input/DatePicker.d.ts +4 -0
- package/date-input/DatePicker.js +115 -0
- package/date-input/Icons.d.ts +6 -0
- package/date-input/Icons.js +58 -0
- package/date-input/YearPicker.d.ts +4 -0
- package/date-input/YearPicker.js +100 -0
- package/date-input/types.d.ts +72 -15
- package/dialog/Dialog.d.ts +1 -1
- package/dialog/Dialog.js +73 -107
- package/dialog/Dialog.stories.tsx +320 -167
- package/dialog/Dialog.test.js +287 -20
- package/dialog/types.d.ts +18 -25
- package/dropdown/Dropdown.d.ts +1 -1
- package/dropdown/Dropdown.js +243 -304
- package/dropdown/Dropdown.stories.tsx +245 -56
- package/dropdown/Dropdown.test.js +575 -165
- package/dropdown/DropdownMenu.d.ts +4 -0
- package/dropdown/DropdownMenu.js +63 -0
- package/dropdown/DropdownMenuItem.d.ts +4 -0
- package/dropdown/DropdownMenuItem.js +67 -0
- package/dropdown/types.d.ts +32 -14
- package/file-input/FileInput.d.ts +2 -2
- package/file-input/FileInput.js +246 -357
- package/file-input/FileInput.stories.tsx +123 -12
- package/file-input/FileInput.test.js +369 -367
- package/file-input/FileItem.d.ts +4 -14
- package/file-input/FileItem.js +50 -99
- package/file-input/types.d.ts +25 -8
- package/flex/Flex.d.ts +4 -0
- package/flex/Flex.js +57 -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 +57 -115
- package/footer/Footer.stories.tsx +41 -19
- package/footer/Footer.test.js +33 -57
- package/footer/Icons.d.ts +2 -2
- package/footer/Icons.js +3 -8
- package/footer/types.d.ts +21 -28
- package/grid/Grid.d.ts +7 -0
- package/grid/Grid.js +76 -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 +90 -170
- package/header/Header.stories.tsx +118 -39
- package/header/Header.test.js +13 -26
- package/header/Icons.d.ts +2 -2
- package/header/Icons.js +4 -9
- package/header/types.d.ts +5 -19
- package/heading/Heading.js +10 -32
- package/heading/Heading.test.js +71 -88
- package/heading/types.d.ts +7 -7
- package/image/Image.d.ts +4 -0
- package/image/Image.js +70 -0
- package/image/Image.stories.tsx +127 -0
- package/image/types.d.ts +72 -0
- package/inset/Inset.js +14 -55
- package/inset/Inset.stories.tsx +37 -36
- package/inset/types.d.ts +2 -2
- package/layout/ApplicationLayout.d.ts +16 -6
- package/layout/ApplicationLayout.js +82 -166
- package/layout/ApplicationLayout.stories.tsx +85 -94
- package/layout/Icons.d.ts +8 -0
- package/layout/Icons.js +51 -48
- package/layout/SidenavContext.d.ts +5 -0
- package/layout/SidenavContext.js +13 -0
- package/layout/types.d.ts +19 -35
- package/link/Link.d.ts +3 -2
- package/link/Link.js +61 -99
- package/link/Link.stories.tsx +155 -53
- package/link/Link.test.js +25 -53
- package/link/types.d.ts +15 -31
- package/main.d.ts +11 -12
- package/main.js +58 -109
- package/nav-tabs/NavTabs.d.ts +8 -0
- package/nav-tabs/NavTabs.js +90 -0
- package/nav-tabs/NavTabs.stories.tsx +274 -0
- package/nav-tabs/NavTabs.test.js +75 -0
- package/nav-tabs/Tab.d.ts +4 -0
- package/nav-tabs/Tab.js +117 -0
- package/nav-tabs/types.d.ts +52 -0
- package/nav-tabs/types.js +5 -0
- package/number-input/NumberInput.d.ts +7 -0
- package/number-input/NumberInput.js +26 -35
- package/number-input/NumberInput.stories.tsx +42 -26
- package/number-input/NumberInput.test.js +701 -377
- package/number-input/types.d.ts +12 -6
- package/package.json +44 -46
- package/paginator/Icons.d.ts +5 -0
- package/paginator/Icons.js +21 -47
- package/paginator/Paginator.js +34 -91
- package/paginator/Paginator.stories.tsx +24 -0
- package/paginator/Paginator.test.js +280 -211
- package/paginator/types.d.ts +3 -3
- package/paragraph/Paragraph.d.ts +5 -0
- package/paragraph/Paragraph.js +22 -0
- package/paragraph/Paragraph.stories.tsx +27 -0
- package/password-input/Icons.d.ts +6 -0
- package/password-input/Icons.js +35 -0
- package/password-input/PasswordInput.js +57 -123
- package/password-input/PasswordInput.stories.tsx +1 -33
- package/password-input/PasswordInput.test.js +160 -143
- package/password-input/types.d.ts +9 -8
- package/progress-bar/ProgressBar.js +65 -91
- package/progress-bar/ProgressBar.stories.tsx +93 -0
- package/progress-bar/ProgressBar.test.js +72 -44
- package/progress-bar/types.d.ts +3 -3
- package/quick-nav/QuickNav.js +71 -41
- package/quick-nav/QuickNav.stories.tsx +146 -27
- package/quick-nav/types.d.ts +10 -10
- package/radio-group/Radio.d.ts +1 -1
- package/radio-group/Radio.js +59 -76
- package/radio-group/RadioGroup.js +71 -116
- package/radio-group/RadioGroup.stories.tsx +132 -18
- package/radio-group/RadioGroup.test.js +518 -457
- package/radio-group/types.d.ts +10 -10
- package/resultset-table/Icons.d.ts +7 -0
- package/resultset-table/Icons.js +47 -0
- package/resultset-table/ResultsetTable.js +159 -0
- package/{resultsetTable → resultset-table}/ResultsetTable.stories.tsx +50 -25
- package/{resultsetTable → resultset-table}/ResultsetTable.test.js +117 -118
- package/{resultsetTable → resultset-table}/types.d.ts +7 -7
- package/resultset-table/types.js +5 -0
- package/select/Icons.d.ts +7 -7
- package/select/Icons.js +1 -5
- package/select/Listbox.d.ts +1 -1
- package/select/Listbox.js +46 -51
- package/select/Option.js +20 -50
- package/select/Select.js +168 -242
- package/select/Select.stories.tsx +525 -136
- package/select/Select.test.js +2009 -1696
- package/select/types.d.ts +16 -20
- package/sidenav/Icons.d.ts +7 -0
- package/sidenav/Icons.js +47 -0
- package/sidenav/Sidenav.d.ts +6 -5
- package/sidenav/Sidenav.js +131 -71
- package/sidenav/Sidenav.stories.tsx +251 -151
- package/sidenav/Sidenav.test.js +26 -45
- package/sidenav/types.d.ts +52 -26
- package/slider/Slider.d.ts +2 -2
- package/slider/Slider.js +148 -181
- package/slider/Slider.test.js +185 -81
- package/slider/types.d.ts +7 -3
- package/spinner/Spinner.js +31 -75
- package/spinner/{Spinner.stories.jsx → Spinner.stories.tsx} +53 -27
- package/spinner/Spinner.test.js +26 -35
- package/spinner/types.d.ts +3 -3
- package/switch/Switch.d.ts +2 -2
- package/switch/Switch.js +143 -121
- package/switch/Switch.stories.tsx +41 -64
- package/switch/Switch.test.js +138 -56
- package/switch/types.d.ts +9 -5
- package/table/Table.js +8 -30
- package/table/{Table.stories.jsx → Table.stories.tsx} +80 -1
- package/table/Table.test.js +3 -8
- package/table/types.d.ts +8 -8
- package/tabs/Tab.d.ts +4 -0
- package/tabs/Tab.js +113 -0
- package/tabs/Tabs.js +314 -141
- package/tabs/Tabs.stories.tsx +119 -11
- package/tabs/Tabs.test.js +223 -69
- package/tabs/types.d.ts +28 -18
- package/tag/Tag.js +33 -68
- package/tag/Tag.stories.tsx +14 -1
- package/tag/Tag.test.js +20 -31
- package/tag/types.d.ts +7 -7
- package/text-input/Icons.d.ts +8 -0
- package/text-input/Icons.js +56 -0
- package/text-input/Suggestion.d.ts +4 -0
- package/text-input/Suggestion.js +67 -0
- package/text-input/Suggestions.d.ts +4 -0
- package/text-input/Suggestions.js +84 -0
- package/text-input/TextInput.js +323 -547
- package/text-input/TextInput.stories.tsx +266 -275
- package/text-input/TextInput.test.js +1403 -1376
- package/text-input/types.d.ts +53 -14
- package/textarea/Textarea.js +79 -131
- package/textarea/Textarea.stories.tsx +174 -0
- package/textarea/Textarea.test.js +152 -183
- package/textarea/types.d.ts +10 -6
- package/toggle-group/ToggleGroup.d.ts +2 -2
- package/toggle-group/ToggleGroup.js +92 -106
- package/toggle-group/ToggleGroup.stories.tsx +49 -4
- package/toggle-group/ToggleGroup.test.js +69 -88
- package/toggle-group/types.d.ts +26 -17
- package/typography/Typography.d.ts +4 -0
- package/typography/Typography.js +23 -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 +1133 -1
- package/useTheme.js +4 -11
- package/useTranslatedLabels.d.ts +85 -0
- package/useTranslatedLabels.js +14 -0
- package/utils/BaseTypography.d.ts +21 -0
- package/utils/BaseTypography.js +94 -0
- package/utils/FocusLock.d.ts +13 -0
- package/utils/FocusLock.js +121 -0
- package/wizard/Wizard.js +51 -91
- package/wizard/Wizard.stories.tsx +40 -1
- package/wizard/Wizard.test.js +54 -81
- package/wizard/types.d.ts +7 -7
- package/ThemeContext.d.ts +0 -10
- package/ThemeContext.js +0 -243
- 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/progress-bar/ProgressBar.stories.jsx +0 -58
- package/radio/Radio.d.ts +0 -4
- package/radio/Radio.js +0 -174
- package/radio/Radio.stories.tsx +0 -192
- package/radio/Radio.test.js +0 -71
- package/radio/types.d.ts +0 -54
- package/resultsetTable/ResultsetTable.js +0 -254
- 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/slider/Slider.stories.tsx +0 -177
- 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/textarea/Textarea.stories.jsx +0 -157
- /package/{list → action-icon}/types.js +0 -0
- /package/{radio → bulleted-list}/types.js +0 -0
- /package/{resultsetTable → container}/types.js +0 -0
- /package/{row → flex}/types.js +0 -0
- /package/{stack → grid}/types.js +0 -0
- /package/{number-input/numberInputContextTypes.js → image/types.js} +0 -0
- /package/{resultsetTable → resultset-table}/ResultsetTable.d.ts +0 -0
package/wizard/Wizard.js
CHANGED
|
@@ -1,34 +1,21 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
4
|
var _typeof3 = require("@babel/runtime/helpers/typeof");
|
|
6
|
-
|
|
7
5
|
Object.defineProperty(exports, "__esModule", {
|
|
8
6
|
value: true
|
|
9
7
|
});
|
|
10
8
|
exports["default"] = void 0;
|
|
11
|
-
|
|
12
9
|
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
|
|
13
|
-
|
|
14
10
|
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
|
|
15
|
-
|
|
16
11
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
17
|
-
|
|
18
12
|
var _react = _interopRequireWildcard(require("react"));
|
|
19
|
-
|
|
20
13
|
var _styledComponents = _interopRequireWildcard(require("styled-components"));
|
|
21
|
-
|
|
22
|
-
var _variables = require("../common/variables.js");
|
|
23
|
-
|
|
14
|
+
var _variables = require("../common/variables");
|
|
24
15
|
var _useTheme = _interopRequireDefault(require("../useTheme"));
|
|
25
|
-
|
|
26
16
|
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10, _templateObject11, _templateObject12, _templateObject13;
|
|
27
|
-
|
|
28
|
-
function
|
|
29
|
-
|
|
30
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof3(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; }
|
|
31
|
-
|
|
17
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
18
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof3(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
|
|
32
19
|
var icons = {
|
|
33
20
|
validIcon: /*#__PURE__*/_react["default"].createElement("svg", {
|
|
34
21
|
id: "check_circle_black_18dp",
|
|
@@ -80,38 +67,31 @@ var icons = {
|
|
|
80
67
|
fill: "#d0011b"
|
|
81
68
|
}))
|
|
82
69
|
};
|
|
83
|
-
|
|
84
70
|
var DxcWizard = function DxcWizard(_ref) {
|
|
85
71
|
var _ref2;
|
|
86
|
-
|
|
87
72
|
var _ref$mode = _ref.mode,
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
73
|
+
mode = _ref$mode === void 0 ? "horizontal" : _ref$mode,
|
|
74
|
+
defaultCurrentStep = _ref.defaultCurrentStep,
|
|
75
|
+
currentStep = _ref.currentStep,
|
|
76
|
+
onStepClick = _ref.onStepClick,
|
|
77
|
+
steps = _ref.steps,
|
|
78
|
+
margin = _ref.margin,
|
|
79
|
+
_ref$tabIndex = _ref.tabIndex,
|
|
80
|
+
tabIndex = _ref$tabIndex === void 0 ? 0 : _ref$tabIndex;
|
|
97
81
|
var _useState = (0, _react.useState)((_ref2 = currentStep !== null && currentStep !== void 0 ? currentStep : defaultCurrentStep) !== null && _ref2 !== void 0 ? _ref2 : 0),
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
82
|
+
_useState2 = (0, _slicedToArray2["default"])(_useState, 2),
|
|
83
|
+
innerCurrent = _useState2[0],
|
|
84
|
+
setInnerCurrentStep = _useState2[1];
|
|
102
85
|
var renderedCurrent = currentStep == null ? innerCurrent : currentStep;
|
|
103
86
|
var colorsTheme = (0, _useTheme["default"])();
|
|
104
|
-
|
|
105
87
|
var handleStepClick = function handleStepClick(newValue) {
|
|
106
88
|
if (currentStep == null) {
|
|
107
89
|
setInnerCurrentStep(newValue);
|
|
108
90
|
}
|
|
109
|
-
|
|
110
91
|
if (onStepClick) {
|
|
111
92
|
onStepClick(newValue);
|
|
112
93
|
}
|
|
113
94
|
};
|
|
114
|
-
|
|
115
95
|
return /*#__PURE__*/_react["default"].createElement(_styledComponents.ThemeProvider, {
|
|
116
96
|
theme: colorsTheme.wizard
|
|
117
97
|
}, /*#__PURE__*/_react["default"].createElement(StepsContainer, {
|
|
@@ -139,17 +119,14 @@ var DxcWizard = function DxcWizard(_ref) {
|
|
|
139
119
|
current: i === renderedCurrent,
|
|
140
120
|
visited: i < renderedCurrent,
|
|
141
121
|
disabled: step.disabled
|
|
142
|
-
}, step.icon ? /*#__PURE__*/_react["default"].createElement(StepIconContainer, {
|
|
143
|
-
disabled: step.disabled
|
|
144
|
-
}, typeof step.icon === "string" ? /*#__PURE__*/_react["default"].createElement(Icon, {
|
|
122
|
+
}, step.icon ? /*#__PURE__*/_react["default"].createElement(StepIconContainer, null, typeof step.icon === "string" ? /*#__PURE__*/_react["default"].createElement(Icon, {
|
|
145
123
|
src: step.icon
|
|
146
|
-
}) : step.icon) : /*#__PURE__*/_react["default"].createElement(Number, {
|
|
147
|
-
|
|
148
|
-
current: i === renderedCurrent
|
|
149
|
-
}, i + 1)), step.valid !== undefined && (step.valid ? /*#__PURE__*/_react["default"].createElement(ValidityIconContainer, null, icons.validIcon) : /*#__PURE__*/_react["default"].createElement(ValidityIconContainer, null, icons.invalidIcon))), (step.label || step.description) && /*#__PURE__*/_react["default"].createElement(InfoContainer, null, step.label && /*#__PURE__*/_react["default"].createElement(Label, {
|
|
124
|
+
}) : step.icon) : /*#__PURE__*/_react["default"].createElement(Number, null, i + 1)), step.valid !== undefined && (step.valid ? /*#__PURE__*/_react["default"].createElement(ValidityIconContainer, null, icons.validIcon) : /*#__PURE__*/_react["default"].createElement(ValidityIconContainer, null, icons.invalidIcon))), (step.label || step.description) && /*#__PURE__*/_react["default"].createElement(InfoContainer, null, step.label && /*#__PURE__*/_react["default"].createElement(Label, {
|
|
125
|
+
current: i === renderedCurrent,
|
|
150
126
|
disabled: step.disabled,
|
|
151
127
|
visited: i <= innerCurrent
|
|
152
128
|
}, step.label), step.description && /*#__PURE__*/_react["default"].createElement(Description, {
|
|
129
|
+
current: i === renderedCurrent,
|
|
153
130
|
disabled: step.disabled,
|
|
154
131
|
visited: i <= innerCurrent
|
|
155
132
|
}, step.description))), i === steps.length - 1 ? "" : /*#__PURE__*/_react["default"].createElement(StepSeparator, {
|
|
@@ -157,8 +134,7 @@ var DxcWizard = function DxcWizard(_ref) {
|
|
|
157
134
|
}));
|
|
158
135
|
})));
|
|
159
136
|
};
|
|
160
|
-
|
|
161
|
-
var StepsContainer = _styledComponents["default"].div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n flex-direction: ", ";\n justify-content: \"center\";\n ", ";\n font-family: ", ";\n\n margin: ", ";\n margin-top: ", ";\n margin-right: ", ";\n margin-bottom: ", ";\n margin-left: ", ";\n"])), function (props) {
|
|
137
|
+
var StepsContainer = _styledComponents["default"].div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n flex-direction: ", ";\n justify-content: center;\n ", ";\n font-family: ", ";\n margin: ", ";\n margin-top: ", ";\n margin-right: ", ";\n margin-bottom: ", ";\n margin-left: ", ";\n"])), function (props) {
|
|
162
138
|
return props.mode === "vertical" ? "column" : "row";
|
|
163
139
|
}, function (props) {
|
|
164
140
|
return props.mode === "vertical" && "height: 500px";
|
|
@@ -175,18 +151,16 @@ var StepsContainer = _styledComponents["default"].div(_templateObject || (_templ
|
|
|
175
151
|
}, function (props) {
|
|
176
152
|
return props.margin && (0, _typeof2["default"])(props.margin) === "object" && props.margin.left ? _variables.spaces[props.margin.left] : "";
|
|
177
153
|
});
|
|
178
|
-
|
|
179
154
|
var StepContainer = _styledComponents["default"].div(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2["default"])(["\n display: inline-flex;\n ", "\n flex-grow: ", ";\n flex-direction: ", ";\n ", "\n"])), function (props) {
|
|
180
|
-
return props.mode
|
|
155
|
+
return props.mode !== "vertical" && "align-items: center;";
|
|
181
156
|
}, function (props) {
|
|
182
157
|
return props.lastStep ? "0" : "1";
|
|
183
158
|
}, function (props) {
|
|
184
159
|
return props.mode === "vertical" ? "column" : "row";
|
|
185
160
|
}, function (props) {
|
|
186
|
-
return props.mode === "vertical"
|
|
161
|
+
return props.mode === "vertical" && "width: fit-content;";
|
|
187
162
|
});
|
|
188
|
-
|
|
189
|
-
var Step = _styledComponents["default"].button(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2["default"])(["\n border: none;\n background: inherit;\n display: flex;\n justify-content: flex-start;\n align-items: center;\n margin: ", ";\n\n padding: 0px;\n ", ";\n\n &:hover {\n ", ";\n }\n &:focus {\n outline: ", " auto 1px;\n }\n"])), function (props) {
|
|
163
|
+
var Step = _styledComponents["default"].button(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n justify-content: flex-start;\n align-items: center;\n border: none;\n border-radius: 0.25rem;\n background: inherit;\n margin: ", ";\n\n padding: 0px;\n ", ";\n\n &:hover {\n ", ";\n }\n &:focus {\n outline: 2px solid ", ";\n }\n"])), function (props) {
|
|
190
164
|
return props.first ? props.mode === "vertical" ? "0 0 24px 0" : "0 24px 0 0" : props.last ? props.mode === "vertical" ? "24px 0 0 0" : "0 0 0 24px" : props.mode === "vertical" ? "24px 0" : "0 24px";
|
|
191
165
|
}, function (props) {
|
|
192
166
|
return props.disabled ? "cursor: not-allowed" : "";
|
|
@@ -195,51 +169,43 @@ var Step = _styledComponents["default"].button(_templateObject3 || (_templateObj
|
|
|
195
169
|
}, function (props) {
|
|
196
170
|
return props.theme.focusColor;
|
|
197
171
|
});
|
|
198
|
-
|
|
199
172
|
var StepHeader = _styledComponents["default"].div(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2["default"])(["\n position: relative;\n display: inline-flex;\n ", "\n"])), function (props) {
|
|
200
173
|
return props.validityIcon && "padding-bottom: 4px;";
|
|
201
174
|
});
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
return props.disabled ? props.theme.disabledCircleWidth : props.current ? props.theme.selectedCircleWidth : props.theme.circleWidth;
|
|
175
|
+
var IconContainer = _styledComponents["default"].div(_templateObject5 || (_templateObject5 = (0, _taggedTemplateLiteral2["default"])(["\n width: ", ";\n height: ", ";\n\n ", "\n ", ";\n\n border-radius: ", ";\n\n display: flex;\n justify-content: center;\n align-items: center;\n"])), function (props) {
|
|
176
|
+
return props.disabled ? props.theme.disabledStepWidth : props.current ? props.theme.selectedStepWidth : props.theme.stepWidth;
|
|
205
177
|
}, function (props) {
|
|
206
|
-
return props.disabled ? props.theme.
|
|
178
|
+
return props.disabled ? props.theme.disabledStepHeight : props.current ? props.theme.selectedStepHeight : props.theme.stepHeight;
|
|
207
179
|
}, function (props) {
|
|
208
|
-
return "\n ".concat(
|
|
180
|
+
return "\n ".concat(props.disabled ? "border: ".concat(props.theme.disabledStepBorderThickness, " ").concat(props.theme.disabledStepBorderStyle, " ").concat(props.theme.disabledStepBorderColor, ";") : props.current ? "border: ".concat(props.theme.selectedStepBorderThickness, " ").concat(props.theme.selectedStepBorderStyle, " ").concat(props.theme.selectedStepBorderColor, ";") : props.visited ? "border: ".concat(props.theme.stepBorderThickness, " ").concat(props.theme.stepBorderStyle, " ").concat(props.theme.visitedStepBorderColor, ";") : "border: ".concat(props.theme.stepBorderThickness, " ").concat(props.theme.stepBorderStyle, " ").concat(props.theme.unvisitedStepBorderColor, ";"), "\n background: ").concat(props.disabled ? "".concat(props.theme.disabledStepBackgroundColor) : props.current ? "".concat(props.theme.selectedStepBackgroundColor) : !props.visited ? "".concat(props.theme.unvisitedStepBackgroundColor) : "".concat(props.theme.visitedStepBackgroundColor), ";\n ");
|
|
209
181
|
}, function (props) {
|
|
210
|
-
return props.disabled ? "color: ".concat(props.theme.
|
|
182
|
+
return props.disabled ? "color: ".concat(props.theme.disabledStepFontColor, ";") : "color: ".concat(props.current ? props.theme.selectedStepFontColor : !props.visited ? props.theme.unvisitedStepFontColor : props.theme.visitedStepFontColor, ";");
|
|
211
183
|
}, function (props) {
|
|
212
|
-
return !props.current && !props.disabled ? props.theme.
|
|
184
|
+
return !props.current && !props.disabled ? props.theme.stepBorderRadius : props.current ? props.theme.selectedStepBorderRadius : props.disabled ? props.theme.disabledStepBorderRadius : "";
|
|
213
185
|
});
|
|
214
|
-
|
|
215
186
|
var Icon = _styledComponents["default"].img(_templateObject6 || (_templateObject6 = (0, _taggedTemplateLiteral2["default"])(["\n width: ", ";\n height: ", ";\n"])), function (props) {
|
|
216
|
-
return props.theme.
|
|
187
|
+
return props.theme.stepIconSize;
|
|
217
188
|
}, function (props) {
|
|
218
|
-
return props.theme.
|
|
189
|
+
return props.theme.stepIconSize;
|
|
219
190
|
});
|
|
220
|
-
|
|
221
191
|
var StepIconContainer = _styledComponents["default"].div(_templateObject7 || (_templateObject7 = (0, _taggedTemplateLiteral2["default"])(["\n width: ", ";\n height: ", ";\n overflow: hidden;\n img,\n svg {\n height: 100%;\n width: 100%;\n }\n"])), function (props) {
|
|
222
|
-
return props.theme.
|
|
192
|
+
return props.theme.stepIconSize;
|
|
223
193
|
}, function (props) {
|
|
224
|
-
return props.theme.
|
|
194
|
+
return props.theme.stepIconSize;
|
|
225
195
|
});
|
|
226
|
-
|
|
227
196
|
var Number = _styledComponents["default"].p(_templateObject8 || (_templateObject8 = (0, _taggedTemplateLiteral2["default"])(["\n font-size: ", ";\n font-family: ", ";\n font-style: ", ";\n font-weight: ", ";\n letter-spacing: ", ";\n opacity: 1;\n margin: 0px 0px 0px 1px;\n"])), function (props) {
|
|
228
|
-
return props.theme.
|
|
197
|
+
return props.theme.stepFontSize;
|
|
229
198
|
}, function (props) {
|
|
230
|
-
return props.theme.
|
|
199
|
+
return props.theme.stepFontFamily;
|
|
231
200
|
}, function (props) {
|
|
232
|
-
return props.theme.
|
|
201
|
+
return props.theme.stepFontStyle;
|
|
233
202
|
}, function (props) {
|
|
234
|
-
return props.theme.
|
|
203
|
+
return props.theme.stepFontWeight;
|
|
235
204
|
}, function (props) {
|
|
236
|
-
return props.theme.
|
|
205
|
+
return props.theme.stepFontTracking;
|
|
237
206
|
});
|
|
238
|
-
|
|
239
207
|
var ValidityIconContainer = _styledComponents["default"].div(_templateObject9 || (_templateObject9 = (0, _taggedTemplateLiteral2["default"])(["\n width: 18px;\n height: 18px;\n position: absolute;\n top: 22.5px;\n left: 22.5px;\n"])));
|
|
240
|
-
|
|
241
208
|
var InfoContainer = _styledComponents["default"].div(_templateObject10 || (_templateObject10 = (0, _taggedTemplateLiteral2["default"])(["\n margin-left: 12px;\n"])));
|
|
242
|
-
|
|
243
209
|
var Label = _styledComponents["default"].p(_templateObject11 || (_templateObject11 = (0, _taggedTemplateLiteral2["default"])(["\n text-align: ", ";\n font-family: ", ";\n font-size: ", ";\n font-style: ", ";\n font-weight: ", ";\n letter-spacing: ", ";\n ", ";\n text-transform: ", ";\n margin: 0;\n"])), function (props) {
|
|
244
210
|
return props.theme.labelTextAlign;
|
|
245
211
|
}, function (props) {
|
|
@@ -251,40 +217,34 @@ var Label = _styledComponents["default"].p(_templateObject11 || (_templateObject
|
|
|
251
217
|
}, function (props) {
|
|
252
218
|
return props.theme.labelFontWeight;
|
|
253
219
|
}, function (props) {
|
|
254
|
-
return props.theme.
|
|
220
|
+
return props.theme.labelFontTracking;
|
|
255
221
|
}, function (props) {
|
|
256
|
-
return props.disabled ? "color: ".concat(props.theme.
|
|
222
|
+
return props.disabled ? "color: ".concat(props.theme.disabledLabelFontColor, ";") : "color: ".concat(!props.visited ? props.theme.unvisitedLabelFontColor : props.current ? props.theme.selectedLabelFontColor : props.theme.visitedLabelFontColor, ";");
|
|
257
223
|
}, function (props) {
|
|
258
224
|
return props.theme.labelFontTextTransform;
|
|
259
225
|
});
|
|
260
|
-
|
|
261
226
|
var Description = _styledComponents["default"].p(_templateObject12 || (_templateObject12 = (0, _taggedTemplateLiteral2["default"])(["\n text-align: ", ";\n font-family: ", ";\n font-size: ", ";\n font-style: ", ";\n font-weight: ", ";\n letter-spacing: ", ";\n text-transform: ", ";\n ", ";\n margin: 0;\n"])), function (props) {
|
|
262
|
-
return props.theme.
|
|
227
|
+
return props.theme.helperTextTextAlign;
|
|
263
228
|
}, function (props) {
|
|
264
|
-
return props.theme.
|
|
229
|
+
return props.theme.helperTextFontFamily;
|
|
265
230
|
}, function (props) {
|
|
266
|
-
return props.theme.
|
|
231
|
+
return props.theme.helperTextFontSize;
|
|
267
232
|
}, function (props) {
|
|
268
|
-
return props.theme.
|
|
233
|
+
return props.theme.helperTextFontStyle;
|
|
269
234
|
}, function (props) {
|
|
270
|
-
return props.theme.
|
|
235
|
+
return props.theme.helperTextFontWeight;
|
|
271
236
|
}, function (props) {
|
|
272
|
-
return props.theme.
|
|
237
|
+
return props.theme.helperTextFontTracking;
|
|
273
238
|
}, function (props) {
|
|
274
|
-
return props.theme.
|
|
239
|
+
return props.theme.helperTextFontTextTransform;
|
|
275
240
|
}, function (props) {
|
|
276
|
-
return props.disabled ? "color: ".concat(props.theme.
|
|
241
|
+
return props.disabled ? "color: ".concat(props.theme.disabledHelperTextFontColor, ";") : "color: ".concat(!props.visited ? props.theme.unvisitedHelperTextFontColor : props.current ? props.theme.selectedHelperTextFontColor : props.theme.visitedHelperTextFontColor, ";");
|
|
277
242
|
});
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
return props.mode === "horizontal" ? "" : "0";
|
|
243
|
+
var StepSeparator = _styledComponents["default"].div(_templateObject13 || (_templateObject13 = (0, _taggedTemplateLiteral2["default"])(["\n ", ";\n ", "\n border: ", ";\n opacity: 1;\n flex-grow: 1;\n"])), function (props) {
|
|
244
|
+
return props.mode === "horizontal" ? "height: 0;" : "width: 0;";
|
|
281
245
|
}, function (props) {
|
|
282
|
-
return props.mode === "
|
|
283
|
-
}, function (props) {
|
|
284
|
-
return props.mode === "vertical" ? "margin: 0 18px;" : "";
|
|
246
|
+
return props.mode === "vertical" && "margin: 0 18px;";
|
|
285
247
|
}, function (props) {
|
|
286
248
|
return "".concat(props.theme.separatorBorderStyle, " ").concat(props.theme.separatorBorderThickness, " ").concat(props.theme.separatorColor);
|
|
287
249
|
});
|
|
288
|
-
|
|
289
|
-
var _default = DxcWizard;
|
|
290
|
-
exports["default"] = _default;
|
|
250
|
+
var _default = exports["default"] = DxcWizard;
|
|
@@ -3,6 +3,7 @@ import DxcWizard from "./Wizard";
|
|
|
3
3
|
import Title from "../../.storybook/components/Title";
|
|
4
4
|
import ExampleContainer from "../../.storybook/components/ExampleContainer";
|
|
5
5
|
import { userEvent, within } from "@storybook/testing-library";
|
|
6
|
+
import { HalstackProvider } from "../HalstackContext";
|
|
6
7
|
|
|
7
8
|
export default {
|
|
8
9
|
title: "Wizard",
|
|
@@ -36,6 +37,7 @@ const stepWithLabel = [
|
|
|
36
37
|
label: "Forth step",
|
|
37
38
|
},
|
|
38
39
|
];
|
|
40
|
+
|
|
39
41
|
const stepWithLabelDescription = [
|
|
40
42
|
{
|
|
41
43
|
label: "First step",
|
|
@@ -56,6 +58,7 @@ const stepWithLabelDescription = [
|
|
|
56
58
|
valid: false,
|
|
57
59
|
},
|
|
58
60
|
];
|
|
61
|
+
|
|
59
62
|
const stepWithLongDescription = [
|
|
60
63
|
{
|
|
61
64
|
label: "First step",
|
|
@@ -73,6 +76,7 @@ const stepWithLongDescription = [
|
|
|
73
76
|
"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. ",
|
|
74
77
|
},
|
|
75
78
|
];
|
|
79
|
+
|
|
76
80
|
const stepDisabled = [
|
|
77
81
|
{
|
|
78
82
|
label: "First step",
|
|
@@ -98,6 +102,7 @@ const stepDisabled = [
|
|
|
98
102
|
disabled: true,
|
|
99
103
|
},
|
|
100
104
|
];
|
|
105
|
+
|
|
101
106
|
const stepIcons = [
|
|
102
107
|
{
|
|
103
108
|
label: "First step",
|
|
@@ -112,6 +117,7 @@ const stepIcons = [
|
|
|
112
117
|
icon: favoriteSVG,
|
|
113
118
|
},
|
|
114
119
|
];
|
|
120
|
+
|
|
115
121
|
const stepLargeIcons = [
|
|
116
122
|
{
|
|
117
123
|
label: "First step",
|
|
@@ -127,19 +133,41 @@ const stepLargeIcons = [
|
|
|
127
133
|
},
|
|
128
134
|
];
|
|
129
135
|
|
|
136
|
+
const opinionatedTheme = {
|
|
137
|
+
wizard: {
|
|
138
|
+
baseColor: "#5f249f",
|
|
139
|
+
fontColor: "#000000",
|
|
140
|
+
selectedStepFontColor: "#ffffff",
|
|
141
|
+
},
|
|
142
|
+
};
|
|
143
|
+
|
|
130
144
|
export const Chromatic = () => (
|
|
131
145
|
<>
|
|
132
146
|
<ExampleContainer>
|
|
133
147
|
<Title title="Current step in the third step, labels and description" theme="light" level={4} />
|
|
134
148
|
<DxcWizard defaultCurrentStep={2} steps={stepWithLabelDescription}></DxcWizard>
|
|
149
|
+
</ExampleContainer>
|
|
150
|
+
<ExampleContainer>
|
|
135
151
|
<Title title="With long description in horizontal" theme="light" level={4} />
|
|
136
152
|
<DxcWizard steps={stepWithLongDescription}></DxcWizard>
|
|
153
|
+
</ExampleContainer>
|
|
154
|
+
<ExampleContainer>
|
|
137
155
|
<Title title="With long description in vertical" theme="light" level={4} />
|
|
138
156
|
<DxcWizard mode="vertical" steps={stepWithLongDescription}></DxcWizard>
|
|
157
|
+
</ExampleContainer>
|
|
158
|
+
<ExampleContainer>
|
|
139
159
|
<Title title="Disabled steps" theme="light" level={4} />
|
|
140
160
|
<DxcWizard steps={stepDisabled}></DxcWizard>
|
|
161
|
+
</ExampleContainer>
|
|
162
|
+
<ExampleContainer pseudoState="pseudo-focus">
|
|
163
|
+
<Title title="Focused steps" theme="light" level={4} />
|
|
164
|
+
<DxcWizard steps={stepIcons}></DxcWizard>
|
|
165
|
+
</ExampleContainer>
|
|
166
|
+
<ExampleContainer>
|
|
141
167
|
<Title title="With icons" theme="light" level={4} />
|
|
142
168
|
<DxcWizard steps={stepIcons}></DxcWizard>
|
|
169
|
+
</ExampleContainer>
|
|
170
|
+
<ExampleContainer>
|
|
143
171
|
<Title title="With large icons" theme="light" level={4} />
|
|
144
172
|
<DxcWizard steps={stepLargeIcons}></DxcWizard>
|
|
145
173
|
</ExampleContainer>
|
|
@@ -201,10 +229,21 @@ export const Chromatic = () => (
|
|
|
201
229
|
<Title title="Xxlarge margin" theme="light" level={4} />
|
|
202
230
|
<DxcWizard mode="vertical" margin="xxlarge" steps={stepWithLabel}></DxcWizard>
|
|
203
231
|
</ExampleContainer>
|
|
232
|
+
<Title title="Opinionated theme" theme="light" level={2} />
|
|
233
|
+
<ExampleContainer>
|
|
234
|
+
<HalstackProvider theme={opinionatedTheme}>
|
|
235
|
+
<DxcWizard defaultCurrentStep={2} steps={stepWithLabelDescription}></DxcWizard>
|
|
236
|
+
</HalstackProvider>
|
|
237
|
+
</ExampleContainer>
|
|
204
238
|
</>
|
|
205
239
|
);
|
|
206
240
|
|
|
207
|
-
const WizardSelected = () =>
|
|
241
|
+
const WizardSelected = () => (
|
|
242
|
+
<ExampleContainer>
|
|
243
|
+
<Title title="Clicked step" theme="light" level={4} />
|
|
244
|
+
<DxcWizard steps={stepWithLabel} mode="vertical"></DxcWizard>
|
|
245
|
+
</ExampleContainer>
|
|
246
|
+
);
|
|
208
247
|
|
|
209
248
|
export const WizardStepActived = WizardSelected.bind({});
|
|
210
249
|
WizardStepActived.play = async ({ canvasElement }) => {
|
package/wizard/Wizard.test.js
CHANGED
|
@@ -1,25 +1,20 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
4
|
var _react = _interopRequireDefault(require("react"));
|
|
6
|
-
|
|
7
5
|
var _react2 = require("@testing-library/react");
|
|
8
|
-
|
|
9
|
-
var _Wizard = _interopRequireDefault(require("./Wizard"));
|
|
10
|
-
|
|
6
|
+
var _Wizard = _interopRequireDefault(require("./Wizard.tsx"));
|
|
11
7
|
describe("Wizard components tests", function () {
|
|
12
8
|
test("Wizard renders with correct steps", function () {
|
|
13
9
|
var _render = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Wizard["default"], {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
10
|
+
steps: [{
|
|
11
|
+
label: "first-step"
|
|
12
|
+
}, {
|
|
13
|
+
label: "second-step"
|
|
14
|
+
}]
|
|
15
|
+
})),
|
|
16
|
+
getByText = _render.getByText,
|
|
17
|
+
getAllByRole = _render.getAllByRole;
|
|
23
18
|
var steps = getAllByRole("button");
|
|
24
19
|
expect(getByText("first-step")).toBeTruthy();
|
|
25
20
|
expect(getByText("second-step")).toBeTruthy();
|
|
@@ -28,112 +23,90 @@ describe("Wizard components tests", function () {
|
|
|
28
23
|
});
|
|
29
24
|
test("Wizard renders with initially selected step", function () {
|
|
30
25
|
var _render2 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Wizard["default"], {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
26
|
+
defaultCurrentStep: 1,
|
|
27
|
+
steps: [{
|
|
28
|
+
label: "first-step"
|
|
29
|
+
}, {
|
|
30
|
+
label: "second-step"
|
|
31
|
+
}]
|
|
32
|
+
})),
|
|
33
|
+
getAllByRole = _render2.getAllByRole;
|
|
40
34
|
var steps = getAllByRole("button");
|
|
41
35
|
expect(steps[1].getAttribute("aria-current")).toBe("step");
|
|
42
36
|
});
|
|
43
37
|
test("Click on step text", function () {
|
|
44
38
|
var onClick = jest.fn();
|
|
45
|
-
|
|
46
39
|
var _render3 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Wizard["default"], {
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
40
|
+
onStepClick: onClick,
|
|
41
|
+
steps: [{
|
|
42
|
+
label: "first-step"
|
|
43
|
+
}]
|
|
44
|
+
})),
|
|
45
|
+
getByText = _render3.getByText;
|
|
54
46
|
var step = getByText("first-step");
|
|
55
|
-
|
|
56
47
|
_react2.fireEvent.click(step);
|
|
57
|
-
|
|
58
48
|
expect(onClick).toHaveBeenCalled();
|
|
59
49
|
});
|
|
60
50
|
test("Click on step description", function () {
|
|
61
51
|
var onClick = jest.fn();
|
|
62
|
-
|
|
63
52
|
var _render4 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Wizard["default"], {
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
53
|
+
onStepClick: onClick,
|
|
54
|
+
steps: [{
|
|
55
|
+
label: "first-step",
|
|
56
|
+
description: "step-description"
|
|
57
|
+
}]
|
|
58
|
+
})),
|
|
59
|
+
getByText = _render4.getByText;
|
|
72
60
|
var step = getByText("step-description");
|
|
73
|
-
|
|
74
61
|
_react2.fireEvent.click(step);
|
|
75
|
-
|
|
76
62
|
expect(onClick).toHaveBeenCalled();
|
|
77
63
|
});
|
|
78
64
|
test("Click on step number", function () {
|
|
79
65
|
var onClick = jest.fn();
|
|
80
|
-
|
|
81
66
|
var _render5 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Wizard["default"], {
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
67
|
+
onStepClick: onClick,
|
|
68
|
+
steps: [{
|
|
69
|
+
label: "first-step"
|
|
70
|
+
}]
|
|
71
|
+
})),
|
|
72
|
+
getByText = _render5.getByText;
|
|
89
73
|
var step = getByText("1");
|
|
90
|
-
|
|
91
74
|
_react2.fireEvent.click(step);
|
|
92
|
-
|
|
93
75
|
expect(onClick).toHaveBeenCalled();
|
|
94
76
|
});
|
|
95
77
|
test("Click on disable step", function () {
|
|
96
78
|
var onClick = jest.fn();
|
|
97
|
-
|
|
98
79
|
var _render6 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Wizard["default"], {
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
80
|
+
onStepClick: onClick,
|
|
81
|
+
steps: [{
|
|
82
|
+
label: "first-step"
|
|
83
|
+
}, {
|
|
84
|
+
label: "second-step",
|
|
85
|
+
disabled: true
|
|
86
|
+
}]
|
|
87
|
+
})),
|
|
88
|
+
getByText = _render6.getByText;
|
|
109
89
|
var step = getByText("second-step");
|
|
110
|
-
|
|
111
90
|
_react2.fireEvent.click(step);
|
|
112
|
-
|
|
113
91
|
expect(onClick).toHaveBeenCalledTimes(0);
|
|
114
92
|
});
|
|
115
93
|
test("Controlled wizard function is called", function () {
|
|
116
94
|
var onClick = jest.fn(function (i) {
|
|
117
95
|
return i;
|
|
118
96
|
});
|
|
119
|
-
|
|
120
97
|
var _render7 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Wizard["default"], {
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
98
|
+
currentStep: 0,
|
|
99
|
+
onStepClick: onClick,
|
|
100
|
+
steps: [{
|
|
101
|
+
label: "first-step"
|
|
102
|
+
}, {
|
|
103
|
+
label: "second-step"
|
|
104
|
+
}]
|
|
105
|
+
})),
|
|
106
|
+
getAllByRole = _render7.getAllByRole;
|
|
131
107
|
var steps = getAllByRole("button");
|
|
132
|
-
|
|
133
108
|
_react2.fireEvent.click(steps[1]);
|
|
134
|
-
|
|
135
109
|
_react2.fireEvent.click(steps[0]);
|
|
136
|
-
|
|
137
110
|
expect(onClick).toHaveBeenCalledTimes(2);
|
|
138
111
|
expect(onClick).toHaveBeenNthCalledWith(1, 1);
|
|
139
112
|
expect(onClick).toHaveBeenNthCalledWith(2, 0);
|
package/wizard/types.d.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
type Space = "xxsmall" | "xsmall" | "small" | "medium" | "large" | "xlarge" | "xxlarge";
|
|
3
|
+
type Margin = {
|
|
4
4
|
top?: Space;
|
|
5
5
|
bottom?: Space;
|
|
6
6
|
left?: Space;
|
|
7
7
|
right?: Space;
|
|
8
8
|
};
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
type SVG = React.ReactNode & React.SVGProps<SVGSVGElement>;
|
|
10
|
+
export type StepProps = {
|
|
11
11
|
/**
|
|
12
12
|
* Step label.
|
|
13
13
|
*/
|
|
@@ -29,7 +29,7 @@ declare type Step = {
|
|
|
29
29
|
*/
|
|
30
30
|
valid?: boolean;
|
|
31
31
|
};
|
|
32
|
-
|
|
32
|
+
type Props = {
|
|
33
33
|
/**
|
|
34
34
|
* The wizard can be showed in horizontal or vertical.
|
|
35
35
|
*/
|
|
@@ -46,11 +46,11 @@ declare type Props = {
|
|
|
46
46
|
* This function will be called when the user clicks a step. The step
|
|
47
47
|
* number will be passed as a parameter.
|
|
48
48
|
*/
|
|
49
|
-
onStepClick?: (
|
|
49
|
+
onStepClick?: (currentStep: number) => void;
|
|
50
50
|
/**
|
|
51
51
|
* An array of objects representing the steps.
|
|
52
52
|
*/
|
|
53
|
-
steps:
|
|
53
|
+
steps: StepProps[];
|
|
54
54
|
/**
|
|
55
55
|
* Size of the margin to be applied to the component ('xxsmall' | 'xsmall' | 'small' | 'medium' | 'large' | 'xlarge' | 'xxlarge').
|
|
56
56
|
* You can pass an object with 'top', 'bottom', 'left' and 'right' properties in order to specify different margin sizes.
|
package/ThemeContext.d.ts
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
declare const ThemeContext: React.Context<object>;
|
|
3
|
-
declare type ThemeProviderPropsType = {
|
|
4
|
-
theme?: object;
|
|
5
|
-
advancedTheme?: object;
|
|
6
|
-
children: React.ReactNode;
|
|
7
|
-
};
|
|
8
|
-
declare const ThemeProvider: ({ theme, advancedTheme, children }: ThemeProviderPropsType) => JSX.Element;
|
|
9
|
-
export default ThemeContext;
|
|
10
|
-
export { ThemeProvider };
|