@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
@@ -54,20 +54,14 @@ var Spinner = ({ variant = "primary", size = "large", forcePx, classNames, attri
54
54
  return /* @__PURE__ */ jsx4("span", { className: classes, ...attributes, children: /* @__PURE__ */ jsx4("span", { className: `${componentClassName}__inner` }) });
55
55
  };
56
56
 
57
- // ../src/foundations/a11y/visually-hidden.tsx
58
- import { jsx as jsx5 } from "preact/jsx-runtime";
59
- var VisuallyHidden = ({ text }) => {
60
- return /* @__PURE__ */ jsx5("span", { className: "visually-hidden", dangerouslySetInnerHTML: { __html: text } });
61
- };
62
-
63
57
  // ../src/components/button/button-base.tsx
64
- import { Fragment, jsx as jsx6, jsxs as jsxs3 } from "preact/jsx-runtime";
65
- var InnerButton = ({ text, isIconButton = false, attributes, a11y, icon, loadingHtml }) => {
58
+ import { Fragment, jsx as jsx5, jsxs as jsxs3 } from "preact/jsx-runtime";
59
+ var InnerButton = ({ text, isIconButton = false, attributes, icon, loadingHtml }) => {
66
60
  let optionalHtml;
67
- if (!isIconButton) {
68
- optionalHtml = /* @__PURE__ */ jsx6("span", { "aria-hidden": "true", children: text });
69
- } else if (!attributes["aria-label"] && a11y?.visuallyHidden) {
70
- optionalHtml = /* @__PURE__ */ jsx6(VisuallyHidden, { text: a11y.visuallyHidden });
61
+ if (!isIconButton && attributes["aria-label"]) {
62
+ optionalHtml = /* @__PURE__ */ jsx5("span", { "aria-hidden": "true", children: text });
63
+ } else if (!isIconButton) {
64
+ optionalHtml = /* @__PURE__ */ jsx5("span", { children: text });
71
65
  }
72
66
  return /* @__PURE__ */ jsxs3(Fragment, { children: [
73
67
  optionalHtml,
@@ -85,8 +79,8 @@ var ToggleWrapper = ({
85
79
  loadingHtml
86
80
  }) => {
87
81
  return /* @__PURE__ */ jsxs3("button", { type: "button", role: "switch", "aria-checked": selected, className: classes, ...attributes, disabled, children: [
88
- /* @__PURE__ */ jsx6("span", { className: "ds-btn__off", "aria-hidden": "true", children: onChild }),
89
- /* @__PURE__ */ jsx6("span", { className: "ds-btn__on", "aria-hidden": "true", children: offChild }),
82
+ /* @__PURE__ */ jsx5("span", { className: "ds-btn__off", "aria-hidden": "true", children: onChild }),
83
+ /* @__PURE__ */ jsx5("span", { className: "ds-btn__on", "aria-hidden": "true", children: offChild }),
90
84
  loadingHtml
91
85
  ] });
92
86
  };
@@ -94,9 +88,7 @@ var ButtonBase = ({
94
88
  text,
95
89
  disabled = false,
96
90
  variant = "primary",
97
- emphasis = "default",
98
- rounded = false,
99
- size = "medium",
91
+ size = "md",
100
92
  fullWidth = false,
101
93
  mobileFullWidth = false,
102
94
  iconPosition = "none",
@@ -108,42 +100,35 @@ var ButtonBase = ({
108
100
  attributes = {},
109
101
  forcePx = false,
110
102
  isIconButton = false,
111
- a11y = {},
112
103
  selected = false,
113
104
  isToggle = false,
114
105
  selectedIconName,
115
106
  selectedText
116
107
  }) => {
117
- if (text && !href && !attributes["aria-label"]) {
108
+ if (isIconButton && text && !attributes["aria-label"]) {
118
109
  attributes["aria-label"] = text;
119
110
  }
120
111
  let spinnerVariant = "secondary";
121
- if (variant === "staticWhite") {
122
- if (emphasis === "transparent" || emphasis === "outline") {
123
- spinnerVariant = "staticWhite";
124
- } else {
125
- spinnerVariant = "staticBlack";
126
- }
127
- } else if (emphasis === "transparent" || emphasis === "outline" || variant === "secondary") {
112
+ if (variant === "staticWhite" || variant === "transparent") {
113
+ spinnerVariant = "staticBlack";
114
+ } else if (variant === "secondaryFilled" || variant === "secondaryOutline") {
128
115
  spinnerVariant = "primary";
129
116
  }
130
- const loadingHtml = /* @__PURE__ */ jsx6(Spinner, { ...{ size: "small", variant: spinnerVariant, forcePx, attributes: { "aria-hidden": "true" } } });
117
+ const loadingHtml = /* @__PURE__ */ jsx5(Spinner, { ...{ size: "small", variant: spinnerVariant, forcePx, attributes: { "aria-hidden": "true" } } });
131
118
  let icon;
132
119
  if (iconName && (iconPosition != "none" || isIconButton == true)) {
133
- icon = /* @__PURE__ */ jsx6(IconUse, { ...{ iconName, attributes: { "aria-hidden": "true" } } });
120
+ icon = /* @__PURE__ */ jsx5(IconUse, { ...{ iconName, attributes: { "aria-hidden": "true" } } });
134
121
  }
135
122
  const classNamePrefix = "ds-btn--";
136
123
  const classes = formatClassString([
137
124
  "ds-btn",
138
125
  `${classNamePrefix}${variant}`,
139
- `${classNamePrefix}${emphasis}`,
140
126
  `${classNamePrefix}${size}`,
141
127
  isToggle && selected && `${classNamePrefix}selected`,
142
128
  fullWidth && `${classNamePrefix}full-width`,
143
129
  mobileFullWidth && `${classNamePrefix}mobile-full-width`,
144
130
  icon && !isIconButton && `${classNamePrefix}icon-${iconPosition}`,
145
131
  isIconButton && `${classNamePrefix}icon-only`,
146
- rounded && `${classNamePrefix}rounded`,
147
132
  isToggle && `${classNamePrefix}toggle`,
148
133
  loading && "ds-loading",
149
134
  forcePx && "ds-force-px",
@@ -153,68 +138,75 @@ var ButtonBase = ({
153
138
  if (isToggle) {
154
139
  let onChild, offChild;
155
140
  if (isIconButton && iconName && selectedIconName) {
156
- onChild = /* @__PURE__ */ jsx6(IconUse, { iconName });
157
- offChild = /* @__PURE__ */ jsx6(IconUse, { iconName: selectedIconName });
141
+ onChild = /* @__PURE__ */ jsx5(IconUse, { iconName });
142
+ offChild = /* @__PURE__ */ jsx5(IconUse, { iconName: selectedIconName });
158
143
  } else {
159
- onChild = /* @__PURE__ */ jsx6("span", { children: text });
144
+ onChild = /* @__PURE__ */ jsx5("span", { children: text });
160
145
  offChild = /* @__PURE__ */ jsxs3(Fragment, { children: [
161
- /* @__PURE__ */ jsx6(IconUse, { iconName: "check" }),
162
- /* @__PURE__ */ jsx6("span", { children: selectedText })
146
+ /* @__PURE__ */ jsx5(IconUse, { iconName: "check" }),
147
+ /* @__PURE__ */ jsx5("span", { children: selectedText })
163
148
  ] });
164
149
  }
165
- buttonToRender = /* @__PURE__ */ jsx6(ToggleWrapper, { ...{ selected, classes, attributes, disabled, onChild, offChild, loadingHtml } });
150
+ buttonToRender = /* @__PURE__ */ jsx5(ToggleWrapper, { ...{ selected, classes, attributes, disabled, onChild, offChild, loadingHtml } });
166
151
  } else {
167
- const buttonParams = { isIconButton, a11y, text, icon, loadingHtml, attributes };
152
+ const buttonParams = { isIconButton, text, icon, loadingHtml, attributes };
168
153
  if (href) {
169
154
  const params = { ...buttonParams, loadingHtml: null };
170
- buttonToRender = /* @__PURE__ */ jsx6("a", { href, className: classes, ...attributes, children: /* @__PURE__ */ jsx6(InnerButton, { ...params }) });
155
+ buttonToRender = /* @__PURE__ */ jsx5("a", { href, className: classes, ...attributes, children: /* @__PURE__ */ jsx5(InnerButton, { ...params }) });
171
156
  } else {
172
- buttonToRender = /* @__PURE__ */ jsx6("button", { type, className: classes, ...attributes, disabled, children: /* @__PURE__ */ jsx6(InnerButton, { ...buttonParams }) });
157
+ buttonToRender = /* @__PURE__ */ jsx5("button", { type, className: classes, ...attributes, disabled, children: /* @__PURE__ */ jsx5(InnerButton, { ...buttonParams }) });
173
158
  }
174
159
  }
175
- return /* @__PURE__ */ jsx6(Fragment, { children: buttonToRender });
160
+ return /* @__PURE__ */ jsx5(Fragment, { children: buttonToRender });
176
161
  };
177
162
 
178
- // ../src/components/icon-button-toggle/icon-button-toggle.tsx
179
- import { jsx as jsx7 } from "preact/jsx-runtime";
180
- var IconButtonToggle = ({
181
- iconName,
182
- selectedIconName,
163
+ // ../src/components/button-toggle/button-toggle.tsx
164
+ import { jsx as jsx6 } from "preact/jsx-runtime";
165
+ var ButtonToggle = ({
183
166
  selected = false,
167
+ text,
168
+ selectedText,
184
169
  disabled = false,
185
170
  variant = "primary",
186
- emphasis = "default",
187
- size = "medium",
171
+ size = "md",
172
+ fullWidth = false,
173
+ mobileFullWidth = false,
174
+ isIconButton = false,
175
+ iconName,
176
+ selectedIconName,
188
177
  loading = false,
189
- attributes,
178
+ attributes = {},
190
179
  classNames,
191
180
  forcePx = false
192
181
  }) => {
193
- return /* @__PURE__ */ jsx7(
182
+ return /* @__PURE__ */ jsx6(
194
183
  ButtonBase,
195
184
  {
196
185
  ...{
197
186
  selected,
187
+ text,
198
188
  disabled,
199
189
  variant,
200
- emphasis,
201
190
  size,
202
- loading,
191
+ fullWidth,
192
+ mobileFullWidth,
193
+ isIconButton,
203
194
  iconName,
204
195
  selectedIconName,
205
- attributes,
196
+ loading,
206
197
  classNames,
198
+ attributes,
207
199
  forcePx,
208
- rounded: true,
209
- isIconButton: true,
210
- isToggle: true
200
+ isToggle: true,
201
+ selectedText,
202
+ type: "button"
211
203
  }
212
204
  }
213
205
  );
214
206
  };
215
207
 
216
208
  // ../src/components/text-input/text-input.tsx
217
- import { jsx as jsx8, jsxs as jsxs4 } from "preact/jsx-runtime";
209
+ import { jsx as jsx7, jsxs as jsxs4 } from "preact/jsx-runtime";
218
210
  var TextInput = ({
219
211
  name,
220
212
  type = "text",
@@ -234,7 +226,7 @@ var TextInput = ({
234
226
  const wrapperClasses = formatClassString([componentClassName, forcePx && "ds-force-px", classNames]);
235
227
  const password = type === "password";
236
228
  return /* @__PURE__ */ jsxs4(FormField, { ...{ error, errorMessage, helpText, wrapperClasses }, children: [
237
- /* @__PURE__ */ jsx8(
229
+ /* @__PURE__ */ jsx7(
238
230
  "input",
239
231
  {
240
232
  type,
@@ -249,15 +241,15 @@ var TextInput = ({
249
241
  ...attributes
250
242
  }
251
243
  ),
252
- /* @__PURE__ */ jsx8("label", { className: `${componentClassName}__label`, htmlFor: name, children: label }),
253
- password && /* @__PURE__ */ jsx8(
254
- IconButtonToggle,
244
+ /* @__PURE__ */ jsx7("label", { className: `${componentClassName}__label`, htmlFor: name, children: label }),
245
+ password && /* @__PURE__ */ jsx7(
246
+ ButtonToggle,
255
247
  {
256
- variant: "secondary",
257
- emphasis: "transparent",
258
- size: "small",
248
+ variant: "transparent",
249
+ size: "sm",
259
250
  iconName: "visibility",
260
251
  selectedIconName: "visibility_off",
252
+ isIconButton: true,
261
253
  selected: false,
262
254
  classNames: `${componentClassName}__password-toggle`,
263
255
  attributes: {