@phillips/seldon 1.121.0 → 1.122.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.
@@ -27,6 +27,10 @@ export interface CarouselProps extends ComponentProps<'div'> {
27
27
  * Whether the carousel should disable dragging.
28
28
  */
29
29
  disableDrag?: boolean;
30
+ /**
31
+ * Whether to disable dragging to navigate between slides for different viewports.
32
+ */
33
+ disableNavigationDrag?: 'mobile' | 'desktop' | 'all' | null;
30
34
  /**
31
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.
32
36
  */
@@ -1,99 +1,115 @@
1
- import { jsx as i } from "react/jsx-runtime";
2
- import { createContext as I, forwardRef as D, useEffect as c, useCallback as n } from "react";
3
- import { getCommonProps as y } from "../../utils/index.js";
4
- import g from "../../node_modules/classnames/index.js";
5
- import k 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 b } from "../../node_modules/embla-carousel-wheel-gestures/dist/embla-carousel-wheel-gestures.esm.js";
8
- const A = I(null), R = D(
1
+ import { jsx as c } from "react/jsx-runtime";
2
+ import { createContext as P, forwardRef as g, useEffect as n, useCallback as f } from "react";
3
+ import { getCommonProps as I } from "../../utils/index.js";
4
+ import y from "../../node_modules/classnames/index.js";
5
+ import V from "../../node_modules/embla-carousel-class-names/esm/embla-carousel-class-names.esm.js";
6
+ import A from "../../node_modules/embla-carousel-react/esm/embla-carousel-react.esm.js";
7
+ import { WheelGesturesPlugin as R } from "../../node_modules/embla-carousel-wheel-gestures/dist/embla-carousel-wheel-gestures.esm.js";
8
+ const S = P(null), E = g(
9
9
  ({
10
- loop: f = !1,
11
- startIndex: m = 0,
12
- onSlideChange: s,
13
- className: u,
14
- children: p,
15
- columnGap: d,
16
- useWheelGestures: w = !1,
17
- disableDrag: l = !1,
18
- inViewThreshold: x = 0.99,
19
- ...a
20
- }, C) => {
21
- const { className: N, ...v } = y(a, "Carousel"), [P, e] = V(
10
+ loop: m = !1,
11
+ startIndex: u = 0,
12
+ onSlideChange: a,
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
+ ...t
21
+ }, k) => {
22
+ const { className: v, ...C } = I(t, "Carousel");
23
+ let s = {};
24
+ switch (h) {
25
+ case "mobile":
26
+ s = { breakpoints: { "(max-width: 960px)": { watchDrag: !1 } } };
27
+ break;
28
+ case "desktop":
29
+ s = { breakpoints: { "(min-width: 961px)": { watchDrag: !1 } } };
30
+ break;
31
+ case "all":
32
+ s = { watchDrag: !1 };
33
+ break;
34
+ default:
35
+ s = {};
36
+ }
37
+ const [b, e] = A(
22
38
  {
23
- loop: f,
24
- startIndex: m,
25
- inViewThreshold: x,
26
- breakpoints: { "(min-width: 961px)": { watchDrag: !1 } }
39
+ loop: m,
40
+ startIndex: u,
41
+ inViewThreshold: N,
42
+ ...s
27
43
  },
28
44
  [
29
- ...w ? [
30
- b({
45
+ ...x ? [
46
+ R({
31
47
  forceWheelAxis: "x"
32
48
  })
33
49
  ] : [],
34
- k({
50
+ V({
35
51
  snapped: "carousel-item-in-view"
36
52
  })
37
53
  ]
38
54
  );
39
- c(() => {
40
- l ? e?.reInit({
55
+ n(() => {
56
+ o ? e?.reInit({
41
57
  watchDrag: () => !1
42
58
  }) : e?.reInit({
43
59
  watchDrag: () => !0
44
60
  });
45
- }, [l, e]);
46
- const h = n(
61
+ }, [o, e]);
62
+ const D = f(
47
63
  (r) => {
48
64
  r.key === "ArrowLeft" ? (r.preventDefault(), e?.scrollPrev()) : r.key === "ArrowRight" && (r.preventDefault(), e?.scrollNext());
49
65
  },
50
66
  [e]
51
- ), o = n(
67
+ ), l = f(
52
68
  (r) => {
53
69
  if (!r)
54
70
  return;
55
- const t = r.slidesInView()?.[0];
56
- t !== void 0 && s?.(t);
71
+ const i = r.slidesInView()?.[0];
72
+ i !== void 0 && a?.(i);
57
73
  },
58
- [s]
74
+ [a]
59
75
  );
60
- return c(() => {
76
+ return n(() => {
61
77
  if (e)
62
- return e.on("slidesInView", o), () => {
63
- e.off("slidesInView", o);
78
+ return e.on("slidesInView", l), () => {
79
+ e.off("slidesInView", l);
64
80
  };
65
- }, [e, o]), /* @__PURE__ */ i(
66
- A.Provider,
81
+ }, [e, l]), /* @__PURE__ */ c(
82
+ S.Provider,
67
83
  {
68
84
  value: {
69
- carouselRef: P,
85
+ carouselRef: b,
70
86
  api: e,
71
87
  scrollPrev: () => e?.scrollPrev(),
72
88
  scrollNext: () => e?.scrollNext(),
73
89
  canScrollPrev: e?.canScrollPrev() ?? !1,
74
90
  canScrollNext: e?.canScrollNext() ?? !1,
75
- columnGap: d,
76
- onSlideChange: s
91
+ columnGap: w,
92
+ onSlideChange: a
77
93
  },
78
- children: /* @__PURE__ */ i(
94
+ children: /* @__PURE__ */ c(
79
95
  "div",
80
96
  {
81
- ref: C,
82
- onKeyDownCapture: h,
83
- className: g(N, u),
97
+ ref: k,
98
+ onKeyDownCapture: D,
99
+ className: y(v, p),
84
100
  role: "region",
85
101
  "aria-roledescription": "carousel",
86
- ...a,
87
- ...v,
88
- children: p
102
+ ...t,
103
+ ...C,
104
+ children: d
89
105
  }
90
106
  )
91
107
  }
92
108
  );
93
109
  }
94
110
  );
95
- R.displayName = "Carousel";
111
+ E.displayName = "Carousel";
96
112
  export {
97
- A as CarouselContext,
98
- R as default
113
+ S as CarouselContext,
114
+ E as default
99
115
  };
@@ -12,7 +12,9 @@ export declare const Playground: {
12
12
  };
13
13
  export declare const CarouselWithArrows: {
14
14
  (props: CarouselProps): import("react/jsx-runtime").JSX.Element;
15
- args: {};
15
+ args: {
16
+ disableNavigationDrag: "desktop";
17
+ };
16
18
  argTypes: {};
17
19
  };
18
20
  export declare const CarouselWithDots: {
@@ -1,12 +1,12 @@
1
1
  import { jsxs as m, jsx as o } from "react/jsx-runtime";
2
2
  import u from "../../node_modules/classnames/index.js";
3
- import { forwardRef as p, useCallback as a } from "react";
4
- import { getCommonProps as C } from "../../utils/index.js";
5
- import { useCarousel as d } from "./utils.js";
3
+ import { forwardRef as d, useCallback as a } from "react";
4
+ import { getCommonProps as p } from "../../utils/index.js";
5
+ import { useCarousel as C } from "./utils.js";
6
6
  import f from "../../assets/CarouselArrowNext.svg.js";
7
7
  import v from "../../assets/CarouselArrowPrev.svg.js";
8
- const N = p(({ className: t, ...s }, l) => {
9
- const { className: e, ...n } = C(s, "CarouselArrows"), { api: r } = d(), i = a(() => {
8
+ const w = d(({ className: t, ...s }, n) => {
9
+ const { className: e, ...l } = p(s, "CarouselArrows"), { api: r } = C(), i = a(() => {
10
10
  r && r.scrollPrev(!0);
11
11
  }, [r]), c = a(() => {
12
12
  r && r.scrollNext(!0);
@@ -14,19 +14,19 @@ const N = p(({ className: t, ...s }, l) => {
14
14
  return /* @__PURE__ */ m(
15
15
  "div",
16
16
  {
17
- ref: l,
17
+ ref: n,
18
18
  "aria-roledescription": "carousel-arrow-navigation",
19
19
  className: u(`${e}`, t),
20
20
  ...s,
21
- ...n,
21
+ ...l,
22
22
  children: [
23
- /* @__PURE__ */ o("button", { className: `${e}-prev-btn`, onClick: () => i(), children: /* @__PURE__ */ o("div", { className: `${e}-prev-btn__icon`, children: /* @__PURE__ */ o(v, {}) }) }),
24
- /* @__PURE__ */ o("button", { className: `${e}-next-btn`, onClick: () => c(), children: /* @__PURE__ */ o("div", { className: `${e}-next-btn__icon`, children: /* @__PURE__ */ o(f, {}) }) })
23
+ /* @__PURE__ */ o("button", { "data-testid": "prev-arrow", className: `${e}-prev-btn`, onClick: () => i(), children: /* @__PURE__ */ o("div", { className: `${e}-prev-btn__icon`, children: /* @__PURE__ */ o(v, {}) }) }),
24
+ /* @__PURE__ */ o("button", { "data-testid": "next-arrow", className: `${e}-next-btn`, onClick: () => c(), children: /* @__PURE__ */ o("div", { className: `${e}-next-btn__icon`, children: /* @__PURE__ */ o(f, {}) }) })
25
25
  ]
26
26
  }
27
27
  );
28
28
  });
29
- N.displayName = "CarouselArrows";
29
+ w.displayName = "CarouselArrows";
30
30
  export {
31
- N as default
31
+ w as default
32
32
  };
@@ -0,0 +1 @@
1
+ export {};
@@ -1,7 +1,6 @@
1
1
  @use '../../allPartials' as *;
2
2
 
3
3
  .#{$px}-bid-snapshot {
4
- padding-bottom: $spacing-sm;
5
4
  position: relative;
6
5
 
7
6
  &__text .#{$px}-has-separators .#{$px}-detail {
@@ -30,6 +29,13 @@
30
29
  &--has-bids .#{$px}-detail__value {
31
30
  font-variation-settings: 'wght' 600;
32
31
  }
32
+
33
+ // styles that will apply to bid message inside bid snapshot only
34
+ .#{$px}-bid-message {
35
+ &.#{$px}-bid-message {
36
+ margin-bottom: $spacing-sm;
37
+ }
38
+ }
33
39
  }
34
40
 
35
41
  .#{$px}-bid-message {
@@ -39,8 +39,8 @@
39
39
 
40
40
  .#{$px}-object-tile__lot-badge {
41
41
  display: inline-block;
42
- position: absolute;
43
42
  left: 4%;
43
+ position: absolute;
44
44
 
45
45
  svg {
46
46
  height: 100%;
@@ -50,12 +50,12 @@
50
50
  fill: $pure-black;
51
51
  }
52
52
  }
53
- }
53
+ }
54
54
  }
55
55
 
56
56
  & .#{$px}-object-tile__lot-number {
57
- margin-bottom: $spacing-xsm;
58
57
  display: inline-block;
58
+ margin-bottom: $spacing-xsm;
59
59
  }
60
60
 
61
61
  & .#{$px}-object-tile__maker,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@phillips/seldon",
3
- "version": "1.121.0",
3
+ "version": "1.122.0",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/PhillipsAuctionHouse/seldon"