@entur/alert 0.17.13-beta.1 → 0.17.13-beta.10

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.
@@ -0,0 +1,27 @@
1
+ import React from 'react';
2
+ import { VariantType } from '@entur/utils';
3
+ /** @deprecated use variant="information" instead */
4
+ declare const info = "info";
5
+ /** @deprecated use variant="negative" instead */
6
+ declare const error = "error";
7
+ export type BannerAlertBoxProps = {
8
+ /** Innholdet i alert-boksen */
9
+ children: React.ReactNode;
10
+ /** Ekstra klassenavn */
11
+ className?: string;
12
+ /** Skjermleser-label for lukkeknappen, om den vises */
13
+ closeButtonLabel?: string;
14
+ /** Callback som kalles når man lukker boksen */
15
+ onClose?: () => void;
16
+ /** Om denne er true, vil boksen få en lukkeknapp i høyre hjørne
17
+ * @default false
18
+ */
19
+ closable?: boolean;
20
+ /** Tittel på boksen - oppsummer virkning */
21
+ title?: string;
22
+ /** Farge og uttrykk på alert-boksen */
23
+ variant: VariantType | typeof info | typeof error;
24
+ [key: string]: any;
25
+ };
26
+ export declare const BannerAlertBox: React.FC<BannerAlertBoxProps>;
27
+ export {};
@@ -0,0 +1,34 @@
1
+ import React from 'react';
2
+ import { VariantType } from '@entur/utils';
3
+ import './BaseAlertBox.scss';
4
+ /** @deprecated use variant="information" instead */
5
+ declare const info = "info";
6
+ /** @deprecated use variant="negative" instead */
7
+ declare const error = "error";
8
+ type BaseAlertBoxProps = {
9
+ /** Innholdet i alert-boksen */
10
+ children?: React.ReactNode;
11
+ /** Ekstra klassenavn */
12
+ className?: string;
13
+ /** Skjermleser-label for lukkeknappen, om den vises
14
+ * @default "Lukk"
15
+ */
16
+ closeButtonLabel?: string;
17
+ /** Callback som kalles når man lukker boksen
18
+ * @default () => {}
19
+ */
20
+ onClose?: () => void;
21
+ /** Om denne er true, vil boksen få en lukkeknapp i høyre hjørne
22
+ * @default false
23
+ */
24
+ closable?: boolean;
25
+ /** Tittel på boksen - oppsummer virkning */
26
+ title?: React.ReactNode;
27
+ /** Farge og uttrykk på alert-boksen */
28
+ variant: VariantType | typeof info | typeof error;
29
+ /** Typen boks (internt bruk) */
30
+ size: 'banner' | 'toast' | 'small';
31
+ [key: string]: any;
32
+ };
33
+ export declare const BaseAlertBox: React.FC<BaseAlertBoxProps>;
34
+ export {};
@@ -0,0 +1,20 @@
1
+ import React from 'react';
2
+ import './CopyableText.scss';
3
+ export type CopyableTextProps = {
4
+ /** Ekstra klassenavn */
5
+ className?: string;
6
+ /** Tekstinnhold som vises og kopieres */
7
+ children: string;
8
+ /** Hvis du ønsker å kopiere noe annet enn
9
+ * innholdet i children kan du legge det inn her */
10
+ textToCopy?: string;
11
+ /** Overskrift i toast-varselet
12
+ * @default 'Kopiert!'
13
+ */
14
+ successHeading?: string;
15
+ /** Bekreftelsesmelding i toast-varselet
16
+ * @default `${textToCopy} ble kopiert til utklippstavlen.`
17
+ */
18
+ successMessage?: string;
19
+ } & Omit<React.ButtonHTMLAttributes<HTMLDivElement>, 'children'>;
20
+ export declare const CopyableText: ({ children, successHeading, successMessage, textToCopy, className, "aria-label": ariaLabel, ...rest }: CopyableTextProps) => JSX.Element;
@@ -0,0 +1,33 @@
1
+ import { VariantType } from '@entur/utils';
2
+ import React from 'react';
3
+ import { BannerAlertBoxProps } from './BannerAlertBox';
4
+ import './ExpandableAlertBox.scss';
5
+ import { SmallAlertBoxProps } from './SmallAlertBox';
6
+ export type SmallExpandableAlertBoxProps = ExpandableAlertBoxProps & SmallAlertBoxProps;
7
+ export declare const SmallExpandableAlertBox: React.FC<SmallExpandableAlertBoxProps>;
8
+ export type BannerExpandableAlertBoxProps = ExpandableAlertBoxProps & BannerAlertBoxProps;
9
+ export declare const BannerExpandableAlertBox: React.FC<BannerExpandableAlertBoxProps>;
10
+ /** @deprecated use variant="information" instead */
11
+ declare const info = "info";
12
+ /** @deprecated use variant="negative" instead */
13
+ declare const error = "error";
14
+ type ExpandableAlertBoxProps = {
15
+ /**Farge og uttrykk på alert-boksen*/
16
+ variant: VariantType | typeof info | typeof error;
17
+ /** Tittelen til ExpandableAlertBox */
18
+ title: React.ReactNode;
19
+ /**Innhold som vises ved ekspandering */
20
+ children: React.ReactNode;
21
+ /**Ekstra klassenavn */
22
+ className?: string;
23
+ /** Tekst som vises på ekspanderingsknappen før åpning
24
+ * @default "Les mer"
25
+ */
26
+ openLabel?: string;
27
+ /** Tekst som vises på ekspanderingsknappen når den er åpnet
28
+ * @default "Lukk"
29
+ */
30
+ closeLabel?: string;
31
+ [key: string]: any;
32
+ };
33
+ export {};
@@ -0,0 +1,29 @@
1
+ import React from 'react';
2
+ import { VariantType } from '@entur/utils';
3
+ /** @deprecated use variant="information" instead */
4
+ declare const info = "info";
5
+ /** @deprecated use variant="negative" instead */
6
+ declare const error = "error";
7
+ export type SmallAlertBoxProps = {
8
+ /** Innholdet i alert-boksen */
9
+ children: React.ReactNode;
10
+ /** Ekstra klassenavn */
11
+ className?: string;
12
+ /** Skjermleser-label for lukkeknappen, om den vises */
13
+ closeButtonLabel?: string;
14
+ /** Om denne er true, vil boksen få en lukkeknapp i høyre hjørne
15
+ * @default false
16
+ */
17
+ closable?: boolean;
18
+ /** Callback som kalles når man lukker boksen */
19
+ onClose?: () => void;
20
+ /** Tittel på boksen - oppsummer virkning */
21
+ title?: string;
22
+ /** Bredden på boksen - fullbredde eller tilpasset innholdet */
23
+ width?: 'fluid' | 'fit-content';
24
+ /** Farge og uttrykk på alert-boksen*/
25
+ variant: VariantType | typeof info | typeof error;
26
+ [key: string]: any;
27
+ };
28
+ export declare const SmallAlertBox: React.FC<SmallAlertBoxProps>;
29
+ export {};
@@ -0,0 +1,23 @@
1
+ import React from 'react';
2
+ import './ToastAlertBox.scss';
3
+ /** @deprecated use variant="information" instead */
4
+ declare const info = "info";
5
+ export type ToastAlertBoxProps = {
6
+ /** Innholdet i toasten */
7
+ children?: React.ReactNode;
8
+ /** Ekstra klassenavn */
9
+ className?: string;
10
+ /** Skjermleser-label for lukkeknappen, om den vises */
11
+ closeButtonLabel?: string;
12
+ /** Callback som kalles når man lukker boksen */
13
+ onClose?: () => void;
14
+ /** Om denne er true, vil boksen få en lukkeknapp i høyre hjørne */
15
+ closable?: boolean;
16
+ /** Tittel på boksen - oppsummer virkning */
17
+ title?: string;
18
+ /** Farge og uttrykk på toasten */
19
+ variant: 'success' | 'information' | typeof info;
20
+ [key: string]: any;
21
+ };
22
+ export declare const ToastAlertBox: React.FC<ToastAlertBoxProps>;
23
+ export {};
@@ -0,0 +1,30 @@
1
+ import React from 'react';
2
+ /** @deprecated use variant="information" instead */
3
+ declare const info = "info";
4
+ export type ToastVariants = 'success' | 'information' | typeof info;
5
+ export type AddToastPayload = {
6
+ title?: string;
7
+ content: React.ReactNode;
8
+ variant?: ToastVariants;
9
+ };
10
+ export type ToastProviderProps = {
11
+ /** Antall millisekunder før toasts forsvinner av seg selv
12
+ * @default 6000
13
+ */
14
+ delay?: number;
15
+ /** Plasseringen av toasts
16
+ * @default "bottom-right"
17
+ */
18
+ position?: 'bottom-right' | 'top-right';
19
+ /** Ekstra klassenavn til ToastProvider-wrapperen */
20
+ className?: string;
21
+ /** Ekstra styling som sendes til ToastProvider-wrapperen */
22
+ style?: React.CSSProperties;
23
+ /** Innholdet */
24
+ children: React.ReactNode;
25
+ };
26
+ export declare const ToastProvider: React.FC<ToastProviderProps>;
27
+ export declare const useToast: () => {
28
+ addToast: (payload: AddToastPayload | string) => void;
29
+ };
30
+ export {};
@@ -0,0 +1,410 @@
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