@dxc-technology/halstack-react 0.0.0-ff43881 → 0.0.0-ff5083e
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/HalstackContext.d.ts +12 -0
- package/HalstackContext.js +295 -0
- package/accordion/Accordion.d.ts +1 -1
- package/accordion/Accordion.js +7 -28
- package/accordion/Accordion.stories.tsx +11 -11
- package/accordion/Accordion.test.js +72 -0
- package/accordion/types.d.ts +4 -0
- package/accordion-group/AccordionGroup.d.ts +1 -1
- package/accordion-group/AccordionGroup.js +13 -15
- package/accordion-group/AccordionGroup.stories.tsx +1 -1
- package/accordion-group/AccordionGroup.test.js +151 -0
- package/accordion-group/types.d.ts +4 -0
- package/alert/Alert.js +4 -1
- package/alert/Alert.test.js +92 -0
- package/badge/Badge.d.ts +1 -1
- package/badge/Badge.js +5 -3
- package/badge/types.d.ts +1 -0
- package/bleed/Bleed.js +1 -34
- package/bleed/Bleed.stories.tsx +31 -32
- package/bleed/types.d.ts +25 -1
- package/box/Box.js +22 -32
- package/box/Box.test.js +18 -0
- package/bulleted-list/BulletedList.d.ts +7 -0
- package/bulleted-list/BulletedList.js +120 -0
- package/bulleted-list/BulletedList.stories.tsx +203 -0
- package/bulleted-list/types.d.ts +11 -0
- package/{list → bulleted-list}/types.js +0 -0
- package/button/Button.js +14 -11
- package/button/Button.test.js +35 -0
- package/card/Card.js +24 -27
- package/card/Card.test.js +50 -0
- package/checkbox/Checkbox.d.ts +1 -1
- package/checkbox/Checkbox.js +43 -39
- package/checkbox/Checkbox.stories.tsx +124 -128
- package/checkbox/Checkbox.test.js +78 -0
- package/checkbox/types.d.ts +7 -3
- package/chip/Chip.test.js +56 -0
- package/common/variables.js +197 -322
- package/date-input/DateInput.js +53 -39
- package/date-input/DateInput.stories.tsx +7 -7
- package/date-input/DateInput.test.js +479 -0
- package/date-input/types.d.ts +16 -9
- package/dialog/Dialog.js +4 -32
- package/dialog/Dialog.test.js +40 -0
- package/dropdown/Dropdown.js +13 -17
- package/dropdown/Dropdown.test.js +189 -0
- package/file-input/FileInput.js +9 -6
- package/file-input/FileInput.test.js +457 -0
- package/file-input/FileItem.js +7 -5
- package/footer/Footer.js +15 -88
- package/footer/Footer.test.js +109 -0
- package/header/Header.js +27 -48
- package/header/Header.stories.tsx +46 -36
- package/header/Header.test.js +79 -0
- package/heading/Heading.test.js +186 -0
- package/inset/Inset.js +1 -34
- package/inset/Inset.stories.tsx +32 -32
- package/inset/types.d.ts +25 -1
- package/layout/ApplicationLayout.d.ts +4 -3
- package/layout/ApplicationLayout.js +82 -114
- package/layout/ApplicationLayout.stories.tsx +14 -59
- package/layout/Icons.d.ts +5 -0
- package/layout/Icons.js +13 -2
- package/layout/SidenavContext.d.ts +5 -0
- package/layout/SidenavContext.js +19 -0
- package/layout/types.d.ts +5 -10
- package/link/Link.d.ts +3 -2
- package/link/Link.js +57 -74
- package/link/Link.stories.tsx +87 -52
- package/link/Link.test.js +83 -0
- package/link/types.d.ts +7 -23
- package/main.d.ts +7 -10
- package/main.js +33 -51
- package/number-input/NumberInput.js +11 -18
- package/number-input/NumberInput.stories.tsx +5 -5
- package/number-input/NumberInput.test.js +506 -0
- package/number-input/types.d.ts +17 -10
- package/package.json +6 -5
- package/paginator/Paginator.js +17 -38
- package/paginator/Paginator.test.js +266 -0
- package/paragraph/Paragraph.d.ts +6 -0
- package/paragraph/Paragraph.js +38 -0
- package/paragraph/Paragraph.stories.tsx +44 -0
- package/password-input/PasswordInput.js +7 -4
- package/password-input/PasswordInput.test.js +180 -0
- package/password-input/types.d.ts +14 -11
- package/progress-bar/ProgressBar.js +1 -1
- package/progress-bar/ProgressBar.stories.jsx +11 -11
- package/progress-bar/ProgressBar.test.js +65 -0
- package/quick-nav/QuickNav.d.ts +4 -0
- package/quick-nav/QuickNav.js +112 -0
- package/quick-nav/QuickNav.stories.tsx +237 -0
- package/quick-nav/types.d.ts +21 -0
- package/{radio → quick-nav}/types.js +0 -0
- package/radio-group/Radio.d.ts +1 -1
- package/radio-group/Radio.js +25 -24
- package/radio-group/RadioGroup.js +46 -37
- package/radio-group/RadioGroup.stories.tsx +60 -39
- package/radio-group/RadioGroup.test.js +530 -83
- package/radio-group/types.d.ts +80 -2
- package/resultsetTable/ResultsetTable.test.js +306 -0
- package/row/types.d.ts +18 -0
- package/select/Icons.d.ts +10 -0
- package/select/Icons.js +93 -0
- package/select/Listbox.d.ts +4 -0
- package/select/Listbox.js +152 -0
- package/select/Option.d.ts +4 -0
- package/select/Option.js +110 -0
- package/select/Select.js +109 -327
- package/select/Select.stories.tsx +103 -81
- package/select/Select.test.js +2120 -0
- package/select/types.d.ts +54 -11
- package/sidenav/Sidenav.d.ts +1 -1
- package/sidenav/Sidenav.js +20 -9
- package/sidenav/Sidenav.test.js +56 -0
- package/slider/Slider.d.ts +1 -1
- package/slider/Slider.js +2 -1
- package/slider/Slider.stories.tsx +8 -8
- package/slider/Slider.test.js +150 -0
- package/slider/types.d.ts +4 -0
- package/spinner/Spinner.js +1 -1
- package/spinner/Spinner.test.js +64 -0
- package/stack/types.d.ts +15 -0
- package/switch/Switch.d.ts +1 -1
- package/switch/Switch.js +35 -19
- package/switch/Switch.stories.tsx +14 -14
- package/switch/Switch.test.js +98 -0
- package/switch/types.d.ts +6 -2
- package/table/Table.test.js +26 -0
- package/tabs/Tabs.d.ts +1 -1
- package/tabs/Tabs.js +9 -11
- package/tabs/Tabs.stories.tsx +0 -8
- package/tabs/Tabs.test.js +140 -0
- package/tabs/types.d.ts +4 -0
- package/tabs-nav/NavTabs.d.ts +8 -0
- package/tabs-nav/NavTabs.js +125 -0
- package/tabs-nav/NavTabs.stories.tsx +170 -0
- package/tabs-nav/NavTabs.test.js +82 -0
- package/tabs-nav/Tab.d.ts +4 -0
- package/tabs-nav/Tab.js +132 -0
- package/tabs-nav/types.d.ts +53 -0
- package/tabs-nav/types.js +5 -0
- package/tag/Tag.js +14 -19
- package/tag/Tag.stories.tsx +12 -8
- package/tag/Tag.test.js +60 -0
- package/text-input/Suggestion.d.ts +4 -0
- package/text-input/Suggestion.js +55 -0
- package/text-input/TextInput.js +56 -80
- package/text-input/TextInput.stories.tsx +30 -12
- package/text-input/TextInput.test.js +1712 -0
- package/text-input/types.d.ts +31 -12
- package/textarea/Textarea.js +20 -27
- package/textarea/Textarea.stories.jsx +33 -12
- package/textarea/Textarea.test.js +437 -0
- package/textarea/types.d.ts +18 -11
- package/toggle-group/ToggleGroup.d.ts +1 -1
- package/toggle-group/ToggleGroup.js +5 -4
- package/toggle-group/ToggleGroup.stories.tsx +4 -4
- package/toggle-group/ToggleGroup.test.js +156 -0
- package/toggle-group/types.d.ts +8 -0
- package/typography/Typography.d.ts +4 -0
- package/typography/Typography.js +131 -0
- package/typography/Typography.stories.tsx +175 -0
- package/typography/types.d.ts +18 -0
- package/typography/types.js +5 -0
- package/typography/typographyContextTypes.d.ts +16 -0
- package/typography/typographyContextTypes.js +5 -0
- package/useTheme.js +2 -2
- package/useTranslatedLabels.d.ts +2 -0
- package/useTranslatedLabels.js +20 -0
- package/wizard/Wizard.d.ts +1 -1
- package/wizard/Wizard.js +55 -44
- package/wizard/Wizard.stories.tsx +13 -23
- package/wizard/Wizard.test.js +141 -0
- package/wizard/types.d.ts +6 -2
- package/ThemeContext.d.ts +0 -15
- package/ThemeContext.js +0 -243
- package/V3Select/V3Select.js +0 -455
- package/V3Select/index.d.ts +0 -27
- package/V3Textarea/V3Textarea.js +0 -260
- package/V3Textarea/index.d.ts +0 -27
- package/date/Date.js +0 -373
- package/date/index.d.ts +0 -27
- package/input-text/Icons.js +0 -22
- package/input-text/InputText.js +0 -611
- package/input-text/index.d.ts +0 -36
- 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/radio/Radio.d.ts +0 -4
- package/radio/Radio.js +0 -174
- package/radio/Radio.stories.tsx +0 -192
- package/radio/types.d.ts +0 -54
- package/text/Text.d.ts +0 -7
- package/text/Text.js +0 -30
- package/text/Text.stories.tsx +0 -19
- package/upload/Upload.js +0 -201
- package/upload/buttons-upload/ButtonsUpload.js +0 -111
- package/upload/buttons-upload/Icons.js +0 -40
- package/upload/dragAndDropArea/DragAndDropArea.js +0 -225
- package/upload/dragAndDropArea/Icons.js +0 -39
- package/upload/file-upload/FileToUpload.js +0 -115
- package/upload/file-upload/Icons.js +0 -66
- package/upload/files-upload/FilesToUpload.js +0 -109
- package/upload/index.d.ts +0 -15
- package/upload/transaction/Icons.js +0 -160
- package/upload/transaction/Transaction.js +0 -104
- package/upload/transactions/Transactions.js +0 -94
package/wizard/Wizard.js
CHANGED
|
@@ -9,10 +9,10 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
9
9
|
});
|
|
10
10
|
exports["default"] = void 0;
|
|
11
11
|
|
|
12
|
-
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
|
|
13
|
-
|
|
14
12
|
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
|
|
15
13
|
|
|
14
|
+
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
|
|
15
|
+
|
|
16
16
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
17
17
|
|
|
18
18
|
var _react = _interopRequireWildcard(require("react"));
|
|
@@ -82,8 +82,11 @@ var icons = {
|
|
|
82
82
|
};
|
|
83
83
|
|
|
84
84
|
var DxcWizard = function DxcWizard(_ref) {
|
|
85
|
+
var _ref2;
|
|
86
|
+
|
|
85
87
|
var _ref$mode = _ref.mode,
|
|
86
88
|
mode = _ref$mode === void 0 ? "horizontal" : _ref$mode,
|
|
89
|
+
defaultCurrentStep = _ref.defaultCurrentStep,
|
|
87
90
|
currentStep = _ref.currentStep,
|
|
88
91
|
onStepClick = _ref.onStepClick,
|
|
89
92
|
steps = _ref.steps,
|
|
@@ -91,7 +94,7 @@ var DxcWizard = function DxcWizard(_ref) {
|
|
|
91
94
|
_ref$tabIndex = _ref.tabIndex,
|
|
92
95
|
tabIndex = _ref$tabIndex === void 0 ? 0 : _ref$tabIndex;
|
|
93
96
|
|
|
94
|
-
var _useState = (0, _react.useState)(currentStep
|
|
97
|
+
var _useState = (0, _react.useState)((_ref2 = currentStep !== null && currentStep !== void 0 ? currentStep : defaultCurrentStep) !== null && _ref2 !== void 0 ? _ref2 : 0),
|
|
95
98
|
_useState2 = (0, _slicedToArray2["default"])(_useState, 2),
|
|
96
99
|
innerCurrent = _useState2[0],
|
|
97
100
|
setInnerCurrentStep = _useState2[1];
|
|
@@ -113,48 +116,54 @@ var DxcWizard = function DxcWizard(_ref) {
|
|
|
113
116
|
theme: colorsTheme.wizard
|
|
114
117
|
}, /*#__PURE__*/_react["default"].createElement(StepsContainer, {
|
|
115
118
|
mode: mode,
|
|
116
|
-
margin: margin
|
|
119
|
+
margin: margin,
|
|
120
|
+
role: "group"
|
|
117
121
|
}, steps === null || steps === void 0 ? void 0 : steps.map(function (step, i) {
|
|
118
122
|
return /*#__PURE__*/_react["default"].createElement(StepContainer, {
|
|
119
123
|
key: "step".concat(i),
|
|
120
124
|
mode: mode,
|
|
121
125
|
lastStep: i === (steps === null || steps === void 0 ? void 0 : steps.length) - 1
|
|
122
126
|
}, /*#__PURE__*/_react["default"].createElement(Step, {
|
|
123
|
-
tabIndex: tabIndex,
|
|
124
127
|
onClick: function onClick() {
|
|
125
|
-
|
|
128
|
+
handleStepClick(i);
|
|
126
129
|
},
|
|
127
|
-
mode: mode,
|
|
128
130
|
disabled: step.disabled,
|
|
131
|
+
mode: mode,
|
|
129
132
|
first: i === 0,
|
|
130
|
-
last: i === (steps === null || steps === void 0 ? void 0 : steps.length) - 1
|
|
131
|
-
|
|
133
|
+
last: i === (steps === null || steps === void 0 ? void 0 : steps.length) - 1,
|
|
134
|
+
"aria-current": renderedCurrent === i ? "step" : "false",
|
|
135
|
+
tabIndex: tabIndex
|
|
136
|
+
}, /*#__PURE__*/_react["default"].createElement(StepHeader, {
|
|
137
|
+
validityIcon: step.valid !== undefined
|
|
138
|
+
}, /*#__PURE__*/_react["default"].createElement(IconContainer, {
|
|
132
139
|
current: i === renderedCurrent,
|
|
133
140
|
visited: i < renderedCurrent,
|
|
134
141
|
disabled: step.disabled
|
|
135
|
-
}, step.icon ?
|
|
136
|
-
src: step.icon
|
|
137
|
-
}) : /*#__PURE__*/_react["default"].createElement(StepIconContainer, {
|
|
142
|
+
}, step.icon ? /*#__PURE__*/_react["default"].createElement(StepIconContainer, {
|
|
138
143
|
disabled: step.disabled
|
|
139
|
-
},
|
|
144
|
+
}, typeof step.icon === "string" ? /*#__PURE__*/_react["default"].createElement(Icon, {
|
|
145
|
+
src: step.icon
|
|
146
|
+
}) : step.icon) : /*#__PURE__*/_react["default"].createElement(Number, {
|
|
140
147
|
disabled: step.disabled,
|
|
141
148
|
current: i === renderedCurrent
|
|
142
|
-
}, i + 1)), step.valid !== undefined
|
|
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, {
|
|
150
|
+
current: i === renderedCurrent,
|
|
143
151
|
disabled: step.disabled,
|
|
144
152
|
visited: i <= innerCurrent
|
|
145
|
-
}, step.label)
|
|
153
|
+
}, step.label), step.description && /*#__PURE__*/_react["default"].createElement(Description, {
|
|
154
|
+
current: i === renderedCurrent,
|
|
146
155
|
disabled: step.disabled,
|
|
147
156
|
visited: i <= innerCurrent
|
|
148
|
-
}, step.description)
|
|
157
|
+
}, step.description))), i === steps.length - 1 ? "" : /*#__PURE__*/_react["default"].createElement(StepSeparator, {
|
|
149
158
|
mode: mode
|
|
150
159
|
}));
|
|
151
160
|
})));
|
|
152
161
|
};
|
|
153
162
|
|
|
154
|
-
var StepsContainer = _styledComponents["default"].div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["\n display:
|
|
163
|
+
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) {
|
|
155
164
|
return props.mode === "vertical" ? "column" : "row";
|
|
156
165
|
}, function (props) {
|
|
157
|
-
return props.mode === "vertical"
|
|
166
|
+
return props.mode === "vertical" && "height: 500px";
|
|
158
167
|
}, function (props) {
|
|
159
168
|
return props.theme.fontFamily;
|
|
160
169
|
}, function (props) {
|
|
@@ -189,42 +198,44 @@ var Step = _styledComponents["default"].button(_templateObject3 || (_templateObj
|
|
|
189
198
|
return props.theme.focusColor;
|
|
190
199
|
});
|
|
191
200
|
|
|
192
|
-
var StepHeader = _styledComponents["default"].div(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2["default"])(["\n position: relative;\n display: inline-flex;\n
|
|
201
|
+
var StepHeader = _styledComponents["default"].div(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2["default"])(["\n position: relative;\n display: inline-flex;\n ", "\n"])), function (props) {
|
|
202
|
+
return props.validityIcon && "padding-bottom: 4px;";
|
|
203
|
+
});
|
|
193
204
|
|
|
194
|
-
var IconContainer = _styledComponents["default"].div(_templateObject5 || (_templateObject5 = (0, _taggedTemplateLiteral2["default"])(["\n width: ", ";\n height: ", ";\n\n ", "\n ", ";\n\n border-radius: ", ";\n display: flex;\n justify-content: center;\n align-items: center;\n"])), function (props) {
|
|
195
|
-
return props.disabled ? props.theme.
|
|
205
|
+
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) {
|
|
206
|
+
return props.disabled ? props.theme.disabledStepWidth : props.current ? props.theme.selectedStepWidth : props.theme.stepWidth;
|
|
196
207
|
}, function (props) {
|
|
197
|
-
return props.disabled ? props.theme.
|
|
208
|
+
return props.disabled ? props.theme.disabledStepHeight : props.current ? props.theme.selectedStepHeight : props.theme.stepHeight;
|
|
198
209
|
}, function (props) {
|
|
199
|
-
return "\n ".concat(
|
|
210
|
+
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 ");
|
|
200
211
|
}, function (props) {
|
|
201
|
-
return props.disabled ? "color: ".concat(props.theme.
|
|
212
|
+
return props.disabled ? "color: ".concat(props.theme.disabledStepFontColor, ";") : "color: ".concat(props.current ? props.theme.selectedStepFontColor : !props.visited ? props.theme.unvisitedStepFontColor : props.theme.visitedStepFontColor, ";");
|
|
202
213
|
}, function (props) {
|
|
203
|
-
return !props.current && !props.disabled ? props.theme.
|
|
214
|
+
return !props.current && !props.disabled ? props.theme.stepBorderRadius : props.current ? props.theme.selectedStepBorderRadius : props.disabled ? props.theme.disabledStepBorderRadius : "";
|
|
204
215
|
});
|
|
205
216
|
|
|
206
217
|
var Icon = _styledComponents["default"].img(_templateObject6 || (_templateObject6 = (0, _taggedTemplateLiteral2["default"])(["\n width: ", ";\n height: ", ";\n"])), function (props) {
|
|
207
|
-
return props.theme.
|
|
218
|
+
return props.theme.stepIconSize;
|
|
208
219
|
}, function (props) {
|
|
209
|
-
return props.theme.
|
|
220
|
+
return props.theme.stepIconSize;
|
|
210
221
|
});
|
|
211
222
|
|
|
212
223
|
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) {
|
|
213
|
-
return props.theme.
|
|
224
|
+
return props.theme.stepIconSize;
|
|
214
225
|
}, function (props) {
|
|
215
|
-
return props.theme.
|
|
226
|
+
return props.theme.stepIconSize;
|
|
216
227
|
});
|
|
217
228
|
|
|
218
229
|
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) {
|
|
219
|
-
return props.theme.
|
|
230
|
+
return props.theme.stepFontSize;
|
|
220
231
|
}, function (props) {
|
|
221
|
-
return props.theme.
|
|
232
|
+
return props.theme.stepFontFamily;
|
|
222
233
|
}, function (props) {
|
|
223
|
-
return props.theme.
|
|
234
|
+
return props.theme.stepFontStyle;
|
|
224
235
|
}, function (props) {
|
|
225
|
-
return props.theme.
|
|
236
|
+
return props.theme.stepFontWeight;
|
|
226
237
|
}, function (props) {
|
|
227
|
-
return props.theme.
|
|
238
|
+
return props.theme.stepFontTracking;
|
|
228
239
|
});
|
|
229
240
|
|
|
230
241
|
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"])));
|
|
@@ -242,29 +253,29 @@ var Label = _styledComponents["default"].p(_templateObject11 || (_templateObject
|
|
|
242
253
|
}, function (props) {
|
|
243
254
|
return props.theme.labelFontWeight;
|
|
244
255
|
}, function (props) {
|
|
245
|
-
return props.theme.
|
|
256
|
+
return props.theme.labelFontTracking;
|
|
246
257
|
}, function (props) {
|
|
247
|
-
return props.disabled ? "color: ".concat(props.theme.
|
|
258
|
+
return props.disabled ? "color: ".concat(props.theme.disabledLabelFontColor, ";") : "color: ".concat(!props.visited ? props.theme.unvisitedLabelFontColor : props.current ? props.theme.selectedLabelFontColor : props.theme.visitedLabelFontColor, ";");
|
|
248
259
|
}, function (props) {
|
|
249
260
|
return props.theme.labelFontTextTransform;
|
|
250
261
|
});
|
|
251
262
|
|
|
252
263
|
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) {
|
|
253
|
-
return props.theme.
|
|
264
|
+
return props.theme.helperTextTextAlign;
|
|
254
265
|
}, function (props) {
|
|
255
|
-
return props.theme.
|
|
266
|
+
return props.theme.helperTextFontFamily;
|
|
256
267
|
}, function (props) {
|
|
257
|
-
return props.theme.
|
|
268
|
+
return props.theme.helperTextFontSize;
|
|
258
269
|
}, function (props) {
|
|
259
|
-
return props.theme.
|
|
270
|
+
return props.theme.helperTextFontStyle;
|
|
260
271
|
}, function (props) {
|
|
261
|
-
return props.theme.
|
|
272
|
+
return props.theme.helperTextFontWeight;
|
|
262
273
|
}, function (props) {
|
|
263
|
-
return props.theme.
|
|
274
|
+
return props.theme.helperTextFontTracking;
|
|
264
275
|
}, function (props) {
|
|
265
|
-
return props.theme.
|
|
276
|
+
return props.theme.helperTextFontTextTransform;
|
|
266
277
|
}, function (props) {
|
|
267
|
-
return props.disabled ? "color: ".concat(props.theme.
|
|
278
|
+
return props.disabled ? "color: ".concat(props.theme.disabledHelperTextFontColor, ";") : "color: ".concat(!props.visited ? props.theme.unvisitedHelperTextFontColor : props.current ? props.theme.selectedHelperTextFontColor : props.theme.visitedHelperTextFontColor, ";");
|
|
268
279
|
});
|
|
269
280
|
|
|
270
281
|
var StepSeparator = _styledComponents["default"].div(_templateObject13 || (_templateObject13 = (0, _taggedTemplateLiteral2["default"])(["\n width: ", ";\n height: ", ";\n ", "\n border: ", ";\n opacity: 1;\n flex-grow: 1;\n"])), function (props) {
|
|
@@ -9,23 +9,18 @@ export default {
|
|
|
9
9
|
component: DxcWizard,
|
|
10
10
|
};
|
|
11
11
|
|
|
12
|
-
const favoriteSVG = (
|
|
13
|
-
|
|
14
|
-
<
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
<path d="M0 0h24v24H0z" fill="none" />
|
|
25
|
-
<path d="M10 20v-6h4v6h5v-8h3L12 3 2 12h3v8z" />
|
|
26
|
-
</svg>
|
|
27
|
-
);
|
|
28
|
-
};
|
|
12
|
+
const favoriteSVG = (
|
|
13
|
+
<svg viewBox="0 0 24 24" fill="currentColor">
|
|
14
|
+
<path d="M0 0h24v24H0z" fill="none" />
|
|
15
|
+
<path d="M12 21.35l-1.45-1.32C5.4 15.36 2 12.28 2 8.5 2 5.42 4.42 3 7.5 3c1.74 0 3.41.81 4.5 2.09C13.09 3.81 14.76 3 16.5 3 19.58 3 22 5.42 22 8.5c0 3.78-3.4 6.86-8.55 11.54L12 21.35z" />
|
|
16
|
+
</svg>
|
|
17
|
+
);
|
|
18
|
+
const largeIcon = (
|
|
19
|
+
<svg xmlns="http://www.w3.org/2000/svg" height="48px" viewBox="0 0 24 24" width="48px" fill="currentColor">
|
|
20
|
+
<path d="M0 0h24v24H0z" fill="none" />
|
|
21
|
+
<path d="M10 20v-6h4v6h5v-8h3L12 3 2 12h3v8z" />
|
|
22
|
+
</svg>
|
|
23
|
+
);
|
|
29
24
|
|
|
30
25
|
const stepWithLabel = [
|
|
31
26
|
{
|
|
@@ -41,7 +36,6 @@ const stepWithLabel = [
|
|
|
41
36
|
label: "Forth step",
|
|
42
37
|
},
|
|
43
38
|
];
|
|
44
|
-
|
|
45
39
|
const stepWithLabelDescription = [
|
|
46
40
|
{
|
|
47
41
|
label: "First step",
|
|
@@ -62,7 +56,6 @@ const stepWithLabelDescription = [
|
|
|
62
56
|
valid: false,
|
|
63
57
|
},
|
|
64
58
|
];
|
|
65
|
-
|
|
66
59
|
const stepWithLongDescription = [
|
|
67
60
|
{
|
|
68
61
|
label: "First step",
|
|
@@ -80,7 +73,6 @@ const stepWithLongDescription = [
|
|
|
80
73
|
"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. ",
|
|
81
74
|
},
|
|
82
75
|
];
|
|
83
|
-
|
|
84
76
|
const stepDisabled = [
|
|
85
77
|
{
|
|
86
78
|
label: "First step",
|
|
@@ -106,7 +98,6 @@ const stepDisabled = [
|
|
|
106
98
|
disabled: true,
|
|
107
99
|
},
|
|
108
100
|
];
|
|
109
|
-
|
|
110
101
|
const stepIcons = [
|
|
111
102
|
{
|
|
112
103
|
label: "First step",
|
|
@@ -121,7 +112,6 @@ const stepIcons = [
|
|
|
121
112
|
icon: favoriteSVG,
|
|
122
113
|
},
|
|
123
114
|
];
|
|
124
|
-
|
|
125
115
|
const stepLargeIcons = [
|
|
126
116
|
{
|
|
127
117
|
label: "First step",
|
|
@@ -141,7 +131,7 @@ export const Chromatic = () => (
|
|
|
141
131
|
<>
|
|
142
132
|
<ExampleContainer>
|
|
143
133
|
<Title title="Current step in the third step, labels and description" theme="light" level={4} />
|
|
144
|
-
<DxcWizard
|
|
134
|
+
<DxcWizard defaultCurrentStep={2} steps={stepWithLabelDescription}></DxcWizard>
|
|
145
135
|
<Title title="With long description in horizontal" theme="light" level={4} />
|
|
146
136
|
<DxcWizard steps={stepWithLongDescription}></DxcWizard>
|
|
147
137
|
<Title title="With long description in vertical" theme="light" level={4} />
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
var _react = _interopRequireDefault(require("react"));
|
|
6
|
+
|
|
7
|
+
var _react2 = require("@testing-library/react");
|
|
8
|
+
|
|
9
|
+
var _Wizard = _interopRequireDefault(require("./Wizard"));
|
|
10
|
+
|
|
11
|
+
describe("Wizard components tests", function () {
|
|
12
|
+
test("Wizard renders with correct steps", function () {
|
|
13
|
+
var _render = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Wizard["default"], {
|
|
14
|
+
steps: [{
|
|
15
|
+
label: "first-step"
|
|
16
|
+
}, {
|
|
17
|
+
label: "second-step"
|
|
18
|
+
}]
|
|
19
|
+
})),
|
|
20
|
+
getByText = _render.getByText,
|
|
21
|
+
getAllByRole = _render.getAllByRole;
|
|
22
|
+
|
|
23
|
+
var steps = getAllByRole("button");
|
|
24
|
+
expect(getByText("first-step")).toBeTruthy();
|
|
25
|
+
expect(getByText("second-step")).toBeTruthy();
|
|
26
|
+
expect(steps[0].getAttribute("aria-current")).toBe("step");
|
|
27
|
+
expect(steps[1].getAttribute("aria-current")).toBe("false");
|
|
28
|
+
});
|
|
29
|
+
test("Wizard renders with initially selected step", function () {
|
|
30
|
+
var _render2 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Wizard["default"], {
|
|
31
|
+
defaultCurrentStep: 1,
|
|
32
|
+
steps: [{
|
|
33
|
+
label: "first-step"
|
|
34
|
+
}, {
|
|
35
|
+
label: "second-step"
|
|
36
|
+
}]
|
|
37
|
+
})),
|
|
38
|
+
getAllByRole = _render2.getAllByRole;
|
|
39
|
+
|
|
40
|
+
var steps = getAllByRole("button");
|
|
41
|
+
expect(steps[1].getAttribute("aria-current")).toBe("step");
|
|
42
|
+
});
|
|
43
|
+
test("Click on step text", function () {
|
|
44
|
+
var onClick = jest.fn();
|
|
45
|
+
|
|
46
|
+
var _render3 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Wizard["default"], {
|
|
47
|
+
onStepClick: onClick,
|
|
48
|
+
steps: [{
|
|
49
|
+
label: "first-step"
|
|
50
|
+
}]
|
|
51
|
+
})),
|
|
52
|
+
getByText = _render3.getByText;
|
|
53
|
+
|
|
54
|
+
var step = getByText("first-step");
|
|
55
|
+
|
|
56
|
+
_react2.fireEvent.click(step);
|
|
57
|
+
|
|
58
|
+
expect(onClick).toHaveBeenCalled();
|
|
59
|
+
});
|
|
60
|
+
test("Click on step description", function () {
|
|
61
|
+
var onClick = jest.fn();
|
|
62
|
+
|
|
63
|
+
var _render4 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Wizard["default"], {
|
|
64
|
+
onStepClick: onClick,
|
|
65
|
+
steps: [{
|
|
66
|
+
label: "first-step",
|
|
67
|
+
description: "step-description"
|
|
68
|
+
}]
|
|
69
|
+
})),
|
|
70
|
+
getByText = _render4.getByText;
|
|
71
|
+
|
|
72
|
+
var step = getByText("step-description");
|
|
73
|
+
|
|
74
|
+
_react2.fireEvent.click(step);
|
|
75
|
+
|
|
76
|
+
expect(onClick).toHaveBeenCalled();
|
|
77
|
+
});
|
|
78
|
+
test("Click on step number", function () {
|
|
79
|
+
var onClick = jest.fn();
|
|
80
|
+
|
|
81
|
+
var _render5 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Wizard["default"], {
|
|
82
|
+
onStepClick: onClick,
|
|
83
|
+
steps: [{
|
|
84
|
+
label: "first-step"
|
|
85
|
+
}]
|
|
86
|
+
})),
|
|
87
|
+
getByText = _render5.getByText;
|
|
88
|
+
|
|
89
|
+
var step = getByText("1");
|
|
90
|
+
|
|
91
|
+
_react2.fireEvent.click(step);
|
|
92
|
+
|
|
93
|
+
expect(onClick).toHaveBeenCalled();
|
|
94
|
+
});
|
|
95
|
+
test("Click on disable step", function () {
|
|
96
|
+
var onClick = jest.fn();
|
|
97
|
+
|
|
98
|
+
var _render6 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Wizard["default"], {
|
|
99
|
+
onStepClick: onClick,
|
|
100
|
+
steps: [{
|
|
101
|
+
label: "first-step"
|
|
102
|
+
}, {
|
|
103
|
+
label: "second-step",
|
|
104
|
+
disabled: true
|
|
105
|
+
}]
|
|
106
|
+
})),
|
|
107
|
+
getByText = _render6.getByText;
|
|
108
|
+
|
|
109
|
+
var step = getByText("second-step");
|
|
110
|
+
|
|
111
|
+
_react2.fireEvent.click(step);
|
|
112
|
+
|
|
113
|
+
expect(onClick).toHaveBeenCalledTimes(0);
|
|
114
|
+
});
|
|
115
|
+
test("Controlled wizard function is called", function () {
|
|
116
|
+
var onClick = jest.fn(function (i) {
|
|
117
|
+
return i;
|
|
118
|
+
});
|
|
119
|
+
|
|
120
|
+
var _render7 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Wizard["default"], {
|
|
121
|
+
currentStep: 0,
|
|
122
|
+
onStepClick: onClick,
|
|
123
|
+
steps: [{
|
|
124
|
+
label: "first-step"
|
|
125
|
+
}, {
|
|
126
|
+
label: "second-step"
|
|
127
|
+
}]
|
|
128
|
+
})),
|
|
129
|
+
getAllByRole = _render7.getAllByRole;
|
|
130
|
+
|
|
131
|
+
var steps = getAllByRole("button");
|
|
132
|
+
|
|
133
|
+
_react2.fireEvent.click(steps[1]);
|
|
134
|
+
|
|
135
|
+
_react2.fireEvent.click(steps[0]);
|
|
136
|
+
|
|
137
|
+
expect(onClick).toHaveBeenCalledTimes(2);
|
|
138
|
+
expect(onClick).toHaveBeenNthCalledWith(1, 1);
|
|
139
|
+
expect(onClick).toHaveBeenNthCalledWith(2, 0);
|
|
140
|
+
});
|
|
141
|
+
});
|
package/wizard/types.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ declare type Margin = {
|
|
|
6
6
|
left?: Space;
|
|
7
7
|
right?: Space;
|
|
8
8
|
};
|
|
9
|
-
declare type SVG = React.SVGProps<SVGSVGElement
|
|
9
|
+
declare type SVG = React.SVGProps<SVGSVGElement>;
|
|
10
10
|
declare type Step = {
|
|
11
11
|
/**
|
|
12
12
|
* Step label.
|
|
@@ -35,7 +35,11 @@ declare type Props = {
|
|
|
35
35
|
*/
|
|
36
36
|
mode?: "horizontal" | "vertical";
|
|
37
37
|
/**
|
|
38
|
-
*
|
|
38
|
+
* Initially selected step, only when it is uncontrolled.
|
|
39
|
+
*/
|
|
40
|
+
defaultCurrentStep?: number;
|
|
41
|
+
/**
|
|
42
|
+
* Defines which step is marked as the current. The numeration starts at 0.
|
|
39
43
|
*/
|
|
40
44
|
currentStep?: number;
|
|
41
45
|
/**
|
package/ThemeContext.d.ts
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
declare const ThemeContext: React.Context<object>;
|
|
3
|
-
declare type ThemeProviderCommonProps = {
|
|
4
|
-
children: React.ReactNode;
|
|
5
|
-
};
|
|
6
|
-
declare type ThemeProviderDefaultTheme = ThemeProviderCommonProps & {
|
|
7
|
-
theme: object;
|
|
8
|
-
};
|
|
9
|
-
declare type ThemeProviderAdvancedTheme = ThemeProviderCommonProps & {
|
|
10
|
-
advancedTheme: object;
|
|
11
|
-
};
|
|
12
|
-
declare type ThemeProviderPropsType = ThemeProviderDefaultTheme | ThemeProviderAdvancedTheme;
|
|
13
|
-
declare const ThemeProvider: (props: ThemeProviderPropsType) => JSX.Element;
|
|
14
|
-
export default ThemeContext;
|
|
15
|
-
export { ThemeProvider };
|