@semcore/wizard 16.0.0-prerelease.2 → 16.0.0-prerelease.20

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