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