@itcase/storybook-config 1.0.41 → 1.0.43

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@itcase/storybook-config",
3
- "version": "1.0.41",
3
+ "version": "1.0.43",
4
4
  "author": "ITCase",
5
5
  "description": "Code style linter configuration presets",
6
6
  "engines": {
@@ -38,12 +38,14 @@
38
38
  "./config/*": {
39
39
  "import": "./config/*.js",
40
40
  "require": "./config/*.js"
41
+ },
42
+ "./utils/*": {
43
+ "import": "./utils/*.js",
44
+ "require": "./utils/*.js"
41
45
  }
42
46
  },
43
47
  "files": [
44
48
  "README.md",
45
- "config",
46
- "utils",
47
49
  "dist"
48
50
  ],
49
51
  "publishConfig": {
@@ -1,12 +0,0 @@
1
- const ADDON_THEMES = {
2
- defaultTheme: 'am',
3
- themes: {
4
- am: 'am',
5
- baikal: 'baikal',
6
- dark: 'dark',
7
- itcase: 'itcase',
8
- light: 'light',
9
- },
10
- }
11
-
12
- export { ADDON_THEMES }
@@ -1,12 +0,0 @@
1
- const ADDONS_NEXTJS = [
2
- '@storybook/addon-links',
3
- '@storybook/addon-essentials',
4
- '@storybook/addon-interactions',
5
- '@itcase/storybook-addon-auth',
6
- '@storybook/addon-themes',
7
- '@storybook/addon-designs',
8
- 'storybook-addon-source-link',
9
- '@etchteam/storybook-addon-status',
10
- ]
11
-
12
- export { ADDONS_NEXTJS }
@@ -1,33 +0,0 @@
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
- '@storybook/addon-themes',
9
- '@etchteam/storybook-addon-status',
10
- {
11
- name: '@storybook/addon-styling-webpack',
12
- options: {
13
- rules: [
14
- {
15
- test: /\.css$/,
16
- use: [
17
- 'style-loader',
18
- {
19
- loader: 'css-loader',
20
- options: { importLoaders: 1 },
21
- },
22
- {
23
- loader: 'postcss-loader',
24
- options: { implementation: require.resolve('postcss') },
25
- },
26
- ],
27
- },
28
- ],
29
- },
30
- },
31
- ]
32
-
33
- export { ADDONS_REACT }
@@ -1,11 +0,0 @@
1
- const ADDONS_REACT_VITE = [
2
- '@storybook/addon-links',
3
- '@storybook/addon-essentials',
4
- '@storybook/addon-interactions',
5
- '@storybook/addon-themes',
6
- '@storybook/addon-designs',
7
- 'storybook-addon-source-link',
8
- '@etchteam/storybook-addon-status',
9
- ]
10
-
11
- export { ADDONS_REACT_VITE }
@@ -1 +0,0 @@
1
- import '../../../../src/config/appearance'
@@ -1,9 +0,0 @@
1
- import { USERS } from './users'
2
-
3
- const AUTHORIZATION = {
4
- profileUrl: `${process.env.REST_BASE_URL}/rest/profile/`,
5
- signInUrl: `${process.env.REST_BASE_URL}/rest/sign-in/`,
6
- values: USERS,
7
- }
8
-
9
- export { AUTHORIZATION }
@@ -1,20 +0,0 @@
1
- const BACKGROUNDS = {
2
- baikal: {
3
- name: 'Baikal',
4
- value: '#4CB7EA',
5
- },
6
- dark: {
7
- name: 'Dark',
8
- value: '#000000',
9
- },
10
- default: {
11
- name: 'Default',
12
- value: 'none',
13
- },
14
- light: {
15
- name: 'Light',
16
- value: '#fff',
17
- },
18
- }
19
-
20
- export { BACKGROUNDS }
@@ -1,5 +0,0 @@
1
- const FRAMEWORK_NEXTJS = {
2
- framework: '@storybook/nextjs',
3
- }
4
-
5
- export { FRAMEWORK_NEXTJS }
@@ -1,21 +0,0 @@
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 }
@@ -1,5 +0,0 @@
1
- const FRAMEWORK_REACT_VITE = {
2
- framework: '@storybook/react-vite',
3
- }
4
-
5
- export { FRAMEWORK_REACT_VITE }
package/config/index.js DELETED
@@ -1,43 +0,0 @@
1
- import { ADDONS_NEXTJS } from './addonsNextJs'
2
- import { ADDONS_REACT } from './addonsReact'
3
- import { ADDONS_REACT_VITE } from './addonsReactVite'
4
- import { ADDON_THEMES } from './addonThemes'
5
- import { AUTHORIZATION } from './authorization'
6
- import { BACKGROUNDS } from './backgrounds'
7
- import { FRAMEWORK_NEXTJS } from './frameworkNextJs'
8
- import { FRAMEWORK_REACT } from './frameworkReact'
9
- import { FRAMEWORK_REACT_VITE } from './frameworkReactVite'
10
- import { MAIN_CONFIG } from './mainConfig'
11
- import { MAIN_CONFIG_VITE } from './mainConfigVite'
12
- import { REFS } from './refs'
13
- import { SOURCELINK } from './sourceLink'
14
- import { STATIC_DIRS_NEXTJS } from './staticDirsNextJs'
15
- import { STATIC_DIRS_REACT } from './staticDirsReact'
16
- import { STATIC_DIRS_REACT_VITE } from './staticDirsReactVite'
17
- import { STATUS } from './status'
18
- import { STORYSORT, STORYSORT_DOCUMENTATION, STORYSORT_ICONS } from './storySort'
19
- import { VIEWPORTS } from './viewports'
20
-
21
- export {
22
- AUTHORIZATION,
23
- ADDON_THEMES,
24
- ADDONS_NEXTJS,
25
- STATIC_DIRS_REACT,
26
- STATIC_DIRS_NEXTJS,
27
- STATUS,
28
- STATIC_DIRS_REACT_VITE,
29
- FRAMEWORK_NEXTJS,
30
- FRAMEWORK_REACT,
31
- FRAMEWORK_REACT_VITE,
32
- ADDONS_REACT,
33
- SOURCELINK,
34
- ADDONS_REACT_VITE,
35
- BACKGROUNDS,
36
- MAIN_CONFIG,
37
- MAIN_CONFIG_VITE,
38
- REFS,
39
- VIEWPORTS,
40
- STORYSORT,
41
- STORYSORT_ICONS,
42
- STORYSORT_DOCUMENTATION,
43
- }
@@ -1,31 +0,0 @@
1
- const MAIN_CONFIG = {
2
- core: {
3
- disableTelemetry: true,
4
- disableWhatsNewNotifications: true,
5
- },
6
- features: {
7
- backgroundsStoryGlobals: true,
8
- viewportStoryGlobals: true,
9
- },
10
- layout: 'fullscreen',
11
- tags: ['autodocs'],
12
- webpackFinal: async (config) => {
13
- const imageRule = config.module?.rules?.find((rule) => {
14
- const test = rule.test
15
- if (!test) {
16
- return false
17
- }
18
- return test.test('.svg')
19
- })
20
-
21
- imageRule.exclude = /\.svg$/
22
-
23
- config.module?.rules?.push({
24
- test: /\.svg$/,
25
- use: ['@svgr/webpack'],
26
- })
27
- return config
28
- },
29
- }
30
-
31
- export { MAIN_CONFIG }
@@ -1,13 +0,0 @@
1
- const MAIN_CONFIG_VITE = {
2
- core: {
3
- disableTelemetry: true,
4
- },
5
- features: {
6
- backgroundsStoryGlobals: true,
7
- viewportStoryGlobals: true,
8
- },
9
- layout: 'fullscreen',
10
- tags: ['autodocs'],
11
- }
12
-
13
- export { MAIN_CONFIG_VITE }
@@ -1,68 +0,0 @@
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
- }
package/config/refs.js DELETED
@@ -1,14 +0,0 @@
1
- const REFS = {
2
- 'itcase-storybook': {
3
- expanded: false,
4
- title: 'Introduction',
5
- url: 'https://itcase.pro/storybook/',
6
- },
7
- 'itcase-ui': {
8
- expanded: false,
9
- title: 'ITCase UI',
10
- url: 'https://itcase.pro/ui/',
11
- },
12
- }
13
-
14
- export { REFS }
@@ -1,25 +0,0 @@
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 }
@@ -1,6 +0,0 @@
1
- const STATIC_DIRS_NEXTJS = [
2
- { from: '../public', to: '/' },
3
- { from: '../src/appearance/', to: 'src/appearance/' },
4
- { from: '../public/img', to: 'img/' },
5
- ]
6
- export { STATIC_DIRS_NEXTJS }
@@ -1,2 +0,0 @@
1
- const STATIC_DIRS_REACT = [{ from: '../public', to: '/' }]
2
- export { STATIC_DIRS_REACT }
@@ -1,2 +0,0 @@
1
- const STATIC_DIRS_REACT_VITE = [{ from: '../public', to: '/' }]
2
- export { STATIC_DIRS_REACT_VITE }
package/config/status.js DELETED
@@ -1,26 +0,0 @@
1
- const STATUS = {
2
- statuses: {
3
- emailDevelopServer: {
4
- color: '#ffffff',
5
- background: 'red',
6
- description: 'Story use template from local django-server',
7
- },
8
- emailRemoteServer: {
9
- color: '#ffffff',
10
- background: 'green',
11
- description: 'Story use template from remote server',
12
- },
13
- emailServerUrlNotSet: {
14
- color: '#ffffff',
15
- background: 'red',
16
- description: 'Please set EMAIL_URL in .env.local',
17
- },
18
- },
19
- type: !process.env.EMAIL_URL
20
- ? 'emailServerUrlNotSet'
21
- : process.env.EMAIL_URL.includes('http://')
22
- ? 'emailDevelopServer'
23
- : 'emailRemoteServer',
24
- }
25
-
26
- export { STATUS }
@@ -1,174 +0,0 @@
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
- '*',
48
- 'Tokens',
49
- 'API',
50
- 'Components',
51
- [
52
- ...defaultDocSort,
53
- ...defaultSortFirst,
54
- '*',
55
- ...defaultSortLast,
56
- [
57
- ...defaultDocSort,
58
- ...defaultSortFirst,
59
- '*',
60
- ...defaultSortLast,
61
- [
62
- 'Components',
63
- [
64
- ...defaultDocSort,
65
- ...defaultSortFirst,
66
- '*',
67
- ...defaultSortLast,
68
- [
69
- ...defaultDocSort,
70
- ...defaultSortFirst,
71
- '*',
72
- ...defaultSortLast,
73
- [...defaultDocSort, ...defaultSortFirst, '*', ...defaultSortLast],
74
- [
75
- 'First',
76
- 'First Bet',
77
- 'Bet',
78
- 'New Offer',
79
- 'Wait',
80
- 'Finished',
81
- 'Stopped',
82
- 'Canceled',
83
- 'Need Confirm',
84
- 'Confirmed',
85
- 'Refused',
86
- '*',
87
- ],
88
- '*',
89
- ...defaultSortLast,
90
- ],
91
- ],
92
- ],
93
- ],
94
- ],
95
- 'Pages',
96
- 'Page Blocks',
97
- [
98
- ...defaultDocSort,
99
- ...defaultSortFirst,
100
- ...defaultStateSort,
101
- '*',
102
- ...defaultSortLast,
103
- [
104
- ...defaultDocSort,
105
- ...defaultSortFirst,
106
- ...defaultStateSort,
107
- '*',
108
- ...defaultSortLast,
109
- [
110
- ...defaultDocSort,
111
- ...defaultSortFirst,
112
- ...defaultStateSort,
113
- '*',
114
- ...defaultSortLast,
115
- [...defaultDocSort, ...defaultSortFirst, ...defaultStateSort, '*', ...defaultSortLast],
116
- ],
117
- ],
118
- ],
119
- 'Page Components',
120
- [
121
- ...defaultDocSort,
122
- ...defaultSortFirst,
123
- ...defaultStateSort,
124
- '*',
125
- ...defaultSortLast,
126
- [
127
- ...defaultDocSort,
128
- ...defaultSortFirst,
129
- ...defaultStateSort,
130
- '*',
131
- ...defaultSortLast,
132
- [
133
- ...defaultDocSort,
134
- ...defaultSortFirst,
135
- ...defaultStateSort,
136
- '*',
137
- ...defaultSortLast,
138
- [...defaultDocSort, ...defaultSortFirst, ...defaultStateSort, '*', ...defaultSortLast],
139
- ],
140
- ],
141
- ],
142
- 'Forms',
143
- [...defaultDocSort, ...defaultFormSort, '*'],
144
- 'Email',
145
- [...defaultDocSort, '*'],
146
- ]
147
-
148
- const STORYSORT_DOCUMENTATION = [
149
- '*',
150
- [
151
- 'Introduction',
152
- 'Frontend',
153
- [
154
- 'Overview',
155
- 'Structure',
156
- 'Packages',
157
- 'Pages',
158
- 'PageBlocks',
159
- 'PageComponents',
160
- 'Forms',
161
- 'Icons',
162
- ],
163
- 'Backend',
164
- 'Design',
165
- 'Email',
166
- 'Storybook',
167
- '*',
168
- 'FAQ',
169
- ],
170
- ]
171
-
172
- const STORYSORT_ICONS = ['Overview', 'Usage', 'Default Icons', '*']
173
-
174
- export { STORYSORT, STORYSORT_DOCUMENTATION, STORYSORT_ICONS }
package/config/users.js DELETED
@@ -1,10 +0,0 @@
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 }
@@ -1,22 +0,0 @@
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 }
@@ -1,55 +0,0 @@
1
- import axios from 'axios'
2
- import camelCase from 'lodash/camelCase'
3
-
4
- async function getStoryInfoBlocks(infoBlockSlugsList = []) {
5
- const slugsList = []
6
- const regExpsList = []
7
-
8
- infoBlockSlugsList.forEach((slug) => {
9
- if (slug instanceof RegExp) {
10
- regExpsList.push(slug)
11
- } else {
12
- slugsList.push(slug)
13
- }
14
- })
15
-
16
- const restBaseUrl = process.env.REST_BASE_URL
17
- const slugsQuery = slugsList.join(',')
18
- const response = await axios.get(`${restBaseUrl}rest/infoblocks/?active=true&slugs=${slugsQuery}`)
19
- const infoBlocksList = response.data.results || []
20
- const infoBlocks = infoBlocksList.reduce((resultData, infoBlockItem) => {
21
- const targetSlugRegExp = regExpsList.find((slugRegExp) => {
22
- return slugRegExp.test(infoBlockItem.slug)
23
- })
24
-
25
- if (targetSlugRegExp) {
26
- const key = camelCase(infoBlockItem.slug)
27
- if (resultData[key]) {
28
- resultData[key].push(infoBlockItem)
29
- } else {
30
- resultData[key] = [infoBlockItem]
31
- }
32
- return resultData
33
- }
34
-
35
- const targetSlug = slugsList.find((slug) => {
36
- return slug === infoBlockItem.slug
37
- })
38
-
39
- if (targetSlug) {
40
- const key = camelCase(targetSlug)
41
- resultData[key] = infoBlockItem
42
- return resultData
43
- }
44
-
45
- // If no specific infoBlocks are assigned to this page,
46
- // then we use the "slug" as a key for the infoBlocks dictionary.
47
- const infoBlockKey = camelCase(infoBlockItem.slug)
48
- resultData[infoBlockKey] = infoBlockItem
49
- return resultData
50
- }, {})
51
-
52
- return infoBlocks
53
- }
54
-
55
- export { getStoryInfoBlocks }