@itcase/storybook-config 1.1.58 → 1.1.60
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/cjs/decorators.js +31 -0
- package/dist/decorators.js +31 -1
- package/package.json +1 -1
package/dist/cjs/decorators.js
CHANGED
|
@@ -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,35 @@ 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
|
+
var groupKey = "" + design.type + (design.name || '');
|
|
41
|
+
sourceLink.links[groupKey] = {
|
|
42
|
+
label: 'Figma — ' + (design.name || context.title),
|
|
43
|
+
href: design.url,
|
|
44
|
+
icon: 'FigmaIcon'
|
|
45
|
+
};
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
var updatedContext = Object.assign({}, context, {
|
|
49
|
+
parameters: Object.assign({}, context.parameters, {
|
|
50
|
+
sourceLink: sourceLink
|
|
51
|
+
})
|
|
52
|
+
});
|
|
53
|
+
return /*#__PURE__*/React.createElement(Story, updatedContext);
|
|
54
|
+
};
|
|
55
|
+
return decorator;
|
|
56
|
+
}
|
|
57
|
+
|
|
28
58
|
function asyncGeneratorStep(n, t, e, r, o, a, c) {
|
|
29
59
|
try {
|
|
30
60
|
var i = n[a](c),
|
|
@@ -442,5 +472,6 @@ function withUiDecorator(Story, _ref) {
|
|
|
442
472
|
}
|
|
443
473
|
|
|
444
474
|
exports.withExtraProviders = withExtraProviders;
|
|
475
|
+
exports.withFigmaSourceLink = withFigmaSourceLink;
|
|
445
476
|
exports.withNextDecoratorFactory = withNextDecoratorFactory;
|
|
446
477
|
exports.withUiDecorator = withUiDecorator;
|
package/dist/decorators.js
CHANGED
|
@@ -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,35 @@ 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
|
+
var groupKey = "" + design.type + (design.name || '');
|
|
39
|
+
sourceLink.links[groupKey] = {
|
|
40
|
+
label: 'Figma — ' + (design.name || context.title),
|
|
41
|
+
href: design.url,
|
|
42
|
+
icon: 'FigmaIcon'
|
|
43
|
+
};
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
var updatedContext = Object.assign({}, context, {
|
|
47
|
+
parameters: Object.assign({}, context.parameters, {
|
|
48
|
+
sourceLink: sourceLink
|
|
49
|
+
})
|
|
50
|
+
});
|
|
51
|
+
return /*#__PURE__*/React.createElement(Story, updatedContext);
|
|
52
|
+
};
|
|
53
|
+
return decorator;
|
|
54
|
+
}
|
|
55
|
+
|
|
26
56
|
function asyncGeneratorStep(n, t, e, r, o, a, c) {
|
|
27
57
|
try {
|
|
28
58
|
var i = n[a](c),
|
|
@@ -439,4 +469,4 @@ function withUiDecorator(Story, _ref) {
|
|
|
439
469
|
}, /*#__PURE__*/React.createElement(Story, null)));
|
|
440
470
|
}
|
|
441
471
|
|
|
442
|
-
export { withExtraProviders, withNextDecoratorFactory, withUiDecorator };
|
|
472
|
+
export { withExtraProviders, withFigmaSourceLink, withNextDecoratorFactory, withUiDecorator };
|