@itcase/storybook-config 1.1.64 → 1.1.66

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,12 +2,12 @@
2
2
 
3
3
  var React = require('react');
4
4
  var castArray = require('lodash/castArray');
5
- var Notifications = require('@itcase/ui/context/Notifications');
6
- var UIContext = require('@itcase/ui/context/UIContext');
7
5
  var index = require('./components/FormSubmitWrapper.js');
8
6
  require('lodash/camelCase');
9
7
  require('@itcase/common');
10
8
  var msw = require('msw');
9
+ var Notifications = require('@itcase/ui/context/Notifications');
10
+ var UIContext = require('@itcase/ui/context/UIContext');
11
11
 
12
12
  function withExtraProviders(providers) {
13
13
  if (providers === void 0) {
@@ -55,26 +55,6 @@ function withFigmaSourceLink() {
55
55
  return decorator;
56
56
  }
57
57
 
58
- function withLayout() {
59
- return function (Story, _ref) {
60
- var parameters = _ref.parameters;
61
- var layouts = {
62
- top: 'sb-layout-top',
63
- right: 'sb-layout-right',
64
- bottom: 'sb-layout-bottom',
65
- left: 'sb-layout-left',
66
- center: 'sb-layout-center'
67
- };
68
- var layoutClass = layouts[(parameters == null ? void 0 : parameters.layout) || ''];
69
- if (!layoutClass) {
70
- return /*#__PURE__*/React.createElement(Story, null);
71
- }
72
- return /*#__PURE__*/React.createElement("div", {
73
- className: layoutClass
74
- }, /*#__PURE__*/React.createElement(Story, null));
75
- };
76
- }
77
-
78
58
  function asyncGeneratorStep(n, t, e, r, o, a, c) {
79
59
  try {
80
60
  var i = n[a](c),
@@ -455,6 +435,39 @@ function hasFormParameters(parameters) {
455
435
  return Boolean(parameters.require || parameters.validation || parameters.serverError || parameters.error500);
456
436
  }
457
437
 
438
+ function withFormSubmitDecorator() {
439
+ var decorator = function decorator(Story, _ref) {
440
+ _ref.args;
441
+ var parameters = _ref.parameters,
442
+ context = _ref.context;
443
+ var updatedContext = Object.assign({}, context, {
444
+ parameters: Object.assign({}, context.parameters)
445
+ });
446
+ return hasFormParameters(parameters) ? /*#__PURE__*/React.createElement(index.FormSubmitWrapper, updatedContext, /*#__PURE__*/React.createElement(Story, updatedContext)) : /*#__PURE__*/React.createElement(Story, updatedContext);
447
+ };
448
+ return decorator;
449
+ }
450
+
451
+ function withLayoutDecorator() {
452
+ return function (Story, _ref) {
453
+ var parameters = _ref.parameters;
454
+ var layouts = {
455
+ top: 'sb-layout-top',
456
+ right: 'sb-layout-right',
457
+ bottom: 'sb-layout-bottom',
458
+ left: 'sb-layout-left',
459
+ center: 'sb-layout-center'
460
+ };
461
+ var layoutClass = layouts[(parameters == null ? void 0 : parameters.layout) || ''];
462
+ if (!layoutClass) {
463
+ return /*#__PURE__*/React.createElement(Story, null);
464
+ }
465
+ return /*#__PURE__*/React.createElement("div", {
466
+ className: layoutClass
467
+ }, /*#__PURE__*/React.createElement(Story, null));
468
+ };
469
+ }
470
+
458
471
  function withNextDecoratorFactory(_ref) {
459
472
  var App = _ref.App,
460
473
  RootStoreProvider = _ref.RootStoreProvider;
@@ -493,6 +506,7 @@ function withUiDecorator(Story, _ref) {
493
506
 
494
507
  exports.withExtraProviders = withExtraProviders;
495
508
  exports.withFigmaSourceLink = withFigmaSourceLink;
496
- exports.withLayout = withLayout;
509
+ exports.withFormSubmitDecorator = withFormSubmitDecorator;
510
+ exports.withLayoutDecorator = withLayoutDecorator;
497
511
  exports.withNextDecoratorFactory = withNextDecoratorFactory;
498
512
  exports.withUiDecorator = withUiDecorator;
@@ -1,11 +1,11 @@
1
1
  import React from 'react';
2
2
  import castArray from 'lodash/castArray';
3
- import { NotificationsProvider } from '@itcase/ui/context/Notifications';
4
- import { UIProvider } from '@itcase/ui/context/UIContext';
5
3
  import { FormSubmitWrapper } from './components/FormSubmitWrapper.js';
6
4
  import 'lodash/camelCase';
7
5
  import '@itcase/common';
8
6
  import { http, HttpResponse } from 'msw';
7
+ import { NotificationsProvider } from '@itcase/ui/context/Notifications';
8
+ import { UIProvider } from '@itcase/ui/context/UIContext';
9
9
 
10
10
  function withExtraProviders(providers) {
11
11
  if (providers === void 0) {
@@ -53,26 +53,6 @@ function withFigmaSourceLink() {
53
53
  return decorator;
54
54
  }
55
55
 
56
- function withLayout() {
57
- return function (Story, _ref) {
58
- var parameters = _ref.parameters;
59
- var layouts = {
60
- top: 'sb-layout-top',
61
- right: 'sb-layout-right',
62
- bottom: 'sb-layout-bottom',
63
- left: 'sb-layout-left',
64
- center: 'sb-layout-center'
65
- };
66
- var layoutClass = layouts[(parameters == null ? void 0 : parameters.layout) || ''];
67
- if (!layoutClass) {
68
- return /*#__PURE__*/React.createElement(Story, null);
69
- }
70
- return /*#__PURE__*/React.createElement("div", {
71
- className: layoutClass
72
- }, /*#__PURE__*/React.createElement(Story, null));
73
- };
74
- }
75
-
76
56
  function asyncGeneratorStep(n, t, e, r, o, a, c) {
77
57
  try {
78
58
  var i = n[a](c),
@@ -453,6 +433,39 @@ function hasFormParameters(parameters) {
453
433
  return Boolean(parameters.require || parameters.validation || parameters.serverError || parameters.error500);
454
434
  }
455
435
 
436
+ function withFormSubmitDecorator() {
437
+ var decorator = function decorator(Story, _ref) {
438
+ _ref.args;
439
+ var parameters = _ref.parameters,
440
+ context = _ref.context;
441
+ var updatedContext = Object.assign({}, context, {
442
+ parameters: Object.assign({}, context.parameters)
443
+ });
444
+ return hasFormParameters(parameters) ? /*#__PURE__*/React.createElement(FormSubmitWrapper, updatedContext, /*#__PURE__*/React.createElement(Story, updatedContext)) : /*#__PURE__*/React.createElement(Story, updatedContext);
445
+ };
446
+ return decorator;
447
+ }
448
+
449
+ function withLayoutDecorator() {
450
+ return function (Story, _ref) {
451
+ var parameters = _ref.parameters;
452
+ var layouts = {
453
+ top: 'sb-layout-top',
454
+ right: 'sb-layout-right',
455
+ bottom: 'sb-layout-bottom',
456
+ left: 'sb-layout-left',
457
+ center: 'sb-layout-center'
458
+ };
459
+ var layoutClass = layouts[(parameters == null ? void 0 : parameters.layout) || ''];
460
+ if (!layoutClass) {
461
+ return /*#__PURE__*/React.createElement(Story, null);
462
+ }
463
+ return /*#__PURE__*/React.createElement("div", {
464
+ className: layoutClass
465
+ }, /*#__PURE__*/React.createElement(Story, null));
466
+ };
467
+ }
468
+
456
469
  function withNextDecoratorFactory(_ref) {
457
470
  var App = _ref.App,
458
471
  RootStoreProvider = _ref.RootStoreProvider;
@@ -489,4 +502,4 @@ function withUiDecorator(Story, _ref) {
489
502
  }, /*#__PURE__*/React.createElement(Story, null)));
490
503
  }
491
504
 
492
- export { withExtraProviders, withFigmaSourceLink, withLayout, withNextDecoratorFactory, withUiDecorator };
505
+ export { withExtraProviders, withFigmaSourceLink, withFormSubmitDecorator, withLayoutDecorator, withNextDecoratorFactory, withUiDecorator };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@itcase/storybook-config",
3
- "version": "1.1.64",
3
+ "version": "1.1.66",
4
4
  "author": "ITCase",
5
5
  "description": "Code style linter configuration presets",
6
6
  "engines": {