"use strict";
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
require("react");
const Icons = require("../components/Icons/Icons.js");
const Button = require("../components/Button.js");
const emotionReactJsxRuntime_browser_esm = require("../node_modules/.pnpm/@emotion_react@11.10.4_q4mq7tnhdumujvomvw24zx33y4/node_modules/@emotion/react/jsx-runtime/dist/emotion-react-jsx-runtime.browser.esm.js");
require("../components/Tabs.js");
const useAppState = require("../lib/useAppState.js");
function PageTile({
  children,
  title,
  pageTitle,
  className,
  titleClassName,
  description,
  component = () => {
  },
  icon,
  subTitle,
  roles = {},
  buttons,
  back,
  onUpdate,
  onRead,
  onCreate,
  onAdd,
  onDelete,
  onLink,
  titleEdit,
  onTitleEdit,
  button,
  onButton,
  onSave,
  ...props
}) {
  const {
    navigate
  } = useAppState.useAppState();
  return /* @__PURE__ */ emotionReactJsxRuntime_browser_esm.jsxs("div", {
    className: "flex items-center justify-between " + (className ? className : "px-8 py-8"),
    children: [/* @__PURE__ */ emotionReactJsxRuntime_browser_esm.jsxs("div", {
      className: "flex items-center flex-1 min-w-0",
      children: [/* @__PURE__ */ emotionReactJsxRuntime_browser_esm.jsxs("div", {
        className: "flex flex-col flex-1",
        children: [back && /* @__PURE__ */ emotionReactJsxRuntime_browser_esm.jsx("div", {
          className: "mb-4 mr-4 sm:block",
          children: /* @__PURE__ */ emotionReactJsxRuntime_browser_esm.jsxs("button", {
            type: "button",
            onClick: (e) => back.url && navigate(back.url) || navigate(-1),
            className: "inline-flex items-center font-medium text-sky-600 hover:text-gray-800",
            children: [/* @__PURE__ */ emotionReactJsxRuntime_browser_esm.jsx(Icons.Icons, {
              name: "back"
            }), back.title || "\u8FD4\u56DE"]
          })
        }), /* @__PURE__ */ emotionReactJsxRuntime_browser_esm.jsxs("h1", {
          className: "flex items-center font-bold text-gray-900 sm:truncate " + (titleClassName ? titleClassName : " text-3xl"),
          children: [icon && /* @__PURE__ */ emotionReactJsxRuntime_browser_esm.jsx(Icons.Icons, {
            name: icon
          }), title || pageTitle]
        }), component({
          navigate
        }), description && /* @__PURE__ */ emotionReactJsxRuntime_browser_esm.jsx("p", {
          className: "mt-2 text-gray-400",
          children: description
        })]
      }), titleEdit && /* @__PURE__ */ emotionReactJsxRuntime_browser_esm.jsx("div", {
        className: "hidden ml-2 sm:block",
        children: /* @__PURE__ */ emotionReactJsxRuntime_browser_esm.jsxs("button", {
          type: "button",
          onClick: (e) => onTitleEdit(e),
          className: "inline-flex items-center px-4 py-2 text-sm font-medium text-gray-700 bg-white border border-gray-300 rounded-md shadow-sm hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-sky-500",
          children: [titleEdit.icon, titleEdit.title]
        })
      })]
    }), /* @__PURE__ */ emotionReactJsxRuntime_browser_esm.jsxs("div", {
      className: "flex items-center space-x-3 lg:ml-4",
      children: [buttons && buttons.map((item, index) => {
        return /* @__PURE__ */ emotionReactJsxRuntime_browser_esm.jsx(Button.Button, {
          ...item
        }, index);
      }), children]
    })]
  });
}
exports.PageTile = PageTile;
//# sourceMappingURL=PageTile.js.map
