@govtechsg/sgds-web-component 3.23.0-rc.5 → 3.23.0-rc.7

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.
Files changed (38) hide show
  1. package/components/Checkbox/index.umd.min.js +2 -2
  2. package/components/Checkbox/index.umd.min.js.map +1 -1
  3. package/components/Checkbox/sgds-checkbox-group.d.ts +2 -1
  4. package/components/Checkbox/sgds-checkbox-group.js +4 -9
  5. package/components/Checkbox/sgds-checkbox-group.js.map +1 -1
  6. package/components/Checkbox/types.d.ts +3 -0
  7. package/components/ComboBox/index.umd.min.js +1 -1
  8. package/components/ComboBox/index.umd.min.js.map +1 -1
  9. package/components/ComboBox/sgds-combo-box.d.ts +2 -0
  10. package/components/ComboBox/sgds-combo-box.js +14 -5
  11. package/components/ComboBox/sgds-combo-box.js.map +1 -1
  12. package/components/Radio/index.umd.min.js +1 -1
  13. package/components/Radio/index.umd.min.js.map +1 -1
  14. package/components/Radio/sgds-radio-group.js +2 -1
  15. package/components/Radio/sgds-radio-group.js.map +1 -1
  16. package/components/index.umd.min.js +4 -4
  17. package/components/index.umd.min.js.map +1 -1
  18. package/css/reboot.css +12 -6
  19. package/css/utility.css +8 -0
  20. package/custom-elements.json +17 -13
  21. package/index.umd.min.js +4 -4
  22. package/index.umd.min.js.map +1 -1
  23. package/package.json +1 -1
  24. package/react/components/Checkbox/sgds-checkbox-group.cjs.js +4 -9
  25. package/react/components/Checkbox/sgds-checkbox-group.cjs.js.map +1 -1
  26. package/react/components/Checkbox/sgds-checkbox-group.js +4 -9
  27. package/react/components/Checkbox/sgds-checkbox-group.js.map +1 -1
  28. package/react/components/ComboBox/sgds-combo-box.cjs.js +14 -5
  29. package/react/components/ComboBox/sgds-combo-box.cjs.js.map +1 -1
  30. package/react/components/ComboBox/sgds-combo-box.js +14 -5
  31. package/react/components/ComboBox/sgds-combo-box.js.map +1 -1
  32. package/react/components/Radio/sgds-radio-group.cjs.js +2 -1
  33. package/react/components/Radio/sgds-radio-group.cjs.js.map +1 -1
  34. package/react/components/Radio/sgds-radio-group.js +2 -1
  35. package/react/components/Radio/sgds-radio-group.js.map +1 -1
  36. package/themes/responsive.css +15 -0
  37. package/themes/root.css +5 -0
  38. package/types/react.d.ts +6 -0
@@ -2325,7 +2325,7 @@ class extends Pe{constructor(e){if(super(e),e.type!==Se&&e.type!==$e&&e.type!==A
2325
2325
  </div>
2326
2326
  </div>
2327
2327
  `:le}
2328
- `;var l}}wt.styles=[...nt.styles,gt,ut],wt.dependencies={"sgds-icon":it},e([ye({type:String,reflect:!0})],wt.prototype,"value",void 0),e([ye({type:Boolean,reflect:!0})],wt.prototype,"checked",void 0),e([ye({type:String,reflect:!0})],wt.prototype,"hasFeedback",void 0),e([ht("checked")],wt.prototype,"defaultChecked",void 0),e([ye({type:Boolean,reflect:!0})],wt.prototype,"indeterminate",void 0),e([ye({type:Boolean,reflect:!0})],wt.prototype,"required",void 0),e([ye({type:Boolean,reflect:!0})],wt.prototype,"noValidate",void 0),e([ye({type:String,reflect:!0})],wt.prototype,"invalidFeedback",void 0),e([He()],wt.prototype,"_isTouched",void 0),e([pt("disabled",{waitUntilFirstUpdate:!0})],wt.prototype,"_handleDisabledChange",null),e([pt("_isTouched",{waitUntilFirstUpdate:!0})],wt.prototype,"_handleIsTouched",null);var ft,mt=o`:host{--sgds-checkbox-group-gap:var(--sgds-spacer-2)}fieldset{border:0;gap:var(--sgds-form-gap-md);margin:0;min-width:0;padding:0}.label-hint-container,fieldset{display:flex;flex-direction:column}.label-hint-container{gap:var(--sgds-form-gap-sm)}.label-hint-container .form-label{color:var(--sgds-form-color-default);font-size:var(--sgds-font-size-label-md);font-weight:var(--sgds-font-weight-semibold)}.checkbox-container{display:flex;flex-direction:column;gap:var(--sgds-form-gap-md);padding:var(--sgds-form-padding-inline-sm) 0}.checkbox-group-validation-input{display:none}:host([disabled]) .label-hint-container{cursor:not-allowed;opacity:var(--sgds-opacity-40)}`;class Zt extends(vt(nt)){constructor(){super(...arguments),this.label="",this.invalidFeedback="Please tick at least one box if you want to proceed",this.hasFeedback=!1,this.hintText="",this.required=!1,this.noValidate=!1,this.value="",this._isTouched=!1,this.defaultValue="",this._blurredCheckboxes=new Set}connectedCallback(){super.connectedCallback(),this.addEventListener("sgds-check",e=>{const{value:t}=e.detail;!this.value.includes(t)&&this._addValue(t)}),this.addEventListener("sgds-uncheck",e=>{const{value:t}=e.detail;this._removeValue(t)}),this.addEventListener("sgds-blur",e=>{const t=e.target;this._blurredCheckboxes.add(t),Array.from(this._blurredCheckboxes).length===this._checkboxes.length&&(this._isTouched=!0,this._blurredCheckboxes.clear())})}firstUpdated(e){super.firstUpdated(e),this.value&&this._updateInputValue(),this.invalid&&this._updateInvalid()}_renderHintText(){const e=Q` <div class="form-text" id="${this._controlId}Help">${this.hintText}</div> `;return this.hintText&&e}_addValue(e){const t=this.value?this.value.split(";"):[];t.push(e),this.value=t.join(";")}_removeValue(e){const t=(this.value?this.value.split(";"):[]).filter(t=>t!==e);this.value=t.join(";")}_sanitizeSlot(){this._checkboxes.forEach(e=>{e.checked=e.defaultChecked=this.value.includes(e.value),e.hasFeedback=this.hasFeedback?"style":null,e.required&&(console.error("Checkboxes in a group cannot have required or hasFeedback prop set to true"),e.remove())}),this._disabledChildCheckboxes()}_disabledChildCheckboxes(){if(this.disabled){this._checkboxes.forEach(e=>e.disabled=this.disabled)}}_handleValueChange(){if("reset"===this.formEvent&&this.value===this.defaultValue)return void(this.formEvent=null);this.emit("sgds-change");this._checkboxes.forEach(e=>{e.checked=this.value.includes(e.value)}),this._updateInputValue(),this._updateInvalid()}_handleIsTouched(){this._mixinShouldSkipSgdsValidation()||this._isTouched&&(this.invalid=!this.input.checkValidity(),this._updateInvalid())}_updateInvalid(){this._checkboxes.forEach(e=>e.invalid=this.invalid)}reportValidity(){return this._mixinReportValidity()}checkValidity(){return this._mixinCheckValidity()}get validity(){return this._mixinGetValidity()}get validationMessage(){return this._mixinGetValidationMessage()}_mixinResetFormControl(){this.value=this.input.value=this.defaultValue,this._updateInputValue("reset"),this._mixinResetValidity(this.input)}async _updateInputValue(e="change"){this.input.value=this.value,this.input.dispatchEvent(new InputEvent(e)),this.formEvent=e}render(){return Q`
2328
+ `;var l}}wt.styles=[...nt.styles,gt,ut],wt.dependencies={"sgds-icon":it},e([ye({type:String,reflect:!0})],wt.prototype,"value",void 0),e([ye({type:Boolean,reflect:!0})],wt.prototype,"checked",void 0),e([ye({type:String,reflect:!0})],wt.prototype,"hasFeedback",void 0),e([ht("checked")],wt.prototype,"defaultChecked",void 0),e([ye({type:Boolean,reflect:!0})],wt.prototype,"indeterminate",void 0),e([ye({type:Boolean,reflect:!0})],wt.prototype,"required",void 0),e([ye({type:Boolean,reflect:!0})],wt.prototype,"noValidate",void 0),e([ye({type:String,reflect:!0})],wt.prototype,"invalidFeedback",void 0),e([He()],wt.prototype,"_isTouched",void 0),e([pt("disabled",{waitUntilFirstUpdate:!0})],wt.prototype,"_handleDisabledChange",null),e([pt("_isTouched",{waitUntilFirstUpdate:!0})],wt.prototype,"_handleIsTouched",null);var ft,mt=o`:host{--sgds-checkbox-group-gap:var(--sgds-spacer-2)}fieldset{border:0;gap:var(--sgds-form-gap-md);margin:0;min-width:0;padding:0}.label-hint-container,fieldset{display:flex;flex-direction:column}.label-hint-container{gap:var(--sgds-form-gap-sm)}.label-hint-container .form-label{color:var(--sgds-form-color-default);font-size:var(--sgds-font-size-label-md);font-weight:var(--sgds-font-weight-semibold)}.checkbox-container{display:flex;flex-direction:column;gap:var(--sgds-form-gap-md);padding:var(--sgds-form-padding-inline-sm) 0}.checkbox-group-validation-input{display:none}:host([disabled]) .label-hint-container{cursor:not-allowed;opacity:var(--sgds-opacity-40)}`;class Zt extends(vt(nt)){constructor(){super(...arguments),this.label="",this.invalidFeedback="Please tick at least one box if you want to proceed",this.hasFeedback=!1,this.hintText="",this.required=!1,this.noValidate=!1,this.value="",this._isTouched=!1,this.defaultValue="",this._blurredCheckboxes=new Set}connectedCallback(){super.connectedCallback(),this.addEventListener("sgds-check",e=>{const{value:t}=e.detail;!this.value.includes(t)&&this._addValue(t)}),this.addEventListener("sgds-uncheck",e=>{const{value:t}=e.detail;this._removeValue(t)}),this.addEventListener("sgds-blur",e=>{const t=e.target;this._blurredCheckboxes.add(t),Array.from(this._blurredCheckboxes).length===this._checkboxes.length&&(this._isTouched=!0,this._blurredCheckboxes.clear())})}firstUpdated(e){super.firstUpdated(e),this.value&&this._updateInputValue(),this.invalid&&this._updateInvalid()}_renderHintText(){const e=Q` <div class="form-text" id="${this._controlId}Help">${this.hintText}</div> `;return this.hintText&&e}_addValue(e){const t=this.value?this.value.split(";"):[];t.push(e),this.value=t.join(";"),this._updateInputValue(),this.emit("sgds-change",{detail:{value:this.value}})}_removeValue(e){const t=(this.value?this.value.split(";"):[]).filter(t=>t!==e);this.value=t.join(";"),this._updateInputValue(),this.emit("sgds-change",{detail:{value:this.value}})}_sanitizeSlot(){this._checkboxes.forEach(e=>{e.checked=e.defaultChecked=this.value.includes(e.value),e.hasFeedback=this.hasFeedback?"style":null,e.required&&(console.error("Checkboxes in a group cannot have required or hasFeedback prop set to true"),e.remove())}),this._disabledChildCheckboxes()}_disabledChildCheckboxes(){if(this.disabled){this._checkboxes.forEach(e=>e.disabled=this.disabled)}}_handleValueChange(){this._checkboxes.forEach(e=>{e.checked=this.value.includes(e.value)}),this._updateInputValue(),this._updateInvalid()}_handleIsTouched(){this._mixinShouldSkipSgdsValidation()||this._isTouched&&(this.invalid=!this.input.checkValidity(),this._updateInvalid())}_updateInvalid(){this._checkboxes.forEach(e=>e.invalid=this.invalid)}reportValidity(){return this._mixinReportValidity()}checkValidity(){return this._mixinCheckValidity()}get validity(){return this._mixinGetValidity()}get validationMessage(){return this._mixinGetValidationMessage()}_mixinResetFormControl(){this.value=this.input.value=this.defaultValue,this._updateInputValue("reset"),this._mixinResetValidity(this.input)}async _updateInputValue(e="change"){this.input.value=this.value,this.input.dispatchEvent(new InputEvent(e))}render(){return Q`
2329
2329
  <fieldset>
2330
2330
  <div class="label-hint-container">
2331
2331
  <label class="form-label">${this.label}</label>
@@ -2354,5 +2354,5 @@ class extends Pe{constructor(e){if(super(e),e.type!==Se&&e.type!==$e&&e.type!==A
2354
2354
  </div>
2355
2355
  `:le}
2356
2356
  </fieldset>
2357
- `}}function Ct(e,t){customElements.get(e)||customElements.define(e,t)}Zt.styles=[...nt.styles,mt],Zt.dependencies={"sgds-icon":it},e([ye({reflect:!0})],Zt.prototype,"label",void 0),e([ye({type:String,reflect:!0})],Zt.prototype,"invalidFeedback",void 0),e([ye({type:Boolean,reflect:!0})],Zt.prototype,"hasFeedback",void 0),e([ye({reflect:!0})],Zt.prototype,"hintText",void 0),e([ye({type:Boolean,reflect:!0})],Zt.prototype,"required",void 0),e([ye({type:Boolean,reflect:!0})],Zt.prototype,"noValidate",void 0),e([ye({reflect:!0})],Zt.prototype,"value",void 0),e([He()],Zt.prototype,"_isTouched",void 0),e([ht()],Zt.prototype,"defaultValue",void 0),e([He()],Zt.prototype,"_blurredCheckboxes",void 0),e([He()],Zt.prototype,"formEvent",void 0),e([(e,t)=>{const{slot:l,selector:i}=ft??{},a="slot"+(l?`[name=${l}]`:":not([name])");return ke(e,t,{get(){const e=this.renderRoot?.querySelector(a),t=e?.assignedElements(ft)??[];return void 0===i?t:t.filter(e=>e.matches(i))}})}],Zt.prototype,"_checkboxes",void 0),e([pt("value",{waitUntilFirstUpdate:!0})],Zt.prototype,"_handleValueChange",null),e([pt("_isTouched",{waitUntilFirstUpdate:!0})],Zt.prototype,"_handleIsTouched",null),e([pt("invalid",{waitUntilFirstUpdate:!0})],Zt.prototype,"_updateInvalid",null),Ct("sgds-checkbox",wt),Ct("sgds-checkbox-group",Zt)});
2357
+ `}}function Ct(e,t){customElements.get(e)||customElements.define(e,t)}Zt.styles=[...nt.styles,mt],Zt.dependencies={"sgds-icon":it},e([ye({reflect:!0})],Zt.prototype,"label",void 0),e([ye({type:String,reflect:!0})],Zt.prototype,"invalidFeedback",void 0),e([ye({type:Boolean,reflect:!0})],Zt.prototype,"hasFeedback",void 0),e([ye({reflect:!0})],Zt.prototype,"hintText",void 0),e([ye({type:Boolean,reflect:!0})],Zt.prototype,"required",void 0),e([ye({type:Boolean,reflect:!0})],Zt.prototype,"noValidate",void 0),e([ye({reflect:!0})],Zt.prototype,"value",void 0),e([He()],Zt.prototype,"_isTouched",void 0),e([ht()],Zt.prototype,"defaultValue",void 0),e([He()],Zt.prototype,"_blurredCheckboxes",void 0),e([(e,t)=>{const{slot:l,selector:i}=ft??{},a="slot"+(l?`[name=${l}]`:":not([name])");return ke(e,t,{get(){const e=this.renderRoot?.querySelector(a),t=e?.assignedElements(ft)??[];return void 0===i?t:t.filter(e=>e.matches(i))}})}],Zt.prototype,"_checkboxes",void 0),e([pt("value",{waitUntilFirstUpdate:!0})],Zt.prototype,"_handleValueChange",null),e([pt("_isTouched",{waitUntilFirstUpdate:!0})],Zt.prototype,"_handleIsTouched",null),e([pt("invalid",{waitUntilFirstUpdate:!0})],Zt.prototype,"_updateInvalid",null),Ct("sgds-checkbox",wt),Ct("sgds-checkbox-group",Zt)});
2358
2358
  //# sourceMappingURL=index.umd.min.js.map