import { _objectSpread2 } from "../../_virtual/_@oxc-project_runtime@0.122.0/helpers/objectSpread2.js";
import { _objectWithoutProperties } from "../../_virtual/_@oxc-project_runtime@0.122.0/helpers/objectWithoutProperties.js";
import { generateColorShades } from "./utils.js";
import React, { useMemo } from "react";
import classNames from "classnames";
import "./index.less";
//#region src/components/pisellTags/index.tsx
const _excluded = [
	"children",
	"type",
	"icon",
	"color",
	"style",
	"others"
];
const pisellTagsColors = {
	success: "#067647",
	warning: "#B54708",
	error: "#B42318",
	gray: "#344054"
};
/**
* @title: 获取颜色
* @description:
* @param {PisellTagsColor} _color
* @return {*}
* @Author: zhiwei.Wang
* @Date: 2024-08-23 16:07
*/
const getColor = (_color) => {
	if (_color) return pisellTagsColors[_color] || _color;
	return "#344054";
};
const getPillColorStyles = (_color) => {
	const colorShades = generateColorShades(_color);
	return {
		"--pisell-tags-bg-color": colorShades["color_50"],
		"--pisell-tags-font-color": colorShades["color_700"],
		"--pisell-tags-border-color": colorShades["color_200"]
	};
};
const getPillOutlineStyles = (_color) => {
	const colorShades = generateColorShades(_color);
	return {
		"--pisell-tags-bg-color": "transparent",
		"--pisell-tags-font-color": colorShades["color_700"],
		"--pisell-tags-border-color": colorShades["color_600"]
	};
};
const PisellTags = (props) => {
	const { children, type, icon, color, style = {}, others = {} } = props, otherProps = _objectWithoutProperties(props, _excluded);
	const styles = useMemo(() => {
		let obj = _objectSpread2(_objectSpread2({}, style), others.style);
		const _color = getColor(props.color);
		if (type === "pill_color") obj = _objectSpread2(_objectSpread2({}, obj), getPillColorStyles(_color));
		if (type === "pill_outline") obj = _objectSpread2(_objectSpread2({}, obj), getPillOutlineStyles(_color));
		return obj;
	}, [
		color,
		style,
		others.style,
		type
	]);
	return /* @__PURE__ */ React.createElement("span", _objectSpread2(_objectSpread2(_objectSpread2({ style: _objectSpread2(_objectSpread2({}, styles), style) }, others), otherProps), {}, { className: classNames("pisell-tags", others.className, otherProps.className) }), icon ? icon : null, children);
};
//#endregion
export { PisellTags as default };
