m3-ripple 1.0.1 → 1.1.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.
@@ -29,9 +29,9 @@ jobs:
29
29
  bun-version: latest
30
30
  registry-url: "https://registry.npmjs.org"
31
31
 
32
- - uses: actions/setup-node@v4
32
+ - uses: actions/setup-node@v5
33
33
  with:
34
- node-version: '20.x'
34
+ node-version: '24.x'
35
35
  registry-url: 'https://registry.npmjs.org'
36
36
 
37
37
  - name: Install packages
@@ -41,7 +41,5 @@ jobs:
41
41
  run: bun run build
42
42
 
43
43
  - name: 'Publish'
44
- env:
45
- NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
46
44
  run: |
47
- npm publish --provenance --access=public
45
+ NPM_AUTH_TOKEN="" npm publish --provenance --access=public
package/CHANGELOG.md CHANGED
@@ -1,3 +1,13 @@
1
+ # 1.1.0 - 30 Dec 2025
2
+ Improvement:
3
+ - add `pointer-events: none` to ripple element to prevent blocking pointer events on parent elements
4
+ - automatic disable ripple effect based on parent element
5
+ - add `overflow: hidden`, `border-radius: inherit` to ripple container
6
+
7
+ # 1.0.2 - 22 Jun 2025
8
+ Fix:
9
+ - Unexpected semi-colon in CSS
10
+
1
11
  # 1.0.1 - 22 Jun 2025
2
12
  Improvement:
3
13
  - Export `main`, `module`, and `types` in package.json
package/dist/index.cjs.js CHANGED
@@ -1 +1 @@
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;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Y=require("react/jsx-runtime"),r=require("react"),J=.2,K=12,Q=75,V=.35,W="forwards",ee=({hoverOpacity:k,pressedOpacity:g,disabled:l=!1,className:v="",style:D,easing:I,duration:a=150,minimumPressDuration:y=225,touchDelay:S=150})=>{const[H,M]=r.useState(!1),[U,T]=r.useState(!1),o=r.useRef(null),P=r.useRef(null),m=r.useRef(""),$=r.useRef(""),b=r.useRef(0),E=r.useRef(void 0),s=r.useRef(0),R=r.useRef(void 0),w=r.useRef(!1);r.useEffect(()=>{if(!P.current)return;const e=P.current.style;k!==void 0&&e.setProperty("--ripple-hover-opacity",k+""),g!==void 0&&e.setProperty("--ripple-pressed-opacity",g+""),a!==void 0&&a!==150&&e.setProperty("--ripple-duration",a+"ms")},[k,g,a]);const f=(e,t)=>parent.addEventListener(e,t,!0),p=(e,t)=>parent.removeEventListener(e,t,!0);r.useEffect(()=>{var t;if((t=o.current)!=null&&t.parentElement)return f("click",F),f("contextmenu",X),f("pointercancel",O),f("pointerdown",q),f("pointerenter",_),f("pointerleave",j),f("pointerup",G),()=>{p("click",F),p("contextmenu",X),p("pointercancel",O),p("pointerdown",q),p("pointerenter",_),p("pointerleave",j),p("pointerup",G)}},[l,I,a,y,S]);const h=r.useCallback(({pointerType:e})=>e==="touch",[]),u=r.useCallback(e=>{var n,c;if(l||(c=(n=o.current)==null?void 0:n.parentElement)!=null&&c.disabled||!e.isPrimary||R.current&&R.current.pointerId!==e.pointerId)return!1;if(e.type==="pointerenter"||e.type==="pointerleave")return!h(e);const t=e.buttons===1;return h(e)||t},[l,h]),N=r.useCallback(({x:e,y:t})=>{const n=o.current;if(!n)return!1;const c=n.getBoundingClientRect();return e>=c.left&&e<=c.right&&t>=c.top&&t<=c.bottom},[o]),_=r.useCallback(e=>{u(e)&&M(!0)},[u]),z=r.useCallback(()=>{const e=o.current;if(!e)return;const{height:t,width:n}=e.getBoundingClientRect(),c=Math.max(t,n),C=Math.max(V*c,Q),x=Math.floor(c*J),Z=Math.sqrt(n**2+t**2)+K;b.current=x,$.current=(Z+C)/x+"",m.current=x+"px"},[o]),B=r.useCallback(e=>{const t=o.current;if(!t)return{x:0,y:0};const n=t.getBoundingClientRect(),c=window.scrollX+n.left,C=window.scrollY+n.top;return{x:e.pageX-c,y:e.pageY-C}},[o]),L=r.useCallback(e=>{const t=o.current.parentElement;if(!t)return{startPoint:{x:0,y:0},endPoint:{x:0,y:0}};const n=t.getBoundingClientRect(),c={x:(n.width-b.current)/2,y:(n.height-b.current)/2};return{startPoint:B(e),endPoint:c}},[o,B]),d=r.useCallback(e=>{var A;const t=P.current;if(!t)return;T(!0),(A=E.current)==null||A.cancel(),z();const{startPoint:n,endPoint:c}=L(e),C=`${n.x}px, ${n.y}px`,x=`${c.x}px, ${c.y}px`;E.current=t.animate({height:[m.current,m.current],width:[m.current,m.current],transform:[`translate(${C}) scale(1)`,`translate(${x}) scale(${$.current})`]},{pseudoElement:"::after",duration:a,easing:I,fill:W})},[z,a,I,L]),i=r.useCallback(()=>{R.current=void 0,s.current=0;const e=E.current;let t=1/0;if(typeof(e==null?void 0:e.currentTime)=="number"?t=e.currentTime:e!=null&&e.currentTime&&(t=e.currentTime.to("ms").value),t>=y)return void T(!1);setTimeout(()=>{E.current===e&&T(!1)},y-t)},[y]),j=r.useCallback(e=>{u(e)&&(M(!1),s.current!==0&&i())},[i,u]),G=r.useCallback(e=>{if(u(e)){if(s.current===2){s.current=3;return}if(s.current===1){s.current=3,d(R.current);return}}},[u,d]),q=r.useCallback(async e=>{if(u(e)){if(R.current=e,!h(e)){s.current=3,d(e);return}w.current&&!N(e)||(w.current=!1,s.current=1,await new Promise(t=>{setTimeout(t,S)}),s.current===1&&(s.current=2,d(e)))}},[u,h,N,d,S]),F=r.useCallback(()=>{if(!l){if(s.current===3){i();return}s.current===0&&(d(),i())}},[l,i,d]),O=r.useCallback(e=>{u(e)&&i()},[i,u]),X=r.useCallback(()=>{l||(w.current=!0,i())},[l,i]);return Y.jsx("div",{ref:o,className:`salty-ripple${v?` ${v}`:""}`,style:D,"aria-hidden":"true",children:Y.jsx("div",{ref:P,className:`salty-ripple-surface${H?" --hover":""}${U?" --press":""}`})})};exports.Ripple=ee;
@@ -1 +1 @@
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"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.tsx"],"names":[],"mappings":"AAQA,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,4CAoVb,CAAA"}
package/dist/index.js CHANGED
@@ -1,192 +1,195 @@
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,
1
+ import { jsx as H } from "react/jsx-runtime";
2
+ import { useState as U, useRef as l, useEffect as Z, useCallback as o } from "react";
3
+ const W = 0.2, b = 12, ee = 75, te = 0.35, re = "forwards", ce = ({
4
+ hoverOpacity: T,
5
+ pressedOpacity: w,
6
6
  disabled: a = !1,
7
- className: A = "",
8
- style: G,
9
- easing: M,
10
- duration: p = 150,
11
- minimumPressDuration: C = 225,
12
- touchDelay: $ = 150
7
+ className: N = "",
8
+ style: J,
9
+ easing: S,
10
+ duration: f = 150,
11
+ minimumPressDuration: E = 225,
12
+ touchDelay: C = 150
13
13
  }) => {
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(
14
+ const [K, _] = U(!1), [Q, A] = U(!1), s = l(null), I = l(null), h = l(""), z = l(""), $ = l(0), g = l(void 0), c = l(
15
15
  0
16
16
  /* INACTIVE */
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",
17
+ ), x = l(void 0), v = l(!1);
18
+ Z(() => {
19
+ if (!I.current) return;
20
+ const e = I.current.style;
21
+ T !== void 0 && e.setProperty("--ripple-hover-opacity", T + ""), w !== void 0 && e.setProperty("--ripple-pressed-opacity", w + ""), f !== void 0 && f !== 150 && e.setProperty("--ripple-duration", f + "ms");
22
+ }, [T, w, f]);
23
+ const p = (e, t) => parent.addEventListener(e, t, !0), d = (e, t) => parent.removeEventListener(e, t, !0);
24
+ Z(() => {
25
+ var t;
26
+ if ((t = s.current) != null && t.parentElement)
27
+ return p("click", j), p("contextmenu", D), p("pointercancel", q), p("pointerdown", O), p("pointerenter", L), p("pointerleave", X), p("pointerup", Y), () => {
28
+ d("click", j), d("contextmenu", D), d("pointercancel", q), d("pointerdown", O), d("pointerenter", L), d("pointerleave", X), d("pointerup", Y);
29
+ };
30
+ }, [a, S, f, E, C]);
31
+ const R = o(
32
+ ({ pointerType: e }) => e === "touch",
25
33
  []
26
- ), s = r(
27
- (t) => {
28
- if (a || !t.isPrimary || m.current && m.current.pointerId !== t.pointerId)
34
+ ), i = o(
35
+ (e) => {
36
+ var r, n;
37
+ if (a || // @ts-ignore
38
+ (n = (r = s.current) == null ? void 0 : r.parentElement) != null && n.disabled || !e.isPrimary || x.current && x.current.pointerId !== e.pointerId)
29
39
  return !1;
30
- if (t.type === "pointerenter" || t.type === "pointerleave")
31
- return !h(t);
32
- const e = t.buttons === 1;
33
- return h(t) || e;
40
+ if (e.type === "pointerenter" || e.type === "pointerleave")
41
+ return !R(e);
42
+ const t = e.buttons === 1;
43
+ return R(e) || t;
34
44
  },
35
- [a, h]
36
- ), z = r(
45
+ [a, R]
46
+ ), B = o(
37
47
  // @ts-ignore
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;
43
- },
44
- [i]
45
- ), Y = r(
46
- (t) => {
47
- s(t) && N(!0);
48
+ ({ x: e, y: t }) => {
49
+ const r = s.current;
50
+ if (!r) return !1;
51
+ const n = r.getBoundingClientRect();
52
+ return e >= n.left && e <= n.right && t >= n.top && t <= n.bottom;
48
53
  },
49
54
  [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;
55
+ ), L = o(
56
+ (e) => {
57
+ i(e) && _(!0);
58
+ },
59
+ [i]
60
+ ), k = o(() => {
61
+ const e = s.current;
62
+ if (!e) return;
63
+ const { height: t, width: r } = e.getBoundingClientRect(), n = Math.max(t, r), P = Math.max(
64
+ te * n,
65
+ ee
66
+ ), y = Math.floor(n * W), V = Math.sqrt(r ** 2 + t ** 2) + b;
67
+ $.current = y, z.current = (V + P) / y + "", h.current = y + "px";
68
+ }, [s]), G = o(
69
+ (e) => {
70
+ const t = s.current;
71
+ if (!t) return { x: 0, y: 0 };
72
+ const r = t.getBoundingClientRect(), n = window.scrollX + r.left, P = window.scrollY + r.top;
63
73
  return {
64
- x: t.pageX - o,
65
- y: t.pageY - P
74
+ x: e.pageX - n,
75
+ y: e.pageY - P
66
76
  };
67
77
  },
68
- [i]
69
- ), L = r(
70
- (t) => {
71
- const e = i.current.parentElement;
72
- if (!e)
78
+ [s]
79
+ ), F = o(
80
+ (e) => {
81
+ const t = s.current.parentElement;
82
+ if (!t)
73
83
  return { startPoint: { x: 0, y: 0 }, endPoint: { x: 0, y: 0 } };
74
- const n = e.getBoundingClientRect(), o = {
75
- x: (n.width - T.current) / 2,
76
- y: (n.height - T.current) / 2
84
+ const r = t.getBoundingClientRect(), n = {
85
+ x: (r.width - $.current) / 2,
86
+ y: (r.height - $.current) / 2
77
87
  };
78
88
  return {
79
- startPoint: v(t),
80
- endPoint: o
89
+ startPoint: G(e),
90
+ endPoint: n
81
91
  };
82
92
  },
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(
93
+ [s, G]
94
+ ), m = o(
95
+ (e) => {
96
+ var M;
97
+ const t = I.current;
98
+ if (!t) return;
99
+ A(!0), (M = g.current) == null || M.cancel(), k();
100
+ const { startPoint: r, endPoint: n } = F(e), P = `${r.x}px, ${r.y}px`, y = `${n.x}px, ${n.y}px`;
101
+ g.current = t.animate(
92
102
  {
93
- height: [d.current, d.current],
94
- width: [d.current, d.current],
103
+ height: [h.current, h.current],
104
+ width: [h.current, h.current],
95
105
  transform: [
96
106
  `translate(${P}) scale(1)`,
97
- `translate(${R}) scale(${_.current})`
107
+ `translate(${y}) scale(${z.current})`
98
108
  ]
99
109
  },
100
110
  {
101
111
  pseudoElement: "::after",
102
- duration: p,
103
- easing: M,
104
- fill: tt
112
+ duration: f,
113
+ easing: S,
114
+ fill: re
105
115
  }
106
116
  );
107
117
  },
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);
118
+ [k, f, S, F]
119
+ ), u = o(() => {
120
+ x.current = void 0, c.current = 0;
121
+ const e = g.current;
122
+ let t = 1 / 0;
123
+ if (typeof (e == null ? void 0 : e.currentTime) == "number" ? t = e.currentTime : e != null && e.currentTime && (t = e.currentTime.to("ms").value), t >= E)
124
+ return void A(!1);
115
125
  setTimeout(() => {
116
- y.current === t && E(!1);
117
- }, C - e);
118
- }, [C]), O = r(
119
- (t) => {
120
- s(t) && (N(!1), c.current !== 0 && u());
126
+ g.current === e && A(!1);
127
+ }, E - t);
128
+ }, [E]), X = o(
129
+ (e) => {
130
+ i(e) && (_(!1), c.current !== 0 && u());
121
131
  },
122
- [u, s]
123
- ), U = r(
124
- (t) => {
125
- if (s(t)) {
132
+ [u, i]
133
+ ), Y = o(
134
+ (e) => {
135
+ if (i(e)) {
126
136
  if (c.current === 2) {
127
137
  c.current = 3;
128
138
  return;
129
139
  }
130
140
  if (c.current === 1) {
131
- c.current = 3, f(m.current);
141
+ c.current = 3, m(x.current);
132
142
  return;
133
143
  }
134
144
  }
135
145
  },
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);
146
+ [i, m]
147
+ ), O = o(
148
+ async (e) => {
149
+ if (i(e)) {
150
+ if (x.current = e, !R(e)) {
151
+ c.current = 3, m(e);
142
152
  return;
143
153
  }
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)));
154
+ v.current && !B(e) || (v.current = !1, c.current = 1, await new Promise((t) => {
155
+ setTimeout(t, C);
156
+ }), c.current === 1 && (c.current = 2, m(e)));
147
157
  }
148
158
  },
149
- [s, h, z, f, $]
150
- ), q = r(() => {
159
+ [i, R, B, m, C]
160
+ ), j = o(() => {
151
161
  if (!a) {
152
162
  if (c.current === 3) {
153
163
  u();
154
164
  return;
155
165
  }
156
- c.current === 0 && (f(), u());
166
+ c.current === 0 && (m(), u());
157
167
  }
158
- }, [a, u, f]), H = r(
159
- (t) => {
160
- s(t) && u();
168
+ }, [a, u, m]), q = o(
169
+ (e) => {
170
+ i(e) && u();
161
171
  },
162
- [u, s]
163
- ), Z = r(() => {
164
- a || (S.current = !0, u());
172
+ [u, i]
173
+ ), D = o(() => {
174
+ a || (v.current = !0, u());
165
175
  }, [a, u]);
166
- return /* @__PURE__ */ k(
176
+ return /* @__PURE__ */ H(
167
177
  "div",
168
178
  {
169
- ref: i,
170
- className: `salty-ripple${A ? ` ${A}` : ""}`,
171
- style: G,
179
+ ref: s,
180
+ className: `salty-ripple${N ? ` ${N}` : ""}`,
181
+ style: J,
172
182
  "aria-hidden": "true",
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(
183
+ children: /* @__PURE__ */ H(
181
184
  "div",
182
185
  {
183
- ref: x,
184
- className: `salty-ripple-surface${F ? " --hover" : ""}${X ? " --press" : ""}`
186
+ ref: I,
187
+ className: `salty-ripple-surface${K ? " --hover" : ""}${Q ? " --press" : ""}`
185
188
  }
186
189
  )
187
190
  }
188
191
  );
189
192
  };
190
193
  export {
191
- nt as Ripple
194
+ ce as Ripple
192
195
  };
package/dist/ripple.css CHANGED
@@ -5,6 +5,9 @@
5
5
  height: 100%;
6
6
  display: block;
7
7
  margin: auto;
8
+ pointer-events: none;
9
+ overflow: hidden;
10
+ border-radius: inherit;
8
11
  }
9
12
 
10
13
  .salty-ripple[aria-disabled='true'] {
@@ -21,7 +24,7 @@
21
24
  inset: 0;
22
25
  pointer-events: none;
23
26
  overflow: hidden;
24
- border-radius: inherit;;
27
+ border-radius: inherit;
25
28
  }
26
29
 
27
30
  .salty-ripple .salty-ripple-surface::before,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "m3-ripple",
3
- "version": "1.0.1",
3
+ "version": "1.1.0",
4
4
  "description": "React TypeScript implementation of Material Design 3 Ripple component",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",