@cas-smartdesign/button 5.1.1 → 5.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -72,8 +72,9 @@ var window;(window||={})["@cas-smartdesign/button"]=(()=>{var n=Object.definePro
72
72
  outline: 1px dashed #111;
73
73
  }
74
74
 
75
- :host(:not([icon])) .icon,
76
- :host([icon=""]) .icon {
75
+ .icon:not([src]),
76
+ .icon[src=""],
77
+ .icon[src="data:,"] {
77
78
  display: none;
78
79
  }
79
80
 
@@ -96,7 +97,9 @@ var window;(window||={})["@cas-smartdesign/button"]=(()=>{var n=Object.definePro
96
97
  max-width: var(--sd-button-max-icon-size, 32px);
97
98
  }
98
99
  </style>
99
- <img class="icon" src="data:," alt />
100
+ <slot name="icon">
101
+ <img class="icon" src="data:," alt part="icon" />
102
+ </slot>
100
103
  <div class="content">
101
104
  <slot></slot>
102
105
  </div>
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../element-base/element-base.ts", "../button.html", "../button.ts"],
4
- "sourcesContent": ["export type IReadyEvent = void;\n\nexport interface CustomEventMap extends HTMLElementEventMap {\n ready: CustomEvent<IReadyEvent>;\n}\n\nexport interface ElementBase {\n addEventListener<K extends keyof CustomEventMap>(\n event: K,\n listener: ((this: this, ev: CustomEventMap[K]) => unknown) | null,\n options?: AddEventListenerOptions | boolean,\n ): void;\n addEventListener(\n type: string,\n callback: EventListenerOrEventListenerObject | null,\n options?: AddEventListenerOptions | boolean,\n ): void;\n removeEventListener<K extends keyof CustomEventMap>(\n type: K,\n listener: (this: this, ev: CustomEventMap[K]) => unknown,\n options?: boolean | EventListenerOptions,\n ): void;\n removeEventListener(\n type: string,\n listener: EventListenerOrEventListenerObject,\n options?: boolean | EventListenerOptions,\n ): void;\n dispatchEvent<EventType extends CustomEventMap[keyof CustomEventMap]>(event: EventType): boolean;\n}\n\nexport abstract class ElementBase extends HTMLElement {\n public abstract is(): string;\n\n protected abstract template(): HTMLTemplateElement;\n private static readonly TEMPLATE_CACHE: {\n [name: string]: HTMLTemplateElement;\n } = {};\n private memoizedTemplate(): HTMLTemplateElement {\n const is = this.is();\n if (ElementBase.TEMPLATE_CACHE[is]) {\n return ElementBase.TEMPLATE_CACHE[is];\n }\n const template = this.template();\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n if ((window as any).ShadyCSS) {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n (window as any).ShadyCSS.prepareTemplate(template, this.is());\n }\n ElementBase.TEMPLATE_CACHE[is] = template;\n return template;\n }\n\n public connectedCallback() {\n const template = this.memoizedTemplate();\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n if ((window as any).ShadyCSS) {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n (window as any).ShadyCSS.styleElement(this);\n }\n if (!this.shadowRoot) {\n this.attachShadow({ mode: \"open\" });\n this.shadowRoot.appendChild(document.importNode(template.content, true));\n requestAnimationFrame(() => this.dispatchEvent(new CustomEvent<IReadyEvent>(\"ready\")));\n }\n }\n\n public whenReady(actor: () => void) {\n if (this.shadowRoot) {\n actor();\n } else {\n this.addEventListener(\"ready\", () => actor());\n }\n }\n}\n", "export default \"<style>\\n\\t:host {\\n\\t\\tcontain: content;\\n\\t\\tbackground: rgba(20, 103, 186, 0);\\n\\t\\tcolor: #1467ba;\\n\\t\\tborder: none;\\n\\t\\toutline: none;\\n\\t\\tpadding: 0 8px;\\n\\t\\theight: 32px;\\n\\t\\tcursor: pointer;\\n\\t\\tuser-select: none;\\n\\t\\tdisplay: inline-flex;\\n\\t\\talign-items: center;\\n\\t\\tjustify-content: center;\\n\\t\\tbox-sizing: border-box;\\n\\t\\tvertical-align: middle;\\n\\t}\\n\\n\\t:host(:focus),\\n\\t:host(:not([disabled], [aria-disabled=\\\"true\\\"]):hover) {\\n\\t\\tbackground: rgba(20, 103, 186, 0.1);\\n\\t}\\n\\n\\t@media (forced-colors: active) {\\n\\t\\t:host(:not([disabled], [aria-disabled=\\\"true\\\"]):focus-visible) {\\n\\t\\t\\toutline: 1px solid;\\n\\t\\t}\\n\\t\\t:host {\\n\\t\\t\\tmargin: 1px;\\n\\t\\t}\\n\\t}\\n\\n\\t:host(:not([disabled], [aria-disabled=\\\"true\\\"]):focus-visible) {\\n\\t\\tbox-shadow: 0 0 0 1px #1467ba inset;\\n\\t}\\n\\n\\t:host(:not([disabled], [aria-disabled=\\\"true\\\"]):active) {\\n\\t\\tbackground: rgba(20, 103, 186, 0.2);\\n\\t}\\n\\n\\t:host([primary]) {\\n\\t\\tbackground: #1467ba;\\n\\t\\tcolor: #fff;\\n\\t}\\n\\n\\t:host([primary]:focus),\\n\\t:host(:not([disabled], [aria-disabled=\\\"true\\\"])[primary]:hover) {\\n\\t\\tbackground: #125da8;\\n\\t}\\n\\n\\t:host([primary]:focus-visible) {\\n\\t\\tbox-shadow: 0 0 0 1px white inset;\\n\\t}\\n\\n\\t:host(:not([disabled], [aria-disabled=\\\"true\\\"])[primary]:focus-visible) {\\n\\t\\toutline: 1px solid #1467ba;\\n\\t}\\n\\n\\t:host(:not([disabled], [aria-disabled=\\\"true\\\"])[primary]:active) {\\n\\t\\tbackground: #0e4883;\\n\\t}\\n\\n\\t:host([disabled]),\\n\\t:host([aria-disabled=\\\"true\\\"]) {\\n\\t\\tfilter: grayscale(100%);\\n\\t\\topacity: 0.5;\\n\\t\\tcursor: default;\\n\\t}\\n\\n\\t:host([disabled]:focus-visible),\\n\\t:host([aria-disabled=\\\"true\\\"]:focus-visible) {\\n\\t\\toutline: 1px dashed #111;\\n\\t}\\n\\n\\t:host(:not([icon])) .icon,\\n\\t:host([icon=\\\"\\\"]) .icon {\\n\\t\\tdisplay: none;\\n\\t}\\n\\n\\t.content {\\n\\t\\tdisplay: flex;\\n\\t\\talign-items: center;\\n\\t\\tmin-width: 0px;\\n\\t}\\n\\n\\t.content ::slotted(*) {\\n\\t\\tmargin-left: var(--sd-button-content-padding, 8px);\\n\\t}\\n\\n\\t.content ::slotted(*:last-child) {\\n\\t\\tmargin-right: var(--sd-button-content-padding, 8px);\\n\\t}\\n\\n\\t.icon {\\n\\t\\tmax-height: var(--sd-button-max-icon-size, 32px);\\n\\t\\tmax-width: var(--sd-button-max-icon-size, 32px);\\n\\t}\\n</style>\\n<img class=\\\"icon\\\" src=\\\"data:,\\\" alt />\\n<div class=\\\"content\\\">\\n\\t<slot></slot>\\n</div>\\n\"", "import { ElementBase } from \"@cas-smartdesign/element-base\";\n\nimport { default as htmlTemplate } from \"./button.html?raw\";\n\ndeclare global {\n interface HTMLElementTagNameMap {\n [Button.ID]: Button;\n }\n}\n\nexport class Button extends ElementBase {\n public static readonly ID = \"sd-button\";\n private _image: HTMLImageElement;\n private _isSpaceOrEnterKeyDown = false;\n\n public get imageElement() {\n return this._image;\n }\n\n public get icon(): string {\n return this.getAttribute(\"icon\");\n }\n\n public set icon(icon: string) {\n if (this.icon !== icon) {\n if (icon) {\n this.setAttribute(\"icon\", icon);\n } else {\n this.removeAttribute(\"icon\");\n }\n this.updateIcon();\n }\n }\n\n public get primary(): boolean {\n return this.hasAttribute(\"primary\");\n }\n\n public set primary(primary: boolean) {\n if (primary) {\n this.setAttribute(\"primary\", \"\");\n } else {\n this.removeAttribute(\"primary\");\n }\n }\n\n public get disabled(): boolean {\n return this.getAttribute(\"aria-disabled\") == \"true\";\n }\n\n public set disabled(disabled: boolean) {\n this.setAttribute(\"aria-disabled\", disabled.toString());\n }\n\n static get observedAttributes() {\n return [\"icon\"];\n }\n\n public is(): string {\n return Button.ID;\n }\n\n protected template(): HTMLTemplateElement {\n const template = document.createElement(\"template\");\n template.innerHTML = htmlTemplate;\n return template;\n }\n\n constructor() {\n super();\n this.addEventListener(\"keydown\", (e) => {\n if (this.isSpaceOrEnter(e)) {\n this._isSpaceOrEnterKeyDown = true;\n e.preventDefault(); // prevent potential scroll-down triggered by space\n }\n });\n this.addEventListener(\"keyup\", (e) => {\n if (this.isSpaceOrEnter(e) && this._isSpaceOrEnterKeyDown == true) {\n this._isSpaceOrEnterKeyDown = false;\n this.click();\n }\n });\n // As Button is not an input element, click is fired even in disabled state\n this.addEventListener(\n \"click\",\n (event) => {\n if (this.disabled || this.hasAttribute(\"disabled\")) {\n event.stopImmediatePropagation();\n return;\n }\n\n const type = this.getAttribute(\"type\")?.toLowerCase()?.trim();\n\n if (type !== \"submit\" && type !== \"reset\") {\n return;\n }\n\n const form = this.closest(\"form\");\n\n if (form && type === \"submit\") {\n form.requestSubmit();\n }\n\n if (form && type === \"reset\") {\n form.reset();\n }\n },\n { capture: true },\n );\n }\n\n private isSpaceOrEnter(event: KeyboardEvent): boolean {\n switch (event.key) {\n case \" \":\n case \"Space\":\n case \"Enter\":\n return true;\n default:\n return false;\n }\n }\n\n public click() {\n if (!this.disabled && !this.hasAttribute(\"disabled\")) {\n super.click();\n }\n }\n\n public connectedCallback() {\n super.connectedCallback();\n\n if (!this.hasAttribute(\"tabIndex\")) {\n this.tabIndex = 0;\n }\n\n this._image = this.shadowRoot.querySelector(\".icon\") as HTMLImageElement;\n\n this.updateIcon();\n if (!this.hasAttribute(\"role\")) {\n this.setAttribute(\"role\", \"button\");\n }\n }\n\n public attributeChangedCallback(): void {\n this.updateIcon();\n }\n\n private updateIcon() {\n if (this._image) {\n const iconSrc = this.getAttribute(\"icon\");\n if (iconSrc) {\n this._image.src = iconSrc;\n }\n }\n }\n}\n\nif (!customElements.get(Button.ID)) {\n customElements.define(Button.ID, Button);\n}\n"],
5
- "mappings": "mfA8BO,IAAeA,EAAf,MAAeA,UAAoB,WAAY,CAO1C,kBAAwC,CAC5C,IAAMC,EAAK,KAAK,GAAA,EAChB,GAAID,EAAY,eAAeC,CAAE,EAC7B,OAAOD,EAAY,eAAeC,CAAE,EAExC,IAAMC,EAAW,KAAK,SAAA,EAEtB,OAAK,OAAe,UAEf,OAAe,SAAS,gBAAgBA,EAAU,KAAK,GAAA,CAAI,EAEhEF,EAAY,eAAeC,CAAE,EAAIC,EAC1BA,CAC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,IAAMO,EAAU,KAAK,aAAa,MAAM,EACpCA,IACA,KAAK,OAAO,IAAMA,EAE1B,CACJ,CACJ,EAhJIV,EAAuB,GAAK,YADzB,IAAMW,EAANX,EAmJF,eAAe,IAAIW,EAAO,EAAE,GAC7B,eAAe,OAAOA,EAAO,GAAIA,CAAM",
4
+ "sourcesContent": ["export type IReadyEvent = void;\n\nexport interface CustomEventMap extends HTMLElementEventMap {\n ready: CustomEvent<IReadyEvent>;\n}\n\nexport interface ElementBase {\n addEventListener<K extends keyof CustomEventMap>(\n event: K,\n listener: ((this: this, ev: CustomEventMap[K]) => unknown) | null,\n options?: AddEventListenerOptions | boolean,\n ): void;\n addEventListener(\n type: string,\n callback: EventListenerOrEventListenerObject | null,\n options?: AddEventListenerOptions | boolean,\n ): void;\n removeEventListener<K extends keyof CustomEventMap>(\n type: K,\n listener: (this: this, ev: CustomEventMap[K]) => unknown,\n options?: boolean | EventListenerOptions,\n ): void;\n removeEventListener(\n type: string,\n listener: EventListenerOrEventListenerObject,\n options?: boolean | EventListenerOptions,\n ): void;\n dispatchEvent<EventType extends CustomEventMap[keyof CustomEventMap]>(event: EventType): boolean;\n}\n\nexport abstract class ElementBase extends HTMLElement {\n public abstract is(): string;\n\n protected abstract template(): HTMLTemplateElement;\n private static readonly TEMPLATE_CACHE: {\n [name: string]: HTMLTemplateElement;\n } = {};\n private memoizedTemplate(): HTMLTemplateElement {\n const is = this.is();\n if (ElementBase.TEMPLATE_CACHE[is]) {\n return ElementBase.TEMPLATE_CACHE[is];\n }\n const template = this.template();\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n if ((window as any).ShadyCSS) {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n (window as any).ShadyCSS.prepareTemplate(template, this.is());\n }\n ElementBase.TEMPLATE_CACHE[is] = template;\n return template;\n }\n\n public connectedCallback() {\n const template = this.memoizedTemplate();\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n if ((window as any).ShadyCSS) {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n (window as any).ShadyCSS.styleElement(this);\n }\n if (!this.shadowRoot) {\n this.attachShadow({ mode: \"open\" });\n this.shadowRoot.appendChild(document.importNode(template.content, true));\n requestAnimationFrame(() => this.dispatchEvent(new CustomEvent<IReadyEvent>(\"ready\")));\n }\n }\n\n public whenReady(actor: () => void) {\n if (this.shadowRoot) {\n actor();\n } else {\n this.addEventListener(\"ready\", () => actor());\n }\n }\n}\n", "export default \"<style>\\n\\t:host {\\n\\t\\tcontain: content;\\n\\t\\tbackground: rgba(20, 103, 186, 0);\\n\\t\\tcolor: #1467ba;\\n\\t\\tborder: none;\\n\\t\\toutline: none;\\n\\t\\tpadding: 0 8px;\\n\\t\\theight: 32px;\\n\\t\\tcursor: pointer;\\n\\t\\tuser-select: none;\\n\\t\\tdisplay: inline-flex;\\n\\t\\talign-items: center;\\n\\t\\tjustify-content: center;\\n\\t\\tbox-sizing: border-box;\\n\\t\\tvertical-align: middle;\\n\\t}\\n\\n\\t:host(:focus),\\n\\t:host(:not([disabled], [aria-disabled=\\\"true\\\"]):hover) {\\n\\t\\tbackground: rgba(20, 103, 186, 0.1);\\n\\t}\\n\\n\\t@media (forced-colors: active) {\\n\\t\\t:host(:not([disabled], [aria-disabled=\\\"true\\\"]):focus-visible) {\\n\\t\\t\\toutline: 1px solid;\\n\\t\\t}\\n\\t\\t:host {\\n\\t\\t\\tmargin: 1px;\\n\\t\\t}\\n\\t}\\n\\n\\t:host(:not([disabled], [aria-disabled=\\\"true\\\"]):focus-visible) {\\n\\t\\tbox-shadow: 0 0 0 1px #1467ba inset;\\n\\t}\\n\\n\\t:host(:not([disabled], [aria-disabled=\\\"true\\\"]):active) {\\n\\t\\tbackground: rgba(20, 103, 186, 0.2);\\n\\t}\\n\\n\\t:host([primary]) {\\n\\t\\tbackground: #1467ba;\\n\\t\\tcolor: #fff;\\n\\t}\\n\\n\\t:host([primary]:focus),\\n\\t:host(:not([disabled], [aria-disabled=\\\"true\\\"])[primary]:hover) {\\n\\t\\tbackground: #125da8;\\n\\t}\\n\\n\\t:host([primary]:focus-visible) {\\n\\t\\tbox-shadow: 0 0 0 1px white inset;\\n\\t}\\n\\n\\t:host(:not([disabled], [aria-disabled=\\\"true\\\"])[primary]:focus-visible) {\\n\\t\\toutline: 1px solid #1467ba;\\n\\t}\\n\\n\\t:host(:not([disabled], [aria-disabled=\\\"true\\\"])[primary]:active) {\\n\\t\\tbackground: #0e4883;\\n\\t}\\n\\n\\t:host([disabled]),\\n\\t:host([aria-disabled=\\\"true\\\"]) {\\n\\t\\tfilter: grayscale(100%);\\n\\t\\topacity: 0.5;\\n\\t\\tcursor: default;\\n\\t}\\n\\n\\t:host([disabled]:focus-visible),\\n\\t:host([aria-disabled=\\\"true\\\"]:focus-visible) {\\n\\t\\toutline: 1px dashed #111;\\n\\t}\\n\\n\\t.icon:not([src]),\\n\\t.icon[src=\\\"\\\"],\\n\\t.icon[src=\\\"data:,\\\"] {\\n\\t\\tdisplay: none;\\n\\t}\\n\\n\\t.content {\\n\\t\\tdisplay: flex;\\n\\t\\talign-items: center;\\n\\t\\tmin-width: 0px;\\n\\t}\\n\\n\\t.content ::slotted(*) {\\n\\t\\tmargin-left: var(--sd-button-content-padding, 8px);\\n\\t}\\n\\n\\t.content ::slotted(*:last-child) {\\n\\t\\tmargin-right: var(--sd-button-content-padding, 8px);\\n\\t}\\n\\n\\t.icon {\\n\\t\\tmax-height: var(--sd-button-max-icon-size, 32px);\\n\\t\\tmax-width: var(--sd-button-max-icon-size, 32px);\\n\\t}\\n</style>\\n<slot name=\\\"icon\\\">\\n\\t<img class=\\\"icon\\\" src=\\\"data:,\\\" alt part=\\\"icon\\\" />\\n</slot>\\n<div class=\\\"content\\\">\\n\\t<slot></slot>\\n</div>\\n\"", "import { ElementBase } from \"@cas-smartdesign/element-base\";\n\nimport { default as htmlTemplate } from \"./button.html?raw\";\n\ndeclare global {\n interface HTMLElementTagNameMap {\n [Button.ID]: Button;\n }\n}\n\nexport class Button extends ElementBase {\n public static readonly ID = \"sd-button\";\n private _image: HTMLImageElement;\n private _isSpaceOrEnterKeyDown = false;\n\n public get imageElement() {\n return this._image;\n }\n\n public get icon(): string {\n return this.getAttribute(\"icon\");\n }\n\n public set icon(icon: string) {\n if (this.icon !== icon) {\n if (icon) {\n this.setAttribute(\"icon\", icon);\n } else {\n this.removeAttribute(\"icon\");\n }\n this.updateIcon();\n }\n }\n\n public get primary(): boolean {\n return this.hasAttribute(\"primary\");\n }\n\n public set primary(primary: boolean) {\n if (primary) {\n this.setAttribute(\"primary\", \"\");\n } else {\n this.removeAttribute(\"primary\");\n }\n }\n\n public get disabled(): boolean {\n return this.getAttribute(\"aria-disabled\") == \"true\";\n }\n\n public set disabled(disabled: boolean) {\n this.setAttribute(\"aria-disabled\", disabled.toString());\n }\n\n static get observedAttributes() {\n return [\"icon\"];\n }\n\n public is(): string {\n return Button.ID;\n }\n\n protected template(): HTMLTemplateElement {\n const template = document.createElement(\"template\");\n template.innerHTML = htmlTemplate;\n return template;\n }\n\n constructor() {\n super();\n this.addEventListener(\"keydown\", (e) => {\n if (this.isSpaceOrEnter(e)) {\n this._isSpaceOrEnterKeyDown = true;\n e.preventDefault(); // prevent potential scroll-down triggered by space\n }\n });\n this.addEventListener(\"keyup\", (e) => {\n if (this.isSpaceOrEnter(e) && this._isSpaceOrEnterKeyDown == true) {\n this._isSpaceOrEnterKeyDown = false;\n this.click();\n }\n });\n // As Button is not an input element, click is fired even in disabled state\n this.addEventListener(\n \"click\",\n (event) => {\n if (this.disabled || this.hasAttribute(\"disabled\")) {\n event.stopImmediatePropagation();\n return;\n }\n\n const type = this.getAttribute(\"type\")?.toLowerCase()?.trim();\n\n if (type !== \"submit\" && type !== \"reset\") {\n return;\n }\n\n const form = this.closest(\"form\");\n\n if (form && type === \"submit\") {\n form.requestSubmit();\n }\n\n if (form && type === \"reset\") {\n form.reset();\n }\n },\n { capture: true },\n );\n }\n\n private isSpaceOrEnter(event: KeyboardEvent): boolean {\n switch (event.key) {\n case \" \":\n case \"Space\":\n case \"Enter\":\n return true;\n default:\n return false;\n }\n }\n\n public click() {\n if (!this.disabled && !this.hasAttribute(\"disabled\")) {\n super.click();\n }\n }\n\n public connectedCallback() {\n super.connectedCallback();\n\n if (!this.hasAttribute(\"tabIndex\")) {\n this.tabIndex = 0;\n }\n\n this._image = this.shadowRoot.querySelector(\".icon\") as HTMLImageElement;\n\n this.updateIcon();\n if (!this.hasAttribute(\"role\")) {\n this.setAttribute(\"role\", \"button\");\n }\n }\n\n public attributeChangedCallback(): void {\n this.updateIcon();\n }\n\n private updateIcon() {\n if (this._image) {\n const iconSrc = this.getAttribute(\"icon\");\n if (iconSrc) {\n this._image.src = iconSrc;\n }\n }\n }\n}\n\nif (!customElements.get(Button.ID)) {\n customElements.define(Button.ID, Button);\n}\n"],
5
+ "mappings": "mfA8BO,IAAeA,EAAf,MAAeA,UAAoB,WAAY,CAO1C,kBAAwC,CAC5C,IAAMC,EAAK,KAAK,GAAA,EAChB,GAAID,EAAY,eAAeC,CAAE,EAC7B,OAAOD,EAAY,eAAeC,CAAE,EAExC,IAAMC,EAAW,KAAK,SAAA,EAEtB,OAAK,OAAe,UAEf,OAAe,SAAS,gBAAgBA,EAAU,KAAK,GAAA,CAAI,EAEhEF,EAAY,eAAeC,CAAE,EAAIC,EAC1BA,CACX,CAEO,mBAAoB,CACvB,IAAMA,EAAW,KAAK,iBAAA,EAEjB,OAAe,UAEf,OAAe,SAAS,aAAa,IAAI,EAEzC,KAAK,aACN,KAAK,aAAa,CAAE,KAAM,MAAA,CAAQ,EAClC,KAAK,WAAW,YAAY,SAAS,WAAWA,EAAS,QAAS,EAAI,CAAC,EACvE,sBAAsB,IAAM,KAAK,cAAc,IAAI,YAAyB,OAAO,CAAC,CAAC,EAE7F,CAEO,UAAUC,EAAmB,CAC5B,KAAK,WACLA,EAAA,EAEA,KAAK,iBAAiB,QAAS,IAAMA,EAAA,CAAO,CAEpD,CACJ,EAvCIH,EAAwB,e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B,KAAK,gBAAgB,SAAS,CAEtC,CAEA,IAAW,UAAoB,CAC3B,OAAO,KAAK,aAAa,eAAe,GAAK,MACjD,CAEA,IAAW,SAASC,EAAmB,CACnC,KAAK,aAAa,gBAAiBA,EAAS,SAAA,CAAU,CAC1D,CAEA,WAAW,oBAAqB,CAC5B,MAAO,CAAC,MAAM,CAClB,CAEO,IAAa,CAChB,OAAOR,EAAO,EAClB,CAEU,UAAgC,CACtC,IAAMS,EAAW,SAAS,cAAc,UAAU,EAClD,OAAAA,EAAS,UAAYV,EACdU,CACX,CA6CQ,eAAeN,EAA+B,CAClD,OAAQA,EAAM,IAAA,CACV,IAAK,IACL,IAAK,QACL,IAAK,QACD,MAAO,GACX,QACI,MAAO,EAAA,CAEnB,CAEO,OAAQ,CACP,CAAC,KAAK,UAAY,CAAC,KAAK,aAAa,UAAU,GAC/C,MAAM,MAAA,CAEd,CAEO,mBAAoB,CACvB,MAAM,kBAAA,EAED,KAAK,aAAa,UAAU,IAC7B,KAAK,SAAW,GAGpB,KAAK,OAAS,KAAK,WAAW,cAAc,OAAO,EAEnD,KAAK,WAAA,EACA,KAAK,aAAa,MAAM,GACzB,KAAK,aAAa,OAAQ,QAAQ,CAE1C,CAEO,0BAAiC,CACpC,KAAK,WAAA,CACT,CAEQ,YAAa,CACjB,GAAI,KAAK,OAAQ,CACb,IAAMO,EAAU,KAAK,aAAa,MAAM,EACpCA,IACA,KAAK,OAAO,IAAMA,EAE1B,CACJ,CACJ,EAhJIV,EAAuB,GAAK,YADzB,IAAMW,EAANX,EAmJF,eAAe,IAAIW,EAAO,EAAE,GAC7B,eAAe,OAAOA,EAAO,GAAIA,CAAM",
6
6
  "names": ["_ElementBase", "is", "template", "actor", "ElementBase", "htmlTemplate", "_Button", "ElementBase", "e", "event", "type", "form", "icon", "primary", "disabled", "template", "iconSrc", "Button"]
7
7
  }
package/dist/button.mjs CHANGED
@@ -73,8 +73,9 @@ const a = `<style>
73
73
  outline: 1px dashed #111;
74
74
  }
75
75
 
76
- :host(:not([icon])) .icon,
77
- :host([icon=""]) .icon {
76
+ .icon:not([src]),
77
+ .icon[src=""],
78
+ .icon[src="data:,"] {
78
79
  display: none;
79
80
  }
80
81
 
@@ -97,7 +98,9 @@ const a = `<style>
97
98
  max-width: var(--sd-button-max-icon-size, 32px);
98
99
  }
99
100
  </style>
100
- <img class="icon" src="data:," alt />
101
+ <slot name="icon">
102
+ <img class="icon" src="data:," alt part="icon" />
103
+ </slot>
101
104
  <div class="content">
102
105
  <slot></slot>
103
106
  </div>
@@ -1 +1 @@
1
- {"version":3,"file":"button.mjs","sources":["../button.html?raw","../button.ts"],"sourcesContent":["export default \"<style>\\n\\t:host {\\n\\t\\tcontain: content;\\n\\t\\tbackground: rgba(20, 103, 186, 0);\\n\\t\\tcolor: #1467ba;\\n\\t\\tborder: none;\\n\\t\\toutline: none;\\n\\t\\tpadding: 0 8px;\\n\\t\\theight: 32px;\\n\\t\\tcursor: pointer;\\n\\t\\tuser-select: none;\\n\\t\\tdisplay: inline-flex;\\n\\t\\talign-items: center;\\n\\t\\tjustify-content: center;\\n\\t\\tbox-sizing: border-box;\\n\\t\\tvertical-align: middle;\\n\\t}\\n\\n\\t:host(:focus),\\n\\t:host(:not([disabled], [aria-disabled=\\\"true\\\"]):hover) {\\n\\t\\tbackground: rgba(20, 103, 186, 0.1);\\n\\t}\\n\\n\\t@media (forced-colors: active) {\\n\\t\\t:host(:not([disabled], [aria-disabled=\\\"true\\\"]):focus-visible) {\\n\\t\\t\\toutline: 1px solid;\\n\\t\\t}\\n\\t\\t:host {\\n\\t\\t\\tmargin: 1px;\\n\\t\\t}\\n\\t}\\n\\n\\t:host(:not([disabled], [aria-disabled=\\\"true\\\"]):focus-visible) {\\n\\t\\tbox-shadow: 0 0 0 1px #1467ba inset;\\n\\t}\\n\\n\\t:host(:not([disabled], [aria-disabled=\\\"true\\\"]):active) {\\n\\t\\tbackground: rgba(20, 103, 186, 0.2);\\n\\t}\\n\\n\\t:host([primary]) {\\n\\t\\tbackground: #1467ba;\\n\\t\\tcolor: #fff;\\n\\t}\\n\\n\\t:host([primary]:focus),\\n\\t:host(:not([disabled], [aria-disabled=\\\"true\\\"])[primary]:hover) {\\n\\t\\tbackground: #125da8;\\n\\t}\\n\\n\\t:host([primary]:focus-visible) {\\n\\t\\tbox-shadow: 0 0 0 1px white inset;\\n\\t}\\n\\n\\t:host(:not([disabled], [aria-disabled=\\\"true\\\"])[primary]:focus-visible) {\\n\\t\\toutline: 1px solid #1467ba;\\n\\t}\\n\\n\\t:host(:not([disabled], [aria-disabled=\\\"true\\\"])[primary]:active) {\\n\\t\\tbackground: #0e4883;\\n\\t}\\n\\n\\t:host([disabled]),\\n\\t:host([aria-disabled=\\\"true\\\"]) {\\n\\t\\tfilter: grayscale(100%);\\n\\t\\topacity: 0.5;\\n\\t\\tcursor: default;\\n\\t}\\n\\n\\t:host([disabled]:focus-visible),\\n\\t:host([aria-disabled=\\\"true\\\"]:focus-visible) {\\n\\t\\toutline: 1px dashed #111;\\n\\t}\\n\\n\\t:host(:not([icon])) .icon,\\n\\t:host([icon=\\\"\\\"]) .icon {\\n\\t\\tdisplay: none;\\n\\t}\\n\\n\\t.content {\\n\\t\\tdisplay: flex;\\n\\t\\talign-items: center;\\n\\t\\tmin-width: 0px;\\n\\t}\\n\\n\\t.content ::slotted(*) {\\n\\t\\tmargin-left: var(--sd-button-content-padding, 8px);\\n\\t}\\n\\n\\t.content ::slotted(*:last-child) {\\n\\t\\tmargin-right: var(--sd-button-content-padding, 8px);\\n\\t}\\n\\n\\t.icon {\\n\\t\\tmax-height: var(--sd-button-max-icon-size, 32px);\\n\\t\\tmax-width: var(--sd-button-max-icon-size, 32px);\\n\\t}\\n</style>\\n<img class=\\\"icon\\\" src=\\\"data:,\\\" alt />\\n<div class=\\\"content\\\">\\n\\t<slot></slot>\\n</div>\\n\"","import { ElementBase } from \"@cas-smartdesign/element-base\";\n\nimport { default as htmlTemplate } from \"./button.html?raw\";\n\ndeclare global {\n interface HTMLElementTagNameMap {\n [Button.ID]: Button;\n }\n}\n\nexport class Button extends ElementBase {\n public static readonly ID = \"sd-button\";\n private _image: HTMLImageElement;\n private _isSpaceOrEnterKeyDown = false;\n\n public get imageElement() {\n return this._image;\n }\n\n public get icon(): string {\n return this.getAttribute(\"icon\");\n }\n\n public set icon(icon: string) {\n if (this.icon !== icon) {\n if (icon) {\n this.setAttribute(\"icon\", icon);\n } else {\n this.removeAttribute(\"icon\");\n }\n this.updateIcon();\n }\n }\n\n public get primary(): boolean {\n return this.hasAttribute(\"primary\");\n }\n\n public set primary(primary: boolean) {\n if (primary) {\n this.setAttribute(\"primary\", \"\");\n } else {\n this.removeAttribute(\"primary\");\n }\n }\n\n public get disabled(): boolean {\n return this.getAttribute(\"aria-disabled\") == \"true\";\n }\n\n public set disabled(disabled: boolean) {\n this.setAttribute(\"aria-disabled\", disabled.toString());\n }\n\n static get observedAttributes() {\n return [\"icon\"];\n }\n\n public is(): string {\n return Button.ID;\n }\n\n protected template(): HTMLTemplateElement {\n const template = document.createElement(\"template\");\n template.innerHTML = htmlTemplate;\n return template;\n }\n\n constructor() {\n super();\n this.addEventListener(\"keydown\", (e) => {\n if (this.isSpaceOrEnter(e)) {\n this._isSpaceOrEnterKeyDown = true;\n e.preventDefault(); // prevent potential scroll-down triggered by space\n }\n });\n this.addEventListener(\"keyup\", (e) => {\n if (this.isSpaceOrEnter(e) && this._isSpaceOrEnterKeyDown == true) {\n this._isSpaceOrEnterKeyDown = false;\n this.click();\n }\n });\n // As Button is not an input element, click is fired even in disabled state\n this.addEventListener(\n \"click\",\n (event) => {\n if (this.disabled || this.hasAttribute(\"disabled\")) {\n event.stopImmediatePropagation();\n return;\n }\n\n const type = this.getAttribute(\"type\")?.toLowerCase()?.trim();\n\n if (type !== \"submit\" && type !== \"reset\") {\n return;\n }\n\n const form = this.closest(\"form\");\n\n if (form && type === \"submit\") {\n form.requestSubmit();\n }\n\n if (form && type === \"reset\") {\n form.reset();\n }\n },\n { capture: true },\n );\n }\n\n private isSpaceOrEnter(event: KeyboardEvent): boolean {\n switch (event.key) {\n case \" \":\n case \"Space\":\n case \"Enter\":\n return true;\n default:\n return false;\n }\n }\n\n public click() {\n if (!this.disabled && !this.hasAttribute(\"disabled\")) {\n super.click();\n }\n }\n\n public connectedCallback() {\n super.connectedCallback();\n\n if (!this.hasAttribute(\"tabIndex\")) {\n this.tabIndex = 0;\n }\n\n this._image = this.shadowRoot.querySelector(\".icon\") as HTMLImageElement;\n\n this.updateIcon();\n if (!this.hasAttribute(\"role\")) {\n this.setAttribute(\"role\", \"button\");\n }\n }\n\n public attributeChangedCallback(): void {\n this.updateIcon();\n }\n\n private updateIcon() {\n if (this._image) {\n const iconSrc = this.getAttribute(\"icon\");\n if (iconSrc) {\n this._image.src = iconSrc;\n }\n }\n }\n}\n\nif (!customElements.get(Button.ID)) {\n customElements.define(Button.ID, Button);\n}\n"],"names":["htmlTemplate","_Button","ElementBase","e","event","type","form","icon","primary","disabled","template","iconSrc","Button"],"mappings":";AAAA,MAAAA,IAAe;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;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 {"version":3,"file":"button.mjs","sources":["../button.html?raw","../button.ts"],"sourcesContent":["export default \"<style>\\n\\t:host {\\n\\t\\tcontain: content;\\n\\t\\tbackground: rgba(20, 103, 186, 0);\\n\\t\\tcolor: #1467ba;\\n\\t\\tborder: none;\\n\\t\\toutline: none;\\n\\t\\tpadding: 0 8px;\\n\\t\\theight: 32px;\\n\\t\\tcursor: pointer;\\n\\t\\tuser-select: none;\\n\\t\\tdisplay: inline-flex;\\n\\t\\talign-items: center;\\n\\t\\tjustify-content: center;\\n\\t\\tbox-sizing: border-box;\\n\\t\\tvertical-align: middle;\\n\\t}\\n\\n\\t:host(:focus),\\n\\t:host(:not([disabled], [aria-disabled=\\\"true\\\"]):hover) {\\n\\t\\tbackground: rgba(20, 103, 186, 0.1);\\n\\t}\\n\\n\\t@media (forced-colors: active) {\\n\\t\\t:host(:not([disabled], [aria-disabled=\\\"true\\\"]):focus-visible) {\\n\\t\\t\\toutline: 1px solid;\\n\\t\\t}\\n\\t\\t:host {\\n\\t\\t\\tmargin: 1px;\\n\\t\\t}\\n\\t}\\n\\n\\t:host(:not([disabled], [aria-disabled=\\\"true\\\"]):focus-visible) {\\n\\t\\tbox-shadow: 0 0 0 1px #1467ba inset;\\n\\t}\\n\\n\\t:host(:not([disabled], [aria-disabled=\\\"true\\\"]):active) {\\n\\t\\tbackground: rgba(20, 103, 186, 0.2);\\n\\t}\\n\\n\\t:host([primary]) {\\n\\t\\tbackground: #1467ba;\\n\\t\\tcolor: #fff;\\n\\t}\\n\\n\\t:host([primary]:focus),\\n\\t:host(:not([disabled], [aria-disabled=\\\"true\\\"])[primary]:hover) {\\n\\t\\tbackground: #125da8;\\n\\t}\\n\\n\\t:host([primary]:focus-visible) {\\n\\t\\tbox-shadow: 0 0 0 1px white inset;\\n\\t}\\n\\n\\t:host(:not([disabled], [aria-disabled=\\\"true\\\"])[primary]:focus-visible) {\\n\\t\\toutline: 1px solid #1467ba;\\n\\t}\\n\\n\\t:host(:not([disabled], [aria-disabled=\\\"true\\\"])[primary]:active) {\\n\\t\\tbackground: #0e4883;\\n\\t}\\n\\n\\t:host([disabled]),\\n\\t:host([aria-disabled=\\\"true\\\"]) {\\n\\t\\tfilter: grayscale(100%);\\n\\t\\topacity: 0.5;\\n\\t\\tcursor: default;\\n\\t}\\n\\n\\t:host([disabled]:focus-visible),\\n\\t:host([aria-disabled=\\\"true\\\"]:focus-visible) {\\n\\t\\toutline: 1px dashed #111;\\n\\t}\\n\\n\\t.icon:not([src]),\\n\\t.icon[src=\\\"\\\"],\\n\\t.icon[src=\\\"data:,\\\"] {\\n\\t\\tdisplay: none;\\n\\t}\\n\\n\\t.content {\\n\\t\\tdisplay: flex;\\n\\t\\talign-items: center;\\n\\t\\tmin-width: 0px;\\n\\t}\\n\\n\\t.content ::slotted(*) {\\n\\t\\tmargin-left: var(--sd-button-content-padding, 8px);\\n\\t}\\n\\n\\t.content ::slotted(*:last-child) {\\n\\t\\tmargin-right: var(--sd-button-content-padding, 8px);\\n\\t}\\n\\n\\t.icon {\\n\\t\\tmax-height: var(--sd-button-max-icon-size, 32px);\\n\\t\\tmax-width: var(--sd-button-max-icon-size, 32px);\\n\\t}\\n</style>\\n<slot name=\\\"icon\\\">\\n\\t<img class=\\\"icon\\\" src=\\\"data:,\\\" alt part=\\\"icon\\\" />\\n</slot>\\n<div class=\\\"content\\\">\\n\\t<slot></slot>\\n</div>\\n\"","import { ElementBase } from \"@cas-smartdesign/element-base\";\n\nimport { default as htmlTemplate } from \"./button.html?raw\";\n\ndeclare global {\n interface HTMLElementTagNameMap {\n [Button.ID]: Button;\n }\n}\n\nexport class Button extends ElementBase {\n public static readonly ID = \"sd-button\";\n private _image: HTMLImageElement;\n private _isSpaceOrEnterKeyDown = false;\n\n public get imageElement() {\n return this._image;\n }\n\n public get icon(): string {\n return this.getAttribute(\"icon\");\n }\n\n public set icon(icon: string) {\n if (this.icon !== icon) {\n if (icon) {\n this.setAttribute(\"icon\", icon);\n } else {\n this.removeAttribute(\"icon\");\n }\n this.updateIcon();\n }\n }\n\n public get primary(): boolean {\n return this.hasAttribute(\"primary\");\n }\n\n public set primary(primary: boolean) {\n if (primary) {\n this.setAttribute(\"primary\", \"\");\n } else {\n this.removeAttribute(\"primary\");\n }\n }\n\n public get disabled(): boolean {\n return this.getAttribute(\"aria-disabled\") == \"true\";\n }\n\n public set disabled(disabled: boolean) {\n this.setAttribute(\"aria-disabled\", disabled.toString());\n }\n\n static get observedAttributes() {\n return [\"icon\"];\n }\n\n public is(): string {\n return Button.ID;\n }\n\n protected template(): HTMLTemplateElement {\n const template = document.createElement(\"template\");\n template.innerHTML = htmlTemplate;\n return template;\n }\n\n constructor() {\n super();\n this.addEventListener(\"keydown\", (e) => {\n if (this.isSpaceOrEnter(e)) {\n this._isSpaceOrEnterKeyDown = true;\n e.preventDefault(); // prevent potential scroll-down triggered by space\n }\n });\n this.addEventListener(\"keyup\", (e) => {\n if (this.isSpaceOrEnter(e) && this._isSpaceOrEnterKeyDown == true) {\n this._isSpaceOrEnterKeyDown = false;\n this.click();\n }\n });\n // As Button is not an input element, click is fired even in disabled state\n this.addEventListener(\n \"click\",\n (event) => {\n if (this.disabled || this.hasAttribute(\"disabled\")) {\n event.stopImmediatePropagation();\n return;\n }\n\n const type = this.getAttribute(\"type\")?.toLowerCase()?.trim();\n\n if (type !== \"submit\" && type !== \"reset\") {\n return;\n }\n\n const form = this.closest(\"form\");\n\n if (form && type === \"submit\") {\n form.requestSubmit();\n }\n\n if (form && type === \"reset\") {\n form.reset();\n }\n },\n { capture: true },\n );\n }\n\n private isSpaceOrEnter(event: KeyboardEvent): boolean {\n switch (event.key) {\n case \" \":\n case \"Space\":\n case \"Enter\":\n return true;\n default:\n return false;\n }\n }\n\n public click() {\n if (!this.disabled && !this.hasAttribute(\"disabled\")) {\n super.click();\n }\n }\n\n public connectedCallback() {\n super.connectedCallback();\n\n if (!this.hasAttribute(\"tabIndex\")) {\n this.tabIndex = 0;\n }\n\n this._image = this.shadowRoot.querySelector(\".icon\") as HTMLImageElement;\n\n this.updateIcon();\n if (!this.hasAttribute(\"role\")) {\n this.setAttribute(\"role\", \"button\");\n }\n }\n\n public attributeChangedCallback(): void {\n this.updateIcon();\n }\n\n private updateIcon() {\n if (this._image) {\n const iconSrc = this.getAttribute(\"icon\");\n if (iconSrc) {\n this._image.src = iconSrc;\n }\n }\n }\n}\n\nif (!customElements.get(Button.ID)) {\n customElements.define(Button.ID, Button);\n}\n"],"names":["htmlTemplate","_Button","ElementBase","e","event","type","form","icon","primary","disabled","template","iconSrc","Button"],"mappings":";AAAA,MAAAA,IAAe;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,GCUFC,IAAN,MAAMA,UAAeC,EAAY;AAAA,EA0DpC,cAAc;AACV,UAAA,GAxDJ,KAAQ,yBAAyB,IAyD7B,KAAK,iBAAiB,WAAW,CAACC,MAAM;AACpC,MAAI,KAAK,eAAeA,CAAC,MACrB,KAAK,yBAAyB,IAC9BA,EAAE,eAAA;AAAA,IAEV,CAAC,GACD,KAAK,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MAAM;AAAA,EAClB;AAAA,EAEO,KAAa;AAChB,WAAOR,EAAO;AAAA,EAClB;AAAA,EAEU,WAAgC;AACtC,UAAMS,IAAW,SAAS,cAAc,UAAU;AAClD,WAAAA,EAAS,YAAYV,GACdU;AAAA,EACX;AAAA,EA6CQ,eAAeN,GAA+B;AAClD,YAAQA,EAAM,KAAA;AAAA,MACV,KAAK;AAAA,MACL,KAAK;AAAA,MACL,KAAK;AACD,eAAO;AAAA,MACX;AACI,eAAO;AAAA,IAAA;AAAA,EAEnB;AAAA,EAEO,QAAQ;AACX,IAAI,CAAC,KAAK,YAAY,CAAC,KAAK,aAAa,UAAU,KAC/C,MAAM,MAAA;AAAA,EAEd;AAAA,EAEO,oBAAoB;AACvB,UAAM,kBAAA,GAED,KAAK,aAAa,UAAU,MAC7B,KAAK,WAAW,IAGpB,KAAK,SAAS,KAAK,WAAW,cAAc,OAAO,GAEnD,KAAK,WAAA,GACA,KAAK,aAAa,MAAM,KACzB,KAAK,aAAa,QAAQ,QAAQ;AAAA,EAE1C;AAAA,EAEO,2BAAiC;AACpC,SAAK,WAAA;AAAA,EACT;AAAA,EAEQ,aAAa;AACjB,QAAI,KAAK,QAAQ;AACb,YAAMO,IAAU,KAAK,aAAa,MAAM;AACxC,MAAIA,MACA,KAAK,OAAO,MAAMA;AAAA,IAE1B;AAAA,EACJ;AACJ;AAhJIV,EAAuB,KAAK;AADzB,IAAMW,IAANX;AAmJF,eAAe,IAAIW,EAAO,EAAE,KAC7B,eAAe,OAAOA,EAAO,IAAIA,CAAM;"}
package/dist/docs/doc.mjs CHANGED
@@ -152,8 +152,9 @@ document.querySelector("#declarative-with-code").addEventListener("click", (even
152
152
  outline: 1px dashed #111;
153
153
  }
154
154
 
155
- :host(:not([icon])) .icon,
156
- :host([icon=""]) .icon {
155
+ .icon:not([src]),
156
+ .icon[src=""],
157
+ .icon[src="data:,"] {
157
158
  display: none;
158
159
  }
159
160
 
@@ -176,7 +177,9 @@ document.querySelector("#declarative-with-code").addEventListener("click", (even
176
177
  max-width: var(--sd-button-max-icon-size, 32px);
177
178
  }
178
179
  </style>
179
- <img class="icon" src="data:," alt />
180
+ <slot name="icon">
181
+ <img class="icon" src="data:," alt part="icon" />
182
+ </slot>
180
183
  <div class="content">
181
184
  <slot></slot>
182
185
  </div>
@@ -7,52 +7,52 @@
7
7
  "@eslint/js@9.34.0": {
8
8
  "licenses": "MIT",
9
9
  "repository": "https://github.com/eslint/eslint",
10
- "licenseUrl": "https://github.com/eslint/eslint/raw/HEAD/LICENSE"
10
+ "licenseUrl": "https://unpkg.com/@eslint/js@9.34.0/LICENSE"
11
11
  },
12
12
  "@rollup/plugin-node-resolve@16.0.1": {
13
13
  "licenses": "MIT",
14
14
  "repository": "https://github.com/rollup/plugins",
15
- "licenseUrl": "https://github.com/rollup/plugins/raw/HEAD/LICENSE"
15
+ "licenseUrl": "https://unpkg.com/@rollup/plugin-node-resolve@16.0.1/LICENSE"
16
16
  },
17
17
  "@types/node@24.3.0": {
18
18
  "licenses": "MIT",
19
19
  "repository": "https://github.com/DefinitelyTyped/DefinitelyTyped",
20
- "licenseUrl": "https://github.com/DefinitelyTyped/DefinitelyTyped/raw/HEAD/LICENSE"
20
+ "licenseUrl": "https://unpkg.com/@types/node@24.3.0/LICENSE"
21
21
  },
22
22
  "@types/postcss-prefix-selector@1.16.3": {
23
23
  "licenses": "MIT",
24
24
  "repository": "https://github.com/DefinitelyTyped/DefinitelyTyped",
25
- "licenseUrl": "https://github.com/DefinitelyTyped/DefinitelyTyped/raw/HEAD/LICENSE"
25
+ "licenseUrl": "https://unpkg.com/@types/postcss-prefix-selector@1.16.3/LICENSE"
26
26
  },
27
27
  "@typescript-eslint/eslint-plugin@8.41.0": {
28
28
  "licenses": "MIT",
29
29
  "repository": "https://github.com/typescript-eslint/typescript-eslint",
30
- "licenseUrl": "https://github.com/typescript-eslint/typescript-eslint/raw/HEAD/LICENSE"
30
+ "licenseUrl": "https://unpkg.com/@typescript-eslint/eslint-plugin@8.41.0/LICENSE"
31
31
  },
32
32
  "@typescript-eslint/parser@8.41.0": {
33
33
  "licenses": "MIT",
34
34
  "repository": "https://github.com/typescript-eslint/typescript-eslint",
35
- "licenseUrl": "https://github.com/typescript-eslint/typescript-eslint/raw/HEAD/LICENSE"
35
+ "licenseUrl": "https://unpkg.com/@typescript-eslint/parser@8.41.0/LICENSE"
36
36
  },
37
37
  "@vitest/coverage-v8@3.2.4": {
38
38
  "licenses": "MIT",
39
39
  "repository": "https://github.com/vitest-dev/vitest",
40
- "licenseUrl": "https://github.com/vitest-dev/vitest/raw/HEAD/LICENSE"
40
+ "licenseUrl": "https://unpkg.com/@vitest/coverage-v8@3.2.4/LICENSE"
41
41
  },
42
42
  "@vitest/ui@3.2.4": {
43
43
  "licenses": "MIT",
44
44
  "repository": "https://github.com/vitest-dev/vitest",
45
- "licenseUrl": "https://github.com/vitest-dev/vitest/raw/HEAD/LICENSE"
45
+ "licenseUrl": "https://unpkg.com/@vitest/ui@3.2.4/LICENSE"
46
46
  },
47
47
  "axe-core@4.10.3": {
48
48
  "licenses": "MPL-2.0",
49
49
  "repository": "https://github.com/dequelabs/axe-core",
50
- "licenseUrl": "https://github.com/dequelabs/axe-core/raw/HEAD/LICENSE"
50
+ "licenseUrl": "https://unpkg.com/axe-core@4.10.3/LICENSE"
51
51
  },
52
52
  "cypress-axe@1.7.0": {
53
53
  "licenses": "MIT",
54
54
  "repository": "https://github.com/component-driven/cypress-axe",
55
- "licenseUrl": "https://github.com/component-driven/cypress-axe/raw/HEAD/License.md"
55
+ "licenseUrl": "https://unpkg.com/cypress-axe@1.7.0/License.md"
56
56
  },
57
57
  "cypress@15.0.0": {
58
58
  "licenses": "MIT",
@@ -62,131 +62,131 @@
62
62
  "esbuild@0.25.9": {
63
63
  "licenses": "MIT",
64
64
  "repository": "https://github.com/evanw/esbuild",
65
- "licenseUrl": "https://github.com/evanw/esbuild/raw/HEAD/LICENSE.md"
65
+ "licenseUrl": "https://unpkg.com/esbuild@0.25.9/LICENSE.md"
66
66
  },
67
67
  "eslint-config-google@0.14.0": {
68
68
  "licenses": "Apache-2.0",
69
69
  "repository": "https://github.com/google/eslint-config-google",
70
- "licenseUrl": "https://github.com/google/eslint-config-google/raw/HEAD/LICENSE"
70
+ "licenseUrl": "https://unpkg.com/eslint-config-google@0.14.0/LICENSE"
71
71
  },
72
72
  "eslint-config-prettier@10.1.8": {
73
73
  "licenses": "MIT",
74
74
  "repository": "https://github.com/prettier/eslint-config-prettier",
75
- "licenseUrl": "https://github.com/prettier/eslint-config-prettier/raw/HEAD/LICENSE"
75
+ "licenseUrl": "https://unpkg.com/eslint-config-prettier@10.1.8/LICENSE"
76
76
  },
77
77
  "eslint@9.34.0": {
78
78
  "licenses": "MIT",
79
79
  "repository": "https://github.com/eslint/eslint",
80
- "licenseUrl": "https://github.com/eslint/eslint/raw/HEAD/LICENSE"
80
+ "licenseUrl": "https://unpkg.com/eslint@9.34.0/LICENSE"
81
81
  },
82
82
  "github-markdown-css@5.8.1": {
83
83
  "licenses": "MIT",
84
84
  "repository": "https://github.com/sindresorhus/github-markdown-css",
85
- "licenseUrl": "https://github.com/sindresorhus/github-markdown-css/raw/HEAD/license"
85
+ "licenseUrl": "https://unpkg.com/github-markdown-css@5.8.1/license"
86
86
  },
87
87
  "highlight.js@11.11.1": {
88
88
  "licenses": "BSD-3-Clause",
89
89
  "repository": "https://github.com/highlightjs/highlight.js",
90
- "licenseUrl": "https://github.com/highlightjs/highlight.js/raw/HEAD/LICENSE"
90
+ "licenseUrl": "https://unpkg.com/highlight.js@11.11.1/LICENSE"
91
91
  },
92
92
  "junit-report-builder@5.1.1": {
93
93
  "licenses": "MIT",
94
94
  "repository": "https://github.com/davidparsson/junit-report-builder",
95
- "licenseUrl": "https://github.com/davidparsson/junit-report-builder/raw/HEAD/LICENSE"
95
+ "licenseUrl": "https://unpkg.com/junit-report-builder@5.1.1/LICENSE"
96
96
  },
97
97
  "lint-staged@16.1.5": {
98
98
  "licenses": "MIT",
99
99
  "repository": "https://github.com/lint-staged/lint-staged",
100
- "licenseUrl": "https://github.com/lint-staged/lint-staged/raw/HEAD/LICENSE"
100
+ "licenseUrl": "https://unpkg.com/lint-staged@16.1.5/LICENSE"
101
101
  },
102
102
  "marked@16.2.1": {
103
103
  "licenses": "MIT",
104
104
  "repository": "https://github.com/markedjs/marked",
105
- "licenseUrl": "https://github.com/markedjs/marked/raw/HEAD/LICENSE.md"
105
+ "licenseUrl": "https://unpkg.com/marked@16.2.1/LICENSE.md"
106
106
  },
107
107
  "postcss-prefix-selector@2.1.1": {
108
108
  "licenses": "MIT",
109
109
  "repository": "https://github.com/RadValentin/postcss-prefix-selector",
110
- "licenseUrl": "https://github.com/RadValentin/postcss-prefix-selector/raw/HEAD/LICENSE"
110
+ "licenseUrl": "https://unpkg.com/postcss-prefix-selector@2.1.1/LICENSE"
111
111
  },
112
112
  "postcss@8.5.6": {
113
113
  "licenses": "MIT",
114
114
  "repository": "https://github.com/postcss/postcss",
115
- "licenseUrl": "https://github.com/postcss/postcss/raw/HEAD/LICENSE"
115
+ "licenseUrl": "https://unpkg.com/postcss@8.5.6/LICENSE"
116
116
  },
117
117
  "prettier@3.6.2": {
118
118
  "licenses": "MIT",
119
119
  "repository": "https://github.com/prettier/prettier",
120
- "licenseUrl": "https://github.com/prettier/prettier/raw/HEAD/LICENSE"
120
+ "licenseUrl": "https://unpkg.com/prettier@3.6.2/LICENSE"
121
121
  },
122
122
  "resolve-pkg@2.0.0": {
123
123
  "licenses": "MIT",
124
124
  "repository": "https://github.com/sindresorhus/resolve-pkg",
125
- "licenseUrl": "https://github.com/sindresorhus/resolve-pkg/raw/HEAD/license"
125
+ "licenseUrl": "https://unpkg.com/resolve-pkg@2.0.0/license"
126
126
  },
127
127
  "sass@1.91.0": {
128
128
  "licenses": "MIT",
129
129
  "repository": "https://github.com/sass/dart-sass",
130
- "licenseUrl": "https://github.com/sass/dart-sass/raw/HEAD/LICENSE"
130
+ "licenseUrl": "https://unpkg.com/sass@1.91.0/LICENSE"
131
131
  },
132
132
  "stylelint-config-recommended-scss@16.0.0": {
133
133
  "licenses": "MIT",
134
134
  "repository": "https://github.com/stylelint-scss/stylelint-config-recommended-scss",
135
- "licenseUrl": "https://github.com/stylelint-scss/stylelint-config-recommended-scss/raw/HEAD/LICENSE"
135
+ "licenseUrl": "https://unpkg.com/stylelint-config-recommended-scss@16.0.0/LICENSE"
136
136
  },
137
137
  "stylelint-config-standard@39.0.0": {
138
138
  "licenses": "MIT",
139
139
  "repository": "https://github.com/stylelint/stylelint-config-standard",
140
- "licenseUrl": "https://github.com/stylelint/stylelint-config-standard/raw/HEAD/LICENSE"
140
+ "licenseUrl": "https://unpkg.com/stylelint-config-standard@39.0.0/LICENSE"
141
141
  },
142
142
  "stylelint-scss@6.12.1": {
143
143
  "licenses": "MIT",
144
144
  "repository": "https://github.com/stylelint-scss/stylelint-scss",
145
- "licenseUrl": "https://github.com/stylelint-scss/stylelint-scss/raw/HEAD/LICENSE"
145
+ "licenseUrl": "https://unpkg.com/stylelint-scss@6.12.1/LICENSE"
146
146
  },
147
147
  "stylelint@16.23.1": {
148
148
  "licenses": "MIT",
149
149
  "repository": "https://github.com/stylelint/stylelint",
150
- "licenseUrl": "https://github.com/stylelint/stylelint/raw/HEAD/LICENSE"
150
+ "licenseUrl": "https://unpkg.com/stylelint@16.23.1/LICENSE"
151
151
  },
152
152
  "tsup@8.5.0": {
153
153
  "licenses": "MIT",
154
154
  "repository": "https://github.com/egoist/tsup",
155
- "licenseUrl": "https://github.com/egoist/tsup/raw/HEAD/LICENSE"
155
+ "licenseUrl": "https://unpkg.com/tsup@8.5.0/LICENSE"
156
156
  },
157
157
  "turbo@2.5.6": {
158
158
  "licenses": "MIT",
159
159
  "repository": "https://github.com/vercel/turborepo",
160
- "licenseUrl": "https://github.com/vercel/turborepo/raw/HEAD/LICENSE"
160
+ "licenseUrl": "https://unpkg.com/turbo@2.5.6/LICENSE"
161
161
  },
162
162
  "typescript-eslint@8.41.0": {
163
163
  "licenses": "MIT",
164
164
  "repository": "https://github.com/typescript-eslint/typescript-eslint",
165
- "licenseUrl": "https://github.com/typescript-eslint/typescript-eslint/raw/HEAD/LICENSE"
165
+ "licenseUrl": "https://unpkg.com/typescript-eslint@8.41.0/LICENSE"
166
166
  },
167
167
  "typescript@5.9.2": {
168
168
  "licenses": "Apache-2.0",
169
169
  "repository": "https://github.com/microsoft/TypeScript",
170
- "licenseUrl": "https://github.com/microsoft/TypeScript/raw/HEAD/LICENSE.txt"
170
+ "licenseUrl": "https://unpkg.com/typescript@5.9.2/LICENSE.txt"
171
171
  },
172
172
  "vite-tsconfig-paths@5.1.4": {
173
173
  "licenses": "MIT",
174
174
  "repository": "https://github.com/aleclarson/vite-tsconfig-paths",
175
- "licenseUrl": "https://github.com/aleclarson/vite-tsconfig-paths/raw/HEAD/LICENSE"
175
+ "licenseUrl": "https://unpkg.com/vite-tsconfig-paths@5.1.4/LICENSE"
176
176
  },
177
177
  "vite@7.1.3": {
178
178
  "licenses": "MIT",
179
179
  "repository": "https://github.com/vitejs/vite",
180
- "licenseUrl": "https://github.com/vitejs/vite/raw/HEAD/LICENSE.md"
180
+ "licenseUrl": "https://unpkg.com/vite@7.1.3/LICENSE.md"
181
181
  },
182
182
  "vitest@3.2.4": {
183
183
  "licenses": "MIT",
184
184
  "repository": "https://github.com/vitest-dev/vitest",
185
- "licenseUrl": "https://github.com/vitest-dev/vitest/raw/HEAD/LICENSE.md"
185
+ "licenseUrl": "https://unpkg.com/vitest@3.2.4/LICENSE.md"
186
186
  },
187
187
  "yargs@18.0.0": {
188
188
  "licenses": "MIT",
189
189
  "repository": "https://github.com/yargs/yargs",
190
- "licenseUrl": "https://github.com/yargs/yargs/raw/HEAD/LICENSE"
190
+ "licenseUrl": "https://unpkg.com/yargs@18.0.0/LICENSE"
191
191
  }
192
192
  }
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "@cas-smartdesign/button",
3
- "version": "5.1.1",
3
+ "version": "5.2.1",
4
4
  "description": "A button element which encloses the look and feel of the smartdesign button",
5
5
  "main": "dist/button-with-externals.js",
6
6
  "module": "dist/button.mjs",
7
7
  "types": "dist/button.d.ts",
8
8
  "license": "SEE LICENSE IN LICENSE",
9
9
  "dependencies": {
10
- "@cas-smartdesign/element-base": "^5.1.0"
10
+ "@cas-smartdesign/element-base": "^5.1.1"
11
11
  },
12
12
  "files": [
13
13
  "dist",
@@ -18,8 +18,8 @@
18
18
  "access": "public"
19
19
  },
20
20
  "devDependencies": {
21
- "@cas-smartdesign/license-generator": "^1.7.0",
22
- "@cas-smartdesign/element-preview": "^0.3.0"
21
+ "@cas-smartdesign/license-generator": "^1.8.1",
22
+ "@cas-smartdesign/element-preview": "^0.3.1"
23
23
  },
24
24
  "scripts": {
25
25
  "version": "pnpm version",