@oslokommune/punkt-css 7.1.7 → 8.0.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.
@@ -143,7 +143,7 @@ a,
143
143
 
144
144
  &--external::after {
145
145
  content: ' ';
146
- --svg: url(https://punkt-cdn.oslo.kommune.no/7.1/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;
@@ -5,55 +5,32 @@
5
5
  @use 'sass:map';
6
6
  @use '../abstracts/variables';
7
7
  @use '../abstracts/mixins/breakpoints' as *;
8
+ @use '../abstracts/mixins/typography';
8
9
 
9
10
  .pkt-breadcrumbs {
10
11
  position: relative;
11
- font-size: map.get(variables.$font-size, 'size-14');
12
- padding: 0 map.get(variables.$spacing, 'size-16');
12
+ @include typography.get-text('pkt-txt-14-light');
13
13
 
14
- @include bp('tablet-up') {
15
- margin-bottom: map.get(variables.$spacing, 'size-16');
16
- }
17
-
18
- @include bp('laptop-up') {
19
- padding: 0 map.get(variables.$spacing, 'size-64');
20
- }
21
14
 
22
15
  &__list {
23
16
  display: flex;
24
17
  flex-direction: column;
25
18
  height: auto;
26
- overflow: hidden;
27
19
  list-style-type: none;
28
20
  border-bottom: 1px solid transparent;
29
21
  transition: all 0.4s ease-in-out;
30
22
 
31
23
  @include bp('phablet-up') {
32
24
  flex-direction: row;
33
- padding: 0 1rem;
34
25
  border-bottom-color: transparent !important;
35
26
  }
36
-
37
- &.expanded {
38
- align-items: flex-start;
39
- max-height: 25rem;
40
- border-bottom-color: var(--color-gray);
41
- transition: all 0.4s ease-in-out;
42
-
43
- & > .pkt-breadcrumbs__item {
44
- display: block;
45
- }
46
-
47
- & > .pkt-breadcrumbs__item:last-child {
48
- display: block;
49
- }
50
- }
51
27
  }
52
28
 
53
29
  &__item {
54
30
  position: relative;
55
31
  display: none;
56
32
  width: 100%;
33
+ text-decoration: underline;
57
34
 
58
35
  @include bp('phablet-up') {
59
36
  display: block;
@@ -62,6 +39,7 @@
62
39
 
63
40
  &:last-child {
64
41
  display: block;
42
+ text-decoration: none;
65
43
 
66
44
  @include bp('tablet-up') {
67
45
  max-width: 300px;
@@ -73,31 +51,11 @@
73
51
  }
74
52
  }
75
53
 
76
- &__link {
77
- text-decoration: none;
78
- color: var(--color-blue-dark);
79
-
80
- &:visited,
81
- &:focus,
82
- &:hover,
83
- &:active {
84
- color: var(--color-blue-dark);
85
- }
86
-
87
- &:hover {
88
- text-decoration: underline;
89
- }
90
- }
91
-
92
54
  &__label {
93
55
  display: flex;
94
56
  align-items: center;
95
- justify-content: flex-start;
96
57
  width: 100%;
97
58
  white-space: nowrap;
98
- padding: map.get(variables.$spacing, 'size-12')
99
- map.get(variables.$spacing, 'size-16')
100
- map.get(variables.$spacing, 'size-16') 0;
101
59
  }
102
60
 
103
61
  &__text {
@@ -110,9 +68,11 @@
110
68
  @include bp('phablet-up') {
111
69
  max-width: 120px;
112
70
  }
71
+
113
72
  @include bp('tablet-up') {
114
73
  max-width: 200px;
115
74
  }
75
+
116
76
  @include bp('tablet-big-up') {
117
77
  max-width: 300px;
118
78
  }
@@ -121,6 +81,23 @@
121
81
  &__icon {
122
82
  width: 1rem;
123
83
  height: 1rem;
124
- margin-right: map.get(variables.$spacing, 'size-12');
84
+ margin-left: map.get(variables.$spacing, 'size-8');
85
+ }
86
+
87
+
88
+ &--desktop {
89
+ display: none !important;
90
+
91
+ @include bp('phablet-up') {
92
+ display: inline-flex !important;
93
+ }
94
+ }
95
+
96
+ &--mobile {
97
+ display: inline-flex !important;
98
+
99
+ @include bp('phablet-up') {
100
+ display: none !important;
101
+ }
125
102
  }
126
103
  }
@@ -28,6 +28,15 @@
28
28
  gap: map.get(variables.$spacing, 'size-4');
29
29
  @include typography.get-text('pkt-txt-14-light');
30
30
 
31
+ > * {
32
+ &:first-child {
33
+ margin-top: 0;
34
+ }
35
+ &:last-child {
36
+ margin-bottom: 0;
37
+ }
38
+ }
39
+
31
40
  &-expandable {
32
41
  display: inline-flex;
33
42
  text-align: left;
@@ -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.1/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,208 @@
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
+ width: 100%;
19
+
20
+ &:is(textarea) {
21
+ min-height: map.get(variables.$spacing, 'size-128');
22
+ }
23
+
24
+ &:is(select) {
25
+ appearance: none;
26
+ -moz-appearance: none;
27
+ -webkit-appearance: none;
28
+ padding-right: 3rem;
29
+
30
+ &:not([multiple]) {
31
+ 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");
32
+ background-repeat: no-repeat;
33
+ background-position: right 0.7rem top 50%;
34
+ background-size: 1.5rem auto, 100%;
35
+ }
36
+
37
+ option {
38
+ background-color: var(--color-white);
39
+ color: var(--color-blue-dark);
40
+ font-weight: normal;
41
+ }
42
+ }
43
+
44
+ // 1. Override Firefox's default opacity
45
+ &::placeholder {
46
+ color: var(--color-grayscale-50);
47
+ opacity: 1; // 1
48
+ }
49
+
50
+ // states
51
+ &:hover,
52
+ &.pkt-input--hover {
53
+ border-color: var(--color-hover);
54
+ }
55
+
56
+ &:focus-visible + &-suffix,
57
+ &.pkt-input__textinput--focus {
58
+ box-shadow: 0 0 0 2px var(--color-active);
59
+ border-color: var(--color-active);
60
+ }
61
+
62
+ &:focus {
63
+ outline: none;
64
+ box-shadow: 0 0 0 2px var(--color-active);
65
+ border-color: var(--color-active);
66
+ }
67
+
68
+ &:disabled,
69
+ &:disabled::placeholder,
70
+ &[readonly] {
71
+ opacity: 1;
72
+ background-color: var(--color-disabled-light);
73
+ border-color: var(--color-disabled);
74
+ cursor: inherit;
75
+ }
76
+
77
+ &:disabled:active {
78
+ border: 2px solid var(--color-disabled);
79
+ }
80
+
81
+ &-prefix,
82
+ &-suffix,
83
+ &-icon {
84
+ @include typography.get-text('pkt-txt-18-light');
85
+ display: flex;
86
+ align-items: center;
87
+ width: auto;
88
+ height: 3rem;
89
+ border: 2px solid var(--color-blue-dark);
90
+ flex-shrink: 0;
91
+ }
92
+
93
+ &-prefix {
94
+ padding: 0.5rem 0rem 0.5rem 1rem;
95
+
96
+ &::after {
97
+ content: '';
98
+ width: 1px;
99
+ margin-left: 0.5rem;
100
+ height: 100%;
101
+ background-color: var(--color-blue-dark);
102
+ }
103
+ }
104
+
105
+ &-suffix {
106
+ padding: 0.5rem 1rem 0.5rem 0rem;
107
+
108
+ svg {
109
+ width: 1.5rem;
110
+ height: 1.5rem;
111
+ margin-left: 0.5rem;
112
+ }
113
+
114
+ &::before {
115
+ content: '';
116
+ width: 1px;
117
+ margin-right: 0.5rem;
118
+ height: 1.5rem;
119
+ background-color: var(--color-blue-dark);
120
+ }
121
+ }
122
+
123
+ &-icon {
124
+ padding: 0.5rem 1rem;
125
+ align-self: stretch;
126
+
127
+ & svg {
128
+ width: 1.5rem;
129
+ height: 1.5rem;
130
+ margin-left: 0.5rem;
131
+ }
132
+ }
133
+
134
+ &--counter-error,
135
+ &--counter-error:focus {
136
+ border-color: var(--color-red);
137
+ background-color: var(--color-red-30);
138
+ }
139
+ &--counter-error:focus {
140
+ box-shadow: 0 0 0 2px var(--color-red);
141
+ }
142
+
143
+ &__container {
144
+ display: flex;
145
+ align-items: center;
146
+ align-self: stretch;
147
+
148
+ :first-child:not(:only-child) {
149
+ border-right: none;
150
+ }
151
+
152
+ :last-child:not(:only-child) {
153
+ border-left: none;
154
+ }
155
+
156
+ :not(:first-child):not(:last-child) {
157
+ border-left: none;
158
+ border-right: none;
159
+ }
160
+
161
+ p {
162
+ margin: 0;
163
+ }
164
+
165
+ //states
166
+ & input:focus {
167
+ box-shadow: none;
168
+ }
169
+
170
+ &:hover .pkt-input,
171
+ &:hover .pkt-input-prefix,
172
+ &:hover .pkt-input-suffix,
173
+ &:hover .pkt-input-icon {
174
+ border-color: var(--color-hover);
175
+ }
176
+
177
+ &:focus-within {
178
+ outline: 2px solid var(--color-active);
179
+
180
+ .pkt-input,
181
+ .pkt-input-prefix,
182
+ .pkt-input-suffix,
183
+ .pkt-input-icon {
184
+ border-color: var(--color-active);
185
+ }
186
+ }
187
+ }
188
+
189
+ &__counter {
190
+ @include typography.get-text('pkt-txt-14-light');
191
+ width: 100%;
192
+ text-align: right;
193
+ &--error {
194
+ @include typography.get-text('pkt-txt-14-medium');
195
+ color: var(--color-red);
196
+ }
197
+ }
198
+ }
199
+
200
+ // Dark mode
201
+ @at-root [data-mode='dark'] {
202
+ .pkt-input-prefix,
203
+ .pkt-input-suffix,
204
+ .pkt-input-icon {
205
+ background-color: var(--color-white);
206
+ color: var(--color-blue-dark);
207
+ }
208
+ }