@kelvininc/ui-components
Version:
Kelvin UI Components
37 lines (32 loc) • 1.94 kB
JavaScript
'use strict';
var index = require('./index-rNNWWpit.js');
var wizard_types = require('./wizard.types-C9Yhv1tt.js');
const toggleButtonGroupCss = "@property --rotation{syntax:\"<angle>\";initial-value:0deg;inherits:false}@keyframes rotate-border{to{--rotation:360deg}}kv-dropdown-base:not(.hydrated)>[slot=list]{display:none}:host{display:flex;gap:var(--spacing-xs);--toggle-group-width:unset}:host>kv-toggle-button{width:var(--toggle-group-width)}";
const KvToggleButtonGroup = class {
constructor(hostRef) {
index.registerInstance(this, hostRef);
this.checkedChange = index.createEvent(this, "checkedChange", 7);
/** @inheritdoc */
this.buttons = [];
/** @inheritdoc */
this.withRadio = false;
/** @inheritdoc */
this.disabled = false;
/** @inheritdoc */
this.size = wizard_types.EComponentSize.Small;
/** @inheritdoc */
this.selectedButtons = {};
/** @inheritdoc */
this.disabledButtons = {};
/** @inheritdoc */
this.radioButtons = {};
}
render() {
return (index.h(index.Host, { key: 'b6340ed668eb3bfa6b7774e2ea7655a551cbd1b3' }, this.buttons.map(button => {
var _a;
return (index.h("kv-toggle-button", { part: "toggle-button-container", exportparts: "toggle-button", icon: button.icon, value: button.value, label: button.label, tooltip: button.tooltip, size: (_a = this.size) !== null && _a !== void 0 ? _a : button.size, preventDefault: button.preventDefault, checked: this.selectedButtons[button.value] || button.checked, disabled: this.disabled || this.disabledButtons[button.value] || button.disabled, withRadio: this.withRadio || this.radioButtons[button.value] || button.withRadio, customAttributes: button.customAttributes }));
})));
}
};
KvToggleButtonGroup.style = toggleButtonGroupCss;
exports.kv_toggle_button_group = KvToggleButtonGroup;