@oslokommune/punkt-css 3.1.1 → 3.2.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.
@@ -8,6 +8,7 @@
8
8
  @use 'sass:map';
9
9
  @use '../abstracts/variables';
10
10
  @use '../abstracts/mixins/typography';
11
+ @use '../abstracts/functions';
11
12
 
12
13
  body {
13
14
  color: var(--color-blue-dark);
@@ -32,42 +33,141 @@ strong {
32
33
  }
33
34
 
34
35
  a {
36
+ // Order of pseudoclasses is important for specificity:
37
+ // link, visited, hover, focus, active
38
+ // but we don't use visited, so we can skip :link
39
+
35
40
  color: var(--color-blue-dark);
36
41
  text-decoration: underline;
37
42
  word-wrap: break-word;
38
43
 
44
+ // visited
39
45
  &:visited {
40
- color: var(--color-visited);
41
- }
42
- &:focus {
43
- color: var(--color-active);
46
+ color: var(--color-blue-dark);
44
47
  }
45
- &:hover {
48
+
49
+ // hover
50
+ &:hover,
51
+ &.pkt-link--hover {
46
52
  color: var(--color-hover);
47
53
  text-decoration: underline;
48
54
  }
49
- &:active {
55
+
56
+ // focus
57
+ &:focus-visible,
58
+ &.pkt-link--focus {
59
+ box-shadow: 0px 0px 0px 0.125rem var(--color-active),
60
+ 0px 0px 0px 0.375rem var(--color-visited-light);
61
+ outline: none;
62
+ color: var(--color-hover);
63
+ }
64
+ &:focus:not(:focus-visible) {
65
+ box-shadow: none;
66
+ outline: 0.125rem solid var(--color-active);
67
+ color: var(--color-hover);
68
+ }
69
+
70
+ // active
71
+ &:active,
72
+ &.pkt-link--active {
50
73
  color: var(--color-active);
51
74
  }
52
75
 
53
76
  @at-root [data-mode='dark'] a {
54
- color: var(--color-white);
77
+ // link
78
+ &:link,
79
+ &.pkt-link--link {
80
+ color: var(--color-white);
81
+ text-decoration: underline;
82
+ word-wrap: break-word;
83
+ }
55
84
 
85
+ // visited
56
86
  &:visited {
57
- color: var(--color-visited-light);
87
+ color: var(--color-white);
58
88
  }
59
- &:focus {
60
- color: var(--color-active-light);
89
+
90
+ // hover
91
+ &:hover,
92
+ &.pkt-link--hover {
93
+ color: var(--color-hover-light);
61
94
  }
62
- &:hover {
95
+
96
+ // focus
97
+ &:focus-visible,
98
+ &.pkt-link--focus {
99
+ box-shadow: 0px 0px 0px 0.125rem var(--color-active-light),
100
+ 0px 0px 0px 0.375rem var(--color-visited-light);
101
+ outline: none;
63
102
  color: var(--color-hover-light);
64
103
  }
65
- &:active {
104
+ &:focus:not(:focus-visible) {
105
+ box-shadow: none;
106
+ outline: 0.125rem solid var(--color-visited-light);
107
+ color: var(--color-hover-light);
108
+ }
109
+
110
+ // active
111
+ &:active,
112
+ &.pkt-link--active {
66
113
  color: var(--color-active-light);
67
114
  }
68
115
  }
69
116
  }
70
117
 
118
+ @mixin icon-new-window-small($fg-color: #2a2859, $bg-color: null) {
119
+ $svg: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" id="new-window-small" fill="none" data-category="ui" viewBox="0 0 32 32"><g fill="#{$fg-color}"><path d="M23.03 21.11v2.06H8.97V9.18h2.06v-2H8.97v-.01h-2v18h18.06v-4.06h-2Z"/><path d="M18 7.16v2h3.62l-7.26 7.28 1.38 1.39 7.27-7.29v3.63h2.02V7.16H18Z"/></g></svg>');
120
+ background-image: functions.escape-svg($svg);
121
+ background-repeat: no-repeat;
122
+ }
123
+
124
+ .pkt-link {
125
+ display: inline-flex;
126
+ text-align: left;
127
+ align-items: center;
128
+
129
+ &__icon {
130
+ --fg-color: currentColor;
131
+ width: 1.5rem;
132
+ height: 1.5rem;
133
+ flex-shrink: 0;
134
+ margin-right: 0.5rem;
135
+ }
136
+
137
+ &--icon-left {
138
+ flex-direction: row;
139
+ text-decoration: none;
140
+ }
141
+
142
+ &--icon-right {
143
+ flex-direction: row-reverse;
144
+ text-decoration: none;
145
+ }
146
+
147
+ &--external::after {
148
+ content: ' ';
149
+ @include icon-new-window-small(#2a2859, null);
150
+ background-size: 18px 18px;
151
+ width: 1.125rem;
152
+ height: 1.125rem;
153
+ }
154
+
155
+ &--external:hover::after {
156
+ @include icon-new-window-small(#1f42aa, null);
157
+ }
158
+ }
159
+
160
+ @at-root [data-mode='dark'] {
161
+ .pkt-link {
162
+ &--external::after {
163
+ @include icon-new-window-small(white, null);
164
+ }
165
+ &--external:hover::after {
166
+ @include icon-new-window-small(#b3f5ff, null);
167
+ }
168
+ }
169
+ }
170
+
71
171
  /*
72
172
  * origo typography
73
173
  * prefix pkt
@@ -60,6 +60,9 @@ $-border-thickness: map.get(variables.$spacing, 'size-4');
60
60
  p {
61
61
  margin-bottom: map.get(variables.$spacing, 'size-16');
62
62
 
63
+ &:first-of-type {
64
+ margin-top: 0;
65
+ }
63
66
  &:last-of-type {
64
67
  margin-bottom: 0;
65
68
  }
@@ -7,3 +7,4 @@
7
7
  @forward 'icon';
8
8
  @forward 'teaserlist';
9
9
  @forward 'messagebox';
10
+ @forward 'linkcard';
@@ -0,0 +1,75 @@
1
+ /*
2
+ * Linkcard component
3
+ */
4
+ @use 'sass:map';
5
+ @use '../abstracts/variables';
6
+ @use '../abstracts/mixins/breakpoints' as *;
7
+ @use '../abstracts/' as *;
8
+
9
+ $-module-name: 'pkt-linkcard';
10
+
11
+ // Spacing
12
+ $-linkcard-spacing: map.get(variables.$spacing, 'size-16');
13
+ $-linkcard-spacing-big: map.get(variables.$spacing, 'size-24');
14
+
15
+ .#{$-module-name} {
16
+ align-items: flex-start;
17
+ padding: $-linkcard-spacing;
18
+ text-decoration: none;
19
+
20
+ @include bp('laptop-up') {
21
+ padding: $-linkcard-spacing-big;
22
+ }
23
+
24
+ &:hover {
25
+ text-decoration: none;
26
+ }
27
+ &:hover .pkt-linkcard__title {
28
+ text-decoration: underline;
29
+ }
30
+
31
+ &__title {
32
+ @include get-text('pkt-txt-24-medium');
33
+ margin-bottom: 0.5rem;
34
+ }
35
+ &__text {
36
+ p:first-of-type {
37
+ margin-top: 0;
38
+ }
39
+ p:last-of-type {
40
+ margin-bottom: 0;
41
+ }
42
+ }
43
+
44
+ & svg {
45
+ margin-top: 0.313rem;
46
+ }
47
+ // Modifiers
48
+ &--beige {
49
+ background-color: var(--color-beige-light);
50
+ }
51
+ &--blue {
52
+ background-color: var(--color-blue-5);
53
+ }
54
+ &--grey-outline {
55
+ border: 4px solid var(--color-gray);
56
+ }
57
+ &--beige-outline {
58
+ border: 4px solid var(--color-beige-light);
59
+ }
60
+ }
61
+ // Dark mode
62
+ @at-root [data-mode='dark'] .pkt-linkcard {
63
+ &--beige {
64
+ color: var(--color-blue-dark) !important;
65
+ &:focus {
66
+ color: var(--color-hover) !important;
67
+ }
68
+ }
69
+ &--blue {
70
+ color: var(--color-blue-dark) !important;
71
+ &:focus {
72
+ color: var(--color-hover) !important;
73
+ }
74
+ }
75
+ }
@@ -49,7 +49,7 @@ $-skins: (
49
49
  'focus-bg': --color-active,
50
50
  'focus-bc': --color-active,
51
51
  'focus-txt': --color-white,
52
- 'focus-outline': --color-active,
52
+ 'focus-outline': --color-visited-light,
53
53
  'hover-bg': --color-active,
54
54
  'hover-bc': --color-active,
55
55
  'hover-txt': --color-white,
@@ -67,7 +67,7 @@ $-skins: (
67
67
  'focus-bg': --color-blue,
68
68
  'focus-bc': --color-blue,
69
69
  'focus-txt': --color-blue-dark,
70
- 'focus-outline': --color-active-light,
70
+ 'focus-outline': --color-visited-light,
71
71
  'hover-bg': --color-blue,
72
72
  'hover-bc': --color-blue,
73
73
  'hover-txt': --color-blue-dark,
@@ -87,7 +87,7 @@ $-skins: (
87
87
  'focus-bg': --color-transparent,
88
88
  'focus-bc': --color-active,
89
89
  'focus-txt': --color-active,
90
- 'focus-outline': --color-active,
90
+ 'focus-outline': --color-visited-light,
91
91
  'hover-bg': --color-active,
92
92
  'hover-bc': --color-active,
93
93
  'hover-txt': --color-white,
@@ -105,7 +105,7 @@ $-skins: (
105
105
  'focus-bg': --color-transparent,
106
106
  'focus-bc': --color-active-light,
107
107
  'focus-txt': --color-active-light,
108
- 'focus-outline': --color-active-light,
108
+ 'focus-outline': --color-visited-light,
109
109
  'hover-bg': --color-active-light,
110
110
  'hover-bc': --color-active-light,
111
111
  'hover-txt': --color-blue-dark,
@@ -123,7 +123,7 @@ $-skins: (
123
123
  'link-bc': --color-transparent,
124
124
  'link-txt': --color-blue-dark,
125
125
  'focus-bg': --color-gray,
126
- 'focus-bc': --color-gray,
126
+ 'focus-bc': --color-active,
127
127
  'focus-txt': --color-active,
128
128
  'hover-bg': --color-gray,
129
129
  'hover-bc': --color-gray,
@@ -140,9 +140,9 @@ $-skins: (
140
140
  'link-bc': --color-transparent,
141
141
  'link-txt': --color-white,
142
142
  'focus-bg': --color-blue-5,
143
- 'focus-bc': --color-blue-5,
143
+ 'focus-bc': --color-active,
144
144
  'focus-txt': --color-blue-dark,
145
- 'focus-outline': --color-active-light,
145
+ 'focus-outline': --color-visited-light,
146
146
  'hover-bg': --color-blue-5,
147
147
  'hover-bc': --color-blue-5,
148
148
  'hover-txt': --color-blue-dark,
@@ -292,8 +292,7 @@ $-skins: (
292
292
  background-color: var(--btn-focus-bg);
293
293
  color: var(--btn-focus-txt);
294
294
  border-color: var(--btn-focus-bc);
295
- outline: 2px solid var(--btn-focus-outline);
296
- outline-offset: 4px;
295
+ outline: 4px solid var(--btn-focus-outline);
297
296
  text-decoration: none;
298
297
  }
299
298
  @at-root a.#{$-module-name}:hover,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oslokommune/punkt-css",
3
- "version": "3.1.1",
3
+ "version": "3.2.0",
4
4
  "description": "CSS-rammeverket til Punkt, et designsystem laget av Oslo Origo",
5
5
  "homepage": "https://punkt.oslo.kommune.no",
6
6
  "author": "Team Designsystem, Oslo Origo",
@@ -21,7 +21,7 @@
21
21
  "watch": "chokidar \"src/scss/**/*\" -c \"npm run build\""
22
22
  },
23
23
  "devDependencies": {
24
- "@oslokommune/punkt-assets": "^3.1.1",
24
+ "@oslokommune/punkt-assets": "^3.1.2",
25
25
  "astro": "^2.0.2",
26
26
  "chokidar-cli": "^3.0.0",
27
27
  "edit-json-file": "^1.7.0",
@@ -32,7 +32,7 @@
32
32
  "svgson": "^5.2.1"
33
33
  },
34
34
  "peerDependencies": {
35
- "@oslokommune/punkt-assets": ">=1.0.0"
35
+ "@oslokommune/punkt-assets": ">=3.1.0"
36
36
  },
37
37
  "engines": {
38
38
  "node": ">=16.0.0"
@@ -57,5 +57,5 @@
57
57
  "url": "https://github.com/oslokommune/punkt/issues"
58
58
  },
59
59
  "license": "MIT",
60
- "gitHead": "7c3dbc3909ada6d66ad4a2e4c9027ce24fe75f16"
60
+ "gitHead": "7345e84b92a76ab77af09ee17660eaa20790e28e"
61
61
  }