@itcase/storybook-config 1.1.58 → 1.1.59

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,6 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  var React = require('react');
4
+ var castArray = require('lodash/castArray');
4
5
  var Notifications = require('@itcase/ui/context/Notifications');
5
6
  var UIContext = require('@itcase/ui/context/UIContext');
6
7
  var index = require('./components/FormSubmitWrapper.js');
@@ -25,6 +26,36 @@ function withExtraProviders(providers) {
25
26
  };
26
27
  }
27
28
 
29
+ function withFigmaSourceLink() {
30
+ var decorator = function decorator(Story, _ref) {
31
+ var parameters = _ref.parameters,
32
+ context = _ref.context;
33
+ var sourceLink = parameters.sourceLink || {};
34
+ if (parameters.design) {
35
+ var designList = castArray(parameters.design);
36
+ if (!sourceLink.links) {
37
+ sourceLink.links = {};
38
+ }
39
+ designList.forEach(function (design) {
40
+ sourceLink.links[design.type] = function () {
41
+ return {
42
+ label: 'Figma — ' + context.meta.title,
43
+ href: design.url,
44
+ icon: 'FigmaIcon'
45
+ };
46
+ };
47
+ });
48
+ }
49
+ var updatedContext = Object.assign({}, context, {
50
+ parameters: Object.assign({}, context.parameters, {
51
+ sourceLink: sourceLink
52
+ })
53
+ });
54
+ return /*#__PURE__*/React.createElement(Story, updatedContext);
55
+ };
56
+ return decorator;
57
+ }
58
+
28
59
  function asyncGeneratorStep(n, t, e, r, o, a, c) {
29
60
  try {
30
61
  var i = n[a](c),
@@ -442,5 +473,6 @@ function withUiDecorator(Story, _ref) {
442
473
  }
443
474
 
444
475
  exports.withExtraProviders = withExtraProviders;
476
+ exports.withFigmaSourceLink = withFigmaSourceLink;
445
477
  exports.withNextDecoratorFactory = withNextDecoratorFactory;
446
478
  exports.withUiDecorator = withUiDecorator;
@@ -1,4 +1,5 @@
1
1
  import React from 'react';
2
+ import castArray from 'lodash/castArray';
2
3
  import { NotificationsProvider } from '@itcase/ui/context/Notifications';
3
4
  import { UIProvider } from '@itcase/ui/context/UIContext';
4
5
  import { FormSubmitWrapper } from './components/FormSubmitWrapper.js';
@@ -23,6 +24,36 @@ function withExtraProviders(providers) {
23
24
  };
24
25
  }
25
26
 
27
+ function withFigmaSourceLink() {
28
+ var decorator = function decorator(Story, _ref) {
29
+ var parameters = _ref.parameters,
30
+ context = _ref.context;
31
+ var sourceLink = parameters.sourceLink || {};
32
+ if (parameters.design) {
33
+ var designList = castArray(parameters.design);
34
+ if (!sourceLink.links) {
35
+ sourceLink.links = {};
36
+ }
37
+ designList.forEach(function (design) {
38
+ sourceLink.links[design.type] = function () {
39
+ return {
40
+ label: 'Figma — ' + context.meta.title,
41
+ href: design.url,
42
+ icon: 'FigmaIcon'
43
+ };
44
+ };
45
+ });
46
+ }
47
+ var updatedContext = Object.assign({}, context, {
48
+ parameters: Object.assign({}, context.parameters, {
49
+ sourceLink: sourceLink
50
+ })
51
+ });
52
+ return /*#__PURE__*/React.createElement(Story, updatedContext);
53
+ };
54
+ return decorator;
55
+ }
56
+
26
57
  function asyncGeneratorStep(n, t, e, r, o, a, c) {
27
58
  try {
28
59
  var i = n[a](c),
@@ -439,4 +470,4 @@ function withUiDecorator(Story, _ref) {
439
470
  }, /*#__PURE__*/React.createElement(Story, null)));
440
471
  }
441
472
 
442
- export { withExtraProviders, withNextDecoratorFactory, withUiDecorator };
473
+ export { withExtraProviders, withFigmaSourceLink, withNextDecoratorFactory, withUiDecorator };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@itcase/storybook-config",
3
- "version": "1.1.58",
3
+ "version": "1.1.59",
4
4
  "author": "ITCase",
5
5
  "description": "Code style linter configuration presets",
6
6
  "engines": {