@itcase/storybook-config 1.2.70 → 1.2.72
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +9 -0
- package/dist/{FormSubmitWrapper-DA2tkSEl.js → FormSubmitWrapper-DXUEGLuS.js} +103 -99
- package/dist/cjs/components/FormSubmitWrapper.js +1 -1
- package/dist/cjs/decorators/withFigmaSourceLink.js +58 -2
- package/dist/cjs/decorators/withFormSubmitDecorator.js +1109 -2
- package/dist/cjs/decorators/withNextDecorator.js +6 -11
- package/dist/cjs/decorators/withUiDecorator.js +4 -9
- package/dist/cjs/decorators.js +4 -7
- package/dist/components/EmailTemplatePreview.js +2 -2
- package/dist/components/{FormSubmitWrapper--d5p3re1.js → FormSubmitWrapper-CytvWwKi.js} +107 -103
- package/dist/components/FormSubmitWrapper.js +2 -2
- package/dist/components/{_rollupPluginBabelHelpers-DQ-fuxJg.js → _rollupPluginBabelHelpers-OwKVS06F.js} +1 -1
- package/dist/components/isArray-CPoGkdXv.js +43 -0
- package/dist/config/sourceLink/sourceLink.js +8 -16
- package/dist/decorators/withClearStoresDecorator.js +2 -2
- package/dist/decorators/withExtraProviders.js +2 -2
- package/dist/decorators/withFigmaSourceLink.js +61 -5
- package/dist/decorators/withFormSubmitDecorator.js +1114 -7
- package/dist/decorators/withLayoutDecorator.js +9 -9
- package/dist/decorators/withNextDecorator.js +8 -13
- package/dist/decorators/withUiDecorator.js +5 -10
- package/dist/decorators.js +5 -8
- package/dist/isArray-DJguRq_2.js +47 -0
- package/package.json +23 -17
- package/dist/Notification-Cqx2_tCE.js +0 -7945
- package/dist/components/Notification-qLYjGbKN.js +0 -7923
|
@@ -2,13 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
var _rollupPluginBabelHelpers = require('../../_rollupPluginBabelHelpers-D8XyM9rZ.js');
|
|
4
4
|
var React = require('react');
|
|
5
|
-
var Notification = require('
|
|
6
|
-
require('@itcase/
|
|
7
|
-
require('lodash/camelCase');
|
|
8
|
-
require('lodash/castArray');
|
|
9
|
-
require('lodash/upperFirst');
|
|
10
|
-
require('lodash/maxBy');
|
|
11
|
-
require('react-dom');
|
|
5
|
+
var Notification = require('@itcase/ui-web/components/Notification');
|
|
6
|
+
var context = require('@itcase/ui-core/context');
|
|
12
7
|
|
|
13
8
|
var _excluded = ["storesData"];
|
|
14
9
|
function withNextDecoratorFactory(_ref) {
|
|
@@ -17,11 +12,11 @@ function withNextDecoratorFactory(_ref) {
|
|
|
17
12
|
var decorator = function decorator(Story, _ref2) {
|
|
18
13
|
var args = _ref2.args,
|
|
19
14
|
parameters = _ref2.parameters,
|
|
20
|
-
context = _ref2.context;
|
|
15
|
+
context$1 = _ref2.context;
|
|
21
16
|
var _prepareStoryArgument = prepareStoryArguments({
|
|
22
17
|
args: args,
|
|
23
18
|
parameters: parameters,
|
|
24
|
-
context: context
|
|
19
|
+
context: context$1
|
|
25
20
|
}),
|
|
26
21
|
appArgs = _prepareStoryArgument.appArgs,
|
|
27
22
|
appContext = _prepareStoryArgument.appContext,
|
|
@@ -32,9 +27,9 @@ function withNextDecoratorFactory(_ref) {
|
|
|
32
27
|
pageProps: appArgs
|
|
33
28
|
});
|
|
34
29
|
}
|
|
35
|
-
return /*#__PURE__*/React.createElement(RootStoreProvider, appArgs.rootStoreInitialData, /*#__PURE__*/React.createElement(
|
|
30
|
+
return /*#__PURE__*/React.createElement(RootStoreProvider, appArgs.rootStoreInitialData, /*#__PURE__*/React.createElement(context.UIProvider, null, /*#__PURE__*/React.createElement(context.NotificationsProvider, {
|
|
36
31
|
initialNotificationsList: parameters.initialNotificationsList || args.initialNotificationsList || []
|
|
37
|
-
}, /*#__PURE__*/React.createElement(Notification.
|
|
32
|
+
}, /*#__PURE__*/React.createElement(Notification.NotificationWrapper, {
|
|
38
33
|
className: "notification_global notification_global_right_top"
|
|
39
34
|
}), /*#__PURE__*/React.createElement(Story, appContext))));
|
|
40
35
|
};
|
|
@@ -1,20 +1,15 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var React = require('react');
|
|
4
|
-
var Notification = require('
|
|
5
|
-
require('@itcase/
|
|
6
|
-
require('lodash/camelCase');
|
|
7
|
-
require('lodash/castArray');
|
|
8
|
-
require('lodash/upperFirst');
|
|
9
|
-
require('lodash/maxBy');
|
|
10
|
-
require('react-dom');
|
|
4
|
+
var Notification = require('@itcase/ui-web/components/Notification');
|
|
5
|
+
var context = require('@itcase/ui-core/context');
|
|
11
6
|
|
|
12
7
|
function withUiDecorator(Story, _ref) {
|
|
13
8
|
var args = _ref.args,
|
|
14
9
|
parameters = _ref.parameters;
|
|
15
|
-
return /*#__PURE__*/React.createElement(
|
|
10
|
+
return /*#__PURE__*/React.createElement(context.UIProvider, null, /*#__PURE__*/React.createElement(context.NotificationsProvider, {
|
|
16
11
|
initialNotificationsList: parameters.initialNotificationsList || args.initialNotificationsList || []
|
|
17
|
-
}, /*#__PURE__*/React.createElement(Notification.
|
|
12
|
+
}, /*#__PURE__*/React.createElement(Notification.NotificationWrapper, null), /*#__PURE__*/React.createElement(Story, null)));
|
|
18
13
|
}
|
|
19
14
|
|
|
20
15
|
exports.withUiDecorator = withUiDecorator;
|
package/dist/cjs/decorators.js
CHANGED
|
@@ -9,15 +9,12 @@ var withNextDecorator = require('./decorators/withNextDecorator.js');
|
|
|
9
9
|
var withUiDecorator = require('./decorators/withUiDecorator.js');
|
|
10
10
|
require('react');
|
|
11
11
|
require('../_rollupPluginBabelHelpers-D8XyM9rZ.js');
|
|
12
|
-
require('
|
|
13
|
-
require('../FormSubmitWrapper-
|
|
14
|
-
require('lodash/camelCase');
|
|
12
|
+
require('../isArray-DJguRq_2.js');
|
|
13
|
+
require('../FormSubmitWrapper-DXUEGLuS.js');
|
|
15
14
|
require('@itcase/common');
|
|
16
15
|
require('msw');
|
|
17
|
-
require('
|
|
18
|
-
require('
|
|
19
|
-
require('lodash/maxBy');
|
|
20
|
-
require('react-dom');
|
|
16
|
+
require('@itcase/ui-web/components/Notification');
|
|
17
|
+
require('@itcase/ui-core/context');
|
|
21
18
|
|
|
22
19
|
|
|
23
20
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import React, { useEffect } from 'react';
|
|
2
2
|
|
|
3
3
|
var BACKEND_URL = process.env.EMAIL_URL;
|
|
4
4
|
if (process.env.NODE_ENV === 'production' && process.env.REST_BASE_URL) {
|
|
@@ -31,7 +31,7 @@ function EmailTemplatePreview(props) {
|
|
|
31
31
|
if (!BACKEND_URL) {
|
|
32
32
|
return null;
|
|
33
33
|
}
|
|
34
|
-
return /*#__PURE__*/
|
|
34
|
+
return /*#__PURE__*/React.createElement("iframe", {
|
|
35
35
|
id: "emailPreview",
|
|
36
36
|
width: "100%",
|
|
37
37
|
height: "100%",
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
1
|
+
import { a as _asyncToGenerator, b as _regenerator, c as _objectSpread2 } from './_rollupPluginBabelHelpers-OwKVS06F.js';
|
|
2
|
+
import React, { useRef, useEffect } from 'react';
|
|
3
3
|
|
|
4
|
-
var SUBMIT_TIMEOUT_MS =
|
|
4
|
+
var SUBMIT_TIMEOUT_MS = 5000;
|
|
5
5
|
var SUBMIT_POLL_MS = 50;
|
|
6
6
|
function getMountRoot() {
|
|
7
|
-
var
|
|
8
|
-
return (
|
|
7
|
+
var _document$getElementB;
|
|
8
|
+
return (_document$getElementB = document.getElementById('storybook-root')) !== null && _document$getElementB !== void 0 ? _document$getElementB : document.body;
|
|
9
9
|
}
|
|
10
10
|
function sleep() {
|
|
11
11
|
var ms = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : SUBMIT_POLL_MS;
|
|
@@ -13,145 +13,137 @@ function sleep() {
|
|
|
13
13
|
setTimeout(resolve, ms);
|
|
14
14
|
});
|
|
15
15
|
}
|
|
16
|
-
function prepareFormForAutoSubmit(form) {
|
|
17
|
-
var _config$field, _fieldState$value, _config$suffix;
|
|
18
|
-
var config = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
19
|
-
var fieldNames = typeof (form === null || form === void 0 ? void 0 : form.getRegisteredFields) === 'function' ? form.getRegisteredFields() : [];
|
|
20
|
-
var fieldName = (_config$field = config.field) !== null && _config$field !== void 0 ? _config$field : fieldNames[0];
|
|
21
|
-
if (!fieldName) {
|
|
22
|
-
return false;
|
|
23
|
-
}
|
|
24
|
-
var fieldState = form.getFieldState(fieldName);
|
|
25
|
-
var value = (_fieldState$value = fieldState === null || fieldState === void 0 ? void 0 : fieldState.value) !== null && _fieldState$value !== void 0 ? _fieldState$value : '';
|
|
26
|
-
var suffix = (_config$suffix = config.suffix) !== null && _config$suffix !== void 0 ? _config$suffix : "\u200B";
|
|
27
|
-
var nextValue = "".concat(value).concat(suffix);
|
|
28
|
-
if (nextValue === value) {
|
|
29
|
-
return false;
|
|
30
|
-
}
|
|
31
|
-
form.change(fieldName, nextValue);
|
|
32
|
-
return true;
|
|
33
|
-
}
|
|
34
16
|
function findSubmitButton(root) {
|
|
17
|
+
var _root$querySelector;
|
|
35
18
|
if (!root) {
|
|
36
19
|
return null;
|
|
37
20
|
}
|
|
38
|
-
|
|
39
|
-
if (byType) {
|
|
40
|
-
return byType;
|
|
41
|
-
}
|
|
42
|
-
var form = root.querySelector('form[data-testid], form');
|
|
43
|
-
if (!form) {
|
|
44
|
-
return null;
|
|
45
|
-
}
|
|
46
|
-
var primaryInGroup = form.querySelector('.form__button .form__button-item, .form__button-item');
|
|
47
|
-
if (primaryInGroup) {
|
|
48
|
-
return primaryInGroup;
|
|
49
|
-
}
|
|
50
|
-
var byTestId = form.querySelector('button[data-testid*="Submit"], button[data-testid*="SignIn"], button[data-testid*="Create"]');
|
|
51
|
-
return byTestId;
|
|
21
|
+
return (_root$querySelector = root.querySelector('button[type="submit"]')) !== null && _root$querySelector !== void 0 ? _root$querySelector : root.querySelector('button.form__button-item');
|
|
52
22
|
}
|
|
53
|
-
function
|
|
54
|
-
return
|
|
23
|
+
function isSubmitButton(button) {
|
|
24
|
+
return (button === null || button === void 0 ? void 0 : button.type) === 'submit';
|
|
55
25
|
}
|
|
56
|
-
function
|
|
57
|
-
|
|
58
|
-
return false;
|
|
59
|
-
}
|
|
60
|
-
var type = button.type || button.getAttribute('type');
|
|
61
|
-
return type === 'submit';
|
|
26
|
+
function canUseFormApi(form) {
|
|
27
|
+
return typeof (form === null || form === void 0 ? void 0 : form.submit) === 'function';
|
|
62
28
|
}
|
|
63
|
-
function
|
|
64
|
-
var
|
|
65
|
-
|
|
66
|
-
if (
|
|
67
|
-
|
|
68
|
-
return true;
|
|
29
|
+
function prepareFormForAutoSubmit(form) {
|
|
30
|
+
var _config$field, _form$getFieldState$v, _form$getFieldState, _config$suffix;
|
|
31
|
+
var config = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
32
|
+
if (!canUseFormApi(form) || typeof form.getRegisteredFields !== 'function') {
|
|
33
|
+
return;
|
|
69
34
|
}
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
return
|
|
35
|
+
var fieldName = (_config$field = config.field) !== null && _config$field !== void 0 ? _config$field : form.getRegisteredFields()[0];
|
|
36
|
+
if (!fieldName) {
|
|
37
|
+
return;
|
|
73
38
|
}
|
|
74
|
-
var
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
39
|
+
var value = (_form$getFieldState$v = (_form$getFieldState = form.getFieldState(fieldName)) === null || _form$getFieldState === void 0 ? void 0 : _form$getFieldState.value) !== null && _form$getFieldState$v !== void 0 ? _form$getFieldState$v : '';
|
|
40
|
+
var nextValue = "".concat(value).concat((_config$suffix = config.suffix) !== null && _config$suffix !== void 0 ? _config$suffix : "\u200B");
|
|
41
|
+
if (nextValue !== value) {
|
|
42
|
+
form.change(fieldName, nextValue);
|
|
78
43
|
}
|
|
79
|
-
|
|
44
|
+
}
|
|
45
|
+
function triggerFormSubmit(_ref) {
|
|
46
|
+
var _submitButton$closest, _submitButton$closest2;
|
|
47
|
+
var form = _ref.form,
|
|
48
|
+
submitButton = _ref.submitButton;
|
|
49
|
+
if (isSubmitButton(submitButton)) {
|
|
80
50
|
submitButton.click();
|
|
81
|
-
return
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
if (canUseFormApi(form)) {
|
|
54
|
+
form.submit();
|
|
55
|
+
return;
|
|
82
56
|
}
|
|
83
|
-
|
|
57
|
+
submitButton === null || submitButton === void 0 || (_submitButton$closest = submitButton.closest('form')) === null || _submitButton$closest === void 0 || (_submitButton$closest2 = _submitButton$closest.requestSubmit) === null || _submitButton$closest2 === void 0 || _submitButton$closest2.call(_submitButton$closest);
|
|
84
58
|
}
|
|
85
|
-
function
|
|
86
|
-
var
|
|
87
|
-
var submitButton = findSubmitButton(root);
|
|
88
|
-
var form = formRef.current;
|
|
89
|
-
var hasFields = typeof (form === null || form === void 0 ? void 0 : form.getRegisteredFields) === 'function' && form.getRegisteredFields().length > 0;
|
|
59
|
+
function getSubmitTarget(formRef) {
|
|
60
|
+
var submitButton = findSubmitButton(getMountRoot());
|
|
90
61
|
return {
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
form: form,
|
|
62
|
+
canSubmit: Boolean(submitButton) || canUseFormApi(formRef.current),
|
|
63
|
+
form: formRef.current,
|
|
94
64
|
submitButton: submitButton
|
|
95
65
|
};
|
|
96
66
|
}
|
|
97
|
-
function
|
|
67
|
+
function bindSubmitButtonClick(formRef, signal) {
|
|
68
|
+
var root = getMountRoot();
|
|
69
|
+
if (!root) {
|
|
70
|
+
return undefined;
|
|
71
|
+
}
|
|
72
|
+
var handler = function handler(event) {
|
|
73
|
+
if (signal.aborted) {
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
var submitButton = findSubmitButton(root);
|
|
77
|
+
if (!submitButton || isSubmitButton(submitButton)) {
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
if (event.target !== submitButton && !submitButton.contains(event.target)) {
|
|
81
|
+
return;
|
|
82
|
+
}
|
|
83
|
+
event.preventDefault();
|
|
84
|
+
triggerFormSubmit({
|
|
85
|
+
form: formRef.current,
|
|
86
|
+
submitButton: submitButton
|
|
87
|
+
});
|
|
88
|
+
};
|
|
89
|
+
root.addEventListener('click', handler, true);
|
|
90
|
+
return function () {
|
|
91
|
+
root.removeEventListener('click', handler, true);
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
function autoSubmitForm(_x) {
|
|
98
95
|
return _autoSubmitForm.apply(this, arguments);
|
|
99
96
|
}
|
|
100
97
|
function _autoSubmitForm() {
|
|
101
|
-
_autoSubmitForm = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(formRef
|
|
102
|
-
var
|
|
98
|
+
_autoSubmitForm = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(formRef) {
|
|
99
|
+
var formSubmitConfig,
|
|
100
|
+
signal,
|
|
101
|
+
didPrepareUnchangedSubmit,
|
|
102
|
+
deadline,
|
|
103
|
+
_getSubmitTarget,
|
|
104
|
+
canSubmit,
|
|
105
|
+
form,
|
|
106
|
+
submitButton,
|
|
107
|
+
_args = arguments;
|
|
103
108
|
return _regenerator().w(function (_context) {
|
|
104
109
|
while (1) switch (_context.n) {
|
|
105
110
|
case 0:
|
|
106
|
-
|
|
111
|
+
formSubmitConfig = _args.length > 1 && _args[1] !== undefined ? _args[1] : {};
|
|
112
|
+
signal = _args.length > 2 ? _args[2] : undefined;
|
|
107
113
|
didPrepareUnchangedSubmit = false;
|
|
114
|
+
deadline = Date.now() + SUBMIT_TIMEOUT_MS;
|
|
108
115
|
case 1:
|
|
109
|
-
if (!(Date.now() < deadline)) {
|
|
110
|
-
_context.n =
|
|
111
|
-
break;
|
|
112
|
-
}
|
|
113
|
-
if (!signal.aborted) {
|
|
114
|
-
_context.n = 2;
|
|
116
|
+
if (!(Date.now() < deadline && !signal.aborted)) {
|
|
117
|
+
_context.n = 6;
|
|
115
118
|
break;
|
|
116
119
|
}
|
|
117
|
-
|
|
118
|
-
case 2:
|
|
119
|
-
_getFormSubmitTarget = getFormSubmitTarget(formRef), canMarkForm = _getFormSubmitTarget.canMarkForm, canSubmit = _getFormSubmitTarget.canSubmit, form = _getFormSubmitTarget.form, submitButton = _getFormSubmitTarget.submitButton;
|
|
120
|
+
_getSubmitTarget = getSubmitTarget(formRef), canSubmit = _getSubmitTarget.canSubmit, form = _getSubmitTarget.form, submitButton = _getSubmitTarget.submitButton;
|
|
120
121
|
if (canSubmit) {
|
|
121
|
-
_context.n =
|
|
122
|
+
_context.n = 3;
|
|
122
123
|
break;
|
|
123
124
|
}
|
|
124
|
-
_context.n =
|
|
125
|
+
_context.n = 2;
|
|
125
126
|
return sleep();
|
|
126
|
-
case
|
|
127
|
+
case 2:
|
|
127
128
|
return _context.a(3, 1);
|
|
128
|
-
case
|
|
129
|
+
case 3:
|
|
129
130
|
if (!(formSubmitConfig !== null && formSubmitConfig !== void 0 && formSubmitConfig.allowUnchangedSubmit && !didPrepareUnchangedSubmit)) {
|
|
130
|
-
_context.n =
|
|
131
|
-
break;
|
|
132
|
-
}
|
|
133
|
-
if (!canMarkForm) {
|
|
134
|
-
_context.n = 6;
|
|
131
|
+
_context.n = 5;
|
|
135
132
|
break;
|
|
136
133
|
}
|
|
137
134
|
prepareFormForAutoSubmit(form, formSubmitConfig);
|
|
138
135
|
didPrepareUnchangedSubmit = true;
|
|
139
|
-
_context.n =
|
|
136
|
+
_context.n = 4;
|
|
140
137
|
return sleep();
|
|
141
|
-
case
|
|
142
|
-
return _context.a(3, 1);
|
|
143
|
-
case 6:
|
|
144
|
-
_context.n = 7;
|
|
145
|
-
return sleep();
|
|
146
|
-
case 7:
|
|
138
|
+
case 4:
|
|
147
139
|
return _context.a(3, 1);
|
|
148
|
-
case
|
|
140
|
+
case 5:
|
|
149
141
|
triggerFormSubmit({
|
|
150
142
|
form: form,
|
|
151
143
|
submitButton: submitButton
|
|
152
144
|
});
|
|
153
145
|
return _context.a(2);
|
|
154
|
-
case
|
|
146
|
+
case 6:
|
|
155
147
|
return _context.a(2);
|
|
156
148
|
}
|
|
157
149
|
}, _callee);
|
|
@@ -166,7 +158,7 @@ function wrapRender(component, render, formRef) {
|
|
|
166
158
|
return function renderWithRef(storyArgs) {
|
|
167
159
|
var args = _objectSpread2({}, storyArgs !== null && storyArgs !== void 0 ? storyArgs : {});
|
|
168
160
|
delete args.ref;
|
|
169
|
-
return /*#__PURE__*/
|
|
161
|
+
return /*#__PURE__*/React.createElement(component, _objectSpread2({
|
|
170
162
|
ref: formRef
|
|
171
163
|
}, args));
|
|
172
164
|
};
|
|
@@ -186,7 +178,7 @@ function withFormRef(children, formRef, bindings) {
|
|
|
186
178
|
ref: formRef
|
|
187
179
|
}) : value;
|
|
188
180
|
};
|
|
189
|
-
return /*#__PURE__*/
|
|
181
|
+
return /*#__PURE__*/React.cloneElement(children, {
|
|
190
182
|
component: storyComponent,
|
|
191
183
|
args: addRef((_ref3 = args !== null && args !== void 0 ? args : context === null || context === void 0 ? void 0 : context.args) !== null && _ref3 !== void 0 ? _ref3 : children === null || children === void 0 || (_children$props3 = children.props) === null || _children$props3 === void 0 ? void 0 : _children$props3.args),
|
|
192
184
|
render: boundRender,
|
|
@@ -202,7 +194,8 @@ function withFormRef(children, formRef, bindings) {
|
|
|
202
194
|
|
|
203
195
|
/**
|
|
204
196
|
* Авто-submit для интерактивного Storybook (Require / Validation / ServerError).
|
|
205
|
-
* При
|
|
197
|
+
* При primaryButtonHtmlType="button" вызывает formRef.current.submit() (final-form API)
|
|
198
|
+
* и вешает click на кнопку, чтобы ручной submit тоже работал.
|
|
206
199
|
* В Vitest не используется — submit делается в play.
|
|
207
200
|
*/
|
|
208
201
|
function FormSubmitWrapper(props) {
|
|
@@ -217,6 +210,17 @@ function FormSubmitWrapper(props) {
|
|
|
217
210
|
submit = _props$submit === void 0 ? true : _props$submit,
|
|
218
211
|
children = props.children;
|
|
219
212
|
var formSubmitConfig = parameters === null || parameters === void 0 ? void 0 : parameters.formSubmit;
|
|
213
|
+
useEffect(function () {
|
|
214
|
+
if (!submit) {
|
|
215
|
+
return undefined;
|
|
216
|
+
}
|
|
217
|
+
var abortController = new AbortController();
|
|
218
|
+
var unbindClick = bindSubmitButtonClick(formRef, abortController.signal);
|
|
219
|
+
return function () {
|
|
220
|
+
abortController.abort();
|
|
221
|
+
unbindClick === null || unbindClick === void 0 || unbindClick();
|
|
222
|
+
};
|
|
223
|
+
}, [formSubmitConfig, submit]);
|
|
220
224
|
useEffect(function () {
|
|
221
225
|
if (!submit) {
|
|
222
226
|
return undefined;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { F as FormSubmitWrapper } from './FormSubmitWrapper
|
|
2
|
-
import './_rollupPluginBabelHelpers-
|
|
1
|
+
export { F as FormSubmitWrapper } from './FormSubmitWrapper-CytvWwKi.js';
|
|
2
|
+
import './_rollupPluginBabelHelpers-OwKVS06F.js';
|
|
3
3
|
import 'react';
|
|
@@ -195,4 +195,4 @@ function _toPropertyKey(t) {
|
|
|
195
195
|
return "symbol" == typeof i ? i : i + "";
|
|
196
196
|
}
|
|
197
197
|
|
|
198
|
-
export {
|
|
198
|
+
export { _objectWithoutProperties as _, _asyncToGenerator as a, _regenerator as b, _objectSpread2 as c };
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
2
|
+
|
|
3
|
+
function getDefaultExportFromCjs (x) {
|
|
4
|
+
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Checks if `value` is classified as an `Array` object.
|
|
9
|
+
*
|
|
10
|
+
* @static
|
|
11
|
+
* @memberOf _
|
|
12
|
+
* @since 0.1.0
|
|
13
|
+
* @category Lang
|
|
14
|
+
* @param {*} value The value to check.
|
|
15
|
+
* @returns {boolean} Returns `true` if `value` is an array, else `false`.
|
|
16
|
+
* @example
|
|
17
|
+
*
|
|
18
|
+
* _.isArray([1, 2, 3]);
|
|
19
|
+
* // => true
|
|
20
|
+
*
|
|
21
|
+
* _.isArray(document.body.children);
|
|
22
|
+
* // => false
|
|
23
|
+
*
|
|
24
|
+
* _.isArray('abc');
|
|
25
|
+
* // => false
|
|
26
|
+
*
|
|
27
|
+
* _.isArray(_.noop);
|
|
28
|
+
* // => false
|
|
29
|
+
*/
|
|
30
|
+
|
|
31
|
+
var isArray_1;
|
|
32
|
+
var hasRequiredIsArray;
|
|
33
|
+
|
|
34
|
+
function requireIsArray () {
|
|
35
|
+
if (hasRequiredIsArray) return isArray_1;
|
|
36
|
+
hasRequiredIsArray = 1;
|
|
37
|
+
var isArray = Array.isArray;
|
|
38
|
+
|
|
39
|
+
isArray_1 = isArray;
|
|
40
|
+
return isArray_1;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export { commonjsGlobal as c, getDefaultExportFromCjs as g, requireIsArray as r };
|
|
@@ -7,26 +7,18 @@ const SOURCE_LINK = {
|
|
|
7
7
|
'component-editor': ({ importPath, rootPath }) => {
|
|
8
8
|
if (!rootPath) return undefined
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
10
|
+
const storiesFolderIndex = importPath.indexOf('/stories/')
|
|
11
|
+
const componentPath =
|
|
12
|
+
storiesFolderIndex !== -1
|
|
13
|
+
? `${importPath.slice(0, storiesFolderIndex)}/index.ts`
|
|
14
|
+
: importPath.replace(/\.stories\.(js|jsx|mjs|ts|tsx)$/, '.$1')
|
|
15
|
+
|
|
16
|
+
const fileUrl = getFileUrl(rootPath, componentPath)
|
|
14
17
|
|
|
15
|
-
if (componentFileUrl.pathname.includes('/stories')) {
|
|
16
|
-
const resultPath =
|
|
17
|
-
componentFileUrl.pathname.slice(
|
|
18
|
-
0,
|
|
19
|
-
componentFileUrl.pathname.indexOf('/stories'),
|
|
20
|
-
) + '/index.ts'
|
|
21
|
-
const resultLabelBase =
|
|
22
|
-
labelPath.slice(0, labelPath.indexOf('/stories')) + '/index.ts'
|
|
23
|
-
labelPath = resultLabelBase
|
|
24
|
-
componentFileUrl = resultPath
|
|
25
|
-
}
|
|
26
18
|
return {
|
|
27
19
|
type: 'editor',
|
|
28
20
|
label: 'VSCode — ' + componentPath,
|
|
29
|
-
href:
|
|
21
|
+
href: fileUrl.href,
|
|
30
22
|
icon: 'VSCodeIcon',
|
|
31
23
|
}
|
|
32
24
|
},
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import React, { useMemo } from 'react';
|
|
2
2
|
|
|
3
3
|
function withClearStoresDecorator(_ref) {
|
|
4
4
|
var clearStoreData = _ref.clearStoreData;
|
|
@@ -6,7 +6,7 @@ function withClearStoresDecorator(_ref) {
|
|
|
6
6
|
useMemo(function () {
|
|
7
7
|
clearStoreData();
|
|
8
8
|
}, [Story]);
|
|
9
|
-
return /*#__PURE__*/
|
|
9
|
+
return /*#__PURE__*/React.createElement(Story, null);
|
|
10
10
|
};
|
|
11
11
|
return Decorator;
|
|
12
12
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import React from 'react';
|
|
2
2
|
|
|
3
3
|
function withExtraProviders() {
|
|
4
4
|
var providers = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
@@ -9,7 +9,7 @@ function withExtraProviders() {
|
|
|
9
9
|
var item = providers[i];
|
|
10
10
|
var Component = item.provider;
|
|
11
11
|
var props = item.props || {};
|
|
12
|
-
currentStory = /*#__PURE__*/
|
|
12
|
+
currentStory = /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Component, props, currentStory));
|
|
13
13
|
}
|
|
14
14
|
return currentStory;
|
|
15
15
|
};
|
|
@@ -1,6 +1,62 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import { c as _objectSpread2 } from '../components/_rollupPluginBabelHelpers-OwKVS06F.js';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { r as requireIsArray, g as getDefaultExportFromCjs } from '../components/isArray-CPoGkdXv.js';
|
|
4
|
+
|
|
5
|
+
var castArray_1;
|
|
6
|
+
var hasRequiredCastArray;
|
|
7
|
+
|
|
8
|
+
function requireCastArray () {
|
|
9
|
+
if (hasRequiredCastArray) return castArray_1;
|
|
10
|
+
hasRequiredCastArray = 1;
|
|
11
|
+
var isArray = requireIsArray();
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Casts `value` as an array if it's not one.
|
|
15
|
+
*
|
|
16
|
+
* @static
|
|
17
|
+
* @memberOf _
|
|
18
|
+
* @since 4.4.0
|
|
19
|
+
* @category Lang
|
|
20
|
+
* @param {*} value The value to inspect.
|
|
21
|
+
* @returns {Array} Returns the cast array.
|
|
22
|
+
* @example
|
|
23
|
+
*
|
|
24
|
+
* _.castArray(1);
|
|
25
|
+
* // => [1]
|
|
26
|
+
*
|
|
27
|
+
* _.castArray({ 'a': 1 });
|
|
28
|
+
* // => [{ 'a': 1 }]
|
|
29
|
+
*
|
|
30
|
+
* _.castArray('abc');
|
|
31
|
+
* // => ['abc']
|
|
32
|
+
*
|
|
33
|
+
* _.castArray(null);
|
|
34
|
+
* // => [null]
|
|
35
|
+
*
|
|
36
|
+
* _.castArray(undefined);
|
|
37
|
+
* // => [undefined]
|
|
38
|
+
*
|
|
39
|
+
* _.castArray();
|
|
40
|
+
* // => []
|
|
41
|
+
*
|
|
42
|
+
* var array = [1, 2, 3];
|
|
43
|
+
* console.log(_.castArray(array) === array);
|
|
44
|
+
* // => true
|
|
45
|
+
*/
|
|
46
|
+
function castArray() {
|
|
47
|
+
if (!arguments.length) {
|
|
48
|
+
return [];
|
|
49
|
+
}
|
|
50
|
+
var value = arguments[0];
|
|
51
|
+
return isArray(value) ? value : [value];
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
castArray_1 = castArray;
|
|
55
|
+
return castArray_1;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
var castArrayExports = requireCastArray();
|
|
59
|
+
var castArray = /*@__PURE__*/getDefaultExportFromCjs(castArrayExports);
|
|
4
60
|
|
|
5
61
|
function withFigmaSourceLink() {
|
|
6
62
|
var decorator = function decorator(Story, _ref) {
|
|
@@ -8,7 +64,7 @@ function withFigmaSourceLink() {
|
|
|
8
64
|
context = _ref.context;
|
|
9
65
|
var sourceLink = parameters.sourceLink || {};
|
|
10
66
|
if (parameters.design) {
|
|
11
|
-
var designList =
|
|
67
|
+
var designList = castArray(parameters.design);
|
|
12
68
|
if (!sourceLink.links) {
|
|
13
69
|
sourceLink.links = {};
|
|
14
70
|
}
|
|
@@ -26,7 +82,7 @@ function withFigmaSourceLink() {
|
|
|
26
82
|
sourceLink: sourceLink
|
|
27
83
|
})
|
|
28
84
|
});
|
|
29
|
-
return /*#__PURE__*/
|
|
85
|
+
return /*#__PURE__*/React.createElement(Story, updatedContext);
|
|
30
86
|
};
|
|
31
87
|
return decorator;
|
|
32
88
|
}
|