@nice-digital/nds-core 1.2.11 → 1.3.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/lib/utils.js CHANGED
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
 
3
3
  exports.__esModule = true;
4
- exports["default"] = exports.camelCase = exports.nextUniqueId = exports.slugify = exports.debounce = exports.throttle = exports.trim = void 0;
4
+ exports.trim = exports.throttle = exports.slugify = exports.nextUniqueId = exports["default"] = exports.debounce = exports.camelCase = void 0;
5
5
 
6
6
  /**
7
7
  * @module Utils
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nice-digital/nds-core",
3
- "version": "1.2.11",
3
+ "version": "1.3.0",
4
4
  "description": "Core code for the NICE Design System",
5
5
  "author": "Ian Routledge <ian.routledge@nice.org.uk>",
6
6
  "contributors": [
@@ -35,7 +35,7 @@
35
35
  "dependencies": {
36
36
  "@nice-digital/icons": "^2.2.7",
37
37
  "prop-types": "^15.7.2",
38
- "sass-mq": "^5.0.0"
38
+ "sass-mq": "^6.0.0"
39
39
  },
40
40
  "peerDependencies": {
41
41
  "react": "^16 || ^17",
@@ -44,5 +44,5 @@
44
44
  "devDependencies": {
45
45
  "@babel/cli": "^7.5.0"
46
46
  },
47
- "gitHead": "6507bf955411adbcfdd4ddabe739125dd18dfd16"
47
+ "gitHead": "0ab9f6e7e5ca7d38e2e6de672772d12d5feb2465"
48
48
  }
@@ -6,8 +6,10 @@
6
6
  /// @param {Number} $num The number whose units you wish to strip.
7
7
  /// @since 0.2.0
8
8
  /// @link https://davidtheclark.github.io/scut/strip-unit.html
9
+ @use "sass:math";
10
+
9
11
  @function nds-strip-unit($num) {
10
- @return $num / ($num * 0 + 1);
12
+ @return math.div($num, $num * 0 + 1);
11
13
  }
12
14
 
13
15
  /// Convert pixel-values to em-values.
@@ -25,7 +27,7 @@
25
27
  $em-vals: ();
26
28
 
27
29
  @each $val in $pixels {
28
- $val-in-ems: (nds-strip-unit($val) / $divisor) * 1em;
30
+ $val-in-ems: math.div(nds-strip-unit($val), $divisor) * 1em;
29
31
  $em-vals: append($em-vals, $val-in-ems);
30
32
  }
31
33
 
@@ -46,7 +48,7 @@
46
48
  @function rem($pixels, $base: $nds-base-font-size) {
47
49
  $rem-vals: ();
48
50
  @each $val in $pixels {
49
- $val-in-rems: nds-strip-unit($val) / $base * 1rem;
51
+ $val-in-rems: math.div(nds-strip-unit($val), $base) * 1rem;
50
52
  $rem-vals: append($rem-vals, $val-in-rems);
51
53
  }
52
54
 
@@ -187,36 +187,36 @@ $nds-colour-beta: #bd5826;
187
187
  $nds-colour-live: #578137;
188
188
 
189
189
  /// Error text and border colour
190
- /// @since 0.2.0
191
- $nds-colour-error: #ae0e1e;
190
+ /// @since 1.7.0
191
+ $nds-colour-error: #b50f23;
192
192
 
193
193
  /// Error background colour
194
- /// @since 0.2.0
195
- $nds-colour-error-background: #eac3c3;
194
+ /// @since 1.7.0
195
+ $nds-colour-error-background: #f9eced;
196
196
 
197
197
  /// Caution text and border colour
198
- /// @since 0.2.0
199
- $nds-colour-caution: #835f24;
198
+ /// @since 1.7.0
199
+ $nds-colour-caution: #dc8a07;
200
200
 
201
201
  /// Caution background colour
202
- /// @since 0.2.0
203
- $nds-colour-caution-background: #ffdfa4;
202
+ /// @since 1.7.0
203
+ $nds-colour-caution-background: #fbf7f1;
204
204
 
205
205
  /// Info text and border colour
206
- /// @since 0.2.0
207
- $nds-colour-info: #497b94;
206
+ /// @since 1.7.0
207
+ $nds-colour-info: #3479d0;
208
208
 
209
209
  /// Info background colour
210
- /// @since 0.2.0
211
- $nds-colour-info-background: #e6faff;
210
+ /// @since 1.7.0
211
+ $nds-colour-info-background: #eff4fc;
212
212
 
213
213
  /// Success text and border colour
214
- /// @since 0.2.0
215
- $nds-colour-success: #3b8458;
214
+ /// @since 1.7.0
215
+ $nds-colour-success: #68c103;
216
216
 
217
217
  /// Success background colour
218
- /// @since 0.2.0
219
- $nds-colour-success-background: #eff7eb;
218
+ /// @since 1.7.0
219
+ $nds-colour-success-background: #f3faeb;
220
220
 
221
221
  /// <mark> tag highlighter colour
222
222
  /// @since 1.2.4
@@ -9,3 +9,7 @@ $nds-container-max-width: 1170;
9
9
  /// The gutter for the default container
10
10
  /// @since 1.0.0
11
11
  $nds-container-gutter: $nds-spacing-medium;
12
+
13
+ /// The maximum content width to ensure good readability
14
+ /// @since 1.7.0
15
+ $nds-readable-width: 66ch;
@@ -1,3 +1,5 @@
1
+ @use "sass:math";
2
+
1
3
  /// Modular scale values
2
4
  /// @link http://www.modularscale.com/
3
5
  /// @prop {Number} golden [1.618034]
@@ -19,22 +21,22 @@
19
21
  /// @since 0.1.0
20
22
  $nds-scales: (
21
23
  golden: 1.618034,
22
- double-octave: 4 / 1,
23
- major-twelfth: 3 / 1,
24
- major-eleventh: 8 / 3,
25
- major-tenth: 5 / 2,
26
- octave: 2 / 1,
27
- major-seventh: 15 / 8,
28
- minor-seventh: 16 / 9,
29
- major-sixth: 5 / 3,
30
- minor-sixth: 8 / 5,
31
- fifth: 3 / 2,
32
- augmented-fourth: sqrt(2) / 1,
33
- fourth: 4 / 3,
34
- major-third: 5 / 4,
35
- minor-third: 6 / 5,
36
- major-second: 9 / 8,
37
- minor-second: 16 / 15
24
+ double-octave: 4,
25
+ major-twelfth: 3,
26
+ major-eleventh: math.div(8, 3),
27
+ major-tenth: math.div(5, 2),
28
+ octave: 2,
29
+ major-seventh: math.div(1, 8),
30
+ minor-seventh: math.div(1, 9),
31
+ major-sixth: math.div(5, 3),
32
+ minor-sixth: math.div(8, 5),
33
+ fifth: math.div(3, 2),
34
+ augmented-fourth: math.sqrt(2),
35
+ fourth: math.div(4, 3),
36
+ major-third: math.div(5, 4),
37
+ minor-third: math.div(6, 5),
38
+ major-second: math.div(9, 8),
39
+ minor-second: 1
38
40
  );
39
41
 
40
42
  /// Gets a module scale ratio with the given name. Looks
@@ -8,8 +8,11 @@
8
8
  @mixin nds-h1 {
9
9
  @include nds-font(h1);
10
10
  clear: both;
11
- font-weight: 900;
11
+ font-weight: 700;
12
+ // Letter spacing and text shadow to mimic 900 weight, see https://github.com/nice-digital/nice-design-system/issues/240
13
+ letter-spacing: 0.5px;
12
14
  max-width: 66ch;
15
+ text-shadow: 1.5px 0 0 currentColor;
13
16
  }
14
17
 
15
18
  /// Secondary heading. Used for h2 tag but can be used directly
@@ -1,3 +1,5 @@
1
+ @use "sass:math";
2
+
1
3
  @function power ($x, $n) {
2
4
  $ret: 1;
3
5
 
@@ -7,7 +9,7 @@
7
9
  }
8
10
  } @else {
9
11
  @for $i from $n to 0 {
10
- $ret: $ret / $x;
12
+ $ret: math.div($ret, $x);
11
13
  }
12
14
  }
13
15
 
@@ -32,7 +34,7 @@
32
34
  $ret: 0;
33
35
 
34
36
  @for $n from 0 to 25 {
35
- $ret: $ret + power(-1, $n) * power($x, 2 * $n + 1) / factorial(2 * $n + 1);
37
+ $ret: $ret + math.div(power(-1, $n) * power($x, 2 * $n + 1), factorial(2 * $n + 1));
36
38
  }
37
39
 
38
40
  @return $ret;
@@ -42,7 +44,7 @@
42
44
  $ret: 0;
43
45
 
44
46
  @for $n from 0 to 25 {
45
- $ret: $ret + power(-1, $n) * power($x, 2 * $n) / factorial(2 * $n);
47
+ $ret: $ret + math.div(power(-1, $n) * power($x, 2 * $n), factorial(2 * $n));
46
48
  }
47
49
 
48
50
  @return $ret;
@@ -52,7 +54,7 @@
52
54
  $ret: 0;
53
55
 
54
56
  @for $n from 0 to 25 {
55
- $ret: $ret + power($x, $n) / factorial($n);
57
+ $ret: $ret + math.div(power($x, $n), factorial($n));
56
58
  }
57
59
 
58
60
  @return $ret;
@@ -64,7 +66,7 @@
64
66
  $dx: .001;
65
67
 
66
68
  @while $n <= $x {
67
- $ret: $ret + $dx / $n;
69
+ $ret: $ret + math.div($dx, $n);
68
70
 
69
71
  $n: $n + $dx;
70
72
  }