UNPKG

@kelvininc/ui-components

Version:
77 lines (72 loc) 4.57 kB
import { p as proxyCustomElement, H, d as createEvent, h, e as Host } from './p-D6GMjtmE.js'; import { a as EComponentSize } from './p-BRgmvbuh.js'; import './p-DBphUUgi.js'; import './p-BcMhjKoS.js'; import './p-BQDwJ0uF.js'; import { d as defineCustomElement$4 } from './p-B41PGLQm.js'; import { d as defineCustomElement$3 } from './p-BeCwHLdO.js'; import { d as defineCustomElement$2 } from './p-7k8390l6.js'; const toggleSwitchCss = "@property --rotation{syntax:\"<angle>\";initial-value:0deg;inherits:false}@keyframes rotate-border{to{--rotation:360deg}}.toggle-switch-container{display:flex}.toggle-switch-container>:last-child{--border-radius-top-right:4px;--border-radius-bottom-right:4px}.toggle-switch-container>:first-child{--border-radius-top-left:4px;--border-radius-bottom-left:4px}.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;--button-padding-small:var(--kv-spacing, 4px) var(--kv-spacing-3x, 12px);--button-padding-large:var(--kv-spacing-2x, 8px) var(--kv-spacing-3x, 12px);--text-color-default:var(--kv-neutral-4, #bebebe);--text-color-active:var(--kv-neutral-2, #e5e5e5);--text-color-disabled:var(--kv-neutral-5, #707070);--text-color-disabled-active:var(--kv-neutral-5, #707070);--background-color-default:\"transparent\";--background-color-active:var(--kv-neutral-6, #3f3f3f);--background-color-disabled:\"transparent\";--background-color-disabled-active:var(--kv-neutral-7, #2a2a2a);--border-color-default:var(--kv-neutral-6, #3f3f3f);--border-color-active:var(--kv-neutral-2, #e5e5e5);--border-color-disabled:var(--kv-neutral-6, #3f3f3f);--border-color-disabled-active:var(--kv-neutral-6, #3f3f3f)}.toggle-switch-container kv-toggle-button::part(toggle-label){font-family:var(--kv-primary-font, \"proxima-nova\", sans-serif, \"Arial\");font-size:12px;font-weight:400;font-stretch:normal;font-style:normal;line-height:18px;letter-spacing:normal;text-transform:none}"; 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: '94071d84c6043b263c17e3a912c8198ae27e809b' }, h("div", { key: '3fbb05bd6df3229bb8b259865439f281d37da47e', class: "toggle-switch-container" }, this.options.map(option => { var _a; return (h("kv-toggle-button", { part: "toggle-switch-option-container", exportparts: "toggle-button", value: option.value, label: option.label, icon: option.icon, preventDefault: option.preventDefault, size: (_a = this.size) !== null && _a !== void 0 ? _a : option.size, disabled: this.disabled || this.disabledButtons[option.value] || option.disabled, checked: this.selectedOption === option.value })); })))); } static get style() { return toggleSwitchCss; } }, [1, "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-radio", "kv-toggle-button"]; 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$4(); } break; case "kv-radio": if (!customElements.get(tagName)) { defineCustomElement$3(); } break; case "kv-toggle-button": if (!customElements.get(tagName)) { defineCustomElement$2(); } break; } }); } defineCustomElement$1(); const KvToggleSwitch = KvToggleSwitch$1; const defineCustomElement = defineCustomElement$1; export { KvToggleSwitch, defineCustomElement };