UNPKG

@progress/kendo-react-dialogs

Version:

React Dialogs provide modal and non-modal windows for showing additional information to the user. KendoReact Dialogs package

87 lines (86 loc) 3.1 kB
/** * @license *------------------------------------------------------------------------------------------- * Copyright © 2025 Progress Software Corporation. All rights reserved. * Licensed under commercial license. See LICENSE.md in the package root for more information *------------------------------------------------------------------------------------------- */ import * as e from "react"; import { windowStage as c } from "./StageEnum.mjs"; import { Button as a } from "@progress/kendo-react-buttons"; import { useLocalization as x } from "@progress/kendo-react-intl"; import { windowMinimizeIcon as I, windowIcon as L, windowRestoreIcon as M, xIcon as N } from "@progress/kendo-svg-icons"; import { dialogsWindowMinimizeButton as w, messages as l, dialogsWindowMaximizeButton as u, dialogsWindowRestoreButton as g, dialogsWindowCloseButton as B } from "./messages/index.mjs"; const v = (t) => { const { children: o, onCloseButtonClick: r, onMinimizeButtonClick: m, onFullScreenButtonClick: s, onRestoreButtonClick: d, onDoubleClick: f, stage: n, forwardedRef: k, id: C } = t, i = x(), E = t.minimizeButton ? /* @__PURE__ */ e.createElement(t.minimizeButton, { onClick: m, stage: n }) : /* @__PURE__ */ e.createElement( a, { fillMode: "flat", icon: "window-minimize", svgIcon: I, className: "k-window-titlebar-action", onClick: m, "aria-label": i.toLanguageString( w, l[w] ) } ), z = t.maximizeButton ? /* @__PURE__ */ e.createElement(t.maximizeButton, { onClick: s, stage: n }) : /* @__PURE__ */ e.createElement( a, { fillMode: "flat", icon: "window-maximize", svgIcon: L, className: "k-window-titlebar-action", onClick: s, "aria-label": i.toLanguageString( u, l[u] ) } ), b = t.restoreButton ? /* @__PURE__ */ e.createElement(t.restoreButton, { onClick: d, stage: n }) : /* @__PURE__ */ e.createElement( a, { fillMode: "flat", icon: "window-restore", svgIcon: M, className: "k-window-titlebar-action", onClick: d, "aria-label": i.toLanguageString(g, l[g]) } ), R = t.closeButton ? /* @__PURE__ */ e.createElement(t.closeButton, { onClick: r, stage: n }) : /* @__PURE__ */ e.createElement( a, { fillMode: "flat", icon: "x", svgIcon: N, className: "k-window-titlebar-action", onClick: r, "aria-label": i.toLanguageString(B, l[B]) } ); return /* @__PURE__ */ e.createElement( "div", { className: "k-window-titlebar", style: { touchAction: "none" }, ref: k, onDoubleClick: f }, /* @__PURE__ */ e.createElement("span", { className: "k-window-title", id: C }, o || ""), /* @__PURE__ */ e.createElement("div", { className: "k-window-titlebar-actions" }, n === c.DEFAULT && E, n === c.DEFAULT && z, n !== c.DEFAULT && b, R) ); }, F = e.forwardRef((t, o) => /* @__PURE__ */ e.createElement(v, { ...t, forwardedRef: o })); export { F as WindowTitleBar };