@entur/alert 0.18.10 → 0.18.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/CopyableText.d.ts +1 -1
- package/dist/alert.cjs.js +3 -1
- package/dist/alert.cjs.js.map +1 -1
- package/dist/alert.esm.js +3 -1
- package/dist/alert.esm.js.map +1 -1
- package/package.json +10 -10
package/dist/CopyableText.d.ts
CHANGED
|
@@ -16,4 +16,4 @@ export type CopyableTextProps = {
|
|
|
16
16
|
*/
|
|
17
17
|
successMessage?: string;
|
|
18
18
|
} & Omit<React.ButtonHTMLAttributes<HTMLDivElement>, 'children'>;
|
|
19
|
-
export declare const CopyableText: ({ children, successHeading, successMessage, textToCopy, className, "aria-label": ariaLabel, ...rest }: CopyableTextProps) => JSX.Element;
|
|
19
|
+
export declare const CopyableText: ({ children, successHeading, successMessage, textToCopy, className, onClick, "aria-label": ariaLabel, ...rest }: CopyableTextProps) => JSX.Element;
|
package/dist/alert.cjs.js
CHANGED
|
@@ -261,6 +261,7 @@ const CopyableText = ({
|
|
|
261
261
|
successMessage,
|
|
262
262
|
textToCopy,
|
|
263
263
|
className,
|
|
264
|
+
onClick,
|
|
264
265
|
"aria-label": ariaLabel = `Kopier ${textToCopy ?? children} til utklippstavlen`,
|
|
265
266
|
...rest
|
|
266
267
|
}) => {
|
|
@@ -268,10 +269,11 @@ const CopyableText = ({
|
|
|
268
269
|
const buttonRef = React.useRef(null);
|
|
269
270
|
const _textToCopy = textToCopy ?? children;
|
|
270
271
|
const _successMessage = successMessage ?? `${_textToCopy} ble kopiert til utklippstavlen.`;
|
|
271
|
-
const handleClick = () => {
|
|
272
|
+
const handleClick = (e) => {
|
|
272
273
|
buttonRef.current && copy(_textToCopy, {
|
|
273
274
|
target: buttonRef.current
|
|
274
275
|
}) && addToast({ title: successHeading, content: _successMessage });
|
|
276
|
+
onClick?.(e);
|
|
275
277
|
};
|
|
276
278
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
277
279
|
"div",
|
package/dist/alert.cjs.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"alert.cjs.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 ValidationErrorIcon,\n ValidationExclamationIcon,\n ValidationInfoIcon,\n ValidationSuccessIcon,\n} from '@entur/icons';\nimport { IconButton } from '@entur/button';\nimport { Tooltip } from '@entur/tooltip';\nimport { VariantType } from '@entur/utils';\n\nimport './BaseAlertBox.scss';\n\nconst iconsMap = {\n success: {\n icon: ValidationSuccessIcon,\n description: 'Suksessmelding',\n },\n information: { icon: ValidationInfoIcon, description: 'Infomelding' },\n warning: {\n icon: ValidationExclamationIcon,\n description: 'Varselmelding',\n },\n negative: { icon: ValidationErrorIcon, description: 'Feilmelding' },\n //deprecated\n info: { icon: ValidationInfoIcon, description: 'Infomelding' },\n error: { icon: ValidationErrorIcon, description: 'Feilmelding' },\n};\n\n/** @deprecated use variant=\"information\" instead */\nconst info = 'info';\n/** @deprecated use variant=\"negative\" instead */\nconst error = 'error';\n\ntype BaseAlertBoxProps = {\n /** Innholdet i alert-boksen */\n children?: React.ReactNode;\n /** Ekstra klassenavn */\n className?: string;\n /** Skjermleser-label for lukkeknappen, om den vises\n * @default \"Lukk\"\n */\n closeButtonLabel?: string;\n /** Callback som kalles når man lukker boksen\n * @default () => {}\n */\n onClose?: () => void;\n /** Om denne er true, vil boksen få en lukkeknapp i høyre hjørne\n * @default false\n */\n closable?: boolean;\n /** Tittel på boksen - oppsummer virkning */\n title?: React.ReactNode;\n /** Farge og uttrykk på alert-boksen */\n variant: VariantType | typeof info | typeof error;\n /** Typen boks (internt bruk) */\n size: 'banner' | 'toast' | 'small';\n [key: string]: any;\n};\n\nexport const BaseAlertBox: React.FC<BaseAlertBoxProps> = ({\n children,\n className,\n closable = false,\n closeButtonLabel = 'Lukk',\n variant,\n onClose = () => ({}),\n size,\n title,\n toastIsBeingRemoved,\n ...rest\n}) => {\n const [isClosed, setClosed] = React.useState(false);\n if (isClosed) {\n return null;\n }\n const handleClose = () => {\n setClosed(true);\n onClose();\n };\n const Icon = iconsMap[variant].icon;\n return (\n <div\n className={classNames(\n 'eds-alert-box',\n `eds-alert-box--${size}`,\n `eds-alert-box--${variant}`,\n {\n 'eds-alert-box--toast--exit-animation': toastIsBeingRemoved,\n 'eds-alert-box--no-title': !title,\n },\n className,\n )}\n {...rest}\n >\n <Icon\n role=\"img\"\n className=\"eds-alert-box__icon\"\n aria-label={iconsMap[variant].description}\n />\n <div\n className={classNames('eds-alert-box__content', {\n 'eds-alert-box__content--no-children': !children,\n })}\n >\n {title && <div className=\"eds-alert-box__title\">{title}</div>}\n {children && children}\n </div>\n {closable && (\n <Tooltip\n className=\"eds-alert-box__tooltip\"\n aria-hidden\n placement=\"bottom\"\n content=\"Lukk\"\n >\n <IconButton\n className=\"eds-alert-box__close-button\"\n aria-label={closeButtonLabel}\n onClick={handleClose}\n type=\"button\"\n >\n <CloseIcon />\n </IconButton>\n </Tooltip>\n )}\n </div>\n );\n};\n","import React from 'react';\nimport { BaseAlertBox } from './BaseAlertBox';\n\nimport { VariantType } from '@entur/utils';\n\n/** @deprecated use variant=\"information\" instead */\nconst info = 'info';\n/** @deprecated use variant=\"negative\" instead */\nconst error = 'error';\n\nexport type BannerAlertBoxProps = {\n /** Innholdet i alert-boksen */\n children: React.ReactNode;\n /** Ekstra klassenavn */\n className?: string;\n /** Skjermleser-label for lukkeknappen, om den vises */\n closeButtonLabel?: string;\n /** Callback som kalles når man lukker boksen */\n onClose?: () => void;\n /** Om denne er true, vil boksen få en lukkeknapp i høyre hjørne\n * @default false\n */\n closable?: boolean;\n /** Tittel på boksen - oppsummer virkning */\n title?: string;\n /** Farge og uttrykk på alert-boksen */\n variant: VariantType | typeof info | typeof error;\n [key: string]: any;\n};\n\nexport const BannerAlertBox: React.FC<BannerAlertBoxProps> = props => (\n <BaseAlertBox {...props} size=\"banner\" />\n);\n","import React from 'react';\nimport { BaseAlertBox } from './BaseAlertBox';\nimport './ToastAlertBox.scss';\n\n/** @deprecated use variant=\"information\" instead */\nconst info = 'info';\n\nexport type ToastAlertBoxProps = {\n /** Innholdet i toasten */\n children?: React.ReactNode;\n /** Ekstra klassenavn */\n className?: string;\n /** Skjermleser-label for lukkeknappen, om den vises */\n closeButtonLabel?: string;\n /** Callback som kalles når man lukker boksen */\n onClose?: () => void;\n /** Om denne er true, vil boksen få en lukkeknapp i høyre hjørne */\n closable?: boolean;\n /** Tittel på boksen - oppsummer virkning */\n title?: string;\n /** Farge og uttrykk på toasten */\n variant: 'success' | 'information' | typeof info;\n [key: string]: any;\n};\n\nexport const ToastAlertBox: React.FC<ToastAlertBoxProps> = props => (\n <BaseAlertBox {...props} size=\"toast\" role=\"status\" />\n);\n","import React from 'react';\nimport classNames from 'classnames';\nimport { BaseAlertBox } from './BaseAlertBox';\n\nimport { VariantType } from '@entur/utils';\n\n/** @deprecated use variant=\"information\" instead */\nconst info = 'info';\n/** @deprecated use variant=\"negative\" instead */\nconst error = 'error';\n\nexport type SmallAlertBoxProps = {\n /** Innholdet i alert-boksen */\n children: React.ReactNode;\n /** Ekstra klassenavn */\n className?: string;\n /** Skjermleser-label for lukkeknappen, om den vises */\n closeButtonLabel?: string;\n /** Om denne er true, vil boksen få en lukkeknapp i høyre hjørne\n * @default false\n */\n closable?: boolean;\n /** Callback som kalles når man lukker boksen */\n onClose?: () => void;\n /** Tittel på boksen - oppsummer virkning */\n title?: string;\n /** Bredden på boksen - fullbredde eller tilpasset innholdet */\n width?: 'fluid' | 'fit-content';\n /** Farge og uttrykk på alert-boksen*/\n variant: VariantType | typeof info | typeof error;\n [key: string]: any;\n};\n\nexport const SmallAlertBox: React.FC<SmallAlertBoxProps> = ({\n className,\n width,\n onClose,\n closable = false,\n closeButtonLabel,\n ...rest\n}) => (\n <BaseAlertBox\n className={classNames(className, {\n 'eds-alert-box--fit-content': width === 'fit-content',\n })}\n {...rest}\n onClose={onClose}\n closable={closable}\n closeButtonLabel={closeButtonLabel}\n size=\"small\"\n />\n);\n","import React from 'react';\nimport { ToastAlertBox } from './ToastAlertBox';\nimport classNames from 'classnames';\n\ntype ToastId = string;\n\n/** @deprecated use variant=\"information\" instead */\nconst info = 'info';\n\nexport type ToastVariants = 'success' | 'information' | typeof info;\n\ntype ToastType = {\n title?: string;\n content: React.ReactNode;\n id: ToastId;\n variant: ToastVariants;\n isBeingRemoved: boolean;\n};\n\ntype ToastContextType = {\n addToast: (payload: AddToastPayload | string) => void;\n removeToast: (id: ToastId) => void;\n toasts: ToastType[];\n};\n\nexport type AddToastPayload = {\n title?: string;\n content: React.ReactNode;\n variant?: ToastVariants;\n};\n\ntype ToastAction =\n | { type: 'ADD_TOAST'; payload: ToastType }\n | { type: 'REMOVE_TOAST'; payload: ToastId }\n | { type: 'PLAY_EXIT_ANIMATION'; payload: ToastId };\n\nconst EXIT_ANIMATION_TIME = 400;\n\nconst ToastContext = React.createContext<ToastContextType | null>(null);\n\nconst toastReducer = (\n prevToasts: ToastType[],\n action: ToastAction,\n): ToastType[] => {\n switch (action.type) {\n case 'ADD_TOAST':\n return [action.payload, ...prevToasts];\n case 'PLAY_EXIT_ANIMATION':\n return prevToasts.map(toast => {\n if (toast.id === action.payload)\n return { ...toast, isBeingRemoved: true };\n return toast;\n });\n case 'REMOVE_TOAST':\n return prevToasts.filter(toast => toast.id !== action.payload);\n }\n};\n\nconst createUniqueId = () => Math.random().toString().substring(2);\n\nconst createToast = (\n toast: AddToastPayload | string,\n id: ToastId,\n): ToastType => {\n if (typeof toast === 'string') {\n return { id, content: toast, variant: 'success', isBeingRemoved: false };\n } else {\n return { id, variant: 'success', isBeingRemoved: false, ...toast };\n }\n};\n\nexport type ToastProviderProps = {\n /** Antall millisekunder før toasts forsvinner av seg selv\n * @default 6000\n */\n delay?: number;\n /** Plasseringen av toasts\n * @default \"bottom-right\"\n */\n position?: 'bottom-right' | 'top-right';\n /** Ekstra klassenavn til ToastProvider-wrapperen */\n className?: string;\n /** Ekstra styling som sendes til ToastProvider-wrapperen */\n style?: React.CSSProperties;\n /** Innholdet */\n children: React.ReactNode;\n};\n\nexport const ToastProvider: React.FC<ToastProviderProps> = ({\n delay = 6000,\n children,\n position = 'bottom-right',\n className,\n style,\n}) => {\n const [toasts, dispatch] = React.useReducer(toastReducer, []);\n const [hoveringId, setHovering] = React.useState<string>();\n const timeoutIdRefs = React.useRef<{ [key: string]: number }>({});\n\n const removeToast = React.useCallback((id: ToastId) => {\n window.clearTimeout(timeoutIdRefs.current[id]);\n dispatch({ type: 'REMOVE_TOAST', payload: id });\n delete timeoutIdRefs.current[id];\n }, []);\n\n const playExitAnimation = React.useCallback((id: ToastId) => {\n window.clearTimeout(timeoutIdRefs.current[id + 'animation']);\n dispatch({ type: 'PLAY_EXIT_ANIMATION', payload: id });\n delete timeoutIdRefs.current[id + 'animation'];\n }, []);\n\n const removeToastWithAnimationAfterDelay = React.useCallback(\n (id: ToastId, delay: number) => {\n timeoutIdRefs.current[id + 'animation'] = window.setTimeout(\n () => playExitAnimation(id),\n delay - EXIT_ANIMATION_TIME,\n );\n timeoutIdRefs.current[id] = window.setTimeout(\n () => removeToast(id),\n delay,\n );\n },\n [timeoutIdRefs, playExitAnimation, removeToast],\n );\n\n const addToast = React.useCallback(\n (toast: AddToastPayload | string) => {\n const id = createUniqueId();\n const payload = createToast(toast, id);\n dispatch({ type: 'ADD_TOAST', payload });\n removeToastWithAnimationAfterDelay(id, delay);\n },\n [delay, removeToastWithAnimationAfterDelay],\n );\n\n const handleMouseEnter = (toast: ToastType) => () => {\n if (toast.isBeingRemoved) return;\n setHovering(toast.id);\n Object.values(timeoutIdRefs.current).forEach(timeoutId => {\n window.clearTimeout(timeoutId);\n });\n timeoutIdRefs.current = {};\n };\n\n const handleMouseLeave = () => {\n setHovering(undefined);\n toasts.forEach(toast => {\n removeToastWithAnimationAfterDelay(toast.id, delay);\n });\n };\n\n const handleClose = (toastId: ToastId) => () => {\n removeToast(toastId);\n handleMouseLeave();\n };\n\n const contextValue = React.useMemo(\n () => ({ toasts, addToast, removeToast }),\n [addToast, removeToast, toasts],\n );\n\n return (\n <ToastContext.Provider value={contextValue}>\n {toasts.length > 0 && (\n <div\n className={classNames(\n 'eds-toast-container',\n `eds-toast-container--${position}`,\n className,\n )}\n style={style}\n >\n {toasts.slice(0, 3).map(toastToShow => (\n <ToastAlertBox\n variant={toastToShow.variant}\n title={toastToShow.title}\n onClose={handleClose(toastToShow.id)}\n onMouseEnter={handleMouseEnter(toastToShow)}\n onMouseLeave={handleMouseLeave}\n closable={hoveringId === toastToShow.id}\n toastIsBeingRemoved={toastToShow.isBeingRemoved}\n key={toastToShow.id}\n >\n {toastToShow.content}\n </ToastAlertBox>\n ))}\n </div>\n )}\n {children}\n </ToastContext.Provider>\n );\n};\n\nexport const useToast: () => {\n addToast: (payload: AddToastPayload | string) => void;\n} = () => {\n const context = React.useContext(ToastContext);\n if (!context) {\n throw new Error(\n 'You need to wrap your component in a ToastProvider component in ' +\n 'order to use the useToast hook',\n );\n }\n const { addToast } = context;\n return {\n addToast,\n };\n};\n","import React from 'react';\nimport copy from 'copy-text-to-clipboard';\n\nimport { IconButton } from '@entur/button';\nimport { CopyIcon } from '@entur/icons';\nimport { PreformattedText } from '@entur/typography';\n\nimport { useToast } from './ToastProvider';\n\nimport './CopyableText.scss';\n\nexport type CopyableTextProps = {\n /** Ekstra klassenavn */\n className?: string;\n /** Tekstinnhold som vises og kopieres */\n children: string;\n /** Hvis du ønsker å kopiere noe annet enn\n * innholdet i children kan du legge det inn her */\n textToCopy?: string;\n /** Overskrift i toast-varselet\n * @default 'Kopiert!'\n */\n successHeading?: string;\n /** Bekreftelsesmelding i toast-varselet\n * @default `${textToCopy} ble kopiert til utklippstavlen.`\n */\n successMessage?: string;\n} & Omit<React.ButtonHTMLAttributes<HTMLDivElement>, 'children'>;\n\nexport const CopyableText = ({\n children,\n successHeading = 'Kopiert!',\n successMessage,\n textToCopy,\n className,\n 'aria-label': ariaLabel = `Kopier ${\n textToCopy ?? children\n } til utklippstavlen`,\n ...rest\n}: CopyableTextProps): JSX.Element => {\n const { addToast } = useToast();\n const buttonRef = React.useRef<HTMLButtonElement>(null);\n const _textToCopy = textToCopy ?? children;\n const _successMessage =\n successMessage ?? `${_textToCopy} ble kopiert til utklippstavlen.`;\n const handleClick = () => {\n buttonRef.current &&\n copy(_textToCopy, {\n target: buttonRef.current,\n }) &&\n addToast({ title: successHeading, content: _successMessage });\n };\n return (\n <div\n className={'eds-copyable-text ' + className}\n style={{ ...rest.style }}\n type=\"button\"\n onClick={handleClick}\n tabIndex={-1}\n aria-label=\"\"\n {...rest}\n >\n <PreformattedText className=\"eds-copyable-text__preformatted-text\">\n <span className=\"eds-copyable-text__displayed-text\">{children}</span>\n <IconButton\n className=\"eds-copyable-text__button\"\n aria-label={ariaLabel}\n type=\"button\"\n ref={buttonRef}\n >\n <CopyIcon className={'eds-copyable-text__button__icon'} />\n </IconButton>\n </PreformattedText>\n </div>\n );\n};\n","import { BaseExpand, ExpandArrow } from '@entur/expand';\nimport { VariantType } from '@entur/utils';\n\nimport classNames from 'classnames';\nimport React from 'react';\nimport { BannerAlertBoxProps } from './BannerAlertBox';\nimport { BaseAlertBox } from './BaseAlertBox';\nimport './ExpandableAlertBox.scss';\nimport { SmallAlertBoxProps } from './SmallAlertBox';\n\nexport type SmallExpandableAlertBoxProps = ExpandableAlertBoxProps &\n SmallAlertBoxProps;\n\nexport const SmallExpandableAlertBox: React.FC<\n SmallExpandableAlertBoxProps\n> = props => {\n return <ExpandableAlertBox size=\"small\" {...props} />;\n};\n\nexport type BannerExpandableAlertBoxProps = ExpandableAlertBoxProps &\n BannerAlertBoxProps;\n\nexport const BannerExpandableAlertBox: React.FC<\n BannerExpandableAlertBoxProps\n> = props => {\n return <ExpandableAlertBox size=\"banner\" {...props} />;\n};\n\n/** @deprecated use variant=\"information\" instead */\nconst info = 'info';\n/** @deprecated use variant=\"negative\" instead */\nconst error = 'error';\n\ntype ExpandableAlertBoxProps = {\n /**Farge og uttrykk på alert-boksen*/\n variant: VariantType | typeof info | typeof error;\n /** Tittelen til ExpandableAlertBox */\n title: React.ReactNode;\n /**Innhold som vises ved ekspandering */\n children: React.ReactNode;\n /**Ekstra klassenavn */\n className?: string;\n /** Tekst som vises på ekspanderingsknappen før åpning\n * @default \"Les mer\"\n */\n openLabel?: string;\n /** Tekst som vises på ekspanderingsknappen når den er åpnet\n * @default \"Lukk\"\n */\n closeLabel?: string;\n [key: string]: any;\n};\n\nconst ExpandableAlertBox: React.FC<ExpandableAlertBoxProps> = ({\n variant,\n title,\n children,\n size,\n className,\n openLabel,\n closeLabel,\n ...rest\n}) => {\n const [open, setopen] = React.useState(false);\n return (\n <BaseAlertBox\n size={size}\n variant={variant}\n className={classNames('eds-expandable-alert-box', className)}\n title={\n <ExpandableAlertBoxTitle\n open={open}\n title={title}\n onClick={() => setopen(!open)}\n openLabel={openLabel}\n closeLabel={closeLabel}\n />\n }\n {...rest}\n >\n <BaseExpand open={open}>{children}</BaseExpand>\n </BaseAlertBox>\n );\n};\n\ntype ExpandableAlertBoxTitleProps = {\n title: React.ReactNode;\n open: boolean;\n openLabel?: string;\n closeLabel?: string;\n onClick: (e: React.MouseEvent) => void;\n};\n\nconst ExpandableAlertBoxTitle: React.FC<ExpandableAlertBoxTitleProps> = ({\n title,\n open,\n openLabel = 'Les mer',\n closeLabel = 'Lukk',\n onClick,\n}) => {\n return (\n <div className=\"eds-expandable-alert-box__title\">\n <div>{title}</div>\n <button\n className=\"eds-expandable-alert-box__button\"\n onClick={onClick}\n type=\"button\"\n >\n {open ? closeLabel : openLabel}\n <ExpandArrow open={open} inline />\n </button>\n </div>\n );\n};\n","import { warnAboutMissingStyles } from '@entur/utils';\nimport './index.scss';\n\nwarnAboutMissingStyles('alert', 'icons');\n\nexport { BannerAlertBox } from './BannerAlertBox';\nexport { ToastAlertBox } from './ToastAlertBox';\nexport { SmallAlertBox } from './SmallAlertBox';\nexport { ToastProvider, useToast } from './ToastProvider';\nexport { CopyableText } from './CopyableText';\nexport * from './ExpandableAlertBox';\n"],"names":["ValidationSuccessIcon","ValidationInfoIcon","ValidationExclamationIcon","ValidationErrorIcon","jsxs","jsx","Tooltip","IconButton","CloseIcon","delay","PreformattedText","CopyIcon","BaseExpand","ExpandArrow","warnAboutMissingStyles"],"mappings":";;;;;;;;;;;;AAeA,MAAM,WAAW;AAAA,EACf,SAAS;AAAA,IACP,MAAMA,MAAAA;AAAAA,IACN,aAAa;AAAA,EAAA;AAAA,EAEf,aAAa,EAAE,MAAMC,0BAAoB,aAAa,cAAA;AAAA,EACtD,SAAS;AAAA,IACP,MAAMC,MAAAA;AAAAA,IACN,aAAa;AAAA,EAAA;AAAA,EAEf,UAAU,EAAE,MAAMC,2BAAqB,aAAa,cAAA;AAAA;AAAA,EAEpD,MAAM,EAAE,MAAMF,0BAAoB,aAAa,cAAA;AAAA,EAC/C,OAAO,EAAE,MAAME,MAAAA,qBAAqB,aAAa,cAAA;AACnD;AAiCO,MAAM,eAA4C,CAAC;AAAA,EACxD;AAAA,EACA;AAAA,EACA,WAAW;AAAA,EACX,mBAAmB;AAAA,EACnB;AAAA,EACA,UAAU,OAAO,CAAA;AAAA,EACjB;AAAA,EACA;AAAA,EACA;AAAA,EACA,GAAG;AACL,MAAM;AACJ,QAAM,CAAC,UAAU,SAAS,IAAI,MAAM,SAAS,KAAK;AAClD,MAAI,UAAU;AACZ,WAAO;AAAA,EACT;AACA,QAAM,cAAc,MAAM;AACxB,cAAU,IAAI;AACd,YAAA;AAAA,EACF;AACA,QAAM,OAAO,SAAS,OAAO,EAAE;AAC/B,SACEC,2BAAAA;AAAAA,IAAC;AAAA,IAAA;AAAA,MACC,WAAW;AAAA,QACT;AA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EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,GAAG;AACL,MAAM;AACJ,QAAM,CAAC,MAAM,OAAO,IAAI,MAAM,SAAS,KAAK;AAC5C,SACEA,2BAAAA;AAAAA,IAAC;AAAA,IAAA;AAAA,MACC;AAAA,MACA;AAAA,MACA,WAAW,WAAW,4BAA4B,SAAS;AAAA,MAC3D,OACEA,2BAAAA;AAAAA,QAAC;AAAA,QAAA;AAAA,UACC;AAAA,UACA;AAAA,UACA,SAAS,MAAM,QAAQ,CAAC,IAAI;AAAA,UAC5B;AAAA,UACA;AAAA,QAAA;AAAA,MAAA;AAAA,MAGH,GAAG;AAAA,MAEJ,UAAAA,2BAAAA,IAACO,OAAAA,YAAA,EAAW,MAAa,SAAA,CAAS;AAAA,IAAA;AAAA,EAAA;AAGxC;AAUA,MAAM,0BAAkE,CAAC;AAAA,EACvE;AAAA,EACA;AAAA,EACA,YAAY;AAAA,EACZ,aAAa;AAAA,EACb;AACF,MAAM;AACJ,SACER,2BAAAA,KAAC,OAAA,EAAI,WAAU,mCACb,UAAA;AAAA,IAAAC,2BAAAA,IAAC,SAAK,UAAA,MAAA,CAAM;AAAA,IACZD,2BAAAA;AAAAA,MAAC;AAAA,MAAA;AAAA,QACC,WAAU;AAAA,QACV;AAAA,QACA,MAAK;AAAA,QAEJ,UAAA;AAAA,UAAA,OAAO,aAAa;AAAA,UACrBC,2BAAAA,IAACQ,OAAAA,aAAA,EAAY,MAAY,QAAM,KAAA,CAAC;AAAA,QAAA;AAAA,MAAA;AAAA,IAAA;AAAA,EAClC,GACF;AAEJ;AC9GAC,MAAAA,uBAAuB,SAAS,OAAO;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"alert.cjs.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 ValidationErrorIcon,\n ValidationExclamationIcon,\n ValidationInfoIcon,\n ValidationSuccessIcon,\n} from '@entur/icons';\nimport { IconButton } from '@entur/button';\nimport { Tooltip } from '@entur/tooltip';\nimport { VariantType } from '@entur/utils';\n\nimport './BaseAlertBox.scss';\n\nconst iconsMap = {\n success: {\n icon: ValidationSuccessIcon,\n description: 'Suksessmelding',\n },\n information: { icon: ValidationInfoIcon, description: 'Infomelding' },\n warning: {\n icon: ValidationExclamationIcon,\n description: 'Varselmelding',\n },\n negative: { icon: ValidationErrorIcon, description: 'Feilmelding' },\n //deprecated\n info: { icon: ValidationInfoIcon, description: 'Infomelding' },\n error: { icon: ValidationErrorIcon, description: 'Feilmelding' },\n};\n\n/** @deprecated use variant=\"information\" instead */\nconst info = 'info';\n/** @deprecated use variant=\"negative\" instead */\nconst error = 'error';\n\ntype BaseAlertBoxProps = {\n /** Innholdet i alert-boksen */\n children?: React.ReactNode;\n /** Ekstra klassenavn */\n className?: string;\n /** Skjermleser-label for lukkeknappen, om den vises\n * @default \"Lukk\"\n */\n closeButtonLabel?: string;\n /** Callback som kalles når man lukker boksen\n * @default () => {}\n */\n onClose?: () => void;\n /** Om denne er true, vil boksen få en lukkeknapp i høyre hjørne\n * @default false\n */\n closable?: boolean;\n /** Tittel på boksen - oppsummer virkning */\n title?: React.ReactNode;\n /** Farge og uttrykk på alert-boksen */\n variant: VariantType | typeof info | typeof error;\n /** Typen boks (internt bruk) */\n size: 'banner' | 'toast' | 'small';\n [key: string]: any;\n};\n\nexport const BaseAlertBox: React.FC<BaseAlertBoxProps> = ({\n children,\n className,\n closable = false,\n closeButtonLabel = 'Lukk',\n variant,\n onClose = () => ({}),\n size,\n title,\n toastIsBeingRemoved,\n ...rest\n}) => {\n const [isClosed, setClosed] = React.useState(false);\n if (isClosed) {\n return null;\n }\n const handleClose = () => {\n setClosed(true);\n onClose();\n };\n const Icon = iconsMap[variant].icon;\n return (\n <div\n className={classNames(\n 'eds-alert-box',\n `eds-alert-box--${size}`,\n `eds-alert-box--${variant}`,\n {\n 'eds-alert-box--toast--exit-animation': toastIsBeingRemoved,\n 'eds-alert-box--no-title': !title,\n },\n className,\n )}\n {...rest}\n >\n <Icon\n role=\"img\"\n className=\"eds-alert-box__icon\"\n aria-label={iconsMap[variant].description}\n />\n <div\n className={classNames('eds-alert-box__content', {\n 'eds-alert-box__content--no-children': !children,\n })}\n >\n {title && <div className=\"eds-alert-box__title\">{title}</div>}\n {children && children}\n </div>\n {closable && (\n <Tooltip\n className=\"eds-alert-box__tooltip\"\n aria-hidden\n placement=\"bottom\"\n content=\"Lukk\"\n >\n <IconButton\n className=\"eds-alert-box__close-button\"\n aria-label={closeButtonLabel}\n onClick={handleClose}\n type=\"button\"\n >\n <CloseIcon />\n </IconButton>\n </Tooltip>\n )}\n </div>\n );\n};\n","import React from 'react';\nimport { BaseAlertBox } from './BaseAlertBox';\n\nimport { VariantType } from '@entur/utils';\n\n/** @deprecated use variant=\"information\" instead */\nconst info = 'info';\n/** @deprecated use variant=\"negative\" instead */\nconst error = 'error';\n\nexport type BannerAlertBoxProps = {\n /** Innholdet i alert-boksen */\n children: React.ReactNode;\n /** Ekstra klassenavn */\n className?: string;\n /** Skjermleser-label for lukkeknappen, om den vises */\n closeButtonLabel?: string;\n /** Callback som kalles når man lukker boksen */\n onClose?: () => void;\n /** Om denne er true, vil boksen få en lukkeknapp i høyre hjørne\n * @default false\n */\n closable?: boolean;\n /** Tittel på boksen - oppsummer virkning */\n title?: string;\n /** Farge og uttrykk på alert-boksen */\n variant: VariantType | typeof info | typeof error;\n [key: string]: any;\n};\n\nexport const BannerAlertBox: React.FC<BannerAlertBoxProps> = props => (\n <BaseAlertBox {...props} size=\"banner\" />\n);\n","import React from 'react';\nimport { BaseAlertBox } from './BaseAlertBox';\nimport './ToastAlertBox.scss';\n\n/** @deprecated use variant=\"information\" instead */\nconst info = 'info';\n\nexport type ToastAlertBoxProps = {\n /** Innholdet i toasten */\n children?: React.ReactNode;\n /** Ekstra klassenavn */\n className?: string;\n /** Skjermleser-label for lukkeknappen, om den vises */\n closeButtonLabel?: string;\n /** Callback som kalles når man lukker boksen */\n onClose?: () => void;\n /** Om denne er true, vil boksen få en lukkeknapp i høyre hjørne */\n closable?: boolean;\n /** Tittel på boksen - oppsummer virkning */\n title?: string;\n /** Farge og uttrykk på toasten */\n variant: 'success' | 'information' | typeof info;\n [key: string]: any;\n};\n\nexport const ToastAlertBox: React.FC<ToastAlertBoxProps> = props => (\n <BaseAlertBox {...props} size=\"toast\" role=\"status\" />\n);\n","import React from 'react';\nimport classNames from 'classnames';\nimport { BaseAlertBox } from './BaseAlertBox';\n\nimport { VariantType } from '@entur/utils';\n\n/** @deprecated use variant=\"information\" instead */\nconst info = 'info';\n/** @deprecated use variant=\"negative\" instead */\nconst error = 'error';\n\nexport type SmallAlertBoxProps = {\n /** Innholdet i alert-boksen */\n children: React.ReactNode;\n /** Ekstra klassenavn */\n className?: string;\n /** Skjermleser-label for lukkeknappen, om den vises */\n closeButtonLabel?: string;\n /** Om denne er true, vil boksen få en lukkeknapp i høyre hjørne\n * @default false\n */\n closable?: boolean;\n /** Callback som kalles når man lukker boksen */\n onClose?: () => void;\n /** Tittel på boksen - oppsummer virkning */\n title?: string;\n /** Bredden på boksen - fullbredde eller tilpasset innholdet */\n width?: 'fluid' | 'fit-content';\n /** Farge og uttrykk på alert-boksen*/\n variant: VariantType | typeof info | typeof error;\n [key: string]: any;\n};\n\nexport const SmallAlertBox: React.FC<SmallAlertBoxProps> = ({\n className,\n width,\n onClose,\n closable = false,\n closeButtonLabel,\n ...rest\n}) => (\n <BaseAlertBox\n className={classNames(className, {\n 'eds-alert-box--fit-content': width === 'fit-content',\n })}\n {...rest}\n onClose={onClose}\n closable={closable}\n closeButtonLabel={closeButtonLabel}\n size=\"small\"\n />\n);\n","import React from 'react';\nimport { ToastAlertBox } from './ToastAlertBox';\nimport classNames from 'classnames';\n\ntype ToastId = string;\n\n/** @deprecated use variant=\"information\" instead */\nconst info = 'info';\n\nexport type ToastVariants = 'success' | 'information' | typeof info;\n\ntype ToastType = {\n title?: string;\n content: React.ReactNode;\n id: ToastId;\n variant: ToastVariants;\n isBeingRemoved: boolean;\n};\n\ntype ToastContextType = {\n addToast: (payload: AddToastPayload | string) => void;\n removeToast: (id: ToastId) => void;\n toasts: ToastType[];\n};\n\nexport type AddToastPayload = {\n title?: string;\n content: React.ReactNode;\n variant?: ToastVariants;\n};\n\ntype ToastAction =\n | { type: 'ADD_TOAST'; payload: ToastType }\n | { type: 'REMOVE_TOAST'; payload: ToastId }\n | { type: 'PLAY_EXIT_ANIMATION'; payload: ToastId };\n\nconst EXIT_ANIMATION_TIME = 400;\n\nconst ToastContext = React.createContext<ToastContextType | null>(null);\n\nconst toastReducer = (\n prevToasts: ToastType[],\n action: ToastAction,\n): ToastType[] => {\n switch (action.type) {\n case 'ADD_TOAST':\n return [action.payload, ...prevToasts];\n case 'PLAY_EXIT_ANIMATION':\n return prevToasts.map(toast => {\n if (toast.id === action.payload)\n return { ...toast, isBeingRemoved: true };\n return toast;\n });\n case 'REMOVE_TOAST':\n return prevToasts.filter(toast => toast.id !== action.payload);\n }\n};\n\nconst createUniqueId = () => Math.random().toString().substring(2);\n\nconst createToast = (\n toast: AddToastPayload | string,\n id: ToastId,\n): ToastType => {\n if (typeof toast === 'string') {\n return { id, content: toast, variant: 'success', isBeingRemoved: false };\n } else {\n return { id, variant: 'success', isBeingRemoved: false, ...toast };\n }\n};\n\nexport type ToastProviderProps = {\n /** Antall millisekunder før toasts forsvinner av seg selv\n * @default 6000\n */\n delay?: number;\n /** Plasseringen av toasts\n * @default \"bottom-right\"\n */\n position?: 'bottom-right' | 'top-right';\n /** Ekstra klassenavn til ToastProvider-wrapperen */\n className?: string;\n /** Ekstra styling som sendes til ToastProvider-wrapperen */\n style?: React.CSSProperties;\n /** Innholdet */\n children: React.ReactNode;\n};\n\nexport const ToastProvider: React.FC<ToastProviderProps> = ({\n delay = 6000,\n children,\n position = 'bottom-right',\n className,\n style,\n}) => {\n const [toasts, dispatch] = React.useReducer(toastReducer, []);\n const [hoveringId, setHovering] = React.useState<string>();\n const timeoutIdRefs = React.useRef<{ [key: string]: number }>({});\n\n const removeToast = React.useCallback((id: ToastId) => {\n window.clearTimeout(timeoutIdRefs.current[id]);\n dispatch({ type: 'REMOVE_TOAST', payload: id });\n delete timeoutIdRefs.current[id];\n }, []);\n\n const playExitAnimation = React.useCallback((id: ToastId) => {\n window.clearTimeout(timeoutIdRefs.current[id + 'animation']);\n dispatch({ type: 'PLAY_EXIT_ANIMATION', payload: id });\n delete timeoutIdRefs.current[id + 'animation'];\n }, []);\n\n const removeToastWithAnimationAfterDelay = React.useCallback(\n (id: ToastId, delay: number) => {\n timeoutIdRefs.current[id + 'animation'] = window.setTimeout(\n () => playExitAnimation(id),\n delay - EXIT_ANIMATION_TIME,\n );\n timeoutIdRefs.current[id] = window.setTimeout(\n () => removeToast(id),\n delay,\n );\n },\n [timeoutIdRefs, playExitAnimation, removeToast],\n );\n\n const addToast = React.useCallback(\n (toast: AddToastPayload | string) => {\n const id = createUniqueId();\n const payload = createToast(toast, id);\n dispatch({ type: 'ADD_TOAST', payload });\n removeToastWithAnimationAfterDelay(id, delay);\n },\n [delay, removeToastWithAnimationAfterDelay],\n );\n\n const handleMouseEnter = (toast: ToastType) => () => {\n if (toast.isBeingRemoved) return;\n setHovering(toast.id);\n Object.values(timeoutIdRefs.current).forEach(timeoutId => {\n window.clearTimeout(timeoutId);\n });\n timeoutIdRefs.current = {};\n };\n\n const handleMouseLeave = () => {\n setHovering(undefined);\n toasts.forEach(toast => {\n removeToastWithAnimationAfterDelay(toast.id, delay);\n });\n };\n\n const handleClose = (toastId: ToastId) => () => {\n removeToast(toastId);\n handleMouseLeave();\n };\n\n const contextValue = React.useMemo(\n () => ({ toasts, addToast, removeToast }),\n [addToast, removeToast, toasts],\n );\n\n return (\n <ToastContext.Provider value={contextValue}>\n {toasts.length > 0 && (\n <div\n className={classNames(\n 'eds-toast-container',\n `eds-toast-container--${position}`,\n className,\n )}\n style={style}\n >\n {toasts.slice(0, 3).map(toastToShow => (\n <ToastAlertBox\n variant={toastToShow.variant}\n title={toastToShow.title}\n onClose={handleClose(toastToShow.id)}\n onMouseEnter={handleMouseEnter(toastToShow)}\n onMouseLeave={handleMouseLeave}\n closable={hoveringId === toastToShow.id}\n toastIsBeingRemoved={toastToShow.isBeingRemoved}\n key={toastToShow.id}\n >\n {toastToShow.content}\n </ToastAlertBox>\n ))}\n </div>\n )}\n {children}\n </ToastContext.Provider>\n );\n};\n\nexport const useToast: () => {\n addToast: (payload: AddToastPayload | string) => void;\n} = () => {\n const context = React.useContext(ToastContext);\n if (!context) {\n throw new Error(\n 'You need to wrap your component in a ToastProvider component in ' +\n 'order to use the useToast hook',\n );\n }\n const { addToast } = context;\n return {\n addToast,\n };\n};\n","import React from 'react';\nimport copy from 'copy-text-to-clipboard';\n\nimport { IconButton } from '@entur/button';\nimport { CopyIcon } from '@entur/icons';\nimport { PreformattedText } from '@entur/typography';\n\nimport { useToast } from './ToastProvider';\n\nimport './CopyableText.scss';\n\nexport type CopyableTextProps = {\n /** Ekstra klassenavn */\n className?: string;\n /** Tekstinnhold som vises og kopieres */\n children: string;\n /** Hvis du ønsker å kopiere noe annet enn\n * innholdet i children kan du legge det inn her */\n textToCopy?: string;\n /** Overskrift i toast-varselet\n * @default 'Kopiert!'\n */\n successHeading?: string;\n /** Bekreftelsesmelding i toast-varselet\n * @default `${textToCopy} ble kopiert til utklippstavlen.`\n */\n successMessage?: string;\n} & Omit<React.ButtonHTMLAttributes<HTMLDivElement>, 'children'>;\n\nexport const CopyableText = ({\n children,\n successHeading = 'Kopiert!',\n successMessage,\n textToCopy,\n className,\n onClick,\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 = (e: React.MouseEvent<HTMLDivElement>) => {\n buttonRef.current &&\n copy(_textToCopy, {\n target: buttonRef.current,\n }) &&\n addToast({ title: successHeading, content: _successMessage });\n onClick?.(e);\n };\n return (\n <div\n className={'eds-copyable-text ' + className}\n style={{ ...rest.style }}\n type=\"button\"\n onClick={handleClick}\n tabIndex={-1}\n aria-label=\"\"\n {...rest}\n >\n <PreformattedText className=\"eds-copyable-text__preformatted-text\">\n <span className=\"eds-copyable-text__displayed-text\">{children}</span>\n <IconButton\n className=\"eds-copyable-text__button\"\n aria-label={ariaLabel}\n type=\"button\"\n ref={buttonRef}\n >\n <CopyIcon className={'eds-copyable-text__button__icon'} />\n </IconButton>\n </PreformattedText>\n </div>\n );\n};\n","import { BaseExpand, ExpandArrow } from '@entur/expand';\nimport { VariantType } from '@entur/utils';\n\nimport classNames from 'classnames';\nimport React from 'react';\nimport { BannerAlertBoxProps } from './BannerAlertBox';\nimport { BaseAlertBox } from './BaseAlertBox';\nimport './ExpandableAlertBox.scss';\nimport { SmallAlertBoxProps } from './SmallAlertBox';\n\nexport type SmallExpandableAlertBoxProps = ExpandableAlertBoxProps &\n SmallAlertBoxProps;\n\nexport const SmallExpandableAlertBox: React.FC<\n SmallExpandableAlertBoxProps\n> = props => {\n return <ExpandableAlertBox size=\"small\" {...props} />;\n};\n\nexport type BannerExpandableAlertBoxProps = ExpandableAlertBoxProps &\n BannerAlertBoxProps;\n\nexport const BannerExpandableAlertBox: React.FC<\n BannerExpandableAlertBoxProps\n> = props => {\n return <ExpandableAlertBox size=\"banner\" {...props} />;\n};\n\n/** @deprecated use variant=\"information\" instead */\nconst info = 'info';\n/** @deprecated use variant=\"negative\" instead */\nconst error = 'error';\n\ntype ExpandableAlertBoxProps = {\n /**Farge og uttrykk på alert-boksen*/\n variant: VariantType | typeof info | typeof error;\n /** Tittelen til ExpandableAlertBox */\n title: React.ReactNode;\n /**Innhold som vises ved ekspandering */\n children: React.ReactNode;\n /**Ekstra klassenavn */\n className?: string;\n /** Tekst som vises på ekspanderingsknappen før åpning\n * @default \"Les mer\"\n */\n openLabel?: string;\n /** Tekst som vises på ekspanderingsknappen når den er åpnet\n * @default \"Lukk\"\n */\n closeLabel?: string;\n [key: string]: any;\n};\n\nconst ExpandableAlertBox: React.FC<ExpandableAlertBoxProps> = ({\n variant,\n title,\n children,\n size,\n className,\n openLabel,\n closeLabel,\n ...rest\n}) => {\n const [open, setopen] = React.useState(false);\n return (\n <BaseAlertBox\n size={size}\n variant={variant}\n className={classNames('eds-expandable-alert-box', className)}\n title={\n <ExpandableAlertBoxTitle\n open={open}\n title={title}\n onClick={() => setopen(!open)}\n openLabel={openLabel}\n closeLabel={closeLabel}\n />\n }\n {...rest}\n >\n <BaseExpand open={open}>{children}</BaseExpand>\n </BaseAlertBox>\n );\n};\n\ntype ExpandableAlertBoxTitleProps = {\n title: React.ReactNode;\n open: boolean;\n openLabel?: string;\n closeLabel?: string;\n onClick: (e: React.MouseEvent) => void;\n};\n\nconst ExpandableAlertBoxTitle: React.FC<ExpandableAlertBoxTitleProps> = ({\n title,\n open,\n openLabel = 'Les mer',\n closeLabel = 'Lukk',\n onClick,\n}) => {\n return (\n <div className=\"eds-expandable-alert-box__title\">\n <div>{title}</div>\n <button\n className=\"eds-expandable-alert-box__button\"\n onClick={onClick}\n type=\"button\"\n >\n {open ? closeLabel : openLabel}\n <ExpandArrow open={open} inline />\n </button>\n </div>\n );\n};\n","import { warnAboutMissingStyles } from '@entur/utils';\nimport './index.scss';\n\nwarnAboutMissingStyles('alert', 'icons');\n\nexport { BannerAlertBox } from './BannerAlertBox';\nexport { ToastAlertBox } from './ToastAlertBox';\nexport { SmallAlertBox } from './SmallAlertBox';\nexport { ToastProvider, useToast } from './ToastProvider';\nexport { CopyableText } from './CopyableText';\nexport * from './ExpandableAlertBox';\n"],"names":["ValidationSuccessIcon","ValidationInfoIcon","ValidationExclamationIcon","ValidationErrorIcon","jsxs","jsx","Tooltip","IconButton","CloseIcon","delay","PreformattedText","CopyIcon","BaseExpand","ExpandArrow","warnAboutMissingStyles"],"mappings":";;;;;;;;;;;;AAeA,MAAM,WAAW;AAAA,EACf,SAAS;AAAA,IACP,MAAMA,MAAAA;AAAAA,IACN,aAAa;AAAA,EAAA;AAAA,EAEf,aAAa,EAAE,MAAMC,0BAAoB,aAAa,cAAA;AAAA,EACtD,SAAS;AAAA,IACP,MAAMC,MAAAA;AAAAA,IACN,aAAa;AAAA,EAAA;AAAA,EAEf,UAAU,EAAE,MAAMC,2BAAqB,aAAa,cAAA;AAAA;AAAA,EAEpD,MAAM,EAAE,MAAMF,0BAAoB,aAAa,cAAA;AAAA,EAC/C,OAAO,EAAE,MAAME,MAAAA,qBAAqB,aAAa,cAAA;AACnD;AAiCO,MAAM,eAA4C,CAAC;AAAA,EACxD;AAAA,EACA;AAAA,EACA,WAAW;AAAA,EACX,mBAAmB;AAAA,EACnB;AAAA,EACA,UAAU,OAAO,CAAA;AAAA,EACjB;AAAA,EACA;AAAA,EACA;AAAA,EACA,GAAG;AACL,MAAM;AACJ,QAAM,CAAC,UAAU,SAAS,IAAI,MAAM,SAAS,KAAK;AAClD,MAAI,UAAU;AACZ,WAAO;AAAA,EACT;AACA,QAAM,cAAc,MAAM;AACxB,cAAU,IAAI;AACd,YAAA;AAAA,EACF;AACA,QAAM,OAAO,SAAS,OAAO,EAAE;AAC/B,SACEC,2BAAAA;AAAAA,IAAC;AAAA,IAAA;AAAA,MACC,WAAW;AAAA,QACT;AAAA,QACA,kBAAkB,IAAI;AAAA,QACtB,kBAAkB,OAAO;AAAA,QACzB;AAAA,UACE,wCAAwC;AAAA,UACxC,2BAA2B,CAAC;AAAA,QAAA;AAAA,QAE9B;AAAA,MAAA;AAAA,MAED,GAAG;AAAA,MAEJ,UAAA;AAAA,QAAAC,2BAAAA;AAAA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IAAA;AAAA,MACC;AAAA,MACA;AAAA,MACA,WAAW,WAAW,4BAA4B,SAAS;AAAA,MAC3D,OACEA,2BAAAA;AAAAA,QAAC;AAAA,QAAA;AAAA,UACC;AAAA,UACA;AAAA,UACA,SAAS,MAAM,QAAQ,CAAC,IAAI;AAAA,UAC5B;AAAA,UACA;AAAA,QAAA;AAAA,MAAA;AAAA,MAGH,GAAG;AAAA,MAEJ,UAAAA,2BAAAA,IAACO,OAAAA,YAAA,EAAW,MAAa,SAAA,CAAS;AAAA,IAAA;AAAA,EAAA;AAGxC;AAUA,MAAM,0BAAkE,CAAC;AAAA,EACvE;AAAA,EACA;AAAA,EACA,YAAY;AAAA,EACZ,aAAa;AAAA,EACb;AACF,MAAM;AACJ,SACER,2BAAAA,KAAC,OAAA,EAAI,WAAU,mCACb,UAAA;AAAA,IAAAC,2BAAAA,IAAC,SAAK,UAAA,MAAA,CAAM;AAAA,IACZD,2BAAAA;AAAAA,MAAC;AAAA,MAAA;AAAA,QACC,WAAU;AAAA,QACV;AAAA,QACA,MAAK;AAAA,QAEJ,UAAA;AAAA,UAAA,OAAO,aAAa;AAAA,UACrBC,2BAAAA,IAACQ,OAAAA,aAAA,EAAY,MAAY,QAAM,KAAA,CAAC;AAAA,QAAA;AAAA,MAAA;AAAA,IAAA;AAAA,EAClC,GACF;AAEJ;AC9GAC,MAAAA,uBAAuB,SAAS,OAAO;;;;;;;;;"}
|
package/dist/alert.esm.js
CHANGED
|
@@ -259,6 +259,7 @@ const CopyableText = ({
|
|
|
259
259
|
successMessage,
|
|
260
260
|
textToCopy,
|
|
261
261
|
className,
|
|
262
|
+
onClick,
|
|
262
263
|
"aria-label": ariaLabel = `Kopier ${textToCopy ?? children} til utklippstavlen`,
|
|
263
264
|
...rest
|
|
264
265
|
}) => {
|
|
@@ -266,10 +267,11 @@ const CopyableText = ({
|
|
|
266
267
|
const buttonRef = React.useRef(null);
|
|
267
268
|
const _textToCopy = textToCopy ?? children;
|
|
268
269
|
const _successMessage = successMessage ?? `${_textToCopy} ble kopiert til utklippstavlen.`;
|
|
269
|
-
const handleClick = () => {
|
|
270
|
+
const handleClick = (e) => {
|
|
270
271
|
buttonRef.current && copy(_textToCopy, {
|
|
271
272
|
target: buttonRef.current
|
|
272
273
|
}) && addToast({ title: successHeading, content: _successMessage });
|
|
274
|
+
onClick?.(e);
|
|
273
275
|
};
|
|
274
276
|
return /* @__PURE__ */ jsx(
|
|
275
277
|
"div",
|
package/dist/alert.esm.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"alert.esm.js","sources":["../src/BaseAlertBox.tsx","../src/BannerAlertBox.tsx","../src/ToastAlertBox.tsx","../src/SmallAlertBox.tsx","../src/ToastProvider.tsx","../src/CopyableText.tsx","../src/ExpandableAlertBox.tsx","../src/index.tsx"],"sourcesContent":["import React from 'react';\nimport classNames from 'classnames';\nimport {\n CloseIcon,\n ValidationErrorIcon,\n ValidationExclamationIcon,\n ValidationInfoIcon,\n ValidationSuccessIcon,\n} from '@entur/icons';\nimport { IconButton } from '@entur/button';\nimport { Tooltip } from '@entur/tooltip';\nimport { VariantType } from '@entur/utils';\n\nimport './BaseAlertBox.scss';\n\nconst iconsMap = {\n success: {\n icon: ValidationSuccessIcon,\n description: 'Suksessmelding',\n },\n information: { icon: ValidationInfoIcon, description: 'Infomelding' },\n warning: {\n icon: ValidationExclamationIcon,\n description: 'Varselmelding',\n },\n negative: { icon: ValidationErrorIcon, description: 'Feilmelding' },\n //deprecated\n info: { icon: ValidationInfoIcon, description: 'Infomelding' },\n error: { icon: ValidationErrorIcon, description: 'Feilmelding' },\n};\n\n/** @deprecated use variant=\"information\" instead */\nconst info = 'info';\n/** @deprecated use variant=\"negative\" instead */\nconst error = 'error';\n\ntype BaseAlertBoxProps = {\n /** Innholdet i alert-boksen */\n children?: React.ReactNode;\n /** Ekstra klassenavn */\n className?: string;\n /** Skjermleser-label for lukkeknappen, om den vises\n * @default \"Lukk\"\n */\n closeButtonLabel?: string;\n /** Callback som kalles når man lukker boksen\n * @default () => {}\n */\n onClose?: () => void;\n /** Om denne er true, vil boksen få en lukkeknapp i høyre hjørne\n * @default false\n */\n closable?: boolean;\n /** Tittel på boksen - oppsummer virkning */\n title?: React.ReactNode;\n /** Farge og uttrykk på alert-boksen */\n variant: VariantType | typeof info | typeof error;\n /** Typen boks (internt bruk) */\n size: 'banner' | 'toast' | 'small';\n [key: string]: any;\n};\n\nexport const BaseAlertBox: React.FC<BaseAlertBoxProps> = ({\n children,\n className,\n closable = false,\n closeButtonLabel = 'Lukk',\n variant,\n onClose = () => ({}),\n size,\n title,\n toastIsBeingRemoved,\n ...rest\n}) => {\n const [isClosed, setClosed] = React.useState(false);\n if (isClosed) {\n return null;\n }\n const handleClose = () => {\n setClosed(true);\n onClose();\n };\n const Icon = iconsMap[variant].icon;\n return (\n <div\n className={classNames(\n 'eds-alert-box',\n `eds-alert-box--${size}`,\n `eds-alert-box--${variant}`,\n {\n 'eds-alert-box--toast--exit-animation': toastIsBeingRemoved,\n 'eds-alert-box--no-title': !title,\n },\n className,\n )}\n {...rest}\n >\n <Icon\n role=\"img\"\n className=\"eds-alert-box__icon\"\n aria-label={iconsMap[variant].description}\n />\n <div\n className={classNames('eds-alert-box__content', {\n 'eds-alert-box__content--no-children': !children,\n })}\n >\n {title && <div className=\"eds-alert-box__title\">{title}</div>}\n {children && children}\n </div>\n {closable && (\n <Tooltip\n className=\"eds-alert-box__tooltip\"\n aria-hidden\n placement=\"bottom\"\n content=\"Lukk\"\n >\n <IconButton\n className=\"eds-alert-box__close-button\"\n aria-label={closeButtonLabel}\n onClick={handleClose}\n type=\"button\"\n >\n <CloseIcon />\n </IconButton>\n </Tooltip>\n )}\n </div>\n );\n};\n","import React from 'react';\nimport { BaseAlertBox } from './BaseAlertBox';\n\nimport { VariantType } from '@entur/utils';\n\n/** @deprecated use variant=\"information\" instead */\nconst info = 'info';\n/** @deprecated use variant=\"negative\" instead */\nconst error = 'error';\n\nexport type BannerAlertBoxProps = {\n /** Innholdet i alert-boksen */\n children: React.ReactNode;\n /** Ekstra klassenavn */\n className?: string;\n /** Skjermleser-label for lukkeknappen, om den vises */\n closeButtonLabel?: string;\n /** Callback som kalles når man lukker boksen */\n onClose?: () => void;\n /** Om denne er true, vil boksen få en lukkeknapp i høyre hjørne\n * @default false\n */\n closable?: boolean;\n /** Tittel på boksen - oppsummer virkning */\n title?: string;\n /** Farge og uttrykk på alert-boksen */\n variant: VariantType | typeof info | typeof error;\n [key: string]: any;\n};\n\nexport const BannerAlertBox: React.FC<BannerAlertBoxProps> = props => (\n <BaseAlertBox {...props} size=\"banner\" />\n);\n","import React from 'react';\nimport { BaseAlertBox } from './BaseAlertBox';\nimport './ToastAlertBox.scss';\n\n/** @deprecated use variant=\"information\" instead */\nconst info = 'info';\n\nexport type ToastAlertBoxProps = {\n /** Innholdet i toasten */\n children?: React.ReactNode;\n /** Ekstra klassenavn */\n className?: string;\n /** Skjermleser-label for lukkeknappen, om den vises */\n closeButtonLabel?: string;\n /** Callback som kalles når man lukker boksen */\n onClose?: () => void;\n /** Om denne er true, vil boksen få en lukkeknapp i høyre hjørne */\n closable?: boolean;\n /** Tittel på boksen - oppsummer virkning */\n title?: string;\n /** Farge og uttrykk på toasten */\n variant: 'success' | 'information' | typeof info;\n [key: string]: any;\n};\n\nexport const ToastAlertBox: React.FC<ToastAlertBoxProps> = props => (\n <BaseAlertBox {...props} size=\"toast\" role=\"status\" />\n);\n","import React from 'react';\nimport classNames from 'classnames';\nimport { BaseAlertBox } from './BaseAlertBox';\n\nimport { VariantType } from '@entur/utils';\n\n/** @deprecated use variant=\"information\" instead */\nconst info = 'info';\n/** @deprecated use variant=\"negative\" instead */\nconst error = 'error';\n\nexport type SmallAlertBoxProps = {\n /** Innholdet i alert-boksen */\n children: React.ReactNode;\n /** Ekstra klassenavn */\n className?: string;\n /** Skjermleser-label for lukkeknappen, om den vises */\n closeButtonLabel?: string;\n /** Om denne er true, vil boksen få en lukkeknapp i høyre hjørne\n * @default false\n */\n closable?: boolean;\n /** Callback som kalles når man lukker boksen */\n onClose?: () => void;\n /** Tittel på boksen - oppsummer virkning */\n title?: string;\n /** Bredden på boksen - fullbredde eller tilpasset innholdet */\n width?: 'fluid' | 'fit-content';\n /** Farge og uttrykk på alert-boksen*/\n variant: VariantType | typeof info | typeof error;\n [key: string]: any;\n};\n\nexport const SmallAlertBox: React.FC<SmallAlertBoxProps> = ({\n className,\n width,\n onClose,\n closable = false,\n closeButtonLabel,\n ...rest\n}) => (\n <BaseAlertBox\n className={classNames(className, {\n 'eds-alert-box--fit-content': width === 'fit-content',\n })}\n {...rest}\n onClose={onClose}\n closable={closable}\n closeButtonLabel={closeButtonLabel}\n size=\"small\"\n />\n);\n","import React from 'react';\nimport { ToastAlertBox } from './ToastAlertBox';\nimport classNames from 'classnames';\n\ntype ToastId = string;\n\n/** @deprecated use variant=\"information\" instead */\nconst info = 'info';\n\nexport type ToastVariants = 'success' | 'information' | typeof info;\n\ntype ToastType = {\n title?: string;\n content: React.ReactNode;\n id: ToastId;\n variant: ToastVariants;\n isBeingRemoved: boolean;\n};\n\ntype ToastContextType = {\n addToast: (payload: AddToastPayload | string) => void;\n removeToast: (id: ToastId) => void;\n toasts: ToastType[];\n};\n\nexport type AddToastPayload = {\n title?: string;\n content: React.ReactNode;\n variant?: ToastVariants;\n};\n\ntype ToastAction =\n | { type: 'ADD_TOAST'; payload: ToastType }\n | { type: 'REMOVE_TOAST'; payload: ToastId }\n | { type: 'PLAY_EXIT_ANIMATION'; payload: ToastId };\n\nconst EXIT_ANIMATION_TIME = 400;\n\nconst ToastContext = React.createContext<ToastContextType | null>(null);\n\nconst toastReducer = (\n prevToasts: ToastType[],\n action: ToastAction,\n): ToastType[] => {\n switch (action.type) {\n case 'ADD_TOAST':\n return [action.payload, ...prevToasts];\n case 'PLAY_EXIT_ANIMATION':\n return prevToasts.map(toast => {\n if (toast.id === action.payload)\n return { ...toast, isBeingRemoved: true };\n return toast;\n });\n case 'REMOVE_TOAST':\n return prevToasts.filter(toast => toast.id !== action.payload);\n }\n};\n\nconst createUniqueId = () => Math.random().toString().substring(2);\n\nconst createToast = (\n toast: AddToastPayload | string,\n id: ToastId,\n): ToastType => {\n if (typeof toast === 'string') {\n return { id, content: toast, variant: 'success', isBeingRemoved: false };\n } else {\n return { id, variant: 'success', isBeingRemoved: false, ...toast };\n }\n};\n\nexport type ToastProviderProps = {\n /** Antall millisekunder før toasts forsvinner av seg selv\n * @default 6000\n */\n delay?: number;\n /** Plasseringen av toasts\n * @default \"bottom-right\"\n */\n position?: 'bottom-right' | 'top-right';\n /** Ekstra klassenavn til ToastProvider-wrapperen */\n className?: string;\n /** Ekstra styling som sendes til ToastProvider-wrapperen */\n style?: React.CSSProperties;\n /** Innholdet */\n children: React.ReactNode;\n};\n\nexport const ToastProvider: React.FC<ToastProviderProps> = ({\n delay = 6000,\n children,\n position = 'bottom-right',\n className,\n style,\n}) => {\n const [toasts, dispatch] = React.useReducer(toastReducer, []);\n const [hoveringId, setHovering] = React.useState<string>();\n const timeoutIdRefs = React.useRef<{ [key: string]: number }>({});\n\n const removeToast = React.useCallback((id: ToastId) => {\n window.clearTimeout(timeoutIdRefs.current[id]);\n dispatch({ type: 'REMOVE_TOAST', payload: id });\n delete timeoutIdRefs.current[id];\n }, []);\n\n const playExitAnimation = React.useCallback((id: ToastId) => {\n window.clearTimeout(timeoutIdRefs.current[id + 'animation']);\n dispatch({ type: 'PLAY_EXIT_ANIMATION', payload: id });\n delete timeoutIdRefs.current[id + 'animation'];\n }, []);\n\n const removeToastWithAnimationAfterDelay = React.useCallback(\n (id: ToastId, delay: number) => {\n timeoutIdRefs.current[id + 'animation'] = window.setTimeout(\n () => playExitAnimation(id),\n delay - EXIT_ANIMATION_TIME,\n );\n timeoutIdRefs.current[id] = window.setTimeout(\n () => removeToast(id),\n delay,\n );\n },\n [timeoutIdRefs, playExitAnimation, removeToast],\n );\n\n const addToast = React.useCallback(\n (toast: AddToastPayload | string) => {\n const id = createUniqueId();\n const payload = createToast(toast, id);\n dispatch({ type: 'ADD_TOAST', payload });\n removeToastWithAnimationAfterDelay(id, delay);\n },\n [delay, removeToastWithAnimationAfterDelay],\n );\n\n const handleMouseEnter = (toast: ToastType) => () => {\n if (toast.isBeingRemoved) return;\n setHovering(toast.id);\n Object.values(timeoutIdRefs.current).forEach(timeoutId => {\n window.clearTimeout(timeoutId);\n });\n timeoutIdRefs.current = {};\n };\n\n const handleMouseLeave = () => {\n setHovering(undefined);\n toasts.forEach(toast => {\n removeToastWithAnimationAfterDelay(toast.id, delay);\n });\n };\n\n const handleClose = (toastId: ToastId) => () => {\n removeToast(toastId);\n handleMouseLeave();\n };\n\n const contextValue = React.useMemo(\n () => ({ toasts, addToast, removeToast }),\n [addToast, removeToast, toasts],\n );\n\n return (\n <ToastContext.Provider value={contextValue}>\n {toasts.length > 0 && (\n <div\n className={classNames(\n 'eds-toast-container',\n `eds-toast-container--${position}`,\n className,\n )}\n style={style}\n >\n {toasts.slice(0, 3).map(toastToShow => (\n <ToastAlertBox\n variant={toastToShow.variant}\n title={toastToShow.title}\n onClose={handleClose(toastToShow.id)}\n onMouseEnter={handleMouseEnter(toastToShow)}\n onMouseLeave={handleMouseLeave}\n closable={hoveringId === toastToShow.id}\n toastIsBeingRemoved={toastToShow.isBeingRemoved}\n key={toastToShow.id}\n >\n {toastToShow.content}\n </ToastAlertBox>\n ))}\n </div>\n )}\n {children}\n </ToastContext.Provider>\n );\n};\n\nexport const useToast: () => {\n addToast: (payload: AddToastPayload | string) => void;\n} = () => {\n const context = React.useContext(ToastContext);\n if (!context) {\n throw new Error(\n 'You need to wrap your component in a ToastProvider component in ' +\n 'order to use the useToast hook',\n );\n }\n const { addToast } = context;\n return {\n addToast,\n };\n};\n","import React from 'react';\nimport copy from 'copy-text-to-clipboard';\n\nimport { IconButton } from '@entur/button';\nimport { CopyIcon } from '@entur/icons';\nimport { PreformattedText } from '@entur/typography';\n\nimport { useToast } from './ToastProvider';\n\nimport './CopyableText.scss';\n\nexport type CopyableTextProps = {\n /** Ekstra klassenavn */\n className?: string;\n /** Tekstinnhold som vises og kopieres */\n children: string;\n /** Hvis du ønsker å kopiere noe annet enn\n * innholdet i children kan du legge det inn her */\n textToCopy?: string;\n /** Overskrift i toast-varselet\n * @default 'Kopiert!'\n */\n successHeading?: string;\n /** Bekreftelsesmelding i toast-varselet\n * @default `${textToCopy} ble kopiert til utklippstavlen.`\n */\n successMessage?: string;\n} & Omit<React.ButtonHTMLAttributes<HTMLDivElement>, 'children'>;\n\nexport const CopyableText = ({\n children,\n successHeading = 'Kopiert!',\n successMessage,\n textToCopy,\n className,\n 'aria-label': ariaLabel = `Kopier ${\n textToCopy ?? children\n } til utklippstavlen`,\n ...rest\n}: CopyableTextProps): JSX.Element => {\n const { addToast } = useToast();\n const buttonRef = React.useRef<HTMLButtonElement>(null);\n const _textToCopy = textToCopy ?? children;\n const _successMessage =\n successMessage ?? `${_textToCopy} ble kopiert til utklippstavlen.`;\n const handleClick = () => {\n buttonRef.current &&\n copy(_textToCopy, {\n target: buttonRef.current,\n }) &&\n addToast({ title: successHeading, content: _successMessage });\n };\n return (\n <div\n className={'eds-copyable-text ' + className}\n style={{ ...rest.style }}\n type=\"button\"\n onClick={handleClick}\n tabIndex={-1}\n aria-label=\"\"\n {...rest}\n >\n <PreformattedText className=\"eds-copyable-text__preformatted-text\">\n <span className=\"eds-copyable-text__displayed-text\">{children}</span>\n <IconButton\n className=\"eds-copyable-text__button\"\n aria-label={ariaLabel}\n type=\"button\"\n ref={buttonRef}\n >\n <CopyIcon className={'eds-copyable-text__button__icon'} />\n </IconButton>\n </PreformattedText>\n </div>\n );\n};\n","import { BaseExpand, ExpandArrow } from '@entur/expand';\nimport { VariantType } from '@entur/utils';\n\nimport classNames from 'classnames';\nimport React from 'react';\nimport { BannerAlertBoxProps } from './BannerAlertBox';\nimport { BaseAlertBox } from './BaseAlertBox';\nimport './ExpandableAlertBox.scss';\nimport { SmallAlertBoxProps } from './SmallAlertBox';\n\nexport type SmallExpandableAlertBoxProps = ExpandableAlertBoxProps &\n SmallAlertBoxProps;\n\nexport const SmallExpandableAlertBox: React.FC<\n SmallExpandableAlertBoxProps\n> = props => {\n return <ExpandableAlertBox size=\"small\" {...props} />;\n};\n\nexport type BannerExpandableAlertBoxProps = ExpandableAlertBoxProps &\n BannerAlertBoxProps;\n\nexport const BannerExpandableAlertBox: React.FC<\n BannerExpandableAlertBoxProps\n> = props => {\n return <ExpandableAlertBox size=\"banner\" {...props} />;\n};\n\n/** @deprecated use variant=\"information\" instead */\nconst info = 'info';\n/** @deprecated use variant=\"negative\" instead */\nconst error = 'error';\n\ntype ExpandableAlertBoxProps = {\n /**Farge og uttrykk på alert-boksen*/\n variant: VariantType | typeof info | typeof error;\n /** Tittelen til ExpandableAlertBox */\n title: React.ReactNode;\n /**Innhold som vises ved ekspandering */\n children: React.ReactNode;\n /**Ekstra klassenavn */\n className?: string;\n /** Tekst som vises på ekspanderingsknappen før åpning\n * @default \"Les mer\"\n */\n openLabel?: string;\n /** Tekst som vises på ekspanderingsknappen når den er åpnet\n * @default \"Lukk\"\n */\n closeLabel?: string;\n [key: string]: any;\n};\n\nconst ExpandableAlertBox: React.FC<ExpandableAlertBoxProps> = ({\n variant,\n title,\n children,\n size,\n className,\n openLabel,\n closeLabel,\n ...rest\n}) => {\n const [open, setopen] = React.useState(false);\n return (\n <BaseAlertBox\n size={size}\n variant={variant}\n className={classNames('eds-expandable-alert-box', className)}\n title={\n <ExpandableAlertBoxTitle\n open={open}\n title={title}\n onClick={() => setopen(!open)}\n openLabel={openLabel}\n closeLabel={closeLabel}\n />\n }\n {...rest}\n >\n <BaseExpand open={open}>{children}</BaseExpand>\n </BaseAlertBox>\n );\n};\n\ntype ExpandableAlertBoxTitleProps = {\n title: React.ReactNode;\n open: boolean;\n openLabel?: string;\n closeLabel?: string;\n onClick: (e: React.MouseEvent) => void;\n};\n\nconst ExpandableAlertBoxTitle: React.FC<ExpandableAlertBoxTitleProps> = ({\n title,\n open,\n openLabel = 'Les mer',\n closeLabel = 'Lukk',\n onClick,\n}) => {\n return (\n <div className=\"eds-expandable-alert-box__title\">\n <div>{title}</div>\n <button\n className=\"eds-expandable-alert-box__button\"\n onClick={onClick}\n type=\"button\"\n >\n {open ? closeLabel : openLabel}\n <ExpandArrow open={open} inline />\n </button>\n </div>\n );\n};\n","import { warnAboutMissingStyles } from '@entur/utils';\nimport './index.scss';\n\nwarnAboutMissingStyles('alert', 'icons');\n\nexport { BannerAlertBox } from './BannerAlertBox';\nexport { ToastAlertBox } from './ToastAlertBox';\nexport { SmallAlertBox } from './SmallAlertBox';\nexport { ToastProvider, useToast } from './ToastProvider';\nexport { CopyableText } from './CopyableText';\nexport * from './ExpandableAlertBox';\n"],"names":["delay"],"mappings":";;;;;;;;;;AAeA,MAAM,WAAW;AAAA,EACf,SAAS;AAAA,IACP,MAAM;AAAA,IACN,aAAa;AAAA,EAAA;AAAA,EAEf,aAAa,EAAE,MAAM,oBAAoB,aAAa,cAAA;AAAA,EACtD,SAAS;AAAA,IACP,MAAM;AAAA,IACN,aAAa;AAAA,EAAA;AAAA,EAEf,UAAU,EAAE,MAAM,qBAAqB,aAAa,cAAA;AAAA;AAAA,EAEpD,MAAM,EAAE,MAAM,oBAAoB,aAAa,cAAA;AAAA,EAC/C,OAAO,EAAE,MAAM,qBAAqB,aAAa,cAAA;AACnD;AAiCO,MAAM,eAA4C,CAAC;AAAA,EACxD;AAAA,EACA;AAAA,EACA,WAAW;AAAA,EACX,mBAAmB;AAAA,EACnB;AAAA,EACA,UAAU,OAAO,CAAA;AAAA,EACjB;AAAA,EACA;AAAA,EACA;AAAA,EACA,GAAG;AACL,MAAM;AACJ,QAAM,CAAC,UAAU,SAAS,IAAI,MAAM,SAAS,KAAK;AAClD,MAAI,UAAU;AACZ,WAAO;AAAA,EACT;AACA,QAAM,cAAc,MAAM;AACxB,cAAU,IAAI;AACd,YAAA;AAAA,EACF;AACA,QAAM,OAAO,SAAS,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C5C,SACE;AAAA,IAAC;AAAA,IAAA;AAAA,MACC;AAAA,MACA;AAAA,MACA,WAAW,WAAW,4BAA4B,SAAS;AAAA,MAC3D,OACE;AAAA,QAAC;AAAA,QAAA;AAAA,UACC;AAAA,UACA;AAAA,UACA,SAAS,MAAM,QAAQ,CAAC,IAAI;AAAA,UAC5B;AAAA,UACA;AAAA,QAAA;AAAA,MAAA;AAAA,MAGH,GAAG;AAAA,MAEJ,UAAA,oBAAC,YAAA,EAAW,MAAa,SAAA,CAAS;AAAA,IAAA;AAAA,EAAA;AAGxC;AAUA,MAAM,0BAAkE,CAAC;AAAA,EACvE;AAAA,EACA;AAAA,EACA,YAAY;AAAA,EACZ,aAAa;AAAA,EACb;AACF,MAAM;AACJ,SACE,qBAAC,OAAA,EAAI,WAAU,mCACb,UAAA;AAAA,IAAA,oBAAC,SAAK,UAAA,MAAA,CAAM;AAAA,IACZ;AAAA,MAAC;AAAA,MAAA;AAAA,QACC,WAAU;AAAA,QACV;AAAA,QACA,MAAK;AAAA,QAEJ,UAAA;AAAA,UAAA,OAAO,aAAa;AAAA,UACrB,oBAAC,aAAA,EAAY,MAAY,QAAM,KAAA,CAAC;AAAA,QAAA;AAAA,MAAA;AAAA,IAAA;AAAA,EAClC,GACF;AAEJ;AC9GA,uBAAuB,SAAS,OAAO;"}
|
|
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 ValidationErrorIcon,\n ValidationExclamationIcon,\n ValidationInfoIcon,\n ValidationSuccessIcon,\n} from '@entur/icons';\nimport { IconButton } from '@entur/button';\nimport { Tooltip } from '@entur/tooltip';\nimport { VariantType } from '@entur/utils';\n\nimport './BaseAlertBox.scss';\n\nconst iconsMap = {\n success: {\n icon: ValidationSuccessIcon,\n description: 'Suksessmelding',\n },\n information: { icon: ValidationInfoIcon, description: 'Infomelding' },\n warning: {\n icon: ValidationExclamationIcon,\n description: 'Varselmelding',\n },\n negative: { icon: ValidationErrorIcon, description: 'Feilmelding' },\n //deprecated\n info: { icon: ValidationInfoIcon, description: 'Infomelding' },\n error: { icon: ValidationErrorIcon, description: 'Feilmelding' },\n};\n\n/** @deprecated use variant=\"information\" instead */\nconst info = 'info';\n/** @deprecated use variant=\"negative\" instead */\nconst error = 'error';\n\ntype BaseAlertBoxProps = {\n /** Innholdet i alert-boksen */\n children?: React.ReactNode;\n /** Ekstra klassenavn */\n className?: string;\n /** Skjermleser-label for lukkeknappen, om den vises\n * @default \"Lukk\"\n */\n closeButtonLabel?: string;\n /** Callback som kalles når man lukker boksen\n * @default () => {}\n */\n onClose?: () => void;\n /** Om denne er true, vil boksen få en lukkeknapp i høyre hjørne\n * @default false\n */\n closable?: boolean;\n /** Tittel på boksen - oppsummer virkning */\n title?: React.ReactNode;\n /** Farge og uttrykk på alert-boksen */\n variant: VariantType | typeof info | typeof error;\n /** Typen boks (internt bruk) */\n size: 'banner' | 'toast' | 'small';\n [key: string]: any;\n};\n\nexport const BaseAlertBox: React.FC<BaseAlertBoxProps> = ({\n children,\n className,\n closable = false,\n closeButtonLabel = 'Lukk',\n variant,\n onClose = () => ({}),\n size,\n title,\n toastIsBeingRemoved,\n ...rest\n}) => {\n const [isClosed, setClosed] = React.useState(false);\n if (isClosed) {\n return null;\n }\n const handleClose = () => {\n setClosed(true);\n onClose();\n };\n const Icon = iconsMap[variant].icon;\n return (\n <div\n className={classNames(\n 'eds-alert-box',\n `eds-alert-box--${size}`,\n `eds-alert-box--${variant}`,\n {\n 'eds-alert-box--toast--exit-animation': toastIsBeingRemoved,\n 'eds-alert-box--no-title': !title,\n },\n className,\n )}\n {...rest}\n >\n <Icon\n role=\"img\"\n className=\"eds-alert-box__icon\"\n aria-label={iconsMap[variant].description}\n />\n <div\n className={classNames('eds-alert-box__content', {\n 'eds-alert-box__content--no-children': !children,\n })}\n >\n {title && <div className=\"eds-alert-box__title\">{title}</div>}\n {children && children}\n </div>\n {closable && (\n <Tooltip\n className=\"eds-alert-box__tooltip\"\n aria-hidden\n placement=\"bottom\"\n content=\"Lukk\"\n >\n <IconButton\n className=\"eds-alert-box__close-button\"\n aria-label={closeButtonLabel}\n onClick={handleClose}\n type=\"button\"\n >\n <CloseIcon />\n </IconButton>\n </Tooltip>\n )}\n </div>\n );\n};\n","import React from 'react';\nimport { BaseAlertBox } from './BaseAlertBox';\n\nimport { VariantType } from '@entur/utils';\n\n/** @deprecated use variant=\"information\" instead */\nconst info = 'info';\n/** @deprecated use variant=\"negative\" instead */\nconst error = 'error';\n\nexport type BannerAlertBoxProps = {\n /** Innholdet i alert-boksen */\n children: React.ReactNode;\n /** Ekstra klassenavn */\n className?: string;\n /** Skjermleser-label for lukkeknappen, om den vises */\n closeButtonLabel?: string;\n /** Callback som kalles når man lukker boksen */\n onClose?: () => void;\n /** Om denne er true, vil boksen få en lukkeknapp i høyre hjørne\n * @default false\n */\n closable?: boolean;\n /** Tittel på boksen - oppsummer virkning */\n title?: string;\n /** Farge og uttrykk på alert-boksen */\n variant: VariantType | typeof info | typeof error;\n [key: string]: any;\n};\n\nexport const BannerAlertBox: React.FC<BannerAlertBoxProps> = props => (\n <BaseAlertBox {...props} size=\"banner\" />\n);\n","import React from 'react';\nimport { BaseAlertBox } from './BaseAlertBox';\nimport './ToastAlertBox.scss';\n\n/** @deprecated use variant=\"information\" instead */\nconst info = 'info';\n\nexport type ToastAlertBoxProps = {\n /** Innholdet i toasten */\n children?: React.ReactNode;\n /** Ekstra klassenavn */\n className?: string;\n /** Skjermleser-label for lukkeknappen, om den vises */\n closeButtonLabel?: string;\n /** Callback som kalles når man lukker boksen */\n onClose?: () => void;\n /** Om denne er true, vil boksen få en lukkeknapp i høyre hjørne */\n closable?: boolean;\n /** Tittel på boksen - oppsummer virkning */\n title?: string;\n /** Farge og uttrykk på toasten */\n variant: 'success' | 'information' | typeof info;\n [key: string]: any;\n};\n\nexport const ToastAlertBox: React.FC<ToastAlertBoxProps> = props => (\n <BaseAlertBox {...props} size=\"toast\" role=\"status\" />\n);\n","import React from 'react';\nimport classNames from 'classnames';\nimport { BaseAlertBox } from './BaseAlertBox';\n\nimport { VariantType } from '@entur/utils';\n\n/** @deprecated use variant=\"information\" instead */\nconst info = 'info';\n/** @deprecated use variant=\"negative\" instead */\nconst error = 'error';\n\nexport type SmallAlertBoxProps = {\n /** Innholdet i alert-boksen */\n children: React.ReactNode;\n /** Ekstra klassenavn */\n className?: string;\n /** Skjermleser-label for lukkeknappen, om den vises */\n closeButtonLabel?: string;\n /** Om denne er true, vil boksen få en lukkeknapp i høyre hjørne\n * @default false\n */\n closable?: boolean;\n /** Callback som kalles når man lukker boksen */\n onClose?: () => void;\n /** Tittel på boksen - oppsummer virkning */\n title?: string;\n /** Bredden på boksen - fullbredde eller tilpasset innholdet */\n width?: 'fluid' | 'fit-content';\n /** Farge og uttrykk på alert-boksen*/\n variant: VariantType | typeof info | typeof error;\n [key: string]: any;\n};\n\nexport const SmallAlertBox: React.FC<SmallAlertBoxProps> = ({\n className,\n width,\n onClose,\n closable = false,\n closeButtonLabel,\n ...rest\n}) => (\n <BaseAlertBox\n className={classNames(className, {\n 'eds-alert-box--fit-content': width === 'fit-content',\n })}\n {...rest}\n onClose={onClose}\n closable={closable}\n closeButtonLabel={closeButtonLabel}\n size=\"small\"\n />\n);\n","import React from 'react';\nimport { ToastAlertBox } from './ToastAlertBox';\nimport classNames from 'classnames';\n\ntype ToastId = string;\n\n/** @deprecated use variant=\"information\" instead */\nconst info = 'info';\n\nexport type ToastVariants = 'success' | 'information' | typeof info;\n\ntype ToastType = {\n title?: string;\n content: React.ReactNode;\n id: ToastId;\n variant: ToastVariants;\n isBeingRemoved: boolean;\n};\n\ntype ToastContextType = {\n addToast: (payload: AddToastPayload | string) => void;\n removeToast: (id: ToastId) => void;\n toasts: ToastType[];\n};\n\nexport type AddToastPayload = {\n title?: string;\n content: React.ReactNode;\n variant?: ToastVariants;\n};\n\ntype ToastAction =\n | { type: 'ADD_TOAST'; payload: ToastType }\n | { type: 'REMOVE_TOAST'; payload: ToastId }\n | { type: 'PLAY_EXIT_ANIMATION'; payload: ToastId };\n\nconst EXIT_ANIMATION_TIME = 400;\n\nconst ToastContext = React.createContext<ToastContextType | null>(null);\n\nconst toastReducer = (\n prevToasts: ToastType[],\n action: ToastAction,\n): ToastType[] => {\n switch (action.type) {\n case 'ADD_TOAST':\n return [action.payload, ...prevToasts];\n case 'PLAY_EXIT_ANIMATION':\n return prevToasts.map(toast => {\n if (toast.id === action.payload)\n return { ...toast, isBeingRemoved: true };\n return toast;\n });\n case 'REMOVE_TOAST':\n return prevToasts.filter(toast => toast.id !== action.payload);\n }\n};\n\nconst createUniqueId = () => Math.random().toString().substring(2);\n\nconst createToast = (\n toast: AddToastPayload | string,\n id: ToastId,\n): ToastType => {\n if (typeof toast === 'string') {\n return { id, content: toast, variant: 'success', isBeingRemoved: false };\n } else {\n return { id, variant: 'success', isBeingRemoved: false, ...toast };\n }\n};\n\nexport type ToastProviderProps = {\n /** Antall millisekunder før toasts forsvinner av seg selv\n * @default 6000\n */\n delay?: number;\n /** Plasseringen av toasts\n * @default \"bottom-right\"\n */\n position?: 'bottom-right' | 'top-right';\n /** Ekstra klassenavn til ToastProvider-wrapperen */\n className?: string;\n /** Ekstra styling som sendes til ToastProvider-wrapperen */\n style?: React.CSSProperties;\n /** Innholdet */\n children: React.ReactNode;\n};\n\nexport const ToastProvider: React.FC<ToastProviderProps> = ({\n delay = 6000,\n children,\n position = 'bottom-right',\n className,\n style,\n}) => {\n const [toasts, dispatch] = React.useReducer(toastReducer, []);\n const [hoveringId, setHovering] = React.useState<string>();\n const timeoutIdRefs = React.useRef<{ [key: string]: number }>({});\n\n const removeToast = React.useCallback((id: ToastId) => {\n window.clearTimeout(timeoutIdRefs.current[id]);\n dispatch({ type: 'REMOVE_TOAST', payload: id });\n delete timeoutIdRefs.current[id];\n }, []);\n\n const playExitAnimation = React.useCallback((id: ToastId) => {\n window.clearTimeout(timeoutIdRefs.current[id + 'animation']);\n dispatch({ type: 'PLAY_EXIT_ANIMATION', payload: id });\n delete timeoutIdRefs.current[id + 'animation'];\n }, []);\n\n const removeToastWithAnimationAfterDelay = React.useCallback(\n (id: ToastId, delay: number) => {\n timeoutIdRefs.current[id + 'animation'] = window.setTimeout(\n () => playExitAnimation(id),\n delay - EXIT_ANIMATION_TIME,\n );\n timeoutIdRefs.current[id] = window.setTimeout(\n () => removeToast(id),\n delay,\n );\n },\n [timeoutIdRefs, playExitAnimation, removeToast],\n );\n\n const addToast = React.useCallback(\n (toast: AddToastPayload | string) => {\n const id = createUniqueId();\n const payload = createToast(toast, id);\n dispatch({ type: 'ADD_TOAST', payload });\n removeToastWithAnimationAfterDelay(id, delay);\n },\n [delay, removeToastWithAnimationAfterDelay],\n );\n\n const handleMouseEnter = (toast: ToastType) => () => {\n if (toast.isBeingRemoved) return;\n setHovering(toast.id);\n Object.values(timeoutIdRefs.current).forEach(timeoutId => {\n window.clearTimeout(timeoutId);\n });\n timeoutIdRefs.current = {};\n };\n\n const handleMouseLeave = () => {\n setHovering(undefined);\n toasts.forEach(toast => {\n removeToastWithAnimationAfterDelay(toast.id, delay);\n });\n };\n\n const handleClose = (toastId: ToastId) => () => {\n removeToast(toastId);\n handleMouseLeave();\n };\n\n const contextValue = React.useMemo(\n () => ({ toasts, addToast, removeToast }),\n [addToast, removeToast, toasts],\n );\n\n return (\n <ToastContext.Provider value={contextValue}>\n {toasts.length > 0 && (\n <div\n className={classNames(\n 'eds-toast-container',\n `eds-toast-container--${position}`,\n className,\n )}\n style={style}\n >\n {toasts.slice(0, 3).map(toastToShow => (\n <ToastAlertBox\n variant={toastToShow.variant}\n title={toastToShow.title}\n onClose={handleClose(toastToShow.id)}\n onMouseEnter={handleMouseEnter(toastToShow)}\n onMouseLeave={handleMouseLeave}\n closable={hoveringId === toastToShow.id}\n toastIsBeingRemoved={toastToShow.isBeingRemoved}\n key={toastToShow.id}\n >\n {toastToShow.content}\n </ToastAlertBox>\n ))}\n </div>\n )}\n {children}\n </ToastContext.Provider>\n );\n};\n\nexport const useToast: () => {\n addToast: (payload: AddToastPayload | string) => void;\n} = () => {\n const context = React.useContext(ToastContext);\n if (!context) {\n throw new Error(\n 'You need to wrap your component in a ToastProvider component in ' +\n 'order to use the useToast hook',\n );\n }\n const { addToast } = context;\n return {\n addToast,\n };\n};\n","import React from 'react';\nimport copy from 'copy-text-to-clipboard';\n\nimport { IconButton } from '@entur/button';\nimport { CopyIcon } from '@entur/icons';\nimport { PreformattedText } from '@entur/typography';\n\nimport { useToast } from './ToastProvider';\n\nimport './CopyableText.scss';\n\nexport type CopyableTextProps = {\n /** Ekstra klassenavn */\n className?: string;\n /** Tekstinnhold som vises og kopieres */\n children: string;\n /** Hvis du ønsker å kopiere noe annet enn\n * innholdet i children kan du legge det inn her */\n textToCopy?: string;\n /** Overskrift i toast-varselet\n * @default 'Kopiert!'\n */\n successHeading?: string;\n /** Bekreftelsesmelding i toast-varselet\n * @default `${textToCopy} ble kopiert til utklippstavlen.`\n */\n successMessage?: string;\n} & Omit<React.ButtonHTMLAttributes<HTMLDivElement>, 'children'>;\n\nexport const CopyableText = ({\n children,\n successHeading = 'Kopiert!',\n successMessage,\n textToCopy,\n className,\n onClick,\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 = (e: React.MouseEvent<HTMLDivElement>) => {\n buttonRef.current &&\n copy(_textToCopy, {\n target: buttonRef.current,\n }) &&\n addToast({ title: successHeading, content: _successMessage });\n onClick?.(e);\n };\n return (\n <div\n className={'eds-copyable-text ' + className}\n style={{ ...rest.style }}\n type=\"button\"\n onClick={handleClick}\n tabIndex={-1}\n aria-label=\"\"\n {...rest}\n >\n <PreformattedText className=\"eds-copyable-text__preformatted-text\">\n <span className=\"eds-copyable-text__displayed-text\">{children}</span>\n <IconButton\n className=\"eds-copyable-text__button\"\n aria-label={ariaLabel}\n type=\"button\"\n ref={buttonRef}\n >\n <CopyIcon className={'eds-copyable-text__button__icon'} />\n </IconButton>\n </PreformattedText>\n </div>\n );\n};\n","import { BaseExpand, ExpandArrow } from '@entur/expand';\nimport { VariantType } from '@entur/utils';\n\nimport classNames from 'classnames';\nimport React from 'react';\nimport { BannerAlertBoxProps } from './BannerAlertBox';\nimport { BaseAlertBox } from './BaseAlertBox';\nimport './ExpandableAlertBox.scss';\nimport { SmallAlertBoxProps } from './SmallAlertBox';\n\nexport type SmallExpandableAlertBoxProps = ExpandableAlertBoxProps &\n SmallAlertBoxProps;\n\nexport const SmallExpandableAlertBox: React.FC<\n SmallExpandableAlertBoxProps\n> = props => {\n return <ExpandableAlertBox size=\"small\" {...props} />;\n};\n\nexport type BannerExpandableAlertBoxProps = ExpandableAlertBoxProps &\n BannerAlertBoxProps;\n\nexport const BannerExpandableAlertBox: React.FC<\n BannerExpandableAlertBoxProps\n> = props => {\n return <ExpandableAlertBox size=\"banner\" {...props} />;\n};\n\n/** @deprecated use variant=\"information\" instead */\nconst info = 'info';\n/** @deprecated use variant=\"negative\" instead */\nconst error = 'error';\n\ntype ExpandableAlertBoxProps = {\n /**Farge og uttrykk på alert-boksen*/\n variant: VariantType | typeof info | typeof error;\n /** Tittelen til ExpandableAlertBox */\n title: React.ReactNode;\n /**Innhold som vises ved ekspandering */\n children: React.ReactNode;\n /**Ekstra klassenavn */\n className?: string;\n /** Tekst som vises på ekspanderingsknappen før åpning\n * @default \"Les mer\"\n */\n openLabel?: string;\n /** Tekst som vises på ekspanderingsknappen når den er åpnet\n * @default \"Lukk\"\n */\n closeLabel?: string;\n [key: string]: any;\n};\n\nconst ExpandableAlertBox: React.FC<ExpandableAlertBoxProps> = ({\n variant,\n title,\n children,\n size,\n className,\n openLabel,\n closeLabel,\n ...rest\n}) => {\n const [open, setopen] = React.useState(false);\n return (\n <BaseAlertBox\n size={size}\n variant={variant}\n className={classNames('eds-expandable-alert-box', className)}\n title={\n <ExpandableAlertBoxTitle\n open={open}\n title={title}\n onClick={() => setopen(!open)}\n openLabel={openLabel}\n closeLabel={closeLabel}\n />\n }\n {...rest}\n >\n <BaseExpand open={open}>{children}</BaseExpand>\n </BaseAlertBox>\n );\n};\n\ntype ExpandableAlertBoxTitleProps = {\n title: React.ReactNode;\n open: boolean;\n openLabel?: string;\n closeLabel?: string;\n onClick: (e: React.MouseEvent) => void;\n};\n\nconst ExpandableAlertBoxTitle: React.FC<ExpandableAlertBoxTitleProps> = ({\n title,\n open,\n openLabel = 'Les mer',\n closeLabel = 'Lukk',\n onClick,\n}) => {\n return (\n <div className=\"eds-expandable-alert-box__title\">\n <div>{title}</div>\n <button\n className=\"eds-expandable-alert-box__button\"\n onClick={onClick}\n type=\"button\"\n >\n {open ? closeLabel : openLabel}\n <ExpandArrow open={open} inline />\n </button>\n </div>\n );\n};\n","import { warnAboutMissingStyles } from '@entur/utils';\nimport './index.scss';\n\nwarnAboutMissingStyles('alert', 'icons');\n\nexport { BannerAlertBox } from './BannerAlertBox';\nexport { ToastAlertBox } from './ToastAlertBox';\nexport { SmallAlertBox } from './SmallAlertBox';\nexport { ToastProvider, useToast } from './ToastProvider';\nexport { CopyableText } from './CopyableText';\nexport * from './ExpandableAlertBox';\n"],"names":["delay"],"mappings":";;;;;;;;;;AAeA,MAAM,WAAW;AAAA,EACf,SAAS;AAAA,IACP,MAAM;AAAA,IACN,aAAa;AAAA,EAAA;AAAA,EAEf,aAAa,EAAE,MAAM,oBAAoB,aAAa,cAAA;AAAA,EACtD,SAAS;AAAA,IACP,MAAM;AAAA,IACN,aAAa;AAAA,EAAA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,OAAO,aAAa;AAAA,UACrB,oBAAC,aAAA,EAAY,MAAY,QAAM,KAAA,CAAC;AAAA,QAAA;AAAA,MAAA;AAAA,IAAA;AAAA,EAClC,GACF;AAEJ;AC9GA,uBAAuB,SAAS,OAAO;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@entur/alert",
|
|
3
|
-
"version": "0.18.
|
|
3
|
+
"version": "0.18.11",
|
|
4
4
|
"license": "EUPL-1.2",
|
|
5
5
|
"main": "dist/alert.cjs.js",
|
|
6
6
|
"module": "dist/alert.esm.js",
|
|
@@ -26,13 +26,13 @@
|
|
|
26
26
|
"react-dom": ">=16.8.0"
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@entur/button": "^4.0.
|
|
30
|
-
"@entur/expand": "^3.7.
|
|
31
|
-
"@entur/icons": "^8.4.
|
|
32
|
-
"@entur/tokens": "^3.22.
|
|
33
|
-
"@entur/tooltip": "^5.3.
|
|
34
|
-
"@entur/typography": "^2.1.
|
|
35
|
-
"@entur/utils": "^0.13.
|
|
29
|
+
"@entur/button": "^4.0.6",
|
|
30
|
+
"@entur/expand": "^3.7.7",
|
|
31
|
+
"@entur/icons": "^8.4.6",
|
|
32
|
+
"@entur/tokens": "^3.22.5",
|
|
33
|
+
"@entur/tooltip": "^5.3.11",
|
|
34
|
+
"@entur/typography": "^2.1.7",
|
|
35
|
+
"@entur/utils": "^0.13.4",
|
|
36
36
|
"classnames": "^2.5.1",
|
|
37
37
|
"copy-text-to-clipboard": "^2.2.0"
|
|
38
38
|
},
|
|
@@ -45,8 +45,8 @@
|
|
|
45
45
|
"jest-environment-jsdom": "^29.0.0",
|
|
46
46
|
"ts-jest": "^29.0.0",
|
|
47
47
|
"typescript": "^5.9.2",
|
|
48
|
-
"vite": "^7.
|
|
48
|
+
"vite": "^7.3.2",
|
|
49
49
|
"vite-plugin-dts": "^4.5.4"
|
|
50
50
|
},
|
|
51
|
-
"gitHead": "
|
|
51
|
+
"gitHead": "0c3904649cb7f504f1d7bd832dfcc64f7fe5c123"
|
|
52
52
|
}
|