@atom-learning/components 6.16.1-beta.1 → 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 +6 -19
- package/dist/components/dialog/DialogContent.js.map +1 -1
- package/dist/components/navigation/NavigationMenu.js +1 -1
- package/dist/components/navigation/NavigationMenu.js.map +1 -1
- package/dist/components/toast/ToastProvider.js +1 -2
- package/dist/components/toast/ToastProvider.js.map +1 -1
- package/dist/components/top-bar/TopBar.js +2 -2
- package/dist/components/top-bar/TopBar.js.map +1 -1
- package/dist/docgen.json +1 -1
- package/dist/index.cjs.js +168 -69
- package/dist/index.cjs.js.map +1 -1
- package/package.json +2 -3
- package/src/index.css +0 -2
- package/src/responsive-variant-classes.css +1 -1
- package/src/utilities.css +0 -6
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,
|
|
@@ -5794,9 +5907,7 @@ var StyledDialogContent = styled(_radix_ui_react_dialog.Content, {
|
|
|
5794
5907
|
"max-h-[90vh]",
|
|
5795
5908
|
"supports-svh:h-auto",
|
|
5796
5909
|
"supports-svh:max-h-[90vh]",
|
|
5797
|
-
"w-95"
|
|
5798
|
-
"[&>[data-dialog-close]]:top-4",
|
|
5799
|
-
"[&>[data-dialog-close]]:right-4"
|
|
5910
|
+
"w-95"
|
|
5800
5911
|
],
|
|
5801
5912
|
sm: [
|
|
5802
5913
|
"rounded-md",
|
|
@@ -5805,9 +5916,7 @@ var StyledDialogContent = styled(_radix_ui_react_dialog.Content, {
|
|
|
5805
5916
|
"max-h-[90vh]",
|
|
5806
5917
|
"supports-svh:h-auto",
|
|
5807
5918
|
"supports-svh:max-h-[90vh]",
|
|
5808
|
-
"w-120"
|
|
5809
|
-
"[&>[data-dialog-close]]:top-4",
|
|
5810
|
-
"[&>[data-dialog-close]]:right-4"
|
|
5919
|
+
"w-120"
|
|
5811
5920
|
],
|
|
5812
5921
|
md: [
|
|
5813
5922
|
"rounded-md",
|
|
@@ -5816,9 +5925,7 @@ var StyledDialogContent = styled(_radix_ui_react_dialog.Content, {
|
|
|
5816
5925
|
"max-h-[90vh]",
|
|
5817
5926
|
"supports-svh:h-auto",
|
|
5818
5927
|
"supports-svh:max-h-[90vh]",
|
|
5819
|
-
"w-150"
|
|
5820
|
-
"[&>[data-dialog-close]]:top-4",
|
|
5821
|
-
"[&>[data-dialog-close]]:right-4"
|
|
5928
|
+
"w-150"
|
|
5822
5929
|
],
|
|
5823
5930
|
lg: [
|
|
5824
5931
|
"rounded-md",
|
|
@@ -5827,9 +5934,7 @@ var StyledDialogContent = styled(_radix_ui_react_dialog.Content, {
|
|
|
5827
5934
|
"max-h-[90vh]",
|
|
5828
5935
|
"supports-svh:h-auto",
|
|
5829
5936
|
"supports-svh:max-h-[90vh]",
|
|
5830
|
-
"w-200"
|
|
5831
|
-
"[&>[data-dialog-close]]:top-4",
|
|
5832
|
-
"[&>[data-dialog-close]]:right-4"
|
|
5937
|
+
"w-200"
|
|
5833
5938
|
],
|
|
5834
5939
|
xl: [
|
|
5835
5940
|
"rounded-md",
|
|
@@ -5838,9 +5943,7 @@ var StyledDialogContent = styled(_radix_ui_react_dialog.Content, {
|
|
|
5838
5943
|
"max-h-[90vh]",
|
|
5839
5944
|
"supports-svh:h-auto",
|
|
5840
5945
|
"supports-svh:max-h-[90vh]",
|
|
5841
|
-
"w-275"
|
|
5842
|
-
"[&>[data-dialog-close]]:top-4",
|
|
5843
|
-
"[&>[data-dialog-close]]:right-4"
|
|
5946
|
+
"w-275"
|
|
5844
5947
|
],
|
|
5845
5948
|
fullscreen: [
|
|
5846
5949
|
"rounded-none",
|
|
@@ -5849,9 +5952,7 @@ var StyledDialogContent = styled(_radix_ui_react_dialog.Content, {
|
|
|
5849
5952
|
"max-w-screen",
|
|
5850
5953
|
"max-h-screen",
|
|
5851
5954
|
"supports-svh:h-svh",
|
|
5852
|
-
"supports-svh:max-h-svh"
|
|
5853
|
-
"[&>[data-dialog-close]]:top-safe-offset-4",
|
|
5854
|
-
"[&>[data-dialog-close]]:right-safe-offset-4"
|
|
5955
|
+
"supports-svh:max-h-svh"
|
|
5855
5956
|
]
|
|
5856
5957
|
},
|
|
5857
5958
|
layout: { panel: [
|
|
@@ -5874,7 +5975,6 @@ var DialogContent = ({ size = "sm", children, closeDialogText = "Close dialog",
|
|
|
5874
5975
|
hasTooltip: false,
|
|
5875
5976
|
size: "md",
|
|
5876
5977
|
theme: "neutral",
|
|
5877
|
-
"data-dialog-close": true,
|
|
5878
5978
|
className: "absolute top-4 right-4 size-12"
|
|
5879
5979
|
}, /* @__PURE__ */ react.createElement(Icon, { is: _atom_learning_icons.Close })), react.Children.map(children, (child) => child?.type !== DialogBackground && child))));
|
|
5880
5980
|
//#endregion
|
|
@@ -6751,7 +6851,7 @@ var NavigationMenuComponent = ({ children, className, ...props }) => {
|
|
|
6751
6851
|
const [activeItem, setActiveItem] = react.default.useState();
|
|
6752
6852
|
const [listWidth, setListWidth] = react.default.useState(0);
|
|
6753
6853
|
const listRef = react.default.useRef(null);
|
|
6754
|
-
react.default.
|
|
6854
|
+
react.default.useLayoutEffect(() => {
|
|
6755
6855
|
if (listRef.current) setListWidth(listRef.current.offsetWidth);
|
|
6756
6856
|
}, [react.default.Children.toArray(children).length]);
|
|
6757
6857
|
react.default.useEffect(() => {
|
|
@@ -9302,8 +9402,7 @@ var ToastProviderBase = styled("div", { base: [
|
|
|
9302
9402
|
"z-2147483647",
|
|
9303
9403
|
"inset-2",
|
|
9304
9404
|
"pointer-events-none",
|
|
9305
|
-
"top-
|
|
9306
|
-
"sm:top-safe-or-3"
|
|
9405
|
+
"sm:top-3"
|
|
9307
9406
|
] });
|
|
9308
9407
|
var ToastWrapper = styled("div", {
|
|
9309
9408
|
base: [
|
|
@@ -9698,8 +9797,8 @@ var StyledRoot = styled("header", {
|
|
|
9698
9797
|
variants: {
|
|
9699
9798
|
hasScrolled: { true: ["shadow-[0px_4px_4px_-2px_rgba(31,31,31,0.1)]"] },
|
|
9700
9799
|
size: {
|
|
9701
|
-
md: ["h-
|
|
9702
|
-
lg: ["h-
|
|
9800
|
+
md: ["h-16"],
|
|
9801
|
+
lg: ["h-24"]
|
|
9703
9802
|
},
|
|
9704
9803
|
diffused: { true: ["supports-color-mix:bg-[color-mix(in_hsl,(--base-1)_70%,transparent)]", "supports-color-mix:backdrop-blur-sm"] },
|
|
9705
9804
|
appearance: {
|