@semcore/wizard 2.53.0-prerelease.2 → 16.0.0-prerelease.10

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.
@@ -1,94 +1,107 @@
1
- import v from "@babel/runtime/helpers/esm/objectSpread2";
2
- import I from "@babel/runtime/helpers/esm/classCallCheck";
3
- import D from "@babel/runtime/helpers/esm/createClass";
4
- import u from "@babel/runtime/helpers/esm/assertThisInitialized";
5
- import W from "@babel/runtime/helpers/esm/inherits";
6
- import B from "@babel/runtime/helpers/esm/createSuper";
7
- import p from "@babel/runtime/helpers/esm/defineProperty";
8
- import { sstyled as M } from "@semcore/utils/lib/core/index";
9
- import F, { sstyled as h, Component as H, assignProps as S } from "@semcore/core";
10
- import a from "react";
11
- import { ScreenReaderOnly as $, Box as b } from "@semcore/flex-box";
12
- import U from "@semcore/modal";
13
- import K from "@semcore/icon/Check/m";
14
- import L from "@semcore/utils/lib/enhances/keyboardFocusEnhance";
15
- import O from "@semcore/utils/lib/enhances/i18nEnhance";
16
- import { localizedMessages as P } from "./translations/__intergalactic-dynamic-locales.mjs";
17
- import { setFocus as j } from "@semcore/utils/lib/use/useFocusLock";
18
- import q from "@semcore/utils/lib/uniqueID";
19
- import m from "@semcore/button";
20
- import G from "@semcore/icon/ArrowRight/m";
21
- import J from "@semcore/icon/ArrowLeft/m";
22
- var Q = (
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 _assertThisInitialized from "@babel/runtime/helpers/esm/assertThisInitialized";
5
+ import _inherits from "@babel/runtime/helpers/esm/inherits";
6
+ import _createSuper from "@babel/runtime/helpers/esm/createSuper";
7
+ import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
8
+ import { sstyled, createComponent, Component, assignProps } from "@semcore/core";
9
+ import React from "react";
10
+ import { ScreenReaderOnly, Box } from "@semcore/flex-box";
11
+ import Modal from "@semcore/modal";
12
+ import CheckM from "@semcore/icon/Check/m";
13
+ import keyboardFocusEnhance from "@semcore/core/lib/utils/enhances/keyboardFocusEnhance";
14
+ import i18nEnhance from "@semcore/core/lib/utils/enhances/i18nEnhance";
15
+ import { localizedMessages } from "./translations/__intergalactic-dynamic-locales.mjs";
16
+ import { setFocus } from "@semcore/core/lib/utils/use/useFocusLock";
17
+ import uniqueIDEnhancement from "@semcore/core/lib/utils/uniqueID";
18
+ import Button from "@semcore/button";
19
+ import ArrowRight from "@semcore/icon/ArrowRight/m";
20
+ import ArrowLeft from "@semcore/icon/ArrowLeft/m";
21
+ var style = (
23
22
  /*__reshadow_css_start__*/
24
- (M.insert(
23
+ (sstyled.insert(
25
24
  /*__inner_css_start__*/
26
- ".___SWizard_lo8zs_gg_{max-width:980px;max-height:700px;display:flex;padding:0;background:0 0}.___SSidebar_lo8zs_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) calc(var(--intergalactic-spacing-8x, 32px) + var(--intergalactic-spacing-05x, 2px));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_lo8zs_gg_{width:44px}}.___SSidebarHeader_lo8zs_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_lo8zs_gg_{display:none}}.___SStepper_lo8zs_gg_{display:flex;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%)}@media (hover:hover){.___SStepper_lo8zs_gg_:hover{background:var(--intergalactic-control-primary-advertising-hover, #421983);z-index:1}}.___SStepper_lo8zs_gg_.__active_lo8zs_gg_{background:var(--intergalactic-control-primary-advertising-active, #8649e1)}.___SStepper_lo8zs_gg_.__disabled_lo8zs_gg_,.___SStepper_lo8zs_gg_:disabled{opacity:var(--intergalactic-disabled-opacity, 0.3);cursor:default;pointer-events:none}@media (max-width:1060px){.___SStepper_lo8zs_gg_{padding:var(--intergalactic-spacing-2x, 8px) var(--intergalactic-spacing-1x, 4px)}@media (hover:hover){.___SStepper_lo8zs_gg_:hover{width:-moz-fit-content;width:fit-content;max-width:220px}.___SStepper_lo8zs_gg_:hover .___SStepDescription_lo8zs_gg_{display:block;border-radius:var(--intergalactic-control-rounded, 6px);white-space:nowrap;overflow:auto}.___SStepper_lo8zs_gg_.__active_lo8zs_gg_:hover .___SStepDescription_lo8zs_gg_{background:var(--intergalactic-control-primary-advertising-active, #8649e1)}}}.___SStepNumber_lo8zs_gg_{display:inline-block;min-width:20px}.___SCompleted_lo8zs_gg_{margin-top:1px}@media (max-width:1060px){.___SStepDescription_lo8zs_gg_{display:none}}.___SContent_lo8zs_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)}.___SSidebarMenu_lo8zs_gg_{display:contents}",
27
- "lo8zs_gg_"
25
+ ".___SWizard_1gak9_gg_{max-width:980px;max-height:700px;display:flex;padding:0;background:0 0}.___SSidebar_1gak9_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) calc(var(--intergalactic-spacing-8x, 32px) + var(--intergalactic-spacing-05x, 2px));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_1gak9_gg_{width:44px}}.___SSidebarHeader_1gak9_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_1gak9_gg_{display:none}}.___SStepper_1gak9_gg_{display:flex;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%)}.___SStepper_1gak9_gg_:focus-visible{outline-color:var(--intergalactic-keyboard-focus-outline-invert, rgba(255, 255, 255, 0.7))}@media (hover:hover){.___SStepper_1gak9_gg_:hover{background:var(--intergalactic-control-primary-advertising-hover, #421983);z-index:1}}.___SStepper_1gak9_gg_.__active_1gak9_gg_{background:var(--intergalactic-control-primary-advertising-active, #8649e1)}.___SStepper_1gak9_gg_.__disabled_1gak9_gg_,.___SStepper_1gak9_gg_:disabled{opacity:var(--intergalactic-disabled-opacity, 0.3);cursor:default;pointer-events:none}@media (max-width:1060px){.___SStepper_1gak9_gg_{padding:var(--intergalactic-spacing-2x, 8px) var(--intergalactic-spacing-1x, 4px)}@media (hover:hover){.___SStepper_1gak9_gg_:hover{width:-moz-fit-content;width:fit-content;max-width:220px}.___SStepper_1gak9_gg_:hover .___SStepDescription_1gak9_gg_{display:block;border-radius:var(--intergalactic-control-rounded, 6px);white-space:nowrap;overflow:auto}.___SStepper_1gak9_gg_.__active_1gak9_gg_:hover .___SStepDescription_1gak9_gg_{background:var(--intergalactic-control-primary-advertising-active, #8649e1)}}}.___SStepNumber_1gak9_gg_{display:inline-block;min-width:20px}.___SCompleted_1gak9_gg_{margin-top:1px}@media (max-width:1060px){.___SStepDescription_1gak9_gg_{display:none}}.___SContent_1gak9_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)}.___SSidebarMenu_1gak9_gg_{display:contents}",
26
+ "1gak9_gg_"
28
27
  ), {
29
- __SWizard: "___SWizard_lo8zs_gg_",
30
- __SStepNumber: "___SStepNumber_lo8zs_gg_",
31
- __SCompleted: "___SCompleted_lo8zs_gg_",
32
- __SContent: "___SContent_lo8zs_gg_",
33
- __SSidebarMenu: "___SSidebarMenu_lo8zs_gg_",
34
- __SSidebar: "___SSidebar_lo8zs_gg_",
35
- __SSidebarHeader: "___SSidebarHeader_lo8zs_gg_",
36
- __SStepper: "___SStepper_lo8zs_gg_",
37
- _active: "__active_lo8zs_gg_",
38
- _disabled: "__disabled_lo8zs_gg_",
39
- __SStepDescription: "___SStepDescription_lo8zs_gg_"
28
+ "__SWizard": "___SWizard_1gak9_gg_",
29
+ "__SStepNumber": "___SStepNumber_1gak9_gg_",
30
+ "__SCompleted": "___SCompleted_1gak9_gg_",
31
+ "__SContent": "___SContent_1gak9_gg_",
32
+ "__SSidebarMenu": "___SSidebarMenu_1gak9_gg_",
33
+ "__SSidebar": "___SSidebar_1gak9_gg_",
34
+ "__SSidebarHeader": "___SSidebarHeader_1gak9_gg_",
35
+ "__SStepper": "___SStepper_1gak9_gg_",
36
+ "_active": "__active_1gak9_gg_",
37
+ "_disabled": "__disabled_1gak9_gg_",
38
+ "__SStepDescription": "___SStepDescription_1gak9_gg_"
40
39
  })
41
- ), f = /* @__PURE__ */ function(e) {
42
- W(t, e);
43
- var _ = B(t);
44
- function t() {
45
- var r;
46
- I(this, t);
47
- for (var i = arguments.length, n = new Array(i), o = 0; o < i; o++)
48
- n[o] = arguments[o];
49
- return r = _.call.apply(_, [this].concat(n)), p(u(r), "_steps", /* @__PURE__ */ new Map()), p(u(r), "modalRef", /* @__PURE__ */ a.createRef()), p(u(r), "contentRef", /* @__PURE__ */ a.createRef()), p(u(r), "state", {
40
+ );
41
+ var WizardRoot = /* @__PURE__ */ function(_Component) {
42
+ _inherits(WizardRoot2, _Component);
43
+ var _super = _createSuper(WizardRoot2);
44
+ function WizardRoot2() {
45
+ var _this;
46
+ _classCallCheck(this, WizardRoot2);
47
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
48
+ args[_key] = arguments[_key];
49
+ }
50
+ _this = _super.call.apply(_super, [this].concat(args));
51
+ _defineProperty(_assertThisInitialized(_this), "_steps", /* @__PURE__ */ new Map());
52
+ _defineProperty(_assertThisInitialized(_this), "modalRef", /* @__PURE__ */ React.createRef());
53
+ _defineProperty(_assertThisInitialized(_this), "contentRef", /* @__PURE__ */ React.createRef());
54
+ _defineProperty(_assertThisInitialized(_this), "state", {
50
55
  highlighted: null
51
- }), p(u(r), "stepperRefs", []), p(u(r), "stepperFocusPrev", function(s) {
56
+ });
57
+ _defineProperty(_assertThisInitialized(_this), "stepperRefs", []);
58
+ _defineProperty(_assertThisInitialized(_this), "stepperFocusPrev", function(i) {
52
59
  return function() {
53
- var l = r._steps.get(s);
54
- l && (r.setState({
55
- highlighted: l == null ? void 0 : l.step
56
- }), setTimeout(function() {
57
- var c;
58
- (c = r.stepperRefs[s - 1]) === null || c === void 0 || c.focus();
59
- }, 0));
60
+ var prevStep = _this._steps.get(i);
61
+ if (!prevStep) return;
62
+ _this.setState({
63
+ highlighted: prevStep === null || prevStep === void 0 ? void 0 : prevStep.step
64
+ });
65
+ setTimeout(function() {
66
+ var _this$stepperRefs;
67
+ (_this$stepperRefs = _this.stepperRefs[i - 1]) === null || _this$stepperRefs === void 0 ? void 0 : _this$stepperRefs.focus();
68
+ }, 0);
60
69
  };
61
- }), p(u(r), "stepperFocusNext", function(s) {
70
+ });
71
+ _defineProperty(_assertThisInitialized(_this), "stepperFocusNext", function(i) {
62
72
  return function() {
63
- var l = r._steps.get(s + 2);
64
- l && (r.setState({
65
- highlighted: l == null ? void 0 : l.step
66
- }), setTimeout(function() {
67
- var c;
68
- (c = r.stepperRefs[s + 1]) === null || c === void 0 || c.focus();
69
- }, 0));
73
+ var nextStep = _this._steps.get(i + 2);
74
+ if (!nextStep) return;
75
+ _this.setState({
76
+ highlighted: nextStep === null || nextStep === void 0 ? void 0 : nextStep.step
77
+ });
78
+ setTimeout(function() {
79
+ var _this$stepperRefs2;
80
+ (_this$stepperRefs2 = _this.stepperRefs[i + 1]) === null || _this$stepperRefs2 === void 0 ? void 0 : _this$stepperRefs2.focus();
81
+ }, 0);
70
82
  };
71
- }), r;
83
+ });
84
+ return _this;
72
85
  }
73
- return D(t, [{
86
+ _createClass(WizardRoot2, [{
74
87
  key: "getStepProps",
75
- value: function(i) {
88
+ value: function getStepProps(props) {
76
89
  return {
77
90
  steps: this._steps,
78
- active: i.step === this.asProps.step,
79
- id: "".concat(this.asProps.uid, "-step-").concat(i.step)
91
+ active: props.step === this.asProps.step,
92
+ id: "".concat(this.asProps.uid, "-step-").concat(props.step)
80
93
  };
81
94
  }
82
95
  }, {
83
96
  key: "getSidebarProps",
84
- value: function() {
97
+ value: function getSidebarProps() {
85
98
  return {
86
99
  uid: this.asProps.uid
87
100
  };
88
101
  }
89
102
  }, {
90
103
  key: "getContentProps",
91
- value: function() {
104
+ value: function getContentProps() {
92
105
  return {
93
106
  uid: this.asProps.uid,
94
107
  step: this.asProps.step,
@@ -97,7 +110,7 @@ var Q = (
97
110
  }
98
111
  }, {
99
112
  key: "getStepBackProps",
100
- value: function() {
113
+ value: function getStepBackProps() {
101
114
  return {
102
115
  getI18nText: this.asProps.getI18nText,
103
116
  step: this.asProps.step
@@ -105,7 +118,7 @@ var Q = (
105
118
  }
106
119
  }, {
107
120
  key: "getStepNextProps",
108
- value: function() {
121
+ value: function getStepNextProps() {
109
122
  return {
110
123
  getI18nText: this.asProps.getI18nText,
111
124
  step: this.asProps.step
@@ -113,146 +126,190 @@ var Q = (
113
126
  }
114
127
  }, {
115
128
  key: "getStepperProps",
116
- value: function(i, n) {
117
- var o = this, s = n + 1;
118
- if (this._steps.has(i.step)) {
119
- var l = this._steps.get(i.step);
120
- s = l.number;
121
- } else
122
- this._steps.set(i.step, v({
123
- number: s
124
- }, i));
125
- var c = i.step === this.asProps.step, d = this.state.highlighted === i.step || this.state.highlighted === null && n === 0;
129
+ value: function getStepperProps(props, i) {
130
+ var _this2 = this;
131
+ var number = i + 1;
132
+ if (this._steps.has(props.step)) {
133
+ var step = this._steps.get(props.step);
134
+ number = step.number;
135
+ } else {
136
+ this._steps.set(props.step, _objectSpread({
137
+ number
138
+ }, props));
139
+ }
140
+ var active = props.step === this.asProps.step;
141
+ var highlighted = this.state.highlighted === props.step || this.state.highlighted === null && i === 0;
126
142
  return {
127
- active: c,
128
- tabIndex: d ? 0 : -1,
129
- number: s,
143
+ active,
144
+ tabIndex: highlighted ? 0 : -1,
145
+ number,
130
146
  getI18nText: this.asProps.getI18nText,
131
147
  uid: this.asProps.uid,
132
- ref: function(x) {
133
- o.stepperRefs[n] = x;
148
+ ref: function ref(node) {
149
+ _this2.stepperRefs[i] = node;
134
150
  },
135
- focusNext: this.stepperFocusNext(n),
136
- focusPrev: this.stepperFocusPrev(n)
151
+ focusNext: this.stepperFocusNext(i),
152
+ focusPrev: this.stepperFocusPrev(i)
137
153
  };
138
154
  }
139
155
  }, {
140
156
  key: "componentDidUpdate",
141
- value: function(i) {
142
- var n = this;
143
- i.step !== this.asProps.step && (this.setState({
157
+ value: function componentDidUpdate(prevProps) {
158
+ var _this3 = this;
159
+ if (prevProps.step === this.asProps.step) return;
160
+ this.setState({
144
161
  highlighted: this.asProps.step || null
145
- }), setTimeout(function() {
146
- i.step !== n.asProps.step && j(n.contentRef.current);
147
- }, 1));
162
+ });
163
+ setTimeout(function() {
164
+ if (prevProps.step === _this3.asProps.step) return;
165
+ setFocus(_this3.contentRef.current);
166
+ }, 1);
148
167
  }
149
168
  }, {
150
169
  key: "render",
151
- value: function() {
152
- var i, n = this.Root, o = this.asProps, s = o.Children, l = o.styles, c = o.uid;
153
- return this._steps.clear(), i = h(l), /* @__PURE__ */ a.createElement(n, i.cn("SWizard", {
154
- render: U,
170
+ value: function render() {
171
+ var _ref7;
172
+ var SWizard = this.Root;
173
+ var _this$asProps = this.asProps, Children = _this$asProps.Children, styles = _this$asProps.styles, uid = _this$asProps.uid;
174
+ this._steps.clear();
175
+ return _ref7 = sstyled(styles), /* @__PURE__ */ React.createElement(SWizard, _ref7.cn("SWizard", {
176
+ "render": Modal,
155
177
  "aria-label": void 0,
156
- ref: this.modalRef,
157
- "aria-labelledby": "".concat(c, "-title")
158
- }), /* @__PURE__ */ a.createElement(s, i.cn("Children", {})));
178
+ "ref": this.modalRef,
179
+ "aria-labelledby": "".concat(uid, "-title")
180
+ }), /* @__PURE__ */ React.createElement(Children, _ref7.cn("Children", {})));
159
181
  }
160
- }]), t;
161
- }(H);
162
- p(f, "displayName", "Wizard");
163
- p(f, "style", Q);
164
- p(f, "enhance", [O(P), q()]);
165
- p(f, "defaultProps", {
182
+ }]);
183
+ return WizardRoot2;
184
+ }(Component);
185
+ _defineProperty(WizardRoot, "displayName", "Wizard");
186
+ _defineProperty(WizardRoot, "style", style);
187
+ _defineProperty(WizardRoot, "enhance", [i18nEnhance(localizedMessages), uniqueIDEnhancement()]);
188
+ _defineProperty(WizardRoot, "defaultProps", {
166
189
  step: null,
167
- i18n: P,
190
+ i18n: localizedMessages,
168
191
  locale: "en"
169
192
  });
170
- function V(e) {
171
- var _ = arguments[0], t, r = e.Children, i = e.styles, n = e.title, o = e.uid, s = b, l = "h2", c = "div";
172
- return a.useCallback(function(d) {
173
- }, []), t = h(i), /* @__PURE__ */ a.createElement(s, t.cn("SSidebar", v({}, S({
174
- __excludeProps: ["title"]
175
- }, _))), n && /* @__PURE__ */ a.createElement(l, t.cn("SSidebarHeader", {
176
- id: "".concat(o, "-title")
177
- }), n), /* @__PURE__ */ a.createElement(c, t.cn("SSidebarMenu", {
178
- role: "tablist",
193
+ function Sidebar(props) {
194
+ var _ref = arguments[0], _ref8;
195
+ var Children = props.Children, styles = props.styles, title = props.title, uid = props.uid;
196
+ var SSidebar = Box;
197
+ var SSidebarHeader = "h2";
198
+ var SSidebarMenu = "div";
199
+ React.useCallback(function(e) {
200
+ }, []);
201
+ return _ref8 = sstyled(styles), /* @__PURE__ */ React.createElement(SSidebar, _ref8.cn("SSidebar", _objectSpread({}, assignProps({
202
+ "__excludeProps": ["title"]
203
+ }, _ref))), title && /* @__PURE__ */ React.createElement(SSidebarHeader, _ref8.cn("SSidebarHeader", {
204
+ "id": "".concat(uid, "-title")
205
+ }), title), /* @__PURE__ */ React.createElement(SSidebarMenu, _ref8.cn("SSidebarMenu", {
206
+ "role": "tablist",
179
207
  "aria-orientation": "vertical"
180
- }), /* @__PURE__ */ a.createElement(r, t.cn("Children", {}))));
208
+ }), /* @__PURE__ */ React.createElement(Children, _ref8.cn("Children", {}))));
181
209
  }
182
- function X(e) {
183
- var _ = arguments[0], t = b, r = e.Children, i = e.styles, n = e.active;
184
- if (n) {
185
- var o;
186
- return o = h(i), /* @__PURE__ */ a.createElement(t, o.cn("SStep", v({}, S({}, _))), /* @__PURE__ */ a.createElement(r, o.cn("Children", {})));
210
+ function Step(props) {
211
+ var _ref2 = arguments[0];
212
+ var SStep = Box;
213
+ var Children = props.Children, styles = props.styles, active = props.active;
214
+ if (active) {
215
+ var _ref9;
216
+ return _ref9 = sstyled(styles), /* @__PURE__ */ React.createElement(SStep, _ref9.cn("SStep", _objectSpread({}, assignProps({}, _ref2))), /* @__PURE__ */ React.createElement(Children, _ref9.cn("Children", {})));
187
217
  }
188
218
  return null;
189
219
  }
190
- function k(e) {
191
- var _ = arguments[0], t, r = e.Children, i = e.styles, n = e.step, o = e.active, s = e.onActive, l = e.completed, c = e.disabled, d = e.number, z = e.getI18nText, x = e.uid, y = e.focusNext, C = e.focusPrev, w = b, E = "span", N = "span", R = K, T = a.useCallback(function(g) {
192
- s && s(n, g);
193
- }, [n, s]), A = a.useCallback(function(g) {
194
- s && (g.key === "Enter" || g.key === " ") && (g.preventDefault(), s(n, g)), g.key === "ArrowUp" && (C(), g.stopPropagation()), g.key === "ArrowDown" && (y(), g.stopPropagation());
195
- }, [n, s, C, y]);
196
- return t = h(i), /* @__PURE__ */ a.createElement(w, t.cn("SStepper", v({}, S({
197
- role: "tab",
198
- id: "".concat(x, "-stepper-").concat(n),
199
- "aria-controls": o ? "".concat(x, "-content-").concat(n) : void 0,
200
- "aria-disabled": c,
201
- "aria-selected": o,
202
- onClick: T,
203
- onKeyDown: A
204
- }, _))), l && /* @__PURE__ */ a.createElement($, t.cn("ScreenReaderOnly", {}), z("completedStep")), /* @__PURE__ */ a.createElement(E, t.cn("SStepNumber", {
220
+ function Stepper(props) {
221
+ var _ref3 = arguments[0], _ref10;
222
+ var Children = props.Children, styles = props.styles, step = props.step, active = props.active, onActive = props.onActive, completed = props.completed, disabled = props.disabled, number = props.number, getI18nText = props.getI18nText, uid = props.uid, focusNext = props.focusNext, focusPrev = props.focusPrev;
223
+ var SStepper = Box;
224
+ var SStepNumber = "span";
225
+ var SStepDescription = "span";
226
+ var SCompleted = CheckM;
227
+ var handlerClick = React.useCallback(function(e) {
228
+ if (onActive) onActive(step, e);
229
+ }, [step, onActive]);
230
+ var handlerKeyDown = React.useCallback(function(e) {
231
+ if (onActive && (e.key === "Enter" || e.key === " ")) {
232
+ e.preventDefault();
233
+ onActive(step, e);
234
+ }
235
+ if (e.key === "ArrowUp") {
236
+ focusPrev();
237
+ e.stopPropagation();
238
+ }
239
+ if (e.key === "ArrowDown") {
240
+ focusNext();
241
+ e.stopPropagation();
242
+ }
243
+ }, [step, onActive, focusPrev, focusNext]);
244
+ return _ref10 = sstyled(styles), /* @__PURE__ */ React.createElement(SStepper, _ref10.cn("SStepper", _objectSpread({}, assignProps({
245
+ "role": "tab",
246
+ "id": "".concat(uid, "-stepper-").concat(step),
247
+ "aria-controls": active ? "".concat(uid, "-content-").concat(step) : void 0,
248
+ "aria-disabled": disabled,
249
+ "aria-selected": active,
250
+ "onClick": handlerClick,
251
+ "onKeyDown": handlerKeyDown
252
+ }, _ref3))), completed && /* @__PURE__ */ React.createElement(ScreenReaderOnly, _ref10.cn("ScreenReaderOnly", {}), getI18nText("completedStep")), /* @__PURE__ */ React.createElement(SStepNumber, _ref10.cn("SStepNumber", {
205
253
  "aria-hidden": "true"
206
- }), l ? /* @__PURE__ */ a.createElement(R, t.cn("SCompleted", {})) : d), /* @__PURE__ */ a.createElement(N, t.cn("SStepDescription", {}), /* @__PURE__ */ a.createElement(r, t.cn("Children", {}))));
254
+ }), completed ? /* @__PURE__ */ React.createElement(SCompleted, _ref10.cn("SCompleted", {})) : number), /* @__PURE__ */ React.createElement(SStepDescription, _ref10.cn("SStepDescription", {}), /* @__PURE__ */ React.createElement(Children, _ref10.cn("Children", {}))));
207
255
  }
208
- k.enhance = [L()];
209
- function Y(e) {
210
- var _ = arguments[0], t, r = e.Children, i = e.children, n = e.styles, o = e.uid, s = e.step, l = b;
211
- return t = h(n), /* @__PURE__ */ a.createElement(l, t.cn("SContent", v({}, S({
212
- role: "tabpanel",
213
- "aria-labelledby": "".concat(o, "-stepper-").concat(s),
214
- id: "".concat(o, "-content-").concat(s)
215
- }, _))), i ? /* @__PURE__ */ a.createElement(r, t.cn("Children", {})) : stepName);
256
+ Stepper.enhance = [keyboardFocusEnhance()];
257
+ function Content(props) {
258
+ var _ref4 = arguments[0], _ref11;
259
+ var Children = props.Children, hasChildren = props.children, styles = props.styles, uid = props.uid, step = props.step;
260
+ var SContent = Box;
261
+ return _ref11 = sstyled(styles), /* @__PURE__ */ React.createElement(SContent, _ref11.cn("SContent", _objectSpread({}, assignProps({
262
+ "role": "tabpanel",
263
+ "aria-labelledby": "".concat(uid, "-stepper-").concat(step),
264
+ "id": "".concat(uid, "-content-").concat(step)
265
+ }, _ref4))), hasChildren ? /* @__PURE__ */ React.createElement(Children, _ref11.cn("Children", {})) : stepName);
216
266
  }
217
- function Z(e) {
218
- var _ = arguments[0], t, r = m, i = e.Children, n = e.children, o = e.styles, s = e.getI18nText, l = e.stepName, c = a.useCallback(function() {
219
- var d;
220
- (d = e.onActive) === null || d === void 0 || d.call(e, e.step - 1);
221
- }, [e.step]);
222
- return t = h(o), /* @__PURE__ */ a.createElement(r, t.cn("SStepBack", v({}, S({
223
- use: "tertiary",
224
- size: "l",
225
- onClick: c,
226
- "aria-label": s("backButton", {
227
- buttonName: l
267
+ function StepBack(props) {
268
+ var _ref5 = arguments[0], _ref12;
269
+ var SStepBack = Button;
270
+ var Children = props.Children, hasChildren = props.children, styles = props.styles, getI18nText = props.getI18nText, stepName2 = props.stepName;
271
+ var handleClick = React.useCallback(function() {
272
+ var _props$onActive;
273
+ (_props$onActive = props.onActive) === null || _props$onActive === void 0 ? void 0 : _props$onActive.call(props, props.step - 1);
274
+ }, [props.step]);
275
+ return _ref12 = sstyled(styles), /* @__PURE__ */ React.createElement(SStepBack, _ref12.cn("SStepBack", _objectSpread({}, assignProps({
276
+ "use": "tertiary",
277
+ "size": "l",
278
+ "onClick": handleClick,
279
+ "aria-label": getI18nText("backButton", {
280
+ buttonName: stepName2
228
281
  })
229
- }, _))), /* @__PURE__ */ a.createElement(m.Addon, null, /* @__PURE__ */ a.createElement(J, t.cn("ArrowLeft", {}))), /* @__PURE__ */ a.createElement(m.Text, null, n ? /* @__PURE__ */ a.createElement(i, t.cn("Children", {})) : l));
282
+ }, _ref5))), /* @__PURE__ */ React.createElement(Button.Addon, null, /* @__PURE__ */ React.createElement(ArrowLeft, _ref12.cn("ArrowLeft", {}))), /* @__PURE__ */ React.createElement(Button.Text, null, hasChildren ? /* @__PURE__ */ React.createElement(Children, _ref12.cn("Children", {})) : stepName2));
230
283
  }
231
- function ee(e) {
232
- var _ = arguments[0], t, r = m, i = e.Children, n = e.children, o = e.styles, s = e.getI18nText, l = e.stepName, c = a.useCallback(function() {
233
- var d;
234
- (d = e.onActive) === null || d === void 0 || d.call(e, e.step + 1);
235
- }, [e.step]);
236
- return t = h(o), /* @__PURE__ */ a.createElement(r, t.cn("SStepNext", v({}, S({
237
- use: "tertiary",
238
- size: "l",
239
- onClick: c,
240
- "aria-label": s("nextButton", {
241
- buttonName: l
284
+ function StepNext(props) {
285
+ var _ref6 = arguments[0], _ref13;
286
+ var SStepNext = Button;
287
+ var Children = props.Children, hasChildren = props.children, styles = props.styles, getI18nText = props.getI18nText, stepName2 = props.stepName;
288
+ var handleClick = React.useCallback(function() {
289
+ var _props$onActive2;
290
+ (_props$onActive2 = props.onActive) === null || _props$onActive2 === void 0 ? void 0 : _props$onActive2.call(props, props.step + 1);
291
+ }, [props.step]);
292
+ return _ref13 = sstyled(styles), /* @__PURE__ */ React.createElement(SStepNext, _ref13.cn("SStepNext", _objectSpread({}, assignProps({
293
+ "use": "tertiary",
294
+ "size": "l",
295
+ "onClick": handleClick,
296
+ "aria-label": getI18nText("nextButton", {
297
+ buttonName: stepName2
242
298
  })
243
- }, _))), /* @__PURE__ */ a.createElement(m.Text, null, n ? /* @__PURE__ */ a.createElement(i, t.cn("Children", {})) : l), /* @__PURE__ */ a.createElement(m.Addon, null, /* @__PURE__ */ a.createElement(G, t.cn("ArrowRight", {}))));
299
+ }, _ref6))), /* @__PURE__ */ React.createElement(Button.Text, null, hasChildren ? /* @__PURE__ */ React.createElement(Children, _ref13.cn("Children", {})) : stepName2), /* @__PURE__ */ React.createElement(Button.Addon, null, /* @__PURE__ */ React.createElement(ArrowRight, _ref13.cn("ArrowRight", {}))));
244
300
  }
245
- var ze = F(f, {
246
- Sidebar: V,
247
- Content: Y,
248
- Step: X,
249
- Stepper: k,
250
- StepBack: Z,
251
- StepNext: ee
252
- }), ye = function(_) {
253
- return _;
301
+ var Wizard = createComponent(WizardRoot, {
302
+ Sidebar,
303
+ Content,
304
+ Step,
305
+ Stepper,
306
+ StepBack,
307
+ StepNext
308
+ });
309
+ var wrapWizardStepper = function wrapWizardStepper2(wrapper) {
310
+ return wrapper;
254
311
  };
255
312
  export {
256
- ze as default,
257
- ye as wrapWizardStepper
313
+ Wizard as default,
314
+ wrapWizardStepper
258
315
  };
package/lib/esm/index.mjs CHANGED
@@ -1,5 +1,5 @@
1
- import { default as p, wrapWizardStepper as a } from "./Wizard.mjs";
1
+ import { default as default2, wrapWizardStepper } from "./Wizard.mjs";
2
2
  export {
3
- p as default,
4
- a as wrapWizardStepper
3
+ default2 as default,
4
+ wrapWizardStepper
5
5
  };
@@ -1,33 +1,33 @@
1
- import r from "./de.json.mjs";
2
- import o from "./en.json.mjs";
3
- import m from "./es.json.mjs";
4
- import t from "./fr.json.mjs";
5
- import i from "./it.json.mjs";
6
- import p from "./ja.json.mjs";
7
- import f from "./ko.json.mjs";
8
- import e from "./nl.json.mjs";
9
- import s from "./pt.json.mjs";
10
- import a from "./tr.json.mjs";
11
- import l from "./vi.json.mjs";
12
- import v from "./zh.json.mjs";
13
- import d from "./pl.json.mjs";
14
- import n from "./sv.json.mjs";
15
- var B = {
16
- de: r,
17
- en: o,
18
- es: m,
19
- fr: t,
20
- it: i,
21
- ja: p,
22
- ko: f,
23
- nl: e,
24
- pt: s,
25
- tr: a,
26
- vi: l,
27
- zh: v,
28
- pl: d,
29
- sv: n
1
+ import de from "./de.json.mjs";
2
+ import en from "./en.json.mjs";
3
+ import es from "./es.json.mjs";
4
+ import fr from "./fr.json.mjs";
5
+ import it from "./it.json.mjs";
6
+ import ja from "./ja.json.mjs";
7
+ import ko from "./ko.json.mjs";
8
+ import nl from "./nl.json.mjs";
9
+ import pt from "./pt.json.mjs";
10
+ import tr from "./tr.json.mjs";
11
+ import vi from "./vi.json.mjs";
12
+ import zh from "./zh.json.mjs";
13
+ import pl from "./pl.json.mjs";
14
+ import sv from "./sv.json.mjs";
15
+ var localizedMessages = {
16
+ de,
17
+ en,
18
+ es,
19
+ fr,
20
+ it,
21
+ ja,
22
+ ko,
23
+ nl,
24
+ pt,
25
+ tr,
26
+ vi,
27
+ zh,
28
+ pl,
29
+ sv
30
30
  };
31
31
  export {
32
- B as localizedMessages
32
+ localizedMessages
33
33
  };
@@ -1,11 +1,14 @@
1
- const t = "Abgeschlossener Schritt", e = "Zurück zu {buttonName}", o = "Weiter zu {buttonName}", n = {
2
- completedStep: t,
3
- backButton: e,
4
- nextButton: o
1
+ const completedStep = "Abgeschlossener Schritt";
2
+ const backButton = "Zurück zu {buttonName}";
3
+ const nextButton = "Weiter zu {buttonName}";
4
+ const de = {
5
+ completedStep,
6
+ backButton,
7
+ nextButton
5
8
  };
6
9
  export {
7
- e as backButton,
8
- t as completedStep,
9
- n as default,
10
- o as nextButton
10
+ backButton,
11
+ completedStep,
12
+ de as default,
13
+ nextButton
11
14
  };
@@ -1,11 +1,14 @@
1
- const t = "Completed step", o = "Back to {buttonName}", e = "Go to {buttonName}", n = {
2
- completedStep: t,
3
- backButton: o,
4
- nextButton: e
1
+ const completedStep = "Completed step";
2
+ const backButton = "Back to {buttonName}";
3
+ const nextButton = "Go to {buttonName}";
4
+ const en = {
5
+ completedStep,
6
+ backButton,
7
+ nextButton
5
8
  };
6
9
  export {
7
- o as backButton,
8
- t as completedStep,
9
- n as default,
10
- e as nextButton
10
+ backButton,
11
+ completedStep,
12
+ en as default,
13
+ nextButton
11
14
  };