@iyulab/chat-components 0.1.0 → 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.
Files changed (111) hide show
  1. package/CHANGELOG.md +30 -4
  2. package/LICENSE +20 -20
  3. package/README.md +36 -20
  4. package/dist/components/blocks/UCodeBlock.component.d.ts +7 -8
  5. package/dist/components/blocks/UCodeBlock.component.js +32 -21
  6. package/dist/components/blocks/UCodeBlock.styles.js +7 -6
  7. package/dist/components/{json-viewer/UJsonViewer.component.d.ts → blocks/UJsonBlock.component.d.ts} +5 -4
  8. package/dist/components/{json-viewer/UJsonViewer.component.js → blocks/UJsonBlock.component.js} +20 -17
  9. package/dist/components/blocks/UJsonBlock.d.ts +7 -0
  10. package/dist/components/blocks/UJsonBlock.js +5 -0
  11. package/dist/components/blocks/UMarkedBlock.component.d.ts +30 -9
  12. package/dist/components/blocks/UMarkedBlock.component.js +75 -26
  13. package/dist/components/blocks/UMarkedBlock.styles.js +288 -949
  14. package/dist/components/blocks/UThinkBlock.component.d.ts +3 -8
  15. package/dist/components/blocks/UThinkBlock.component.js +28 -22
  16. package/dist/components/blocks/UThinkBlock.styles.js +35 -54
  17. package/dist/components/blocks/UToolBlock.component.d.ts +13 -9
  18. package/dist/components/blocks/UToolBlock.component.js +30 -76
  19. package/dist/components/blocks/UToolBlock.styles.js +21 -62
  20. package/dist/components/buttons/UAttachButton.component.d.ts +3 -5
  21. package/dist/components/buttons/UAttachButton.component.js +30 -19
  22. package/dist/components/buttons/UAttachButton.styles.js +5 -12
  23. package/dist/components/buttons/UCopyButton.component.d.ts +3 -8
  24. package/dist/components/buttons/UCopyButton.component.js +29 -53
  25. package/dist/components/buttons/UCopyButton.styles.js +8 -37
  26. package/dist/components/buttons/UReportButton.component.d.ts +9 -0
  27. package/dist/components/buttons/UReportButton.component.js +36 -0
  28. package/dist/components/buttons/UReportButton.d.ts +7 -0
  29. package/dist/components/buttons/UReportButton.js +5 -0
  30. package/dist/components/buttons/UReportButton.styles.js +14 -0
  31. package/dist/components/buttons/URetryButton.component.d.ts +11 -0
  32. package/dist/components/buttons/URetryButton.component.js +53 -0
  33. package/dist/components/buttons/URetryButton.d.ts +7 -0
  34. package/dist/components/buttons/URetryButton.js +5 -0
  35. package/dist/components/buttons/URetryButton.styles.js +26 -0
  36. package/dist/components/buttons/UShareButton.component.d.ts +9 -0
  37. package/dist/components/buttons/UShareButton.component.js +36 -0
  38. package/dist/components/buttons/UShareButton.d.ts +7 -0
  39. package/dist/components/buttons/UShareButton.js +5 -0
  40. package/dist/components/buttons/UShareButton.styles.d.ts +1 -0
  41. package/dist/components/buttons/UShareButton.styles.js +14 -0
  42. package/dist/components/buttons/UVoteButton.component.d.ts +15 -0
  43. package/dist/components/buttons/UVoteButton.component.js +70 -0
  44. package/dist/components/buttons/UVoteButton.d.ts +8 -0
  45. package/dist/components/buttons/UVoteButton.js +5 -0
  46. package/dist/components/buttons/UVoteButton.styles.d.ts +1 -0
  47. package/dist/components/buttons/UVoteButton.styles.js +19 -0
  48. package/dist/components/loaders/UDotLoader.component.d.ts +9 -0
  49. package/dist/components/loaders/UDotLoader.component.js +23 -0
  50. package/dist/components/loaders/UDotLoader.d.ts +7 -0
  51. package/dist/components/loaders/UDotLoader.js +5 -0
  52. package/dist/components/loaders/UDotLoader.styles.d.ts +1 -0
  53. package/dist/components/loaders/UDotLoader.styles.js +50 -0
  54. package/dist/components/message/UMessage.component.d.ts +12 -6
  55. package/dist/components/message/UMessage.component.js +39 -59
  56. package/dist/components/message/UMessage.d.ts +0 -1
  57. package/dist/components/message/UMessage.styles.js +30 -49
  58. package/dist/components/prompt/UPrompt.component.d.ts +25 -0
  59. package/dist/components/prompt/UPrompt.component.js +113 -0
  60. package/dist/components/prompt/UPrompt.d.ts +7 -0
  61. package/dist/components/prompt/UPrompt.js +5 -0
  62. package/dist/components/prompt/UPrompt.styles.d.ts +1 -0
  63. package/dist/components/prompt/UPrompt.styles.js +42 -0
  64. package/dist/components/references/URefCard.component.d.ts +22 -0
  65. package/dist/components/references/URefCard.component.js +96 -0
  66. package/dist/components/references/URefCard.d.ts +7 -0
  67. package/dist/components/references/URefCard.js +5 -0
  68. package/dist/components/references/URefCard.styles.d.ts +1 -0
  69. package/dist/components/references/URefCard.styles.js +103 -0
  70. package/dist/components/references/URefCardGroup.component.d.ts +25 -0
  71. package/dist/components/references/URefCardGroup.component.js +88 -0
  72. package/dist/components/references/URefCardGroup.d.ts +7 -0
  73. package/dist/components/references/URefCardGroup.js +5 -0
  74. package/dist/components/references/URefCardGroup.styles.d.ts +1 -0
  75. package/dist/components/references/URefCardGroup.styles.js +69 -0
  76. package/dist/components/references/URefTag.component.d.ts +11 -0
  77. package/dist/components/{buttons/USendButton.component.js → references/URefTag.component.js} +17 -14
  78. package/dist/components/references/URefTag.d.ts +7 -0
  79. package/dist/components/references/URefTag.js +5 -0
  80. package/dist/components/references/URefTag.styles.d.ts +1 -0
  81. package/dist/components/references/URefTag.styles.js +51 -0
  82. package/dist/events/UCancelEvent.d.ts +6 -0
  83. package/dist/index.d.ts +15 -5
  84. package/dist/index.js +20 -6
  85. package/dist/types/BlockItem.d.ts +36 -0
  86. package/dist/types/BlockReference.d.ts +32 -0
  87. package/dist/types/JsonNode.d.ts +20 -0
  88. package/dist/utilities/converters.d.ts +9 -0
  89. package/dist/utilities/converters.js +19 -0
  90. package/package.json +14 -15
  91. package/dist/components/buttons/USendButton.component.d.ts +0 -13
  92. package/dist/components/buttons/USendButton.d.ts +0 -7
  93. package/dist/components/buttons/USendButton.js +0 -5
  94. package/dist/components/buttons/USendButton.styles.js +0 -23
  95. package/dist/components/buttons/UThinkButton.component.d.ts +0 -19
  96. package/dist/components/buttons/UThinkButton.component.js +0 -73
  97. package/dist/components/buttons/UThinkButton.d.ts +0 -7
  98. package/dist/components/buttons/UThinkButton.js +0 -5
  99. package/dist/components/buttons/UThinkButton.styles.js +0 -72
  100. package/dist/components/json-viewer/UJsonViewer.d.ts +0 -7
  101. package/dist/components/json-viewer/UJsonViewer.js +0 -5
  102. package/dist/components/json-viewer/UJsonViewer.lib.d.ts +0 -16
  103. package/dist/components/json-viewer/UJsonViewer.lib.js +0 -28
  104. package/dist/components/message/UMessage.types.d.ts +0 -21
  105. package/dist/events/UStopEvent.d.ts +0 -6
  106. package/dist/internals/date-helpers.d.ts +0 -8
  107. package/dist/internals/date-helpers.js +0 -27
  108. /package/dist/components/{buttons/USendButton.styles.d.ts → blocks/UJsonBlock.styles.d.ts} +0 -0
  109. /package/dist/components/{json-viewer/UJsonViewer.styles.js → blocks/UJsonBlock.styles.js} +0 -0
  110. /package/dist/components/buttons/{UThinkButton.styles.d.ts → UReportButton.styles.d.ts} +0 -0
  111. /package/dist/components/{json-viewer/UJsonViewer.styles.d.ts → buttons/URetryButton.styles.d.ts} +0 -0
@@ -1,4 +1,3 @@
1
- import { nothing } from 'lit';
2
1
  import { BaseElement } from '@iyulab/components/dist/components/BaseElement.js';
3
2
  /**
4
3
  * 클릭 시 클립보드에 텍스트를 복사하는 버튼입니다. 복사 상태를 표시하기 위해 아이콘이 변경됩니다.
@@ -6,17 +5,13 @@ import { BaseElement } from '@iyulab/components/dist/components/BaseElement.js';
6
5
  export declare class UCopyButton extends BaseElement {
7
6
  static styles: import('lit').CSSResultGroup[];
8
7
  static dependencies: Record<string, typeof BaseElement>;
9
- /** 버튼의 모드를 설정합니다. 기본은 'symbol'입니다. */
10
- mode: 'badge' | 'symbol';
11
8
  /** 클립보드 복사 상태를 나타내는 플래그입니다. */
12
9
  isCopied: boolean;
13
- /** 복사할 텍스트를 설정합니다. */
14
- value?: string;
15
10
  /** 클립보드 복사 후 재사용 대기 시간 (ms) */
16
11
  delay: number;
17
- connectedCallback(): void;
18
- disconnectedCallback(): void;
19
- render(): typeof nothing | import('lit-html').TemplateResult<1>;
12
+ /** 복사할 텍스트를 설정합니다. */
13
+ value?: string;
14
+ render(): import('lit-html').TemplateResult<1>;
20
15
  /**
21
16
  * 클립보드에 텍스트를 복사하는 메서드입니다.
22
17
  * 복사 후 재사용 대기 시간이 설정되어 있으면, 일정 시간 후에 복사 가능 상태로 되돌립니다.
@@ -1,7 +1,8 @@
1
- import { html, nothing } from 'lit';
2
- import { property } from 'lit/decorators.js';
1
+ import { html } from 'lit';
2
+ import { state, property } from 'lit/decorators.js';
3
3
  import { BaseElement } from '@iyulab/components/dist/components/BaseElement.js';
4
4
  import { UIcon } from '@iyulab/components/dist/components/icon/UIcon.component.js';
5
+ import { UButton } from '@iyulab/components/dist/components/button/UButton.component.js';
5
6
  import { UTooltip } from '@iyulab/components/dist/components/tooltip/UTooltip.component.js';
6
7
  import { styles } from './UCopyButton.styles.js';
7
8
 
@@ -17,7 +18,6 @@ var __decorateClass = (decorators, target, key, kind) => {
17
18
  class UCopyButton extends BaseElement {
18
19
  constructor() {
19
20
  super(...arguments);
20
- this.mode = "symbol";
21
21
  this.isCopied = false;
22
22
  this.delay = 1e3;
23
23
  /**
@@ -27,30 +27,16 @@ class UCopyButton extends BaseElement {
27
27
  this.copyToClipboard = async () => {
28
28
  if (!this.value) return;
29
29
  if (this.isCopied) return;
30
- if (navigator.clipboard) {
31
- await navigator.clipboard.writeText(this.value);
32
- } else {
33
- const area = document.createElement("textarea");
34
- area.style.position = "fixed";
35
- area.style.opacity = "0";
36
- area.style.pointerEvents = "none";
37
- area.value = this.value;
38
- document.body.appendChild(area);
39
- area.focus();
40
- area.select();
41
- try {
42
- document.execCommand("copy");
43
- } catch (err) {
44
- console.error("Failed to copy: ", err);
45
- } finally {
46
- document.body.removeChild(area);
47
- }
48
- }
49
- if (this.delay > 0) {
30
+ try {
31
+ await window.navigator.clipboard.writeText(this.value);
32
+ if (this.delay <= 0) return;
50
33
  this.isCopied = true;
51
34
  setTimeout(() => {
52
35
  this.isCopied = false;
53
36
  }, this.delay);
37
+ } catch (error) {
38
+ console.error("Failed to copy text to clipboard:", error);
39
+ this.isCopied = false;
54
40
  }
55
41
  };
56
42
  }
@@ -60,46 +46,36 @@ class UCopyButton extends BaseElement {
60
46
  static {
61
47
  this.dependencies = {
62
48
  "u-icon": UIcon,
49
+ "u-button": UButton,
63
50
  "u-tooltip": UTooltip
64
51
  };
65
52
  }
66
- connectedCallback() {
67
- super.connectedCallback();
68
- this.addEventListener("click", this.copyToClipboard);
69
- }
70
- disconnectedCallback() {
71
- this.removeEventListener("click", this.copyToClipboard);
72
- super.disconnectedCallback();
73
- }
74
53
  render() {
75
- if (this.mode === "badge") {
76
- return html`
77
- <u-icon lib="internal" name=${this.isCopied ? "check-lg" : "copy"}></u-icon>
78
- <span class="display">${this.isCopied ? "Copied!" : "Copy"}</span>
79
- `;
80
- } else if (this.mode === "symbol") {
81
- return html`
82
- <u-icon lib="internal" name=${this.isCopied ? "check-lg" : "copy"}></u-icon>
83
- <u-tooltip for="u-icon" distance="6">
84
- ${this.isCopied ? "Copied!" : "Copy"}
85
- </u-tooltip>
86
- `;
87
- } else {
88
- return nothing;
89
- }
54
+ return html`
55
+ <u-button part="base"
56
+ variant="borderless"
57
+ ?disabled=${this.isCopied}
58
+ @click=${this.copyToClipboard}>
59
+ <u-icon part="icon"
60
+ lib="internal"
61
+ name=${this.isCopied ? "check-lg" : "copy"}
62
+ ></u-icon>
63
+ </u-button>
64
+
65
+ <u-tooltip for="u-button" placement="bottom" distance="8">
66
+ <slot></slot>
67
+ </u-tooltip>
68
+ `;
90
69
  }
91
70
  }
92
71
  __decorateClass([
93
- property({ type: String, reflect: true })
94
- ], UCopyButton.prototype, "mode");
95
- __decorateClass([
96
- property({ type: Boolean, reflect: true })
72
+ state()
97
73
  ], UCopyButton.prototype, "isCopied");
98
- __decorateClass([
99
- property({ type: String })
100
- ], UCopyButton.prototype, "value");
101
74
  __decorateClass([
102
75
  property({ type: Number })
103
76
  ], UCopyButton.prototype, "delay");
77
+ __decorateClass([
78
+ property({ type: String })
79
+ ], UCopyButton.prototype, "value");
104
80
 
105
81
  export { UCopyButton };
@@ -1,46 +1,17 @@
1
1
  import { css } from 'lit';
2
2
 
3
3
  const styles = css`
4
- :host {
5
- position: relative;
6
- padding: 8px;
7
- border-radius: 8px;
8
- font-size: inherit;
9
- color: inherit;
10
- background-color: transparent;
11
- cursor: pointer;
4
+ :host(:empty) u-tooltip {
5
+ display: none;
12
6
  }
13
- :host(:hover) {
14
- background-color: var(--u-neutral-100, #f3f4f6);
15
- }
16
- :host([isCopied]) {
17
- pointer-events: none;
18
- background-color: transparent;
19
- }
20
- :host([mode="symbol"]) {
21
- display: inline-flex;
22
- }
23
- :host([mode="badge"]) {
24
- display: flex;
25
- flex-direction: row;
26
- align-items: center;
27
- gap: 6px;
28
- }
29
-
30
- u-icon {
31
- font-size: inherit;
32
- }
33
- u-icon[name="copy"] {
34
- color: inherit;
35
- }
36
- u-icon[name="check"] {
37
- color: var(--u-green-500);
7
+
8
+ u-button {
9
+ color: var(--u-txt-color-weak);
10
+ font-size: 16px;
38
11
  }
39
12
 
40
- .display {
41
- font-size: inherit;
42
- color: inherit;
43
- line-height: 1;
13
+ u-icon[name="check-lg"] {
14
+ color: var(--u-green-500);
44
15
  }
45
16
  `;
46
17
 
@@ -0,0 +1,9 @@
1
+ import { BaseElement } from '@iyulab/components/dist/components/BaseElement.js';
2
+ /**
3
+ * 메시지 신고 버튼 컴포넌트입니다.
4
+ */
5
+ export declare class UReportButton extends BaseElement {
6
+ static styles: import('lit').CSSResultGroup[];
7
+ static dependencies: Record<string, typeof BaseElement>;
8
+ render(): import('lit-html').TemplateResult<1>;
9
+ }
@@ -0,0 +1,36 @@
1
+ import { html } from 'lit';
2
+ import { BaseElement } from '@iyulab/components/dist/components/BaseElement.js';
3
+ import { UIcon } from '@iyulab/components/dist/components/icon/UIcon.component.js';
4
+ import { UButton } from '@iyulab/components/dist/components/button/UButton.component.js';
5
+ import { UTooltip } from '@iyulab/components/dist/components/tooltip/UTooltip.component.js';
6
+ import { styles } from './UReportButton.styles.js';
7
+
8
+ class UReportButton extends BaseElement {
9
+ static {
10
+ this.styles = [super.styles, styles];
11
+ }
12
+ static {
13
+ this.dependencies = {
14
+ "u-icon": UIcon,
15
+ "u-button": UButton,
16
+ "u-tooltip": UTooltip
17
+ };
18
+ }
19
+ render() {
20
+ return html`
21
+ <u-button part="base"
22
+ variant="borderless">
23
+ <u-icon part="icon"
24
+ lib="internal"
25
+ name="flag"
26
+ ></u-icon>
27
+ </u-button>
28
+
29
+ <u-tooltip for="u-button" placement="bottom" distance="8">
30
+ <slot></slot>
31
+ </u-tooltip>
32
+ `;
33
+ }
34
+ }
35
+
36
+ export { UReportButton };
@@ -0,0 +1,7 @@
1
+ import { UReportButton } from './UReportButton.component.js';
2
+ declare global {
3
+ interface HTMLElementTagNameMap {
4
+ 'u-report-button': UReportButton;
5
+ }
6
+ }
7
+ export { UReportButton };
@@ -0,0 +1,5 @@
1
+ import { UReportButton } from './UReportButton.component.js';
2
+
3
+ UReportButton.define("u-report-button");
4
+
5
+ export { UReportButton };
@@ -0,0 +1,14 @@
1
+ import { css } from 'lit';
2
+
3
+ const styles = css`
4
+ :host(:empty) u-tooltip {
5
+ display: none;
6
+ }
7
+
8
+ u-button {
9
+ color: var(--u-txt-color-weak);
10
+ font-size: 16px;
11
+ }
12
+ `;
13
+
14
+ export { styles };
@@ -0,0 +1,11 @@
1
+ import { BaseElement } from '@iyulab/components/dist/components/BaseElement.js';
2
+ /**
3
+ * 메시지 재시도 버튼 컴포넌트입니다.
4
+ */
5
+ export declare class URetryButton extends BaseElement {
6
+ static styles: import('lit').CSSResultGroup[];
7
+ static dependencies: Record<string, typeof BaseElement>;
8
+ /** 재생성 중인지 여부 */
9
+ loading: boolean;
10
+ render(): import('lit-html').TemplateResult<1>;
11
+ }
@@ -0,0 +1,53 @@
1
+ import { html } from 'lit';
2
+ import { property } from 'lit/decorators.js';
3
+ import { BaseElement } from '@iyulab/components/dist/components/BaseElement.js';
4
+ import { UIcon } from '@iyulab/components/dist/components/icon/UIcon.component.js';
5
+ import { UButton } from '@iyulab/components/dist/components/button/UButton.component.js';
6
+ import { UTooltip } from '@iyulab/components/dist/components/tooltip/UTooltip.component.js';
7
+ import { styles } from './URetryButton.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;
17
+ };
18
+ class URetryButton extends BaseElement {
19
+ constructor() {
20
+ super(...arguments);
21
+ this.loading = false;
22
+ }
23
+ static {
24
+ this.styles = [super.styles, styles];
25
+ }
26
+ static {
27
+ this.dependencies = {
28
+ "u-icon": UIcon,
29
+ "u-button": UButton,
30
+ "u-tooltip": UTooltip
31
+ };
32
+ }
33
+ render() {
34
+ return html`
35
+ <u-button part="base"
36
+ variant="borderless">
37
+ <u-icon part="icon"
38
+ lib="internal"
39
+ name="arrow-repeat"
40
+ ></u-icon>
41
+ </u-button>
42
+
43
+ <u-tooltip for="u-button" placement="bottom" distance="8">
44
+ <slot></slot>
45
+ </u-tooltip>
46
+ `;
47
+ }
48
+ }
49
+ __decorateClass([
50
+ property({ type: Boolean, reflect: true })
51
+ ], URetryButton.prototype, "loading");
52
+
53
+ export { URetryButton };
@@ -0,0 +1,7 @@
1
+ import { URetryButton } from './URetryButton.component.js';
2
+ declare global {
3
+ interface HTMLElementTagNameMap {
4
+ 'u-retry-button': URetryButton;
5
+ }
6
+ }
7
+ export { URetryButton };
@@ -0,0 +1,5 @@
1
+ import { URetryButton } from './URetryButton.component.js';
2
+
3
+ URetryButton.define("u-retry-button");
4
+
5
+ export { URetryButton };
@@ -0,0 +1,26 @@
1
+ import { css } from 'lit';
2
+
3
+ const styles = css`
4
+ :host(:empty) u-tooltip {
5
+ display: none;
6
+ }
7
+ :host([loading]) u-icon {
8
+ animation: spin 1s linear infinite;
9
+ }
10
+
11
+ u-button {
12
+ color: var(--u-txt-color-weak);
13
+ font-size: 16px;
14
+ }
15
+
16
+ @keyframes spin {
17
+ from {
18
+ transform: rotate(0deg);
19
+ }
20
+ to {
21
+ transform: rotate(360deg);
22
+ }
23
+ }
24
+ `;
25
+
26
+ export { styles };
@@ -0,0 +1,9 @@
1
+ import { BaseElement } from '@iyulab/components/dist/components/BaseElement.js';
2
+ /**
3
+ * 메시지 공유하기 버튼 컴포넌트입니다.
4
+ */
5
+ export declare class UShareButton extends BaseElement {
6
+ static styles: import('lit').CSSResultGroup[];
7
+ static dependencies: Record<string, typeof BaseElement>;
8
+ render(): import('lit-html').TemplateResult<1>;
9
+ }
@@ -0,0 +1,36 @@
1
+ import { html } from 'lit';
2
+ import { BaseElement } from '@iyulab/components/dist/components/BaseElement.js';
3
+ import { UIcon } from '@iyulab/components/dist/components/icon/UIcon.component.js';
4
+ import { UButton } from '@iyulab/components/dist/components/button/UButton.component.js';
5
+ import { UTooltip } from '@iyulab/components/dist/components/tooltip/UTooltip.component.js';
6
+ import { styles } from './UShareButton.styles.js';
7
+
8
+ class UShareButton extends BaseElement {
9
+ static {
10
+ this.styles = [super.styles, styles];
11
+ }
12
+ static {
13
+ this.dependencies = {
14
+ "u-icon": UIcon,
15
+ "u-button": UButton,
16
+ "u-tooltip": UTooltip
17
+ };
18
+ }
19
+ render() {
20
+ return html`
21
+ <u-button part="base"
22
+ variant="borderless">
23
+ <u-icon part="icon"
24
+ lib="internal"
25
+ name="share"
26
+ ></u-icon>
27
+ </u-button>
28
+
29
+ <u-tooltip for="u-button" placement="bottom" distance="8">
30
+ <slot></slot>
31
+ </u-tooltip>
32
+ `;
33
+ }
34
+ }
35
+
36
+ export { UShareButton };
@@ -0,0 +1,7 @@
1
+ import { UShareButton } from './UShareButton.component.js';
2
+ declare global {
3
+ interface HTMLElementTagNameMap {
4
+ 'u-share-button': UShareButton;
5
+ }
6
+ }
7
+ export { UShareButton };
@@ -0,0 +1,5 @@
1
+ import { UShareButton } from './UShareButton.component.js';
2
+
3
+ UShareButton.define("u-share-button");
4
+
5
+ export { UShareButton };
@@ -0,0 +1 @@
1
+ export declare const styles: import('lit').CSSResult;
@@ -0,0 +1,14 @@
1
+ import { css } from 'lit';
2
+
3
+ const styles = css`
4
+ :host(:empty) u-tooltip {
5
+ display: none;
6
+ }
7
+
8
+ u-button {
9
+ color: var(--u-txt-color-weak);
10
+ font-size: 16px;
11
+ }
12
+ `;
13
+
14
+ export { styles };
@@ -0,0 +1,15 @@
1
+ import { BaseElement } from '@iyulab/components/dist/components/BaseElement.js';
2
+ /** 투표 상태 타입 */
3
+ export type VoteValue = 'none' | 'up' | 'down';
4
+ /**
5
+ * 투표 버튼 컴포넌트입니다.
6
+ */
7
+ export declare class UVoteButton extends BaseElement {
8
+ static styles: import('lit').CSSResultGroup[];
9
+ static dependencies: Record<string, typeof BaseElement>;
10
+ /** 현재 투표 상태 */
11
+ value: VoteValue;
12
+ render(): import('lit-html').TemplateResult<1>;
13
+ private handleUpButtonClick;
14
+ private handleDownButtonClick;
15
+ }
@@ -0,0 +1,70 @@
1
+ import { html } from 'lit';
2
+ import { property } from 'lit/decorators.js';
3
+ import { BaseElement } from '@iyulab/components/dist/components/BaseElement.js';
4
+ import { UIcon } from '@iyulab/components/dist/components/icon/UIcon.component.js';
5
+ import { UButton } from '@iyulab/components/dist/components/button/UButton.component.js';
6
+ import { UTooltip } from '@iyulab/components/dist/components/tooltip/UTooltip.component.js';
7
+ import { styles } from './UVoteButton.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;
17
+ };
18
+ class UVoteButton extends BaseElement {
19
+ constructor() {
20
+ super(...arguments);
21
+ this.value = "none";
22
+ this.handleUpButtonClick = () => {
23
+ this.value = this.value === "up" ? "none" : "up";
24
+ this.emit("u-change", { value: this.value });
25
+ };
26
+ this.handleDownButtonClick = () => {
27
+ this.value = this.value === "down" ? "none" : "down";
28
+ this.emit("u-change", { value: this.value });
29
+ };
30
+ }
31
+ static {
32
+ this.styles = [super.styles, styles];
33
+ }
34
+ static {
35
+ this.dependencies = {
36
+ "u-icon": UIcon,
37
+ "u-button": UButton,
38
+ "u-tooltip": UTooltip
39
+ };
40
+ }
41
+ render() {
42
+ return html`
43
+ <u-button class="up-btn" part="up-btn"
44
+ variant="borderless"
45
+ @click=${this.handleUpButtonClick}>
46
+ <u-icon part="icon"
47
+ lib="internal"
48
+ name=${this.value === "up" ? "hand-thumbs-up-fill" : "hand-thumbs-up"}
49
+ ></u-icon>
50
+ </u-button>
51
+ <u-button class="down-btn" part="down-btn"
52
+ variant="borderless"
53
+ @click=${this.handleDownButtonClick}>
54
+ <u-icon part="icon"
55
+ lib="internal"
56
+ name=${this.value === "down" ? "hand-thumbs-down-fill" : "hand-thumbs-down"}
57
+ ></u-icon>
58
+ </u-button>
59
+
60
+ <u-tooltip for="u-button" placement="bottom" distance="8">
61
+ <slot></slot>
62
+ </u-tooltip>
63
+ `;
64
+ }
65
+ }
66
+ __decorateClass([
67
+ property({ type: String })
68
+ ], UVoteButton.prototype, "value");
69
+
70
+ export { UVoteButton };
@@ -0,0 +1,8 @@
1
+ import { UVoteButton } from './UVoteButton.component.js';
2
+ declare global {
3
+ interface HTMLElementTagNameMap {
4
+ 'u-vote-button': UVoteButton;
5
+ }
6
+ }
7
+ export { UVoteButton };
8
+ export type { VoteValue } from './UVoteButton.component.js';
@@ -0,0 +1,5 @@
1
+ import { UVoteButton } from './UVoteButton.component.js';
2
+
3
+ UVoteButton.define("u-vote-button");
4
+
5
+ export { UVoteButton };
@@ -0,0 +1 @@
1
+ export declare const styles: import('lit').CSSResult;
@@ -0,0 +1,19 @@
1
+ import { css } from 'lit';
2
+
3
+ const styles = css`
4
+ :host {
5
+ display: flex;
6
+ flex-direction: row;
7
+ align-items: center;
8
+ }
9
+ :host(:empty) u-tooltip {
10
+ display: none;
11
+ }
12
+
13
+ u-button {
14
+ color: var(--u-txt-color-weak);
15
+ font-size: 16px;
16
+ }
17
+ `;
18
+
19
+ export { styles };
@@ -0,0 +1,9 @@
1
+ import { BaseElement } from '@iyulab/components/dist/components/BaseElement.js';
2
+ /**
3
+ * 점 3개 로더 컴포넌트입니다.
4
+ */
5
+ export declare class UDotLoader extends BaseElement {
6
+ static styles: import('lit').CSSResultGroup[];
7
+ static dependencies: Record<string, typeof BaseElement>;
8
+ render(): import('lit-html').TemplateResult<1>;
9
+ }
@@ -0,0 +1,23 @@
1
+ import { html } from 'lit';
2
+ import { BaseElement } from '@iyulab/components/dist/components/BaseElement.js';
3
+ import { styles } from './UDotLoader.styles.js';
4
+
5
+ class UDotLoader extends BaseElement {
6
+ static {
7
+ this.styles = [super.styles, styles];
8
+ }
9
+ static {
10
+ this.dependencies = {};
11
+ }
12
+ render() {
13
+ return html`
14
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
15
+ <circle class="d0" cx="4" cy="12" r="3" />
16
+ <circle class="d1" cx="12" cy="12" r="3" />
17
+ <circle class="d2" cx="20" cy="12" r="3" />
18
+ </svg>
19
+ `;
20
+ }
21
+ }
22
+
23
+ export { UDotLoader };
@@ -0,0 +1,7 @@
1
+ import { UDotLoader } from './UDotLoader.component.js';
2
+ declare global {
3
+ interface HTMLElementTagNameMap {
4
+ 'u-dot-loader': UDotLoader;
5
+ }
6
+ }
7
+ export { UDotLoader };
@@ -0,0 +1,5 @@
1
+ import { UDotLoader } from './UDotLoader.component.js';
2
+
3
+ UDotLoader.define("u-dot-loader");
4
+
5
+ export { UDotLoader };
@@ -0,0 +1 @@
1
+ export declare const styles: import('lit').CSSResult;