UNPKG

@dialpad/dialtone

Version:

Dialpad's Dialtone design system monorepo

74 lines (73 loc) 1.86 kB
import { DT_STACK_ALIGN as e, DT_STACK_DIRECTION as t, DT_STACK_GAP as n, DT_STACK_JUSTIFY as r, DT_STACK_RESPONSIVE_BREAKPOINTS as i } from "./stack-constants.js"; //#region components/stack/utils.js function a(e) { return e === t.default; } function o(e) { return typeof e == "string" ? e : typeof e == "object" && e ? e.default : null; } function s(e) { if (typeof e == "string") return a(e) ? null : t[e]; if (typeof e == "object") { let { default: n } = e; return a(n) ? null : t[n]; } else return null; } function c(e, t, n, r = "d-stack") { return typeof e != "object" || !e ? [] : i.map((i) => { let a = e[i]; if (!a) return null; let o = Array.isArray(n) ? n.includes(a) : a in n, s = t === "" ? `${r}--${i}-${a}` : `${r}--${i}-${t}-${a}`; return o ? s : null; }); } function l(e) { return s(e) ? `d-stack--${t[s(e)]}` : null; } function u(e) { return c(e, "", t); } function d(e) { return c(e, "gap", n); } function f(t) { return c(t, "align", e); } function p(e) { return typeof e != "object" || !e ? [] : i.map((t) => { let n = e[t]; if (!n) return null; let i = r.includes(n), a = _(n); return i ? `d-stack--${t}-justify-${a}` : null; }); } function m(e, t, n, r) { return [ ...u(e), ...d(t), ...f(n), ...p(r) ]; } function h(e) { let t = o(e); return n.includes(t) ? `d-stack--gap-${t}` : null; } function g(t) { let n = o(t); return e.includes(n) ? `d-stack--align-${n}` : null; } function _(e) { return { "space-around": "around", "space-between": "between", "space-evenly": "evenly" }[e] || e; } function v(e) { let t = o(e), n = _(t); return r.includes(t) ? `d-stack--justify-${n}` : null; } //#endregion export { g as getDefaultAlignClass, l as getDefaultDirectionClass, h as getDefaultGapClass, v as getDefaultJustifyClass, m as getResponsiveClasses }; //# sourceMappingURL=utils.js.map