Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
const require_chunk = require("../../chunk-CKQMccvm.cjs");
const require_ThemeProvider = require("../../ThemeProvider-0ytg6ico.cjs");
let clsx = require("clsx");
clsx = require_chunk.__toESM(clsx);
let lucide_react = require("lucide-react");
let react = require("react");
react = require_chunk.__toESM(react);
let react_jsx_runtime = require("react/jsx-runtime");
let _radix_ui_react_select = require("@radix-ui/react-select");
_radix_ui_react_select = require_chunk.__toESM(_radix_ui_react_select);
//#region src/components/Select/Select.tsx
const SelectSizeContext = (0, react.createContext)(null);
const useSelectSizeContext = () => (0, react.useContext)(SelectSizeContext);
const Select = ({ size = "md", ...props }) => {
	const [currentSize, setCurrentSize] = (0, react.useState)(size);
	(0, react.useEffect)(() => {
		setCurrentSize(size);
	}, [size]);
	const contextValue = (0, react.useMemo)(() => ({
		size: currentSize,
		setSize: setCurrentSize
	}), [currentSize]);
	return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SelectSizeContext.Provider, {
		value: contextValue,
		children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_radix_ui_react_select.Root, { ...props })
	});
};
const SelectGroup = (0, react.forwardRef)(({ className, style, ...props }, ref) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_radix_ui_react_select.Group, {
	ref,
	className: (0, clsx.default)("openui-select-group", className),
	style,
	...props
}));
const SelectValue = _radix_ui_react_select.Value;
const sizeMap = {
	sm: "openui-select-trigger-sm",
	md: "openui-select-trigger-md",
	lg: "openui-select-trigger-lg"
};
const SelectTrigger = (0, react.forwardRef)(({ className, style, children, hideDropdownIcon, size, ...props }, ref) => {
	const sizeContext = useSelectSizeContext();
	const resolvedSize = size ?? sizeContext?.size ?? "md";
	(0, react.useEffect)(() => {
		if (sizeContext && sizeContext.size !== resolvedSize) sizeContext.setSize(resolvedSize);
	}, [resolvedSize, sizeContext]);
	return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(_radix_ui_react_select.Trigger, {
		ref,
		className: (0, clsx.default)("openui-select-trigger", sizeMap[resolvedSize], className),
		style,
		...props,
		children: [children, /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_radix_ui_react_select.Icon, {
			asChild: true,
			children: !hideDropdownIcon && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.ChevronDown, { className: "openui-select-trigger-icon" })
		})]
	});
});
const SelectContent = (0, react.forwardRef)(({ className, children, position = "popper", ...props }, ref) => {
	const { portalThemeClassName } = require_ThemeProvider.useTheme();
	const sizeContext = useSelectSizeContext();
	return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_radix_ui_react_select.Portal, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_radix_ui_react_select.Content, {
		ref,
		className: (0, clsx.default)("openui-select-content", sizeContext && `openui-select-content-${sizeContext.size}`, className, portalThemeClassName),
		position,
		sideOffset: 2,
		...props,
		children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_radix_ui_react_select.Viewport, {
			className: "openui-select-viewport",
			"data-position": position,
			children
		})
	}) });
});
const SelectLabel = (0, react.forwardRef)(({ className, style, ...props }, ref) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_radix_ui_react_select.Label, {
	ref,
	className: (0, clsx.default)("openui-select-label", className),
	style,
	...props
}));
const SelectItem = (0, react.forwardRef)(({ className, style, children, showTick = true, textValue, ...props }, ref) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(_radix_ui_react_select.Item, {
	ref,
	className: (0, clsx.default)("openui-select-item", showTick ? "openui-select-item--with-tick" : "openui-select-item--without-tick", className),
	style,
	...props,
	children: [
		showTick && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
			className: "openui-select-item-check-wrapper",
			children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_radix_ui_react_select.ItemIndicator, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.Check, { className: "openui-select-item-check-icon" }) })
		}),
		/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_radix_ui_react_select.ItemText, {
			className: "openui-select-item-text",
			children
		}),
		textValue && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
			className: "openui-select-item-text-value",
			children: textValue
		})
	]
}));
const SelectSeparator = (0, react.forwardRef)(({ className, style, ...props }, ref) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_radix_ui_react_select.Separator, {
	ref,
	className: (0, clsx.default)("openui-select-separator", className),
	style,
	...props
}));
//#endregion
exports.Select = Select;
exports.SelectContent = SelectContent;
exports.SelectGroup = SelectGroup;
exports.SelectItem = SelectItem;
exports.SelectLabel = SelectLabel;
exports.SelectSeparator = SelectSeparator;
exports.SelectTrigger = SelectTrigger;
exports.SelectValue = SelectValue;

//# sourceMappingURL=index.cjs.map