@nuralyui/carousel 0.0.3
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/carousel.component.d.ts +19 -0
- package/carousel.component.d.ts.map +1 -0
- package/carousel.component.js +128 -0
- package/carousel.component.js.map +1 -0
- package/carousel.style.d.ts +2 -0
- package/carousel.style.d.ts.map +1 -0
- package/carousel.style.js +68 -0
- package/carousel.style.js.map +1 -0
- package/demo/carousel-demo.d.ts +6 -0
- package/demo/carousel-demo.d.ts.map +1 -0
- package/demo/carousel-demo.js +68 -0
- package/demo/carousel-demo.js.map +1 -0
- package/index.d.ts +2 -0
- package/index.d.ts.map +1 -0
- package/index.js +2 -0
- package/index.js.map +1 -0
- package/package.json +12 -0
- package/react.d.ts +5 -0
- package/react.d.ts.map +1 -0
- package/react.js +12 -0
- package/react.js.map +1 -0
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { LitElement } from 'lit';
|
|
2
|
+
export declare class CarouselComponent extends LitElement {
|
|
3
|
+
static styles: import("lit").CSSResult;
|
|
4
|
+
currentIndex: number;
|
|
5
|
+
autoPlay: boolean;
|
|
6
|
+
autoplaySpeed: number;
|
|
7
|
+
private slideElements;
|
|
8
|
+
private displayedElements;
|
|
9
|
+
private intervalId;
|
|
10
|
+
firstUpdated(): void;
|
|
11
|
+
startAutoPlay(): void;
|
|
12
|
+
stopAutoPlay(): void;
|
|
13
|
+
next(): void;
|
|
14
|
+
prev(): void;
|
|
15
|
+
goTo(index: number): void;
|
|
16
|
+
disconnectedCallback(): void;
|
|
17
|
+
render(): import("lit").TemplateResult<1>;
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=carousel.component.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"carousel.component.d.ts","sourceRoot":"","sources":["../../../src/components/carousel/carousel.component.ts"],"names":[],"mappings":"AAAA,OAAO,EAAO,UAAU,EAAU,MAAM,KAAK,CAAC;AAK9C,qBACa,iBAAkB,SAAQ,UAAU;IAC/C,OAAgB,MAAM,0BAAU;IAEpB,YAAY,SAAK;IACjB,QAAQ,UAAS;IACjB,aAAa,SAAQ;IAEjC,OAAO,CAAC,aAAa,CAAiB;IAEtC,OAAO,CAAC,iBAAiB,CAAiB;IAC1C,OAAO,CAAC,UAAU,CAAuB;IAEhC,YAAY;IAYrB,aAAa;IAMb,YAAY;IAOZ,IAAI;IAUJ,IAAI;IAUJ,IAAI,CAAC,KAAK,EAAE,MAAM;IAMT,oBAAoB;IAKpB,MAAM;CAyChB"}
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
import { html, LitElement, nothing } from 'lit';
|
|
8
|
+
import { styles } from './carousel.style.js';
|
|
9
|
+
import { customElement, property, queryAssignedElements, state } from 'lit/decorators.js';
|
|
10
|
+
import { repeat } from 'lit/directives/repeat.js';
|
|
11
|
+
let CarouselComponent = class CarouselComponent extends LitElement {
|
|
12
|
+
constructor() {
|
|
13
|
+
super(...arguments);
|
|
14
|
+
this.currentIndex = 0;
|
|
15
|
+
this.autoPlay = false;
|
|
16
|
+
this.autoplaySpeed = 3000;
|
|
17
|
+
this.intervalId = null;
|
|
18
|
+
}
|
|
19
|
+
firstUpdated() {
|
|
20
|
+
this.displayedElements = this.slideElements.map((element, index) => {
|
|
21
|
+
if (index != this.currentIndex) {
|
|
22
|
+
element.classList.add('carousel-item-hidden');
|
|
23
|
+
}
|
|
24
|
+
return element;
|
|
25
|
+
});
|
|
26
|
+
if (this.autoPlay) {
|
|
27
|
+
this.startAutoPlay();
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
startAutoPlay() {
|
|
31
|
+
this.intervalId = window.setInterval(() => {
|
|
32
|
+
this.next();
|
|
33
|
+
}, this.autoplaySpeed);
|
|
34
|
+
}
|
|
35
|
+
stopAutoPlay() {
|
|
36
|
+
if (this.intervalId) {
|
|
37
|
+
clearInterval(this.intervalId);
|
|
38
|
+
this.intervalId = null;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
next() {
|
|
42
|
+
this.displayedElements[this.currentIndex].classList.add('carousel-item-hidden');
|
|
43
|
+
if (this.displayedElements.length - 1 == this.currentIndex) {
|
|
44
|
+
this.currentIndex = 0;
|
|
45
|
+
}
|
|
46
|
+
else {
|
|
47
|
+
this.currentIndex++;
|
|
48
|
+
}
|
|
49
|
+
this.displayedElements[this.currentIndex].classList.remove('carousel-item-hidden');
|
|
50
|
+
}
|
|
51
|
+
prev() {
|
|
52
|
+
this.displayedElements[this.currentIndex].classList.add('carousel-item-hidden');
|
|
53
|
+
if (this.currentIndex == 0) {
|
|
54
|
+
this.currentIndex = this.displayedElements.length - 1;
|
|
55
|
+
}
|
|
56
|
+
else {
|
|
57
|
+
this.currentIndex--;
|
|
58
|
+
}
|
|
59
|
+
this.displayedElements[this.currentIndex].classList.remove('carousel-item-hidden');
|
|
60
|
+
}
|
|
61
|
+
goTo(index) {
|
|
62
|
+
this.displayedElements[this.currentIndex].classList.add('carousel-item-hidden');
|
|
63
|
+
this.currentIndex = index;
|
|
64
|
+
this.displayedElements[this.currentIndex].classList.remove('carousel-item-hidden');
|
|
65
|
+
}
|
|
66
|
+
disconnectedCallback() {
|
|
67
|
+
super.disconnectedCallback();
|
|
68
|
+
this.stopAutoPlay();
|
|
69
|
+
}
|
|
70
|
+
render() {
|
|
71
|
+
var _a;
|
|
72
|
+
return html `
|
|
73
|
+
<div class="carousel">
|
|
74
|
+
<slot></slot>
|
|
75
|
+
${!this.autoPlay
|
|
76
|
+
? html `
|
|
77
|
+
<div class="controls">
|
|
78
|
+
<hy-button
|
|
79
|
+
@click="${this.prev}"
|
|
80
|
+
type="ghost"
|
|
81
|
+
size="small"
|
|
82
|
+
class="button-control"
|
|
83
|
+
.icon="${['chevron-left']}"
|
|
84
|
+
></hy-button>
|
|
85
|
+
<hy-button
|
|
86
|
+
@click="${this.next}"
|
|
87
|
+
type="ghost"
|
|
88
|
+
size="small"
|
|
89
|
+
class="button-control"
|
|
90
|
+
.icon="${['chevron-right']}"
|
|
91
|
+
></hy-button>
|
|
92
|
+
</div>
|
|
93
|
+
`
|
|
94
|
+
: nothing}
|
|
95
|
+
|
|
96
|
+
<div class="dots">
|
|
97
|
+
${repeat(Array.from({ length: (_a = this.displayedElements) === null || _a === void 0 ? void 0 : _a.length }), (_, index) => html `
|
|
98
|
+
<span
|
|
99
|
+
class="dot ${index === this.currentIndex ? 'active' : ''}"
|
|
100
|
+
@click="${() => this.goTo(index)}"
|
|
101
|
+
></span>
|
|
102
|
+
`)}
|
|
103
|
+
</div
|
|
104
|
+
</div>
|
|
105
|
+
`;
|
|
106
|
+
}
|
|
107
|
+
};
|
|
108
|
+
CarouselComponent.styles = styles;
|
|
109
|
+
__decorate([
|
|
110
|
+
property()
|
|
111
|
+
], CarouselComponent.prototype, "currentIndex", void 0);
|
|
112
|
+
__decorate([
|
|
113
|
+
property()
|
|
114
|
+
], CarouselComponent.prototype, "autoPlay", void 0);
|
|
115
|
+
__decorate([
|
|
116
|
+
property()
|
|
117
|
+
], CarouselComponent.prototype, "autoplaySpeed", void 0);
|
|
118
|
+
__decorate([
|
|
119
|
+
queryAssignedElements()
|
|
120
|
+
], CarouselComponent.prototype, "slideElements", void 0);
|
|
121
|
+
__decorate([
|
|
122
|
+
state()
|
|
123
|
+
], CarouselComponent.prototype, "displayedElements", void 0);
|
|
124
|
+
CarouselComponent = __decorate([
|
|
125
|
+
customElement('hy-carousel')
|
|
126
|
+
], CarouselComponent);
|
|
127
|
+
export { CarouselComponent };
|
|
128
|
+
//# sourceMappingURL=carousel.component.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"carousel.component.js","sourceRoot":"","sources":["../../../src/components/carousel/carousel.component.ts"],"names":[],"mappings":"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","sourcesContent":["import {html, LitElement, nothing} from 'lit';\nimport {styles} from './carousel.style.js';\nimport {customElement, property, queryAssignedElements, state} from 'lit/decorators.js';\nimport {repeat} from 'lit/directives/repeat.js';\n\n@customElement('hy-carousel')\nexport class CarouselComponent extends LitElement {\n static override styles = styles;\n\n @property() currentIndex = 0;\n @property() autoPlay = false;\n @property() autoplaySpeed = 3000;\n @queryAssignedElements()\n private slideElements!: HTMLElement[];\n @state()\n private displayedElements!: HTMLElement[];\n private intervalId: number | null = null;\n\n override firstUpdated() {\n this.displayedElements = this.slideElements.map((element, index) => {\n if (index != this.currentIndex) {\n element.classList.add('carousel-item-hidden');\n }\n return element;\n });\n if (this.autoPlay) {\n this.startAutoPlay();\n }\n }\n\n startAutoPlay() {\n this.intervalId = window.setInterval(() => {\n this.next();\n }, this.autoplaySpeed);\n }\n\n stopAutoPlay() {\n if (this.intervalId) {\n clearInterval(this.intervalId);\n this.intervalId = null;\n }\n }\n\n next() {\n this.displayedElements[this.currentIndex].classList.add('carousel-item-hidden');\n if (this.displayedElements.length - 1 == this.currentIndex) {\n this.currentIndex = 0;\n } else {\n this.currentIndex++;\n }\n this.displayedElements[this.currentIndex].classList.remove('carousel-item-hidden');\n }\n\n prev() {\n this.displayedElements[this.currentIndex].classList.add('carousel-item-hidden');\n if (this.currentIndex == 0) {\n this.currentIndex = this.displayedElements.length - 1;\n } else {\n this.currentIndex--;\n }\n this.displayedElements[this.currentIndex].classList.remove('carousel-item-hidden');\n }\n\n goTo(index: number) {\n this.displayedElements[this.currentIndex].classList.add('carousel-item-hidden');\n this.currentIndex = index;\n this.displayedElements[this.currentIndex].classList.remove('carousel-item-hidden');\n }\n\n override disconnectedCallback() {\n super.disconnectedCallback();\n this.stopAutoPlay();\n }\n\n override render() {\n return html`\n <div class=\"carousel\">\n <slot></slot>\n ${\n !this.autoPlay\n ? html`\n <div class=\"controls\">\n <hy-button\n @click=\"${this.prev}\"\n type=\"ghost\"\n size=\"small\"\n class=\"button-control\"\n .icon=\"${['chevron-left']}\"\n ></hy-button>\n <hy-button\n @click=\"${this.next}\"\n type=\"ghost\"\n size=\"small\"\n class=\"button-control\"\n .icon=\"${['chevron-right']}\"\n ></hy-button>\n </div>\n `\n : nothing\n }\n\n <div class=\"dots\">\n ${repeat(\n Array.from({length: this.displayedElements?.length}),\n (_, index) => html`\n <span\n class=\"dot ${index === this.currentIndex ? 'active' : ''}\"\n @click=\"${() => this.goTo(index)}\"\n ></span>\n `\n )}\n </div\n </div>\n `;\n }\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"carousel.style.d.ts","sourceRoot":"","sources":["../../../src/components/carousel/carousel.style.ts"],"names":[],"mappings":"AAoEA,eAAO,MAAM,MAAM,yBAAiB,CAAC"}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { css } from 'lit';
|
|
2
|
+
const carouselStyles = css `
|
|
3
|
+
:host {
|
|
4
|
+
position: relative;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
.carousel {
|
|
8
|
+
width: 100%;
|
|
9
|
+
display: flex;
|
|
10
|
+
justify-content: center;
|
|
11
|
+
flex-direction: column;
|
|
12
|
+
align-items: center;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
::slotted(.carousel-item-hidden) {
|
|
16
|
+
position: absolute;
|
|
17
|
+
opacity: 0;
|
|
18
|
+
}
|
|
19
|
+
::slotted(:not(.carousel-item-hidden)) {
|
|
20
|
+
opacity: 1;
|
|
21
|
+
transition: opacity 0.5s ease;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.controls {
|
|
25
|
+
position: absolute;
|
|
26
|
+
width: 100%;
|
|
27
|
+
top: 50%;
|
|
28
|
+
display: flex;
|
|
29
|
+
justify-content: space-between;
|
|
30
|
+
}
|
|
31
|
+
.button-control {
|
|
32
|
+
--hybrid-button-ghost-text-color: grey;
|
|
33
|
+
--hybrid-button-ghost-active-border-color: transparent;
|
|
34
|
+
--hybrid-button-ghost-hover-background-color: transparent;
|
|
35
|
+
--hybrid-button-ghost-hover-border-color: transparent;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.dot {
|
|
39
|
+
height: 8px;
|
|
40
|
+
width: 8px;
|
|
41
|
+
margin: 0 5px;
|
|
42
|
+
background-color: var(--carousel-dot-background-color);
|
|
43
|
+
display: inline-block;
|
|
44
|
+
cursor: pointer;
|
|
45
|
+
opacity: 0.4;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
.dot.active {
|
|
49
|
+
background-color: var(--carousel-dot-active-background-color);
|
|
50
|
+
opacity: 0.9;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
:host {
|
|
54
|
+
--carousel-dot-background-color: #bebebe;
|
|
55
|
+
--carousel-dot-active-background-color: gray;
|
|
56
|
+
}
|
|
57
|
+
@media (prefers-color-scheme: dark) {
|
|
58
|
+
:host {
|
|
59
|
+
--carousel-dot-background-color: gray;
|
|
60
|
+
--carousel-dot-active-background-color: lightgray;
|
|
61
|
+
.button-control {
|
|
62
|
+
--hybrid-button-ghost-text-color: #ffffff;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
`;
|
|
67
|
+
export const styles = carouselStyles;
|
|
68
|
+
//# sourceMappingURL=carousel.style.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"carousel.style.js","sourceRoot":"","sources":["../../../src/components/carousel/carousel.style.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,GAAG,EAAC,MAAM,KAAK,CAAC;AAExB,MAAM,cAAc,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAgEzB,CAAC;AAEF,MAAM,CAAC,MAAM,MAAM,GAAG,cAAc,CAAC","sourcesContent":["import {css} from 'lit';\n\nconst carouselStyles = css`\n :host {\n position: relative;\n }\n\n .carousel {\n width: 100%;\n display: flex;\n justify-content: center;\n flex-direction: column;\n align-items: center;\n }\n\n ::slotted(.carousel-item-hidden) {\n position: absolute;\n opacity: 0;\n }\n ::slotted(:not(.carousel-item-hidden)) {\n opacity: 1;\n transition: opacity 0.5s ease;\n }\n\n .controls {\n position: absolute;\n width: 100%;\n top: 50%;\n display: flex;\n justify-content: space-between;\n }\n .button-control {\n --hybrid-button-ghost-text-color: grey;\n --hybrid-button-ghost-active-border-color: transparent;\n --hybrid-button-ghost-hover-background-color: transparent;\n --hybrid-button-ghost-hover-border-color: transparent;\n }\n\n .dot {\n height: 8px;\n width: 8px;\n margin: 0 5px;\n background-color: var(--carousel-dot-background-color);\n display: inline-block;\n cursor: pointer;\n opacity: 0.4;\n }\n\n .dot.active {\n background-color: var(--carousel-dot-active-background-color);\n opacity: 0.9;\n }\n\n :host {\n --carousel-dot-background-color: #bebebe;\n --carousel-dot-active-background-color: gray;\n }\n @media (prefers-color-scheme: dark) {\n :host {\n --carousel-dot-background-color: gray;\n --carousel-dot-active-background-color: lightgray;\n .button-control {\n --hybrid-button-ghost-text-color: #ffffff;\n }\n }\n }\n`;\n\nexport const styles = carouselStyles;\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"carousel-demo.d.ts","sourceRoot":"","sources":["../../../../src/components/carousel/demo/carousel-demo.ts"],"names":[],"mappings":"AAAA,OAAO,EAAO,UAAU,EAAC,MAAM,KAAK,CAAC;AACrC,OAAO,uBAAuB,CAAC;AAG/B,qBACa,YAAa,SAAQ,UAAU;IACjC,MAAM;CAoDhB"}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
import { html, LitElement } from 'lit';
|
|
8
|
+
import '../carousel.component';
|
|
9
|
+
import { customElement } from 'lit/decorators.js';
|
|
10
|
+
let CarouselDemo = class CarouselDemo extends LitElement {
|
|
11
|
+
render() {
|
|
12
|
+
return html `
|
|
13
|
+
AUTOPLAY
|
|
14
|
+
<hy-carousel ?autoplay=${true}>
|
|
15
|
+
<div>
|
|
16
|
+
<h3>Slide 1</h3>
|
|
17
|
+
<p>Content for Slide 1</p>
|
|
18
|
+
</div>
|
|
19
|
+
<div>
|
|
20
|
+
<h3>Slide 2</h3>
|
|
21
|
+
<p>Content for Slide 2</p>
|
|
22
|
+
</div>
|
|
23
|
+
<div>
|
|
24
|
+
<h3>Slide 3</h3>
|
|
25
|
+
<p>Content for Slide 3</p>
|
|
26
|
+
</div>
|
|
27
|
+
</hy-carousel>
|
|
28
|
+
<hr />
|
|
29
|
+
|
|
30
|
+
WITH CONTROLS
|
|
31
|
+
<hy-carousel>
|
|
32
|
+
<div>
|
|
33
|
+
<h3>Slide 1</h3>
|
|
34
|
+
<p>Content for Slide 1</p>
|
|
35
|
+
</div>
|
|
36
|
+
<div>
|
|
37
|
+
<h3>Slide 2</h3>
|
|
38
|
+
<p>Content for Slide 2</p>
|
|
39
|
+
</div>
|
|
40
|
+
<div>
|
|
41
|
+
<h3>Slide 3</h3>
|
|
42
|
+
<p>Content for Slide 3</p>
|
|
43
|
+
</div>
|
|
44
|
+
</hy-carousel>
|
|
45
|
+
<hr />
|
|
46
|
+
<hy-carousel>
|
|
47
|
+
<div>
|
|
48
|
+
<img src="https://via.placeholder.com/150" alt="Image 1" />
|
|
49
|
+
</div>
|
|
50
|
+
<div>
|
|
51
|
+
<img src="https://via.placeholder.com/150" alt="Image 2" />
|
|
52
|
+
</div>
|
|
53
|
+
|
|
54
|
+
<div>
|
|
55
|
+
<img src="https://via.placeholder.com/150" alt="Image 4" />
|
|
56
|
+
</div>
|
|
57
|
+
<div>
|
|
58
|
+
<img src="https://via.placeholder.com/150" alt="Image 6" />
|
|
59
|
+
</div>
|
|
60
|
+
</hy-carousel>
|
|
61
|
+
`;
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
CarouselDemo = __decorate([
|
|
65
|
+
customElement('hy-carousel-demo')
|
|
66
|
+
], CarouselDemo);
|
|
67
|
+
export { CarouselDemo };
|
|
68
|
+
//# sourceMappingURL=carousel-demo.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"carousel-demo.js","sourceRoot":"","sources":["../../../../src/components/carousel/demo/carousel-demo.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAC,IAAI,EAAE,UAAU,EAAC,MAAM,KAAK,CAAC;AACrC,OAAO,uBAAuB,CAAC;AAC/B,OAAO,EAAC,aAAa,EAAC,MAAM,mBAAmB,CAAC;AAGhD,IAAa,YAAY,GAAzB,MAAa,YAAa,SAAQ,UAAU;IACjC,MAAM;QACb,OAAO,IAAI,CAAA;;+BAEgB,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KA+C9B,CAAC;IACJ,CAAC;CACF,CAAA;AArDY,YAAY;IADxB,aAAa,CAAC,kBAAkB,CAAC;GACrB,YAAY,CAqDxB;SArDY,YAAY","sourcesContent":["import {html, LitElement} from 'lit';\nimport '../carousel.component';\nimport {customElement} from 'lit/decorators.js';\n\n@customElement('hy-carousel-demo')\nexport class CarouselDemo extends LitElement {\n override render() {\n return html`\n AUTOPLAY\n <hy-carousel ?autoplay=${true}>\n <div>\n <h3>Slide 1</h3>\n <p>Content for Slide 1</p>\n </div>\n <div>\n <h3>Slide 2</h3>\n <p>Content for Slide 2</p>\n </div>\n <div>\n <h3>Slide 3</h3>\n <p>Content for Slide 3</p>\n </div>\n </hy-carousel>\n <hr />\n\n WITH CONTROLS\n <hy-carousel>\n <div>\n <h3>Slide 1</h3>\n <p>Content for Slide 1</p>\n </div>\n <div>\n <h3>Slide 2</h3>\n <p>Content for Slide 2</p>\n </div>\n <div>\n <h3>Slide 3</h3>\n <p>Content for Slide 3</p>\n </div>\n </hy-carousel>\n <hr />\n <hy-carousel>\n <div>\n <img src=\"https://via.placeholder.com/150\" alt=\"Image 1\" />\n </div>\n <div>\n <img src=\"https://via.placeholder.com/150\" alt=\"Image 2\" />\n </div>\n\n <div>\n <img src=\"https://via.placeholder.com/150\" alt=\"Image 4\" />\n </div>\n <div>\n <img src=\"https://via.placeholder.com/150\" alt=\"Image 6\" />\n </div>\n </hy-carousel>\n `;\n }\n}\n"]}
|
package/index.d.ts
ADDED
package/index.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/carousel/index.ts"],"names":[],"mappings":"AAAA,cAAc,yBAAyB,CAAC"}
|
package/index.js
ADDED
package/index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/carousel/index.ts"],"names":[],"mappings":"AAAA,cAAc,yBAAyB,CAAC","sourcesContent":["export * from './carousel.component.js';\n"]}
|
package/package.json
ADDED
package/react.d.ts
ADDED
package/react.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"react.d.ts","sourceRoot":"","sources":["../../../src/components/carousel/react.ts"],"names":[],"mappings":"AAEA,OAAO,EAAC,iBAAiB,EAAC,MAAM,yBAAyB,CAAC;AAE1D,eAAO,MAAM,UAAU;;EAOrB,CAAC"}
|
package/react.js
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { createComponent } from '@lit-labs/react';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { CarouselComponent } from './carousel.component.js';
|
|
4
|
+
export const HyCarousel = createComponent({
|
|
5
|
+
tagName: 'hy-carousel',
|
|
6
|
+
elementClass: CarouselComponent,
|
|
7
|
+
react: React,
|
|
8
|
+
events: {
|
|
9
|
+
slideChange: 'slide-change',
|
|
10
|
+
},
|
|
11
|
+
});
|
|
12
|
+
//# sourceMappingURL=react.js.map
|
package/react.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"react.js","sourceRoot":"","sources":["../../../src/components/carousel/react.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,eAAe,EAAC,MAAM,iBAAiB,CAAC;AAChD,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAC,iBAAiB,EAAC,MAAM,yBAAyB,CAAC;AAE1D,MAAM,CAAC,MAAM,UAAU,GAAG,eAAe,CAAC;IACxC,OAAO,EAAE,aAAa;IACtB,YAAY,EAAE,iBAAiB;IAC/B,KAAK,EAAE,KAAK;IACZ,MAAM,EAAE;QACN,WAAW,EAAE,cAAc;KAC5B;CACF,CAAC,CAAC","sourcesContent":["import {createComponent} from '@lit-labs/react';\nimport * as React from 'react';\nimport {CarouselComponent} from './carousel.component.js';\n\nexport const HyCarousel = createComponent({\n tagName: 'hy-carousel',\n elementClass: CarouselComponent,\n react: React,\n events: {\n slideChange: 'slide-change',\n },\n});\n"]}
|