@salt-ds/embla-carousel 0.0.0-snapshot-20250627090641

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 (102) hide show
  1. package/CHANGELOG.md +161 -0
  2. package/README.md +3 -0
  3. package/css/salt-embla-carousel.css +155 -0
  4. package/dist-cjs/Carousel.css.js +6 -0
  5. package/dist-cjs/Carousel.css.js.map +1 -0
  6. package/dist-cjs/Carousel.js +53 -0
  7. package/dist-cjs/Carousel.js.map +1 -0
  8. package/dist-cjs/CarouselAnnouncementPlugin.js +55 -0
  9. package/dist-cjs/CarouselAnnouncementPlugin.js.map +1 -0
  10. package/dist-cjs/CarouselAutoplayIndicator.css.js +6 -0
  11. package/dist-cjs/CarouselAutoplayIndicator.css.js.map +1 -0
  12. package/dist-cjs/CarouselAutoplayIndicator.js +82 -0
  13. package/dist-cjs/CarouselAutoplayIndicator.js.map +1 -0
  14. package/dist-cjs/CarouselAutoplayIndicatorSVG.js +54 -0
  15. package/dist-cjs/CarouselAutoplayIndicatorSVG.js.map +1 -0
  16. package/dist-cjs/CarouselCard.css.js +6 -0
  17. package/dist-cjs/CarouselCard.css.js.map +1 -0
  18. package/dist-cjs/CarouselCard.js +50 -0
  19. package/dist-cjs/CarouselCard.js.map +1 -0
  20. package/dist-cjs/CarouselContext.js +22 -0
  21. package/dist-cjs/CarouselContext.js.map +1 -0
  22. package/dist-cjs/CarouselNextButton.js +35 -0
  23. package/dist-cjs/CarouselNextButton.js.map +1 -0
  24. package/dist-cjs/CarouselPreviousButton.js +35 -0
  25. package/dist-cjs/CarouselPreviousButton.js.map +1 -0
  26. package/dist-cjs/CarouselProgressLabel.css.js +6 -0
  27. package/dist-cjs/CarouselProgressLabel.css.js.map +1 -0
  28. package/dist-cjs/CarouselProgressLabel.js +65 -0
  29. package/dist-cjs/CarouselProgressLabel.js.map +1 -0
  30. package/dist-cjs/CarouselSlides.css.js +6 -0
  31. package/dist-cjs/CarouselSlides.css.js.map +1 -0
  32. package/dist-cjs/CarouselSlides.js +55 -0
  33. package/dist-cjs/CarouselSlides.js.map +1 -0
  34. package/dist-cjs/CarouselTab.css.js +6 -0
  35. package/dist-cjs/CarouselTab.css.js.map +1 -0
  36. package/dist-cjs/CarouselTab.js +71 -0
  37. package/dist-cjs/CarouselTab.js.map +1 -0
  38. package/dist-cjs/CarouselTabList.css.js +6 -0
  39. package/dist-cjs/CarouselTabList.css.js.map +1 -0
  40. package/dist-cjs/CarouselTabList.js +94 -0
  41. package/dist-cjs/CarouselTabList.js.map +1 -0
  42. package/dist-cjs/index.js +31 -0
  43. package/dist-cjs/index.js.map +1 -0
  44. package/dist-cjs/usePrevNextButtons.js +41 -0
  45. package/dist-cjs/usePrevNextButtons.js.map +1 -0
  46. package/dist-es/Carousel.css.js +4 -0
  47. package/dist-es/Carousel.css.js.map +1 -0
  48. package/dist-es/Carousel.js +51 -0
  49. package/dist-es/Carousel.js.map +1 -0
  50. package/dist-es/CarouselAnnouncementPlugin.js +52 -0
  51. package/dist-es/CarouselAnnouncementPlugin.js.map +1 -0
  52. package/dist-es/CarouselAutoplayIndicator.css.js +4 -0
  53. package/dist-es/CarouselAutoplayIndicator.css.js.map +1 -0
  54. package/dist-es/CarouselAutoplayIndicator.js +80 -0
  55. package/dist-es/CarouselAutoplayIndicator.js.map +1 -0
  56. package/dist-es/CarouselAutoplayIndicatorSVG.js +52 -0
  57. package/dist-es/CarouselAutoplayIndicatorSVG.js.map +1 -0
  58. package/dist-es/CarouselCard.css.js +4 -0
  59. package/dist-es/CarouselCard.css.js.map +1 -0
  60. package/dist-es/CarouselCard.js +48 -0
  61. package/dist-es/CarouselCard.js.map +1 -0
  62. package/dist-es/CarouselContext.js +19 -0
  63. package/dist-es/CarouselContext.js.map +1 -0
  64. package/dist-es/CarouselNextButton.js +33 -0
  65. package/dist-es/CarouselNextButton.js.map +1 -0
  66. package/dist-es/CarouselPreviousButton.js +33 -0
  67. package/dist-es/CarouselPreviousButton.js.map +1 -0
  68. package/dist-es/CarouselProgressLabel.css.js +4 -0
  69. package/dist-es/CarouselProgressLabel.css.js.map +1 -0
  70. package/dist-es/CarouselProgressLabel.js +63 -0
  71. package/dist-es/CarouselProgressLabel.js.map +1 -0
  72. package/dist-es/CarouselSlides.css.js +4 -0
  73. package/dist-es/CarouselSlides.css.js.map +1 -0
  74. package/dist-es/CarouselSlides.js +53 -0
  75. package/dist-es/CarouselSlides.js.map +1 -0
  76. package/dist-es/CarouselTab.css.js +4 -0
  77. package/dist-es/CarouselTab.css.js.map +1 -0
  78. package/dist-es/CarouselTab.js +68 -0
  79. package/dist-es/CarouselTab.js.map +1 -0
  80. package/dist-es/CarouselTabList.css.js +4 -0
  81. package/dist-es/CarouselTabList.css.js.map +1 -0
  82. package/dist-es/CarouselTabList.js +92 -0
  83. package/dist-es/CarouselTabList.js.map +1 -0
  84. package/dist-es/index.js +12 -0
  85. package/dist-es/index.js.map +1 -0
  86. package/dist-es/usePrevNextButtons.js +39 -0
  87. package/dist-es/usePrevNextButtons.js.map +1 -0
  88. package/dist-types/Carousel.d.ts +27 -0
  89. package/dist-types/CarouselAnnouncementPlugin.d.ts +34 -0
  90. package/dist-types/CarouselAutoplayIndicator.d.ts +16 -0
  91. package/dist-types/CarouselAutoplayIndicatorSVG.d.ts +24 -0
  92. package/dist-types/CarouselCard.d.ts +33 -0
  93. package/dist-types/CarouselContext.d.ts +20 -0
  94. package/dist-types/CarouselNextButton.d.ts +7 -0
  95. package/dist-types/CarouselPreviousButton.d.ts +7 -0
  96. package/dist-types/CarouselProgressLabel.d.ts +7 -0
  97. package/dist-types/CarouselSlides.d.ts +7 -0
  98. package/dist-types/CarouselTab.d.ts +34 -0
  99. package/dist-types/CarouselTabList.d.ts +12 -0
  100. package/dist-types/index.d.ts +11 -0
  101. package/dist-types/usePrevNextButtons.d.ts +20 -0
  102. package/package.json +54 -0
@@ -0,0 +1,53 @@
1
+ import { jsx } from 'react/jsx-runtime';
2
+ import { makePrefixer, useForkRef } from '@salt-ds/core';
3
+ import { useComponentCssInjection } from '@salt-ds/styles';
4
+ import { useWindow } from '@salt-ds/window';
5
+ import { clsx } from 'clsx';
6
+ import { forwardRef } from 'react';
7
+ import { useCarouselContext } from './CarouselContext.js';
8
+ import css_248z from './CarouselSlides.css.js';
9
+
10
+ const withBaseName = makePrefixer("saltCarouselSlides");
11
+ const CarouselSlides = forwardRef(
12
+ function CarouselSlides2({ children, className, onKeyDown, ...rest }, propRef) {
13
+ const targetWindow = useWindow();
14
+ useComponentCssInjection({
15
+ testId: "salt-carousel-slides",
16
+ css: css_248z,
17
+ window: targetWindow
18
+ });
19
+ const { emblaApi, emblaRef } = useCarouselContext();
20
+ const ref = useForkRef(propRef, emblaRef);
21
+ const handleKeyDown = (event) => {
22
+ if (event.repeat) {
23
+ return;
24
+ }
25
+ switch (event.key) {
26
+ case "ArrowLeft": {
27
+ event.preventDefault();
28
+ emblaApi == null ? void 0 : emblaApi.scrollPrev();
29
+ break;
30
+ }
31
+ case "ArrowRight": {
32
+ event.preventDefault();
33
+ emblaApi == null ? void 0 : emblaApi.scrollNext();
34
+ break;
35
+ }
36
+ }
37
+ onKeyDown == null ? void 0 : onKeyDown(event);
38
+ };
39
+ return /* @__PURE__ */ jsx(
40
+ "div",
41
+ {
42
+ onKeyDown: handleKeyDown,
43
+ ref,
44
+ className: clsx(withBaseName(), className),
45
+ ...rest,
46
+ children: /* @__PURE__ */ jsx("div", { className: withBaseName("container"), children })
47
+ }
48
+ );
49
+ }
50
+ );
51
+
52
+ export { CarouselSlides };
53
+ //# sourceMappingURL=CarouselSlides.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CarouselSlides.js","sources":["../src/CarouselSlides.tsx"],"sourcesContent":["import { makePrefixer, useForkRef } from \"@salt-ds/core\";\nimport { useComponentCssInjection } from \"@salt-ds/styles\";\nimport { useWindow } from \"@salt-ds/window\";\nimport { clsx } from \"clsx\";\nimport {\n type ComponentPropsWithoutRef,\n type KeyboardEvent,\n type Ref,\n forwardRef,\n} from \"react\";\nimport { useCarouselContext } from \"./CarouselContext\";\nimport carouselSlidesCss from \"./CarouselSlides.css\";\n\n/**\n * Props for the CarouselSlides component.\n */\nexport interface CarouselSlidesProps extends ComponentPropsWithoutRef<\"div\"> {}\n\nconst withBaseName = makePrefixer(\"saltCarouselSlides\");\n\nexport const CarouselSlides = forwardRef<HTMLDivElement, CarouselSlidesProps>(\n function CarouselSlides(\n { children, className, onKeyDown, ...rest },\n propRef,\n ) {\n const targetWindow = useWindow();\n useComponentCssInjection({\n testId: \"salt-carousel-slides\",\n css: carouselSlidesCss,\n window: targetWindow,\n });\n const { emblaApi, emblaRef } = useCarouselContext();\n\n const ref = useForkRef(propRef, emblaRef) as Ref<HTMLDivElement>;\n\n const handleKeyDown = (event: KeyboardEvent<HTMLDivElement>) => {\n if (event.repeat) {\n return;\n }\n switch (event.key) {\n case \"ArrowLeft\": {\n event.preventDefault();\n emblaApi?.scrollPrev();\n break;\n }\n case \"ArrowRight\": {\n event.preventDefault();\n emblaApi?.scrollNext();\n break;\n }\n }\n onKeyDown?.(event);\n };\n\n return (\n <div\n onKeyDown={handleKeyDown}\n ref={ref}\n className={clsx(withBaseName(), className)}\n {...rest}\n >\n <div className={withBaseName(\"container\")}>{children}</div>\n </div>\n );\n },\n);\n"],"names":["CarouselSlides","carouselSlidesCss"],"mappings":";;;;;;;;;AAkBA,MAAM,YAAA,GAAe,aAAa,oBAAoB,CAAA;AAE/C,MAAM,cAAiB,GAAA,UAAA;AAAA,EAC5B,SAASA,gBACP,EAAE,QAAA,EAAU,WAAW,SAAW,EAAA,GAAG,IAAK,EAAA,EAC1C,OACA,EAAA;AACA,IAAA,MAAM,eAAe,SAAU,EAAA;AAC/B,IAAyB,wBAAA,CAAA;AAAA,MACvB,MAAQ,EAAA,sBAAA;AAAA,MACR,GAAK,EAAAC,QAAA;AAAA,MACL,MAAQ,EAAA;AAAA,KACT,CAAA;AACD,IAAA,MAAM,EAAE,QAAA,EAAU,QAAS,EAAA,GAAI,kBAAmB,EAAA;AAElD,IAAM,MAAA,GAAA,GAAM,UAAW,CAAA,OAAA,EAAS,QAAQ,CAAA;AAExC,IAAM,MAAA,aAAA,GAAgB,CAAC,KAAyC,KAAA;AAC9D,MAAA,IAAI,MAAM,MAAQ,EAAA;AAChB,QAAA;AAAA;AAEF,MAAA,QAAQ,MAAM,GAAK;AAAA,QACjB,KAAK,WAAa,EAAA;AAChB,UAAA,KAAA,CAAM,cAAe,EAAA;AACrB,UAAU,QAAA,IAAA,IAAA,GAAA,MAAA,GAAA,QAAA,CAAA,UAAA,EAAA;AACV,UAAA;AAAA;AACF,QACA,KAAK,YAAc,EAAA;AACjB,UAAA,KAAA,CAAM,cAAe,EAAA;AACrB,UAAU,QAAA,IAAA,IAAA,GAAA,MAAA,GAAA,QAAA,CAAA,UAAA,EAAA;AACV,UAAA;AAAA;AACF;AAEF,MAAY,SAAA,IAAA,IAAA,GAAA,MAAA,GAAA,SAAA,CAAA,KAAA,CAAA;AAAA,KACd;AAEA,IACE,uBAAA,GAAA;AAAA,MAAC,KAAA;AAAA,MAAA;AAAA,QACC,SAAW,EAAA,aAAA;AAAA,QACX,GAAA;AAAA,QACA,SAAW,EAAA,IAAA,CAAK,YAAa,EAAA,EAAG,SAAS,CAAA;AAAA,QACxC,GAAG,IAAA;AAAA,QAEJ,8BAAC,KAAI,EAAA,EAAA,SAAA,EAAW,YAAa,CAAA,WAAW,GAAI,QAAS,EAAA;AAAA;AAAA,KACvD;AAAA;AAGN;;;;"}
@@ -0,0 +1,4 @@
1
+ var css_248z = ".saltCarouselTab {\n position: relative;\n width: var(--salt-size-selectable);\n height: var(--salt-size-selectable);\n border: none;\n box-shadow: inset 0 0 0 var(--salt-size-border) var(--salt-selectable-borderColor);\n -webkit-tap-highlight-color: var(--salt-selectable-borderColor-hover);\n -webkit-appearance: none;\n appearance: none;\n background-color: transparent;\n touch-action: manipulation;\n display: inline-flex;\n text-decoration: none;\n cursor: pointer;\n padding: 0;\n margin: 0;\n align-items: center;\n justify-content: center;\n border-radius: var(--salt-palette-corner-strongest);\n transition: box-shadow var(--salt-duration-perceptible) ease-in-out;\n}\n\n.saltCarouselTab:after {\n content: \"\";\n position: absolute;\n width: var(--salt-size-selectable);\n height: var(--salt-size-selectable);\n border-radius: 50%;\n background-color: transparent;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n}\n\n.saltCarouselTab:focus-visible {\n outline-style: var(--salt-focused-outlineStyle);\n outline-width: var(--salt-focused-outlineWidth);\n outline-color: var(--salt-focused-outlineColor);\n outline-offset: var(--salt-focused-outlineOffset);\n background: var(--salt-selectable-background-hover);\n border-color: var(--salt-selectable-borderColor-hover);\n}\n\n.saltCarouselTab-selected {\n box-shadow: inset 0 0 0 var(--salt-size-selectable) var(--salt-selectable-borderColor-selected);\n}\n";
2
+
3
+ export { css_248z as default };
4
+ //# sourceMappingURL=CarouselTab.css.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CarouselTab.css.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;"}
@@ -0,0 +1,68 @@
1
+ import { jsx } from 'react/jsx-runtime';
2
+ import { makePrefixer } from '@salt-ds/core';
3
+ import { useComponentCssInjection } from '@salt-ds/styles';
4
+ import { useWindow } from '@salt-ds/window';
5
+ import { clsx } from 'clsx';
6
+ import { forwardRef, useState, useCallback, useEffect } from 'react';
7
+ import css_248z from './CarouselTab.css.js';
8
+
9
+ const withBaseName = makePrefixer("saltCarouselTab");
10
+ const useCarouselTab = (emblaApi) => {
11
+ const [selectedIndex, setSelectedIndex] = useState(0);
12
+ const [scrollSnaps, setScrollSnaps] = useState([]);
13
+ const handleClick = useCallback(
14
+ (index) => {
15
+ if (!emblaApi) return;
16
+ emblaApi.scrollTo(index);
17
+ },
18
+ [emblaApi]
19
+ );
20
+ const handleInit = useCallback((emblaApi2) => {
21
+ setScrollSnaps(emblaApi2.scrollSnapList());
22
+ }, []);
23
+ const handleSelect = useCallback((emblaApi2) => {
24
+ setSelectedIndex(emblaApi2.selectedScrollSnap());
25
+ }, []);
26
+ useEffect(() => {
27
+ if (!emblaApi) return;
28
+ handleInit(emblaApi);
29
+ handleSelect(emblaApi);
30
+ emblaApi.on("init", handleInit).on("reInit", handleInit).on("select", handleSelect);
31
+ return () => {
32
+ emblaApi.off("init", handleInit);
33
+ emblaApi.off("reInit", handleInit);
34
+ emblaApi.off("settle", handleSelect);
35
+ };
36
+ }, [emblaApi, handleInit, handleSelect]);
37
+ return {
38
+ selectedIndex,
39
+ scrollSnaps,
40
+ onClick: handleClick
41
+ };
42
+ };
43
+ const CarouselTab = forwardRef(
44
+ function CarouselTab2({ children, className, selected = false, ...rest }, ref) {
45
+ const targetWindow = useWindow();
46
+ useComponentCssInjection({
47
+ testId: "salt-carousel-tab",
48
+ css: css_248z,
49
+ window: targetWindow
50
+ });
51
+ return /* @__PURE__ */ jsx(
52
+ "button",
53
+ {
54
+ className: clsx(
55
+ withBaseName(),
56
+ { [withBaseName("selected")]: selected },
57
+ className
58
+ ),
59
+ ref,
60
+ ...rest,
61
+ children
62
+ }
63
+ );
64
+ }
65
+ );
66
+
67
+ export { CarouselTab, useCarouselTab };
68
+ //# sourceMappingURL=CarouselTab.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CarouselTab.js","sources":["../src/CarouselTab.tsx"],"sourcesContent":["import { makePrefixer } from \"@salt-ds/core\";\nimport { useComponentCssInjection } from \"@salt-ds/styles\";\nimport { useWindow } from \"@salt-ds/window\";\nimport { clsx } from \"clsx\";\nimport type { EmblaCarouselType } from \"embla-carousel\";\nimport {\n type ComponentPropsWithRef,\n forwardRef,\n useCallback,\n useEffect,\n useState,\n} from \"react\";\nimport carouselTabCss from \"./CarouselTab.css\";\n\n/**\n * Type definition for the UseCarouselTab hook.\n * Provides state and handlers for tablist navigation in a carousel.\n */\ntype UseCarouselTabProps = {\n /**\n * The index of the currently selected slide.\n */\n selectedIndex: number;\n\n /**\n * An array of scroll snap positions for the carousel slides.\n */\n scrollSnaps: number[];\n\n /**\n * Handler function for clicking a tab button to navigate to a specific slide.\n *\n * @param index - The index of the slide to navigate to.\n */\n onClick: (index: number) => void;\n};\n\nconst withBaseName = makePrefixer(\"saltCarouselTab\");\n\nexport const useCarouselTab = (\n emblaApi: EmblaCarouselType | undefined,\n): UseCarouselTabProps => {\n const [selectedIndex, setSelectedIndex] = useState(0);\n const [scrollSnaps, setScrollSnaps] = useState<number[]>([]);\n\n const handleClick = useCallback(\n (index: number) => {\n if (!emblaApi) return;\n emblaApi.scrollTo(index);\n },\n [emblaApi],\n );\n\n const handleInit = useCallback((emblaApi: EmblaCarouselType) => {\n setScrollSnaps(emblaApi.scrollSnapList());\n }, []);\n\n const handleSelect = useCallback((emblaApi: EmblaCarouselType) => {\n setSelectedIndex(emblaApi.selectedScrollSnap());\n }, []);\n\n useEffect(() => {\n if (!emblaApi) return;\n\n handleInit(emblaApi);\n handleSelect(emblaApi);\n emblaApi\n .on(\"init\", handleInit)\n .on(\"reInit\", handleInit)\n .on(\"select\", handleSelect);\n // Cleanup listener on component unmount\n return () => {\n emblaApi.off(\"init\", handleInit);\n emblaApi.off(\"reInit\", handleInit);\n emblaApi.off(\"settle\", handleSelect);\n };\n }, [emblaApi, handleInit, handleSelect]);\n\n return {\n selectedIndex,\n scrollSnaps,\n onClick: handleClick,\n };\n};\n\n/**\n * Props for the CarouselTab component.\n */\nexport interface CarouselTabProps extends ComponentPropsWithRef<\"button\"> {\n /**\n * Is the selected slide\n */\n selected?: boolean;\n}\n\nexport const CarouselTab = forwardRef<HTMLButtonElement, CarouselTabProps>(\n function CarouselTab(\n { children, className, selected = false, ...rest },\n ref,\n ) {\n const targetWindow = useWindow();\n useComponentCssInjection({\n testId: \"salt-carousel-tab\",\n css: carouselTabCss,\n window: targetWindow,\n });\n\n return (\n <button\n className={clsx(\n withBaseName(),\n { [withBaseName(\"selected\")]: selected },\n className,\n )}\n ref={ref}\n {...rest}\n >\n {children}\n </button>\n );\n },\n);\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AI,UAAU,YAAY,CAAA;AAAA,KACrC;AAAA,GACC,EAAA,CAAC,QAAU,EAAA,UAAA,EAAY,YAAY,CAAC,CAAA;AAEvC,EAAO,OAAA;AAAA,IACL,aAAA;AAAA,IACA,WAAA;AAAA,IACA,OAAS,EAAA;AAAA,GACX;AACF;AAYO,MAAM,WAAc,GAAA,UAAA;AAAA,EACzB,SAASC,YACP,CAAA,EAAE,QAAU,EAAA,SAAA,EAAW,WAAW,KAAO,EAAA,GAAG,IAAK,EAAA,EACjD,GACA,EAAA;AACA,IAAA,MAAM,eAAe,SAAU,EAAA;AAC/B,IAAyB,wBAAA,CAAA;AAAA,MACvB,MAAQ,EAAA,mBAAA;AAAA,MACR,GAAK,EAAAC,QAAA;AAAA,MACL,MAAQ,EAAA;AAAA,KACT,CAAA;AAED,IACE,uBAAA,GAAA;AAAA,MAAC,QAAA;AAAA,MAAA;AAAA,QACC,SAAW,EAAA,IAAA;AAAA,UACT,YAAa,EAAA;AAAA,UACb,EAAE,CAAC,YAAA,CAAa,UAAU,CAAC,GAAG,QAAS,EAAA;AAAA,UACvC;AAAA,SACF;AAAA,QACA,GAAA;AAAA,QACC,GAAG,IAAA;AAAA,QAEH;AAAA;AAAA,KACH;AAAA;AAGN;;;;"}
@@ -0,0 +1,4 @@
1
+ var css_248z = ".saltCarouselTabList {\n display: flex;\n flex-wrap: wrap;\n justify-content: flex-end;\n align-items: center;\n gap: var(--salt-spacing-200);\n}\n\n.saltCarouselTabList:focus-visible {\n outline-style: var(--salt-focused-outlineStyle);\n outline-width: var(--salt-focused-outlineWidth);\n outline-offset: var(--salt-focused-outlineOffset);\n outline-color: var(--salt-focused-outlineColor);\n}\n";
2
+
3
+ export { css_248z as default };
4
+ //# sourceMappingURL=CarouselTabList.css.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CarouselTabList.css.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;"}
@@ -0,0 +1,92 @@
1
+ import { jsx } from 'react/jsx-runtime';
2
+ import { makePrefixer, renderProps } from '@salt-ds/core';
3
+ import { useComponentCssInjection } from '@salt-ds/styles';
4
+ import { useWindow } from '@salt-ds/window';
5
+ import { clsx } from 'clsx';
6
+ import { forwardRef, useRef } from 'react';
7
+ import { useCarouselContext } from './CarouselContext.js';
8
+ import { CarouselTab, useCarouselTab } from './CarouselTab.js';
9
+ import css_248z from './CarouselTabList.css.js';
10
+
11
+ const withBaseName = makePrefixer("saltCarouselTabList");
12
+ const CarouselTabRenderer = forwardRef((props, ref) => {
13
+ return renderProps(CarouselTab, { ...props, ref });
14
+ });
15
+ const CarouselTabList = forwardRef(
16
+ function CarouselTabList2({ className, render, onKeyDown, ...rest }, ref) {
17
+ const targetWindow = useWindow();
18
+ useComponentCssInjection({
19
+ testId: "salt-carousel-controls",
20
+ css: css_248z,
21
+ window: targetWindow
22
+ });
23
+ const { emblaApi } = useCarouselContext();
24
+ const { selectedIndex, scrollSnaps, onClick } = useCarouselTab(emblaApi);
25
+ const slideNodes = emblaApi == null ? void 0 : emblaApi.slideNodes();
26
+ const numberOfSlides = (slideNodes == null ? void 0 : slideNodes.length) ?? 0;
27
+ const slidesPerTransition = numberOfSlides ? Math.ceil(numberOfSlides / scrollSnaps.length) : 0;
28
+ const buttonRefs = useRef([]);
29
+ const handleKeyDown = (event) => {
30
+ var _a;
31
+ let newIndex = selectedIndex;
32
+ if (event.key === "ArrowLeft" || event.key === "ArrowRight") {
33
+ const direction = event.key === "ArrowLeft" ? -1 : 1;
34
+ newIndex = (selectedIndex + direction + scrollSnaps.length) % scrollSnaps.length;
35
+ } else if (event.key === "Home") {
36
+ newIndex = 0;
37
+ } else if (event.key === "End") {
38
+ newIndex = scrollSnaps.length - 1;
39
+ }
40
+ if (newIndex !== selectedIndex) {
41
+ onClick(newIndex);
42
+ (_a = buttonRefs.current[newIndex]) == null ? void 0 : _a.focus();
43
+ event.preventDefault();
44
+ event.stopPropagation();
45
+ }
46
+ onKeyDown == null ? void 0 : onKeyDown(event);
47
+ };
48
+ return /* @__PURE__ */ jsx(
49
+ "div",
50
+ {
51
+ role: "tablist",
52
+ "aria-label": "Choose slide",
53
+ tabIndex: 0,
54
+ className: clsx(withBaseName(), className),
55
+ onKeyDown: handleKeyDown,
56
+ ref,
57
+ ...rest,
58
+ children: scrollSnaps.map((_, tabIndex) => {
59
+ const startSlideNumber = tabIndex * slidesPerTransition + 1;
60
+ const endSlideNumber = Math.min(
61
+ startSlideNumber + slidesPerTransition - 1,
62
+ numberOfSlides
63
+ );
64
+ const label = startSlideNumber === endSlideNumber ? `Slide ${startSlideNumber}` : `Slides ${startSlideNumber}-${endSlideNumber} of ${numberOfSlides}`;
65
+ const selected = selectedIndex === tabIndex;
66
+ const ariaControls = (slideNodes == null ? void 0 : slideNodes.length) ? slideNodes[startSlideNumber - 1].id : void 0;
67
+ return /* @__PURE__ */ jsx(
68
+ CarouselTabRenderer,
69
+ {
70
+ ref: (element) => {
71
+ buttonRefs.current[tabIndex] = element;
72
+ },
73
+ render,
74
+ role: "tab",
75
+ onClick: () => onClick(tabIndex),
76
+ "aria-selected": selected,
77
+ selected,
78
+ tabIndex: selected ? 0 : -1,
79
+ "aria-label": label,
80
+ "aria-labelledby": ariaControls,
81
+ "aria-controls": ariaControls
82
+ },
83
+ `carouselTab-${tabIndex}}`
84
+ );
85
+ })
86
+ }
87
+ );
88
+ }
89
+ );
90
+
91
+ export { CarouselTabList };
92
+ //# sourceMappingURL=CarouselTabList.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CarouselTabList.js","sources":["../src/CarouselTabList.tsx"],"sourcesContent":["import { type RenderPropsType, makePrefixer, renderProps } from \"@salt-ds/core\";\nimport { useComponentCssInjection } from \"@salt-ds/styles\";\nimport { useWindow } from \"@salt-ds/window\";\nimport { clsx } from \"clsx\";\nimport { type HTMLAttributes, forwardRef, useRef } from \"react\";\nimport { useCarouselContext } from \"./CarouselContext\";\nimport {\n CarouselTab,\n type CarouselTabProps,\n useCarouselTab,\n} from \"./CarouselTab\";\nimport carouselControlsCss from \"./CarouselTabList.css\";\n\nconst withBaseName = makePrefixer(\"saltCarouselTabList\");\n\n/**\n * Props for the CarouselTabList component.\n */\nexport interface CarouselTabListProps extends HTMLAttributes<HTMLDivElement> {\n /**\n * Render prop to enable customisation of tab button.\n */\n render?: RenderPropsType[\"render\"];\n}\n\nconst CarouselTabRenderer = forwardRef<\n HTMLButtonElement,\n CarouselTabProps & { render?: CarouselTabListProps[\"render\"] }\n>((props, ref) => {\n return renderProps(CarouselTab, { ...props, ref });\n});\n\nexport const CarouselTabList = forwardRef<HTMLDivElement, CarouselTabListProps>(\n function CarouselTabList({ className, render, onKeyDown, ...rest }, ref) {\n const targetWindow = useWindow();\n useComponentCssInjection({\n testId: \"salt-carousel-controls\",\n css: carouselControlsCss,\n window: targetWindow,\n });\n\n const { emblaApi } = useCarouselContext();\n const { selectedIndex, scrollSnaps, onClick } = useCarouselTab(emblaApi);\n\n const slideNodes = emblaApi?.slideNodes();\n const numberOfSlides = slideNodes?.length ?? 0;\n const slidesPerTransition = numberOfSlides\n ? Math.ceil(numberOfSlides / scrollSnaps.length)\n : 0;\n\n const buttonRefs = useRef<(HTMLButtonElement | null)[]>([]);\n\n const handleKeyDown: React.KeyboardEventHandler<HTMLDivElement> = (\n event,\n ) => {\n let newIndex = selectedIndex;\n\n if (event.key === \"ArrowLeft\" || event.key === \"ArrowRight\") {\n const direction = event.key === \"ArrowLeft\" ? -1 : 1;\n newIndex =\n (selectedIndex + direction + scrollSnaps.length) % scrollSnaps.length;\n } else if (event.key === \"Home\") {\n newIndex = 0;\n } else if (event.key === \"End\") {\n newIndex = scrollSnaps.length - 1;\n }\n\n if (newIndex !== selectedIndex) {\n onClick(newIndex);\n buttonRefs.current[newIndex]?.focus();\n event.preventDefault();\n event.stopPropagation();\n }\n onKeyDown?.(event);\n };\n\n return (\n <div\n role=\"tablist\"\n aria-label=\"Choose slide\"\n tabIndex={0}\n className={clsx(withBaseName(), className)}\n onKeyDown={handleKeyDown}\n ref={ref}\n {...rest}\n >\n {scrollSnaps.map((_, tabIndex) => {\n const startSlideNumber = tabIndex * slidesPerTransition + 1;\n const endSlideNumber = Math.min(\n startSlideNumber + slidesPerTransition - 1,\n numberOfSlides,\n );\n const label =\n startSlideNumber === endSlideNumber\n ? `Slide ${startSlideNumber}`\n : `Slides ${startSlideNumber}-${endSlideNumber} of ${numberOfSlides}`;\n\n const selected = selectedIndex === tabIndex;\n\n const ariaControls = slideNodes?.length\n ? slideNodes[startSlideNumber - 1].id\n : undefined;\n return (\n <CarouselTabRenderer\n key={`carouselTab-${tabIndex}}`}\n ref={(element: HTMLButtonElement) => {\n buttonRefs.current[tabIndex] = element;\n }}\n render={render}\n role={\"tab\"}\n onClick={() => onClick(tabIndex)}\n aria-selected={selected}\n selected={selected}\n tabIndex={selected ? 0 : -1}\n aria-label={label}\n aria-labelledby={ariaControls}\n aria-controls={ariaControls}\n />\n );\n })}\n </div>\n );\n },\n);\n"],"names":["CarouselTabList","carouselControlsCss"],"mappings":";;;;;;;;;;AAaA,MAAM,YAAA,GAAe,aAAa,qBAAqB,CAAA;AAYvD,MAAM,mBAAsB,GAAA,UAAA,CAG1B,CAAC,KAAA,EAAO,GAAQ,KAAA;AAChB,EAAA,OAAO,YAAY,WAAa,EAAA,EAAE,GAAG,KAAA,EAAO,KAAK,CAAA;AACnD,CAAC,CAAA;AAEM,MAAM,eAAkB,GAAA,UAAA;AAAA,EAC7B,SAASA,iBAAgB,EAAE,SAAA,EAAW,QAAQ,SAAW,EAAA,GAAG,IAAK,EAAA,EAAG,GAAK,EAAA;AACvE,IAAA,MAAM,eAAe,SAAU,EAAA;AAC/B,IAAyB,wBAAA,CAAA;AAAA,MACvB,MAAQ,EAAA,wBAAA;AAAA,MACR,GAAK,EAAAC,QAAA;AAAA,MACL,MAAQ,EAAA;AAAA,KACT,CAAA;AAED,IAAM,MAAA,EAAE,QAAS,EAAA,GAAI,kBAAmB,EAAA;AACxC,IAAA,MAAM,EAAE,aAAe,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AAM,OAAA,CAAQ,QAAQ,CAAA;AAAA,cAC/B,eAAe,EAAA,QAAA;AAAA,cACf,QAAA;AAAA,cACA,QAAA,EAAU,WAAW,CAAI,GAAA,EAAA;AAAA,cACzB,YAAY,EAAA,KAAA;AAAA,cACZ,iBAAiB,EAAA,YAAA;AAAA,cACjB,eAAe,EAAA;AAAA,aAAA;AAAA,YAZV,eAAe,QAAQ,CAAA,CAAA;AAAA,WAa9B;AAAA,SAEH;AAAA;AAAA,KACH;AAAA;AAGN;;;;"}
@@ -0,0 +1,12 @@
1
+ export { Carousel } from './Carousel.js';
2
+ export { CarouselAnnouncement, getSlideLabel } from './CarouselAnnouncementPlugin.js';
3
+ export { CarouselCard } from './CarouselCard.js';
4
+ export { CarouselContext, useCarouselContext } from './CarouselContext.js';
5
+ export { CarouselTab, useCarouselTab } from './CarouselTab.js';
6
+ export { CarouselTabList } from './CarouselTabList.js';
7
+ export { CarouselAutoplayIndicator } from './CarouselAutoplayIndicator.js';
8
+ export { CarouselPreviousButton } from './CarouselPreviousButton.js';
9
+ export { CarouselNextButton } from './CarouselNextButton.js';
10
+ export { CarouselSlides } from './CarouselSlides.js';
11
+ export { CarouselProgressLabel } from './CarouselProgressLabel.js';
12
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;"}
@@ -0,0 +1,39 @@
1
+ import { useState, useCallback, useEffect } from 'react';
2
+ import { useCarouselContext } from './CarouselContext.js';
3
+
4
+ const usePrevNextButtons = () => {
5
+ const [prevBtnDisabled, setPrevBtnDisabled] = useState(true);
6
+ const [nextBtnDisabled, setNextBtnDisabled] = useState(true);
7
+ const { emblaApi } = useCarouselContext();
8
+ const handlePrevButtonClick = useCallback(() => {
9
+ if (!emblaApi) return;
10
+ emblaApi.scrollPrev();
11
+ }, [emblaApi]);
12
+ const handleNextButtonClick = useCallback(() => {
13
+ if (!emblaApi) return;
14
+ emblaApi.scrollNext();
15
+ }, [emblaApi]);
16
+ const handleSelect = useCallback((emblaApi2) => {
17
+ setPrevBtnDisabled(!emblaApi2.canScrollPrev());
18
+ setNextBtnDisabled(!emblaApi2.canScrollNext());
19
+ }, []);
20
+ useEffect(() => {
21
+ if (!emblaApi) {
22
+ return;
23
+ }
24
+ handleSelect(emblaApi);
25
+ emblaApi.on("init", handleSelect).on("reInit", handleSelect).on("select", handleSelect);
26
+ return () => {
27
+ emblaApi.off("init", handleSelect).off("reInit", handleSelect).off("select", handleSelect);
28
+ };
29
+ }, [emblaApi, handleSelect]);
30
+ return {
31
+ prevBtnDisabled,
32
+ nextBtnDisabled,
33
+ onPrevButtonClick: handlePrevButtonClick,
34
+ onNextButtonClick: handleNextButtonClick
35
+ };
36
+ };
37
+
38
+ export { usePrevNextButtons };
39
+ //# sourceMappingURL=usePrevNextButtons.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"usePrevNextButtons.js","sources":["../src/usePrevNextButtons.tsx"],"sourcesContent":["import type { EmblaCarouselType } from \"embla-carousel\";\nimport { useCallback, useEffect, useState } from \"react\";\nimport { useCarouselContext } from \"./CarouselContext\";\n\ntype UsePrevNextButtonsType = {\n /**\n * Indicates whether the previous button is disabled.\n */\n prevBtnDisabled: boolean;\n /**\n * Indicates whether the next button is disabled.\n */\n nextBtnDisabled: boolean;\n /**\n * Handles the click event for the previous button.\n */\n onPrevButtonClick: () => void;\n /**\n * Handles the click event for the next button.\n */\n onNextButtonClick: () => void;\n};\n\nexport const usePrevNextButtons = (): UsePrevNextButtonsType => {\n const [prevBtnDisabled, setPrevBtnDisabled] = useState(true);\n const [nextBtnDisabled, setNextBtnDisabled] = useState(true);\n\n const { emblaApi } = useCarouselContext();\n\n const handlePrevButtonClick = useCallback(() => {\n if (!emblaApi) return;\n emblaApi.scrollPrev();\n }, [emblaApi]);\n\n const handleNextButtonClick = useCallback(() => {\n if (!emblaApi) return;\n emblaApi.scrollNext();\n }, [emblaApi]);\n\n const handleSelect = useCallback((emblaApi: EmblaCarouselType) => {\n setPrevBtnDisabled(!emblaApi.canScrollPrev());\n setNextBtnDisabled(!emblaApi.canScrollNext());\n }, []);\n\n useEffect(() => {\n if (!emblaApi) {\n return;\n }\n handleSelect(emblaApi);\n emblaApi\n .on(\"init\", handleSelect)\n .on(\"reInit\", handleSelect)\n .on(\"select\", handleSelect);\n // Cleanup listener on component unmount\n return () => {\n emblaApi\n .off(\"init\", handleSelect)\n .off(\"reInit\", handleSelect)\n .off(\"select\", handleSelect);\n };\n }, [emblaApi, handleSelect]);\n\n return {\n prevBtnDisabled,\n nextBtnDisabled,\n onPrevButtonClick: handlePrevButtonClick,\n onNextButtonClick: handleNextButtonClick,\n };\n};\n"],"names":["emblaApi"],"mappings":";;;AAuBO,MAAM,qBAAqB,MAA8B;AAC9D,EAAA,MAAM,CAAC,eAAA,EAAiB,kBAAkB,CAAA,GAAI,SAAS,IAAI,CAAA;AAC3D,EAAA,MAAM,CAAC,eAAA,EAAiB,kBAAkB,CAAA,GAAI,SAAS,IAAI,CAAA;AAE3D,EAAM,MAAA,EAAE,QAAS,EAAA,GAAI,kBAAmB,EAAA;AAExC,EAAM,MAAA,qBAAA,GAAwB,YAAY,MAAM;AAC9C,IAAA,IAAI,CAAC,QAAU,EAAA;AACf,IAAA,QAAA,CAAS,UAAW,EAAA;AAAA,GACtB,EAAG,CAAC,QAAQ,CAAC,CAAA;AAEb,EAAM,MAAA,qBAAA,GAAwB,YAAY,MAAM;AAC9C,IAAA,IAAI,CAAC,QAAU,EAAA;AACf,IAAA,QAAA,CAAS,UAAW,EAAA;AAAA,GACtB,EAAG,CAAC,QAAQ,CAAC,CAAA;AAEb,EAAM,MAAA,YAAA,GAAe,WAAY,CAAA,CAACA,SAAgC,KAAA;AAChE,IAAmB,kBAAA,CAAA,CAACA,SAAS,CAAA,aAAA,EAAe,CAAA;AAC5C,IAAmB,kBAAA,CAAA,CAACA,SAAS,CAAA,aAAA,EAAe,CAAA;AAAA,GAC9C,EAAG,EAAE,CAAA;AAEL,EAAA,SAAA,CAAU,MAAM;AACd,IAAA,IAAI,CAAC,QAAU,EAAA;AACb,MAAA;AAAA;AAEF,IAAA,YAAA,CAAa,QAAQ,CAAA;AACrB,IACG,QAAA,CAAA,EAAA,CAAG,MAAQ,EAAA,YAAY,CACvB,CAAA,EAAA,CAAG,UAAU,YAAY,CAAA,CACzB,EAAG,CAAA,QAAA,EAAU,YAAY,CAAA;AAE5B,IAAA,OAAO,MAAM;AACX,MACG,QAAA,CAAA,GAAA,CAAI,MAAQ,EAAA,YAAY,CACxB,CAAA,GAAA,CAAI,UAAU,YAAY,CAAA,CAC1B,GAAI,CAAA,QAAA,EAAU,YAAY,CAAA;AAAA,KAC/B;AAAA,GACC,EAAA,CAAC,QAAU,EAAA,YAAY,CAAC,CAAA;AAE3B,EAAO,OAAA;AAAA,IACL,eAAA;AAAA,IACA,eAAA;AAAA,IACA,iBAAmB,EAAA,qBAAA;AAAA,IACnB,iBAAmB,EAAA;AAAA,GACrB;AACF;;;;"}
@@ -0,0 +1,27 @@
1
+ import useEmblaCarousel, { type UseEmblaCarouselType } from "embla-carousel-react";
2
+ import { type ComponentPropsWithoutRef } from "react";
3
+ export type CarouselEmblaRefType = UseEmblaCarouselType[0];
4
+ export type CarouselEmblaApiType = UseEmblaCarouselType[1];
5
+ type UseCarouselParameters = Parameters<typeof useEmblaCarousel>;
6
+ export type CarouselOptions = UseCarouselParameters[0];
7
+ export type CarouselPlugin = UseCarouselParameters[1];
8
+ /**
9
+ * Props for the Carousel component.
10
+ * Pass a ref to the carousel to get it to return a reference to the embla API
11
+ */
12
+ export interface CarouselProps extends ComponentPropsWithoutRef<"section"> {
13
+ /**
14
+ * Options to configure the Embla Carousel.
15
+ * These options are passed directly to the Embla Carousel instance.
16
+ */
17
+ emblaOptions?: CarouselOptions;
18
+ /**
19
+ * Plugins to enhance the functionality of the Embla Carousel.
20
+ * These options are passed directly to the Embla Carousel instance.
21
+ */
22
+ emblaPlugins?: CarouselPlugin;
23
+ /** Get embla API as ref, use this to manage the state of the Carousel */
24
+ getEmblaApi?: (embla: CarouselEmblaApiType) => void;
25
+ }
26
+ export declare const Carousel: import("react").ForwardRefExoticComponent<CarouselProps & import("react").RefAttributes<HTMLElement>>;
27
+ export {};
@@ -0,0 +1,34 @@
1
+ import type { CreateOptionsType, CreatePluginType } from "embla-carousel";
2
+ declare module "embla-carousel" {
3
+ interface EmblaPluginsType {
4
+ announcement: CarouselAnnouncementType;
5
+ }
6
+ }
7
+ /**
8
+ * Type definition for the parameters of the getSlideLabel function.
9
+ */
10
+ export type GetSlideLabelProps = (
11
+ /**
12
+ * The HTML element representing the slide.
13
+ */
14
+ slideElement: HTMLElement,
15
+ /**
16
+ * The index of the slide within the carousel.
17
+ */
18
+ slideIndex: number,
19
+ /**
20
+ * The total number of slides in the carousel.
21
+ */
22
+ slideCount: number) => string;
23
+ /**
24
+ * Generates a label for a carousel slide based on ARIA attributes.
25
+ *
26
+ * @param props - The properties required to generate the slide description.
27
+ * @returns A string description of the slide, including its position and ARIA label or text content.
28
+ */
29
+ export declare const getSlideLabel: GetSlideLabelProps;
30
+ type OptionsType = CreateOptionsType<{}>;
31
+ export type CarouselAnnouncementType = CreatePluginType<{}, OptionsType>;
32
+ export type CarouselAnnouncementOptionsType = CarouselAnnouncementType["options"];
33
+ export declare function CarouselAnnouncement(userOptions?: CarouselAnnouncementOptionsType): CarouselAnnouncementType;
34
+ export {};
@@ -0,0 +1,16 @@
1
+ import { type ComponentPropsWithoutRef } from "react";
2
+ export interface CarouselAutoplayIndicatorProps extends ComponentPropsWithoutRef<"div"> {
3
+ /**
4
+ * Duration of each slide in milliseconds.
5
+ */
6
+ duration: number;
7
+ /**
8
+ * Index of slide currently displayed.
9
+ */
10
+ slideIndex: number;
11
+ /**
12
+ * If `true`, the indicator is animated to visualize the time until the next slide.
13
+ */
14
+ isPlaying: boolean;
15
+ }
16
+ export declare const CarouselAutoplayIndicator: import("react").ForwardRefExoticComponent<CarouselAutoplayIndicatorProps & import("react").RefAttributes<HTMLDivElement>>;
@@ -0,0 +1,24 @@
1
+ import { type SVGAttributes } from "react";
2
+ export interface CarouselAutoplayIndicatorSVGProps extends SVGAttributes<SVGSVGElement> {
3
+ /**
4
+ * Class name to apply to the SVG element.
5
+ */
6
+ className?: string;
7
+ /**
8
+ * Ref to attach to progress indicator element
9
+ */
10
+ barRef: React.Ref<SVGCircleElement>;
11
+ /**
12
+ * Size of the SVG in pixels.
13
+ */
14
+ size: number;
15
+ /**
16
+ * Stroke width of the progress indicator in pixels.
17
+ */
18
+ strokeWidth: number;
19
+ /**
20
+ * Radius of the progress indicator circle.
21
+ */
22
+ radius: number;
23
+ }
24
+ export declare const CarouselAutoplayIndicatorSVG: import("react").ForwardRefExoticComponent<CarouselAutoplayIndicatorSVGProps & import("react").RefAttributes<SVGSVGElement>>;
@@ -0,0 +1,33 @@
1
+ import { type ComponentProps, type ReactNode } from "react";
2
+ /**
3
+ * Props for the CarouselCard component.
4
+ */
5
+ export interface CarouselCardProps extends ComponentProps<"div"> {
6
+ /**
7
+ * Actions to be displayed in the content footer.
8
+ * This can include buttons or any other interactive elements.
9
+ */
10
+ actions?: ReactNode;
11
+ /**
12
+ * Media content to be displayed inside the slide.
13
+ * This could include images, videos, etc., that are visually prominent.
14
+ * It differs from children in that media is intended to be the main visual element of the slide.
15
+ */
16
+ media?: ReactNode;
17
+ /**
18
+ * The appearance of the slide. Options are 'bordered', and 'transparent'.
19
+ * 'transparent' is the default value.
20
+ **/
21
+ appearance?: "bordered" | "transparent";
22
+ /**
23
+ * Header content to be displayed at the top of the slide.
24
+ * This can be text or any other React node.
25
+ */
26
+ header?: ReactNode;
27
+ /**
28
+ * Carousel slide id.
29
+ * This can be used to uniquely identify the slide.
30
+ */
31
+ id?: string;
32
+ }
33
+ export declare const CarouselCard: import("react").ForwardRefExoticComponent<Omit<CarouselCardProps, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
@@ -0,0 +1,20 @@
1
+ import type { CarouselEmblaApiType, CarouselEmblaRefType } from "./Carousel";
2
+ /**
3
+ * Type definition for the Carousel context.
4
+ * Provides access to the Embla Carousel API and reference.
5
+ */
6
+ interface CarouselContextType {
7
+ /**
8
+ * The API instance of the Embla Carousel.
9
+ * Provides methods to control the carousel programmatically.
10
+ */
11
+ emblaApi?: CarouselEmblaApiType;
12
+ /**
13
+ * The reference to the Embla Carousel viewport.
14
+ * Used to directly interact with the carousel DOM element.
15
+ */
16
+ emblaRef?: CarouselEmblaRefType;
17
+ }
18
+ export declare const CarouselContext: import("react").Context<CarouselContextType | undefined>;
19
+ export declare const useCarouselContext: () => CarouselContextType;
20
+ export {};
@@ -0,0 +1,7 @@
1
+ import { type ButtonProps } from "@salt-ds/core";
2
+ /**
3
+ * Props for the CarouselNextButton component.
4
+ */
5
+ export interface CarouselNextButtonProps extends ButtonProps {
6
+ }
7
+ export declare const CarouselNextButton: import("react").ForwardRefExoticComponent<CarouselNextButtonProps & import("react").RefAttributes<HTMLButtonElement>>;
@@ -0,0 +1,7 @@
1
+ import { type ButtonProps } from "@salt-ds/core";
2
+ /**
3
+ * Props for the CarouselPreviousButton component.
4
+ */
5
+ export interface CarouselPreviousButtonProps extends ButtonProps {
6
+ }
7
+ export declare const CarouselPreviousButton: import("react").ForwardRefExoticComponent<CarouselPreviousButtonProps & import("react").RefAttributes<HTMLButtonElement>>;
@@ -0,0 +1,7 @@
1
+ import { type TextProps } from "@salt-ds/core";
2
+ /**
3
+ * Props for the CarouselProgressLabel component.
4
+ */
5
+ export interface CarouselProgressLabelProps extends TextProps<"div"> {
6
+ }
7
+ export declare function CarouselProgressLabel({ className, styleAs, children, ...props }: CarouselProgressLabelProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,7 @@
1
+ import { type ComponentPropsWithoutRef } from "react";
2
+ /**
3
+ * Props for the CarouselSlides component.
4
+ */
5
+ export interface CarouselSlidesProps extends ComponentPropsWithoutRef<"div"> {
6
+ }
7
+ export declare const CarouselSlides: import("react").ForwardRefExoticComponent<CarouselSlidesProps & import("react").RefAttributes<HTMLDivElement>>;
@@ -0,0 +1,34 @@
1
+ import type { EmblaCarouselType } from "embla-carousel";
2
+ import { type ComponentPropsWithRef } from "react";
3
+ /**
4
+ * Type definition for the UseCarouselTab hook.
5
+ * Provides state and handlers for tablist navigation in a carousel.
6
+ */
7
+ type UseCarouselTabProps = {
8
+ /**
9
+ * The index of the currently selected slide.
10
+ */
11
+ selectedIndex: number;
12
+ /**
13
+ * An array of scroll snap positions for the carousel slides.
14
+ */
15
+ scrollSnaps: number[];
16
+ /**
17
+ * Handler function for clicking a tab button to navigate to a specific slide.
18
+ *
19
+ * @param index - The index of the slide to navigate to.
20
+ */
21
+ onClick: (index: number) => void;
22
+ };
23
+ export declare const useCarouselTab: (emblaApi: EmblaCarouselType | undefined) => UseCarouselTabProps;
24
+ /**
25
+ * Props for the CarouselTab component.
26
+ */
27
+ export interface CarouselTabProps extends ComponentPropsWithRef<"button"> {
28
+ /**
29
+ * Is the selected slide
30
+ */
31
+ selected?: boolean;
32
+ }
33
+ export declare const CarouselTab: import("react").ForwardRefExoticComponent<Omit<CarouselTabProps, "ref"> & import("react").RefAttributes<HTMLButtonElement>>;
34
+ export {};
@@ -0,0 +1,12 @@
1
+ import { type RenderPropsType } from "@salt-ds/core";
2
+ import { type HTMLAttributes } from "react";
3
+ /**
4
+ * Props for the CarouselTabList component.
5
+ */
6
+ export interface CarouselTabListProps extends HTMLAttributes<HTMLDivElement> {
7
+ /**
8
+ * Render prop to enable customisation of tab button.
9
+ */
10
+ render?: RenderPropsType["render"];
11
+ }
12
+ export declare const CarouselTabList: import("react").ForwardRefExoticComponent<CarouselTabListProps & import("react").RefAttributes<HTMLDivElement>>;
@@ -0,0 +1,11 @@
1
+ export * from "./Carousel";
2
+ export * from "./CarouselAnnouncementPlugin";
3
+ export * from "./CarouselCard";
4
+ export * from "./CarouselContext";
5
+ export * from "./CarouselTab";
6
+ export * from "./CarouselTabList";
7
+ export * from "./CarouselAutoplayIndicator";
8
+ export * from "./CarouselPreviousButton";
9
+ export * from "./CarouselNextButton";
10
+ export * from "./CarouselSlides";
11
+ export * from "./CarouselProgressLabel";
@@ -0,0 +1,20 @@
1
+ type UsePrevNextButtonsType = {
2
+ /**
3
+ * Indicates whether the previous button is disabled.
4
+ */
5
+ prevBtnDisabled: boolean;
6
+ /**
7
+ * Indicates whether the next button is disabled.
8
+ */
9
+ nextBtnDisabled: boolean;
10
+ /**
11
+ * Handles the click event for the previous button.
12
+ */
13
+ onPrevButtonClick: () => void;
14
+ /**
15
+ * Handles the click event for the next button.
16
+ */
17
+ onNextButtonClick: () => void;
18
+ };
19
+ export declare const usePrevNextButtons: () => UsePrevNextButtonsType;
20
+ export {};