@oslokommune/punkt-css 7.2.0 → 8.0.4

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.
@@ -143,7 +143,7 @@ a,
143
143
 
144
144
  &--external::after {
145
145
  content: ' ';
146
- --svg: url(https://punkt-cdn.oslo.kommune.no/7.2/icons/new-window-small.svg);
146
+ --svg: url(https://punkt-cdn.oslo.kommune.no/8.0/icons/new-window-small.svg);
147
147
  background-image: var(--svg);
148
148
  background-repeat: no-repeat;
149
149
  background-size: 18px 18px;
@@ -22,12 +22,22 @@
22
22
  }
23
23
 
24
24
  &__helptext {
25
+ width: min(100%, 31rem);
25
26
  display: flex;
26
27
  flex-direction: column;
27
28
  align-items: flex-start;
28
29
  gap: map.get(variables.$spacing, 'size-4');
29
30
  @include typography.get-text('pkt-txt-14-light');
30
31
 
32
+ > * {
33
+ &:first-child {
34
+ margin-top: 0;
35
+ }
36
+ &:last-child {
37
+ margin-bottom: 0;
38
+ }
39
+ }
40
+
31
41
  &-expandable {
32
42
  display: inline-flex;
33
43
  text-align: left;
@@ -39,7 +49,6 @@
39
49
  }
40
50
 
41
51
  &-open {
42
- width: 100%;
43
52
  display: block;
44
53
  border-left: 2px solid var(--color-blue-dark);
45
54
  padding: map.get(variables.$spacing, 'size-8')
@@ -75,7 +84,7 @@
75
84
 
76
85
  // Alert
77
86
  .pkt-alert {
78
- width: 100%;
87
+ width: min(100%, 31rem);
79
88
  padding: 0.75rem 1rem 0.75rem calc(8px - 4px);
80
89
  margin: 0 0 0.5rem 0;
81
90
 
@@ -108,26 +117,26 @@
108
117
  }
109
118
 
110
119
  &--error {
111
- .pkt-textinput__input,
112
- .pkt-textinput__input-prefix,
113
- .pkt-textinput__input-suffix,
114
- .pkt-textinput__input-icon {
120
+ .pkt-input,
121
+ .pkt-input-prefix,
122
+ .pkt-input-suffix,
123
+ .pkt-input-icon {
115
124
  border-color: var(--color-red);
116
125
  }
117
126
 
118
- .pkt-textinput__input:hover,
119
- .pkt-textinput__container:hover .pkt-textinput__input,
120
- .pkt-textinput__container:hover .pkt-textinput__input-prefix,
121
- .pkt-textinput__container:hover .pkt-textinput__input-suffix,
122
- .pkt-textinput__container:hover .pkt-textinput__input-icon {
127
+ .pkt-input:hover,
128
+ .pkt-input__container:hover .pkt-input,
129
+ .pkt-input__container:hover .pkt-input-prefix,
130
+ .pkt-input__container:hover .pkt-input-suffix,
131
+ .pkt-input__container:hover .pkt-input-icon {
123
132
  border-color: var(--color-red);
124
133
  }
125
134
 
126
- .pkt-textinput__input:focus-within,
127
- .pkt-textinput__container:focus-within .pkt-textinput__input,
128
- .pkt-textinput__container:focus-within .pkt-textinput__input-prefix,
129
- .pkt-textinput__container:focus-within .pkt-textinput__input-suffix,
130
- .pkt-textinput__container:focus-within .pkt-textinput__input-icon {
135
+ .pkt-input:focus-within,
136
+ .pkt-input__container:focus-within .pkt-input,
137
+ .pkt-input__container:focus-within .pkt-input-prefix,
138
+ .pkt-input__container:focus-within .pkt-input-suffix,
139
+ .pkt-input__container:focus-within .pkt-input-icon {
131
140
  border-color: var(--color-red);
132
141
  }
133
142
  }
@@ -136,45 +145,36 @@
136
145
  color: var(--color-disabled);
137
146
  cursor: inherit;
138
147
 
139
- .pkt-textinput__input,
140
- .pkt-textinput__input-prefix,
141
- .pkt-textinput__input-suffix,
142
- .pkt-textinput__input-icon {
148
+ .pkt-input,
149
+ .pkt-input-prefix,
150
+ .pkt-input-suffix,
151
+ .pkt-input-icon {
143
152
  border-color: var(--color-disabled);
144
153
  background-color: var(--color-disabled-light);
145
154
  }
146
155
 
147
- .pkt-textinput__container:hover .pkt-textinput__input,
148
- .pkt-textinput__container:hover .pkt-textinput__input-prefix,
149
- .pkt-textinput__container:hover .pkt-textinput__input-suffix,
150
- .pkt-textinput__container:hover .pkt-textinput__input-icon {
156
+ .pkt-input__container:hover .pkt-input,
157
+ .pkt-input__container:hover .pkt-input-prefix,
158
+ .pkt-input__container:hover .pkt-input-suffix,
159
+ .pkt-input__container:hover .pkt-input-icon {
151
160
  border-color: var(--color-disabled);
152
161
  }
153
162
 
154
- .pkt-textinput__input:hover {
163
+ .pkt-input:hover {
155
164
  border-color: var(--color-disabled);
156
165
  box-shadow: none;
157
166
  }
158
167
 
159
- .pkt-textinput__input:focus {
168
+ .pkt-input:focus {
160
169
  border-color: var(--color-disabled);
161
170
  box-shadow: none;
162
171
  outline: none;
163
172
  }
164
173
 
165
- .pkt-textinput__container:active .pkt-textinput__input {
174
+ .pkt-input__container:active .pkt-input {
166
175
  border-right: none;
167
176
  box-shadow: none;
168
177
  outline: none;
169
178
  }
170
179
  }
171
- // Dark mode
172
- @at-root [data-mode='dark'] {
173
- .pkt-textinput__input-prefix,
174
- .pkt-textinput__input-suffix,
175
- .pkt-textinput__input-icon {
176
- background-color: var(--color-white);
177
- color: var(--color-blue-dark);
178
- }
179
- }
180
180
  }
@@ -1,180 +1,13 @@
1
- /* textinput */
2
- @use 'sass:map';
3
- @use '../abstracts/variables';
4
- @use '../abstracts/functions';
5
- @use '../abstracts/mixins/typography';
1
+ /*
2
+ * Textinput component
3
+ *
4
+ * Denne blir stilsatt av .pkt-input
5
+ * Ikke bruk klassen .pkt-textinput
6
+ */
7
+ @use '../elements/input';
6
8
 
7
9
  .pkt-textinput {
8
10
  &__input {
9
- @include typography.get-text('pkt-txt-18-light');
10
- display: flex;
11
- align-items: center;
12
- appearance: none; // Fix appearance on date inputs in Safari
13
- background-color: var(--color-white);
14
- border: 2px solid var(--color-blue-dark);
15
- border-radius: 0;
16
- color: var(--color-blue-dark);
17
- margin: 0;
18
- padding: 0.5rem 1rem;
19
- width: 100%;
20
-
21
- &:is(textarea) {
22
- min-height: map.get(variables.$spacing, 'size-128');
23
- }
24
-
25
- // 1. Override Firefox's default opacity
26
- &::placeholder {
27
- color: var(--color-grayscale-50);
28
- opacity: 1; // 1
29
- }
30
-
31
- // states
32
- &:hover,
33
- &.pkt-textinput__textinput--hover {
34
- border-color: var(--color-hover);
35
- }
36
-
37
- &:focus-visible + .pkt-textinput-suffix,
38
- &.pkt-textinput__textinput--focus {
39
- box-shadow: 0 0 0 2px var(--color-active);
40
- border-color: var(--color-active);
41
- }
42
-
43
- &:focus {
44
- outline: none;
45
- box-shadow: 0 0 0 2px var(--color-active);
46
- border-color: var(--color-active);
47
- }
48
-
49
- &:disabled,
50
- &:disabled::placeholder,
51
- &[readonly] {
52
- opacity: 1;
53
- background-color: var(--color-disabled-light);
54
- border-color: var(--color-disabled);
55
- cursor: inherit;
56
- }
57
-
58
- &:disabled:active {
59
- border: 2px solid var(--color-disabled);
60
- }
61
-
62
- &-prefix,
63
- &-suffix,
64
- &-icon {
65
- @include typography.get-text('pkt-txt-18-light');
66
- display: flex;
67
- align-items: center;
68
- width: auto;
69
- height: 3rem;
70
- border: 2px solid var(--color-blue-dark);
71
- flex-shrink: 0;
72
- }
73
-
74
- &-prefix {
75
- padding: 0.5rem 0rem 0.5rem 1rem;
76
-
77
- &::after {
78
- content: '';
79
- width: 1px;
80
- margin-left: 0.5rem;
81
- height: 100%;
82
- background-color: var(--color-blue-dark);
83
- }
84
- }
85
-
86
- &-suffix {
87
- padding: 0.5rem 1rem 0.5rem 0rem;
88
-
89
- svg {
90
- width: 1.5rem;
91
- height: 1.5rem;
92
- margin-left: 0.5rem;
93
- }
94
-
95
- &::before {
96
- content: '';
97
- width: 1px;
98
- margin-right: 0.5rem;
99
- height: 1.5rem;
100
- background-color: var(--color-blue-dark);
101
- }
102
- }
103
-
104
- &-icon {
105
- padding: 0.5rem 1rem;
106
- align-self: stretch;
107
-
108
- & svg {
109
- width: 1.5rem;
110
- height: 1.5rem;
111
- margin-left: 0.5rem;
112
- }
113
- }
114
-
115
- &--counter-error,
116
- &--counter-error:focus {
117
- border-color: var(--color-red);
118
- background-color: var(--color-red-30);
119
- }
120
- &--counter-error:focus {
121
- box-shadow: 0 0 0 2px var(--color-red);
122
- }
123
- }
124
-
125
- &__container {
126
- display: flex;
127
- align-items: center;
128
- align-self: stretch;
129
-
130
- :first-child:not(:only-child) {
131
- border-right: none;
132
- }
133
-
134
- :last-child:not(:only-child) {
135
- border-left: none;
136
- }
137
-
138
- :not(:first-child):not(:last-child) {
139
- border-left: none;
140
- border-right: none;
141
- }
142
-
143
- p {
144
- margin: 0;
145
- }
146
-
147
- //states
148
- & input:focus {
149
- box-shadow: none;
150
- }
151
-
152
- &:hover .pkt-textinput__input,
153
- &:hover .pkt-textinput__input-prefix,
154
- &:hover .pkt-textinput__input-suffix,
155
- &:hover .pkt-textinput__input-icon {
156
- border-color: var(--color-hover);
157
- }
158
-
159
- &:focus-within {
160
- outline: 2px solid var(--color-active);
161
-
162
- .pkt-textinput__input,
163
- .pkt-textinput__input-prefix,
164
- .pkt-textinput__input-suffix,
165
- .pkt-textinput__input-icon {
166
- border-color: var(--color-active);
167
- }
168
- }
169
- }
170
-
171
- &__counter {
172
- @include typography.get-text('pkt-txt-14-light');
173
- width: 100%;
174
- text-align: right;
175
- &--error {
176
- @include typography.get-text('pkt-txt-14-medium');
177
- color: var(--color-red);
178
- }
11
+ @extend .pkt-input;
179
12
  }
180
13
  }
@@ -81,7 +81,7 @@ $-module-name: 'pkt-form-check-input';
81
81
  }
82
82
 
83
83
  &[type='checkbox'] {
84
- --svg: url(https://punkt-cdn.oslo.kommune.no/7.2/icons/check-medium.svg);
84
+ --svg: url(https://punkt-cdn.oslo.kommune.no/8.0/icons/check-medium.svg);
85
85
  position: relative;
86
86
  background-color: blue;
87
87
  }
@@ -3,6 +3,7 @@
3
3
  @forward 'checkbox-radio';
4
4
  @forward 'hr';
5
5
  @forward 'image';
6
+ @forward 'input';
6
7
  @forward 'list';
7
8
  @forward 'section';
8
9
  @forward 'select';
@@ -0,0 +1,218 @@
1
+ /* Common styles for all inputs */
2
+ @use 'sass:map';
3
+ @use '../abstracts/variables';
4
+ @use '../abstracts/functions';
5
+ @use '../abstracts/mixins/typography';
6
+
7
+ .pkt-input {
8
+ @include typography.get-text('pkt-txt-18-light');
9
+ display: flex;
10
+ align-items: center;
11
+ appearance: none; // Fix appearance on date inputs in Safari
12
+ background-color: var(--color-white);
13
+ border: 2px solid var(--color-blue-dark);
14
+ border-radius: 0;
15
+ color: var(--color-blue-dark);
16
+ margin: 0;
17
+ padding: 0.5rem 1rem;
18
+
19
+ &:not(textarea[cols]):not(input[size]):not(&--fullwidth),
20
+ &__container:not(:has(textarea[cols])):not(:has(input[size])):not(
21
+ :has(&--fullwidth)
22
+ ) {
23
+ width: min(100%, 31rem);
24
+ }
25
+
26
+ &--fullwidth {
27
+ width: 100%;
28
+ }
29
+
30
+ &:is(textarea) {
31
+ min-height: map.get(variables.$spacing, 'size-128');
32
+ }
33
+
34
+ &:is(select) {
35
+ appearance: none;
36
+ -moz-appearance: none;
37
+ -webkit-appearance: none;
38
+ padding-right: 3rem;
39
+
40
+ &:not([multiple]) {
41
+ background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Cpath fill='var(--fg-color %232A2859)' fill-rule='evenodd' d='M16 19.41 6.33 10 5 11.29 16 22l11-10.71L25.67 10 16 19.41z'/%3E%3C/svg%3E");
42
+ background-repeat: no-repeat;
43
+ background-position: right 0.7rem top 50%;
44
+ background-size: 1.5rem auto, 100%;
45
+ }
46
+
47
+ option {
48
+ background-color: var(--color-white);
49
+ color: var(--color-blue-dark);
50
+ font-weight: normal;
51
+ }
52
+ }
53
+
54
+ // 1. Override Firefox's default opacity
55
+ &::placeholder {
56
+ color: var(--color-grayscale-50);
57
+ opacity: 1; // 1
58
+ }
59
+
60
+ // states
61
+ &:hover,
62
+ &.pkt-input--hover {
63
+ border-color: var(--color-hover);
64
+ }
65
+
66
+ &:focus-visible + &-suffix,
67
+ &.pkt-input__textinput--focus {
68
+ box-shadow: 0 0 0 2px var(--color-active);
69
+ border-color: var(--color-active);
70
+ }
71
+
72
+ &:focus {
73
+ outline: none;
74
+ box-shadow: 0 0 0 2px var(--color-active);
75
+ border-color: var(--color-active);
76
+ }
77
+
78
+ &:disabled,
79
+ &:disabled::placeholder,
80
+ &[readonly] {
81
+ opacity: 1;
82
+ background-color: var(--color-disabled-light);
83
+ border-color: var(--color-disabled);
84
+ cursor: inherit;
85
+ }
86
+
87
+ &:disabled:active {
88
+ border: 2px solid var(--color-disabled);
89
+ }
90
+
91
+ &-prefix,
92
+ &-suffix,
93
+ &-icon {
94
+ @include typography.get-text('pkt-txt-18-light');
95
+ display: flex;
96
+ align-items: center;
97
+ width: auto;
98
+ height: 3rem;
99
+ border: 2px solid var(--color-blue-dark);
100
+ flex-shrink: 0;
101
+ }
102
+
103
+ &-prefix {
104
+ padding: 0.5rem 0rem 0.5rem 1rem;
105
+
106
+ &::after {
107
+ content: '';
108
+ width: 1px;
109
+ margin-left: 0.5rem;
110
+ height: 100%;
111
+ background-color: var(--color-blue-dark);
112
+ }
113
+ }
114
+
115
+ &-suffix {
116
+ padding: 0.5rem 1rem 0.5rem 0rem;
117
+
118
+ svg {
119
+ width: 1.5rem;
120
+ height: 1.5rem;
121
+ margin-left: 0.5rem;
122
+ }
123
+
124
+ &::before {
125
+ content: '';
126
+ width: 1px;
127
+ margin-right: 0.5rem;
128
+ height: 1.5rem;
129
+ background-color: var(--color-blue-dark);
130
+ }
131
+ }
132
+
133
+ &-icon {
134
+ padding: 0.5rem 1rem;
135
+ align-self: stretch;
136
+
137
+ & svg {
138
+ width: 1.5rem;
139
+ height: 1.5rem;
140
+ margin-left: 0.5rem;
141
+ }
142
+ }
143
+
144
+ &--counter-error,
145
+ &--counter-error:focus {
146
+ border-color: var(--color-red);
147
+ background-color: var(--color-red-30);
148
+ }
149
+ &--counter-error:focus {
150
+ box-shadow: 0 0 0 2px var(--color-red);
151
+ }
152
+
153
+ &__container {
154
+ display: flex;
155
+ align-items: center;
156
+ align-self: stretch;
157
+
158
+ :first-child:not(:only-child) {
159
+ border-right: none;
160
+ }
161
+
162
+ :last-child:not(:only-child) {
163
+ border-left: none;
164
+ }
165
+
166
+ :not(:first-child):not(:last-child) {
167
+ border-left: none;
168
+ border-right: none;
169
+ }
170
+
171
+ p {
172
+ margin: 0;
173
+ }
174
+
175
+ //states
176
+ & input:focus {
177
+ box-shadow: none;
178
+ }
179
+
180
+ &:hover .pkt-input,
181
+ &:hover .pkt-input-prefix,
182
+ &:hover .pkt-input-suffix,
183
+ &:hover .pkt-input-icon {
184
+ border-color: var(--color-hover);
185
+ }
186
+
187
+ &:focus-within {
188
+ outline: 2px solid var(--color-active);
189
+
190
+ .pkt-input,
191
+ .pkt-input-prefix,
192
+ .pkt-input-suffix,
193
+ .pkt-input-icon {
194
+ border-color: var(--color-active);
195
+ }
196
+ }
197
+ }
198
+
199
+ &__counter {
200
+ @include typography.get-text('pkt-txt-14-light');
201
+ width: 100%;
202
+ text-align: right;
203
+ &--error {
204
+ @include typography.get-text('pkt-txt-14-medium');
205
+ color: var(--color-red);
206
+ }
207
+ }
208
+ }
209
+
210
+ // Dark mode
211
+ @at-root [data-mode='dark'] {
212
+ .pkt-input-prefix,
213
+ .pkt-input-suffix,
214
+ .pkt-input-icon {
215
+ background-color: var(--color-white);
216
+ color: var(--color-blue-dark);
217
+ }
218
+ }
@@ -1,73 +1,13 @@
1
1
  /*
2
2
  * Select component
3
3
  *
4
- * TODO: Det er ikke optimalt løst å duplisere svg-ikonet,
5
- * dette refaktoreres ved anledning.
4
+ * Denne blir stilsatt av .pkt-input
5
+ * Ikke bruk klassen .pkt-select
6
6
  */
7
7
 
8
- @use 'sass:map';
9
- @use '../abstracts/variables';
10
- @use '../abstracts/functions';
8
+ @use './input';
11
9
 
12
- .pkt-select {
13
- --svg: url(https://punkt-cdn.oslo.kommune.no/7.2/icons/chevron-thin-down.svg);
14
-
15
- display: block;
16
- background-color: var(--color-white);
17
- background-image: var(--svg);
18
- background-repeat: no-repeat;
19
- background-position: right 0.7rem top 50%;
20
- background-size: 2rem auto, 100%;
21
- border: 2px solid var(--color-blue-dark);
22
- border-radius: 0;
23
- color: var(--color-blue-dark);
24
- font-family: inherit;
25
- font-size: map.get(variables.$font-size, 'size-16');
26
- font-weight: normal;
27
- height: 3.125rem;
28
- line-height: 2rem;
29
- margin: 0;
30
- max-width: 100%;
31
- padding: 0.4375rem 3rem 0.4375rem 0.5rem;
32
- width: 100%;
33
- appearance: none;
34
- -moz-appearance: none;
35
- -webkit-appearance: none;
36
-
37
- &::-ms-expand {
38
- display: none;
39
- }
40
-
41
- &:enabled:focus {
42
- border-color: var(--color-active);
43
- outline: 2px solid var(--color-active);
44
- }
45
-
46
- &:enabled:hover {
47
- --fg-color: var(--color-active);
48
- border-color: var(--color-active);
49
- color: var(--color-active);
50
- }
51
-
52
- &:enabled:active {
53
- border-color: var(--color-active);
54
- outline: none;
55
- }
56
-
57
- // Remove outline from select box in FF
58
- &:-moz-focusring {
59
- color: transparent;
60
- text-shadow: 0 0 0 var(--color-active);
61
- }
62
-
63
- &:disabled {
64
- filter: grayscale(1) brightness(4.16);
65
- font-weight: 500;
66
- }
67
-
68
- option {
69
- background-color: var(--color-white);
70
- color: var(--color-blue-dark);
71
- font-weight: normal;
72
- }
10
+ .pkt-select select,
11
+ .pkt-select:is(select) {
12
+ @extend .pkt-input;
73
13
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oslokommune/punkt-css",
3
- "version": "7.2.0",
3
+ "version": "8.0.4",
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",
@@ -20,7 +20,7 @@
20
20
  "preview": "astro preview"
21
21
  },
22
22
  "devDependencies": {
23
- "@oslokommune/punkt-assets": "^7.0.0",
23
+ "@oslokommune/punkt-assets": "^8.0.0",
24
24
  "astro": "^2.8.1",
25
25
  "edit-json-file": "^1.7.0",
26
26
  "fs-extra": "^11.1.0",
@@ -55,5 +55,5 @@
55
55
  "url": "https://github.com/oslokommune/punkt/issues"
56
56
  },
57
57
  "license": "MIT",
58
- "gitHead": "f66d7532315a855442edf9e19cf883d7862a787f"
58
+ "gitHead": "76e06018fc3c83228f894bde62f9b41bf111c9b1"
59
59
  }