@ulu/frontend 0.1.0-beta.65 → 0.1.0-beta.67
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/CHANGELOG.md +11 -0
- package/README.dev.md +2 -2
- package/README.md +6 -0
- package/dist/ulu-frontend.min.css +1 -1
- package/docs-dev/changelog/index.html +23 -0
- package/docs-dev/demos/card/index.html +16 -16
- package/docs-dev/demos/counter-list/index.html +16 -0
- package/docs-dev/demos/data-table/index.html +100 -100
- package/docs-dev/sass/components/counter-list/index.html +9 -8
- package/docs-dev/sass/core/breakpoint/index.html +66 -28
- package/docs-dev/sass/core/utils/index.html +440 -193
- package/package.json +1 -1
- package/scss/_breakpoint.scss +28 -7
- package/scss/_utils.scss +140 -11
- package/scss/components/_counter-list.scss +21 -7
- package/scss/components/_data-grid.scss +17 -0
package/package.json
CHANGED
package/scss/_breakpoint.scss
CHANGED
|
@@ -31,8 +31,6 @@ $config: (
|
|
|
31
31
|
}
|
|
32
32
|
|
|
33
33
|
/// Get a config option
|
|
34
|
-
/// @compiler
|
|
35
|
-
/// @use "index" as ulu;
|
|
36
34
|
/// @example scss {compile} Example usage
|
|
37
35
|
/// .test-get {
|
|
38
36
|
/// font-size: ulu.breakpoint-get("base");
|
|
@@ -70,15 +68,13 @@ $sizes: (
|
|
|
70
68
|
}
|
|
71
69
|
|
|
72
70
|
/// Get all breakpoint sizes
|
|
73
|
-
/// @return {Map} Map of breakpoints (equivalent to $sizes)
|
|
74
71
|
/// @compiler
|
|
75
|
-
/// @use "index" as ulu;
|
|
76
|
-
/// @use "sass:map";
|
|
77
72
|
/// @example scss {compile} Example usage
|
|
78
|
-
/// .test-get {
|
|
73
|
+
/// .test-get-sizes {
|
|
79
74
|
/// $sizes: ulu.breakpoint-get-sizes();
|
|
80
75
|
/// height: map.get($sizes, "medium");
|
|
81
76
|
/// }
|
|
77
|
+
/// @return {Map} Map of breakpoints (equivalent to $sizes)
|
|
82
78
|
|
|
83
79
|
@function get-sizes() {
|
|
84
80
|
@return $sizes;
|
|
@@ -86,14 +82,25 @@ $sizes: (
|
|
|
86
82
|
|
|
87
83
|
/// Get a specific breakpoint's raw value/size
|
|
88
84
|
/// @param {String} $size The name of the size to get
|
|
85
|
+
/// @compiler
|
|
86
|
+
/// @example scss {compile} Example usage
|
|
87
|
+
/// .test-get-size {
|
|
88
|
+
/// height: ulu.breakpoint-get-size("medium");
|
|
89
|
+
/// }
|
|
89
90
|
/// @return {Number} The sizes value
|
|
90
|
-
|
|
91
|
+
|
|
91
92
|
@function get-size($size) {
|
|
92
93
|
@return utils.require-map-get($sizes, $size, "breakpoint size");
|
|
93
94
|
}
|
|
94
95
|
|
|
95
96
|
/// Get a specific breakpoint's size's value and optionally specify max to get the ending/max value for a breakpoint
|
|
96
97
|
/// @param {Boolean} $max [false] Get the max value
|
|
98
|
+
/// @compiler
|
|
99
|
+
/// @example scss {compile} Example usage
|
|
100
|
+
/// .test-get-size-value {
|
|
101
|
+
/// height: ulu.breakpoint-get-size-value("medium", true);
|
|
102
|
+
/// max-height: ulu.breakpoint-get-size-value("medium");
|
|
103
|
+
/// }
|
|
97
104
|
/// @return {Number} The value for the given size
|
|
98
105
|
|
|
99
106
|
@function get-size-value($size, $max: false) {
|
|
@@ -107,6 +114,20 @@ $sizes: (
|
|
|
107
114
|
/// Check if a specific size exist
|
|
108
115
|
/// @param {String} $name The breakpoint size to check if exists
|
|
109
116
|
/// @return {Boolean}
|
|
117
|
+
/// @example scss {compile} Example usage
|
|
118
|
+
/// .test-exists {
|
|
119
|
+
/// @if(ulu.breakpoint-exists("medium")) {
|
|
120
|
+
/// @include ulu.breakpoint-min("medium") {
|
|
121
|
+
/// padding: 2rem;
|
|
122
|
+
/// }
|
|
123
|
+
/// }
|
|
124
|
+
/// // The below content doesn't print because the size doesn't exist.
|
|
125
|
+
/// @if(ulu.breakpoint-exists("too-large")) {
|
|
126
|
+
/// @include ulu.breakpoint-min("too-large") {
|
|
127
|
+
/// padding: 20000rem;
|
|
128
|
+
/// }
|
|
129
|
+
/// }
|
|
130
|
+
/// }
|
|
110
131
|
|
|
111
132
|
@function exists($name) {
|
|
112
133
|
$size: map.get($sizes, $name);
|
package/scss/_utils.scss
CHANGED
|
@@ -34,12 +34,11 @@ $config: (
|
|
|
34
34
|
|
|
35
35
|
/// Get a config option
|
|
36
36
|
/// @param {Map} $name Name of property
|
|
37
|
-
/// @compiler
|
|
38
|
-
/// @use "index" as ulu;
|
|
39
37
|
/// @example scss {compile} Example usage
|
|
40
38
|
/// .test-em-to-pixel {
|
|
41
39
|
/// width: ulu.utils-get("pixel-em-base");
|
|
42
40
|
/// }
|
|
41
|
+
/// @return {Dimension}
|
|
43
42
|
|
|
44
43
|
@function get($name) {
|
|
45
44
|
@return require-map-get($config, $name, 'utils');
|
|
@@ -50,14 +49,12 @@ $config: (
|
|
|
50
49
|
/// @param {Map} $map The map to get the value from
|
|
51
50
|
/// @param {String} $key The key in the map to get value from
|
|
52
51
|
/// @param {String} $context The context of using this function for debugging help
|
|
53
|
-
/// @return {*} The value from the map
|
|
54
|
-
/// @compiler
|
|
55
|
-
/// @use "index" as ulu;
|
|
56
52
|
/// @example scss {compile} Example usage
|
|
57
53
|
/// .test-require-map {
|
|
58
54
|
/// $test-map: ("test-font-size": 12px);
|
|
59
55
|
/// font-size: ulu.utils-require-map-get($test-map, "test-font-size");
|
|
60
56
|
/// }
|
|
57
|
+
/// @return {*} The value from the map
|
|
61
58
|
|
|
62
59
|
@function require-map-get($map, $key, $context: "unknown") {
|
|
63
60
|
// $value: map.get($map, $key);
|
|
@@ -104,6 +101,21 @@ $config: (
|
|
|
104
101
|
/// Returns true if we should include something (map of booleans)
|
|
105
102
|
/// @param {String} $name Name of item to see if it's included
|
|
106
103
|
/// @param {Map} $includes Map of includes
|
|
104
|
+
/// @example scss {compile} Example usage
|
|
105
|
+
/// $include-styles : (
|
|
106
|
+
/// "h2" : true,
|
|
107
|
+
/// "h3" : false
|
|
108
|
+
/// );
|
|
109
|
+
/// @if(ulu.utils-included("h2", $include-styles)) {
|
|
110
|
+
/// h2 {
|
|
111
|
+
/// font-size: 24px;
|
|
112
|
+
/// }
|
|
113
|
+
/// }
|
|
114
|
+
/// @if(ulu.utils-included("h3", $include-styles)) {
|
|
115
|
+
/// h3 {
|
|
116
|
+
/// font-size: 18px;
|
|
117
|
+
/// }
|
|
118
|
+
/// }
|
|
107
119
|
|
|
108
120
|
@function included($name, $includes) {
|
|
109
121
|
$value: map.get($includes, $name);
|
|
@@ -124,10 +136,21 @@ $config: (
|
|
|
124
136
|
}
|
|
125
137
|
}
|
|
126
138
|
|
|
127
|
-
|
|
139
|
+
/// Provide a default when value type is not correct
|
|
128
140
|
/// @param {String} $type type of value it should be
|
|
129
141
|
/// @param {String} $value the value to provide if it is that type
|
|
130
142
|
/// @param {String} $fallback the fallback value
|
|
143
|
+
/// @example scss {compile} Example usage
|
|
144
|
+
/// $user-accent-color: #FE5F55;
|
|
145
|
+
/// $user-error-color: "##C6ECAE";
|
|
146
|
+
/// $default-color: #777DA7;
|
|
147
|
+
/// .accent-color {
|
|
148
|
+
/// background-color: ulu.utils-if-type("color", $user-accent-color, $default-color);
|
|
149
|
+
/// }
|
|
150
|
+
/// .error-color {
|
|
151
|
+
/// background-color: ulu.utils-if-type("color", $user-error-color, $default-color);
|
|
152
|
+
/// }
|
|
153
|
+
/// @return {CssValue} Returns the value or the fallback.
|
|
131
154
|
|
|
132
155
|
@function if-type($type, $value, $fallback) {
|
|
133
156
|
@if meta.type-of($value) == $type {
|
|
@@ -137,9 +160,19 @@ $config: (
|
|
|
137
160
|
}
|
|
138
161
|
}
|
|
139
162
|
|
|
140
|
-
|
|
163
|
+
/// Returns number unit info, and strips the unit
|
|
141
164
|
/// @param {String} $number Number to get meta info for
|
|
142
165
|
/// @return {Map} With properties (unit, value, invalid [true/false if not number])
|
|
166
|
+
/// @example scss {compile} Example usage
|
|
167
|
+
/// $size-info: ulu.utils-number-info(24px);
|
|
168
|
+
/// $size-info-invalid: ulu.utils-number-info("Twenty Four Pixels");
|
|
169
|
+
/// .number-info-result {
|
|
170
|
+
/// content: meta.inspect($size-info);
|
|
171
|
+
/// }
|
|
172
|
+
/// .number-info-invalid-result {
|
|
173
|
+
/// content: meta.inspect($size-info-invalid);
|
|
174
|
+
/// }
|
|
175
|
+
///
|
|
143
176
|
|
|
144
177
|
@function number-info($number, $errors: false) {
|
|
145
178
|
|
|
@@ -167,6 +200,14 @@ $config: (
|
|
|
167
200
|
/// @param {Number} $number The unitless number to add unit to
|
|
168
201
|
/// @param {String} $unit The unit to add to number
|
|
169
202
|
/// @return {String} Number with unit attached (can't be used in maths)
|
|
203
|
+
/// @example scss {compile} Example usage
|
|
204
|
+
/// $number: 12;
|
|
205
|
+
/// $unit: "px";
|
|
206
|
+
/// $number-with-unit: ulu.utils-add-unit($number, $unit);
|
|
207
|
+
/// .add-unit-result {
|
|
208
|
+
/// content: $number-with-unit;
|
|
209
|
+
/// }
|
|
210
|
+
///
|
|
170
211
|
|
|
171
212
|
@function add-unit($number, $unit) {
|
|
172
213
|
@return $number + string.unquote($unit);
|
|
@@ -176,7 +217,18 @@ $config: (
|
|
|
176
217
|
/// @param {Number} $number
|
|
177
218
|
/// @param {String} $other-number
|
|
178
219
|
/// @return {Boolean} Whether they have the same unit type
|
|
179
|
-
|
|
220
|
+
/// Could be made into multiple arguments in future if needed
|
|
221
|
+
/// @example scss {compile} Example usage
|
|
222
|
+
/// $number-1: 12px;
|
|
223
|
+
/// $number-2: 12px;
|
|
224
|
+
/// $number-3: 12rem;
|
|
225
|
+
/// .positive-result {
|
|
226
|
+
/// content: ulu.utils-units-match($number-1, $number-2);
|
|
227
|
+
/// }
|
|
228
|
+
/// .negative-result {
|
|
229
|
+
/// content: ulu.utils-units-match($number-1, $number-3);
|
|
230
|
+
/// }
|
|
231
|
+
///
|
|
180
232
|
|
|
181
233
|
@function units-match($number, $other-number) {
|
|
182
234
|
@return math.unit($number) == math.unit($other-number);
|
|
@@ -186,7 +238,34 @@ $config: (
|
|
|
186
238
|
/// @param {Map} $original Source map
|
|
187
239
|
/// @param {Map} $changes Changes to merge into source map
|
|
188
240
|
/// @param {String} $mode How to merge changes (merge [defualt], deep, or overwrite)
|
|
189
|
-
/// @
|
|
241
|
+
/// @example scss {compile} Example usage
|
|
242
|
+
/// $map-1: (
|
|
243
|
+
/// "inner-map" : (
|
|
244
|
+
/// "color" : "green",
|
|
245
|
+
/// "secondary-color" : "green"
|
|
246
|
+
/// ),
|
|
247
|
+
/// "color" : "green",
|
|
248
|
+
/// "secondary-color" : "green"
|
|
249
|
+
/// );
|
|
250
|
+
/// $map-2: (
|
|
251
|
+
/// "inner-map" : (
|
|
252
|
+
/// "color" : "red"
|
|
253
|
+
/// ),
|
|
254
|
+
/// "color" : "red",
|
|
255
|
+
/// );
|
|
256
|
+
/// .result-default {
|
|
257
|
+
/// $merged-map: ulu.utils-map-merge($map-1, $map-2);
|
|
258
|
+
/// content: meta.inspect($merged-map);
|
|
259
|
+
/// }
|
|
260
|
+
/// .result-deep {
|
|
261
|
+
/// $merged-map-deep: ulu.utils-map-merge($map-1, $map-2, "deep");
|
|
262
|
+
/// content: meta.inspect($merged-map-deep);
|
|
263
|
+
/// }
|
|
264
|
+
/// .result-overwrite {
|
|
265
|
+
/// $merged-map-overwrite: ulu.utils-map-merge($map-1, $map-2, "overwrite");
|
|
266
|
+
/// content: meta.inspect($merged-map-overwrite);
|
|
267
|
+
/// }
|
|
268
|
+
///
|
|
190
269
|
|
|
191
270
|
@function map-merge($original, $changes, $mode: null) {
|
|
192
271
|
@if ($mode == "deep") {
|
|
@@ -202,6 +281,20 @@ $config: (
|
|
|
202
281
|
/// @param {Map} $map Source map
|
|
203
282
|
/// @param {String} $key Property to check for
|
|
204
283
|
/// @return {Boolean}
|
|
284
|
+
/// @example scss {compile} Example usage
|
|
285
|
+
/// $map-1 : (
|
|
286
|
+
/// "has-key" : true
|
|
287
|
+
/// );
|
|
288
|
+
/// $map-2 : (
|
|
289
|
+
/// "missing-key" : true
|
|
290
|
+
/// );
|
|
291
|
+
/// .map-1 {
|
|
292
|
+
/// content: ulu.utils-map-has($map-1, "has-key");
|
|
293
|
+
/// }
|
|
294
|
+
/// .map-2 {
|
|
295
|
+
/// content: ulu.utils-map-has($map-2, "has-key");
|
|
296
|
+
/// }
|
|
297
|
+
///
|
|
205
298
|
|
|
206
299
|
@function map-has($map, $key) {
|
|
207
300
|
@if (meta.type-of($map) != "map") {
|
|
@@ -225,6 +318,17 @@ $config: (
|
|
|
225
318
|
|
|
226
319
|
/// Utility for providing fallbacks, the first truthy value (non false or null) will be returned
|
|
227
320
|
/// @return {*} The first truthy value
|
|
321
|
+
/// @example scss {compile} Example usage
|
|
322
|
+
/// $fallback-text: "No input received";
|
|
323
|
+
/// .user-name:after {
|
|
324
|
+
/// $user-name: "Johnny";
|
|
325
|
+
/// content: ulu.utils-fallback($user-name, $fallback-text);
|
|
326
|
+
/// }
|
|
327
|
+
/// .user-birthdate:after {
|
|
328
|
+
/// $user-birthdate: null;
|
|
329
|
+
/// content: ulu.utils-fallback($user-birthdate, $fallback-text);
|
|
330
|
+
/// }
|
|
331
|
+
///
|
|
228
332
|
|
|
229
333
|
@function fallback($args...) {
|
|
230
334
|
@each $arg in $args {
|
|
@@ -236,6 +340,19 @@ $config: (
|
|
|
236
340
|
}
|
|
237
341
|
|
|
238
342
|
/// Provides fallback values from the same map
|
|
343
|
+
/// @return {*}
|
|
344
|
+
/// @example scss {compile} Example usage
|
|
345
|
+
/// $map: (
|
|
346
|
+
/// "name": doug,
|
|
347
|
+
/// "gpa": "3",
|
|
348
|
+
/// "grade": "B",
|
|
349
|
+
/// );
|
|
350
|
+
/// .fallback-map {
|
|
351
|
+
/// // iterates through properties until it finds one that is a key in the map.
|
|
352
|
+
/// content: ulu.utils-map-fallback($map, "gpa", "grade", "average");
|
|
353
|
+
/// }
|
|
354
|
+
///
|
|
355
|
+
|
|
239
356
|
@function map-fallback($map, $properties...) {
|
|
240
357
|
@each $prop in $properties {
|
|
241
358
|
$value: map.get($map, $prop);
|
|
@@ -252,6 +369,18 @@ $config: (
|
|
|
252
369
|
/// @param {List} $keys The list of keys to check for
|
|
253
370
|
/// @param {List} $options Options for how this behaves
|
|
254
371
|
/// @param {List} $options.with-value Requires that at least one of the map entries from the list has a value other than null
|
|
372
|
+
/// @example scss {compile} Example usage
|
|
373
|
+
/// $map : (
|
|
374
|
+
/// "has-key" : true
|
|
375
|
+
/// );
|
|
376
|
+
/// $keys : (
|
|
377
|
+
/// "has-key",
|
|
378
|
+
/// "needs-key",
|
|
379
|
+
/// );
|
|
380
|
+
/// .map-contains-any-result {
|
|
381
|
+
/// content: ulu.utils-map-contains-any($map, $keys);
|
|
382
|
+
/// }
|
|
383
|
+
///
|
|
255
384
|
@function map-contains-any($map, $keys, $options: ()) {
|
|
256
385
|
@if (meta.type-of($map) != "map") {
|
|
257
386
|
@error "map-contains-any(): Incorrect type for $map (should be map)";
|
|
@@ -278,6 +407,8 @@ $config: (
|
|
|
278
407
|
/// @param {*} $value The value that may need the fallback
|
|
279
408
|
/// @param {Map} $lookup Map of properties to functions (use sass:meta > meta.get-function to populate)
|
|
280
409
|
/// @return {*} The user's original value, or if the value is true get the default value from the provided function
|
|
410
|
+
/// @example scss {compile} Example usage
|
|
411
|
+
///
|
|
281
412
|
|
|
282
413
|
@function function-fallback($prop, $value, $lookup) {
|
|
283
414
|
$arguments: null;
|
|
@@ -484,8 +615,6 @@ $config: (
|
|
|
484
615
|
/// Strips the unit from the number
|
|
485
616
|
/// - Normally this shouldn't be needed
|
|
486
617
|
/// @link https://stackoverflow.com/questions/12328259/how-do-you-strip-the-unit-from-any-number-in-sass/12335841#12335841 Original source (Miriam Suzanne)
|
|
487
|
-
/// @compiler
|
|
488
|
-
/// @use "index" as ulu;
|
|
489
618
|
/// @example scss {compile} Example usage
|
|
490
619
|
/// .test {
|
|
491
620
|
/// line-height: ulu.utils-strip-unit(4rem);
|
|
@@ -3,6 +3,8 @@
|
|
|
3
3
|
/// Outputs a styled list with counters
|
|
4
4
|
|
|
5
5
|
@use "sass:map";
|
|
6
|
+
@use "sass:selector" as sassSelector;
|
|
7
|
+
|
|
6
8
|
@use "../utils";
|
|
7
9
|
@use "../selector";
|
|
8
10
|
@use "../color";
|
|
@@ -21,6 +23,7 @@
|
|
|
21
23
|
/// @prop {CssUnit} counter-font-size [1.2em] The font-size of the counter text.
|
|
22
24
|
/// @prop {Color|String} counter-color [white] The text color of the counter. Accepts color names or hex codes.
|
|
23
25
|
/// @prop {Color|String} counter-background-color ["accent"] The background color of the counter. Refers to a color in the color module.
|
|
26
|
+
/// @prop {String} extra-selector [null] Additional selectors to include table styling.
|
|
24
27
|
|
|
25
28
|
$config: (
|
|
26
29
|
"margin" : (2rem 0),
|
|
@@ -36,6 +39,7 @@ $config: (
|
|
|
36
39
|
"counter-font-family" : null,
|
|
37
40
|
"counter-color" : white,
|
|
38
41
|
"counter-background-color" : "accent",
|
|
42
|
+
"extra-selector" : null
|
|
39
43
|
) !default;
|
|
40
44
|
|
|
41
45
|
/// Change modules $config
|
|
@@ -67,16 +71,26 @@ $config: (
|
|
|
67
71
|
|
|
68
72
|
@mixin styles {
|
|
69
73
|
$prefix: selector.class("counter-list");
|
|
70
|
-
$
|
|
71
|
-
$
|
|
74
|
+
$prefix-item: sassSelector.parse("#{ $prefix }__item");
|
|
75
|
+
$extra-selector: get("extra-selector");
|
|
76
|
+
|
|
77
|
+
$selector: $prefix;
|
|
78
|
+
$selector-item: sassSelector.parse("#{ $prefix } > li, #{ $prefix-item }");
|
|
72
79
|
|
|
73
|
-
|
|
80
|
+
@if ($extra-selector) {
|
|
81
|
+
$selector: sassSelector.parse("#{ $prefix }, #{ $extra-selector }");
|
|
82
|
+
$selector-item: sassSelector.parse("#{ $selector-item }, #{ $extra-selector } > li");
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
#{ $selector } {
|
|
74
86
|
margin: get("margin");
|
|
75
87
|
counter-reset: ulu-counter-list;
|
|
76
88
|
}
|
|
77
89
|
|
|
78
|
-
#{ $
|
|
79
|
-
|
|
90
|
+
#{ $selector-item } {
|
|
91
|
+
$width: get("counter-width");
|
|
92
|
+
$height: utils.fallback(get("counter-height"), $width);
|
|
93
|
+
|
|
80
94
|
display: flex;
|
|
81
95
|
gap: get("counter-gap");
|
|
82
96
|
align-items: get("align-items");
|
|
@@ -121,13 +135,13 @@ $config: (
|
|
|
121
135
|
// Modifiers
|
|
122
136
|
#{ $prefix }--alphabetical {
|
|
123
137
|
& > li::before,
|
|
124
|
-
& > #{ $prefix }
|
|
138
|
+
& > #{ $prefix-item }::before {
|
|
125
139
|
content: counter(ulu-counter-list, upper-alpha);
|
|
126
140
|
}
|
|
127
141
|
}
|
|
128
142
|
#{ $prefix }--numeric {
|
|
129
143
|
& > li::before,
|
|
130
|
-
& > #{ $prefix }
|
|
144
|
+
& > #{ $prefix-item }::before {
|
|
131
145
|
content: counter(ulu-counter-list, numeric);
|
|
132
146
|
}
|
|
133
147
|
}
|
|
@@ -664,6 +664,23 @@ $config: (
|
|
|
664
664
|
}
|
|
665
665
|
}
|
|
666
666
|
|
|
667
|
+
&#{'[#{ $attribute }*="gutters-row:"]'} {
|
|
668
|
+
> #{ $select-item } {
|
|
669
|
+
padding-top: $gutter;
|
|
670
|
+
padding-bottom: $gutter;
|
|
671
|
+
}
|
|
672
|
+
@if $extra-gutter-scales {
|
|
673
|
+
@each $scale, $amount in $extra-gutter-scales {
|
|
674
|
+
&#{'[#{ $attribute }*="gutter-scale: #{ $scale }"]'} {
|
|
675
|
+
> #{ $select-item } {
|
|
676
|
+
padding-top: $gutter * $amount;
|
|
677
|
+
padding-bottom: $gutter * $amount;
|
|
678
|
+
}
|
|
679
|
+
}
|
|
680
|
+
}
|
|
681
|
+
}
|
|
682
|
+
}
|
|
683
|
+
|
|
667
684
|
@include -create-column-widths(
|
|
668
685
|
$columns: $columns,
|
|
669
686
|
$attribute-item: $attribute-item,
|