@easy-editor/materials-dashboard-carousel 0.0.3 → 0.0.4

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/component.js DELETED
@@ -1,186 +0,0 @@
1
- /* @easy-editor/materials-dashboard-carousel v0.0.2 (component) */
2
- (function (global, factory) {
3
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('react'), require('react/jsx-runtime')) :
4
- typeof define === 'function' && define.amd ? define(['exports', 'react', 'react/jsx-runtime'], factory) :
5
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.EasyEditorMaterialsCarouselComponent = {}, global.React, global.jsxRuntime));
6
- })(this, (function (exports, react, jsxRuntime) { 'use strict';
7
-
8
- function styleInject(css, ref) {
9
- if (ref === void 0) ref = {};
10
- var insertAt = ref.insertAt;
11
- if (typeof document === 'undefined') {
12
- return;
13
- }
14
- var head = document.head || document.getElementsByTagName('head')[0];
15
- var style = document.createElement('style');
16
- style.type = 'text/css';
17
- if (insertAt === 'top') {
18
- if (head.firstChild) {
19
- head.insertBefore(style, head.firstChild);
20
- } else {
21
- head.appendChild(style);
22
- }
23
- } else {
24
- head.appendChild(style);
25
- }
26
- if (style.styleSheet) {
27
- style.styleSheet.cssText = css;
28
- } else {
29
- style.appendChild(document.createTextNode(css));
30
- }
31
- }
32
-
33
- var css_248z = ".component-module__container___VbZSk{border-radius:8px;height:100%;overflow:hidden;position:relative;width:100%}.component-module__track___I-5nr{display:flex;height:100%;transition:transform .5s ease}.component-module__slide___7N5m5{align-items:center;display:flex;flex:0 0 100%;height:100%;justify-content:center;width:100%}.component-module__slideImage___CJ8fn{height:100%;object-fit:cover;width:100%}.component-module__navButton___0CqxY{align-items:center;background:rgba(0,0,0,.5);border:none;border-radius:50%;color:#fff;cursor:pointer;display:flex;height:40px;justify-content:center;position:absolute;top:50%;transform:translateY(-50%);transition:background .3s ease;width:40px;z-index:10}.component-module__navButton___0CqxY:hover{background:rgba(0,0,0,.7)}.component-module__navButtonPrev___qAqle{left:16px}.component-module__navButtonNext___yYw7n{right:16px}.component-module__indicators___WMttK{bottom:16px;display:flex;gap:8px;left:50%;position:absolute;transform:translateX(-50%);z-index:10}.component-module__indicator___KYoys{background:hsla(0,0%,100%,.4);border:none;border-radius:50%;cursor:pointer;height:8px;padding:0;transition:all .3s ease;width:8px}.component-module__indicatorActive___ws6eP{background:#fff;transform:scale(1.2)}.component-module__indicator___KYoys:hover{background:hsla(0,0%,100%,.7)}";
34
- var styles = {"container":"component-module__container___VbZSk","track":"component-module__track___I-5nr","slide":"component-module__slide___7N5m5","slideImage":"component-module__slideImage___CJ8fn","navButton":"component-module__navButton___0CqxY","navButtonPrev":"component-module__navButtonPrev___qAqle","navButtonNext":"component-module__navButtonNext___yYw7n","indicators":"component-module__indicators___WMttK","indicator":"component-module__indicator___KYoys","indicatorActive":"component-module__indicatorActive___ws6eP"};
35
- styleInject(css_248z);
36
-
37
- /**
38
- * Carousel Component
39
- * 轮播组件
40
- */
41
-
42
- const DEFAULT_ITEMS = [{
43
- src: 'https://picsum.photos/800/400?random=1',
44
- alt: 'Slide 1'
45
- }, {
46
- src: 'https://picsum.photos/800/400?random=2',
47
- alt: 'Slide 2'
48
- }, {
49
- src: 'https://picsum.photos/800/400?random=3',
50
- alt: 'Slide 3'
51
- }];
52
- const ChevronLeft = () => /*#__PURE__*/jsxRuntime.jsxs("svg", {
53
- "aria-hidden": "true",
54
- fill: "none",
55
- height: "24",
56
- stroke: "currentColor",
57
- strokeWidth: "2",
58
- viewBox: "0 0 24 24",
59
- width: "24",
60
- children: [/*#__PURE__*/jsxRuntime.jsx("title", {
61
- children: "Previous"
62
- }), /*#__PURE__*/jsxRuntime.jsx("path", {
63
- d: "M15 18l-6-6 6-6"
64
- })]
65
- });
66
- const ChevronRight = () => /*#__PURE__*/jsxRuntime.jsxs("svg", {
67
- "aria-hidden": "true",
68
- fill: "none",
69
- height: "24",
70
- stroke: "currentColor",
71
- strokeWidth: "2",
72
- viewBox: "0 0 24 24",
73
- width: "24",
74
- children: [/*#__PURE__*/jsxRuntime.jsx("title", {
75
- children: "Next"
76
- }), /*#__PURE__*/jsxRuntime.jsx("path", {
77
- d: "M9 18l6-6-6-6"
78
- })]
79
- });
80
- const Carousel = ({
81
- ref,
82
- items = DEFAULT_ITEMS,
83
- autoPlay = true,
84
- interval = 3000,
85
- showNav = true,
86
- showIndicators = true,
87
- loop = true,
88
- style: externalStyle
89
- }) => {
90
- const [currentIndex, setCurrentIndex] = react.useState(0);
91
- const goToNext = react.useCallback(() => {
92
- setCurrentIndex(prev => {
93
- if (prev >= items.length - 1) {
94
- return loop ? 0 : prev;
95
- }
96
- return prev + 1;
97
- });
98
- }, [items.length, loop]);
99
- const goToPrev = react.useCallback(() => {
100
- setCurrentIndex(prev => {
101
- if (prev <= 0) {
102
- return loop ? items.length - 1 : prev;
103
- }
104
- return prev - 1;
105
- });
106
- }, [items.length, loop]);
107
- const goToSlide = react.useCallback(index => {
108
- setCurrentIndex(index);
109
- }, []);
110
-
111
- // 自动播放
112
- react.useEffect(() => {
113
- if (!autoPlay || items.length <= 1) {
114
- return;
115
- }
116
- const timer = setInterval(goToNext, interval);
117
- return () => clearInterval(timer);
118
- }, [autoPlay, interval, goToNext, items.length]);
119
- if (items.length === 0) {
120
- return null;
121
- }
122
- return /*#__PURE__*/jsxRuntime.jsxs("div", {
123
- className: styles.container,
124
- ref: ref,
125
- style: externalStyle,
126
- children: [/*#__PURE__*/jsxRuntime.jsx("div", {
127
- className: styles.track,
128
- style: {
129
- transform: `translateX(-${currentIndex * 100}%)`
130
- },
131
- children: items.map((item, index) => /*#__PURE__*/jsxRuntime.jsx("div", {
132
- className: styles.slide,
133
- children: item.link ? /*#__PURE__*/jsxRuntime.jsx("a", {
134
- href: item.link,
135
- rel: "noopener noreferrer",
136
- target: "_blank",
137
- children: /*#__PURE__*/jsxRuntime.jsx("img", {
138
- alt: item.alt || '',
139
- className: styles.slideImage,
140
- draggable: false,
141
- height: "200",
142
- src: item.src,
143
- width: "100%"
144
- })
145
- }) : /*#__PURE__*/jsxRuntime.jsx("img", {
146
- alt: item.alt || '',
147
- className: styles.slideImage,
148
- draggable: false,
149
- height: "200",
150
- src: item.src,
151
- width: "100%"
152
- })
153
- }, index))
154
- }), showNav && items.length > 1 && /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
155
- children: [/*#__PURE__*/jsxRuntime.jsx("button", {
156
- "aria-label": "Previous slide",
157
- className: `${styles.navButton} ${styles.navButtonPrev}`,
158
- onClick: goToPrev,
159
- type: "button",
160
- children: /*#__PURE__*/jsxRuntime.jsx(ChevronLeft, {})
161
- }), /*#__PURE__*/jsxRuntime.jsx("button", {
162
- "aria-label": "Next slide",
163
- className: `${styles.navButton} ${styles.navButtonNext}`,
164
- onClick: goToNext,
165
- type: "button",
166
- children: /*#__PURE__*/jsxRuntime.jsx(ChevronRight, {})
167
- })]
168
- }), showIndicators && items.length > 1 && /*#__PURE__*/jsxRuntime.jsx("div", {
169
- className: styles.indicators,
170
- children: items.map((_, index) => /*#__PURE__*/jsxRuntime.jsx("button", {
171
- "aria-label": `Go to slide ${index + 1}`,
172
- className: `${styles.indicator} ${index === currentIndex ? styles.indicatorActive : ''}`,
173
- onClick: () => goToSlide(index),
174
- type: "button"
175
- }, index))
176
- })]
177
- });
178
- };
179
-
180
- exports.Carousel = Carousel;
181
- exports.default = Carousel;
182
-
183
- Object.defineProperty(exports, '__esModule', { value: true });
184
-
185
- }));
186
- //# sourceMappingURL=component.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"component.js","sources":["../../../../../node_modules/.pnpm/style-inject@0.3.0/node_modules/style-inject/dist/style-inject.es.js","../src/component.tsx"],"sourcesContent":["function styleInject(css, ref) {\n if ( ref === void 0 ) ref = {};\n var insertAt = ref.insertAt;\n\n if (!css || typeof document === 'undefined') { return; }\n\n var head = document.head || document.getElementsByTagName('head')[0];\n var style = document.createElement('style');\n style.type = 'text/css';\n\n if (insertAt === 'top') {\n if (head.firstChild) {\n head.insertBefore(style, head.firstChild);\n } else {\n head.appendChild(style);\n }\n } else {\n head.appendChild(style);\n }\n\n if (style.styleSheet) {\n style.styleSheet.cssText = css;\n } else {\n style.appendChild(document.createTextNode(css));\n }\n}\n\nexport default styleInject;\n","/**\n * Carousel Component\n * 轮播组件\n */\n\nimport { useState, useEffect, useCallback, type CSSProperties, type Ref } from 'react'\nimport styles from './component.module.css'\n\nexport interface CarouselItem {\n /** 图片地址 */\n src: string\n /** 图片描述 */\n alt?: string\n /** 点击链接 */\n link?: string\n}\n\nexport interface CarouselProps {\n ref?: Ref<HTMLDivElement>\n /** 轮播项 */\n items?: CarouselItem[]\n /** 自动播放 */\n autoPlay?: boolean\n /** 自动播放间隔(毫秒) */\n interval?: number\n /** 是否显示导航按钮 */\n showNav?: boolean\n /** 是否显示指示器 */\n showIndicators?: boolean\n /** 是否循环播放 */\n loop?: boolean\n /** 外部样式 */\n style?: CSSProperties\n}\n\nconst DEFAULT_ITEMS: CarouselItem[] = [\n { src: 'https://picsum.photos/800/400?random=1', alt: 'Slide 1' },\n { src: 'https://picsum.photos/800/400?random=2', alt: 'Slide 2' },\n { src: 'https://picsum.photos/800/400?random=3', alt: 'Slide 3' },\n]\n\nconst ChevronLeft = () => (\n <svg aria-hidden='true' fill='none' height='24' stroke='currentColor' strokeWidth='2' viewBox='0 0 24 24' width='24'>\n <title>Previous</title>\n <path d='M15 18l-6-6 6-6' />\n </svg>\n)\n\nconst ChevronRight = () => (\n <svg aria-hidden='true' fill='none' height='24' stroke='currentColor' strokeWidth='2' viewBox='0 0 24 24' width='24'>\n <title>Next</title>\n <path d='M9 18l6-6-6-6' />\n </svg>\n)\n\nexport const Carousel: React.FC<CarouselProps> = ({\n ref,\n items = DEFAULT_ITEMS,\n autoPlay = true,\n interval = 3000,\n showNav = true,\n showIndicators = true,\n loop = true,\n style: externalStyle,\n}) => {\n const [currentIndex, setCurrentIndex] = useState(0)\n\n const goToNext = useCallback(() => {\n setCurrentIndex(prev => {\n if (prev >= items.length - 1) {\n return loop ? 0 : prev\n }\n return prev + 1\n })\n }, [items.length, loop])\n\n const goToPrev = useCallback(() => {\n setCurrentIndex(prev => {\n if (prev <= 0) {\n return loop ? items.length - 1 : prev\n }\n return prev - 1\n })\n }, [items.length, loop])\n\n const goToSlide = useCallback((index: number) => {\n setCurrentIndex(index)\n }, [])\n\n // 自动播放\n useEffect(() => {\n if (!autoPlay || items.length <= 1) {\n return\n }\n\n const timer = setInterval(goToNext, interval)\n return () => clearInterval(timer)\n }, [autoPlay, interval, goToNext, items.length])\n\n if (items.length === 0) {\n return null\n }\n\n return (\n <div className={styles.container} ref={ref} style={externalStyle}>\n <div className={styles.track} style={{ transform: `translateX(-${currentIndex * 100}%)` }}>\n {items.map((item, index) => (\n <div className={styles.slide} key={index}>\n {item.link ? (\n <a href={item.link} rel='noopener noreferrer' target='_blank'>\n <img\n alt={item.alt || ''}\n className={styles.slideImage}\n draggable={false}\n height='200'\n src={item.src}\n width='100%'\n />\n </a>\n ) : (\n <img\n alt={item.alt || ''}\n className={styles.slideImage}\n draggable={false}\n height='200'\n src={item.src}\n width='100%'\n />\n )}\n </div>\n ))}\n </div>\n\n {/* 导航按钮 */}\n {showNav && items.length > 1 && (\n <>\n <button\n aria-label='Previous slide'\n className={`${styles.navButton} ${styles.navButtonPrev}`}\n onClick={goToPrev}\n type='button'\n >\n <ChevronLeft />\n </button>\n <button\n aria-label='Next slide'\n className={`${styles.navButton} ${styles.navButtonNext}`}\n onClick={goToNext}\n type='button'\n >\n <ChevronRight />\n </button>\n </>\n )}\n\n {/* 指示器 */}\n {showIndicators && items.length > 1 && (\n <div className={styles.indicators}>\n {items.map((_, index) => (\n <button\n aria-label={`Go to slide ${index + 1}`}\n className={`${styles.indicator} ${index === currentIndex ? styles.indicatorActive : ''}`}\n key={index}\n onClick={() => goToSlide(index)}\n type='button'\n />\n ))}\n </div>\n )}\n </div>\n )\n}\n\nexport default Carousel\n"],"names":["styleInject","css","ref","insertAt","document","head","getElementsByTagName","style","createElement","type","firstChild","insertBefore","appendChild","styleSheet","cssText","createTextNode","DEFAULT_ITEMS","src","alt","ChevronLeft","_jsxs","fill","height","stroke","strokeWidth","viewBox","width","children","_jsx","d","ChevronRight","Carousel","items","autoPlay","interval","showNav","showIndicators","loop","externalStyle","currentIndex","setCurrentIndex","useState","goToNext","useCallback","prev","length","goToPrev","goToSlide","index","useEffect","timer","setInterval","clearInterval","className","styles","container","track","transform","map","item","slide","link","href","rel","target","slideImage","draggable","_Fragment","navButton","navButtonPrev","onClick","navButtonNext","indicators","_","indicator","indicatorActive"],"mappings":";;;;;;;EAAA,SAASA,WAAWA,CAACC,GAAG,EAAEC,GAAG,EAAE;IAC7B,IAAKA,GAAG,KAAK,MAAM,EAAGA,GAAG,GAAG,EAAE;EAC9B,EAAA,IAAIC,QAAQ,GAAGD,GAAG,CAACC,QAAQ;EAE3B,EAAA,IAAY,OAAOC,QAAQ,KAAK,WAAW,EAAE;EAAE,IAAA;EAAQ,EAAA;EAEvD,EAAA,IAAIC,IAAI,GAAGD,QAAQ,CAACC,IAAI,IAAID,QAAQ,CAACE,oBAAoB,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;EACpE,EAAA,IAAIC,KAAK,GAAGH,QAAQ,CAACI,aAAa,CAAC,OAAO,CAAC;IAC3CD,KAAK,CAACE,IAAI,GAAG,UAAU;IAEvB,IAAIN,QAAQ,KAAK,KAAK,EAAE;MACtB,IAAIE,IAAI,CAACK,UAAU,EAAE;QACnBL,IAAI,CAACM,YAAY,CAACJ,KAAK,EAAEF,IAAI,CAACK,UAAU,CAAC;EAC3C,IAAA,CAAC,MAAM;EACLL,MAAAA,IAAI,CAACO,WAAW,CAACL,KAAK,CAAC;EACzB,IAAA;EACF,EAAA,CAAC,MAAM;EACLF,IAAAA,IAAI,CAACO,WAAW,CAACL,KAAK,CAAC;EACzB,EAAA;IAEA,IAAIA,KAAK,CAACM,UAAU,EAAE;EACpB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EAAAkB,QAAAA,QAAA,eAEbC,cAAA,CAACE,YAAY,EAAA,EAAE;EAAC,OACV,CAAC;OACT,CACH,EAGAM,cAAc,IAAIJ,KAAK,CAACa,MAAM,GAAG,CAAC,iBACjCjB,cAAA,CAAA,KAAA,EAAA;QAAKyB,SAAS,EAAEC,MAAM,CAACkB,UAAW;QAAA7C,QAAA,EAC/BK,KAAK,CAAC0B,GAAG,CAAC,CAACe,CAAC,EAAEzB,KAAK,kBAClBpB,cAAA,CAAA,QAAA,EAAA;EACE,QAAA,YAAA,EAAY,CAAA,YAAA,EAAeoB,KAAK,GAAG,CAAC,CAAA,CAAG;EACvCK,QAAAA,SAAS,EAAE,CAAA,EAAGC,MAAM,CAACoB,SAAS,CAAA,CAAA,EAAI1B,KAAK,KAAKT,YAAY,GAAGe,MAAM,CAACqB,eAAe,GAAG,EAAE,CAAA,CAAG;EAEzFL,QAAAA,OAAO,EAAEA,MAAMvB,SAAS,CAACC,KAAK,CAAE;EAChCvC,QAAAA,IAAI,EAAC;EAAQ,OAAA,EAFRuC,KAGN,CACF;EAAC,KACC,CACN;EAAA,GACE,CAAC;EAEV;;;;;;;;;;;","x_google_ignoreList":[0]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"component.min.js","sources":["../../../../../node_modules/.pnpm/style-inject@0.3.0/node_modules/style-inject/dist/style-inject.es.js","../src/component.tsx"],"sourcesContent":["function styleInject(css, ref) {\n if ( ref === void 0 ) ref = {};\n var insertAt = ref.insertAt;\n\n if (!css || typeof document === 'undefined') { return; }\n\n var head = document.head || document.getElementsByTagName('head')[0];\n var style = document.createElement('style');\n style.type = 'text/css';\n\n if (insertAt === 'top') {\n if (head.firstChild) {\n head.insertBefore(style, head.firstChild);\n } else {\n head.appendChild(style);\n }\n } else {\n head.appendChild(style);\n }\n\n if (style.styleSheet) {\n style.styleSheet.cssText = css;\n } else {\n style.appendChild(document.createTextNode(css));\n }\n}\n\nexport default styleInject;\n","/**\n * Carousel Component\n * 轮播组件\n */\n\nimport { useState, useEffect, useCallback, type CSSProperties, type Ref } from 'react'\nimport styles from './component.module.css'\n\nexport interface CarouselItem {\n /** 图片地址 */\n src: string\n /** 图片描述 */\n alt?: string\n /** 点击链接 */\n link?: string\n}\n\nexport interface CarouselProps {\n ref?: Ref<HTMLDivElement>\n /** 轮播项 */\n items?: CarouselItem[]\n /** 自动播放 */\n autoPlay?: boolean\n /** 自动播放间隔(毫秒) */\n interval?: number\n /** 是否显示导航按钮 */\n showNav?: boolean\n /** 是否显示指示器 */\n showIndicators?: boolean\n /** 是否循环播放 */\n loop?: boolean\n /** 外部样式 */\n style?: CSSProperties\n}\n\nconst DEFAULT_ITEMS: CarouselItem[] = [\n { src: 'https://picsum.photos/800/400?random=1', alt: 'Slide 1' },\n { src: 'https://picsum.photos/800/400?random=2', alt: 'Slide 2' },\n { src: 'https://picsum.photos/800/400?random=3', alt: 'Slide 3' },\n]\n\nconst ChevronLeft = () => (\n <svg aria-hidden='true' fill='none' height='24' stroke='currentColor' strokeWidth='2' viewBox='0 0 24 24' width='24'>\n <title>Previous</title>\n <path d='M15 18l-6-6 6-6' />\n </svg>\n)\n\nconst ChevronRight = () => (\n <svg aria-hidden='true' fill='none' height='24' stroke='currentColor' strokeWidth='2' viewBox='0 0 24 24' width='24'>\n <title>Next</title>\n <path d='M9 18l6-6-6-6' />\n </svg>\n)\n\nexport const Carousel: React.FC<CarouselProps> = ({\n ref,\n items = DEFAULT_ITEMS,\n autoPlay = true,\n interval = 3000,\n showNav = true,\n showIndicators = true,\n loop = true,\n style: externalStyle,\n}) => {\n const [currentIndex, setCurrentIndex] = useState(0)\n\n const goToNext = useCallback(() => {\n setCurrentIndex(prev => {\n if (prev >= items.length - 1) {\n return loop ? 0 : prev\n }\n return prev + 1\n })\n }, [items.length, loop])\n\n const goToPrev = useCallback(() => {\n setCurrentIndex(prev => {\n if (prev <= 0) {\n return loop ? items.length - 1 : prev\n }\n return prev - 1\n })\n }, [items.length, loop])\n\n const goToSlide = useCallback((index: number) => {\n setCurrentIndex(index)\n }, [])\n\n // 自动播放\n useEffect(() => {\n if (!autoPlay || items.length <= 1) {\n return\n }\n\n const timer = setInterval(goToNext, interval)\n return () => clearInterval(timer)\n }, [autoPlay, interval, goToNext, items.length])\n\n if (items.length === 0) {\n return null\n }\n\n return (\n <div className={styles.container} ref={ref} style={externalStyle}>\n <div className={styles.track} style={{ transform: `translateX(-${currentIndex * 100}%)` }}>\n {items.map((item, index) => (\n <div className={styles.slide} key={index}>\n {item.link ? (\n <a href={item.link} rel='noopener noreferrer' target='_blank'>\n <img\n alt={item.alt || ''}\n className={styles.slideImage}\n draggable={false}\n height='200'\n src={item.src}\n width='100%'\n />\n </a>\n ) : (\n <img\n alt={item.alt || ''}\n className={styles.slideImage}\n draggable={false}\n height='200'\n src={item.src}\n width='100%'\n />\n )}\n </div>\n ))}\n </div>\n\n {/* 导航按钮 */}\n {showNav && items.length > 1 && (\n <>\n <button\n aria-label='Previous slide'\n className={`${styles.navButton} ${styles.navButtonPrev}`}\n onClick={goToPrev}\n type='button'\n >\n <ChevronLeft />\n </button>\n <button\n aria-label='Next slide'\n className={`${styles.navButton} ${styles.navButtonNext}`}\n onClick={goToNext}\n type='button'\n >\n <ChevronRight />\n </button>\n </>\n )}\n\n {/* 指示器 */}\n {showIndicators && items.length > 1 && (\n <div className={styles.indicators}>\n {items.map((_, index) => (\n <button\n aria-label={`Go to slide ${index + 1}`}\n className={`${styles.indicator} ${index === currentIndex ? styles.indicatorActive : ''}`}\n key={index}\n onClick={() => goToSlide(index)}\n type='button'\n />\n ))}\n </div>\n )}\n </div>\n )\n}\n\nexport default Carousel\n"],"names":["css","ref","insertAt","document","head","getElementsByTagName","style","createElement","type","firstChild","insertBefore","appendChild","styleSheet","cssText","createTextNode","DEFAULT_ITEMS","src","alt","ChevronLeft","_jsxs","fill","height","stroke","strokeWidth","viewBox","width","children","_jsx","d","ChevronRight","Carousel","items","autoPlay","interval","showNav","showIndicators","loop","externalStyle","currentIndex","setCurrentIndex","useState","goToNext","useCallback","prev","length","goToPrev","goToSlide","index","useEffect","timer","setInterval","clearInterval","className","styles","transform","map","item","link","href","rel","target","draggable","_Fragment","onClick","_"],"mappings":"2wBAAA,SAAqBA,EAAKC,QACX,IAARA,IAAiBA,EAAM,CAAA,GAC5B,IAAIC,EAAWD,EAAIC,SAEnB,GAAgC,oBAAbC,SAAnB,CAEA,IAAIC,EAAOD,SAASC,MAAQD,SAASE,qBAAqB,QAAQ,GAC9DC,EAAQH,SAASI,cAAc,SACnCD,EAAME,KAAO,WAEI,QAAbN,GACEE,EAAKK,WACPL,EAAKM,aAAaJ,EAAOF,EAAKK,YAKhCL,EAAKO,YAAYL,GAGfA,EAAMM,WACRN,EAAMM,WAAWC,QAAUb,EAE3BM,EAAMK,YAAYR,SAASW,eAAed,GAnBW,CAqBzD,izCCUA,MAAMe,EAAgC,CACpC,CAAEC,IAAK,yCAA0CC,IAAK,WACtD,CAAED,IAAK,yCAA0CC,IAAK,WACtD,CAAED,IAAK,yCAA0CC,IAAK,YAGlDC,EAAcA,IAClBC,EAAAA,KAAA,MAAA,CAAK,cAAY,OAAOC,KAAK,OAAOC,OAAO,KAAKC,OAAO,eAAeC,YAAY,IAAIC,QAAQ,YAAYC,MAAM,KAAIC,UAClHC,EAAAA,IAAA,QAAA,CAAAD,SAAO,aACPC,EAAAA,IAAA,OAAA,CAAMC,EAAE,uBAINC,EAAeA,IACnBV,EAAAA,KAAA,MAAA,CAAK,cAAY,OAAOC,KAAK,OAAOC,OAAO,KAAKC,OAAO,eAAeC,YAAY,IAAIC,QAAQ,YAAYC,MAAM,KAAIC,UAClHC,EAAAA,IAAA,QAAA,CAAAD,SAAO,SACPC,EAAAA,IAAA,OAAA,CAAMC,EAAE,qBAICE,EAAoCA,EAC/C7B,MACA8B,QAAQhB,EACRiB,YAAW,EACXC,WAAW,IACXC,WAAU,EACVC,kBAAiB,EACjBC,QAAO,EACP9B,MAAO+B,MAEP,MAAOC,EAAcC,GAAmBC,EA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,WAAA,CAAApC,UACEC,EAAAA,IAAA,SAAA,CACE,aAAW,iBACXyB,UAAW,GAAGC,KAAoBA,IAClCU,QAASlB,EACTrC,KAAK,SAAQkB,SAEbC,EAAAA,IAACT,EAAW,CAAA,KAEdS,EAAAA,IAAA,SAAA,CACE,aAAW,aACXyB,UAAW,GAAGC,KAAoBA,IAClCU,QAAStB,EACTjC,KAAK,SAAQkB,SAEbC,EAAAA,IAACE,EAAY,CAAA,QAMlBM,GAAkBJ,EAAMa,OAAS,GAChCjB,EAAAA,IAAA,MAAA,CAAKyB,UAAWC,EAAkB3B,SAC/BK,EAAMwB,IAAI,CAACS,EAAGjB,IACbpB,EAAAA,IAAA,SAAA,CACE,aAAY,eAAeoB,EAAQ,IACnCK,UAAW,GAAGC,KAAoBN,IAAUT,EAAee,EAAyB,KAEpFU,QAASA,IAAMjB,EAAUC,GACzBvC,KAAK,UAFAuC","x_google_ignoreList":[0]}
package/dist/index.cjs DELETED
@@ -1,418 +0,0 @@
1
- 'use strict';
2
-
3
- var react = require('react');
4
- var jsxRuntime = require('react/jsx-runtime');
5
-
6
- function styleInject(css, ref) {
7
- if (ref === void 0) ref = {};
8
- var insertAt = ref.insertAt;
9
- if (typeof document === 'undefined') {
10
- return;
11
- }
12
- var head = document.head || document.getElementsByTagName('head')[0];
13
- var style = document.createElement('style');
14
- style.type = 'text/css';
15
- if (insertAt === 'top') {
16
- if (head.firstChild) {
17
- head.insertBefore(style, head.firstChild);
18
- } else {
19
- head.appendChild(style);
20
- }
21
- } else {
22
- head.appendChild(style);
23
- }
24
- if (style.styleSheet) {
25
- style.styleSheet.cssText = css;
26
- } else {
27
- style.appendChild(document.createTextNode(css));
28
- }
29
- }
30
-
31
- var css_248z = ".component-module__container___VbZSk{border-radius:8px;height:100%;overflow:hidden;position:relative;width:100%}.component-module__track___I-5nr{display:flex;height:100%;transition:transform .5s ease}.component-module__slide___7N5m5{align-items:center;display:flex;flex:0 0 100%;height:100%;justify-content:center;width:100%}.component-module__slideImage___CJ8fn{height:100%;object-fit:cover;width:100%}.component-module__navButton___0CqxY{align-items:center;background:rgba(0,0,0,.5);border:none;border-radius:50%;color:#fff;cursor:pointer;display:flex;height:40px;justify-content:center;position:absolute;top:50%;transform:translateY(-50%);transition:background .3s ease;width:40px;z-index:10}.component-module__navButton___0CqxY:hover{background:rgba(0,0,0,.7)}.component-module__navButtonPrev___qAqle{left:16px}.component-module__navButtonNext___yYw7n{right:16px}.component-module__indicators___WMttK{bottom:16px;display:flex;gap:8px;left:50%;position:absolute;transform:translateX(-50%);z-index:10}.component-module__indicator___KYoys{background:hsla(0,0%,100%,.4);border:none;border-radius:50%;cursor:pointer;height:8px;padding:0;transition:all .3s ease;width:8px}.component-module__indicatorActive___ws6eP{background:#fff;transform:scale(1.2)}.component-module__indicator___KYoys:hover{background:hsla(0,0%,100%,.7)}";
32
- var styles = {"container":"component-module__container___VbZSk","track":"component-module__track___I-5nr","slide":"component-module__slide___7N5m5","slideImage":"component-module__slideImage___CJ8fn","navButton":"component-module__navButton___0CqxY","navButtonPrev":"component-module__navButtonPrev___qAqle","navButtonNext":"component-module__navButtonNext___yYw7n","indicators":"component-module__indicators___WMttK","indicator":"component-module__indicator___KYoys","indicatorActive":"component-module__indicatorActive___ws6eP"};
33
- styleInject(css_248z);
34
-
35
- /**
36
- * Carousel Component
37
- * 轮播组件
38
- */
39
-
40
- const DEFAULT_ITEMS = [{
41
- src: 'https://picsum.photos/800/400?random=1',
42
- alt: 'Slide 1'
43
- }, {
44
- src: 'https://picsum.photos/800/400?random=2',
45
- alt: 'Slide 2'
46
- }, {
47
- src: 'https://picsum.photos/800/400?random=3',
48
- alt: 'Slide 3'
49
- }];
50
- const ChevronLeft = () => /*#__PURE__*/jsxRuntime.jsxs("svg", {
51
- "aria-hidden": "true",
52
- fill: "none",
53
- height: "24",
54
- stroke: "currentColor",
55
- strokeWidth: "2",
56
- viewBox: "0 0 24 24",
57
- width: "24",
58
- children: [/*#__PURE__*/jsxRuntime.jsx("title", {
59
- children: "Previous"
60
- }), /*#__PURE__*/jsxRuntime.jsx("path", {
61
- d: "M15 18l-6-6 6-6"
62
- })]
63
- });
64
- const ChevronRight = () => /*#__PURE__*/jsxRuntime.jsxs("svg", {
65
- "aria-hidden": "true",
66
- fill: "none",
67
- height: "24",
68
- stroke: "currentColor",
69
- strokeWidth: "2",
70
- viewBox: "0 0 24 24",
71
- width: "24",
72
- children: [/*#__PURE__*/jsxRuntime.jsx("title", {
73
- children: "Next"
74
- }), /*#__PURE__*/jsxRuntime.jsx("path", {
75
- d: "M9 18l6-6-6-6"
76
- })]
77
- });
78
- const Carousel = ({
79
- ref,
80
- items = DEFAULT_ITEMS,
81
- autoPlay = true,
82
- interval = 3000,
83
- showNav = true,
84
- showIndicators = true,
85
- loop = true,
86
- style: externalStyle
87
- }) => {
88
- const [currentIndex, setCurrentIndex] = react.useState(0);
89
- const goToNext = react.useCallback(() => {
90
- setCurrentIndex(prev => {
91
- if (prev >= items.length - 1) {
92
- return loop ? 0 : prev;
93
- }
94
- return prev + 1;
95
- });
96
- }, [items.length, loop]);
97
- const goToPrev = react.useCallback(() => {
98
- setCurrentIndex(prev => {
99
- if (prev <= 0) {
100
- return loop ? items.length - 1 : prev;
101
- }
102
- return prev - 1;
103
- });
104
- }, [items.length, loop]);
105
- const goToSlide = react.useCallback(index => {
106
- setCurrentIndex(index);
107
- }, []);
108
-
109
- // 自动播放
110
- react.useEffect(() => {
111
- if (!autoPlay || items.length <= 1) {
112
- return;
113
- }
114
- const timer = setInterval(goToNext, interval);
115
- return () => clearInterval(timer);
116
- }, [autoPlay, interval, goToNext, items.length]);
117
- if (items.length === 0) {
118
- return null;
119
- }
120
- return /*#__PURE__*/jsxRuntime.jsxs("div", {
121
- className: styles.container,
122
- ref: ref,
123
- style: externalStyle,
124
- children: [/*#__PURE__*/jsxRuntime.jsx("div", {
125
- className: styles.track,
126
- style: {
127
- transform: `translateX(-${currentIndex * 100}%)`
128
- },
129
- children: items.map((item, index) => /*#__PURE__*/jsxRuntime.jsx("div", {
130
- className: styles.slide,
131
- children: item.link ? /*#__PURE__*/jsxRuntime.jsx("a", {
132
- href: item.link,
133
- rel: "noopener noreferrer",
134
- target: "_blank",
135
- children: /*#__PURE__*/jsxRuntime.jsx("img", {
136
- alt: item.alt || '',
137
- className: styles.slideImage,
138
- draggable: false,
139
- height: "200",
140
- src: item.src,
141
- width: "100%"
142
- })
143
- }) : /*#__PURE__*/jsxRuntime.jsx("img", {
144
- alt: item.alt || '',
145
- className: styles.slideImage,
146
- draggable: false,
147
- height: "200",
148
- src: item.src,
149
- width: "100%"
150
- })
151
- }, index))
152
- }), showNav && items.length > 1 && /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
153
- children: [/*#__PURE__*/jsxRuntime.jsx("button", {
154
- "aria-label": "Previous slide",
155
- className: `${styles.navButton} ${styles.navButtonPrev}`,
156
- onClick: goToPrev,
157
- type: "button",
158
- children: /*#__PURE__*/jsxRuntime.jsx(ChevronLeft, {})
159
- }), /*#__PURE__*/jsxRuntime.jsx("button", {
160
- "aria-label": "Next slide",
161
- className: `${styles.navButton} ${styles.navButtonNext}`,
162
- onClick: goToNext,
163
- type: "button",
164
- children: /*#__PURE__*/jsxRuntime.jsx(ChevronRight, {})
165
- })]
166
- }), showIndicators && items.length > 1 && /*#__PURE__*/jsxRuntime.jsx("div", {
167
- className: styles.indicators,
168
- children: items.map((_, index) => /*#__PURE__*/jsxRuntime.jsx("button", {
169
- "aria-label": `Go to slide ${index + 1}`,
170
- className: `${styles.indicator} ${index === currentIndex ? styles.indicatorActive : ''}`,
171
- onClick: () => goToSlide(index),
172
- type: "button"
173
- }, index))
174
- })]
175
- });
176
- };
177
-
178
- const MaterialGroup = {
179
- DISPLAY: 'display'};
180
-
181
- const COMPONENT_NAME = 'EasyEditorMaterialsCarousel';
182
- const PACKAGE_NAME = '@easy-editor/materials-dashboard-carousel';
183
-
184
- const configure = {
185
- props: [{
186
- type: 'group',
187
- title: '属性',
188
- setter: 'TabSetter',
189
- items: [{
190
- type: 'group',
191
- key: 'config',
192
- title: '配置',
193
- setter: {
194
- componentName: 'CollapseSetter',
195
- props: {
196
- icon: false
197
- }
198
- },
199
- items: [
200
- {
201
- name: 'id',
202
- title: 'ID',
203
- setter: 'NodeIdSetter',
204
- extraProps: {
205
- label: false
206
- }
207
- }, {
208
- name: 'title',
209
- title: '标题',
210
- setter: 'StringSetter',
211
- extraProps: {
212
- getValue(target) {
213
- return target.getExtraPropValue('title');
214
- },
215
- setValue(target, value) {
216
- target.setExtraPropValue('title', value);
217
- }
218
- }
219
- }, {
220
- type: 'group',
221
- title: '基础属性',
222
- setter: {
223
- componentName: 'CollapseSetter',
224
- props: {
225
- icon: false
226
- }
227
- },
228
- items: [{
229
- name: 'rect',
230
- title: '位置尺寸',
231
- setter: 'RectSetter',
232
- extraProps: {
233
- getValue(target) {
234
- return target.getExtraPropValue('$dashboard.rect');
235
- },
236
- setValue(target, value) {
237
- target.setExtraPropValue('$dashboard.rect', value);
238
- }
239
- }
240
- }]
241
- },
242
- {
243
- type: 'group',
244
- title: '数据',
245
- setter: {
246
- componentName: 'CollapseSetter',
247
- props: {
248
- icon: false
249
- }
250
- },
251
- items: [{
252
- name: 'items',
253
- title: '轮播项',
254
- setter: 'JsonSetter'
255
- }]
256
- }, {
257
- type: 'group',
258
- title: '行为',
259
- setter: {
260
- componentName: 'CollapseSetter',
261
- props: {
262
- icon: false
263
- }
264
- },
265
- items: [{
266
- name: 'autoPlay',
267
- title: '自动播放',
268
- setter: 'SwitchSetter',
269
- extraProps: {
270
- defaultValue: true
271
- }
272
- }, {
273
- name: 'interval',
274
- title: '播放间隔(ms)',
275
- setter: 'NumberSetter',
276
- extraProps: {
277
- defaultValue: 3000
278
- }
279
- }, {
280
- name: 'loop',
281
- title: '循环播放',
282
- setter: 'SwitchSetter',
283
- extraProps: {
284
- defaultValue: true
285
- }
286
- }]
287
- }, {
288
- type: 'group',
289
- title: '显示',
290
- setter: {
291
- componentName: 'CollapseSetter',
292
- props: {
293
- icon: false
294
- }
295
- },
296
- items: [{
297
- name: 'showNav',
298
- title: '显示导航按钮',
299
- setter: 'SwitchSetter',
300
- extraProps: {
301
- defaultValue: true
302
- }
303
- }, {
304
- name: 'showIndicators',
305
- title: '显示指示器',
306
- setter: 'SwitchSetter',
307
- extraProps: {
308
- defaultValue: true
309
- }
310
- }]
311
- }]
312
- }, {
313
- type: 'group',
314
- key: 'data',
315
- title: '数据',
316
- items: [{
317
- name: 'dataBinding',
318
- title: '数据绑定',
319
- setter: 'DataBindingSetter'
320
- }]
321
- }, {
322
- type: 'group',
323
- key: 'advanced',
324
- title: '高级',
325
- items: [{
326
- name: 'condition',
327
- title: '显隐控制',
328
- setter: 'SwitchSetter',
329
- extraProps: {
330
- defaultValue: true,
331
- supportVariable: true
332
- }
333
- }]
334
- }]
335
- }],
336
- component: {},
337
- supports: {},
338
- advanced: {}
339
- };
340
-
341
- const snippets = [{
342
- title: '图片轮播',
343
- screenshot: '',
344
- schema: {
345
- componentName: COMPONENT_NAME,
346
- props: {
347
- items: [{
348
- src: 'https://picsum.photos/800/400?random=1',
349
- alt: 'Slide 1'
350
- }, {
351
- src: 'https://picsum.photos/800/400?random=2',
352
- alt: 'Slide 2'
353
- }, {
354
- src: 'https://picsum.photos/800/400?random=3',
355
- alt: 'Slide 3'
356
- }],
357
- autoPlay: true,
358
- interval: 3000,
359
- showNav: true,
360
- showIndicators: true,
361
- loop: true
362
- },
363
- $dashboard: {
364
- rect: {
365
- width: 600,
366
- height: 300
367
- }
368
- }
369
- }
370
- }, {
371
- title: '手动轮播',
372
- screenshot: '',
373
- schema: {
374
- componentName: COMPONENT_NAME,
375
- props: {
376
- items: [{
377
- src: 'https://picsum.photos/800/400?random=4',
378
- alt: 'Slide 1'
379
- }, {
380
- src: 'https://picsum.photos/800/400?random=5',
381
- alt: 'Slide 2'
382
- }],
383
- autoPlay: false,
384
- showNav: true,
385
- showIndicators: true,
386
- loop: true
387
- },
388
- $dashboard: {
389
- rect: {
390
- width: 600,
391
- height: 300
392
- }
393
- }
394
- }
395
- }];
396
-
397
- var version = "0.0.2";
398
- var pkg = {
399
- version: version};
400
-
401
- const meta = {
402
- componentName: COMPONENT_NAME,
403
- title: '轮播',
404
- group: MaterialGroup.DISPLAY,
405
- devMode: 'proCode',
406
- npm: {
407
- package: PACKAGE_NAME,
408
- version: pkg.version,
409
- globalName: COMPONENT_NAME,
410
- componentName: COMPONENT_NAME
411
- },
412
- snippets,
413
- configure
414
- };
415
-
416
- exports.component = Carousel;
417
- exports.meta = meta;
418
- //# sourceMappingURL=index.cjs.map