@phillips/seldon 1.115.0 → 1.115.1

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.
@@ -14,13 +14,5 @@ export interface CarouselDotsProps extends ComponentProps<'div'> {
14
14
  */
15
15
  numberOfSlides?: number;
16
16
  }
17
- /**
18
- * ## Overview
19
- *
20
- * Carousel dots component that displays pagination for the carousel.
21
- * It supports a maximum number of visible dots
22
- * The dots animate left to right as the user navigates through the carousel.
23
- *
24
- */
25
17
  declare const CarouselDots: import('react').ForwardRefExoticComponent<Omit<CarouselDotsProps, "ref"> & import('react').RefAttributes<HTMLDivElement>>;
26
18
  export default CarouselDots;
@@ -1,31 +1,31 @@
1
1
  import { jsx as u } from "react/jsx-runtime";
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 c, useEffect as W, useMemo as q } from "react";
4
- import { useCarousel as z } from "./utils.js";
5
- import { getCommonProps as A } from "../../utils/index.js";
6
- import { CarouselDot as F } from "./CarouselDot.js";
7
- const G = E(
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
- Array.from({ length: v }, (e, t) => t)
2
+ import E from "../../node_modules/classnames/index.js";
3
+ import { forwardRef as G, useId as L, useState as S, useRef as M, useCallback as c, useEffect as q, useMemo as z } from "react";
4
+ import { useCarousel as A } from "./utils.js";
5
+ import { getCommonProps as F } from "../../utils/index.js";
6
+ import { CarouselDot as H } from "./CarouselDot.js";
7
+ const w = 10, N = 10, J = 11, K = G(
8
+ ({ className: v, maxDots: h = 9, position: V = "inline", numberOfSlides: b = 0, ...C }, k) => {
9
+ const { className: a, ...y } = F(C, "CarouselDots"), R = L(), { api: o, onSlideChange: s } = A(), [T, O] = S(0), [i, P] = S(
10
+ Array.from({ length: b }, (e, t) => t)
11
11
  ), l = M(null), [D, $] = S([]), g = c((e) => {
12
12
  var t, m;
13
13
  l.current && ((m = (t = l.current).scrollTo) == null || m.call(t, {
14
14
  // 8px width + 12px gap
15
- left: e * 20 - l.current.offsetWidth / 2 + 10,
15
+ left: e * (w + N) - l.current.offsetWidth / 2 + J,
16
16
  // Center dot in container
17
17
  behavior: "smooth"
18
18
  }));
19
- }, []), O = c(
19
+ }, []), W = c(
20
20
  (e) => {
21
21
  o && (o.scrollTo(e, !0), s == null || s(e));
22
22
  },
23
23
  [o, s]
24
24
  ), f = c((e) => {
25
- T(e.scrollSnapList());
25
+ P(e.scrollSnapList());
26
26
  }, []), n = c(
27
27
  (e) => {
28
- R(e.selectedScrollSnap()), g(e.selectedScrollSnap());
28
+ O(e.selectedScrollSnap()), g(e.selectedScrollSnap());
29
29
  },
30
30
  [g]
31
31
  ), d = c(
@@ -34,31 +34,31 @@ const G = E(
34
34
  },
35
35
  [s]
36
36
  );
37
- W(() => {
37
+ q(() => {
38
38
  if (o)
39
39
  return f(o), n(o), o.on("reInit", f).on("reInit", n).on("select", n).on("settle", d), () => {
40
40
  o.off("reInit", f).off("reInit", n).off("select", n).off("settle", d);
41
41
  };
42
42
  }, [o, f, n, d]);
43
- const r = q(() => D.sort((e, t) => e - t), [D]);
43
+ const r = z(() => D.sort((e, t) => e - t), [D]);
44
44
  return /* @__PURE__ */ u(
45
45
  "div",
46
46
  {
47
- ref: V,
47
+ ref: k,
48
48
  role: "group",
49
49
  "aria-roledescription": "pagination",
50
50
  "aria-label": "pagination",
51
- className: B(`${a}`, w, `${a}-${N}`),
51
+ className: E(`${a}`, v, `${a}-${V}`),
52
52
  ...C,
53
- ...b,
53
+ ...y,
54
54
  children: /* @__PURE__ */ u("div", { className: `${a}-container`, children: /* @__PURE__ */ u(
55
55
  "div",
56
56
  {
57
- style: { "--max-width": `${h * 8 + (h - 1) * 12}px` },
57
+ style: { "--max-width": `${h * w + (h - 1) * N}px` },
58
58
  className: `${a}-container-inner`,
59
59
  ref: l,
60
60
  children: i.map((e, t) => {
61
- const m = y === t, p = r.indexOf(t), P = (
61
+ const m = T === t, p = r.indexOf(t), _ = (
62
62
  // The dot is out of view
63
63
  p === -1 || // The dot must be either among the first two or last two visible dots
64
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
@@ -66,17 +66,17 @@ const G = E(
66
66
  !(t >= i.length - 2 && r.includes(i.length - 1) && r.includes(i.length - 2))
67
67
  );
68
68
  return /* @__PURE__ */ u(
69
- F,
69
+ H,
70
70
  {
71
- onClick: () => O(t),
71
+ onClick: () => W(t),
72
72
  isSelected: m,
73
73
  scrollableContainerRef: l,
74
- onInViewChange: (_) => {
75
- $(_ ? (I) => [...I, t] : (I) => I.filter((j) => j !== t));
74
+ onInViewChange: (j) => {
75
+ $(j ? (I) => [...I, t] : (I) => I.filter((B) => B !== t));
76
76
  },
77
- variant: P ? "sm" : "md"
77
+ variant: _ ? "sm" : "md"
78
78
  },
79
- `${k}-dot-${t}`
79
+ `${R}-dot-${t}`
80
80
  );
81
81
  })
82
82
  }
@@ -85,7 +85,7 @@ const G = E(
85
85
  );
86
86
  }
87
87
  );
88
- G.displayName = "CarouselDots";
88
+ K.displayName = "CarouselDots";
89
89
  export {
90
- G as default
90
+ K as default
91
91
  };
@@ -62,7 +62,7 @@
62
62
  &-container-inner {
63
63
  align-items: center;
64
64
  display: flex;
65
- gap: 12px;
65
+ gap: 10px;
66
66
  max-width: var(--max-width);
67
67
  overflow: auto;
68
68
  -webkit-overflow-scrolling: touch;
@@ -79,17 +79,31 @@
79
79
  &-dot__container {
80
80
  align-items: center;
81
81
  display: flex;
82
- height: 8px;
82
+ height: 10px;
83
83
  justify-content: center;
84
- min-width: 8px;
84
+ margin: 2px;
85
+ min-width: 10px;
85
86
  padding: 1px;
86
87
  scroll-snap-align: center;
87
- width: 8px;
88
+ width: 10px;
89
+
90
+ &:focus-visible {
91
+ border-radius: 50%;
92
+ outline: 0.5px solid #000;
93
+
94
+ &-dot {
95
+ &:hover {
96
+ background-color: transparent;
97
+ outline: 1px solid #000;
98
+ }
99
+ }
100
+ }
88
101
  }
89
102
 
90
103
  &-dot {
104
+ background-color: #eceae7;
91
105
  border-radius: 50%;
92
- outline: 1px solid #adadad;
106
+ outline-color: #eceae7;
93
107
 
94
108
  &--md {
95
109
  height: 100%;
@@ -101,9 +115,19 @@
101
115
  width: 50%;
102
116
  }
103
117
 
118
+ &:hover {
119
+ background-color: transparent;
120
+ outline: 1px solid #000;
121
+ }
122
+
104
123
  &--selected {
105
- background-color: #525050;
106
- outline-color: #525050;
124
+ background-color: #000;
125
+ outline-color: #000;
126
+
127
+ &:hover {
128
+ background-color: #000;
129
+ outline: none;
130
+ }
107
131
  }
108
132
  }
109
133
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@phillips/seldon",
3
- "version": "1.115.0",
3
+ "version": "1.115.1",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/PhillipsAuctionHouse/seldon"