@iyulab/components 0.1.0 → 0.1.2
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 +8 -0
- package/dist/assets/icons/arrow-clockwise.svg.js +3 -7
- package/dist/assets/icons/arrow-down.svg.js +3 -6
- package/dist/assets/icons/arrow-up.svg.js +3 -6
- package/dist/assets/icons/ban.svg.js +3 -6
- package/dist/assets/icons/bell-fill.svg.js +3 -6
- package/dist/assets/icons/check-circle-fill.svg.js +3 -6
- package/dist/assets/icons/check-lg.svg.js +3 -6
- package/dist/assets/icons/chevron-down.svg.js +3 -6
- package/dist/assets/icons/chevron-left.svg.js +3 -6
- package/dist/assets/icons/chevron-right.svg.js +3 -6
- package/dist/assets/icons/chevron-up.svg.js +3 -6
- package/dist/assets/icons/copy.svg.js +3 -6
- package/dist/assets/icons/dash-lg.svg.js +3 -6
- package/dist/assets/icons/exclamation-circle-fill.svg.js +3 -6
- package/dist/assets/icons/exclamation-triangle-fill.svg.js +3 -6
- package/dist/assets/icons/eye-slash.svg.js +3 -8
- package/dist/assets/icons/eye.svg.js +3 -7
- package/dist/assets/icons/info-circle-fill.svg.js +3 -6
- package/dist/assets/icons/layout-sidebar.svg.js +3 -6
- package/dist/assets/icons/lightbulb-fill.svg.js +3 -6
- package/dist/assets/icons/lightbulb-off.svg.js +3 -6
- package/dist/assets/icons/lightbulb.svg.js +3 -6
- package/dist/assets/icons/mic-fill.svg.js +3 -7
- package/dist/assets/icons/mic-mute-fill.svg.js +3 -7
- package/dist/assets/icons/paperclip.svg.js +3 -6
- package/dist/assets/icons/pencil-square.svg.js +3 -7
- package/dist/assets/icons/plus-lg.svg.js +3 -6
- package/dist/assets/icons/search.svg.js +3 -6
- package/dist/assets/icons/speedometer.svg.js +3 -7
- package/dist/assets/icons/x-lg.svg.js +3 -6
- package/dist/assets/styles/dark.css.js +3 -4
- package/dist/assets/styles/light.css.js +3 -4
- package/dist/components/BaseElement.js +32 -22
- package/dist/components/BaseElement.styles.js +5 -5
- package/dist/components/alert/Alert.js +79 -51
- package/dist/components/alert/Alert.styles.js +5 -5
- package/dist/components/button/Button.js +29 -23
- package/dist/components/button/Button.styles.js +5 -5
- package/dist/components/context-menu/ContextMenu.js +123 -72
- package/dist/components/context-menu/ContextMenu.styles.js +5 -5
- package/dist/components/dialog/Dialog.js +73 -40
- package/dist/components/dialog/Dialog.styles.js +5 -5
- package/dist/components/form/Form.js +51 -32
- package/dist/components/form/Form.styles.js +5 -5
- package/dist/components/icon/Icon.js +53 -36
- package/dist/components/icon/Icon.styles.js +5 -5
- package/dist/components/icon-button/IconButton.js +44 -36
- package/dist/components/icon-button/IconButton.styles.js +5 -5
- package/dist/components/input/Input.js +161 -112
- package/dist/components/input/Input.styles.js +5 -5
- package/dist/components/menu/Menu.js +108 -58
- package/dist/components/menu/Menu.styles.js +5 -5
- package/dist/components/menu-item/MenuItem.js +67 -37
- package/dist/components/menu-item/MenuItem.styles.js +5 -5
- package/dist/components/panel/Panel.js +11 -10
- package/dist/components/panel/Panel.styles.js +5 -5
- package/dist/components/progress-ring/ProgressRing.js +70 -45
- package/dist/components/progress-ring/ProgressRing.styles.js +5 -5
- package/dist/components/spinner/Spinner.js +9 -9
- package/dist/components/spinner/Spinner.styles.js +5 -5
- package/dist/components/split-panel/SplitPanel.js +127 -66
- package/dist/components/split-panel/SplitPanel.styles.js +5 -5
- package/dist/components/split-panel/Splitter.js +29 -23
- package/dist/components/split-panel/Splitter.styles.js +5 -5
- package/dist/components/tooltip/Tooltip.js +115 -74
- package/dist/components/tooltip/Tooltip.styles.js +5 -5
- package/dist/index.js +18 -40
- package/dist/internals/attribute-converters.js +10 -8
- package/dist/internals/icons.js +41 -66
- package/dist/internals/node-helpers.js +16 -17
- package/dist/utilities/BrowserStorage.d.ts +43 -0
- package/dist/utilities/BrowserStorage.js +87 -0
- package/dist/utilities/decorators.js +19 -14
- package/dist/utilities/index.d.ts +1 -1
- package/dist/utilities/notifier.js +62 -20
- package/dist/utilities/theme.d.ts +38 -26
- package/dist/utilities/theme.js +110 -85
- package/package.json +2 -2
- package/dist/utilities/storage.d.ts +0 -60
- package/dist/utilities/storage.js +0 -120
|
@@ -1,41 +1,69 @@
|
|
|
1
|
-
import { html
|
|
2
|
-
import { query
|
|
3
|
-
import { BaseElement
|
|
4
|
-
import { styles
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
import { html } from 'lit';
|
|
2
|
+
import { query, property } from 'lit/decorators.js';
|
|
3
|
+
import { BaseElement } from '../BaseElement.js';
|
|
4
|
+
import { styles } from './Dialog.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;
|
|
9
14
|
};
|
|
10
|
-
class
|
|
15
|
+
class Dialog extends BaseElement {
|
|
11
16
|
constructor() {
|
|
12
|
-
super(...arguments)
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
17
|
+
super(...arguments);
|
|
18
|
+
this.open = false;
|
|
19
|
+
this.closeOnOverlayClick = true;
|
|
20
|
+
this.closeOnEscape = true;
|
|
21
|
+
/** 다이얼로그를 표시합니다 */
|
|
22
|
+
this.show = async () => {
|
|
23
|
+
this.open = true;
|
|
24
|
+
await this.updateComplete;
|
|
25
|
+
};
|
|
26
|
+
/** 다이얼로그를 숨깁니다 */
|
|
27
|
+
this.hide = async () => {
|
|
28
|
+
await this.updateComplete;
|
|
29
|
+
this.open = false;
|
|
30
|
+
};
|
|
31
|
+
/** 오버레이 클릭 핸들러 */
|
|
32
|
+
this.handleOverlayClick = (e) => {
|
|
33
|
+
if (this.closeOnOverlayClick && e.target === this.overlayEl) {
|
|
34
|
+
this.hide();
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
/** 키보드 이벤트 핸들러 */
|
|
38
|
+
this.handleKeyDown = (e) => {
|
|
39
|
+
if (this.closeOnEscape && e.key === "Escape" && this.open) {
|
|
40
|
+
e.preventDefault();
|
|
41
|
+
this.hide();
|
|
42
|
+
}
|
|
20
43
|
};
|
|
21
44
|
}
|
|
22
45
|
static {
|
|
23
|
-
this.styles = [super.styles,
|
|
46
|
+
this.styles = [super.styles, styles];
|
|
24
47
|
}
|
|
25
48
|
static {
|
|
26
49
|
this.dependencies = {};
|
|
27
50
|
}
|
|
28
51
|
connectedCallback() {
|
|
29
|
-
super.connectedCallback()
|
|
52
|
+
super.connectedCallback();
|
|
53
|
+
window.addEventListener("keydown", this.handleKeyDown);
|
|
30
54
|
}
|
|
31
55
|
disconnectedCallback() {
|
|
32
|
-
window.removeEventListener("keydown", this.handleKeyDown)
|
|
56
|
+
window.removeEventListener("keydown", this.handleKeyDown);
|
|
57
|
+
super.disconnectedCallback();
|
|
33
58
|
}
|
|
34
|
-
updated(
|
|
35
|
-
super.updated(
|
|
59
|
+
updated(changedProperties) {
|
|
60
|
+
super.updated(changedProperties);
|
|
61
|
+
if (changedProperties.has("open")) {
|
|
62
|
+
this.updateOpenState(this.open);
|
|
63
|
+
}
|
|
36
64
|
}
|
|
37
65
|
render() {
|
|
38
|
-
return
|
|
66
|
+
return html`
|
|
39
67
|
<div class="overlay" part="overlay"
|
|
40
68
|
?hidden=${!this.open}
|
|
41
69
|
@click=${this.handleOverlayClick}>
|
|
@@ -45,22 +73,27 @@ class o extends h {
|
|
|
45
73
|
</div>
|
|
46
74
|
`;
|
|
47
75
|
}
|
|
48
|
-
updateOpenState(
|
|
49
|
-
|
|
76
|
+
updateOpenState(open) {
|
|
77
|
+
if (open) {
|
|
78
|
+
document.body.style.overflow = "hidden";
|
|
79
|
+
this.emit("u-show");
|
|
80
|
+
} else {
|
|
81
|
+
document.body.style.overflow = "";
|
|
82
|
+
this.emit("u-hide");
|
|
83
|
+
}
|
|
50
84
|
}
|
|
51
85
|
}
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
],
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
],
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
],
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
],
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
};
|
|
86
|
+
__decorateClass([
|
|
87
|
+
query(".overlay")
|
|
88
|
+
], Dialog.prototype, "overlayEl");
|
|
89
|
+
__decorateClass([
|
|
90
|
+
property({ type: Boolean, reflect: true })
|
|
91
|
+
], Dialog.prototype, "open");
|
|
92
|
+
__decorateClass([
|
|
93
|
+
property({ type: Boolean })
|
|
94
|
+
], Dialog.prototype, "closeOnOverlayClick");
|
|
95
|
+
__decorateClass([
|
|
96
|
+
property({ type: Boolean })
|
|
97
|
+
], Dialog.prototype, "closeOnEscape");
|
|
98
|
+
|
|
99
|
+
export { Dialog };
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { css
|
|
2
|
-
|
|
1
|
+
import { css } from 'lit';
|
|
2
|
+
|
|
3
|
+
const styles = css`
|
|
3
4
|
:host {
|
|
4
5
|
display: inline-block;
|
|
5
6
|
}
|
|
@@ -27,6 +28,5 @@ const r = o`
|
|
|
27
28
|
overflow: hidden;
|
|
28
29
|
}
|
|
29
30
|
`;
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
};
|
|
31
|
+
|
|
32
|
+
export { styles };
|
|
@@ -1,53 +1,72 @@
|
|
|
1
|
-
import { html
|
|
2
|
-
import { property
|
|
3
|
-
import { arrayAttributeConverter
|
|
4
|
-
import { BaseElement
|
|
5
|
-
import { Input
|
|
6
|
-
import { styles
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
1
|
+
import { html } from 'lit';
|
|
2
|
+
import { property } from 'lit/decorators.js';
|
|
3
|
+
import { arrayAttributeConverter } from '../../internals/attribute-converters.js';
|
|
4
|
+
import { BaseElement } from '../BaseElement.js';
|
|
5
|
+
import { Input } from '../input/Input.js';
|
|
6
|
+
import { styles } from './Form.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;
|
|
11
16
|
};
|
|
12
|
-
class
|
|
17
|
+
class Form extends BaseElement {
|
|
13
18
|
constructor() {
|
|
14
|
-
super(...arguments)
|
|
15
|
-
|
|
16
|
-
|
|
19
|
+
super(...arguments);
|
|
20
|
+
this.includes = [];
|
|
21
|
+
this.excludes = [];
|
|
22
|
+
/** 입력 요소의 변경 이벤트를 처리합니다. */
|
|
23
|
+
this.handleChange = (e) => {
|
|
24
|
+
const input = e.target;
|
|
25
|
+
const name = input.name;
|
|
26
|
+
const value = input.value;
|
|
27
|
+
if (!name) return;
|
|
28
|
+
if (!this.includes.includes(name)) return;
|
|
29
|
+
if (this.excludes.includes(name)) return;
|
|
30
|
+
if (this.context && typeof this.context === "object") {
|
|
31
|
+
this.context[name] = value;
|
|
32
|
+
}
|
|
17
33
|
};
|
|
18
34
|
}
|
|
19
35
|
static {
|
|
20
|
-
this.styles = [super.styles,
|
|
36
|
+
this.styles = [super.styles, styles];
|
|
21
37
|
}
|
|
22
38
|
static {
|
|
23
39
|
this.dependencies = {};
|
|
24
40
|
}
|
|
25
41
|
connectedCallback() {
|
|
26
|
-
super.connectedCallback()
|
|
42
|
+
super.connectedCallback();
|
|
43
|
+
this.addEventListener("change", this.handleChange);
|
|
27
44
|
}
|
|
28
45
|
disconnectedCallback() {
|
|
29
|
-
this.removeEventListener("change", this.handleChange)
|
|
46
|
+
this.removeEventListener("change", this.handleChange);
|
|
47
|
+
super.disconnectedCallback();
|
|
30
48
|
}
|
|
31
49
|
render() {
|
|
32
|
-
return
|
|
50
|
+
return html`
|
|
33
51
|
<slot></slot>
|
|
34
52
|
`;
|
|
35
53
|
}
|
|
36
54
|
/** 폼 내의 모든 입력 요소를 검증합니다. */
|
|
37
55
|
validate() {
|
|
38
|
-
const
|
|
39
|
-
|
|
56
|
+
const slot = this.shadowRoot?.querySelector("slot");
|
|
57
|
+
const inputEls = slot?.assignedElements({ flatten: true }).filter((el) => el instanceof Input) || [];
|
|
58
|
+
const isValid = Array.from(inputEls).every((input) => input.validate());
|
|
59
|
+
return isValid;
|
|
40
60
|
}
|
|
41
61
|
}
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
],
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
],
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
],
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
};
|
|
62
|
+
__decorateClass([
|
|
63
|
+
property({ type: Array, converter: arrayAttributeConverter((v) => v) })
|
|
64
|
+
], Form.prototype, "includes");
|
|
65
|
+
__decorateClass([
|
|
66
|
+
property({ type: Array, converter: arrayAttributeConverter((v) => v) })
|
|
67
|
+
], Form.prototype, "excludes");
|
|
68
|
+
__decorateClass([
|
|
69
|
+
property({ type: Object, attribute: false })
|
|
70
|
+
], Form.prototype, "context");
|
|
71
|
+
|
|
72
|
+
export { Form };
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { css
|
|
2
|
-
|
|
1
|
+
import { css } from 'lit';
|
|
2
|
+
|
|
3
|
+
const styles = css`
|
|
3
4
|
:host {
|
|
4
5
|
width: 100%;
|
|
5
6
|
display: flex;
|
|
@@ -13,6 +14,5 @@ const e = t`
|
|
|
13
14
|
width: 100%;
|
|
14
15
|
}
|
|
15
16
|
`;
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
};
|
|
17
|
+
|
|
18
|
+
export { styles };
|
|
@@ -1,63 +1,80 @@
|
|
|
1
|
-
import { nothing
|
|
2
|
-
import { property
|
|
3
|
-
import { unsafeHTML
|
|
4
|
-
import { until
|
|
5
|
-
import { BaseElement
|
|
6
|
-
import { icons
|
|
7
|
-
import { styles
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
1
|
+
import { nothing } from 'lit';
|
|
2
|
+
import { property } from 'lit/decorators.js';
|
|
3
|
+
import { unsafeHTML } from 'lit/directives/unsafe-html.js';
|
|
4
|
+
import { until } from 'lit/directives/until.js';
|
|
5
|
+
import { BaseElement } from '../BaseElement.js';
|
|
6
|
+
import { icons } from '../../internals/icons.js';
|
|
7
|
+
import { styles } from './Icon.styles.js';
|
|
8
|
+
|
|
9
|
+
var __defProp = Object.defineProperty;
|
|
10
|
+
var __decorateClass = (decorators, target, key, kind) => {
|
|
11
|
+
var result = void 0 ;
|
|
12
|
+
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
13
|
+
if (decorator = decorators[i])
|
|
14
|
+
result = (decorator(target, key, result) ) || result;
|
|
15
|
+
if (result) __defProp(target, key, result);
|
|
16
|
+
return result;
|
|
12
17
|
};
|
|
13
|
-
const
|
|
18
|
+
const _Icon = class _Icon extends BaseElement {
|
|
14
19
|
constructor() {
|
|
15
|
-
super(...arguments)
|
|
20
|
+
super(...arguments);
|
|
21
|
+
this.remote = false;
|
|
16
22
|
}
|
|
17
23
|
static {
|
|
18
|
-
this.styles = [super.styles,
|
|
24
|
+
this.styles = [super.styles, styles];
|
|
19
25
|
}
|
|
20
26
|
static {
|
|
21
27
|
this.dependencies = {};
|
|
22
28
|
}
|
|
23
29
|
static {
|
|
30
|
+
/**
|
|
31
|
+
* 아이콘을 외부에서 불러올 때 사용되는 기본 경로를 설정합니다.
|
|
32
|
+
* @default '/assets/icons/'
|
|
33
|
+
*/
|
|
24
34
|
this.remoteBaseUrl = "/assets/icons/";
|
|
25
35
|
}
|
|
26
36
|
render() {
|
|
27
|
-
|
|
37
|
+
if (!this.name) return nothing;
|
|
38
|
+
return until(this.load(this.name).then((html) => {
|
|
39
|
+
if (!this.validate(html)) return nothing;
|
|
40
|
+
return unsafeHTML(html);
|
|
41
|
+
}), nothing);
|
|
28
42
|
}
|
|
29
43
|
/**
|
|
30
44
|
* 아이콘의 HTML 콘텐츠를 가져옵니다.
|
|
31
45
|
* 외부 아이콘 경로를 사용하거나, 내부 레지스트리에서 아이콘을 찾습니다.
|
|
32
46
|
* @param name 아이콘 이름
|
|
33
47
|
*/
|
|
34
|
-
async load(
|
|
48
|
+
async load(name) {
|
|
35
49
|
if (this.remote) {
|
|
36
|
-
const
|
|
50
|
+
const remoteUrl = _Icon.remoteBaseUrl.endsWith("/") ? `${_Icon.remoteBaseUrl}${name}.svg` : `${_Icon.remoteBaseUrl}/${name}.svg`;
|
|
37
51
|
try {
|
|
38
|
-
const
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
52
|
+
const response = await fetch(remoteUrl);
|
|
53
|
+
if (!response.ok) return void 0;
|
|
54
|
+
return (await response.text())?.trim();
|
|
55
|
+
} catch (error) {
|
|
56
|
+
console.error(error);
|
|
57
|
+
return void 0;
|
|
43
58
|
}
|
|
44
|
-
} else
|
|
45
|
-
return
|
|
59
|
+
} else {
|
|
60
|
+
return icons.get(name)?.trim();
|
|
61
|
+
}
|
|
46
62
|
}
|
|
47
63
|
/**
|
|
48
64
|
* SVG 콘텐츠가 유효한 HTML인지 검사합니다.
|
|
49
65
|
*/
|
|
50
|
-
validate(
|
|
51
|
-
|
|
66
|
+
validate(html) {
|
|
67
|
+
if (!html) return false;
|
|
68
|
+
if (!html.endsWith("</svg>")) return false;
|
|
69
|
+
return true;
|
|
52
70
|
}
|
|
53
71
|
};
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
],
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
],
|
|
60
|
-
let
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
};
|
|
72
|
+
__decorateClass([
|
|
73
|
+
property({ type: Boolean })
|
|
74
|
+
], _Icon.prototype, "remote");
|
|
75
|
+
__decorateClass([
|
|
76
|
+
property({ type: String })
|
|
77
|
+
], _Icon.prototype, "name");
|
|
78
|
+
let Icon = _Icon;
|
|
79
|
+
|
|
80
|
+
export { Icon };
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { css
|
|
2
|
-
|
|
1
|
+
import { css } from 'lit';
|
|
2
|
+
|
|
3
|
+
const styles = css`
|
|
3
4
|
:host {
|
|
4
5
|
display: inline-flex;
|
|
5
6
|
font-size: inherit;
|
|
@@ -12,6 +13,5 @@ const e = o`
|
|
|
12
13
|
fill: currentColor;
|
|
13
14
|
}
|
|
14
15
|
`;
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
};
|
|
16
|
+
|
|
17
|
+
export { styles };
|
|
@@ -1,51 +1,59 @@
|
|
|
1
|
-
import { html
|
|
2
|
-
import { property
|
|
3
|
-
import { ifDefined
|
|
4
|
-
import { BaseElement
|
|
5
|
-
import { Spinner
|
|
6
|
-
import { Icon
|
|
7
|
-
import { styles
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
1
|
+
import { html } from 'lit';
|
|
2
|
+
import { property } from 'lit/decorators.js';
|
|
3
|
+
import { ifDefined } from 'lit/directives/if-defined.js';
|
|
4
|
+
import { BaseElement } from '../BaseElement.js';
|
|
5
|
+
import { Spinner } from '../spinner/Spinner.js';
|
|
6
|
+
import { Icon } from '../icon/Icon.js';
|
|
7
|
+
import { styles } from './IconButton.styles.js';
|
|
8
|
+
|
|
9
|
+
var __defProp = Object.defineProperty;
|
|
10
|
+
var __decorateClass = (decorators, target, key, kind) => {
|
|
11
|
+
var result = void 0 ;
|
|
12
|
+
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
13
|
+
if (decorator = decorators[i])
|
|
14
|
+
result = (decorator(target, key, result) ) || result;
|
|
15
|
+
if (result) __defProp(target, key, result);
|
|
16
|
+
return result;
|
|
12
17
|
};
|
|
13
|
-
class
|
|
18
|
+
class IconButton extends BaseElement {
|
|
14
19
|
constructor() {
|
|
15
|
-
super(...arguments)
|
|
20
|
+
super(...arguments);
|
|
21
|
+
this.borderless = false;
|
|
22
|
+
this.disabled = false;
|
|
23
|
+
this.loading = false;
|
|
24
|
+
this.remote = false;
|
|
16
25
|
}
|
|
17
26
|
static {
|
|
18
|
-
this.styles = [super.styles,
|
|
27
|
+
this.styles = [super.styles, styles];
|
|
19
28
|
}
|
|
20
29
|
static {
|
|
21
30
|
this.dependencies = {
|
|
22
|
-
"u-spinner":
|
|
23
|
-
"u-icon":
|
|
31
|
+
"u-spinner": Spinner,
|
|
32
|
+
"u-icon": Icon
|
|
24
33
|
};
|
|
25
34
|
}
|
|
26
35
|
render() {
|
|
27
|
-
return
|
|
36
|
+
return html`
|
|
28
37
|
<button part="base" ?disabled=${this.disabled || this.loading}>
|
|
29
|
-
${this.loading ?
|
|
38
|
+
${this.loading ? html`<u-spinner></u-spinner>` : html`<u-icon ?remote=${this.remote} name=${ifDefined(this.name)}></u-icon>`}
|
|
30
39
|
</button>
|
|
31
40
|
`;
|
|
32
41
|
}
|
|
33
42
|
}
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
],
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
],
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
],
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
],
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
],
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
};
|
|
43
|
+
__decorateClass([
|
|
44
|
+
property({ type: Boolean, reflect: true })
|
|
45
|
+
], IconButton.prototype, "borderless");
|
|
46
|
+
__decorateClass([
|
|
47
|
+
property({ type: Boolean, reflect: true })
|
|
48
|
+
], IconButton.prototype, "disabled");
|
|
49
|
+
__decorateClass([
|
|
50
|
+
property({ type: Boolean, reflect: true })
|
|
51
|
+
], IconButton.prototype, "loading");
|
|
52
|
+
__decorateClass([
|
|
53
|
+
property({ type: Boolean })
|
|
54
|
+
], IconButton.prototype, "remote");
|
|
55
|
+
__decorateClass([
|
|
56
|
+
property({ type: String })
|
|
57
|
+
], IconButton.prototype, "name");
|
|
58
|
+
|
|
59
|
+
export { IconButton };
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { css
|
|
2
|
-
|
|
1
|
+
import { css } from 'lit';
|
|
2
|
+
|
|
3
|
+
const styles = css`
|
|
3
4
|
:host {
|
|
4
5
|
position: relative;
|
|
5
6
|
display: inline-flex;
|
|
@@ -64,6 +65,5 @@ const e = o`
|
|
|
64
65
|
color: inherit;
|
|
65
66
|
}
|
|
66
67
|
`;
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
};
|
|
68
|
+
|
|
69
|
+
export { styles };
|