@nice-digital/nds-core 1.3.3-alpha.0 → 2.0.0-alpha.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 (42) hide show
  1. package/package.json +5 -5
  2. package/scss/colours/_index.scss +1 -0
  3. package/scss/colours/tokens/_alias.scss +163 -0
  4. package/scss/colours/tokens/_global.scss +47 -0
  5. package/scss/{helpers/_helpers-focus.scss → focus/_index.scss} +15 -11
  6. package/scss/{helpers/_helpers-glyphs.scss → glyphs/_index.scss} +12 -10
  7. package/scss/layout/_index.scss +43 -0
  8. package/scss/media-queries/_index.scss +29 -0
  9. package/scss/media-queries/vendor/_mq.scss +307 -0
  10. package/scss/{settings/_settings-modular-scale.scss → modular-scale/_index.scss} +9 -7
  11. package/scss/spacing/_index.scss +31 -0
  12. package/scss/typography/{_typography-headings.scss → _headings.scss} +20 -19
  13. package/scss/typography/_helpers.scss +172 -0
  14. package/scss/typography/_index.scss +4 -0
  15. package/scss/typography/_links.scss +78 -0
  16. package/scss/{settings/_settings-typography.scss → typography/_settings.scss} +38 -34
  17. package/scss/{helpers/_helpers-utils.scss → utils/_index.scss} +22 -19
  18. package/scss/{vendor/_vendor-is.scss → utils/vendor/_is.scss} +8 -6
  19. package/scss/visibility/_index.scss +65 -0
  20. package/scss/core.scss +0 -4
  21. package/scss/helpers/_helpers-clearfix.scss +0 -23
  22. package/scss/helpers/_helpers-lists.scss +0 -45
  23. package/scss/helpers/_helpers-print.scss +0 -35
  24. package/scss/helpers/_helpers-text.scss +0 -21
  25. package/scss/helpers/_helpers-visibility.scss +0 -37
  26. package/scss/helpers/_helpers.scss +0 -2
  27. package/scss/layout/_layout-container.scss +0 -12
  28. package/scss/layout/_layout.scss +0 -1
  29. package/scss/settings/_settings-breakpoints.scss +0 -25
  30. package/scss/settings/_settings-colours-nice.scss +0 -80
  31. package/scss/settings/_settings-colours-semantic.scss +0 -247
  32. package/scss/settings/_settings-glyphs.scss +0 -3
  33. package/scss/settings/_settings-layout.scss +0 -15
  34. package/scss/settings/_settings-mq.scss +0 -17
  35. package/scss/settings/_settings-print.scss +0 -5
  36. package/scss/settings/_settings-spacing.scss +0 -43
  37. package/scss/settings/_settings.scss +0 -4
  38. package/scss/typography/_typography-helpers.scss +0 -148
  39. package/scss/typography/_typography-links.scss +0 -73
  40. package/scss/typography/_typography.scss +0 -1
  41. package/scss/vendor/_vendor-math.scss +0 -79
  42. package/scss/vendor/_vendor.scss +0 -2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nice-digital/nds-core",
3
- "version": "1.3.3-alpha.0",
3
+ "version": "2.0.0-alpha.0",
4
4
  "description": "Core code for the NICE Design System",
5
5
  "author": "Ian Routledge <ian.routledge@nice.org.uk>",
6
6
  "contributors": [
@@ -33,16 +33,16 @@
33
33
  "url": "https://github.com/nice-digital/nice-design-system/issues"
34
34
  },
35
35
  "dependencies": {
36
- "@nice-digital/icons": "^3.0.1-alpha.0",
36
+ "@nice-digital/icons": "^4.0.0-alpha.0",
37
37
  "prop-types": "^15.7.2",
38
38
  "sass-mq": "^6.0.0"
39
39
  },
40
40
  "peerDependencies": {
41
- "react": "^16 || ^17",
42
- "react-dom": "^16 || ^17"
41
+ "react": "^16 || ^17 || ^18",
42
+ "react-dom": "^16 || ^17 || ^18"
43
43
  },
44
44
  "devDependencies": {
45
45
  "@babel/cli": "^7.5.0"
46
46
  },
47
- "gitHead": "8624fdff10d45cdd07dec7f2eda7d2f4db68c474"
47
+ "gitHead": "66fbcb1c0c01b0afc6b51b0f3fe4719be92996b0"
48
48
  }
@@ -0,0 +1 @@
1
+ @forward 'tokens/alias';
@@ -0,0 +1,163 @@
1
+ @use 'global';
2
+
3
+ // Text, links, focus
4
+ $text: global.$nice-black;
5
+ $text-inverse: global.$white;
6
+ $link: global.$custom-blue-1;
7
+ $link-hover: global.$custom-blue-2;
8
+ $link-visited: global.$custom-purple-1;
9
+ $link-active: global.$nice-black;
10
+ $link-focus: global.$custom-blue-1;
11
+ $link-inverse: global.$white;
12
+ $link-inverse-hover: global.$custom-grey-2;
13
+ $link-inverse-visited: global.$white;
14
+ $link-inverse-active: global.$custom-grey-2;
15
+ $link-inverse-focus: global.$white;
16
+ $code-background: global.$custom-grey-4;
17
+ $mark: global.$custom-yellow-highlight;
18
+ $focus: global.$custom-teal;
19
+ $focus-inverse: global.$white;
20
+ $text-print: global.$black;
21
+
22
+ // Buttons
23
+ $btn-cta: global.$yellow;
24
+ $btn-cta-hover: global.$custom-yellow-shade;
25
+ $btn-cta-text: global.$nice-black;
26
+ $btn-cta-border: global.$white;
27
+ $btn-primary: global.$black-tint-1;
28
+ $btn-primary-hover: global.$nice-black;
29
+ $btn-primary-text: global.$white;
30
+ $btn-secondary: global.$custom-grey-3;
31
+ $btn-secondary-hover: global.$black-tint-1;
32
+ $btn-secondary-text: global.$white;
33
+ $btn-inverse: global.$white;
34
+ $btn-inverse-hover: global.$custom-grey-2;
35
+ $btn-inverse-text: global.$nice-black;
36
+
37
+ // Borders
38
+ $border: global.$custom-grey-1;
39
+ $border-selected: global.$nice-teal;
40
+
41
+ // Status
42
+ $error: global.$custom-red-1;
43
+ $error-background: global.$custom-red-1-tint;
44
+ $info: global.$custom-blue-3;
45
+ $info-background: global.$custom-blue-3-tint;
46
+ $caution: global.$custom-orange-1;
47
+ $caution-background: global.$custom-orange-1-tint;
48
+ $success: global.$custom-green-1;
49
+ $success-background: global.$custom-green-1-tint;
50
+
51
+ // Fills
52
+ $fill-page-background: global.$nice-cream-tint-1;
53
+
54
+ // Forms
55
+ $form-group-hint: global.$black-tint-1;
56
+ $checkbox: global.$nice-black;
57
+ $checkbox-hint: global.$black-tint-1;
58
+ $radio: global.$nice-black;
59
+ $radio-hint: global.$black-tint-1;
60
+
61
+ // Components...
62
+
63
+ // A-Z list
64
+ $a-z-list-heading-background: global.$white;
65
+
66
+ // Action banner
67
+ $action-banner-default-background: global.$nice-blue;
68
+ $action-banner-default-border: global.$nice-black;
69
+ $action-banner-subtle-background: global.$nice-cream;
70
+ $action-banner-subtle-border: global.$nice-cream;
71
+
72
+ // Alphabet
73
+ $alphabet-letter-background: global.$white;
74
+ $alphabet-letter-span: global.$black-tint-1;
75
+
76
+ // Card
77
+ $card-author: global.$black-tint-1;
78
+ $card-metadata: global.$black-tint-1;
79
+
80
+ // Callout
81
+ $callout-background: global.$white;
82
+
83
+ // Column list
84
+ $column-list-boxed-background: global.$white;
85
+
86
+ // Enhanced pagination
87
+ $enhanced-pagination-current-item-background: global.$custom-grey-2;
88
+ $enhanced-pagination-link-hover-background: global.$white;
89
+
90
+ // Filters
91
+ $filter-panel-background: global.$custom-grey-4;
92
+ $filter-panel-heading-button-background: global.$custom-grey-2;
93
+ $filter-group-heading-background: global.$custom-grey-2;
94
+ $filter-group-heading-button-background: global.$custom-grey-2;
95
+ $filter-group-heading-button-background-hover: global.$custom-grey-1;
96
+ $filter-option-background: global.$white;
97
+ $filter-option-border: global.$custom-grey-2;
98
+ $filter-option-hover: global.$custom-grey-4;
99
+ $filter-option-hover-border: global.$custom-grey-1;
100
+ $filter-option-text-before-background: global.$white;
101
+ $filter-option-text-before-border: global.$black-tint-1;
102
+ $filter-input-controls-border: global.$custom-grey-2;
103
+
104
+ // Full bleed
105
+ $full-bleed-background: global.$white;
106
+ $full-bleed-light-background: global.$nice-teal;
107
+ $full-bleed-light-text: global.$white;
108
+
109
+ // Hero
110
+ $hero-background: global.$nice-blue-tint-1;
111
+ $hero-border: global.$nice-blue-tint-2;
112
+
113
+ // Horizontal nav
114
+ $horizontal-nav-list-border: global.$nice-black;
115
+ $horizontal-nav-current-link-background: global.$custom-grey-4;
116
+ $horizontal-nav-current-link-border: global.$nice-black;
117
+ $horizontal-nav-current-link: global.$nice-black;
118
+ $horizontal-nav-active-link-mobile: global.$white;
119
+ $horizontal-nav-active-link-mobile-background: global.$nice-teal;
120
+
121
+ // Icons
122
+ $icons: global.$nice-teal;
123
+
124
+ // Panels
125
+ $panel-default-background: global.$nice-cream;
126
+ $panel-default-border: global.$custom-grey-2;
127
+ $panel-impact-background: global.$nice-blue;
128
+ $panel-impact-border: global.$nice-blue;
129
+ $panel-impact-alt-background-1: global.$nice-blue;
130
+ $panel-impact-alt-background-2: global.$nice-blue-tint-1;
131
+ $panel-primary-background: global.$white;
132
+ $panel-primary-border: global.$nice-teal-tint-2;
133
+ $panel-inverse-background: global.$black-tint-1;
134
+
135
+ // Quote
136
+ $quote-left-border: global.$nice-teal;
137
+
138
+ // Stacked nav
139
+ $stacked-nav-background: global.$white;
140
+ $stacked-nav-active-hint: global.$white;
141
+ $stacked-nav-current-link: global.$custom-grey-4;
142
+ $stacked-nav-current-link-background: global.$nice-teal;
143
+ $stacked-nav-current-link-active: global.$white;
144
+ $stacked-nav-link-hover: global.$custom-grey-2;
145
+
146
+ // Tables
147
+ $table-heading: global.$white;
148
+ $table-row-odd: global.$nice-cream-tint-1;
149
+ $table-row-even: global.$nice-cream-2;
150
+
151
+ // Tabs
152
+ $tab-btn-selected: global.$custom-grey-4;
153
+ $tab-pane: global.$custom-grey-4;
154
+ $tab-content: global.$custom-grey-4;
155
+
156
+ // Tags
157
+ $tag-background: global.$black-tint-1;
158
+ $tag-outline: global.$black-tint-1;
159
+ $tag-outline-background: global.$custom-grey-4;
160
+ $tag-remove: global.$nice-teal;
161
+ $tag-remove-hover-after: global.$nice-black;
162
+ $tag-anchor: global.$white;
163
+ $tag-print: global.$black;
@@ -0,0 +1,47 @@
1
+ // Global tokens - do not reference these directly, use alias tokens instead!
2
+
3
+ // Primary palette
4
+ $nice-teal: #228096;
5
+ $nice-cream: #f7f4f1;
6
+ $nice-blue: #00436c;
7
+ $white: #fff;
8
+ $black: #000;
9
+ $nice-black: #0e0e0e;
10
+
11
+ // Secondary palette
12
+ $yellow: #ead054;
13
+
14
+ // Tertiary palette
15
+ $nice-teal-tint-1: #59a0b0;
16
+ $nice-teal-tint-2: #91c0cb;
17
+ $nice-teal-tint-3: #c8e0e6;
18
+ $nice-blue-tint-1: #407291;
19
+ $nice-blue-tint-2: #80a1b5;
20
+ $nice-blue-tint-3: #bfd0da;
21
+ $nice-cream-1: #ded5ca;
22
+ $nice-cream-2: #e6e0d7;
23
+ $nice-cream-3: #eeeae4;
24
+ $nice-cream-tint-1: #fbfaf8;
25
+ $black-tint-1: #404040;
26
+ $black-tint-2: #808080;
27
+ $black-tint-3: #bfbfbf;
28
+
29
+ // Custom palette
30
+ $custom-grey-1: #adadad;
31
+ $custom-grey-2: #d6d6d6;
32
+ $custom-grey-3: #666;
33
+ $custom-grey-4: #e9e9e9;
34
+ $custom-blue-1: #005ea5;
35
+ $custom-blue-2: #003761;
36
+ $custom-blue-3: #3479d0;
37
+ $custom-blue-3-tint: #eff4fc;
38
+ $custom-purple-1: #4c2c92;
39
+ $custom-red-1: #b50f23;
40
+ $custom-red-1-tint: #f9eced;
41
+ $custom-orange-1: #dc8a07;
42
+ $custom-orange-1-tint: #fbf7f1;
43
+ $custom-green-1: #68c103;
44
+ $custom-green-1-tint: #f3faeb;
45
+ $custom-yellow-shade: #d6ba32;
46
+ $custom-yellow-highlight: #fff999;
47
+ $custom-teal: #0092a6;
@@ -1,3 +1,7 @@
1
+ @use '../spacing';
2
+ @use '../colours';
3
+ @use '../utils';
4
+
1
5
  ////
2
6
  /// @group helpers
3
7
  ////
@@ -6,13 +10,13 @@
6
10
  /// @param {Boolean} $rounded whether to use box shadow for border (outline can't be styled to have radius corners)
7
11
  /// @output the default focus styles ie background colour and outline
8
12
  /// @since 0.1.0
9
- @mixin nds-default-focus-style($rounded: false) {
13
+ @mixin default-focus-style($rounded: false) {
10
14
  @if $rounded {
11
- box-shadow: 0 0 0 rem($nds-spacing-x-small) $nds-colour-focus;
12
- outline: $nds-spacing-x-small solid transparent;
13
- outline-offset: $nds-spacing-x-small;
15
+ box-shadow: 0 0 0 utils.rem(spacing.$x-small) colours.$focus;
16
+ outline: spacing.$x-small solid transparent;
17
+ outline-offset: spacing.$x-small;
14
18
  } @else {
15
- outline: rem($nds-spacing-x-small) solid $nds-colour-focus;
19
+ outline: utils.rem(spacing.$x-small) solid colours.$focus;
16
20
  }
17
21
  }
18
22
 
@@ -20,24 +24,24 @@
20
24
  /// on an inverse (dark) background
21
25
  /// @output the inverse focus styles ie background colour and outline
22
26
  /// @since 0.3.1
23
- @mixin nds-inverse-focus-style {
24
- outline: rem($nds-spacing-x-small) solid $nds-colour-focus-inverse;
27
+ @mixin inverse-focus-style {
28
+ outline: utils.rem(spacing.$x-small) solid colours.$focus-inverse;
25
29
  }
26
30
 
27
- @mixin nds-default-button-focus {
31
+ @mixin default-button-focus {
28
32
  .btn,
29
33
  button {
30
34
  &:focus {
31
- @include nds-default-focus-style;
35
+ @include default-focus-style;
32
36
  }
33
37
  }
34
38
  }
35
39
 
36
- @mixin nds-inverse-button-focus {
40
+ @mixin inverse-button-focus {
37
41
  .btn,
38
42
  button {
39
43
  &:focus {
40
- @include nds-inverse-focus-style;
44
+ @include inverse-focus-style;
41
45
  }
42
46
  }
43
47
  }
@@ -1,10 +1,12 @@
1
+ @use 'sass:map';
2
+
1
3
  ////
2
4
  /// @group helpers
3
5
  ////
4
6
 
5
7
  /// A map of glyph name to code point (character entity reference).
6
8
  /// Avoids magic strings like `content: '\201C'` within our SASS.
7
- /// Usual usage is via the `get-glyph` function, e.g. `nds-get-glyph(greater-than)`.
9
+ /// Usual usage is via the `get-glyph` function, e.g. `get-glyph(greater-than)`.
8
10
  /// @see get-glyph
9
11
  /// @link https://css-tricks.com/snippets/html/glyphs/
10
12
  /// @prop {String} bullet [2022] Bullet (•)
@@ -17,7 +19,7 @@
17
19
  /// @prop {String} punc-space [02008] Punctuation space (small, width of a comma)
18
20
  /// @prop {String} zero-width-space [0200B] Zero width space
19
21
  /// @since 0.1.0
20
- $nds-glyphs: (
22
+ $glyphs: (
21
23
  bullet: '2022',
22
24
  copyright: '00a9',
23
25
  greater-than: '003e',
@@ -31,29 +33,29 @@ $nds-glyphs: (
31
33
  ) !default;
32
34
 
33
35
  /// Gets a glyph code, or several, (character entity reference) from the
34
- /// `$nds-glyphs` map, matching the given `$names`. Usually used with the content
36
+ /// `$glyphs` map, matching the given `$names`. Usually used with the content
35
37
  /// property for psuedo elements, to avoid use of magic character reference strings.
36
38
  /// @param {argList} $names The name(s) of the glyph(s) to get
37
39
  /// @returns {string} The character entity reference code(s) as a string, e.g. '\201C' or '\02008\029C9'
38
- /// @see $nds-glyphs
40
+ /// @see $glyphs
39
41
  /// @since 0.1.0
40
42
  /// @example Single glyph
41
43
  /// .rule {
42
- /// content: nds-get-glyph(greater-than);
44
+ /// content: get-glyph(greater-than);
43
45
  /// }
44
46
  /// @example Multiple glyphs together
45
47
  /// .rule {
46
- /// content: nds-get-glyph(punc-space, box-box);
48
+ /// content: get-glyph(punc-space, box-box);
47
49
  /// }
48
- @function nds-get-glyph($names...) {
50
+ @function get-glyph($names...) {
49
51
  $codes: '';
50
52
 
51
53
  @each $name in $names {
52
- @if map-has-key($nds-glyphs, $name) {
53
- $code: map-get($nds-glyphs, $name);
54
+ @if map.has-key($glyphs, $name) {
55
+ $code: map.get($glyphs, $name);
54
56
  $codes: $codes + '\\#{$code}';
55
57
  } @else {
56
- @error 'Glyph with name #{$name} could not be found in the $nds-glyphs map';
58
+ @error 'Glyph with name #{$name} could not be found in the $glyphs map';
57
59
  }
58
60
  }
59
61
 
@@ -0,0 +1,43 @@
1
+ @use '../spacing';
2
+ @use '../utils';
3
+
4
+ /// The maximum width of the default container, in pixels
5
+ /// @since 0.5.2
6
+ $container-max-width: 1170;
7
+
8
+ /// The gutter for the default container
9
+ /// @since 1.0.0
10
+ $container-gutter: spacing.$medium;
11
+
12
+ /// The maximum content width to ensure good readability
13
+ /// @since 1.7.0
14
+ $readable-width: 66ch;
15
+
16
+ /// Container placeholder.
17
+ /// @since 1.0.0
18
+ @mixin container {
19
+ margin: auto;
20
+ max-width: utils.rem($container-max-width);
21
+ width: 96%; // IE11 support for calc not consistent https://caniuse.com/calc (See "Known issues")
22
+ width: calc(100% - #{rem($container-gutter * 2)});
23
+ }
24
+
25
+ /// Make an element adapt its height to fit floated children, and clear floats in both directions.
26
+ /// @since 0.1.0
27
+ @mixin clearfix {
28
+ &:before,
29
+ &:after {
30
+ content: ' ';
31
+ display: table;
32
+ }
33
+
34
+ &:after {
35
+ clear: both;
36
+ }
37
+ }
38
+
39
+ /// Placeholder for clearfix
40
+ /// @since 0.1.0
41
+ %clearfix {
42
+ @include clearfix;
43
+ }
@@ -0,0 +1,29 @@
1
+ /// Extra small break point
2
+ /// @since 0.2.0
3
+ $xs: 400px !default;
4
+
5
+ /// 'Small' break point. Roughly portrait tablets.
6
+ /// @since 0.2.0
7
+ $sm: 600px !default;
8
+
9
+ /// 'Medium' break point. Roughly landscape tablets.
10
+ /// @since 0.2.0
11
+ $md: 900px !default;
12
+
13
+ /// 'Large' break point. Roughly 'dektops'.
14
+ /// @since 0.2.0
15
+ $lg: 1200px !default;
16
+
17
+ /// 'Extra large' break point for wide screens
18
+ /// @since 0.2.0
19
+ $xl: 1600px !default;
20
+
21
+ @forward 'vendor/mq' with (
22
+ $breakpoints: (
23
+ xs: $xs,
24
+ sm: $sm,
25
+ md: $md,
26
+ lg: $lg,
27
+ xl: $xl
28
+ )
29
+ );