@kyndryl-design-system/shidoka-applications 2.7.1 → 2.7.2

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.
@@ -235,7 +235,6 @@ import{_ as o}from"../../../vendor/tslib-53a81efe.js";import{t,n as r,b as e,l a
235
235
  }
236
236
  .kd-btn--secondary-destructive:focus {
237
237
  outline-color: var(--kd-color-border-button-primary-destructive-default);
238
- background-color: var(--kd-color-background-button-secondary-destructive-hover);
239
238
  }
240
239
  .kd-btn--secondary-destructive:active {
241
240
  color: var(--kd-color-text-level-primary);
@@ -1 +1 @@
1
- {"version":3,"file":"button.js","sources":["../../../../src/components/reusable/button/button.ts"],"sourcesContent":["/**\n * Copyright Kyndryl, Inc. 2023\n */\n\nimport { html, LitElement } from 'lit';\nimport {\n customElement,\n property,\n state,\n query,\n queryAssignedNodes,\n queryAssignedElements,\n} from 'lit/decorators.js';\nimport { ifDefined } from 'lit/directives/if-defined.js';\nimport { classMap } from 'lit-html/directives/class-map.js';\nimport { debounce } from '../../../common/helpers/helpers';\n\nimport {\n BUTTON_KINDS,\n BUTTON_SIZES,\n BUTTON_TYPES,\n BUTTON_ICON_POSITION,\n BUTTON_KINDS_SOLID,\n BUTTON_KINDS_OUTLINE,\n} from './defs';\n\nimport stylesheet from './button.scss';\n\n/**\n * Button component.\n *\n * @slot unnamed - Slot for button text.\n * @slot icon - Slot for an icon.\n * @fires on-click - Emits the original click event.\n */\n@customElement('kyn-button')\nexport class Button extends LitElement {\n static override styles = [stylesheet];\n\n /** @ignore */\n static override shadowRootOptions = {\n ...LitElement.shadowRootOptions,\n delegatesFocus: true,\n };\n\n /**\n * Associate the component with forms.\n * @ignore\n */\n static formAssociated = true;\n\n /**\n * Attached internals for form association.\n * @ignore\n */\n @state()\n internals = this.attachInternals();\n\n /** ARIA label for the button for accessibility. */\n @property({ type: String })\n description = '';\n\n /** Type for the &lt;button&gt; element. */\n @property({ type: String })\n type: BUTTON_TYPES = BUTTON_TYPES.BUTTON;\n\n /** Specifies the visual appearance/kind of the button. */\n @property({ type: String })\n kind: BUTTON_KINDS = BUTTON_KINDS.PRIMARY;\n\n /** Converts the button to an &lt;a&gt; tag if specified. */\n @property({ type: String })\n href = '';\n\n /** Specifies the size of the button. */\n @property({ type: String })\n size: BUTTON_SIZES = BUTTON_SIZES.MEDIUM;\n\n /** Specifies the position of the icon relative to any button text. */\n @property({ type: String })\n iconPosition: BUTTON_ICON_POSITION = BUTTON_ICON_POSITION.CENTER;\n\n /** Determines if the button is disabled.\n * @internal\n */\n @state()\n iconOnly = false;\n\n /** Determines if the button is disabled. */\n @property({ type: Boolean, reflect: true })\n disabled = false;\n\n /** Button value. */\n @property({ type: String })\n value = '';\n\n /** Button name. */\n @property({ type: String })\n name = '';\n\n /** Determines if the button is Floatable */\n @property({ type: Boolean })\n isFloating = false;\n\n /** Show button after scrolling to 50% of the page*/\n @property({ type: Boolean })\n showOnScroll = false;\n\n /** Determines showButton state .\n * @internal\n */\n @state()\n _showButton = false;\n\n /** re-size button to 'medium' at mobile breakpoint.\n * @internal\n */\n @state()\n _reSizeBtn = false;\n\n /** Button formmethod. */\n @property({ type: String })\n formmethod!: any;\n\n /** Queries default slot nodes.\n * @internal\n */\n @queryAssignedNodes()\n _slottedEls!: Array<any>;\n\n /** Queries icon slot nodes.\n * @internal\n */\n @queryAssignedElements({ slot: 'icon' })\n _iconEls!: Array<any>;\n\n /** Queries the .button element.\n * @internal\n */\n @query('.button')\n _btnEl!: any;\n\n override render() {\n const BtnClasses = {\n 'kd-btn': true,\n [`kd-btn--${this.kind}`]: true,\n 'kd-btn--solid-styles': BUTTON_KINDS_SOLID.includes(this.kind),\n 'kd-btn--outline-styles': BUTTON_KINDS_OUTLINE.includes(this.kind),\n 'kd-btn--large': this.size === BUTTON_SIZES.LARGE,\n 'kd-btn--small': this.size === BUTTON_SIZES.SMALL,\n 'kd-btn--medium': this._reSizeBtn || this.size === BUTTON_SIZES.MEDIUM,\n 'kd-btn--icon-align': !!this.iconPosition,\n [`kd-btn--icon-${this.iconPosition}`]:\n !!this.iconPosition && !this.iconOnly,\n [`kd-btn--icon-center`]: this._iconEls?.length && this.iconOnly,\n 'kd-btn--float': this.isFloating,\n 'kd-btn--hidden': this.showOnScroll && !this._showButton,\n 'icon-only': this._iconEls?.length && this.iconOnly,\n };\n\n return html`\n ${this.href && this.href !== ''\n ? html`\n <a\n part=\"button\"\n class=${classMap(BtnClasses)}\n href=${this.href}\n ?disabled=${this.disabled}\n aria-label=${ifDefined(this.description)}\n title=${ifDefined(this.description)}\n @click=${(e: Event) => this.handleClick(e)}\n >\n <span>\n <slot @slotchange=${() => this._handleSlotChange()}></slot>\n <slot\n name=\"icon\"\n @slotchange=${() => this._handleSlotChange()}\n ></slot>\n </span>\n </a>\n `\n : html`\n <button\n part=\"button\"\n class=${classMap(BtnClasses)}\n type=${this.type}\n ?disabled=${this.disabled}\n aria-label=${ifDefined(this.description)}\n title=${ifDefined(this.description)}\n name=${ifDefined(this.name)}\n value=${ifDefined(this.value)}\n formmethod=${ifDefined(this.formmethod)}\n @click=${(e: Event) => this.handleClick(e)}\n >\n <span>\n <slot @slotchange=${() => this._handleSlotChange()}></slot>\n <slot\n name=\"icon\"\n @slotchange=${() => this._handleSlotChange()}\n ></slot>\n </span>\n </button>\n `}\n `;\n }\n\n private handleClick(e: Event) {\n if (this.internals.form) {\n if (this.type === 'submit') {\n this.internals.form.requestSubmit();\n } else if (this.type === 'reset') {\n this.internals.form.reset();\n }\n }\n\n const event = new CustomEvent('on-click', {\n detail: { origEvent: e },\n });\n this.dispatchEvent(event);\n }\n\n private _testIconOnly() {\n if (!this._iconEls?.length) {\n return false;\n }\n\n const TextNodes = this._slottedEls?.filter((node: any) => {\n return node.textContent.trim() !== '';\n });\n\n const VisibleTextNodes = TextNodes.filter((node: any) => {\n if (node.tagName) {\n const Styles = getComputedStyle(node);\n return Styles.display !== 'none' && Styles.visibility !== 'hidden';\n } else {\n return true;\n }\n });\n\n return !VisibleTextNodes.length;\n }\n\n private _handleSlotChange() {\n this.iconOnly = this._testIconOnly();\n this.requestUpdate();\n }\n\n /** @internal */\n private _debounceResize = debounce(() => {\n this._reSizeButton();\n this.iconOnly = this._testIconOnly();\n });\n\n /** @internal */\n private _reSizeButton() {\n // Resize button to medium at mobile breakpoint\n if ((this.isFloating || this.showOnScroll) && window.innerWidth <= 672) {\n this._reSizeBtn = true;\n } else {\n this._reSizeBtn = false;\n }\n }\n\n /** @internal */\n private _debounceScroll = debounce(() => {\n if (this.showOnScroll) {\n this._handleScroll();\n }\n });\n\n /** @internal */\n private _handleScroll() {\n const scrollPosition = window.scrollY;\n const windowHeight = window.innerHeight;\n const pageHeight = document.documentElement.scrollHeight;\n // Show the button if scrolled 50% of the page\n this._showButton = scrollPosition > (pageHeight - windowHeight) / 2;\n }\n\n override connectedCallback() {\n super.connectedCallback();\n window.addEventListener('resize', this._debounceResize);\n if (this.showOnScroll) {\n window.addEventListener('scroll', this._debounceScroll);\n }\n }\n\n override disconnectedCallback() {\n window.removeEventListener('resize', this._debounceResize);\n if (this.showOnScroll) {\n window.removeEventListener('scroll', this._debounceScroll);\n }\n super.disconnectedCallback();\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'kyn-button': Button;\n }\n}\n"],"names":["Button","LitElement","constructor","this","internals","attachInternals","description","type","BUTTON_TYPES","BUTTON","kind","BUTTON_KINDS","PRIMARY","href","size","BUTTON_SIZES","MEDIUM","iconPosition","BUTTON_ICON_POSITION","CENTER","iconOnly","disabled","value","name","isFloating","showOnScroll","_showButton","_reSizeBtn","_debounceResize","debounce","_reSizeButton","_testIconOnly","_debounceScroll","_handleScroll","render","BtnClasses","BUTTON_KINDS_SOLID","includes","BUTTON_KINDS_OUTLINE","LARGE","SMALL","_a","_iconEls","length","_b","html","classMap","ifDefined","e","handleClick","_handleSlotChange","formmethod","form","requestSubmit","reset","event","CustomEvent","detail","origEvent","dispatchEvent","_slottedEls","filter","node","textContent","trim","tagName","Styles","getComputedStyle","display","visibility","requestUpdate","window","innerWidth","scrollPosition","scrollY","windowHeight","innerHeight","pageHeight","document","documentElement","scrollHeight","connectedCallback","super","addEventListener","disconnectedCallback","removeEventListener","styles","stylesheet","shadowRootOptions","delegatesFocus","formAssociated","__decorate","state","prototype","property","String","Boolean","reflect","queryAssignedNodes","queryAssignedElements","slot","query","customElement"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCO,IAAMA,EAAN,cAAqBC,EAArB,WAAAC,uBAoBLC,KAAAC,UAAYD,KAAKE,kBAIjBF,KAAWG,YAAG,GAIdH,KAAAI,KAAqBC,EAAaC,OAIlCN,KAAAO,KAAqBC,EAAaC,QAIlCT,KAAIU,KAAG,GAIPV,KAAAW,KAAqBC,EAAaC,OAIlCb,KAAAc,aAAqCC,EAAqBC,OAM1DhB,KAAQiB,UAAG,EAIXjB,KAAQkB,UAAG,EAIXlB,KAAKmB,MAAG,GAIRnB,KAAIoB,KAAG,GAIPpB,KAAUqB,YAAG,EAIbrB,KAAYsB,cAAG,EAMftB,KAAWuB,aAAG,EAMdvB,KAAUwB,YAAG,EAkILxB,KAAAyB,gBAAkBC,GAAS,KACjC1B,KAAK2B,gBACL3B,KAAKiB,SAAWjB,KAAK4B,eAAe,IAc9B5B,KAAA6B,gBAAkBH,GA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EAAA,CADCQ,EAAsB,CAAEC,KAAM,UACTpG,EAAA6F,UAAA,gBAAA,GAMtBF,EAAA,CADCU,EAAM,YACMrG,EAAA6F,UAAA,cAAA,GAxGF7F,EAAM2F,EAAA,CADlBW,EAAc,eACFtG"}
1
+ {"version":3,"file":"button.js","sources":["../../../../src/components/reusable/button/button.ts"],"sourcesContent":["/**\n * Copyright Kyndryl, Inc. 2023\n */\n\nimport { html, LitElement } from 'lit';\nimport {\n customElement,\n property,\n state,\n query,\n queryAssignedNodes,\n queryAssignedElements,\n} from 'lit/decorators.js';\nimport { ifDefined } from 'lit/directives/if-defined.js';\nimport { classMap } from 'lit-html/directives/class-map.js';\nimport { debounce } from '../../../common/helpers/helpers';\n\nimport {\n BUTTON_KINDS,\n BUTTON_SIZES,\n BUTTON_TYPES,\n BUTTON_ICON_POSITION,\n BUTTON_KINDS_SOLID,\n BUTTON_KINDS_OUTLINE,\n} from './defs';\n\nimport stylesheet from './button.scss';\n\n/**\n * Button component.\n *\n * @slot unnamed - Slot for button text.\n * @slot icon - Slot for an icon.\n * @fires on-click - Emits the original click event.\n */\n@customElement('kyn-button')\nexport class Button extends LitElement {\n static override styles = [stylesheet];\n\n /** @ignore */\n static override shadowRootOptions = {\n ...LitElement.shadowRootOptions,\n delegatesFocus: true,\n };\n\n /**\n * Associate the component with forms.\n * @ignore\n */\n static formAssociated = true;\n\n /**\n * Attached internals for form association.\n * @ignore\n */\n @state()\n internals = this.attachInternals();\n\n /** ARIA label for the button for accessibility. */\n @property({ type: String })\n description = '';\n\n /** Type for the &lt;button&gt; element. */\n @property({ type: String })\n type: BUTTON_TYPES = BUTTON_TYPES.BUTTON;\n\n /** Specifies the visual appearance/kind of the button. */\n @property({ type: String })\n kind: BUTTON_KINDS = BUTTON_KINDS.PRIMARY;\n\n /** Converts the button to an &lt;a&gt; tag if specified. */\n @property({ type: String })\n href = '';\n\n /** Specifies the size of the button. */\n @property({ type: String })\n size: BUTTON_SIZES = BUTTON_SIZES.MEDIUM;\n\n /** Specifies the position of the icon relative to any button text. */\n @property({ type: String })\n iconPosition: BUTTON_ICON_POSITION = BUTTON_ICON_POSITION.CENTER;\n\n /** Determines if the button is disabled.\n * @internal\n */\n @state()\n iconOnly = false;\n\n /** Determines if the button is disabled. */\n @property({ type: Boolean, reflect: true })\n disabled = false;\n\n /** Button value. */\n @property({ type: String })\n value = '';\n\n /** Button name. */\n @property({ type: String })\n name = '';\n\n /** Determines if the button is Floatable */\n @property({ type: Boolean })\n isFloating = false;\n\n /** Show button after scrolling to 50% of the page*/\n @property({ type: Boolean })\n showOnScroll = false;\n\n /** Determines showButton state .\n * @internal\n */\n @state()\n _showButton = false;\n\n /** re-size button to 'medium' at mobile breakpoint.\n * @internal\n */\n @state()\n _reSizeBtn = false;\n\n /** Button formmethod. */\n @property({ type: String })\n formmethod!: any;\n\n /** Queries default slot nodes.\n * @internal\n */\n @queryAssignedNodes()\n _slottedEls!: Array<any>;\n\n /** Queries icon slot nodes.\n * @internal\n */\n @queryAssignedElements({ slot: 'icon' })\n _iconEls!: Array<any>;\n\n /** Queries the .button element.\n * @internal\n */\n @query('.button')\n _btnEl!: any;\n\n override render() {\n const BtnClasses = {\n 'kd-btn': true,\n [`kd-btn--${this.kind}`]: true,\n 'kd-btn--solid-styles': BUTTON_KINDS_SOLID.includes(this.kind),\n 'kd-btn--outline-styles': BUTTON_KINDS_OUTLINE.includes(this.kind),\n 'kd-btn--large': this.size === BUTTON_SIZES.LARGE,\n 'kd-btn--small': this.size === BUTTON_SIZES.SMALL,\n 'kd-btn--medium': this._reSizeBtn || this.size === BUTTON_SIZES.MEDIUM,\n 'kd-btn--icon-align': !!this.iconPosition,\n [`kd-btn--icon-${this.iconPosition}`]:\n !!this.iconPosition && !this.iconOnly,\n [`kd-btn--icon-center`]: this._iconEls?.length && this.iconOnly,\n 'kd-btn--float': this.isFloating,\n 'kd-btn--hidden': this.showOnScroll && !this._showButton,\n 'icon-only': this._iconEls?.length && this.iconOnly,\n };\n\n return html`\n ${this.href && this.href !== ''\n ? html`\n <a\n part=\"button\"\n class=${classMap(BtnClasses)}\n href=${this.href}\n ?disabled=${this.disabled}\n aria-label=${ifDefined(this.description)}\n title=${ifDefined(this.description)}\n @click=${(e: Event) => this.handleClick(e)}\n >\n <span>\n <slot @slotchange=${() => this._handleSlotChange()}></slot>\n <slot\n name=\"icon\"\n @slotchange=${() => this._handleSlotChange()}\n ></slot>\n </span>\n </a>\n `\n : html`\n <button\n part=\"button\"\n class=${classMap(BtnClasses)}\n type=${this.type}\n ?disabled=${this.disabled}\n aria-label=${ifDefined(this.description)}\n title=${ifDefined(this.description)}\n name=${ifDefined(this.name)}\n value=${ifDefined(this.value)}\n formmethod=${ifDefined(this.formmethod)}\n @click=${(e: Event) => this.handleClick(e)}\n >\n <span>\n <slot @slotchange=${() => this._handleSlotChange()}></slot>\n <slot\n name=\"icon\"\n @slotchange=${() => this._handleSlotChange()}\n ></slot>\n </span>\n </button>\n `}\n `;\n }\n\n private handleClick(e: Event) {\n if (this.internals.form) {\n if (this.type === 'submit') {\n this.internals.form.requestSubmit();\n } else if (this.type === 'reset') {\n this.internals.form.reset();\n }\n }\n\n const event = new CustomEvent('on-click', {\n detail: { origEvent: e },\n });\n this.dispatchEvent(event);\n }\n\n private _testIconOnly() {\n if (!this._iconEls?.length) {\n return false;\n }\n\n const TextNodes = this._slottedEls?.filter((node: any) => {\n return node.textContent.trim() !== '';\n });\n\n const VisibleTextNodes = TextNodes.filter((node: any) => {\n if (node.tagName) {\n const Styles = getComputedStyle(node);\n return Styles.display !== 'none' && Styles.visibility !== 'hidden';\n } else {\n return true;\n }\n });\n\n return !VisibleTextNodes.length;\n }\n\n private _handleSlotChange() {\n this.iconOnly = this._testIconOnly();\n this.requestUpdate();\n }\n\n /** @internal */\n private _debounceResize = debounce(() => {\n this._reSizeButton();\n this.iconOnly = this._testIconOnly();\n });\n\n /** @internal */\n private _reSizeButton() {\n // Resize button to medium at mobile breakpoint\n if ((this.isFloating || this.showOnScroll) && window.innerWidth <= 672) {\n this._reSizeBtn = true;\n } else {\n this._reSizeBtn = false;\n }\n }\n\n /** @internal */\n private _debounceScroll = debounce(() => {\n if (this.showOnScroll) {\n this._handleScroll();\n }\n });\n\n /** @internal */\n private _handleScroll() {\n const scrollPosition = window.scrollY;\n const windowHeight = window.innerHeight;\n const pageHeight = document.documentElement.scrollHeight;\n // Show the button if scrolled 50% of the page\n this._showButton = scrollPosition > (pageHeight - windowHeight) / 2;\n }\n\n override connectedCallback() {\n super.connectedCallback();\n window.addEventListener('resize', this._debounceResize);\n if (this.showOnScroll) {\n window.addEventListener('scroll', this._debounceScroll);\n }\n }\n\n override disconnectedCallback() {\n window.removeEventListener('resize', this._debounceResize);\n if (this.showOnScroll) {\n window.removeEventListener('scroll', this._debounceScroll);\n }\n super.disconnectedCallback();\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'kyn-button': Button;\n }\n}\n"],"names":["Button","LitElement","constructor","this","internals","attachInternals","description","type","BUTTON_TYPES","BUTTON","kind","BUTTON_KINDS","PRIMARY","href","size","BUTTON_SIZES","MEDIUM","iconPosition","BUTTON_ICON_POSITION","CENTER","iconOnly","disabled","value","name","isFloating","showOnScroll","_showButton","_reSizeBtn","_debounceResize","debounce","_reSizeButton","_testIconOnly","_debounceScroll","_handleScroll","render","BtnClasses","BUTTON_KINDS_SOLID","includes","BUTTON_KINDS_OUTLINE","LARGE","SMALL","_a","_iconEls","length","_b","html","classMap","ifDefined","e","handleClick","_handleSlotChange","formmethod","form","requestSubmit","reset","event","CustomEvent","detail","origEvent","dispatchEvent","_slottedEls","filter","node","textContent","trim","tagName","Styles","getComputedStyle","display","visibility","requestUpdate","window","innerWidth","scrollPosition","scrollY","windowHeight","innerHeight","pageHeight","document","documentElement","scrollHeight","connectedCallback","super","addEventListener","disconnectedCallback","removeEventListener","styles","stylesheet","shadowRootOptions","delegatesFocus","formAssociated","__decorate","state","prototype","property","String","Boolean","reflect","queryAssignedNodes","queryAssignedEl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l-design-system/shidoka-applications",
3
- "version": "2.7.1",
3
+ "version": "2.7.2",
4
4
  "description": "Shidoka Web Components for Applications",
5
5
  "main": "index.js",
6
6
  "type": "module",