@xwadex/fesd-next 0.3.4-8 → 0.3.4-9
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/index.d.ts +186 -5
- package/dist/components/index.js +9561 -5
- package/dist/components/index.js.map +1 -0
- package/dist/hooks/index.d.ts +68 -10
- package/dist/hooks/index.js +9243 -10
- package/dist/hooks/index.js.map +1 -0
- package/dist/index.d.ts +55 -5
- package/dist/index.js +36374 -5
- package/dist/index.js.map +1 -0
- package/dist/shadcns/index.d.ts +490 -48
- package/dist/shadcns/index.js +32495 -48
- package/dist/shadcns/index.js.map +1 -0
- package/dist/types/index.d.ts +17 -2
- package/dist/types/index.js +3 -2
- package/dist/types/index.js.map +1 -0
- package/dist/useAnchors-BzgJT2J9.d.ts +78 -0
- package/dist/utils/index.d.ts +12 -10
- package/dist/utils/index.js +56 -63
- package/dist/utils/index.js.map +1 -0
- package/package.json +9 -7
- package/dist/components/anchors/anchors.d.ts +0 -14
- package/dist/components/anchors/anchors.js +0 -23
- package/dist/components/anchors/index.d.ts +0 -1
- package/dist/components/anchors/index.js +0 -1
- package/dist/components/embla-carousels/embla-carousels-hooks.d.ts +0 -36
- package/dist/components/embla-carousels/embla-carousels-hooks.js +0 -83
- package/dist/components/embla-carousels/embla-carousels.d.ts +0 -23
- package/dist/components/embla-carousels/embla-carousels.js +0 -58
- package/dist/components/embla-carousels/index.d.ts +0 -2
- package/dist/components/embla-carousels/index.js +0 -2
- package/dist/components/emblas/embla-container.d.ts +0 -8
- package/dist/components/emblas/embla-container.js +0 -12
- package/dist/components/emblas/embla-context.d.ts +0 -21
- package/dist/components/emblas/embla-context.js +0 -12
- package/dist/components/emblas/embla.d.ts +0 -20
- package/dist/components/emblas/embla.js +0 -124
- package/dist/components/emblas/emblas-pagination.d.ts +0 -11
- package/dist/components/emblas/emblas-pagination.js +0 -89
- package/dist/components/emblas/index.d.ts +0 -4
- package/dist/components/emblas/index.js +0 -4
- package/dist/components/scroll-containers/index.d.ts +0 -3
- package/dist/components/scroll-containers/index.js +0 -3
- package/dist/components/scroll-containers/lenis-scroll.d.ts +0 -20
- package/dist/components/scroll-containers/lenis-scroll.js +0 -65
- package/dist/components/scroll-containers/native-scroll.d.ts +0 -6
- package/dist/components/scroll-containers/native-scroll.js +0 -23
- package/dist/components/scroll-containers/scroll-containers.d.ts +0 -25
- package/dist/components/scroll-containers/scroll-containers.js +0 -46
- package/dist/components/tests/index.d.ts +0 -1
- package/dist/components/tests/index.js +0 -1
- package/dist/components/tests/tests.d.ts +0 -4
- package/dist/components/tests/tests.js +0 -9
- package/dist/hooks/useAnchors.d.ts +0 -73
- package/dist/hooks/useAnchors.js +0 -203
- package/dist/hooks/useAsyncFetcher.d.ts +0 -11
- package/dist/hooks/useAsyncFetcher.js +0 -39
- package/dist/hooks/useCookies.d.ts +0 -6
- package/dist/hooks/useCookies.js +0 -42
- package/dist/hooks/useDebounce.d.ts +0 -7
- package/dist/hooks/useDebounce.js +0 -15
- package/dist/hooks/useDebounceValue.d.ts +0 -1
- package/dist/hooks/useDebounceValue.js +0 -16
- package/dist/hooks/useDragResize.d.ts +0 -22
- package/dist/hooks/useDragResize.js +0 -74
- package/dist/hooks/useEffectLeave.d.ts +0 -1
- package/dist/hooks/useEffectLeave.js +0 -11
- package/dist/hooks/useEffectOne.d.ts +0 -1
- package/dist/hooks/useEffectOne.js +0 -11
- package/dist/hooks/useHash.d.ts +0 -1
- package/dist/hooks/useHash.js +0 -18
- package/dist/hooks/useLocations.d.ts +0 -13
- package/dist/hooks/useLocations.js +0 -24
- package/dist/hooks/useMounted.d.ts +0 -3
- package/dist/hooks/useMounted.js +0 -6
- package/dist/shadcns/components/ui/accordion.d.ts +0 -7
- package/dist/shadcns/components/ui/accordion.js +0 -18
- package/dist/shadcns/components/ui/alert-dialog.d.ts +0 -14
- package/dist/shadcns/components/ui/alert-dialog.js +0 -38
- package/dist/shadcns/components/ui/alert.d.ts +0 -9
- package/dist/shadcns/components/ui/alert.js +0 -25
- package/dist/shadcns/components/ui/aspect-ratio.d.ts +0 -3
- package/dist/shadcns/components/ui/aspect-ratio.js +0 -7
- package/dist/shadcns/components/ui/avatar.d.ts +0 -6
- package/dist/shadcns/components/ui/avatar.js +0 -14
- package/dist/shadcns/components/ui/badge.d.ts +0 -9
- package/dist/shadcns/components/ui/badge.js +0 -23
- package/dist/shadcns/components/ui/breadcrumb.d.ts +0 -11
- package/dist/shadcns/components/ui/breadcrumb.js +0 -27
- package/dist/shadcns/components/ui/button-group.d.ts +0 -11
- package/dist/shadcns/components/ui/button-group.js +0 -26
- package/dist/shadcns/components/ui/button.d.ts +0 -10
- package/dist/shadcns/components/ui/button.js +0 -31
- package/dist/shadcns/components/ui/calendar.d.ts +0 -8
- package/dist/shadcns/components/ui/calendar.js +0 -73
- package/dist/shadcns/components/ui/card.d.ts +0 -9
- package/dist/shadcns/components/ui/card.js +0 -25
- package/dist/shadcns/components/ui/carousel.d.ts +0 -19
- package/dist/shadcns/components/ui/carousel.js +0 -91
- package/dist/shadcns/components/ui/chart.d.ts +0 -40
- package/dist/shadcns/components/ui/chart.js +0 -114
- package/dist/shadcns/components/ui/checkbox.d.ts +0 -4
- package/dist/shadcns/components/ui/checkbox.js +0 -9
- package/dist/shadcns/components/ui/collapsible.d.ts +0 -5
- package/dist/shadcns/components/ui/collapsible.js +0 -13
- package/dist/shadcns/components/ui/command.d.ts +0 -18
- package/dist/shadcns/components/ui/command.js +0 -33
- package/dist/shadcns/components/ui/context-menu.d.ts +0 -25
- package/dist/shadcns/components/ui/context-menu.js +0 -51
- package/dist/shadcns/components/ui/dialog.d.ts +0 -15
- package/dist/shadcns/components/ui/dialog.js +0 -36
- package/dist/shadcns/components/ui/drawer.d.ts +0 -13
- package/dist/shadcns/components/ui/drawer.js +0 -35
- package/dist/shadcns/components/ui/dropdown-menu.d.ts +0 -25
- package/dist/shadcns/components/ui/dropdown-menu.js +0 -51
- package/dist/shadcns/components/ui/field.d.ts +0 -24
- package/dist/shadcns/components/ui/field.js +0 -75
- package/dist/shadcns/components/ui/form.d.ts +0 -24
- package/dist/shadcns/components/ui/form.js +0 -56
- package/dist/shadcns/components/ui/hover-card.d.ts +0 -6
- package/dist/shadcns/components/ui/hover-card.js +0 -14
- package/dist/shadcns/components/ui/input-otp.d.ts +0 -11
- package/dist/shadcns/components/ui/input-otp.js +0 -21
- package/dist/shadcns/components/ui/input.d.ts +0 -3
- package/dist/shadcns/components/ui/input.js +0 -6
- package/dist/shadcns/components/ui/item.d.ts +0 -23
- package/dist/shadcns/components/ui/item.js +0 -65
- package/dist/shadcns/components/ui/label.d.ts +0 -4
- package/dist/shadcns/components/ui/label.js +0 -8
- package/dist/shadcns/components/ui/menubar.d.ts +0 -26
- package/dist/shadcns/components/ui/menubar.js +0 -54
- package/dist/shadcns/components/ui/native-select.d.ts +0 -7
- package/dist/shadcns/components/ui/native-select.js +0 -13
- package/dist/shadcns/components/ui/navigation-menu.d.ts +0 -14
- package/dist/shadcns/components/ui/navigation-menu.js +0 -31
- package/dist/shadcns/components/ui/pagination.d.ts +0 -13
- package/dist/shadcns/components/ui/pagination.js +0 -28
- package/dist/shadcns/components/ui/popover.d.ts +0 -7
- package/dist/shadcns/components/ui/popover.js +0 -17
- package/dist/shadcns/components/ui/progress.d.ts +0 -4
- package/dist/shadcns/components/ui/progress.js +0 -8
- package/dist/shadcns/components/ui/radio-group.d.ts +0 -5
- package/dist/shadcns/components/ui/radio-group.js +0 -12
- package/dist/shadcns/components/ui/resizable.d.ts +0 -8
- package/dist/shadcns/components/ui/resizable.js +0 -15
- package/dist/shadcns/components/ui/scroll-area.d.ts +0 -5
- package/dist/shadcns/components/ui/scroll-area.js +0 -11
- package/dist/shadcns/components/ui/select.d.ts +0 -15
- package/dist/shadcns/components/ui/select.js +0 -38
- package/dist/shadcns/components/ui/separator.d.ts +0 -4
- package/dist/shadcns/components/ui/separator.js +0 -8
- package/dist/shadcns/components/ui/sheet.d.ts +0 -13
- package/dist/shadcns/components/ui/sheet.js +0 -40
- package/dist/shadcns/components/ui/sidebar.d.ts +0 -66
- package/dist/shadcns/components/ui/sidebar.js +0 -204
- package/dist/shadcns/components/ui/skeleton.d.ts +0 -2
- package/dist/shadcns/components/ui/skeleton.js +0 -6
- package/dist/shadcns/components/ui/slider.d.ts +0 -4
- package/dist/shadcns/components/ui/slider.js +0 -10
- package/dist/shadcns/components/ui/sonner.d.ts +0 -3
- package/dist/shadcns/components/ui/sonner.js +0 -13
- package/dist/shadcns/components/ui/switch.d.ts +0 -4
- package/dist/shadcns/components/ui/switch.js +0 -8
- package/dist/shadcns/components/ui/table.d.ts +0 -10
- package/dist/shadcns/components/ui/table.js +0 -28
- package/dist/shadcns/components/ui/tabs.d.ts +0 -7
- package/dist/shadcns/components/ui/tabs.js +0 -17
- package/dist/shadcns/components/ui/textarea.d.ts +0 -3
- package/dist/shadcns/components/ui/textarea.js +0 -6
- package/dist/shadcns/components/ui/toggle-group.d.ts +0 -7
- package/dist/shadcns/components/ui/toggle-group.js +0 -20
- package/dist/shadcns/components/ui/toggle.d.ts +0 -9
- package/dist/shadcns/components/ui/toggle.js +0 -26
- package/dist/shadcns/components/ui/tooltip.d.ts +0 -7
- package/dist/shadcns/components/ui/tooltip.js +0 -17
- package/dist/shadcns/hooks/use-mobile.d.ts +0 -1
- package/dist/shadcns/hooks/use-mobile.js +0 -15
- package/dist/shadcns/lib/utils.d.ts +0 -2
- package/dist/shadcns/lib/utils.js +0 -5
- package/dist/types/components.type.d.ts +0 -9
- package/dist/types/components.type.js +0 -1
- package/dist/types/shadcns.type.d.ts +0 -6
- package/dist/types/shadcns.type.js +0 -2
package/dist/types/index.d.ts
CHANGED
|
@@ -1,2 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
type ShadcnBaseProps<P extends keyof React.JSX.IntrinsicElements | React.JSXElementConstructor<any>> = {
|
|
2
|
+
as?: React.ElementType;
|
|
3
|
+
} & React.ComponentProps<P>;
|
|
4
|
+
type BaseProps<T extends React.ElementType, P extends keyof React.JSX.IntrinsicElements | React.JSXElementConstructor<any>> = {
|
|
5
|
+
as?: T;
|
|
6
|
+
} & React.ComponentProps<P>;
|
|
7
|
+
|
|
8
|
+
type AsTypes<T extends React.ElementType = "div"> = {
|
|
9
|
+
as?: T;
|
|
10
|
+
};
|
|
11
|
+
type AsPropsToOmit<T extends React.ElementType, P> = keyof (AsTypes<T> & P);
|
|
12
|
+
type AsPropsTypes<T extends React.ElementType, P = {}> = P & AsTypes<T> & Omit<React.ComponentPropsWithoutRef<T>, AsPropsToOmit<T, P>>;
|
|
13
|
+
type SlotsPropsTypes = {
|
|
14
|
+
[key: number]: string;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export type { AsPropsTypes, BaseProps, ShadcnBaseProps, SlotsPropsTypes };
|
package/dist/types/index.js
CHANGED
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
|
|
2
|
+
//# sourceMappingURL=index.js.map
|
|
3
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"index.js"}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import * as zustand from 'zustand';
|
|
2
|
+
import * as React$1 from 'react';
|
|
3
|
+
import { Easing, AnimationPlaybackControlsWithThen } from 'motion/react';
|
|
4
|
+
import Lenis from 'lenis';
|
|
5
|
+
|
|
6
|
+
interface AnimateOptions {
|
|
7
|
+
duration?: number;
|
|
8
|
+
delay?: number;
|
|
9
|
+
ease?: Easing | Easing[] | undefined;
|
|
10
|
+
onScroll?: (lenis?: Lenis) => void;
|
|
11
|
+
onScrolling?: (value: number) => void;
|
|
12
|
+
onScrolled?: (lenis?: Lenis) => void;
|
|
13
|
+
}
|
|
14
|
+
interface AnchorOptions extends AnimateOptions {
|
|
15
|
+
anchor: string;
|
|
16
|
+
container?: string;
|
|
17
|
+
offseters?: string | string[];
|
|
18
|
+
direction?: "x" | "y";
|
|
19
|
+
align?: "start" | "center" | "end";
|
|
20
|
+
offset?: number;
|
|
21
|
+
}
|
|
22
|
+
interface ScrollOptions extends AnimateOptions {
|
|
23
|
+
controllerKey: string;
|
|
24
|
+
containerDom: HTMLElement | Window;
|
|
25
|
+
anchorScrollValue: {
|
|
26
|
+
left: number;
|
|
27
|
+
top: number;
|
|
28
|
+
};
|
|
29
|
+
containerScrollValue: {
|
|
30
|
+
left: number;
|
|
31
|
+
top: number;
|
|
32
|
+
};
|
|
33
|
+
direction?: AnchorOptions["direction"];
|
|
34
|
+
}
|
|
35
|
+
type AnimateController = AnimationPlaybackControlsWithThen;
|
|
36
|
+
interface AnchorsMethods {
|
|
37
|
+
registerAnchors: (name: string) => {
|
|
38
|
+
[key: string]: string | React.RefObject<null>;
|
|
39
|
+
ref: React.RefObject<null>;
|
|
40
|
+
};
|
|
41
|
+
registerOffseters: (name: string) => {
|
|
42
|
+
[key: string]: string | React.RefObject<null>;
|
|
43
|
+
ref: React.RefObject<null>;
|
|
44
|
+
};
|
|
45
|
+
setStores: (options: AnchorStoreOptions) => void;
|
|
46
|
+
getStores: () => AnchorsStores;
|
|
47
|
+
scrollToAnchor: (anchorOptions: AnchorOptions) => void;
|
|
48
|
+
}
|
|
49
|
+
declare function useAnchors(): AnchorsMethods;
|
|
50
|
+
interface RegistrationDatas {
|
|
51
|
+
key: keyof AnchorsStores;
|
|
52
|
+
name: string;
|
|
53
|
+
}
|
|
54
|
+
declare function useRegistration({ key, name }: RegistrationDatas): {
|
|
55
|
+
[x: string]: string | React$1.RefObject<null>;
|
|
56
|
+
ref: React$1.RefObject<null>;
|
|
57
|
+
};
|
|
58
|
+
declare function registerAnchors(name: string): {
|
|
59
|
+
[x: string]: string | React$1.RefObject<null>;
|
|
60
|
+
ref: React$1.RefObject<null>;
|
|
61
|
+
};
|
|
62
|
+
declare function registerOffseters(name: string): {
|
|
63
|
+
[x: string]: string | React$1.RefObject<null>;
|
|
64
|
+
ref: React$1.RefObject<null>;
|
|
65
|
+
};
|
|
66
|
+
interface AnchorsStores {
|
|
67
|
+
anchors: Map<string, HTMLElement | null>;
|
|
68
|
+
offseters: Map<string, HTMLElement | null>;
|
|
69
|
+
}
|
|
70
|
+
declare const useAnchorsStores: zustand.UseBoundStore<zustand.StoreApi<AnchorsStores>>;
|
|
71
|
+
declare const getAnchorsStores: () => AnchorsStores;
|
|
72
|
+
interface AnchorStoreOptions extends RegistrationDatas {
|
|
73
|
+
node: HTMLDivElement | null;
|
|
74
|
+
action: "add" | "remove";
|
|
75
|
+
}
|
|
76
|
+
declare const setAnchorsStore: (options: AnchorStoreOptions) => void;
|
|
77
|
+
|
|
78
|
+
export { type AnchorOptions as A, type RegistrationDatas as R, type ScrollOptions as S, type AnchorStoreOptions as a, type AnchorsMethods as b, type AnchorsStores as c, type AnimateController as d, type AnimateOptions as e, registerOffseters as f, getAnchorsStores as g, useAnchorsStores as h, useRegistration as i, registerAnchors as r, setAnchorsStore as s, useAnchors as u };
|
package/dist/utils/index.d.ts
CHANGED
|
@@ -1,13 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
declare const regexParse: (regexString: string, flags?: string) => RegExp | String;
|
|
2
|
+
declare const regexReplaceEach: (currentValue: string, replace: {
|
|
3
3
|
pattern: string;
|
|
4
4
|
flags?: string;
|
|
5
5
|
}[]) => string;
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
6
|
+
declare const mediaRatio: (width: number, height: number) => string;
|
|
7
|
+
declare const sleep: (time: number) => Promise<void>;
|
|
8
|
+
declare const querySearchWord: (str: string) => string;
|
|
9
|
+
declare const lockBody: (active: boolean, stillScrollHTMLElement?: HTMLElement | HTMLElement[] | null | undefined) => void;
|
|
10
|
+
declare const mergeClassName: (...argements: (string | number | boolean)[]) => string;
|
|
11
|
+
declare const getSearchParams: (searchParams: URLSearchParams) => any;
|
|
12
|
+
declare const getDomTransTime: (target: HTMLElement) => number;
|
|
13
|
+
declare const getURLSearchParams: (searchParams: URLSearchParams) => URLSearchParams;
|
|
14
|
+
|
|
15
|
+
export { getDomTransTime, getSearchParams, getURLSearchParams, lockBody, mediaRatio, mergeClassName, querySearchWord, regexParse, regexReplaceEach, sleep };
|
package/dist/utils/index.js
CHANGED
|
@@ -1,70 +1,63 @@
|
|
|
1
|
-
import { lock, clearBodyLocks } from
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
1
|
+
import { lock, clearBodyLocks } from 'tua-body-scroll-lock';
|
|
2
|
+
|
|
3
|
+
// src/utils/index.ts
|
|
4
|
+
var regexParse = (regexString, flags) => {
|
|
5
|
+
const regex = regexString.replace(/\\\\/g, "\\");
|
|
6
|
+
try {
|
|
7
|
+
return new RegExp(regex);
|
|
8
|
+
} catch (e) {
|
|
9
|
+
console.error("Invalid regular expression:", regexString, e);
|
|
10
|
+
return regexString;
|
|
11
|
+
}
|
|
11
12
|
};
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
? current.replace(regexPattern, "")
|
|
16
|
-
: current;
|
|
13
|
+
var regexReplaceEach = (currentValue, replace) => replace.reduce((current, regexs) => {
|
|
14
|
+
const regexPattern = regexParse(regexs.pattern, regexs.flags);
|
|
15
|
+
return regexPattern instanceof RegExp ? current.replace(regexPattern, "") : current;
|
|
17
16
|
}, currentValue);
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
return resolve();
|
|
25
|
-
}, time);
|
|
17
|
+
var mediaRatio = (width, height) => Number(width) && Number(height) ? Math.round(height / width * 1e4) / 100 + "%" : "100%";
|
|
18
|
+
var sleep = (time) => new Promise((resolve) => {
|
|
19
|
+
let timer = setTimeout(() => {
|
|
20
|
+
clearTimeout(timer);
|
|
21
|
+
return resolve();
|
|
22
|
+
}, time);
|
|
26
23
|
});
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
24
|
+
var querySearchWord = (str) => str.trim().toLowerCase();
|
|
25
|
+
var lockBody = (active, stillScrollHTMLElement) => {
|
|
26
|
+
document.body.style.overflow = active ? "visible" : "";
|
|
27
|
+
active ? lock(stillScrollHTMLElement) : clearBodyLocks();
|
|
31
28
|
};
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
29
|
+
var mergeClassName = (...argements) => argements.toString().replace(/,/g, " ").replace(/\s+/g, " ").trim();
|
|
30
|
+
var getSearchParams = (searchParams) => {
|
|
31
|
+
const params = {};
|
|
32
|
+
searchParams.forEach((value, key) => {
|
|
33
|
+
params[key] = value;
|
|
34
|
+
});
|
|
35
|
+
return params;
|
|
37
36
|
};
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
const parseTime = (timeStr) => {
|
|
54
|
-
timeStr = timeStr.trim();
|
|
55
|
-
if (timeStr.endsWith("ms"))
|
|
56
|
-
return parseFloat(timeStr);
|
|
57
|
-
if (timeStr.endsWith("s"))
|
|
58
|
-
return parseFloat(timeStr) * 1000;
|
|
59
|
-
return 0;
|
|
60
|
-
};
|
|
61
|
-
const durations = computedStyle.transitionDuration.split(",").map(parseTime);
|
|
62
|
-
const delays = computedStyle.transitionDelay.split(",").map(parseTime);
|
|
63
|
-
const maxLength = Math.max(durations.length, delays.length);
|
|
64
|
-
return Math.max(...Array.from({ length: maxLength }, (_, i) => (durations[i] || 0) + (delays[i] || 0)));
|
|
37
|
+
var getDomTransTime = (target) => {
|
|
38
|
+
if (!target) return 0;
|
|
39
|
+
const computedStyle = window.getComputedStyle(target);
|
|
40
|
+
const parseTime = (timeStr) => {
|
|
41
|
+
timeStr = timeStr.trim();
|
|
42
|
+
if (timeStr.endsWith("ms")) return parseFloat(timeStr);
|
|
43
|
+
if (timeStr.endsWith("s")) return parseFloat(timeStr) * 1e3;
|
|
44
|
+
return 0;
|
|
45
|
+
};
|
|
46
|
+
const durations = computedStyle.transitionDuration.split(",").map(parseTime);
|
|
47
|
+
const delays = computedStyle.transitionDelay.split(",").map(parseTime);
|
|
48
|
+
const maxLength = Math.max(durations.length, delays.length);
|
|
49
|
+
return Math.max(
|
|
50
|
+
...Array.from({ length: maxLength }, (_, i) => (durations[i] || 0) + (delays[i] || 0))
|
|
51
|
+
);
|
|
65
52
|
};
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
53
|
+
var getURLSearchParams = (searchParams) => {
|
|
54
|
+
const params = {};
|
|
55
|
+
searchParams.forEach((value, key) => {
|
|
56
|
+
params[key] = value;
|
|
57
|
+
});
|
|
58
|
+
return new URLSearchParams({ ...params });
|
|
70
59
|
};
|
|
60
|
+
|
|
61
|
+
export { getDomTransTime, getSearchParams, getURLSearchParams, lockBody, mediaRatio, mergeClassName, querySearchWord, regexParse, regexReplaceEach, sleep };
|
|
62
|
+
//# sourceMappingURL=index.js.map
|
|
63
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/utils/index.ts"],"names":[],"mappings":"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","file":"index.js","sourcesContent":["import { lock, clearBodyLocks } from \"tua-body-scroll-lock\"\nexport const regexParse = (regexString: string, flags?: string): RegExp | String => {\n\tconst regex = regexString.replace(/\\\\\\\\/g, \"\\\\\")\n\ttry {\n\t\treturn new RegExp(regex)\n\t} catch (e) {\n\t\tconsole.error(\"Invalid regular expression:\", regexString, e)\n\t\treturn regexString\n\t}\n}\n\nexport const regexReplaceEach = (\n\tcurrentValue: string,\n\treplace: { pattern: string, flags?: string }[]\n): string =>\n\treplace.reduce((current, regexs) => {\n\t\tconst regexPattern = regexParse(regexs.pattern, regexs.flags)\n\t\treturn regexPattern instanceof RegExp\n\t\t\t? current.replace(regexPattern, \"\")\n\t\t\t: current\n\t}, currentValue)\n\nexport const mediaRatio = (width: number, height: number) =>\n\tNumber(width) && Number(height)\n\t\t? Math.round(height / width * 10000) / 100 + \"%\"\n\t\t: \"100%\"\n\nexport const sleep = (time: number) => new Promise<void>((resolve) => {\n\tlet timer = setTimeout(() => {\n\t\tclearTimeout(timer)\n\t\treturn resolve()\n\t}, time)\n})\n\nexport const querySearchWord = (str: string) => str.trim().toLowerCase()\n\nexport const lockBody = (\n\tactive: boolean,\n\tstillScrollHTMLElement?: HTMLElement | HTMLElement[] | null | undefined\n): void => {\n\tdocument.body.style.overflow = active ? \"visible\" : \"\"\n\tactive ? lock(stillScrollHTMLElement) : clearBodyLocks()\n}\n\nexport const mergeClassName = (...argements: (string | number | boolean)[]): string =>\n\targements.toString().replace(/,/g, \" \").replace(/\\s+/g, \" \").trim()\n\nexport const getSearchParams = (searchParams: URLSearchParams) => {\n\tconst params: any = {}\n\tsearchParams.forEach((value: any, key: any) => { params[key] = value })\n\treturn params\n}\n\n// export const getDomTransTime = (target: HTMLElement): number => {\n// const computedStyle = window.getComputedStyle(target)\n// const transNumber = (time: string) => {\n// if (time.endsWith(\"ms\")) return parseFloat(time)\n// if (time.endsWith(\"s\")) return parseFloat(time) * 1000\n// return 0\n// }\n// const durations = computedStyle.transitionDuration.split(',').map(transNumber)\n// const delays = computedStyle.transitionDelay.split(',').map(transNumber)\n// return Math.max(...durations.map((d, i) => d + (delays[i] || 0)))\n// }\n\nexport const getDomTransTime = (target: HTMLElement): number => {\n\tif (!target) return 0\n\n\tconst computedStyle = window.getComputedStyle(target)\n\n\tconst parseTime = (timeStr: string): number => {\n\t\ttimeStr = timeStr.trim()\n\t\tif (timeStr.endsWith(\"ms\")) return parseFloat(timeStr)\n\t\tif (timeStr.endsWith(\"s\")) return parseFloat(timeStr) * 1000\n\t\treturn 0\n\t}\n\n\tconst durations = computedStyle.transitionDuration.split(\",\").map(parseTime)\n\tconst delays = computedStyle.transitionDelay.split(\",\").map(parseTime)\n\tconst maxLength = Math.max(durations.length, delays.length)\n\n\treturn Math.max(\n\t\t...Array.from({ length: maxLength }, (_, i) => (durations[i] || 0) + (delays[i] || 0))\n\t)\n}\n\nexport const getURLSearchParams = (searchParams: URLSearchParams) => {\n\tconst params: any = {}\n\tsearchParams.forEach((value: any, key: any) => { params[key] = value })\n\treturn new URLSearchParams({ ...params })\n}\n\n"]}
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xwadex/fesd-next",
|
|
3
|
-
"version": "0.3.4-
|
|
3
|
+
"version": "0.3.4-9",
|
|
4
4
|
"private": false,
|
|
5
|
-
"main": "dist/index.js",
|
|
6
|
-
"types": "dist/index.d.ts",
|
|
7
5
|
"type": "module",
|
|
6
|
+
"main": "./dist/index.js",
|
|
7
|
+
"types": "./dist/index.d.ts",
|
|
8
8
|
"exports": {
|
|
9
9
|
".": {
|
|
10
10
|
"import": "./dist/index.js",
|
|
@@ -29,9 +29,6 @@
|
|
|
29
29
|
"./types": {
|
|
30
30
|
"import": "./dist/types/index.js",
|
|
31
31
|
"types": "./dist/types/index.d.ts"
|
|
32
|
-
},
|
|
33
|
-
"./styles": {
|
|
34
|
-
"import": "./dist/styles/tailwind.css"
|
|
35
32
|
}
|
|
36
33
|
},
|
|
37
34
|
"files": [
|
|
@@ -39,7 +36,8 @@
|
|
|
39
36
|
],
|
|
40
37
|
"scripts": {
|
|
41
38
|
"clean": "rm -rf dist",
|
|
42
|
-
"build": "
|
|
39
|
+
"build:js": "tsup",
|
|
40
|
+
"build": "npm run clean && npm run build:js"
|
|
43
41
|
},
|
|
44
42
|
"peerDependencies": {
|
|
45
43
|
"react": ">=18",
|
|
@@ -56,5 +54,9 @@
|
|
|
56
54
|
"react-sortablejs": "^6.1.4",
|
|
57
55
|
"motion": "^12.18.1",
|
|
58
56
|
"tw-animate-css": "^1.3.4"
|
|
57
|
+
},
|
|
58
|
+
"devDependencies": {
|
|
59
|
+
"tsup": "^8.5.1",
|
|
60
|
+
"typescript": "^5.9.3"
|
|
59
61
|
}
|
|
60
62
|
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import type { AnchorOptions } from "../../hooks/index.js";
|
|
2
|
-
interface PropsType extends React.ComponentProps<"div"> {
|
|
3
|
-
name: string;
|
|
4
|
-
}
|
|
5
|
-
export declare const AnchorTarget: React.FC<PropsType>;
|
|
6
|
-
export declare const AnchorOffseter: React.FC<PropsType>;
|
|
7
|
-
type TriggerProps = AnchorOptions & React.ComponentProps<"div"> & {};
|
|
8
|
-
export declare const AnchorTrigger: React.FC<TriggerProps>;
|
|
9
|
-
export declare const Anchors: {
|
|
10
|
-
Trigger: import("react").FC<TriggerProps>;
|
|
11
|
-
Target: import("react").FC<PropsType>;
|
|
12
|
-
Offseter: import("react").FC<PropsType>;
|
|
13
|
-
};
|
|
14
|
-
export {};
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
// update: 2025.11.12
|
|
3
|
-
// version: 0.0.2.bate
|
|
4
|
-
// dev: wade
|
|
5
|
-
import { useAnchors } from "../../hooks/index.js";
|
|
6
|
-
import { cn } from "../../shadcns/index.js";
|
|
7
|
-
export const AnchorTarget = ({ name, ...props }) => {
|
|
8
|
-
const { registerAnchors } = useAnchors();
|
|
9
|
-
return (_jsx("div", { ...props, ...registerAnchors(name) }));
|
|
10
|
-
};
|
|
11
|
-
export const AnchorOffseter = ({ name, ...props }) => {
|
|
12
|
-
const { registerOffseters } = useAnchors();
|
|
13
|
-
return (_jsx("div", { ...props, ...registerOffseters(name) }));
|
|
14
|
-
};
|
|
15
|
-
export const AnchorTrigger = ({ children, className, ...options }) => {
|
|
16
|
-
const { scrollToAnchor } = useAnchors();
|
|
17
|
-
return (_jsx("div", { className: cn(className), onClick: () => scrollToAnchor(options), children: children }));
|
|
18
|
-
};
|
|
19
|
-
export const Anchors = {
|
|
20
|
-
Trigger: AnchorTrigger,
|
|
21
|
-
Target: AnchorTarget,
|
|
22
|
-
Offseter: AnchorOffseter
|
|
23
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./anchors";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./anchors";
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import useEmblaCarousel from "embla-carousel-react";
|
|
2
|
-
import type { UseEmblaCarouselType } from "embla-carousel-react";
|
|
3
|
-
import type { AutoplayOptionsType } from "embla-carousel-autoplay";
|
|
4
|
-
import type { AutoScrollOptionsType } from "embla-carousel-auto-scroll";
|
|
5
|
-
import type { AutoHeightOptionsType } from "embla-carousel-auto-height";
|
|
6
|
-
import type { ClassNamesOptionsType } from "embla-carousel-class-names";
|
|
7
|
-
import type { FadeOptionsType } from "embla-carousel-fade";
|
|
8
|
-
type CarouselApi = UseEmblaCarouselType[1];
|
|
9
|
-
type UseCarouselParameters = Parameters<typeof useEmblaCarousel>;
|
|
10
|
-
type CarouselOptions = UseCarouselParameters[0];
|
|
11
|
-
export interface EmblaCarouselsHooksTypes {
|
|
12
|
-
options?: CarouselOptions;
|
|
13
|
-
autoplay?: AutoplayOptionsType | true;
|
|
14
|
-
autoScroll?: AutoScrollOptionsType | true;
|
|
15
|
-
classNames?: ClassNamesOptionsType | true;
|
|
16
|
-
autoHeight?: AutoHeightOptionsType | true;
|
|
17
|
-
fade?: FadeOptionsType | true;
|
|
18
|
-
wheel?: {
|
|
19
|
-
wheelDraggingClass?: string;
|
|
20
|
-
forceWheelAxis?: "x" | "y";
|
|
21
|
-
target?: Element;
|
|
22
|
-
} | true;
|
|
23
|
-
setApi?: (api: CarouselApi) => void;
|
|
24
|
-
}
|
|
25
|
-
export declare function emblaCarouselsHooks({ options, autoplay, autoScroll, classNames, autoHeight, fade, wheel, setApi, }: EmblaCarouselsHooksTypes): {
|
|
26
|
-
emblaRef: (node: HTMLElement | null) => void;
|
|
27
|
-
emblaApi: CarouselApi;
|
|
28
|
-
orientation: "x" | "y";
|
|
29
|
-
currentIndex: number;
|
|
30
|
-
isScrollPrev: boolean;
|
|
31
|
-
isScrollNext: boolean;
|
|
32
|
-
scrollPrev: () => void;
|
|
33
|
-
scrollNext: () => void;
|
|
34
|
-
onKeyDownCapture: (event: React.KeyboardEvent<HTMLDivElement>) => void;
|
|
35
|
-
};
|
|
36
|
-
export {};
|
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
// update: 2025.11.20
|
|
2
|
-
// version: 0.0.1.bate
|
|
3
|
-
// dev: wade
|
|
4
|
-
import { useCallback, useEffect, useEffectEvent, useMemo, useState } from "react";
|
|
5
|
-
import useEmblaCarousel from "embla-carousel-react";
|
|
6
|
-
import { WheelGesturesPlugin } from "embla-carousel-wheel-gestures";
|
|
7
|
-
import Autoplay from "embla-carousel-autoplay";
|
|
8
|
-
import AutoScroll from "embla-carousel-auto-scroll";
|
|
9
|
-
import AutoHeight from "embla-carousel-auto-height";
|
|
10
|
-
import ClassNames from "embla-carousel-class-names";
|
|
11
|
-
import Fade from "embla-carousel-fade";
|
|
12
|
-
export function emblaCarouselsHooks({ options, autoplay, autoScroll, classNames, autoHeight, fade, wheel, setApi, }) {
|
|
13
|
-
const orientation = options?.axis ?? "x";
|
|
14
|
-
const plugins = useMemo(() => ([
|
|
15
|
-
autoplay && Autoplay(typeof autoplay == "boolean" ? undefined : autoplay),
|
|
16
|
-
autoScroll && AutoScroll(typeof autoScroll == "boolean" ? undefined : autoScroll),
|
|
17
|
-
autoHeight && AutoHeight(typeof autoHeight == "boolean" ? undefined : autoHeight),
|
|
18
|
-
classNames && ClassNames(typeof classNames == "boolean" ? undefined : classNames),
|
|
19
|
-
fade && Fade(typeof fade == "boolean" ? undefined : fade),
|
|
20
|
-
wheel && WheelGesturesPlugin(typeof wheel == "boolean" ? undefined : wheel),
|
|
21
|
-
].filter(plugin => plugin)), [
|
|
22
|
-
autoplay,
|
|
23
|
-
autoScroll,
|
|
24
|
-
classNames,
|
|
25
|
-
fade,
|
|
26
|
-
wheel,
|
|
27
|
-
autoHeight
|
|
28
|
-
]);
|
|
29
|
-
const [emblaRef, emblaApi] = useEmblaCarousel(options, plugins);
|
|
30
|
-
const [currentIndex, setCurrentIndex] = useState(0);
|
|
31
|
-
const [isScrollPrev, setIsScrollPrev] = useState(false);
|
|
32
|
-
const [isScrollNext, setIsScrollNext] = useState(false);
|
|
33
|
-
const scrollPrev = useCallback(() => {
|
|
34
|
-
emblaApi?.scrollPrev();
|
|
35
|
-
}, [emblaApi]);
|
|
36
|
-
const scrollNext = useCallback(() => {
|
|
37
|
-
emblaApi?.scrollNext();
|
|
38
|
-
}, [emblaApi]);
|
|
39
|
-
const onKeyDownCapture = useCallback((event) => {
|
|
40
|
-
console.log("key...");
|
|
41
|
-
if (event.key === "ArrowLeft") {
|
|
42
|
-
event.preventDefault();
|
|
43
|
-
scrollPrev();
|
|
44
|
-
}
|
|
45
|
-
else if (event.key === "ArrowRight") {
|
|
46
|
-
event.preventDefault();
|
|
47
|
-
scrollNext();
|
|
48
|
-
}
|
|
49
|
-
}, [scrollPrev, scrollNext]);
|
|
50
|
-
const onSelect = useCallback((api) => {
|
|
51
|
-
if (!api)
|
|
52
|
-
return;
|
|
53
|
-
setCurrentIndex(api?.selectedScrollSnap());
|
|
54
|
-
setIsScrollPrev(api.canScrollPrev());
|
|
55
|
-
setIsScrollNext(api.canScrollNext());
|
|
56
|
-
}, []);
|
|
57
|
-
const initalEffect = useEffectEvent(() => {
|
|
58
|
-
if (!emblaApi || !setApi)
|
|
59
|
-
return;
|
|
60
|
-
setApi?.(emblaApi);
|
|
61
|
-
onSelect(emblaApi);
|
|
62
|
-
emblaApi.on("reInit", onSelect);
|
|
63
|
-
emblaApi.on("select", onSelect);
|
|
64
|
-
return () => {
|
|
65
|
-
emblaApi?.off("select", onSelect);
|
|
66
|
-
};
|
|
67
|
-
});
|
|
68
|
-
useEffect(() => {
|
|
69
|
-
const events = initalEffect();
|
|
70
|
-
return () => { events?.(); };
|
|
71
|
-
}, [emblaApi]);
|
|
72
|
-
return {
|
|
73
|
-
emblaRef,
|
|
74
|
-
emblaApi,
|
|
75
|
-
orientation,
|
|
76
|
-
currentIndex,
|
|
77
|
-
isScrollPrev,
|
|
78
|
-
isScrollNext,
|
|
79
|
-
scrollPrev,
|
|
80
|
-
scrollNext,
|
|
81
|
-
onKeyDownCapture
|
|
82
|
-
};
|
|
83
|
-
}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import useEmblaCarousel from "embla-carousel-react";
|
|
2
|
-
import type { EmblaCarouselsHooksTypes } from "./embla-carousels-hooks";
|
|
3
|
-
export type CarouselsContextProps = {
|
|
4
|
-
emblaRef: ReturnType<typeof useEmblaCarousel>[0];
|
|
5
|
-
emblaApi: ReturnType<typeof useEmblaCarousel>[1];
|
|
6
|
-
currentIndex?: number;
|
|
7
|
-
orientation: "x" | "y";
|
|
8
|
-
isScrollPrev: boolean;
|
|
9
|
-
isScrollNext: boolean;
|
|
10
|
-
scrollPrev: () => void;
|
|
11
|
-
scrollNext: () => void;
|
|
12
|
-
};
|
|
13
|
-
export declare const useCarouselsContext: () => CarouselsContextProps;
|
|
14
|
-
export interface PropsTypes extends EmblaCarouselsHooksTypes, React.ComponentProps<"div"> {
|
|
15
|
-
}
|
|
16
|
-
export declare const EmblaCarouselsRoots: React.FC<PropsTypes>;
|
|
17
|
-
export declare const EmblaCarouselsContents: React.FC<React.ComponentProps<"div">>;
|
|
18
|
-
export declare const EmblaCarouselsSlides: React.FC<React.ComponentProps<"div">>;
|
|
19
|
-
export declare const EmblaCarousels: {
|
|
20
|
-
Roots: import("react").FC<PropsTypes>;
|
|
21
|
-
Contents: import("react").FC<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>>;
|
|
22
|
-
Slides: import("react").FC<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>>;
|
|
23
|
-
};
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
// update: 2025.11.20
|
|
3
|
-
// version: 0.0.1.bate
|
|
4
|
-
// dev: wade
|
|
5
|
-
import { createContext, memo, use, useMemo } from "react";
|
|
6
|
-
import { emblaCarouselsHooks, } from "./embla-carousels-hooks";
|
|
7
|
-
import { cn } from "../../shadcns/index.js";
|
|
8
|
-
const CarouselsContext = createContext(null);
|
|
9
|
-
export const useCarouselsContext = () => {
|
|
10
|
-
const context = use(CarouselsContext);
|
|
11
|
-
if (!context)
|
|
12
|
-
throw new Error("useCarousel must be used within a <Carousel />");
|
|
13
|
-
return context;
|
|
14
|
-
};
|
|
15
|
-
export const EmblaCarouselsRoots = memo(({ children, className, setApi, options, autoplay, autoScroll, classNames, autoHeight, fade, wheel, ...props }) => {
|
|
16
|
-
const { emblaRef, emblaApi, orientation, currentIndex, isScrollPrev, isScrollNext, scrollPrev, scrollNext, onKeyDownCapture, } = emblaCarouselsHooks({
|
|
17
|
-
setApi,
|
|
18
|
-
options,
|
|
19
|
-
autoplay,
|
|
20
|
-
autoScroll,
|
|
21
|
-
classNames,
|
|
22
|
-
autoHeight,
|
|
23
|
-
fade,
|
|
24
|
-
wheel,
|
|
25
|
-
});
|
|
26
|
-
const contextValue = useMemo(() => ({
|
|
27
|
-
emblaRef,
|
|
28
|
-
emblaApi,
|
|
29
|
-
orientation,
|
|
30
|
-
currentIndex,
|
|
31
|
-
isScrollPrev,
|
|
32
|
-
isScrollNext,
|
|
33
|
-
scrollPrev,
|
|
34
|
-
scrollNext,
|
|
35
|
-
}), [
|
|
36
|
-
emblaRef,
|
|
37
|
-
emblaApi,
|
|
38
|
-
orientation,
|
|
39
|
-
currentIndex,
|
|
40
|
-
isScrollPrev,
|
|
41
|
-
isScrollNext,
|
|
42
|
-
scrollPrev,
|
|
43
|
-
scrollNext,
|
|
44
|
-
]);
|
|
45
|
-
return (_jsx(CarouselsContext, { value: contextValue, children: _jsx("div", { "data-component": "embla-carousels", onKeyDownCapture: onKeyDownCapture, className: cn("relative overflow-hidden", className), "aria-roledescription": "embla-carousels", role: "region", ...props, children: children }) }));
|
|
46
|
-
});
|
|
47
|
-
export const EmblaCarouselsContents = memo(({ className, ...props }) => {
|
|
48
|
-
const { emblaRef, orientation } = useCarouselsContext();
|
|
49
|
-
return (_jsx("div", { ref: emblaRef, className: "overflow-hidden", "data-component": "embla-carousels-contents", children: _jsx("div", { className: cn("flex", orientation === "x" ? "flex-row" : "flex-col", className), ...props }) }));
|
|
50
|
-
});
|
|
51
|
-
export const EmblaCarouselsSlides = memo(({ className, ...props }) => {
|
|
52
|
-
return (_jsx("div", { role: "group", "aria-roledescription": "slide", "data-component": "embla-carousels-slides", className: cn("min-w-0 shrink-0 grow-0 basis-full", className), ...props }));
|
|
53
|
-
});
|
|
54
|
-
export const EmblaCarousels = {
|
|
55
|
-
Roots: EmblaCarouselsRoots,
|
|
56
|
-
Contents: EmblaCarouselsContents,
|
|
57
|
-
Slides: EmblaCarouselsSlides,
|
|
58
|
-
};
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { cn } from "../../shadcns/index.js";
|
|
3
|
-
import { useCarouselContext } from "./embla-context";
|
|
4
|
-
const EmblaContainer = ({ slide: SlideComponent, className, children, style, ...props }) => {
|
|
5
|
-
const { datas, emblaApi } = useCarouselContext();
|
|
6
|
-
const cantSlide = !emblaApi?.canScrollNext() && !emblaApi?.canScrollPrev();
|
|
7
|
-
return (_jsxs("div", { "data-component": "embla-container", className: cn("flex", className, cantSlide && [
|
|
8
|
-
"transform-[unset!important]"
|
|
9
|
-
]), style: { ...style }, children: [SlideComponent && datas?.map((item, index) => (_jsx(SlideComponent, { ...item, index: index, ...props }, item?.multipurpose?.key ?? item?.id ?? index))), children] }));
|
|
10
|
-
};
|
|
11
|
-
EmblaContainer.displayName = "EmblaContainer";
|
|
12
|
-
export default EmblaContainer;
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import type { EmblaViewportRefType } from "embla-carousel-react";
|
|
2
|
-
import type { EmblaCarouselType } from 'embla-carousel';
|
|
3
|
-
interface CarouselContextTypes {
|
|
4
|
-
datas: [];
|
|
5
|
-
emblaRef?: EmblaViewportRefType;
|
|
6
|
-
emblaApi?: EmblaCarouselType | null;
|
|
7
|
-
selectIndex: number;
|
|
8
|
-
scrollSnaps: number[];
|
|
9
|
-
nextScroll: () => void;
|
|
10
|
-
prevScroll: () => void;
|
|
11
|
-
scrollToIndex: (index: number) => void;
|
|
12
|
-
autoPlayReset: () => void;
|
|
13
|
-
autoPlayStop: () => void;
|
|
14
|
-
autoPlayPlay: () => void;
|
|
15
|
-
}
|
|
16
|
-
export declare const CarouselContextProvider: (props: {
|
|
17
|
-
children: React.ReactNode;
|
|
18
|
-
value: CarouselContextTypes;
|
|
19
|
-
}) => import("react/jsx-runtime").JSX.Element;
|
|
20
|
-
export declare const useCarouselContext: () => CarouselContextTypes;
|
|
21
|
-
export {};
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { createContext, use } from "react";
|
|
3
|
-
const CarouselContext = createContext(null);
|
|
4
|
-
export const CarouselContextProvider = (props) => {
|
|
5
|
-
return _jsx(CarouselContext, { ...props });
|
|
6
|
-
};
|
|
7
|
-
export const useCarouselContext = () => {
|
|
8
|
-
const context = use(CarouselContext);
|
|
9
|
-
if (!context)
|
|
10
|
-
throw new Error("useCMSData must be used inside CMSProvider");
|
|
11
|
-
return context;
|
|
12
|
-
};
|