@alto-avios/alto-ui 3.3.0 → 3.4.0-alpha.2
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/IconButton.module-DcfPVyUX.js +48 -0
- package/dist/IconButton.module-DcfPVyUX.js.map +1 -0
- package/dist/assets/AutoplayControl.css +1 -0
- package/dist/assets/Carousel.css +1 -0
- package/dist/assets/CarouselButton.css +1 -0
- package/dist/assets/CarouselDots.css +1 -0
- package/dist/components/Accordion/Accordion.js +8 -8
- package/dist/components/AviosCurrencySymbol/AviosCurrencySymbol.js +2 -2
- package/dist/components/ButtonGroup/ButtonGroup.js +2 -2
- package/dist/components/CalloutBanner/CalloutBanner.js +2 -2
- package/dist/components/Carousel/AutoplayControl/AutoplayControl.d.ts +27 -0
- package/dist/components/Carousel/AutoplayControl/AutoplayControl.js +65 -0
- package/dist/components/Carousel/AutoplayControl/AutoplayControl.js.map +1 -0
- package/dist/components/Carousel/Carousel.d.ts +150 -0
- package/dist/components/Carousel/Carousel.js +245 -0
- package/dist/components/Carousel/Carousel.js.map +1 -0
- package/dist/components/Carousel/CarouselButton/CarouselButton.d.ts +41 -0
- package/dist/components/Carousel/CarouselButton/CarouselButton.js +116 -0
- package/dist/components/Carousel/CarouselButton/CarouselButton.js.map +1 -0
- package/dist/components/Carousel/CarouselDots/CarouselDots.d.ts +15 -0
- package/dist/components/Carousel/CarouselDots/CarouselDots.js +192 -0
- package/dist/components/Carousel/CarouselDots/CarouselDots.js.map +1 -0
- package/dist/components/Carousel/index.d.ts +1 -0
- package/dist/components/Carousel/index.js +5 -0
- package/dist/components/Carousel/index.js.map +1 -0
- package/dist/components/CreditCardNumberField/CreditCardNumberField.js +4 -4
- package/dist/components/CreditCardSecurityCodeField/CreditCardSecurityCodeField.js +3 -3
- package/dist/components/Dialog/Dialog.js +3 -3
- package/dist/components/ErrorSummary/ErrorSummary.js +4 -4
- package/dist/components/IconButton/IconButton.js +21 -64
- package/dist/components/IconButton/IconButton.js.map +1 -1
- package/dist/components/Image/Image.js +7 -7
- package/dist/components/PasswordField/PasswordField.js +2 -2
- package/dist/components/PhoneNumberField/PhoneNumberField.js +1 -1
- package/dist/components/Popover/Popover.js +2 -2
- package/dist/components/SearchField/SearchField.js +3 -3
- package/dist/components/Section/Section.js +4 -4
- package/dist/components/SelectCard/SelectCard.js +2 -2
- package/dist/components/_base/Field/Field.js +2 -2
- package/dist/index-uZFEbUWx.js +1005 -0
- package/dist/index-uZFEbUWx.js.map +1 -0
- package/dist/{react-number-format.es-DMLgWFZX.js → react-number-format.es-DXPULhrt.js} +6 -6
- package/dist/{react-number-format.es-DMLgWFZX.js.map → react-number-format.es-DXPULhrt.js.map} +1 -1
- package/package.json +2 -1
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import './assets/IconButton.css';const iconButton = "_iconButton_kb1oz_1";
|
|
2
|
+
const sm = "_sm_kb1oz_24";
|
|
3
|
+
const md = "_md_kb1oz_30";
|
|
4
|
+
const lg = "_lg_kb1oz_36";
|
|
5
|
+
const accentPrimary = "_accentPrimary_kb1oz_46";
|
|
6
|
+
const accentSecondary = "_accentSecondary_kb1oz_69";
|
|
7
|
+
const accentTertiary = "_accentTertiary_kb1oz_98";
|
|
8
|
+
const accentQuaternary = "_accentQuaternary_kb1oz_127";
|
|
9
|
+
const criticalPrimary = "_criticalPrimary_kb1oz_151";
|
|
10
|
+
const criticalSecondary = "_criticalSecondary_kb1oz_175";
|
|
11
|
+
const criticalTertiary = "_criticalTertiary_kb1oz_204";
|
|
12
|
+
const criticalQuaternary = "_criticalQuaternary_kb1oz_229";
|
|
13
|
+
const neutralPrimary = "_neutralPrimary_kb1oz_254";
|
|
14
|
+
const neutralSecondary = "_neutralSecondary_kb1oz_278";
|
|
15
|
+
const neutralTertiary = "_neutralTertiary_kb1oz_305";
|
|
16
|
+
const neutralQuaternary = "_neutralQuaternary_kb1oz_330";
|
|
17
|
+
const whitePrimary = "_whitePrimary_kb1oz_356";
|
|
18
|
+
const whiteSecondary = "_whiteSecondary_kb1oz_385";
|
|
19
|
+
const whiteTertiary = "_whiteTertiary_kb1oz_416";
|
|
20
|
+
const whiteQuaternary = "_whiteQuaternary_kb1oz_445";
|
|
21
|
+
const iconButtonStyles = {
|
|
22
|
+
iconButton,
|
|
23
|
+
sm,
|
|
24
|
+
md,
|
|
25
|
+
lg,
|
|
26
|
+
accentPrimary,
|
|
27
|
+
accentSecondary,
|
|
28
|
+
accentTertiary,
|
|
29
|
+
accentQuaternary,
|
|
30
|
+
criticalPrimary,
|
|
31
|
+
criticalSecondary,
|
|
32
|
+
criticalTertiary,
|
|
33
|
+
criticalQuaternary,
|
|
34
|
+
neutralPrimary,
|
|
35
|
+
neutralSecondary,
|
|
36
|
+
neutralTertiary,
|
|
37
|
+
neutralQuaternary,
|
|
38
|
+
whitePrimary,
|
|
39
|
+
whiteSecondary,
|
|
40
|
+
whiteTertiary,
|
|
41
|
+
whiteQuaternary,
|
|
42
|
+
"fa-spinner-third": "_fa-spinner-third_kb1oz_476",
|
|
43
|
+
"icon-wrapper": "_icon-wrapper_kb1oz_481"
|
|
44
|
+
};
|
|
45
|
+
export {
|
|
46
|
+
iconButtonStyles as i
|
|
47
|
+
};
|
|
48
|
+
//# sourceMappingURL=IconButton.module-DcfPVyUX.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IconButton.module-DcfPVyUX.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
._autoplayControl_jeo17_1{background:none;border:none;min-height:40px;min-width:40px;padding:0;pointer-events:auto;position:relative;z-index:10}._autoplayControl_jeo17_1,._iconButton_jeo17_17{align-items:center;display:flex;justify-content:center}._iconButton_jeo17_17{box-shadow:0 2px 8px #0003}._sizeMd_jeo17_25,._sizeMd_jeo17_25 ._iconButton_jeo17_17{height:48px;width:48px}._sizeSm_jeo17_31,._sizeSm_jeo17_31 ._iconButton_jeo17_17{height:36px;width:36px}._neutralVibrant_jeo17_38 ._iconButton_jeo17_17{background-color:var(--alto-sem-color-fg-inverse-on-subtle);border-radius:var(--alto-sem-radius-circle,50%);color:var(--alto-sem-color-fg-inverse-on-vibrant)}._whiteVibrant_jeo17_44 ._iconButton_jeo17_17{background-color:var(--alto-sem-color-fg-white-primary);border-radius:var(--alto-sem-radius-circle,50%);color:var(--alto-sem-color-fg-white-on-vibrant)}._whiteVibrant_jeo17_44 ._iconButton_jeo17_17[data-focused]{outline-color:var(--alto-sem-color-border-white)}._neutralSubtle_jeo17_55 ._iconButton_jeo17_17{background-color:var(--alto-sem-color-fg-inverse-primary);border-radius:var(--alto-sem-radius-circle,50%);color:var(--alto-sem-color-fg-inverse-on-subtle)}._whiteSubtle_jeo17_61 ._iconButton_jeo17_17{background-color:#00000080;border-radius:var(--alto-sem-radius-circle,50%);color:var(--alto-sem-color-fg-white-on-subtle)}._whiteSubtle_jeo17_61 ._iconButton_jeo17_17[data-focused]{outline-color:var(--alto-sem-color-border-white)}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
._carouselWrapper_mtbhv_1{max-width:100%;overflow:hidden;position:relative;width:100%}._showPartialItems_mtbhv_9,._showPartialItems_mtbhv_9 ._carousel_mtbhv_1{overflow:visible}._carousel_mtbhv_1{overflow:hidden;position:relative;width:100%}._scroller_mtbhv_23{display:flex;overflow-x:hidden;scroll-behavior:smooth;scroll-snap-type:x mandatory;-webkit-overflow-scrolling:touch;transition:all .3s ease}[data-dragging=true] ._scroller_mtbhv_23{cursor:grabbing;scroll-behavior:auto}._scroller_mtbhv_23:hover{cursor:grab}._item_mtbhv_43{box-sizing:border-box;flex:0 0 100%;scroll-snap-align:start;scroll-snap-stop:always}div[style*=--items-per-page] ._item_mtbhv_43{flex:0 0 auto;flex-basis:calc(100%/var(--items-per-page))}div[style*=--space-between-items] ._item_mtbhv_43{margin-right:var(--space-between-items)}div[style*=--space-between-items] ._item_mtbhv_43:last-child{margin-right:0}div[style*=--scroll-padding] ._scroller_mtbhv_23{padding-left:var(--scroll-padding);padding-right:var(--scroll-padding);scroll-padding-left:var(--scroll-padding);scroll-padding-right:var(--scroll-padding)}._slideLeft_mtbhv_73{animation:_slideLeftAnimation_mtbhv_1 .4s ease-out}._slideRight_mtbhv_77{animation:_slideRightAnimation_mtbhv_1 .4s ease-out}@keyframes _slideLeftAnimation_mtbhv_1{0%{transform:translate(5%)}to{transform:translate(0)}}@keyframes _slideRightAnimation_mtbhv_1{0%{transform:translate(-5%)}to{transform:translate(0)}}._controls_mtbhv_100{bottom:0;left:0;pointer-events:none;position:absolute;right:0;top:0;z-index:1}._dotsContainerWrapper_mtbhv_111{pointer-events:auto;z-index:2}._dotsContainer_mtbhv_111{position:relative}@media (max-width:768px){._dotsContainerWrapper_mtbhv_111{cursor:pointer}._dotsContainerWrapper_mtbhv_111:active{opacity:.8}}._hiddenTabs_mtbhv_133{height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px;clip:rect(0,0,0,0);border-width:0;white-space:nowrap}._tapEnabled_mtbhv_146{cursor:pointer;touch-action:manipulation}._autoplayControlWrapper_mtbhv_161{align-items:center;display:flex;justify-content:center;pointer-events:auto;position:absolute;right:16px;top:16px;z-index:10}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
._arrowContainer_ny9r1_1{background:none;border:none;padding:0;pointer-events:auto;position:relative;z-index:2}._iconButton_ny9r1_10{align-items:center;display:flex;justify-content:center}._hideWhenDisabled_ny9r1_16[aria-disabled=true]{display:none}._neutral_ny9r1_22 ._iconButton_ny9r1_10[data-focused=true],._neutral_ny9r1_22 ._iconButton_ny9r1_10[data-parent-hovered=true]{background-color:var(--alto-sem-color-overlay-state-darken-invert-hover)}:not([aria-disabled]) ._neutral_ny9r1_22 ._iconButton_ny9r1_10[data-parent-pressed=true]{background-color:var(--alto-sem-color-overlay-state-darken-invert-active)}._white_ny9r1_32 ._iconButton_ny9r1_10{background-color:transparent;border:none;border-radius:0}._white_ny9r1_32:not([aria-disabled]) ._iconButton_ny9r1_10[data-focused=true],._white_ny9r1_32:not([aria-disabled]) ._iconButton_ny9r1_10[data-parent-hovered=true]{background-color:var(--alto-sem-color-overlay-state-lighten-hover)}._white_ny9r1_32:not([aria-disabled]) ._iconButton_ny9r1_10[data-parent-pressed=true]{background-color:var(--alto-sem-color-overlay-state-lighten-active)}._shapeFlat_ny9r1_48:not([aria-disabled]) ._iconButton_ny9r1_10{background-color:var(--alto-sem-color-bg-white-vibrant-default)}._shapeFlat_ny9r1_48:not([aria-disabled]) ._iconButton_ny9r1_10[data-focused=true],._shapeFlat_ny9r1_48:not([aria-disabled]) ._iconButton_ny9r1_10[data-parent-hovered=true]{background-color:var(--alto-sem-color-bg-white-vibrant-hover)}._shapeFlat_ny9r1_48:not([aria-disabled]) ._iconButton_ny9r1_10[data-parent-pressed=true]{background-color:var(--alto-sem-color-bg-white-vibrant-active)}._shapeElevated_ny9r1_62:not([aria-disabled]) ._iconButton_ny9r1_10{background-color:var(--alto-sem-color-bg-white-vibrant-default);box-shadow:0 11.4px 9.12px #2f2a850d,0 2.59px 4.4px #2f2a850d,0 6.99px 18.18px #2f2a8514}._shapeElevated_ny9r1_62:not([aria-disabled]) ._iconButton_ny9r1_10[data-focused=true],._shapeElevated_ny9r1_62:not([aria-disabled]) ._iconButton_ny9r1_10[data-parent-hovered=true]{background-color:var(--alto-sem-color-bg-white-vibrant-hover)}._shapeElevated_ny9r1_62:not([aria-disabled]) ._iconButton_ny9r1_10[data-parent-pressed=true]{background-color:var(--alto-sem-color-bg-white-vibrant-active)}._gradient_ny9r1_80:not([aria-disabled]) ._iconButton_ny9r1_10{background:linear-gradient(90deg,#fefefe 50%,#fff0);border:none;border-radius:0}._gradient_ny9r1_80._next_ny9r1_86:not([aria-disabled]) ._iconButton_ny9r1_10{background:linear-gradient(90deg,#fff0,#fefefe 50%)}._gradient_ny9r1_80:not([aria-disabled]) ._iconButton_ny9r1_10[data-focused=true],._gradient_ny9r1_80:not([aria-disabled]) ._iconButton_ny9r1_10[data-parent-hovered=true]{background:linear-gradient(90deg,#fefefe 50%,#fff0);color:var(--alto-sem-color-fg-accent-primary)}._gradient_ny9r1_80._next_ny9r1_86:not([aria-disabled]) ._iconButton_ny9r1_10[data-focused=true],._gradient_ny9r1_80._next_ny9r1_86:not([aria-disabled]) ._iconButton_ny9r1_10[data-parent-hovered=true]{background:linear-gradient(90deg,#fff0,#fefefe 50%);color:var(--alto-sem-color-fg-accent-primary)}._gradient_ny9r1_80:not([aria-disabled]) ._iconButton_ny9r1_10[data-parent-pressed=true]{background-color:var(--alto-sem-color-overlay-state-lighten-active)}._gradient_ny9r1_80:not([aria-disabled]) ._iconButton_ny9r1_10[data-focused],._white_ny9r1_32:not([aria-disabled]) ._iconButton_ny9r1_10{outline-offset:var(--alto-sem-border-width-none)}[aria-disabled] ._iconButton_ny9r1_10{background-color:var(--alto-sem-color-fg-disabled-primary);cursor:not-allowed;opacity:var(--alto-sem-opacity-30)}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
._tabsContainer_1yet6_1{margin:0 auto;min-height:30px;width:240px}._tabsContainer_1yet6_1,._tabs_1yet6_1{align-items:center;display:flex;justify-content:center;overflow:hidden;position:relative}._tabs_1yet6_1{background-color:var(--alto-sem-color-bg-white-vibrant-default);border-radius:var(--alto-sem-radius-circle);padding:var(--alto-sem-space-2xs) var(--alto-sem-space-xs)}._tabs_1yet6_1[data-focused=true]{outline:2px solid var(--alto-sem-color-border-accent);outline-offset:1px}._tabs_1yet6_1._transparent_1yet6_28{background-color:transparent}._dotsScroller_1yet6_32{align-items:center;display:flex;gap:var(--alto-sem-space-2xs);justify-content:center;position:relative;white-space:nowrap;will-change:transform}._tab_1yet6_1{background-color:#0000004d;border:none;border-radius:var(--alto-sem-radius-circle);cursor:pointer;display:block;flex-shrink:0;margin:0;padding:0;transition:background-color .6s ease,width .6s ease,height .6s ease,opacity .6s ease}._tab_1yet6_1:hover,._tab_1yet6_1[data-hovered=true]{transform:scale(1.1)}._tab_1yet6_1._activeTab_1yet6_65{background-color:var(--alto-sem-color-fg-primary)}._tabs_1yet6_1[data-focused=true] ._tab_1yet6_1._activeTab_1yet6_65{background-color:var(--alto-sem-color-border-accent)}._tabMd_1yet6_74{height:8px;width:8px}._tabLg_1yet6_79{height:12px;width:12px}._tabSizeMedium_1yet6_85{height:6px;opacity:.8;width:6px}._tabSizeSmall_1yet6_92{height:4px;opacity:.6;width:4px}[data-dot-size=lg] ._tabSizeMedium_1yet6_85{height:9px;width:9px}[data-dot-size=lg] ._tabSizeSmall_1yet6_92{height:6px;width:6px}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
-
import
|
|
2
|
+
import React__default from "react";
|
|
3
3
|
import { Disclosure, DisclosureGroup, Button, DisclosurePanel } from "react-aria-components";
|
|
4
4
|
import { Icon } from "../Icon/Icon.js";
|
|
5
5
|
import '../../assets/Accordion.css';const accordion = "_accordion_1i793_1";
|
|
@@ -58,8 +58,8 @@ const AccordionPanel = ({
|
|
|
58
58
|
children,
|
|
59
59
|
...props
|
|
60
60
|
}) => {
|
|
61
|
-
const contentRef =
|
|
62
|
-
|
|
61
|
+
const contentRef = React__default.useRef(null);
|
|
62
|
+
React__default.useEffect(() => {
|
|
63
63
|
const content = contentRef.current;
|
|
64
64
|
if (!content) return;
|
|
65
65
|
const group = content.closest('[role="group"]');
|
|
@@ -110,8 +110,8 @@ const AccordionGroup = ({
|
|
|
110
110
|
allowsMultipleExpanded = true
|
|
111
111
|
}) => {
|
|
112
112
|
const groupClasses = [styles.accordionGroup, className].filter(Boolean).join(" ");
|
|
113
|
-
const defaultExpandedKeys =
|
|
114
|
-
if (
|
|
113
|
+
const defaultExpandedKeys = React__default.Children.toArray(children).map((child, index) => {
|
|
114
|
+
if (React__default.isValidElement(child) && child.props.defaultExpanded) {
|
|
115
115
|
return `accordion-${index}`;
|
|
116
116
|
}
|
|
117
117
|
return null;
|
|
@@ -121,9 +121,9 @@ const AccordionGroup = ({
|
|
|
121
121
|
title,
|
|
122
122
|
description
|
|
123
123
|
] }),
|
|
124
|
-
/* @__PURE__ */ jsx(DisclosureGroup, { className: styles.accordionStack, allowsMultipleExpanded, defaultExpandedKeys, children:
|
|
125
|
-
if (
|
|
126
|
-
return
|
|
124
|
+
/* @__PURE__ */ jsx(DisclosureGroup, { className: styles.accordionStack, allowsMultipleExpanded, defaultExpandedKeys, children: React__default.Children.map(children, (child, index) => {
|
|
125
|
+
if (React__default.isValidElement(child)) {
|
|
126
|
+
return React__default.cloneElement(child, {
|
|
127
127
|
key: `accordion-${index}`,
|
|
128
128
|
id: `accordion-${index}`
|
|
129
129
|
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
-
import
|
|
2
|
+
import React__default from "react";
|
|
3
3
|
import { c as cva } from "../../index-Bi3v_EjJ.js";
|
|
4
4
|
import '../../assets/AviosCurrencySymbol.css';const styles = {
|
|
5
5
|
"aviosCurrencySymbol-primary": "_aviosCurrencySymbol-primary_q5gfd_1",
|
|
@@ -43,7 +43,7 @@ const AviosCurrencySymbol = ({
|
|
|
43
43
|
"aria-label": ariaLabel,
|
|
44
44
|
...props
|
|
45
45
|
}) => {
|
|
46
|
-
const dimensions =
|
|
46
|
+
const dimensions = React__default.useMemo(() => {
|
|
47
47
|
if (width && height) {
|
|
48
48
|
return {
|
|
49
49
|
width,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
import
|
|
2
|
+
import React__default from "react";
|
|
3
3
|
import { c as cva } from "../../index-Bi3v_EjJ.js";
|
|
4
4
|
import '../../assets/ButtonGroup.css';const buttonGroup = "_buttonGroup_zcnod_2";
|
|
5
5
|
const alignStart = "_alignStart_zcnod_10";
|
|
@@ -41,7 +41,7 @@ const ButtonGroup = ({
|
|
|
41
41
|
}) => {
|
|
42
42
|
return /* @__PURE__ */ jsx("div", { className: `${buttonGroupStyles({
|
|
43
43
|
align
|
|
44
|
-
})}`, role: "group", "aria-label": "Button Group", children:
|
|
44
|
+
})}`, role: "group", "aria-label": "Button Group", children: React__default.Children.map(children, (child) => child) });
|
|
45
45
|
};
|
|
46
46
|
export {
|
|
47
47
|
ButtonGroup,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
-
import
|
|
2
|
+
import React__default from "react";
|
|
3
3
|
import { Icon } from "../Icon/Icon.js";
|
|
4
4
|
import { c as cva } from "../../index-Bi3v_EjJ.js";
|
|
5
5
|
import { IconButton } from "../IconButton/IconButton.js";
|
|
@@ -55,7 +55,7 @@ const CalloutBanner = ({
|
|
|
55
55
|
emphasis = "primary",
|
|
56
56
|
onDismiss
|
|
57
57
|
}) => {
|
|
58
|
-
const iconName =
|
|
58
|
+
const iconName = React__default.useMemo(() => {
|
|
59
59
|
switch (styleVariant) {
|
|
60
60
|
case "critical":
|
|
61
61
|
return "circle-exclamation";
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export interface AutoplayControlProps {
|
|
2
|
+
/**
|
|
3
|
+
* Focus style
|
|
4
|
+
* @default 'default'
|
|
5
|
+
*/
|
|
6
|
+
focusStyle?: 'default' | 'white';
|
|
7
|
+
/**
|
|
8
|
+
* Style variant of the button
|
|
9
|
+
* @default 'neutralVibrant'
|
|
10
|
+
*/
|
|
11
|
+
variant?: 'neutralVibrant' | 'neutralSubtle' | 'whiteVibrant' | 'whiteSubtle';
|
|
12
|
+
/**
|
|
13
|
+
* Size of the button
|
|
14
|
+
* @default 'md'
|
|
15
|
+
*/
|
|
16
|
+
size?: 'sm' | 'md';
|
|
17
|
+
/**
|
|
18
|
+
* Additional CSS class name for the container
|
|
19
|
+
*/
|
|
20
|
+
className?: string;
|
|
21
|
+
/**
|
|
22
|
+
* Additional CSS class name for the button
|
|
23
|
+
*/
|
|
24
|
+
buttonClassName?: string;
|
|
25
|
+
}
|
|
26
|
+
export declare const AutoplayControl: ({ variant, size, focusStyle, className, buttonClassName, }: AutoplayControlProps) => import("react/jsx-runtime").JSX.Element;
|
|
27
|
+
export default AutoplayControl;
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useState } from "react";
|
|
3
|
+
import { f as CarouselAutoplayControl } from "../../../index-uZFEbUWx.js";
|
|
4
|
+
import { useFocusRing } from "@react-aria/focus";
|
|
5
|
+
import { i as iconButtonStyles } from "../../../IconButton.module-DcfPVyUX.js";
|
|
6
|
+
import { Icon } from "../../Icon/Icon.js";
|
|
7
|
+
import { focusStyleVariants } from "../../../utils/focus/focusStyles.js";
|
|
8
|
+
import '../../../assets/AutoplayControl.css';const autoplayControl = "_autoplayControl_jeo17_1";
|
|
9
|
+
const iconButton = "_iconButton_jeo17_17";
|
|
10
|
+
const sizeMd = "_sizeMd_jeo17_25";
|
|
11
|
+
const sizeSm = "_sizeSm_jeo17_31";
|
|
12
|
+
const neutralVibrant = "_neutralVibrant_jeo17_38";
|
|
13
|
+
const whiteVibrant = "_whiteVibrant_jeo17_44";
|
|
14
|
+
const neutralSubtle = "_neutralSubtle_jeo17_55";
|
|
15
|
+
const whiteSubtle = "_whiteSubtle_jeo17_61";
|
|
16
|
+
const styles = {
|
|
17
|
+
autoplayControl,
|
|
18
|
+
iconButton,
|
|
19
|
+
sizeMd,
|
|
20
|
+
sizeSm,
|
|
21
|
+
neutralVibrant,
|
|
22
|
+
whiteVibrant,
|
|
23
|
+
neutralSubtle,
|
|
24
|
+
whiteSubtle
|
|
25
|
+
};
|
|
26
|
+
const AutoplayControl = ({
|
|
27
|
+
variant = "neutralVibrant",
|
|
28
|
+
size = "md",
|
|
29
|
+
focusStyle = "default",
|
|
30
|
+
className = "",
|
|
31
|
+
buttonClassName = ""
|
|
32
|
+
}) => {
|
|
33
|
+
const {
|
|
34
|
+
isFocusVisible,
|
|
35
|
+
focusProps
|
|
36
|
+
} = useFocusRing();
|
|
37
|
+
const [isHovered, setIsHovered] = useState(false);
|
|
38
|
+
const [isPressed, setIsPressed] = useState(false);
|
|
39
|
+
const variantClass = styles[variant] || "";
|
|
40
|
+
const iconSize = size === "md" ? "1.25x" : "1x";
|
|
41
|
+
const getIconColor = () => {
|
|
42
|
+
switch (variant) {
|
|
43
|
+
case "whiteVibrant":
|
|
44
|
+
return "whiteOnVibrant";
|
|
45
|
+
case "whiteSubtle":
|
|
46
|
+
return "whiteOnSubtle";
|
|
47
|
+
case "neutralVibrant":
|
|
48
|
+
return "inverseOnVibrant";
|
|
49
|
+
case "neutralSubtle":
|
|
50
|
+
return "inverseOnSubtle";
|
|
51
|
+
default:
|
|
52
|
+
return "whiteOnVibrant";
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
return /* @__PURE__ */ jsx(CarouselAutoplayControl, { className: `${styles.autoplayControl} ${variantClass} ${className || ""}`, ...focusProps, onMouseEnter: () => setIsHovered(true), onMouseLeave: () => setIsHovered(false), onMouseDown: () => setIsPressed(true), onMouseUp: () => setIsPressed(false), "data-hovered": isHovered ? true : void 0, "data-pressed": isPressed ? true : void 0, "data-size": size, children: ({
|
|
56
|
+
autoplayUserPreference
|
|
57
|
+
}) => /* @__PURE__ */ jsx("div", { className: `${styles.iconButton} ${iconButtonStyles.iconButton} ${iconButtonStyles[size] || ""} ${focusStyleVariants({
|
|
58
|
+
focusStyle
|
|
59
|
+
})} ${buttonClassName || ""}`, "data-focused": isFocusVisible ? true : void 0, "data-parent-hovered": isHovered ? true : void 0, "data-parent-pressed": isPressed ? true : void 0, "data-size": size, children: /* @__PURE__ */ jsx(Icon, { iconPrefix: "fas", iconName: autoplayUserPreference ? "pause" : "play", color: getIconColor(), iconSize, "aria-hidden": "true" }) }) });
|
|
60
|
+
};
|
|
61
|
+
export {
|
|
62
|
+
AutoplayControl,
|
|
63
|
+
AutoplayControl as default
|
|
64
|
+
};
|
|
65
|
+
//# sourceMappingURL=AutoplayControl.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AutoplayControl.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
export interface CarouselProps {
|
|
3
|
+
/**
|
|
4
|
+
* Content to be displayed in the carousel
|
|
5
|
+
*/
|
|
6
|
+
children?: React.ReactNode | React.ReactNode[];
|
|
7
|
+
/**
|
|
8
|
+
* Carousel variant
|
|
9
|
+
* @default 'default'
|
|
10
|
+
*/
|
|
11
|
+
variant?: 'default' | 'minimal';
|
|
12
|
+
/**
|
|
13
|
+
* Looping behavior
|
|
14
|
+
* - 'infinite': Carousel loops continuously
|
|
15
|
+
* - 'backToStart': Carousel loops back to start after reaching end
|
|
16
|
+
* - 'off': Looping is disabled
|
|
17
|
+
* @default 'off'
|
|
18
|
+
*/
|
|
19
|
+
looping?: 'infinite' | 'backToStart' | 'off';
|
|
20
|
+
/**
|
|
21
|
+
* Number of items to display per page (minimum: 1)
|
|
22
|
+
* Decimal values (e.g., 2.25) can be used to show partial items
|
|
23
|
+
* @default 1
|
|
24
|
+
* @min 1
|
|
25
|
+
*/
|
|
26
|
+
itemsPerPage?: number;
|
|
27
|
+
/**
|
|
28
|
+
* Space between carousel items in pixels
|
|
29
|
+
* @default 0
|
|
30
|
+
*/
|
|
31
|
+
spaceBetweenItems?: number;
|
|
32
|
+
/**
|
|
33
|
+
* Whether to show a peek of the next/previous slides when in
|
|
34
|
+
* overflow mode
|
|
35
|
+
* @default false
|
|
36
|
+
*/
|
|
37
|
+
hasScrollPeek?: boolean;
|
|
38
|
+
/**
|
|
39
|
+
* Additional CSS class for the carousel container
|
|
40
|
+
*/
|
|
41
|
+
className?: string;
|
|
42
|
+
/**
|
|
43
|
+
* Icon type for navigation buttons
|
|
44
|
+
* @default 'chevron'
|
|
45
|
+
*/
|
|
46
|
+
iconType?: 'chevron';
|
|
47
|
+
/**
|
|
48
|
+
* Style of carousel arrow buttons
|
|
49
|
+
* @default 'neutral'
|
|
50
|
+
*/
|
|
51
|
+
carouselArrow?: 'neutral' | 'white' | 'shapeFlat' | 'shapeElevated' | 'gradient';
|
|
52
|
+
/**
|
|
53
|
+
* Size of navigation buttons
|
|
54
|
+
* @default 'md'
|
|
55
|
+
*/
|
|
56
|
+
buttonSize?: 'sm' | 'md' | 'lg';
|
|
57
|
+
/**
|
|
58
|
+
* Focus style for interactive elements
|
|
59
|
+
* @default 'default'
|
|
60
|
+
*/
|
|
61
|
+
focusStyle?: 'default' | 'white';
|
|
62
|
+
/**
|
|
63
|
+
* Size of pagination dots
|
|
64
|
+
* @default 'md'
|
|
65
|
+
*/
|
|
66
|
+
dotSize?: 'md' | 'lg';
|
|
67
|
+
/**
|
|
68
|
+
* Visual style of pagination dots
|
|
69
|
+
* @default 'standard'
|
|
70
|
+
*/
|
|
71
|
+
dotsVariant?: 'standard' | 'transparent';
|
|
72
|
+
/**
|
|
73
|
+
* Whether to hide pagination dots
|
|
74
|
+
* @default false
|
|
75
|
+
*/
|
|
76
|
+
hideDots?: boolean;
|
|
77
|
+
/**
|
|
78
|
+
* Whether to enable cycle behavior on dots container tap for mobile
|
|
79
|
+
* @default true
|
|
80
|
+
*/
|
|
81
|
+
enableTapCycling?: boolean;
|
|
82
|
+
/**
|
|
83
|
+
* Whether the autoplay is enabled
|
|
84
|
+
* @default false
|
|
85
|
+
*/
|
|
86
|
+
isPaused?: boolean;
|
|
87
|
+
/**
|
|
88
|
+
* Interval in milliseconds between slides during autoplay
|
|
89
|
+
* @default 2000
|
|
90
|
+
*/
|
|
91
|
+
autoPlayInterval?: number;
|
|
92
|
+
/**
|
|
93
|
+
* Style variant for autoplay control button
|
|
94
|
+
* @default 'neutralVibrant'
|
|
95
|
+
*/
|
|
96
|
+
autoPlayControlVariant?: 'neutralVibrant' | 'neutralSubtle' | 'whiteVibrant' | 'whiteSubtle';
|
|
97
|
+
/**
|
|
98
|
+
* Size of autoplay control button
|
|
99
|
+
* @default 'md'
|
|
100
|
+
*/
|
|
101
|
+
autoPlayControlSize?: 'sm' | 'md';
|
|
102
|
+
/**
|
|
103
|
+
* Whether to enable mouse dragging for the carousel
|
|
104
|
+
* @default true
|
|
105
|
+
*/
|
|
106
|
+
mouseDragging?: boolean;
|
|
107
|
+
/**
|
|
108
|
+
* Class name for the outermost wrapper of the carousel
|
|
109
|
+
*/
|
|
110
|
+
carouselWrapperClassName?: string;
|
|
111
|
+
/**
|
|
112
|
+
* Class name for the controls container
|
|
113
|
+
*/
|
|
114
|
+
controlsClassName?: string;
|
|
115
|
+
/**
|
|
116
|
+
* Class name for the previous button
|
|
117
|
+
* Use this to position the previous button
|
|
118
|
+
*/
|
|
119
|
+
prevButtonClassName?: string;
|
|
120
|
+
/**
|
|
121
|
+
* Class name for the next button
|
|
122
|
+
* Use this to position the next button
|
|
123
|
+
*/
|
|
124
|
+
nextButtonClassName?: string;
|
|
125
|
+
/**
|
|
126
|
+
* Class name for the autoplay control
|
|
127
|
+
* Use this to position the autoplay button
|
|
128
|
+
*/
|
|
129
|
+
autoplayControlClassName?: string;
|
|
130
|
+
/**
|
|
131
|
+
* Class name for the dots container
|
|
132
|
+
* Use this to position the pagination dots
|
|
133
|
+
*/
|
|
134
|
+
dotsContainerClassName?: string;
|
|
135
|
+
/**
|
|
136
|
+
* Class name for the dots wrapper
|
|
137
|
+
* Use this to style the dots wrapper
|
|
138
|
+
*/
|
|
139
|
+
dotsWrapperClassName?: string;
|
|
140
|
+
/**
|
|
141
|
+
* Class name for individual dots
|
|
142
|
+
*/
|
|
143
|
+
dotClassName?: string;
|
|
144
|
+
/**
|
|
145
|
+
* Class name for the active dot
|
|
146
|
+
*/
|
|
147
|
+
activeDotClassName?: string;
|
|
148
|
+
}
|
|
149
|
+
export declare const Carousel: ({ children, looping, className, itemsPerPage, spaceBetweenItems, hasScrollPeek, iconType, carouselArrow, buttonSize, focusStyle, dotSize, dotsVariant, hideDots, enableTapCycling, isPaused, autoPlayInterval, autoPlayControlVariant, autoPlayControlSize, mouseDragging, carouselWrapperClassName, controlsClassName, prevButtonClassName, nextButtonClassName, autoplayControlClassName, dotsContainerClassName, dotsWrapperClassName, dotClassName, activeDotClassName, }: CarouselProps) => import("react/jsx-runtime").JSX.Element;
|
|
150
|
+
export default Carousel;
|
|
@@ -0,0 +1,245 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import React__default, { useRef, useState, useEffect } from "react";
|
|
3
|
+
import { c as cva } from "../../index-Bi3v_EjJ.js";
|
|
4
|
+
import { C as Carousel$1, a as CarouselScroller, b as CarouselItem, c as CarouselTabs, d as CarouselTab } from "../../index-uZFEbUWx.js";
|
|
5
|
+
import { CarouselButton } from "./CarouselButton/CarouselButton.js";
|
|
6
|
+
import { CarouselDots } from "./CarouselDots/CarouselDots.js";
|
|
7
|
+
import { AutoplayControl } from "./AutoplayControl/AutoplayControl.js";
|
|
8
|
+
import '../../assets/Carousel.css';const carouselWrapper = "_carouselWrapper_mtbhv_1";
|
|
9
|
+
const showPartialItems = "_showPartialItems_mtbhv_9";
|
|
10
|
+
const carousel$1 = "_carousel_mtbhv_1";
|
|
11
|
+
const scroller = "_scroller_mtbhv_23";
|
|
12
|
+
const item = "_item_mtbhv_43";
|
|
13
|
+
const slideLeft = "_slideLeft_mtbhv_73";
|
|
14
|
+
const slideLeftAnimation = "_slideLeftAnimation_mtbhv_1";
|
|
15
|
+
const slideRight = "_slideRight_mtbhv_77";
|
|
16
|
+
const slideRightAnimation = "_slideRightAnimation_mtbhv_1";
|
|
17
|
+
const controls = "_controls_mtbhv_100";
|
|
18
|
+
const dotsContainerWrapper = "_dotsContainerWrapper_mtbhv_111";
|
|
19
|
+
const dotsContainer = "_dotsContainer_mtbhv_111";
|
|
20
|
+
const hiddenTabs = "_hiddenTabs_mtbhv_133";
|
|
21
|
+
const tapEnabled = "_tapEnabled_mtbhv_146";
|
|
22
|
+
const infinite = "_infinite_mtbhv_152";
|
|
23
|
+
const native = "_native_mtbhv_157";
|
|
24
|
+
const autoplayControlWrapper = "_autoplayControlWrapper_mtbhv_161";
|
|
25
|
+
const styles = {
|
|
26
|
+
carouselWrapper,
|
|
27
|
+
showPartialItems,
|
|
28
|
+
carousel: carousel$1,
|
|
29
|
+
scroller,
|
|
30
|
+
item,
|
|
31
|
+
slideLeft,
|
|
32
|
+
slideLeftAnimation,
|
|
33
|
+
slideRight,
|
|
34
|
+
slideRightAnimation,
|
|
35
|
+
controls,
|
|
36
|
+
dotsContainerWrapper,
|
|
37
|
+
dotsContainer,
|
|
38
|
+
hiddenTabs,
|
|
39
|
+
tapEnabled,
|
|
40
|
+
infinite,
|
|
41
|
+
native,
|
|
42
|
+
autoplayControlWrapper
|
|
43
|
+
};
|
|
44
|
+
const carousel = cva(styles.carousel, {
|
|
45
|
+
variants: {
|
|
46
|
+
looping: {
|
|
47
|
+
infinite: styles.infinite,
|
|
48
|
+
backToStart: styles.native,
|
|
49
|
+
off: void 0
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
const Carousel = ({
|
|
54
|
+
children = [],
|
|
55
|
+
looping = "off",
|
|
56
|
+
className = "",
|
|
57
|
+
itemsPerPage = 1,
|
|
58
|
+
spaceBetweenItems = 0,
|
|
59
|
+
hasScrollPeek = false,
|
|
60
|
+
// Button and Controls Props
|
|
61
|
+
iconType = "chevron",
|
|
62
|
+
carouselArrow = "neutral",
|
|
63
|
+
buttonSize = "md",
|
|
64
|
+
focusStyle = "default",
|
|
65
|
+
// Dots/Tabs Props
|
|
66
|
+
dotSize = "md",
|
|
67
|
+
dotsVariant = "standard",
|
|
68
|
+
hideDots = false,
|
|
69
|
+
// Mobile Props
|
|
70
|
+
enableTapCycling = true,
|
|
71
|
+
// Autoplay Props
|
|
72
|
+
isPaused = false,
|
|
73
|
+
autoPlayInterval = 2e3,
|
|
74
|
+
autoPlayControlVariant = "neutralVibrant",
|
|
75
|
+
autoPlayControlSize = "md",
|
|
76
|
+
// Mouse Dragging
|
|
77
|
+
mouseDragging = true,
|
|
78
|
+
// Custom Class Names
|
|
79
|
+
carouselWrapperClassName = "",
|
|
80
|
+
controlsClassName = "",
|
|
81
|
+
prevButtonClassName = "",
|
|
82
|
+
nextButtonClassName = "",
|
|
83
|
+
autoplayControlClassName = "",
|
|
84
|
+
dotsContainerClassName = "",
|
|
85
|
+
dotsWrapperClassName = "",
|
|
86
|
+
dotClassName = "",
|
|
87
|
+
activeDotClassName = ""
|
|
88
|
+
}) => {
|
|
89
|
+
const getLoopValue = () => {
|
|
90
|
+
if (looping === "infinite") return "infinite";
|
|
91
|
+
if (looping === "backToStart") return "native";
|
|
92
|
+
if (looping === "off") return void 0;
|
|
93
|
+
return looping;
|
|
94
|
+
};
|
|
95
|
+
const items = React__default.Children.toArray(children);
|
|
96
|
+
const totalItems = items.length;
|
|
97
|
+
const safeItemsPerPage = Math.max(1, itemsPerPage);
|
|
98
|
+
const totalPages = Math.ceil(totalItems / safeItemsPerPage);
|
|
99
|
+
const carouselRef = useRef(null);
|
|
100
|
+
const ariaCarouselRef = useRef(null);
|
|
101
|
+
const [currentPage, setCurrentPage] = useState(0);
|
|
102
|
+
const [prevPage, setPrevPage] = useState(0);
|
|
103
|
+
const [isDragging, setIsDragging] = useState(false);
|
|
104
|
+
const getCarouselWrapperClasses = () => {
|
|
105
|
+
const classes = [styles.carouselWrapper];
|
|
106
|
+
if (!Number.isInteger(safeItemsPerPage)) {
|
|
107
|
+
classes.push(styles.showPartialItems);
|
|
108
|
+
}
|
|
109
|
+
if (carouselWrapperClassName) {
|
|
110
|
+
classes.push(carouselWrapperClassName);
|
|
111
|
+
}
|
|
112
|
+
return classes.join(" ");
|
|
113
|
+
};
|
|
114
|
+
const getCssVariables = () => {
|
|
115
|
+
const cssVars2 = {};
|
|
116
|
+
if (itemsPerPage !== 1) {
|
|
117
|
+
cssVars2["--items-per-page"] = String(safeItemsPerPage);
|
|
118
|
+
}
|
|
119
|
+
if (spaceBetweenItems > 0) {
|
|
120
|
+
cssVars2["--space-between-items"] = `${spaceBetweenItems}px`;
|
|
121
|
+
}
|
|
122
|
+
if (hasScrollPeek) {
|
|
123
|
+
cssVars2["--scroll-padding"] = "16px";
|
|
124
|
+
}
|
|
125
|
+
return Object.keys(cssVars2).length > 0 ? cssVars2 : void 0;
|
|
126
|
+
};
|
|
127
|
+
const navigateToSlide = (index) => {
|
|
128
|
+
if (index === currentPage) return;
|
|
129
|
+
setPrevPage(currentPage);
|
|
130
|
+
setCurrentPage(index);
|
|
131
|
+
if (carouselRef.current) {
|
|
132
|
+
const nativeTab = carouselRef.current.querySelector(`[data-index="${index}"]`);
|
|
133
|
+
if (nativeTab && nativeTab instanceof HTMLElement) {
|
|
134
|
+
nativeTab.click();
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
};
|
|
138
|
+
useEffect(() => {
|
|
139
|
+
if (carouselRef.current) {
|
|
140
|
+
const scroller2 = carouselRef.current.querySelector(`.${styles.scroller}`);
|
|
141
|
+
if (scroller2 && scroller2 instanceof HTMLElement) {
|
|
142
|
+
if (prevPage < currentPage) {
|
|
143
|
+
scroller2.classList.remove(styles.slideLeft);
|
|
144
|
+
scroller2.classList.add(styles.slideRight);
|
|
145
|
+
} else if (prevPage > currentPage) {
|
|
146
|
+
scroller2.classList.remove(styles.slideRight);
|
|
147
|
+
scroller2.classList.add(styles.slideLeft);
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
}, [currentPage, prevPage]);
|
|
152
|
+
useEffect(() => {
|
|
153
|
+
if (!carouselRef.current) return;
|
|
154
|
+
const updateCurrentPage = () => {
|
|
155
|
+
if (!carouselRef.current) return;
|
|
156
|
+
const selectedTab = carouselRef.current.querySelector('[aria-selected="true"]');
|
|
157
|
+
if (selectedTab && selectedTab.hasAttribute("data-index")) {
|
|
158
|
+
const index = parseInt(selectedTab.getAttribute("data-index") || "0", 10);
|
|
159
|
+
if (!isNaN(index) && index !== currentPage) {
|
|
160
|
+
setPrevPage(currentPage);
|
|
161
|
+
setCurrentPage(index);
|
|
162
|
+
}
|
|
163
|
+
} else {
|
|
164
|
+
const visibleSlide = carouselRef.current.querySelector('[role="tabpanel"]:not([aria-hidden="true"])');
|
|
165
|
+
if (visibleSlide && visibleSlide.hasAttribute("data-index")) {
|
|
166
|
+
const index = parseInt(visibleSlide.getAttribute("data-index") || "0", 10);
|
|
167
|
+
if (!isNaN(index) && index !== currentPage) {
|
|
168
|
+
setPrevPage(currentPage);
|
|
169
|
+
setCurrentPage(index);
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
};
|
|
174
|
+
const prevButton = carouselRef.current.querySelector('[dir="prev"]');
|
|
175
|
+
const nextButton = carouselRef.current.querySelector('[dir="next"]');
|
|
176
|
+
const handleButtonClick = () => {
|
|
177
|
+
setTimeout(updateCurrentPage, 50);
|
|
178
|
+
};
|
|
179
|
+
prevButton == null ? void 0 : prevButton.addEventListener("click", handleButtonClick);
|
|
180
|
+
nextButton == null ? void 0 : nextButton.addEventListener("click", handleButtonClick);
|
|
181
|
+
const observer = new MutationObserver((mutations) => {
|
|
182
|
+
for (const mutation of mutations) {
|
|
183
|
+
if (mutation.type === "attributes" && (mutation.attributeName === "aria-selected" || mutation.attributeName === "aria-current")) {
|
|
184
|
+
updateCurrentPage();
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
});
|
|
188
|
+
const tabs = carouselRef.current.querySelectorAll('[role="tab"]');
|
|
189
|
+
tabs.forEach((tab) => {
|
|
190
|
+
observer.observe(tab, {
|
|
191
|
+
attributes: true
|
|
192
|
+
});
|
|
193
|
+
});
|
|
194
|
+
const scroller2 = carouselRef.current.querySelector(".scroller");
|
|
195
|
+
if (scroller2) {
|
|
196
|
+
observer.observe(scroller2, {
|
|
197
|
+
attributes: true
|
|
198
|
+
});
|
|
199
|
+
}
|
|
200
|
+
const handleSlideTransition = () => {
|
|
201
|
+
updateCurrentPage();
|
|
202
|
+
};
|
|
203
|
+
const scrollerElement = carouselRef.current.querySelector(`.${styles.scroller}`);
|
|
204
|
+
if (scrollerElement) {
|
|
205
|
+
scrollerElement.addEventListener("transitionend", handleSlideTransition);
|
|
206
|
+
}
|
|
207
|
+
updateCurrentPage();
|
|
208
|
+
const checkInterval = setInterval(updateCurrentPage, 300);
|
|
209
|
+
return () => {
|
|
210
|
+
observer.disconnect();
|
|
211
|
+
prevButton == null ? void 0 : prevButton.removeEventListener("click", handleButtonClick);
|
|
212
|
+
nextButton == null ? void 0 : nextButton.removeEventListener("click", handleButtonClick);
|
|
213
|
+
if (scrollerElement) {
|
|
214
|
+
scrollerElement.removeEventListener("transitionend", handleSlideTransition);
|
|
215
|
+
}
|
|
216
|
+
clearInterval(checkInterval);
|
|
217
|
+
};
|
|
218
|
+
}, [currentPage]);
|
|
219
|
+
const cssVars = getCssVariables();
|
|
220
|
+
return /* @__PURE__ */ jsx("div", { className: getCarouselWrapperClasses(), ref: carouselRef, style: cssVars, "data-dots-size": dotSize, children: /* @__PURE__ */ jsxs(Carousel$1, { className: `${carousel({
|
|
221
|
+
looping
|
|
222
|
+
})} ${className}`, loop: getLoopValue(), ref: ariaCarouselRef, autoplay: isPaused, autoplayInterval: autoPlayInterval, mouseDragging, onDragStart: () => setIsDragging(true), onDragEnd: () => setIsDragging(false), "data-dragging": isDragging ? "true" : "false", itemsPerPage: safeItemsPerPage, spaceBetweenItems: spaceBetweenItems > 0 ? `${spaceBetweenItems}px` : void 0, scrollPadding: hasScrollPeek ? "16px" : void 0, "data-has-scroll-peek": hasScrollPeek ? "true" : void 0, "data-has-space-between": spaceBetweenItems > 0 ? "true" : void 0, "data-items-per-page": itemsPerPage !== 1 ? safeItemsPerPage.toString() : void 0, children: [
|
|
223
|
+
isPaused && /* @__PURE__ */ jsx("div", { className: `${styles.autoplayControlWrapper} ${autoplayControlClassName || ""}`, children: /* @__PURE__ */ jsx(AutoplayControl, { variant: autoPlayControlVariant, size: autoPlayControlSize, className: "" }) }),
|
|
224
|
+
/* @__PURE__ */ jsx(CarouselScroller, { className: styles.scroller, children: items.map((child, index) => /* @__PURE__ */ jsx(CarouselItem, { className: styles.item, children: child }, index)) }),
|
|
225
|
+
/* @__PURE__ */ jsxs("div", { className: `${styles.controls} ${controlsClassName}`, children: [
|
|
226
|
+
/* @__PURE__ */ jsx(CarouselButton, { dir: "prev", variant: carouselArrow, size: buttonSize, focusStyle, iconType, className: prevButtonClassName }),
|
|
227
|
+
/* @__PURE__ */ jsx(CarouselButton, { dir: "next", variant: carouselArrow, size: buttonSize, focusStyle, iconType, className: nextButtonClassName })
|
|
228
|
+
] }),
|
|
229
|
+
/* @__PURE__ */ jsx("div", { className: styles.hiddenTabs, children: /* @__PURE__ */ jsx(CarouselTabs, { children: (page) => /* @__PURE__ */ jsx(CarouselTab, { index: page.index, "data-index": page.index, "data-slide-tab": "true" }, page.index) }) }),
|
|
230
|
+
!hideDots && /* @__PURE__ */ jsx(CarouselDots, { totalItems: totalPages, currentPage, onDotClick: (index) => {
|
|
231
|
+
const isMobileDevice = /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);
|
|
232
|
+
if (isMobileDevice && enableTapCycling) {
|
|
233
|
+
const nextPage = (currentPage + 1) % totalPages;
|
|
234
|
+
navigateToSlide(nextPage);
|
|
235
|
+
} else {
|
|
236
|
+
navigateToSlide(index);
|
|
237
|
+
}
|
|
238
|
+
}, tabSize: dotSize, dotSize, variant: dotsVariant, className: `${dotsContainerClassName} ${enableTapCycling ? styles.tapEnabled : ""}`, dotsWrapperClassName, dotClassName, activeDotClassName })
|
|
239
|
+
] }) });
|
|
240
|
+
};
|
|
241
|
+
export {
|
|
242
|
+
Carousel,
|
|
243
|
+
Carousel as default
|
|
244
|
+
};
|
|
245
|
+
//# sourceMappingURL=Carousel.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Carousel.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|