UNPKG

@coreui/vue

Version:

UI Components Library for Vue.js

20 lines (16 loc) 805 B
'use strict'; var vue = require('vue'); var CChip = require('../chip/CChip.js'); // Build CChip vnodes from data items (string or descriptor). Coordination is // handled by the chip-set context the chips inject, so this only creates them — // shared by CChipSet's `chips` prop and CChipInput's value list. It lives apart // from useChipSet to avoid a CChip ↔ useChipSet import cycle. const chipsFromData = (items = []) => items.map((item) => { if (typeof item === 'string') { return vue.h(CChip.CChip, { value: item, key: item }, { default: () => item }); } const { value, label, ...rest } = item; return vue.h(CChip.CChip, { value, key: value, ...rest }, { default: () => label ?? value }); }); exports.chipsFromData = chipsFromData; //# sourceMappingURL=buildChips.js.map