@entur/alert 0.11.17 → 0.11.19

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/LICENSE.md CHANGED
@@ -208,74 +208,3 @@ The European Commission may update this Appendix to later versions of the above
208
208
  a new version of the EUPL, as long as they provide the rights granted in Article 2 of this Licence and protect the
209
209
  covered Source Code from exclusive appropriation.
210
210
  All other changes or additions to this Appendix require the production of a new EUPL version.
211
-
212
- # Standard Nucleo License
213
-
214
- - Last updated: July 2, 2018
215
- - [Github repo](https://github.com/NucleoApp/license-standard)
216
-
217
- By purchasing the Nucleo icons, you have the right to:
218
-
219
- - Use the Nucleo icons in unlimited personal and commercial projects, for yourself or a client, with no limitation to the number of impressions for your end product.
220
- - Use the Nucleo icons in applications, software, UI/UX design, print, and logo design.
221
- - Modify the Nucleo icons to create your icon variations.
222
-
223
- You don't have the right to:
224
-
225
- - Sublicense, resell, share, transfer, or otherwise redistribute the Nucleo icons (even for free or within a more complex downloadable file).
226
- - Use the Nucleo icons in a product that is directly competitive with Nucleo.
227
-
228
- ## Limitations & Extended license
229
-
230
- - **For each project, you can use a maximum of 250 Nucleo icons** (intended per unique style: for example, if you're using the same icon in both the outline and glyph styles, or in 2 different sizes, you're using 2 icons). You can lift this limit by purchasing an Extended License.
231
- - If you're using Nucleo icons in templates, themes or plugins offered for sale, you can use a maximum of 100 Nucleo icons. You can lift this limit by purchasing an Extended License.
232
- - If you're using the Nucleo icons in open source projects, you can use a maximum of 100 Nucleo icons.
233
- - If you're interested in using the Nucleo icons in items offered for sale (or for free) where the Nucleo icons contribute to the core value of the product being sold/shared, you will need an Extended License (e.g., a CMS where users can browse the Nucleo icons and pick the ones to include in their design).
234
-
235
- [Learn more about the Extended License](https://nucleoapp.com/extended-license)
236
-
237
- ## Freelance Projects & Contracted work
238
-
239
- If you're working on a project for a client, you can share with your client a maximum of 250 Nucleo icons per project. You can't share the Nucleo source files unless the client purchases a license.
240
-
241
- If the Nucleo icons contribute to the core value of the product being sold/shared, or if you (or your client) wish to include more than 250 icons in the project, the [Extended License](https://nucleoapp.com/extended-license) is required.
242
-
243
- ## Templates, Themes, UI Kits & Plugins
244
-
245
- If you're using Nucleo icons in templates, themes or plugins offered for sale (e.g., UI kits, Wordpress Themes, HTML/CSS Templates), **you can include up to 100 icons in the downloadable source files**. This limitation applies to the icon fonts as well.
246
-
247
- The downloadable source file has to include the [Nucleo Copyright Notice](https://nucleoapp.com/copyright-notice).
248
-
249
- If the Nucleo icons contribute to the core value of the template, theme or plugin sold (e.g., a theme builder where users can browse Nucleo icons and pick the ones to include in their design), or if you wish to use more than 100 Nucleo icons, you will need an [Extended License](https://nucleoapp.com/extended-license).
250
-
251
- It's not possible to purchase an Extended License if the template, theme or plugin is distributed for free.
252
-
253
- If you're offering a free and pro version of your product, the free version cannot include more than 100 icons even if you purchased an Extended License to lift the limit. The Extended License applies only to the pro version of your product.
254
-
255
- ## Open source projects
256
-
257
- If you're using the Nucleo icons in open source projects, **you can include up to 100 icons in the downloadable source files**. This limitation applies to the icon fonts as well.
258
-
259
- The downloadable source file has to include the [Nucleo Copyright Notice](https://nucleoapp.com/copyright-notice).
260
-
261
- It's not possible to purchase an Extended License for open source projects.
262
-
263
- ## Sharing Nucleo icons with team members
264
-
265
- If you're the sole owner of a Nucleo license, you can share with your team members only the icons used in your work, with a maximum of 250 icons (e.g., if you're a designer, you can share with the developers of your team only the Nucleo icons used in your design files).
266
-
267
- Your team members cannot reuse the Nucleo icons in other projects unless they purchase a license.
268
-
269
- If more than one team member needs access to the Nucleo icons, you can consider purchasing a [team license](https://nucleoapp.com/pricing).
270
-
271
- ## Design systems
272
-
273
- If you wish to include the Nucleo icons in a design system available on a public server, you can use a maximum of 250 Nucleo icons, even if your team purchased a Nucleo team license.
274
-
275
- If the design system is accessible only by the members of your organization (e.g., is hosted on a password protected server), but you're the sole owner of a Nucleo license, you can share with your colleagues a maximum of 250 Nucleo icons.
276
-
277
- If the design system is on a public server, you can lift the 250 icons limit by buying an [Extended License](https://nucleoapp.com/extended-license). However, please keep in mind you can't provide a link/button to download all the icons.
278
-
279
- If your team purchased a Nucleo team license that covers all the users with access to the design system, and the design system is not public (e.g., is hosted on a password protected server), then there's no limitation to the number of icons that can be included.
280
-
281
- If you're still unclear about what is or isn't allowed under this license, please contact us at info@nucleoapp.com.
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- export declare type BannerAlertBoxProps = {
2
+ export type BannerAlertBoxProps = {
3
3
  /** Innholdet i alert-boksen */
4
4
  children: React.ReactNode;
5
5
  /** Ekstra klassenavn */
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
  import './styles.scss';
3
- declare type BaseAlertBoxProps = {
3
+ type BaseAlertBoxProps = {
4
4
  /** Innholdet i alert-boksen */
5
5
  children?: React.ReactNode;
6
6
  /** Ekstra klassenavn */
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
  import './CopyableText.scss';
3
- export declare type CopyableTextProps = {
3
+ export type CopyableTextProps = {
4
4
  /** Ekstra klassenavn */
5
5
  className?: string;
6
6
  /** Tekstinnhold som vises og kopieres */
@@ -2,11 +2,11 @@ import React from 'react';
2
2
  import { BannerAlertBoxProps } from './BannerAlertBox';
3
3
  import './ExpandableAlertBox.scss';
4
4
  import { SmallAlertBoxProps } from './SmallAlertBox';
5
- export declare type SmallExpandableAlertBoxProps = ExpandableAlertBoxProps & SmallAlertBoxProps;
5
+ export type SmallExpandableAlertBoxProps = ExpandableAlertBoxProps & SmallAlertBoxProps;
6
6
  export declare const SmallExpandableAlertBox: React.FC<SmallExpandableAlertBoxProps>;
7
- export declare type BannerExpandableAlertBoxProps = ExpandableAlertBoxProps & BannerAlertBoxProps;
7
+ export type BannerExpandableAlertBoxProps = ExpandableAlertBoxProps & BannerAlertBoxProps;
8
8
  export declare const BannerExpandableAlertBox: React.FC<BannerExpandableAlertBoxProps>;
9
- declare type ExpandableAlertBoxProps = {
9
+ type ExpandableAlertBoxProps = {
10
10
  /**Farge og uttrykk på alert-boksen */
11
11
  variant: 'success' | 'info' | 'warning' | 'error';
12
12
  /** Tittelen til ExpandableAlertBox */
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- export declare type SmallAlertBoxProps = {
2
+ export type SmallAlertBoxProps = {
3
3
  /** Innholdet i alert-boksen */
4
4
  children: React.ReactNode;
5
5
  /** Ekstra klassenavn */
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- export declare type ToastAlertBoxProps = {
2
+ export type ToastAlertBoxProps = {
3
3
  /** Innholdet i toasten */
4
4
  children?: React.ReactNode;
5
5
  /** Ekstra klassenavn */
@@ -1,11 +1,11 @@
1
1
  import React from 'react';
2
- declare type ToastVariants = 'success' | 'info';
3
- declare type AddToastPayload = {
2
+ type ToastVariants = 'success' | 'info';
3
+ type AddToastPayload = {
4
4
  title?: string;
5
5
  content: React.ReactNode;
6
6
  variant?: ToastVariants;
7
7
  } | string;
8
- export declare type ToastProviderProps = {
8
+ export type ToastProviderProps = {
9
9
  /** Antall millisekunder før toasts forsvinner av seg selv
10
10
  * @default 6000
11
11
  */
@@ -17,35 +17,29 @@ var classNames__default = /*#__PURE__*/_interopDefaultLegacy(classNames);
17
17
  var copy__default = /*#__PURE__*/_interopDefaultLegacy(copy);
18
18
 
19
19
  function _extends() {
20
- _extends = Object.assign || function (target) {
20
+ _extends = Object.assign ? Object.assign.bind() : function (target) {
21
21
  for (var i = 1; i < arguments.length; i++) {
22
22
  var source = arguments[i];
23
-
24
23
  for (var key in source) {
25
24
  if (Object.prototype.hasOwnProperty.call(source, key)) {
26
25
  target[key] = source[key];
27
26
  }
28
27
  }
29
28
  }
30
-
31
29
  return target;
32
30
  };
33
-
34
31
  return _extends.apply(this, arguments);
35
32
  }
36
-
37
33
  function _objectWithoutPropertiesLoose(source, excluded) {
38
34
  if (source == null) return {};
39
35
  var target = {};
40
36
  var sourceKeys = Object.keys(source);
41
37
  var key, i;
42
-
43
38
  for (i = 0; i < sourceKeys.length; i++) {
44
39
  key = sourceKeys[i];
45
40
  if (excluded.indexOf(key) >= 0) continue;
46
41
  target[key] = source[key];
47
42
  }
48
-
49
43
  return target;
50
44
  }
51
45
 
@@ -58,34 +52,30 @@ var iconsMap = {
58
52
  };
59
53
  var BaseAlertBox = function BaseAlertBox(_ref) {
60
54
  var children = _ref.children,
61
- className = _ref.className,
62
- _ref$closable = _ref.closable,
63
- closable = _ref$closable === void 0 ? false : _ref$closable,
64
- _ref$closeButtonLabel = _ref.closeButtonLabel,
65
- closeButtonLabel = _ref$closeButtonLabel === void 0 ? 'Lukk' : _ref$closeButtonLabel,
66
- variant = _ref.variant,
67
- _ref$onClose = _ref.onClose,
68
- onClose = _ref$onClose === void 0 ? function () {
69
- return {};
70
- } : _ref$onClose,
71
- size = _ref.size,
72
- title = _ref.title,
73
- toastIsBeingRemoved = _ref.toastIsBeingRemoved,
74
- rest = _objectWithoutPropertiesLoose(_ref, _excluded$3);
75
-
55
+ className = _ref.className,
56
+ _ref$closable = _ref.closable,
57
+ closable = _ref$closable === void 0 ? false : _ref$closable,
58
+ _ref$closeButtonLabel = _ref.closeButtonLabel,
59
+ closeButtonLabel = _ref$closeButtonLabel === void 0 ? 'Lukk' : _ref$closeButtonLabel,
60
+ variant = _ref.variant,
61
+ _ref$onClose = _ref.onClose,
62
+ onClose = _ref$onClose === void 0 ? function () {
63
+ return {};
64
+ } : _ref$onClose,
65
+ size = _ref.size,
66
+ title = _ref.title,
67
+ toastIsBeingRemoved = _ref.toastIsBeingRemoved,
68
+ rest = _objectWithoutPropertiesLoose(_ref, _excluded$3);
76
69
  var _React$useState = React__default["default"].useState(false),
77
- isClosed = _React$useState[0],
78
- setClosed = _React$useState[1];
79
-
70
+ isClosed = _React$useState[0],
71
+ setClosed = _React$useState[1];
80
72
  if (isClosed) {
81
73
  return null;
82
74
  }
83
-
84
75
  var handleClose = function handleClose() {
85
76
  setClosed(true);
86
77
  onClose();
87
78
  };
88
-
89
79
  var Icon = iconsMap[variant];
90
80
  return React__default["default"].createElement("div", _extends({
91
81
  className: classNames__default["default"]('eds-alert-box', "eds-alert-box--" + size, "eds-alert-box--" + variant, {
@@ -124,13 +114,12 @@ var ToastAlertBox = function ToastAlertBox(props) {
124
114
  var _excluded$2 = ["className", "width", "onClose", "closable", "closeButtonLabel"];
125
115
  var SmallAlertBox = function SmallAlertBox(_ref) {
126
116
  var className = _ref.className,
127
- width = _ref.width,
128
- onClose = _ref.onClose,
129
- _ref$closable = _ref.closable,
130
- closable = _ref$closable === void 0 ? false : _ref$closable,
131
- closeButtonLabel = _ref.closeButtonLabel,
132
- rest = _objectWithoutPropertiesLoose(_ref, _excluded$2);
133
-
117
+ width = _ref.width,
118
+ onClose = _ref.onClose,
119
+ _ref$closable = _ref.closable,
120
+ closable = _ref$closable === void 0 ? false : _ref$closable,
121
+ closeButtonLabel = _ref.closeButtonLabel,
122
+ rest = _objectWithoutPropertiesLoose(_ref, _excluded$2);
134
123
  return React__default["default"].createElement(BaseAlertBox, _extends({
135
124
  className: classNames__default["default"](className, {
136
125
  'eds-alert-box--fit-content': width === 'fit-content'
@@ -145,12 +134,10 @@ var SmallAlertBox = function SmallAlertBox(_ref) {
145
134
 
146
135
  var EXIT_ANIMATION_TIME = 400;
147
136
  var ToastContext = /*#__PURE__*/React__default["default"].createContext(null);
148
-
149
137
  var toastReducer = function toastReducer(prevToasts, action) {
150
138
  switch (action.type) {
151
139
  case 'ADD_TOAST':
152
140
  return [action.payload].concat(prevToasts);
153
-
154
141
  case 'PLAY_EXIT_ANIMATION':
155
142
  return prevToasts.map(function (toast) {
156
143
  if (toast.id === action.payload) return _extends({}, toast, {
@@ -158,18 +145,15 @@ var toastReducer = function toastReducer(prevToasts, action) {
158
145
  });
159
146
  return toast;
160
147
  });
161
-
162
148
  case 'REMOVE_TOAST':
163
149
  return prevToasts.filter(function (toast) {
164
150
  return toast.id !== action.payload;
165
151
  });
166
152
  }
167
153
  };
168
-
169
154
  var createUniqueId = function createUniqueId() {
170
155
  return Math.random().toString().substring(2);
171
156
  };
172
-
173
157
  var createToast = function createToast(toast, id) {
174
158
  if (typeof toast === 'string') {
175
159
  return {
@@ -186,24 +170,20 @@ var createToast = function createToast(toast, id) {
186
170
  }, toast);
187
171
  }
188
172
  };
189
-
190
173
  var ToastProvider = function ToastProvider(_ref) {
191
174
  var _ref$delay = _ref.delay,
192
- delay = _ref$delay === void 0 ? 6000 : _ref$delay,
193
- children = _ref.children,
194
- _ref$position = _ref.position,
195
- position = _ref$position === void 0 ? 'bottom-right' : _ref$position,
196
- className = _ref.className,
197
- style = _ref.style;
198
-
175
+ delay = _ref$delay === void 0 ? 6000 : _ref$delay,
176
+ children = _ref.children,
177
+ _ref$position = _ref.position,
178
+ position = _ref$position === void 0 ? 'bottom-right' : _ref$position,
179
+ className = _ref.className,
180
+ style = _ref.style;
199
181
  var _React$useReducer = React__default["default"].useReducer(toastReducer, []),
200
- toasts = _React$useReducer[0],
201
- dispatch = _React$useReducer[1];
202
-
182
+ toasts = _React$useReducer[0],
183
+ dispatch = _React$useReducer[1];
203
184
  var _React$useState = React__default["default"].useState(),
204
- hoveringId = _React$useState[0],
205
- setHovering = _React$useState[1];
206
-
185
+ hoveringId = _React$useState[0],
186
+ setHovering = _React$useState[1];
207
187
  var timeoutIdRefs = React__default["default"].useRef({});
208
188
  var removeToast = React__default["default"].useCallback(function (id) {
209
189
  window.clearTimeout(timeoutIdRefs.current[id]);
@@ -238,7 +218,6 @@ var ToastProvider = function ToastProvider(_ref) {
238
218
  });
239
219
  removeToastWithAnimationAfterDelay(id, delay);
240
220
  }, [delay, removeToastWithAnimationAfterDelay]);
241
-
242
221
  var handleMouseEnter = function handleMouseEnter(toast) {
243
222
  return function () {
244
223
  if (toast.isBeingRemoved) return;
@@ -249,21 +228,18 @@ var ToastProvider = function ToastProvider(_ref) {
249
228
  timeoutIdRefs.current = {};
250
229
  };
251
230
  };
252
-
253
231
  var handleMouseLeave = function handleMouseLeave() {
254
232
  setHovering(undefined);
255
233
  toasts.forEach(function (toast) {
256
234
  removeToastWithAnimationAfterDelay(toast.id, delay);
257
235
  });
258
236
  };
259
-
260
237
  var handleClose = function handleClose(toastId) {
261
238
  return function () {
262
239
  removeToast(toastId);
263
240
  handleMouseLeave();
264
241
  };
265
242
  };
266
-
267
243
  var contextValue = React__default["default"].useMemo(function () {
268
244
  return {
269
245
  toasts: toasts,
@@ -291,11 +267,9 @@ var ToastProvider = function ToastProvider(_ref) {
291
267
  };
292
268
  var useToast = function useToast() {
293
269
  var context = React__default["default"].useContext(ToastContext);
294
-
295
270
  if (!context) {
296
271
  throw new Error('You need to wrap your component in a ToastProvider component in ' + 'order to use the useToast hook');
297
272
  }
298
-
299
273
  var addToast = context.addToast;
300
274
  return {
301
275
  addToast: addToast
@@ -305,18 +279,15 @@ var useToast = function useToast() {
305
279
  var _excluded$1 = ["children", "successHeading", "successMessage", "className"];
306
280
  var CopyableText = function CopyableText(_ref) {
307
281
  var children = _ref.children,
308
- _ref$successHeading = _ref.successHeading,
309
- successHeading = _ref$successHeading === void 0 ? 'Kopiert!' : _ref$successHeading,
310
- _ref$successMessage = _ref.successMessage,
311
- successMessage = _ref$successMessage === void 0 ? 'Innholdet ble kopiert til utklippstavlen.' : _ref$successMessage,
312
- className = _ref.className,
313
- rest = _objectWithoutPropertiesLoose(_ref, _excluded$1);
314
-
282
+ _ref$successHeading = _ref.successHeading,
283
+ successHeading = _ref$successHeading === void 0 ? 'Kopiert!' : _ref$successHeading,
284
+ _ref$successMessage = _ref.successMessage,
285
+ successMessage = _ref$successMessage === void 0 ? 'Innholdet ble kopiert til utklippstavlen.' : _ref$successMessage,
286
+ className = _ref.className,
287
+ rest = _objectWithoutPropertiesLoose(_ref, _excluded$1);
315
288
  var _useToast = useToast(),
316
- addToast = _useToast.addToast;
317
-
289
+ addToast = _useToast.addToast;
318
290
  var buttonRef = React__default["default"].useRef(null);
319
-
320
291
  var handleClick = function handleClick() {
321
292
  buttonRef.current && copy__default["default"](children, {
322
293
  target: buttonRef.current
@@ -325,7 +296,6 @@ var CopyableText = function CopyableText(_ref) {
325
296
  content: successMessage
326
297
  });
327
298
  };
328
-
329
299
  return React__default["default"].createElement("button", _extends({
330
300
  className: 'copyable-text ' + className,
331
301
  style: _extends({}, rest.style),
@@ -349,21 +319,18 @@ var BannerExpandableAlertBox = function BannerExpandableAlertBox(props) {
349
319
  size: "banner"
350
320
  }, props));
351
321
  };
352
-
353
322
  var ExpandableAlertBox = function ExpandableAlertBox(_ref) {
354
323
  var variant = _ref.variant,
355
- title = _ref.title,
356
- children = _ref.children,
357
- size = _ref.size,
358
- className = _ref.className,
359
- openLabel = _ref.openLabel,
360
- closeLabel = _ref.closeLabel,
361
- rest = _objectWithoutPropertiesLoose(_ref, _excluded);
362
-
324
+ title = _ref.title,
325
+ children = _ref.children,
326
+ size = _ref.size,
327
+ className = _ref.className,
328
+ openLabel = _ref.openLabel,
329
+ closeLabel = _ref.closeLabel,
330
+ rest = _objectWithoutPropertiesLoose(_ref, _excluded);
363
331
  var _React$useState = React__default["default"].useState(false),
364
- open = _React$useState[0],
365
- setopen = _React$useState[1];
366
-
332
+ open = _React$useState[0],
333
+ setopen = _React$useState[1];
367
334
  return React__default["default"].createElement(BaseAlertBox, _extends({
368
335
  size: size,
369
336
  variant: variant,
@@ -381,15 +348,14 @@ var ExpandableAlertBox = function ExpandableAlertBox(_ref) {
381
348
  open: open
382
349
  }, children));
383
350
  };
384
-
385
351
  var ExpandableAlertBoxTitle = function ExpandableAlertBoxTitle(_ref2) {
386
352
  var title = _ref2.title,
387
- open = _ref2.open,
388
- _ref2$openLabel = _ref2.openLabel,
389
- openLabel = _ref2$openLabel === void 0 ? 'Les mer' : _ref2$openLabel,
390
- _ref2$closeLabel = _ref2.closeLabel,
391
- closeLabel = _ref2$closeLabel === void 0 ? 'Lukk' : _ref2$closeLabel,
392
- onClick = _ref2.onClick;
353
+ open = _ref2.open,
354
+ _ref2$openLabel = _ref2.openLabel,
355
+ openLabel = _ref2$openLabel === void 0 ? 'Les mer' : _ref2$openLabel,
356
+ _ref2$closeLabel = _ref2.closeLabel,
357
+ closeLabel = _ref2$closeLabel === void 0 ? 'Lukk' : _ref2$closeLabel,
358
+ onClick = _ref2.onClick;
393
359
  return React__default["default"].createElement("div", {
394
360
  className: "eds-expandable-alert-box__title"
395
361
  }, React__default["default"].createElement("div", null, title), React__default["default"].createElement("button", {
@@ -1 +1 @@
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 OutlinedValidationCheckIcon,\n OutlinedValidationExclamationIcon,\n OutlinedValidationInfoIcon,\n OutlinedValidationErrorIcon,\n} from '@entur/icons';\nimport './styles.scss';\n\nconst iconsMap = {\n success: OutlinedValidationCheckIcon,\n info: OutlinedValidationInfoIcon,\n warning: OutlinedValidationExclamationIcon,\n error: OutlinedValidationErrorIcon,\n};\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: 'success' | 'info' | 'warning' | '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];\n return (\n <div\n className={classNames(\n 'eds-alert-box',\n `eds-alert-box--${size}`,\n `eds-alert-box--${variant}`,\n { 'eds-alert-box--toast--exit-animation': toastIsBeingRemoved },\n className,\n )}\n {...rest}\n >\n {closable && (\n <button\n aria-label={closeButtonLabel}\n className=\"eds-alert-box__close-button\"\n type=\"button\"\n onClick={handleClose}\n >\n <CloseIcon />\n </button>\n )}\n <Icon className=\"eds-alert-box__icon\" />\n <div\n className={classNames('eds-alert-box__content', {\n 'eds-alert-box__content--no-title': !title,\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 </div>\n );\n};\n","import React from 'react';\nimport { BaseAlertBox } from './BaseAlertBox';\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: 'success' | 'info' | 'warning' | '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';\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' | '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\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: 'success' | 'info' | 'warning' | '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\ntype ToastVariants = 'success' | '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) => void;\n removeToast: (id: ToastId) => void;\n toasts: ToastType[];\n};\n\ntype AddToastPayload =\n | { title?: string; content: React.ReactNode; variant?: ToastVariants }\n | string;\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 = (toast: AddToastPayload, id: ToastId): 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) => {\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) => 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';\n\nimport copy from 'copy-text-to-clipboard';\n\nimport { useToast } from './ToastProvider';\nimport { CopyIcon } from '@entur/icons';\nimport { PreformattedText } from '@entur/typography';\n\nimport './CopyableText.scss';\n\nexport type CopyableTextProps = {\n /** Ekstra klassenavn */\n className?: string;\n /** Tekstinnhold som vises og kopieres */\n children: string;\n /** Overskrift i toast-varselet */\n successHeading?: string;\n /** Bekreftelsesmelding i toast-varselet */\n successMessage?: string;\n} & Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, 'children'>;\n\nexport const CopyableText = ({\n children,\n successHeading = 'Kopiert!',\n successMessage = 'Innholdet ble kopiert til utklippstavlen.',\n className,\n ...rest\n}: CopyableTextProps): JSX.Element => {\n const { addToast } = useToast();\n const buttonRef = React.useRef<HTMLButtonElement>(null);\n const handleClick = () => {\n buttonRef.current &&\n copy(children, {\n target: buttonRef.current,\n }) &&\n addToast({ title: successHeading, content: successMessage });\n };\n return (\n <button\n className={'copyable-text ' + className}\n style={{ ...rest.style }}\n type=\"button\"\n onClick={handleClick}\n ref={buttonRef}\n aria-label=\"Kopier innhold\"\n {...rest}\n >\n <PreformattedText>{children}</PreformattedText>\n <CopyIcon className=\"copyable-text__icon\" />\n </button>\n );\n};\n","import { BaseExpand, ExpandArrow } from '@entur/expand/';\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\ntype ExpandableAlertBoxProps = {\n /**Farge og uttrykk på alert-boksen */\n variant: 'success' | 'info' | 'warning' | '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","OutlinedValidationCheckIcon","info","OutlinedValidationInfoIcon","warning","OutlinedValidationExclamationIcon","error","OutlinedValidationErrorIcon","BaseAlertBox","children","className","closable","closeButtonLabel","variant","onClose","size","title","toastIsBeingRemoved","rest","React","useState","isClosed","setClosed","handleClose","Icon","classNames","type","onClick","CloseIcon","BannerAlertBox","props","ToastAlertBox","role","SmallAlertBox","width","EXIT_ANIMATION_TIME","ToastContext","createContext","toastReducer","prevToasts","action","payload","map","toast","id","isBeingRemoved","filter","createUniqueId","Math","random","toString","substring","createToast","content","ToastProvider","delay","position","style","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","successHeading","successMessage","buttonRef","handleClick","copy","target","ref","PreformattedText","CopyIcon","SmallExpandableAlertBox","ExpandableAlertBox","BannerExpandableAlertBox","openLabel","closeLabel","open","setopen","ExpandableAlertBoxTitle","BaseExpand","ExpandArrow","inline","warnAboutMissingStyles"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAWA,IAAMA,QAAQ,GAAG;AACfC,EAA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SACER,uCAAA,MAAA;AAAKT,IAAAA,SAAS,EAAC;GAAf,EACES,uCAAA,MAAA,MAAA,EAAMH,KAAN,CADF,EAEEG,uCAAA,SAAA;AACET,IAAAA,SAAS,EAAC;AACViB,IAAAA,OAAO,EAAEA;AACTD,IAAAA,IAAI,EAAC;GAHP,EAKGqF,IAAI,GAAGD,UAAH,GAAgBD,SALvB,EAME1F,uCAAA,CAACgG,aAAD;AAAaJ,IAAAA,IAAI,EAAEA;AAAMK,IAAAA,MAAM;GAA/B,CANF,CAFF,CADF;AAaD,CApBD;;ACjFAC,4BAAsB,CAAC,OAAD,EAAU,OAAV,CAAtB;;;;;;;;;;;"}
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 OutlinedValidationCheckIcon,\n OutlinedValidationExclamationIcon,\n OutlinedValidationInfoIcon,\n OutlinedValidationErrorIcon,\n} from '@entur/icons';\nimport './styles.scss';\n\nconst iconsMap = {\n success: OutlinedValidationCheckIcon,\n info: OutlinedValidationInfoIcon,\n warning: OutlinedValidationExclamationIcon,\n error: OutlinedValidationErrorIcon,\n};\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: 'success' | 'info' | 'warning' | '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];\n return (\n <div\n className={classNames(\n 'eds-alert-box',\n `eds-alert-box--${size}`,\n `eds-alert-box--${variant}`,\n { 'eds-alert-box--toast--exit-animation': toastIsBeingRemoved },\n className,\n )}\n {...rest}\n >\n {closable && (\n <button\n aria-label={closeButtonLabel}\n className=\"eds-alert-box__close-button\"\n type=\"button\"\n onClick={handleClose}\n >\n <CloseIcon />\n </button>\n )}\n <Icon className=\"eds-alert-box__icon\" />\n <div\n className={classNames('eds-alert-box__content', {\n 'eds-alert-box__content--no-title': !title,\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 </div>\n );\n};\n","import React from 'react';\nimport { BaseAlertBox } from './BaseAlertBox';\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: 'success' | 'info' | 'warning' | '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';\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' | '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\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: 'success' | 'info' | 'warning' | '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\ntype ToastVariants = 'success' | '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) => void;\n removeToast: (id: ToastId) => void;\n toasts: ToastType[];\n};\n\ntype AddToastPayload =\n | { title?: string; content: React.ReactNode; variant?: ToastVariants }\n | string;\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 = (toast: AddToastPayload, id: ToastId): 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) => {\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) => 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';\n\nimport copy from 'copy-text-to-clipboard';\n\nimport { useToast } from './ToastProvider';\nimport { CopyIcon } from '@entur/icons';\nimport { PreformattedText } from '@entur/typography';\n\nimport './CopyableText.scss';\n\nexport type CopyableTextProps = {\n /** Ekstra klassenavn */\n className?: string;\n /** Tekstinnhold som vises og kopieres */\n children: string;\n /** Overskrift i toast-varselet */\n successHeading?: string;\n /** Bekreftelsesmelding i toast-varselet */\n successMessage?: string;\n} & Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, 'children'>;\n\nexport const CopyableText = ({\n children,\n successHeading = 'Kopiert!',\n successMessage = 'Innholdet ble kopiert til utklippstavlen.',\n className,\n ...rest\n}: CopyableTextProps): JSX.Element => {\n const { addToast } = useToast();\n const buttonRef = React.useRef<HTMLButtonElement>(null);\n const handleClick = () => {\n buttonRef.current &&\n copy(children, {\n target: buttonRef.current,\n }) &&\n addToast({ title: successHeading, content: successMessage });\n };\n return (\n <button\n className={'copyable-text ' + className}\n style={{ ...rest.style }}\n type=\"button\"\n onClick={handleClick}\n ref={buttonRef}\n aria-label=\"Kopier innhold\"\n {...rest}\n >\n <PreformattedText>{children}</PreformattedText>\n <CopyIcon className=\"copyable-text__icon\" />\n </button>\n );\n};\n","import { BaseExpand, ExpandArrow } from '@entur/expand/';\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\ntype ExpandableAlertBoxProps = {\n /**Farge og uttrykk på alert-boksen */\n variant: 'success' | 'info' | 'warning' | '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","OutlinedValidationCheckIcon","info","OutlinedValidationInfoIcon","warning","OutlinedValidationExclamationIcon","error","OutlinedValidationErrorIcon","BaseAlertBox","children","className","closable","closeButtonLabel","variant","onClose","size","title","toastIsBeingRemoved","rest","_excluded","React","useState","isClosed","setClosed","handleClose","Icon","createElement","classNames","type","onClick","CloseIcon","BannerAlertBox","props","ToastAlertBox","role","SmallAlertBox","width","EXIT_ANIMATION_TIME","ToastContext","createContext","toastReducer","prevToasts","action","payload","map","toast","id","isBeingRemoved","filter","createUniqueId","Math","random","toString","substring","createToast","content","ToastProvider","delay","position","style","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","successHeading","successMessage","buttonRef","handleClick","copy","target","ref","PreformattedText","CopyIcon","SmallExpandableAlertBox","ExpandableAlertBox","BannerExpandableAlertBox","open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AAEP,EAAA,OACET,yBAAA,CAAAM,aAAA,CAAA,KAAA,EAAA;AAAKhB,IAAAA,SAAS,EAAC,iCAAA;AAAiC,GAAA,EAC9CU,yBAAA,CAAAM,aAAA,CAAA,KAAA,EAAA,IAAA,EAAMV,KAAK,CAAO,EAClBI,yBACE,CAAAM,aAAA,CAAA,QAAA,EAAA;AAAAhB,IAAAA,SAAS,EAAC,kCAAkC;AAC5CmB,IAAAA,OAAO,EAAEA,OAAO;AAChBD,IAAAA,IAAI,EAAC,QAAA;AAAQ,GAAA,EAEZqF,IAAI,GAAGD,UAAU,GAAGD,SAAS,EAC9B3F,yBAAC,CAAAM,aAAA,CAAA2F,aAAW,EAAC;AAAAJ,IAAAA,IAAI,EAAEA,IAAI;AAAEK,IAAAA,MAAM,EAAG,IAAA;GAAA,CAAA,CAC3B,CACL,CAAA;AAEV,CAAC;;ACrGDC,4BAAsB,CAAC,OAAO,EAAE,OAAO,CAAC;;;;;;;;;;;"}
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@entur/utils"),t=require("react"),n=require("classnames"),a=require("@entur/icons"),l=require("copy-text-to-clipboard"),o=require("@entur/typography"),r=require("@entur/expand/");function i(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var s=i(t),u=i(n),c=i(l);function d(){return d=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var a in n)Object.prototype.hasOwnProperty.call(n,a)&&(e[a]=n[a])}return e},d.apply(this,arguments)}function f(e,t){if(null==e)return{};var n,a,l={},o=Object.keys(e);for(a=0;a<o.length;a++)t.indexOf(n=o[a])>=0||(l[n]=e[n]);return l}var m=["children","className","closable","closeButtonLabel","variant","onClose","size","title","toastIsBeingRemoved"],b={success:a.OutlinedValidationCheckIcon,info:a.OutlinedValidationInfoIcon,warning:a.OutlinedValidationExclamationIcon,error:a.OutlinedValidationErrorIcon},p=function(e){var t=e.children,n=e.className,l=e.closable,o=void 0!==l&&l,r=e.closeButtonLabel,i=void 0===r?"Lukk":r,c=e.variant,p=e.onClose,v=void 0===p?function(){return{}}:p,x=e.size,E=e.title,y=e.toastIsBeingRemoved,T=f(e,m),_=s.default.useState(!1),h=_[1];if(_[0])return null;var N=b[c];return s.default.createElement("div",d({className:u.default("eds-alert-box","eds-alert-box--"+x,"eds-alert-box--"+c,{"eds-alert-box--toast--exit-animation":y},n)},T),o&&s.default.createElement("button",{"aria-label":i,className:"eds-alert-box__close-button",type:"button",onClick:function(){h(!0),v()}},s.default.createElement(a.CloseIcon,null)),s.default.createElement(N,{className:"eds-alert-box__icon"}),s.default.createElement("div",{className:u.default("eds-alert-box__content",{"eds-alert-box__content--no-title":!E,"eds-alert-box__content--no-children":!t})},E&&s.default.createElement("div",{className:"eds-alert-box__title"},E),t&&t))},v=function(e){return s.default.createElement(p,d({},e,{size:"toast",role:"status"}))},x=["className","width","onClose","closable","closeButtonLabel"],E=s.default.createContext(null),y=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?d({},e,{isBeingRemoved:!0}):e}));case"REMOVE_TOAST":return e.filter((function(e){return e.id!==t.payload}))}},T=function(){var e=s.default.useContext(E);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}},_=["children","successHeading","successMessage","className"],h=["variant","title","children","size","className","openLabel","closeLabel"],N=function(e){var t=e.variant,n=e.title,a=e.children,l=e.size,o=e.className,i=e.openLabel,c=e.closeLabel,m=f(e,h),b=s.default.useState(!1),v=b[0],x=b[1];return s.default.createElement(p,d({size:l,variant:t,className:u.default("eds-expandable-alert-box",o),title:s.default.createElement(g,{open:v,title:n,onClick:function(){return x(!v)},openLabel:i,closeLabel:c})},m),s.default.createElement(r.BaseExpand,{open:v},a))},g=function(e){var t=e.open,n=e.openLabel,a=void 0===n?"Les mer":n,l=e.closeLabel,o=void 0===l?"Lukk":l,i=e.onClick;return s.default.createElement("div",{className:"eds-expandable-alert-box__title"},s.default.createElement("div",null,e.title),s.default.createElement("button",{className:"eds-expandable-alert-box__button",onClick:i,type:"button"},t?o:a,s.default.createElement(r.ExpandArrow,{open:t,inline:!0})))};e.warnAboutMissingStyles("alert","icons"),exports.BannerAlertBox=function(e){return s.default.createElement(p,d({},e,{size:"banner"}))},exports.BannerExpandableAlertBox=function(e){return s.default.createElement(N,d({size:"banner"},e))},exports.CopyableText=function(e){var t=e.children,n=e.successHeading,l=void 0===n?"Kopiert!":n,r=e.successMessage,i=void 0===r?"Innholdet ble kopiert til utklippstavlen.":r,u=e.className,m=f(e,_),b=T().addToast,p=s.default.useRef(null);return s.default.createElement("button",d({className:"copyable-text "+u,style:d({},m.style),type:"button",onClick:function(){p.current&&c.default(t,{target:p.current})&&b({title:l,content:i})},ref:p,"aria-label":"Kopier innhold"},m),s.default.createElement(o.PreformattedText,null,t),s.default.createElement(a.CopyIcon,{className:"copyable-text__icon"}))},exports.SmallAlertBox=function(e){var t=e.className,n=e.width,a=e.onClose,l=e.closable,o=void 0!==l&&l,r=e.closeButtonLabel,i=f(e,x);return s.default.createElement(p,d({className:u.default(t,{"eds-alert-box--fit-content":"fit-content"===n})},i,{onClose:a,closable:o,closeButtonLabel:r,size:"small"}))},exports.SmallExpandableAlertBox=function(e){return s.default.createElement(N,d({size:"small"},e))},exports.ToastAlertBox=v,exports.ToastProvider=function(e){var t=e.delay,n=void 0===t?6e3:t,a=e.children,l=e.position,o=void 0===l?"bottom-right":l,r=e.className,i=e.style,c=s.default.useReducer(y,[]),f=c[0],m=c[1],b=s.default.useState(),p=b[0],x=b[1],T=s.default.useRef({}),_=s.default.useCallback((function(e){window.clearTimeout(T.current[e]),m({type:"REMOVE_TOAST",payload:e}),delete T.current[e]}),[]),h=s.default.useCallback((function(e){window.clearTimeout(T.current[e+"animation"]),m({type:"PLAY_EXIT_ANIMATION",payload:e}),delete T.current[e+"animation"]}),[]),N=s.default.useCallback((function(e,t){T.current[e+"animation"]=window.setTimeout((function(){return h(e)}),t-400),T.current[e]=window.setTimeout((function(){return _(e)}),t)}),[T,h,_]),g=s.default.useCallback((function(e){var t=Math.random().toString().substring(2),a=function(e,t){return"string"==typeof e?{id:t,content:e,variant:"success",isBeingRemoved:!1}:d({id:t,variant:"success",isBeingRemoved:!1},e)}(e,t);m({type:"ADD_TOAST",payload:a}),N(t,n)}),[n,N]),B=function(){x(void 0),f.forEach((function(e){N(e.id,n)}))},C=s.default.useMemo((function(){return{toasts:f,addToast:g,removeToast:_}}),[g,_,f]);return s.default.createElement(E.Provider,{value:C},f.length>0&&s.default.createElement("div",{className:u.default("eds-toast-container","eds-toast-container--"+o,r),style:i},f.slice(0,3).map((function(e){return s.default.createElement(v,{variant:e.variant,title:e.title,onClose:(n=e.id,function(){_(n),B()}),onMouseEnter:(t=e,function(){t.isBeingRemoved||(x(t.id),Object.values(T.current).forEach((function(e){window.clearTimeout(e)})),T.current={})}),onMouseLeave:B,closable:p===e.id,toastIsBeingRemoved:e.isBeingRemoved,key:e.id},e.content);var t,n}))),a)},exports.useToast=T;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@entur/utils"),t=require("react"),n=require("classnames"),a=require("@entur/icons"),l=require("copy-text-to-clipboard"),o=require("@entur/typography"),r=require("@entur/expand/");function i(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var s=i(t),u=i(n),c=i(l);function d(){return d=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var a in n)Object.prototype.hasOwnProperty.call(n,a)&&(e[a]=n[a])}return e},d.apply(this,arguments)}function f(e,t){if(null==e)return{};var n,a,l={},o=Object.keys(e);for(a=0;a<o.length;a++)t.indexOf(n=o[a])>=0||(l[n]=e[n]);return l}var m=["children","className","closable","closeButtonLabel","variant","onClose","size","title","toastIsBeingRemoved"],b={success:a.OutlinedValidationCheckIcon,info:a.OutlinedValidationInfoIcon,warning:a.OutlinedValidationExclamationIcon,error:a.OutlinedValidationErrorIcon},p=function(e){var t=e.children,n=e.className,l=e.closable,o=void 0!==l&&l,r=e.closeButtonLabel,i=void 0===r?"Lukk":r,c=e.variant,p=e.onClose,v=void 0===p?function(){return{}}:p,x=e.size,E=e.title,y=e.toastIsBeingRemoved,T=f(e,m),_=s.default.useState(!1),h=_[1];if(_[0])return null;var g=b[c];return s.default.createElement("div",d({className:u.default("eds-alert-box","eds-alert-box--"+x,"eds-alert-box--"+c,{"eds-alert-box--toast--exit-animation":y},n)},T),o&&s.default.createElement("button",{"aria-label":i,className:"eds-alert-box__close-button",type:"button",onClick:function(){h(!0),v()}},s.default.createElement(a.CloseIcon,null)),s.default.createElement(g,{className:"eds-alert-box__icon"}),s.default.createElement("div",{className:u.default("eds-alert-box__content",{"eds-alert-box__content--no-title":!E,"eds-alert-box__content--no-children":!t})},E&&s.default.createElement("div",{className:"eds-alert-box__title"},E),t&&t))},v=function(e){return s.default.createElement(p,d({},e,{size:"toast",role:"status"}))},x=["className","width","onClose","closable","closeButtonLabel"],E=s.default.createContext(null),y=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?d({},e,{isBeingRemoved:!0}):e}));case"REMOVE_TOAST":return e.filter((function(e){return e.id!==t.payload}))}},T=function(){var e=s.default.useContext(E);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}},_=["children","successHeading","successMessage","className"],h=["variant","title","children","size","className","openLabel","closeLabel"],g=function(e){var t=e.variant,n=e.title,a=e.children,l=e.size,o=e.className,i=e.openLabel,c=e.closeLabel,m=f(e,h),b=s.default.useState(!1),v=b[0],x=b[1];return s.default.createElement(p,d({size:l,variant:t,className:u.default("eds-expandable-alert-box",o),title:s.default.createElement(N,{open:v,title:n,onClick:function(){return x(!v)},openLabel:i,closeLabel:c})},m),s.default.createElement(r.BaseExpand,{open:v},a))},N=function(e){var t=e.open,n=e.openLabel,a=void 0===n?"Les mer":n,l=e.closeLabel,o=void 0===l?"Lukk":l,i=e.onClick;return s.default.createElement("div",{className:"eds-expandable-alert-box__title"},s.default.createElement("div",null,e.title),s.default.createElement("button",{className:"eds-expandable-alert-box__button",onClick:i,type:"button"},t?o:a,s.default.createElement(r.ExpandArrow,{open:t,inline:!0})))};e.warnAboutMissingStyles("alert","icons"),exports.BannerAlertBox=function(e){return s.default.createElement(p,d({},e,{size:"banner"}))},exports.BannerExpandableAlertBox=function(e){return s.default.createElement(g,d({size:"banner"},e))},exports.CopyableText=function(e){var t=e.children,n=e.successHeading,l=void 0===n?"Kopiert!":n,r=e.successMessage,i=void 0===r?"Innholdet ble kopiert til utklippstavlen.":r,u=e.className,m=f(e,_),b=T().addToast,p=s.default.useRef(null);return s.default.createElement("button",d({className:"copyable-text "+u,style:d({},m.style),type:"button",onClick:function(){p.current&&c.default(t,{target:p.current})&&b({title:l,content:i})},ref:p,"aria-label":"Kopier innhold"},m),s.default.createElement(o.PreformattedText,null,t),s.default.createElement(a.CopyIcon,{className:"copyable-text__icon"}))},exports.SmallAlertBox=function(e){var t=e.className,n=e.width,a=e.onClose,l=e.closable,o=void 0!==l&&l,r=e.closeButtonLabel,i=f(e,x);return s.default.createElement(p,d({className:u.default(t,{"eds-alert-box--fit-content":"fit-content"===n})},i,{onClose:a,closable:o,closeButtonLabel:r,size:"small"}))},exports.SmallExpandableAlertBox=function(e){return s.default.createElement(g,d({size:"small"},e))},exports.ToastAlertBox=v,exports.ToastProvider=function(e){var t=e.delay,n=void 0===t?6e3:t,a=e.children,l=e.position,o=void 0===l?"bottom-right":l,r=e.className,i=e.style,c=s.default.useReducer(y,[]),f=c[0],m=c[1],b=s.default.useState(),p=b[0],x=b[1],T=s.default.useRef({}),_=s.default.useCallback((function(e){window.clearTimeout(T.current[e]),m({type:"REMOVE_TOAST",payload:e}),delete T.current[e]}),[]),h=s.default.useCallback((function(e){window.clearTimeout(T.current[e+"animation"]),m({type:"PLAY_EXIT_ANIMATION",payload:e}),delete T.current[e+"animation"]}),[]),g=s.default.useCallback((function(e,t){T.current[e+"animation"]=window.setTimeout((function(){return h(e)}),t-400),T.current[e]=window.setTimeout((function(){return _(e)}),t)}),[T,h,_]),N=s.default.useCallback((function(e){var t=Math.random().toString().substring(2),a=function(e,t){return"string"==typeof e?{id:t,content:e,variant:"success",isBeingRemoved:!1}:d({id:t,variant:"success",isBeingRemoved:!1},e)}(e,t);m({type:"ADD_TOAST",payload:a}),g(t,n)}),[n,g]),B=function(){x(void 0),f.forEach((function(e){g(e.id,n)}))},C=s.default.useMemo((function(){return{toasts:f,addToast:N,removeToast:_}}),[N,_,f]);return s.default.createElement(E.Provider,{value:C},f.length>0&&s.default.createElement("div",{className:u.default("eds-toast-container","eds-toast-container--"+o,r),style:i},f.slice(0,3).map((function(e){return s.default.createElement(v,{variant:e.variant,title:e.title,onClose:(n=e.id,function(){_(n),B()}),onMouseEnter:(t=e,function(){t.isBeingRemoved||(x(t.id),Object.values(T.current).forEach((function(e){window.clearTimeout(e)})),T.current={})}),onMouseLeave:B,closable:p===e.id,toastIsBeingRemoved:e.isBeingRemoved,key:e.id},e.content);var t,n}))),a)},exports.useToast=T;
2
2
  //# sourceMappingURL=alert.cjs.production.min.js.map