@atom-learning/components 6.17.0-beta.1 → 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/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 embla_carousel_react = require("embla-carousel-react");
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$1 = styled("div", {
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$1, { size }), /* @__PURE__ */ react.createElement(Dot$1, { size }), /* @__PURE__ */ react.createElement(Dot$1, { size }));
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 ArrowButton = styled("button", { base: [
2128
+ var buttonStyles = [
2130
2129
  "items-center",
2130
+ "bg-[unset]",
2131
2131
  "text-primary-800",
2132
2132
  "cursor-pointer",
2133
2133
  "flex",
@@ -2140,168 +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
- "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
- };
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 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"
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
2167
  //#endregion
2198
2168
  //#region src/components/carousel/CarouselSlide.tsx
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: "flex items-center justify-center px-3" }, children));
2208
- };
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));
2209
2173
  //#endregion
2210
2174
  //#region src/components/carousel/CarouselSlider.tsx
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
- };
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);
2222
2179
  //#endregion
2223
2180
  //#region src/components/carousel/Carousel.tsx
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
- };
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);
2305
2192
  var Carousel = Object.assign(CarouselComponent, {
2306
2193
  ArrowNext: CarouselArrowNext,
2307
2194
  ArrowPrevious: CarouselArrowPrevious,
@@ -6206,6 +6093,15 @@ var DropdownMenuItem = styled(_radix_ui_react_dropdown_menu.Item, { base: [
6206
6093
  "hover:underline"
6207
6094
  ] });
6208
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
6209
6105
  //#region src/components/dropdown-menu/DropdownMenuLinkItem.tsx
6210
6106
  var StyledLink$2 = styled("a", { base: ["no-underline"] });
6211
6107
  var DropdownMenuLinkItem = ({ children, href, ...props }) => /* @__PURE__ */ react.default.createElement(DropdownMenuItem, {
@@ -6230,7 +6126,9 @@ var DropdownMenuTrigger = styled(_radix_ui_react_dropdown_menu.Trigger, { base:
6230
6126
  //#region src/components/dropdown-menu/DropdownMenu.tsx
6231
6127
  var DropdownMenu = Object.assign(_radix_ui_react_dropdown_menu.Root, {
6232
6128
  Content: DropdownMenuContent,
6129
+ Group: _radix_ui_react_dropdown_menu.Group,
6233
6130
  Item: DropdownMenuItem,
6131
+ Label: DropdownMenuLabel,
6234
6132
  LinkItem: DropdownMenuLinkItem,
6235
6133
  Portal: _radix_ui_react_dropdown_menu.Portal,
6236
6134
  Separator: DropdownMenuSeparator,