draft-components 1.11.0 → 1.12.0
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.
|
@@ -6,13 +6,13 @@ require('../button/button.cjs');
|
|
|
6
6
|
const iconButton = require('../button/icon-button.cjs');
|
|
7
7
|
const slideOverContext = require('./slide-over-context.cjs');
|
|
8
8
|
|
|
9
|
-
function SlideOverHeader({ className, htmlTitle, title, description, closeButtonAccessibleName, onClickCloseButton, ...props }) {
|
|
9
|
+
function SlideOverHeader({ className, htmlTitle, title, children, description, closeButtonAccessibleName, onClickCloseButton, ...props }) {
|
|
10
10
|
const { titleId, descriptionId, closePanel } = slideOverContext.useSlideOverContext();
|
|
11
11
|
const onCloseButtonClicked = (ev) => {
|
|
12
12
|
closePanel('close-button');
|
|
13
13
|
onClickCloseButton?.(ev);
|
|
14
14
|
};
|
|
15
|
-
return (jsxRuntime.jsxs("div", { className: reactHelpers.classNames('dc-slide-over-header', className), title: htmlTitle, ...props, children: [jsxRuntime.jsxs("div", { className: "dc-slide-over-header__title", children: [jsxRuntime.jsx("h2", { id: titleId, children: title }), jsxRuntime.jsx(iconButton.IconButton, { icon: jsxRuntime.jsx(XMarkIcon, {}), "aria-label": closeButtonAccessibleName, variant: "tinted", size: "xs", onClick: onCloseButtonClicked })] }), description ? (jsxRuntime.jsx("div", { id: descriptionId, className: "dc-slide-over-header__description", children: description })) : null] }));
|
|
15
|
+
return (jsxRuntime.jsxs("div", { className: reactHelpers.classNames('dc-slide-over-header', className), title: htmlTitle, ...props, children: [jsxRuntime.jsxs("div", { className: "dc-slide-over-header__title", children: [jsxRuntime.jsx("h2", { id: titleId, children: title }), jsxRuntime.jsx(iconButton.IconButton, { icon: jsxRuntime.jsx(XMarkIcon, {}), "aria-label": closeButtonAccessibleName, variant: "tinted", size: "xs", onClick: onCloseButtonClicked })] }), description ? (jsxRuntime.jsx("div", { id: descriptionId, className: "dc-slide-over-header__description", children: description })) : null, children ? (jsxRuntime.jsx("div", { className: "dc-slide-over-header__content", children: children })) : null] }));
|
|
16
16
|
}
|
|
17
17
|
function XMarkIcon(props) {
|
|
18
18
|
return (jsxRuntime.jsx("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", width: 20, height: 20, fill: "none", stroke: "currentColor", strokeWidth: 1.5, ...props, children: jsxRuntime.jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M6 18L18 6M6 6l12 12" }) }));
|
package/css/draft-components.css
CHANGED
|
@@ -1275,6 +1275,12 @@
|
|
|
1275
1275
|
margin-top: 4px;
|
|
1276
1276
|
}
|
|
1277
1277
|
|
|
1278
|
+
.dc-slide-over-header__content {
|
|
1279
|
+
font: var(--dc-text-md);
|
|
1280
|
+
color: var(--dc-slide-over-text-color);
|
|
1281
|
+
margin-top: 8px;
|
|
1282
|
+
}
|
|
1283
|
+
|
|
1278
1284
|
.dc-slide-over-body {
|
|
1279
1285
|
color: var(--dc-slide-over-text-color);
|
|
1280
1286
|
overflow: auto;
|
|
@@ -4,13 +4,13 @@ import '../button/button.js';
|
|
|
4
4
|
import { IconButton } from '../button/icon-button.js';
|
|
5
5
|
import { useSlideOverContext } from './slide-over-context.js';
|
|
6
6
|
|
|
7
|
-
function SlideOverHeader({ className, htmlTitle, title, description, closeButtonAccessibleName, onClickCloseButton, ...props }) {
|
|
7
|
+
function SlideOverHeader({ className, htmlTitle, title, children, description, closeButtonAccessibleName, onClickCloseButton, ...props }) {
|
|
8
8
|
const { titleId, descriptionId, closePanel } = useSlideOverContext();
|
|
9
9
|
const onCloseButtonClicked = (ev) => {
|
|
10
10
|
closePanel('close-button');
|
|
11
11
|
onClickCloseButton?.(ev);
|
|
12
12
|
};
|
|
13
|
-
return (jsxs("div", { className: classNames('dc-slide-over-header', className), title: htmlTitle, ...props, children: [jsxs("div", { className: "dc-slide-over-header__title", children: [jsx("h2", { id: titleId, children: title }), jsx(IconButton, { icon: jsx(XMarkIcon, {}), "aria-label": closeButtonAccessibleName, variant: "tinted", size: "xs", onClick: onCloseButtonClicked })] }), description ? (jsx("div", { id: descriptionId, className: "dc-slide-over-header__description", children: description })) : null] }));
|
|
13
|
+
return (jsxs("div", { className: classNames('dc-slide-over-header', className), title: htmlTitle, ...props, children: [jsxs("div", { className: "dc-slide-over-header__title", children: [jsx("h2", { id: titleId, children: title }), jsx(IconButton, { icon: jsx(XMarkIcon, {}), "aria-label": closeButtonAccessibleName, variant: "tinted", size: "xs", onClick: onCloseButtonClicked })] }), description ? (jsx("div", { id: descriptionId, className: "dc-slide-over-header__description", children: description })) : null, children ? (jsx("div", { className: "dc-slide-over-header__content", children: children })) : null] }));
|
|
14
14
|
}
|
|
15
15
|
function XMarkIcon(props) {
|
|
16
16
|
return (jsx("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", width: 20, height: 20, fill: "none", stroke: "currentColor", strokeWidth: 1.5, ...props, children: jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M6 18L18 6M6 6l12 12" }) }));
|
package/package.json
CHANGED
|
@@ -8,4 +8,4 @@ export type SlideOverHeaderProps = {
|
|
|
8
8
|
closeButtonAccessibleName?: string;
|
|
9
9
|
onClickCloseButton?: MouseEventHandler<HTMLButtonElement>;
|
|
10
10
|
} & SlideOverHeaderBaseProps;
|
|
11
|
-
export declare function SlideOverHeader({ className, htmlTitle, title, description, closeButtonAccessibleName, onClickCloseButton, ...props }: SlideOverHeaderProps): import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
export declare function SlideOverHeader({ className, htmlTitle, title, children, description, closeButtonAccessibleName, onClickCloseButton, ...props }: SlideOverHeaderProps): import("react/jsx-runtime").JSX.Element;
|