@nuvoui/core 1.2.3 → 1.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.
@@ -2,6 +2,7 @@
2
2
  @use 'sass:string';
3
3
  @use 'sass:meta';
4
4
  @use '../abstracts' as *;
5
+ @use '../abstracts/functions' as FN;
5
6
 
6
7
 
7
8
  /**
@@ -73,40 +74,6 @@
73
74
  * @see flex, grid, display
74
75
  */
75
76
 
76
- // -----------------------------------------------
77
- // HELPER FUNCTIONS
78
- // -----------------------------------------------
79
-
80
- /**
81
- * @function format-unit-value
82
- * @description Ensures values have appropriate units
83
- * @param {Number|String} $value - The value to format
84
- * @returns {Number|String} Value with appropriate units
85
- * @internal
86
- */
87
-
88
- @function format-unit-value($value) {
89
- // Zero check
90
- @if $value == 0 {
91
- @return 0;
92
- }
93
-
94
- // If pure number (no units), add px
95
- @if meta.type-of($value) == 'number' and math.unit($value) == "" {
96
- @return $value * 1px; // Multiply by 1px instead of adding px
97
- }
98
-
99
- // If number with units (like rem), return as is
100
- @if meta.type-of($value) == 'number' and math.unit($value) != "" {
101
- @return $value; // Already has units, return as is
102
- }
103
-
104
- // Convert value to string for unit checking
105
- $value-str: if(meta.type-of($value) == 'string', string.unquote($value), #{$value});
106
-
107
- @return $value-str;
108
- }
109
-
110
77
 
111
78
  // -----------------------------------------------
112
79
  // PADDING MIXINS
@@ -117,7 +84,7 @@
117
84
  * @description Sets padding on all sides
118
85
  * @param {Number|String} $val - Padding value
119
86
  */
120
- @mixin p($val) { padding: format-unit-value($val); }
87
+ @mixin p($val) { padding: FN.fix-units($val); }
121
88
 
122
89
  /**
123
90
  * @mixin px
@@ -125,10 +92,9 @@
125
92
  * @param {Number|String} $val - Padding value
126
93
  */
127
94
  @mixin px($val) {
128
- $val: format-unit-value($val);
95
+ $val: FN.fix-units($val);
129
96
 
130
- padding-left: $val;
131
- padding-right: $val;
97
+ padding-inline: $val;
132
98
  }
133
99
 
134
100
  /**
@@ -137,10 +103,9 @@
137
103
  * @param {Number|String} $val - Padding value
138
104
  */
139
105
  @mixin py($val) {
140
- $val: format-unit-value($val);
141
-
142
- padding-top: $val;
143
- padding-bottom: $val;
106
+ $val: FN.fix-units($val);
107
+
108
+ padding-block: $val;
144
109
  }
145
110
 
146
111
  /**
@@ -149,7 +114,7 @@
149
114
  * @param {Number|String} $val - Padding value
150
115
  */
151
116
  @mixin pt($val) {
152
- $val: format-unit-value($val);
117
+ $val: FN.fix-units($val);
153
118
 
154
119
  padding-top: $val;
155
120
  }
@@ -160,7 +125,7 @@
160
125
  * @param {Number|String} $val - Padding value
161
126
  */
162
127
  @mixin pr($val) {
163
- $val: format-unit-value($val);
128
+ $val: FN.fix-units($val);
164
129
 
165
130
  padding-right: $val;
166
131
  }
@@ -171,7 +136,7 @@
171
136
  * @param {Number|String} $val - Padding value
172
137
  */
173
138
  @mixin pb($val) {
174
- $val: format-unit-value($val);
139
+ $val: FN.fix-units($val);
175
140
 
176
141
  padding-bottom: $val;
177
142
  }
@@ -182,7 +147,7 @@
182
147
  * @param {Number|String} $val - Padding value
183
148
  */
184
149
  @mixin pl($val) {
185
- $val: format-unit-value($val);
150
+ $val: FN.fix-units($val);
186
151
 
187
152
  padding-left: $val;
188
153
  }
@@ -197,7 +162,7 @@
197
162
  * @param {Number|String} $val - Margin value
198
163
  */
199
164
  @mixin m($val) {
200
- $val: format-unit-value($val);
165
+ $val: FN.fix-units($val);
201
166
 
202
167
  margin: $val;
203
168
  }
@@ -208,10 +173,9 @@
208
173
  * @param {Number|String} $val - Margin value
209
174
  */
210
175
  @mixin mx($val) {
211
- $val: format-unit-value($val);
176
+ $val: FN.fix-units($val);
212
177
 
213
- margin-left: $val;
214
- margin-right: $val;
178
+ margin-inline: $val;
215
179
  }
216
180
 
217
181
  /**
@@ -220,10 +184,9 @@
220
184
  * @param {Number|String} $val - Margin value
221
185
  */
222
186
  @mixin my($val) {
223
- $val: format-unit-value($val);
187
+ $val: FN.fix-units($val);
224
188
 
225
- margin-top: $val;
226
- margin-bottom: $val;
189
+ margin-block: $val;
227
190
  }
228
191
 
229
192
  /**
@@ -232,7 +195,7 @@
232
195
  * @param {Number|String} $val - Margin value
233
196
  */
234
197
  @mixin mt($val) {
235
- $val: format-unit-value($val);
198
+ $val: FN.fix-units($val);
236
199
 
237
200
  margin-top: $val;
238
201
  }
@@ -243,7 +206,7 @@
243
206
  * @param {Number|String} $val - Margin value
244
207
  */
245
208
  @mixin mr($val) {
246
- $val: format-unit-value($val);
209
+ $val: FN.fix-units($val);
247
210
 
248
211
  margin-right: $val;
249
212
  }
@@ -254,7 +217,7 @@
254
217
  * @param {Number|String} $val - Margin value
255
218
  */
256
219
  @mixin mb($val) {
257
- $val: format-unit-value($val);
220
+ $val: FN.fix-units($val);
258
221
 
259
222
  margin-bottom: $val;
260
223
  }
@@ -265,7 +228,7 @@
265
228
  * @param {Number|String} $val - Margin value
266
229
  */
267
230
  @mixin ml($val) {
268
- $val: format-unit-value($val);
231
+ $val: FN.fix-units($val);
269
232
 
270
233
  margin-left: $val;
271
234
  }
@@ -289,6 +252,71 @@
289
252
  @mixin mx-auto { @include ml-auto; @include mr-auto; }
290
253
 
291
254
 
255
+ // -----------------------------------------------
256
+ // INSET MIXINS
257
+ // -----------------------------------------------
258
+
259
+ /**
260
+ * @mixin inset
261
+ * @description Sets all inset properties (top, right, bottom, left)
262
+ * @param {Number|String} $val - Inset value
263
+ */
264
+ @mixin inset($val) {
265
+ $val: FN.fix-units($val);
266
+
267
+ inset: $val;
268
+ }
269
+
270
+ /**
271
+ * @mixin inset-x
272
+ * @description Sets horizontal inset properties (left and right)
273
+ * @param {Number|String} $val - Inset value
274
+ */
275
+ @mixin inset-x($val) {
276
+ $val: FN.fix-units($val);
277
+
278
+ left: $val;
279
+ right: $val;
280
+ }
281
+
282
+ /**
283
+ * @mixin inset-y
284
+ * @description Sets vertical inset properties (top and bottom)
285
+ * @param {Number|String} $val - Inset value
286
+ */
287
+ @mixin inset-y($val) {
288
+ $val: FN.fix-units($val);
289
+
290
+ top: $val;
291
+ bottom: $val;
292
+ }
293
+
294
+ /**
295
+ * @mixin inset-auto
296
+ * @description Sets all inset properties to auto
297
+ */
298
+ @mixin inset-auto {
299
+ inset: auto;
300
+ }
301
+
302
+ /**
303
+ * @mixin inset-x-auto
304
+ * @description Sets horizontal inset properties to auto
305
+ */
306
+ @mixin inset-x-auto {
307
+ left: auto;
308
+ right: auto;
309
+ }
310
+
311
+ /**
312
+ * @mixin inset-y-auto
313
+ * @description Sets vertical inset properties to auto
314
+ */
315
+ @mixin inset-y-auto {
316
+ top: auto;
317
+ bottom: auto;
318
+ }
319
+
292
320
  // -----------------------------------------------
293
321
  // SPACING MIXINS
294
322
  // -----------------------------------------------
@@ -300,7 +328,7 @@
300
328
  */
301
329
  @mixin space-y($i) {
302
330
  & > * + * {
303
- $i: format-unit-value($i);
331
+ $i: FN.fix-units($i);
304
332
 
305
333
  margin-top: $i;
306
334
  }
@@ -313,7 +341,7 @@
313
341
  */
314
342
  @mixin space-x($i) {
315
343
  & > * + * {
316
- $i: format-unit-value($i);
344
+ $i: FN.fix-units($i);
317
345
 
318
346
  margin-left: $i;
319
347
  }
@@ -328,21 +356,21 @@
328
356
  * @description Sets gap between grid/flex children
329
357
  * @param {Number|String} $val - Gap value
330
358
  */
331
- @mixin gap($val) { $val: format-unit-value($val); gap: $val; }
359
+ @mixin gap($val) { $val: FN.fix-units($val); gap: $val; }
332
360
 
333
361
  /**
334
362
  * @mixin gap-x
335
363
  * @description Sets horizontal gap between grid/flex children
336
364
  * @param {Number|String} $val - Gap value
337
365
  */
338
- @mixin gap-x($val) { $val: format-unit-value($val); column-gap: $val; }
366
+ @mixin gap-x($val) { $val: FN.fix-units($val); column-gap: $val; }
339
367
 
340
368
  /**
341
369
  * @mixin gap-y
342
370
  * @description Sets vertical gap between grid/flex children
343
371
  * @param {Number|String} $val - Gap value
344
372
  */
345
- @mixin gap-y($val) { $val: format-unit-value($val); row-gap: $val; }
373
+ @mixin gap-y($val) { $val: FN.fix-units($val); row-gap: $val; }
346
374
 
347
375
  @if $generate-utility-classes {
348
376
  // -----------------------------------------------
@@ -359,6 +387,12 @@
359
387
 
360
388
  .gap-auto { gap: auto; }
361
389
 
390
+ // Auto inset utility classes
391
+ .inset-auto { @include inset-auto; }
392
+ .inset-x-auto { @include inset-x-auto; }
393
+ .inset-y-auto { @include inset-y-auto; }
394
+
395
+
362
396
  // -----------------------------------------------
363
397
  // SPACING CLASSES
364
398
  // -----------------------------------------------
@@ -390,6 +424,11 @@
390
424
  // Space classes
391
425
  .space-x-#{$key} { @include space-x($value); }
392
426
  .space-y-#{$key} { @include space-y($value); }
427
+
428
+ .inset-#{$key} { @include inset($value); }
429
+ .inset-x-#{$key} { @include inset-x($value); }
430
+ .inset-y-#{$key} { @include inset-y($value); }
431
+
393
432
  }
394
433
 
395
434
 
@@ -402,6 +441,9 @@
402
441
  .mx-auto\@#{$breakpoint} { @include mx-auto; }
403
442
  .ml-auto\@#{$breakpoint} { @include ml-auto; }
404
443
  .mr-auto\@#{$breakpoint} { @include mr-auto; }
444
+ .inset-auto\@#{$breakpoint} { @include inset-auto; }
445
+ .inset-x-auto\@#{$breakpoint} { @include inset-x-auto; }
446
+ .inset-y-auto\@#{$breakpoint} { @include inset-y-auto; }
405
447
 
406
448
  // Generate utilities from spacing map
407
449
  @each $key, $value in $spacings {
@@ -430,6 +472,10 @@
430
472
  // Space classes
431
473
  .space-x-#{$key}\@#{$breakpoint} { @include space-x($value); }
432
474
  .space-y-#{$key}\@#{$breakpoint} { @include space-y($value); }
475
+ .inset-#{$key}\@#{$breakpoint} { @include inset($value); }
476
+ .inset-x-#{$key}\@#{$breakpoint} { @include inset-x($value); }
477
+ .inset-y-#{$key}\@#{$breakpoint} { @include inset-y($value); }
478
+
433
479
  }
434
480
  }
435
481
  }
@@ -180,6 +180,9 @@
180
180
  &::before,
181
181
  &::after {
182
182
  inset: auto auto auto 100%;
183
+ left: auto; // Remove any left positioning
184
+ right: 100%; // Position to the left of the element
185
+ top: 50%;
183
186
  transform: translate3d(10px, -50%, 0);
184
187
  }
185
188