@xwadex/fesd-next 0.3.4-7.21 → 0.3.4-7.23

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.
Files changed (111) hide show
  1. package/dist/components/content-builders/article4/article4cora/article4cora-roots.d.ts +4 -0
  2. package/dist/components/content-builders/article4/article4cora/article4cora-roots.js +79 -0
  3. package/dist/components/content-builders/article4/article4cora/media-base/index.d.ts +2 -0
  4. package/dist/components/content-builders/article4/article4cora/media-base/index.js +2 -0
  5. package/dist/components/content-builders/article4/article4cora/media-base/media-base-root.d.ts +15 -0
  6. package/dist/components/content-builders/article4/article4cora/media-base/media-base-root.js +52 -0
  7. package/dist/components/content-builders/article4/article4cora/media-cover/index.d.ts +2 -0
  8. package/dist/components/content-builders/article4/article4cora/media-cover/index.js +2 -0
  9. package/dist/components/content-builders/article4/article4cora/media-cover/media-cover-root.d.ts +15 -0
  10. package/dist/components/content-builders/article4/article4cora/media-cover/media-cover-root.js +23 -0
  11. package/dist/components/content-builders/article4/article4cora/media-embla/index.d.ts +2 -0
  12. package/dist/components/content-builders/article4/article4cora/media-embla/index.js +2 -0
  13. package/dist/components/content-builders/article4/article4cora/media-embla/media-embla-root.d.ts +25 -0
  14. package/dist/components/content-builders/article4/article4cora/media-embla/media-embla-root.js +107 -0
  15. package/dist/components/content-builders/article4/baseBlock.d.ts +17 -0
  16. package/dist/components/content-builders/article4/baseBlock.js +115 -0
  17. package/dist/components/content-builders/article4/commonComponents.d.ts +53 -0
  18. package/dist/components/content-builders/article4/commonComponents.js +81 -0
  19. package/dist/components/content-builders/article4/config.d.ts +4 -0
  20. package/dist/components/content-builders/article4/config.js +6 -0
  21. package/dist/components/content-builders/article4/index.d.ts +12 -0
  22. package/dist/components/content-builders/article4/index.js +12 -0
  23. package/dist/components/content-builders/article4/type10Block.d.ts +14 -0
  24. package/dist/components/content-builders/article4/type10Block.js +24 -0
  25. package/dist/components/content-builders/article4/type1Block.d.ts +9 -0
  26. package/dist/components/content-builders/article4/type1Block.js +12 -0
  27. package/dist/components/content-builders/article4/type2Block.d.ts +9 -0
  28. package/dist/components/content-builders/article4/type2Block.js +17 -0
  29. package/dist/components/content-builders/article4/type3Block.d.ts +8 -0
  30. package/dist/components/content-builders/article4/type3Block.js +12 -0
  31. package/dist/components/content-builders/article4/type4Block.d.ts +27 -0
  32. package/dist/components/content-builders/article4/type4Block.js +53 -0
  33. package/dist/components/content-builders/article4/type5Block.d.ts +24 -0
  34. package/dist/components/content-builders/article4/type5Block.js +43 -0
  35. package/dist/components/content-builders/article4/type6Block.d.ts +24 -0
  36. package/dist/components/content-builders/article4/type6Block.js +43 -0
  37. package/dist/components/content-builders/article4/type7Block.d.ts +12 -0
  38. package/dist/components/content-builders/article4/type7Block.js +19 -0
  39. package/dist/components/content-builders/article4/type8Block.d.ts +11 -0
  40. package/dist/components/content-builders/article4/type8Block.js +14 -0
  41. package/dist/components/content-builders/article4/type9Block.d.ts +11 -0
  42. package/dist/components/content-builders/article4/type9Block.js +19 -0
  43. package/dist/components/content-builders/blocks/base-block.d.ts +12 -0
  44. package/dist/components/content-builders/blocks/base-block.js +91 -0
  45. package/dist/components/content-builders/blocks/headers-block.d.ts +20 -0
  46. package/dist/components/content-builders/blocks/headers-block.js +49 -0
  47. package/dist/components/content-builders/blocks/index.d.ts +4 -0
  48. package/dist/components/content-builders/blocks/index.js +4 -0
  49. package/dist/components/content-builders/blocks/media-content.d.ts +7 -0
  50. package/dist/components/content-builders/blocks/media-content.js +23 -0
  51. package/dist/components/content-builders/blocks/root-header.d.ts +11 -0
  52. package/dist/components/content-builders/blocks/root-header.js +14 -0
  53. package/dist/components/content-builders/blocks/roots.d.ts +8 -0
  54. package/dist/components/content-builders/blocks/roots.js +23 -0
  55. package/dist/components/content-builders/blocks/text-content.d.ts +20 -0
  56. package/dist/components/content-builders/blocks/text-content.js +190 -0
  57. package/dist/components/content-builders/content-builder-actionbar.d.ts +1 -0
  58. package/dist/components/content-builders/content-builder-actionbar.js +64 -0
  59. package/dist/components/content-builders/content-builder-blocks-dialogs.d.ts +4 -0
  60. package/dist/components/content-builders/content-builder-blocks-dialogs.js +45 -0
  61. package/dist/components/content-builders/content-builder-blocks.d.ts +15 -0
  62. package/dist/components/content-builders/content-builder-blocks.js +40 -0
  63. package/dist/components/content-builders/content-builder-builder.d.ts +13 -0
  64. package/dist/components/content-builders/content-builder-builder.js +17 -0
  65. package/dist/components/content-builders/content-builder-configs.d.ts +203 -0
  66. package/dist/components/content-builders/content-builder-configs.js +125 -0
  67. package/dist/components/content-builders/content-builder-context.d.ts +24 -0
  68. package/dist/components/content-builders/content-builder-context.js +47 -0
  69. package/dist/components/content-builders/content-builder-fields.d.ts +1 -0
  70. package/dist/components/content-builders/content-builder-fields.js +5 -0
  71. package/dist/components/content-builders/content-builder-functionbar.d.ts +1 -0
  72. package/dist/components/content-builders/content-builder-functionbar.js +37 -0
  73. package/dist/components/content-builders/content-builder-helpers.d.ts +9 -0
  74. package/dist/components/content-builders/content-builder-helpers.js +43 -0
  75. package/dist/components/content-builders/content-builder-hooks.d.ts +39 -0
  76. package/dist/components/content-builders/content-builder-hooks.js +129 -0
  77. package/dist/components/content-builders/content-builder-iframe.d.ts +5 -0
  78. package/dist/components/content-builders/content-builder-iframe.js +15 -0
  79. package/dist/components/content-builders/content-builder-overlay.d.ts +1 -0
  80. package/dist/components/content-builders/content-builder-overlay.js +22 -0
  81. package/dist/components/content-builders/content-builder-panels.d.ts +10 -0
  82. package/dist/components/content-builders/content-builder-panels.js +165 -0
  83. package/dist/components/content-builders/content-builder-preview.d.ts +4 -0
  84. package/dist/components/content-builders/content-builder-preview.js +22 -0
  85. package/dist/components/content-builders/content-builder-pucks-context.d.ts +13 -0
  86. package/dist/components/content-builders/content-builder-pucks-context.js +17 -0
  87. package/dist/components/content-builders/content-builder-pucks-hooks.d.ts +17 -0
  88. package/dist/components/content-builders/content-builder-pucks-hooks.js +119 -0
  89. package/dist/components/content-builders/content-builder-render.d.ts +6 -0
  90. package/dist/components/content-builders/content-builder-render.js +6 -0
  91. package/dist/components/content-builders/content-builder.d.ts +7 -0
  92. package/dist/components/content-builders/content-builder.js +24 -0
  93. package/dist/components/content-builders/fields/fields-tabs.d.ts +5 -0
  94. package/dist/components/content-builders/fields/fields-tabs.js +9 -0
  95. package/dist/components/content-builders/index.d.ts +5 -0
  96. package/dist/components/content-builders/index.js +5 -0
  97. package/dist/components/content-builders/initial-datas.d.ts +56 -0
  98. package/dist/components/content-builders/initial-datas.js +818 -0
  99. package/dist/components/emblas/embla-container.d.ts +8 -0
  100. package/dist/components/emblas/embla-container.js +13 -0
  101. package/dist/components/emblas/embla-context.d.ts +21 -0
  102. package/dist/components/emblas/embla-context.js +13 -0
  103. package/dist/components/emblas/embla.d.ts +20 -0
  104. package/dist/components/emblas/embla.js +125 -0
  105. package/dist/components/emblas/emblas-pagination.d.ts +11 -0
  106. package/dist/components/emblas/emblas-pagination.js +90 -0
  107. package/dist/components/emblas/index.d.ts +4 -0
  108. package/dist/components/emblas/index.js +4 -0
  109. package/dist/components/index.d.ts +2 -0
  110. package/dist/components/index.js +2 -0
  111. package/package.json +1 -1
@@ -0,0 +1,4 @@
1
+ declare const Article4CoraRoots: React.FC<any>;
2
+ export declare const mediaTestData: {};
3
+ export declare const mediaTestData2: {};
4
+ export default Article4CoraRoots;
@@ -0,0 +1,79 @@
1
+ "use client";
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { cn } from "../../../../shadcns/index.js";
4
+ import { MediaEmblaRoot } from "./media-embla";
5
+ import { MediaBaseRoot } from "./media-base";
6
+ const Article4CoraRoots = ({ data }) => {
7
+ return (_jsx("div", { className: cn("mt-19", "py-20"), children: _jsxs("div", { className: cn("mx-auto", "px-20", "py-20", "max-w-[80%]", "bg-[#f7f7f7]", "space-y-20", "@container"), children: [_jsx(MediaBaseRoot, { ...mediaTestData }), _jsx(MediaEmblaRoot, { ...mediaTestData2 })] }) }));
8
+ };
9
+ // 假資料 - 一般圖文
10
+ export const mediaTestData = {
11
+ // row: 2,
12
+ // merge: true,
13
+ // firstBig: true,
14
+ // imgSize: "x11",
15
+ // imgFlex: "center",
16
+ // imgWidthFull: false,
17
+ // mobileImgSingle: true,
18
+ // descriptionColor: "#f00",
19
+ // descriptionAlign: 'center',
20
+ // datas: [
21
+ // {
22
+ // type: "image",
23
+ // img: "https://picsum.photos/id/986/1000/200",
24
+ // imgAlt: "123",
25
+ // href: 'https://picsum.photos/id/986/700/400',
26
+ // target: true,
27
+ // description: "有設定外連結+_blank",
28
+ // },
29
+ // {
30
+ // },
31
+ // {
32
+ // type: "video",
33
+ // },
34
+ // ],
35
+ };
36
+ // 假資料 - 輪播
37
+ export const mediaTestData2 = {
38
+ // row: 3,
39
+ // merge: true,
40
+ // navigation: 'center',
41
+ // pagination: false,
42
+ // slidesToScroll: 2,
43
+ // autoplay: false,
44
+ // autoplayDelay = 2000,
45
+ // duration: 25,
46
+ // loop: false,
47
+ // imgSize: "x11",
48
+ // imgFlex: "center",
49
+ // imgWidthFull:false,
50
+ // navigationColor:'#f00',
51
+ // paginationColor:'#f00',
52
+ // descriptionColor:'#f00',
53
+ // descriptionAlign:'center',
54
+ // datas: [
55
+ // {
56
+ // type: "image",
57
+ // img: "https://picsum.photos/id/986/500/400",
58
+ // imgAlt: "123",
59
+ // href: 'https://picsum.photos/id/986/500/400',
60
+ // target: true,
61
+ // description: "有設定外連結+_blank",
62
+ // },
63
+ // {
64
+ // type: "image",
65
+ // img: "https://picsum.photos/id/986/200/100",
66
+ // imgAlt: "123",
67
+ // href: 'https://picsum.photos/id/986/200/400',
68
+ // description: "有設定外連結,沒有_blank",
69
+ // },
70
+ // {
71
+ // type: "video",
72
+ // img: "https://picsum.photos/id/986/700/400",
73
+ // imgAlt: "123",
74
+ // description: "影片樣式",
75
+ // },
76
+ // ],
77
+ };
78
+ Article4CoraRoots.displayName = "Article4CoraRoots";
79
+ export default Article4CoraRoots;
@@ -0,0 +1,2 @@
1
+ export { default as MediaBaseRoot } from "./media-base-root";
2
+ export * from "./media-base-root";
@@ -0,0 +1,2 @@
1
+ export { default as MediaBaseRoot } from "./media-base-root";
2
+ export * from "./media-base-root";
@@ -0,0 +1,15 @@
1
+ import { MediaCoverProps } from "../media-cover";
2
+ export interface MediaBaseRootProps {
3
+ row?: number;
4
+ merge?: boolean;
5
+ firstBig?: boolean;
6
+ imgSize?: "x11" | "x34" | "x43" | "x169" | 'custom';
7
+ imgFlex?: "top" | "center" | "bottom";
8
+ imgWidthFull?: boolean;
9
+ mobileImgSingle?: boolean;
10
+ descriptionColor?: string;
11
+ descriptionAlign?: string;
12
+ datas?: MediaCoverProps[];
13
+ }
14
+ export declare const MediaBaseRoot: React.FC<MediaBaseRootProps>;
15
+ export default MediaBaseRoot;
@@ -0,0 +1,52 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { cn } from "../../../../../shadcns/index.js";
3
+ import { MediaCover } from "../media-cover";
4
+ // 主件
5
+ export const MediaBaseRoot = (props) => {
6
+ // default options
7
+ const { row = 1, merge = false, firstBig = false, imgSize = 'x43', imgFlex = "top", imgWidthFull = true, mobileImgSingle = false, descriptionColor, descriptionAlign = "left", datas = [{
8
+ type: 'video',
9
+ }], } = props;
10
+ const imgSizeStyle = {
11
+ "x11": "1/1",
12
+ "x34": "3/4",
13
+ "x43": "4/3",
14
+ "x169": "16/9",
15
+ 'custom': false
16
+ }[imgSize || ""];
17
+ // 變數們 ( 放外層讓裡面繼承 )
18
+ const rootStyle = {
19
+ "--desktop-row-number": row, // 電腦版每列顯示數量
20
+ "--description-color": descriptionColor, // 圖片敘述顏色
21
+ "--img-size": imgSizeStyle // 圖片比例
22
+ };
23
+ const isSingleRow = row === 1;
24
+ // 文字對齊
25
+ const descriptionAlignClassName = `text-${descriptionAlign || "left"}`;
26
+ // 圖片對齊
27
+ const emblaContainerImgFlex = {
28
+ top: "items-start",
29
+ center: "items-center",
30
+ bottom: "items-end",
31
+ }[imgFlex] || "items-start";
32
+ return (_jsx("div", { "data-component": "media-cover-root", className: cn("w-full", "grid", "gap-x-5", "gap-y-5", "grid-cols-2", // 手機版預設 2 張
33
+ descriptionAlignClassName, "**:data-[component='media-cover']:text-(--description-color)", `**:data-[component='media-cover-photo']:aspect-(--img-size)`, "@4xl:grid-cols-[repeat(var(--desktop-row-number),1fr)]",
34
+ // 拼圖模式
35
+ merge && [
36
+ "gap-0",
37
+ ],
38
+ // 每列設置1張或是手機版設置單張圖時,手機顯示 1 張
39
+ (isSingleRow || mobileImgSingle) && [
40
+ "grid-cols-1",
41
+ ], !imgWidthFull && [
42
+ "**:data-[component='media-cover-photo']:w-auto",
43
+ ], emblaContainerImgFlex), style: rootStyle, children: datas.map((data, index) => {
44
+ // firstBig 判斷
45
+ const isfirstBig = firstBig && index === 0;
46
+ return (_jsx(MediaCover, { merge: merge, style: {
47
+ gridColumn: isfirstBig ? `1 / span ${row}` : 'auto',
48
+ }, ...data }, index));
49
+ }) }));
50
+ };
51
+ MediaBaseRoot.displayName = "MediaBaseRoot";
52
+ export default MediaBaseRoot;
@@ -0,0 +1,2 @@
1
+ export { default as MediaCover } from "./media-cover-root";
2
+ export * from "./media-cover-root";
@@ -0,0 +1,2 @@
1
+ export { default as MediaCover } from "./media-cover-root";
2
+ export * from "./media-cover-root";
@@ -0,0 +1,15 @@
1
+ export interface MediaCoverProps {
2
+ type?: "image" | "video" | "youtube";
3
+ merge?: boolean;
4
+ img?: string;
5
+ imgAlt?: string;
6
+ description?: string;
7
+ href?: string;
8
+ target?: boolean;
9
+ className?: string;
10
+ style?: any;
11
+ }
12
+ export declare const MediaCover: React.FC<MediaCoverProps>;
13
+ export declare const MediaCoverPhoto: React.FC<MediaCoverProps>;
14
+ export declare const MediaCoverVideo: React.FC<MediaCoverProps>;
15
+ export default MediaCover;
@@ -0,0 +1,23 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { cn } from "../../../../../shadcns/index.js";
3
+ // 1.殼
4
+ export const MediaCover = (props) => {
5
+ const { type = "image", merge, href, target, description = "圖片說明文字", style, } = props;
6
+ // 只有 target 才要 _blank
7
+ const linkProps = target
8
+ ? { target: "_blank" }
9
+ : {};
10
+ return (_jsxs("figure", { "data-component": "media-cover", style: style, children: [type === "image" && (href ? (_jsx("a", { href: href, ...linkProps, children: _jsx(MediaCoverPhoto, { ...props }) })) : (_jsx(MediaCoverPhoto, { ...props }))), type === "video" && _jsx(MediaCoverVideo, { ...props }), !merge && description && (_jsx("figcaption", { "data-component": "media-cover-description", className: cn("mt-2.5", "text-sm"), children: description }))] }));
11
+ };
12
+ // 1-1.圖
13
+ export const MediaCoverPhoto = (props) => {
14
+ const { img = "https://picsum.photos/id/986/700/400", imgAlt = "imgAlt" } = props;
15
+ return (_jsx("img", { "data-component": "media-cover-photo", className: cn("w-full", "h-auto", "object-cover", "block"), src: img, alt: imgAlt || "" }));
16
+ };
17
+ // 1-2.影片
18
+ export const MediaCoverVideo = (props) => {
19
+ const { img = "https://picsum.photos/id/986/700/400", } = props;
20
+ return (_jsx("div", { "data-component": "media-cover-video", className: cn("relative"), children: _jsxs("div", { children: [img && _jsx(MediaCoverPhoto, { ...props }), _jsx("div", { className: cn("absolute", "top-1/2", "left-1/2", "-translate-x-1/2", "-translate-y-1/2", "w-full", "h-full", "flex", "justify-center", "items-center", "after:absolute", "after:top-1/2", "after:left-1/2", "after:-translate-x-1/2", "after:-translate-y-1/2", "after:w-full", "after:h-full", "after:z-0", "after:bg-black", "after:opacity-50"), children: _jsx("div", { className: cn("relative", "w-[min(24%,60px)]", "aspect-square", "flex", "justify-center", "items-center", "bg-white", "rounded-full", "cursor-pointer", "z-1"), children: _jsx("div", { className: cn("border-solid", "border-[6px_0_6px_9px]", "border-transparent", "border-l-black", "z-1", "@4xl:border-[8px_0_8px_13px]") }) }) })] }) }));
21
+ };
22
+ MediaCover.displayName = "MediaCover";
23
+ export default MediaCover;
@@ -0,0 +1,2 @@
1
+ export { default as MediaEmblaRoot } from "./media-embla-root";
2
+ export * from "./media-embla-root";
@@ -0,0 +1,2 @@
1
+ export { default as MediaEmblaRoot } from "./media-embla-root";
2
+ export * from "./media-embla-root";
@@ -0,0 +1,25 @@
1
+ import { MediaCoverProps } from "../media-cover";
2
+ export interface MediaEmblaRootProps {
3
+ row?: number;
4
+ merge?: boolean;
5
+ navigation?: "bottom" | "center" | boolean;
6
+ pagination?: boolean;
7
+ slidesToScroll?: number;
8
+ autoplay?: boolean;
9
+ autoplayDelay?: number;
10
+ duration?: number;
11
+ loop?: boolean;
12
+ imgSize?: "x11" | "x34" | "x43" | "x169" | string;
13
+ imgFlex?: "top" | "center" | "bottom";
14
+ imgWidthFull?: boolean;
15
+ navigationColor?: string;
16
+ paginationColor?: string;
17
+ descriptionColor?: string;
18
+ descriptionAlign?: "left" | "center" | "right";
19
+ datas?: MediaCoverProps[];
20
+ }
21
+ export declare const MediaEmblaRoot: React.FC<MediaEmblaRootProps>;
22
+ export declare const MediaEmblaSlides: React.FC<any>;
23
+ export declare const MediaEmblaNavigation: React.FC<any>;
24
+ export declare const MediaEmblaPagination: React.FC<any>;
25
+ export default MediaEmblaRoot;
@@ -0,0 +1,107 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { cn } from "../../../../../shadcns/index.js";
3
+ import { Embla, EmblaPagination, EmblaContainer, useCarouselContext } from "../../../../index.js";
4
+ import { MediaCover } from "../media-cover";
5
+ // 輪播樣式
6
+ export const MediaEmblaRoot = (props) => {
7
+ // default options
8
+ const { row = 2, merge = false, navigation = false, pagination = true, slidesToScroll = 1, autoplay = true, autoplayDelay = 4000, duration = 25, loop = true, imgSize, imgFlex = "top", imgWidthFull = true, navigationColor, paginationColor, descriptionColor, descriptionAlign = "left", datas = [{}, {}, {}], } = props;
9
+ // navigation 模式
10
+ const navigationIsCenter = navigation === 'center';
11
+ // 電腦版,row 的數量 === datas 輪播數量時,不會啟動按鈕,故不調整整體寬度
12
+ const isControllerHide = row === datas.length || row > datas.length;
13
+ // embla 總寬度計算
14
+ const emblaClassName = navigationIsCenter
15
+ ? cn(
16
+ // 左右箭頭啟動,且置中時會縮短整體寬度
17
+ "w-[calc(100%-40px-20px*2)]", "mx-auto", isControllerHide ? "@4xl:w-[calc(100%+20px)] -ml-2.5" : "@4xl:w-[calc(100%-60px-30px*2)]") : cn(
18
+ // 左右箭頭置下或隱藏,寬度撐滿
19
+ merge
20
+ ? "ml-0 w-full" // 啟動拼圖,不用計算圖片左右間距
21
+ : "w-[calc(100%+20px)] -ml-2.5" // base,
22
+ );
23
+ // navigation 樣式
24
+ const navigationClassName = navigationIsCenter ? cn(
25
+ // navigation = 'center' 置中
26
+ "absolute", "justify-between", "top-1/2", "-translate-y-1/2", "w-full") : cn(
27
+ // navigation = 'bottom' 置底 || false 移除
28
+ "mt-2.5", "justify-center", "gap-x-5", "@4xl:mt-7.5");
29
+ // 圖片比例
30
+ const imgSizeStyle = {
31
+ "x11": "1/1",
32
+ "x34": "3/4",
33
+ "x43": "4/3",
34
+ "x169": "16/9",
35
+ }[imgSize || ""];
36
+ // 變數們 ( 放外層讓裡面繼承 )
37
+ const rootStyle = {
38
+ "--navigation-color": navigationColor ? navigationColor : "#000", // 左右箭頭顏色
39
+ "--description-color": descriptionColor, // 圖片敘述顏色
40
+ "--slide-basis": row ? `${100 / row}%` : "100%", // slide 寬度變數
41
+ "--img-size": imgSizeStyle // 圖片比例
42
+ };
43
+ // 圖片對齊
44
+ const emblaContainerImgFlex = {
45
+ top: "items-start",
46
+ center: "items-center",
47
+ bottom: "items-end",
48
+ }[imgFlex] || "items-start";
49
+ // 文字對齊
50
+ const descriptionAlignClassName = `text-${descriptionAlign || "left"}`;
51
+ // slide 樣式計算
52
+ const mediaEmblaSlidesClassName = row ? cn("flex-[0_0_100%]", "@4xl:flex-[0_0_var(--slide-basis)]", merge ? "pl-0" : "pl-2.5", merge ? "pr-0" : "pr-2.5") : cn("flex-[0_0_100%]", "px-2.5");
53
+ return (_jsx("div", { "data-component": "media-embla-root", className: cn("relative", "overflow-hidden", !imgWidthFull && [
54
+ "**:data-[component='media-cover-photo']:w-auto",
55
+ ], descriptionAlignClassName, "**:data-[component='media-cover']:text-(--description-color)", `**:data-[component='media-cover-photo']:aspect-(--img-size)`), style: rootStyle, children: _jsx(Embla, { options: {
56
+ align: "start",
57
+ duration: duration,
58
+ loop: loop,
59
+ breakpoints: {
60
+ '(min-width: 768px)': { slidesToScroll: slidesToScroll },
61
+ },
62
+ }, autoplayEnabled: autoplay, autoplayOptions: {
63
+ delay: autoplayDelay,
64
+ stopOnMouseEnter: true, // 滑鼠移入後暫停
65
+ }, className: cn("w-[calc(100%+20px)]", "-ml-2.5", emblaClassName),
66
+ // pagination & navigation
67
+ controls: [
68
+ pagination && _jsx(MediaEmblaPagination, { paginationColor: paginationColor }),
69
+ navigation && _jsx(MediaEmblaNavigation, { className: navigationClassName })
70
+ ], children: _jsx(EmblaContainer, { className: cn(emblaContainerImgFlex), children: datas.map((data, index) => {
71
+ return (_jsx(MediaEmblaSlides, { className: mediaEmblaSlidesClassName, ...data }, index));
72
+ }) }) }) }));
73
+ };
74
+ // slide 卡片
75
+ export const MediaEmblaSlides = ({ className, ...props }) => {
76
+ return (_jsx("div", { "data-component": "media-embla-slides", className: cn("relative", "shrink-0", className), children: _jsx(MediaCover, { ...props }) }));
77
+ };
78
+ // navigation 左右箭頭
79
+ export const MediaEmblaNavigation = ({ className, svgIcon }) => {
80
+ const { scrollSnaps, nextScroll, prevScroll, emblaApi } = useCarouselContext();
81
+ const canScrollNext = emblaApi?.canScrollNext();
82
+ const canScrollPrev = emblaApi?.canScrollPrev();
83
+ const isSingle = scrollSnaps.length < 2;
84
+ const svgIcon2 = svgIcon ? svgIcon :
85
+ _jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", height: "12", viewBox: "0 0 30 12", fill: "none", children: [_jsx("g", { clipPath: "url(#clip0_5_91)", children: _jsx("path", { d: "M6.55801 0.496948L0.980469 5.99166M0.980469 5.99166L6.55801 11.5002M0.980469 5.99166H30.0003", strokeWidth: "2", strokeMiterlimit: "10" }) }), _jsx("defs", { children: _jsx("clipPath", { id: "clip0_5_91", children: _jsx("rect", { width: "30", height: "11.9972", fill: "white" }) }) })] });
86
+ return (_jsxs("div", { "data-component": "media-embla-navigation", className: cn("flex", "z-9", isSingle && [
87
+ "hidden"
88
+ ], "[&_svg]:stroke-(--navigation-color)", className), children: [_jsx("div", { onClick: () => { prevScroll(); }, className: cn("[&_svg]:w-5", "pointer-events-none", "@4xl:[&_svg]:w-7.5", "opacity-20", canScrollPrev && [
89
+ "pointer-events-auto",
90
+ "cursor-pointer",
91
+ "opacity-100",
92
+ ]), children: svgIcon2 }), _jsx("div", { onClick: () => { nextScroll(); }, className: cn("[&_svg]:w-5", "pointer-events-none", "opacity-20", "-scale-x-100", "@4xl:[&_svg]:w-7.5", canScrollNext && [
93
+ "pointer-events-auto",
94
+ "cursor-pointer",
95
+ "opacity-100",
96
+ ]), children: svgIcon2 })] }));
97
+ };
98
+ // Pagination 輪播點點
99
+ export const MediaEmblaPagination = ({ swiperNumberShow = false, dynamicLimit = false, paginationColor = "#000", }) => {
100
+ const { scrollSnaps } = useCarouselContext();
101
+ const isSingle = scrollSnaps.length < 2;
102
+ return (_jsx("div", { "data-component": "media-embla-pagination", className: cn("flex", "justify-center", "px-5", "mt-2.5", "w-full", "@4xl:mt-7.5", isSingle && [
103
+ "hidden",
104
+ ]), children: _jsx(EmblaPagination, { swiperNumber: swiperNumberShow, dynamic: dynamicLimit, color: paginationColor }) }));
105
+ };
106
+ MediaEmblaRoot.displayName = "MediaEmblaRoot";
107
+ export default MediaEmblaRoot;
@@ -0,0 +1,17 @@
1
+ import type { ComponentConfig, PuckComponent } from "@puckeditor/core";
2
+ type HeadingData = {
3
+ title?: string;
4
+ titleTag?: any;
5
+ titleColor?: string;
6
+ titleAlign?: "left" | "center" | "right";
7
+ };
8
+ type ContentBlockData = {
9
+ option?: {
10
+ rwdReverse?: 'normal' | 'reverse';
11
+ };
12
+ config?: any;
13
+ };
14
+ export declare const BaseBlockSue: PuckComponent<ContentBlockData>;
15
+ export declare const RenderHeading: React.FC<HeadingData>;
16
+ export declare const BaseBlockSueConfigs: ComponentConfig;
17
+ export {};
@@ -0,0 +1,115 @@
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
+ import { cn } from "../../../shadcns/index.js";
3
+ import { RenderImage, RenderBtn } from "./commonComponents";
4
+ import { BuilderBlocksComponent } from "../content-builder-blocks";
5
+ export const BaseBlockSue = ({ option, config, puck, ...props }) => {
6
+ // 引入樣式
7
+ // const { type1Block } = config || {}
8
+ const { rwdReverse = "normal" } = option || {};
9
+ const isRWDReverse = rwdReverse === 'reverse';
10
+ return (_jsx(BuilderBlocksComponent, { name: "BaseBlockSue", puck: puck, children: _jsx("div", { "data-component": "BaseBlock", className: cn("@container", "w-full", "max-w-full", "py-15", config), ...props, children: _jsxs("div", { "data-component": "article-item-inner", className: cn("w-9/10", "max-w-[1200px]", "mx-auto", "grid", "grid-rows-[auto_auto]", "gap-5"), children: [_jsx("div", { className: cn("w-full", "order-0"), children: _jsx(RenderHeading, {}) }), _jsx("div", { className: cn("w-full", "@4xl:order-1", isRWDReverse && "order-2"), children: _jsx(RenderImage, {}) }), _jsx("div", { className: cn("w-full", "@4xl:order-2", isRWDReverse && "order-1"), children: _jsx(RenderText, {}) })] }) }) }));
11
+ };
12
+ export const RenderHeading = (props) => {
13
+ const { title = '標題', titleTag: TitleComponent = "h2", titleColor, titleAlign = "left", } = props;
14
+ const alignMap = {
15
+ left: "text-left",
16
+ center: "text-center",
17
+ right: "text-right",
18
+ };
19
+ return (_jsx(_Fragment, { children: _jsx("div", { className: cn("w-full"), style: {
20
+ "--title-color": titleColor,
21
+ }, children: title &&
22
+ _jsx(TitleComponent, { "data-component": "article-item-title", className: cn("text-xl", "@4xl:text-3xl", "font-bold", "text-(--title-color)", titleAlign && alignMap[titleAlign]), children: title }) }) }));
23
+ };
24
+ const RenderText = (props) => {
25
+ const { subTitle = '副標題', paragraph = '內文', subTitleAlign = "left", paragraphAlign = "left", buttonAlign = "left", buttonData = [
26
+ {
27
+ buttonText: '按鈕',
28
+ buttonLink: 'javascript:',
29
+ },
30
+ {
31
+ buttonText: '按鈕',
32
+ buttonLink: 'javascript:',
33
+ },
34
+ {
35
+ buttonText: '按鈕',
36
+ buttonLink: 'javascript:',
37
+ },
38
+ ], subTitleColor, paragraphColor } = props;
39
+ const alignMap = {
40
+ left: "text-left",
41
+ center: "text-center",
42
+ right: "text-right",
43
+ };
44
+ return (_jsx(_Fragment, { children: _jsxs("div", { "data-component": "article-text-content", className: cn("w-full"), style: {
45
+ "--subTitle-color": subTitleColor,
46
+ "--paragraph-color": paragraphColor,
47
+ }, children: [_jsxs("div", { className: cn("space-y-5"), children: [subTitle &&
48
+ _jsx("p", { "data-component": "article-text-subtitle", className: cn("text-m", "@4xl:text-xl", "text-gray-600", "text-(--subTitle-color)", subTitleAlign && alignMap[subTitleAlign]), children: subTitle }), paragraph &&
49
+ _jsx("p", { "data-component": "article-text-paragraph", className: cn("text-sm", "text-gray-700", "text-(--paragraph-color)", paragraphAlign && alignMap[paragraphAlign]), children: paragraph })] }), buttonData && _jsx(RenderBtn, { buttonData: buttonData, buttonAlign: buttonAlign })] }) }));
50
+ };
51
+ export const BaseBlockSueConfigs = {
52
+ label: "BaseBlockSue",
53
+ fields: {
54
+ // slotTextBlock: { type: "slot", allow: ["TextContent"] },
55
+ // slotMediaBlock: { type: "slot", allow: ["MediaContent"] },
56
+ option: {
57
+ label: "Contetn Options",
58
+ type: "object",
59
+ objectFields: {
60
+ rwdReverse: {
61
+ label: "Content Align",
62
+ type: "radio",
63
+ options: [
64
+ { label: "Normal", value: "normal" },
65
+ { label: "Reverse", value: "reverse" },
66
+ ],
67
+ },
68
+ textAlign2: {
69
+ label: "Content Vertical",
70
+ type: "radio",
71
+ options: [
72
+ { label: "Top", value: "top" },
73
+ { label: "Middle", value: "middle" },
74
+ { label: "Bottom", value: "bottom" },
75
+ ],
76
+ },
77
+ },
78
+ },
79
+ // background: {
80
+ // label: "Background Setting",
81
+ // type: "object",
82
+ // objectFields: {
83
+ // isImage: {
84
+ // label: "Use Image",
85
+ // type: "radio",
86
+ // options: [
87
+ // { label: "Yes", value: "yes" },
88
+ // { label: "No", value: "no" },
89
+ // ],
90
+ // },
91
+ // imageAddress: {
92
+ // label: "Image Address",
93
+ // type: "text"
94
+ // },
95
+ // color: {
96
+ // label: "Color",
97
+ // type: "text"
98
+ // },
99
+ // },
100
+ // },
101
+ },
102
+ // defaultProps: {
103
+ // options: {
104
+ // textAlign: "left",
105
+ // textAlign2: "top"
106
+ // },
107
+ // background: {
108
+ // isImage: "no"
109
+ // },
110
+ // configs: {
111
+ // className: ""
112
+ // }
113
+ // },
114
+ render: BaseBlockSue
115
+ };
@@ -0,0 +1,53 @@
1
+ export type MediaData = {
2
+ row?: number;
3
+ firstbig?: boolean;
4
+ merge?: boolean;
5
+ gapY?: number;
6
+ gapX?: number;
7
+ datas?: MediaItem[];
8
+ };
9
+ export type TextBoxData = {
10
+ title?: string;
11
+ subtitle?: string;
12
+ paragraph?: string;
13
+ titleAlign?: "left" | "center" | "right";
14
+ subTitleAlign?: "left" | "center" | "right";
15
+ paragraphAlign?: "left" | "center" | "right";
16
+ buttonAlign?: "left" | "center" | "right";
17
+ buttonData?: ButtonItem[];
18
+ titleTag?: any;
19
+ titleColor?: string;
20
+ subTitleColor?: string;
21
+ paragraphColor?: string;
22
+ };
23
+ export type ButtonItem = {
24
+ buttonText?: string;
25
+ buttonLink?: string;
26
+ option?: ButtonOptions;
27
+ };
28
+ export type ButtonOptions = {
29
+ bgColor?: string;
30
+ textColor?: string;
31
+ hoverBgColor?: string;
32
+ hoverTextColor?: string;
33
+ };
34
+ export type MediaItem = {
35
+ type?: "image" | "video" | "youtube";
36
+ merge?: boolean;
37
+ img?: string;
38
+ img_alt?: string;
39
+ description?: string;
40
+ href?: string;
41
+ target?: boolean;
42
+ className?: string;
43
+ style?: any;
44
+ };
45
+ export declare const RenderText: React.FC<TextBoxData>;
46
+ export declare const RenderBtn: React.FC<{
47
+ buttonAlign?: string;
48
+ buttonData?: ButtonItem[];
49
+ }>;
50
+ export declare const RenderImage: React.FC<{
51
+ props?: any;
52
+ type?: "picture" | "embla";
53
+ }>;
@@ -0,0 +1,81 @@
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
+ import { MediaBaseRoot } from "./article4cora/media-base";
3
+ import { MediaEmblaRoot } from "./article4cora/media-embla";
4
+ import { cn } from "../../../shadcns/index.js";
5
+ export const RenderText = (props) => {
6
+ const { title = '標題', subtitle = '副標題', paragraph = '內文', titleAlign = "left", subTitleAlign = "left", paragraphAlign = "left", buttonAlign = "left", buttonData = [
7
+ {
8
+ buttonText: '按鈕',
9
+ buttonLink: 'javascript:;',
10
+ },
11
+ ], titleTag: TitleComponent = "h2", titleColor, subTitleColor, paragraphColor, } = props;
12
+ const alignMap = {
13
+ left: "text-left",
14
+ center: "text-center",
15
+ right: "text-right",
16
+ };
17
+ return (_jsx(_Fragment, { children: _jsxs("div", { "data-component": "article-text-content", className: cn("w-full"), style: {
18
+ "--title-color": titleColor,
19
+ "--subTitle-color": subTitleColor,
20
+ "--paragraph-color": paragraphColor,
21
+ }, children: [_jsxs("div", { className: cn("space-y-5"), children: [_jsxs("hgroup", { className: cn("space-y-5"), children: [title &&
22
+ _jsx(TitleComponent, { "data-component": "article-text-title", className: cn("text-xl", "font-bold", "@4xl:text-3xl", "text-(--title-color)", titleAlign && alignMap[titleAlign]), children: title }), subtitle &&
23
+ _jsx("p", { "data-component": "article-text-subtitle", className: cn("text-m", "@4xl:text-xl", "text-gray-600", "text-(--subTitle-color)", subTitleAlign && alignMap[subTitleAlign]), children: subtitle })] }), paragraph &&
24
+ _jsx("p", { "data-component": "article-text-paragraph", className: cn("text-sm", "text-gray-700", "text-(--paragraph-color)", paragraphAlign && alignMap[paragraphAlign]), children: paragraph })] }), buttonData && _jsx(RenderBtn, { buttonData: buttonData, buttonAlign: buttonAlign })] }) }));
25
+ };
26
+ export const RenderBtn = ({ buttonAlign, buttonData }) => {
27
+ // 按鈕對齊
28
+ const buttonAlignClassName = {
29
+ "left": "justify-start",
30
+ "center": "justify-center",
31
+ "right": "justify-end",
32
+ }[buttonAlign || ""];
33
+ return (_jsx(_Fragment, { children: _jsx("div", { className: cn("flex", "gap-2", "flex-wrap", "mt-5", buttonAlignClassName), children: buttonData?.map((item, i) => (_jsx("a", { href: item.buttonLink, "data-component": "article-button", className: cn("inline-block", "px-4", "py-2", "text-sm", "font-semibold", "leading-[1.8]", "tracking-[0.8px]", "transition", "duration-500", "bg-(--bg-color)", "text-(--T-color)", "hover:bg-(--hoverBG-color)", "hover:text-(--hoverT-color)"), style: {
34
+ "--T-color": item.option?.textColor || "#FFF",
35
+ "--bg-color": item.option?.bgColor || "#000",
36
+ "--hoverT-color": item.option?.hoverTextColor || "#000",
37
+ "--hoverBG-color": item.option?.hoverBgColor || "#F1F1f1",
38
+ }, children: item.buttonText }, i))) }) }));
39
+ };
40
+ export const RenderImage = ({ props = {
41
+ row: 2,
42
+ // merge: true,
43
+ // navigation: 'center',
44
+ // pagination: false,
45
+ // slidesToScroll: 1,
46
+ // autoplay: false,
47
+ // duration: 25,
48
+ // loop: true,
49
+ // navigationColor: '#0ff',
50
+ // paginationColor: '#f0f',
51
+ // descriptionColor: '#ff0',
52
+ // descriptionAlign: 'center',
53
+ // imgWidthFull: false,
54
+ datas: [
55
+ {
56
+ // type: "image",
57
+ // img: "https://picsum.photos/id/986/700/400",
58
+ // imgAlt: "123",
59
+ href: 'https://picsum.photos/id/986/700/400',
60
+ target: true,
61
+ description: "有設定外連結+_blank",
62
+ },
63
+ {
64
+ // type: "image",
65
+ // img: "https://picsum.photos/id/986/700/400",
66
+ // imgAlt: "123",
67
+ href: 'https://picsum.photos/id/986/700/400',
68
+ description: "有設定外連結,沒有_blank",
69
+ },
70
+ {
71
+ type: "video",
72
+ // img: "https://picsum.photos/id/986/700/400",
73
+ // imgAlt: "123",
74
+ description: "影片樣式",
75
+ },
76
+ ]
77
+ }, type = "embla", }) => {
78
+ return (_jsx(_Fragment, { children: _jsxs("div", { "data-component": "article-media", className: cn("w-full"), children: [type === "picture" &&
79
+ _jsx(MediaBaseRoot, { ...props }), type === "embla" &&
80
+ _jsx(MediaEmblaRoot, { ...props })] }) }));
81
+ };
@@ -0,0 +1,4 @@
1
+ declare const config: {
2
+ type1Block: string[];
3
+ };
4
+ export default config;
@@ -0,0 +1,6 @@
1
+ const config = {
2
+ type1Block: [
3
+ "**:text-blue-500"
4
+ ]
5
+ };
6
+ export default config;