@iyulab/components 0.1.10 → 0.2.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 +52 -0
- package/dist/assets/icons/arrow-repeat.svg.js +3 -0
- package/dist/assets/icons/box-arrow-up-right.svg.js +3 -0
- package/dist/assets/icons/file-earmark.svg.js +3 -0
- package/dist/assets/icons/flag.svg.js +3 -0
- package/dist/assets/icons/globe.svg.js +3 -0
- package/dist/assets/icons/hand-thumbs-down-fill.svg.js +3 -0
- package/dist/assets/icons/hand-thumbs-down.svg.js +3 -0
- package/dist/assets/icons/hand-thumbs-up-fill.svg.js +3 -0
- package/dist/assets/icons/hand-thumbs-up.svg.js +3 -0
- package/dist/assets/icons/share.svg.js +3 -0
- package/dist/assets/icons/stop-circle.svg.js +3 -0
- package/dist/assets/icons/tools.svg.js +3 -0
- package/dist/components/FloatingElement.d.ts +13 -5
- package/dist/components/FloatingElement.js +32 -15
- package/dist/components/FloatingElement.styles.js +0 -4
- package/dist/components/button/UButton.component.d.ts +7 -0
- package/dist/components/button/UButton.component.js +20 -1
- package/dist/components/button/UButton.styles.js +51 -8
- package/dist/components/dialog/UDialog.component.d.ts +2 -0
- package/dist/components/dialog/UDialog.component.js +14 -9
- package/dist/components/divider/UDivider.component.d.ts +3 -18
- package/dist/components/divider/UDivider.component.js +3 -62
- package/dist/components/divider/UDivider.styles.js +11 -43
- package/dist/components/drawer/UDrawer.component.d.ts +2 -0
- package/dist/components/drawer/UDrawer.component.js +14 -9
- package/dist/components/form/UForm.component.js +3 -3
- package/dist/components/icon/UIcon.component.d.ts +4 -1
- package/dist/components/icon/UIcon.component.js +2 -2
- package/dist/components/menu/UMenu.component.d.ts +4 -7
- package/dist/components/menu/UMenu.component.js +94 -83
- package/dist/components/menu/UMenu.styles.js +1 -1
- package/dist/components/menu-item/UMenuItem.component.d.ts +10 -4
- package/dist/components/menu-item/UMenuItem.component.js +37 -26
- package/dist/components/menu-item/UMenuItem.styles.js +4 -4
- package/dist/components/split-panel/USplitPanel.component.d.ts +22 -8
- package/dist/components/split-panel/USplitPanel.component.js +121 -75
- package/dist/components/split-panel/USplitPanel.styles.js +30 -0
- package/dist/components/tag/UTag.component.d.ts +23 -0
- package/dist/components/tag/UTag.component.js +72 -0
- package/dist/components/tag/UTag.d.ts +8 -0
- package/dist/components/tag/UTag.js +5 -0
- package/dist/components/tag/UTag.styles.js +83 -0
- package/dist/components/tooltip/UTooltip.component.d.ts +8 -0
- package/dist/components/tooltip/UTooltip.component.js +59 -17
- package/dist/components/tooltip/UTooltip.styles.js +15 -0
- package/dist/components/tree-item/UTreeItem.component.d.ts +16 -8
- package/dist/components/tree-item/UTreeItem.component.js +69 -31
- package/dist/components/tree-item/UTreeItem.styles.js +8 -3
- package/dist/index.d.ts +4 -3
- package/dist/index.js +5 -4
- package/dist/react-components/UTag.d.ts +8 -0
- package/dist/react-components/UTag.js +10 -0
- package/dist/react-components/index.d.ts +1 -1
- package/dist/react-components/index.js +1 -1
- package/dist/utilities/{icons.d.ts → IconRegistry.d.ts} +20 -26
- package/dist/utilities/{icons.js → IconRegistry.js} +29 -20
- package/dist/utilities/{notifier.d.ts → Notifier.d.ts} +8 -13
- package/dist/utilities/{notifier.js → Notifier.js} +8 -10
- package/dist/utilities/{theme.d.ts → Theme.d.ts} +14 -20
- package/dist/utilities/{theme.js → Theme.js} +39 -35
- package/dist/{internals/attribute-converters.d.ts → utilities/converters.d.ts} +1 -1
- package/dist/{internals/attribute-converters.js → utilities/converters.js} +2 -2
- package/dist/{internals/node-helpers.js → utilities/elements.js} +6 -5
- package/package.json +7 -7
- package/dist/assets/icons/arrow-clockwise.svg.js +0 -3
- package/dist/assets/icons/speedometer.svg.js +0 -3
- package/dist/components/icon-button/UIconButton.component.d.ts +0 -20
- package/dist/components/icon-button/UIconButton.component.js +0 -59
- package/dist/components/icon-button/UIconButton.d.ts +0 -7
- package/dist/components/icon-button/UIconButton.js +0 -5
- package/dist/components/icon-button/UIconButton.styles.js +0 -54
- package/dist/internals/react-wrapper.d.ts +0 -21
- package/dist/react-components/UIconButton.d.ts +0 -8
- package/dist/react-components/UIconButton.js +0 -10
- /package/dist/components/{icon-button/UIconButton.styles.d.ts → tag/UTag.styles.d.ts} +0 -0
- /package/dist/{internals/node-helpers.d.ts → utilities/elements.d.ts} +0 -0
|
@@ -22,7 +22,7 @@ const styles = css`
|
|
|
22
22
|
pointer-events: none;
|
|
23
23
|
cursor: not-allowed;
|
|
24
24
|
}
|
|
25
|
-
:host(
|
|
25
|
+
:host([selected]) {
|
|
26
26
|
color: var(--selected-color);
|
|
27
27
|
background-color: var(--selected-bg-color);
|
|
28
28
|
}
|
|
@@ -31,9 +31,9 @@ const styles = css`
|
|
|
31
31
|
background-color: var(--u-bg-color-hover);
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
-
/*
|
|
35
|
-
.
|
|
36
|
-
flex: 1
|
|
34
|
+
/* 라벨 영역 */
|
|
35
|
+
.label {
|
|
36
|
+
flex: 1 1 auto;
|
|
37
37
|
font-size: 1em;
|
|
38
38
|
line-height: 1.5;
|
|
39
39
|
overflow: hidden;
|
|
@@ -6,11 +6,17 @@ import { BaseElement } from '../BaseElement.js';
|
|
|
6
6
|
export declare class USplitPanel extends BaseElement {
|
|
7
7
|
static styles: import('lit').CSSResultGroup[];
|
|
8
8
|
static dependencies: Record<string, typeof BaseElement>;
|
|
9
|
+
/** 현재 상태를 저장하는 패널 요소들 */
|
|
9
10
|
private panels;
|
|
10
|
-
private
|
|
11
|
-
|
|
12
|
-
private
|
|
13
|
-
|
|
11
|
+
private sizes;
|
|
12
|
+
/** 드래그 시작 시 저장되는 정보 */
|
|
13
|
+
private draggingIndex;
|
|
14
|
+
private dragStartSizes;
|
|
15
|
+
private dragStartPosition;
|
|
16
|
+
private containerSize;
|
|
17
|
+
slotEls?: HTMLElement[];
|
|
18
|
+
/** 스플리터 개수 (렌더링용) */
|
|
19
|
+
splitterCount: number;
|
|
14
20
|
/** 분할 방향을 설정합니다. 'horizontal'은 좌우 분할, 'vertical'은 상하 분할입니다. */
|
|
15
21
|
orientation: 'horizontal' | 'vertical';
|
|
16
22
|
/** 초기 패널 크기 비율을 설정합니다. (예: [30, 70]은 첫 번째 패널이 30%, 두 번째 패널이 70%를 차지) */
|
|
@@ -22,9 +28,17 @@ export declare class USplitPanel extends BaseElement {
|
|
|
22
28
|
disconnectedCallback(): void;
|
|
23
29
|
protected willUpdate(changedProperties: PropertyValues): void;
|
|
24
30
|
render(): import('lit-html').TemplateResult<1>;
|
|
25
|
-
|
|
31
|
+
/** 슬롯 변경시 패널 초기화 */
|
|
26
32
|
private handleSlotChange;
|
|
27
|
-
/**
|
|
28
|
-
private
|
|
29
|
-
|
|
33
|
+
/** 패널 및 크기 초기화 */
|
|
34
|
+
private initialize;
|
|
35
|
+
/** 패널에 새로운 스타일 적용 */
|
|
36
|
+
private updatePanelStyles;
|
|
37
|
+
private handleSplitterMouseDown;
|
|
38
|
+
private handleDocumentMouseMove;
|
|
39
|
+
private handleDocumentMouseUp;
|
|
40
|
+
/** 전역 이벤트 리스너 제거 */
|
|
41
|
+
private removeEventListeners;
|
|
42
|
+
/** 거터 크기 가져오기 */
|
|
43
|
+
private getGutterSize;
|
|
30
44
|
}
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { html } from 'lit';
|
|
2
|
-
import { queryAssignedElements, property } from 'lit/decorators.js';
|
|
3
|
-
import {
|
|
2
|
+
import { queryAssignedElements, state, property } from 'lit/decorators.js';
|
|
3
|
+
import { arrayAttrConverter } from '../../utilities/converters.js';
|
|
4
4
|
import { BaseElement } from '../BaseElement.js';
|
|
5
|
-
import { UDivider } from '../divider/UDivider.component.js';
|
|
6
5
|
import { styles } from './USplitPanel.styles.js';
|
|
7
6
|
|
|
8
7
|
var __defProp = Object.defineProperty;
|
|
@@ -17,90 +16,113 @@ var __decorateClass = (decorators, target, key, kind) => {
|
|
|
17
16
|
class USplitPanel extends BaseElement {
|
|
18
17
|
constructor() {
|
|
19
18
|
super(...arguments);
|
|
19
|
+
/** 현재 상태를 저장하는 패널 요소들 */
|
|
20
20
|
this.panels = [];
|
|
21
|
-
this.
|
|
22
|
-
|
|
23
|
-
this.
|
|
21
|
+
this.sizes = [];
|
|
22
|
+
/** 드래그 시작 시 저장되는 정보 */
|
|
23
|
+
this.draggingIndex = -1;
|
|
24
|
+
this.dragStartSizes = [];
|
|
25
|
+
this.dragStartPosition = 0;
|
|
26
|
+
this.containerSize = 0;
|
|
27
|
+
this.splitterCount = 0;
|
|
24
28
|
this.orientation = "horizontal";
|
|
25
29
|
this.initRatio = [];
|
|
26
30
|
this.minSizes = [];
|
|
27
31
|
this.maxSizes = [];
|
|
28
|
-
|
|
29
|
-
this.
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
32
|
+
/** 슬롯 변경시 패널 초기화 */
|
|
33
|
+
this.handleSlotChange = () => {
|
|
34
|
+
const panels = this.slotEls || [];
|
|
35
|
+
if (panels.every((p, i) => p === this.panels[i])) {
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
this.initialize();
|
|
39
|
+
};
|
|
40
|
+
/** 패널 및 크기 초기화 */
|
|
41
|
+
this.initialize = () => {
|
|
42
|
+
this.panels = this.slotEls || [];
|
|
43
|
+
if (this.panels.length === 0) {
|
|
44
|
+
this.splitterCount = 0;
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
this.splitterCount = Math.max(0, this.panels.length - 1);
|
|
33
48
|
if (this.initRatio.length === this.panels.length) {
|
|
34
|
-
const
|
|
35
|
-
this.
|
|
49
|
+
const total = this.initRatio.reduce((sum, r) => sum + r, 0);
|
|
50
|
+
this.sizes = this.initRatio.map((r) => r / total * 100);
|
|
36
51
|
} else {
|
|
37
|
-
const
|
|
38
|
-
this.
|
|
52
|
+
const equalSize = 100 / this.panels.length;
|
|
53
|
+
this.sizes = this.panels.map(() => equalSize);
|
|
39
54
|
}
|
|
40
|
-
this.
|
|
41
|
-
const property2 = this.orientation === "horizontal" ? "width" : "height";
|
|
42
|
-
const dividerSize = this.getDividerSize();
|
|
43
|
-
this.panels.forEach((panel, index) => {
|
|
44
|
-
const ratio = this.panelSizes[index];
|
|
45
|
-
panel.style.flex = "none";
|
|
46
|
-
panel.style[property2] = index === 0 || index === this.panels.length - 1 ? `calc(${ratio}% - ${dividerSize / 2}px)` : `calc(${ratio}% - ${dividerSize}px)`;
|
|
47
|
-
if (index === this.panels.length - 1) return;
|
|
48
|
-
const divider = new UDivider();
|
|
49
|
-
divider.orientation = this.orientation;
|
|
50
|
-
divider.movable = true;
|
|
51
|
-
divider.addEventListener("u-move", this.handleDividerMove);
|
|
52
|
-
this.dividers.push(divider);
|
|
53
|
-
panel.after(divider);
|
|
54
|
-
});
|
|
55
|
+
this.updatePanelStyles();
|
|
55
56
|
this.requestUpdate();
|
|
56
|
-
await this.updateComplete;
|
|
57
57
|
};
|
|
58
|
-
this.
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
58
|
+
this.handleSplitterMouseDown = (e, index) => {
|
|
59
|
+
if (e.button !== 0) return;
|
|
60
|
+
e.preventDefault();
|
|
61
|
+
this.draggingIndex = index;
|
|
62
|
+
this.dragStartPosition = this.orientation === "horizontal" ? e.clientX : e.clientY;
|
|
63
|
+
this.dragStartSizes = [...this.sizes];
|
|
64
|
+
const rect = this.getBoundingClientRect();
|
|
65
|
+
this.containerSize = this.orientation === "horizontal" ? rect.width : rect.height;
|
|
66
|
+
this.containerSize -= this.getGutterSize() * this.splitterCount;
|
|
67
|
+
const splitters = this.shadowRoot?.querySelectorAll(".splitter");
|
|
68
|
+
splitters?.[index]?.classList.add("active");
|
|
69
|
+
document.addEventListener("mousemove", this.handleDocumentMouseMove);
|
|
70
|
+
document.addEventListener("mouseup", this.handleDocumentMouseUp);
|
|
71
|
+
document.body.style.userSelect = "none";
|
|
72
|
+
document.body.style.cursor = this.orientation === "horizontal" ? "col-resize" : "row-resize";
|
|
64
73
|
};
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
const
|
|
69
|
-
const
|
|
70
|
-
|
|
71
|
-
const
|
|
72
|
-
const
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
const
|
|
76
|
-
const
|
|
77
|
-
const
|
|
78
|
-
|
|
79
|
-
if (
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
74
|
+
this.handleDocumentMouseMove = (e) => {
|
|
75
|
+
if (this.draggingIndex === -1) return;
|
|
76
|
+
e.preventDefault();
|
|
77
|
+
const currentPosition = this.orientation === "horizontal" ? e.clientX : e.clientY;
|
|
78
|
+
const delta = currentPosition - this.dragStartPosition;
|
|
79
|
+
const deltaPercent = delta / this.containerSize * 100;
|
|
80
|
+
const aIndex = this.draggingIndex;
|
|
81
|
+
const bIndex = this.draggingIndex + 1;
|
|
82
|
+
let newASize = this.dragStartSizes[aIndex] + deltaPercent;
|
|
83
|
+
let newBSize = this.dragStartSizes[bIndex] - deltaPercent;
|
|
84
|
+
const minAPercent = (this.minSizes[aIndex] ?? 0) / this.containerSize * 100;
|
|
85
|
+
const minBPercent = (this.minSizes[bIndex] ?? 0) / this.containerSize * 100;
|
|
86
|
+
const maxAPercent = this.maxSizes[aIndex] ? this.maxSizes[aIndex] / this.containerSize * 100 : 100;
|
|
87
|
+
const maxBPercent = this.maxSizes[bIndex] ? this.maxSizes[bIndex] / this.containerSize * 100 : 100;
|
|
88
|
+
if (newASize < minAPercent) {
|
|
89
|
+
newASize = minAPercent;
|
|
90
|
+
newBSize = this.dragStartSizes[aIndex] + this.dragStartSizes[bIndex] - newASize;
|
|
91
|
+
}
|
|
92
|
+
if (newBSize < minBPercent) {
|
|
93
|
+
newBSize = minBPercent;
|
|
94
|
+
newASize = this.dragStartSizes[aIndex] + this.dragStartSizes[bIndex] - newBSize;
|
|
95
|
+
}
|
|
96
|
+
if (newASize > maxAPercent) {
|
|
97
|
+
newASize = maxAPercent;
|
|
98
|
+
newBSize = this.dragStartSizes[aIndex] + this.dragStartSizes[bIndex] - newASize;
|
|
89
99
|
}
|
|
90
|
-
|
|
91
|
-
|
|
100
|
+
if (newBSize > maxBPercent) {
|
|
101
|
+
newBSize = maxBPercent;
|
|
102
|
+
newASize = this.dragStartSizes[aIndex] + this.dragStartSizes[bIndex] - newBSize;
|
|
103
|
+
}
|
|
104
|
+
this.sizes[aIndex] = newASize;
|
|
105
|
+
this.sizes[bIndex] = newBSize;
|
|
106
|
+
this.updatePanelStyles();
|
|
107
|
+
};
|
|
108
|
+
this.handleDocumentMouseUp = () => {
|
|
109
|
+
if (this.draggingIndex === -1) return;
|
|
110
|
+
const splitters = this.shadowRoot?.querySelectorAll(".splitter");
|
|
111
|
+
splitters?.[this.draggingIndex]?.classList.remove("active");
|
|
112
|
+
this.draggingIndex = -1;
|
|
113
|
+
this.removeEventListeners();
|
|
114
|
+
document.body.style.userSelect = "";
|
|
115
|
+
document.body.style.cursor = "";
|
|
92
116
|
};
|
|
93
117
|
}
|
|
94
118
|
static {
|
|
95
119
|
this.styles = [super.styles, styles];
|
|
96
120
|
}
|
|
97
121
|
static {
|
|
98
|
-
this.dependencies = {
|
|
99
|
-
"u-divider": UDivider
|
|
100
|
-
};
|
|
122
|
+
this.dependencies = {};
|
|
101
123
|
}
|
|
102
124
|
disconnectedCallback() {
|
|
103
|
-
this.
|
|
125
|
+
this.removeEventListeners();
|
|
104
126
|
super.disconnectedCallback();
|
|
105
127
|
}
|
|
106
128
|
willUpdate(changedProperties) {
|
|
@@ -111,29 +133,53 @@ class USplitPanel extends BaseElement {
|
|
|
111
133
|
}
|
|
112
134
|
render() {
|
|
113
135
|
return html`
|
|
136
|
+
${Array.from({ length: this.splitterCount }, (_, i) => html`
|
|
137
|
+
<div class="splitter" style="order: ${i * 2 + 1}"
|
|
138
|
+
orientation=${this.orientation}
|
|
139
|
+
@mousedown=${(e) => this.handleSplitterMouseDown(e, i)}>
|
|
140
|
+
</div>
|
|
141
|
+
`)}
|
|
114
142
|
<slot @slotchange=${this.handleSlotChange}></slot>
|
|
115
143
|
`;
|
|
116
144
|
}
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
const
|
|
120
|
-
|
|
145
|
+
/** 패널에 새로운 스타일 적용 */
|
|
146
|
+
updatePanelStyles() {
|
|
147
|
+
const dimension = this.orientation === "horizontal" ? "width" : "height";
|
|
148
|
+
const gutterSize = this.getGutterSize();
|
|
149
|
+
this.panels.forEach((panel, index) => {
|
|
150
|
+
const size = this.sizes[index];
|
|
151
|
+
panel.style[dimension] = `calc(${size}% - ${gutterSize * (this.splitterCount / this.panels.length)}px)`;
|
|
152
|
+
panel.style.order = String(index * 2);
|
|
153
|
+
});
|
|
154
|
+
}
|
|
155
|
+
/** 전역 이벤트 리스너 제거 */
|
|
156
|
+
removeEventListeners() {
|
|
157
|
+
document.removeEventListener("mousemove", this.handleDocumentMouseMove);
|
|
158
|
+
document.removeEventListener("mouseup", this.handleDocumentMouseUp);
|
|
159
|
+
}
|
|
160
|
+
/** 거터 크기 가져오기 */
|
|
161
|
+
getGutterSize() {
|
|
162
|
+
const sizeStr = getComputedStyle(this).getPropertyValue("--splitter-size").trim();
|
|
163
|
+
return parseFloat(sizeStr) || 4;
|
|
121
164
|
}
|
|
122
165
|
}
|
|
123
166
|
__decorateClass([
|
|
124
167
|
queryAssignedElements({ flatten: true })
|
|
125
|
-
], USplitPanel.prototype, "
|
|
168
|
+
], USplitPanel.prototype, "slotEls");
|
|
169
|
+
__decorateClass([
|
|
170
|
+
state()
|
|
171
|
+
], USplitPanel.prototype, "splitterCount");
|
|
126
172
|
__decorateClass([
|
|
127
173
|
property({ type: String, reflect: true })
|
|
128
174
|
], USplitPanel.prototype, "orientation");
|
|
129
175
|
__decorateClass([
|
|
130
|
-
property({ type: Array, attribute: "init-ratio", converter:
|
|
176
|
+
property({ type: Array, attribute: "init-ratio", converter: arrayAttrConverter(parseFloat) })
|
|
131
177
|
], USplitPanel.prototype, "initRatio");
|
|
132
178
|
__decorateClass([
|
|
133
|
-
property({ type: Array, attribute: "min-sizes", converter:
|
|
179
|
+
property({ type: Array, attribute: "min-sizes", converter: arrayAttrConverter(parseFloat) })
|
|
134
180
|
], USplitPanel.prototype, "minSizes");
|
|
135
181
|
__decorateClass([
|
|
136
|
-
property({ type: Array, attribute: "max-sizes", converter:
|
|
182
|
+
property({ type: Array, attribute: "max-sizes", converter: arrayAttrConverter(parseFloat) })
|
|
137
183
|
], USplitPanel.prototype, "maxSizes");
|
|
138
184
|
|
|
139
185
|
export { USplitPanel };
|
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
import { css } from 'lit';
|
|
2
2
|
|
|
3
3
|
const styles = css`
|
|
4
|
+
:host {
|
|
5
|
+
--splitter-size: 4px;
|
|
6
|
+
--splitter-color: var(--u-neutral-200, #e5e7eb);
|
|
7
|
+
--splitter-active-color: var(--u-blue-500, #3b82f6);
|
|
8
|
+
}
|
|
9
|
+
|
|
4
10
|
:host {
|
|
5
11
|
position: relative;
|
|
6
12
|
display: flex;
|
|
@@ -14,6 +20,30 @@ const styles = css`
|
|
|
14
20
|
:host([orientation="vertical"]) {
|
|
15
21
|
flex-direction: column;
|
|
16
22
|
}
|
|
23
|
+
|
|
24
|
+
/* Splitter */
|
|
25
|
+
.splitter {
|
|
26
|
+
flex-shrink: 0;
|
|
27
|
+
background-color: var(--splitter-color);
|
|
28
|
+
transition: background-color 0.15s ease;
|
|
29
|
+
}
|
|
30
|
+
.splitter[orientation="horizontal"] {
|
|
31
|
+
width: var(--splitter-size);
|
|
32
|
+
cursor: col-resize;
|
|
33
|
+
}
|
|
34
|
+
.splitter[orientation="vertical"] {
|
|
35
|
+
height: var(--splitter-size);
|
|
36
|
+
cursor: row-resize;
|
|
37
|
+
}
|
|
38
|
+
.splitter:hover,
|
|
39
|
+
.splitter.active {
|
|
40
|
+
background-color: var(--splitter-active-color);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/* Slotted panels */
|
|
44
|
+
::slotted(*) {
|
|
45
|
+
overflow: auto;
|
|
46
|
+
}
|
|
17
47
|
`;
|
|
18
48
|
|
|
19
49
|
export { styles };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { BaseElement } from '../BaseElement.js';
|
|
2
|
+
export type TagVariant = "default" | "info" | "success" | "warning" | "danger";
|
|
3
|
+
/**
|
|
4
|
+
* Tag 컴포넌트는 레이블, 카테고리, 상태 등을 표시하는데 사용됩니다.
|
|
5
|
+
* @slot - 태그 내부에 표시할 콘텐츠를 삽입합니다.
|
|
6
|
+
* @slot prefix - 태그의 접두사로 표시할 콘텐츠를 삽입합니다.
|
|
7
|
+
* @slot suffix - 태그의 접미사로 표시할 콘텐츠를 삽입합니다.
|
|
8
|
+
*/
|
|
9
|
+
export declare class UTag extends BaseElement {
|
|
10
|
+
static styles: import('lit').CSSResultGroup[];
|
|
11
|
+
static dependencies: Record<string, typeof BaseElement>;
|
|
12
|
+
/** 태그의 스타일 변형을 설정합니다. */
|
|
13
|
+
variant: TagVariant;
|
|
14
|
+
/** 태그를 둥글게 표시합니다. */
|
|
15
|
+
rounded: boolean;
|
|
16
|
+
/** 태그를 제거 가능하게 설정합니다. */
|
|
17
|
+
removable: boolean;
|
|
18
|
+
connectedCallback(): void;
|
|
19
|
+
disconnectedCallback(): void;
|
|
20
|
+
render(): import('lit-html').TemplateResult<1>;
|
|
21
|
+
private handleRemoveButtonClick;
|
|
22
|
+
private handleTransitionEnd;
|
|
23
|
+
}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { html } from 'lit';
|
|
2
|
+
import { property } from 'lit/decorators.js';
|
|
3
|
+
import { BaseElement } from '../BaseElement.js';
|
|
4
|
+
import { styles } from './UTag.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 UTag extends BaseElement {
|
|
16
|
+
constructor() {
|
|
17
|
+
super(...arguments);
|
|
18
|
+
this.variant = "default";
|
|
19
|
+
this.rounded = false;
|
|
20
|
+
this.removable = false;
|
|
21
|
+
this.handleRemoveButtonClick = (e) => {
|
|
22
|
+
e.stopPropagation();
|
|
23
|
+
this.emit("u-remove");
|
|
24
|
+
requestAnimationFrame(() => {
|
|
25
|
+
this.style.transform = "scale(0.8)";
|
|
26
|
+
this.style.opacity = "0";
|
|
27
|
+
});
|
|
28
|
+
};
|
|
29
|
+
this.handleTransitionEnd = (e) => {
|
|
30
|
+
if (e.propertyName === "opacity" && this.style.opacity === "0") {
|
|
31
|
+
this.remove();
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
static {
|
|
36
|
+
this.styles = [super.styles, styles];
|
|
37
|
+
}
|
|
38
|
+
static {
|
|
39
|
+
this.dependencies = {};
|
|
40
|
+
}
|
|
41
|
+
connectedCallback() {
|
|
42
|
+
super.connectedCallback();
|
|
43
|
+
this.addEventListener("transitionend", this.handleTransitionEnd);
|
|
44
|
+
}
|
|
45
|
+
disconnectedCallback() {
|
|
46
|
+
this.removeEventListener("transitionend", this.handleTransitionEnd);
|
|
47
|
+
super.disconnectedCallback();
|
|
48
|
+
}
|
|
49
|
+
render() {
|
|
50
|
+
return html`
|
|
51
|
+
<slot name="prefix"></slot>
|
|
52
|
+
<slot></slot>
|
|
53
|
+
<slot name="suffix"></slot>
|
|
54
|
+
<button class="remove-btn" part="remove-btn"
|
|
55
|
+
?hidden=${!this.removable}
|
|
56
|
+
@click=${this.handleRemoveButtonClick}>
|
|
57
|
+
×
|
|
58
|
+
</button>
|
|
59
|
+
`;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
__decorateClass([
|
|
63
|
+
property({ type: String, reflect: true })
|
|
64
|
+
], UTag.prototype, "variant");
|
|
65
|
+
__decorateClass([
|
|
66
|
+
property({ type: Boolean, reflect: true })
|
|
67
|
+
], UTag.prototype, "rounded");
|
|
68
|
+
__decorateClass([
|
|
69
|
+
property({ type: Boolean, reflect: true })
|
|
70
|
+
], UTag.prototype, "removable");
|
|
71
|
+
|
|
72
|
+
export { UTag };
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { css } from 'lit';
|
|
2
|
+
|
|
3
|
+
const styles = css`
|
|
4
|
+
:host {
|
|
5
|
+
display: inline-flex;
|
|
6
|
+
align-items: center;
|
|
7
|
+
gap: 4px;
|
|
8
|
+
font-size: 12px;
|
|
9
|
+
padding: 0.25em 0.5em;
|
|
10
|
+
border-radius: 4px;
|
|
11
|
+
font-weight: 500;
|
|
12
|
+
line-height: 1.5em;
|
|
13
|
+
white-space: nowrap;
|
|
14
|
+
user-select: none;
|
|
15
|
+
opacity: 1;
|
|
16
|
+
transform: scale(1);
|
|
17
|
+
transition: opacity 0.2s ease, transform 0.2s ease;
|
|
18
|
+
}
|
|
19
|
+
/* Style variants */
|
|
20
|
+
:host([variant="default"]) {
|
|
21
|
+
color: var(--u-neutral-800);
|
|
22
|
+
border: 1px solid var(--u-neutral-300);
|
|
23
|
+
background-color: var(--u-neutral-100);
|
|
24
|
+
}
|
|
25
|
+
:host([variant="info"]) {
|
|
26
|
+
color: var(--u-blue-800);
|
|
27
|
+
border: 1px solid var(--u-blue-300);
|
|
28
|
+
background-color: var(--u-blue-100);
|
|
29
|
+
}
|
|
30
|
+
:host([variant="success"]) {
|
|
31
|
+
color: var(--u-green-800);
|
|
32
|
+
border: 1px solid var(--u-green-300);
|
|
33
|
+
background-color: var(--u-green-100);
|
|
34
|
+
}
|
|
35
|
+
:host([variant="warning"]) {
|
|
36
|
+
color: var(--u-yellow-800);
|
|
37
|
+
border: 1px solid var(--u-yellow-300);
|
|
38
|
+
background-color: var(--u-yellow-100);
|
|
39
|
+
}
|
|
40
|
+
:host([variant="danger"]) {
|
|
41
|
+
color: var(--u-red-800);
|
|
42
|
+
border: 1px solid var(--u-red-300);
|
|
43
|
+
background-color: var(--u-red-100);
|
|
44
|
+
}
|
|
45
|
+
/* Rounded variant */
|
|
46
|
+
:host([rounded]) {
|
|
47
|
+
border-radius: 999px;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/* Slot styles */
|
|
51
|
+
::slotted([slot="prefix"]) {
|
|
52
|
+
margin-right: 0.2em;
|
|
53
|
+
}
|
|
54
|
+
::slotted([slot="suffix"]) {
|
|
55
|
+
margin-left: 0.2em;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/* Remove button */
|
|
59
|
+
.remove-btn {
|
|
60
|
+
display: inline-flex;
|
|
61
|
+
align-items: center;
|
|
62
|
+
justify-content: center;
|
|
63
|
+
font-size: 1.5em;
|
|
64
|
+
width: 1em;
|
|
65
|
+
height: 1em;
|
|
66
|
+
line-height: 1.2em;
|
|
67
|
+
padding: 0;
|
|
68
|
+
border: none;
|
|
69
|
+
border-radius: 50%;
|
|
70
|
+
color: currentColor;
|
|
71
|
+
background-color: transparent;
|
|
72
|
+
transition: background-color 0.2s ease;
|
|
73
|
+
cursor: pointer;
|
|
74
|
+
}
|
|
75
|
+
.remove-btn:hover {
|
|
76
|
+
background-color: rgba(0, 0, 0, 0.1);
|
|
77
|
+
}
|
|
78
|
+
.remove-btn:active {
|
|
79
|
+
background-color: rgba(0, 0, 0, 0.2);
|
|
80
|
+
}
|
|
81
|
+
`;
|
|
82
|
+
|
|
83
|
+
export { styles };
|
|
@@ -7,10 +7,18 @@ import { FloatingElement } from '../FloatingElement.js';
|
|
|
7
7
|
export declare class UTooltip extends FloatingElement {
|
|
8
8
|
static styles: import('lit').CSSResultGroup[];
|
|
9
9
|
static dependencies: Record<string, typeof BaseElement>;
|
|
10
|
+
/**
|
|
11
|
+
* 툴팁 내부로 마우스를 이동해도 툴팁이 유지되는지 여부입니다.
|
|
12
|
+
* true일 경우 툴팁 위에 마우스를 올려놓을 수 있습니다.
|
|
13
|
+
*
|
|
14
|
+
* @default false
|
|
15
|
+
*/
|
|
16
|
+
interactive: boolean;
|
|
10
17
|
protected updated(changedProperties: PropertyValues): void;
|
|
11
18
|
render(): import('lit-html').TemplateResult<1>;
|
|
12
19
|
/** this 바인딩 이벤트 핸들러 */
|
|
13
20
|
private _show;
|
|
21
|
+
/** this 바인딩 이벤트 핸들러 */
|
|
14
22
|
private _hide;
|
|
15
23
|
/** 바인딩 이벤트 핸들러 */
|
|
16
24
|
private bind;
|