@salutejs/plasma-sb-utils 0.210.0-canary.2353.19638539568.0 → 0.211.0-canary.2354.19672366908.0
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/lib/components/Button/Button.d.ts +126 -0
- package/lib/components/Button/Button.js +55 -0
- package/lib/components/Button/Button.js.map +1 -0
- package/lib/components/Button/fixtures.d.ts +3 -0
- package/lib/components/Button/fixtures.js +13 -0
- package/lib/components/Button/fixtures.js.map +1 -0
- package/lib/components/Button/index.d.ts +1 -0
- package/lib/components/Button/index.js +2 -0
- package/lib/components/Button/index.js.map +1 -0
- package/lib/components/Button/meta.d.ts +91 -0
- package/lib/components/Button/meta.js +74 -0
- package/lib/components/Button/meta.js.map +1 -0
- package/lib/components/Button/stories.d.ts +2 -0
- package/lib/components/Button/stories.js +54 -0
- package/lib/components/Button/stories.js.map +1 -0
- package/lib/components/ReactStrictModeDecorator.js.map +1 -1
- package/lib/components/StoryDecorators.d.ts +1 -1
- package/lib/components/StoryDecorators.js.map +1 -1
- package/lib/components/index.d.ts +1 -0
- package/lib/components/index.js +1 -0
- package/lib/components/index.js.map +1 -1
- package/package.json +6 -4
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
declare type CreateStoriesProps = {
|
|
3
|
+
component: any;
|
|
4
|
+
componentConfig: any;
|
|
5
|
+
title?: string;
|
|
6
|
+
disablePropsList?: string[];
|
|
7
|
+
defaultArgs?: {};
|
|
8
|
+
additionalArgTypes?: {};
|
|
9
|
+
additionalComponents: {
|
|
10
|
+
Counter: any;
|
|
11
|
+
Icon?: any;
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
export declare const getButtonStories: (config: CreateStoriesProps) => {
|
|
15
|
+
meta: {
|
|
16
|
+
title: string;
|
|
17
|
+
decorators: any[];
|
|
18
|
+
component: any;
|
|
19
|
+
args: {
|
|
20
|
+
view: string;
|
|
21
|
+
size: string;
|
|
22
|
+
contentPlacing: string;
|
|
23
|
+
stretching: string;
|
|
24
|
+
text: string;
|
|
25
|
+
value: string;
|
|
26
|
+
disabled: boolean;
|
|
27
|
+
focused: boolean;
|
|
28
|
+
square: boolean;
|
|
29
|
+
isLoading: boolean;
|
|
30
|
+
enableContentLeft: boolean;
|
|
31
|
+
enableContentRight: boolean;
|
|
32
|
+
enableCounter: boolean;
|
|
33
|
+
};
|
|
34
|
+
argTypes: {
|
|
35
|
+
view: {
|
|
36
|
+
options: any;
|
|
37
|
+
control: {
|
|
38
|
+
type: string;
|
|
39
|
+
};
|
|
40
|
+
};
|
|
41
|
+
size: {
|
|
42
|
+
options: any;
|
|
43
|
+
control: {
|
|
44
|
+
type: string;
|
|
45
|
+
};
|
|
46
|
+
};
|
|
47
|
+
value: {
|
|
48
|
+
control: {
|
|
49
|
+
type: string;
|
|
50
|
+
};
|
|
51
|
+
};
|
|
52
|
+
text: {
|
|
53
|
+
control: {
|
|
54
|
+
type: string;
|
|
55
|
+
};
|
|
56
|
+
};
|
|
57
|
+
isLoading: {
|
|
58
|
+
control: {
|
|
59
|
+
type: string;
|
|
60
|
+
};
|
|
61
|
+
};
|
|
62
|
+
disabled: {
|
|
63
|
+
control: {
|
|
64
|
+
type: string;
|
|
65
|
+
};
|
|
66
|
+
};
|
|
67
|
+
contentPlacing: {
|
|
68
|
+
options: string[];
|
|
69
|
+
control: {
|
|
70
|
+
type: string;
|
|
71
|
+
};
|
|
72
|
+
};
|
|
73
|
+
stretching: {
|
|
74
|
+
options: string[];
|
|
75
|
+
control: {
|
|
76
|
+
type: string;
|
|
77
|
+
};
|
|
78
|
+
};
|
|
79
|
+
pin: {
|
|
80
|
+
options: string[];
|
|
81
|
+
control: {
|
|
82
|
+
type: string;
|
|
83
|
+
};
|
|
84
|
+
};
|
|
85
|
+
enableContentLeft: {
|
|
86
|
+
control: {
|
|
87
|
+
type: string;
|
|
88
|
+
};
|
|
89
|
+
};
|
|
90
|
+
enableContentRight: {
|
|
91
|
+
control: {
|
|
92
|
+
type: string;
|
|
93
|
+
};
|
|
94
|
+
};
|
|
95
|
+
};
|
|
96
|
+
};
|
|
97
|
+
Default: {
|
|
98
|
+
render: (args: any) => JSX.Element;
|
|
99
|
+
args: {
|
|
100
|
+
value: string;
|
|
101
|
+
};
|
|
102
|
+
argTypes: {
|
|
103
|
+
[x: string]: {
|
|
104
|
+
table: {
|
|
105
|
+
disable: true;
|
|
106
|
+
};
|
|
107
|
+
};
|
|
108
|
+
};
|
|
109
|
+
};
|
|
110
|
+
WithValue: {
|
|
111
|
+
render: (args: any) => JSX.Element;
|
|
112
|
+
args: {
|
|
113
|
+
enableContentLeft: boolean;
|
|
114
|
+
enableCounter: boolean;
|
|
115
|
+
value: string;
|
|
116
|
+
};
|
|
117
|
+
argTypes: {
|
|
118
|
+
[x: string]: {
|
|
119
|
+
table: {
|
|
120
|
+
disable: true;
|
|
121
|
+
};
|
|
122
|
+
};
|
|
123
|
+
};
|
|
124
|
+
};
|
|
125
|
+
};
|
|
126
|
+
export {};
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
13
|
+
var t = {};
|
|
14
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
15
|
+
t[p] = s[p];
|
|
16
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
17
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
18
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
19
|
+
t[p[i]] = s[p[i]];
|
|
20
|
+
}
|
|
21
|
+
return t;
|
|
22
|
+
};
|
|
23
|
+
import React from 'react';
|
|
24
|
+
import { disableProps, getConfigVariations } from '../../helpers';
|
|
25
|
+
import { createMeta } from './meta';
|
|
26
|
+
import { createDefaultStory } from './stories';
|
|
27
|
+
export var getButtonStories = function (config) {
|
|
28
|
+
var component = config.component, componentConfig = config.componentConfig, additionalComponents = config.additionalComponents, rest = __rest(config, ["component", "componentConfig", "additionalComponents"]);
|
|
29
|
+
var Counter = additionalComponents.Counter, Icon = additionalComponents.Icon;
|
|
30
|
+
var buttonConfig = getConfigVariations(componentConfig);
|
|
31
|
+
var meta = createMeta(__assign({ component: component, componentConfig: buttonConfig }, rest));
|
|
32
|
+
var DefaultStoryComponent = createDefaultStory(component, { Counter: Counter, Icon: Icon });
|
|
33
|
+
var Default = {
|
|
34
|
+
render: function (args) { return React.createElement(DefaultStoryComponent, __assign({}, args)); },
|
|
35
|
+
args: {
|
|
36
|
+
value: '',
|
|
37
|
+
},
|
|
38
|
+
argTypes: __assign({}, disableProps(['value'])),
|
|
39
|
+
};
|
|
40
|
+
var WithValue = {
|
|
41
|
+
render: function (args) { return React.createElement(DefaultStoryComponent, __assign({}, args)); },
|
|
42
|
+
args: {
|
|
43
|
+
enableContentLeft: false,
|
|
44
|
+
enableCounter: false,
|
|
45
|
+
value: 'Value',
|
|
46
|
+
},
|
|
47
|
+
argTypes: __assign({}, disableProps(['enableContentRight'])),
|
|
48
|
+
};
|
|
49
|
+
return {
|
|
50
|
+
meta: meta,
|
|
51
|
+
Default: Default,
|
|
52
|
+
WithValue: WithValue,
|
|
53
|
+
};
|
|
54
|
+
};
|
|
55
|
+
//# sourceMappingURL=Button.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Button.js","sourceRoot":"","sources":["../../../src/components/Button/Button.ts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AAO;SACjB;QACD,QAAQ,eACD,YAAY,CAAC,CAAC,oBAAoB,CAAC,CAAC,CAC1C;KACJ,CAAC;IAEF,OAAO;QACH,IAAI,MAAA;QACJ,OAAO,SAAA;QACP,SAAS,WAAA;KACZ,CAAC;AACN,CAAC,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export var stretchingValues = ['auto', 'filled', 'fixed'];
|
|
2
|
+
export var pinValues = [
|
|
3
|
+
'',
|
|
4
|
+
'square-square',
|
|
5
|
+
'square-clear',
|
|
6
|
+
'clear-square',
|
|
7
|
+
'clear-clear',
|
|
8
|
+
'clear-circle',
|
|
9
|
+
'circle-clear',
|
|
10
|
+
'circle-circle',
|
|
11
|
+
];
|
|
12
|
+
export var contentPlacingValues = ['default', 'relaxed'];
|
|
13
|
+
//# sourceMappingURL=fixtures.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fixtures.js","sourceRoot":"","sources":["../../../src/components/Button/fixtures.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,IAAM,gBAAgB,GAAG,CAAC,MAAM,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAC;AAE5D,MAAM,CAAC,IAAM,SAAS,GAAG;IACrB,EAAE;IACF,eAAe;IACf,cAAc;IACd,cAAc;IACd,aAAa;IACb,cAAc;IACd,cAAc;IACd,eAAe;CAClB,CAAC;AAEF,MAAM,CAAC,IAAM,oBAAoB,GAAG,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './Button';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/Button/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC"}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
declare type CreateMetaProps = {
|
|
2
|
+
component: any;
|
|
3
|
+
componentConfig: any;
|
|
4
|
+
title?: string;
|
|
5
|
+
defaultArgs?: {};
|
|
6
|
+
additionalArgTypes?: {};
|
|
7
|
+
disablePropsList?: string[];
|
|
8
|
+
};
|
|
9
|
+
export declare const createMeta: ({ component, componentConfig, title, defaultArgs, additionalArgTypes, disablePropsList, }: CreateMetaProps) => {
|
|
10
|
+
title: string;
|
|
11
|
+
decorators: any[];
|
|
12
|
+
component: any;
|
|
13
|
+
args: {
|
|
14
|
+
view: string;
|
|
15
|
+
size: string;
|
|
16
|
+
contentPlacing: string;
|
|
17
|
+
stretching: string;
|
|
18
|
+
text: string;
|
|
19
|
+
value: string;
|
|
20
|
+
disabled: boolean;
|
|
21
|
+
focused: boolean;
|
|
22
|
+
square: boolean;
|
|
23
|
+
isLoading: boolean;
|
|
24
|
+
enableContentLeft: boolean;
|
|
25
|
+
enableContentRight: boolean;
|
|
26
|
+
enableCounter: boolean;
|
|
27
|
+
};
|
|
28
|
+
argTypes: {
|
|
29
|
+
view: {
|
|
30
|
+
options: any;
|
|
31
|
+
control: {
|
|
32
|
+
type: string;
|
|
33
|
+
};
|
|
34
|
+
};
|
|
35
|
+
size: {
|
|
36
|
+
options: any;
|
|
37
|
+
control: {
|
|
38
|
+
type: string;
|
|
39
|
+
};
|
|
40
|
+
};
|
|
41
|
+
value: {
|
|
42
|
+
control: {
|
|
43
|
+
type: string;
|
|
44
|
+
};
|
|
45
|
+
};
|
|
46
|
+
text: {
|
|
47
|
+
control: {
|
|
48
|
+
type: string;
|
|
49
|
+
};
|
|
50
|
+
};
|
|
51
|
+
isLoading: {
|
|
52
|
+
control: {
|
|
53
|
+
type: string;
|
|
54
|
+
};
|
|
55
|
+
};
|
|
56
|
+
disabled: {
|
|
57
|
+
control: {
|
|
58
|
+
type: string;
|
|
59
|
+
};
|
|
60
|
+
};
|
|
61
|
+
contentPlacing: {
|
|
62
|
+
options: string[];
|
|
63
|
+
control: {
|
|
64
|
+
type: string;
|
|
65
|
+
};
|
|
66
|
+
};
|
|
67
|
+
stretching: {
|
|
68
|
+
options: string[];
|
|
69
|
+
control: {
|
|
70
|
+
type: string;
|
|
71
|
+
};
|
|
72
|
+
};
|
|
73
|
+
pin: {
|
|
74
|
+
options: string[];
|
|
75
|
+
control: {
|
|
76
|
+
type: string;
|
|
77
|
+
};
|
|
78
|
+
};
|
|
79
|
+
enableContentLeft: {
|
|
80
|
+
control: {
|
|
81
|
+
type: string;
|
|
82
|
+
};
|
|
83
|
+
};
|
|
84
|
+
enableContentRight: {
|
|
85
|
+
control: {
|
|
86
|
+
type: string;
|
|
87
|
+
};
|
|
88
|
+
};
|
|
89
|
+
};
|
|
90
|
+
};
|
|
91
|
+
export {};
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from) {
|
|
13
|
+
for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
|
|
14
|
+
to[j] = from[i];
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
import { disableProps, InSpacingDecorator } from '../../index';
|
|
18
|
+
import { stretchingValues, pinValues, contentPlacingValues } from './fixtures';
|
|
19
|
+
export var createMeta = function (_a) {
|
|
20
|
+
var component = _a.component, componentConfig = _a.componentConfig, _b = _a.title, title = _b === void 0 ? 'Data Entry/Button' : _b, _c = _a.defaultArgs, defaultArgs = _c === void 0 ? {} : _c, _d = _a.additionalArgTypes, additionalArgTypes = _d === void 0 ? {} : _d, _e = _a.disablePropsList, disablePropsList = _e === void 0 ? [] : _e;
|
|
21
|
+
return {
|
|
22
|
+
title: title,
|
|
23
|
+
decorators: [InSpacingDecorator],
|
|
24
|
+
component: component,
|
|
25
|
+
args: __assign({ view: 'default', size: 's', contentPlacing: 'default', stretching: 'auto', text: 'Button', value: '', disabled: false, focused: true, square: false, isLoading: false, enableContentLeft: false, enableContentRight: false, enableCounter: false }, defaultArgs),
|
|
26
|
+
argTypes: __assign(__assign({ view: {
|
|
27
|
+
options: componentConfig.views,
|
|
28
|
+
control: { type: 'select' },
|
|
29
|
+
}, size: {
|
|
30
|
+
options: componentConfig.sizes,
|
|
31
|
+
control: { type: 'select' },
|
|
32
|
+
}, value: {
|
|
33
|
+
control: { type: 'text' },
|
|
34
|
+
}, text: {
|
|
35
|
+
control: { type: 'text' },
|
|
36
|
+
}, isLoading: {
|
|
37
|
+
control: { type: 'boolean' },
|
|
38
|
+
}, disabled: {
|
|
39
|
+
control: { type: 'boolean' },
|
|
40
|
+
}, contentPlacing: {
|
|
41
|
+
options: contentPlacingValues,
|
|
42
|
+
control: { type: 'select' },
|
|
43
|
+
}, stretching: {
|
|
44
|
+
options: stretchingValues,
|
|
45
|
+
control: { type: 'select' },
|
|
46
|
+
}, pin: {
|
|
47
|
+
options: pinValues,
|
|
48
|
+
control: { type: 'select' },
|
|
49
|
+
}, enableContentLeft: {
|
|
50
|
+
control: { type: 'boolean' },
|
|
51
|
+
}, enableContentRight: {
|
|
52
|
+
control: { type: 'boolean' },
|
|
53
|
+
} }, additionalArgTypes), disableProps(__spreadArray([
|
|
54
|
+
'theme',
|
|
55
|
+
'loader',
|
|
56
|
+
'onClick',
|
|
57
|
+
'onFocus',
|
|
58
|
+
'onBlur',
|
|
59
|
+
'outlined',
|
|
60
|
+
'contentLeft',
|
|
61
|
+
'contentRight',
|
|
62
|
+
'shiftLeft',
|
|
63
|
+
'shiftRight',
|
|
64
|
+
'stretch',
|
|
65
|
+
'as',
|
|
66
|
+
'forwardedAs',
|
|
67
|
+
'pin',
|
|
68
|
+
'focused',
|
|
69
|
+
'blur',
|
|
70
|
+
'square'
|
|
71
|
+
], disablePropsList))),
|
|
72
|
+
};
|
|
73
|
+
};
|
|
74
|
+
//# sourceMappingURL=meta.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"meta.js","sourceRoot":"","sources":["../../../src/components/Button/meta.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,OAAO,EAAE,YAAY,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAE/D,OAAO,EAAE,gBAAgB,EAAE,SAAS,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAW/E,MAAM,CAAC,IAAM,UAAU,GAAG,UAAC,EAOT;QANd,SAAS,eAAA,EACT,eAAe,qBAAA,EACf,aAA2B,EAA3B,KAAK,mBAAG,mBAAmB,KAAA,EAC3B,mBAAgB,EAAhB,WAAW,mBAAG,EAAE,KAAA,EAChB,0BAAuB,EAAvB,kBAAkB,mBAAG,EAAE,KAAA,EACvB,wBAAqB,EAArB,gBAAgB,mBAAG,EAAE,KAAA;IAErB,OAAO;QACH,KAAK,OAAA;QACL,UAAU,EAAE,CAAC,kBAAkB,CAAC;QAChC,SAAS,WAAA;QACT,IAAI,aACA,IAAI,EAAE,SAAS,EACf,IAAI,EAAE,GAAG,EACT,cAAc,EAAE,SAAS,EACzB,UAAU,EAAE,MAAM,EAClB,IAAI,EAAE,QAAQ,EACd,KAAK,EAAE,EAAE,EACT,QAAQ,EAAE,KAAK,EACf,OAAO,EAAE,IAAI,EACb,MAAM,EAAE,KAAK,EACb,SAAS,EAAE,KAAK,EAChB,iBAAiB,EAAE,KAAK,EACxB,kBAAkB,EAAE,KAAK,EACzB,aAAa,EAAE,KAAK,IACjB,WAAW,CACjB;QACD,QAAQ,sBACJ,IAAI,EAAE;gBACF,OAAO,EAAE,eAAe,CAAC,KAAK;gBAC9B,OAAO,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;aAC9B,EACD,IAAI,EAAE;gBACF,OAAO,EAAE,eAAe,CAAC,KAAK;gBAC9B,OAAO,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;aAC9B,EACD,KAAK,EAAE;gBACH,OAAO,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE;aAC5B,EACD,IAAI,EAAE;gBACF,OAAO,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE;aAC5B,EACD,SAAS,EAAE;gBACP,OAAO,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE;aAC/B,EACD,QAAQ,EAAE;gBACN,OAAO,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE;aAC/B,EACD,cAAc,EAAE;gBACZ,OAAO,EAAE,oBAAoB;gBAC7B,OAAO,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;aAC9B,EACD,UAAU,EAAE;gBACR,OAAO,EAAE,gBAAgB;gBACzB,OAAO,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;aAC9B,EACD,GAAG,EAAE;gBACD,OAAO,EAAE,SAAS;gBAClB,OAAO,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;aAC9B,EACD,iBAAiB,EAAE;gBACf,OAAO,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE;aAC/B,EACD,kBAAkB,EAAE;gBAChB,OAAO,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE;aAC/B,IACE,kBAAkB,GAClB,YAAY;YACX,OAAO;YACP,QAAQ;YACR,SAAS;YACT,SAAS;YACT,QAAQ;YACR,UAAU;YACV,aAAa;YACb,cAAc;YACd,WAAW;YACX,YAAY;YACZ,SAAS;YACT,IAAI;YACJ,aAAa;YACb,KAAK;YACL,SAAS;YACT,MAAM;YACN,QAAQ;WACL,gBAAgB,EACrB,CACL;KACJ,CAAC;AACN,CAAC,CAAC"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
13
|
+
var t = {};
|
|
14
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
15
|
+
t[p] = s[p];
|
|
16
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
17
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
18
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
19
|
+
t[p[i]] = s[p[i]];
|
|
20
|
+
}
|
|
21
|
+
return t;
|
|
22
|
+
};
|
|
23
|
+
import React from 'react';
|
|
24
|
+
import { action } from '@storybook/addon-actions';
|
|
25
|
+
import { IconMic } from '@salutejs/plasma-icons';
|
|
26
|
+
var counterSizeMap = {
|
|
27
|
+
xxs: 'xxs',
|
|
28
|
+
xs: 'xxs',
|
|
29
|
+
s: 'xxs',
|
|
30
|
+
m: 'xs',
|
|
31
|
+
l: 's',
|
|
32
|
+
xl: 's',
|
|
33
|
+
};
|
|
34
|
+
var onClick = action('onClick');
|
|
35
|
+
var onFocus = action('onFocus');
|
|
36
|
+
var onBlur = action('onBlur');
|
|
37
|
+
var getIconSize = function (size) { return (size === 'xs' || size === 'xxs' ? 'xs' : 's'); };
|
|
38
|
+
var getCounterSize = function (size) { var _a; return (_a = counterSizeMap === null || counterSizeMap === void 0 ? void 0 : counterSizeMap[size]) !== null && _a !== void 0 ? _a : 's'; };
|
|
39
|
+
var shouldShowIcon = function (enabled, size) { return enabled && size !== 'xxs'; };
|
|
40
|
+
export var createDefaultStory = function (Button, Components) {
|
|
41
|
+
var Counter = Components.Counter, Icon = Components.Icon;
|
|
42
|
+
var getIcon = function (size) {
|
|
43
|
+
return Icon ? React.createElement(Icon, { size: size, color: "inherit" }) : React.createElement(IconMic, { size: getIconSize(size), color: "inherit" });
|
|
44
|
+
};
|
|
45
|
+
return function (_a) {
|
|
46
|
+
var enableContentLeft = _a.enableContentLeft, enableContentRight = _a.enableContentRight, enableCounter = _a.enableCounter, size = _a.size, rest = __rest(_a, ["enableContentLeft", "enableContentRight", "enableCounter", "size"]);
|
|
47
|
+
var computedContentSlot = function (predicate) { return (predicate ? getIcon(size) : undefined); };
|
|
48
|
+
var computedCounterSlot = function (predicate) {
|
|
49
|
+
return predicate ? React.createElement(Counter, { view: "accent", size: getCounterSize(size), count: 0 }) : undefined;
|
|
50
|
+
};
|
|
51
|
+
return (React.createElement(Button, __assign({ contentLeft: computedContentSlot(shouldShowIcon(enableContentLeft, size)), contentRight: computedContentSlot(shouldShowIcon(enableContentRight, size)), additionalContent: computedCounterSlot(enableCounter), size: size, onClick: onClick, onFocus: onFocus, onBlur: onBlur }, rest)));
|
|
52
|
+
};
|
|
53
|
+
};
|
|
54
|
+
//# sourceMappingURL=stories.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stories.js","sourceRoot":"","sources":["../../../src/components/Button/stories.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAC;AAClD,OAAO,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AAEjD,IAAM,cAAc,GAAQ;IACxB,GAAG,EAAE,KAAK;IACV,EAAE,EAAE,KAAK;IACT,CAAC,EAAE,KAAK;IACR,CAAC,EAAE,IAAI;IACP,CAAC,EAAE,GAAG;IACN,EAAE,EAAE,GAAG;CACV,CAAC;AAEF,IAAM,OAAO,GAAG,MAAM,CAAC,SAAS,CAAC,CAAC;AAClC,IAAM,OAAO,GAAG,MAAM,CAAC,SAAS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;YAC3C,OAAA,SAAS,CAAC,CAAC,CAAC,oBAAC,OAAO,IAAC,IAAI,EAAC,QAAQ,EAAC,IAAI,EAAE,cAAc,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,CAAC,GAAI,CAAC,CAAC,CAAC,SAAS;QAAvF,CAAuF,CAAC;QAE5F,OAAO,CACH,oBAAC,MAAM,aACH,WAAW,EAAE,mBAAmB,CAAC,cAAc,CAAC,iBAAiB,EAAE,IAAI,CAAC,CAAC,EACzE,YAAY,EAAE,mBAAmB,CAAC,cAAc,CAAC,kBAAkB,EAAE,IAAI,CAAC,CAAC,EAC3E,iBAAiB,EAAE,mBAAmB,CAAC,aAAa,CAAC,EACrD,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,OAAO,EAChB,OAAO,EAAE,OAAO,EAChB,MAAM,EAAE,MAAM,IACV,IAAI,EACV,CACL,CAAC;IACN,CAAC,CAAC;AACN,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ReactStrictModeDecorator.js","sourceRoot":"","sources":["../../src/components/ReactStrictModeDecorator.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,MAAM,CAAC,IAAM,4BAA4B,GAAG;IACxC,eAAe,EAAE;QACb,WAAW,EAAE,wCAAwC;QACrD,OAAO,EAAE;YACL,KAAK,EAAE,qBAAqB;YAC5B,KAAK,EAAE;gBACH,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,UAAU,EAAE;gBACnC,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,SAAS,EAAE;aACpC;SACJ;KACJ;CACJ,CAAC;AAEF,MAAM,CAAC,IAAM,mBAAmB,GAAc,UAAC,
|
|
1
|
+
{"version":3,"file":"ReactStrictModeDecorator.js","sourceRoot":"","sources":["../../src/components/ReactStrictModeDecorator.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,MAAM,CAAC,IAAM,4BAA4B,GAAG;IACxC,eAAe,EAAE;QACb,WAAW,EAAE,wCAAwC;QACrD,OAAO,EAAE;YACL,KAAK,EAAE,qBAAqB;YAC5B,KAAK,EAAE;gBACH,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,UAAU,EAAE;gBACnC,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,SAAS,EAAE;aACpC;SACJ;KACJ;CACJ,CAAC;AAEF,MAAM,CAAC,IAAM,mBAAmB,GAAc,UAAC,KAAc,EAAE,OAAqB;IAChF,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,eAAe,EAAE;QAClC,OAAO,oBAAC,KAAK,OAAG,CAAC;KACpB;IAED,OAAO,CACH,oBAAC,KAAK,CAAC,UAAU;QACb,oBAAC,KAAK,OAAG,CACM,CACtB,CAAC;AACN,CAAC,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { Decorator } from '@storybook/react';
|
|
1
|
+
import type { Decorator } from '@storybook/react';
|
|
2
2
|
export declare const InSpacing: Decorator;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StoryDecorators.js","sourceRoot":"","sources":["../../src/components/StoryDecorators.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,MAAM,CAAC,IAAM,SAAS,GAAc,UAAC,
|
|
1
|
+
{"version":3,"file":"StoryDecorators.js","sourceRoot":"","sources":["../../src/components/StoryDecorators.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,MAAM,CAAC,IAAM,SAAS,GAAc,UAAC,KAAc,IAAK,OAAA,CACpD,6BAAK,KAAK,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE;IAC3B,oBAAC,KAAK,OAAG,CACP,CACT,EAJuD,CAIvD,CAAC"}
|
|
@@ -4,3 +4,4 @@ export { PaletteGrid } from './PaletteGrid';
|
|
|
4
4
|
export { InSpacing as InSpacingDecorator } from './StoryDecorators';
|
|
5
5
|
export { ThemeColors } from './ThemeColors';
|
|
6
6
|
export { withReactStrictMode, reactStrictModePreviewOption } from './ReactStrictModeDecorator';
|
|
7
|
+
export * from './Button';
|
package/lib/components/index.js
CHANGED
|
@@ -4,4 +4,5 @@ export { PaletteGrid } from './PaletteGrid';
|
|
|
4
4
|
export { InSpacing as InSpacingDecorator } from './StoryDecorators';
|
|
5
5
|
export { ThemeColors } from './ThemeColors';
|
|
6
6
|
export { withReactStrictMode, reactStrictModePreviewOption } from './ReactStrictModeDecorator';
|
|
7
|
+
export * from './Button';
|
|
7
8
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,SAAS,IAAI,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AACpE,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,mBAAmB,EAAE,4BAA4B,EAAE,MAAM,4BAA4B,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,SAAS,IAAI,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AACpE,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,mBAAmB,EAAE,4BAA4B,EAAE,MAAM,4BAA4B,CAAC;AAC/F,cAAc,UAAU,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@salutejs/plasma-sb-utils",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.211.0-canary.2354.19672366908.0",
|
|
4
4
|
"description": "Code shared between ui libraries.",
|
|
5
5
|
"author": "Salute Frontend Team <salute.developers@gmail.com>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -20,7 +20,10 @@
|
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
22
|
"@salutejs/plasma-colors": "0.16.0",
|
|
23
|
-
"@salutejs/plasma-core": "1.
|
|
23
|
+
"@salutejs/plasma-core": "1.211.0-canary.2354.19672366908.0",
|
|
24
|
+
"@salutejs/plasma-icons": "1.228.0-canary.2354.19672366908.0",
|
|
25
|
+
"@storybook/addon-actions": "8.6.14",
|
|
26
|
+
"@storybook/react": "8.6.14",
|
|
24
27
|
"param-case": "^3.0.4"
|
|
25
28
|
},
|
|
26
29
|
"peerDependencies": {
|
|
@@ -29,7 +32,6 @@
|
|
|
29
32
|
"styled-components": "^5.1.1"
|
|
30
33
|
},
|
|
31
34
|
"devDependencies": {
|
|
32
|
-
"@storybook/react": "7.6.17",
|
|
33
35
|
"@types/react": "18.0.28",
|
|
34
36
|
"@types/react-dom": "18.0.11",
|
|
35
37
|
"@types/styled-components": "^5.1.0",
|
|
@@ -44,5 +46,5 @@
|
|
|
44
46
|
"files": [
|
|
45
47
|
"lib"
|
|
46
48
|
],
|
|
47
|
-
"gitHead": "
|
|
49
|
+
"gitHead": "58fc749560c8d6eceecd98e42c0f4482e2ee2e15"
|
|
48
50
|
}
|