@kelvininc/ui-components
Version:
Kelvin UI Components
44 lines (40 loc) • 2.19 kB
JavaScript
import { r as registerInstance, c as createEvent, h, H as Host } from './index-D-JVwta2.js';
import { a as EComponentSize } from './components-DzZLIMy0.js';
import './lib-config-DwRzddFC.js';
import './action-button.types-DVds6a5Z.js';
import './absolute-time-picker-dropdown.types-CojoW2Y2.js';
import './icon.types-SVedE_O8.js';
import './summary-card.types-BcMhjKoS.js';
import './toaster.types-vhHhaF4Q.js';
import './tree-item.types-CBuzk8fR.js';
import './tag-alarm.types-DHk26cGe.js';
import './wizard.types-7ioMFMb5.js';
const toggleButtonGroupCss = "@property --rotation{syntax:\"<angle>\";initial-value:0deg;inherits:false}@keyframes rotate-border{to{--rotation:360deg}}:host{display:flex;gap:var(--kv-spacing, 4px);--toggle-group-width:unset}:host>kv-toggle-button{width:var(--toggle-group-width)}";
const KvToggleButtonGroup = class {
constructor(hostRef) {
registerInstance(this, hostRef);
this.checkedChange = createEvent(this, "checkedChange", 7);
/** @inheritdoc */
this.buttons = [];
/** @inheritdoc */
this.withRadio = false;
/** @inheritdoc */
this.disabled = false;
/** @inheritdoc */
this.size = EComponentSize.Small;
/** @inheritdoc */
this.selectedButtons = {};
/** @inheritdoc */
this.disabledButtons = {};
/** @inheritdoc */
this.radioButtons = {};
}
render() {
return (h(Host, { key: 'a61b9b7fe554e7337be7b82a0b315d5ef5187ea0' }, this.buttons.map(button => {
var _a;
return (h("kv-toggle-button", { part: "toggle-button-container", exportparts: "toggle-button", value: button.value, label: button.label, icon: button.icon, preventDefault: button.preventDefault, size: (_a = this.size) !== null && _a !== void 0 ? _a : button.size, disabled: this.disabled || this.disabledButtons[button.value] || button.disabled, checked: this.selectedButtons[button.value] || button.checked, withRadio: this.withRadio || this.radioButtons[button.value] || button.withRadio }));
})));
}
};
KvToggleButtonGroup.style = toggleButtonGroupCss;
export { KvToggleButtonGroup as kv_toggle_button_group };