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.
- package/README.md +40 -0
- package/dist/cli/index.js +3780 -28
- package/dist/cli-new/cli/build-css.d.ts +19 -0
- package/dist/cli-new/cli/build-css.js +88 -0
- package/dist/cli-new/cli/generators/button.d.ts +9 -0
- package/dist/cli-new/cli/generators/button.js +224 -0
- package/dist/cli-new/cli/generators/card.d.ts +9 -0
- package/dist/cli-new/cli/generators/card.js +104 -0
- package/dist/cli-new/cli/generators/checkbox.d.ts +6 -0
- package/dist/cli-new/cli/generators/checkbox.js +163 -0
- package/dist/cli-new/cli/generators/index.d.ts +10 -0
- package/dist/cli-new/cli/generators/index.js +40 -0
- package/dist/cli-new/cli/generators/input.d.ts +9 -0
- package/dist/cli-new/cli/generators/input.js +231 -0
- package/dist/cli-new/cli/generators/switch.d.ts +6 -0
- package/dist/cli-new/cli/generators/switch.js +156 -0
- package/dist/cli-new/cli/generators/utilities.d.ts +9 -0
- package/dist/cli-new/cli/generators/utilities.js +150 -0
- package/dist/cli-new/cli/index.d.ts +8 -0
- package/dist/cli-new/cli/index.js +288 -0
- package/dist/cli-new/cli/token-resolver.d.ts +44 -0
- package/dist/cli-new/cli/token-resolver.js +137 -0
- package/dist/cli-new/cli/utils/deep-merge.d.ts +15 -0
- package/dist/cli-new/cli/utils/deep-merge.js +41 -0
- package/dist/cli-new/cli/validate-config.d.ts +19 -0
- package/dist/cli-new/cli/validate-config.js +151 -0
- package/dist/cli-new/src/core/component-defaults.d.ts +7 -0
- package/dist/cli-new/src/core/component-defaults.js +467 -0
- package/dist/cli-new/src/core/types/config.d.ts +489 -0
- package/dist/cli-new/src/core/types/config.js +5 -0
- package/dist/cli-new/src/presets/index.d.ts +44 -0
- package/dist/cli-new/src/presets/index.js +194 -0
- package/dist/components.css +1579 -2
- package/dist/react/core/component-defaults.d.ts +8 -0
- package/dist/react/core/component-defaults.d.ts.map +1 -0
- package/dist/react/core/types/config.d.ts +490 -0
- package/dist/react/core/types/config.d.ts.map +1 -0
- package/dist/react/index.cjs +11577 -17
- package/dist/react/index.cjs.map +1 -1
- package/dist/react/index.d.ts +407 -4
- package/dist/react/index.js +11532 -6
- package/dist/react/index.js.map +1 -1
- package/dist/react/presets/index.d.ts +45 -0
- package/dist/react/presets/index.d.ts.map +1 -0
- package/dist/react/react/components/accordion.d.ts +30 -0
- package/dist/react/react/components/accordion.d.ts.map +1 -0
- package/dist/react/react/components/alert.d.ts +7 -0
- package/dist/react/react/components/alert.d.ts.map +1 -0
- package/dist/react/react/components/aspect-ratio.d.ts +8 -0
- package/dist/react/react/components/aspect-ratio.d.ts.map +1 -0
- package/dist/react/react/components/avatar.d.ts +10 -0
- package/dist/react/react/components/avatar.d.ts.map +1 -0
- package/dist/react/react/components/breadcrumb.d.ts +28 -0
- package/dist/react/react/components/breadcrumb.d.ts.map +1 -0
- package/dist/react/react/components/button.d.ts +3 -2
- package/dist/react/react/components/button.d.ts.map +1 -1
- package/dist/react/react/components/checkbox.d.ts +9 -0
- package/dist/react/react/components/checkbox.d.ts.map +1 -0
- package/dist/react/react/components/code.d.ts +6 -0
- package/dist/react/react/components/code.d.ts.map +1 -0
- package/dist/react/react/components/container.d.ts +8 -0
- package/dist/react/react/components/container.d.ts.map +1 -0
- package/dist/react/react/components/dialog.d.ts +28 -0
- package/dist/react/react/components/dialog.d.ts.map +1 -0
- package/dist/react/react/components/dropdown-menu.d.ts +32 -0
- package/dist/react/react/components/dropdown-menu.d.ts.map +1 -0
- package/dist/react/react/components/grid.d.ts +8 -0
- package/dist/react/react/components/grid.d.ts.map +1 -0
- package/dist/react/react/components/input.d.ts +4 -0
- package/dist/react/react/components/input.d.ts.map +1 -1
- package/dist/react/react/components/kbd.d.ts +6 -0
- package/dist/react/react/components/kbd.d.ts.map +1 -0
- package/dist/react/react/components/label.d.ts +7 -0
- package/dist/react/react/components/label.d.ts.map +1 -0
- package/dist/react/react/components/progress.d.ts +10 -0
- package/dist/react/react/components/progress.d.ts.map +1 -0
- package/dist/react/react/components/radio-group.d.ts +15 -0
- package/dist/react/react/components/radio-group.d.ts.map +1 -0
- package/dist/react/react/components/scroll-area.d.ts +8 -0
- package/dist/react/react/components/scroll-area.d.ts.map +1 -0
- package/dist/react/react/components/select.d.ts +29 -0
- package/dist/react/react/components/select.d.ts.map +1 -0
- package/dist/react/react/components/separator.d.ts +8 -0
- package/dist/react/react/components/separator.d.ts.map +1 -0
- package/dist/react/react/components/skeleton.d.ts +8 -0
- package/dist/react/react/components/skeleton.d.ts.map +1 -0
- package/dist/react/react/components/spinner.d.ts +7 -0
- package/dist/react/react/components/spinner.d.ts.map +1 -0
- package/dist/react/react/components/stack.d.ts +11 -0
- package/dist/react/react/components/stack.d.ts.map +1 -0
- package/dist/react/react/components/switch.d.ts +10 -0
- package/dist/react/react/components/switch.d.ts.map +1 -0
- package/dist/react/react/components/table.d.ts +27 -0
- package/dist/react/react/components/table.d.ts.map +1 -0
- package/dist/react/react/components/tabs.d.ts +21 -0
- package/dist/react/react/components/tabs.d.ts.map +1 -0
- package/dist/react/react/components/tag.d.ts +10 -0
- package/dist/react/react/components/tag.d.ts.map +1 -0
- package/dist/react/react/components/textarea.d.ts +11 -0
- package/dist/react/react/components/textarea.d.ts.map +1 -0
- package/dist/react/react/components/toast.d.ts +28 -0
- package/dist/react/react/components/toast.d.ts.map +1 -0
- package/dist/react/react/components/tooltip.d.ts +16 -0
- package/dist/react/react/components/tooltip.d.ts.map +1 -0
- package/dist/react/react/components/visually-hidden.d.ts +7 -0
- package/dist/react/react/components/visually-hidden.d.ts.map +1 -0
- package/dist/react/react/hooks/index.d.ts +5 -0
- package/dist/react/react/hooks/index.d.ts.map +1 -0
- package/dist/react/react/hooks/use-theme.d.ts +17 -0
- package/dist/react/react/hooks/use-theme.d.ts.map +1 -0
- package/dist/react/react/index.d.ts +30 -0
- package/dist/react/react/index.d.ts.map +1 -1
- package/dist/styles.css +1579 -2
- package/package.json +35 -4
|
@@ -0,0 +1,231 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,156 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,150 @@
|
|
|
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 function generateUtilitiesCSS() {
|
|
10
|
+
return `/**
|
|
11
|
+
* CZero Utility Classes
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
/* Display */
|
|
15
|
+
.cz-inline-flex { display: inline-flex; }
|
|
16
|
+
.cz-flex { display: flex; }
|
|
17
|
+
.cz-flex-col { flex-direction: column; }
|
|
18
|
+
.cz-items-center { align-items: center; }
|
|
19
|
+
.cz-justify-center { justify-content: center; }
|
|
20
|
+
.cz-flex-wrap { flex-wrap: wrap; }
|
|
21
|
+
|
|
22
|
+
/* Gap */
|
|
23
|
+
.cz-gap-1 { gap: 0.25rem; }
|
|
24
|
+
.cz-gap-1\\.5 { gap: 0.375rem; }
|
|
25
|
+
.cz-gap-2 { gap: 0.5rem; }
|
|
26
|
+
|
|
27
|
+
/* Width */
|
|
28
|
+
.cz-w-full { width: 100%; }
|
|
29
|
+
|
|
30
|
+
/* Whitespace */
|
|
31
|
+
.cz-whitespace-nowrap { white-space: nowrap; }
|
|
32
|
+
|
|
33
|
+
/* Opacity */
|
|
34
|
+
.cz-opacity-25 { opacity: 0.25; }
|
|
35
|
+
.cz-opacity-50 { opacity: 0.5; }
|
|
36
|
+
.cz-opacity-75 { opacity: 0.75; }
|
|
37
|
+
|
|
38
|
+
/* Animation */
|
|
39
|
+
@keyframes cz-spin {
|
|
40
|
+
from { transform: rotate(0deg); }
|
|
41
|
+
to { transform: rotate(360deg); }
|
|
42
|
+
}
|
|
43
|
+
.cz-animate-spin { animation: cz-spin 1s linear infinite; }
|
|
44
|
+
|
|
45
|
+
/* Sizing */
|
|
46
|
+
.cz-h-4 { height: 1rem; }
|
|
47
|
+
.cz-w-4 { width: 1rem; }
|
|
48
|
+
.cz-h-8 { height: 2rem; }
|
|
49
|
+
.cz-h-10 { height: 2.5rem; }
|
|
50
|
+
.cz-h-12 { height: 3rem; }
|
|
51
|
+
|
|
52
|
+
/* Padding */
|
|
53
|
+
.cz-px-2 { padding-left: 0.5rem; padding-right: 0.5rem; }
|
|
54
|
+
.cz-px-3 { padding-left: 0.75rem; padding-right: 0.75rem; }
|
|
55
|
+
.cz-px-4 { padding-left: 1rem; padding-right: 1rem; }
|
|
56
|
+
.cz-px-6 { padding-left: 1.5rem; padding-right: 1.5rem; }
|
|
57
|
+
.cz-py-0\\.5 { padding-top: 0.125rem; padding-bottom: 0.125rem; }
|
|
58
|
+
.cz-p-lg { padding: var(--cz-spacing-lg); }
|
|
59
|
+
.cz-pb-md { padding-bottom: var(--cz-spacing-md); }
|
|
60
|
+
.cz-pt-md { padding-top: var(--cz-spacing-md); }
|
|
61
|
+
.cz-px-1\\.5 { padding-left: 0.375rem; padding-right: 0.375rem; }
|
|
62
|
+
|
|
63
|
+
/* Margin */
|
|
64
|
+
.cz-mb-md { margin-bottom: var(--cz-spacing-md); }
|
|
65
|
+
.cz-mt-md { margin-top: var(--cz-spacing-md); }
|
|
66
|
+
|
|
67
|
+
/* Typography */
|
|
68
|
+
.cz-text-xs { font-size: var(--cz-font-size-xs); }
|
|
69
|
+
.cz-text-sm { font-size: var(--cz-font-size-sm); }
|
|
70
|
+
.cz-text-md { font-size: var(--cz-font-size-md); }
|
|
71
|
+
.cz-text-lg { font-size: var(--cz-font-size-lg); }
|
|
72
|
+
.cz-font-medium { font-weight: var(--cz-font-weight-medium); }
|
|
73
|
+
.cz-font-semibold { font-weight: var(--cz-font-weight-semibold); }
|
|
74
|
+
.cz-leading-tight { line-height: var(--cz-font-lineHeight-tight); }
|
|
75
|
+
|
|
76
|
+
/* Colors - Background */
|
|
77
|
+
.cz-bg-bg { background-color: hsl(var(--cz-color-bg)); }
|
|
78
|
+
.cz-bg-primary { background-color: hsl(var(--cz-color-primary)); }
|
|
79
|
+
.cz-bg-secondary { background-color: hsl(var(--cz-color-secondary)); }
|
|
80
|
+
.cz-bg-muted { background-color: hsl(var(--cz-color-muted)); }
|
|
81
|
+
.cz-bg-danger { background-color: hsl(var(--cz-color-danger)); }
|
|
82
|
+
.cz-bg-success { background-color: hsl(var(--cz-color-success)); }
|
|
83
|
+
.cz-bg-warning { background-color: hsl(var(--cz-color-warning)); }
|
|
84
|
+
.cz-bg-transparent { background-color: transparent; }
|
|
85
|
+
|
|
86
|
+
/* Colors - Text */
|
|
87
|
+
.cz-text-fg { color: hsl(var(--cz-color-fg)); }
|
|
88
|
+
.cz-text-primary-fg { color: hsl(var(--cz-color-primaryFg)); }
|
|
89
|
+
.cz-text-secondary-fg { color: hsl(var(--cz-color-secondaryFg)); }
|
|
90
|
+
.cz-text-muted-fg { color: hsl(var(--cz-color-mutedFg)); }
|
|
91
|
+
.cz-text-danger { color: hsl(var(--cz-color-danger)); }
|
|
92
|
+
.cz-text-danger-fg { color: hsl(var(--cz-color-dangerFg)); }
|
|
93
|
+
.cz-text-success-fg { color: hsl(var(--cz-color-successFg)); }
|
|
94
|
+
.cz-text-warning-fg { color: hsl(var(--cz-color-warningFg)); }
|
|
95
|
+
|
|
96
|
+
/* Border */
|
|
97
|
+
.cz-border { border-width: 1px; border-style: solid; }
|
|
98
|
+
.cz-border-b { border-bottom-width: 1px; border-bottom-style: solid; }
|
|
99
|
+
.cz-border-t { border-top-width: 1px; border-top-style: solid; }
|
|
100
|
+
.cz-border-border { border-color: hsl(var(--cz-color-border)); }
|
|
101
|
+
.cz-border-danger { border-color: hsl(var(--cz-color-danger)); }
|
|
102
|
+
|
|
103
|
+
/* Border Radius */
|
|
104
|
+
.cz-rounded-sm { border-radius: var(--cz-radius-sm); }
|
|
105
|
+
.cz-rounded-md { border-radius: var(--cz-radius-md); }
|
|
106
|
+
.cz-rounded-lg { border-radius: var(--cz-radius-lg); }
|
|
107
|
+
.cz-rounded-full { border-radius: var(--cz-radius-full); }
|
|
108
|
+
|
|
109
|
+
/* Shadow */
|
|
110
|
+
.cz-shadow-sm { box-shadow: var(--cz-shadow-sm); }
|
|
111
|
+
|
|
112
|
+
/* Transitions */
|
|
113
|
+
.cz-transition { transition: all var(--cz-transition-fast); }
|
|
114
|
+
|
|
115
|
+
/* States */
|
|
116
|
+
.cz-disabled {
|
|
117
|
+
pointer-events: none;
|
|
118
|
+
opacity: 0.5;
|
|
119
|
+
cursor: not-allowed;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
/* Focus */
|
|
123
|
+
.cz-focus-ring:focus,
|
|
124
|
+
.cz-focus-ring:focus-visible {
|
|
125
|
+
outline: none;
|
|
126
|
+
box-shadow: 0 0 0 2px hsl(var(--cz-color-bg)), 0 0 0 4px hsl(var(--cz-color-ring));
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
/* Hover states */
|
|
130
|
+
.cz-hover-opacity:hover { opacity: 0.9; }
|
|
131
|
+
.cz-hover-muted:hover { background-color: hsl(var(--cz-color-muted)); }
|
|
132
|
+
|
|
133
|
+
/* Label & Error */
|
|
134
|
+
.cz-label {
|
|
135
|
+
font-size: var(--cz-font-size-sm);
|
|
136
|
+
font-weight: var(--cz-font-weight-medium);
|
|
137
|
+
color: hsl(var(--cz-color-fg));
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
.cz-label-required {
|
|
141
|
+
color: hsl(var(--cz-color-danger));
|
|
142
|
+
margin-left: 0.25rem;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
.cz-error {
|
|
146
|
+
font-size: var(--cz-font-size-sm);
|
|
147
|
+
color: hsl(var(--cz-color-danger));
|
|
148
|
+
}
|
|
149
|
+
`;
|
|
150
|
+
}
|