UNPKG

@navikt/ds-react

Version:

React components from the Norwegian Labour and Welfare Administration.

40 lines 1.82 kB
var __rest = (this && this.__rest) || function (s, e) { var t = {}; for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p]; if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]]; } return t; }; import React, { forwardRef } from "react"; import { XMarkIcon } from "@navikt/aksel-icons"; import { Button } from "../../button/index.js"; import { cl } from "../../utils/helpers/index.js"; import { useI18n } from "../../utils/i18n/i18n.hooks.js"; import { DialogCloseTrigger } from "../close-trigger/DialogCloseTrigger.js"; /** * @see 🏷️ {@link DialogHeaderProps} * @example * ```jsx * <Dialog> * <Dialog.Popup> * <Dialog.Header> * <Dialog.Title>Dialog title</Dialog.Title> * </Dialog.Header> * </Dialog.Popup> * </Dialog> * ``` */ const DialogHeader = forwardRef((_a, forwardedRef) => { var { className, children, withClosebutton = true } = _a, restProps = __rest(_a, ["className", "children", "withClosebutton"]); const translate = useI18n("global"); return (React.createElement("div", Object.assign({}, restProps, { ref: forwardedRef, className: cl("aksel-dialog__header", className) }), withClosebutton && (React.createElement(DialogCloseTrigger, null, React.createElement(Button, { type: "button", className: "aksel-dialog__close-button", size: "small", variant: "tertiary-neutral", icon: React.createElement(XMarkIcon, { title: translate("close") }) }))), children)); }); export { DialogHeader }; //# sourceMappingURL=DialogHeader.js.map