@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.
Files changed (65) hide show
  1. package/CHANGELOG.md +23 -0
  2. package/components/blocked-content/blocked-content.js +1 -1
  3. package/components/blocked-content/blocked-content.njk +2 -2
  4. package/components/buddy-menu/buddy-menu.njk +5 -5
  5. package/components/buddy-menu/buddy-menu.scss +0 -1
  6. package/components/button/README.md +6 -8
  7. package/components/button/button-types.ts +34 -27
  8. package/components/button/button.njk +12 -20
  9. package/components/button/button.scss +58 -85
  10. package/components/button-toggle/README.md +8 -5
  11. package/components/button-toggle/button-toggle.njk +3 -0
  12. package/components/divider/README.md +1 -1
  13. package/components/empty-state/empty-state.njk +2 -3
  14. package/components/factbox/factbox.njk +4 -4
  15. package/components/group-header/group-header.njk +10 -10
  16. package/components/group-header/group-header.scss +1 -2
  17. package/components/list-item/list-item-types.ts +3 -3
  18. package/components/list-item/list-item.njk +4 -4
  19. package/components/modal/modal.njk +10 -8
  20. package/components/modal/modal.scss +3 -4
  21. package/components/pagination/pagination.njk +0 -1
  22. package/components/profile-header/profile-header.njk +2 -2
  23. package/components/tag-header/tag-header.njk +2 -2
  24. package/components/teaser-list-swipe/teaser-list-swipe.njk +9 -9
  25. package/components/teaser-list-swipe/teaser-list-swipe.scss +3 -3
  26. package/components/teaser-list-vertical/teaser-list-vertical.njk +1 -1
  27. package/components/text-input/text-input.njk +5 -3
  28. package/components/text-input/text-input.scss +2 -3
  29. package/components/tooltip/tooltip.njk +4 -4
  30. package/components/tooltip/tooltip.scss +0 -1
  31. package/package.json +1 -1
  32. package/preact/components/buddy-menu/buddy-menu.js +47 -99
  33. package/preact/components/buddy-menu/buddy-menu.js.map +4 -4
  34. package/preact/components/button/button-base.d.ts +2 -2
  35. package/preact/components/button/button-base.js +25 -40
  36. package/preact/components/button/button-base.js.map +4 -4
  37. package/preact/components/button/button-types.d.ts +24 -21
  38. package/preact/components/button/button.d.ts +1 -1
  39. package/preact/components/button/button.js +30 -47
  40. package/preact/components/button/button.js.map +4 -4
  41. package/preact/components/button-toggle/button-toggle.d.ts +1 -1
  42. package/preact/components/button-toggle/button-toggle.js +34 -44
  43. package/preact/components/button-toggle/button-toggle.js.map +4 -4
  44. package/preact/components/list-item/list-item-types.d.ts +3 -3
  45. package/preact/components/list-item/list-item.js +55 -65
  46. package/preact/components/list-item/list-item.js.map +4 -4
  47. package/preact/components/text-input/text-input.js +55 -63
  48. package/preact/components/text-input/text-input.js.map +4 -4
  49. package/components/icon-button/README-NJK.md +0 -47
  50. package/components/icon-button/README-UXD.md +0 -44
  51. package/components/icon-button/README.md +0 -31
  52. package/components/icon-button/icon-button.njk +0 -22
  53. package/components/icon-button/icon-button.scss +0 -32
  54. package/components/icon-button-toggle/README-NJK.md +0 -53
  55. package/components/icon-button-toggle/README-UXD.md +0 -0
  56. package/components/icon-button-toggle/README.md +0 -38
  57. package/components/icon-button-toggle/icon-button-toggle.njk +0 -18
  58. package/components/icon-button-toggle/icon-button-toggle.scss +0 -1
  59. package/preact/components/icon-button/icon-button.d.ts +0 -10
  60. package/preact/components/icon-button/icon-button.js +0 -198
  61. package/preact/components/icon-button/icon-button.js.map +0 -7
  62. package/preact/components/icon-button-toggle/icon-button-toggle.d.ts +0 -18
  63. package/preact/components/icon-button-toggle/icon-button-toggle.js +0 -200
  64. package/preact/components/icon-button-toggle/icon-button-toggle.js.map +0 -7
  65. 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 jsx9, jsxs as jsxs6 } from "preact/jsx-runtime";
220
- var InnerButton = ({ text, isIconButton = false, attributes, a11y, icon, loadingHtml }) => {
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__ */ jsx9("span", { "aria-hidden": "true", children: text });
224
- } else if (!attributes["aria-label"] && a11y?.visuallyHidden) {
225
- optionalHtml = /* @__PURE__ */ jsx9(VisuallyHidden, { text: a11y.visuallyHidden });
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__ */ jsx9("span", { className: "ds-btn__off", "aria-hidden": "true", children: onChild }),
244
- /* @__PURE__ */ jsx9("span", { className: "ds-btn__on", "aria-hidden": "true", children: offChild }),
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
- emphasis = "default",
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 (text && !href && !attributes["aria-label"]) {
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
- if (emphasis === "transparent" || emphasis === "outline") {
278
- spinnerVariant = "staticWhite";
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__ */ jsx9(Spinner, { ...{ size: "small", variant: spinnerVariant, forcePx, attributes: { "aria-hidden": "true" } } });
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__ */ jsx9(IconUse, { ...{ iconName, attributes: { "aria-hidden": "true" } } });
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__ */ jsx9(IconUse, { iconName });
312
- offChild = /* @__PURE__ */ jsx9(IconUse, { iconName: selectedIconName });
296
+ onChild = /* @__PURE__ */ jsx8(IconUse, { iconName });
297
+ offChild = /* @__PURE__ */ jsx8(IconUse, { iconName: selectedIconName });
313
298
  } else {
314
- onChild = /* @__PURE__ */ jsx9("span", { children: text });
299
+ onChild = /* @__PURE__ */ jsx8("span", { children: text });
315
300
  offChild = /* @__PURE__ */ jsxs6(Fragment3, { children: [
316
- /* @__PURE__ */ jsx9(IconUse, { iconName: "check" }),
317
- /* @__PURE__ */ jsx9("span", { children: selectedText })
301
+ /* @__PURE__ */ jsx8(IconUse, { iconName: "check" }),
302
+ /* @__PURE__ */ jsx8("span", { children: selectedText })
318
303
  ] });
319
304
  }
320
- buttonToRender = /* @__PURE__ */ jsx9(ToggleWrapper, { ...{ selected, classes, attributes, disabled, onChild, offChild, loadingHtml } });
305
+ buttonToRender = /* @__PURE__ */ jsx8(ToggleWrapper, { ...{ selected, classes, attributes, disabled, onChild, offChild, loadingHtml } });
321
306
  } else {
322
- const buttonParams = { isIconButton, a11y, text, icon, loadingHtml, attributes };
307
+ const buttonParams = { isIconButton, text, icon, loadingHtml, attributes };
323
308
  if (href) {
324
309
  const params = { ...buttonParams, loadingHtml: null };
325
- buttonToRender = /* @__PURE__ */ jsx9("a", { href, className: classes, ...attributes, children: /* @__PURE__ */ jsx9(InnerButton, { ...params }) });
310
+ buttonToRender = /* @__PURE__ */ jsx8("a", { href, className: classes, ...attributes, children: /* @__PURE__ */ jsx8(InnerButton, { ...params }) });
326
311
  } else {
327
- buttonToRender = /* @__PURE__ */ jsx9("button", { type, className: classes, ...attributes, disabled, children: /* @__PURE__ */ jsx9(InnerButton, { ...buttonParams }) });
312
+ buttonToRender = /* @__PURE__ */ jsx8("button", { type, className: classes, ...attributes, disabled, children: /* @__PURE__ */ jsx8(InnerButton, { ...buttonParams }) });
328
313
  }
329
314
  }
330
- return /* @__PURE__ */ jsx9(Fragment3, { children: buttonToRender });
315
+ return /* @__PURE__ */ jsx8(Fragment3, { children: buttonToRender });
331
316
  };
332
317
 
333
318
  // ../src/components/button-toggle/button-toggle.tsx
334
- import { jsx as jsx10 } from "preact/jsx-runtime";
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 = "medium",
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__ */ jsx10(
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 jsx11, jsxs as jsxs7 } from "preact/jsx-runtime";
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__ */ jsx11("li", { className: classes, children: /* @__PURE__ */ jsxs7(ListItemInner, { ...{ ...props, componentClassName }, children: [
411
- iconLeftSvg && /* @__PURE__ */ jsx11("span", { className: `${componentClassName}__icon-left`, children: iconLeftSvg }),
412
- mediaHtml && /* @__PURE__ */ jsx11(
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__ */ jsx11(
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__ */ jsx11("span", { className: `${componentClassName}__meta`, children: meta }),
430
- iconRightSvg && /* @__PURE__ */ jsx11("span", { className: `${componentClassName}__icon-right`, children: iconRightSvg })
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__ */ jsx11(Fragment4, { children: hasLink ? /* @__PURE__ */ jsx11("a", { className: classes, href, ...attributes, children }) : /* @__PURE__ */ jsx11("button", { className: classes, disabled, ...attributes, children }) });
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__ */ jsx11(ListItemIconWrapper, { placement: "left", componentClassName, children: /* @__PURE__ */ jsx11(
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__ */ jsx11(ListItemIconWrapper, { placement: "left", componentClassName, children: /* @__PURE__ */ jsx11(
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__ */ jsx11(ListItemIconWrapper, { placement: "right", componentClassName, children: /* @__PURE__ */ jsx11(
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__ */ jsx11(IconUse, { iconName: "expand_less" }),
520
- /* @__PURE__ */ jsx11(IconUse, { iconName: "expand_more" })
509
+ /* @__PURE__ */ jsx10(IconUse, { iconName: "expand_less" }),
510
+ /* @__PURE__ */ jsx10(IconUse, { iconName: "expand_more" })
521
511
  ] })
522
512
  ] }),
523
- accordionContent && /* @__PURE__ */ jsx11("div", { className: `${componentClassName}__accordion-inner`, children: accordionContent })
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__ */ jsx11(
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 || "secondary",
534
- size: "small",
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__ */ jsx11("div", { className: classes, ...attributes, children });
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__ */ jsx11("span", { className: titleClasses, ...attributes, children: title }),
558
- subtitle && /* @__PURE__ */ jsx11("span", { className: `${componentClassName}__subtitle`, children: subtitle })
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__ */ jsx11("span", { className: `${componentClassName}__icon-${placement}`, children });
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";