koval-ui
Version:
React components collection with minimalistic design. Supports theming, layout, and input validation.
34 lines (33 loc) • 1.04 kB
JavaScript
"use client";
import { jsx as s } from "react/jsx-runtime";
import { forwardRef as u, useMemo as a } from "react";
import N from "classnames";
import { useLocalTheme as L } from "css-vars-hook";
import { useBrowserLocale as h } from "../../internal/locale/useBrowserLocale.js";
import { useLinkRefs as w } from "../../internal/hooks/useLinkRefs.js";
import m from "./Flag.module.css.js";
import { flagsDictionary as y } from "./flagsDictionary.js";
const R = u(
({ className: t, countryCode: o, size: e = 24, ...l }, c) => {
const { LocalRoot: i, ref: n } = L(), f = a(() => ({ size: e }), [e]);
w(c, n);
const p = y[o], r = h(), g = a(
() => new Intl.DisplayNames(r, { type: "region" }).of(o),
[o, r]
);
return /* @__PURE__ */ s(
i,
{
...l,
theme: f,
className: N(m.container, t),
children: /* @__PURE__ */ s("span", { className: m.flag, title: g, children: p })
}
);
}
);
R.displayName = "Flag";
export {
R as Flag
};
//# sourceMappingURL=Flag.js.map