@verifiedinc-public/shared-ui-elements 12.8.4 → 12.9.0
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,11 +1,16 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { PrettyPhoneInputProps } from './PrettyPhoneInput';
|
|
2
|
+
export interface PhoneInputProps extends PrettyPhoneInputProps {
|
|
3
|
+
/**
|
|
4
|
+
* Whether to render the phone input in a pretty way (animated gradient border). Defaults to false.
|
|
5
|
+
*/
|
|
6
|
+
pretty?: boolean;
|
|
7
|
+
}
|
|
2
8
|
/**
|
|
3
9
|
* Renders a phone input component.
|
|
4
10
|
*
|
|
5
11
|
* @param props - The props for the phone input component.
|
|
6
12
|
* @param props.pretty - Whether to render the phone input in a pretty way.
|
|
13
|
+
* @param props.loading - Whether to show the loading indicator. Only the pretty variant renders one.
|
|
7
14
|
* @returns The phone input component.
|
|
8
15
|
*/
|
|
9
|
-
export declare function PhoneInput(props: Readonly<
|
|
10
|
-
pretty?: boolean;
|
|
11
|
-
}>): import("react").JSX.Element;
|
|
16
|
+
export declare function PhoneInput({ pretty, loading, ...props }: Readonly<PhoneInputProps>): React.JSX.Element;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";import{
|
|
1
|
+
"use strict";import{BasePhoneInput as e}from"./BasePhoneInput.mjs";import{PrettyPhoneInput as p}from"./PrettyPhoneInput.mjs";import{jsx as r}from"react/jsx-runtime";function a({pretty:t=!1,loading:n,...o}){return t?r(p,{...o,loading:n}):r(e,{...o})}export{a as PhoneInput};
|
|
@@ -1,2 +1,16 @@
|
|
|
1
1
|
import { BasePhoneInputProps } from './BasePhoneInput';
|
|
2
|
-
export
|
|
2
|
+
export interface PrettyPhoneInputProps extends BasePhoneInputProps {
|
|
3
|
+
/**
|
|
4
|
+
* Whether the input is waiting on something (e.g. a lookup triggered by the typed number).
|
|
5
|
+
* The beam lapping the border speeds up while true so it reads as a loading indicator. Defaults to false.
|
|
6
|
+
*/
|
|
7
|
+
loading?: boolean;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Renders the phone input wrapped in a gradient border with a beam of light lapping it at a constant
|
|
11
|
+
* speed: slowly while idle, quickly while loading.
|
|
12
|
+
*
|
|
13
|
+
* @param loading - Whether to show the loading indicator (the beam laps the border quickly). Defaults to false.
|
|
14
|
+
* @param props - Every other prop is forwarded to `BasePhoneInput`.
|
|
15
|
+
*/
|
|
16
|
+
export declare function PrettyPhoneInput({ loading, ...props }: Readonly<PrettyPhoneInputProps>): React.JSX.Element;
|
|
@@ -1,64 +1,32 @@
|
|
|
1
|
-
"use strict";import{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
50% {
|
|
34
|
-
background-size: 110% 110%;
|
|
35
|
-
}
|
|
36
|
-
100% {
|
|
37
|
-
background-size: 100% 100%;
|
|
38
|
-
}
|
|
39
|
-
`,s=n`
|
|
40
|
-
0% {
|
|
41
|
-
background-position: 0% 0%;
|
|
42
|
-
}
|
|
43
|
-
25% {
|
|
44
|
-
background-position: 100% 100%;
|
|
45
|
-
}
|
|
46
|
-
50% {
|
|
47
|
-
background-position: 100% 100%;
|
|
48
|
-
}
|
|
49
|
-
75% {
|
|
50
|
-
background-position: 100% 100%;
|
|
51
|
-
}
|
|
52
|
-
100% {
|
|
53
|
-
background-position: 0% 0%;
|
|
54
|
-
}
|
|
55
|
-
`;return a(p,{width:"100%",sx:{position:"relative",zIndex:0,"& label.MuiFormLabel-root":{background:i},"& .MuiOutlinedInput-root":{position:"relative",overflow:"hidden","&::before":{content:'""',position:"absolute",width:"calc(100% + 8px)",aspectRatio:1,left:-4,zIndex:-1,background:`conic-gradient(
|
|
56
|
-
from 45deg,
|
|
57
|
-
${e} 0deg,
|
|
58
|
-
${e} 60deg,
|
|
59
|
-
${r} 95deg,
|
|
60
|
-
rgba(255,255,255,1) 105deg,
|
|
61
|
-
${r} 115deg,
|
|
62
|
-
${e} 150deg,
|
|
63
|
-
${e} 360deg
|
|
64
|
-
)`,animation:`${d} 8s linear infinite, ${u} 3s linear infinite, ${s} 12s linear infinite`,backgroundOrigin:"border-box",backgroundPosition:"center",backgroundSize:"100% 100%"}},"& .MuiOutlinedInput-notchedOutline":{border:"none",zIndex:-1,m:.25,top:0,"&::before":{content:'""',position:"absolute",inset:0,backgroundColor:i,zIndex:-1},"& legend":{display:"none"}},"& .MuiOutlinedInput-root:hover .MuiOutlinedInput-notchedOutline":{border:"none"},"& .MuiOutlinedInput-root.Mui-focused .MuiOutlinedInput-notchedOutline":{border:"none"}},children:a(b,{...t})})}export{m as PrettyPhoneInput};
|
|
1
|
+
"use strict";import{useRef as v,useState as C,useEffect as g}from"react";import{useTheme as R,Box as T,keyframes as h}from"@mui/material";import{alpha as j,darken as B}from"../../utils/color/index.mjs";import{BasePhoneInput as E}from"./BasePhoneInput.mjs";import{jsx as y}from"react/jsx-runtime";const V=8,q=.8,m="--ppi-progress",O=160,I=36,w={start:-O/2,"start-shoulder":-I/2,core:0,"end-shoulder":I/2,end:O/2},A=h`
|
|
2
|
+
from {
|
|
3
|
+
${m}: 0;
|
|
4
|
+
}
|
|
5
|
+
to {
|
|
6
|
+
${m}: 1;
|
|
7
|
+
}
|
|
8
|
+
`,D=h`
|
|
9
|
+
from {
|
|
10
|
+
transform: rotate(0deg);
|
|
11
|
+
}
|
|
12
|
+
to {
|
|
13
|
+
transform: rotate(360deg);
|
|
14
|
+
}
|
|
15
|
+
`,x=new WeakSet;function F(e){const o=e.ownerDocument,n=o.defaultView;if(!n||typeof n.CSS>"u"||typeof n.CSS.registerProperty!="function")return!1;if(x.has(o))return!0;try{n.CSS.registerProperty({name:m,syntax:"<number>",inherits:!1,initialValue:"0"})}catch(t){if(t.name!=="InvalidModificationError")return!1}return x.add(o),!0}function L(e){const o=w[e],n=`var(--ppi-d-${e})`,t="var(--ppi-p)",d={[`--ppi-d-${e}`]:`calc(var(${m}) * ${t} ${o<0?"-":"+"} ${Math.abs(o)})`,[`--ppi-x-${e}`]:`clamp(-1 * var(--ppi-a), abs(mod(${n} + ${t} * 0.75, ${t}) - ${t} / 2) - ${t} / 4, var(--ppi-a))`,[`--ppi-y-${e}`]:`clamp(-1 * var(--ppi-b), ${t} / 4 - abs(mod(${n}, ${t}) - ${t} / 2), var(--ppi-b))`,[`--ppi-t-${e}`]:`atan2(var(--ppi-x-${e}), -1 * var(--ppi-y-${e}))`};return e!=="start"&&(d[`--ppi-s-${e}`]=`mod(var(--ppi-t-${e}) - var(--ppi-t-start), 360deg)`),d}const G={"--ppi-a":"calc(var(--ppi-w) / 2)","--ppi-b":"calc(var(--ppi-h) / 2)","--ppi-p":"calc(4 * (var(--ppi-a) + var(--ppi-b)))",...Object.assign({},...Object.keys(w).map(L))};function N({loading:e=!1,...o}){const n=R(),t=v(null),[d,S]=C(!1),a=e?q:V,$=v(a),i=o.error?n.palette.error.main:n.palette.primary.main,c=j(B(i,10),.4),b=n.palette.background.paper;g(()=>{const r=t.current;r&&S(F(r))},[]),g(()=>{const r=t.current,u=r?.querySelector(".MuiOutlinedInput-root"),p=r?.ownerDocument.defaultView;if(!r||!u||!p||typeof p.ResizeObserver>"u")return;const s=new p.ResizeObserver(()=>{const{width:l,height:f}=u.getBoundingClientRect();r.style.setProperty("--ppi-w",String(l)),r.style.setProperty("--ppi-h",String(f))});return s.observe(u),()=>{s.disconnect()}},[]),g(()=>{var r;const u=$.current;$.current=a;const p=(r=t.current)==null?void 0:r.querySelector(".MuiOutlinedInput-root");if(!(u===a||!p||typeof p.getAnimations!="function"))for(const s of p.getAnimations({subtree:!0})){const l=s.effect;if(l?.pseudoElement!=="::before"||typeof s.currentTime!="number")continue;const f=u*1e3,z=s.currentTime%f/f;s.currentTime=z*a*1e3}},[a]);const k=`conic-gradient(
|
|
16
|
+
from var(--ppi-t-start),
|
|
17
|
+
${i} 0deg,
|
|
18
|
+
${c} var(--ppi-s-start-shoulder),
|
|
19
|
+
rgba(255,255,255,1) var(--ppi-s-core),
|
|
20
|
+
${c} var(--ppi-s-end-shoulder),
|
|
21
|
+
${i} var(--ppi-s-end),
|
|
22
|
+
${i} 360deg
|
|
23
|
+
)`,M=`conic-gradient(
|
|
24
|
+
from 45deg,
|
|
25
|
+
${i} 0deg,
|
|
26
|
+
${i} 60deg,
|
|
27
|
+
${c} 95deg,
|
|
28
|
+
rgba(255,255,255,1) 105deg,
|
|
29
|
+
${c} 115deg,
|
|
30
|
+
${i} 150deg,
|
|
31
|
+
${i} 360deg
|
|
32
|
+
)`,P=d?{...G,background:k,animation:`${A} ${a}s linear infinite`}:{background:M,animation:`${D} ${a}s linear infinite`};return y(T,{ref:t,width:"100%","aria-busy":e||void 0,sx:{position:"relative",zIndex:0,"--ppi-w":"320","--ppi-h":"56","& label.MuiFormLabel-root":{background:b},"& .MuiOutlinedInput-root":{position:"relative",overflow:"hidden","&::before":{content:'""',position:"absolute",width:"calc(100% + 8px)",aspectRatio:1,left:-4,zIndex:-1,backgroundOrigin:"border-box",backgroundPosition:"center",backgroundSize:"100% 100%",...P}},"& .MuiOutlinedInput-notchedOutline":{border:"none",zIndex:-1,m:.25,top:0,"&::before":{content:'""',position:"absolute",inset:0,backgroundColor:b,zIndex:-1},"& legend":{display:"none"}},"& .MuiOutlinedInput-root:hover .MuiOutlinedInput-notchedOutline":{border:"none"},"& .MuiOutlinedInput-root.Mui-focused .MuiOutlinedInput-notchedOutline":{border:"none"}},children:y(E,{...o})})}export{N as PrettyPhoneInput};
|