nsw-design-system 3.5.2 → 3.6.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/dist/css/core.css +1 -1
- package/dist/css/main.css +1 -1
- package/dist/js/main.js +41 -33
- package/package.json +1 -1
- package/src/components/filters/filters.js +24 -17
- package/src/components/select/select.js +2 -0
- package/src/core/spacing/_spacing.scss +24 -18
- package/src/global/scss/base/_functions.scss +17 -0
- package/src/global/scss/base/_mixins.scss +116 -0
- package/src/global/scss/helpers/_all.scss +4 -2
- package/src/global/scss/helpers/_api.scss +18 -0
- package/src/global/scss/helpers/_text.scss +4 -0
- package/src/global/scss/helpers/_utilities.scss +414 -0
- package/src/global/scss/settings/_settings.scss +63 -0
- package/src/global/scss/settings/_theme.scss +3 -0
- package/src/global/scss/helpers/_shadow.scss +0 -3
package/dist/js/main.js
CHANGED
|
@@ -788,38 +788,43 @@
|
|
|
788
788
|
}
|
|
789
789
|
}
|
|
790
790
|
selectedItems() {
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
791
|
+
const stateCheck = setInterval(() => {
|
|
792
|
+
if (document.readyState === 'complete') {
|
|
793
|
+
clearInterval(stateCheck);
|
|
794
|
+
this.filtersItems.forEach(filter => {
|
|
795
|
+
const button = filter.querySelector('.nsw-filters__item-name');
|
|
796
|
+
const content = filter.querySelector('.nsw-filters__item-content');
|
|
797
|
+
const text = content ? content.querySelectorAll('input[type="text"]') : null;
|
|
798
|
+
const selects = content ? content.querySelectorAll('select') : null;
|
|
799
|
+
const checkboxes = content ? content.querySelectorAll('input[type="checkbox"]:not([id$="-all"])') : null;
|
|
800
|
+
if (!content) return;
|
|
801
|
+
this.updateCount({
|
|
802
|
+
array: text,
|
|
803
|
+
title: button
|
|
804
|
+
});
|
|
805
|
+
this.updateCount({
|
|
806
|
+
array: selects,
|
|
807
|
+
title: button
|
|
808
|
+
});
|
|
809
|
+
this.updateCount({
|
|
810
|
+
array: checkboxes,
|
|
811
|
+
title: button
|
|
812
|
+
});
|
|
813
|
+
this.updateStatus({
|
|
814
|
+
array: text,
|
|
815
|
+
title: button
|
|
816
|
+
});
|
|
817
|
+
this.updateStatus({
|
|
818
|
+
array: selects,
|
|
819
|
+
title: button
|
|
820
|
+
});
|
|
821
|
+
this.updateStatus({
|
|
822
|
+
array: checkboxes,
|
|
823
|
+
title: button
|
|
824
|
+
});
|
|
825
|
+
});
|
|
826
|
+
}
|
|
827
|
+
}, 100);
|
|
823
828
|
}
|
|
824
829
|
clearAllFilters(e) {
|
|
825
830
|
e.preventDefault();
|
|
@@ -829,7 +834,7 @@
|
|
|
829
834
|
const content = filter.querySelector('.nsw-filters__item-content');
|
|
830
835
|
const text = content.querySelectorAll('input[type="text"]');
|
|
831
836
|
const selects = content.querySelectorAll('select');
|
|
832
|
-
const checkboxes = content.querySelectorAll('input[type="checkbox"]');
|
|
837
|
+
const checkboxes = content.querySelectorAll('input[type="checkbox"]:not([id$="-all"])');
|
|
833
838
|
const allFields = [...text, ...selects, ...checkboxes];
|
|
834
839
|
if (!content) return;
|
|
835
840
|
if (allFields.length > 0) {
|
|
@@ -838,6 +843,7 @@
|
|
|
838
843
|
if (this.constructor.getCondition(field) && (field.type === 'text' || field.type === 'select-one')) {
|
|
839
844
|
field.value = '';
|
|
840
845
|
} else {
|
|
846
|
+
field.click();
|
|
841
847
|
field.checked = false;
|
|
842
848
|
}
|
|
843
849
|
});
|
|
@@ -1205,11 +1211,13 @@
|
|
|
1205
1211
|
this.customOptions.forEach(check => {
|
|
1206
1212
|
const input = check.querySelector('.nsw-form__checkbox-input');
|
|
1207
1213
|
if (count === this.options.length) {
|
|
1214
|
+
input.click();
|
|
1208
1215
|
input.checked = false;
|
|
1209
1216
|
input.removeAttribute('checked');
|
|
1210
1217
|
check.setAttribute('aria-selected', 'false');
|
|
1211
1218
|
this.updateNativeSelect(check.getAttribute('data-index'), false);
|
|
1212
1219
|
} else {
|
|
1220
|
+
input.click();
|
|
1213
1221
|
input.checked = true;
|
|
1214
1222
|
input.setAttribute('checked', '');
|
|
1215
1223
|
check.setAttribute('aria-selected', 'true');
|
package/package.json
CHANGED
|
@@ -231,6 +231,7 @@ class Filters {
|
|
|
231
231
|
updateCount(options) {
|
|
232
232
|
const id = uniqueId()
|
|
233
233
|
const GroupArray = []
|
|
234
|
+
|
|
234
235
|
if (options.array.length > 0) {
|
|
235
236
|
options.array.forEach((element, index) => {
|
|
236
237
|
const getEventType = this.constructor.getEventType(element.type)
|
|
@@ -307,22 +308,27 @@ class Filters {
|
|
|
307
308
|
}
|
|
308
309
|
|
|
309
310
|
selectedItems() {
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
311
|
+
const stateCheck = setInterval(() => {
|
|
312
|
+
if (document.readyState === 'complete') {
|
|
313
|
+
clearInterval(stateCheck)
|
|
314
|
+
this.filtersItems.forEach((filter) => {
|
|
315
|
+
const button = filter.querySelector('.nsw-filters__item-name')
|
|
316
|
+
const content = filter.querySelector('.nsw-filters__item-content')
|
|
317
|
+
const text = content ? content.querySelectorAll('input[type="text"]') : null
|
|
318
|
+
const selects = content ? content.querySelectorAll('select') : null
|
|
319
|
+
const checkboxes = content ? content.querySelectorAll('input[type="checkbox"]:not([id$="-all"])') : null
|
|
320
|
+
|
|
321
|
+
if (!content) return
|
|
322
|
+
|
|
323
|
+
this.updateCount({ array: text, title: button })
|
|
324
|
+
this.updateCount({ array: selects, title: button })
|
|
325
|
+
this.updateCount({ array: checkboxes, title: button })
|
|
326
|
+
this.updateStatus({ array: text, title: button })
|
|
327
|
+
this.updateStatus({ array: selects, title: button })
|
|
328
|
+
this.updateStatus({ array: checkboxes, title: button })
|
|
329
|
+
})
|
|
330
|
+
}
|
|
331
|
+
}, 100)
|
|
326
332
|
}
|
|
327
333
|
|
|
328
334
|
clearAllFilters(e) {
|
|
@@ -333,7 +339,7 @@ class Filters {
|
|
|
333
339
|
const content = filter.querySelector('.nsw-filters__item-content')
|
|
334
340
|
const text = content.querySelectorAll('input[type="text"]')
|
|
335
341
|
const selects = content.querySelectorAll('select')
|
|
336
|
-
const checkboxes = content.querySelectorAll('input[type="checkbox"]')
|
|
342
|
+
const checkboxes = content.querySelectorAll('input[type="checkbox"]:not([id$="-all"])')
|
|
337
343
|
const allFields = [...text, ...selects, ...checkboxes]
|
|
338
344
|
|
|
339
345
|
if (!content) return
|
|
@@ -344,6 +350,7 @@ class Filters {
|
|
|
344
350
|
if (this.constructor.getCondition(field) && (field.type === 'text' || field.type === 'select-one')) {
|
|
345
351
|
field.value = ''
|
|
346
352
|
} else {
|
|
353
|
+
field.click()
|
|
347
354
|
field.checked = false
|
|
348
355
|
}
|
|
349
356
|
})
|
|
@@ -160,12 +160,14 @@ class Select {
|
|
|
160
160
|
const input = check.querySelector('.nsw-form__checkbox-input')
|
|
161
161
|
|
|
162
162
|
if (count === this.options.length) {
|
|
163
|
+
input.click()
|
|
163
164
|
input.checked = false
|
|
164
165
|
input.removeAttribute('checked')
|
|
165
166
|
check.setAttribute('aria-selected', 'false')
|
|
166
167
|
|
|
167
168
|
this.updateNativeSelect(check.getAttribute('data-index'), false)
|
|
168
169
|
} else {
|
|
170
|
+
input.click()
|
|
169
171
|
input.checked = true
|
|
170
172
|
input.setAttribute('checked', '')
|
|
171
173
|
check.setAttribute('aria-selected', 'true')
|
|
@@ -1,8 +1,14 @@
|
|
|
1
|
+
/* stylelint-disable declaration-no-important */
|
|
2
|
+
|
|
1
3
|
.nsw-block {
|
|
2
4
|
@include component-spacing();
|
|
3
5
|
}
|
|
4
6
|
|
|
5
7
|
$spacers: (
|
|
8
|
+
0: (
|
|
9
|
+
mobile: 0,
|
|
10
|
+
desktop: 0
|
|
11
|
+
),
|
|
6
12
|
xs: (
|
|
7
13
|
mobile: 4px,
|
|
8
14
|
desktop: 8px
|
|
@@ -35,64 +41,64 @@ $spacers: (
|
|
|
35
41
|
$length-desktop: rem(map-get($lengths, desktop));
|
|
36
42
|
|
|
37
43
|
.#{$abbrev}-#{$size} {
|
|
38
|
-
#{$prop}: $length-mobile;
|
|
44
|
+
#{$prop}: $length-mobile !important;
|
|
39
45
|
}
|
|
40
46
|
|
|
41
47
|
.#{$abbrev}-top-#{$size} {
|
|
42
|
-
#{$prop}-top: $length-mobile;
|
|
48
|
+
#{$prop}-top: $length-mobile !important;
|
|
43
49
|
}
|
|
44
50
|
|
|
45
51
|
.#{$abbrev}-right-#{$size} {
|
|
46
|
-
#{$prop}-right: $length-mobile;
|
|
52
|
+
#{$prop}-right: $length-mobile !important;
|
|
47
53
|
}
|
|
48
54
|
|
|
49
55
|
.#{$abbrev}-bottom-#{$size} {
|
|
50
|
-
#{$prop}-bottom: $length-mobile;
|
|
56
|
+
#{$prop}-bottom: $length-mobile !important;
|
|
51
57
|
}
|
|
52
58
|
|
|
53
59
|
.#{$abbrev}-left-#{$size} {
|
|
54
|
-
#{$prop}-left: $length-mobile;
|
|
60
|
+
#{$prop}-left: $length-mobile !important;
|
|
55
61
|
}
|
|
56
62
|
|
|
57
63
|
.#{$abbrev}-x-#{$size} {
|
|
58
|
-
#{$prop}-left: $length-mobile;
|
|
59
|
-
#{$prop}-right: $length-mobile;
|
|
64
|
+
#{$prop}-left: $length-mobile !important;
|
|
65
|
+
#{$prop}-right: $length-mobile !important;
|
|
60
66
|
}
|
|
61
67
|
|
|
62
68
|
.#{$abbrev}-y-#{$size} {
|
|
63
|
-
#{$prop}-top: $length-mobile;
|
|
64
|
-
#{$prop}-bottom: $length-mobile;
|
|
69
|
+
#{$prop}-top: $length-mobile !important;
|
|
70
|
+
#{$prop}-bottom: $length-mobile !important;
|
|
65
71
|
}
|
|
66
72
|
|
|
67
73
|
@include breakpoint('lg') {
|
|
68
74
|
.#{$abbrev}-#{$size} {
|
|
69
|
-
#{$prop}: $length-desktop;
|
|
75
|
+
#{$prop}: $length-desktop !important;
|
|
70
76
|
}
|
|
71
77
|
|
|
72
78
|
.#{$abbrev}-top-#{$size} {
|
|
73
|
-
#{$prop}-top: $length-desktop;
|
|
79
|
+
#{$prop}-top: $length-desktop !important;
|
|
74
80
|
}
|
|
75
81
|
|
|
76
82
|
.#{$abbrev}-right-#{$size} {
|
|
77
|
-
#{$prop}-right: $length-desktop;
|
|
83
|
+
#{$prop}-right: $length-desktop !important;
|
|
78
84
|
}
|
|
79
85
|
|
|
80
86
|
.#{$abbrev}-bottom-#{$size} {
|
|
81
|
-
#{$prop}-bottom: $length-desktop;
|
|
87
|
+
#{$prop}-bottom: $length-desktop !important;
|
|
82
88
|
}
|
|
83
89
|
|
|
84
90
|
.#{$abbrev}-left-#{$size} {
|
|
85
|
-
#{$prop}-left: $length-desktop;
|
|
91
|
+
#{$prop}-left: $length-desktop !important;
|
|
86
92
|
}
|
|
87
93
|
|
|
88
94
|
.#{$abbrev}-x-#{$size} {
|
|
89
|
-
#{$prop}-left: $length-desktop;
|
|
90
|
-
#{$prop}-right: $length-desktop;
|
|
95
|
+
#{$prop}-left: $length-desktop !important;
|
|
96
|
+
#{$prop}-right: $length-desktop !important;
|
|
91
97
|
}
|
|
92
98
|
|
|
93
99
|
.#{$abbrev}-y-#{$size} {
|
|
94
|
-
#{$prop}-top: $length-desktop;
|
|
95
|
-
#{$prop}-bottom: $length-desktop;
|
|
100
|
+
#{$prop}-top: $length-desktop !important;
|
|
101
|
+
#{$prop}-bottom: $length-desktop !important;
|
|
96
102
|
}
|
|
97
103
|
}
|
|
98
104
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
@use 'sass:math';
|
|
2
2
|
|
|
3
|
+
/* stylelint-disable declaration-no-important, string-quotes, number-leading-zero */
|
|
3
4
|
@function rem($value) {
|
|
4
5
|
@if (unitless($value)) {
|
|
5
6
|
$value: $value * 1px;
|
|
@@ -44,3 +45,19 @@
|
|
|
44
45
|
|
|
45
46
|
@return $string;
|
|
46
47
|
}
|
|
48
|
+
|
|
49
|
+
@function breakpoint-min($name, $breakpoints: $nsw-breakpoints) {
|
|
50
|
+
$min: map-get($breakpoints, $name);
|
|
51
|
+
|
|
52
|
+
@return if($min != 0, $min, null);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
@function breakpoint-max($name, $breakpoints: $nsw-breakpoints) {
|
|
56
|
+
$max: map-get($breakpoints, $name);
|
|
57
|
+
|
|
58
|
+
@return if($max and $max > 0, $max - .02, null);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
@function breakpoint-infix($name, $breakpoints: $nsw-breakpoints) {
|
|
62
|
+
@return if(breakpoint-min($name, $breakpoints) == null, "", "-#{$name}");
|
|
63
|
+
}
|
|
@@ -246,3 +246,119 @@
|
|
|
246
246
|
}
|
|
247
247
|
}
|
|
248
248
|
}
|
|
249
|
+
|
|
250
|
+
@mixin media-breakpoint-up($name, $breakpoints: $nsw-breakpoints) {
|
|
251
|
+
$min: breakpoint-min($name, $breakpoints);
|
|
252
|
+
@if $min {
|
|
253
|
+
@media (min-width: $min) {
|
|
254
|
+
@content;
|
|
255
|
+
}
|
|
256
|
+
} @else {
|
|
257
|
+
@content;
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
@mixin text-truncate() {
|
|
262
|
+
overflow: hidden;
|
|
263
|
+
text-overflow: ellipsis;
|
|
264
|
+
white-space: nowrap;
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
// Utility generator
|
|
268
|
+
// Used to generate utilities & print utilities
|
|
269
|
+
/* stylelint-disable string-quotes, number-leading-zero */
|
|
270
|
+
@mixin generate-utility($utility, $infix: "", $is-rfs-media-query: false) {
|
|
271
|
+
$values: map-get($utility, values);
|
|
272
|
+
|
|
273
|
+
// If the values are a list or string, convert it into a map
|
|
274
|
+
@if type-of($values) == "string" or type-of(nth($values, 1)) != "list" {
|
|
275
|
+
$values: zip($values, $values);
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
@each $key, $value in $values {
|
|
279
|
+
$properties: map-get($utility, property);
|
|
280
|
+
|
|
281
|
+
// Multiple properties are possible, for example with vertical or horizontal margins or paddings
|
|
282
|
+
@if type-of($properties) == "string" {
|
|
283
|
+
$properties: append((), $properties);
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
// Use custom class if present
|
|
287
|
+
$property-class: if(map-has-key($utility, class), map-get($utility, class), nth($properties, 1));
|
|
288
|
+
$property-class: if($property-class == null, "", $property-class);
|
|
289
|
+
|
|
290
|
+
// Use custom CSS variable name if present, otherwise default to `class`
|
|
291
|
+
$css-variable-name: if(map-has-key($utility, css-variable-name), map-get($utility, css-variable-name), map-get($utility, class));
|
|
292
|
+
|
|
293
|
+
// State params to generate pseudo-classes
|
|
294
|
+
$state: if(map-has-key($utility, state), map-get($utility, state), ());
|
|
295
|
+
|
|
296
|
+
$infix: if($property-class == "" and str-slice($infix, 1, 1) == "-", str-slice($infix, 2), $infix);
|
|
297
|
+
|
|
298
|
+
// Don't prefix if value key is null (e.g. with shadow class)
|
|
299
|
+
$property-class-modifier: if($key, if($property-class == "" and $infix == "", "", "-") + $key, "");
|
|
300
|
+
|
|
301
|
+
@if map-get($utility, rfs) {
|
|
302
|
+
// Inside the media query
|
|
303
|
+
@if $is-rfs-media-query {
|
|
304
|
+
$val: rfs-value($value);
|
|
305
|
+
|
|
306
|
+
// Do not render anything if fluid and non fluid values are the same
|
|
307
|
+
$value: if($val == rfs-fluid-value($value), null, $val);
|
|
308
|
+
}
|
|
309
|
+
@else {
|
|
310
|
+
$value: rfs-fluid-value($value);
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
$is-css-var: map-get($utility, css-var);
|
|
315
|
+
$is-local-vars: map-get($utility, local-vars);
|
|
316
|
+
$is-rtl: map-get($utility, rtl);
|
|
317
|
+
|
|
318
|
+
@if $value != null {
|
|
319
|
+
@if $is-rtl == false {
|
|
320
|
+
/* rtl:begin:remove */
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
@if $is-css-var {
|
|
324
|
+
.#{$property-class + $infix + $property-class-modifier} {
|
|
325
|
+
--#{$prefix}#{$css-variable-name}: #{$value};
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
@each $pseudo in $state {
|
|
329
|
+
.#{$property-class + $infix + $property-class-modifier}-#{$pseudo}:#{$pseudo} {
|
|
330
|
+
--#{$prefix}#{$css-variable-name}: #{$value};
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
} @else {
|
|
334
|
+
.#{$property-class + $infix + $property-class-modifier} {
|
|
335
|
+
@each $property in $properties {
|
|
336
|
+
@if $is-local-vars {
|
|
337
|
+
@each $local-var, $variable in $is-local-vars {
|
|
338
|
+
--#{$prefix}#{$local-var}: #{$variable};
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
#{$property}: $value if($enable-important-utilities, !important, null);
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
@each $pseudo in $state {
|
|
346
|
+
.#{$property-class + $infix + $property-class-modifier}-#{$pseudo}:#{$pseudo} {
|
|
347
|
+
@each $property in $properties {
|
|
348
|
+
@if $is-local-vars {
|
|
349
|
+
@each $local-var, $variable in $is-local-vars {
|
|
350
|
+
--#{$prefix}#{$local-var}: #{$variable};
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
#{$property}: $value if($enable-important-utilities, !important, null);
|
|
354
|
+
}
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
@if $is-rtl == false {
|
|
360
|
+
/* rtl:end:remove */
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
}
|
|
364
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
// Loop over each breakpoint
|
|
2
|
+
/* stylelint-disable string-quotes */
|
|
3
|
+
@each $breakpoint in map-keys($nsw-breakpoints) {
|
|
4
|
+
|
|
5
|
+
// Generate media query if needed
|
|
6
|
+
@include media-breakpoint-up($breakpoint) {
|
|
7
|
+
$infix: breakpoint-infix($breakpoint, $nsw-breakpoints);
|
|
8
|
+
|
|
9
|
+
// Loop over each utility property
|
|
10
|
+
@each $key, $utility in $utilities {
|
|
11
|
+
// The utility can be disabled with `false`, thus check if the utility is a map first
|
|
12
|
+
// Only proceed if responsive media queries are enabled or if it's the base media query
|
|
13
|
+
@if type-of($utility) == "map" and (map-get($utility, responsive) or $infix == "") {
|
|
14
|
+
@include generate-utility($utility, $infix);
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
}
|