/*! © 2026 Yahoo, Inc. UDS v0.0.0-development */
"use client";
"use client";
import { jsx } from "react/jsx-runtime";
import { SelectValue as SelectValue$1, useSelectContext, useStoreState } from "@ariakit/react";
//#region src/components/client/Select/SelectValue.tsx
function normalizeSelectValue(value) {
	if (typeof value === "string") return value;
	return value.join(", ");
}
function SelectValue({ fallback, children, ...props }) {
	const select = useSelectContext();
	const storeValue = useStoreState(select, "value");
	const items = useStoreState(select, "items");
	const hasValue = storeValue != null && storeValue !== "";
	if (children) return /* @__PURE__ */ jsx(SelectValue$1, {
		fallback,
		...props,
		children: (value) => children(normalizeSelectValue(value))
	});
	if (!hasValue) return fallback ?? null;
	return (items?.find((item) => item.value === storeValue))?.element?.textContent ?? storeValue;
}
SelectValue.displayName = "SelectValue";
//#endregion
export { SelectValue };
