@scrippsproduct/networks-ui-library 1.1.0-alpha.0 → 1.1.0-alpha.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/assets/ActionButton.css +1 -1
- package/dist/assets/CarouselSlide.css +1 -1
- package/dist/assets/Figure.css +1 -1
- package/dist/components/ActionButton/ActionButton.d.ts +20 -1
- package/dist/components/ActionButton/ActionButton.js +36 -36
- package/dist/components/ActionButton/index.d.ts +2 -1
- package/dist/components/Carousel/Carousel.d.ts +7 -24
- package/dist/components/Carousel/Carousel.js +112 -112
- package/dist/components/Carousel/CarouselUtils.class.d.ts +16 -28
- package/dist/components/Carousel/CarouselUtils.class.js +85 -55
- package/dist/components/CarouselSlide/CarouselSlide.d.ts +8 -6
- package/dist/components/CarouselSlide/CarouselSlide.js +90 -26
- package/dist/components/CarouselSlide/index.d.ts +2 -1
- package/dist/components/CarouselSlide/slide-layouts/Empty/Empty.d.ts +1 -1
- package/dist/components/CarouselSlide/slide-layouts/Empty/Empty.js +3 -4
- package/dist/components/CarouselSlide/slide-layouts/Empty/index.d.ts +2 -1
- package/dist/components/CarouselSlide/slide-layouts/Figure/Figure.d.ts +2 -2
- package/dist/components/CarouselSlide/slide-layouts/Figure/Figure.js +10 -11
- package/dist/components/CarouselSlide/slide-layouts/Figure/index.d.ts +2 -1
- package/dist/components/CarouselSlide/slide-layouts/Text/TextSlide.d.ts +2 -2
- package/dist/components/CarouselSlide/slide-layouts/Text/TextSlide.js +9 -10
- package/dist/components/CarouselSlide/slide-layouts/Text/index.d.ts +2 -1
- package/dist/components/ScheduleList/ScheduleList.js +9 -9
- package/dist/settings.d.ts +4 -3
- package/dist/types.d.js +27 -0
- package/package.json +7 -2
- package/dist/components/CarouselSlide/slide-layouts/Figure/Figure.stories.d.ts +0 -34
- package/dist/components/CarouselSlide/slide-layouts/Figure/Figure.stories.js +0 -105
- package/dist/components/CarouselSlide/slide-layouts/Text/TextSlide.stories.d.ts +0 -19
- package/dist/components/CarouselSlide/slide-layouts/Text/TextSlide.stories.js +0 -35
|
@@ -1 +1 @@
|
|
|
1
|
-
._action-
|
|
1
|
+
._action-btn_zgv2f_1{--button-bg-color: #1e5799;--button-hover-bg-color: #444;--button-color: #fff;--button-hover-color: #fff;--button-border-color: #1e5799;--button-hover-border-color: #1e5799;cursor:pointer;transform:scale(1);display:inline-block;box-sizing:border-box;padding:.75em 1.5em;border:1px solid var(--button-border-color);font-weight:600;color:var(--button-color);text-transform:uppercase;background-color:var(--button-bg-color);box-shadow:none;transition:scale .325s ease-out,border-radius .225s ease-in-out,box-shadow .225s ease-out,background-color .225s ease-in-out,border-color .225s ease-in-out,color .225s ease-in-out}._action-btn_zgv2f_1:hover,._action-btn_zgv2f_1:focus{scale:1.02;border-color:var(--button-hover-border-color);border-radius:4px;color:var(--button-hover-color);background-color:var(--button-hover-bg-color);box-shadow:1px 1px 4px #0003;transition:all .25s ease-in-out}._action-btn--small_zgv2f_31{font-size:.8rem}._action-btn--small_zgv2f_31>i{margin-right:.25rem}._action-btn--large_zgv2f_38{font-size:1.25rem}._action-btn--large_zgv2f_38>i{margin-right:.75rem}._action-btn--primary_zgv2f_45{--button-bg-color: #1e5799;--button-hover-bg-color: #444;--button-color: #fff;--button-hover-color: #fff;--button-border-color: #1e5799;--button-hover-border-color: #1e5799}._action-btn--action_zgv2f_54{--button-bg-color: hsl(150deg 55% 38%);--button-hover-bg-color: #444;--button-color: #fff;--button-hover-color: #fff;--button-border-color: hsl(150deg 55% 38%);--button-hover-border-color: hsl(150deg 55% 38%)}._action-btn--info_zgv2f_63{--button-bg-color: hsl(30deg 80% 51%);--button-hover-bg-color: #444;--button-color: #fff;--button-hover-color: #fff;--button-border-color: hsl(30deg 80% 51%);--button-hover-border-color: hsl(30deg 80% 51%)}._action-btn--danger_zgv2f_72{--button-bg-color: hsl(0deg 51% 50%);--button-hover-bg-color: #444;--button-color: #fff;--button-hover-color: #fff;--button-border-color: hsl(0deg 51% 50%);--button-hover-border-color: hsl(0deg 51% 50%)}._action-btn_zgv2f_1[disabled]{--button-bg-color: #c5c5c5;--button-hover-bg-color: #c5c5c5;--button-color: #fff;--button-hover-color: #fff;--button-border-color: #c5c5c5;--button-hover-border-color: #c5c5c5;cursor:default}._action-btn_zgv2f_1[disabled]:hover,._action-btn_zgv2f_1[disabled]:focus{scale:1;border-radius:0;background-position:bottom left;box-shadow:none}._dots-pulse_zgv2f_97{display:flex;padding:.3em .35em}._dots-pulse_zgv2f_97>span{display:inline-block;width:8px;height:8px;margin:2px;border-radius:100%;background-color:var(--button-color);animation-fill-mode:both}._dots-pulse_zgv2f_97>span:nth-child(1){animation:_scale_zgv2f_1 1.5s -.12s infinite cubic-bezier(.2,.68,.18,1.08)}._dots-pulse_zgv2f_97>span:nth-child(2){animation:_scale_zgv2f_1 1.5s -.06s infinite cubic-bezier(.2,.68,.18,1.08)}._dots-pulse_zgv2f_97>span:nth-child(3){animation:_scale_zgv2f_1 1.5s 0s infinite cubic-bezier(.2,.68,.18,1.08)}@keyframes _scale_zgv2f_1{0%{transform:scale(.1);opacity:.7}25%{transform:scale(1);opacity:1}50%{transform:scale(.1);opacity:.7}75%{transform:scale(1);opacity:1}to{transform:scale(.1);opacity:.7}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
.
|
|
1
|
+
._slide_1echy_2{scroll-snap-align:center;overflow:hidden;display:flex;flex:0 0 100%;column-gap:var(--_slide-gap);align-items:center;justify-content:var(--_cells-position);box-sizing:border-box;aspect-ratio:var(--_slide-aspect-ratio);padding-inline-end:0}._slide_1echy_2[inert]{opacity:.5}._slide--variable-height_1echy_18{aspect-ratio:unset}._slide_1echy_2>*{display:grid;flex:0 1 calc(var(--_slide-cell-size) - var(--_slide-gap));gap:var(--_slide-gap);place-items:center;aspect-ratio:var(--_cell-aspect-ratio)}._slide_1echy_2>image-card{display:flex;gap:0;place-items:flex-start}
|
package/dist/assets/Figure.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
._figure-
|
|
1
|
+
._figure-slide__figure_1140y_2{overflow:hidden;display:grid;grid:[stack] 100%/[stack] 100%;align-items:end;aspect-ratio:var(--_cell-aspect-ratio);width:100%;-webkit-max-inline-size:max-content;max-inline-size:max-content;height:100%;margin-block:0;margin-inline:auto;border-radius:0;background-repeat:no-repeat;background-position:center;background-size:cover}._figure-slide_1140y_2{overflow-y:hidden;display:flex;gap:var(--_slide-gap);justify-content:flex-start;aspect-ratio:var(--_cell-aspect-ratio);width:100%}._figure-slide_1140y_2 ._figure-slide__figure_1140y_2{flex-basis:100%}._figure-slide__figure_1140y_2>img{object-fit:cover}._figure-slide--captioned-image_1140y_36>*{grid-area:stack}._figure-slide--captioned-image_1140y_36>figcaption{justify-self:stretch;-webkit-max-inline-size:100%;max-inline-size:100%;padding-block:4rem 1rem;padding-inline:1rem;color:#fff;text-align:center;background:linear-gradient(to top,#000e,75%,#0000)}._figure-slide--captioned-image_1140y_36>figcaption>a{color:#fff}
|
|
@@ -1,3 +1,22 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
type ActionButtonProps = {
|
|
3
|
+
label: string;
|
|
4
|
+
type?: 'button' | 'submit' | 'reset';
|
|
5
|
+
onClick?: (e: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void;
|
|
6
|
+
varient?: string;
|
|
7
|
+
size?: string;
|
|
8
|
+
customColors?: {
|
|
9
|
+
bgColor: string;
|
|
10
|
+
bgHoverColor: string;
|
|
11
|
+
color: string;
|
|
12
|
+
hoverColor: string;
|
|
13
|
+
borderColor: string;
|
|
14
|
+
borderHoverColor: string;
|
|
15
|
+
};
|
|
16
|
+
disabled?: boolean;
|
|
17
|
+
classname?: string;
|
|
18
|
+
[key: string]: unknown;
|
|
19
|
+
};
|
|
1
20
|
/**
|
|
2
21
|
* ActionButton component for rendering a button that will display a loading state.
|
|
3
22
|
* @param {*} param0 - Component props.
|
|
@@ -18,5 +37,5 @@
|
|
|
18
37
|
* @param {object} param0.attributes - Additional attributes to be applied to the button.
|
|
19
38
|
* @returns {JSX.Element} The rendered action button.
|
|
20
39
|
*/
|
|
21
|
-
export function ActionButton({ label, type, onClick, varient, size, customColors, disabled, classname, ...attributes }:
|
|
40
|
+
export declare function ActionButton({ label, type, onClick, varient, size, customColors, disabled, classname, ...attributes }: ActionButtonProps): JSX.Element;
|
|
22
41
|
export default ActionButton;
|
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { useState as
|
|
3
|
-
import { subscribe as w, unsubscribe as y, publish as
|
|
4
|
-
import { classes as
|
|
5
|
-
import '../../assets/ActionButton.css';const
|
|
6
|
-
"action-btn": "_action-
|
|
7
|
-
"action-btn--small": "_action-btn--
|
|
8
|
-
"action-btn--large": "_action-btn--
|
|
9
|
-
"action-btn--primary": "_action-btn--
|
|
10
|
-
"action-btn--action": "_action-btn--
|
|
11
|
-
"action-btn--info": "_action-btn--
|
|
12
|
-
"action-btn--danger": "_action-btn--
|
|
13
|
-
"dots-pulse": "_dots-
|
|
14
|
-
scale:
|
|
1
|
+
import { jsxs as b, jsx as t } from "react/jsx-runtime";
|
|
2
|
+
import { useState as z, useEffect as H } from "react";
|
|
3
|
+
import { subscribe as w, unsubscribe as y, publish as k } from "../../utils/events.js";
|
|
4
|
+
import { classes as x } from "../../utils/helpers.js";
|
|
5
|
+
import '../../assets/ActionButton.css';const N = "_scale_zgv2f_1", n = {
|
|
6
|
+
"action-btn": "_action-btn_zgv2f_1",
|
|
7
|
+
"action-btn--small": "_action-btn--small_zgv2f_31",
|
|
8
|
+
"action-btn--large": "_action-btn--large_zgv2f_38",
|
|
9
|
+
"action-btn--primary": "_action-btn--primary_zgv2f_45",
|
|
10
|
+
"action-btn--action": "_action-btn--action_zgv2f_54",
|
|
11
|
+
"action-btn--info": "_action-btn--info_zgv2f_63",
|
|
12
|
+
"action-btn--danger": "_action-btn--danger_zgv2f_72",
|
|
13
|
+
"dots-pulse": "_dots-pulse_zgv2f_97",
|
|
14
|
+
scale: N
|
|
15
15
|
};
|
|
16
|
-
function
|
|
16
|
+
function $({
|
|
17
17
|
label: l,
|
|
18
18
|
type: c = "button",
|
|
19
|
-
onClick:
|
|
19
|
+
onClick: d = () => {
|
|
20
20
|
},
|
|
21
21
|
varient: r = "",
|
|
22
22
|
size: e = "",
|
|
@@ -28,42 +28,42 @@ function A({
|
|
|
28
28
|
borderColor: "",
|
|
29
29
|
borderHoverColor: ""
|
|
30
30
|
},
|
|
31
|
-
disabled:
|
|
31
|
+
disabled: s,
|
|
32
32
|
classname: _ = "",
|
|
33
|
-
...
|
|
33
|
+
...g
|
|
34
34
|
}) {
|
|
35
|
-
const [a,
|
|
35
|
+
const [a, i] = z("idle"), p = r === "" ? "" : `action-btn--${r}`, v = e === "" ? "" : `action-btn--${e}`, f = o.bgColor !== "" ? {
|
|
36
36
|
"--button-bg-color": o.bgColor,
|
|
37
37
|
"--button-hover-bg-color": o.bgHoverColor === "" ? o.bgColor : o.bgHoverColor,
|
|
38
38
|
"--button-color": o.color,
|
|
39
39
|
"--button-hover-color": o.hoverColor === "" ? o.color : o.hoverColor,
|
|
40
40
|
"--button-border-color": o.borderColor === "" ? o.bgColor : o.borderColor,
|
|
41
41
|
"--button-hover-border-color": o.borderHoverColor === "" && o.borderColor === "" ? o.bgColor : o.borderHoverColor
|
|
42
|
-
} : null,
|
|
43
|
-
|
|
44
|
-
},
|
|
45
|
-
|
|
42
|
+
} : null, h = () => {
|
|
43
|
+
i("idle");
|
|
44
|
+
}, u = (C) => {
|
|
45
|
+
d(C), i("waiting"), k("scripps:actionbtn:clicked");
|
|
46
46
|
};
|
|
47
|
-
return H(() => (w("scripps:action:completed",
|
|
47
|
+
return H(() => (w("scripps:action:completed", h), () => {
|
|
48
48
|
y("scripps:action:completed");
|
|
49
|
-
}), []), /* @__PURE__ */
|
|
49
|
+
}), []), /* @__PURE__ */ b(
|
|
50
50
|
"button",
|
|
51
51
|
{
|
|
52
|
-
|
|
53
|
-
className: N([
|
|
52
|
+
className: x([
|
|
54
53
|
n["action-btn"],
|
|
55
54
|
"action-btn",
|
|
56
55
|
_,
|
|
57
|
-
r === "" ? "" : n[
|
|
58
|
-
e === "" ? "" : n[
|
|
56
|
+
r === "" ? "" : n[p],
|
|
57
|
+
e === "" ? "" : n[v]
|
|
59
58
|
]),
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
59
|
+
disabled: a === "waiting" || s,
|
|
60
|
+
style: f || void 0,
|
|
61
|
+
type: c,
|
|
62
|
+
onClick: u,
|
|
63
|
+
...g,
|
|
64
64
|
children: [
|
|
65
65
|
a !== "waiting" && /* @__PURE__ */ t("span", { className: n["action-btn__label"], children: l }),
|
|
66
|
-
a === "waiting" && /* @__PURE__ */
|
|
66
|
+
a === "waiting" && /* @__PURE__ */ b("div", { className: n["dots-pulse"], children: [
|
|
67
67
|
/* @__PURE__ */ t("span", {}),
|
|
68
68
|
/* @__PURE__ */ t("span", {}),
|
|
69
69
|
/* @__PURE__ */ t("span", {})
|
|
@@ -73,6 +73,6 @@ function A({
|
|
|
73
73
|
);
|
|
74
74
|
}
|
|
75
75
|
export {
|
|
76
|
-
|
|
77
|
-
|
|
76
|
+
$ as ActionButton,
|
|
77
|
+
$ as default
|
|
78
78
|
};
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
export { ActionButton
|
|
1
|
+
export { ActionButton } from './ActionButton';
|
|
2
|
+
export { ActionButton as default } from './ActionButton';
|
|
@@ -1,25 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
controlButtonsOffset: number;
|
|
9
|
-
showScrollbar: boolean;
|
|
10
|
-
startIndex: number;
|
|
11
|
-
variableHeight: boolean;
|
|
12
|
-
title: string;
|
|
13
|
-
autoplay: boolean;
|
|
14
|
-
autoplayDelay: number;
|
|
15
|
-
showPagination: boolean;
|
|
16
|
-
gutterSize: number;
|
|
17
|
-
slideAspectRatio: string;
|
|
18
|
-
slideGap: number;
|
|
19
|
-
cellsPerSlide: number;
|
|
20
|
-
cellAspectRatio: string;
|
|
21
|
-
cellsPosition: string;
|
|
22
|
-
wrapAround: boolean;
|
|
23
|
-
} | undefined;
|
|
24
|
-
}): import("react/jsx-runtime").JSX.Element;
|
|
1
|
+
import { CarouselCell, CarouselOptions } from '../../types';
|
|
2
|
+
type CarouselProps = {
|
|
3
|
+
id: string | number;
|
|
4
|
+
cells: CarouselCell[];
|
|
5
|
+
options?: CarouselOptions;
|
|
6
|
+
};
|
|
7
|
+
export declare function Carousel({ id, cells, options, }: CarouselProps): JSX.Element;
|
|
25
8
|
export default Carousel;
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { jsx as o, Fragment as
|
|
2
|
-
import { useRef as s, useState as
|
|
3
|
-
import { chunkArray as
|
|
4
|
-
import
|
|
5
|
-
import { CarouselSlide as
|
|
1
|
+
import { jsx as o, Fragment as Q, jsxs as K } from "react/jsx-runtime";
|
|
2
|
+
import { useRef as s, useState as C, useEffect as j, useCallback as i } from "react";
|
|
3
|
+
import { chunkArray as X, classes as A } from "../../utils/helpers.js";
|
|
4
|
+
import Y from "./CarouselUtils.class.js";
|
|
5
|
+
import { CarouselSlide as Z } from "../CarouselSlide/CarouselSlide.js";
|
|
6
6
|
import { c as a } from "../../Carousel.module-DOrBKQEQ.mjs";
|
|
7
|
-
import { C as
|
|
8
|
-
import { C as
|
|
9
|
-
const
|
|
10
|
-
function
|
|
11
|
-
id:
|
|
12
|
-
|
|
13
|
-
options:
|
|
7
|
+
import { C as ee } from "../../chevron-left-DRvpaLmK.mjs";
|
|
8
|
+
import { C as re } from "../../chevron-right-C8yCnmfx.mjs";
|
|
9
|
+
const _ = window.matchMedia("(width <= 600px)"), P = window.matchMedia("(width <= 800px"), b = window.matchMedia("(width <= 1024px"), z = window.matchMedia("(width <= 1280px");
|
|
10
|
+
function ue({
|
|
11
|
+
id: E,
|
|
12
|
+
cells: L,
|
|
13
|
+
options: x = {
|
|
14
14
|
paginationType: "dots",
|
|
15
15
|
showControls: !0,
|
|
16
16
|
controlArrowSize: 48,
|
|
@@ -31,18 +31,17 @@ function de({
|
|
|
31
31
|
wrapAround: !0
|
|
32
32
|
}
|
|
33
33
|
}) {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
B(() => {
|
|
34
|
+
const h = s(`carousel-${E}`), I = s(null), c = s(null), R = s(null), p = s([...L]), T = s(null), m = s(null), r = s(null), e = s(x), l = s(x), $ = s("-50%"), [N, B] = C([]), [M, G] = C([]), [k, H] = C(0);
|
|
35
|
+
j(() => {
|
|
37
36
|
const t = () => {
|
|
38
|
-
|
|
37
|
+
_.matches ? e.current = {
|
|
39
38
|
...l.current,
|
|
40
39
|
showControls: !1,
|
|
41
40
|
showPagination: !1,
|
|
42
41
|
cellsPerSlide: 1,
|
|
43
42
|
cellsPosition: l.current.wrapAround ? "center" : "flex-start",
|
|
44
43
|
gutterSize: 10
|
|
45
|
-
} :
|
|
44
|
+
} : P.matches ? l.current.cellsPerSlide !== 1 ? e.current = {
|
|
46
45
|
...l.current,
|
|
47
46
|
cellsPerSlide: 2,
|
|
48
47
|
showControls: !1,
|
|
@@ -51,7 +50,7 @@ function de({
|
|
|
51
50
|
...l.current,
|
|
52
51
|
showControls: !1,
|
|
53
52
|
gutterSize: 10
|
|
54
|
-
} :
|
|
53
|
+
} : b.matches ? l.current.cellsPerSlide !== 1 && l.current.cellsPerSlide !== 2 ? e.current = {
|
|
55
54
|
...l.current,
|
|
56
55
|
cellsPerSlide: 3,
|
|
57
56
|
showControls: !1,
|
|
@@ -60,7 +59,7 @@ function de({
|
|
|
60
59
|
...l.current,
|
|
61
60
|
showControls: !1,
|
|
62
61
|
gutterSize: 10
|
|
63
|
-
} :
|
|
62
|
+
} : z.matches ? l.current.showPagination ? e.current = {
|
|
64
63
|
...l.current,
|
|
65
64
|
showControls: !1
|
|
66
65
|
} : e.current = {
|
|
@@ -71,120 +70,122 @@ function de({
|
|
|
71
70
|
};
|
|
72
71
|
t();
|
|
73
72
|
const n = () => {
|
|
74
|
-
|
|
73
|
+
H((u) => u + 1), t();
|
|
75
74
|
};
|
|
76
|
-
return
|
|
77
|
-
|
|
75
|
+
return _.addEventListener("change", n), P.addEventListener("change", n), b.addEventListener("change", n), z.addEventListener("change", n), () => {
|
|
76
|
+
_.removeEventListener("change", n), P.removeEventListener("change", n), b.removeEventListener("change", n), z.removeEventListener("change", n);
|
|
78
77
|
};
|
|
79
78
|
}, []);
|
|
80
|
-
const
|
|
81
|
-
const u =
|
|
82
|
-
|
|
83
|
-
let
|
|
84
|
-
for (let
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
79
|
+
const D = i((t, n) => {
|
|
80
|
+
const u = X(n, t);
|
|
81
|
+
G([...u]);
|
|
82
|
+
let S = [];
|
|
83
|
+
for (let f = 0; f <= u.length - 1; f++)
|
|
84
|
+
S[f] = {
|
|
85
|
+
ariaLabel: `${f + 1} of ${u.length}`,
|
|
86
|
+
layout: u[f][0].layout || "",
|
|
87
|
+
cells: [
|
|
88
|
+
...u[f]
|
|
89
|
+
]
|
|
90
|
+
};
|
|
91
|
+
const v = [...S], y = [...S], q = v.slice(-1), J = v.slice(0);
|
|
92
|
+
return y.push(J[0]), y.unshift(q[0]), e.current.wrapAround && t.length > n ? y : v;
|
|
93
|
+
}, []), d = i(() => {
|
|
94
|
+
e.current.autoplay && r.current && r.current.clearTimer();
|
|
95
|
+
}, []), U = i((t) => {
|
|
96
|
+
d();
|
|
97
97
|
const n = t.key;
|
|
98
|
-
n === "ArrowLeft" ? (t.preventDefault(), r.current.determineScrollAction(-1)) : n === "ArrowRight" && (t.preventDefault(), r.current.determineScrollAction(1));
|
|
99
|
-
}, [
|
|
100
|
-
|
|
101
|
-
r.current.handleScrollEnd();
|
|
98
|
+
n === "ArrowLeft" ? (t.preventDefault(), r.current && r.current.determineScrollAction(-1)) : n === "ArrowRight" && (t.preventDefault(), r.current && r.current.determineScrollAction(1));
|
|
99
|
+
}, [d]), F = i(() => {
|
|
100
|
+
d(), c.current !== null && c.current.addEventListener("scrollend", () => {
|
|
101
|
+
r.current && r.current.handleScrollEnd();
|
|
102
102
|
}, { once: !0 });
|
|
103
|
-
}, [
|
|
104
|
-
|
|
105
|
-
r.current.handleScrollEnd(),
|
|
103
|
+
}, [d]), w = i(() => {
|
|
104
|
+
d(), c.current !== null && c.current.addEventListener("scrollend", () => {
|
|
105
|
+
r.current && r.current.handleScrollEnd(), c.current && c.current.addEventListener("scroll", w, { once: !0 });
|
|
106
106
|
}, { once: !0 });
|
|
107
|
-
}, [
|
|
107
|
+
}, [d]), W = () => {
|
|
108
108
|
r.current && e.current.autoplay && r.current.clearTimer();
|
|
109
|
-
},
|
|
109
|
+
}, g = i(() => {
|
|
110
110
|
//! make sure class is only instantiated once because of reacts
|
|
111
111
|
//! "strict" mode double do hocus pocus
|
|
112
112
|
var t, n;
|
|
113
|
-
r.current !== null &&
|
|
114
|
-
carouselEl:
|
|
115
|
-
scrollerEl:
|
|
116
|
-
paginationEl:
|
|
117
|
-
|
|
113
|
+
r.current !== null && k > 0 && ((n = (t = r.current).clearTimer) == null || n.call(t), r.current = null), r.current = new Y({
|
|
114
|
+
carouselEl: I.current,
|
|
115
|
+
scrollerEl: c.current,
|
|
116
|
+
paginationEl: R.current,
|
|
117
|
+
cells: p.current,
|
|
118
118
|
navBtnEls: {
|
|
119
119
|
next: T.current,
|
|
120
|
-
previous:
|
|
120
|
+
previous: m.current
|
|
121
121
|
},
|
|
122
|
-
id:
|
|
122
|
+
id: h.current,
|
|
123
123
|
options: {
|
|
124
124
|
autoplay: e.current.autoplay,
|
|
125
|
-
wrapAround: e.current.wrapAround &&
|
|
125
|
+
wrapAround: e.current.wrapAround && p.current.length > (e.current.cellsPerSlide || 1),
|
|
126
126
|
showPagination: e.current.showPagination,
|
|
127
127
|
delay: e.current.autoplayDelay,
|
|
128
128
|
slideGutterSize: e.current.gutterSize,
|
|
129
129
|
slideAspectRatio: e.current.slideAspectRatio,
|
|
130
|
-
showControls: e.current.showControls &&
|
|
130
|
+
showControls: e.current.showControls && p.current.length > (e.current.cellsPerSlide || 1),
|
|
131
131
|
cellsPerSlide: e.current.cellsPerSlide
|
|
132
132
|
}
|
|
133
133
|
});
|
|
134
|
-
}, [
|
|
135
|
-
|
|
136
|
-
}, [
|
|
137
|
-
if (
|
|
134
|
+
}, [k]), O = i(() => {
|
|
135
|
+
c.current && c.current.addEventListener("scroll", w, { once: !0 });
|
|
136
|
+
}, [w]), V = i(() => {
|
|
137
|
+
if (B(D(p.current, e.current.cellsPerSlide ?? 1)), p.current.length > (e.current.cellsPerSlide ?? 1)) {
|
|
138
138
|
let t = setInterval(() => {
|
|
139
|
-
|
|
139
|
+
c.current !== null && (m.current !== null && e.current.showControls || !e.current.showControls) && (clearInterval(t), O(), g());
|
|
140
140
|
}, 100);
|
|
141
141
|
} else {
|
|
142
142
|
let t = setInterval(() => {
|
|
143
|
-
|
|
143
|
+
c.current !== null && (clearInterval(t), g());
|
|
144
144
|
}, 100);
|
|
145
145
|
}
|
|
146
|
-
}, [
|
|
147
|
-
return
|
|
146
|
+
}, [D, O, g]);
|
|
147
|
+
return j(() => {
|
|
148
148
|
if (e.current !== null) {
|
|
149
149
|
if (e.current.showControls) {
|
|
150
150
|
let t = 0;
|
|
151
|
-
e.current.showPagination && (t = t + 25), e.current.showScrollbar && (t = t + 6),
|
|
151
|
+
e.current.showPagination && (t = t + 25), e.current.showScrollbar && (t = t + 6), $.current = `calc(-50% - ${t}px)`;
|
|
152
152
|
}
|
|
153
|
-
|
|
153
|
+
V();
|
|
154
154
|
}
|
|
155
155
|
return () => {
|
|
156
|
-
|
|
156
|
+
W();
|
|
157
157
|
};
|
|
158
|
-
}, [
|
|
158
|
+
}, [V, e]), /* @__PURE__ */ o(Q, { children: e.current !== null && /* @__PURE__ */ K(
|
|
159
159
|
"div",
|
|
160
160
|
{
|
|
161
|
+
"aria-label": e.current.title,
|
|
162
|
+
"aria-roledescription": "carousel",
|
|
161
163
|
className: a.carousel,
|
|
162
|
-
id:
|
|
163
|
-
ref:
|
|
164
|
-
tabIndex: -1,
|
|
164
|
+
id: h.current,
|
|
165
|
+
ref: I,
|
|
165
166
|
role: "region",
|
|
166
|
-
"aria-roledescription": "carousel",
|
|
167
|
-
"aria-label": e.current.title,
|
|
168
|
-
onKeyDown: F,
|
|
169
167
|
style: {
|
|
170
|
-
"--_carousel-gutters": e.current.wrapAround ? `${e.current.gutterSize <= 25 ? e.current.gutterSize : 25}%` : `0 ${e.current.gutterSize <= 25 ? e.current.gutterSize : 25}%`,
|
|
168
|
+
"--_carousel-gutters": e.current.wrapAround ? `${(e.current.gutterSize ?? 25) <= 25 ? e.current.gutterSize ?? 25 : 25}%` : `0 ${(e.current.gutterSize ?? 25) <= 25 ? e.current.gutterSize ?? 25 : 25}%`,
|
|
171
169
|
"--_slide-aspect-ratio": e.current.slideAspectRatio,
|
|
172
170
|
"--_cell-aspect-ratio": e.current.cellAspectRatio,
|
|
173
|
-
"--_slide-cell-size": `${100 / e.current.cellsPerSlide}%`,
|
|
171
|
+
"--_slide-cell-size": `${100 / (e.current.cellsPerSlide ?? 1)}%`,
|
|
174
172
|
"--_cells-position": e.current.cellsPosition,
|
|
175
|
-
"--_control-btns-offset-x": `${e.current.controlButtonsOffset}rem`,
|
|
176
|
-
"--_slide-gap": `${e.current.slideGap}rem`,
|
|
177
|
-
"--_controls-transform":
|
|
173
|
+
"--_control-btns-offset-x": `${e.current.controlButtonsOffset ?? 0}rem`,
|
|
174
|
+
"--_slide-gap": `${e.current.slideGap ?? 0}rem`,
|
|
175
|
+
"--_controls-transform": $.current
|
|
178
176
|
},
|
|
177
|
+
tabIndex: -1,
|
|
178
|
+
onKeyDown: U,
|
|
179
179
|
children: [
|
|
180
180
|
/* @__PURE__ */ o(
|
|
181
181
|
"ol",
|
|
182
182
|
{
|
|
183
|
+
"aria-label": "Items Scroller",
|
|
184
|
+
"aria-live": "polite",
|
|
183
185
|
className: a.carousel__scroller,
|
|
184
|
-
|
|
186
|
+
"data-scrollbar": e.current.showScrollbar,
|
|
187
|
+
ref: c,
|
|
185
188
|
role: "group",
|
|
186
|
-
"aria-label": "Items Scroller",
|
|
187
|
-
"aria-live": "Polite",
|
|
188
189
|
tabIndex: 0,
|
|
189
190
|
onMouseEnter: () => {
|
|
190
191
|
e.current.autoplay && r.current !== null && r.current.clearTimer();
|
|
@@ -192,32 +193,31 @@ function de({
|
|
|
192
193
|
onMouseLeave: () => {
|
|
193
194
|
e.current.autoplay && r.current !== null && r.current.startTimer();
|
|
194
195
|
},
|
|
195
|
-
onTouchStart:
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
ee,
|
|
196
|
+
onTouchStart: F,
|
|
197
|
+
children: N.length > 0 && N.map((t, n) => /* @__PURE__ */ o(
|
|
198
|
+
Z,
|
|
199
199
|
{
|
|
200
|
-
slide: t,
|
|
201
|
-
index: n,
|
|
202
200
|
currentIndex: e.current.wrapAround ? 1 : 0,
|
|
201
|
+
index: n,
|
|
202
|
+
slide: { ...t, ariaLabel: t.ariaLabel || "" },
|
|
203
203
|
variableHeight: e.current.variableHeight
|
|
204
204
|
},
|
|
205
|
-
`carousel${
|
|
205
|
+
`carousel${E}-slide${n}`
|
|
206
206
|
))
|
|
207
207
|
}
|
|
208
208
|
),
|
|
209
|
-
e.current.showControls &&
|
|
209
|
+
e.current.showControls && L.length > (e.current.cellsPerSlide ?? 1) && /* @__PURE__ */ K("div", { className: a["carousel-controls"], children: [
|
|
210
210
|
/* @__PURE__ */ o(
|
|
211
211
|
"button",
|
|
212
212
|
{
|
|
213
|
-
|
|
214
|
-
ref: S,
|
|
215
|
-
title: "Previous Item",
|
|
216
|
-
className: _([a["carousel-controls__btn"], a["carousel-controls__previous"], "carousel-controls__previous"]),
|
|
217
|
-
"aria-controls": p.current,
|
|
213
|
+
"aria-controls": h.current,
|
|
218
214
|
"aria-label": "Previous Item",
|
|
215
|
+
className: A([a["carousel-controls__btn"], a["carousel-controls__previous"], "carousel-controls__previous"]),
|
|
216
|
+
ref: m,
|
|
217
|
+
title: "Previous Item",
|
|
218
|
+
type: "button",
|
|
219
219
|
onClick: () => {
|
|
220
|
-
r.current.determineScrollAction(-1);
|
|
220
|
+
r.current && r.current.determineScrollAction(-1);
|
|
221
221
|
},
|
|
222
222
|
onMouseEnter: () => {
|
|
223
223
|
e.current.autoplay && r.current !== null && r.current.clearTimer();
|
|
@@ -225,20 +225,20 @@ function de({
|
|
|
225
225
|
onMouseLeave: () => {
|
|
226
226
|
e.current.autoplay && r.current !== null && r.current.startTimer();
|
|
227
227
|
},
|
|
228
|
-
children: /* @__PURE__ */ o("i", { "aria-hidden": "true", children: /* @__PURE__ */ o(
|
|
228
|
+
children: /* @__PURE__ */ o("i", { "aria-hidden": "true", children: /* @__PURE__ */ o(ee, { height: e.current.controlArrowSize, width: e.current.controlArrowSize }) })
|
|
229
229
|
}
|
|
230
230
|
),
|
|
231
231
|
/* @__PURE__ */ o(
|
|
232
232
|
"button",
|
|
233
233
|
{
|
|
234
|
-
|
|
234
|
+
"aria-controls": h.current,
|
|
235
|
+
"aria-label": "Next Item",
|
|
236
|
+
className: A([a["carousel-controls__btn"], a["carousel-controls__next"], "carousel-controls__next"]),
|
|
235
237
|
ref: T,
|
|
236
238
|
title: "Next Item",
|
|
237
|
-
|
|
238
|
-
"aria-controls": p.current,
|
|
239
|
-
"aria-label": "Next Item",
|
|
239
|
+
type: "button",
|
|
240
240
|
onClick: () => {
|
|
241
|
-
r.current.determineScrollAction(1);
|
|
241
|
+
r.current && r.current.determineScrollAction(1);
|
|
242
242
|
},
|
|
243
243
|
onMouseEnter: () => {
|
|
244
244
|
e.current.autoplay && r.current !== null && r.current.clearTimer();
|
|
@@ -246,27 +246,27 @@ function de({
|
|
|
246
246
|
onMouseLeave: () => {
|
|
247
247
|
e.current.autoplay && r.current !== null && r.current.startTimer();
|
|
248
248
|
},
|
|
249
|
-
children: /* @__PURE__ */ o("i", { "aria-hidden": "true", children: /* @__PURE__ */ o(
|
|
249
|
+
children: /* @__PURE__ */ o("i", { "aria-hidden": "true", children: /* @__PURE__ */ o(re, { height: e.current.controlArrowSize, width: e.current.controlArrowSize }) })
|
|
250
250
|
}
|
|
251
251
|
)
|
|
252
252
|
] }),
|
|
253
|
-
e.current.showPagination &&
|
|
253
|
+
e.current.showPagination && M.length > 1 && /* @__PURE__ */ o("div", { className: [a["carousel-nav"], "carousel-nav"].join(" "), children: /* @__PURE__ */ o("ol", { className: a["carousel-nav__list"], ref: R, children: M.map((t, n) => /* @__PURE__ */ o(
|
|
254
254
|
"li",
|
|
255
255
|
{
|
|
256
|
-
className:
|
|
256
|
+
className: A([a["carousel-nav__item"], "carousel-nav__item"]),
|
|
257
257
|
"data-current": n === 0 ? "true" : "false",
|
|
258
|
+
title: `Navigate to slide ${n + 1}`,
|
|
258
259
|
onClick: () => {
|
|
259
|
-
r.current.navigateToIndex(n);
|
|
260
|
-
}
|
|
261
|
-
title: `Navigate to slide ${n + 1}`
|
|
260
|
+
r.current && r.current.navigateToIndex(n);
|
|
261
|
+
}
|
|
262
262
|
},
|
|
263
|
-
`carousel${
|
|
263
|
+
`carousel${h}-nav-${n}`
|
|
264
264
|
)) }) })
|
|
265
265
|
]
|
|
266
266
|
}
|
|
267
267
|
) });
|
|
268
268
|
}
|
|
269
269
|
export {
|
|
270
|
-
|
|
271
|
-
|
|
270
|
+
ue as Carousel,
|
|
271
|
+
ue as default
|
|
272
272
|
};
|
|
@@ -1,34 +1,24 @@
|
|
|
1
|
+
import { CarouselCell, CarouselOptions, CarouselNavBtnEls, CarouselUtilsConstructorParams } from '../../types';
|
|
1
2
|
export default class CarouselUtils {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
navBtnEls?: {
|
|
8
|
-
next: {};
|
|
9
|
-
previous: {};
|
|
10
|
-
} | undefined;
|
|
11
|
-
options: any;
|
|
12
|
-
});
|
|
13
|
-
carouselEl: any;
|
|
14
|
-
scrollerEl: any;
|
|
15
|
-
paginationEl: any;
|
|
16
|
-
slides: any;
|
|
3
|
+
#private;
|
|
4
|
+
carouselEl: HTMLElement;
|
|
5
|
+
scrollerEl: HTMLElement;
|
|
6
|
+
paginationEl: HTMLElement;
|
|
7
|
+
cells: CarouselCell[];
|
|
17
8
|
currentIndex: number;
|
|
18
|
-
slideEls:
|
|
19
|
-
navBtnEls:
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
timerInterval: any;
|
|
27
|
-
slideGutterSize: any;
|
|
28
|
-
showPagination: any;
|
|
9
|
+
slideEls: HTMLElement[];
|
|
10
|
+
navBtnEls: CarouselNavBtnEls;
|
|
11
|
+
currentIntersecting: IntersectionObserverEntry | Record<string, never>;
|
|
12
|
+
options: CarouselOptions;
|
|
13
|
+
timer: NodeJS.Timeout | null | undefined;
|
|
14
|
+
timerInterval: number | undefined;
|
|
15
|
+
slideGutterSize: number;
|
|
16
|
+
showPagination: boolean | undefined;
|
|
29
17
|
isInitialScroll: boolean;
|
|
30
18
|
totalSlideEls: number;
|
|
31
19
|
totalSlides: number;
|
|
20
|
+
carouselObserver: IntersectionObserver | undefined;
|
|
21
|
+
constructor({ carouselEl, scrollerEl, paginationEl, cells, navBtnEls, options, }: CarouselUtilsConstructorParams);
|
|
32
22
|
/**
|
|
33
23
|
* starts the autoplay timer
|
|
34
24
|
*/
|
|
@@ -63,6 +53,4 @@ export default class CarouselUtils {
|
|
|
63
53
|
* @returns void
|
|
64
54
|
*/
|
|
65
55
|
handleScrollEnd(): void;
|
|
66
|
-
carouselObserver: IntersectionObserver | undefined;
|
|
67
|
-
#private;
|
|
68
56
|
}
|