@bonniernews/dn-design-system-web 28.0.1 → 29.0.1
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 +23 -0
- package/components/blocked-content/blocked-content.js +1 -1
- package/components/blocked-content/blocked-content.njk +2 -2
- package/components/buddy-menu/buddy-menu.njk +5 -5
- package/components/buddy-menu/buddy-menu.scss +0 -1
- package/components/button/README.md +6 -8
- package/components/button/button-types.ts +34 -27
- package/components/button/button.njk +12 -20
- package/components/button/button.scss +58 -85
- package/components/button-toggle/README.md +8 -5
- package/components/button-toggle/button-toggle.njk +3 -0
- package/components/divider/README.md +1 -1
- package/components/empty-state/empty-state.njk +2 -3
- package/components/factbox/factbox.njk +4 -4
- package/components/group-header/group-header.njk +10 -10
- package/components/group-header/group-header.scss +1 -2
- package/components/list-item/list-item-types.ts +3 -3
- package/components/list-item/list-item.njk +4 -4
- package/components/modal/modal.njk +10 -8
- package/components/modal/modal.scss +3 -4
- package/components/pagination/pagination.njk +0 -1
- package/components/profile-header/profile-header.njk +2 -2
- package/components/tag-header/tag-header.njk +2 -2
- package/components/teaser-list-swipe/teaser-list-swipe.njk +9 -9
- package/components/teaser-list-swipe/teaser-list-swipe.scss +3 -3
- package/components/teaser-list-vertical/teaser-list-vertical.njk +1 -1
- package/components/text-input/text-input.njk +5 -3
- package/components/text-input/text-input.scss +2 -3
- package/components/tooltip/tooltip.njk +4 -4
- package/components/tooltip/tooltip.scss +0 -1
- package/package.json +1 -1
- package/preact/components/buddy-menu/buddy-menu.js +47 -99
- package/preact/components/buddy-menu/buddy-menu.js.map +4 -4
- package/preact/components/button/button-base.d.ts +2 -2
- package/preact/components/button/button-base.js +25 -40
- package/preact/components/button/button-base.js.map +4 -4
- package/preact/components/button/button-types.d.ts +24 -21
- package/preact/components/button/button.d.ts +1 -1
- package/preact/components/button/button.js +30 -47
- package/preact/components/button/button.js.map +4 -4
- package/preact/components/button-toggle/button-toggle.d.ts +1 -1
- package/preact/components/button-toggle/button-toggle.js +34 -44
- package/preact/components/button-toggle/button-toggle.js.map +4 -4
- package/preact/components/list-item/list-item-types.d.ts +3 -3
- package/preact/components/list-item/list-item.js +55 -65
- package/preact/components/list-item/list-item.js.map +4 -4
- package/preact/components/text-input/text-input.js +55 -63
- package/preact/components/text-input/text-input.js.map +4 -4
- package/components/icon-button/README-NJK.md +0 -47
- package/components/icon-button/README-UXD.md +0 -44
- package/components/icon-button/README.md +0 -31
- package/components/icon-button/icon-button.njk +0 -22
- package/components/icon-button/icon-button.scss +0 -32
- package/components/icon-button-toggle/README-NJK.md +0 -53
- package/components/icon-button-toggle/README-UXD.md +0 -0
- package/components/icon-button-toggle/README.md +0 -38
- package/components/icon-button-toggle/icon-button-toggle.njk +0 -18
- package/components/icon-button-toggle/icon-button-toggle.scss +0 -1
- package/preact/components/icon-button/icon-button.d.ts +0 -10
- package/preact/components/icon-button/icon-button.js +0 -198
- package/preact/components/icon-button/icon-button.js.map +0 -7
- package/preact/components/icon-button-toggle/icon-button-toggle.d.ts +0 -18
- package/preact/components/icon-button-toggle/icon-button-toggle.js +0 -200
- package/preact/components/icon-button-toggle/icon-button-toggle.js.map +0 -7
- package/preact/foundations/a11y/visually-hidden.d.ts +0 -4
|
@@ -209,20 +209,14 @@ var Spinner = ({ variant = "primary", size = "large", forcePx, classNames, attri
|
|
|
209
209
|
return /* @__PURE__ */ jsx7("span", { className: classes, ...attributes, children: /* @__PURE__ */ jsx7("span", { className: `${componentClassName}__inner` }) });
|
|
210
210
|
};
|
|
211
211
|
|
|
212
|
-
// ../src/foundations/a11y/visually-hidden.tsx
|
|
213
|
-
import { jsx as jsx8 } from "preact/jsx-runtime";
|
|
214
|
-
var VisuallyHidden = ({ text }) => {
|
|
215
|
-
return /* @__PURE__ */ jsx8("span", { className: "visually-hidden", dangerouslySetInnerHTML: { __html: text } });
|
|
216
|
-
};
|
|
217
|
-
|
|
218
212
|
// ../src/components/button/button-base.tsx
|
|
219
|
-
import { Fragment as Fragment3, jsx as
|
|
220
|
-
var InnerButton = ({ text, isIconButton = false, attributes,
|
|
213
|
+
import { Fragment as Fragment3, jsx as jsx8, jsxs as jsxs6 } from "preact/jsx-runtime";
|
|
214
|
+
var InnerButton = ({ text, isIconButton = false, attributes, icon, loadingHtml }) => {
|
|
221
215
|
let optionalHtml;
|
|
222
|
-
if (!isIconButton) {
|
|
223
|
-
optionalHtml = /* @__PURE__ */
|
|
224
|
-
} else if (!
|
|
225
|
-
optionalHtml = /* @__PURE__ */
|
|
216
|
+
if (!isIconButton && attributes["aria-label"]) {
|
|
217
|
+
optionalHtml = /* @__PURE__ */ jsx8("span", { "aria-hidden": "true", children: text });
|
|
218
|
+
} else if (!isIconButton) {
|
|
219
|
+
optionalHtml = /* @__PURE__ */ jsx8("span", { children: text });
|
|
226
220
|
}
|
|
227
221
|
return /* @__PURE__ */ jsxs6(Fragment3, { children: [
|
|
228
222
|
optionalHtml,
|
|
@@ -240,8 +234,8 @@ var ToggleWrapper = ({
|
|
|
240
234
|
loadingHtml
|
|
241
235
|
}) => {
|
|
242
236
|
return /* @__PURE__ */ jsxs6("button", { type: "button", role: "switch", "aria-checked": selected, className: classes, ...attributes, disabled, children: [
|
|
243
|
-
/* @__PURE__ */
|
|
244
|
-
/* @__PURE__ */
|
|
237
|
+
/* @__PURE__ */ jsx8("span", { className: "ds-btn__off", "aria-hidden": "true", children: onChild }),
|
|
238
|
+
/* @__PURE__ */ jsx8("span", { className: "ds-btn__on", "aria-hidden": "true", children: offChild }),
|
|
245
239
|
loadingHtml
|
|
246
240
|
] });
|
|
247
241
|
};
|
|
@@ -249,9 +243,7 @@ var ButtonBase = ({
|
|
|
249
243
|
text,
|
|
250
244
|
disabled = false,
|
|
251
245
|
variant = "primary",
|
|
252
|
-
|
|
253
|
-
rounded = false,
|
|
254
|
-
size = "medium",
|
|
246
|
+
size = "md",
|
|
255
247
|
fullWidth = false,
|
|
256
248
|
mobileFullWidth = false,
|
|
257
249
|
iconPosition = "none",
|
|
@@ -263,42 +255,35 @@ var ButtonBase = ({
|
|
|
263
255
|
attributes = {},
|
|
264
256
|
forcePx = false,
|
|
265
257
|
isIconButton = false,
|
|
266
|
-
a11y = {},
|
|
267
258
|
selected = false,
|
|
268
259
|
isToggle = false,
|
|
269
260
|
selectedIconName,
|
|
270
261
|
selectedText
|
|
271
262
|
}) => {
|
|
272
|
-
if (
|
|
263
|
+
if (isIconButton && text && !attributes["aria-label"]) {
|
|
273
264
|
attributes["aria-label"] = text;
|
|
274
265
|
}
|
|
275
266
|
let spinnerVariant = "secondary";
|
|
276
|
-
if (variant === "staticWhite") {
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
} else {
|
|
280
|
-
spinnerVariant = "staticBlack";
|
|
281
|
-
}
|
|
282
|
-
} else if (emphasis === "transparent" || emphasis === "outline" || variant === "secondary") {
|
|
267
|
+
if (variant === "staticWhite" || variant === "transparent") {
|
|
268
|
+
spinnerVariant = "staticBlack";
|
|
269
|
+
} else if (variant === "secondaryFilled" || variant === "secondaryOutline") {
|
|
283
270
|
spinnerVariant = "primary";
|
|
284
271
|
}
|
|
285
|
-
const loadingHtml = /* @__PURE__ */
|
|
272
|
+
const loadingHtml = /* @__PURE__ */ jsx8(Spinner, { ...{ size: "small", variant: spinnerVariant, forcePx, attributes: { "aria-hidden": "true" } } });
|
|
286
273
|
let icon;
|
|
287
274
|
if (iconName && (iconPosition != "none" || isIconButton == true)) {
|
|
288
|
-
icon = /* @__PURE__ */
|
|
275
|
+
icon = /* @__PURE__ */ jsx8(IconUse, { ...{ iconName, attributes: { "aria-hidden": "true" } } });
|
|
289
276
|
}
|
|
290
277
|
const classNamePrefix = "ds-btn--";
|
|
291
278
|
const classes = formatClassString([
|
|
292
279
|
"ds-btn",
|
|
293
280
|
`${classNamePrefix}${variant}`,
|
|
294
|
-
`${classNamePrefix}${emphasis}`,
|
|
295
281
|
`${classNamePrefix}${size}`,
|
|
296
282
|
isToggle && selected && `${classNamePrefix}selected`,
|
|
297
283
|
fullWidth && `${classNamePrefix}full-width`,
|
|
298
284
|
mobileFullWidth && `${classNamePrefix}mobile-full-width`,
|
|
299
285
|
icon && !isIconButton && `${classNamePrefix}icon-${iconPosition}`,
|
|
300
286
|
isIconButton && `${classNamePrefix}icon-only`,
|
|
301
|
-
rounded && `${classNamePrefix}rounded`,
|
|
302
287
|
isToggle && `${classNamePrefix}toggle`,
|
|
303
288
|
loading && "ds-loading",
|
|
304
289
|
forcePx && "ds-force-px",
|
|
@@ -308,45 +293,48 @@ var ButtonBase = ({
|
|
|
308
293
|
if (isToggle) {
|
|
309
294
|
let onChild, offChild;
|
|
310
295
|
if (isIconButton && iconName && selectedIconName) {
|
|
311
|
-
onChild = /* @__PURE__ */
|
|
312
|
-
offChild = /* @__PURE__ */
|
|
296
|
+
onChild = /* @__PURE__ */ jsx8(IconUse, { iconName });
|
|
297
|
+
offChild = /* @__PURE__ */ jsx8(IconUse, { iconName: selectedIconName });
|
|
313
298
|
} else {
|
|
314
|
-
onChild = /* @__PURE__ */
|
|
299
|
+
onChild = /* @__PURE__ */ jsx8("span", { children: text });
|
|
315
300
|
offChild = /* @__PURE__ */ jsxs6(Fragment3, { children: [
|
|
316
|
-
/* @__PURE__ */
|
|
317
|
-
/* @__PURE__ */
|
|
301
|
+
/* @__PURE__ */ jsx8(IconUse, { iconName: "check" }),
|
|
302
|
+
/* @__PURE__ */ jsx8("span", { children: selectedText })
|
|
318
303
|
] });
|
|
319
304
|
}
|
|
320
|
-
buttonToRender = /* @__PURE__ */
|
|
305
|
+
buttonToRender = /* @__PURE__ */ jsx8(ToggleWrapper, { ...{ selected, classes, attributes, disabled, onChild, offChild, loadingHtml } });
|
|
321
306
|
} else {
|
|
322
|
-
const buttonParams = { isIconButton,
|
|
307
|
+
const buttonParams = { isIconButton, text, icon, loadingHtml, attributes };
|
|
323
308
|
if (href) {
|
|
324
309
|
const params = { ...buttonParams, loadingHtml: null };
|
|
325
|
-
buttonToRender = /* @__PURE__ */
|
|
310
|
+
buttonToRender = /* @__PURE__ */ jsx8("a", { href, className: classes, ...attributes, children: /* @__PURE__ */ jsx8(InnerButton, { ...params }) });
|
|
326
311
|
} else {
|
|
327
|
-
buttonToRender = /* @__PURE__ */
|
|
312
|
+
buttonToRender = /* @__PURE__ */ jsx8("button", { type, className: classes, ...attributes, disabled, children: /* @__PURE__ */ jsx8(InnerButton, { ...buttonParams }) });
|
|
328
313
|
}
|
|
329
314
|
}
|
|
330
|
-
return /* @__PURE__ */
|
|
315
|
+
return /* @__PURE__ */ jsx8(Fragment3, { children: buttonToRender });
|
|
331
316
|
};
|
|
332
317
|
|
|
333
318
|
// ../src/components/button-toggle/button-toggle.tsx
|
|
334
|
-
import { jsx as
|
|
319
|
+
import { jsx as jsx9 } from "preact/jsx-runtime";
|
|
335
320
|
var ButtonToggle = ({
|
|
336
321
|
selected = false,
|
|
337
322
|
text,
|
|
338
323
|
selectedText,
|
|
339
324
|
disabled = false,
|
|
340
325
|
variant = "primary",
|
|
341
|
-
size = "
|
|
326
|
+
size = "md",
|
|
342
327
|
fullWidth = false,
|
|
343
328
|
mobileFullWidth = false,
|
|
329
|
+
isIconButton = false,
|
|
330
|
+
iconName,
|
|
331
|
+
selectedIconName,
|
|
344
332
|
loading = false,
|
|
345
333
|
attributes = {},
|
|
346
334
|
classNames,
|
|
347
335
|
forcePx = false
|
|
348
336
|
}) => {
|
|
349
|
-
return /* @__PURE__ */
|
|
337
|
+
return /* @__PURE__ */ jsx9(
|
|
350
338
|
ButtonBase,
|
|
351
339
|
{
|
|
352
340
|
...{
|
|
@@ -354,10 +342,12 @@ var ButtonToggle = ({
|
|
|
354
342
|
text,
|
|
355
343
|
disabled,
|
|
356
344
|
variant,
|
|
357
|
-
rounded: true,
|
|
358
345
|
size,
|
|
359
346
|
fullWidth,
|
|
360
347
|
mobileFullWidth,
|
|
348
|
+
isIconButton,
|
|
349
|
+
iconName,
|
|
350
|
+
selectedIconName,
|
|
361
351
|
loading,
|
|
362
352
|
classNames,
|
|
363
353
|
attributes,
|
|
@@ -372,7 +362,7 @@ var ButtonToggle = ({
|
|
|
372
362
|
var button_toggle_default = ButtonToggle;
|
|
373
363
|
|
|
374
364
|
// ../src/components/list-item/list-item.tsx
|
|
375
|
-
import { Fragment as Fragment4, jsx as
|
|
365
|
+
import { Fragment as Fragment4, jsx as jsx10, jsxs as jsxs7 } from "preact/jsx-runtime";
|
|
376
366
|
var ListItem = (props) => {
|
|
377
367
|
const {
|
|
378
368
|
listItemType,
|
|
@@ -407,16 +397,16 @@ var ListItem = (props) => {
|
|
|
407
397
|
}
|
|
408
398
|
}
|
|
409
399
|
const mediaHtml = (listItemType === "image" || listItemType === "byline") && props.mediaHtml;
|
|
410
|
-
return /* @__PURE__ */
|
|
411
|
-
iconLeftSvg && /* @__PURE__ */
|
|
412
|
-
mediaHtml && /* @__PURE__ */
|
|
400
|
+
return /* @__PURE__ */ jsx10("li", { className: classes, children: /* @__PURE__ */ jsxs7(ListItemInner, { ...{ ...props, componentClassName }, children: [
|
|
401
|
+
iconLeftSvg && /* @__PURE__ */ jsx10("span", { className: `${componentClassName}__icon-left`, children: iconLeftSvg }),
|
|
402
|
+
mediaHtml && /* @__PURE__ */ jsx10(
|
|
413
403
|
"div",
|
|
414
404
|
{
|
|
415
405
|
className: getImageClass(componentClassName, listItemType),
|
|
416
406
|
dangerouslySetInnerHTML: { __html: mediaHtml }
|
|
417
407
|
}
|
|
418
408
|
),
|
|
419
|
-
title && /* @__PURE__ */
|
|
409
|
+
title && /* @__PURE__ */ jsx10(
|
|
420
410
|
Title,
|
|
421
411
|
{
|
|
422
412
|
title,
|
|
@@ -426,8 +416,8 @@ var ListItem = (props) => {
|
|
|
426
416
|
attributes
|
|
427
417
|
}
|
|
428
418
|
),
|
|
429
|
-
meta && /* @__PURE__ */
|
|
430
|
-
iconRightSvg && /* @__PURE__ */
|
|
419
|
+
meta && /* @__PURE__ */ jsx10("span", { className: `${componentClassName}__meta`, children: meta }),
|
|
420
|
+
iconRightSvg && /* @__PURE__ */ jsx10("span", { className: `${componentClassName}__icon-right`, children: iconRightSvg })
|
|
431
421
|
] }) });
|
|
432
422
|
};
|
|
433
423
|
var ListItemInner = ({
|
|
@@ -457,10 +447,10 @@ var ListItemInner = ({
|
|
|
457
447
|
case "standard":
|
|
458
448
|
case "image":
|
|
459
449
|
const hasLink = href && !disabled;
|
|
460
|
-
return /* @__PURE__ */
|
|
450
|
+
return /* @__PURE__ */ jsx10(Fragment4, { children: hasLink ? /* @__PURE__ */ jsx10("a", { className: classes, href, ...attributes, children }) : /* @__PURE__ */ jsx10("button", { className: classes, disabled, ...attributes, children }) });
|
|
461
451
|
case "checkbox":
|
|
462
452
|
return /* @__PURE__ */ jsxs7("label", { className: classes, htmlFor: name, ...attributes, children: [
|
|
463
|
-
/* @__PURE__ */
|
|
453
|
+
/* @__PURE__ */ jsx10(ListItemIconWrapper, { placement: "left", componentClassName, children: /* @__PURE__ */ jsx10(
|
|
464
454
|
checkbox_default,
|
|
465
455
|
{
|
|
466
456
|
...{
|
|
@@ -477,7 +467,7 @@ var ListItemInner = ({
|
|
|
477
467
|
] });
|
|
478
468
|
case "radio":
|
|
479
469
|
return /* @__PURE__ */ jsxs7("label", { className: classes, htmlFor: id, ...attributes, children: [
|
|
480
|
-
/* @__PURE__ */
|
|
470
|
+
/* @__PURE__ */ jsx10(ListItemIconWrapper, { placement: "left", componentClassName, children: /* @__PURE__ */ jsx10(
|
|
481
471
|
RadioButton,
|
|
482
472
|
{
|
|
483
473
|
...{
|
|
@@ -496,7 +486,7 @@ var ListItemInner = ({
|
|
|
496
486
|
case "switch":
|
|
497
487
|
return /* @__PURE__ */ jsxs7("label", { className: classes, htmlFor: name, ...attributes, children: [
|
|
498
488
|
children,
|
|
499
|
-
/* @__PURE__ */
|
|
489
|
+
/* @__PURE__ */ jsx10(ListItemIconWrapper, { placement: "right", componentClassName, children: /* @__PURE__ */ jsx10(
|
|
500
490
|
Switch,
|
|
501
491
|
{
|
|
502
492
|
...{
|
|
@@ -516,22 +506,22 @@ var ListItemInner = ({
|
|
|
516
506
|
/* @__PURE__ */ jsxs7("button", { className: classes, disabled, ...attributes, children: [
|
|
517
507
|
children,
|
|
518
508
|
/* @__PURE__ */ jsxs7(ListItemIconWrapper, { placement: "right", componentClassName, children: [
|
|
519
|
-
/* @__PURE__ */
|
|
520
|
-
/* @__PURE__ */
|
|
509
|
+
/* @__PURE__ */ jsx10(IconUse, { iconName: "expand_less" }),
|
|
510
|
+
/* @__PURE__ */ jsx10(IconUse, { iconName: "expand_more" })
|
|
521
511
|
] })
|
|
522
512
|
] }),
|
|
523
|
-
accordionContent && /* @__PURE__ */
|
|
513
|
+
accordionContent && /* @__PURE__ */ jsx10("div", { className: `${componentClassName}__accordion-inner`, children: accordionContent })
|
|
524
514
|
] });
|
|
525
515
|
case "toggle":
|
|
526
516
|
case "byline":
|
|
527
|
-
const buttonComponent = /* @__PURE__ */
|
|
517
|
+
const buttonComponent = /* @__PURE__ */ jsx10(
|
|
528
518
|
button_toggle_default,
|
|
529
519
|
{
|
|
530
520
|
...{
|
|
531
521
|
text: toggleText,
|
|
532
522
|
selectedText: toggleSelectedText || "",
|
|
533
|
-
variant: variant || "
|
|
534
|
-
size: "
|
|
523
|
+
variant: variant || "secondaryFilled",
|
|
524
|
+
size: "sm",
|
|
535
525
|
selected,
|
|
536
526
|
disabled,
|
|
537
527
|
forcePx,
|
|
@@ -544,7 +534,7 @@ var ListItemInner = ({
|
|
|
544
534
|
buttonComponent
|
|
545
535
|
] });
|
|
546
536
|
default:
|
|
547
|
-
return /* @__PURE__ */
|
|
537
|
+
return /* @__PURE__ */ jsx10("div", { className: classes, ...attributes, children });
|
|
548
538
|
}
|
|
549
539
|
};
|
|
550
540
|
var Title = ({ title, subtitle, fontWeight, attributes }) => {
|
|
@@ -554,8 +544,8 @@ var Title = ({ title, subtitle, fontWeight, attributes }) => {
|
|
|
554
544
|
`${componentClassName}__title--${fontWeight}`
|
|
555
545
|
]);
|
|
556
546
|
return /* @__PURE__ */ jsxs7("div", { className: `${componentClassName}__titles`, children: [
|
|
557
|
-
/* @__PURE__ */
|
|
558
|
-
subtitle && /* @__PURE__ */
|
|
547
|
+
/* @__PURE__ */ jsx10("span", { className: titleClasses, ...attributes, children: title }),
|
|
548
|
+
subtitle && /* @__PURE__ */ jsx10("span", { className: `${componentClassName}__subtitle`, children: subtitle })
|
|
559
549
|
] });
|
|
560
550
|
};
|
|
561
551
|
var ListItemIconWrapper = ({
|
|
@@ -563,7 +553,7 @@ var ListItemIconWrapper = ({
|
|
|
563
553
|
componentClassName,
|
|
564
554
|
children
|
|
565
555
|
}) => {
|
|
566
|
-
return /* @__PURE__ */
|
|
556
|
+
return /* @__PURE__ */ jsx10("span", { className: `${componentClassName}__icon-${placement}`, children });
|
|
567
557
|
};
|
|
568
558
|
var getImageClass = (componentClassName, listItemType) => {
|
|
569
559
|
const imageType = listItemType === "byline" ? "portrait" : "image";
|