@bonniernews/dn-design-system-web 32.6.0 → 32.6.2
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.
- package/CHANGELOG.md +19 -0
- package/components/byline/README-NJK.md +55 -0
- package/components/byline/README.md +27 -49
- package/components/byline/byline.scss +4 -3
- package/components/byline-list/README.md +13 -2
- package/components/direkt-header/README.md +2 -1
- package/components/direkt-header/direkt-header.scss +1 -0
- package/package.json +1 -1
- package/preact/components/byline/byline.d.ts +37 -0
- package/preact/components/byline/byline.js +505 -0
- package/preact/components/byline/byline.js.map +7 -0
- package/preact/components/byline-list/byline-list.d.ts +4 -21
- package/preact/components/byline-list/byline-list.js +31 -30
- package/preact/components/byline-list/byline-list.js.map +2 -2
- package/preact/components/direkt-header/direkt-header.d.ts +3 -2
- package/preact/components/direkt-header/direkt-header.js +6 -5
- package/preact/components/direkt-header/direkt-header.js.map +2 -2
|
@@ -0,0 +1,505 @@
|
|
|
1
|
+
// ../src/components/byline/byline.tsx
|
|
2
|
+
import { Fragment as Fragment2 } from "preact/jsx-runtime";
|
|
3
|
+
|
|
4
|
+
// ../src/helpers/formatClassString.ts
|
|
5
|
+
var formatClassString = (classesArray) => {
|
|
6
|
+
return classesArray.filter((x) => !!x).join(" ");
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
// ../src/foundations/icons/sprite.svg
|
|
10
|
+
import { h } from "preact";
|
|
11
|
+
import { jsx, jsxs } from "preact/jsx-runtime";
|
|
12
|
+
|
|
13
|
+
// ../src/components/icon-sprite/icon-sprite.tsx
|
|
14
|
+
import { jsx as jsx2 } from "preact/jsx-runtime";
|
|
15
|
+
var IconUse = ({ iconName, classNames, attributes }) => {
|
|
16
|
+
const componentClassName = "ds-icon";
|
|
17
|
+
const classes = formatClassString([
|
|
18
|
+
componentClassName,
|
|
19
|
+
`${componentClassName}--sprite`,
|
|
20
|
+
`${componentClassName}--${iconName}`,
|
|
21
|
+
classNames
|
|
22
|
+
]);
|
|
23
|
+
return /* @__PURE__ */ jsx2("i", { className: classes, ...attributes, children: /* @__PURE__ */ jsx2("svg", { children: /* @__PURE__ */ jsx2("use", { xlinkHref: `#ds-${iconName}` }) }) });
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
// ../src/components/spinner/spinner.tsx
|
|
27
|
+
import { jsx as jsx3 } from "preact/jsx-runtime";
|
|
28
|
+
var Spinner = ({ variant = "primary", size = "large", forcePx, classNames, attributes }) => {
|
|
29
|
+
const componentClassName = "ds-spinner";
|
|
30
|
+
const classes = formatClassString([
|
|
31
|
+
`${componentClassName}`,
|
|
32
|
+
`${componentClassName}--${variant}`,
|
|
33
|
+
`${componentClassName}--${size}`,
|
|
34
|
+
forcePx && "ds-force-px",
|
|
35
|
+
classNames
|
|
36
|
+
]);
|
|
37
|
+
return /* @__PURE__ */ jsx3("span", { className: classes, ...attributes, children: /* @__PURE__ */ jsx3("span", { className: `${componentClassName}__inner` }) });
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
// ../src/components/button/button-base.tsx
|
|
41
|
+
import { Fragment, jsx as jsx4, jsxs as jsxs2 } from "preact/jsx-runtime";
|
|
42
|
+
var InnerButton = ({ text, isIconButton = false, attributes, icon, loadingHtml }) => {
|
|
43
|
+
let optionalHtml;
|
|
44
|
+
if (!isIconButton && attributes["aria-label"]) {
|
|
45
|
+
optionalHtml = /* @__PURE__ */ jsx4("span", { "aria-hidden": "true", children: text });
|
|
46
|
+
} else if (!isIconButton) {
|
|
47
|
+
optionalHtml = /* @__PURE__ */ jsx4("span", { children: text });
|
|
48
|
+
}
|
|
49
|
+
return /* @__PURE__ */ jsxs2(Fragment, { children: [
|
|
50
|
+
optionalHtml,
|
|
51
|
+
icon,
|
|
52
|
+
loadingHtml
|
|
53
|
+
] });
|
|
54
|
+
};
|
|
55
|
+
var ToggleWrapper = ({
|
|
56
|
+
selected = false,
|
|
57
|
+
disabled = false,
|
|
58
|
+
attributes,
|
|
59
|
+
classes,
|
|
60
|
+
onChild,
|
|
61
|
+
offChild,
|
|
62
|
+
loadingHtml
|
|
63
|
+
}) => {
|
|
64
|
+
return /* @__PURE__ */ jsxs2("button", { type: "button", role: "switch", "aria-checked": selected, className: classes, ...attributes, disabled, children: [
|
|
65
|
+
/* @__PURE__ */ jsx4("span", { className: "ds-btn__off", "aria-hidden": "true", children: onChild }),
|
|
66
|
+
/* @__PURE__ */ jsx4("span", { className: "ds-btn__on", "aria-hidden": "true", children: offChild }),
|
|
67
|
+
loadingHtml
|
|
68
|
+
] });
|
|
69
|
+
};
|
|
70
|
+
var ButtonBase = ({
|
|
71
|
+
text,
|
|
72
|
+
disabled = false,
|
|
73
|
+
variant = "primary",
|
|
74
|
+
size = "md",
|
|
75
|
+
fullWidth = false,
|
|
76
|
+
mobileFullWidth = false,
|
|
77
|
+
iconPosition = "none",
|
|
78
|
+
iconName,
|
|
79
|
+
loading = false,
|
|
80
|
+
type = "button",
|
|
81
|
+
href,
|
|
82
|
+
classNames,
|
|
83
|
+
attributes = {},
|
|
84
|
+
forcePx = false,
|
|
85
|
+
isIconButton = false,
|
|
86
|
+
selected = false,
|
|
87
|
+
isToggle = false,
|
|
88
|
+
selectedIconName,
|
|
89
|
+
selectedText
|
|
90
|
+
}) => {
|
|
91
|
+
if (isIconButton && text && !attributes["aria-label"]) {
|
|
92
|
+
attributes["aria-label"] = text;
|
|
93
|
+
} else if (isToggle && text && selectedText && !attributes["aria-label"]) {
|
|
94
|
+
attributes["aria-label"] = selected ? selectedText : text;
|
|
95
|
+
}
|
|
96
|
+
let spinnerVariant = "secondary";
|
|
97
|
+
if (variant === "staticWhite" || variant === "transparent") {
|
|
98
|
+
spinnerVariant = "staticBlack";
|
|
99
|
+
} else if (variant === "secondaryFilled" || variant === "secondaryOutline") {
|
|
100
|
+
spinnerVariant = "primary";
|
|
101
|
+
}
|
|
102
|
+
const loadingHtml = /* @__PURE__ */ jsx4(Spinner, { ...{ size: "small", variant: spinnerVariant, forcePx, attributes: { "aria-hidden": "true" } } });
|
|
103
|
+
let icon;
|
|
104
|
+
if (iconName && (iconPosition != "none" || isIconButton == true)) {
|
|
105
|
+
icon = /* @__PURE__ */ jsx4(IconUse, { ...{ iconName, attributes: { "aria-hidden": "true" } } });
|
|
106
|
+
}
|
|
107
|
+
const classNamePrefix = "ds-btn--";
|
|
108
|
+
const classes = formatClassString([
|
|
109
|
+
"ds-btn",
|
|
110
|
+
`${classNamePrefix}${variant}`,
|
|
111
|
+
`${classNamePrefix}${size}`,
|
|
112
|
+
isToggle && selected && `${classNamePrefix}selected`,
|
|
113
|
+
fullWidth && `${classNamePrefix}full-width`,
|
|
114
|
+
mobileFullWidth && `${classNamePrefix}mobile-full-width`,
|
|
115
|
+
icon && !isIconButton && `${classNamePrefix}icon-${iconPosition}`,
|
|
116
|
+
isIconButton && `${classNamePrefix}icon-only`,
|
|
117
|
+
isToggle && `${classNamePrefix}toggle`,
|
|
118
|
+
loading && "ds-loading",
|
|
119
|
+
forcePx && "ds-force-px",
|
|
120
|
+
classNames
|
|
121
|
+
]);
|
|
122
|
+
let buttonToRender;
|
|
123
|
+
if (isToggle) {
|
|
124
|
+
let onChild, offChild;
|
|
125
|
+
if (isIconButton && iconName && selectedIconName) {
|
|
126
|
+
onChild = /* @__PURE__ */ jsx4(IconUse, { iconName });
|
|
127
|
+
offChild = /* @__PURE__ */ jsx4(IconUse, { iconName: selectedIconName });
|
|
128
|
+
} else {
|
|
129
|
+
onChild = /* @__PURE__ */ jsx4("span", { children: text });
|
|
130
|
+
offChild = /* @__PURE__ */ jsxs2(Fragment, { children: [
|
|
131
|
+
/* @__PURE__ */ jsx4(IconUse, { iconName: "check" }),
|
|
132
|
+
/* @__PURE__ */ jsx4("span", { children: selectedText })
|
|
133
|
+
] });
|
|
134
|
+
}
|
|
135
|
+
buttonToRender = /* @__PURE__ */ jsx4(ToggleWrapper, { ...{ selected, classes, attributes, disabled, onChild, offChild, loadingHtml } });
|
|
136
|
+
} else {
|
|
137
|
+
const buttonParams = { isIconButton, text, icon, loadingHtml, attributes };
|
|
138
|
+
if (href) {
|
|
139
|
+
const params = { ...buttonParams, loadingHtml: null };
|
|
140
|
+
buttonToRender = /* @__PURE__ */ jsx4("a", { href, className: classes, ...attributes, children: /* @__PURE__ */ jsx4(InnerButton, { ...params }) });
|
|
141
|
+
} else {
|
|
142
|
+
buttonToRender = /* @__PURE__ */ jsx4("button", { type, className: classes, ...attributes, disabled, children: /* @__PURE__ */ jsx4(InnerButton, { ...buttonParams }) });
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
return /* @__PURE__ */ jsx4(Fragment, { children: buttonToRender });
|
|
146
|
+
};
|
|
147
|
+
|
|
148
|
+
// ../src/components/button/button.tsx
|
|
149
|
+
import { jsx as jsx5 } from "preact/jsx-runtime";
|
|
150
|
+
var Button = ({
|
|
151
|
+
text,
|
|
152
|
+
disabled = false,
|
|
153
|
+
variant = "primary",
|
|
154
|
+
size = "md",
|
|
155
|
+
fullWidth = false,
|
|
156
|
+
mobileFullWidth = false,
|
|
157
|
+
iconPosition = "none",
|
|
158
|
+
iconName,
|
|
159
|
+
loading = false,
|
|
160
|
+
type = "button",
|
|
161
|
+
href,
|
|
162
|
+
isIconButton = false,
|
|
163
|
+
classNames,
|
|
164
|
+
attributes,
|
|
165
|
+
forcePx = false
|
|
166
|
+
}) => {
|
|
167
|
+
return /* @__PURE__ */ jsx5(ButtonBase, { ...{
|
|
168
|
+
text,
|
|
169
|
+
disabled,
|
|
170
|
+
variant,
|
|
171
|
+
size,
|
|
172
|
+
fullWidth,
|
|
173
|
+
mobileFullWidth,
|
|
174
|
+
iconPosition,
|
|
175
|
+
iconName,
|
|
176
|
+
loading,
|
|
177
|
+
type,
|
|
178
|
+
href,
|
|
179
|
+
isIconButton,
|
|
180
|
+
classNames,
|
|
181
|
+
attributes,
|
|
182
|
+
forcePx
|
|
183
|
+
} });
|
|
184
|
+
};
|
|
185
|
+
var button_default = Button;
|
|
186
|
+
|
|
187
|
+
// ../src/components/modal/modal.tsx
|
|
188
|
+
import { jsx as jsx6, jsxs as jsxs3 } from "preact/jsx-runtime";
|
|
189
|
+
var Modal = ({
|
|
190
|
+
title,
|
|
191
|
+
modalType = "standard",
|
|
192
|
+
primaryButton,
|
|
193
|
+
secondaryButton,
|
|
194
|
+
classNames,
|
|
195
|
+
attributes,
|
|
196
|
+
forcePx,
|
|
197
|
+
children
|
|
198
|
+
}) => {
|
|
199
|
+
const componentClassName = "ds-modal";
|
|
200
|
+
const classes = formatClassString([
|
|
201
|
+
componentClassName,
|
|
202
|
+
modalType === "sheet" && `${componentClassName}--sheet`,
|
|
203
|
+
forcePx && "ds-force-px",
|
|
204
|
+
classNames
|
|
205
|
+
]);
|
|
206
|
+
const hasButtons = primaryButton || secondaryButton;
|
|
207
|
+
return /* @__PURE__ */ jsx6("div", { className: classes, children: /* @__PURE__ */ jsx6("dialog", { className: `${componentClassName}__inner`, ...attributes, children: /* @__PURE__ */ jsxs3("div", { className: `${componentClassName}__content`, children: [
|
|
208
|
+
modalType === "standard" && /* @__PURE__ */ jsx6(
|
|
209
|
+
button_default,
|
|
210
|
+
{
|
|
211
|
+
...{
|
|
212
|
+
variant: "transparent",
|
|
213
|
+
size: "sm",
|
|
214
|
+
iconName: "close",
|
|
215
|
+
isIconButton: true,
|
|
216
|
+
attributes: {
|
|
217
|
+
"aria-label": "st\xE4ng"
|
|
218
|
+
},
|
|
219
|
+
classNames: "ds-modal__close ds-modal__close--icon"
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
),
|
|
223
|
+
title && /* @__PURE__ */ jsx6("h2", { children: title }),
|
|
224
|
+
children,
|
|
225
|
+
hasButtons && /* @__PURE__ */ jsxs3("div", { className: "ds-modal__buttons", children: [
|
|
226
|
+
secondaryButton && /* @__PURE__ */ jsx6(
|
|
227
|
+
button_default,
|
|
228
|
+
{
|
|
229
|
+
...{
|
|
230
|
+
text: secondaryButton.text,
|
|
231
|
+
size: "lg",
|
|
232
|
+
variant: "secondaryOutline",
|
|
233
|
+
href: secondaryButton.href,
|
|
234
|
+
classNames: [
|
|
235
|
+
"ds-modal__secondary-button",
|
|
236
|
+
secondaryButton.isCloseButton && "ds-modal__close",
|
|
237
|
+
secondaryButton.classNames
|
|
238
|
+
].join(" "),
|
|
239
|
+
attributes: secondaryButton.attributes,
|
|
240
|
+
forcePx,
|
|
241
|
+
mobileFullWidth: true
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
),
|
|
245
|
+
primaryButton && /* @__PURE__ */ jsx6(
|
|
246
|
+
button_default,
|
|
247
|
+
{
|
|
248
|
+
...{
|
|
249
|
+
text: primaryButton.text,
|
|
250
|
+
size: "lg",
|
|
251
|
+
variant: "primaryBlack",
|
|
252
|
+
href: primaryButton.href,
|
|
253
|
+
classNames: ["ds-modal__primary-button", primaryButton.classNames].join(" "),
|
|
254
|
+
attributes: primaryButton.attributes,
|
|
255
|
+
forcePx,
|
|
256
|
+
mobileFullWidth: true
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
)
|
|
260
|
+
] })
|
|
261
|
+
] }) }) });
|
|
262
|
+
};
|
|
263
|
+
|
|
264
|
+
// ../src/components/button-toggle/button-toggle.tsx
|
|
265
|
+
import { jsx as jsx7 } from "preact/jsx-runtime";
|
|
266
|
+
var ButtonToggle = ({
|
|
267
|
+
selected = false,
|
|
268
|
+
text,
|
|
269
|
+
selectedText,
|
|
270
|
+
disabled = false,
|
|
271
|
+
variant = "primary",
|
|
272
|
+
size = "md",
|
|
273
|
+
fullWidth = false,
|
|
274
|
+
mobileFullWidth = false,
|
|
275
|
+
isIconButton = false,
|
|
276
|
+
iconName,
|
|
277
|
+
selectedIconName,
|
|
278
|
+
loading = false,
|
|
279
|
+
attributes = {},
|
|
280
|
+
classNames,
|
|
281
|
+
forcePx = false
|
|
282
|
+
}) => {
|
|
283
|
+
return /* @__PURE__ */ jsx7(
|
|
284
|
+
ButtonBase,
|
|
285
|
+
{
|
|
286
|
+
...{
|
|
287
|
+
selected,
|
|
288
|
+
text,
|
|
289
|
+
disabled,
|
|
290
|
+
variant,
|
|
291
|
+
size,
|
|
292
|
+
fullWidth,
|
|
293
|
+
mobileFullWidth,
|
|
294
|
+
isIconButton,
|
|
295
|
+
iconName,
|
|
296
|
+
selectedIconName,
|
|
297
|
+
loading,
|
|
298
|
+
classNames,
|
|
299
|
+
attributes,
|
|
300
|
+
forcePx,
|
|
301
|
+
isToggle: true,
|
|
302
|
+
selectedText,
|
|
303
|
+
type: "button"
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
);
|
|
307
|
+
};
|
|
308
|
+
var button_toggle_default = ButtonToggle;
|
|
309
|
+
|
|
310
|
+
// ../src/components/byline-list/byline-list.tsx
|
|
311
|
+
import { jsx as jsx8, jsxs as jsxs4 } from "preact/jsx-runtime";
|
|
312
|
+
var BylineList = ({ bylines, attributes, showBorderOnLastItem = false, forcePx, classNames }) => {
|
|
313
|
+
const componentClassName = "ds-byline-list__item";
|
|
314
|
+
const classes = formatClassString(["ds-byline-list", forcePx && "ds-force-px", classNames]);
|
|
315
|
+
return /* @__PURE__ */ jsx8("ul", { className: classes, ...attributes, children: bylines && bylines.map((byline, index) => {
|
|
316
|
+
const { name, authorId, authorPageUrl, bylineImage, role, followable } = byline;
|
|
317
|
+
const linkAttributes = {
|
|
318
|
+
"data-link-category": "article author",
|
|
319
|
+
"data-index": `${index}`,
|
|
320
|
+
"data-label": name,
|
|
321
|
+
"data-id": authorId
|
|
322
|
+
};
|
|
323
|
+
const shouldShowBorder = showBorderOnLastItem || index !== bylines.length - 1;
|
|
324
|
+
return /* @__PURE__ */ jsxs4(BylineListInner, { ...{ ...byline, forcePx }, linkAttributes, border: shouldShowBorder, followable, authorPageUrl, children: [
|
|
325
|
+
bylineImage && /* @__PURE__ */ jsx8(
|
|
326
|
+
"div",
|
|
327
|
+
{
|
|
328
|
+
className: `${componentClassName}__portrait`,
|
|
329
|
+
dangerouslySetInnerHTML: { __html: bylineImage }
|
|
330
|
+
}
|
|
331
|
+
),
|
|
332
|
+
/* @__PURE__ */ jsx8(
|
|
333
|
+
Title,
|
|
334
|
+
{
|
|
335
|
+
title: name,
|
|
336
|
+
role,
|
|
337
|
+
authorPageUrl: followable ? authorPageUrl : "",
|
|
338
|
+
attributes: followable && authorPageUrl ? linkAttributes : void 0
|
|
339
|
+
}
|
|
340
|
+
)
|
|
341
|
+
] }, `byline-list-${index}`);
|
|
342
|
+
}) });
|
|
343
|
+
};
|
|
344
|
+
var BylineListInner = ({
|
|
345
|
+
disabled,
|
|
346
|
+
attributes,
|
|
347
|
+
linkAttributes,
|
|
348
|
+
authorPageUrl,
|
|
349
|
+
listItemClassNames,
|
|
350
|
+
buttonAttributes,
|
|
351
|
+
buttonClassNames,
|
|
352
|
+
followable,
|
|
353
|
+
followed,
|
|
354
|
+
border = true,
|
|
355
|
+
forcePx,
|
|
356
|
+
children
|
|
357
|
+
}) => {
|
|
358
|
+
const componentClassName = "ds-byline-list__item";
|
|
359
|
+
const classes = formatClassString([
|
|
360
|
+
componentClassName,
|
|
361
|
+
listItemClassNames,
|
|
362
|
+
border && `${componentClassName}--border`
|
|
363
|
+
]);
|
|
364
|
+
const isLink = authorPageUrl && !followable;
|
|
365
|
+
return /* @__PURE__ */ jsx8("li", { className: classes, ...attributes, children: isLink ? /* @__PURE__ */ jsxs4("a", { href: authorPageUrl, className: `${componentClassName}__content`, ...linkAttributes, children: [
|
|
366
|
+
children,
|
|
367
|
+
/* @__PURE__ */ jsx8("span", { className: `${componentClassName}__icon-right`, children: IconUse({ iconName: "arrow_forward" }) })
|
|
368
|
+
] }) : /* @__PURE__ */ jsxs4("div", { className: `${componentClassName}__content`, children: [
|
|
369
|
+
children,
|
|
370
|
+
followable && /* @__PURE__ */ jsx8(
|
|
371
|
+
button_toggle_default,
|
|
372
|
+
{
|
|
373
|
+
...{
|
|
374
|
+
text: "F\xF6lj",
|
|
375
|
+
selectedText: "F\xF6ljer",
|
|
376
|
+
variant: "secondaryFilled",
|
|
377
|
+
size: "sm",
|
|
378
|
+
selected: followed,
|
|
379
|
+
disabled,
|
|
380
|
+
forcePx,
|
|
381
|
+
attributes: buttonAttributes,
|
|
382
|
+
classNames: buttonClassNames
|
|
383
|
+
}
|
|
384
|
+
}
|
|
385
|
+
)
|
|
386
|
+
] }) });
|
|
387
|
+
};
|
|
388
|
+
var Title = ({ title, role, authorPageUrl, attributes }) => {
|
|
389
|
+
const componentClassName = "ds-byline-list__item";
|
|
390
|
+
const titleClasses = formatClassString([
|
|
391
|
+
`${componentClassName}__title`
|
|
392
|
+
]);
|
|
393
|
+
return /* @__PURE__ */ jsxs4("div", { className: `${componentClassName}__titles`, children: [
|
|
394
|
+
authorPageUrl ? /* @__PURE__ */ jsx8("a", { href: authorPageUrl, className: titleClasses, ...attributes, children: title }) : /* @__PURE__ */ jsx8("span", { className: titleClasses, ...attributes, children: title }),
|
|
395
|
+
/* @__PURE__ */ jsx8("span", { className: `${componentClassName}__role`, children: role })
|
|
396
|
+
] });
|
|
397
|
+
};
|
|
398
|
+
|
|
399
|
+
// ../src/components/byline/byline.tsx
|
|
400
|
+
import { Fragment as Fragment3, jsx as jsx9, jsxs as jsxs5 } from "preact/jsx-runtime";
|
|
401
|
+
var Byline = ({
|
|
402
|
+
bylines,
|
|
403
|
+
bylineTitle,
|
|
404
|
+
largeByline = false,
|
|
405
|
+
hideBylineImages = false,
|
|
406
|
+
renderBylineModal = false,
|
|
407
|
+
showNameAsLink = false,
|
|
408
|
+
classNames,
|
|
409
|
+
attributes
|
|
410
|
+
}) => {
|
|
411
|
+
const componentClassName = "ds-byline";
|
|
412
|
+
const classes = formatClassString([
|
|
413
|
+
componentClassName,
|
|
414
|
+
largeByline ? `${componentClassName}--large` : "",
|
|
415
|
+
!hideBylineImages ? `${componentClassName}--show-images` : "",
|
|
416
|
+
classNames
|
|
417
|
+
]);
|
|
418
|
+
const shouldRenderModal = !!bylines.length && renderBylineModal && !showNameAsLink;
|
|
419
|
+
return /* @__PURE__ */ jsxs5(Fragment3, { children: [
|
|
420
|
+
/* @__PURE__ */ jsx9("div", { className: classes, ...attributes, children: bylines.length === 1 ? /* @__PURE__ */ jsxs5("div", { className: `${componentClassName}__inner`, children: [
|
|
421
|
+
!hideBylineImages && /* @__PURE__ */ jsx9(
|
|
422
|
+
"div",
|
|
423
|
+
{
|
|
424
|
+
className: largeByline ? `${componentClassName}__portrait--large` : `${componentClassName}__portrait`,
|
|
425
|
+
dangerouslySetInnerHTML: { __html: bylines[0].bylineImage || "" }
|
|
426
|
+
}
|
|
427
|
+
),
|
|
428
|
+
/* @__PURE__ */ jsxs5("div", { className: `${componentClassName}__info`, children: [
|
|
429
|
+
/* @__PURE__ */ jsx9("span", { className: `${componentClassName}__role`, children: bylineTitle }),
|
|
430
|
+
/* @__PURE__ */ jsx9(
|
|
431
|
+
"a",
|
|
432
|
+
{
|
|
433
|
+
href: bylines[0].authorPageUrl || "#",
|
|
434
|
+
className: `${componentClassName}__name`,
|
|
435
|
+
"data-link-category": "article author",
|
|
436
|
+
"data-id": bylines[0].authorPageUrl,
|
|
437
|
+
"data-index": "1",
|
|
438
|
+
"data-label": bylines[0].name,
|
|
439
|
+
children: bylines[0].name
|
|
440
|
+
}
|
|
441
|
+
)
|
|
442
|
+
] })
|
|
443
|
+
] }) : /* @__PURE__ */ jsxs5("div", { className: `${componentClassName}__inner ${componentClassName}__inner--multiple`, children: [
|
|
444
|
+
!hideBylineImages && bylines.map((byline, index) => /* @__PURE__ */ jsx9(
|
|
445
|
+
"div",
|
|
446
|
+
{
|
|
447
|
+
className: `${componentClassName}__portrait`,
|
|
448
|
+
dangerouslySetInnerHTML: { __html: byline.bylineImage || "" }
|
|
449
|
+
},
|
|
450
|
+
`byline-portrait-${index}`
|
|
451
|
+
)),
|
|
452
|
+
/* @__PURE__ */ jsxs5("div", { className: `${componentClassName}__info`, children: [
|
|
453
|
+
/* @__PURE__ */ jsx9("span", { className: `${componentClassName}__role`, children: bylineTitle }),
|
|
454
|
+
bylines.map((byline, index) => {
|
|
455
|
+
const { authorPageUrl } = byline;
|
|
456
|
+
const isLast = index === bylines.length - 1;
|
|
457
|
+
return /* @__PURE__ */ jsxs5(Fragment2, { children: [
|
|
458
|
+
isLast && /* @__PURE__ */ jsx9("span", { className: `${componentClassName}__and`, children: "och " }),
|
|
459
|
+
/* @__PURE__ */ jsx9(
|
|
460
|
+
AuthorName,
|
|
461
|
+
{
|
|
462
|
+
renderLink: showNameAsLink && !!authorPageUrl,
|
|
463
|
+
byline,
|
|
464
|
+
componentClassName,
|
|
465
|
+
index: index + 1,
|
|
466
|
+
showComma: index < bylines.length - 2
|
|
467
|
+
}
|
|
468
|
+
),
|
|
469
|
+
" "
|
|
470
|
+
] }, `byline-name-${index}`);
|
|
471
|
+
})
|
|
472
|
+
] })
|
|
473
|
+
] }) }),
|
|
474
|
+
shouldRenderModal && /* @__PURE__ */ jsx9(Modal, { modalType: "sheet", classNames: "ds-modal--byline", children: /* @__PURE__ */ jsx9(BylineList, { bylines }) })
|
|
475
|
+
] });
|
|
476
|
+
};
|
|
477
|
+
var AuthorName = ({ renderLink, byline, componentClassName, index, showComma }) => {
|
|
478
|
+
const { authorPageUrl, name } = byline;
|
|
479
|
+
if (renderLink) {
|
|
480
|
+
return /* @__PURE__ */ jsxs5(
|
|
481
|
+
"a",
|
|
482
|
+
{
|
|
483
|
+
href: authorPageUrl,
|
|
484
|
+
className: `${componentClassName}__name`,
|
|
485
|
+
"data-link-category": "article author",
|
|
486
|
+
"data-id": authorPageUrl,
|
|
487
|
+
"data-index": index,
|
|
488
|
+
"data-label": name,
|
|
489
|
+
children: [
|
|
490
|
+
name,
|
|
491
|
+
showComma ? "," : ""
|
|
492
|
+
]
|
|
493
|
+
}
|
|
494
|
+
);
|
|
495
|
+
} else {
|
|
496
|
+
return /* @__PURE__ */ jsxs5("span", { className: `${componentClassName}__name`, children: [
|
|
497
|
+
name,
|
|
498
|
+
showComma ? "," : ""
|
|
499
|
+
] });
|
|
500
|
+
}
|
|
501
|
+
};
|
|
502
|
+
export {
|
|
503
|
+
Byline
|
|
504
|
+
};
|
|
505
|
+
//# sourceMappingURL=byline.js.map
|