@phillips/seldon 1.104.1 → 1.105.0

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.
@@ -1,65 +1,69 @@
1
- import { jsx as a } from "react/jsx-runtime";
2
- import { createContext as h, forwardRef as k, useEffect as m, useCallback as i } from "react";
1
+ import { jsx as m } from "react/jsx-runtime";
2
+ import { createContext as h, forwardRef as k, useEffect as u, useCallback as i } from "react";
3
3
  import { getCommonProps as A } from "../../utils/index.js";
4
4
  import R from "../../node_modules/classnames/index.js";
5
- import b from "../../node_modules/embla-carousel-react/esm/embla-carousel-react.esm.js";
6
- import { WheelGesturesPlugin as E } from "../../node_modules/embla-carousel-wheel-gestures/dist/embla-carousel-wheel-gestures.esm.js";
7
- const K = h(null), W = k(
5
+ import b from "../../node_modules/embla-carousel-class-names/esm/embla-carousel-class-names.esm.js";
6
+ import E from "../../node_modules/embla-carousel-react/esm/embla-carousel-react.esm.js";
7
+ import { WheelGesturesPlugin as K } from "../../node_modules/embla-carousel-wheel-gestures/dist/embla-carousel-wheel-gestures.esm.js";
8
+ const W = h(null), j = k(
8
9
  ({
9
10
  loop: w = !1,
10
11
  startIndex: x = 0,
11
12
  onSlideChange: s,
12
13
  className: d,
13
14
  children: N,
14
- columnGap: P,
15
- useWheelGestures: v = !1,
16
- disableDrag: o = !1,
15
+ columnGap: v,
16
+ useWheelGestures: P = !1,
17
+ disableDrag: l = !1,
17
18
  ...t
18
19
  }, I) => {
19
20
  var c, f;
20
- const { className: y, ...C } = A(t, "Carousel"), [D, e] = b(
21
+ const { className: C, ...y } = A(t, "Carousel"), [D, e] = E(
21
22
  {
22
23
  loop: w,
23
24
  startIndex: x,
24
25
  inViewThreshold: 0.99
25
26
  },
26
27
  [
27
- ...v ? [
28
- E({
28
+ ...P ? [
29
+ K({
29
30
  forceWheelAxis: "x"
30
31
  })
31
- ] : []
32
+ ] : [],
33
+ b({
34
+ snapped: "carousel-item-in-view"
35
+ })
32
36
  ]
33
37
  );
34
- m(() => {
35
- o ? e == null || e.reInit({
38
+ u(() => {
39
+ l ? e == null || e.reInit({
36
40
  watchDrag: () => !1
37
41
  }) : e == null || e.reInit({
38
42
  watchDrag: () => !0
39
43
  });
40
- }, [o, e]);
44
+ }, [l, e]);
41
45
  const V = i(
42
46
  (r) => {
43
47
  r.key === "ArrowLeft" ? (r.preventDefault(), e == null || e.scrollPrev()) : r.key === "ArrowRight" && (r.preventDefault(), e == null || e.scrollNext());
44
48
  },
45
49
  [e]
46
- ), l = i(
50
+ ), o = i(
47
51
  (r) => {
48
- var u;
52
+ var a;
49
53
  if (!r)
50
54
  return;
51
- const n = (u = r.slidesInView()) == null ? void 0 : u[0];
55
+ const n = (a = r.slidesInView()) == null ? void 0 : a[0];
52
56
  n !== void 0 && (s == null || s(n));
53
57
  },
54
58
  [s]
55
59
  );
56
- return m(() => {
60
+ return u(() => {
57
61
  if (e)
58
- return e.on("slidesInView", l), () => {
59
- e.off("slidesInView", l);
62
+ return e.on("slidesInView", o), () => {
63
+ e.off("slidesInView", o);
60
64
  };
61
- }, [e, l]), /* @__PURE__ */ a(
62
- K.Provider,
65
+ }, [e, o]), /* @__PURE__ */ m(
66
+ W.Provider,
63
67
  {
64
68
  value: {
65
69
  carouselRef: D,
@@ -68,19 +72,19 @@ const K = h(null), W = k(
68
72
  scrollNext: () => e == null ? void 0 : e.scrollNext(),
69
73
  canScrollPrev: (c = e == null ? void 0 : e.canScrollPrev()) != null ? c : !1,
70
74
  canScrollNext: (f = e == null ? void 0 : e.canScrollNext()) != null ? f : !1,
71
- columnGap: P,
75
+ columnGap: v,
72
76
  onSlideChange: s
73
77
  },
74
- children: /* @__PURE__ */ a(
78
+ children: /* @__PURE__ */ m(
75
79
  "div",
76
80
  {
77
81
  ref: I,
78
82
  onKeyDownCapture: V,
79
- className: R(y, d),
83
+ className: R(C, d),
80
84
  role: "region",
81
85
  "aria-roledescription": "carousel",
82
86
  ...t,
83
- ...C,
87
+ ...y,
84
88
  children: N
85
89
  }
86
90
  )
@@ -88,8 +92,8 @@ const K = h(null), W = k(
88
92
  );
89
93
  }
90
94
  );
91
- W.displayName = "Carousel";
95
+ j.displayName = "Carousel";
92
96
  export {
93
- K as CarouselContext,
94
- W as default
97
+ W as CarouselContext,
98
+ j as default
95
99
  };
@@ -4,27 +4,19 @@ import a from "../../node_modules/classnames/index.js";
4
4
  import { useCarousel as p } from "./utils.js";
5
5
  import { getCommonProps as u } from "../../utils/index.js";
6
6
  const C = f(
7
- ({ className: n, containerClassName: t, containerStyles: m, ...e }, l) => {
8
- const { className: o, ...c } = u(e, "Carousel"), { carouselRef: i, columnGap: s } = p();
9
- return /* @__PURE__ */ r(
7
+ ({ className: m, containerClassName: n, containerStyles: t, ...e }, l) => {
8
+ const { className: o, ...c } = u(e, "CarouselContent"), { carouselRef: i, columnGap: s } = p();
9
+ return /* @__PURE__ */ r("div", { ref: i, className: a(`${o}`, n), style: t, children: /* @__PURE__ */ r(
10
10
  "div",
11
11
  {
12
- ref: i,
13
- className: a(`${o}-content`, t),
14
- style: m,
15
- children: /* @__PURE__ */ r(
16
- "div",
17
- {
18
- ref: l,
19
- className: a(`${o}-content-inner`, n, {
20
- [`${o}-content-inner--gap-${s}`]: !!s
21
- }),
22
- ...e,
23
- ...c
24
- }
25
- )
12
+ ref: l,
13
+ className: a(`${o}-inner`, m, {
14
+ [`${o}-inner--gap-${s}`]: !!s
15
+ }),
16
+ ...e,
17
+ ...c
26
18
  }
27
- );
19
+ ) });
28
20
  }
29
21
  );
30
22
  C.displayName = "CarouselContent";
@@ -1,10 +1,9 @@
1
- interface Props {
1
+ import { ComponentProps } from 'react';
2
+ interface Props extends ComponentProps<'button'> {
2
3
  /** Whether the dot is selected */
3
4
  isSelected: boolean;
4
5
  /** Callback function when the dot is clicked */
5
6
  onClick: () => void;
6
- /** Base class name for styling */
7
- baseClassName: string;
8
7
  /** Reference to the scrollable container */
9
8
  scrollableContainerRef: React.RefObject<HTMLDivElement>;
10
9
  /** Callback function when the dot comes into view within the scrollable container */
@@ -12,5 +11,5 @@ interface Props {
12
11
  /** Variant of the dot */
13
12
  variant?: 'sm' | 'md';
14
13
  }
15
- export declare const CarouselDot: ({ isSelected, onClick, baseClassName, scrollableContainerRef, onInViewChange, variant, }: Props) => import("react/jsx-runtime").JSX.Element;
14
+ export declare const CarouselDot: ({ isSelected, onClick, scrollableContainerRef, onInViewChange, variant, ...props }: Props) => import("react/jsx-runtime").JSX.Element;
16
15
  export {};
@@ -1,34 +1,36 @@
1
- import { jsx as n } from "react/jsx-runtime";
1
+ import { jsx as e } from "react/jsx-runtime";
2
2
  import r from "../../node_modules/classnames/index.js";
3
- import { useInView as m } from "../../node_modules/react-intersection-observer/dist/index.js";
4
- const l = ({
5
- isSelected: i,
6
- onClick: e,
7
- baseClassName: o,
8
- scrollableContainerRef: c,
9
- onInViewChange: p,
10
- variant: t = "md"
3
+ import { useInView as i } from "../../node_modules/react-intersection-observer/dist/index.js";
4
+ import { getCommonProps as f } from "../../utils/index.js";
5
+ const N = ({
6
+ isSelected: t,
7
+ onClick: m,
8
+ scrollableContainerRef: n,
9
+ onInViewChange: a,
10
+ variant: s = "md",
11
+ ...c
11
12
  }) => {
12
- const { ref: d } = m({
13
+ const { className: o, ...l } = f(c, "CarouselDot"), { ref: p } = i({
13
14
  threshold: 0,
14
- root: c.current,
15
- onChange(a) {
16
- p(a);
15
+ root: n.current,
16
+ onChange(u) {
17
+ a(u);
17
18
  }
18
19
  });
19
- return /* @__PURE__ */ n(
20
+ return /* @__PURE__ */ e(
20
21
  "button",
21
22
  {
22
- ref: d,
23
+ ref: p,
23
24
  role: "button",
24
- onClick: e,
25
- className: r(`${o}-pagination-dot__container`),
26
- children: /* @__PURE__ */ n(
25
+ onClick: m,
26
+ className: r(`${o}__container`),
27
+ ...l,
28
+ children: /* @__PURE__ */ e(
27
29
  "span",
28
30
  {
29
- className: r(`${o}-pagination-dot`, {
30
- [`${o}-pagination-dot--selected`]: i,
31
- [`${o}-pagination-dot--${t}`]: t
31
+ className: r(`${o}`, {
32
+ [`${o}--selected`]: t,
33
+ [`${o}--${s}`]: s
32
34
  })
33
35
  }
34
36
  )
@@ -36,5 +38,5 @@ const l = ({
36
38
  );
37
39
  };
38
40
  export {
39
- l as CarouselDot
41
+ N as CarouselDot
40
42
  };
@@ -1,46 +1,46 @@
1
1
  import { jsx as u } from "react/jsx-runtime";
2
2
  import B from "../../node_modules/classnames/index.js";
3
- import { forwardRef as E, useId as L, useState as S, useRef as M, useCallback as a, useEffect as W, useMemo as q } from "react";
3
+ import { forwardRef as E, useId as L, useState as S, useRef as M, useCallback as c, useEffect as W, useMemo as q } from "react";
4
4
  import { useCarousel as z } from "./utils.js";
5
5
  import { getCommonProps as A } from "../../utils/index.js";
6
6
  import { CarouselDot as F } from "./CarouselDot.js";
7
7
  const G = E(
8
- ({ className: w, maxDots: g = 9, position: N = "inline", numberOfSlides: v = 0, ...h }, V) => {
9
- const { className: l, ...b } = A(h, "Carousel"), k = L(), { api: o, onSlideChange: n } = z(), [y, R] = S(0), [i, T] = S(
8
+ ({ className: w, maxDots: h = 9, position: N = "inline", numberOfSlides: v = 0, ...C }, V) => {
9
+ const { className: a, ...b } = A(C, "CarouselDots"), k = L(), { api: o, onSlideChange: s } = z(), [y, R] = S(0), [i, T] = S(
10
10
  Array.from({ length: v }, (e, t) => t)
11
- ), c = M(null), [C, D] = S([]), $ = a((e) => {
11
+ ), l = M(null), [D, $] = S([]), g = c((e) => {
12
12
  var t, m;
13
- c.current && ((m = (t = c.current).scrollTo) == null || m.call(t, {
13
+ l.current && ((m = (t = l.current).scrollTo) == null || m.call(t, {
14
14
  // 8px width + 12px gap
15
- left: e * 20 - c.current.offsetWidth / 2 + 10,
15
+ left: e * 20 - l.current.offsetWidth / 2 + 10,
16
16
  // Center dot in container
17
17
  behavior: "smooth"
18
18
  }));
19
- }, []), O = a(
19
+ }, []), O = c(
20
20
  (e) => {
21
- o && (o.scrollTo(e, !0), n == null || n(e));
21
+ o && (o.scrollTo(e, !0), s == null || s(e));
22
22
  },
23
- [o, n]
24
- ), f = a((e) => {
23
+ [o, s]
24
+ ), f = c((e) => {
25
25
  T(e.scrollSnapList());
26
- }, []), s = a(
26
+ }, []), n = c(
27
27
  (e) => {
28
- R(e.selectedScrollSnap()), $(e.selectedScrollSnap());
28
+ R(e.selectedScrollSnap()), g(e.selectedScrollSnap());
29
29
  },
30
- [$]
31
- ), p = a(
30
+ [g]
31
+ ), d = c(
32
32
  (e) => {
33
- n == null || n(e.selectedScrollSnap());
33
+ s == null || s(e.selectedScrollSnap());
34
34
  },
35
- [n]
35
+ [s]
36
36
  );
37
37
  W(() => {
38
38
  if (o)
39
- return f(o), s(o), o.on("reInit", f).on("reInit", s).on("select", s).on("settle", p), () => {
40
- o.off("reInit", f).off("reInit", s).off("select", s).off("settle", p);
39
+ return f(o), n(o), o.on("reInit", f).on("reInit", n).on("select", n).on("settle", d), () => {
40
+ o.off("reInit", f).off("reInit", n).off("select", n).off("settle", d);
41
41
  };
42
- }, [o, f, s, p]);
43
- const r = q(() => C.sort((e, t) => e - t), [C]);
42
+ }, [o, f, n, d]);
43
+ const r = q(() => D.sort((e, t) => e - t), [D]);
44
44
  return /* @__PURE__ */ u(
45
45
  "div",
46
46
  {
@@ -48,20 +48,20 @@ const G = E(
48
48
  role: "group",
49
49
  "aria-roledescription": "pagination",
50
50
  "aria-label": "pagination",
51
- className: B(`${l}-pagination`, w, `${l}-pagination-${N}`),
52
- ...h,
51
+ className: B(`${a}`, w, `${a}-${N}`),
52
+ ...C,
53
53
  ...b,
54
- children: /* @__PURE__ */ u("div", { className: `${l}-pagination-container`, children: /* @__PURE__ */ u(
54
+ children: /* @__PURE__ */ u("div", { className: `${a}-container`, children: /* @__PURE__ */ u(
55
55
  "div",
56
56
  {
57
- style: { "--max-width": `${g * 8 + (g - 1) * 12}px` },
58
- className: `${l}-pagination-container-inner`,
59
- ref: c,
57
+ style: { "--max-width": `${h * 8 + (h - 1) * 12}px` },
58
+ className: `${a}-container-inner`,
59
+ ref: l,
60
60
  children: i.map((e, t) => {
61
- const m = y === t, d = r.indexOf(t), P = (
61
+ const m = y === t, p = r.indexOf(t), P = (
62
62
  // The dot is out of view
63
- d === -1 || // The dot must be either among the first two or last two visible dots
64
- (d <= 1 || d >= r.length - 2) && // Don't shrink if we're showing the first two dots (index 0,1) and both are visible
63
+ p === -1 || // The dot must be either among the first two or last two visible dots
64
+ (p <= 1 || p >= r.length - 2) && // Don't shrink if we're showing the first two dots (index 0,1) and both are visible
65
65
  !(t <= 1 && r.includes(0) && r.includes(1)) && // Don't shrink if we're showing the last two dots and both are visible
66
66
  !(t >= i.length - 2 && r.includes(i.length - 1) && r.includes(i.length - 2))
67
67
  );
@@ -70,10 +70,9 @@ const G = E(
70
70
  {
71
71
  onClick: () => O(t),
72
72
  isSelected: m,
73
- baseClassName: l,
74
- scrollableContainerRef: c,
73
+ scrollableContainerRef: l,
75
74
  onInViewChange: (_) => {
76
- D(_ ? (I) => [...I, t] : (I) => I.filter((j) => j !== t));
75
+ $(_ ? (I) => [...I, t] : (I) => I.filter((j) => j !== t));
77
76
  },
78
77
  variant: P ? "sm" : "md"
79
78
  },
@@ -1,19 +1,19 @@
1
1
  import { jsx as t } from "react/jsx-runtime";
2
- import i from "../../node_modules/classnames/index.js";
3
- import { forwardRef as l } from "react";
2
+ import l from "../../node_modules/classnames/index.js";
3
+ import { forwardRef as i } from "react";
4
4
  import { getCommonProps as n } from "../../utils/index.js";
5
5
  import { useCarousel as c } from "./utils.js";
6
- const u = l(({ className: m, ...o }, s) => {
7
- const { className: e, ...a } = n(o, "Carousel"), { columnGap: r } = c();
6
+ const u = i(({ className: m, ...o }, s) => {
7
+ const { className: r, ...a } = n(o, "CarouselItem"), { columnGap: e } = c();
8
8
  return /* @__PURE__ */ t(
9
9
  "div",
10
10
  {
11
11
  ref: s,
12
12
  role: o.onClick ? "button" : "group",
13
13
  "aria-roledescription": "slide",
14
- className: i(`${e}-item`, m, {
15
- [`${e}-item--gap-${r}`]: !!r,
16
- [`${e}-item--cursor-pointer`]: !!o.onClick
14
+ className: l(`${r}`, m, {
15
+ [`${r}--gap-${e}`]: !!e,
16
+ [`${r}--cursor-pointer`]: !!o.onClick
17
17
  }),
18
18
  ...o,
19
19
  ...a