@itcase/storybook-config 1.0.18 → 1.0.20
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/itcase-storybook-config/components/EmailTemplatePreview.js +42 -0
- package/dist/cjs/itcase-storybook-config/components/FormSubmitWrapper.js +17 -0
- package/dist/config/addonsNextJs.js +10 -0
- package/dist/config/addonsReact.js +31 -0
- package/dist/config/addonsReactVite.js +9 -0
- package/dist/config/appearance.js +1 -0
- package/dist/config/authorization.js +9 -0
- package/dist/config/backgrounds.js +16 -0
- package/dist/config/frameworkNextJs.js +5 -0
- package/dist/config/frameworkReact.js +21 -0
- package/dist/config/frameworkReactVite.js +5 -0
- package/dist/config/index.js +39 -0
- package/dist/config/mainConfig.js +29 -0
- package/dist/config/mainConfigVite.js +11 -0
- package/dist/config/preview.css +68 -0
- package/dist/config/refs.js +14 -0
- package/dist/config/sourceLink.js +25 -0
- package/dist/config/staticDirsNextJs.js +6 -0
- package/dist/config/staticDirsReact.js +2 -0
- package/dist/config/staticDirsReactVite.js +2 -0
- package/dist/config/storySort.js +191 -0
- package/dist/config/users.js +10 -0
- package/dist/config/viewports.js +22 -0
- package/dist/itcase-storybook-config/components/EmailTemplatePreview.js +40 -0
- package/dist/itcase-storybook-config/components/FormSubmitWrapper.js +15 -0
- package/package.json +35 -14
- package/components/EmailTemplatePreview/index.js +0 -50
- package/components/FormSubmitWrapper/index.js +0 -17
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var React = require('react');
|
|
4
|
+
|
|
5
|
+
var BACKEND_URL = process.env.EMAIL_URL;
|
|
6
|
+
if (process.env.NODE_ENV === 'production') {
|
|
7
|
+
BACKEND_URL = process.env.REST_BASE_URL + "/storybook";
|
|
8
|
+
}
|
|
9
|
+
function EmailTemplatePreview(props) {
|
|
10
|
+
var style = {
|
|
11
|
+
width: '100%',
|
|
12
|
+
height: '100%',
|
|
13
|
+
position: 'absolute',
|
|
14
|
+
top: '0',
|
|
15
|
+
right: '0',
|
|
16
|
+
bottom: '0',
|
|
17
|
+
left: '0',
|
|
18
|
+
overflow: 'hidden',
|
|
19
|
+
border: '0',
|
|
20
|
+
overflowX: 'hidden',
|
|
21
|
+
overflowY: 'hidden'
|
|
22
|
+
};
|
|
23
|
+
React.useEffect(function () {
|
|
24
|
+
var emailPreviewIframe = document.getElementById('emailPreview');
|
|
25
|
+
var loaded = function loaded() {
|
|
26
|
+
var email = emailPreviewIframe.getElementsByClassName('email-body').length;
|
|
27
|
+
if (!email) {
|
|
28
|
+
alert('Need to run the backend server to display email templates, use: python manage.py runserver');
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
emailPreviewIframe.addEventListener('load', loaded, true);
|
|
32
|
+
});
|
|
33
|
+
return /*#__PURE__*/React.createElement("iframe", {
|
|
34
|
+
width: "100%",
|
|
35
|
+
height: "100%",
|
|
36
|
+
id: "emailPreview",
|
|
37
|
+
src: "" + BACKEND_URL + props.url,
|
|
38
|
+
style: style
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
exports.EmailTemplatePreview = EmailTemplatePreview;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var React = require('react');
|
|
4
|
+
|
|
5
|
+
function FormSubmitWrapper(props) {
|
|
6
|
+
var formRef = React.useRef();
|
|
7
|
+
React.useEffect(function () {
|
|
8
|
+
if (formRef != null && formRef.current) {
|
|
9
|
+
formRef.current.submit();
|
|
10
|
+
}
|
|
11
|
+
}, [formRef]);
|
|
12
|
+
return /*#__PURE__*/React.cloneElement(props.children, {
|
|
13
|
+
ref: formRef
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
exports.FormSubmitWrapper = FormSubmitWrapper;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
const ADDONS_REACT = [
|
|
2
|
+
'@storybook/addon-webpack5-compiler-swc',
|
|
3
|
+
'@storybook/addon-essentials',
|
|
4
|
+
'@storybook/addon-themes',
|
|
5
|
+
'@storybook/addon-interactions',
|
|
6
|
+
'@storybook/addon-designs',
|
|
7
|
+
'storybook-addon-source-link',
|
|
8
|
+
{
|
|
9
|
+
name: '@storybook/addon-styling-webpack',
|
|
10
|
+
options: {
|
|
11
|
+
rules: [
|
|
12
|
+
{
|
|
13
|
+
test: /\.css$/,
|
|
14
|
+
use: [
|
|
15
|
+
'style-loader',
|
|
16
|
+
{
|
|
17
|
+
loader: 'css-loader',
|
|
18
|
+
options: { importLoaders: 1 },
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
loader: 'postcss-loader',
|
|
22
|
+
options: { implementation: require.resolve('postcss') },
|
|
23
|
+
},
|
|
24
|
+
],
|
|
25
|
+
},
|
|
26
|
+
],
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
]
|
|
30
|
+
|
|
31
|
+
export { ADDONS_REACT }
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import '../../../../src/config/appearance'
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
const FRAMEWORK_REACT = {
|
|
2
|
+
framework: {
|
|
3
|
+
name: '@storybook/react-webpack5',
|
|
4
|
+
options: {
|
|
5
|
+
builder: {
|
|
6
|
+
useSWC: true,
|
|
7
|
+
},
|
|
8
|
+
},
|
|
9
|
+
},
|
|
10
|
+
swc: () => ({
|
|
11
|
+
jsc: {
|
|
12
|
+
transform: {
|
|
13
|
+
react: {
|
|
14
|
+
runtime: 'automatic',
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
}),
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export { FRAMEWORK_REACT }
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { ADDONS_NEXTJS } from './addonsNextJs'
|
|
2
|
+
import { ADDONS_REACT } from './addonsReact'
|
|
3
|
+
import { ADDONS_REACT_VITE } from './addonsReactVite'
|
|
4
|
+
import { AUTHORIZATION } from './authorization'
|
|
5
|
+
import { BACKGROUNDS } from './backgrounds'
|
|
6
|
+
import { FRAMEWORK_NEXTJS } from './frameworkNextJs'
|
|
7
|
+
import { FRAMEWORK_REACT } from './frameworkReact'
|
|
8
|
+
import { FRAMEWORK_REACT_VITE } from './frameworkReactVite'
|
|
9
|
+
import { MAIN_CONFIG } from './mainConfig'
|
|
10
|
+
import { MAIN_CONFIG_VITE } from './mainConfigVite'
|
|
11
|
+
import { REFS } from './refs'
|
|
12
|
+
import { SOURCELINK } from './sourceLink'
|
|
13
|
+
import { STATIC_DIRS_NEXTJS } from './staticDirsNextJs'
|
|
14
|
+
import { STATIC_DIRS_REACT } from './staticDirsReact'
|
|
15
|
+
import { STATIC_DIRS_REACT_VITE } from './staticDirsReactVite'
|
|
16
|
+
import { STORYSORT, STORYSORT_DOCUMENTATION, STORYSORT_ICONS } from './storySort'
|
|
17
|
+
import { VIEWPORTS } from './viewports'
|
|
18
|
+
|
|
19
|
+
export {
|
|
20
|
+
AUTHORIZATION,
|
|
21
|
+
ADDONS_NEXTJS,
|
|
22
|
+
STATIC_DIRS_REACT,
|
|
23
|
+
STATIC_DIRS_NEXTJS,
|
|
24
|
+
STATIC_DIRS_REACT_VITE,
|
|
25
|
+
FRAMEWORK_NEXTJS,
|
|
26
|
+
FRAMEWORK_REACT,
|
|
27
|
+
FRAMEWORK_REACT_VITE,
|
|
28
|
+
ADDONS_REACT,
|
|
29
|
+
SOURCELINK,
|
|
30
|
+
ADDONS_REACT_VITE,
|
|
31
|
+
BACKGROUNDS,
|
|
32
|
+
MAIN_CONFIG,
|
|
33
|
+
MAIN_CONFIG_VITE,
|
|
34
|
+
REFS,
|
|
35
|
+
VIEWPORTS,
|
|
36
|
+
STORYSORT,
|
|
37
|
+
STORYSORT_ICONS,
|
|
38
|
+
STORYSORT_DOCUMENTATION,
|
|
39
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
const MAIN_CONFIG = {
|
|
2
|
+
core: {
|
|
3
|
+
disableTelemetry: true,
|
|
4
|
+
disableWhatsNewNotifications: true,
|
|
5
|
+
},
|
|
6
|
+
features: {
|
|
7
|
+
backgroundsStoryGlobals: true,
|
|
8
|
+
viewportStoryGlobals: true,
|
|
9
|
+
},
|
|
10
|
+
webpackFinal: async (config) => {
|
|
11
|
+
const imageRule = config.module?.rules?.find((rule) => {
|
|
12
|
+
const test = rule.test
|
|
13
|
+
if (!test) {
|
|
14
|
+
return false
|
|
15
|
+
}
|
|
16
|
+
return test.test('.svg')
|
|
17
|
+
})
|
|
18
|
+
|
|
19
|
+
imageRule.exclude = /\.svg$/
|
|
20
|
+
|
|
21
|
+
config.module?.rules?.push({
|
|
22
|
+
test: /\.svg$/,
|
|
23
|
+
use: ['@svgr/webpack'],
|
|
24
|
+
})
|
|
25
|
+
return config
|
|
26
|
+
},
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export { MAIN_CONFIG }
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
.sb-main-centered {
|
|
2
|
+
& #storybook-root {
|
|
3
|
+
min-height: 100%;
|
|
4
|
+
align-items: center;
|
|
5
|
+
}
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
.sb-main-fullscreen {
|
|
9
|
+
height: auto;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
#storybook-root {
|
|
13
|
+
width: 100%;
|
|
14
|
+
min-height: 100%;
|
|
15
|
+
display: flex;
|
|
16
|
+
justify-content: center;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.docs-story {
|
|
20
|
+
padding: 40px;
|
|
21
|
+
display: flex;
|
|
22
|
+
justify-content: center;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.icon-gallery {
|
|
26
|
+
&__block {
|
|
27
|
+
display: flex;
|
|
28
|
+
flex-direction: column;
|
|
29
|
+
gap: 20px;
|
|
30
|
+
&-title {
|
|
31
|
+
font-size: 20px;
|
|
32
|
+
font-weight: bold;
|
|
33
|
+
text-transform: capitalize;
|
|
34
|
+
}
|
|
35
|
+
&-group {
|
|
36
|
+
display: flex;
|
|
37
|
+
flex-flow: wrap;
|
|
38
|
+
&-link {
|
|
39
|
+
min-width: 120px;
|
|
40
|
+
margin: 0 10px 30px 0;
|
|
41
|
+
position: relative;
|
|
42
|
+
display: inline-flex;
|
|
43
|
+
flex: 0 1 calc(20% - 10px);
|
|
44
|
+
flex-direction: row;
|
|
45
|
+
align-items: center;
|
|
46
|
+
cursor: pointer;
|
|
47
|
+
&:hover {
|
|
48
|
+
^^&-hint {
|
|
49
|
+
visibility: visible;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
&-hint {
|
|
54
|
+
white-space: nowrap;
|
|
55
|
+
background: #fff;
|
|
56
|
+
padding: 4px 8px;
|
|
57
|
+
border-radius: 8px;
|
|
58
|
+
position: absolute;
|
|
59
|
+
visibility: hidden;
|
|
60
|
+
box-shadow: 0 4px 12px 0 rgba(0, 0, 0, 0.2);
|
|
61
|
+
left: 50%;
|
|
62
|
+
top: 80%;
|
|
63
|
+
z-index: 2;
|
|
64
|
+
transform: translate(-50%, 0%);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { getFileUrl } from 'storybook-addon-source-link'
|
|
2
|
+
|
|
3
|
+
const SOURCELINK = {
|
|
4
|
+
links: {
|
|
5
|
+
before: { label: '', href: '', order: 0, icon: '' },
|
|
6
|
+
'component-vscode': ({ importPath, rootPath }) => {
|
|
7
|
+
if (!rootPath) return undefined
|
|
8
|
+
const componentPath = importPath.replace(/\.stories\.(js|tsx)?$/, '.js')
|
|
9
|
+
const labelPath = 'Source — ' + importPath.replace(/\.stories\.(js|tsx)?$/, '')
|
|
10
|
+
const componentFileUrl = getFileUrl(rootPath, componentPath)
|
|
11
|
+
const href = `vscode://${componentFileUrl.href}`
|
|
12
|
+
return { label: labelPath, href, icon: 'VSCodeIcon' }
|
|
13
|
+
},
|
|
14
|
+
'story-vscode': ({ importPath, rootPath }) => {
|
|
15
|
+
if (!rootPath) return undefined
|
|
16
|
+
const fileUrl = getFileUrl(rootPath, importPath)
|
|
17
|
+
const labelPath = 'Story — ' + importPath.replace(/\.(js|tsx)?$/, '')
|
|
18
|
+
const href = `vscode://${fileUrl.href}`
|
|
19
|
+
return { label: labelPath, href, icon: 'StorybookIcon' }
|
|
20
|
+
},
|
|
21
|
+
'addon-powered-by': { label: '', href: '', order: 1000, icon: '' },
|
|
22
|
+
},
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export { SOURCELINK }
|
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
const defaultDocSort = [
|
|
2
|
+
'Introduction',
|
|
3
|
+
'Overview',
|
|
4
|
+
'Designer',
|
|
5
|
+
'Developer',
|
|
6
|
+
'Properties',
|
|
7
|
+
'Accessibility',
|
|
8
|
+
]
|
|
9
|
+
|
|
10
|
+
const defaultSortFirst = [
|
|
11
|
+
'Regular',
|
|
12
|
+
'All or Nothing',
|
|
13
|
+
'Mix',
|
|
14
|
+
'Tile',
|
|
15
|
+
'List',
|
|
16
|
+
'Item',
|
|
17
|
+
'Detail',
|
|
18
|
+
'Desktop',
|
|
19
|
+
'Mobile',
|
|
20
|
+
'Before',
|
|
21
|
+
'Header',
|
|
22
|
+
'Content',
|
|
23
|
+
'Item',
|
|
24
|
+
'Image',
|
|
25
|
+
'Data',
|
|
26
|
+
]
|
|
27
|
+
|
|
28
|
+
const defaultStateSort = ['Data', 'Verify', 'Error', 'Success']
|
|
29
|
+
|
|
30
|
+
const defaultFormSort = [
|
|
31
|
+
'Default',
|
|
32
|
+
'Require',
|
|
33
|
+
'Required',
|
|
34
|
+
'Validation',
|
|
35
|
+
'Server Error',
|
|
36
|
+
'Filled',
|
|
37
|
+
'Error 400',
|
|
38
|
+
'Error 500',
|
|
39
|
+
'Loading',
|
|
40
|
+
'Response',
|
|
41
|
+
'Success',
|
|
42
|
+
]
|
|
43
|
+
|
|
44
|
+
const defaultSortLast = ['Footer', 'After']
|
|
45
|
+
|
|
46
|
+
const STORYSORT = {
|
|
47
|
+
storySort: {
|
|
48
|
+
includeNames: true,
|
|
49
|
+
order: [
|
|
50
|
+
'*',
|
|
51
|
+
'Components',
|
|
52
|
+
[
|
|
53
|
+
...defaultDocSort,
|
|
54
|
+
...defaultSortFirst,
|
|
55
|
+
'*',
|
|
56
|
+
...defaultSortLast,
|
|
57
|
+
[
|
|
58
|
+
...defaultDocSort,
|
|
59
|
+
...defaultSortFirst,
|
|
60
|
+
'*',
|
|
61
|
+
...defaultSortLast,
|
|
62
|
+
[
|
|
63
|
+
...defaultDocSort,
|
|
64
|
+
...defaultSortFirst,
|
|
65
|
+
'*',
|
|
66
|
+
...defaultSortLast,
|
|
67
|
+
[
|
|
68
|
+
...defaultDocSort,
|
|
69
|
+
...defaultSortFirst,
|
|
70
|
+
'*',
|
|
71
|
+
...defaultSortLast,
|
|
72
|
+
[
|
|
73
|
+
...defaultDocSort,
|
|
74
|
+
...defaultSortFirst,
|
|
75
|
+
'*',
|
|
76
|
+
...defaultSortLast,
|
|
77
|
+
[...defaultDocSort, ...defaultSortFirst, '*', ...defaultSortLast],
|
|
78
|
+
[
|
|
79
|
+
'First',
|
|
80
|
+
'First Bet',
|
|
81
|
+
'Bet',
|
|
82
|
+
'New Offer',
|
|
83
|
+
'Wait',
|
|
84
|
+
'Finished',
|
|
85
|
+
'Stopped',
|
|
86
|
+
'Canceled',
|
|
87
|
+
'Need Confirm',
|
|
88
|
+
'Confirmed',
|
|
89
|
+
'Refused',
|
|
90
|
+
'*',
|
|
91
|
+
],
|
|
92
|
+
'*',
|
|
93
|
+
...defaultSortLast,
|
|
94
|
+
],
|
|
95
|
+
],
|
|
96
|
+
],
|
|
97
|
+
],
|
|
98
|
+
],
|
|
99
|
+
'Page Blocks',
|
|
100
|
+
[
|
|
101
|
+
...defaultDocSort,
|
|
102
|
+
...defaultSortFirst,
|
|
103
|
+
...defaultStateSort,
|
|
104
|
+
'*',
|
|
105
|
+
...defaultSortLast,
|
|
106
|
+
[
|
|
107
|
+
...defaultDocSort,
|
|
108
|
+
...defaultSortFirst,
|
|
109
|
+
...defaultStateSort,
|
|
110
|
+
'*',
|
|
111
|
+
...defaultSortLast,
|
|
112
|
+
[
|
|
113
|
+
...defaultDocSort,
|
|
114
|
+
...defaultSortFirst,
|
|
115
|
+
...defaultStateSort,
|
|
116
|
+
'*',
|
|
117
|
+
...defaultSortLast,
|
|
118
|
+
[...defaultDocSort, ...defaultSortFirst, ...defaultStateSort, '*', ...defaultSortLast],
|
|
119
|
+
],
|
|
120
|
+
],
|
|
121
|
+
],
|
|
122
|
+
'Page Components',
|
|
123
|
+
[
|
|
124
|
+
...defaultDocSort,
|
|
125
|
+
...defaultSortFirst,
|
|
126
|
+
...defaultStateSort,
|
|
127
|
+
'*',
|
|
128
|
+
...defaultSortLast,
|
|
129
|
+
[
|
|
130
|
+
...defaultDocSort,
|
|
131
|
+
...defaultSortFirst,
|
|
132
|
+
...defaultStateSort,
|
|
133
|
+
'*',
|
|
134
|
+
...defaultSortLast,
|
|
135
|
+
[
|
|
136
|
+
...defaultDocSort,
|
|
137
|
+
...defaultSortFirst,
|
|
138
|
+
...defaultStateSort,
|
|
139
|
+
'*',
|
|
140
|
+
...defaultSortLast,
|
|
141
|
+
[...defaultDocSort, ...defaultSortFirst, ...defaultStateSort, '*', ...defaultSortLast],
|
|
142
|
+
],
|
|
143
|
+
],
|
|
144
|
+
],
|
|
145
|
+
'Pages',
|
|
146
|
+
[...defaultDocSort, '*'],
|
|
147
|
+
'Forms',
|
|
148
|
+
[...defaultDocSort, ...defaultFormSort, '*'],
|
|
149
|
+
'Email',
|
|
150
|
+
[...defaultDocSort, '*'],
|
|
151
|
+
],
|
|
152
|
+
},
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
const STORYSORT_DOCUMENTATION = {
|
|
156
|
+
storySort: {
|
|
157
|
+
includeNames: true,
|
|
158
|
+
order: [
|
|
159
|
+
'*',
|
|
160
|
+
[
|
|
161
|
+
'Introduction',
|
|
162
|
+
'Frontend',
|
|
163
|
+
[
|
|
164
|
+
'Overview',
|
|
165
|
+
'Structure',
|
|
166
|
+
'Packages',
|
|
167
|
+
'Pages',
|
|
168
|
+
'PageBlocks',
|
|
169
|
+
'PageComponents',
|
|
170
|
+
'Forms',
|
|
171
|
+
'Icons',
|
|
172
|
+
],
|
|
173
|
+
'Backend',
|
|
174
|
+
'Design',
|
|
175
|
+
'Email',
|
|
176
|
+
'Storybook',
|
|
177
|
+
'*',
|
|
178
|
+
'FAQ',
|
|
179
|
+
],
|
|
180
|
+
],
|
|
181
|
+
},
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
const STORYSORT_ICONS = {
|
|
185
|
+
storySort: {
|
|
186
|
+
includeNames: true,
|
|
187
|
+
order: ['Overview', 'Usage', 'Default Icons', '*'],
|
|
188
|
+
},
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
export { STORYSORT, STORYSORT_DOCUMENTATION, STORYSORT_ICONS }
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { DEFAULT_USERS } from '@itcase/storybook-addon-auth/defaults'
|
|
2
|
+
|
|
3
|
+
const USERS = {
|
|
4
|
+
user: { name: 'User', token: process.env.USER_AUTH_TOKEN, color: '#777777' },
|
|
5
|
+
manager: { name: 'Manager', token: process.env.MANAGER_AUTH_TOKEN, color: '#D80E4F' },
|
|
6
|
+
admin: { name: 'Admin', token: process.env.ADMIN_AUTH_TOKEN, color: '#1EA5FC' },
|
|
7
|
+
...DEFAULT_USERS,
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export { USERS }
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { INITIAL_VIEWPORTS, MINIMAL_VIEWPORTS } from '@storybook/addon-viewport'
|
|
2
|
+
|
|
3
|
+
const VIEWPORTS = {
|
|
4
|
+
desktop: {
|
|
5
|
+
name: 'Desktop',
|
|
6
|
+
styles: {
|
|
7
|
+
width: '1440px',
|
|
8
|
+
height: '100%',
|
|
9
|
+
},
|
|
10
|
+
},
|
|
11
|
+
mobile: {
|
|
12
|
+
name: 'Mobile',
|
|
13
|
+
styles: {
|
|
14
|
+
width: '375px',
|
|
15
|
+
height: '667px',
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
...INITIAL_VIEWPORTS,
|
|
19
|
+
...MINIMAL_VIEWPORTS,
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export { VIEWPORTS }
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import React, { useEffect } from 'react';
|
|
2
|
+
|
|
3
|
+
var BACKEND_URL = process.env.EMAIL_URL;
|
|
4
|
+
if (process.env.NODE_ENV === 'production') {
|
|
5
|
+
BACKEND_URL = process.env.REST_BASE_URL + "/storybook";
|
|
6
|
+
}
|
|
7
|
+
function EmailTemplatePreview(props) {
|
|
8
|
+
var style = {
|
|
9
|
+
width: '100%',
|
|
10
|
+
height: '100%',
|
|
11
|
+
position: 'absolute',
|
|
12
|
+
top: '0',
|
|
13
|
+
right: '0',
|
|
14
|
+
bottom: '0',
|
|
15
|
+
left: '0',
|
|
16
|
+
overflow: 'hidden',
|
|
17
|
+
border: '0',
|
|
18
|
+
overflowX: 'hidden',
|
|
19
|
+
overflowY: 'hidden'
|
|
20
|
+
};
|
|
21
|
+
useEffect(function () {
|
|
22
|
+
var emailPreviewIframe = document.getElementById('emailPreview');
|
|
23
|
+
var loaded = function loaded() {
|
|
24
|
+
var email = emailPreviewIframe.getElementsByClassName('email-body').length;
|
|
25
|
+
if (!email) {
|
|
26
|
+
alert('Need to run the backend server to display email templates, use: python manage.py runserver');
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
emailPreviewIframe.addEventListener('load', loaded, true);
|
|
30
|
+
});
|
|
31
|
+
return /*#__PURE__*/React.createElement("iframe", {
|
|
32
|
+
width: "100%",
|
|
33
|
+
height: "100%",
|
|
34
|
+
id: "emailPreview",
|
|
35
|
+
src: "" + BACKEND_URL + props.url,
|
|
36
|
+
style: style
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export { EmailTemplatePreview };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import React, { useRef, useEffect } from 'react';
|
|
2
|
+
|
|
3
|
+
function FormSubmitWrapper(props) {
|
|
4
|
+
var formRef = useRef();
|
|
5
|
+
useEffect(function () {
|
|
6
|
+
if (formRef != null && formRef.current) {
|
|
7
|
+
formRef.current.submit();
|
|
8
|
+
}
|
|
9
|
+
}, [formRef]);
|
|
10
|
+
return /*#__PURE__*/React.cloneElement(props.children, {
|
|
11
|
+
ref: formRef
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export { FormSubmitWrapper };
|
package/package.json
CHANGED
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@itcase/storybook-config",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.20",
|
|
4
4
|
"author": "ITCase",
|
|
5
5
|
"description": "Code style linter configuration presets",
|
|
6
6
|
"engines": {
|
|
7
7
|
"node": ">=20.12.0"
|
|
8
8
|
},
|
|
9
9
|
"scripts": {
|
|
10
|
-
"
|
|
10
|
+
"build": "npm run build-js",
|
|
11
|
+
"build-js": "rm -rf dist && NODE_ENV=production rollup -c",
|
|
12
|
+
"prepare": "npx husky install",
|
|
13
|
+
"prepack": "npm run build",
|
|
11
14
|
"storybook-react": "storybook dev -p 6006 --config-dir .storybook-react",
|
|
12
15
|
"storybook-next-js": "storybook dev -p 6006 -c .storybook-next-js",
|
|
13
16
|
"semantic-release": "semantic-release"
|
|
@@ -19,11 +22,22 @@
|
|
|
19
22
|
"type": "git",
|
|
20
23
|
"url": "https://github.com/ITCase/itcase-storybook-config.git"
|
|
21
24
|
},
|
|
22
|
-
"
|
|
25
|
+
"exports": {
|
|
26
|
+
"./components/*": {
|
|
27
|
+
"types": "./dist/types/components/*/index.d.ts",
|
|
28
|
+
"import": "./dist/components/*.js",
|
|
29
|
+
"require": "./dist/cjs/components/*.js"
|
|
30
|
+
},
|
|
31
|
+
"./comfig/*": {
|
|
32
|
+
"types": "./dist/types/config/*/index.d.ts",
|
|
33
|
+
"import": "./dist/config/*.js",
|
|
34
|
+
"require": "./dist/cjs/config/*.js"
|
|
35
|
+
}
|
|
36
|
+
},
|
|
23
37
|
"files": [
|
|
24
38
|
"README.md",
|
|
25
|
-
"
|
|
26
|
-
"
|
|
39
|
+
"config",
|
|
40
|
+
"dist"
|
|
27
41
|
],
|
|
28
42
|
"publishConfig": {
|
|
29
43
|
"access": "public",
|
|
@@ -34,15 +48,13 @@
|
|
|
34
48
|
},
|
|
35
49
|
"dependencies": {
|
|
36
50
|
"@itcase/config": "^1.0.7",
|
|
37
|
-
"@storybook/addon-designs": "^8.2.0",
|
|
38
|
-
"storybook-addon-source-link": "^0.2.1",
|
|
39
51
|
"@itcase/storybook-addon-auth": "^1.0.4",
|
|
40
52
|
"@storybook/addon-actions": "^8.5.5",
|
|
41
53
|
"@storybook/addon-controls": "^8.5.5",
|
|
54
|
+
"@storybook/addon-designs": "^8.2.0",
|
|
42
55
|
"@storybook/addon-essentials": "^8.5.5",
|
|
43
56
|
"@storybook/addon-interactions": "^8.5.5",
|
|
44
57
|
"@storybook/addon-links": "^8.5.5",
|
|
45
|
-
"@storybook/react-vite": "^8.5.5",
|
|
46
58
|
"@storybook/addon-styling-webpack": "^1.0.1",
|
|
47
59
|
"@storybook/addon-themes": "^8.5.5",
|
|
48
60
|
"@storybook/addon-viewport": "^8.5.5",
|
|
@@ -52,32 +64,41 @@
|
|
|
52
64
|
"@storybook/nextjs": "^8.5.5",
|
|
53
65
|
"@storybook/preview-api": "^8.5.5",
|
|
54
66
|
"@storybook/react": "^8.5.5",
|
|
67
|
+
"@storybook/react-vite": "^8.5.5",
|
|
55
68
|
"@storybook/react-webpack5": "^8.5.5",
|
|
56
69
|
"@storybook/theming": "^8.5.5",
|
|
57
70
|
"http-proxy-middleware": "^3.0.3",
|
|
58
71
|
"msw": "^2.7.0",
|
|
59
72
|
"msw-storybook-addon": "^2.0.4",
|
|
60
73
|
"react-docgen": "^7.1.1",
|
|
61
|
-
"react-docgen-typescript-plugin": "^1.0.8"
|
|
74
|
+
"react-docgen-typescript-plugin": "^1.0.8",
|
|
75
|
+
"storybook-addon-source-link": "^0.2.1"
|
|
62
76
|
},
|
|
63
77
|
"devDependencies": {
|
|
64
|
-
"react": "^18",
|
|
65
|
-
"react-dom": "^18",
|
|
66
|
-
"@types/react": "^18",
|
|
67
|
-
"@types/react-dom": "^18",
|
|
68
78
|
"@commitlint/cli": "^19.7.1",
|
|
69
79
|
"@commitlint/config-conventional": "^19.7.1",
|
|
70
80
|
"@itcase/common": "^1.2.17",
|
|
71
|
-
"@itcase/lint": "^1.0.
|
|
81
|
+
"@itcase/lint": "^1.0.41",
|
|
72
82
|
"@itcase/ui": "^1.3.25",
|
|
83
|
+
"@rollup/plugin-babel": "^6.0.4",
|
|
84
|
+
"@rollup/plugin-commonjs": "^28.0.2",
|
|
85
|
+
"@rollup/plugin-node-resolve": "^16.0.0",
|
|
73
86
|
"@semantic-release/changelog": "^6.0.3",
|
|
74
87
|
"@semantic-release/git": "^10.0.1",
|
|
75
88
|
"@semantic-release/release-notes-generator": "14.0.3",
|
|
89
|
+
"@types/react": "^18",
|
|
90
|
+
"@types/react-dom": "^18",
|
|
76
91
|
"conventional-changelog-conventionalcommits": "^8.0.0",
|
|
77
92
|
"eslint": "9.20.1",
|
|
93
|
+
"glob": "^11.0.1",
|
|
78
94
|
"husky": "^9.1.7",
|
|
79
95
|
"lint-staged": "^15.4.3",
|
|
80
96
|
"prettier": "^3.5.0",
|
|
97
|
+
"react": "^18",
|
|
98
|
+
"react-dom": "^18",
|
|
99
|
+
"rollup": "^4.34.6",
|
|
100
|
+
"rollup-plugin-copy": "^3.5.0",
|
|
101
|
+
"rollup-plugin-peer-deps-external": "^2.2.4",
|
|
81
102
|
"semantic-release": "^24.2.2",
|
|
82
103
|
"storybook": "^8.5.5",
|
|
83
104
|
"stylelint": "^16.14.1",
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import React, { useEffect } from 'react'
|
|
2
|
-
|
|
3
|
-
let BACKEND_URL = process.env.EMAIL_URL
|
|
4
|
-
|
|
5
|
-
if (process.env.NODE_ENV === 'production') {
|
|
6
|
-
BACKEND_URL = `${process.env.REST_BASE_URL}/storybook`
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
function EmailTemplatePreview(props) {
|
|
10
|
-
const style = {
|
|
11
|
-
width: '100%',
|
|
12
|
-
height: '100%',
|
|
13
|
-
position: 'absolute',
|
|
14
|
-
top: '0',
|
|
15
|
-
right: '0',
|
|
16
|
-
bottom: '0',
|
|
17
|
-
left: '0',
|
|
18
|
-
overflow: 'hidden',
|
|
19
|
-
border: '0',
|
|
20
|
-
overflowX: 'hidden',
|
|
21
|
-
overflowY: 'hidden',
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
useEffect(() => {
|
|
25
|
-
const emailPreviewIframe = document.getElementById('emailPreview')
|
|
26
|
-
const loaded = () => {
|
|
27
|
-
const email = emailPreviewIframe.getElementsByClassName('email-body').length
|
|
28
|
-
if (!email) {
|
|
29
|
-
alert(
|
|
30
|
-
'Need to run the backend server to display email templates, use: python manage.py runserver',
|
|
31
|
-
)
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
emailPreviewIframe.addEventListener('load', loaded, true)
|
|
35
|
-
})
|
|
36
|
-
|
|
37
|
-
return (
|
|
38
|
-
<React.Fragment>
|
|
39
|
-
<iframe
|
|
40
|
-
width="100%"
|
|
41
|
-
height="100%"
|
|
42
|
-
id="emailPreview"
|
|
43
|
-
src={`${BACKEND_URL}${props.url}`}
|
|
44
|
-
style={style}
|
|
45
|
-
/>
|
|
46
|
-
</React.Fragment>
|
|
47
|
-
)
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
export { EmailTemplatePreview }
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import React, { useEffect, useRef } from 'react'
|
|
2
|
-
|
|
3
|
-
function FormSubmitWrapper(props) {
|
|
4
|
-
const formRef = useRef()
|
|
5
|
-
|
|
6
|
-
useEffect(() => {
|
|
7
|
-
if (formRef?.current) {
|
|
8
|
-
formRef.current.submit()
|
|
9
|
-
}
|
|
10
|
-
}, [formRef])
|
|
11
|
-
|
|
12
|
-
return React.cloneElement(props.children, {
|
|
13
|
-
ref: formRef,
|
|
14
|
-
})
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
export { FormSubmitWrapper }
|