Files
wdi-dashboard/node_modules/@chakra-ui/shared-utils/dist/index.js
2024-08-16 15:06:52 +05:30

79 lines
2.3 KiB
JavaScript

"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
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 __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
// src/index.ts
var src_exports = {};
__export(src_exports, {
ariaAttr: () => ariaAttr,
callAll: () => callAll,
callAllHandlers: () => callAllHandlers,
cx: () => cx,
dataAttr: () => dataAttr,
isObject: () => isObject,
runIfFn: () => runIfFn,
warn: () => warn
});
module.exports = __toCommonJS(src_exports);
var cx = (...classNames) => classNames.filter(Boolean).join(" ");
function isDev() {
return process.env.NODE_ENV !== "production";
}
function isObject(value) {
const type = typeof value;
return value != null && (type === "object" || type === "function") && !Array.isArray(value);
}
var warn = (options) => {
const { condition, message } = options;
if (condition && isDev()) {
console.warn(message);
}
};
function runIfFn(valueOrFn, ...args) {
return isFunction(valueOrFn) ? valueOrFn(...args) : valueOrFn;
}
var isFunction = (value) => typeof value === "function";
var dataAttr = (condition) => condition ? "" : void 0;
var ariaAttr = (condition) => condition ? true : void 0;
function callAllHandlers(...fns) {
return function func(event) {
fns.some((fn) => {
fn == null ? void 0 : fn(event);
return event == null ? void 0 : event.defaultPrevented;
});
};
}
function callAll(...fns) {
return function mergedFn(arg) {
fns.forEach((fn) => {
fn == null ? void 0 : fn(arg);
});
};
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
ariaAttr,
callAll,
callAllHandlers,
cx,
dataAttr,
isObject,
runIfFn,
warn
});