@yamada-ui/react
Version:
React UI components of the Yamada, by the Yamada, for the Yamada built with React and Emotion
20 lines (18 loc) • 627 B
JavaScript
import { utils_exports } from "../../utils/index.js";
//#region src/core/css/style.ts
function generateStyle(prefix) {
return function(value, { prev = {}, theme }) {
const result = {};
let style = {};
if (prefix) style = theme?.styles?.[prefix]?.[value] ?? {};
else if ((0, utils_exports.isString)(value)) {
const [key, ...rest] = value.split(".");
if (key) style = theme?.styles?.[key]?.[rest.join(".")] ?? {};
}
for (const prop in style) if (!(prop in prev && prev[prop] != null)) result[prop] = style[prop];
return result;
};
}
//#endregion
export { generateStyle };
//# sourceMappingURL=style.js.map