UNPKG

@lonli-lokli/react-mosaic-component

Version:
71 lines (69 loc) 2.91 kB
"use strict"; 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); // libs/react-mosaic-component/src/lib/util/OptionalBlueprint.tsx var OptionalBlueprint_exports = {}; __export(OptionalBlueprint_exports, { OptionalBlueprint: () => OptionalBlueprint }); module.exports = __toCommonJS(OptionalBlueprint_exports); var import_classnames = __toESM(require("classnames"), 1); var import_lodash_es = require("lodash-es"); var React = __toESM(require("react"), 1); var import_contextTypes = require("../contextTypes.cjs"); var OptionalBlueprint; ((OptionalBlueprint2) => { OptionalBlueprint2.Icon = ({ icon, className, size = "standard" }) => { const { blueprintNamespace } = React.useContext(import_contextTypes.MosaicContext); return /* @__PURE__ */ React.createElement( "span", { className: (0, import_classnames.default)( className, getIconClass(blueprintNamespace, icon), { [`${blueprintNamespace}-icon`]: size === "empty", [`${blueprintNamespace}-icon-${size}`]: size !== "empty" } ) } ); }; function getClasses(blueprintNamespace, ...names) { return names.map((name) => `${blueprintNamespace}-${(0, import_lodash_es.kebabCase)(name)}`).join(" "); } OptionalBlueprint2.getClasses = getClasses; function getIconClass(blueprintNamespace, iconName) { return `${blueprintNamespace}-icon-${(0, import_lodash_es.kebabCase)(iconName)}`; } OptionalBlueprint2.getIconClass = getIconClass; })(OptionalBlueprint || (OptionalBlueprint = {}));