@semcore/wizard 16.1.10-prerelease.6 → 16.2.0-prerelease.0
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/CHANGELOG.md +12 -0
- package/lib/cjs/Wizard.js +66 -51
- package/lib/cjs/Wizard.js.map +1 -1
- package/lib/cjs/Wizard.types.js +2 -0
- package/lib/cjs/Wizard.types.js.map +1 -0
- package/lib/cjs/index.js.map +1 -1
- package/lib/cjs/style/wizard.shadow.css +1 -1
- package/lib/es6/Wizard.js +66 -51
- package/lib/es6/Wizard.js.map +1 -1
- package/lib/es6/Wizard.types.js +2 -0
- package/lib/es6/Wizard.types.js.map +1 -0
- package/lib/es6/index.js.map +1 -1
- package/lib/es6/style/wizard.shadow.css +1 -1
- package/lib/esm/Wizard.mjs +70 -50
- package/lib/esm/style/wizard.shadow.css +1 -1
- package/lib/types/Wizard.d.ts +6 -0
- package/lib/types/Wizard.types.d.ts +135 -0
- package/lib/types/index.d.ts +3 -113
- package/lib/types/translations/__intergalactic-dynamic-locales.d.ts +72 -0
- package/package.json +9 -9
- package/src/{Wizard.jsx → Wizard.tsx} +89 -49
- package/src/{index.d.ts → Wizard.types.ts} +64 -19
- package/src/{index.js → index.ts} +2 -0
- package/src/style/wizard.shadow.css +1 -1
- package/lib/cjs/index.d.js +0 -2
- package/lib/cjs/index.d.js.map +0 -1
- package/lib/es6/index.d.js +0 -2
- package/lib/es6/index.d.js.map +0 -1
package/lib/esm/Wizard.mjs
CHANGED
|
@@ -23,23 +23,23 @@ var style = (
|
|
|
23
23
|
/*__reshadow_css_start__*/
|
|
24
24
|
(sstyled.insert(
|
|
25
25
|
/*__inner_css_start__*/
|
|
26
|
-
".
|
|
26
|
+
".___SWizard_1ihdz_gg_{max-width:980px;max-height:700px;display:flex;padding:0;background:0 0}.___SSidebar_1ihdz_gg_{background:var(--intergalactic-control-primary-advertising, #5925ab);color:var(--intergalactic-text-primary-invert, #ffffff);font-weight:var(--intergalactic-bold, 700);font-size:var(--intergalactic-fs-300, 16px);line-height:var(--intergalactic-lh-300, 150%);padding:var(--intergalactic-spacing-10x, 40px) var(--intergalactic-spacing-2x, 8px);max-width:220px;flex-shrink:0;box-sizing:border-box;border-radius:var(--intergalactic-modal-rounded, 12px)0 0 var(--intergalactic-modal-rounded, 12px)}@media (max-width:1060px){.___SSidebar_1ihdz_gg_{width:56px}}.___SSidebar_1ihdz_gg_ .___SStepper_1ihdz_gg_{display:flex;gap:var(--intergalactic-spacing-1x, 4px);font-size:var(--intergalactic-fs-200, 14px);border-radius:var(--intergalactic-control-rounded, 6px);padding:var(--intergalactic-spacing-2x, 8px) var(--intergalactic-spacing-3x, 12px);cursor:pointer;position:relative;overflow:auto;line-height:var(--intergalactic-lh-200, 142%)}.___SSidebar_1ihdz_gg_ .___SStepper_1ihdz_gg_:focus-visible{outline-color:var(--intergalactic-keyboard-focus-invert-outline, rgba(255, 255, 255, 0.8))}@media (hover:hover){.___SSidebar_1ihdz_gg_ .___SStepper_1ihdz_gg_:hover{background:var(--intergalactic-control-primary-advertising-hover, #421983);z-index:2}}.___SSidebar_1ihdz_gg_ .___SStepper_1ihdz_gg_.__active_1ihdz_gg_{background:var(--intergalactic-control-primary-advertising-active, #8649e1)}.___SSidebar_1ihdz_gg_ .___SStepper_1ihdz_gg_.__disabled_1ihdz_gg_,.___SSidebar_1ihdz_gg_ .___SStepper_1ihdz_gg_:disabled{opacity:var(--intergalactic-disabled-opacity, 0.3);cursor:default;pointer-events:none}@media (max-width:1060px){.___SSidebar_1ihdz_gg_ .___SStepper_1ihdz_gg_{padding:var(--intergalactic-spacing-2x, 8px)}@media (hover:hover){.___SSidebar_1ihdz_gg_ .___SStepper_1ihdz_gg_:hover{width:-moz-fit-content;width:fit-content;max-width:220px}.___SSidebar_1ihdz_gg_ .___SStepper_1ihdz_gg_:hover .___SStepDescription_1ihdz_gg_{display:block;border-radius:var(--intergalactic-control-rounded, 6px);white-space:nowrap;overflow:auto}.___SSidebar_1ihdz_gg_ .___SStepper_1ihdz_gg_.__active_1ihdz_gg_:hover .___SStepDescription_1ihdz_gg_{background:var(--intergalactic-control-primary-advertising-active, #8649e1)}}}.___SSidebarHeader_1ihdz_gg_{font-size:var(--intergalactic-fs-300, 16px);margin:0 var(--intergalactic-spacing-5x, 20px) var(--intergalactic-spacing-4x, 16px)}@media (max-width:1060px){.___SSidebarHeader_1ihdz_gg_{display:none}}.___SStepNumber_1ihdz_gg_{display:inline-block;min-width:20px;text-align:center}.___SCompleted_1ihdz_gg_{margin-top:1px}@media (max-width:1060px){.___SStepDescription_1ihdz_gg_{display:none}}.___SContent_1ihdz_gg_{padding:var(--intergalactic-spacing-10x, 40px);width:100%;border-radius:0 var(--intergalactic-modal-rounded, 12px) var(--intergalactic-modal-rounded, 12px)0;background:var(--intergalactic-bg-primary-neutral, #ffffff)}.___SContent_1ihdz_gg_.__noSidebar_1ihdz_gg_{border-radius:var(--intergalactic-modal-rounded, 12px)}.___SSidebarMenu_1ihdz_gg_{display:contents}",
|
|
27
27
|
/*__inner_css_end__*/
|
|
28
|
-
"
|
|
28
|
+
"1ihdz_gg_"
|
|
29
29
|
), /*__reshadow_css_end__*/
|
|
30
30
|
{
|
|
31
|
-
"__SWizard": "
|
|
32
|
-
"__SStepNumber": "
|
|
33
|
-
"__SCompleted": "
|
|
34
|
-
"__SContent": "
|
|
35
|
-
"_noSidebar": "
|
|
36
|
-
"__SSidebarMenu": "
|
|
37
|
-
"__SSidebar": "
|
|
38
|
-
"__SStepper": "
|
|
39
|
-
"_active": "
|
|
40
|
-
"_disabled": "
|
|
41
|
-
"__SStepDescription": "
|
|
42
|
-
"__SSidebarHeader": "
|
|
31
|
+
"__SWizard": "___SWizard_1ihdz_gg_",
|
|
32
|
+
"__SStepNumber": "___SStepNumber_1ihdz_gg_",
|
|
33
|
+
"__SCompleted": "___SCompleted_1ihdz_gg_",
|
|
34
|
+
"__SContent": "___SContent_1ihdz_gg_",
|
|
35
|
+
"_noSidebar": "__noSidebar_1ihdz_gg_",
|
|
36
|
+
"__SSidebarMenu": "___SSidebarMenu_1ihdz_gg_",
|
|
37
|
+
"__SSidebar": "___SSidebar_1ihdz_gg_",
|
|
38
|
+
"__SStepper": "___SStepper_1ihdz_gg_",
|
|
39
|
+
"_active": "__active_1ihdz_gg_",
|
|
40
|
+
"_disabled": "__disabled_1ihdz_gg_",
|
|
41
|
+
"__SStepDescription": "___SStepDescription_1ihdz_gg_",
|
|
42
|
+
"__SSidebarHeader": "___SSidebarHeader_1ihdz_gg_"
|
|
43
43
|
})
|
|
44
44
|
);
|
|
45
45
|
var WizardRoot = /* @__PURE__ */ (function(_Component) {
|
|
@@ -87,32 +87,52 @@ var WizardRoot = /* @__PURE__ */ (function(_Component) {
|
|
|
87
87
|
}
|
|
88
88
|
_inherits(WizardRoot2, _Component);
|
|
89
89
|
return _createClass(WizardRoot2, [{
|
|
90
|
+
key: "getStepId",
|
|
91
|
+
value: function getStepId(step) {
|
|
92
|
+
return "".concat(this.asProps.uid, "-step-").concat(step);
|
|
93
|
+
}
|
|
94
|
+
}, {
|
|
95
|
+
key: "getId",
|
|
96
|
+
value: function getId() {
|
|
97
|
+
return "".concat(this.asProps.uid, "-title");
|
|
98
|
+
}
|
|
99
|
+
}, {
|
|
100
|
+
key: "getStepperId",
|
|
101
|
+
value: function getStepperId(step) {
|
|
102
|
+
var uid = this.asProps.uid;
|
|
103
|
+
return "".concat(uid, "-stepper-").concat(step);
|
|
104
|
+
}
|
|
105
|
+
}, {
|
|
106
|
+
key: "getContentId",
|
|
107
|
+
value: function getContentId(step) {
|
|
108
|
+
var uid = this.asProps.uid;
|
|
109
|
+
return "".concat(uid, "-content-").concat(step);
|
|
110
|
+
}
|
|
111
|
+
}, {
|
|
90
112
|
key: "getStepProps",
|
|
91
113
|
value: function getStepProps(props) {
|
|
92
114
|
return {
|
|
93
115
|
steps: this._steps,
|
|
94
116
|
active: props.step === this.asProps.step,
|
|
95
|
-
id:
|
|
117
|
+
id: this.getStepId(props.step)
|
|
96
118
|
};
|
|
97
119
|
}
|
|
98
120
|
}, {
|
|
99
121
|
key: "getSidebarProps",
|
|
100
122
|
value: function getSidebarProps() {
|
|
101
123
|
return {
|
|
102
|
-
|
|
124
|
+
id: this.getId()
|
|
103
125
|
};
|
|
104
126
|
}
|
|
105
127
|
}, {
|
|
106
128
|
key: "getContentProps",
|
|
107
129
|
value: function getContentProps() {
|
|
108
|
-
var
|
|
109
|
-
var Sidebar2 = findComponent(Children, ["Wizard.Sidebar"]);
|
|
110
|
-
return {
|
|
111
|
-
uid: this.asProps.uid,
|
|
112
|
-
step: this.asProps.step,
|
|
130
|
+
var _this$asProps = this.asProps, Children = _this$asProps.Children, step = _this$asProps.step;
|
|
131
|
+
var Sidebar2 = findComponent(Children, ["Wizard.Sidebar"], true);
|
|
132
|
+
return _defineProperty(_defineProperty({
|
|
113
133
|
ref: this.contentRef,
|
|
114
134
|
noSidebar: !Sidebar2
|
|
115
|
-
};
|
|
135
|
+
}, "aria-labelledby", this.getStepperId(step)), "id", this.getContentId(step));
|
|
116
136
|
}
|
|
117
137
|
}, {
|
|
118
138
|
key: "getStepBackProps",
|
|
@@ -147,15 +167,19 @@ var WizardRoot = /* @__PURE__ */ (function(_Component) {
|
|
|
147
167
|
var highlighted = this.state.highlighted === props.step || this.state.highlighted === null && i === 0;
|
|
148
168
|
return {
|
|
149
169
|
active,
|
|
150
|
-
tabIndex: highlighted ? 0 : -1,
|
|
170
|
+
"tabIndex": highlighted ? 0 : -1,
|
|
151
171
|
number,
|
|
152
|
-
getI18nText: this.asProps.getI18nText,
|
|
153
|
-
uid: this.asProps.uid,
|
|
154
|
-
ref: function ref(node) {
|
|
172
|
+
"getI18nText": this.asProps.getI18nText,
|
|
173
|
+
"uid": this.asProps.uid,
|
|
174
|
+
"ref": function ref(node) {
|
|
155
175
|
_this2.stepperRefs[i] = node;
|
|
156
176
|
},
|
|
157
|
-
focusNext: this.stepperFocusNext(i),
|
|
158
|
-
focusPrev: this.stepperFocusPrev(i)
|
|
177
|
+
"focusNext": this.stepperFocusNext(i),
|
|
178
|
+
"focusPrev": this.stepperFocusPrev(i),
|
|
179
|
+
"id": this.getStepperId(props.step),
|
|
180
|
+
"aria-controls": active ? this.getContentId(props.step) : void 0,
|
|
181
|
+
"aria-disabled": props.disabled,
|
|
182
|
+
"aria-selected": active
|
|
159
183
|
};
|
|
160
184
|
}
|
|
161
185
|
}, {
|
|
@@ -168,7 +192,9 @@ var WizardRoot = /* @__PURE__ */ (function(_Component) {
|
|
|
168
192
|
});
|
|
169
193
|
setTimeout(function() {
|
|
170
194
|
if (prevProps.step === _this3.asProps.step) return;
|
|
171
|
-
|
|
195
|
+
if (_this3.contentRef.current) {
|
|
196
|
+
setFocus(_this3.contentRef.current);
|
|
197
|
+
}
|
|
172
198
|
}, 1);
|
|
173
199
|
}
|
|
174
200
|
}, {
|
|
@@ -176,13 +202,13 @@ var WizardRoot = /* @__PURE__ */ (function(_Component) {
|
|
|
176
202
|
value: function render() {
|
|
177
203
|
var _ref7;
|
|
178
204
|
var SWizard = this.Root;
|
|
179
|
-
var _this$
|
|
205
|
+
var _this$asProps2 = this.asProps, Children = _this$asProps2.Children, styles = _this$asProps2.styles;
|
|
180
206
|
this._steps.clear();
|
|
181
207
|
return _ref7 = sstyled(styles), /* @__PURE__ */ React.createElement(SWizard, _ref7.cn("SWizard", {
|
|
182
208
|
"render": Modal,
|
|
183
209
|
"aria-label": void 0,
|
|
184
210
|
"ref": this.modalRef,
|
|
185
|
-
"aria-labelledby":
|
|
211
|
+
"aria-labelledby": this.getId()
|
|
186
212
|
}), /* @__PURE__ */ React.createElement(Children, _ref7.cn("Children", {})));
|
|
187
213
|
}
|
|
188
214
|
}]);
|
|
@@ -197,14 +223,14 @@ _defineProperty(WizardRoot, "defaultProps", {
|
|
|
197
223
|
});
|
|
198
224
|
function Sidebar(props) {
|
|
199
225
|
var _ref = arguments[0], _ref8;
|
|
200
|
-
var Children = props.Children, styles = props.styles, title = props.title,
|
|
226
|
+
var Children = props.Children, styles = props.styles, title = props.title, id = props.id;
|
|
201
227
|
var SSidebar = Box;
|
|
202
228
|
var SSidebarHeader = "h2";
|
|
203
229
|
var SSidebarMenu = "div";
|
|
204
230
|
return _ref8 = sstyled(styles), /* @__PURE__ */ React.createElement(SSidebar, _ref8.cn("SSidebar", _objectSpread({}, assignProps({
|
|
205
|
-
"__excludeProps": ["title"]
|
|
231
|
+
"__excludeProps": ["title", "id"]
|
|
206
232
|
}, _ref))), title && /* @__PURE__ */ React.createElement(SSidebarHeader, _ref8.cn("SSidebarHeader", {
|
|
207
|
-
"id":
|
|
233
|
+
"id": id
|
|
208
234
|
}), title), /* @__PURE__ */ React.createElement(SSidebarMenu, _ref8.cn("SSidebarMenu", {
|
|
209
235
|
"role": "tablist",
|
|
210
236
|
"aria-orientation": "vertical"
|
|
@@ -222,7 +248,7 @@ function Step(props) {
|
|
|
222
248
|
}
|
|
223
249
|
function Stepper(props) {
|
|
224
250
|
var _ref3 = arguments[0], _ref0;
|
|
225
|
-
var Children = props.Children, styles = props.styles, step = props.step,
|
|
251
|
+
var Children = props.Children, styles = props.styles, step = props.step, onActive = props.onActive, completed = props.completed, number = props.number, getI18nText = props.getI18nText, focusNext = props.focusNext, focusPrev = props.focusPrev;
|
|
226
252
|
var SStepper = Box;
|
|
227
253
|
var SStepNumber = "span";
|
|
228
254
|
var SStepDescription = "span";
|
|
@@ -246,10 +272,6 @@ function Stepper(props) {
|
|
|
246
272
|
}, [step, onActive, focusPrev, focusNext]);
|
|
247
273
|
return _ref0 = sstyled(styles), /* @__PURE__ */ React.createElement(SStepper, _ref0.cn("SStepper", _objectSpread({}, assignProps({
|
|
248
274
|
"role": "tab",
|
|
249
|
-
"id": "".concat(uid, "-stepper-").concat(step),
|
|
250
|
-
"aria-controls": active ? "".concat(uid, "-content-").concat(step) : void 0,
|
|
251
|
-
"aria-disabled": disabled,
|
|
252
|
-
"aria-selected": active,
|
|
253
275
|
"onClick": handlerClick,
|
|
254
276
|
"onKeyDown": handlerKeyDown
|
|
255
277
|
}, _ref3))), completed && /* @__PURE__ */ React.createElement(ScreenReaderOnly, _ref0.cn("ScreenReaderOnly", {}), getI18nText("completedStep")), /* @__PURE__ */ React.createElement(SStepNumber, _ref0.cn("SStepNumber", {
|
|
@@ -259,18 +281,16 @@ function Stepper(props) {
|
|
|
259
281
|
Stepper.enhance = [keyboardFocusEnhance()];
|
|
260
282
|
function Content(props) {
|
|
261
283
|
var _ref4 = arguments[0], _ref1;
|
|
262
|
-
var Children = props.Children,
|
|
284
|
+
var Children = props.Children, styles = props.styles;
|
|
263
285
|
var SContent = Box;
|
|
264
286
|
return _ref1 = sstyled(styles), /* @__PURE__ */ React.createElement(SContent, _ref1.cn("SContent", _objectSpread({}, assignProps({
|
|
265
|
-
"role": "tabpanel"
|
|
266
|
-
|
|
267
|
-
"id": "".concat(uid, "-content-").concat(step)
|
|
268
|
-
}, _ref4))), hasChildren ? /* @__PURE__ */ React.createElement(Children, _ref1.cn("Children", {})) : stepName);
|
|
287
|
+
"role": "tabpanel"
|
|
288
|
+
}, _ref4))), /* @__PURE__ */ React.createElement(Children, _ref1.cn("Children", {})));
|
|
269
289
|
}
|
|
270
290
|
function StepBack(props) {
|
|
271
291
|
var _ref5 = arguments[0], _ref10;
|
|
272
292
|
var SStepBack = Button;
|
|
273
|
-
var Children = props.Children, hasChildren = props.children, styles = props.styles, getI18nText = props.getI18nText,
|
|
293
|
+
var Children = props.Children, hasChildren = props.children, styles = props.styles, getI18nText = props.getI18nText, stepName = props.stepName;
|
|
274
294
|
var handleClick = React.useCallback(function() {
|
|
275
295
|
var _props$onActive;
|
|
276
296
|
(_props$onActive = props.onActive) === null || _props$onActive === void 0 || _props$onActive.call(props, props.step - 1);
|
|
@@ -280,14 +300,14 @@ function StepBack(props) {
|
|
|
280
300
|
"size": "l",
|
|
281
301
|
"onClick": handleClick,
|
|
282
302
|
"aria-label": getI18nText("backButton", {
|
|
283
|
-
buttonName:
|
|
303
|
+
buttonName: stepName
|
|
284
304
|
})
|
|
285
|
-
}, _ref5))), /* @__PURE__ */ React.createElement(Button.Addon, null, /* @__PURE__ */ React.createElement(ArrowLeft, _ref10.cn("ArrowLeft", {}))), /* @__PURE__ */ React.createElement(Button.Text, null, hasChildren ? /* @__PURE__ */ React.createElement(Children, _ref10.cn("Children", {})) :
|
|
305
|
+
}, _ref5))), /* @__PURE__ */ React.createElement(Button.Addon, null, /* @__PURE__ */ React.createElement(ArrowLeft, _ref10.cn("ArrowLeft", {}))), /* @__PURE__ */ React.createElement(Button.Text, null, hasChildren ? /* @__PURE__ */ React.createElement(Children, _ref10.cn("Children", {})) : stepName));
|
|
286
306
|
}
|
|
287
307
|
function StepNext(props) {
|
|
288
308
|
var _ref6 = arguments[0], _ref11;
|
|
289
309
|
var SStepNext = Button;
|
|
290
|
-
var Children = props.Children, hasChildren = props.children, styles = props.styles, getI18nText = props.getI18nText,
|
|
310
|
+
var Children = props.Children, hasChildren = props.children, styles = props.styles, getI18nText = props.getI18nText, stepName = props.stepName;
|
|
291
311
|
var handleClick = React.useCallback(function() {
|
|
292
312
|
var _props$onActive2;
|
|
293
313
|
(_props$onActive2 = props.onActive) === null || _props$onActive2 === void 0 || _props$onActive2.call(props, props.step + 1);
|
|
@@ -297,9 +317,9 @@ function StepNext(props) {
|
|
|
297
317
|
"size": "l",
|
|
298
318
|
"onClick": handleClick,
|
|
299
319
|
"aria-label": getI18nText("nextButton", {
|
|
300
|
-
buttonName:
|
|
320
|
+
buttonName: stepName
|
|
301
321
|
})
|
|
302
|
-
}, _ref6))), /* @__PURE__ */ React.createElement(Button.Text, null, hasChildren ? /* @__PURE__ */ React.createElement(Children, _ref11.cn("Children", {})) :
|
|
322
|
+
}, _ref6))), /* @__PURE__ */ React.createElement(Button.Text, null, hasChildren ? /* @__PURE__ */ React.createElement(Children, _ref11.cn("Children", {})) : stepName), /* @__PURE__ */ React.createElement(Button.Addon, null, /* @__PURE__ */ React.createElement(ArrowRight, _ref11.cn("ArrowRight", {}))));
|
|
303
323
|
}
|
|
304
324
|
var Wizard = createComponent(WizardRoot, {
|
|
305
325
|
Sidebar,
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { Intergalactic } from '@semcore/core';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import type { IntergalacticWizardStepperComponent, WizardType } from './Wizard.types';
|
|
4
|
+
declare const Wizard: WizardType;
|
|
5
|
+
export declare const wrapWizardStepper: <PropsExtending extends {}>(wrapper: (props: Intergalactic.InternalTypings.UntypeRefAndTag<Intergalactic.InternalTypings.ComponentPropsNesting<IntergalacticWizardStepperComponent>> & PropsExtending) => React.ReactNode) => IntergalacticWizardStepperComponent<PropsExtending>;
|
|
6
|
+
export default Wizard;
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
import type { ButtonProps } from '@semcore/button';
|
|
2
|
+
import type { UnknownProperties, Intergalactic } from '@semcore/core';
|
|
3
|
+
import type { useI18n } from '@semcore/core/lib/utils/enhances/WithI18n';
|
|
4
|
+
import type { BoxProps } from '@semcore/flex-box';
|
|
5
|
+
import type { ModalProps } from '@semcore/modal';
|
|
6
|
+
import type React from 'react';
|
|
7
|
+
export type WizardStep = string | number | boolean;
|
|
8
|
+
/** @deprecated */
|
|
9
|
+
export interface IWizardProps extends WizardProps, UnknownProperties {
|
|
10
|
+
}
|
|
11
|
+
export type WizardProps = ModalProps & {
|
|
12
|
+
/**
|
|
13
|
+
* Active step value
|
|
14
|
+
*/
|
|
15
|
+
step: WizardStep;
|
|
16
|
+
/** Specifies the locale for i18n support */
|
|
17
|
+
locale?: string;
|
|
18
|
+
};
|
|
19
|
+
/** @deprecated */
|
|
20
|
+
export interface IWizardSidebarProps extends WizardSidebarProps, UnknownProperties {
|
|
21
|
+
}
|
|
22
|
+
export type WizardSidebarProps = BoxProps & {
|
|
23
|
+
/**
|
|
24
|
+
* Sidebar title
|
|
25
|
+
*/
|
|
26
|
+
title?: React.ReactNode;
|
|
27
|
+
/**
|
|
28
|
+
* @internal html id attribute
|
|
29
|
+
*/
|
|
30
|
+
id?: string;
|
|
31
|
+
};
|
|
32
|
+
/** @deprecated */
|
|
33
|
+
export interface IWizardStepProps extends WizardStepProps, UnknownProperties {
|
|
34
|
+
}
|
|
35
|
+
export type WizardStepProps = BoxProps & {
|
|
36
|
+
/**
|
|
37
|
+
* Step value
|
|
38
|
+
*/
|
|
39
|
+
step: WizardStep;
|
|
40
|
+
/**
|
|
41
|
+
* Disabled step
|
|
42
|
+
*/
|
|
43
|
+
disabled?: boolean;
|
|
44
|
+
/**
|
|
45
|
+
* Active flag
|
|
46
|
+
* @internal
|
|
47
|
+
*/
|
|
48
|
+
active?: boolean;
|
|
49
|
+
};
|
|
50
|
+
/** @deprecated */
|
|
51
|
+
export interface IWizardStepperProps extends WizardStepperProps, UnknownProperties {
|
|
52
|
+
}
|
|
53
|
+
export type WizardStepperProps<T extends WizardStep = WizardStep> = BoxProps & {
|
|
54
|
+
/**
|
|
55
|
+
* Step value
|
|
56
|
+
*/
|
|
57
|
+
step: T;
|
|
58
|
+
/**
|
|
59
|
+
* Is invoked when active the step
|
|
60
|
+
*/
|
|
61
|
+
onActive?: ((step: T, e: React.SyntheticEvent<HTMLElement> | React.KeyboardEvent) => void) | React.Dispatch<React.SetStateAction<T>>;
|
|
62
|
+
/**
|
|
63
|
+
* Stepper number
|
|
64
|
+
* @default incremental value
|
|
65
|
+
*/
|
|
66
|
+
number?: React.ReactNode;
|
|
67
|
+
/**
|
|
68
|
+
* Is the step completed
|
|
69
|
+
*/
|
|
70
|
+
completed?: boolean;
|
|
71
|
+
/** Disables interaction with the stepper */
|
|
72
|
+
disabled?: boolean;
|
|
73
|
+
/**
|
|
74
|
+
* Translation function
|
|
75
|
+
* @internal
|
|
76
|
+
*/
|
|
77
|
+
getI18nText?: ReturnType<typeof useI18n>;
|
|
78
|
+
/**
|
|
79
|
+
* Go to next step
|
|
80
|
+
* @internal
|
|
81
|
+
*/
|
|
82
|
+
focusNext?: () => void;
|
|
83
|
+
/**
|
|
84
|
+
* Go to prev step
|
|
85
|
+
* @internal
|
|
86
|
+
*/
|
|
87
|
+
focusPrev?: () => void;
|
|
88
|
+
};
|
|
89
|
+
export type WizardContentProps = BoxProps & {
|
|
90
|
+
/**
|
|
91
|
+
* Renders wizard content container with border-radius on the left side
|
|
92
|
+
*/
|
|
93
|
+
noSidebar?: boolean;
|
|
94
|
+
};
|
|
95
|
+
export type WizardStepBackProps<T extends WizardStep = WizardStep> = ButtonProps & {
|
|
96
|
+
/** Callback invoked when navigating to the previous step */
|
|
97
|
+
onActive?: ((step: T, e?: React.SyntheticEvent<HTMLElement>) => void) | React.Dispatch<React.SetStateAction<T>>;
|
|
98
|
+
/** Step name being navigated to */
|
|
99
|
+
stepName?: string;
|
|
100
|
+
/**
|
|
101
|
+
* CurrentStep
|
|
102
|
+
* @internal
|
|
103
|
+
*/
|
|
104
|
+
step?: number;
|
|
105
|
+
/**
|
|
106
|
+
* Translation function
|
|
107
|
+
* @internal
|
|
108
|
+
*/
|
|
109
|
+
getI18nText?: ReturnType<typeof useI18n>;
|
|
110
|
+
};
|
|
111
|
+
export type WizardStepNextProps<T extends WizardStep = WizardStep> = ButtonProps & {
|
|
112
|
+
/** Callback invoked when navigating to the next step */
|
|
113
|
+
onActive?: ((step: T, e?: React.SyntheticEvent<HTMLElement>) => void) | React.Dispatch<React.SetStateAction<T>>;
|
|
114
|
+
/** Step name being navigated to */
|
|
115
|
+
stepName?: string;
|
|
116
|
+
/**
|
|
117
|
+
* CurrentStep
|
|
118
|
+
* @internal
|
|
119
|
+
*/
|
|
120
|
+
step?: number;
|
|
121
|
+
/**
|
|
122
|
+
* Translation function
|
|
123
|
+
* @internal
|
|
124
|
+
*/
|
|
125
|
+
getI18nText?: ReturnType<typeof useI18n>;
|
|
126
|
+
};
|
|
127
|
+
export type IntergalacticWizardStepperComponent<PropsExtending = {}> = (<Value extends WizardStep, Tag extends Intergalactic.Tag = 'div'>(props: Intergalactic.InternalTypings.ComponentProps<Tag, 'div', WizardStepperProps<Value>> & PropsExtending) => Intergalactic.InternalTypings.ComponentRenderingResults) & Intergalactic.InternalTypings.ComponentAdditive<'div', 'div', WizardStepperProps>;
|
|
128
|
+
export type WizardType = Intergalactic.Component<'div', WizardProps> & {
|
|
129
|
+
Sidebar: Intergalactic.Component<'div', WizardSidebarProps>;
|
|
130
|
+
Step: Intergalactic.Component<'div', WizardStepProps>;
|
|
131
|
+
Stepper: IntergalacticWizardStepperComponent;
|
|
132
|
+
Content: Intergalactic.Component<'div', WizardContentProps>;
|
|
133
|
+
StepBack: Intergalactic.Component<'button', WizardStepBackProps>;
|
|
134
|
+
StepNext: Intergalactic.Component<'button', WizardStepNextProps>;
|
|
135
|
+
};
|
package/lib/types/index.d.ts
CHANGED
|
@@ -1,113 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import type { ModalProps } from '@semcore/modal';
|
|
5
|
-
import type React from 'react';
|
|
6
|
-
|
|
7
|
-
export type WizardStep = string | number | boolean;
|
|
8
|
-
|
|
9
|
-
/** @deprecated */
|
|
10
|
-
export interface IWizardProps extends WizardProps, UnknownProperties {}
|
|
11
|
-
export type WizardProps = ModalProps & {
|
|
12
|
-
/**
|
|
13
|
-
* Active step value
|
|
14
|
-
*/
|
|
15
|
-
step: WizardStep;
|
|
16
|
-
/** Specifies the locale for i18n support */
|
|
17
|
-
locale?: string;
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
/** @deprecated */
|
|
21
|
-
export interface IWizardSidebarProps extends WizardSidebarProps, UnknownProperties {}
|
|
22
|
-
export type WizardSidebarProps = BoxProps & {
|
|
23
|
-
/**
|
|
24
|
-
* Sidebar title
|
|
25
|
-
*/
|
|
26
|
-
title?: React.ReactNode;
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
/** @deprecated */
|
|
30
|
-
export interface IWizardStepProps extends WizardStepProps, UnknownProperties {}
|
|
31
|
-
export type WizardStepProps = BoxProps & {
|
|
32
|
-
/**
|
|
33
|
-
* Step value
|
|
34
|
-
*/
|
|
35
|
-
step: WizardStep;
|
|
36
|
-
/**
|
|
37
|
-
* Disabled step
|
|
38
|
-
*/
|
|
39
|
-
disabled?: boolean;
|
|
40
|
-
};
|
|
41
|
-
|
|
42
|
-
/** @deprecated */
|
|
43
|
-
export interface IWizardStepperProps extends WizardStepperProps, UnknownProperties {}
|
|
44
|
-
export type WizardStepperProps<T extends WizardStep = WizardStep> = BoxProps & {
|
|
45
|
-
/**
|
|
46
|
-
* Step value
|
|
47
|
-
*/
|
|
48
|
-
step: T;
|
|
49
|
-
/**
|
|
50
|
-
* Is invoked when active the step
|
|
51
|
-
*/
|
|
52
|
-
onActive?:
|
|
53
|
-
| ((step: T, e: React.SyntheticEvent<HTMLElement>) => void)
|
|
54
|
-
| React.Dispatch<React.SetStateAction<T>>;
|
|
55
|
-
/**
|
|
56
|
-
* Stepper number
|
|
57
|
-
* @default incremental value
|
|
58
|
-
*/
|
|
59
|
-
number?: React.ReactNode;
|
|
60
|
-
/**
|
|
61
|
-
* Is the step completed
|
|
62
|
-
*/
|
|
63
|
-
completed?: boolean;
|
|
64
|
-
/** Disables interaction with the stepper */
|
|
65
|
-
disabled?: boolean;
|
|
66
|
-
};
|
|
67
|
-
|
|
68
|
-
export type WizardStepBackProps<T extends WizardStep = WizardStep> = ButtonProps & {
|
|
69
|
-
/** Callback invoked when navigating to the previous step */
|
|
70
|
-
onActive?:
|
|
71
|
-
| ((step: T, e: React.SyntheticEvent<HTMLElement>) => void)
|
|
72
|
-
| React.Dispatch<React.SetStateAction<T>>;
|
|
73
|
-
/** Step name being navigated to */
|
|
74
|
-
stepName?: string;
|
|
75
|
-
};
|
|
76
|
-
export type WizardStepNextProps<T extends WizardStep = WizardStep> = ButtonProps & {
|
|
77
|
-
/** Callback invoked when navigating to the next step */
|
|
78
|
-
onActive?:
|
|
79
|
-
| ((step: T, e: React.SyntheticEvent<HTMLElement>) => void)
|
|
80
|
-
| React.Dispatch<React.SetStateAction<T>>;
|
|
81
|
-
/** Step name being navigated to */
|
|
82
|
-
stepName?: string;
|
|
83
|
-
};
|
|
84
|
-
|
|
85
|
-
type IntergalacticWizardStepperComponent<PropsExtending = {}> = (<
|
|
86
|
-
Value extends WizardStep,
|
|
87
|
-
Tag extends Intergalactic.Tag = 'div',
|
|
88
|
-
>(
|
|
89
|
-
props: Intergalactic.InternalTypings.ComponentProps<Tag, 'div', WizardStepperProps<Value>> &
|
|
90
|
-
PropsExtending,
|
|
91
|
-
) => Intergalactic.InternalTypings.ComponentRenderingResults) &
|
|
92
|
-
Intergalactic.InternalTypings.ComponentAdditive<'div', 'div', WizardStepperProps>;
|
|
93
|
-
|
|
94
|
-
declare const Wizard: Intergalactic.Component<'div', WizardProps> & {
|
|
95
|
-
Sidebar: Intergalactic.Component<'div', WizardSidebarProps>;
|
|
96
|
-
Step: Intergalactic.Component<'div', WizardStepProps>;
|
|
97
|
-
Stepper: IntergalacticWizardStepperComponent;
|
|
98
|
-
Content: typeof Box;
|
|
99
|
-
StepBack: Intergalactic.Component<'button', WizardStepBackProps>;
|
|
100
|
-
StepNext: Intergalactic.Component<'button', WizardStepNextProps>;
|
|
101
|
-
};
|
|
102
|
-
|
|
103
|
-
declare const wrapWizardStepper: <PropsExtending extends {}>(
|
|
104
|
-
wrapper: (
|
|
105
|
-
props: Intergalactic.InternalTypings.UntypeRefAndTag<
|
|
106
|
-
Intergalactic.InternalTypings.ComponentPropsNesting<IntergalacticWizardStepperComponent>
|
|
107
|
-
> &
|
|
108
|
-
PropsExtending,
|
|
109
|
-
) => React.ReactNode,
|
|
110
|
-
) => IntergalacticWizardStepperComponent<PropsExtending>;
|
|
111
|
-
export { wrapWizardStepper };
|
|
112
|
-
|
|
113
|
-
export default Wizard;
|
|
1
|
+
export { default } from './Wizard';
|
|
2
|
+
export * from './Wizard';
|
|
3
|
+
export type * from './Wizard.types';
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
export declare const localizedMessages: {
|
|
2
|
+
de: {
|
|
3
|
+
completedStep: string;
|
|
4
|
+
backButton: string;
|
|
5
|
+
nextButton: string;
|
|
6
|
+
};
|
|
7
|
+
en: {
|
|
8
|
+
completedStep: string;
|
|
9
|
+
backButton: string;
|
|
10
|
+
nextButton: string;
|
|
11
|
+
};
|
|
12
|
+
es: {
|
|
13
|
+
completedStep: string;
|
|
14
|
+
backButton: string;
|
|
15
|
+
nextButton: string;
|
|
16
|
+
};
|
|
17
|
+
fr: {
|
|
18
|
+
completedStep: string;
|
|
19
|
+
backButton: string;
|
|
20
|
+
nextButton: string;
|
|
21
|
+
};
|
|
22
|
+
it: {
|
|
23
|
+
completedStep: string;
|
|
24
|
+
backButton: string;
|
|
25
|
+
nextButton: string;
|
|
26
|
+
};
|
|
27
|
+
ja: {
|
|
28
|
+
completedStep: string;
|
|
29
|
+
backButton: string;
|
|
30
|
+
nextButton: string;
|
|
31
|
+
};
|
|
32
|
+
ko: {
|
|
33
|
+
completedStep: string;
|
|
34
|
+
backButton: string;
|
|
35
|
+
nextButton: string;
|
|
36
|
+
};
|
|
37
|
+
nl: {
|
|
38
|
+
completedStep: string;
|
|
39
|
+
backButton: string;
|
|
40
|
+
nextButton: string;
|
|
41
|
+
};
|
|
42
|
+
pt: {
|
|
43
|
+
completedStep: string;
|
|
44
|
+
backButton: string;
|
|
45
|
+
nextButton: string;
|
|
46
|
+
};
|
|
47
|
+
tr: {
|
|
48
|
+
completedStep: string;
|
|
49
|
+
backButton: string;
|
|
50
|
+
nextButton: string;
|
|
51
|
+
};
|
|
52
|
+
vi: {
|
|
53
|
+
completedStep: string;
|
|
54
|
+
backButton: string;
|
|
55
|
+
nextButton: string;
|
|
56
|
+
};
|
|
57
|
+
zh: {
|
|
58
|
+
completedStep: string;
|
|
59
|
+
backButton: string;
|
|
60
|
+
nextButton: string;
|
|
61
|
+
};
|
|
62
|
+
pl: {
|
|
63
|
+
completedStep: string;
|
|
64
|
+
backButton: string;
|
|
65
|
+
nextButton: string;
|
|
66
|
+
};
|
|
67
|
+
sv: {
|
|
68
|
+
completedStep: string;
|
|
69
|
+
backButton: string;
|
|
70
|
+
nextButton: string;
|
|
71
|
+
};
|
|
72
|
+
};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@semcore/wizard",
|
|
3
3
|
"description": "Semrush Wizard Component",
|
|
4
|
-
"version": "16.
|
|
4
|
+
"version": "16.2.0-prerelease.0",
|
|
5
5
|
"main": "lib/cjs/index.js",
|
|
6
6
|
"module": "lib/es6/index.js",
|
|
7
7
|
"typings": "lib/types/index.d.ts",
|
|
@@ -14,13 +14,13 @@
|
|
|
14
14
|
"types": "./lib/types/index.d.ts"
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@semcore/button": "16.0.
|
|
18
|
-
"@semcore/flex-box": "16.0.
|
|
19
|
-
"@semcore/icon": "16.5.
|
|
20
|
-
"@semcore/modal": "16.1.
|
|
17
|
+
"@semcore/button": "16.0.11-prerelease.0",
|
|
18
|
+
"@semcore/flex-box": "16.0.11-prerelease.0",
|
|
19
|
+
"@semcore/icon": "16.5.2-prerelease.0",
|
|
20
|
+
"@semcore/modal": "16.1.11-prerelease.0"
|
|
21
21
|
},
|
|
22
22
|
"peerDependencies": {
|
|
23
|
-
"@semcore/base-components": "^16.4.
|
|
23
|
+
"@semcore/base-components": "^16.4.1-prerelease.0"
|
|
24
24
|
},
|
|
25
25
|
"repository": {
|
|
26
26
|
"type": "git",
|
|
@@ -28,10 +28,10 @@
|
|
|
28
28
|
"directory": "semcore/wizard"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
|
-
"@semcore/
|
|
32
|
-
"@semcore/
|
|
31
|
+
"@semcore/testing-utils": "1.0.0",
|
|
32
|
+
"@semcore/core": "16.5.1-prerelease.0"
|
|
33
33
|
},
|
|
34
34
|
"scripts": {
|
|
35
|
-
"build": "pnpm semcore-builder
|
|
35
|
+
"build": "pnpm semcore-builder && pnpm vite build"
|
|
36
36
|
}
|
|
37
37
|
}
|