@itcase/storybook-config 1.2.75 → 1.2.78

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,11 +1,12 @@
1
- import React, { useEffect } from 'react';
1
+ import { useEffect } from 'react';
2
+ import { jsx } from 'react/jsx-runtime';
2
3
 
3
- var BACKEND_URL = process.env.EMAIL_URL;
4
+ let BACKEND_URL = process.env.EMAIL_URL;
4
5
  if (process.env.NODE_ENV === 'production' && process.env.REST_BASE_URL) {
5
- BACKEND_URL = "".concat(process.env.REST_BASE_URL, "/storybook");
6
+ BACKEND_URL = `${process.env.REST_BASE_URL}/storybook`;
6
7
  }
7
8
  function EmailTemplatePreview(props) {
8
- var style = {
9
+ const style = {
9
10
  width: '100%',
10
11
  height: '100%',
11
12
  border: '0',
@@ -18,24 +19,24 @@ function EmailTemplatePreview(props) {
18
19
  overflowX: 'hidden',
19
20
  overflowY: 'hidden'
20
21
  };
21
- useEffect(function () {
22
- var emailPreviewIframe = document.getElementById('emailPreview');
23
- var loaded = function loaded() {
24
- var email = emailPreviewIframe.getElementsByClassName('email-body').length;
22
+ useEffect(() => {
23
+ const emailPreviewIframe = document.getElementById('emailPreview');
24
+ const loaded = () => {
25
+ const email = emailPreviewIframe.getElementsByClassName('email-body').length;
25
26
  if (!email && process.env.EMAIL_URL && process.env.EMAIL_URL.includes('http://')) {
26
27
  alert('Need to run the backend server to display email templates, use: python manage.py runserver');
27
28
  }
28
29
  };
29
- emailPreviewIframe === null || emailPreviewIframe === void 0 || emailPreviewIframe.addEventListener('load', loaded, true);
30
+ emailPreviewIframe?.addEventListener('load', loaded, true);
30
31
  });
31
32
  if (!BACKEND_URL) {
32
33
  return null;
33
34
  }
34
- return /*#__PURE__*/React.createElement("iframe", {
35
+ return /*#__PURE__*/jsx("iframe", {
35
36
  id: "emailPreview",
36
37
  width: "100%",
37
38
  height: "100%",
38
- src: "".concat(BACKEND_URL).concat(props.url),
39
+ src: `${BACKEND_URL}${props.url}`,
39
40
  style: style
40
41
  });
41
42
  }
@@ -0,0 +1,211 @@
1
+ import React, { useRef, useEffect } from 'react';
2
+
3
+ const SUBMIT_POLL_MS = 50;
4
+ function getStoryPreviewDocument() {
5
+ const previewIframe = document.getElementById('storybook-preview-iframe') ?? document.querySelector('iframe[data-is-storybook="true"]');
6
+ return previewIframe?.contentDocument ?? null;
7
+ }
8
+ function getMountRoot() {
9
+ const previewDocument = getStoryPreviewDocument();
10
+ if (previewDocument) {
11
+ return previewDocument.getElementById('storybook-root') ?? previewDocument.getElementById('root') ?? previewDocument.body;
12
+ }
13
+ return document.getElementById('storybook-root') ?? document.getElementById('root') ?? document.body;
14
+ }
15
+ function canSubmitFormApi(form) {
16
+ return typeof form?.submit === 'function' && typeof form.getRegisteredFields === 'function' && form.getRegisteredFields().length > 0;
17
+ }
18
+ function findSaveDraftButton(root) {
19
+ if (!root) {
20
+ return null;
21
+ }
22
+ const saveDraft = root.querySelector('[data-testid$="SaveDraftButton"]');
23
+ if (!saveDraft) {
24
+ return null;
25
+ }
26
+ return saveDraft.tagName === 'BUTTON' ? saveDraft : saveDraft.querySelector('button');
27
+ }
28
+ function findSubmitButton(root) {
29
+ if (!root) {
30
+ return null;
31
+ }
32
+ const byType = root.querySelector('button[type="submit"]');
33
+ if (byType) {
34
+ return byType;
35
+ }
36
+ const form = root.querySelector('form[data-testid], form');
37
+ if (!form) {
38
+ return null;
39
+ }
40
+ return form.querySelector('.form__button .form__button-item, .form__button-item') ?? null;
41
+ }
42
+ function touchFieldsBeforeSubmit(form) {
43
+ if (!canSubmitFormApi(form)) {
44
+ return;
45
+ }
46
+ for (const fieldName of form.getRegisteredFields()) {
47
+ if (!form.getFieldState(fieldName)?.touched) {
48
+ form.blur(fieldName);
49
+ }
50
+ }
51
+ }
52
+ function triggerFormSubmit({
53
+ form,
54
+ root,
55
+ submitButton
56
+ }) {
57
+ const saveDraftButton = findSaveDraftButton(root ?? getMountRoot());
58
+ if (saveDraftButton) {
59
+ saveDraftButton.click();
60
+ return;
61
+ }
62
+ if (canSubmitFormApi(form)) {
63
+ touchFieldsBeforeSubmit(form);
64
+ form.submit();
65
+ return;
66
+ }
67
+ if (submitButton?.type === 'submit') {
68
+ submitButton.click();
69
+ }
70
+ }
71
+ async function autoSubmitForm(formRef, signal) {
72
+ if (formRef.__itcaseDidAutoSubmit) {
73
+ return;
74
+ }
75
+ while (!signal.aborted) {
76
+ const root = getMountRoot();
77
+ const form = formRef.current;
78
+ const submitButton = findSubmitButton(root);
79
+ const saveDraftButton = findSaveDraftButton(root);
80
+ const canSubmitViaFormApi = canSubmitFormApi(form);
81
+ const canClickNativeSubmit = submitButton?.type === 'submit';
82
+ const canClickSaveDraft = Boolean(saveDraftButton);
83
+
84
+ // primaryButtonHtmlType="button": ждём final-form API или кнопку черновика в DOM
85
+ if (!canSubmitViaFormApi && !canClickNativeSubmit && !canClickSaveDraft) {
86
+ await new Promise(resolve => {
87
+ setTimeout(resolve, SUBMIT_POLL_MS);
88
+ });
89
+ continue;
90
+ }
91
+ formRef.__itcaseDidAutoSubmit = true;
92
+ await new Promise(resolve => {
93
+ requestAnimationFrame(() => {
94
+ requestAnimationFrame(resolve);
95
+ });
96
+ });
97
+ if (signal.aborted) {
98
+ return;
99
+ }
100
+ triggerFormSubmit({
101
+ form: formRef.current,
102
+ root,
103
+ submitButton
104
+ });
105
+ return;
106
+ }
107
+ }
108
+
109
+ function wrapRender(component, render, formRef, defaultArgs = {}) {
110
+ if (typeof render !== 'function') {
111
+ return render;
112
+ }
113
+ return function renderWithRef(storyArgs) {
114
+ const args = {
115
+ ...defaultArgs,
116
+ ...(storyArgs ?? {})
117
+ };
118
+ delete args.ref;
119
+ delete args.errors;
120
+ if (!args.onSubmit && defaultArgs.onSubmit) {
121
+ args.onSubmit = defaultArgs.onSubmit;
122
+ }
123
+ const rendered = render(args);
124
+ if (/*#__PURE__*/React.isValidElement(rendered)) {
125
+ return /*#__PURE__*/React.cloneElement(rendered, {
126
+ ...rendered.props,
127
+ ...args,
128
+ ref: formRef
129
+ });
130
+ }
131
+ if (component) {
132
+ return /*#__PURE__*/React.createElement(component, {
133
+ ref: formRef,
134
+ ...args
135
+ });
136
+ }
137
+ return rendered;
138
+ };
139
+ }
140
+ function withFormRef(children, formRef, bindings) {
141
+ const {
142
+ component,
143
+ args,
144
+ render: storyRender,
145
+ allArgs,
146
+ context
147
+ } = bindings;
148
+ const storyArgs = args ?? context?.args ?? children?.props?.args ?? {};
149
+ const storyComponent = component ?? context?.component ?? children?.props?.component;
150
+ const storyRenderFn = storyRender ?? context?.render ?? children?.props?.render;
151
+ const boundRender = wrapRender(storyComponent, storyRenderFn, formRef, storyArgs);
152
+ const addRef = value => value ? {
153
+ ...value,
154
+ ref: formRef
155
+ } : value;
156
+ return /*#__PURE__*/React.cloneElement(children, {
157
+ component: storyComponent,
158
+ args: addRef(storyArgs),
159
+ render: boundRender,
160
+ allArgs: addRef(allArgs),
161
+ context: context ? {
162
+ ...context,
163
+ component: storyComponent,
164
+ args: addRef(context.args),
165
+ render: boundRender,
166
+ allArgs: addRef(context.allArgs)
167
+ } : context
168
+ });
169
+ }
170
+
171
+ /**
172
+ * Авто-submit для интерактивного Storybook (Require / Validation / ServerError).
173
+ * При primaryButtonHtmlType="button" — formRef.current.submit() (final-form API),
174
+ * при type="submit" — click по кнопке. В Vitest submit в play.
175
+ */
176
+ function FormSubmitWrapper(props) {
177
+ const formRef = useRef(null);
178
+ const {
179
+ component,
180
+ args,
181
+ render,
182
+ allArgs,
183
+ context,
184
+ submit = true,
185
+ children
186
+ } = props;
187
+ const storyArgs = args ?? context?.args ?? children?.props?.args ?? {};
188
+ useEffect(() => {
189
+ if (!submit) {
190
+ return undefined;
191
+ }
192
+ delete formRef.__itcaseDidAutoSubmit;
193
+ const abortController = new AbortController();
194
+ autoSubmitForm(formRef, abortController.signal);
195
+ return () => {
196
+ abortController.abort();
197
+ delete formRef.__itcaseDidAutoSubmit;
198
+ };
199
+ }, [submit, storyArgs.errors]);
200
+
201
+ // eslint-disable-next-line react-hooks/refs -- ref уходит в cloneElement внутри bound render
202
+ return withFormRef(children, formRef, {
203
+ component,
204
+ args: storyArgs,
205
+ render,
206
+ allArgs,
207
+ context
208
+ });
209
+ }
210
+
211
+ export { FormSubmitWrapper as F };
@@ -1,3 +1,2 @@
1
- export { F as FormSubmitWrapper } from './FormSubmitWrapper-DoGZRTm5.js';
2
- import './_rollupPluginBabelHelpers-CEVa9ZMs.js';
1
+ export { F as FormSubmitWrapper } from './FormSubmitWrapper-B2tMQZu2.js';
3
2
  import 'react';
@@ -1,12 +1,12 @@
1
- import React, { useMemo } from 'react';
1
+ import 'react';
2
+ import { jsx } from 'react/jsx-runtime';
2
3
 
3
- function withClearStoresDecorator(_ref) {
4
- var clearStoreData = _ref.clearStoreData;
5
- var Decorator = function Decorator(Story) {
6
- useMemo(function () {
7
- clearStoreData();
8
- }, [Story]);
9
- return /*#__PURE__*/React.createElement(Story, null);
4
+ function withClearStoresDecorator({
5
+ clearStoreData
6
+ }) {
7
+ const Decorator = Story => {
8
+ clearStoreData();
9
+ return /*#__PURE__*/jsx(Story, {});
10
10
  };
11
11
  return Decorator;
12
12
  }
@@ -1,15 +1,20 @@
1
1
  import React from 'react';
2
+ import { jsx } from 'react/jsx-runtime';
2
3
 
3
- function withExtraProviders() {
4
- var providers = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
4
+ function withExtraProviders(providers = []) {
5
5
  if (!Array.isArray(providers)) throw new Error('withExtraProviders requires an array of components');
6
- return function (StoryFn, context) {
7
- var currentStory = StoryFn(context);
8
- for (var i = providers.length - 1; i >= 0; i--) {
9
- var item = providers[i];
10
- var Component = item.provider;
11
- var props = item.props || {};
12
- currentStory = /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Component, props, currentStory));
6
+ return (StoryFn, context) => {
7
+ let currentStory = StoryFn(context);
8
+ for (let i = providers.length - 1; i >= 0; i--) {
9
+ const item = providers[i];
10
+ const Component = item.provider;
11
+ const props = item.props || {};
12
+ currentStory = /*#__PURE__*/jsx(React.Fragment, {
13
+ children: /*#__PURE__*/jsx(Component, {
14
+ ...props,
15
+ children: currentStory
16
+ })
17
+ });
13
18
  }
14
19
  return currentStory;
15
20
  };
@@ -1,6 +1,6 @@
1
- import { d as _objectSpread2 } from '../components/_rollupPluginBabelHelpers-CEVa9ZMs.js';
2
- import React from 'react';
1
+ import 'react';
3
2
  import { r as requireIsArray, g as getDefaultExportFromCjs } from '../components/isArray-CPoGkdXv.js';
3
+ import { jsx } from 'react/jsx-runtime';
4
4
 
5
5
  var castArray_1;
6
6
  var hasRequiredCastArray;
@@ -59,17 +59,18 @@ var castArrayExports = requireCastArray();
59
59
  var castArray = /*@__PURE__*/getDefaultExportFromCjs(castArrayExports);
60
60
 
61
61
  function withFigmaSourceLink() {
62
- var decorator = function decorator(Story, _ref) {
63
- var parameters = _ref.parameters,
64
- context = _ref.context;
65
- var sourceLink = parameters.sourceLink || {};
62
+ const decorator = (Story, {
63
+ parameters,
64
+ context
65
+ }) => {
66
+ const sourceLink = parameters.sourceLink || {};
66
67
  if (parameters.design) {
67
- var designList = castArray(parameters.design);
68
+ const designList = castArray(parameters.design);
68
69
  if (!sourceLink.links) {
69
70
  sourceLink.links = {};
70
71
  }
71
- designList.forEach(function (design) {
72
- var groupKey = "".concat(design.type).concat(design.name || '');
72
+ designList.forEach(design => {
73
+ const groupKey = `${design.type}${design.name || ''}`;
73
74
  sourceLink.links[groupKey] = {
74
75
  label: 'Figma — ' + context.title + (design.name ? ' / ' + design.name : ''),
75
76
  href: design.url,
@@ -77,12 +78,16 @@ function withFigmaSourceLink() {
77
78
  };
78
79
  });
79
80
  }
80
- var updatedContext = _objectSpread2(_objectSpread2({}, context), {}, {
81
- parameters: _objectSpread2(_objectSpread2({}, context.parameters), {}, {
81
+ const updatedContext = {
82
+ ...context,
83
+ parameters: {
84
+ ...context.parameters,
82
85
  sourceLink: sourceLink
83
- })
86
+ }
87
+ };
88
+ return /*#__PURE__*/jsx(Story, {
89
+ ...updatedContext
84
90
  });
85
- return /*#__PURE__*/React.createElement(Story, updatedContext);
86
91
  };
87
92
  return decorator;
88
93
  }
@@ -1,10 +1,10 @@
1
- import { d as _objectSpread2 } from '../components/_rollupPluginBabelHelpers-CEVa9ZMs.js';
2
- import React from 'react';
3
- import { F as FormSubmitWrapper } from '../components/FormSubmitWrapper-DoGZRTm5.js';
1
+ import 'react';
2
+ import { F as FormSubmitWrapper } from '../components/FormSubmitWrapper-B2tMQZu2.js';
4
3
  import { c as commonjsGlobal, r as requireIsArray } from '../components/isArray-CPoGkdXv.js';
5
4
  import '@itcase/common';
6
5
  import 'msw';
7
6
  import 'final-form';
7
+ import { jsx } from 'react/jsx-runtime';
8
8
 
9
9
  /** Detect free variable `global` from Node.js. */
10
10
 
@@ -1118,32 +1118,41 @@ function hasFormParameters(parameters) {
1118
1118
  }
1119
1119
 
1120
1120
  function getStoryArgs(storyContext) {
1121
- var _storyContext$context, _storyContext$initial, _baseContext$args, _storyContext$args;
1122
- var baseContext = (_storyContext$context = storyContext.context) !== null && _storyContext$context !== void 0 ? _storyContext$context : storyContext;
1123
- return _objectSpread2(_objectSpread2(_objectSpread2({}, (_storyContext$initial = storyContext.initialArgs) !== null && _storyContext$initial !== void 0 ? _storyContext$initial : {}), (_baseContext$args = baseContext.args) !== null && _baseContext$args !== void 0 ? _baseContext$args : {}), (_storyContext$args = storyContext.args) !== null && _storyContext$args !== void 0 ? _storyContext$args : {});
1121
+ const baseContext = storyContext.context ?? storyContext;
1122
+ return {
1123
+ ...(storyContext.initialArgs ?? {}),
1124
+ ...(baseContext.args ?? {}),
1125
+ ...(storyContext.args ?? {})
1126
+ };
1124
1127
  }
1125
1128
  function enhanceStoryContext(storyContext) {
1126
- var _storyContext$context2;
1127
- var baseContext = (_storyContext$context2 = storyContext.context) !== null && _storyContext$context2 !== void 0 ? _storyContext$context2 : storyContext;
1128
- var args = getStoryArgs(storyContext);
1129
- return _objectSpread2(_objectSpread2({}, baseContext), {}, {
1130
- args: args
1131
- });
1129
+ const baseContext = storyContext.context ?? storyContext;
1130
+ const args = getStoryArgs(storyContext);
1131
+ return {
1132
+ ...baseContext,
1133
+ args
1134
+ };
1132
1135
  }
1133
1136
  function withFormSubmitDecorator() {
1134
- var decorator = function decorator(Story, storyContext) {
1135
- var parameters = storyContext.parameters;
1136
- var context = enhanceStoryContext(storyContext);
1137
+ const decorator = (Story, storyContext) => {
1138
+ const {
1139
+ parameters
1140
+ } = storyContext;
1141
+ const context = enhanceStoryContext(storyContext);
1137
1142
  if (!hasFormParameters(parameters)) {
1138
- return /*#__PURE__*/React.createElement(Story, Object.assign({}, context, {
1143
+ return /*#__PURE__*/jsx(Story, {
1144
+ ...context,
1139
1145
  parameters: parameters
1140
- }));
1146
+ });
1141
1147
  }
1142
- return /*#__PURE__*/React.createElement(FormSubmitWrapper, Object.assign({}, context, {
1143
- parameters: parameters
1144
- }), /*#__PURE__*/React.createElement(Story, Object.assign({}, context, {
1145
- parameters: parameters
1146
- })));
1148
+ return /*#__PURE__*/jsx(FormSubmitWrapper, {
1149
+ ...context,
1150
+ parameters: parameters,
1151
+ children: /*#__PURE__*/jsx(Story, {
1152
+ ...context,
1153
+ parameters: parameters
1154
+ })
1155
+ });
1147
1156
  };
1148
1157
  return decorator;
1149
1158
  }
@@ -1,9 +1,11 @@
1
- import React from 'react';
1
+ import 'react';
2
+ import { jsx } from 'react/jsx-runtime';
2
3
 
3
4
  function withLayoutDecorator() {
4
- return function (Story, _ref) {
5
- var parameters = _ref.parameters;
6
- var layouts = {
5
+ return (Story, {
6
+ parameters
7
+ }) => {
8
+ const layouts = {
7
9
  top: 'sb-layout-top',
8
10
  right: 'sb-layout-right',
9
11
  bottom: 'sb-layout-bottom',
@@ -16,29 +18,33 @@ function withLayoutDecorator() {
16
18
  rightFull: 'sb-layout-right-full',
17
19
  topFull: 'sb-layout-top-full'
18
20
  };
19
- var layoutClass = layouts[(parameters === null || parameters === void 0 ? void 0 : parameters.layout) || ''];
20
- var maxWidthStyle = {
21
+ const layoutClass = layouts[parameters?.layout || ''];
22
+ const maxWidthStyle = {
21
23
  width: parameters.maxWidth && '100%',
22
- maxWidth: parameters === null || parameters === void 0 ? void 0 : parameters.maxWidth
24
+ maxWidth: parameters?.maxWidth
23
25
  };
24
26
  if (!layoutClass && parameters.maxWidth) {
25
- return /*#__PURE__*/React.createElement("div", {
26
- style: maxWidthStyle
27
- }, /*#__PURE__*/React.createElement(Story, null));
27
+ return /*#__PURE__*/jsx("div", {
28
+ style: maxWidthStyle,
29
+ children: /*#__PURE__*/jsx(Story, {})
30
+ });
28
31
  }
29
32
  if (layoutClass && !parameters.maxWidth) {
30
- return /*#__PURE__*/React.createElement("div", {
31
- className: layoutClass
32
- }, /*#__PURE__*/React.createElement(Story, null));
33
+ return /*#__PURE__*/jsx("div", {
34
+ className: layoutClass,
35
+ children: /*#__PURE__*/jsx(Story, {})
36
+ });
33
37
  }
34
38
  if (layoutClass && parameters.maxWidth) {
35
- return /*#__PURE__*/React.createElement("div", {
36
- className: layoutClass
37
- }, /*#__PURE__*/React.createElement("div", {
38
- style: maxWidthStyle
39
- }, /*#__PURE__*/React.createElement(Story, null)));
39
+ return /*#__PURE__*/jsx("div", {
40
+ className: layoutClass,
41
+ children: /*#__PURE__*/jsx("div", {
42
+ style: maxWidthStyle,
43
+ children: /*#__PURE__*/jsx(Story, {})
44
+ })
45
+ });
40
46
  }
41
- return /*#__PURE__*/React.createElement(Story, null);
47
+ return /*#__PURE__*/jsx(Story, {});
42
48
  };
43
49
  }
44
50
 
@@ -1,42 +1,53 @@
1
- import { _ as _objectWithoutProperties } from '../components/_rollupPluginBabelHelpers-CEVa9ZMs.js';
2
- import React from 'react';
1
+ import 'react';
3
2
  import { NotificationWrapper } from '@itcase/ui-web/components/Notification';
4
3
  import { UIProvider, NotificationsProvider } from '@itcase/ui-core/context';
4
+ import { jsx, jsxs } from 'react/jsx-runtime';
5
5
 
6
- var _excluded = ["storesData"];
7
- function withNextDecoratorFactory(_ref) {
8
- var App = _ref.App,
9
- RootStoreProvider = _ref.RootStoreProvider;
10
- var decorator = function decorator(Story, _ref2) {
11
- var args = _ref2.args,
12
- parameters = _ref2.parameters,
13
- context = _ref2.context;
14
- var _prepareStoryArgument = prepareStoryArguments({
15
- args: args,
16
- parameters: parameters,
17
- context: context
18
- }),
19
- appArgs = _prepareStoryArgument.appArgs,
20
- appContext = _prepareStoryArgument.appContext,
21
- appParameters = _prepareStoryArgument.appParameters;
6
+ function withNextDecoratorFactory({
7
+ App,
8
+ RootStoreProvider
9
+ }) {
10
+ const decorator = (Story, {
11
+ args,
12
+ parameters,
13
+ context
14
+ }) => {
15
+ const {
16
+ appArgs,
17
+ appContext,
18
+ appParameters
19
+ } = prepareStoryArguments({
20
+ args,
21
+ parameters,
22
+ context
23
+ });
22
24
  if (appParameters.page) {
23
- return /*#__PURE__*/React.createElement(App, {
25
+ return /*#__PURE__*/jsx(App, {
24
26
  Component: Story,
25
27
  pageProps: appArgs
26
28
  });
27
29
  }
28
- return /*#__PURE__*/React.createElement(RootStoreProvider, appArgs.rootStoreInitialData, /*#__PURE__*/React.createElement(UIProvider, null, /*#__PURE__*/React.createElement(NotificationsProvider, {
29
- initialNotificationsList: parameters.initialNotificationsList || args.initialNotificationsList || []
30
- }, /*#__PURE__*/React.createElement(NotificationWrapper, {
31
- className: "notification_global notification_global_right_top"
32
- }), /*#__PURE__*/React.createElement(Story, appContext))));
30
+ return /*#__PURE__*/jsx(RootStoreProvider, {
31
+ ...appArgs.rootStoreInitialData,
32
+ children: /*#__PURE__*/jsx(UIProvider, {
33
+ children: /*#__PURE__*/jsxs(NotificationsProvider, {
34
+ initialNotificationsList: parameters.initialNotificationsList || args.initialNotificationsList || [],
35
+ children: [/*#__PURE__*/jsx(NotificationWrapper, {
36
+ className: "notification_global notification_global_right_top"
37
+ }), /*#__PURE__*/jsx(Story, {
38
+ ...appContext
39
+ })]
40
+ })
41
+ })
42
+ });
33
43
  };
34
44
  return decorator;
35
45
  }
36
- var prepareStoryArguments = function prepareStoryArguments(_ref3) {
37
- var args = _ref3.args,
38
- parameters = _ref3.parameters,
39
- context = _ref3.context;
46
+ const prepareStoryArguments = ({
47
+ args,
48
+ parameters,
49
+ context
50
+ }) => {
40
51
  if (parameters.storeData || parameters.storesData) {
41
52
  throw new Error('"withNextDecoratorFactory" error: "parameters.storesData" is deprecated. Set "storesData" to args instead.');
42
53
  }
@@ -46,8 +57,10 @@ var prepareStoryArguments = function prepareStoryArguments(_ref3) {
46
57
  if (args.rootStoreInitialData) {
47
58
  throw new Error('"withNextDecoratorFactory" error: do not user "args.rootStoreInitialData". Use "storesData" argument he passes parameters to rootStoreInitialData.');
48
59
  }
49
- var storesData = args.storesData,
50
- otherArgs = _objectWithoutProperties(args, _excluded);
60
+ const {
61
+ storesData,
62
+ ...otherArgs
63
+ } = args;
51
64
  otherArgs.rootStoreInitialData = storesData;
52
65
  return {
53
66
  appArgs: otherArgs,
@@ -1,13 +1,18 @@
1
- import React from 'react';
1
+ import 'react';
2
2
  import { NotificationWrapper } from '@itcase/ui-web/components/Notification';
3
3
  import { UIProvider, NotificationsProvider } from '@itcase/ui-core/context';
4
+ import { jsx, jsxs } from 'react/jsx-runtime';
4
5
 
5
- function withUiDecorator(Story, _ref) {
6
- var args = _ref.args,
7
- parameters = _ref.parameters;
8
- return /*#__PURE__*/React.createElement(UIProvider, null, /*#__PURE__*/React.createElement(NotificationsProvider, {
9
- initialNotificationsList: parameters.initialNotificationsList || args.initialNotificationsList || []
10
- }, /*#__PURE__*/React.createElement(NotificationWrapper, null), /*#__PURE__*/React.createElement(Story, null)));
6
+ function withUiDecorator(Story, {
7
+ args,
8
+ parameters
9
+ }) {
10
+ return /*#__PURE__*/jsx(UIProvider, {
11
+ children: /*#__PURE__*/jsxs(NotificationsProvider, {
12
+ initialNotificationsList: parameters.initialNotificationsList || args.initialNotificationsList || [],
13
+ children: [/*#__PURE__*/jsx(NotificationWrapper, {}), /*#__PURE__*/jsx(Story, {})]
14
+ })
15
+ });
11
16
  }
12
17
 
13
18
  export { withUiDecorator };
@@ -6,9 +6,9 @@ export { withLayoutDecorator } from './decorators/withLayoutDecorator.js';
6
6
  export { withNextDecoratorFactory } from './decorators/withNextDecorator.js';
7
7
  export { withUiDecorator } from './decorators/withUiDecorator.js';
8
8
  import 'react';
9
- import './components/_rollupPluginBabelHelpers-CEVa9ZMs.js';
9
+ import 'react/jsx-runtime';
10
10
  import './components/isArray-CPoGkdXv.js';
11
- import './components/FormSubmitWrapper-DoGZRTm5.js';
11
+ import './components/FormSubmitWrapper-B2tMQZu2.js';
12
12
  import '@itcase/common';
13
13
  import 'msw';
14
14
  import 'final-form';