@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.
Files changed (30) hide show
  1. package/dist/assets/ActionButton.css +1 -1
  2. package/dist/assets/CarouselSlide.css +1 -1
  3. package/dist/assets/Figure.css +1 -1
  4. package/dist/components/ActionButton/ActionButton.d.ts +20 -1
  5. package/dist/components/ActionButton/ActionButton.js +36 -36
  6. package/dist/components/ActionButton/index.d.ts +2 -1
  7. package/dist/components/Carousel/Carousel.d.ts +7 -24
  8. package/dist/components/Carousel/Carousel.js +112 -112
  9. package/dist/components/Carousel/CarouselUtils.class.d.ts +16 -28
  10. package/dist/components/Carousel/CarouselUtils.class.js +85 -55
  11. package/dist/components/CarouselSlide/CarouselSlide.d.ts +8 -6
  12. package/dist/components/CarouselSlide/CarouselSlide.js +90 -26
  13. package/dist/components/CarouselSlide/index.d.ts +2 -1
  14. package/dist/components/CarouselSlide/slide-layouts/Empty/Empty.d.ts +1 -1
  15. package/dist/components/CarouselSlide/slide-layouts/Empty/Empty.js +3 -4
  16. package/dist/components/CarouselSlide/slide-layouts/Empty/index.d.ts +2 -1
  17. package/dist/components/CarouselSlide/slide-layouts/Figure/Figure.d.ts +2 -2
  18. package/dist/components/CarouselSlide/slide-layouts/Figure/Figure.js +10 -11
  19. package/dist/components/CarouselSlide/slide-layouts/Figure/index.d.ts +2 -1
  20. package/dist/components/CarouselSlide/slide-layouts/Text/TextSlide.d.ts +2 -2
  21. package/dist/components/CarouselSlide/slide-layouts/Text/TextSlide.js +9 -10
  22. package/dist/components/CarouselSlide/slide-layouts/Text/index.d.ts +2 -1
  23. package/dist/components/ScheduleList/ScheduleList.js +9 -9
  24. package/dist/settings.d.ts +4 -3
  25. package/dist/types.d.js +27 -0
  26. package/package.json +7 -2
  27. package/dist/components/CarouselSlide/slide-layouts/Figure/Figure.stories.d.ts +0 -34
  28. package/dist/components/CarouselSlide/slide-layouts/Figure/Figure.stories.js +0 -105
  29. package/dist/components/CarouselSlide/slide-layouts/Text/TextSlide.stories.d.ts +0 -19
  30. package/dist/components/CarouselSlide/slide-layouts/Text/TextSlide.stories.js +0 -35
@@ -1 +1 @@
1
- ._action-btn_9huvk_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;display:inline-block;background-color:var(--button-bg-color);color:var(--button-color);border:1px solid var(--button-border-color);text-transform:uppercase;font-weight:600;padding:.75em 1.5em;box-sizing:border-box;transform:scale(1);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;cursor:pointer}._action-btn_9huvk_1:hover,._action-btn_9huvk_1:focus{background-color:var(--button-hover-bg-color);color:var(--button-hover-color);border-color:var(--button-hover-border-color);scale:1.02;box-shadow:1px 1px 4px #0003;border-radius:4px;transition:all .25s ease-in-out}._action-btn--small_9huvk_31{font-size:.8rem}._action-btn--small_9huvk_31>i{margin-right:.25rem}._action-btn--large_9huvk_38{font-size:1.25rem}._action-btn--large_9huvk_38>i{margin-right:.75rem}._action-btn--primary_9huvk_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_9huvk_54{--button-bg-color: hsl(150, 55%, 38%);--button-hover-bg-color: #444;--button-color: #fff;--button-hover-color: #fff;--button-border-color: hsl(150, 55%, 38%);--button-hover-border-color: hsl(150, 55%, 38%)}._action-btn--info_9huvk_63{--button-bg-color: hsl(30, 80%, 51%);--button-hover-bg-color: #444;--button-color: #fff;--button-hover-color: #fff;--button-border-color: hsl(30, 80%, 51%);--button-hover-border-color: hsl(30, 80%, 51%)}._action-btn--danger_9huvk_72{--button-bg-color: hsl(0, 51%, 50%);--button-hover-bg-color: #444;--button-color: #fff;--button-hover-color: #fff;--button-border-color: hsl(0, 51%, 50%);--button-hover-border-color: hsl(0, 51%, 50%)}._action-btn_9huvk_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_9huvk_1[disabled]:hover,._action-btn_9huvk_1[disabled]:focus{background-position:bottom left;scale:1;border-radius:0;box-shadow:none}._dots-pulse_9huvk_97{display:flex;padding:.3em .35em}._dots-pulse_9huvk_97>span{background-color:var(--button-color);width:8px;height:8px;border-radius:100%;margin:2px;animation-fill-mode:both;display:inline-block}._dots-pulse_9huvk_97>span:nth-child(1){animation:_scale_9huvk_1 1.5s -.12s infinite cubic-bezier(.2,.68,.18,1.08)}._dots-pulse_9huvk_97>span:nth-child(2){animation:_scale_9huvk_1 1.5s -.06s infinite cubic-bezier(.2,.68,.18,1.08)}._dots-pulse_9huvk_97>span:nth-child(3){animation:_scale_9huvk_1 1.5s 0s infinite cubic-bezier(.2,.68,.18,1.08)}@keyframes _scale_9huvk_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
+ ._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
- ._slide_gx8qn_1{scroll-snap-align:center;box-sizing:border-box;flex:0 0 100%;display:flex;justify-content:var(--_cells-position);align-items:center;column-gap:var(--_slide-gap);padding-inline-end:0;aspect-ratio:var(--_slide-aspect-ratio);overflow:hidden}._slide_gx8qn_1[inert]{opacity:.5}._slide--variable-height_gx8qn_17{aspect-ratio:unset}._slide_gx8qn_1>*{flex:0 1 calc(var(--_slide-cell-size) - var(--_slide-gap));display:grid;gap:var(--_slide-gap);place-items:center;aspect-ratio:var(--_cell-aspect-ratio)}._slide_gx8qn_1>image-card{gap:0;place-items:flex-start;display:flex}
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}
@@ -1 +1 @@
1
- ._figure-slide_6uaj0_1{display:flex;justify-content:flex-start;gap:var(--_slide-gap);width:100%;aspect-ratio:var(--_cell-aspect-ratio);overflow-y:hidden}._figure-slide_6uaj0_1 ._figure-slide__figure_6uaj0_9{flex-basis:100%}._figure-slide__figure_6uaj0_9{display:grid;grid:[stack] 100%/[stack] 100%;align-items:end;aspect-ratio:var(--_cell-aspect-ratio);width:100%;height:100%;background-repeat:no-repeat;background-size:cover;background-position:center;border-radius:0;overflow:hidden;max-inline-size:-webkit-max-content;max-inline-size:-moz-max-content;max-inline-size:max-content;margin-inline:auto;margin-block:0}._figure-slide__figure_6uaj0_9>img{object-fit:cover}._figure-slide--captioned-image_6uaj0_36>*{grid-area:stack}._figure-slide--captioned-image_6uaj0_36>figcaption{color:#fff;max-inline-size:100%;background:linear-gradient(to top,#000e,75%,#0000);justify-self:stretch;text-align:center;padding-block:4rem 1rem;padding-inline:1rem}._figure-slide--captioned-image_6uaj0_36>figcaption>a{color:#fff}
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 }: any): JSX.Element;
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 i, jsx as t } from "react/jsx-runtime";
2
- import { useState as C, useEffect as H } from "react";
3
- import { subscribe as w, unsubscribe as y, publish as x } from "../../utils/events.js";
4
- import { classes as N } from "../../utils/helpers.js";
5
- import '../../assets/ActionButton.css';const S = "_scale_9huvk_1", n = {
6
- "action-btn": "_action-btn_9huvk_1",
7
- "action-btn--small": "_action-btn--small_9huvk_31",
8
- "action-btn--large": "_action-btn--large_9huvk_38",
9
- "action-btn--primary": "_action-btn--primary_9huvk_45",
10
- "action-btn--action": "_action-btn--action_9huvk_54",
11
- "action-btn--info": "_action-btn--info_9huvk_63",
12
- "action-btn--danger": "_action-btn--danger_9huvk_72",
13
- "dots-pulse": "_dots-pulse_9huvk_97",
14
- scale: S
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 A({
16
+ function $({
17
17
  label: l,
18
18
  type: c = "button",
19
- onClick: s = () => {
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: d,
31
+ disabled: s,
32
32
  classname: _ = "",
33
- ...p
33
+ ...g
34
34
  }) {
35
- const [a, b] = C("idle"), v = r === "" ? "" : `action-btn--${r}`, h = e === "" ? "" : `action-btn--${e}`, g = o.bgColor !== "" ? {
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, u = () => {
43
- b("idle");
44
- }, k = (f) => {
45
- s(f), b("waiting"), x("scripps:actionbtn:clicked");
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", u), () => {
47
+ return H(() => (w("scripps:action:completed", h), () => {
48
48
  y("scripps:action:completed");
49
- }), []), /* @__PURE__ */ i(
49
+ }), []), /* @__PURE__ */ b(
50
50
  "button",
51
51
  {
52
- type: c,
53
- className: N([
52
+ className: x([
54
53
  n["action-btn"],
55
54
  "action-btn",
56
55
  _,
57
- r === "" ? "" : n[v],
58
- e === "" ? "" : n[h]
56
+ r === "" ? "" : n[p],
57
+ e === "" ? "" : n[v]
59
58
  ]),
60
- onClick: k,
61
- disabled: a === "waiting" || d,
62
- style: g,
63
- ...p,
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__ */ i("div", { className: n["dots-pulse"], children: [
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
- A as ActionButton,
77
- A as default
76
+ $ as ActionButton,
77
+ $ as default
78
78
  };
@@ -1 +1,2 @@
1
- export { ActionButton, ActionButton as default } from './ActionButton';
1
+ export { ActionButton } from './ActionButton';
2
+ export { ActionButton as default } from './ActionButton';
@@ -1,25 +1,8 @@
1
- export function Carousel({ id, slides, options }: {
2
- id: any;
3
- slides: any;
4
- options?: {
5
- paginationType: string;
6
- showControls: boolean;
7
- controlArrowSize: number;
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 X, jsxs as K } from "react/jsx-runtime";
2
- import { useRef as s, useState as P, useEffect as B, useCallback as d } from "react";
3
- import { chunkArray as Y, classes as _ } from "../../utils/helpers.js";
4
- import Z from "./CarouselUtils.class.js";
5
- import { CarouselSlide as ee } from "../CarouselSlide/CarouselSlide.js";
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 re } from "../../chevron-left-DRvpaLmK.mjs";
8
- import { C as te } from "../../chevron-right-C8yCnmfx.mjs";
9
- const b = window.matchMedia("(width <= 600px)"), z = window.matchMedia("(width <= 800px"), E = window.matchMedia("(width <= 1024px"), L = window.matchMedia("(width <= 1280px");
10
- function de({
11
- id: g,
12
- slides: x,
13
- options: I = {
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
- console.log(`Carousel component with id: ${g} initialized`);
35
- const p = s(`carousel-${g}`), R = s(null), i = s(null), $ = s(null), m = s(x), T = s(null), S = s(null), r = s(null), e = s(I), l = s(I), N = s("-50%"), [M, G] = P([]), [k, H] = P([]), [D, U] = P(0);
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
- b.matches ? e.current = {
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
- } : z.matches ? l.current.cellsPerSlide !== 1 ? e.current = {
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
- } : E.matches ? l.current.cellsPerSlide !== 1 && l.current.cellsPerSlide !== 2 ? e.current = {
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
- } : L.matches ? l.current.showPagination ? e.current = {
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
- U((u) => u + 1), t();
73
+ H((u) => u + 1), t();
75
74
  };
76
- return b.addEventListener("change", n), z.addEventListener("change", n), E.addEventListener("change", n), L.addEventListener("change", n), () => {
77
- b.removeEventListener("change", n), z.removeEventListener("change", n), E.removeEventListener("change", n), L.removeEventListener("change", n);
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 O = d((t, n) => {
81
- const u = Y(n, t);
82
- H([...u]);
83
- let h = [];
84
- for (let c = 0; c <= u.length - 1; c++) {
85
- h[c] = {}, h[c].ariaLabel = `${c + 1} of ${u.length}`, h[c].layout = u[c][0].layout, h[c].cells = [];
86
- for (let w = 0; w <= u[c].length - 1; w++)
87
- h[c].cells[w] = {
88
- props: u[c][w].props
89
- };
90
- }
91
- const C = [...h], A = [...h], J = C.slice(-1), Q = C.slice(0);
92
- return A.push(Q[0]), A.unshift(J[0]), e.current.wrapAround && t.length > n ? A : C;
93
- }, []), f = d(() => {
94
- e.current.autoplay && r.current.clearTimer();
95
- }, []), F = d((t) => {
96
- f();
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
- }, [f]), W = d(() => {
100
- f(), i.current.addEventListener("scrollend", () => {
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
- }, [f]), v = d(() => {
104
- f(), i.current.addEventListener("scrollend", () => {
105
- r.current.handleScrollEnd(), i.current.addEventListener("scroll", v, { once: !0 });
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
- }, [f]), q = () => {
107
+ }, [d]), W = () => {
108
108
  r.current && e.current.autoplay && r.current.clearTimer();
109
- }, y = d(() => {
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 && D > 0 && ((n = (t = r.current).clearTimer) == null || n.call(t), r.current = null), r.current = new Z({
114
- carouselEl: R.current,
115
- scrollerEl: i.current,
116
- paginationEl: $.current,
117
- slides: m.current,
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: S.current
120
+ previous: m.current
121
121
  },
122
- id: p.current,
122
+ id: h.current,
123
123
  options: {
124
124
  autoplay: e.current.autoplay,
125
- wrapAround: e.current.wrapAround && m.current.length > e.current.cellsPerSlide,
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 && m.current.length > e.current.cellsPerSlide,
130
+ showControls: e.current.showControls && p.current.length > (e.current.cellsPerSlide || 1),
131
131
  cellsPerSlide: e.current.cellsPerSlide
132
132
  }
133
133
  });
134
- }, [D]), V = d(() => {
135
- i.current.addEventListener("scroll", v, { once: !0 });
136
- }, [v]), j = d(() => {
137
- if (G(O(m.current, e.current.cellsPerSlide)), m.current.length > e.current.cellsPerSlide) {
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
- i.current !== null && (S.current !== null && e.current.showControls || !e.current.showControls) && (clearInterval(t), V(), y());
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
- i.current !== null && (clearInterval(t), y());
143
+ c.current !== null && (clearInterval(t), g());
144
144
  }, 100);
145
145
  }
146
- }, [O, V, y]);
147
- return B(() => {
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), N.current = `calc(-50% - ${t}px)`;
151
+ e.current.showPagination && (t = t + 25), e.current.showScrollbar && (t = t + 6), $.current = `calc(-50% - ${t}px)`;
152
152
  }
153
- j();
153
+ V();
154
154
  }
155
155
  return () => {
156
- q();
156
+ W();
157
157
  };
158
- }, [j, e]), /* @__PURE__ */ o(X, { children: e.current !== null && /* @__PURE__ */ K(
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: p.current,
163
- ref: R,
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": N.current
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
- ref: i,
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: W,
196
- "data-scrollbar": e.current.showScrollbar,
197
- children: M.length > 0 && M.map((t, n) => /* @__PURE__ */ o(
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${g}-slide${n}`
205
+ `carousel${E}-slide${n}`
206
206
  ))
207
207
  }
208
208
  ),
209
- e.current.showControls && x.length > e.current.cellsPerSlide && /* @__PURE__ */ K("div", { className: a["carousel-controls"], children: [
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
- type: "button",
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(re, { width: e.current.controlArrowSize, height: e.current.controlArrowSize }) })
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
- type: "button",
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
- className: _([a["carousel-controls__btn"], a["carousel-controls__next"], "carousel-controls__next"]),
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(te, { width: e.current.controlArrowSize, height: e.current.controlArrowSize }) })
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 && k.length > 1 && /* @__PURE__ */ o("div", { className: [a["carousel-nav"], "carousel-nav"].join(" "), children: /* @__PURE__ */ o("ol", { className: a["carousel-nav__list"], ref: $, children: k.map((t, n) => /* @__PURE__ */ o(
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: _([a["carousel-nav__item"], "carousel-nav__item"]),
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${p}-nav-${n}`
263
+ `carousel${h}-nav-${n}`
264
264
  )) }) })
265
265
  ]
266
266
  }
267
267
  ) });
268
268
  }
269
269
  export {
270
- de as Carousel,
271
- de as default
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
- constructor({ carouselEl, scrollerEl, paginationEl, slides, navBtnEls, options }: {
3
- carouselEl: any;
4
- scrollerEl: any;
5
- paginationEl: any;
6
- slides: any;
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: any[];
19
- navBtnEls: {
20
- next: {};
21
- previous: {};
22
- };
23
- currentIntersecting: {};
24
- options: any;
25
- timer: NodeJS.Timeout | null;
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
  }