@jobber/components 6.111.4 → 6.111.6
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/LightBox/LightBox.d.ts +11 -0
- package/dist/LightBox-cjs.js +13 -17
- package/dist/LightBox-es.js +13 -17
- package/dist/styles.css +55 -10
- package/package.json +2 -2
|
@@ -41,5 +41,16 @@ interface LightBoxProps {
|
|
|
41
41
|
*/
|
|
42
42
|
readonly boxSizing?: CSSProperties["boxSizing"];
|
|
43
43
|
}
|
|
44
|
+
export declare const slideVariants: {
|
|
45
|
+
enter: (directionRef: React.RefObject<number>) => {
|
|
46
|
+
x: string;
|
|
47
|
+
};
|
|
48
|
+
center: {
|
|
49
|
+
x: number;
|
|
50
|
+
};
|
|
51
|
+
exit: (directionRef: React.RefObject<number>) => {
|
|
52
|
+
x: string;
|
|
53
|
+
};
|
|
54
|
+
};
|
|
44
55
|
export declare function LightBox({ boxSizing, open, images, imageIndex, onRequestClose, }: LightBoxProps): React.JSX.Element;
|
|
45
56
|
export {};
|
package/dist/LightBox-cjs.js
CHANGED
|
@@ -17,20 +17,16 @@ const swipeConfidenceThreshold = 10000;
|
|
|
17
17
|
const swipePower = (offset, velocity) => {
|
|
18
18
|
return Math.abs(offset) * velocity;
|
|
19
19
|
};
|
|
20
|
-
const
|
|
21
|
-
enter: (
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
};
|
|
25
|
-
},
|
|
20
|
+
const slideVariants = {
|
|
21
|
+
enter: (directionRef) => ({
|
|
22
|
+
x: directionRef.current > 0 ? "150%" : "-150%",
|
|
23
|
+
}),
|
|
26
24
|
center: {
|
|
27
25
|
x: 0,
|
|
28
26
|
},
|
|
29
|
-
exit: (
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
};
|
|
33
|
-
},
|
|
27
|
+
exit: (directionRef) => ({
|
|
28
|
+
x: directionRef.current < 0 ? "150%" : "-150%",
|
|
29
|
+
}),
|
|
34
30
|
};
|
|
35
31
|
const imageTransition = {
|
|
36
32
|
x: { duration: 0.65, ease: [0.42, 0, 0, 1.03] },
|
|
@@ -42,7 +38,7 @@ const BUTTON_DEBOUNCE_DELAY = 250;
|
|
|
42
38
|
const MOVEMENT_DEBOUNCE_DELAY = 1000;
|
|
43
39
|
function LightBox({ boxSizing = "content-box", open, images, imageIndex = 0, onRequestClose, }) {
|
|
44
40
|
const [currentImageIndex, setCurrentImageIndex] = React.useState(imageIndex);
|
|
45
|
-
const
|
|
41
|
+
const directionRef = React.useRef(0);
|
|
46
42
|
const [mouseIsStationary, setMouseIsStationary] = React.useState(true);
|
|
47
43
|
const lightboxRef = jobberHooks.useFocusTrap(open);
|
|
48
44
|
const selectedThumbnailRef = React.useRef(null);
|
|
@@ -94,7 +90,7 @@ function LightBox({ boxSizing = "content-box", open, images, imageIndex = 0, onR
|
|
|
94
90
|
React.createElement(ButtonDismiss.ButtonDismiss, { ariaLabel: "Close", onClick: handleRequestClose })))),
|
|
95
91
|
React.createElement("div", { className: styles.imageArea },
|
|
96
92
|
React.createElement(framerMotion.AnimatePresence, { initial: false },
|
|
97
|
-
React.createElement(framerMotion.motion.img, { key: currentImageIndex, variants:
|
|
93
|
+
React.createElement(framerMotion.motion.img, { key: currentImageIndex, variants: slideVariants, src: images[currentImageIndex].url, custom: directionRef, className: styles.image, initial: "enter", alt: images[currentImageIndex].alt ||
|
|
98
94
|
images[currentImageIndex].title ||
|
|
99
95
|
"", animate: "center", exit: "exit", transition: imageTransition, drag: "x", dragConstraints: { left: 0, right: 0 }, dragElastic: 1, onDragEnd: handleOnDragEnd }))),
|
|
100
96
|
images.length > 1 && (React.createElement(React.Fragment, null,
|
|
@@ -116,11 +112,11 @@ function LightBox({ boxSizing = "content-box", open, images, imageIndex = 0, onR
|
|
|
116
112
|
? ReactDOM.createPortal(template, document.body)
|
|
117
113
|
: template;
|
|
118
114
|
function handleMovePrevious() {
|
|
119
|
-
|
|
115
|
+
directionRef.current = -1;
|
|
120
116
|
setCurrentImageIndex((currentImageIndex + images.length - 1) % images.length);
|
|
121
117
|
}
|
|
122
118
|
function handleMoveNext() {
|
|
123
|
-
|
|
119
|
+
directionRef.current = 1;
|
|
124
120
|
setCurrentImageIndex((currentImageIndex + 1) % images.length);
|
|
125
121
|
}
|
|
126
122
|
function handleRequestClose() {
|
|
@@ -137,10 +133,10 @@ function LightBox({ boxSizing = "content-box", open, images, imageIndex = 0, onR
|
|
|
137
133
|
}
|
|
138
134
|
function handleThumbnailClick(index) {
|
|
139
135
|
if (index < currentImageIndex) {
|
|
140
|
-
|
|
136
|
+
directionRef.current = -1;
|
|
141
137
|
}
|
|
142
138
|
else {
|
|
143
|
-
|
|
139
|
+
directionRef.current = 1;
|
|
144
140
|
}
|
|
145
141
|
setCurrentImageIndex(index);
|
|
146
142
|
}
|
package/dist/LightBox-es.js
CHANGED
|
@@ -15,20 +15,16 @@ const swipeConfidenceThreshold = 10000;
|
|
|
15
15
|
const swipePower = (offset, velocity) => {
|
|
16
16
|
return Math.abs(offset) * velocity;
|
|
17
17
|
};
|
|
18
|
-
const
|
|
19
|
-
enter: (
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
};
|
|
23
|
-
},
|
|
18
|
+
const slideVariants = {
|
|
19
|
+
enter: (directionRef) => ({
|
|
20
|
+
x: directionRef.current > 0 ? "150%" : "-150%",
|
|
21
|
+
}),
|
|
24
22
|
center: {
|
|
25
23
|
x: 0,
|
|
26
24
|
},
|
|
27
|
-
exit: (
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
};
|
|
31
|
-
},
|
|
25
|
+
exit: (directionRef) => ({
|
|
26
|
+
x: directionRef.current < 0 ? "150%" : "-150%",
|
|
27
|
+
}),
|
|
32
28
|
};
|
|
33
29
|
const imageTransition = {
|
|
34
30
|
x: { duration: 0.65, ease: [0.42, 0, 0, 1.03] },
|
|
@@ -40,7 +36,7 @@ const BUTTON_DEBOUNCE_DELAY = 250;
|
|
|
40
36
|
const MOVEMENT_DEBOUNCE_DELAY = 1000;
|
|
41
37
|
function LightBox({ boxSizing = "content-box", open, images, imageIndex = 0, onRequestClose, }) {
|
|
42
38
|
const [currentImageIndex, setCurrentImageIndex] = useState(imageIndex);
|
|
43
|
-
const
|
|
39
|
+
const directionRef = useRef(0);
|
|
44
40
|
const [mouseIsStationary, setMouseIsStationary] = useState(true);
|
|
45
41
|
const lightboxRef = useFocusTrap(open);
|
|
46
42
|
const selectedThumbnailRef = useRef(null);
|
|
@@ -92,7 +88,7 @@ function LightBox({ boxSizing = "content-box", open, images, imageIndex = 0, onR
|
|
|
92
88
|
React__default.createElement(ButtonDismiss, { ariaLabel: "Close", onClick: handleRequestClose })))),
|
|
93
89
|
React__default.createElement("div", { className: styles.imageArea },
|
|
94
90
|
React__default.createElement(AnimatePresence, { initial: false },
|
|
95
|
-
React__default.createElement(motion.img, { key: currentImageIndex, variants:
|
|
91
|
+
React__default.createElement(motion.img, { key: currentImageIndex, variants: slideVariants, src: images[currentImageIndex].url, custom: directionRef, className: styles.image, initial: "enter", alt: images[currentImageIndex].alt ||
|
|
96
92
|
images[currentImageIndex].title ||
|
|
97
93
|
"", animate: "center", exit: "exit", transition: imageTransition, drag: "x", dragConstraints: { left: 0, right: 0 }, dragElastic: 1, onDragEnd: handleOnDragEnd }))),
|
|
98
94
|
images.length > 1 && (React__default.createElement(React__default.Fragment, null,
|
|
@@ -114,11 +110,11 @@ function LightBox({ boxSizing = "content-box", open, images, imageIndex = 0, onR
|
|
|
114
110
|
? ReactDOM__default.createPortal(template, document.body)
|
|
115
111
|
: template;
|
|
116
112
|
function handleMovePrevious() {
|
|
117
|
-
|
|
113
|
+
directionRef.current = -1;
|
|
118
114
|
setCurrentImageIndex((currentImageIndex + images.length - 1) % images.length);
|
|
119
115
|
}
|
|
120
116
|
function handleMoveNext() {
|
|
121
|
-
|
|
117
|
+
directionRef.current = 1;
|
|
122
118
|
setCurrentImageIndex((currentImageIndex + 1) % images.length);
|
|
123
119
|
}
|
|
124
120
|
function handleRequestClose() {
|
|
@@ -135,10 +131,10 @@ function LightBox({ boxSizing = "content-box", open, images, imageIndex = 0, onR
|
|
|
135
131
|
}
|
|
136
132
|
function handleThumbnailClick(index) {
|
|
137
133
|
if (index < currentImageIndex) {
|
|
138
|
-
|
|
134
|
+
directionRef.current = -1;
|
|
139
135
|
}
|
|
140
136
|
else {
|
|
141
|
-
|
|
137
|
+
directionRef.current = 1;
|
|
142
138
|
}
|
|
143
139
|
setCurrentImageIndex(index);
|
|
144
140
|
}
|
package/dist/styles.css
CHANGED
|
@@ -10326,18 +10326,18 @@ input.oOrjwubmsVA- {
|
|
|
10326
10326
|
|
|
10327
10327
|
display: grid;
|
|
10328
10328
|
grid-template-columns: repeat(var(--segmentedControl--option-count), 1fr);
|
|
10329
|
-
-ms-flex-align:
|
|
10330
|
-
align-items:
|
|
10329
|
+
-ms-flex-align: stretch;
|
|
10330
|
+
align-items: stretch;
|
|
10331
10331
|
position: relative;
|
|
10332
10332
|
min-height: 40px;
|
|
10333
10333
|
min-height: var(--segmentedControl--size);
|
|
10334
10334
|
box-sizing: border-box;
|
|
10335
10335
|
border: 1px solid hsl(200, 13%, 87%);
|
|
10336
|
-
border: var(--border-base) solid var(--color-border
|
|
10336
|
+
border: var(--border-base) solid var(--color-border);
|
|
10337
10337
|
border-radius: 8px;
|
|
10338
10338
|
border-radius: var(--radius-base);
|
|
10339
|
-
background-color:
|
|
10340
|
-
background-color: var(--color-
|
|
10339
|
+
background-color: rgba(255, 255, 255, 1);
|
|
10340
|
+
background-color: var(--color-surface);
|
|
10341
10341
|
}
|
|
10342
10342
|
|
|
10343
10343
|
.V41prM1xcKI- {
|
|
@@ -10360,7 +10360,11 @@ input.oOrjwubmsVA- {
|
|
|
10360
10360
|
z-index: 1;
|
|
10361
10361
|
padding: 0 12px;
|
|
10362
10362
|
padding: 0 var(--space-slim);
|
|
10363
|
+
border-radius: 8px;
|
|
10364
|
+
border-radius: var(--radius-base);
|
|
10363
10365
|
overflow: hidden;
|
|
10366
|
+
color: hsl(197, 15%, 43%);
|
|
10367
|
+
color: var(--color-text--secondary);
|
|
10364
10368
|
font-size: 14px;
|
|
10365
10369
|
font-size: var(--typography--fontSize-base);
|
|
10366
10370
|
font-weight: 600;
|
|
@@ -10370,6 +10374,26 @@ input.oOrjwubmsVA- {
|
|
|
10370
10374
|
align-items: center;
|
|
10371
10375
|
-ms-flex-pack: center;
|
|
10372
10376
|
justify-content: center;
|
|
10377
|
+
transition:
|
|
10378
|
+
background-color 300ms ease-out,
|
|
10379
|
+
color 300ms ease-out;
|
|
10380
|
+
transition:
|
|
10381
|
+
background-color var(--timing-slow) ease-out,
|
|
10382
|
+
color var(--timing-slow) ease-out;
|
|
10383
|
+
}
|
|
10384
|
+
|
|
10385
|
+
.FDDKTZkTdfM- input[type="radio"]:checked + label {
|
|
10386
|
+
color: hsl(107, 58%, 33%);
|
|
10387
|
+
color: var(--color-interactive);
|
|
10388
|
+
}
|
|
10389
|
+
|
|
10390
|
+
/* Hover only on unselected options; selected already has a green border. */
|
|
10391
|
+
|
|
10392
|
+
.FDDKTZkTdfM- input[type="radio"]:not(:checked) + label:hover {
|
|
10393
|
+
color: hsl(107, 65%, 24%);
|
|
10394
|
+
color: var(--color-interactive--hover);
|
|
10395
|
+
background-color: hsl(109, 28%, 92%);
|
|
10396
|
+
background-color: var(--color-interactive--background--subtle--hover);
|
|
10373
10397
|
}
|
|
10374
10398
|
|
|
10375
10399
|
.FDDKTZkTdfM- span {
|
|
@@ -10377,17 +10401,38 @@ input.oOrjwubmsVA- {
|
|
|
10377
10401
|
left: 0;
|
|
10378
10402
|
width: calc(100% / var(--segmentedControl--option-count));
|
|
10379
10403
|
height: 100%;
|
|
10404
|
+
box-sizing: border-box;
|
|
10405
|
+
border: 1px solid hsl(107, 58%, 33%);
|
|
10406
|
+
border: var(--border-base) solid var(--color-interactive);
|
|
10380
10407
|
border-radius: 8px;
|
|
10381
10408
|
border-radius: var(--radius-base);
|
|
10382
|
-
outline: 1px solid hsl(200, 13%, 87%);
|
|
10383
|
-
outline: var(--border-base) solid var(--color-border--interactive);
|
|
10384
10409
|
background-color: rgba(255, 255, 255, 1);
|
|
10385
10410
|
background-color: var(--color-surface);
|
|
10386
|
-
transition:
|
|
10387
|
-
transition: var(--timing-
|
|
10411
|
+
transition: 300ms left ease-out;
|
|
10412
|
+
transition: var(--timing-slow) left ease-out;
|
|
10413
|
+
}
|
|
10414
|
+
|
|
10415
|
+
/* Focus ring at z-index: 2 so hover backgrounds (z-index: 1) can't cover it.
|
|
10416
|
+
Negative inset aligns with the span's outer edge so the green border stays
|
|
10417
|
+
visible inside the focus ring. */
|
|
10418
|
+
|
|
10419
|
+
.FDDKTZkTdfM- span::after {
|
|
10420
|
+
content: "";
|
|
10421
|
+
position: absolute;
|
|
10422
|
+
top: calc(-1 * 1px);
|
|
10423
|
+
right: calc(-1 * 1px);
|
|
10424
|
+
bottom: calc(-1 * 1px);
|
|
10425
|
+
left: calc(-1 * 1px);
|
|
10426
|
+
top: calc(-1 * var(--border-base));
|
|
10427
|
+
right: calc(-1 * var(--border-base));
|
|
10428
|
+
bottom: calc(-1 * var(--border-base));
|
|
10429
|
+
left: calc(-1 * var(--border-base));
|
|
10430
|
+
z-index: 2;
|
|
10431
|
+
border-radius: inherit;
|
|
10432
|
+
pointer-events: none;
|
|
10388
10433
|
}
|
|
10389
10434
|
|
|
10390
|
-
.FDDKTZkTdfM- input[type="radio"]:focus-visible ~ span {
|
|
10435
|
+
.FDDKTZkTdfM- input[type="radio"]:focus-visible ~ span::after {
|
|
10391
10436
|
box-shadow: 0px 0px 0px 2px rgba(255, 255, 255, 1), 0px 0px 0px 4px hsl(198, 12%, 57%);
|
|
10392
10437
|
box-shadow: var(--shadow-focus);
|
|
10393
10438
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jobber/components",
|
|
3
|
-
"version": "6.111.
|
|
3
|
+
"version": "6.111.6",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.cjs",
|
|
@@ -538,5 +538,5 @@
|
|
|
538
538
|
"> 1%",
|
|
539
539
|
"IE 10"
|
|
540
540
|
],
|
|
541
|
-
"gitHead": "
|
|
541
|
+
"gitHead": "5e13c04744e67afffde1230699b158b1d3c44fbe"
|
|
542
542
|
}
|