mainstack-design-system 1.3.8 → 1.3.9
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.
- package/dist/mainstack-design-system435.cjs +1 -1
- package/dist/mainstack-design-system435.js +25 -25
- package/dist/mainstack-design-system442.cjs +1 -1
- package/dist/mainstack-design-system442.js +21 -21
- package/dist/mainstack-design-system444.cjs +1 -1
- package/dist/mainstack-design-system444.js +25 -25
- package/dist/mainstack-design-system592.cjs +1 -1
- package/dist/mainstack-design-system592.js +90 -86
- package/package.json +1 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),
|
|
2
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),m=require("react"),d=require("./index-4R9KShCu.cjs"),b=require("./mainstack-design-system566.cjs"),p=require("./mainstack-design-system567.cjs"),r=m.forwardRef(({disabled:o,...n},t)=>{const{isOptionOpen:i,onOptionOpenChange:s,activeCountry:u,isDisabled:l,isError:c,isSuccess:a}=b.usePhoneNumberContext();return e.jsx(d.PopoverTrigger,{asChild:!0,children:e.jsx(p.FormCountrySelect,{...n,"data-slot":"phone-number-flag-field",disabled:o||l,isOptionOpen:i,onOptionOpenChange:s,activeCountry:u,isError:c,isSuccess:a,ref:t})})});r.displayName="PhoneNumberFlagField";exports.PhoneNumberFlagField=r;
|
|
@@ -1,36 +1,36 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx as e } from "react/jsx-runtime";
|
|
3
|
-
import { forwardRef as
|
|
4
|
-
import { a as
|
|
5
|
-
import { usePhoneNumberContext as
|
|
6
|
-
import { FormCountrySelect as
|
|
7
|
-
const
|
|
8
|
-
({
|
|
3
|
+
import { forwardRef as p } from "react";
|
|
4
|
+
import { a as d } from "./index-RoCFhqzC.js";
|
|
5
|
+
import { usePhoneNumberContext as u } from "./mainstack-design-system566.js";
|
|
6
|
+
import { FormCountrySelect as f } from "./mainstack-design-system567.js";
|
|
7
|
+
const c = p(
|
|
8
|
+
({ disabled: r, ...o }, i) => {
|
|
9
9
|
const {
|
|
10
|
-
isOptionOpen:
|
|
11
|
-
onOptionOpenChange:
|
|
12
|
-
activeCountry:
|
|
13
|
-
isDisabled:
|
|
14
|
-
isError:
|
|
15
|
-
isSuccess:
|
|
16
|
-
} =
|
|
17
|
-
return /* @__PURE__ */ e(
|
|
18
|
-
|
|
10
|
+
isOptionOpen: t,
|
|
11
|
+
onOptionOpenChange: n,
|
|
12
|
+
activeCountry: m,
|
|
13
|
+
isDisabled: s,
|
|
14
|
+
isError: a,
|
|
15
|
+
isSuccess: l
|
|
16
|
+
} = u();
|
|
17
|
+
return /* @__PURE__ */ e(d, { asChild: !0, children: /* @__PURE__ */ e(
|
|
18
|
+
f,
|
|
19
19
|
{
|
|
20
|
-
...
|
|
20
|
+
...o,
|
|
21
21
|
"data-slot": "phone-number-flag-field",
|
|
22
|
-
disabled:
|
|
23
|
-
isOptionOpen:
|
|
24
|
-
onOptionOpenChange:
|
|
25
|
-
activeCountry:
|
|
26
|
-
isError:
|
|
27
|
-
isSuccess:
|
|
28
|
-
ref:
|
|
22
|
+
disabled: r || s,
|
|
23
|
+
isOptionOpen: t,
|
|
24
|
+
onOptionOpenChange: n,
|
|
25
|
+
activeCountry: m,
|
|
26
|
+
isError: a,
|
|
27
|
+
isSuccess: l,
|
|
28
|
+
ref: i
|
|
29
29
|
}
|
|
30
30
|
) });
|
|
31
31
|
}
|
|
32
32
|
);
|
|
33
|
-
|
|
33
|
+
c.displayName = "PhoneNumberFlagField";
|
|
34
34
|
export {
|
|
35
|
-
|
|
35
|
+
c as PhoneNumberFlagField
|
|
36
36
|
};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),
|
|
2
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),g=require("react"),m=require("./mainstack-design-system431.cjs"),F=require("./mainstack-design-system432.cjs");require("./mainstack-design-system430.cjs");const e=require("./utils-DRUMSl4z.cjs"),C=require("./mainstack-design-system571.cjs"),P=require("./mainstack-design-system560.cjs"),c=g.forwardRef(({placeholder:a="0.00",disabled:l,...s},u)=>{const{activeCountry:i,isDisabled:d,value:_,onValueChange:r}=C.usePriceFieldContext(),p=P.COUNTRIES_ISO2_CODE_TO_CURRENCY_CODE_MAP[i];return t.jsxs(m.InputRoot,{"data-slot":"price-field-digit-field",className:" has-disabled:opacity-50",children:[t.jsx("p",{className:e.cn("body-extrasmall-book"),children:p??""}),t.jsx(F.InputField,{...s,disabled:l||d,placeholder:a,value:e.formatPriceDigit(e.sanitizePriceInputValue(_)),onChange:n=>{const o=e.getPriceDigitMetadataValueObject({value:n.target.value,activeCountry:i});r&&(n.target.value=o.digit,r(o))},ref:u})]})});c.displayName="PriceFieldDigitField";exports.PriceFieldDigitField=c;
|
|
@@ -1,37 +1,37 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import { jsxs as
|
|
3
|
-
import { forwardRef as
|
|
4
|
-
import { InputRoot as
|
|
5
|
-
import { InputField as
|
|
2
|
+
import { jsxs as p, jsx as r } from "react/jsx-runtime";
|
|
3
|
+
import { forwardRef as u } from "react";
|
|
4
|
+
import { InputRoot as f } from "./mainstack-design-system431.js";
|
|
5
|
+
import { InputField as g } from "./mainstack-design-system432.js";
|
|
6
6
|
import "./mainstack-design-system430.js";
|
|
7
|
-
import { c as
|
|
8
|
-
import { usePriceFieldContext as
|
|
9
|
-
import { COUNTRIES_ISO2_CODE_TO_CURRENCY_CODE_MAP as
|
|
10
|
-
const
|
|
11
|
-
({ placeholder: o = "0.00",
|
|
12
|
-
const { activeCountry: e, isDisabled:
|
|
13
|
-
return /* @__PURE__ */
|
|
14
|
-
|
|
7
|
+
import { c as C, f as _, e as b, b as v } from "./utils-CFdAYIby.js";
|
|
8
|
+
import { usePriceFieldContext as D } from "./mainstack-design-system571.js";
|
|
9
|
+
import { COUNTRIES_ISO2_CODE_TO_CURRENCY_CODE_MAP as P } from "./mainstack-design-system560.js";
|
|
10
|
+
const y = u(
|
|
11
|
+
({ placeholder: o = "0.00", disabled: l, ...c }, d) => {
|
|
12
|
+
const { activeCountry: e, isDisabled: s, value: m, onValueChange: i } = D(), n = P[e];
|
|
13
|
+
return /* @__PURE__ */ p(
|
|
14
|
+
f,
|
|
15
15
|
{
|
|
16
16
|
"data-slot": "price-field-digit-field",
|
|
17
17
|
className: " has-disabled:opacity-50",
|
|
18
18
|
children: [
|
|
19
|
-
/* @__PURE__ */ r("p", { className:
|
|
19
|
+
/* @__PURE__ */ r("p", { className: C("body-extrasmall-book"), children: n ?? "" }),
|
|
20
20
|
/* @__PURE__ */ r(
|
|
21
|
-
|
|
21
|
+
g,
|
|
22
22
|
{
|
|
23
|
-
...
|
|
24
|
-
disabled:
|
|
23
|
+
...c,
|
|
24
|
+
disabled: l || s,
|
|
25
25
|
placeholder: o,
|
|
26
|
-
value:
|
|
26
|
+
value: _(v(m)),
|
|
27
27
|
onChange: (t) => {
|
|
28
|
-
const a =
|
|
28
|
+
const a = b({
|
|
29
29
|
value: t.target.value,
|
|
30
30
|
activeCountry: e
|
|
31
31
|
});
|
|
32
32
|
i && (t.target.value = a.digit, i(a));
|
|
33
33
|
},
|
|
34
|
-
ref:
|
|
34
|
+
ref: d
|
|
35
35
|
}
|
|
36
36
|
)
|
|
37
37
|
]
|
|
@@ -39,7 +39,7 @@ const P = p(
|
|
|
39
39
|
);
|
|
40
40
|
}
|
|
41
41
|
);
|
|
42
|
-
|
|
42
|
+
y.displayName = "PriceFieldDigitField";
|
|
43
43
|
export {
|
|
44
|
-
|
|
44
|
+
y as PriceFieldDigitField
|
|
45
45
|
};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),
|
|
2
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),u=require("react"),F=require("./index-4R9KShCu.cjs"),p=require("./mainstack-design-system571.cjs"),g=require("./mainstack-design-system567.cjs"),i=u.forwardRef(({disabled:r,...t},o)=>{const{isOptionOpen:n,onOptionOpenChange:l,activeCountry:c,isDisabled:s,isError:d,isSuccess:a}=p.usePriceFieldContext();return e.jsx(F.PopoverTrigger,{asChild:!0,children:e.jsx(g.FormCountrySelect,{...t,"data-slot":"price-field-flag-field",disabled:r||s,isOptionOpen:n,onOptionOpenChange:l,activeCountry:c,isError:d,isSuccess:a,ref:o})})});i.displayName="PriceFieldFlagField";exports.PriceFieldFlagField=i;
|
|
@@ -1,36 +1,36 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx as e } from "react/jsx-runtime";
|
|
3
|
-
import { forwardRef as
|
|
4
|
-
import { a as
|
|
5
|
-
import { usePriceFieldContext as
|
|
6
|
-
import { FormCountrySelect as
|
|
7
|
-
const
|
|
8
|
-
({
|
|
3
|
+
import { forwardRef as p } from "react";
|
|
4
|
+
import { a as m } from "./index-RoCFhqzC.js";
|
|
5
|
+
import { usePriceFieldContext as c } from "./mainstack-design-system571.js";
|
|
6
|
+
import { FormCountrySelect as f } from "./mainstack-design-system567.js";
|
|
7
|
+
const F = p(
|
|
8
|
+
({ disabled: r, ...i }, o) => {
|
|
9
9
|
const {
|
|
10
|
-
isOptionOpen:
|
|
11
|
-
onOptionOpenChange:
|
|
12
|
-
activeCountry:
|
|
13
|
-
isDisabled:
|
|
14
|
-
isError:
|
|
15
|
-
isSuccess:
|
|
16
|
-
} =
|
|
17
|
-
return /* @__PURE__ */ e(
|
|
18
|
-
|
|
10
|
+
isOptionOpen: t,
|
|
11
|
+
onOptionOpenChange: l,
|
|
12
|
+
activeCountry: s,
|
|
13
|
+
isDisabled: a,
|
|
14
|
+
isError: d,
|
|
15
|
+
isSuccess: n
|
|
16
|
+
} = c();
|
|
17
|
+
return /* @__PURE__ */ e(m, { asChild: !0, children: /* @__PURE__ */ e(
|
|
18
|
+
f,
|
|
19
19
|
{
|
|
20
|
-
...
|
|
20
|
+
...i,
|
|
21
21
|
"data-slot": "price-field-flag-field",
|
|
22
|
-
disabled:
|
|
23
|
-
isOptionOpen:
|
|
24
|
-
onOptionOpenChange:
|
|
25
|
-
activeCountry:
|
|
26
|
-
isError:
|
|
27
|
-
isSuccess:
|
|
28
|
-
ref:
|
|
22
|
+
disabled: r || a,
|
|
23
|
+
isOptionOpen: t,
|
|
24
|
+
onOptionOpenChange: l,
|
|
25
|
+
activeCountry: s,
|
|
26
|
+
isError: d,
|
|
27
|
+
isSuccess: n,
|
|
28
|
+
ref: o
|
|
29
29
|
}
|
|
30
30
|
) });
|
|
31
31
|
}
|
|
32
32
|
);
|
|
33
|
-
|
|
33
|
+
F.displayName = "PriceFieldFlagField";
|
|
34
34
|
export {
|
|
35
|
-
|
|
35
|
+
F as PriceFieldFlagField
|
|
36
36
|
};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const R=require("react/jsx-runtime"),f=require("react"),tt=require("./mainstack-design-system431.cjs"),et=require("./mainstack-design-system432.cjs");require("./mainstack-design-system430.cjs");const u=require("./index-C7rXc8w3.cjs"),q=require("./utils-DRUMSl4z.cjs"),nt=require("./mainstack-design-system566.cjs");function T(t,n){return ut(t)||at(t,n)||ot(t,n)||rt()}function rt(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
3
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function ot(t,n){if(t){if(typeof t=="string")return M(t,n);var e=Object.prototype.toString.call(t).slice(8,-1);if(e==="Object"&&t.constructor&&(e=t.constructor.name),e==="Map"||e==="Set")return Array.from(t);if(e==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e))return M(t,n)}}function M(t,n){(n==null||n>t.length)&&(n=t.length);for(var e=0,
|
|
3
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function ot(t,n){if(t){if(typeof t=="string")return M(t,n);var e=Object.prototype.toString.call(t).slice(8,-1);if(e==="Object"&&t.constructor&&(e=t.constructor.name),e==="Map"||e==="Set")return Array.from(t);if(e==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e))return M(t,n)}}function M(t,n){(n==null||n>t.length)&&(n=t.length);for(var e=0,o=new Array(n);e<n;e++)o[e]=t[e];return o}function at(t,n){var e=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(e!=null){var o,r,a,c,p=[],y=!0,i=!1;try{if(a=(e=e.call(t)).next,n!==0)for(;!(y=(o=a.call(e)).done)&&(p.push(o.value),p.length!==n);y=!0);}catch(s){i=!0,r=s}finally{try{if(!y&&e.return!=null&&(c=e.return(),Object(c)!==c))return}finally{if(i)throw r}}return p}}function ut(t){if(Array.isArray(t))return t}function it(t){var n=this,e=t.value,o=t.onChange,r=t.country,a=t.defaultCountry,c=t.international,p=t.withCountryCallingCode,y=t.useNationalFormatForDefaultCountryValue,i=t.metadata;typeof p=="boolean"&&!(r&&c)&&console.error("[react-phone-number-input] `withCountryCallingCode` property can only be used together with `country` and `international` properties"),r&&a&&console.error("[react-phone-number-input] When `country` property is passed, `defaultCountry` property has no effect and therefore shouldn't be passed"),typeof c=="boolean"&&!r&&console.error("[react-phone-number-input] `international` property can only be used together with `country` property");var s=st({international:c,country:r,defaultCountry:a,withCountryCallingCode:p}),m=f.useRef(),b=function(d,C,v){console.error("[react-phone-number-input] Expected phone number ".concat(d," to correspond to country ").concat(C," but ").concat(v?"in reality it corresponds to country "+v:"it doesn't",".")),m.current=!0},g=function(d){return e&&u.validateE164Number(e),lt(e,r,a,s,y,i,function(){d&&d.onCountryMismatch&&d.onCountryMismatch();for(var C=arguments.length,v=new Array(C),O=0;O<C;O++)v[O]=arguments[O];b.apply(n,v)})},w=f.useState(r),I=T(w,2),F=I[0],B=I[1],H=f.useState(a),E=T(H,2),z=E[0],G=E[1],J=f.useState(g()),_=T(J,2),K=_[0],h=_[1],Q=f.useState(e),L=T(Q,2),A=L[0],N=L[1],X=f.useState(),x=T(X,2);x[0];var $=x[1],D=f.useCallback(function(){return $({})},[$]);function V(l){if(l){s==="NATIONAL_PART_OF_INTERNATIONAL"&&(l="+".concat(u.getCountryCallingCode$1(r,i)).concat(l));var d=new u.AsYouType(r||a,i);return d.input(l),d.getNumberValue()}}f.useEffect(function(){e!==A&&(N(e),h(g()))},[e]),f.useEffect(function(){if(r!==F){B(r);var l,d=g({onCountryMismatch:function(){l=!0}});h(d),l&&N(V(d))}},[r]),f.useEffect(function(){a!==z&&(G(a),h(g()))},[a]),f.useEffect(function(){A!==e&&o(A)},[A]);var Z=f.useCallback(function(l){var d;if(r)if(s==="INTERNATIONAL"){var C=u.getInternationalPhoneNumberPrefix(r,i);if(l.indexOf(C)!==0){if(l&&l[0]!=="+")l=C+l;else if(!m.current)return h(C),N(void 0),D()}}else l&&l[0]==="+"&&(l=l.slice(1));else a||l&&l[0]!=="+"&&(l="+"+l);l&&(d=V(l)),h(l),N(d)},[r,s,a,i,h,N,D,m]);return{phoneDigits:K,setPhoneDigits:Z,inputFormat:s}}function lt(t,n,e,o,r,a,c){if(n&&o==="INTERNATIONAL"){var p=u.getInternationalPhoneNumberPrefix(n,a);return t?(t.indexOf(p)!==0&&c(t,n),t):p}if(!t)return"";if(!n&&!e)return t;var y=new u.AsYouType(void 0,a);y.input(t);var i=y.getNumber();if(i)if(n)switch(i.country&&i.country!==n?c(t,n,i.country):i.countryCallingCode!==u.getCountryCallingCode$1(n,a)&&c(t,n),o){case"NATIONAL":return u.parseDigits(i.formatNational());case"NATIONAL_PART_OF_INTERNATIONAL":return u.parseDigits(u.removePrefixFromFormattedPhoneNumber(i.formatInternational(),u.getInternationalPhoneNumberPrefix(n,a)));case"INTERNATIONAL":throw new Error('`inputFormat: "INTERNATIONAL"` case should\'ve already been handled earlier in the code');case"INTERNATIONAL_OR_NATIONAL":throw new Error('`inputFormat: "INTERNATIONAL_OR_NATIONAL"` is not possible when `country` is fixed');default:throw new Error("Unknown `inputFormat`: ".concat(o))}else return i.countryCallingCode&&i.countryCallingCode===u.getCountryCallingCode$1(e,a)&&r?u.parseDigits(i.formatNational()):t;else return""}function st(t){var n=t.international,e=t.country,o=t.defaultCountry,r=t.withCountryCallingCode;return e?n?r?"INTERNATIONAL":"NATIONAL_PART_OF_INTERNATIONAL":"NATIONAL":o?"INTERNATIONAL_OR_NATIONAL":"INTERNATIONAL"}var ct=["Component","country","defaultCountry","useNationalFormatForDefaultCountryValue","value","onChange","metadata","international","withCountryCallingCode"];function j(){return j=Object.assign?Object.assign.bind():function(t){for(var n=1;n<arguments.length;n++){var e=arguments[n];for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o])}return t},j.apply(this,arguments)}function ft(t,n){if(t==null)return{};var e=pt(t,n),o,r;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);for(r=0;r<a.length;r++)o=a[r],!(n.indexOf(o)>=0)&&Object.prototype.propertyIsEnumerable.call(t,o)&&(e[o]=t[o])}return e}function pt(t,n){if(t==null)return{};var e={},o=Object.keys(t),r,a;for(a=0;a<o.length;a++)r=o[a],!(n.indexOf(r)>=0)&&(e[r]=t[r]);return e}function P(t,n){var e=t.Component,o=t.country,r=t.defaultCountry,a=t.useNationalFormatForDefaultCountryValue,c=a===void 0?!0:a,p=t.value,y=t.onChange,i=t.metadata,s=t.international,m=t.withCountryCallingCode,b=ft(t,ct),g=it({value:p,onChange:y,country:o,defaultCountry:r,international:s,withCountryCallingCode:m,useNationalFormatForDefaultCountryValue:c,metadata:i}),w=g.phoneDigits,I=g.setPhoneDigits,F=g.inputFormat;return f.createElement(e,j({},b,{ref:n,metadata:i,inputFormat:F,international:s,withCountryCallingCode:m,country:o||r,value:w,onChange:I}))}P=f.forwardRef(P);P.propTypes={value:u.PropTypes.string,onChange:u.PropTypes.func.isRequired,country:u.PropTypes.string,defaultCountry:u.PropTypes.string,international:u.PropTypes.bool,withCountryCallingCode:u.PropTypes.bool,Component:u.PropTypes.elementType.isRequired,useNationalFormatForDefaultCountryValue:u.PropTypes.bool,metadata:u.metadata};var yt=["type","autoComplete","smartCaret","metadata"];function S(){return S=Object.assign?Object.assign.bind():function(t){for(var n=1;n<arguments.length;n++){var e=arguments[n];for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o])}return t},S.apply(this,arguments)}function dt(t,n){if(t==null)return{};var e=Ct(t,n),o,r;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);for(r=0;r<a.length;r++)o=a[r],!(n.indexOf(o)>=0)&&Object.prototype.propertyIsEnumerable.call(t,o)&&(e[o]=t[o])}return e}function Ct(t,n){if(t==null)return{};var e={},o=Object.keys(t),r,a;for(a=0;a<o.length;a++)r=o[a],!(n.indexOf(r)>=0)&&(e[r]=t[r]);return e}function k(t){function n(e,o){var r=e.type,a=r===void 0?"tel":r,c=e.autoComplete,p=c===void 0?"tel":c,y=e.smartCaret,i=y===void 0?!0:y,s=e.metadata,m=s===void 0?t:s,b=dt(e,yt);return f.createElement(P,S({},b,{type:a,autoComplete:p,metadata:m,ref:o,Component:i?u.InputSmart:u.InputBasic}))}return n=f.forwardRef(n),n.propTypes={type:u.PropTypes.string,autoComplete:u.PropTypes.string,smartCaret:u.PropTypes.bool,metadata:u.PropTypes.object},n}k();function Y(t,n){var e=Array.prototype.slice.call(n);return e.push(u.metadata$1),t.apply(this,e)}k(u.metadata$1);function W(){return Y(u.getCountryCallingCode$1,arguments)}function mt(){return Y(u.isSupportedCountry$1,arguments)}const U=f.forwardRef(({placeholder:t="000 - 000 - 000",disabled:n,...e},o)=>{const{activeCountry:r,isDisabled:a,value:c,onValueChange:p}=nt.usePhoneNumberContext(),y=i=>{if(!i)return"";let s="";return r&&mt(r)&&(s=W(r)),i.replace(`+${s}`,"")};return R.jsxs(tt.InputRoot,{"data-slot":"phone-number-digit-field",className:" has-disabled:opacity-50",children:[R.jsxs("p",{className:q.cn("body-extrasmall-book"),children:["(+",W(r||"US"),")"]}),R.jsx(et.InputField,{...e,disabled:n||a,placeholder:t,value:y(c),onChange:i=>{const s=q.getPhoneNumberDigitMetadataValueObject({value:i.target.value,activeCountry:r});p&&(i.target.value=s.digit,p(s))},ref:o})]})});U.displayName="PhoneNumberDigitField";exports.PhoneNumberDigitField=U;
|
|
@@ -24,22 +24,22 @@ function vt(t, n) {
|
|
|
24
24
|
}
|
|
25
25
|
function B(t, n) {
|
|
26
26
|
(n == null || n > t.length) && (n = t.length);
|
|
27
|
-
for (var e = 0,
|
|
28
|
-
return
|
|
27
|
+
for (var e = 0, a = new Array(n); e < n; e++) a[e] = t[e];
|
|
28
|
+
return a;
|
|
29
29
|
}
|
|
30
30
|
function At(t, n) {
|
|
31
31
|
var e = t == null ? null : typeof Symbol < "u" && t[Symbol.iterator] || t["@@iterator"];
|
|
32
32
|
if (e != null) {
|
|
33
|
-
var
|
|
33
|
+
var a, r, o, s, f = [], c = !0, i = !1;
|
|
34
34
|
try {
|
|
35
|
-
if (o = (e = e.call(t)).next, n !== 0) for (; !(
|
|
36
|
-
} catch (
|
|
37
|
-
i = !0,
|
|
35
|
+
if (o = (e = e.call(t)).next, n !== 0) for (; !(c = (a = o.call(e)).done) && (f.push(a.value), f.length !== n); c = !0) ;
|
|
36
|
+
} catch (l) {
|
|
37
|
+
i = !0, r = l;
|
|
38
38
|
} finally {
|
|
39
39
|
try {
|
|
40
|
-
if (!
|
|
40
|
+
if (!c && e.return != null && (s = e.return(), Object(s) !== s)) return;
|
|
41
41
|
} finally {
|
|
42
|
-
if (i) throw
|
|
42
|
+
if (i) throw r;
|
|
43
43
|
}
|
|
44
44
|
}
|
|
45
45
|
return f;
|
|
@@ -49,56 +49,56 @@ function Ot(t) {
|
|
|
49
49
|
if (Array.isArray(t)) return t;
|
|
50
50
|
}
|
|
51
51
|
function It(t) {
|
|
52
|
-
var n = this, e = t.value,
|
|
53
|
-
typeof f == "boolean" && !(
|
|
54
|
-
var
|
|
55
|
-
international:
|
|
56
|
-
country:
|
|
52
|
+
var n = this, e = t.value, a = t.onChange, r = t.country, o = t.defaultCountry, s = t.international, f = t.withCountryCallingCode, c = t.useNationalFormatForDefaultCountryValue, i = t.metadata;
|
|
53
|
+
typeof f == "boolean" && !(r && s) && console.error("[react-phone-number-input] `withCountryCallingCode` property can only be used together with `country` and `international` properties"), r && o && console.error("[react-phone-number-input] When `country` property is passed, `defaultCountry` property has no effect and therefore shouldn't be passed"), typeof s == "boolean" && !r && console.error("[react-phone-number-input] `international` property can only be used together with `country` property");
|
|
54
|
+
var l = Pt({
|
|
55
|
+
international: s,
|
|
56
|
+
country: r,
|
|
57
57
|
defaultCountry: o,
|
|
58
58
|
withCountryCallingCode: f
|
|
59
|
-
}), m = ut(), h = function(
|
|
60
|
-
console.error("[react-phone-number-input] Expected phone number ".concat(
|
|
61
|
-
}, C = function(
|
|
62
|
-
return e && ct(e), Tt(e,
|
|
63
|
-
|
|
59
|
+
}), m = ut(), h = function(y, d, b) {
|
|
60
|
+
console.error("[react-phone-number-input] Expected phone number ".concat(y, " to correspond to country ").concat(d, " but ").concat(b ? "in reality it corresponds to country " + b : "it doesn't", ".")), m.current = !0;
|
|
61
|
+
}, C = function(y) {
|
|
62
|
+
return e && ct(e), Tt(e, r, o, l, c, i, function() {
|
|
63
|
+
y && y.onCountryMismatch && y.onCountryMismatch();
|
|
64
64
|
for (var d = arguments.length, b = new Array(d), T = 0; T < d; T++)
|
|
65
65
|
b[T] = arguments[T];
|
|
66
66
|
h.apply(n, b);
|
|
67
67
|
});
|
|
68
|
-
}, j = v(
|
|
68
|
+
}, j = v(r), O = A(j, 2), E = O[0], Q = O[1], X = v(o), $ = A(X, 2), Z = $[0], tt = $[1], et = v(C()), V = A(et, 2), nt = V[0], g = V[1], rt = v(e), D = A(rt, 2), I = D[0], N = D[1], at = v(), M = A(at, 2);
|
|
69
69
|
M[0];
|
|
70
70
|
var W = M[1], k = q(function() {
|
|
71
71
|
return W({});
|
|
72
72
|
}, [W]);
|
|
73
73
|
function U(u) {
|
|
74
74
|
if (u) {
|
|
75
|
-
|
|
76
|
-
var
|
|
77
|
-
return
|
|
75
|
+
l === "NATIONAL_PART_OF_INTERNATIONAL" && (u = "+".concat(F(r, i)).concat(u));
|
|
76
|
+
var y = new z(r || o, i);
|
|
77
|
+
return y.input(u), y.getNumberValue();
|
|
78
78
|
}
|
|
79
79
|
}
|
|
80
80
|
P(function() {
|
|
81
81
|
e !== I && (N(e), g(C()));
|
|
82
82
|
}, [e]), P(function() {
|
|
83
|
-
if (
|
|
84
|
-
Q(
|
|
85
|
-
var u,
|
|
83
|
+
if (r !== E) {
|
|
84
|
+
Q(r);
|
|
85
|
+
var u, y = C({
|
|
86
86
|
onCountryMismatch: function() {
|
|
87
87
|
u = !0;
|
|
88
88
|
}
|
|
89
89
|
});
|
|
90
|
-
g(
|
|
90
|
+
g(y), u && N(U(y));
|
|
91
91
|
}
|
|
92
|
-
}, [
|
|
92
|
+
}, [r]), P(function() {
|
|
93
93
|
o !== Z && (tt(o), g(C()));
|
|
94
94
|
}, [o]), P(function() {
|
|
95
|
-
I !== e &&
|
|
95
|
+
I !== e && a(I);
|
|
96
96
|
}, [I]);
|
|
97
97
|
var ot = q(function(u) {
|
|
98
|
-
var
|
|
99
|
-
if (
|
|
100
|
-
if (
|
|
101
|
-
var d = S(
|
|
98
|
+
var y;
|
|
99
|
+
if (r)
|
|
100
|
+
if (l === "INTERNATIONAL") {
|
|
101
|
+
var d = S(r, i);
|
|
102
102
|
if (u.indexOf(d) !== 0) {
|
|
103
103
|
if (u && u[0] !== "+")
|
|
104
104
|
u = d + u;
|
|
@@ -107,29 +107,29 @@ function It(t) {
|
|
|
107
107
|
} else
|
|
108
108
|
u && u[0] === "+" && (u = u.slice(1));
|
|
109
109
|
else o || u && u[0] !== "+" && (u = "+" + u);
|
|
110
|
-
u && (
|
|
111
|
-
}, [
|
|
110
|
+
u && (y = U(u)), g(u), N(y);
|
|
111
|
+
}, [r, l, o, i, g, N, k, m]);
|
|
112
112
|
return {
|
|
113
113
|
phoneDigits: nt,
|
|
114
114
|
setPhoneDigits: ot,
|
|
115
|
-
inputFormat:
|
|
115
|
+
inputFormat: l
|
|
116
116
|
};
|
|
117
117
|
}
|
|
118
|
-
function Tt(t, n, e,
|
|
119
|
-
if (n &&
|
|
118
|
+
function Tt(t, n, e, a, r, o, s) {
|
|
119
|
+
if (n && a === "INTERNATIONAL") {
|
|
120
120
|
var f = S(n, o);
|
|
121
|
-
return t ? (t.indexOf(f) !== 0 &&
|
|
121
|
+
return t ? (t.indexOf(f) !== 0 && s(t, n), t) : f;
|
|
122
122
|
}
|
|
123
123
|
if (!t)
|
|
124
124
|
return "";
|
|
125
125
|
if (!n && !e)
|
|
126
126
|
return t;
|
|
127
|
-
var
|
|
128
|
-
|
|
129
|
-
var i =
|
|
127
|
+
var c = new z(void 0, o);
|
|
128
|
+
c.input(t);
|
|
129
|
+
var i = c.getNumber();
|
|
130
130
|
if (i)
|
|
131
131
|
if (n)
|
|
132
|
-
switch (i.country && i.country !== n ?
|
|
132
|
+
switch (i.country && i.country !== n ? s(t, n, i.country) : i.countryCallingCode !== F(n, o) && s(t, n), a) {
|
|
133
133
|
case "NATIONAL":
|
|
134
134
|
return L(i.formatNational());
|
|
135
135
|
case "NATIONAL_PART_OF_INTERNATIONAL":
|
|
@@ -139,63 +139,63 @@ function Tt(t, n, e, r, a, o, l) {
|
|
|
139
139
|
case "INTERNATIONAL_OR_NATIONAL":
|
|
140
140
|
throw new Error('`inputFormat: "INTERNATIONAL_OR_NATIONAL"` is not possible when `country` is fixed');
|
|
141
141
|
default:
|
|
142
|
-
throw new Error("Unknown `inputFormat`: ".concat(
|
|
142
|
+
throw new Error("Unknown `inputFormat`: ".concat(a));
|
|
143
143
|
}
|
|
144
144
|
else
|
|
145
|
-
return i.countryCallingCode && i.countryCallingCode === F(e, o) &&
|
|
145
|
+
return i.countryCallingCode && i.countryCallingCode === F(e, o) && r ? L(i.formatNational()) : t;
|
|
146
146
|
else
|
|
147
147
|
return "";
|
|
148
148
|
}
|
|
149
149
|
function Pt(t) {
|
|
150
|
-
var n = t.international, e = t.country,
|
|
151
|
-
return e ? n ?
|
|
150
|
+
var n = t.international, e = t.country, a = t.defaultCountry, r = t.withCountryCallingCode;
|
|
151
|
+
return e ? n ? r ? "INTERNATIONAL" : "NATIONAL_PART_OF_INTERNATIONAL" : "NATIONAL" : a ? "INTERNATIONAL_OR_NATIONAL" : "INTERNATIONAL";
|
|
152
152
|
}
|
|
153
153
|
var wt = ["Component", "country", "defaultCountry", "useNationalFormatForDefaultCountryValue", "value", "onChange", "metadata", "international", "withCountryCallingCode"];
|
|
154
154
|
function _() {
|
|
155
155
|
return _ = Object.assign ? Object.assign.bind() : function(t) {
|
|
156
156
|
for (var n = 1; n < arguments.length; n++) {
|
|
157
157
|
var e = arguments[n];
|
|
158
|
-
for (var
|
|
159
|
-
Object.prototype.hasOwnProperty.call(e,
|
|
158
|
+
for (var a in e)
|
|
159
|
+
Object.prototype.hasOwnProperty.call(e, a) && (t[a] = e[a]);
|
|
160
160
|
}
|
|
161
161
|
return t;
|
|
162
162
|
}, _.apply(this, arguments);
|
|
163
163
|
}
|
|
164
164
|
function Ft(t, n) {
|
|
165
165
|
if (t == null) return {};
|
|
166
|
-
var e = Rt(t, n),
|
|
166
|
+
var e = Rt(t, n), a, r;
|
|
167
167
|
if (Object.getOwnPropertySymbols) {
|
|
168
168
|
var o = Object.getOwnPropertySymbols(t);
|
|
169
|
-
for (
|
|
170
|
-
|
|
169
|
+
for (r = 0; r < o.length; r++)
|
|
170
|
+
a = o[r], !(n.indexOf(a) >= 0) && Object.prototype.propertyIsEnumerable.call(t, a) && (e[a] = t[a]);
|
|
171
171
|
}
|
|
172
172
|
return e;
|
|
173
173
|
}
|
|
174
174
|
function Rt(t, n) {
|
|
175
175
|
if (t == null) return {};
|
|
176
|
-
var e = {},
|
|
177
|
-
for (o = 0; o <
|
|
178
|
-
|
|
176
|
+
var e = {}, a = Object.keys(t), r, o;
|
|
177
|
+
for (o = 0; o < a.length; o++)
|
|
178
|
+
r = a[o], !(n.indexOf(r) >= 0) && (e[r] = t[r]);
|
|
179
179
|
return e;
|
|
180
180
|
}
|
|
181
181
|
function R(t, n) {
|
|
182
|
-
var e = t.Component,
|
|
182
|
+
var e = t.Component, a = t.country, r = t.defaultCountry, o = t.useNationalFormatForDefaultCountryValue, s = o === void 0 ? !0 : o, f = t.value, c = t.onChange, i = t.metadata, l = t.international, m = t.withCountryCallingCode, h = Ft(t, wt), C = It({
|
|
183
183
|
value: f,
|
|
184
|
-
onChange:
|
|
185
|
-
country:
|
|
186
|
-
defaultCountry:
|
|
187
|
-
international:
|
|
184
|
+
onChange: c,
|
|
185
|
+
country: a,
|
|
186
|
+
defaultCountry: r,
|
|
187
|
+
international: l,
|
|
188
188
|
withCountryCallingCode: m,
|
|
189
|
-
useNationalFormatForDefaultCountryValue:
|
|
189
|
+
useNationalFormatForDefaultCountryValue: s,
|
|
190
190
|
metadata: i
|
|
191
191
|
}), j = C.phoneDigits, O = C.setPhoneDigits, E = C.inputFormat;
|
|
192
192
|
return /* @__PURE__ */ w.createElement(e, _({}, h, {
|
|
193
193
|
ref: n,
|
|
194
194
|
metadata: i,
|
|
195
195
|
inputFormat: E,
|
|
196
|
-
international:
|
|
196
|
+
international: l,
|
|
197
197
|
withCountryCallingCode: m,
|
|
198
|
-
country:
|
|
198
|
+
country: a || r,
|
|
199
199
|
value: j,
|
|
200
200
|
onChange: O
|
|
201
201
|
}));
|
|
@@ -273,37 +273,37 @@ function x() {
|
|
|
273
273
|
return x = Object.assign ? Object.assign.bind() : function(t) {
|
|
274
274
|
for (var n = 1; n < arguments.length; n++) {
|
|
275
275
|
var e = arguments[n];
|
|
276
|
-
for (var
|
|
277
|
-
Object.prototype.hasOwnProperty.call(e,
|
|
276
|
+
for (var a in e)
|
|
277
|
+
Object.prototype.hasOwnProperty.call(e, a) && (t[a] = e[a]);
|
|
278
278
|
}
|
|
279
279
|
return t;
|
|
280
280
|
}, x.apply(this, arguments);
|
|
281
281
|
}
|
|
282
282
|
function Et(t, n) {
|
|
283
283
|
if (t == null) return {};
|
|
284
|
-
var e = Lt(t, n),
|
|
284
|
+
var e = Lt(t, n), a, r;
|
|
285
285
|
if (Object.getOwnPropertySymbols) {
|
|
286
286
|
var o = Object.getOwnPropertySymbols(t);
|
|
287
|
-
for (
|
|
288
|
-
|
|
287
|
+
for (r = 0; r < o.length; r++)
|
|
288
|
+
a = o[r], !(n.indexOf(a) >= 0) && Object.prototype.propertyIsEnumerable.call(t, a) && (e[a] = t[a]);
|
|
289
289
|
}
|
|
290
290
|
return e;
|
|
291
291
|
}
|
|
292
292
|
function Lt(t, n) {
|
|
293
293
|
if (t == null) return {};
|
|
294
|
-
var e = {},
|
|
295
|
-
for (o = 0; o <
|
|
296
|
-
|
|
294
|
+
var e = {}, a = Object.keys(t), r, o;
|
|
295
|
+
for (o = 0; o < a.length; o++)
|
|
296
|
+
r = a[o], !(n.indexOf(r) >= 0) && (e[r] = t[r]);
|
|
297
297
|
return e;
|
|
298
298
|
}
|
|
299
299
|
function J(t) {
|
|
300
|
-
function n(e,
|
|
301
|
-
var
|
|
300
|
+
function n(e, a) {
|
|
301
|
+
var r = e.type, o = r === void 0 ? "tel" : r, s = e.autoComplete, f = s === void 0 ? "tel" : s, c = e.smartCaret, i = c === void 0 ? !0 : c, l = e.metadata, m = l === void 0 ? t : l, h = Et(e, jt);
|
|
302
302
|
return /* @__PURE__ */ w.createElement(R, x({}, h, {
|
|
303
303
|
type: o,
|
|
304
304
|
autoComplete: f,
|
|
305
305
|
metadata: m,
|
|
306
|
-
ref:
|
|
306
|
+
ref: a,
|
|
307
307
|
Component: i ? dt : mt
|
|
308
308
|
}));
|
|
309
309
|
}
|
|
@@ -344,11 +344,15 @@ function St() {
|
|
|
344
344
|
return K(Ct, arguments);
|
|
345
345
|
}
|
|
346
346
|
const _t = lt(
|
|
347
|
-
({
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
347
|
+
({
|
|
348
|
+
placeholder: t = "000 - 000 - 000",
|
|
349
|
+
disabled: n,
|
|
350
|
+
...e
|
|
351
|
+
}, a) => {
|
|
352
|
+
const { activeCountry: r, isDisabled: o, value: s, onValueChange: f } = Nt(), c = (i) => {
|
|
353
|
+
if (!i) return "";
|
|
354
|
+
let l = "";
|
|
355
|
+
return r && St(r) && (l = H(r)), i.replace(`+${l}`, "");
|
|
352
356
|
};
|
|
353
357
|
return /* @__PURE__ */ Y(
|
|
354
358
|
st,
|
|
@@ -364,18 +368,18 @@ const _t = lt(
|
|
|
364
368
|
/* @__PURE__ */ it(
|
|
365
369
|
ft,
|
|
366
370
|
{
|
|
367
|
-
...
|
|
368
|
-
disabled:
|
|
371
|
+
...e,
|
|
372
|
+
disabled: n || o,
|
|
369
373
|
placeholder: t,
|
|
370
|
-
value:
|
|
371
|
-
onChange: (
|
|
372
|
-
const
|
|
373
|
-
value:
|
|
374
|
+
value: c(s),
|
|
375
|
+
onChange: (i) => {
|
|
376
|
+
const l = ht({
|
|
377
|
+
value: i.target.value,
|
|
374
378
|
activeCountry: r
|
|
375
379
|
});
|
|
376
|
-
|
|
380
|
+
f && (i.target.value = l.digit, f(l));
|
|
377
381
|
},
|
|
378
|
-
ref:
|
|
382
|
+
ref: a
|
|
379
383
|
}
|
|
380
384
|
)
|
|
381
385
|
]
|