@crossed/demo
Version:
A universal & performant styling library for React Native, Next.js & React
74 lines (73 loc) • 3.54 kB
JavaScript
;
var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
// If the importer is in node compatibility mode or this is not an ESM
// file that has been converted to a CommonJS file using a Babel-
// compatible transform (i.e. "__esModule" has not been set), then set
// "default" to the CommonJS "module.exports" for node compatibility.
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
mod
));
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var unicons_exports = {};
__export(unicons_exports, {
UniconsDemo: () => UniconsDemo
});
module.exports = __toCommonJS(unicons_exports);
var import_jsx_runtime = require("react/jsx-runtime");
var import_ui = require("@crossed/ui");
var Icons = __toESM(require("@crossed/unicons"));
var import_fuse = __toESM(require("fuse.js"));
var import_react = require("react");
const UniconsDemo = () => {
const iconsKey = Object.keys(Icons);
const [search, setSearch] = (0, import_react.useState)("");
const fuse = (0, import_react.useMemo)(() => {
return new import_fuse.default(iconsKey, {});
}, [iconsKey]);
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_ui.YBox, { className: "w-full", children: [
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ui.Input, { value: search, onChangeValue: setSearch, size: "lg", children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_ui.Input.Content, { children: [
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ui.Input.Input, { placeholder: "Search..." }),
search && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ui.Input.Icon, { onPress: () => setSearch(""), children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Icons.UilTimes, {}) })
] }) }),
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ui.XBox, { className: "flex-wrap justify-center gap-y-10", space: "xl", children: (search ? fuse.search(search).map(({ item }) => item) : iconsKey).map(
(name) => {
const Icon = Icons[name];
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
import_ui.YBox,
{
space: "sm",
className: "basis-2/12 items-center rounded-md py-5",
children: [
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Icon, { size: 32 }),
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ui.Text, { className: "dark:text-neutral-500", children: name })
]
},
name
);
}
) })
] });
};
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
UniconsDemo
});
//# sourceMappingURL=unicons.js.map