@xwadex/fesd-next 0.3.4-7.2 → 0.3.4-7.21
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/anchors/anchors.d.ts +14 -0
- package/dist/components/anchors/anchors.js +24 -0
- package/dist/components/anchors/index.d.ts +1 -0
- package/dist/components/anchors/index.js +1 -0
- package/dist/components/embla-carousels/embla-carousels-hooks.d.ts +36 -0
- package/dist/components/embla-carousels/embla-carousels-hooks.js +84 -0
- package/dist/components/embla-carousels/embla-carousels.d.ts +23 -0
- package/dist/components/embla-carousels/embla-carousels.js +59 -0
- package/dist/components/embla-carousels/index.d.ts +2 -0
- package/dist/components/embla-carousels/index.js +2 -0
- package/dist/components/index.d.ts +5 -2
- package/dist/components/index.js +5 -2
- package/dist/components/puck-contents/-heading-block.d.ts +13 -0
- package/dist/components/puck-contents/-heading-block.js +77 -0
- package/dist/components/puck-contents/-media-content.d.ts +7 -0
- package/dist/components/puck-contents/-media-content.js +22 -0
- package/dist/components/puck-contents/-text-content.d.ts +13 -0
- package/dist/components/puck-contents/-text-content.js +148 -0
- package/dist/components/puck-contents/index.d.ts +2 -0
- package/dist/components/puck-contents/index.js +2 -0
- package/dist/components/puck-contents/puck-configs.d.ts +14 -0
- package/dist/components/puck-contents/puck-configs.js +65 -0
- package/dist/components/puck-contents/puck-contents-editor.d.ts +5 -0
- package/dist/components/puck-contents/puck-contents-editor.js +27 -0
- package/dist/components/puck-contents/puck-contents-rander.d.ts +5 -0
- package/dist/components/puck-contents/puck-contents-rander.js +14 -0
- package/dist/components/puck-contents/puck-inital-datas.d.ts +46 -0
- package/dist/components/puck-contents/puck-inital-datas.js +92 -0
- package/dist/components/scroll-containers/index.d.ts +3 -0
- package/dist/components/scroll-containers/index.js +3 -0
- package/dist/components/scroll-containers/lenis-scroll.d.ts +20 -0
- package/dist/components/scroll-containers/lenis-scroll.js +66 -0
- package/dist/components/scroll-containers/native-scroll.d.ts +6 -0
- package/dist/components/scroll-containers/native-scroll.js +24 -0
- package/dist/components/scroll-containers/scroll-containers.d.ts +25 -0
- package/dist/components/scroll-containers/scroll-containers.js +47 -0
- package/dist/components/tests/index.d.ts +1 -0
- package/dist/components/tests/index.js +1 -0
- package/dist/components/tests/tests.d.ts +4 -0
- package/dist/components/tests/tests.js +10 -0
- package/dist/hooks/index.d.ts +1 -0
- package/dist/hooks/index.js +1 -0
- package/dist/hooks/useAnchors.d.ts +48 -33
- package/dist/hooks/useAnchors.js +181 -98
- package/dist/hooks/useHash.d.ts +1 -0
- package/dist/hooks/useHash.js +19 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/shadcns/components/ui/accordion.d.ts +7 -0
- package/dist/shadcns/components/ui/accordion.js +18 -0
- package/dist/shadcns/components/ui/alert-dialog.d.ts +14 -0
- package/dist/shadcns/components/ui/alert-dialog.js +38 -0
- package/dist/shadcns/components/ui/alert.d.ts +9 -0
- package/dist/shadcns/components/ui/alert.js +25 -0
- package/dist/shadcns/components/ui/aspect-ratio.d.ts +3 -0
- package/dist/shadcns/components/ui/aspect-ratio.js +7 -0
- package/dist/shadcns/components/ui/avatar.d.ts +6 -0
- package/dist/shadcns/components/ui/avatar.js +14 -0
- package/dist/shadcns/components/ui/badge.d.ts +9 -0
- package/dist/shadcns/components/ui/badge.js +23 -0
- package/dist/shadcns/components/ui/breadcrumb.d.ts +11 -0
- package/dist/shadcns/components/ui/breadcrumb.js +27 -0
- package/dist/shadcns/components/ui/button-group.d.ts +11 -0
- package/dist/shadcns/components/ui/button-group.js +26 -0
- package/dist/shadcns/components/ui/button.d.ts +10 -0
- package/dist/shadcns/components/ui/button.js +32 -0
- package/dist/shadcns/components/ui/calendar.d.ts +8 -0
- package/dist/shadcns/components/ui/calendar.js +73 -0
- package/dist/shadcns/components/ui/card.d.ts +9 -0
- package/dist/shadcns/components/ui/card.js +25 -0
- package/dist/shadcns/components/ui/carousel.d.ts +19 -0
- package/dist/shadcns/components/ui/carousel.js +91 -0
- package/dist/shadcns/components/ui/chart.d.ts +40 -0
- package/dist/shadcns/components/ui/chart.js +114 -0
- package/dist/shadcns/components/ui/checkbox.d.ts +4 -0
- package/dist/shadcns/components/ui/checkbox.js +9 -0
- package/dist/shadcns/components/ui/collapsible.d.ts +5 -0
- package/dist/shadcns/components/ui/collapsible.js +13 -0
- package/dist/shadcns/components/ui/command.d.ts +18 -0
- package/dist/shadcns/components/ui/command.js +33 -0
- package/dist/shadcns/components/ui/context-menu.d.ts +25 -0
- package/dist/shadcns/components/ui/context-menu.js +51 -0
- package/dist/shadcns/components/ui/dialog.d.ts +15 -0
- package/dist/shadcns/components/ui/dialog.js +36 -0
- package/dist/shadcns/components/ui/drawer.d.ts +13 -0
- package/dist/shadcns/components/ui/drawer.js +35 -0
- package/dist/shadcns/components/ui/dropdown-menu.d.ts +25 -0
- package/dist/shadcns/components/ui/dropdown-menu.js +51 -0
- package/dist/shadcns/components/ui/field.d.ts +24 -0
- package/dist/shadcns/components/ui/field.js +76 -0
- package/dist/shadcns/components/ui/form.d.ts +24 -0
- package/dist/shadcns/components/ui/form.js +56 -0
- package/dist/shadcns/components/ui/hover-card.d.ts +6 -0
- package/dist/shadcns/components/ui/hover-card.js +14 -0
- package/dist/shadcns/components/ui/input-otp.d.ts +11 -0
- package/dist/shadcns/components/ui/input-otp.js +21 -0
- package/dist/shadcns/components/ui/input.d.ts +3 -0
- package/dist/shadcns/components/ui/input.js +6 -0
- package/dist/shadcns/components/ui/item.d.ts +23 -0
- package/dist/shadcns/components/ui/item.js +65 -0
- package/dist/shadcns/components/ui/label.d.ts +4 -0
- package/dist/shadcns/components/ui/label.js +8 -0
- package/dist/shadcns/components/ui/menubar.d.ts +26 -0
- package/dist/shadcns/components/ui/menubar.js +54 -0
- package/dist/shadcns/components/ui/native-select.d.ts +7 -0
- package/dist/shadcns/components/ui/native-select.js +13 -0
- package/dist/shadcns/components/ui/navigation-menu.d.ts +14 -0
- package/dist/shadcns/components/ui/navigation-menu.js +32 -0
- package/dist/shadcns/components/ui/pagination.d.ts +13 -0
- package/dist/shadcns/components/ui/pagination.js +28 -0
- package/dist/shadcns/components/ui/popover.d.ts +7 -0
- package/dist/shadcns/components/ui/popover.js +17 -0
- package/dist/shadcns/components/ui/progress.d.ts +4 -0
- package/dist/shadcns/components/ui/progress.js +8 -0
- package/dist/shadcns/components/ui/radio-group.d.ts +5 -0
- package/dist/shadcns/components/ui/radio-group.js +12 -0
- package/dist/shadcns/components/ui/resizable.d.ts +8 -0
- package/dist/shadcns/components/ui/resizable.js +15 -0
- package/dist/shadcns/components/ui/scroll-area.d.ts +5 -0
- package/dist/shadcns/components/ui/scroll-area.js +11 -0
- package/dist/shadcns/components/ui/select.d.ts +15 -0
- package/dist/shadcns/components/ui/select.js +38 -0
- package/dist/shadcns/components/ui/separator.d.ts +4 -0
- package/dist/shadcns/components/ui/separator.js +8 -0
- package/dist/shadcns/components/ui/sheet.d.ts +13 -0
- package/dist/shadcns/components/ui/sheet.js +40 -0
- package/dist/shadcns/components/ui/sidebar.d.ts +66 -0
- package/dist/shadcns/components/ui/sidebar.js +204 -0
- package/dist/shadcns/components/ui/skeleton.d.ts +2 -0
- package/dist/shadcns/components/ui/skeleton.js +6 -0
- package/dist/shadcns/components/ui/slider.d.ts +4 -0
- package/dist/shadcns/components/ui/slider.js +10 -0
- package/dist/shadcns/components/ui/sonner.d.ts +3 -0
- package/dist/shadcns/components/ui/sonner.js +13 -0
- package/dist/shadcns/components/ui/switch.d.ts +4 -0
- package/dist/shadcns/components/ui/switch.js +8 -0
- package/dist/shadcns/components/ui/table.d.ts +10 -0
- package/dist/shadcns/components/ui/table.js +28 -0
- package/dist/shadcns/components/ui/tabs.d.ts +7 -0
- package/dist/shadcns/components/ui/tabs.js +17 -0
- package/dist/shadcns/components/ui/textarea.d.ts +3 -0
- package/dist/shadcns/components/ui/textarea.js +7 -0
- package/dist/shadcns/components/ui/toggle-group.d.ts +7 -0
- package/dist/shadcns/components/ui/toggle-group.js +20 -0
- package/dist/shadcns/components/ui/toggle.d.ts +9 -0
- package/dist/shadcns/components/ui/toggle.js +26 -0
- package/dist/shadcns/components/ui/tooltip.d.ts +7 -0
- package/dist/shadcns/components/ui/tooltip.js +17 -0
- package/dist/{hooks/useIsMobile.js → shadcns/hooks/use-mobile.js} +5 -6
- package/dist/shadcns/index.d.ts +48 -0
- package/dist/shadcns/index.js +48 -0
- package/dist/shadcns/lib/utils.d.ts +2 -0
- package/dist/shadcns/lib/utils.js +5 -0
- package/dist/types/shadcns.type.d.ts +0 -1
- package/dist/types/shadcns.type.js +1 -0
- package/dist/utils/index.d.ts +0 -2
- package/dist/utils/index.js +0 -5
- package/package.json +6 -2
- package/dist/components/TestComponent.d.ts +0 -4
- package/dist/components/TestComponent.js +0 -10
- /package/dist/{hooks/useIsMobile.d.ts → shadcns/hooks/use-mobile.d.ts} +0 -0
|
@@ -0,0 +1,14 @@
|
|
|
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 {};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
// update: 2025.11.12
|
|
4
|
+
// version: 0.0.2.bate
|
|
5
|
+
// dev: wade
|
|
6
|
+
import { useAnchors } from "../../hooks/index.js";
|
|
7
|
+
import { cn } from "../../shadcns/index.js";
|
|
8
|
+
export const AnchorTarget = ({ name, ...props }) => {
|
|
9
|
+
const { registerAnchors } = useAnchors();
|
|
10
|
+
return (_jsx("div", { ...props, ...registerAnchors(name) }));
|
|
11
|
+
};
|
|
12
|
+
export const AnchorOffseter = ({ name, ...props }) => {
|
|
13
|
+
const { registerOffseters } = useAnchors();
|
|
14
|
+
return (_jsx("div", { ...props, ...registerOffseters(name) }));
|
|
15
|
+
};
|
|
16
|
+
export const AnchorTrigger = ({ children, className, ...options }) => {
|
|
17
|
+
const { scrollToAnchor } = useAnchors();
|
|
18
|
+
return (_jsx("div", { className: cn(className), onClick: () => scrollToAnchor(options), children: children }));
|
|
19
|
+
};
|
|
20
|
+
export const Anchors = {
|
|
21
|
+
Trigger: AnchorTrigger,
|
|
22
|
+
Target: AnchorTarget,
|
|
23
|
+
Offseter: AnchorOffseter
|
|
24
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./anchors";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./anchors";
|
|
@@ -0,0 +1,36 @@
|
|
|
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 {};
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
// update: 2025.11.20
|
|
3
|
+
// version: 0.0.1.bate
|
|
4
|
+
// dev: wade
|
|
5
|
+
import { useCallback, useEffect, useEffectEvent, useMemo, useState } from "react";
|
|
6
|
+
import useEmblaCarousel from "embla-carousel-react";
|
|
7
|
+
import { WheelGesturesPlugin } from "embla-carousel-wheel-gestures";
|
|
8
|
+
import Autoplay from "embla-carousel-autoplay";
|
|
9
|
+
import AutoScroll from "embla-carousel-auto-scroll";
|
|
10
|
+
import AutoHeight from "embla-carousel-auto-height";
|
|
11
|
+
import ClassNames from "embla-carousel-class-names";
|
|
12
|
+
import Fade from "embla-carousel-fade";
|
|
13
|
+
export function emblaCarouselsHooks({ options, autoplay, autoScroll, classNames, autoHeight, fade, wheel, setApi, }) {
|
|
14
|
+
const orientation = options?.axis ?? "x";
|
|
15
|
+
const plugins = useMemo(() => ([
|
|
16
|
+
autoplay && Autoplay(typeof autoplay == "boolean" ? undefined : autoplay),
|
|
17
|
+
autoScroll && AutoScroll(typeof autoScroll == "boolean" ? undefined : autoScroll),
|
|
18
|
+
autoHeight && AutoHeight(typeof autoHeight == "boolean" ? undefined : autoHeight),
|
|
19
|
+
classNames && ClassNames(typeof classNames == "boolean" ? undefined : classNames),
|
|
20
|
+
fade && Fade(typeof fade == "boolean" ? undefined : fade),
|
|
21
|
+
wheel && WheelGesturesPlugin(typeof wheel == "boolean" ? undefined : wheel),
|
|
22
|
+
].filter(plugin => plugin)), [
|
|
23
|
+
autoplay,
|
|
24
|
+
autoScroll,
|
|
25
|
+
classNames,
|
|
26
|
+
fade,
|
|
27
|
+
wheel,
|
|
28
|
+
autoHeight
|
|
29
|
+
]);
|
|
30
|
+
const [emblaRef, emblaApi] = useEmblaCarousel(options, plugins);
|
|
31
|
+
const [currentIndex, setCurrentIndex] = useState(0);
|
|
32
|
+
const [isScrollPrev, setIsScrollPrev] = useState(false);
|
|
33
|
+
const [isScrollNext, setIsScrollNext] = useState(false);
|
|
34
|
+
const scrollPrev = useCallback(() => {
|
|
35
|
+
emblaApi?.scrollPrev();
|
|
36
|
+
}, [emblaApi]);
|
|
37
|
+
const scrollNext = useCallback(() => {
|
|
38
|
+
emblaApi?.scrollNext();
|
|
39
|
+
}, [emblaApi]);
|
|
40
|
+
const onKeyDownCapture = useCallback((event) => {
|
|
41
|
+
console.log("key...");
|
|
42
|
+
if (event.key === "ArrowLeft") {
|
|
43
|
+
event.preventDefault();
|
|
44
|
+
scrollPrev();
|
|
45
|
+
}
|
|
46
|
+
else if (event.key === "ArrowRight") {
|
|
47
|
+
event.preventDefault();
|
|
48
|
+
scrollNext();
|
|
49
|
+
}
|
|
50
|
+
}, [scrollPrev, scrollNext]);
|
|
51
|
+
const onSelect = useCallback((api) => {
|
|
52
|
+
if (!api)
|
|
53
|
+
return;
|
|
54
|
+
setCurrentIndex(api?.selectedScrollSnap());
|
|
55
|
+
setIsScrollPrev(api.canScrollPrev());
|
|
56
|
+
setIsScrollNext(api.canScrollNext());
|
|
57
|
+
}, []);
|
|
58
|
+
const initalEffect = useEffectEvent(() => {
|
|
59
|
+
if (!emblaApi || !setApi)
|
|
60
|
+
return;
|
|
61
|
+
setApi?.(emblaApi);
|
|
62
|
+
onSelect(emblaApi);
|
|
63
|
+
emblaApi.on("reInit", onSelect);
|
|
64
|
+
emblaApi.on("select", onSelect);
|
|
65
|
+
return () => {
|
|
66
|
+
emblaApi?.off("select", onSelect);
|
|
67
|
+
};
|
|
68
|
+
});
|
|
69
|
+
useEffect(() => {
|
|
70
|
+
const events = initalEffect();
|
|
71
|
+
return () => { events?.(); };
|
|
72
|
+
}, [emblaApi]);
|
|
73
|
+
return {
|
|
74
|
+
emblaRef,
|
|
75
|
+
emblaApi,
|
|
76
|
+
orientation,
|
|
77
|
+
currentIndex,
|
|
78
|
+
isScrollPrev,
|
|
79
|
+
isScrollNext,
|
|
80
|
+
scrollPrev,
|
|
81
|
+
scrollNext,
|
|
82
|
+
onKeyDownCapture
|
|
83
|
+
};
|
|
84
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
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
|
+
};
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
// update: 2025.11.20
|
|
4
|
+
// version: 0.0.1.bate
|
|
5
|
+
// dev: wade
|
|
6
|
+
import { createContext, memo, use, useMemo } from "react";
|
|
7
|
+
import { emblaCarouselsHooks, } from "./embla-carousels-hooks";
|
|
8
|
+
import { cn } from "../../shadcns/index.js";
|
|
9
|
+
const CarouselsContext = createContext(null);
|
|
10
|
+
export const useCarouselsContext = () => {
|
|
11
|
+
const context = use(CarouselsContext);
|
|
12
|
+
if (!context)
|
|
13
|
+
throw new Error("useCarousel must be used within a <Carousel />");
|
|
14
|
+
return context;
|
|
15
|
+
};
|
|
16
|
+
export const EmblaCarouselsRoots = memo(({ children, className, setApi, options, autoplay, autoScroll, classNames, autoHeight, fade, wheel, ...props }) => {
|
|
17
|
+
const { emblaRef, emblaApi, orientation, currentIndex, isScrollPrev, isScrollNext, scrollPrev, scrollNext, onKeyDownCapture, } = emblaCarouselsHooks({
|
|
18
|
+
setApi,
|
|
19
|
+
options,
|
|
20
|
+
autoplay,
|
|
21
|
+
autoScroll,
|
|
22
|
+
classNames,
|
|
23
|
+
autoHeight,
|
|
24
|
+
fade,
|
|
25
|
+
wheel,
|
|
26
|
+
});
|
|
27
|
+
const contextValue = useMemo(() => ({
|
|
28
|
+
emblaRef,
|
|
29
|
+
emblaApi,
|
|
30
|
+
orientation,
|
|
31
|
+
currentIndex,
|
|
32
|
+
isScrollPrev,
|
|
33
|
+
isScrollNext,
|
|
34
|
+
scrollPrev,
|
|
35
|
+
scrollNext,
|
|
36
|
+
}), [
|
|
37
|
+
emblaRef,
|
|
38
|
+
emblaApi,
|
|
39
|
+
orientation,
|
|
40
|
+
currentIndex,
|
|
41
|
+
isScrollPrev,
|
|
42
|
+
isScrollNext,
|
|
43
|
+
scrollPrev,
|
|
44
|
+
scrollNext,
|
|
45
|
+
]);
|
|
46
|
+
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 }) }));
|
|
47
|
+
});
|
|
48
|
+
export const EmblaCarouselsContents = memo(({ className, ...props }) => {
|
|
49
|
+
const { emblaRef, orientation } = useCarouselsContext();
|
|
50
|
+
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 }) }));
|
|
51
|
+
});
|
|
52
|
+
export const EmblaCarouselsSlides = memo(({ className, ...props }) => {
|
|
53
|
+
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 }));
|
|
54
|
+
});
|
|
55
|
+
export const EmblaCarousels = {
|
|
56
|
+
Roots: EmblaCarouselsRoots,
|
|
57
|
+
Contents: EmblaCarouselsContents,
|
|
58
|
+
Slides: EmblaCarouselsSlides,
|
|
59
|
+
};
|
package/dist/components/index.js
CHANGED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { ComponentConfig, PuckComponent } from "@puckeditor/core";
|
|
2
|
+
export interface Props {
|
|
3
|
+
title?: string;
|
|
4
|
+
description?: string;
|
|
5
|
+
subTitle?: string;
|
|
6
|
+
buttons?: any;
|
|
7
|
+
imgs?: string;
|
|
8
|
+
options?: any;
|
|
9
|
+
textBlock?: any;
|
|
10
|
+
mediaBlock?: any;
|
|
11
|
+
}
|
|
12
|
+
export declare const PuckBaseBlock: PuckComponent<Props>;
|
|
13
|
+
export declare const BaseBlock: ComponentConfig;
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
|
+
import { TextContent } from "./-text-content";
|
|
4
|
+
import { MediaContent } from "./-media-content";
|
|
5
|
+
import { cn } from "../../shadcns/index.js";
|
|
6
|
+
export const PuckBaseBlock = ({ title, description, subTitle, buttons, imgs, options, textBlock: TextBlock, mediaBlock: MediaBlock, ...puckProps }) => {
|
|
7
|
+
const { textAlign } = options;
|
|
8
|
+
return (_jsx("div", { className: cn("p-10 grid items-center justify-center gap-10", textAlign == "right"
|
|
9
|
+
? "grid-cols-[40%_60%]"
|
|
10
|
+
: "grid-cols-[60%_40%]"), children: textAlign == "left"
|
|
11
|
+
? _jsxs(_Fragment, { children: [_jsxs("div", { children: [" ", TextBlock ? _jsx(TextBlock, {}) : null] }), _jsxs("div", { children: [" ", MediaBlock ? _jsx(MediaBlock, {}) : null] })] })
|
|
12
|
+
: _jsxs(_Fragment, { children: [_jsxs("div", { children: [" ", MediaBlock ? _jsx(MediaBlock, {}) : null] }), _jsxs("div", { children: [" ", TextBlock ? _jsx(TextBlock, {}) : null] })] }) }));
|
|
13
|
+
};
|
|
14
|
+
export const BaseBlock = {
|
|
15
|
+
label: "Base Block",
|
|
16
|
+
fields: {
|
|
17
|
+
textBlock: { type: "slot", allow: ["TextContent"] },
|
|
18
|
+
mediaBlock: { type: "slot", allow: ["MediaContent"] },
|
|
19
|
+
options: {
|
|
20
|
+
label: "Contetn Options",
|
|
21
|
+
type: "object",
|
|
22
|
+
objectFields: {
|
|
23
|
+
textAlign: {
|
|
24
|
+
label: "Content Position",
|
|
25
|
+
type: "radio",
|
|
26
|
+
options: [
|
|
27
|
+
{ label: "Left", value: "left" },
|
|
28
|
+
{ label: "Right", value: "right" },
|
|
29
|
+
],
|
|
30
|
+
},
|
|
31
|
+
textAlign2: {
|
|
32
|
+
label: "Content Vertical",
|
|
33
|
+
type: "radio",
|
|
34
|
+
options: [
|
|
35
|
+
{ label: "Top", value: "top" },
|
|
36
|
+
{ label: "Middle", value: "middle" },
|
|
37
|
+
{ label: "Bottom", value: "bottom" },
|
|
38
|
+
],
|
|
39
|
+
},
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
background: {
|
|
43
|
+
label: "Background Setting",
|
|
44
|
+
type: "object",
|
|
45
|
+
objectFields: {
|
|
46
|
+
isImage: {
|
|
47
|
+
label: "Use Image",
|
|
48
|
+
type: "radio",
|
|
49
|
+
options: [
|
|
50
|
+
{ label: "Yes", value: "yes" },
|
|
51
|
+
{ label: "No", value: "no" },
|
|
52
|
+
],
|
|
53
|
+
},
|
|
54
|
+
imageAddress: {
|
|
55
|
+
label: "Image Address",
|
|
56
|
+
type: "text"
|
|
57
|
+
},
|
|
58
|
+
color: {
|
|
59
|
+
label: "Color",
|
|
60
|
+
type: "text"
|
|
61
|
+
},
|
|
62
|
+
},
|
|
63
|
+
},
|
|
64
|
+
},
|
|
65
|
+
defaultProps: {
|
|
66
|
+
options: {
|
|
67
|
+
textAlign: "left",
|
|
68
|
+
textAlign2: "top"
|
|
69
|
+
},
|
|
70
|
+
background: {
|
|
71
|
+
isImage: "no"
|
|
72
|
+
},
|
|
73
|
+
textBlock: [{ type: "TextContent", props: { ...TextContent.defaultProps } }],
|
|
74
|
+
mediaBlock: [{ type: "MediaContent", props: { ...MediaContent.defaultProps } },],
|
|
75
|
+
},
|
|
76
|
+
render: PuckBaseBlock
|
|
77
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
export const PuckMediaContent = ({ alt, imgs, }) => {
|
|
4
|
+
return (_jsxs("figure", { className: "flex flex-col gap-3 items-center [&_img]:max-w-full", children: [_jsx("div", { className: "bg-gray-100 ", children: _jsx("img", { src: String(imgs) }) }), alt && _jsx("figcaption", { children: alt })] }));
|
|
5
|
+
};
|
|
6
|
+
export const MediaContent = {
|
|
7
|
+
label: "Media Content",
|
|
8
|
+
permissions: {
|
|
9
|
+
delete: false,
|
|
10
|
+
drag: false,
|
|
11
|
+
insert: false
|
|
12
|
+
},
|
|
13
|
+
fields: {
|
|
14
|
+
imgs: { type: "text" },
|
|
15
|
+
alt: { type: "text" },
|
|
16
|
+
},
|
|
17
|
+
defaultProps: {
|
|
18
|
+
imgs: "/01.png",
|
|
19
|
+
alt: "alt"
|
|
20
|
+
},
|
|
21
|
+
render: PuckMediaContent
|
|
22
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { ComponentConfig, PuckComponent } from "@puckeditor/core";
|
|
2
|
+
export interface Props {
|
|
3
|
+
title?: string;
|
|
4
|
+
description?: string;
|
|
5
|
+
subTitle?: string;
|
|
6
|
+
buttons?: any;
|
|
7
|
+
imgs?: string;
|
|
8
|
+
options?: any;
|
|
9
|
+
css?: any;
|
|
10
|
+
puck?: any;
|
|
11
|
+
}
|
|
12
|
+
export declare const PuckTextContent: PuckComponent<Props>;
|
|
13
|
+
export declare const TextContent: ComponentConfig;
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useState } from "react";
|
|
4
|
+
import { AutoField, FieldLabel } from "@puckeditor/core";
|
|
5
|
+
import { cn } from "../../shadcns/index.js";
|
|
6
|
+
export const PuckTextContent = ({ title, description, subTitle, buttons, puck, css }) => {
|
|
7
|
+
return (_jsxs("div", { "data-component": "text-content-root", className: cn("flex flex-col gap-10 justify-start items-start"), children: [_jsxs("hgroup", { "data-component": "text-content-hgroup", className: "flex flex-col gap-3", children: [_jsx("h2", { "data-component": "text-content-title", className: "text-3xl font-semibold", children: title }), _jsx("p", { "data-component": "text-content-subTitle", className: "text-base font-medium", children: subTitle })] }), _jsx("p", { "data-component": "text-content-description", className: "", children: description }), buttons && buttons?.length > 0 && _jsx("div", { "data-component": "text-content-buttonGroup", className: "flex gap-0.5", children: buttons.map((bt, index) => (_jsx("button", { "data-component": "text-content-button", className: "p-3 border rounded", children: bt.label }, index))) })] }));
|
|
8
|
+
};
|
|
9
|
+
export const TextContent = {
|
|
10
|
+
label: "TextContent",
|
|
11
|
+
permissions: {
|
|
12
|
+
delete: false,
|
|
13
|
+
drag: false,
|
|
14
|
+
insert: false
|
|
15
|
+
},
|
|
16
|
+
resolveData: async ({ props }, { changed }) => {
|
|
17
|
+
if (changed.buttons && props?.buttons?.length) {
|
|
18
|
+
const defaultButtons = props.buttons.map((button, index) => {
|
|
19
|
+
if (button?.label == "")
|
|
20
|
+
button.label = `Unnamed ${Number(index) + 1}`;
|
|
21
|
+
if (!button?.linkTarget)
|
|
22
|
+
button["linkTarget"] = "yes";
|
|
23
|
+
return button;
|
|
24
|
+
});
|
|
25
|
+
console.log("defaultButtons", defaultButtons);
|
|
26
|
+
return { ...props, buttons: defaultButtons };
|
|
27
|
+
}
|
|
28
|
+
return { props };
|
|
29
|
+
},
|
|
30
|
+
fields: {
|
|
31
|
+
title2: {
|
|
32
|
+
label: "Title2",
|
|
33
|
+
type: "custom",
|
|
34
|
+
render: ({ onChange, value }) => {
|
|
35
|
+
const [tab, setTab] = useState("A");
|
|
36
|
+
return (_jsxs(FieldLabel, { label: "Title2", readOnly: true, children: [_jsxs("div", { className: "flex gap-2", children: [_jsx("button", { onClick: () => setTab("A"), className: "flex-1 p-2 border", children: "A" }), _jsx("button", { onClick: () => setTab("B"), className: "flex-1 p-2 border", children: "B" })] }), tab == "A" && _jsx("div", { children: _jsx(AutoField, { field: { type: "text" }, onChange: onChange, value: value ?? "wade", readOnly: true }) }), tab == "B" && _jsx("div", { children: "B" })] }));
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
title: {
|
|
40
|
+
label: "Title",
|
|
41
|
+
type: "text",
|
|
42
|
+
contentEditable: true
|
|
43
|
+
},
|
|
44
|
+
subTitle: {
|
|
45
|
+
label: "Sub Title",
|
|
46
|
+
type: "text",
|
|
47
|
+
contentEditable: true
|
|
48
|
+
},
|
|
49
|
+
description: {
|
|
50
|
+
label: "Description",
|
|
51
|
+
type: "textarea",
|
|
52
|
+
contentEditable: true
|
|
53
|
+
},
|
|
54
|
+
buttons: {
|
|
55
|
+
label: "Buttons",
|
|
56
|
+
type: "array",
|
|
57
|
+
arrayFields: {
|
|
58
|
+
label: {
|
|
59
|
+
label: "Label",
|
|
60
|
+
type: "text",
|
|
61
|
+
contentEditable: true,
|
|
62
|
+
placeholder: "ex: learn more"
|
|
63
|
+
},
|
|
64
|
+
link: {
|
|
65
|
+
label: "Link",
|
|
66
|
+
type: "text",
|
|
67
|
+
placeholder: "ex: http://www.abc.com"
|
|
68
|
+
},
|
|
69
|
+
linkTarget: {
|
|
70
|
+
label: "Link Blank",
|
|
71
|
+
type: "radio",
|
|
72
|
+
options: [
|
|
73
|
+
{ label: "Yes", value: "yes" },
|
|
74
|
+
{ label: "No", value: "no" },
|
|
75
|
+
],
|
|
76
|
+
},
|
|
77
|
+
labelColor: {
|
|
78
|
+
label: "Label Color",
|
|
79
|
+
type: "text",
|
|
80
|
+
placeholder: "ex: #000000"
|
|
81
|
+
},
|
|
82
|
+
backgroundColor: {
|
|
83
|
+
label: "Background Color",
|
|
84
|
+
type: "text",
|
|
85
|
+
placeholder: "ex: #000000"
|
|
86
|
+
},
|
|
87
|
+
borderColor: {
|
|
88
|
+
label: "Border Color",
|
|
89
|
+
type: "text",
|
|
90
|
+
placeholder: "ex: #000000"
|
|
91
|
+
},
|
|
92
|
+
},
|
|
93
|
+
defaultItemProps: (index) => ({
|
|
94
|
+
label: `Unnamed ${index + 1}`,
|
|
95
|
+
}),
|
|
96
|
+
getItemSummary: (item, index) => {
|
|
97
|
+
return item?.label || `Unnamed ${Number(index) + 1}`;
|
|
98
|
+
},
|
|
99
|
+
},
|
|
100
|
+
titleOptions: {
|
|
101
|
+
label: "Title",
|
|
102
|
+
type: "object",
|
|
103
|
+
objectFields: {
|
|
104
|
+
content2: {
|
|
105
|
+
label: "Content",
|
|
106
|
+
type: "text"
|
|
107
|
+
},
|
|
108
|
+
tage2: {
|
|
109
|
+
label: "Tag",
|
|
110
|
+
type: "radio",
|
|
111
|
+
options: [
|
|
112
|
+
{ label: "H1", value: "h1" },
|
|
113
|
+
{ label: "H2", value: "h2" },
|
|
114
|
+
{ label: "H3", value: "h3" },
|
|
115
|
+
{ label: "H4", value: "h4" },
|
|
116
|
+
{ label: "H5", value: "h5" },
|
|
117
|
+
{ label: "H6", value: "h6" }
|
|
118
|
+
]
|
|
119
|
+
},
|
|
120
|
+
color2: {
|
|
121
|
+
label: "Color",
|
|
122
|
+
type: "text"
|
|
123
|
+
},
|
|
124
|
+
align2: {
|
|
125
|
+
label: "Align",
|
|
126
|
+
type: "radio",
|
|
127
|
+
options: [
|
|
128
|
+
{ label: "Left", value: "left" },
|
|
129
|
+
{ label: "Center", value: "center" },
|
|
130
|
+
{ label: "Right", value: "right" }
|
|
131
|
+
],
|
|
132
|
+
},
|
|
133
|
+
},
|
|
134
|
+
},
|
|
135
|
+
},
|
|
136
|
+
defaultProps: {
|
|
137
|
+
title: "Content that adapts to your layout",
|
|
138
|
+
subTitle: "Designed for clarity and consistency",
|
|
139
|
+
description: "This section supports flexible content placement and alignment across different screen sizes.",
|
|
140
|
+
titleOptions: {
|
|
141
|
+
content2: "Content that adapts to your layout",
|
|
142
|
+
tage2: "h3",
|
|
143
|
+
color2: "",
|
|
144
|
+
align2: "left"
|
|
145
|
+
},
|
|
146
|
+
},
|
|
147
|
+
render: PuckTextContent
|
|
148
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Config } from "@puckeditor/core";
|
|
2
|
+
type RootProps = {
|
|
3
|
+
title: string;
|
|
4
|
+
description: string;
|
|
5
|
+
};
|
|
6
|
+
export declare const renderConfig: Config<{}, RootProps>;
|
|
7
|
+
export declare const editorConfig: Config<{}, RootProps>;
|
|
8
|
+
export declare const editorConfigOverrides: {
|
|
9
|
+
iframe: ({ document, children }: any) => import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
headerActions: ({ children }: any) => import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
components: ({ children }: any) => import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
componentItem: (props: any) => import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
};
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
|
+
import { useRouter } from "next/navigation";
|
|
4
|
+
import { BaseBlock } from "./-heading-block";
|
|
5
|
+
import { MediaContent } from "./-media-content";
|
|
6
|
+
import { TextContent } from "./-text-content";
|
|
7
|
+
import { cn } from "../../shadcns/index.js";
|
|
8
|
+
export const renderConfig = {
|
|
9
|
+
components: {
|
|
10
|
+
"Base Block": BaseBlock,
|
|
11
|
+
MediaContent,
|
|
12
|
+
TextContent,
|
|
13
|
+
},
|
|
14
|
+
categories: {
|
|
15
|
+
"Base": {
|
|
16
|
+
title: "Base Block",
|
|
17
|
+
components: ["Base Block"],
|
|
18
|
+
},
|
|
19
|
+
other: {
|
|
20
|
+
visible: false,
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
};
|
|
24
|
+
export const editorConfig = {
|
|
25
|
+
...renderConfig,
|
|
26
|
+
root: {
|
|
27
|
+
label: "Page Content",
|
|
28
|
+
fields: {
|
|
29
|
+
title: { type: "text" }, // You need to redefine the `title` field if we want to retain it
|
|
30
|
+
description: { type: "textarea" },
|
|
31
|
+
},
|
|
32
|
+
defaultProps: {
|
|
33
|
+
title: "Hello, world",
|
|
34
|
+
description: "Lorem ipsum",
|
|
35
|
+
content: [],
|
|
36
|
+
},
|
|
37
|
+
render: ({ children, title, description, }) => {
|
|
38
|
+
return (_jsxs("div", { className: "h-full flex flex-col bg-white text-black!", children: [_jsxs("header", { className: "px-10 py-2 flex justify-between border-b fixed t-0 w-full z-9 bg-white", children: [_jsx("div", { className: "text-xl font-semibold flex-1", children: "BEONES" }), _jsxs("div", { className: "flex-1 flex gap-10 justify-center items-center", children: [_jsx("div", { className: "text-md font-semibold", children: "ABOTU" }), _jsx("div", { className: "text-md font-semibold", children: "PRODUCTS" }), _jsx("div", { className: "text-md font-semibold", children: "SOLUTIONS" }), _jsx("div", { className: "text-md font-semibold", children: "SUPPORT" })] }), _jsx("div", { className: cn("text-2xl font-semibold flex-1 flex justify-end items-center", "[&_span]:w-8", "[&_span]:h-0.5", "[&_span]:bg-black"), children: _jsxs("div", { className: cn("flex flex-col gap-1"), children: [_jsx("span", {}), _jsx("span", {}), _jsx("span", {})] }) })] }), _jsx("div", { className: "pt-11.5 h-full", children: children }), _jsx("footer", { className: cn("px-10 py-2"), children: description })] }));
|
|
39
|
+
},
|
|
40
|
+
},
|
|
41
|
+
};
|
|
42
|
+
export const editorConfigOverrides = {
|
|
43
|
+
iframe: ({ document, children }) => {
|
|
44
|
+
if (document) {
|
|
45
|
+
document.body.style.overflowY = "auto";
|
|
46
|
+
// document.documentElement.style.overflowY = "auto";
|
|
47
|
+
document.body.style.scrollBehavior = "none";
|
|
48
|
+
}
|
|
49
|
+
return _jsx(_Fragment, { children: children });
|
|
50
|
+
},
|
|
51
|
+
headerActions: ({ children }) => {
|
|
52
|
+
// const usePuck = createUsePuck();
|
|
53
|
+
const router = useRouter();
|
|
54
|
+
// const preview = () => {
|
|
55
|
+
// const appState = usePuck((s) => s.appState);
|
|
56
|
+
// console.log("appState", appState.data);
|
|
57
|
+
// // router.push("/puck/previews")
|
|
58
|
+
// }
|
|
59
|
+
return (_jsx("div", { className: "flex gap-2", children: children }));
|
|
60
|
+
},
|
|
61
|
+
components: ({ children }) => _jsxs("div", { children: ["eeee", children] }),
|
|
62
|
+
componentItem: (props) => {
|
|
63
|
+
return (_jsxs("div", { className: "p-3 justify-between w-full min-h-10 border bg-white hover:bg-gray-50 flex items-center cursor-grab active:cursor-grabbing text-black! border-black/10", children: [_jsx("div", { children: props.name }), _jsx("div", { children: _jsx("img", { src: "/01.png", className: "max-w-20" }) })] }));
|
|
64
|
+
},
|
|
65
|
+
};
|