czero 0.2.0 → 0.2.5

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 (62) hide show
  1. package/README.md +209 -209
  2. package/dist/cli/index.js +970 -72
  3. package/dist/components.css +2158 -1913
  4. package/dist/react/core/component-defaults.d.ts.map +1 -1
  5. package/dist/react/core/types/config.d.ts +161 -2
  6. package/dist/react/core/types/config.d.ts.map +1 -1
  7. package/dist/react/index.cjs +695 -12
  8. package/dist/react/index.cjs.map +1 -1
  9. package/dist/react/index.d.ts +138 -11
  10. package/dist/react/index.js +693 -13
  11. package/dist/react/index.js.map +1 -1
  12. package/dist/react/react/components/button.d.ts +1 -0
  13. package/dist/react/react/components/button.d.ts.map +1 -1
  14. package/dist/react/react/components/data-table.d.ts +39 -0
  15. package/dist/react/react/components/data-table.d.ts.map +1 -0
  16. package/dist/react/react/components/input.d.ts +5 -2
  17. package/dist/react/react/components/input.d.ts.map +1 -1
  18. package/dist/react/react/components/modal.d.ts +44 -0
  19. package/dist/react/react/components/modal.d.ts.map +1 -0
  20. package/dist/react/react/components/search-input.d.ts +13 -0
  21. package/dist/react/react/components/search-input.d.ts.map +1 -0
  22. package/dist/react/react/components/status-badge.d.ts +11 -0
  23. package/dist/react/react/components/status-badge.d.ts.map +1 -0
  24. package/dist/react/react/components/tabs.d.ts +42 -7
  25. package/dist/react/react/components/tabs.d.ts.map +1 -1
  26. package/dist/react/react/index.d.ts +4 -1
  27. package/dist/react/react/index.d.ts.map +1 -1
  28. package/dist/reset.css +6 -15
  29. package/dist/styles.css +2244 -2008
  30. package/package.json +93 -92
  31. package/dist/cli-new/cli/build-css.d.ts +0 -19
  32. package/dist/cli-new/cli/build-css.js +0 -88
  33. package/dist/cli-new/cli/generators/button.d.ts +0 -9
  34. package/dist/cli-new/cli/generators/button.js +0 -224
  35. package/dist/cli-new/cli/generators/card.d.ts +0 -9
  36. package/dist/cli-new/cli/generators/card.js +0 -104
  37. package/dist/cli-new/cli/generators/checkbox.d.ts +0 -6
  38. package/dist/cli-new/cli/generators/checkbox.js +0 -163
  39. package/dist/cli-new/cli/generators/index.d.ts +0 -10
  40. package/dist/cli-new/cli/generators/index.js +0 -40
  41. package/dist/cli-new/cli/generators/input.d.ts +0 -9
  42. package/dist/cli-new/cli/generators/input.js +0 -231
  43. package/dist/cli-new/cli/generators/switch.d.ts +0 -6
  44. package/dist/cli-new/cli/generators/switch.js +0 -156
  45. package/dist/cli-new/cli/generators/utilities.d.ts +0 -9
  46. package/dist/cli-new/cli/generators/utilities.js +0 -150
  47. package/dist/cli-new/cli/index.d.ts +0 -8
  48. package/dist/cli-new/cli/index.js +0 -288
  49. package/dist/cli-new/cli/token-resolver.d.ts +0 -44
  50. package/dist/cli-new/cli/token-resolver.js +0 -137
  51. package/dist/cli-new/cli/utils/deep-merge.d.ts +0 -15
  52. package/dist/cli-new/cli/utils/deep-merge.js +0 -41
  53. package/dist/cli-new/cli/validate-config.d.ts +0 -19
  54. package/dist/cli-new/cli/validate-config.js +0 -151
  55. package/dist/cli-new/src/core/component-defaults.d.ts +0 -7
  56. package/dist/cli-new/src/core/component-defaults.js +0 -467
  57. package/dist/cli-new/src/core/types/config.d.ts +0 -489
  58. package/dist/cli-new/src/core/types/config.js +0 -5
  59. package/dist/cli-new/src/presets/index.d.ts +0 -44
  60. package/dist/cli-new/src/presets/index.js +0 -194
  61. package/dist/react/react/lib/cn.d.ts +0 -7
  62. package/dist/react/react/lib/cn.d.ts.map +0 -1
@@ -1,163 +0,0 @@
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
- }
@@ -1,10 +0,0 @@
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";
@@ -1,40 +0,0 @@
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";
@@ -1,9 +0,0 @@
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;
@@ -1,231 +0,0 @@
1
- /**
2
- * CZero Input CSS Generator
3
- * Generates CSS for input component from config tokens
4
- */
5
- import { resolveToken, componentVarName } from "../token-resolver";
6
- /**
7
- * Generate all input CSS including variables, base styles, sizes, and states
8
- */
9
- export function generateInputCSS(config) {
10
- let css = "";
11
- css += "/* ===== INPUT ===== */\n\n";
12
- // Generate CSS variables
13
- css += generateInputVariables(config);
14
- css += "\n";
15
- // Generate base styles
16
- css += generateInputBase();
17
- css += "\n";
18
- // Generate size variants
19
- css += generateInputSizes();
20
- css += "\n";
21
- // Generate state styles
22
- css += generateInputStates(config);
23
- css += "\n";
24
- // Generate icon styles
25
- css += generateInputIcons(config);
26
- css += "\n";
27
- // Generate clear button styles
28
- css += generateInputClear();
29
- css += "\n";
30
- // Append custom CSS
31
- if (config.customCSS) {
32
- css += `/* Custom Input CSS */\n${config.customCSS}\n`;
33
- }
34
- return css;
35
- }
36
- /**
37
- * Generate CSS variables for input component
38
- */
39
- function generateInputVariables(config) {
40
- const vars = [];
41
- // Size-based variables
42
- if (config.height) {
43
- for (const [size, value] of Object.entries(config.height)) {
44
- vars.push(` ${componentVarName("input", "height", size)}: ${resolveToken(value)};`);
45
- }
46
- }
47
- if (config.paddingX) {
48
- for (const [size, value] of Object.entries(config.paddingX)) {
49
- vars.push(` ${componentVarName("input", "paddingX", size)}: ${resolveToken(value)};`);
50
- }
51
- }
52
- if (config.fontSize && typeof config.fontSize === "object") {
53
- for (const [size, value] of Object.entries(config.fontSize)) {
54
- vars.push(` ${componentVarName("input", "fontSize", size)}: ${resolveToken(value)};`);
55
- }
56
- }
57
- // Single-value variables
58
- if (config.borderRadius) {
59
- vars.push(` ${componentVarName("input", "borderRadius")}: ${resolveToken(config.borderRadius)};`);
60
- }
61
- if (config.borderWidth) {
62
- vars.push(` ${componentVarName("input", "borderWidth")}: ${resolveToken(config.borderWidth)};`);
63
- }
64
- if (config.borderColor) {
65
- vars.push(` ${componentVarName("input", "borderColor")}: ${resolveToken(config.borderColor)};`);
66
- }
67
- if (config.bg) {
68
- vars.push(` ${componentVarName("input", "bg")}: ${resolveToken(config.bg)};`);
69
- }
70
- if (config.color) {
71
- vars.push(` ${componentVarName("input", "color")}: ${resolveToken(config.color)};`);
72
- }
73
- if (config.placeholderColor) {
74
- vars.push(` ${componentVarName("input", "placeholderColor")}: ${resolveToken(config.placeholderColor)};`);
75
- }
76
- // Icon variables
77
- if (config.iconSize) {
78
- vars.push(` ${componentVarName("input", "iconSize")}: ${resolveToken(config.iconSize)};`);
79
- }
80
- if (config.iconColor) {
81
- vars.push(` ${componentVarName("input", "iconColor")}: ${resolveToken(config.iconColor)};`);
82
- }
83
- if (config.iconSpacing) {
84
- vars.push(` ${componentVarName("input", "iconSpacing")}: ${resolveToken(config.iconSpacing)};`);
85
- }
86
- // State variables
87
- if (config.states?.focus?.borderColor) {
88
- vars.push(` ${componentVarName("input", "focusBorderColor")}: ${resolveToken(config.states.focus.borderColor)};`);
89
- }
90
- if (config.states?.focus?.shadow) {
91
- vars.push(` ${componentVarName("input", "focusShadow")}: ${resolveToken(config.states.focus.shadow)};`);
92
- }
93
- if (config.states?.error?.borderColor) {
94
- vars.push(` ${componentVarName("input", "errorBorderColor")}: ${resolveToken(config.states.error.borderColor)};`);
95
- }
96
- if (config.states?.error?.focusShadow) {
97
- vars.push(` ${componentVarName("input", "errorFocusShadow")}: ${resolveToken(config.states.error.focusShadow)};`);
98
- }
99
- if (config.states?.disabled?.opacity) {
100
- vars.push(` ${componentVarName("input", "disabledOpacity")}: ${config.states.disabled.opacity};`);
101
- }
102
- return `:root {\n${vars.join("\n")}\n}\n`;
103
- }
104
- /**
105
- * Generate base input styles
106
- */
107
- function generateInputBase() {
108
- return `.cz-input-field {
109
- display: flex;
110
- flex-direction: column;
111
- gap: 0.375rem;
112
- }
113
-
114
- .cz-input-wrapper {
115
- position: relative;
116
- display: flex;
117
- align-items: center;
118
- width: 100%;
119
- }
120
-
121
- .cz-input {
122
- width: 100%;
123
- border-radius: var(--cz-input-border-radius);
124
- border: var(--cz-input-border-width) solid var(--cz-input-border-color);
125
- background-color: var(--cz-input-bg);
126
- color: var(--cz-input-color);
127
- transition: all var(--cz-transition-fast);
128
- }
129
-
130
- .cz-input::placeholder {
131
- color: var(--cz-input-placeholder-color);
132
- }
133
- `;
134
- }
135
- /**
136
- * Generate input size variants
137
- */
138
- function generateInputSizes() {
139
- return `/* Input Sizes */
140
- .cz-input-sm {
141
- height: var(--cz-input-height-sm);
142
- padding: 0 var(--cz-input-padding-x-sm);
143
- font-size: var(--cz-input-font-size-sm);
144
- }
145
- .cz-input-md {
146
- height: var(--cz-input-height-md);
147
- padding: 0 var(--cz-input-padding-x-md);
148
- font-size: var(--cz-input-font-size-md);
149
- }
150
- .cz-input-lg {
151
- height: var(--cz-input-height-lg);
152
- padding: 0 var(--cz-input-padding-x-lg);
153
- font-size: var(--cz-input-font-size-lg);
154
- }
155
- `;
156
- }
157
- /**
158
- * Generate input state styles
159
- */
160
- function generateInputStates(config) {
161
- return `.cz-input:focus {
162
- outline: none;
163
- border-color: var(--cz-input-focus-border-color);
164
- box-shadow: var(--cz-input-focus-shadow);
165
- }
166
-
167
- .cz-input:disabled {
168
- cursor: not-allowed;
169
- opacity: var(--cz-input-disabled-opacity);
170
- }
171
-
172
- .cz-input-error {
173
- border-color: var(--cz-input-error-border-color);
174
- }
175
- .cz-input-error:focus {
176
- border-color: var(--cz-input-error-border-color);
177
- box-shadow: var(--cz-input-error-focus-shadow);
178
- }
179
-
180
- .cz-input-description {
181
- font-size: var(--cz-font-size-xs);
182
- color: var(--cz-input-placeholder-color);
183
- }
184
- `;
185
- }
186
- /**
187
- * Generate input icon styles
188
- */
189
- function generateInputIcons(config) {
190
- return `/* Input with Icons */
191
- .cz-input-has-left-icon .cz-input { padding-left: var(--cz-input-icon-spacing); }
192
- .cz-input-has-right-icon .cz-input { padding-right: var(--cz-input-icon-spacing); }
193
-
194
- .cz-input-icon {
195
- position: absolute;
196
- display: flex;
197
- align-items: center;
198
- justify-content: center;
199
- width: var(--cz-input-icon-spacing);
200
- height: 100%;
201
- color: var(--cz-input-icon-color);
202
- pointer-events: none;
203
- }
204
- .cz-input-icon svg { width: var(--cz-input-icon-size); height: var(--cz-input-icon-size); }
205
- .cz-input-icon-left { left: 0; }
206
- .cz-input-icon-right { right: 0; }
207
- `;
208
- }
209
- /**
210
- * Generate input clear button styles
211
- */
212
- function generateInputClear() {
213
- return `/* Input Clear Button */
214
- .cz-input-clear {
215
- position: absolute;
216
- right: 0;
217
- display: flex;
218
- align-items: center;
219
- justify-content: center;
220
- width: var(--cz-input-icon-spacing);
221
- height: 100%;
222
- color: var(--cz-input-icon-color);
223
- background: transparent;
224
- border: none;
225
- cursor: pointer;
226
- transition: color var(--cz-transition-fast);
227
- }
228
- .cz-input-clear:hover { color: var(--cz-input-color); }
229
- .cz-input-clear svg { width: 0.875rem; height: 0.875rem; }
230
- `;
231
- }
@@ -1,6 +0,0 @@
1
- /**
2
- * CZero Switch CSS Generator
3
- * Generates CSS for switch component from config tokens
4
- */
5
- import type { SwitchTokens } from "../../src/core/types/config";
6
- export declare function generateSwitchCSS(config: SwitchTokens): string;
@@ -1,156 +0,0 @@
1
- /**
2
- * CZero Switch CSS Generator
3
- * Generates CSS for switch component from config tokens
4
- */
5
- import { resolveToken } from "../token-resolver";
6
- export function generateSwitchCSS(config) {
7
- let css = "";
8
- css += "/* ===== SWITCH ===== */\n\n";
9
- css += generateSwitchVariables(config);
10
- css += "\n";
11
- css += generateSwitchBase();
12
- css += "\n";
13
- css += generateSwitchSizes(config);
14
- css += "\n";
15
- css += generateSwitchLabel();
16
- css += "\n";
17
- if (config.customCSS) {
18
- css += `/* Custom Switch CSS */\n${config.customCSS}\n`;
19
- }
20
- return css;
21
- }
22
- function generateSwitchVariables(config) {
23
- const vars = [];
24
- // Size variants
25
- if (config.width) {
26
- for (const [size, value] of Object.entries(config.width)) {
27
- vars.push(` --cz-switch-width-${size}: ${resolveToken(value)};`);
28
- }
29
- }
30
- if (config.height) {
31
- for (const [size, value] of Object.entries(config.height)) {
32
- vars.push(` --cz-switch-height-${size}: ${resolveToken(value)};`);
33
- }
34
- }
35
- if (config.thumbSize) {
36
- for (const [size, value] of Object.entries(config.thumbSize)) {
37
- vars.push(` --cz-switch-thumb-size-${size}: ${resolveToken(value)};`);
38
- }
39
- }
40
- // Single values
41
- if (config.thumbOffset)
42
- vars.push(` --cz-switch-thumb-offset: ${config.thumbOffset};`);
43
- if (config.borderRadius)
44
- vars.push(` --cz-switch-border-radius: ${resolveToken(config.borderRadius)};`);
45
- if (config.bgUnchecked)
46
- vars.push(` --cz-switch-bg-unchecked: ${resolveToken(config.bgUnchecked)};`);
47
- if (config.bgChecked)
48
- vars.push(` --cz-switch-bg-checked: ${resolveToken(config.bgChecked)};`);
49
- if (config.thumbBg)
50
- vars.push(` --cz-switch-thumb-bg: ${resolveToken(config.thumbBg)};`);
51
- if (config.thumbShadow)
52
- vars.push(` --cz-switch-thumb-shadow: ${resolveToken(config.thumbShadow)};`);
53
- if (config.transition)
54
- vars.push(` --cz-switch-transition: ${resolveToken(config.transition)};`);
55
- // States
56
- if (config.states?.focus?.ringWidth)
57
- vars.push(` --cz-switch-focus-ring-width: ${config.states.focus.ringWidth};`);
58
- if (config.states?.focus?.ringColor)
59
- vars.push(` --cz-switch-focus-ring-color: ${resolveToken(config.states.focus.ringColor)};`);
60
- if (config.states?.disabled?.opacity)
61
- vars.push(` --cz-switch-disabled-opacity: ${config.states.disabled.opacity};`);
62
- return `:root {\n${vars.join("\n")}\n}\n`;
63
- }
64
- function generateSwitchBase() {
65
- return `.cz-switch {
66
- all: unset;
67
- box-sizing: border-box;
68
- display: inline-flex;
69
- align-items: center;
70
- position: relative;
71
- border-radius: var(--cz-switch-border-radius);
72
- background-color: var(--cz-switch-bg-unchecked);
73
- transition: all var(--cz-switch-transition);
74
- cursor: pointer;
75
- }
76
-
77
- .cz-switch:focus-visible {
78
- outline: none;
79
- box-shadow: 0 0 0 2px hsl(var(--cz-color-bg)), 0 0 0 4px var(--cz-switch-focus-ring-color);
80
- }
81
-
82
- .cz-switch[data-state="checked"],
83
- .cz-switch.cz-switch-checked {
84
- background-color: var(--cz-switch-bg-checked);
85
- }
86
-
87
- .cz-switch.cz-disabled,
88
- .cz-switch:disabled {
89
- opacity: var(--cz-switch-disabled-opacity);
90
- cursor: not-allowed;
91
- }
92
-
93
- .cz-switch-thumb {
94
- display: block;
95
- border-radius: var(--cz-switch-border-radius);
96
- background-color: var(--cz-switch-thumb-bg);
97
- box-shadow: var(--cz-switch-thumb-shadow);
98
- transition: transform var(--cz-switch-transition);
99
- }
100
- `;
101
- }
102
- function generateSwitchSizes(config) {
103
- let css = "/* Switch Sizes */\n";
104
- for (const size of ["sm", "md", "lg"]) {
105
- css += `.cz-switch-${size} {
106
- width: var(--cz-switch-width-${size});
107
- height: var(--cz-switch-height-${size});
108
- }
109
- .cz-switch-${size} .cz-switch-thumb {
110
- width: var(--cz-switch-thumb-size-${size});
111
- height: var(--cz-switch-thumb-size-${size});
112
- transform: translateX(var(--cz-switch-thumb-offset));
113
- }
114
- .cz-switch-${size}[data-state="checked"] .cz-switch-thumb,
115
- .cz-switch-${size}.cz-switch-checked .cz-switch-thumb {
116
- transform: translateX(calc(var(--cz-switch-width-${size}) - var(--cz-switch-thumb-size-${size}) - var(--cz-switch-thumb-offset)));
117
- }
118
- `;
119
- }
120
- return css;
121
- }
122
- function generateSwitchLabel() {
123
- return `/* Switch with Label */
124
- .cz-switch-container {
125
- display: inline-flex;
126
- align-items: flex-start;
127
- gap: 0.75rem;
128
- cursor: pointer;
129
- }
130
- .cz-switch-container.cz-disabled {
131
- opacity: var(--cz-switch-disabled-opacity);
132
- cursor: not-allowed;
133
- }
134
-
135
- .cz-switch-label-left { flex-direction: row-reverse; }
136
- .cz-switch-label-right { flex-direction: row; }
137
-
138
- .cz-switch-text {
139
- display: flex;
140
- flex-direction: column;
141
- gap: 0.125rem;
142
- }
143
-
144
- .cz-switch-label {
145
- font-size: var(--cz-font-size-sm);
146
- font-weight: var(--cz-font-weight-medium);
147
- color: hsl(var(--cz-color-fg));
148
- line-height: 1.5;
149
- }
150
-
151
- .cz-switch-description {
152
- font-size: var(--cz-font-size-xs);
153
- color: hsl(var(--cz-color-mutedFg));
154
- }
155
- `;
156
- }
@@ -1,9 +0,0 @@
1
- /**
2
- * CZero Utilities CSS Generator
3
- * Generates utility classes from config
4
- */
5
- /**
6
- * Generate utility CSS classes
7
- * These are helper classes used by components and available to users
8
- */
9
- export declare function generateUtilitiesCSS(): string;