@trackunit/react-drawer 1.12.0 → 1.12.1

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/index.cjs.js CHANGED
@@ -369,16 +369,15 @@ const getElementYTranslation = (element) => {
369
369
  const isPassedThreshold = (dragDistance, threshold) => {
370
370
  return dragDistance >= threshold;
371
371
  };
372
- /**
373
- * Hook for handling swipe events on the drawer.
374
372
  /**
375
373
  * Hook for handling swipe events on the drawer.
376
374
  *
377
- * @param closingThreshold - The fraction (0-1) of the drawer's height needed to trigger open/close.
378
- * @param onCloseGesture - Callback when a close gesture is detected (optional).
379
- * @param onOpenGesture - Callback when an open gesture is detected (optional).
380
- * @param onDragEnd - Callback when the drag/swipe gesture ends. Receives drag distance and velocity (optional).
381
- * @param constrainDrag - Function to constrain/deny drag. Receives drag distance, returns boolean (optional).
375
+ * @param options - The hook options.
376
+ * @param options.closingThreshold - The fraction (0-1) of the drawer's height needed to trigger open/close.
377
+ * @param options.onCloseGesture - Callback when a close gesture is detected (optional).
378
+ * @param options.onOpenGesture - Callback when an open gesture is detected (optional).
379
+ * @param options.onDragEnd - Callback when the drag/swipe gesture ends. Receives drag distance and velocity (optional).
380
+ * @param options.constrainDrag - Function to constrain/deny drag. Receives drag distance, returns boolean (optional).
382
381
  */
383
382
  const useSwipeHandlers = ({ closingThreshold, onCloseGesture, onOpenGesture, onDragEnd, constrainDrag, }) => {
384
383
  const [isDragging, setIsDragging] = react.useState(false);
@@ -442,9 +441,10 @@ const useSwipeHandlers = ({ closingThreshold, onCloseGesture, onOpenGesture, onD
442
441
  /**
443
442
  * DrawerPuller is a React component that renders a puller element for a swipeable drawer.
444
443
  *
445
- * @param {CommonProps} props - The props for the DrawerPuller component.
446
- * @param {string} [props.className] - Additional class names to apply to the puller element.
447
- * @param {Ref<HTMLDivElement>} ref - The ref to be forwarded to the root div element.
444
+ * @param props - The props for the DrawerPuller component.
445
+ * @param props.className - Additional class names to apply to the puller element.
446
+ * @param props.ref - The ref to be forwarded to the root div element.
447
+ * @returns {ReactElement} The drawer puller element.
448
448
  */
449
449
  const DrawerPuller = ({ className, ref, ...props }) => {
450
450
  return (jsxRuntime.jsx("div", { className: cvaPuller({ className }), "data-testid": "drawer-puller", ...props, ref: ref, children: jsxRuntime.jsx("div", { className: cvaPullerIcon() }) }));
package/index.esm.js CHANGED
@@ -367,16 +367,15 @@ const getElementYTranslation = (element) => {
367
367
  const isPassedThreshold = (dragDistance, threshold) => {
368
368
  return dragDistance >= threshold;
369
369
  };
370
- /**
371
- * Hook for handling swipe events on the drawer.
372
370
  /**
373
371
  * Hook for handling swipe events on the drawer.
374
372
  *
375
- * @param closingThreshold - The fraction (0-1) of the drawer's height needed to trigger open/close.
376
- * @param onCloseGesture - Callback when a close gesture is detected (optional).
377
- * @param onOpenGesture - Callback when an open gesture is detected (optional).
378
- * @param onDragEnd - Callback when the drag/swipe gesture ends. Receives drag distance and velocity (optional).
379
- * @param constrainDrag - Function to constrain/deny drag. Receives drag distance, returns boolean (optional).
373
+ * @param options - The hook options.
374
+ * @param options.closingThreshold - The fraction (0-1) of the drawer's height needed to trigger open/close.
375
+ * @param options.onCloseGesture - Callback when a close gesture is detected (optional).
376
+ * @param options.onOpenGesture - Callback when an open gesture is detected (optional).
377
+ * @param options.onDragEnd - Callback when the drag/swipe gesture ends. Receives drag distance and velocity (optional).
378
+ * @param options.constrainDrag - Function to constrain/deny drag. Receives drag distance, returns boolean (optional).
380
379
  */
381
380
  const useSwipeHandlers = ({ closingThreshold, onCloseGesture, onOpenGesture, onDragEnd, constrainDrag, }) => {
382
381
  const [isDragging, setIsDragging] = useState(false);
@@ -440,9 +439,10 @@ const useSwipeHandlers = ({ closingThreshold, onCloseGesture, onOpenGesture, onD
440
439
  /**
441
440
  * DrawerPuller is a React component that renders a puller element for a swipeable drawer.
442
441
  *
443
- * @param {CommonProps} props - The props for the DrawerPuller component.
444
- * @param {string} [props.className] - Additional class names to apply to the puller element.
445
- * @param {Ref<HTMLDivElement>} ref - The ref to be forwarded to the root div element.
442
+ * @param props - The props for the DrawerPuller component.
443
+ * @param props.className - Additional class names to apply to the puller element.
444
+ * @param props.ref - The ref to be forwarded to the root div element.
445
+ * @returns {ReactElement} The drawer puller element.
446
446
  */
447
447
  const DrawerPuller = ({ className, ref, ...props }) => {
448
448
  return (jsx("div", { className: cvaPuller({ className }), "data-testid": "drawer-puller", ...props, ref: ref, children: jsx("div", { className: cvaPullerIcon() }) }));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trackunit/react-drawer",
3
- "version": "1.12.0",
3
+ "version": "1.12.1",
4
4
  "repository": "https://github.com/Trackunit/manager",
5
5
  "license": "SEE LICENSE IN LICENSE.txt",
6
6
  "engines": {
@@ -9,10 +9,10 @@
9
9
  "dependencies": {
10
10
  "react": "19.0.0",
11
11
  "react-swipeable": "^7.0.1",
12
- "@trackunit/react-components": "1.16.0",
13
- "@trackunit/css-class-variance-utilities": "1.11.19",
14
- "@trackunit/ui-icons": "1.11.18",
15
- "@trackunit/i18n-library-translation": "1.12.0"
12
+ "@trackunit/react-components": "1.16.1",
13
+ "@trackunit/css-class-variance-utilities": "1.11.20",
14
+ "@trackunit/ui-icons": "1.11.19",
15
+ "@trackunit/i18n-library-translation": "1.12.1"
16
16
  },
17
17
  "module": "./index.esm.js",
18
18
  "main": "./index.cjs.js",
@@ -1,15 +1,16 @@
1
1
  import { CommonProps } from "@trackunit/react-components";
2
- import { type Ref } from "react";
2
+ import { ReactElement, type Ref } from "react";
3
3
  /**
4
4
  * DrawerPuller is a React component that renders a puller element for a swipeable drawer.
5
5
  *
6
- * @param {CommonProps} props - The props for the DrawerPuller component.
7
- * @param {string} [props.className] - Additional class names to apply to the puller element.
8
- * @param {Ref<HTMLDivElement>} ref - The ref to be forwarded to the root div element.
6
+ * @param props - The props for the DrawerPuller component.
7
+ * @param props.className - Additional class names to apply to the puller element.
8
+ * @param props.ref - The ref to be forwarded to the root div element.
9
+ * @returns {ReactElement} The drawer puller element.
9
10
  */
10
11
  export declare const DrawerPuller: {
11
12
  ({ className, ref, ...props }: CommonProps & {
12
13
  ref?: Ref<HTMLDivElement>;
13
- }): import("react/jsx-runtime").JSX.Element;
14
+ }): ReactElement;
14
15
  displayName: string;
15
16
  };
@@ -12,16 +12,15 @@ interface UseSwipeHandlersProps {
12
12
  * @returns {number} - The Y translation value of the element. Returns 0 if the element is not provided or if the transform style is "none".
13
13
  */
14
14
  export declare const getElementYTranslation: (element?: HTMLElement | null) => number;
15
- /**
16
- * Hook for handling swipe events on the drawer.
17
15
  /**
18
16
  * Hook for handling swipe events on the drawer.
19
17
  *
20
- * @param closingThreshold - The fraction (0-1) of the drawer's height needed to trigger open/close.
21
- * @param onCloseGesture - Callback when a close gesture is detected (optional).
22
- * @param onOpenGesture - Callback when an open gesture is detected (optional).
23
- * @param onDragEnd - Callback when the drag/swipe gesture ends. Receives drag distance and velocity (optional).
24
- * @param constrainDrag - Function to constrain/deny drag. Receives drag distance, returns boolean (optional).
18
+ * @param options - The hook options.
19
+ * @param options.closingThreshold - The fraction (0-1) of the drawer's height needed to trigger open/close.
20
+ * @param options.onCloseGesture - Callback when a close gesture is detected (optional).
21
+ * @param options.onOpenGesture - Callback when an open gesture is detected (optional).
22
+ * @param options.onDragEnd - Callback when the drag/swipe gesture ends. Receives drag distance and velocity (optional).
23
+ * @param options.constrainDrag - Function to constrain/deny drag. Receives drag distance, returns boolean (optional).
25
24
  */
26
25
  export declare const useSwipeHandlers: ({ closingThreshold, onCloseGesture, onOpenGesture, onDragEnd, constrainDrag, }: UseSwipeHandlersProps) => {
27
26
  handlers: import("react-swipeable").SwipeableHandlers;