@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
@@ -34,20 +34,14 @@ var Spinner = ({ variant = "primary", size = "large", forcePx, classNames, attri
34
34
  return /* @__PURE__ */ jsx3("span", { className: classes, ...attributes, children: /* @__PURE__ */ jsx3("span", { className: `${componentClassName}__inner` }) });
35
35
  };
36
36
 
37
- // ../src/foundations/a11y/visually-hidden.tsx
38
- import { jsx as jsx4 } from "preact/jsx-runtime";
39
- var VisuallyHidden = ({ text }) => {
40
- return /* @__PURE__ */ jsx4("span", { className: "visually-hidden", dangerouslySetInnerHTML: { __html: text } });
41
- };
42
-
43
37
  // ../src/components/button/button-base.tsx
44
- import { Fragment, jsx as jsx5, jsxs as jsxs2 } from "preact/jsx-runtime";
45
- var InnerButton = ({ text, isIconButton = false, attributes, a11y, icon, loadingHtml }) => {
38
+ import { Fragment, jsx as jsx4, jsxs as jsxs2 } from "preact/jsx-runtime";
39
+ var InnerButton = ({ text, isIconButton = false, attributes, icon, loadingHtml }) => {
46
40
  let optionalHtml;
47
- if (!isIconButton) {
48
- optionalHtml = /* @__PURE__ */ jsx5("span", { "aria-hidden": "true", children: text });
49
- } else if (!attributes["aria-label"] && a11y?.visuallyHidden) {
50
- optionalHtml = /* @__PURE__ */ jsx5(VisuallyHidden, { text: a11y.visuallyHidden });
41
+ if (!isIconButton && attributes["aria-label"]) {
42
+ optionalHtml = /* @__PURE__ */ jsx4("span", { "aria-hidden": "true", children: text });
43
+ } else if (!isIconButton) {
44
+ optionalHtml = /* @__PURE__ */ jsx4("span", { children: text });
51
45
  }
52
46
  return /* @__PURE__ */ jsxs2(Fragment, { children: [
53
47
  optionalHtml,
@@ -65,8 +59,8 @@ var ToggleWrapper = ({
65
59
  loadingHtml
66
60
  }) => {
67
61
  return /* @__PURE__ */ jsxs2("button", { type: "button", role: "switch", "aria-checked": selected, className: classes, ...attributes, disabled, children: [
68
- /* @__PURE__ */ jsx5("span", { className: "ds-btn__off", "aria-hidden": "true", children: onChild }),
69
- /* @__PURE__ */ jsx5("span", { className: "ds-btn__on", "aria-hidden": "true", children: offChild }),
62
+ /* @__PURE__ */ jsx4("span", { className: "ds-btn__off", "aria-hidden": "true", children: onChild }),
63
+ /* @__PURE__ */ jsx4("span", { className: "ds-btn__on", "aria-hidden": "true", children: offChild }),
70
64
  loadingHtml
71
65
  ] });
72
66
  };
@@ -74,9 +68,7 @@ var ButtonBase = ({
74
68
  text,
75
69
  disabled = false,
76
70
  variant = "primary",
77
- emphasis = "default",
78
- rounded = false,
79
- size = "medium",
71
+ size = "md",
80
72
  fullWidth = false,
81
73
  mobileFullWidth = false,
82
74
  iconPosition = "none",
@@ -88,42 +80,35 @@ var ButtonBase = ({
88
80
  attributes = {},
89
81
  forcePx = false,
90
82
  isIconButton = false,
91
- a11y = {},
92
83
  selected = false,
93
84
  isToggle = false,
94
85
  selectedIconName,
95
86
  selectedText
96
87
  }) => {
97
- if (text && !href && !attributes["aria-label"]) {
88
+ if (isIconButton && text && !attributes["aria-label"]) {
98
89
  attributes["aria-label"] = text;
99
90
  }
100
91
  let spinnerVariant = "secondary";
101
- if (variant === "staticWhite") {
102
- if (emphasis === "transparent" || emphasis === "outline") {
103
- spinnerVariant = "staticWhite";
104
- } else {
105
- spinnerVariant = "staticBlack";
106
- }
107
- } else if (emphasis === "transparent" || emphasis === "outline" || variant === "secondary") {
92
+ if (variant === "staticWhite" || variant === "transparent") {
93
+ spinnerVariant = "staticBlack";
94
+ } else if (variant === "secondaryFilled" || variant === "secondaryOutline") {
108
95
  spinnerVariant = "primary";
109
96
  }
110
- const loadingHtml = /* @__PURE__ */ jsx5(Spinner, { ...{ size: "small", variant: spinnerVariant, forcePx, attributes: { "aria-hidden": "true" } } });
97
+ const loadingHtml = /* @__PURE__ */ jsx4(Spinner, { ...{ size: "small", variant: spinnerVariant, forcePx, attributes: { "aria-hidden": "true" } } });
111
98
  let icon;
112
99
  if (iconName && (iconPosition != "none" || isIconButton == true)) {
113
- icon = /* @__PURE__ */ jsx5(IconUse, { ...{ iconName, attributes: { "aria-hidden": "true" } } });
100
+ icon = /* @__PURE__ */ jsx4(IconUse, { ...{ iconName, attributes: { "aria-hidden": "true" } } });
114
101
  }
115
102
  const classNamePrefix = "ds-btn--";
116
103
  const classes = formatClassString([
117
104
  "ds-btn",
118
105
  `${classNamePrefix}${variant}`,
119
- `${classNamePrefix}${emphasis}`,
120
106
  `${classNamePrefix}${size}`,
121
107
  isToggle && selected && `${classNamePrefix}selected`,
122
108
  fullWidth && `${classNamePrefix}full-width`,
123
109
  mobileFullWidth && `${classNamePrefix}mobile-full-width`,
124
110
  icon && !isIconButton && `${classNamePrefix}icon-${iconPosition}`,
125
111
  isIconButton && `${classNamePrefix}icon-only`,
126
- rounded && `${classNamePrefix}rounded`,
127
112
  isToggle && `${classNamePrefix}toggle`,
128
113
  loading && "ds-loading",
129
114
  forcePx && "ds-force-px",
@@ -133,37 +118,35 @@ var ButtonBase = ({
133
118
  if (isToggle) {
134
119
  let onChild, offChild;
135
120
  if (isIconButton && iconName && selectedIconName) {
136
- onChild = /* @__PURE__ */ jsx5(IconUse, { iconName });
137
- offChild = /* @__PURE__ */ jsx5(IconUse, { iconName: selectedIconName });
121
+ onChild = /* @__PURE__ */ jsx4(IconUse, { iconName });
122
+ offChild = /* @__PURE__ */ jsx4(IconUse, { iconName: selectedIconName });
138
123
  } else {
139
- onChild = /* @__PURE__ */ jsx5("span", { children: text });
124
+ onChild = /* @__PURE__ */ jsx4("span", { children: text });
140
125
  offChild = /* @__PURE__ */ jsxs2(Fragment, { children: [
141
- /* @__PURE__ */ jsx5(IconUse, { iconName: "check" }),
142
- /* @__PURE__ */ jsx5("span", { children: selectedText })
126
+ /* @__PURE__ */ jsx4(IconUse, { iconName: "check" }),
127
+ /* @__PURE__ */ jsx4("span", { children: selectedText })
143
128
  ] });
144
129
  }
145
- buttonToRender = /* @__PURE__ */ jsx5(ToggleWrapper, { ...{ selected, classes, attributes, disabled, onChild, offChild, loadingHtml } });
130
+ buttonToRender = /* @__PURE__ */ jsx4(ToggleWrapper, { ...{ selected, classes, attributes, disabled, onChild, offChild, loadingHtml } });
146
131
  } else {
147
- const buttonParams = { isIconButton, a11y, text, icon, loadingHtml, attributes };
132
+ const buttonParams = { isIconButton, text, icon, loadingHtml, attributes };
148
133
  if (href) {
149
134
  const params = { ...buttonParams, loadingHtml: null };
150
- buttonToRender = /* @__PURE__ */ jsx5("a", { href, className: classes, ...attributes, children: /* @__PURE__ */ jsx5(InnerButton, { ...params }) });
135
+ buttonToRender = /* @__PURE__ */ jsx4("a", { href, className: classes, ...attributes, children: /* @__PURE__ */ jsx4(InnerButton, { ...params }) });
151
136
  } else {
152
- buttonToRender = /* @__PURE__ */ jsx5("button", { type, className: classes, ...attributes, disabled, children: /* @__PURE__ */ jsx5(InnerButton, { ...buttonParams }) });
137
+ buttonToRender = /* @__PURE__ */ jsx4("button", { type, className: classes, ...attributes, disabled, children: /* @__PURE__ */ jsx4(InnerButton, { ...buttonParams }) });
153
138
  }
154
139
  }
155
- return /* @__PURE__ */ jsx5(Fragment, { children: buttonToRender });
140
+ return /* @__PURE__ */ jsx4(Fragment, { children: buttonToRender });
156
141
  };
157
142
 
158
143
  // ../src/components/button/button.tsx
159
- import { jsx as jsx6 } from "preact/jsx-runtime";
144
+ import { jsx as jsx5 } from "preact/jsx-runtime";
160
145
  var Button = ({
161
146
  text,
162
147
  disabled = false,
163
148
  variant = "primary",
164
- emphasis = "default",
165
- rounded = false,
166
- size = "medium",
149
+ size = "md",
167
150
  fullWidth = false,
168
151
  mobileFullWidth = false,
169
152
  iconPosition = "none",
@@ -171,16 +154,15 @@ var Button = ({
171
154
  loading = false,
172
155
  type = "button",
173
156
  href,
157
+ isIconButton = false,
174
158
  classNames,
175
159
  attributes,
176
160
  forcePx = false
177
161
  }) => {
178
- return /* @__PURE__ */ jsx6(ButtonBase, { ...{
162
+ return /* @__PURE__ */ jsx5(ButtonBase, { ...{
179
163
  text,
180
164
  disabled,
181
165
  variant,
182
- emphasis,
183
- rounded,
184
166
  size,
185
167
  fullWidth,
186
168
  mobileFullWidth,
@@ -189,50 +171,15 @@ var Button = ({
189
171
  loading,
190
172
  type,
191
173
  href,
174
+ isIconButton,
192
175
  classNames,
193
176
  attributes,
194
177
  forcePx
195
178
  } });
196
179
  };
197
180
 
198
- // ../src/components/icon-button/icon-button.tsx
199
- import { jsx as jsx7 } from "preact/jsx-runtime";
200
- var IconButton = ({
201
- iconName,
202
- disabled = false,
203
- variant = "primary",
204
- emphasis = "default",
205
- rounded = true,
206
- size = "medium",
207
- loading = false,
208
- a11y,
209
- attributes,
210
- classNames,
211
- forcePx = false
212
- }) => {
213
- return /* @__PURE__ */ jsx7(
214
- ButtonBase,
215
- {
216
- ...{
217
- disabled,
218
- variant,
219
- emphasis,
220
- rounded,
221
- size,
222
- loading,
223
- iconName,
224
- a11y,
225
- attributes,
226
- classNames,
227
- forcePx,
228
- isIconButton: true
229
- }
230
- }
231
- );
232
- };
233
-
234
181
  // ../src/components/buddy-menu/buddy-menu.tsx
235
- import { jsx as jsx8, jsxs as jsxs3 } from "preact/jsx-runtime";
182
+ import { jsx as jsx6, jsxs as jsxs3 } from "preact/jsx-runtime";
236
183
  var BuddyMenu = ({
237
184
  userName,
238
185
  links,
@@ -247,16 +194,17 @@ var BuddyMenu = ({
247
194
  }) => {
248
195
  const componentClassName = "ds-buddy-menu";
249
196
  const classes = formatClassString([componentClassName, forcePx && "ds-force-px", classNames]);
250
- return /* @__PURE__ */ jsx8("div", { class: `${classes} ${isDnSkola && "ds-buddy-menu--skola"}`, ...attributes, children: /* @__PURE__ */ jsx8("div", { class: `${componentClassName}__inner`, children: /* @__PURE__ */ jsx8("div", { class: "ds-buddy-menu__scrollable-container", children: /* @__PURE__ */ jsxs3("div", { class: "ds-buddy-menu__content", children: [
251
- /* @__PURE__ */ jsx8(
252
- IconButton,
197
+ return /* @__PURE__ */ jsx6("div", { class: `${classes} ${isDnSkola && "ds-buddy-menu--skola"}`, ...attributes, children: /* @__PURE__ */ jsx6("div", { class: `${componentClassName}__inner`, children: /* @__PURE__ */ jsx6("div", { class: "ds-buddy-menu__scrollable-container", children: /* @__PURE__ */ jsxs3("div", { class: "ds-buddy-menu__content", children: [
198
+ /* @__PURE__ */ jsx6(
199
+ Button,
253
200
  {
254
201
  ...{
255
- size: "small",
202
+ size: "sm",
256
203
  iconName: "close",
257
204
  classNames: "ds-buddy-menu__close",
258
205
  forcePx,
259
- emphasis: "transparent"
206
+ variant: "transparent",
207
+ isIconButton: true
260
208
  }
261
209
  }
262
210
  ),
@@ -264,23 +212,23 @@ var BuddyMenu = ({
264
212
  /* @__PURE__ */ jsxs3("span", { class: "ds-buddy-menu__greeting", children: [
265
213
  "Hej",
266
214
  " ",
267
- /* @__PURE__ */ jsx8("span", { class: "ds-buddy-menu__name js-buddy-menu-name", "data-name-type": "given", children: userName }),
215
+ /* @__PURE__ */ jsx6("span", { class: "ds-buddy-menu__name js-buddy-menu-name", "data-name-type": "given", children: userName }),
268
216
  "!"
269
217
  ] }),
270
218
  !isDnSkola && /* @__PURE__ */ jsxs3("div", { class: "ds-buddy-menu__account", children: [
271
- /* @__PURE__ */ jsx8("h2", { class: "ds-buddy-menu__account-title", children: "Min prenumeration" }),
272
- /* @__PURE__ */ jsx8("span", { class: "ds-buddy-menu__account-level js-buddy-menu__account-level", children: accountLevel }),
219
+ /* @__PURE__ */ jsx6("h2", { class: "ds-buddy-menu__account-title", children: "Min prenumeration" }),
220
+ /* @__PURE__ */ jsx6("span", { class: "ds-buddy-menu__account-level js-buddy-menu__account-level", children: accountLevel }),
273
221
  addons && /* @__PURE__ */ jsxs3("div", { class: `ds-buddy-menu__addons ${addonsClassNames}`, children: [
274
- /* @__PURE__ */ jsx8("h2", { class: "ds-buddy-menu__addons-title", children: "Mina till\xE4gg" }),
275
- /* @__PURE__ */ jsx8("ul", { class: "ds-buddy-menu__addons-list", children: addons.map((addon) => /* @__PURE__ */ jsx8("li", { class: addon.classNames, children: /* @__PURE__ */ jsx8("a", { href: addon.href, children: addon.title }) })) })
222
+ /* @__PURE__ */ jsx6("h2", { class: "ds-buddy-menu__addons-title", children: "Mina till\xE4gg" }),
223
+ /* @__PURE__ */ jsx6("ul", { class: "ds-buddy-menu__addons-list", children: addons.map((addon) => /* @__PURE__ */ jsx6("li", { class: addon.classNames, children: /* @__PURE__ */ jsx6("a", { href: addon.href, children: addon.title }) })) })
276
224
  ] }),
277
- /* @__PURE__ */ jsx8(
225
+ /* @__PURE__ */ jsx6(
278
226
  Button,
279
227
  {
280
228
  ...{
281
229
  text: "Mitt konto",
282
- size: "large",
283
- variant: "primary",
230
+ size: "lg",
231
+ variant: "primaryBlack",
284
232
  fullWidth: true,
285
233
  href: myAccountUrl,
286
234
  attributes: { "data-hide-promo": "" },
@@ -291,8 +239,8 @@ var BuddyMenu = ({
291
239
  ] })
292
240
  ] }),
293
241
  /* @__PURE__ */ jsxs3("div", { class: "ds-buddy-menu__links", children: [
294
- /* @__PURE__ */ jsx8("h2", { class: "ds-buddy-menu__links-title", children: "Mitt inneh\xE5ll" }),
295
- /* @__PURE__ */ jsx8("ul", { class: "ds-buddy-menu__links-list", children: links })
242
+ /* @__PURE__ */ jsx6("h2", { class: "ds-buddy-menu__links-title", children: "Mitt inneh\xE5ll" }),
243
+ /* @__PURE__ */ jsx6("ul", { class: "ds-buddy-menu__links-list", children: links })
296
244
  ] })
297
245
  ] }) }) }) });
298
246
  };