@kelvininc/ui-components
Version:
Kelvin UI Components
31 lines (27 loc) • 2.17 kB
JavaScript
import { r as registerInstance, c as createEvent, h, H as Host } from './index-BOTigrTZ.js';
import { c as EComponentSize } from './wizard.types-COrzvkrr.js';
const toggleSwitchCss = "@property --rotation{syntax:\"<angle>\";initial-value:0deg;inherits:false}@keyframes rotate-border{to{--rotation:360deg}}kv-dropdown-base:not(.hydrated)>[slot=list]{display:none}.toggle-switch-container{display:flex}.toggle-switch-container>:last-child{--border-radius-top-right:var(--toggle-radius-default);--border-radius-bottom-right:var(--toggle-radius-default)}.toggle-switch-container>:first-child{--border-radius-top-left:var(--toggle-radius-default);--border-radius-bottom-left:var(--toggle-radius-default)}.toggle-switch-container kv-toggle-button{--border-radius-top-right:0;--border-radius-bottom-right:0;--border-radius-top-left:0;--border-radius-bottom-left:0}";
const KvToggleSwitch = class {
constructor(hostRef) {
registerInstance(this, hostRef);
this.checkedChange = createEvent(this, "checkedChange", 7);
/** @inheritdoc */
this.options = [];
/** @inheritdoc */
this.disabled = false;
/** @inheritdoc */
this.size = EComponentSize.Small;
/** @inheritdoc */
this.selectedOption = '';
/** @inheritdoc */
this.disabledButtons = {};
}
render() {
return (h(Host, { key: '3d72ccf4578635b32fe65a1d177a006dc7945598' }, h("div", { key: '037f38ff83df0d9facdf303113b4b3a58a2f54f9', class: "toggle-switch-container" }, this.options.map(option => {
var _a;
return (h("kv-toggle-button", { part: "toggle-switch-option-container", exportparts: "toggle-button", icon: option.icon, value: option.value, label: option.label, tooltip: option.tooltip, size: (_a = this.size) !== null && _a !== void 0 ? _a : option.size, preventDefault: option.preventDefault, checked: this.selectedOption === option.value, disabled: this.disabled || this.disabledButtons[option.value] || option.disabled, customAttributes: option.customAttributes }));
}))));
}
};
KvToggleSwitch.style = toggleSwitchCss;
export { KvToggleSwitch as kv_toggle_switch };