@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
|
@@ -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
|
|
65
|
-
var InnerButton = ({ text, isIconButton = false, attributes,
|
|
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__ */
|
|
69
|
-
} else if (!
|
|
70
|
-
optionalHtml = /* @__PURE__ */
|
|
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__ */
|
|
89
|
-
/* @__PURE__ */
|
|
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
|
-
|
|
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 (
|
|
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
|
-
|
|
123
|
-
|
|
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__ */
|
|
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__ */
|
|
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__ */
|
|
157
|
-
offChild = /* @__PURE__ */
|
|
141
|
+
onChild = /* @__PURE__ */ jsx5(IconUse, { iconName });
|
|
142
|
+
offChild = /* @__PURE__ */ jsx5(IconUse, { iconName: selectedIconName });
|
|
158
143
|
} else {
|
|
159
|
-
onChild = /* @__PURE__ */
|
|
144
|
+
onChild = /* @__PURE__ */ jsx5("span", { children: text });
|
|
160
145
|
offChild = /* @__PURE__ */ jsxs3(Fragment, { children: [
|
|
161
|
-
/* @__PURE__ */
|
|
162
|
-
/* @__PURE__ */
|
|
146
|
+
/* @__PURE__ */ jsx5(IconUse, { iconName: "check" }),
|
|
147
|
+
/* @__PURE__ */ jsx5("span", { children: selectedText })
|
|
163
148
|
] });
|
|
164
149
|
}
|
|
165
|
-
buttonToRender = /* @__PURE__ */
|
|
150
|
+
buttonToRender = /* @__PURE__ */ jsx5(ToggleWrapper, { ...{ selected, classes, attributes, disabled, onChild, offChild, loadingHtml } });
|
|
166
151
|
} else {
|
|
167
|
-
const buttonParams = { isIconButton,
|
|
152
|
+
const buttonParams = { isIconButton, text, icon, loadingHtml, attributes };
|
|
168
153
|
if (href) {
|
|
169
154
|
const params = { ...buttonParams, loadingHtml: null };
|
|
170
|
-
buttonToRender = /* @__PURE__ */
|
|
155
|
+
buttonToRender = /* @__PURE__ */ jsx5("a", { href, className: classes, ...attributes, children: /* @__PURE__ */ jsx5(InnerButton, { ...params }) });
|
|
171
156
|
} else {
|
|
172
|
-
buttonToRender = /* @__PURE__ */
|
|
157
|
+
buttonToRender = /* @__PURE__ */ jsx5("button", { type, className: classes, ...attributes, disabled, children: /* @__PURE__ */ jsx5(InnerButton, { ...buttonParams }) });
|
|
173
158
|
}
|
|
174
159
|
}
|
|
175
|
-
return /* @__PURE__ */
|
|
160
|
+
return /* @__PURE__ */ jsx5(Fragment, { children: buttonToRender });
|
|
176
161
|
};
|
|
177
162
|
|
|
178
|
-
// ../src/components/
|
|
179
|
-
import { jsx as
|
|
180
|
-
var
|
|
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
|
-
|
|
187
|
-
|
|
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__ */
|
|
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
|
-
|
|
191
|
+
fullWidth,
|
|
192
|
+
mobileFullWidth,
|
|
193
|
+
isIconButton,
|
|
203
194
|
iconName,
|
|
204
195
|
selectedIconName,
|
|
205
|
-
|
|
196
|
+
loading,
|
|
206
197
|
classNames,
|
|
198
|
+
attributes,
|
|
207
199
|
forcePx,
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
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
|
|
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__ */
|
|
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__ */
|
|
253
|
-
password && /* @__PURE__ */
|
|
254
|
-
|
|
244
|
+
/* @__PURE__ */ jsx7("label", { className: `${componentClassName}__label`, htmlFor: name, children: label }),
|
|
245
|
+
password && /* @__PURE__ */ jsx7(
|
|
246
|
+
ButtonToggle,
|
|
255
247
|
{
|
|
256
|
-
variant: "
|
|
257
|
-
|
|
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: {
|