| 1 |
"use strict"; |
| 2 |
Object.defineProperty(exports, "__esModule", { value: true }); |
| 3 |
exports.css = void 0; |
| 4 |
/** Joins args into a className string |
| 5 |
* |
| 6 |
* @param {any} args list of objects, string, or arrays to reduce |
| 7 |
*/ |
| 8 |
function css(...args) { |
| 9 |
// Adapted from https://github.com/JedWatson/classnames/blob/master/index.js |
| 10 |
const classes = []; |
| 11 |
const hasOwn = {}.hasOwnProperty; |
| 12 |
args.filter(Boolean).forEach((arg) => { |
| 13 |
const argType = typeof arg; |
| 14 |
if (argType === 'string' || argType === 'number') { |
| 15 |
classes.push(arg); |
| 16 |
} |
| 17 |
else if (Array.isArray(arg) && arg.length) { |
| 18 |
const inner = css(...arg); |
| 19 |
if (inner) { |
| 20 |
classes.push(inner); |
| 21 |
} |
| 22 |
} |
| 23 |
else if (argType === 'object') { |
| 24 |
for (const key in arg) { |
| 25 |
if (hasOwn.call(arg, key) && arg[key]) { |
| 26 |
classes.push(key); |
| 27 |
} |
| 28 |
} |
| 29 |
} |
| 30 |
}); |
| 31 |
return classes.join(' '); |
| 32 |
} |
| 33 |
exports.css = css; |
| 34 |
//# sourceMappingURL=index.js.map |