@julseb-lib/react 1.1.25 → 1.1.27

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
@@ -180,7 +180,7 @@ declare const genFontWeight: Record<LibFontWeights, string>;
180
180
  *
181
181
  * @see https://doc-julseb-lib-react.vercel.app/helpers/hooks#useClickOutside
182
182
  */
183
- declare const useClickOutside: <T extends HTMLElement = HTMLElement>(ref: RefObject<T>, handler: () => void, isActive?: boolean, delay?: number) => void;
183
+ declare const useClickOutside: <T extends HTMLElement = HTMLElement>(ref: RefObject<T>, handler: (e?: MouseEvent) => void, isActive?: boolean, delay?: number) => void;
184
184
 
185
185
  type CopiedValue = string | null;
186
186
  type CopyFn = (text: string) => Promise<boolean>;
@@ -560,7 +560,7 @@ declare const usePagination: ({ currentPage, setCurrentPage, totalPages, }: ILib
560
560
  */
561
561
  declare const useTextLineCount: (text: string, fontSize?: number) => {
562
562
  visualLines: number;
563
- elementRef: react.RefObject<HTMLTextAreaElement | HTMLInputElement | null>;
563
+ elementRef: react.RefObject<HTMLInputElement | HTMLTextAreaElement | null>;
564
564
  };
565
565
 
566
566
  /**
package/dist/index.d.ts CHANGED
@@ -180,7 +180,7 @@ declare const genFontWeight: Record<LibFontWeights, string>;
180
180
  *
181
181
  * @see https://doc-julseb-lib-react.vercel.app/helpers/hooks#useClickOutside
182
182
  */
183
- declare const useClickOutside: <T extends HTMLElement = HTMLElement>(ref: RefObject<T>, handler: () => void, isActive?: boolean, delay?: number) => void;
183
+ declare const useClickOutside: <T extends HTMLElement = HTMLElement>(ref: RefObject<T>, handler: (e?: MouseEvent) => void, isActive?: boolean, delay?: number) => void;
184
184
 
185
185
  type CopiedValue = string | null;
186
186
  type CopyFn = (text: string) => Promise<boolean>;
@@ -560,7 +560,7 @@ declare const usePagination: ({ currentPage, setCurrentPage, totalPages, }: ILib
560
560
  */
561
561
  declare const useTextLineCount: (text: string, fontSize?: number) => {
562
562
  visualLines: number;
563
- elementRef: react.RefObject<HTMLTextAreaElement | HTMLInputElement | null>;
563
+ elementRef: react.RefObject<HTMLInputElement | HTMLTextAreaElement | null>;
564
564
  };
565
565
 
566
566
  /**
package/dist/index.js CHANGED
@@ -51,7 +51,7 @@ import {
51
51
  libMarkdownEditorOptions,
52
52
  linkifyText,
53
53
  scrollToTop
54
- } from "./chunk-UHS3R3PM.js";
54
+ } from "./chunk-PXJ4JXEH.js";
55
55
 
56
56
  // #style-inject:#style-inject
57
57
  function styleInject(css, { insertAt } = {}) {
@@ -1425,7 +1425,7 @@ var genPosition = {
1425
1425
  // src/lib/components/LazyImage/LazyImage.tsx
1426
1426
  import { Suspense, lazy } from "react";
1427
1427
  import { jsx as jsx16 } from "react/jsx-runtime";
1428
- var Image2 = lazy(() => import("./Image-SKLDS4YE.js"));
1428
+ var Image2 = lazy(() => import("./Image-4MLJ7FPA.js"));
1429
1429
  var LazyImage = ({
1430
1430
  className,
1431
1431
  ref,
@@ -2317,7 +2317,8 @@ var InputContainer = ({
2317
2317
  ),
2318
2318
  ...rest,
2319
2319
  children: [
2320
- label && /* @__PURE__ */ jsxs10(
2320
+ label && // eslint-disable-next-line
2321
+ /* @__PURE__ */ jsxs10(
2321
2322
  "label",
2322
2323
  {
2323
2324
  htmlFor: id,
@@ -2630,7 +2631,6 @@ var InputListItem = ({
2630
2631
  return /* @__PURE__ */ jsxs11(
2631
2632
  "button",
2632
2633
  {
2633
- role: "button",
2634
2634
  onClick,
2635
2635
  className: clsx(
2636
2636
  "flex items-center gap-2 p-2 w-full text-left",
@@ -3294,42 +3294,49 @@ var InputImage = ({
3294
3294
  helperBottom,
3295
3295
  validation,
3296
3296
  className: containerClassName,
3297
- children: /* @__PURE__ */ jsxs20(
3298
- "label",
3297
+ children: /* @__PURE__ */ jsx52(
3298
+ "button",
3299
3299
  {
3300
- htmlFor: id,
3301
- ref,
3302
- className: clsx(
3303
- "relative flex justify-center items-center size-16 overflow-hidden text-primary-500 cursor-pointer",
3304
- validation?.status === false ? "bg-danger-50 text-danger-500" : "bg-gray-100",
3305
- disabled && "cursor-not-allowed text-gray-500",
3306
- genBorderRadius[borderRadius],
3307
- "input-image-container",
3308
- className
3309
- ),
3310
3300
  onMouseEnter: () => !disabled && setIsHovered(true),
3311
3301
  onMouseLeave: () => !disabled && setIsHovered(false),
3312
- children: [
3313
- value === "" || !value ? /* @__PURE__ */ jsx52(EmptyContainer, { icons }) : /* @__PURE__ */ jsx52(
3314
- "img",
3315
- {
3316
- src: value,
3317
- alt: "Image input",
3318
- className: "w-full h-full object-cover input-image-image"
3319
- }
3320
- ),
3321
- /* @__PURE__ */ jsx52(HoverContainer, { isVisible: isHovered, icons }),
3322
- /* @__PURE__ */ jsx52(
3323
- "input",
3324
- {
3325
- type: "file",
3326
- id,
3327
- disabled,
3328
- className: "hidden input-image-input",
3329
- ...rest
3330
- }
3331
- )
3332
- ]
3302
+ type: "button",
3303
+ children: /* @__PURE__ */ jsxs20(
3304
+ "label",
3305
+ {
3306
+ htmlFor: id,
3307
+ ref,
3308
+ className: clsx(
3309
+ "relative flex justify-center items-center size-16 overflow-hidden text-primary-500 cursor-pointer",
3310
+ validation?.status === false ? "bg-danger-50 text-danger-500" : "bg-gray-100",
3311
+ disabled && "cursor-not-allowed text-gray-500",
3312
+ genBorderRadius[borderRadius],
3313
+ "input-image-container",
3314
+ className
3315
+ ),
3316
+ children: [
3317
+ value === "" || !value ? /* @__PURE__ */ jsx52(EmptyContainer, { icons }) : /* @__PURE__ */ jsx52(
3318
+ "img",
3319
+ {
3320
+ src: value,
3321
+ alt: "Input",
3322
+ className: "w-full h-full object-cover input-image-image"
3323
+ }
3324
+ ),
3325
+ /* @__PURE__ */ jsx52(HoverContainer, { isVisible: isHovered, icons }),
3326
+ /* @__PURE__ */ jsx52(
3327
+ "input",
3328
+ {
3329
+ type: "file",
3330
+ id,
3331
+ disabled,
3332
+ className: "sr-only input-image-input",
3333
+ accept: "image/*",
3334
+ ...rest
3335
+ }
3336
+ )
3337
+ ]
3338
+ }
3339
+ )
3333
3340
  }
3334
3341
  )
3335
3342
  }
@@ -63847,7 +63854,6 @@ var InputPhone = ({
63847
63854
  "input-phone-country-button"
63848
63855
  ),
63849
63856
  onClick: () => setIsOpen(!isOpen),
63850
- role: "button",
63851
63857
  "aria-label": countryButtonAriaLabel,
63852
63858
  children: [
63853
63859
  country?.flag,
@@ -63918,7 +63924,8 @@ var InputPhone = ({
63918
63924
  className: "outline-none w-full input-phone-search",
63919
63925
  placeholder: searchPlaceholder,
63920
63926
  value: search,
63921
- onChange: (e) => setSearch(e.target.value)
63927
+ onChange: (e) => setSearch(e.target.value),
63928
+ "aria-label": "Search country"
63922
63929
  }
63923
63930
  )
63924
63931
  ]
@@ -64135,12 +64142,6 @@ var InputSlider = ({
64135
64142
  "flex items-center gap-2 w-full input-slider-container",
64136
64143
  className
64137
64144
  ),
64138
- onMouseEnter: () => {
64139
- if (showValue === "hover") setIsTooltipVisible(true);
64140
- },
64141
- onMouseLeave: () => {
64142
- if (showValue === "hover") setIsTooltipVisible(false);
64143
- },
64144
64145
  children: [
64145
64146
  showMinMax && /* @__PURE__ */ jsx298(Text, { tag: "small", color: "gray", className: "min-max", children: min }),
64146
64147
  /* @__PURE__ */ jsxs265("div", { className: "relative w-full slider-wrapper", children: [
@@ -64169,6 +64170,13 @@ var InputSlider = ({
64169
64170
  ["--cursor-value"]: `${percentage}%`,
64170
64171
  background: validation?.status === false ? `linear-gradient(to right, rgb(239 68 68) 0%, rgb(239 68 68) ${percentage}%, rgb(229 231 235) ${percentage}%, rgb(229 231 235) 100%)` : validation?.status === true ? `linear-gradient(to right, rgb(34 197 94) 0%, rgb(34 197 94) ${percentage}%, rgb(229 231 235) ${percentage}%, rgb(229 231 235) 100%)` : `linear-gradient(to right, rgb(59 130 246) 0%, rgb(59 130 246) ${percentage}%, rgb(229 231 235) ${percentage}%, rgb(229 231 235) 100%)`
64171
64172
  },
64173
+ onMouseEnter: () => {
64174
+ if (showValue === "hover") setIsTooltipVisible(true);
64175
+ },
64176
+ onMouseLeave: () => {
64177
+ if (showValue === "hover")
64178
+ setIsTooltipVisible(false);
64179
+ },
64172
64180
  ...inputProps
64173
64181
  }
64174
64182
  )
@@ -64612,7 +64620,8 @@ var InputPin = ({
64612
64620
  "border border-gray-200 size-12 rounded-lg text-center focus:border-primary-500",
64613
64621
  validation?.status === false ? "focus:border-danger-500" : validation?.status === true && "focus:border-success-500",
64614
64622
  "input-pin"
64615
- )
64623
+ ),
64624
+ "aria-label": `Input pin ${i + 1}`
64616
64625
  },
64617
64626
  i
64618
64627
  );
@@ -65465,7 +65474,6 @@ var Modal = ({
65465
65474
  ),
65466
65475
  onClick: () => setIsOpen(false),
65467
65476
  "aria-label": labelClose,
65468
- role: "button",
65469
65477
  type: "button",
65470
65478
  children: closeIcon
65471
65479
  }
@@ -65524,7 +65532,6 @@ var DragListItem = ({
65524
65532
  /* @__PURE__ */ jsx320(
65525
65533
  "button",
65526
65534
  {
65527
- role: "button",
65528
65535
  "aria-label": iconLabel,
65529
65536
  className: clsx(
65530
65537
  "outline-none cursor-grab! active:cursor-grabbing",
@@ -65835,7 +65842,8 @@ var Paginator = ({
65835
65842
  "[&::-webkit-outer-spin-button]:appearance-none [&::-webkit-inner-spin-button]:appearance-none [&::-webkit-inner-spin-button]:m-0 [appearance:textfield]",
65836
65843
  "paginator-input"
65837
65844
  ),
65838
- size: currentPage.toString().length + 1
65845
+ size: currentPage.toString().length + 1,
65846
+ "aria-label": "Change page"
65839
65847
  }
65840
65848
  ),
65841
65849
  " ",
@@ -66220,8 +66228,7 @@ import {
66220
66228
  Children as Children3,
66221
66229
  useState as useState25,
66222
66230
  useEffect as useEffect14,
66223
- useRef as useRef15,
66224
- Suspense as Suspense2
66231
+ useRef as useRef15
66225
66232
  } from "react";
66226
66233
  import { uuid as uuid10 } from "@julseb-lib/utils";
66227
66234
 
@@ -66255,7 +66262,6 @@ var SlideshowButton = ({
66255
66262
  onClick,
66256
66263
  "aria-label": position === "left" ? controls?.labelPrev ?? "Previous" : controls?.labelNext ?? "Next",
66257
66264
  type: "button",
66258
- role: "button",
66259
66265
  children: position === "left" ? controls?.icons?.prev ?? /* @__PURE__ */ jsx332(
66260
66266
  BiChevronLeft,
66261
66267
  {
@@ -66312,6 +66318,7 @@ var SlideshowPagination = ({
66312
66318
  setActive(i);
66313
66319
  handleClick(i);
66314
66320
  },
66321
+ "aria-label": `Set image ${i + 1} active`,
66315
66322
  children: /* @__PURE__ */ jsx333(
66316
66323
  "img",
66317
66324
  {
@@ -66319,7 +66326,8 @@ var SlideshowPagination = ({
66319
66326
  className: clsx(
66320
66327
  "w-full h-full object-cover",
66321
66328
  "slideshow-thumbnail"
66322
- )
66329
+ ),
66330
+ alt: `Slideshow ${i + 1}`
66323
66331
  }
66324
66332
  )
66325
66333
  },
@@ -66328,7 +66336,6 @@ var SlideshowPagination = ({
66328
66336
  "button",
66329
66337
  {
66330
66338
  className: clsx(
66331
- "",
66332
66339
  type === "dots-outline" ? outlineColor[color ?? "primary"] : genBgColor2[color ?? "primary"],
66333
66340
  active === n && "active",
66334
66341
  type === "dots" && [
@@ -66343,7 +66350,8 @@ var SlideshowPagination = ({
66343
66350
  onClick: () => {
66344
66351
  setActive(n);
66345
66352
  handleClick(n);
66346
- }
66353
+ },
66354
+ "aria-label": `Set image ${n + 1} active`
66347
66355
  },
66348
66356
  n
66349
66357
  ))
@@ -66531,6 +66539,9 @@ var Slideshow = ({
66531
66539
  userSelect: "none",
66532
66540
  WebkitUserSelect: "none"
66533
66541
  },
66542
+ "aria-label": "Slides wrapper",
66543
+ role: "slider",
66544
+ tabIndex: 0,
66534
66545
  children: /* @__PURE__ */ jsx334(
66535
66546
  "div",
66536
66547
  {
@@ -66545,27 +66556,21 @@ var Slideshow = ({
66545
66556
  transitionDuration: `${options?.speed ?? 300}ms`
66546
66557
  },
66547
66558
  children: images ? images.map((img, i) => /* @__PURE__ */ jsx334(
66548
- Suspense2,
66559
+ LazyImage,
66549
66560
  {
66550
- fallback: /* @__PURE__ */ jsx334("p", { children: "Loading..." }),
66551
- children: /* @__PURE__ */ jsx334(
66552
- Image,
66553
- {
66554
- src: img,
66555
- alt: `Slideshow image ${i + 1}`,
66556
- className: clsx(
66557
- "size-full shrink-0",
66558
- genObjectFit[imgFit],
66559
- "slideshow-image"
66560
- ),
66561
- width: "100%",
66562
- height: "100%",
66563
- fit: "cover",
66564
- borderRadius,
66565
- draggable: false
66566
- },
66567
- uuid10()
66568
- )
66561
+ src: img,
66562
+ alt: `Slideshow image ${i + 1}`,
66563
+ className: clsx(
66564
+ "size-full shrink-0",
66565
+ genObjectFit[imgFit],
66566
+ "slideshow-image"
66567
+ ),
66568
+ width: "100%",
66569
+ height: "100%",
66570
+ borderRadius,
66571
+ draggable: false,
66572
+ skeletonClasses: "size-full",
66573
+ skeletonAnimation: "shine"
66569
66574
  },
66570
66575
  uuid10()
66571
66576
  )) : childrenArray.map((child) => /* @__PURE__ */ jsx334(
@@ -67650,7 +67655,7 @@ var Drawer = ({
67650
67655
  "[&.open]:opacity-100 [&.open]:visible",
67651
67656
  "overlay"
67652
67657
  ),
67653
- onClick: () => setIsOpen(false)
67658
+ "aria-label": "Close drawer"
67654
67659
  }
67655
67660
  ),
67656
67661
  /* @__PURE__ */ jsxs290(
@@ -67796,7 +67801,8 @@ var Header = ({
67796
67801
  }, [hideOnScroll]);
67797
67802
  const burgerProps = {
67798
67803
  isOpen,
67799
- onClick: () => {
67804
+ onClick: (e) => {
67805
+ e.stopPropagation();
67800
67806
  if (isOpen) handleClose();
67801
67807
  else handleOpen();
67802
67808
  },
@@ -67835,7 +67841,8 @@ var Header = ({
67835
67841
  ref: el
67836
67842
  };
67837
67843
  useKeyPress("Escape", handleClose);
67838
- useClickOutside(el, () => {
67844
+ useClickOutside(el, (e) => {
67845
+ if (e.target?.closest(".header-burger")) return;
67839
67846
  if (isOpen) handleClose();
67840
67847
  });
67841
67848
  return /* @__PURE__ */ jsxs291(
@@ -67880,7 +67887,7 @@ var Header = ({
67880
67887
  isOpen ? "visible opacity-100" : "invisible opacity-0",
67881
67888
  "drawer-overlay"
67882
67889
  ),
67883
- onClick: handleClose
67890
+ "aria-label": "Close drawer"
67884
67891
  }
67885
67892
  ),
67886
67893
  navDesktopPosition === "right" && /* @__PURE__ */ jsx351("nav", { ...navProps }),