import { a as IconSize, n as AnalyticsId, s as LanguageLocales } from "../../constants2.js";
import { t as Icon_default } from "../../Icon.js";
import { n as useLanguage } from "../../useLanguage.js";
import { t as X_default } from "../../X.js";
import classNames from "classnames";
import { jsx, jsxs } from "react/jsx-runtime";
import styles from "./styles.module.scss";
var HN_Designsystem_Chip_en_GB_default = { removeAriaLabel: "Remove" };
var HN_Designsystem_Chip_nb_NO_default = { removeAriaLabel: "Fjern" };
const getResources = (language) => {
	switch (language) {
		case LanguageLocales.ENGLISH: return HN_Designsystem_Chip_en_GB_default;
		case LanguageLocales.NORWEGIAN:
		default: return HN_Designsystem_Chip_nb_NO_default;
	}
};
var Chip = (props) => {
	const { children, onChipClick, onCloseClick, chipButtonProps, closeButtonProps, testId, withCloseButton = true, resources } = props;
	const { language } = useLanguage(LanguageLocales.NORWEGIAN);
	const defaultResources = getResources(language);
	const mergedResources = {
		...defaultResources,
		...resources,
		removeAriaLabel: closeButtonProps?.["aria-label"] || resources?.removeAriaLabel || `${defaultResources.removeAriaLabel} ${children}`
	};
	return /* @__PURE__ */ jsxs("div", {
		className: styles["chip"],
		children: [/* @__PURE__ */ jsx("button", {
			...chipButtonProps,
			className: classNames(styles["chip__chip"]),
			onClick: onChipClick,
			type: "button",
			"data-testid": testId,
			"data-analyticsid": AnalyticsId.Tag,
			children: /* @__PURE__ */ jsx("span", {
				className: classNames(styles["chip__chip__inner"], { [styles["chip__chip__inner--without-close"]]: !withCloseButton }),
				children
			})
		}), withCloseButton && /* @__PURE__ */ jsx("button", {
			...closeButtonProps,
			"aria-label": mergedResources.removeAriaLabel,
			className: classNames(styles["chip__close"]),
			onClick: onCloseClick,
			type: "button",
			"data-testid": `${testId}-close`,
			"data-analyticsid": AnalyticsId.Tag,
			children: /* @__PURE__ */ jsx("span", {
				className: styles["chip__close__inner"],
				children: /* @__PURE__ */ jsx(Icon_default, {
					svgIcon: X_default,
					size: IconSize.XXSmall
				})
			})
		})]
	});
};
var Chip_default = Chip;
export { Chip_default as default };

//# sourceMappingURL=index.js.map