@phillips/seldon 1.190.0 → 1.192.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.
@@ -35,10 +35,6 @@ export interface CarouselProps extends ComponentProps<'div'> {
35
35
  * The threshold for slides to be considered in view. A value of 0.1 means that 10% of the slide must be in view for it to be considered in view.
36
36
  */
37
37
  inViewThreshold?: number;
38
- /**
39
- * The number of slides to scroll at once.
40
- */
41
- slidesToScroll?: number;
42
38
  }
43
39
  type CarouselContextProps = {
44
40
  carouselRef: ReturnType<typeof useEmblaCarousel>[0];
@@ -1,28 +1,27 @@
1
1
  import { jsx as c } from "react/jsx-runtime";
2
- import { createContext as g, forwardRef as I, useEffect as n, useCallback as f } from "react";
3
- import { getCommonProps as y } from "../../utils/index.js";
4
- import V from "../../node_modules/classnames/index.js";
5
- import A from "../../node_modules/embla-carousel-class-names/esm/embla-carousel-class-names.esm.js";
6
- import R from "../../node_modules/embla-carousel-react/esm/embla-carousel-react.esm.js";
7
- import { WheelGesturesPlugin as S } from "../../node_modules/embla-carousel-wheel-gestures/dist/embla-carousel-wheel-gestures.esm.js";
8
- const E = g(null), K = I(
2
+ import { createContext as P, forwardRef as I, useEffect as f, useCallback as m } from "react";
3
+ import { getCommonProps as E } from "../../utils/index.js";
4
+ import y from "../../node_modules/classnames/index.js";
5
+ import S from "../../node_modules/embla-carousel-class-names/esm/embla-carousel-class-names.esm.js";
6
+ import V from "../../node_modules/embla-carousel-react/esm/embla-carousel-react.esm.js";
7
+ import { WheelGesturesPlugin as A } from "../../node_modules/embla-carousel-wheel-gestures/dist/embla-carousel-wheel-gestures.esm.js";
8
+ const R = P(null), K = I(
9
9
  ({
10
- loop: m = !1,
11
- startIndex: u = 0,
12
- onSlideChange: a,
10
+ loop: u = !1,
11
+ startIndex: d = 0,
12
+ onSlideChange: o,
13
13
  className: p,
14
- children: d,
15
- columnGap: w,
16
- useWheelGestures: x = !1,
17
- disableDrag: o = !1,
18
- disableNavigationDrag: h = null,
19
- inViewThreshold: N = 0.99,
20
- slidesToScroll: k = 1,
21
- ...t
22
- }, v) => {
23
- const { className: C, ...b } = y(t, "Carousel");
14
+ children: w,
15
+ columnGap: x,
16
+ useWheelGestures: N = !1,
17
+ disableDrag: i = !1,
18
+ disableNavigationDrag: v = null,
19
+ inViewThreshold: b = 0.99,
20
+ ...n
21
+ }, h) => {
22
+ const { className: g, ...k } = E(n, "Carousel");
24
23
  let s = {};
25
- switch (h) {
24
+ switch (v) {
26
25
  case "mobile":
27
26
  s = { breakpoints: { "(max-width: 960px)": { watchDrag: !1 } } };
28
27
  break;
@@ -35,75 +34,82 @@ const E = g(null), K = I(
35
34
  default:
36
35
  s = {};
37
36
  }
38
- const [D, e] = R(
37
+ const [C, e] = V(
39
38
  {
40
- loop: m,
41
- startIndex: u,
42
- inViewThreshold: N,
43
- ...s,
44
- slidesToScroll: k
39
+ loop: u,
40
+ startIndex: d,
41
+ inViewThreshold: b,
42
+ ...s
45
43
  },
46
44
  [
47
- ...x ? [
48
- S({
45
+ ...N ? [
46
+ A({
49
47
  forceWheelAxis: "x"
50
48
  })
51
49
  ] : [],
52
- A({
50
+ S({
53
51
  snapped: "carousel-item-in-view"
54
52
  })
55
53
  ]
56
54
  );
57
- n(() => {
58
- o ? e?.reInit({
55
+ f(() => {
56
+ i ? e?.reInit({
59
57
  watchDrag: () => !1
60
58
  }) : e?.reInit({
61
59
  watchDrag: () => !0
62
60
  });
63
- }, [o, e]);
64
- const P = f(
65
- (r) => {
66
- r.key === "ArrowLeft" ? (r.preventDefault(), e?.scrollPrev()) : r.key === "ArrowRight" && (r.preventDefault(), e?.scrollNext());
61
+ }, [i, e]);
62
+ const D = m(
63
+ (l) => {
64
+ if (l.key === "ArrowLeft") {
65
+ l.preventDefault(), e?.scrollPrev();
66
+ const r = e?.slideNodes().filter((t) => t === document.activeElement)[0]?.previousElementSibling;
67
+ r && r?.focus();
68
+ } else if (l.key === "ArrowRight") {
69
+ l.preventDefault(), e?.scrollNext();
70
+ const r = e?.slideNodes().filter((t) => t === document.activeElement)[0]?.nextElementSibling;
71
+ r && r?.focus();
72
+ }
67
73
  },
68
74
  [e]
69
- ), l = f(
70
- (r) => {
71
- if (!r)
75
+ ), a = m(
76
+ (l) => {
77
+ if (!l)
72
78
  return;
73
- const i = r.slidesInView()?.[0];
74
- i !== void 0 && a?.(i);
79
+ const r = l.slidesInView()?.[0];
80
+ r !== void 0 && o?.(r);
75
81
  },
76
- [a]
82
+ [o]
77
83
  );
78
- return n(() => {
84
+ return f(() => {
79
85
  if (e)
80
- return e.on("slidesInView", l), () => {
81
- e.off("slidesInView", l);
86
+ return e.on("slidesInView", a), () => {
87
+ e.off("slidesInView", a);
82
88
  };
83
- }, [e, l]), /* @__PURE__ */ c(
84
- E.Provider,
89
+ }, [e, a]), /* @__PURE__ */ c(
90
+ R.Provider,
85
91
  {
86
92
  value: {
87
- carouselRef: D,
93
+ carouselRef: C,
88
94
  api: e,
89
95
  scrollPrev: () => e?.scrollPrev(),
90
96
  scrollNext: () => e?.scrollNext(),
91
97
  canScrollPrev: e?.canScrollPrev() ?? !1,
92
98
  canScrollNext: e?.canScrollNext() ?? !1,
93
- columnGap: w,
94
- onSlideChange: a
99
+ columnGap: x,
100
+ onSlideChange: o
95
101
  },
96
102
  children: /* @__PURE__ */ c(
97
103
  "div",
98
104
  {
99
- ref: v,
100
- onKeyDownCapture: P,
101
- className: V(C, p),
105
+ ref: h,
106
+ onKeyDownCapture: D,
107
+ className: y(g, p),
102
108
  role: "region",
103
109
  "aria-roledescription": "carousel",
104
- ...t,
105
- ...b,
106
- children: d
110
+ ...n,
111
+ ...k,
112
+ children: w
107
113
  }
108
114
  )
109
115
  }
@@ -112,6 +118,6 @@ const E = g(null), K = I(
112
118
  );
113
119
  K.displayName = "Carousel";
114
120
  export {
115
- E as CarouselContext,
121
+ R as CarouselContext,
116
122
  K as default
117
123
  };
@@ -49,7 +49,6 @@ export declare const CarouselWithMultipleItems: {
49
49
  (props: CarouselProps): import("react/jsx-runtime").JSX.Element;
50
50
  args: {
51
51
  disableNavigationDrag: "desktop";
52
- slidesToScroll: number;
53
52
  };
54
53
  argTypes: {
55
54
  slidesToScroll: {
@@ -1,31 +1,43 @@
1
- import { jsxs as d, jsx as o } from "react/jsx-runtime";
1
+ import { jsxs as h, jsx as s } from "react/jsx-runtime";
2
2
  import u from "../../node_modules/classnames/index.js";
3
- import { forwardRef as p, useCallback as t } from "react";
4
- import { getCommonProps as C } from "../../utils/index.js";
5
- import { useCarousel as f } from "./utils.js";
6
- import a from "../Icon/Icon.js";
7
- const h = p(({ className: n, ...s }, i) => {
8
- const { className: e, ...c } = C(s, "CarouselArrows"), { api: r } = f(), l = t(() => {
9
- r && r.scrollPrev(!0);
10
- }, [r]), m = t(() => {
11
- r && r.scrollNext(!0);
12
- }, [r]);
13
- return /* @__PURE__ */ d(
3
+ import { forwardRef as f, useCallback as n } from "react";
4
+ import { getCommonProps as p } from "../../utils/index.js";
5
+ import { useCarousel as C } from "./utils.js";
6
+ import t from "../Icon/Icon.js";
7
+ const v = f(({ className: l, ...i }, a) => {
8
+ const { className: r, ...c } = p(i, "CarouselArrows"), { api: e } = C(), m = n(() => {
9
+ if (e)
10
+ if (e?.slidesInView().length <= 1)
11
+ e.scrollPrev(!0);
12
+ else {
13
+ const o = e?.slidesInView();
14
+ e?.scrollTo(Math.max(0, o[0] - (o.length ?? 1)));
15
+ }
16
+ }, [e]), d = n(() => {
17
+ if (e)
18
+ if (e?.slidesInView().length <= 1)
19
+ e?.scrollNext(!0);
20
+ else {
21
+ const w = (e?.slidesInView()).slice(-1)[0] + 1;
22
+ e?.scrollTo(w);
23
+ }
24
+ }, [e]);
25
+ return /* @__PURE__ */ h(
14
26
  "div",
15
27
  {
16
- ref: i,
28
+ ref: a,
17
29
  "aria-roledescription": "carousel-arrow-navigation",
18
- className: u(`${e}`, n),
19
- ...s,
30
+ className: u(`${r}`, l),
31
+ ...i,
20
32
  ...c,
21
33
  children: [
22
- /* @__PURE__ */ o("button", { "data-testid": "prev-arrow", className: `${e}-prev-btn`, onClick: () => l(), children: /* @__PURE__ */ o("div", { className: `${e}-prev-btn__icon`, children: /* @__PURE__ */ o(a, { icon: "ChevronLeft", height: "2rem" }) }) }),
23
- /* @__PURE__ */ o("button", { "data-testid": "next-arrow", className: `${e}-next-btn`, onClick: () => m(), children: /* @__PURE__ */ o("div", { className: `${e}-next-btn__icon`, children: /* @__PURE__ */ o(a, { icon: "ChevronRight", height: "2rem" }) }) })
34
+ /* @__PURE__ */ s("button", { "data-testid": "prev-arrow", className: `${r}-prev-btn`, onClick: () => m(), children: /* @__PURE__ */ s("div", { className: `${r}-prev-btn__icon`, children: /* @__PURE__ */ s(t, { icon: "ChevronLeft", height: "2rem" }) }) }),
35
+ /* @__PURE__ */ s("button", { "data-testid": "next-arrow", className: `${r}-next-btn`, onClick: () => d(), children: /* @__PURE__ */ s("div", { className: `${r}-next-btn__icon`, children: /* @__PURE__ */ s(t, { icon: "ChevronRight", height: "2rem" }) }) })
24
36
  ]
25
37
  }
26
38
  );
27
39
  });
28
- h.displayName = "CarouselArrows";
40
+ v.displayName = "CarouselArrows";
29
41
  export {
30
- h as default
42
+ v as default
31
43
  };
@@ -19,12 +19,14 @@
19
19
  background-image: none !important;
20
20
  background-clip: initial !important;
21
21
  border-radius: 0.1875rem !important;
22
- border-color: $black-100 !important;
22
+ /* stylelint-disable-next-line declaration-property-value-allowed-list */
23
+ border-color: #0000 !important;
23
24
  box-shadow: none !important;
24
25
  /* stylelint-disable-next-line property-no-vendor-prefix */
25
26
  -webkit-box-decoration-break: clone !important;
26
27
  box-decoration-break: clone !important;
27
- color: $black-100 !important;
28
+ /* stylelint-disable-next-line declaration-property-value-allowed-list */
29
+ color: #0000 !important;
28
30
  outline: none !important;
29
31
  pointer-events: none !important;
30
32
  /* stylelint-disable-next-line property-no-vendor-prefix */
@@ -47,6 +49,10 @@ input[type='radio'].#{$px}-skeleton {
47
49
 
48
50
  button.#{$px}-skeleton {
49
51
  border-radius: 6.25rem !important;
52
+
53
+ svg path {
54
+ fill: transparent !important;
55
+ }
50
56
  }
51
57
 
52
58
  .#{$px}-toggle-input {
@@ -26,7 +26,7 @@ $highlight-yellow: #fff90a;
26
26
  $highlight-green: #46ea77;
27
27
  $highlight-blue: #0065fc;
28
28
  $highlight-red: #ff3d0a;
29
- $highlight-purple: #802dfa;
29
+ $highlight-purple: #6f4eea;
30
30
 
31
31
  // Functional
32
32
 
@@ -26,7 +26,7 @@ $highlight-yellow: #fff90a;
26
26
  $highlight-green: #46ea77;
27
27
  $highlight-blue: #0065fc;
28
28
  $highlight-red: #ff3d0a;
29
- $highlight-purple: #802dfa;
29
+ $highlight-purple: #6f4eea;
30
30
 
31
31
  // Functional
32
32
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@phillips/seldon",
3
- "version": "1.190.0",
3
+ "version": "1.192.0",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/PhillipsAuctionHouse/seldon"