@jorgemadrid/open-carousel 0.1.0 → 0.1.2

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.cjs CHANGED
@@ -1,9 +1,7 @@
1
1
  "use strict";
2
- var __create = Object.create;
3
2
  var __defProp = Object.defineProperty;
4
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
5
  var __hasOwnProp = Object.prototype.hasOwnProperty;
8
6
  var __export = (target, all) => {
9
7
  for (var name in all)
@@ -17,14 +15,6 @@ var __copyProps = (to, from, except, desc) => {
17
15
  }
18
16
  return to;
19
17
  };
20
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
- // If the importer is in node compatibility mode or this is not an ESM
22
- // file that has been converted to a CommonJS file using a Babel-
23
- // compatible transform (i.e. "__esModule" has not been set), then set
24
- // "default" to the CommonJS "module.exports" for node compatibility.
25
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
- mod
27
- ));
28
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
19
 
30
20
  // src/index.ts
@@ -1611,23 +1601,39 @@ function useCarouselCoordinator(options) {
1611
1601
  };
1612
1602
  }
1613
1603
 
1604
+ // node_modules/clsx/dist/clsx.mjs
1605
+ function r(e) {
1606
+ var t, f, n = "";
1607
+ if ("string" == typeof e || "number" == typeof e) n += e;
1608
+ else if ("object" == typeof e) if (Array.isArray(e)) {
1609
+ var o = e.length;
1610
+ for (t = 0; t < o; t++) e[t] && (f = r(e[t])) && (n && (n += " "), n += f);
1611
+ } else for (f in e) e[f] && (n && (n += " "), n += f);
1612
+ return n;
1613
+ }
1614
+ function clsx() {
1615
+ for (var e, t, f = 0, n = "", o = arguments.length; f < o; f++) (e = arguments[f]) && (t = r(e)) && (n && (n += " "), n += t);
1616
+ return n;
1617
+ }
1618
+ var clsx_default = clsx;
1619
+
1614
1620
  // src/CarouselArrow.tsx
1615
- var import_clsx = __toESM(require("clsx"), 1);
1616
- var import_react_i18next = require("react-i18next");
1617
1621
  var import_jsx_runtime = require("react/jsx-runtime");
1618
1622
  function CarouselArrow({
1619
1623
  direction,
1620
1624
  onClick,
1621
1625
  disabled = false,
1622
- className
1626
+ className,
1627
+ label,
1628
+ ...props
1623
1629
  }) {
1624
- const { t } = (0, import_react_i18next.useTranslation)();
1630
+ const defaultLabel = direction === "left" ? "Previous" : "Next";
1625
1631
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1626
1632
  "button",
1627
1633
  {
1628
1634
  onClick,
1629
1635
  disabled,
1630
- className: (0, import_clsx.default)(
1636
+ className: clsx_default(
1631
1637
  "carousel-button",
1632
1638
  // Base class from global CSS
1633
1639
  direction === "left" ? "prev" : "next",
@@ -1636,11 +1642,12 @@ function CarouselArrow({
1636
1642
  // State modifiers
1637
1643
  className
1638
1644
  ),
1639
- "aria-label": direction === "left" ? t("carousel.previous") : t("carousel.next"),
1645
+ "aria-label": label || defaultLabel,
1640
1646
  onPointerDown: (e) => {
1641
1647
  e.stopPropagation();
1642
1648
  e.preventDefault();
1643
1649
  },
1650
+ ...props,
1644
1651
  children: direction === "left" ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1645
1652
  "svg",
1646
1653
  {
@@ -1895,7 +1902,9 @@ function BaseCarouselInner({
1895
1902
  debugId = "carousel",
1896
1903
  debug,
1897
1904
  eagerSelectionOnMobile = false,
1898
- initialIndex
1905
+ initialIndex,
1906
+ prevLabel = "Previous",
1907
+ nextLabel = "Next"
1899
1908
  }) {
1900
1909
  const resolvedGap = gapProp ?? (typeof window !== "undefined" && window.innerWidth < LAYOUT_CONFIG.GAP_BREAKPOINT ? LAYOUT_CONFIG.GAP_MOBILE : LAYOUT_CONFIG.GAP_DESKTOP);
1901
1910
  const logger = (0, import_react10.useMemo)(() => createLogger(debugId, debug), [debugId, debug]);
@@ -2360,7 +2369,15 @@ function BaseCarouselInner({
2360
2369
  paddingBottom: verticalPadding
2361
2370
  },
2362
2371
  children: [
2363
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(CarouselArrow, { direction: "left", onClick: () => handleArrowClick("left"), className: "prev" }),
2372
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
2373
+ CarouselArrow,
2374
+ {
2375
+ direction: "left",
2376
+ onClick: () => handleArrowClick("left"),
2377
+ className: "prev",
2378
+ label: prevLabel
2379
+ }
2380
+ ),
2364
2381
  infinite && !isReady && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
2365
2382
  "div",
2366
2383
  {
@@ -2495,7 +2512,15 @@ function BaseCarouselInner({
2495
2512
  }), [allItems, infinite, bufferBeforeCount, items.length, getItemKey, renderItem, widthCssValue, itemClassName, scrollToThisItem])
2496
2513
  }
2497
2514
  ),
2498
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(CarouselArrow, { direction: "right", onClick: () => handleArrowClick("right"), className: "next" })
2515
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
2516
+ CarouselArrow,
2517
+ {
2518
+ direction: "right",
2519
+ onClick: () => handleArrowClick("right"),
2520
+ className: "next",
2521
+ label: nextLabel
2522
+ }
2523
+ )
2499
2524
  ]
2500
2525
  }
2501
2526
  );