@kyndryl-design-system/shidoka-applications 2.0.0 → 2.0.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.
package/README.md CHANGED
@@ -42,7 +42,7 @@ After installation, you can make use of tokens/variables included in root.css su
42
42
 
43
43
  ## Start using components
44
44
 
45
- See [Storybook](https://kyndryl-design-system.github.io/shidoka-applications/) for the full components documentation.
45
+ See [Storybook](https://shidoka-applications.netlify.app) for the full components documentation.
46
46
 
47
47
  ### Example: Component with Sub-components
48
48
 
@@ -119,15 +119,15 @@ import{_ as o}from"../../../vendor/tslib-53a81efe.js";import{t,n as r,b as e,l a
119
119
  .kd-btn[disabled] {
120
120
  cursor: not-allowed;
121
121
  }
122
- .kd-btn--solid-styles {
123
- position: relative;
124
- overflow: hidden;
125
- }
126
- .kd-btn--solid-styles span {
122
+ .kd-btn span {
127
123
  display: flex;
128
124
  align-items: center;
129
125
  z-index: 1;
130
126
  }
127
+ .kd-btn--solid-styles {
128
+ position: relative;
129
+ overflow: hidden;
130
+ }
131
131
  .kd-btn--solid-styles:before {
132
132
  content: "";
133
133
  position: absolute;
@@ -141,7 +141,7 @@ import{_ as o}from"../../../vendor/tslib-53a81efe.js";import{t,n as r,b as e,l a
141
141
  transform-origin: left;
142
142
  opacity: 0;
143
143
  }
144
- .kd-btn--solid-styles:hover:before {
144
+ .kd-btn--solid-styles:hover:before, .kd-btn--solid-styles:active:before {
145
145
  transform: scaleX(1);
146
146
  opacity: 1;
147
147
  }
@@ -220,6 +220,9 @@ import{_ as o}from"../../../vendor/tslib-53a81efe.js";import{t,n as r,b as e,l a
220
220
  .kd-btn--secondary-ai:focus {
221
221
  outline-color: var(--kd-color-border-button-ai-state-focused);
222
222
  }
223
+ .kd-btn--secondary-ai:active {
224
+ color: var(--kd-color-text-button-dark-primary);
225
+ }
223
226
  .kd-btn--secondary-ai:active:before {
224
227
  background-color: var(--kd-color-background-button-secondary-ai-pressed);
225
228
  }
@@ -309,6 +312,7 @@ import{_ as o}from"../../../vendor/tslib-53a81efe.js";import{t,n as r,b as e,l a
309
312
  .kd-btn--outline-ai:hover {
310
313
  background-color: var(--kd-color-background-button-primary-ai-hover);
311
314
  border-color: var(--kd-color-border-button-ai-state-hover);
315
+ color: var(--kd-color-text-level-light);
312
316
  }
313
317
  .kd-btn--outline-ai:focus {
314
318
  border-color: var(--kd-color-border-button-ai-state-focused);
@@ -317,6 +321,7 @@ import{_ as o}from"../../../vendor/tslib-53a81efe.js";import{t,n as r,b as e,l a
317
321
  .kd-btn--outline-ai:active {
318
322
  background-color: var(--kd-color-background-button-primary-ai-pressed);
319
323
  border-color: var(--kd-color-border-button-ai-state-pressed);
324
+ color: var(--kd-color-text-level-light);
320
325
  }
321
326
  .kd-btn--outline-destructive {
322
327
  color: var(--kd-color-text-button-light-destructive);
@@ -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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AA6F,UAAA,kBAAA,GAInBF,EAAA,CADCG,EAAS,CAAEvF,KAAMwF,UACD/F,EAAA6F,UAAA,kBAAA,GAMjBF,EAAA,CADCO,KACwBlG,EAAA6F,UAAA,mBAAA,GAMzBF,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","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,GAAS,KAC7B1B,KAAKsB,cACPtB,KAAK8B,eACN,GA2BJ,CAxJU,MAAAC,WACP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F,EAAA,CADCU,EAAM,YACMrG,EAAA6F,UAAA,cAAA,GAxGF7F,EAAM2F,EAAA,CADlBW,EAAc,eACFtG"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kyndryl-design-system/shidoka-applications",
3
- "version": "2.0.0",
3
+ "version": "2.0.1",
4
4
  "description": "Shidoka Web Components for Applications",
5
5
  "main": "index.js",
6
6
  "type": "module",