@atom-learning/components 6.16.1-beta.0 → 6.17.0-beta.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/dist/components/carousel/Carousel.d.ts +32 -25
- package/dist/components/carousel/Carousel.js +83 -13
- package/dist/components/carousel/Carousel.js.map +1 -1
- package/dist/components/carousel/CarouselArrows.d.ts +5 -6
- package/dist/components/carousel/CarouselArrows.js +25 -9
- package/dist/components/carousel/CarouselArrows.js.map +1 -1
- package/dist/components/carousel/CarouselPagination.d.ts +2 -3
- package/dist/components/carousel/CarouselPagination.js +31 -17
- package/dist/components/carousel/CarouselPagination.js.map +1 -1
- package/dist/components/carousel/CarouselSlide.d.ts +2 -4
- package/dist/components/carousel/CarouselSlide.js +12 -5
- package/dist/components/carousel/CarouselSlide.js.map +1 -1
- package/dist/components/carousel/CarouselSlider.d.ts +6 -4
- package/dist/components/carousel/CarouselSlider.js +12 -5
- package/dist/components/carousel/CarouselSlider.js.map +1 -1
- package/dist/components/dialog/DialogContent.js +1 -1
- package/dist/components/dialog/DialogContent.js.map +1 -1
- package/dist/components/toast/ToastProvider.js +1 -2
- package/dist/components/toast/ToastProvider.js.map +1 -1
- package/dist/docgen.json +1 -1
- package/dist/index.cjs.js +160 -48
- package/dist/index.cjs.js.map +1 -1
- package/package.json +2 -3
- package/src/index.css +0 -2
package/dist/index.cjs.js
CHANGED
|
@@ -45,7 +45,8 @@ let _radix_ui_react_tooltip = require("@radix-ui/react-tooltip");
|
|
|
45
45
|
let _radix_ui_react_alert_dialog = require("@radix-ui/react-alert-dialog");
|
|
46
46
|
let uid = require("uid");
|
|
47
47
|
let throttle_debounce = require("throttle-debounce");
|
|
48
|
-
let
|
|
48
|
+
let embla_carousel_react = require("embla-carousel-react");
|
|
49
|
+
embla_carousel_react = __toESM(embla_carousel_react);
|
|
49
50
|
let _radix_ui_react_checkbox = require("@radix-ui/react-checkbox");
|
|
50
51
|
_radix_ui_react_checkbox = __toESM(_radix_ui_react_checkbox);
|
|
51
52
|
let _radix_ui_react_collapsible = require("@radix-ui/react-collapsible");
|
|
@@ -687,7 +688,7 @@ var useIsMountedRef = () => {
|
|
|
687
688
|
};
|
|
688
689
|
//#endregion
|
|
689
690
|
//#region src/components/loader/Loader.tsx
|
|
690
|
-
var Dot = styled("div", {
|
|
691
|
+
var Dot$1 = styled("div", {
|
|
691
692
|
base: [
|
|
692
693
|
"animate-pulse",
|
|
693
694
|
"bg-current",
|
|
@@ -706,7 +707,7 @@ var Loader = ({ className, message = "Loading", size = "md", ...props }) => /* @
|
|
|
706
707
|
className: cn("flex", "justify-center", className),
|
|
707
708
|
role: "alert",
|
|
708
709
|
...props
|
|
709
|
-
}, /* @__PURE__ */ react.createElement("span", { className: "sr-only" }, message), /* @__PURE__ */ react.createElement(Dot, { size }), /* @__PURE__ */ react.createElement(Dot, { size }), /* @__PURE__ */ react.createElement(Dot, { size }));
|
|
710
|
+
}, /* @__PURE__ */ react.createElement("span", { className: "sr-only" }, message), /* @__PURE__ */ react.createElement(Dot$1, { size }), /* @__PURE__ */ react.createElement(Dot$1, { size }), /* @__PURE__ */ react.createElement(Dot$1, { size }));
|
|
710
711
|
//#endregion
|
|
711
712
|
//#region src/components/button/Button.tsx
|
|
712
713
|
var StyledButton = styled("button", {
|
|
@@ -2125,9 +2126,8 @@ var Box = styled("div", { base: [] });
|
|
|
2125
2126
|
Box.displayName = "Box";
|
|
2126
2127
|
//#endregion
|
|
2127
2128
|
//#region src/components/carousel/CarouselArrows.tsx
|
|
2128
|
-
var
|
|
2129
|
+
var ArrowButton = styled("button", { base: [
|
|
2129
2130
|
"items-center",
|
|
2130
|
-
"bg-[unset]",
|
|
2131
2131
|
"text-primary-800",
|
|
2132
2132
|
"cursor-pointer",
|
|
2133
2133
|
"flex",
|
|
@@ -2140,55 +2140,168 @@ var buttonStyles = [
|
|
|
2140
2140
|
"ease-in-out",
|
|
2141
2141
|
"hover:text-primary-900",
|
|
2142
2142
|
"active:text-primary-1000",
|
|
2143
|
-
"disabled:text-grey-200"
|
|
2144
|
-
|
|
2145
|
-
|
|
2146
|
-
var
|
|
2147
|
-
|
|
2148
|
-
|
|
2143
|
+
"disabled:text-grey-200",
|
|
2144
|
+
"disabled:cursor-not-allowed"
|
|
2145
|
+
] });
|
|
2146
|
+
var CarouselArrowPrevious = (props) => {
|
|
2147
|
+
const { scrollPrev, canScrollPrev } = useCarousel();
|
|
2148
|
+
return /* @__PURE__ */ react.createElement(ArrowButton, {
|
|
2149
|
+
type: "button",
|
|
2150
|
+
onClick: scrollPrev,
|
|
2151
|
+
disabled: !canScrollPrev,
|
|
2152
|
+
"aria-label": "Previous slide",
|
|
2153
|
+
...props
|
|
2154
|
+
}, /* @__PURE__ */ react.createElement(Icon, { is: _atom_learning_icons.ChevronLeft }));
|
|
2155
|
+
};
|
|
2156
|
+
var CarouselArrowNext = (props) => {
|
|
2157
|
+
const { scrollNext, canScrollNext } = useCarousel();
|
|
2158
|
+
return /* @__PURE__ */ react.createElement(ArrowButton, {
|
|
2159
|
+
type: "button",
|
|
2160
|
+
onClick: scrollNext,
|
|
2161
|
+
disabled: !canScrollNext,
|
|
2162
|
+
"aria-label": "Next slide",
|
|
2163
|
+
...props
|
|
2164
|
+
}, /* @__PURE__ */ react.createElement(Icon, { is: _atom_learning_icons.ChevronRight }));
|
|
2165
|
+
};
|
|
2149
2166
|
//#endregion
|
|
2150
2167
|
//#region src/components/carousel/CarouselPagination.tsx
|
|
2151
|
-
var
|
|
2152
|
-
"
|
|
2153
|
-
"
|
|
2154
|
-
"
|
|
2155
|
-
"
|
|
2156
|
-
"
|
|
2157
|
-
"
|
|
2158
|
-
"
|
|
2159
|
-
"
|
|
2160
|
-
"
|
|
2161
|
-
"
|
|
2162
|
-
"
|
|
2163
|
-
"
|
|
2164
|
-
"
|
|
2165
|
-
"[&_button]:transition-all"
|
|
2168
|
+
var Dot = styled("button", { base: [
|
|
2169
|
+
"bg-grey-600",
|
|
2170
|
+
"cursor-pointer",
|
|
2171
|
+
"duration-100",
|
|
2172
|
+
"ease-in",
|
|
2173
|
+
"focus:bg-primary-900",
|
|
2174
|
+
"hover:bg-primary-900",
|
|
2175
|
+
"mx-1",
|
|
2176
|
+
"p-1",
|
|
2177
|
+
"rounded-full",
|
|
2178
|
+
"size-3",
|
|
2179
|
+
"transition-all",
|
|
2180
|
+
"disabled:bg-primary-800",
|
|
2181
|
+
"disabled:cursor-default"
|
|
2166
2182
|
] });
|
|
2183
|
+
var CarouselPagination = ({ className, ...rest }) => {
|
|
2184
|
+
const { scrollSnaps, selectedIndex, scrollTo } = useCarousel();
|
|
2185
|
+
const dots = Array.from({ length: scrollSnaps.length }, (_, i) => i);
|
|
2186
|
+
return /* @__PURE__ */ react.createElement("div", {
|
|
2187
|
+
className: cn("flex", "justify-center", className),
|
|
2188
|
+
...rest
|
|
2189
|
+
}, dots.map((index) => /* @__PURE__ */ react.createElement(Dot, {
|
|
2190
|
+
key: index,
|
|
2191
|
+
type: "button",
|
|
2192
|
+
onClick: () => scrollTo(index),
|
|
2193
|
+
disabled: index === selectedIndex,
|
|
2194
|
+
"aria-label": "slide dot"
|
|
2195
|
+
})));
|
|
2196
|
+
};
|
|
2167
2197
|
//#endregion
|
|
2168
2198
|
//#region src/components/carousel/CarouselSlide.tsx
|
|
2169
|
-
var CarouselSlide = ({ children, ...
|
|
2170
|
-
|
|
2171
|
-
|
|
2172
|
-
|
|
2199
|
+
var CarouselSlide = ({ children, className, index, ...rest }) => {
|
|
2200
|
+
const { selectedIndex } = useCarousel();
|
|
2201
|
+
const isSelected = selectedIndex === index;
|
|
2202
|
+
return /* @__PURE__ */ react.createElement("div", {
|
|
2203
|
+
role: "option",
|
|
2204
|
+
"aria-selected": isSelected,
|
|
2205
|
+
className: cn("basis-full", "shrink-0", className),
|
|
2206
|
+
...rest
|
|
2207
|
+
}, /* @__PURE__ */ react.createElement("div", { className: "grid place-items-center px-3" }, children));
|
|
2208
|
+
};
|
|
2173
2209
|
//#endregion
|
|
2174
2210
|
//#region src/components/carousel/CarouselSlider.tsx
|
|
2175
|
-
var CarouselSlider = ({ children, className, overflow, ...rest }) =>
|
|
2176
|
-
|
|
2177
|
-
|
|
2178
|
-
|
|
2211
|
+
var CarouselSlider = ({ children, className, overflow, tabIndex = 0, ...rest }) => {
|
|
2212
|
+
const { emblaRef } = useCarousel();
|
|
2213
|
+
return /* @__PURE__ */ react.createElement("div", {
|
|
2214
|
+
ref: emblaRef,
|
|
2215
|
+
className: cn("ml-[50%]", "-translate-x-1/2", "cursor-grab", overflow ? "overflow-visible" : "overflow-hidden", className),
|
|
2216
|
+
role: "listbox",
|
|
2217
|
+
"aria-live": "polite",
|
|
2218
|
+
tabIndex,
|
|
2219
|
+
...rest
|
|
2220
|
+
}, /* @__PURE__ */ react.createElement("div", { className: "flex" }, children));
|
|
2221
|
+
};
|
|
2179
2222
|
//#endregion
|
|
2180
2223
|
//#region src/components/carousel/Carousel.tsx
|
|
2181
|
-
var
|
|
2182
|
-
|
|
2183
|
-
|
|
2184
|
-
|
|
2185
|
-
|
|
2186
|
-
}
|
|
2187
|
-
|
|
2188
|
-
|
|
2189
|
-
|
|
2190
|
-
|
|
2191
|
-
|
|
2224
|
+
var CarouselContext = react.createContext(null);
|
|
2225
|
+
var CarouselComponent = ({ children, currentSlide = 0, ...props }) => {
|
|
2226
|
+
const [emblaRef, emblaApi] = (0, embla_carousel_react.default)({
|
|
2227
|
+
startIndex: currentSlide,
|
|
2228
|
+
align: "center"
|
|
2229
|
+
});
|
|
2230
|
+
const [selectedIndex, setSelectedIndex] = react.useState(currentSlide);
|
|
2231
|
+
const [scrollSnaps, setScrollSnaps] = react.useState([]);
|
|
2232
|
+
const [canScrollPrev, setCanScrollPrev] = react.useState(false);
|
|
2233
|
+
const [canScrollNext, setCanScrollNext] = react.useState(false);
|
|
2234
|
+
const scrollPrev = react.useCallback(() => {
|
|
2235
|
+
emblaApi?.scrollPrev();
|
|
2236
|
+
}, [emblaApi]);
|
|
2237
|
+
const scrollNext = react.useCallback(() => {
|
|
2238
|
+
emblaApi?.scrollNext();
|
|
2239
|
+
}, [emblaApi]);
|
|
2240
|
+
const scrollTo = react.useCallback((index) => {
|
|
2241
|
+
emblaApi?.scrollTo(index);
|
|
2242
|
+
}, [emblaApi]);
|
|
2243
|
+
const onSelect = react.useCallback(() => {
|
|
2244
|
+
if (!emblaApi) return;
|
|
2245
|
+
setSelectedIndex(emblaApi.selectedScrollSnap());
|
|
2246
|
+
setCanScrollPrev(emblaApi.canScrollPrev());
|
|
2247
|
+
setCanScrollNext(emblaApi.canScrollNext());
|
|
2248
|
+
}, [emblaApi]);
|
|
2249
|
+
const onInit = react.useCallback(() => {
|
|
2250
|
+
if (!emblaApi) return;
|
|
2251
|
+
setScrollSnaps(emblaApi.scrollSnapList());
|
|
2252
|
+
}, [emblaApi]);
|
|
2253
|
+
react.useEffect(() => {
|
|
2254
|
+
if (!emblaApi) return;
|
|
2255
|
+
onInit();
|
|
2256
|
+
onSelect();
|
|
2257
|
+
emblaApi.on("reInit", onInit);
|
|
2258
|
+
emblaApi.on("reInit", onSelect);
|
|
2259
|
+
emblaApi.on("select", onSelect);
|
|
2260
|
+
return () => {
|
|
2261
|
+
emblaApi.off("reInit", onInit);
|
|
2262
|
+
emblaApi.off("reInit", onSelect);
|
|
2263
|
+
emblaApi.off("select", onSelect);
|
|
2264
|
+
};
|
|
2265
|
+
}, [
|
|
2266
|
+
emblaApi,
|
|
2267
|
+
onInit,
|
|
2268
|
+
onSelect
|
|
2269
|
+
]);
|
|
2270
|
+
const contextValue = react.useMemo(() => ({
|
|
2271
|
+
emblaRef,
|
|
2272
|
+
emblaApi,
|
|
2273
|
+
selectedIndex,
|
|
2274
|
+
scrollSnaps,
|
|
2275
|
+
canScrollPrev,
|
|
2276
|
+
canScrollNext,
|
|
2277
|
+
scrollPrev,
|
|
2278
|
+
scrollNext,
|
|
2279
|
+
scrollTo
|
|
2280
|
+
}), [
|
|
2281
|
+
emblaRef,
|
|
2282
|
+
emblaApi,
|
|
2283
|
+
selectedIndex,
|
|
2284
|
+
scrollSnaps,
|
|
2285
|
+
canScrollPrev,
|
|
2286
|
+
canScrollNext,
|
|
2287
|
+
scrollPrev,
|
|
2288
|
+
scrollNext,
|
|
2289
|
+
scrollTo
|
|
2290
|
+
]);
|
|
2291
|
+
const { className, ...rest } = props;
|
|
2292
|
+
return /* @__PURE__ */ react.createElement("div", {
|
|
2293
|
+
className: cn("relative", "w-full", className),
|
|
2294
|
+
...rest
|
|
2295
|
+
}, /* @__PURE__ */ react.createElement(CarouselContext.Provider, { value: contextValue }, children));
|
|
2296
|
+
};
|
|
2297
|
+
var useCarousel = () => {
|
|
2298
|
+
const context = react.useContext(CarouselContext);
|
|
2299
|
+
if (!context) throw new Error("useCarousel must be used within a Carousel");
|
|
2300
|
+
return {
|
|
2301
|
+
...context,
|
|
2302
|
+
currentSlide: context.selectedIndex
|
|
2303
|
+
};
|
|
2304
|
+
};
|
|
2192
2305
|
var Carousel = Object.assign(CarouselComponent, {
|
|
2193
2306
|
ArrowNext: CarouselArrowNext,
|
|
2194
2307
|
ArrowPrevious: CarouselArrowPrevious,
|
|
@@ -5862,7 +5975,7 @@ var DialogContent = ({ size = "sm", children, closeDialogText = "Close dialog",
|
|
|
5862
5975
|
hasTooltip: false,
|
|
5863
5976
|
size: "md",
|
|
5864
5977
|
theme: "neutral",
|
|
5865
|
-
className: "top-
|
|
5978
|
+
className: "absolute top-4 right-4 size-12"
|
|
5866
5979
|
}, /* @__PURE__ */ react.createElement(Icon, { is: _atom_learning_icons.Close })), react.Children.map(children, (child) => child?.type !== DialogBackground && child))));
|
|
5867
5980
|
//#endregion
|
|
5868
5981
|
//#region src/components/dialog/DialogFooter.tsx
|
|
@@ -9289,8 +9402,7 @@ var ToastProviderBase = styled("div", { base: [
|
|
|
9289
9402
|
"z-2147483647",
|
|
9290
9403
|
"inset-2",
|
|
9291
9404
|
"pointer-events-none",
|
|
9292
|
-
"top-
|
|
9293
|
-
"sm:top-safe-or-3"
|
|
9405
|
+
"sm:top-3"
|
|
9294
9406
|
] });
|
|
9295
9407
|
var ToastWrapper = styled("div", {
|
|
9296
9408
|
base: [
|