UNPKG

@lobehub/ui

Version:

Lobe UI is an open-source UI component library for building AIGC web apps

72 lines (69 loc) 2.02 kB
'use client'; import FlexBasic_default from "../Flex/FlexBasic.mjs"; import Text_default from "../Text/Text.mjs"; import { stopPropagation } from "../utils/dom.mjs"; import MaterialFileTypeIcon_default from "../MaterialFileTypeIcon/MaterialFileTypeIcon.mjs"; import { memo, useMemo } from "react"; import { jsx, jsxs } from "react/jsx-runtime"; import { Select } from "antd"; import { bundledLanguagesInfo } from "shiki"; //#region src/Highlighter/LangSelect.tsx const LangSelect = memo(({ ...rest }) => { return /* @__PURE__ */ jsx(Select, { className: "languageTitle", onClick: stopPropagation, options: useMemo(() => [{ aliases: ["text", "txt"], label: /* @__PURE__ */ jsxs(FlexBasic_default, { align: "center", gap: 4, horizontal: true, children: [/* @__PURE__ */ jsx(MaterialFileTypeIcon_default, { fallbackUnknownType: false, filename: `*.txt`, size: 18, type: "file", variant: "raw" }), /* @__PURE__ */ jsx(Text_default, { ellipsis: true, fontSize: 13, children: "Plaintext" })] }), value: "plaintext" }, ...bundledLanguagesInfo.map((item) => ({ aliases: item.aliases, label: /* @__PURE__ */ jsxs(FlexBasic_default, { align: "center", gap: 4, horizontal: true, children: [/* @__PURE__ */ jsx(MaterialFileTypeIcon_default, { fallbackUnknownType: false, filename: `*.${item?.aliases?.[0] || item.id}`, size: 18, type: "file", variant: "raw" }), /* @__PURE__ */ jsx(Text_default, { ellipsis: true, fontSize: 13, children: item.name })] }), title: (item.aliases || [item.id]).filter(Boolean).map((item$1) => `*.${item$1}`).join(","), value: item.id }))], []), showSearch: true, size: "small", style: { maxWidth: 240, width: "100%" }, suffixIcon: false, variant: "borderless", ...rest }); }); var LangSelect_default = LangSelect; //#endregion export { LangSelect_default as default }; //# sourceMappingURL=LangSelect.mjs.map