@randstad-uca/design-system 1.0.101 → 1.0.102

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.
@@ -31,6 +31,7 @@ export declare class RandstadForm extends BaseControl {
31
31
  */
32
32
  private get _isCleanButtonVisible();
33
33
  private handleKeyDown;
34
+ private get _inputMode();
34
35
  private handleInputArrowKey;
35
36
  private handleButtonArrowKey;
36
37
  render(): TemplateResult<1>;
package/dist/index.js CHANGED
@@ -1186,7 +1186,7 @@ function _(t,e){return(e,i,o)=>((t,e,i)=>(i.configurable=!0,i.enumerable=!0,Refl
1186
1186
  height: 24px;
1187
1187
  color: var( --primary-color );
1188
1188
  }
1189
- `]}togglePassword(t){this.isPasswordVisible=!this.isPasswordVisible;const e=t.currentTarget.parentElement?.querySelector("input");e&&(e.type=this.isPasswordVisible?"text":"password"),this.requestUpdate()}handleInput(t){this.handleInputCustom(t);const e=t.target.value;void 0!==this.maxLength&&"textarea"!==this.type?this.value=e.slice(0,this.maxLength):this.value=e,this.dispatchEvent(new CustomEvent("valueChanged",{detail:this.value})),this.dispatchEvent(new Event("input",{bubbles:!0})),this.requestUpdate()}handleClear(){this.value="",this.dispatchEvent(new CustomEvent("valueChanged",{detail:this.value})),this.dispatchEvent(new Event("input",{bubbles:!0})),this.requestUpdate()}handleLinkClick(t){t.preventDefault(),this.linkRoute&&this.dispatchEvent(new CustomEvent("linkClicked",{detail:this.linkRoute,bubbles:!0,composed:!0}))}_updateValueWithCursor(t,e,i){const o=t.value;if(o!==e){i.preventDefault();const r=t.selectionStart,s=t.selectionEnd;if(t.value=e,null!==r&&null!==s){const i=o.length-e.length,n=Math.max(0,r-i),a=Math.max(0,s-i);t.setSelectionRange(n,a)}}}handleInputCustom(t){const e=t.target;let i=!1;if("number"===this.keydown||"text"===this.keydown||"alfanumeric"===this.keydown)i=!0;else if(this.keydownRegex)try{i=!new RegExp(this.keydownRegex).test("😀")}catch(t){i=!0}if(i){const i=e.value.replace(tt,"");this._updateValueWithCursor(e,i,t)}"number"===this.keydown?this.onlyNumeric(t):"text"===this.keydown?this.onlyText(t):"alfanumeric"===this.keydown?this.onlyAlphanumeric(t):this.keydownRegex&&this.onlyRegex(t)}onlyNumeric(t){const e=t.target,i=e.value.replace(/[^0-9]/g,"");this._updateValueWithCursor(e,i,t)}onlyText(t){const e=t.target,i=e.value.replace(/[^a-zA-Z\sáéíóúüñÁÉÍÓÚÑÜ]/g,"").trimStart();this._updateValueWithCursor(e,i,t)}onlyAlphanumeric(t){const e=t.target,i=e.value.replace(/[^a-zA-Z0-9]/g,"").trimStart();this._updateValueWithCursor(e,i,t)}onlyRegex(t){if(!this.keydownRegex)return;const e=t.target,i=e.value;let o=this.keydownRegex.match(/\[\^?[^\]]+\]/g);o||(o=[`[${this.keydownRegex}]`]);let r="";const s=o.length>=2,n=new RegExp(o[0]),a=s?new RegExp(o[1]):n,l=i.split("");for(let t=0;t<l.length;t++){const e=l[t];0===t?n.test(e)&&(r+=e):a.test(e)&&(r+=e)}const d=r.trimStart();this._updateValueWithCursor(e,d,t)}handleInputKeyDown(t){this.handleKeyDown(t),this.handleInputArrowKey(t)}get _isCleanButtonVisible(){return this.cleanButton&&!!this.value&&"password"!==this.type&&"textarea"!==this.type}handleKeyDown(t){if("Enter"!==t.key)return;const e=new Event("submit",{bubbles:!0,composed:!0,cancelable:!0}),i=this.closest("form");i&&i.dispatchEvent(e)}handleInputArrowKey(t){if("ArrowRight"!==t.key)return;const e=t.target;if(("password"===this.type||this._isCleanButtonVisible)&&e.selectionStart===e.value.length){t.preventDefault();const e=this.shadowRoot?.querySelector(".toggle-password, .clean-button");e?.focus()}}handleButtonArrowKey(t){if("ArrowLeft"!==t.key)return;t.preventDefault();const e=this.shadowRoot?.querySelector(".form-input");e&&(e.focus(),e.selectionStart=e.selectionEnd=e.value.length)}render(){const t="textarea"===this.type?` height: ${this.heightTextArea??"30px"}; max-height: ${this.maxHeightTextArea??"30px"}; overflow-y: auto; `:"",o=this.labelColor?`--label-color: ${this.labelColor};`:"",r=e`
1189
+ `]}togglePassword(t){this.isPasswordVisible=!this.isPasswordVisible;const e=t.currentTarget.parentElement?.querySelector("input");e&&(e.type=this.isPasswordVisible?"text":"password"),this.requestUpdate()}handleInput(t){this.handleInputCustom(t);const e=t.target.value;void 0!==this.maxLength&&"textarea"!==this.type?this.value=e.slice(0,this.maxLength):this.value=e,this.dispatchEvent(new CustomEvent("valueChanged",{detail:this.value})),this.dispatchEvent(new Event("input",{bubbles:!0})),this.requestUpdate()}handleClear(){this.value="",this.dispatchEvent(new CustomEvent("valueChanged",{detail:this.value})),this.dispatchEvent(new Event("input",{bubbles:!0})),this.requestUpdate()}handleLinkClick(t){t.preventDefault(),this.linkRoute&&this.dispatchEvent(new CustomEvent("linkClicked",{detail:this.linkRoute,bubbles:!0,composed:!0}))}_updateValueWithCursor(t,e,i){const o=t.value;if(o!==e){i.preventDefault();const r=t.selectionStart,s=t.selectionEnd;if(t.value=e,null!==r&&null!==s){const i=o.length-e.length,n=Math.max(0,r-i),a=Math.max(0,s-i);t.setSelectionRange(n,a)}}}handleInputCustom(t){const e=t.target;let i=!1;if("number"===this.keydown||"text"===this.keydown||"alfanumeric"===this.keydown)i=!0;else if(this.keydownRegex)try{i=!new RegExp(this.keydownRegex).test("😀")}catch(t){i=!0}if(i){const i=e.value.replace(tt,"");this._updateValueWithCursor(e,i,t)}"number"===this.keydown?this.onlyNumeric(t):"text"===this.keydown?this.onlyText(t):"alfanumeric"===this.keydown?this.onlyAlphanumeric(t):this.keydownRegex&&this.onlyRegex(t)}onlyNumeric(t){const e=t.target,i=e.value.replace(/[^0-9]/g,"");this._updateValueWithCursor(e,i,t)}onlyText(t){const e=t.target,i=e.value.replace(/[^a-zA-Z\sáéíóúüñÁÉÍÓÚÑÜ]/g,"").trimStart();this._updateValueWithCursor(e,i,t)}onlyAlphanumeric(t){const e=t.target,i=e.value.replace(/[^a-zA-Z0-9]/g,"").trimStart();this._updateValueWithCursor(e,i,t)}onlyRegex(t){if(!this.keydownRegex)return;const e=t.target,i=e.value;let o=this.keydownRegex.match(/\[\^?[^\]]+\]/g);o||(o=[`[${this.keydownRegex}]`]);let r="";const s=o.length>=2,n=new RegExp(o[0]),a=s?new RegExp(o[1]):n,l=i.split("");for(let t=0;t<l.length;t++){const e=l[t];0===t?n.test(e)&&(r+=e):a.test(e)&&(r+=e)}const d=r.trimStart();this._updateValueWithCursor(e,d,t)}handleInputKeyDown(t){this.handleKeyDown(t),this.handleInputArrowKey(t)}get _isCleanButtonVisible(){return this.cleanButton&&!!this.value&&"password"!==this.type&&"textarea"!==this.type}handleKeyDown(t){if("Enter"!==t.key)return;const e=new Event("submit",{bubbles:!0,composed:!0,cancelable:!0}),i=this.closest("form");i&&i.dispatchEvent(e)}get _inputMode(){return"password"===this.type?"text":"number"===this.keydown?"numeric":"text"}handleInputArrowKey(t){if("ArrowRight"!==t.key)return;const e=t.target;if(("password"===this.type||this._isCleanButtonVisible)&&e.selectionStart===e.value.length){t.preventDefault();const e=this.shadowRoot?.querySelector(".toggle-password, .clean-button");e?.focus()}}handleButtonArrowKey(t){if("ArrowLeft"!==t.key)return;t.preventDefault();const e=this.shadowRoot?.querySelector(".form-input");e&&(e.focus(),e.selectionStart=e.selectionEnd=e.value.length)}render(){const t="textarea"===this.type?` height: ${this.heightTextArea??"30px"}; max-height: ${this.maxHeightTextArea??"30px"}; overflow-y: auto; `:"",o=this.labelColor?`--label-color: ${this.labelColor};`:"",r=e`
1190
1190
  <randstad-icon
1191
1191
  name="${this.isPasswordVisible?"eye_crossed":"eye"}"
1192
1192
  size="24px"
@@ -1224,7 +1224,8 @@ function _(t,e){return(e,i,o)=>((t,e,i)=>(i.configurable=!0,i.enumerable=!0,Refl
1224
1224
  ?disabled=${this.disabled}
1225
1225
  @input=${this.handleInput}
1226
1226
  maxlength=${this.maxLength??i}
1227
- @keydown=${this.handleInputKeyDown}
1227
+ @keydown=${this.handleInputKeyDown}
1228
+ inputmode=${this._inputMode}
1228
1229
  />
1229
1230
 
1230
1231
  ${"password"===this.type?e`
@@ -1482,6 +1483,7 @@ function _(t,e){return(e,i,o)=>((t,e,i)=>(i.configurable=!0,i.enumerable=!0,Refl
1482
1483
  ?disabled=${this.disabled}
1483
1484
  @keydown=${this._handleKeyDown}
1484
1485
  @input=${this._handleInputOrPaste}
1486
+ inputmode=${"google"===this.platform?"email":"url"}
1485
1487
  maxlength=${o>0?o:i}
1486
1488
  />
1487
1489
 
@@ -2617,6 +2619,7 @@ function _(t,e){return(e,i,o)=>((t,e,i)=>(i.configurable=!0,i.enumerable=!0,Refl
2617
2619
  maxlength="${this.maxLength??""}"
2618
2620
  tabindex="0"
2619
2621
  role="combobox"
2622
+ inputmode="search"
2620
2623
  autocomplete="new-password"
2621
2624
  aria-expanded="${this.isOpen}"
2622
2625
  aria-controls="options-list"
@@ -2682,6 +2685,7 @@ function _(t,e){return(e,i,o)=>((t,e,i)=>(i.configurable=!0,i.enumerable=!0,Refl
2682
2685
  @keydown="${this.preventInvalidStart}"
2683
2686
  @paste="${this.handlePaste}"
2684
2687
  placeholder="${h}"
2688
+ inputmode="search"
2685
2689
  maxlength="${this.maxLength??""}"
2686
2690
  />
2687
2691
 
@@ -3961,6 +3965,7 @@ function _(t,e){return(e,i,o)=>((t,e,i)=>(i.configurable=!0,i.enumerable=!0,Refl
3961
3965
  ?disabled=${this.disabled}
3962
3966
  ?readonly=${this.readonly}
3963
3967
  maxlength="${this.maxLength}"
3968
+ inputmode="numeric"
3964
3969
  @input=${this.readonly?null:this.handleInput}
3965
3970
  @keydown=${this.readonly?null:this.handleKeyDown}
3966
3971
  @click=${this.readonly?this.handleCalendarButtonClick:null}