@semcore/wizard 16.2.3-prerelease.9 → 16.3.0-prerelease.1
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 +3 -3
- package/lib/cjs/Wizard.js +295 -278
- package/lib/cjs/Wizard.js.map +1 -1
- package/lib/cjs/Wizard.types.js.map +1 -1
- package/lib/cjs/index.js +4 -4
- package/lib/cjs/index.js.map +1 -1
- package/lib/cjs/style/wizard.shadow.css +12 -12
- package/lib/cjs/translations/__intergalactic-dynamic-locales.js +16 -16
- package/lib/cjs/translations/__intergalactic-dynamic-locales.js.map +1 -1
- package/lib/es6/Wizard.js +285 -267
- package/lib/es6/Wizard.js.map +1 -1
- package/lib/es6/Wizard.types.js.map +1 -1
- package/lib/es6/style/wizard.shadow.css +12 -12
- package/lib/es6/translations/__intergalactic-dynamic-locales.js +15 -15
- package/lib/es6/translations/__intergalactic-dynamic-locales.js.map +1 -1
- package/lib/esm/Wizard.mjs +253 -266
- package/lib/esm/style/wizard.shadow.css +12 -12
- package/lib/esm/translations/__intergalactic-dynamic-locales.mjs +1 -1
- package/lib/types/Wizard.types.d.ts +27 -16
- package/package.json +8 -9
- package/src/Wizard.tsx +7 -5
- package/src/Wizard.types.ts +27 -19
- package/src/style/wizard.shadow.css +12 -12
package/lib/esm/Wizard.mjs
CHANGED
|
@@ -1,11 +1,17 @@
|
|
|
1
|
+
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
2
|
+
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
|
|
3
|
+
import _createClass from "@babel/runtime/helpers/esm/createClass";
|
|
4
|
+
import _callSuper from "@babel/runtime/helpers/esm/callSuper";
|
|
5
|
+
import _inherits from "@babel/runtime/helpers/esm/inherits";
|
|
1
6
|
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
2
7
|
import { createComponent, sstyled, Component, assignProps } from "@semcore/core";
|
|
3
|
-
import { Box, ScreenReaderOnly } from "@semcore/base-components";
|
|
4
8
|
import Button from "@semcore/button";
|
|
5
9
|
import i18nEnhance from "@semcore/core/lib/utils/enhances/i18nEnhance";
|
|
10
|
+
import keyboardFocusEnhance from "@semcore/core/lib/utils/enhances/keyboardFocusEnhance";
|
|
6
11
|
import findComponent from "@semcore/core/lib/utils/findComponent";
|
|
7
12
|
import uniqueIDEnhancement from "@semcore/core/lib/utils/uniqueID";
|
|
8
13
|
import { setFocus } from "@semcore/core/lib/utils/use/useFocusLock";
|
|
14
|
+
import { Box, ScreenReaderOnly } from "@semcore/flex-box";
|
|
9
15
|
import ArrowLeft from "@semcore/icon/ArrowLeft/m";
|
|
10
16
|
import ArrowRight from "@semcore/icon/ArrowRight/m";
|
|
11
17
|
import CheckM from "@semcore/icon/Check/m";
|
|
@@ -13,183 +19,209 @@ import Modal from "@semcore/modal";
|
|
|
13
19
|
import React from "react";
|
|
14
20
|
import { localizedMessages } from "./translations/__intergalactic-dynamic-locales.mjs";
|
|
15
21
|
/*!__reshadow-styles__:"./style/wizard.shadow.css"*/
|
|
16
|
-
|
|
22
|
+
var style = (
|
|
17
23
|
/*__reshadow_css_start__*/
|
|
18
24
|
(sstyled.insert(
|
|
19
25
|
/*__inner_css_start__*/
|
|
20
|
-
".
|
|
26
|
+
".___SWizard_15s2m_gg_{max-width:980px;max-height:700px;display:flex;padding:0;background:0 0}.___SSidebar_15s2m_gg_{background:var(--intergalactic-control-primary-advertising, rgb(162, 97, 253));color:var(--intergalactic-text-primary-invert, rgba(254, 255, 255, 0.949));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, calc(12px + 2px))0 0 var(--intergalactic-modal-rounded, calc(12px + 2px))}@media (max-width:1060px){.___SSidebar_15s2m_gg_{width:56px}}.___SSidebar_15s2m_gg_ .___SStepper_15s2m_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_15s2m_gg_ .___SStepper_15s2m_gg_:focus-visible{outline-color:var(--intergalactic-keyboard-focus-invert-outline, rgba(255, 255, 255, 0.7))}@media (hover:hover){.___SSidebar_15s2m_gg_ .___SStepper_15s2m_gg_:hover{background:var(--intergalactic-control-primary-advertising-hover, rgb(150, 76, 251));z-index:2}}.___SSidebar_15s2m_gg_ .___SStepper_15s2m_gg_.__active_15s2m_gg_{background:var(--intergalactic-control-primary-advertising-active, rgb(144, 65, 250))}.___SSidebar_15s2m_gg_ .___SStepper_15s2m_gg_.__disabled_15s2m_gg_,.___SSidebar_15s2m_gg_ .___SStepper_15s2m_gg_:disabled{opacity:var(--intergalactic-disabled-opacity, 0.4);cursor:default;pointer-events:none}@media (max-width:1060px){.___SSidebar_15s2m_gg_ .___SStepper_15s2m_gg_{padding:var(--intergalactic-spacing-2x, 8px)}@media (hover:hover){.___SSidebar_15s2m_gg_ .___SStepper_15s2m_gg_:hover{width:-moz-max-content;width:max-content;max-width:220px}.___SSidebar_15s2m_gg_ .___SStepper_15s2m_gg_:hover .___SStepDescription_15s2m_gg_{display:block;border-radius:var(--intergalactic-control-rounded, 6px);overflow:auto}.___SSidebar_15s2m_gg_ .___SStepper_15s2m_gg_.__active_15s2m_gg_:hover .___SStepDescription_15s2m_gg_{background:var(--intergalactic-control-primary-advertising-active, rgb(144, 65, 250))}}}.___SSidebarHeader_15s2m_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_15s2m_gg_{display:none}}.___SStepNumber_15s2m_gg_{display:inline-block;min-width:20px;text-align:center}.___SCompleted_15s2m_gg_{margin-top:1px}.___SStepDescription_15s2m_gg_{word-wrap:anywhere}@media (max-width:1060px){.___SStepDescription_15s2m_gg_{display:none}}.___SContent_15s2m_gg_{padding:var(--intergalactic-spacing-10x, 40px);width:100%;border-radius:0 var(--intergalactic-modal-rounded, calc(12px + 2px)) var(--intergalactic-modal-rounded, calc(12px + 2px))0;background:var(--intergalactic-bg-primary-neutral, rgb(255, 255, 255))}.___SContent_15s2m_gg_.__noSidebar_15s2m_gg_{border-radius:var(--intergalactic-modal-rounded, calc(12px + 2px))}.___SSidebarMenu_15s2m_gg_{display:contents}",
|
|
21
27
|
/*__inner_css_end__*/
|
|
22
|
-
"
|
|
28
|
+
"15s2m_gg_"
|
|
23
29
|
), /*__reshadow_css_end__*/
|
|
24
30
|
{
|
|
25
|
-
"__SWizard": "
|
|
26
|
-
"__SStepNumber": "
|
|
27
|
-
"__SCompleted": "
|
|
28
|
-
"__SContent": "
|
|
29
|
-
"_noSidebar": "
|
|
30
|
-
"__SSidebarMenu": "
|
|
31
|
-
"__SSidebar": "
|
|
32
|
-
"__SStepper": "
|
|
33
|
-
"_active": "
|
|
34
|
-
"_disabled": "
|
|
35
|
-
"__SStepDescription": "
|
|
36
|
-
"__SSidebarHeader": "
|
|
31
|
+
"__SWizard": "___SWizard_15s2m_gg_",
|
|
32
|
+
"__SStepNumber": "___SStepNumber_15s2m_gg_",
|
|
33
|
+
"__SCompleted": "___SCompleted_15s2m_gg_",
|
|
34
|
+
"__SContent": "___SContent_15s2m_gg_",
|
|
35
|
+
"_noSidebar": "__noSidebar_15s2m_gg_",
|
|
36
|
+
"__SSidebarMenu": "___SSidebarMenu_15s2m_gg_",
|
|
37
|
+
"__SSidebar": "___SSidebar_15s2m_gg_",
|
|
38
|
+
"__SStepper": "___SStepper_15s2m_gg_",
|
|
39
|
+
"_active": "__active_15s2m_gg_",
|
|
40
|
+
"_disabled": "__disabled_15s2m_gg_",
|
|
41
|
+
"__SStepDescription": "___SStepDescription_15s2m_gg_",
|
|
42
|
+
"__SSidebarHeader": "___SSidebarHeader_15s2m_gg_"
|
|
37
43
|
})
|
|
38
44
|
);
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
45
|
+
var WizardRoot = /* @__PURE__ */ (function(_Component) {
|
|
46
|
+
function WizardRoot2() {
|
|
47
|
+
var _this;
|
|
48
|
+
_classCallCheck(this, WizardRoot2);
|
|
49
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
50
|
+
args[_key] = arguments[_key];
|
|
51
|
+
}
|
|
52
|
+
_this = _callSuper(this, WizardRoot2, [].concat(args));
|
|
53
|
+
_defineProperty(_this, "_steps", /* @__PURE__ */ new Map());
|
|
54
|
+
_defineProperty(_this, "modalRef", /* @__PURE__ */ React.createRef());
|
|
55
|
+
_defineProperty(_this, "contentRef", /* @__PURE__ */ React.createRef());
|
|
56
|
+
_defineProperty(_this, "stepperRefs", []);
|
|
57
|
+
_defineProperty(_this, "state", {
|
|
58
|
+
// @ts-ignore
|
|
59
|
+
highlighted: _this.props.step
|
|
48
60
|
});
|
|
49
|
-
_defineProperty(
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
61
|
+
_defineProperty(_this, "stepperFocusPrev", function(i) {
|
|
62
|
+
return function() {
|
|
63
|
+
var prevStep = _this._steps.get(i);
|
|
64
|
+
if (!prevStep) return;
|
|
65
|
+
if (prevStep.disabled) {
|
|
66
|
+
_this.stepperFocusPrev(i - 1)();
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
_this.setState({
|
|
70
|
+
highlighted: prevStep === null || prevStep === void 0 ? void 0 : prevStep.step
|
|
71
|
+
});
|
|
72
|
+
setTimeout(function() {
|
|
73
|
+
var _this$stepperRefs;
|
|
74
|
+
(_this$stepperRefs = _this.stepperRefs[i - 1]) === null || _this$stepperRefs === void 0 || _this$stepperRefs.focus();
|
|
75
|
+
}, 0);
|
|
76
|
+
};
|
|
63
77
|
});
|
|
64
|
-
_defineProperty(
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
+
_defineProperty(_this, "stepperFocusNext", function(i) {
|
|
79
|
+
return function() {
|
|
80
|
+
var nextStep = _this._steps.get(i + 2);
|
|
81
|
+
if (!nextStep) return;
|
|
82
|
+
if (nextStep.disabled) {
|
|
83
|
+
_this.stepperFocusNext(i + 1)();
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
_this.setState({
|
|
87
|
+
highlighted: nextStep === null || nextStep === void 0 ? void 0 : nextStep.step
|
|
88
|
+
});
|
|
89
|
+
setTimeout(function() {
|
|
90
|
+
var _this$stepperRefs2;
|
|
91
|
+
(_this$stepperRefs2 = _this.stepperRefs[i + 1]) === null || _this$stepperRefs2 === void 0 || _this$stepperRefs2.focus();
|
|
92
|
+
}, 0);
|
|
93
|
+
};
|
|
78
94
|
});
|
|
95
|
+
return _this;
|
|
79
96
|
}
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
uid
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
97
|
+
_inherits(WizardRoot2, _Component);
|
|
98
|
+
return _createClass(WizardRoot2, [{
|
|
99
|
+
key: "getStepId",
|
|
100
|
+
value: function getStepId(step) {
|
|
101
|
+
return "".concat(this.asProps.uid, "-step-").concat(step);
|
|
102
|
+
}
|
|
103
|
+
}, {
|
|
104
|
+
key: "getId",
|
|
105
|
+
value: function getId() {
|
|
106
|
+
return "".concat(this.asProps.uid, "-title");
|
|
107
|
+
}
|
|
108
|
+
}, {
|
|
109
|
+
key: "getStepperId",
|
|
110
|
+
value: function getStepperId(step) {
|
|
111
|
+
var uid = this.asProps.uid;
|
|
112
|
+
return "".concat(uid, "-stepper-").concat(step);
|
|
113
|
+
}
|
|
114
|
+
}, {
|
|
115
|
+
key: "getContentId",
|
|
116
|
+
value: function getContentId(step) {
|
|
117
|
+
var uid = this.asProps.uid;
|
|
118
|
+
return "".concat(uid, "-content-").concat(step);
|
|
119
|
+
}
|
|
120
|
+
}, {
|
|
121
|
+
key: "getStepProps",
|
|
122
|
+
value: function getStepProps(props) {
|
|
123
|
+
return {
|
|
124
|
+
steps: this._steps,
|
|
125
|
+
active: props.step === this.asProps.step,
|
|
126
|
+
id: this.getStepId(props.step)
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
}, {
|
|
130
|
+
key: "getSidebarProps",
|
|
131
|
+
value: function getSidebarProps() {
|
|
132
|
+
return {
|
|
133
|
+
id: this.getId()
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
}, {
|
|
137
|
+
key: "getContentProps",
|
|
138
|
+
value: function getContentProps() {
|
|
139
|
+
var _this$asProps = this.asProps, Children = _this$asProps.Children, step = _this$asProps.step;
|
|
140
|
+
var Sidebar2 = findComponent(Children, ["Wizard.Sidebar"], true);
|
|
141
|
+
return _defineProperty(_defineProperty({
|
|
142
|
+
ref: this.contentRef,
|
|
143
|
+
noSidebar: !Sidebar2
|
|
144
|
+
}, "aria-labelledby", this.getStepperId(step)), "id", this.getContentId(step));
|
|
145
|
+
}
|
|
146
|
+
}, {
|
|
147
|
+
key: "getStepBackProps",
|
|
148
|
+
value: function getStepBackProps() {
|
|
149
|
+
return {
|
|
150
|
+
getI18nText: this.asProps.getI18nText,
|
|
151
|
+
step: this.asProps.step
|
|
152
|
+
};
|
|
153
|
+
}
|
|
154
|
+
}, {
|
|
155
|
+
key: "getStepNextProps",
|
|
156
|
+
value: function getStepNextProps() {
|
|
157
|
+
return {
|
|
158
|
+
getI18nText: this.asProps.getI18nText,
|
|
159
|
+
step: this.asProps.step
|
|
160
|
+
};
|
|
161
|
+
}
|
|
162
|
+
}, {
|
|
163
|
+
key: "getStepperProps",
|
|
164
|
+
value: function getStepperProps(props, i) {
|
|
165
|
+
var _this2 = this;
|
|
166
|
+
var number = i + 1;
|
|
167
|
+
if (this._steps.has(props.step)) {
|
|
168
|
+
var step = this._steps.get(props.step);
|
|
169
|
+
number = step.number;
|
|
170
|
+
} else {
|
|
171
|
+
this._steps.set(props.step, _objectSpread({
|
|
172
|
+
number
|
|
173
|
+
}, props));
|
|
174
|
+
}
|
|
175
|
+
var active = props.step === this.asProps.step;
|
|
176
|
+
var highlighted = this.state.highlighted === props.step;
|
|
177
|
+
return {
|
|
178
|
+
active,
|
|
179
|
+
"tabIndex": highlighted ? 0 : -1,
|
|
142
180
|
number,
|
|
143
|
-
|
|
144
|
-
|
|
181
|
+
"getI18nText": this.asProps.getI18nText,
|
|
182
|
+
"uid": this.asProps.uid,
|
|
183
|
+
"ref": function ref(node) {
|
|
184
|
+
_this2.stepperRefs[i] = node;
|
|
185
|
+
},
|
|
186
|
+
"focusNext": this.stepperFocusNext(i),
|
|
187
|
+
"focusPrev": this.stepperFocusPrev(i),
|
|
188
|
+
"id": this.getStepperId(props.step),
|
|
189
|
+
"aria-controls": active ? this.getContentId(props.step) : void 0,
|
|
190
|
+
"aria-disabled": props.disabled,
|
|
191
|
+
"aria-selected": active
|
|
192
|
+
};
|
|
145
193
|
}
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
"tabIndex": highlighted ? 0 : -1,
|
|
151
|
-
number,
|
|
152
|
-
"getI18nText": this.asProps.getI18nText,
|
|
153
|
-
"uid": this.asProps.uid,
|
|
154
|
-
"ref": (node) => {
|
|
155
|
-
this.stepperRefs[i] = node;
|
|
156
|
-
},
|
|
157
|
-
"focusNext": this.stepperFocusNext(i),
|
|
158
|
-
"focusPrev": this.stepperFocusPrev(i),
|
|
159
|
-
"id": this.getStepperId(props.step),
|
|
160
|
-
"aria-controls": active ? this.getContentId(props.step) : void 0,
|
|
161
|
-
"aria-disabled": props.disabled,
|
|
162
|
-
"aria-selected": active
|
|
163
|
-
};
|
|
164
|
-
}
|
|
165
|
-
componentDidUpdate(prevProps) {
|
|
166
|
-
if (prevProps.step === this.asProps.step) return;
|
|
167
|
-
this.setState({
|
|
168
|
-
highlighted: this.asProps.step
|
|
169
|
-
});
|
|
170
|
-
setTimeout(() => {
|
|
194
|
+
}, {
|
|
195
|
+
key: "componentDidUpdate",
|
|
196
|
+
value: function componentDidUpdate(prevProps) {
|
|
197
|
+
var _this3 = this;
|
|
171
198
|
if (prevProps.step === this.asProps.step) return;
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
"
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
199
|
+
this.setState({
|
|
200
|
+
highlighted: this.asProps.step
|
|
201
|
+
});
|
|
202
|
+
setTimeout(function() {
|
|
203
|
+
if (prevProps.step === _this3.asProps.step) return;
|
|
204
|
+
if (_this3.contentRef.current) {
|
|
205
|
+
setFocus(_this3.contentRef.current);
|
|
206
|
+
}
|
|
207
|
+
}, 1);
|
|
208
|
+
}
|
|
209
|
+
}, {
|
|
210
|
+
key: "render",
|
|
211
|
+
value: function render() {
|
|
212
|
+
var _ref7;
|
|
213
|
+
var SWizard = this.Root;
|
|
214
|
+
var _this$asProps2 = this.asProps, Children = _this$asProps2.Children, styles = _this$asProps2.styles;
|
|
215
|
+
this._steps.clear();
|
|
216
|
+
return _ref7 = sstyled(styles), /* @__PURE__ */ React.createElement(SWizard, _ref7.cn("SWizard", {
|
|
217
|
+
"render": Modal,
|
|
218
|
+
"aria-label": void 0,
|
|
219
|
+
"ref": this.modalRef,
|
|
220
|
+
"aria-labelledby": this.getId()
|
|
221
|
+
}), /* @__PURE__ */ React.createElement(Children, _ref7.cn("Children", {})));
|
|
222
|
+
}
|
|
223
|
+
}]);
|
|
224
|
+
})(Component);
|
|
193
225
|
_defineProperty(WizardRoot, "displayName", "Wizard");
|
|
194
226
|
_defineProperty(WizardRoot, "style", style);
|
|
195
227
|
_defineProperty(WizardRoot, "enhance", [i18nEnhance(localizedMessages), uniqueIDEnhancement()]);
|
|
@@ -200,20 +232,13 @@ _defineProperty(WizardRoot, "defaultProps", {
|
|
|
200
232
|
});
|
|
201
233
|
function Sidebar(props) {
|
|
202
234
|
var _ref = arguments[0], _ref8;
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
const SSidebarHeader = "h2";
|
|
211
|
-
const SSidebarMenu = "div";
|
|
212
|
-
return _ref8 = sstyled(styles), /* @__PURE__ */ React.createElement(SSidebar, _ref8.cn("SSidebar", {
|
|
213
|
-
...assignProps({
|
|
214
|
-
"__excludeProps": ["title", "id"]
|
|
215
|
-
}, _ref)
|
|
216
|
-
}), title && /* @__PURE__ */ React.createElement(SSidebarHeader, _ref8.cn("SSidebarHeader", {
|
|
235
|
+
var Children = props.Children, styles = props.styles, title = props.title, id = props.id;
|
|
236
|
+
var SSidebar = Box;
|
|
237
|
+
var SSidebarHeader = "h2";
|
|
238
|
+
var SSidebarMenu = "div";
|
|
239
|
+
return _ref8 = sstyled(styles), /* @__PURE__ */ React.createElement(SSidebar, _ref8.cn("SSidebar", _objectSpread({}, assignProps({
|
|
240
|
+
"__excludeProps": ["title", "id"]
|
|
241
|
+
}, _ref))), title && /* @__PURE__ */ React.createElement(SSidebarHeader, _ref8.cn("SSidebarHeader", {
|
|
217
242
|
"id": id
|
|
218
243
|
}), title), /* @__PURE__ */ React.createElement(SSidebarMenu, _ref8.cn("SSidebarMenu", {
|
|
219
244
|
"role": "tablist",
|
|
@@ -222,42 +247,25 @@ function Sidebar(props) {
|
|
|
222
247
|
}
|
|
223
248
|
function Step(props) {
|
|
224
249
|
var _ref2 = arguments[0];
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
Children,
|
|
228
|
-
styles,
|
|
229
|
-
active
|
|
230
|
-
} = props;
|
|
250
|
+
var SStep = Box;
|
|
251
|
+
var Children = props.Children, styles = props.styles, active = props.active;
|
|
231
252
|
if (active) {
|
|
232
253
|
var _ref9;
|
|
233
|
-
return _ref9 = sstyled(styles), /* @__PURE__ */ React.createElement(SStep, _ref9.cn("SStep", {
|
|
234
|
-
...assignProps({}, _ref2)
|
|
235
|
-
}), /* @__PURE__ */ React.createElement(Children, _ref9.cn("Children", {})));
|
|
254
|
+
return _ref9 = sstyled(styles), /* @__PURE__ */ React.createElement(SStep, _ref9.cn("SStep", _objectSpread({}, assignProps({}, _ref2))), /* @__PURE__ */ React.createElement(Children, _ref9.cn("Children", {})));
|
|
236
255
|
}
|
|
237
256
|
return null;
|
|
238
257
|
}
|
|
239
258
|
function Stepper(props) {
|
|
240
259
|
var _ref3 = arguments[0], _ref0;
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
number,
|
|
248
|
-
getI18nText,
|
|
249
|
-
focusNext,
|
|
250
|
-
focusPrev,
|
|
251
|
-
disabled
|
|
252
|
-
} = props;
|
|
253
|
-
const SStepper = Box;
|
|
254
|
-
const SStepNumber = "span";
|
|
255
|
-
const SStepDescription = "span";
|
|
256
|
-
const SCompleted = CheckM;
|
|
257
|
-
const handlerClick = React.useCallback((e) => {
|
|
260
|
+
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;
|
|
261
|
+
var SStepper = Box;
|
|
262
|
+
var SStepNumber = "span";
|
|
263
|
+
var SStepDescription = "span";
|
|
264
|
+
var SCompleted = CheckM;
|
|
265
|
+
var handlerClick = React.useCallback(function(e) {
|
|
258
266
|
if (onActive) onActive(step, e);
|
|
259
267
|
}, [step, onActive]);
|
|
260
|
-
|
|
268
|
+
var handlerKeyDown = React.useCallback(function(e) {
|
|
261
269
|
if (onActive && (e.key === "Enter" || e.key === " ")) {
|
|
262
270
|
e.preventDefault();
|
|
263
271
|
onActive(step, e);
|
|
@@ -271,81 +279,58 @@ function Stepper(props) {
|
|
|
271
279
|
e.stopPropagation();
|
|
272
280
|
}
|
|
273
281
|
}, [step, onActive, focusPrev, focusNext]);
|
|
274
|
-
return _ref0 = sstyled(styles), /* @__PURE__ */ React.createElement(SStepper, _ref0.cn("SStepper", {
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
"onKeyDown": handlerKeyDown
|
|
280
|
-
}, _ref3)
|
|
281
|
-
}), completed && /* @__PURE__ */ React.createElement(ScreenReaderOnly, _ref0.cn("ScreenReaderOnly", {}), getI18nText("completedStep")), /* @__PURE__ */ React.createElement(SStepNumber, _ref0.cn("SStepNumber", {
|
|
282
|
+
return _ref0 = sstyled(styles), /* @__PURE__ */ React.createElement(SStepper, _ref0.cn("SStepper", _objectSpread({}, assignProps({
|
|
283
|
+
"role": "tab",
|
|
284
|
+
"onClick": handlerClick,
|
|
285
|
+
"onKeyDown": handlerKeyDown
|
|
286
|
+
}, _ref3))), completed && /* @__PURE__ */ React.createElement(ScreenReaderOnly, _ref0.cn("ScreenReaderOnly", {}), getI18nText("completedStep")), /* @__PURE__ */ React.createElement(SStepNumber, _ref0.cn("SStepNumber", {
|
|
282
287
|
"aria-hidden": "true"
|
|
283
288
|
}), completed ? /* @__PURE__ */ React.createElement(SCompleted, _ref0.cn("SCompleted", {})) : number), /* @__PURE__ */ React.createElement(SStepDescription, _ref0.cn("SStepDescription", {}), /* @__PURE__ */ React.createElement(Children, _ref0.cn("Children", {}))));
|
|
284
289
|
}
|
|
290
|
+
Stepper.enhance = [keyboardFocusEnhance()];
|
|
285
291
|
function Content(props) {
|
|
286
292
|
var _ref4 = arguments[0], _ref1;
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
return _ref1 = sstyled(styles), /* @__PURE__ */ React.createElement(SContent, _ref1.cn("SContent", {
|
|
293
|
-
...assignProps({
|
|
294
|
-
"role": "tabpanel"
|
|
295
|
-
}, _ref4)
|
|
296
|
-
}), /* @__PURE__ */ React.createElement(Children, _ref1.cn("Children", {})));
|
|
293
|
+
var Children = props.Children, styles = props.styles;
|
|
294
|
+
var SContent = Box;
|
|
295
|
+
return _ref1 = sstyled(styles), /* @__PURE__ */ React.createElement(SContent, _ref1.cn("SContent", _objectSpread({}, assignProps({
|
|
296
|
+
"role": "tabpanel"
|
|
297
|
+
}, _ref4))), /* @__PURE__ */ React.createElement(Children, _ref1.cn("Children", {})));
|
|
297
298
|
}
|
|
298
299
|
function StepBack(props) {
|
|
299
300
|
var _ref5 = arguments[0], _ref10;
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
getI18nText,
|
|
306
|
-
stepName
|
|
307
|
-
} = props;
|
|
308
|
-
const handleClick = React.useCallback(() => {
|
|
309
|
-
var _a;
|
|
310
|
-
(_a = props.onActive) == null ? void 0 : _a.call(props, props.step - 1);
|
|
301
|
+
var SStepBack = Button;
|
|
302
|
+
var Children = props.Children, hasChildren = props.children, styles = props.styles, getI18nText = props.getI18nText, stepName = props.stepName;
|
|
303
|
+
var handleClick = React.useCallback(function() {
|
|
304
|
+
var _props$onActive;
|
|
305
|
+
(_props$onActive = props.onActive) === null || _props$onActive === void 0 || _props$onActive.call(props, props.step - 1);
|
|
311
306
|
}, [props.step]);
|
|
312
|
-
return _ref10 = sstyled(styles), /* @__PURE__ */ React.createElement(SStepBack, _ref10.cn("SStepBack", {
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
}, _ref5)
|
|
321
|
-
}), /* @__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));
|
|
307
|
+
return _ref10 = sstyled(styles), /* @__PURE__ */ React.createElement(SStepBack, _ref10.cn("SStepBack", _objectSpread({}, assignProps({
|
|
308
|
+
"use": "tertiary",
|
|
309
|
+
"size": "l",
|
|
310
|
+
"onClick": handleClick,
|
|
311
|
+
"aria-label": getI18nText("backButton", {
|
|
312
|
+
buttonName: stepName
|
|
313
|
+
})
|
|
314
|
+
}, _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));
|
|
322
315
|
}
|
|
323
316
|
function StepNext(props) {
|
|
324
317
|
var _ref6 = arguments[0], _ref11;
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
getI18nText,
|
|
331
|
-
stepName
|
|
332
|
-
} = props;
|
|
333
|
-
const handleClick = React.useCallback(() => {
|
|
334
|
-
var _a;
|
|
335
|
-
(_a = props.onActive) == null ? void 0 : _a.call(props, props.step + 1);
|
|
318
|
+
var SStepNext = Button;
|
|
319
|
+
var Children = props.Children, hasChildren = props.children, styles = props.styles, getI18nText = props.getI18nText, stepName = props.stepName;
|
|
320
|
+
var handleClick = React.useCallback(function() {
|
|
321
|
+
var _props$onActive2;
|
|
322
|
+
(_props$onActive2 = props.onActive) === null || _props$onActive2 === void 0 || _props$onActive2.call(props, props.step + 1);
|
|
336
323
|
}, [props.step]);
|
|
337
|
-
return _ref11 = sstyled(styles), /* @__PURE__ */ React.createElement(SStepNext, _ref11.cn("SStepNext", {
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
}, _ref6)
|
|
346
|
-
}), /* @__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", {}))));
|
|
324
|
+
return _ref11 = sstyled(styles), /* @__PURE__ */ React.createElement(SStepNext, _ref11.cn("SStepNext", _objectSpread({}, assignProps({
|
|
325
|
+
"use": "tertiary",
|
|
326
|
+
"size": "l",
|
|
327
|
+
"onClick": handleClick,
|
|
328
|
+
"aria-label": getI18nText("nextButton", {
|
|
329
|
+
buttonName: stepName
|
|
330
|
+
})
|
|
331
|
+
}, _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", {}))));
|
|
347
332
|
}
|
|
348
|
-
|
|
333
|
+
var Wizard = createComponent(WizardRoot, {
|
|
349
334
|
Sidebar,
|
|
350
335
|
Content,
|
|
351
336
|
Step,
|
|
@@ -353,7 +338,9 @@ const Wizard = createComponent(WizardRoot, {
|
|
|
353
338
|
StepBack,
|
|
354
339
|
StepNext
|
|
355
340
|
});
|
|
356
|
-
|
|
341
|
+
var wrapWizardStepper = function wrapWizardStepper2(wrapper) {
|
|
342
|
+
return wrapper;
|
|
343
|
+
};
|
|
357
344
|
export {
|
|
358
345
|
Wizard as default,
|
|
359
346
|
wrapWizardStepper
|