@helsenorge/designsystem-react 12.7.0 → 12.9.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/AsChildSlot.js +74 -0
- package/AsChildSlot.js.map +1 -0
- package/CHANGELOG.md +48 -5
- package/Drawer.js +58 -4
- package/Drawer.js.map +1 -1
- package/HN.Designsystem.Dropdown.nb-NO.js +13 -0
- package/HN.Designsystem.Dropdown.nb-NO.js.map +1 -0
- package/HelpDetails.js +1 -1
- package/LinkList.js +1 -0
- package/LinkList.js.map +1 -1
- package/Panel.js +0 -1
- package/Panel.js.map +1 -1
- package/SingleSelectItem.js +96 -0
- package/SingleSelectItem.js.map +1 -0
- package/clamp.js +11 -0
- package/clamp.js.map +1 -0
- package/components/ArticleTeaser/styles.module.scss +3 -5
- package/components/AsChildSlot/AsChildSlot.d.ts +23 -0
- package/components/AsChildSlot/AsChildSlot.test.d.ts +1 -0
- package/components/AsChildSlot/index.d.ts +3 -0
- package/components/AsChildSlot/index.js +6 -0
- package/components/AsChildSlot/index.js.map +1 -0
- package/components/AsChildSlot/styles.module.scss +13 -0
- package/components/AsChildSlot/styles.module.scss.d.ts +9 -0
- package/components/Drawer/styles.module.scss +45 -26
- package/components/Drawer/styles.module.scss.d.ts +5 -0
- package/components/Dropdown/Dropdown.d.ts +19 -21
- package/components/Dropdown/Dropdown.test.d.ts +1 -0
- package/components/Dropdown/SingleSelect/SingleSelect.d.ts +18 -0
- package/components/Dropdown/SingleSelect/SingleSelect.test.d.ts +1 -0
- package/components/Dropdown/SingleSelect/SingleSelectItem.d.ts +21 -0
- package/components/Dropdown/SingleSelect/index.d.ts +3 -0
- package/components/Dropdown/SingleSelect/index.js +6 -0
- package/components/Dropdown/SingleSelect/index.js.map +1 -0
- package/components/Dropdown/SingleSelect/styles.module.scss +54 -0
- package/components/Dropdown/SingleSelect/styles.module.scss.d.ts +14 -0
- package/components/Dropdown/index.js +143 -78
- package/components/Dropdown/index.js.map +1 -1
- package/components/Dropdown/styles.module.scss +90 -136
- package/components/Dropdown/styles.module.scss.d.ts +8 -9
- package/components/DropdownOld/DropdownOld.d.ts +42 -0
- package/components/DropdownOld/index.d.ts +3 -0
- package/components/DropdownOld/index.js +194 -0
- package/components/DropdownOld/index.js.map +1 -0
- package/components/DropdownOld/resourceHelper.d.ts +3 -0
- package/components/DropdownOld/styles.module.scss +230 -0
- package/components/DropdownOld/styles.module.scss.d.ts +25 -0
- package/components/Icons/EmoticonAnnoyed.js +8 -11
- package/components/Icons/EmoticonAnnoyed.js.map +1 -1
- package/components/Icons/EmoticonDelighted.js +8 -4
- package/components/Icons/EmoticonDelighted.js.map +1 -1
- package/components/Icons/EmoticonDisappointed.js +8 -4
- package/components/Icons/EmoticonDisappointed.js.map +1 -1
- package/components/Icons/EmoticonHappy.js +8 -4
- package/components/Icons/EmoticonHappy.js.map +1 -1
- package/components/Icons/EmoticonMeh.js +8 -4
- package/components/Icons/EmoticonMeh.js.map +1 -1
- package/components/LinkList/styles.module.scss +47 -61
- package/components/LinkList/styles.module.scss.d.ts +1 -0
- package/components/ListEditMode/styles.module.scss +1 -0
- package/components/NotificationPanel/index.js +3 -1
- package/components/NotificationPanel/index.js.map +1 -1
- package/components/NotificationPanel/styles.module.scss +10 -5
- package/components/Panel/Panel.d.ts +1 -1
- package/designsystem-react.css +10 -0
- package/index.d.ts +1 -0
- package/index.js +2 -0
- package/index.js.map +1 -1
- package/package.json +1 -1
- package/scss/supernova/styles/colors.css +10 -0
- package/use-animate.js +1 -7
- package/use-animate.js.map +1 -1
- /package/{resources/index.d.ts → components/DropdownOld/DropdownOld.test.d.ts} +0 -0
|
@@ -15,70 +15,56 @@
|
|
|
15
15
|
|
|
16
16
|
&--outline {
|
|
17
17
|
&--neutral {
|
|
18
|
-
border: 1px solid var(--
|
|
18
|
+
border: 1px solid var(--component-listelements-border-neutral-normal);
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
&--blueberry {
|
|
22
|
-
border: 1px solid var(--
|
|
22
|
+
border: 1px solid var(--component-listelements-border-blueberry-normal);
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
&--cherry {
|
|
26
|
-
border: 1px solid var(--
|
|
26
|
+
border: 1px solid var(--component-listelements-border-cherry-normal);
|
|
27
27
|
}
|
|
28
28
|
|
|
29
29
|
&--white {
|
|
30
|
-
border: 1px solid var(--
|
|
30
|
+
border: 1px solid var(--component-listelements-border-neutral-normal);
|
|
31
31
|
}
|
|
32
32
|
}
|
|
33
33
|
|
|
34
34
|
&__list-item {
|
|
35
35
|
&--line {
|
|
36
|
-
border-bottom: 1px solid var(--
|
|
36
|
+
border-bottom: 1px solid var(--component-listelements-border-neutral-normal);
|
|
37
37
|
|
|
38
38
|
&:first-of-type {
|
|
39
|
-
border-top: 1px solid var(--
|
|
39
|
+
border-top: 1px solid var(--component-listelements-border-neutral-normal);
|
|
40
40
|
}
|
|
41
41
|
}
|
|
42
42
|
|
|
43
43
|
&--outline {
|
|
44
|
-
|
|
45
|
-
border-top: spacers.getSpacer(2xs) var(--core-color-neutral-100) solid;
|
|
46
|
-
border-left: spacers.getSpacer(2xs) var(--core-color-neutral-100) solid;
|
|
47
|
-
border-right: spacers.getSpacer(2xs) var(--core-color-neutral-100) solid;
|
|
44
|
+
--border-color: var(--component-listelements-border-neutral-light);
|
|
48
45
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
46
|
+
border-top: spacers.getSpacer(2xs) var(--border-color) solid;
|
|
47
|
+
border-left: spacers.getSpacer(2xs) var(--border-color) solid;
|
|
48
|
+
border-right: spacers.getSpacer(2xs) var(--border-color) solid;
|
|
49
|
+
|
|
50
|
+
&:last-of-type {
|
|
51
|
+
border-bottom: spacers.getSpacer(2xs) var(--border-color) solid;
|
|
52
52
|
}
|
|
53
53
|
|
|
54
|
-
&--
|
|
55
|
-
border-
|
|
56
|
-
|
|
57
|
-
border-right: spacers.getSpacer(2xs) var(--core-color-blueberry-100) solid;
|
|
54
|
+
&--white {
|
|
55
|
+
--border-color: var(--component-listelements-border-neutral-light);
|
|
56
|
+
}
|
|
58
57
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
}
|
|
58
|
+
&--blueberry {
|
|
59
|
+
--border-color: var(--component-listelements-border-blueberry-light);
|
|
62
60
|
}
|
|
63
61
|
|
|
64
62
|
&--cherry {
|
|
65
|
-
border-
|
|
66
|
-
border-left: spacers.getSpacer(2xs) var(--core-color-cherry-100) solid;
|
|
67
|
-
border-right: spacers.getSpacer(2xs) var(--core-color-cherry-100) solid;
|
|
68
|
-
|
|
69
|
-
&:last-of-type {
|
|
70
|
-
border-bottom: spacers.getSpacer(2xs) var(--core-color-cherry-100) solid;
|
|
71
|
-
}
|
|
63
|
+
--border-color: var(--component-listelements-border-cherry-light);
|
|
72
64
|
}
|
|
73
65
|
|
|
74
66
|
&--neutral {
|
|
75
|
-
border-
|
|
76
|
-
border-left: spacers.getSpacer(2xs) var(--core-color-neutral-100) solid;
|
|
77
|
-
border-right: spacers.getSpacer(2xs) var(--core-color-neutral-100) solid;
|
|
78
|
-
|
|
79
|
-
&:last-of-type {
|
|
80
|
-
border-bottom: spacers.getSpacer(2xs) var(--core-color-neutral-100) solid;
|
|
81
|
-
}
|
|
67
|
+
--border-color: var(--component-listelements-border-neutral-light);
|
|
82
68
|
}
|
|
83
69
|
}
|
|
84
70
|
}
|
|
@@ -110,15 +96,15 @@
|
|
|
110
96
|
}
|
|
111
97
|
|
|
112
98
|
&--blueberry {
|
|
113
|
-
background-color: var(--
|
|
99
|
+
background-color: var(--component-listelements-background-blueberry-light);
|
|
114
100
|
}
|
|
115
101
|
|
|
116
102
|
&--cherry {
|
|
117
|
-
background-color: var(--
|
|
103
|
+
background-color: var(--component-listelements-background-cherry-light);
|
|
118
104
|
}
|
|
119
105
|
|
|
120
106
|
&--neutral {
|
|
121
|
-
background-color: var(--
|
|
107
|
+
background-color: var(--component-listelements-background-neutral-light);
|
|
122
108
|
}
|
|
123
109
|
}
|
|
124
110
|
|
|
@@ -134,20 +120,20 @@
|
|
|
134
120
|
}
|
|
135
121
|
|
|
136
122
|
&--blueberry {
|
|
137
|
-
border: 1px solid var(--
|
|
123
|
+
border: 1px solid var(--component-listelements-border-blueberry-normal);
|
|
138
124
|
}
|
|
139
125
|
|
|
140
126
|
&--cherry {
|
|
141
|
-
border: 1px solid var(--
|
|
127
|
+
border: 1px solid var(--component-listelements-border-cherry-normal);
|
|
142
128
|
}
|
|
143
129
|
|
|
144
130
|
&--neutral {
|
|
145
|
-
border: 1px solid var(--
|
|
131
|
+
border: 1px solid var(--component-listelements-border-neutral-normal);
|
|
146
132
|
}
|
|
147
133
|
|
|
148
134
|
// Skal ikke brukes, men klassen er definert for enkelhets skyld
|
|
149
135
|
&--white {
|
|
150
|
-
border: 1px solid var(--
|
|
136
|
+
border: 1px solid var(--component-listelements-border-neutral-normal);
|
|
151
137
|
}
|
|
152
138
|
}
|
|
153
139
|
|
|
@@ -186,41 +172,41 @@
|
|
|
186
172
|
&--white:not(.link-list__anchor--outline) {
|
|
187
173
|
// listeelement settes til div om man er i edit mode, og skal da ikke ha hover/active effekter
|
|
188
174
|
&:hover:not(div) {
|
|
189
|
-
background-color: var(--
|
|
175
|
+
background-color: var(--component-listelements-background-neutral-light);
|
|
190
176
|
}
|
|
191
177
|
|
|
192
178
|
&:active:not(div) {
|
|
193
|
-
background-color: var(--
|
|
179
|
+
background-color: var(--component-listelements-background-neutral-medium);
|
|
194
180
|
}
|
|
195
181
|
}
|
|
196
182
|
|
|
197
183
|
&--blueberry:not(.link-list__anchor--outline) {
|
|
198
184
|
&:hover:not(div) {
|
|
199
|
-
background-color: var(--
|
|
185
|
+
background-color: var(--component-listelements-background-blueberry-medium);
|
|
200
186
|
}
|
|
201
187
|
|
|
202
188
|
&:active:not(div) {
|
|
203
|
-
background-color: var(--
|
|
189
|
+
background-color: var(--component-listelements-background-blueberry-dark);
|
|
204
190
|
}
|
|
205
191
|
}
|
|
206
192
|
|
|
207
193
|
&--cherry:not(.link-list__anchor--outline) {
|
|
208
194
|
&:hover:not(div) {
|
|
209
|
-
background-color: var(--
|
|
195
|
+
background-color: var(--component-listelements-background-cherry-medium);
|
|
210
196
|
}
|
|
211
197
|
|
|
212
198
|
&:active:not(div) {
|
|
213
|
-
background-color: var(--
|
|
199
|
+
background-color: var(--component-listelements-background-cherry-dark);
|
|
214
200
|
}
|
|
215
201
|
}
|
|
216
202
|
|
|
217
203
|
&--neutral:not(.link-list__anchor--outline) {
|
|
218
204
|
&:hover:not(div) {
|
|
219
|
-
background-color: var(--
|
|
205
|
+
background-color: var(--component-listelements-background-neutral-medium);
|
|
220
206
|
}
|
|
221
207
|
|
|
222
208
|
&:active:not(div) {
|
|
223
|
-
background-color: var(--
|
|
209
|
+
background-color: var(--component-listelements-background-neutral-dark);
|
|
224
210
|
}
|
|
225
211
|
}
|
|
226
212
|
|
|
@@ -240,51 +226,51 @@
|
|
|
240
226
|
}
|
|
241
227
|
|
|
242
228
|
&--blueberry {
|
|
243
|
-
border-bottom: 1px solid var(--
|
|
229
|
+
border-bottom: 1px solid var(--component-listelements-border-blueberry-normal);
|
|
244
230
|
|
|
245
231
|
&:hover:not(div) {
|
|
246
|
-
background-color: var(--
|
|
232
|
+
background-color: var(--component-listelements-background-blueberry-light);
|
|
247
233
|
}
|
|
248
234
|
|
|
249
235
|
&:active:not(div) {
|
|
250
|
-
background-color: var(--
|
|
236
|
+
background-color: var(--component-listelements-background-blueberry-medium);
|
|
251
237
|
}
|
|
252
238
|
}
|
|
253
239
|
|
|
254
240
|
&--cherry {
|
|
255
|
-
border-bottom: 1px solid var(--
|
|
241
|
+
border-bottom: 1px solid var(--component-listelements-border-cherry-normal);
|
|
256
242
|
|
|
257
243
|
&:hover:not(div) {
|
|
258
|
-
background-color: var(--
|
|
244
|
+
background-color: var(--component-listelements-background-cherry-light);
|
|
259
245
|
}
|
|
260
246
|
|
|
261
247
|
&:active:not(div) {
|
|
262
|
-
background-color: var(--
|
|
248
|
+
background-color: var(--component-listelements-background-cherry-medium);
|
|
263
249
|
}
|
|
264
250
|
}
|
|
265
251
|
|
|
266
252
|
&--neutral {
|
|
267
|
-
border-bottom: 1px solid var(--
|
|
253
|
+
border-bottom: 1px solid var(--component-listelements-border-neutral-normal);
|
|
268
254
|
|
|
269
255
|
&:hover:not(div) {
|
|
270
|
-
background-color: var(--
|
|
256
|
+
background-color: var(--component-listelements-background-neutral-light);
|
|
271
257
|
}
|
|
272
258
|
|
|
273
259
|
&:active:not(div) {
|
|
274
|
-
background-color: var(--
|
|
260
|
+
background-color: var(--component-listelements-background-neutral-medium);
|
|
275
261
|
}
|
|
276
262
|
}
|
|
277
263
|
}
|
|
278
264
|
|
|
279
265
|
&--new {
|
|
280
|
-
background-color: var(--
|
|
266
|
+
background-color: var(--component-listelements-background-blueberry-light) !important;
|
|
281
267
|
|
|
282
268
|
&:hover:not(div) {
|
|
283
|
-
background-color: var(--
|
|
269
|
+
background-color: var(--component-listelements-background-blueberry-medium) !important;
|
|
284
270
|
}
|
|
285
271
|
|
|
286
272
|
&:active:not(div) {
|
|
287
|
-
background-color: var(--
|
|
273
|
+
background-color: var(--component-listelements-background-blueberry-dark) !important;
|
|
288
274
|
}
|
|
289
275
|
}
|
|
290
276
|
}
|
|
@@ -31,6 +31,7 @@ export type Styles = {
|
|
|
31
31
|
'link-list__anchor--white': string;
|
|
32
32
|
'link-list__image-container': string;
|
|
33
33
|
'link-list__list-item--line': string;
|
|
34
|
+
'link-list__list-item--outline': string;
|
|
34
35
|
'link-list__list-item--outline--blueberry': string;
|
|
35
36
|
'link-list__list-item--outline--cherry': string;
|
|
36
37
|
'link-list__list-item--outline--neutral': string;
|
|
@@ -2,6 +2,7 @@ import { jsx, jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import React__default from "react";
|
|
3
3
|
import classNames from "classnames";
|
|
4
4
|
import { AnalyticsId, IconSize } from "../../constants.js";
|
|
5
|
+
import { useIsMobileBreakpoint } from "../../hooks/useIsMobileBreakpoint.js";
|
|
5
6
|
import { useUuid } from "../../hooks/useUuid.js";
|
|
6
7
|
import { getAriaLabelAttributes } from "../../utils/accessibility.js";
|
|
7
8
|
import { N as NotificationBadge } from "../../NotificationBadge.js";
|
|
@@ -37,6 +38,7 @@ const NotificationPanel = React__default.forwardRef((props, ref) => {
|
|
|
37
38
|
} = props;
|
|
38
39
|
const uuid = useUuid(labelId);
|
|
39
40
|
const [expanderOpen, setExpanderOpen] = React__default.useState(expanderOpenFromStart);
|
|
41
|
+
const isMobile = useIsMobileBreakpoint();
|
|
40
42
|
const renderContent = () => {
|
|
41
43
|
const outlineVariant = compactVariant === "outline";
|
|
42
44
|
const contentClasses = classNames(styles["notification-panel__content"]);
|
|
@@ -95,7 +97,7 @@ const NotificationPanel = React__default.forwardRef((props, ref) => {
|
|
|
95
97
|
NotificationBadge,
|
|
96
98
|
{
|
|
97
99
|
variant,
|
|
98
|
-
size: compactVariant ? IconSize.XSmall : IconSize.Small,
|
|
100
|
+
size: compactVariant || isMobile ? IconSize.XSmall : IconSize.Small,
|
|
99
101
|
className: styles["notification-panel__icon"]
|
|
100
102
|
}
|
|
101
103
|
),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../src/components/NotificationPanel/NotificationPanel.tsx"],"sourcesContent":["import React from 'react';\n\nimport classNames from 'classnames';\n\nimport { AnalyticsId, IconSize } from '../../constants';\nimport { useUuid } from '../../hooks/useUuid';\nimport { getAriaLabelAttributes } from '../../utils/accessibility';\nimport NotificationBadge from '../Badge/NotificationBadge';\nimport Close from '../Close';\nimport Expander from '../Expander';\n\nimport styles from './styles.module.scss';\n\nexport type NotificationPanelVariants = 'info' | 'warn' | 'error' | 'success';\nexport type NotificationCompactVariants = 'basic' | 'outline';\nexport type NotificationPanelSizes = 'small' | 'medium' | 'large';\nexport type LabelTags = 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'span';\n\nexport interface NotificationPanelProps {\n /** Adds custom classes to the element. */\n className?: string;\n /** Adds inner child elements. */\n children?: React.ReactNode;\n /** Adds inner expander elements. */\n expanderChildren?: React.ReactNode;\n /** Text for expanderButton. */\n expanderButtonText?: string;\n /** Text for expanderButton when closed. */\n expanderButtonClosedText?: string;\n /** Makes expander be open from start. */\n expanderOpenFromStart?: boolean;\n /** Changes the visual representation of the notification panel. */\n variant?: NotificationPanelVariants;\n /** Makes the panel more compact. Available in basic and outline. */\n compactVariant?: NotificationCompactVariants;\n /** Sets a fixed size for the content container. */\n size?: NotificationPanelSizes;\n /** Used in combination with dismissiable property to close the notification panel. */\n onClick?: (e?: React.MouseEvent<HTMLElement, MouseEvent>) => void;\n /** Toggles the close button in the top right corner. */\n dismissable?: boolean;\n /** Enables a fluid outer container that spans the entire width of parent. */\n fluid?: boolean;\n /** Sets a label for the notification panel. */\n label?: string;\n /** Changes the underlying element of the label. */\n labelHtmlMarkup?: LabelTags;\n /** Close button aria-label */\n ariaLabelCloseBtn?: string;\n /** Custom id for the label */\n labelId?: string;\n /** Custom role for the panel. Default is no role. If variant is alert or crisis, the aria role will be set to \"alert\" unless the role-prop is also set. */\n role?: 'region' | 'alert' | 'status';\n /** Sets the data-testid attribute. */\n testId?: string;\n}\n\ntype WrapFluidProps = Pick<NotificationPanelProps, 'fluid'> & {\n children: React.ReactElement;\n};\n\nconst FluidWrapper: React.FC<WrapFluidProps> = ({ fluid, children }) => {\n if (fluid) {\n const fluidClasses = classNames(styles['fluid-wrapper']);\n\n return <div className={fluidClasses}>{children}</div>;\n }\n return children;\n};\n\nconst NotificationPanel = React.forwardRef<HTMLDivElement, NotificationPanelProps>((props, ref) => {\n const {\n children,\n variant = 'info',\n dismissable = false,\n onClick,\n expanderChildren,\n expanderButtonText,\n expanderButtonClosedText,\n expanderOpenFromStart = false,\n compactVariant,\n label,\n labelHtmlMarkup = 'h1',\n fluid = false,\n size,\n className,\n labelId,\n role,\n testId,\n } = props;\n const uuid = useUuid(labelId);\n const [expanderOpen, setExpanderOpen] = React.useState(expanderOpenFromStart);\n\n const renderContent = (): JSX.Element => {\n const outlineVariant = compactVariant === 'outline';\n const contentClasses = classNames(styles['notification-panel__content']);\n const labelClasses = classNames(styles['notification-panel__label'], {\n [styles['notification-panel__label--no-content']]: !children && !expanderChildren,\n [styles['notification-panel__label--compact']]: !!compactVariant,\n [styles['notification-panel__label--outline']]: outlineVariant,\n });\n const childrenClasses = classNames(styles['notification-panel__children'], {\n [styles['notification-panel__children--with-label']]: label,\n [styles['notification-panel__children--expander-no-label']]: expanderChildren && !label,\n [styles['notification-panel__children--outline']]: outlineVariant,\n });\n const CustomTag = labelHtmlMarkup;\n\n return (\n <div className={contentClasses} id={!label ? uuid : undefined}>\n {label && (\n <CustomTag className={labelClasses} id={uuid}>\n {label}\n </CustomTag>\n )}\n {children && <div className={childrenClasses}>{children}</div>}\n {expanderChildren && expanderButtonText && expanderButtonClosedText && !compactVariant && (\n <Expander\n title={expanderOpen ? expanderButtonText : expanderButtonClosedText}\n onExpand={setExpanderOpen}\n expanded={expanderOpen}\n testId=\"expand\"\n >\n {expanderChildren}\n </Expander>\n )}\n </div>\n );\n };\n\n const notificationPanelClasses = classNames(\n styles['notification-panel'],\n styles[`notification-panel--${variant}`],\n size && styles[`notification-panel--${size}`],\n {\n [styles['notification-panel--compact']]: !!compactVariant,\n [styles['notification-panel--compact--basic']]: compactVariant === 'basic',\n [styles['notification-panel--compact--outline']]: compactVariant === 'outline',\n [styles['notification-panel--with-content']]: expanderChildren || (label && children),\n [styles['notification-panel--dismissable']]: dismissable,\n },\n className\n );\n\n const ariaRole = role || (variant === 'error' && 'alert') || undefined;\n const ariaLabelAttributes = ariaRole ? getAriaLabelAttributes({ label, id: uuid }) : undefined;\n\n return (\n <FluidWrapper fluid={fluid}>\n <div\n ref={ref}\n role={ariaRole}\n data-testid={testId}\n data-analyticsid={AnalyticsId.NotificationPanel}\n className={notificationPanelClasses}\n {...ariaLabelAttributes}\n >\n <NotificationBadge\n variant={variant}\n size={compactVariant ? IconSize.XSmall : IconSize.Small}\n className={styles['notification-panel__icon']}\n />\n {dismissable && (\n <span className={styles['notification-panel__close']}>\n <Close ariaLabel={props.ariaLabelCloseBtn} onClick={onClick} color=\"black\" />\n </span>\n )}\n {renderContent()}\n </div>\n </FluidWrapper>\n );\n});\n\nexport default NotificationPanel;\n"],"names":["React"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../src/components/NotificationPanel/NotificationPanel.tsx"],"sourcesContent":["import React from 'react';\n\nimport classNames from 'classnames';\n\nimport { AnalyticsId, IconSize } from '../../constants';\nimport { useIsMobileBreakpoint } from '../../hooks/useIsMobileBreakpoint';\nimport { useUuid } from '../../hooks/useUuid';\nimport { getAriaLabelAttributes } from '../../utils/accessibility';\nimport NotificationBadge from '../Badge/NotificationBadge';\nimport Close from '../Close';\nimport Expander from '../Expander';\n\nimport styles from './styles.module.scss';\n\nexport type NotificationPanelVariants = 'info' | 'warn' | 'error' | 'success';\nexport type NotificationCompactVariants = 'basic' | 'outline';\nexport type NotificationPanelSizes = 'small' | 'medium' | 'large';\nexport type LabelTags = 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'span';\n\nexport interface NotificationPanelProps {\n /** Adds custom classes to the element. */\n className?: string;\n /** Adds inner child elements. */\n children?: React.ReactNode;\n /** Adds inner expander elements. */\n expanderChildren?: React.ReactNode;\n /** Text for expanderButton. */\n expanderButtonText?: string;\n /** Text for expanderButton when closed. */\n expanderButtonClosedText?: string;\n /** Makes expander be open from start. */\n expanderOpenFromStart?: boolean;\n /** Changes the visual representation of the notification panel. */\n variant?: NotificationPanelVariants;\n /** Makes the panel more compact. Available in basic and outline. */\n compactVariant?: NotificationCompactVariants;\n /** Sets a fixed size for the content container. */\n size?: NotificationPanelSizes;\n /** Used in combination with dismissiable property to close the notification panel. */\n onClick?: (e?: React.MouseEvent<HTMLElement, MouseEvent>) => void;\n /** Toggles the close button in the top right corner. */\n dismissable?: boolean;\n /** Enables a fluid outer container that spans the entire width of parent. */\n fluid?: boolean;\n /** Sets a label for the notification panel. */\n label?: string;\n /** Changes the underlying element of the label. */\n labelHtmlMarkup?: LabelTags;\n /** Close button aria-label */\n ariaLabelCloseBtn?: string;\n /** Custom id for the label */\n labelId?: string;\n /** Custom role for the panel. Default is no role. If variant is alert or crisis, the aria role will be set to \"alert\" unless the role-prop is also set. */\n role?: 'region' | 'alert' | 'status';\n /** Sets the data-testid attribute. */\n testId?: string;\n}\n\ntype WrapFluidProps = Pick<NotificationPanelProps, 'fluid'> & {\n children: React.ReactElement;\n};\n\nconst FluidWrapper: React.FC<WrapFluidProps> = ({ fluid, children }) => {\n if (fluid) {\n const fluidClasses = classNames(styles['fluid-wrapper']);\n\n return <div className={fluidClasses}>{children}</div>;\n }\n return children;\n};\n\nconst NotificationPanel = React.forwardRef<HTMLDivElement, NotificationPanelProps>((props, ref) => {\n const {\n children,\n variant = 'info',\n dismissable = false,\n onClick,\n expanderChildren,\n expanderButtonText,\n expanderButtonClosedText,\n expanderOpenFromStart = false,\n compactVariant,\n label,\n labelHtmlMarkup = 'h1',\n fluid = false,\n size,\n className,\n labelId,\n role,\n testId,\n } = props;\n const uuid = useUuid(labelId);\n const [expanderOpen, setExpanderOpen] = React.useState(expanderOpenFromStart);\n const isMobile = useIsMobileBreakpoint();\n\n const renderContent = (): JSX.Element => {\n const outlineVariant = compactVariant === 'outline';\n const contentClasses = classNames(styles['notification-panel__content']);\n const labelClasses = classNames(styles['notification-panel__label'], {\n [styles['notification-panel__label--no-content']]: !children && !expanderChildren,\n [styles['notification-panel__label--compact']]: !!compactVariant,\n [styles['notification-panel__label--outline']]: outlineVariant,\n });\n const childrenClasses = classNames(styles['notification-panel__children'], {\n [styles['notification-panel__children--with-label']]: label,\n [styles['notification-panel__children--expander-no-label']]: expanderChildren && !label,\n [styles['notification-panel__children--outline']]: outlineVariant,\n });\n const CustomTag = labelHtmlMarkup;\n\n return (\n <div className={contentClasses} id={!label ? uuid : undefined}>\n {label && (\n <CustomTag className={labelClasses} id={uuid}>\n {label}\n </CustomTag>\n )}\n {children && <div className={childrenClasses}>{children}</div>}\n {expanderChildren && expanderButtonText && expanderButtonClosedText && !compactVariant && (\n <Expander\n title={expanderOpen ? expanderButtonText : expanderButtonClosedText}\n onExpand={setExpanderOpen}\n expanded={expanderOpen}\n testId=\"expand\"\n >\n {expanderChildren}\n </Expander>\n )}\n </div>\n );\n };\n\n const notificationPanelClasses = classNames(\n styles['notification-panel'],\n styles[`notification-panel--${variant}`],\n size && styles[`notification-panel--${size}`],\n {\n [styles['notification-panel--compact']]: !!compactVariant,\n [styles['notification-panel--compact--basic']]: compactVariant === 'basic',\n [styles['notification-panel--compact--outline']]: compactVariant === 'outline',\n [styles['notification-panel--with-content']]: expanderChildren || (label && children),\n [styles['notification-panel--dismissable']]: dismissable,\n },\n className\n );\n\n const ariaRole = role || (variant === 'error' && 'alert') || undefined;\n const ariaLabelAttributes = ariaRole ? getAriaLabelAttributes({ label, id: uuid }) : undefined;\n\n return (\n <FluidWrapper fluid={fluid}>\n <div\n ref={ref}\n role={ariaRole}\n data-testid={testId}\n data-analyticsid={AnalyticsId.NotificationPanel}\n className={notificationPanelClasses}\n {...ariaLabelAttributes}\n >\n <NotificationBadge\n variant={variant}\n size={compactVariant || isMobile ? IconSize.XSmall : IconSize.Small}\n className={styles['notification-panel__icon']}\n />\n {dismissable && (\n <span className={styles['notification-panel__close']}>\n <Close ariaLabel={props.ariaLabelCloseBtn} onClick={onClick} color=\"black\" />\n </span>\n )}\n {renderContent()}\n </div>\n </FluidWrapper>\n );\n});\n\nexport default NotificationPanel;\n"],"names":["React"],"mappings":";;;;;;;;;;;AA8DA,MAAM,eAAyC,CAAC,EAAE,OAAO,eAAe;AACtE,MAAI,OAAO;AACT,UAAM,eAAe,WAAW,OAAO,eAAe,CAAC;AAEvD,WAAO,oBAAC,OAAA,EAAI,WAAW,cAAe,SAAA,CAAS;AAAA,EACjD;AACA,SAAO;AACT;AAEA,MAAM,oBAAoBA,eAAM,WAAmD,CAA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,EAAA,GAEnB;AAEJ,CAAC;"}
|
|
@@ -15,9 +15,6 @@
|
|
|
15
15
|
@media (min-width: map.get(breakpoints.$grid-breakpoints, md)) {
|
|
16
16
|
padding-left: spacers.getSpacer(s);
|
|
17
17
|
padding-right: spacers.getSpacer(m);
|
|
18
|
-
#{$panel}__icon {
|
|
19
|
-
margin-right: spacers.getSpacer(m);
|
|
20
|
-
}
|
|
21
18
|
}
|
|
22
19
|
|
|
23
20
|
&--compact {
|
|
@@ -36,7 +33,11 @@
|
|
|
36
33
|
}
|
|
37
34
|
}
|
|
38
35
|
#{$panel}__icon {
|
|
39
|
-
margin-right: spacers.getSpacer(
|
|
36
|
+
margin-right: spacers.getSpacer(3xs);
|
|
37
|
+
|
|
38
|
+
@media (min-width: map.get(breakpoints.$grid-breakpoints, md)) {
|
|
39
|
+
margin-right: spacers.getSpacer(2xs);
|
|
40
|
+
}
|
|
40
41
|
}
|
|
41
42
|
|
|
42
43
|
&--dismissable {
|
|
@@ -114,7 +115,11 @@
|
|
|
114
115
|
&__close {
|
|
115
116
|
order: 1;
|
|
116
117
|
margin-left: auto;
|
|
117
|
-
padding-left: spacers.getSpacer(
|
|
118
|
+
padding-left: spacers.getSpacer(3xs);
|
|
119
|
+
|
|
120
|
+
@media (min-width: map.get(breakpoints.$grid-breakpoints, md)) {
|
|
121
|
+
padding-left: spacers.getSpacer(2xs);
|
|
122
|
+
}
|
|
118
123
|
}
|
|
119
124
|
|
|
120
125
|
&__content {
|
|
@@ -42,7 +42,7 @@ export interface PanelProps {
|
|
|
42
42
|
/** Sets classes on the outermost container of the panel */
|
|
43
43
|
className?: string;
|
|
44
44
|
/** Action called when toggling expansion of ExpandedContent */
|
|
45
|
-
onExpand?: () => void;
|
|
45
|
+
onExpand?: (isExpanded?: boolean) => void;
|
|
46
46
|
/** Sets the stacking order of the content boxes */
|
|
47
47
|
stacking?: PanelStacking;
|
|
48
48
|
/** Sets the data-testid attribute. */
|
package/designsystem-react.css
CHANGED
|
@@ -236,4 +236,14 @@
|
|
|
236
236
|
--component-listelements-background-cherry-dark: #eec0a5;
|
|
237
237
|
--component-listelements-border-cherry-normal: #d56147;
|
|
238
238
|
--component-listelements-border-neutral-normal: #7d7c79;
|
|
239
|
+
--component-statusdot-graphics-banana-ondark: #f5e080;
|
|
240
|
+
--component-statusdot-graphics-banana-onlight: #ab7c00;
|
|
241
|
+
--component-statusdot-graphics-blueberry-ondark: #afdae3;
|
|
242
|
+
--component-statusdot-graphics-blueberry-onlight: #188097;
|
|
243
|
+
--component-statusdot-graphics-cherry-ondark: #f7e1d2;
|
|
244
|
+
--component-statusdot-graphics-cherry-onlight: #a31f0e;
|
|
245
|
+
--component-statusdot-graphics-kiwi-ondark: #9de2bf;
|
|
246
|
+
--component-statusdot-graphics-kiwi-onlight: #078141;
|
|
247
|
+
--component-statusdot-graphics-neutral-ondark: #f5f3f3;
|
|
248
|
+
--component-statusdot-graphics-neutral-onlight: #7d7c79;
|
|
239
249
|
}
|
package/index.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ export { useBreakpoint, Breakpoint } from './hooks/useBreakpoint';
|
|
|
3
3
|
export { useFocusToggle } from './hooks/useFocusToggle';
|
|
4
4
|
export { useFocusTrap } from './hooks/useFocusTrap';
|
|
5
5
|
export { useHover } from './hooks/useHover';
|
|
6
|
+
export { usePseudoClasses } from './hooks/usePseudoClasses';
|
|
6
7
|
export { useIntersectionObserver } from './hooks/useIntersectionObserver';
|
|
7
8
|
export { useIsVisible } from './hooks/useIsVisible';
|
|
8
9
|
export { useLayoutEvent } from './hooks/useLayoutEvent';
|
package/index.js
CHANGED
|
@@ -3,6 +3,7 @@ import { Breakpoint, useBreakpoint } from "./hooks/useBreakpoint.js";
|
|
|
3
3
|
import { useFocusToggle } from "./hooks/useFocusToggle.js";
|
|
4
4
|
import { useFocusTrap } from "./hooks/useFocusTrap.js";
|
|
5
5
|
import { useHover } from "./hooks/useHover.js";
|
|
6
|
+
import { usePseudoClasses } from "./hooks/usePseudoClasses.js";
|
|
6
7
|
import { useIntersectionObserver } from "./hooks/useIntersectionObserver.js";
|
|
7
8
|
import { useIsVisible } from "./hooks/useIsVisible.js";
|
|
8
9
|
import { useLayoutEvent } from "./hooks/useLayoutEvent.js";
|
|
@@ -38,6 +39,7 @@ export {
|
|
|
38
39
|
useLayoutEvent,
|
|
39
40
|
useOutsideEvent,
|
|
40
41
|
usePrevious,
|
|
42
|
+
usePseudoClasses,
|
|
41
43
|
useResizeObserver,
|
|
42
44
|
useSize,
|
|
43
45
|
useToggle,
|
package/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;"}
|
package/package.json
CHANGED
|
@@ -236,4 +236,14 @@
|
|
|
236
236
|
--component-listelements-background-cherry-dark: #eec0a5;
|
|
237
237
|
--component-listelements-border-cherry-normal: #d56147;
|
|
238
238
|
--component-listelements-border-neutral-normal: #7d7c79;
|
|
239
|
+
--component-statusdot-graphics-banana-ondark: #f5e080;
|
|
240
|
+
--component-statusdot-graphics-banana-onlight: #ab7c00;
|
|
241
|
+
--component-statusdot-graphics-blueberry-ondark: #afdae3;
|
|
242
|
+
--component-statusdot-graphics-blueberry-onlight: #188097;
|
|
243
|
+
--component-statusdot-graphics-cherry-ondark: #f7e1d2;
|
|
244
|
+
--component-statusdot-graphics-cherry-onlight: #a31f0e;
|
|
245
|
+
--component-statusdot-graphics-kiwi-ondark: #9de2bf;
|
|
246
|
+
--component-statusdot-graphics-kiwi-onlight: #078141;
|
|
247
|
+
--component-statusdot-graphics-neutral-ondark: #f5f3f3;
|
|
248
|
+
--component-statusdot-graphics-neutral-onlight: #7d7c79;
|
|
239
249
|
}
|
package/use-animate.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { useRef, useEffect } from "react";
|
|
2
|
+
import { c as clamp } from "./clamp.js";
|
|
2
3
|
function useConstant(init) {
|
|
3
4
|
const ref = useRef(null);
|
|
4
5
|
if (ref.current === null) {
|
|
@@ -276,13 +277,6 @@ const singleCssVariableRegex = /var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\
|
|
|
276
277
|
const getValueAsType = (value, type) => {
|
|
277
278
|
return type && typeof value === "number" ? type.transform(value) : value;
|
|
278
279
|
};
|
|
279
|
-
const clamp = (min, max, v) => {
|
|
280
|
-
if (v > max)
|
|
281
|
-
return max;
|
|
282
|
-
if (v < min)
|
|
283
|
-
return min;
|
|
284
|
-
return v;
|
|
285
|
-
};
|
|
286
280
|
const number = {
|
|
287
281
|
test: (v) => typeof v === "number",
|
|
288
282
|
parse: parseFloat,
|