m3-ripple 1.0.0 → 1.0.1
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/CHANGELOG.md +11 -0
- package/dist/index.cjs.js +1 -22
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +143 -416
- package/dist/ripple.css +7 -51
- package/package.json +3 -1
- package/bunfig.toml +0 -2
- package/dist/demo.d.ts +0 -9
- package/dist/demo.d.ts.map +0 -1
package/CHANGELOG.md
ADDED
package/dist/index.cjs.js
CHANGED
|
@@ -1,22 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
2
|
-
* @license React
|
|
3
|
-
* react-jsx-runtime.production.js
|
|
4
|
-
*
|
|
5
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
6
|
-
*
|
|
7
|
-
* This source code is licensed under the MIT license found in the
|
|
8
|
-
* LICENSE file in the root directory of this source tree.
|
|
9
|
-
*/var Q;function te(){if(Q)return D;Q=1;var b=Symbol.for("react.transitional.element"),h=Symbol.for("react.fragment");function u(S,i,f){var C=null;if(f!==void 0&&(C=""+f),i.key!==void 0&&(C=""+i.key),"key"in i){f={};for(var _ in i)_!=="key"&&(f[_]=i[_])}else f=i;return i=f.ref,{$$typeof:b,type:S,key:C,ref:i!==void 0?i:null,props:f}}return D.Fragment=h,D.jsx=u,D.jsxs=u,D}var F={};/**
|
|
10
|
-
* @license React
|
|
11
|
-
* react-jsx-runtime.development.js
|
|
12
|
-
*
|
|
13
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
14
|
-
*
|
|
15
|
-
* This source code is licensed under the MIT license found in the
|
|
16
|
-
* LICENSE file in the root directory of this source tree.
|
|
17
|
-
*/var K;function ne(){return K||(K=1,process.env.NODE_ENV!=="production"&&function(){function b(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===B?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case k:return"Fragment";case N:return"Profiler";case U:return"StrictMode";case I:return"Suspense";case g:return"SuspenseList";case H:return"Activity"}if(typeof e=="object")switch(typeof e.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),e.$$typeof){case y:return"Portal";case l:return(e.displayName||"Context")+".Provider";case w:return(e._context.displayName||"Context")+".Consumer";case x:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case E:return t=e.displayName||null,t!==null?t:b(e.type)||"Memo";case $:t=e._payload,e=e._init;try{return b(e(t))}catch{}}return null}function h(e){return""+e}function u(e){try{h(e);var t=!1}catch{t=!0}if(t){t=console;var r=t.error,n=typeof Symbol=="function"&&Symbol.toStringTag&&e[Symbol.toStringTag]||e.constructor.name||"Object";return r.call(t,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",n),h(e)}}function S(e){if(e===k)return"<>";if(typeof e=="object"&&e!==null&&e.$$typeof===$)return"<...>";try{var t=b(e);return t?"<"+t+">":"<...>"}catch{return"<...>"}}function i(){var e=O.A;return e===null?null:e.getOwner()}function f(){return Error("react-stack-top-frame")}function C(e){if(M.call(e,"key")){var t=Object.getOwnPropertyDescriptor(e,"key").get;if(t&&t.isReactWarning)return!1}return e.key!==void 0}function _(e,t){function r(){W||(W=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",t))}r.isReactWarning=!0,Object.defineProperty(e,"key",{get:r,configurable:!0})}function L(){var e=b(this.type);return q[e]||(q[e]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),e=this.props.ref,e!==void 0?e:null}function z(e,t,r,n,c,a,m,R){return r=a.ref,e={$$typeof:p,type:e,key:t,props:a,_owner:c},(r!==void 0?r:null)!==null?Object.defineProperty(e,"ref",{enumerable:!1,get:L}):Object.defineProperty(e,"ref",{enumerable:!1,value:null}),e._store={},Object.defineProperty(e._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(e,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(e,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:m}),Object.defineProperty(e,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:R}),Object.freeze&&(Object.freeze(e.props),Object.freeze(e)),e}function A(e,t,r,n,c,a,m,R){var s=t.children;if(s!==void 0)if(n)if(P(s)){for(n=0;n<s.length;n++)j(s[n]);Object.freeze&&Object.freeze(s)}else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else j(s);if(M.call(t,"key")){s=b(e);var T=Object.keys(t).filter(function(Z){return Z!=="key"});n=0<T.length?"{key: someKey, "+T.join(": ..., ")+": ...}":"{key: someKey}",X[s+n]||(T=0<T.length?"{"+T.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
|
|
18
|
-
let props = %s;
|
|
19
|
-
<%s {...props} />
|
|
20
|
-
React keys must be passed directly to JSX without using spread:
|
|
21
|
-
let props = %s;
|
|
22
|
-
<%s key={someKey} {...props} />`,n,s,T,s),X[s+n]=!0)}if(s=null,r!==void 0&&(u(r),s=""+r),C(t)&&(u(t.key),s=""+t.key),"key"in t){r={};for(var Y in t)Y!=="key"&&(r[Y]=t[Y])}else r=t;return s&&_(r,typeof e=="function"?e.displayName||e.name||"Unknown":e),z(e,s,a,c,i(),r,m,R)}function j(e){typeof e=="object"&&e!==null&&e.$$typeof===p&&e._store&&(e._store.validated=1)}var v=o,p=Symbol.for("react.transitional.element"),y=Symbol.for("react.portal"),k=Symbol.for("react.fragment"),U=Symbol.for("react.strict_mode"),N=Symbol.for("react.profiler"),w=Symbol.for("react.consumer"),l=Symbol.for("react.context"),x=Symbol.for("react.forward_ref"),I=Symbol.for("react.suspense"),g=Symbol.for("react.suspense_list"),E=Symbol.for("react.memo"),$=Symbol.for("react.lazy"),H=Symbol.for("react.activity"),B=Symbol.for("react.client.reference"),O=v.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,M=Object.prototype.hasOwnProperty,P=Array.isArray,d=console.createTask?console.createTask:function(){return null};v={"react-stack-bottom-frame":function(e){return e()}};var W,q={},G=v["react-stack-bottom-frame"].bind(v,f)(),J=d(S(f)),X={};F.Fragment=k,F.jsx=function(e,t,r,n,c){var a=1e4>O.recentlyCreatedOwnerStacks++;return A(e,t,r,!1,n,c,a?Error("react-stack-top-frame"):G,a?d(S(e)):J)},F.jsxs=function(e,t,r,n,c){var a=1e4>O.recentlyCreatedOwnerStacks++;return A(e,t,r,!0,n,c,a?Error("react-stack-top-frame"):G,a?d(S(e)):J)}}()),F}var ee;function oe(){return ee||(ee=1,process.env.NODE_ENV==="production"?V.exports=te():V.exports=ne()),V.exports}var re=oe();const se=.2,ae=12,ce=75,ue=.35,le="forwards",ie=({hoverOpacity:b,pressedOpacity:h,disabled:u=!1,className:S="",style:i,easing:f,duration:C=150,minimumPressDuration:_=225,touchDelay:L=150})=>{const[z,A]=o.useState(!1),[j,v]=o.useState(!1),p=o.useRef(null),y=o.useRef(null),k=o.useRef(""),U=o.useRef(""),N=o.useRef(0),w=o.useRef(void 0),l=o.useRef(0),x=o.useRef(void 0),I=o.useRef(!1);o.useEffect(()=>{if(!y.current)return;const r=y.current.style;b!==void 0&&r.setProperty("--ripple-hover-opacity",b+""),h!==void 0&&r.setProperty("--ripple-pressed-opacity",h+"")},[b,h]);const g=o.useCallback(({pointerType:r})=>r==="touch",[]),E=o.useCallback(r=>{if(u||!r.isPrimary||x.current&&x.current.pointerId!==r.pointerId)return!1;if(r.type==="pointerenter"||r.type==="pointerleave")return!g(r);const n=r.buttons===1;return g(r)||n},[u,g]),$=o.useCallback(({x:r,y:n})=>{const c=p.current;if(!c)return!1;const{top:a,left:m,bottom:R,right:s}=c.getBoundingClientRect();return r>=m&&r<=s&&n>=a&&n<=R},[p]),H=o.useCallback(r=>{E(r)&&A(!0)},[E]),B=o.useCallback(()=>{const r=p.current;if(!r)return;const{height:n,width:c}=r.getBoundingClientRect(),a=Math.max(n,c),m=Math.max(ue*a,ce),R=Math.floor(a*se),T=Math.sqrt(c**2+n**2)+ae;N.current=R,U.current=`${(T+m)/R}`,k.current=`${R}px`},[p]),O=o.useCallback(r=>{const n=p.current;if(!n)return{x:0,y:0};const{scrollX:c,scrollY:a}=window,{left:m,top:R}=n.getBoundingClientRect(),s=c+m,T=a+R,{pageX:Y,pageY:Z}=r;return{x:Y-s,y:Z-T}},[p]),M=o.useCallback(r=>{const n=p.current.parentElement;if(!n)return{startPoint:{x:0,y:0},endPoint:{x:0,y:0}};const{height:c,width:a}=n.getBoundingClientRect(),m={x:(a-N.current)/2,y:(c-N.current)/2};return{startPoint:O(r),endPoint:m}},[p,O]),P=o.useCallback(r=>{var s;const n=y.current;if(!n)return;v(!0),(s=w.current)==null||s.cancel(),B();const{startPoint:c,endPoint:a}=M(r),m=`${c.x}px, ${c.y}px`,R=`${a.x}px, ${a.y}px`;w.current=n.animate({height:[k.current,k.current],width:[k.current,k.current],transform:[`translate(${m}) scale(1)`,`translate(${R}) scale(${U.current})`]},{pseudoElement:"::after",duration:C,easing:f,fill:le})},[B,C,f,M]),d=o.useCallback(()=>{x.current=void 0,l.current=0;const r=w.current;let n=1/0;if(typeof(r==null?void 0:r.currentTime)=="number"?n=r.currentTime:r!=null&&r.currentTime&&(n=r.currentTime.to("ms").value),n>=_)return void v(!1);setTimeout(()=>{w.current===r&&v(!1)},_-n)},[_]),W=o.useCallback(r=>{E(r)&&(A(!1),l.current!==0&&d())},[d,E]),q=o.useCallback(r=>{if(E(r)){if(l.current===2){l.current=3;return}if(l.current===1){l.current=3,P(x.current);return}}},[E,P]),G=o.useCallback(async r=>{if(E(r)){if(x.current=r,!g(r)){l.current=3,P(r);return}I.current&&!$(r)||(I.current=!1,l.current=1,await new Promise(n=>{setTimeout(n,L)}),l.current===1&&(l.current=2,P(r)))}},[E,g,$,P,L]),J=o.useCallback(()=>{if(!u){if(l.current===3){d();return}l.current===0&&(P(),d())}},[u,d,P]),X=o.useCallback(r=>{E(r)&&d()},[d,E]),e=o.useCallback(()=>{u||(I.current=!0,d())},[u,d]);o.useEffect(()=>{u&&(A(!1),v(!1))},[u]);const t=o.useMemo(()=>["salty-ripple-surface",[z&&"hovered",j&&"pressed"].filter(Boolean).join(" ")].filter(Boolean).join(" "),[z,j]);return re.jsx("div",{ref:p,className:`salty-ripple${S?` ${S}`:""}`,style:i,"aria-hidden":"true",onClick:J,onContextMenu:e,onPointerCancel:X,onPointerDown:G,onPointerEnter:H,onPointerLeave:W,onPointerUp:q,children:re.jsx("div",{ref:y,className:t})})};exports.Ripple=ie;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const z=require("react/jsx-runtime"),t=require("react"),H=.2,Z=12,J=75,K=.35,Q="forwards",V=({hoverOpacity:y,pressedOpacity:x,disabled:a=!1,className:T="",style:B,easing:b,duration:f=150,minimumPressDuration:g=225,touchDelay:w=150})=>{const[L,A]=t.useState(!1),[j,k]=t.useState(!1),u=t.useRef(null),m=t.useRef(null),p=t.useRef(""),M=t.useRef(""),I=t.useRef(0),P=t.useRef(void 0),c=t.useRef(0),d=t.useRef(void 0),S=t.useRef(!1);t.useEffect(()=>{if(!m.current)return;const e=m.current.style;y!==void 0&&e.setProperty("--ripple-hover-opacity",y+""),x!==void 0&&e.setProperty("--ripple-pressed-opacity",x+""),f!==void 0&&f!==150&&e.setProperty("--ripple-duration",f+"ms")},[y,x,f]);const R=t.useCallback(({pointerType:e})=>e==="touch",[]),o=t.useCallback(e=>{if(a||!e.isPrimary||d.current&&d.current.pointerId!==e.pointerId)return!1;if(e.type==="pointerenter"||e.type==="pointerleave")return!R(e);const r=e.buttons===1;return R(e)||r},[a,R]),$=t.useCallback(({x:e,y:r})=>{const n=u.current;if(!n)return!1;const s=n.getBoundingClientRect();return e>=s.left&&e<=s.right&&r>=s.top&&r<=s.bottom},[u]),D=t.useCallback(e=>{o(e)&&A(!0)},[o]),N=t.useCallback(()=>{const e=u.current;if(!e)return;const{height:r,width:n}=e.getBoundingClientRect(),s=Math.max(r,n),C=Math.max(K*s,J),h=Math.floor(s*H),U=Math.sqrt(n**2+r**2)+Z;I.current=h,M.current=(U+C)/h+"",p.current=h+"px"},[u]),_=t.useCallback(e=>{const r=u.current;if(!r)return{x:0,y:0};const n=r.getBoundingClientRect(),s=window.scrollX+n.left,C=window.scrollY+n.top;return{x:e.pageX-s,y:e.pageY-C}},[u]),v=t.useCallback(e=>{const r=u.current.parentElement;if(!r)return{startPoint:{x:0,y:0},endPoint:{x:0,y:0}};const n=r.getBoundingClientRect(),s={x:(n.width-I.current)/2,y:(n.height-I.current)/2};return{startPoint:_(e),endPoint:s}},[u,_]),l=t.useCallback(e=>{var E;const r=m.current;if(!r)return;k(!0),(E=P.current)==null||E.cancel(),N();const{startPoint:n,endPoint:s}=v(e),C=`${n.x}px, ${n.y}px`,h=`${s.x}px, ${s.y}px`;P.current=r.animate({height:[p.current,p.current],width:[p.current,p.current],transform:[`translate(${C}) scale(1)`,`translate(${h}) scale(${M.current})`]},{pseudoElement:"::after",duration:f,easing:b,fill:Q})},[N,f,b,v]),i=t.useCallback(()=>{d.current=void 0,c.current=0;const e=P.current;let r=1/0;if(typeof(e==null?void 0:e.currentTime)=="number"?r=e.currentTime:e!=null&&e.currentTime&&(r=e.currentTime.to("ms").value),r>=g)return void k(!1);setTimeout(()=>{P.current===e&&k(!1)},g-r)},[g]),G=t.useCallback(e=>{o(e)&&(A(!1),c.current!==0&&i())},[i,o]),q=t.useCallback(e=>{if(o(e)){if(c.current===2){c.current=3;return}if(c.current===1){c.current=3,l(d.current);return}}},[o,l]),F=t.useCallback(async e=>{if(o(e)){if(d.current=e,!R(e)){c.current=3,l(e);return}S.current&&!$(e)||(S.current=!1,c.current=1,await new Promise(r=>{setTimeout(r,w)}),c.current===1&&(c.current=2,l(e)))}},[o,R,$,l,w]),O=t.useCallback(()=>{if(!a){if(c.current===3){i();return}c.current===0&&(l(),i())}},[a,i,l]),X=t.useCallback(e=>{o(e)&&i()},[i,o]),Y=t.useCallback(()=>{a||(S.current=!0,i())},[a,i]);return z.jsx("div",{ref:u,className:`salty-ripple${T?` ${T}`:""}`,style:B,"aria-hidden":"true",onClick:O,onContextMenu:Y,onPointerCancel:X,onPointerDown:F,onPointerEnter:D,onPointerLeave:G,onPointerUp:q,children:z.jsx("div",{ref:m,className:`salty-ripple-surface${L?" --hover":""}${j?" --press":""}`})})};exports.Ripple=V;
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.tsx"],"names":[],"mappings":"AAcA,MAAM,WAAW,WAAW;IACxB;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAA;IAElB;;;;OAIG;IACH,YAAY,CAAC,EAAE,MAAM,CAAA;IAErB;;;;OAIG;IACH,cAAc,CAAC,EAAE,MAAM,CAAA;IAEvB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAA;IAElB;;OAEG;IACH,KAAK,CAAC,EAAE,KAAK,CAAC,aAAa,CAAA;IAE3B;;OAEG;IACH,MAAM,CAAC,EAAE,4BAA4B,CAAA;IAErC;;;;OAIG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAA;IAEjB;;;;;OAKG;IACH,oBAAoB,CAAC,EAAE,MAAM,CAAA;IAE7B;;;;OAIG;IACH,UAAU,CAAC,EAAE,MAAM,CAAA;CACtB;AA+CD;;GAEG;AACH,eAAO,MAAM,MAAM,GAAI,kHAUpB,WAAW,4CAsTb,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -1,465 +1,192 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
8
|
-
*
|
|
9
|
-
* This source code is licensed under the MIT license found in the
|
|
10
|
-
* LICENSE file in the root directory of this source tree.
|
|
11
|
-
*/
|
|
12
|
-
var re;
|
|
13
|
-
function ce() {
|
|
14
|
-
if (re) return F;
|
|
15
|
-
re = 1;
|
|
16
|
-
var T = Symbol.for("react.transitional.element"), S = Symbol.for("react.fragment");
|
|
17
|
-
function u(A, l, f) {
|
|
18
|
-
var g = null;
|
|
19
|
-
if (f !== void 0 && (g = "" + f), l.key !== void 0 && (g = "" + l.key), "key" in l) {
|
|
20
|
-
f = {};
|
|
21
|
-
for (var v in l)
|
|
22
|
-
v !== "key" && (f[v] = l[v]);
|
|
23
|
-
} else f = l;
|
|
24
|
-
return l = f.ref, {
|
|
25
|
-
$$typeof: T,
|
|
26
|
-
type: A,
|
|
27
|
-
key: g,
|
|
28
|
-
ref: l !== void 0 ? l : null,
|
|
29
|
-
props: f
|
|
30
|
-
};
|
|
31
|
-
}
|
|
32
|
-
return F.Fragment = S, F.jsx = u, F.jsxs = u, F;
|
|
33
|
-
}
|
|
34
|
-
var L = {};
|
|
35
|
-
/**
|
|
36
|
-
* @license React
|
|
37
|
-
* react-jsx-runtime.development.js
|
|
38
|
-
*
|
|
39
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
40
|
-
*
|
|
41
|
-
* This source code is licensed under the MIT license found in the
|
|
42
|
-
* LICENSE file in the root directory of this source tree.
|
|
43
|
-
*/
|
|
44
|
-
var te;
|
|
45
|
-
function ue() {
|
|
46
|
-
return te || (te = 1, process.env.NODE_ENV !== "production" && function() {
|
|
47
|
-
function T(e) {
|
|
48
|
-
if (e == null) return null;
|
|
49
|
-
if (typeof e == "function")
|
|
50
|
-
return e.$$typeof === W ? null : e.displayName || e.name || null;
|
|
51
|
-
if (typeof e == "string") return e;
|
|
52
|
-
switch (e) {
|
|
53
|
-
case b:
|
|
54
|
-
return "Fragment";
|
|
55
|
-
case I:
|
|
56
|
-
return "Profiler";
|
|
57
|
-
case B:
|
|
58
|
-
return "StrictMode";
|
|
59
|
-
case $:
|
|
60
|
-
return "Suspense";
|
|
61
|
-
case y:
|
|
62
|
-
return "SuspenseList";
|
|
63
|
-
case Z:
|
|
64
|
-
return "Activity";
|
|
65
|
-
}
|
|
66
|
-
if (typeof e == "object")
|
|
67
|
-
switch (typeof e.tag == "number" && console.error(
|
|
68
|
-
"Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
|
|
69
|
-
), e.$$typeof) {
|
|
70
|
-
case O:
|
|
71
|
-
return "Portal";
|
|
72
|
-
case i:
|
|
73
|
-
return (e.displayName || "Context") + ".Provider";
|
|
74
|
-
case C:
|
|
75
|
-
return (e._context.displayName || "Context") + ".Consumer";
|
|
76
|
-
case k:
|
|
77
|
-
var t = e.render;
|
|
78
|
-
return e = e.displayName, e || (e = t.displayName || t.name || "", e = e !== "" ? "ForwardRef(" + e + ")" : "ForwardRef"), e;
|
|
79
|
-
case R:
|
|
80
|
-
return t = e.displayName || null, t !== null ? t : T(e.type) || "Memo";
|
|
81
|
-
case M:
|
|
82
|
-
t = e._payload, e = e._init;
|
|
83
|
-
try {
|
|
84
|
-
return T(e(t));
|
|
85
|
-
} catch {
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
return null;
|
|
89
|
-
}
|
|
90
|
-
function S(e) {
|
|
91
|
-
return "" + e;
|
|
92
|
-
}
|
|
93
|
-
function u(e) {
|
|
94
|
-
try {
|
|
95
|
-
S(e);
|
|
96
|
-
var t = !1;
|
|
97
|
-
} catch {
|
|
98
|
-
t = !0;
|
|
99
|
-
}
|
|
100
|
-
if (t) {
|
|
101
|
-
t = console;
|
|
102
|
-
var r = t.error, n = typeof Symbol == "function" && Symbol.toStringTag && e[Symbol.toStringTag] || e.constructor.name || "Object";
|
|
103
|
-
return r.call(
|
|
104
|
-
t,
|
|
105
|
-
"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
|
|
106
|
-
n
|
|
107
|
-
), S(e);
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
function A(e) {
|
|
111
|
-
if (e === b) return "<>";
|
|
112
|
-
if (typeof e == "object" && e !== null && e.$$typeof === M)
|
|
113
|
-
return "<...>";
|
|
114
|
-
try {
|
|
115
|
-
var t = T(e);
|
|
116
|
-
return t ? "<" + t + ">" : "<...>";
|
|
117
|
-
} catch {
|
|
118
|
-
return "<...>";
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
function l() {
|
|
122
|
-
var e = j.A;
|
|
123
|
-
return e === null ? null : e.getOwner();
|
|
124
|
-
}
|
|
125
|
-
function f() {
|
|
126
|
-
return Error("react-stack-top-frame");
|
|
127
|
-
}
|
|
128
|
-
function g(e) {
|
|
129
|
-
if (Y.call(e, "key")) {
|
|
130
|
-
var t = Object.getOwnPropertyDescriptor(e, "key").get;
|
|
131
|
-
if (t && t.isReactWarning) return !1;
|
|
132
|
-
}
|
|
133
|
-
return e.key !== void 0;
|
|
134
|
-
}
|
|
135
|
-
function v(e, t) {
|
|
136
|
-
function r() {
|
|
137
|
-
G || (G = !0, console.error(
|
|
138
|
-
"%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",
|
|
139
|
-
t
|
|
140
|
-
));
|
|
141
|
-
}
|
|
142
|
-
r.isReactWarning = !0, Object.defineProperty(e, "key", {
|
|
143
|
-
get: r,
|
|
144
|
-
configurable: !0
|
|
145
|
-
});
|
|
146
|
-
}
|
|
147
|
-
function z() {
|
|
148
|
-
var e = T(this.type);
|
|
149
|
-
return q[e] || (q[e] = !0, console.error(
|
|
150
|
-
"Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release."
|
|
151
|
-
)), e = this.props.ref, e !== void 0 ? e : null;
|
|
152
|
-
}
|
|
153
|
-
function U(e, t, r, n, a, s, m, p) {
|
|
154
|
-
return r = s.ref, e = {
|
|
155
|
-
$$typeof: E,
|
|
156
|
-
type: e,
|
|
157
|
-
key: t,
|
|
158
|
-
props: s,
|
|
159
|
-
_owner: a
|
|
160
|
-
}, (r !== void 0 ? r : null) !== null ? Object.defineProperty(e, "ref", {
|
|
161
|
-
enumerable: !1,
|
|
162
|
-
get: z
|
|
163
|
-
}) : Object.defineProperty(e, "ref", { enumerable: !1, value: null }), e._store = {}, Object.defineProperty(e._store, "validated", {
|
|
164
|
-
configurable: !1,
|
|
165
|
-
enumerable: !1,
|
|
166
|
-
writable: !0,
|
|
167
|
-
value: 0
|
|
168
|
-
}), Object.defineProperty(e, "_debugInfo", {
|
|
169
|
-
configurable: !1,
|
|
170
|
-
enumerable: !1,
|
|
171
|
-
writable: !0,
|
|
172
|
-
value: null
|
|
173
|
-
}), Object.defineProperty(e, "_debugStack", {
|
|
174
|
-
configurable: !1,
|
|
175
|
-
enumerable: !1,
|
|
176
|
-
writable: !0,
|
|
177
|
-
value: m
|
|
178
|
-
}), Object.defineProperty(e, "_debugTask", {
|
|
179
|
-
configurable: !1,
|
|
180
|
-
enumerable: !1,
|
|
181
|
-
writable: !0,
|
|
182
|
-
value: p
|
|
183
|
-
}), Object.freeze && (Object.freeze(e.props), Object.freeze(e)), e;
|
|
184
|
-
}
|
|
185
|
-
function w(e, t, r, n, a, s, m, p) {
|
|
186
|
-
var o = t.children;
|
|
187
|
-
if (o !== void 0)
|
|
188
|
-
if (n)
|
|
189
|
-
if (h(o)) {
|
|
190
|
-
for (n = 0; n < o.length; n++)
|
|
191
|
-
N(o[n]);
|
|
192
|
-
Object.freeze && Object.freeze(o);
|
|
193
|
-
} else
|
|
194
|
-
console.error(
|
|
195
|
-
"React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."
|
|
196
|
-
);
|
|
197
|
-
else N(o);
|
|
198
|
-
if (Y.call(t, "key")) {
|
|
199
|
-
o = T(e);
|
|
200
|
-
var _ = Object.keys(t).filter(function(Q) {
|
|
201
|
-
return Q !== "key";
|
|
202
|
-
});
|
|
203
|
-
n = 0 < _.length ? "{key: someKey, " + _.join(": ..., ") + ": ...}" : "{key: someKey}", V[o + n] || (_ = 0 < _.length ? "{" + _.join(": ..., ") + ": ...}" : "{}", console.error(
|
|
204
|
-
`A props object containing a "key" prop is being spread into JSX:
|
|
205
|
-
let props = %s;
|
|
206
|
-
<%s {...props} />
|
|
207
|
-
React keys must be passed directly to JSX without using spread:
|
|
208
|
-
let props = %s;
|
|
209
|
-
<%s key={someKey} {...props} />`,
|
|
210
|
-
n,
|
|
211
|
-
o,
|
|
212
|
-
_,
|
|
213
|
-
o
|
|
214
|
-
), V[o + n] = !0);
|
|
215
|
-
}
|
|
216
|
-
if (o = null, r !== void 0 && (u(r), o = "" + r), g(t) && (u(t.key), o = "" + t.key), "key" in t) {
|
|
217
|
-
r = {};
|
|
218
|
-
for (var D in t)
|
|
219
|
-
D !== "key" && (r[D] = t[D]);
|
|
220
|
-
} else r = t;
|
|
221
|
-
return o && v(
|
|
222
|
-
r,
|
|
223
|
-
typeof e == "function" ? e.displayName || e.name || "Unknown" : e
|
|
224
|
-
), U(
|
|
225
|
-
e,
|
|
226
|
-
o,
|
|
227
|
-
s,
|
|
228
|
-
a,
|
|
229
|
-
l(),
|
|
230
|
-
r,
|
|
231
|
-
m,
|
|
232
|
-
p
|
|
233
|
-
);
|
|
234
|
-
}
|
|
235
|
-
function N(e) {
|
|
236
|
-
typeof e == "object" && e !== null && e.$$typeof === E && e._store && (e._store.validated = 1);
|
|
237
|
-
}
|
|
238
|
-
var P = se, E = Symbol.for("react.transitional.element"), O = Symbol.for("react.portal"), b = Symbol.for("react.fragment"), B = Symbol.for("react.strict_mode"), I = Symbol.for("react.profiler"), C = Symbol.for("react.consumer"), i = Symbol.for("react.context"), k = Symbol.for("react.forward_ref"), $ = Symbol.for("react.suspense"), y = Symbol.for("react.suspense_list"), R = Symbol.for("react.memo"), M = Symbol.for("react.lazy"), Z = Symbol.for("react.activity"), W = Symbol.for("react.client.reference"), j = P.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, Y = Object.prototype.hasOwnProperty, h = Array.isArray, d = console.createTask ? console.createTask : function() {
|
|
239
|
-
return null;
|
|
240
|
-
};
|
|
241
|
-
P = {
|
|
242
|
-
"react-stack-bottom-frame": function(e) {
|
|
243
|
-
return e();
|
|
244
|
-
}
|
|
245
|
-
};
|
|
246
|
-
var G, q = {}, J = P["react-stack-bottom-frame"].bind(
|
|
247
|
-
P,
|
|
248
|
-
f
|
|
249
|
-
)(), X = d(A(f)), V = {};
|
|
250
|
-
L.Fragment = b, L.jsx = function(e, t, r, n, a) {
|
|
251
|
-
var s = 1e4 > j.recentlyCreatedOwnerStacks++;
|
|
252
|
-
return w(
|
|
253
|
-
e,
|
|
254
|
-
t,
|
|
255
|
-
r,
|
|
256
|
-
!1,
|
|
257
|
-
n,
|
|
258
|
-
a,
|
|
259
|
-
s ? Error("react-stack-top-frame") : J,
|
|
260
|
-
s ? d(A(e)) : X
|
|
261
|
-
);
|
|
262
|
-
}, L.jsxs = function(e, t, r, n, a) {
|
|
263
|
-
var s = 1e4 > j.recentlyCreatedOwnerStacks++;
|
|
264
|
-
return w(
|
|
265
|
-
e,
|
|
266
|
-
t,
|
|
267
|
-
r,
|
|
268
|
-
!0,
|
|
269
|
-
n,
|
|
270
|
-
a,
|
|
271
|
-
s ? Error("react-stack-top-frame") : J,
|
|
272
|
-
s ? d(A(e)) : X
|
|
273
|
-
);
|
|
274
|
-
};
|
|
275
|
-
}()), L;
|
|
276
|
-
}
|
|
277
|
-
var ne;
|
|
278
|
-
function ie() {
|
|
279
|
-
return ne || (ne = 1, process.env.NODE_ENV === "production" ? H.exports = ce() : H.exports = ue()), H.exports;
|
|
280
|
-
}
|
|
281
|
-
var oe = ie();
|
|
282
|
-
const le = 0.2, fe = 12, de = 75, me = 0.35, pe = "forwards", Re = ({
|
|
283
|
-
hoverOpacity: T,
|
|
284
|
-
pressedOpacity: S,
|
|
285
|
-
disabled: u = !1,
|
|
1
|
+
import { jsx as k } from "react/jsx-runtime";
|
|
2
|
+
import { useState as D, useRef as l, useEffect as K, useCallback as r } from "react";
|
|
3
|
+
const Q = 0.2, V = 12, W = 75, b = 0.35, tt = "forwards", nt = ({
|
|
4
|
+
hoverOpacity: g,
|
|
5
|
+
pressedOpacity: I,
|
|
6
|
+
disabled: a = !1,
|
|
286
7
|
className: A = "",
|
|
287
|
-
style:
|
|
288
|
-
easing:
|
|
289
|
-
duration:
|
|
290
|
-
minimumPressDuration:
|
|
291
|
-
touchDelay:
|
|
8
|
+
style: G,
|
|
9
|
+
easing: M,
|
|
10
|
+
duration: p = 150,
|
|
11
|
+
minimumPressDuration: C = 225,
|
|
12
|
+
touchDelay: $ = 150
|
|
292
13
|
}) => {
|
|
293
|
-
const [
|
|
14
|
+
const [F, N] = D(!1), [X, E] = D(!1), i = l(null), x = l(null), d = l(""), _ = l(""), T = l(0), y = l(void 0), c = l(
|
|
294
15
|
0
|
|
295
16
|
/* INACTIVE */
|
|
296
|
-
),
|
|
297
|
-
|
|
298
|
-
if (!
|
|
299
|
-
const
|
|
300
|
-
|
|
301
|
-
}, [
|
|
302
|
-
const
|
|
303
|
-
(
|
|
304
|
-
|
|
17
|
+
), m = l(void 0), S = l(!1);
|
|
18
|
+
K(() => {
|
|
19
|
+
if (!x.current) return;
|
|
20
|
+
const t = x.current.style;
|
|
21
|
+
g !== void 0 && t.setProperty("--ripple-hover-opacity", g + ""), I !== void 0 && t.setProperty("--ripple-pressed-opacity", I + ""), p !== void 0 && p !== 150 && t.setProperty("--ripple-duration", p + "ms");
|
|
22
|
+
}, [g, I, p]);
|
|
23
|
+
const h = r(
|
|
24
|
+
({ pointerType: t }) => t === "touch",
|
|
25
|
+
[]
|
|
26
|
+
), s = r(
|
|
27
|
+
(t) => {
|
|
28
|
+
if (a || !t.isPrimary || m.current && m.current.pointerId !== t.pointerId)
|
|
305
29
|
return !1;
|
|
306
|
-
if (
|
|
307
|
-
return !
|
|
308
|
-
const
|
|
309
|
-
return
|
|
30
|
+
if (t.type === "pointerenter" || t.type === "pointerleave")
|
|
31
|
+
return !h(t);
|
|
32
|
+
const e = t.buttons === 1;
|
|
33
|
+
return h(t) || e;
|
|
310
34
|
},
|
|
311
|
-
[
|
|
312
|
-
),
|
|
35
|
+
[a, h]
|
|
36
|
+
), z = r(
|
|
313
37
|
// @ts-ignore
|
|
314
|
-
({ x:
|
|
315
|
-
const
|
|
316
|
-
if (!
|
|
317
|
-
const
|
|
318
|
-
return
|
|
38
|
+
({ x: t, y: e }) => {
|
|
39
|
+
const n = i.current;
|
|
40
|
+
if (!n) return !1;
|
|
41
|
+
const o = n.getBoundingClientRect();
|
|
42
|
+
return t >= o.left && t <= o.right && e >= o.top && e <= o.bottom;
|
|
319
43
|
},
|
|
320
|
-
[
|
|
321
|
-
),
|
|
322
|
-
(
|
|
323
|
-
|
|
44
|
+
[i]
|
|
45
|
+
), Y = r(
|
|
46
|
+
(t) => {
|
|
47
|
+
s(t) && N(!0);
|
|
324
48
|
},
|
|
325
|
-
[
|
|
326
|
-
),
|
|
327
|
-
const
|
|
328
|
-
if (!
|
|
329
|
-
const { height:
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
),
|
|
333
|
-
|
|
334
|
-
}, [
|
|
335
|
-
(
|
|
336
|
-
const
|
|
337
|
-
if (!
|
|
338
|
-
const
|
|
339
|
-
return {
|
|
49
|
+
[s]
|
|
50
|
+
), B = r(() => {
|
|
51
|
+
const t = i.current;
|
|
52
|
+
if (!t) return;
|
|
53
|
+
const { height: e, width: n } = t.getBoundingClientRect(), o = Math.max(e, n), P = Math.max(
|
|
54
|
+
b * o,
|
|
55
|
+
W
|
|
56
|
+
), R = Math.floor(o * Q), J = Math.sqrt(n ** 2 + e ** 2) + V;
|
|
57
|
+
T.current = R, _.current = (J + P) / R + "", d.current = R + "px";
|
|
58
|
+
}, [i]), v = r(
|
|
59
|
+
(t) => {
|
|
60
|
+
const e = i.current;
|
|
61
|
+
if (!e) return { x: 0, y: 0 };
|
|
62
|
+
const n = e.getBoundingClientRect(), o = window.scrollX + n.left, P = window.scrollY + n.top;
|
|
63
|
+
return {
|
|
64
|
+
x: t.pageX - o,
|
|
65
|
+
y: t.pageY - P
|
|
66
|
+
};
|
|
340
67
|
},
|
|
341
|
-
[
|
|
342
|
-
),
|
|
343
|
-
(
|
|
344
|
-
const
|
|
345
|
-
if (!
|
|
68
|
+
[i]
|
|
69
|
+
), L = r(
|
|
70
|
+
(t) => {
|
|
71
|
+
const e = i.current.parentElement;
|
|
72
|
+
if (!e)
|
|
346
73
|
return { startPoint: { x: 0, y: 0 }, endPoint: { x: 0, y: 0 } };
|
|
347
|
-
const
|
|
348
|
-
x: (
|
|
349
|
-
y: (
|
|
74
|
+
const n = e.getBoundingClientRect(), o = {
|
|
75
|
+
x: (n.width - T.current) / 2,
|
|
76
|
+
y: (n.height - T.current) / 2
|
|
350
77
|
};
|
|
351
78
|
return {
|
|
352
|
-
startPoint:
|
|
353
|
-
endPoint:
|
|
79
|
+
startPoint: v(t),
|
|
80
|
+
endPoint: o
|
|
354
81
|
};
|
|
355
82
|
},
|
|
356
|
-
[
|
|
357
|
-
),
|
|
358
|
-
(
|
|
359
|
-
var
|
|
360
|
-
const
|
|
361
|
-
if (!
|
|
362
|
-
|
|
363
|
-
const { startPoint:
|
|
364
|
-
|
|
83
|
+
[i, v]
|
|
84
|
+
), f = r(
|
|
85
|
+
(t) => {
|
|
86
|
+
var w;
|
|
87
|
+
const e = x.current;
|
|
88
|
+
if (!e) return;
|
|
89
|
+
E(!0), (w = y.current) == null || w.cancel(), B();
|
|
90
|
+
const { startPoint: n, endPoint: o } = L(t), P = `${n.x}px, ${n.y}px`, R = `${o.x}px, ${o.y}px`;
|
|
91
|
+
y.current = e.animate(
|
|
365
92
|
{
|
|
366
|
-
height: [
|
|
367
|
-
width: [
|
|
93
|
+
height: [d.current, d.current],
|
|
94
|
+
width: [d.current, d.current],
|
|
368
95
|
transform: [
|
|
369
|
-
`translate(${
|
|
370
|
-
`translate(${
|
|
96
|
+
`translate(${P}) scale(1)`,
|
|
97
|
+
`translate(${R}) scale(${_.current})`
|
|
371
98
|
]
|
|
372
99
|
},
|
|
373
100
|
{
|
|
374
101
|
pseudoElement: "::after",
|
|
375
|
-
duration:
|
|
376
|
-
easing:
|
|
377
|
-
fill:
|
|
102
|
+
duration: p,
|
|
103
|
+
easing: M,
|
|
104
|
+
fill: tt
|
|
378
105
|
}
|
|
379
106
|
);
|
|
380
107
|
},
|
|
381
|
-
[
|
|
382
|
-
),
|
|
383
|
-
|
|
384
|
-
const
|
|
385
|
-
let
|
|
386
|
-
if (typeof (
|
|
387
|
-
|
|
388
|
-
).value), n >= v)
|
|
389
|
-
return void P(!1);
|
|
108
|
+
[B, p, M, L]
|
|
109
|
+
), u = r(() => {
|
|
110
|
+
m.current = void 0, c.current = 0;
|
|
111
|
+
const t = y.current;
|
|
112
|
+
let e = 1 / 0;
|
|
113
|
+
if (typeof (t == null ? void 0 : t.currentTime) == "number" ? e = t.currentTime : t != null && t.currentTime && (e = t.currentTime.to("ms").value), e >= C)
|
|
114
|
+
return void E(!1);
|
|
390
115
|
setTimeout(() => {
|
|
391
|
-
|
|
392
|
-
},
|
|
393
|
-
}, [
|
|
394
|
-
(
|
|
395
|
-
|
|
116
|
+
y.current === t && E(!1);
|
|
117
|
+
}, C - e);
|
|
118
|
+
}, [C]), O = r(
|
|
119
|
+
(t) => {
|
|
120
|
+
s(t) && (N(!1), c.current !== 0 && u());
|
|
396
121
|
},
|
|
397
|
-
[
|
|
398
|
-
),
|
|
399
|
-
(
|
|
400
|
-
if (
|
|
401
|
-
if (
|
|
402
|
-
|
|
122
|
+
[u, s]
|
|
123
|
+
), U = r(
|
|
124
|
+
(t) => {
|
|
125
|
+
if (s(t)) {
|
|
126
|
+
if (c.current === 2) {
|
|
127
|
+
c.current = 3;
|
|
403
128
|
return;
|
|
404
129
|
}
|
|
405
|
-
if (
|
|
406
|
-
|
|
130
|
+
if (c.current === 1) {
|
|
131
|
+
c.current = 3, f(m.current);
|
|
407
132
|
return;
|
|
408
133
|
}
|
|
409
134
|
}
|
|
410
135
|
},
|
|
411
|
-
[
|
|
412
|
-
),
|
|
413
|
-
async (
|
|
414
|
-
if (
|
|
415
|
-
if (
|
|
416
|
-
|
|
136
|
+
[s, f]
|
|
137
|
+
), j = r(
|
|
138
|
+
async (t) => {
|
|
139
|
+
if (s(t)) {
|
|
140
|
+
if (m.current = t, !h(t)) {
|
|
141
|
+
c.current = 3, f(t);
|
|
417
142
|
return;
|
|
418
143
|
}
|
|
419
|
-
|
|
420
|
-
setTimeout(
|
|
421
|
-
}),
|
|
144
|
+
S.current && !z(t) || (S.current = !1, c.current = 1, await new Promise((e) => {
|
|
145
|
+
setTimeout(e, $);
|
|
146
|
+
}), c.current === 1 && (c.current = 2, f(t)));
|
|
422
147
|
}
|
|
423
148
|
},
|
|
424
|
-
[
|
|
425
|
-
),
|
|
426
|
-
if (!
|
|
427
|
-
if (
|
|
428
|
-
|
|
149
|
+
[s, h, z, f, $]
|
|
150
|
+
), q = r(() => {
|
|
151
|
+
if (!a) {
|
|
152
|
+
if (c.current === 3) {
|
|
153
|
+
u();
|
|
429
154
|
return;
|
|
430
155
|
}
|
|
431
|
-
|
|
156
|
+
c.current === 0 && (f(), u());
|
|
432
157
|
}
|
|
433
|
-
}, [
|
|
434
|
-
(
|
|
435
|
-
|
|
158
|
+
}, [a, u, f]), H = r(
|
|
159
|
+
(t) => {
|
|
160
|
+
s(t) && u();
|
|
436
161
|
},
|
|
437
|
-
[
|
|
438
|
-
),
|
|
439
|
-
|
|
440
|
-
}, [
|
|
441
|
-
|
|
442
|
-
u && (w(!1), P(!1));
|
|
443
|
-
}, [u]);
|
|
444
|
-
const t = ae(() => ["salty-ripple-surface", [U && "hovered", N && "pressed"].filter(Boolean).join(" ")].filter(Boolean).join(" "), [U, N]);
|
|
445
|
-
return /* @__PURE__ */ oe.jsx(
|
|
162
|
+
[u, s]
|
|
163
|
+
), Z = r(() => {
|
|
164
|
+
a || (S.current = !0, u());
|
|
165
|
+
}, [a, u]);
|
|
166
|
+
return /* @__PURE__ */ k(
|
|
446
167
|
"div",
|
|
447
168
|
{
|
|
448
|
-
ref:
|
|
169
|
+
ref: i,
|
|
449
170
|
className: `salty-ripple${A ? ` ${A}` : ""}`,
|
|
450
|
-
style:
|
|
171
|
+
style: G,
|
|
451
172
|
"aria-hidden": "true",
|
|
452
|
-
onClick:
|
|
453
|
-
onContextMenu:
|
|
454
|
-
onPointerCancel:
|
|
455
|
-
onPointerDown:
|
|
456
|
-
onPointerEnter:
|
|
457
|
-
onPointerLeave:
|
|
458
|
-
onPointerUp:
|
|
459
|
-
children: /* @__PURE__ */
|
|
173
|
+
onClick: q,
|
|
174
|
+
onContextMenu: Z,
|
|
175
|
+
onPointerCancel: H,
|
|
176
|
+
onPointerDown: j,
|
|
177
|
+
onPointerEnter: Y,
|
|
178
|
+
onPointerLeave: O,
|
|
179
|
+
onPointerUp: U,
|
|
180
|
+
children: /* @__PURE__ */ k(
|
|
181
|
+
"div",
|
|
182
|
+
{
|
|
183
|
+
ref: x,
|
|
184
|
+
className: `salty-ripple-surface${F ? " --hover" : ""}${X ? " --press" : ""}`
|
|
185
|
+
}
|
|
186
|
+
)
|
|
460
187
|
}
|
|
461
188
|
);
|
|
462
189
|
};
|
|
463
190
|
export {
|
|
464
|
-
|
|
191
|
+
nt as Ripple
|
|
465
192
|
};
|
package/dist/ripple.css
CHANGED
|
@@ -1,50 +1,6 @@
|
|
|
1
|
-
.salty-ripple-surface {
|
|
2
|
-
position: absolute;
|
|
3
|
-
inset: 0;
|
|
4
|
-
pointer-events: none;
|
|
5
|
-
overflow: hidden;
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
.salty-ripple-surface::before,
|
|
9
|
-
.salty-ripple-surface::after {
|
|
10
|
-
content: '';
|
|
11
|
-
opacity: 0;
|
|
12
|
-
position: absolute;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
.salty-ripple-surface::before {
|
|
16
|
-
background-color: currentColor;
|
|
17
|
-
inset: 0;
|
|
18
|
-
transition:
|
|
19
|
-
opacity 15ms linear,
|
|
20
|
-
background-color 15ms linear;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
.salty-ripple-surface::after {
|
|
24
|
-
background: radial-gradient(
|
|
25
|
-
closest-side,
|
|
26
|
-
currentColor max(100% - 70px, 65%),
|
|
27
|
-
transparent 100%
|
|
28
|
-
);
|
|
29
|
-
transform-origin: center center;
|
|
30
|
-
transition: opacity 375ms linear;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
.hovered::before {
|
|
34
|
-
background-color: currentColor;
|
|
35
|
-
opacity: 0.08;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
.pressed::after {
|
|
39
|
-
opacity: 0.12;
|
|
40
|
-
transition-duration: 75ms;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
/* React-specific styles */
|
|
44
1
|
.salty-ripple {
|
|
45
2
|
position: absolute;
|
|
46
|
-
|
|
47
|
-
left: 0;
|
|
3
|
+
inset: 0;
|
|
48
4
|
width: 100%;
|
|
49
5
|
height: 100%;
|
|
50
6
|
display: block;
|
|
@@ -65,7 +21,7 @@
|
|
|
65
21
|
inset: 0;
|
|
66
22
|
pointer-events: none;
|
|
67
23
|
overflow: hidden;
|
|
68
|
-
border-radius: inherit
|
|
24
|
+
border-radius: inherit;;
|
|
69
25
|
}
|
|
70
26
|
|
|
71
27
|
.salty-ripple .salty-ripple-surface::before,
|
|
@@ -81,8 +37,8 @@
|
|
|
81
37
|
background-color: currentColor;
|
|
82
38
|
inset: 0;
|
|
83
39
|
transition:
|
|
84
|
-
opacity
|
|
85
|
-
background-color
|
|
40
|
+
opacity var(--ripple-duration, 150ms),
|
|
41
|
+
background-color var(--ripple-duration, 150ms);
|
|
86
42
|
}
|
|
87
43
|
|
|
88
44
|
.salty-ripple .salty-ripple-surface::after {
|
|
@@ -93,15 +49,15 @@
|
|
|
93
49
|
transparent 100%
|
|
94
50
|
);
|
|
95
51
|
transform-origin: center center;
|
|
96
|
-
transition: opacity 375ms
|
|
52
|
+
transition: opacity 375ms;
|
|
97
53
|
}
|
|
98
54
|
|
|
99
|
-
.salty-ripple .salty-ripple-surface
|
|
55
|
+
.salty-ripple .salty-ripple-surface.--hover::before {
|
|
100
56
|
background-color: currentColor;
|
|
101
57
|
opacity: var(--ripple-hover-opacity, 0.08);
|
|
102
58
|
}
|
|
103
59
|
|
|
104
|
-
.salty-ripple .salty-ripple-surface
|
|
60
|
+
.salty-ripple .salty-ripple-surface.--press::after {
|
|
105
61
|
opacity: var(--ripple-pressed-opacity, 0.12);
|
|
106
62
|
transition-duration: 75ms;
|
|
107
63
|
}
|
package/package.json
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "m3-ripple",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.1",
|
|
4
4
|
"description": "React TypeScript implementation of Material Design 3 Ripple component",
|
|
5
5
|
"type": "module",
|
|
6
|
+
"main": "./dist/index.cjs",
|
|
7
|
+
"module": "./dist/index.js",
|
|
6
8
|
"author": {
|
|
7
9
|
"name": "saltyAom",
|
|
8
10
|
"url": "https://github.com/SaltyAom",
|
package/bunfig.toml
DELETED
package/dist/demo.d.ts
DELETED
package/dist/demo.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"demo.d.ts","sourceRoot":"","sources":["../src/demo.tsx"],"names":[],"mappings":"AAAA;;;;GAIG;AAOH,OAAO,cAAc,CAAA;AA2IrB,QAAA,MAAM,IAAI,+CAsNT,CAAA;AAMD,eAAe,IAAI,CAAA"}
|