'use client';
"use strict";
var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
  for (var name in all)
    __defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
  if (from && typeof from === "object" || typeof from === "function") {
    for (let key of __getOwnPropNames(from))
      if (!__hasOwnProp.call(to, key) && key !== except)
        __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
  }
  return to;
};
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
  // If the importer is in node compatibility mode or this is not an ESM
  // file that has been converted to a CommonJS file using a Babel-
  // compatible transform (i.e. "__esModule" has not been set), then set
  // "default" to the CommonJS "module.exports" for node compatibility.
  isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
  mod
));
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);

// src/components/Tabs/Tabs.tsx
var Tabs_exports = {};
__export(Tabs_exports, {
  Tabs: () => Tabs,
  TabsContent: () => TabsContent,
  TabsList: () => TabsList,
  TabsRoot: () => TabsRoot,
  TabsTrigger: () => TabsTrigger
});
module.exports = __toCommonJS(Tabs_exports);
var React = __toESM(require("react"), 1);
var import_lib = require("@paalan/react-shared/lib");
var TabsPrimitive = __toESM(require("@radix-ui/react-tabs"), 1);
var import_jsx_runtime = require("react/jsx-runtime");
var TabsRoot = TabsPrimitive.Root;
var TabsList = React.forwardRef(({ className, strip, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
  TabsPrimitive.List,
  {
    ref,
    className: (0, import_lib.cn)(
      "inline-flex items-center justify-center",
      {
        "h-9 rounded-lg  bg-muted p-1 text-muted-foreground": !strip,
        " border-b border-gray-300 bg-background text-foreground": strip
      },
      className
    ),
    ...props
  }
));
TabsList.displayName = TabsPrimitive.List.displayName;
var TabsTrigger = React.forwardRef(({ className, strip, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
  TabsPrimitive.Trigger,
  {
    ref,
    className: (0, import_lib.cn)(
      "inline-flex items-center justify-center whitespace-nowrap px-3 py-1 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",
      {
        "rounded-md data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow": !strip,
        "cursor-pointer py-2 outline-none hover:text-primary data-[state=active]:text-primary data-[state=active]:shadow-[inset_0_-1px_0_0,0_1px_0_0]": strip
      },
      className
    ),
    ...props
  }
));
TabsTrigger.displayName = TabsPrimitive.Trigger.displayName;
var TabsContent = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
  TabsPrimitive.Content,
  {
    ref,
    className: (0, import_lib.cn)(
      "mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",
      className
    ),
    ...props
  }
));
TabsContent.displayName = TabsPrimitive.Content.displayName;
var Tabs = React.forwardRef(
  ({
    activeTab: tab,
    onTabChange,
    tabs,
    tabListClassName,
    triggerClassName: allTriggerClassName,
    contentClassName: allContentClassName,
    strip = true,
    ...props
  }, ref) => {
    const [activeTab, setActiveTab] = React.useState(tab);
    React.useEffect(() => {
      setActiveTab(tab);
    }, [tab]);
    const onTabChangeHandle = (value) => {
      setActiveTab(value);
      onTabChange?.(value);
    };
    return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(TabsRoot, { ...props, value: activeTab, onValueChange: onTabChangeHandle, ref, children: [
      /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TabsList, { className: tabListClassName, strip, children: tabs.map(({ label, value, triggerClassName }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TabsTrigger, { value, className: (0, import_lib.cn)(allTriggerClassName, triggerClassName), strip, children: label }, value)) }),
      tabs.map(({ value, content, contentClassName }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(React.Fragment, { children: !!content && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TabsContent, { value, className: (0, import_lib.cn)(allContentClassName, contentClassName), children: content }) }, value))
    ] });
  }
);
