@nuvoui/core 1.1.8 → 1.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 (39) hide show
  1. package/README.md +90 -35
  2. package/dist/nuvoui.css +28531 -0
  3. package/dist/nuvoui.css.map +1 -0
  4. package/dist/nuvoui.min.css +2 -1
  5. package/dist/nuvoui.min.css.map +1 -0
  6. package/package.json +48 -27
  7. package/src/styles/abstracts/_config.scss +157 -0
  8. package/src/styles/abstracts/_functions.scss +81 -0
  9. package/src/styles/abstracts/_index.scss +2 -0
  10. package/src/styles/base/_base.scss +2 -2
  11. package/src/styles/base/_index.scss +2 -0
  12. package/src/styles/base/_reset.scss +8 -6
  13. package/src/styles/index.scss +11 -30
  14. package/src/styles/layouts/_container.scss +2 -21
  15. package/src/styles/layouts/_flex.scss +4 -3
  16. package/src/styles/layouts/_grid.scss +3 -35
  17. package/src/styles/layouts/_index.scss +3 -0
  18. package/src/styles/mixins-map.scss +875 -1477
  19. package/src/styles/themes/_index.scss +1 -0
  20. package/src/styles/themes/_theme.scss +175 -57
  21. package/src/styles/utilities/_alignment.scss +1 -1
  22. package/src/styles/utilities/_animations.scss +65 -61
  23. package/src/styles/utilities/_borders.scss +280 -16
  24. package/src/styles/utilities/_colors.scss +68 -49
  25. package/src/styles/utilities/_container-queries.scss +9 -10
  26. package/src/styles/utilities/_display.scss +2 -2
  27. package/src/styles/utilities/_helpers.scss +110 -108
  28. package/src/styles/utilities/_index.scss +19 -0
  29. package/src/styles/utilities/_media-queries.scss +48 -14
  30. package/src/styles/utilities/_opacity.scss +33 -15
  31. package/src/styles/utilities/_position.scss +7 -7
  32. package/src/styles/utilities/_shadows.scss +147 -95
  33. package/src/styles/utilities/_sizing.scss +22 -21
  34. package/src/styles/utilities/_spacing.scss +38 -22
  35. package/src/styles/utilities/_tooltips.scss +153 -105
  36. package/src/styles/utilities/_transitions.scss +1 -1
  37. package/src/styles/utilities/_typography.scss +4 -4
  38. package/src/styles/utilities/_functions.scss +0 -84
  39. package/src/styles/utilities/_variables.scss +0 -126
@@ -1,29 +1,293 @@
1
- // _spacing.scss
1
+ // _borders.scss
2
+ // Border utility classes for NuvoUI
2
3
 
3
4
  @use 'sass:math';
4
- @use './variables' as *;
5
+ @use 'sass:map';
6
+ @use '../abstracts' as *;
5
7
 
6
- // todo: mixins mising and also finalize .b .bb or not to .b
7
- @mixin border($val) { $val: if($val == 0, $val, $val + px); border-width: $val; }
8
- @mixin rounded($val) { border-radius: $val; }
8
+ // -----------------------------------------------
9
+ // MIXINS
10
+ // -----------------------------------------------
9
11
 
12
+ // Core Border Mixins - improved to include style and color by default
13
+ @mixin border($val) {
14
+ $val: if($val == 0, $val, $val + px);
15
+
16
+ border-width: $val;
17
+ @if $val != 0 {
18
+ border-style: solid; // Apply solid style by default when width > 0
19
+ border-color: var(--border, var(--border)); // Apply default color
20
+ }
21
+ }
22
+
23
+ @mixin border-top($val) {
24
+ $val: if($val == 0, $val, $val + px);
25
+
26
+ border-top-width: $val;
27
+ @if $val != 0 {
28
+ border-top-style: solid;
29
+ border-top-color: var(--border, var(--border));
30
+ }
31
+ }
32
+
33
+ @mixin border-right($val) {
34
+ $val: if($val == 0, $val, $val + px);
35
+
36
+ border-right-width: $val;
37
+ @if $val != 0 {
38
+ border-right-style: solid;
39
+ border-right-color: var(--border, var(--border));
40
+ }
41
+ }
42
+
43
+ @mixin border-bottom($val) {
44
+ $val: if($val == 0, $val, $val + px);
45
+
46
+ border-bottom-width: $val;
47
+ @if $val != 0 {
48
+ border-bottom-style: solid;
49
+ border-bottom-color: var(--border, var(--border));
50
+ }
51
+ }
52
+
53
+ @mixin border-left($val) {
54
+ $val: if($val == 0, $val, $val + px);
55
+
56
+ border-left-width: $val;
57
+ @if $val != 0 {
58
+ border-left-style: solid;
59
+ border-left-color: var(--border, var(--border));
60
+ }
61
+ }
62
+
63
+ // Border Radius Mixins
64
+ @mixin rounded($val: map.get($border-radii, 'md')) {
65
+ border-radius: $val;
66
+ }
67
+
68
+ @mixin rounded-t($val) {
69
+ border-top-left-radius: $val;
70
+ border-top-right-radius: $val;
71
+ }
72
+
73
+ @mixin rounded-r($val) {
74
+ border-top-right-radius: $val;
75
+ border-bottom-right-radius: $val;
76
+ }
77
+
78
+ @mixin rounded-b($val) {
79
+ border-bottom-left-radius: $val;
80
+ border-bottom-right-radius: $val;
81
+ }
82
+
83
+ @mixin rounded-l($val) {
84
+ border-top-left-radius: $val;
85
+ border-bottom-left-radius: $val;
86
+ }
87
+
88
+ @mixin rounded-tl($val) { border-top-left-radius: $val; }
89
+ @mixin rounded-tr($val) { border-top-right-radius: $val; }
90
+ @mixin rounded-br($val) { border-bottom-right-radius: $val; }
91
+ @mixin rounded-bl($val) { border-bottom-left-radius: $val; }
92
+
93
+ // Border Style and Color
94
+ @mixin border-style($style) { border-style: $style; }
95
+ @mixin border-color($color) { border-color: $color; }
96
+
97
+ // Combined border properties
98
+ @mixin border-all($width, $style, $color) {
99
+ border-width: $width;
100
+ border-style: $style;
101
+ border-color: $color;
102
+ }
103
+
104
+ // -----------------------------------------------
105
+ // VARIABLES
106
+ // -----------------------------------------------
107
+
108
+ // Common border width values that are most useful
109
+ $border-widths: (0, 1, 2, 4, 8);
110
+
111
+ // Common border radius values that are most useful
112
+ $border-radii: (
113
+ 'xs': 0.25rem,
114
+ 'sm': 0.375rem,
115
+ 'md': 0.5rem,
116
+ 'lg': 0.75rem,
117
+ 'xl': 1rem,
118
+ '2xl': 1.25rem,
119
+ 'full': 9999px,
120
+ 'none': 0
121
+ );
122
+
123
+ // Common border styles
124
+ $border-styles: (solid, dashed, dotted, double, none);
125
+
126
+ // -----------------------------------------------
127
+ // UTILITY CLASSES
128
+ // -----------------------------------------------
129
+
130
+ // Basic border classes (all sides)
10
131
  .border { @include border(1); }
11
132
  .border-0 { @include border(0); }
12
133
 
13
- @each $i in 0 1 2 4 8 {
14
- .border-#{$i} { @include border($i); }
134
+ // All sides border width
135
+ @each $width in $border-widths {
136
+ .border-#{$width} { @include border($width); }
15
137
  }
16
138
 
17
- .rounded { @include rounded(0.25rem); }
18
- .square { @include rounded(0) }
19
- .pill { @include rounded(9999px); }
139
+ // Directional border width
140
+ @each $width in $border-widths {
141
+ .border-t-#{$width} { @include border-top($width); }
142
+ .border-r-#{$width} { @include border-right($width); }
143
+ .border-b-#{$width} { @include border-bottom($width); }
144
+ .border-l-#{$width} { @include border-left($width); }
145
+ }
146
+
147
+ // Common shortcuts for single-side borders
148
+ .border-t { @include border-top(1); }
149
+ .border-r { @include border-right(1); }
150
+ .border-b { @include border-bottom(1); }
151
+ .border-l { @include border-left(1); }
152
+
153
+ // Border radius classes
154
+ .rounded { @include rounded; } // Default rounded
155
+ .square { @include rounded(0); } // Alias for no radius
156
+
157
+ @each $name, $value in $border-radii {
158
+ .rounded-#{$name} { @include rounded($value); }
159
+ }
160
+
161
+ // Directional border radius
162
+ @each $name, $value in $border-radii {
163
+ .rounded-t-#{$name} { @include rounded-t($value); }
164
+ .rounded-r-#{$name} { @include rounded-r($value); }
165
+ .rounded-b-#{$name} { @include rounded-b($value); }
166
+ .rounded-l-#{$name} { @include rounded-l($value); }
20
167
 
21
- // Responsive Position Classes
168
+ // Individual corners
169
+ .rounded-tl-#{$name} { @include rounded-tl($value); }
170
+ .rounded-tr-#{$name} { @include rounded-tr($value); }
171
+ .rounded-br-#{$name} { @include rounded-br($value); }
172
+ .rounded-bl-#{$name} { @include rounded-bl($value); }
173
+ }
174
+
175
+ // Pill shape (alias for full radius)
176
+ .pill { @include rounded(9999px); }
177
+
178
+ // Border styles - these override the default solid style if needed
179
+ @each $style in $border-styles {
180
+ .border-#{$style} { @include border-style($style); }
181
+ }
182
+
183
+ // Border colors - these override the default color if needed
184
+ .border-default { @include border-color(var(--border)); }
185
+ .border-light { @include border-color(var(--border-light-color)); }
186
+ .border-dark { @include border-color(var(--border-dark-color)); }
187
+ .border-primary { @include border-color(var(--primary)); }
188
+ .border-secondary { @include border-color(var(--secondary)); }
189
+ .border-success { @include border-color(var(--success)); }
190
+ .border-danger { @include border-color(var(--danger)); }
191
+ .border-warning { @include border-color(var(--warning)); }
192
+ .border-info { @include border-color(var(--info)); }
193
+
194
+ // Common combined border utilities (style + color)
195
+ .border-primary-solid {
196
+ @include border-style(solid);
197
+ @include border-color(var(--primary));
198
+ }
199
+
200
+ .border-danger-dashed {
201
+ @include border-style(dashed);
202
+ @include border-color(var(--danger));
203
+ }
204
+
205
+ // -----------------------------------------------
206
+ // HOVER, ACTIVE, AND FOCUS STATES
207
+ // -----------------------------------------------
208
+
209
+ // Hover state border classes
210
+ @each $width in $border-widths {
211
+ .hover\:border-#{$width}:hover { @include border($width); }
212
+ }
213
+
214
+ @each $style in $border-styles {
215
+ .hover\:border-#{$style}:hover { @include border-style($style); }
216
+ }
217
+
218
+ // Border colors on hover
219
+ .hover\:border-default:hover { @include border-color(var(--border)); }
220
+ .hover\:border-light:hover { @include border-color(var(--border-light-color)); }
221
+ .hover\:border-dark:hover { @include border-color(var(--border-dark-color)); }
222
+ .hover\:border-primary:hover { @include border-color(var(--primary)); }
223
+ .hover\:border-secondary:hover { @include border-color(var(--secondary)); }
224
+ .hover\:border-success:hover { @include border-color(var(--success)); }
225
+ .hover\:border-danger:hover { @include border-color(var(--danger)); }
226
+ .hover\:border-warning:hover { @include border-color(var(--warning)); }
227
+ .hover\:border-info:hover { @include border-color(var(--info)); }
228
+
229
+ // Active state border classes
230
+ @each $width in $border-widths {
231
+ .active\:border-#{$width}:active { @include border($width); }
232
+ }
233
+
234
+ @each $style in $border-styles {
235
+ .active\:border-#{$style}:active { @include border-style($style); }
236
+ }
237
+
238
+ // Border colors on active state
239
+ .active\:border-default:active { @include border-color(var(--border)); }
240
+ .active\:border-light:active { @include border-color(var(--border-light-color)); }
241
+ .active\:border-dark:active { @include border-color(var(--border-dark-color)); }
242
+ .active\:border-primary:active { @include border-color(var(--primary)); }
243
+ .active\:border-secondary:active { @include border-color(var(--secondary)); }
244
+ .active\:border-success:active { @include border-color(var(--success)); }
245
+ .active\:border-danger:active { @include border-color(var(--danger)); }
246
+ .active\:border-warning:active { @include border-color(var(--warning)); }
247
+ .active\:border-info:active { @include border-color(var(--info)); }
248
+
249
+ // Focus state border classes
250
+ @each $width in $border-widths {
251
+ .focus\:border-#{$width}:focus { @include border($width); }
252
+ }
253
+
254
+ @each $style in $border-styles {
255
+ .focus\:border-#{$style}:focus { @include border-style($style); }
256
+ }
257
+
258
+ // Border colors on focus
259
+ .focus\:border-default:focus { @include border-color(var(--border)); }
260
+ .focus\:border-light:focus { @include border-color(var(--border-light-color)); }
261
+ .focus\:border-dark:focus { @include border-color(var(--border-dark-color)); }
262
+ .focus\:border-primary:focus { @include border-color(var(--primary)); }
263
+ .focus\:border-secondary:focus { @include border-color(var(--secondary)); }
264
+ .focus\:border-success:focus { @include border-color(var(--success)); }
265
+ .focus\:border-danger:focus { @include border-color(var(--danger)); }
266
+ .focus\:border-warning:focus { @include border-color(var(--warning)); }
267
+ .focus\:border-info:focus { @include border-color(var(--info)); }
268
+
269
+ // -----------------------------------------------
270
+ // RESPONSIVE CLASSES
271
+ // -----------------------------------------------
272
+
22
273
  @each $breakpoint, $width in $breakpoints {
23
- @media (min-width: #{$width}) {
24
- @each $i in 0 2 3 4 5 10 15 20 25 {
25
- .rounded-#{$i}\@#{$breakpoint} { @include border($i); }
26
- }
27
- .rounded\@#{$breakpoint} { @include border(0.25rem); }
274
+ @media (min-width: #{$width}) {
275
+ // Border width responsive
276
+ @each $val in $border-widths {
277
+ .border-#{$val}\@#{$breakpoint} { @include border($val); }
278
+ }
279
+
280
+ // Common shortcuts for responsive
281
+ .border\@#{$breakpoint} { @include border(1); }
282
+ .border-0\@#{$breakpoint} { @include border(0); }
283
+
284
+ // Border radius responsive
285
+ @each $name, $value in $border-radii {
286
+ .rounded-#{$name}\@#{$breakpoint} { @include rounded($value); }
28
287
  }
288
+
289
+ .rounded\@#{$breakpoint} { @include rounded; }
290
+ .square\@#{$breakpoint} { @include rounded(0); }
291
+ .pill\@#{$breakpoint} { @include rounded(9999px); }
292
+ }
29
293
  }
@@ -1,16 +1,18 @@
1
+ // _colors.scss - Color functions and scale generation
1
2
  @use "sass:math";
2
3
  @use 'sass:color';
3
4
  @use 'sass:map';
4
5
  @use 'sass:meta';
5
6
  @use 'sass:list';
6
7
 
7
- @use './variables' as *;
8
+ @use '../abstracts' as *;
8
9
 
9
10
  // Color Validation
10
11
  @function is-valid-color($color) {
11
12
  @return meta.type-of($color) == 'color';
12
13
  }
13
14
 
15
+ // Scale Generation Function
14
16
  @function create-color-scale($color) {
15
17
  $scale: ();
16
18
  $stops: (
@@ -25,62 +27,61 @@
25
27
  800: 25%,
26
28
  900: 15%
27
29
  );
28
-
29
- @each $stop, $mix in $stops {
30
- $value: if($stop == 500,
31
- $color,
32
- if($stop < 500,
33
- color.mix(white, $color, $mix),
34
- color.mix(black, $color, (100% - $mix))
35
- )
36
- );
37
- $scale: map.set($scale, $stop, $value);
30
+
31
+ @each $shade, $lightness in $stops {
32
+ $adjusted-color: $color;
33
+
34
+ @if $shade < 500 {
35
+ // Lighter shades: mix with white
36
+ $mix-percentage: math.div($lightness - 50%, 50%) * 100%;
37
+ $adjusted-color: color.mix(white, $color, $mix-percentage);
38
+ } @else if $shade > 500 {
39
+ // Darker shades: mix with black
40
+ $mix-percentage: math.div(50% - $lightness, 50%) * 100%;
41
+ $adjusted-color: color.mix(black, $color, $mix-percentage);
42
+ }
43
+
44
+ $scale: map.set($scale, $shade, $adjusted-color);
38
45
  }
39
46
 
40
47
  @return $scale;
41
- }
42
-
43
-
44
- // Color Relationship Functions
45
- @function find-text-color($color) {
46
- $luminance: luminance($color);
47
- @return if($luminance > 0.55, #000, #fff);
48
48
  }
49
49
 
50
- // Luminance Calculation
50
+ // Luminance calculation for contrast
51
51
  @function luminance($color) {
52
- $r: color.red($color) / 255;
53
- $g: color.green($color) / 255;
54
- $b: color.blue($color) / 255;
52
+ $red: math.div(color.channel($color, "red"), 255);
53
+ $green: math.div(color.channel($color, "green"), 255);
54
+ $blue: math.div(color.channel($color, "blue"), 255);
55
55
 
56
- $r: if($r <= 0.0393, $r / 12.92, pow(($r + 0.055) / 1.055, 2.4));
57
- $g: if($g <= 0.0393, $g / 12.92, pow(($g + 0.055) / 1.055, 2.4));
58
- $b: if($b <= 0.0393, $b / 12.92, pow(($b + 0.055) / 1.055, 2.4));
56
+ $red: if($red <= 0.0393, math.div($red, 12.92), math.pow((math.div($red + 0.055, 1.055)), 2.4));
57
+ $green: if($green <= 0.0393, math.div($green, 12.92), math.pow((math.div($green + 0.055, 1.055)), 2.4));
58
+ $blue: if($blue <= 0.0393, math.div($blue, 12.92), math.pow((math.div($blue + 0.055, 1.055)), 2.4));
59
59
 
60
- @return $r * 0.2126 + $g * 0.7152 + $b * 0.0722;
60
+ @return 0.2126 * $red + 0.7152 * $green + 0.0722 * $blue;
61
+ }
62
+
63
+ // Find appropriate text color for a background
64
+ @function find-text-color($background) {
65
+ $luminance: luminance($background);
66
+ @return if($luminance > 0.55, #000, #fff);
61
67
  }
62
68
 
63
- // Context-Aware Colors
69
+ // Adaptive contrast mixin
64
70
  @mixin adaptive-contrast($color) {
65
- background: $color;
71
+ background-color: $color;
66
72
  color: find-text-color($color);
67
73
 
68
74
  @media (prefers-contrast: more) {
69
- $high-contrast: adjust-contrast($color, 20%);
70
-
71
- background: $high-contrast;
72
- }
73
- }
74
-
75
- // Filter Mixins
76
- @mixin backdrop-filter($value) {
77
- backdrop-filter: $value;
78
- }
75
+ $adjusted: if(color.lightness($color) > 50%,
76
+ color.adjust($color, $lightness: -10%),
77
+ color.adjust($color, $lightness: 10%));
79
78
 
80
- @mixin filter($value) {
81
- filter: $value;
79
+ background-color: $adjusted;
80
+ color: find-text-color($adjusted);
81
+ }
82
82
  }
83
83
 
84
+ // Generate color scales
84
85
  $colors: (
85
86
  'primary': create-color-scale($primary),
86
87
  'secondary': create-color-scale($secondary),
@@ -88,17 +89,35 @@ $colors: (
88
89
  'danger': create-color-scale($danger),
89
90
  'warning': create-color-scale($warning),
90
91
  'info': create-color-scale($info)
91
- );
92
+ );
92
93
 
93
- // Glass Effect Utilities
94
- .glass-effect {
95
- @include backdrop-filter(blur(10px));
94
+ // Generate scales for primitives
95
+ $colors-primitives: ();
96
96
 
97
- background-color: rgb(255 255 255 / 10%);
97
+ @each $name, $color in $color-primitives {
98
+ $colors-primitives: map.set($colors-primitives, $name, create-color-scale($color));
98
99
  }
99
100
 
100
- .frosted-glass {
101
- @include backdrop-filter(blur(5px) saturate(180%));
102
-
103
- background-color: rgb(255 255 255 / 80%);
101
+ // todo: documentation
102
+ @mixin bg($color) {
103
+ & {
104
+ background-color: $color;
105
+ }
106
+ }
107
+ @mixin color($color) {
108
+ & {
109
+ color: $color;
110
+ }
111
+ }
112
+ @mixin gradient($direction, $colors...) {
113
+ background-image: linear-gradient($direction, $colors);
104
114
  }
115
+
116
+ // Filter Mixins
117
+ @mixin backdrop-filter($value) {
118
+ backdrop-filter: $value;
119
+ }
120
+
121
+ @mixin filter($value) {
122
+ filter: $value;
123
+ }
@@ -1,8 +1,8 @@
1
- @use 'sass:map';
2
- @use 'sass:meta';
3
- @use './variables' as *;
4
- @use './functions' as FN;
5
-
1
+ @use "sass:map";
2
+ @use "sass:meta";
3
+ @use "../abstracts" as *;
4
+ @use "../abstracts/functions" as FN;
5
+
6
6
  /**
7
7
  * Container Query Mixins
8
8
  *
@@ -48,13 +48,13 @@
48
48
  @mixin container-only($breakpoint, $containerName: null) {
49
49
  $min: FN.get-breakpoint-value($breakpoint);
50
50
  $next-breakpoint: null;
51
-
51
+
52
52
  @each $name, $width in $breakpoints {
53
53
  @if $width > $min and (not $next-breakpoint or $width < $next-breakpoint) {
54
54
  $next-breakpoint: $width;
55
55
  }
56
56
  }
57
-
57
+
58
58
  @if $next-breakpoint {
59
59
  @container #{$containerName} (min-width: #{$min}) and (max-width: (#{ $next-breakpoint } - 0.02px)) {
60
60
  @content;
@@ -81,7 +81,6 @@
81
81
  container-name: $name;
82
82
  }
83
83
 
84
-
85
84
  // Utility classes
86
85
  .container-inline-size {
87
86
  container-type: inline-size;
@@ -91,8 +90,8 @@
91
90
  container-type: size;
92
91
  }
93
92
 
94
- @each $name in ('main', 'sidebar', 'card', 'section') {
93
+ @each $name in ("main", "sidebar", "card", "section") {
95
94
  .container-#{$name} {
96
95
  container-name: $name;
97
96
  }
98
- }
97
+ }
@@ -1,8 +1,8 @@
1
1
  // Section: Utilities
2
2
  // Module: Display
3
3
 
4
- @use './variables' as *;
5
- @use './functions' as FN;
4
+ @use '../abstracts' as *;
5
+ @use '../abstracts/functions' as FN;
6
6
 
7
7
  /**
8
8
  * Display Utilities