@neo4j-ndl/react 4.8.0 → 4.8.2
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 +1 -1
- package/lib/cjs/banner/Banner.js.map +1 -1
- package/lib/cjs/clean-icon-button/CleanIconButton.js +3 -1
- package/lib/cjs/clean-icon-button/CleanIconButton.js.map +1 -1
- package/lib/cjs/dialog/Dialog.js +3 -4
- package/lib/cjs/dialog/Dialog.js.map +1 -1
- package/lib/cjs/drawer/Drawer.js +2 -2
- package/lib/cjs/drawer/Drawer.js.map +1 -1
- package/lib/cjs/icon-button/IconButton.js +3 -1
- package/lib/cjs/icon-button/IconButton.js.map +1 -1
- package/lib/esm/banner/Banner.js +1 -1
- package/lib/esm/banner/Banner.js.map +1 -1
- package/lib/esm/clean-icon-button/CleanIconButton.js +3 -1
- package/lib/esm/clean-icon-button/CleanIconButton.js.map +1 -1
- package/lib/esm/dialog/Dialog.js +3 -4
- package/lib/esm/dialog/Dialog.js.map +1 -1
- package/lib/esm/drawer/Drawer.js +2 -2
- package/lib/esm/drawer/Drawer.js.map +1 -1
- package/lib/esm/icon-button/IconButton.js +3 -1
- package/lib/esm/icon-button/IconButton.js.map +1 -1
- package/lib/types/banner/Banner.d.ts.map +1 -1
- package/lib/types/clean-icon-button/CleanIconButton.d.ts.map +1 -1
- package/lib/types/dialog/Dialog.d.ts.map +1 -1
- package/lib/types/icon-button/IconButton.d.ts.map +1 -1
- package/package.json +1 -1
package/lib/cjs/banner/Banner.js
CHANGED
|
@@ -91,7 +91,7 @@ const BannerComponent = (_a) => {
|
|
|
91
91
|
onClose(e);
|
|
92
92
|
}
|
|
93
93
|
};
|
|
94
|
-
return ((0, jsx_runtime_1.jsxs)(Element, Object.assign({ className: classes, role: isAlert ? 'alert' : undefined, ref: ref }, restProps, htmlAttributes, { children: [hasIcon && (0, jsx_runtime_1.jsx)(StatusIcon, { variant: variant }), (0, jsx_runtime_1.jsx)("div", { className: "ndl-banner-content", children: children }), isCloseable && ((0, jsx_runtime_1.jsx)(clean_icon_button_1.CleanIconButton, { size: "small", onClick: handleClose, description:
|
|
94
|
+
return ((0, jsx_runtime_1.jsxs)(Element, Object.assign({ className: classes, role: isAlert ? 'alert' : undefined, ref: ref }, restProps, htmlAttributes, { children: [hasIcon && (0, jsx_runtime_1.jsx)(StatusIcon, { variant: variant }), (0, jsx_runtime_1.jsx)("div", { className: "ndl-banner-content", children: children }), isCloseable && ((0, jsx_runtime_1.jsx)(clean_icon_button_1.CleanIconButton, { size: "small", onClick: handleClose, description: null, htmlAttributes: { 'aria-label': 'Close' }, children: (0, jsx_runtime_1.jsx)(icons_1.XMarkIconOutline, {}) }))] })));
|
|
95
95
|
};
|
|
96
96
|
const Banner = Object.assign(BannerComponent, {
|
|
97
97
|
Actions: BannerActions,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Banner.js","sourceRoot":"","sources":["../../../src/banner/Banner.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,4DAAoC;AAOpC,4DAAuD;AACvD,oCAOkB;AAClB,8CAA2C;AA8C3C,MAAM,UAAU,GAAG,CAAC,EAAE,OAAO,EAA8B,EAAE,EAAE;IAC7D,MAAM,aAAa,GAAG,CAAC,GAAG,EAAE;QAC1B,QAAQ,OAAO,EAAE,CAAC;YAChB,KAAK,SAAS;gBACZ,OAAO,uBAAC,4BAAoB,KAAG,CAAC;YAClC,KAAK,SAAS;gBACZ,OAAO,uBAAC,oCAA4B,KAAG,CAAC;YAC1C,KAAK,QAAQ;gBACX,OAAO,uBAAC,kCAA0B,KAAG,CAAC;YACxC,KAAK,MAAM;gBACT,OAAO,uBAAC,kCAA0B,KAAG,CAAC;YACxC,KAAK,SAAS;gBACZ,OAAO,uBAAC,uBAAe,KAAG,CAAC;YAC7B;gBACE,OAAO,IAAI,CAAC;QAChB,CAAC;IACH,CAAC,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AO,EAAE,aAAa;IACtB,WAAW,EAAE,iBAAiB;IAC9B,MAAM,EAAE,YAAY;CACrB,CAAC,CAAC;AAEM,wBAAM","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 {\n BoltIconOutline,\n CheckCircleIconSolid,\n ExclamationCircleIconSolid,\n ExclamationTriangleIconSolid,\n InformationCircleIconSolid,\n XMarkIconOutline,\n} from '../icons';\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 or alertdialog, based on the value of `isCloseable` */\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 e?: 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 e:\n | React.MouseEvent<HTMLElement, MouseEvent>\n | React.KeyboardEvent<HTMLElement>,\n ) => {\n if (onClose && typeof onClose === 'function') {\n onClose(e);\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 <div className=\"ndl-banner-content\">{children}</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"]}
|
|
@@ -36,7 +36,9 @@ exports.CleanIconButton = void 0;
|
|
|
36
36
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
37
37
|
const icon_button_base_1 = require("../icon-button-base");
|
|
38
38
|
const CleanIconButton = (_a) => {
|
|
39
|
-
var { children, as, isLoading = false, isDisabled = false, size = 'medium',
|
|
39
|
+
var { children, as, isLoading = false, isDisabled = false, size = 'medium',
|
|
40
|
+
// Does not have a default value to avoid setting aria-pressed to true if not explicitly set
|
|
41
|
+
isActive, variant = 'neutral', description, tooltipProps, className, style, htmlAttributes, onClick, ref } = _a, restProps = __rest(_a, ["children", "as", "isLoading", "isDisabled", "size", "isActive", "variant", "description", "tooltipProps", "className", "style", "htmlAttributes", "onClick", "ref"]);
|
|
40
42
|
return ((0, jsx_runtime_1.jsx)(icon_button_base_1.IconButtonBase, Object.assign({ as: as, iconButtonVariant: "clean", isDisabled: isDisabled, size: size, isLoading: isLoading, isActive: isActive, variant: variant, description: description, tooltipProps: tooltipProps, className: className, style: style, htmlAttributes: htmlAttributes, onClick: onClick, ref: ref }, restProps, { children: children })));
|
|
41
43
|
};
|
|
42
44
|
exports.CleanIconButton = CleanIconButton;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CleanIconButton.js","sourceRoot":"","sources":["../../../src/clean-icon-button/CleanIconButton.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;AAuBA,0DAA+E;AAOxE,MAAM,eAAe,GAAG,CAAyC,
|
|
1
|
+
{"version":3,"file":"CleanIconButton.js","sourceRoot":"","sources":["../../../src/clean-icon-button/CleanIconButton.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;AAuBA,0DAA+E;AAOxE,MAAM,eAAe,GAAG,CAAyC,EAiBhB,EAAE,EAAE;QAjBY,EACtE,QAAQ,EACR,EAAE,EACF,SAAS,GAAG,KAAK,EACjB,UAAU,GAAG,KAAK,EAClB,IAAI,GAAG,QAAQ;IACf,4FAA4F;IAC5F,QAAQ,EACR,OAAO,GAAG,SAAS,EACnB,WAAW,EACX,YAAY,EACZ,SAAS,EACT,KAAK,EACL,cAAc,EACd,OAAO,EACP,GAAG,OAEmD,EADnD,SAAS,cAhB0D,qKAiBvE,CADa;IAEZ,OAAO,CACL,uBAAC,iCAAc,kBACb,EAAE,EAAE,EAAE,EACN,iBAAiB,EAAC,OAAO,EACzB,UAAU,EAAE,UAAU,EACtB,IAAI,EAAE,IAAI,EACV,SAAS,EAAE,SAAS,EACpB,QAAQ,EAAE,QAAQ,EAClB,OAAO,EAAE,OAAO,EAChB,WAAW,EAAE,WAAW,EACxB,YAAY,EAAE,YAAY,EAC1B,SAAS,EAAE,SAAS,EACpB,KAAK,EAAE,KAAK,EACZ,cAAc,EAAE,cAAc,EAC9B,OAAO,EAAE,OAAO,EAChB,GAAG,EAAE,GAAG,IACJ,SAAS,cAEZ,QAAQ,IACM,CAClB,CAAC;AACJ,CAAC,CAAC;AAvCW,QAAA,eAAe,mBAuC1B","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 type React from 'react';\n\nimport { type PolymorphicCommonProps } from '../_common/types';\nimport { IconButtonBase, type IconButtonBaseProps } from '../icon-button-base';\n\ntype CleanIconButtonButtonProps = Omit<\n IconButtonBaseProps,\n 'iconButtonVariant' | 'isFloating'\n>;\n\nexport const CleanIconButton = <T extends React.ElementType = 'button'>({\n children,\n as,\n isLoading = false,\n isDisabled = false,\n size = 'medium',\n // Does not have a default value to avoid setting aria-pressed to true if not explicitly set\n isActive,\n variant = 'neutral',\n description,\n tooltipProps,\n className,\n style,\n htmlAttributes,\n onClick,\n ref,\n ...restProps\n}: PolymorphicCommonProps<T, CleanIconButtonButtonProps>) => {\n return (\n <IconButtonBase\n as={as}\n iconButtonVariant=\"clean\"\n isDisabled={isDisabled}\n size={size}\n isLoading={isLoading}\n isActive={isActive}\n variant={variant}\n description={description}\n tooltipProps={tooltipProps}\n className={className}\n style={style}\n htmlAttributes={htmlAttributes}\n onClick={onClick}\n ref={ref}\n {...restProps}\n >\n {children}\n </IconButtonBase>\n );\n};\n"]}
|
package/lib/cjs/dialog/Dialog.js
CHANGED
|
@@ -128,10 +128,9 @@ const DialogComponent = (_a) => {
|
|
|
128
128
|
headerId,
|
|
129
129
|
setHeaderId,
|
|
130
130
|
variant,
|
|
131
|
-
}, children: [!hasDisabledCloseButton && ((0, jsx_runtime_1.jsx)(clean_icon_button_1.CleanIconButton, { size: "medium", className: "ndl-dialog-close", onClick: handleCloseClick, description:
|
|
132
|
-
'
|
|
133
|
-
|
|
134
|
-
}, children: (0, jsx_runtime_1.jsx)(icons_1.XMarkIconOutline, {}) })), (0, jsx_runtime_1.jsxs)("div", { className: "ndl-dialog-content-wrapper", children: [variant && ((0, jsx_runtime_1.jsx)("div", { className: `ndl-dialog-type-icon ndl-${variant}`, "data-testid": "ndl-dialog-type-icon", children: typeIcons[variant] })), (0, jsx_runtime_1.jsx)("div", { className: "n-flex n-flex-col n-flex-1 n-w-full", children: children })] })] }) })));
|
|
131
|
+
}, children: [!hasDisabledCloseButton && ((0, jsx_runtime_1.jsx)(clean_icon_button_1.CleanIconButton, { size: "medium", className: "ndl-dialog-close", onClick: handleCloseClick, description: null, htmlAttributes: {
|
|
132
|
+
'aria-label': 'Close',
|
|
133
|
+
}, children: (0, jsx_runtime_1.jsx)(icons_1.XMarkIconOutline, {}) })), (0, jsx_runtime_1.jsxs)("div", { className: "ndl-dialog-content-wrapper", children: [variant && ((0, jsx_runtime_1.jsx)("div", { className: `ndl-dialog-type-icon ndl-${variant}`, children: typeIcons[variant] })), (0, jsx_runtime_1.jsx)("div", { className: "n-flex n-flex-col n-flex-1 n-w-full", children: children })] })] }) })));
|
|
135
134
|
};
|
|
136
135
|
const Actions = (_a) => {
|
|
137
136
|
var { as, children, className, style, htmlAttributes, ref } = _a, restProps = __rest(_a, ["as", "children", "className", "style", "htmlAttributes", "ref"]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Dialog.js","sourceRoot":"","sources":["../../../src/dialog/Dialog.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,4DAAoC;AACpC,+CAA0D;AAO1D,4DAAuD;AACvD,oDAAgD;AAChD,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,kBAAkB,EAAE,SAAS,CAAC,CAAC;IAE1D,OAAO,CACL,8CACE,GAAG,EAAE,GAAG,EACR,GAAG,EAAE,GAAG,EACR,SAAS,EAAE,OAAO,EAClB,KAAK,EAAE,KAAK,EACZ,GAAG,EAAE,GAAG,IACJ,SAAS,EACT,cAAc,EAClB,CACH,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,eAAe,EAAE;IAC5C,OAAO;IACP,OAAO;IACP,WAAW;IACX,MAAM;IACN,KAAK;IACL,QAAQ;CACT,CAAC,CAAC;AAEM,wBAAM","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, { useEffect, useId, useState } from 'react';\n\nimport {\n type CommonProps,\n type PolymorphicCommonProps,\n} from '../_common/types';\nimport { type ButtonBase } from '../button';\nimport { CleanIconButton } from '../clean-icon-button';\nimport { FilledButton } from '../filled-button';\nimport {\n ExclamationCircleIconOutline,\n ExclamationTriangleIconOutline,\n InformationCircleIconOutline,\n XMarkIconOutline,\n} from '../icons';\nimport { Modal, ModalCloseReason } from '../modal';\nimport { OutlinedButton } from '../outlined-button';\nimport { TextButton } from '../text-button';\nimport { Typography } from '../typography';\nimport { DialogContext, useDialogContext } from './dialog-context';\nimport {\n type DialogActionsProps,\n DialogCloseReason,\n type DialogContentProps,\n type DialogDescriptionProps,\n type DialogHeaderProps,\n type DialogImageProps,\n type DialogProps,\n type DialogSubtitleProps,\n} from './dialog-types';\n\nconst convertCloseReason = (reason: ModalCloseReason): DialogCloseReason => {\n const dialogReason = reason as unknown as DialogCloseReason;\n if (Object.values(DialogCloseReason).includes(dialogReason)) {\n return dialogReason;\n }\n\n throw new Error(`Unknown reason '${reason}' received from popup`);\n};\n/* Stroke width on regular icons is 1.5px */\nconst typeIcons: Record<\n NonNullable<React.ComponentProps<typeof Dialog>['variant']>,\n React.ReactNode\n> = {\n danger: <ExclamationCircleIconOutline htmlAttributes={{ strokeWidth: 3 }} />,\n info: <InformationCircleIconOutline htmlAttributes={{ strokeWidth: 3 }} />,\n warning: (\n <ExclamationTriangleIconOutline htmlAttributes={{ strokeWidth: 3 }} />\n ),\n};\n\nconst DialogComponent = ({\n isOpen,\n onClose,\n children,\n variant,\n size,\n container,\n rootProps,\n hasDisabledCloseButton = false,\n htmlAttributes,\n className,\n style,\n ref,\n ...restProps\n}: CommonProps<'div', DialogProps>) => {\n const id = useId();\n const [headerId, setHeaderId] = useState<string | undefined>(id);\n\n const handleCloseClick = (e: React.MouseEvent<HTMLButtonElement>) => {\n e.preventDefault();\n onClose?.(e, DialogCloseReason.CLOSE_BUTTON_CLICK);\n };\n\n const handleClose = (\n e: React.MouseEvent<HTMLElement> | React.KeyboardEvent<HTMLElement>,\n reason?: ModalCloseReason,\n ) => {\n // Dialog should not be closed when backdrop is clicked\n if (reason === ModalCloseReason.BACKDROP_CLICK) {\n return;\n }\n\n onClose?.(e, reason !== undefined ? convertCloseReason(reason) : undefined);\n };\n\n const hasHeaderChild = React.useMemo(() => {\n const childrenArray = React.Children.toArray(children);\n return childrenArray.some(\n (child) => React.isValidElement(child) && child.type === Header,\n );\n }, [children]);\n\n const ariaLabelledBy =\n htmlAttributes?.['aria-labelledby'] ??\n (hasHeaderChild ? headerId : undefined);\n\n if (!isOpen) {\n return null;\n }\n\n if (htmlAttributes?.['aria-label'] === undefined && !ariaLabelledBy) {\n console.warn(\n 'The Dialog is missing aria-label and Header. Please add one of them for accessibility.',\n );\n }\n\n const classes = classNames('ndl-dialog', className, {\n 'ndl-with-close-button': !hasDisabledCloseButton,\n 'ndl-with-icon': !!variant,\n });\n\n return (\n <Modal\n isOpen={isOpen}\n onClose={handleClose}\n container={container}\n rootProps={rootProps}\n size={size}\n htmlAttributes={{\n ...htmlAttributes,\n 'aria-labelledby': ariaLabelledBy,\n }}\n className={classes}\n style={style}\n ref={ref}\n {...restProps}\n >\n <DialogContext.Provider\n value={{\n headerId,\n setHeaderId,\n variant,\n }}\n >\n {!hasDisabledCloseButton && (\n <CleanIconButton\n size=\"medium\"\n className=\"ndl-dialog-close\"\n onClick={handleCloseClick}\n description=\"Close\"\n htmlAttributes={{\n 'data-testid': 'ndl-dialog-close',\n role: 'button',\n }}\n >\n <XMarkIconOutline />\n </CleanIconButton>\n )}\n <div className=\"ndl-dialog-content-wrapper\">\n {variant && (\n <div\n className={`ndl-dialog-type-icon ndl-${variant}`}\n data-testid=\"ndl-dialog-type-icon\"\n >\n {typeIcons[variant]}\n </div>\n )}\n <div className=\"n-flex n-flex-col n-flex-1 n-w-full\">{children}</div>\n </div>\n </DialogContext.Provider>\n </Modal>\n );\n};\n\nconst Actions = <T extends React.ElementType = 'div'>({\n as,\n children,\n className,\n style,\n htmlAttributes,\n ref,\n ...restProps\n}: PolymorphicCommonProps<T, DialogActionsProps>) => {\n const { variant } = useDialogContext();\n const classes = classNames('ndl-dialog-actions', className);\n const Component: React.ElementType = as ?? 'div';\n\n let childrenToRender = children;\n\n // For danger dialogs, we want to convert primary buttons to danger buttons by default\n if (variant === 'danger') {\n childrenToRender = React.Children.map(children, (element) => {\n if (!React.isValidElement(element)) {\n return;\n }\n if (\n element.type === OutlinedButton ||\n element.type === FilledButton ||\n element.type === TextButton\n ) {\n const buttonElement = element as React.ReactElement<\n React.ComponentProps<typeof ButtonBase>\n >;\n\n if (\n buttonElement.props.variant === 'primary' ||\n buttonElement.props.variant === undefined\n ) {\n return React.cloneElement(buttonElement, {\n ...buttonElement.props,\n variant: 'danger',\n });\n }\n }\n return element;\n });\n }\n\n return (\n <Component\n className={classes}\n style={style}\n ref={ref}\n {...restProps}\n {...htmlAttributes}\n >\n {childrenToRender}\n </Component>\n );\n};\n\nconst Header = <T extends React.ElementType = 'span'>({\n as,\n children,\n className,\n style,\n htmlAttributes,\n ref,\n ...restProps\n}: PolymorphicCommonProps<T, DialogHeaderProps>) => {\n const { headerId, setHeaderId } = useDialogContext();\n const classes = classNames('ndl-dialog-header', className);\n const Component: React.ElementType = as ?? 'span';\n\n useEffect(() => {\n if (Boolean(htmlAttributes?.id) === true) {\n setHeaderId?.(htmlAttributes?.id);\n }\n }, [htmlAttributes?.id, setHeaderId]);\n\n return (\n <Typography\n as={Component}\n className={classes}\n ref={ref}\n style={style}\n variant=\"title-2\"\n {...restProps}\n htmlAttributes={{ ...htmlAttributes, id: headerId }}\n >\n {children}\n </Typography>\n );\n};\n\nconst Subtitle = <T extends React.ElementType = 'div'>({\n as,\n children,\n className,\n style,\n htmlAttributes,\n ref,\n ...restProps\n}: PolymorphicCommonProps<T, DialogSubtitleProps>) => {\n const classes = classNames('ndl-dialog-subtitle', className);\n const Component: React.ElementType = as ?? 'div';\n\n return (\n <Component\n className={classes}\n style={style}\n ref={ref}\n {...restProps}\n {...htmlAttributes}\n >\n {children}\n </Component>\n );\n};\n\nconst Description = <T extends React.ElementType = 'div'>({\n as,\n children,\n className,\n style,\n htmlAttributes,\n ref,\n ...restProps\n}: PolymorphicCommonProps<T, DialogDescriptionProps>) => {\n const classes = classNames('ndl-dialog-description', className);\n const Component: React.ElementType = as ?? 'div';\n\n return (\n <Component\n className={classes}\n style={style}\n ref={ref}\n {...restProps}\n {...htmlAttributes}\n >\n {children}\n </Component>\n );\n};\n\nconst Content = <T extends React.ElementType = 'div'>({\n as,\n children,\n className,\n style,\n htmlAttributes,\n ref,\n ...restProps\n}: PolymorphicCommonProps<T, DialogContentProps>) => {\n const classes = classNames('ndl-dialog-content', className);\n const Component: React.ElementType = as ?? 'div';\n\n return (\n <Component\n className={classes}\n style={style}\n ref={ref}\n {...restProps}\n {...htmlAttributes}\n >\n {children}\n </Component>\n );\n};\n\nconst Image = ({\n src,\n alt,\n className,\n style,\n htmlAttributes,\n ref,\n ...restProps\n}: CommonProps<'img', DialogImageProps>) => {\n const classes = classNames('ndl-dialog-image', className);\n\n return (\n <img\n src={src}\n alt={alt}\n className={classes}\n style={style}\n ref={ref}\n {...restProps}\n {...htmlAttributes}\n />\n );\n};\n\nconst Dialog = Object.assign(DialogComponent, {\n Actions,\n Content,\n Description,\n Header,\n Image,\n Subtitle,\n});\n\nexport { Dialog };\n"]}
|
|
1
|
+
{"version":3,"file":"Dialog.js","sourceRoot":"","sources":["../../../src/dialog/Dialog.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,4DAAoC;AACpC,+CAA0D;AAO1D,4DAAuD;AACvD,oDAAgD;AAChD,oCAKkB;AAClB,oCAAmD;AACnD,wDAAoD;AACpD,gDAA4C;AAC5C,8CAA2C;AAC3C,qDAAmE;AACnE,iDASwB;AAExB,MAAM,kBAAkB,GAAG,CAAC,MAAwB,EAAqB,EAAE;IACzE,MAAM,YAAY,GAAG,MAAsC,CAAC;IAC5D,IAAI,MAAM,CAAC,MAAM,CAAC,gCAAiB,CAAC,CAAC,QAAQ,CAAC,YAAY,CAAC,EAAE,CAAC;QAC5D,OAAO,YAAY,CAAC;IACtB,CAAC;IAED,MAAM,IAAI,KAAK,CAAC,mBAAmB,MAAM,uBAAuB,CAAC,CAAC;AACpE,CAAC,CAAC;AACF,4CAA4C;AAC5C,MAAM,SAAS,GAGX;IACF,MAAM,EAAE,uBAAC,oCAA4B,IAAC,cAAc,EAAE,EAAE,WAAW,EAAE,CAAC,EAAE,GAAI;IAC5E,IAAI,EAAE,uBAAC,oCAA4B,IAAC,cAAc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AQ,EACR,SAAS,EACT,KAAK,EACL,cAAc,EACd,GAAG,OAE2C,EAD3C,SAAS,cAPwC,iEAQrD,CADa;IAEZ,MAAM,OAAO,GAAG,IAAA,oBAAU,EAAC,oBAAoB,EAAE,SAAS,CAAC,CAAC;IAC5D,MAAM,SAAS,GAAsB,EAAE,aAAF,EAAE,cAAF,EAAE,GAAI,KAAK,CAAC;IAEjD,OAAO,CACL,uBAAC,SAAS,kBACR,SAAS,EAAE,OAAO,EAClB,KAAK,EAAE,KAAK,EACZ,GAAG,EAAE,GAAG,IACJ,SAAS,EACT,cAAc,cAEjB,QAAQ,IACC,CACb,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,KAAK,GAAG,CAAC,EAQwB,EAAE,EAAE;QAR5B,EACb,GAAG,EACH,GAAG,EACH,SAAS,EACT,KAAK,EACL,cAAc,EACd,GAAG,OAEkC,EADlC,SAAS,cAPC,6DAQd,CADa;IAEZ,MAAM,OAAO,GAAG,IAAA,oBAAU,EAAC,kBAAkB,EAAE,SAAS,CAAC,CAAC;IAE1D,OAAO,CACL,8CACE,GAAG,EAAE,GAAG,EACR,GAAG,EAAE,GAAG,EACR,SAAS,EAAE,OAAO,EAClB,KAAK,EAAE,KAAK,EACZ,GAAG,EAAE,GAAG,IACJ,SAAS,EACT,cAAc,EAClB,CACH,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,eAAe,EAAE;IAC5C,OAAO;IACP,OAAO;IACP,WAAW;IACX,MAAM;IACN,KAAK;IACL,QAAQ;CACT,CAAC,CAAC;AAEM,wBAAM","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, { useEffect, useId, useState } from 'react';\n\nimport {\n type CommonProps,\n type PolymorphicCommonProps,\n} from '../_common/types';\nimport { type ButtonBase } from '../button';\nimport { CleanIconButton } from '../clean-icon-button';\nimport { FilledButton } from '../filled-button';\nimport {\n ExclamationCircleIconOutline,\n ExclamationTriangleIconOutline,\n InformationCircleIconOutline,\n XMarkIconOutline,\n} from '../icons';\nimport { Modal, ModalCloseReason } from '../modal';\nimport { OutlinedButton } from '../outlined-button';\nimport { TextButton } from '../text-button';\nimport { Typography } from '../typography';\nimport { DialogContext, useDialogContext } from './dialog-context';\nimport {\n type DialogActionsProps,\n DialogCloseReason,\n type DialogContentProps,\n type DialogDescriptionProps,\n type DialogHeaderProps,\n type DialogImageProps,\n type DialogProps,\n type DialogSubtitleProps,\n} from './dialog-types';\n\nconst convertCloseReason = (reason: ModalCloseReason): DialogCloseReason => {\n const dialogReason = reason as unknown as DialogCloseReason;\n if (Object.values(DialogCloseReason).includes(dialogReason)) {\n return dialogReason;\n }\n\n throw new Error(`Unknown reason '${reason}' received from popup`);\n};\n/* Stroke width on regular icons is 1.5px */\nconst typeIcons: Record<\n NonNullable<React.ComponentProps<typeof Dialog>['variant']>,\n React.ReactNode\n> = {\n danger: <ExclamationCircleIconOutline htmlAttributes={{ strokeWidth: 3 }} />,\n info: <InformationCircleIconOutline htmlAttributes={{ strokeWidth: 3 }} />,\n warning: (\n <ExclamationTriangleIconOutline htmlAttributes={{ strokeWidth: 3 }} />\n ),\n};\n\nconst DialogComponent = ({\n isOpen,\n onClose,\n children,\n variant,\n size,\n container,\n rootProps,\n hasDisabledCloseButton = false,\n htmlAttributes,\n className,\n style,\n ref,\n ...restProps\n}: CommonProps<'div', DialogProps>) => {\n const id = useId();\n const [headerId, setHeaderId] = useState<string | undefined>(id);\n\n const handleCloseClick = (e: React.MouseEvent<HTMLButtonElement>) => {\n e.preventDefault();\n onClose?.(e, DialogCloseReason.CLOSE_BUTTON_CLICK);\n };\n\n const handleClose = (\n e: React.MouseEvent<HTMLElement> | React.KeyboardEvent<HTMLElement>,\n reason?: ModalCloseReason,\n ) => {\n // Dialog should not be closed when backdrop is clicked\n if (reason === ModalCloseReason.BACKDROP_CLICK) {\n return;\n }\n\n onClose?.(e, reason !== undefined ? convertCloseReason(reason) : undefined);\n };\n\n const hasHeaderChild = React.useMemo(() => {\n const childrenArray = React.Children.toArray(children);\n return childrenArray.some(\n (child) => React.isValidElement(child) && child.type === Header,\n );\n }, [children]);\n\n const ariaLabelledBy =\n htmlAttributes?.['aria-labelledby'] ??\n (hasHeaderChild ? headerId : undefined);\n\n if (!isOpen) {\n return null;\n }\n\n if (htmlAttributes?.['aria-label'] === undefined && !ariaLabelledBy) {\n console.warn(\n 'The Dialog is missing aria-label and Header. Please add one of them for accessibility.',\n );\n }\n\n const classes = classNames('ndl-dialog', className, {\n 'ndl-with-close-button': !hasDisabledCloseButton,\n 'ndl-with-icon': !!variant,\n });\n\n return (\n <Modal\n isOpen={isOpen}\n onClose={handleClose}\n container={container}\n rootProps={rootProps}\n size={size}\n htmlAttributes={{\n ...htmlAttributes,\n 'aria-labelledby': ariaLabelledBy,\n }}\n className={classes}\n style={style}\n ref={ref}\n {...restProps}\n >\n <DialogContext.Provider\n value={{\n headerId,\n setHeaderId,\n variant,\n }}\n >\n {!hasDisabledCloseButton && (\n <CleanIconButton\n size=\"medium\"\n className=\"ndl-dialog-close\"\n onClick={handleCloseClick}\n description={null}\n htmlAttributes={{\n 'aria-label': 'Close',\n }}\n >\n <XMarkIconOutline />\n </CleanIconButton>\n )}\n <div className=\"ndl-dialog-content-wrapper\">\n {variant && (\n <div className={`ndl-dialog-type-icon ndl-${variant}`}>\n {typeIcons[variant]}\n </div>\n )}\n <div className=\"n-flex n-flex-col n-flex-1 n-w-full\">{children}</div>\n </div>\n </DialogContext.Provider>\n </Modal>\n );\n};\n\nconst Actions = <T extends React.ElementType = 'div'>({\n as,\n children,\n className,\n style,\n htmlAttributes,\n ref,\n ...restProps\n}: PolymorphicCommonProps<T, DialogActionsProps>) => {\n const { variant } = useDialogContext();\n const classes = classNames('ndl-dialog-actions', className);\n const Component: React.ElementType = as ?? 'div';\n\n let childrenToRender = children;\n\n // For danger dialogs, we want to convert primary buttons to danger buttons by default\n if (variant === 'danger') {\n childrenToRender = React.Children.map(children, (element) => {\n if (!React.isValidElement(element)) {\n return;\n }\n if (\n element.type === OutlinedButton ||\n element.type === FilledButton ||\n element.type === TextButton\n ) {\n const buttonElement = element as React.ReactElement<\n React.ComponentProps<typeof ButtonBase>\n >;\n\n if (\n buttonElement.props.variant === 'primary' ||\n buttonElement.props.variant === undefined\n ) {\n return React.cloneElement(buttonElement, {\n ...buttonElement.props,\n variant: 'danger',\n });\n }\n }\n return element;\n });\n }\n\n return (\n <Component\n className={classes}\n style={style}\n ref={ref}\n {...restProps}\n {...htmlAttributes}\n >\n {childrenToRender}\n </Component>\n );\n};\n\nconst Header = <T extends React.ElementType = 'span'>({\n as,\n children,\n className,\n style,\n htmlAttributes,\n ref,\n ...restProps\n}: PolymorphicCommonProps<T, DialogHeaderProps>) => {\n const { headerId, setHeaderId } = useDialogContext();\n const classes = classNames('ndl-dialog-header', className);\n const Component: React.ElementType = as ?? 'span';\n\n useEffect(() => {\n if (Boolean(htmlAttributes?.id) === true) {\n setHeaderId?.(htmlAttributes?.id);\n }\n }, [htmlAttributes?.id, setHeaderId]);\n\n return (\n <Typography\n as={Component}\n className={classes}\n ref={ref}\n style={style}\n variant=\"title-2\"\n {...restProps}\n htmlAttributes={{ ...htmlAttributes, id: headerId }}\n >\n {children}\n </Typography>\n );\n};\n\nconst Subtitle = <T extends React.ElementType = 'div'>({\n as,\n children,\n className,\n style,\n htmlAttributes,\n ref,\n ...restProps\n}: PolymorphicCommonProps<T, DialogSubtitleProps>) => {\n const classes = classNames('ndl-dialog-subtitle', className);\n const Component: React.ElementType = as ?? 'div';\n\n return (\n <Component\n className={classes}\n style={style}\n ref={ref}\n {...restProps}\n {...htmlAttributes}\n >\n {children}\n </Component>\n );\n};\n\nconst Description = <T extends React.ElementType = 'div'>({\n as,\n children,\n className,\n style,\n htmlAttributes,\n ref,\n ...restProps\n}: PolymorphicCommonProps<T, DialogDescriptionProps>) => {\n const classes = classNames('ndl-dialog-description', className);\n const Component: React.ElementType = as ?? 'div';\n\n return (\n <Component\n className={classes}\n style={style}\n ref={ref}\n {...restProps}\n {...htmlAttributes}\n >\n {children}\n </Component>\n );\n};\n\nconst Content = <T extends React.ElementType = 'div'>({\n as,\n children,\n className,\n style,\n htmlAttributes,\n ref,\n ...restProps\n}: PolymorphicCommonProps<T, DialogContentProps>) => {\n const classes = classNames('ndl-dialog-content', className);\n const Component: React.ElementType = as ?? 'div';\n\n return (\n <Component\n className={classes}\n style={style}\n ref={ref}\n {...restProps}\n {...htmlAttributes}\n >\n {children}\n </Component>\n );\n};\n\nconst Image = ({\n src,\n alt,\n className,\n style,\n htmlAttributes,\n ref,\n ...restProps\n}: CommonProps<'img', DialogImageProps>) => {\n const classes = classNames('ndl-dialog-image', className);\n\n return (\n <img\n src={src}\n alt={alt}\n className={classes}\n style={style}\n ref={ref}\n {...restProps}\n {...htmlAttributes}\n />\n );\n};\n\nconst Dialog = Object.assign(DialogComponent, {\n Actions,\n Content,\n Description,\n Header,\n Image,\n Subtitle,\n});\n\nexport { Dialog };\n"]}
|
package/lib/cjs/drawer/Drawer.js
CHANGED
|
@@ -61,8 +61,8 @@ const DrawerComponent = function DrawerComponent(_a) {
|
|
|
61
61
|
const resizableStylePosition = type === 'overlay' ? 'absolute' : 'relative';
|
|
62
62
|
const shouldRenderInPortal = isPortaled && type === 'overlay';
|
|
63
63
|
const Component = as !== null && as !== void 0 ? as : 'div';
|
|
64
|
-
const Close = () => ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: isCloseable && ((0, jsx_runtime_1.jsx)(clean_icon_button_1.CleanIconButton, { className: "ndl-drawer-close-button", onClick: setOnExpandedChange, description:
|
|
65
|
-
|
|
64
|
+
const Close = () => ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: isCloseable && ((0, jsx_runtime_1.jsx)(clean_icon_button_1.CleanIconButton, { className: "ndl-drawer-close-button", onClick: setOnExpandedChange, description: null, size: "medium", htmlAttributes: {
|
|
65
|
+
'aria-label': 'Close',
|
|
66
66
|
}, children: (0, jsx_runtime_1.jsx)(icons_1.XMarkIconOutline, {}) })) }));
|
|
67
67
|
if (isResizeable) {
|
|
68
68
|
return ((0, jsx_runtime_1.jsx)(conditional_wrap_1.ConditionalWrap, { shouldWrap: shouldRenderInPortal, wrap: (wrapChildren) => ((0, jsx_runtime_1.jsx)(react_1.FloatingPortal, Object.assign({ preserveTabOrder: true }, portalProps, { children: wrapChildren }))), children: (0, jsx_runtime_1.jsxs)(re_resizable_1.Resizable, Object.assign({ as: Component, defaultSize: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Drawer.js","sourceRoot":"","sources":["../../../src/drawer/Drawer.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,8CAAoD;AACpD,4DAAoC;AACpC,+CAA8D;AAE9D,iCAAyD;AAMzD,4DAAuD;AACvD,0DAAsD;AACtD,oCAA4C;AAC5C,8CAA2C;AA4C3C,MAAM,eAAe,GAAG,SAAS,eAAe,CAE9C,EAiBuC;QAjBvC,EACA,QAAQ,EACR,SAAS,GAAG,EAAE,EACd,UAAU,EACV,gBAAgB,EAChB,QAAQ,GAAG,MAAM,EACjB,IAAI,GAAG,SAAS,EAChB,YAAY,GAAG,KAAK,EACpB,eAAe,EACf,WAAW,GAAG,IAAI,EAClB,UAAU,GAAG,KAAK,EAClB,WAAW,GAAG,EAAE,E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AAQ,IACL,GACF,CACP,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,eAAe,EAAE;IAC5C,OAAO,EAAE,aAAa;IACtB,IAAI,EAAE,UAAU;IAChB,MAAM,EAAE,YAAY;CACrB,CAAC,CAAC;AAEM,wBAAM","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 { FloatingPortal } from '@floating-ui/react';\nimport classNames from 'classnames';\nimport { Resizable, type ResizableProps } from 're-resizable';\nimport type React from 'react';\nimport { type ComponentProps, useCallback } from 'react';\n\nimport {\n type HtmlAttributes,\n type PolymorphicCommonProps,\n} from '../_common/types';\nimport { CleanIconButton } from '../clean-icon-button';\nimport { ConditionalWrap } from '../conditional-wrap';\nimport { XMarkIconOutline } from '../icons';\nimport { Typography } from '../typography';\n\ntype DrawerPosition = 'left' | 'right';\n\ntype DrawerType = 'overlay' | 'push';\n\ntype DrawerProps = {\n /** Controls whether the drawer is open (expanded) or closed (collapsed). */\n isExpanded: boolean;\n\n /** Callback functions fired when the drawer's expanded state changes. */\n onExpandedChange?: (expanded: boolean) => void;\n\n /** Position where the drawer appears on screen. By default, it appears from the left. */\n position?: DrawerPosition;\n\n /** How the drawer affects the layout of sibling content. By default, it overlays content. */\n type?: DrawerType;\n\n /** Enables horizontal resizing of the drawer, by default it is not resizable. */\n isResizeable?: boolean;\n\n /** To use this prop the isResizeable prop must be set to true. For overriding the third party library props: https://github.com/bokuweb/re-resizable */\n resizeableProps?: ResizableProps;\n\n /** Whether a close button (X) is displayed in the drawer. */\n isCloseable?: boolean;\n\n /** Whether to portal the content */\n isPortaled?: boolean;\n\n /** The content to display within the drawer. */\n children: React.ReactNode;\n\n /** Additional CSS classes to apply to the drawer container. */\n className?: string;\n\n /**\n * Props to pass to the portal from @floating-ui/react FloatingPortal\n * @see https://floating-ui.com/docs/floatingportal\n */\n portalProps?: ComponentProps<typeof FloatingPortal>;\n};\n\nconst DrawerComponent = function DrawerComponent<\n T extends React.ElementType = 'div',\n>({\n children,\n className = '',\n isExpanded,\n onExpandedChange,\n position = 'left',\n type = 'overlay',\n isResizeable = false,\n resizeableProps,\n isCloseable = true,\n isPortaled = false,\n portalProps = {},\n htmlAttributes,\n style,\n ref,\n as,\n ...restProps\n}: PolymorphicCommonProps<T, DrawerProps>) {\n const setOnExpandedChange = useCallback(() => {\n if (onExpandedChange) {\n onExpandedChange(!isExpanded);\n }\n }, [isExpanded, onExpandedChange]);\n\n const classes = classNames('ndl-drawer', className, {\n 'ndl-drawer-expanded': isExpanded,\n 'ndl-drawer-left': position === 'left',\n 'ndl-drawer-overlay': type === 'overlay',\n 'ndl-drawer-push': type === 'push',\n 'ndl-drawer-right': position === 'right',\n });\n\n const resizableStylePosition = type === 'overlay' ? 'absolute' : 'relative';\n const shouldRenderInPortal = isPortaled && type === 'overlay';\n const Component = as ?? 'div';\n\n const Close = () => (\n <>\n {isCloseable && (\n <CleanIconButton\n className=\"ndl-drawer-close-button\"\n onClick={setOnExpandedChange}\n description=\"Close\"\n size=\"medium\"\n htmlAttributes={{\n title: 'Close drawer',\n }}\n >\n <XMarkIconOutline />\n </CleanIconButton>\n )}\n </>\n );\n\n if (isResizeable) {\n return (\n <ConditionalWrap\n shouldWrap={shouldRenderInPortal}\n wrap={(wrapChildren) => (\n <FloatingPortal preserveTabOrder={true} {...portalProps}>\n {wrapChildren}\n </FloatingPortal>\n )}\n >\n <Resizable\n as={Component}\n defaultSize={{\n height: '100%',\n width: 'auto',\n }}\n {...resizeableProps}\n className={classes}\n style={{\n position: resizableStylePosition,\n ...style,\n ...resizeableProps?.style,\n }}\n boundsByDirection={true}\n bounds=\"parent\"\n handleStyles={{\n /*\n * adding a small offset to the handle to make it easier to click\n * if the content of the drawer is scrollable, most noticeable if not using\n * a mouse on mac or chrome on windows with the fluent scrollbars\n */\n right: {\n right: '-8px',\n },\n }}\n enable={{\n bottom: false,\n bottomLeft: false,\n bottomRight: false,\n left: position === 'right',\n right: position === 'left',\n top: false,\n topLeft: false,\n topRight: false,\n }}\n ref={ref}\n {...restProps}\n {...htmlAttributes}\n >\n {children}\n <Close />\n </Resizable>\n </ConditionalWrap>\n );\n }\n\n return (\n <ConditionalWrap\n shouldWrap={shouldRenderInPortal}\n wrap={(wrapChildren) => (\n <FloatingPortal preserveTabOrder={true} {...portalProps}>\n {wrapChildren}\n </FloatingPortal>\n )}\n >\n <Component\n className={classes}\n style={style}\n ref={ref}\n {...restProps}\n {...htmlAttributes}\n >\n {children}\n <Close />\n </Component>\n </ConditionalWrap>\n );\n};\n\nDrawerComponent.displayName = 'Drawer';\n\ntype DrawerHeaderProps = {\n children: React.ReactNode;\n className?: string;\n htmlAttributes?: HtmlAttributes<'h5'>;\n};\n\nconst DrawerHeader = ({\n children,\n className = '',\n htmlAttributes,\n ...restProps\n}: DrawerHeaderProps) => {\n const classes = classNames('ndl-drawer-header', className);\n\n if (typeof children === 'string' || typeof children === 'number') {\n return (\n <Typography\n className={classes}\n variant=\"title-3\"\n {...restProps}\n {...htmlAttributes}\n >\n {children}\n </Typography>\n );\n }\n\n return (\n <div className={classes} {...restProps} {...htmlAttributes}>\n {children}\n </div>\n );\n};\n\ntype DrawerActionsProps = {\n children: React.ReactNode;\n className?: string;\n htmlAttributes?: HtmlAttributes<'div'>;\n};\n\nconst DrawerActions = ({\n children,\n className = '',\n htmlAttributes,\n ...restProps\n}: DrawerActionsProps) => {\n const classes = classNames('ndl-drawer-actions', className);\n\n return (\n <div className={classes} {...restProps} {...htmlAttributes}>\n {children}\n </div>\n );\n};\n\ntype DrawerBodyProps = {\n children: React.ReactNode;\n className?: string;\n htmlAttributes?: HtmlAttributes<'div'>;\n};\n\nconst DrawerBody = ({\n children,\n className = '',\n htmlAttributes,\n ...restProps\n}: DrawerBodyProps) => {\n const classes = classNames('ndl-drawer-body', className);\n\n return (\n <div className=\"ndl-drawer-body-wrapper\">\n <div className={classes} {...restProps} {...htmlAttributes}>\n {children}\n </div>\n </div>\n );\n};\n\nconst Drawer = Object.assign(DrawerComponent, {\n Actions: DrawerActions,\n Body: DrawerBody,\n Header: DrawerHeader,\n});\n\nexport { Drawer };\n"]}
|
|
1
|
+
{"version":3,"file":"Drawer.js","sourceRoot":"","sources":["../../../src/drawer/Drawer.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,8CAAoD;AACpD,4DAAoC;AACpC,+CAA8D;AAE9D,iCAAyD;AAMzD,4DAAuD;AACvD,0DAAsD;AACtD,oCAA4C;AAC5C,8CAA2C;AA4C3C,MAAM,eAAe,GAAG,SAAS,eAAe,CAE9C,EAiBuC;QAjBvC,EACA,QAAQ,EACR,SAAS,GAAG,EAAE,EACd,UAAU,EACV,gBAAgB,EAChB,QAAQ,GAAG,MAAM,EACjB,IAAI,GAAG,SAAS,EAChB,YAAY,GAAG,KAAK,EACpB,eAAe,EACf,WAAW,GAAG,IAAI,EAClB,UAAU,GAAG,KAAK,EAClB,WAAW,GAAG,EAAE,EAChB,cAAc,EACd,KAAK,EACL,GAAG,EACH,EAAE,OAEqC,EADpC,SAAS,cAhBZ,sMAiBD,CADa;IAEZ,MAAM,mBAAmB,GAAG,IAAA,mBAAW,EAAC,GAAG,EAAE;QAC3C,IAAI,gBAAgB,EAAE,CAAC;YACrB,gBAAgB,CAAC,CAAC,UAAU,CAAC,CAAC;QAChC,CAAC;IACH,CAAC,EAAE,CAAC,U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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 { FloatingPortal } from '@floating-ui/react';\nimport classNames from 'classnames';\nimport { Resizable, type ResizableProps } from 're-resizable';\nimport type React from 'react';\nimport { type ComponentProps, useCallback } from 'react';\n\nimport {\n type HtmlAttributes,\n type PolymorphicCommonProps,\n} from '../_common/types';\nimport { CleanIconButton } from '../clean-icon-button';\nimport { ConditionalWrap } from '../conditional-wrap';\nimport { XMarkIconOutline } from '../icons';\nimport { Typography } from '../typography';\n\ntype DrawerPosition = 'left' | 'right';\n\ntype DrawerType = 'overlay' | 'push';\n\ntype DrawerProps = {\n /** Controls whether the drawer is open (expanded) or closed (collapsed). */\n isExpanded: boolean;\n\n /** Callback functions fired when the drawer's expanded state changes. */\n onExpandedChange?: (expanded: boolean) => void;\n\n /** Position where the drawer appears on screen. By default, it appears from the left. */\n position?: DrawerPosition;\n\n /** How the drawer affects the layout of sibling content. By default, it overlays content. */\n type?: DrawerType;\n\n /** Enables horizontal resizing of the drawer, by default it is not resizable. */\n isResizeable?: boolean;\n\n /** To use this prop the isResizeable prop must be set to true. For overriding the third party library props: https://github.com/bokuweb/re-resizable */\n resizeableProps?: ResizableProps;\n\n /** Whether a close button (X) is displayed in the drawer. */\n isCloseable?: boolean;\n\n /** Whether to portal the content */\n isPortaled?: boolean;\n\n /** The content to display within the drawer. */\n children: React.ReactNode;\n\n /** Additional CSS classes to apply to the drawer container. */\n className?: string;\n\n /**\n * Props to pass to the portal from @floating-ui/react FloatingPortal\n * @see https://floating-ui.com/docs/floatingportal\n */\n portalProps?: ComponentProps<typeof FloatingPortal>;\n};\n\nconst DrawerComponent = function DrawerComponent<\n T extends React.ElementType = 'div',\n>({\n children,\n className = '',\n isExpanded,\n onExpandedChange,\n position = 'left',\n type = 'overlay',\n isResizeable = false,\n resizeableProps,\n isCloseable = true,\n isPortaled = false,\n portalProps = {},\n htmlAttributes,\n style,\n ref,\n as,\n ...restProps\n}: PolymorphicCommonProps<T, DrawerProps>) {\n const setOnExpandedChange = useCallback(() => {\n if (onExpandedChange) {\n onExpandedChange(!isExpanded);\n }\n }, [isExpanded, onExpandedChange]);\n\n const classes = classNames('ndl-drawer', className, {\n 'ndl-drawer-expanded': isExpanded,\n 'ndl-drawer-left': position === 'left',\n 'ndl-drawer-overlay': type === 'overlay',\n 'ndl-drawer-push': type === 'push',\n 'ndl-drawer-right': position === 'right',\n });\n\n const resizableStylePosition = type === 'overlay' ? 'absolute' : 'relative';\n const shouldRenderInPortal = isPortaled && type === 'overlay';\n const Component = as ?? 'div';\n\n const Close = () => (\n <>\n {isCloseable && (\n <CleanIconButton\n className=\"ndl-drawer-close-button\"\n onClick={setOnExpandedChange}\n description={null}\n size=\"medium\"\n htmlAttributes={{\n 'aria-label': 'Close',\n }}\n >\n <XMarkIconOutline />\n </CleanIconButton>\n )}\n </>\n );\n\n if (isResizeable) {\n return (\n <ConditionalWrap\n shouldWrap={shouldRenderInPortal}\n wrap={(wrapChildren) => (\n <FloatingPortal preserveTabOrder={true} {...portalProps}>\n {wrapChildren}\n </FloatingPortal>\n )}\n >\n <Resizable\n as={Component}\n defaultSize={{\n height: '100%',\n width: 'auto',\n }}\n {...resizeableProps}\n className={classes}\n style={{\n position: resizableStylePosition,\n ...style,\n ...resizeableProps?.style,\n }}\n boundsByDirection={true}\n bounds=\"parent\"\n handleStyles={{\n /*\n * adding a small offset to the handle to make it easier to click\n * if the content of the drawer is scrollable, most noticeable if not using\n * a mouse on mac or chrome on windows with the fluent scrollbars\n */\n right: {\n right: '-8px',\n },\n }}\n enable={{\n bottom: false,\n bottomLeft: false,\n bottomRight: false,\n left: position === 'right',\n right: position === 'left',\n top: false,\n topLeft: false,\n topRight: false,\n }}\n ref={ref}\n {...restProps}\n {...htmlAttributes}\n >\n {children}\n <Close />\n </Resizable>\n </ConditionalWrap>\n );\n }\n\n return (\n <ConditionalWrap\n shouldWrap={shouldRenderInPortal}\n wrap={(wrapChildren) => (\n <FloatingPortal preserveTabOrder={true} {...portalProps}>\n {wrapChildren}\n </FloatingPortal>\n )}\n >\n <Component\n className={classes}\n style={style}\n ref={ref}\n {...restProps}\n {...htmlAttributes}\n >\n {children}\n <Close />\n </Component>\n </ConditionalWrap>\n );\n};\n\nDrawerComponent.displayName = 'Drawer';\n\ntype DrawerHeaderProps = {\n children: React.ReactNode;\n className?: string;\n htmlAttributes?: HtmlAttributes<'h5'>;\n};\n\nconst DrawerHeader = ({\n children,\n className = '',\n htmlAttributes,\n ...restProps\n}: DrawerHeaderProps) => {\n const classes = classNames('ndl-drawer-header', className);\n\n if (typeof children === 'string' || typeof children === 'number') {\n return (\n <Typography\n className={classes}\n variant=\"title-3\"\n {...restProps}\n {...htmlAttributes}\n >\n {children}\n </Typography>\n );\n }\n\n return (\n <div className={classes} {...restProps} {...htmlAttributes}>\n {children}\n </div>\n );\n};\n\ntype DrawerActionsProps = {\n children: React.ReactNode;\n className?: string;\n htmlAttributes?: HtmlAttributes<'div'>;\n};\n\nconst DrawerActions = ({\n children,\n className = '',\n htmlAttributes,\n ...restProps\n}: DrawerActionsProps) => {\n const classes = classNames('ndl-drawer-actions', className);\n\n return (\n <div className={classes} {...restProps} {...htmlAttributes}>\n {children}\n </div>\n );\n};\n\ntype DrawerBodyProps = {\n children: React.ReactNode;\n className?: string;\n htmlAttributes?: HtmlAttributes<'div'>;\n};\n\nconst DrawerBody = ({\n children,\n className = '',\n htmlAttributes,\n ...restProps\n}: DrawerBodyProps) => {\n const classes = classNames('ndl-drawer-body', className);\n\n return (\n <div className=\"ndl-drawer-body-wrapper\">\n <div className={classes} {...restProps} {...htmlAttributes}>\n {children}\n </div>\n </div>\n );\n};\n\nconst Drawer = Object.assign(DrawerComponent, {\n Actions: DrawerActions,\n Body: DrawerBody,\n Header: DrawerHeader,\n});\n\nexport { Drawer };\n"]}
|
|
@@ -36,7 +36,9 @@ exports.IconButton = void 0;
|
|
|
36
36
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
37
37
|
const icon_button_base_1 = require("../icon-button-base");
|
|
38
38
|
const IconButton = (_a) => {
|
|
39
|
-
var { children, as, isLoading = false, isDisabled = false, size = 'medium', isFloating = false,
|
|
39
|
+
var { children, as, isLoading = false, isDisabled = false, size = 'medium', isFloating = false,
|
|
40
|
+
// Does not have a default value to avoid setting aria-pressed to true if not explicitly set
|
|
41
|
+
isActive, variant = 'neutral', description, tooltipProps, className, style, htmlAttributes, onClick, ref } = _a, restProps = __rest(_a, ["children", "as", "isLoading", "isDisabled", "size", "isFloating", "isActive", "variant", "description", "tooltipProps", "className", "style", "htmlAttributes", "onClick", "ref"]);
|
|
40
42
|
return ((0, jsx_runtime_1.jsx)(icon_button_base_1.IconButtonBase, Object.assign({ as: as, iconButtonVariant: "default", isDisabled: isDisabled, size: size, isLoading: isLoading, isActive: isActive, isFloating: isFloating, description: description, tooltipProps: tooltipProps, className: className, style: style, variant: variant, htmlAttributes: htmlAttributes, onClick: onClick, ref: ref }, restProps, { children: children })));
|
|
41
43
|
};
|
|
42
44
|
exports.IconButton = IconButton;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IconButton.js","sourceRoot":"","sources":["../../../src/icon-button/IconButton.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;AAuBA,0DAA+E;AAIxE,MAAM,UAAU,GAAG,CAAyC,
|
|
1
|
+
{"version":3,"file":"IconButton.js","sourceRoot":"","sources":["../../../src/icon-button/IconButton.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;AAuBA,0DAA+E;AAIxE,MAAM,UAAU,GAAG,CAAyC,EAkBhB,EAAE,EAAE;QAlBY,EACjE,QAAQ,EACR,EAAE,EACF,SAAS,GAAG,KAAK,EACjB,UAAU,GAAG,KAAK,EAClB,IAAI,GAAG,QAAQ,EACf,UAAU,GAAG,KAAK;IAClB,4FAA4F;IAC5F,QAAQ,EACR,OAAO,GAAG,SAAS,EACnB,WAAW,EACX,YAAY,EACZ,SAAS,EACT,KAAK,EACL,cAAc,EACd,OAAO,EACP,GAAG,OAE8C,EAD9C,SAAS,cAjBqD,mLAkBlE,CADa;IAEZ,OAAO,CACL,uBAAC,iCAAc,kBACb,EAAE,EAAE,EAAE,EACN,iBAAiB,EAAC,SAAS,EAC3B,UAAU,EAAE,UAAU,EACtB,IAAI,EAAE,IAAI,EACV,SAAS,EAAE,SAAS,EACpB,QAAQ,EAAE,QAAQ,EAClB,UAAU,EAAE,UAAU,EACtB,WAAW,EAAE,WAAW,EACxB,YAAY,EAAE,YAAY,EAC1B,SAAS,EAAE,SAAS,EACpB,KAAK,EAAE,KAAK,EACZ,OAAO,EAAE,OAAO,EAChB,cAAc,EAAE,cAAc,EAC9B,OAAO,EAAE,OAAO,EAChB,GAAG,EAAE,GAAG,IACJ,SAAS,cAEZ,QAAQ,IACM,CAClB,CAAC;AACJ,CAAC,CAAC;AAzCW,QAAA,UAAU,cAyCrB","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 type React from 'react';\n\nimport { type PolymorphicCommonProps } from '../_common/types';\nimport { IconButtonBase, type IconButtonBaseProps } from '../icon-button-base';\n\ntype IconButtonButtonProps = Omit<IconButtonBaseProps, 'iconButtonVariant'>;\n\nexport const IconButton = <T extends React.ElementType = 'button'>({\n children,\n as,\n isLoading = false,\n isDisabled = false,\n size = 'medium',\n isFloating = false,\n // Does not have a default value to avoid setting aria-pressed to true if not explicitly set\n isActive,\n variant = 'neutral',\n description,\n tooltipProps,\n className,\n style,\n htmlAttributes,\n onClick,\n ref,\n ...restProps\n}: PolymorphicCommonProps<T, IconButtonButtonProps>) => {\n return (\n <IconButtonBase\n as={as}\n iconButtonVariant=\"default\"\n isDisabled={isDisabled}\n size={size}\n isLoading={isLoading}\n isActive={isActive}\n isFloating={isFloating}\n description={description}\n tooltipProps={tooltipProps}\n className={className}\n style={style}\n variant={variant}\n htmlAttributes={htmlAttributes}\n onClick={onClick}\n ref={ref}\n {...restProps}\n >\n {children}\n </IconButtonBase>\n );\n};\n"]}
|
package/lib/esm/banner/Banner.js
CHANGED
|
@@ -85,7 +85,7 @@ const BannerComponent = (_a) => {
|
|
|
85
85
|
onClose(e);
|
|
86
86
|
}
|
|
87
87
|
};
|
|
88
|
-
return (_jsxs(Element, Object.assign({ className: classes, role: isAlert ? 'alert' : undefined, ref: ref }, restProps, htmlAttributes, { children: [hasIcon && _jsx(StatusIcon, { variant: variant }), _jsx("div", { className: "ndl-banner-content", children: children }), isCloseable && (_jsx(CleanIconButton, { size: "small", onClick: handleClose, description:
|
|
88
|
+
return (_jsxs(Element, Object.assign({ className: classes, role: isAlert ? 'alert' : undefined, ref: ref }, restProps, htmlAttributes, { children: [hasIcon && _jsx(StatusIcon, { variant: variant }), _jsx("div", { className: "ndl-banner-content", children: children }), isCloseable && (_jsx(CleanIconButton, { size: "small", onClick: handleClose, description: null, htmlAttributes: { 'aria-label': 'Close' }, children: _jsx(XMarkIconOutline, {}) }))] })));
|
|
89
89
|
};
|
|
90
90
|
const Banner = Object.assign(BannerComponent,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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 {\n BoltIconOutline,\n CheckCircleIconSolid,\n ExclamationCircleIconSolid,\n ExclamationTriangleIconSolid,\n InformationCircleIconSolid,\n XMarkIconOutline,\n} from '../icons';\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 or alertdialog, based on the value of `isCloseable` */\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 e?: 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 e:\n | React.MouseEvent<HTMLElement, MouseEvent>\n | React.KeyboardEvent<HTMLElement>,\n ) => {\n if (onClose && typeof onClose === 'function') {\n onClose(e);\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 <div className=\"ndl-banner-content\">{children}</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"]}
|
|
@@ -33,7 +33,9 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
33
33
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
34
34
|
import { IconButtonBase } from '../icon-button-base';
|
|
35
35
|
export const CleanIconButton = (_a) => {
|
|
36
|
-
var { children, as, isLoading = false, isDisabled = false, size = 'medium',
|
|
36
|
+
var { children, as, isLoading = false, isDisabled = false, size = 'medium',
|
|
37
|
+
// Does not have a default value to avoid setting aria-pressed to true if not explicitly set
|
|
38
|
+
isActive, variant = 'neutral', description, tooltipProps, className, style, htmlAttributes, onClick, ref } = _a, restProps = __rest(_a, ["children", "as", "isLoading", "isDisabled", "size", "isActive", "variant", "description", "tooltipProps", "className", "style", "htmlAttributes", "onClick", "ref"]);
|
|
37
39
|
return (_jsx(IconButtonBase, Object.assign({ as: as, iconButtonVariant: "clean", isDisabled: isDisabled, size: size, isLoading: isLoading, isActive: isActive, variant: variant, description: description, tooltipProps: tooltipProps, className: className, style: style, htmlAttributes: htmlAttributes, onClick: onClick, ref: ref }, restProps, { children: children })));
|
|
38
40
|
};
|
|
39
41
|
//# sourceMappingURL=CleanIconButton.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CleanIconButton.js","sourceRoot":"","sources":["../../../src/clean-icon-button/CleanIconButton.tsx"],"names":[],"mappings":";;;;;;;;;;;;AAuBA,OAAO,EAAE,cAAc,EAA4B,MAAM,qBAAqB,CAAC;AAO/E,MAAM,CAAC,MAAM,eAAe,GAAG,CAAyC,
|
|
1
|
+
{"version":3,"file":"CleanIconButton.js","sourceRoot":"","sources":["../../../src/clean-icon-button/CleanIconButton.tsx"],"names":[],"mappings":";;;;;;;;;;;;AAuBA,OAAO,EAAE,cAAc,EAA4B,MAAM,qBAAqB,CAAC;AAO/E,MAAM,CAAC,MAAM,eAAe,GAAG,CAAyC,EAiBhB,EAAE,EAAE;QAjBY,EACtE,QAAQ,EACR,EAAE,EACF,SAAS,GAAG,KAAK,EACjB,UAAU,GAAG,KAAK,EAClB,IAAI,GAAG,QAAQ;IACf,4FAA4F;IAC5F,QAAQ,EACR,OAAO,GAAG,SAAS,EACnB,WAAW,EACX,YAAY,EACZ,SAAS,EACT,KAAK,EACL,cAAc,EACd,OAAO,EACP,GAAG,OAEmD,EADnD,SAAS,cAhB0D,qKAiBvE,CADa;IAEZ,OAAO,CACL,KAAC,cAAc,kBACb,EAAE,EAAE,EAAE,EACN,iBAAiB,EAAC,OAAO,EACzB,UAAU,EAAE,UAAU,EACtB,IAAI,EAAE,IAAI,EACV,SAAS,EAAE,SAAS,EACpB,QAAQ,EAAE,QAAQ,EAClB,OAAO,EAAE,OAAO,EAChB,WAAW,EAAE,WAAW,EACxB,YAAY,EAAE,YAAY,EAC1B,SAAS,EAAE,SAAS,EACpB,KAAK,EAAE,KAAK,EACZ,cAAc,EAAE,cAAc,EAC9B,OAAO,EAAE,OAAO,EAChB,GAAG,EAAE,GAAG,IACJ,SAAS,cAEZ,QAAQ,IACM,CAClB,CAAC;AACJ,CAAC,CAAC","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 type React from 'react';\n\nimport { type PolymorphicCommonProps } from '../_common/types';\nimport { IconButtonBase, type IconButtonBaseProps } from '../icon-button-base';\n\ntype CleanIconButtonButtonProps = Omit<\n IconButtonBaseProps,\n 'iconButtonVariant' | 'isFloating'\n>;\n\nexport const CleanIconButton = <T extends React.ElementType = 'button'>({\n children,\n as,\n isLoading = false,\n isDisabled = false,\n size = 'medium',\n // Does not have a default value to avoid setting aria-pressed to true if not explicitly set\n isActive,\n variant = 'neutral',\n description,\n tooltipProps,\n className,\n style,\n htmlAttributes,\n onClick,\n ref,\n ...restProps\n}: PolymorphicCommonProps<T, CleanIconButtonButtonProps>) => {\n return (\n <IconButtonBase\n as={as}\n iconButtonVariant=\"clean\"\n isDisabled={isDisabled}\n size={size}\n isLoading={isLoading}\n isActive={isActive}\n variant={variant}\n description={description}\n tooltipProps={tooltipProps}\n className={className}\n style={style}\n htmlAttributes={htmlAttributes}\n onClick={onClick}\n ref={ref}\n {...restProps}\n >\n {children}\n </IconButtonBase>\n );\n};\n"]}
|
package/lib/esm/dialog/Dialog.js
CHANGED
|
@@ -89,10 +89,9 @@ const DialogComponent = (_a) => {
|
|
|
89
89
|
headerId,
|
|
90
90
|
setHeaderId,
|
|
91
91
|
variant,
|
|
92
|
-
}, children: [!hasDisabledCloseButton && (_jsx(CleanIconButton, { size: "medium", className: "ndl-dialog-close", onClick: handleCloseClick, description:
|
|
93
|
-
'
|
|
94
|
-
|
|
95
|
-
}, children: _jsx(XMarkIconOutline, {}) })), _jsxs("div", { className: "ndl-dialog-content-wrapper", children: [variant && (_jsx("div", { className: `ndl-dialog-type-icon ndl-${variant}`, "data-testid": "ndl-dialog-type-icon", children: typeIcons[variant] })), _jsx("div", { className: "n-flex n-flex-col n-flex-1 n-w-full", children: children })] })] }) })));
|
|
92
|
+
}, children: [!hasDisabledCloseButton && (_jsx(CleanIconButton, { size: "medium", className: "ndl-dialog-close", onClick: handleCloseClick, description: null, htmlAttributes: {
|
|
93
|
+
'aria-label': 'Close',
|
|
94
|
+
}, children: _jsx(XMarkIconOutline, {}) })), _jsxs("div", { className: "ndl-dialog-content-wrapper", children: [variant && (_jsx("div", { className: `ndl-dialog-type-icon ndl-${variant}`, children: typeIcons[variant] })), _jsx("div", { className: "n-flex n-flex-col n-flex-1 n-w-full", children: children })] })] }) })));
|
|
96
95
|
};
|
|
97
96
|
const Actions = (_a) => {
|
|
98
97
|
var { as, children, className, style, htmlAttributes, ref } = _a, restProps = __rest(_a, ["as", "children", "className", "style", "htmlAttributes", "ref"]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Dialog.js","sourceRoot":"","sources":["../../../src/dialog/Dialog.tsx"],"names":[],"mappings":";;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAO1D,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,EACL,4BAA4B,EAC5B,8BAA8B,EAC9B,4BAA4B,EAC5B,gBAAgB,GACjB,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,KAAK,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AACnD,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAE,UAA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kB,EAAE,SAAS,CAAC,CAAC;IAE1D,OAAO,CACL,4BACE,GAAG,EAAE,GAAG,EACR,GAAG,EAAE,GAAG,EACR,SAAS,EAAE,OAAO,EAClB,KAAK,EAAE,KAAK,EACZ,GAAG,EAAE,GAAG,IACJ,SAAS,EACT,cAAc,EAClB,CACH,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,eAAe,EAAE;IAC5C,OAAO;IACP,OAAO;IACP,WAAW;IACX,MAAM;IACN,KAAK;IACL,QAAQ;CACT,CAAC,CAAC;AAEH,OAAO,EAAE,MAAM,EAAE,CAAC","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, { useEffect, useId, useState } from 'react';\n\nimport {\n type CommonProps,\n type PolymorphicCommonProps,\n} from '../_common/types';\nimport { type ButtonBase } from '../button';\nimport { CleanIconButton } from '../clean-icon-button';\nimport { FilledButton } from '../filled-button';\nimport {\n ExclamationCircleIconOutline,\n ExclamationTriangleIconOutline,\n InformationCircleIconOutline,\n XMarkIconOutline,\n} from '../icons';\nimport { Modal, ModalCloseReason } from '../modal';\nimport { OutlinedButton } from '../outlined-button';\nimport { TextButton } from '../text-button';\nimport { Typography } from '../typography';\nimport { DialogContext, useDialogContext } from './dialog-context';\nimport {\n type DialogActionsProps,\n DialogCloseReason,\n type DialogContentProps,\n type DialogDescriptionProps,\n type DialogHeaderProps,\n type DialogImageProps,\n type DialogProps,\n type DialogSubtitleProps,\n} from './dialog-types';\n\nconst convertCloseReason = (reason: ModalCloseReason): DialogCloseReason => {\n const dialogReason = reason as unknown as DialogCloseReason;\n if (Object.values(DialogCloseReason).includes(dialogReason)) {\n return dialogReason;\n }\n\n throw new Error(`Unknown reason '${reason}' received from popup`);\n};\n/* Stroke width on regular icons is 1.5px */\nconst typeIcons: Record<\n NonNullable<React.ComponentProps<typeof Dialog>['variant']>,\n React.ReactNode\n> = {\n danger: <ExclamationCircleIconOutline htmlAttributes={{ strokeWidth: 3 }} />,\n info: <InformationCircleIconOutline htmlAttributes={{ strokeWidth: 3 }} />,\n warning: (\n <ExclamationTriangleIconOutline htmlAttributes={{ strokeWidth: 3 }} />\n ),\n};\n\nconst DialogComponent = ({\n isOpen,\n onClose,\n children,\n variant,\n size,\n container,\n rootProps,\n hasDisabledCloseButton = false,\n htmlAttributes,\n className,\n style,\n ref,\n ...restProps\n}: CommonProps<'div', DialogProps>) => {\n const id = useId();\n const [headerId, setHeaderId] = useState<string | undefined>(id);\n\n const handleCloseClick = (e: React.MouseEvent<HTMLButtonElement>) => {\n e.preventDefault();\n onClose?.(e, DialogCloseReason.CLOSE_BUTTON_CLICK);\n };\n\n const handleClose = (\n e: React.MouseEvent<HTMLElement> | React.KeyboardEvent<HTMLElement>,\n reason?: ModalCloseReason,\n ) => {\n // Dialog should not be closed when backdrop is clicked\n if (reason === ModalCloseReason.BACKDROP_CLICK) {\n return;\n }\n\n onClose?.(e, reason !== undefined ? convertCloseReason(reason) : undefined);\n };\n\n const hasHeaderChild = React.useMemo(() => {\n const childrenArray = React.Children.toArray(children);\n return childrenArray.some(\n (child) => React.isValidElement(child) && child.type === Header,\n );\n }, [children]);\n\n const ariaLabelledBy =\n htmlAttributes?.['aria-labelledby'] ??\n (hasHeaderChild ? headerId : undefined);\n\n if (!isOpen) {\n return null;\n }\n\n if (htmlAttributes?.['aria-label'] === undefined && !ariaLabelledBy) {\n console.warn(\n 'The Dialog is missing aria-label and Header. Please add one of them for accessibility.',\n );\n }\n\n const classes = classNames('ndl-dialog', className, {\n 'ndl-with-close-button': !hasDisabledCloseButton,\n 'ndl-with-icon': !!variant,\n });\n\n return (\n <Modal\n isOpen={isOpen}\n onClose={handleClose}\n container={container}\n rootProps={rootProps}\n size={size}\n htmlAttributes={{\n ...htmlAttributes,\n 'aria-labelledby': ariaLabelledBy,\n }}\n className={classes}\n style={style}\n ref={ref}\n {...restProps}\n >\n <DialogContext.Provider\n value={{\n headerId,\n setHeaderId,\n variant,\n }}\n >\n {!hasDisabledCloseButton && (\n <CleanIconButton\n size=\"medium\"\n className=\"ndl-dialog-close\"\n onClick={handleCloseClick}\n description=\"Close\"\n htmlAttributes={{\n 'data-testid': 'ndl-dialog-close',\n role: 'button',\n }}\n >\n <XMarkIconOutline />\n </CleanIconButton>\n )}\n <div className=\"ndl-dialog-content-wrapper\">\n {variant && (\n <div\n className={`ndl-dialog-type-icon ndl-${variant}`}\n data-testid=\"ndl-dialog-type-icon\"\n >\n {typeIcons[variant]}\n </div>\n )}\n <div className=\"n-flex n-flex-col n-flex-1 n-w-full\">{children}</div>\n </div>\n </DialogContext.Provider>\n </Modal>\n );\n};\n\nconst Actions = <T extends React.ElementType = 'div'>({\n as,\n children,\n className,\n style,\n htmlAttributes,\n ref,\n ...restProps\n}: PolymorphicCommonProps<T, DialogActionsProps>) => {\n const { variant } = useDialogContext();\n const classes = classNames('ndl-dialog-actions', className);\n const Component: React.ElementType = as ?? 'div';\n\n let childrenToRender = children;\n\n // For danger dialogs, we want to convert primary buttons to danger buttons by default\n if (variant === 'danger') {\n childrenToRender = React.Children.map(children, (element) => {\n if (!React.isValidElement(element)) {\n return;\n }\n if (\n element.type === OutlinedButton ||\n element.type === FilledButton ||\n element.type === TextButton\n ) {\n const buttonElement = element as React.ReactElement<\n React.ComponentProps<typeof ButtonBase>\n >;\n\n if (\n buttonElement.props.variant === 'primary' ||\n buttonElement.props.variant === undefined\n ) {\n return React.cloneElement(buttonElement, {\n ...buttonElement.props,\n variant: 'danger',\n });\n }\n }\n return element;\n });\n }\n\n return (\n <Component\n className={classes}\n style={style}\n ref={ref}\n {...restProps}\n {...htmlAttributes}\n >\n {childrenToRender}\n </Component>\n );\n};\n\nconst Header = <T extends React.ElementType = 'span'>({\n as,\n children,\n className,\n style,\n htmlAttributes,\n ref,\n ...restProps\n}: PolymorphicCommonProps<T, DialogHeaderProps>) => {\n const { headerId, setHeaderId } = useDialogContext();\n const classes = classNames('ndl-dialog-header', className);\n const Component: React.ElementType = as ?? 'span';\n\n useEffect(() => {\n if (Boolean(htmlAttributes?.id) === true) {\n setHeaderId?.(htmlAttributes?.id);\n }\n }, [htmlAttributes?.id, setHeaderId]);\n\n return (\n <Typography\n as={Component}\n className={classes}\n ref={ref}\n style={style}\n variant=\"title-2\"\n {...restProps}\n htmlAttributes={{ ...htmlAttributes, id: headerId }}\n >\n {children}\n </Typography>\n );\n};\n\nconst Subtitle = <T extends React.ElementType = 'div'>({\n as,\n children,\n className,\n style,\n htmlAttributes,\n ref,\n ...restProps\n}: PolymorphicCommonProps<T, DialogSubtitleProps>) => {\n const classes = classNames('ndl-dialog-subtitle', className);\n const Component: React.ElementType = as ?? 'div';\n\n return (\n <Component\n className={classes}\n style={style}\n ref={ref}\n {...restProps}\n {...htmlAttributes}\n >\n {children}\n </Component>\n );\n};\n\nconst Description = <T extends React.ElementType = 'div'>({\n as,\n children,\n className,\n style,\n htmlAttributes,\n ref,\n ...restProps\n}: PolymorphicCommonProps<T, DialogDescriptionProps>) => {\n const classes = classNames('ndl-dialog-description', className);\n const Component: React.ElementType = as ?? 'div';\n\n return (\n <Component\n className={classes}\n style={style}\n ref={ref}\n {...restProps}\n {...htmlAttributes}\n >\n {children}\n </Component>\n );\n};\n\nconst Content = <T extends React.ElementType = 'div'>({\n as,\n children,\n className,\n style,\n htmlAttributes,\n ref,\n ...restProps\n}: PolymorphicCommonProps<T, DialogContentProps>) => {\n const classes = classNames('ndl-dialog-content', className);\n const Component: React.ElementType = as ?? 'div';\n\n return (\n <Component\n className={classes}\n style={style}\n ref={ref}\n {...restProps}\n {...htmlAttributes}\n >\n {children}\n </Component>\n );\n};\n\nconst Image = ({\n src,\n alt,\n className,\n style,\n htmlAttributes,\n ref,\n ...restProps\n}: CommonProps<'img', DialogImageProps>) => {\n const classes = classNames('ndl-dialog-image', className);\n\n return (\n <img\n src={src}\n alt={alt}\n className={classes}\n style={style}\n ref={ref}\n {...restProps}\n {...htmlAttributes}\n />\n );\n};\n\nconst Dialog = Object.assign(DialogComponent, {\n Actions,\n Content,\n Description,\n Header,\n Image,\n Subtitle,\n});\n\nexport { Dialog };\n"]}
|
|
1
|
+
{"version":3,"file":"Dialog.js","sourceRoot":"","sources":["../../../src/dialog/Dialog.tsx"],"names":[],"mappings":";;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAO1D,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,EACL,4BAA4B,EAC5B,8BAA8B,EAC9B,4BAA4B,EAC5B,gBAAgB,GACjB,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,KAAK,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AACnD,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACnE,OAAO,EAEL,iBAAiB,GAOlB,MAAM,gBAAgB,CAAC;AAExB,MAAM,k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C,MAAM,CAAC,eAAe,EAAE;IAC5C,OAAO;IACP,OAAO;IACP,WAAW;IACX,MAAM;IACN,KAAK;IACL,QAAQ;CACT,CAAC,CAAC;AAEH,OAAO,EAAE,MAAM,EAAE,CAAC","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, { useEffect, useId, useState } from 'react';\n\nimport {\n type CommonProps,\n type PolymorphicCommonProps,\n} from '../_common/types';\nimport { type ButtonBase } from '../button';\nimport { CleanIconButton } from '../clean-icon-button';\nimport { FilledButton } from '../filled-button';\nimport {\n ExclamationCircleIconOutline,\n ExclamationTriangleIconOutline,\n InformationCircleIconOutline,\n XMarkIconOutline,\n} from '../icons';\nimport { Modal, ModalCloseReason } from '../modal';\nimport { OutlinedButton } from '../outlined-button';\nimport { TextButton } from '../text-button';\nimport { Typography } from '../typography';\nimport { DialogContext, useDialogContext } from './dialog-context';\nimport {\n type DialogActionsProps,\n DialogCloseReason,\n type DialogContentProps,\n type DialogDescriptionProps,\n type DialogHeaderProps,\n type DialogImageProps,\n type DialogProps,\n type DialogSubtitleProps,\n} from './dialog-types';\n\nconst convertCloseReason = (reason: ModalCloseReason): DialogCloseReason => {\n const dialogReason = reason as unknown as DialogCloseReason;\n if (Object.values(DialogCloseReason).includes(dialogReason)) {\n return dialogReason;\n }\n\n throw new Error(`Unknown reason '${reason}' received from popup`);\n};\n/* Stroke width on regular icons is 1.5px */\nconst typeIcons: Record<\n NonNullable<React.ComponentProps<typeof Dialog>['variant']>,\n React.ReactNode\n> = {\n danger: <ExclamationCircleIconOutline htmlAttributes={{ strokeWidth: 3 }} />,\n info: <InformationCircleIconOutline htmlAttributes={{ strokeWidth: 3 }} />,\n warning: (\n <ExclamationTriangleIconOutline htmlAttributes={{ strokeWidth: 3 }} />\n ),\n};\n\nconst DialogComponent = ({\n isOpen,\n onClose,\n children,\n variant,\n size,\n container,\n rootProps,\n hasDisabledCloseButton = false,\n htmlAttributes,\n className,\n style,\n ref,\n ...restProps\n}: CommonProps<'div', DialogProps>) => {\n const id = useId();\n const [headerId, setHeaderId] = useState<string | undefined>(id);\n\n const handleCloseClick = (e: React.MouseEvent<HTMLButtonElement>) => {\n e.preventDefault();\n onClose?.(e, DialogCloseReason.CLOSE_BUTTON_CLICK);\n };\n\n const handleClose = (\n e: React.MouseEvent<HTMLElement> | React.KeyboardEvent<HTMLElement>,\n reason?: ModalCloseReason,\n ) => {\n // Dialog should not be closed when backdrop is clicked\n if (reason === ModalCloseReason.BACKDROP_CLICK) {\n return;\n }\n\n onClose?.(e, reason !== undefined ? convertCloseReason(reason) : undefined);\n };\n\n const hasHeaderChild = React.useMemo(() => {\n const childrenArray = React.Children.toArray(children);\n return childrenArray.some(\n (child) => React.isValidElement(child) && child.type === Header,\n );\n }, [children]);\n\n const ariaLabelledBy =\n htmlAttributes?.['aria-labelledby'] ??\n (hasHeaderChild ? headerId : undefined);\n\n if (!isOpen) {\n return null;\n }\n\n if (htmlAttributes?.['aria-label'] === undefined && !ariaLabelledBy) {\n console.warn(\n 'The Dialog is missing aria-label and Header. Please add one of them for accessibility.',\n );\n }\n\n const classes = classNames('ndl-dialog', className, {\n 'ndl-with-close-button': !hasDisabledCloseButton,\n 'ndl-with-icon': !!variant,\n });\n\n return (\n <Modal\n isOpen={isOpen}\n onClose={handleClose}\n container={container}\n rootProps={rootProps}\n size={size}\n htmlAttributes={{\n ...htmlAttributes,\n 'aria-labelledby': ariaLabelledBy,\n }}\n className={classes}\n style={style}\n ref={ref}\n {...restProps}\n >\n <DialogContext.Provider\n value={{\n headerId,\n setHeaderId,\n variant,\n }}\n >\n {!hasDisabledCloseButton && (\n <CleanIconButton\n size=\"medium\"\n className=\"ndl-dialog-close\"\n onClick={handleCloseClick}\n description={null}\n htmlAttributes={{\n 'aria-label': 'Close',\n }}\n >\n <XMarkIconOutline />\n </CleanIconButton>\n )}\n <div className=\"ndl-dialog-content-wrapper\">\n {variant && (\n <div className={`ndl-dialog-type-icon ndl-${variant}`}>\n {typeIcons[variant]}\n </div>\n )}\n <div className=\"n-flex n-flex-col n-flex-1 n-w-full\">{children}</div>\n </div>\n </DialogContext.Provider>\n </Modal>\n );\n};\n\nconst Actions = <T extends React.ElementType = 'div'>({\n as,\n children,\n className,\n style,\n htmlAttributes,\n ref,\n ...restProps\n}: PolymorphicCommonProps<T, DialogActionsProps>) => {\n const { variant } = useDialogContext();\n const classes = classNames('ndl-dialog-actions', className);\n const Component: React.ElementType = as ?? 'div';\n\n let childrenToRender = children;\n\n // For danger dialogs, we want to convert primary buttons to danger buttons by default\n if (variant === 'danger') {\n childrenToRender = React.Children.map(children, (element) => {\n if (!React.isValidElement(element)) {\n return;\n }\n if (\n element.type === OutlinedButton ||\n element.type === FilledButton ||\n element.type === TextButton\n ) {\n const buttonElement = element as React.ReactElement<\n React.ComponentProps<typeof ButtonBase>\n >;\n\n if (\n buttonElement.props.variant === 'primary' ||\n buttonElement.props.variant === undefined\n ) {\n return React.cloneElement(buttonElement, {\n ...buttonElement.props,\n variant: 'danger',\n });\n }\n }\n return element;\n });\n }\n\n return (\n <Component\n className={classes}\n style={style}\n ref={ref}\n {...restProps}\n {...htmlAttributes}\n >\n {childrenToRender}\n </Component>\n );\n};\n\nconst Header = <T extends React.ElementType = 'span'>({\n as,\n children,\n className,\n style,\n htmlAttributes,\n ref,\n ...restProps\n}: PolymorphicCommonProps<T, DialogHeaderProps>) => {\n const { headerId, setHeaderId } = useDialogContext();\n const classes = classNames('ndl-dialog-header', className);\n const Component: React.ElementType = as ?? 'span';\n\n useEffect(() => {\n if (Boolean(htmlAttributes?.id) === true) {\n setHeaderId?.(htmlAttributes?.id);\n }\n }, [htmlAttributes?.id, setHeaderId]);\n\n return (\n <Typography\n as={Component}\n className={classes}\n ref={ref}\n style={style}\n variant=\"title-2\"\n {...restProps}\n htmlAttributes={{ ...htmlAttributes, id: headerId }}\n >\n {children}\n </Typography>\n );\n};\n\nconst Subtitle = <T extends React.ElementType = 'div'>({\n as,\n children,\n className,\n style,\n htmlAttributes,\n ref,\n ...restProps\n}: PolymorphicCommonProps<T, DialogSubtitleProps>) => {\n const classes = classNames('ndl-dialog-subtitle', className);\n const Component: React.ElementType = as ?? 'div';\n\n return (\n <Component\n className={classes}\n style={style}\n ref={ref}\n {...restProps}\n {...htmlAttributes}\n >\n {children}\n </Component>\n );\n};\n\nconst Description = <T extends React.ElementType = 'div'>({\n as,\n children,\n className,\n style,\n htmlAttributes,\n ref,\n ...restProps\n}: PolymorphicCommonProps<T, DialogDescriptionProps>) => {\n const classes = classNames('ndl-dialog-description', className);\n const Component: React.ElementType = as ?? 'div';\n\n return (\n <Component\n className={classes}\n style={style}\n ref={ref}\n {...restProps}\n {...htmlAttributes}\n >\n {children}\n </Component>\n );\n};\n\nconst Content = <T extends React.ElementType = 'div'>({\n as,\n children,\n className,\n style,\n htmlAttributes,\n ref,\n ...restProps\n}: PolymorphicCommonProps<T, DialogContentProps>) => {\n const classes = classNames('ndl-dialog-content', className);\n const Component: React.ElementType = as ?? 'div';\n\n return (\n <Component\n className={classes}\n style={style}\n ref={ref}\n {...restProps}\n {...htmlAttributes}\n >\n {children}\n </Component>\n );\n};\n\nconst Image = ({\n src,\n alt,\n className,\n style,\n htmlAttributes,\n ref,\n ...restProps\n}: CommonProps<'img', DialogImageProps>) => {\n const classes = classNames('ndl-dialog-image', className);\n\n return (\n <img\n src={src}\n alt={alt}\n className={classes}\n style={style}\n ref={ref}\n {...restProps}\n {...htmlAttributes}\n />\n );\n};\n\nconst Dialog = Object.assign(DialogComponent, {\n Actions,\n Content,\n Description,\n Header,\n Image,\n Subtitle,\n});\n\nexport { Dialog };\n"]}
|
package/lib/esm/drawer/Drawer.js
CHANGED
|
@@ -55,8 +55,8 @@ const DrawerComponent = function DrawerComponent(_a) {
|
|
|
55
55
|
const resizableStylePosition = type === 'overlay' ? 'absolute' : 'relative';
|
|
56
56
|
const shouldRenderInPortal = isPortaled && type === 'overlay';
|
|
57
57
|
const Component = as !== null && as !== void 0 ? as : 'div';
|
|
58
|
-
const Close = () => (_jsx(_Fragment, { children: isCloseable && (_jsx(CleanIconButton, { className: "ndl-drawer-close-button", onClick: setOnExpandedChange, description:
|
|
59
|
-
|
|
58
|
+
const Close = () => (_jsx(_Fragment, { children: isCloseable && (_jsx(CleanIconButton, { className: "ndl-drawer-close-button", onClick: setOnExpandedChange, description: null, size: "medium", htmlAttributes: {
|
|
59
|
+
'aria-label': 'Close',
|
|
60
60
|
}, children: _jsx(XMarkIconOutline, {}) })) }));
|
|
61
61
|
if (isResizeable) {
|
|
62
62
|
return (_jsx(ConditionalWrap, { shouldWrap: shouldRenderInPortal, wrap: (wrapChildren) => (_jsx(FloatingPortal, Object.assign({ preserveTabOrder: true }, portalProps, { children: wrapChildren }))), children: _jsxs(Resizable, Object.assign({ as: Component, defaultSize: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Drawer.js","sourceRoot":"","sources":["../../../src/drawer/Drawer.tsx"],"names":[],"mappings":";;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,EAAE,SAAS,EAAuB,MAAM,cAAc,CAAC;AAE9D,OAAO,EAAuB,WAAW,EAAE,MAAM,OAAO,CAAC;AAMzD,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,C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AS,EAAM,cAAc,cACvD,QAAQ,IACL,CACP,CAAC;AACJ,CAAC,CAAC;AAQF,MAAM,UAAU,GAAG,CAAC,EAKF,EAAE,EAAE;QALF,EAClB,QAAQ,EACR,SAAS,GAAG,EAAE,EACd,cAAc,OAEE,EADb,SAAS,cAJM,2CAKnB,CADa;IAEZ,MAAM,OAAO,GAAG,UAAU,CAAC,iBAAiB,EAAE,SAAS,CAAC,CAAC;IAEzD,OAAO,CACL,cAAK,SAAS,EAAC,yBAAyB,YACtC,4BAAK,SAAS,EAAE,OAAO,IAAM,SAAS,EAAM,cAAc,cACvD,QAAQ,IACL,GACF,CACP,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,eAAe,EAAE;IAC5C,OAAO,EAAE,aAAa;IACtB,IAAI,EAAE,UAAU;IAChB,MAAM,EAAE,YAAY;CACrB,CAAC,CAAC;AAEH,OAAO,EAAE,MAAM,EAAE,CAAC","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 { FloatingPortal } from '@floating-ui/react';\nimport classNames from 'classnames';\nimport { Resizable, type ResizableProps } from 're-resizable';\nimport type React from 'react';\nimport { type ComponentProps, useCallback } from 'react';\n\nimport {\n type HtmlAttributes,\n type PolymorphicCommonProps,\n} from '../_common/types';\nimport { CleanIconButton } from '../clean-icon-button';\nimport { ConditionalWrap } from '../conditional-wrap';\nimport { XMarkIconOutline } from '../icons';\nimport { Typography } from '../typography';\n\ntype DrawerPosition = 'left' | 'right';\n\ntype DrawerType = 'overlay' | 'push';\n\ntype DrawerProps = {\n /** Controls whether the drawer is open (expanded) or closed (collapsed). */\n isExpanded: boolean;\n\n /** Callback functions fired when the drawer's expanded state changes. */\n onExpandedChange?: (expanded: boolean) => void;\n\n /** Position where the drawer appears on screen. By default, it appears from the left. */\n position?: DrawerPosition;\n\n /** How the drawer affects the layout of sibling content. By default, it overlays content. */\n type?: DrawerType;\n\n /** Enables horizontal resizing of the drawer, by default it is not resizable. */\n isResizeable?: boolean;\n\n /** To use this prop the isResizeable prop must be set to true. For overriding the third party library props: https://github.com/bokuweb/re-resizable */\n resizeableProps?: ResizableProps;\n\n /** Whether a close button (X) is displayed in the drawer. */\n isCloseable?: boolean;\n\n /** Whether to portal the content */\n isPortaled?: boolean;\n\n /** The content to display within the drawer. */\n children: React.ReactNode;\n\n /** Additional CSS classes to apply to the drawer container. */\n className?: string;\n\n /**\n * Props to pass to the portal from @floating-ui/react FloatingPortal\n * @see https://floating-ui.com/docs/floatingportal\n */\n portalProps?: ComponentProps<typeof FloatingPortal>;\n};\n\nconst DrawerComponent = function DrawerComponent<\n T extends React.ElementType = 'div',\n>({\n children,\n className = '',\n isExpanded,\n onExpandedChange,\n position = 'left',\n type = 'overlay',\n isResizeable = false,\n resizeableProps,\n isCloseable = true,\n isPortaled = false,\n portalProps = {},\n htmlAttributes,\n style,\n ref,\n as,\n ...restProps\n}: PolymorphicCommonProps<T, DrawerProps>) {\n const setOnExpandedChange = useCallback(() => {\n if (onExpandedChange) {\n onExpandedChange(!isExpanded);\n }\n }, [isExpanded, onExpandedChange]);\n\n const classes = classNames('ndl-drawer', className, {\n 'ndl-drawer-expanded': isExpanded,\n 'ndl-drawer-left': position === 'left',\n 'ndl-drawer-overlay': type === 'overlay',\n 'ndl-drawer-push': type === 'push',\n 'ndl-drawer-right': position === 'right',\n });\n\n const resizableStylePosition = type === 'overlay' ? 'absolute' : 'relative';\n const shouldRenderInPortal = isPortaled && type === 'overlay';\n const Component = as ?? 'div';\n\n const Close = () => (\n <>\n {isCloseable && (\n <CleanIconButton\n className=\"ndl-drawer-close-button\"\n onClick={setOnExpandedChange}\n description=\"Close\"\n size=\"medium\"\n htmlAttributes={{\n title: 'Close drawer',\n }}\n >\n <XMarkIconOutline />\n </CleanIconButton>\n )}\n </>\n );\n\n if (isResizeable) {\n return (\n <ConditionalWrap\n shouldWrap={shouldRenderInPortal}\n wrap={(wrapChildren) => (\n <FloatingPortal preserveTabOrder={true} {...portalProps}>\n {wrapChildren}\n </FloatingPortal>\n )}\n >\n <Resizable\n as={Component}\n defaultSize={{\n height: '100%',\n width: 'auto',\n }}\n {...resizeableProps}\n className={classes}\n style={{\n position: resizableStylePosition,\n ...style,\n ...resizeableProps?.style,\n }}\n boundsByDirection={true}\n bounds=\"parent\"\n handleStyles={{\n /*\n * adding a small offset to the handle to make it easier to click\n * if the content of the drawer is scrollable, most noticeable if not using\n * a mouse on mac or chrome on windows with the fluent scrollbars\n */\n right: {\n right: '-8px',\n },\n }}\n enable={{\n bottom: false,\n bottomLeft: false,\n bottomRight: false,\n left: position === 'right',\n right: position === 'left',\n top: false,\n topLeft: false,\n topRight: false,\n }}\n ref={ref}\n {...restProps}\n {...htmlAttributes}\n >\n {children}\n <Close />\n </Resizable>\n </ConditionalWrap>\n );\n }\n\n return (\n <ConditionalWrap\n shouldWrap={shouldRenderInPortal}\n wrap={(wrapChildren) => (\n <FloatingPortal preserveTabOrder={true} {...portalProps}>\n {wrapChildren}\n </FloatingPortal>\n )}\n >\n <Component\n className={classes}\n style={style}\n ref={ref}\n {...restProps}\n {...htmlAttributes}\n >\n {children}\n <Close />\n </Component>\n </ConditionalWrap>\n );\n};\n\nDrawerComponent.displayName = 'Drawer';\n\ntype DrawerHeaderProps = {\n children: React.ReactNode;\n className?: string;\n htmlAttributes?: HtmlAttributes<'h5'>;\n};\n\nconst DrawerHeader = ({\n children,\n className = '',\n htmlAttributes,\n ...restProps\n}: DrawerHeaderProps) => {\n const classes = classNames('ndl-drawer-header', className);\n\n if (typeof children === 'string' || typeof children === 'number') {\n return (\n <Typography\n className={classes}\n variant=\"title-3\"\n {...restProps}\n {...htmlAttributes}\n >\n {children}\n </Typography>\n );\n }\n\n return (\n <div className={classes} {...restProps} {...htmlAttributes}>\n {children}\n </div>\n );\n};\n\ntype DrawerActionsProps = {\n children: React.ReactNode;\n className?: string;\n htmlAttributes?: HtmlAttributes<'div'>;\n};\n\nconst DrawerActions = ({\n children,\n className = '',\n htmlAttributes,\n ...restProps\n}: DrawerActionsProps) => {\n const classes = classNames('ndl-drawer-actions', className);\n\n return (\n <div className={classes} {...restProps} {...htmlAttributes}>\n {children}\n </div>\n );\n};\n\ntype DrawerBodyProps = {\n children: React.ReactNode;\n className?: string;\n htmlAttributes?: HtmlAttributes<'div'>;\n};\n\nconst DrawerBody = ({\n children,\n className = '',\n htmlAttributes,\n ...restProps\n}: DrawerBodyProps) => {\n const classes = classNames('ndl-drawer-body', className);\n\n return (\n <div className=\"ndl-drawer-body-wrapper\">\n <div className={classes} {...restProps} {...htmlAttributes}>\n {children}\n </div>\n </div>\n );\n};\n\nconst Drawer = Object.assign(DrawerComponent, {\n Actions: DrawerActions,\n Body: DrawerBody,\n Header: DrawerHeader,\n});\n\nexport { Drawer };\n"]}
|
|
1
|
+
{"version":3,"file":"Drawer.js","sourceRoot":"","sources":["../../../src/drawer/Drawer.tsx"],"names":[],"mappings":";;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,EAAE,SAAS,EAAuB,MAAM,cAAc,CAAC;AAE9D,OAAO,EAAuB,WAAW,EAAE,MAAM,OAAO,CAAC;AAMzD,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,eAAe,EA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L,CACP,CAAC;AACJ,CAAC,CAAC;AAQF,MAAM,UAAU,GAAG,CAAC,EAKF,EAAE,EAAE;QALF,EAClB,QAAQ,EACR,SAAS,GAAG,EAAE,EACd,cAAc,OAEE,EADb,SAAS,cAJM,2CAKnB,CADa;IAEZ,MAAM,OAAO,GAAG,UAAU,CAAC,iBAAiB,EAAE,SAAS,CAAC,CAAC;IAEzD,OAAO,CACL,cAAK,SAAS,EAAC,yBAAyB,YACtC,4BAAK,SAAS,EAAE,OAAO,IAAM,SAAS,EAAM,cAAc,cACvD,QAAQ,IACL,GACF,CACP,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,eAAe,EAAE;IAC5C,OAAO,EAAE,aAAa;IACtB,IAAI,EAAE,UAAU;IAChB,MAAM,EAAE,YAAY;CACrB,CAAC,CAAC;AAEH,OAAO,EAAE,MAAM,EAAE,CAAC","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 { FloatingPortal } from '@floating-ui/react';\nimport classNames from 'classnames';\nimport { Resizable, type ResizableProps } from 're-resizable';\nimport type React from 'react';\nimport { type ComponentProps, useCallback } from 'react';\n\nimport {\n type HtmlAttributes,\n type PolymorphicCommonProps,\n} from '../_common/types';\nimport { CleanIconButton } from '../clean-icon-button';\nimport { ConditionalWrap } from '../conditional-wrap';\nimport { XMarkIconOutline } from '../icons';\nimport { Typography } from '../typography';\n\ntype DrawerPosition = 'left' | 'right';\n\ntype DrawerType = 'overlay' | 'push';\n\ntype DrawerProps = {\n /** Controls whether the drawer is open (expanded) or closed (collapsed). */\n isExpanded: boolean;\n\n /** Callback functions fired when the drawer's expanded state changes. */\n onExpandedChange?: (expanded: boolean) => void;\n\n /** Position where the drawer appears on screen. By default, it appears from the left. */\n position?: DrawerPosition;\n\n /** How the drawer affects the layout of sibling content. By default, it overlays content. */\n type?: DrawerType;\n\n /** Enables horizontal resizing of the drawer, by default it is not resizable. */\n isResizeable?: boolean;\n\n /** To use this prop the isResizeable prop must be set to true. For overriding the third party library props: https://github.com/bokuweb/re-resizable */\n resizeableProps?: ResizableProps;\n\n /** Whether a close button (X) is displayed in the drawer. */\n isCloseable?: boolean;\n\n /** Whether to portal the content */\n isPortaled?: boolean;\n\n /** The content to display within the drawer. */\n children: React.ReactNode;\n\n /** Additional CSS classes to apply to the drawer container. */\n className?: string;\n\n /**\n * Props to pass to the portal from @floating-ui/react FloatingPortal\n * @see https://floating-ui.com/docs/floatingportal\n */\n portalProps?: ComponentProps<typeof FloatingPortal>;\n};\n\nconst DrawerComponent = function DrawerComponent<\n T extends React.ElementType = 'div',\n>({\n children,\n className = '',\n isExpanded,\n onExpandedChange,\n position = 'left',\n type = 'overlay',\n isResizeable = false,\n resizeableProps,\n isCloseable = true,\n isPortaled = false,\n portalProps = {},\n htmlAttributes,\n style,\n ref,\n as,\n ...restProps\n}: PolymorphicCommonProps<T, DrawerProps>) {\n const setOnExpandedChange = useCallback(() => {\n if (onExpandedChange) {\n onExpandedChange(!isExpanded);\n }\n }, [isExpanded, onExpandedChange]);\n\n const classes = classNames('ndl-drawer', className, {\n 'ndl-drawer-expanded': isExpanded,\n 'ndl-drawer-left': position === 'left',\n 'ndl-drawer-overlay': type === 'overlay',\n 'ndl-drawer-push': type === 'push',\n 'ndl-drawer-right': position === 'right',\n });\n\n const resizableStylePosition = type === 'overlay' ? 'absolute' : 'relative';\n const shouldRenderInPortal = isPortaled && type === 'overlay';\n const Component = as ?? 'div';\n\n const Close = () => (\n <>\n {isCloseable && (\n <CleanIconButton\n className=\"ndl-drawer-close-button\"\n onClick={setOnExpandedChange}\n description={null}\n size=\"medium\"\n htmlAttributes={{\n 'aria-label': 'Close',\n }}\n >\n <XMarkIconOutline />\n </CleanIconButton>\n )}\n </>\n );\n\n if (isResizeable) {\n return (\n <ConditionalWrap\n shouldWrap={shouldRenderInPortal}\n wrap={(wrapChildren) => (\n <FloatingPortal preserveTabOrder={true} {...portalProps}>\n {wrapChildren}\n </FloatingPortal>\n )}\n >\n <Resizable\n as={Component}\n defaultSize={{\n height: '100%',\n width: 'auto',\n }}\n {...resizeableProps}\n className={classes}\n style={{\n position: resizableStylePosition,\n ...style,\n ...resizeableProps?.style,\n }}\n boundsByDirection={true}\n bounds=\"parent\"\n handleStyles={{\n /*\n * adding a small offset to the handle to make it easier to click\n * if the content of the drawer is scrollable, most noticeable if not using\n * a mouse on mac or chrome on windows with the fluent scrollbars\n */\n right: {\n right: '-8px',\n },\n }}\n enable={{\n bottom: false,\n bottomLeft: false,\n bottomRight: false,\n left: position === 'right',\n right: position === 'left',\n top: false,\n topLeft: false,\n topRight: false,\n }}\n ref={ref}\n {...restProps}\n {...htmlAttributes}\n >\n {children}\n <Close />\n </Resizable>\n </ConditionalWrap>\n );\n }\n\n return (\n <ConditionalWrap\n shouldWrap={shouldRenderInPortal}\n wrap={(wrapChildren) => (\n <FloatingPortal preserveTabOrder={true} {...portalProps}>\n {wrapChildren}\n </FloatingPortal>\n )}\n >\n <Component\n className={classes}\n style={style}\n ref={ref}\n {...restProps}\n {...htmlAttributes}\n >\n {children}\n <Close />\n </Component>\n </ConditionalWrap>\n );\n};\n\nDrawerComponent.displayName = 'Drawer';\n\ntype DrawerHeaderProps = {\n children: React.ReactNode;\n className?: string;\n htmlAttributes?: HtmlAttributes<'h5'>;\n};\n\nconst DrawerHeader = ({\n children,\n className = '',\n htmlAttributes,\n ...restProps\n}: DrawerHeaderProps) => {\n const classes = classNames('ndl-drawer-header', className);\n\n if (typeof children === 'string' || typeof children === 'number') {\n return (\n <Typography\n className={classes}\n variant=\"title-3\"\n {...restProps}\n {...htmlAttributes}\n >\n {children}\n </Typography>\n );\n }\n\n return (\n <div className={classes} {...restProps} {...htmlAttributes}>\n {children}\n </div>\n );\n};\n\ntype DrawerActionsProps = {\n children: React.ReactNode;\n className?: string;\n htmlAttributes?: HtmlAttributes<'div'>;\n};\n\nconst DrawerActions = ({\n children,\n className = '',\n htmlAttributes,\n ...restProps\n}: DrawerActionsProps) => {\n const classes = classNames('ndl-drawer-actions', className);\n\n return (\n <div className={classes} {...restProps} {...htmlAttributes}>\n {children}\n </div>\n );\n};\n\ntype DrawerBodyProps = {\n children: React.ReactNode;\n className?: string;\n htmlAttributes?: HtmlAttributes<'div'>;\n};\n\nconst DrawerBody = ({\n children,\n className = '',\n htmlAttributes,\n ...restProps\n}: DrawerBodyProps) => {\n const classes = classNames('ndl-drawer-body', className);\n\n return (\n <div className=\"ndl-drawer-body-wrapper\">\n <div className={classes} {...restProps} {...htmlAttributes}>\n {children}\n </div>\n </div>\n );\n};\n\nconst Drawer = Object.assign(DrawerComponent, {\n Actions: DrawerActions,\n Body: DrawerBody,\n Header: DrawerHeader,\n});\n\nexport { Drawer };\n"]}
|
|
@@ -33,7 +33,9 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
33
33
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
34
34
|
import { IconButtonBase } from '../icon-button-base';
|
|
35
35
|
export const IconButton = (_a) => {
|
|
36
|
-
var { children, as, isLoading = false, isDisabled = false, size = 'medium', isFloating = false,
|
|
36
|
+
var { children, as, isLoading = false, isDisabled = false, size = 'medium', isFloating = false,
|
|
37
|
+
// Does not have a default value to avoid setting aria-pressed to true if not explicitly set
|
|
38
|
+
isActive, variant = 'neutral', description, tooltipProps, className, style, htmlAttributes, onClick, ref } = _a, restProps = __rest(_a, ["children", "as", "isLoading", "isDisabled", "size", "isFloating", "isActive", "variant", "description", "tooltipProps", "className", "style", "htmlAttributes", "onClick", "ref"]);
|
|
37
39
|
return (_jsx(IconButtonBase, Object.assign({ as: as, iconButtonVariant: "default", isDisabled: isDisabled, size: size, isLoading: isLoading, isActive: isActive, isFloating: isFloating, description: description, tooltipProps: tooltipProps, className: className, style: style, variant: variant, htmlAttributes: htmlAttributes, onClick: onClick, ref: ref }, restProps, { children: children })));
|
|
38
40
|
};
|
|
39
41
|
//# sourceMappingURL=IconButton.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IconButton.js","sourceRoot":"","sources":["../../../src/icon-button/IconButton.tsx"],"names":[],"mappings":";;;;;;;;;;;;AAuBA,OAAO,EAAE,cAAc,EAA4B,MAAM,qBAAqB,CAAC;AAI/E,MAAM,CAAC,MAAM,UAAU,GAAG,CAAyC,
|
|
1
|
+
{"version":3,"file":"IconButton.js","sourceRoot":"","sources":["../../../src/icon-button/IconButton.tsx"],"names":[],"mappings":";;;;;;;;;;;;AAuBA,OAAO,EAAE,cAAc,EAA4B,MAAM,qBAAqB,CAAC;AAI/E,MAAM,CAAC,MAAM,UAAU,GAAG,CAAyC,EAkBhB,EAAE,EAAE;QAlBY,EACjE,QAAQ,EACR,EAAE,EACF,SAAS,GAAG,KAAK,EACjB,UAAU,GAAG,KAAK,EAClB,IAAI,GAAG,QAAQ,EACf,UAAU,GAAG,KAAK;IAClB,4FAA4F;IAC5F,QAAQ,EACR,OAAO,GAAG,SAAS,EACnB,WAAW,EACX,YAAY,EACZ,SAAS,EACT,KAAK,EACL,cAAc,EACd,OAAO,EACP,GAAG,OAE8C,EAD9C,SAAS,cAjBqD,mLAkBlE,CADa;IAEZ,OAAO,CACL,KAAC,cAAc,kBACb,EAAE,EAAE,EAAE,EACN,iBAAiB,EAAC,SAAS,EAC3B,UAAU,EAAE,UAAU,EACtB,IAAI,EAAE,IAAI,EACV,SAAS,EAAE,SAAS,EACpB,QAAQ,EAAE,QAAQ,EAClB,UAAU,EAAE,UAAU,EACtB,WAAW,EAAE,WAAW,EACxB,YAAY,EAAE,YAAY,EAC1B,SAAS,EAAE,SAAS,EACpB,KAAK,EAAE,KAAK,EACZ,OAAO,EAAE,OAAO,EAChB,cAAc,EAAE,cAAc,EAC9B,OAAO,EAAE,OAAO,EAChB,GAAG,EAAE,GAAG,IACJ,SAAS,cAEZ,QAAQ,IACM,CAClB,CAAC;AACJ,CAAC,CAAC","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 type React from 'react';\n\nimport { type PolymorphicCommonProps } from '../_common/types';\nimport { IconButtonBase, type IconButtonBaseProps } from '../icon-button-base';\n\ntype IconButtonButtonProps = Omit<IconButtonBaseProps, 'iconButtonVariant'>;\n\nexport const IconButton = <T extends React.ElementType = 'button'>({\n children,\n as,\n isLoading = false,\n isDisabled = false,\n size = 'medium',\n isFloating = false,\n // Does not have a default value to avoid setting aria-pressed to true if not explicitly set\n isActive,\n variant = 'neutral',\n description,\n tooltipProps,\n className,\n style,\n htmlAttributes,\n onClick,\n ref,\n ...restProps\n}: PolymorphicCommonProps<T, IconButtonButtonProps>) => {\n return (\n <IconButtonBase\n as={as}\n iconButtonVariant=\"default\"\n isDisabled={isDisabled}\n size={size}\n isLoading={isLoading}\n isActive={isActive}\n isFloating={isFloating}\n description={description}\n tooltipProps={tooltipProps}\n className={className}\n style={style}\n variant={variant}\n htmlAttributes={htmlAttributes}\n onClick={onClick}\n ref={ref}\n {...restProps}\n >\n {children}\n </IconButtonBase>\n );\n};\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Banner.d.ts","sourceRoot":"","sources":["../../../src/banner/Banner.tsx"],"names":[],"mappings":"AAqBA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EACL,KAAK,WAAW,EAChB,KAAK,sBAAsB,EAC5B,MAAM,kBAAkB,CAAC;AAW1B;;;;;;GAMG;AAEH,KAAK,iBAAiB,GAAG;IACvB,gFAAgF;IAChF,OAAO,CAAC,EAAE,OAAO,CAAC;IAElB,yCAAyC;IACzC,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAE3B,iFAAiF;IACjF,OAAO,CAAC,EAAE,OAAO,CAAC;IAElB,8BAA8B;IAC9B,KAAK,CAAC,EAAE,QAAQ,GAAG,QAAQ,CAAC;IAE5B,gCAAgC;IAChC,OAAO,CAAC,EAAE,aAAa,CAAC;CACzB,CAAC;AAEF,KAAK,oBAAoB,GAAG;IAC1B,iFAAiF;IACjF,WAAW,EAAE,IAAI,CAAC;IAElB,uDAAuD;IACvD,OAAO,EAAE,CACP,CAAC,CAAC,EAAE,KAAK,CAAC,UAAU,CAAC,WAAW,CAAC,GAAG,KAAK,CAAC,aAAa,CAAC,WAAW,CAAC,KACjE,IAAI,CAAC;CACX,CAAC;AAEF,KAAK,uBAAuB,GAAG;IAC7B,WAAW,CAAC,EAAE,KAAK,CAAC;IACpB,OAAO,CAAC,EAAE,KAAK,CAAC;CACjB,CAAC;AAEF,KAAK,gBAAgB,GAAG,oBAAoB,GAAG,uBAAuB,CAAC;AAEvE,KAAK,WAAW,GAAG,iBAAiB,GAAG,gBAAgB,CAAC;AACxD,KAAK,aAAa,GAAG,MAAM,GAAG,SAAS,GAAG,SAAS,GAAG,QAAQ,GAAG,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"Banner.d.ts","sourceRoot":"","sources":["../../../src/banner/Banner.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,WAAW,CAAC,KAAK,EAAE;QAAE,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;KAAE,CAAC;gFAxBjD,WAAW,CAAC,MAAM,EAAE;QAAE,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;KAAE,CAAC;CA+HnD,CAAC;AAEH,OAAO,EAAE,MAAM,EAAE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CleanIconButton.d.ts","sourceRoot":"","sources":["../../../src/clean-icon-button/CleanIconButton.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,KAAK,sBAAsB,EAAE,MAAM,kBAAkB,CAAC;AAC/D,OAAO,EAAkB,KAAK,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAE/E,KAAK,0BAA0B,GAAG,IAAI,CACpC,mBAAmB,EACnB,mBAAmB,GAAG,YAAY,CACnC,CAAC;AAEF,eAAO,MAAM,eAAe,GAAI,CAAC,SAAS,KAAK,CAAC,WAAW,GAAG,QAAQ,EAAE,
|
|
1
|
+
{"version":3,"file":"CleanIconButton.d.ts","sourceRoot":"","sources":["../../../src/clean-icon-button/CleanIconButton.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,KAAK,sBAAsB,EAAE,MAAM,kBAAkB,CAAC;AAC/D,OAAO,EAAkB,KAAK,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAE/E,KAAK,0BAA0B,GAAG,IAAI,CACpC,mBAAmB,EACnB,mBAAmB,GAAG,YAAY,CACnC,CAAC;AAEF,eAAO,MAAM,eAAe,GAAI,CAAC,SAAS,KAAK,CAAC,WAAW,GAAG,QAAQ,EAAE,2JAiBrE,sBAAsB,CAAC,CAAC,EAAE,0BAA0B,CAAC,4CAsBvD,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Dialog.d.ts","sourceRoot":"","sources":["../../../src/dialog/Dialog.tsx"],"names":[],"mappings":"AAqBA,OAAO,KAAqC,MAAM,OAAO,CAAC;AAE1D,OAAO,EACL,KAAK,WAAW,EAChB,KAAK,sBAAsB,EAC5B,MAAM,kBAAkB,CAAC;AAe1B,OAAO,EACL,KAAK,kBAAkB,EAEvB,KAAK,kBAAkB,EACvB,KAAK,sBAAsB,EAC3B,KAAK,iBAAiB,EACtB,KAAK,gBAAgB,EACrB,KAAK,WAAW,EAChB,KAAK,mBAAmB,EACzB,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"Dialog.d.ts","sourceRoot":"","sources":["../../../src/dialog/Dialog.tsx"],"names":[],"mappings":"AAqBA,OAAO,KAAqC,MAAM,OAAO,CAAC;AAE1D,OAAO,EACL,KAAK,WAAW,EAChB,KAAK,sBAAsB,EAC5B,MAAM,kBAAkB,CAAC;AAe1B,OAAO,EACL,KAAK,kBAAkB,EAEvB,KAAK,kBAAkB,EACvB,KAAK,sBAAsB,EAC3B,KAAK,iBAAiB,EACtB,KAAK,gBAAgB,EACrB,KAAK,WAAW,EAChB,KAAK,mBAAmB,EACzB,MAAM,gBAAgB,CAAC;AAkUxB,QAAA,MAAM,MAAM,qJA9RT,WAAW,CAAC,KAAK,EAAE,WAAW,CAAC;cAgGjB,CAAC,SAAS,KAAK,CAAC,WAAW,iFAQzC,sBAAsB,CAAC,CAAC,EAAE,kBAAkB,CAAC;cAqI/B,CAAC,SAAS,KAAK,CAAC,WAAW,iFAQzC,sBAAsB,CAAC,CAAC,EAAE,kBAAkB,CAAC;kBAjC3B,CAAC,SAAS,KAAK,CAAC,WAAW,iFAQ7C,sBAAsB,CAAC,CAAC,EAAE,sBAAsB,CAAC;aAnEpC,CAAC,SAAS,KAAK,CAAC,WAAW,kFAQxC,sBAAsB,CAAC,CAAC,EAAE,iBAAiB,CAAC;+EA6G5C,WAAW,CAAC,KAAK,EAAE,gBAAgB,CAAC;eAnFrB,CAAC,SAAS,KAAK,CAAC,WAAW,iFAQ1C,sBAAsB,CAAC,CAAC,EAAE,mBAAmB,CAAC;CAkG/C,CAAC;AAEH,OAAO,EAAE,MAAM,EAAE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IconButton.d.ts","sourceRoot":"","sources":["../../../src/icon-button/IconButton.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,KAAK,sBAAsB,EAAE,MAAM,kBAAkB,CAAC;AAC/D,OAAO,EAAkB,KAAK,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAE/E,KAAK,qBAAqB,GAAG,IAAI,CAAC,mBAAmB,EAAE,mBAAmB,CAAC,CAAC;AAE5E,eAAO,MAAM,UAAU,GAAI,CAAC,SAAS,KAAK,CAAC,WAAW,GAAG,QAAQ,EAAE,
|
|
1
|
+
{"version":3,"file":"IconButton.d.ts","sourceRoot":"","sources":["../../../src/icon-button/IconButton.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,KAAK,sBAAsB,EAAE,MAAM,kBAAkB,CAAC;AAC/D,OAAO,EAAkB,KAAK,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAE/E,KAAK,qBAAqB,GAAG,IAAI,CAAC,mBAAmB,EAAE,mBAAmB,CAAC,CAAC;AAE5E,eAAO,MAAM,UAAU,GAAI,CAAC,SAAS,KAAK,CAAC,WAAW,GAAG,QAAQ,EAAE,uKAkBhE,sBAAsB,CAAC,CAAC,EAAE,qBAAqB,CAAC,4CAuBlD,CAAC"}
|