react-simplikit 0.0.36 → 0.0.37
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/components/ImpressionArea/index.cjs +15 -14
- package/dist/components/ImpressionArea/index.d.cts +8 -6
- package/dist/index.cjs +15 -14
- package/esm/components/ImpressionArea/index.d.ts +8 -6
- package/esm/components/ImpressionArea/index.js +15 -14
- package/esm/index.js +15 -14
- package/package.json +1 -1
|
@@ -270,20 +270,21 @@ function mergeRefs(...refs) {
|
|
|
270
270
|
|
|
271
271
|
// src/components/ImpressionArea/ImpressionArea.tsx
|
|
272
272
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
273
|
-
var ImpressionArea = (0, import_react7.forwardRef)(
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
273
|
+
var ImpressionArea = (0, import_react7.forwardRef)(ImpressionAreaImpl);
|
|
274
|
+
function ImpressionAreaImpl({ as, rootMargin, areaThreshold, timeThreshold, onImpressionStart, onImpressionEnd, ...props }, ref) {
|
|
275
|
+
const Component = as ?? "div";
|
|
276
|
+
const impressionRef = useImpressionRef({
|
|
277
|
+
onImpressionStart,
|
|
278
|
+
onImpressionEnd,
|
|
279
|
+
areaThreshold,
|
|
280
|
+
timeThreshold,
|
|
281
|
+
rootMargin
|
|
282
|
+
});
|
|
283
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Component, { ref: mergeRefs(ref, impressionRef), ...props });
|
|
284
|
+
}
|
|
285
|
+
Object.assign(ImpressionArea, {
|
|
286
|
+
displayName: "ImpressionArea"
|
|
287
|
+
});
|
|
287
288
|
// Annotate the CommonJS export names for ESM import in node:
|
|
288
289
|
0 && (module.exports = {
|
|
289
290
|
ImpressionArea
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { ElementType, Ref, ReactNode } from 'react';
|
|
1
|
+
import { ElementType, ReactNode, Ref } from 'react';
|
|
3
2
|
import { UseImpressionRefOptions } from '../../hooks/useImpressionRef/index.cjs';
|
|
4
3
|
|
|
4
|
+
type Element<T extends ElementType, InstrinsicElements = T extends keyof React.JSX.IntrinsicElements ? React.JSX.IntrinsicElements[T] : HTMLElement> = InstrinsicElements extends React.ClassAttributes<infer E extends HTMLElement> ? E : HTMLElement;
|
|
5
5
|
type Props<Tag extends ElementType> = React.ComponentPropsWithoutRef<Tag> & UseImpressionRefOptions & {
|
|
6
6
|
as?: Tag;
|
|
7
|
-
ref?: Ref<HTMLElement>;
|
|
8
7
|
children?: ReactNode;
|
|
9
8
|
className?: string;
|
|
10
9
|
};
|
|
@@ -14,13 +13,14 @@ type Props<Tag extends ElementType> = React.ComponentPropsWithoutRef<Tag> & UseI
|
|
|
14
13
|
* and executes callbacks when the element enters or exits the viewport. This component uses the `useImpressionRef`
|
|
15
14
|
* hook to track the element's visibility.
|
|
16
15
|
*
|
|
17
|
-
* @
|
|
16
|
+
* @template {ElementType} T - The HTML tag to render. Defaults to `div`.
|
|
17
|
+
* @param {T} [as='div'] - The HTML tag to render. Defaults to `div`.
|
|
18
18
|
* @param {string} [rootMargin] - Margin to adjust the detection area.
|
|
19
19
|
* @param {number} [areaThreshold] - Minimum ratio of the element that must be visible (0 to 1).
|
|
20
20
|
* @param {number} [timeThreshold] - Minimum time the element must be visible (in milliseconds).
|
|
21
21
|
* @param {() => void} [onImpressionStart] - Callback function executed when the element enters the view.
|
|
22
22
|
* @param {() => void} [onImpressionEnd] - Callback function executed when the element exits the view.
|
|
23
|
-
* @param {Ref<
|
|
23
|
+
* @param {Ref<Element<T>>} [ref] - Reference to the element.
|
|
24
24
|
* @param {React.ReactNode} [children] - Child elements to be rendered inside the component.
|
|
25
25
|
* @param {string} [className] - Additional class names for styling.
|
|
26
26
|
*
|
|
@@ -40,6 +40,8 @@ type Props<Tag extends ElementType> = React.ComponentPropsWithoutRef<Tag> & UseI
|
|
|
40
40
|
* );
|
|
41
41
|
* }
|
|
42
42
|
*/
|
|
43
|
-
declare const ImpressionArea:
|
|
43
|
+
declare const ImpressionArea: <T extends ElementType = "div">(props: Props<T> & {
|
|
44
|
+
ref?: Ref<Element<T>>;
|
|
45
|
+
}) => React.ReactNode;
|
|
44
46
|
|
|
45
47
|
export { ImpressionArea };
|
package/dist/index.cjs
CHANGED
|
@@ -302,20 +302,21 @@ function mergeRefs(...refs) {
|
|
|
302
302
|
|
|
303
303
|
// src/components/ImpressionArea/ImpressionArea.tsx
|
|
304
304
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
305
|
-
var ImpressionArea = (0, import_react7.forwardRef)(
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
305
|
+
var ImpressionArea = (0, import_react7.forwardRef)(ImpressionAreaImpl);
|
|
306
|
+
function ImpressionAreaImpl({ as, rootMargin, areaThreshold, timeThreshold, onImpressionStart, onImpressionEnd, ...props }, ref) {
|
|
307
|
+
const Component = as ?? "div";
|
|
308
|
+
const impressionRef = useImpressionRef({
|
|
309
|
+
onImpressionStart,
|
|
310
|
+
onImpressionEnd,
|
|
311
|
+
areaThreshold,
|
|
312
|
+
timeThreshold,
|
|
313
|
+
rootMargin
|
|
314
|
+
});
|
|
315
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Component, { ref: mergeRefs(ref, impressionRef), ...props });
|
|
316
|
+
}
|
|
317
|
+
Object.assign(ImpressionArea, {
|
|
318
|
+
displayName: "ImpressionArea"
|
|
319
|
+
});
|
|
319
320
|
|
|
320
321
|
// src/components/Separated/Separated.tsx
|
|
321
322
|
var import_react8 = require("react");
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { ElementType, Ref, ReactNode } from 'react';
|
|
1
|
+
import { ElementType, ReactNode, Ref } from 'react';
|
|
3
2
|
import { UseImpressionRefOptions } from '../../hooks/useImpressionRef/index.js';
|
|
4
3
|
|
|
4
|
+
type Element<T extends ElementType, InstrinsicElements = T extends keyof React.JSX.IntrinsicElements ? React.JSX.IntrinsicElements[T] : HTMLElement> = InstrinsicElements extends React.ClassAttributes<infer E extends HTMLElement> ? E : HTMLElement;
|
|
5
5
|
type Props<Tag extends ElementType> = React.ComponentPropsWithoutRef<Tag> & UseImpressionRefOptions & {
|
|
6
6
|
as?: Tag;
|
|
7
|
-
ref?: Ref<HTMLElement>;
|
|
8
7
|
children?: ReactNode;
|
|
9
8
|
className?: string;
|
|
10
9
|
};
|
|
@@ -14,13 +13,14 @@ type Props<Tag extends ElementType> = React.ComponentPropsWithoutRef<Tag> & UseI
|
|
|
14
13
|
* and executes callbacks when the element enters or exits the viewport. This component uses the `useImpressionRef`
|
|
15
14
|
* hook to track the element's visibility.
|
|
16
15
|
*
|
|
17
|
-
* @
|
|
16
|
+
* @template {ElementType} T - The HTML tag to render. Defaults to `div`.
|
|
17
|
+
* @param {T} [as='div'] - The HTML tag to render. Defaults to `div`.
|
|
18
18
|
* @param {string} [rootMargin] - Margin to adjust the detection area.
|
|
19
19
|
* @param {number} [areaThreshold] - Minimum ratio of the element that must be visible (0 to 1).
|
|
20
20
|
* @param {number} [timeThreshold] - Minimum time the element must be visible (in milliseconds).
|
|
21
21
|
* @param {() => void} [onImpressionStart] - Callback function executed when the element enters the view.
|
|
22
22
|
* @param {() => void} [onImpressionEnd] - Callback function executed when the element exits the view.
|
|
23
|
-
* @param {Ref<
|
|
23
|
+
* @param {Ref<Element<T>>} [ref] - Reference to the element.
|
|
24
24
|
* @param {React.ReactNode} [children] - Child elements to be rendered inside the component.
|
|
25
25
|
* @param {string} [className] - Additional class names for styling.
|
|
26
26
|
*
|
|
@@ -40,6 +40,8 @@ type Props<Tag extends ElementType> = React.ComponentPropsWithoutRef<Tag> & UseI
|
|
|
40
40
|
* );
|
|
41
41
|
* }
|
|
42
42
|
*/
|
|
43
|
-
declare const ImpressionArea:
|
|
43
|
+
declare const ImpressionArea: <T extends ElementType = "div">(props: Props<T> & {
|
|
44
|
+
ref?: Ref<Element<T>>;
|
|
45
|
+
}) => React.ReactNode;
|
|
44
46
|
|
|
45
47
|
export { ImpressionArea };
|
|
@@ -244,20 +244,21 @@ function mergeRefs(...refs) {
|
|
|
244
244
|
|
|
245
245
|
// src/components/ImpressionArea/ImpressionArea.tsx
|
|
246
246
|
import { jsx } from "react/jsx-runtime";
|
|
247
|
-
var ImpressionArea = forwardRef(
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
247
|
+
var ImpressionArea = forwardRef(ImpressionAreaImpl);
|
|
248
|
+
function ImpressionAreaImpl({ as, rootMargin, areaThreshold, timeThreshold, onImpressionStart, onImpressionEnd, ...props }, ref) {
|
|
249
|
+
const Component = as ?? "div";
|
|
250
|
+
const impressionRef = useImpressionRef({
|
|
251
|
+
onImpressionStart,
|
|
252
|
+
onImpressionEnd,
|
|
253
|
+
areaThreshold,
|
|
254
|
+
timeThreshold,
|
|
255
|
+
rootMargin
|
|
256
|
+
});
|
|
257
|
+
return /* @__PURE__ */ jsx(Component, { ref: mergeRefs(ref, impressionRef), ...props });
|
|
258
|
+
}
|
|
259
|
+
Object.assign(ImpressionArea, {
|
|
260
|
+
displayName: "ImpressionArea"
|
|
261
|
+
});
|
|
261
262
|
export {
|
|
262
263
|
ImpressionArea
|
|
263
264
|
};
|
package/esm/index.js
CHANGED
|
@@ -244,20 +244,21 @@ function mergeRefs(...refs) {
|
|
|
244
244
|
|
|
245
245
|
// src/components/ImpressionArea/ImpressionArea.tsx
|
|
246
246
|
import { jsx } from "react/jsx-runtime";
|
|
247
|
-
var ImpressionArea = forwardRef(
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
247
|
+
var ImpressionArea = forwardRef(ImpressionAreaImpl);
|
|
248
|
+
function ImpressionAreaImpl({ as, rootMargin, areaThreshold, timeThreshold, onImpressionStart, onImpressionEnd, ...props }, ref) {
|
|
249
|
+
const Component = as ?? "div";
|
|
250
|
+
const impressionRef = useImpressionRef({
|
|
251
|
+
onImpressionStart,
|
|
252
|
+
onImpressionEnd,
|
|
253
|
+
areaThreshold,
|
|
254
|
+
timeThreshold,
|
|
255
|
+
rootMargin
|
|
256
|
+
});
|
|
257
|
+
return /* @__PURE__ */ jsx(Component, { ref: mergeRefs(ref, impressionRef), ...props });
|
|
258
|
+
}
|
|
259
|
+
Object.assign(ImpressionArea, {
|
|
260
|
+
displayName: "ImpressionArea"
|
|
261
|
+
});
|
|
261
262
|
|
|
262
263
|
// src/components/Separated/Separated.tsx
|
|
263
264
|
import { Children, Fragment, isValidElement } from "react";
|