m3-ripple 1.1.1 → 1.1.3
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 +12 -1
- package/dist/index.cjs.js +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +175 -140
- package/dist/ripple.css +4 -4
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,4 +1,15 @@
|
|
|
1
|
-
# 1.1.
|
|
1
|
+
# 1.1.3 - 3 Jan 2026
|
|
2
|
+
Fix:
|
|
3
|
+
- remove `overflow-hidden` from ripple to prevent missing ripple effect on Safari
|
|
4
|
+
|
|
5
|
+
# 1.1.2 - 2 Jan 2026
|
|
6
|
+
Improvement:
|
|
7
|
+
- add `--ripple-color` to set default ripple color
|
|
8
|
+
|
|
9
|
+
Fix:
|
|
10
|
+
- default ripple to center when using keyboard event
|
|
11
|
+
|
|
12
|
+
# 1.1.1 - 30 Dec 2025
|
|
2
13
|
Fix:
|
|
3
14
|
- ripple sharing element
|
|
4
15
|
|
package/dist/index.cjs.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Y=require("react/jsx-runtime"),n=require("react"),j=.2,q=12,X=75,Z=.35,s={INACTIVE:0,TOUCH_DELAY:1,HOLDING:2,WAITING_FOR_CLICK:3},J=({hoverOpacity:A,pressedOpacity:x,disabled:f=!1,className:S="",style:K,easing:_,duration:p=150,minimumPressDuration:T=225,touchDelay:N=150})=>{const[U,L]=n.useState(!1),[V,y]=n.useState(!1),i=n.useRef(null),h=n.useRef(null),I=n.useRef(""),b=n.useRef(""),P=n.useRef(0),E=n.useRef(void 0),o=n.useRef(s.INACTIVE),R=n.useRef(void 0),k=n.useRef(!1);n.useEffect(()=>{if(!h.current)return;const e=h.current.style;A!==void 0&&e.setProperty("--ripple-hover-opacity",A+""),x!==void 0&&e.setProperty("--ripple-pressed-opacity",x+""),p!==void 0&&p!==150&&e.setProperty("--ripple-duration",p+"ms")},[A,x,p]),n.useEffect(()=>{var c;const e=(c=i.current)==null?void 0:c.parentElement;if(!e)return;const t=(r,u)=>e.addEventListener(r,u,!0);return t("click",z),t("contextmenu",F),t("pointercancel",B),t("pointerdown",H),t("pointerenter",w),t("pointerleave",M),t("pointerup",D),()=>{const r=(u,d)=>e.removeEventListener(u,d,!0);r("click",z),r("contextmenu",F),r("pointercancel",B),r("pointerdown",H),r("pointerenter",w),r("pointerleave",M),r("pointerup",D)}},[f,_,p,T,N]);const m=n.useCallback(({pointerType:e})=>e==="touch",[]),l=n.useCallback(e=>{var c,r;if(f||(r=(c=i.current)==null?void 0:c.parentElement)!=null&&r.disabled||!e.isPrimary||R.current&&R.current.pointerId!==e.pointerId)return!1;if(e.type==="pointerenter"||e.type==="pointerleave")return!m(e);const t=e.buttons===1;return m(e)||t},[f,m]),O=n.useCallback(({x:e,y:t})=>{const c=i.current;if(!c)return!1;const r=c.getBoundingClientRect();return e>=r.left&&e<=r.right&&t>=r.top&&t<=r.bottom},[i]),w=n.useCallback(e=>{l(e)&&L(!0)},[l]),G=n.useCallback(()=>{const e=i.current;if(!e)return;const{height:t,width:c}=e.getBoundingClientRect(),r=Math.max(t,c),u=Math.max(Z*r,X),d=Math.floor(r*j),W=Math.sqrt(c**2+t**2)+q;P.current=d,b.current=(W+u)/d+"",I.current=d+"px"},[i]),$=n.useCallback(e=>{const t=i.current;if(!t)return{x:0,y:0};const c=t.getBoundingClientRect(),r=window.scrollX+c.left,u=window.scrollY+c.top;return{x:e.pageX-r,y:e.pageY-u}},[i]),v=n.useCallback(e=>{var u;const t=(u=i.current)==null?void 0:u.parentElement;if(!t)return{startPoint:{x:0,y:0},endPoint:{x:0,y:0}};const c=t.getBoundingClientRect(),r={x:(c.width-P.current)/2,y:(c.height-P.current)/2};return{startPoint:e?$(e):r,endPoint:r}},[i,$]),C=n.useCallback(e=>{var g;const t=h.current;if(!t)return;y(!0),(g=E.current)==null||g.cancel(),G();const{startPoint:c,endPoint:r}=v(e),u=`${c.x}px,${c.y}px`,d=`${r.x}px,${r.y}px`;E.current=t.animate({height:[I.current,I.current],width:[I.current,I.current],transform:[`translate(${u}) scale(1)`,`translate(${d}) scale(${b.current})`]},{pseudoElement:"::after",duration:p,easing:_,fill:"forwards"})},[G,p,_,v]),a=n.useCallback(()=>{R.current=void 0,o.current=s.INACTIVE;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>=T)return void y(!1);setTimeout(()=>{E.current===e&&y(!1)},T-t)},[T]),M=n.useCallback(e=>{l(e)&&(L(!1),o.current!==s.INACTIVE&&a())},[a,l]),D=n.useCallback(e=>{if(l(e)){if(o.current===s.HOLDING){o.current=s.WAITING_FOR_CLICK;return}if(o.current===s.TOUCH_DELAY){o.current=s.WAITING_FOR_CLICK,C(R.current);return}}},[l,C]),H=n.useCallback(e=>{if(l(e)){if(R.current=e,!m(e)){o.current=s.WAITING_FOR_CLICK,C(e);return}k.current&&!O(e)||(k.current=!1,o.current=s.TOUCH_DELAY,setTimeout(()=>{o.current===s.TOUCH_DELAY&&(o.current=s.HOLDING,C(e))},N))}},[l,m,O,C,N]),z=n.useCallback(e=>{if(!f){if(o.current===s.WAITING_FOR_CLICK){a();return}o.current===s.INACTIVE&&(C(e),a())}},[f,a,C]),B=n.useCallback(e=>{l(e)&&a()},[a,l]),F=n.useCallback(()=>{f||(k.current=!0,a())},[f,a]);return Y.jsx("div",{ref:i,className:`salty-ripple${S?` ${S}`:""}`,style:K,"aria-hidden":"true",children:Y.jsx("div",{ref:h,className:`salty-ripple-surface${U?" --hover":""}${V?" --press":""}`})})};exports.Ripple=J;
|
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":"AAOA,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,4CAyVb,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -1,196 +1,231 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { useState as
|
|
3
|
-
const
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
1
|
+
import { jsx as U } from "react/jsx-runtime";
|
|
2
|
+
import { useState as V, useRef as a, useEffect as W, useCallback as o } from "react";
|
|
3
|
+
const J = 0.2, Q = 12, b = 75, tt = 0.35, c = {
|
|
4
|
+
/**
|
|
5
|
+
* Initial state of the control, no touch in progress.
|
|
6
|
+
*
|
|
7
|
+
* Transitions:
|
|
8
|
+
* - on touch down: transition to `TOUCH_DELAY`.
|
|
9
|
+
* - on mouse down: transition to `WAITING_FOR_CLICK`.
|
|
10
|
+
*/
|
|
11
|
+
INACTIVE: 0,
|
|
12
|
+
/**
|
|
13
|
+
* Touch down has been received, waiting to determine if it's a swipe or
|
|
14
|
+
* scroll.
|
|
15
|
+
*
|
|
16
|
+
* Transitions:
|
|
17
|
+
* - on touch up: begin press; transition to `WAITING_FOR_CLICK`.
|
|
18
|
+
* - on cancel: transition to `INACTIVE`.
|
|
19
|
+
* - after `TOUCH_DELAY_MS`: begin press; transition to `HOLDING`.
|
|
20
|
+
*/
|
|
21
|
+
TOUCH_DELAY: 1,
|
|
22
|
+
/**
|
|
23
|
+
* A touch has been deemed to be a press
|
|
24
|
+
*
|
|
25
|
+
* Transitions:
|
|
26
|
+
* - on up: transition to `WAITING_FOR_CLICK`.
|
|
27
|
+
*/
|
|
28
|
+
HOLDING: 2,
|
|
29
|
+
/**
|
|
30
|
+
* The user touch has finished, transition into rest state.
|
|
31
|
+
*
|
|
32
|
+
* Transitions:
|
|
33
|
+
* - on click end press; transition to `INACTIVE`.
|
|
34
|
+
*/
|
|
35
|
+
WAITING_FOR_CLICK: 3
|
|
36
|
+
}, nt = ({
|
|
37
|
+
hoverOpacity: _,
|
|
38
|
+
pressedOpacity: x,
|
|
39
|
+
disabled: p = !1,
|
|
40
|
+
className: O = "",
|
|
41
|
+
style: X,
|
|
42
|
+
easing: N,
|
|
43
|
+
duration: d = 150,
|
|
44
|
+
minimumPressDuration: E = 225,
|
|
45
|
+
touchDelay: P = 150
|
|
13
46
|
}) => {
|
|
14
|
-
const [
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
const e = y.current.style;
|
|
21
|
-
I !== void 0 && e.setProperty("--ripple-hover-opacity", I + ""), g !== void 0 && e.setProperty("--ripple-pressed-opacity", g + ""), p !== void 0 && p !== 150 && e.setProperty("--ripple-duration", p + "ms");
|
|
22
|
-
}, [I, g, p]), H(() => {
|
|
47
|
+
const [j, w] = V(!1), [q, y] = V(!1), u = a(null), R = a(null), C = a(""), G = a(""), L = a(0), A = a(void 0), s = a(c.INACTIVE), h = a(void 0), g = a(!1);
|
|
48
|
+
W(() => {
|
|
49
|
+
if (!R.current) return;
|
|
50
|
+
const t = R.current.style;
|
|
51
|
+
_ !== void 0 && t.setProperty("--ripple-hover-opacity", _ + ""), x !== void 0 && t.setProperty("--ripple-pressed-opacity", x + ""), d !== void 0 && d !== 150 && t.setProperty("--ripple-duration", d + "ms");
|
|
52
|
+
}, [_, x, d]), W(() => {
|
|
23
53
|
var n;
|
|
24
|
-
const
|
|
25
|
-
if (!
|
|
26
|
-
const
|
|
27
|
-
return
|
|
28
|
-
const r = (
|
|
29
|
-
r("click", Y), r("contextmenu",
|
|
54
|
+
const t = (n = u.current) == null ? void 0 : n.parentElement;
|
|
55
|
+
if (!t) return;
|
|
56
|
+
const e = (r, i) => t.addEventListener(r, i, !0);
|
|
57
|
+
return e("click", Y), e("contextmenu", K), e("pointercancel", k), e("pointerdown", F), e("pointerenter", v), e("pointerleave", z), e("pointerup", B), () => {
|
|
58
|
+
const r = (i, m) => t.removeEventListener(i, m, !0);
|
|
59
|
+
r("click", Y), r("contextmenu", K), r("pointercancel", k), r("pointerdown", F), r("pointerenter", v), r("pointerleave", z), r("pointerup", B);
|
|
30
60
|
};
|
|
31
|
-
}, [
|
|
32
|
-
const
|
|
33
|
-
({ pointerType:
|
|
61
|
+
}, [p, N, d, E, P]);
|
|
62
|
+
const T = o(
|
|
63
|
+
({ pointerType: t }) => t === "touch",
|
|
34
64
|
[]
|
|
35
|
-
),
|
|
36
|
-
(
|
|
65
|
+
), l = o(
|
|
66
|
+
(t) => {
|
|
37
67
|
var n, r;
|
|
38
|
-
if (
|
|
39
|
-
(r = (n =
|
|
68
|
+
if (p || // @ts-ignore
|
|
69
|
+
(r = (n = u.current) == null ? void 0 : n.parentElement) != null && r.disabled || !t.isPrimary || h.current && h.current.pointerId !== t.pointerId)
|
|
40
70
|
return !1;
|
|
41
|
-
if (
|
|
42
|
-
return !
|
|
43
|
-
const
|
|
44
|
-
return
|
|
71
|
+
if (t.type === "pointerenter" || t.type === "pointerleave")
|
|
72
|
+
return !T(t);
|
|
73
|
+
const e = t.buttons === 1;
|
|
74
|
+
return T(t) || e;
|
|
45
75
|
},
|
|
46
|
-
[
|
|
47
|
-
),
|
|
76
|
+
[p, T]
|
|
77
|
+
), $ = o(
|
|
48
78
|
// @ts-ignore
|
|
49
|
-
({ x:
|
|
50
|
-
const n =
|
|
79
|
+
({ x: t, y: e }) => {
|
|
80
|
+
const n = u.current;
|
|
51
81
|
if (!n) return !1;
|
|
52
82
|
const r = n.getBoundingClientRect();
|
|
53
|
-
return
|
|
83
|
+
return t >= r.left && t <= r.right && e >= r.top && e <= r.bottom;
|
|
54
84
|
},
|
|
55
|
-
[
|
|
56
|
-
),
|
|
57
|
-
(
|
|
58
|
-
|
|
85
|
+
[u]
|
|
86
|
+
), v = o(
|
|
87
|
+
(t) => {
|
|
88
|
+
l(t) && w(!0);
|
|
59
89
|
},
|
|
60
|
-
[
|
|
61
|
-
),
|
|
62
|
-
const
|
|
63
|
-
if (!
|
|
64
|
-
const { height:
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
), m = Math.floor(r *
|
|
68
|
-
|
|
69
|
-
}, [
|
|
70
|
-
(
|
|
71
|
-
const
|
|
72
|
-
if (!
|
|
73
|
-
const n =
|
|
90
|
+
[l]
|
|
91
|
+
), M = o(() => {
|
|
92
|
+
const t = u.current;
|
|
93
|
+
if (!t) return;
|
|
94
|
+
const { height: e, width: n } = t.getBoundingClientRect(), r = Math.max(e, n), i = Math.max(
|
|
95
|
+
tt * r,
|
|
96
|
+
b
|
|
97
|
+
), m = Math.floor(r * J), Z = Math.sqrt(n ** 2 + e ** 2) + Q;
|
|
98
|
+
L.current = m, G.current = (Z + i) / m + "", C.current = m + "px";
|
|
99
|
+
}, [u]), D = o(
|
|
100
|
+
(t) => {
|
|
101
|
+
const e = u.current;
|
|
102
|
+
if (!e) return { x: 0, y: 0 };
|
|
103
|
+
const n = e.getBoundingClientRect(), r = window.scrollX + n.left, i = window.scrollY + n.top;
|
|
74
104
|
return {
|
|
75
|
-
x:
|
|
76
|
-
y:
|
|
105
|
+
x: t.pageX - r,
|
|
106
|
+
y: t.pageY - i
|
|
77
107
|
};
|
|
78
108
|
},
|
|
79
|
-
[
|
|
80
|
-
),
|
|
81
|
-
(
|
|
82
|
-
|
|
83
|
-
|
|
109
|
+
[u]
|
|
110
|
+
), H = o(
|
|
111
|
+
(t) => {
|
|
112
|
+
var i;
|
|
113
|
+
const e = (i = u.current) == null ? void 0 : i.parentElement;
|
|
114
|
+
if (!e)
|
|
84
115
|
return { startPoint: { x: 0, y: 0 }, endPoint: { x: 0, y: 0 } };
|
|
85
|
-
const n =
|
|
86
|
-
x: (n.width -
|
|
87
|
-
y: (n.height -
|
|
116
|
+
const n = e.getBoundingClientRect(), r = {
|
|
117
|
+
x: (n.width - L.current) / 2,
|
|
118
|
+
y: (n.height - L.current) / 2
|
|
88
119
|
};
|
|
89
120
|
return {
|
|
90
|
-
|
|
121
|
+
// If using keyboard, start in the center
|
|
122
|
+
startPoint: t ? D(t) : r,
|
|
91
123
|
endPoint: r
|
|
92
124
|
};
|
|
93
125
|
},
|
|
94
|
-
[
|
|
95
|
-
),
|
|
96
|
-
(
|
|
97
|
-
var
|
|
98
|
-
const
|
|
99
|
-
if (!
|
|
100
|
-
|
|
101
|
-
const { startPoint: n, endPoint: r } =
|
|
102
|
-
|
|
126
|
+
[u, D]
|
|
127
|
+
), I = o(
|
|
128
|
+
(t) => {
|
|
129
|
+
var S;
|
|
130
|
+
const e = R.current;
|
|
131
|
+
if (!e) return;
|
|
132
|
+
y(!0), (S = A.current) == null || S.cancel(), M();
|
|
133
|
+
const { startPoint: n, endPoint: r } = H(t), i = `${n.x}px,${n.y}px`, m = `${r.x}px,${r.y}px`;
|
|
134
|
+
A.current = e.animate(
|
|
103
135
|
{
|
|
104
|
-
height: [
|
|
105
|
-
width: [
|
|
136
|
+
height: [C.current, C.current],
|
|
137
|
+
width: [C.current, C.current],
|
|
106
138
|
transform: [
|
|
107
|
-
`translate(${
|
|
108
|
-
`translate(${m}) scale(${
|
|
139
|
+
`translate(${i}) scale(1)`,
|
|
140
|
+
`translate(${m}) scale(${G.current})`
|
|
109
141
|
]
|
|
110
142
|
},
|
|
111
143
|
{
|
|
112
144
|
pseudoElement: "::after",
|
|
113
|
-
duration:
|
|
114
|
-
easing:
|
|
115
|
-
fill:
|
|
145
|
+
duration: d,
|
|
146
|
+
easing: N,
|
|
147
|
+
fill: "forwards"
|
|
116
148
|
}
|
|
117
149
|
);
|
|
118
150
|
},
|
|
119
|
-
[
|
|
120
|
-
),
|
|
121
|
-
|
|
122
|
-
const
|
|
123
|
-
let
|
|
124
|
-
if (typeof (
|
|
125
|
-
return void
|
|
151
|
+
[M, d, N, H]
|
|
152
|
+
), f = o(() => {
|
|
153
|
+
h.current = void 0, s.current = c.INACTIVE;
|
|
154
|
+
const t = A.current;
|
|
155
|
+
let e = 1 / 0;
|
|
156
|
+
if (typeof (t == null ? void 0 : t.currentTime) == "number" ? e = t.currentTime : t != null && t.currentTime && (e = t.currentTime.to("ms").value), e >= E)
|
|
157
|
+
return void y(!1);
|
|
126
158
|
setTimeout(() => {
|
|
127
|
-
|
|
128
|
-
},
|
|
129
|
-
}, [
|
|
130
|
-
(
|
|
131
|
-
|
|
159
|
+
A.current === t && y(!1);
|
|
160
|
+
}, E - e);
|
|
161
|
+
}, [E]), z = o(
|
|
162
|
+
(t) => {
|
|
163
|
+
l(t) && (w(!1), s.current !== c.INACTIVE && f());
|
|
132
164
|
},
|
|
133
|
-
[
|
|
134
|
-
),
|
|
135
|
-
(
|
|
136
|
-
if (
|
|
137
|
-
if (
|
|
138
|
-
|
|
165
|
+
[f, l]
|
|
166
|
+
), B = o(
|
|
167
|
+
(t) => {
|
|
168
|
+
if (l(t)) {
|
|
169
|
+
if (s.current === c.HOLDING) {
|
|
170
|
+
s.current = c.WAITING_FOR_CLICK;
|
|
139
171
|
return;
|
|
140
172
|
}
|
|
141
|
-
if (
|
|
142
|
-
|
|
173
|
+
if (s.current === c.TOUCH_DELAY) {
|
|
174
|
+
s.current = c.WAITING_FOR_CLICK, I(h.current);
|
|
143
175
|
return;
|
|
144
176
|
}
|
|
145
177
|
}
|
|
146
178
|
},
|
|
147
|
-
[
|
|
148
|
-
),
|
|
149
|
-
|
|
150
|
-
if (
|
|
151
|
-
if (
|
|
152
|
-
|
|
179
|
+
[l, I]
|
|
180
|
+
), F = o(
|
|
181
|
+
(t) => {
|
|
182
|
+
if (l(t)) {
|
|
183
|
+
if (h.current = t, !T(t)) {
|
|
184
|
+
s.current = c.WAITING_FOR_CLICK, I(t);
|
|
153
185
|
return;
|
|
154
186
|
}
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
}
|
|
187
|
+
g.current && !$(t) || (g.current = !1, s.current = c.TOUCH_DELAY, setTimeout(() => {
|
|
188
|
+
s.current === c.TOUCH_DELAY && (s.current = c.HOLDING, I(t));
|
|
189
|
+
}, P));
|
|
158
190
|
}
|
|
159
191
|
},
|
|
160
|
-
[
|
|
161
|
-
), Y = o(
|
|
162
|
-
|
|
163
|
-
if (
|
|
164
|
-
|
|
165
|
-
|
|
192
|
+
[l, T, $, I, P]
|
|
193
|
+
), Y = o(
|
|
194
|
+
(t) => {
|
|
195
|
+
if (!p) {
|
|
196
|
+
if (s.current === c.WAITING_FOR_CLICK) {
|
|
197
|
+
f();
|
|
198
|
+
return;
|
|
199
|
+
}
|
|
200
|
+
s.current === c.INACTIVE && (I(t), f());
|
|
166
201
|
}
|
|
167
|
-
c.current === 0 && (d(), u());
|
|
168
|
-
}
|
|
169
|
-
}, [a, u, d]), O = o(
|
|
170
|
-
(e) => {
|
|
171
|
-
i(e) && u();
|
|
172
202
|
},
|
|
173
|
-
[
|
|
174
|
-
),
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
203
|
+
[p, f, I]
|
|
204
|
+
), k = o(
|
|
205
|
+
(t) => {
|
|
206
|
+
l(t) && f();
|
|
207
|
+
},
|
|
208
|
+
[f, l]
|
|
209
|
+
), K = o(() => {
|
|
210
|
+
p || (g.current = !0, f());
|
|
211
|
+
}, [p, f]);
|
|
212
|
+
return /* @__PURE__ */ U(
|
|
178
213
|
"div",
|
|
179
214
|
{
|
|
180
|
-
ref:
|
|
181
|
-
className: `salty-ripple${
|
|
182
|
-
style:
|
|
215
|
+
ref: u,
|
|
216
|
+
className: `salty-ripple${O ? ` ${O}` : ""}`,
|
|
217
|
+
style: X,
|
|
183
218
|
"aria-hidden": "true",
|
|
184
|
-
children: /* @__PURE__ */
|
|
219
|
+
children: /* @__PURE__ */ U(
|
|
185
220
|
"div",
|
|
186
221
|
{
|
|
187
|
-
ref:
|
|
188
|
-
className: `salty-ripple-surface${
|
|
222
|
+
ref: R,
|
|
223
|
+
className: `salty-ripple-surface${j ? " --hover" : ""}${q ? " --press" : ""}`
|
|
189
224
|
}
|
|
190
225
|
)
|
|
191
226
|
}
|
|
192
227
|
);
|
|
193
228
|
};
|
|
194
229
|
export {
|
|
195
|
-
|
|
230
|
+
nt as Ripple
|
|
196
231
|
};
|
package/dist/ripple.css
CHANGED
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
.salty-ripple .salty-ripple-surface {
|
|
24
24
|
inset: 0;
|
|
25
25
|
pointer-events: none;
|
|
26
|
-
overflow: hidden
|
|
26
|
+
/*overflow: hidden;*/
|
|
27
27
|
border-radius: inherit;
|
|
28
28
|
}
|
|
29
29
|
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
.salty-ripple .salty-ripple-surface::before {
|
|
38
38
|
width: 100%;
|
|
39
39
|
height: 100%;
|
|
40
|
-
background-color: currentColor;
|
|
40
|
+
background-color: var(--ripple-color, currentColor);
|
|
41
41
|
inset: 0;
|
|
42
42
|
transition:
|
|
43
43
|
opacity var(--ripple-duration, 150ms),
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
inset: 0;
|
|
49
49
|
background: radial-gradient(
|
|
50
50
|
closest-side,
|
|
51
|
-
currentColor max(100% - 70px, 65%),
|
|
51
|
+
var(--ripple-color, currentColor) max(100% - 70px, 65%),
|
|
52
52
|
transparent 100%
|
|
53
53
|
);
|
|
54
54
|
transform-origin: center center;
|
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
}
|
|
57
57
|
|
|
58
58
|
.salty-ripple .salty-ripple-surface.--hover::before {
|
|
59
|
-
background-color: currentColor;
|
|
59
|
+
background-color: var(--ripple-color, currentColor);
|
|
60
60
|
opacity: var(--ripple-hover-opacity, 0.08);
|
|
61
61
|
}
|
|
62
62
|
|