@entur/alert 0.14.13 → 0.15.1

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.
@@ -8,9 +8,13 @@ export type CopyableTextProps = {
8
8
  /** Hvis du ønsker å kopiere noe annet enn
9
9
  * innholdet i children kan du legge det inn her */
10
10
  textToCopy?: string;
11
- /** Overskrift i toast-varselet */
11
+ /** Overskrift i toast-varselet
12
+ * @default 'Kopiert!'
13
+ */
12
14
  successHeading?: string;
13
- /** Bekreftelsesmelding i toast-varselet */
15
+ /** Bekreftelsesmelding i toast-varselet
16
+ * @default `${textToCopy} ble kopiert til utklippstavlen.`
17
+ */
14
18
  successMessage?: string;
15
19
  } & Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, 'children'>;
16
- export declare const CopyableText: ({ children, successHeading, successMessage, textToCopy, className, ...rest }: CopyableTextProps) => JSX.Element;
20
+ export declare const CopyableText: ({ children, successHeading, successMessage, textToCopy, className, "aria-label": ariaLabel, ...rest }: CopyableTextProps) => JSX.Element;
@@ -7,6 +7,7 @@ var React = require('react');
7
7
  var classNames = require('classnames');
8
8
  var icons = require('@entur/icons');
9
9
  var copy = require('copy-text-to-clipboard');
10
+ var button = require('@entur/button');
10
11
  var typography = require('@entur/typography');
11
12
  var _ = require('@entur/expand/');
12
13
 
@@ -284,37 +285,48 @@ var useToast = function useToast() {
284
285
  };
285
286
  };
286
287
 
287
- var _excluded$1 = ["children", "successHeading", "successMessage", "textToCopy", "className"];
288
+ var _excluded$1 = ["children", "successHeading", "successMessage", "textToCopy", "className", "aria-label"];
288
289
  var CopyableText = function CopyableText(_ref) {
289
290
  var children = _ref.children,
290
291
  _ref$successHeading = _ref.successHeading,
291
292
  successHeading = _ref$successHeading === void 0 ? 'Kopiert!' : _ref$successHeading,
292
- _ref$successMessage = _ref.successMessage,
293
- successMessage = _ref$successMessage === void 0 ? 'Innholdet ble kopiert til utklippstavlen.' : _ref$successMessage,
293
+ successMessage = _ref.successMessage,
294
294
  textToCopy = _ref.textToCopy,
295
295
  className = _ref.className,
296
+ _ref$ariaLabel = _ref['aria-label'],
297
+ ariaLabel = _ref$ariaLabel === void 0 ? "Kopier " + (textToCopy != null ? textToCopy : children) + " til utklippstavlen" : _ref$ariaLabel,
296
298
  rest = _objectWithoutPropertiesLoose(_ref, _excluded$1);
297
299
  var _useToast = useToast(),
298
300
  addToast = _useToast.addToast;
299
301
  var buttonRef = React.useRef(null);
302
+ var _textToCopy = textToCopy != null ? textToCopy : children;
303
+ var _successMessage = successMessage != null ? successMessage : _textToCopy + " ble kopiert til utklippstavlen.";
300
304
  var handleClick = function handleClick() {
301
- buttonRef.current && copy(textToCopy !== undefined ? textToCopy : children, {
305
+ buttonRef.current && copy(_textToCopy, {
302
306
  target: buttonRef.current
303
307
  }) && addToast({
304
308
  title: successHeading,
305
- content: successMessage
309
+ content: _successMessage
306
310
  });
307
311
  };
308
312
  return React.createElement("button", _extends({
309
- className: 'copyable-text ' + className,
313
+ className: 'eds-copyable-text ' + className,
310
314
  style: _extends({}, rest.style),
311
315
  type: "button",
312
316
  onClick: handleClick,
313
317
  ref: buttonRef,
314
- "aria-label": "Kopier innhold"
315
- }, rest), React.createElement(typography.PreformattedText, null, children), React.createElement(icons.CopyIcon, {
316
- className: "copyable-text__icon"
317
- }));
318
+ tabIndex: -1,
319
+ "aria-label": ""
320
+ }, rest), React.createElement(typography.PreformattedText, {
321
+ className: "eds-copyable-text__preformatted-text"
322
+ }, React.createElement("span", {
323
+ className: "eds-copyable-text__displayed-text"
324
+ }, children), React.createElement(button.IconButton, {
325
+ className: "eds-copyable-text__button",
326
+ "aria-label": ariaLabel
327
+ }, React.createElement(icons.CopyIcon, {
328
+ className: 'eds-copyable-text__button__icon'
329
+ }))));
318
330
  };
319
331
 
320
332
  var _excluded = ["variant", "title", "children", "size", "className", "openLabel", "closeLabel"];
@@ -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: {\n icon: OutlinedValidationCheckIcon,\n description: 'Suksessmelding',\n },\n info: { icon: OutlinedValidationInfoIcon, description: 'Infomelding' },\n warning: {\n icon: OutlinedValidationExclamationIcon,\n description: 'Varselmelding',\n },\n error: { icon: OutlinedValidationErrorIcon, description: 'Feilmelding' },\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].icon;\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\n role=\"img\"\n className=\"eds-alert-box__icon\"\n aria-label={iconsMap[variant].description}\n />\n <div\n className={classNames('eds-alert-box__content', {\n 'eds-alert-box__content--no-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 /** Hvis du ønsker å kopiere noe annet enn\n * innholdet i children kan du legge det inn her */\n textToCopy?: string;\n /** Overskrift i toast-varselet */\n 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 textToCopy,\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(textToCopy !== undefined ? textToCopy : 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","icon","OutlinedValidationCheckIcon","description","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","role","BannerAlertBox","props","ToastAlertBox","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","textToCopy","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,EAAE;AACPC,IAAAA,IAAI,EAAEC,iCAA2B;AACjCC,IAAAA,WA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AS,gCAAG,SAAS,GAAA,eAAA;AAAA,IAAA,gBAAA,GAAA,KAAA,CACrBC,UAAU;AAAVA,IAAAA,UAAU,iCAAG,MAAM,GAAA,gBAAA;AACnBpF,IAAAA,OAAO,SAAPA,OAAO,CAAA;AAEP,EAAA,OACET,KAAA,CAAAM,aAAA,CAAA,KAAA,EAAA;AAAKhB,IAAAA,SAAS,EAAC,iCAAA;AAAiC,GAAA,EAC9CU,KAAA,CAAAM,aAAA,CAAA,KAAA,EAAA,IAAA,EAAMV,KAAK,CAAO,EAClBI,KACE,CAAAM,aAAA,CAAA,QAAA,EAAA;AAAAhB,IAAAA,SAAS,EAAC,kCAAkC;AAC5CmB,IAAAA,OAAO,EAAEA,OAAO;AAChBD,IAAAA,IAAI,EAAC,QAAA;AAAQ,GAAA,EAEZsF,IAAI,GAAGD,UAAU,GAAGD,SAAS,EAC9B5F,KAAC,CAAAM,aAAA,CAAA4F,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
+ {"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: {\n icon: OutlinedValidationCheckIcon,\n description: 'Suksessmelding',\n },\n info: { icon: OutlinedValidationInfoIcon, description: 'Infomelding' },\n warning: {\n icon: OutlinedValidationExclamationIcon,\n description: 'Varselmelding',\n },\n error: { icon: OutlinedValidationErrorIcon, description: 'Feilmelding' },\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].icon;\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\n role=\"img\"\n className=\"eds-alert-box__icon\"\n aria-label={iconsMap[variant].description}\n />\n <div\n className={classNames('eds-alert-box__content', {\n 'eds-alert-box__content--no-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';\nimport copy from 'copy-text-to-clipboard';\n\nimport { IconButton } from '@entur/button';\nimport { CopyIcon } from '@entur/icons';\nimport { PreformattedText } from '@entur/typography';\n\nimport { useToast } from './ToastProvider';\n\nimport './CopyableText.scss';\n\nexport type CopyableTextProps = {\n /** Ekstra klassenavn */\n className?: string;\n /** Tekstinnhold som vises og kopieres */\n children: string;\n /** Hvis du ønsker å kopiere noe annet enn\n * innholdet i children kan du legge det inn her */\n textToCopy?: string;\n /** Overskrift i toast-varselet\n * @default 'Kopiert!'\n */\n successHeading?: string;\n /** Bekreftelsesmelding i toast-varselet\n * @default `${textToCopy} ble kopiert til utklippstavlen.`\n */\n successMessage?: string;\n} & Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, 'children'>;\n\nexport const CopyableText = ({\n children,\n successHeading = 'Kopiert!',\n successMessage,\n textToCopy,\n className,\n 'aria-label': ariaLabel = `Kopier ${\n textToCopy ?? children\n } til utklippstavlen`,\n ...rest\n}: CopyableTextProps): JSX.Element => {\n const { addToast } = useToast();\n const buttonRef = React.useRef<HTMLButtonElement>(null);\n const _textToCopy = textToCopy ?? children;\n const _successMessage =\n successMessage ?? `${_textToCopy} ble kopiert til utklippstavlen.`;\n const handleClick = () => {\n buttonRef.current &&\n copy(_textToCopy, {\n target: buttonRef.current,\n }) &&\n addToast({ title: successHeading, content: _successMessage });\n };\n return (\n <button\n className={'eds-copyable-text ' + className}\n style={{ ...rest.style }}\n type=\"button\"\n onClick={handleClick}\n ref={buttonRef}\n tabIndex={-1}\n aria-label=\"\"\n {...rest}\n >\n <PreformattedText className=\"eds-copyable-text__preformatted-text\">\n <span className=\"eds-copyable-text__displayed-text\">{children}</span>\n <IconButton\n className=\"eds-copyable-text__button\"\n aria-label={ariaLabel}\n >\n <CopyIcon className={'eds-copyable-text__button__icon'} />\n </IconButton>\n </PreformattedText>\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","icon","OutlinedValidationCheckIcon","description","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","role","BannerAlertBox","props","ToastAlertBox","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","textToCopy","ariaLabel","buttonRef","_textToCopy","_successMessage","handleClick","copy","target","ref","tabIndex","PreformattedText","IconButton","CopyIcon","SmallExpandableAlertBox","ExpandableAlertBox","BannerExpandableAlertBox","openLabel","closeLabel","open","setopen","ExpandableAlertBoxTitle","BaseExpand","ExpandArrow","inline","warnAboutMissingStyles"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAWA,IAAMA,QAAQ,GAAG;AACfC,EAAAA,OAAO,EAAE;AACPC,IAAAA,IAAI,EAAEC,iCAA2B;AACjCC,IAAAA,WAAW,EAAE,gBAAA;GACd;AACDC,EAAAA,IAAI,EAAE;AAAEH,IAAAA,IAAI,EAAE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,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@entur/utils"),t=require("react"),n=require("classnames"),o=require("@entur/icons"),a=require("copy-text-to-clipboard"),r=require("@entur/typography"),i=require("@entur/expand/");function l(){return l=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},l.apply(this,arguments)}function s(e,t){if(null==e)return{};var n,o,a={},r=Object.keys(e);for(o=0;o<r.length;o++)t.indexOf(n=r[o])>=0||(a[n]=e[n]);return a}var c=["children","className","closable","closeButtonLabel","variant","onClose","size","title","toastIsBeingRemoved"],u={success:{icon:o.OutlinedValidationCheckIcon,description:"Suksessmelding"},info:{icon:o.OutlinedValidationInfoIcon,description:"Infomelding"},warning:{icon:o.OutlinedValidationExclamationIcon,description:"Varselmelding"},error:{icon:o.OutlinedValidationErrorIcon,description:"Feilmelding"}},d=function(e){var a=e.children,r=e.className,i=e.closable,d=void 0!==i&&i,m=e.closeButtonLabel,p=void 0===m?"Lukk":m,b=e.variant,v=e.onClose,f=void 0===v?function(){return{}}:v,x=e.size,E=e.title,y=e.toastIsBeingRemoved,T=s(e,c),g=t.useState(!1),_=g[1];if(g[0])return null;var h=u[b].icon;return t.createElement("div",l({className:n("eds-alert-box","eds-alert-box--"+x,"eds-alert-box--"+b,{"eds-alert-box--toast--exit-animation":y},r)},T),d&&t.createElement("button",{"aria-label":p,className:"eds-alert-box__close-button",type:"button",onClick:function(){_(!0),f()}},t.createElement(o.CloseIcon,null)),t.createElement(h,{role:"img",className:"eds-alert-box__icon","aria-label":u[b].description}),t.createElement("div",{className:n("eds-alert-box__content",{"eds-alert-box__content--no-title":!E,"eds-alert-box__content--no-children":!a})},E&&t.createElement("div",{className:"eds-alert-box__title"},E),a&&a))},m=function(e){return t.createElement(d,l({},e,{size:"toast",role:"status"}))},p=["className","width","onClose","closable","closeButtonLabel"],b=t.createContext(null),v=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?l({},e,{isBeingRemoved:!0}):e}));case"REMOVE_TOAST":return e.filter((function(e){return e.id!==t.payload}))}},f=function(){var e=t.useContext(b);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}},x=["children","successHeading","successMessage","textToCopy","className"],E=["variant","title","children","size","className","openLabel","closeLabel"],y=function(e){var o=e.variant,a=e.title,r=e.children,c=e.size,u=e.className,m=e.openLabel,p=e.closeLabel,b=s(e,E),v=t.useState(!1),f=v[0],x=v[1];return t.createElement(d,l({size:c,variant:o,className:n("eds-expandable-alert-box",u),title:t.createElement(T,{open:f,title:a,onClick:function(){return x(!f)},openLabel:m,closeLabel:p})},b),t.createElement(i.BaseExpand,{open:f},r))},T=function(e){var n=e.open,o=e.openLabel,a=void 0===o?"Les mer":o,r=e.closeLabel,l=void 0===r?"Lukk":r,s=e.onClick;return t.createElement("div",{className:"eds-expandable-alert-box__title"},t.createElement("div",null,e.title),t.createElement("button",{className:"eds-expandable-alert-box__button",onClick:s,type:"button"},n?l:a,t.createElement(i.ExpandArrow,{open:n,inline:!0})))};e.warnAboutMissingStyles("alert","icons"),exports.BannerAlertBox=function(e){return t.createElement(d,l({},e,{size:"banner"}))},exports.BannerExpandableAlertBox=function(e){return t.createElement(y,l({size:"banner"},e))},exports.CopyableText=function(e){var n=e.children,i=e.successHeading,c=void 0===i?"Kopiert!":i,u=e.successMessage,d=void 0===u?"Innholdet ble kopiert til utklippstavlen.":u,m=e.textToCopy,p=e.className,b=s(e,x),v=f().addToast,E=t.useRef(null);return t.createElement("button",l({className:"copyable-text "+p,style:l({},b.style),type:"button",onClick:function(){E.current&&a(void 0!==m?m:n,{target:E.current})&&v({title:c,content:d})},ref:E,"aria-label":"Kopier innhold"},b),t.createElement(r.PreformattedText,null,n),t.createElement(o.CopyIcon,{className:"copyable-text__icon"}))},exports.SmallAlertBox=function(e){var o=e.className,a=e.width,r=e.onClose,i=e.closable,c=void 0!==i&&i,u=e.closeButtonLabel,m=s(e,p);return t.createElement(d,l({className:n(o,{"eds-alert-box--fit-content":"fit-content"===a})},m,{onClose:r,closable:c,closeButtonLabel:u,size:"small"}))},exports.SmallExpandableAlertBox=function(e){return t.createElement(y,l({size:"small"},e))},exports.ToastAlertBox=m,exports.ToastProvider=function(e){var o=e.delay,a=void 0===o?6e3:o,r=e.children,i=e.position,s=void 0===i?"bottom-right":i,c=e.className,u=e.style,d=t.useReducer(v,[]),p=d[0],f=d[1],x=t.useState(),E=x[0],y=x[1],T=t.useRef({}),g=t.useCallback((function(e){window.clearTimeout(T.current[e]),f({type:"REMOVE_TOAST",payload:e}),delete T.current[e]}),[]),_=t.useCallback((function(e){window.clearTimeout(T.current[e+"animation"]),f({type:"PLAY_EXIT_ANIMATION",payload:e}),delete T.current[e+"animation"]}),[]),h=t.useCallback((function(e,t){T.current[e+"animation"]=window.setTimeout((function(){return _(e)}),t-400),T.current[e]=window.setTimeout((function(){return g(e)}),t)}),[T,_,g]),N=t.useCallback((function(e){var t=Math.random().toString().substring(2),n=function(e,t){return"string"==typeof e?{id:t,content:e,variant:"success",isBeingRemoved:!1}:l({id:t,variant:"success",isBeingRemoved:!1},e)}(e,t);f({type:"ADD_TOAST",payload:n}),h(t,a)}),[a,h]),C=function(){y(void 0),p.forEach((function(e){h(e.id,a)}))},B=t.useMemo((function(){return{toasts:p,addToast:N,removeToast:g}}),[N,g,p]);return t.createElement(b.Provider,{value:B},p.length>0&&t.createElement("div",{className:n("eds-toast-container","eds-toast-container--"+s,c),style:u},p.slice(0,3).map((function(e){return t.createElement(m,{variant:e.variant,title:e.title,onClose:(o=e.id,function(){g(o),C()}),onMouseEnter:(n=e,function(){n.isBeingRemoved||(y(n.id),Object.values(T.current).forEach((function(e){window.clearTimeout(e)})),T.current={})}),onMouseLeave:C,closable:E===e.id,toastIsBeingRemoved:e.isBeingRemoved,key:e.id},e.content);var n,o}))),r)},exports.useToast=f;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@entur/utils"),t=require("react"),n=require("classnames"),a=require("@entur/icons"),o=require("copy-text-to-clipboard"),r=require("@entur/button"),l=require("@entur/typography"),i=require("@entur/expand/");function s(){return s=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},s.apply(this,arguments)}function c(e,t){if(null==e)return{};var n,a,o={},r=Object.keys(e);for(a=0;a<r.length;a++)t.indexOf(n=r[a])>=0||(o[n]=e[n]);return o}var u=["children","className","closable","closeButtonLabel","variant","onClose","size","title","toastIsBeingRemoved"],d={success:{icon:a.OutlinedValidationCheckIcon,description:"Suksessmelding"},info:{icon:a.OutlinedValidationInfoIcon,description:"Infomelding"},warning:{icon:a.OutlinedValidationExclamationIcon,description:"Varselmelding"},error:{icon:a.OutlinedValidationErrorIcon,description:"Feilmelding"}},m=function(e){var o=e.children,r=e.className,l=e.closable,i=void 0!==l&&l,m=e.closeButtonLabel,b=void 0===m?"Lukk":m,p=e.variant,v=e.onClose,f=void 0===v?function(){return{}}:v,x=e.size,E=e.title,y=e.toastIsBeingRemoved,_=c(e,u),T=t.useState(!1),g=T[1];if(T[0])return null;var N=d[p].icon;return t.createElement("div",s({className:n("eds-alert-box","eds-alert-box--"+x,"eds-alert-box--"+p,{"eds-alert-box--toast--exit-animation":y},r)},_),i&&t.createElement("button",{"aria-label":b,className:"eds-alert-box__close-button",type:"button",onClick:function(){g(!0),f()}},t.createElement(a.CloseIcon,null)),t.createElement(N,{role:"img",className:"eds-alert-box__icon","aria-label":d[p].description}),t.createElement("div",{className:n("eds-alert-box__content",{"eds-alert-box__content--no-title":!E,"eds-alert-box__content--no-children":!o})},E&&t.createElement("div",{className:"eds-alert-box__title"},E),o&&o))},b=function(e){return t.createElement(m,s({},e,{size:"toast",role:"status"}))},p=["className","width","onClose","closable","closeButtonLabel"],v=t.createContext(null),f=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?s({},e,{isBeingRemoved:!0}):e}));case"REMOVE_TOAST":return e.filter((function(e){return e.id!==t.payload}))}},x=function(){var e=t.useContext(v);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}},E=["children","successHeading","successMessage","textToCopy","className","aria-label"],y=["variant","title","children","size","className","openLabel","closeLabel"],_=function(e){var a=e.variant,o=e.title,r=e.children,l=e.size,u=e.className,d=e.openLabel,b=e.closeLabel,p=c(e,y),v=t.useState(!1),f=v[0],x=v[1];return t.createElement(m,s({size:l,variant:a,className:n("eds-expandable-alert-box",u),title:t.createElement(T,{open:f,title:o,onClick:function(){return x(!f)},openLabel:d,closeLabel:b})},p),t.createElement(i.BaseExpand,{open:f},r))},T=function(e){var n=e.open,a=e.openLabel,o=void 0===a?"Les mer":a,r=e.closeLabel,l=void 0===r?"Lukk":r,s=e.onClick;return t.createElement("div",{className:"eds-expandable-alert-box__title"},t.createElement("div",null,e.title),t.createElement("button",{className:"eds-expandable-alert-box__button",onClick:s,type:"button"},n?l:o,t.createElement(i.ExpandArrow,{open:n,inline:!0})))};e.warnAboutMissingStyles("alert","icons"),exports.BannerAlertBox=function(e){return t.createElement(m,s({},e,{size:"banner"}))},exports.BannerExpandableAlertBox=function(e){return t.createElement(_,s({size:"banner"},e))},exports.CopyableText=function(e){var n=e.children,i=e.successHeading,u=void 0===i?"Kopiert!":i,d=e.successMessage,m=e.textToCopy,b=e.className,p=e["aria-label"],v=void 0===p?"Kopier "+(null!=m?m:n)+" til utklippstavlen":p,f=c(e,E),y=x().addToast,_=t.useRef(null),T=null!=m?m:n,g=null!=d?d:T+" ble kopiert til utklippstavlen.";return t.createElement("button",s({className:"eds-copyable-text "+b,style:s({},f.style),type:"button",onClick:function(){_.current&&o(T,{target:_.current})&&y({title:u,content:g})},ref:_,tabIndex:-1,"aria-label":""},f),t.createElement(l.PreformattedText,{className:"eds-copyable-text__preformatted-text"},t.createElement("span",{className:"eds-copyable-text__displayed-text"},n),t.createElement(r.IconButton,{className:"eds-copyable-text__button","aria-label":v},t.createElement(a.CopyIcon,{className:"eds-copyable-text__button__icon"}))))},exports.SmallAlertBox=function(e){var a=e.className,o=e.width,r=e.onClose,l=e.closable,i=void 0!==l&&l,u=e.closeButtonLabel,d=c(e,p);return t.createElement(m,s({className:n(a,{"eds-alert-box--fit-content":"fit-content"===o})},d,{onClose:r,closable:i,closeButtonLabel:u,size:"small"}))},exports.SmallExpandableAlertBox=function(e){return t.createElement(_,s({size:"small"},e))},exports.ToastAlertBox=b,exports.ToastProvider=function(e){var a=e.delay,o=void 0===a?6e3:a,r=e.children,l=e.position,i=void 0===l?"bottom-right":l,c=e.className,u=e.style,d=t.useReducer(f,[]),m=d[0],p=d[1],x=t.useState(),E=x[0],y=x[1],_=t.useRef({}),T=t.useCallback((function(e){window.clearTimeout(_.current[e]),p({type:"REMOVE_TOAST",payload:e}),delete _.current[e]}),[]),g=t.useCallback((function(e){window.clearTimeout(_.current[e+"animation"]),p({type:"PLAY_EXIT_ANIMATION",payload:e}),delete _.current[e+"animation"]}),[]),N=t.useCallback((function(e,t){_.current[e+"animation"]=window.setTimeout((function(){return g(e)}),t-400),_.current[e]=window.setTimeout((function(){return T(e)}),t)}),[_,g,T]),h=t.useCallback((function(e){var t=Math.random().toString().substring(2),n=function(e,t){return"string"==typeof e?{id:t,content:e,variant:"success",isBeingRemoved:!1}:s({id:t,variant:"success",isBeingRemoved:!1},e)}(e,t);p({type:"ADD_TOAST",payload:n}),N(t,o)}),[o,N]),C=function(){y(void 0),m.forEach((function(e){N(e.id,o)}))},B=t.useMemo((function(){return{toasts:m,addToast:h,removeToast:T}}),[h,T,m]);return t.createElement(v.Provider,{value:B},m.length>0&&t.createElement("div",{className:n("eds-toast-container","eds-toast-container--"+i,c),style:u},m.slice(0,3).map((function(e){return t.createElement(b,{variant:e.variant,title:e.title,onClose:(a=e.id,function(){T(a),C()}),onMouseEnter:(n=e,function(){n.isBeingRemoved||(y(n.id),Object.values(_.current).forEach((function(e){window.clearTimeout(e)})),_.current={})}),onMouseLeave:C,closable:E===e.id,toastIsBeingRemoved:e.isBeingRemoved,key:e.id},e.content);var n,a}))),r)},exports.useToast=x;
2
2
  //# sourceMappingURL=alert.cjs.production.min.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"alert.cjs.production.min.js","sources":["../src/BaseAlertBox.tsx","../src/ToastAlertBox.tsx","../src/ToastProvider.tsx","../src/ExpandableAlertBox.tsx","../src/index.tsx","../src/BannerAlertBox.tsx","../src/CopyableText.tsx","../src/SmallAlertBox.tsx"],"sourcesContent":["import React from 'react';\nimport classNames from 'classnames';\nimport {\n CloseIcon,\n OutlinedValidationCheckIcon,\n OutlinedValidationExclamationIcon,\n OutlinedValidationInfoIcon,\n OutlinedValidationErrorIcon,\n} from '@entur/icons';\nimport './styles.scss';\n\nconst iconsMap = {\n success: {\n icon: OutlinedValidationCheckIcon,\n description: 'Suksessmelding',\n },\n info: { icon: OutlinedValidationInfoIcon, description: 'Infomelding' },\n warning: {\n icon: OutlinedValidationExclamationIcon,\n description: 'Varselmelding',\n },\n error: { icon: OutlinedValidationErrorIcon, description: 'Feilmelding' },\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].icon;\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\n role=\"img\"\n className=\"eds-alert-box__icon\"\n aria-label={iconsMap[variant].description}\n />\n <div\n className={classNames('eds-alert-box__content', {\n 'eds-alert-box__content--no-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 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 { 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 { 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","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';\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 /** Hvis du ønsker å kopiere noe annet enn\n * innholdet i children kan du legge det inn her */\n textToCopy?: string;\n /** Overskrift i toast-varselet */\n 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 textToCopy,\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(textToCopy !== undefined ? textToCopy : 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 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"],"names":["iconsMap","success","icon","OutlinedValidationCheckIcon","description","info","OutlinedValidationInfoIcon","warning","OutlinedValidationExclamationIcon","error","OutlinedValidationErrorIcon","BaseAlertBox","_ref","children","className","_ref$closable","closable","_ref$closeButtonLabel","closeButtonLabel","variant","_ref$onClose","onClose","size","title","toastIsBeingRemoved","rest","_objectWithoutPropertiesLoose","_excluded","_React$useState","React","useState","setClosed","Icon","createElement","_extends","classNames","type","onClick","CloseIcon","role","ToastAlertBox","props","ToastContext","createContext","toastReducer","prevToasts","action","payload","concat","map","toast","id","isBeingRemoved","filter","useToast","context","useContext","Error","addToast","ExpandableAlertBox","openLabel","closeLabel","open","setopen","ExpandableAlertBoxTitle","BaseExpand","_ref2","_ref2$openLabel","_ref2$closeLabel","ExpandArrow","inline","warnAboutMissingStyles","_ref$successHeading","successHeading","_ref$successMessage","successMessage","textToCopy","buttonRef","useRef","style","current","copy","undefined","target","content","ref","PreformattedText","CopyIcon","width","_ref$delay","delay","_ref$position","position","_React$useReducer","useReducer","toasts","dispatch","hoveringId","setHovering","timeoutIdRefs","removeToast","useCallback","window","clearTimeout","playExitAnimation","removeToastWithAnimationAfterDelay","setTimeout","Math","random","toString","substring","createToast","handleMouseLeave","forEach","contextValue","useMemo","Provider","value","length","slice","toastToShow","toastId","onMouseEnter","Object","values","timeoutId","onMouseLeave","key"],"mappings":"ouBAWMA,EAAW,CACfC,QAAS,CACPC,KAAMC,EAA2BA,4BACjCC,YAAa,kBAEfC,KAAM,CAAEH,KAAMI,EAA0BA,2BAAEF,YAAa,eACvDG,QAAS,CACPL,KAAMM,EAAiCA,kCACvCJ,YAAa,iBAEfK,MAAO,CAAEP,KAAMQ,EAA2BA,4BAAEN,YAAa,gBA6B9CO,EAA4C,SAWpDC,GAAA,IAVHC,IAAAA,SACAC,IAAAA,UAASC,EAAAH,EACTI,SAAAA,cAAgBD,EAAAE,EAAAL,EAChBM,iBAAAA,aAAmB,OAAMD,EACzBE,IAAAA,QAAOC,EAAAR,EACPS,QAAAA,OAAU,IAAAD,EAAA,WAAA,MAAO,IAAGA,EACpBE,IAAAA,KACAC,IAAAA,MACAC,IAAAA,oBACGC,EAAIC,EAAAd,EAAAe,GAEPC,EAA8BC,EAAMC,UAAS,GAA5BC,EAASH,EAAA,GAC1B,GADeA,EAAA,GAEb,OAAO,KAET,IAIMI,EAAOhC,EAASmB,GAASjB,KAC/B,OACE2B,EACEI,cAAA,MAAAC,EAAA,CAAApB,UAAWqB,EACT,kCACkBb,EAAI,kBACJH,EAClB,CAAE,uCAAwCK,GAC1CV,IAEEW,GAEHT,GACCa,EACcI,cAAA,SAAA,CAAA,aAAAf,EACZJ,UAAU,8BACVsB,KAAK,SACLC,QArBY,WAClBN,GAAU,GACVV,MAqBMQ,EAACI,cAAAK,YAAY,OAGjBT,EAAAI,cAACD,EACC,CAAAO,KAAK,MACLzB,UAAU,sBAAqB,aACnBd,EAASmB,GAASf,cAEhCyB,EAAAI,cAAA,MAAA,CACEnB,UAAWqB,E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,SAAAY,GAC3CvB,OAAOC,aAAasB,EACtB,IACA1B,EAAcnB,QAAU,MAqCd8C,aAAcd,EACdhG,SAAUiF,IAAeuB,EAAYrE,GACrC3B,oBAAqBgG,EAAYpE,eACjC2E,IAAKP,EAAYrE,IAEhBqE,EAAYpC,SAhDA,IAAClC,EAgBLuE,CAiCK,KAIrB5G,EAGP"}
1
+ {"version":3,"file":"alert.cjs.production.min.js","sources":["../src/BaseAlertBox.tsx","../src/ToastAlertBox.tsx","../src/ToastProvider.tsx","../src/ExpandableAlertBox.tsx","../src/index.tsx","../src/BannerAlertBox.tsx","../src/CopyableText.tsx","../src/SmallAlertBox.tsx"],"sourcesContent":["import React from 'react';\nimport classNames from 'classnames';\nimport {\n CloseIcon,\n OutlinedValidationCheckIcon,\n OutlinedValidationExclamationIcon,\n OutlinedValidationInfoIcon,\n OutlinedValidationErrorIcon,\n} from '@entur/icons';\nimport './styles.scss';\n\nconst iconsMap = {\n success: {\n icon: OutlinedValidationCheckIcon,\n description: 'Suksessmelding',\n },\n info: { icon: OutlinedValidationInfoIcon, description: 'Infomelding' },\n warning: {\n icon: OutlinedValidationExclamationIcon,\n description: 'Varselmelding',\n },\n error: { icon: OutlinedValidationErrorIcon, description: 'Feilmelding' },\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].icon;\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\n role=\"img\"\n className=\"eds-alert-box__icon\"\n aria-label={iconsMap[variant].description}\n />\n <div\n className={classNames('eds-alert-box__content', {\n 'eds-alert-box__content--no-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 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 { 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 { 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","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 copy from 'copy-text-to-clipboard';\n\nimport { IconButton } from '@entur/button';\nimport { CopyIcon } from '@entur/icons';\nimport { PreformattedText } from '@entur/typography';\n\nimport { useToast } from './ToastProvider';\n\nimport './CopyableText.scss';\n\nexport type CopyableTextProps = {\n /** Ekstra klassenavn */\n className?: string;\n /** Tekstinnhold som vises og kopieres */\n children: string;\n /** Hvis du ønsker å kopiere noe annet enn\n * innholdet i children kan du legge det inn her */\n textToCopy?: string;\n /** Overskrift i toast-varselet\n * @default 'Kopiert!'\n */\n successHeading?: string;\n /** Bekreftelsesmelding i toast-varselet\n * @default `${textToCopy} ble kopiert til utklippstavlen.`\n */\n successMessage?: string;\n} & Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, 'children'>;\n\nexport const CopyableText = ({\n children,\n successHeading = 'Kopiert!',\n successMessage,\n textToCopy,\n className,\n 'aria-label': ariaLabel = `Kopier ${\n textToCopy ?? children\n } til utklippstavlen`,\n ...rest\n}: CopyableTextProps): JSX.Element => {\n const { addToast } = useToast();\n const buttonRef = React.useRef<HTMLButtonElement>(null);\n const _textToCopy = textToCopy ?? children;\n const _successMessage =\n successMessage ?? `${_textToCopy} ble kopiert til utklippstavlen.`;\n const handleClick = () => {\n buttonRef.current &&\n copy(_textToCopy, {\n target: buttonRef.current,\n }) &&\n addToast({ title: successHeading, content: _successMessage });\n };\n return (\n <button\n className={'eds-copyable-text ' + className}\n style={{ ...rest.style }}\n type=\"button\"\n onClick={handleClick}\n ref={buttonRef}\n tabIndex={-1}\n aria-label=\"\"\n {...rest}\n >\n <PreformattedText className=\"eds-copyable-text__preformatted-text\">\n <span className=\"eds-copyable-text__displayed-text\">{children}</span>\n <IconButton\n className=\"eds-copyable-text__button\"\n aria-label={ariaLabel}\n >\n <CopyIcon className={'eds-copyable-text__button__icon'} />\n </IconButton>\n </PreformattedText>\n </button>\n );\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"],"names":["iconsMap","success","icon","OutlinedValidationCheckIcon","description","info","OutlinedValidationInfoIcon","warning","OutlinedValidationExclamationIcon","error","OutlinedValidationErrorIcon","BaseAlertBox","_ref","children","className","_ref$closable","closable","_ref$closeButtonLabel","closeButtonLabel","variant","_ref$onClose","onClose","size","title","toastIsBeingRemoved","rest","_objectWithoutPropertiesLoose","_excluded","_React$useState","React","useState","setClosed","Icon","createElement","_extends","classNames","type","onClick","CloseIcon","role","ToastAlertBox","props","ToastContext","createContext","toastReducer","prevToasts","action","payload","concat","map","toast","id","isBeingRemoved","filter","useToast","context","useContext","Error","addToast","ExpandableAlertBox","openLabel","closeLabel","open","setopen","ExpandableAlertBoxTitle","BaseExpand","_ref2","_ref2$openLabel","_ref2$closeLabel","ExpandArrow","inline","warnAboutMissingStyles","_ref$successHeading","successHeading","successMessage","textToCopy","_ref$ariaLabel","ariaLabel","buttonRef","useRef","_textToCopy","_successMessage","style","current","copy","target","content","ref","tabIndex","PreformattedText","IconButton","CopyIcon","width","_ref$delay","delay","_ref$position","position","_React$useReducer","useReducer","toasts","dispatch","hoveringId","setHovering","timeoutIdRefs","removeToast","useCallback","window","clearTimeout","playExitAnimation","removeToastWithAnimationAfterDelay","setTimeout","Math","random","toString","substring","createToast","handleMouseLeave","undefined","forEach","contextValue","useMemo","Provider","value","length","slice","toastToShow","toastId","onMouseEnter","Object","values","timeoutId","onMouseLeave","key"],"mappings":"+vBAWMA,EAAW,CACfC,QAAS,CACPC,KAAMC,EAA2BA,4BACjCC,YAAa,kBAEfC,KAAM,CAAEH,KAAMI,EAA0BA,2BAAEF,YAAa,eACvDG,QAAS,CACPL,KAAMM,EAAiCA,kCACvCJ,YAAa,iBAEfK,MAAO,CAAEP,KAAMQ,EAA2BA,4BAAEN,YAAa,gBA6B9CO,EAA4C,SAWpDC,GAAA,IAVHC,IAAAA,SACAC,IAAAA,UAASC,EAAAH,EACTI,SAAAA,cAAgBD,EAAAE,EAAAL,EAChBM,iBAAAA,aAAmB,OAAMD,EACzBE,IAAAA,QAAOC,EAAAR,EACPS,QAAAA,OAAU,IAAAD,EAAA,WAAA,MAAO,IAAGA,EACpBE,IAAAA,KACAC,IAAAA,MACAC,IAAAA,oBACGC,EAAIC,EAAAd,EAAAe,GAEPC,EAA8BC,EAAMC,UAAS,GAA5BC,EAASH,EAAA,GAC1B,GADeA,EAAA,GAEb,OAAO,KAET,IAIMI,EAAOhC,EAASmB,GAASjB,KAC/B,OACE2B,EACEI,cAAA,MAAAC,EAAA,CAAApB,UAAWqB,EACT,kCACkBb,EAAI,kBACJH,EAClB,CAAE,uCA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U8C,YAAAA,EAAc,GACzC,CAAC9C,EAAU8C,EAAaL,IAG1B,OACEtE,gBAACa,EAAa+E,SAAS,CAAAC,MAAOH,GAC3BpB,EAAOwB,OAAS,GACf9F,EAAAI,cAAA,MAAA,CACEnB,UAAWqB,EACT,8CACwB6D,EACxBlF,GAEFoE,MAAOA,GAENiB,EAAOyB,MAAM,EAAG,GAAG3E,KAAI,SAAA4E,GAAW,OACjChG,EAACI,cAAAO,EACC,CAAArB,QAAS0G,EAAY1G,QACrBI,MAAOsG,EAAYtG,MACnBF,SAzBSyG,EAyBYD,EAAY1E,GAzBH,WACxCqD,EAAYsB,GACZV,MAwBUW,cA1Cc7E,EA0CiB2E,EA1CI,WACzC3E,EAAME,iBACVkD,EAAYpD,EAAMC,IAClB6E,OAAOC,OAAO1B,EAAcpB,SAASmC,SAAQ,SAAAY,GAC3CxB,OAAOC,aAAauB,EACtB,IACA3B,EAAcpB,QAAU,MAqCdgD,aAAcf,EACdpG,SAAUqF,IAAewB,EAAY1E,GACrC3B,oBAAqBqG,EAAYzE,eACjCgF,IAAKP,EAAY1E,IAEhB0E,EAAYvC,SAhDA,IAACpC,EAgBL4E,CAiCK,KAIrBjH,EAGP"}
package/dist/alert.esm.js CHANGED
@@ -3,6 +3,7 @@ import React from 'react';
3
3
  import classNames from 'classnames';
4
4
  import { CloseIcon, OutlinedValidationCheckIcon, OutlinedValidationInfoIcon, OutlinedValidationExclamationIcon, OutlinedValidationErrorIcon, CopyIcon } from '@entur/icons';
5
5
  import copy from 'copy-text-to-clipboard';
6
+ import { IconButton } from '@entur/button';
6
7
  import { PreformattedText } from '@entur/typography';
7
8
  import { BaseExpand, ExpandArrow } from '@entur/expand/';
8
9
 
@@ -280,37 +281,48 @@ var useToast = function useToast() {
280
281
  };
281
282
  };
282
283
 
283
- var _excluded$1 = ["children", "successHeading", "successMessage", "textToCopy", "className"];
284
+ var _excluded$1 = ["children", "successHeading", "successMessage", "textToCopy", "className", "aria-label"];
284
285
  var CopyableText = function CopyableText(_ref) {
285
286
  var children = _ref.children,
286
287
  _ref$successHeading = _ref.successHeading,
287
288
  successHeading = _ref$successHeading === void 0 ? 'Kopiert!' : _ref$successHeading,
288
- _ref$successMessage = _ref.successMessage,
289
- successMessage = _ref$successMessage === void 0 ? 'Innholdet ble kopiert til utklippstavlen.' : _ref$successMessage,
289
+ successMessage = _ref.successMessage,
290
290
  textToCopy = _ref.textToCopy,
291
291
  className = _ref.className,
292
+ _ref$ariaLabel = _ref['aria-label'],
293
+ ariaLabel = _ref$ariaLabel === void 0 ? "Kopier " + (textToCopy != null ? textToCopy : children) + " til utklippstavlen" : _ref$ariaLabel,
292
294
  rest = _objectWithoutPropertiesLoose(_ref, _excluded$1);
293
295
  var _useToast = useToast(),
294
296
  addToast = _useToast.addToast;
295
297
  var buttonRef = React.useRef(null);
298
+ var _textToCopy = textToCopy != null ? textToCopy : children;
299
+ var _successMessage = successMessage != null ? successMessage : _textToCopy + " ble kopiert til utklippstavlen.";
296
300
  var handleClick = function handleClick() {
297
- buttonRef.current && copy(textToCopy !== undefined ? textToCopy : children, {
301
+ buttonRef.current && copy(_textToCopy, {
298
302
  target: buttonRef.current
299
303
  }) && addToast({
300
304
  title: successHeading,
301
- content: successMessage
305
+ content: _successMessage
302
306
  });
303
307
  };
304
308
  return React.createElement("button", _extends({
305
- className: 'copyable-text ' + className,
309
+ className: 'eds-copyable-text ' + className,
306
310
  style: _extends({}, rest.style),
307
311
  type: "button",
308
312
  onClick: handleClick,
309
313
  ref: buttonRef,
310
- "aria-label": "Kopier innhold"
311
- }, rest), React.createElement(PreformattedText, null, children), React.createElement(CopyIcon, {
312
- className: "copyable-text__icon"
313
- }));
314
+ tabIndex: -1,
315
+ "aria-label": ""
316
+ }, rest), React.createElement(PreformattedText, {
317
+ className: "eds-copyable-text__preformatted-text"
318
+ }, React.createElement("span", {
319
+ className: "eds-copyable-text__displayed-text"
320
+ }, children), React.createElement(IconButton, {
321
+ className: "eds-copyable-text__button",
322
+ "aria-label": ariaLabel
323
+ }, React.createElement(CopyIcon, {
324
+ className: 'eds-copyable-text__button__icon'
325
+ }))));
314
326
  };
315
327
 
316
328
  var _excluded = ["variant", "title", "children", "size", "className", "openLabel", "closeLabel"];
@@ -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: {\n icon: OutlinedValidationCheckIcon,\n description: 'Suksessmelding',\n },\n info: { icon: OutlinedValidationInfoIcon, description: 'Infomelding' },\n warning: {\n icon: OutlinedValidationExclamationIcon,\n description: 'Varselmelding',\n },\n error: { icon: OutlinedValidationErrorIcon, description: 'Feilmelding' },\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].icon;\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\n role=\"img\"\n className=\"eds-alert-box__icon\"\n aria-label={iconsMap[variant].description}\n />\n <div\n className={classNames('eds-alert-box__content', {\n 'eds-alert-box__content--no-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 /** Hvis du ønsker å kopiere noe annet enn\n * innholdet i children kan du legge det inn her */\n textToCopy?: string;\n /** Overskrift i toast-varselet */\n 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 textToCopy,\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(textToCopy !== undefined ? textToCopy : 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","icon","OutlinedValidationCheckIcon","description","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","role","BannerAlertBox","props","ToastAlertBox","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","textToCopy","buttonRef","handleClick","copy","target","ref","PreformattedText","CopyIcon","SmallExpandableAlertBox","ExpandableAlertBox","BannerExpandableAlertBox","openLabel","closeLabel","open","setopen","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AEnB,CAAC,CAAA;AAUD,IAAM2G,uBAAuB,GAA2C,SAAlEA,uBAAuB,CAMxB,KAAA,EAAA;EAAA,IALHpG,KAAK,SAALA,KAAK;AACLkG,IAAAA,IAAI,SAAJA,IAAI;AAAA,IAAA,eAAA,GAAA,KAAA,CACJF,SAAS;AAATA,IAAAA,SAAS,gCAAG,SAAS,GAAA,eAAA;AAAA,IAAA,gBAAA,GAAA,KAAA,CACrBC,UAAU;AAAVA,IAAAA,UAAU,iCAAG,MAAM,GAAA,gBAAA;AACnBpF,IAAAA,OAAO,SAAPA,OAAO,CAAA;AAEP,EAAA,OACET,KAAA,CAAAM,aAAA,CAAA,KAAA,EAAA;AAAKhB,IAAAA,SAAS,EAAC,iCAAA;AAAiC,GAAA,EAC9CU,KAAA,CAAAM,aAAA,CAAA,KAAA,EAAA,IAAA,EAAMV,KAAK,CAAO,EAClBI,KACE,CAAAM,aAAA,CAAA,QAAA,EAAA;AAAAhB,IAAAA,SAAS,EAAC,kCAAkC;AAC5CmB,IAAAA,OAAO,EAAEA,OAAO;AAChBD,IAAAA,IAAI,EAAC,QAAA;AAAQ,GAAA,EAEZsF,IAAI,GAAGD,UAAU,GAAGD,SAAS,EAC9B5F,KAAC,CAAAM,aAAA,CAAA4F,WAAW,EAAC;AAAAJ,IAAAA,IAAI,EAAEA,IAAI;AAAEK,IAAAA,MAAM,EAAG,IAAA;GAAA,CAAA,CAC3B,CACL,CAAA;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: {\n icon: OutlinedValidationCheckIcon,\n description: 'Suksessmelding',\n },\n info: { icon: OutlinedValidationInfoIcon, description: 'Infomelding' },\n warning: {\n icon: OutlinedValidationExclamationIcon,\n description: 'Varselmelding',\n },\n error: { icon: OutlinedValidationErrorIcon, description: 'Feilmelding' },\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].icon;\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\n role=\"img\"\n className=\"eds-alert-box__icon\"\n aria-label={iconsMap[variant].description}\n />\n <div\n className={classNames('eds-alert-box__content', {\n 'eds-alert-box__content--no-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';\nimport copy from 'copy-text-to-clipboard';\n\nimport { IconButton } from '@entur/button';\nimport { CopyIcon } from '@entur/icons';\nimport { PreformattedText } from '@entur/typography';\n\nimport { useToast } from './ToastProvider';\n\nimport './CopyableText.scss';\n\nexport type CopyableTextProps = {\n /** Ekstra klassenavn */\n className?: string;\n /** Tekstinnhold som vises og kopieres */\n children: string;\n /** Hvis du ønsker å kopiere noe annet enn\n * innholdet i children kan du legge det inn her */\n textToCopy?: string;\n /** Overskrift i toast-varselet\n * @default 'Kopiert!'\n */\n successHeading?: string;\n /** Bekreftelsesmelding i toast-varselet\n * @default `${textToCopy} ble kopiert til utklippstavlen.`\n */\n successMessage?: string;\n} & Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, 'children'>;\n\nexport const CopyableText = ({\n children,\n successHeading = 'Kopiert!',\n successMessage,\n textToCopy,\n className,\n 'aria-label': ariaLabel = `Kopier ${\n textToCopy ?? children\n } til utklippstavlen`,\n ...rest\n}: CopyableTextProps): JSX.Element => {\n const { addToast } = useToast();\n const buttonRef = React.useRef<HTMLButtonElement>(null);\n const _textToCopy = textToCopy ?? children;\n const _successMessage =\n successMessage ?? `${_textToCopy} ble kopiert til utklippstavlen.`;\n const handleClick = () => {\n buttonRef.current &&\n copy(_textToCopy, {\n target: buttonRef.current,\n }) &&\n addToast({ title: successHeading, content: _successMessage });\n };\n return (\n <button\n className={'eds-copyable-text ' + className}\n style={{ ...rest.style }}\n type=\"button\"\n onClick={handleClick}\n ref={buttonRef}\n tabIndex={-1}\n aria-label=\"\"\n {...rest}\n >\n <PreformattedText className=\"eds-copyable-text__preformatted-text\">\n <span className=\"eds-copyable-text__displayed-text\">{children}</span>\n <IconButton\n className=\"eds-copyable-text__button\"\n aria-label={ariaLabel}\n >\n <CopyIcon className={'eds-copyable-text__button__icon'} />\n </IconButton>\n </PreformattedText>\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","icon","OutlinedValidationCheckIcon","description","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","role","BannerAlertBox","props","ToastAlertBox","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","textToCopy","ariaLabel","buttonRef","_textToCopy","_successMessage","handleClick","copy","target","ref","tabIndex","PreformattedText","IconButton","CopyIcon","SmallExpandableAlertBox","ExpandableAlertBox","BannerExpandableAlertBox","openLabel","closeLabel","open","setopen","ExpandableAlertBoxTitle","BaseExpand","ExpandArrow","inline","warnAboutMissingStyles"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;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AC;AAAAJ,IAAAA,IAAI,EAAEA,IAAI;AAAEK,IAAAA,MAAM,EAAG,IAAA;GAAA,CAAA,CAC3B,CACL,CAAA;AAEV,CAAC;;ACrGDC,sBAAsB,CAAC,OAAO,EAAE,OAAO,CAAC;;;;"}
package/dist/styles.css CHANGED
@@ -192,7 +192,8 @@
192
192
  }
193
193
  /* DO NOT CHANGE!*/
194
194
  /* This file is automatically generated from @entur/tokens! Changes will be overwritten. */
195
- .copyable-text {
195
+ .eds-copyable-text,
196
+ .eds-contrast .eds-copyable-text {
196
197
  -webkit-appearance: none;
197
198
  -moz-appearance: none;
198
199
  appearance: none;
@@ -209,28 +210,45 @@
209
210
  text-align: left;
210
211
  width: 100%;
211
212
  }
212
- .copyable-text > * {
213
+ .eds-copyable-text__preformatted-text,
214
+ .eds-contrast .eds-copyable-text__preformatted-text {
213
215
  margin: 0;
214
- }
215
- .copyable-text:focus {
216
+ display: flex;
217
+ justify-content: space-between;
218
+ transition: border-color 0.1s;
219
+ }
220
+ .eds-copyable-text__preformatted-text:hover,
221
+ .eds-contrast .eds-copyable-text__preformatted-text:hover {
222
+ border-color: #646464;
223
+ }
224
+ .eds-copyable-text__displayed-text,
225
+ .eds-contrast .eds-copyable-text__displayed-text {
226
+ overflow-x: hidden;
227
+ text-overflow: ellipsis;
228
+ text-wrap: nowrap;
229
+ }
230
+ .eds-copyable-text__button,
231
+ .eds-contrast .eds-copyable-text__button {
232
+ margin: -0.5rem;
233
+ margin-left: 0.5rem;
234
+ }
235
+ .eds-copyable-text__button:hover,
236
+ .eds-contrast .eds-copyable-text__button:hover {
237
+ background-color: #656782;
238
+ color: #ffffff;
239
+ }
240
+ .eds-copyable-text:focus,
241
+ .eds-contrast .eds-copyable-text:focus {
216
242
  outline-offset: 0.125rem;
217
243
  outline: none;
218
244
  box-shadow: 0 0 0 0.125rem #ffffff, 0 0 0 0.25rem #181c56;
219
245
  }
220
- .eds-contrast .copyable-text:focus {
246
+ .eds-contrast .eds-copyable-text:focus,
247
+ .eds-contrast .eds-contrast .eds-copyable-text:focus {
221
248
  box-shadow: 0 0 0 0.125rem #181c56, 0 0 0 0.25rem #ffffff;
222
249
  }
223
-
224
- .copyable-text__icon {
225
- display: none;
226
- position: absolute;
227
- right: 1.5rem;
228
- top: 1rem;
229
- bottom: 1rem;
230
- }
231
- .copyable-text:hover .copyable-text__icon, .copyable-text:focus .copyable-text__icon {
232
- display: block;
233
- color: #181c56;
250
+ :root {
251
+ --eds-alert: 1;
234
252
  }
235
253
  /* DO NOT CHANGE!*/
236
254
  /* This file is automatically generated from @entur/tokens! Changes will be overwritten. */
@@ -277,6 +295,3 @@
277
295
  font-size: 1rem;
278
296
  padding-left: 0.25rem;
279
297
  }
280
- :root {
281
- --eds-alert: 1;
282
- }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@entur/alert",
3
- "version": "0.14.13",
3
+ "version": "0.15.1",
4
4
  "license": "EUPL-1.2",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/alert.esm.js",
@@ -27,10 +27,11 @@
27
27
  "react-dom": ">=16.8.0"
28
28
  },
29
29
  "dependencies": {
30
- "@entur/expand": "^3.4.11",
31
- "@entur/icons": "^6.8.0",
30
+ "@entur/button": "^3.1.5",
31
+ "@entur/expand": "^3.4.12",
32
+ "@entur/icons": "^6.9.0",
32
33
  "@entur/tokens": "^3.10.0",
33
- "@entur/typography": "^1.8.10",
34
+ "@entur/typography": "^1.8.11",
34
35
  "@entur/utils": "^0.9.5",
35
36
  "classnames": "^2.3.1",
36
37
  "copy-text-to-clipboard": "^2.2"
@@ -39,5 +40,5 @@
39
40
  "node": "16.17.0",
40
41
  "yarn": "1.22.19"
41
42
  },
42
- "gitHead": "9e5cbcf10c3e18dff42f0afb3b4cb40df557c14c"
43
+ "gitHead": "36f7ef81ee8188c701d607dc01124658dfff7265"
43
44
  }