storybook-addon-design-system-docs 1.0.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/LICENSE +21 -0
- package/README.md +108 -0
- package/dist/core/assets/config.d.ts +15 -0
- package/dist/core/assets/config.js +100 -0
- package/dist/core/assets/generator.d.ts +11 -0
- package/dist/core/assets/generator.js +77 -0
- package/dist/core/primitives/index.d.ts +7 -0
- package/dist/core/primitives/index.js +23 -0
- package/dist/core/primitives/types.d.ts +130 -0
- package/dist/core/primitives/types.js +2 -0
- package/dist/manager.js +2 -0
- package/dist/preset.cjs +208 -0
- package/dist/preset.d.ts +30 -0
- package/dist/preset.js +13 -0
- package/dist/types.d.ts +204 -0
- package/dist/types.js +17 -0
- package/dist/unplugin.d.ts +2 -0
- package/dist/unplugin.js +139 -0
- package/dist/util/Logger.d.ts +67 -0
- package/dist/util/Logger.js +172 -0
- package/dist/util/resolveTemplate.d.ts +10 -0
- package/dist/util/resolveTemplate.js +60 -0
- package/manager.js +1 -0
- package/package.json +153 -0
- package/preset.js +13 -0
- package/tailwind.config.js +233 -0
- package/templates/assets.mdx +29 -0
- package/templates/colors.mdx +13 -0
- package/templates/design-system.mdx +57 -0
- package/templates/radius.mdx +9 -0
- package/templates/shadows.mdx +9 -0
- package/templates/spacing.mdx +12 -0
- package/templates/typography.mdx +18 -0
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Logger = void 0;
|
|
4
|
+
const LOG_LEVELS = {
|
|
5
|
+
debug: 0,
|
|
6
|
+
info: 1,
|
|
7
|
+
warn: 2,
|
|
8
|
+
error: 3,
|
|
9
|
+
silent: 4,
|
|
10
|
+
};
|
|
11
|
+
// ANSI color codes
|
|
12
|
+
const COLORS = {
|
|
13
|
+
reset: "\x1b[0m",
|
|
14
|
+
dim: "\x1b[2m",
|
|
15
|
+
cyan: "\x1b[36m",
|
|
16
|
+
yellow: "\x1b[33m",
|
|
17
|
+
red: "\x1b[31m",
|
|
18
|
+
magenta: "\x1b[35m",
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* Detect if colors should be used in output.
|
|
22
|
+
* Respects NO_COLOR env var and checks for TTY.
|
|
23
|
+
*/
|
|
24
|
+
function supportsColor() {
|
|
25
|
+
// Respect NO_COLOR convention: https://no-color.org/
|
|
26
|
+
if (process.env.NO_COLOR !== undefined) {
|
|
27
|
+
return false;
|
|
28
|
+
}
|
|
29
|
+
// Check FORCE_COLOR for CI environments that support colors
|
|
30
|
+
if (process.env.FORCE_COLOR !== undefined) {
|
|
31
|
+
return process.env.FORCE_COLOR !== "0";
|
|
32
|
+
}
|
|
33
|
+
// Check if stdout is a TTY
|
|
34
|
+
if (typeof process !== "undefined" && process.stdout?.isTTY) {
|
|
35
|
+
return true;
|
|
36
|
+
}
|
|
37
|
+
return false;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Logger utility for the addon with configurable log levels and context support.
|
|
41
|
+
*
|
|
42
|
+
* Features:
|
|
43
|
+
* - Log levels (debug, info, warn, error, silent)
|
|
44
|
+
* - Context/prefix support for consistent logging
|
|
45
|
+
* - Conditional ANSI colors (respects NO_COLOR, FORCE_COLOR, TTY detection)
|
|
46
|
+
* - Structured data logging
|
|
47
|
+
*/
|
|
48
|
+
// biome-ignore lint/suspicious/useAdjacentOverloadSignatures: Separate static/instance grouping is preferred here
|
|
49
|
+
class Logger {
|
|
50
|
+
/**
|
|
51
|
+
* Create a logger instance with a specific context prefix.
|
|
52
|
+
* @param context - Context name to prefix log messages (e.g., 'ConfigLoader', 'unplugin')
|
|
53
|
+
*/
|
|
54
|
+
constructor(context) {
|
|
55
|
+
this.prefix = context
|
|
56
|
+
? `[${Logger.defaultPrefix}:${context}]`
|
|
57
|
+
: `[${Logger.defaultPrefix}]`;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Set the global log level. Messages below this level will be suppressed.
|
|
61
|
+
*/
|
|
62
|
+
static setLevel(level) {
|
|
63
|
+
Logger.level = level;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Get the current global log level.
|
|
67
|
+
*/
|
|
68
|
+
static getLevel() {
|
|
69
|
+
return Logger.level;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Enable or disable color output.
|
|
73
|
+
*/
|
|
74
|
+
static setColors(enabled) {
|
|
75
|
+
Logger.useColors = enabled;
|
|
76
|
+
}
|
|
77
|
+
shouldLog(level) {
|
|
78
|
+
return LOG_LEVELS[level] >= LOG_LEVELS[Logger.level];
|
|
79
|
+
}
|
|
80
|
+
colorize(color, text) {
|
|
81
|
+
if (!Logger.useColors) {
|
|
82
|
+
return text;
|
|
83
|
+
}
|
|
84
|
+
return `${COLORS[color]}${text}${COLORS.reset}`;
|
|
85
|
+
}
|
|
86
|
+
formatMessage(level, message) {
|
|
87
|
+
return `${this.prefix} ${level}: ${message}`;
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Log debug messages. Only shown when log level is 'debug'.
|
|
91
|
+
*/
|
|
92
|
+
debug(message, data) {
|
|
93
|
+
if (!this.shouldLog("debug"))
|
|
94
|
+
return;
|
|
95
|
+
const formatted = this.formatMessage("DEBUG", message);
|
|
96
|
+
console.debug(this.colorize("dim", formatted));
|
|
97
|
+
if (data) {
|
|
98
|
+
console.debug(this.colorize("dim", JSON.stringify(data, null, 2)));
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Log informational messages.
|
|
103
|
+
*/
|
|
104
|
+
info(message, data) {
|
|
105
|
+
if (!this.shouldLog("info"))
|
|
106
|
+
return;
|
|
107
|
+
const formatted = this.formatMessage("INFO", message);
|
|
108
|
+
console.info(this.colorize("cyan", formatted));
|
|
109
|
+
if (data) {
|
|
110
|
+
console.info(JSON.stringify(data, null, 2));
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* Log warning messages.
|
|
115
|
+
*/
|
|
116
|
+
warn(message, data) {
|
|
117
|
+
if (!this.shouldLog("warn"))
|
|
118
|
+
return;
|
|
119
|
+
const formatted = this.formatMessage("WARN", message);
|
|
120
|
+
console.warn(this.colorize("yellow", formatted));
|
|
121
|
+
if (data) {
|
|
122
|
+
console.warn(JSON.stringify(data, null, 2));
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* Log error messages.
|
|
127
|
+
*/
|
|
128
|
+
error(message, error, data) {
|
|
129
|
+
if (!this.shouldLog("error"))
|
|
130
|
+
return;
|
|
131
|
+
const formatted = this.formatMessage("ERROR", message);
|
|
132
|
+
console.error(this.colorize("red", formatted));
|
|
133
|
+
if (error instanceof Error) {
|
|
134
|
+
console.error(this.colorize("red", ` ${error.message}`));
|
|
135
|
+
if (error.stack) {
|
|
136
|
+
console.error(this.colorize("dim", error.stack));
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
else if (error !== undefined) {
|
|
140
|
+
console.error(error);
|
|
141
|
+
}
|
|
142
|
+
if (data) {
|
|
143
|
+
console.error(JSON.stringify(data, null, 2));
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
// Static convenience methods for backward compatibility and quick logging
|
|
147
|
+
/**
|
|
148
|
+
* Static warn method for backward compatibility.
|
|
149
|
+
* Consider using instance methods for context-aware logging.
|
|
150
|
+
*/
|
|
151
|
+
static warn(message) {
|
|
152
|
+
new Logger().warn(message);
|
|
153
|
+
}
|
|
154
|
+
/**
|
|
155
|
+
* Static error method for backward compatibility.
|
|
156
|
+
* Consider using instance methods for context-aware logging.
|
|
157
|
+
*/
|
|
158
|
+
static error(message) {
|
|
159
|
+
new Logger().error(message);
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* Static info method for backward compatibility.
|
|
163
|
+
* Consider using instance methods for context-aware logging.
|
|
164
|
+
*/
|
|
165
|
+
static info(message) {
|
|
166
|
+
new Logger().info(message);
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
exports.Logger = Logger;
|
|
170
|
+
Logger.defaultPrefix = "storybook-addon-design-system-docs";
|
|
171
|
+
Logger.level = "info";
|
|
172
|
+
Logger.useColors = supportsColor();
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { NormalizedAddonOptions } from "@/core/primitives/types";
|
|
2
|
+
/**
|
|
3
|
+
* Resolves the absolute path to the MDX template for a given section.
|
|
4
|
+
* Checks user-configured directory, project override, and built-in templates.
|
|
5
|
+
*
|
|
6
|
+
* @param sectionName - The name of the section (e.g., "Colors", "Typography", "assets").
|
|
7
|
+
* @param options - The normalized addon options.
|
|
8
|
+
* @returns The absolute path to the resolved MDX template file, or undefined if not found.
|
|
9
|
+
*/
|
|
10
|
+
export declare function resolveTemplate(sectionName: string, options: NormalizedAddonOptions): string;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.resolveTemplate = void 0;
|
|
4
|
+
const node_fs_1 = require("node:fs");
|
|
5
|
+
const node_path_1 = require("node:path");
|
|
6
|
+
const node_url_1 = require("node:url");
|
|
7
|
+
const Logger_1 = require("@/util/Logger");
|
|
8
|
+
const __filename = (0, node_url_1.fileURLToPath)(import.meta.url);
|
|
9
|
+
const __dirname = node_path_1.default.dirname(__filename);
|
|
10
|
+
const logger = new Logger_1.Logger("resolveTemplate");
|
|
11
|
+
/**
|
|
12
|
+
* Convert camelCase or PascalCase to kebab-case
|
|
13
|
+
* e.g., "BorderRadius" -> "border-radius", "Colors" -> "colors"
|
|
14
|
+
*/
|
|
15
|
+
function toKebabCase(str) {
|
|
16
|
+
return str.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase();
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Resolves the absolute path to the MDX template for a given section.
|
|
20
|
+
* Checks user-configured directory, project override, and built-in templates.
|
|
21
|
+
*
|
|
22
|
+
* @param sectionName - The name of the section (e.g., "Colors", "Typography", "assets").
|
|
23
|
+
* @param options - The normalized addon options.
|
|
24
|
+
* @returns The absolute path to the resolved MDX template file, or undefined if not found.
|
|
25
|
+
*/
|
|
26
|
+
function resolveTemplate(sectionName, options) {
|
|
27
|
+
const kebabName = toKebabCase(sectionName);
|
|
28
|
+
const filename = `${kebabName}.mdx`;
|
|
29
|
+
// 1. User configured directory
|
|
30
|
+
if (options.templates?.directory) {
|
|
31
|
+
const userTemplate = node_path_1.default.resolve(options.templates.directory, filename);
|
|
32
|
+
if (node_fs_1.default.existsSync(userTemplate)) {
|
|
33
|
+
logger.debug(`Using user template from configured directory: ${userTemplate}`);
|
|
34
|
+
return userTemplate;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
// 2. .storybook/design-system-docs override
|
|
38
|
+
const userOverridePath = node_path_1.default.resolve(process.cwd(), ".storybook", "design-system-docs", filename);
|
|
39
|
+
if (node_fs_1.default.existsSync(userOverridePath)) {
|
|
40
|
+
logger.debug(`Using user override template: ${userOverridePath}`);
|
|
41
|
+
return userOverridePath;
|
|
42
|
+
}
|
|
43
|
+
// 3. Built-in templates
|
|
44
|
+
// We try multiple potential locations to be robust across build/dev environments
|
|
45
|
+
const potentialPaths = [
|
|
46
|
+
node_path_1.default.resolve(__dirname, "../../templates", filename), // src structure (addon/util -> src/templates)
|
|
47
|
+
node_path_1.default.resolve(__dirname, "../templates", filename), // dist structure (dist/util -> dist/templates)
|
|
48
|
+
node_path_1.default.resolve(__dirname, "templates", filename), // fallback
|
|
49
|
+
];
|
|
50
|
+
for (const p of potentialPaths) {
|
|
51
|
+
if (node_fs_1.default.existsSync(p)) {
|
|
52
|
+
logger.debug(`Using built-in template: ${p}`);
|
|
53
|
+
return p;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
logger.warn(`Could not find template for section: ${sectionName} (checked ${filename})`);
|
|
57
|
+
// Fallback: return the first potential path even if it doesn't exist, to let the caller handle the error
|
|
58
|
+
return potentialPaths[0];
|
|
59
|
+
}
|
|
60
|
+
exports.resolveTemplate = resolveTemplate;
|
package/manager.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import './dist/manager';
|
package/package.json
ADDED
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "storybook-addon-design-system-docs",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Design System documentation that comes directly from your tailwind config.",
|
|
5
|
+
"author": "Saulo Vallory <https://saulo.engineer>",
|
|
6
|
+
"contributors": [
|
|
7
|
+
"Matan Yosef <https://github.com/matanio>"
|
|
8
|
+
],
|
|
9
|
+
"repository": {
|
|
10
|
+
"type": "git",
|
|
11
|
+
"url": "https://github.com/svallory/storybook-addon-design-system-docs"
|
|
12
|
+
},
|
|
13
|
+
"dependencies": {
|
|
14
|
+
"unplugin": "^1.12.0"
|
|
15
|
+
},
|
|
16
|
+
"devDependencies": {
|
|
17
|
+
"@biomejs/biome": "^2.3.11",
|
|
18
|
+
"@chromatic-com/storybook": "^4.1.3",
|
|
19
|
+
"@frontline-hq/recma-sections": "^1.0.8",
|
|
20
|
+
"@storybook/addon-a11y": "^10.1.11",
|
|
21
|
+
"@storybook/addon-docs": "^10.1.11",
|
|
22
|
+
"@storybook/addon-links": "^10.1.11",
|
|
23
|
+
"@storybook/addon-vitest": "^10.1.11",
|
|
24
|
+
"@storybook/mdx2-csf": "^1.1.0",
|
|
25
|
+
"@storybook/react-vite": "^10.1.11",
|
|
26
|
+
"@types/node": "^18.15.0",
|
|
27
|
+
"@types/react": "^18.2.65",
|
|
28
|
+
"@types/react-dom": "^18.2.21",
|
|
29
|
+
"@vitejs/plugin-react": "^4.2.1",
|
|
30
|
+
"@vitest/browser": "^2.1.9",
|
|
31
|
+
"@vitest/coverage-v8": "^2.1.9",
|
|
32
|
+
"auto": "^11.1.1",
|
|
33
|
+
"autoprefixer": "^10.4.23",
|
|
34
|
+
"boxen": "^7.1.1",
|
|
35
|
+
"dedent": "^1.5.1",
|
|
36
|
+
"nodemon": "^3.1.10",
|
|
37
|
+
"npm-run-all": "^4.1.5",
|
|
38
|
+
"playwright": "^1.57.0",
|
|
39
|
+
"postcss": "^8.5.6",
|
|
40
|
+
"prompts": "^2.4.2",
|
|
41
|
+
"react": "^18.2.0",
|
|
42
|
+
"react-dom": "^18.2.0",
|
|
43
|
+
"storybook": "^10.1.11",
|
|
44
|
+
"tailwindcss": "^3.0.0 || ^4.0.0",
|
|
45
|
+
"tsup": "^8.5.0",
|
|
46
|
+
"typescript": "^5.4.2",
|
|
47
|
+
"vite": "^5.4.21",
|
|
48
|
+
"vitest": "^2.1.9",
|
|
49
|
+
"zx": "^7.2.3"
|
|
50
|
+
},
|
|
51
|
+
"peerDependencies": {
|
|
52
|
+
"tailwindcss": "^3.0.0 || ^4.0.0",
|
|
53
|
+
"react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0",
|
|
54
|
+
"react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0"
|
|
55
|
+
},
|
|
56
|
+
"exports": {
|
|
57
|
+
".": {
|
|
58
|
+
"types": "./dist/index.d.ts",
|
|
59
|
+
"import": "./dist/index.js",
|
|
60
|
+
"require": "./dist/index.cjs"
|
|
61
|
+
},
|
|
62
|
+
"./preset": {
|
|
63
|
+
"types": "./dist/preset.d.ts",
|
|
64
|
+
"import": "./dist/preset.js",
|
|
65
|
+
"require": "./dist/preset.cjs"
|
|
66
|
+
},
|
|
67
|
+
"./manager": "./dist/manager.js",
|
|
68
|
+
"./components": {
|
|
69
|
+
"types": "./dist/components/primitives/index.d.ts",
|
|
70
|
+
"import": "./dist/components/primitives/index.js"
|
|
71
|
+
},
|
|
72
|
+
"./components/theme": {
|
|
73
|
+
"types": "./dist/components/primitives/index.d.ts",
|
|
74
|
+
"import": "./dist/components/primitives/index.js",
|
|
75
|
+
"require": "./dist/components/primitives/index.cjs"
|
|
76
|
+
},
|
|
77
|
+
"./components/assets": {
|
|
78
|
+
"types": "./dist/components/assets/index.d.ts",
|
|
79
|
+
"import": "./dist/components/assets/index.js",
|
|
80
|
+
"require": "./dist/components/assets/index.cjs"
|
|
81
|
+
},
|
|
82
|
+
"./assets": {
|
|
83
|
+
"types": "./dist/assets.d.ts",
|
|
84
|
+
"import": "./dist/assets.js",
|
|
85
|
+
"require": "./dist/assets.cjs"
|
|
86
|
+
},
|
|
87
|
+
"./mdx-templates/*": "./templates/*.mdx",
|
|
88
|
+
"./package.json": "./package.json"
|
|
89
|
+
},
|
|
90
|
+
"bundler": {
|
|
91
|
+
"exportEntries": [
|
|
92
|
+
"src/addon/index.ts",
|
|
93
|
+
"src/addon/assets.ts",
|
|
94
|
+
"src/addon/components/primitives/index.ts",
|
|
95
|
+
"src/addon/components/assets/index.ts"
|
|
96
|
+
],
|
|
97
|
+
"managerEntries": [
|
|
98
|
+
"src/addon/manager.tsx"
|
|
99
|
+
],
|
|
100
|
+
"nodeEntries": [
|
|
101
|
+
"src/addon/preset.ts"
|
|
102
|
+
]
|
|
103
|
+
},
|
|
104
|
+
"files": [
|
|
105
|
+
"dist/**/*",
|
|
106
|
+
"templates",
|
|
107
|
+
"README.md",
|
|
108
|
+
"*.js",
|
|
109
|
+
"*.d.ts"
|
|
110
|
+
],
|
|
111
|
+
"keywords": [
|
|
112
|
+
"tailwind",
|
|
113
|
+
"css",
|
|
114
|
+
"layout",
|
|
115
|
+
"appearance",
|
|
116
|
+
"style",
|
|
117
|
+
"design",
|
|
118
|
+
"system",
|
|
119
|
+
"auto",
|
|
120
|
+
"docs",
|
|
121
|
+
"storybook-addons"
|
|
122
|
+
],
|
|
123
|
+
"license": "MIT",
|
|
124
|
+
"overrides": {
|
|
125
|
+
"storybook": "$storybook"
|
|
126
|
+
},
|
|
127
|
+
"publishConfig": {
|
|
128
|
+
"access": "public"
|
|
129
|
+
},
|
|
130
|
+
"scripts": {
|
|
131
|
+
"build": "tsup",
|
|
132
|
+
"build:watch": "bun run build -- --watch",
|
|
133
|
+
"test": "vitest",
|
|
134
|
+
"lint": "biome check src",
|
|
135
|
+
"lint:fix": "biome check src --write",
|
|
136
|
+
"format": "biome format src --write",
|
|
137
|
+
"start": "bun run build && run-p build:watch storybook:rebuild",
|
|
138
|
+
"prerelease": "zx scripts/prepublish-checks.js",
|
|
139
|
+
"release": "bun run build && auto shipit",
|
|
140
|
+
"storybook:rebuild": "nodemon --watch dist --exec \"storybook dev -p 6006 --no-open\"",
|
|
141
|
+
"storybook": "storybook dev -p 6006",
|
|
142
|
+
"build-storybook": "storybook build"
|
|
143
|
+
},
|
|
144
|
+
"storybook": {
|
|
145
|
+
"displayName": "Design System Docs",
|
|
146
|
+
"supportedFrameworks": [
|
|
147
|
+
"react",
|
|
148
|
+
"vue"
|
|
149
|
+
],
|
|
150
|
+
"icon": "https://user-images.githubusercontent.com/321738/63501763-88dbf600-c4cc-11e9-96cd-94adadc2fd72.png"
|
|
151
|
+
},
|
|
152
|
+
"type": "module"
|
|
153
|
+
}
|
package/preset.js
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { createRequire } from 'module';
|
|
2
|
+
const require = createRequire(import.meta.url);
|
|
3
|
+
|
|
4
|
+
const preset = require('./dist/preset.cjs');
|
|
5
|
+
|
|
6
|
+
export const managerEntries = (entry = []) => {
|
|
7
|
+
return [...entry, require.resolve('./dist/manager.js')];
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
export const experimental_indexers = preset.experimental_indexers;
|
|
11
|
+
export const viteFinal = preset.viteFinal;
|
|
12
|
+
export const stories = preset.stories;
|
|
13
|
+
export const staticDirs = preset.staticDirs;
|
|
@@ -0,0 +1,233 @@
|
|
|
1
|
+
/** @type {import('tailwindcss').Config} */
|
|
2
|
+
export default {
|
|
3
|
+
content: ['./index.html', './src/**/*.{js,ts,jsx,tsx}'],
|
|
4
|
+
theme: {
|
|
5
|
+
// A comprehensive design system example
|
|
6
|
+
extend: {
|
|
7
|
+
colors: {
|
|
8
|
+
// Primary brand colors
|
|
9
|
+
primary: {
|
|
10
|
+
50: '#eff6ff',
|
|
11
|
+
100: '#dbeafe',
|
|
12
|
+
200: '#bfdbfe',
|
|
13
|
+
300: '#93c5fd',
|
|
14
|
+
400: '#60a5fa',
|
|
15
|
+
500: '#3b82f6',
|
|
16
|
+
600: '#2563eb',
|
|
17
|
+
700: '#1d4ed8',
|
|
18
|
+
800: '#1e40af',
|
|
19
|
+
900: '#1e3a8a',
|
|
20
|
+
950: '#172554',
|
|
21
|
+
},
|
|
22
|
+
// Secondary brand colors
|
|
23
|
+
secondary: {
|
|
24
|
+
50: '#f8fafc',
|
|
25
|
+
100: '#f1f5f9',
|
|
26
|
+
200: '#e2e8f0',
|
|
27
|
+
300: '#cbd5e1',
|
|
28
|
+
400: '#94a3b8',
|
|
29
|
+
500: '#64748b',
|
|
30
|
+
600: '#475569',
|
|
31
|
+
700: '#334155',
|
|
32
|
+
800: '#1e293b',
|
|
33
|
+
900: '#0f172a',
|
|
34
|
+
950: '#020617',
|
|
35
|
+
},
|
|
36
|
+
// Accent colors
|
|
37
|
+
accent: {
|
|
38
|
+
50: '#fefce8',
|
|
39
|
+
100: '#fef9c3',
|
|
40
|
+
200: '#fef08a',
|
|
41
|
+
300: '#fde047',
|
|
42
|
+
400: '#facc15',
|
|
43
|
+
500: '#eab308',
|
|
44
|
+
600: '#ca8a04',
|
|
45
|
+
700: '#a16207',
|
|
46
|
+
800: '#854d0e',
|
|
47
|
+
900: '#713f12',
|
|
48
|
+
950: '#422006',
|
|
49
|
+
},
|
|
50
|
+
// Semantic colors
|
|
51
|
+
success: {
|
|
52
|
+
50: '#f0fdf4',
|
|
53
|
+
100: '#dcfce7',
|
|
54
|
+
200: '#bbf7d0',
|
|
55
|
+
300: '#86efac',
|
|
56
|
+
400: '#4ade80',
|
|
57
|
+
500: '#22c55e',
|
|
58
|
+
600: '#16a34a',
|
|
59
|
+
700: '#15803d',
|
|
60
|
+
800: '#166534',
|
|
61
|
+
900: '#14532d',
|
|
62
|
+
950: '#052e16',
|
|
63
|
+
},
|
|
64
|
+
warning: {
|
|
65
|
+
50: '#fffbeb',
|
|
66
|
+
100: '#fef3c7',
|
|
67
|
+
200: '#fde68a',
|
|
68
|
+
300: '#fcd34d',
|
|
69
|
+
400: '#fbbf24',
|
|
70
|
+
500: '#f59e0b',
|
|
71
|
+
600: '#d97706',
|
|
72
|
+
700: '#b45309',
|
|
73
|
+
800: '#92400e',
|
|
74
|
+
900: '#78350f',
|
|
75
|
+
950: '#451a03',
|
|
76
|
+
},
|
|
77
|
+
error: {
|
|
78
|
+
50: '#fef2f2',
|
|
79
|
+
100: '#fee2e2',
|
|
80
|
+
200: '#fecaca',
|
|
81
|
+
300: '#fca5a5',
|
|
82
|
+
400: '#f87171',
|
|
83
|
+
500: '#ef4444',
|
|
84
|
+
600: '#dc2626',
|
|
85
|
+
700: '#b91c1c',
|
|
86
|
+
800: '#991b1b',
|
|
87
|
+
900: '#7f1d1d',
|
|
88
|
+
950: '#450a0a',
|
|
89
|
+
},
|
|
90
|
+
// Custom red-ish colors (kept from original)
|
|
91
|
+
'red-ish': {
|
|
92
|
+
100: '#ff0040',
|
|
93
|
+
200: '#f12000',
|
|
94
|
+
300: '#ff3202',
|
|
95
|
+
400: '#ff0220',
|
|
96
|
+
500: '#ff0120',
|
|
97
|
+
600: '#e0011a',
|
|
98
|
+
700: '#c00114',
|
|
99
|
+
800: '#a0000e',
|
|
100
|
+
900: '#800008',
|
|
101
|
+
},
|
|
102
|
+
},
|
|
103
|
+
fontSize: {
|
|
104
|
+
// Extra small sizes
|
|
105
|
+
xxs: '0.625rem', // 10px
|
|
106
|
+
xs: '0.75rem', // 12px
|
|
107
|
+
sm: '0.875rem', // 14px
|
|
108
|
+
base: '1rem', // 16px
|
|
109
|
+
lg: '1.125rem', // 18px
|
|
110
|
+
xl: '1.25rem', // 20px
|
|
111
|
+
// Large sizes
|
|
112
|
+
'2xl': '1.5rem', // 24px
|
|
113
|
+
'3xl': '1.875rem', // 30px
|
|
114
|
+
'4xl': '2.25rem', // 36px
|
|
115
|
+
'5xl': '3rem', // 48px
|
|
116
|
+
'6xl': '3.75rem', // 60px
|
|
117
|
+
'7xl': '4.5rem', // 72px
|
|
118
|
+
'8xl': '6rem', // 96px
|
|
119
|
+
'9xl': '8rem', // 128px
|
|
120
|
+
},
|
|
121
|
+
fontFamily: {
|
|
122
|
+
// Primary font families
|
|
123
|
+
sans: ['Inter', 'ui-sans-serif', 'system-ui', 'sans-serif'],
|
|
124
|
+
serif: ['ui-serif', 'Georgia', 'Cambria', 'Times New Roman', 'Times', 'serif'],
|
|
125
|
+
mono: ['ui-monospace', 'SFMono-Regular', 'Menlo', 'Monaco', 'Consolas', 'Liberation Mono', 'Courier New', 'monospace'],
|
|
126
|
+
|
|
127
|
+
// Custom font families
|
|
128
|
+
display: ['Inter', 'system-ui', 'sans-serif'],
|
|
129
|
+
code: ['SFMono-Regular', 'Menlo', 'monospace'],
|
|
130
|
+
},
|
|
131
|
+
fontWeight: {
|
|
132
|
+
thin: '100',
|
|
133
|
+
extralight: '200',
|
|
134
|
+
light: '300',
|
|
135
|
+
normal: '400',
|
|
136
|
+
medium: '500',
|
|
137
|
+
semibold: '600',
|
|
138
|
+
bold: '700',
|
|
139
|
+
extrabold: '800',
|
|
140
|
+
black: '900',
|
|
141
|
+
},
|
|
142
|
+
spacing: {
|
|
143
|
+
// 0.5 = 2px
|
|
144
|
+
0.5: '0.125rem',
|
|
145
|
+
// 1.5 = 6px
|
|
146
|
+
1.5: '0.375rem',
|
|
147
|
+
// 2.5 = 10px
|
|
148
|
+
2.5: '0.625rem',
|
|
149
|
+
// 3.5 = 14px
|
|
150
|
+
3.5: '0.875rem',
|
|
151
|
+
// 4.5 = 18px
|
|
152
|
+
4.5: '1.125rem',
|
|
153
|
+
// 5.5 = 22px
|
|
154
|
+
5.5: '1.375rem',
|
|
155
|
+
// 7 = 28px
|
|
156
|
+
7: '1.75rem',
|
|
157
|
+
// 9 = 36px
|
|
158
|
+
9: '2.25rem',
|
|
159
|
+
// 11 = 44px
|
|
160
|
+
11: '2.75rem',
|
|
161
|
+
// 12 = 48px
|
|
162
|
+
12: '3rem',
|
|
163
|
+
// 14 = 56px
|
|
164
|
+
14: '3.5rem',
|
|
165
|
+
// 16 = 64px
|
|
166
|
+
16: '4rem',
|
|
167
|
+
// 20 = 80px
|
|
168
|
+
20: '5rem',
|
|
169
|
+
// 24 = 96px
|
|
170
|
+
24: '6rem',
|
|
171
|
+
// 28 = 112px
|
|
172
|
+
28: '7rem',
|
|
173
|
+
// 32 = 128px
|
|
174
|
+
32: '8rem',
|
|
175
|
+
// 36 = 144px
|
|
176
|
+
36: '9rem',
|
|
177
|
+
// 40 = 160px
|
|
178
|
+
40: '10rem',
|
|
179
|
+
// 44 = 176px
|
|
180
|
+
44: '11rem',
|
|
181
|
+
// 48 = 192px
|
|
182
|
+
48: '12rem',
|
|
183
|
+
// 52 = 208px
|
|
184
|
+
52: '13rem',
|
|
185
|
+
// 56 = 224px
|
|
186
|
+
56: '14rem',
|
|
187
|
+
// 60 = 240px
|
|
188
|
+
60: '15rem',
|
|
189
|
+
// 64 = 256px
|
|
190
|
+
64: '16rem',
|
|
191
|
+
// 72 = 288px
|
|
192
|
+
72: '18rem',
|
|
193
|
+
// 80 = 320px
|
|
194
|
+
80: '20rem',
|
|
195
|
+
// 96 = 384px
|
|
196
|
+
96: '24rem',
|
|
197
|
+
},
|
|
198
|
+
boxShadow: {
|
|
199
|
+
// Custom shadows
|
|
200
|
+
'xs': '0 1px 2px 0 rgba(0, 0, 0, 0.05)',
|
|
201
|
+
'sm': '0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06)',
|
|
202
|
+
'md': '0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06)',
|
|
203
|
+
'lg': '0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05)',
|
|
204
|
+
'xl': '0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04)',
|
|
205
|
+
'2xl': '0 25px 50px -12px rgba(0, 0, 0, 0.25)',
|
|
206
|
+
'3xl': '0 35px 60px -15px rgba(0, 0, 0, 0.3)',
|
|
207
|
+
'inner': 'inset 0 2px 4px 0 rgba(0, 0, 0, 0.06)',
|
|
208
|
+
'none': 'none',
|
|
209
|
+
// Colored shadows
|
|
210
|
+
'primary': '0 4px 6px -1px rgba(59, 130, 246, 0.3), 0 2px 4px -1px rgba(59, 130, 246, 0.2)',
|
|
211
|
+
'accent': '0 4px 6px -1px rgba(234, 179, 8, 0.3), 0 2px 4px -1px rgba(234, 179, 8, 0.2)',
|
|
212
|
+
'success': '0 4px 6px -1px rgba(34, 197, 94, 0.3), 0 2px 4px -1px rgba(34, 197, 94, 0.2)',
|
|
213
|
+
'error': '0 4px 6px -1px rgba(239, 68, 68, 0.3), 0 2px 4px -1px rgba(239, 68, 68, 0.2)',
|
|
214
|
+
},
|
|
215
|
+
borderRadius: {
|
|
216
|
+
'none': '0px',
|
|
217
|
+
'sm': '0.125rem', // 2px
|
|
218
|
+
DEFAULT: '0.25rem', // 4px
|
|
219
|
+
'md': '0.375rem', // 6px
|
|
220
|
+
'lg': '0.5rem', // 8px
|
|
221
|
+
'xl': '0.75rem', // 12px
|
|
222
|
+
'2xl': '1rem', // 16px
|
|
223
|
+
'3xl': '1.5rem', // 24px
|
|
224
|
+
'full': '9999px',
|
|
225
|
+
// Custom sizes
|
|
226
|
+
'4xl': '2rem', // 32px
|
|
227
|
+
'5xl': '2.5rem', // 40px
|
|
228
|
+
'6xl': '3rem', // 48px
|
|
229
|
+
},
|
|
230
|
+
},
|
|
231
|
+
},
|
|
232
|
+
plugins: [],
|
|
233
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
{/**
|
|
2
|
+
* Asset Documentation Template
|
|
3
|
+
*
|
|
4
|
+
* This template is used to render asset documentation pages (Icons, Illustrations, etc.).
|
|
5
|
+
* The `assetGroup` import is automatically resolved to the specific asset group's data
|
|
6
|
+
* based on which virtual MDX file is being processed.
|
|
7
|
+
*
|
|
8
|
+
* Users can override this template by creating:
|
|
9
|
+
* .storybook/design-system-docs/assets.mdx
|
|
10
|
+
*
|
|
11
|
+
* The <Meta title="..." /> tag is injected automatically by the unplugin.
|
|
12
|
+
*/}
|
|
13
|
+
|
|
14
|
+
import { Meta } from "@storybook/addon-docs/blocks";
|
|
15
|
+
import { AssetSection } from 'storybook-addon-design-system-docs/components/assets';
|
|
16
|
+
import assetGroup from 'design-system-docs:assets/{{group.name}}';
|
|
17
|
+
|
|
18
|
+
<Meta title="Assets/{{group.name}}" />
|
|
19
|
+
|
|
20
|
+
<AssetSection
|
|
21
|
+
title="{{group.title}}"
|
|
22
|
+
description={assetGroup.config.description}
|
|
23
|
+
assets={assetGroup.assets}
|
|
24
|
+
groupByFolder={assetGroup.config.groupByFolder}
|
|
25
|
+
variants={assetGroup.config.variants}
|
|
26
|
+
copy={assetGroup.config.copy}
|
|
27
|
+
display={assetGroup.config.display}
|
|
28
|
+
storageKeyPrefix={`assets-{{group.name}}`}
|
|
29
|
+
/>
|