@neo4j-ndl/react 5.7.4-alpha.0.a1435aa β 5.7.4
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/lib/LICENSES.txt +3 -3
- package/lib/cjs/announcement-banner/AnnouncementBanner.js +1 -1
- package/lib/cjs/announcement-banner/AnnouncementBanner.js.map +1 -1
- package/lib/esm/announcement-banner/AnnouncementBanner.mjs +1 -1
- package/lib/esm/announcement-banner/AnnouncementBanner.mjs.map +1 -1
- package/lib/types/announcement-banner/AnnouncementBanner.d.ts.map +1 -1
- package/package.json +3 -4
- package/skills/ndl-react/SKILL.md +2 -2
package/lib/LICENSES.txt
CHANGED
|
@@ -3217,7 +3217,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
|
3217
3217
|
|
|
3218
3218
|
---
|
|
3219
3219
|
|
|
3220
|
-
The following software may be included in this product: hast-util-raw (9.
|
|
3220
|
+
The following software may be included in this product: hast-util-raw (9.1.0)
|
|
3221
3221
|
This software contains the following license and notice below:
|
|
3222
3222
|
|
|
3223
3223
|
(The MIT License)
|
|
@@ -5346,7 +5346,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
|
|
|
5346
5346
|
|
|
5347
5347
|
---
|
|
5348
5348
|
|
|
5349
|
-
The following software may be included in this product: parse5 (
|
|
5349
|
+
The following software may be included in this product: parse5 (7.3.0)
|
|
5350
5350
|
This software contains the following license and notice below:
|
|
5351
5351
|
|
|
5352
5352
|
Copyright (c) 2013-2019 Ivan Nikulin (ifaaan@gmail.com, https://github.com/inikulin)
|
|
@@ -29235,7 +29235,7 @@ THIS SOFTWARE.
|
|
|
29235
29235
|
|
|
29236
29236
|
---
|
|
29237
29237
|
|
|
29238
|
-
The following software may be included in this product: entities (
|
|
29238
|
+
The following software may be included in this product: entities (6.0.1)
|
|
29239
29239
|
This software contains the following license and notice below:
|
|
29240
29240
|
|
|
29241
29241
|
Copyright (c) Felix BΓΆhm
|
|
@@ -96,7 +96,7 @@ const AnnouncementBannerContext = react.default.createContext({
|
|
|
96
96
|
const AnnouncementBannerHeader = (_ref) => {
|
|
97
97
|
let { children, className, style, htmlAttributes, ref } = _ref, restProps = require_objectWithoutProperties.default(_ref, _excluded);
|
|
98
98
|
const { hasIcon, icon, variant } = (0, react.useContext)(AnnouncementBannerContext);
|
|
99
|
-
const classes = (0, classnames.default)("ndl-announcement-banner-header", className);
|
|
99
|
+
const classes = (0, classnames.default)("ndl-announcement-banner-header", { "ndl-announcement-banner-header-with-icon": hasIcon }, className);
|
|
100
100
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_typography_Typography.Typography, require_objectSpread2.default(require_objectSpread2.default({
|
|
101
101
|
as: "span",
|
|
102
102
|
variant: "body-medium",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AnnouncementBanner.js","names":["ExclamationTriangleIconSolid","ExclamationCircleIconSolid","SparklesIconSolid","InformationCircleIconSolid","BoltIconOutline","React","useContext","classNames","Typography","useRef","useState","CleanIconButton","XMarkIconOutline"],"sources":["../../../src/announcement-banner/AnnouncementBanner.tsx"],"sourcesContent":["/*!\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\nimport classNames from 'classnames';\nimport React, { useContext, useEffect, useRef, useState } from 'react';\n\nimport {\n type CommonProps,\n type PolymorphicCommonProps,\n} from '../_common/types';\nimport { CleanIconButton } from '../clean-icon-button';\nimport { BoltIconOutline } from '../icons/generated/heroIcons/BoltIconOutline';\nimport { ExclamationCircleIconSolid } from '../icons/generated/heroIcons/ExclamationCircleIconSolid';\nimport { ExclamationTriangleIconSolid } from '../icons/generated/heroIcons/ExclamationTriangleIconSolid';\nimport { InformationCircleIconSolid } from '../icons/generated/heroIcons/InformationCircleIconSolid';\nimport { SparklesIconSolid } from '../icons/generated/heroIcons/SparklesIconSolid';\nimport { XMarkIconOutline } from '../icons/generated/heroIcons/XMarkIconOutline';\nimport { Typography } from '../typography';\n\n/**\n *\n *\n * Types\n *\n *\n */\n\ntype AnnouncementBannerVariant =\n | 'info'\n | 'warning'\n | 'danger'\n | 'discovery'\n | 'neutral';\n\ntype AnnouncementBannerLiveRegion = 'status' | 'alert';\n\ntype PendingAnnouncement = {\n message: string;\n role: AnnouncementBannerLiveRegion;\n};\n\ntype AnnouncementBannerCommonProps = {\n /** Shows a status icon. The icon is based on the value of the `variant` prop */\n hasIcon?: boolean;\n\n /**\n * Decorative icon shown when `hasIcon` is true. Only used for `discovery`\n * and `neutral`; those variants fall back to Sparkles and Bolt. `info`,\n * `warning`, and `danger` always use their status icons.\n */\n icon?: React.ReactNode;\n\n /** Content to be shown in the announcement banner. */\n children?: React.ReactNode;\n\n /**\n * Announces the header when the banner appears or its header changes.\n * `status` announces politely, while `alert` interrupts the user. Leave this\n * unset for banners that are present during the page's initial render.\n * This is independent of the visual `variant`.\n */\n liveRegion?: AnnouncementBannerLiveRegion;\n\n /** The variant of the announcement banner */\n variant?: AnnouncementBannerVariant;\n};\n\ntype CloseableAnnouncementBannerProps = {\n /** If the banner is closeable. Renders an icon button on the right */\n isCloseable: true;\n\n /** Event handler for when the close icon is clicked */\n onClose: (\n error?: React.MouseEvent<HTMLElement> | React.KeyboardEvent<HTMLElement>,\n ) => void;\n};\n\ntype NonCloseableAnnouncementBannerProps = {\n isCloseable?: false;\n onClose?: never;\n};\n\ntype AnnouncementBannerCloseProps =\n | CloseableAnnouncementBannerProps\n | NonCloseableAnnouncementBannerProps;\n\ntype AnnouncementBannerProps = AnnouncementBannerCommonProps &\n AnnouncementBannerCloseProps;\n\nconst LIVE_REGION_REGISTRATION_DELAY = 100;\n\nconst StatusIcon = ({\n icon,\n variant,\n}: {\n icon?: React.ReactNode;\n variant: AnnouncementBannerVariant;\n}) => {\n const canUseCustomIcon = variant === 'discovery' || variant === 'neutral';\n const iconComponent = (() => {\n if (canUseCustomIcon && icon) {\n return icon;\n }\n\n switch (variant) {\n case 'warning':\n return <ExclamationTriangleIconSolid />;\n case 'danger':\n return <ExclamationCircleIconSolid />;\n case 'discovery':\n return <SparklesIconSolid />;\n case 'info':\n return <InformationCircleIconSolid />;\n case 'neutral':\n return <BoltIconOutline />;\n default:\n return null;\n }\n })();\n\n return (\n <span className=\"ndl-announcement-banner-status-icon\" aria-hidden=\"true\">\n {iconComponent}\n </span>\n );\n};\n\nconst AnnouncementBannerContext = React.createContext<{\n hasIcon: boolean;\n icon?: React.ReactNode;\n variant: AnnouncementBannerVariant;\n}>({\n hasIcon: false,\n variant: 'info',\n});\n\n/**\n * Short title or message for the announcement.\n */\nconst AnnouncementBannerHeader = ({\n children,\n className,\n style,\n htmlAttributes,\n ref,\n ...restProps\n}: CommonProps<'span', { children: React.ReactNode }>) => {\n const { hasIcon, icon, variant } = useContext(AnnouncementBannerContext);\n const classes = classNames('ndl-announcement-banner-header', className);\n return (\n <Typography\n as=\"span\"\n variant=\"body-medium\"\n className={classes}\n style={style}\n ref={ref}\n htmlAttributes={htmlAttributes}\n {...restProps}\n >\n {hasIcon && <StatusIcon icon={icon} variant={variant} />}\n {children}\n </Typography>\n );\n};\n\n/**\n * Optional actions shown next to the announcement message.\n */\nconst AnnouncementBannerActions = ({\n children,\n className,\n style,\n htmlAttributes,\n ref,\n ...restProps\n}: CommonProps<'div', { children: React.ReactNode }>) => {\n const classes = classNames('ndl-announcement-banner-actions', className);\n return (\n <div\n className={classes}\n style={style}\n ref={ref}\n {...restProps}\n {...htmlAttributes}\n >\n {children}\n </div>\n );\n};\n\n/**\n * Full-width announcement bar intended to sit at the top of its parent.\n * It stays in normal document flow so sibling content is shifted down.\n *\n * @remarks\n * Place `AnnouncementBanner` as the first child of a full-width parent (for\n * example the page shell).\n */\nconst AnnouncementBannerComponent = <\n TElement extends React.ElementType = 'section',\n>({\n as,\n variant = 'info',\n hasIcon = false,\n icon,\n onClose,\n className,\n children,\n isCloseable = false,\n htmlAttributes,\n liveRegion,\n ref,\n ...restProps\n}: PolymorphicCommonProps<TElement, AnnouncementBannerProps>) => {\n const Element: React.ElementType = as ?? 'section';\n const contentRef = useRef<HTMLDivElement>(null);\n const [pendingAnnouncement, setPendingAnnouncement] =\n useState<PendingAnnouncement | null>(null);\n\n const classes = classNames('ndl-announcement-banner', className, {\n 'ndl-announcement-banner-closeable': isCloseable,\n 'ndl-danger': variant === 'danger',\n 'ndl-discovery': variant === 'discovery',\n 'ndl-info': variant === 'info',\n 'ndl-neutral': variant === 'neutral',\n 'ndl-warning': variant === 'warning',\n });\n\n const handleClose = (\n error:\n | React.MouseEvent<HTMLElement, MouseEvent>\n | React.KeyboardEvent<HTMLElement>,\n ) => {\n if (onClose && typeof onClose === 'function') {\n onClose(error);\n }\n };\n\n useEffect(() => {\n if (!liveRegion || !contentRef.current) {\n setPendingAnnouncement(null);\n return;\n }\n\n const header = contentRef.current.querySelector(\n '.ndl-announcement-banner-header',\n );\n\n if (!header) {\n setPendingAnnouncement(null);\n return;\n }\n\n let timeoutId: number | undefined;\n\n const announceHeader = () => {\n window.clearTimeout(timeoutId);\n setPendingAnnouncement(null);\n\n const message = header.textContent?.trim();\n\n if (message) {\n timeoutId = window.setTimeout(() => {\n setPendingAnnouncement({ message, role: liveRegion });\n }, LIVE_REGION_REGISTRATION_DELAY);\n }\n };\n\n const observer = new MutationObserver(announceHeader);\n observer.observe(header, {\n characterData: true,\n childList: true,\n subtree: true,\n });\n announceHeader();\n\n return () => {\n observer.disconnect();\n window.clearTimeout(timeoutId);\n };\n }, [liveRegion]);\n\n const announcement =\n pendingAnnouncement?.role === liveRegion\n ? (pendingAnnouncement?.message ?? '')\n : '';\n\n return (\n <Element className={classes} ref={ref} {...restProps} {...htmlAttributes}>\n {liveRegion && (\n <span\n className=\"ndl-announcement-banner-live-region\"\n role={liveRegion}\n aria-atomic=\"true\"\n >\n {announcement}\n </span>\n )}\n <div className=\"ndl-announcement-banner-container\" ref={contentRef}>\n <AnnouncementBannerContext.Provider value={{ hasIcon, icon, variant }}>\n {children}\n </AnnouncementBannerContext.Provider>\n </div>\n {isCloseable && (\n <div className=\"ndl-announcement-banner-close\">\n <CleanIconButton\n size=\"small\"\n onClick={handleClose}\n description={null}\n htmlAttributes={{ 'aria-label': 'Close' }}\n >\n <XMarkIconOutline />\n </CleanIconButton>\n </div>\n )}\n </Element>\n );\n};\n\nconst AnnouncementBanner = Object.assign(AnnouncementBannerComponent, {\n Actions: AnnouncementBannerActions,\n Header: AnnouncementBannerHeader,\n});\n\nexport { AnnouncementBanner };\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA6JE;CACA;CACA;CACA;CACA;;;CAyBA;CACA;CACA;CACA;CACA;;;CA4BA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;;AA1HF,MAAM,iCAAiC;AAEvC,MAAM,cAAc,EAClB,MACA,cAII;CACJ,MAAM,mBAAmB,YAAY,eAAe,YAAY;CAsBhE,OACE,iBAAA,GAAA,kBAAA,IAAA,CAAC,QAAD;EAAM,WAAU;EAAsC,eAAY;EAtBvC,iBAAA;GAC3B,IAAI,oBAAoB,MACtB,OAAO;GAGT,QAAQ,SAAR;IACE,KAAK,WACH,OAAO,iBAAA,GAAA,kBAAA,IAAA,CAACA,+DAAAA,8BAAD,CAA+B,CAAA;IACxC,KAAK,UACH,OAAO,iBAAA,GAAA,kBAAA,IAAA,CAACC,6DAAAA,4BAAD,CAA6B,CAAA;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TriangleIconSolid","ExclamationCircleIconSolid","SparklesIconSolid","InformationCircleIconSolid","BoltIconOutline","React","useContext","classNames","Typography","useRef","useState","CleanIconButton","XMarkIconOutline"],"sources":["../../../src/announcement-banner/AnnouncementBanner.tsx"],"sourcesContent":["/*!\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\nimport classNames from 'classnames';\nimport React, { useContext, useEffect, useRef, useState } from 'react';\n\nimport {\n type CommonProps,\n type PolymorphicCommonProps,\n} from '../_common/types';\nimport { CleanIconButton } from '../clean-icon-button';\nimport { BoltIconOutline } from '../icons/generated/heroIcons/BoltIconOutline';\nimport { ExclamationCircleIconSolid } from '../icons/generated/heroIcons/ExclamationCircleIconSolid';\nimport { ExclamationTriangleIconSolid } from '../icons/generated/heroIcons/ExclamationTriangleIconSolid';\nimport { InformationCircleIconSolid } from '../icons/generated/heroIcons/InformationCircleIconSolid';\nimport { SparklesIconSolid } from '../icons/generated/heroIcons/SparklesIconSolid';\nimport { XMarkIconOutline } from '../icons/generated/heroIcons/XMarkIconOutline';\nimport { Typography } from '../typography';\n\n/**\n *\n *\n * Types\n *\n *\n */\n\ntype AnnouncementBannerVariant =\n | 'info'\n | 'warning'\n | 'danger'\n | 'discovery'\n | 'neutral';\n\ntype AnnouncementBannerLiveRegion = 'status' | 'alert';\n\ntype PendingAnnouncement = {\n message: string;\n role: AnnouncementBannerLiveRegion;\n};\n\ntype AnnouncementBannerCommonProps = {\n /** Shows a status icon. The icon is based on the value of the `variant` prop */\n hasIcon?: boolean;\n\n /**\n * Decorative icon shown when `hasIcon` is true. Only used for `discovery`\n * and `neutral`; those variants fall back to Sparkles and Bolt. `info`,\n * `warning`, and `danger` always use their status icons.\n */\n icon?: React.ReactNode;\n\n /** Content to be shown in the announcement banner. */\n children?: React.ReactNode;\n\n /**\n * Announces the header when the banner appears or its header changes.\n * `status` announces politely, while `alert` interrupts the user. Leave this\n * unset for banners that are present during the page's initial render.\n * This is independent of the visual `variant`.\n */\n liveRegion?: AnnouncementBannerLiveRegion;\n\n /** The variant of the announcement banner */\n variant?: AnnouncementBannerVariant;\n};\n\ntype CloseableAnnouncementBannerProps = {\n /** If the banner is closeable. Renders an icon button on the right */\n isCloseable: true;\n\n /** Event handler for when the close icon is clicked */\n onClose: (\n error?: React.MouseEvent<HTMLElement> | React.KeyboardEvent<HTMLElement>,\n ) => void;\n};\n\ntype NonCloseableAnnouncementBannerProps = {\n isCloseable?: false;\n onClose?: never;\n};\n\ntype AnnouncementBannerCloseProps =\n | CloseableAnnouncementBannerProps\n | NonCloseableAnnouncementBannerProps;\n\ntype AnnouncementBannerProps = AnnouncementBannerCommonProps &\n AnnouncementBannerCloseProps;\n\nconst LIVE_REGION_REGISTRATION_DELAY = 100;\n\nconst StatusIcon = ({\n icon,\n variant,\n}: {\n icon?: React.ReactNode;\n variant: AnnouncementBannerVariant;\n}) => {\n const canUseCustomIcon = variant === 'discovery' || variant === 'neutral';\n const iconComponent = (() => {\n if (canUseCustomIcon && icon) {\n return icon;\n }\n\n switch (variant) {\n case 'warning':\n return <ExclamationTriangleIconSolid />;\n case 'danger':\n return <ExclamationCircleIconSolid />;\n case 'discovery':\n return <SparklesIconSolid />;\n case 'info':\n return <InformationCircleIconSolid />;\n case 'neutral':\n return <BoltIconOutline />;\n default:\n return null;\n }\n })();\n\n return (\n <span className=\"ndl-announcement-banner-status-icon\" aria-hidden=\"true\">\n {iconComponent}\n </span>\n );\n};\n\nconst AnnouncementBannerContext = React.createContext<{\n hasIcon: boolean;\n icon?: React.ReactNode;\n variant: AnnouncementBannerVariant;\n}>({\n hasIcon: false,\n variant: 'info',\n});\n\n/**\n * Short title or message for the announcement.\n */\nconst AnnouncementBannerHeader = ({\n children,\n className,\n style,\n htmlAttributes,\n ref,\n ...restProps\n}: CommonProps<'span', { children: React.ReactNode }>) => {\n const { hasIcon, icon, variant } = useContext(AnnouncementBannerContext);\n const classes = classNames(\n 'ndl-announcement-banner-header',\n {\n 'ndl-announcement-banner-header-with-icon': hasIcon,\n },\n className,\n );\n return (\n <Typography\n as=\"span\"\n variant=\"body-medium\"\n className={classes}\n style={style}\n ref={ref}\n htmlAttributes={htmlAttributes}\n {...restProps}\n >\n {hasIcon && <StatusIcon icon={icon} variant={variant} />}\n {children}\n </Typography>\n );\n};\n\n/**\n * Optional actions shown next to the announcement message.\n */\nconst AnnouncementBannerActions = ({\n children,\n className,\n style,\n htmlAttributes,\n ref,\n ...restProps\n}: CommonProps<'div', { children: React.ReactNode }>) => {\n const classes = classNames('ndl-announcement-banner-actions', className);\n return (\n <div\n className={classes}\n style={style}\n ref={ref}\n {...restProps}\n {...htmlAttributes}\n >\n {children}\n </div>\n );\n};\n\n/**\n * Full-width announcement bar intended to sit at the top of its parent.\n * It stays in normal document flow so sibling content is shifted down.\n *\n * @remarks\n * Place `AnnouncementBanner` as the first child of a full-width parent (for\n * example the page shell).\n */\nconst AnnouncementBannerComponent = <\n TElement extends React.ElementType = 'section',\n>({\n as,\n variant = 'info',\n hasIcon = false,\n icon,\n onClose,\n className,\n children,\n isCloseable = false,\n htmlAttributes,\n liveRegion,\n ref,\n ...restProps\n}: PolymorphicCommonProps<TElement, AnnouncementBannerProps>) => {\n const Element: React.ElementType = as ?? 'section';\n const contentRef = useRef<HTMLDivElement>(null);\n const [pendingAnnouncement, setPendingAnnouncement] =\n useState<PendingAnnouncement | null>(null);\n\n const classes = classNames('ndl-announcement-banner', className, {\n 'ndl-announcement-banner-closeable': isCloseable,\n 'ndl-danger': variant === 'danger',\n 'ndl-discovery': variant === 'discovery',\n 'ndl-info': variant === 'info',\n 'ndl-neutral': variant === 'neutral',\n 'ndl-warning': variant === 'warning',\n });\n\n const handleClose = (\n error:\n | React.MouseEvent<HTMLElement, MouseEvent>\n | React.KeyboardEvent<HTMLElement>,\n ) => {\n if (onClose && typeof onClose === 'function') {\n onClose(error);\n }\n };\n\n useEffect(() => {\n if (!liveRegion || !contentRef.current) {\n setPendingAnnouncement(null);\n return;\n }\n\n const header = contentRef.current.querySelector(\n '.ndl-announcement-banner-header',\n );\n\n if (!header) {\n setPendingAnnouncement(null);\n return;\n }\n\n let timeoutId: number | undefined;\n\n const announceHeader = () => {\n window.clearTimeout(timeoutId);\n setPendingAnnouncement(null);\n\n const message = header.textContent?.trim();\n\n if (message) {\n timeoutId = window.setTimeout(() => {\n setPendingAnnouncement({ message, role: liveRegion });\n }, LIVE_REGION_REGISTRATION_DELAY);\n }\n };\n\n const observer = new MutationObserver(announceHeader);\n observer.observe(header, {\n characterData: true,\n childList: true,\n subtree: true,\n });\n announceHeader();\n\n return () => {\n observer.disconnect();\n window.clearTimeout(timeoutId);\n };\n }, [liveRegion]);\n\n const announcement =\n pendingAnnouncement?.role === liveRegion\n ? (pendingAnnouncement?.message ?? '')\n : '';\n\n return (\n <Element className={classes} ref={ref} {...restProps} {...htmlAttributes}>\n {liveRegion && (\n <span\n className=\"ndl-announcement-banner-live-region\"\n role={liveRegion}\n aria-atomic=\"true\"\n >\n {announcement}\n </span>\n )}\n <div className=\"ndl-announcement-banner-container\" ref={contentRef}>\n <AnnouncementBannerContext.Provider value={{ hasIcon, icon, variant }}>\n {children}\n </AnnouncementBannerContext.Provider>\n </div>\n {isCloseable && (\n <div className=\"ndl-announcement-banner-close\">\n <CleanIconButton\n size=\"small\"\n onClick={handleClose}\n description={null}\n htmlAttributes={{ 'aria-label': 'Close' }}\n >\n <XMarkIconOutline />\n </CleanIconButton>\n </div>\n )}\n </Element>\n );\n};\n\nconst AnnouncementBanner = Object.assign(AnnouncementBannerComponent, {\n Actions: AnnouncementBannerActions,\n Header: AnnouncementBannerHeader,\n});\n\nexport { AnnouncementBanner };\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA6JE;CACA;CACA;CACA;CACA;;;CA+BA;CACA;CACA;CACA;CACA;;;CA4BA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;;AAhIF,MAAM,iCAAiC;AAEvC,MAAM,cAAc,EAClB,MACA,cAII;CACJ,MAAM,mBAAmB,YAAY,eAAe,YAAY;CAsBhE,OACE,iBAAA,GAAA,kBAAA,IAAA,CAAC,QAAD;EAAM,WAAU;EAAsC,eAAY;EAtBvC,iBAAA;GAC3B,IAAI,oBAAoB,MACtB,OAAO;GAGT,QAAQ,SAAR;IACE,KAAK,WACH,OAAO,iBAAA,GAAA,kBAAA,IAAA,CAACA,+DAAAA,8BAAD,CAA+B,CAAA;IACxC,KAAK,UACH,OAAO,iBAAA,GAAA,kBAAA,IAAA,CAACC,6DAAAA,4BAAD,CAA6B,CAAA;IACtC,KAAK,aACH,OAAO,iBAAA,GAAA,kBAAA,IAAA,CAACC,oDAAAA,mBAAD,CAAoB,CAAA;IAC7B,KAAK,QACH,OAAO,iBAAA,GAAA,kBAAA,IAAA,CAACC,6DAAAA,4BAAD,CAA6B,CAAA;IACtC,KAAK,WACH,OAAO,iBAAA,GAAA,kBAAA,IAAA,CAACC,kDAAAA,iBAAD,CAAkB,CAAA;IAC3B,SACE,OAAO;GACX;EACF,EAAA,CAIiB;CACT,CAAA;AAEV;AAEA,MAAM,4BAA4BC,MAAAA,QAAM,cAIrC;CACD,SAAS;CACT,SAAS;AACX,CAAC;;;;AAKD,MAAM,4BAA4B,SAOwB;CAPxB,IAAA,EAChC,UACA,WACA,OACA,gBACA,QAAA,MACG,YAAA,gCAAA,QAAA,MAAA,SAAA;CAEH,MAAM,EAAE,SAAS,MAAM,aAAA,GAAYC,MAAA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,CAAC,QAAD;GACE,WAAU;GACV,MAAM;GACN,eAAY;GAEX,UAAA;EACG,CAAA;EAER,iBAAA,GAAA,kBAAA,IAAA,CAAC,OAAD;GAAK,WAAU;GAAoC,KAAK;GACtD,UAAA,iBAAA,GAAA,kBAAA,IAAA,CAAC,0BAA0B,UAA3B;IAAoC,OAAO;KAAE;KAAS;KAAM;IAAQ;IACjE;GACiC,CAAA;EACjC,CAAA;EACJ,eACC,iBAAA,GAAA,kBAAA,IAAA,CAAC,OAAD;GAAK,WAAU;GACb,UAAA,iBAAA,GAAA,kBAAA,IAAA,CAACI,0CAAAA,iBAAD;IACE,MAAK;IACL,SAAS;IACT,aAAa;IACb,gBAAgB,EAAE,cAAc,QAAQ;IAExC,UAAA,iBAAA,GAAA,kBAAA,IAAA,CAACC,mDAAAA,kBAAD,CAAmB,CAAA;GACJ,CAAA;EACd,CAAA;CAEA,EAAA,CAAA,CAAA;AAEb;AAEA,MAAM,qBAAqB,OAAO,OAAO,6BAA6B;CACpE,SAAS;CACT,QAAQ;AACV,CAAC"}
|
|
@@ -88,7 +88,7 @@ const AnnouncementBannerContext = React.createContext({
|
|
|
88
88
|
const AnnouncementBannerHeader = (_ref) => {
|
|
89
89
|
let { children, className, style, htmlAttributes, ref } = _ref, restProps = _objectWithoutProperties(_ref, _excluded);
|
|
90
90
|
const { hasIcon, icon, variant } = useContext(AnnouncementBannerContext);
|
|
91
|
-
const classes = classNames("ndl-announcement-banner-header", className);
|
|
91
|
+
const classes = classNames("ndl-announcement-banner-header", { "ndl-announcement-banner-header-with-icon": hasIcon }, className);
|
|
92
92
|
return /* @__PURE__ */ jsxs(Typography, _objectSpread2(_objectSpread2({
|
|
93
93
|
as: "span",
|
|
94
94
|
variant: "body-medium",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AnnouncementBanner.mjs","names":[],"sources":["../../../src/announcement-banner/AnnouncementBanner.tsx"],"sourcesContent":["/*!\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\nimport classNames from 'classnames';\nimport React, { useContext, useEffect, useRef, useState } from 'react';\n\nimport {\n type CommonProps,\n type PolymorphicCommonProps,\n} from '../_common/types';\nimport { CleanIconButton } from '../clean-icon-button';\nimport { BoltIconOutline } from '../icons/generated/heroIcons/BoltIconOutline';\nimport { ExclamationCircleIconSolid } from '../icons/generated/heroIcons/ExclamationCircleIconSolid';\nimport { ExclamationTriangleIconSolid } from '../icons/generated/heroIcons/ExclamationTriangleIconSolid';\nimport { InformationCircleIconSolid } from '../icons/generated/heroIcons/InformationCircleIconSolid';\nimport { SparklesIconSolid } from '../icons/generated/heroIcons/SparklesIconSolid';\nimport { XMarkIconOutline } from '../icons/generated/heroIcons/XMarkIconOutline';\nimport { Typography } from '../typography';\n\n/**\n *\n *\n * Types\n *\n *\n */\n\ntype AnnouncementBannerVariant =\n | 'info'\n | 'warning'\n | 'danger'\n | 'discovery'\n | 'neutral';\n\ntype AnnouncementBannerLiveRegion = 'status' | 'alert';\n\ntype PendingAnnouncement = {\n message: string;\n role: AnnouncementBannerLiveRegion;\n};\n\ntype AnnouncementBannerCommonProps = {\n /** Shows a status icon. The icon is based on the value of the `variant` prop */\n hasIcon?: boolean;\n\n /**\n * Decorative icon shown when `hasIcon` is true. Only used for `discovery`\n * and `neutral`; those variants fall back to Sparkles and Bolt. `info`,\n * `warning`, and `danger` always use their status icons.\n */\n icon?: React.ReactNode;\n\n /** Content to be shown in the announcement banner. */\n children?: React.ReactNode;\n\n /**\n * Announces the header when the banner appears or its header changes.\n * `status` announces politely, while `alert` interrupts the user. Leave this\n * unset for banners that are present during the page's initial render.\n * This is independent of the visual `variant`.\n */\n liveRegion?: AnnouncementBannerLiveRegion;\n\n /** The variant of the announcement banner */\n variant?: AnnouncementBannerVariant;\n};\n\ntype CloseableAnnouncementBannerProps = {\n /** If the banner is closeable. Renders an icon button on the right */\n isCloseable: true;\n\n /** Event handler for when the close icon is clicked */\n onClose: (\n error?: React.MouseEvent<HTMLElement> | React.KeyboardEvent<HTMLElement>,\n ) => void;\n};\n\ntype NonCloseableAnnouncementBannerProps = {\n isCloseable?: false;\n onClose?: never;\n};\n\ntype AnnouncementBannerCloseProps =\n | CloseableAnnouncementBannerProps\n | NonCloseableAnnouncementBannerProps;\n\ntype AnnouncementBannerProps = AnnouncementBannerCommonProps &\n AnnouncementBannerCloseProps;\n\nconst LIVE_REGION_REGISTRATION_DELAY = 100;\n\nconst StatusIcon = ({\n icon,\n variant,\n}: {\n icon?: React.ReactNode;\n variant: AnnouncementBannerVariant;\n}) => {\n const canUseCustomIcon = variant === 'discovery' || variant === 'neutral';\n const iconComponent = (() => {\n if (canUseCustomIcon && icon) {\n return icon;\n }\n\n switch (variant) {\n case 'warning':\n return <ExclamationTriangleIconSolid />;\n case 'danger':\n return <ExclamationCircleIconSolid />;\n case 'discovery':\n return <SparklesIconSolid />;\n case 'info':\n return <InformationCircleIconSolid />;\n case 'neutral':\n return <BoltIconOutline />;\n default:\n return null;\n }\n })();\n\n return (\n <span className=\"ndl-announcement-banner-status-icon\" aria-hidden=\"true\">\n {iconComponent}\n </span>\n );\n};\n\nconst AnnouncementBannerContext = React.createContext<{\n hasIcon: boolean;\n icon?: React.ReactNode;\n variant: AnnouncementBannerVariant;\n}>({\n hasIcon: false,\n variant: 'info',\n});\n\n/**\n * Short title or message for the announcement.\n */\nconst AnnouncementBannerHeader = ({\n children,\n className,\n style,\n htmlAttributes,\n ref,\n ...restProps\n}: CommonProps<'span', { children: React.ReactNode }>) => {\n const { hasIcon, icon, variant } = useContext(AnnouncementBannerContext);\n const classes = classNames('ndl-announcement-banner-header', className);\n return (\n <Typography\n as=\"span\"\n variant=\"body-medium\"\n className={classes}\n style={style}\n ref={ref}\n htmlAttributes={htmlAttributes}\n {...restProps}\n >\n {hasIcon && <StatusIcon icon={icon} variant={variant} />}\n {children}\n </Typography>\n );\n};\n\n/**\n * Optional actions shown next to the announcement message.\n */\nconst AnnouncementBannerActions = ({\n children,\n className,\n style,\n htmlAttributes,\n ref,\n ...restProps\n}: CommonProps<'div', { children: React.ReactNode }>) => {\n const classes = classNames('ndl-announcement-banner-actions', className);\n return (\n <div\n className={classes}\n style={style}\n ref={ref}\n {...restProps}\n {...htmlAttributes}\n >\n {children}\n </div>\n );\n};\n\n/**\n * Full-width announcement bar intended to sit at the top of its parent.\n * It stays in normal document flow so sibling content is shifted down.\n *\n * @remarks\n * Place `AnnouncementBanner` as the first child of a full-width parent (for\n * example the page shell).\n */\nconst AnnouncementBannerComponent = <\n TElement extends React.ElementType = 'section',\n>({\n as,\n variant = 'info',\n hasIcon = false,\n icon,\n onClose,\n className,\n children,\n isCloseable = false,\n htmlAttributes,\n liveRegion,\n ref,\n ...restProps\n}: PolymorphicCommonProps<TElement, AnnouncementBannerProps>) => {\n const Element: React.ElementType = as ?? 'section';\n const contentRef = useRef<HTMLDivElement>(null);\n const [pendingAnnouncement, setPendingAnnouncement] =\n useState<PendingAnnouncement | null>(null);\n\n const classes = classNames('ndl-announcement-banner', className, {\n 'ndl-announcement-banner-closeable': isCloseable,\n 'ndl-danger': variant === 'danger',\n 'ndl-discovery': variant === 'discovery',\n 'ndl-info': variant === 'info',\n 'ndl-neutral': variant === 'neutral',\n 'ndl-warning': variant === 'warning',\n });\n\n const handleClose = (\n error:\n | React.MouseEvent<HTMLElement, MouseEvent>\n | React.KeyboardEvent<HTMLElement>,\n ) => {\n if (onClose && typeof onClose === 'function') {\n onClose(error);\n }\n };\n\n useEffect(() => {\n if (!liveRegion || !contentRef.current) {\n setPendingAnnouncement(null);\n return;\n }\n\n const header = contentRef.current.querySelector(\n '.ndl-announcement-banner-header',\n );\n\n if (!header) {\n setPendingAnnouncement(null);\n return;\n }\n\n let timeoutId: number | undefined;\n\n const announceHeader = () => {\n window.clearTimeout(timeoutId);\n setPendingAnnouncement(null);\n\n const message = header.textContent?.trim();\n\n if (message) {\n timeoutId = window.setTimeout(() => {\n setPendingAnnouncement({ message, role: liveRegion });\n }, LIVE_REGION_REGISTRATION_DELAY);\n }\n };\n\n const observer = new MutationObserver(announceHeader);\n observer.observe(header, {\n characterData: true,\n childList: true,\n subtree: true,\n });\n announceHeader();\n\n return () => {\n observer.disconnect();\n window.clearTimeout(timeoutId);\n };\n }, [liveRegion]);\n\n const announcement =\n pendingAnnouncement?.role === liveRegion\n ? (pendingAnnouncement?.message ?? '')\n : '';\n\n return (\n <Element className={classes} ref={ref} {...restProps} {...htmlAttributes}>\n {liveRegion && (\n <span\n className=\"ndl-announcement-banner-live-region\"\n role={liveRegion}\n aria-atomic=\"true\"\n >\n {announcement}\n </span>\n )}\n <div className=\"ndl-announcement-banner-container\" ref={contentRef}>\n <AnnouncementBannerContext.Provider value={{ hasIcon, icon, variant }}>\n {children}\n </AnnouncementBannerContext.Provider>\n </div>\n {isCloseable && (\n <div className=\"ndl-announcement-banner-close\">\n <CleanIconButton\n size=\"small\"\n onClick={handleClose}\n description={null}\n htmlAttributes={{ 'aria-label': 'Close' }}\n >\n <XMarkIconOutline />\n </CleanIconButton>\n </div>\n )}\n </Element>\n );\n};\n\nconst AnnouncementBanner = Object.assign(AnnouncementBannerComponent, {\n Actions: AnnouncementBannerActions,\n Header: AnnouncementBannerHeader,\n});\n\nexport { AnnouncementBanner };\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA6JE;CACA;CACA;CACA;CACA;;;CAyBA;CACA;CACA;CACA;CACA;;;CA4BA;CACA;CACA;CACA;CACA;CACA;CACA;CAC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;GACpB,OAAO,aAAa,SAAS;EAC/B;CACF,GAAG,CAAC,UAAU,CAAC;CAEf,MAAM,gBAAA,wBAAA,QAAA,wBAAA,KAAA,IAAA,KAAA,IACJ,oBAAqB,UAAS,cAAA,wBAAA,wBAAA,QAAA,wBAAA,KAAA,IAAA,KAAA,IACzB,oBAAqB,aAAA,QAAA,0BAAA,KAAA,IAAA,wBAAW,KACjC;CAEN,OACE,qBAAC,SAAA,eAAA,eAAA,eAAA;EAAQ,WAAW;EAAc;CAAS,GAAA,SAAA,GAAe,cAAA,GAAA,CAAA,GAAA,EAAA,UAA1D;EACG,cACC,oBAAC,QAAD;GACE,WAAU;GACV,MAAM;GACN,eAAY;GAEX,UAAA;EACG,CAAA;EAER,oBAAC,OAAD;GAAK,WAAU;GAAoC,KAAK;GACtD,UAAA,oBAAC,0BAA0B,UAA3B;IAAoC,OAAO;KAAE;KAAS;KAAM;IAAQ;IACjE;GACiC,CAAA;EACjC,CAAA;EACJ,eACC,oBAAC,OAAD;GAAK,WAAU;GACb,UAAA,oBAAC,iBAAD;IACE,MAAK;IACL,SAAS;IACT,aAAa;IACb,gBAAgB,EAAE,cAAc,QAAQ;IAExC,UAAA,oBAAC,kBAAD,CAAmB,CAAA;GACJ,CAAA;EACd,CAAA;CAEA,EAAA,CAAA,CAAA;AAEb;AAEA,MAAM,qBAAqB,OAAO,OAAO,6BAA6B;CACpE,SAAS;CACT,QAAQ;AACV,CAAC"}
|
|
1
|
+
{"version":3,"file":"AnnouncementBanner.mjs","names":[],"sources":["../../../src/announcement-banner/AnnouncementBanner.tsx"],"sourcesContent":["/*!\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\nimport classNames from 'classnames';\nimport React, { useContext, useEffect, useRef, useState } from 'react';\n\nimport {\n type CommonProps,\n type PolymorphicCommonProps,\n} from '../_common/types';\nimport { CleanIconButton } from '../clean-icon-button';\nimport { BoltIconOutline } from '../icons/generated/heroIcons/BoltIconOutline';\nimport { ExclamationCircleIconSolid } from '../icons/generated/heroIcons/ExclamationCircleIconSolid';\nimport { ExclamationTriangleIconSolid } from '../icons/generated/heroIcons/ExclamationTriangleIconSolid';\nimport { InformationCircleIconSolid } from '../icons/generated/heroIcons/InformationCircleIconSolid';\nimport { SparklesIconSolid } from '../icons/generated/heroIcons/SparklesIconSolid';\nimport { XMarkIconOutline } from '../icons/generated/heroIcons/XMarkIconOutline';\nimport { Typography } from '../typography';\n\n/**\n *\n *\n * Types\n *\n *\n */\n\ntype AnnouncementBannerVariant =\n | 'info'\n | 'warning'\n | 'danger'\n | 'discovery'\n | 'neutral';\n\ntype AnnouncementBannerLiveRegion = 'status' | 'alert';\n\ntype PendingAnnouncement = {\n message: string;\n role: AnnouncementBannerLiveRegion;\n};\n\ntype AnnouncementBannerCommonProps = {\n /** Shows a status icon. The icon is based on the value of the `variant` prop */\n hasIcon?: boolean;\n\n /**\n * Decorative icon shown when `hasIcon` is true. Only used for `discovery`\n * and `neutral`; those variants fall back to Sparkles and Bolt. `info`,\n * `warning`, and `danger` always use their status icons.\n */\n icon?: React.ReactNode;\n\n /** Content to be shown in the announcement banner. */\n children?: React.ReactNode;\n\n /**\n * Announces the header when the banner appears or its header changes.\n * `status` announces politely, while `alert` interrupts the user. Leave this\n * unset for banners that are present during the page's initial render.\n * This is independent of the visual `variant`.\n */\n liveRegion?: AnnouncementBannerLiveRegion;\n\n /** The variant of the announcement banner */\n variant?: AnnouncementBannerVariant;\n};\n\ntype CloseableAnnouncementBannerProps = {\n /** If the banner is closeable. Renders an icon button on the right */\n isCloseable: true;\n\n /** Event handler for when the close icon is clicked */\n onClose: (\n error?: React.MouseEvent<HTMLElement> | React.KeyboardEvent<HTMLElement>,\n ) => void;\n};\n\ntype NonCloseableAnnouncementBannerProps = {\n isCloseable?: false;\n onClose?: never;\n};\n\ntype AnnouncementBannerCloseProps =\n | CloseableAnnouncementBannerProps\n | NonCloseableAnnouncementBannerProps;\n\ntype AnnouncementBannerProps = AnnouncementBannerCommonProps &\n AnnouncementBannerCloseProps;\n\nconst LIVE_REGION_REGISTRATION_DELAY = 100;\n\nconst StatusIcon = ({\n icon,\n variant,\n}: {\n icon?: React.ReactNode;\n variant: AnnouncementBannerVariant;\n}) => {\n const canUseCustomIcon = variant === 'discovery' || variant === 'neutral';\n const iconComponent = (() => {\n if (canUseCustomIcon && icon) {\n return icon;\n }\n\n switch (variant) {\n case 'warning':\n return <ExclamationTriangleIconSolid />;\n case 'danger':\n return <ExclamationCircleIconSolid />;\n case 'discovery':\n return <SparklesIconSolid />;\n case 'info':\n return <InformationCircleIconSolid />;\n case 'neutral':\n return <BoltIconOutline />;\n default:\n return null;\n }\n })();\n\n return (\n <span className=\"ndl-announcement-banner-status-icon\" aria-hidden=\"true\">\n {iconComponent}\n </span>\n );\n};\n\nconst AnnouncementBannerContext = React.createContext<{\n hasIcon: boolean;\n icon?: React.ReactNode;\n variant: AnnouncementBannerVariant;\n}>({\n hasIcon: false,\n variant: 'info',\n});\n\n/**\n * Short title or message for the announcement.\n */\nconst AnnouncementBannerHeader = ({\n children,\n className,\n style,\n htmlAttributes,\n ref,\n ...restProps\n}: CommonProps<'span', { children: React.ReactNode }>) => {\n const { hasIcon, icon, variant } = useContext(AnnouncementBannerContext);\n const classes = classNames(\n 'ndl-announcement-banner-header',\n {\n 'ndl-announcement-banner-header-with-icon': hasIcon,\n },\n className,\n );\n return (\n <Typography\n as=\"span\"\n variant=\"body-medium\"\n className={classes}\n style={style}\n ref={ref}\n htmlAttributes={htmlAttributes}\n {...restProps}\n >\n {hasIcon && <StatusIcon icon={icon} variant={variant} />}\n {children}\n </Typography>\n );\n};\n\n/**\n * Optional actions shown next to the announcement message.\n */\nconst AnnouncementBannerActions = ({\n children,\n className,\n style,\n htmlAttributes,\n ref,\n ...restProps\n}: CommonProps<'div', { children: React.ReactNode }>) => {\n const classes = classNames('ndl-announcement-banner-actions', className);\n return (\n <div\n className={classes}\n style={style}\n ref={ref}\n {...restProps}\n {...htmlAttributes}\n >\n {children}\n </div>\n );\n};\n\n/**\n * Full-width announcement bar intended to sit at the top of its parent.\n * It stays in normal document flow so sibling content is shifted down.\n *\n * @remarks\n * Place `AnnouncementBanner` as the first child of a full-width parent (for\n * example the page shell).\n */\nconst AnnouncementBannerComponent = <\n TElement extends React.ElementType = 'section',\n>({\n as,\n variant = 'info',\n hasIcon = false,\n icon,\n onClose,\n className,\n children,\n isCloseable = false,\n htmlAttributes,\n liveRegion,\n ref,\n ...restProps\n}: PolymorphicCommonProps<TElement, AnnouncementBannerProps>) => {\n const Element: React.ElementType = as ?? 'section';\n const contentRef = useRef<HTMLDivElement>(null);\n const [pendingAnnouncement, setPendingAnnouncement] =\n useState<PendingAnnouncement | null>(null);\n\n const classes = classNames('ndl-announcement-banner', className, {\n 'ndl-announcement-banner-closeable': isCloseable,\n 'ndl-danger': variant === 'danger',\n 'ndl-discovery': variant === 'discovery',\n 'ndl-info': variant === 'info',\n 'ndl-neutral': variant === 'neutral',\n 'ndl-warning': variant === 'warning',\n });\n\n const handleClose = (\n error:\n | React.MouseEvent<HTMLElement, MouseEvent>\n | React.KeyboardEvent<HTMLElement>,\n ) => {\n if (onClose && typeof onClose === 'function') {\n onClose(error);\n }\n };\n\n useEffect(() => {\n if (!liveRegion || !contentRef.current) {\n setPendingAnnouncement(null);\n return;\n }\n\n const header = contentRef.current.querySelector(\n '.ndl-announcement-banner-header',\n );\n\n if (!header) {\n setPendingAnnouncement(null);\n return;\n }\n\n let timeoutId: number | undefined;\n\n const announceHeader = () => {\n window.clearTimeout(timeoutId);\n setPendingAnnouncement(null);\n\n const message = header.textContent?.trim();\n\n if (message) {\n timeoutId = window.setTimeout(() => {\n setPendingAnnouncement({ message, role: liveRegion });\n }, LIVE_REGION_REGISTRATION_DELAY);\n }\n };\n\n const observer = new MutationObserver(announceHeader);\n observer.observe(header, {\n characterData: true,\n childList: true,\n subtree: true,\n });\n announceHeader();\n\n return () => {\n observer.disconnect();\n window.clearTimeout(timeoutId);\n };\n }, [liveRegion]);\n\n const announcement =\n pendingAnnouncement?.role === liveRegion\n ? (pendingAnnouncement?.message ?? '')\n : '';\n\n return (\n <Element className={classes} ref={ref} {...restProps} {...htmlAttributes}>\n {liveRegion && (\n <span\n className=\"ndl-announcement-banner-live-region\"\n role={liveRegion}\n aria-atomic=\"true\"\n >\n {announcement}\n </span>\n )}\n <div className=\"ndl-announcement-banner-container\" ref={contentRef}>\n <AnnouncementBannerContext.Provider value={{ hasIcon, icon, variant }}>\n {children}\n </AnnouncementBannerContext.Provider>\n </div>\n {isCloseable && (\n <div className=\"ndl-announcement-banner-close\">\n <CleanIconButton\n size=\"small\"\n onClick={handleClose}\n description={null}\n htmlAttributes={{ 'aria-label': 'Close' }}\n >\n <XMarkIconOutline />\n </CleanIconButton>\n </div>\n )}\n </Element>\n );\n};\n\nconst AnnouncementBanner = Object.assign(AnnouncementBannerComponent, {\n Actions: AnnouncementBannerActions,\n Header: AnnouncementBannerHeader,\n});\n\nexport { AnnouncementBanner };\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA6JE;CACA;CACA;CACA;CACA;;;CA+BA;CACA;CACA;CACA;CACA;;;CA4BA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;;AAhIF,MAAM,iCAAiC;AAEvC,MAAM,cAAc,EAClB,MACA,cAII;CACJ,MAAM,mBAAmB,YAAY,eAAe,YAAY;CAsBhE,OACE,oBAAC,QAAD;EAAM,WAAU;EAAs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S,cAAA,wBAAA,wBAAA,QAAA,wBAAA,KAAA,IAAA,KAAA,IACzB,oBAAqB,aAAA,QAAA,0BAAA,KAAA,IAAA,wBAAW,KACjC;CAEN,OACE,qBAAC,SAAA,eAAA,eAAA,eAAA;EAAQ,WAAW;EAAc;CAAS,GAAA,SAAA,GAAe,cAAA,GAAA,CAAA,GAAA,EAAA,UAA1D;EACG,cACC,oBAAC,QAAD;GACE,WAAU;GACV,MAAM;GACN,eAAY;GAEX,UAAA;EACG,CAAA;EAER,oBAAC,OAAD;GAAK,WAAU;GAAoC,KAAK;GACtD,UAAA,oBAAC,0BAA0B,UAA3B;IAAoC,OAAO;KAAE;KAAS;KAAM;IAAQ;IACjE;GACiC,CAAA;EACjC,CAAA;EACJ,eACC,oBAAC,OAAD;GAAK,WAAU;GACb,UAAA,oBAAC,iBAAD;IACE,MAAK;IACL,SAAS;IACT,aAAa;IACb,gBAAgB,EAAE,cAAc,QAAQ;IAExC,UAAA,oBAAC,kBAAD,CAAmB,CAAA;GACJ,CAAA;EACd,CAAA;CAEA,EAAA,CAAA,CAAA;AAEb;AAEA,MAAM,qBAAqB,OAAO,OAAO,6BAA6B;CACpE,SAAS;CACT,QAAQ;AACV,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AnnouncementBanner.d.ts","sourceRoot":"","sources":["../../../src/announcement-banner/AnnouncementBanner.tsx"],"names":[],"mappings":"AAqBA,OAAO,KAAkD,MAAM,OAAO,CAAC;AAEvE,OAAO,EACL,KAAK,WAAW,EAChB,KAAK,sBAAsB,EAC5B,MAAM,kBAAkB,CAAC;AAU1B;;;;;;GAMG;AAEH,KAAK,yBAAyB,GAC1B,MAAM,GACN,SAAS,GACT,QAAQ,GACR,WAAW,GACX,SAAS,CAAC;AAEd,KAAK,4BAA4B,GAAG,QAAQ,GAAG,OAAO,CAAC;AAOvD,KAAK,6BAA6B,GAAG;IACnC,gFAAgF;IAChF,OAAO,CAAC,EAAE,OAAO,CAAC;IAElB;;;;OAIG;IACH,IAAI,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAEvB,sDAAsD;IACtD,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAE3B;;;;;OAKG;IACH,UAAU,CAAC,EAAE,4BAA4B,CAAC;IAE1C,6CAA6C;IAC7C,OAAO,CAAC,EAAE,yBAAyB,CAAC;CACrC,CAAC;AAEF,KAAK,gCAAgC,GAAG;IACtC,sEAAsE;IACtE,WAAW,EAAE,IAAI,CAAC;IAElB,uDAAuD;IACvD,OAAO,EAAE,CACP,KAAK,CAAC,EAAE,KAAK,CAAC,UAAU,CAAC,WAAW,CAAC,GAAG,KAAK,CAAC,aAAa,CAAC,WAAW,CAAC,KACrE,IAAI,CAAC;CACX,CAAC;AAEF,KAAK,mCAAmC,GAAG;IACzC,WAAW,CAAC,EAAE,KAAK,CAAC;IACpB,OAAO,CAAC,EAAE,KAAK,CAAC;CACjB,CAAC;AAEF,KAAK,4BAA4B,GAC7B,gCAAgC,GAChC,mCAAmC,CAAC;AAExC,KAAK,uBAAuB,GAAG,6BAA6B,GAC1D,4BAA4B,CAAC;
|
|
1
|
+
{"version":3,"file":"AnnouncementBanner.d.ts","sourceRoot":"","sources":["../../../src/announcement-banner/AnnouncementBanner.tsx"],"names":[],"mappings":"AAqBA,OAAO,KAAkD,MAAM,OAAO,CAAC;AAEvE,OAAO,EACL,KAAK,WAAW,EAChB,KAAK,sBAAsB,EAC5B,MAAM,kBAAkB,CAAC;AAU1B;;;;;;GAMG;AAEH,KAAK,yBAAyB,GAC1B,MAAM,GACN,SAAS,GACT,QAAQ,GACR,WAAW,GACX,SAAS,CAAC;AAEd,KAAK,4BAA4B,GAAG,QAAQ,GAAG,OAAO,CAAC;AAOvD,KAAK,6BAA6B,GAAG;IACnC,gFAAgF;IAChF,OAAO,CAAC,EAAE,OAAO,CAAC;IAElB;;;;OAIG;IACH,IAAI,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAEvB,sDAAsD;IACtD,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAE3B;;;;;OAKG;IACH,UAAU,CAAC,EAAE,4BAA4B,CAAC;IAE1C,6CAA6C;IAC7C,OAAO,CAAC,EAAE,yBAAyB,CAAC;CACrC,CAAC;AAEF,KAAK,gCAAgC,GAAG;IACtC,sEAAsE;IACtE,WAAW,EAAE,IAAI,CAAC;IAElB,uDAAuD;IACvD,OAAO,EAAE,CACP,KAAK,CAAC,EAAE,KAAK,CAAC,UAAU,CAAC,WAAW,CAAC,GAAG,KAAK,CAAC,aAAa,CAAC,WAAW,CAAC,KACrE,IAAI,CAAC;CACX,CAAC;AAEF,KAAK,mCAAmC,GAAG;IACzC,WAAW,CAAC,EAAE,KAAK,CAAC;IACpB,OAAO,CAAC,EAAE,KAAK,CAAC;CACjB,CAAC;AAEF,KAAK,4BAA4B,GAC7B,gCAAgC,GAChC,mCAAmC,CAAC;AAExC,KAAK,uBAAuB,GAAG,6BAA6B,GAC1D,4BAA4B,CAAC;AA8O/B,QAAA,MAAM,kBAAkB,IAxHtB,QAAQ,SAAS,KAAK,CAAC,WAAW,wIAcjC,sBAAsB,CAAC,QAAQ,EAAE,uBAAuB,CAAC;iFAtCzD,WAAW,CAAC,KAAK,EAAE;QAAE,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;KAAE,CAAC;gFAnCjD,WAAW,CAAC,MAAM,EAAE;QAAE,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;KAAE,CAAC;CAsLnD,CAAC;AAEH,OAAO,EAAE,kBAAkB,EAAE,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@neo4j-ndl/react",
|
|
3
|
-
"version": "5.7.4
|
|
3
|
+
"version": "5.7.4",
|
|
4
4
|
"sideEffects": false,
|
|
5
5
|
"description": "React implementation of Neo4j Design System",
|
|
6
6
|
"keywords": [
|
|
@@ -434,7 +434,7 @@
|
|
|
434
434
|
"@tanstack/react-table": "8.21.3",
|
|
435
435
|
"react": ">=19.0.0",
|
|
436
436
|
"react-dom": ">=19.0.0",
|
|
437
|
-
"@neo4j-ndl/base": "^5.4.
|
|
437
|
+
"@neo4j-ndl/base": "^5.4.7"
|
|
438
438
|
},
|
|
439
439
|
"dependencies": {
|
|
440
440
|
"@dnd-kit/core": "6.3.1",
|
|
@@ -461,8 +461,7 @@
|
|
|
461
461
|
"temporal-polyfill": "1.0.1",
|
|
462
462
|
"tinycolor2": "1.6.0",
|
|
463
463
|
"usehooks-ts": "3.1.1",
|
|
464
|
-
"zod": "4.6.7"
|
|
465
|
-
"@neo4j-ndl/base": "5.4.6-alpha.a1435aa"
|
|
464
|
+
"zod": "4.6.7"
|
|
466
465
|
},
|
|
467
466
|
"scripts": {
|
|
468
467
|
"generate-component": "node ./scripts/component-generator.js",
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
name: ndl-react
|
|
3
3
|
metadata:
|
|
4
4
|
package: '@neo4j-ndl/react'
|
|
5
|
-
version: '5.7.4
|
|
5
|
+
version: '5.7.4'
|
|
6
6
|
description: >-
|
|
7
7
|
Build and edit UI with the Neo4j Needle React design system
|
|
8
8
|
(@neo4j-ndl/react). Use when adding, composing, or modifying Needle components
|
|
@@ -15,7 +15,7 @@ description: >-
|
|
|
15
15
|
|
|
16
16
|
# Neo4j Needle (@neo4j-ndl/react)
|
|
17
17
|
|
|
18
|
-
> π Shipped with `@neo4j-ndl/react` v5.7.4
|
|
18
|
+
> π Shipped with `@neo4j-ndl/react` v5.7.4. Once installed into your repo (e.g. via
|
|
19
19
|
> `npx skills add`) this folder is detached from the package β the installed
|
|
20
20
|
> package (TypeScript types in `node_modules/@neo4j-ndl/react`) is the source of
|
|
21
21
|
> truth.
|