@nysds/components 1.9.0 → 1.9.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/dist/nysds.es.js +2 -2
- package/dist/nysds.es.js.map +1 -1
- package/dist/nysds.js +2 -2
- package/dist/nysds.js.map +1 -1
- package/package.json +1 -1
package/dist/nysds.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
(function(p,de){typeof exports=="object"&&typeof module<"u"?de(exports):typeof define=="function"&&define.amd?define(["exports"],de):(p=typeof globalThis<"u"?globalThis:p||self,de(p.NYSDS={}))})(this,function(p){"use strict";/*!
|
|
2
|
-
* New York State Design System (v1.9.
|
|
2
|
+
* New York State Design System (v1.9.1)
|
|
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
|
|
@@ -3717,7 +3717,7 @@
|
|
|
3717
3717
|
>
|
|
3718
3718
|
<slot>${this.label}</slot>
|
|
3719
3719
|
</option>
|
|
3720
|
-
`}}Fe([i({type:Boolean,reflect:!0})],ve.prototype,"disabled"),Fe([i({type:Boolean,reflect:!0})],ve.prototype,"selected"),Fe([i({type:String})],ve.prototype,"value"),Fe([i({type:String})],ve.prototype,"label"),Fe([i({type:Boolean,reflect:!0})],ve.prototype,"hidden"),customElements.define("nys-option",ve);var H2=Object.defineProperty,I2=Object.getOwnPropertyDescriptor,q=(a,e,t,o)=>{for(var s=o>1?void 0:o?I2(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&&H2(e,t,s),s};let B2=0;const B=(le=class extends v{constructor(){super(),this.id="",this.name="",this.label="",this.description="",this.value="",this.disabled=!1,this.required=!1,this.optional=!1,this._tooltip="",this.form=null,this.showError=!1,this.errorMessage="",this._width="md",this._hasUserInteracted=!1,this._internals=this.attachInternals()}get width(){return this._width}set width(e){this._width=le.VALID_WIDTHS.includes(e)?e:"full"}connectedCallback(){super.connectedCallback(),this.id||(this.id=`nys-select-${Date.now()}-${B2++}`),this.addEventListener("invalid",this._handleInvalid)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("invalid",this._handleInvalid)}firstUpdated(){this._setValue()}formResetCallback(){this.value=""}_handleSlotChange(){var s,r;const e=(s=this.shadowRoot)==null?void 0:s.querySelector('slot:not([name="description"])'),t=(r=this.shadowRoot)==null?void 0:r.querySelector("select");if(!e||!t)return;t.querySelectorAll("option:not([hidden])").forEach(n=>n.remove()),e.assignedElements({flatten:!0}).forEach(n=>{var c;if(n instanceof ve){const d=document.createElement("option");d.value=n.value,d.textContent=n.label||((c=n.textContent)==null?void 0:c.trim())||"",d.disabled=n.disabled,d.selected=n.selected,t.appendChild(d)}})}_setValue(){this._internals.setFormValue(this.value),this._manageRequire()}_manageRequire(){var s;const e=(s=this.shadowRoot)==null?void 0:s.querySelector("select");if(!e)return;const t=this.errorMessage||"Please select an option.";this.required&&!this.value?(this._internals.ariaRequired="true",this._internals.setValidity({valueMissing:!0},t,e)):(this._internals.ariaRequired="false",this._internals.setValidity({}),this._hasUserInteracted=!1)}_setValidityMessage(e=""){var o,s;const t=(o=this.shadowRoot)==null?void 0:o.querySelector("select");t&&(this.showError=!!e,(s=this.errorMessage)!=null&&s.trim()&&e!==""&&(e=this.errorMessage),this._internals.setValidity(e?{customError:!0}:{},e,t))}_validate(){var o;const e=(o=this.shadowRoot)==null?void 0:o.querySelector("select");if(!e)return;let t=e.validationMessage;this._manageRequire(),this._setValidityMessage(t)}checkValidity(){var t;const e=(t=this.shadowRoot)==null?void 0:t.querySelector("select");return e?e.checkValidity():!0}_handleInvalid(e){var o;e.preventDefault(),this._hasUserInteracted=!0,this._validate(),this.showError=!0;const t=(o=this.shadowRoot)==null?void 0:o.querySelector("select");if(t){const s=this._internals.form;s?Array.from(s.elements).find(c=>typeof c.checkValidity=="function"&&!c.checkValidity())===this&&t.focus():t.focus()}}_handleChange(e){const t=e.target;this.value=t.value,this._internals.setFormValue(this.value),this._hasUserInteracted&&this._validate(),this.dispatchEvent(new CustomEvent("change",{detail:{id:this.id,value:this.value},bubbles:!0,composed:!0}))}_handleFocus(){this.dispatchEvent(new Event("nys-focus"))}_handleBlur(){this._hasUserInteracted||(this._hasUserInteracted=!0),this._validate(),this.dispatchEvent(new Event("nys-blur"))}updated(e){var t;if(super.updated(e),e.has("value")){const o=(t=this.shadowRoot)==null?void 0:t.querySelector("select");o&&(o.value=this.value)}}render(){return l`
|
|
3720
|
+
`}}Fe([i({type:Boolean,reflect:!0})],ve.prototype,"disabled"),Fe([i({type:Boolean,reflect:!0})],ve.prototype,"selected"),Fe([i({type:String})],ve.prototype,"value"),Fe([i({type:String})],ve.prototype,"label"),Fe([i({type:Boolean,reflect:!0})],ve.prototype,"hidden"),customElements.define("nys-option",ve);var H2=Object.defineProperty,I2=Object.getOwnPropertyDescriptor,q=(a,e,t,o)=>{for(var s=o>1?void 0:o?I2(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&&H2(e,t,s),s};let B2=0;const B=(le=class extends v{constructor(){super(),this.id="",this.name="",this.label="",this.description="",this.value="",this.disabled=!1,this.required=!1,this.optional=!1,this._tooltip="",this.form=null,this.showError=!1,this.errorMessage="",this._width="md",this._hasUserInteracted=!1,this._internals=this.attachInternals()}get width(){return this._width}set width(e){this._width=le.VALID_WIDTHS.includes(e)?e:"full"}connectedCallback(){super.connectedCallback(),this.id||(this.id=`nys-select-${Date.now()}-${B2++}`),this.addEventListener("invalid",this._handleInvalid)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("invalid",this._handleInvalid)}firstUpdated(){this._setValue()}formResetCallback(){this.value=""}_handleSlotChange(){var s,r;const e=(s=this.shadowRoot)==null?void 0:s.querySelector('slot:not([name="description"])'),t=(r=this.shadowRoot)==null?void 0:r.querySelector("select");if(!e||!t)return;t.querySelectorAll("option:not([hidden])").forEach(n=>n.remove()),e.assignedElements({flatten:!0}).forEach(n=>{var c;if(n instanceof ve){const d=document.createElement("option");d.value=n.value,d.textContent=n.label||((c=n.textContent)==null?void 0:c.trim())||"",d.disabled=n.disabled,d.selected=n.selected,t.appendChild(d)}})}_setValue(){this._internals.setFormValue(this.value),this._manageRequire()}_manageRequire(){var s;const e=(s=this.shadowRoot)==null?void 0:s.querySelector("select");if(!e)return;const t=this.errorMessage||"Please select an option.";this.required&&!this.value?(this._internals.ariaRequired="true",this._internals.setValidity({valueMissing:!0},t,e)):(this._internals.ariaRequired="false",this._internals.setValidity({}),this._hasUserInteracted=!1)}_setValidityMessage(e=""){var o,s;const t=(o=this.shadowRoot)==null?void 0:o.querySelector("select");t&&(this.showError=!!e,(s=this.errorMessage)!=null&&s.trim()&&e!==""&&(e=this.errorMessage),this._internals.setValidity(e?{customError:!0}:{},e,t))}_validate(){var o;const e=(o=this.shadowRoot)==null?void 0:o.querySelector("select");if(!e)return;let t=e.validationMessage;this._manageRequire(),this._setValidityMessage(t)}checkValidity(){var t;const e=(t=this.shadowRoot)==null?void 0:t.querySelector("select");return e?e.checkValidity():!0}_handleInvalid(e){var o;e.preventDefault(),this._hasUserInteracted=!0,this._validate(),this.showError=!0;const t=(o=this.shadowRoot)==null?void 0:o.querySelector("select");if(t){const s=this._internals.form;s?Array.from(s.elements).find(c=>typeof c.checkValidity=="function"&&!c.checkValidity())===this&&t.focus():t.focus()}}_handleChange(e){const t=e.target;this.value=t.value,this._internals.setFormValue(this.value),this._hasUserInteracted&&this._validate(),this.dispatchEvent(new CustomEvent("nys-change",{detail:{id:this.id,value:this.value},bubbles:!0,composed:!0}))}_handleFocus(){this.dispatchEvent(new Event("nys-focus"))}_handleBlur(){this._hasUserInteracted||(this._hasUserInteracted=!0),this._validate(),this.dispatchEvent(new Event("nys-blur"))}updated(e){var t;if(super.updated(e),e.has("value")){const o=(t=this.shadowRoot)==null?void 0:t.querySelector("select");o&&(o.value=this.value)}}render(){return l`
|
|
3721
3721
|
<div class="nys-select">
|
|
3722
3722
|
<nys-label
|
|
3723
3723
|
for=${this.id}
|