@semcore/notice-bubble 16.2.1-prerelease.4 → 17.0.0-prerelease.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/README.md +4 -4
- package/lib/cjs/NoticeBubble.js +222 -328
- package/lib/cjs/NoticeBubble.js.map +1 -1
- package/lib/cjs/NoticeBubble.type.js.map +1 -1
- package/lib/cjs/NoticeBubbleManager.js +67 -117
- package/lib/cjs/NoticeBubbleManager.js.map +1 -1
- package/lib/cjs/index.js +7 -9
- package/lib/cjs/index.js.map +1 -1
- package/lib/cjs/translations/__intergalactic-dynamic-locales.js +16 -16
- package/lib/cjs/translations/__intergalactic-dynamic-locales.js.map +1 -1
- package/lib/cjs/utils.js +32 -43
- package/lib/cjs/utils.js.map +1 -1
- package/lib/es6/NoticeBubble.js +207 -314
- package/lib/es6/NoticeBubble.js.map +1 -1
- package/lib/es6/NoticeBubble.type.js.map +1 -1
- package/lib/es6/NoticeBubbleManager.js +60 -111
- package/lib/es6/NoticeBubbleManager.js.map +1 -1
- package/lib/es6/index.js +0 -1
- package/lib/es6/index.js.map +1 -1
- package/lib/es6/translations/__intergalactic-dynamic-locales.js +15 -15
- package/lib/es6/translations/__intergalactic-dynamic-locales.js.map +1 -1
- package/lib/es6/utils.js +24 -36
- package/lib/es6/utils.js.map +1 -1
- package/lib/esm/NoticeBubble.mjs +209 -293
- package/lib/esm/NoticeBubbleManager.mjs +60 -111
- package/lib/esm/index.mjs +3 -7
- package/lib/esm/translations/__intergalactic-dynamic-locales.mjs +1 -1
- package/lib/esm/utils.mjs +24 -36
- package/lib/types/NoticeBubble.d.ts +2 -31
- package/lib/types/NoticeBubble.type.d.ts +6 -45
- package/lib/types/NoticeBubbleManager.d.ts +2 -4
- package/lib/types/index.d.ts +0 -1
- package/package.json +8 -10
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NoticeBubble.js","names":["Animation","Box","Flex","Portal","Button","createComponent","Component","sstyled","Root","i18nEnhance","fire","getFocusableIn","isNode","useForkRef","contextThemeEnhance","useFocusLock","setFocus","cssVariableEnhance","ZIndexStackingContextProvider","zIndexStackingEnhance","CloseIcon","React","manager","style","_sstyled","insert","localizedMessages","Timer","NoticeBubbleContainerRoot","_Component","_this","_classCallCheck","_len","arguments","length","args","Array","_key","_callSuper","concat","_defineProperty","notices","infos","warnings","_unsubscribe","setState","forceUpdate","_inherits","_createClass","key","value","componentDidMount","asProps","addListener","handleChange","render","_ref","_ref3","SNoticeBubble","SNoticeAriaLiveWrapper","_this$asProps","Children","styles","disablePortal","getI18nText","ref","parentZIndexStacking","duration","containerNode","state","map","notice","_ref2","SView","type","ViewWarning","ViewInfo","createElement","PortalForNoticeItem","cn","_objectSpread","uid","filter","_assignProps","_ref4","_ref5","variable","fallback","v","Number","parseInt","prop","i18n","locale","FocusLock","forwardRef","props","outerRef","focusLock","other","_objectWithoutProperties","_excluded","innerRef","useRef","_extends","_React$useState","useState","_React$useState2","_slicedToArray","showContent","setShowContent","useEffect","setTimeout","Tag","tag","designToken","nodeToMount","_Component2","_this2","_len2","_key2","createRef","e","clearTimer","handleClose","timer","pause","resume","event","_this2$timer","_this2$ref$current","paused","rect","current","getBoundingClientRect","mouseInRect","clientX","left","right","clientY","top","bottom","_this3","document","body","addEventListener","handleBodyMouseMove","noticeElement","focusableNodes","node","closeButtonRef","componentWillUnmount","removeEventListener","clear","_ref6","SBubble","SDismiss","SContent","SMessage","SAction","SIcon","_this$props","visible","initialAnimation","animationDuration","icon","children","action","handleMouseEnter","handleMouseLeave","handleKeydown","undefined","Addon","color","Fragment","_ViewInfo2","NoticeBubbleView","_Component3","_this4","_len3","_key3","_notice","add","remove","componentDidUpdate","update","NoticeBubbleWarningView","_NoticeBubbleView2","NoticeBubbleContainer","Info","Warning","NoticeBubble","NoticeBubbleWarning"],"sources":["../../src/NoticeBubble.tsx"],"sourcesContent":["import { Animation, Box, Flex, Portal } from '@semcore/base-components';\nimport Button from '@semcore/button';\nimport { createComponent, Component, sstyled, Root } from '@semcore/core';\nimport type { Intergalactic } from '@semcore/core';\nimport i18nEnhance from '@semcore/core/lib/utils/enhances/i18nEnhance';\nimport fire from '@semcore/core/lib/utils/fire';\nimport { getFocusableIn } from '@semcore/core/lib/utils/focus-lock/getFocusableIn';\nimport isNode from '@semcore/core/lib/utils/isNode';\nimport type { NodeByRef } from '@semcore/core/lib/utils/ref';\nimport { useForkRef } from '@semcore/core/lib/utils/ref';\nimport { contextThemeEnhance } from '@semcore/core/lib/utils/ThemeProvider';\nimport { useFocusLock, setFocus } from '@semcore/core/lib/utils/use/useFocusLock';\nimport { cssVariableEnhance } from '@semcore/core/lib/utils/useCssVariable';\nimport {\n ZIndexStackingContextProvider,\n zIndexStackingEnhance,\n} from '@semcore/core/lib/utils/zIndexStacking';\nimport CloseIcon from '@semcore/icon/Close/m';\nimport React from 'react';\n\nimport type {\n AddedNoticeMeta,\n NoticeBubbleContainerProps,\n NoticeBubbleProps,\n NoticeBubbleViewItemProps, NoticeBubbleWarningProps,\n} from './NoticeBubble.type';\nimport type { NoticeBubbleManager, NoticeItem } from './NoticeBubbleManager';\nimport manager from './NoticeBubbleManager';\nimport style from './style/notice-bubble.shadow.css';\nimport { localizedMessages } from './translations/__intergalactic-dynamic-locales';\nimport { Timer } from './utils';\n\ntype State = {\n notices: NoticeItem[];\n infos: NoticeItem[];\n warnings: NoticeItem[];\n};\n\nclass NoticeBubbleContainerRoot extends Component<NoticeBubbleContainerProps, {}, State, typeof NoticeBubbleContainerRoot.enhance, typeof NoticeBubbleContainerRoot.defaultProps> {\n static displayName = 'NoticeBubbleContainer';\n static style = style;\n static enhance = [\n i18nEnhance(localizedMessages),\n contextThemeEnhance(),\n zIndexStackingEnhance('z-index-notice-bubble'),\n cssVariableEnhance<'duration', number, number>({\n variable: '--intergalactic-duration-popper',\n fallback: 200,\n map: (v: string) => Number.parseInt(v, 10),\n prop: 'duration',\n }),\n ] as const;\n\n static defaultProps = {\n manager,\n i18n: localizedMessages,\n locale: 'en',\n } as const;\n\n _unsubscribe: (() => void) | null = null;\n\n state: State = {\n notices: [],\n infos: [],\n warnings: [],\n };\n\n componentDidMount() {\n this._unsubscribe = this.asProps.manager.addListener(this.handleChange);\n }\n\n componentWillUnmount = () => {\n if (this._unsubscribe) {\n this._unsubscribe();\n }\n };\n\n handleChange = (notices: NoticeItem[]) => {\n this.setState({ notices });\n this.forceUpdate(); // need this, because somehow this component doesn't rerender event if the notices are different\n };\n\n render() {\n const SNoticeBubble = Root;\n const SNoticeAriaLiveWrapper = 'div';\n const { Children, styles, disablePortal, getI18nText, ref, parentZIndexStacking, duration, containerNode } =\n this.asProps;\n const { notices } = this.state;\n\n if (containerNode) {\n return notices.map((notice) => {\n const SView = notice.type === 'warning' ? ViewWarning : ViewInfo;\n\n return sstyled(styles)(\n <PortalForNoticeItem\n key={notice.uid}\n tag={SView}\n containerNode={containerNode}\n animationDuration={duration}\n styles={styles}\n getI18nText={getI18nText}\n {...notice}\n />,\n );\n });\n }\n\n const infos = notices.filter((notice) => notice.type === 'info');\n const warnings = notices.filter((notice) => notice.type === 'warning');\n\n return sstyled(styles)(\n <ZIndexStackingContextProvider designToken='z-index-notice-bubble'>\n <Portal disablePortal={disablePortal}>\n <SNoticeBubble\n render={Box}\n ref={ref}\n tag='section'\n role='region'\n aria-label={getI18nText('notification')}\n zIndex={parentZIndexStacking}\n >\n <Children />\n {warnings.map((notice) => {\n const SView = ViewWarning;\n return sstyled(styles)(\n <SView\n key={notice.uid}\n animationDuration={duration}\n styles={styles}\n getI18nText={getI18nText}\n {...notice}\n />,\n );\n })}\n <SNoticeAriaLiveWrapper aria-live='polite'>\n {infos.map((notice) => {\n const SView = ViewInfo;\n return sstyled(styles)(\n <SView\n key={notice.uid}\n animationDuration={duration}\n styles={styles}\n getI18nText={getI18nText}\n {...notice}\n />,\n );\n })}\n </SNoticeAriaLiveWrapper>\n </SNoticeBubble>\n </Portal>\n </ZIndexStackingContextProvider>,\n );\n }\n}\n\nconst FocusLock = React.forwardRef((props: any, outerRef: React.ForwardedRef<HTMLDivElement>) => {\n const { focusLock, ...other } = props;\n const innerRef = React.useRef<HTMLDivElement | null>(null);\n useFocusLock(innerRef, false, 'auto', !focusLock, true);\n const ref = useForkRef(outerRef, innerRef);\n\n return <Flex ref={ref} {...other} />;\n});\n\nconst PortalForNoticeItem = (props: NoticeBubbleViewItemProps & { containerNode: NodeByRef; tag: typeof ViewInfo }) => {\n const [showContent, setShowContent] = React.useState(false);\n\n // Show content for info notice in previously mounted node with aria-live polite\n React.useEffect(() => {\n setTimeout(() => {\n setShowContent(true);\n }, 200);\n }, []);\n\n const SNoticeAriaLiveWrapper = 'div';\n const Tag = props.tag;\n\n if (props.type === 'info') {\n return (\n <ZIndexStackingContextProvider designToken='z-index-notice-bubble'>\n <Portal nodeToMount={props.containerNode}>\n <SNoticeAriaLiveWrapper aria-live='polite'>\n {showContent && <Tag {...props} />}\n </SNoticeAriaLiveWrapper>\n </Portal>\n </ZIndexStackingContextProvider>\n );\n }\n\n return (\n <ZIndexStackingContextProvider designToken='z-index-notice-bubble'>\n <Portal nodeToMount={props.containerNode}>\n <Tag {...props} />\n </Portal>\n </ZIndexStackingContextProvider>\n );\n};\n\nclass ViewInfo extends Component<NoticeBubbleViewItemProps> {\n timer: Timer | null = null;\n ref = React.createRef<HTMLDivElement>();\n closeButtonRef = React.createRef<HTMLButtonElement>();\n\n componentDidMount() {\n const { duration } = this.props;\n if (duration) {\n this.timer = new Timer(this.handleClose, duration);\n document.body.addEventListener('mousemove', this.handleBodyMouseMove);\n }\n\n const noticeElement = this.ref.current;\n\n if (noticeElement) {\n const focusableNodes = getFocusableIn(noticeElement).filter(\n (node) => node !== this.closeButtonRef.current,\n );\n\n if (focusableNodes.length > 0) {\n setTimeout(() => setFocus(noticeElement), 0);\n }\n }\n }\n\n componentWillUnmount() {\n this.clearTimer();\n document.body.removeEventListener('mousemove', this.handleBodyMouseMove);\n }\n\n clearTimer() {\n if (this.timer) {\n this.timer.clear();\n this.timer = null;\n }\n }\n\n handleClose = (e: React.SyntheticEvent) => {\n // because it might be called not only from the close icon click\n fire(this, 'onClose', e);\n this.clearTimer();\n };\n\n handleKeydown = (e: React.KeyboardEvent) => {\n if (e.key === 'Escape') {\n this.handleClose(e);\n }\n };\n\n handleMouseEnter = () => {\n if (!this.timer) return;\n this.timer.pause();\n };\n\n handleMouseLeave = () => {\n if (!this.timer) return;\n this.timer.resume();\n };\n\n handleBodyMouseMove = (event: MouseEvent) => {\n if (!this.timer?.paused) return;\n const rect = this.ref.current?.getBoundingClientRect();\n if (!rect) return;\n const mouseInRect =\n event.clientX >= rect.left &&\n event.clientX <= rect.right &&\n event.clientY >= rect.top &&\n event.clientY <= rect.bottom;\n if (mouseInRect) return;\n this.timer.resume();\n };\n\n render() {\n const SBubble = FocusLock;\n const SDismiss = Button;\n const SContent = Flex;\n const SMessage = 'div';\n const SAction = 'div';\n const SIcon = Flex;\n const {\n styles,\n getI18nText,\n visible,\n type,\n initialAnimation,\n animationDuration,\n icon,\n children,\n action,\n focusLock,\n } = this.props;\n\n return sstyled(styles)(\n <Animation\n initialAnimation={initialAnimation}\n visible={visible ?? true}\n duration={animationDuration}\n // @ts-ignore\n keyframes={[styles['@enter'], styles['@exit']]}\n >\n <SBubble\n type={type}\n ref={this.ref}\n onMouseEnter={this.handleMouseEnter}\n onMouseLeave={this.handleMouseLeave}\n onKeyDown={this.handleKeydown}\n role={type === 'warning' ? 'alert' : undefined}\n focusLock={focusLock}\n >\n <SDismiss\n aria-haspopup={undefined}\n type='button'\n use='tertiary'\n size='m'\n theme='invert'\n onClick={this.handleClose}\n aria-label={getI18nText('close')}\n active={false}\n title={getI18nText('close')}\n ref={this.closeButtonRef}\n data-hide-focus-hover-popper='true'\n >\n <Button.Addon tag={CloseIcon} color='icon-primary-invert' />\n </SDismiss>\n\n {isNode(icon)\n ? (\n <>\n <SIcon>{icon}</SIcon>\n <SContent>\n <SMessage>{children}</SMessage>\n {isNode(action) ? <SAction>{action}</SAction> : null}\n </SContent>\n </>\n )\n : (\n <SContent>\n <SMessage>{children}</SMessage>\n {isNode(action) ? <SAction>{action}</SAction> : null}\n </SContent>\n )}\n </SBubble>\n </Animation>,\n );\n }\n}\n\nclass ViewWarning extends ViewInfo {\n static defaultProps = {\n type: 'warning',\n duration: 0,\n };\n}\n\nclass NoticeBubbleView extends Component<{ manager: NoticeBubbleManager } & (NoticeBubbleProps | NoticeBubbleWarningProps)> {\n static defaultProps = {\n duration: 5000,\n type: 'info',\n manager,\n };\n\n _notice: null | AddedNoticeMeta = null;\n\n componentDidMount() {\n this._notice = this.asProps.manager.add(this.asProps);\n }\n\n componentWillUnmount() {\n if (this._notice) {\n this._notice.remove();\n }\n }\n\n componentDidUpdate() {\n if (this._notice) {\n this._notice.update(this.asProps);\n }\n }\n\n render() {\n return null;\n }\n}\n\nclass NoticeBubbleWarningView extends NoticeBubbleView {\n static defaultProps = {\n duration: 5000,\n type: 'warning',\n manager,\n };\n}\n\nconst NoticeBubbleContainer = createComponent(NoticeBubbleContainerRoot, {\n Info: NoticeBubbleView,\n Warning: NoticeBubbleWarningView,\n}) as Intergalactic.Component<'div', NoticeBubbleContainerProps> & {\n Info: typeof NoticeBubbleView;\n Warning: typeof NoticeBubbleWarningView;\n};\n\nconst NoticeBubble = NoticeBubbleContainer.Info;\nconst NoticeBubbleWarning = NoticeBubbleContainer.Warning;\n\nexport { NoticeBubble, NoticeBubbleWarning };\n\nexport default NoticeBubbleContainer;\n"],"mappings":";;;;;;;;;;;;AAAA,SAASA,SAAS,EAAEC,GAAG,EAAEC,IAAI,EAAEC,MAAM,QAAQ,0BAA0B;AACvE,OAAOC,MAAM,MAAM,iBAAiB;AACpC,SAASC,eAAe,EAAEC,SAAS,EAAEC,OAAO,EAAEC,IAAI,QAAQ,eAAe;AAEzE,OAAOC,WAAW,MAAM,8CAA8C;AACtE,OAAOC,IAAI,MAAM,8BAA8B;AAC/C,SAASC,cAAc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IAAMK,YAAY,GAAGH,qBAAqB,CAACC,IAAI;AAC/C,IAAMG,mBAAmB,GAAGJ,qBAAqB,CAACE,OAAO;AAEzD,SAASC,YAAY,EAAEC,mBAAmB;AAE1C,eAAeJ,qBAAqB","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"NoticeBubble.js","names":["Animation","Box","Flex","Portal","Button","createComponent","Component","sstyled","Root","i18nEnhance","fire","getFocusableIn","isNode","useForkRef","contextThemeEnhance","useFocusLock","setFocus","cssVariableEnhance","ZIndexStackingContextProvider","zIndexStackingEnhance","CloseIcon","React","manager","style","_sstyled","insert","localizedMessages","Timer","NoticeBubbleContainerRoot","constructor","args","_defineProperty","notices","infos","warnings","_unsubscribe","setState","forceUpdate","componentDidMount","asProps","addListener","handleChange","render","_ref","_ref3","SNoticeBubble","SNoticeAriaLiveWrapper","Children","styles","disablePortal","getI18nText","ref","parentZIndexStacking","duration","containerNode","state","map","notice","_ref2","SView","type","ViewWarning","ViewInfo","createElement","PortalForNoticeItem","cn","uid","filter","_assignProps","_ref4","_ref5","variable","fallback","v","Number","parseInt","prop","i18n","locale","FocusLock","forwardRef","props","outerRef","focusLock","other","innerRef","useRef","_extends","showContent","setShowContent","useState","useEffect","setTimeout","Tag","tag","designToken","nodeToMount","createRef","e","clearTimer","key","handleClose","timer","pause","resume","event","paused","rect","current","getBoundingClientRect","mouseInRect","clientX","left","right","clientY","top","bottom","document","body","addEventListener","handleBodyMouseMove","noticeElement","focusableNodes","node","closeButtonRef","length","componentWillUnmount","removeEventListener","clear","_ref6","SBubble","SDismiss","SContent","SMessage","SAction","SIcon","visible","initialAnimation","animationDuration","icon","children","action","handleMouseEnter","handleMouseLeave","handleKeydown","undefined","Addon","color","Fragment","NoticeBubbleContainer"],"sources":["../../src/NoticeBubble.tsx"],"sourcesContent":["import { Animation, Box, Flex, Portal } from '@semcore/base-components';\nimport Button from '@semcore/button';\nimport { createComponent, Component, sstyled, Root } from '@semcore/core';\nimport type { Intergalactic } from '@semcore/core';\nimport i18nEnhance from '@semcore/core/lib/utils/enhances/i18nEnhance';\nimport fire from '@semcore/core/lib/utils/fire';\nimport { getFocusableIn } from '@semcore/core/lib/utils/focus-lock/getFocusableIn';\nimport isNode from '@semcore/core/lib/utils/isNode';\nimport { useForkRef } from '@semcore/core/lib/utils/ref';\nimport { contextThemeEnhance } from '@semcore/core/lib/utils/ThemeProvider';\nimport { useFocusLock, setFocus } from '@semcore/core/lib/utils/use/useFocusLock';\nimport { cssVariableEnhance } from '@semcore/core/lib/utils/useCssVariable';\nimport {\n ZIndexStackingContextProvider,\n zIndexStackingEnhance,\n} from '@semcore/core/lib/utils/zIndexStacking';\nimport CloseIcon from '@semcore/icon/Close/m';\nimport React from 'react';\n\nimport type {\n NoticeBubbleContainerProps,\n NoticeBubbleViewItemProps,\n} from './NoticeBubble.type';\nimport type { NoticeItem } from './NoticeBubbleManager';\nimport manager from './NoticeBubbleManager';\nimport style from './style/notice-bubble.shadow.css';\nimport { localizedMessages } from './translations/__intergalactic-dynamic-locales';\nimport { Timer } from './utils';\n\ntype State = {\n notices: NoticeItem[];\n infos: NoticeItem[];\n warnings: NoticeItem[];\n};\n\nclass NoticeBubbleContainerRoot extends Component<NoticeBubbleContainerProps, typeof NoticeBubbleContainerRoot.enhance, {}, typeof NoticeBubbleContainerRoot.defaultProps, State> {\n static displayName = 'NoticeBubbleContainer';\n static style = style;\n static enhance = [\n i18nEnhance(localizedMessages),\n contextThemeEnhance(),\n zIndexStackingEnhance('z-index-notice-bubble'),\n cssVariableEnhance<'duration', number, number>({\n variable: '--intergalactic-duration-popper',\n fallback: 200,\n map: (v: string) => Number.parseInt(v, 10),\n prop: 'duration',\n }),\n ] as const;\n\n static defaultProps = {\n manager,\n i18n: localizedMessages,\n locale: 'en',\n } as const;\n\n _unsubscribe: (() => void) | null = null;\n\n state: State = {\n notices: [],\n infos: [],\n warnings: [],\n };\n\n componentDidMount() {\n this._unsubscribe = this.asProps.manager.addListener(this.handleChange);\n }\n\n componentWillUnmount = () => {\n if (this._unsubscribe) {\n this._unsubscribe();\n }\n };\n\n handleChange = (notices: NoticeItem[]) => {\n this.setState({ notices });\n this.forceUpdate(); // need this, because somehow this component doesn't rerender event if the notices are different\n };\n\n render() {\n const SNoticeBubble = Root;\n const SNoticeAriaLiveWrapper = 'div';\n const { Children, styles, disablePortal, getI18nText, ref, parentZIndexStacking, duration, containerNode } =\n this.asProps;\n const { notices } = this.state;\n\n if (containerNode) {\n return notices.map((notice) => {\n const SView = notice.type === 'warning' ? ViewWarning : ViewInfo;\n\n return sstyled(styles)(\n <PortalForNoticeItem\n key={notice.uid}\n tag={SView}\n containerNode={containerNode}\n animationDuration={duration}\n styles={styles}\n getI18nText={getI18nText}\n {...notice}\n />,\n );\n });\n }\n\n const infos = notices.filter((notice) => notice.type === 'info');\n const warnings = notices.filter((notice) => notice.type === 'warning');\n\n return sstyled(styles)(\n <ZIndexStackingContextProvider designToken='z-index-notice-bubble'>\n <Portal disablePortal={disablePortal}>\n <SNoticeBubble\n render={Box}\n ref={ref}\n tag='section'\n role='region'\n aria-label={getI18nText('notification')}\n zIndex={parentZIndexStacking}\n >\n <Children />\n {warnings.map((notice) => {\n const SView = ViewWarning;\n return sstyled(styles)(\n <SView\n key={notice.uid}\n animationDuration={duration}\n styles={styles}\n getI18nText={getI18nText}\n {...notice}\n />,\n );\n })}\n <SNoticeAriaLiveWrapper aria-live='polite'>\n {infos.map((notice) => {\n const SView = ViewInfo;\n return sstyled(styles)(\n <SView\n key={notice.uid}\n animationDuration={duration}\n styles={styles}\n getI18nText={getI18nText}\n {...notice}\n />,\n );\n })}\n </SNoticeAriaLiveWrapper>\n </SNoticeBubble>\n </Portal>\n </ZIndexStackingContextProvider>,\n );\n }\n}\n\nconst FocusLock = React.forwardRef((props: any, outerRef: React.ForwardedRef<HTMLDivElement>) => {\n const { focusLock, ...other } = props;\n const innerRef = React.useRef<HTMLDivElement | null>(null);\n useFocusLock(innerRef, false, 'auto', !focusLock, true);\n const ref = useForkRef(outerRef, innerRef);\n\n return <Flex ref={ref} {...other} />;\n});\n\nconst PortalForNoticeItem = (props: NoticeBubbleViewItemProps & { containerNode: HTMLElement; tag: typeof ViewInfo }) => {\n const [showContent, setShowContent] = React.useState(false);\n\n // Show content for info notice in previously mounted node with aria-live polite\n React.useEffect(() => {\n setTimeout(() => {\n setShowContent(true);\n }, 200);\n }, []);\n\n const SNoticeAriaLiveWrapper = 'div';\n const Tag = props.tag;\n\n if (props.type === 'info') {\n return (\n <ZIndexStackingContextProvider designToken='z-index-notice-bubble'>\n <Portal nodeToMount={props.containerNode}>\n <SNoticeAriaLiveWrapper aria-live='polite'>\n {showContent && <Tag {...props} />}\n </SNoticeAriaLiveWrapper>\n </Portal>\n </ZIndexStackingContextProvider>\n );\n }\n\n return (\n <ZIndexStackingContextProvider designToken='z-index-notice-bubble'>\n <Portal nodeToMount={props.containerNode}>\n <Tag {...props} />\n </Portal>\n </ZIndexStackingContextProvider>\n );\n};\n\nclass ViewInfo extends Component<NoticeBubbleViewItemProps> {\n timer: Timer | null = null;\n ref = React.createRef<HTMLDivElement>();\n closeButtonRef = React.createRef<HTMLButtonElement>();\n\n componentDidMount() {\n const { duration } = this.props;\n if (duration) {\n this.timer = new Timer(this.handleClose, duration);\n document.body.addEventListener('mousemove', this.handleBodyMouseMove);\n }\n\n const noticeElement = this.ref.current;\n\n if (noticeElement) {\n const focusableNodes = getFocusableIn(noticeElement).filter(\n (node) => node !== this.closeButtonRef.current,\n );\n\n if (focusableNodes.length > 0) {\n setTimeout(() => setFocus(noticeElement), 0);\n }\n }\n }\n\n componentWillUnmount() {\n this.clearTimer();\n document.body.removeEventListener('mousemove', this.handleBodyMouseMove);\n }\n\n clearTimer() {\n if (this.timer) {\n this.timer.clear();\n this.timer = null;\n }\n }\n\n handleClose = (e: React.SyntheticEvent) => {\n // because it might be called not only from the close icon click\n fire(this, 'onClose', e);\n this.clearTimer();\n };\n\n handleKeydown = (e: React.KeyboardEvent) => {\n if (e.key === 'Escape') {\n this.handleClose(e);\n }\n };\n\n handleMouseEnter = () => {\n if (!this.timer) return;\n this.timer.pause();\n };\n\n handleMouseLeave = () => {\n if (!this.timer) return;\n this.timer.resume();\n };\n\n handleBodyMouseMove = (event: MouseEvent) => {\n if (!this.timer?.paused) return;\n const rect = this.ref.current?.getBoundingClientRect();\n if (!rect) return;\n const mouseInRect =\n event.clientX >= rect.left &&\n event.clientX <= rect.right &&\n event.clientY >= rect.top &&\n event.clientY <= rect.bottom;\n if (mouseInRect) return;\n this.timer.resume();\n };\n\n render() {\n const SBubble = FocusLock;\n const SDismiss = Button;\n const SContent = Flex;\n const SMessage = 'div';\n const SAction = 'div';\n const SIcon = Flex;\n const {\n styles,\n getI18nText,\n visible,\n type,\n initialAnimation,\n animationDuration,\n icon,\n children,\n action,\n focusLock,\n } = this.props;\n\n return sstyled(styles)(\n <Animation\n initialAnimation={initialAnimation}\n visible={visible ?? true}\n duration={animationDuration}\n // @ts-ignore\n keyframes={[styles['@enter'], styles['@exit']]}\n >\n <SBubble\n type={type}\n ref={this.ref}\n onMouseEnter={this.handleMouseEnter}\n onMouseLeave={this.handleMouseLeave}\n onKeyDown={this.handleKeydown}\n role={type === 'warning' ? 'alert' : undefined}\n focusLock={focusLock}\n >\n <SDismiss\n aria-haspopup={undefined}\n type='button'\n use='tertiary'\n size='m'\n theme='invert'\n onClick={this.handleClose}\n aria-label={getI18nText('close')}\n active={false}\n title={getI18nText('close')}\n ref={this.closeButtonRef}\n data-hide-focus-hover-popper='true'\n >\n <Button.Addon tag={CloseIcon} color='icon-primary-invert' />\n </SDismiss>\n\n {isNode(icon)\n ? (\n <>\n <SIcon>{icon}</SIcon>\n <SContent>\n <SMessage>{children}</SMessage>\n {isNode(action) ? <SAction>{action}</SAction> : null}\n </SContent>\n </>\n )\n : (\n <SContent>\n <SMessage>{children}</SMessage>\n {isNode(action) ? <SAction>{action}</SAction> : null}\n </SContent>\n )}\n </SBubble>\n </Animation>,\n );\n }\n}\n\nclass ViewWarning extends ViewInfo {\n static defaultProps = {\n type: 'warning',\n duration: 0,\n };\n}\n\nconst NoticeBubbleContainer = createComponent(NoticeBubbleContainerRoot) as Intergalactic.Component<'div', NoticeBubbleContainerProps>;\n\nexport default NoticeBubbleContainer;\n"],"mappings":";;;;AAAA,SAASA,SAAS,EAAEC,GAAG,EAAEC,IAAI,EAAEC,MAAM,QAAQ,0BAA0B;AACvE,OAAOC,MAAM,MAAM,iBAAiB;AACpC,SAASC,eAAe,EAAEC,SAAS,EAAEC,OAAO,EAAEC,IAAI,QAAQ,eAAe;AAEzE,OAAOC,WAAW,MAAM,8CAA8C;AACtE,OAAOC,IAAI,MAAM,8BAA8B;AAC/C,SAASC,cAAc,QAAQ,mDAAmD;AAClF,OAAOC,MAAM,MAAM,gCAAgC;AACnD,SAASC,UAAU,QAAQ,6BAA6B;AACxD,SAASC,mBAAmB,QAAQ,uCAAuC;AAC3E,SAASC,YAAY,EAAEC,QAAQ,QAAQ,0CAA0C;AACjF,SAASC,kBAAkB,QAAQ,wCAAwC;AAC3E,SACEC,6BAA6B,EAC7BC,qBAAqB,QAChB,wCAAwC;AAC/C,OAAOC,SAAS,MAAM,uBAAuB;AAC7C,OAAOC,KAAK,MAAM,OAAO;AAOzB,OAAOC,OAAO,MAAM,uBAAuB;AAAC;AAAA,MAAAC,KAAA,8BAAAC,QAAA,CAAAC,MAAA;AAAA;AAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;AAAA;AAE5C,SAASC,iBAAiB,QAAQ,gDAAgD;AAClF,SAASC,KAAK,QAAQ,SAAS;AAQ/B,MAAMC,yBAAyB,SAAStB,SAAS,CAAiI;EAAAuB,YAAA,GAAAC,IAAA;IAAA,SAAAA,IAAA;IAAAC,eAAA,uBAqB5I,IAAI;IAAAA,eAAA,gBAEzB;MACbC,OAAO,EAAE,EAAE;MACXC,KAAK,EAAE,EAAE;MACTC,QAAQ,EAA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"version":3,"file":"NoticeBubble.type.js","names":[],"sources":["../../src/NoticeBubble.type.ts"],"sourcesContent":["import type { PortalProps, BoxProps } from '@semcore/base-components';\nimport type {
|
|
1
|
+
{"version":3,"file":"NoticeBubble.type.js","names":[],"sources":["../../src/NoticeBubble.type.ts"],"sourcesContent":["import type { PortalProps, BoxProps } from '@semcore/base-components';\nimport type { Intergalactic } from '@semcore/core';\nimport type { useI18n } from '@semcore/core/lib/utils/enhances/WithI18n';\nimport type { RefObject } from 'react';\n\n/**\n * @deprecated. Pass noticeBubbleContainer property from window.sm2.getNoticeBubbleContainer()\n */\nexport type NoticeBubbleContainerPortalProps = PortalProps;\n\nexport type NoticeBubbleContainerProps = BoxProps &\n NoticeBubbleContainerPortalProps & {\n /** Ref to mount bubbles in. You should use element form window.sm2.getNoticeBubbleContainer() */\n containerNode?: HTMLElement | null;\n /** Manager copy */\n manager?: NoticeBubbleManagerClass;\n /** Specifies the locale for i18n support */\n locale?: string;\n };\n\nexport type NoticeBubbleViewItemProps = NoticeBubbleProps & {\n containerNode?: HTMLElement;\n animationDuration: number;\n getI18nText: ReturnType<typeof useI18n>;\n styles: React.DetailedHTMLProps<React.StyleHTMLAttributes<HTMLStyleElement>, HTMLStyleElement> | undefined;\n};\n\nexport type NoticeBubbleProps = BoxProps & {\n /** Notice type */\n type?: 'info' | 'warning';\n /**\n * Notice display duration. Set to 0 to disable auto-close.\n */\n duration?: number;\n /**\n * Enables animation on first rendering.\n * @default false\n */\n initialAnimation?: boolean;\n /**\n * Use it for complex notices with important controls.\n * If enabled, browser focus will be locked in the notice\n * until it's closed. After close focus should return to the element\n * where it was placed before notice appear.\n */\n focusLock?: boolean;\n /**\n * Notice visibility.\n */\n visible?: boolean;\n /**\n * Control under the notice children.\n * */\n action?: React.ReactNode;\n /**\n * Callback triggered by \"Close\" icon click.\n * */\n onClose?: (e?: React.SyntheticEvent) => void;\n /**\n * Notice content.\n * */\n children?: React.ReactNode;\n manager?: NoticeBubbleManagerClass;\n icon?: React.ReactElement;\n};\n\nexport type NoticeBubbleInfoProps = NoticeBubbleProps & {\n readonly type?: 'info';\n};\n\nexport type NoticeBubbleWarningProps = NoticeBubbleProps & {\n readonly type?: 'warning';\n};\n\nexport type AddedNoticeMeta = {\n uid: number;\n update: (props: NoticeBubbleInfoProps | NoticeBubbleWarningProps) => Promise<AddedNoticeMeta>;\n remove: () => boolean;\n ref: RefObject<HTMLElement>;\n};\n\nexport type NoticeBubbleManagerClass = {\n /**\n * Creates and shows a notice.\n * */\n add: (props: NoticeBubbleInfoProps | NoticeBubbleWarningProps) => AddedNoticeMeta;\n /**\n * Removes notice by uid.\n * */\n remove: (uid: number) => boolean;\n /**\n * Replace notice by uid.\n */\n replace: (uid: number, props: NoticeBubbleInfoProps | NoticeBubbleWarningProps) => void;\n /**\n * Replace last notice (if it is existing)\n */\n replaceLast: (props: NoticeBubbleInfoProps | NoticeBubbleWarningProps) => void;\n};\n\nexport declare const NoticeBubbleContainer: Intergalactic.Component<\n 'div',\n NoticeBubbleContainerProps\n>;\n"],"mappings":"","ignoreList":[]}
|
|
@@ -1,127 +1,76 @@
|
|
|
1
|
-
import _objectSpread from "@babel/runtime/helpers/objectSpread2";
|
|
2
|
-
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
3
|
-
import _createClass from "@babel/runtime/helpers/createClass";
|
|
4
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
5
2
|
import { callAllEventHandlers } from '@semcore/core/lib/utils/assignProps';
|
|
6
3
|
import EventEmitter from '@semcore/core/lib/utils/eventEmitter';
|
|
7
|
-
import { setFocus } from '@semcore/core/lib/utils/use/useFocusLock';
|
|
8
4
|
import React from 'react';
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
_classCallCheck(this, NoticeBubbleManager);
|
|
5
|
+
const EVENT_NAME = 'CHANGE';
|
|
6
|
+
class NoticeBubbleManager {
|
|
7
|
+
constructor() {
|
|
13
8
|
_defineProperty(this, "items", []);
|
|
14
9
|
_defineProperty(this, "emitter", new EventEmitter());
|
|
15
10
|
_defineProperty(this, "counter", 0);
|
|
16
|
-
_defineProperty(this, "replaceTimer", null);
|
|
17
11
|
}
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
this.items.push(item);
|
|
52
|
-
this.emit();
|
|
53
|
-
return {
|
|
54
|
-
uid: uid,
|
|
55
|
-
update: this.update.bind(this, uid),
|
|
56
|
-
remove: this.remove.bind(this, uid),
|
|
57
|
-
ref: ref,
|
|
58
|
-
// todo Brauer Ilia: remove this property, because we added logic about autofocus in Notice
|
|
59
|
-
focus: focus
|
|
60
|
-
};
|
|
61
|
-
}
|
|
62
|
-
}, {
|
|
63
|
-
key: "update",
|
|
64
|
-
value: function update(uid, props) {
|
|
65
|
-
var index = this.items.findIndex(function (item) {
|
|
66
|
-
return item.uid === uid;
|
|
67
|
-
});
|
|
68
|
-
if (index !== -1) {
|
|
69
|
-
this.items[index] = _objectSpread(_objectSpread({}, this.items[index]), props);
|
|
70
|
-
this.emit();
|
|
71
|
-
return true;
|
|
72
|
-
}
|
|
73
|
-
return false;
|
|
74
|
-
}
|
|
75
|
-
}, {
|
|
76
|
-
key: "replace",
|
|
77
|
-
value: function replace(uid, props) {
|
|
78
|
-
var _this2 = this;
|
|
79
|
-
if (this.replaceTimer) {
|
|
80
|
-
clearTimeout(this.replaceTimer);
|
|
81
|
-
}
|
|
82
|
-
this.remove(uid);
|
|
83
|
-
this.replaceTimer = setTimeout(function () {
|
|
84
|
-
_this2.add(props);
|
|
12
|
+
addListener(fn) {
|
|
13
|
+
return this.emitter.subscribe(EVENT_NAME, fn);
|
|
14
|
+
}
|
|
15
|
+
emit() {
|
|
16
|
+
this.emitter.emit(EVENT_NAME, this.items);
|
|
17
|
+
}
|
|
18
|
+
add(props) {
|
|
19
|
+
const uid = this.counter++;
|
|
20
|
+
const ref = /*#__PURE__*/React.createRef();
|
|
21
|
+
const item = {
|
|
22
|
+
type: 'info',
|
|
23
|
+
uid,
|
|
24
|
+
visible: props.initialAnimation ? true : undefined,
|
|
25
|
+
forwardRef: ref,
|
|
26
|
+
...props,
|
|
27
|
+
onClose: callAllEventHandlers(props.onClose, () => {
|
|
28
|
+
this.remove(uid);
|
|
29
|
+
})
|
|
30
|
+
};
|
|
31
|
+
this.items.push(item);
|
|
32
|
+
this.emit();
|
|
33
|
+
return {
|
|
34
|
+
uid,
|
|
35
|
+
update: this.replace.bind(this, uid),
|
|
36
|
+
remove: this.remove.bind(this, uid),
|
|
37
|
+
ref
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
replace(uid, props) {
|
|
41
|
+
this.remove(uid);
|
|
42
|
+
return new Promise(resolve => {
|
|
43
|
+
setTimeout(() => {
|
|
44
|
+
resolve(this.add(props));
|
|
85
45
|
}, 300);
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
replaceLast(props) {
|
|
49
|
+
const item = this.items[this.items.length - 1];
|
|
50
|
+
if (item?.visible) {
|
|
51
|
+
this.remove(this.counter - 1);
|
|
86
52
|
}
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
var _this3 = this;
|
|
91
|
-
if (this.replaceTimer) {
|
|
92
|
-
clearTimeout(this.replaceTimer);
|
|
93
|
-
}
|
|
94
|
-
var item = this.items[this.items.length - 1];
|
|
95
|
-
if (item !== null && item !== void 0 && item.visible) {
|
|
96
|
-
this.remove(this.counter - 1);
|
|
97
|
-
}
|
|
98
|
-
this.replaceTimer = setTimeout(function () {
|
|
99
|
-
_this3.add(props);
|
|
53
|
+
return new Promise(resolve => {
|
|
54
|
+
setTimeout(() => {
|
|
55
|
+
resolve(this.add(props));
|
|
100
56
|
}, 300);
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
if (item) {
|
|
110
|
-
item.visible = false;
|
|
111
|
-
setTimeout(function () {
|
|
112
|
-
_this4.items = _this4.items.filter(function (item) {
|
|
113
|
-
return item.uid !== uid;
|
|
114
|
-
});
|
|
115
|
-
_this4.emit();
|
|
116
|
-
}, 1000);
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
remove(uid) {
|
|
60
|
+
const item = this.items.find(item => item.uid === uid);
|
|
61
|
+
if (item) {
|
|
62
|
+
item.visible = false;
|
|
63
|
+
setTimeout(() => {
|
|
64
|
+
this.items = this.items.filter(item => item.uid !== uid);
|
|
117
65
|
this.emit();
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
return
|
|
66
|
+
}, 1000);
|
|
67
|
+
this.emit();
|
|
68
|
+
return true;
|
|
121
69
|
}
|
|
122
|
-
|
|
123
|
-
}
|
|
124
|
-
|
|
70
|
+
return false;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
const noticeBubbleDefaultManager = new NoticeBubbleManager();
|
|
125
74
|
export { NoticeBubbleManager };
|
|
126
75
|
export default noticeBubbleDefaultManager;
|
|
127
76
|
//# sourceMappingURL=NoticeBubbleManager.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NoticeBubbleManager.js","names":["callAllEventHandlers","EventEmitter","
|
|
1
|
+
{"version":3,"file":"NoticeBubbleManager.js","names":["callAllEventHandlers","EventEmitter","React","EVENT_NAME","NoticeBubbleManager","constructor","_defineProperty","addListener","fn","emitter","subscribe","emit","items","add","props","uid","counter","ref","createRef","item","type","visible","initialAnimation","undefined","forwardRef","onClose","remove","push","update","replace","bind","Promise","resolve","setTimeout","replaceLast","length","find","filter","noticeBubbleDefaultManager"],"sources":["../../src/NoticeBubbleManager.ts"],"sourcesContent":["import { callAllEventHandlers } from '@semcore/core/lib/utils/assignProps';\nimport EventEmitter from '@semcore/core/lib/utils/eventEmitter';\nimport { setFocus } from '@semcore/core/lib/utils/use/useFocusLock';\nimport type { RefObject } from 'react';\nimport React from 'react';\n\nimport type {\n NoticeBubbleManagerClass,\n NoticeBubbleInfoProps,\n NoticeBubbleWarningProps,\n AddedNoticeMeta,\n} from './NoticeBubble.type';\n\nconst EVENT_NAME = 'CHANGE';\n\nexport type NoticeItem = (NoticeBubbleInfoProps | NoticeBubbleWarningProps) & {\n uid: number;\n visible?: boolean;\n forwardRef: RefObject<HTMLElement>;\n onClose: () => void;\n};\n\nclass NoticeBubbleManager implements NoticeBubbleManagerClass {\n private items: NoticeItem[] = [];\n private emitter = new EventEmitter();\n private counter = 0;\n\n public addListener(fn: (items: NoticeItem[]) => void): () => void {\n return this.emitter.subscribe(EVENT_NAME, fn);\n }\n\n private emit() {\n this.emitter.emit(EVENT_NAME, this.items);\n }\n\n public add(props: NoticeBubbleInfoProps | NoticeBubbleWarningProps): AddedNoticeMeta {\n const uid = this.counter++;\n const ref = React.createRef<HTMLElement>();\n\n const item = {\n type: 'info',\n uid,\n visible: props.initialAnimation ? true : undefined,\n forwardRef: ref,\n ...props,\n onClose: callAllEventHandlers(props.onClose, () => {\n this.remove(uid);\n }),\n } as const;\n this.items.push(item);\n this.emit();\n return {\n uid,\n update: this.replace.bind(this, uid),\n remove: this.remove.bind(this, uid),\n ref,\n };\n }\n\n public replace(uid: number, props: NoticeBubbleInfoProps | NoticeBubbleWarningProps): Promise<AddedNoticeMeta> {\n this.remove(uid);\n\n return new Promise((resolve) => {\n setTimeout(() => {\n resolve(this.add(props));\n }, 300);\n });\n }\n\n public replaceLast(props: NoticeBubbleInfoProps | NoticeBubbleWarningProps): Promise<AddedNoticeMeta> {\n const item = this.items[this.items.length - 1];\n\n if (item?.visible) {\n this.remove(this.counter - 1);\n }\n\n return new Promise((resolve) => {\n setTimeout(() => {\n resolve(this.add(props));\n }, 300);\n });\n }\n\n public remove(uid: number): boolean {\n const item = this.items.find((item) => item.uid === uid);\n if (item) {\n item.visible = false;\n setTimeout(() => {\n this.items = this.items.filter((item) => item.uid !== uid);\n this.emit();\n }, 1000);\n this.emit();\n return true;\n }\n return false;\n }\n}\n\nconst noticeBubbleDefaultManager = new NoticeBubbleManager();\n\nexport { NoticeBubbleManager };\nexport default noticeBubbleDefaultManager;\n"],"mappings":";AAAA,SAASA,oBAAoB,QAAQ,qCAAqC;AAC1E,OAAOC,YAAY,MAAM,sCAAsC;AAG/D,OAAOC,KAAK,MAAM,OAAO;AASzB,MAAMC,UAAU,GAAG,QAAQ;AAS3B,MAAMC,mBAAmB,CAAqC;EAAAC,YAAA;IAAAC,eAAA,gBAC9B,EAAE;IAAAA,eAAA,kBACd,IAAIL,YAAY,CAAC,CAAC;IAAAK,eAAA,kBAClB,CAAC;EAAA;EAEZC,WAAWA,CAACC,EAAiC,EAAc;IAChE,OAAO,IAAI,CAACC,OAAO,CAACC,SAAS,CAACP,UAAU,EAAEK,EAAE,CAAC;EAC/C;EAEQG,IAAIA,CAAA,EAAG;IACb,IAAI,CAACF,OAAO,CAACE,IAAI,CAACR,UAAU,EAAE,IAAI,CAACS,KAAK,CAAC;EAC3C;EAEOC,GAAGA,CAACC,KAAuD,EAAmB;IACnF,MAAMC,GAAG,GAAG,IAAI,CAACC,OAAO,EAAE;IAC1B,MAAMC,GAAG,gBAAGf,KAAK,CAACgB,SAAS,CAAc,CAAC;IAE1C,MAAMC,IAAI,GAAG;MACXC,IAAI,EAAE,MAAM;MACZL,GAAG;MACHM,OAAO,EAAEP,KAAK,CAACQ,gBAAgB,GAAG,IAAI,GAAGC,SAAS;MAClDC,UAAU,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AI,CAACP,KAAK,CAACwB,IAAI,CAAEjB,IAAI,IAAKA,IAAI,CAACJ,GAAG,KAAKA,GAAG,CAAC;IACxD,IAAII,IAAI,EAAE;MACRA,IAAI,CAACE,OAAO,GAAG,KAAK;MACpBY,UAAU,CAAC,MAAM;QACf,IAAI,CAACrB,KAAK,GAAG,IAAI,CAACA,KAAK,CAACyB,MAAM,CAAElB,IAAI,IAAKA,IAAI,CAACJ,GAAG,KAAKA,GAAG,CAAC;QAC1D,IAAI,CAACJ,IAAI,CAAC,CAAC;MACb,CAAC,EAAE,IAAI,CAAC;MACR,IAAI,CAACA,IAAI,CAAC,CAAC;MACX,OAAO,IAAI;IACb;IACA,OAAO,KAAK;EACd;AACF;AAEA,MAAM2B,0BAA0B,GAAG,IAAIlC,mBAAmB,CAAC,CAAC;AAE5D,SAASA,mBAAmB;AAC5B,eAAekC,0BAA0B","ignoreList":[]}
|
package/lib/es6/index.js
CHANGED
|
@@ -2,6 +2,5 @@ import { default as NoticeBubbleContainer } from './NoticeBubble';
|
|
|
2
2
|
import { default as noticeBubbleDefaultManager } from './NoticeBubbleManager';
|
|
3
3
|
export * from './NoticeBubble';
|
|
4
4
|
export * from './NoticeBubbleManager';
|
|
5
|
-
export default noticeBubbleDefaultManager;
|
|
6
5
|
export { NoticeBubbleContainer, noticeBubbleDefaultManager };
|
|
7
6
|
//# sourceMappingURL=index.js.map
|
package/lib/es6/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["default","NoticeBubbleContainer","noticeBubbleDefaultManager"],"sources":["../../src/index.ts"],"sourcesContent":["import { default as NoticeBubbleContainer } from './NoticeBubble';\nimport type {\n NoticeBubbleContainerProps,\n NoticeBubbleInfoProps,\n NoticeBubbleWarningProps,\n AddedNoticeMeta,\n} from './NoticeBubble.type';\nimport { default as noticeBubbleDefaultManager } from './NoticeBubbleManager';\n\nexport * from './NoticeBubble';\n\nexport * from './NoticeBubbleManager';\n\nexport
|
|
1
|
+
{"version":3,"file":"index.js","names":["default","NoticeBubbleContainer","noticeBubbleDefaultManager"],"sources":["../../src/index.ts"],"sourcesContent":["import { default as NoticeBubbleContainer } from './NoticeBubble';\nimport type {\n NoticeBubbleContainerProps,\n NoticeBubbleInfoProps,\n NoticeBubbleWarningProps,\n AddedNoticeMeta,\n} from './NoticeBubble.type';\nimport { default as noticeBubbleDefaultManager } from './NoticeBubbleManager';\n\nexport * from './NoticeBubble';\n\nexport * from './NoticeBubbleManager';\n\nexport { NoticeBubbleContainer, noticeBubbleDefaultManager };\n\nexport type {\n NoticeBubbleContainerProps,\n NoticeBubbleInfoProps,\n NoticeBubbleWarningProps,\n AddedNoticeMeta,\n};\n"],"mappings":"AAAA,SAASA,OAAO,IAAIC,qBAAqB,QAAQ,gBAAgB;AAOjE,SAASD,OAAO,IAAIE,0BAA0B,QAAQ,uBAAuB;AAE7E,cAAc,gBAAgB;AAE9B,cAAc,uBAAuB;AAErC,SAASD,qBAAqB,EAAEC,0BAA0B","ignoreList":[]}
|
|
@@ -12,20 +12,20 @@ import sv from './sv.json';
|
|
|
12
12
|
import tr from './tr.json';
|
|
13
13
|
import vi from './vi.json';
|
|
14
14
|
import zh from './zh.json';
|
|
15
|
-
export
|
|
16
|
-
de
|
|
17
|
-
en
|
|
18
|
-
es
|
|
19
|
-
fr
|
|
20
|
-
it
|
|
21
|
-
ja
|
|
22
|
-
ko
|
|
23
|
-
nl
|
|
24
|
-
pt
|
|
25
|
-
tr
|
|
26
|
-
vi
|
|
27
|
-
zh
|
|
28
|
-
pl
|
|
29
|
-
sv
|
|
15
|
+
export const localizedMessages = {
|
|
16
|
+
de,
|
|
17
|
+
en,
|
|
18
|
+
es,
|
|
19
|
+
fr,
|
|
20
|
+
it,
|
|
21
|
+
ja,
|
|
22
|
+
ko,
|
|
23
|
+
nl,
|
|
24
|
+
pt,
|
|
25
|
+
tr,
|
|
26
|
+
vi,
|
|
27
|
+
zh,
|
|
28
|
+
pl,
|
|
29
|
+
sv
|
|
30
30
|
};
|
|
31
31
|
//# sourceMappingURL=__intergalactic-dynamic-locales.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"__intergalactic-dynamic-locales.js","names":["de","en","es","fr","it","ja","ko","nl","pl","pt","sv","tr","vi","zh","localizedMessages"],"sources":["../../../src/translations/__intergalactic-dynamic-locales.ts"],"sourcesContent":["import de from './de.json';\nimport en from './en.json';\nimport es from './es.json';\nimport fr from './fr.json';\nimport it from './it.json';\nimport ja from './ja.json';\nimport ko from './ko.json';\nimport nl from './nl.json';\nimport pl from './pl.json';\nimport pt from './pt.json';\nimport sv from './sv.json';\nimport tr from './tr.json';\nimport vi from './vi.json';\nimport zh from './zh.json';\n\nexport const localizedMessages = {\n de,\n en,\n es,\n fr,\n it,\n ja,\n ko,\n nl,\n pt,\n tr,\n vi,\n zh,\n pl,\n sv,\n};\n"],"mappings":"AAAA,OAAOA,EAAE,MAAM,WAAW;AAC1B,OAAOC,EAAE,MAAM,WAAW;AAC1B,OAAOC,EAAE,MAAM,WAAW;AAC1B,OAAOC,EAAE,MAAM,WAAW;AAC1B,OAAOC,EAAE,MAAM,WAAW;AAC1B,OAAOC,EAAE,MAAM,WAAW;AAC1B,OAAOC,EAAE,MAAM,WAAW;AAC1B,OAAOC,EAAE,MAAM,WAAW;AAC1B,OAAOC,EAAE,MAAM,WAAW;AAC1B,OAAOC,EAAE,MAAM,WAAW;AAC1B,OAAOC,EAAE,MAAM,WAAW;AAC1B,OAAOC,EAAE,MAAM,WAAW;AAC1B,OAAOC,EAAE,MAAM,WAAW;AAC1B,OAAOC,EAAE,MAAM,WAAW;AAE1B,OAAO,
|
|
1
|
+
{"version":3,"file":"__intergalactic-dynamic-locales.js","names":["de","en","es","fr","it","ja","ko","nl","pl","pt","sv","tr","vi","zh","localizedMessages"],"sources":["../../../src/translations/__intergalactic-dynamic-locales.ts"],"sourcesContent":["import de from './de.json';\nimport en from './en.json';\nimport es from './es.json';\nimport fr from './fr.json';\nimport it from './it.json';\nimport ja from './ja.json';\nimport ko from './ko.json';\nimport nl from './nl.json';\nimport pl from './pl.json';\nimport pt from './pt.json';\nimport sv from './sv.json';\nimport tr from './tr.json';\nimport vi from './vi.json';\nimport zh from './zh.json';\n\nexport const localizedMessages = {\n de,\n en,\n es,\n fr,\n it,\n ja,\n ko,\n nl,\n pt,\n tr,\n vi,\n zh,\n pl,\n sv,\n};\n"],"mappings":"AAAA,OAAOA,EAAE,MAAM,WAAW;AAC1B,OAAOC,EAAE,MAAM,WAAW;AAC1B,OAAOC,EAAE,MAAM,WAAW;AAC1B,OAAOC,EAAE,MAAM,WAAW;AAC1B,OAAOC,EAAE,MAAM,WAAW;AAC1B,OAAOC,EAAE,MAAM,WAAW;AAC1B,OAAOC,EAAE,MAAM,WAAW;AAC1B,OAAOC,EAAE,MAAM,WAAW;AAC1B,OAAOC,EAAE,MAAM,WAAW;AAC1B,OAAOC,EAAE,MAAM,WAAW;AAC1B,OAAOC,EAAE,MAAM,WAAW;AAC1B,OAAOC,EAAE,MAAM,WAAW;AAC1B,OAAOC,EAAE,MAAM,WAAW;AAC1B,OAAOC,EAAE,MAAM,WAAW;AAE1B,OAAO,MAAMC,iBAAiB,GAAG;EAC/Bd,EAAE;EACFC,EAAE;EACFC,EAAE;EACFC,EAAE;EACFC,EAAE;EACFC,EAAE;EACFC,EAAE;EACFC,EAAE;EACFE,EAAE;EACFE,EAAE;EACFC,EAAE;EACFC,EAAE;EACFL,EAAE;EACFE;AACF,CAAC","ignoreList":[]}
|
package/lib/es6/utils.js
CHANGED
|
@@ -1,9 +1,6 @@
|
|
|
1
|
-
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
2
|
-
import _createClass from "@babel/runtime/helpers/createClass";
|
|
3
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
_classCallCheck(this, Timer);
|
|
2
|
+
class Timer {
|
|
3
|
+
constructor(callback, delay) {
|
|
7
4
|
_defineProperty(this, "delay", void 0);
|
|
8
5
|
_defineProperty(this, "callback", void 0);
|
|
9
6
|
_defineProperty(this, "remaining", void 0);
|
|
@@ -16,39 +13,30 @@ var Timer = /*#__PURE__*/function () {
|
|
|
16
13
|
this.paused = false;
|
|
17
14
|
this.resume();
|
|
18
15
|
}
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
if (this.timerId) {
|
|
23
|
-
clearTimeout(this.timerId);
|
|
24
|
-
}
|
|
25
|
-
this.remaining -= Date.now() - this.start;
|
|
26
|
-
this.paused = true;
|
|
16
|
+
pause() {
|
|
17
|
+
if (this.timerId) {
|
|
18
|
+
clearTimeout(this.timerId);
|
|
27
19
|
}
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
this.timerId = window.setTimeout(this.callback, this.remaining);
|
|
37
|
-
}
|
|
38
|
-
}, {
|
|
39
|
-
key: "reset",
|
|
40
|
-
value: function reset() {
|
|
41
|
-
this.remaining = this.delay;
|
|
42
|
-
this.resume();
|
|
20
|
+
this.remaining -= Date.now() - this.start;
|
|
21
|
+
this.paused = true;
|
|
22
|
+
}
|
|
23
|
+
resume() {
|
|
24
|
+
this.start = Date.now();
|
|
25
|
+
this.paused = false;
|
|
26
|
+
if (this.timerId) {
|
|
27
|
+
clearTimeout(this.timerId);
|
|
43
28
|
}
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
29
|
+
this.timerId = window.setTimeout(this.callback, this.remaining);
|
|
30
|
+
}
|
|
31
|
+
reset() {
|
|
32
|
+
this.remaining = this.delay;
|
|
33
|
+
this.resume();
|
|
34
|
+
}
|
|
35
|
+
clear() {
|
|
36
|
+
if (this.timerId) {
|
|
37
|
+
clearTimeout(this.timerId);
|
|
50
38
|
}
|
|
51
|
-
}
|
|
52
|
-
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
53
41
|
export { Timer };
|
|
54
42
|
//# sourceMappingURL=utils.js.map
|
package/lib/es6/utils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","names":["Timer","
|
|
1
|
+
{"version":3,"file":"utils.js","names":["Timer","constructor","callback","delay","_defineProperty","remaining","paused","resume","pause","timerId","clearTimeout","Date","now","start","window","setTimeout","reset","clear"],"sources":["../../src/utils.ts"],"sourcesContent":["class Timer {\n private readonly delay: number;\n private readonly callback: Function;\n\n private remaining: number;\n private timerId: number | null = null;\n private start: number = 0;\n\n public paused: boolean;\n\n constructor(callback: Function, delay: number) {\n this.callback = callback;\n this.delay = delay;\n\n this.remaining = delay;\n this.paused = false;\n this.resume();\n }\n\n pause() {\n if (this.timerId) {\n clearTimeout(this.timerId);\n }\n this.remaining -= Date.now() - this.start;\n this.paused = true;\n }\n\n resume() {\n this.start = Date.now();\n this.paused = false;\n if (this.timerId) {\n clearTimeout(this.timerId);\n }\n this.timerId = window.setTimeout(this.callback, this.remaining);\n }\n\n reset() {\n this.remaining = this.delay;\n this.resume();\n }\n\n clear() {\n if (this.timerId) {\n clearTimeout(this.timerId);\n }\n }\n}\n\nexport { Timer };\n"],"mappings":";AAAA,MAAMA,KAAK,CAAC;EAUVC,WAAWA,CAACC,QAAkB,EAAEC,KAAa,EAAE;IAAAC,eAAA;IAAAA,eAAA;IAAAA,eAAA;IAAAA,eAAA,kBALd,IAAI;IAAAA,eAAA,gBACb,CAAC;IAAAA,eAAA;IAKvB,IAAI,CAACF,QAAQ,GAAGA,QAAQ;IACxB,IAAI,CAACC,KAAK,GAAGA,KAAK;IAElB,IAAI,CAACE,SAAS,GAAGF,KAAK;IACtB,IAAI,CAACG,MAAM,GAAG,KAAK;IACnB,IAAI,CAACC,MAAM,CAAC,CAAC;EACf;EAEAC,KAAKA,CAAA,EAAG;IACN,IAAI,IAAI,CAACC,OAAO,EAAE;MAChBC,YAAY,C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