@canlooks/can-ui 0.0.72 → 0.0.74
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.
|
@@ -4,6 +4,7 @@ exports.Icon = Icon;
|
|
|
4
4
|
const jsx_runtime_1 = require("@emotion/react/jsx-runtime");
|
|
5
5
|
const react_fontawesome_1 = require("@fortawesome/react-fontawesome");
|
|
6
6
|
const utils_1 = require("../../utils");
|
|
7
|
+
const classes = (0, utils_1.defineInnerClasses)('icon');
|
|
7
8
|
function Icon({ color, ...props }) {
|
|
8
|
-
return (0, jsx_runtime_1.jsx)(react_fontawesome_1.FontAwesomeIcon, { ...props, color: (0, utils_1.useColor)(color) });
|
|
9
|
+
return ((0, jsx_runtime_1.jsx)(react_fontawesome_1.FontAwesomeIcon, { ...props, className: (0, utils_1.clsx)(classes.root, props.className), color: (0, utils_1.useColor)(color) }));
|
|
9
10
|
}
|
|
@@ -14,7 +14,10 @@ exports.TouchRipple = (0, react_1.memo)(({ color = 'primary', container, effectC
|
|
|
14
14
|
(0, react_1.useEffect)(() => {
|
|
15
15
|
const parentElement = containerEl.current ?? ref.current.parentElement;
|
|
16
16
|
if (parentElement) {
|
|
17
|
-
const pointerDown = ({
|
|
17
|
+
const pointerDown = ({ clientX, clientY }) => {
|
|
18
|
+
const { left, top } = parentElement.getBoundingClientRect();
|
|
19
|
+
const offsetX = clientX - left;
|
|
20
|
+
const offsetY = clientY - top;
|
|
18
21
|
const maxWidth = Math.max(parentElement.clientWidth - offsetX, offsetX);
|
|
19
22
|
const maxHeight = Math.max(parentElement.clientHeight - offsetY, offsetY);
|
|
20
23
|
setRipples(o => {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx } from "@emotion/react/jsx-runtime";
|
|
2
2
|
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
|
|
3
|
-
import { useColor } from '../../utils';
|
|
3
|
+
import { clsx, defineInnerClasses, useColor } from '../../utils';
|
|
4
|
+
const classes = defineInnerClasses('icon');
|
|
4
5
|
export function Icon({ color, ...props }) {
|
|
5
|
-
return _jsx(FontAwesomeIcon, { ...props, color: useColor(color) });
|
|
6
|
+
return (_jsx(FontAwesomeIcon, { ...props, className: clsx(classes.root, props.className), color: useColor(color) }));
|
|
6
7
|
}
|
|
@@ -11,7 +11,10 @@ export const TouchRipple = memo(({ color = 'primary', container, effectContainer
|
|
|
11
11
|
useEffect(() => {
|
|
12
12
|
const parentElement = containerEl.current ?? ref.current.parentElement;
|
|
13
13
|
if (parentElement) {
|
|
14
|
-
const pointerDown = ({
|
|
14
|
+
const pointerDown = ({ clientX, clientY }) => {
|
|
15
|
+
const { left, top } = parentElement.getBoundingClientRect();
|
|
16
|
+
const offsetX = clientX - left;
|
|
17
|
+
const offsetY = clientY - top;
|
|
15
18
|
const maxWidth = Math.max(parentElement.clientWidth - offsetX, offsetX);
|
|
16
19
|
const maxHeight = Math.max(parentElement.clientHeight - offsetY, offsetY);
|
|
17
20
|
setRipples(o => {
|