czero 0.1.0 → 0.2.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.
Files changed (114) hide show
  1. package/README.md +40 -0
  2. package/dist/cli/index.js +3780 -28
  3. package/dist/cli-new/cli/build-css.d.ts +19 -0
  4. package/dist/cli-new/cli/build-css.js +88 -0
  5. package/dist/cli-new/cli/generators/button.d.ts +9 -0
  6. package/dist/cli-new/cli/generators/button.js +224 -0
  7. package/dist/cli-new/cli/generators/card.d.ts +9 -0
  8. package/dist/cli-new/cli/generators/card.js +104 -0
  9. package/dist/cli-new/cli/generators/checkbox.d.ts +6 -0
  10. package/dist/cli-new/cli/generators/checkbox.js +163 -0
  11. package/dist/cli-new/cli/generators/index.d.ts +10 -0
  12. package/dist/cli-new/cli/generators/index.js +40 -0
  13. package/dist/cli-new/cli/generators/input.d.ts +9 -0
  14. package/dist/cli-new/cli/generators/input.js +231 -0
  15. package/dist/cli-new/cli/generators/switch.d.ts +6 -0
  16. package/dist/cli-new/cli/generators/switch.js +156 -0
  17. package/dist/cli-new/cli/generators/utilities.d.ts +9 -0
  18. package/dist/cli-new/cli/generators/utilities.js +150 -0
  19. package/dist/cli-new/cli/index.d.ts +8 -0
  20. package/dist/cli-new/cli/index.js +288 -0
  21. package/dist/cli-new/cli/token-resolver.d.ts +44 -0
  22. package/dist/cli-new/cli/token-resolver.js +137 -0
  23. package/dist/cli-new/cli/utils/deep-merge.d.ts +15 -0
  24. package/dist/cli-new/cli/utils/deep-merge.js +41 -0
  25. package/dist/cli-new/cli/validate-config.d.ts +19 -0
  26. package/dist/cli-new/cli/validate-config.js +151 -0
  27. package/dist/cli-new/src/core/component-defaults.d.ts +7 -0
  28. package/dist/cli-new/src/core/component-defaults.js +467 -0
  29. package/dist/cli-new/src/core/types/config.d.ts +489 -0
  30. package/dist/cli-new/src/core/types/config.js +5 -0
  31. package/dist/cli-new/src/presets/index.d.ts +44 -0
  32. package/dist/cli-new/src/presets/index.js +194 -0
  33. package/dist/components.css +1579 -2
  34. package/dist/react/core/component-defaults.d.ts +8 -0
  35. package/dist/react/core/component-defaults.d.ts.map +1 -0
  36. package/dist/react/core/types/config.d.ts +490 -0
  37. package/dist/react/core/types/config.d.ts.map +1 -0
  38. package/dist/react/index.cjs +11577 -17
  39. package/dist/react/index.cjs.map +1 -1
  40. package/dist/react/index.d.ts +407 -4
  41. package/dist/react/index.js +11532 -6
  42. package/dist/react/index.js.map +1 -1
  43. package/dist/react/presets/index.d.ts +45 -0
  44. package/dist/react/presets/index.d.ts.map +1 -0
  45. package/dist/react/react/components/accordion.d.ts +30 -0
  46. package/dist/react/react/components/accordion.d.ts.map +1 -0
  47. package/dist/react/react/components/alert.d.ts +7 -0
  48. package/dist/react/react/components/alert.d.ts.map +1 -0
  49. package/dist/react/react/components/aspect-ratio.d.ts +8 -0
  50. package/dist/react/react/components/aspect-ratio.d.ts.map +1 -0
  51. package/dist/react/react/components/avatar.d.ts +10 -0
  52. package/dist/react/react/components/avatar.d.ts.map +1 -0
  53. package/dist/react/react/components/breadcrumb.d.ts +28 -0
  54. package/dist/react/react/components/breadcrumb.d.ts.map +1 -0
  55. package/dist/react/react/components/button.d.ts +3 -2
  56. package/dist/react/react/components/button.d.ts.map +1 -1
  57. package/dist/react/react/components/checkbox.d.ts +9 -0
  58. package/dist/react/react/components/checkbox.d.ts.map +1 -0
  59. package/dist/react/react/components/code.d.ts +6 -0
  60. package/dist/react/react/components/code.d.ts.map +1 -0
  61. package/dist/react/react/components/container.d.ts +8 -0
  62. package/dist/react/react/components/container.d.ts.map +1 -0
  63. package/dist/react/react/components/dialog.d.ts +28 -0
  64. package/dist/react/react/components/dialog.d.ts.map +1 -0
  65. package/dist/react/react/components/dropdown-menu.d.ts +32 -0
  66. package/dist/react/react/components/dropdown-menu.d.ts.map +1 -0
  67. package/dist/react/react/components/grid.d.ts +8 -0
  68. package/dist/react/react/components/grid.d.ts.map +1 -0
  69. package/dist/react/react/components/input.d.ts +4 -0
  70. package/dist/react/react/components/input.d.ts.map +1 -1
  71. package/dist/react/react/components/kbd.d.ts +6 -0
  72. package/dist/react/react/components/kbd.d.ts.map +1 -0
  73. package/dist/react/react/components/label.d.ts +7 -0
  74. package/dist/react/react/components/label.d.ts.map +1 -0
  75. package/dist/react/react/components/progress.d.ts +10 -0
  76. package/dist/react/react/components/progress.d.ts.map +1 -0
  77. package/dist/react/react/components/radio-group.d.ts +15 -0
  78. package/dist/react/react/components/radio-group.d.ts.map +1 -0
  79. package/dist/react/react/components/scroll-area.d.ts +8 -0
  80. package/dist/react/react/components/scroll-area.d.ts.map +1 -0
  81. package/dist/react/react/components/select.d.ts +29 -0
  82. package/dist/react/react/components/select.d.ts.map +1 -0
  83. package/dist/react/react/components/separator.d.ts +8 -0
  84. package/dist/react/react/components/separator.d.ts.map +1 -0
  85. package/dist/react/react/components/skeleton.d.ts +8 -0
  86. package/dist/react/react/components/skeleton.d.ts.map +1 -0
  87. package/dist/react/react/components/spinner.d.ts +7 -0
  88. package/dist/react/react/components/spinner.d.ts.map +1 -0
  89. package/dist/react/react/components/stack.d.ts +11 -0
  90. package/dist/react/react/components/stack.d.ts.map +1 -0
  91. package/dist/react/react/components/switch.d.ts +10 -0
  92. package/dist/react/react/components/switch.d.ts.map +1 -0
  93. package/dist/react/react/components/table.d.ts +27 -0
  94. package/dist/react/react/components/table.d.ts.map +1 -0
  95. package/dist/react/react/components/tabs.d.ts +21 -0
  96. package/dist/react/react/components/tabs.d.ts.map +1 -0
  97. package/dist/react/react/components/tag.d.ts +10 -0
  98. package/dist/react/react/components/tag.d.ts.map +1 -0
  99. package/dist/react/react/components/textarea.d.ts +11 -0
  100. package/dist/react/react/components/textarea.d.ts.map +1 -0
  101. package/dist/react/react/components/toast.d.ts +28 -0
  102. package/dist/react/react/components/toast.d.ts.map +1 -0
  103. package/dist/react/react/components/tooltip.d.ts +16 -0
  104. package/dist/react/react/components/tooltip.d.ts.map +1 -0
  105. package/dist/react/react/components/visually-hidden.d.ts +7 -0
  106. package/dist/react/react/components/visually-hidden.d.ts.map +1 -0
  107. package/dist/react/react/hooks/index.d.ts +5 -0
  108. package/dist/react/react/hooks/index.d.ts.map +1 -0
  109. package/dist/react/react/hooks/use-theme.d.ts +17 -0
  110. package/dist/react/react/hooks/use-theme.d.ts.map +1 -0
  111. package/dist/react/react/index.d.ts +30 -0
  112. package/dist/react/react/index.d.ts.map +1 -1
  113. package/dist/styles.css +1579 -2
  114. package/package.json +35 -4
@@ -0,0 +1,19 @@
1
+ /**
2
+ * CZero CSS Builder
3
+ * Builds complete CSS from config using component generators
4
+ */
5
+ import type { CZeroConfig } from "../src/core/types/config";
6
+ /**
7
+ * Build complete component CSS from config
8
+ * Merges user config with defaults and generates CSS for each component
9
+ */
10
+ export declare function buildComponentsCSS(config: CZeroConfig): string;
11
+ /**
12
+ * Get legacy components CSS from file
13
+ * Used for components that haven't been migrated to the new generator system
14
+ */
15
+ export declare function getLegacyComponentsCSS(componentsPath: string, excludeComponents?: string[]): string;
16
+ /**
17
+ * Validate config structure
18
+ */
19
+ export declare function validateConfig(config: unknown): CZeroConfig;
@@ -0,0 +1,88 @@
1
+ /**
2
+ * CZero CSS Builder
3
+ * Builds complete CSS from config using component generators
4
+ */
5
+ import { componentDefaults } from "../src/core/component-defaults";
6
+ import { deepMerge } from "./utils/deep-merge";
7
+ import { generateButtonCSS, generateInputCSS, generateCardCSS, generateSwitchCSS, generateCheckboxCSS, } from "./generators";
8
+ /**
9
+ * Build complete component CSS from config
10
+ * Merges user config with defaults and generates CSS for each component
11
+ */
12
+ export function buildComponentsCSS(config) {
13
+ // Merge user component config with defaults
14
+ const components = deepMerge(componentDefaults, config.components || {});
15
+ let css = "";
16
+ // Add before custom CSS
17
+ if (config.customCSS?.before) {
18
+ css += `/* Custom CSS (before) */\n${config.customCSS.before}\n\n`;
19
+ }
20
+ // Generate CSS for each component
21
+ // Only generating for the 5 implemented components for now
22
+ if (components.button) {
23
+ css += generateButtonCSS(components.button);
24
+ css += "\n";
25
+ }
26
+ if (components.input) {
27
+ css += generateInputCSS(components.input);
28
+ css += "\n";
29
+ }
30
+ if (components.card) {
31
+ css += generateCardCSS(components.card);
32
+ css += "\n";
33
+ }
34
+ if (components.switch) {
35
+ css += generateSwitchCSS(components.switch);
36
+ css += "\n";
37
+ }
38
+ if (components.checkbox) {
39
+ css += generateCheckboxCSS(components.checkbox);
40
+ css += "\n";
41
+ }
42
+ // Add after custom CSS
43
+ if (config.customCSS?.after) {
44
+ css += `/* Custom CSS (after) */\n${config.customCSS.after}\n`;
45
+ }
46
+ return css;
47
+ }
48
+ /**
49
+ * Get legacy components CSS from file
50
+ * Used for components that haven't been migrated to the new generator system
51
+ */
52
+ export function getLegacyComponentsCSS(componentsPath, excludeComponents = ["button", "input", "card", "switch", "checkbox"]) {
53
+ // For now, we read the entire file
54
+ // In the future, we could parse and exclude specific sections
55
+ // This is a migration helper
56
+ const fs = require("fs");
57
+ if (!fs.existsSync(componentsPath)) {
58
+ return "";
59
+ }
60
+ let css = fs.readFileSync(componentsPath, "utf-8");
61
+ // Remove sections for components that are now generated
62
+ // This is a simple approach - in production you'd want more robust parsing
63
+ for (const component of excludeComponents) {
64
+ // Remove the component section from the CSS
65
+ // Looking for patterns like /* ===== BUTTON ===== */ to the next /* ===== */ or end
66
+ const sectionRegex = new RegExp(`\\/\\*\\s*=====\\s*${component.toUpperCase()}\\s*=====\\s*\\*\\/[\\s\\S]*?(?=\\/\\*\\s*=====|$)`, "gi");
67
+ css = css.replace(sectionRegex, "");
68
+ }
69
+ return css;
70
+ }
71
+ /**
72
+ * Validate config structure
73
+ */
74
+ export function validateConfig(config) {
75
+ if (typeof config !== "object" || config === null) {
76
+ return {};
77
+ }
78
+ // Basic validation - in production you'd want more robust checking
79
+ const validConfig = config;
80
+ // Warn about unknown top-level keys
81
+ const validKeys = ["color", "radius", "shadow", "spacing", "typography", "transition", "breakpoints", "components", "customCSS"];
82
+ for (const key of Object.keys(validConfig)) {
83
+ if (!validKeys.includes(key)) {
84
+ console.warn(`⚠️ Unknown config key: "${key}"`);
85
+ }
86
+ }
87
+ return validConfig;
88
+ }
@@ -0,0 +1,9 @@
1
+ /**
2
+ * CZero Button CSS Generator
3
+ * Generates CSS for button component from config tokens
4
+ */
5
+ import type { ButtonTokens } from "../../src/core/types/config";
6
+ /**
7
+ * Generate all button CSS including variables, base styles, sizes, variants, and states
8
+ */
9
+ export declare function generateButtonCSS(config: ButtonTokens): string;
@@ -0,0 +1,224 @@
1
+ /**
2
+ * CZero Button CSS Generator
3
+ * Generates CSS for button component from config tokens
4
+ */
5
+ import { resolveToken, componentVarName } from "../token-resolver";
6
+ /**
7
+ * Generate all button CSS including variables, base styles, sizes, variants, and states
8
+ */
9
+ export function generateButtonCSS(config) {
10
+ let css = "";
11
+ css += "/* ===== BUTTON ===== */\n\n";
12
+ // Generate CSS variables
13
+ css += generateButtonVariables(config);
14
+ css += "\n";
15
+ // Generate base styles
16
+ css += generateButtonBase();
17
+ css += "\n";
18
+ // Generate size variants
19
+ css += generateButtonSizes(config);
20
+ css += "\n";
21
+ // Generate color variants
22
+ if (config.variants) {
23
+ css += generateButtonVariants(config.variants);
24
+ css += "\n";
25
+ }
26
+ // Generate icon button styles
27
+ css += generateButtonIcon(config);
28
+ css += "\n";
29
+ // Generate loading state styles
30
+ css += generateButtonLoading(config);
31
+ css += "\n";
32
+ // Append custom CSS
33
+ if (config.customCSS) {
34
+ css += `/* Custom Button CSS */\n${config.customCSS}\n`;
35
+ }
36
+ return css;
37
+ }
38
+ /**
39
+ * Generate CSS variables for button component
40
+ */
41
+ function generateButtonVariables(config) {
42
+ const vars = [];
43
+ // Size-based variables
44
+ if (config.height) {
45
+ for (const [size, value] of Object.entries(config.height)) {
46
+ vars.push(` ${componentVarName("button", "height", size)}: ${resolveToken(value)};`);
47
+ }
48
+ }
49
+ if (config.paddingX) {
50
+ for (const [size, value] of Object.entries(config.paddingX)) {
51
+ vars.push(` ${componentVarName("button", "paddingX", size)}: ${resolveToken(value)};`);
52
+ }
53
+ }
54
+ if (config.fontSize && typeof config.fontSize === "object") {
55
+ for (const [size, value] of Object.entries(config.fontSize)) {
56
+ vars.push(` ${componentVarName("button", "fontSize", size)}: ${resolveToken(value)};`);
57
+ }
58
+ }
59
+ if (config.iconSize) {
60
+ for (const [size, value] of Object.entries(config.iconSize)) {
61
+ vars.push(` ${componentVarName("button", "iconSize", size)}: ${resolveToken(value)};`);
62
+ }
63
+ }
64
+ // Single-value variables
65
+ if (config.gap) {
66
+ vars.push(` ${componentVarName("button", "gap")}: ${resolveToken(config.gap)};`);
67
+ }
68
+ if (config.fontWeight) {
69
+ vars.push(` ${componentVarName("button", "fontWeight")}: ${resolveToken(config.fontWeight)};`);
70
+ }
71
+ if (config.borderRadius) {
72
+ vars.push(` ${componentVarName("button", "borderRadius")}: ${resolveToken(config.borderRadius)};`);
73
+ }
74
+ if (config.borderWidth) {
75
+ vars.push(` ${componentVarName("button", "borderWidth")}: ${resolveToken(config.borderWidth)};`);
76
+ }
77
+ if (config.transition) {
78
+ vars.push(` ${componentVarName("button", "transition")}: ${resolveToken(config.transition)};`);
79
+ }
80
+ // State variables
81
+ if (config.states?.hover?.opacity) {
82
+ vars.push(` ${componentVarName("button", "hoverOpacity")}: ${config.states.hover.opacity};`);
83
+ }
84
+ if (config.states?.focus?.ringWidth) {
85
+ vars.push(` ${componentVarName("button", "focusRingWidth")}: ${config.states.focus.ringWidth};`);
86
+ }
87
+ if (config.states?.focus?.ringOffset) {
88
+ vars.push(` ${componentVarName("button", "focusRingOffset")}: ${config.states.focus.ringOffset};`);
89
+ }
90
+ if (config.states?.focus?.ringColor) {
91
+ vars.push(` ${componentVarName("button", "focusRingColor")}: ${resolveToken(config.states.focus.ringColor)};`);
92
+ }
93
+ if (config.states?.disabled?.opacity) {
94
+ vars.push(` ${componentVarName("button", "disabledOpacity")}: ${config.states.disabled.opacity};`);
95
+ }
96
+ // Animation variables
97
+ if (config.animations?.loading?.duration) {
98
+ vars.push(` ${componentVarName("button", "loadingDuration")}: ${config.animations.loading.duration};`);
99
+ }
100
+ if (config.animations?.loading?.timing) {
101
+ vars.push(` ${componentVarName("button", "loadingTiming")}: ${config.animations.loading.timing};`);
102
+ }
103
+ // Variant variables
104
+ if (config.variants) {
105
+ for (const [name, variant] of Object.entries(config.variants)) {
106
+ if (variant.bg) {
107
+ vars.push(` --cz-btn-${name}-bg: ${resolveToken(variant.bg)};`);
108
+ }
109
+ if (variant.color) {
110
+ vars.push(` --cz-btn-${name}-color: ${resolveToken(variant.color)};`);
111
+ }
112
+ if (variant.borderColor) {
113
+ vars.push(` --cz-btn-${name}-border-color: ${resolveToken(variant.borderColor)};`);
114
+ }
115
+ }
116
+ }
117
+ return `:root {\n${vars.join("\n")}\n}\n`;
118
+ }
119
+ /**
120
+ * Generate base button styles
121
+ */
122
+ function generateButtonBase() {
123
+ return `.cz-btn {
124
+ display: inline-flex;
125
+ align-items: center;
126
+ justify-content: center;
127
+ gap: var(--cz-btn-gap);
128
+ border-radius: var(--cz-btn-border-radius);
129
+ font-weight: var(--cz-btn-font-weight);
130
+ transition: all var(--cz-btn-transition);
131
+ cursor: pointer;
132
+ border: var(--cz-btn-border-width) solid transparent;
133
+ }
134
+
135
+ .cz-btn:focus-visible {
136
+ outline: none;
137
+ box-shadow: 0 0 0 var(--cz-btn-focus-ring-offset) hsl(var(--cz-color-bg)),
138
+ 0 0 0 calc(var(--cz-btn-focus-ring-offset) + var(--cz-btn-focus-ring-width)) var(--cz-btn-focus-ring-color);
139
+ }
140
+
141
+ .cz-btn:disabled {
142
+ pointer-events: none;
143
+ opacity: var(--cz-btn-disabled-opacity);
144
+ }
145
+ `;
146
+ }
147
+ /**
148
+ * Generate button size variants
149
+ */
150
+ function generateButtonSizes(config) {
151
+ const sizes = ["sm", "md", "lg"];
152
+ let css = "/* Button Sizes */\n";
153
+ for (const size of sizes) {
154
+ css += `.cz-btn-${size} {
155
+ height: var(--cz-btn-height-${size});
156
+ padding: 0 var(--cz-btn-padding-x-${size});
157
+ font-size: var(--cz-btn-font-size-${size});
158
+ }\n`;
159
+ }
160
+ return css;
161
+ }
162
+ /**
163
+ * Generate button color variants
164
+ */
165
+ function generateButtonVariants(variants) {
166
+ let css = "/* Button Variants */\n";
167
+ for (const [name, variant] of Object.entries(variants)) {
168
+ // Base variant styles
169
+ css += `.cz-btn-${name} {\n`;
170
+ css += ` background: var(--cz-btn-${name}-bg);\n`;
171
+ css += ` color: var(--cz-btn-${name}-color);\n`;
172
+ if (variant.borderColor && variant.borderColor !== "transparent") {
173
+ css += ` border-color: var(--cz-btn-${name}-border-color);\n`;
174
+ }
175
+ if (variant.textDecoration) {
176
+ css += ` text-decoration: ${variant.textDecoration};\n`;
177
+ css += ` text-underline-offset: 4px;\n`;
178
+ }
179
+ css += `}\n`;
180
+ // Hover styles
181
+ if (variant.hover) {
182
+ css += `.cz-btn-${name}:hover {\n`;
183
+ if (variant.hover.opacity) {
184
+ css += ` opacity: ${variant.hover.opacity};\n`;
185
+ }
186
+ if (variant.hover.bg) {
187
+ css += ` background: ${resolveToken(variant.hover.bg)};\n`;
188
+ }
189
+ if (variant.textDecoration) {
190
+ css += ` text-decoration-thickness: 2px;\n`;
191
+ }
192
+ css += `}\n`;
193
+ }
194
+ }
195
+ return css;
196
+ }
197
+ /**
198
+ * Generate icon button styles
199
+ */
200
+ function generateButtonIcon(config) {
201
+ return `/* Button Icon Size */
202
+ .cz-btn-icon {
203
+ padding: 0;
204
+ }
205
+ .cz-btn-icon.cz-btn-sm { width: var(--cz-btn-icon-size-sm); height: var(--cz-btn-icon-size-sm); }
206
+ .cz-btn-icon.cz-btn-md { width: var(--cz-btn-icon-size-md); height: var(--cz-btn-icon-size-md); }
207
+ .cz-btn-icon.cz-btn-lg { width: var(--cz-btn-icon-size-lg); height: var(--cz-btn-icon-size-lg); }
208
+ `;
209
+ }
210
+ /**
211
+ * Generate loading button styles
212
+ */
213
+ function generateButtonLoading(config) {
214
+ return `/* Button Loading State */
215
+ .cz-btn-loading { position: relative; }
216
+ .cz-btn-spinner {
217
+ width: 1rem;
218
+ height: 1rem;
219
+ animation: cz-spin var(--cz-btn-loading-duration) var(--cz-btn-loading-timing) infinite;
220
+ flex-shrink: 0;
221
+ }
222
+ .cz-btn-content { opacity: 1; }
223
+ `;
224
+ }
@@ -0,0 +1,9 @@
1
+ /**
2
+ * CZero Card CSS Generator
3
+ * Generates CSS for card component from config tokens
4
+ */
5
+ import type { CardTokens } from "../../src/core/types/config";
6
+ /**
7
+ * Generate all card CSS including variables and styles
8
+ */
9
+ export declare function generateCardCSS(config: CardTokens): string;
@@ -0,0 +1,104 @@
1
+ /**
2
+ * CZero Card CSS Generator
3
+ * Generates CSS for card component from config tokens
4
+ */
5
+ import { resolveToken } from "../token-resolver";
6
+ /**
7
+ * Generate all card CSS including variables and styles
8
+ */
9
+ export function generateCardCSS(config) {
10
+ let css = "";
11
+ css += "/* ===== CARD ===== */\n\n";
12
+ css += generateCardVariables(config);
13
+ css += "\n";
14
+ css += generateCardBase();
15
+ css += "\n";
16
+ if (config.customCSS) {
17
+ css += `/* Custom Card CSS */\n${config.customCSS}\n`;
18
+ }
19
+ return css;
20
+ }
21
+ function generateCardVariables(config) {
22
+ const vars = [];
23
+ if (config.padding)
24
+ vars.push(` --cz-card-padding: ${resolveToken(config.padding)};`);
25
+ if (config.borderRadius)
26
+ vars.push(` --cz-card-border-radius: ${resolveToken(config.borderRadius)};`);
27
+ if (config.borderWidth)
28
+ vars.push(` --cz-card-border-width: ${resolveToken(config.borderWidth)};`);
29
+ if (config.borderColor)
30
+ vars.push(` --cz-card-border-color: ${resolveToken(config.borderColor)};`);
31
+ if (config.bg)
32
+ vars.push(` --cz-card-bg: ${resolveToken(config.bg)};`);
33
+ if (config.shadow)
34
+ vars.push(` --cz-card-shadow: ${resolveToken(config.shadow)};`);
35
+ // Header
36
+ if (config.header?.paddingBottom)
37
+ vars.push(` --cz-card-header-padding-bottom: ${resolveToken(config.header.paddingBottom)};`);
38
+ if (config.header?.marginBottom)
39
+ vars.push(` --cz-card-header-margin-bottom: ${resolveToken(config.header.marginBottom)};`);
40
+ // Title
41
+ if (config.title?.fontSize)
42
+ vars.push(` --cz-card-title-font-size: ${resolveToken(config.title.fontSize)};`);
43
+ if (config.title?.fontWeight)
44
+ vars.push(` --cz-card-title-font-weight: ${resolveToken(config.title.fontWeight)};`);
45
+ if (config.title?.color)
46
+ vars.push(` --cz-card-title-color: ${resolveToken(config.title.color)};`);
47
+ // Description
48
+ if (config.description?.fontSize)
49
+ vars.push(` --cz-card-description-font-size: ${resolveToken(config.description.fontSize)};`);
50
+ if (config.description?.color)
51
+ vars.push(` --cz-card-description-color: ${resolveToken(config.description.color)};`);
52
+ // Footer
53
+ if (config.footer?.paddingTop)
54
+ vars.push(` --cz-card-footer-padding-top: ${resolveToken(config.footer.paddingTop)};`);
55
+ if (config.footer?.marginTop)
56
+ vars.push(` --cz-card-footer-margin-top: ${resolveToken(config.footer.marginTop)};`);
57
+ if (config.footer?.gap)
58
+ vars.push(` --cz-card-footer-gap: ${config.footer.gap};`);
59
+ return `:root {\n${vars.join("\n")}\n}\n`;
60
+ }
61
+ function generateCardBase() {
62
+ return `.cz-card {
63
+ border-radius: var(--cz-card-border-radius);
64
+ border: var(--cz-card-border-width) solid var(--cz-card-border-color);
65
+ background-color: var(--cz-card-bg);
66
+ box-shadow: var(--cz-card-shadow);
67
+ padding: var(--cz-card-padding);
68
+ }
69
+
70
+ .cz-card-no-padding { padding: 0; }
71
+
72
+ .cz-card-header {
73
+ display: flex;
74
+ flex-direction: column;
75
+ gap: 0.375rem;
76
+ padding-bottom: var(--cz-card-header-padding-bottom);
77
+ border-bottom: var(--cz-card-border-width) solid var(--cz-card-border-color);
78
+ margin-bottom: var(--cz-card-header-margin-bottom);
79
+ }
80
+
81
+ .cz-card-title {
82
+ font-size: var(--cz-card-title-font-size);
83
+ font-weight: var(--cz-card-title-font-weight);
84
+ color: var(--cz-card-title-color);
85
+ line-height: var(--cz-font-lineHeight-tight);
86
+ }
87
+
88
+ .cz-card-description {
89
+ font-size: var(--cz-card-description-font-size);
90
+ color: var(--cz-card-description-color);
91
+ }
92
+
93
+ .cz-card-body { color: var(--cz-card-title-color); }
94
+
95
+ .cz-card-footer {
96
+ display: flex;
97
+ align-items: center;
98
+ gap: var(--cz-card-footer-gap);
99
+ padding-top: var(--cz-card-footer-padding-top);
100
+ margin-top: var(--cz-card-footer-margin-top);
101
+ border-top: var(--cz-card-border-width) solid var(--cz-card-border-color);
102
+ }
103
+ `;
104
+ }
@@ -0,0 +1,6 @@
1
+ /**
2
+ * CZero Checkbox CSS Generator
3
+ * Generates CSS for checkbox component from config tokens
4
+ */
5
+ import type { CheckboxTokens } from "../../src/core/types/config";
6
+ export declare function generateCheckboxCSS(config: CheckboxTokens): string;
@@ -0,0 +1,163 @@
1
+ /**
2
+ * CZero Checkbox CSS Generator
3
+ * Generates CSS for checkbox component from config tokens
4
+ */
5
+ import { resolveToken } from "../token-resolver";
6
+ export function generateCheckboxCSS(config) {
7
+ let css = "";
8
+ css += "/* ===== CHECKBOX ===== */\n\n";
9
+ css += generateCheckboxVariables(config);
10
+ css += "\n";
11
+ css += generateCheckboxBase();
12
+ css += "\n";
13
+ css += generateCheckboxSizes(config);
14
+ css += "\n";
15
+ css += generateCheckboxDescription();
16
+ css += "\n";
17
+ if (config.customCSS) {
18
+ css += `/* Custom Checkbox CSS */\n${config.customCSS}\n`;
19
+ }
20
+ return css;
21
+ }
22
+ function generateCheckboxVariables(config) {
23
+ const vars = [];
24
+ // Size variants
25
+ if (config.size) {
26
+ for (const [size, value] of Object.entries(config.size)) {
27
+ vars.push(` --cz-checkbox-size-${size}: ${resolveToken(value)};`);
28
+ }
29
+ }
30
+ if (config.iconSize) {
31
+ for (const [size, value] of Object.entries(config.iconSize)) {
32
+ vars.push(` --cz-checkbox-icon-size-${size}: ${value};`);
33
+ }
34
+ }
35
+ // Single values
36
+ if (config.borderRadius)
37
+ vars.push(` --cz-checkbox-border-radius: ${resolveToken(config.borderRadius)};`);
38
+ if (config.borderWidth)
39
+ vars.push(` --cz-checkbox-border-width: ${config.borderWidth};`);
40
+ if (config.borderColor)
41
+ vars.push(` --cz-checkbox-border-color: ${resolveToken(config.borderColor)};`);
42
+ if (config.bg)
43
+ vars.push(` --cz-checkbox-bg: ${resolveToken(config.bg)};`);
44
+ if (config.checkedBg)
45
+ vars.push(` --cz-checkbox-checked-bg: ${resolveToken(config.checkedBg)};`);
46
+ if (config.checkedBorderColor)
47
+ vars.push(` --cz-checkbox-checked-border-color: ${resolveToken(config.checkedBorderColor)};`);
48
+ if (config.indicatorColor)
49
+ vars.push(` --cz-checkbox-indicator-color: ${resolveToken(config.indicatorColor)};`);
50
+ if (config.labelFontSize)
51
+ vars.push(` --cz-checkbox-label-font-size: ${resolveToken(config.labelFontSize)};`);
52
+ if (config.labelGap)
53
+ vars.push(` --cz-checkbox-label-gap: ${config.labelGap};`);
54
+ // States
55
+ if (config.states?.hover?.borderColor)
56
+ vars.push(` --cz-checkbox-hover-border-color: ${resolveToken(config.states.hover.borderColor)};`);
57
+ if (config.states?.focus?.ringWidth)
58
+ vars.push(` --cz-checkbox-focus-ring-width: ${config.states.focus.ringWidth};`);
59
+ if (config.states?.focus?.ringColor)
60
+ vars.push(` --cz-checkbox-focus-ring-color: ${resolveToken(config.states.focus.ringColor)};`);
61
+ if (config.states?.disabled?.opacity)
62
+ vars.push(` --cz-checkbox-disabled-opacity: ${config.states.disabled.opacity};`);
63
+ return `:root {\n${vars.join("\n")}\n}\n`;
64
+ }
65
+ function generateCheckboxBase() {
66
+ return `.cz-checkbox-wrapper {
67
+ display: inline-flex;
68
+ align-items: center;
69
+ gap: var(--cz-checkbox-label-gap);
70
+ cursor: pointer;
71
+ user-select: none;
72
+ }
73
+
74
+ .cz-checkbox-wrapper.cz-disabled {
75
+ cursor: not-allowed;
76
+ opacity: var(--cz-checkbox-disabled-opacity);
77
+ }
78
+
79
+ .cz-checkbox {
80
+ all: unset;
81
+ box-sizing: border-box;
82
+ display: inline-flex;
83
+ align-items: center;
84
+ justify-content: center;
85
+ border-radius: var(--cz-checkbox-border-radius);
86
+ border: var(--cz-checkbox-border-width) solid var(--cz-checkbox-border-color);
87
+ background-color: var(--cz-checkbox-bg);
88
+ transition: all var(--cz-transition-fast);
89
+ flex-shrink: 0;
90
+ cursor: pointer;
91
+ }
92
+
93
+ .cz-checkbox:hover {
94
+ border-color: var(--cz-checkbox-hover-border-color);
95
+ }
96
+
97
+ .cz-checkbox:focus-visible {
98
+ outline: none;
99
+ box-shadow: 0 0 0 2px hsl(var(--cz-color-bg)), 0 0 0 4px var(--cz-checkbox-focus-ring-color);
100
+ }
101
+
102
+ .cz-checkbox:disabled {
103
+ cursor: not-allowed;
104
+ opacity: var(--cz-checkbox-disabled-opacity);
105
+ }
106
+
107
+ .cz-checkbox[data-state="checked"],
108
+ .cz-checkbox[data-state="indeterminate"] {
109
+ background-color: var(--cz-checkbox-checked-bg);
110
+ border-color: var(--cz-checkbox-checked-border-color);
111
+ }
112
+
113
+ .cz-checkbox-indicator {
114
+ display: flex;
115
+ align-items: center;
116
+ justify-content: center;
117
+ color: var(--cz-checkbox-indicator-color);
118
+ width: 100%;
119
+ height: 100%;
120
+ }
121
+
122
+ .cz-checkbox-label {
123
+ font-size: var(--cz-checkbox-label-font-size);
124
+ color: hsl(var(--cz-color-fg));
125
+ }
126
+ `;
127
+ }
128
+ function generateCheckboxSizes(config) {
129
+ let css = "/* Checkbox Sizes */\n";
130
+ for (const size of ["sm", "md", "lg"]) {
131
+ css += `.cz-checkbox-${size} {
132
+ width: var(--cz-checkbox-size-${size});
133
+ height: var(--cz-checkbox-size-${size});
134
+ }
135
+ .cz-checkbox-${size} .cz-checkbox-indicator svg {
136
+ width: var(--cz-checkbox-icon-size-${size});
137
+ height: var(--cz-checkbox-icon-size-${size});
138
+ }
139
+ `;
140
+ }
141
+ return css;
142
+ }
143
+ function generateCheckboxDescription() {
144
+ return `/* Checkbox with Description */
145
+ .cz-checkbox-wrapper-with-description {
146
+ align-items: flex-start;
147
+ }
148
+ .cz-checkbox-wrapper-with-description .cz-checkbox {
149
+ margin-top: 0.125rem;
150
+ }
151
+
152
+ .cz-checkbox-text {
153
+ display: flex;
154
+ flex-direction: column;
155
+ gap: 0.125rem;
156
+ }
157
+
158
+ .cz-checkbox-description {
159
+ font-size: var(--cz-font-size-xs);
160
+ color: hsl(var(--cz-color-mutedFg));
161
+ }
162
+ `;
163
+ }
@@ -0,0 +1,10 @@
1
+ /**
2
+ * CZero CSS Generators Index
3
+ * Exports all component CSS generators
4
+ */
5
+ export { generateButtonCSS } from "./button";
6
+ export { generateInputCSS } from "./input";
7
+ export { generateCardCSS } from "./card";
8
+ export { generateSwitchCSS } from "./switch";
9
+ export { generateCheckboxCSS } from "./checkbox";
10
+ export { generateUtilitiesCSS } from "./utilities";
@@ -0,0 +1,40 @@
1
+ /**
2
+ * CZero CSS Generators Index
3
+ * Exports all component CSS generators
4
+ */
5
+ export { generateButtonCSS } from "./button";
6
+ export { generateInputCSS } from "./input";
7
+ export { generateCardCSS } from "./card";
8
+ export { generateSwitchCSS } from "./switch";
9
+ export { generateCheckboxCSS } from "./checkbox";
10
+ export { generateUtilitiesCSS } from "./utilities";
11
+ // Future generators will be added here:
12
+ // export { generateTextareaCSS } from "./textarea";
13
+ // export { generateCardCSS } from "./card";
14
+ // export { generateBadgeCSS } from "./badge";
15
+ // export { generateSwitchCSS } from "./switch";
16
+ // export { generateCheckboxCSS } from "./checkbox";
17
+ // export { generateRadioCSS } from "./radio";
18
+ // export { generateSelectCSS } from "./select";
19
+ // export { generateLabelCSS } from "./label";
20
+ // export { generateAlertCSS } from "./alert";
21
+ // export { generateTooltipCSS } from "./tooltip";
22
+ // export { generateProgressCSS } from "./progress";
23
+ // export { generateSkeletonCSS } from "./skeleton";
24
+ // export { generateSpinnerCSS } from "./spinner";
25
+ // export { generateTabsCSS } from "./tabs";
26
+ // export { generateDialogCSS } from "./dialog";
27
+ // export { generateDropdownMenuCSS } from "./dropdown-menu";
28
+ // export { generateAccordionCSS } from "./accordion";
29
+ // export { generateTableCSS } from "./table";
30
+ // export { generateAvatarCSS } from "./avatar";
31
+ // export { generateSeparatorCSS } from "./separator";
32
+ // export { generateBreadcrumbCSS } from "./breadcrumb";
33
+ // export { generateCodeCSS } from "./code";
34
+ // export { generateKbdCSS } from "./kbd";
35
+ // export { generateTagCSS } from "./tag";
36
+ // export { generateToastCSS } from "./toast";
37
+ // export { generateScrollAreaCSS } from "./scroll-area";
38
+ // export { generateContainerCSS } from "./container";
39
+ // export { generateStackCSS } from "./stack";
40
+ // export { generateGridCSS } from "./grid";
@@ -0,0 +1,9 @@
1
+ /**
2
+ * CZero Input CSS Generator
3
+ * Generates CSS for input component from config tokens
4
+ */
5
+ import type { InputTokens } from "../../src/core/types/config";
6
+ /**
7
+ * Generate all input CSS including variables, base styles, sizes, and states
8
+ */
9
+ export declare function generateInputCSS(config: InputTokens): string;