UNPKG

@limetech/lime-elements

Version:
43 lines (39 loc) 1.63 kB
'use strict'; var index = require('./index-BjHIBY-I.js'); const RadioButtonGroup = class { constructor(hostRef) { index.registerInstance(this, hostRef); this.change = index.createEvent(this, "change"); /** * Disables all radio buttons when `true` */ this.disabled = false; /** * By default, lists will display 3 lines of text, and then truncate the rest. * Consumers can increase or decrease this number by specifying * `maxLinesSecondaryText`. If consumer enters zero or negative * numbers we default to 1; and if they type decimals we round up. */ this.maxLinesSecondaryText = 3; this.handleChange = (event) => { event.stopPropagation(); if (this.disabled) { return; } this.change.emit(event.detail); }; } render() { return (index.h("limel-list", { key: 'd42e6342d4fd79d34cb2c6a9d25d3dfe577e9a99', items: this.createItems(), type: "radio", badgeIcons: this.badgeIcons, maxLinesSecondaryText: this.maxLinesSecondaryText, onChange: this.handleChange })); } createItems() { return this.items.map((option) => { var _a; if ('separator' in option) { return option; } return Object.assign(Object.assign({}, option), { selected: option.value === ((_a = this.selectedItem) === null || _a === void 0 ? void 0 : _a.value), disabled: this.disabled || option.disabled }); }); } }; exports.limel_radio_button_group = RadioButtonGroup;