@agnos-ui/react-bootstrap 0.8.0-next.0 → 0.8.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/{accordion-QclyKh8E.cjs → accordion-CKX3QpIN.cjs} +3 -1
- package/{accordion-GX854ooE.js → accordion-CrXiNNLE.js} +4 -2
- package/carousel-B8b91cHo.cjs +72 -0
- package/carousel-CB4uoAm0.js +73 -0
- package/{collapse-UMbDs6Gh.cjs → collapse-BQNW5NFj.cjs} +2 -1
- package/{collapse-BOXBa8_8.js → collapse-DojQXsLN.js} +3 -2
- package/components/accordion/index.cjs +1 -1
- package/components/accordion/index.js +1 -1
- package/components/carousel/carousel.d.ts +39 -0
- package/components/carousel/carousel.gen.d.ts +358 -0
- package/components/carousel/index.cjs +8 -0
- package/components/carousel/index.d.ts +2 -0
- package/components/carousel/index.js +8 -0
- package/components/collapse/index.cjs +1 -1
- package/components/collapse/index.js +1 -1
- package/components/select/index.js +1 -1
- package/components/slider/index.cjs +1 -1
- package/components/slider/index.js +1 -1
- package/components/toast/index.cjs +10 -5
- package/components/toast/index.d.ts +1 -0
- package/components/toast/index.js +7 -2
- package/components/toast/toast.gen.d.ts +85 -0
- package/components/toast/toasterProvider.d.ts +34 -0
- package/config.gen.d.ts +5 -0
- package/generated/types.cjs +7 -0
- package/generated/types.d.ts +1 -1
- package/generated/types.js +1 -0
- package/index.cjs +26 -8
- package/index.d.ts +1 -0
- package/index.js +52 -40
- package/package.json +5 -3
- package/{select-C2jCf6jT.js → select-ClQGKBMF.js} +1 -1
- package/{slider-DyvRcMCK.cjs → slider-CkKKSyai.cjs} +15 -39
- package/{slider-vFEkaZP-.js → slider-ZmbENVpb.js} +16 -40
- package/{toast-BUHjCme7.js → toasterProvider-DO_5lfVp.js} +61 -3
- package/{toast-CkwIDuRg.cjs → toasterProvider-glQ29Go3.cjs} +60 -2
- package/types.d.ts +2 -0
|
@@ -22,8 +22,10 @@ const AccordionItemDefaultSlotStructure = (slotContext) => /* @__PURE__ */ jsxRu
|
|
|
22
22
|
] });
|
|
23
23
|
function AccordionItem(props) {
|
|
24
24
|
const { registerItem } = React.useContext(AccordionDIContext);
|
|
25
|
+
const id = React.useId();
|
|
25
26
|
const widgetContext = generated_config.useWidgetWithConfig(registerItem, props, null, {
|
|
26
|
-
structure: AccordionItemDefaultSlotStructure
|
|
27
|
+
structure: AccordionItemDefaultSlotStructure,
|
|
28
|
+
id
|
|
27
29
|
});
|
|
28
30
|
const { state, api, directives } = widgetContext;
|
|
29
31
|
React.useImperativeHandle(props.ref, () => api, [api]);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsxs, Fragment, jsx } from "react/jsx-runtime";
|
|
2
2
|
import { Slot } from "@agnos-ui/react-headless/slot";
|
|
3
3
|
import { useDirectives, classDirective } from "@agnos-ui/react-headless/utils/directive";
|
|
4
|
-
import { createContext,
|
|
4
|
+
import { useContext, createContext, useId, useImperativeHandle, useEffect } from "react";
|
|
5
5
|
import { useWidgetWithConfig } from "./generated/config.js";
|
|
6
6
|
import { getAccordionDefaultConfig, createAccordionItem, createAccordion, factoryCreateAccordion } from "@agnos-ui/core-bootstrap/components/accordion";
|
|
7
7
|
const export_getAccordionDefaultConfig = getAccordionDefaultConfig;
|
|
@@ -21,8 +21,10 @@ const AccordionItemDefaultSlotStructure = (slotContext) => /* @__PURE__ */ jsxs(
|
|
|
21
21
|
] });
|
|
22
22
|
function AccordionItem(props) {
|
|
23
23
|
const { registerItem } = useContext(AccordionDIContext);
|
|
24
|
+
const id = useId();
|
|
24
25
|
const widgetContext = useWidgetWithConfig(registerItem, props, null, {
|
|
25
|
-
structure: AccordionItemDefaultSlotStructure
|
|
26
|
+
structure: AccordionItemDefaultSlotStructure,
|
|
27
|
+
id
|
|
26
28
|
});
|
|
27
29
|
const { state, api, directives } = widgetContext;
|
|
28
30
|
useImperativeHandle(props.ref, () => api, [api]);
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
const jsxRuntime = require("react/jsx-runtime");
|
|
3
|
+
const carousel = require("@agnos-ui/core-bootstrap/components/carousel");
|
|
4
|
+
const config = require("@agnos-ui/react-headless/config");
|
|
5
|
+
const slot = require("@agnos-ui/react-headless/slot");
|
|
6
|
+
const directive = require("@agnos-ui/react-headless/utils/directive");
|
|
7
|
+
const React = require("react");
|
|
8
|
+
const export_getCarouselDefaultConfig = carousel.getCarouselDefaultConfig;
|
|
9
|
+
const export_createCarousel = carousel.createCarousel;
|
|
10
|
+
const CarouselPrevButton = ({ direction, scrollPrev }) => {
|
|
11
|
+
const prevBtnClassPrefix = direction === "rtl" ? "carousel-control-next" : "carousel-control-prev";
|
|
12
|
+
return /* @__PURE__ */ jsxRuntime.jsx("button", { className: prevBtnClassPrefix, ...directive.useDirective(scrollPrev), children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: `${prevBtnClassPrefix}-icon` }) });
|
|
13
|
+
};
|
|
14
|
+
const CarouselNextButton = ({ direction, scrollNext }) => {
|
|
15
|
+
const prevBtnClassPrefix = direction === "ltr" ? "carousel-control-next" : "carousel-control-prev";
|
|
16
|
+
return /* @__PURE__ */ jsxRuntime.jsx("button", { className: prevBtnClassPrefix, ...directive.useDirective(scrollNext), children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: `${prevBtnClassPrefix}-icon` }) });
|
|
17
|
+
};
|
|
18
|
+
const CarouselTabIndicator = ({
|
|
19
|
+
index,
|
|
20
|
+
id,
|
|
21
|
+
tabIndicator,
|
|
22
|
+
active
|
|
23
|
+
}) => /* @__PURE__ */ jsxRuntime.jsx("button", { "data-bs-target": true, className: active ? "active" : void 0, ...directive.useDirective(tabIndicator, { index, id }) });
|
|
24
|
+
const CarouselSlide = ({
|
|
25
|
+
slideData,
|
|
26
|
+
widget,
|
|
27
|
+
index
|
|
28
|
+
}) => /* @__PURE__ */ jsxRuntime.jsx("div", { ...directive.useDirective(widget.directives.slide, { id: slideData.id, index }), children: /* @__PURE__ */ jsxRuntime.jsx(slot.Slot, { slotContent: widget.state.slide, props: { ...slideData, ...widget } }) });
|
|
29
|
+
const CarouselTabList = ({
|
|
30
|
+
slidesData,
|
|
31
|
+
tabList,
|
|
32
|
+
tabIndicator,
|
|
33
|
+
selectedScrollSnap
|
|
34
|
+
}) => /* @__PURE__ */ jsxRuntime.jsx("div", { className: "carousel-indicators", ...directive.useDirective(tabList), children: slidesData.map(({ id }, index) => /* @__PURE__ */ jsxRuntime.jsx(CarouselTabIndicator, { index, tabIndicator, id, active: selectedScrollSnap === index }, id)) });
|
|
35
|
+
const CarouselDefaultNavigation = (widget) => {
|
|
36
|
+
const {
|
|
37
|
+
state: { showNavigationArrows, showNavigationIndicators, canScrollNext, canScrollPrev, slidesData, direction, selectedScrollSnap },
|
|
38
|
+
directives
|
|
39
|
+
} = widget;
|
|
40
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
41
|
+
showNavigationArrows && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
42
|
+
canScrollPrev && /* @__PURE__ */ jsxRuntime.jsx(CarouselPrevButton, { scrollPrev: directives.scrollPrev, direction }),
|
|
43
|
+
canScrollNext && /* @__PURE__ */ jsxRuntime.jsx(CarouselNextButton, { scrollNext: directives.scrollNext, direction })
|
|
44
|
+
] }),
|
|
45
|
+
showNavigationIndicators && /* @__PURE__ */ jsxRuntime.jsx(
|
|
46
|
+
CarouselTabList,
|
|
47
|
+
{
|
|
48
|
+
slidesData,
|
|
49
|
+
tabList: directives.tabList,
|
|
50
|
+
tabIndicator: directives.tabIndicator,
|
|
51
|
+
selectedScrollSnap
|
|
52
|
+
}
|
|
53
|
+
)
|
|
54
|
+
] });
|
|
55
|
+
};
|
|
56
|
+
const CarouselDefaultStructure = (widget) => /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
57
|
+
/* @__PURE__ */ jsxRuntime.jsx(slot.Slot, { slotContent: widget.state.navigation, props: widget }),
|
|
58
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { ...directive.useDirective(widget.directives.container), children: widget.state.slidesData.map((slideData, index) => /* @__PURE__ */ jsxRuntime.jsx(CarouselSlide, { slideData, widget, index }, slideData.id)) })
|
|
59
|
+
] });
|
|
60
|
+
function Carousel({ ref, ...props }) {
|
|
61
|
+
const widget = config.useWidgetWithConfig(export_createCarousel, props, "carousel", {
|
|
62
|
+
structure: CarouselDefaultStructure,
|
|
63
|
+
navigation: CarouselDefaultNavigation
|
|
64
|
+
});
|
|
65
|
+
React.useImperativeHandle(ref, () => widget.api, [widget.api]);
|
|
66
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { ...directive.useDirective(widget.directives.root), children: /* @__PURE__ */ jsxRuntime.jsx(slot.Slot, { slotContent: widget.state.structure, props: widget }) });
|
|
67
|
+
}
|
|
68
|
+
exports.Carousel = Carousel;
|
|
69
|
+
exports.CarouselDefaultNavigation = CarouselDefaultNavigation;
|
|
70
|
+
exports.CarouselDefaultStructure = CarouselDefaultStructure;
|
|
71
|
+
exports.export_createCarousel = export_createCarousel;
|
|
72
|
+
exports.export_getCarouselDefaultConfig = export_getCarouselDefaultConfig;
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { jsxs, Fragment, jsx } from "react/jsx-runtime";
|
|
2
|
+
import { getCarouselDefaultConfig, createCarousel } from "@agnos-ui/core-bootstrap/components/carousel";
|
|
3
|
+
import { useWidgetWithConfig } from "@agnos-ui/react-headless/config";
|
|
4
|
+
import { Slot } from "@agnos-ui/react-headless/slot";
|
|
5
|
+
import { useDirective } from "@agnos-ui/react-headless/utils/directive";
|
|
6
|
+
import { useImperativeHandle } from "react";
|
|
7
|
+
const export_getCarouselDefaultConfig = getCarouselDefaultConfig;
|
|
8
|
+
const export_createCarousel = createCarousel;
|
|
9
|
+
const CarouselPrevButton = ({ direction, scrollPrev }) => {
|
|
10
|
+
const prevBtnClassPrefix = direction === "rtl" ? "carousel-control-next" : "carousel-control-prev";
|
|
11
|
+
return /* @__PURE__ */ jsx("button", { className: prevBtnClassPrefix, ...useDirective(scrollPrev), children: /* @__PURE__ */ jsx("span", { className: `${prevBtnClassPrefix}-icon` }) });
|
|
12
|
+
};
|
|
13
|
+
const CarouselNextButton = ({ direction, scrollNext }) => {
|
|
14
|
+
const prevBtnClassPrefix = direction === "ltr" ? "carousel-control-next" : "carousel-control-prev";
|
|
15
|
+
return /* @__PURE__ */ jsx("button", { className: prevBtnClassPrefix, ...useDirective(scrollNext), children: /* @__PURE__ */ jsx("span", { className: `${prevBtnClassPrefix}-icon` }) });
|
|
16
|
+
};
|
|
17
|
+
const CarouselTabIndicator = ({
|
|
18
|
+
index,
|
|
19
|
+
id,
|
|
20
|
+
tabIndicator,
|
|
21
|
+
active
|
|
22
|
+
}) => /* @__PURE__ */ jsx("button", { "data-bs-target": true, className: active ? "active" : void 0, ...useDirective(tabIndicator, { index, id }) });
|
|
23
|
+
const CarouselSlide = ({
|
|
24
|
+
slideData,
|
|
25
|
+
widget,
|
|
26
|
+
index
|
|
27
|
+
}) => /* @__PURE__ */ jsx("div", { ...useDirective(widget.directives.slide, { id: slideData.id, index }), children: /* @__PURE__ */ jsx(Slot, { slotContent: widget.state.slide, props: { ...slideData, ...widget } }) });
|
|
28
|
+
const CarouselTabList = ({
|
|
29
|
+
slidesData,
|
|
30
|
+
tabList,
|
|
31
|
+
tabIndicator,
|
|
32
|
+
selectedScrollSnap
|
|
33
|
+
}) => /* @__PURE__ */ jsx("div", { className: "carousel-indicators", ...useDirective(tabList), children: slidesData.map(({ id }, index) => /* @__PURE__ */ jsx(CarouselTabIndicator, { index, tabIndicator, id, active: selectedScrollSnap === index }, id)) });
|
|
34
|
+
const CarouselDefaultNavigation = (widget) => {
|
|
35
|
+
const {
|
|
36
|
+
state: { showNavigationArrows, showNavigationIndicators, canScrollNext, canScrollPrev, slidesData, direction, selectedScrollSnap },
|
|
37
|
+
directives
|
|
38
|
+
} = widget;
|
|
39
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
40
|
+
showNavigationArrows && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
41
|
+
canScrollPrev && /* @__PURE__ */ jsx(CarouselPrevButton, { scrollPrev: directives.scrollPrev, direction }),
|
|
42
|
+
canScrollNext && /* @__PURE__ */ jsx(CarouselNextButton, { scrollNext: directives.scrollNext, direction })
|
|
43
|
+
] }),
|
|
44
|
+
showNavigationIndicators && /* @__PURE__ */ jsx(
|
|
45
|
+
CarouselTabList,
|
|
46
|
+
{
|
|
47
|
+
slidesData,
|
|
48
|
+
tabList: directives.tabList,
|
|
49
|
+
tabIndicator: directives.tabIndicator,
|
|
50
|
+
selectedScrollSnap
|
|
51
|
+
}
|
|
52
|
+
)
|
|
53
|
+
] });
|
|
54
|
+
};
|
|
55
|
+
const CarouselDefaultStructure = (widget) => /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
56
|
+
/* @__PURE__ */ jsx(Slot, { slotContent: widget.state.navigation, props: widget }),
|
|
57
|
+
/* @__PURE__ */ jsx("div", { ...useDirective(widget.directives.container), children: widget.state.slidesData.map((slideData, index) => /* @__PURE__ */ jsx(CarouselSlide, { slideData, widget, index }, slideData.id)) })
|
|
58
|
+
] });
|
|
59
|
+
function Carousel({ ref, ...props }) {
|
|
60
|
+
const widget = useWidgetWithConfig(export_createCarousel, props, "carousel", {
|
|
61
|
+
structure: CarouselDefaultStructure,
|
|
62
|
+
navigation: CarouselDefaultNavigation
|
|
63
|
+
});
|
|
64
|
+
useImperativeHandle(ref, () => widget.api, [widget.api]);
|
|
65
|
+
return /* @__PURE__ */ jsx("div", { ...useDirective(widget.directives.root), children: /* @__PURE__ */ jsx(Slot, { slotContent: widget.state.structure, props: widget }) });
|
|
66
|
+
}
|
|
67
|
+
export {
|
|
68
|
+
CarouselDefaultNavigation as C,
|
|
69
|
+
export_createCarousel as a,
|
|
70
|
+
CarouselDefaultStructure as b,
|
|
71
|
+
Carousel as c,
|
|
72
|
+
export_getCarouselDefaultConfig as e
|
|
73
|
+
};
|
|
@@ -7,7 +7,8 @@ const directive = require("@agnos-ui/react-headless/utils/directive");
|
|
|
7
7
|
const export_getCollapseDefaultConfig = collapse.getCollapseDefaultConfig;
|
|
8
8
|
const export_createCollapse = collapse.createCollapse;
|
|
9
9
|
function Collapse(props) {
|
|
10
|
-
const
|
|
10
|
+
const id = React.useId();
|
|
11
|
+
const { api, directives } = generated_config.useWidgetWithConfig(export_createCollapse, props, "collapse", { id });
|
|
11
12
|
React.useImperativeHandle(props.ref, () => api, [api]);
|
|
12
13
|
return /* @__PURE__ */ jsxRuntime.jsx("div", { ...directive.useDirectives(directives.collapseDirective), children: props.children });
|
|
13
14
|
}
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
import { useImperativeHandle } from "react";
|
|
2
|
+
import { useId, useImperativeHandle } from "react";
|
|
3
3
|
import { useWidgetWithConfig } from "./generated/config.js";
|
|
4
4
|
import { getCollapseDefaultConfig, createCollapse } from "@agnos-ui/core-bootstrap/components/collapse";
|
|
5
5
|
import { useDirectives } from "@agnos-ui/react-headless/utils/directive";
|
|
6
6
|
const export_getCollapseDefaultConfig = getCollapseDefaultConfig;
|
|
7
7
|
const export_createCollapse = createCollapse;
|
|
8
8
|
function Collapse(props) {
|
|
9
|
-
const
|
|
9
|
+
const id = useId();
|
|
10
|
+
const { api, directives } = useWidgetWithConfig(export_createCollapse, props, "collapse", { id });
|
|
10
11
|
useImperativeHandle(props.ref, () => api, [api]);
|
|
11
12
|
return /* @__PURE__ */ jsx("div", { ...useDirectives(directives.collapseDirective), children: props.children });
|
|
12
13
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const accordion = require("../../accordion-
|
|
3
|
+
const accordion = require("../../accordion-CKX3QpIN.cjs");
|
|
4
4
|
exports.Accordion = accordion.Accordion;
|
|
5
5
|
exports.AccordionItem = accordion.AccordionItem;
|
|
6
6
|
exports.AccordionItemDefaultSlotStructure = accordion.AccordionItemDefaultSlotStructure;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { CarouselApi, CarouselContext, CarouselProps } from './carousel.gen';
|
|
2
|
+
import type { Ref } from 'react';
|
|
3
|
+
/**
|
|
4
|
+
* Renders the default slot navigation for the carousel component.
|
|
5
|
+
*
|
|
6
|
+
* @param widget - The widget context containing the state, api and directives for carousel.
|
|
7
|
+
* @returns The rendered carousel navigation.
|
|
8
|
+
*/
|
|
9
|
+
export declare const CarouselDefaultNavigation: <SlideData extends {
|
|
10
|
+
id: string;
|
|
11
|
+
}>(widget: CarouselContext<SlideData>) => import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
/**
|
|
13
|
+
* Renders the default slot structure for the carousel component.
|
|
14
|
+
*
|
|
15
|
+
* @param widget - The widget context containing the state, api and directives for carousel.
|
|
16
|
+
* @returns The rendered carousel structure.
|
|
17
|
+
*/
|
|
18
|
+
export declare const CarouselDefaultStructure: <SlideData extends {
|
|
19
|
+
id: string;
|
|
20
|
+
}>(widget: CarouselContext<SlideData>) => import("react/jsx-runtime").JSX.Element;
|
|
21
|
+
/**
|
|
22
|
+
* Carousel component that uses a forward ref to expose an API.
|
|
23
|
+
*
|
|
24
|
+
* This component utilizes the {@link useWidgetWithConfig} hook to create a carousel widget
|
|
25
|
+
* and the {@link https://react.dev/reference/react/useImperativeHandle | useImperativeHandle} hook to expose the widget's API via the ref.
|
|
26
|
+
*
|
|
27
|
+
* @template SlideData - The type of data used by each slide in the carousel.
|
|
28
|
+
*
|
|
29
|
+
* @param props - partial properties of the CarouselProps interface.
|
|
30
|
+
* @param props.ref - forwarded reference to the CarouselApi.
|
|
31
|
+
* @param props.children - content of the carousel
|
|
32
|
+
*
|
|
33
|
+
* @returns a JSX element that renders the Carousel component with navigation arrows and indicators.
|
|
34
|
+
*/
|
|
35
|
+
export declare function Carousel<SlideData extends {
|
|
36
|
+
id: string;
|
|
37
|
+
}>({ ref, ...props }: Partial<CarouselProps<SlideData>> & {
|
|
38
|
+
ref?: Ref<CarouselApi>;
|
|
39
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,358 @@
|
|
|
1
|
+
import type { PropsConfig, WidgetSlotContext, SlotContent, Directive, Widget } from '@agnos-ui/react-headless/types';
|
|
2
|
+
import type { EmblaPluginType, EmblaPluginsType, EmblaCarouselType } from 'embla-carousel';
|
|
3
|
+
/**
|
|
4
|
+
* Retrieve a shallow copy of the default Carousel config
|
|
5
|
+
* @returns the default Carousel config
|
|
6
|
+
*/
|
|
7
|
+
declare const export_getCarouselDefaultConfig: () => CarouselProps<any>;
|
|
8
|
+
export { export_getCarouselDefaultConfig as getCarouselDefaultConfig };
|
|
9
|
+
/**
|
|
10
|
+
* Create a Carousel with given config props
|
|
11
|
+
*
|
|
12
|
+
* @template SlideData - The type of the data for each slide.
|
|
13
|
+
* @param config - an optional carousel config
|
|
14
|
+
* @returns a CarouselWidget
|
|
15
|
+
*/
|
|
16
|
+
declare const export_createCarousel: <SlideData extends {
|
|
17
|
+
id: string;
|
|
18
|
+
}>(config?: PropsConfig<CarouselProps<SlideData>>) => CarouselWidget<SlideData>;
|
|
19
|
+
export { export_createCarousel as createCarousel };
|
|
20
|
+
/**
|
|
21
|
+
* Represents the context for a carousel.
|
|
22
|
+
*
|
|
23
|
+
* @template SlideData - The type of data used by each slide in the carousel.
|
|
24
|
+
*/
|
|
25
|
+
export type CarouselContext<SlideData extends {
|
|
26
|
+
id: string;
|
|
27
|
+
}> = WidgetSlotContext<CarouselWidget<SlideData>>;
|
|
28
|
+
/**
|
|
29
|
+
* Represents the context for a carousel slide.
|
|
30
|
+
*
|
|
31
|
+
* @template SlideData - The type of data used by each slide in the carousel.
|
|
32
|
+
*/
|
|
33
|
+
export type CarouselSlideContext<SlideData extends {
|
|
34
|
+
id: string;
|
|
35
|
+
}> = WidgetSlotContext<CarouselWidget<SlideData>> & SlideData;
|
|
36
|
+
/**
|
|
37
|
+
* Represents the state of a carousel component.
|
|
38
|
+
*
|
|
39
|
+
* @template SlideData - The type of data used by each slide in the carousel.
|
|
40
|
+
*/
|
|
41
|
+
export interface CarouselState<SlideData extends {
|
|
42
|
+
id: string;
|
|
43
|
+
}> {
|
|
44
|
+
/**
|
|
45
|
+
* is the carousel currently scrolling
|
|
46
|
+
*/
|
|
47
|
+
scrolling: boolean;
|
|
48
|
+
/**
|
|
49
|
+
* can carousel scroll to previous slide
|
|
50
|
+
*/
|
|
51
|
+
canScrollPrev: boolean;
|
|
52
|
+
/**
|
|
53
|
+
* can carousel scroll to next slide
|
|
54
|
+
*/
|
|
55
|
+
canScrollNext: boolean;
|
|
56
|
+
/**
|
|
57
|
+
* selected scroll snap
|
|
58
|
+
*/
|
|
59
|
+
selectedScrollSnap: number;
|
|
60
|
+
/**
|
|
61
|
+
* is the carousel initialized
|
|
62
|
+
*/
|
|
63
|
+
initialized: boolean;
|
|
64
|
+
/**
|
|
65
|
+
* If `true`, 'previous' and 'next' navigation arrows will be visible.
|
|
66
|
+
*/
|
|
67
|
+
showNavigationArrows: boolean;
|
|
68
|
+
/**
|
|
69
|
+
* If `true`, navigation indicators at the bottom of the slide will be visible.
|
|
70
|
+
*/
|
|
71
|
+
showNavigationIndicators: boolean;
|
|
72
|
+
/**
|
|
73
|
+
* Choose content direction between `ltr` and `rtl`
|
|
74
|
+
*
|
|
75
|
+
* @see {@link https://www.embla-carousel.com/api/options/#direction}
|
|
76
|
+
* @defaultValue `'ltr'`
|
|
77
|
+
*/
|
|
78
|
+
direction: 'ltr' | 'rtl';
|
|
79
|
+
/**
|
|
80
|
+
* CSS classes to be applied on the widget main container
|
|
81
|
+
*
|
|
82
|
+
* @defaultValue `''`
|
|
83
|
+
*/
|
|
84
|
+
className: string;
|
|
85
|
+
/**
|
|
86
|
+
* Class name to apply to the container of the carousel.
|
|
87
|
+
*
|
|
88
|
+
* @defaultValue `''`
|
|
89
|
+
*/
|
|
90
|
+
containerClass: string;
|
|
91
|
+
/**
|
|
92
|
+
* Class name to apply to each slide in the carousel.
|
|
93
|
+
*
|
|
94
|
+
* @defaultValue `''`
|
|
95
|
+
*/
|
|
96
|
+
slideClass: string | ((slideContext: {
|
|
97
|
+
id: string;
|
|
98
|
+
index: number;
|
|
99
|
+
active: boolean;
|
|
100
|
+
}) => string);
|
|
101
|
+
/**
|
|
102
|
+
* The data for each slide in the carousel.
|
|
103
|
+
*
|
|
104
|
+
* @defaultValue `[]`
|
|
105
|
+
*/
|
|
106
|
+
slidesData: SlideData[];
|
|
107
|
+
/**
|
|
108
|
+
* The structure of the carousel.
|
|
109
|
+
*
|
|
110
|
+
* @defaultValue `undefined`
|
|
111
|
+
*/
|
|
112
|
+
structure: SlotContent<CarouselContext<SlideData>>;
|
|
113
|
+
/**
|
|
114
|
+
* The navigation layer of the carousel.
|
|
115
|
+
*
|
|
116
|
+
* @defaultValue `undefined`
|
|
117
|
+
*/
|
|
118
|
+
navigation: SlotContent<CarouselContext<SlideData>>;
|
|
119
|
+
/**
|
|
120
|
+
* The content of each slide in the carousel.
|
|
121
|
+
*
|
|
122
|
+
* @defaultValue `undefined`
|
|
123
|
+
*/
|
|
124
|
+
slide: SlotContent<CarouselSlideContext<SlideData>>;
|
|
125
|
+
/**
|
|
126
|
+
* The aria-live attribute value for the carousel container.
|
|
127
|
+
*
|
|
128
|
+
* @defaultValue `'polite'`
|
|
129
|
+
*/
|
|
130
|
+
ariaLive: string;
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* Interface representing the properties for a carousel component.
|
|
134
|
+
*
|
|
135
|
+
* @template SlideData - The type of data used by each slide in the carousel.
|
|
136
|
+
*/
|
|
137
|
+
export interface CarouselProps<SlideData extends {
|
|
138
|
+
id: string;
|
|
139
|
+
}> {
|
|
140
|
+
/**
|
|
141
|
+
* Plugins to extend the carousel with additional features
|
|
142
|
+
* @defaultValue `[]`
|
|
143
|
+
*/
|
|
144
|
+
plugins: EmblaPluginType[];
|
|
145
|
+
/**
|
|
146
|
+
* Aria label for navigation indicators
|
|
147
|
+
*/
|
|
148
|
+
ariaIndicatorLabel: (index: number) => string;
|
|
149
|
+
/**
|
|
150
|
+
* Aria label for previous button
|
|
151
|
+
*/
|
|
152
|
+
ariaPrevLabel: string;
|
|
153
|
+
/**
|
|
154
|
+
* Aria label for next button
|
|
155
|
+
*/
|
|
156
|
+
ariaNextLabel: string;
|
|
157
|
+
/**
|
|
158
|
+
* Align the slides relative to the carousel viewport
|
|
159
|
+
*
|
|
160
|
+
* @see {@link https://www.embla-carousel.com/api/options/#align}
|
|
161
|
+
* @defaultValue `'center'`
|
|
162
|
+
*/
|
|
163
|
+
align: 'start' | 'center' | 'end';
|
|
164
|
+
/**
|
|
165
|
+
* Enables choosing a custom container element which holds the slides. By default, Embla will choose the first direct child element of the root element. Provide a valid CSS selector string.
|
|
166
|
+
*
|
|
167
|
+
* @see {@link https://www.embla-carousel.com/api/options/#container}
|
|
168
|
+
*/
|
|
169
|
+
container: string | null;
|
|
170
|
+
/**
|
|
171
|
+
* Clear leading and trailing empty space that causes excessive scrolling
|
|
172
|
+
*
|
|
173
|
+
* @see {@link https://www.embla-carousel.com/api/options/#containScroll}
|
|
174
|
+
* @defaultValue `'trimSnaps'`
|
|
175
|
+
*/
|
|
176
|
+
containScroll: false | 'trimSnaps' | 'keepSnaps';
|
|
177
|
+
/**
|
|
178
|
+
* Choose content direction between `ltr` and `rtl`
|
|
179
|
+
*
|
|
180
|
+
* @see {@link https://www.embla-carousel.com/api/options/#direction}
|
|
181
|
+
* @defaultValue `'ltr'`
|
|
182
|
+
*/
|
|
183
|
+
direction: 'ltr' | 'rtl';
|
|
184
|
+
/**
|
|
185
|
+
* Enables momentum scrolling
|
|
186
|
+
*
|
|
187
|
+
* @see {@link https://www.embla-carousel.com/api/options/#dragFree}
|
|
188
|
+
* @defaultValue `false`
|
|
189
|
+
*/
|
|
190
|
+
dragFree: boolean;
|
|
191
|
+
/**
|
|
192
|
+
* Drag threshold in pixels
|
|
193
|
+
*
|
|
194
|
+
* @see {@link https://www.embla-carousel.com/api/options/#dragThreshold}
|
|
195
|
+
* @defaultValue `10`
|
|
196
|
+
*/
|
|
197
|
+
dragThreshold: number;
|
|
198
|
+
/**
|
|
199
|
+
* Set scroll duration when triggered by any of the API methods
|
|
200
|
+
*
|
|
201
|
+
* @see {@link https://www.embla-carousel.com/api/options/#duration}
|
|
202
|
+
* @defaultValue `25`
|
|
203
|
+
*/
|
|
204
|
+
duration: number;
|
|
205
|
+
/**
|
|
206
|
+
* Enables infinite looping
|
|
207
|
+
*
|
|
208
|
+
* @see {@link https://www.embla-carousel.com/api/options/#loop}
|
|
209
|
+
* @defaultValue `false`
|
|
210
|
+
*/
|
|
211
|
+
loop: boolean;
|
|
212
|
+
/**
|
|
213
|
+
* Allow the carousel to skip scroll snaps if it's dragged vigorously
|
|
214
|
+
*
|
|
215
|
+
* @see {@link https://www.embla-carousel.com/api/options/#skipsnaps}
|
|
216
|
+
* @defaultValue `false`
|
|
217
|
+
*/
|
|
218
|
+
skipSnaps: boolean;
|
|
219
|
+
/**
|
|
220
|
+
* If `true`, 'previous' and 'next' navigation arrows will be visible.
|
|
221
|
+
*/
|
|
222
|
+
showNavigationArrows: boolean;
|
|
223
|
+
/**
|
|
224
|
+
* If `true`, navigation indicators at the bottom of the slide will be visible.
|
|
225
|
+
*/
|
|
226
|
+
showNavigationIndicators: boolean;
|
|
227
|
+
/**
|
|
228
|
+
* CSS classes to be applied on the widget main container
|
|
229
|
+
*
|
|
230
|
+
* @defaultValue `''`
|
|
231
|
+
*/
|
|
232
|
+
className: string;
|
|
233
|
+
/**
|
|
234
|
+
* Class name to apply to the container of the carousel.
|
|
235
|
+
*
|
|
236
|
+
* @defaultValue `''`
|
|
237
|
+
*/
|
|
238
|
+
containerClass: string;
|
|
239
|
+
/**
|
|
240
|
+
* Class name to apply to each slide in the carousel.
|
|
241
|
+
*
|
|
242
|
+
* @defaultValue `''`
|
|
243
|
+
*/
|
|
244
|
+
slideClass: string | ((slideContext: {
|
|
245
|
+
id: string;
|
|
246
|
+
index: number;
|
|
247
|
+
active: boolean;
|
|
248
|
+
}) => string);
|
|
249
|
+
/**
|
|
250
|
+
* The data for each slide in the carousel.
|
|
251
|
+
*
|
|
252
|
+
* @defaultValue `[]`
|
|
253
|
+
*/
|
|
254
|
+
slidesData: SlideData[];
|
|
255
|
+
/**
|
|
256
|
+
* The structure of the carousel.
|
|
257
|
+
*
|
|
258
|
+
* @defaultValue `undefined`
|
|
259
|
+
*/
|
|
260
|
+
structure: SlotContent<CarouselContext<SlideData>>;
|
|
261
|
+
/**
|
|
262
|
+
* The navigation layer of the carousel.
|
|
263
|
+
*
|
|
264
|
+
* @defaultValue `undefined`
|
|
265
|
+
*/
|
|
266
|
+
navigation: SlotContent<CarouselContext<SlideData>>;
|
|
267
|
+
/**
|
|
268
|
+
* The content of each slide in the carousel.
|
|
269
|
+
*
|
|
270
|
+
* @defaultValue `undefined`
|
|
271
|
+
*/
|
|
272
|
+
slide: SlotContent<CarouselSlideContext<SlideData>>;
|
|
273
|
+
/**
|
|
274
|
+
* The aria-live attribute value for the carousel container.
|
|
275
|
+
*
|
|
276
|
+
* @defaultValue `'polite'`
|
|
277
|
+
*/
|
|
278
|
+
ariaLive: string;
|
|
279
|
+
}
|
|
280
|
+
/**
|
|
281
|
+
* Represents the directives for a carousel component.
|
|
282
|
+
*/
|
|
283
|
+
export interface CarouselDirectives {
|
|
284
|
+
/**
|
|
285
|
+
* A directive to be applied to each slide in the carousel.
|
|
286
|
+
*/
|
|
287
|
+
slide: Directive<{
|
|
288
|
+
id: string;
|
|
289
|
+
index: number;
|
|
290
|
+
}>;
|
|
291
|
+
/**
|
|
292
|
+
* A directive to be applied to container of the carousel.
|
|
293
|
+
*/
|
|
294
|
+
container: Directive;
|
|
295
|
+
/**
|
|
296
|
+
* the root directive
|
|
297
|
+
*/
|
|
298
|
+
root: Directive;
|
|
299
|
+
/**
|
|
300
|
+
* A directive to be applied to a navigation button allowing to scroll to the previous slide.
|
|
301
|
+
*/
|
|
302
|
+
scrollPrev: Directive;
|
|
303
|
+
/**
|
|
304
|
+
* A directive to be applied to a navigation button allowing to scroll to the next slide.
|
|
305
|
+
*/
|
|
306
|
+
scrollNext: Directive;
|
|
307
|
+
/**
|
|
308
|
+
* A directive to be applied to a tab list allowing to navigate to the corresponding slide.
|
|
309
|
+
* This directive adds the role `tablist` and is recommended to be used together with {@link tabIndicator}.
|
|
310
|
+
*/
|
|
311
|
+
tabList: Directive;
|
|
312
|
+
/**
|
|
313
|
+
* A directive to be applied to a navigation indicator allowing to scroll to the corresponding slide.
|
|
314
|
+
* As this directive adds the role `tab` to the element, it is recommended to use it on a button or a link and the parent element should have the {@link tabList} directive attached.
|
|
315
|
+
*/
|
|
316
|
+
tabIndicator: Directive<{
|
|
317
|
+
index: number;
|
|
318
|
+
id: string;
|
|
319
|
+
jump?: boolean;
|
|
320
|
+
}>;
|
|
321
|
+
}
|
|
322
|
+
/**
|
|
323
|
+
* Represents a carousel widget with specific properties, state, API, and directives.
|
|
324
|
+
*
|
|
325
|
+
* @template SlideData - The type of the data for each slide.
|
|
326
|
+
*/
|
|
327
|
+
export type CarouselWidget<SlideData extends {
|
|
328
|
+
id: string;
|
|
329
|
+
}> = Widget<CarouselProps<SlideData>, CarouselState<SlideData>, CarouselApi, CarouselDirectives>;
|
|
330
|
+
/**
|
|
331
|
+
* Represents the API for a carousel component.
|
|
332
|
+
*/
|
|
333
|
+
export interface CarouselApi {
|
|
334
|
+
/**
|
|
335
|
+
* Scroll to the previous snap point if possible.
|
|
336
|
+
* @param jump - scroll instantly
|
|
337
|
+
*/
|
|
338
|
+
scrollPrev: (jump?: boolean) => void;
|
|
339
|
+
/**
|
|
340
|
+
* Scroll to the next snap point if possible.
|
|
341
|
+
* @param jump - scroll instantly
|
|
342
|
+
*/
|
|
343
|
+
scrollNext: (jump?: boolean) => void;
|
|
344
|
+
/**
|
|
345
|
+
* Scroll to a snap point by index
|
|
346
|
+
* @param index - the snap point index
|
|
347
|
+
* @param jump - scroll instantly
|
|
348
|
+
*/
|
|
349
|
+
scrollTo: (index: number, jump?: boolean) => void;
|
|
350
|
+
/**
|
|
351
|
+
* Retrieve the enabled plugins
|
|
352
|
+
*/
|
|
353
|
+
plugins: () => EmblaPluginsType | undefined;
|
|
354
|
+
/**
|
|
355
|
+
* Retrieve the inner EmblaApi object
|
|
356
|
+
*/
|
|
357
|
+
emblaApi: () => EmblaCarouselType | undefined;
|
|
358
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const carousel = require("../../carousel-B8b91cHo.cjs");
|
|
4
|
+
exports.Carousel = carousel.Carousel;
|
|
5
|
+
exports.CarouselDefaultNavigation = carousel.CarouselDefaultNavigation;
|
|
6
|
+
exports.CarouselDefaultStructure = carousel.CarouselDefaultStructure;
|
|
7
|
+
exports.createCarousel = carousel.export_createCarousel;
|
|
8
|
+
exports.getCarouselDefaultConfig = carousel.export_getCarouselDefaultConfig;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const collapse = require("../../collapse-
|
|
3
|
+
const collapse = require("../../collapse-BQNW5NFj.cjs");
|
|
4
4
|
exports.Collapse = collapse.Collapse;
|
|
5
5
|
exports.createCollapse = collapse.export_createCollapse;
|
|
6
6
|
exports.getCollapseDefaultConfig = collapse.export_getCollapseDefaultConfig;
|