@nysds/components 1.11.1 → 1.11.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.
package/dist/nysds.js CHANGED
@@ -1,5 +1,5 @@
1
1
  (function(u,pe){typeof exports=="object"&&typeof module<"u"?pe(exports):typeof define=="function"&&define.amd?define(["exports"],pe):(u=typeof globalThis<"u"?globalThis:u||self,pe(u.NYSDS={}))})(this,(function(u){"use strict";/*!
2
- * New York State Design System (v1.11.1)
2
+ * New York State Design System (v1.11.2)
3
3
  * Description: A design system for New York State's digital products.
4
4
  * Repository: https://github.com/its-hcd/nysds
5
5
  * License: MIT
@@ -592,7 +592,7 @@
592
592
  height: 100%;
593
593
  fill: currentColor;
594
594
  }
595
- `;var W1=Object.defineProperty,Q=(a,e,t,o)=>{for(var s=void 0,r=a.length-1,n;r>=0;r--)(n=a[r])&&(s=n(e,t,s)||s);return s&&W1(e,t,s),s};let Y1=0;const _t=class _t extends p{constructor(){super(...arguments),this.id="",this.ariaLabel="",this.image="",this.initials="",this.icon="",this.color="",this.interactive=!1,this.disabled=!1,this.lazy=!1,this._slotHasContent=!0}connectedCallback(){super.connectedCallback(),this.id||(this.id=`nys-avatar-${Date.now()}-${Y1++}`)}firstUpdated(){this._checkSlotContent()}async _checkSlotContent(){const e=this.shadowRoot?.querySelector("slot");if(!e){this._slotHasContent=!1;return}await Promise.resolve();const t=e.assignedNodes({flatten:!0}).filter(o=>o.nodeType===Node.ELEMENT_NODE||o.nodeType===Node.TEXT_NODE&&o.textContent?.trim());this._slotHasContent=t.length>0}getContrastForeground(){const e="var(--nys-color-ink, #000)",t="var(--nys-color-ink-reverse, #fff)",o="var(--nys-color-text, #000)",s="var(--nys-color-text-reverse, #fff)";if(!this.color)return;const r=document.createElement("div");r.style.color=this.color,document.body.appendChild(r);const n=getComputedStyle(r).color;document.body.removeChild(r);const c=n.match(/\d+/g);if(!c)return;const d=Number(c[0]),h=Number(c[1]),f=Number(c[2]),w=(.299*d+.587*h+.114*f)/255<.5;return this.initials?.length>0?w?s:o:w?t:e}render(){return l`
595
+ `;var W1=Object.defineProperty,Q=(a,e,t,o)=>{for(var s=void 0,r=a.length-1,n;r>=0;r--)(n=a[r])&&(s=n(e,t,s)||s);return s&&W1(e,t,s),s};let Y1=0;const _t=class _t extends p{constructor(){super(...arguments),this.id="",this.ariaLabel="",this.image="",this.initials="",this.icon="",this.color="",this.interactive=!1,this.disabled=!1,this.lazy=!1,this._slotHasContent=!1}connectedCallback(){super.connectedCallback(),this.id||(this.id=`nys-avatar-${Date.now()}-${Y1++}`)}async _handleSlotChange(){const e=this.shadowRoot?.querySelector("slot");if(!e){this._slotHasContent=!1;return}await Promise.resolve();const t=e.assignedNodes({flatten:!0}).filter(o=>o.nodeType===Node.ELEMENT_NODE||o.nodeType===Node.TEXT_NODE&&o.textContent?.trim());this._slotHasContent=t.length>0}getContrastForeground(){const e="var(--nys-color-ink, #000)",t="var(--nys-color-ink-reverse, #fff)",o="var(--nys-color-text, #000)",s="var(--nys-color-text-reverse, #fff)";if(!this.color)return;const r=document.createElement("div");r.style.color=this.color,document.body.appendChild(r);const n=getComputedStyle(r).color;document.body.removeChild(r);const c=n.match(/\d+/g);if(!c)return;const d=Number(c[0]),h=Number(c[1]),f=Number(c[2]),w=(.299*d+.587*h+.114*f)/255<.5;return this.initials?.length>0?w?s:o:w?t:e}render(){return l`
596
596
  <label class="nys-avatar" id=${this.id}>
597
597
  <div class="nys-avatar__content">
598
598
  <div
@@ -614,14 +614,13 @@
614
614
  class="nys-avatar__initials"
615
615
  aria-hidden="true"
616
616
  >${this.initials}</span
617
- >`:this._slotHasContent?l`<div part="nys-avatar__icon">
618
- <slot></slot>
619
- </div>`:l`<div part="nys-avatar__icon">
620
- <nys-icon
621
- label="nys-avatar__icon"
622
- name=${this.icon?.length>0?this.icon:"account_circle"}
623
- ></nys-icon>
624
- </div>`}
617
+ >`:l`<div part="nys-avatar__icon">
618
+ <slot @slotchange=${this._handleSlotChange}></slot>
619
+ ${this._slotHasContent?null:l`<nys-icon
620
+ label="nys-avatar__icon"
621
+ name=${this.icon?.length>0?this.icon:"account_circle"}
622
+ ></nys-icon>`}
623
+ </div>`}
625
624
  </div>
626
625
  </div>
627
626
  </label>
@@ -666,8 +665,12 @@
666
665
  --_nys-button-height: var(--nys-size-600, 48px);
667
666
  --_nys-button-border-radius--start: var(--nys-radius-xl, 12px);
668
667
  --_nys-button-border-radius--end: var(--nys-radius-xl, 12px);
669
- --_nys-button-padding--y: var(--nys-space-150, 12px);
670
- --_nys-button-padding--x: var(--nys-space-250, 20px);
668
+ --_nys-button-padding--y: calc(
669
+ var(--nys-space-150, 12px) - var(--nys-border-width-md, 2px)
670
+ ); /* remove calc when SASS'd */
671
+ --_nys-button-padding--x: calc(
672
+ var(--nys-space-250, 20px) - var(--nys-border-width-md, 2px)
673
+ ); /* remove calc when SASS'd */
671
674
  --_nys-button-gap: var(--nys-space-100, 8px);
672
675
  --_nys-button-border-width: var(--nys-border-width-md, 2px);
673
676
  --_nys-button-outline-width: var(--nys-border-width-md, 2px);
@@ -741,18 +744,30 @@
741
744
  /* Sizes */
742
745
  :host([size="sm"]) {
743
746
  --_nys-button-height: var(--nys-size-500, 40px);
744
- --_nys-button-padding--y: var(--nys-space-100, 8px);
745
- --_nys-button-padding--x: var(--nys-space-200, 16px);
747
+ --_nys-button-padding--y: calc(
748
+ var(--nys-space-100, 8px) - var(--nys-border-width-md, 2px)
749
+ ); /* remove calc when SASS'd */
750
+ --_nys-button-padding--x: calc(
751
+ var(--nys-space-200, 16px) - var(--nys-border-width-md, 2px)
752
+ ); /* remove calc when SASS'd */
746
753
  }
747
754
  :host([size="md"]) {
748
755
  --_nys-button-height: var(--nys-size-600, 48px);
749
- --_nys-button-padding--y: var(--nys-space-150, 12px);
750
- --_nys-button-padding--x: var(--nys-space-250, 20px);
756
+ --_nys-button-padding--y: calc(
757
+ var(--nys-space-150, 12px) - var(--nys-border-width-md, 2px)
758
+ ); /* remove calc when SASS'd */
759
+ --_nys-button-padding--x: calc(
760
+ var(--nys-space-250, 20px) - var(--nys-border-width-md, 2px)
761
+ ); /* remove calc when SASS'd */
751
762
  }
752
763
  :host([size="lg"]) {
753
764
  --_nys-button-height: var(--nys-size-700, 56px);
754
- --_nys-button-padding--y: var(--nys-space-200, 16px);
755
- --_nys-button-padding--x: var(--nys-space-300, 24px);
765
+ --_nys-button-padding--y: calc(
766
+ var(--nys-space-200, 16px) - var(--nys-border-width-md, 2px)
767
+ ); /* remove calc when SASS'd */
768
+ --_nys-button-padding--x: calc(
769
+ var(--nys-space-300, 24px) - var(--nys-border-width-md, 2px)
770
+ ); /* remove calc when SASS'd */
756
771
  }
757
772
  :host([fullWidth]) {
758
773
  --_nys-button-width: 100%;
@@ -1232,7 +1247,6 @@
1232
1247
  .nys-button {
1233
1248
  width: var(--_nys-button-width);
1234
1249
  min-height: var(--_nys-button-height);
1235
- height: var(--_nys-button-height);
1236
1250
  /* set every corner individually */
1237
1251
  border-start-start-radius: var(--_nys-button-border-radius--start);
1238
1252
  border-end-start-radius: var(--_nys-button-border-radius--start);
@@ -2368,8 +2382,7 @@
2368
2382
  ${this._dragActive?"drag-active":""}
2369
2383
  ${this._isDropDisabled?"disabled":""}
2370
2384
  ${this.showError&&!this._isDropDisabled?"error":""}"
2371
- @click=${this._isDropDisabled?null:this._openFileDialog}
2372
- @keydown=${e=>!this._isDropDisabled&&(e.key==="Enter"||e.key===" ")&&this._openFileDialog()}
2385
+ @click=${this._isDropDisabled?null:e=>{e.target.closest("nys-button")||this._openFileDialog()}}
2373
2386
  @dragover=${this._isDropDisabled?null:this._onDragOver}
2374
2387
  @dragleave=${this._isDropDisabled?null:this._onDragLeave}
2375
2388
  @drop=${this._isDropDisabled?null:this._onDrop}
@@ -2383,8 +2396,7 @@
2383
2396
  ariaLabel=${this._buttonAriaLabel}
2384
2397
  ariaDescription=${this._buttonAriaDescription}
2385
2398
  ?disabled=${this._isDropDisabled}
2386
- @nys-click=${e=>{e.stopPropagation(),this._openFileDialog()}}
2387
- @click=${e=>e.stopPropagation()}
2399
+ @nys-click="${e=>{e.preventDefault(),e.stopPropagation(),this._openFileDialog()}}"
2388
2400
  ></nys-button>
2389
2401
  <p>or drag here</p>`}
2390
2402
  </div>`:l`<nys-button
@@ -3161,7 +3173,7 @@
3161
3173
  ?inverted=${this.inverted}
3162
3174
  >
3163
3175
  <div class="nys-label__tooltip-icon">
3164
- <nys-icon name="info" size="3xl"></nys-icon>
3176
+ <nys-icon name="info" size="4xl"></nys-icon>
3165
3177
  </div>
3166
3178
  </nys-tooltip>`:""}
3167
3179
  </div>
@@ -3320,7 +3332,7 @@
3320
3332
  align-items: center;
3321
3333
  }
3322
3334
  }
3323
- `;var Ds=Object.defineProperty,Ms=Object.getOwnPropertyDescriptor,be=(a,e,t,o)=>{for(var s=o>1?void 0:o?Ms(e,t):e,r=a.length-1,n;r>=0;r--)(n=a[r])&&(s=(o?n(e,t,s):n(s))||s);return o&&s&&Ds(e,t,s),s};let zs=0;const oe=(me=class extends p{constructor(){super(),this.id="",this.heading="",this.subheading="",this.open=!1,this.mandatory=!1,this._width="md",this._actionButtonSlot=null,this._prevFocusedElement=null,this._originalBodyOverflow=null,this.hasBodySlots=!1,this.hasActionSlots=!1}get width(){return this._width}set width(e){this._width=me.VALID_WIDTHS.includes(e)?e:"md"}connectedCallback(){super.connectedCallback(),this.id||(this.id=`nys-{{componentName}}-${Date.now()}-${zs++}`),window.addEventListener("resize",()=>this._updateSlottedButtonWidth()),window.addEventListener("keydown",e=>this._handleKeydown(e))}disconnectedCallback(){super.disconnectedCallback(),this._restoreBodyScroll(),window.removeEventListener("keydown",e=>this._handleKeydown(e))}firstUpdated(){this._handleBodySlotChange(),this._handleActionSlotChange()}async updated(e){e.has("open")&&(this.open?(this._hideBodyScroll(),this._dispatchOpenEvent(),await this.updateComplete,this._savePrevFocused(),this._focusOnModal(),this._updateDismissAria()):(this._restorePrevFocused(),this._restoreBodyScroll(),this._dispatchCloseEvent(),this._updateDismissAria()))}_hideBodyScroll(){this._originalBodyOverflow===null&&(this._originalBodyOverflow=document.body.style.overflow),document.body.style.overflow="hidden"}_restoreBodyScroll(){this._originalBodyOverflow!==null&&(document.body.style.overflow=this._originalBodyOverflow,this._originalBodyOverflow=null)}_savePrevFocused(){this._prevFocusedElement=document.activeElement}_focusOnModal(){this.shadowRoot?.querySelector(".nys-modal")?.focus()}async _restorePrevFocused(){const e=this._prevFocusedElement;if(e&&e.tagName.toLowerCase()==="nys-button"){const o=await e.getButtonElement();if(o){o.focus();return}}else this._prevFocusedElement?.focus();this._prevFocusedElement=null}async _handleBodySlotChange(){const e=this.shadowRoot?.querySelector("slot");e&&(this.hasBodySlots=e.assignedNodes({flatten:!0}).some(t=>t.nodeType===Node.ELEMENT_NODE||t.textContent?.trim()))}async _handleActionSlotChange(){const e=this.shadowRoot?.querySelector('slot[name="actions"]');e&&(this.hasActionSlots=e.assignedNodes({flatten:!0}).some(t=>t.nodeType===Node.ELEMENT_NODE||t.textContent?.trim()),this._actionButtonSlot=e,this._updateSlottedButtonWidth())}_updateSlottedButtonWidth(){if(!this._actionButtonSlot)return;const e=window.innerWidth<=480;this._actionButtonSlot.assignedElements().forEach(t=>{t.querySelectorAll("nys-button").forEach(o=>{e?o?.setAttribute("fullWidth",""):o?.removeAttribute("fullWidth")})})}_dispatchOpenEvent(){this.dispatchEvent(new CustomEvent("nys-open",{detail:{id:this.id},bubbles:!0,composed:!0}))}_dispatchCloseEvent(){this.dispatchEvent(new CustomEvent("nys-close",{detail:{id:this.id},bubbles:!0,composed:!0}))}_getAriaDescribedBy(){const e=[];return this.subheading&&e.push(`${this.id}-subheading`),this.hasBodySlots&&e.push(`${this.id}-desc`),e.join(" ")}_updateDismissAria(){const e=this.shadowRoot?.querySelector("nys-button");e&&(e.setAttribute("ariaLabel"," "),this.open&&setTimeout(()=>{e.setAttribute("ariaLabel","Close this window")},100))}async _handleKeydown(e){if(this.open&&(e.key==="Escape"&&!this.mandatory&&(e.preventDefault(),this._closeModal()),e.key==="Tab")){const t=this.shadowRoot?.querySelector(".nys-modal");if(!t)return;const o='a[href], area[href], button:not([disabled]), details, iframe, object, input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [contentEditable="true"], [tabindex]:not([tabindex^="-"])',s=[],r=t.querySelector("nys-button");r&&s.push(r);const n=Array.from(t.querySelectorAll("slot"));for(const c of n){const d=c.assignedElements({flatten:!0});for(const h of d)h instanceof HTMLElement&&h.matches(o)&&s.push(h),h.querySelectorAll("nys-button").forEach(f=>{s.push(f)})}if(s.length>0){const c=s[0],d=s[s.length-1];let h=document.activeElement,f=s.indexOf(h);if(e.shiftKey){e.preventDefault();let v=f-1;v<0&&(v=s.length-1);const w=s[v];s[v].tagName.toLowerCase()==="nys-button"?(await w.getButtonElement())?.focus():w.focus()}else h===d&&(e.preventDefault(),c.tagName.toLowerCase()==="nys-button"?(await c.getButtonElement())?.focus():c.focus())}}}_closeModal(){this.open=!1,this._dispatchCloseEvent()}render(){return this.open?l`<div
3335
+ `;var Ds=Object.defineProperty,Ms=Object.getOwnPropertyDescriptor,be=(a,e,t,o)=>{for(var s=o>1?void 0:o?Ms(e,t):e,r=a.length-1,n;r>=0;r--)(n=a[r])&&(s=(o?n(e,t,s):n(s))||s);return o&&s&&Ds(e,t,s),s};let zs=0;const oe=(me=class extends p{constructor(){super(),this.id="",this.heading="",this.subheading="",this.open=!1,this.mandatory=!1,this._width="md",this._actionButtonSlot=null,this._prevFocusedElement=null,this._originalBodyOverflow=null,this.hasBodySlots=!1,this.hasActionSlots=!1}get width(){return this._width}set width(e){this._width=me.VALID_WIDTHS.includes(e)?e:"md"}connectedCallback(){super.connectedCallback(),this.id||(this.id=`nys-{{componentName}}-${Date.now()}-${zs++}`),window.addEventListener("resize",()=>this._updateSlottedButtonWidth()),window.addEventListener("keydown",e=>this._handleKeydown(e))}disconnectedCallback(){super.disconnectedCallback(),this._restoreBodyScroll(),window.removeEventListener("keydown",e=>this._handleKeydown(e))}async updated(e){e.has("open")&&(this.open?(this._hideBodyScroll(),this._dispatchOpenEvent(),await this.updateComplete,this._savePrevFocused(),this._focusOnModal(),this._updateDismissAria()):(this._restorePrevFocused(),this._restoreBodyScroll(),this._dispatchCloseEvent(),this._updateDismissAria()))}_hideBodyScroll(){this._originalBodyOverflow===null&&(this._originalBodyOverflow=document.body.style.overflow),document.body.style.overflow="hidden"}_restoreBodyScroll(){this._originalBodyOverflow!==null&&(document.body.style.overflow=this._originalBodyOverflow,this._originalBodyOverflow=null)}_savePrevFocused(){this._prevFocusedElement=document.activeElement}_focusOnModal(){this.shadowRoot?.querySelector(".nys-modal")?.focus()}async _restorePrevFocused(){const e=this._prevFocusedElement;if(e&&e.tagName.toLowerCase()==="nys-button"){const o=await e.getButtonElement();if(o){o.focus();return}}else this._prevFocusedElement?.focus();this._prevFocusedElement=null}async _handleBodySlotChange(){const e=this.shadowRoot?.querySelector("slot");e&&(this.hasBodySlots=e.assignedNodes({flatten:!0}).some(t=>t.nodeType===Node.ELEMENT_NODE||t.textContent?.trim()))}async _handleActionSlotChange(){const e=this.shadowRoot?.querySelector('slot[name="actions"]');e&&(this.hasActionSlots=e.assignedNodes({flatten:!0}).some(t=>t.nodeType===Node.ELEMENT_NODE||t.textContent?.trim()),this._actionButtonSlot=e,this._updateSlottedButtonWidth())}_updateSlottedButtonWidth(){if(!this._actionButtonSlot)return;const e=window.innerWidth<=480;this._actionButtonSlot.assignedElements().forEach(t=>{t.querySelectorAll("nys-button").forEach(o=>{e?o?.setAttribute("fullWidth",""):o?.removeAttribute("fullWidth")})})}_dispatchOpenEvent(){this.dispatchEvent(new CustomEvent("nys-open",{detail:{id:this.id},bubbles:!0,composed:!0}))}_dispatchCloseEvent(){this.dispatchEvent(new CustomEvent("nys-close",{detail:{id:this.id},bubbles:!0,composed:!0}))}_getAriaDescribedBy(){const e=[];return this.subheading&&e.push(`${this.id}-subheading`),this.hasBodySlots&&e.push(`${this.id}-desc`),e.join(" ")}_updateDismissAria(){const e=this.shadowRoot?.querySelector("nys-button");e&&(e.setAttribute("ariaLabel"," "),this.open&&setTimeout(()=>{e.setAttribute("ariaLabel","Close this window")},100))}async _handleKeydown(e){if(this.open&&(e.key==="Escape"&&!this.mandatory&&(e.preventDefault(),this._closeModal()),e.key==="Tab")){const t=this.shadowRoot?.querySelector(".nys-modal");if(!t)return;const o='a[href], area[href], button:not([disabled]), details, iframe, object, input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [contentEditable="true"], [tabindex]:not([tabindex^="-"])',s=[],r=t.querySelector("nys-button");r&&s.push(r);const n=Array.from(t.querySelectorAll("slot"));for(const c of n){const d=c.assignedElements({flatten:!0});for(const h of d)h instanceof HTMLElement&&h.matches(o)&&s.push(h),h.querySelectorAll("nys-button").forEach(f=>{s.push(f)})}if(s.length>0){const c=s[0],d=s[s.length-1];let h=document.activeElement,f=s.indexOf(h);if(e.shiftKey){e.preventDefault();let v=f-1;v<0&&(v=s.length-1);const w=s[v];s[v].tagName.toLowerCase()==="nys-button"?(await w.getButtonElement())?.focus():w.focus()}else h===d&&(e.preventDefault(),c.tagName.toLowerCase()==="nys-button"?(await c.getButtonElement())?.focus():c.focus())}}}_closeModal(){this.open=!1,this._dispatchCloseEvent()}render(){return this.open?l`<div
3324
3336
  id=${this.id}
3325
3337
  class="nys-modal-overlay"
3326
3338
  role="dialog"
@@ -3502,7 +3514,7 @@
3502
3514
  display: none;
3503
3515
  }
3504
3516
  }
3505
- `;var Hs=Object.defineProperty,Ge=(a,e,t,o)=>{for(var s=void 0,r=a.length-1,n;r>=0;r--)(n=a[r])&&(s=n(e,t,s)||s);return s&&Hs(e,t,s),s};let Bs=0;const kt=class kt extends p{constructor(){super(),this.id="",this.name="",this.currentPage=1,this.totalPages=1,this._twoBeforeLast=!1}updated(e){super.updated(e),this.currentPage=this._clampPage(this.currentPage),this._twoBeforeLast=this.currentPage===this.totalPages-2}connectedCallback(){super.connectedCallback(),this.id||(this.id=`nys-pagination-${Date.now()}-${Bs++}`)}_clampPage(e){return e<1?1:e>this.totalPages?this.totalPages:e}renderPageButtons(){const e=[],t=(d,h)=>{e.push(l`
3517
+ `;var Hs=Object.defineProperty,Ge=(a,e,t,o)=>{for(var s=void 0,r=a.length-1,n;r>=0;r--)(n=a[r])&&(s=n(e,t,s)||s);return s&&Hs(e,t,s),s};let Bs=0;const kt=class kt extends p{constructor(){super(),this.id="",this.name="",this.currentPage=1,this.totalPages=1,this._twoBeforeLast=!1}willUpdate(e){if(e.has("currentPage")||e.has("totalPages")){const t=this._clampPage(this.currentPage);t!==this.currentPage&&(this.currentPage=t);const o=this.currentPage===this.totalPages-2;o!==this._twoBeforeLast&&(this._twoBeforeLast=o)}}connectedCallback(){super.connectedCallback(),this.id||(this.id=`nys-pagination-${Date.now()}-${Bs++}`)}_clampPage(e){return e<1?1:e>this.totalPages?this.totalPages:e}renderPageButtons(){const e=[],t=(d,h)=>{e.push(l`
3506
3518
  <nys-button
3507
3519
  label=${String(d)}
3508
3520
  ariaLabel="Page ${d}"
@@ -3908,7 +3920,7 @@
3908
3920
  overflow: hidden;
3909
3921
  border: 0;
3910
3922
  }
3911
- `;var Is=Object.defineProperty,Ps=Object.getOwnPropertyDescriptor,H=(a,e,t,o)=>{for(var s=o>1?void 0:o?Ps(e,t):e,r=a.length-1,n;r>=0;r--)(n=a[r])&&(s=(o?n(e,t,s):n(s))||s);return o&&s&&Is(e,t,s),s};let Os=0;const D=(de=class extends p{constructor(){super(),this.id="",this.name="",this.required=!1,this.optional=!1,this.showError=!1,this.errorMessage="",this.label="",this.description="",this.tile=!1,this._tooltip="",this.inverted=!1,this.form=null,this.selectedValue=null,this._slottedDescriptionText="",this._size="md",this._internals=this.attachInternals()}get size(){return this._size}set size(e){this._size=de.VALID_SIZES.includes(e)?e:"md"}connectedCallback(){super.connectedCallback(),this.id||(this.id=`nys-radiogroup-${Date.now()}-${Os++}`),this.addEventListener("nys-change",this._handleRadioButtonChange),this.addEventListener("invalid",this._handleInvalid)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("nys-change",this._handleRadioButtonChange),this.removeEventListener("invalid",this._handleInvalid)}async firstUpdated(){this._initializeCheckedRadioValue(),this._setValue(),this._setRadioButtonRequire(),this._updateRadioButtonsSize(),this._updateRadioButtonsTile(),this._updateRadioButtonsShowError(),this._getSlotDescriptionForAria(),await this.updateComplete,this._initializeChildAttributes(),this._updateGroupTabIndex()}updated(e){(e.has("required")||e.has("selectedValue"))&&this._manageRequire(),e.has("size")&&this._updateRadioButtonsSize(),e.has("tile")&&this._updateRadioButtonsTile(),e.has("inverted")&&this._updateRadioButtonsInvert(),e.has("showError")&&this._updateRadioButtonsShowError(),e.has("form")&&this._updateRadioButtonsForm()}formResetCallback(){this.querySelectorAll("nys-radiobutton").forEach(t=>{t.formResetUpdate()})}_setValue(){this._internals.setFormValue(this.selectedValue)}_setRadioButtonRequire(){this.querySelectorAll("nys-radiobutton").forEach((t,o)=>{this.required&&o===0&&t.setAttribute("required","required")})}async _manageRequire(){const e=this.errorMessage||"Please select an option.",o=Array.from(this.querySelectorAll("nys-radiobutton"))[0];o&&(this.required&&!this.selectedValue?this._internals.setValidity({valueMissing:!0},e,o):(this.showError=!1,this._internals.setValidity({},"",o)))}checkValidity(){const e=Array.from(this.querySelectorAll("nys-radiobutton"));return!this.required||e.some(o=>o.checked)}_initializeCheckedRadioValue(){const e=this.querySelector("nys-radiobutton[checked]");e&&(this.selectedValue=e.getAttribute("value"),this._internals.setFormValue(this.selectedValue))}_getAllRadios(){return Array.from(this.querySelectorAll("nys-radiobutton"))}async _handleKeyDown(e){if(!["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"," ","Enter"].includes(e.key))return;e.preventDefault();const o=this._getAllRadios().filter(h=>!h.disabled),s=o.find(h=>h.checked)||o[0],r=e.key===" "||e.key==="Enter"?0:["ArrowUp","ArrowLeft"].includes(e.key)?-1:1;let n=o.indexOf(s)+r;n<0&&(n=o.length-1),n>=o.length&&(n=0);const c=o[n];(await c.getInputElement())?.click(),this._updateGroupTabIndex(),c.focus()}_updateGroupTabIndex(){const e=this._getAllRadios(),t=e.find(o=>o.checked)||e[0];e.forEach(o=>{o.disabled?o.tabIndex=-1:o.tabIndex=o===t?0:-1,o.setAttribute("aria-checked",o.checked?"true":"false"),o.setAttribute("aria-disabled",o.disabled?"true":"false"),o.setAttribute("aria-required",this.required?"true":"false")})}_initializeChildAttributes(){this._getAllRadios().forEach(t=>{t.setAttribute("role","radio"),t.setAttribute("aria-checked",String(t.checked)),t.setAttribute("aria-required",String(t.required)),t.setAttribute("aria-disabled",String(t.disabled)),t.setAttribute("tabindex","-1")})}_updateRadioButtonsSize(){this.querySelectorAll("nys-radiobutton").forEach(t=>{t.setAttribute("size",this.size)})}_updateRadioButtonsTile(){this.querySelectorAll("nys-radiobutton").forEach(t=>{this.tile?t.toggleAttribute("tile",!0):t.removeAttribute("tile")})}_updateRadioButtonsInvert(){this.querySelectorAll("nys-radiobutton").forEach(t=>{this.inverted?t.toggleAttribute("inverted",!0):t.removeAttribute("inverted")})}_updateRadioButtonsShowError(){this.querySelectorAll("nys-radiobutton").forEach(t=>{this.showError?t.setAttribute("showError",""):t.removeAttribute("showError")})}_updateRadioButtonsForm(){this.querySelectorAll("nys-radiobutton").forEach(t=>{this.showError&&this.form!==null?t.setAttribute("form",this.form):t.removeAttribute("form")})}_getSlotDescriptionForAria(){const t=this.shadowRoot?.querySelector('slot[name="description"]')?.assignedNodes({flatten:!0})||[];this._slottedDescriptionText=t.map(o=>o.textContent?.trim()).filter(Boolean).join(", ")}_handleRadioButtonChange(e){const t=e,{name:o,value:s}=t.detail;this.name=o,this.selectedValue=s,this._internals.setFormValue(this.selectedValue),this._updateGroupTabIndex()}async _handleInvalid(e){if(e.preventDefault(),this._internals.validity.valueMissing){this.showError=!0,this._manageRequire();const t=this.querySelector("nys-radiobutton");if(t){const o=this._internals.form;o?Array.from(o.elements).find(n=>typeof n.checkValidity=="function"&&!n.checkValidity())===this&&(t.focus(),t.classList.add("active-focus")):(t.focus(),t.classList.add("active-focus"))}}}render(){return l`<div class="nys-radiogroup">
3923
+ `;var Is=Object.defineProperty,Ps=Object.getOwnPropertyDescriptor,H=(a,e,t,o)=>{for(var s=o>1?void 0:o?Ps(e,t):e,r=a.length-1,n;r>=0;r--)(n=a[r])&&(s=(o?n(e,t,s):n(s))||s);return o&&s&&Is(e,t,s),s};let Os=0;const D=(de=class extends p{constructor(){super(),this.id="",this.name="",this.required=!1,this.optional=!1,this.showError=!1,this.errorMessage="",this.label="",this.description="",this.tile=!1,this._tooltip="",this.inverted=!1,this.form=null,this.selectedValue=null,this._slottedDescriptionText="",this._size="md",this._internals=this.attachInternals()}get size(){return this._size}set size(e){this._size=de.VALID_SIZES.includes(e)?e:"md"}connectedCallback(){super.connectedCallback(),this.id||(this.id=`nys-radiogroup-${Date.now()}-${Os++}`),this.addEventListener("nys-change",this._handleRadioButtonChange),this.addEventListener("invalid",this._handleInvalid)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("nys-change",this._handleRadioButtonChange),this.removeEventListener("invalid",this._handleInvalid)}async firstUpdated(){await this.updateComplete,this._initializeCheckedRadioValue(),this._setValue(),this._setRadioButtonRequire(),this._updateRadioButtonsSize(),this._updateRadioButtonsTile(),this._updateRadioButtonsShowError(),this._getSlotDescriptionForAria(),this._initializeChildAttributes(),this._updateGroupTabIndex()}updated(e){(e.has("required")||e.has("selectedValue"))&&this._manageRequire(),e.has("size")&&this._updateRadioButtonsSize(),e.has("tile")&&this._updateRadioButtonsTile(),e.has("inverted")&&this._updateRadioButtonsInvert(),e.has("showError")&&this._updateRadioButtonsShowError(),e.has("form")&&this._updateRadioButtonsForm()}formResetCallback(){this.querySelectorAll("nys-radiobutton").forEach(t=>{t.formResetUpdate()})}_setValue(){this._internals.setFormValue(this.selectedValue)}_setRadioButtonRequire(){this.querySelectorAll("nys-radiobutton").forEach((t,o)=>{this.required&&o===0&&t.setAttribute("required","required")})}async _manageRequire(){const e=this.errorMessage||"Please select an option.",o=Array.from(this.querySelectorAll("nys-radiobutton"))[0];o&&(this.required&&!this.selectedValue?this._internals.setValidity({valueMissing:!0},e,o):(this.showError=!1,this._internals.setValidity({},"",o)))}checkValidity(){const e=Array.from(this.querySelectorAll("nys-radiobutton"));return!this.required||e.some(o=>o.checked)}_initializeCheckedRadioValue(){const e=this.querySelector("nys-radiobutton[checked]");e&&(this.selectedValue=e.getAttribute("value"),this._internals.setFormValue(this.selectedValue))}_getAllRadios(){return Array.from(this.querySelectorAll("nys-radiobutton"))}async _handleKeyDown(e){if(!["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"," ","Enter"].includes(e.key))return;e.preventDefault();const o=this._getAllRadios().filter(h=>!h.disabled),s=o.find(h=>h.checked)||o[0],r=e.key===" "||e.key==="Enter"?0:["ArrowUp","ArrowLeft"].includes(e.key)?-1:1;let n=o.indexOf(s)+r;n<0&&(n=o.length-1),n>=o.length&&(n=0);const c=o[n];(await c.getInputElement())?.click(),this._updateGroupTabIndex(),c.focus()}_updateGroupTabIndex(){const e=this._getAllRadios(),t=e.find(o=>o.checked)||e[0];e.forEach(o=>{o.disabled?o.tabIndex=-1:o.tabIndex=o===t?0:-1,o.setAttribute("aria-checked",o.checked?"true":"false"),o.setAttribute("aria-disabled",o.disabled?"true":"false"),o.setAttribute("aria-required",this.required?"true":"false")})}_initializeChildAttributes(){this._getAllRadios().forEach(t=>{t.setAttribute("role","radio"),t.setAttribute("aria-checked",String(t.checked)),t.setAttribute("aria-required",String(t.required)),t.setAttribute("aria-disabled",String(t.disabled)),t.setAttribute("tabindex","-1")})}_updateRadioButtonsSize(){this.querySelectorAll("nys-radiobutton").forEach(t=>{t.setAttribute("size",this.size)})}_updateRadioButtonsTile(){this.querySelectorAll("nys-radiobutton").forEach(t=>{this.tile?t.toggleAttribute("tile",!0):t.removeAttribute("tile")})}_updateRadioButtonsInvert(){this.querySelectorAll("nys-radiobutton").forEach(t=>{this.inverted?t.toggleAttribute("inverted",!0):t.removeAttribute("inverted")})}_updateRadioButtonsShowError(){this.querySelectorAll("nys-radiobutton").forEach(t=>{this.showError?t.setAttribute("showError",""):t.removeAttribute("showError")})}_updateRadioButtonsForm(){this.querySelectorAll("nys-radiobutton").forEach(t=>{this.showError&&this.form!==null?t.setAttribute("form",this.form):t.removeAttribute("form")})}_getSlotDescriptionForAria(){const t=this.shadowRoot?.querySelector('slot[name="description"]')?.assignedNodes({flatten:!0})||[];this._slottedDescriptionText=t.map(o=>o.textContent?.trim()).filter(Boolean).join(", ")}_handleRadioButtonChange(e){const t=e,{name:o,value:s}=t.detail;this.name=o,this.selectedValue=s,this._internals.setFormValue(this.selectedValue),this._updateGroupTabIndex()}async _handleInvalid(e){if(e.preventDefault(),this._internals.validity.valueMissing){this.showError=!0,this._manageRequire();const t=this.querySelector("nys-radiobutton");if(t){const o=this._internals.form;o?Array.from(o.elements).find(n=>typeof n.checkValidity=="function"&&!n.checkValidity())===this&&(t.focus(),t.classList.add("active-focus")):(t.focus(),t.classList.add("active-focus"))}}}render(){return l`<div class="nys-radiogroup">
3912
3924
  <nys-label
3913
3925
  for=${this.id}
3914
3926
  label=${this.label}
@@ -4143,7 +4155,7 @@
4143
4155
  @blur="${this._handleBlur}"
4144
4156
  @change="${this._handleChange}"
4145
4157
  >
4146
- <option hidden disabled selected value=""></option>
4158
+ <option data-native hidden disabled selected value=""></option>
4147
4159
  </select>
4148
4160
  <slot
4149
4161
  @slotchange="${this._handleSlotChange}"
@@ -4397,7 +4409,11 @@
4397
4409
  rgba(255, 255, 255, 0.9)
4398
4410
  );
4399
4411
  width: var(--nys-size-300, 24px);
4412
+ min-width: var(--nys-size-300, 24px);
4413
+ max-width: var(--nys-size-300, 24px);
4400
4414
  height: var(--nys-size-300, 24px);
4415
+ min-height: var(--nys-size-300, 24px);
4416
+ max-height: var(--nys-size-300, 24px);
4401
4417
  display: flex;
4402
4418
  align-items: center;
4403
4419
  justify-content: center;
@@ -4513,7 +4529,11 @@
4513
4529
  border: none;
4514
4530
  background-color: var(--nys-color-neutral-200, #bec0c1);
4515
4531
  height: var(--nys-size-100, 8px);
4532
+ min-height: var(--nys-size-100, 8px);
4533
+ max-height: var(--nys-size-100, 8px);
4516
4534
  width: 100%;
4535
+ min-width: 100%;
4536
+ max-width: 100%;
4517
4537
  color: transparent;
4518
4538
  }
4519
4539
 
@@ -4572,7 +4592,11 @@
4572
4592
  rgba(255, 255, 255, 0.9)
4573
4593
  );
4574
4594
  width: var(--nys-space-300, 24px);
4595
+ min-width: var(--nys-space-300, 24px);
4596
+ max-width: var(--nys-space-300, 24px);
4575
4597
  height: var(--nys-space-300, 24px);
4598
+ min-height: var(--nys-space-300, 24px);
4599
+ max-height: var(--nys-space-300, 24px);
4576
4600
  color: var(--nys-color-text, #1b1b1b);
4577
4601
  }
4578
4602
 
@@ -4623,7 +4647,7 @@
4623
4647
  </div>
4624
4648
  </div>
4625
4649
  </div>
4626
- `}};St.styles=l1;let G=St;Ae([i({type:Boolean,reflect:!0})],G.prototype,"selected"),Ae([i({type:Boolean,reflect:!0})],G.prototype,"current"),Ae([i({type:String})],G.prototype,"label"),Ae([i({type:String})],G.prototype,"href"),Ae([i({type:Boolean})],G.prototype,"isCompactExpanded"),Ae([i({attribute:!1})],G.prototype,"onClick"),Ae([i({type:Number})],G.prototype,"stepNumber"),customElements.get("nys-step")||customElements.define("nys-step",G);var Ks=Object.defineProperty,Ye=(a,e,t,o)=>{for(var s=void 0,r=a.length-1,n;r>=0;r--)(n=a[r])&&(s=n(e,t,s)||s);return s&&Ks(e,t,s),s};const Lt=class Lt extends p{constructor(){super(),this.id="",this.name="",this.label="",this.counterText="initial",this.isCompactExpanded=!1,this._stepsNumbered=!1,this._onStepClick=async e=>{const t=e.composedPath().find(n=>n instanceof HTMLElement&&n.tagName.toLowerCase()==="nys-step");if(!t)return;const o=Array.from(this.querySelectorAll("nys-step")),s=o.findIndex(n=>n.hasAttribute("current")),r=o.indexOf(t);s!==-1&&r>s||t.hasAttribute("selected")||(o.forEach(n=>n.removeAttribute("selected")),t.setAttribute("selected",""),this._updateCounter(),this.isCompactExpanded=!1)}}connectedCallback(){super.connectedCallback(),this.addEventListener("nys-step-click",this._onStepClick),requestAnimationFrame(()=>this._validateSteps())}disconnectedCallback(){this.removeEventListener("nys-step-click",this._onStepClick),super.disconnectedCallback()}_validateSteps(){Array.from(this.children).forEach(e=>{const t=e instanceof HTMLElement&&e.tagName.toLowerCase()==="nys-step",o=e instanceof HTMLElement&&e.hasAttribute("slot")&&e.getAttribute("slot")==="actions";!t&&!o&&(console.warn("Only <nys-step> elements or the <div slot='actions'> container are allowed as direct children of <nys-stepper>. Removing:",e),e.remove())})}_validateButtonSlot(e){const o=e.target.assignedElements();if(o.length!==1||o[0].tagName.toLowerCase()!=="div"){console.warn("The 'actions' slot must have exactly one <div> as a direct child.");return}const s=o[0];Array.from(s.children).forEach(r=>{r instanceof HTMLElement&&r.tagName.toLowerCase()==="nys-button"?(r.setAttribute("size","sm"),r.hasAttribute("fullWidth")&&(r.style.flex="1 1 0")):(console.warn("The <div> inside 'actions' slot only accepts <nys-button> elements. Removing invalid node:",r),r.remove())})}_updateCounter(){if(this.isCompactExpanded){this.counterText="Back to Form",this.style.height="-webkit-fit-content",this.style.height="-moz-fit-content",this.style.height="fit-content";return}else this.style.height="auto";const e=this.querySelectorAll("nys-step"),t=Array.from(e).findIndex(s=>s.hasAttribute("selected")),o=e.length;this.counterText=t>=0?`Step ${t+1} of ${o}`:`Step 1 of ${o}`}updated(){const e=this.querySelectorAll("nys-step");this._stepsNumbered||(e.forEach((r,n)=>{r.stepNumber=n+1}),this._stepsNumbered=!0);let t=!1,o=!1,s=!1;e.forEach((r,n)=>{r.hasAttribute("current")&&(s?r.removeAttribute("current"):s=!0),n===0?r.setAttribute("first",""):r.removeAttribute("first"),r.hasAttribute("current")?(t=!0,r.removeAttribute("previous")):t?r.removeAttribute("previous"):r.setAttribute("previous",""),r.hasAttribute("selected")&&(t||o?r.removeAttribute("selected"):o=!0),this.hasAttribute("isCompactExpanded")?r.setAttribute("isCompactExpanded",""):r.removeAttribute("isCompactExpanded")}),o||(s?e.forEach(r=>{r.hasAttribute("current")&&!o&&(r.setAttribute("selected",""),o=!0)}):e.length>0&&(e[0].setAttribute("current",""),e[0].setAttribute("selected",""))),this._updateCounter()}_toggleCompact(){this.isCompactExpanded=!this.isCompactExpanded}_handleCounterKeydown(e){(e.key===" "||e.key==="Enter")&&(e.preventDefault(),this._toggleCompact())}render(){return l`
4650
+ `}};St.styles=l1;let G=St;Ae([i({type:Boolean,reflect:!0})],G.prototype,"selected"),Ae([i({type:Boolean,reflect:!0})],G.prototype,"current"),Ae([i({type:String})],G.prototype,"label"),Ae([i({type:String})],G.prototype,"href"),Ae([i({type:Boolean})],G.prototype,"isCompactExpanded"),Ae([i({attribute:!1})],G.prototype,"onClick"),Ae([i({type:Number})],G.prototype,"stepNumber"),customElements.get("nys-step")||customElements.define("nys-step",G);var Ks=Object.defineProperty,Ye=(a,e,t,o)=>{for(var s=void 0,r=a.length-1,n;r>=0;r--)(n=a[r])&&(s=n(e,t,s)||s);return s&&Ks(e,t,s),s};const Lt=class Lt extends p{constructor(){super(),this.id="",this.name="",this.label="",this.counterText="initial",this.isCompactExpanded=!1,this._stepsNumbered=!1,this._onStepClick=async e=>{const t=e.composedPath().find(n=>n instanceof HTMLElement&&n.tagName.toLowerCase()==="nys-step");if(!t)return;const o=Array.from(this.querySelectorAll("nys-step")),s=o.findIndex(n=>n.hasAttribute("current")),r=o.indexOf(t);s!==-1&&r>s||t.hasAttribute("selected")||(o.forEach(n=>n.removeAttribute("selected")),t.setAttribute("selected",""),this._updateCounter(),this.isCompactExpanded=!1)}}connectedCallback(){super.connectedCallback(),this.addEventListener("nys-step-click",this._onStepClick),requestAnimationFrame(()=>this._validateSteps())}disconnectedCallback(){this.removeEventListener("nys-step-click",this._onStepClick),super.disconnectedCallback()}_validateSteps(){Array.from(this.children).forEach(e=>{const t=e instanceof HTMLElement&&e.tagName.toLowerCase()==="nys-step",o=e instanceof HTMLElement&&e.hasAttribute("slot")&&e.getAttribute("slot")==="actions";!t&&!o&&(console.warn("Only <nys-step> elements or the <div slot='actions'> container are allowed as direct children of <nys-stepper>. Removing:",e),e.remove())})}_validateButtonSlot(e){const o=e.target.assignedElements();if(o.length!==1||o[0].tagName.toLowerCase()!=="div"){console.warn("The 'actions' slot must have exactly one <div> as a direct child.");return}const s=o[0];Array.from(s.children).forEach(r=>{r instanceof HTMLElement&&r.tagName.toLowerCase()==="nys-button"?(r.setAttribute("size","sm"),r.hasAttribute("fullWidth")&&(r.style.flex="1 1 0")):(console.warn("The <div> inside 'actions' slot only accepts <nys-button> elements. Removing invalid node:",r),r.remove())})}_updateCounter(){let e;if(this.isCompactExpanded)e="Back to Form",this.style.height="-webkit-fit-content",this.style.height="-moz-fit-content",this.style.height="fit-content";else{this.style.height="auto";const t=this.querySelectorAll("nys-step"),o=Array.from(t).findIndex(r=>r.hasAttribute("selected")),s=t.length;e=o>=0?`Step ${o+1} of ${s}`:`Step 1 of ${s}`}e!==this.counterText&&(this.counterText=e)}willUpdate(){const e=this.querySelectorAll("nys-step");this._stepsNumbered||(e.forEach((r,n)=>{r.stepNumber=n+1}),this._stepsNumbered=!0);let t=!1,o=!1,s=!1;e.forEach((r,n)=>{r.hasAttribute("current")&&(s?r.removeAttribute("current"):s=!0),n===0?r.setAttribute("first",""):r.removeAttribute("first"),r.hasAttribute("current")?(t=!0,r.removeAttribute("previous")):t?r.removeAttribute("previous"):r.setAttribute("previous",""),r.hasAttribute("selected")&&(t||o?r.removeAttribute("selected"):o=!0),this.isCompactExpanded?r.setAttribute("isCompactExpanded",""):r.removeAttribute("isCompactExpanded")}),o||(s?e.forEach(r=>{r.hasAttribute("current")&&!o&&(r.setAttribute("selected",""),o=!0)}):e.length>0&&(e[0].setAttribute("current",""),e[0].setAttribute("selected",""))),this._updateCounter()}_toggleCompact(){this.isCompactExpanded=!this.isCompactExpanded}_handleCounterKeydown(e){(e.key===" "||e.key==="Enter")&&(e.preventDefault(),this._toggleCompact())}render(){return l`
4627
4651
  <div class="nys-stepper" id=${this.id} name=${this.name}>
4628
4652
  <div class="nys-stepper__header">
4629
4653
  <slot name="actions" @slotchange=${this._validateButtonSlot}></slot>
@@ -4799,6 +4823,7 @@
4799
4823
  class="nys-textarea__textarea ${this.resize}"
4800
4824
  name=${this.name}
4801
4825
  id=${this.id}
4826
+ .value=${this.value}
4802
4827
  ?disabled=${this.disabled}
4803
4828
  ?required=${this.required}
4804
4829
  ?readonly=${this.readonly}
@@ -4815,9 +4840,7 @@
4815
4840
  @blur="${this._handleBlur}"
4816
4841
  @select="${this._handleSelect}"
4817
4842
  @selectionchange="${this._handleSelectionChange}"
4818
- >
4819
- ${this.value}</textarea
4820
- >
4843
+ ></textarea>
4821
4844
  <nys-errormessage
4822
4845
  ?showError=${this.showError}
4823
4846
  errorMessage=${this._internals.validationMessage||this.errorMessage}