braid-design-system
Version:
Themeable design system for the SEEK Group
25 lines (24 loc) • 1.2 kB
JavaScript
const clsx = require("clsx");
const lib_utils_optimizeResponsiveArray_cjs = require("./optimizeResponsiveArray.cjs");
const lib_css_atoms_sprinkles_css_cjs = require("../css/atoms/sprinkles.css.cjs");
const _interopDefaultCompat = (e) => e && typeof e === "object" && "default" in e ? e : { default: e };
const clsx__default = /* @__PURE__ */ _interopDefaultCompat(clsx);
const resolveResponsiveProp = (value, mobileAtoms, tabletAtoms, desktopAtoms, wideAtoms) => {
if (typeof value === "string" || typeof value === "number") {
return mobileAtoms[value];
}
const normalized = lib_css_atoms_sprinkles_css_cjs.normalizeResponsiveValue(value);
const [mobile, tablet, desktop, wide] = lib_utils_optimizeResponsiveArray_cjs.optimizeResponsiveArray([
normalized.mobile ?? null,
normalized.tablet ?? null,
normalized.desktop ?? null,
normalized.wide ?? null
]);
const mobileAtom = mobileAtoms[mobile];
const tabletAtom = tabletAtoms[tablet];
const desktopAtom = desktopAtoms[desktop];
const wideAtom = wideAtoms[wide];
return clsx__default.default(mobileAtom, tabletAtom, desktopAtom, wideAtom);
};
exports.resolveResponsiveProp = resolveResponsiveProp;
;