@spark-ui/components 10.22.1 → 11.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +5 -5
- package/dist/DialogTrigger-woU7vsJi.d.ts +0 -142
- package/dist/Input-N8AWWSmt.d.ts +0 -41
- package/dist/InputTrailingIcon-ZZx8PoJy.d.ts +0 -20
- package/dist/LabelRequiredIndicator-DRnCzHMU.d.ts +0 -19
- package/dist/accordion/index.d.ts +0 -73
- package/dist/accordion/index.js +0 -325
- package/dist/accordion/index.js.map +0 -1
- package/dist/alert-dialog/index.d.ts +0 -119
- package/dist/alert-dialog/index.js +0 -1554
- package/dist/alert-dialog/index.js.map +0 -1
- package/dist/avatar/index.d.ts +0 -66
- package/dist/avatar/index.js +0 -1303
- package/dist/avatar/index.js.map +0 -1
- package/dist/badge/index.d.ts +0 -47
- package/dist/badge/index.js +0 -122
- package/dist/badge/index.js.map +0 -1
- package/dist/breadcrumb/index.d.ts +0 -64
- package/dist/breadcrumb/index.js +0 -327
- package/dist/breadcrumb/index.js.map +0 -1
- package/dist/button/index.d.ts +0 -41
- package/dist/button/index.js +0 -935
- package/dist/button/index.js.map +0 -1
- package/dist/card/index.d.ts +0 -61
- package/dist/card/index.js +0 -502
- package/dist/card/index.js.map +0 -1
- package/dist/carousel/index.d.ts +0 -261
- package/dist/carousel/index.js +0 -1801
- package/dist/carousel/index.js.map +0 -1
- package/dist/checkbox/index.d.ts +0 -120
- package/dist/checkbox/index.js +0 -511
- package/dist/checkbox/index.js.map +0 -1
- package/dist/chip/index.d.ts +0 -97
- package/dist/chip/index.js +0 -908
- package/dist/chip/index.js.map +0 -1
- package/dist/collapsible/index.d.ts +0 -43
- package/dist/collapsible/index.js +0 -109
- package/dist/collapsible/index.js.map +0 -1
- package/dist/combobox/index.d.ts +0 -287
- package/dist/combobox/index.js +0 -2588
- package/dist/combobox/index.js.map +0 -1
- package/dist/dialog/index.d.ts +0 -33
- package/dist/dialog/index.js +0 -1389
- package/dist/dialog/index.js.map +0 -1
- package/dist/divider/index.d.ts +0 -61
- package/dist/divider/index.js +0 -224
- package/dist/divider/index.js.map +0 -1
- package/dist/drawer/index.d.ts +0 -152
- package/dist/drawer/index.js +0 -1400
- package/dist/drawer/index.js.map +0 -1
- package/dist/dropdown/index.d.ts +0 -233
- package/dist/dropdown/index.js +0 -2051
- package/dist/dropdown/index.js.map +0 -1
- package/dist/form-field/index.d.ts +0 -186
- package/dist/form-field/index.js +0 -553
- package/dist/form-field/index.js.map +0 -1
- package/dist/icon/index.d.ts +0 -28
- package/dist/icon/index.js +0 -127
- package/dist/icon/index.js.map +0 -1
- package/dist/icon-button/index.d.ts +0 -16
- package/dist/icon-button/index.js +0 -980
- package/dist/icon-button/index.js.map +0 -1
- package/dist/input/index.d.ts +0 -78
- package/dist/input/index.js +0 -724
- package/dist/input/index.js.map +0 -1
- package/dist/kbd/index.d.ts +0 -9
- package/dist/kbd/index.js +0 -47
- package/dist/kbd/index.js.map +0 -1
- package/dist/label/index.d.ts +0 -11
- package/dist/label/index.js +0 -78
- package/dist/label/index.js.map +0 -1
- package/dist/link-box/index.d.ts +0 -34
- package/dist/link-box/index.js +0 -92
- package/dist/link-box/index.js.map +0 -1
- package/dist/pagination/index.d.ts +0 -143
- package/dist/pagination/index.js +0 -1353
- package/dist/pagination/index.js.map +0 -1
- package/dist/popover/index.d.ts +0 -93
- package/dist/popover/index.js +0 -1339
- package/dist/popover/index.js.map +0 -1
- package/dist/portal/index.d.ts +0 -13
- package/dist/portal/index.js +0 -37
- package/dist/portal/index.js.map +0 -1
- package/dist/progress/index.d.ts +0 -48
- package/dist/progress/index.js +0 -223
- package/dist/progress/index.js.map +0 -1
- package/dist/progress-tracker/index.d.ts +0 -80
- package/dist/progress-tracker/index.js +0 -571
- package/dist/progress-tracker/index.js.map +0 -1
- package/dist/radio-group/index.d.ts +0 -100
- package/dist/radio-group/index.js +0 -318
- package/dist/radio-group/index.js.map +0 -1
- package/dist/rating/index.d.ts +0 -78
- package/dist/rating/index.js +0 -363
- package/dist/rating/index.js.map +0 -1
- package/dist/scrolling-list/index.d.ts +0 -118
- package/dist/scrolling-list/index.js +0 -1426
- package/dist/scrolling-list/index.js.map +0 -1
- package/dist/segmented-gauge/index.d.ts +0 -100
- package/dist/segmented-gauge/index.js +0 -277
- package/dist/segmented-gauge/index.js.map +0 -1
- package/dist/select/index.d.ts +0 -167
- package/dist/select/index.js +0 -581
- package/dist/select/index.js.map +0 -1
- package/dist/skeleton/index.d.ts +0 -67
- package/dist/skeleton/index.js +0 -206
- package/dist/skeleton/index.js.map +0 -1
- package/dist/slider/index.d.ts +0 -97
- package/dist/slider/index.js +0 -220
- package/dist/slider/index.js.map +0 -1
- package/dist/slot/index.d.ts +0 -16
- package/dist/slot/index.js +0 -51
- package/dist/slot/index.js.map +0 -1
- package/dist/snackbar/index.d.ts +0 -158
- package/dist/snackbar/index.js +0 -1756
- package/dist/snackbar/index.js.map +0 -1
- package/dist/spinner/index.d.ts +0 -21
- package/dist/spinner/index.js +0 -139
- package/dist/spinner/index.js.map +0 -1
- package/dist/stepper/index.d.ts +0 -81
- package/dist/stepper/index.js +0 -1847
- package/dist/stepper/index.js.map +0 -1
- package/dist/switch/index.d.ts +0 -64
- package/dist/switch/index.js +0 -327
- package/dist/switch/index.js.map +0 -1
- package/dist/tabs/index.d.ts +0 -103
- package/dist/tabs/index.js +0 -1376
- package/dist/tabs/index.js.map +0 -1
- package/dist/tag/index.d.ts +0 -29
- package/dist/tag/index.js +0 -283
- package/dist/tag/index.js.map +0 -1
- package/dist/text-link/index.d.ts +0 -20
- package/dist/text-link/index.js +0 -100
- package/dist/text-link/index.js.map +0 -1
- package/dist/textarea/index.d.ts +0 -57
- package/dist/textarea/index.js +0 -797
- package/dist/textarea/index.js.map +0 -1
- package/dist/toast/index.d.ts +0 -56
- package/dist/toast/index.js +0 -1412
- package/dist/toast/index.js.map +0 -1
- package/dist/visually-hidden/index.d.ts +0 -16
- package/dist/visually-hidden/index.js +0 -67
- package/dist/visually-hidden/index.js.map +0 -1
package/dist/carousel/index.js
DELETED
|
@@ -1,1801 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
|
|
20
|
-
// src/carousel/index.ts
|
|
21
|
-
var carousel_exports = {};
|
|
22
|
-
__export(carousel_exports, {
|
|
23
|
-
Carousel: () => Carousel2
|
|
24
|
-
});
|
|
25
|
-
module.exports = __toCommonJS(carousel_exports);
|
|
26
|
-
|
|
27
|
-
// src/carousel/Carousel.tsx
|
|
28
|
-
var import_class_variance_authority = require("class-variance-authority");
|
|
29
|
-
var import_react7 = require("react");
|
|
30
|
-
|
|
31
|
-
// src/carousel/useCarousel.ts
|
|
32
|
-
var import_react6 = require("react");
|
|
33
|
-
|
|
34
|
-
// src/carousel/useEvent.ts
|
|
35
|
-
var import_react = require("react");
|
|
36
|
-
function useEvent(callback) {
|
|
37
|
-
const ref = (0, import_react.useRef)(() => {
|
|
38
|
-
throw new Error("Cannot call an event handler while rendering.");
|
|
39
|
-
});
|
|
40
|
-
(0, import_react.useLayoutEffect)(() => {
|
|
41
|
-
ref.current = callback;
|
|
42
|
-
});
|
|
43
|
-
return (0, import_react.useCallback)((...args) => ref.current?.(...args), []);
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
// src/carousel/useIsMounted.ts
|
|
47
|
-
var import_react2 = require("react");
|
|
48
|
-
var useIsMounted = () => {
|
|
49
|
-
const isMounted = (0, import_react2.useRef)(false);
|
|
50
|
-
(0, import_react2.useEffect)(() => {
|
|
51
|
-
isMounted.current = true;
|
|
52
|
-
return () => {
|
|
53
|
-
isMounted.current = false;
|
|
54
|
-
};
|
|
55
|
-
}, []);
|
|
56
|
-
return isMounted;
|
|
57
|
-
};
|
|
58
|
-
|
|
59
|
-
// src/carousel/useScrollEnd.ts
|
|
60
|
-
var import_react3 = require("react");
|
|
61
|
-
function useScrollEnd(scrollRef, callback) {
|
|
62
|
-
const scrollLeft = (0, import_react3.useRef)(0);
|
|
63
|
-
const safariTimeout = (0, import_react3.useRef)(null);
|
|
64
|
-
(0, import_react3.useEffect)(() => {
|
|
65
|
-
const element = scrollRef.current;
|
|
66
|
-
if (!element) return;
|
|
67
|
-
const supportsScrollend = "onscrollend" in window;
|
|
68
|
-
const handleScrollEnd = () => {
|
|
69
|
-
callback();
|
|
70
|
-
};
|
|
71
|
-
const handleSafariScroll = () => {
|
|
72
|
-
if (safariTimeout.current) {
|
|
73
|
-
clearTimeout(safariTimeout.current);
|
|
74
|
-
}
|
|
75
|
-
if (scrollRef.current) {
|
|
76
|
-
scrollLeft.current = scrollRef.current.scrollLeft;
|
|
77
|
-
safariTimeout.current = setTimeout(() => {
|
|
78
|
-
if (scrollRef.current) {
|
|
79
|
-
handleScrollEnd();
|
|
80
|
-
}
|
|
81
|
-
}, 150);
|
|
82
|
-
}
|
|
83
|
-
};
|
|
84
|
-
if (supportsScrollend) {
|
|
85
|
-
element.addEventListener("scrollend", handleScrollEnd);
|
|
86
|
-
} else {
|
|
87
|
-
element.addEventListener("scroll", handleSafariScroll);
|
|
88
|
-
}
|
|
89
|
-
return () => {
|
|
90
|
-
if (safariTimeout.current) {
|
|
91
|
-
clearTimeout(safariTimeout.current);
|
|
92
|
-
}
|
|
93
|
-
if (supportsScrollend) {
|
|
94
|
-
element.removeEventListener("scrollend", handleScrollEnd);
|
|
95
|
-
} else {
|
|
96
|
-
element.removeEventListener("scroll", handleSafariScroll);
|
|
97
|
-
}
|
|
98
|
-
};
|
|
99
|
-
}, [callback, scrollRef]);
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
// src/carousel/useSnapPoints.ts
|
|
103
|
-
var import_react5 = require("react");
|
|
104
|
-
|
|
105
|
-
// src/carousel/useResizeObserver.ts
|
|
106
|
-
var import_react4 = require("react");
|
|
107
|
-
function useResizeObserver(ref, callback) {
|
|
108
|
-
(0, import_react4.useLayoutEffect)(() => {
|
|
109
|
-
const element = ref.current;
|
|
110
|
-
if (!element) return;
|
|
111
|
-
const observer = new ResizeObserver((entries) => {
|
|
112
|
-
for (const entry of entries) {
|
|
113
|
-
callback(entry.contentRect.width);
|
|
114
|
-
}
|
|
115
|
-
});
|
|
116
|
-
observer.observe(element);
|
|
117
|
-
return () => observer.disconnect();
|
|
118
|
-
}, [ref, callback]);
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
// src/carousel/utils.ts
|
|
122
|
-
function getSnapIndices({
|
|
123
|
-
totalSlides,
|
|
124
|
-
slidesPerMove,
|
|
125
|
-
slidesPerPage
|
|
126
|
-
}) {
|
|
127
|
-
const slideBy = slidesPerMove === "auto" ? slidesPerPage : slidesPerMove;
|
|
128
|
-
const snapPoints = [];
|
|
129
|
-
const lastSnapIndex = Math.floor((totalSlides - slidesPerPage) / slideBy) * slideBy;
|
|
130
|
-
for (let i = 0; i <= lastSnapIndex; i += slideBy) {
|
|
131
|
-
snapPoints.push(i);
|
|
132
|
-
}
|
|
133
|
-
if (snapPoints[snapPoints.length - 1] !== totalSlides - slidesPerPage) {
|
|
134
|
-
snapPoints.push(totalSlides - slidesPerPage);
|
|
135
|
-
}
|
|
136
|
-
return snapPoints;
|
|
137
|
-
}
|
|
138
|
-
function getSlideElements(container) {
|
|
139
|
-
return container ? Array.from(container.querySelectorAll('[data-part="item"]')) : [];
|
|
140
|
-
}
|
|
141
|
-
function isSnapPoint(slideIndex, {
|
|
142
|
-
container,
|
|
143
|
-
slidesPerMove,
|
|
144
|
-
slidesPerPage
|
|
145
|
-
}) {
|
|
146
|
-
return getSnapIndices({
|
|
147
|
-
totalSlides: getSlideElements(container).length,
|
|
148
|
-
slidesPerPage,
|
|
149
|
-
slidesPerMove
|
|
150
|
-
}).includes(slideIndex);
|
|
151
|
-
}
|
|
152
|
-
function getSnapPositions({
|
|
153
|
-
container,
|
|
154
|
-
slidesPerMove,
|
|
155
|
-
slidesPerPage
|
|
156
|
-
}) {
|
|
157
|
-
if (!container) return [];
|
|
158
|
-
return getSlideElements(container).filter((_, index) => {
|
|
159
|
-
return isSnapPoint(index, {
|
|
160
|
-
slidesPerMove,
|
|
161
|
-
slidesPerPage,
|
|
162
|
-
container
|
|
163
|
-
});
|
|
164
|
-
}).map((slide) => slide.offsetLeft);
|
|
165
|
-
}
|
|
166
|
-
function computeDotState({
|
|
167
|
-
dotIndex,
|
|
168
|
-
pageState,
|
|
169
|
-
totalPages,
|
|
170
|
-
maxDots = 5
|
|
171
|
-
}) {
|
|
172
|
-
if (totalPages <= maxDots) {
|
|
173
|
-
return dotIndex === pageState ? "active" : "idle";
|
|
174
|
-
}
|
|
175
|
-
if (pageState <= Math.floor(maxDots / 2)) {
|
|
176
|
-
if (dotIndex > maxDots - 1) return "hidden";
|
|
177
|
-
if (dotIndex === pageState) return "active";
|
|
178
|
-
if (dotIndex === maxDots - 1) return "edge";
|
|
179
|
-
return "idle";
|
|
180
|
-
}
|
|
181
|
-
if (pageState >= totalPages - Math.ceil(maxDots / 2)) {
|
|
182
|
-
const startIndex2 = totalPages - maxDots;
|
|
183
|
-
if (dotIndex < startIndex2) return "hidden";
|
|
184
|
-
if (dotIndex === pageState) return "active";
|
|
185
|
-
if (dotIndex === startIndex2) return "edge";
|
|
186
|
-
return "idle";
|
|
187
|
-
}
|
|
188
|
-
const startIndex = pageState - Math.floor(maxDots / 2);
|
|
189
|
-
const endIndex = pageState + Math.floor(maxDots / 2);
|
|
190
|
-
if (dotIndex < startIndex || dotIndex > endIndex) return "hidden";
|
|
191
|
-
if (dotIndex === pageState) return "active";
|
|
192
|
-
if (dotIndex === startIndex || dotIndex === endIndex) return "edge";
|
|
193
|
-
return "idle";
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
// src/carousel/useSnapPoints.ts
|
|
197
|
-
function useSnapPoints(initialSnapPoints = [], {
|
|
198
|
-
carouselRef,
|
|
199
|
-
slidesPerMove,
|
|
200
|
-
slidesPerPage
|
|
201
|
-
}) {
|
|
202
|
-
const [pageSnapPoints, setPageSnapPoints] = (0, import_react5.useState)(initialSnapPoints);
|
|
203
|
-
const stableSnapPoints = (0, import_react5.useMemo)(() => pageSnapPoints, [pageSnapPoints]);
|
|
204
|
-
useResizeObserver(carouselRef, () => {
|
|
205
|
-
const newSnapPoints = getSnapPositions({
|
|
206
|
-
slidesPerMove,
|
|
207
|
-
slidesPerPage,
|
|
208
|
-
container: carouselRef.current
|
|
209
|
-
});
|
|
210
|
-
if (JSON.stringify(pageSnapPoints) !== JSON.stringify(newSnapPoints)) {
|
|
211
|
-
setPageSnapPoints(newSnapPoints);
|
|
212
|
-
}
|
|
213
|
-
});
|
|
214
|
-
return [stableSnapPoints, setPageSnapPoints];
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
// src/carousel/useCarousel.ts
|
|
218
|
-
var DATA_SCOPE = "carousel";
|
|
219
|
-
var DIRECTION = "ltr";
|
|
220
|
-
var useCarousel = ({
|
|
221
|
-
defaultPage,
|
|
222
|
-
gap = 16,
|
|
223
|
-
snapType = "mandatory",
|
|
224
|
-
snapStop = "always",
|
|
225
|
-
scrollPadding = 0,
|
|
226
|
-
slidesPerPage = 1,
|
|
227
|
-
slidesPerMove = "auto",
|
|
228
|
-
scrollBehavior = "smooth",
|
|
229
|
-
loop = false,
|
|
230
|
-
pagePickerInset = false,
|
|
231
|
-
maxDots = 5,
|
|
232
|
-
// state control
|
|
233
|
-
page: controlledPage,
|
|
234
|
-
onPageChange: onPageChangeProp
|
|
235
|
-
}) => {
|
|
236
|
-
const carouselId = (0, import_react6.useId)();
|
|
237
|
-
const [pageState, setPageState] = (0, import_react6.useState)(defaultPage || controlledPage || 0);
|
|
238
|
-
const carouselRef = (0, import_react6.useRef)(null);
|
|
239
|
-
const pageIndicatorsRefs = (0, import_react6.useRef)([]);
|
|
240
|
-
const isMountedRef = useIsMounted();
|
|
241
|
-
const isMounted = isMountedRef.current;
|
|
242
|
-
const onPageChange = useEvent(onPageChangeProp);
|
|
243
|
-
const [pageSnapPoints] = useSnapPoints([], {
|
|
244
|
-
carouselRef,
|
|
245
|
-
slidesPerMove,
|
|
246
|
-
slidesPerPage
|
|
247
|
-
});
|
|
248
|
-
const canScrollPrev = (0, import_react6.useRef)(loop || pageState > 0);
|
|
249
|
-
const canScrollNext = (0, import_react6.useRef)(loop || pageState < pageSnapPoints.length - 1);
|
|
250
|
-
canScrollPrev.current = loop || pageState > 0;
|
|
251
|
-
canScrollNext.current = loop || pageState < pageSnapPoints.length - 1;
|
|
252
|
-
const handlePageChange = (0, import_react6.useCallback)(
|
|
253
|
-
(page) => {
|
|
254
|
-
if (page !== pageState) {
|
|
255
|
-
setPageState(page);
|
|
256
|
-
onPageChange?.(page);
|
|
257
|
-
}
|
|
258
|
-
},
|
|
259
|
-
[onPageChange, pageState]
|
|
260
|
-
);
|
|
261
|
-
const scrollTo = (0, import_react6.useCallback)(
|
|
262
|
-
(page, behavior) => {
|
|
263
|
-
if (carouselRef.current) {
|
|
264
|
-
carouselRef.current.scrollTo({
|
|
265
|
-
left: pageSnapPoints[page],
|
|
266
|
-
behavior: behavior === "instant" ? "auto" : "smooth"
|
|
267
|
-
});
|
|
268
|
-
handlePageChange(page);
|
|
269
|
-
}
|
|
270
|
-
},
|
|
271
|
-
[handlePageChange, pageSnapPoints]
|
|
272
|
-
);
|
|
273
|
-
const scrollPrev = (0, import_react6.useCallback)(
|
|
274
|
-
(cb) => {
|
|
275
|
-
if (canScrollPrev) {
|
|
276
|
-
const targetPage = loop && pageState === 0 ? pageSnapPoints.length - 1 : Math.max(pageState - 1, 0);
|
|
277
|
-
scrollTo(targetPage, scrollBehavior);
|
|
278
|
-
cb?.(targetPage);
|
|
279
|
-
}
|
|
280
|
-
},
|
|
281
|
-
[loop, pageSnapPoints, pageState, scrollBehavior, scrollTo]
|
|
282
|
-
);
|
|
283
|
-
const scrollNext = (0, import_react6.useCallback)(
|
|
284
|
-
(cb) => {
|
|
285
|
-
if (canScrollNext) {
|
|
286
|
-
const targetPage = loop && pageState === pageSnapPoints.length - 1 ? 0 : Math.min(pageState + 1, pageSnapPoints.length - 1);
|
|
287
|
-
scrollTo(targetPage, scrollBehavior);
|
|
288
|
-
cb?.(targetPage);
|
|
289
|
-
}
|
|
290
|
-
},
|
|
291
|
-
[loop, pageSnapPoints, pageState, scrollBehavior, scrollTo]
|
|
292
|
-
);
|
|
293
|
-
(0, import_react6.useEffect)(() => {
|
|
294
|
-
if (controlledPage != null) {
|
|
295
|
-
scrollTo(controlledPage, scrollBehavior);
|
|
296
|
-
}
|
|
297
|
-
}, [controlledPage, scrollBehavior, scrollTo]);
|
|
298
|
-
(0, import_react6.useLayoutEffect)(() => {
|
|
299
|
-
if (defaultPage != null && !isMounted && carouselRef.current) {
|
|
300
|
-
const snapPositions = getSnapPositions({
|
|
301
|
-
container: carouselRef.current,
|
|
302
|
-
slidesPerMove,
|
|
303
|
-
slidesPerPage
|
|
304
|
-
});
|
|
305
|
-
carouselRef.current.scrollTo({
|
|
306
|
-
left: snapPositions[defaultPage],
|
|
307
|
-
behavior: "instant"
|
|
308
|
-
});
|
|
309
|
-
}
|
|
310
|
-
}, [defaultPage, isMounted, slidesPerMove, slidesPerPage]);
|
|
311
|
-
const syncPageStateWithScrollPosition = (0, import_react6.useCallback)(() => {
|
|
312
|
-
if (!carouselRef.current || pageSnapPoints.length === 0) return;
|
|
313
|
-
const { scrollLeft } = carouselRef.current;
|
|
314
|
-
const distances = pageSnapPoints.map((pagePosition) => Math.abs(scrollLeft - pagePosition));
|
|
315
|
-
const pageInViewport = distances.indexOf(Math.min(...distances));
|
|
316
|
-
if (pageInViewport !== -1) {
|
|
317
|
-
handlePageChange(pageInViewport);
|
|
318
|
-
}
|
|
319
|
-
}, [pageSnapPoints, handlePageChange]);
|
|
320
|
-
useScrollEnd(carouselRef, syncPageStateWithScrollPosition);
|
|
321
|
-
const contextValue = {
|
|
322
|
-
ref: carouselRef,
|
|
323
|
-
pageIndicatorsRefs,
|
|
324
|
-
// props
|
|
325
|
-
gap,
|
|
326
|
-
snapType,
|
|
327
|
-
snapStop,
|
|
328
|
-
scrollPadding,
|
|
329
|
-
slidesPerPage,
|
|
330
|
-
slidesPerMove,
|
|
331
|
-
scrollBehavior,
|
|
332
|
-
loop,
|
|
333
|
-
pagePickerInset,
|
|
334
|
-
maxDots,
|
|
335
|
-
// computed state
|
|
336
|
-
page: pageState,
|
|
337
|
-
pageSnapPoints,
|
|
338
|
-
canScrollNext: canScrollNext.current,
|
|
339
|
-
canScrollPrev: canScrollPrev.current,
|
|
340
|
-
scrollTo,
|
|
341
|
-
scrollPrev,
|
|
342
|
-
scrollNext,
|
|
343
|
-
// anatomy
|
|
344
|
-
getRootProps: () => ({
|
|
345
|
-
id: `carousel::${carouselId}:`,
|
|
346
|
-
role: "region",
|
|
347
|
-
"aria-roledescription": "carousel",
|
|
348
|
-
"data-scope": DATA_SCOPE,
|
|
349
|
-
"data-part": "root",
|
|
350
|
-
"data-orientation": "horizontal",
|
|
351
|
-
dir: DIRECTION,
|
|
352
|
-
style: {
|
|
353
|
-
"--slides-per-page": slidesPerPage,
|
|
354
|
-
"--slide-spacing": `${gap}px`,
|
|
355
|
-
"--slide-item-size": "calc(100% / var(--slides-per-page) - var(--slide-spacing) * (var(--slides-per-page) - 1) / var(--slides-per-page))"
|
|
356
|
-
}
|
|
357
|
-
}),
|
|
358
|
-
getControlProps: () => ({
|
|
359
|
-
"data-scope": DATA_SCOPE,
|
|
360
|
-
"data-part": "control",
|
|
361
|
-
"data-orientation": "horizontal"
|
|
362
|
-
}),
|
|
363
|
-
getPrevTriggerProps: () => ({
|
|
364
|
-
id: `carousel::${carouselId}::prev-trigger`,
|
|
365
|
-
"aria-controls": `carousel::${carouselId}::item-group`,
|
|
366
|
-
"data-scope": DATA_SCOPE,
|
|
367
|
-
"data-part": "prev-trigger",
|
|
368
|
-
"data-orientation": "horizontal",
|
|
369
|
-
type: "button",
|
|
370
|
-
dir: DIRECTION,
|
|
371
|
-
disabled: !canScrollPrev.current,
|
|
372
|
-
onClick: () => scrollPrev()
|
|
373
|
-
}),
|
|
374
|
-
getNextTriggerProps: () => ({
|
|
375
|
-
id: `carousel::${carouselId}::next-trigger`,
|
|
376
|
-
"aria-controls": `carousel::${carouselId}::item-group`,
|
|
377
|
-
"data-scope": DATA_SCOPE,
|
|
378
|
-
"data-part": "next-trigger",
|
|
379
|
-
"data-orientation": "horizontal",
|
|
380
|
-
type: "button",
|
|
381
|
-
dir: DIRECTION,
|
|
382
|
-
disabled: !canScrollNext.current,
|
|
383
|
-
onClick: () => scrollNext()
|
|
384
|
-
}),
|
|
385
|
-
getSlidesContainerProps: () => ({
|
|
386
|
-
id: `carousel::${carouselId}::item-group`,
|
|
387
|
-
/**
|
|
388
|
-
* The carousel pattern was originally designed for a single slide.
|
|
389
|
-
* When there is more than one slide, the aria-live region is set to off to avoid announcing the whole list of slides.
|
|
390
|
-
* This is not ideal but we keep it for backwards compatibility.
|
|
391
|
-
*
|
|
392
|
-
* @see https://www.w3.org/WAI/ARIA/apg/patterns/carousel/#wai-aria-attributes
|
|
393
|
-
*/
|
|
394
|
-
"aria-live": slidesPerPage > 1 ? "off" : "polite",
|
|
395
|
-
"data-scope": DATA_SCOPE,
|
|
396
|
-
"data-part": "item-group",
|
|
397
|
-
"data-orientation": "horizontal",
|
|
398
|
-
dir: DIRECTION,
|
|
399
|
-
tabIndex: 0,
|
|
400
|
-
style: {
|
|
401
|
-
display: "grid",
|
|
402
|
-
gap: "var(--slide-spacing)",
|
|
403
|
-
scrollSnapType: `x ${snapType}`,
|
|
404
|
-
gridAutoFlow: "column",
|
|
405
|
-
scrollbarWidth: "none",
|
|
406
|
-
gridAutoColumns: "var(--slide-item-size)",
|
|
407
|
-
overflowX: "auto"
|
|
408
|
-
},
|
|
409
|
-
ref: carouselRef
|
|
410
|
-
}),
|
|
411
|
-
getSlideProps: ({ index }) => {
|
|
412
|
-
const isStopPoint = isSnapPoint(index, {
|
|
413
|
-
container: carouselRef.current,
|
|
414
|
-
slidesPerMove,
|
|
415
|
-
slidesPerPage
|
|
416
|
-
});
|
|
417
|
-
return {
|
|
418
|
-
id: `carousel::${carouselId}::item:${index}`,
|
|
419
|
-
role: "group",
|
|
420
|
-
"aria-roledescription": "slide",
|
|
421
|
-
"data-scope": DATA_SCOPE,
|
|
422
|
-
"data-part": "item",
|
|
423
|
-
"data-index": index,
|
|
424
|
-
"data-orientation": "horizontal",
|
|
425
|
-
dir: DIRECTION,
|
|
426
|
-
style: {
|
|
427
|
-
...isStopPoint && {
|
|
428
|
-
scrollSnapAlign: "start",
|
|
429
|
-
scrollSnapStop: snapStop
|
|
430
|
-
}
|
|
431
|
-
}
|
|
432
|
-
};
|
|
433
|
-
},
|
|
434
|
-
getIndicatorGroupProps: () => ({
|
|
435
|
-
role: "radiogroup",
|
|
436
|
-
id: `carousel::${carouselId}::indicator-group`,
|
|
437
|
-
"data-scope": DATA_SCOPE,
|
|
438
|
-
"data-part": "indicator-group",
|
|
439
|
-
"data-orientation": "horizontal",
|
|
440
|
-
dir: DIRECTION
|
|
441
|
-
}),
|
|
442
|
-
getIndicatorProps: ({ index }) => {
|
|
443
|
-
const dotState = computeDotState({
|
|
444
|
-
dotIndex: index,
|
|
445
|
-
pageState,
|
|
446
|
-
totalPages: pageSnapPoints.length,
|
|
447
|
-
maxDots
|
|
448
|
-
});
|
|
449
|
-
return {
|
|
450
|
-
role: "radio",
|
|
451
|
-
id: `carousel::${carouselId}::indicator:${index}`,
|
|
452
|
-
"aria-checked": index === pageState,
|
|
453
|
-
"data-scope": DATA_SCOPE,
|
|
454
|
-
"data-part": "indicator",
|
|
455
|
-
"data-orientation": "horizontal",
|
|
456
|
-
"data-index": index,
|
|
457
|
-
"data-state": dotState,
|
|
458
|
-
tabIndex: index === pageState ? 0 : -1,
|
|
459
|
-
onClick: () => {
|
|
460
|
-
scrollTo(index, scrollBehavior);
|
|
461
|
-
},
|
|
462
|
-
onKeyDown: (event) => {
|
|
463
|
-
const focusActiveIndicator = (page) => {
|
|
464
|
-
pageIndicatorsRefs.current[page]?.focus();
|
|
465
|
-
};
|
|
466
|
-
if (event.key === "ArrowRight" && canScrollNext) {
|
|
467
|
-
scrollNext(focusActiveIndicator);
|
|
468
|
-
} else if (event.key === "ArrowLeft" && canScrollPrev) {
|
|
469
|
-
scrollPrev(focusActiveIndicator);
|
|
470
|
-
}
|
|
471
|
-
}
|
|
472
|
-
};
|
|
473
|
-
}
|
|
474
|
-
};
|
|
475
|
-
return contextValue;
|
|
476
|
-
};
|
|
477
|
-
|
|
478
|
-
// src/carousel/Carousel.tsx
|
|
479
|
-
var import_jsx_runtime = require("react/jsx-runtime");
|
|
480
|
-
var CarouselContext = (0, import_react7.createContext)(null);
|
|
481
|
-
var Carousel = ({
|
|
482
|
-
className,
|
|
483
|
-
snapType = "mandatory",
|
|
484
|
-
snapStop = "always",
|
|
485
|
-
scrollBehavior = "smooth",
|
|
486
|
-
slidesPerMove = "auto",
|
|
487
|
-
pagePickerInset = false,
|
|
488
|
-
slidesPerPage = 1,
|
|
489
|
-
loop = false,
|
|
490
|
-
children,
|
|
491
|
-
gap = 16,
|
|
492
|
-
defaultPage,
|
|
493
|
-
page,
|
|
494
|
-
onPageChange,
|
|
495
|
-
maxDots = 5,
|
|
496
|
-
...props
|
|
497
|
-
}) => {
|
|
498
|
-
const carouselApi = useCarousel({
|
|
499
|
-
defaultPage,
|
|
500
|
-
slidesPerPage,
|
|
501
|
-
slidesPerMove,
|
|
502
|
-
loop,
|
|
503
|
-
gap,
|
|
504
|
-
scrollBehavior,
|
|
505
|
-
snapStop,
|
|
506
|
-
snapType,
|
|
507
|
-
page,
|
|
508
|
-
pagePickerInset,
|
|
509
|
-
onPageChange,
|
|
510
|
-
maxDots
|
|
511
|
-
});
|
|
512
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
513
|
-
CarouselContext.Provider,
|
|
514
|
-
{
|
|
515
|
-
value: {
|
|
516
|
-
...carouselApi,
|
|
517
|
-
scrollBehavior
|
|
518
|
-
},
|
|
519
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
520
|
-
"div",
|
|
521
|
-
{
|
|
522
|
-
"data-spark-component": "carousel",
|
|
523
|
-
className: (0, import_class_variance_authority.cx)("gap-lg relative box-border flex flex-col", className),
|
|
524
|
-
...carouselApi.getRootProps(),
|
|
525
|
-
...props,
|
|
526
|
-
children
|
|
527
|
-
}
|
|
528
|
-
)
|
|
529
|
-
}
|
|
530
|
-
);
|
|
531
|
-
};
|
|
532
|
-
Carousel.displayName = "Carousel";
|
|
533
|
-
var useCarouselContext = () => {
|
|
534
|
-
const context = (0, import_react7.useContext)(CarouselContext);
|
|
535
|
-
if (!context) {
|
|
536
|
-
throw Error("useCarouselContext must be used within a Carousel provider");
|
|
537
|
-
}
|
|
538
|
-
return context;
|
|
539
|
-
};
|
|
540
|
-
|
|
541
|
-
// src/carousel/CarouselControls.tsx
|
|
542
|
-
var import_class_variance_authority2 = require("class-variance-authority");
|
|
543
|
-
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
544
|
-
var CarouselControls = ({ children, className, ...props }) => {
|
|
545
|
-
const ctx = useCarouselContext();
|
|
546
|
-
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
547
|
-
"div",
|
|
548
|
-
{
|
|
549
|
-
"data-spark-component": "carousel-controls",
|
|
550
|
-
className: (0, import_class_variance_authority2.cx)(
|
|
551
|
-
"default:px-lg pointer-events-none absolute inset-0 flex flex-row items-center justify-between",
|
|
552
|
-
className
|
|
553
|
-
),
|
|
554
|
-
...ctx.getControlProps(),
|
|
555
|
-
...props,
|
|
556
|
-
children
|
|
557
|
-
}
|
|
558
|
-
);
|
|
559
|
-
};
|
|
560
|
-
CarouselControls.displayName = "Carousel.Controls";
|
|
561
|
-
|
|
562
|
-
// src/carousel/CarouselNextButton.tsx
|
|
563
|
-
var import_ArrowVerticalRight = require("@spark-ui/icons/ArrowVerticalRight");
|
|
564
|
-
|
|
565
|
-
// src/icon/Icon.tsx
|
|
566
|
-
var import_react9 = require("react");
|
|
567
|
-
|
|
568
|
-
// src/slot/Slot.tsx
|
|
569
|
-
var import_radix_ui = require("radix-ui");
|
|
570
|
-
var import_react8 = require("react");
|
|
571
|
-
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
572
|
-
var Slottable = import_radix_ui.Slot.Slottable;
|
|
573
|
-
var Slot = ({ ref, ...props }) => {
|
|
574
|
-
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_radix_ui.Slot.Root, { ref, ...props });
|
|
575
|
-
};
|
|
576
|
-
var wrapPolymorphicSlot = (asChild, children, callback) => {
|
|
577
|
-
if (!asChild) return callback(children);
|
|
578
|
-
return (0, import_react8.isValidElement)(children) ? (0, import_react8.cloneElement)(
|
|
579
|
-
children,
|
|
580
|
-
void 0,
|
|
581
|
-
callback(children.props.children)
|
|
582
|
-
) : null;
|
|
583
|
-
};
|
|
584
|
-
|
|
585
|
-
// src/visually-hidden/VisuallyHidden.tsx
|
|
586
|
-
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
587
|
-
var VisuallyHidden = ({ asChild = false, ref, ...props }) => {
|
|
588
|
-
const Component = asChild ? Slot : "span";
|
|
589
|
-
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
590
|
-
Component,
|
|
591
|
-
{
|
|
592
|
-
...props,
|
|
593
|
-
ref,
|
|
594
|
-
style: {
|
|
595
|
-
// See: https://github.com/twbs/bootstrap/blob/main/scss/mixins/_visually-hidden.scss
|
|
596
|
-
position: "absolute",
|
|
597
|
-
border: 0,
|
|
598
|
-
width: 1,
|
|
599
|
-
height: 1,
|
|
600
|
-
padding: 0,
|
|
601
|
-
margin: -1,
|
|
602
|
-
overflow: "hidden",
|
|
603
|
-
clip: "rect(0, 0, 0, 0)",
|
|
604
|
-
whiteSpace: "nowrap",
|
|
605
|
-
wordWrap: "normal",
|
|
606
|
-
...props.style
|
|
607
|
-
}
|
|
608
|
-
}
|
|
609
|
-
);
|
|
610
|
-
};
|
|
611
|
-
VisuallyHidden.displayName = "VisuallyHidden";
|
|
612
|
-
|
|
613
|
-
// src/icon/Icon.styles.tsx
|
|
614
|
-
var import_internal_utils = require("@spark-ui/internal-utils");
|
|
615
|
-
var import_class_variance_authority3 = require("class-variance-authority");
|
|
616
|
-
var iconStyles = (0, import_class_variance_authority3.cva)(["fill-current shrink-0"], {
|
|
617
|
-
variants: {
|
|
618
|
-
/**
|
|
619
|
-
* Color scheme of the icon.
|
|
620
|
-
*/
|
|
621
|
-
intent: (0, import_internal_utils.makeVariants)({
|
|
622
|
-
current: ["text-current"],
|
|
623
|
-
main: ["text-main"],
|
|
624
|
-
support: ["text-support"],
|
|
625
|
-
accent: ["text-accent"],
|
|
626
|
-
basic: ["text-basic"],
|
|
627
|
-
success: ["text-success"],
|
|
628
|
-
alert: ["text-alert"],
|
|
629
|
-
error: ["text-error"],
|
|
630
|
-
info: ["text-info"],
|
|
631
|
-
neutral: ["text-neutral"]
|
|
632
|
-
}),
|
|
633
|
-
/**
|
|
634
|
-
* Sets the size of the icon.
|
|
635
|
-
*/
|
|
636
|
-
size: (0, import_internal_utils.makeVariants)({
|
|
637
|
-
current: ["u-current-font-size"],
|
|
638
|
-
sm: ["w-sz-16", "h-sz-16"],
|
|
639
|
-
md: ["w-sz-24", "h-sz-24"],
|
|
640
|
-
lg: ["w-sz-32", "h-sz-32"],
|
|
641
|
-
xl: ["w-sz-40", "h-sz-40"]
|
|
642
|
-
})
|
|
643
|
-
}
|
|
644
|
-
});
|
|
645
|
-
|
|
646
|
-
// src/icon/Icon.tsx
|
|
647
|
-
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
648
|
-
var Icon = ({
|
|
649
|
-
label,
|
|
650
|
-
className,
|
|
651
|
-
size = "current",
|
|
652
|
-
intent = "current",
|
|
653
|
-
children,
|
|
654
|
-
...others
|
|
655
|
-
}) => {
|
|
656
|
-
const child = import_react9.Children.only(children);
|
|
657
|
-
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_jsx_runtime5.Fragment, { children: [
|
|
658
|
-
(0, import_react9.cloneElement)(child, {
|
|
659
|
-
className: iconStyles({ className, size, intent }),
|
|
660
|
-
"data-spark-component": "icon",
|
|
661
|
-
"aria-hidden": "true",
|
|
662
|
-
focusable: "false",
|
|
663
|
-
...others
|
|
664
|
-
}),
|
|
665
|
-
label && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(VisuallyHidden, { children: label })
|
|
666
|
-
] });
|
|
667
|
-
};
|
|
668
|
-
Icon.displayName = "Icon";
|
|
669
|
-
|
|
670
|
-
// src/button/Button.tsx
|
|
671
|
-
var import_class_variance_authority6 = require("class-variance-authority");
|
|
672
|
-
var import_react10 = require("react");
|
|
673
|
-
|
|
674
|
-
// src/spinner/Spinner.styles.tsx
|
|
675
|
-
var import_internal_utils2 = require("@spark-ui/internal-utils");
|
|
676
|
-
var import_class_variance_authority4 = require("class-variance-authority");
|
|
677
|
-
var defaultVariants = {
|
|
678
|
-
intent: "current",
|
|
679
|
-
size: "current",
|
|
680
|
-
isBackgroundVisible: false
|
|
681
|
-
};
|
|
682
|
-
var spinnerStyles = (0, import_class_variance_authority4.cva)(
|
|
683
|
-
["inline-block", "border-solid", "rounded-full", "border-md", "animate-spin"],
|
|
684
|
-
{
|
|
685
|
-
variants: {
|
|
686
|
-
/**
|
|
687
|
-
* Use `size` prop to set the size of the spinner. If you want to set the full size for the spinner, don't forget to add a wrapping container with its own size.
|
|
688
|
-
*/
|
|
689
|
-
size: {
|
|
690
|
-
current: ["u-current-font-size"],
|
|
691
|
-
sm: ["w-sz-20", "h-sz-20"],
|
|
692
|
-
md: ["w-sz-28", "h-sz-28"],
|
|
693
|
-
full: ["w-full", "h-full"]
|
|
694
|
-
},
|
|
695
|
-
/**
|
|
696
|
-
* Color scheme of the spinner.
|
|
697
|
-
*/
|
|
698
|
-
intent: (0, import_internal_utils2.makeVariants)({
|
|
699
|
-
current: ["border-current"],
|
|
700
|
-
main: ["border-main"],
|
|
701
|
-
support: ["border-support"],
|
|
702
|
-
accent: ["border-accent"],
|
|
703
|
-
basic: ["border-basic"],
|
|
704
|
-
success: ["border-success"],
|
|
705
|
-
alert: ["border-alert"],
|
|
706
|
-
error: ["border-error"],
|
|
707
|
-
info: ["border-info"],
|
|
708
|
-
neutral: ["border-neutral"]
|
|
709
|
-
}),
|
|
710
|
-
/**
|
|
711
|
-
* Size of the button.
|
|
712
|
-
*/
|
|
713
|
-
isBackgroundVisible: {
|
|
714
|
-
true: ["border-b-neutral-container", "border-l-neutral-container"],
|
|
715
|
-
false: ["border-b-transparent", "border-l-transparent"]
|
|
716
|
-
}
|
|
717
|
-
},
|
|
718
|
-
defaultVariants
|
|
719
|
-
}
|
|
720
|
-
);
|
|
721
|
-
|
|
722
|
-
// src/spinner/Spinner.tsx
|
|
723
|
-
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
724
|
-
var Spinner = ({
|
|
725
|
-
className,
|
|
726
|
-
size = "current",
|
|
727
|
-
intent = "current",
|
|
728
|
-
label,
|
|
729
|
-
isBackgroundVisible,
|
|
730
|
-
ref,
|
|
731
|
-
...others
|
|
732
|
-
}) => {
|
|
733
|
-
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
734
|
-
"span",
|
|
735
|
-
{
|
|
736
|
-
role: "status",
|
|
737
|
-
"data-spark-component": "spinner",
|
|
738
|
-
ref,
|
|
739
|
-
className: spinnerStyles({ className, size, intent, isBackgroundVisible }),
|
|
740
|
-
...others,
|
|
741
|
-
children: label && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(VisuallyHidden, { children: label })
|
|
742
|
-
}
|
|
743
|
-
);
|
|
744
|
-
};
|
|
745
|
-
|
|
746
|
-
// src/button/Button.styles.tsx
|
|
747
|
-
var import_internal_utils8 = require("@spark-ui/internal-utils");
|
|
748
|
-
var import_class_variance_authority5 = require("class-variance-authority");
|
|
749
|
-
|
|
750
|
-
// src/button/variants/filled.ts
|
|
751
|
-
var import_internal_utils3 = require("@spark-ui/internal-utils");
|
|
752
|
-
var filledVariants = [
|
|
753
|
-
// Main
|
|
754
|
-
{
|
|
755
|
-
intent: "main",
|
|
756
|
-
design: "filled",
|
|
757
|
-
class: (0, import_internal_utils3.tw)([
|
|
758
|
-
"bg-main",
|
|
759
|
-
"text-on-main",
|
|
760
|
-
"hover:bg-main-hovered",
|
|
761
|
-
"enabled:active:bg-main-hovered",
|
|
762
|
-
"focus-visible:bg-main-hovered"
|
|
763
|
-
])
|
|
764
|
-
},
|
|
765
|
-
// Support
|
|
766
|
-
{
|
|
767
|
-
intent: "support",
|
|
768
|
-
design: "filled",
|
|
769
|
-
class: (0, import_internal_utils3.tw)([
|
|
770
|
-
"bg-support",
|
|
771
|
-
"text-on-support",
|
|
772
|
-
"hover:bg-support-hovered",
|
|
773
|
-
"enabled:active:bg-support-hovered",
|
|
774
|
-
"focus-visible:bg-support-hovered"
|
|
775
|
-
])
|
|
776
|
-
},
|
|
777
|
-
// Accent
|
|
778
|
-
{
|
|
779
|
-
intent: "accent",
|
|
780
|
-
design: "filled",
|
|
781
|
-
class: (0, import_internal_utils3.tw)([
|
|
782
|
-
"bg-accent",
|
|
783
|
-
"text-on-accent",
|
|
784
|
-
"hover:bg-accent-hovered",
|
|
785
|
-
"enabled:active:bg-accent-hovered",
|
|
786
|
-
"focus-visible:bg-accent-hovered"
|
|
787
|
-
])
|
|
788
|
-
},
|
|
789
|
-
// Basic
|
|
790
|
-
{
|
|
791
|
-
intent: "basic",
|
|
792
|
-
design: "filled",
|
|
793
|
-
class: (0, import_internal_utils3.tw)([
|
|
794
|
-
"bg-basic",
|
|
795
|
-
"text-on-basic",
|
|
796
|
-
"hover:bg-basic-hovered",
|
|
797
|
-
"enabled:active:bg-basic-hovered",
|
|
798
|
-
"focus-visible:bg-basic-hovered"
|
|
799
|
-
])
|
|
800
|
-
},
|
|
801
|
-
// Success
|
|
802
|
-
{
|
|
803
|
-
intent: "success",
|
|
804
|
-
design: "filled",
|
|
805
|
-
class: (0, import_internal_utils3.tw)([
|
|
806
|
-
"bg-success",
|
|
807
|
-
"text-on-success",
|
|
808
|
-
"hover:bg-success-hovered",
|
|
809
|
-
"enabled:active:bg-success-hovered",
|
|
810
|
-
"focus-visible:bg-success-hovered"
|
|
811
|
-
])
|
|
812
|
-
},
|
|
813
|
-
// Alert
|
|
814
|
-
{
|
|
815
|
-
intent: "alert",
|
|
816
|
-
design: "filled",
|
|
817
|
-
class: (0, import_internal_utils3.tw)([
|
|
818
|
-
"bg-alert",
|
|
819
|
-
"text-on-alert",
|
|
820
|
-
"hover:bg-alert-hovered",
|
|
821
|
-
"enabled:active:bg-alert-hovered",
|
|
822
|
-
"focus-visible:bg-alert-hovered"
|
|
823
|
-
])
|
|
824
|
-
},
|
|
825
|
-
// Danger
|
|
826
|
-
{
|
|
827
|
-
intent: "danger",
|
|
828
|
-
design: "filled",
|
|
829
|
-
class: (0, import_internal_utils3.tw)([
|
|
830
|
-
"text-on-error bg-error",
|
|
831
|
-
"hover:bg-error-hovered enabled:active:bg-error-hovered",
|
|
832
|
-
"focus-visible:bg-error-hovered"
|
|
833
|
-
])
|
|
834
|
-
},
|
|
835
|
-
// Info
|
|
836
|
-
{
|
|
837
|
-
intent: "info",
|
|
838
|
-
design: "filled",
|
|
839
|
-
class: (0, import_internal_utils3.tw)([
|
|
840
|
-
"text-on-error bg-info",
|
|
841
|
-
"hover:bg-info-hovered enabled:active:bg-info-hovered",
|
|
842
|
-
"focus-visible:bg-info-hovered"
|
|
843
|
-
])
|
|
844
|
-
},
|
|
845
|
-
// Neutral
|
|
846
|
-
{
|
|
847
|
-
intent: "neutral",
|
|
848
|
-
design: "filled",
|
|
849
|
-
class: (0, import_internal_utils3.tw)([
|
|
850
|
-
"bg-neutral",
|
|
851
|
-
"text-on-neutral",
|
|
852
|
-
"hover:bg-neutral-hovered",
|
|
853
|
-
"enabled:active:bg-neutral-hovered",
|
|
854
|
-
"focus-visible:bg-neutral-hovered"
|
|
855
|
-
])
|
|
856
|
-
},
|
|
857
|
-
// Surface
|
|
858
|
-
{
|
|
859
|
-
intent: "surface",
|
|
860
|
-
design: "filled",
|
|
861
|
-
class: (0, import_internal_utils3.tw)([
|
|
862
|
-
"bg-surface",
|
|
863
|
-
"text-on-surface",
|
|
864
|
-
"hover:bg-surface-hovered",
|
|
865
|
-
"enabled:active:bg-surface-hovered",
|
|
866
|
-
"focus-visible:bg-surface-hovered"
|
|
867
|
-
])
|
|
868
|
-
},
|
|
869
|
-
{
|
|
870
|
-
intent: "surfaceInverse",
|
|
871
|
-
design: "filled",
|
|
872
|
-
class: (0, import_internal_utils3.tw)([
|
|
873
|
-
"bg-surface-inverse",
|
|
874
|
-
"text-on-surface-inverse",
|
|
875
|
-
"hover:bg-surface-inverse-hovered",
|
|
876
|
-
"enabled:active:bg-surface-inverse-hovered",
|
|
877
|
-
"focus-visible:bg-surface-inverse-hovered"
|
|
878
|
-
])
|
|
879
|
-
}
|
|
880
|
-
];
|
|
881
|
-
|
|
882
|
-
// src/button/variants/ghost.ts
|
|
883
|
-
var import_internal_utils4 = require("@spark-ui/internal-utils");
|
|
884
|
-
var ghostVariants = [
|
|
885
|
-
{
|
|
886
|
-
intent: "main",
|
|
887
|
-
design: "ghost",
|
|
888
|
-
class: (0, import_internal_utils4.tw)([
|
|
889
|
-
"text-on-main-container",
|
|
890
|
-
"hover:bg-main/dim-5",
|
|
891
|
-
"enabled:active:bg-main/dim-5",
|
|
892
|
-
"focus-visible:bg-main/dim-5"
|
|
893
|
-
])
|
|
894
|
-
},
|
|
895
|
-
{
|
|
896
|
-
intent: "support",
|
|
897
|
-
design: "ghost",
|
|
898
|
-
class: (0, import_internal_utils4.tw)([
|
|
899
|
-
"text-on-support-container",
|
|
900
|
-
"hover:bg-support/dim-5",
|
|
901
|
-
"enabled:active:bg-support/dim-5",
|
|
902
|
-
"focus-visible:bg-support/dim-5"
|
|
903
|
-
])
|
|
904
|
-
},
|
|
905
|
-
{
|
|
906
|
-
intent: "accent",
|
|
907
|
-
design: "ghost",
|
|
908
|
-
class: (0, import_internal_utils4.tw)([
|
|
909
|
-
"text-on-accent-container",
|
|
910
|
-
"hover:bg-accent/dim-5",
|
|
911
|
-
"enabled:active:bg-accent/dim-5",
|
|
912
|
-
"focus-visible:bg-accent/dim-5"
|
|
913
|
-
])
|
|
914
|
-
},
|
|
915
|
-
{
|
|
916
|
-
intent: "basic",
|
|
917
|
-
design: "ghost",
|
|
918
|
-
class: (0, import_internal_utils4.tw)([
|
|
919
|
-
"text-on-basic-container",
|
|
920
|
-
"hover:bg-basic/dim-5",
|
|
921
|
-
"enabled:active:bg-basic/dim-5",
|
|
922
|
-
"focus-visible:bg-basic/dim-5"
|
|
923
|
-
])
|
|
924
|
-
},
|
|
925
|
-
{
|
|
926
|
-
intent: "success",
|
|
927
|
-
design: "ghost",
|
|
928
|
-
class: (0, import_internal_utils4.tw)([
|
|
929
|
-
"text-on-success-container",
|
|
930
|
-
"hover:bg-success/dim-5",
|
|
931
|
-
"enabled:active:bg-success/dim-5",
|
|
932
|
-
"focus-visible:bg-success/dim-5"
|
|
933
|
-
])
|
|
934
|
-
},
|
|
935
|
-
{
|
|
936
|
-
intent: "alert",
|
|
937
|
-
design: "ghost",
|
|
938
|
-
class: (0, import_internal_utils4.tw)([
|
|
939
|
-
"text-on-alert-container",
|
|
940
|
-
"hover:bg-alert/dim-5",
|
|
941
|
-
"enabled:active:bg-alert/dim-5",
|
|
942
|
-
"focus-visible:bg-alert/dim-5"
|
|
943
|
-
])
|
|
944
|
-
},
|
|
945
|
-
{
|
|
946
|
-
intent: "danger",
|
|
947
|
-
design: "ghost",
|
|
948
|
-
class: (0, import_internal_utils4.tw)([
|
|
949
|
-
"text-on-error-container",
|
|
950
|
-
"hover:bg-error/dim-5",
|
|
951
|
-
"enabled:active:bg-error/dim-5",
|
|
952
|
-
"focus-visible:bg-error/dim-5"
|
|
953
|
-
])
|
|
954
|
-
},
|
|
955
|
-
{
|
|
956
|
-
intent: "info",
|
|
957
|
-
design: "ghost",
|
|
958
|
-
class: (0, import_internal_utils4.tw)([
|
|
959
|
-
"text-on-info-container",
|
|
960
|
-
"hover:bg-info/dim-5",
|
|
961
|
-
"enabled:active:bg-info/dim-5",
|
|
962
|
-
"focus-visible:bg-info/dim-5"
|
|
963
|
-
])
|
|
964
|
-
},
|
|
965
|
-
{
|
|
966
|
-
intent: "neutral",
|
|
967
|
-
design: "ghost",
|
|
968
|
-
class: (0, import_internal_utils4.tw)([
|
|
969
|
-
"text-on-neutral-container",
|
|
970
|
-
"hover:bg-neutral/dim-5",
|
|
971
|
-
"enabled:active:bg-neutral/dim-5",
|
|
972
|
-
"focus-visible:bg-neutral/dim-5"
|
|
973
|
-
])
|
|
974
|
-
},
|
|
975
|
-
{
|
|
976
|
-
intent: "surface",
|
|
977
|
-
design: "ghost",
|
|
978
|
-
class: (0, import_internal_utils4.tw)([
|
|
979
|
-
"text-surface",
|
|
980
|
-
"hover:bg-surface/dim-5",
|
|
981
|
-
"enabled:active:bg-surface/dim-5",
|
|
982
|
-
"focus-visible:bg-surface/dim-5"
|
|
983
|
-
])
|
|
984
|
-
},
|
|
985
|
-
{
|
|
986
|
-
intent: "surfaceInverse",
|
|
987
|
-
design: "ghost",
|
|
988
|
-
class: (0, import_internal_utils4.tw)([
|
|
989
|
-
"text-surface-inverse",
|
|
990
|
-
"hover:bg-surface-inverse/dim-5",
|
|
991
|
-
"enabled:active:bg-surface-inverse/dim-5",
|
|
992
|
-
"focus-visible:bg-surface-inverse/dim-5"
|
|
993
|
-
])
|
|
994
|
-
}
|
|
995
|
-
];
|
|
996
|
-
|
|
997
|
-
// src/button/variants/outlined.ts
|
|
998
|
-
var import_internal_utils5 = require("@spark-ui/internal-utils");
|
|
999
|
-
var outlinedVariants = [
|
|
1000
|
-
{
|
|
1001
|
-
intent: "main",
|
|
1002
|
-
design: "outlined",
|
|
1003
|
-
class: (0, import_internal_utils5.tw)([
|
|
1004
|
-
"hover:bg-main/dim-5",
|
|
1005
|
-
"enabled:active:bg-main/dim-5",
|
|
1006
|
-
"focus-visible:bg-main/dim-5",
|
|
1007
|
-
"text-main"
|
|
1008
|
-
])
|
|
1009
|
-
},
|
|
1010
|
-
{
|
|
1011
|
-
intent: "support",
|
|
1012
|
-
design: "outlined",
|
|
1013
|
-
class: (0, import_internal_utils5.tw)([
|
|
1014
|
-
"hover:bg-support/dim-5",
|
|
1015
|
-
"enabled:active:bg-support/dim-5",
|
|
1016
|
-
"focus-visible:bg-support/dim-5",
|
|
1017
|
-
"text-support"
|
|
1018
|
-
])
|
|
1019
|
-
},
|
|
1020
|
-
{
|
|
1021
|
-
intent: "accent",
|
|
1022
|
-
design: "outlined",
|
|
1023
|
-
class: (0, import_internal_utils5.tw)([
|
|
1024
|
-
"hover:bg-accent/dim-5",
|
|
1025
|
-
"enabled:active:bg-accent/dim-5",
|
|
1026
|
-
"focus-visible:bg-accent/dim-5",
|
|
1027
|
-
"text-accent"
|
|
1028
|
-
])
|
|
1029
|
-
},
|
|
1030
|
-
{
|
|
1031
|
-
intent: "basic",
|
|
1032
|
-
design: "outlined",
|
|
1033
|
-
class: (0, import_internal_utils5.tw)([
|
|
1034
|
-
"hover:bg-basic/dim-5",
|
|
1035
|
-
"enabled:active:bg-basic/dim-5",
|
|
1036
|
-
"focus-visible:bg-basic/dim-5",
|
|
1037
|
-
"text-basic"
|
|
1038
|
-
])
|
|
1039
|
-
},
|
|
1040
|
-
{
|
|
1041
|
-
intent: "success",
|
|
1042
|
-
design: "outlined",
|
|
1043
|
-
class: (0, import_internal_utils5.tw)([
|
|
1044
|
-
"hover:bg-success/dim-5",
|
|
1045
|
-
"enabled:active:bg-success/dim-5",
|
|
1046
|
-
"focus-visible:bg-success/dim-5",
|
|
1047
|
-
"text-success"
|
|
1048
|
-
])
|
|
1049
|
-
},
|
|
1050
|
-
{
|
|
1051
|
-
intent: "alert",
|
|
1052
|
-
design: "outlined",
|
|
1053
|
-
class: (0, import_internal_utils5.tw)([
|
|
1054
|
-
"hover:bg-alert/dim-5",
|
|
1055
|
-
"enabled:active:bg-alert/dim-5",
|
|
1056
|
-
"focus-visible:bg-alert/dim-5",
|
|
1057
|
-
"text-alert"
|
|
1058
|
-
])
|
|
1059
|
-
},
|
|
1060
|
-
{
|
|
1061
|
-
intent: "danger",
|
|
1062
|
-
design: "outlined",
|
|
1063
|
-
class: (0, import_internal_utils5.tw)([
|
|
1064
|
-
"hover:bg-error/dim-5",
|
|
1065
|
-
"enabled:active:bg-error/dim-5",
|
|
1066
|
-
"focus-visible:bg-error/dim-5",
|
|
1067
|
-
"text-error"
|
|
1068
|
-
])
|
|
1069
|
-
},
|
|
1070
|
-
{
|
|
1071
|
-
intent: "info",
|
|
1072
|
-
design: "outlined",
|
|
1073
|
-
class: (0, import_internal_utils5.tw)([
|
|
1074
|
-
"hover:bg-info/dim-5",
|
|
1075
|
-
"enabled:active:bg-info/dim-5",
|
|
1076
|
-
"focus-visible:bg-info/dim-5",
|
|
1077
|
-
"text-info"
|
|
1078
|
-
])
|
|
1079
|
-
},
|
|
1080
|
-
{
|
|
1081
|
-
intent: "neutral",
|
|
1082
|
-
design: "outlined",
|
|
1083
|
-
class: (0, import_internal_utils5.tw)([
|
|
1084
|
-
"hover:bg-neutral/dim-5",
|
|
1085
|
-
"enabled:active:bg-neutral/dim-5",
|
|
1086
|
-
"focus-visible:bg-neutral/dim-5",
|
|
1087
|
-
"text-neutral"
|
|
1088
|
-
])
|
|
1089
|
-
},
|
|
1090
|
-
{
|
|
1091
|
-
intent: "surface",
|
|
1092
|
-
design: "outlined",
|
|
1093
|
-
class: (0, import_internal_utils5.tw)([
|
|
1094
|
-
"hover:bg-surface/dim-5",
|
|
1095
|
-
"enabled:active:bg-surface/dim-5",
|
|
1096
|
-
"focus-visible:bg-surface/dim-5",
|
|
1097
|
-
"text-surface"
|
|
1098
|
-
])
|
|
1099
|
-
},
|
|
1100
|
-
{
|
|
1101
|
-
intent: "surfaceInverse",
|
|
1102
|
-
design: "outlined",
|
|
1103
|
-
class: (0, import_internal_utils5.tw)([
|
|
1104
|
-
"hover:bg-surface-inverse/dim-5",
|
|
1105
|
-
"enabled:active:bg-surface-inverse/dim-5",
|
|
1106
|
-
"focus-visible:bg-surface-inverse/dim-5",
|
|
1107
|
-
"text-surface-inverse"
|
|
1108
|
-
])
|
|
1109
|
-
}
|
|
1110
|
-
];
|
|
1111
|
-
|
|
1112
|
-
// src/button/variants/tinted.ts
|
|
1113
|
-
var import_internal_utils6 = require("@spark-ui/internal-utils");
|
|
1114
|
-
var tintedVariants = [
|
|
1115
|
-
{
|
|
1116
|
-
intent: "main",
|
|
1117
|
-
design: "tinted",
|
|
1118
|
-
class: (0, import_internal_utils6.tw)([
|
|
1119
|
-
"bg-main-container",
|
|
1120
|
-
"text-on-main-container",
|
|
1121
|
-
"hover:bg-main-container-hovered",
|
|
1122
|
-
"enabled:active:bg-main-container-hovered",
|
|
1123
|
-
"focus-visible:bg-main-container-hovered"
|
|
1124
|
-
])
|
|
1125
|
-
},
|
|
1126
|
-
{
|
|
1127
|
-
intent: "support",
|
|
1128
|
-
design: "tinted",
|
|
1129
|
-
class: (0, import_internal_utils6.tw)([
|
|
1130
|
-
"bg-support-container",
|
|
1131
|
-
"text-on-support-container",
|
|
1132
|
-
"hover:bg-support-container-hovered",
|
|
1133
|
-
"enabled:active:bg-support-container-hovered",
|
|
1134
|
-
"focus-visible:bg-support-container-hovered"
|
|
1135
|
-
])
|
|
1136
|
-
},
|
|
1137
|
-
{
|
|
1138
|
-
intent: "accent",
|
|
1139
|
-
design: "tinted",
|
|
1140
|
-
class: (0, import_internal_utils6.tw)([
|
|
1141
|
-
"bg-accent-container",
|
|
1142
|
-
"text-on-accent-container",
|
|
1143
|
-
"hover:bg-accent-container-hovered",
|
|
1144
|
-
"enabled:active:bg-accent-container-hovered",
|
|
1145
|
-
"focus-visible:bg-accent-container-hovered"
|
|
1146
|
-
])
|
|
1147
|
-
},
|
|
1148
|
-
{
|
|
1149
|
-
intent: "basic",
|
|
1150
|
-
design: "tinted",
|
|
1151
|
-
class: (0, import_internal_utils6.tw)([
|
|
1152
|
-
"bg-basic-container",
|
|
1153
|
-
"text-on-basic-container",
|
|
1154
|
-
"hover:bg-basic-container-hovered",
|
|
1155
|
-
"enabled:active:bg-basic-container-hovered",
|
|
1156
|
-
"focus-visible:bg-basic-container-hovered"
|
|
1157
|
-
])
|
|
1158
|
-
},
|
|
1159
|
-
{
|
|
1160
|
-
intent: "success",
|
|
1161
|
-
design: "tinted",
|
|
1162
|
-
class: (0, import_internal_utils6.tw)([
|
|
1163
|
-
"bg-success-container",
|
|
1164
|
-
"text-on-success-container",
|
|
1165
|
-
"hover:bg-success-container-hovered",
|
|
1166
|
-
"enabled:active:bg-success-container-hovered",
|
|
1167
|
-
"focus-visible:bg-success-container-hovered"
|
|
1168
|
-
])
|
|
1169
|
-
},
|
|
1170
|
-
{
|
|
1171
|
-
intent: "alert",
|
|
1172
|
-
design: "tinted",
|
|
1173
|
-
class: (0, import_internal_utils6.tw)([
|
|
1174
|
-
"bg-alert-container",
|
|
1175
|
-
"text-on-alert-container",
|
|
1176
|
-
"hover:bg-alert-container-hovered",
|
|
1177
|
-
"enabled:active:bg-alert-container-hovered",
|
|
1178
|
-
"focus-visible:bg-alert-container-hovered"
|
|
1179
|
-
])
|
|
1180
|
-
},
|
|
1181
|
-
{
|
|
1182
|
-
intent: "danger",
|
|
1183
|
-
design: "tinted",
|
|
1184
|
-
class: (0, import_internal_utils6.tw)([
|
|
1185
|
-
"bg-error-container",
|
|
1186
|
-
"text-on-error-container",
|
|
1187
|
-
"hover:bg-error-container-hovered",
|
|
1188
|
-
"enabled:active:bg-error-container-hovered",
|
|
1189
|
-
"focus-visible:bg-error-container-hovered"
|
|
1190
|
-
])
|
|
1191
|
-
},
|
|
1192
|
-
{
|
|
1193
|
-
intent: "info",
|
|
1194
|
-
design: "tinted",
|
|
1195
|
-
class: (0, import_internal_utils6.tw)([
|
|
1196
|
-
"bg-info-container",
|
|
1197
|
-
"text-on-info-container",
|
|
1198
|
-
"hover:bg-info-container-hovered",
|
|
1199
|
-
"enabled:active:bg-info-container-hovered",
|
|
1200
|
-
"focus-visible:bg-info-container-hovered"
|
|
1201
|
-
])
|
|
1202
|
-
},
|
|
1203
|
-
{
|
|
1204
|
-
intent: "neutral",
|
|
1205
|
-
design: "tinted",
|
|
1206
|
-
class: (0, import_internal_utils6.tw)([
|
|
1207
|
-
"bg-neutral-container",
|
|
1208
|
-
"text-on-neutral-container",
|
|
1209
|
-
"hover:bg-neutral-container-hovered",
|
|
1210
|
-
"enabled:active:bg-neutral-container-hovered",
|
|
1211
|
-
"focus-visible:bg-neutral-container-hovered"
|
|
1212
|
-
])
|
|
1213
|
-
},
|
|
1214
|
-
{
|
|
1215
|
-
intent: "surface",
|
|
1216
|
-
design: "tinted",
|
|
1217
|
-
class: (0, import_internal_utils6.tw)([
|
|
1218
|
-
"bg-surface",
|
|
1219
|
-
"text-on-surface",
|
|
1220
|
-
"hover:bg-surface-hovered",
|
|
1221
|
-
"enabled:active:bg-surface-hovered",
|
|
1222
|
-
"focus-visible:bg-surface-hovered"
|
|
1223
|
-
])
|
|
1224
|
-
},
|
|
1225
|
-
{
|
|
1226
|
-
intent: "surfaceInverse",
|
|
1227
|
-
design: "tinted",
|
|
1228
|
-
class: (0, import_internal_utils6.tw)([
|
|
1229
|
-
"bg-surface-inverse",
|
|
1230
|
-
"text-on-surface-inverse",
|
|
1231
|
-
"hover:bg-surface-inverse-hovered",
|
|
1232
|
-
"enabled:active:bg-surface-inverse-hovered",
|
|
1233
|
-
"focus-visible:bg-surface-inverse-hovered"
|
|
1234
|
-
])
|
|
1235
|
-
}
|
|
1236
|
-
];
|
|
1237
|
-
|
|
1238
|
-
// src/button/variants/contrast.ts
|
|
1239
|
-
var import_internal_utils7 = require("@spark-ui/internal-utils");
|
|
1240
|
-
var contrastVariants = [
|
|
1241
|
-
{
|
|
1242
|
-
intent: "main",
|
|
1243
|
-
design: "contrast",
|
|
1244
|
-
class: (0, import_internal_utils7.tw)([
|
|
1245
|
-
"text-on-main-contaier bg-surface",
|
|
1246
|
-
"hover:bg-main-container-hovered",
|
|
1247
|
-
"enabled:active:bg-main-container-hovered",
|
|
1248
|
-
"focus-visible:bg-main-container-hovered"
|
|
1249
|
-
])
|
|
1250
|
-
},
|
|
1251
|
-
{
|
|
1252
|
-
intent: "support",
|
|
1253
|
-
design: "contrast",
|
|
1254
|
-
class: (0, import_internal_utils7.tw)([
|
|
1255
|
-
"text-on-support-container bg-surface",
|
|
1256
|
-
"hover:bg-support-container-hovered",
|
|
1257
|
-
"enabled:active:bg-support-container-hovered",
|
|
1258
|
-
"focus-visible:bg-support-container-hovered"
|
|
1259
|
-
])
|
|
1260
|
-
},
|
|
1261
|
-
{
|
|
1262
|
-
intent: "accent",
|
|
1263
|
-
design: "contrast",
|
|
1264
|
-
class: (0, import_internal_utils7.tw)([
|
|
1265
|
-
"text-on-accent-container bg-surface",
|
|
1266
|
-
"hover:bg-accent-container-hovered",
|
|
1267
|
-
"enabled:active:bg-accent-container-hovered",
|
|
1268
|
-
"focus-visible:bg-accent-container-hovered"
|
|
1269
|
-
])
|
|
1270
|
-
},
|
|
1271
|
-
{
|
|
1272
|
-
intent: "basic",
|
|
1273
|
-
design: "contrast",
|
|
1274
|
-
class: (0, import_internal_utils7.tw)([
|
|
1275
|
-
"text-on-basic-container bg-surface",
|
|
1276
|
-
"hover:bg-basic-container-hovered",
|
|
1277
|
-
"enabled:active:bg-basic-container-hovered",
|
|
1278
|
-
"focus-visible:bg-basic-container-hovered"
|
|
1279
|
-
])
|
|
1280
|
-
},
|
|
1281
|
-
{
|
|
1282
|
-
intent: "success",
|
|
1283
|
-
design: "contrast",
|
|
1284
|
-
class: (0, import_internal_utils7.tw)([
|
|
1285
|
-
"text-on-success-container bg-surface",
|
|
1286
|
-
"hover:bg-success-container-hovered",
|
|
1287
|
-
"enabled:active:bg-success-container-hovered",
|
|
1288
|
-
"focus-visible:bg-success-container-hovered"
|
|
1289
|
-
])
|
|
1290
|
-
},
|
|
1291
|
-
{
|
|
1292
|
-
intent: "alert",
|
|
1293
|
-
design: "contrast",
|
|
1294
|
-
class: (0, import_internal_utils7.tw)([
|
|
1295
|
-
"text-on-alert-container bg-surface",
|
|
1296
|
-
"hover:bg-alert-container-hovered",
|
|
1297
|
-
"enabled:active:bg-alert-container-hovered",
|
|
1298
|
-
"focus-visible:bg-alert-container-hovered"
|
|
1299
|
-
])
|
|
1300
|
-
},
|
|
1301
|
-
{
|
|
1302
|
-
intent: "danger",
|
|
1303
|
-
design: "contrast",
|
|
1304
|
-
class: (0, import_internal_utils7.tw)([
|
|
1305
|
-
"text-on-error-container bg-surface",
|
|
1306
|
-
"hover:bg-error-container-hovered",
|
|
1307
|
-
"enabled:active:bg-error-container-hovered",
|
|
1308
|
-
"focus-visible:bg-error-container-hovered"
|
|
1309
|
-
])
|
|
1310
|
-
},
|
|
1311
|
-
{
|
|
1312
|
-
intent: "info",
|
|
1313
|
-
design: "contrast",
|
|
1314
|
-
class: (0, import_internal_utils7.tw)([
|
|
1315
|
-
"text-on-info-container bg-surface",
|
|
1316
|
-
"hover:bg-info-container-hovered",
|
|
1317
|
-
"enabled:active:bg-info-container-hovered",
|
|
1318
|
-
"focus-visible:bg-info-container-hovered"
|
|
1319
|
-
])
|
|
1320
|
-
},
|
|
1321
|
-
{
|
|
1322
|
-
intent: "neutral",
|
|
1323
|
-
design: "contrast",
|
|
1324
|
-
class: (0, import_internal_utils7.tw)([
|
|
1325
|
-
"text-on-neutral-container bg-surface",
|
|
1326
|
-
"hover:bg-neutral-container-hovered",
|
|
1327
|
-
"enabled:active:bg-neutral-container-hovered",
|
|
1328
|
-
"focus-visible:bg-neutral-container-hovered"
|
|
1329
|
-
])
|
|
1330
|
-
},
|
|
1331
|
-
{
|
|
1332
|
-
intent: "surface",
|
|
1333
|
-
design: "contrast",
|
|
1334
|
-
class: (0, import_internal_utils7.tw)([
|
|
1335
|
-
"text-on-surface bg-surface",
|
|
1336
|
-
"hover:bg-surface-hovered",
|
|
1337
|
-
"enabled:active:bg-surface-hovered",
|
|
1338
|
-
"focus-visible:bg-surface-hovered"
|
|
1339
|
-
])
|
|
1340
|
-
},
|
|
1341
|
-
{
|
|
1342
|
-
intent: "surfaceInverse",
|
|
1343
|
-
design: "contrast",
|
|
1344
|
-
class: (0, import_internal_utils7.tw)([
|
|
1345
|
-
"text-on-surface-inverse bg-surface-inverse",
|
|
1346
|
-
"hover:bg-surface-inverse-hovered",
|
|
1347
|
-
"enabled:active:bg-surface-inverse-hovered",
|
|
1348
|
-
"focus-visible:bg-surface-inverse-hovered"
|
|
1349
|
-
])
|
|
1350
|
-
}
|
|
1351
|
-
];
|
|
1352
|
-
|
|
1353
|
-
// src/button/Button.styles.tsx
|
|
1354
|
-
var buttonStyles = (0, import_class_variance_authority5.cva)(
|
|
1355
|
-
[
|
|
1356
|
-
"u-shadow-border-transition",
|
|
1357
|
-
"box-border inline-flex items-center justify-center gap-md whitespace-nowrap",
|
|
1358
|
-
"default:px-lg",
|
|
1359
|
-
"text-body-1 font-bold",
|
|
1360
|
-
"focus-visible:u-outline"
|
|
1361
|
-
],
|
|
1362
|
-
{
|
|
1363
|
-
variants: {
|
|
1364
|
-
/**
|
|
1365
|
-
* Main style of the button.
|
|
1366
|
-
*
|
|
1367
|
-
* - `filled`: Button will be plain.
|
|
1368
|
-
*
|
|
1369
|
-
* - `outlined`: Button will be transparent with an outline.
|
|
1370
|
-
*
|
|
1371
|
-
* - `tinted`: Button will be filled but using a lighter color scheme.
|
|
1372
|
-
*
|
|
1373
|
-
* - `ghost`: Button will look like a link. No borders, plain text.
|
|
1374
|
-
*
|
|
1375
|
-
* - `contrast`: Button will be surface filled. No borders, plain text.
|
|
1376
|
-
*
|
|
1377
|
-
*/
|
|
1378
|
-
design: (0, import_internal_utils8.makeVariants)({
|
|
1379
|
-
filled: [],
|
|
1380
|
-
outlined: ["bg-transparent", "border-sm", "border-current"],
|
|
1381
|
-
tinted: [],
|
|
1382
|
-
ghost: ["default:-mx-md px-md hover:bg-main/dim-5"],
|
|
1383
|
-
contrast: []
|
|
1384
|
-
}),
|
|
1385
|
-
underline: {
|
|
1386
|
-
true: ["underline"]
|
|
1387
|
-
},
|
|
1388
|
-
/**
|
|
1389
|
-
* Color scheme of the button.
|
|
1390
|
-
*/
|
|
1391
|
-
intent: (0, import_internal_utils8.makeVariants)({
|
|
1392
|
-
main: [],
|
|
1393
|
-
support: [],
|
|
1394
|
-
accent: [],
|
|
1395
|
-
basic: [],
|
|
1396
|
-
success: [],
|
|
1397
|
-
alert: [],
|
|
1398
|
-
danger: [],
|
|
1399
|
-
info: [],
|
|
1400
|
-
neutral: [],
|
|
1401
|
-
surface: [],
|
|
1402
|
-
surfaceInverse: []
|
|
1403
|
-
}),
|
|
1404
|
-
/**
|
|
1405
|
-
* Size of the button.
|
|
1406
|
-
*/
|
|
1407
|
-
size: (0, import_internal_utils8.makeVariants)({
|
|
1408
|
-
sm: ["min-w-sz-32", "h-sz-32"],
|
|
1409
|
-
md: ["min-w-sz-44", "h-sz-44"],
|
|
1410
|
-
lg: ["min-w-sz-56", "h-sz-56"]
|
|
1411
|
-
}),
|
|
1412
|
-
/**
|
|
1413
|
-
* Shape of the button.
|
|
1414
|
-
*/
|
|
1415
|
-
shape: (0, import_internal_utils8.makeVariants)({
|
|
1416
|
-
rounded: ["rounded-lg"],
|
|
1417
|
-
square: ["rounded-0"],
|
|
1418
|
-
pill: ["rounded-full"]
|
|
1419
|
-
}),
|
|
1420
|
-
/**
|
|
1421
|
-
* Disable the button, preventing user interaction and adding opacity.
|
|
1422
|
-
*/
|
|
1423
|
-
disabled: {
|
|
1424
|
-
true: ["cursor-not-allowed", "opacity-dim-3"],
|
|
1425
|
-
false: ["cursor-pointer"]
|
|
1426
|
-
}
|
|
1427
|
-
},
|
|
1428
|
-
compoundVariants: [
|
|
1429
|
-
...filledVariants,
|
|
1430
|
-
...outlinedVariants,
|
|
1431
|
-
...tintedVariants,
|
|
1432
|
-
...ghostVariants,
|
|
1433
|
-
...contrastVariants
|
|
1434
|
-
],
|
|
1435
|
-
defaultVariants: {
|
|
1436
|
-
design: "filled",
|
|
1437
|
-
intent: "main",
|
|
1438
|
-
size: "md",
|
|
1439
|
-
shape: "rounded"
|
|
1440
|
-
}
|
|
1441
|
-
}
|
|
1442
|
-
);
|
|
1443
|
-
|
|
1444
|
-
// src/button/Button.tsx
|
|
1445
|
-
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
1446
|
-
var blockedEventHandlers = [
|
|
1447
|
-
"onClick",
|
|
1448
|
-
"onMouseDown",
|
|
1449
|
-
"onMouseUp",
|
|
1450
|
-
"onMouseEnter",
|
|
1451
|
-
"onMouseLeave",
|
|
1452
|
-
"onMouseOver",
|
|
1453
|
-
"onMouseOut",
|
|
1454
|
-
"onKeyDown",
|
|
1455
|
-
"onKeyPress",
|
|
1456
|
-
"onKeyUp",
|
|
1457
|
-
"onSubmit"
|
|
1458
|
-
];
|
|
1459
|
-
var Button = ({
|
|
1460
|
-
children,
|
|
1461
|
-
design = "filled",
|
|
1462
|
-
disabled = false,
|
|
1463
|
-
intent = "main",
|
|
1464
|
-
isLoading = false,
|
|
1465
|
-
loadingLabel,
|
|
1466
|
-
loadingText,
|
|
1467
|
-
shape = "rounded",
|
|
1468
|
-
size = "md",
|
|
1469
|
-
asChild,
|
|
1470
|
-
className,
|
|
1471
|
-
underline = false,
|
|
1472
|
-
ref,
|
|
1473
|
-
...others
|
|
1474
|
-
}) => {
|
|
1475
|
-
const Component = asChild ? Slot : "button";
|
|
1476
|
-
const shouldNotInteract = !!disabled || isLoading;
|
|
1477
|
-
const disabledEventHandlers = (0, import_react10.useMemo)(() => {
|
|
1478
|
-
const result = {};
|
|
1479
|
-
if (shouldNotInteract) {
|
|
1480
|
-
blockedEventHandlers.forEach((eventHandler) => result[eventHandler] = void 0);
|
|
1481
|
-
}
|
|
1482
|
-
return result;
|
|
1483
|
-
}, [shouldNotInteract]);
|
|
1484
|
-
const spinnerProps = {
|
|
1485
|
-
size: "current",
|
|
1486
|
-
className: loadingText ? "inline-block" : "absolute",
|
|
1487
|
-
...loadingLabel && { "aria-label": loadingLabel }
|
|
1488
|
-
};
|
|
1489
|
-
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1490
|
-
Component,
|
|
1491
|
-
{
|
|
1492
|
-
"data-spark-component": "button",
|
|
1493
|
-
...Component === "button" && { type: "button" },
|
|
1494
|
-
ref,
|
|
1495
|
-
className: buttonStyles({
|
|
1496
|
-
className,
|
|
1497
|
-
design,
|
|
1498
|
-
disabled: shouldNotInteract,
|
|
1499
|
-
intent,
|
|
1500
|
-
shape,
|
|
1501
|
-
size,
|
|
1502
|
-
underline
|
|
1503
|
-
}),
|
|
1504
|
-
disabled: !!disabled,
|
|
1505
|
-
"aria-busy": isLoading,
|
|
1506
|
-
"aria-live": isLoading ? "assertive" : "off",
|
|
1507
|
-
...others,
|
|
1508
|
-
...disabledEventHandlers,
|
|
1509
|
-
children: wrapPolymorphicSlot(
|
|
1510
|
-
asChild,
|
|
1511
|
-
children,
|
|
1512
|
-
(slotted) => isLoading ? /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_jsx_runtime7.Fragment, { children: [
|
|
1513
|
-
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Spinner, { ...spinnerProps }),
|
|
1514
|
-
loadingText && loadingText,
|
|
1515
|
-
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1516
|
-
"div",
|
|
1517
|
-
{
|
|
1518
|
-
"aria-hidden": true,
|
|
1519
|
-
className: (0, import_class_variance_authority6.cx)("gap-md", loadingText ? "hidden" : "inline-flex opacity-0"),
|
|
1520
|
-
children: slotted
|
|
1521
|
-
}
|
|
1522
|
-
)
|
|
1523
|
-
] }) : slotted
|
|
1524
|
-
)
|
|
1525
|
-
}
|
|
1526
|
-
);
|
|
1527
|
-
};
|
|
1528
|
-
Button.displayName = "Button";
|
|
1529
|
-
|
|
1530
|
-
// src/icon-button/IconButton.styles.tsx
|
|
1531
|
-
var import_internal_utils9 = require("@spark-ui/internal-utils");
|
|
1532
|
-
var import_class_variance_authority7 = require("class-variance-authority");
|
|
1533
|
-
var iconButtonStyles = (0, import_class_variance_authority7.cva)(["pl-0 pr-0"], {
|
|
1534
|
-
variants: {
|
|
1535
|
-
/**
|
|
1536
|
-
* Sets the size of the icon.
|
|
1537
|
-
*/
|
|
1538
|
-
size: (0, import_internal_utils9.makeVariants)({
|
|
1539
|
-
sm: ["text-body-1"],
|
|
1540
|
-
md: ["text-body-1"],
|
|
1541
|
-
lg: ["text-display-3"]
|
|
1542
|
-
})
|
|
1543
|
-
}
|
|
1544
|
-
});
|
|
1545
|
-
|
|
1546
|
-
// src/icon-button/IconButton.tsx
|
|
1547
|
-
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
1548
|
-
var IconButton = ({
|
|
1549
|
-
design = "filled",
|
|
1550
|
-
disabled = false,
|
|
1551
|
-
intent = "main",
|
|
1552
|
-
shape = "rounded",
|
|
1553
|
-
size = "md",
|
|
1554
|
-
className,
|
|
1555
|
-
ref,
|
|
1556
|
-
...others
|
|
1557
|
-
}) => {
|
|
1558
|
-
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1559
|
-
Button,
|
|
1560
|
-
{
|
|
1561
|
-
"data-spark-component": "icon-button",
|
|
1562
|
-
ref,
|
|
1563
|
-
className: iconButtonStyles({ size, className }),
|
|
1564
|
-
design,
|
|
1565
|
-
disabled,
|
|
1566
|
-
intent,
|
|
1567
|
-
shape,
|
|
1568
|
-
size,
|
|
1569
|
-
...others
|
|
1570
|
-
}
|
|
1571
|
-
);
|
|
1572
|
-
};
|
|
1573
|
-
IconButton.displayName = "IconButton";
|
|
1574
|
-
|
|
1575
|
-
// src/carousel/CarouselNextButton.tsx
|
|
1576
|
-
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
1577
|
-
var CarouselNextButton = ({
|
|
1578
|
-
"aria-label": ariaLabel,
|
|
1579
|
-
...buttonProps
|
|
1580
|
-
}) => {
|
|
1581
|
-
const ctx = useCarouselContext();
|
|
1582
|
-
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1583
|
-
IconButton,
|
|
1584
|
-
{
|
|
1585
|
-
"data-spark-component": "carousel-next-button",
|
|
1586
|
-
...ctx.getNextTriggerProps(),
|
|
1587
|
-
intent: "surface",
|
|
1588
|
-
design: "filled",
|
|
1589
|
-
className: "pointer-events-auto cursor-pointer shadow-sm disabled:invisible",
|
|
1590
|
-
"aria-label": ariaLabel,
|
|
1591
|
-
...buttonProps,
|
|
1592
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Icon, { children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_ArrowVerticalRight.ArrowVerticalRight, {}) })
|
|
1593
|
-
}
|
|
1594
|
-
);
|
|
1595
|
-
};
|
|
1596
|
-
CarouselNextButton.displayName = "Carousel.NextButton";
|
|
1597
|
-
|
|
1598
|
-
// src/carousel/CarouselPageIndicator.tsx
|
|
1599
|
-
var import_class_variance_authority8 = require("class-variance-authority");
|
|
1600
|
-
var import_react11 = require("react");
|
|
1601
|
-
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
1602
|
-
var CarouselPageIndicator = ({
|
|
1603
|
-
children,
|
|
1604
|
-
unstyled = false,
|
|
1605
|
-
index,
|
|
1606
|
-
"aria-label": ariaLabel,
|
|
1607
|
-
className,
|
|
1608
|
-
intent = "basic"
|
|
1609
|
-
}) => {
|
|
1610
|
-
const ctx = useCarouselContext();
|
|
1611
|
-
const ref = (0, import_react11.useRef)(null);
|
|
1612
|
-
(0, import_react11.useEffect)(() => {
|
|
1613
|
-
if (ctx.pageIndicatorsRefs.current) {
|
|
1614
|
-
ctx.pageIndicatorsRefs.current[index] = ref.current;
|
|
1615
|
-
}
|
|
1616
|
-
});
|
|
1617
|
-
const indicatorProps = ctx.getIndicatorProps({ index });
|
|
1618
|
-
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1619
|
-
"button",
|
|
1620
|
-
{
|
|
1621
|
-
"data-spark-component": "carousel-page-indicator",
|
|
1622
|
-
ref,
|
|
1623
|
-
...indicatorProps,
|
|
1624
|
-
"aria-label": ariaLabel,
|
|
1625
|
-
className: (0, import_class_variance_authority8.cx)(
|
|
1626
|
-
{
|
|
1627
|
-
[(0, import_class_variance_authority8.cx)(
|
|
1628
|
-
"border-outline group relative flex justify-center border-0 hover:cursor-pointer",
|
|
1629
|
-
"m-sm rounded-sm transition-all duration-[200ms] ease-linear",
|
|
1630
|
-
"w-sz-8 h-sz-8",
|
|
1631
|
-
"data-[state=active]:w-sz-32 data-[state=active]:h-sz-8",
|
|
1632
|
-
"data-[state=edge]:w-sz-4 data-[state=edge]:h-sz-4",
|
|
1633
|
-
"data-[state=hidden]:m-0 data-[state=hidden]:size-0",
|
|
1634
|
-
intent === "surface" ? "data-[state=active]:bg-surface bg-surface/dim-2" : "data-[state=active]:bg-basic bg-on-surface/dim-2"
|
|
1635
|
-
)]: !unstyled
|
|
1636
|
-
// [dotsStyles]: !unstyled,
|
|
1637
|
-
},
|
|
1638
|
-
className
|
|
1639
|
-
),
|
|
1640
|
-
children
|
|
1641
|
-
},
|
|
1642
|
-
index
|
|
1643
|
-
);
|
|
1644
|
-
};
|
|
1645
|
-
CarouselPageIndicator.displayName = "Carousel.PageIndicator";
|
|
1646
|
-
|
|
1647
|
-
// src/carousel/CarouselPagePicker.tsx
|
|
1648
|
-
var import_class_variance_authority9 = require("class-variance-authority");
|
|
1649
|
-
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
1650
|
-
var CarouselPagePicker = ({ children, className }) => {
|
|
1651
|
-
const ctx = useCarouselContext();
|
|
1652
|
-
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_jsx_runtime11.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
1653
|
-
"div",
|
|
1654
|
-
{
|
|
1655
|
-
"data-spark-component": "carousel-page-picker",
|
|
1656
|
-
...ctx.getIndicatorGroupProps(),
|
|
1657
|
-
className: (0, import_class_variance_authority9.cx)(
|
|
1658
|
-
"flex-wrap items-center justify-center",
|
|
1659
|
-
"default:min-h-sz-16 flex",
|
|
1660
|
-
ctx.pagePickerInset && "bottom-sz-12 absolute inset-x-0",
|
|
1661
|
-
className
|
|
1662
|
-
),
|
|
1663
|
-
children: ctx.pageSnapPoints.length <= 1 ? null : children({
|
|
1664
|
-
...ctx,
|
|
1665
|
-
pages: Array.from({ length: ctx.pageSnapPoints.length }, (_, i) => i)
|
|
1666
|
-
})
|
|
1667
|
-
}
|
|
1668
|
-
) });
|
|
1669
|
-
};
|
|
1670
|
-
CarouselPagePicker.displayName = "Carousel.PagePicker";
|
|
1671
|
-
|
|
1672
|
-
// src/carousel/CarouselPrevButton.tsx
|
|
1673
|
-
var import_ArrowVerticalLeft = require("@spark-ui/icons/ArrowVerticalLeft");
|
|
1674
|
-
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
1675
|
-
var CarouselPrevButton = ({
|
|
1676
|
-
"aria-label": ariaLabel,
|
|
1677
|
-
...buttonProps
|
|
1678
|
-
}) => {
|
|
1679
|
-
const ctx = useCarouselContext();
|
|
1680
|
-
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1681
|
-
IconButton,
|
|
1682
|
-
{
|
|
1683
|
-
"data-spark-component": "carousel-prev-button",
|
|
1684
|
-
...ctx.getPrevTriggerProps(),
|
|
1685
|
-
intent: "surface",
|
|
1686
|
-
design: "filled",
|
|
1687
|
-
className: "pointer-events-auto cursor-pointer shadow-sm disabled:invisible",
|
|
1688
|
-
"aria-label": ariaLabel,
|
|
1689
|
-
...buttonProps,
|
|
1690
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Icon, { children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_ArrowVerticalLeft.ArrowVerticalLeft, {}) })
|
|
1691
|
-
}
|
|
1692
|
-
);
|
|
1693
|
-
};
|
|
1694
|
-
CarouselPrevButton.displayName = "Carousel.PrevButton";
|
|
1695
|
-
|
|
1696
|
-
// src/carousel/CarouselSlide.tsx
|
|
1697
|
-
var import_class_variance_authority10 = require("class-variance-authority");
|
|
1698
|
-
var import_react13 = require("react");
|
|
1699
|
-
|
|
1700
|
-
// src/carousel/useIsVisible.ts
|
|
1701
|
-
var import_react12 = require("react");
|
|
1702
|
-
function useIsVisible(elementRef, parentRef) {
|
|
1703
|
-
const [isVisible, setIsVisible] = (0, import_react12.useState)(true);
|
|
1704
|
-
(0, import_react12.useLayoutEffect)(() => {
|
|
1705
|
-
const el = elementRef.current;
|
|
1706
|
-
const parent = parentRef.current;
|
|
1707
|
-
if (!parent || !el) return;
|
|
1708
|
-
const observer = new IntersectionObserver(
|
|
1709
|
-
([entry]) => {
|
|
1710
|
-
if (entry) {
|
|
1711
|
-
setIsVisible(entry.isIntersecting);
|
|
1712
|
-
}
|
|
1713
|
-
},
|
|
1714
|
-
{ root: parent, threshold: 0.2 }
|
|
1715
|
-
);
|
|
1716
|
-
observer.observe(el);
|
|
1717
|
-
return () => observer.disconnect();
|
|
1718
|
-
});
|
|
1719
|
-
return isVisible;
|
|
1720
|
-
}
|
|
1721
|
-
|
|
1722
|
-
// src/carousel/CarouselSlide.tsx
|
|
1723
|
-
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
1724
|
-
var CarouselSlide = ({
|
|
1725
|
-
children,
|
|
1726
|
-
index = 0,
|
|
1727
|
-
totalSlides,
|
|
1728
|
-
className = "",
|
|
1729
|
-
...props
|
|
1730
|
-
}) => {
|
|
1731
|
-
const itemRef = (0, import_react13.useRef)(null);
|
|
1732
|
-
const ctx = useCarouselContext();
|
|
1733
|
-
const isVisible = useIsVisible(itemRef, ctx.ref);
|
|
1734
|
-
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1735
|
-
"div",
|
|
1736
|
-
{
|
|
1737
|
-
"data-spark-component": "carousel-slide",
|
|
1738
|
-
ref: itemRef,
|
|
1739
|
-
...ctx.getSlideProps({ index, totalSlides }),
|
|
1740
|
-
className: (0, import_class_variance_authority10.cx)("default:bg-surface relative overflow-hidden", className),
|
|
1741
|
-
"aria-hidden": !isVisible,
|
|
1742
|
-
inert: !isVisible,
|
|
1743
|
-
...props,
|
|
1744
|
-
children
|
|
1745
|
-
}
|
|
1746
|
-
);
|
|
1747
|
-
};
|
|
1748
|
-
CarouselSlide.displayName = "Carousel.Slide";
|
|
1749
|
-
|
|
1750
|
-
// src/carousel/CarouselSlides.tsx
|
|
1751
|
-
var import_class_variance_authority11 = require("class-variance-authority");
|
|
1752
|
-
var import_react14 = require("react");
|
|
1753
|
-
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
1754
|
-
var CarouselSlides = ({ children, className = "" }) => {
|
|
1755
|
-
const ctx = useCarouselContext();
|
|
1756
|
-
const childrenElements = import_react14.Children.toArray(children);
|
|
1757
|
-
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
1758
|
-
"div",
|
|
1759
|
-
{
|
|
1760
|
-
"data-spark-component": "carousel-slides",
|
|
1761
|
-
...ctx.getSlidesContainerProps(),
|
|
1762
|
-
className: (0, import_class_variance_authority11.cx)(
|
|
1763
|
-
"focus-visible:u-outline relative w-full",
|
|
1764
|
-
"[-ms-overflow-style:none] [scrollbar-width:none] [&::-webkit-scrollbar]:hidden",
|
|
1765
|
-
className
|
|
1766
|
-
),
|
|
1767
|
-
children: childrenElements.map(
|
|
1768
|
-
(child, index) => (0, import_react14.isValidElement)(child) ? (0, import_react14.cloneElement)(child, {
|
|
1769
|
-
index,
|
|
1770
|
-
totalSlides: childrenElements.length
|
|
1771
|
-
}) : child
|
|
1772
|
-
)
|
|
1773
|
-
}
|
|
1774
|
-
);
|
|
1775
|
-
};
|
|
1776
|
-
CarouselSlides.displayName = "Carousel.Slides";
|
|
1777
|
-
|
|
1778
|
-
// src/carousel/CarouselViewport.tsx
|
|
1779
|
-
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
1780
|
-
var CarouselViewport = ({ children }) => {
|
|
1781
|
-
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "relative flex items-center justify-around p-0", children });
|
|
1782
|
-
};
|
|
1783
|
-
CarouselViewport.displayName = "Carousel.Viewport";
|
|
1784
|
-
|
|
1785
|
-
// src/carousel/index.ts
|
|
1786
|
-
var Carousel2 = Object.assign(Carousel, {
|
|
1787
|
-
Controls: CarouselControls,
|
|
1788
|
-
NextButton: CarouselNextButton,
|
|
1789
|
-
PrevButton: CarouselPrevButton,
|
|
1790
|
-
Slide: CarouselSlide,
|
|
1791
|
-
Slides: CarouselSlides,
|
|
1792
|
-
Viewport: CarouselViewport,
|
|
1793
|
-
PagePicker: CarouselPagePicker,
|
|
1794
|
-
PageIndicator: CarouselPageIndicator
|
|
1795
|
-
});
|
|
1796
|
-
Carousel2.displayName = "Carousel";
|
|
1797
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
1798
|
-
0 && (module.exports = {
|
|
1799
|
-
Carousel
|
|
1800
|
-
});
|
|
1801
|
-
//# sourceMappingURL=index.js.map
|