@neo4j-ndl/react 5.5.3 → 5.5.5
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/cjs/banner/Banner.js
CHANGED
|
@@ -138,20 +138,19 @@ const BannerComponent = (_ref4) => {
|
|
|
138
138
|
className: classes,
|
|
139
139
|
role: isAlert ? "alert" : void 0,
|
|
140
140
|
ref
|
|
141
|
-
}, restProps), htmlAttributes), {}, { children: [
|
|
142
|
-
|
|
143
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
141
|
+
}, restProps), htmlAttributes), {}, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
142
|
+
className: "ndl-banner-content-wrapper",
|
|
143
|
+
children: [hasIcon && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(StatusIcon, { variant }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
144
144
|
className: "ndl-banner-content",
|
|
145
145
|
children
|
|
146
|
-
})
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
] }));
|
|
146
|
+
})]
|
|
147
|
+
}), isCloseable && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_clean_icon_button_CleanIconButton.CleanIconButton, {
|
|
148
|
+
size: "small",
|
|
149
|
+
onClick: handleClose,
|
|
150
|
+
description: null,
|
|
151
|
+
htmlAttributes: { "aria-label": "Close" },
|
|
152
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_icons_generated_heroIcons_XMarkIconOutline.XMarkIconOutline, {})
|
|
153
|
+
})] }));
|
|
155
154
|
};
|
|
156
155
|
const Banner = Object.assign(BannerComponent, {
|
|
157
156
|
Actions: BannerActions,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Banner.js","names":["CheckCircleIconSolid","ExclamationTriangleIconSolid","ExclamationCircleIconSolid","InformationCircleIconSolid","BoltIconOutline","classNames","Typography","CleanIconButton","XMarkIconOutline"],"sources":["../../../src/banner/Banner.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 type React 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 { CheckCircleIconSolid } from '../icons/generated/heroIcons/CheckCircleIconSolid';\nimport { ExclamationCircleIconSolid } from '../icons/generated/heroIcons/ExclamationCircleIconSolid';\nimport { ExclamationTriangleIconSolid } from '../icons/generated/heroIcons/ExclamationTriangleIconSolid';\nimport { InformationCircleIconSolid } from '../icons/generated/heroIcons/InformationCircleIconSolid';\nimport { XMarkIconOutline } from '../icons/generated/heroIcons/XMarkIconOutline';\nimport { Typography } from '../typography';\n/**\n *\n *\n * Types\n *\n *\n */\n\ntype BannerCommonProps = {\n /** Shows a status icon. The icon is based on the value of the `variant` prop */\n hasIcon?: boolean;\n\n /** Content to be shown in the banner. */\n children?: React.ReactNode;\n\n /** Sets the role to alert */\n isAlert?: boolean;\n\n /** How the banner is used. */\n usage?: 'inline' | 'global';\n\n /** The variant of the banner */\n variant?: BannerVariant;\n};\n\ntype CloseableBannerProps = {\n /** If the banner is closeable. Renders an icon button in the top right corner */\n isCloseable: true;\n\n /** Event handler for when the close icon is clicked */\n onClose: (\n event?: React.MouseEvent<HTMLElement> | React.KeyboardEvent<HTMLElement>,\n ) => void;\n};\n\ntype NonCloseableBannerProps = {\n isCloseable?: false;\n onClose?: never;\n};\n\ntype BannerCloseProps = CloseableBannerProps | NonCloseableBannerProps;\n\ntype BannerProps = BannerCommonProps & BannerCloseProps;\ntype BannerVariant = 'info' | 'success' | 'warning' | 'danger' | 'neutral';\n\nconst StatusIcon = ({ variant }: { variant: BannerVariant }) => {\n const iconComponent = (() => {\n switch (variant) {\n case 'success':\n return <CheckCircleIconSolid />;\n case 'warning':\n return <ExclamationTriangleIconSolid />;\n case 'danger':\n return <ExclamationCircleIconSolid />;\n case 'info':\n return <InformationCircleIconSolid />;\n case 'neutral':\n return <BoltIconOutline />;\n default:\n return null;\n }\n })();\n\n return <div className=\"ndl-banner-status-icon\">{iconComponent}</div>;\n};\n\nconst BannerHeader = ({\n children,\n className,\n style,\n htmlAttributes,\n ref,\n ...restProps\n}: CommonProps<'span', { children: React.ReactNode }>) => {\n const classes = classNames('ndl-banner-header', className);\n return (\n <Typography\n as=\"span\"\n variant=\"title-4\"\n className={classes}\n style={style}\n ref={ref}\n htmlAttributes={htmlAttributes}\n {...restProps}\n >\n {children}\n </Typography>\n );\n};\n\nconst BannerDescription = ({\n children,\n className,\n style,\n htmlAttributes,\n ref,\n ...restProps\n}: CommonProps<'div', { children: React.ReactNode }>) => {\n const classes = classNames('ndl-banner-description', className);\n return (\n <Typography\n as=\"div\"\n variant=\"body-medium\"\n className={classes}\n style={style}\n ref={ref}\n {...restProps}\n {...htmlAttributes}\n >\n {children}\n </Typography>\n );\n};\n\nconst BannerActions = ({\n children,\n className,\n style,\n htmlAttributes,\n ref,\n ...restProps\n}: CommonProps<'div', { children: React.ReactNode }>) => {\n const classes = classNames('ndl-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\nconst BannerComponent = <T extends React.ElementType = 'section'>({\n as,\n variant = 'info',\n hasIcon = false,\n onClose,\n className,\n children,\n isCloseable = false,\n usage = 'inline',\n htmlAttributes,\n isAlert = false,\n ref,\n ...restProps\n}: PolymorphicCommonProps<T, BannerProps>) => {\n const Element: React.ElementType = as ?? 'section';\n\n const classes = classNames('ndl-banner', className, {\n 'ndl-danger': variant === 'danger',\n 'ndl-global': usage === 'global',\n 'ndl-info': variant === 'info',\n 'ndl-inline': usage === 'inline',\n 'ndl-neutral': variant === 'neutral',\n 'ndl-success': variant === 'success',\n 'ndl-warning': variant === 'warning',\n });\n\n const handleClose = (\n event:\n | React.MouseEvent<HTMLElement, MouseEvent>\n | React.KeyboardEvent<HTMLElement>,\n ) => {\n if (onClose && typeof onClose === 'function') {\n onClose(event);\n }\n };\n\n return (\n <Element\n className={classes}\n role={isAlert ? 'alert' : undefined}\n ref={ref}\n {...restProps}\n {...htmlAttributes}\n >\n {hasIcon && <StatusIcon variant={variant} />}\n
|
|
1
|
+
{"version":3,"file":"Banner.js","names":["CheckCircleIconSolid","ExclamationTriangleIconSolid","ExclamationCircleIconSolid","InformationCircleIconSolid","BoltIconOutline","classNames","Typography","CleanIconButton","XMarkIconOutline"],"sources":["../../../src/banner/Banner.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 type React 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 { CheckCircleIconSolid } from '../icons/generated/heroIcons/CheckCircleIconSolid';\nimport { ExclamationCircleIconSolid } from '../icons/generated/heroIcons/ExclamationCircleIconSolid';\nimport { ExclamationTriangleIconSolid } from '../icons/generated/heroIcons/ExclamationTriangleIconSolid';\nimport { InformationCircleIconSolid } from '../icons/generated/heroIcons/InformationCircleIconSolid';\nimport { XMarkIconOutline } from '../icons/generated/heroIcons/XMarkIconOutline';\nimport { Typography } from '../typography';\n/**\n *\n *\n * Types\n *\n *\n */\n\ntype BannerCommonProps = {\n /** Shows a status icon. The icon is based on the value of the `variant` prop */\n hasIcon?: boolean;\n\n /** Content to be shown in the banner. */\n children?: React.ReactNode;\n\n /** Sets the role to alert */\n isAlert?: boolean;\n\n /** How the banner is used. */\n usage?: 'inline' | 'global';\n\n /** The variant of the banner */\n variant?: BannerVariant;\n};\n\ntype CloseableBannerProps = {\n /** If the banner is closeable. Renders an icon button in the top right corner */\n isCloseable: true;\n\n /** Event handler for when the close icon is clicked */\n onClose: (\n event?: React.MouseEvent<HTMLElement> | React.KeyboardEvent<HTMLElement>,\n ) => void;\n};\n\ntype NonCloseableBannerProps = {\n isCloseable?: false;\n onClose?: never;\n};\n\ntype BannerCloseProps = CloseableBannerProps | NonCloseableBannerProps;\n\ntype BannerProps = BannerCommonProps & BannerCloseProps;\ntype BannerVariant = 'info' | 'success' | 'warning' | 'danger' | 'neutral';\n\nconst StatusIcon = ({ variant }: { variant: BannerVariant }) => {\n const iconComponent = (() => {\n switch (variant) {\n case 'success':\n return <CheckCircleIconSolid />;\n case 'warning':\n return <ExclamationTriangleIconSolid />;\n case 'danger':\n return <ExclamationCircleIconSolid />;\n case 'info':\n return <InformationCircleIconSolid />;\n case 'neutral':\n return <BoltIconOutline />;\n default:\n return null;\n }\n })();\n\n return <div className=\"ndl-banner-status-icon\">{iconComponent}</div>;\n};\n\nconst BannerHeader = ({\n children,\n className,\n style,\n htmlAttributes,\n ref,\n ...restProps\n}: CommonProps<'span', { children: React.ReactNode }>) => {\n const classes = classNames('ndl-banner-header', className);\n return (\n <Typography\n as=\"span\"\n variant=\"title-4\"\n className={classes}\n style={style}\n ref={ref}\n htmlAttributes={htmlAttributes}\n {...restProps}\n >\n {children}\n </Typography>\n );\n};\n\nconst BannerDescription = ({\n children,\n className,\n style,\n htmlAttributes,\n ref,\n ...restProps\n}: CommonProps<'div', { children: React.ReactNode }>) => {\n const classes = classNames('ndl-banner-description', className);\n return (\n <Typography\n as=\"div\"\n variant=\"body-medium\"\n className={classes}\n style={style}\n ref={ref}\n {...restProps}\n {...htmlAttributes}\n >\n {children}\n </Typography>\n );\n};\n\nconst BannerActions = ({\n children,\n className,\n style,\n htmlAttributes,\n ref,\n ...restProps\n}: CommonProps<'div', { children: React.ReactNode }>) => {\n const classes = classNames('ndl-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\nconst BannerComponent = <T extends React.ElementType = 'section'>({\n as,\n variant = 'info',\n hasIcon = false,\n onClose,\n className,\n children,\n isCloseable = false,\n usage = 'inline',\n htmlAttributes,\n isAlert = false,\n ref,\n ...restProps\n}: PolymorphicCommonProps<T, BannerProps>) => {\n const Element: React.ElementType = as ?? 'section';\n\n const classes = classNames('ndl-banner', className, {\n 'ndl-danger': variant === 'danger',\n 'ndl-global': usage === 'global',\n 'ndl-info': variant === 'info',\n 'ndl-inline': usage === 'inline',\n 'ndl-neutral': variant === 'neutral',\n 'ndl-success': variant === 'success',\n 'ndl-warning': variant === 'warning',\n });\n\n const handleClose = (\n event:\n | React.MouseEvent<HTMLElement, MouseEvent>\n | React.KeyboardEvent<HTMLElement>,\n ) => {\n if (onClose && typeof onClose === 'function') {\n onClose(event);\n }\n };\n\n return (\n <Element\n className={classes}\n role={isAlert ? 'alert' : undefined}\n ref={ref}\n {...restProps}\n {...htmlAttributes}\n >\n <div className=\"ndl-banner-content-wrapper\">\n {hasIcon && <StatusIcon variant={variant} />}\n <div className=\"ndl-banner-content\">{children}</div>\n </div>\n {isCloseable && (\n <CleanIconButton\n size=\"small\"\n onClick={handleClose}\n description={null}\n htmlAttributes={{ 'aria-label': 'Close' }}\n >\n <XMarkIconOutline />\n </CleanIconButton>\n )}\n </Element>\n );\n};\n\nconst Banner = Object.assign(BannerComponent, {\n Actions: BannerActions,\n Description: BannerDescription,\n Header: BannerHeader,\n});\n\nexport { Banner };\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAsGE;CACA;CACA;CACA;CACA;;;CAoBA;CACA;CACA;CACA;CACA;;;CAoBA;CACA;CACA;CACA;CACA;;;CAkBA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;;AAtGF,MAAM,cAAc,EAAE,cAA0C;CAkB9D,OAAO,iBAAA,GAAA,kBAAA,IAAA,CAAC,OAAD;EAAK,WAAU;EAjBO,iBAAA;GAC3B,QAAQ,SAAR;IACE,KAAK,WACH,OAAO,iBAAA,GAAA,kBAAA,IAAA,CAACA,uDAAAA,sBAAD,CAAuB,CAAA;IAChC,KAAK,WACH,OAAO,iBAAA,GAAA,kBAAA,IAAA,CAACC,+DAAAA,8BAAD,CAA+B,CAAA;IACxC,KAAK,UACH,OAAO,iBAAA,GAAA,kBAAA,IAAA,CAACC,6DAAAA,4BAAD,CAA6B,CAAA;IACtC,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,CAE4D;CAAO,CAAA;AACrE;AAEA,MAAM,gBAAgB,SAOoC;CAPpC,IAAA,EACpB,UACA,WACA,OACA,gBACA,QAAA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M,UAA6B,OAAA,QAAA,OAAA,KAAA,IAAA,KAAM;CAEzC,MAAM,WAAA,GAAUA,WAAAA,QAAAA,CAAW,cAAc,WAAW;EAClD,cAAc,YAAY;EAC1B,cAAc,UAAU;EACxB,YAAY,YAAY;EACxB,cAAc,UAAU;EACxB,eAAe,YAAY;EAC3B,eAAe,YAAY;EAC3B,eAAe,YAAY;CAC7B,CAAC;CAED,MAAM,eACJ,UAGG;EACH,IAAI,WAAW,OAAO,YAAY,YAChC,QAAQ,KAAK;CAEjB;CAEA,OACE,iBAAA,GAAA,kBAAA,KAAA,CAAC,SAAA,sBAAA,QAAA,sBAAA,QAAA,sBAAA,QAAA;EACC,WAAW;EACX,MAAM,UAAU,UAAU,KAAA;EACrB;CACD,GAAA,SAAA,GACA,cAAA,GAAA,CAAA,GAAA,EAAA,UALN,CAOE,iBAAA,GAAA,kBAAA,KAAA,CAAC,OAAD;EAAK,WAAU;EAAf,UAAA,CACG,WAAW,iBAAA,GAAA,kBAAA,IAAA,CAAC,YAAD,EAAqB,QAAU,CAAA,GAC3C,iBAAA,GAAA,kBAAA,IAAA,CAAC,OAAD;GAAK,WAAU;GAAsB;EAAc,CAAA,CAChD;CACJ,CAAA,GAAA,eACC,iBAAA,GAAA,kBAAA,IAAA,CAACE,0CAAAA,iBAAD;EACE,MAAK;EACL,SAAS;EACT,aAAa;EACb,gBAAgB,EAAE,cAAc,QAAQ;EAExC,UAAA,iBAAA,GAAA,kBAAA,IAAA,CAACC,mDAAAA,kBAAD,CAAmB,CAAA;CACJ,CAAA,CAEZ,EAAA,CAAA,CAAA;AAEb;AAEA,MAAM,SAAS,OAAO,OAAO,iBAAiB;CAC5C,SAAS;CACT,aAAa;CACb,QAAQ;AACV,CAAC"}
|
|
@@ -131,20 +131,19 @@ const BannerComponent = (_ref4) => {
|
|
|
131
131
|
className: classes,
|
|
132
132
|
role: isAlert ? "alert" : void 0,
|
|
133
133
|
ref
|
|
134
|
-
}, restProps), htmlAttributes), {}, { children: [
|
|
135
|
-
|
|
136
|
-
/* @__PURE__ */ jsx("div", {
|
|
134
|
+
}, restProps), htmlAttributes), {}, { children: [/* @__PURE__ */ jsxs("div", {
|
|
135
|
+
className: "ndl-banner-content-wrapper",
|
|
136
|
+
children: [hasIcon && /* @__PURE__ */ jsx(StatusIcon, { variant }), /* @__PURE__ */ jsx("div", {
|
|
137
137
|
className: "ndl-banner-content",
|
|
138
138
|
children
|
|
139
|
-
})
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
] }));
|
|
139
|
+
})]
|
|
140
|
+
}), isCloseable && /* @__PURE__ */ jsx(CleanIconButton, {
|
|
141
|
+
size: "small",
|
|
142
|
+
onClick: handleClose,
|
|
143
|
+
description: null,
|
|
144
|
+
htmlAttributes: { "aria-label": "Close" },
|
|
145
|
+
children: /* @__PURE__ */ jsx(XMarkIconOutline, {})
|
|
146
|
+
})] }));
|
|
148
147
|
};
|
|
149
148
|
const Banner = Object.assign(BannerComponent, {
|
|
150
149
|
Actions: BannerActions,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Banner.mjs","names":[],"sources":["../../../src/banner/Banner.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 type React 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 { CheckCircleIconSolid } from '../icons/generated/heroIcons/CheckCircleIconSolid';\nimport { ExclamationCircleIconSolid } from '../icons/generated/heroIcons/ExclamationCircleIconSolid';\nimport { ExclamationTriangleIconSolid } from '../icons/generated/heroIcons/ExclamationTriangleIconSolid';\nimport { InformationCircleIconSolid } from '../icons/generated/heroIcons/InformationCircleIconSolid';\nimport { XMarkIconOutline } from '../icons/generated/heroIcons/XMarkIconOutline';\nimport { Typography } from '../typography';\n/**\n *\n *\n * Types\n *\n *\n */\n\ntype BannerCommonProps = {\n /** Shows a status icon. The icon is based on the value of the `variant` prop */\n hasIcon?: boolean;\n\n /** Content to be shown in the banner. */\n children?: React.ReactNode;\n\n /** Sets the role to alert */\n isAlert?: boolean;\n\n /** How the banner is used. */\n usage?: 'inline' | 'global';\n\n /** The variant of the banner */\n variant?: BannerVariant;\n};\n\ntype CloseableBannerProps = {\n /** If the banner is closeable. Renders an icon button in the top right corner */\n isCloseable: true;\n\n /** Event handler for when the close icon is clicked */\n onClose: (\n event?: React.MouseEvent<HTMLElement> | React.KeyboardEvent<HTMLElement>,\n ) => void;\n};\n\ntype NonCloseableBannerProps = {\n isCloseable?: false;\n onClose?: never;\n};\n\ntype BannerCloseProps = CloseableBannerProps | NonCloseableBannerProps;\n\ntype BannerProps = BannerCommonProps & BannerCloseProps;\ntype BannerVariant = 'info' | 'success' | 'warning' | 'danger' | 'neutral';\n\nconst StatusIcon = ({ variant }: { variant: BannerVariant }) => {\n const iconComponent = (() => {\n switch (variant) {\n case 'success':\n return <CheckCircleIconSolid />;\n case 'warning':\n return <ExclamationTriangleIconSolid />;\n case 'danger':\n return <ExclamationCircleIconSolid />;\n case 'info':\n return <InformationCircleIconSolid />;\n case 'neutral':\n return <BoltIconOutline />;\n default:\n return null;\n }\n })();\n\n return <div className=\"ndl-banner-status-icon\">{iconComponent}</div>;\n};\n\nconst BannerHeader = ({\n children,\n className,\n style,\n htmlAttributes,\n ref,\n ...restProps\n}: CommonProps<'span', { children: React.ReactNode }>) => {\n const classes = classNames('ndl-banner-header', className);\n return (\n <Typography\n as=\"span\"\n variant=\"title-4\"\n className={classes}\n style={style}\n ref={ref}\n htmlAttributes={htmlAttributes}\n {...restProps}\n >\n {children}\n </Typography>\n );\n};\n\nconst BannerDescription = ({\n children,\n className,\n style,\n htmlAttributes,\n ref,\n ...restProps\n}: CommonProps<'div', { children: React.ReactNode }>) => {\n const classes = classNames('ndl-banner-description', className);\n return (\n <Typography\n as=\"div\"\n variant=\"body-medium\"\n className={classes}\n style={style}\n ref={ref}\n {...restProps}\n {...htmlAttributes}\n >\n {children}\n </Typography>\n );\n};\n\nconst BannerActions = ({\n children,\n className,\n style,\n htmlAttributes,\n ref,\n ...restProps\n}: CommonProps<'div', { children: React.ReactNode }>) => {\n const classes = classNames('ndl-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\nconst BannerComponent = <T extends React.ElementType = 'section'>({\n as,\n variant = 'info',\n hasIcon = false,\n onClose,\n className,\n children,\n isCloseable = false,\n usage = 'inline',\n htmlAttributes,\n isAlert = false,\n ref,\n ...restProps\n}: PolymorphicCommonProps<T, BannerProps>) => {\n const Element: React.ElementType = as ?? 'section';\n\n const classes = classNames('ndl-banner', className, {\n 'ndl-danger': variant === 'danger',\n 'ndl-global': usage === 'global',\n 'ndl-info': variant === 'info',\n 'ndl-inline': usage === 'inline',\n 'ndl-neutral': variant === 'neutral',\n 'ndl-success': variant === 'success',\n 'ndl-warning': variant === 'warning',\n });\n\n const handleClose = (\n event:\n | React.MouseEvent<HTMLElement, MouseEvent>\n | React.KeyboardEvent<HTMLElement>,\n ) => {\n if (onClose && typeof onClose === 'function') {\n onClose(event);\n }\n };\n\n return (\n <Element\n className={classes}\n role={isAlert ? 'alert' : undefined}\n ref={ref}\n {...restProps}\n {...htmlAttributes}\n >\n {hasIcon && <StatusIcon variant={variant} />}\n
|
|
1
|
+
{"version":3,"file":"Banner.mjs","names":[],"sources":["../../../src/banner/Banner.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 type React 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 { CheckCircleIconSolid } from '../icons/generated/heroIcons/CheckCircleIconSolid';\nimport { ExclamationCircleIconSolid } from '../icons/generated/heroIcons/ExclamationCircleIconSolid';\nimport { ExclamationTriangleIconSolid } from '../icons/generated/heroIcons/ExclamationTriangleIconSolid';\nimport { InformationCircleIconSolid } from '../icons/generated/heroIcons/InformationCircleIconSolid';\nimport { XMarkIconOutline } from '../icons/generated/heroIcons/XMarkIconOutline';\nimport { Typography } from '../typography';\n/**\n *\n *\n * Types\n *\n *\n */\n\ntype BannerCommonProps = {\n /** Shows a status icon. The icon is based on the value of the `variant` prop */\n hasIcon?: boolean;\n\n /** Content to be shown in the banner. */\n children?: React.ReactNode;\n\n /** Sets the role to alert */\n isAlert?: boolean;\n\n /** How the banner is used. */\n usage?: 'inline' | 'global';\n\n /** The variant of the banner */\n variant?: BannerVariant;\n};\n\ntype CloseableBannerProps = {\n /** If the banner is closeable. Renders an icon button in the top right corner */\n isCloseable: true;\n\n /** Event handler for when the close icon is clicked */\n onClose: (\n event?: React.MouseEvent<HTMLElement> | React.KeyboardEvent<HTMLElement>,\n ) => void;\n};\n\ntype NonCloseableBannerProps = {\n isCloseable?: false;\n onClose?: never;\n};\n\ntype BannerCloseProps = CloseableBannerProps | NonCloseableBannerProps;\n\ntype BannerProps = BannerCommonProps & BannerCloseProps;\ntype BannerVariant = 'info' | 'success' | 'warning' | 'danger' | 'neutral';\n\nconst StatusIcon = ({ variant }: { variant: BannerVariant }) => {\n const iconComponent = (() => {\n switch (variant) {\n case 'success':\n return <CheckCircleIconSolid />;\n case 'warning':\n return <ExclamationTriangleIconSolid />;\n case 'danger':\n return <ExclamationCircleIconSolid />;\n case 'info':\n return <InformationCircleIconSolid />;\n case 'neutral':\n return <BoltIconOutline />;\n default:\n return null;\n }\n })();\n\n return <div className=\"ndl-banner-status-icon\">{iconComponent}</div>;\n};\n\nconst BannerHeader = ({\n children,\n className,\n style,\n htmlAttributes,\n ref,\n ...restProps\n}: CommonProps<'span', { children: React.ReactNode }>) => {\n const classes = classNames('ndl-banner-header', className);\n return (\n <Typography\n as=\"span\"\n variant=\"title-4\"\n className={classes}\n style={style}\n ref={ref}\n htmlAttributes={htmlAttributes}\n {...restProps}\n >\n {children}\n </Typography>\n );\n};\n\nconst BannerDescription = ({\n children,\n className,\n style,\n htmlAttributes,\n ref,\n ...restProps\n}: CommonProps<'div', { children: React.ReactNode }>) => {\n const classes = classNames('ndl-banner-description', className);\n return (\n <Typography\n as=\"div\"\n variant=\"body-medium\"\n className={classes}\n style={style}\n ref={ref}\n {...restProps}\n {...htmlAttributes}\n >\n {children}\n </Typography>\n );\n};\n\nconst BannerActions = ({\n children,\n className,\n style,\n htmlAttributes,\n ref,\n ...restProps\n}: CommonProps<'div', { children: React.ReactNode }>) => {\n const classes = classNames('ndl-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\nconst BannerComponent = <T extends React.ElementType = 'section'>({\n as,\n variant = 'info',\n hasIcon = false,\n onClose,\n className,\n children,\n isCloseable = false,\n usage = 'inline',\n htmlAttributes,\n isAlert = false,\n ref,\n ...restProps\n}: PolymorphicCommonProps<T, BannerProps>) => {\n const Element: React.ElementType = as ?? 'section';\n\n const classes = classNames('ndl-banner', className, {\n 'ndl-danger': variant === 'danger',\n 'ndl-global': usage === 'global',\n 'ndl-info': variant === 'info',\n 'ndl-inline': usage === 'inline',\n 'ndl-neutral': variant === 'neutral',\n 'ndl-success': variant === 'success',\n 'ndl-warning': variant === 'warning',\n });\n\n const handleClose = (\n event:\n | React.MouseEvent<HTMLElement, MouseEvent>\n | React.KeyboardEvent<HTMLElement>,\n ) => {\n if (onClose && typeof onClose === 'function') {\n onClose(event);\n }\n };\n\n return (\n <Element\n className={classes}\n role={isAlert ? 'alert' : undefined}\n ref={ref}\n {...restProps}\n {...htmlAttributes}\n >\n <div className=\"ndl-banner-content-wrapper\">\n {hasIcon && <StatusIcon variant={variant} />}\n <div className=\"ndl-banner-content\">{children}</div>\n </div>\n {isCloseable && (\n <CleanIconButton\n size=\"small\"\n onClick={handleClose}\n description={null}\n htmlAttributes={{ 'aria-label': 'Close' }}\n >\n <XMarkIconOutline />\n </CleanIconButton>\n )}\n </Element>\n );\n};\n\nconst Banner = Object.assign(BannerComponent, {\n Actions: BannerActions,\n Description: BannerDescription,\n Header: BannerHeader,\n});\n\nexport { Banner };\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAsGE;CACA;CACA;CACA;CACA;;;CAoBA;CACA;CACA;CACA;CACA;;;CAoBA;CACA;CACA;CACA;CACA;;;CAkBA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;;AAtGF,MAAM,cAAc,EAAE,cAA0C;CAkB9D,OAAO,oBAAC,OAAD;EAAK,WAAU;EAjBO,iBAAA;GAC3B,QAAQ,SAAR;IACE,K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4j-ndl/react",
|
|
3
|
-
"version": "5.5.
|
|
3
|
+
"version": "5.5.5",
|
|
4
4
|
"sideEffects": false,
|
|
5
5
|
"description": "React implementation of Neo4j Design System",
|
|
6
6
|
"keywords": [
|
|
@@ -429,7 +429,7 @@
|
|
|
429
429
|
"@tanstack/react-table": "8.21.3",
|
|
430
430
|
"react": ">=19.0.0",
|
|
431
431
|
"react-dom": ">=19.0.0",
|
|
432
|
-
"@neo4j-ndl/base": "^5.
|
|
432
|
+
"@neo4j-ndl/base": "^5.4.0"
|
|
433
433
|
},
|
|
434
434
|
"dependencies": {
|
|
435
435
|
"@dnd-kit/core": "6.3.1",
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
name: ndl-react
|
|
3
3
|
metadata:
|
|
4
4
|
package: '@neo4j-ndl/react'
|
|
5
|
-
version: '5.5.
|
|
5
|
+
version: '5.5.5'
|
|
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.5.
|
|
18
|
+
> 📌 Shipped with `@neo4j-ndl/react` v5.5.5. 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.
|