@iyulab/components 0.1.4 → 0.1.5
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/assets/styles/dark.css +40 -36
- package/dist/assets/styles/dark.css.js +1 -1
- package/dist/assets/styles/light.css +41 -38
- package/dist/assets/styles/light.css.js +1 -1
- package/dist/components/BaseElement.styles.js +2 -2
- package/dist/components/alert/Alert.d.ts +8 -4
- package/dist/components/alert/Alert.js +24 -15
- package/dist/components/alert/Alert.styles.js +32 -39
- package/dist/components/alert/index.js +5 -0
- package/dist/components/button/Button.js +4 -2
- package/dist/components/button/Button.styles.js +13 -20
- package/dist/components/button/index.js +5 -0
- package/dist/components/context-menu/index.js +5 -0
- package/dist/components/copy-button/CopyButton.d.ts +7 -3
- package/dist/components/copy-button/CopyButton.js +69 -0
- package/dist/components/copy-button/CopyButton.styles.js +17 -0
- package/dist/components/copy-button/index.js +5 -0
- package/dist/components/dialog/index.js +5 -0
- package/dist/components/divider/Divider.d.ts +5 -5
- package/dist/components/divider/Divider.js +15 -15
- package/dist/components/divider/Divider.styles.js +7 -5
- package/dist/components/divider/index.js +5 -0
- package/dist/components/form/Form.d.ts +3 -1
- package/dist/components/form/Form.js +3 -1
- package/dist/components/form/Form.styles.js +1 -0
- package/dist/components/form/index.js +5 -0
- package/dist/components/icon/Icon.d.ts +6 -12
- package/dist/components/icon/Icon.js +14 -30
- package/dist/components/icon/Icon.styles.js +1 -1
- package/dist/components/icon/index.js +5 -0
- package/dist/components/icon-button/IconButton.d.ts +3 -3
- package/dist/components/icon-button/IconButton.js +6 -6
- package/dist/components/icon-button/IconButton.styles.js +14 -29
- package/dist/components/icon-button/index.js +5 -0
- package/dist/components/index.d.ts +1 -1
- package/dist/components/input/Input.d.ts +14 -13
- package/dist/components/input/Input.js +56 -55
- package/dist/components/input/Input.styles.js +52 -54
- package/dist/components/input/index.js +5 -0
- package/dist/components/menu/index.js +5 -0
- package/dist/components/progress-bar/ProgressBar.d.ts +1 -1
- package/dist/components/progress-bar/ProgressBar.js +2 -2
- package/dist/components/progress-bar/ProgressBar.styles.js +10 -10
- package/dist/components/progress-bar/index.js +5 -0
- package/dist/components/progress-ring/ProgressRing.d.ts +2 -2
- package/dist/components/progress-ring/ProgressRing.js +7 -6
- package/dist/components/progress-ring/ProgressRing.styles.js +8 -9
- package/dist/components/progress-ring/index.js +5 -0
- package/dist/components/spinner/Spinner.styles.js +5 -3
- package/dist/components/spinner/index.js +5 -0
- package/dist/components/split-panel/SplitPanel.d.ts +1 -1
- package/dist/components/split-panel/SplitPanel.js +5 -7
- package/dist/components/split-panel/index.js +5 -0
- package/dist/components/tooltip/Tooltip.styles.js +1 -1
- package/dist/components/tooltip/index.js +5 -0
- package/dist/components/tree/index.js +5 -0
- package/dist/components/tree-item/index.js +5 -0
- package/dist/index.js +24 -5
- package/dist/integrations/react/index.d.ts +0 -1
- package/dist/integrations/react/index.js +0 -1
- package/dist/internals/index.d.ts +0 -1
- package/dist/utilities/decorators.js +2 -0
- package/dist/utilities/icons.d.ts +46 -0
- package/dist/utilities/icons.js +114 -0
- package/dist/utilities/index.d.ts +1 -0
- package/dist/utilities/notifier.d.ts +17 -7
- package/dist/utilities/notifier.js +51 -41
- package/dist/utilities/theme.d.ts +15 -20
- package/dist/utilities/theme.js +24 -20
- package/package.json +7 -6
- package/dist/components/panel/Panel.d.ts +0 -9
- package/dist/components/panel/Panel.js +0 -17
- package/dist/components/panel/Panel.styles.d.ts +0 -1
- package/dist/components/panel/Panel.styles.js +0 -12
- package/dist/components/panel/index.d.ts +0 -7
- package/dist/integrations/react/UPanel.d.ts +0 -8
- package/dist/integrations/react/UPanel.js +0 -10
- package/dist/internals/icon-helpers.d.ts +0 -32
- package/dist/internals/icon-helpers.js +0 -48
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { html } from 'lit';
|
|
2
|
+
import { state, property } from 'lit/decorators.js';
|
|
3
|
+
import { BaseElement } from '../BaseElement.js';
|
|
4
|
+
import { IconButton } from '../icon-button/IconButton.js';
|
|
5
|
+
import { styles } from './CopyButton.styles.js';
|
|
6
|
+
|
|
7
|
+
var __defProp = Object.defineProperty;
|
|
8
|
+
var __decorateClass = (decorators, target, key, kind) => {
|
|
9
|
+
var result = void 0 ;
|
|
10
|
+
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
11
|
+
if (decorator = decorators[i])
|
|
12
|
+
result = (decorator(target, key, result) ) || result;
|
|
13
|
+
if (result) __defProp(target, key, result);
|
|
14
|
+
return result;
|
|
15
|
+
};
|
|
16
|
+
class CopyButton extends BaseElement {
|
|
17
|
+
constructor() {
|
|
18
|
+
super(...arguments);
|
|
19
|
+
this.copied = false;
|
|
20
|
+
this.borderless = false;
|
|
21
|
+
this.disabled = false;
|
|
22
|
+
this.value = "";
|
|
23
|
+
/** 복사 버튼 클릭 핸들러 */
|
|
24
|
+
this.handleButtonClick = async () => {
|
|
25
|
+
try {
|
|
26
|
+
await navigator.clipboard.writeText(this.value);
|
|
27
|
+
this.copied = true;
|
|
28
|
+
this.emit("u-copy", { value: this.value });
|
|
29
|
+
setTimeout(() => this.copied = false, 2e3);
|
|
30
|
+
} catch (error) {
|
|
31
|
+
console.error("Failed to copy text: ", error);
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
static {
|
|
36
|
+
this.styles = [super.styles, styles];
|
|
37
|
+
}
|
|
38
|
+
static {
|
|
39
|
+
this.dependencies = {
|
|
40
|
+
"u-icon-button": IconButton
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
render() {
|
|
44
|
+
return html`
|
|
45
|
+
<u-icon-button part="base"
|
|
46
|
+
?copied=${this.copied}
|
|
47
|
+
.borderless=${this.borderless}
|
|
48
|
+
.disabled=${this.disabled || this.copied}
|
|
49
|
+
.library=${"internal"}
|
|
50
|
+
.name=${this.copied ? "check-lg" : "copy"}
|
|
51
|
+
@click=${this.handleButtonClick}>
|
|
52
|
+
</u-icon-button>
|
|
53
|
+
`;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
__decorateClass([
|
|
57
|
+
state()
|
|
58
|
+
], CopyButton.prototype, "copied");
|
|
59
|
+
__decorateClass([
|
|
60
|
+
property({ type: Boolean })
|
|
61
|
+
], CopyButton.prototype, "borderless");
|
|
62
|
+
__decorateClass([
|
|
63
|
+
property({ type: Boolean })
|
|
64
|
+
], CopyButton.prototype, "disabled");
|
|
65
|
+
__decorateClass([
|
|
66
|
+
property({ type: String })
|
|
67
|
+
], CopyButton.prototype, "value");
|
|
68
|
+
|
|
69
|
+
export { CopyButton };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { css } from 'lit';
|
|
2
|
+
|
|
3
|
+
const styles = css`
|
|
4
|
+
:host {
|
|
5
|
+
display: inline-block;
|
|
6
|
+
font-size: 16px;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
u-icon-button {
|
|
10
|
+
font-size: inherit;
|
|
11
|
+
}
|
|
12
|
+
u-icon-button[copied] {
|
|
13
|
+
color: var(--u-green-600, #16a34a);
|
|
14
|
+
}
|
|
15
|
+
`;
|
|
16
|
+
|
|
17
|
+
export { styles };
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import { nothing } from 'lit';
|
|
2
2
|
import { BaseElement } from '../BaseElement.js';
|
|
3
3
|
/**
|
|
4
|
-
* Divider 컴포넌트는 엘리먼트 사이에
|
|
4
|
+
* Divider 컴포넌트는 엘리먼트 사이에 움직임이 가능한 구분선을 제공합니다.
|
|
5
5
|
*/
|
|
6
6
|
export declare class Divider extends BaseElement {
|
|
7
7
|
static styles: import('lit').CSSResultGroup[];
|
|
8
8
|
static dependencies: Record<string, typeof BaseElement>;
|
|
9
9
|
/** 마지막 마우스 위치를 저장합니다. */
|
|
10
10
|
private position;
|
|
11
|
-
/**
|
|
12
|
-
|
|
13
|
-
/** 드래그 가능 여부를 설정합니다. */
|
|
14
|
-
draggable: boolean;
|
|
11
|
+
/** 분할선이 움직이는지 여부를 나타냅니다. */
|
|
12
|
+
moving: boolean;
|
|
15
13
|
/** 분할 방향을 설정합니다. */
|
|
16
14
|
orientation: 'horizontal' | 'vertical';
|
|
15
|
+
/** 분할선을 움직일 수 있는지 여부를 설정합니다. */
|
|
16
|
+
movable: boolean;
|
|
17
17
|
disconnectedCallback(): void;
|
|
18
18
|
render(): typeof nothing | import('lit-html').TemplateResult<1>;
|
|
19
19
|
/** 마우스 다운 이벤트 핸들러 */
|
|
@@ -17,15 +17,15 @@ class Divider extends BaseElement {
|
|
|
17
17
|
super(...arguments);
|
|
18
18
|
/** 마지막 마우스 위치를 저장합니다. */
|
|
19
19
|
this.position = 0;
|
|
20
|
-
this.
|
|
21
|
-
this.draggable = false;
|
|
20
|
+
this.moving = false;
|
|
22
21
|
this.orientation = "horizontal";
|
|
22
|
+
this.movable = false;
|
|
23
23
|
/** 마우스 다운 이벤트 핸들러 */
|
|
24
24
|
this.handleMouseDown = (e) => {
|
|
25
25
|
e.preventDefault();
|
|
26
|
-
this.
|
|
26
|
+
this.moving = true;
|
|
27
27
|
this.position = this.orientation === "horizontal" ? e.clientX : e.clientY;
|
|
28
|
-
this.emit("u-
|
|
28
|
+
this.emit("u-movestart");
|
|
29
29
|
document.addEventListener("mousemove", this.handleMouseMove);
|
|
30
30
|
document.addEventListener("mouseup", this.handleMouseUp);
|
|
31
31
|
document.body.style.userSelect = "none";
|
|
@@ -33,18 +33,18 @@ class Divider extends BaseElement {
|
|
|
33
33
|
};
|
|
34
34
|
/** 마우스 무브 이벤트 핸들러 */
|
|
35
35
|
this.handleMouseMove = (e) => {
|
|
36
|
-
if (!this.
|
|
36
|
+
if (!this.moving) return;
|
|
37
37
|
e.preventDefault();
|
|
38
38
|
const position = this.orientation === "horizontal" ? e.clientX : e.clientY;
|
|
39
39
|
const delta = position - this.position;
|
|
40
|
-
this.emit("u-
|
|
40
|
+
this.emit("u-move", { delta });
|
|
41
41
|
this.position = position;
|
|
42
42
|
};
|
|
43
43
|
/** 마우스 업 이벤트 핸들러 */
|
|
44
44
|
this.handleMouseUp = (_) => {
|
|
45
|
-
if (!this.
|
|
46
|
-
this.
|
|
47
|
-
this.emit("u-
|
|
45
|
+
if (!this.moving) return;
|
|
46
|
+
this.moving = false;
|
|
47
|
+
this.emit("u-moveend");
|
|
48
48
|
document.removeEventListener("mousemove", this.handleMouseMove);
|
|
49
49
|
document.removeEventListener("mouseup", this.handleMouseUp);
|
|
50
50
|
document.body.style.userSelect = "";
|
|
@@ -63,10 +63,10 @@ class Divider extends BaseElement {
|
|
|
63
63
|
document.removeEventListener("mouseup", this.handleMouseUp);
|
|
64
64
|
}
|
|
65
65
|
render() {
|
|
66
|
-
if (this.
|
|
66
|
+
if (this.movable) {
|
|
67
67
|
return html`
|
|
68
68
|
<div class="handler"
|
|
69
|
-
?
|
|
69
|
+
?moving=${this.moving}
|
|
70
70
|
orientation=${this.orientation}
|
|
71
71
|
@mousedown=${this.handleMouseDown}
|
|
72
72
|
></div>
|
|
@@ -78,12 +78,12 @@ class Divider extends BaseElement {
|
|
|
78
78
|
}
|
|
79
79
|
__decorateClass([
|
|
80
80
|
state()
|
|
81
|
-
], Divider.prototype, "
|
|
82
|
-
__decorateClass([
|
|
83
|
-
property({ type: Boolean, reflect: true })
|
|
84
|
-
], Divider.prototype, "draggable");
|
|
81
|
+
], Divider.prototype, "moving");
|
|
85
82
|
__decorateClass([
|
|
86
83
|
property({ type: String, reflect: true })
|
|
87
84
|
], Divider.prototype, "orientation");
|
|
85
|
+
__decorateClass([
|
|
86
|
+
property({ type: Boolean, reflect: true })
|
|
87
|
+
], Divider.prototype, "movable");
|
|
88
88
|
|
|
89
89
|
export { Divider };
|
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
import { css } from 'lit';
|
|
2
2
|
|
|
3
3
|
const styles = css`
|
|
4
|
+
:host {
|
|
5
|
+
--divider-size: 2px;
|
|
6
|
+
--handler-size: 4px;
|
|
7
|
+
--handler-color: var(--u-blue-500, #3b82f6);
|
|
8
|
+
}
|
|
9
|
+
|
|
4
10
|
:host {
|
|
5
11
|
position: relative;
|
|
6
12
|
display: block;
|
|
7
13
|
flex-shrink: 0;
|
|
8
14
|
background-color: var(--u-neutral-200, #e5e7eb);
|
|
9
|
-
|
|
10
|
-
--divider-size: 2px;
|
|
11
|
-
--handler-size: 4px;
|
|
12
|
-
--handler-color: var(--u-blue-500, #3b82f6);
|
|
13
15
|
}
|
|
14
16
|
:host([orientation="horizontal"]) {
|
|
15
17
|
width: var(--divider-size, 2px);
|
|
@@ -46,7 +48,7 @@ const styles = css`
|
|
|
46
48
|
width: 100%;
|
|
47
49
|
height: var(--handler-size, 4px);
|
|
48
50
|
}
|
|
49
|
-
.handler[
|
|
51
|
+
.handler[moving],
|
|
50
52
|
.handler:hover {
|
|
51
53
|
opacity: 1;
|
|
52
54
|
}
|
|
@@ -15,7 +15,9 @@ export declare class Form extends BaseElement {
|
|
|
15
15
|
connectedCallback(): void;
|
|
16
16
|
disconnectedCallback(): void;
|
|
17
17
|
render(): import('lit-html').TemplateResult<1>;
|
|
18
|
-
/**
|
|
18
|
+
/**
|
|
19
|
+
* 폼 내의 모든 입력 요소를 검증합니다.
|
|
20
|
+
*/
|
|
19
21
|
validate(): boolean;
|
|
20
22
|
/** 입력 요소의 변경 이벤트를 처리합니다. */
|
|
21
23
|
private handleChange;
|
|
@@ -51,7 +51,9 @@ class Form extends BaseElement {
|
|
|
51
51
|
<slot></slot>
|
|
52
52
|
`;
|
|
53
53
|
}
|
|
54
|
-
/**
|
|
54
|
+
/**
|
|
55
|
+
* 폼 내의 모든 입력 요소를 검증합니다.
|
|
56
|
+
*/
|
|
55
57
|
validate() {
|
|
56
58
|
const slot = this.shadowRoot?.querySelector("slot");
|
|
57
59
|
const inputEls = slot?.assignedElements({ flatten: true }).filter((el) => el instanceof Input) || [];
|
|
@@ -6,24 +6,18 @@ export declare class Icon extends BaseElement {
|
|
|
6
6
|
static styles: import('lit').CSSResultGroup[];
|
|
7
7
|
static dependencies: Record<string, typeof BaseElement>;
|
|
8
8
|
/**
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
* -
|
|
12
|
-
*
|
|
9
|
+
* 사용할 아이콘 라이브러리를 지정합니다.
|
|
10
|
+
*
|
|
11
|
+
* - 기본 내장: "internal" | "default"
|
|
12
|
+
* - 사용자 확장 라이브러리: icons.register()로 등록한 라이브러리 이름
|
|
13
|
+
* @default "default"
|
|
13
14
|
*/
|
|
14
|
-
|
|
15
|
+
library: "internal" | "default" | (string & {});
|
|
15
16
|
/**
|
|
16
17
|
* 사용할 아이콘의 이름을 지정합니다.
|
|
17
|
-
* @description 외부에서 불러오는 SVG 아이콘인 경우, 이름은 파일명(확장자 제외)이어야 합니다.
|
|
18
18
|
*/
|
|
19
19
|
name?: string;
|
|
20
20
|
render(): import('lit-html/directive.js').DirectiveResult<typeof import('lit-html/directives/until.js').UntilDirective>;
|
|
21
|
-
/**
|
|
22
|
-
* 아이콘의 HTML 콘텐츠를 가져옵니다.
|
|
23
|
-
* 외부 아이콘 경로를 사용하거나, 내부 레지스트리에서 아이콘을 찾습니다.
|
|
24
|
-
* @param name 아이콘 이름
|
|
25
|
-
*/
|
|
26
|
-
private load;
|
|
27
21
|
/**
|
|
28
22
|
* SVG 콘텐츠가 유효한 HTML인지 검사합니다.
|
|
29
23
|
*/
|
|
@@ -3,7 +3,7 @@ import { property } from 'lit/decorators.js';
|
|
|
3
3
|
import { unsafeHTML } from 'lit/directives/unsafe-html.js';
|
|
4
4
|
import { until } from 'lit/directives/until.js';
|
|
5
5
|
import { BaseElement } from '../BaseElement.js';
|
|
6
|
-
import {
|
|
6
|
+
import { icons } from '../../utilities/icons.js';
|
|
7
7
|
import { styles } from './Icon.styles.js';
|
|
8
8
|
|
|
9
9
|
var __defProp = Object.defineProperty;
|
|
@@ -18,7 +18,7 @@ var __decorateClass = (decorators, target, key, kind) => {
|
|
|
18
18
|
class Icon extends BaseElement {
|
|
19
19
|
constructor() {
|
|
20
20
|
super(...arguments);
|
|
21
|
-
this.
|
|
21
|
+
this.library = "default";
|
|
22
22
|
}
|
|
23
23
|
static {
|
|
24
24
|
this.styles = [super.styles, styles];
|
|
@@ -28,44 +28,28 @@ class Icon extends BaseElement {
|
|
|
28
28
|
}
|
|
29
29
|
render() {
|
|
30
30
|
if (!this.name) return nothing;
|
|
31
|
-
return until(
|
|
32
|
-
|
|
33
|
-
return unsafeHTML(html);
|
|
31
|
+
return until(icons.resolve(this.library, this.name).then((html) => {
|
|
32
|
+
return this.validate(html) ? unsafeHTML(html) : nothing;
|
|
34
33
|
}), nothing);
|
|
35
34
|
}
|
|
36
|
-
/**
|
|
37
|
-
* 아이콘의 HTML 콘텐츠를 가져옵니다.
|
|
38
|
-
* 외부 아이콘 경로를 사용하거나, 내부 레지스트리에서 아이콘을 찾습니다.
|
|
39
|
-
* @param name 아이콘 이름
|
|
40
|
-
*/
|
|
41
|
-
async load(name) {
|
|
42
|
-
if (this.remote) {
|
|
43
|
-
const baseUrl = getBaseUrl();
|
|
44
|
-
const remoteUrl = baseUrl.endsWith("/") ? `${baseUrl}${name}.svg` : `${baseUrl}/${name}.svg`;
|
|
45
|
-
try {
|
|
46
|
-
const response = await fetch(remoteUrl);
|
|
47
|
-
if (!response.ok) return void 0;
|
|
48
|
-
return (await response.text())?.trim();
|
|
49
|
-
} catch (error) {
|
|
50
|
-
console.error(error);
|
|
51
|
-
return void 0;
|
|
52
|
-
}
|
|
53
|
-
} else {
|
|
54
|
-
return iconBundle.get(name)?.trim();
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
35
|
/**
|
|
58
36
|
* SVG 콘텐츠가 유효한 HTML인지 검사합니다.
|
|
59
37
|
*/
|
|
60
38
|
validate(html) {
|
|
61
39
|
if (!html) return false;
|
|
62
|
-
|
|
63
|
-
|
|
40
|
+
const trimmed = html.trim();
|
|
41
|
+
try {
|
|
42
|
+
const doc = new DOMParser().parseFromString(trimmed, "image/svg+xml");
|
|
43
|
+
if (doc.querySelector("parsererror")) return false;
|
|
44
|
+
return doc.documentElement?.tagName.toLowerCase() === "svg";
|
|
45
|
+
} catch {
|
|
46
|
+
return false;
|
|
47
|
+
}
|
|
64
48
|
}
|
|
65
49
|
}
|
|
66
50
|
__decorateClass([
|
|
67
|
-
property({ type:
|
|
68
|
-
], Icon.prototype, "
|
|
51
|
+
property({ type: String, attribute: "lib" })
|
|
52
|
+
], Icon.prototype, "library");
|
|
69
53
|
__decorateClass([
|
|
70
54
|
property({ type: String })
|
|
71
55
|
], Icon.prototype, "name");
|
|
@@ -5,14 +5,14 @@ import { BaseElement } from '../BaseElement.js';
|
|
|
5
5
|
export declare class IconButton extends BaseElement {
|
|
6
6
|
static styles: import('lit').CSSResultGroup[];
|
|
7
7
|
static dependencies: Record<string, typeof BaseElement>;
|
|
8
|
-
/** 경계선이 없는
|
|
8
|
+
/** 경계선이 없는 스타일을 적용합니다. */
|
|
9
9
|
borderless: boolean;
|
|
10
10
|
/** 버튼이 비활성화 상태인지 여부를 설정합니다. 비활성화된 버튼은 클릭할 수 없습니다. */
|
|
11
11
|
disabled: boolean;
|
|
12
12
|
/** 버튼이 로딩 상태인지 여부를 설정합니다. 로딩 중에는 버튼이 비활성화되고 스피너가 표시됩니다. */
|
|
13
13
|
loading: boolean;
|
|
14
|
-
/**
|
|
15
|
-
|
|
14
|
+
/** 아이콘 라이브러리를 지정합니다. */
|
|
15
|
+
library: "internal" | "default" | (string & {});
|
|
16
16
|
/** 아이콘의 이름을 지정합니다. */
|
|
17
17
|
name?: string;
|
|
18
18
|
render(): import('lit-html').TemplateResult<1>;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { html } from 'lit';
|
|
2
2
|
import { property } from 'lit/decorators.js';
|
|
3
|
-
import { ifDefined } from 'lit/directives/if-defined.js';
|
|
4
3
|
import { BaseElement } from '../BaseElement.js';
|
|
5
4
|
import { Spinner } from '../spinner/Spinner.js';
|
|
6
5
|
import { Icon } from '../icon/Icon.js';
|
|
@@ -21,7 +20,7 @@ class IconButton extends BaseElement {
|
|
|
21
20
|
this.borderless = false;
|
|
22
21
|
this.disabled = false;
|
|
23
22
|
this.loading = false;
|
|
24
|
-
this.
|
|
23
|
+
this.library = "default";
|
|
25
24
|
}
|
|
26
25
|
static {
|
|
27
26
|
this.styles = [super.styles, styles];
|
|
@@ -34,8 +33,9 @@ class IconButton extends BaseElement {
|
|
|
34
33
|
}
|
|
35
34
|
render() {
|
|
36
35
|
return html`
|
|
37
|
-
<button part="base"
|
|
38
|
-
|
|
36
|
+
<button part="base"
|
|
37
|
+
?disabled=${this.disabled || this.loading}>
|
|
38
|
+
${this.loading ? html`<u-spinner></u-spinner>` : html`<u-icon .library=${this.library} .name=${this.name}></u-icon>`}
|
|
39
39
|
</button>
|
|
40
40
|
`;
|
|
41
41
|
}
|
|
@@ -50,8 +50,8 @@ __decorateClass([
|
|
|
50
50
|
property({ type: Boolean, reflect: true })
|
|
51
51
|
], IconButton.prototype, "loading");
|
|
52
52
|
__decorateClass([
|
|
53
|
-
property({ type:
|
|
54
|
-
], IconButton.prototype, "
|
|
53
|
+
property({ type: String, attribute: "lib" })
|
|
54
|
+
], IconButton.prototype, "library");
|
|
55
55
|
__decorateClass([
|
|
56
56
|
property({ type: String })
|
|
57
57
|
], IconButton.prototype, "name");
|
|
@@ -6,63 +6,48 @@ const styles = css`
|
|
|
6
6
|
display: inline-flex;
|
|
7
7
|
|
|
8
8
|
font-size: 16px;
|
|
9
|
-
color: var(--u-icon-color);
|
|
10
9
|
padding: 0.5em;
|
|
11
|
-
|
|
10
|
+
color: var(--u-icon-color);
|
|
12
11
|
border: 1px solid var(--u-border-color);
|
|
13
12
|
border-radius: 6px;
|
|
13
|
+
background-color: var(--u-bg-color);
|
|
14
14
|
|
|
15
15
|
transition: all 0.2s ease;
|
|
16
16
|
user-select: none;
|
|
17
17
|
cursor: pointer;
|
|
18
18
|
}
|
|
19
|
-
:host([borderless]) {
|
|
20
|
-
border: none;
|
|
21
|
-
background-color: transparent;
|
|
22
|
-
}
|
|
23
|
-
:host([borderless]:hover) {
|
|
24
|
-
border: none;
|
|
25
|
-
background-color: transparent;
|
|
26
|
-
}
|
|
27
|
-
:host([borderless]:active) {
|
|
28
|
-
border: none;
|
|
29
|
-
background-color: transparent;
|
|
30
|
-
}
|
|
31
|
-
:host([loading]),
|
|
32
|
-
:host([disabled]) {
|
|
33
|
-
pointer-events: none;
|
|
34
|
-
}
|
|
35
|
-
:host([disabled]) {
|
|
36
|
-
opacity: 0.6;
|
|
37
|
-
color: var(--u-icon-color-disabled);
|
|
38
|
-
}
|
|
39
19
|
:host(:hover) {
|
|
40
20
|
color: var(--u-icon-color-hover);
|
|
41
21
|
background-color: var(--u-bg-color-hover);
|
|
42
|
-
border-color: var(--u-border-color-strong);
|
|
43
22
|
}
|
|
44
23
|
:host(:active) {
|
|
45
24
|
color: var(--u-icon-color-active);
|
|
46
25
|
background-color: var(--u-bg-color-active);
|
|
47
26
|
transform: translateY(1px);
|
|
48
27
|
}
|
|
28
|
+
:host([borderless]) {
|
|
29
|
+
border: none;
|
|
30
|
+
background-color: transparent;
|
|
31
|
+
}
|
|
32
|
+
:host([loading]),
|
|
33
|
+
:host([disabled]) {
|
|
34
|
+
color: var(--u-icon-color-disabled);
|
|
35
|
+
pointer-events: none;
|
|
36
|
+
}
|
|
49
37
|
|
|
50
38
|
button {
|
|
51
39
|
all: unset;
|
|
52
40
|
display: inline-flex;
|
|
53
|
-
align-items: center;
|
|
54
|
-
justify-content: center;
|
|
55
41
|
}
|
|
56
42
|
button:focus-visible {
|
|
57
43
|
outline: 2px solid var(--u-blue-500, #3b82f6);
|
|
58
44
|
outline-offset: 2px;
|
|
59
|
-
border-radius: inherit;
|
|
60
45
|
}
|
|
61
46
|
|
|
62
|
-
u-
|
|
63
|
-
u-
|
|
64
|
-
font-size: inherit;
|
|
47
|
+
u-spinner,
|
|
48
|
+
u-icon {
|
|
65
49
|
color: inherit;
|
|
50
|
+
font-size: inherit;
|
|
66
51
|
}
|
|
67
52
|
`;
|
|
68
53
|
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export * from './alert';
|
|
2
2
|
export * from './button';
|
|
3
3
|
export * from './context-menu';
|
|
4
|
+
export * from './copy-button';
|
|
4
5
|
export * from './dialog';
|
|
5
6
|
export * from './divider';
|
|
6
7
|
export * from './form';
|
|
@@ -8,7 +9,6 @@ export * from './icon';
|
|
|
8
9
|
export * from './icon-button';
|
|
9
10
|
export * from './input';
|
|
10
11
|
export * from './menu';
|
|
11
|
-
export * from './panel';
|
|
12
12
|
export * from './progress-bar';
|
|
13
13
|
export * from './progress-ring';
|
|
14
14
|
export * from './spinner';
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { PropertyValues } from 'lit';
|
|
2
2
|
import { BaseElement } from '../BaseElement.js';
|
|
3
|
+
/** 지원하는 input 타입 */
|
|
4
|
+
type InputType = ('text' | 'password' | 'email' | 'tel' | 'url' | 'search' | 'number' | 'date' | 'time' | 'datetime-local' | 'month' | 'week');
|
|
3
5
|
/**
|
|
4
6
|
* Input 컴포넌트는 사용자 입력을 받는 텍스트 입력 필드입니다.
|
|
5
7
|
* prefix, suffix 슬롯과 라벨, 도움말, 유효성 검사 등의 기능을 제공합니다.
|
|
@@ -7,23 +9,23 @@ import { BaseElement } from '../BaseElement.js';
|
|
|
7
9
|
export declare class Input extends BaseElement {
|
|
8
10
|
static styles: import('lit').CSSResultGroup[];
|
|
9
11
|
static dependencies: Record<string, typeof BaseElement>;
|
|
10
|
-
|
|
11
|
-
/** password type인 경우 비밀번호 표시/숨김 상태 */
|
|
12
|
-
showPassword: boolean;
|
|
12
|
+
inputEl: HTMLInputElement;
|
|
13
13
|
/** 유효성 검사 실패 여부 */
|
|
14
14
|
isInvalid: boolean;
|
|
15
15
|
/** 현재 표시할 유효성 검사 메시지 */
|
|
16
16
|
currentValidationMessage: string;
|
|
17
|
+
/** password type인 경우 비밀번호 표시/숨김 상태 */
|
|
18
|
+
showPassword: boolean;
|
|
17
19
|
/** input 요소의 type 속성 */
|
|
18
|
-
type:
|
|
20
|
+
type: InputType;
|
|
19
21
|
/** 필수 입력 여부 */
|
|
20
22
|
required: boolean;
|
|
23
|
+
/** 읽기 전용 여부 */
|
|
24
|
+
readonly: boolean;
|
|
21
25
|
/** 비활성화 여부 */
|
|
22
26
|
disabled: boolean;
|
|
23
27
|
/** 클리어 버튼 표시 여부 */
|
|
24
28
|
clearable: boolean;
|
|
25
|
-
/** 읽기 전용 여부 */
|
|
26
|
-
readonly: boolean;
|
|
27
29
|
/** input 요소의 name 속성 */
|
|
28
30
|
name?: string;
|
|
29
31
|
/** 라벨 텍스트 */
|
|
@@ -50,8 +52,6 @@ export declare class Input extends BaseElement {
|
|
|
50
52
|
validationMessage?: string;
|
|
51
53
|
protected updated(changedProperties: PropertyValues): void;
|
|
52
54
|
render(): import('lit-html').TemplateResult<1>;
|
|
53
|
-
/** 라벨 영역을 렌더링합니다. */
|
|
54
|
-
private renderHeader;
|
|
55
55
|
/** 유효성 검사를 수행합니다. */
|
|
56
56
|
validate(): boolean;
|
|
57
57
|
/** 입력값을 초기화합니다. */
|
|
@@ -63,11 +63,12 @@ export declare class Input extends BaseElement {
|
|
|
63
63
|
/** input 이벤트 핸들러 */
|
|
64
64
|
private handleInput;
|
|
65
65
|
/** change 이벤트 핸들러 */
|
|
66
|
-
private
|
|
66
|
+
private handleInputChange;
|
|
67
67
|
/** blur 이벤트 핸들러 */
|
|
68
|
-
private
|
|
69
|
-
/** 클리어 버튼 클릭 핸들러 */
|
|
70
|
-
private handleClear;
|
|
68
|
+
private handleInputBlur;
|
|
71
69
|
/** 비밀번호 표시/숨김 토글 핸들러 */
|
|
72
|
-
private
|
|
70
|
+
private handlePasswordTogglerClick;
|
|
71
|
+
/** 클리어 버튼 클릭 핸들러 */
|
|
72
|
+
private handleClearBtnClick;
|
|
73
73
|
}
|
|
74
|
+
export {};
|