@itcase/storybook-config 1.2.80 → 1.2.82

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.
@@ -2,6 +2,10 @@
2
2
 
3
3
  var React = require('react');
4
4
 
5
+ function isVitestEnvironment() {
6
+ return Boolean(undefined?.VITEST);
7
+ }
8
+
5
9
  const SUBMIT_POLL_MS = 50;
6
10
  function getStoryPreviewDocument() {
7
11
  const previewIframe = document.getElementById('storybook-preview-iframe') ?? document.querySelector('iframe[data-is-storybook="true"]');
@@ -173,7 +177,9 @@ function withFormRef(children, formRef, bindings) {
173
177
  /**
174
178
  * Авто-submit для интерактивного Storybook (Require / Validation / ServerError).
175
179
  * При primaryButtonHtmlType="button" — formRef.current.submit() (final-form API),
176
- * при type="submit" — click по кнопке. В Vitest submit в play.
180
+ * при type="submit" — click по кнопке. В Vitest submit в play — auto-submit не
181
+ * запускаем, иначе второй клик из play ставит modifiedSinceLastSubmit и прячет
182
+ * non-field notification.
177
183
  */
178
184
  function FormSubmitWrapper(props) {
179
185
  const formRef = React.useRef(null);
@@ -187,8 +193,9 @@ function FormSubmitWrapper(props) {
187
193
  children
188
194
  } = props;
189
195
  const storyArgs = args ?? context?.args ?? children?.props?.args ?? {};
196
+ const shouldAutoSubmit = submit && !isVitestEnvironment();
190
197
  React.useEffect(() => {
191
- if (!submit) {
198
+ if (!shouldAutoSubmit) {
192
199
  return undefined;
193
200
  }
194
201
  delete formRef.__itcaseDidAutoSubmit;
@@ -198,7 +205,7 @@ function FormSubmitWrapper(props) {
198
205
  abortController.abort();
199
206
  delete formRef.__itcaseDidAutoSubmit;
200
207
  };
201
- }, [submit, storyArgs.errors]);
208
+ }, [shouldAutoSubmit, storyArgs.errors]);
202
209
 
203
210
  // eslint-disable-next-line react-hooks/refs -- ref уходит в cloneElement внутри bound render
204
211
  return withFormRef(children, formRef, {
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var FormSubmitWrapper = require('../../FormSubmitWrapper-_VeLgVir.js');
3
+ var FormSubmitWrapper = require('../../FormSubmitWrapper-Bv5qs18h.js');
4
4
  require('react');
5
5
 
6
6
 
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  require('react');
4
- var FormSubmitWrapper = require('../../FormSubmitWrapper-_VeLgVir.js');
4
+ var FormSubmitWrapper = require('../../FormSubmitWrapper-Bv5qs18h.js');
5
5
  var isArray = require('../../isArray-DJguRq_2.js');
6
6
  require('@itcase/common');
7
7
  require('msw');
@@ -10,7 +10,7 @@ var withUiDecorator = require('./decorators/withUiDecorator.js');
10
10
  require('react');
11
11
  require('react/jsx-runtime');
12
12
  require('../isArray-DJguRq_2.js');
13
- require('../FormSubmitWrapper-_VeLgVir.js');
13
+ require('../FormSubmitWrapper-Bv5qs18h.js');
14
14
  require('@itcase/common');
15
15
  require('msw');
16
16
  require('@itcase/ui-core/context');
@@ -2,7 +2,9 @@ import React from 'react';
2
2
  /**
3
3
  * Авто-submit для интерактивного Storybook (Require / Validation / ServerError).
4
4
  * При primaryButtonHtmlType="button" — formRef.current.submit() (final-form API),
5
- * при type="submit" — click по кнопке. В Vitest submit в play.
5
+ * при type="submit" — click по кнопке. В Vitest submit в play — auto-submit не
6
+ * запускаем, иначе второй клик из play ставит modifiedSinceLastSubmit и прячет
7
+ * non-field notification.
6
8
  */
7
9
  declare function FormSubmitWrapper(props: any): React.FunctionComponentElement<{
8
10
  component: any;
@@ -1,4 +1,5 @@
1
1
  import React, { useEffect, useRef } from 'react';
2
+ import { isVitestEnvironment } from '../../utils/isVitestEnvironment';
2
3
  import { autoSubmitForm } from './autoSubmitForm';
3
4
  function wrapRender(component, render, formRef, defaultArgs = {}) {
4
5
  if (typeof render !== 'function') {
@@ -54,14 +55,17 @@ function withFormRef(children, formRef, bindings) {
54
55
  /**
55
56
  * Авто-submit для интерактивного Storybook (Require / Validation / ServerError).
56
57
  * При primaryButtonHtmlType="button" — formRef.current.submit() (final-form API),
57
- * при type="submit" — click по кнопке. В Vitest submit в play.
58
+ * при type="submit" — click по кнопке. В Vitest submit в play — auto-submit не
59
+ * запускаем, иначе второй клик из play ставит modifiedSinceLastSubmit и прячет
60
+ * non-field notification.
58
61
  */
59
62
  function FormSubmitWrapper(props) {
60
63
  const formRef = useRef(null);
61
64
  const { component, args, render, allArgs, context, submit = true, children, } = props;
62
65
  const storyArgs = args ?? context?.args ?? children?.props?.args ?? {};
66
+ const shouldAutoSubmit = submit && !isVitestEnvironment();
63
67
  useEffect(() => {
64
- if (!submit) {
68
+ if (!shouldAutoSubmit) {
65
69
  return undefined;
66
70
  }
67
71
  delete formRef.__itcaseDidAutoSubmit;
@@ -71,7 +75,7 @@ function FormSubmitWrapper(props) {
71
75
  abortController.abort();
72
76
  delete formRef.__itcaseDidAutoSubmit;
73
77
  };
74
- }, [submit, storyArgs.errors]);
78
+ }, [shouldAutoSubmit, storyArgs.errors]);
75
79
  // eslint-disable-next-line react-hooks/refs -- ref уходит в cloneElement внутри bound render
76
80
  return withFormRef(children, formRef, {
77
81
  component,
@@ -1,5 +1,9 @@
1
1
  import React, { useRef, useEffect } from 'react';
2
2
 
3
+ function isVitestEnvironment() {
4
+ return Boolean(import.meta.env?.VITEST);
5
+ }
6
+
3
7
  const SUBMIT_POLL_MS = 50;
4
8
  function getStoryPreviewDocument() {
5
9
  const previewIframe = document.getElementById('storybook-preview-iframe') ?? document.querySelector('iframe[data-is-storybook="true"]');
@@ -171,7 +175,9 @@ function withFormRef(children, formRef, bindings) {
171
175
  /**
172
176
  * Авто-submit для интерактивного Storybook (Require / Validation / ServerError).
173
177
  * При primaryButtonHtmlType="button" — formRef.current.submit() (final-form API),
174
- * при type="submit" — click по кнопке. В Vitest submit в play.
178
+ * при type="submit" — click по кнопке. В Vitest submit в play — auto-submit не
179
+ * запускаем, иначе второй клик из play ставит modifiedSinceLastSubmit и прячет
180
+ * non-field notification.
175
181
  */
176
182
  function FormSubmitWrapper(props) {
177
183
  const formRef = useRef(null);
@@ -185,8 +191,9 @@ function FormSubmitWrapper(props) {
185
191
  children
186
192
  } = props;
187
193
  const storyArgs = args ?? context?.args ?? children?.props?.args ?? {};
194
+ const shouldAutoSubmit = submit && !isVitestEnvironment();
188
195
  useEffect(() => {
189
- if (!submit) {
196
+ if (!shouldAutoSubmit) {
190
197
  return undefined;
191
198
  }
192
199
  delete formRef.__itcaseDidAutoSubmit;
@@ -196,7 +203,7 @@ function FormSubmitWrapper(props) {
196
203
  abortController.abort();
197
204
  delete formRef.__itcaseDidAutoSubmit;
198
205
  };
199
- }, [submit, storyArgs.errors]);
206
+ }, [shouldAutoSubmit, storyArgs.errors]);
200
207
 
201
208
  // eslint-disable-next-line react-hooks/refs -- ref уходит в cloneElement внутри bound render
202
209
  return withFormRef(children, formRef, {
@@ -1,2 +1,2 @@
1
- export { F as FormSubmitWrapper } from './FormSubmitWrapper-B2tMQZu2.js';
1
+ export { F as FormSubmitWrapper } from './FormSubmitWrapper-EwNkaMht.js';
2
2
  import 'react';
@@ -4,6 +4,7 @@ const ADDONS_VITE = [
4
4
  '@storybook/addon-designs',
5
5
  '@storybook/addon-docs',
6
6
  '@storybook/addon-vitest',
7
+ 'msw-storybook-addon',
7
8
  'storybook-addon-source-link',
8
9
  ];
9
10
  export { ADDONS_VITE };
@@ -1,5 +1,5 @@
1
1
  import 'react';
2
- import { F as FormSubmitWrapper } from '../components/FormSubmitWrapper-B2tMQZu2.js';
2
+ import { F as FormSubmitWrapper } from '../components/FormSubmitWrapper-EwNkaMht.js';
3
3
  import { c as commonjsGlobal, r as requireIsArray } from '../components/isArray-CPoGkdXv.js';
4
4
  import '@itcase/common';
5
5
  import 'msw';
@@ -8,7 +8,7 @@ export { withUiDecorator } from './decorators/withUiDecorator.js';
8
8
  import 'react';
9
9
  import 'react/jsx-runtime';
10
10
  import './components/isArray-CPoGkdXv.js';
11
- import './components/FormSubmitWrapper-B2tMQZu2.js';
11
+ import './components/FormSubmitWrapper-EwNkaMht.js';
12
12
  import '@itcase/common';
13
13
  import 'msw';
14
14
  import '@itcase/ui-core/context';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@itcase/storybook-config",
3
- "version": "1.2.80",
3
+ "version": "1.2.82",
4
4
  "author": "ITCase",
5
5
  "description": "Storybook configuration package",
6
6
  "engines": {
@@ -100,27 +100,27 @@
100
100
  "@react-native-async-storage/async-storage": "^3.1.1",
101
101
  "@react-native-community/datetimepicker": "^9.1.0",
102
102
  "@storybook/addon-designs": "^11.1.4",
103
- "@storybook/addon-docs": "^10.5.5",
104
- "@storybook/addon-links": "^10.5.5",
103
+ "@storybook/addon-docs": "^10.5.7",
104
+ "@storybook/addon-links": "^10.5.7",
105
105
  "@storybook/addon-ondevice-actions": "10.5.4",
106
106
  "@storybook/addon-ondevice-backgrounds": "10.5.4",
107
107
  "@storybook/addon-ondevice-controls": "10.5.4",
108
108
  "@storybook/addon-ondevice-notes": "^10.5.4",
109
109
  "@storybook/addon-react-native-web": "^0.0.29",
110
110
  "@storybook/addon-styling-webpack": "^3.0.2",
111
- "@storybook/addon-themes": "^10.5.5",
112
- "@storybook/addon-vitest": "^10.5.5",
111
+ "@storybook/addon-themes": "^10.5.7",
112
+ "@storybook/addon-vitest": "^10.5.7",
113
113
  "@storybook/addon-webpack5-compiler-swc": "^4.0.3",
114
- "@storybook/builder-vite": "^10.5.5",
115
- "@storybook/nextjs": "^10.5.5",
116
- "@storybook/nextjs-vite": "^10.5.5",
117
- "@storybook/react": "^10.5.5",
114
+ "@storybook/builder-vite": "^10.5.7",
115
+ "@storybook/nextjs": "^10.5.7",
116
+ "@storybook/nextjs-vite": "^10.5.7",
117
+ "@storybook/react": "^10.5.7",
118
118
  "@storybook/react-native": "10.5.4",
119
119
  "@storybook/react-native-ui-lite": "10.5.4",
120
- "@storybook/react-native-web-vite": "^10.5.5",
121
- "@storybook/react-vite": "^10.5.5",
122
- "@storybook/react-webpack5": "^10.5.5",
123
- "@vitejs/plugin-react": "^6.0.4",
120
+ "@storybook/react-native-web-vite": "^10.5.7",
121
+ "@storybook/react-vite": "^10.5.7",
122
+ "@storybook/react-webpack5": "^10.5.7",
123
+ "@vitejs/plugin-react": "^6.0.5",
124
124
  "@vitest/browser-playwright": "^4.1.10",
125
125
  "babel-loader": "^10.1.1",
126
126
  "babel-plugin-react-docgen": "^4.2.1",
@@ -132,13 +132,13 @@
132
132
  "msw-storybook-addon": "^3.0.0",
133
133
  "react-native-gesture-handler": "^3.1.0",
134
134
  "react-native-reanimated": "^4.5.3",
135
- "react-native-safe-area-context": "^5.8.0",
135
+ "react-native-safe-area-context": "^5.8.1",
136
136
  "react-native-svg": "^15.15.5",
137
137
  "react-native-web": "^0.21.2",
138
138
  "react-native-worklets": "^0.11.3",
139
- "storybook": "^10.5.5",
139
+ "storybook": "^10.5.7",
140
140
  "storybook-addon-source-link": "^2.0.1",
141
- "vite": "^8.1.5",
141
+ "vite": "^8.2.1",
142
142
  "vite-plugin-babel": "^1.7.3",
143
143
  "vite-plugin-svgr": "^5.2.0",
144
144
  "vite-tsconfig-paths": "^6.1.1",
@@ -153,9 +153,9 @@
153
153
  "@commitlint/cli": "^21.2.1",
154
154
  "@commitlint/config-conventional": "^21.2.0",
155
155
  "@itcase/common": "^1.2.50",
156
- "@itcase/lint": "^1.1.118",
157
- "@itcase/ui-core": "^1.10.61",
158
- "@itcase/ui-web": "^1.10.61",
156
+ "@itcase/lint": "^1.1.121",
157
+ "@itcase/ui-core": "^1.10.66",
158
+ "@itcase/ui-web": "^1.10.66",
159
159
  "@react-native-community/cli": "20.2.0",
160
160
  "@react-native-community/cli-platform-android": "20.2.0",
161
161
  "@react-native-community/cli-platform-ios": "20.2.0",
@@ -167,7 +167,7 @@
167
167
  "@rollup/plugin-commonjs": "^29.0.3",
168
168
  "@rollup/plugin-json": "^6.1.0",
169
169
  "@rollup/plugin-node-resolve": "^16.0.3",
170
- "@storybook/addon-docs": "^10.5.5",
170
+ "@storybook/addon-docs": "^10.5.7",
171
171
  "@types/react": "^18",
172
172
  "@types/react-dom": "^18",
173
173
  "babel-plugin-transform-inline-environment-variables": "^0.4.4",
@@ -175,8 +175,8 @@
175
175
  "eslint": "9.39.2",
176
176
  "glob": "^13.0.6",
177
177
  "husky": "^9.1.7",
178
- "lint-staged": "^17.2.0",
179
- "next": "^16.2.12",
178
+ "lint-staged": "^17.3.0",
179
+ "next": "^16.3.0",
180
180
  "prettier": "^3.9.6",
181
181
  "react": "^18",
182
182
  "react-docgen": "^8.0.3",
@@ -184,12 +184,12 @@
184
184
  "react-dom": "^18",
185
185
  "react-native": "0.86.2",
186
186
  "react-native-web": "^0.21.2",
187
- "rollup": "^4.62.3",
187
+ "rollup": "^4.62.4",
188
188
  "rollup-plugin-copy": "^3.5.0",
189
189
  "rollup-plugin-peer-deps-external": "^2.2.4",
190
- "semantic-release": "^25.0.8",
190
+ "semantic-release": "^25.0.9",
191
191
  "stylelint": "^17.14.1",
192
192
  "typescript": "^6.0.3",
193
- "vite": "^8.1.5"
193
+ "vite": "^8.2.1"
194
194
  }
195
195
  }