@entur/alert 0.17.13-beta.9 → 0.17.14

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/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "@entur/alert",
3
- "version": "0.17.13-beta.9",
3
+ "version": "0.17.14",
4
4
  "license": "EUPL-1.2",
5
- "main": "dist/index.js",
5
+ "main": "dist/alert.cjs.js",
6
6
  "module": "dist/alert.esm.js",
7
- "typings": "dist/index.d.ts",
7
+ "types": "dist/index.d.ts",
8
8
  "files": [
9
9
  "dist"
10
10
  ],
@@ -17,28 +17,38 @@
17
17
  "access": "public"
18
18
  },
19
19
  "scripts": {
20
- "start": "dts watch --noClean",
21
- "build": "dts build",
22
- "test": "dts test",
23
- "lint": "dts lint src"
20
+ "start": "vite build --watch",
21
+ "build": "vite build",
22
+ "test": "jest",
23
+ "lint": "eslint src"
24
24
  },
25
25
  "peerDependencies": {
26
26
  "react": ">=16.8.0",
27
27
  "react-dom": ">=16.8.0"
28
28
  },
29
29
  "dependencies": {
30
- "@entur/button": "^3.3.13-beta.9",
31
- "@entur/expand": "^3.6.13-beta.9",
32
- "@entur/icons": "^8.0.0",
33
- "@entur/tokens": "^3.19.1",
34
- "@entur/tooltip": "^5.2.13-beta.9",
35
- "@entur/typography": "^1.10.0-beta.9",
36
- "@entur/utils": "^0.12.3",
37
- "classnames": "^2.3.1",
38
- "copy-text-to-clipboard": "^2.2"
30
+ "@entur/button": "^3.3.14",
31
+ "@entur/expand": "^3.6.14",
32
+ "@entur/icons": "^8.0.2",
33
+ "@entur/tokens": "^3.19.3",
34
+ "@entur/tooltip": "^5.2.14",
35
+ "@entur/typography": "^1.9.14",
36
+ "@entur/utils": "^0.12.5",
37
+ "classnames": "^2.5.1",
38
+ "copy-text-to-clipboard": "^2.2.0"
39
39
  },
40
40
  "devDependencies": {
41
- "dts-cli": "2.0.5"
41
+ "@testing-library/jest-dom": "^5.17.0",
42
+ "@testing-library/react": "^10.4.9",
43
+ "@testing-library/user-event": "14.6.1",
44
+ "@vitejs/plugin-react": "^5.0.1",
45
+ "eslint": "^7.32.0",
46
+ "jest": "^29.0.0",
47
+ "jest-environment-jsdom": "^29.0.0",
48
+ "ts-jest": "^29.0.0",
49
+ "typescript": "^5.9.2",
50
+ "vite": "^7.1.3",
51
+ "vite-plugin-dts": "^4.5.4"
42
52
  },
43
- "gitHead": "6f685d2e4ac13bdaf9c6480f9e7922c9d8f4619c"
53
+ "gitHead": "5dd9d318f1d79f6f522f978de27b551fda1e91cc"
44
54
  }
@@ -1,410 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- var utils = require('@entur/utils');
6
- var React = require('react');
7
- var classNames = require('classnames');
8
- var icons = require('@entur/icons');
9
- var button = require('@entur/button');
10
- var tooltip = require('@entur/tooltip');
11
- var copy = require('copy-text-to-clipboard');
12
- var typography = require('@entur/typography');
13
- var _ = require('@entur/expand/');
14
-
15
- function _extends() {
16
- return _extends = Object.assign ? Object.assign.bind() : function (n) {
17
- for (var e = 1; e < arguments.length; e++) {
18
- var t = arguments[e];
19
- for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
20
- }
21
- return n;
22
- }, _extends.apply(null, arguments);
23
- }
24
- function _objectWithoutPropertiesLoose(r, e) {
25
- if (null == r) return {};
26
- var t = {};
27
- for (var n in r) if ({}.hasOwnProperty.call(r, n)) {
28
- if (-1 !== e.indexOf(n)) continue;
29
- t[n] = r[n];
30
- }
31
- return t;
32
- }
33
-
34
- var _excluded$3 = ["children", "className", "closable", "closeButtonLabel", "variant", "onClose", "size", "title", "toastIsBeingRemoved"];
35
- var iconsMap = {
36
- success: {
37
- icon: icons.ValidationSuccessIcon,
38
- description: 'Suksessmelding'
39
- },
40
- information: {
41
- icon: icons.ValidationInfoIcon,
42
- description: 'Infomelding'
43
- },
44
- warning: {
45
- icon: icons.ValidationExclamationIcon,
46
- description: 'Varselmelding'
47
- },
48
- negative: {
49
- icon: icons.ValidationErrorIcon,
50
- description: 'Feilmelding'
51
- },
52
- //deprecated
53
- info: {
54
- icon: icons.ValidationInfoIcon,
55
- description: 'Infomelding'
56
- },
57
- error: {
58
- icon: icons.ValidationErrorIcon,
59
- description: 'Feilmelding'
60
- }
61
- };
62
- var BaseAlertBox = function BaseAlertBox(_ref) {
63
- var children = _ref.children,
64
- className = _ref.className,
65
- _ref$closable = _ref.closable,
66
- closable = _ref$closable === void 0 ? false : _ref$closable,
67
- _ref$closeButtonLabel = _ref.closeButtonLabel,
68
- closeButtonLabel = _ref$closeButtonLabel === void 0 ? 'Lukk' : _ref$closeButtonLabel,
69
- variant = _ref.variant,
70
- _ref$onClose = _ref.onClose,
71
- onClose = _ref$onClose === void 0 ? function () {
72
- return {};
73
- } : _ref$onClose,
74
- size = _ref.size,
75
- title = _ref.title,
76
- toastIsBeingRemoved = _ref.toastIsBeingRemoved,
77
- rest = _objectWithoutPropertiesLoose(_ref, _excluded$3);
78
- var _React$useState = React.useState(false),
79
- isClosed = _React$useState[0],
80
- setClosed = _React$useState[1];
81
- if (isClosed) {
82
- return null;
83
- }
84
- var handleClose = function handleClose() {
85
- setClosed(true);
86
- onClose();
87
- };
88
- var Icon = iconsMap[variant].icon;
89
- return React.createElement("div", _extends({
90
- className: classNames('eds-alert-box', "eds-alert-box--" + size, "eds-alert-box--" + variant, {
91
- 'eds-alert-box--toast--exit-animation': toastIsBeingRemoved,
92
- 'eds-alert-box--no-title': !title
93
- }, className)
94
- }, rest), React.createElement(Icon, {
95
- role: "img",
96
- className: "eds-alert-box__icon",
97
- "aria-label": iconsMap[variant].description
98
- }), React.createElement("div", {
99
- className: classNames('eds-alert-box__content', {
100
- 'eds-alert-box__content--no-children': !children
101
- })
102
- }, title && React.createElement("div", {
103
- className: "eds-alert-box__title"
104
- }, title), children && children), closable && React.createElement(tooltip.Tooltip, {
105
- className: "eds-alert-box__tooltip",
106
- "aria-hidden": true,
107
- placement: "bottom",
108
- content: "Lukk"
109
- }, React.createElement(button.IconButton, {
110
- className: "eds-alert-box__close-button",
111
- "aria-label": closeButtonLabel,
112
- onClick: handleClose,
113
- type: "button"
114
- }, React.createElement(icons.CloseIcon, null))));
115
- };
116
-
117
- var BannerAlertBox = function BannerAlertBox(props) {
118
- return React.createElement(BaseAlertBox, _extends({}, props, {
119
- size: "banner"
120
- }));
121
- };
122
-
123
- var ToastAlertBox = function ToastAlertBox(props) {
124
- return React.createElement(BaseAlertBox, _extends({}, props, {
125
- size: "toast",
126
- role: "status"
127
- }));
128
- };
129
-
130
- var _excluded$2 = ["className", "width", "onClose", "closable", "closeButtonLabel"];
131
- var SmallAlertBox = function SmallAlertBox(_ref) {
132
- var className = _ref.className,
133
- width = _ref.width,
134
- onClose = _ref.onClose,
135
- _ref$closable = _ref.closable,
136
- closable = _ref$closable === void 0 ? false : _ref$closable,
137
- closeButtonLabel = _ref.closeButtonLabel,
138
- rest = _objectWithoutPropertiesLoose(_ref, _excluded$2);
139
- return React.createElement(BaseAlertBox, _extends({
140
- className: classNames(className, {
141
- 'eds-alert-box--fit-content': width === 'fit-content'
142
- })
143
- }, rest, {
144
- onClose: onClose,
145
- closable: closable,
146
- closeButtonLabel: closeButtonLabel,
147
- size: "small"
148
- }));
149
- };
150
-
151
- var EXIT_ANIMATION_TIME = 400;
152
- var ToastContext = /*#__PURE__*/React.createContext(null);
153
- var toastReducer = function toastReducer(prevToasts, action) {
154
- switch (action.type) {
155
- case 'ADD_TOAST':
156
- return [action.payload].concat(prevToasts);
157
- case 'PLAY_EXIT_ANIMATION':
158
- return prevToasts.map(function (toast) {
159
- if (toast.id === action.payload) return _extends({}, toast, {
160
- isBeingRemoved: true
161
- });
162
- return toast;
163
- });
164
- case 'REMOVE_TOAST':
165
- return prevToasts.filter(function (toast) {
166
- return toast.id !== action.payload;
167
- });
168
- }
169
- };
170
- var createUniqueId = function createUniqueId() {
171
- return Math.random().toString().substring(2);
172
- };
173
- var createToast = function createToast(toast, id) {
174
- if (typeof toast === 'string') {
175
- return {
176
- id: id,
177
- content: toast,
178
- variant: 'success',
179
- isBeingRemoved: false
180
- };
181
- } else {
182
- return _extends({
183
- id: id,
184
- variant: 'success',
185
- isBeingRemoved: false
186
- }, toast);
187
- }
188
- };
189
- var ToastProvider = function ToastProvider(_ref) {
190
- var _ref$delay = _ref.delay,
191
- delay = _ref$delay === void 0 ? 6000 : _ref$delay,
192
- children = _ref.children,
193
- _ref$position = _ref.position,
194
- position = _ref$position === void 0 ? 'bottom-right' : _ref$position,
195
- className = _ref.className,
196
- style = _ref.style;
197
- var _React$useReducer = React.useReducer(toastReducer, []),
198
- toasts = _React$useReducer[0],
199
- dispatch = _React$useReducer[1];
200
- var _React$useState = React.useState(),
201
- hoveringId = _React$useState[0],
202
- setHovering = _React$useState[1];
203
- var timeoutIdRefs = React.useRef({});
204
- var removeToast = React.useCallback(function (id) {
205
- window.clearTimeout(timeoutIdRefs.current[id]);
206
- dispatch({
207
- type: 'REMOVE_TOAST',
208
- payload: id
209
- });
210
- delete timeoutIdRefs.current[id];
211
- }, []);
212
- var playExitAnimation = React.useCallback(function (id) {
213
- window.clearTimeout(timeoutIdRefs.current[id + 'animation']);
214
- dispatch({
215
- type: 'PLAY_EXIT_ANIMATION',
216
- payload: id
217
- });
218
- delete timeoutIdRefs.current[id + 'animation'];
219
- }, []);
220
- var removeToastWithAnimationAfterDelay = React.useCallback(function (id, delay) {
221
- timeoutIdRefs.current[id + 'animation'] = window.setTimeout(function () {
222
- return playExitAnimation(id);
223
- }, delay - EXIT_ANIMATION_TIME);
224
- timeoutIdRefs.current[id] = window.setTimeout(function () {
225
- return removeToast(id);
226
- }, delay);
227
- }, [timeoutIdRefs, playExitAnimation, removeToast]);
228
- var addToast = React.useCallback(function (toast) {
229
- var id = createUniqueId();
230
- var payload = createToast(toast, id);
231
- dispatch({
232
- type: 'ADD_TOAST',
233
- payload: payload
234
- });
235
- removeToastWithAnimationAfterDelay(id, delay);
236
- }, [delay, removeToastWithAnimationAfterDelay]);
237
- var handleMouseEnter = function handleMouseEnter(toast) {
238
- return function () {
239
- if (toast.isBeingRemoved) return;
240
- setHovering(toast.id);
241
- Object.values(timeoutIdRefs.current).forEach(function (timeoutId) {
242
- window.clearTimeout(timeoutId);
243
- });
244
- timeoutIdRefs.current = {};
245
- };
246
- };
247
- var handleMouseLeave = function handleMouseLeave() {
248
- setHovering(undefined);
249
- toasts.forEach(function (toast) {
250
- removeToastWithAnimationAfterDelay(toast.id, delay);
251
- });
252
- };
253
- var handleClose = function handleClose(toastId) {
254
- return function () {
255
- removeToast(toastId);
256
- handleMouseLeave();
257
- };
258
- };
259
- var contextValue = React.useMemo(function () {
260
- return {
261
- toasts: toasts,
262
- addToast: addToast,
263
- removeToast: removeToast
264
- };
265
- }, [addToast, removeToast, toasts]);
266
- return React.createElement(ToastContext.Provider, {
267
- value: contextValue
268
- }, toasts.length > 0 && React.createElement("div", {
269
- className: classNames('eds-toast-container', "eds-toast-container--" + position, className),
270
- style: style
271
- }, toasts.slice(0, 3).map(function (toastToShow) {
272
- return React.createElement(ToastAlertBox, {
273
- variant: toastToShow.variant,
274
- title: toastToShow.title,
275
- onClose: handleClose(toastToShow.id),
276
- onMouseEnter: handleMouseEnter(toastToShow),
277
- onMouseLeave: handleMouseLeave,
278
- closable: hoveringId === toastToShow.id,
279
- toastIsBeingRemoved: toastToShow.isBeingRemoved,
280
- key: toastToShow.id
281
- }, toastToShow.content);
282
- })), children);
283
- };
284
- var useToast = function useToast() {
285
- var context = React.useContext(ToastContext);
286
- if (!context) {
287
- throw new Error('You need to wrap your component in a ToastProvider component in ' + 'order to use the useToast hook');
288
- }
289
- var addToast = context.addToast;
290
- return {
291
- addToast: addToast
292
- };
293
- };
294
-
295
- var _excluded$1 = ["children", "successHeading", "successMessage", "textToCopy", "className", "aria-label"];
296
- var CopyableText = function CopyableText(_ref) {
297
- var children = _ref.children,
298
- _ref$successHeading = _ref.successHeading,
299
- successHeading = _ref$successHeading === void 0 ? 'Kopiert!' : _ref$successHeading,
300
- successMessage = _ref.successMessage,
301
- textToCopy = _ref.textToCopy,
302
- className = _ref.className,
303
- _ref$ariaLabel = _ref['aria-label'],
304
- ariaLabel = _ref$ariaLabel === void 0 ? "Kopier " + (textToCopy != null ? textToCopy : children) + " til utklippstavlen" : _ref$ariaLabel,
305
- rest = _objectWithoutPropertiesLoose(_ref, _excluded$1);
306
- var _useToast = useToast(),
307
- addToast = _useToast.addToast;
308
- var buttonRef = React.useRef(null);
309
- var _textToCopy = textToCopy != null ? textToCopy : children;
310
- var _successMessage = successMessage != null ? successMessage : _textToCopy + " ble kopiert til utklippstavlen.";
311
- var handleClick = function handleClick() {
312
- buttonRef.current && copy(_textToCopy, {
313
- target: buttonRef.current
314
- }) && addToast({
315
- title: successHeading,
316
- content: _successMessage
317
- });
318
- };
319
- return React.createElement("div", _extends({
320
- className: 'eds-copyable-text ' + className,
321
- style: _extends({}, rest.style),
322
- type: "button",
323
- onClick: handleClick,
324
- tabIndex: -1,
325
- "aria-label": ""
326
- }, rest), React.createElement(typography.PreformattedText, {
327
- className: "eds-copyable-text__preformatted-text"
328
- }, React.createElement("span", {
329
- className: "eds-copyable-text__displayed-text"
330
- }, children), React.createElement(button.IconButton, {
331
- className: "eds-copyable-text__button",
332
- "aria-label": ariaLabel,
333
- type: "button",
334
- ref: buttonRef
335
- }, React.createElement(icons.CopyIcon, {
336
- className: 'eds-copyable-text__button__icon'
337
- }))));
338
- };
339
-
340
- var _excluded = ["variant", "title", "children", "size", "className", "openLabel", "closeLabel"];
341
- var SmallExpandableAlertBox = function SmallExpandableAlertBox(props) {
342
- return React.createElement(ExpandableAlertBox, _extends({
343
- size: "small"
344
- }, props));
345
- };
346
- var BannerExpandableAlertBox = function BannerExpandableAlertBox(props) {
347
- return React.createElement(ExpandableAlertBox, _extends({
348
- size: "banner"
349
- }, props));
350
- };
351
- var ExpandableAlertBox = function ExpandableAlertBox(_ref) {
352
- var variant = _ref.variant,
353
- title = _ref.title,
354
- children = _ref.children,
355
- size = _ref.size,
356
- className = _ref.className,
357
- openLabel = _ref.openLabel,
358
- closeLabel = _ref.closeLabel,
359
- rest = _objectWithoutPropertiesLoose(_ref, _excluded);
360
- var _React$useState = React.useState(false),
361
- open = _React$useState[0],
362
- setopen = _React$useState[1];
363
- return React.createElement(BaseAlertBox, _extends({
364
- size: size,
365
- variant: variant,
366
- className: classNames('eds-expandable-alert-box', className),
367
- title: React.createElement(ExpandableAlertBoxTitle, {
368
- open: open,
369
- title: title,
370
- onClick: function onClick() {
371
- return setopen(!open);
372
- },
373
- openLabel: openLabel,
374
- closeLabel: closeLabel
375
- })
376
- }, rest), React.createElement(_.BaseExpand, {
377
- open: open
378
- }, children));
379
- };
380
- var ExpandableAlertBoxTitle = function ExpandableAlertBoxTitle(_ref2) {
381
- var title = _ref2.title,
382
- open = _ref2.open,
383
- _ref2$openLabel = _ref2.openLabel,
384
- openLabel = _ref2$openLabel === void 0 ? 'Les mer' : _ref2$openLabel,
385
- _ref2$closeLabel = _ref2.closeLabel,
386
- closeLabel = _ref2$closeLabel === void 0 ? 'Lukk' : _ref2$closeLabel,
387
- onClick = _ref2.onClick;
388
- return React.createElement("div", {
389
- className: "eds-expandable-alert-box__title"
390
- }, React.createElement("div", null, title), React.createElement("button", {
391
- className: "eds-expandable-alert-box__button",
392
- onClick: onClick,
393
- type: "button"
394
- }, open ? closeLabel : openLabel, React.createElement(_.ExpandArrow, {
395
- open: open,
396
- inline: true
397
- })));
398
- };
399
-
400
- utils.warnAboutMissingStyles('alert', 'icons');
401
-
402
- exports.BannerAlertBox = BannerAlertBox;
403
- exports.BannerExpandableAlertBox = BannerExpandableAlertBox;
404
- exports.CopyableText = CopyableText;
405
- exports.SmallAlertBox = SmallAlertBox;
406
- exports.SmallExpandableAlertBox = SmallExpandableAlertBox;
407
- exports.ToastAlertBox = ToastAlertBox;
408
- exports.ToastProvider = ToastProvider;
409
- exports.useToast = useToast;
410
- //# sourceMappingURL=alert.cjs.development.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"alert.cjs.development.js","sources":["../src/BaseAlertBox.tsx","../src/BannerAlertBox.tsx","../src/ToastAlertBox.tsx","../src/SmallAlertBox.tsx","../src/ToastProvider.tsx","../src/CopyableText.tsx","../src/ExpandableAlertBox.tsx","../src/index.tsx"],"sourcesContent":["import React from 'react';\nimport classNames from 'classnames';\nimport {\n CloseIcon,\n ValidationSuccessIcon,\n ValidationExclamationIcon,\n ValidationInfoIcon,\n ValidationErrorIcon,\n} from '@entur/icons';\nimport { IconButton } from '@entur/button';\nimport { Tooltip } from '@entur/tooltip';\nimport { VariantType } from '@entur/utils';\n\nimport './BaseAlertBox.scss';\n\nconst iconsMap = {\n success: {\n icon: ValidationSuccessIcon,\n description: 'Suksessmelding',\n },\n information: { icon: ValidationInfoIcon, description: 'Infomelding' },\n warning: {\n icon: ValidationExclamationIcon,\n description: 'Varselmelding',\n },\n negative: { icon: ValidationErrorIcon, description: 'Feilmelding' },\n //deprecated\n info: { icon: ValidationInfoIcon, description: 'Infomelding' },\n error: { icon: ValidationErrorIcon, description: 'Feilmelding' },\n};\n\n/** @deprecated use variant=\"information\" instead */\nconst info = 'info';\n/** @deprecated use variant=\"negative\" instead */\nconst error = 'error';\n\ntype BaseAlertBoxProps = {\n /** Innholdet i alert-boksen */\n children?: React.ReactNode;\n /** Ekstra klassenavn */\n className?: string;\n /** Skjermleser-label for lukkeknappen, om den vises\n * @default \"Lukk\"\n */\n closeButtonLabel?: string;\n /** Callback som kalles når man lukker boksen\n * @default () => {}\n */\n onClose?: () => void;\n /** Om denne er true, vil boksen få en lukkeknapp i høyre hjørne\n * @default false\n */\n closable?: boolean;\n /** Tittel på boksen - oppsummer virkning */\n title?: React.ReactNode;\n /** Farge og uttrykk på alert-boksen */\n variant: VariantType | typeof info | typeof error;\n /** Typen boks (internt bruk) */\n size: 'banner' | 'toast' | 'small';\n [key: string]: any;\n};\n\nexport const BaseAlertBox: React.FC<BaseAlertBoxProps> = ({\n children,\n className,\n closable = false,\n closeButtonLabel = 'Lukk',\n variant,\n onClose = () => ({}),\n size,\n title,\n toastIsBeingRemoved,\n ...rest\n}) => {\n const [isClosed, setClosed] = React.useState(false);\n if (isClosed) {\n return null;\n }\n const handleClose = () => {\n setClosed(true);\n onClose();\n };\n const Icon = iconsMap[variant].icon;\n return (\n <div\n className={classNames(\n 'eds-alert-box',\n `eds-alert-box--${size}`,\n `eds-alert-box--${variant}`,\n {\n 'eds-alert-box--toast--exit-animation': toastIsBeingRemoved,\n 'eds-alert-box--no-title': !title,\n },\n className,\n )}\n {...rest}\n >\n <Icon\n role=\"img\"\n className=\"eds-alert-box__icon\"\n aria-label={iconsMap[variant].description}\n />\n <div\n className={classNames('eds-alert-box__content', {\n 'eds-alert-box__content--no-children': !children,\n })}\n >\n {title && <div className=\"eds-alert-box__title\">{title}</div>}\n {children && children}\n </div>\n {closable && (\n <Tooltip\n className=\"eds-alert-box__tooltip\"\n aria-hidden\n placement=\"bottom\"\n content=\"Lukk\"\n >\n <IconButton\n className=\"eds-alert-box__close-button\"\n aria-label={closeButtonLabel}\n onClick={handleClose}\n type=\"button\"\n >\n <CloseIcon />\n </IconButton>\n </Tooltip>\n )}\n </div>\n );\n};\n","import React from 'react';\nimport { BaseAlertBox } from './BaseAlertBox';\n\nimport { VariantType } from '@entur/utils';\n\n/** @deprecated use variant=\"information\" instead */\nconst info = 'info';\n/** @deprecated use variant=\"negative\" instead */\nconst error = 'error';\n\nexport type BannerAlertBoxProps = {\n /** Innholdet i alert-boksen */\n children: React.ReactNode;\n /** Ekstra klassenavn */\n className?: string;\n /** Skjermleser-label for lukkeknappen, om den vises */\n closeButtonLabel?: string;\n /** Callback som kalles når man lukker boksen */\n onClose?: () => void;\n /** Om denne er true, vil boksen få en lukkeknapp i høyre hjørne\n * @default false\n */\n closable?: boolean;\n /** Tittel på boksen - oppsummer virkning */\n title?: string;\n /** Farge og uttrykk på alert-boksen */\n variant: VariantType | typeof info | typeof error;\n [key: string]: any;\n};\n\nexport const BannerAlertBox: React.FC<BannerAlertBoxProps> = props => (\n <BaseAlertBox {...props} size=\"banner\" />\n);\n","import React from 'react';\nimport { BaseAlertBox } from './BaseAlertBox';\nimport './ToastAlertBox.scss';\n\n/** @deprecated use variant=\"information\" instead */\nconst info = 'info';\n\nexport type ToastAlertBoxProps = {\n /** Innholdet i toasten */\n children?: React.ReactNode;\n /** Ekstra klassenavn */\n className?: string;\n /** Skjermleser-label for lukkeknappen, om den vises */\n closeButtonLabel?: string;\n /** Callback som kalles når man lukker boksen */\n onClose?: () => void;\n /** Om denne er true, vil boksen få en lukkeknapp i høyre hjørne */\n closable?: boolean;\n /** Tittel på boksen - oppsummer virkning */\n title?: string;\n /** Farge og uttrykk på toasten */\n variant: 'success' | 'information' | typeof info;\n [key: string]: any;\n};\n\nexport const ToastAlertBox: React.FC<ToastAlertBoxProps> = props => (\n <BaseAlertBox {...props} size=\"toast\" role=\"status\" />\n);\n","import React from 'react';\nimport classNames from 'classnames';\nimport { BaseAlertBox } from './BaseAlertBox';\n\nimport { VariantType } from '@entur/utils';\n\n/** @deprecated use variant=\"information\" instead */\nconst info = 'info';\n/** @deprecated use variant=\"negative\" instead */\nconst error = 'error';\n\nexport type SmallAlertBoxProps = {\n /** Innholdet i alert-boksen */\n children: React.ReactNode;\n /** Ekstra klassenavn */\n className?: string;\n /** Skjermleser-label for lukkeknappen, om den vises */\n closeButtonLabel?: string;\n /** Om denne er true, vil boksen få en lukkeknapp i høyre hjørne\n * @default false\n */\n closable?: boolean;\n /** Callback som kalles når man lukker boksen */\n onClose?: () => void;\n /** Tittel på boksen - oppsummer virkning */\n title?: string;\n /** Bredden på boksen - fullbredde eller tilpasset innholdet */\n width?: 'fluid' | 'fit-content';\n /** Farge og uttrykk på alert-boksen*/\n variant: VariantType | typeof info | typeof error;\n [key: string]: any;\n};\n\nexport const SmallAlertBox: React.FC<SmallAlertBoxProps> = ({\n className,\n width,\n onClose,\n closable = false,\n closeButtonLabel,\n ...rest\n}) => (\n <BaseAlertBox\n className={classNames(className, {\n 'eds-alert-box--fit-content': width === 'fit-content',\n })}\n {...rest}\n onClose={onClose}\n closable={closable}\n closeButtonLabel={closeButtonLabel}\n size=\"small\"\n />\n);\n","import React from 'react';\nimport { ToastAlertBox } from './ToastAlertBox';\nimport classNames from 'classnames';\n\ntype ToastId = string;\n\n/** @deprecated use variant=\"information\" instead */\nconst info = 'info';\n\nexport type ToastVariants = 'success' | 'information' | typeof info;\n\ntype ToastType = {\n title?: string;\n content: React.ReactNode;\n id: ToastId;\n variant: ToastVariants;\n isBeingRemoved: boolean;\n};\n\ntype ToastContextType = {\n addToast: (payload: AddToastPayload | string) => void;\n removeToast: (id: ToastId) => void;\n toasts: ToastType[];\n};\n\nexport type AddToastPayload = {\n title?: string;\n content: React.ReactNode;\n variant?: ToastVariants;\n};\n\ntype ToastAction =\n | { type: 'ADD_TOAST'; payload: ToastType }\n | { type: 'REMOVE_TOAST'; payload: ToastId }\n | { type: 'PLAY_EXIT_ANIMATION'; payload: ToastId };\n\nconst EXIT_ANIMATION_TIME = 400;\n\nconst ToastContext = React.createContext<ToastContextType | null>(null);\n\nconst toastReducer = (\n prevToasts: ToastType[],\n action: ToastAction,\n): ToastType[] => {\n switch (action.type) {\n case 'ADD_TOAST':\n return [action.payload, ...prevToasts];\n case 'PLAY_EXIT_ANIMATION':\n return prevToasts.map(toast => {\n if (toast.id === action.payload)\n return { ...toast, isBeingRemoved: true };\n return toast;\n });\n case 'REMOVE_TOAST':\n return prevToasts.filter(toast => toast.id !== action.payload);\n }\n};\n\nconst createUniqueId = () => Math.random().toString().substring(2);\n\nconst createToast = (\n toast: AddToastPayload | string,\n id: ToastId,\n): ToastType => {\n if (typeof toast === 'string') {\n return { id, content: toast, variant: 'success', isBeingRemoved: false };\n } else {\n return { id, variant: 'success', isBeingRemoved: false, ...toast };\n }\n};\n\nexport type ToastProviderProps = {\n /** Antall millisekunder før toasts forsvinner av seg selv\n * @default 6000\n */\n delay?: number;\n /** Plasseringen av toasts\n * @default \"bottom-right\"\n */\n position?: 'bottom-right' | 'top-right';\n /** Ekstra klassenavn til ToastProvider-wrapperen */\n className?: string;\n /** Ekstra styling som sendes til ToastProvider-wrapperen */\n style?: React.CSSProperties;\n /** Innholdet */\n children: React.ReactNode;\n};\n\nexport const ToastProvider: React.FC<ToastProviderProps> = ({\n delay = 6000,\n children,\n position = 'bottom-right',\n className,\n style,\n}) => {\n const [toasts, dispatch] = React.useReducer(toastReducer, []);\n const [hoveringId, setHovering] = React.useState<string>();\n const timeoutIdRefs = React.useRef<{ [key: string]: number }>({});\n\n const removeToast = React.useCallback((id: ToastId) => {\n window.clearTimeout(timeoutIdRefs.current[id]);\n dispatch({ type: 'REMOVE_TOAST', payload: id });\n delete timeoutIdRefs.current[id];\n }, []);\n\n const playExitAnimation = React.useCallback((id: ToastId) => {\n window.clearTimeout(timeoutIdRefs.current[id + 'animation']);\n dispatch({ type: 'PLAY_EXIT_ANIMATION', payload: id });\n delete timeoutIdRefs.current[id + 'animation'];\n }, []);\n\n const removeToastWithAnimationAfterDelay = React.useCallback(\n (id: ToastId, delay: number) => {\n timeoutIdRefs.current[id + 'animation'] = window.setTimeout(\n () => playExitAnimation(id),\n delay - EXIT_ANIMATION_TIME,\n );\n timeoutIdRefs.current[id] = window.setTimeout(\n () => removeToast(id),\n delay,\n );\n },\n [timeoutIdRefs, playExitAnimation, removeToast],\n );\n\n const addToast = React.useCallback(\n (toast: AddToastPayload | string) => {\n const id = createUniqueId();\n const payload = createToast(toast, id);\n dispatch({ type: 'ADD_TOAST', payload });\n removeToastWithAnimationAfterDelay(id, delay);\n },\n [delay, removeToastWithAnimationAfterDelay],\n );\n\n const handleMouseEnter = (toast: ToastType) => () => {\n if (toast.isBeingRemoved) return;\n setHovering(toast.id);\n Object.values(timeoutIdRefs.current).forEach(timeoutId => {\n window.clearTimeout(timeoutId);\n });\n timeoutIdRefs.current = {};\n };\n\n const handleMouseLeave = () => {\n setHovering(undefined);\n toasts.forEach(toast => {\n removeToastWithAnimationAfterDelay(toast.id, delay);\n });\n };\n\n const handleClose = (toastId: ToastId) => () => {\n removeToast(toastId);\n handleMouseLeave();\n };\n\n const contextValue = React.useMemo(\n () => ({ toasts, addToast, removeToast }),\n [addToast, removeToast, toasts],\n );\n\n return (\n <ToastContext.Provider value={contextValue}>\n {toasts.length > 0 && (\n <div\n className={classNames(\n 'eds-toast-container',\n `eds-toast-container--${position}`,\n className,\n )}\n style={style}\n >\n {toasts.slice(0, 3).map(toastToShow => (\n <ToastAlertBox\n variant={toastToShow.variant}\n title={toastToShow.title}\n onClose={handleClose(toastToShow.id)}\n onMouseEnter={handleMouseEnter(toastToShow)}\n onMouseLeave={handleMouseLeave}\n closable={hoveringId === toastToShow.id}\n toastIsBeingRemoved={toastToShow.isBeingRemoved}\n key={toastToShow.id}\n >\n {toastToShow.content}\n </ToastAlertBox>\n ))}\n </div>\n )}\n {children}\n </ToastContext.Provider>\n );\n};\n\nexport const useToast: () => {\n addToast: (payload: AddToastPayload | string) => void;\n} = () => {\n const context = React.useContext(ToastContext);\n if (!context) {\n throw new Error(\n 'You need to wrap your component in a ToastProvider component in ' +\n 'order to use the useToast hook',\n );\n }\n const { addToast } = context;\n return {\n addToast,\n };\n};\n","import React from 'react';\nimport copy from 'copy-text-to-clipboard';\n\nimport { IconButton } from '@entur/button';\nimport { CopyIcon } from '@entur/icons';\nimport { PreformattedText } from '@entur/typography';\n\nimport { useToast } from './ToastProvider';\n\nimport './CopyableText.scss';\n\nexport type CopyableTextProps = {\n /** Ekstra klassenavn */\n className?: string;\n /** Tekstinnhold som vises og kopieres */\n children: string;\n /** Hvis du ønsker å kopiere noe annet enn\n * innholdet i children kan du legge det inn her */\n textToCopy?: string;\n /** Overskrift i toast-varselet\n * @default 'Kopiert!'\n */\n successHeading?: string;\n /** Bekreftelsesmelding i toast-varselet\n * @default `${textToCopy} ble kopiert til utklippstavlen.`\n */\n successMessage?: string;\n} & Omit<React.ButtonHTMLAttributes<HTMLDivElement>, 'children'>;\n\nexport const CopyableText = ({\n children,\n successHeading = 'Kopiert!',\n successMessage,\n textToCopy,\n className,\n 'aria-label': ariaLabel = `Kopier ${\n textToCopy ?? children\n } til utklippstavlen`,\n ...rest\n}: CopyableTextProps): JSX.Element => {\n const { addToast } = useToast();\n const buttonRef = React.useRef<HTMLButtonElement>(null);\n const _textToCopy = textToCopy ?? children;\n const _successMessage =\n successMessage ?? `${_textToCopy} ble kopiert til utklippstavlen.`;\n const handleClick = () => {\n buttonRef.current &&\n copy(_textToCopy, {\n target: buttonRef.current,\n }) &&\n addToast({ title: successHeading, content: _successMessage });\n };\n return (\n <div\n className={'eds-copyable-text ' + className}\n style={{ ...rest.style }}\n type=\"button\"\n onClick={handleClick}\n tabIndex={-1}\n aria-label=\"\"\n {...rest}\n >\n <PreformattedText className=\"eds-copyable-text__preformatted-text\">\n <span className=\"eds-copyable-text__displayed-text\">{children}</span>\n <IconButton\n className=\"eds-copyable-text__button\"\n aria-label={ariaLabel}\n type=\"button\"\n ref={buttonRef}\n >\n <CopyIcon className={'eds-copyable-text__button__icon'} />\n </IconButton>\n </PreformattedText>\n </div>\n );\n};\n","import { BaseExpand, ExpandArrow } from '@entur/expand/';\nimport { VariantType } from '@entur/utils';\n\nimport classNames from 'classnames';\nimport React from 'react';\nimport { BannerAlertBoxProps } from './BannerAlertBox';\nimport { BaseAlertBox } from './BaseAlertBox';\nimport './ExpandableAlertBox.scss';\nimport { SmallAlertBoxProps } from './SmallAlertBox';\n\nexport type SmallExpandableAlertBoxProps = ExpandableAlertBoxProps &\n SmallAlertBoxProps;\n\nexport const SmallExpandableAlertBox: React.FC<SmallExpandableAlertBoxProps> =\n props => {\n return <ExpandableAlertBox size=\"small\" {...props} />;\n };\n\nexport type BannerExpandableAlertBoxProps = ExpandableAlertBoxProps &\n BannerAlertBoxProps;\n\nexport const BannerExpandableAlertBox: React.FC<BannerExpandableAlertBoxProps> =\n props => {\n return <ExpandableAlertBox size=\"banner\" {...props} />;\n };\n\n/** @deprecated use variant=\"information\" instead */\nconst info = 'info';\n/** @deprecated use variant=\"negative\" instead */\nconst error = 'error';\n\ntype ExpandableAlertBoxProps = {\n /**Farge og uttrykk på alert-boksen*/\n variant: VariantType | typeof info | typeof error;\n /** Tittelen til ExpandableAlertBox */\n title: React.ReactNode;\n /**Innhold som vises ved ekspandering */\n children: React.ReactNode;\n /**Ekstra klassenavn */\n className?: string;\n /** Tekst som vises på ekspanderingsknappen før åpning\n * @default \"Les mer\"\n */\n openLabel?: string;\n /** Tekst som vises på ekspanderingsknappen når den er åpnet\n * @default \"Lukk\"\n */\n closeLabel?: string;\n [key: string]: any;\n};\n\nconst ExpandableAlertBox: React.FC<ExpandableAlertBoxProps> = ({\n variant,\n title,\n children,\n size,\n className,\n openLabel,\n closeLabel,\n ...rest\n}) => {\n const [open, setopen] = React.useState(false);\n return (\n <BaseAlertBox\n size={size}\n variant={variant}\n className={classNames('eds-expandable-alert-box', className)}\n title={\n <ExpandableAlertBoxTitle\n open={open}\n title={title}\n onClick={() => setopen(!open)}\n openLabel={openLabel}\n closeLabel={closeLabel}\n />\n }\n {...rest}\n >\n <BaseExpand open={open}>{children}</BaseExpand>\n </BaseAlertBox>\n );\n};\n\ntype ExpandableAlertBoxTitleProps = {\n title: React.ReactNode;\n open: boolean;\n openLabel?: string;\n closeLabel?: string;\n onClick: (e: React.MouseEvent) => void;\n};\n\nconst ExpandableAlertBoxTitle: React.FC<ExpandableAlertBoxTitleProps> = ({\n title,\n open,\n openLabel = 'Les mer',\n closeLabel = 'Lukk',\n onClick,\n}) => {\n return (\n <div className=\"eds-expandable-alert-box__title\">\n <div>{title}</div>\n <button\n className=\"eds-expandable-alert-box__button\"\n onClick={onClick}\n type=\"button\"\n >\n {open ? closeLabel : openLabel}\n <ExpandArrow open={open} inline />\n </button>\n </div>\n );\n};\n","import { warnAboutMissingStyles } from '@entur/utils';\nimport './index.scss';\n\nwarnAboutMissingStyles('alert', 'icons');\n\nexport { BannerAlertBox } from './BannerAlertBox';\nexport { ToastAlertBox } from './ToastAlertBox';\nexport { SmallAlertBox } from './SmallAlertBox';\nexport { ToastProvider, useToast } from './ToastProvider';\nexport { CopyableText } from './CopyableText';\nexport * from './ExpandableAlertBox';\n"],"names":["iconsMap","success","icon","ValidationSuccessIcon","description","information","ValidationInfoIcon","warning","ValidationExclamationIcon","negative","ValidationErrorIcon","info","error","BaseAlertBox","_ref","children","className","_ref$closable","closable","_ref$closeButtonLabel","closeButtonLabel","variant","_ref$onClose","onClose","size","title","toastIsBeingRemoved","rest","_objectWithoutPropertiesLoose","_excluded","_React$useState","React","useState","isClosed","setClosed","handleClose","Icon","createElement","_extends","classNames","role","Tooltip","placement","content","IconButton","onClick","type","CloseIcon","BannerAlertBox","props","ToastAlertBox","SmallAlertBox","width","EXIT_ANIMATION_TIME","ToastContext","createContext","toastReducer","prevToasts","action","payload","concat","map","toast","id","isBeingRemoved","filter","createUniqueId","Math","random","toString","substring","createToast","ToastProvider","_ref$delay","delay","_ref$position","position","style","_React$useReducer","useReducer","toasts","dispatch","hoveringId","setHovering","timeoutIdRefs","useRef","removeToast","useCallback","window","clearTimeout","current","playExitAnimation","removeToastWithAnimationAfterDelay","setTimeout","addToast","handleMouseEnter","Object","values","forEach","timeoutId","handleMouseLeave","undefined","toastId","contextValue","useMemo","Provider","value","length","slice","toastToShow","onMouseEnter","onMouseLeave","key","useToast","context","useContext","Error","CopyableText","_ref$successHeading","successHeading","successMessage","textToCopy","_ref$ariaLabel","ariaLabel","_useToast","buttonRef","_textToCopy","_successMessage","handleClick","copy","target","tabIndex","PreformattedText","ref","CopyIcon","SmallExpandableAlertBox","ExpandableAlertBox","BannerExpandableAlertBox","openLabel","closeLabel","open","setopen","ExpandableAlertBoxTitle","BaseExpand","_ref2","_ref2$openLabel","_ref2$closeLabel","ExpandArrow","inline","warnAboutMissingStyles"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAeA,IAAMA,QAAQ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AAO,CAAC;;;;;;;;;;;"}
@@ -1,2 +0,0 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@entur/utils"),t=require("react"),n=require("classnames"),a=require("@entur/icons"),o=require("@entur/button"),r=require("@entur/tooltip"),l=require("copy-text-to-clipboard"),i=require("@entur/typography"),s=require("@entur/expand/");function c(){return c=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var a in n)({}).hasOwnProperty.call(n,a)&&(e[a]=n[a])}return e},c.apply(null,arguments)}function u(e,t){if(null==e)return{};var n={};for(var a in e)if({}.hasOwnProperty.call(e,a)){if(-1!==t.indexOf(a))continue;n[a]=e[a]}return n}var d=["children","className","closable","closeButtonLabel","variant","onClose","size","title","toastIsBeingRemoved"],m={success:{icon:a.ValidationSuccessIcon,description:"Suksessmelding"},information:{icon:a.ValidationInfoIcon,description:"Infomelding"},warning:{icon:a.ValidationExclamationIcon,description:"Varselmelding"},negative:{icon:a.ValidationErrorIcon,description:"Feilmelding"},info:{icon:a.ValidationInfoIcon,description:"Infomelding"},error:{icon:a.ValidationErrorIcon,description:"Feilmelding"}},p=function(e){var l=e.children,i=e.className,s=e.closable,p=void 0!==s&&s,b=e.closeButtonLabel,v=void 0===b?"Lukk":b,f=e.variant,x=e.onClose,E=void 0===x?function(){return{}}:x,y=e.size,_=e.title,g=e.toastIsBeingRemoved,T=u(e,d),N=t.useState(!1),h=N[1];if(N[0])return null;var I=m[f].icon;return t.createElement("div",c({className:n("eds-alert-box","eds-alert-box--"+y,"eds-alert-box--"+f,{"eds-alert-box--toast--exit-animation":g,"eds-alert-box--no-title":!_},i)},T),t.createElement(I,{role:"img",className:"eds-alert-box__icon","aria-label":m[f].description}),t.createElement("div",{className:n("eds-alert-box__content",{"eds-alert-box__content--no-children":!l})},_&&t.createElement("div",{className:"eds-alert-box__title"},_),l&&l),p&&t.createElement(r.Tooltip,{className:"eds-alert-box__tooltip","aria-hidden":!0,placement:"bottom",content:"Lukk"},t.createElement(o.IconButton,{className:"eds-alert-box__close-button","aria-label":v,onClick:function(){h(!0),E()},type:"button"},t.createElement(a.CloseIcon,null))))},b=function(e){return t.createElement(p,c({},e,{size:"toast",role:"status"}))},v=["className","width","onClose","closable","closeButtonLabel"],f=t.createContext(null),x=function(e,t){switch(t.type){case"ADD_TOAST":return[t.payload].concat(e);case"PLAY_EXIT_ANIMATION":return e.map((function(e){return e.id===t.payload?c({},e,{isBeingRemoved:!0}):e}));case"REMOVE_TOAST":return e.filter((function(e){return e.id!==t.payload}))}},E=function(){var e=t.useContext(f);if(!e)throw new Error("You need to wrap your component in a ToastProvider component in order to use the useToast hook");return{addToast:e.addToast}},y=["children","successHeading","successMessage","textToCopy","className","aria-label"],_=["variant","title","children","size","className","openLabel","closeLabel"],g=function(e){var a=e.variant,o=e.title,r=e.children,l=e.size,i=e.className,d=e.openLabel,m=e.closeLabel,b=u(e,_),v=t.useState(!1),f=v[0],x=v[1];return t.createElement(p,c({size:l,variant:a,className:n("eds-expandable-alert-box",i),title:t.createElement(T,{open:f,title:o,onClick:function(){return x(!f)},openLabel:d,closeLabel:m})},b),t.createElement(s.BaseExpand,{open:f},r))},T=function(e){var n=e.open,a=e.openLabel,o=void 0===a?"Les mer":a,r=e.closeLabel,l=void 0===r?"Lukk":r,i=e.onClick;return t.createElement("div",{className:"eds-expandable-alert-box__title"},t.createElement("div",null,e.title),t.createElement("button",{className:"eds-expandable-alert-box__button",onClick:i,type:"button"},n?l:o,t.createElement(s.ExpandArrow,{open:n,inline:!0})))};e.warnAboutMissingStyles("alert","icons"),exports.BannerAlertBox=function(e){return t.createElement(p,c({},e,{size:"banner"}))},exports.BannerExpandableAlertBox=function(e){return t.createElement(g,c({size:"banner"},e))},exports.CopyableText=function(e){var n=e.children,r=e.successHeading,s=void 0===r?"Kopiert!":r,d=e.successMessage,m=e.textToCopy,p=e.className,b=e["aria-label"],v=void 0===b?"Kopier "+(null!=m?m:n)+" til utklippstavlen":b,f=u(e,y),x=E().addToast,_=t.useRef(null),g=null!=m?m:n,T=null!=d?d:g+" ble kopiert til utklippstavlen.";return t.createElement("div",c({className:"eds-copyable-text "+p,style:c({},f.style),type:"button",onClick:function(){_.current&&l(g,{target:_.current})&&x({title:s,content:T})},tabIndex:-1,"aria-label":""},f),t.createElement(i.PreformattedText,{className:"eds-copyable-text__preformatted-text"},t.createElement("span",{className:"eds-copyable-text__displayed-text"},n),t.createElement(o.IconButton,{className:"eds-copyable-text__button","aria-label":v,type:"button",ref:_},t.createElement(a.CopyIcon,{className:"eds-copyable-text__button__icon"}))))},exports.SmallAlertBox=function(e){var a=e.className,o=e.width,r=e.onClose,l=e.closable,i=void 0!==l&&l,s=e.closeButtonLabel,d=u(e,v);return t.createElement(p,c({className:n(a,{"eds-alert-box--fit-content":"fit-content"===o})},d,{onClose:r,closable:i,closeButtonLabel:s,size:"small"}))},exports.SmallExpandableAlertBox=function(e){return t.createElement(g,c({size:"small"},e))},exports.ToastAlertBox=b,exports.ToastProvider=function(e){var a=e.delay,o=void 0===a?6e3:a,r=e.children,l=e.position,i=void 0===l?"bottom-right":l,s=e.className,u=e.style,d=t.useReducer(x,[]),m=d[0],p=d[1],v=t.useState(),E=v[0],y=v[1],_=t.useRef({}),g=t.useCallback((function(e){window.clearTimeout(_.current[e]),p({type:"REMOVE_TOAST",payload:e}),delete _.current[e]}),[]),T=t.useCallback((function(e){window.clearTimeout(_.current[e+"animation"]),p({type:"PLAY_EXIT_ANIMATION",payload:e}),delete _.current[e+"animation"]}),[]),N=t.useCallback((function(e,t){_.current[e+"animation"]=window.setTimeout((function(){return T(e)}),t-400),_.current[e]=window.setTimeout((function(){return g(e)}),t)}),[_,T,g]),h=t.useCallback((function(e){var t=Math.random().toString().substring(2),n=function(e,t){return"string"==typeof e?{id:t,content:e,variant:"success",isBeingRemoved:!1}:c({id:t,variant:"success",isBeingRemoved:!1},e)}(e,t);p({type:"ADD_TOAST",payload:n}),N(t,o)}),[o,N]),I=function(){y(void 0),m.forEach((function(e){N(e.id,o)}))},B=t.useMemo((function(){return{toasts:m,addToast:h,removeToast:g}}),[h,g,m]);return t.createElement(f.Provider,{value:B},m.length>0&&t.createElement("div",{className:n("eds-toast-container","eds-toast-container--"+i,s),style:u},m.slice(0,3).map((function(e){return t.createElement(b,{variant:e.variant,title:e.title,onClose:(a=e.id,function(){g(a),I()}),onMouseEnter:(n=e,function(){n.isBeingRemoved||(y(n.id),Object.values(_.current).forEach((function(e){window.clearTimeout(e)})),_.current={})}),onMouseLeave:I,closable:E===e.id,toastIsBeingRemoved:e.isBeingRemoved,key:e.id},e.content);var n,a}))),r)},exports.useToast=E;
2
- //# sourceMappingURL=alert.cjs.production.min.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"alert.cjs.production.min.js","sources":["../src/BaseAlertBox.tsx","../src/ToastAlertBox.tsx","../src/ToastProvider.tsx","../src/ExpandableAlertBox.tsx","../src/index.tsx","../src/BannerAlertBox.tsx","../src/CopyableText.tsx","../src/SmallAlertBox.tsx"],"sourcesContent":["import React from 'react';\nimport classNames from 'classnames';\nimport {\n CloseIcon,\n ValidationSuccessIcon,\n ValidationExclamationIcon,\n ValidationInfoIcon,\n ValidationErrorIcon,\n} from '@entur/icons';\nimport { IconButton } from '@entur/button';\nimport { Tooltip } from '@entur/tooltip';\nimport { VariantType } from '@entur/utils';\n\nimport './BaseAlertBox.scss';\n\nconst iconsMap = {\n success: {\n icon: ValidationSuccessIcon,\n description: 'Suksessmelding',\n },\n information: { icon: ValidationInfoIcon, description: 'Infomelding' },\n warning: {\n icon: ValidationExclamationIcon,\n description: 'Varselmelding',\n },\n negative: { icon: ValidationErrorIcon, description: 'Feilmelding' },\n //deprecated\n info: { icon: ValidationInfoIcon, description: 'Infomelding' },\n error: { icon: ValidationErrorIcon, description: 'Feilmelding' },\n};\n\n/** @deprecated use variant=\"information\" instead */\nconst info = 'info';\n/** @deprecated use variant=\"negative\" instead */\nconst error = 'error';\n\ntype BaseAlertBoxProps = {\n /** Innholdet i alert-boksen */\n children?: React.ReactNode;\n /** Ekstra klassenavn */\n className?: string;\n /** Skjermleser-label for lukkeknappen, om den vises\n * @default \"Lukk\"\n */\n closeButtonLabel?: string;\n /** Callback som kalles når man lukker boksen\n * @default () => {}\n */\n onClose?: () => void;\n /** Om denne er true, vil boksen få en lukkeknapp i høyre hjørne\n * @default false\n */\n closable?: boolean;\n /** Tittel på boksen - oppsummer virkning */\n title?: React.ReactNode;\n /** Farge og uttrykk på alert-boksen */\n variant: VariantType | typeof info | typeof error;\n /** Typen boks (internt bruk) */\n size: 'banner' | 'toast' | 'small';\n [key: string]: any;\n};\n\nexport const BaseAlertBox: React.FC<BaseAlertBoxProps> = ({\n children,\n className,\n closable = false,\n closeButtonLabel = 'Lukk',\n variant,\n onClose = () => ({}),\n size,\n title,\n toastIsBeingRemoved,\n ...rest\n}) => {\n const [isClosed, setClosed] = React.useState(false);\n if (isClosed) {\n return null;\n }\n const handleClose = () => {\n setClosed(true);\n onClose();\n };\n const Icon = iconsMap[variant].icon;\n return (\n <div\n className={classNames(\n 'eds-alert-box',\n `eds-alert-box--${size}`,\n `eds-alert-box--${variant}`,\n {\n 'eds-alert-box--toast--exit-animation': toastIsBeingRemoved,\n 'eds-alert-box--no-title': !title,\n },\n className,\n )}\n {...rest}\n >\n <Icon\n role=\"img\"\n className=\"eds-alert-box__icon\"\n aria-label={iconsMap[variant].description}\n />\n <div\n className={classNames('eds-alert-box__content', {\n 'eds-alert-box__content--no-children': !children,\n })}\n >\n {title && <div className=\"eds-alert-box__title\">{title}</div>}\n {children && children}\n </div>\n {closable && (\n <Tooltip\n className=\"eds-alert-box__tooltip\"\n aria-hidden\n placement=\"bottom\"\n content=\"Lukk\"\n >\n <IconButton\n className=\"eds-alert-box__close-button\"\n aria-label={closeButtonLabel}\n onClick={handleClose}\n type=\"button\"\n >\n <CloseIcon />\n </IconButton>\n </Tooltip>\n )}\n </div>\n );\n};\n","import React from 'react';\nimport { BaseAlertBox } from './BaseAlertBox';\nimport './ToastAlertBox.scss';\n\n/** @deprecated use variant=\"information\" instead */\nconst info = 'info';\n\nexport type ToastAlertBoxProps = {\n /** Innholdet i toasten */\n children?: React.ReactNode;\n /** Ekstra klassenavn */\n className?: string;\n /** Skjermleser-label for lukkeknappen, om den vises */\n closeButtonLabel?: string;\n /** Callback som kalles når man lukker boksen */\n onClose?: () => void;\n /** Om denne er true, vil boksen få en lukkeknapp i høyre hjørne */\n closable?: boolean;\n /** Tittel på boksen - oppsummer virkning */\n title?: string;\n /** Farge og uttrykk på toasten */\n variant: 'success' | 'information' | typeof info;\n [key: string]: any;\n};\n\nexport const ToastAlertBox: React.FC<ToastAlertBoxProps> = props => (\n <BaseAlertBox {...props} size=\"toast\" role=\"status\" />\n);\n","import React from 'react';\nimport { ToastAlertBox } from './ToastAlertBox';\nimport classNames from 'classnames';\n\ntype ToastId = string;\n\n/** @deprecated use variant=\"information\" instead */\nconst info = 'info';\n\nexport type ToastVariants = 'success' | 'information' | typeof info;\n\ntype ToastType = {\n title?: string;\n content: React.ReactNode;\n id: ToastId;\n variant: ToastVariants;\n isBeingRemoved: boolean;\n};\n\ntype ToastContextType = {\n addToast: (payload: AddToastPayload | string) => void;\n removeToast: (id: ToastId) => void;\n toasts: ToastType[];\n};\n\nexport type AddToastPayload = {\n title?: string;\n content: React.ReactNode;\n variant?: ToastVariants;\n};\n\ntype ToastAction =\n | { type: 'ADD_TOAST'; payload: ToastType }\n | { type: 'REMOVE_TOAST'; payload: ToastId }\n | { type: 'PLAY_EXIT_ANIMATION'; payload: ToastId };\n\nconst EXIT_ANIMATION_TIME = 400;\n\nconst ToastContext = React.createContext<ToastContextType | null>(null);\n\nconst toastReducer = (\n prevToasts: ToastType[],\n action: ToastAction,\n): ToastType[] => {\n switch (action.type) {\n case 'ADD_TOAST':\n return [action.payload, ...prevToasts];\n case 'PLAY_EXIT_ANIMATION':\n return prevToasts.map(toast => {\n if (toast.id === action.payload)\n return { ...toast, isBeingRemoved: true };\n return toast;\n });\n case 'REMOVE_TOAST':\n return prevToasts.filter(toast => toast.id !== action.payload);\n }\n};\n\nconst createUniqueId = () => Math.random().toString().substring(2);\n\nconst createToast = (\n toast: AddToastPayload | string,\n id: ToastId,\n): ToastType => {\n if (typeof toast === 'string') {\n return { id, content: toast, variant: 'success', isBeingRemoved: false };\n } else {\n return { id, variant: 'success', isBeingRemoved: false, ...toast };\n }\n};\n\nexport type ToastProviderProps = {\n /** Antall millisekunder før toasts forsvinner av seg selv\n * @default 6000\n */\n delay?: number;\n /** Plasseringen av toasts\n * @default \"bottom-right\"\n */\n position?: 'bottom-right' | 'top-right';\n /** Ekstra klassenavn til ToastProvider-wrapperen */\n className?: string;\n /** Ekstra styling som sendes til ToastProvider-wrapperen */\n style?: React.CSSProperties;\n /** Innholdet */\n children: React.ReactNode;\n};\n\nexport const ToastProvider: React.FC<ToastProviderProps> = ({\n delay = 6000,\n children,\n position = 'bottom-right',\n className,\n style,\n}) => {\n const [toasts, dispatch] = React.useReducer(toastReducer, []);\n const [hoveringId, setHovering] = React.useState<string>();\n const timeoutIdRefs = React.useRef<{ [key: string]: number }>({});\n\n const removeToast = React.useCallback((id: ToastId) => {\n window.clearTimeout(timeoutIdRefs.current[id]);\n dispatch({ type: 'REMOVE_TOAST', payload: id });\n delete timeoutIdRefs.current[id];\n }, []);\n\n const playExitAnimation = React.useCallback((id: ToastId) => {\n window.clearTimeout(timeoutIdRefs.current[id + 'animation']);\n dispatch({ type: 'PLAY_EXIT_ANIMATION', payload: id });\n delete timeoutIdRefs.current[id + 'animation'];\n }, []);\n\n const removeToastWithAnimationAfterDelay = React.useCallback(\n (id: ToastId, delay: number) => {\n timeoutIdRefs.current[id + 'animation'] = window.setTimeout(\n () => playExitAnimation(id),\n delay - EXIT_ANIMATION_TIME,\n );\n timeoutIdRefs.current[id] = window.setTimeout(\n () => removeToast(id),\n delay,\n );\n },\n [timeoutIdRefs, playExitAnimation, removeToast],\n );\n\n const addToast = React.useCallback(\n (toast: AddToastPayload | string) => {\n const id = createUniqueId();\n const payload = createToast(toast, id);\n dispatch({ type: 'ADD_TOAST', payload });\n removeToastWithAnimationAfterDelay(id, delay);\n },\n [delay, removeToastWithAnimationAfterDelay],\n );\n\n const handleMouseEnter = (toast: ToastType) => () => {\n if (toast.isBeingRemoved) return;\n setHovering(toast.id);\n Object.values(timeoutIdRefs.current).forEach(timeoutId => {\n window.clearTimeout(timeoutId);\n });\n timeoutIdRefs.current = {};\n };\n\n const handleMouseLeave = () => {\n setHovering(undefined);\n toasts.forEach(toast => {\n removeToastWithAnimationAfterDelay(toast.id, delay);\n });\n };\n\n const handleClose = (toastId: ToastId) => () => {\n removeToast(toastId);\n handleMouseLeave();\n };\n\n const contextValue = React.useMemo(\n () => ({ toasts, addToast, removeToast }),\n [addToast, removeToast, toasts],\n );\n\n return (\n <ToastContext.Provider value={contextValue}>\n {toasts.length > 0 && (\n <div\n className={classNames(\n 'eds-toast-container',\n `eds-toast-container--${position}`,\n className,\n )}\n style={style}\n >\n {toasts.slice(0, 3).map(toastToShow => (\n <ToastAlertBox\n variant={toastToShow.variant}\n title={toastToShow.title}\n onClose={handleClose(toastToShow.id)}\n onMouseEnter={handleMouseEnter(toastToShow)}\n onMouseLeave={handleMouseLeave}\n closable={hoveringId === toastToShow.id}\n toastIsBeingRemoved={toastToShow.isBeingRemoved}\n key={toastToShow.id}\n >\n {toastToShow.content}\n </ToastAlertBox>\n ))}\n </div>\n )}\n {children}\n </ToastContext.Provider>\n );\n};\n\nexport const useToast: () => {\n addToast: (payload: AddToastPayload | string) => void;\n} = () => {\n const context = React.useContext(ToastContext);\n if (!context) {\n throw new Error(\n 'You need to wrap your component in a ToastProvider component in ' +\n 'order to use the useToast hook',\n );\n }\n const { addToast } = context;\n return {\n addToast,\n };\n};\n","import { BaseExpand, ExpandArrow } from '@entur/expand/';\nimport { VariantType } from '@entur/utils';\n\nimport classNames from 'classnames';\nimport React from 'react';\nimport { BannerAlertBoxProps } from './BannerAlertBox';\nimport { BaseAlertBox } from './BaseAlertBox';\nimport './ExpandableAlertBox.scss';\nimport { SmallAlertBoxProps } from './SmallAlertBox';\n\nexport type SmallExpandableAlertBoxProps = ExpandableAlertBoxProps &\n SmallAlertBoxProps;\n\nexport const SmallExpandableAlertBox: React.FC<SmallExpandableAlertBoxProps> =\n props => {\n return <ExpandableAlertBox size=\"small\" {...props} />;\n };\n\nexport type BannerExpandableAlertBoxProps = ExpandableAlertBoxProps &\n BannerAlertBoxProps;\n\nexport const BannerExpandableAlertBox: React.FC<BannerExpandableAlertBoxProps> =\n props => {\n return <ExpandableAlertBox size=\"banner\" {...props} />;\n };\n\n/** @deprecated use variant=\"information\" instead */\nconst info = 'info';\n/** @deprecated use variant=\"negative\" instead */\nconst error = 'error';\n\ntype ExpandableAlertBoxProps = {\n /**Farge og uttrykk på alert-boksen*/\n variant: VariantType | typeof info | typeof error;\n /** Tittelen til ExpandableAlertBox */\n title: React.ReactNode;\n /**Innhold som vises ved ekspandering */\n children: React.ReactNode;\n /**Ekstra klassenavn */\n className?: string;\n /** Tekst som vises på ekspanderingsknappen før åpning\n * @default \"Les mer\"\n */\n openLabel?: string;\n /** Tekst som vises på ekspanderingsknappen når den er åpnet\n * @default \"Lukk\"\n */\n closeLabel?: string;\n [key: string]: any;\n};\n\nconst ExpandableAlertBox: React.FC<ExpandableAlertBoxProps> = ({\n variant,\n title,\n children,\n size,\n className,\n openLabel,\n closeLabel,\n ...rest\n}) => {\n const [open, setopen] = React.useState(false);\n return (\n <BaseAlertBox\n size={size}\n variant={variant}\n className={classNames('eds-expandable-alert-box', className)}\n title={\n <ExpandableAlertBoxTitle\n open={open}\n title={title}\n onClick={() => setopen(!open)}\n openLabel={openLabel}\n closeLabel={closeLabel}\n />\n }\n {...rest}\n >\n <BaseExpand open={open}>{children}</BaseExpand>\n </BaseAlertBox>\n );\n};\n\ntype ExpandableAlertBoxTitleProps = {\n title: React.ReactNode;\n open: boolean;\n openLabel?: string;\n closeLabel?: string;\n onClick: (e: React.MouseEvent) => void;\n};\n\nconst ExpandableAlertBoxTitle: React.FC<ExpandableAlertBoxTitleProps> = ({\n title,\n open,\n openLabel = 'Les mer',\n closeLabel = 'Lukk',\n onClick,\n}) => {\n return (\n <div className=\"eds-expandable-alert-box__title\">\n <div>{title}</div>\n <button\n className=\"eds-expandable-alert-box__button\"\n onClick={onClick}\n type=\"button\"\n >\n {open ? closeLabel : openLabel}\n <ExpandArrow open={open} inline />\n </button>\n </div>\n );\n};\n","import { warnAboutMissingStyles } from '@entur/utils';\nimport './index.scss';\n\nwarnAboutMissingStyles('alert', 'icons');\n\nexport { BannerAlertBox } from './BannerAlertBox';\nexport { ToastAlertBox } from './ToastAlertBox';\nexport { SmallAlertBox } from './SmallAlertBox';\nexport { ToastProvider, useToast } from './ToastProvider';\nexport { CopyableText } from './CopyableText';\nexport * from './ExpandableAlertBox';\n","import React from 'react';\nimport { BaseAlertBox } from './BaseAlertBox';\n\nimport { VariantType } from '@entur/utils';\n\n/** @deprecated use variant=\"information\" instead */\nconst info = 'info';\n/** @deprecated use variant=\"negative\" instead */\nconst error = 'error';\n\nexport type BannerAlertBoxProps = {\n /** Innholdet i alert-boksen */\n children: React.ReactNode;\n /** Ekstra klassenavn */\n className?: string;\n /** Skjermleser-label for lukkeknappen, om den vises */\n closeButtonLabel?: string;\n /** Callback som kalles når man lukker boksen */\n onClose?: () => void;\n /** Om denne er true, vil boksen få en lukkeknapp i høyre hjørne\n * @default false\n */\n closable?: boolean;\n /** Tittel på boksen - oppsummer virkning */\n title?: string;\n /** Farge og uttrykk på alert-boksen */\n variant: VariantType | typeof info | typeof error;\n [key: string]: any;\n};\n\nexport const BannerAlertBox: React.FC<BannerAlertBoxProps> = props => (\n <BaseAlertBox {...props} size=\"banner\" />\n);\n","import React from 'react';\nimport copy from 'copy-text-to-clipboard';\n\nimport { IconButton } from '@entur/button';\nimport { CopyIcon } from '@entur/icons';\nimport { PreformattedText } from '@entur/typography';\n\nimport { useToast } from './ToastProvider';\n\nimport './CopyableText.scss';\n\nexport type CopyableTextProps = {\n /** Ekstra klassenavn */\n className?: string;\n /** Tekstinnhold som vises og kopieres */\n children: string;\n /** Hvis du ønsker å kopiere noe annet enn\n * innholdet i children kan du legge det inn her */\n textToCopy?: string;\n /** Overskrift i toast-varselet\n * @default 'Kopiert!'\n */\n successHeading?: string;\n /** Bekreftelsesmelding i toast-varselet\n * @default `${textToCopy} ble kopiert til utklippstavlen.`\n */\n successMessage?: string;\n} & Omit<React.ButtonHTMLAttributes<HTMLDivElement>, 'children'>;\n\nexport const CopyableText = ({\n children,\n successHeading = 'Kopiert!',\n successMessage,\n textToCopy,\n className,\n 'aria-label': ariaLabel = `Kopier ${\n textToCopy ?? children\n } til utklippstavlen`,\n ...rest\n}: CopyableTextProps): JSX.Element => {\n const { addToast } = useToast();\n const buttonRef = React.useRef<HTMLButtonElement>(null);\n const _textToCopy = textToCopy ?? children;\n const _successMessage =\n successMessage ?? `${_textToCopy} ble kopiert til utklippstavlen.`;\n const handleClick = () => {\n buttonRef.current &&\n copy(_textToCopy, {\n target: buttonRef.current,\n }) &&\n addToast({ title: successHeading, content: _successMessage });\n };\n return (\n <div\n className={'eds-copyable-text ' + className}\n style={{ ...rest.style }}\n type=\"button\"\n onClick={handleClick}\n tabIndex={-1}\n aria-label=\"\"\n {...rest}\n >\n <PreformattedText className=\"eds-copyable-text__preformatted-text\">\n <span className=\"eds-copyable-text__displayed-text\">{children}</span>\n <IconButton\n className=\"eds-copyable-text__button\"\n aria-label={ariaLabel}\n type=\"button\"\n ref={buttonRef}\n >\n <CopyIcon className={'eds-copyable-text__button__icon'} />\n </IconButton>\n </PreformattedText>\n </div>\n );\n};\n","import React from 'react';\nimport classNames from 'classnames';\nimport { BaseAlertBox } from './BaseAlertBox';\n\nimport { VariantType } from '@entur/utils';\n\n/** @deprecated use variant=\"information\" instead */\nconst info = 'info';\n/** @deprecated use variant=\"negative\" instead */\nconst error = 'error';\n\nexport type SmallAlertBoxProps = {\n /** Innholdet i alert-boksen */\n children: React.ReactNode;\n /** Ekstra klassenavn */\n className?: string;\n /** Skjermleser-label for lukkeknappen, om den vises */\n closeButtonLabel?: string;\n /** Om denne er true, vil boksen få en lukkeknapp i høyre hjørne\n * @default false\n */\n closable?: boolean;\n /** Callback som kalles når man lukker boksen */\n onClose?: () => void;\n /** Tittel på boksen - oppsummer virkning */\n title?: string;\n /** Bredden på boksen - fullbredde eller tilpasset innholdet */\n width?: 'fluid' | 'fit-content';\n /** Farge og uttrykk på alert-boksen*/\n variant: VariantType | typeof info | typeof error;\n [key: string]: any;\n};\n\nexport const SmallAlertBox: React.FC<SmallAlertBoxProps> = ({\n className,\n width,\n onClose,\n closable = false,\n closeButtonLabel,\n ...rest\n}) => (\n <BaseAlertBox\n className={classNames(className, {\n 'eds-alert-box--fit-content': width === 'fit-content',\n })}\n {...rest}\n onClose={onClose}\n closable={closable}\n closeButtonLabel={closeButtonLabel}\n size=\"small\"\n />\n);\n"],"names":["iconsMap","success","icon","ValidationSuccessIcon","description","information","ValidationInfoIcon","warning","ValidationExclamationIcon","negative","ValidationErrorIcon","info","error","BaseAlertBox","_ref","children","className","_ref$closable","closable","_ref$closeButtonLabel","closeButtonLabel","variant","_ref$onClose","onClose","size","title","toastIsBeingRemoved","rest","_objectWithoutPropertiesLoose","_excluded","_React$useState","React","useState","setClosed","Icon","createElement","_extends","classNames","role","Tooltip","placement","content","IconButton","onClick","type","CloseIcon","ToastAlertBox","props","ToastContext","createContext","toastReducer","prevToasts","action","payload","concat","map","toast","id","isBeingRemoved","filter","useToast","context","useContext","Error","addToast","ExpandableAlertBox","openLabel","closeLabel","open","setopen","ExpandableAlertBoxTitle","BaseExpand","_ref2","_ref2$openLabel","_ref2$closeLabel","ExpandArrow","inline","warnAboutMissingStyles","_ref$successHeading","successHeading","successMessage","textToCopy","_ref$ariaLabel","ariaLabel","buttonRef","useRef","_textToCopy","_successMessage","style","current","copy","target","tabIndex","PreformattedText","ref","CopyIcon","width","_ref$delay","delay","_ref$position","position","_React$useReducer","useReducer","toasts","dispatch","hoveringId","setHovering","timeoutIdRefs","removeToast","useCallback","window","clearTimeout","playExitAnimation","removeToastWithAnimationAfterDelay","setTimeout","Math","random","toString","substring","createToast","handleMouseLeave","undefined","forEach","contextValue","useMemo","Provider","value","length","slice","toastToShow","toastId","onMouseEnter","Object","values","timeoutId","onMouseLeave","key"],"mappings":"wxBAeMA,EAAW,CACfC,QAAS,CACPC,KAAMC,EAAqBA,sBAC3BC,YAAa,kBAEfC,YAAa,CAAEH,KAAMI,EAAkBA,mBAAEF,YAAa,eACtDG,QAAS,CACPL,KAAMM,EAAyBA,0BAC/BJ,YAAa,iBAEfK,SAAU,CAAEP,KAAMQ,EAAmBA,oBAAEN,YAAa,eAEpDO,KAAM,CAAET,KAAMI,EAAkBA,mBAAEF,YAAa,eAC/CQ,MAAO,CAAEV,KAAMQ,EAAmBA,oBAAEN,YAAa,gBAkCtCS,EAA4C,SAAhCC,GAWpB,IAVHC,EAAQD,EAARC,SACAC,EAASF,EAATE,UAASC,EAAAH,EACTI,SAAAA,OAAW,IAAHD,GAAQA,EAAAE,EAAAL,EAChBM,iBAAAA,OAAmB,IAAHD,EAAG,OAAMA,EACzBE,EAAOP,EAAPO,QAAOC,EAAAR,EACPS,QAAAA,OAAU,IAAHD,EAAG,WAAA,MAAO,EAAE,EAACA,EACpBE,EAAIV,EAAJU,KACAC,EAAKX,EAALW,MACAC,EAAmBZ,EAAnBY,oBACGC,EAAIC,EAAAd,EAAAe,GAEPC,EAA8BC,EAAMC,UAAS,GAA5BC,EAASH,EAAA,GAC1B,GADeA,EAAA,GAEb,OAAO,KAET,IAIMI,EAAOlC,EAASqB,GAASnB,KAC/B,OACE6B,EAAAI,cAAA,MAAAC,EAAA,CACEpB,UAAWqB,EACT,kCACkBb,EAAI,kBACJH,EAClB,CACE,uCAAwCK,EACxC,2BAA4BD,GAE9BT,IAEEW,GAEJI,EAAAI,cAACD,EACC,CAAAI,KAAK,MACLtB,UAAU,sBAAqB,a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