@itcase/storybook-config 1.2.68 → 1.2.70
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/dist/{FormSubmitWrapper-i32wPLJH.js → FormSubmitWrapper-DA2tkSEl.js} +38 -2
- package/dist/cjs/components/FormSubmitWrapper.js +1 -1
- package/dist/cjs/decorators/withFormSubmitDecorator.js +1 -1
- package/dist/cjs/decorators.js +1 -1
- package/dist/components/{FormSubmitWrapper-DvowO4lz.js → FormSubmitWrapper--d5p3re1.js} +38 -2
- package/dist/components/FormSubmitWrapper.js +1 -1
- package/dist/config/config/mainConfigNextJsVite.js +3 -0
- package/dist/config/config/mainConfigVite.js +3 -0
- package/dist/config/vite/getMediaProxyServerConfig.js +19 -0
- package/dist/decorators/withFormSubmitDecorator.js +1 -1
- package/dist/decorators.js +1 -1
- package/package.json +7 -7
|
@@ -52,6 +52,38 @@ function findSubmitButton(root) {
|
|
|
52
52
|
var byTestId = form.querySelector('button[data-testid*="Submit"], button[data-testid*="SignIn"], button[data-testid*="Create"]');
|
|
53
53
|
return byTestId;
|
|
54
54
|
}
|
|
55
|
+
function canSubmitFormApi(form) {
|
|
56
|
+
return typeof (form === null || form === void 0 ? void 0 : form.submit) === 'function' && typeof (form === null || form === void 0 ? void 0 : form.getRegisteredFields) === 'function' && form.getRegisteredFields().length > 0;
|
|
57
|
+
}
|
|
58
|
+
function isNativeSubmitButton(button) {
|
|
59
|
+
if (!button) {
|
|
60
|
+
return false;
|
|
61
|
+
}
|
|
62
|
+
var type = button.type || button.getAttribute('type');
|
|
63
|
+
return type === 'submit';
|
|
64
|
+
}
|
|
65
|
+
function triggerFormSubmit(_ref2) {
|
|
66
|
+
var form = _ref2.form,
|
|
67
|
+
submitButton = _ref2.submitButton;
|
|
68
|
+
if (isNativeSubmitButton(submitButton)) {
|
|
69
|
+
submitButton.click();
|
|
70
|
+
return true;
|
|
71
|
+
}
|
|
72
|
+
if (canSubmitFormApi(form)) {
|
|
73
|
+
form.submit();
|
|
74
|
+
return true;
|
|
75
|
+
}
|
|
76
|
+
var htmlForm = submitButton === null || submitButton === void 0 ? void 0 : submitButton.closest('form');
|
|
77
|
+
if (htmlForm && typeof htmlForm.requestSubmit === 'function') {
|
|
78
|
+
htmlForm.requestSubmit();
|
|
79
|
+
return true;
|
|
80
|
+
}
|
|
81
|
+
if (submitButton) {
|
|
82
|
+
submitButton.click();
|
|
83
|
+
return true;
|
|
84
|
+
}
|
|
85
|
+
return false;
|
|
86
|
+
}
|
|
55
87
|
function getFormSubmitTarget(formRef) {
|
|
56
88
|
var root = getMountRoot();
|
|
57
89
|
var submitButton = findSubmitButton(root);
|
|
@@ -59,7 +91,7 @@ function getFormSubmitTarget(formRef) {
|
|
|
59
91
|
var hasFields = typeof (form === null || form === void 0 ? void 0 : form.getRegisteredFields) === 'function' && form.getRegisteredFields().length > 0;
|
|
60
92
|
return {
|
|
61
93
|
canMarkForm: Boolean(form && hasFields),
|
|
62
|
-
canSubmit: Boolean(submitButton),
|
|
94
|
+
canSubmit: Boolean(submitButton) || canSubmitFormApi(form),
|
|
63
95
|
form: form,
|
|
64
96
|
submitButton: submitButton
|
|
65
97
|
};
|
|
@@ -116,7 +148,10 @@ function _autoSubmitForm() {
|
|
|
116
148
|
case 7:
|
|
117
149
|
return _context.a(3, 1);
|
|
118
150
|
case 8:
|
|
119
|
-
|
|
151
|
+
triggerFormSubmit({
|
|
152
|
+
form: form,
|
|
153
|
+
submitButton: submitButton
|
|
154
|
+
});
|
|
120
155
|
return _context.a(2);
|
|
121
156
|
case 9:
|
|
122
157
|
return _context.a(2);
|
|
@@ -169,6 +204,7 @@ function withFormRef(children, formRef, bindings) {
|
|
|
169
204
|
|
|
170
205
|
/**
|
|
171
206
|
* Авто-submit для интерактивного Storybook (Require / Validation / ServerError).
|
|
207
|
+
* При type="button" вызывает formRef.current.submit() (final-form API).
|
|
172
208
|
* В Vitest не используется — submit делается в play.
|
|
173
209
|
*/
|
|
174
210
|
function FormSubmitWrapper(props) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var React = require('react');
|
|
4
|
-
var FormSubmitWrapper = require('../../FormSubmitWrapper-
|
|
4
|
+
var FormSubmitWrapper = require('../../FormSubmitWrapper-DA2tkSEl.js');
|
|
5
5
|
require('lodash/camelCase');
|
|
6
6
|
require('@itcase/common');
|
|
7
7
|
require('msw');
|
package/dist/cjs/decorators.js
CHANGED
|
@@ -10,7 +10,7 @@ var withUiDecorator = require('./decorators/withUiDecorator.js');
|
|
|
10
10
|
require('react');
|
|
11
11
|
require('../_rollupPluginBabelHelpers-D8XyM9rZ.js');
|
|
12
12
|
require('lodash/castArray');
|
|
13
|
-
require('../FormSubmitWrapper-
|
|
13
|
+
require('../FormSubmitWrapper-DA2tkSEl.js');
|
|
14
14
|
require('lodash/camelCase');
|
|
15
15
|
require('@itcase/common');
|
|
16
16
|
require('msw');
|
|
@@ -50,6 +50,38 @@ function findSubmitButton(root) {
|
|
|
50
50
|
var byTestId = form.querySelector('button[data-testid*="Submit"], button[data-testid*="SignIn"], button[data-testid*="Create"]');
|
|
51
51
|
return byTestId;
|
|
52
52
|
}
|
|
53
|
+
function canSubmitFormApi(form) {
|
|
54
|
+
return typeof (form === null || form === void 0 ? void 0 : form.submit) === 'function' && typeof (form === null || form === void 0 ? void 0 : form.getRegisteredFields) === 'function' && form.getRegisteredFields().length > 0;
|
|
55
|
+
}
|
|
56
|
+
function isNativeSubmitButton(button) {
|
|
57
|
+
if (!button) {
|
|
58
|
+
return false;
|
|
59
|
+
}
|
|
60
|
+
var type = button.type || button.getAttribute('type');
|
|
61
|
+
return type === 'submit';
|
|
62
|
+
}
|
|
63
|
+
function triggerFormSubmit(_ref2) {
|
|
64
|
+
var form = _ref2.form,
|
|
65
|
+
submitButton = _ref2.submitButton;
|
|
66
|
+
if (isNativeSubmitButton(submitButton)) {
|
|
67
|
+
submitButton.click();
|
|
68
|
+
return true;
|
|
69
|
+
}
|
|
70
|
+
if (canSubmitFormApi(form)) {
|
|
71
|
+
form.submit();
|
|
72
|
+
return true;
|
|
73
|
+
}
|
|
74
|
+
var htmlForm = submitButton === null || submitButton === void 0 ? void 0 : submitButton.closest('form');
|
|
75
|
+
if (htmlForm && typeof htmlForm.requestSubmit === 'function') {
|
|
76
|
+
htmlForm.requestSubmit();
|
|
77
|
+
return true;
|
|
78
|
+
}
|
|
79
|
+
if (submitButton) {
|
|
80
|
+
submitButton.click();
|
|
81
|
+
return true;
|
|
82
|
+
}
|
|
83
|
+
return false;
|
|
84
|
+
}
|
|
53
85
|
function getFormSubmitTarget(formRef) {
|
|
54
86
|
var root = getMountRoot();
|
|
55
87
|
var submitButton = findSubmitButton(root);
|
|
@@ -57,7 +89,7 @@ function getFormSubmitTarget(formRef) {
|
|
|
57
89
|
var hasFields = typeof (form === null || form === void 0 ? void 0 : form.getRegisteredFields) === 'function' && form.getRegisteredFields().length > 0;
|
|
58
90
|
return {
|
|
59
91
|
canMarkForm: Boolean(form && hasFields),
|
|
60
|
-
canSubmit: Boolean(submitButton),
|
|
92
|
+
canSubmit: Boolean(submitButton) || canSubmitFormApi(form),
|
|
61
93
|
form: form,
|
|
62
94
|
submitButton: submitButton
|
|
63
95
|
};
|
|
@@ -114,7 +146,10 @@ function _autoSubmitForm() {
|
|
|
114
146
|
case 7:
|
|
115
147
|
return _context.a(3, 1);
|
|
116
148
|
case 8:
|
|
117
|
-
|
|
149
|
+
triggerFormSubmit({
|
|
150
|
+
form: form,
|
|
151
|
+
submitButton: submitButton
|
|
152
|
+
});
|
|
118
153
|
return _context.a(2);
|
|
119
154
|
case 9:
|
|
120
155
|
return _context.a(2);
|
|
@@ -167,6 +202,7 @@ function withFormRef(children, formRef, bindings) {
|
|
|
167
202
|
|
|
168
203
|
/**
|
|
169
204
|
* Авто-submit для интерактивного Storybook (Require / Validation / ServerError).
|
|
205
|
+
* При type="button" вызывает formRef.current.submit() (final-form API).
|
|
170
206
|
* В Vitest не используется — submit делается в play.
|
|
171
207
|
*/
|
|
172
208
|
function FormSubmitWrapper(props) {
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import svgr from 'vite-plugin-svgr'
|
|
2
2
|
|
|
3
|
+
import { getMediaProxyServerConfig } from '../vite/getMediaProxyServerConfig.js'
|
|
4
|
+
|
|
3
5
|
const MAIN_CONFIG_NEXTJS_VITE = {
|
|
4
6
|
env: (config) => ({
|
|
5
7
|
...config,
|
|
@@ -24,6 +26,7 @@ const MAIN_CONFIG_NEXTJS_VITE = {
|
|
|
24
26
|
...config.resolve,
|
|
25
27
|
tsconfigPaths: true,
|
|
26
28
|
},
|
|
29
|
+
...getMediaProxyServerConfig(),
|
|
27
30
|
})
|
|
28
31
|
},
|
|
29
32
|
core: {
|
|
@@ -2,6 +2,8 @@ import path from 'node:path'
|
|
|
2
2
|
|
|
3
3
|
import svgr from 'vite-plugin-svgr'
|
|
4
4
|
|
|
5
|
+
import { getMediaProxyServerConfig } from '../vite/getMediaProxyServerConfig.js'
|
|
6
|
+
|
|
5
7
|
const MAIN_CONFIG_VITE = {
|
|
6
8
|
viteFinal: async function (config) {
|
|
7
9
|
const { mergeConfig } = await import('vite')
|
|
@@ -65,6 +67,7 @@ const MAIN_CONFIG_VITE = {
|
|
|
65
67
|
: {}),
|
|
66
68
|
usePolling: false,
|
|
67
69
|
},
|
|
70
|
+
...getMediaProxyServerConfig().server,
|
|
68
71
|
},
|
|
69
72
|
})
|
|
70
73
|
},
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
function getMediaProxyServerConfig() {
|
|
2
|
+
const restBaseUrl = process.env.REST_BASE_URL?.replace(/\/$/, '')
|
|
3
|
+
if (!restBaseUrl) {
|
|
4
|
+
return {}
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
return {
|
|
8
|
+
server: {
|
|
9
|
+
proxy: {
|
|
10
|
+
'/media': {
|
|
11
|
+
changeOrigin: true,
|
|
12
|
+
target: restBaseUrl,
|
|
13
|
+
},
|
|
14
|
+
},
|
|
15
|
+
},
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export { getMediaProxyServerConfig }
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React__default from 'react';
|
|
2
|
-
import { F as FormSubmitWrapper } from '../components/FormSubmitWrapper
|
|
2
|
+
import { F as FormSubmitWrapper } from '../components/FormSubmitWrapper--d5p3re1.js';
|
|
3
3
|
import 'lodash/camelCase';
|
|
4
4
|
import '@itcase/common';
|
|
5
5
|
import 'msw';
|
package/dist/decorators.js
CHANGED
|
@@ -8,7 +8,7 @@ export { withUiDecorator } from './decorators/withUiDecorator.js';
|
|
|
8
8
|
import 'react';
|
|
9
9
|
import './components/_rollupPluginBabelHelpers-DQ-fuxJg.js';
|
|
10
10
|
import 'lodash/castArray';
|
|
11
|
-
import './components/FormSubmitWrapper
|
|
11
|
+
import './components/FormSubmitWrapper--d5p3re1.js';
|
|
12
12
|
import 'lodash/camelCase';
|
|
13
13
|
import '@itcase/common';
|
|
14
14
|
import 'msw';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@itcase/storybook-config",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.70",
|
|
4
4
|
"author": "ITCase",
|
|
5
5
|
"description": "Storybook configuration package",
|
|
6
6
|
"engines": {
|
|
@@ -118,12 +118,12 @@
|
|
|
118
118
|
"http-proxy-middleware": "^4.0.0",
|
|
119
119
|
"msw": "^2.14.6",
|
|
120
120
|
"msw-storybook-addon": "^2.0.7",
|
|
121
|
-
"react-native-gesture-handler": "^
|
|
122
|
-
"react-native-reanimated": "^4.
|
|
121
|
+
"react-native-gesture-handler": "^3.0.0",
|
|
122
|
+
"react-native-reanimated": "^4.4.0",
|
|
123
123
|
"react-native-safe-area-context": "^5.8.0",
|
|
124
124
|
"react-native-svg": "^15.15.5",
|
|
125
125
|
"react-native-web": "^0.21.2",
|
|
126
|
-
"react-native-worklets": "^0.
|
|
126
|
+
"react-native-worklets": "^0.9.1",
|
|
127
127
|
"storybook": "^10.4.1",
|
|
128
128
|
"storybook-addon-source-link": "^2.0.1",
|
|
129
129
|
"vite": "^8.0.14",
|
|
@@ -141,8 +141,8 @@
|
|
|
141
141
|
"@commitlint/config-conventional": "^21.0.1",
|
|
142
142
|
"@itcase/common": "^1.2.43",
|
|
143
143
|
"@itcase/lint": "^1.1.116",
|
|
144
|
-
"@itcase/ui-core": "^1.10.
|
|
145
|
-
"@itcase/ui-web": "^1.10.
|
|
144
|
+
"@itcase/ui-core": "^1.10.8",
|
|
145
|
+
"@itcase/ui-web": "^1.10.8",
|
|
146
146
|
"@react-native-community/cli": "20.1.3",
|
|
147
147
|
"@react-native-community/cli-platform-android": "20.1.3",
|
|
148
148
|
"@react-native-community/cli-platform-ios": "20.1.3",
|
|
@@ -176,7 +176,7 @@
|
|
|
176
176
|
"rollup-plugin-peer-deps-external": "^2.2.4",
|
|
177
177
|
"semantic-release": "^25.0.3",
|
|
178
178
|
"stylelint": "^17.12.0",
|
|
179
|
-
"typescript": "^
|
|
179
|
+
"typescript": "^6.0.3",
|
|
180
180
|
"vite": "^8.0.14"
|
|
181
181
|
}
|
|
182
182
|
}
|