@julseb-lib/react 1.0.10 → 1.0.12

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
@@ -1777,13 +1777,13 @@ declare const Autocomplete: FC$1<ILibAutocomplete>;
1777
1777
  * icons={{ default: <BiHeart />, checked: <BiSolidHeart /> }}
1778
1778
  * />
1779
1779
  *
1780
- * @extends HTMLDivElement
1780
+ * @extends ILibRating
1781
1781
  *
1782
1782
  * @prop {string} [props.className] - Additional CSS classes to apply to the rating container.
1783
1783
  * @prop {React.Ref<HTMLDivElement>} [props.ref] - Ref to the rating container div element.
1784
1784
  * @prop {number} [props.rating] - Current rating value (1-5 stars).
1785
- * @prop {function} [props.setRating] - Function to update the rating value when not in read-only mode.
1786
- * @prop {object} [props.icons] - Icon configuration object with default and checked icon variants.
1785
+ * @prop {(rating: number) => void} [props.setRating] - Function to update the rating value when not in read-only mode.
1786
+ * @prop {{ default?: React.ReactNode; checked?: React.ReactNode }} [props.icons] - Icon configuration object with default and checked icon variants.
1787
1787
  * @prop {boolean} [props.readOnly] - Whether the rating is in read-only mode (no interaction).
1788
1788
  * @prop {string} [props.label] - Label text to display above the rating.
1789
1789
  * @prop {string} [props.labelComment] - Additional comment text next to the label.
@@ -1791,8 +1791,10 @@ declare const Autocomplete: FC$1<ILibAutocomplete>;
1791
1791
  * @prop {string} [props.helperBottom] - Helper text to display at the bottom of the rating.
1792
1792
  * @prop {string} [props.id] - Unique identifier for the rating element.
1793
1793
  * @prop {LibValidation} [props.validation] - Validation state and configuration object.
1794
- * @prop {string} [containerClassName] - Additional CSS classes for the container.
1795
- * @prop {any} [props.rest] - Additional props spread to the rating container.
1794
+ * @prop {string} [props.containerClassName] - Additional CSS classes for the container.
1795
+ * @prop {number} [props.iconsSize=32] - Size of the rating icons. Default: 32.
1796
+ * @prop {LibColorsHover} [props.accentColor="primary"] - Accent color for the icons. Default: "primary".
1797
+ * @prop {"xs" | "sm" | "md" | "lg" | "xl" | "2xl"} [props.gap="xs"] - Gap between rating icons. Default: "xs".
1796
1798
  *
1797
1799
  * @returns {JSX.Element} The rendered Rating component.
1798
1800
  *
package/dist/index.d.ts CHANGED
@@ -1777,13 +1777,13 @@ declare const Autocomplete: FC$1<ILibAutocomplete>;
1777
1777
  * icons={{ default: <BiHeart />, checked: <BiSolidHeart /> }}
1778
1778
  * />
1779
1779
  *
1780
- * @extends HTMLDivElement
1780
+ * @extends ILibRating
1781
1781
  *
1782
1782
  * @prop {string} [props.className] - Additional CSS classes to apply to the rating container.
1783
1783
  * @prop {React.Ref<HTMLDivElement>} [props.ref] - Ref to the rating container div element.
1784
1784
  * @prop {number} [props.rating] - Current rating value (1-5 stars).
1785
- * @prop {function} [props.setRating] - Function to update the rating value when not in read-only mode.
1786
- * @prop {object} [props.icons] - Icon configuration object with default and checked icon variants.
1785
+ * @prop {(rating: number) => void} [props.setRating] - Function to update the rating value when not in read-only mode.
1786
+ * @prop {{ default?: React.ReactNode; checked?: React.ReactNode }} [props.icons] - Icon configuration object with default and checked icon variants.
1787
1787
  * @prop {boolean} [props.readOnly] - Whether the rating is in read-only mode (no interaction).
1788
1788
  * @prop {string} [props.label] - Label text to display above the rating.
1789
1789
  * @prop {string} [props.labelComment] - Additional comment text next to the label.
@@ -1791,8 +1791,10 @@ declare const Autocomplete: FC$1<ILibAutocomplete>;
1791
1791
  * @prop {string} [props.helperBottom] - Helper text to display at the bottom of the rating.
1792
1792
  * @prop {string} [props.id] - Unique identifier for the rating element.
1793
1793
  * @prop {LibValidation} [props.validation] - Validation state and configuration object.
1794
- * @prop {string} [containerClassName] - Additional CSS classes for the container.
1795
- * @prop {any} [props.rest] - Additional props spread to the rating container.
1794
+ * @prop {string} [props.containerClassName] - Additional CSS classes for the container.
1795
+ * @prop {number} [props.iconsSize=32] - Size of the rating icons. Default: 32.
1796
+ * @prop {LibColorsHover} [props.accentColor="primary"] - Accent color for the icons. Default: "primary".
1797
+ * @prop {"xs" | "sm" | "md" | "lg" | "xl" | "2xl"} [props.gap="xs"] - Gap between rating icons. Default: "xs".
1796
1798
  *
1797
1799
  * @returns {JSX.Element} The rendered Rating component.
1798
1800
  *
package/dist/index.js CHANGED
@@ -66330,6 +66330,9 @@ var Rating = ({
66330
66330
  id,
66331
66331
  validation,
66332
66332
  containerClassName,
66333
+ iconsSize = 32,
66334
+ accentColor = "primary",
66335
+ gap = "xs",
66333
66336
  ...rest
66334
66337
  }) => {
66335
66338
  return /* @__PURE__ */ jsx318(
@@ -66346,7 +66349,7 @@ var Rating = ({
66346
66349
  {
66347
66350
  ref,
66348
66351
  id,
66349
- className: clsx("flex gap-2", "rating", className),
66352
+ className: clsx("flex", genGap[gap], "rating", className),
66350
66353
  ...rest,
66351
66354
  children: generateNumbers(0, 4).map((n) => {
66352
66355
  const Element = readOnly ? "span" : "button";
@@ -66356,20 +66359,20 @@ var Rating = ({
66356
66359
  onClick: () => !readOnly && setRating(n + 1),
66357
66360
  type: "button",
66358
66361
  className: clsx(
66359
- readOnly ? "text-primary-500" : genTextColorHover["primary"],
66362
+ readOnly ? genTextAllColor[accentColor] : genTextColorHover[accentColor],
66360
66363
  validation?.status === false ? readOnly ? "text-danger-500" : genTextColorHover["danger"] : validation?.status === true && (readOnly ? "text-success-500" : genTextColorHover["success"]),
66361
66364
  "rating-item"
66362
66365
  ),
66363
66366
  children: n >= rating ? icons?.default ?? /* @__PURE__ */ jsx318(
66364
66367
  BiStar,
66365
66368
  {
66366
- size: 32,
66369
+ size: iconsSize,
66367
66370
  className: "rating-icon"
66368
66371
  }
66369
66372
  ) : icons?.checked ?? /* @__PURE__ */ jsx318(
66370
66373
  BiSolidStar,
66371
66374
  {
66372
- size: 32,
66375
+ size: iconsSize,
66373
66376
  className: "rating-icon"
66374
66377
  }
66375
66378
  )
@@ -68111,25 +68114,28 @@ import { generateNumbers as generateNumbers2 } from "@julseb-lib/utils";
68111
68114
  import { jsx as jsx350 } from "react/jsx-runtime";
68112
68115
  var SlideshowPagination = ({
68113
68116
  className,
68114
- pagination,
68115
68117
  images,
68116
68118
  active,
68117
68119
  setActive,
68118
- contentLength
68120
+ contentLength,
68121
+ handleClick,
68122
+ position = "outside",
68123
+ hideOnTouch,
68124
+ color = "primary",
68125
+ type = "dots"
68119
68126
  }) => {
68120
68127
  const isTouchScreen = useTouchScreen();
68121
- if (isTouchScreen && pagination?.hideOnTouch || contentLength === 0)
68122
- return null;
68128
+ if (isTouchScreen && hideOnTouch || contentLength === 0) return null;
68123
68129
  return /* @__PURE__ */ jsx350(
68124
68130
  "div",
68125
68131
  {
68126
68132
  className: clsx(
68127
68133
  "flex justify-center gap-2 mx-auto px-2 w-full max-w-[70%]",
68128
- pagination?.position === "outside" ? "" : "absolute bottom-1 left-[50%] -translate-x-[50%]",
68134
+ position === "outside" ? "" : "absolute bottom-1 left-[50%] -translate-x-[50%]",
68129
68135
  "slideshow-controls",
68130
68136
  className
68131
68137
  ),
68132
- children: pagination?.type === "thumbnails" ? images?.map((image, i) => /* @__PURE__ */ jsx350(
68138
+ children: type === "thumbnails" ? images?.map((image, i) => /* @__PURE__ */ jsx350(
68133
68139
  "button",
68134
68140
  {
68135
68141
  className: clsx(
@@ -68139,7 +68145,10 @@ var SlideshowPagination = ({
68139
68145
  active === i && "active",
68140
68146
  "slideshow-thumbnail-container"
68141
68147
  ),
68142
- onClick: () => setActive(i),
68148
+ onClick: () => {
68149
+ setActive(i);
68150
+ handleClick(i);
68151
+ },
68143
68152
  children: /* @__PURE__ */ jsx350(
68144
68153
  "img",
68145
68154
  {
@@ -68157,20 +68166,21 @@ var SlideshowPagination = ({
68157
68166
  {
68158
68167
  className: clsx(
68159
68168
  "",
68160
- pagination?.type === "dots-outline" ? outlineColor[pagination?.color ?? "primary"] : genBgColor2[pagination?.color ?? "primary"],
68169
+ type === "dots-outline" ? outlineColor[color ?? "primary"] : genBgColor2[color ?? "primary"],
68161
68170
  active === n && "active",
68162
- pagination?.type === "dots" && [
68171
+ type === "dots" && [
68163
68172
  "size-2 rounded-full block"
68164
68173
  ],
68165
- pagination?.type === "dots-outline" && [
68174
+ type === "dots-outline" && [
68166
68175
  "size-2 rounded-full border-1"
68167
68176
  ],
68168
- pagination?.type === "bars" && [
68169
- "grow h-1 rounded-full"
68170
- ],
68177
+ type === "bars" && ["grow h-1 rounded-full"],
68171
68178
  "slideshow-control"
68172
68179
  ),
68173
- onClick: () => setActive(n)
68180
+ onClick: () => {
68181
+ setActive(n);
68182
+ handleClick(n);
68183
+ }
68174
68184
  },
68175
68185
  n
68176
68186
  ))
@@ -68421,17 +68431,16 @@ var Slideshow = ({
68421
68431
  !hidePagination && totalSlides > 1 && /* @__PURE__ */ jsx351(
68422
68432
  SlideshowPagination,
68423
68433
  {
68434
+ className: pagination?.className,
68435
+ images: pagination?.images,
68424
68436
  active: currentSlide,
68425
68437
  setActive: setCurrentSlide,
68426
68438
  contentLength: totalSlides,
68427
68439
  handleClick: goToSlide,
68428
- pagination: {
68429
- type: pagination?.type ?? "dots",
68430
- hideOnTouch: pagination?.hideOnTouch ?? false,
68431
- position: pagination?.position ?? "outside",
68432
- color: pagination?.color ?? "primary"
68433
- },
68434
- images
68440
+ position: pagination?.position,
68441
+ hideOnTouch: pagination?.hideOnTouch,
68442
+ color: pagination?.color,
68443
+ type: pagination?.type
68435
68444
  }
68436
68445
  )
68437
68446
  ]