@bonniernews/dn-design-system-web 37.3.3 → 37.5.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 +79 -0
- package/components/correction-notice/README.md +23 -0
- package/components/correction-notice/correction-notice.scss +26 -0
- package/components/pill/README.md +10 -2
- package/components/pill/pill.scss +14 -0
- package/components/pill-group/README.md +48 -0
- package/components/pill-group/pill-group.scss +16 -0
- package/package.json +1 -1
- package/preact/components/correction-notice/correction-notice.d.ts +18 -0
- package/preact/components/correction-notice/correction-notice.js +204 -0
- package/preact/components/correction-notice/correction-notice.js.map +7 -0
- package/preact/components/pill/pill.d.ts +17 -4
- package/preact/components/pill/pill.js +17 -3
- package/preact/components/pill/pill.js.map +2 -2
- package/preact/components/pill-group/pill-group.d.ts +39 -0
- package/preact/components/pill-group/pill-group.js +97 -0
- package/preact/components/pill-group/pill-group.js.map +7 -0
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,85 @@ All changes to @bonniernews/dn-design-system-web will be documented in this file
|
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
7
|
+
## [37.5.0](https://github.com/BonnierNews/dn-design-system/compare/@bonniernews/dn-design-system-web@37.4.0...@bonniernews/dn-design-system-web@37.5.0) (2026-06-24)
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
### ⚠ BREAKING CHANGES
|
|
11
|
+
|
|
12
|
+
* delete old design tokens (#2066)
|
|
13
|
+
|
|
14
|
+
### Features
|
|
15
|
+
|
|
16
|
+
* add LAB Light and LAB Dark theme support ([#2059](https://github.com/BonnierNews/dn-design-system/issues/2059)) ([0c364fe](https://github.com/BonnierNews/dn-design-system/commit/0c364fe7775340033ddac34233ccf26049e4fee9))
|
|
17
|
+
* **app:** create useSpacing hook ([#2094](https://github.com/BonnierNews/dn-design-system/issues/2094)) ([665db36](https://github.com/BonnierNews/dn-design-system/commit/665db36efc9d4a3c8aed261db50674239a935b6e))
|
|
18
|
+
* **app:** getSpacingValue ([#2095](https://github.com/BonnierNews/dn-design-system/issues/2095)) ([33fd425](https://github.com/BonnierNews/dn-design-system/commit/33fd42537760d51acc4402927e47d475fefc455b))
|
|
19
|
+
* **web:** pill-group component ([#2083](https://github.com/BonnierNews/dn-design-system/issues/2083)) ([779f0c8](https://github.com/BonnierNews/dn-design-system/commit/779f0c8f5bf3282992e0bcbc2d001de45b2fd7c1))
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
### Bug Fixes
|
|
23
|
+
|
|
24
|
+
* **app:** add noImplicitAny to all tsconfigs ([#2087](https://github.com/BonnierNews/dn-design-system/issues/2087)) ([0ef38a6](https://github.com/BonnierNews/dn-design-system/commit/0ef38a6351e7d654e4261505d64fb367a05e221d))
|
|
25
|
+
* **app:** broken spacing in Flex ([#2086](https://github.com/BonnierNews/dn-design-system/issues/2086)) ([25afbed](https://github.com/BonnierNews/dn-design-system/commit/25afbed286f9e6d4915031825f71ba27a0a669b1))
|
|
26
|
+
* **app:** do not import all app typography styles ([#2088](https://github.com/BonnierNews/dn-design-system/issues/2088)) ([2b7be00](https://github.com/BonnierNews/dn-design-system/commit/2b7be003f69f235133087cbac0e4dfcd7ddd31d8))
|
|
27
|
+
* **app:** restore lineHeight in typography ([#2079](https://github.com/BonnierNews/dn-design-system/issues/2079)) ([30d52e7](https://github.com/BonnierNews/dn-design-system/commit/30d52e71a2516ed85b61c62e5d99b5889c2eb6d5))
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
### Maintenance
|
|
31
|
+
|
|
32
|
+
* **app:** import new Figma variables structure ([#2071](https://github.com/BonnierNews/dn-design-system/issues/2071)) ([687b786](https://github.com/BonnierNews/dn-design-system/commit/687b786711903b1a6925fcb69296498c6a4b64d8))
|
|
33
|
+
* **app:** new app lab colors ([#2096](https://github.com/BonnierNews/dn-design-system/issues/2096)) ([0367fbf](https://github.com/BonnierNews/dn-design-system/commit/0367fbf45dc308115bf8a7ae4105fdf50fd7f33b))
|
|
34
|
+
* **app:** remove unused eslint-config package ([#2060](https://github.com/BonnierNews/dn-design-system/issues/2060)) ([69dce5c](https://github.com/BonnierNews/dn-design-system/commit/69dce5ccf388dc494d9c1138f3dfaaeed8621718))
|
|
35
|
+
* **app:** support deep color objects in createDynamicColorsIOS ([#2078](https://github.com/BonnierNews/dn-design-system/issues/2078)) ([69fb3f3](https://github.com/BonnierNews/dn-design-system/commit/69fb3f3d9fea8693308bd4e2abe77c70e1c7967b))
|
|
36
|
+
* delete new-app-package script ([#2073](https://github.com/BonnierNews/dn-design-system/issues/2073)) ([aa75dd3](https://github.com/BonnierNews/dn-design-system/commit/aa75dd3add09423acb6fc1b20158863ca73bd2f5))
|
|
37
|
+
* delete old design tokens ([#2066](https://github.com/BonnierNews/dn-design-system/issues/2066)) ([376f090](https://github.com/BonnierNews/dn-design-system/commit/376f090e8bba55316d382b85f2fff1187dfe4bcf))
|
|
38
|
+
* latest figma import and sync variables ([#2089](https://github.com/BonnierNews/dn-design-system/issues/2089)) ([7c8a445](https://github.com/BonnierNews/dn-design-system/commit/7c8a445b9950eb306edbcb3e197bde5365f00a74))
|
|
39
|
+
* latest figma variables ([#2090](https://github.com/BonnierNews/dn-design-system/issues/2090)) ([7c3cc72](https://github.com/BonnierNews/dn-design-system/commit/7c3cc72b85bc07b98e838b46e067b38d0b029412))
|
|
40
|
+
* latest figma vars ([#2093](https://github.com/BonnierNews/dn-design-system/issues/2093)) ([fc9e159](https://github.com/BonnierNews/dn-design-system/commit/fc9e159e5362fb6f0b8fbf5b027eaa2d2c78e200))
|
|
41
|
+
* prerelease packages ([07e4798](https://github.com/BonnierNews/dn-design-system/commit/07e4798a8b2b9a994d7a447f3ee1364b2a1ff5ca))
|
|
42
|
+
* prerelease packages ([719350a](https://github.com/BonnierNews/dn-design-system/commit/719350a1a60d8431bb60058291871564444177c8))
|
|
43
|
+
* prerelease packages ([238637d](https://github.com/BonnierNews/dn-design-system/commit/238637d8805cba09bd7612e8d386603af22bd3cf))
|
|
44
|
+
* prerelease packages ([11cf788](https://github.com/BonnierNews/dn-design-system/commit/11cf7887ff7c6bdc09d7a659e32bf6b4c9935c9b))
|
|
45
|
+
* prerelease packages ([9d35284](https://github.com/BonnierNews/dn-design-system/commit/9d35284d77cf1a97dfc14f826311bd91b4be2aa1))
|
|
46
|
+
* prerelease packages ([04869e0](https://github.com/BonnierNews/dn-design-system/commit/04869e0e5423b0b1dab5ce058443d0cf1a9a863d))
|
|
47
|
+
* prerelease packages ([6df7927](https://github.com/BonnierNews/dn-design-system/commit/6df792777fe3ead7540ece2185e22b908ff8c04d))
|
|
48
|
+
* prerelease packages ([62f0e70](https://github.com/BonnierNews/dn-design-system/commit/62f0e70bc912758fa4318f1cd4bf3c0baa755f9e))
|
|
49
|
+
* prerelease packages ([a851630](https://github.com/BonnierNews/dn-design-system/commit/a851630612ad3e2af497251a0d758794b10c3408))
|
|
50
|
+
* prerelease packages ([308fb9b](https://github.com/BonnierNews/dn-design-system/commit/308fb9bb30f5a424eabe328379aa8a3df7a6daf9))
|
|
51
|
+
* prerelease packages ([688f203](https://github.com/BonnierNews/dn-design-system/commit/688f203156f0dbff4afb3c2042ad1059f718c6af))
|
|
52
|
+
* prerelease packages ([c133147](https://github.com/BonnierNews/dn-design-system/commit/c133147bde647c743a8065687e46cc18ffb8f2ca))
|
|
53
|
+
* prerelease packages ([2b9fe93](https://github.com/BonnierNews/dn-design-system/commit/2b9fe935d0306e10247b35a41c03f0462f61be8a))
|
|
54
|
+
* prerelease packages ([41b079d](https://github.com/BonnierNews/dn-design-system/commit/41b079d2898fbc57e064e019951581f409aa1a55))
|
|
55
|
+
* prerelease packages ([cc315db](https://github.com/BonnierNews/dn-design-system/commit/cc315dba970f052af542b975fd9916563f15df81))
|
|
56
|
+
* prerelease packages ([27a1ff6](https://github.com/BonnierNews/dn-design-system/commit/27a1ff61a26e50bc4f7c01851752db5e62b6474c))
|
|
57
|
+
* prerelease packages ([2f340a7](https://github.com/BonnierNews/dn-design-system/commit/2f340a791293d2535d4c71695fe7c4aceeaaf1ef))
|
|
58
|
+
* prerelease packages ([42f3f7f](https://github.com/BonnierNews/dn-design-system/commit/42f3f7fcc19c7a2e5d88c10ec9e987180cfaabde))
|
|
59
|
+
* prerelease packages ([1e5a7be](https://github.com/BonnierNews/dn-design-system/commit/1e5a7bef476b6e800df82a287bbb680a5d7a808a))
|
|
60
|
+
* prerelease packages ([859ea38](https://github.com/BonnierNews/dn-design-system/commit/859ea38581704387e49180c663b928aba4e6674f))
|
|
61
|
+
* sync figma variables ([#2081](https://github.com/BonnierNews/dn-design-system/issues/2081)) ([fc4a658](https://github.com/BonnierNews/dn-design-system/commit/fc4a658080fd325a1c9d094a32064962fa9e02fe))
|
|
62
|
+
* sync figma variables ([#2085](https://github.com/BonnierNews/dn-design-system/issues/2085)) ([c143232](https://github.com/BonnierNews/dn-design-system/commit/c1432326cf3f291797c868ff48312d80bc255a51))
|
|
63
|
+
* sync figma variables ([#2092](https://github.com/BonnierNews/dn-design-system/issues/2092)) ([17b09e2](https://github.com/BonnierNews/dn-design-system/commit/17b09e282924f33d3d9d8fb591b9c63cfa57a4ef))
|
|
64
|
+
* sync figma variables v2 ([#2084](https://github.com/BonnierNews/dn-design-system/issues/2084)) ([1da384f](https://github.com/BonnierNews/dn-design-system/commit/1da384f278696bbed133ed9d528d3c04b719cd79))
|
|
65
|
+
* update new variables ([#2080](https://github.com/BonnierNews/dn-design-system/issues/2080)) ([53e7335](https://github.com/BonnierNews/dn-design-system/commit/53e7335465be8a989198bc1c7de1c51fbc702112))
|
|
66
|
+
|
|
67
|
+
## [37.4.0](https://github.com/BonnierNews/dn-design-system/compare/@bonniernews/dn-design-system-web@37.3.3...@bonniernews/dn-design-system-web@37.4.0) (2026-04-29)
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
### Features
|
|
71
|
+
|
|
72
|
+
* **web:** correction notice ([#2058](https://github.com/BonnierNews/dn-design-system/issues/2058)) ([996a10e](https://github.com/BonnierNews/dn-design-system/commit/996a10e97b9561d2e03614068dbfa53c6ec51a9b))
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
### Bug Fixes
|
|
76
|
+
|
|
77
|
+
* **app:** download puppeteer Chromium if postinstall was skipped ([#2055](https://github.com/BonnierNews/dn-design-system/issues/2055)) ([62a4c4e](https://github.com/BonnierNews/dn-design-system/commit/62a4c4eefe2b80b5aa7bc583e2d7f884ba3812c5))
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
### Maintenance
|
|
81
|
+
|
|
82
|
+
* **deps:** bump the npm_and_yarn group across 3 directories with 8 updates ([#2047](https://github.com/BonnierNews/dn-design-system/issues/2047)) ([682c3c5](https://github.com/BonnierNews/dn-design-system/commit/682c3c5f543ba3fa52c341c340e694100f3f500b))
|
|
83
|
+
* **deps:** bump undici from 6.23.0 to 6.24.1 in the npm_and_yarn group across 1 directory ([#2034](https://github.com/BonnierNews/dn-design-system/issues/2034)) ([f0347dd](https://github.com/BonnierNews/dn-design-system/commit/f0347ddf2af34600b678294d1778de326d3d27b1))
|
|
84
|
+
* migrate axios to native fetch ([#2052](https://github.com/BonnierNews/dn-design-system/issues/2052)) ([6261b8d](https://github.com/BonnierNews/dn-design-system/commit/6261b8d1eec51c77b2c98ca4878bb1237bb2e1ae))
|
|
85
|
+
|
|
7
86
|
## [37.3.3](https://github.com/BonnierNews/dn-design-system/compare/@bonniernews/dn-design-system-web@37.3.2...@bonniernews/dn-design-system-web@37.3.3) (2026-04-16)
|
|
8
87
|
|
|
9
88
|
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
CorrectionNotice
|
|
2
|
+
================
|
|
3
|
+
|
|
4
|
+
* GitHub: [BonnierNews/dn-design-system/web/src/components/correction-notice](https://github.com/BonnierNews/dn-design-system/tree/main/web/src/components/correction-notice)
|
|
5
|
+
* Storybook: [CorrectionNotice](https://designsystem.dn.se/?path=/docs/basic-correctionnotice--docs)
|
|
6
|
+
|
|
7
|
+
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/correction-notice/correction-notice.scss'`
|
|
8
|
+
|
|
9
|
+
| Name | Description | Default |
|
|
10
|
+
|:--- | :--- | :--- |
|
|
11
|
+
| text\* | Text displayed to the left, e.g. "Har du upptäckt ett fel?"<br />string | \- |
|
|
12
|
+
| buttonText\* | Button label, e.g. "Kontakta DN"<br />string | \- |
|
|
13
|
+
| href\* | URL for the button (typically a mailto: link)<br />string | \- |
|
|
14
|
+
| classNames | Ex. "my-special-class"<br />string | \- |
|
|
15
|
+
| attributes | Ex. { target: "\_blank", "data-test": "lorem ipsum" }<br />Record<string, unknown> | \- |
|
|
16
|
+
|
|
17
|
+
```jsx
|
|
18
|
+
<CorrectionNotice
|
|
19
|
+
buttonText="Kontakta DN"
|
|
20
|
+
href="mailto:ratta@dn.se?subject=R%C3%A4ttelse"
|
|
21
|
+
text="Har du upptäckt ett fel?"
|
|
22
|
+
/>
|
|
23
|
+
```
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
@use "../../foundations/helpers/forward.helpers.scss" as *;
|
|
2
|
+
@use "../button/button.scss";
|
|
3
|
+
|
|
4
|
+
.ds-correction-notice {
|
|
5
|
+
padding: ds-spacing(0 0 $ds-s-200);
|
|
6
|
+
|
|
7
|
+
.ds-correction-notice__inner {
|
|
8
|
+
display: flex;
|
|
9
|
+
align-items: center;
|
|
10
|
+
justify-content: space-between;
|
|
11
|
+
gap: ds-spacing($ds-s-100);
|
|
12
|
+
padding: ds-spacing($ds-s-100);
|
|
13
|
+
background-color: $ds-color-surface-highlight;
|
|
14
|
+
border-radius: ds-border-radius(050);
|
|
15
|
+
|
|
16
|
+
.ds-correction-notice__text {
|
|
17
|
+
@include ds-typography($ds-typography-functional-body-sm) {
|
|
18
|
+
color: $ds-color-text-primary;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.ds-btn {
|
|
23
|
+
flex-shrink: 0;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
@@ -6,14 +6,22 @@ Pill
|
|
|
6
6
|
|
|
7
7
|
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/pill/pill.scss'`
|
|
8
8
|
|
|
9
|
+
Two variants available:
|
|
10
|
+
|
|
11
|
+
* `link` — used for navigation, supports `selected` state and has an optional arrow icon
|
|
12
|
+
* `button` — used as a toggleable button, supports `selected` state
|
|
13
|
+
|
|
9
14
|
| Name | Description | Default |
|
|
10
15
|
|:--- | :--- | :--- |
|
|
16
|
+
| variant | "link", "button" | "link" |
|
|
17
|
+
| href\* | string | \- |
|
|
18
|
+
| showIcon | boolean | \- |
|
|
11
19
|
| text\* | string | \- |
|
|
12
|
-
| variant | "link" | link |
|
|
13
20
|
| size | "sm", "lg" | "lg" |
|
|
14
|
-
|
|
|
21
|
+
| selected | boolean | false |
|
|
15
22
|
| classNames | Ex. "my-special-class"<br />string | \- |
|
|
16
23
|
| attributes | Ex. { target: "\_blank", "data-test": "lorem ipsum" }<br />Record<string, unknown> | { } |
|
|
24
|
+
| onClick | () => void | \- |
|
|
17
25
|
|
|
18
26
|
```jsx
|
|
19
27
|
<Pill
|
|
@@ -45,6 +45,20 @@ $ds-pill-outlined__border-width: ds-border-width(xxs);
|
|
|
45
45
|
opacity: $ds-opacity-component-hover-pressed;
|
|
46
46
|
}
|
|
47
47
|
}
|
|
48
|
+
|
|
49
|
+
&.ds-pill--selected {
|
|
50
|
+
background-color: $ds-color-surface-brand;
|
|
51
|
+
border-color: $ds-color-surface-brand;
|
|
52
|
+
color: $ds-color-surface-primary;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
&.ds-pill--button.ds-pill--lg {
|
|
56
|
+
padding: ds-spacing($ds-s-050, rem) ds-spacing($ds-s-100, rem);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
&.ds-pill--button.ds-pill--sm {
|
|
60
|
+
padding: ds-spacing($ds-s-050, rem) ds-spacing($ds-s-100, rem);
|
|
61
|
+
}
|
|
48
62
|
}
|
|
49
63
|
|
|
50
64
|
.ds-pill--link {
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
PillGroup
|
|
2
|
+
=========
|
|
3
|
+
|
|
4
|
+
* GitHub: [BonnierNews/dn-design-system/web/src/components/pill-group](https://github.com/BonnierNews/dn-design-system/tree/main/web/src/components/pill-group)
|
|
5
|
+
* Storybook: [PillGroup](https://designsystem.dn.se/?path=/docs/basic-pillgroup--docs)
|
|
6
|
+
|
|
7
|
+
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/pill-group/pill-group.scss'`
|
|
8
|
+
|
|
9
|
+
A group of multi-select pills. Two variants:
|
|
10
|
+
|
|
11
|
+
* `multi-select` — multiple pills can be active at once (checkbox behaviour)
|
|
12
|
+
* `single-select` — only one pill can be active at a time (radio behaviour)
|
|
13
|
+
|
|
14
|
+
The component is stateless — selection state and `onClick` handlers are managed by the consumer.
|
|
15
|
+
|
|
16
|
+
| Name | Description | Default |
|
|
17
|
+
|:--- | :--- | :--- |
|
|
18
|
+
| variant\* | "multi-select", "single-select" | \- |
|
|
19
|
+
| items\* | PillGroupItem\[\] | PillGroupSingleSelectItem\[\] | \- |
|
|
20
|
+
| size | "sm", "lg" | "lg" |
|
|
21
|
+
| label\* | string | \- |
|
|
22
|
+
| classNames | Ex. "my-special-class"<br />string | \- |
|
|
23
|
+
| attributes | Ex. { target: "\_blank", "data-test": "lorem ipsum" }<br />Record<string, unknown> | { } |
|
|
24
|
+
|
|
25
|
+
```jsx
|
|
26
|
+
<PillGroup
|
|
27
|
+
items={[
|
|
28
|
+
{
|
|
29
|
+
text: 'Sport',
|
|
30
|
+
value: 'sport'
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
text: 'Kultur',
|
|
34
|
+
value: 'kultur'
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
text: 'Ekonomi',
|
|
38
|
+
value: 'ekonomi'
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
text: 'Utrikes',
|
|
42
|
+
value: 'utrikes'
|
|
43
|
+
}
|
|
44
|
+
]}
|
|
45
|
+
label="Filtrera efter ämne"
|
|
46
|
+
variant="multi-select"
|
|
47
|
+
/>
|
|
48
|
+
```
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
@use "../../foundations/helpers/forward.helpers.scss" as *;
|
|
2
|
+
@use "../pill/pill.scss";
|
|
3
|
+
|
|
4
|
+
.ds-pill-group {
|
|
5
|
+
display: flex;
|
|
6
|
+
flex-wrap: wrap;
|
|
7
|
+
gap: ds-spacing($ds-s-050);
|
|
8
|
+
|
|
9
|
+
.ds-pill.ds-pill--sm {
|
|
10
|
+
padding: ds-spacing($ds-s-025, rem) ds-spacing($ds-s-050, rem);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.ds-pill.ds-pill--lg {
|
|
14
|
+
padding: ds-spacing($ds-s-050, rem) ds-spacing($ds-s-100, rem);
|
|
15
|
+
}
|
|
16
|
+
}
|
package/package.json
CHANGED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { SharedProps } from '@bonniernews/dn-design-system-web/assets/types/shared-props.ts';
|
|
2
|
+
export interface CorrectionNoticeProps extends SharedProps {
|
|
3
|
+
/** Text displayed to the left, e.g. "Har du upptäckt ett fel?" */
|
|
4
|
+
text: string;
|
|
5
|
+
/** Button label, e.g. "Kontakta DN" */
|
|
6
|
+
buttonText: string;
|
|
7
|
+
/** URL for the button (typically a mailto: link) */
|
|
8
|
+
href: string;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* - GitHub: [BonnierNews/dn-design-system/web/src/components/correction-notice](https://github.com/BonnierNews/dn-design-system/tree/main/web/src/components/correction-notice)
|
|
12
|
+
* - Storybook: [CorrectionNotice](https://designsystem.dn.se/?path=/docs/basic-correctionnotice--docs)
|
|
13
|
+
*
|
|
14
|
+
* The component will not include styling by itself. Make sure to include the right styles for the component. See example below:
|
|
15
|
+
* `@use '@bonniernews/dn-design-system-web/components/correction-notice/correction-notice.scss'`
|
|
16
|
+
*/
|
|
17
|
+
export declare const CorrectionNotice: ({ text, buttonText, href, classNames, attributes }: CorrectionNoticeProps) => import("preact").JSX.Element;
|
|
18
|
+
export default CorrectionNotice;
|
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
// ../src/helpers/formatClassString.ts
|
|
2
|
+
var formatClassString = (classesArray) => {
|
|
3
|
+
return classesArray.filter((x) => !!x).join(" ");
|
|
4
|
+
};
|
|
5
|
+
|
|
6
|
+
// ../src/foundations/icons/sprite.svg
|
|
7
|
+
import { h } from "preact";
|
|
8
|
+
import { jsx, jsxs } from "preact/jsx-runtime";
|
|
9
|
+
|
|
10
|
+
// ../src/components/icon-sprite/icon-sprite.tsx
|
|
11
|
+
import { jsx as jsx2 } from "preact/jsx-runtime";
|
|
12
|
+
var IconUse = ({ iconName, classNames, attributes }) => {
|
|
13
|
+
const componentClassName = "ds-icon";
|
|
14
|
+
const classes = formatClassString([
|
|
15
|
+
componentClassName,
|
|
16
|
+
`${componentClassName}--sprite`,
|
|
17
|
+
`${componentClassName}--${iconName}`,
|
|
18
|
+
classNames
|
|
19
|
+
]);
|
|
20
|
+
return /* @__PURE__ */ jsx2("i", { className: classes, ...attributes, children: /* @__PURE__ */ jsx2("svg", { children: /* @__PURE__ */ jsx2("use", { xlinkHref: `#ds-${iconName}` }) }) });
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
// ../src/components/spinner/spinner.tsx
|
|
24
|
+
import { jsx as jsx3 } from "preact/jsx-runtime";
|
|
25
|
+
var Spinner = ({ variant = "primary", size = "large", forcePx, classNames, attributes }) => {
|
|
26
|
+
const componentClassName = "ds-spinner";
|
|
27
|
+
const classes = formatClassString([
|
|
28
|
+
`${componentClassName}`,
|
|
29
|
+
`${componentClassName}--${variant}`,
|
|
30
|
+
`${componentClassName}--${size}`,
|
|
31
|
+
forcePx && "ds-force-px",
|
|
32
|
+
classNames
|
|
33
|
+
]);
|
|
34
|
+
return /* @__PURE__ */ jsx3("span", { className: classes, ...attributes, children: /* @__PURE__ */ jsx3("span", { className: `${componentClassName}__inner` }) });
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
// ../src/components/button/button-base.tsx
|
|
38
|
+
import { Fragment, jsx as jsx4, jsxs as jsxs2 } from "preact/jsx-runtime";
|
|
39
|
+
var InnerButton = ({ text, isIconButton = false, attributes, icon, loadingHtml }) => {
|
|
40
|
+
let optionalHtml;
|
|
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 });
|
|
45
|
+
}
|
|
46
|
+
return /* @__PURE__ */ jsxs2(Fragment, { children: [
|
|
47
|
+
optionalHtml,
|
|
48
|
+
icon,
|
|
49
|
+
loadingHtml
|
|
50
|
+
] });
|
|
51
|
+
};
|
|
52
|
+
var ToggleWrapper = ({
|
|
53
|
+
selected = false,
|
|
54
|
+
disabled = false,
|
|
55
|
+
attributes,
|
|
56
|
+
classes,
|
|
57
|
+
onChild,
|
|
58
|
+
offChild,
|
|
59
|
+
loadingHtml
|
|
60
|
+
}) => {
|
|
61
|
+
return /* @__PURE__ */ jsxs2("button", { type: "button", role: "switch", "aria-checked": selected, className: classes, ...attributes, disabled, children: [
|
|
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 }),
|
|
64
|
+
loadingHtml
|
|
65
|
+
] });
|
|
66
|
+
};
|
|
67
|
+
var ButtonBase = ({
|
|
68
|
+
text,
|
|
69
|
+
disabled = false,
|
|
70
|
+
variant = "primary",
|
|
71
|
+
size = "md",
|
|
72
|
+
fullWidth = false,
|
|
73
|
+
mobileFullWidth = false,
|
|
74
|
+
iconPosition = "none",
|
|
75
|
+
iconName,
|
|
76
|
+
loading = false,
|
|
77
|
+
type = "button",
|
|
78
|
+
href,
|
|
79
|
+
classNames,
|
|
80
|
+
attributes = {},
|
|
81
|
+
forcePx = false,
|
|
82
|
+
isIconButton = false,
|
|
83
|
+
selected = false,
|
|
84
|
+
isToggle = false,
|
|
85
|
+
selectedIconName,
|
|
86
|
+
selectedText
|
|
87
|
+
}) => {
|
|
88
|
+
if (isIconButton && text && !attributes["aria-label"]) {
|
|
89
|
+
attributes["aria-label"] = text;
|
|
90
|
+
} else if (isToggle && text && selectedText && !attributes["aria-label"]) {
|
|
91
|
+
attributes["aria-label"] = selected ? selectedText : text;
|
|
92
|
+
}
|
|
93
|
+
let spinnerVariant = "secondary";
|
|
94
|
+
if (variant === "staticWhite" || variant === "transparent") {
|
|
95
|
+
spinnerVariant = "staticBlack";
|
|
96
|
+
} else if (variant === "secondaryFilled" || variant === "secondaryOutline") {
|
|
97
|
+
spinnerVariant = "primary";
|
|
98
|
+
}
|
|
99
|
+
const loadingHtml = /* @__PURE__ */ jsx4(Spinner, { ...{ size: "small", variant: spinnerVariant, forcePx, attributes: { "aria-hidden": "true" } } });
|
|
100
|
+
let icon;
|
|
101
|
+
if (iconName && (iconPosition != "none" || isIconButton == true)) {
|
|
102
|
+
icon = /* @__PURE__ */ jsx4(IconUse, { ...{ iconName, attributes: { "aria-hidden": "true" } } });
|
|
103
|
+
}
|
|
104
|
+
const classNamePrefix = "ds-btn--";
|
|
105
|
+
const classes = formatClassString([
|
|
106
|
+
"ds-btn",
|
|
107
|
+
`${classNamePrefix}${variant}`,
|
|
108
|
+
`${classNamePrefix}${size}`,
|
|
109
|
+
isToggle && selected && `${classNamePrefix}selected`,
|
|
110
|
+
fullWidth && `${classNamePrefix}full-width`,
|
|
111
|
+
mobileFullWidth && `${classNamePrefix}mobile-full-width`,
|
|
112
|
+
icon && !isIconButton && `${classNamePrefix}icon-${iconPosition}`,
|
|
113
|
+
isIconButton && `${classNamePrefix}icon-only`,
|
|
114
|
+
isToggle && `${classNamePrefix}toggle`,
|
|
115
|
+
loading && "ds-loading",
|
|
116
|
+
forcePx && "ds-force-px",
|
|
117
|
+
classNames
|
|
118
|
+
]);
|
|
119
|
+
let buttonToRender;
|
|
120
|
+
if (isToggle) {
|
|
121
|
+
let onChild, offChild;
|
|
122
|
+
if (isIconButton && iconName && selectedIconName) {
|
|
123
|
+
onChild = /* @__PURE__ */ jsx4(IconUse, { iconName });
|
|
124
|
+
offChild = /* @__PURE__ */ jsx4(IconUse, { iconName: selectedIconName });
|
|
125
|
+
} else {
|
|
126
|
+
onChild = /* @__PURE__ */ jsx4("span", { children: text });
|
|
127
|
+
offChild = /* @__PURE__ */ jsxs2(Fragment, { children: [
|
|
128
|
+
/* @__PURE__ */ jsx4(IconUse, { iconName: "check" }),
|
|
129
|
+
/* @__PURE__ */ jsx4("span", { children: selectedText })
|
|
130
|
+
] });
|
|
131
|
+
}
|
|
132
|
+
buttonToRender = /* @__PURE__ */ jsx4(ToggleWrapper, { ...{ selected, classes, attributes, disabled, onChild, offChild, loadingHtml } });
|
|
133
|
+
} else {
|
|
134
|
+
const buttonParams = { isIconButton, text, icon, loadingHtml, attributes };
|
|
135
|
+
if (href) {
|
|
136
|
+
const params = { ...buttonParams, loadingHtml: null };
|
|
137
|
+
buttonToRender = /* @__PURE__ */ jsx4("a", { href, className: classes, ...attributes, children: /* @__PURE__ */ jsx4(InnerButton, { ...params }) });
|
|
138
|
+
} else {
|
|
139
|
+
buttonToRender = /* @__PURE__ */ jsx4("button", { type, className: classes, ...attributes, disabled, children: /* @__PURE__ */ jsx4(InnerButton, { ...buttonParams }) });
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
return /* @__PURE__ */ jsx4(Fragment, { children: buttonToRender });
|
|
143
|
+
};
|
|
144
|
+
|
|
145
|
+
// ../src/components/button/button.tsx
|
|
146
|
+
import { jsx as jsx5 } from "preact/jsx-runtime";
|
|
147
|
+
var Button = ({
|
|
148
|
+
text,
|
|
149
|
+
disabled = false,
|
|
150
|
+
variant = "primary",
|
|
151
|
+
size = "md",
|
|
152
|
+
fullWidth = false,
|
|
153
|
+
mobileFullWidth = false,
|
|
154
|
+
iconPosition = "none",
|
|
155
|
+
iconName,
|
|
156
|
+
loading = false,
|
|
157
|
+
type = "button",
|
|
158
|
+
href,
|
|
159
|
+
isIconButton = false,
|
|
160
|
+
classNames,
|
|
161
|
+
attributes,
|
|
162
|
+
forcePx = false
|
|
163
|
+
}) => {
|
|
164
|
+
return /* @__PURE__ */ jsx5(
|
|
165
|
+
ButtonBase,
|
|
166
|
+
{
|
|
167
|
+
...{
|
|
168
|
+
text,
|
|
169
|
+
disabled,
|
|
170
|
+
variant,
|
|
171
|
+
size,
|
|
172
|
+
fullWidth,
|
|
173
|
+
mobileFullWidth,
|
|
174
|
+
iconPosition,
|
|
175
|
+
iconName,
|
|
176
|
+
loading,
|
|
177
|
+
type,
|
|
178
|
+
href,
|
|
179
|
+
isIconButton,
|
|
180
|
+
classNames,
|
|
181
|
+
attributes,
|
|
182
|
+
forcePx
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
);
|
|
186
|
+
};
|
|
187
|
+
var button_default = Button;
|
|
188
|
+
|
|
189
|
+
// ../src/components/correction-notice/correction-notice.tsx
|
|
190
|
+
import { jsx as jsx6, jsxs as jsxs3 } from "preact/jsx-runtime";
|
|
191
|
+
var CorrectionNotice = ({ text, buttonText, href, classNames, attributes }) => {
|
|
192
|
+
const componentClassName = "ds-correction-notice";
|
|
193
|
+
const classes = formatClassString([componentClassName, classNames]);
|
|
194
|
+
return /* @__PURE__ */ jsx6("div", { className: classes, ...attributes, children: /* @__PURE__ */ jsxs3("div", { className: `${componentClassName}__inner`, children: [
|
|
195
|
+
/* @__PURE__ */ jsx6("span", { className: `${componentClassName}__text`, children: text }),
|
|
196
|
+
/* @__PURE__ */ jsx6(button_default, { text: buttonText, variant: "primaryBlack", href, size: "sm" })
|
|
197
|
+
] }) });
|
|
198
|
+
};
|
|
199
|
+
var correction_notice_default = CorrectionNotice;
|
|
200
|
+
export {
|
|
201
|
+
CorrectionNotice,
|
|
202
|
+
correction_notice_default as default
|
|
203
|
+
};
|
|
204
|
+
//# sourceMappingURL=correction-notice.js.map
|