@prasworld/flux-ui 0.0.1

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.
@@ -0,0 +1,112 @@
1
+ /**
2
+ * CSS Custom Properties Initialization
3
+ * ====================================
4
+ * Generated programmatically from _variables.scss maps.
5
+ *
6
+ * This file generates the :root block with all CSS custom properties
7
+ * derived from the SCSS token definitions, enabling CSS-only consumers
8
+ * and runtime theming.
9
+ */
10
+
11
+ @use 'variables' as *;
12
+
13
+ :root {
14
+ // ========================================================================
15
+ // Color Palettes
16
+ // ========================================================================
17
+ @each $palette-name, $palette-map in $palette-maps {
18
+ @each $shade, $value in $palette-map {
19
+ --vi-color-#{$palette-name}-#{$shade}: #{strip-units($value)};
20
+ }
21
+ }
22
+
23
+ // ========================================================================
24
+ // Semantic Colors
25
+ // ========================================================================
26
+ @each $color-name, $color-value in $color-map {
27
+ --vi-color-#{$color-name}: #{strip-units($color-value)};
28
+ }
29
+
30
+ // ========================================================================
31
+ // Functional Colors
32
+ // ========================================================================
33
+ --vi-color-background: #{strip-units($color-background)};
34
+ --vi-color-foreground: #{strip-units($color-foreground)};
35
+ --vi-color-border: #{strip-units($color-border)};
36
+
37
+ // ========================================================================
38
+ // Spacing
39
+ // ========================================================================
40
+ @each $spacing-name, $spacing-value in $spacing-map {
41
+ --vi-spacing-#{$spacing-name}: #{strip-units($spacing-value)};
42
+ }
43
+
44
+ // ========================================================================
45
+ // Typography — Families
46
+ // ========================================================================
47
+ --vi-font-family-base: #{strip-units($font-family-base)};
48
+ --vi-font-family-mono: #{strip-units($font-family-mono)};
49
+
50
+ // ========================================================================
51
+ // Typography — Sizes
52
+ // ========================================================================
53
+ --vi-font-size-xs: #{strip-units($font-size-xs)};
54
+ --vi-font-size-sm: #{strip-units($font-size-sm)};
55
+ --vi-font-size-base: #{strip-units($font-size-base)};
56
+ --vi-font-size-lg: #{strip-units($font-size-lg)};
57
+ --vi-font-size-xl: #{strip-units($font-size-xl)};
58
+ --vi-font-size-2xl: #{strip-units($font-size-2xl)};
59
+ --vi-font-size-3xl: #{strip-units($font-size-3xl)};
60
+
61
+ // ========================================================================
62
+ // Typography — Weights
63
+ // ========================================================================
64
+ --vi-font-weight-light: #{strip-units($font-weight-light)};
65
+ --vi-font-weight-normal: #{strip-units($font-weight-normal)};
66
+ --vi-font-weight-medium: #{strip-units($font-weight-medium)};
67
+ --vi-font-weight-semibold: #{strip-units($font-weight-semibold)};
68
+ --vi-font-weight-bold: #{strip-units($font-weight-bold)};
69
+
70
+ // ========================================================================
71
+ // Typography — Line Heights
72
+ // ========================================================================
73
+ --vi-line-height-tight: #{strip-units($line-height-tight)};
74
+ --vi-line-height-normal: #{strip-units($line-height-normal)};
75
+ --vi-line-height-relaxed: #{strip-units($line-height-relaxed)};
76
+
77
+ // ========================================================================
78
+ // Shadows
79
+ // ========================================================================
80
+ @each $shadow-name, $shadow-value in $shadow-map {
81
+ --vi-shadow-#{$shadow-name}: #{strip-units($shadow-value)};
82
+ }
83
+
84
+ // ========================================================================
85
+ // Border Radius
86
+ // ========================================================================
87
+ --vi-border-radius-sm: #{strip-units($border-radius-sm)};
88
+ --vi-border-radius-md: #{strip-units($border-radius-md)};
89
+ --vi-border-radius-lg: #{strip-units($border-radius-lg)};
90
+ --vi-border-radius-xl: #{strip-units($border-radius-xl)};
91
+
92
+ // ========================================================================
93
+ // Border Widths
94
+ // ========================================================================
95
+ --vi-border-width-thin: #{strip-units($border-width-thin)};
96
+ --vi-border-width-base: #{strip-units($border-width-base)};
97
+ --vi-border-width-thick: #{strip-units($border-width-thick)};
98
+ }
99
+
100
+ /**
101
+ * Strip var() wrapper from CSS custom properties
102
+ * Used to extract the fallback value for :root initialization
103
+ */
104
+ @function strip-units($value) {
105
+ @if type-of($value) == 'string' and str-index($value, 'var(') {
106
+ // Extracts fallback from var(--vi-token, fallback)
107
+ $start: str-index($value, ',') + 2;
108
+ $end: str-length($value) - 1;
109
+ @return str-slice($value, $start, $end);
110
+ }
111
+ @return $value;
112
+ }
@@ -0,0 +1,175 @@
1
+ /**
2
+ * Theme System
3
+ * ============
4
+ * Themeable tokens as composable SCSS maps + vi-theme() mixin.
5
+ *
6
+ * Pattern:
7
+ * 1. Define theme maps (e.g. $vi-theme--light, $vi-theme--dark)
8
+ * 2. Call @include vi-theme($theme-map) inside a selector
9
+ * 3. Mixin emits CSS custom properties for each token in the map
10
+ *
11
+ * Usage:
12
+ * :root {
13
+ * @include vi-theme($vi-theme--light, $emit-custom-properties: true);
14
+ * }
15
+ *
16
+ * [data-theme="dark"] {
17
+ * @include vi-theme($vi-theme--dark, $emit-custom-properties: true, $emit-difference: true);
18
+ * }
19
+ */
20
+
21
+ @use 'sass:map';
22
+ @use './variables' as *;
23
+
24
+ // ============================================================================
25
+ // LIGHT THEME
26
+ // ============================================================================
27
+ // Comprehensive token map for light theme.
28
+ // Keys are token names; values are references to palette variables from _variables.scss
29
+
30
+ $vi-theme--light: (
31
+ // Text colors
32
+ 'text-primary': $color-grey-900,
33
+ 'text-secondary': $color-grey-700,
34
+ 'text-tertiary': $color-grey-600,
35
+ 'text-inverse': $color-grey-100,
36
+ 'text-success': $color-green-700,
37
+ 'text-warning': $color-yellow-800,
38
+ 'text-error': $color-red-700,
39
+ 'text-info': $color-blue-700,
40
+
41
+ // Background colors
42
+ 'bg-primary': $color-grey-100,
43
+ 'bg-secondary': $color-grey-200,
44
+ 'bg-tertiary': $color-grey-300,
45
+ 'bg-inverse': $color-grey-900,
46
+ 'bg-success': #e6f9f0,
47
+ 'bg-warning': #fff8e1,
48
+ 'bg-error': #ffebee,
49
+ 'bg-info': #e3f2fd,
50
+
51
+ // Layer/depth
52
+ 'layer-01': $color-grey-100, // Surface
53
+ 'layer-02': $color-grey-200, // Raised
54
+ 'layer-03': $color-grey-300, // Elevated
55
+ 'layer-hover': $color-grey-200,
56
+ 'layer-active': $color-grey-300,
57
+
58
+ // Border colors
59
+ 'border-default': $color-grey-200,
60
+ 'border-strong': $color-grey-300,
61
+ 'border-subtle': $color-grey-100,
62
+
63
+ // Focus/interaction
64
+ 'focus-ring': $color-blue-500,
65
+ 'hover-overlay': rgba(0, 0, 0, 0.04),
66
+ 'active-overlay': rgba(0, 0, 0, 0.08),
67
+
68
+ // Component-specific
69
+ 'button-primary-bg': $color-blue-600,
70
+ 'button-primary-text': #ffffff,
71
+ 'button-secondary-bg': $color-grey-200,
72
+ 'button-secondary-text': $color-grey-900,
73
+ 'button-danger-bg': $color-red-600,
74
+ 'button-danger-text': #ffffff,
75
+
76
+ 'input-bg': #ffffff,
77
+ 'input-text': $color-grey-900,
78
+ 'input-border': $color-grey-200,
79
+ 'input-placeholder': $color-grey-500,
80
+ 'input-focus-ring': $color-blue-500,
81
+
82
+ 'card-bg': #ffffff,
83
+ 'card-border': $color-grey-200,
84
+ );
85
+
86
+ // ============================================================================
87
+ // DARK THEME
88
+ // ============================================================================
89
+ // Inherits from light theme; overrides tokens for dark adaptation.
90
+
91
+ $vi-theme--dark: map.merge($vi-theme--light, (
92
+ // Text colors — inverted
93
+ 'text-primary': $color-grey-100,
94
+ 'text-secondary': $color-grey-300,
95
+ 'text-tertiary': $color-grey-400,
96
+ 'text-inverse': $color-grey-900,
97
+
98
+ // Background colors — dark
99
+ 'bg-primary': $color-grey-900,
100
+ 'bg-secondary': $color-grey-800,
101
+ 'bg-tertiary': $color-grey-700,
102
+ 'bg-inverse': $color-grey-100,
103
+
104
+ // Layer/depth
105
+ 'layer-01': $color-grey-900,
106
+ 'layer-02': $color-grey-800,
107
+ 'layer-03': $color-grey-700,
108
+ 'layer-hover': $color-grey-800,
109
+ 'layer-active': $color-grey-700,
110
+
111
+ // Border colors — lighter for contrast
112
+ 'border-default': $color-grey-700,
113
+ 'border-strong': $color-grey-600,
114
+ 'border-subtle': $color-grey-800,
115
+
116
+ // Focus/interaction — adapted
117
+ 'focus-ring': $color-blue-400,
118
+ 'hover-overlay': rgba(255, 255, 255, 0.04),
119
+ 'active-overlay': rgba(255, 255, 255, 0.08),
120
+
121
+ // Component-specific
122
+ 'button-primary-text': #ffffff,
123
+ 'button-secondary-bg': $color-grey-700,
124
+ 'button-secondary-text': $color-grey-100,
125
+ 'button-danger-text': #ffffff,
126
+
127
+ 'input-bg': $color-grey-800,
128
+ 'input-text': $color-grey-100,
129
+ 'input-border': $color-grey-700,
130
+ 'input-placeholder': $color-grey-500,
131
+
132
+ 'card-bg': $color-grey-900,
133
+ 'card-border': $color-grey-800,
134
+ ));
135
+
136
+ // ============================================================================
137
+ // VI-THEME MIXIN
138
+ // ============================================================================
139
+ /**
140
+ * Apply a theme by setting SCSS variables and optionally emitting CSS custom properties.
141
+ *
142
+ * Parameters:
143
+ * $theme — Theme token map (e.g., $vi-theme--light)
144
+ * $emit-custom-properties — (default: false) Emit CSS custom properties (--vi-*)
145
+ * $emit-difference — (default: false) Only emit tokens differing from $vi-theme--light
146
+ * $parent-theme — (optional) Explicit parent for diff comparison (default: $vi-theme--light)
147
+ */
148
+
149
+ @mixin vi-theme(
150
+ $theme,
151
+ $emit-custom-properties: false,
152
+ $emit-difference: false,
153
+ $parent-theme: $vi-theme--light
154
+ ) {
155
+ @each $token-key, $token-value in $theme {
156
+ // Only emit CSS custom properties if requested
157
+ @if $emit-custom-properties {
158
+ // Check if we should emit based on emit-difference flag
159
+ $should-emit: true;
160
+
161
+ @if $emit-difference {
162
+ $parent-value: map.get($parent-theme, $token-key);
163
+ @if $parent-value == $token-value {
164
+ $should-emit: false;
165
+ }
166
+ }
167
+
168
+ @if $should-emit {
169
+ // Emit: --vi-text-primary: var(--vi-color-grey-900, #111827);
170
+ // (where $token-value = $color-grey-900 from _variables.scss)
171
+ --vi-#{$token-key}: #{$token-value};
172
+ }
173
+ }
174
+ }
175
+ }
@@ -0,0 +1,434 @@
1
+ /**
2
+ * Utility Classes
3
+ * ===============
4
+ * Spacing, typography, and other common utilities.
5
+ * These are all generated from design tokens.
6
+ */
7
+
8
+ @use './variables' as *;
9
+
10
+ @layer utilities {
11
+ // ============================================================================
12
+ // MARGIN
13
+ // ============================================================================
14
+
15
+ @each $name, $value in $spacing-map {
16
+ .m-#{$name} {
17
+ margin: $value;
18
+ }
19
+
20
+ .mx-#{$name} {
21
+ margin-left: $value;
22
+ margin-right: $value;
23
+ }
24
+
25
+ .my-#{$name} {
26
+ margin-top: $value;
27
+ margin-bottom: $value;
28
+ }
29
+
30
+ .mt-#{$name} {
31
+ margin-top: $value;
32
+ }
33
+
34
+ .mr-#{$name} {
35
+ margin-right: $value;
36
+ }
37
+
38
+ .mb-#{$name} {
39
+ margin-bottom: $value;
40
+ }
41
+
42
+ .ml-#{$name} {
43
+ margin-left: $value;
44
+ }
45
+ }
46
+
47
+ // ============================================================================
48
+ // PADDING
49
+ // ============================================================================
50
+
51
+ @each $name, $value in $spacing-map {
52
+ .p-#{$name} {
53
+ padding: $value;
54
+ }
55
+
56
+ .px-#{$name} {
57
+ padding-left: $value;
58
+ padding-right: $value;
59
+ }
60
+
61
+ .py-#{$name} {
62
+ padding-top: $value;
63
+ padding-bottom: $value;
64
+ }
65
+
66
+ .pt-#{$name} {
67
+ padding-top: $value;
68
+ }
69
+
70
+ .pr-#{$name} {
71
+ padding-right: $value;
72
+ }
73
+
74
+ .pb-#{$name} {
75
+ padding-bottom: $value;
76
+ }
77
+
78
+ .pl-#{$name} {
79
+ padding-left: $value;
80
+ }
81
+ }
82
+
83
+ // ============================================================================
84
+ // TYPOGRAPHY
85
+ // ============================================================================
86
+
87
+ .text-xs {
88
+ font-size: $font-size-xs;
89
+ }
90
+
91
+ .text-sm {
92
+ font-size: $font-size-sm;
93
+ }
94
+
95
+ .text-base {
96
+ font-size: $font-size-base;
97
+ }
98
+
99
+ .text-lg {
100
+ font-size: $font-size-lg;
101
+ }
102
+
103
+ .text-xl {
104
+ font-size: $font-size-xl;
105
+ }
106
+
107
+ .text-2xl {
108
+ font-size: $font-size-2xl;
109
+ }
110
+
111
+ .text-3xl {
112
+ font-size: $font-size-3xl;
113
+ }
114
+
115
+ .font-light {
116
+ font-weight: $font-weight-light;
117
+ }
118
+
119
+ .font-normal {
120
+ font-weight: $font-weight-normal;
121
+ }
122
+
123
+ .font-medium {
124
+ font-weight: $font-weight-medium;
125
+ }
126
+
127
+ .font-semibold {
128
+ font-weight: $font-weight-semibold;
129
+ }
130
+
131
+ .font-bold {
132
+ font-weight: $font-weight-bold;
133
+ }
134
+
135
+ .leading-tight {
136
+ line-height: $line-height-tight;
137
+ }
138
+
139
+ .leading-normal {
140
+ line-height: $line-height-normal;
141
+ }
142
+
143
+ .leading-relaxed {
144
+ line-height: $line-height-relaxed;
145
+ }
146
+
147
+ .text-center {
148
+ text-align: center;
149
+ }
150
+
151
+ .text-left {
152
+ text-align: left;
153
+ }
154
+
155
+ .text-right {
156
+ text-align: right;
157
+ }
158
+
159
+ // ============================================================================
160
+ // COLORS
161
+ // ============================================================================
162
+
163
+ @each $name, $value in $color-map {
164
+ .text-#{$name} {
165
+ color: $value;
166
+ }
167
+
168
+ .bg-#{$name} {
169
+ background-color: $value;
170
+ }
171
+
172
+ .border-#{$name} {
173
+ border-color: $value;
174
+ }
175
+ }
176
+
177
+ // Palette shades: grey, red, yellow, green, blue, purple — 100–900
178
+ // Generates .text-{palette}-{shade} and .bg-{palette}-{shade} for all palettes.
179
+ @each $palette-name, $palette in $palette-maps {
180
+ @each $shade, $value in $palette {
181
+ .text-#{$palette-name}-#{$shade} {
182
+ color: $value;
183
+ }
184
+
185
+ .bg-#{$palette-name}-#{$shade} {
186
+ background-color: $value;
187
+ }
188
+ }
189
+ }
190
+
191
+ // -- Neutral alias for grey (semantic naming) --
192
+ @each $shade, $value in $color-grey-map {
193
+ .text-neutral-#{$shade} {
194
+ color: $value;
195
+ }
196
+
197
+ .bg-neutral-#{$shade} {
198
+ background-color: $value;
199
+ }
200
+
201
+ .border-neutral-#{$shade} {
202
+ border-color: $value;
203
+ }
204
+ }
205
+
206
+ // ============================================================================
207
+ // SHADOWS
208
+ // ============================================================================
209
+
210
+ @each $name, $value in $shadow-map {
211
+ .shadow-#{$name} {
212
+ box-shadow: $value;
213
+ }
214
+ }
215
+
216
+ // ============================================================================
217
+ // BORDER RADIUS
218
+ // ============================================================================
219
+
220
+ .rounded-none {
221
+ border-radius: 0;
222
+ }
223
+
224
+ .rounded-sm {
225
+ border-radius: $border-radius-sm;
226
+ }
227
+
228
+ .rounded-md {
229
+ border-radius: $border-radius-md;
230
+ }
231
+
232
+ .rounded-lg {
233
+ border-radius: $border-radius-lg;
234
+ }
235
+
236
+ .rounded-xl {
237
+ border-radius: $border-radius-xl;
238
+ }
239
+
240
+ .rounded-full {
241
+ border-radius: 9999px;
242
+ }
243
+
244
+ // ============================================================================
245
+ // BORDERS
246
+ // ============================================================================
247
+
248
+ .border-thin {
249
+ border-width: $border-width-thin;
250
+ border-style: solid;
251
+ }
252
+
253
+ .border-base {
254
+ border-width: $border-width-base;
255
+ border-style: solid;
256
+ }
257
+
258
+ .border-thick {
259
+ border-width: $border-width-thick;
260
+ border-style: solid;
261
+ }
262
+
263
+ // ============================================================================
264
+ // Z-INDEX
265
+ // ============================================================================
266
+
267
+ @each $name, $value in $z-index-map {
268
+ .z-#{$name} {
269
+ z-index: $value;
270
+ }
271
+ }
272
+
273
+ // ============================================================================
274
+ // OPACITY
275
+ // ============================================================================
276
+
277
+ .opacity-0 { opacity: 0; }
278
+ .opacity-25 { opacity: 0.25; }
279
+ .opacity-50 { opacity: 0.5; }
280
+ .opacity-75 { opacity: 0.75; }
281
+ .opacity-100 { opacity: 1; }
282
+
283
+ // ============================================================================
284
+ // DISPLAY
285
+ // ============================================================================
286
+
287
+ .block {
288
+ display: block;
289
+ }
290
+
291
+ .inline {
292
+ display: inline;
293
+ }
294
+
295
+ .inline-block {
296
+ display: inline-block;
297
+ }
298
+
299
+ .hidden {
300
+ display: none;
301
+ }
302
+
303
+ // ============================================================================
304
+ // FLEXBOX
305
+ // ============================================================================
306
+
307
+ .flex {
308
+ display: flex;
309
+ }
310
+
311
+ .flex-row {
312
+ flex-direction: row;
313
+ }
314
+
315
+ .flex-col {
316
+ flex-direction: column;
317
+ }
318
+
319
+ .flex-wrap {
320
+ flex-wrap: wrap;
321
+ }
322
+
323
+ .flex-nowrap {
324
+ flex-wrap: nowrap;
325
+ }
326
+
327
+ .justify-start {
328
+ justify-content: flex-start;
329
+ }
330
+
331
+ .justify-end {
332
+ justify-content: flex-end;
333
+ }
334
+
335
+ .justify-center {
336
+ justify-content: center;
337
+ }
338
+
339
+ .justify-between {
340
+ justify-content: space-between;
341
+ }
342
+
343
+ .justify-around {
344
+ justify-content: space-around;
345
+ }
346
+
347
+ .justify-evenly {
348
+ justify-content: space-evenly;
349
+ }
350
+
351
+ .items-start {
352
+ align-items: flex-start;
353
+ }
354
+
355
+ .items-end {
356
+ align-items: flex-end;
357
+ }
358
+
359
+ .items-center {
360
+ align-items: center;
361
+ }
362
+
363
+ .items-stretch {
364
+ align-items: stretch;
365
+ }
366
+
367
+ .items-baseline {
368
+ align-items: baseline;
369
+ }
370
+
371
+ .flex-1 {
372
+ flex: 1 1 0%;
373
+ }
374
+
375
+ .flex-auto {
376
+ flex: 1 1 auto;
377
+ }
378
+
379
+ .flex-none {
380
+ flex: none;
381
+ }
382
+
383
+ // ============================================================================
384
+ // GRID
385
+ // ============================================================================
386
+
387
+ .grid {
388
+ display: grid;
389
+ }
390
+
391
+ @for $i from 1 through 12 {
392
+ .grid-cols-#{$i} {
393
+ grid-template-columns: repeat(#{$i}, minmax(0, 1fr));
394
+ }
395
+ }
396
+
397
+ // ============================================================================
398
+ // GAP
399
+ // ============================================================================
400
+
401
+ @each $name, $value in $spacing-map {
402
+ .gap-#{$name} {
403
+ gap: $value;
404
+ }
405
+
406
+ .gap-x-#{$name} {
407
+ column-gap: $value;
408
+ }
409
+
410
+ .gap-y-#{$name} {
411
+ row-gap: $value;
412
+ }
413
+ }
414
+
415
+ // ============================================================================
416
+ // TRANSITIONS & ANIMATIONS
417
+ // ============================================================================
418
+
419
+ .transition-all {
420
+ transition: all 0.2s ease-in-out;
421
+ }
422
+
423
+ .transition-colors {
424
+ transition: background-color 0.2s ease-in-out, color 0.2s ease-in-out, border-color 0.2s ease-in-out;
425
+ }
426
+
427
+ .transition-opacity {
428
+ transition: opacity 0.2s ease-in-out;
429
+ }
430
+
431
+ .duration-100 { transition-duration: 100ms; }
432
+ .duration-200 { transition-duration: 200ms; }
433
+ .duration-300 { transition-duration: 300ms; }
434
+ }