import { cx as e } from "../../../theme/tools.js";
import { Input as t } from "../../../atomic/atoms/input/Input.js";
import { BackofficeEmptyState as n } from "../backoffice_empty_state/BackofficeEmptyState.js";
import { layout as r, list as i, listItem as a, row as o, rowMeta as s, rowSubtitle as c, rowText as l, rowTitle as u } from "./backofficePicker.css.js";
import { useId as d } from "react";
import { Fragment as f, jsx as p, jsxs as m } from "react/jsx-runtime";
import { useTranslation as h } from "react-i18next";
//#region src/backoffice/molecules/backoffice_picker/BackofficePicker.tsx
var g = ({ searchValue: n, onSearchChange: i, searchEnabled: a = !0, searchPlaceholder: o, searchAriaLabel: s, searchName: c = "backoffice-picker-search", children: l, className: u }) => {
	let { t: f } = h("ui"), g = d(), _ = o ?? f("backoffice.picker.searchPlaceholder"), v = s ?? f("backoffice.picker.searchAriaLabel"), y = null;
	return a && (y = /* @__PURE__ */ p(t, {
		id: g,
		name: c,
		value: n,
		onChange: (e) => {
			i(e.target.value);
		},
		placeholder: _,
		"aria-label": v,
		size: "small",
		fullWidth: !0
	})), /* @__PURE__ */ m("div", {
		className: e(r, u),
		children: [y, l]
	});
}, _ = ({ title: e, subtitle: t, meta: n }) => {
	let r = null;
	t != null && (r = /* @__PURE__ */ p("div", {
		className: c,
		children: t
	}));
	let i = null;
	return n != null && (i = /* @__PURE__ */ p("div", {
		className: s,
		children: n
	})), /* @__PURE__ */ m("div", {
		className: o,
		children: [/* @__PURE__ */ m("div", {
			className: l,
			children: [/* @__PURE__ */ p("div", {
				className: u,
				children: e
			}), r]
		}), i]
	});
}, v = ({ items: t, onSelectItem: r, emptyState: o, ariaLabel: s, className: c }) => {
	let { t: l } = h("ui"), u = s ?? l("backoffice.picker.listAriaLabel");
	return t.length === 0 ? /* @__PURE__ */ p(f, { children: o ?? /* @__PURE__ */ p(n, {
		title: l("backoffice.picker.empty.title"),
		description: l("backoffice.picker.empty.description")
	}) }) : /* @__PURE__ */ p("div", {
		className: e(i, c),
		role: "listbox",
		"aria-label": u,
		children: t.map((e) => /* @__PURE__ */ p("button", {
			type: "button",
			className: a,
			role: "option",
			"aria-selected": "false",
			"aria-label": e.ariaLabel,
			disabled: e.disabled,
			onClick: () => {
				r(e);
			},
			children: /* @__PURE__ */ p(_, {
				title: e.title,
				subtitle: e.subtitle,
				meta: e.meta
			})
		}, e.id))
	});
};
//#endregion
export { v as BackofficePickerList, _ as BackofficePickerRow, g as BackofficePickerShell };

//# sourceMappingURL=BackofficePicker.js.map