UNPKG

@limetech/lime-elements

Version:
41 lines (38 loc) 1.64 kB
import { r as registerInstance, c as createEvent, h } from './index-DBTJNfo7.js'; const RadioButtonGroup = class { constructor(hostRef) { registerInstance(this, hostRef); this.change = 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 (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 }); }); } }; export { RadioButtonGroup as limel_radio_button_group };