@ikas/storefront 6.1.0-beta.174 → 6.1.0-beta.175

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.
@@ -1 +1 @@
1
- import*as e from"react";import{runInAction as t}from"mobx";import{observer as n}from"mobx-react-lite";import a,{FormItemType as o}from"./model.js";import r from"./caret-down.js";import l from"./style.module.scss.js";import"@ikas/storefront-config";import{useTranslation as i}from"../../../../utils/i18n.js";import u from"react-tooltip";import{PhoneNumberInput as c}from"../phone-number-input/index.js";var s=n((function(n){var r=i().t,s=e.useState((function(){return new a(n)})),p=s[0],E=s[1],v=e.useRef(null),h=e.useRef(null);e.useEffect((function(){u.rebuild()}),[]),e.useEffect((function(){t((function(){p.type=n.type}))}),[n.type]),e.useEffect((function(){t((function(){p.inputType=n.inputType}))}),[n.inputType]),e.useEffect((function(){t((function(){p.inputMode=n.inputMode}))}),[n.inputMode]),e.useEffect((function(){t((function(){p.value=n.value}))}),[n.value]),e.useEffect((function(){t((function(){p.options=n.options}))}),[n.options]),e.useEffect((function(){t((function(){p.label=n.label}))}),[n.label]),e.useEffect((function(){t((function(){p.hasError=n.hasError}))}),[n.hasError]),e.useEffect((function(){t((function(){p.errorText=n.errorText}))}),[n.errorText]),e.useEffect((function(){t((function(){p.textAreaPlaceholder=n.textAreaPlaceholder}))}),[n.textAreaPlaceholder]),e.useEffect((function(){t((function(){p.rightContent=n.rightContent}))}),[n.rightContent]),e.useEffect((function(){t((function(){p.disabled=n.disabled||!1}))}),[n.disabled]),e.useEffect((function(){t((function(){p.isLoading=n.isLoading||!1}))}),[n.isLoading]),e.useEffect((function(){t((function(){p.disableResize=n.disableResize}))}),[n.disableResize]),e.useEffect((function(){t((function(){E(new a(n))}))}),[n.onChange]),e.useEffect((function(){!p.country&&n.currentCountryCode&&p.onCountryChange(n.currentCountryCode)}),[n.currentCountryCode]);var y=p.type===o.TEXT||p.type===o.TEXT_AREA;return e.createElement("div",{className:p.formItemStyle,style:n.style},e.createElement("div",{className:l.FormItemWrapper},e.createElement("div",{className:l.FormItemInputWrapper,onClick:y?function(e){var t,n;p.type===o.TEXT?null===(t=v.current)||void 0===t||t.focus():p.type===o.TEXT_AREA&&(null===(n=h.current)||void 0===n||n.focus())}:void 0,style:y?void 0:{cursor:"default"}},e.createElement("label",{className:p.labelStyle,id:n.name+"-label",htmlFor:n.name},p.label),p.type===o.TEXT&&e.createElement(m,{ref:v,vm:p,type:p.inputType,disabled:p.disabled,required:n.required,pattern:n.pattern,autocomplete:n.autocomplete,name:n.name,placeholder:n.placeholder,autocapitalize:n.autocapitalize,autocorrect:n.autocorrect,spellcheck:n.spellcheck,ariaLabelledBy:n.name+"-label"}),p.type===o.TEL&&e.createElement(c,{key:n.currentCountryCode||"1",disabled:p.disabled,defaultCountry:n.currentCountryCode,placeholder:r("checkout-page:enterPhoneNumber"),value:p.value?p.value:"",onChange:p.onPhoneChange}),p.type===o.TEXT_AREA&&e.createElement(d,{ref:h,vm:p,name:n.name}),p.type===o.SELECT&&e.createElement(f,{ariaLabelledBy:n.name+"-label",vm:p,autocomplete:n.autocomplete,name:n.name})),!!p.hasError&&e.createElement("div",{className:l.ErrorMsg},p.errorText||""),!!n.tooltipText&&e.createElement("div",{className:l.FormItemTooltipContainer,"data-tip":n.tooltipText,"data-event":"touchstart focus mouseover","data-event-off":"mouseout"},"?"),!!p.rightContent&&e.createElement("div",{className:l.RightContent},p.rightContent)))})),m=n(e.forwardRef((function(t,n){var a=t.vm,o=t.name,r=t.autocomplete,l=t.type,i=t.pattern,u=t.required,c=t.disabled,s=t.placeholder,m=t.autocapitalize,d=t.autocorrect,f=t.spellcheck,p=t.ariaLabelledBy;return e.createElement("input",{ref:n,id:o,required:u,type:l||"text",name:o,pattern:i,disabled:c,autoComplete:r,inputMode:a.inputMode||"text",className:a.inputStyle,value:a.value||"",onChange:a.onValueChange,placeholder:s,autoCapitalize:m,autoCorrect:d,spellCheck:f,"aria-labelledby":p})}))),d=n(e.forwardRef((function(t,n){var a,o=t.vm,r=t.name;return e.createElement(e.Fragment,null,e.createElement("textarea",{ref:n,style:{resize:o.disableResize?"none":"initial"},name:r,value:o.value||"",disabled:o.disabled,onChange:o.onTextAreaValueChange,placeholder:o.textAreaPlaceholder||"",maxLength:o.maxLength}),o.maxLength&&e.createElement("div",{className:l.TextareaInfo},(null===(a=o.value)||void 0===a?void 0:a.length)||0," / ",o.maxLength))}))),f=n((function(t){var n,a,o=t.vm,i=t.autocomplete,u=t.name,c=t.ariaLabelledBy,s=null===(n=o.options)||void 0===n?void 0:n.find((function(e){return e.value===o.value}));return e.createElement(e.Fragment,null,e.createElement("select",{id:u,"aria-labelledby":c,name:u,className:o.inputStyle,disabled:o.isLoading||o.disabled,autoComplete:i,value:(null==s?void 0:s.label)||"",onChange:o.onSelectChange},!o.value&&e.createElement("option",{value:"",disabled:!0,key:-1}),null===(a=o.options)||void 0===a?void 0:a.map((function(t,n){return e.createElement("option",{key:n+t.value,value:t.label},t.label)}))),e.createElement("div",{className:l.ArrowContainer},!o.isLoading&&e.createElement(r,null),o.isLoading&&e.createElement("div",{className:l.Loader})))}));export{s as FormItem};
1
+ import*as e from"react";import{runInAction as t}from"mobx";import{observer as n}from"mobx-react-lite";import a,{FormItemType as o}from"./model.js";import l from"./caret-down.js";import r from"./style.module.scss.js";import"@ikas/storefront-config";import{useTranslation as i}from"../../../../utils/i18n.js";import u from"react-tooltip";import{PhoneNumberInput as c}from"../phone-number-input/index.js";var s=n((function(n){var l=i().t,s=e.useState((function(){return new a(n)})),p=s[0],v=s[1],E=e.useRef(null),h=e.useRef(null);e.useEffect((function(){u.rebuild()}),[]),e.useEffect((function(){t((function(){p.type=n.type}))}),[n.type]),e.useEffect((function(){t((function(){p.inputType=n.inputType}))}),[n.inputType]),e.useEffect((function(){t((function(){p.inputMode=n.inputMode}))}),[n.inputMode]),e.useEffect((function(){t((function(){p.value=n.value}))}),[n.value]),e.useEffect((function(){t((function(){p.options=n.options}))}),[n.options]),e.useEffect((function(){t((function(){p.label=n.label}))}),[n.label]),e.useEffect((function(){t((function(){p.hasError=n.hasError}))}),[n.hasError]),e.useEffect((function(){t((function(){p.errorText=n.errorText}))}),[n.errorText]),e.useEffect((function(){t((function(){p.textAreaPlaceholder=n.textAreaPlaceholder}))}),[n.textAreaPlaceholder]),e.useEffect((function(){t((function(){p.rightContent=n.rightContent}))}),[n.rightContent]),e.useEffect((function(){t((function(){p.disabled=n.disabled||!1}))}),[n.disabled]),e.useEffect((function(){t((function(){p.isLoading=n.isLoading||!1}))}),[n.isLoading]),e.useEffect((function(){t((function(){p.disableResize=n.disableResize}))}),[n.disableResize]),e.useEffect((function(){t((function(){v(new a(n))}))}),[n.onChange]),e.useEffect((function(){!p.country&&n.currentCountryCode&&p.onCountryChange(n.currentCountryCode)}),[n.currentCountryCode]);var y=p.type===o.TEXT||p.type===o.TEXT_AREA;return e.createElement("div",{className:p.formItemStyle,style:n.style},e.createElement("div",{className:r.FormItemWrapper},e.createElement("div",{className:r.FormItemInputWrapper,onClick:y?function(e){var t,n;p.type===o.TEXT?null===(t=E.current)||void 0===t||t.focus():p.type===o.TEXT_AREA&&(null===(n=h.current)||void 0===n||n.focus())}:void 0,style:y?void 0:{cursor:"default"}},e.createElement("label",{className:p.labelStyle,id:n.name+"-label",htmlFor:n.name},p.label),p.type===o.TEXT&&e.createElement(m,{ref:E,vm:p,type:p.inputType,disabled:p.disabled,required:n.required,pattern:n.pattern,autocomplete:n.autocomplete,name:n.name,placeholder:n.placeholder,autocapitalize:n.autocapitalize,autocorrect:n.autocorrect,spellcheck:n.spellcheck,ariaLabelledBy:n.name+"-label"}),p.type===o.TEL&&e.createElement(c,{key:n.currentCountryCode||"1",disabled:p.disabled,defaultCountry:n.currentCountryCode,placeholder:l("checkout-page:enterPhoneNumber"),value:p.value?p.value:"",onChange:p.onPhoneChange}),p.type===o.TEXT_AREA&&e.createElement(d,{ref:h,vm:p,name:n.name}),p.type===o.SELECT&&e.createElement(f,{ariaLabelledBy:n.name+"-label",vm:p,autocomplete:n.autocomplete,name:n.name})),!!p.hasError&&e.createElement("div",{className:r.ErrorMsg},p.errorText||""),!!n.tooltipText&&e.createElement("div",{className:r.FormItemTooltipContainer,"data-tip":n.tooltipText,"data-event":"touchstart focus mouseover","data-event-off":"mouseout"},"?"),!!p.rightContent&&e.createElement("div",{className:r.RightContent},p.rightContent)))})),m=n(e.forwardRef((function(t,n){var a=t.vm,o=t.name,l=t.autocomplete,r=t.type,i=t.pattern,u=t.required,c=t.disabled,s=t.placeholder,m=t.autocapitalize,d=t.autocorrect,f=t.spellcheck,p=t.ariaLabelledBy;return e.createElement("input",{ref:n,id:o,required:u,type:r||"text",name:o,pattern:i,disabled:c,autoComplete:l,inputMode:a.inputMode||"text",className:a.inputStyle,value:a.value||"",onChange:a.onValueChange,placeholder:a.value?"":s,autoCapitalize:m,autoCorrect:d,spellCheck:f,"aria-labelledby":p})}))),d=n(e.forwardRef((function(t,n){var a,o=t.vm,l=t.name;return e.createElement(e.Fragment,null,e.createElement("textarea",{ref:n,style:{resize:o.disableResize?"none":"initial"},name:l,value:o.value||"",disabled:o.disabled,onChange:o.onTextAreaValueChange,placeholder:o.value?"":o.textAreaPlaceholder||"",maxLength:o.maxLength}),o.maxLength&&e.createElement("div",{className:r.TextareaInfo},(null===(a=o.value)||void 0===a?void 0:a.length)||0," / ",o.maxLength))}))),f=n((function(t){var n,a,o=t.vm,i=t.autocomplete,u=t.name,c=t.ariaLabelledBy,s=null===(n=o.options)||void 0===n?void 0:n.find((function(e){return e.value===o.value}));return e.createElement(e.Fragment,null,e.createElement("select",{id:u,"aria-labelledby":c,name:u,className:o.inputStyle,disabled:o.isLoading||o.disabled,autoComplete:i,value:(null==s?void 0:s.label)||"",onChange:o.onSelectChange},!o.value&&e.createElement("option",{value:"",disabled:!0,key:-1}),null===(a=o.options)||void 0===a?void 0:a.map((function(t,n){return e.createElement("option",{key:n+t.value,value:t.label},t.label)}))),e.createElement("div",{className:r.ArrowContainer},!o.isLoading&&e.createElement(l,null),o.isLoading&&e.createElement("div",{className:r.Loader})))}));export{s as FormItem};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ikas/storefront",
3
- "version": "6.1.0-beta.174",
3
+ "version": "6.1.0-beta.175",
4
4
  "description": "Storefront functionality for ikas storefront themes.",
5
5
  "author": "ikas",
6
6
  "license": "ISC",
@@ -22,11 +22,11 @@
22
22
  "swiper": "11.0.6"
23
23
  },
24
24
  "devDependencies": {
25
- "@ikas/storefront-api": "^6.1.0-beta.174",
26
- "@ikas/storefront-config": "^6.1.0-beta.174",
27
- "@ikas/storefront-model-functions": "^6.1.0-beta.174",
28
- "@ikas/storefront-models": "^6.1.0-beta.174",
29
- "@ikas/storefront-providers": "^6.1.0-beta.174",
25
+ "@ikas/storefront-api": "^6.1.0-beta.175",
26
+ "@ikas/storefront-config": "^6.1.0-beta.175",
27
+ "@ikas/storefront-model-functions": "^6.1.0-beta.175",
28
+ "@ikas/storefront-models": "^6.1.0-beta.175",
29
+ "@ikas/storefront-providers": "^6.1.0-beta.175",
30
30
  "@ikas/localized-address": "1.0.0-beta.6",
31
31
  "@adyen/adyen-web": "^5.57.0",
32
32
  "@rollup/plugin-commonjs": "^22.0.0",
@@ -61,11 +61,11 @@
61
61
  },
62
62
  "peerDependencies": {
63
63
  "@ikas/localized-address": "1.0.0-beta.6",
64
- "@ikas/storefront-api": "^6.1.0-beta.174",
65
- "@ikas/storefront-config": "^6.1.0-beta.174",
66
- "@ikas/storefront-model-functions": "^6.1.0-beta.174",
67
- "@ikas/storefront-models": "^6.1.0-beta.174",
68
- "@ikas/storefront-providers": "^6.1.0-beta.174",
64
+ "@ikas/storefront-api": "^6.1.0-beta.175",
65
+ "@ikas/storefront-config": "^6.1.0-beta.175",
66
+ "@ikas/storefront-model-functions": "^6.1.0-beta.175",
67
+ "@ikas/storefront-models": "^6.1.0-beta.175",
68
+ "@ikas/storefront-providers": "^6.1.0-beta.175",
69
69
  "mobx": "^6.1.3",
70
70
  "mobx-react-lite": "^3.1.5",
71
71
  "next": "12.2.0",