@bonniernews/dn-design-system-web 35.0.0 → 36.0.0
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 +19 -0
- package/components/list-item/list-item-types.ts +2 -2
- package/components/list-item/list-item.njk +0 -14
- package/components/list-item/list-item.scss +1 -1
- package/components/{radio-button → radio-button-group}/README.md +18 -11
- package/components/{radio-button/radio-button.scss → radio-button-group/radio-button-group.scss} +2 -2
- package/package.json +1 -1
- package/preact/components/list-item/list-item-types.d.ts +2 -2
- package/preact/components/list-item/list-item.js +57 -57
- package/preact/components/list-item/list-item.js.map +4 -4
- package/preact/components/{radio-button/radio-button.d.ts → radio-button-group/radio-button-group.d.ts} +9 -8
- package/preact/components/{radio-button/radio-button.js → radio-button-group/radio-button-group.js} +12 -12
- package/preact/components/radio-button-group/radio-button-group.js.map +7 -0
- package/components/radio-button/README-njk.md +0 -49
- package/components/radio-button/radio-button.njk +0 -47
- package/preact/components/radio-button/radio-button.js.map +0 -7
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,25 @@ All changes to @bonniernews/dn-design-system-web will be documented in this file
|
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
7
|
+
## [36.0.0](https://github.com/BonnierNews/dn-design-system/compare/@bonniernews/dn-design-system-web@35.0.0...@bonniernews/dn-design-system-web@36.0.0) (2026-01-08)
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
### ⚠ BREAKING CHANGES
|
|
11
|
+
|
|
12
|
+
* **web:** We renamed the radio button component to make it clear that it takes a list of radio buttons. It is now Radio Button Group
|
|
13
|
+
|
|
14
|
+
### Bug Fixes
|
|
15
|
+
|
|
16
|
+
* **web:** radio button renamed to radio button group ([#1977](https://github.com/BonnierNews/dn-design-system/issues/1977)) ([89e83c6](https://github.com/BonnierNews/dn-design-system/commit/89e83c636225652660c486045015c216b203deac))
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
### Maintenance
|
|
20
|
+
|
|
21
|
+
* **app:** script for dynamicColorsIOS ([#1969](https://github.com/BonnierNews/dn-design-system/issues/1969)) ([78b4ab7](https://github.com/BonnierNews/dn-design-system/commit/78b4ab740578ce030e87adc2e43bfdb1d6c2ea22))
|
|
22
|
+
* **foundations:** fix token check security ([#1976](https://github.com/BonnierNews/dn-design-system/issues/1976)) ([600dc63](https://github.com/BonnierNews/dn-design-system/commit/600dc63f0bb818628a160f5b9ee9036d080e4a76))
|
|
23
|
+
* prerelease packages ([ada232c](https://github.com/BonnierNews/dn-design-system/commit/ada232cbd6791991d499944d21ec5a5e3c15c66e))
|
|
24
|
+
* **web:** fix build script security ([#1975](https://github.com/BonnierNews/dn-design-system/issues/1975)) ([9a3bf7d](https://github.com/BonnierNews/dn-design-system/commit/9a3bf7d2735ebfb73e39efc614327f50a6163ded))
|
|
25
|
+
|
|
7
26
|
## [35.0.0](https://github.com/BonnierNews/dn-design-system/compare/@bonniernews/dn-design-system-web@34.2.2...@bonniernews/dn-design-system-web@35.0.0) (2025-12-10)
|
|
8
27
|
|
|
9
28
|
|
|
@@ -3,7 +3,7 @@ import { ComponentChildren } from 'preact'
|
|
|
3
3
|
import type { DsIcon } from '@bonniernews/dn-design-system-web/types-lib/ds-icon.d.ts'
|
|
4
4
|
|
|
5
5
|
import { ButtonToggleStandardProps } from '../button/button-types'
|
|
6
|
-
import {
|
|
6
|
+
import type { RadioButtonProps } from '../radio-button-group/radio-button-group'
|
|
7
7
|
import { SwitchInnerProps } from '../switch/switch'
|
|
8
8
|
|
|
9
9
|
export interface ListItemSharedProps {
|
|
@@ -20,7 +20,7 @@ export interface ListItemSharedProps {
|
|
|
20
20
|
|
|
21
21
|
export interface ListItemBaseProps extends ListItemSharedProps {
|
|
22
22
|
listItemType: 'accordion' | 'checkbox' | 'radio' | 'switch' | 'image' | 'standard' | 'toggle'
|
|
23
|
-
radioButtons?:
|
|
23
|
+
radioButtons?: RadioButtonProps[]
|
|
24
24
|
href?: string
|
|
25
25
|
leadingIcon?: DsIcon
|
|
26
26
|
trailingIcon?: DsIcon
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
{% from '@bonniernews/dn-design-system-web/components/icon-sprite/icon-sprite.njk' import IconUse %}
|
|
2
2
|
{% from '@bonniernews/dn-design-system-web/components/switch/switch.njk' import Switch %}
|
|
3
3
|
{% from '@bonniernews/dn-design-system-web/components/checkbox/checkbox.njk' import Checkbox %}
|
|
4
|
-
{% from '@bonniernews/dn-design-system-web/components/radio-button/radio-button.njk' import RadioButton %}
|
|
5
4
|
{% from '@bonniernews/dn-design-system-web/components/button-toggle/button-toggle.njk' import ButtonToggle %}
|
|
6
5
|
{% from '@bonniernews/dn-design-system-web/njk-helpers/attributes.njk' import getAttributes %}
|
|
7
6
|
|
|
@@ -99,19 +98,6 @@
|
|
|
99
98
|
{% endset %}
|
|
100
99
|
{{ caller() if caller }}
|
|
101
100
|
</label>
|
|
102
|
-
{% elif element == 'radio' %}
|
|
103
|
-
<label class="{{ classes }}" for="{{ params.id }}" {{- attributes | safe }}>
|
|
104
|
-
{% set iconLeftSvg %}
|
|
105
|
-
{{ RadioButton({
|
|
106
|
-
name: params.name,
|
|
107
|
-
condensed: true,
|
|
108
|
-
disabled: params.disabled,
|
|
109
|
-
forcePx: params.forcePx,
|
|
110
|
-
buttons: [{ id: params.id, checked: params.selected, attributes: params.elementAttributes, classNames: params.elementClassNames }]
|
|
111
|
-
})}}
|
|
112
|
-
{% endset %}
|
|
113
|
-
{{ caller() if caller }}
|
|
114
|
-
</label>
|
|
115
101
|
{% elif element == 'switch' %}
|
|
116
102
|
<label class="{{ classes }}" for="{{ params.name }}" {{- attributes | safe }} >
|
|
117
103
|
{% set iconRightSvg %}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
@use "../icon-sprite/icon-sprite.scss";
|
|
3
3
|
@use "../checkbox/checkbox.scss" as *;
|
|
4
4
|
@use "../switch/switch.scss" as *;
|
|
5
|
-
@use "../radio-button/radio-button.scss" as *;
|
|
5
|
+
@use "../radio-button-group/radio-button-group.scss" as *;
|
|
6
6
|
@use "../button-toggle/button-toggle.scss" as *;
|
|
7
7
|
|
|
8
8
|
$ds-list-item__icon-size: 24px;
|
|
@@ -1,15 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
RadioButtonGroup
|
|
2
|
+
================
|
|
3
3
|
|
|
4
|
-
* GitHub: [BonnierNews/dn-design-system/web/src/components/radio-button](https://github.com/BonnierNews/dn-design-system/tree/main/web/src/components/radio-button)
|
|
5
|
-
* Storybook: [
|
|
4
|
+
* GitHub: [BonnierNews/dn-design-system/web/src/components/radio-button-group](https://github.com/BonnierNews/dn-design-system/tree/main/web/src/components/radio-button-group)
|
|
5
|
+
* Storybook: [RadioButtonGroup](https://designsystem.dn.se/?path=/docs/basic-form-radiobuttongroup--docs)
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
This component is used to render a group of radio buttons.
|
|
8
|
+
|
|
9
|
+
The component will not include styling by itself. Make sure to include the right styles for the component. See example below: `@use '@bonniernews/dn-design-system-web/components/radio-button-group/radio-button-group.scss`
|
|
8
10
|
|
|
9
11
|
| Name | Description | Default |
|
|
10
12
|
|:--- | :--- | :--- |
|
|
11
|
-
| buttons\* |
|
|
12
|
-
| id\* | string | \- |
|
|
13
|
+
| buttons\* | RadioButtonProps\[\] | \- |
|
|
13
14
|
| name | string | \- |
|
|
14
15
|
| error | boolean | \- |
|
|
15
16
|
| errorMessage | string | \- |
|
|
@@ -22,12 +23,18 @@ The component will not include styling by itself. Make sure to include the right
|
|
|
22
23
|
| attributes | Ex. { target: "\_blank", "data-test": "lorem ipsum" }<br />Record<string, unknown> | \- |
|
|
23
24
|
|
|
24
25
|
```jsx
|
|
25
|
-
<
|
|
26
|
+
<RadioButtonGroup
|
|
26
27
|
buttons={[
|
|
27
28
|
{
|
|
28
|
-
id: '
|
|
29
|
-
|
|
30
|
-
|
|
29
|
+
id: 'my_radio_name1',
|
|
30
|
+
label: 'My radio 1',
|
|
31
|
+
selected: true,
|
|
32
|
+
value: 'my_radio_value1'
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
id: 'my_radio_name2',
|
|
36
|
+
label: 'My radio 2',
|
|
37
|
+
value: 'my_radio_value2'
|
|
31
38
|
}
|
|
32
39
|
]}
|
|
33
40
|
name="my_radio_name"
|
package/components/{radio-button/radio-button.scss → radio-button-group/radio-button-group.scss}
RENAMED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
$ds-radio-btn__icon-size: 24px;
|
|
6
6
|
|
|
7
|
-
.ds-radio-btn {
|
|
7
|
+
.ds-radio-btn-group {
|
|
8
8
|
display: inline-flex;
|
|
9
9
|
flex-direction: column;
|
|
10
10
|
align-items: flex-start;
|
|
@@ -112,7 +112,7 @@ $ds-radio-btn__icon-size: 24px;
|
|
|
112
112
|
}
|
|
113
113
|
}
|
|
114
114
|
|
|
115
|
-
.ds-radio-btn input:disabled + .ds-radio-btn__inner {
|
|
115
|
+
.ds-radio-btn-group input:disabled + .ds-radio-btn__inner {
|
|
116
116
|
cursor: not-allowed;
|
|
117
117
|
.ds-radio-btn__icon {
|
|
118
118
|
color: $ds-color-text-primary-disabled;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ComponentChildren } from 'preact';
|
|
2
2
|
import type { DsIcon } from '@bonniernews/dn-design-system-web/types-lib/ds-icon.d.ts';
|
|
3
3
|
import { ButtonToggleStandardProps } from '../button/button-types';
|
|
4
|
-
import {
|
|
4
|
+
import type { RadioButtonProps } from '../radio-button-group/radio-button-group';
|
|
5
5
|
import { SwitchInnerProps } from '../switch/switch';
|
|
6
6
|
export interface ListItemSharedProps {
|
|
7
7
|
title?: string;
|
|
@@ -18,7 +18,7 @@ export interface ListItemSharedProps {
|
|
|
18
18
|
}
|
|
19
19
|
export interface ListItemBaseProps extends ListItemSharedProps {
|
|
20
20
|
listItemType: 'accordion' | 'checkbox' | 'radio' | 'switch' | 'image' | 'standard' | 'toggle';
|
|
21
|
-
radioButtons?:
|
|
21
|
+
radioButtons?: RadioButtonProps[];
|
|
22
22
|
href?: string;
|
|
23
23
|
leadingIcon?: DsIcon;
|
|
24
24
|
trailingIcon?: DsIcon;
|
|
@@ -264,54 +264,8 @@ var CheckboxIcons = ({ componentClassName }) => {
|
|
|
264
264
|
};
|
|
265
265
|
var checkbox_default = Checkbox;
|
|
266
266
|
|
|
267
|
-
// ../src/components/radio-button/radio-button.tsx
|
|
268
|
-
import { Fragment as Fragment2 } from "preact";
|
|
269
|
-
import { jsx as jsx8, jsxs as jsxs5 } from "preact/jsx-runtime";
|
|
270
|
-
var RadioButton = ({
|
|
271
|
-
buttons,
|
|
272
|
-
error,
|
|
273
|
-
name,
|
|
274
|
-
errorMessage,
|
|
275
|
-
required,
|
|
276
|
-
stripLabel,
|
|
277
|
-
disabled,
|
|
278
|
-
forcePx,
|
|
279
|
-
classNames
|
|
280
|
-
}) => {
|
|
281
|
-
const componentClassName = "ds-radio-btn";
|
|
282
|
-
const wrapperClasses = formatClassString([componentClassName, forcePx && "ds-force-px", classNames]);
|
|
283
|
-
return /* @__PURE__ */ jsx8(form_field_default, { error, errorMessage, wrapperClasses, children: buttons?.map((button) => {
|
|
284
|
-
const { id, selected, value, label, attributes } = button;
|
|
285
|
-
return /* @__PURE__ */ jsxs5(Fragment2, { children: [
|
|
286
|
-
/* @__PURE__ */ jsx8(
|
|
287
|
-
"input",
|
|
288
|
-
{
|
|
289
|
-
type: "radio",
|
|
290
|
-
id,
|
|
291
|
-
name,
|
|
292
|
-
defaultChecked: selected,
|
|
293
|
-
disabled,
|
|
294
|
-
required,
|
|
295
|
-
value,
|
|
296
|
-
...attributes
|
|
297
|
-
}
|
|
298
|
-
),
|
|
299
|
-
stripLabel ? /* @__PURE__ */ jsx8("div", { className: `${componentClassName}__inner`, children: /* @__PURE__ */ jsx8(RadioButtonIcons, { componentClassName }) }) : /* @__PURE__ */ jsxs5("label", { className: `${componentClassName}__inner`, htmlFor: id, children: [
|
|
300
|
-
/* @__PURE__ */ jsx8(RadioButtonIcons, { componentClassName }),
|
|
301
|
-
label && /* @__PURE__ */ jsx8("span", { className: `${componentClassName}__text`, children: label })
|
|
302
|
-
] })
|
|
303
|
-
] }, id);
|
|
304
|
-
}) });
|
|
305
|
-
};
|
|
306
|
-
var RadioButtonIcons = ({ componentClassName }) => {
|
|
307
|
-
return /* @__PURE__ */ jsxs5("span", { className: `${componentClassName}__icon`, children: [
|
|
308
|
-
/* @__PURE__ */ jsx8(IconUse, { iconName: "radio_button_unchecked" }),
|
|
309
|
-
/* @__PURE__ */ jsx8(IconUse, { iconName: "radio_button_checked" })
|
|
310
|
-
] });
|
|
311
|
-
};
|
|
312
|
-
|
|
313
267
|
// ../src/components/switch/switch.tsx
|
|
314
|
-
import { Fragment as
|
|
268
|
+
import { Fragment as Fragment2, jsx as jsx8, jsxs as jsxs5 } from "preact/jsx-runtime";
|
|
315
269
|
var Switch = ({
|
|
316
270
|
name = "ds-switch",
|
|
317
271
|
checked,
|
|
@@ -326,8 +280,8 @@ var Switch = ({
|
|
|
326
280
|
}) => {
|
|
327
281
|
const componentClassName = "ds-switch";
|
|
328
282
|
const classes = formatClassString([componentClassName, forcePx && "ds-force-px", classNames]);
|
|
329
|
-
return /* @__PURE__ */
|
|
330
|
-
/* @__PURE__ */
|
|
283
|
+
return /* @__PURE__ */ jsxs5("div", { className: classes, children: [
|
|
284
|
+
/* @__PURE__ */ jsx8(
|
|
331
285
|
"input",
|
|
332
286
|
{
|
|
333
287
|
type: "checkbox",
|
|
@@ -339,7 +293,7 @@ var Switch = ({
|
|
|
339
293
|
...attributes
|
|
340
294
|
}
|
|
341
295
|
),
|
|
342
|
-
stripLabel ? /* @__PURE__ */
|
|
296
|
+
stripLabel ? /* @__PURE__ */ jsx8("div", { className: `${componentClassName}__inner`, children: /* @__PURE__ */ jsx8(
|
|
343
297
|
SwitchInner,
|
|
344
298
|
{
|
|
345
299
|
...{
|
|
@@ -349,7 +303,7 @@ var Switch = ({
|
|
|
349
303
|
componentClassName
|
|
350
304
|
}
|
|
351
305
|
}
|
|
352
|
-
) }) : /* @__PURE__ */
|
|
306
|
+
) }) : /* @__PURE__ */ jsx8("label", { className: `${componentClassName}__inner`, tabIndex: 0, htmlFor: name, children: /* @__PURE__ */ jsx8(
|
|
353
307
|
SwitchInner,
|
|
354
308
|
{
|
|
355
309
|
...{
|
|
@@ -363,12 +317,58 @@ var Switch = ({
|
|
|
363
317
|
] });
|
|
364
318
|
};
|
|
365
319
|
var SwitchInner = ({ showMeta, metaOn, metaOff, componentClassName }) => {
|
|
366
|
-
return /* @__PURE__ */
|
|
367
|
-
showMeta && /* @__PURE__ */
|
|
368
|
-
/* @__PURE__ */
|
|
369
|
-
/* @__PURE__ */
|
|
320
|
+
return /* @__PURE__ */ jsxs5(Fragment2, { children: [
|
|
321
|
+
showMeta && /* @__PURE__ */ jsxs5("div", { className: `${componentClassName}__meta`, children: [
|
|
322
|
+
/* @__PURE__ */ jsx8("span", { className: `${componentClassName}__meta-on`, children: metaOn }),
|
|
323
|
+
/* @__PURE__ */ jsx8("span", { className: `${componentClassName}__meta-off`, children: metaOff })
|
|
370
324
|
] }),
|
|
371
|
-
/* @__PURE__ */
|
|
325
|
+
/* @__PURE__ */ jsx8("span", { className: `${componentClassName}__box`, children: /* @__PURE__ */ jsx8("span", { className: `${componentClassName}__knob` }) })
|
|
326
|
+
] });
|
|
327
|
+
};
|
|
328
|
+
|
|
329
|
+
// ../src/components/radio-button-group/radio-button-group.tsx
|
|
330
|
+
import { Fragment as Fragment3 } from "preact";
|
|
331
|
+
import { jsx as jsx9, jsxs as jsxs6 } from "preact/jsx-runtime";
|
|
332
|
+
var RadioButtonGroup = ({
|
|
333
|
+
buttons,
|
|
334
|
+
error,
|
|
335
|
+
name,
|
|
336
|
+
errorMessage,
|
|
337
|
+
required,
|
|
338
|
+
stripLabel,
|
|
339
|
+
disabled,
|
|
340
|
+
forcePx,
|
|
341
|
+
classNames
|
|
342
|
+
}) => {
|
|
343
|
+
const radioButtonClassName = "ds-radio-btn";
|
|
344
|
+
const wrapperClasses = formatClassString(["ds-radio-btn-group", forcePx && "ds-force-px", classNames]);
|
|
345
|
+
return /* @__PURE__ */ jsx9(form_field_default, { error, errorMessage, wrapperClasses, children: buttons?.map((button) => {
|
|
346
|
+
const { id, selected, value, label, attributes } = button;
|
|
347
|
+
return /* @__PURE__ */ jsxs6(Fragment3, { children: [
|
|
348
|
+
/* @__PURE__ */ jsx9(
|
|
349
|
+
"input",
|
|
350
|
+
{
|
|
351
|
+
type: "radio",
|
|
352
|
+
id,
|
|
353
|
+
name,
|
|
354
|
+
defaultChecked: selected,
|
|
355
|
+
disabled,
|
|
356
|
+
required,
|
|
357
|
+
value,
|
|
358
|
+
...attributes
|
|
359
|
+
}
|
|
360
|
+
),
|
|
361
|
+
stripLabel ? /* @__PURE__ */ jsx9("div", { className: `${radioButtonClassName}__inner`, children: /* @__PURE__ */ jsx9(RadioButtonIcons, { radioButtonClassName }) }) : /* @__PURE__ */ jsxs6("label", { className: `${radioButtonClassName}__inner`, htmlFor: id, children: [
|
|
362
|
+
/* @__PURE__ */ jsx9(RadioButtonIcons, { radioButtonClassName }),
|
|
363
|
+
label && /* @__PURE__ */ jsx9("span", { className: `${radioButtonClassName}__text`, children: label })
|
|
364
|
+
] })
|
|
365
|
+
] }, id);
|
|
366
|
+
}) });
|
|
367
|
+
};
|
|
368
|
+
var RadioButtonIcons = ({ radioButtonClassName }) => {
|
|
369
|
+
return /* @__PURE__ */ jsxs6("span", { className: `${radioButtonClassName}__icon`, children: [
|
|
370
|
+
/* @__PURE__ */ jsx9(IconUse, { iconName: "radio_button_unchecked" }),
|
|
371
|
+
/* @__PURE__ */ jsx9(IconUse, { iconName: "radio_button_checked" })
|
|
372
372
|
] });
|
|
373
373
|
};
|
|
374
374
|
|
|
@@ -473,7 +473,7 @@ var ListItemInner = ({
|
|
|
473
473
|
case "radio":
|
|
474
474
|
return /* @__PURE__ */ jsxs7("label", { className: classes, htmlFor: id, ...attributes, children: [
|
|
475
475
|
/* @__PURE__ */ jsx10(ListItemIconWrapper, { placement: "left", componentClassName, children: /* @__PURE__ */ jsx10(
|
|
476
|
-
|
|
476
|
+
RadioButtonGroup,
|
|
477
477
|
{
|
|
478
478
|
...{
|
|
479
479
|
id,
|