UNPKG

@coreui/vue

Version:

UI Components Library for Vue.js

18 lines (15 loc) 757 B
import { h } from 'vue'; import { CChip } from '../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 h(CChip, { value: item, key: item }, { default: () => item }); } const { value, label, ...rest } = item; return h(CChip, { value, key: value, ...rest }, { default: () => label ?? value }); }); export { chipsFromData }; //# sourceMappingURL=buildChips.js.map