@phillips/seldon 1.121.0 → 1.122.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.
- package/dist/components/Carousel/Carousel.d.ts +4 -0
- package/dist/components/Carousel/Carousel.js +69 -53
- package/dist/components/Carousel/Carousel.stories.d.ts +3 -1
- package/dist/components/Carousel/CarouselArrows.js +11 -11
- package/dist/components/Carousel/CarouselArrows.test.d.ts +1 -0
- package/dist/components/Carousel/CarouselDots.js +11 -12
- package/dist/scss/components/Carousel/_carousel.scss +2 -4
- package/dist/scss/patterns/BidSnapshot/_bidSnapshot.scss +7 -1
- package/dist/scss/patterns/ObjectTile/_objectTile.scss +3 -3
- package/package.json +1 -1
|
@@ -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
|
|
2
|
-
import { createContext as
|
|
3
|
-
import { getCommonProps as
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import { WheelGesturesPlugin as
|
|
8
|
-
const
|
|
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:
|
|
11
|
-
startIndex:
|
|
12
|
-
onSlideChange:
|
|
13
|
-
className:
|
|
14
|
-
children:
|
|
15
|
-
columnGap:
|
|
16
|
-
useWheelGestures:
|
|
17
|
-
disableDrag:
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
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:
|
|
24
|
-
startIndex:
|
|
25
|
-
inViewThreshold:
|
|
26
|
-
|
|
39
|
+
loop: m,
|
|
40
|
+
startIndex: u,
|
|
41
|
+
inViewThreshold: N,
|
|
42
|
+
...s
|
|
27
43
|
},
|
|
28
44
|
[
|
|
29
|
-
...
|
|
30
|
-
|
|
45
|
+
...x ? [
|
|
46
|
+
R({
|
|
31
47
|
forceWheelAxis: "x"
|
|
32
48
|
})
|
|
33
49
|
] : [],
|
|
34
|
-
|
|
50
|
+
V({
|
|
35
51
|
snapped: "carousel-item-in-view"
|
|
36
52
|
})
|
|
37
53
|
]
|
|
38
54
|
);
|
|
39
|
-
|
|
40
|
-
|
|
55
|
+
n(() => {
|
|
56
|
+
o ? e?.reInit({
|
|
41
57
|
watchDrag: () => !1
|
|
42
58
|
}) : e?.reInit({
|
|
43
59
|
watchDrag: () => !0
|
|
44
60
|
});
|
|
45
|
-
}, [
|
|
46
|
-
const
|
|
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
|
-
),
|
|
67
|
+
), l = f(
|
|
52
68
|
(r) => {
|
|
53
69
|
if (!r)
|
|
54
70
|
return;
|
|
55
|
-
const
|
|
56
|
-
|
|
71
|
+
const i = r.slidesInView()?.[0];
|
|
72
|
+
i !== void 0 && a?.(i);
|
|
57
73
|
},
|
|
58
|
-
[
|
|
74
|
+
[a]
|
|
59
75
|
);
|
|
60
|
-
return
|
|
76
|
+
return n(() => {
|
|
61
77
|
if (e)
|
|
62
|
-
return e.on("slidesInView",
|
|
63
|
-
e.off("slidesInView",
|
|
78
|
+
return e.on("slidesInView", l), () => {
|
|
79
|
+
e.off("slidesInView", l);
|
|
64
80
|
};
|
|
65
|
-
}, [e,
|
|
66
|
-
|
|
81
|
+
}, [e, l]), /* @__PURE__ */ c(
|
|
82
|
+
S.Provider,
|
|
67
83
|
{
|
|
68
84
|
value: {
|
|
69
|
-
carouselRef:
|
|
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:
|
|
76
|
-
onSlideChange:
|
|
91
|
+
columnGap: w,
|
|
92
|
+
onSlideChange: a
|
|
77
93
|
},
|
|
78
|
-
children: /* @__PURE__ */
|
|
94
|
+
children: /* @__PURE__ */ c(
|
|
79
95
|
"div",
|
|
80
96
|
{
|
|
81
|
-
ref:
|
|
82
|
-
onKeyDownCapture:
|
|
83
|
-
className:
|
|
97
|
+
ref: k,
|
|
98
|
+
onKeyDownCapture: D,
|
|
99
|
+
className: y(v, p),
|
|
84
100
|
role: "region",
|
|
85
101
|
"aria-roledescription": "carousel",
|
|
86
|
-
...
|
|
87
|
-
...
|
|
88
|
-
children:
|
|
102
|
+
...t,
|
|
103
|
+
...C,
|
|
104
|
+
children: d
|
|
89
105
|
}
|
|
90
106
|
)
|
|
91
107
|
}
|
|
92
108
|
);
|
|
93
109
|
}
|
|
94
110
|
);
|
|
95
|
-
|
|
111
|
+
E.displayName = "Carousel";
|
|
96
112
|
export {
|
|
97
|
-
|
|
98
|
-
|
|
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
|
|
4
|
-
import { getCommonProps as
|
|
5
|
-
import { useCarousel as
|
|
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
|
|
9
|
-
const { className: e, ...
|
|
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:
|
|
17
|
+
ref: n,
|
|
18
18
|
"aria-roledescription": "carousel-arrow-navigation",
|
|
19
19
|
className: u(`${e}`, t),
|
|
20
20
|
...s,
|
|
21
|
-
...
|
|
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
|
-
|
|
29
|
+
w.displayName = "CarouselArrows";
|
|
30
30
|
export {
|
|
31
|
-
|
|
31
|
+
w as default
|
|
32
32
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -4,14 +4,13 @@ import { forwardRef as G, useId as L, useState as S, useRef as M, useCallback as
|
|
|
4
4
|
import { useCarousel as A } from "./utils.js";
|
|
5
5
|
import { getCommonProps as F } from "../../utils/index.js";
|
|
6
6
|
import { CarouselDot as H } from "./CarouselDot.js";
|
|
7
|
-
const
|
|
8
|
-
({ className: N, maxDots:
|
|
9
|
-
const { className: c, ...k } = F(
|
|
7
|
+
const h = 10, C = 12, J = (h + C) / 2, K = G(
|
|
8
|
+
({ className: N, maxDots: I = 9, position: v = "inline", numberOfSlides: V = 0, ...g }, b) => {
|
|
9
|
+
const { className: c, ...k } = F(g, "CarouselDots"), y = L(), { api: t, onSlideChange: a } = A(), [R, T] = S(0), [i, O] = S(
|
|
10
10
|
Array.from({ length: V }, (e, o) => o)
|
|
11
|
-
), r = M(null), [
|
|
11
|
+
), r = M(null), [D, $] = S([]), w = l((e) => {
|
|
12
12
|
r.current && r.current.scrollTo?.({
|
|
13
|
-
|
|
14
|
-
left: e * ($ + w) - r.current.offsetWidth / 2 + J,
|
|
13
|
+
left: e * (h + C) - r.current.offsetWidth / 2 + J,
|
|
15
14
|
// Center dot in container
|
|
16
15
|
behavior: "smooth"
|
|
17
16
|
});
|
|
@@ -24,9 +23,9 @@ const $ = 10, w = 10, J = 11, K = G(
|
|
|
24
23
|
O(e.scrollSnapList());
|
|
25
24
|
}, []), n = l(
|
|
26
25
|
(e) => {
|
|
27
|
-
T(e.selectedScrollSnap()),
|
|
26
|
+
T(e.selectedScrollSnap()), w(e.selectedScrollSnap());
|
|
28
27
|
},
|
|
29
|
-
[
|
|
28
|
+
[w]
|
|
30
29
|
), u = l(
|
|
31
30
|
(e) => {
|
|
32
31
|
a?.(e.selectedScrollSnap());
|
|
@@ -39,7 +38,7 @@ const $ = 10, w = 10, J = 11, K = G(
|
|
|
39
38
|
t.off("reInit", f).off("reInit", n).off("select", n).off("settle", u);
|
|
40
39
|
};
|
|
41
40
|
}, [t, f, n, u]);
|
|
42
|
-
const s = z(() =>
|
|
41
|
+
const s = z(() => D.sort((e, o) => e - o), [D]);
|
|
43
42
|
return /* @__PURE__ */ m(
|
|
44
43
|
"div",
|
|
45
44
|
{
|
|
@@ -48,12 +47,12 @@ const $ = 10, w = 10, J = 11, K = G(
|
|
|
48
47
|
"aria-roledescription": "pagination",
|
|
49
48
|
"aria-label": "pagination",
|
|
50
49
|
className: E(`${c}`, N, `${c}-${v}`),
|
|
51
|
-
...
|
|
50
|
+
...g,
|
|
52
51
|
...k,
|
|
53
52
|
children: /* @__PURE__ */ m("div", { className: `${c}-container`, children: /* @__PURE__ */ m(
|
|
54
53
|
"div",
|
|
55
54
|
{
|
|
56
|
-
style: { "--max-width": `${
|
|
55
|
+
style: { "--max-width": `${I * h + (I - 1) * C + 2}px` },
|
|
57
56
|
className: `${c}-container-inner`,
|
|
58
57
|
ref: r,
|
|
59
58
|
children: i.map((e, o) => {
|
|
@@ -71,7 +70,7 @@ const $ = 10, w = 10, J = 11, K = G(
|
|
|
71
70
|
isSelected: W,
|
|
72
71
|
scrollableContainerRef: r,
|
|
73
72
|
onInViewChange: (j) => {
|
|
74
|
-
|
|
73
|
+
$(j ? (p) => [...p, o] : (p) => p.filter((B) => B !== o));
|
|
75
74
|
},
|
|
76
75
|
variant: _ ? "sm" : "md"
|
|
77
76
|
},
|
|
@@ -93,7 +93,6 @@
|
|
|
93
93
|
&-dots {
|
|
94
94
|
align-items: center;
|
|
95
95
|
display: flex;
|
|
96
|
-
gap: 12px;
|
|
97
96
|
justify-content: center;
|
|
98
97
|
margin-top: 1rem;
|
|
99
98
|
|
|
@@ -120,14 +119,14 @@
|
|
|
120
119
|
&-container-inner {
|
|
121
120
|
align-items: center;
|
|
122
121
|
display: flex;
|
|
123
|
-
gap:
|
|
122
|
+
gap: 12px;
|
|
124
123
|
max-width: var(--max-width);
|
|
125
124
|
overflow: auto;
|
|
126
125
|
-webkit-overflow-scrolling: touch;
|
|
127
126
|
-ms-overflow-style: none; /* Internet Explorer 10+ */
|
|
127
|
+
padding: 1px 2px;
|
|
128
128
|
scroll-snap-type: x mandatory;
|
|
129
129
|
scrollbar-width: none; /* Firefox */
|
|
130
|
-
|
|
131
130
|
&::-webkit-scrollbar {
|
|
132
131
|
display: none; /* Safari and Chrome */
|
|
133
132
|
}
|
|
@@ -139,7 +138,6 @@
|
|
|
139
138
|
display: flex;
|
|
140
139
|
height: 10px;
|
|
141
140
|
justify-content: center;
|
|
142
|
-
margin: 2px;
|
|
143
141
|
min-width: 10px;
|
|
144
142
|
padding: 1px;
|
|
145
143
|
scroll-snap-align: center;
|
|
@@ -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,
|