@iyulab/components 0.2.3 → 0.3.0
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/CHANGELOG.md +10 -0
- package/dist/components/card/UCard.component.d.ts +21 -0
- package/dist/components/card/UCard.component.js +66 -0
- package/dist/components/card/UCard.d.ts +7 -0
- package/dist/components/card/UCard.js +5 -0
- package/dist/components/card/UCard.styles.d.ts +1 -0
- package/dist/components/card/UCard.styles.js +76 -0
- package/dist/components/carousel/UCarousel.component.d.ts +67 -0
- package/dist/components/carousel/UCarousel.component.js +243 -0
- package/dist/components/carousel/UCarousel.d.ts +7 -0
- package/dist/components/carousel/UCarousel.js +5 -0
- package/dist/components/carousel/UCarousel.styles.d.ts +1 -0
- package/dist/components/carousel/UCarousel.styles.js +113 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +4 -0
- package/dist/react-components/UCard.d.ts +8 -0
- package/dist/react-components/UCard.js +10 -0
- package/dist/react-components/UCarousel.d.ts +8 -0
- package/dist/react-components/UCarousel.js +10 -0
- package/dist/react-components/index.d.ts +2 -0
- package/dist/react-components/index.js +2 -0
- package/package.json +22 -11
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.3.0 (2026-02-26)
|
|
4
|
+
|
|
5
|
+
### Features
|
|
6
|
+
- **UCard**: Added card layout component with `header`, `footer`, `media` slots
|
|
7
|
+
- **UCarousel**: Added carousel component with autoplay, drag, navigation, multi-slide view
|
|
8
|
+
|
|
9
|
+
### Improvements
|
|
10
|
+
- Moved `@lit/react`, `react` to optional peerDependencies
|
|
11
|
+
- Updated devDependencies
|
|
12
|
+
|
|
3
13
|
## 0.2.3 (2026-02-09)
|
|
4
14
|
|
|
5
15
|
### Features
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { BaseElement } from '../BaseElement.js';
|
|
2
|
+
/**
|
|
3
|
+
* Card 컴포넌트는 콘텐츠를 카드 형태로 표시합니다.
|
|
4
|
+
* @slot - 카드의 메인 콘텐츠를 삽입합니다.
|
|
5
|
+
* @slot header - 카드 상단의 헤더 영역에 표시할 콘텐츠를 삽입합니다.
|
|
6
|
+
* @slot footer - 카드 하단의 푸터 영역에 표시할 콘텐츠를 삽입합니다.
|
|
7
|
+
* @slot media - 카드의 미디어 영역에 표시할 이미지, 비디오 등을 삽입합니다.
|
|
8
|
+
*/
|
|
9
|
+
export declare class UCard extends BaseElement {
|
|
10
|
+
static styles: import('lit').CSSResultGroup[];
|
|
11
|
+
/** 카드의 그림자 효과를 제거할지 여부를 설정합니다. */
|
|
12
|
+
shadowless: boolean;
|
|
13
|
+
/** 카드의 경계선을 제거할지 여부를 설정합니다. */
|
|
14
|
+
borderless: boolean;
|
|
15
|
+
/** 카드에 호버 효과를 적용할지 여부를 설정합니다. */
|
|
16
|
+
hoverable: boolean;
|
|
17
|
+
/** 카드의 레이아웃 방향을 설정합니다. 'vertical'(세로) 또는 'horizontal'(가로) */
|
|
18
|
+
orientation: 'vertical' | 'horizontal';
|
|
19
|
+
render(): import('lit-html').TemplateResult<1>;
|
|
20
|
+
private handleSlotChange;
|
|
21
|
+
}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { html } from 'lit';
|
|
2
|
+
import { property } from 'lit/decorators.js';
|
|
3
|
+
import { BaseElement } from '../BaseElement.js';
|
|
4
|
+
import { styles } from './UCard.styles.js';
|
|
5
|
+
|
|
6
|
+
var __defProp = Object.defineProperty;
|
|
7
|
+
var __decorateClass = (decorators, target, key, kind) => {
|
|
8
|
+
var result = void 0 ;
|
|
9
|
+
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
10
|
+
if (decorator = decorators[i])
|
|
11
|
+
result = (decorator(target, key, result) ) || result;
|
|
12
|
+
if (result) __defProp(target, key, result);
|
|
13
|
+
return result;
|
|
14
|
+
};
|
|
15
|
+
class UCard extends BaseElement {
|
|
16
|
+
constructor() {
|
|
17
|
+
super(...arguments);
|
|
18
|
+
this.shadowless = false;
|
|
19
|
+
this.borderless = false;
|
|
20
|
+
this.hoverable = false;
|
|
21
|
+
this.orientation = "vertical";
|
|
22
|
+
}
|
|
23
|
+
static {
|
|
24
|
+
this.styles = [super.styles, styles];
|
|
25
|
+
}
|
|
26
|
+
render() {
|
|
27
|
+
return html`
|
|
28
|
+
<div part="media" class="media">
|
|
29
|
+
<slot name="media" @slotchange=${this.handleSlotChange}></slot>
|
|
30
|
+
</div>
|
|
31
|
+
<div class="content">
|
|
32
|
+
<header part="header" class="header">
|
|
33
|
+
<slot name="header" @slotchange=${this.handleSlotChange}></slot>
|
|
34
|
+
</header>
|
|
35
|
+
<div part="body" class="body">
|
|
36
|
+
<slot @slotchange=${this.handleSlotChange}></slot>
|
|
37
|
+
</div>
|
|
38
|
+
<footer part="footer" class="footer">
|
|
39
|
+
<slot name="footer" @slotchange=${this.handleSlotChange}></slot>
|
|
40
|
+
</footer>
|
|
41
|
+
</div>
|
|
42
|
+
`;
|
|
43
|
+
}
|
|
44
|
+
handleSlotChange(e) {
|
|
45
|
+
const slot = e.target;
|
|
46
|
+
const container = slot.parentElement;
|
|
47
|
+
const hasContent = slot.assignedNodes({ flatten: true }).length > 0;
|
|
48
|
+
if (container) {
|
|
49
|
+
container.classList.toggle("has-content", hasContent);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
__decorateClass([
|
|
54
|
+
property({ type: Boolean, reflect: true })
|
|
55
|
+
], UCard.prototype, "shadowless");
|
|
56
|
+
__decorateClass([
|
|
57
|
+
property({ type: Boolean, reflect: true })
|
|
58
|
+
], UCard.prototype, "borderless");
|
|
59
|
+
__decorateClass([
|
|
60
|
+
property({ type: Boolean, reflect: true })
|
|
61
|
+
], UCard.prototype, "hoverable");
|
|
62
|
+
__decorateClass([
|
|
63
|
+
property({ type: String, reflect: true })
|
|
64
|
+
], UCard.prototype, "orientation");
|
|
65
|
+
|
|
66
|
+
export { UCard };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const styles: import('lit').CSSResult;
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { css } from 'lit';
|
|
2
|
+
|
|
3
|
+
const styles = css`
|
|
4
|
+
:host {
|
|
5
|
+
display: flex;
|
|
6
|
+
flex-direction: column;
|
|
7
|
+
background-color: var(--u-panel-bg-color);
|
|
8
|
+
border-radius: 8px;
|
|
9
|
+
overflow: hidden;
|
|
10
|
+
border: 1px solid var(--u-border-color);
|
|
11
|
+
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
|
|
12
|
+
}
|
|
13
|
+
:host([borderless]) {
|
|
14
|
+
border: none;
|
|
15
|
+
}
|
|
16
|
+
:host([shadowless]) {
|
|
17
|
+
box-shadow: none;
|
|
18
|
+
}
|
|
19
|
+
:host([hoverable]) {
|
|
20
|
+
cursor: pointer;
|
|
21
|
+
transition: all 0.2s ease;
|
|
22
|
+
}
|
|
23
|
+
:host([hoverable]:hover) {
|
|
24
|
+
transform: translateY(-2px);
|
|
25
|
+
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
|
|
26
|
+
}
|
|
27
|
+
:host([orientation="horizontal"]) {
|
|
28
|
+
flex-direction: row;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.media {
|
|
32
|
+
display: none;
|
|
33
|
+
flex-shrink: 0;
|
|
34
|
+
overflow: hidden;
|
|
35
|
+
}
|
|
36
|
+
.media.has-content {
|
|
37
|
+
display: block;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.content {
|
|
41
|
+
display: flex;
|
|
42
|
+
flex-direction: column;
|
|
43
|
+
flex: 1;
|
|
44
|
+
min-width: 0;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
.header {
|
|
48
|
+
display: none;
|
|
49
|
+
padding: 16px;
|
|
50
|
+
border-bottom: 1px solid var(--u-border-color);
|
|
51
|
+
}
|
|
52
|
+
.header.has-content {
|
|
53
|
+
display: block;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
.body {
|
|
57
|
+
display: none;
|
|
58
|
+
flex: 1;
|
|
59
|
+
padding: 16px;
|
|
60
|
+
}
|
|
61
|
+
.body.has-content {
|
|
62
|
+
display: block;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
.footer {
|
|
66
|
+
display: none;
|
|
67
|
+
padding: 16px;
|
|
68
|
+
border-top: 1px solid var(--u-border-color);
|
|
69
|
+
}
|
|
70
|
+
.footer.has-content {
|
|
71
|
+
display: block;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
`;
|
|
75
|
+
|
|
76
|
+
export { styles };
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { PropertyValues } from 'lit';
|
|
2
|
+
import { BaseElement } from '../BaseElement.js';
|
|
3
|
+
/**
|
|
4
|
+
* Carousel 컴포넌트는 여러 슬라이드를 회전하며 표시합니다.
|
|
5
|
+
*
|
|
6
|
+
* @slot - 슬라이드로 표시할 콘텐츠. 각 자식 요소가 하나의 슬라이드.
|
|
7
|
+
* @event u-change - 슬라이드 변경 시. detail: { currentIndex: number }
|
|
8
|
+
*
|
|
9
|
+
* @csspart slides - 슬라이드 컨테이너 (aspect-ratio 등 외부 스타일링)
|
|
10
|
+
* @csspart prev-button - 이전 버튼
|
|
11
|
+
* @csspart next-button - 다음 버튼
|
|
12
|
+
* @csspart indicator - 인디케이터 컨테이너
|
|
13
|
+
* @csspart dot - 인디케이터 도트
|
|
14
|
+
*/
|
|
15
|
+
export declare class UCarousel extends BaseElement {
|
|
16
|
+
static styles: import('lit').CSSResultGroup[];
|
|
17
|
+
static dependencies: Record<string, typeof BaseElement>;
|
|
18
|
+
/** 현재 활성 슬라이드 인덱스 */
|
|
19
|
+
currentIndex: number;
|
|
20
|
+
/** 자동 재생 활성화 */
|
|
21
|
+
autoplay: boolean;
|
|
22
|
+
/** 자동 재생 간격 (ms) */
|
|
23
|
+
autoplayInterval: number;
|
|
24
|
+
/** 이전/다음 네비게이션 버튼 표시 */
|
|
25
|
+
navigation: boolean;
|
|
26
|
+
/** 페이지 인디케이터 표시 */
|
|
27
|
+
pagination: boolean;
|
|
28
|
+
/** 처음/끝에서 순환 이동 */
|
|
29
|
+
loop: boolean;
|
|
30
|
+
/** 드래그로 슬라이드 전환 */
|
|
31
|
+
draggable: boolean;
|
|
32
|
+
/** 한 화면에 표시할 슬라이드 수 */
|
|
33
|
+
slidesPerView: number;
|
|
34
|
+
/** 한 번에 이동할 슬라이드 수 */
|
|
35
|
+
slidesPerMove: number;
|
|
36
|
+
/** 슬라이드 간 간격 (px) */
|
|
37
|
+
gap: number;
|
|
38
|
+
private _slideCount;
|
|
39
|
+
private _isDragging;
|
|
40
|
+
private _dragOffset;
|
|
41
|
+
private _autoplayTimer?;
|
|
42
|
+
private _dragStartX;
|
|
43
|
+
private _dragStartTime;
|
|
44
|
+
private get _perView();
|
|
45
|
+
private get _perMove();
|
|
46
|
+
private get _maxIndex();
|
|
47
|
+
private get _pageCount();
|
|
48
|
+
private get _currentPage();
|
|
49
|
+
connectedCallback(): void;
|
|
50
|
+
disconnectedCallback(): void;
|
|
51
|
+
protected willUpdate(changedProperties: PropertyValues): void;
|
|
52
|
+
protected updated(changedProperties: PropertyValues): void;
|
|
53
|
+
render(): import('lit-html').TemplateResult<1>;
|
|
54
|
+
/** 이전 슬라이드로 이동 */
|
|
55
|
+
prev(): void;
|
|
56
|
+
/** 다음 슬라이드로 이동 */
|
|
57
|
+
next(): void;
|
|
58
|
+
/** 지정한 인덱스로 이동 */
|
|
59
|
+
goTo(index: number): void;
|
|
60
|
+
private handleSlotChange;
|
|
61
|
+
private startAutoplay;
|
|
62
|
+
private stopAutoplay;
|
|
63
|
+
private handleDragStart;
|
|
64
|
+
private handlePointerDown;
|
|
65
|
+
private handlePointerMove;
|
|
66
|
+
private handlePointerUp;
|
|
67
|
+
}
|
|
@@ -0,0 +1,243 @@
|
|
|
1
|
+
import { html } from 'lit';
|
|
2
|
+
import { property, state } from 'lit/decorators.js';
|
|
3
|
+
import { BaseElement } from '../BaseElement.js';
|
|
4
|
+
import { UButton } from '../button/UButton.component.js';
|
|
5
|
+
import { UIcon } from '../icon/UIcon.component.js';
|
|
6
|
+
import { styles } from './UCarousel.styles.js';
|
|
7
|
+
|
|
8
|
+
var __defProp = Object.defineProperty;
|
|
9
|
+
var __decorateClass = (decorators, target, key, kind) => {
|
|
10
|
+
var result = void 0 ;
|
|
11
|
+
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
12
|
+
if (decorator = decorators[i])
|
|
13
|
+
result = (decorator(target, key, result) ) || result;
|
|
14
|
+
if (result) __defProp(target, key, result);
|
|
15
|
+
return result;
|
|
16
|
+
};
|
|
17
|
+
class UCarousel extends BaseElement {
|
|
18
|
+
constructor() {
|
|
19
|
+
super(...arguments);
|
|
20
|
+
this.currentIndex = 0;
|
|
21
|
+
this.autoplay = false;
|
|
22
|
+
this.autoplayInterval = 3e3;
|
|
23
|
+
this.navigation = true;
|
|
24
|
+
this.pagination = true;
|
|
25
|
+
this.loop = true;
|
|
26
|
+
this.draggable = false;
|
|
27
|
+
this.slidesPerView = 1;
|
|
28
|
+
this.slidesPerMove = 1;
|
|
29
|
+
this.gap = 0;
|
|
30
|
+
this._slideCount = 0;
|
|
31
|
+
this._isDragging = false;
|
|
32
|
+
this._dragOffset = 0;
|
|
33
|
+
this._dragStartX = 0;
|
|
34
|
+
this._dragStartTime = 0;
|
|
35
|
+
this.handleDragStart = (e) => {
|
|
36
|
+
e.preventDefault();
|
|
37
|
+
};
|
|
38
|
+
this.handlePointerDown = (e) => {
|
|
39
|
+
if (e.button !== 0) return;
|
|
40
|
+
e.preventDefault();
|
|
41
|
+
this._isDragging = true;
|
|
42
|
+
this._dragStartX = e.clientX;
|
|
43
|
+
this._dragOffset = 0;
|
|
44
|
+
this._dragStartTime = Date.now();
|
|
45
|
+
if (this.autoplay) this.stopAutoplay();
|
|
46
|
+
const wrapper = e.currentTarget;
|
|
47
|
+
wrapper.setPointerCapture(e.pointerId);
|
|
48
|
+
};
|
|
49
|
+
this.handlePointerMove = (e) => {
|
|
50
|
+
if (!this._isDragging) return;
|
|
51
|
+
const wrapper = e.currentTarget;
|
|
52
|
+
this._dragOffset = (e.clientX - this._dragStartX) / wrapper.offsetWidth * 100;
|
|
53
|
+
};
|
|
54
|
+
this.handlePointerUp = (e) => {
|
|
55
|
+
if (!this._isDragging) return;
|
|
56
|
+
const elapsed = Date.now() - this._dragStartTime;
|
|
57
|
+
const absDrag = Math.abs(this._dragOffset);
|
|
58
|
+
if (absDrag > 20 || absDrag > 5 && elapsed < 300) {
|
|
59
|
+
if (this._dragOffset < 0) this.next();
|
|
60
|
+
else this.prev();
|
|
61
|
+
}
|
|
62
|
+
this._isDragging = false;
|
|
63
|
+
this._dragOffset = 0;
|
|
64
|
+
if (this.autoplay) this.startAutoplay();
|
|
65
|
+
const wrapper = e.currentTarget;
|
|
66
|
+
wrapper.releasePointerCapture(e.pointerId);
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
static {
|
|
70
|
+
this.styles = [super.styles, styles];
|
|
71
|
+
}
|
|
72
|
+
static {
|
|
73
|
+
this.dependencies = {
|
|
74
|
+
"u-button": UButton,
|
|
75
|
+
"u-icon": UIcon
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
get _perView() {
|
|
79
|
+
return Math.max(1, this.slidesPerView);
|
|
80
|
+
}
|
|
81
|
+
get _perMove() {
|
|
82
|
+
return Math.max(1, this.slidesPerMove);
|
|
83
|
+
}
|
|
84
|
+
get _maxIndex() {
|
|
85
|
+
return Math.max(0, this._slideCount - this._perView);
|
|
86
|
+
}
|
|
87
|
+
get _pageCount() {
|
|
88
|
+
return this._maxIndex <= 0 ? 1 : Math.ceil(this._maxIndex / this._perMove) + 1;
|
|
89
|
+
}
|
|
90
|
+
get _currentPage() {
|
|
91
|
+
return this.currentIndex >= this._maxIndex ? this._pageCount - 1 : Math.floor(this.currentIndex / this._perMove);
|
|
92
|
+
}
|
|
93
|
+
connectedCallback() {
|
|
94
|
+
super.connectedCallback();
|
|
95
|
+
if (this.autoplay) this.startAutoplay();
|
|
96
|
+
}
|
|
97
|
+
disconnectedCallback() {
|
|
98
|
+
this.stopAutoplay();
|
|
99
|
+
super.disconnectedCallback();
|
|
100
|
+
}
|
|
101
|
+
willUpdate(changedProperties) {
|
|
102
|
+
super.willUpdate(changedProperties);
|
|
103
|
+
if (changedProperties.has("slidesPerView")) {
|
|
104
|
+
this.style.setProperty("--slides-per-view", String(this._perView));
|
|
105
|
+
}
|
|
106
|
+
if (changedProperties.has("gap")) {
|
|
107
|
+
this.style.setProperty("--slide-gap", `${this.gap}px`);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
updated(changedProperties) {
|
|
111
|
+
super.updated(changedProperties);
|
|
112
|
+
if (changedProperties.has("autoplay") || changedProperties.has("autoplayInterval")) {
|
|
113
|
+
if (this.autoplay) this.startAutoplay();
|
|
114
|
+
else this.stopAutoplay();
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
render() {
|
|
118
|
+
const pct = -(this.currentIndex * (100 / this._perView)) + this._dragOffset;
|
|
119
|
+
const gapPx = this.gap > 0 ? -(this.currentIndex * this.gap / this._perView) : 0;
|
|
120
|
+
const transform = gapPx ? `translateX(calc(${pct}% + ${gapPx}px))` : `translateX(${pct}%)`;
|
|
121
|
+
const style = `transform: ${transform}${this._isDragging ? "; transition: none" : ""}`;
|
|
122
|
+
return html`
|
|
123
|
+
<div class="slides-wrapper"
|
|
124
|
+
@dragstart=${this.handleDragStart}
|
|
125
|
+
@pointerdown=${this.draggable ? this.handlePointerDown : null}
|
|
126
|
+
@pointermove=${this.draggable ? this.handlePointerMove : null}
|
|
127
|
+
@pointerup=${this.draggable ? this.handlePointerUp : null}
|
|
128
|
+
@pointerleave=${this.draggable ? this.handlePointerUp : null}>
|
|
129
|
+
<div part="slides" class="slides" style="${style}">
|
|
130
|
+
<slot @slotchange=${this.handleSlotChange}></slot>
|
|
131
|
+
</div>
|
|
132
|
+
</div>
|
|
133
|
+
|
|
134
|
+
<u-button part="prev-button" class="nav-button prev" variant="borderless"
|
|
135
|
+
?hidden=${!this.navigation}
|
|
136
|
+
?disabled=${!this.loop && this.currentIndex <= 0}
|
|
137
|
+
@click=${this.prev}>
|
|
138
|
+
<u-icon lib="internal" name="chevron-left"></u-icon>
|
|
139
|
+
</u-button>
|
|
140
|
+
<u-button part="next-button" class="nav-button next" variant="borderless"
|
|
141
|
+
?hidden=${!this.navigation}
|
|
142
|
+
?disabled=${!this.loop && this.currentIndex >= this._maxIndex}
|
|
143
|
+
@click=${this.next}>
|
|
144
|
+
<u-icon lib="internal" name="chevron-right"></u-icon>
|
|
145
|
+
</u-button>
|
|
146
|
+
|
|
147
|
+
<div part="indicator" class="indicator"
|
|
148
|
+
?hidden=${!this.pagination || !this._slideCount}>
|
|
149
|
+
${Array.from({ length: this._pageCount }, (_, i) => html`
|
|
150
|
+
<button part="dot"
|
|
151
|
+
class="dot ${i === this._currentPage ? "active" : ""}"
|
|
152
|
+
@click=${() => this.goTo(Math.min(i * this._perMove, this._maxIndex))}>
|
|
153
|
+
</button>
|
|
154
|
+
`)}
|
|
155
|
+
</div>
|
|
156
|
+
`;
|
|
157
|
+
}
|
|
158
|
+
/** 이전 슬라이드로 이동 */
|
|
159
|
+
prev() {
|
|
160
|
+
const target = Math.max(0, this.currentIndex - this._perMove);
|
|
161
|
+
if (target !== this.currentIndex) {
|
|
162
|
+
this.goTo(target);
|
|
163
|
+
} else if (this.loop) {
|
|
164
|
+
this.goTo(Math.min((this._pageCount - 1) * this._perMove, this._maxIndex));
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
/** 다음 슬라이드로 이동 */
|
|
168
|
+
next() {
|
|
169
|
+
const target = Math.min(this._maxIndex, this.currentIndex + this._perMove);
|
|
170
|
+
if (target !== this.currentIndex) {
|
|
171
|
+
this.goTo(target);
|
|
172
|
+
} else if (this.loop) {
|
|
173
|
+
this.goTo(0);
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
/** 지정한 인덱스로 이동 */
|
|
177
|
+
goTo(index) {
|
|
178
|
+
if (index < 0 || index > this._maxIndex || index === this.currentIndex) return;
|
|
179
|
+
this.currentIndex = index;
|
|
180
|
+
this.emit("u-change", {
|
|
181
|
+
currentIndex: this.currentIndex
|
|
182
|
+
});
|
|
183
|
+
if (this.autoplay) this.startAutoplay();
|
|
184
|
+
}
|
|
185
|
+
handleSlotChange(e) {
|
|
186
|
+
const slot = e.target;
|
|
187
|
+
this._slideCount = slot.assignedElements().length;
|
|
188
|
+
if (this.currentIndex >= this._slideCount) {
|
|
189
|
+
this.currentIndex = Math.max(0, this._slideCount - 1);
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
startAutoplay() {
|
|
193
|
+
this.stopAutoplay();
|
|
194
|
+
this._autoplayTimer = window.setInterval(() => this.next(), this.autoplayInterval);
|
|
195
|
+
}
|
|
196
|
+
stopAutoplay() {
|
|
197
|
+
if (this._autoplayTimer) {
|
|
198
|
+
clearInterval(this._autoplayTimer);
|
|
199
|
+
this._autoplayTimer = void 0;
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
__decorateClass([
|
|
204
|
+
property({ type: Number, reflect: true, attribute: "current-index" })
|
|
205
|
+
], UCarousel.prototype, "currentIndex");
|
|
206
|
+
__decorateClass([
|
|
207
|
+
property({ type: Boolean, reflect: true })
|
|
208
|
+
], UCarousel.prototype, "autoplay");
|
|
209
|
+
__decorateClass([
|
|
210
|
+
property({ type: Number, attribute: "autoplay-interval" })
|
|
211
|
+
], UCarousel.prototype, "autoplayInterval");
|
|
212
|
+
__decorateClass([
|
|
213
|
+
property({ type: Boolean, reflect: true })
|
|
214
|
+
], UCarousel.prototype, "navigation");
|
|
215
|
+
__decorateClass([
|
|
216
|
+
property({ type: Boolean, reflect: true })
|
|
217
|
+
], UCarousel.prototype, "pagination");
|
|
218
|
+
__decorateClass([
|
|
219
|
+
property({ type: Boolean, reflect: true })
|
|
220
|
+
], UCarousel.prototype, "loop");
|
|
221
|
+
__decorateClass([
|
|
222
|
+
property({ type: Boolean, reflect: true })
|
|
223
|
+
], UCarousel.prototype, "draggable");
|
|
224
|
+
__decorateClass([
|
|
225
|
+
property({ type: Number, reflect: true, attribute: "slides-per-view" })
|
|
226
|
+
], UCarousel.prototype, "slidesPerView");
|
|
227
|
+
__decorateClass([
|
|
228
|
+
property({ type: Number, attribute: "slides-per-move" })
|
|
229
|
+
], UCarousel.prototype, "slidesPerMove");
|
|
230
|
+
__decorateClass([
|
|
231
|
+
property({ type: Number, reflect: true })
|
|
232
|
+
], UCarousel.prototype, "gap");
|
|
233
|
+
__decorateClass([
|
|
234
|
+
state()
|
|
235
|
+
], UCarousel.prototype, "_slideCount");
|
|
236
|
+
__decorateClass([
|
|
237
|
+
state()
|
|
238
|
+
], UCarousel.prototype, "_isDragging");
|
|
239
|
+
__decorateClass([
|
|
240
|
+
state()
|
|
241
|
+
], UCarousel.prototype, "_dragOffset");
|
|
242
|
+
|
|
243
|
+
export { UCarousel };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const styles: import('lit').CSSResult;
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import { css } from 'lit';
|
|
2
|
+
|
|
3
|
+
const styles = css`
|
|
4
|
+
/* ── Host ── */
|
|
5
|
+
:host {
|
|
6
|
+
--slide-gap: 0px;
|
|
7
|
+
--slides-per-view: 1;
|
|
8
|
+
}
|
|
9
|
+
:host {
|
|
10
|
+
display: block;
|
|
11
|
+
position: relative;
|
|
12
|
+
width: 100%;
|
|
13
|
+
overflow: hidden;
|
|
14
|
+
box-sizing: border-box;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/* ── Draggable ── */
|
|
18
|
+
:host([draggable]) .slides-wrapper {
|
|
19
|
+
cursor: grab;
|
|
20
|
+
user-select: none;
|
|
21
|
+
}
|
|
22
|
+
:host([draggable]) .slides-wrapper:active {
|
|
23
|
+
cursor: grabbing;
|
|
24
|
+
}
|
|
25
|
+
:host([draggable]) ::slotted(*) {
|
|
26
|
+
-webkit-user-drag: none;
|
|
27
|
+
user-select: none;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/* ── Slides ── */
|
|
31
|
+
.slides-wrapper {
|
|
32
|
+
position: relative;
|
|
33
|
+
width: 100%;
|
|
34
|
+
height: 100%;
|
|
35
|
+
overflow: hidden;
|
|
36
|
+
touch-action: pan-y;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.slides {
|
|
40
|
+
display: flex;
|
|
41
|
+
width: 100%;
|
|
42
|
+
height: 100%;
|
|
43
|
+
gap: var(--slide-gap, 0px);
|
|
44
|
+
transition: transform 0.3s ease-in-out;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
::slotted(*) {
|
|
48
|
+
flex: 0 0 calc(
|
|
49
|
+
(100% - (var(--slides-per-view) - 1) * var(--slide-gap, 0px))
|
|
50
|
+
/ var(--slides-per-view)
|
|
51
|
+
);
|
|
52
|
+
min-width: 0;
|
|
53
|
+
height: 100%;
|
|
54
|
+
box-sizing: border-box;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/* ── Navigation ── */
|
|
58
|
+
.nav-button {
|
|
59
|
+
position: absolute;
|
|
60
|
+
z-index: 10;
|
|
61
|
+
top: 50%;
|
|
62
|
+
transform: translateY(-50%);
|
|
63
|
+
width: 40px;
|
|
64
|
+
height: 40px;
|
|
65
|
+
display: flex;
|
|
66
|
+
align-items: center;
|
|
67
|
+
justify-content: center;
|
|
68
|
+
border-radius: 50%;
|
|
69
|
+
font-size: 16px;
|
|
70
|
+
background-color: var(--u-panel-bg-color, #fff);
|
|
71
|
+
box-shadow: 0 2px 8px var(--u-shadow-color-normal, rgba(0, 0, 0, 0.12));
|
|
72
|
+
opacity: 0.9;
|
|
73
|
+
}
|
|
74
|
+
.nav-button:hover {
|
|
75
|
+
opacity: 1;
|
|
76
|
+
background-color: var(--u-bg-color-hover, #f3f4f6);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
.nav-button.prev { left: 16px; }
|
|
80
|
+
.nav-button.next { right: 16px; }
|
|
81
|
+
|
|
82
|
+
/* ── Indicator ── */
|
|
83
|
+
.indicator {
|
|
84
|
+
position: absolute;
|
|
85
|
+
z-index: 10;
|
|
86
|
+
bottom: 16px;
|
|
87
|
+
left: 50%;
|
|
88
|
+
transform: translateX(-50%);
|
|
89
|
+
display: flex;
|
|
90
|
+
gap: 8px;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
.dot {
|
|
94
|
+
width: 10px;
|
|
95
|
+
height: 10px;
|
|
96
|
+
padding: 0;
|
|
97
|
+
border: none;
|
|
98
|
+
border-radius: 50%;
|
|
99
|
+
background-color: var(--u-neutral-400, rgba(0, 0, 0, 0.3));
|
|
100
|
+
cursor: pointer;
|
|
101
|
+
transition: all 0.2s ease;
|
|
102
|
+
}
|
|
103
|
+
.dot:hover {
|
|
104
|
+
background-color: var(--u-neutral-200, rgba(0, 0, 0, 0.5));
|
|
105
|
+
}
|
|
106
|
+
.dot.active {
|
|
107
|
+
background-color: var(--u-neutral-100, rgba(0, 0, 0, 0.8));
|
|
108
|
+
width: 24px;
|
|
109
|
+
border-radius: 5px;
|
|
110
|
+
}
|
|
111
|
+
`;
|
|
112
|
+
|
|
113
|
+
export { styles };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
export * from './components/alert/UAlert.js';
|
|
2
2
|
export * from './components/button/UButton.js';
|
|
3
|
+
export * from './components/card/UCard.js';
|
|
4
|
+
export * from './components/carousel/UCarousel.js';
|
|
3
5
|
export * from './components/dialog/UDialog.js';
|
|
4
6
|
export * from './components/divider/UDivider.js';
|
|
5
7
|
export * from './components/drawer/UDrawer.js';
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import './components/alert/UAlert.js';
|
|
2
2
|
import './components/button/UButton.js';
|
|
3
|
+
import './components/card/UCard.js';
|
|
4
|
+
import './components/carousel/UCarousel.js';
|
|
3
5
|
import './components/dialog/UDialog.js';
|
|
4
6
|
import './components/divider/UDivider.js';
|
|
5
7
|
import './components/drawer/UDrawer.js';
|
|
@@ -23,6 +25,8 @@ export { Notifier } from './utilities/Notifier.js';
|
|
|
23
25
|
export { Theme } from './utilities/Theme.js';
|
|
24
26
|
export { UAlert } from './components/alert/UAlert.component.js';
|
|
25
27
|
export { UButton } from './components/button/UButton.component.js';
|
|
28
|
+
export { UCard } from './components/card/UCard.component.js';
|
|
29
|
+
export { UCarousel } from './components/carousel/UCarousel.component.js';
|
|
26
30
|
export { UDialog } from './components/dialog/UDialog.component.js';
|
|
27
31
|
export { UDivider } from './components/divider/UDivider.component.js';
|
|
28
32
|
export { UDrawer } from './components/drawer/UDrawer.component.js';
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { UCarousel } from '../components/carousel/UCarousel';
|
|
3
|
+
|
|
4
|
+
export declare const UCarousel: React.ForwardRefExoticComponent<
|
|
5
|
+
Partial<UCarousel> & React.HTMLAttributes<UCarousel>
|
|
6
|
+
>;
|
|
7
|
+
|
|
8
|
+
export type UCarouselProps = React.ComponentProps<typeof UCarousel>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { createComponent } from '@lit/react';
|
|
3
|
+
import { UCarousel } from '../components/carousel/UCarousel';
|
|
4
|
+
|
|
5
|
+
export const UCarousel = createComponent({
|
|
6
|
+
react: React,
|
|
7
|
+
tagName: 'u-carousel',
|
|
8
|
+
elementClass: UCarousel,
|
|
9
|
+
events: {}
|
|
10
|
+
});
|
|
@@ -7,6 +7,8 @@
|
|
|
7
7
|
|
|
8
8
|
export { UAlert, UAlertProps } from './UAlert';
|
|
9
9
|
export { UButton, UButtonProps } from './UButton';
|
|
10
|
+
export { UCard, UCardProps } from './UCard';
|
|
11
|
+
export { UCarousel, UCarouselProps } from './UCarousel';
|
|
10
12
|
export { UDialog, UDialogProps } from './UDialog';
|
|
11
13
|
export { UDivider, UDividerProps } from './UDivider';
|
|
12
14
|
export { UDrawer, UDrawerProps } from './UDrawer';
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
export { UAlert } from './UAlert.js';
|
|
2
2
|
export { UButton } from './UButton.js';
|
|
3
|
+
export { UCard } from './UCard.js';
|
|
4
|
+
export { UCarousel } from './UCarousel.js';
|
|
3
5
|
export { UDialog } from './UDialog.js';
|
|
4
6
|
export { UDivider } from './UDivider.js';
|
|
5
7
|
export { UDrawer } from './UDrawer.js';
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@iyulab/components",
|
|
3
3
|
"description": "web-components library based on lit-element made by iyulab",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.3.0",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"iyulab",
|
|
7
7
|
"components",
|
|
@@ -39,22 +39,33 @@
|
|
|
39
39
|
"build": "eslint && vite build"
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"@floating-ui/dom": "^1.7.
|
|
43
|
-
"@lit/react": "^1.0.8",
|
|
42
|
+
"@floating-ui/dom": "^1.7.5",
|
|
44
43
|
"lit": "^3.3.2",
|
|
45
|
-
"
|
|
44
|
+
"quill": "2.0.3",
|
|
46
45
|
"reflect-metadata": "^0.2.2"
|
|
47
46
|
},
|
|
47
|
+
"peerDependencies": {
|
|
48
|
+
"@lit/react": ">=1.0.0",
|
|
49
|
+
"react": ">=18.0.0"
|
|
50
|
+
},
|
|
51
|
+
"peerDependenciesMeta": {
|
|
52
|
+
"react": {
|
|
53
|
+
"optional": true
|
|
54
|
+
},
|
|
55
|
+
"@lit/react": {
|
|
56
|
+
"optional": true
|
|
57
|
+
}
|
|
58
|
+
},
|
|
48
59
|
"devDependencies": {
|
|
49
|
-
"@eslint/js": "^
|
|
50
|
-
"@types/node": "^25.0
|
|
51
|
-
"eslint": "^
|
|
52
|
-
"eslint-plugin-lit": "^2.
|
|
53
|
-
"globals": "^17.
|
|
60
|
+
"@eslint/js": "^10.0.1",
|
|
61
|
+
"@types/node": "^25.3.0",
|
|
62
|
+
"eslint": "^10.0.2",
|
|
63
|
+
"eslint-plugin-lit": "^2.2.1",
|
|
64
|
+
"globals": "^17.3.0",
|
|
54
65
|
"typescript": "^5.9.3",
|
|
55
|
-
"typescript-eslint": "^8.
|
|
66
|
+
"typescript-eslint": "^8.56.1",
|
|
56
67
|
"vite": "^7.3.1",
|
|
57
68
|
"vite-plugin-dts": "^4.5.4",
|
|
58
|
-
"vite-plugin-static-copy": "^3.
|
|
69
|
+
"vite-plugin-static-copy": "^3.2.0"
|
|
59
70
|
}
|
|
60
71
|
}
|