@procore/storybook-addon 4.5.1 → 4.6.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/CHANGELOG.md +6 -0
- package/README.md +10 -8
- package/dist/legacy/chunk-CLCAWS5I.js +253 -0
- package/dist/legacy/index.cjs +5343 -8
- package/dist/legacy/index.d.cts +2 -1
- package/dist/legacy/index.d.ts +2 -1
- package/dist/legacy/index.js +5121 -5
- package/dist/legacy/preset.cjs +48 -245
- package/dist/legacy/preset.d.cts +88 -8
- package/dist/legacy/preset.d.ts +88 -8
- package/dist/legacy/preset.js +7 -413
- package/dist/modern/chunk-CLCAWS5I.js +253 -0
- package/dist/modern/index.cjs +5343 -8
- package/dist/modern/index.d.cts +2 -1
- package/dist/modern/index.d.ts +2 -1
- package/dist/modern/index.js +5121 -5
- package/dist/modern/preset.cjs +48 -245
- package/dist/modern/preset.d.cts +88 -8
- package/dist/modern/preset.d.ts +88 -8
- package/dist/modern/preset.js +7 -413
- package/package.json +8 -8
- package/dist/legacy/chunk-QGM4M3NI.js +0 -37
- package/dist/modern/chunk-QGM4M3NI.js +0 -37
package/CHANGELOG.md
CHANGED
package/README.md
CHANGED
|
@@ -8,7 +8,7 @@ An addon to customize procore theme and adds common used configuration.
|
|
|
8
8
|
yarn add -D @procore/storybook-addon
|
|
9
9
|
```
|
|
10
10
|
|
|
11
|
-
And add the addon to
|
|
11
|
+
And add the addon to your addon sets:
|
|
12
12
|
|
|
13
13
|
```tsx
|
|
14
14
|
module.exports = {
|
|
@@ -16,11 +16,13 @@ module.exports = {
|
|
|
16
16
|
};
|
|
17
17
|
```
|
|
18
18
|
|
|
19
|
-
This
|
|
19
|
+
This addon provides essential functionality and addons used across different apps at Procore.
|
|
20
20
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
- [@storybook/addon-
|
|
21
|
+
## Included Addons
|
|
22
|
+
|
|
23
|
+
- [@storybook/addon-docs](https://storybook.js.org/addons/@storybook/addon-docs) - Documentation and documentation controls
|
|
24
|
+
- [@storybook/addon-a11y](https://storybook.js.org/addons/@storybook/addon-a11y) - Accessibility testing addon
|
|
25
|
+
- [@storybook/addon-styling-webpack](https://storybook.js.org/addons/@storybook/addon-styling-webpack) - Webpack styling configuration
|
|
24
26
|
|
|
25
27
|
## Usage
|
|
26
28
|
|
|
@@ -33,12 +35,12 @@ This simple addon adds 3 main addon used across different apps at Procore.
|
|
|
33
35
|
- a hower text ${\text{\color{green}{Core}}}$
|
|
34
36
|
- the link to core design system [https://design.procore.com](https://design.procore.com) on the logo.
|
|
35
37
|
|
|
36
|
-
In order to set the theme by default values ${\text{\color{green}{createProcoreTheme}}}$ needs to be added in `manager.
|
|
38
|
+
In order to set the theme by default values ${\text{\color{green}{createProcoreTheme}}}$ needs to be added in `manager.ts`. If no parameter has been passed to the `createProcoreTheme` the aforementioned default values will be set.
|
|
37
39
|
|
|
38
40
|
```tsx
|
|
39
41
|
// .storybook/manager.js
|
|
40
42
|
import { createProcoreTheme } from '@procore/storybook-addon';
|
|
41
|
-
import { addons } from '
|
|
43
|
+
import { addons } from 'storybook/manager-api';
|
|
42
44
|
|
|
43
45
|
addons.setConfig({
|
|
44
46
|
theme: createProcoreTheme(),
|
|
@@ -51,7 +53,7 @@ For more configuration please visit: https://storybook.js.org/docs/react/configu
|
|
|
51
53
|
// .storybook/manager.js
|
|
52
54
|
// example below will override Procore default theming configuration
|
|
53
55
|
import { createProcoreTheme } from '@procore/storybook-addon';
|
|
54
|
-
import { addons } from '
|
|
56
|
+
import { addons } from 'storybook/manager-api';
|
|
55
57
|
|
|
56
58
|
addons.setConfig({
|
|
57
59
|
theme: createProcoreTheme({
|
|
@@ -0,0 +1,253 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
|
|
8
|
+
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
|
|
9
|
+
}) : x)(function(x) {
|
|
10
|
+
if (typeof require !== "undefined") return require.apply(this, arguments);
|
|
11
|
+
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
12
|
+
});
|
|
13
|
+
var __commonJS = (cb, mod) => function __require2() {
|
|
14
|
+
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
15
|
+
};
|
|
16
|
+
var __copyProps = (to, from, except, desc) => {
|
|
17
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
18
|
+
for (let key of __getOwnPropNames(from))
|
|
19
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
20
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
21
|
+
}
|
|
22
|
+
return to;
|
|
23
|
+
};
|
|
24
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
25
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
26
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
27
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
28
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
29
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
30
|
+
mod
|
|
31
|
+
));
|
|
32
|
+
|
|
33
|
+
// ../../node_modules/react-dev-utils/getCacheIdentifier.js
|
|
34
|
+
var require_getCacheIdentifier = __commonJS({
|
|
35
|
+
"../../node_modules/react-dev-utils/getCacheIdentifier.js"(exports, module) {
|
|
36
|
+
"use strict";
|
|
37
|
+
module.exports = function getCacheIdentifier2(environment, packages) {
|
|
38
|
+
let cacheIdentifier = environment == null ? "" : environment.toString();
|
|
39
|
+
for (const packageName of packages) {
|
|
40
|
+
cacheIdentifier += `:${packageName}@`;
|
|
41
|
+
try {
|
|
42
|
+
cacheIdentifier += __require(`${packageName}/package.json`).version;
|
|
43
|
+
} catch (_) {
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
return cacheIdentifier;
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
// src/configurations/babel.ts
|
|
52
|
+
var import_getCacheIdentifier = __toESM(require_getCacheIdentifier(), 1);
|
|
53
|
+
import { version as babelRuntimeVersion } from "@babel/runtime/package.json";
|
|
54
|
+
import { version as corejsVersion } from "core-js/package.json";
|
|
55
|
+
var targets = "defaults";
|
|
56
|
+
var transformRuntimeOptions = {
|
|
57
|
+
// By default, babel assumes babel/runtime version 7.0.0-beta.0,
|
|
58
|
+
// explicitly resolving to match the provided helper functions.
|
|
59
|
+
// https://github.com/babel/babel/issues/10261
|
|
60
|
+
version: babelRuntimeVersion
|
|
61
|
+
};
|
|
62
|
+
function createConfigForReact() {
|
|
63
|
+
const env = process.env.NODE_ENV || "development";
|
|
64
|
+
const isProduction = env === "production";
|
|
65
|
+
return {
|
|
66
|
+
babelrc: false,
|
|
67
|
+
cacheCompression: false,
|
|
68
|
+
cacheDirectory: true,
|
|
69
|
+
cacheIdentifier: (0, import_getCacheIdentifier.default)(env, [
|
|
70
|
+
"babel-plugin-named-asset-import",
|
|
71
|
+
"react-dev-utils"
|
|
72
|
+
]),
|
|
73
|
+
assumptions: {
|
|
74
|
+
privateFieldsAsProperties: true,
|
|
75
|
+
setPublicClassFields: true
|
|
76
|
+
},
|
|
77
|
+
compact: isProduction,
|
|
78
|
+
configFile: false,
|
|
79
|
+
sourceType: "unambiguous",
|
|
80
|
+
targets,
|
|
81
|
+
plugins: [
|
|
82
|
+
[
|
|
83
|
+
__require.resolve("@babel/plugin-transform-runtime"),
|
|
84
|
+
transformRuntimeOptions
|
|
85
|
+
],
|
|
86
|
+
[
|
|
87
|
+
__require.resolve("babel-plugin-named-asset-import"),
|
|
88
|
+
{
|
|
89
|
+
loaderMap: {
|
|
90
|
+
svg: {
|
|
91
|
+
ReactComponent: "@svgr/webpack?-svgo,+titleProp,+ref![path]"
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
],
|
|
96
|
+
[
|
|
97
|
+
__require.resolve("babel-plugin-styled-components"),
|
|
98
|
+
{
|
|
99
|
+
minify: true,
|
|
100
|
+
ssr: false,
|
|
101
|
+
displayName: true,
|
|
102
|
+
fileName: false,
|
|
103
|
+
transpileTemplateLiterals: true,
|
|
104
|
+
pure: false
|
|
105
|
+
}
|
|
106
|
+
]
|
|
107
|
+
],
|
|
108
|
+
presets: [
|
|
109
|
+
[
|
|
110
|
+
__require.resolve("@babel/preset-env"),
|
|
111
|
+
{
|
|
112
|
+
useBuiltIns: "usage",
|
|
113
|
+
corejs: corejsVersion
|
|
114
|
+
}
|
|
115
|
+
],
|
|
116
|
+
[
|
|
117
|
+
__require.resolve("@babel/preset-react"),
|
|
118
|
+
{
|
|
119
|
+
useBuiltIns: true
|
|
120
|
+
}
|
|
121
|
+
],
|
|
122
|
+
__require.resolve("@babel/preset-typescript")
|
|
123
|
+
]
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
// src/configurations/previewHead.ts
|
|
128
|
+
var defaultValues = {
|
|
129
|
+
includeBoxSizing: true
|
|
130
|
+
};
|
|
131
|
+
function previewHead_default(head, _options, parameters) {
|
|
132
|
+
const { includeBoxSizing = true } = {
|
|
133
|
+
...defaultValues,
|
|
134
|
+
...parameters
|
|
135
|
+
};
|
|
136
|
+
return `
|
|
137
|
+
${head}
|
|
138
|
+
<meta charset="UTF-8" />
|
|
139
|
+
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
140
|
+
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Inter:wght@400;600;700&display=swap">
|
|
141
|
+
|
|
142
|
+
<style>
|
|
143
|
+
${includeBoxSizing ? `
|
|
144
|
+
*,
|
|
145
|
+
*:before,
|
|
146
|
+
*:after {
|
|
147
|
+
-webkit-box-sizing: inherit;
|
|
148
|
+
-moz-box-sizing: inherit;
|
|
149
|
+
box-sizing: inherit;
|
|
150
|
+
}
|
|
151
|
+
html {
|
|
152
|
+
-webkit-box-sizing: border-box;
|
|
153
|
+
-moz-box-sizing: border-box;
|
|
154
|
+
box-sizing: border-box;
|
|
155
|
+
}
|
|
156
|
+
` : ""}
|
|
157
|
+
html {
|
|
158
|
+
font-family: Inter, sans-serif;
|
|
159
|
+
}
|
|
160
|
+
body {
|
|
161
|
+
width: 100%;
|
|
162
|
+
}
|
|
163
|
+
</style>
|
|
164
|
+
`;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
// src/utils/index.ts
|
|
168
|
+
function requireIfExists(moduleName) {
|
|
169
|
+
try {
|
|
170
|
+
return __require(moduleName);
|
|
171
|
+
} catch (e) {
|
|
172
|
+
return;
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
// src/preset.ts
|
|
177
|
+
var addons = () => {
|
|
178
|
+
const sassImplementation = requireIfExists("sass");
|
|
179
|
+
return [
|
|
180
|
+
{
|
|
181
|
+
name: "@storybook/addon-styling-webpack",
|
|
182
|
+
options: {
|
|
183
|
+
rules: [
|
|
184
|
+
{
|
|
185
|
+
test: /\.scss$/,
|
|
186
|
+
use: [
|
|
187
|
+
"style-loader",
|
|
188
|
+
{
|
|
189
|
+
loader: "css-loader",
|
|
190
|
+
options: {
|
|
191
|
+
modules: {
|
|
192
|
+
localIdentName: "[name]__[local]--[hash:base64:5]"
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
},
|
|
196
|
+
{
|
|
197
|
+
loader: "sass-loader",
|
|
198
|
+
options: {
|
|
199
|
+
...sassImplementation ? {
|
|
200
|
+
implementation: sassImplementation
|
|
201
|
+
} : {}
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
]
|
|
205
|
+
},
|
|
206
|
+
{
|
|
207
|
+
test: /\.css$/,
|
|
208
|
+
use: [
|
|
209
|
+
"style-loader",
|
|
210
|
+
{
|
|
211
|
+
loader: "css-loader",
|
|
212
|
+
options: {
|
|
213
|
+
modules: {
|
|
214
|
+
localIdentName: "[name]__[local]--[hash:base64:5]"
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
]
|
|
219
|
+
}
|
|
220
|
+
]
|
|
221
|
+
}
|
|
222
|
+
},
|
|
223
|
+
"@storybook/addon-docs",
|
|
224
|
+
"@storybook/addon-a11y"
|
|
225
|
+
];
|
|
226
|
+
};
|
|
227
|
+
function babelDefault() {
|
|
228
|
+
return createConfigForReact();
|
|
229
|
+
}
|
|
230
|
+
var typescript = {
|
|
231
|
+
checkOptions: {
|
|
232
|
+
check: true,
|
|
233
|
+
exclude: /node_modules/
|
|
234
|
+
},
|
|
235
|
+
reactDocgen: false
|
|
236
|
+
};
|
|
237
|
+
var preset_default = {
|
|
238
|
+
addons: addons(),
|
|
239
|
+
babelDefault,
|
|
240
|
+
typescript,
|
|
241
|
+
previewHead: previewHead_default
|
|
242
|
+
};
|
|
243
|
+
|
|
244
|
+
export {
|
|
245
|
+
__require,
|
|
246
|
+
__commonJS,
|
|
247
|
+
__toESM,
|
|
248
|
+
previewHead_default,
|
|
249
|
+
addons,
|
|
250
|
+
babelDefault,
|
|
251
|
+
typescript,
|
|
252
|
+
preset_default
|
|
253
|
+
};
|