@ikas/storefront 6.1.0-beta.166 → 6.1.0-beta.167

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 o,{FormItemType as a}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 o(n)})),p=s[0],E=s[1];return 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.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 o(n))}))}),[n.onChange]),e.useEffect((function(){!p.country&&n.currentCountryCode&&p.onCountryChange(n.currentCountryCode)}),[n.currentCountryCode]),e.createElement("div",{className:p.formItemStyle,style:n.style},e.createElement("div",{className:l.FormItemWrapper},e.createElement("div",{className:l.FormItemInputWrapper},e.createElement("div",{className:p.labelStyle},p.label),p.type===a.TEXT&&e.createElement(m,{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}),p.type===a.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===a.TEXT_AREA&&e.createElement(d,{vm:p,name:n.name}),p.type===a.SELECT&&e.createElement(f,{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((function(t){var n=t.vm,o=t.name,a=t.autocomplete,r=t.type,l=t.pattern,i=t.required,u=t.disabled,c=t.placeholder,s=t.autocapitalize,m=t.autocorrect,d=t.spellcheck;return e.createElement("input",{required:i,type:r||"text",name:o,pattern:l,disabled:u,autoComplete:a,inputMode:n.inputMode||"text",className:n.inputStyle,value:n.value,onChange:n.onValueChange,placeholder:n.isFocused?c:void 0,onFocus:n.handleOnFocus,onBlur:n.handleOnBlur,autoCapitalize:s,autoCorrect:m,spellCheck:d})})),d=n((function(t){var n,o=t.vm,a=t.name;return e.createElement(e.Fragment,null,e.createElement("textarea",{style:{resize:o.disableResize?"none":"initial"},name:a,value:o.value,disabled:o.disabled,onChange:o.onTextAreaValueChange,placeholder:o.textAreaPlaceholder||"",maxLength:o.maxLength}),o.maxLength&&e.createElement("div",{className:l.TextareaInfo},(null===(n=o.value)||void 0===n?void 0:n.length)||0," / ",o.maxLength))})),f=n((function(t){var n,o=t.vm,a=t.autocomplete,i=t.name;return e.createElement(e.Fragment,null,e.createElement("select",{name:i,className:o.inputStyle,disabled:o.isLoading||o.disabled,autoComplete:a,onChange:o.onSelectChange},!o.value&&e.createElement("option",{selected:!0,disabled:!0,key:-1}),null===(n=o.options)||void 0===n?void 0:n.map((function(t,n){return e.createElement("option",{key:n+t.value,value:t.label,selected:o.value===t.value},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 o,{FormItemType as a}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 o(n)})),p=s[0],E=s[1];return 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.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 o(n))}))}),[n.onChange]),e.useEffect((function(){!p.country&&n.currentCountryCode&&p.onCountryChange(n.currentCountryCode)}),[n.currentCountryCode]),e.createElement("div",{className:p.formItemStyle,style:n.style},e.createElement("div",{className:l.FormItemWrapper},e.createElement("div",{className:l.FormItemInputWrapper},e.createElement("div",{className:p.labelStyle},p.label),p.type===a.TEXT&&e.createElement(m,{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}),p.type===a.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===a.TEXT_AREA&&e.createElement(d,{vm:p,name:n.name}),p.type===a.SELECT&&e.createElement(f,{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((function(t){var n=t.vm,o=t.name,a=t.autocomplete,r=t.type,l=t.pattern,i=t.required,u=t.disabled,c=t.placeholder,s=t.autocapitalize,m=t.autocorrect,d=t.spellcheck;return e.createElement("input",{required:i,type:r||"text",name:o,pattern:l,disabled:u,autoComplete:a,inputMode:n.inputMode||"text",className:n.inputStyle,defaultValue:n.value,onChange:n.onValueChange,placeholder:n.isFocused?c:void 0,onFocus:n.handleOnFocus,onBlur:n.handleOnBlur,autoCapitalize:s,autoCorrect:m,spellCheck:d})})),d=n((function(t){var n,o=t.vm,a=t.name;return e.createElement(e.Fragment,null,e.createElement("textarea",{style:{resize:o.disableResize?"none":"initial"},name:a,defaultValue:o.value,disabled:o.disabled,onChange:o.onTextAreaValueChange,placeholder:o.textAreaPlaceholder||"",maxLength:o.maxLength}),o.maxLength&&e.createElement("div",{className:l.TextareaInfo},(null===(n=o.value)||void 0===n?void 0:n.length)||0," / ",o.maxLength))})),f=n((function(t){var n,o=t.vm,a=t.autocomplete,i=t.name;return e.createElement(e.Fragment,null,e.createElement("select",{name:i,className:o.inputStyle,disabled:o.isLoading||o.disabled,autoComplete:a,onChange:o.onSelectChange},!o.value&&e.createElement("option",{selected:!0,disabled:!0,key:-1}),null===(n=o.options)||void 0===n?void 0:n.map((function(t,n){return e.createElement("option",{key:n+t.value,value:t.label,selected:o.value===t.value},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};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ikas/storefront",
3
- "version": "6.1.0-beta.166",
3
+ "version": "6.1.0-beta.167",
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.166",
26
- "@ikas/storefront-config": "^6.1.0-beta.166",
27
- "@ikas/storefront-model-functions": "^6.1.0-beta.166",
28
- "@ikas/storefront-models": "^6.1.0-beta.166",
29
- "@ikas/storefront-providers": "^6.1.0-beta.166",
25
+ "@ikas/storefront-api": "^6.1.0-beta.167",
26
+ "@ikas/storefront-config": "^6.1.0-beta.167",
27
+ "@ikas/storefront-model-functions": "^6.1.0-beta.167",
28
+ "@ikas/storefront-models": "^6.1.0-beta.167",
29
+ "@ikas/storefront-providers": "^6.1.0-beta.167",
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.166",
65
- "@ikas/storefront-config": "^6.1.0-beta.166",
66
- "@ikas/storefront-model-functions": "^6.1.0-beta.166",
67
- "@ikas/storefront-models": "^6.1.0-beta.166",
68
- "@ikas/storefront-providers": "^6.1.0-beta.166",
64
+ "@ikas/storefront-api": "^6.1.0-beta.167",
65
+ "@ikas/storefront-config": "^6.1.0-beta.167",
66
+ "@ikas/storefront-model-functions": "^6.1.0-beta.167",
67
+ "@ikas/storefront-models": "^6.1.0-beta.167",
68
+ "@ikas/storefront-providers": "^6.1.0-beta.167",
69
69
  "mobx": "^6.1.3",
70
70
  "mobx-react-lite": "^3.1.5",
71
71
  "next": "12.2.0",