@salt-ds/embla-carousel 0.1.5 → 1.0.0
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/CHANGELOG.md +51 -0
- package/css/salt-embla-carousel.css +54 -27
- package/dist-cjs/Carousel.js +30 -9
- package/dist-cjs/Carousel.js.map +1 -1
- package/dist-cjs/CarouselAutoplayIndicator.css.js +1 -1
- package/dist-cjs/CarouselAutoplayIndicator.js.map +1 -1
- package/dist-cjs/CarouselAutoplayIndicatorSVG.js +12 -24
- package/dist-cjs/CarouselAutoplayIndicatorSVG.js.map +1 -1
- package/dist-cjs/CarouselCard.css.js +1 -1
- package/dist-cjs/CarouselCard.js +23 -9
- package/dist-cjs/CarouselCard.js.map +1 -1
- package/dist-cjs/CarouselContext.js.map +1 -1
- package/dist-cjs/CarouselNextButton.js +4 -1
- package/dist-cjs/CarouselNextButton.js.map +1 -1
- package/dist-cjs/CarouselPreviousButton.js +4 -1
- package/dist-cjs/CarouselPreviousButton.js.map +1 -1
- package/dist-cjs/CarouselProgressLabel.js +11 -33
- package/dist-cjs/CarouselProgressLabel.js.map +1 -1
- package/dist-cjs/CarouselSlides.css.js +1 -1
- package/dist-cjs/CarouselSlides.js +148 -25
- package/dist-cjs/CarouselSlides.js.map +1 -1
- package/dist-cjs/CarouselTab.css.js +1 -1
- package/dist-cjs/CarouselTab.js +1 -5
- package/dist-cjs/CarouselTab.js.map +1 -1
- package/dist-cjs/CarouselTabList.css.js +1 -1
- package/dist-cjs/CarouselTabList.js +47 -27
- package/dist-cjs/CarouselTabList.js.map +1 -1
- package/dist-cjs/createCustomSettle.js +1 -1
- package/dist-cjs/createCustomSettle.js.map +1 -1
- package/dist-cjs/getSlideDescription.js +32 -0
- package/dist-cjs/getSlideDescription.js.map +1 -0
- package/dist-cjs/getVisibleSlideDescription.js +26 -0
- package/dist-cjs/getVisibleSlideDescription.js.map +1 -0
- package/dist-cjs/getVisibleSlideIndexes.js +33 -0
- package/dist-cjs/getVisibleSlideIndexes.js.map +1 -0
- package/dist-cjs/index.js +0 -3
- package/dist-cjs/index.js.map +1 -1
- package/dist-cjs/usePrevNextButtons.js +3 -1
- package/dist-cjs/usePrevNextButtons.js.map +1 -1
- package/dist-es/Carousel.js +32 -11
- package/dist-es/Carousel.js.map +1 -1
- package/dist-es/CarouselAutoplayIndicator.css.js +1 -1
- package/dist-es/CarouselAutoplayIndicator.js.map +1 -1
- package/dist-es/CarouselAutoplayIndicatorSVG.js +13 -25
- package/dist-es/CarouselAutoplayIndicatorSVG.js.map +1 -1
- package/dist-es/CarouselCard.css.js +1 -1
- package/dist-es/CarouselCard.js +23 -9
- package/dist-es/CarouselCard.js.map +1 -1
- package/dist-es/CarouselContext.js.map +1 -1
- package/dist-es/CarouselNextButton.js +4 -1
- package/dist-es/CarouselNextButton.js.map +1 -1
- package/dist-es/CarouselPreviousButton.js +4 -1
- package/dist-es/CarouselPreviousButton.js.map +1 -1
- package/dist-es/CarouselProgressLabel.js +12 -34
- package/dist-es/CarouselProgressLabel.js.map +1 -1
- package/dist-es/CarouselSlides.css.js +1 -1
- package/dist-es/CarouselSlides.js +150 -27
- package/dist-es/CarouselSlides.js.map +1 -1
- package/dist-es/CarouselTab.css.js +1 -1
- package/dist-es/CarouselTab.js +1 -5
- package/dist-es/CarouselTab.js.map +1 -1
- package/dist-es/CarouselTabList.css.js +1 -1
- package/dist-es/CarouselTabList.js +48 -28
- package/dist-es/CarouselTabList.js.map +1 -1
- package/dist-es/createCustomSettle.js +1 -1
- package/dist-es/createCustomSettle.js.map +1 -1
- package/dist-es/getSlideDescription.js +30 -0
- package/dist-es/getSlideDescription.js.map +1 -0
- package/dist-es/getVisibleSlideDescription.js +24 -0
- package/dist-es/getVisibleSlideDescription.js.map +1 -0
- package/dist-es/getVisibleSlideIndexes.js +30 -0
- package/dist-es/getVisibleSlideIndexes.js.map +1 -0
- package/dist-es/index.js +0 -1
- package/dist-es/index.js.map +1 -1
- package/dist-es/usePrevNextButtons.js +3 -1
- package/dist-es/usePrevNextButtons.js.map +1 -1
- package/dist-types/Carousel.d.ts +7 -1
- package/dist-types/CarouselContext.d.ts +31 -0
- package/dist-types/CarouselTab.d.ts +0 -6
- package/dist-types/CarouselTabList.d.ts +4 -0
- package/dist-types/getSlideDescription.d.ts +7 -0
- package/dist-types/getVisibleSlideDescription.d.ts +7 -0
- package/dist-types/getVisibleSlideIndexes.d.ts +8 -0
- package/dist-types/index.d.ts +0 -1
- package/package.json +2 -2
- package/dist-cjs/CarouselAnnouncementPlugin.js +0 -52
- package/dist-cjs/CarouselAnnouncementPlugin.js.map +0 -1
- package/dist-cjs/CarouselProgressLabel.css.js +0 -6
- package/dist-cjs/CarouselProgressLabel.css.js.map +0 -1
- package/dist-es/CarouselAnnouncementPlugin.js +0 -49
- package/dist-es/CarouselAnnouncementPlugin.js.map +0 -1
- package/dist-es/CarouselProgressLabel.css.js +0 -4
- package/dist-es/CarouselProgressLabel.css.js.map +0 -1
- package/dist-types/CarouselAnnouncementPlugin.d.ts +0 -24
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,56 @@
|
|
|
1
1
|
# @salt-ds/embla-carousel
|
|
2
2
|
|
|
3
|
+
## 1.0.0
|
|
4
|
+
|
|
5
|
+
### Major Changes
|
|
6
|
+
|
|
7
|
+
- da42e9a: Carousel is now a stable API.
|
|
8
|
+
|
|
9
|
+
Features include:
|
|
10
|
+
|
|
11
|
+
- Composable Salt controls for navigation and progress.
|
|
12
|
+
- Composable with custom content within slides.
|
|
13
|
+
- Built on the popular `embla-carousel` library, with Salt-specific accessibility and theming enhancements.
|
|
14
|
+
|
|
15
|
+
Refer to [example](https://saltdesignsystem.com/salt/components/carousel/usage#sequential-with-slide-group) for basic usage.
|
|
16
|
+
|
|
17
|
+
### Patch Changes
|
|
18
|
+
|
|
19
|
+
- Updated dependencies [61c2bad]
|
|
20
|
+
- Updated dependencies [fef411f]
|
|
21
|
+
- @salt-ds/core@1.51.0
|
|
22
|
+
|
|
23
|
+
## 0.1.6
|
|
24
|
+
|
|
25
|
+
### Patch Changes
|
|
26
|
+
|
|
27
|
+
- 30fc785: Accessibility updates for Carousel
|
|
28
|
+
|
|
29
|
+
- Carousel now passes WCAG 2.1 AA requirements, if implemented as per documentation.
|
|
30
|
+
- Removed next/prev buttons from focus order, when displaying a tablist.
|
|
31
|
+
- Slides and actions within slides are now focusable.
|
|
32
|
+
|
|
33
|
+
Removed embla plugin `CarouselAnnouncementPlugin.ts` as it is no longer needed.
|
|
34
|
+
|
|
35
|
+
```diff
|
|
36
|
+
- import { CarouselAnnouncementPlugin } from "./CarouselAnnouncementPlugin";
|
|
37
|
+
<Carousel
|
|
38
|
+
aria-label="Account overview"
|
|
39
|
+
getEmblaApi={setEmblaApi}
|
|
40
|
+
- emblaPlugins={[CarouselAnnouncementPlugin()]}
|
|
41
|
+
>
|
|
42
|
+
</Carousel>
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
- Updated dependencies [378fc01]
|
|
46
|
+
- Updated dependencies [1f53f12]
|
|
47
|
+
- Updated dependencies [22fed0d]
|
|
48
|
+
- Updated dependencies [770bc9c]
|
|
49
|
+
- Updated dependencies [54e4b19]
|
|
50
|
+
- Updated dependencies [bbb7dba]
|
|
51
|
+
- Updated dependencies [c3df8d8]
|
|
52
|
+
- @salt-ds/core@1.49.0
|
|
53
|
+
|
|
3
54
|
## 0.1.5
|
|
4
55
|
|
|
5
56
|
### Patch Changes
|
|
@@ -18,10 +18,6 @@
|
|
|
18
18
|
.saltCarouselAutoplayIndicatorSVG {
|
|
19
19
|
transform: rotate(-90deg);
|
|
20
20
|
}
|
|
21
|
-
.saltCarouselAutoplayIndicatorSVG-track {
|
|
22
|
-
fill: none;
|
|
23
|
-
stroke: var(--salt-accent-foreground);
|
|
24
|
-
}
|
|
25
21
|
.saltCarouselAutoplayIndicatorSVG-bar {
|
|
26
22
|
fill: none;
|
|
27
23
|
stroke: var(--salt-accent-background);
|
|
@@ -56,41 +52,82 @@
|
|
|
56
52
|
gap: var(--salt-spacing-200);
|
|
57
53
|
flex-grow: 1;
|
|
58
54
|
}
|
|
55
|
+
.saltCarouselCard:focus-visible {
|
|
56
|
+
outline: none;
|
|
57
|
+
}
|
|
58
|
+
.saltCarouselCard:not(.saltCarouselCard-bordered):focus-visible::after {
|
|
59
|
+
content: "";
|
|
60
|
+
position: absolute;
|
|
61
|
+
top: 0;
|
|
62
|
+
bottom: 0;
|
|
63
|
+
left: var(--carousel-slide-spacing);
|
|
64
|
+
right: 0;
|
|
65
|
+
outline: var(--salt-focused-outline);
|
|
66
|
+
outline-offset: calc(var(--salt-focused-outlineWidth) * -1);
|
|
67
|
+
cursor: var(--salt-cursor-hover);
|
|
68
|
+
}
|
|
69
|
+
.saltCarouselCard-bordered:focus-visible::after {
|
|
70
|
+
content: "";
|
|
71
|
+
position: absolute;
|
|
72
|
+
top: 0;
|
|
73
|
+
bottom: 0;
|
|
74
|
+
left: var(--carousel-slide-spacing);
|
|
75
|
+
right: 0;
|
|
76
|
+
outline: var(--salt-focused-outline);
|
|
77
|
+
outline-offset: calc(var(--salt-focused-outlineWidth) * -1);
|
|
78
|
+
cursor: var(--salt-cursor-hover);
|
|
79
|
+
border-radius: var(--salt-palette-corner, 0);
|
|
80
|
+
}
|
|
59
81
|
.saltCarouselCard-body {
|
|
60
82
|
display: flex;
|
|
61
83
|
overflow: hidden;
|
|
62
84
|
flex-direction: column;
|
|
63
|
-
gap: var(--salt-spacing-200);
|
|
64
85
|
flex-grow: 1;
|
|
86
|
+
padding-bottom: var(--salt-spacing-200);
|
|
87
|
+
}
|
|
88
|
+
.saltCarouselCard-header {
|
|
89
|
+
padding-bottom: var(--salt-spacing-100);
|
|
90
|
+
}
|
|
91
|
+
.saltCarouselCard-actions {
|
|
92
|
+
padding-top: var(--salt-spacing-200);
|
|
93
|
+
}
|
|
94
|
+
.saltCarouselCard-body.saltCarouselCard-bordered-body {
|
|
65
95
|
padding: 0 var(--salt-spacing-200) var(--salt-spacing-200) var(--salt-spacing-200);
|
|
66
96
|
}
|
|
67
97
|
.saltCarouselCard-content h2,
|
|
68
98
|
.saltCarouselCard-content h3 {
|
|
69
99
|
margin: 0;
|
|
70
100
|
}
|
|
71
|
-
.saltCarouselCard
|
|
72
|
-
visibility: hidden;
|
|
73
|
-
}
|
|
74
|
-
.saltCarouselCard-bordered {
|
|
101
|
+
.saltCarouselCard-bordered-content {
|
|
75
102
|
background: var(--salt-container-primary-background);
|
|
76
103
|
border: var(--salt-size-fixed-100) var(--salt-container-borderStyle) var(--salt-container-primary-borderColor);
|
|
77
104
|
border-radius: var(--salt-palette-corner, 0);
|
|
78
105
|
}
|
|
79
106
|
|
|
80
|
-
/* src/CarouselProgressLabel.css */
|
|
81
|
-
.saltCarouselTabList.saltText {
|
|
82
|
-
font-weight: var(--salt-text-fontWeight-strong);
|
|
83
|
-
}
|
|
84
|
-
|
|
85
107
|
/* src/CarouselSlides.css */
|
|
86
108
|
.saltCarouselSlides {
|
|
87
109
|
overflow: hidden;
|
|
110
|
+
cursor: var(--salt-cursor-grab);
|
|
88
111
|
}
|
|
89
112
|
.saltCarouselSlides-container {
|
|
90
113
|
display: flex;
|
|
91
114
|
touch-action: pan-y pinch-zoom;
|
|
92
115
|
margin-left: calc(var(--carousel-slide-spacing) * -1);
|
|
93
116
|
}
|
|
117
|
+
.saltCarouselSlides-sr-only {
|
|
118
|
+
position: absolute;
|
|
119
|
+
height: 1px;
|
|
120
|
+
width: 1px;
|
|
121
|
+
padding: 0;
|
|
122
|
+
margin: -1px;
|
|
123
|
+
overflow: hidden;
|
|
124
|
+
clip: rect(0, 0, 0, 0);
|
|
125
|
+
white-space: nowrap;
|
|
126
|
+
border-width: 0;
|
|
127
|
+
}
|
|
128
|
+
.saltCarouselSlides-dragging {
|
|
129
|
+
cursor: var(--salt-cursor-grab-active);
|
|
130
|
+
}
|
|
94
131
|
|
|
95
132
|
/* src/CarouselTab.css */
|
|
96
133
|
.saltCarouselTab {
|
|
@@ -126,12 +163,8 @@
|
|
|
126
163
|
transform: translate(-50%, -50%);
|
|
127
164
|
}
|
|
128
165
|
.saltCarouselTab:focus-visible {
|
|
129
|
-
outline
|
|
130
|
-
outline-
|
|
131
|
-
outline-color: var(--salt-focused-outlineColor);
|
|
132
|
-
outline-offset: var(--salt-focused-outlineOffset);
|
|
133
|
-
background: var(--salt-selectable-background-hover);
|
|
134
|
-
border-color: var(--salt-selectable-borderColor-hover);
|
|
166
|
+
outline: var(--saltRadioButton-outline, var(--salt-focused-outline));
|
|
167
|
+
outline-offset: var(--salt-spacing-fixed-100);
|
|
135
168
|
}
|
|
136
169
|
.saltCarouselTab-selected {
|
|
137
170
|
box-shadow: inset 0 0 0 var(--salt-size-selectable) var(--salt-selectable-borderColor-selected);
|
|
@@ -145,11 +178,5 @@
|
|
|
145
178
|
align-items: center;
|
|
146
179
|
gap: var(--salt-spacing-200);
|
|
147
180
|
}
|
|
148
|
-
.saltCarouselTabList:focus-visible {
|
|
149
|
-
outline-style: var(--salt-focused-outlineStyle);
|
|
150
|
-
outline-width: var(--salt-focused-outlineWidth);
|
|
151
|
-
outline-offset: var(--salt-focused-outlineOffset);
|
|
152
|
-
outline-color: var(--salt-focused-outlineColor);
|
|
153
|
-
}
|
|
154
181
|
|
|
155
|
-
/* src/
|
|
182
|
+
/* src/1a62c25b-2a44-4f89-9546-cfbe130f6c2f.css */
|
package/dist-cjs/Carousel.js
CHANGED
|
@@ -15,9 +15,11 @@ const Carousel = react.forwardRef(
|
|
|
15
15
|
function Carousel2({
|
|
16
16
|
children,
|
|
17
17
|
className,
|
|
18
|
+
disableSlideAnnouncements,
|
|
18
19
|
emblaOptions = {},
|
|
19
20
|
emblaPlugins = [],
|
|
20
21
|
getEmblaApi,
|
|
22
|
+
id,
|
|
21
23
|
...rest
|
|
22
24
|
}, ref) {
|
|
23
25
|
const targetWindow = window.useWindow();
|
|
@@ -29,23 +31,42 @@ const Carousel = react.forwardRef(
|
|
|
29
31
|
const [emblaRef, emblaApi] = useEmblaCarousel(emblaOptions, [
|
|
30
32
|
...emblaPlugins
|
|
31
33
|
]);
|
|
34
|
+
const carouselId = core.useId(id);
|
|
32
35
|
react.useEffect(() => {
|
|
33
36
|
if (emblaApi) {
|
|
34
37
|
getEmblaApi == null ? void 0 : getEmblaApi(emblaApi);
|
|
35
38
|
}
|
|
36
39
|
return void 0;
|
|
37
40
|
}, [emblaApi]);
|
|
38
|
-
|
|
39
|
-
|
|
41
|
+
const [ariaVariant, setAriaVariant] = react.useState("group");
|
|
42
|
+
const [announcementState, setAnnouncementState] = react.useState(void 0);
|
|
43
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
44
|
+
CarouselContext.CarouselContext.Provider,
|
|
40
45
|
{
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
46
|
+
value: {
|
|
47
|
+
ariaVariant,
|
|
48
|
+
disableSlideAnnouncements,
|
|
49
|
+
emblaApi,
|
|
50
|
+
emblaRef,
|
|
51
|
+
setAriaVariant,
|
|
52
|
+
announcementState,
|
|
53
|
+
setAnnouncementState,
|
|
54
|
+
carouselId
|
|
55
|
+
},
|
|
56
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
57
|
+
"section",
|
|
58
|
+
{
|
|
59
|
+
"aria-roledescription": "carousel",
|
|
60
|
+
role: "region",
|
|
61
|
+
className: clsx.clsx(withBaseName(), className),
|
|
62
|
+
ref,
|
|
63
|
+
...rest,
|
|
64
|
+
children
|
|
65
|
+
},
|
|
66
|
+
`carousel-${ariaVariant}}`
|
|
67
|
+
)
|
|
47
68
|
}
|
|
48
|
-
)
|
|
69
|
+
);
|
|
49
70
|
}
|
|
50
71
|
);
|
|
51
72
|
|
package/dist-cjs/Carousel.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Carousel.js","sources":["../src/Carousel.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 useEmblaCarousel, {\n type UseEmblaCarouselType,\n} from \"embla-carousel-react\";\nimport {
|
|
1
|
+
{"version":3,"file":"Carousel.js","sources":["../src/Carousel.tsx"],"sourcesContent":["import { makePrefixer, useId } from \"@salt-ds/core\";\nimport { useComponentCssInjection } from \"@salt-ds/styles\";\nimport { useWindow } from \"@salt-ds/window\";\nimport { clsx } from \"clsx\";\nimport useEmblaCarousel, {\n type UseEmblaCarouselType,\n} from \"embla-carousel-react\";\nimport {\n type ComponentPropsWithoutRef,\n forwardRef,\n useEffect,\n useState,\n} from \"react\";\nimport carouselCss from \"./Carousel.css\";\nimport {\n type CarouselAnnouncementTrigger,\n type CarouselAriaVariant,\n CarouselContext,\n} from \"./CarouselContext\";\n\nconst withBaseName = makePrefixer(\"saltCarousel\");\n\nexport type CarouselEmblaRefType = UseEmblaCarouselType[0];\nexport type CarouselEmblaApiType = UseEmblaCarouselType[1];\n\ntype UseCarouselParameters = Parameters<typeof useEmblaCarousel>;\nexport type CarouselOptions = UseCarouselParameters[0];\nexport type CarouselPlugin = UseCarouselParameters[1];\n\n/**\n * Props for the Carousel component.\n * Pass a ref to the carousel to get it to return a reference to the embla API\n */\nexport interface CarouselProps extends ComponentPropsWithoutRef<\"section\"> {\n /**\n * Options to configure the Embla Carousel.\n * These options are passed directly to the Embla Carousel instance.\n */\n emblaOptions?: CarouselOptions;\n\n /**\n * Plugins to enhance the functionality of the Embla Carousel.\n * These options are passed directly to the Embla Carousel instance.\n */\n emblaPlugins?: CarouselPlugin;\n /**\n * Get embla API instance, use this to manage the state of the Carousel\n **/\n getEmblaApi?: (embla: CarouselEmblaApiType) => void;\n /**\n * Disable screenreader announcing slide updates, defaults to false.\n */\n disableSlideAnnouncements?: boolean;\n}\n\nexport const Carousel = forwardRef<HTMLElement, CarouselProps>(\n function Carousel(\n {\n children,\n className,\n disableSlideAnnouncements,\n emblaOptions = {},\n emblaPlugins = [],\n getEmblaApi,\n id,\n ...rest\n },\n ref,\n ) {\n const targetWindow = useWindow();\n useComponentCssInjection({\n testId: \"salt-carousel\",\n css: carouselCss,\n window: targetWindow,\n });\n\n const [emblaRef, emblaApi] = useEmblaCarousel(emblaOptions, [\n ...emblaPlugins,\n ]);\n\n const carouselId = useId(id);\n\n useEffect(() => {\n if (emblaApi) {\n getEmblaApi?.(emblaApi);\n }\n return undefined;\n }, [emblaApi]);\n\n const [ariaVariant, setAriaVariant] =\n useState<CarouselAriaVariant>(\"group\");\n const [announcementState, setAnnouncementState] = useState<\n CarouselAnnouncementTrigger | undefined\n >(undefined);\n\n return (\n <CarouselContext.Provider\n value={{\n ariaVariant,\n disableSlideAnnouncements,\n emblaApi,\n emblaRef,\n setAriaVariant,\n announcementState,\n setAnnouncementState,\n carouselId,\n }}\n >\n <section\n key={`carousel-${ariaVariant}}`}\n aria-roledescription=\"carousel\"\n role=\"region\"\n className={clsx(withBaseName(), className)}\n ref={ref}\n {...rest}\n >\n {children}\n </section>\n </CarouselContext.Provider>\n );\n },\n);\n"],"names":["makePrefixer","forwardRef","Carousel","useWindow","useComponentCssInjection","carouselCss","useId","useEffect","useState","jsx","CarouselContext","clsx"],"mappings":";;;;;;;;;;;;AAoBA,MAAM,YAAA,GAAeA,kBAAa,cAAc,CAAA;AAmCzC,MAAM,QAAA,GAAWC,gBAAA;AAAA,EACtB,SAASC,SAAAA,CACP;AAAA,IACE,QAAA;AAAA,IACA,SAAA;AAAA,IACA,yBAAA;AAAA,IACA,eAAe,EAAC;AAAA,IAChB,eAAe,EAAC;AAAA,IAChB,WAAA;AAAA,IACA,EAAA;AAAA,IACA,GAAG;AAAA,KAEL,GAAA,EACA;AACA,IAAA,MAAM,eAAeC,gBAAA,EAAU;AAC/B,IAAAC,+BAAA,CAAyB;AAAA,MACvB,MAAA,EAAQ,eAAA;AAAA,MACR,GAAA,EAAKC,UAAA;AAAA,MACL,MAAA,EAAQ;AAAA,KACT,CAAA;AAED,IAAA,MAAM,CAAC,QAAA,EAAU,QAAQ,CAAA,GAAI,iBAAiB,YAAA,EAAc;AAAA,MAC1D,GAAG;AAAA,KACJ,CAAA;AAED,IAAA,MAAM,UAAA,GAAaC,WAAM,EAAE,CAAA;AAE3B,IAAAC,eAAA,CAAU,MAAM;AACd,MAAA,IAAI,QAAA,EAAU;AACZ,QAAA,WAAA,IAAA,IAAA,GAAA,MAAA,GAAA,WAAA,CAAc,QAAA,CAAA;AAAA,MAChB;AACA,MAAA,OAAO,MAAA;AAAA,IACT,CAAA,EAAG,CAAC,QAAQ,CAAC,CAAA;AAEb,IAAA,MAAM,CAAC,WAAA,EAAa,cAAc,CAAA,GAChCC,eAA8B,OAAO,CAAA;AACvC,IAAA,MAAM,CAAC,iBAAA,EAAmB,oBAAoB,CAAA,GAAIA,eAEhD,MAAS,CAAA;AAEX,IAAA,uBACEC,cAAA;AAAA,MAACC,+BAAA,CAAgB,QAAA;AAAA,MAAhB;AAAA,QACC,KAAA,EAAO;AAAA,UACL,WAAA;AAAA,UACA,yBAAA;AAAA,UACA,QAAA;AAAA,UACA,QAAA;AAAA,UACA,cAAA;AAAA,UACA,iBAAA;AAAA,UACA,oBAAA;AAAA,UACA;AAAA,SACF;AAAA,QAEA,QAAA,kBAAAD,cAAA;AAAA,UAAC,SAAA;AAAA,UAAA;AAAA,YAEC,sBAAA,EAAqB,UAAA;AAAA,YACrB,IAAA,EAAK,QAAA;AAAA,YACL,SAAA,EAAWE,SAAA,CAAK,YAAA,EAAa,EAAG,SAAS,CAAA;AAAA,YACzC,GAAA;AAAA,YACC,GAAG,IAAA;AAAA,YAEH;AAAA,WAAA;AAAA,UAPI,YAAY,WAAW,CAAA,CAAA;AAAA;AAQ9B;AAAA,KACF;AAAA,EAEJ;AACF;;;;"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var css_248z = ".saltCarouselAutoplayIndicator {\n --carousel-svg-circumference: 0;\n display: flex;\n align-self: center;\n}\n\n.saltCarouselAutoplayIndicatorSVG {\n transform: rotate(-90deg);\n}\n\n.saltCarouselAutoplayIndicatorSVG-
|
|
3
|
+
var css_248z = ".saltCarouselAutoplayIndicator {\n --carousel-svg-circumference: 0;\n display: flex;\n align-self: center;\n}\n\n.saltCarouselAutoplayIndicatorSVG {\n transform: rotate(-90deg);\n}\n\n.saltCarouselAutoplayIndicatorSVG-bar {\n fill: none;\n stroke: var(--salt-accent-background);\n stroke-dasharray: var(--carousel-svg-circumference);\n stroke-dashoffset: var(--carousel-svg-circumference);\n animation: indicatorAnimation 0.5s linear;\n animation-play-state: paused;\n}\n\n@keyframes indicatorAnimation {\n from {\n stroke-dashoffset: var(--carousel-svg-circumference);\n }\n to {\n stroke-dashoffset: 0;\n }\n}\n";
|
|
4
4
|
|
|
5
5
|
module.exports = css_248z;
|
|
6
6
|
//# sourceMappingURL=CarouselAutoplayIndicator.css.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CarouselAutoplayIndicator.js","sources":["../src/CarouselAutoplayIndicator.tsx"],"sourcesContent":["import { makePrefixer, useDensity } 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 CSSProperties,\n forwardRef,\n useEffect,\n useRef,\n} from \"react\";\nimport carouselAutoplayIndicator from \"./CarouselAutoplayIndicator.css\";\nimport { CarouselAutoplayIndicatorSVG } from \"./CarouselAutoplayIndicatorSVG\";\n\nexport interface CarouselAutoplayIndicatorProps\n extends ComponentPropsWithoutRef<\"div\"> {\n /**\n * Duration of each slide in milliseconds.\n */\n duration: number;\n /**\n * Index of slide currently displayed.\n */\n slideIndex: number;\n /**\n * If `true`, the indicator is animated to visualize the time until the next slide.\n */\n isPlaying: boolean;\n /**\n * If `true`, the animation is paused.\n */\n isPaused?: boolean;\n}\n\nconst withBaseName = makePrefixer(\"saltCarouselAutoplayIndicator\");\n\nconst sizeAndStrokeWidthMapping = {\n high: { size: 10, strokeWidth: 2 },\n medium: { size: 12, strokeWidth: 2 },\n low: { size: 14, strokeWidth: 2 },\n touch: { size: 16, strokeWidth: 2 },\n};\n\nexport const CarouselAutoplayIndicator = forwardRef<\n HTMLDivElement,\n CarouselAutoplayIndicatorProps\n>(\n (\n {\n className,\n duration,\n slideIndex,\n isPlaying,\n isPaused = false,\n children,\n ...props\n },\n ref,\n ) => {\n const targetWindow = useWindow();\n useComponentCssInjection({\n testId: \"salt-carousel-autoplay-indicator\",\n css: carouselAutoplayIndicator,\n window: targetWindow,\n });\n\n const barRef = useRef<SVGCircleElement>(null);\n const animationFrameId = useRef<number | null>(null);\n\n const density = useDensity();\n const { size, strokeWidth } = sizeAndStrokeWidthMapping[density];\n const radius = (size - strokeWidth) / 2;\n const circumference = 2 * Math.PI * radius;\n\n useEffect(() => {\n if (barRef.current) {\n animationFrameId.current = requestAnimationFrame(() => {\n if (!barRef.current) {\n return;\n }\n barRef.current.style.animation = \"none\"; // Reset animation\n barRef.current.style.strokeDashoffset = `${circumference}`;\n animationFrameId.current = requestAnimationFrame(() => {\n if (!barRef.current) {\n return;\n }\n barRef.current.style.animation = `indicatorAnimation ${duration}ms linear`;\n barRef.current.style.animationPlayState = isPaused\n ? \"paused\"\n : isPlaying\n ? \"running\"\n : \"paused\";\n });\n });\n }\n\n return () => {\n if (animationFrameId.current !== null) {\n cancelAnimationFrame(animationFrameId.current);\n animationFrameId.current = null;\n }\n };\n }, [circumference, duration, slideIndex, isPlaying, isPaused]);\n\n return (\n <div\n ref={ref}\n style={\n {\n width: size,\n height: size,\n \"--carousel-svg-circumference\": circumference,\n } as CSSProperties\n }\n className={clsx(withBaseName(), className)}\n {...props}\n >\n <CarouselAutoplayIndicatorSVG\n size={size}\n strokeWidth={strokeWidth}\n barRef={barRef}\n radius={radius}\n />\n </div>\n );\n },\n);\n"],"names":["makePrefixer","forwardRef","useWindow","useComponentCssInjection","carouselAutoplayIndicator","useRef","useDensity","useEffect","jsx","clsx","CarouselAutoplayIndicatorSVG"],"mappings":";;;;;;;;;;;AAkCA,MAAM,YAAA,GAAeA,kBAAa,+BAA+B,CAAA;AAEjE,MAAM,
|
|
1
|
+
{"version":3,"file":"CarouselAutoplayIndicator.js","sources":["../src/CarouselAutoplayIndicator.tsx"],"sourcesContent":["import { makePrefixer, useDensity } 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 CSSProperties,\n forwardRef,\n useEffect,\n useRef,\n} from \"react\";\nimport carouselAutoplayIndicator from \"./CarouselAutoplayIndicator.css\";\nimport { CarouselAutoplayIndicatorSVG } from \"./CarouselAutoplayIndicatorSVG\";\n\nexport interface CarouselAutoplayIndicatorProps\n extends ComponentPropsWithoutRef<\"div\"> {\n /**\n * Duration of each slide in milliseconds.\n */\n duration: number;\n /**\n * Index of slide currently displayed.\n */\n slideIndex: number;\n /**\n * If `true`, the indicator is animated to visualize the time until the next slide.\n */\n isPlaying: boolean;\n /**\n * If `true`, the animation is paused.\n */\n isPaused?: boolean;\n}\n\nconst withBaseName = makePrefixer(\"saltCarouselAutoplayIndicator\");\n\nconst sizeAndStrokeWidthMapping = {\n high: { size: 10, strokeWidth: 2 },\n medium: { size: 12, strokeWidth: 2 },\n low: { size: 14, strokeWidth: 2 },\n touch: { size: 16, strokeWidth: 2 },\n};\n\nexport const CarouselAutoplayIndicator = forwardRef<\n HTMLDivElement,\n CarouselAutoplayIndicatorProps\n>(\n (\n {\n className,\n duration,\n slideIndex,\n isPlaying,\n isPaused = false,\n children,\n ...props\n },\n ref,\n ) => {\n const targetWindow = useWindow();\n useComponentCssInjection({\n testId: \"salt-carousel-autoplay-indicator\",\n css: carouselAutoplayIndicator,\n window: targetWindow,\n });\n\n const barRef = useRef<SVGCircleElement>(null);\n const animationFrameId = useRef<number | null>(null);\n\n const density = useDensity();\n const { size, strokeWidth } = sizeAndStrokeWidthMapping[density];\n const radius = (size - strokeWidth) / 2;\n const circumference = 2 * Math.PI * radius;\n\n useEffect(() => {\n if (barRef.current) {\n animationFrameId.current = requestAnimationFrame(() => {\n if (!barRef.current) {\n return;\n }\n barRef.current.style.animation = \"none\"; // Reset animation\n barRef.current.style.strokeDashoffset = `${circumference}`;\n animationFrameId.current = requestAnimationFrame(() => {\n if (!barRef.current) {\n return;\n }\n barRef.current.style.animation = `indicatorAnimation ${duration}ms linear`;\n barRef.current.style.animationPlayState = isPaused\n ? \"paused\"\n : isPlaying\n ? \"running\"\n : \"paused\";\n });\n });\n }\n\n return () => {\n if (animationFrameId.current !== null) {\n cancelAnimationFrame(animationFrameId.current);\n animationFrameId.current = null;\n }\n };\n }, [circumference, duration, slideIndex, isPlaying, isPaused]);\n\n return (\n <div\n ref={ref}\n style={\n {\n width: size,\n height: size,\n \"--carousel-svg-circumference\": circumference,\n } as CSSProperties\n }\n className={clsx(withBaseName(), className)}\n {...props}\n >\n <CarouselAutoplayIndicatorSVG\n size={size}\n strokeWidth={strokeWidth}\n barRef={barRef}\n radius={radius}\n />\n </div>\n );\n },\n);\n"],"names":["makePrefixer","forwardRef","useWindow","useComponentCssInjection","carouselAutoplayIndicator","useRef","useDensity","useEffect","jsx","clsx","CarouselAutoplayIndicatorSVG"],"mappings":";;;;;;;;;;;AAkCA,MAAM,YAAA,GAAeA,kBAAa,+BAA+B,CAAA;AAEjE,MAAM,yBAAA,GAA4B;AAAA,EAChC,IAAA,EAAM,EAAE,IAAA,EAAM,EAAA,EAAI,aAAa,CAAA,EAAE;AAAA,EACjC,MAAA,EAAQ,EAAE,IAAA,EAAM,EAAA,EAAI,aAAa,CAAA,EAAE;AAAA,EACnC,GAAA,EAAK,EAAE,IAAA,EAAM,EAAA,EAAI,aAAa,CAAA,EAAE;AAAA,EAChC,KAAA,EAAO,EAAE,IAAA,EAAM,EAAA,EAAI,aAAa,CAAA;AAClC,CAAA;AAEO,MAAM,yBAAA,GAA4BC,gBAAA;AAAA,EAIvC,CACE;AAAA,IACE,SAAA;AAAA,IACA,QAAA;AAAA,IACA,UAAA;AAAA,IACA,SAAA;AAAA,IACA,QAAA,GAAW,KAAA;AAAA,IACX,QAAA;AAAA,IACA,GAAG;AAAA,KAEL,GAAA,KACG;AACH,IAAA,MAAM,eAAeC,gBAAA,EAAU;AAC/B,IAAAC,+BAAA,CAAyB;AAAA,MACvB,MAAA,EAAQ,kCAAA;AAAA,MACR,GAAA,EAAKC,2BAAA;AAAA,MACL,MAAA,EAAQ;AAAA,KACT,CAAA;AAED,IAAA,MAAM,MAAA,GAASC,aAAyB,IAAI,CAAA;AAC5C,IAAA,MAAM,gBAAA,GAAmBA,aAAsB,IAAI,CAAA;AAEnD,IAAA,MAAM,UAAUC,eAAA,EAAW;AAC3B,IAAA,MAAM,EAAE,IAAA,EAAM,WAAA,EAAY,GAAI,0BAA0B,OAAO,CAAA;AAC/D,IAAA,MAAM,MAAA,GAAA,CAAU,OAAO,WAAA,IAAe,CAAA;AACtC,IAAA,MAAM,aAAA,GAAgB,CAAA,GAAI,IAAA,CAAK,EAAA,GAAK,MAAA;AAEpC,IAAAC,eAAA,CAAU,MAAM;AACd,MAAA,IAAI,OAAO,OAAA,EAAS;AAClB,QAAA,gBAAA,CAAiB,OAAA,GAAU,sBAAsB,MAAM;AACrD,UAAA,IAAI,CAAC,OAAO,OAAA,EAAS;AACnB,YAAA;AAAA,UACF;AACA,UAAA,MAAA,CAAO,OAAA,CAAQ,MAAM,SAAA,GAAY,MAAA;AACjC,UAAA,MAAA,CAAO,OAAA,CAAQ,KAAA,CAAM,gBAAA,GAAmB,CAAA,EAAG,aAAa,CAAA,CAAA;AACxD,UAAA,gBAAA,CAAiB,OAAA,GAAU,sBAAsB,MAAM;AACrD,YAAA,IAAI,CAAC,OAAO,OAAA,EAAS;AACnB,cAAA;AAAA,YACF;AACA,YAAA,MAAA,CAAO,OAAA,CAAQ,KAAA,CAAM,SAAA,GAAY,CAAA,mBAAA,EAAsB,QAAQ,CAAA,SAAA,CAAA;AAC/D,YAAA,MAAA,CAAO,QAAQ,KAAA,CAAM,kBAAA,GAAqB,QAAA,GACtC,QAAA,GACA,YACE,SAAA,GACA,QAAA;AAAA,UACR,CAAC,CAAA;AAAA,QACH,CAAC,CAAA;AAAA,MACH;AAEA,MAAA,OAAO,MAAM;AACX,QAAA,IAAI,gBAAA,CAAiB,YAAY,IAAA,EAAM;AACrC,UAAA,oBAAA,CAAqB,iBAAiB,OAAO,CAAA;AAC7C,UAAA,gBAAA,CAAiB,OAAA,GAAU,IAAA;AAAA,QAC7B;AAAA,MACF,CAAA;AAAA,IACF,GAAG,CAAC,aAAA,EAAe,UAAU,UAAA,EAAY,SAAA,EAAW,QAAQ,CAAC,CAAA;AAE7D,IAAA,uBACEC,cAAA;AAAA,MAAC,KAAA;AAAA,MAAA;AAAA,QACC,GAAA;AAAA,QACA,KAAA,EACE;AAAA,UACE,KAAA,EAAO,IAAA;AAAA,UACP,MAAA,EAAQ,IAAA;AAAA,UACR,8BAAA,EAAgC;AAAA,SAClC;AAAA,QAEF,SAAA,EAAWC,SAAA,CAAK,YAAA,EAAa,EAAG,SAAS,CAAA;AAAA,QACxC,GAAG,KAAA;AAAA,QAEJ,QAAA,kBAAAD,cAAA;AAAA,UAACE,yDAAA;AAAA,UAAA;AAAA,YACC,IAAA;AAAA,YACA,WAAA;AAAA,YACA,MAAA;AAAA,YACA;AAAA;AAAA;AACF;AAAA,KACF;AAAA,EAEJ;AACF;;;;"}
|
|
@@ -14,7 +14,7 @@ const CarouselAutoplayIndicatorSVG = react.forwardRef(
|
|
|
14
14
|
size,
|
|
15
15
|
strokeWidth
|
|
16
16
|
}, ref) => {
|
|
17
|
-
return /* @__PURE__ */ jsxRuntime.
|
|
17
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
18
18
|
"svg",
|
|
19
19
|
{
|
|
20
20
|
className: clsx.clsx(withBaseName(), className),
|
|
@@ -22,29 +22,17 @@ const CarouselAutoplayIndicatorSVG = react.forwardRef(
|
|
|
22
22
|
height: size,
|
|
23
23
|
"aria-hidden": true,
|
|
24
24
|
ref,
|
|
25
|
-
children:
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
37
|
-
"circle",
|
|
38
|
-
{
|
|
39
|
-
ref: barRef,
|
|
40
|
-
className: withBaseName("bar"),
|
|
41
|
-
cx: size / 2,
|
|
42
|
-
cy: size / 2,
|
|
43
|
-
r: radius,
|
|
44
|
-
strokeWidth
|
|
45
|
-
}
|
|
46
|
-
)
|
|
47
|
-
]
|
|
25
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
26
|
+
"circle",
|
|
27
|
+
{
|
|
28
|
+
ref: barRef,
|
|
29
|
+
className: withBaseName("bar"),
|
|
30
|
+
cx: size / 2,
|
|
31
|
+
cy: size / 2,
|
|
32
|
+
r: radius,
|
|
33
|
+
strokeWidth
|
|
34
|
+
}
|
|
35
|
+
)
|
|
48
36
|
}
|
|
49
37
|
);
|
|
50
38
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CarouselAutoplayIndicatorSVG.js","sources":["../src/CarouselAutoplayIndicatorSVG.tsx"],"sourcesContent":["import { makePrefixer } from \"@salt-ds/core\";\nimport { clsx } from \"clsx\";\nimport { forwardRef, type Ref, type SVGAttributes } from \"react\";\n\nconst withBaseName = makePrefixer(\"saltCarouselAutoplayIndicatorSVG\");\n\nexport interface CarouselAutoplayIndicatorSVGProps\n extends SVGAttributes<SVGSVGElement> {\n /**\n * Class name to apply to the SVG element.\n */\n className?: string;\n /**\n * Ref to attach to progress indicator element\n */\n barRef: Ref<SVGCircleElement>;\n /**\n * Size of the SVG in pixels.\n */\n size: number;\n /**\n * Stroke width of the progress indicator in pixels.\n */\n strokeWidth: number;\n /**\n * Radius of the progress indicator circle.\n */\n radius: number;\n}\n\nexport const CarouselAutoplayIndicatorSVG = forwardRef<\n SVGSVGElement,\n CarouselAutoplayIndicatorSVGProps\n>(\n (\n {\n barRef,\n className,\n radius,\n size,\n strokeWidth,\n }: CarouselAutoplayIndicatorSVGProps,\n ref,\n ) => {\n return (\n <svg\n className={clsx(withBaseName(), className)}\n width={size}\n height={size}\n aria-hidden\n ref={ref}\n >\n <circle\n
|
|
1
|
+
{"version":3,"file":"CarouselAutoplayIndicatorSVG.js","sources":["../src/CarouselAutoplayIndicatorSVG.tsx"],"sourcesContent":["import { makePrefixer } from \"@salt-ds/core\";\nimport { clsx } from \"clsx\";\nimport { forwardRef, type Ref, type SVGAttributes } from \"react\";\n\nconst withBaseName = makePrefixer(\"saltCarouselAutoplayIndicatorSVG\");\n\nexport interface CarouselAutoplayIndicatorSVGProps\n extends SVGAttributes<SVGSVGElement> {\n /**\n * Class name to apply to the SVG element.\n */\n className?: string;\n /**\n * Ref to attach to progress indicator element\n */\n barRef: Ref<SVGCircleElement>;\n /**\n * Size of the SVG in pixels.\n */\n size: number;\n /**\n * Stroke width of the progress indicator in pixels.\n */\n strokeWidth: number;\n /**\n * Radius of the progress indicator circle.\n */\n radius: number;\n}\n\nexport const CarouselAutoplayIndicatorSVG = forwardRef<\n SVGSVGElement,\n CarouselAutoplayIndicatorSVGProps\n>(\n (\n {\n barRef,\n className,\n radius,\n size,\n strokeWidth,\n }: CarouselAutoplayIndicatorSVGProps,\n ref,\n ) => {\n return (\n <svg\n className={clsx(withBaseName(), className)}\n width={size}\n height={size}\n aria-hidden\n ref={ref}\n >\n <circle\n ref={barRef}\n className={withBaseName(\"bar\")}\n cx={size / 2}\n cy={size / 2}\n r={radius}\n strokeWidth={strokeWidth}\n />\n </svg>\n );\n },\n);\n"],"names":["makePrefixer","forwardRef","jsx","clsx"],"mappings":";;;;;;;AAIA,MAAM,YAAA,GAAeA,kBAAa,kCAAkC,CAAA;AA0B7D,MAAM,4BAAA,GAA+BC,gBAAA;AAAA,EAI1C,CACE;AAAA,IACE,MAAA;AAAA,IACA,SAAA;AAAA,IACA,MAAA;AAAA,IACA,IAAA;AAAA,IACA;AAAA,KAEF,GAAA,KACG;AACH,IAAA,uBACEC,cAAA;AAAA,MAAC,KAAA;AAAA,MAAA;AAAA,QACC,SAAA,EAAWC,SAAA,CAAK,YAAA,EAAa,EAAG,SAAS,CAAA;AAAA,QACzC,KAAA,EAAO,IAAA;AAAA,QACP,MAAA,EAAQ,IAAA;AAAA,QACR,aAAA,EAAW,IAAA;AAAA,QACX,GAAA;AAAA,QAEA,QAAA,kBAAAD,cAAA;AAAA,UAAC,QAAA;AAAA,UAAA;AAAA,YACC,GAAA,EAAK,MAAA;AAAA,YACL,SAAA,EAAW,aAAa,KAAK,CAAA;AAAA,YAC7B,IAAI,IAAA,GAAO,CAAA;AAAA,YACX,IAAI,IAAA,GAAO,CAAA;AAAA,YACX,CAAA,EAAG,MAAA;AAAA,YACH;AAAA;AAAA;AACF;AAAA,KACF;AAAA,EAEJ;AACF;;;;"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var css_248z = ".saltCarouselCard {\n display: flex;\n transform: translate3d(0, 0, 0);\n flex: 0 0 var(--carousel-slide-size);\n min-width: 0;\n padding-left: var(--carousel-slide-spacing);\n box-sizing: border-box;\n}\n\n.saltCarouselCard-content {\n display: flex;\n user-select: none;\n overflow: hidden;\n flex-direction: column;\n gap: var(--salt-spacing-200);\n flex-grow: 1;\n}\n\n.saltCarouselCard-
|
|
3
|
+
var css_248z = ".saltCarouselCard {\n display: flex;\n transform: translate3d(0, 0, 0);\n flex: 0 0 var(--carousel-slide-size);\n min-width: 0;\n padding-left: var(--carousel-slide-spacing);\n box-sizing: border-box;\n}\n\n.saltCarouselCard-content {\n display: flex;\n user-select: none;\n overflow: hidden;\n flex-direction: column;\n gap: var(--salt-spacing-200);\n flex-grow: 1;\n}\n\n.saltCarouselCard:focus-visible {\n outline: none;\n}\n\n.saltCarouselCard:not(.saltCarouselCard-bordered):focus-visible::after {\n content: \"\";\n position: absolute;\n top: 0;\n bottom: 0;\n left: var(--carousel-slide-spacing);\n right: 0;\n outline: var(--salt-focused-outline);\n outline-offset: calc(var(--salt-focused-outlineWidth) * -1);\n cursor: var(--salt-cursor-hover);\n}\n\n.saltCarouselCard-bordered:focus-visible::after {\n content: \"\";\n position: absolute;\n top: 0;\n bottom: 0;\n left: var(--carousel-slide-spacing);\n right: 0;\n outline: var(--salt-focused-outline);\n outline-offset: calc(var(--salt-focused-outlineWidth) * -1);\n cursor: var(--salt-cursor-hover);\n border-radius: var(--salt-palette-corner, 0);\n}\n\n.saltCarouselCard-body {\n display: flex;\n overflow: hidden;\n flex-direction: column;\n flex-grow: 1;\n padding-bottom: var(--salt-spacing-200);\n}\n\n.saltCarouselCard-header {\n padding-bottom: var(--salt-spacing-100);\n}\n.saltCarouselCard-actions {\n padding-top: var(--salt-spacing-200);\n}\n\n.saltCarouselCard-body.saltCarouselCard-bordered-body {\n padding: 0 var(--salt-spacing-200) var(--salt-spacing-200) var(--salt-spacing-200);\n}\n\n.saltCarouselCard-content h2,\n.saltCarouselCard-content h3 {\n margin: 0;\n}\n\n.saltCarouselCard-bordered-content {\n background: var(--salt-container-primary-background);\n border: var(--salt-size-fixed-100) var(--salt-container-borderStyle) var(--salt-container-primary-borderColor);\n border-radius: var(--salt-palette-corner, 0);\n}\n";
|
|
4
4
|
|
|
5
5
|
module.exports = css_248z;
|
|
6
6
|
//# sourceMappingURL=CarouselCard.css.js.map
|
package/dist-cjs/CarouselCard.js
CHANGED
|
@@ -7,6 +7,7 @@ var window = require('@salt-ds/window');
|
|
|
7
7
|
var clsx = require('clsx');
|
|
8
8
|
var react = require('react');
|
|
9
9
|
var CarouselCard$1 = require('./CarouselCard.css.js');
|
|
10
|
+
var CarouselContext = require('./CarouselContext.js');
|
|
10
11
|
|
|
11
12
|
const withBaseName = core.makePrefixer("saltCarouselCard");
|
|
12
13
|
const CarouselCard = react.forwardRef(
|
|
@@ -17,27 +18,40 @@ const CarouselCard = react.forwardRef(
|
|
|
17
18
|
css: CarouselCard$1,
|
|
18
19
|
window: targetWindow
|
|
19
20
|
});
|
|
21
|
+
const { ariaVariant } = CarouselContext.useCarouselContext();
|
|
20
22
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
21
23
|
"div",
|
|
22
24
|
{
|
|
23
|
-
role: "tabpanel",
|
|
24
25
|
"aria-roledescription": "slide",
|
|
25
|
-
className: clsx.clsx(
|
|
26
|
-
|
|
26
|
+
className: clsx.clsx([
|
|
27
|
+
withBaseName(),
|
|
28
|
+
{ [withBaseName("bordered")]: appearance === "bordered" },
|
|
29
|
+
className
|
|
30
|
+
]),
|
|
27
31
|
ref,
|
|
32
|
+
role: ariaVariant,
|
|
33
|
+
...rest,
|
|
28
34
|
children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
29
35
|
"div",
|
|
30
36
|
{
|
|
31
37
|
className: clsx.clsx(withBaseName("content"), {
|
|
32
|
-
[withBaseName("bordered")]: appearance === "bordered"
|
|
38
|
+
[withBaseName("bordered-content")]: appearance === "bordered"
|
|
33
39
|
}),
|
|
34
40
|
children: [
|
|
35
41
|
media,
|
|
36
|
-
children && /* @__PURE__ */ jsxRuntime.jsxs(
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
42
|
+
children && /* @__PURE__ */ jsxRuntime.jsxs(
|
|
43
|
+
"div",
|
|
44
|
+
{
|
|
45
|
+
className: clsx.clsx(withBaseName("body"), {
|
|
46
|
+
[withBaseName("bordered-body")]: appearance === "bordered"
|
|
47
|
+
}),
|
|
48
|
+
children: [
|
|
49
|
+
header ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: withBaseName("header"), children: header }) : null,
|
|
50
|
+
children,
|
|
51
|
+
actions ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: withBaseName("actions"), children: actions }) : null
|
|
52
|
+
]
|
|
53
|
+
}
|
|
54
|
+
)
|
|
41
55
|
]
|
|
42
56
|
}
|
|
43
57
|
)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CarouselCard.js","sources":["../src/CarouselCard.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 ComponentProps, forwardRef, type ReactNode } from \"react\";\nimport saltCarouselCardCss from \"./CarouselCard.css\";\n\nconst withBaseName = makePrefixer(\"saltCarouselCard\");\n\n/**\n * Props for the CarouselCard component.\n */\nexport interface CarouselCardProps extends ComponentProps<\"div\"> {\n /**\n * Actions to be displayed in the content footer.\n * This can include buttons or any other interactive elements.\n */\n actions?: ReactNode;\n\n /**\n * Media content to be displayed inside the slide.\n * This could include images, videos, etc., that are visually prominent.\n * It differs from children in that media is intended to be the main visual element of the slide.\n */\n media?: ReactNode;\n\n /**\n * The appearance of the slide. Options are 'bordered', and 'transparent'.\n * 'transparent' is the default value.\n **/\n appearance?: \"bordered\" | \"transparent\";\n\n /**\n * Header content to be displayed at the top of the slide.\n * This can be text or any other React node.\n */\n header?: ReactNode;\n\n /**\n * Carousel slide id.\n * This can be used to uniquely identify the slide.\n */\n id?: string;\n}\n\nexport const CarouselCard = forwardRef<HTMLDivElement, CarouselCardProps>(\n function CarouselCard(\n { actions, appearance, children, className, header, media, ...rest },\n ref,\n ) {\n const targetWindow = useWindow();\n useComponentCssInjection({\n testId: \"salt-carousel-card\",\n css: saltCarouselCardCss,\n window: targetWindow,\n });\n\n return (\n <div\n
|
|
1
|
+
{"version":3,"file":"CarouselCard.js","sources":["../src/CarouselCard.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 ComponentProps, forwardRef, type ReactNode } from \"react\";\nimport saltCarouselCardCss from \"./CarouselCard.css\";\nimport { useCarouselContext } from \"./CarouselContext\";\n\nconst withBaseName = makePrefixer(\"saltCarouselCard\");\n\n/**\n * Props for the CarouselCard component.\n */\nexport interface CarouselCardProps extends ComponentProps<\"div\"> {\n /**\n * Actions to be displayed in the content footer.\n * This can include buttons or any other interactive elements.\n */\n actions?: ReactNode;\n\n /**\n * Media content to be displayed inside the slide.\n * This could include images, videos, etc., that are visually prominent.\n * It differs from children in that media is intended to be the main visual element of the slide.\n */\n media?: ReactNode;\n\n /**\n * The appearance of the slide. Options are 'bordered', and 'transparent'.\n * 'transparent' is the default value.\n **/\n appearance?: \"bordered\" | \"transparent\";\n\n /**\n * Header content to be displayed at the top of the slide.\n * This can be text or any other React node.\n */\n header?: ReactNode;\n\n /**\n * Carousel slide id.\n * This can be used to uniquely identify the slide.\n */\n id?: string;\n}\n\nexport const CarouselCard = forwardRef<HTMLDivElement, CarouselCardProps>(\n function CarouselCard(\n { actions, appearance, children, className, header, media, ...rest },\n ref,\n ) {\n const targetWindow = useWindow();\n useComponentCssInjection({\n testId: \"salt-carousel-card\",\n css: saltCarouselCardCss,\n window: targetWindow,\n });\n\n const { ariaVariant } = useCarouselContext();\n\n return (\n <div\n aria-roledescription=\"slide\"\n className={clsx([\n withBaseName(),\n { [withBaseName(\"bordered\")]: appearance === \"bordered\" },\n className,\n ])}\n ref={ref}\n role={ariaVariant}\n {...rest}\n >\n <div\n className={clsx(withBaseName(\"content\"), {\n [withBaseName(\"bordered-content\")]: appearance === \"bordered\",\n })}\n >\n {media}\n {children && (\n <div\n className={clsx(withBaseName(\"body\"), {\n [withBaseName(\"bordered-body\")]: appearance === \"bordered\",\n })}\n >\n {header ? (\n <div className={withBaseName(\"header\")}>{header}</div>\n ) : null}\n {children}\n {actions ? (\n <div className={withBaseName(\"actions\")}>{actions}</div>\n ) : null}\n </div>\n )}\n </div>\n </div>\n );\n },\n);\n"],"names":["makePrefixer","forwardRef","CarouselCard","useWindow","useComponentCssInjection","saltCarouselCardCss","useCarouselContext","jsx","clsx","jsxs"],"mappings":";;;;;;;;;;;AAQA,MAAM,YAAA,GAAeA,kBAAa,kBAAkB,CAAA;AAsC7C,MAAM,YAAA,GAAeC,gBAAA;AAAA,EAC1B,SAASC,aAAAA,CACP,EAAE,OAAA,EAAS,UAAA,EAAY,QAAA,EAAU,SAAA,EAAW,MAAA,EAAQ,KAAA,EAAO,GAAG,IAAA,EAAK,EACnE,GAAA,EACA;AACA,IAAA,MAAM,eAAeC,gBAAA,EAAU;AAC/B,IAAAC,+BAAA,CAAyB;AAAA,MACvB,MAAA,EAAQ,oBAAA;AAAA,MACR,GAAA,EAAKC,cAAA;AAAA,MACL,MAAA,EAAQ;AAAA,KACT,CAAA;AAED,IAAA,MAAM,EAAE,WAAA,EAAY,GAAIC,kCAAA,EAAmB;AAE3C,IAAA,uBACEC,cAAA;AAAA,MAAC,KAAA;AAAA,MAAA;AAAA,QACC,sBAAA,EAAqB,OAAA;AAAA,QACrB,WAAWC,SAAA,CAAK;AAAA,UACd,YAAA,EAAa;AAAA,UACb,EAAE,CAAC,YAAA,CAAa,UAAU,CAAC,GAAG,eAAe,UAAA,EAAW;AAAA,UACxD;AAAA,SACD,CAAA;AAAA,QACD,GAAA;AAAA,QACA,IAAA,EAAM,WAAA;AAAA,QACL,GAAG,IAAA;AAAA,QAEJ,QAAA,kBAAAC,eAAA;AAAA,UAAC,KAAA;AAAA,UAAA;AAAA,YACC,SAAA,EAAWD,SAAA,CAAK,YAAA,CAAa,SAAS,CAAA,EAAG;AAAA,cACvC,CAAC,YAAA,CAAa,kBAAkB,CAAC,GAAG,UAAA,KAAe;AAAA,aACpD,CAAA;AAAA,YAEA,QAAA,EAAA;AAAA,cAAA,KAAA;AAAA,cACA,QAAA,oBACCC,eAAA;AAAA,gBAAC,KAAA;AAAA,gBAAA;AAAA,kBACC,SAAA,EAAWD,SAAA,CAAK,YAAA,CAAa,MAAM,CAAA,EAAG;AAAA,oBACpC,CAAC,YAAA,CAAa,eAAe,CAAC,GAAG,UAAA,KAAe;AAAA,mBACjD,CAAA;AAAA,kBAEA,QAAA,EAAA;AAAA,oBAAA,MAAA,kCACE,KAAA,EAAA,EAAI,SAAA,EAAW,aAAa,QAAQ,CAAA,EAAI,kBAAO,CAAA,GAC9C,IAAA;AAAA,oBACH,QAAA;AAAA,oBACA,OAAA,kCACE,KAAA,EAAA,EAAI,SAAA,EAAW,aAAa,SAAS,CAAA,EAAI,mBAAQ,CAAA,GAChD;AAAA;AAAA;AAAA;AACN;AAAA;AAAA;AAEJ;AAAA,KACF;AAAA,EAEJ;AACF;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CarouselContext.js","sources":["../src/CarouselContext.tsx"],"sourcesContent":["import { createContext } from \"@salt-ds/core\";\nimport { useContext } from \"react\";\nimport type { CarouselEmblaApiType, CarouselEmblaRefType } from \"./Carousel\";\n\n/**\n * Type definition for the Carousel context.\n * Provides access to the Embla Carousel API and reference.\n */\ninterface CarouselContextType {\n /**\n * The API instance of the Embla Carousel.\n * Provides methods to control the carousel programmatically.\n */\n emblaApi?: CarouselEmblaApiType;\n\n /**\n * The reference to the Embla Carousel viewport.\n * Used to directly interact with the carousel DOM element.\n */\n emblaRef?: CarouselEmblaRefType;\n}\n\nexport const CarouselContext = createContext<CarouselContextType | undefined>(\n \"CarouselContext\",\n undefined,\n);\n\nexport const useCarouselContext = (): CarouselContextType => {\n const context = useContext(CarouselContext);\n if (!context) {\n throw new Error(\n \"useCarouselContext must be used within a CarouselProvider\",\n );\n }\n return context;\n};\n"],"names":["createContext","useContext"],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"CarouselContext.js","sources":["../src/CarouselContext.tsx"],"sourcesContent":["import { createContext } from \"@salt-ds/core\";\nimport { type Dispatch, type SetStateAction, useContext } from \"react\";\nimport type { CarouselEmblaApiType, CarouselEmblaRefType } from \"./Carousel\";\n\nexport type CarouselAriaVariant = \"group\" | \"tabpanel\";\n\nexport type CarouselAnnouncementTrigger =\n | \"tab\"\n | \"navigation\"\n | \"drag\"\n | \"focus\";\n\n/**\n * Type definition for the Carousel context.\n * Provides access to the Embla Carousel API and reference.\n */\ninterface CarouselContextType {\n /**\n * The API instance of the Embla Carousel.\n * Provides methods to control the carousel programmatically.\n */\n emblaApi?: CarouselEmblaApiType;\n\n /**\n * The reference to the Embla Carousel viewport.\n * Used to directly interact with the carousel DOM element.\n */\n emblaRef?: CarouselEmblaRefType;\n /**\n * Aria variant for the Carousel.\n * When used with a `CarouselTabList` the screenreader will be presented as a `tablist` of tabpanels.\n * When used without a `CarouselTabList` the screenreader will be presented as a `group` of slides.\n */\n ariaVariant: CarouselAriaVariant;\n /**\n * Function to set the aria variant for the Carousel.\n */\n setAriaVariant: Dispatch<SetStateAction<CarouselAriaVariant>>;\n /**\n * Disable screenreader announcing slide updates, defaults to false.\n */\n disableSlideAnnouncements?: boolean;\n /**\n * Id for the carousel\n */\n carouselId: string | undefined;\n /**\n * Announcement state, determines whether change is communicated to screenreader.\n * @param trigger\n */\n announcementState: CarouselAnnouncementTrigger | undefined;\n /**\n * Set announcement state, determines whether change is communicated to screenreader.\n * @param trigger\n */\n setAnnouncementState: (\n trigger: CarouselAnnouncementTrigger | undefined,\n ) => void;\n}\n\nexport const CarouselContext = createContext<CarouselContextType | undefined>(\n \"CarouselContext\",\n undefined,\n);\n\nexport const useCarouselContext = (): CarouselContextType => {\n const context = useContext(CarouselContext);\n if (!context) {\n throw new Error(\n \"useCarouselContext must be used within a CarouselProvider\",\n );\n }\n return context;\n};\n"],"names":["createContext","useContext"],"mappings":";;;;;AA4DO,MAAM,eAAA,GAAkBA,kBAAA;AAAA,EAC7B,iBAAA;AAAA,EACA;AACF;AAEO,MAAM,qBAAqB,MAA2B;AAC3D,EAAA,MAAM,OAAA,GAAUC,iBAAW,eAAe,CAAA;AAC1C,EAAA,IAAI,CAAC,OAAA,EAAS;AACZ,IAAA,MAAM,IAAI,KAAA;AAAA,MACR;AAAA,KACF;AAAA,EACF;AACA,EAAA,OAAO,OAAA;AACT;;;;;"}
|
|
@@ -3,11 +3,13 @@
|
|
|
3
3
|
var jsxRuntime = require('react/jsx-runtime');
|
|
4
4
|
var core = require('@salt-ds/core');
|
|
5
5
|
var react = require('react');
|
|
6
|
+
var CarouselContext = require('./CarouselContext.js');
|
|
6
7
|
var usePrevNextButtons = require('./usePrevNextButtons.js');
|
|
7
8
|
|
|
8
9
|
const CarouselNextButton = react.forwardRef(function CarouselNextButton2({ className, onClick, ...rest }, ref) {
|
|
9
10
|
const { NextIcon } = core.useIcon();
|
|
10
11
|
const { nextBtnDisabled, onNextButtonClick } = usePrevNextButtons.usePrevNextButtons();
|
|
12
|
+
const { carouselId } = CarouselContext.useCarouselContext();
|
|
11
13
|
const handleClick = (event) => {
|
|
12
14
|
onNextButtonClick();
|
|
13
15
|
onClick == null ? void 0 : onClick(event);
|
|
@@ -18,7 +20,8 @@ const CarouselNextButton = react.forwardRef(function CarouselNextButton2({ class
|
|
|
18
20
|
onClick: handleClick,
|
|
19
21
|
disabled: nextBtnDisabled,
|
|
20
22
|
focusableWhenDisabled: true,
|
|
21
|
-
appearance: "
|
|
23
|
+
appearance: "transparent",
|
|
24
|
+
"aria-controls": `${carouselId}-slides`,
|
|
22
25
|
sentiment: "neutral",
|
|
23
26
|
"aria-label": "Next slide",
|
|
24
27
|
ref,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CarouselNextButton.js","sources":["../src/CarouselNextButton.tsx"],"sourcesContent":["import { Button, type ButtonProps, useIcon } from \"@salt-ds/core\";\nimport { forwardRef, type MouseEventHandler } from \"react\";\nimport { usePrevNextButtons } from \"./usePrevNextButtons\";\n\n/**\n * Props for the CarouselNextButton component.\n */\nexport interface CarouselNextButtonProps\n extends Omit<ButtonProps, \"variant\" | \"loading\" | \"loadingAnnouncement\"> {}\n\nexport const CarouselNextButton = forwardRef<\n HTMLButtonElement,\n CarouselNextButtonProps\n>(function CarouselNextButton({ className, onClick, ...rest }, ref) {\n const { NextIcon } = useIcon();\n const { nextBtnDisabled, onNextButtonClick } = usePrevNextButtons();\n\n const handleClick: MouseEventHandler<HTMLButtonElement> = (event) => {\n onNextButtonClick();\n onClick?.(event);\n };\n\n return (\n <Button\n onClick={handleClick}\n disabled={nextBtnDisabled}\n focusableWhenDisabled\n appearance=\"
|
|
1
|
+
{"version":3,"file":"CarouselNextButton.js","sources":["../src/CarouselNextButton.tsx"],"sourcesContent":["import { Button, type ButtonProps, useIcon } from \"@salt-ds/core\";\nimport { forwardRef, type MouseEventHandler } from \"react\";\nimport { useCarouselContext } from \"./CarouselContext\";\nimport { usePrevNextButtons } from \"./usePrevNextButtons\";\n\n/**\n * Props for the CarouselNextButton component.\n */\nexport interface CarouselNextButtonProps\n extends Omit<ButtonProps, \"variant\" | \"loading\" | \"loadingAnnouncement\"> {}\n\nexport const CarouselNextButton = forwardRef<\n HTMLButtonElement,\n CarouselNextButtonProps\n>(function CarouselNextButton({ className, onClick, ...rest }, ref) {\n const { NextIcon } = useIcon();\n const { nextBtnDisabled, onNextButtonClick } = usePrevNextButtons();\n\n const { carouselId } = useCarouselContext();\n\n const handleClick: MouseEventHandler<HTMLButtonElement> = (event) => {\n onNextButtonClick();\n onClick?.(event);\n };\n\n return (\n <Button\n onClick={handleClick}\n disabled={nextBtnDisabled}\n focusableWhenDisabled\n appearance=\"transparent\"\n aria-controls={`${carouselId}-slides`}\n sentiment=\"neutral\"\n aria-label=\"Next slide\"\n ref={ref}\n {...rest}\n >\n <NextIcon aria-hidden />\n </Button>\n );\n});\n"],"names":["forwardRef","CarouselNextButton","useIcon","usePrevNextButtons","useCarouselContext","jsx","Button"],"mappings":";;;;;;;;AAWO,MAAM,kBAAA,GAAqBA,gBAAA,CAGhC,SAASC,mBAAAA,CAAmB,EAAE,WAAW,OAAA,EAAS,GAAG,IAAA,EAAK,EAAG,GAAA,EAAK;AAClE,EAAA,MAAM,EAAE,QAAA,EAAS,GAAIC,YAAA,EAAQ;AAC7B,EAAA,MAAM,EAAE,eAAA,EAAiB,iBAAA,EAAkB,GAAIC,qCAAA,EAAmB;AAElE,EAAA,MAAM,EAAE,UAAA,EAAW,GAAIC,kCAAA,EAAmB;AAE1C,EAAA,MAAM,WAAA,GAAoD,CAAC,KAAA,KAAU;AACnE,IAAA,iBAAA,EAAkB;AAClB,IAAA,OAAA,IAAA,IAAA,GAAA,MAAA,GAAA,OAAA,CAAU,KAAA,CAAA;AAAA,EACZ,CAAA;AAEA,EAAA,uBACEC,cAAA;AAAA,IAACC,WAAA;AAAA,IAAA;AAAA,MACC,OAAA,EAAS,WAAA;AAAA,MACT,QAAA,EAAU,eAAA;AAAA,MACV,qBAAA,EAAqB,IAAA;AAAA,MACrB,UAAA,EAAW,aAAA;AAAA,MACX,eAAA,EAAe,GAAG,UAAU,CAAA,OAAA,CAAA;AAAA,MAC5B,SAAA,EAAU,SAAA;AAAA,MACV,YAAA,EAAW,YAAA;AAAA,MACX,GAAA;AAAA,MACC,GAAG,IAAA;AAAA,MAEJ,QAAA,kBAAAD,cAAA,CAAC,QAAA,EAAA,EAAS,aAAA,EAAW,IAAA,EAAC;AAAA;AAAA,GACxB;AAEJ,CAAC;;;;"}
|
|
@@ -3,11 +3,13 @@
|
|
|
3
3
|
var jsxRuntime = require('react/jsx-runtime');
|
|
4
4
|
var core = require('@salt-ds/core');
|
|
5
5
|
var react = require('react');
|
|
6
|
+
var CarouselContext = require('./CarouselContext.js');
|
|
6
7
|
var usePrevNextButtons = require('./usePrevNextButtons.js');
|
|
7
8
|
|
|
8
9
|
const CarouselPreviousButton = react.forwardRef(function CarouselPreviousButton2({ className, onClick, ...rest }, ref) {
|
|
9
10
|
const { PreviousIcon } = core.useIcon();
|
|
10
11
|
const { prevBtnDisabled, onPrevButtonClick } = usePrevNextButtons.usePrevNextButtons();
|
|
12
|
+
const { carouselId } = CarouselContext.useCarouselContext();
|
|
11
13
|
const handleClick = (event) => {
|
|
12
14
|
onPrevButtonClick();
|
|
13
15
|
onClick == null ? void 0 : onClick(event);
|
|
@@ -18,7 +20,8 @@ const CarouselPreviousButton = react.forwardRef(function CarouselPreviousButton2
|
|
|
18
20
|
onClick: handleClick,
|
|
19
21
|
disabled: prevBtnDisabled,
|
|
20
22
|
focusableWhenDisabled: true,
|
|
21
|
-
appearance: "
|
|
23
|
+
appearance: "transparent",
|
|
24
|
+
"aria-controls": `${carouselId}-slides`,
|
|
22
25
|
sentiment: "neutral",
|
|
23
26
|
"aria-label": "Previous slide",
|
|
24
27
|
ref,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CarouselPreviousButton.js","sources":["../src/CarouselPreviousButton.tsx"],"sourcesContent":["import { Button, type ButtonProps, useIcon } from \"@salt-ds/core\";\nimport { forwardRef, type MouseEventHandler } from \"react\";\nimport { usePrevNextButtons } from \"./usePrevNextButtons\";\n\n/**\n * Props for the CarouselPreviousButton component.\n */\nexport interface CarouselPreviousButtonProps\n extends Omit<ButtonProps, \"variant\" | \"loading\" | \"loadingAnnouncement\"> {}\n\nexport const CarouselPreviousButton = forwardRef<\n HTMLButtonElement,\n CarouselPreviousButtonProps\n>(function CarouselPreviousButton({ className, onClick, ...rest }, ref) {\n const { PreviousIcon } = useIcon();\n const { prevBtnDisabled, onPrevButtonClick } = usePrevNextButtons();\n\n const handleClick: MouseEventHandler<HTMLButtonElement> = (event) => {\n onPrevButtonClick();\n onClick?.(event);\n };\n\n return (\n <Button\n onClick={handleClick}\n disabled={prevBtnDisabled}\n focusableWhenDisabled\n appearance=\"
|
|
1
|
+
{"version":3,"file":"CarouselPreviousButton.js","sources":["../src/CarouselPreviousButton.tsx"],"sourcesContent":["import { Button, type ButtonProps, useIcon } from \"@salt-ds/core\";\nimport { forwardRef, type MouseEventHandler } from \"react\";\nimport { useCarouselContext } from \"./CarouselContext\";\nimport { usePrevNextButtons } from \"./usePrevNextButtons\";\n\n/**\n * Props for the CarouselPreviousButton component.\n */\nexport interface CarouselPreviousButtonProps\n extends Omit<ButtonProps, \"variant\" | \"loading\" | \"loadingAnnouncement\"> {}\n\nexport const CarouselPreviousButton = forwardRef<\n HTMLButtonElement,\n CarouselPreviousButtonProps\n>(function CarouselPreviousButton({ className, onClick, ...rest }, ref) {\n const { PreviousIcon } = useIcon();\n const { prevBtnDisabled, onPrevButtonClick } = usePrevNextButtons();\n\n const { carouselId } = useCarouselContext();\n\n const handleClick: MouseEventHandler<HTMLButtonElement> = (event) => {\n onPrevButtonClick();\n onClick?.(event);\n };\n\n return (\n <Button\n onClick={handleClick}\n disabled={prevBtnDisabled}\n focusableWhenDisabled\n appearance=\"transparent\"\n aria-controls={`${carouselId}-slides`}\n sentiment=\"neutral\"\n aria-label=\"Previous slide\"\n ref={ref}\n {...rest}\n >\n <PreviousIcon aria-hidden />\n </Button>\n );\n});\n"],"names":["forwardRef","CarouselPreviousButton","useIcon","usePrevNextButtons","useCarouselContext","jsx","Button"],"mappings":";;;;;;;;AAWO,MAAM,sBAAA,GAAyBA,gBAAA,CAGpC,SAASC,uBAAAA,CAAuB,EAAE,WAAW,OAAA,EAAS,GAAG,IAAA,EAAK,EAAG,GAAA,EAAK;AACtE,EAAA,MAAM,EAAE,YAAA,EAAa,GAAIC,YAAA,EAAQ;AACjC,EAAA,MAAM,EAAE,eAAA,EAAiB,iBAAA,EAAkB,GAAIC,qCAAA,EAAmB;AAElE,EAAA,MAAM,EAAE,UAAA,EAAW,GAAIC,kCAAA,EAAmB;AAE1C,EAAA,MAAM,WAAA,GAAoD,CAAC,KAAA,KAAU;AACnE,IAAA,iBAAA,EAAkB;AAClB,IAAA,OAAA,IAAA,IAAA,GAAA,MAAA,GAAA,OAAA,CAAU,KAAA,CAAA;AAAA,EACZ,CAAA;AAEA,EAAA,uBACEC,cAAA;AAAA,IAACC,WAAA;AAAA,IAAA;AAAA,MACC,OAAA,EAAS,WAAA;AAAA,MACT,QAAA,EAAU,eAAA;AAAA,MACV,qBAAA,EAAqB,IAAA;AAAA,MACrB,UAAA,EAAW,aAAA;AAAA,MACX,eAAA,EAAe,GAAG,UAAU,CAAA,OAAA,CAAA;AAAA,MAC5B,SAAA,EAAU,SAAA;AAAA,MACV,YAAA,EAAW,gBAAA;AAAA,MACX,GAAA;AAAA,MACC,GAAG,IAAA;AAAA,MAEJ,QAAA,kBAAAD,cAAA,CAAC,YAAA,EAAA,EAAa,aAAA,EAAW,IAAA,EAAC;AAAA;AAAA,GAC5B;AAEJ,CAAC;;;;"}
|