weg-shared-layout 0.0.24 → 0.0.25

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.
Files changed (33) hide show
  1. package/dist/cjs/weg-footer_2.cjs.entry.js +218 -193
  2. package/dist/collection/components/weg-footer/weg-footer.css +97 -45
  3. package/dist/collection/components/weg-footer/weg-footer.js +22 -26
  4. package/dist/collection/components/weg-header/weg-header.css +33 -32
  5. package/dist/collection/components/weg-header/weg-header.js +142 -138
  6. package/dist/collection/styles/shared.css +3 -3
  7. package/dist/collection/utils/layout.js +57 -9
  8. package/dist/components/p-BnMIy-A5.js +1 -0
  9. package/dist/components/weg-footer.js +1 -1
  10. package/dist/components/weg-header.js +1 -1
  11. package/dist/esm/weg-footer_2.entry.js +218 -193
  12. package/dist/types/components/weg-footer/weg-footer.d.ts +2 -2
  13. package/dist/types/components/weg-header/weg-header.d.ts +14 -11
  14. package/dist/types/components.d.ts +6 -6
  15. package/dist/types/types/layout-data.d.ts +13 -27
  16. package/dist/types/utils/layout.d.ts +9 -1
  17. package/dist/weg-shared-layout/p-d74a58cf.entry.js +1 -0
  18. package/dist/weg-shared-layout/weg-shared-layout.esm.js +1 -1
  19. package/docs/angular-integration-guide.md +81 -103
  20. package/docs/angular.md +9 -27
  21. package/docs/nextjs.md +11 -10
  22. package/docs/react.md +3 -3
  23. package/docs/vanilla.md +8 -10
  24. package/package.json +1 -1
  25. package/readme.md +16 -42
  26. package/src/assets/dummy-data.json +221 -147
  27. package/dist/collection/components/weg-header/signed-in-layout.js +0 -13
  28. package/dist/collection/constants/weg-urls.js +0 -18
  29. package/dist/components/p-DbIEJ3IT.js +0 -1
  30. package/dist/types/components/weg-header/signed-in-layout.d.ts +0 -18
  31. package/dist/types/constants/weg-urls.d.ts +0 -18
  32. package/dist/weg-shared-layout/p-c6ec3888.entry.js +0 -1
  33. package/src/constants/weg-urls.ts +0 -23
@@ -27,24 +27,46 @@
27
27
  display: flex;
28
28
  flex-direction: column;
29
29
  align-items: center;
30
- gap: 20px;
31
- padding-block: 32px;
30
+ gap: 1.25rem;
31
+ padding-block: 2rem;
32
+ padding-inline: 0.5rem;
33
+ }
34
+
35
+ @media (width >= 960px) {
36
+ .footer__inner {
37
+ gap: 2.25rem;
38
+ padding-block: 3.5rem;
39
+ padding-inline: 1rem;
40
+ }
41
+ }
42
+
43
+ @media (width >= 1280px) {
44
+ .footer__inner {
45
+ padding-inline: 2rem;
46
+ }
32
47
  }
33
48
 
34
49
  .social {
35
50
  display: flex;
36
51
  align-items: center;
37
52
  justify-content: center;
38
- gap: 16px;
53
+ gap: 1rem;
54
+ flex-wrap: wrap;
55
+ }
56
+
57
+ @media (width >= 960px) {
58
+ .social {
59
+ gap: 1.75rem;
60
+ }
39
61
  }
40
62
 
41
63
  .social__link {
42
- width: 48px;
43
- height: 48px;
64
+ width: 3rem;
65
+ height: 3rem;
44
66
  display: inline-flex;
45
67
  align-items: center;
46
68
  justify-content: center;
47
- border-radius: 999px;
69
+ border-radius: 999rem;
48
70
  background: transparent;
49
71
  color: inherit;
50
72
  text-decoration: none;
@@ -63,17 +85,17 @@
63
85
 
64
86
  .social__icon {
65
87
  display: inline-flex;
66
- width: 48px;
67
- height: 48px;
88
+ width: 3rem;
89
+ height: 3rem;
68
90
  }
69
91
 
70
92
  .footer-link {
71
93
  color: #ffffff;
72
94
  font-family: 'Open Sans', var(--weg-font-family);
73
- font-size: 16px;
95
+ font-size: 1rem;
74
96
  font-style: normal;
75
97
  font-weight: 300;
76
- line-height: 24px;
98
+ line-height: 1.5rem;
77
99
  display: block;
78
100
  width: 100%;
79
101
  text-align: center;
@@ -86,6 +108,14 @@
86
108
  outline: none;
87
109
  }
88
110
 
111
+ @media (width >= 960px) {
112
+ .footer-link {
113
+ display: inline;
114
+ width: auto;
115
+ text-align: left;
116
+ }
117
+ }
118
+
89
119
  .footer-link:hover {
90
120
  opacity: 0.9;
91
121
  }
@@ -99,8 +129,15 @@
99
129
  width: 100%;
100
130
  max-width: 860px;
101
131
  text-align: center;
102
- font-size: 16px;
103
- line-height: 24px;
132
+ font-size: 1rem;
133
+ line-height: 1.5rem;
134
+ }
135
+
136
+ @media (width >= 960px) {
137
+ .legal {
138
+ font-size: 1.125rem;
139
+ line-height: 1.75rem;
140
+ }
104
141
  }
105
142
 
106
143
  .legal__p {
@@ -112,63 +149,77 @@
112
149
  display: flex;
113
150
  flex-direction: column;
114
151
  align-items: center;
115
- gap: 36px;
152
+ gap: 2.25rem;
116
153
  text-align: center;
117
- font-size: 16px;
118
- line-height: 24px;
154
+ font-size: 1rem;
155
+ line-height: 1.5rem;
156
+ }
157
+
158
+ @media (width >= 960px) {
159
+ .standard {
160
+ font-size: 1.125rem;
161
+ line-height: 1.75rem;
162
+ }
119
163
  }
120
164
 
121
165
  .columns {
122
166
  width: 100%;
123
167
  display: grid;
124
- gap: 0;
125
168
  grid-template-columns: 1fr;
169
+ gap: 0;
126
170
  }
127
171
 
128
172
  .columns__col {
129
173
  display: flex;
130
- flex: 1 1 0;
131
- min-width: 0;
132
- width: 100%;
133
- align-items: stretch;
134
174
  flex-direction: column;
175
+ align-items: stretch;
176
+ width: 100%;
177
+ min-width: 0;
135
178
  }
136
179
 
137
180
  .columns__col:not(:first-child) {
138
- gap: 32px;
181
+ gap: 2rem;
139
182
  }
140
183
 
141
184
  .columns__divider {
142
185
  display: block;
143
- background: rgba(255, 255, 255, 0.35);
144
186
  flex-shrink: 0;
145
187
  width: 100%;
146
188
  height: 1px;
147
- align-self: stretch;
148
- margin-top: 32px;
149
- margin-bottom: 0;
189
+ margin-top: 2rem;
190
+ background: rgba(255, 255, 255, 0.35);
150
191
  }
151
192
 
152
193
  .columns__links {
153
194
  display: flex;
154
195
  flex-direction: column;
155
196
  align-items: stretch;
156
- gap: 12px;
157
- flex: 1;
197
+ gap: 0.75rem;
158
198
  width: 100%;
159
199
  min-width: 0;
160
- padding: 0 4px;
161
200
  text-align: center;
162
201
  }
163
202
 
164
- @media (width >= 960px) {
165
- .footer__inner {
166
- gap: 36px;
167
- padding-block: 56px;
203
+ /* sm: 6 footer columns → 3 × 2 grid */
204
+ @media (width >= 640px) {
205
+ .columns {
206
+ grid-template-columns: repeat(3, minmax(0, 1fr));
207
+ gap: 1.5rem 3rem;
168
208
  }
169
209
 
170
- .social {
171
- gap: 28px;
210
+ .columns__col:not(:first-child) {
211
+ gap: 0;
212
+ }
213
+
214
+ .columns__col:nth-child(-n + 3):not(:first-child) .columns__divider {
215
+ display: none;
216
+ }
217
+
218
+ .columns__col:nth-child(n + 4) .columns__divider {
219
+ display: block;
220
+ width: 100%;
221
+ height: 1px;
222
+ margin: 0 0 1.5rem;
172
223
  }
173
224
 
174
225
  .footer-link {
@@ -177,16 +228,14 @@
177
228
  text-align: left;
178
229
  }
179
230
 
180
- .legal {
181
- font-size: 18px;
182
- line-height: 28px;
183
- }
184
-
185
- .standard {
186
- font-size: 18px;
187
- line-height: 28px;
231
+ .columns__links {
232
+ align-items: flex-start;
233
+ text-align: left;
188
234
  }
235
+ }
189
236
 
237
+ /* md: 6 footer columns → single row */
238
+ @media (width >= 960px) {
190
239
  .columns {
191
240
  display: flex;
192
241
  flex-direction: row;
@@ -196,6 +245,7 @@
196
245
  }
197
246
 
198
247
  .columns__col {
248
+ flex: 1 1 0;
199
249
  flex-direction: row;
200
250
  align-items: stretch;
201
251
  }
@@ -204,15 +254,17 @@
204
254
  gap: 0;
205
255
  }
206
256
 
207
- .columns__divider {
257
+ .columns__col:nth-child(-n + 3):not(:first-child) .columns__divider,
258
+ .columns__col:nth-child(n + 4) .columns__divider {
259
+ display: block;
208
260
  width: 1px;
209
261
  height: auto;
210
- margin: 0 12px;
262
+ margin: 0 1.5rem;
211
263
  }
212
264
 
213
265
  .columns__links {
266
+ flex: 1;
214
267
  align-items: flex-start;
215
- padding: 0 12px;
216
268
  text-align: left;
217
269
  }
218
270
  }
@@ -1,8 +1,8 @@
1
1
  import { h } from "@stencil/core";
2
- import { isNonEmptyString, normalizeLinks, parseJsonProp } from "../../utils/layout";
2
+ import { isNonEmptyString, normalizeMenu, parseJsonProp } from "../../utils/layout";
3
3
  const EMPTY_FOOTER = {
4
4
  social: [],
5
- columns: [],
5
+ menu: [],
6
6
  credits: '',
7
7
  copyright: '',
8
8
  };
@@ -29,32 +29,28 @@ function normalizeSocialLinks(input) {
29
29
  }
30
30
  return result;
31
31
  }
32
- function normalizeColumns(input) {
33
- if (!Array.isArray(input))
34
- return [];
35
- const result = [];
36
- for (const item of input) {
37
- if (!item || typeof item !== 'object')
38
- continue;
39
- const links = normalizeLinks(item.links);
40
- if (links.length === 0)
41
- continue;
42
- result.push({ links });
43
- }
44
- return result;
45
- }
46
32
  function normalizeFooterData(input) {
47
33
  const root = (input && typeof input === 'object' ? input : {});
48
34
  const footer = (root.footer && typeof root.footer === 'object' ? root.footer : {});
49
35
  return {
50
36
  social: normalizeSocialLinks(footer?.social),
51
- columns: normalizeColumns(footer?.columns),
37
+ menu: normalizeMenu(footer?.menu),
52
38
  credits: isNonEmptyString(footer?.credits) ? footer.credits.trim() : '',
53
39
  copyright: isNonEmptyString(footer?.copyright) ? footer.copyright.trim() : '',
54
40
  };
55
41
  }
56
42
  function linkOpensNewTab(link) {
57
- return isExternalHref(link.href);
43
+ if (link.target === '_blank')
44
+ return true;
45
+ return link.href ? isExternalHref(link.href) : false;
46
+ }
47
+ function linkTarget(link) {
48
+ if (link.target)
49
+ return link.target;
50
+ return linkOpensNewTab(link) ? '_blank' : undefined;
51
+ }
52
+ function linkRel(link) {
53
+ return linkOpensNewTab(link) ? 'noreferrer noopener' : undefined;
58
54
  }
59
55
  function SocialIcon({ platform }) {
60
56
  const common = {
@@ -92,7 +88,7 @@ export class WegFooter {
92
88
  * {
93
89
  * "footer": {
94
90
  * "social": [{ "platform": "LinkedIn", "href": "https://..." }],
95
- * "columns": [{ "links": [{ "label": "About Us", "href": "/about" }] }],
91
+ * "menu": [[{ "label": "About Us", "href": "/about" }]],
96
92
  * "credits": "...",
97
93
  * "copyright": "..."
98
94
  * }
@@ -126,14 +122,14 @@ export class WegFooter {
126
122
  return null;
127
123
  return (h("div", { class: "social" }, links.map((l) => (h("a", { class: "social__link", href: l.href, "aria-label": l.platform, target: isExternalHref(l.href) ? '_blank' : undefined, rel: isExternalHref(l.href) ? 'noreferrer noopener' : undefined }, h("span", { class: "social__icon", "aria-hidden": "true" }, h(SocialIcon, { platform: l.platform })))))));
128
124
  }
129
- renderColumns() {
130
- const columns = this.resolved.columns;
131
- if (columns.length === 0)
125
+ renderMenu() {
126
+ const menu = this.resolved.menu;
127
+ if (menu.length === 0)
132
128
  return null;
133
- return (h("div", { class: "columns" }, columns.map((column, columnIndex) => (h("div", { class: "columns__col", key: columnIndex }, columnIndex > 0 ? h("div", { class: "columns__divider", "aria-hidden": "true" }) : null, h("nav", { class: "columns__links", "aria-label": `Footer links column ${columnIndex + 1}` }, column.links.map((l, linkIndex) => (h("a", { class: "footer-link", href: l.href, key: linkIndex, target: linkOpensNewTab(l) ? '_blank' : undefined, rel: linkOpensNewTab(l) ? 'noreferrer noopener' : undefined }, l.label)))))))));
129
+ return (h("div", { class: "columns" }, menu.map((links, columnIndex) => (h("div", { class: "columns__col", key: columnIndex }, columnIndex > 0 ? h("div", { class: "columns__divider", "aria-hidden": "true" }) : null, h("nav", { class: "columns__links", "aria-label": `Footer links column ${columnIndex + 1}` }, links.map((l, linkIndex) => (h("a", { class: "footer-link", href: l.href, key: linkIndex, target: linkTarget(l), rel: linkRel(l) }, l.label)))))))));
134
130
  }
135
131
  render() {
136
- return (h("footer", { key: 'ba0581c526990148d89fca1c9d6bd69a7d94ab4a', class: "footer" }, h("div", { key: '929f83df41eddc9128036c76108c36182aebe6d7', class: "container footer__inner" }, this.renderSocialLinks(), h("div", { key: '3635cfe0c5e6f4efb79e28a776b6974840875f88', class: "standard" }, this.renderColumns(), this.renderLegalText()))));
132
+ return (h("footer", { key: '44ce6d694eb145005f006b5a02ec68fe2da8ca44', class: "footer" }, h("div", { key: '43dbb00e195a561a44cd9ae0e843c448dce546bb', class: "container footer__inner" }, this.renderSocialLinks(), h("div", { key: '1ede37520397d4fa63671dccc7e3f83f26ac0955', class: "standard" }, this.renderMenu(), this.renderLegalText()))));
137
133
  }
138
134
  static get is() { return "weg-footer"; }
139
135
  static get encapsulation() { return "shadow"; }
@@ -154,7 +150,7 @@ export class WegFooter {
154
150
  "mutable": false,
155
151
  "complexType": {
156
152
  "original": "LayoutData | string",
157
- "resolved": "string | { header?: Partial<LayoutHeaderData>; footer?: Partial<{ social: unknown; columns: unknown; credits: unknown; copyright: unknown; }>; }",
153
+ "resolved": "string | { header?: Partial<LayoutHeaderData>; footer?: Partial<LayoutFooterData>; }",
158
154
  "references": {
159
155
  "LayoutData": {
160
156
  "location": "import",
@@ -168,7 +164,7 @@ export class WegFooter {
168
164
  "optional": true,
169
165
  "docs": {
170
166
  "tags": [],
171
- "text": "Layout payload, supplied by the host application.\r\n\r\nIn JS / framework templates, pass the object directly (e.g. Angular\r\n`[layout]=\"layoutData\"`, React `layout={layoutData}`, vanilla\r\n`el.layout = layoutData`).\r\n\r\nIn plain HTML, pass the same JSON as a string on the `layout` attribute.\r\n\r\nExpected shape:\r\n```json\r\n{\r\n \"footer\": {\r\n \"social\": [{ \"platform\": \"LinkedIn\", \"href\": \"https://...\" }],\r\n \"columns\": [{ \"links\": [{ \"label\": \"About Us\", \"href\": \"/about\" }] }],\r\n \"credits\": \"...\",\r\n \"copyright\": \"...\"\r\n }\r\n}\r\n```"
167
+ "text": "Layout payload, supplied by the host application.\r\n\r\nIn JS / framework templates, pass the object directly (e.g. Angular\r\n`[layout]=\"layoutData\"`, React `layout={layoutData}`, vanilla\r\n`el.layout = layoutData`).\r\n\r\nIn plain HTML, pass the same JSON as a string on the `layout` attribute.\r\n\r\nExpected shape:\r\n```json\r\n{\r\n \"footer\": {\r\n \"social\": [{ \"platform\": \"LinkedIn\", \"href\": \"https://...\" }],\r\n \"menu\": [[{ \"label\": \"About Us\", \"href\": \"/about\" }]],\r\n \"credits\": \"...\",\r\n \"copyright\": \"...\"\r\n }\r\n}\r\n```"
172
168
  },
173
169
  "getter": false,
174
170
  "setter": false,
@@ -26,7 +26,7 @@
26
26
 
27
27
  @media (width >= 960px) {
28
28
  .header {
29
- border-bottom-width: 4px;
29
+ border-bottom-width: 0.25rem;
30
30
  }
31
31
  }
32
32
 
@@ -38,7 +38,7 @@
38
38
  .header--menu-open {
39
39
  position: fixed;
40
40
  inset: 0;
41
- z-index: 100;
41
+ z-index: 1000;
42
42
  display: flex;
43
43
  flex-direction: column;
44
44
  overflow: hidden;
@@ -91,7 +91,7 @@
91
91
  }
92
92
 
93
93
  .logo {
94
- height: 40px;
94
+ height: 2.5rem;
95
95
  width: auto;
96
96
  }
97
97
 
@@ -154,6 +154,7 @@
154
154
 
155
155
  .main-nav-panel {
156
156
  display: none;
157
+ margin-inline: -0.5rem;
157
158
  }
158
159
 
159
160
  @media (width >= 960px) {
@@ -169,7 +170,7 @@
169
170
  }
170
171
 
171
172
  .main-nav {
172
- padding: 0 16px 24px;
173
+ padding: 0 1rem 1.5rem;
173
174
  }
174
175
 
175
176
  @media (width >= 960px) {
@@ -178,7 +179,7 @@
178
179
  align-items: center;
179
180
  justify-content: flex-end;
180
181
  flex-wrap: wrap;
181
- gap: 16px;
182
+ gap: 1rem;
182
183
  padding: 0;
183
184
  }
184
185
  }
@@ -225,7 +226,7 @@
225
226
  .nav-link {
226
227
  display: block;
227
228
  width: 100%;
228
- padding: 16px 0;
229
+ padding: 1rem 0;
229
230
  font-weight: 600;
230
231
  color: inherit;
231
232
  text-decoration: none;
@@ -246,9 +247,9 @@
246
247
  display: flex;
247
248
  align-items: center;
248
249
  justify-content: space-between;
249
- gap: 12px;
250
+ gap: 0.75rem;
250
251
  width: 100%;
251
- padding: 16px 0;
252
+ padding: 1rem 0;
252
253
  border: none;
253
254
  background: transparent;
254
255
  font: inherit;
@@ -277,56 +278,56 @@
277
278
  display: inline-flex;
278
279
  align-items: center;
279
280
  justify-content: center;
280
- width: 24px;
281
- height: 24px;
282
- border-radius: 999px;
281
+ width: 1.5rem;
282
+ height: 1.5rem;
283
+ border-radius: 999rem;
283
284
  background: #312e81;
284
285
  color: #ffffff;
285
286
  flex-shrink: 0;
286
287
  }
287
288
 
288
289
  .nav-dropdown__panel {
289
- padding: 0 0 12px;
290
+ padding: 0 0 0.75rem;
290
291
  }
291
292
 
292
293
  @media (width >= 960px) {
293
294
  .nav-dropdown__panel {
294
295
  position: absolute;
295
- top: calc(100% + 8px);
296
+ top: calc(100% + 0.5rem);
296
297
  left: 0;
297
- z-index: 50;
298
- min-width: 280px;
299
- padding: 12px 0 12px 12px;
298
+ z-index: 500;
299
+ min-width: 17.5rem;
300
+ padding: 0.75rem 0 0.75rem 0.75rem;
300
301
  border: 1px solid #e2e8f0;
301
- border-radius: 8px;
302
+ border-radius: 0.5rem;
302
303
  background: #f8fafc;
303
- box-shadow: 0 4px 16px rgba(15, 23, 42, 0.08);
304
+ box-shadow: 0 0.25rem 1rem rgba(15, 23, 42, 0.08);
304
305
  }
305
306
 
306
307
  .nav-dropdown__panel::before {
307
308
  content: '';
308
309
  position: absolute;
309
- top: -8px;
310
+ top: -0.5rem;
310
311
  left: 0;
311
312
  right: 0;
312
- height: 8px;
313
+ height: 0.5rem;
313
314
  }
314
315
  }
315
316
 
316
317
  .nav-dropdown__accent {
317
- border-left: 4px solid var(--weg-color-accent);
318
- padding-left: 12px;
318
+ border-left: 0.25rem solid var(--weg-color-accent);
319
+ padding-left: 0.75rem;
319
320
  }
320
321
 
321
322
  .nav-dropdown__links {
322
323
  display: flex;
323
324
  flex-direction: column;
324
- gap: 4px;
325
+ gap: 0.25rem;
325
326
  }
326
327
 
327
328
  .nav-dropdown__link {
328
329
  display: block;
329
- padding: 10px 0;
330
+ padding: 0.625rem 0;
330
331
  font-weight: 400;
331
332
  color: inherit;
332
333
  text-decoration: none;
@@ -338,9 +339,9 @@
338
339
  }
339
340
 
340
341
  .nav-dropdown__link:focus-visible {
341
- outline: 2px solid var(--weg-color-accent);
342
- outline-offset: 2px;
343
- border-radius: 4px;
342
+ outline: 0.125rem solid var(--weg-color-accent);
343
+ outline-offset: 0.125rem;
344
+ border-radius: 0.25rem;
344
345
  }
345
346
 
346
347
  @media (width >= 960px) {
@@ -380,7 +381,7 @@
380
381
  align-items: center;
381
382
  width: auto;
382
383
  padding: 0.5rem;
383
- border-radius: 8px;
384
+ border-radius: 0.5rem;
384
385
  }
385
386
 
386
387
  .nav-dropdown__trigger {
@@ -408,7 +409,7 @@
408
409
  .auth-button {
409
410
  display: inline-flex;
410
411
  align-items: center;
411
- gap: 8px;
412
+ gap: 0.5rem;
412
413
  font-weight: 600;
413
414
  color: inherit;
414
415
  text-decoration: none;
@@ -441,11 +442,11 @@
441
442
  display: inline-flex;
442
443
  align-items: center;
443
444
  justify-content: center;
444
- width: 40px;
445
- height: 40px;
445
+ width: 2.5rem;
446
+ height: 2.5rem;
446
447
  padding: 0;
447
448
  border: none;
448
- border-radius: 8px;
449
+ border-radius: 0.5rem;
449
450
  background: transparent;
450
451
  color: inherit;
451
452
  cursor: pointer;