@openeuropa/bcl-theme-default 1.2.2 → 1.4.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/package.json CHANGED
@@ -2,18 +2,19 @@
2
2
  "name": "@openeuropa/bcl-theme-default",
3
3
  "author": "European Commission",
4
4
  "license": "EUPL-1.2",
5
- "version": "1.2.2",
5
+ "version": "1.4.0",
6
6
  "description": "OE - BCL theme default",
7
7
  "scripts": {
8
8
  "align-templates": "lerna --scope \"@openeuropa/bcl-twig-templates\" run prepublish",
9
9
  "build": "npm-run-all build:*",
10
10
  "build:styles": "cross-env bcl-builder styles",
11
+ "build:color-scheme": "cross-env bcl-builder color-scheme",
11
12
  "build:scripts": "cross-env bcl-builder scripts",
12
13
  "build:copy": "cross-env bcl-builder copy",
13
14
  "build:sprite": "cross-env bcl-builder sprite",
14
15
  "clean": "rimraf css js templates logos icons",
15
16
  "prepublish": "npm run build",
16
- "update:styles": "npm run build:styles && copyfiles -f css/*.min.css ../../../assets",
17
+ "update:styles": "npm run build:styles && npm run build:color-scheme && copyfiles -f css/*.min.css ../../../assets",
17
18
  "update:scripts": "npm run build:scripts && copyfiles -f js/*.bundle.min.js ../../../assets",
18
19
  "update:templates": "run-s align-templates build:copy"
19
20
  },
@@ -21,9 +22,9 @@
21
22
  "@ecl/resources-ec-logo": "3.7.1",
22
23
  "@ecl/resources-eu-logo": "3.7.1",
23
24
  "@ecl/resources-flag-icons": "3.7.1",
24
- "@openeuropa/bcl-bootstrap": "^1.2.2",
25
- "@openeuropa/bcl-builder": "^1.2.2",
26
- "@openeuropa/bcl-twig-templates": "^1.2.2",
25
+ "@openeuropa/bcl-bootstrap": "^1.4.0",
26
+ "@openeuropa/bcl-builder": "^1.4.0",
27
+ "@openeuropa/bcl-twig-templates": "^1.4.0",
27
28
  "copyfiles": "2.4.1",
28
29
  "cross-env": "7.0.3",
29
30
  "flag-icons": "6.9.2",
@@ -48,5 +49,5 @@
48
49
  "design-system",
49
50
  "twig"
50
51
  ],
51
- "gitHead": "03e3f25dcc61e449566c32a78213363e7d18afd0"
52
+ "gitHead": "0271b344c41999ea181851f229385df1d539047b"
52
53
  }
@@ -61,7 +61,7 @@
61
61
 
62
62
  .bcl-banner__content {
63
63
  padding: map-get($spacers, "4-75") map-get($spacers, "4-5");
64
- border-color: $banner-content-border-color;
64
+ border-color: var(--bs-primary);
65
65
  }
66
66
 
67
67
  .bcl-banner__image {
@@ -100,7 +100,7 @@
100
100
  &.overlay {
101
101
  .bcl-banner__content {
102
102
  background: $white;
103
- border-bottom: 4px solid $banner-content-border-color;
103
+ border-bottom: 4px solid var(--bs-primary);
104
104
  }
105
105
  }
106
106
 
@@ -18,7 +18,7 @@
18
18
  display: inline-block;
19
19
  position: absolute;
20
20
  border-radius: 50%;
21
- border: 2px solid $primary;
21
+ border: 2px solid var(--bs-primary);
22
22
  left: 0;
23
23
  width: 22px;
24
24
  height: 22px;
@@ -80,9 +80,6 @@ $badge-font-size-desktop: 1rem; // 16px
80
80
  $badge-active-box-shadow: $btn-active-box-shadow;
81
81
  $badge-focus-width: $btn-focus-width;
82
82
 
83
- // banners
84
- $banner-content-border-color: $primary;
85
-
86
83
  // Forms
87
84
  $form-check-input-size-lg: $form-check-input-width + 0.3em !default;
88
85
  $form-font-size: $font-size-base !default;
@@ -0,0 +1,11 @@
1
+ $colors-schemes: (
2
+ "ocean": (
3
+ "primary": #4eac00,
4
+ "secondary": #fbff00,
5
+ "danger": #ff8800,
6
+ "success": #4dff00,
7
+ "text": #294d26,
8
+ "background": #ffdfb0,
9
+ "link": #7b00ff,
10
+ ),
11
+ );
@@ -0,0 +1,15 @@
1
+ // Configuration
2
+ @import "@openeuropa/bcl-bootstrap/scss/functions";
3
+ @import "@openeuropa/bcl-bootstrap/scss/variables";
4
+ @import "@openeuropa/bcl-bootstrap/scss/maps";
5
+ @import "@openeuropa/bcl-bootstrap/scss/mixins";
6
+
7
+ @import "@openeuropa/bcl-theme-default/src/scss/color_scheme/background";
8
+ @import "@openeuropa/bcl-theme-default/src/scss/color_scheme/text";
9
+ @import "@openeuropa/bcl-theme-default/src/scss/color_scheme/link";
10
+
11
+ @import "@openeuropa/bcl-theme-default/src/scss/color_scheme/alert";
12
+ @import "@openeuropa/bcl-theme-default/src/scss/color_scheme/buttons";
13
+ @import "@openeuropa/bcl-theme-default/src/scss/color_scheme/list_group";
14
+ @import "@openeuropa/bcl-theme-default/src/scss/color_scheme/utilities";
15
+ @import "@openeuropa/bcl-theme-default/src/scss/color_scheme/badges";
@@ -0,0 +1,18 @@
1
+ // Color scheme - Alert
2
+
3
+ @mixin generate-alerts($color, $value) {
4
+ $alert-background: shift-color($value, $alert-bg-scale);
5
+ $alert-border: shift-color($value, $alert-border-scale);
6
+ $alert-color: shift-color($value, $alert-color-scale);
7
+
8
+ @if (contrast-ratio($alert-background, $alert-color) < $min-contrast-ratio) {
9
+ $alert-color: mix(
10
+ $value,
11
+ color-contrast($alert-background),
12
+ abs($alert-color-scale)
13
+ );
14
+ }
15
+ .alert-#{$color} {
16
+ @include alert-variant($alert-background, $alert-border, $alert-color);
17
+ }
18
+ }
@@ -0,0 +1,22 @@
1
+ // Color scheme - Background
2
+
3
+ @mixin generate-background($color, $value) {
4
+ &.bg-default {
5
+ // Accordion
6
+ $accordion-button-active-bg: tint-color($value, 90%);
7
+ --#{$prefix}accordion-bg: #{$value};
8
+ --#{$prefix}accordion-active-bg: #{$accordion-button-active-bg};
9
+
10
+ // Card
11
+ .card {
12
+ --#{$prefix}card-bg: transparent;
13
+ }
14
+
15
+ &:not(header, .accordion) {
16
+ background: $value !important;
17
+ }
18
+ .bcl-header__navbar {
19
+ background: $value !important;
20
+ }
21
+ }
22
+ }
@@ -0,0 +1,69 @@
1
+ // Color scheme - List Group
2
+
3
+ @mixin generate-badges($color, $value) {
4
+ .badge.bg-#{$color} a,
5
+ .badge.bg-#{$color} {
6
+ @if $color == light or $color == warning {
7
+ color: $black;
8
+ } @else {
9
+ color: $white;
10
+ }
11
+ }
12
+ .badge-outline-#{$color} a {
13
+ color: $value !important;
14
+ }
15
+ .badge-outline-#{$color} {
16
+ background: transparent !important;
17
+ @if $color == light {
18
+ border: $border-width solid $light;
19
+ color: $light !important;
20
+ } @else {
21
+ border: $border-width solid $value;
22
+ color: $value !important;
23
+ }
24
+ }
25
+ a.badge {
26
+ &:focus-within,
27
+ &:active,
28
+ &:hover {
29
+ &.badge-outline-#{$color} {
30
+ @if $color == dark {
31
+ background-color: $light !important;
32
+ border-color: $black;
33
+ } @else if $color == light {
34
+ border-color: $white;
35
+ color: $white;
36
+ background: rgba($white, 0.3) !important;
37
+ } @else {
38
+ background-color: tint-color($value, 90%) !important;
39
+ border-color: shade-color($value, 15%) !important;
40
+ }
41
+ }
42
+ &.text-bg-#{$color} {
43
+ background-color: shade-color($value, 15%) !important;
44
+ }
45
+ }
46
+ &.text-bg-#{$color} {
47
+ &:focus {
48
+ @if $enable-shadows {
49
+ @include box-shadow(
50
+ $btn-box-shadow,
51
+ 0 0 0 $btn-focus-width
52
+ rgba(mix(color-contrast($value), $value, 15%), 0.5)
53
+ );
54
+ } @else {
55
+ box-shadow: 0
56
+ 0
57
+ 0
58
+ $btn-focus-width
59
+ rgba(mix(color-contrast($value), $value, 15%), 0.5);
60
+ }
61
+ }
62
+ }
63
+ &.badge-outline-#{$color} {
64
+ &:focus {
65
+ box-shadow: 0 0 0 $btn-focus-width rgba($value, 0.5);
66
+ }
67
+ }
68
+ }
69
+ }
@@ -0,0 +1,31 @@
1
+ // Color scheme - buttons
2
+
3
+ @mixin generate-buttons($color, $value) {
4
+ // Buttons
5
+ .btn-#{$color} {
6
+ @if $color == "light" {
7
+ @include button-variant(
8
+ $value,
9
+ $value,
10
+ $hover-background: shade-color($value, $btn-hover-bg-shade-amount),
11
+ $hover-border: shade-color($value, $btn-hover-border-shade-amount),
12
+ $active-background: shade-color($value, $btn-active-bg-shade-amount),
13
+ $active-border: shade-color($value, $btn-active-border-shade-amount)
14
+ );
15
+ } @else if $color == "dark" {
16
+ @include button-variant(
17
+ $value,
18
+ $value,
19
+ $hover-background: tint-color($value, $btn-hover-bg-tint-amount),
20
+ $hover-border: tint-color($value, $btn-hover-border-tint-amount),
21
+ $active-background: tint-color($value, $btn-active-bg-tint-amount),
22
+ $active-border: tint-color($value, $btn-active-border-tint-amount)
23
+ );
24
+ } @else {
25
+ @include button-variant($value, $value);
26
+ }
27
+ }
28
+ .btn-outline-#{$color} {
29
+ @include button-outline-variant($value);
30
+ }
31
+ }
@@ -0,0 +1,6 @@
1
+ @mixin generate-link($color, $value) {
2
+ // Links
3
+ $link-hover-color: shift-color($value, $link-shade-percentage);
4
+ --bs-link-color: #{$value};
5
+ --bs-link-hover-color: #{$link-hover-color};
6
+ }
@@ -0,0 +1,15 @@
1
+ // Color scheme - List Group
2
+
3
+ @mixin generate-list-group($color, $value) {
4
+ // List group
5
+ $lg-v-bg: shift-color($value, $list-group-item-bg-scale);
6
+ $lg-v-color: shift-color($value, $list-group-item-color-scale);
7
+ @if (contrast-ratio($lg-v-bg, $lg-v-color) < $min-contrast-ratio) {
8
+ $lg-v-color: mix(
9
+ $value,
10
+ color-contrast($lg-v-bg),
11
+ abs($list-group-item-color-scale)
12
+ );
13
+ }
14
+ @include list-group-item-variant($color, $lg-v-bg, $lg-v-color);
15
+ }
@@ -0,0 +1,29 @@
1
+ // Color scheme - Text
2
+
3
+ @mixin generate-text($color, $value) {
4
+ &.text-color-default {
5
+ // Accordion
6
+ --#{$prefix}accordion-btn-color: #{$value};
7
+ --#{$prefix}accordion-active-color: #{$value};
8
+ --#{$prefix}accordion-color: #{$value};
9
+
10
+ color: $value !important;
11
+
12
+ .icon--file {
13
+ color: $value;
14
+ }
15
+ .bcl-header__navbar {
16
+ .navbar-nav {
17
+ .nav-link {
18
+ color: $value;
19
+ }
20
+ }
21
+ }
22
+ &.bcl-footer--neutral {
23
+ p,
24
+ a {
25
+ color: $value;
26
+ }
27
+ }
28
+ }
29
+ }
@@ -0,0 +1,41 @@
1
+ // Color scheme - utilities
2
+
3
+ @mixin generate-utilities($color, $value) {
4
+ $color-rgb: to-rgb($value);
5
+ &.text-bg-#{$color},
6
+ .text-bg-#{$color} {
7
+ color: color-contrast($value)
8
+ if($enable-important-utilities, !important, null);
9
+ background-color: RGBA($color-rgb, var(--#{$prefix}bg-opacity, 1))
10
+ if($enable-important-utilities, !important, null);
11
+ }
12
+
13
+ &.bg-#{$color},
14
+ .bg-#{$color} {
15
+ --bs-bg-opacity: 1;
16
+ background-color: rgba(
17
+ var(--bs-#{$color}-rgb),
18
+ var(--bs-bg-opacity)
19
+ ) !important;
20
+ }
21
+
22
+ .link-#{$color} {
23
+ color: $value !important; // stylelint-disable-line declaration-no-important
24
+
25
+ @if $link-shade-percentage != 0 {
26
+ &:hover,
27
+ &:focus {
28
+ color: if(
29
+ color-contrast($value) == $color-contrast-light,
30
+ shade-color($value, $link-shade-percentage),
31
+ tint-color($value, $link-shade-percentage)
32
+ ) !important; // stylelint-disable-line declaration-no-important
33
+ }
34
+ }
35
+ }
36
+ @if $color == "primary" {
37
+ .icon--primary {
38
+ color: $value;
39
+ }
40
+ }
41
+ }
@@ -0,0 +1,25 @@
1
+ @each $scheme-name, $scheme-array in $colors-schemes {
2
+ .#{$scheme-name} {
3
+ $theme-colors-rgb: map-loop($scheme-array, to-rgb, "$value");
4
+ @each $color, $value in $theme-colors-rgb {
5
+ --#{$prefix}#{$color}-rgb: #{$value};
6
+ }
7
+ @each $color, $value in $scheme-array {
8
+ --#{$prefix}#{$color}: #{$value};
9
+
10
+ @if $color == "text" {
11
+ @include generate-text($color, $value);
12
+ } @else if $color == "link" {
13
+ @include generate-link($color, $value);
14
+ } @else if $color == "background" {
15
+ @include generate-background($color, $value);
16
+ } @else {
17
+ @include generate-alerts($color, $value);
18
+ @include generate-buttons($color, $value);
19
+ @include generate-list-group($color, $value);
20
+ @include generate-badges($color, $value);
21
+ @include generate-utilities($color, $value);
22
+ }
23
+ }
24
+ }
25
+ }
@@ -93,7 +93,7 @@
93
93
  icon: _item.icon|merge({
94
94
  path: _icon_path,
95
95
  size: 'l',
96
- attributes: _icon_attributes.addClass('mb-2'),
96
+ attributes: _icon_attributes.addClass(['mb-2', 'icon--primary']),
97
97
  })
98
98
  }) %}
99
99
  {% include '@oe-bcl/bcl-icon/icon.html.twig' with _item.icon only %}
@@ -69,18 +69,21 @@
69
69
  {% endif %}
70
70
  </div>
71
71
  <div class="col-12 col-md-3 align-self-end text-md-end">
72
- {% include '@oe-bcl/bcl-link/link.html.twig' with _item.download|merge({
72
+ {% set download_attributes = create_attribute()
73
+ .setAttribute('download', true)
74
+ .setAttribute('target', '_blank')
75
+ .addClass(['d-block', 'standalone', 'mt-1'])
76
+ %}
77
+ {% set _download_item = _item.download|merge({
73
78
  icon_position: "after",
74
79
  icon: {
75
80
  name: "download",
76
81
  size: "fluid",
77
82
  path: _icon_path,
78
- },
79
- attributes: create_attribute()
80
- .setAttribute('download', true)
81
- .setAttribute('target', '_blank')
82
- .addClass(['d-block', 'standalone', 'mt-1'])
83
- }) only %}
83
+ }|merge(_item.download.icon|default({})),
84
+ attributes: download_attributes.merge(_item.download.attributes|default(create_attribute()))
85
+ }) %}
86
+ {% include '@oe-bcl/bcl-link/link.html.twig' with _download_item only %}
84
87
  </div>
85
88
  </div>
86
89
  {% endif %}
@@ -138,17 +138,18 @@
138
138
  </small>
139
139
  {% endif %}
140
140
  </div>
141
+ {% set download_attributes = create_attribute()
142
+ .setAttribute('download', 'true')
143
+ .setAttribute('target', '_blank')
144
+ .addClass(['standalone', 'align-self-center', 'd-inline-block', 'mt-1', 'mt-md-0', 'flex-shrink-0']) %}
141
145
  {% set _download = _download|merge({
142
146
  icon_position: "after",
143
147
  icon: {
144
148
  name: "download",
145
149
  size: "fluid",
146
150
  path: _icon_path,
147
- },
148
- attributes: create_attribute()
149
- .setAttribute('download', true)
150
- .setAttribute('target', '_blank')
151
- .addClass(['standalone', 'align-self-center', 'd-inline-block', 'mt-1', 'mt-md-0', 'flex-shrink-0'])
151
+ }|merge(_download.icon|default({})),
152
+ attributes: download_attributes.merge(_download.attributes|default(create_attribute()))
152
153
  }) %}
153
154
  {% include '@oe-bcl/bcl-link/link.html.twig' with _download only %}
154
155
  </div>
@@ -35,18 +35,18 @@
35
35
 
36
36
  {% set attributes = attributes.addClass(_classes) %}
37
37
 
38
- <div
39
- {{ attributes }}
40
- >
41
- {% if _title is not empty %}
42
- {% include '@oe-bcl/bcl-heading/heading.html.twig' with {
43
- title: _title,
44
- title_tag: _title_tag,
45
- title_link: _title_link,
46
- attributes: _title_attributes.addClass(_title_classes),
47
- } only %}
48
- {% endif %}
49
- {% if _links is not empty and _links is iterable %}
38
+ {% if _links is not empty and _links is iterable %}
39
+ <div
40
+ {{ attributes }}
41
+ >
42
+ {% if _title is not empty %}
43
+ {% include '@oe-bcl/bcl-heading/heading.html.twig' with {
44
+ title: _title,
45
+ title_tag: _title_tag,
46
+ title_link: _title_link,
47
+ attributes: _title_attributes.addClass(_title_classes),
48
+ } only %}
49
+ {% endif %}
50
50
  <ul class="ps-0 mb-0">
51
51
  {% for _link in _links %}
52
52
  {% if _link.attributes is empty %}
@@ -70,7 +70,7 @@
70
70
  </li>
71
71
  {% endfor %}
72
72
  </ul>
73
- {% endif %}
74
- </div>
73
+ </div>
74
+ {% endif %}
75
75
 
76
76
  {% endapply %}