@entur/alert 0.11.14 → 0.11.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +457 -0
- package/dist/alert.cjs.development.js +88 -54
- package/dist/alert.cjs.development.js.map +1 -1
- package/dist/alert.cjs.production.min.js.map +1 -1
- package/dist/alert.esm.js +88 -54
- package/dist/alert.esm.js.map +1 -1
- package/dist/styles.css +1 -0
- package/package.json +11 -16
package/dist/alert.esm.js
CHANGED
|
@@ -10,26 +10,32 @@ function _extends() {
|
|
|
10
10
|
_extends = Object.assign || function (target) {
|
|
11
11
|
for (var i = 1; i < arguments.length; i++) {
|
|
12
12
|
var source = arguments[i];
|
|
13
|
+
|
|
13
14
|
for (var key in source) {
|
|
14
15
|
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
15
16
|
target[key] = source[key];
|
|
16
17
|
}
|
|
17
18
|
}
|
|
18
19
|
}
|
|
20
|
+
|
|
19
21
|
return target;
|
|
20
22
|
};
|
|
23
|
+
|
|
21
24
|
return _extends.apply(this, arguments);
|
|
22
25
|
}
|
|
26
|
+
|
|
23
27
|
function _objectWithoutPropertiesLoose(source, excluded) {
|
|
24
28
|
if (source == null) return {};
|
|
25
29
|
var target = {};
|
|
26
30
|
var sourceKeys = Object.keys(source);
|
|
27
31
|
var key, i;
|
|
32
|
+
|
|
28
33
|
for (i = 0; i < sourceKeys.length; i++) {
|
|
29
34
|
key = sourceKeys[i];
|
|
30
35
|
if (excluded.indexOf(key) >= 0) continue;
|
|
31
36
|
target[key] = source[key];
|
|
32
37
|
}
|
|
38
|
+
|
|
33
39
|
return target;
|
|
34
40
|
}
|
|
35
41
|
|
|
@@ -42,30 +48,34 @@ var iconsMap = {
|
|
|
42
48
|
};
|
|
43
49
|
var BaseAlertBox = function BaseAlertBox(_ref) {
|
|
44
50
|
var children = _ref.children,
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
51
|
+
className = _ref.className,
|
|
52
|
+
_ref$closable = _ref.closable,
|
|
53
|
+
closable = _ref$closable === void 0 ? false : _ref$closable,
|
|
54
|
+
_ref$closeButtonLabel = _ref.closeButtonLabel,
|
|
55
|
+
closeButtonLabel = _ref$closeButtonLabel === void 0 ? 'Lukk' : _ref$closeButtonLabel,
|
|
56
|
+
variant = _ref.variant,
|
|
57
|
+
_ref$onClose = _ref.onClose,
|
|
58
|
+
onClose = _ref$onClose === void 0 ? function () {
|
|
59
|
+
return {};
|
|
60
|
+
} : _ref$onClose,
|
|
61
|
+
size = _ref.size,
|
|
62
|
+
title = _ref.title,
|
|
63
|
+
toastIsBeingRemoved = _ref.toastIsBeingRemoved,
|
|
64
|
+
rest = _objectWithoutPropertiesLoose(_ref, _excluded$3);
|
|
65
|
+
|
|
59
66
|
var _React$useState = React.useState(false),
|
|
60
|
-
|
|
61
|
-
|
|
67
|
+
isClosed = _React$useState[0],
|
|
68
|
+
setClosed = _React$useState[1];
|
|
69
|
+
|
|
62
70
|
if (isClosed) {
|
|
63
71
|
return null;
|
|
64
72
|
}
|
|
73
|
+
|
|
65
74
|
var handleClose = function handleClose() {
|
|
66
75
|
setClosed(true);
|
|
67
76
|
onClose();
|
|
68
77
|
};
|
|
78
|
+
|
|
69
79
|
var Icon = iconsMap[variant];
|
|
70
80
|
return React.createElement("div", _extends({
|
|
71
81
|
className: classNames('eds-alert-box', "eds-alert-box--" + size, "eds-alert-box--" + variant, {
|
|
@@ -104,12 +114,13 @@ var ToastAlertBox = function ToastAlertBox(props) {
|
|
|
104
114
|
var _excluded$2 = ["className", "width", "onClose", "closable", "closeButtonLabel"];
|
|
105
115
|
var SmallAlertBox = function SmallAlertBox(_ref) {
|
|
106
116
|
var className = _ref.className,
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
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);
|
|
123
|
+
|
|
113
124
|
return React.createElement(BaseAlertBox, _extends({
|
|
114
125
|
className: classNames(className, {
|
|
115
126
|
'eds-alert-box--fit-content': width === 'fit-content'
|
|
@@ -124,10 +135,12 @@ var SmallAlertBox = function SmallAlertBox(_ref) {
|
|
|
124
135
|
|
|
125
136
|
var EXIT_ANIMATION_TIME = 400;
|
|
126
137
|
var ToastContext = /*#__PURE__*/React.createContext(null);
|
|
138
|
+
|
|
127
139
|
var toastReducer = function toastReducer(prevToasts, action) {
|
|
128
140
|
switch (action.type) {
|
|
129
141
|
case 'ADD_TOAST':
|
|
130
142
|
return [action.payload].concat(prevToasts);
|
|
143
|
+
|
|
131
144
|
case 'PLAY_EXIT_ANIMATION':
|
|
132
145
|
return prevToasts.map(function (toast) {
|
|
133
146
|
if (toast.id === action.payload) return _extends({}, toast, {
|
|
@@ -135,15 +148,18 @@ var toastReducer = function toastReducer(prevToasts, action) {
|
|
|
135
148
|
});
|
|
136
149
|
return toast;
|
|
137
150
|
});
|
|
151
|
+
|
|
138
152
|
case 'REMOVE_TOAST':
|
|
139
153
|
return prevToasts.filter(function (toast) {
|
|
140
154
|
return toast.id !== action.payload;
|
|
141
155
|
});
|
|
142
156
|
}
|
|
143
157
|
};
|
|
158
|
+
|
|
144
159
|
var createUniqueId = function createUniqueId() {
|
|
145
160
|
return Math.random().toString().substring(2);
|
|
146
161
|
};
|
|
162
|
+
|
|
147
163
|
var createToast = function createToast(toast, id) {
|
|
148
164
|
if (typeof toast === 'string') {
|
|
149
165
|
return {
|
|
@@ -160,20 +176,24 @@ var createToast = function createToast(toast, id) {
|
|
|
160
176
|
}, toast);
|
|
161
177
|
}
|
|
162
178
|
};
|
|
179
|
+
|
|
163
180
|
var ToastProvider = function ToastProvider(_ref) {
|
|
164
181
|
var _ref$delay = _ref.delay,
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
182
|
+
delay = _ref$delay === void 0 ? 6000 : _ref$delay,
|
|
183
|
+
children = _ref.children,
|
|
184
|
+
_ref$position = _ref.position,
|
|
185
|
+
position = _ref$position === void 0 ? 'bottom-right' : _ref$position,
|
|
186
|
+
className = _ref.className,
|
|
187
|
+
style = _ref.style;
|
|
188
|
+
|
|
171
189
|
var _React$useReducer = React.useReducer(toastReducer, []),
|
|
172
|
-
|
|
173
|
-
|
|
190
|
+
toasts = _React$useReducer[0],
|
|
191
|
+
dispatch = _React$useReducer[1];
|
|
192
|
+
|
|
174
193
|
var _React$useState = React.useState(),
|
|
175
|
-
|
|
176
|
-
|
|
194
|
+
hoveringId = _React$useState[0],
|
|
195
|
+
setHovering = _React$useState[1];
|
|
196
|
+
|
|
177
197
|
var timeoutIdRefs = React.useRef({});
|
|
178
198
|
var removeToast = React.useCallback(function (id) {
|
|
179
199
|
window.clearTimeout(timeoutIdRefs.current[id]);
|
|
@@ -208,6 +228,7 @@ var ToastProvider = function ToastProvider(_ref) {
|
|
|
208
228
|
});
|
|
209
229
|
removeToastWithAnimationAfterDelay(id, delay);
|
|
210
230
|
}, [delay, removeToastWithAnimationAfterDelay]);
|
|
231
|
+
|
|
211
232
|
var handleMouseEnter = function handleMouseEnter(toast) {
|
|
212
233
|
return function () {
|
|
213
234
|
if (toast.isBeingRemoved) return;
|
|
@@ -218,18 +239,21 @@ var ToastProvider = function ToastProvider(_ref) {
|
|
|
218
239
|
timeoutIdRefs.current = {};
|
|
219
240
|
};
|
|
220
241
|
};
|
|
242
|
+
|
|
221
243
|
var handleMouseLeave = function handleMouseLeave() {
|
|
222
244
|
setHovering(undefined);
|
|
223
245
|
toasts.forEach(function (toast) {
|
|
224
246
|
removeToastWithAnimationAfterDelay(toast.id, delay);
|
|
225
247
|
});
|
|
226
248
|
};
|
|
249
|
+
|
|
227
250
|
var handleClose = function handleClose(toastId) {
|
|
228
251
|
return function () {
|
|
229
252
|
removeToast(toastId);
|
|
230
253
|
handleMouseLeave();
|
|
231
254
|
};
|
|
232
255
|
};
|
|
256
|
+
|
|
233
257
|
var contextValue = React.useMemo(function () {
|
|
234
258
|
return {
|
|
235
259
|
toasts: toasts,
|
|
@@ -257,9 +281,11 @@ var ToastProvider = function ToastProvider(_ref) {
|
|
|
257
281
|
};
|
|
258
282
|
var useToast = function useToast() {
|
|
259
283
|
var context = React.useContext(ToastContext);
|
|
284
|
+
|
|
260
285
|
if (!context) {
|
|
261
286
|
throw new Error('You need to wrap your component in a ToastProvider component in ' + 'order to use the useToast hook');
|
|
262
287
|
}
|
|
288
|
+
|
|
263
289
|
var addToast = context.addToast;
|
|
264
290
|
return {
|
|
265
291
|
addToast: addToast
|
|
@@ -269,15 +295,18 @@ var useToast = function useToast() {
|
|
|
269
295
|
var _excluded$1 = ["children", "successHeading", "successMessage", "className"];
|
|
270
296
|
var CopyableText = function CopyableText(_ref) {
|
|
271
297
|
var children = _ref.children,
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
298
|
+
_ref$successHeading = _ref.successHeading,
|
|
299
|
+
successHeading = _ref$successHeading === void 0 ? 'Kopiert!' : _ref$successHeading,
|
|
300
|
+
_ref$successMessage = _ref.successMessage,
|
|
301
|
+
successMessage = _ref$successMessage === void 0 ? 'Innholdet ble kopiert til utklippstavlen.' : _ref$successMessage,
|
|
302
|
+
className = _ref.className,
|
|
303
|
+
rest = _objectWithoutPropertiesLoose(_ref, _excluded$1);
|
|
304
|
+
|
|
278
305
|
var _useToast = useToast(),
|
|
279
|
-
|
|
306
|
+
addToast = _useToast.addToast;
|
|
307
|
+
|
|
280
308
|
var buttonRef = React.useRef(null);
|
|
309
|
+
|
|
281
310
|
var handleClick = function handleClick() {
|
|
282
311
|
buttonRef.current && copy(children, {
|
|
283
312
|
target: buttonRef.current
|
|
@@ -286,6 +315,7 @@ var CopyableText = function CopyableText(_ref) {
|
|
|
286
315
|
content: successMessage
|
|
287
316
|
});
|
|
288
317
|
};
|
|
318
|
+
|
|
289
319
|
return React.createElement("button", _extends({
|
|
290
320
|
className: 'copyable-text ' + className,
|
|
291
321
|
style: _extends({}, rest.style),
|
|
@@ -309,18 +339,21 @@ var BannerExpandableAlertBox = function BannerExpandableAlertBox(props) {
|
|
|
309
339
|
size: "banner"
|
|
310
340
|
}, props));
|
|
311
341
|
};
|
|
342
|
+
|
|
312
343
|
var ExpandableAlertBox = function ExpandableAlertBox(_ref) {
|
|
313
344
|
var variant = _ref.variant,
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
345
|
+
title = _ref.title,
|
|
346
|
+
children = _ref.children,
|
|
347
|
+
size = _ref.size,
|
|
348
|
+
className = _ref.className,
|
|
349
|
+
openLabel = _ref.openLabel,
|
|
350
|
+
closeLabel = _ref.closeLabel,
|
|
351
|
+
rest = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
352
|
+
|
|
321
353
|
var _React$useState = React.useState(false),
|
|
322
|
-
|
|
323
|
-
|
|
354
|
+
open = _React$useState[0],
|
|
355
|
+
setopen = _React$useState[1];
|
|
356
|
+
|
|
324
357
|
return React.createElement(BaseAlertBox, _extends({
|
|
325
358
|
size: size,
|
|
326
359
|
variant: variant,
|
|
@@ -338,14 +371,15 @@ var ExpandableAlertBox = function ExpandableAlertBox(_ref) {
|
|
|
338
371
|
open: open
|
|
339
372
|
}, children));
|
|
340
373
|
};
|
|
374
|
+
|
|
341
375
|
var ExpandableAlertBoxTitle = function ExpandableAlertBoxTitle(_ref2) {
|
|
342
376
|
var title = _ref2.title,
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
377
|
+
open = _ref2.open,
|
|
378
|
+
_ref2$openLabel = _ref2.openLabel,
|
|
379
|
+
openLabel = _ref2$openLabel === void 0 ? 'Les mer' : _ref2$openLabel,
|
|
380
|
+
_ref2$closeLabel = _ref2.closeLabel,
|
|
381
|
+
closeLabel = _ref2$closeLabel === void 0 ? 'Lukk' : _ref2$closeLabel,
|
|
382
|
+
onClick = _ref2.onClick;
|
|
349
383
|
return React.createElement("div", {
|
|
350
384
|
className: "eds-expandable-alert-box__title"
|
|
351
385
|
}, React.createElement("div", null, title), React.createElement("button", {
|
package/dist/alert.esm.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"alert.esm.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;EACfC,OAAO,EAAEC,2BAA2B;EACpCC,IAAI,EAAEC,0BAA0B;EAChCC,OAAO,EAAEC,iCAAiC;EAC1CC,KAAK,EAAEC;CACR;AA4BM,IAAMC,YAAY,GAAgC,SAA5CA,YAAY;MACvBC,QAAQ,QAARA,QAAQ;IACRC,SAAS,QAATA,SAAS;IAAA,qBACTC,QAAQ;IAARA,QAAQ,8BAAG,KAAK;IAAA,6BAChBC,gBAAgB;IAAhBA,gBAAgB,sCAAG,MAAM;IACzBC,OAAO,QAAPA,OAAO;IAAA,oBACPC,OAAO;IAAPA,OAAO,6BAAG;MAAA,OAAO,EAAE;KAAC;IACpBC,IAAI,QAAJA,IAAI;IACJC,KAAK,QAALA,KAAK;IACLC,mBAAmB,QAAnBA,mBAAmB;IAChBC,IAAI;EAEP,sBAA8BC,KAAK,CAACC,QAAQ,CAAC,KAAK,CAAC;IAA5CC,QAAQ;IAAEC,SAAS;EAC1B,IAAID,QAAQ,EAAE;IACZ,OAAO,IAAI;;EAEb,IAAME,WAAW,GAAG,SAAdA,WAAW;IACfD,SAAS,CAAC,IAAI,CAAC;IACfR,OAAO,EAAE;GACV;EACD,IAAMU,IAAI,GAAGzB,QAAQ,CAACc,OAAO,CAAC;EAC9B,OACEM;IACET,SAAS,EAAEe,UAAU,CACnB,eAAe,sBACGV,IAAI,sBACJF,OAAO,EACzB;MAAE,sCAAsC,EAAEI;KAAqB,EAC/DP,SAAS;KAEPQ,IAAI,GAEPP,QAAQ,IACPQ;kBACcP,gBAAgB;IAC5BF,SAAS,EAAC,6BAA6B;IACvCgB,IAAI,EAAC,QAAQ;IACbC,OAAO,EAAEJ;KAETJ,oBAACS,S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EC,OAAO;EACpB,OACE7F,oBAACX,YAAY;IACXO,IAAI,EAAEA,IAAI;IACVF,OAAO,EAAEA,OAAO;IAChBH,SAAS,EAAEe,UAAU,CAAC,0BAA0B,EAAEf,SAAS,CAAC;IAC5DM,KAAK,EACHG,oBAAC8F,uBAAuB;MACtBF,IAAI,EAAEA,IAAI;MACV/F,KAAK,EAAEA,KAAK;MACZW,OAAO,EAAE;QAAA,OAAMqF,OAAO,CAAC,CAACD,IAAI,CAAC;;MAC7BF,SAAS,EAAEA,SAAS;MACpBC,UAAU,EAAEA;;KAGZ5F,IAAI,GAERC,oBAAC+F,UAAU;IAACH,IAAI,EAAEA;KAAOtG,QAAQ,CAAc,CAClC;AAEnB,CAAC;AAUD,IAAMwG,uBAAuB,GAA2C,SAAlEA,uBAAuB;MAC3BjG,KAAK,SAALA,KAAK;IACL+F,IAAI,SAAJA,IAAI;IAAA,wBACJF,SAAS;IAATA,SAAS,gCAAG,SAAS;IAAA,yBACrBC,UAAU;IAAVA,UAAU,iCAAG,MAAM;IACnBnF,OAAO,SAAPA,OAAO;EAEP,OACER;IAAKT,SAAS,EAAC;KACbS,iCAAMH,KAAK,CAAO,EAClBG;IACET,SAAS,EAAC,kCAAkC;IAC5CiB,OAAO,EAAEA,OAAO;IAChBD,IAAI,EAAC;KAEJqF,IAAI,GAAGD,UAAU,GAAGD,SAAS,EAC9B1F,oBAACgG,WAAW;IAACJ,IAAI,EAAEA,IAAI;IAAEK,MAAM;IAAG,CAC3B,CACL;AAEV,CAAC;;ACrGDC,sBAAsB,CAAC,OAAO,EAAE,OAAO,CAAC;;;;"}
|
|
1
|
+
{"version":3,"file":"alert.esm.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,EAAAA,OAAO,EAAEC,2BADM;AAEfC,EAAAA,IAAI,EAAEC,0BAFS;AAGfC,EAAAA,OAAO,EAAEC,iCAHM;AAIfC,EAAAA,KAAK,EAAEC;AAJQ,CAAjB;AAiCO,IAAMC,YAAY,GAAgC,SAA5CA,YAA4C;MACvDC,gBAAAA;MACAC,iBAAAA;2BACAC;MAAAA,sCAAW;mCACXC;MAAAA,sDAAmB;MACnBC,eAAAA;0BACAC;MAAAA,oCAAU;AAAA,WAAO,EAAP;AAAA;MACVC,YAAAA;MACAC,aAAAA;MACAC,2BAAAA;MACGC;;AAEH,wBAA8BC,KAAK,CAACC,QAAN,CAAe,KAAf,CAA9B;AAAA,MAAOC,QAAP;AAAA,MAAiBC,SAAjB;;AACA,MAAID,QAAJ,EAAc;AACZ,WAA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
|
-
"version": "0.11.
|
|
3
|
+
"version": "0.11.16",
|
|
4
4
|
"license": "EUPL-1.2",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/alert.esm.js",
|
|
@@ -17,34 +17,29 @@
|
|
|
17
17
|
"access": "public"
|
|
18
18
|
},
|
|
19
19
|
"scripts": {
|
|
20
|
-
"start": "
|
|
21
|
-
"build": "
|
|
22
|
-
"test": "
|
|
23
|
-
"lint": "
|
|
20
|
+
"start": "dts watch --noClean",
|
|
21
|
+
"build": "dts build",
|
|
22
|
+
"test": "dts test",
|
|
23
|
+
"lint": "dts lint"
|
|
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/expand": "^3.3.
|
|
31
|
-
"@entur/icons": "^5.
|
|
32
|
-
"@entur/typography": "^1.7.
|
|
33
|
-
"@entur/utils": "^0.4.
|
|
30
|
+
"@entur/expand": "^3.3.29",
|
|
31
|
+
"@entur/icons": "^5.4.1",
|
|
32
|
+
"@entur/typography": "^1.7.4",
|
|
33
|
+
"@entur/utils": "^0.4.9",
|
|
34
34
|
"classnames": "^2.3.1",
|
|
35
35
|
"copy-text-to-clipboard": "2.2"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
|
-
"@entur/tokens": "^3.4.
|
|
39
|
-
"dts-cli": "^1.1.6",
|
|
40
|
-
"jest": "^27.0.0",
|
|
41
|
-
"jest-watch-typeahead": "^2.2.0",
|
|
42
|
-
"ts-jest": "^27.0.0",
|
|
43
|
-
"typescript": "^4.8.0"
|
|
38
|
+
"@entur/tokens": "^3.4.4"
|
|
44
39
|
},
|
|
45
40
|
"volta": {
|
|
46
41
|
"node": "14.17.0",
|
|
47
42
|
"yarn": "1.18.0"
|
|
48
43
|
},
|
|
49
|
-
"gitHead": "
|
|
44
|
+
"gitHead": "de71e205560a699e2dce301e133966dc9348c459"
|
|
50
45
|
}
|