@julseb-lib/react 1.0.45 → 1.0.46

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.d.cts CHANGED
@@ -531,6 +531,28 @@ declare const usePagination: ({ currentPage, setCurrentPage, totalPages, }: ILib
531
531
  handlePage: (n: number) => void;
532
532
  };
533
533
 
534
+ /**
535
+ * Hook for calculating the number of lines text will occupy in a container with given dimensions and font properties.
536
+ *
537
+ * @hook
538
+ *
539
+ * @example
540
+ * const lineCount = useTextLineCount(
541
+ * "This is a long text that will wrap across multiple lines",
542
+ * 300,
543
+ * 16,
544
+ * "Arial"
545
+ * )
546
+ *
547
+ * @param {string} text - The text content to measure for line count.
548
+ * @param {number} containerWidth - The width of the container in pixels.
549
+ * @param {number} [fontSize=16] - The font size in pixels. Default: 16.
550
+ * @param {string} [fontFamily="lato"] - The font family to use for measurement. Default: "system-ui".
551
+ *
552
+ * @returns {number} The number of lines the text will occupy.
553
+ *
554
+ * @see https://doc-julseb-lib-react.vercel.app/hooks/use-text-line-count
555
+ */
534
556
  declare const useTextLineCount: (text: string, containerWidth: number, fontSize?: number, fontFamily?: string) => number;
535
557
 
536
558
  /**
package/dist/index.d.ts CHANGED
@@ -531,6 +531,28 @@ declare const usePagination: ({ currentPage, setCurrentPage, totalPages, }: ILib
531
531
  handlePage: (n: number) => void;
532
532
  };
533
533
 
534
+ /**
535
+ * Hook for calculating the number of lines text will occupy in a container with given dimensions and font properties.
536
+ *
537
+ * @hook
538
+ *
539
+ * @example
540
+ * const lineCount = useTextLineCount(
541
+ * "This is a long text that will wrap across multiple lines",
542
+ * 300,
543
+ * 16,
544
+ * "Arial"
545
+ * )
546
+ *
547
+ * @param {string} text - The text content to measure for line count.
548
+ * @param {number} containerWidth - The width of the container in pixels.
549
+ * @param {number} [fontSize=16] - The font size in pixels. Default: 16.
550
+ * @param {string} [fontFamily="lato"] - The font family to use for measurement. Default: "system-ui".
551
+ *
552
+ * @returns {number} The number of lines the text will occupy.
553
+ *
554
+ * @see https://doc-julseb-lib-react.vercel.app/hooks/use-text-line-count
555
+ */
534
556
  declare const useTextLineCount: (text: string, containerWidth: number, fontSize?: number, fontFamily?: string) => number;
535
557
 
536
558
  /**
package/dist/index.js CHANGED
@@ -2312,7 +2312,7 @@ var usePagination = ({
2312
2312
 
2313
2313
  // src/lib/hooks/useTextLineCount.tsx
2314
2314
  import { useState as useState8, useRef, useCallback, useEffect as useEffect7 } from "react";
2315
- var useTextLineCount = (text, containerWidth, fontSize = 16, fontFamily = "system-ui") => {
2315
+ var useTextLineCount = (text, containerWidth, fontSize = 16, fontFamily = "lato") => {
2316
2316
  const [lineCount, setLineCount] = useState8(1);
2317
2317
  const canvasRef = useRef(null);
2318
2318
  const measureLines = useCallback(() => {