UNPKG

@kelvininc/ui-components

Version:
91 lines (86 loc) 4.33 kB
import { H as proxyCustomElement, I as H, J as createEvent, e as EComponentSize, K as h, L as Host } from './p-BP5CxQcH.js'; import { d as defineCustomElement$7 } from './p-DQ7v6WT-.js'; import { d as defineCustomElement$6 } from './p-CgqRIP0M.js'; import { d as defineCustomElement$5 } from './p-s9JMr6UQ.js'; import { d as defineCustomElement$4 } from './p-BVkWAv-0.js'; import { d as defineCustomElement$3 } from './p-DdZmrasC.js'; import { d as defineCustomElement$2 } from './p-DFBbXuLI.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$1 = /*@__PURE__*/ proxyCustomElement(class KvToggleSwitch extends H { constructor() { super(); this.__registerHost(); this.__attachShadow(); 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 })); })))); } static get style() { return toggleSwitchCss; } }, [257, "kv-toggle-switch", { "options": [16], "disabled": [516], "size": [513], "selectedOption": [513, "selected-option"], "disabledButtons": [16, "disabled-buttons"] }]); function defineCustomElement$1() { if (typeof customElements === "undefined") { return; } const components = ["kv-toggle-switch", "kv-icon", "kv-portal", "kv-radio", "kv-toggle-button", "kv-tooltip", "kv-tooltip-text"]; components.forEach(tagName => { switch (tagName) { case "kv-toggle-switch": if (!customElements.get(tagName)) { customElements.define(tagName, KvToggleSwitch$1); } break; case "kv-icon": if (!customElements.get(tagName)) { defineCustomElement$7(); } break; case "kv-portal": if (!customElements.get(tagName)) { defineCustomElement$6(); } break; case "kv-radio": if (!customElements.get(tagName)) { defineCustomElement$5(); } break; case "kv-toggle-button": if (!customElements.get(tagName)) { defineCustomElement$4(); } break; case "kv-tooltip": if (!customElements.get(tagName)) { defineCustomElement$3(); } break; case "kv-tooltip-text": if (!customElements.get(tagName)) { defineCustomElement$2(); } break; } }); } defineCustomElement$1(); const KvToggleSwitch = KvToggleSwitch$1; const defineCustomElement = defineCustomElement$1; export { KvToggleSwitch, defineCustomElement };