UNPKG

@mantine/core

Version:

React components library focused on usability, accessibility and developer experience

26 lines (25 loc) 834 B
"use client"; //#region packages/@mantine/core/src/core/Box/get-box-mod/get-box-mod.ts function transformModKey(key) { return `data-${(key.startsWith("data-") ? key.slice(5) : key).replace(/([a-z])([A-Z])/g, "$1-$2").toLowerCase()}`; } function getMod(props) { return Object.keys(props).reduce((acc, key) => { const value = props[key]; if (value === void 0 || value === "" || value === false || value === null) return acc; acc[transformModKey(key)] = props[key]; return acc; }, {}); } function getBoxMod(mod) { if (!mod) return null; if (typeof mod === "string") return { [transformModKey(mod)]: true }; if (Array.isArray(mod)) return [...mod].reduce((acc, value) => ({ ...acc, ...getBoxMod(value) }), {}); return getMod(mod); } //#endregion exports.getBoxMod = getBoxMod; //# sourceMappingURL=get-box-mod.cjs.map