@atom-learning/components 6.17.0-beta.2 → 6.17.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 +25 -33
- package/dist/components/carousel/Carousel.js +14 -84
- package/dist/components/carousel/Carousel.js.map +1 -1
- package/dist/components/carousel/CarouselArrows.d.ts +6 -5
- package/dist/components/carousel/CarouselArrows.js +9 -25
- package/dist/components/carousel/CarouselArrows.js.map +1 -1
- package/dist/components/carousel/CarouselPagination.d.ts +3 -2
- package/dist/components/carousel/CarouselPagination.js +17 -31
- package/dist/components/carousel/CarouselPagination.js.map +1 -1
- package/dist/components/carousel/CarouselSlide.d.ts +4 -2
- package/dist/components/carousel/CarouselSlide.js +5 -14
- package/dist/components/carousel/CarouselSlide.js.map +1 -1
- package/dist/components/carousel/CarouselSlider.d.ts +4 -10
- package/dist/components/carousel/CarouselSlider.js +6 -22
- package/dist/components/carousel/CarouselSlider.js.map +1 -1
- package/dist/components/dropdown-menu/DropdownMenu.d.ts +5 -0
- package/dist/components/dropdown-menu/DropdownMenu.js +4 -1
- package/dist/components/dropdown-menu/DropdownMenu.js.map +1 -1
- package/dist/components/dropdown-menu/DropdownMenuLabel.d.ts +8 -0
- package/dist/components/dropdown-menu/DropdownMenuLabel.js +16 -0
- package/dist/components/dropdown-menu/DropdownMenuLabel.js.map +1 -0
- package/dist/docgen.json +1 -1
- package/dist/index.cjs.js +58 -170
- package/dist/index.cjs.js.map +1 -1
- package/package.json +2 -2
package/dist/index.cjs.js
CHANGED
|
@@ -45,8 +45,7 @@ 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
|
|
49
|
-
embla_carousel_react = __toESM(embla_carousel_react);
|
|
48
|
+
let pure_react_carousel = require("pure-react-carousel");
|
|
50
49
|
let _radix_ui_react_checkbox = require("@radix-ui/react-checkbox");
|
|
51
50
|
_radix_ui_react_checkbox = __toESM(_radix_ui_react_checkbox);
|
|
52
51
|
let _radix_ui_react_collapsible = require("@radix-ui/react-collapsible");
|
|
@@ -688,7 +687,7 @@ var useIsMountedRef = () => {
|
|
|
688
687
|
};
|
|
689
688
|
//#endregion
|
|
690
689
|
//#region src/components/loader/Loader.tsx
|
|
691
|
-
var Dot
|
|
690
|
+
var Dot = styled("div", {
|
|
692
691
|
base: [
|
|
693
692
|
"animate-pulse",
|
|
694
693
|
"bg-current",
|
|
@@ -707,7 +706,7 @@ var Loader = ({ className, message = "Loading", size = "md", ...props }) => /* @
|
|
|
707
706
|
className: cn("flex", "justify-center", className),
|
|
708
707
|
role: "alert",
|
|
709
708
|
...props
|
|
710
|
-
}, /* @__PURE__ */ react.createElement("span", { className: "sr-only" }, message), /* @__PURE__ */ react.createElement(Dot
|
|
709
|
+
}, /* @__PURE__ */ react.createElement("span", { className: "sr-only" }, message), /* @__PURE__ */ react.createElement(Dot, { size }), /* @__PURE__ */ react.createElement(Dot, { size }), /* @__PURE__ */ react.createElement(Dot, { size }));
|
|
711
710
|
//#endregion
|
|
712
711
|
//#region src/components/button/Button.tsx
|
|
713
712
|
var StyledButton = styled("button", {
|
|
@@ -2126,8 +2125,9 @@ var Box = styled("div", { base: [] });
|
|
|
2126
2125
|
Box.displayName = "Box";
|
|
2127
2126
|
//#endregion
|
|
2128
2127
|
//#region src/components/carousel/CarouselArrows.tsx
|
|
2129
|
-
var
|
|
2128
|
+
var buttonStyles = [
|
|
2130
2129
|
"items-center",
|
|
2130
|
+
"bg-[unset]",
|
|
2131
2131
|
"text-primary-800",
|
|
2132
2132
|
"cursor-pointer",
|
|
2133
2133
|
"flex",
|
|
@@ -2140,178 +2140,55 @@ var ArrowButton = styled("button", { base: [
|
|
|
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
|
-
|
|
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
|
-
};
|
|
2143
|
+
"disabled:text-grey-200"
|
|
2144
|
+
];
|
|
2145
|
+
var StyledButtonBack = styled(pure_react_carousel.ButtonBack, { base: buttonStyles });
|
|
2146
|
+
var StyledButtonNext = styled(pure_react_carousel.ButtonNext, { base: buttonStyles });
|
|
2147
|
+
var CarouselArrowPrevious = (props) => /* @__PURE__ */ react.createElement(StyledButtonBack, props, /* @__PURE__ */ react.createElement(Icon, { is: _atom_learning_icons.ChevronLeft }));
|
|
2148
|
+
var CarouselArrowNext = (props) => /* @__PURE__ */ react.createElement(StyledButtonNext, props, /* @__PURE__ */ react.createElement(Icon, { is: _atom_learning_icons.ChevronRight }));
|
|
2166
2149
|
//#endregion
|
|
2167
2150
|
//#region src/components/carousel/CarouselPagination.tsx
|
|
2168
|
-
var
|
|
2169
|
-
"
|
|
2170
|
-
"
|
|
2171
|
-
"
|
|
2172
|
-
"
|
|
2173
|
-
"
|
|
2174
|
-
"
|
|
2175
|
-
"
|
|
2176
|
-
"
|
|
2177
|
-
"
|
|
2178
|
-
"
|
|
2179
|
-
"
|
|
2180
|
-
"
|
|
2181
|
-
"
|
|
2151
|
+
var CarouselPagination = styled(pure_react_carousel.DotGroup, { base: [
|
|
2152
|
+
"justify-center",
|
|
2153
|
+
"[&_button]:[[class*=selected]]:bg-primary-800",
|
|
2154
|
+
"[&_button]:bg-grey-600",
|
|
2155
|
+
"[&_button]:border-none",
|
|
2156
|
+
"[&_button]:cursor-pointer",
|
|
2157
|
+
"[&_button]:duration-100",
|
|
2158
|
+
"[&_button]:ease-in",
|
|
2159
|
+
"[&_button]:focus:bg-primary-900",
|
|
2160
|
+
"[&_button]:hover:bg-primary-900",
|
|
2161
|
+
"[&_button]:mx-1",
|
|
2162
|
+
"[&_button]:p-1",
|
|
2163
|
+
"[&_button]:rounded-[50%]",
|
|
2164
|
+
"[&_button]:size-3",
|
|
2165
|
+
"[&_button]:transition-all"
|
|
2182
2166
|
] });
|
|
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
|
-
};
|
|
2197
|
-
//#endregion
|
|
2198
|
-
//#region src/components/carousel/CarouselSlider.tsx
|
|
2199
|
-
var toSlideGapClass = {
|
|
2200
|
-
none: "",
|
|
2201
|
-
0: "px-0.5",
|
|
2202
|
-
1: "px-1",
|
|
2203
|
-
2: "px-2",
|
|
2204
|
-
3: "px-3",
|
|
2205
|
-
4: "px-4"
|
|
2206
|
-
};
|
|
2207
|
-
var CarouselSlideGapContext = react.createContext(3);
|
|
2208
|
-
var CarouselSlider = ({ children, className, gap = 3, overflow, tabIndex = 0, ...rest }) => {
|
|
2209
|
-
const { emblaRef } = useCarousel();
|
|
2210
|
-
return /* @__PURE__ */ react.createElement("div", {
|
|
2211
|
-
ref: emblaRef,
|
|
2212
|
-
className: cn("ml-[50%]", "-translate-x-1/2", "cursor-grab", overflow ? "overflow-visible" : "overflow-hidden", className),
|
|
2213
|
-
role: "listbox",
|
|
2214
|
-
"aria-live": "polite",
|
|
2215
|
-
tabIndex,
|
|
2216
|
-
...rest
|
|
2217
|
-
}, /* @__PURE__ */ react.createElement("div", { className: "flex" }, /* @__PURE__ */ react.createElement(CarouselSlideGapContext.Provider, { value: gap }, children)));
|
|
2218
|
-
};
|
|
2219
2167
|
//#endregion
|
|
2220
2168
|
//#region src/components/carousel/CarouselSlide.tsx
|
|
2221
|
-
var CarouselSlide = ({ children,
|
|
2222
|
-
|
|
2223
|
-
|
|
2224
|
-
|
|
2225
|
-
|
|
2226
|
-
|
|
2227
|
-
|
|
2228
|
-
|
|
2229
|
-
|
|
2230
|
-
|
|
2231
|
-
};
|
|
2169
|
+
var CarouselSlide = ({ children, ...remainingProps }) => /* @__PURE__ */ react.createElement(pure_react_carousel.Slide, {
|
|
2170
|
+
...remainingProps,
|
|
2171
|
+
tag: "div"
|
|
2172
|
+
}, /* @__PURE__ */ react.createElement("div", { className: "px-3" }, children));
|
|
2173
|
+
//#endregion
|
|
2174
|
+
//#region src/components/carousel/CarouselSlider.tsx
|
|
2175
|
+
var CarouselSlider = ({ children, className, overflow, ...rest }) => /* @__PURE__ */ react.createElement(pure_react_carousel.Slider, {
|
|
2176
|
+
...rest,
|
|
2177
|
+
className: cn(String.raw`ml-[50%] -translate-x-1/2 cursor-grab overflow-hidden **:[[class*=slideInner]]:flex **:[[class*=slideInner]]:justify-center **:[[class*=slide\_]]:float-left **:[[class*=slide\_]]:pb-0! **:[[class*=sliderTray\_]]:transition-transform **:[[class*=sliderTray\_]]:duration-500 **:[[class*=sliderTray\_]]:ease-[cubic-bezier(.645,.045,.355,1)]`, overflow && "overflow-visible", className)
|
|
2178
|
+
}, children);
|
|
2232
2179
|
//#endregion
|
|
2233
2180
|
//#region src/components/carousel/Carousel.tsx
|
|
2234
|
-
var
|
|
2235
|
-
|
|
2236
|
-
|
|
2237
|
-
|
|
2238
|
-
|
|
2239
|
-
|
|
2240
|
-
|
|
2241
|
-
|
|
2242
|
-
|
|
2243
|
-
|
|
2244
|
-
|
|
2245
|
-
emblaApi?.scrollPrev();
|
|
2246
|
-
}, [emblaApi]);
|
|
2247
|
-
const scrollNext = react.useCallback(() => {
|
|
2248
|
-
emblaApi?.scrollNext();
|
|
2249
|
-
}, [emblaApi]);
|
|
2250
|
-
const scrollTo = react.useCallback((index) => {
|
|
2251
|
-
emblaApi?.scrollTo(index);
|
|
2252
|
-
}, [emblaApi]);
|
|
2253
|
-
const onSelect = react.useCallback(() => {
|
|
2254
|
-
if (!emblaApi) return;
|
|
2255
|
-
setSelectedIndex(emblaApi.selectedScrollSnap());
|
|
2256
|
-
setCanScrollPrev(emblaApi.canScrollPrev());
|
|
2257
|
-
setCanScrollNext(emblaApi.canScrollNext());
|
|
2258
|
-
}, [emblaApi]);
|
|
2259
|
-
const onInit = react.useCallback(() => {
|
|
2260
|
-
if (!emblaApi) return;
|
|
2261
|
-
setScrollSnaps(emblaApi.scrollSnapList());
|
|
2262
|
-
}, [emblaApi]);
|
|
2263
|
-
react.useEffect(() => {
|
|
2264
|
-
if (!emblaApi) return;
|
|
2265
|
-
onInit();
|
|
2266
|
-
onSelect();
|
|
2267
|
-
emblaApi.on("reInit", onInit);
|
|
2268
|
-
emblaApi.on("reInit", onSelect);
|
|
2269
|
-
emblaApi.on("select", onSelect);
|
|
2270
|
-
return () => {
|
|
2271
|
-
emblaApi.off("reInit", onInit);
|
|
2272
|
-
emblaApi.off("reInit", onSelect);
|
|
2273
|
-
emblaApi.off("select", onSelect);
|
|
2274
|
-
};
|
|
2275
|
-
}, [
|
|
2276
|
-
emblaApi,
|
|
2277
|
-
onInit,
|
|
2278
|
-
onSelect
|
|
2279
|
-
]);
|
|
2280
|
-
const contextValue = react.useMemo(() => ({
|
|
2281
|
-
emblaRef,
|
|
2282
|
-
emblaApi,
|
|
2283
|
-
selectedIndex,
|
|
2284
|
-
scrollSnaps,
|
|
2285
|
-
canScrollPrev,
|
|
2286
|
-
canScrollNext,
|
|
2287
|
-
scrollPrev,
|
|
2288
|
-
scrollNext,
|
|
2289
|
-
scrollTo
|
|
2290
|
-
}), [
|
|
2291
|
-
emblaRef,
|
|
2292
|
-
emblaApi,
|
|
2293
|
-
selectedIndex,
|
|
2294
|
-
scrollSnaps,
|
|
2295
|
-
canScrollPrev,
|
|
2296
|
-
canScrollNext,
|
|
2297
|
-
scrollPrev,
|
|
2298
|
-
scrollNext,
|
|
2299
|
-
scrollTo
|
|
2300
|
-
]);
|
|
2301
|
-
const { className, ...rest } = props;
|
|
2302
|
-
return /* @__PURE__ */ react.createElement("div", {
|
|
2303
|
-
className: cn("relative", "w-full", className),
|
|
2304
|
-
...rest
|
|
2305
|
-
}, /* @__PURE__ */ react.createElement(CarouselContext.Provider, { value: contextValue }, children));
|
|
2306
|
-
};
|
|
2307
|
-
var useCarousel = () => {
|
|
2308
|
-
const context = react.useContext(CarouselContext);
|
|
2309
|
-
if (!context) throw new Error("useCarousel must be used within a Carousel");
|
|
2310
|
-
return {
|
|
2311
|
-
...context,
|
|
2312
|
-
currentSlide: context.selectedIndex
|
|
2313
|
-
};
|
|
2314
|
-
};
|
|
2181
|
+
var CarouselComponent = ({ children, className, slideHeight, slideWidth, numSlides, ...props }) => /* @__PURE__ */ react.createElement(CSSWrapper, { className }, /* @__PURE__ */ react.createElement(pure_react_carousel.CarouselProvider, {
|
|
2182
|
+
naturalSlideWidth: slideWidth,
|
|
2183
|
+
naturalSlideHeight: slideHeight,
|
|
2184
|
+
totalSlides: numSlides,
|
|
2185
|
+
...props
|
|
2186
|
+
}, children));
|
|
2187
|
+
/**
|
|
2188
|
+
* Documentation about the hook usage
|
|
2189
|
+
* https://github.com/express-labs/pure-react-carousel#hooks-and-usecontext
|
|
2190
|
+
*/
|
|
2191
|
+
var useCarousel = () => react.useContext(pure_react_carousel.CarouselContext);
|
|
2315
2192
|
var Carousel = Object.assign(CarouselComponent, {
|
|
2316
2193
|
ArrowNext: CarouselArrowNext,
|
|
2317
2194
|
ArrowPrevious: CarouselArrowPrevious,
|
|
@@ -6216,6 +6093,15 @@ var DropdownMenuItem = styled(_radix_ui_react_dropdown_menu.Item, { base: [
|
|
|
6216
6093
|
"hover:underline"
|
|
6217
6094
|
] });
|
|
6218
6095
|
//#endregion
|
|
6096
|
+
//#region src/components/dropdown-menu/DropdownMenuLabel.tsx
|
|
6097
|
+
var DropdownMenuLabel = ({ className, ...props }) => /* @__PURE__ */ react.createElement(Text, {
|
|
6098
|
+
as: _radix_ui_react_dropdown_menu.Label,
|
|
6099
|
+
size: "sm",
|
|
6100
|
+
className: cn("px-3", "py-2", "text-text-subtle", className),
|
|
6101
|
+
...props
|
|
6102
|
+
});
|
|
6103
|
+
DropdownMenuLabel.displayName = "DropdownMenuLabel";
|
|
6104
|
+
//#endregion
|
|
6219
6105
|
//#region src/components/dropdown-menu/DropdownMenuLinkItem.tsx
|
|
6220
6106
|
var StyledLink$2 = styled("a", { base: ["no-underline"] });
|
|
6221
6107
|
var DropdownMenuLinkItem = ({ children, href, ...props }) => /* @__PURE__ */ react.default.createElement(DropdownMenuItem, {
|
|
@@ -6240,7 +6126,9 @@ var DropdownMenuTrigger = styled(_radix_ui_react_dropdown_menu.Trigger, { base:
|
|
|
6240
6126
|
//#region src/components/dropdown-menu/DropdownMenu.tsx
|
|
6241
6127
|
var DropdownMenu = Object.assign(_radix_ui_react_dropdown_menu.Root, {
|
|
6242
6128
|
Content: DropdownMenuContent,
|
|
6129
|
+
Group: _radix_ui_react_dropdown_menu.Group,
|
|
6243
6130
|
Item: DropdownMenuItem,
|
|
6131
|
+
Label: DropdownMenuLabel,
|
|
6244
6132
|
LinkItem: DropdownMenuLinkItem,
|
|
6245
6133
|
Portal: _radix_ui_react_dropdown_menu.Portal,
|
|
6246
6134
|
Separator: DropdownMenuSeparator,
|