@utrecht/web-component-library-stencil 1.0.0-alpha.165 → 1.0.0-alpha.169

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.
@@ -9,11 +9,12 @@
9
9
  * Copyright (c) 2021 Robbert Broersma
10
10
  */
11
11
  /* stylelint-disable-next-line block-no-empty */
12
- .utrecht-navhtml {
13
- font-family: var(--utrecht-font-family-sans-serif);
14
- }
15
-
16
12
  .utrecht-sidenav {
13
+ --utrecht-sidenav-connection-color: var(--utrecht-sidenav-item-marker-color);
14
+ --utrecht-sidenav-connection-inline-size: 2px;
15
+ --utrecht-sidenav-marker-current-color: var(--utrecht-sidenav-link-hover-color);
16
+ --utrecht-sidenav-marker-offset: 26px;
17
+ --utrecht-sidenav-connection-block-size: 38px;
17
18
  border-block-end: 1px solid var(--utrecht-color-grey-80);
18
19
  border-block-start: 1px solid var(--utrecht-color-grey-80);
19
20
  margin-block-end: 0;
@@ -31,212 +32,152 @@
31
32
  padding-inline-start: 0;
32
33
  }
33
34
 
34
- .utrecht-sidenav__list ul {
35
- margin-block-end: 0;
36
- padding-block-end: 0;
37
- padding-block-start: 0;
38
- padding-inline-start: 1.2rem;
35
+ .utrecht-sidenav__list--child {
36
+ margin-block-start: 0;
37
+ padding-inline-end: 0;
38
+ padding-inline-start: 1.4rem;
39
39
  }
40
40
 
41
- .utrecht-sidenav__item,
42
- .utrecht-sidenav__sibling__item {
41
+ .utrecht-sidenav__item {
43
42
  list-style: none;
44
43
  margin-inline-start: 0;
45
44
  position: relative;
46
45
  }
47
46
 
48
- .utrecht-sidenav__item:last-child {
47
+ .utrecht-sidenav__item--current {
48
+ color: var(--utrecht-sidenav-item-hover-color, var(--utrecht-link-hover-color, red));
49
+ }
50
+
51
+ .utrecht-sidenav__item--last {
49
52
  border-block-end: none;
50
53
  }
51
54
 
52
55
  /* draw the li item box bottom line */
53
- .utrecht-sidenav__item span:not(.utrecht-sidenav__item:last-child span, .utrecht-sidenav__item--has-children span:first-of-type) {
56
+ .utrecht-sidenav__item-separator:not(.utrecht-sidenav__item--last .utrecht-sidenav__item-separator,
57
+ .utrecht-sidenav__item--has-children .utrecht-sidenav__item-separator:first-of-type) {
58
+ /* .utrecht-sidenav__item--has-children span */
54
59
  border-block-end: 1px solid var(--utrecht-color-grey-80);
55
60
  display: block;
56
- margin-inline-start: var(--utrecht-space-inline-lg);
57
- }
58
-
59
- /* Remove bottom padding form first item in list with children */
60
- .utrecht-sidenav__item .utrecht-sidenav__link--has-children {
61
- padding-block-end: 0;
61
+ margin-inline-start: var(--utrecht-space-inline-md);
62
62
  }
63
63
 
64
- .utrecht-sidenav__child__item {
65
- list-style: none;
66
- }
67
-
68
- .utrecht-sidenav__link,
69
- .utrecht-sidenav__link--sibling {
64
+ .utrecht-sidenav__link {
70
65
  color: var(--utrecht-sidenav-link-color, var(--utrecht-link-color, blue));
71
66
  display: block;
72
67
  margin-inline-start: 0;
73
68
  padding-block-end: var(--utrecht-space-block-xs);
74
69
  padding-block-start: var(--utrecht-space-block-xs);
75
70
  padding-inline-end: var(--utrecht-space-inline-3xs);
76
- padding-inline-start: var(--utrecht-space-inline-xl);
77
- text-decoration: none;
78
- }
79
-
80
- .utrecht-sidenav__link--child,
81
- .utrecht-sidenav__link--child--current {
82
- color: var(--utrecht-sidenav-link-color, var(--utrecht-link-color, blue));
83
- display: block;
84
- margin-block-end: 0;
85
- margin-block-start: 0;
86
- padding-block-end: var(--utrecht-space-block-2xs);
87
- padding-block-start: var(--utrecht-space-block-2xs);
88
- padding-inline-end: var(--utrecht-space-inline-3xs);
89
- padding-inline-start: var(--utrecht-space-inline-xl);
71
+ padding-inline-start: var(--utrecht-space-inline-lg);
90
72
  text-decoration: none;
91
73
  }
92
74
 
93
- .utrecht-sidenav__link::before,
94
- .utrecht-sidenav__link--sibling::before {
95
- background-color: var(--utrecht-sidenav-item-marker-color);
96
- left: 26px;
97
- }
98
-
99
- /* Little fix to move the dot to the right */
100
- .utrecht-sidenav__link--current::before {
101
- background-color: var(--utrecht-sidenav-link-hover-color);
102
- left: 27px;
103
- }
104
-
105
- /* Dot for link with siblings */
106
- .utrecht-sidenav__link::before,
107
- .utrecht-sidenav__link--sibling::before,
108
- .utrecht-sidenav__item:last-child .utrecht-sidenav__link--current::before {
109
- border-radius: 100%;
110
- box-shadow: 0 0 2px 2px #fff;
111
- /* Make var */
112
- content: "";
113
- height: 8px;
114
- overflow: hidden;
115
- position: absolute;
116
- top: 20px;
117
- /* Hard value? */
118
- transform: translateY(-50%) translateX(-2.5ch);
119
- width: 8px;
120
- z-index: 10;
121
- }
122
-
123
- /* Hover layout for mousover on sidenav__link */
124
- .utrecht-sidenav__link:hover::before,
125
- .utrecht-sidenav__link--sibling:hover::before {
126
- background-color: var(--utrecht-sidenav-link-hover-color);
127
- }
128
-
129
- .utrecht-sidenav__item a:hover {
75
+ .utrecht-sidenav__link:hover {
130
76
  color: var(--utrecht-sidenav-link-hover-color, var(--utrecht-link-hover-color, red));
131
77
  text-decoration: underline;
132
78
  }
133
79
 
134
- .utrecht-sidenav__item--current {
135
- color: var(--utrecht-sidenav-item-hover-color, var(--utrecht-link-hover-color, red));
80
+ .utrecht-sidenav__link--focus-visible, .utrecht-sidenav__link:focus {
81
+ box-shadow: 0 0 0 var(--utrecht-focus-box-shadow-spread-radius, 0) var(--utrecht-focus-box-shadow-color, transparent);
82
+ outline-color: var(--utrecht-focus-outline-color, transparent);
83
+ outline-offset: 0;
84
+ outline-style: var(--utrecht-focus-outline-style, solid);
85
+ outline-width: var(--utrecht-focus-outline-width, 0);
86
+ }
87
+
88
+ /* Remove bottom padding form first item in list with children */
89
+ .utrecht-sidenav__link--has-children {
90
+ padding-block-end: 0;
136
91
  }
137
92
 
138
93
  /* Draw metro connection lines on sidenav link items */
139
- .utrecht-sidenav__link::after,
140
- .utrecht-sidenav__item:last-child .utrecht-sidenav__link::after {
141
- background: var(--utrecht-sidenav-item-marker-color);
142
- /* min-height: 100%;
143
- height: calc(100% + 2px); */
94
+ .utrecht-sidenav__connection, .utrecht-sidenav--pseudo-elements .utrecht-sidenav__link:not(.utrecht-sidenav__link--sibling):not(.utrecht-sidenav__link--child)::after {
95
+ background: var(--utrecht-sidenav-connection-color);
144
96
  bottom: 0;
145
97
  content: "";
146
98
  display: block;
99
+ height: calc(var(--utrecht-sidenav-connection-block-size) + 2px);
147
100
  left: 3px;
101
+ min-height: var(--utrecht-sidenav-connection-block-size);
148
102
  overflow: hidden;
149
103
  position: absolute;
150
104
  top: -22px;
151
- width: 3px;
105
+ width: var(--utrecht-sidenav-connection-inline-size);
152
106
  z-index: 5;
153
107
  }
154
108
 
155
- /* Draw short metro connection lines on sidenav child link items */
156
- .utrecht-sidenav__item:last-child .utrecht-sidenav__link::after,
157
- .utrecht-sidenav__link--current::after,
158
- .utrecht-sidenav__item--has-children a::after {
159
- height: 40px;
160
- min-height: 38px;
161
- }
162
-
163
- /* Remove first metro line in listing */
164
- .utrecht-sidenav__item:first-child .utrecht-sidenav__link::after {
165
- content: "";
109
+ .utrecht-sidenav__connection--first, .utrecht-sidenav--pseudo-elements .utrecht-sidenav__item:first-child .utrecht-sidenav__link::after {
166
110
  display: none;
167
111
  }
168
112
 
169
- /* Make current link bold */
170
- .utrecht-sidenav__link--current,
171
- .utrecht-sidenav__link--child--current {
172
- font-weight: var(--utrecht-typography-weight-scale-bold-font-weight);
173
- }
174
-
175
- .utrecht-sidenav__list--child {
176
- margin-block-end: 0;
177
- margin-block-start: 0;
178
- padding-block-end: 0;
179
- padding-block-start: 0;
180
- padding-inline-end: 0;
181
- padding-inline-start: 1.4rem;
182
- }
183
-
184
- .utrecht-sidenav__item--child {
185
- border: none;
186
- list-style: none;
187
- position: relative;
188
- }
189
-
190
- /* No last border on child item */
191
- .utrecht-sidenav__item--child:last-child {
192
- border: none;
113
+ /* Dot for link with siblings */
114
+ /* Little fix to move the dot to the right */
115
+ .utrecht-sidenav__marker, .utrecht-sidenav--pseudo-elements .utrecht-sidenav__link::before {
116
+ background-color: var(--utrecht-sidenav-item-marker-color);
117
+ border-radius: 100%;
118
+ box-shadow: 0 0 2px 2px #fff;
119
+ /* Make var */
120
+ content: "";
121
+ height: 8px;
122
+ left: var(--utrecht-sidenav-marker-offset);
123
+ overflow: hidden;
124
+ position: absolute;
125
+ top: 20px;
126
+ /* Hard value? */
127
+ transform: translateY(-50%) translateX(calc(-1 * var(--utrecht-sidenav-marker-offset)));
128
+ width: 8px;
129
+ z-index: 10;
193
130
  }
194
131
 
195
132
  /* Add dot bullets on child links */
196
- .utrecht-sidenav__link--child::before,
197
- .utrecht-sidenav__link--child--current::before {
133
+ .utrecht-sidenav__marker--child, .utrecht-sidenav--pseudo-elements .utrecht-sidenav__link--child::before {
198
134
  background-color: transparent;
199
135
  border: 2px solid var(--utrecht-sidenav-link-color);
200
- border-radius: 100%;
201
- content: "";
202
136
  height: 4px;
203
137
  left: 1.2rem;
204
- overflow: hidden;
205
- position: absolute;
206
138
  top: 16px;
207
139
  transform: translateY(-50%) translateX(-19.5px);
208
140
  width: 4px;
209
- z-index: 10;
210
141
  }
211
142
 
212
- /* Make current marker dots bold */
213
- .utrecht-sidenav__link--child--current::before {
143
+ /* selector must override .utrecht-sidenav__marker--child */
144
+ .utrecht-sidenav__marker--current, .utrecht-sidenav--pseudo-elements .utrecht-sidenav__link--current::before,
145
+ .utrecht-sidenav--pseudo-elements .utrecht-sidenav__link--current-child::before {
146
+ background-color: var(--utrecht-sidenav-marker-current-color);
147
+ }
148
+
149
+ .utrecht-sidenav__link--child,
150
+ .utrecht-sidenav__link--current-child {
151
+ color: var(--utrecht-sidenav-link-color, var(--utrecht-link-color, blue));
152
+ margin-block-end: 0;
153
+ margin-block-start: 0;
154
+ padding-block-end: var(--utrecht-space-block-2xs);
155
+ padding-block-start: var(--utrecht-space-block-2xs);
156
+ padding-inline-end: var(--utrecht-space-inline-3xs);
157
+ padding-inline-start: var(--utrecht-space-inline-lg);
158
+ text-decoration: none;
159
+ }
160
+
161
+ .utrecht-sidenav__link--current,
162
+ .utrecht-sidenav__link--current-child {
163
+ font-weight: var(--utrecht-typography-weight-scale-bold-font-weight);
164
+ }
165
+
166
+ /* Hover layout for mousover on sidenav__link */
167
+ .utrecht-sidenav__marker--hover, .utrecht-sidenav--pseudo-elements .utrecht-sidenav__link:hover::before {
214
168
  background-color: var(--utrecht-sidenav-link-hover-color);
215
169
  }
216
170
 
217
171
  /* Hover layout for mousover on child__link */
218
- .utrecht-sidenav__link--child:hover::before {
172
+ .utrecht-sidenav__marker--child.utrecht-sidenav__marker--hover, .utrecht-sidenav--pseudo-elements .utrecht-sidenav__marker--child.utrecht-sidenav__link:hover::before, .utrecht-sidenav--pseudo-elements .utrecht-sidenav__marker--hover.utrecht-sidenav__link--child::before, .utrecht-sidenav--pseudo-elements .utrecht-sidenav__link--child.utrecht-sidenav__link:hover::before {
219
173
  background-color: var(--utrecht-sidenav-link-hover-color);
220
174
  border: 2px solid var(--utrecht-sidenav-link-hover-color);
221
175
  }
222
176
 
223
- /* remove :after lines in child and sibling links */
224
- .utrecht-sidenav__item--child:first-child .utrecht-sidenav__link--child--current::after,
225
- .utrecht-sidenav__link--child::after,
226
- .utrecht-sidenav__item .utrecht-sidenav__item--child .utrecht-sidenav__link--child::after,
227
- .utrecht-sidenav__item .utrecht-sidenav__link--sibling::after,
228
- .utrecht-sidenav__item--sibling:last-child .utrecht-sidenav__link--sibling::after {
177
+ .utrecht-sidenav--pseudo-elements .utrecht-sidenav__link--child::after {
229
178
  display: none;
230
179
  }
231
180
 
232
- .utrecht-sidenav__link--focus-visible, .utrecht-sidenav__link:focus {
233
- box-shadow: 0 0 0 var(--utrecht-focus-box-shadow-spread-radius, 0) var(--utrecht-focus-box-shadow-color, transparent);
234
- outline-color: var(--utrecht-focus-outline-color, transparent);
235
- outline-offset: 0;
236
- outline-style: var(--utrecht-focus-outline-style, solid);
237
- outline-width: var(--utrecht-focus-outline-width, 0);
238
- }
239
-
240
181
  .utrecht-sidenav__link:focus:not(:focus-visible) {
241
182
  /* undo focus ring */
242
183
  box-shadow: none;
@@ -4,11 +4,17 @@ export class Sidenav {
4
4
  render() {
5
5
  const items = JSON.parse(this.json);
6
6
  return (h("nav", { class: "utrecht-sidenav" },
7
- h("ul", { class: "utrecht-sidenav__list" }, items.map(({ href, title, current, focus, children, sibling, haschildren }) => (h("li", { key: href, class: clsx('utrecht-sidenav__item', sibling && 'utrecht-sidenav__item--sibling', haschildren && 'utrecht-sidenav__item--has-children') },
8
- h("a", { class: clsx('utrecht-sidenav__link', current && 'utrecht-sidenav__link--current', focus && 'utrecht-sidenav__link--focus', sibling && 'utrecht-sidenav__link--sibling', haschildren && 'utrecht-sidenav__link--has-children'), href: href }, title),
9
- h("span", null),
7
+ h("ul", { class: "utrecht-sidenav__list" }, items.map(({ href, title, current, focus, children, sibling, haschildren }, index, array) => (h("li", { key: href, class: clsx('utrecht-sidenav__item', index + 1 === array.length && 'utrecht-sidenav__item--last', sibling && 'utrecht-sidenav__item--sibling', haschildren && 'utrecht-sidenav__item--has-children') },
8
+ h("a", { class: clsx('utrecht-sidenav__link', current && 'utrecht-sidenav__link--current', focus && 'utrecht-sidenav__link--focus', sibling && 'utrecht-sidenav__link--sibling', haschildren && 'utrecht-sidenav__link--has-children'), href: href },
9
+ h("div", { class: clsx('utrecht-sidenav__marker', current && 'utrecht-sidenav__marker--current') }),
10
+ !(sibling || index === 0) ? h("div", { class: "utrecht-sidenav__connection" }) : null,
11
+ title),
12
+ h("div", { class: "utrecht-sidenav__item-separator" }),
10
13
  children ? (h("ul", { class: "utrecht-sidenav__list utrecht-sidenav__list--child" }, children.map(({ href, title, current, focus }) => (h("li", { key: href, class: "utrecht-sidenav__item utrecht-sidenav__item--child" },
11
- h("a", { class: clsx('utrecht-sidenav__link utrecht-sidenav__link--child', current && 'utrecht-sidenav__link--current utrecht-sidenav__link--child--current', focus && 'utrecht-sidenav__link--focus'), href: href }, title)))))) : ('')))))));
14
+ h("a", { class: clsx('utrecht-sidenav__link', 'utrecht-sidenav__link--child', current && 'utrecht-sidenav__link--current', current && 'utrecht-sidenav__link--current-child', focus && 'utrecht-sidenav__link--focus'), href: href },
15
+ h("div", { class: clsx('utrecht-sidenav__marker', 'utrecht-sidenav__marker--child', current && 'utrecht-sidenav__marker--current', current && 'utrecht-sidenav__marker--current-child') }),
16
+ title)))))) : (''),
17
+ children && h("div", { class: "utrecht-sidenav__item-separator" })))))));
12
18
  }
13
19
  static get is() { return "utrecht-sidenav"; }
14
20
  static get encapsulation() { return "shadow"; }
@@ -77,6 +77,16 @@ however browsers don't seem to have implemented great looking supixel tweening y
77
77
  text-underline-offset: var(--utrecht-link-text-underline-offset);
78
78
  }
79
79
 
80
+ .utrecht-link-icon-left {
81
+ background-image: var(--utrecht-link-icon-left-background-image, none);
82
+ background-position: 0 0.25em;
83
+ background-repeat: no-repeat;
84
+ color: var(--utrecht-link-color, blue);
85
+ font-weight: var(--utrecht-typography-weight-scale-bold-font-weight);
86
+ padding-inline-start: var(--utrecht-space-block-md);
87
+ text-decoration: none;
88
+ }
89
+
80
90
  .utrecht-link:visited,
81
91
  .utrecht-link--visited {
82
92
  color: var(--utrecht-link-visited-color, var(--utrecht-link-color));