UNPKG

laif-ds

Version:

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

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