@nice2dev/icons-cursor 1.2.1 → 1.3.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.
- package/dist/index.cjs +14 -15
- package/dist/index.mjs +14 -15
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -141,28 +141,27 @@ ${properties}
|
|
|
141
141
|
}
|
|
142
142
|
function useCursor(IconComponent, options = {}) {
|
|
143
143
|
var _a, _b;
|
|
144
|
+
const { size, color, secondaryColor, fallback, variant } = options;
|
|
145
|
+
const hotspotX = (_a = options.hotspot) == null ? void 0 : _a.x;
|
|
146
|
+
const hotspotY = (_b = options.hotspot) == null ? void 0 : _b.y;
|
|
144
147
|
const cursor = React.useMemo(() => {
|
|
145
148
|
if (!IconComponent) {
|
|
146
149
|
return "auto";
|
|
147
150
|
}
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
options.size,
|
|
152
|
-
options.color,
|
|
153
|
-
(_a = options.hotspot) == null ? void 0 : _a.x,
|
|
154
|
-
(_b = options.hotspot) == null ? void 0 : _b.y,
|
|
155
|
-
options.fallback,
|
|
156
|
-
options.variant,
|
|
157
|
-
options.secondaryColor
|
|
158
|
-
]);
|
|
151
|
+
const hotspot = hotspotX !== void 0 && hotspotY !== void 0 ? { x: hotspotX, y: hotspotY } : void 0;
|
|
152
|
+
return buildCursor(IconComponent, { size, color, secondaryColor, fallback, variant, hotspot }).cursor;
|
|
153
|
+
}, [IconComponent, size, color, secondaryColor, fallback, variant, hotspotX, hotspotY]);
|
|
159
154
|
return { cursor };
|
|
160
155
|
}
|
|
161
156
|
function useCursors(cursors, options = {}) {
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
);
|
|
157
|
+
var _a, _b;
|
|
158
|
+
const { size, color, secondaryColor, fallback, variant } = options;
|
|
159
|
+
const hotspotX = (_a = options.hotspot) == null ? void 0 : _a.x;
|
|
160
|
+
const hotspotY = (_b = options.hotspot) == null ? void 0 : _b.y;
|
|
161
|
+
const cursorMap = React.useMemo(() => {
|
|
162
|
+
const hotspot = hotspotX !== void 0 && hotspotY !== void 0 ? { x: hotspotX, y: hotspotY } : void 0;
|
|
163
|
+
return buildCursors(cursors, { size, color, secondaryColor, fallback, variant, hotspot });
|
|
164
|
+
}, [cursors, size, color, secondaryColor, fallback, variant, hotspotX, hotspotY]);
|
|
166
165
|
const [activeCursor, setActiveCursor] = React.useState(null);
|
|
167
166
|
const style = React.useMemo(
|
|
168
167
|
() => ({
|
package/dist/index.mjs
CHANGED
|
@@ -143,28 +143,27 @@ ${properties}
|
|
|
143
143
|
}
|
|
144
144
|
function useCursor(IconComponent, options = {}) {
|
|
145
145
|
var _a, _b;
|
|
146
|
+
const { size, color, secondaryColor, fallback, variant } = options;
|
|
147
|
+
const hotspotX = (_a = options.hotspot) == null ? void 0 : _a.x;
|
|
148
|
+
const hotspotY = (_b = options.hotspot) == null ? void 0 : _b.y;
|
|
146
149
|
const cursor = useMemo(() => {
|
|
147
150
|
if (!IconComponent) {
|
|
148
151
|
return "auto";
|
|
149
152
|
}
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
options.size,
|
|
154
|
-
options.color,
|
|
155
|
-
(_a = options.hotspot) == null ? void 0 : _a.x,
|
|
156
|
-
(_b = options.hotspot) == null ? void 0 : _b.y,
|
|
157
|
-
options.fallback,
|
|
158
|
-
options.variant,
|
|
159
|
-
options.secondaryColor
|
|
160
|
-
]);
|
|
153
|
+
const hotspot = hotspotX !== void 0 && hotspotY !== void 0 ? { x: hotspotX, y: hotspotY } : void 0;
|
|
154
|
+
return buildCursor(IconComponent, { size, color, secondaryColor, fallback, variant, hotspot }).cursor;
|
|
155
|
+
}, [IconComponent, size, color, secondaryColor, fallback, variant, hotspotX, hotspotY]);
|
|
161
156
|
return { cursor };
|
|
162
157
|
}
|
|
163
158
|
function useCursors(cursors, options = {}) {
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
);
|
|
159
|
+
var _a, _b;
|
|
160
|
+
const { size, color, secondaryColor, fallback, variant } = options;
|
|
161
|
+
const hotspotX = (_a = options.hotspot) == null ? void 0 : _a.x;
|
|
162
|
+
const hotspotY = (_b = options.hotspot) == null ? void 0 : _b.y;
|
|
163
|
+
const cursorMap = useMemo(() => {
|
|
164
|
+
const hotspot = hotspotX !== void 0 && hotspotY !== void 0 ? { x: hotspotX, y: hotspotY } : void 0;
|
|
165
|
+
return buildCursors(cursors, { size, color, secondaryColor, fallback, variant, hotspot });
|
|
166
|
+
}, [cursors, size, color, secondaryColor, fallback, variant, hotspotX, hotspotY]);
|
|
168
167
|
const [activeCursor, setActiveCursor] = useState(null);
|
|
169
168
|
const style = useMemo(
|
|
170
169
|
() => ({
|
package/package.json
CHANGED