@ikas/storefront 6.1.0-beta.174 → 6.1.0-beta.176
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
|
|
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],E=s[1],v=e.useRef(null),y=e.useRef(null),b=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 h=p.type===o.TEXT||p.type===o.TEXT_AREA||p.type===o.TEL;return e.createElement("div",{className:p.formItemStyle,style:n.style},e.createElement("div",{className:r.FormItemWrapper},e.createElement("div",{className:r.FormItemInputWrapper,onClick:h?function(e){var t,n,a;"SELECT"!==e.target.tagName&&(p.type===o.TEXT?null===(t=v.current)||void 0===t||t.focus():p.type===o.TEXT_AREA?null===(n=y.current)||void 0===n||n.focus():p.type===o.TEL&&(null===(a=b.current)||void 0===a||a.focus()))}:void 0,style:h?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,{ref:b,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:y,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||"",onInput: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,onInput: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};
|
|
@@ -6,5 +6,5 @@ declare type Props = {
|
|
|
6
6
|
value: string;
|
|
7
7
|
onChange: (value: string) => void;
|
|
8
8
|
};
|
|
9
|
-
export declare const PhoneNumberInput: React.
|
|
9
|
+
export declare const PhoneNumberInput: React.MemoExoticComponent<React.ForwardRefExoticComponent<Pick<Props & React.RefAttributes<HTMLInputElement>, keyof Props | "key"> & React.RefAttributes<HTMLInputElement>>>;
|
|
10
10
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__awaiter as e,__generator as t}from'./../../../../ext/tslib/tslib.es6.js';import*as a from"react";import{observer as r}from"mobx-react-lite";import
|
|
1
|
+
import{__awaiter as e,__generator as t}from'./../../../../ext/tslib/tslib.es6.js';import*as a from"react";import{observer as r}from"mobx-react-lite";import n,{isSupportedCountry as l,formatIncompletePhoneNumber as o,getCountryCallingCode as u,parseIncompletePhoneNumber as s}from"libphonenumber-js";import c from"./get-countries.js";import i from"./style.module.scss.js";var m=r(a.forwardRef((function(r,m){var v=r.defaultCountry,f=r.disabled,d=void 0!==f&&f,p=r.placeholder,g=r.value,b=r.onChange,E=a.useState([]),y=E[0],h=E[1],N=a.useState(v||"TR"),S=N[0],F=N[1],j=a.useState(""),C=j[0],I=j[1];a.useEffect((function(){w();var e=S;if("KK"===e&&(e="TR"),l(e)||(e="US"),g){var t=n(g);t&&t.country&&(e=t.country),I(o(g,e))}else x(e);F(e)}),[v]);var w=function(){return e(void 0,void 0,void 0,(function(){var e;return t(this,(function(t){switch(t.label){case 0:return[4,c()];case 1:return e=t.sent(),h(e),[2]}}))}))},x=function(e){var t=u(e);I("+".concat(t))},R=function(e){return o(e,S)};return a.createElement(a.Fragment,null,a.createElement("div",{className:i.SelectFlag},a.createElement("div",{className:i.FlagContainer},a.createElement("div",{className:i.Flag},a.createElement("img",{className:i.FlagImage,alt:S,src:"https://cdn.myikas.com/sf/assets/flags/3x2/".concat(S,".svg")}),a.createElement("div",{className:i.Arrow})),a.createElement("select",{className:i.Select,value:S,onInput:function(e){if(e.target.value){var t=e.target.value;F(t),x(t)}},disabled:d},y.map((function(e){return a.createElement("option",{key:e.value,value:e.value},e.label)}))))),a.createElement("input",{ref:m,type:"tel",autoComplete:"tel",className:i.Input,value:C,onInput:function(e){var t=y.find((function(t){var a;return t.value===(null===(a=n(e.target.value))||void 0===a?void 0:a.country)}));t&&F(t.value);var a=R(e.target.value);I(a),b(a?s(a):e.target.value)},placeholder:p,disabled:d}))})));export{m as PhoneNumberInput};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ikas/storefront",
|
|
3
|
-
"version": "6.1.0-beta.
|
|
3
|
+
"version": "6.1.0-beta.176",
|
|
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.
|
|
26
|
-
"@ikas/storefront-config": "^6.1.0-beta.
|
|
27
|
-
"@ikas/storefront-model-functions": "^6.1.0-beta.
|
|
28
|
-
"@ikas/storefront-models": "^6.1.0-beta.
|
|
29
|
-
"@ikas/storefront-providers": "^6.1.0-beta.
|
|
25
|
+
"@ikas/storefront-api": "^6.1.0-beta.176",
|
|
26
|
+
"@ikas/storefront-config": "^6.1.0-beta.176",
|
|
27
|
+
"@ikas/storefront-model-functions": "^6.1.0-beta.176",
|
|
28
|
+
"@ikas/storefront-models": "^6.1.0-beta.176",
|
|
29
|
+
"@ikas/storefront-providers": "^6.1.0-beta.176",
|
|
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.
|
|
65
|
-
"@ikas/storefront-config": "^6.1.0-beta.
|
|
66
|
-
"@ikas/storefront-model-functions": "^6.1.0-beta.
|
|
67
|
-
"@ikas/storefront-models": "^6.1.0-beta.
|
|
68
|
-
"@ikas/storefront-providers": "^6.1.0-beta.
|
|
64
|
+
"@ikas/storefront-api": "^6.1.0-beta.176",
|
|
65
|
+
"@ikas/storefront-config": "^6.1.0-beta.176",
|
|
66
|
+
"@ikas/storefront-model-functions": "^6.1.0-beta.176",
|
|
67
|
+
"@ikas/storefront-models": "^6.1.0-beta.176",
|
|
68
|
+
"@ikas/storefront-providers": "^6.1.0-beta.176",
|
|
69
69
|
"mobx": "^6.1.3",
|
|
70
70
|
"mobx-react-lite": "^3.1.5",
|
|
71
71
|
"next": "12.2.0",
|