@trackunit/react-drawer 1.13.20 → 1.13.23

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
@@ -303,13 +303,14 @@ const getIconName = (open, position) => {
303
303
  * The button might be disabled based on the 'disableButton' prop.
304
304
  *
305
305
  * @param {object} props - The properties passed to the component
306
- * @param {boolean} props.open - Indicates if the button is in "open" state
307
306
  * @param {Function} [props.onClick] - Optional callback function for when the button is clicked
307
+ * @param {boolean} props.open - Indicates if the button is in "open" state
308
308
  * @param {DrawerPosition} props.position - The position of the button relative to its container
309
+ * @param props.ref - Ref forwarded to the root DOM element
309
310
  */
310
- const DrawerToggle = ({ open, position, onClick = NOOP }) => {
311
+ const DrawerToggle = ({ open, position, onClick = NOOP, ref }) => {
311
312
  const name = getIconName(open, position);
312
- return (jsxRuntime.jsx("div", { className: cvaToggleContainer({ position }), children: jsxRuntime.jsx("button", { className: cvaDrawerToggle({ position }), "data-testid": "toggle-button", onClick: onClick, children: jsxRuntime.jsx(reactComponents.Icon, { name: name }) }) }));
313
+ return (jsxRuntime.jsx("div", { className: cvaToggleContainer({ position }), ref: ref, children: jsxRuntime.jsx("button", { className: cvaDrawerToggle({ position }), "data-testid": "toggle-button", onClick: onClick, children: jsxRuntime.jsx(reactComponents.Icon, { name: name }) }) }));
313
314
  };
314
315
  const cvaDrawerToggle = cssClassVarianceUtilities.cvaMerge([
315
316
  "flex",
package/index.esm.js CHANGED
@@ -301,13 +301,14 @@ const getIconName = (open, position) => {
301
301
  * The button might be disabled based on the 'disableButton' prop.
302
302
  *
303
303
  * @param {object} props - The properties passed to the component
304
- * @param {boolean} props.open - Indicates if the button is in "open" state
305
304
  * @param {Function} [props.onClick] - Optional callback function for when the button is clicked
305
+ * @param {boolean} props.open - Indicates if the button is in "open" state
306
306
  * @param {DrawerPosition} props.position - The position of the button relative to its container
307
+ * @param props.ref - Ref forwarded to the root DOM element
307
308
  */
308
- const DrawerToggle = ({ open, position, onClick = NOOP }) => {
309
+ const DrawerToggle = ({ open, position, onClick = NOOP, ref }) => {
309
310
  const name = getIconName(open, position);
310
- return (jsx("div", { className: cvaToggleContainer({ position }), children: jsx("button", { className: cvaDrawerToggle({ position }), "data-testid": "toggle-button", onClick: onClick, children: jsx(Icon, { name: name }) }) }));
311
+ return (jsx("div", { className: cvaToggleContainer({ position }), ref: ref, children: jsx("button", { className: cvaDrawerToggle({ position }), "data-testid": "toggle-button", onClick: onClick, children: jsx(Icon, { name: name }) }) }));
311
312
  };
312
313
  const cvaDrawerToggle = cvaMerge([
313
314
  "flex",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trackunit/react-drawer",
3
- "version": "1.13.20",
3
+ "version": "1.13.23",
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.17.17",
13
- "@trackunit/css-class-variance-utilities": "1.11.42",
14
- "@trackunit/ui-icons": "1.11.41",
15
- "@trackunit/i18n-library-translation": "1.12.26"
12
+ "@trackunit/react-components": "1.17.20",
13
+ "@trackunit/css-class-variance-utilities": "1.11.43",
14
+ "@trackunit/ui-icons": "1.11.42",
15
+ "@trackunit/i18n-library-translation": "1.12.27"
16
16
  },
17
17
  "module": "./index.esm.js",
18
18
  "main": "./index.cjs.js",
@@ -1,6 +1,7 @@
1
+ import { Refable } from "@trackunit/react-components";
1
2
  import { MouseEvent } from "react";
2
3
  import { type DrawerPosition } from "../../types";
3
- interface DrawerToggleProps {
4
+ interface DrawerToggleProps extends Refable<HTMLDivElement> {
4
5
  open: boolean;
5
6
  onClick?: (event: MouseEvent) => void;
6
7
  position: DrawerPosition;
@@ -12,9 +13,10 @@ interface DrawerToggleProps {
12
13
  * The button might be disabled based on the 'disableButton' prop.
13
14
  *
14
15
  * @param {object} props - The properties passed to the component
15
- * @param {boolean} props.open - Indicates if the button is in "open" state
16
16
  * @param {Function} [props.onClick] - Optional callback function for when the button is clicked
17
+ * @param {boolean} props.open - Indicates if the button is in "open" state
17
18
  * @param {DrawerPosition} props.position - The position of the button relative to its container
19
+ * @param props.ref - Ref forwarded to the root DOM element
18
20
  */
19
- export declare const DrawerToggle: ({ open, position, onClick }: DrawerToggleProps) => import("react/jsx-runtime").JSX.Element;
21
+ export declare const DrawerToggle: ({ open, position, onClick, ref }: DrawerToggleProps) => import("react/jsx-runtime").JSX.Element;
20
22
  export {};