UNPKG

@zeix/ui-element

Version:

UIElement - a HTML-first library for reactive Web Components

21 lines (18 loc) 465 B
import { component, computed, pass } from '../../..' // import '../form-spinbutton/form-spinbutton' export default component('module-catalog', {}, (_, { first, useElements }) => { const total = computed(() => useElements('form-spinbutton').reduce( (sum, item) => sum + item.value, 0, ), ) return [ first('basic-button', [ pass({ disabled: () => !total.get(), badge: () => (total.get() > 0 ? String(total.get()) : ''), }), ]), ] })