@randstad-uca/design-system 1.0.101 → 1.0.103

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
@@ -143,9 +143,10 @@ function _(t,e){return(e,i,o)=>((t,e,i)=>(i.configurable=!0,i.enumerable=!0,Refl
143
143
  justify-content: space-between;
144
144
  gap: 16px;
145
145
  flex-direction: row;
146
- align-items: flex-start;
146
+ align-items: center;
147
147
  cursor: pointer;
148
- min-height: 57px;
148
+ min-height: 25px;
149
+ padding-bottom: 16px;
149
150
  }
150
151
 
151
152
  .title {
@@ -155,7 +156,7 @@ function _(t,e){return(e,i,o)=>((t,e,i)=>(i.configurable=!0,i.enumerable=!0,Refl
155
156
 
156
157
  .icon-wrapper {
157
158
  position: absolute;
158
- top: 0;
159
+ top: -7px;
159
160
  right: 0;
160
161
  width: 40px;
161
162
  height: 40px;
@@ -209,22 +210,10 @@ function _(t,e){return(e,i,o)=>((t,e,i)=>(i.configurable=!0,i.enumerable=!0,Refl
209
210
  }
210
211
 
211
212
  @media (max-width: 501px) {
212
- .header {
213
- min-height: 42px;
214
- max-height: 67px;
215
- }
216
213
  .title {
217
- margin-bottom: 16px;
218
214
  max-width: 90%;
219
215
  }
220
216
  }
221
-
222
- @media (max-width: 355px) {
223
- .header {
224
- min-height: 42px;
225
- max-height: unset;
226
- }
227
- }
228
217
  `}connectedCallback(){super.connectedCallback(),this.mediaQueryList=window.matchMedia(V),this.mediaQueryList.addEventListener("change",this.handleMediaQueryChange)}disconnectedCallback(){super.disconnectedCallback(),this.mediaQueryList.removeEventListener("change",this.handleMediaQueryChange)}toggle(){this.isOpen=!this.isOpen}render(){const t=e`
229
218
  <randstad-icon
230
219
  name="${this.isOpen?"arrow_up":"arrow_down"}"
@@ -1186,7 +1175,7 @@ function _(t,e){return(e,i,o)=>((t,e,i)=>(i.configurable=!0,i.enumerable=!0,Refl
1186
1175
  height: 24px;
1187
1176
  color: var( --primary-color );
1188
1177
  }
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`
1178
+ `]}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
1179
  <randstad-icon
1191
1180
  name="${this.isPasswordVisible?"eye_crossed":"eye"}"
1192
1181
  size="24px"
@@ -1224,7 +1213,8 @@ function _(t,e){return(e,i,o)=>((t,e,i)=>(i.configurable=!0,i.enumerable=!0,Refl
1224
1213
  ?disabled=${this.disabled}
1225
1214
  @input=${this.handleInput}
1226
1215
  maxlength=${this.maxLength??i}
1227
- @keydown=${this.handleInputKeyDown}
1216
+ @keydown=${this.handleInputKeyDown}
1217
+ inputmode=${this._inputMode}
1228
1218
  />
1229
1219
 
1230
1220
  ${"password"===this.type?e`
@@ -1482,6 +1472,7 @@ function _(t,e){return(e,i,o)=>((t,e,i)=>(i.configurable=!0,i.enumerable=!0,Refl
1482
1472
  ?disabled=${this.disabled}
1483
1473
  @keydown=${this._handleKeyDown}
1484
1474
  @input=${this._handleInputOrPaste}
1475
+ inputmode=${"google"===this.platform?"email":"url"}
1485
1476
  maxlength=${o>0?o:i}
1486
1477
  />
1487
1478
 
@@ -2617,6 +2608,7 @@ function _(t,e){return(e,i,o)=>((t,e,i)=>(i.configurable=!0,i.enumerable=!0,Refl
2617
2608
  maxlength="${this.maxLength??""}"
2618
2609
  tabindex="0"
2619
2610
  role="combobox"
2611
+ inputmode="search"
2620
2612
  autocomplete="new-password"
2621
2613
  aria-expanded="${this.isOpen}"
2622
2614
  aria-controls="options-list"
@@ -2682,6 +2674,7 @@ function _(t,e){return(e,i,o)=>((t,e,i)=>(i.configurable=!0,i.enumerable=!0,Refl
2682
2674
  @keydown="${this.preventInvalidStart}"
2683
2675
  @paste="${this.handlePaste}"
2684
2676
  placeholder="${h}"
2677
+ inputmode="search"
2685
2678
  maxlength="${this.maxLength??""}"
2686
2679
  />
2687
2680
 
@@ -3961,6 +3954,7 @@ function _(t,e){return(e,i,o)=>((t,e,i)=>(i.configurable=!0,i.enumerable=!0,Refl
3961
3954
  ?disabled=${this.disabled}
3962
3955
  ?readonly=${this.readonly}
3963
3956
  maxlength="${this.maxLength}"
3957
+ inputmode="numeric"
3964
3958
  @input=${this.readonly?null:this.handleInput}
3965
3959
  @keydown=${this.readonly?null:this.handleKeyDown}
3966
3960
  @click=${this.readonly?this.handleCalendarButtonClick:null}