UNPKG

laif-ds

Version:

Design System di Laif con componenti React basati su principi di Atomic Design

39 lines (38 loc) 685 B
"use client"; import u from "../../../../_virtual/omit.js"; import t from "../constants/colors.json.js"; const d = (h, e = !0, n = 0, s = 0, o = []) => h.reduce((l, r) => { const c = s + l.length; if (r?.children?.length) { const i = d( r.children, e, n + 1, c + 1, [...o, r.key] ); return [ ...l, { color: t[c % t.length], ...u(r, "children"), expanded: e, level: n, parentsKeys: o }, ...i ]; } return [ ...l, { color: t[c % t.length], ...u(r, "children"), level: n, parentsKeys: o } ]; }, []); export { d as transformData };