@lazhus/kg-ui 0.2.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.
Files changed (70) hide show
  1. package/README.md +128 -0
  2. package/custom-elements.json +3815 -0
  3. package/dist/components/kg-accordion-item.js +117 -0
  4. package/dist/components/kg-accordion.js +32 -0
  5. package/dist/components/kg-button.js +241 -0
  6. package/dist/components/kg-card.js +129 -0
  7. package/dist/components/kg-checkbox.js +147 -0
  8. package/dist/components/kg-colorpicker.js +240 -0
  9. package/dist/components/kg-column.js +48 -0
  10. package/dist/components/kg-datagrid.js +428 -0
  11. package/dist/components/kg-datepicker.js +650 -0
  12. package/dist/components/kg-divider.js +118 -0
  13. package/dist/components/kg-drawer.js +178 -0
  14. package/dist/components/kg-file-upload.js +274 -0
  15. package/dist/components/kg-grid.js +46 -0
  16. package/dist/components/kg-image.js +100 -0
  17. package/dist/components/kg-input.js +318 -0
  18. package/dist/components/kg-loader.js +175 -0
  19. package/dist/components/kg-modal.js +165 -0
  20. package/dist/components/kg-progress.js +82 -0
  21. package/dist/components/kg-radio-group.js +75 -0
  22. package/dist/components/kg-radio.js +121 -0
  23. package/dist/components/kg-row.js +42 -0
  24. package/dist/components/kg-select.js +331 -0
  25. package/dist/components/kg-skeleton.js +108 -0
  26. package/dist/components/kg-slider.js +196 -0
  27. package/dist/components/kg-spinner.js +79 -0
  28. package/dist/components/kg-stepper.js +214 -0
  29. package/dist/components/kg-switch.js +106 -0
  30. package/dist/components/kg-tab-panel.js +35 -0
  31. package/dist/components/kg-tabs.js +158 -0
  32. package/dist/components/kg-text.js +141 -0
  33. package/dist/components/kg-textarea.js +162 -0
  34. package/dist/components/kg-toast.js +200 -0
  35. package/dist/index.js +68 -0
  36. package/dist/kg-ui.css +1 -0
  37. package/package.json +57 -0
  38. package/types/components/kg-accordion-item.d.ts +25 -0
  39. package/types/components/kg-accordion.d.ts +22 -0
  40. package/types/components/kg-button.d.ts +34 -0
  41. package/types/components/kg-card.d.ts +31 -0
  42. package/types/components/kg-checkbox.d.ts +28 -0
  43. package/types/components/kg-colorpicker.d.ts +28 -0
  44. package/types/components/kg-column.d.ts +20 -0
  45. package/types/components/kg-datagrid.d.ts +55 -0
  46. package/types/components/kg-datepicker.d.ts +43 -0
  47. package/types/components/kg-divider.d.ts +34 -0
  48. package/types/components/kg-drawer.d.ts +31 -0
  49. package/types/components/kg-file-upload.d.ts +40 -0
  50. package/types/components/kg-grid.d.ts +20 -0
  51. package/types/components/kg-image.d.ts +40 -0
  52. package/types/components/kg-input.d.ts +34 -0
  53. package/types/components/kg-loader.d.ts +31 -0
  54. package/types/components/kg-modal.d.ts +31 -0
  55. package/types/components/kg-progress.d.ts +37 -0
  56. package/types/components/kg-radio-group.d.ts +25 -0
  57. package/types/components/kg-radio.d.ts +25 -0
  58. package/types/components/kg-row.d.ts +20 -0
  59. package/types/components/kg-select.d.ts +37 -0
  60. package/types/components/kg-skeleton.d.ts +34 -0
  61. package/types/components/kg-slider.d.ts +40 -0
  62. package/types/components/kg-spinner.d.ts +28 -0
  63. package/types/components/kg-stepper.d.ts +31 -0
  64. package/types/components/kg-switch.d.ts +28 -0
  65. package/types/components/kg-tab-panel.d.ts +28 -0
  66. package/types/components/kg-tabs.d.ts +25 -0
  67. package/types/components/kg-text.d.ts +31 -0
  68. package/types/components/kg-textarea.d.ts +43 -0
  69. package/types/components/kg-toast.d.ts +28 -0
  70. package/types/index.d.ts +335 -0
@@ -0,0 +1,35 @@
1
+ import { LitElement as t, css as e, html as a } from "lit";
2
+ class s extends t {
3
+ static properties = {
4
+ value: { type: String },
5
+ label: { type: String },
6
+ active: { type: Boolean, reflect: !0 }
7
+ };
8
+ static styles = e`
9
+ :host {
10
+ display: none;
11
+ width: 100%;
12
+ height: 100%;
13
+ animation: fadeIn 0.3s ease;
14
+ }
15
+
16
+ :host([active]) {
17
+ display: block;
18
+ }
19
+
20
+ @keyframes fadeIn {
21
+ from { opacity: 0; transform: translateY(5px); }
22
+ to { opacity: 1; transform: translateY(0); }
23
+ }
24
+ `;
25
+ constructor() {
26
+ super(), this.value = "", this.label = "", this.active = !1;
27
+ }
28
+ render() {
29
+ return a`<slot></slot>`;
30
+ }
31
+ }
32
+ customElements.define("kg-tab-panel", s);
33
+ export {
34
+ s as kgtabpanel
35
+ };
@@ -0,0 +1,158 @@
1
+ import { LitElement as a, css as i, html as r } from "lit";
2
+ class o extends a {
3
+ static properties = {
4
+ activeTab: { type: String, reflect: !0 },
5
+ vertical: { type: Boolean, reflect: !0 }
6
+ };
7
+ static styles = i`
8
+ :host {
9
+ display: flex;
10
+ flex-direction: column;
11
+ width: 100%;
12
+ font-family: inherit;
13
+ }
14
+
15
+ :host([vertical]) {
16
+ flex-direction: row;
17
+ }
18
+
19
+ .tabs-header {
20
+ display: flex;
21
+ border-bottom: 2px solid var(--kg-border);
22
+ gap: 0.5rem;
23
+ padding: 0 0.5rem;
24
+ overflow-x: auto;
25
+ scrollbar-width: none;
26
+ }
27
+
28
+ :host([vertical]) .tabs-header {
29
+ flex-direction: column;
30
+ border-bottom: none;
31
+ border-right: 2px solid var(--kg-border);
32
+ padding: 0.5rem 0 0.5rem 0.5rem;
33
+ gap: 0.25rem;
34
+ min-width: 180px;
35
+ }
36
+
37
+ .tab-trigger {
38
+ padding: 0.75rem 1.25rem;
39
+ font-size: 0.9rem;
40
+ font-weight: 600;
41
+ color: var(--kg-text-muted);
42
+ cursor: pointer;
43
+ position: relative;
44
+ white-space: nowrap;
45
+ transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
46
+ background: transparent;
47
+ border: none;
48
+ outline: none;
49
+ border-radius: 8px 8px 0 0;
50
+ margin-bottom: -2px;
51
+ }
52
+
53
+ :host([vertical]) .tab-trigger {
54
+ padding: 0.75rem 1rem;
55
+ text-align: left;
56
+ border-radius: 8px 0 0 8px;
57
+ margin-bottom: 0;
58
+ margin-right: -2px;
59
+ }
60
+
61
+ .tab-trigger:hover {
62
+ color: var(--kg-primary);
63
+ background: rgba(65, 171, 52, 0.05);
64
+ }
65
+
66
+ .tab-trigger.active {
67
+ color: var(--kg-primary);
68
+ background: rgba(65, 171, 52, 0.08);
69
+ }
70
+
71
+ /* Standard Underline */
72
+ .tab-trigger::after {
73
+ content: '';
74
+ position: absolute;
75
+ bottom: -2px;
76
+ left: 0;
77
+ width: 100%;
78
+ height: 2px;
79
+ background: var(--kg-primary);
80
+ transform: scaleX(0);
81
+ transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
82
+ border-radius: 2px 2px 0 0;
83
+ }
84
+
85
+ :host([vertical]) .tab-trigger::after {
86
+ bottom: 0;
87
+ left: auto;
88
+ right: -2px;
89
+ width: 2px;
90
+ height: 100%;
91
+ transform: scaleY(0);
92
+ border-radius: 2px 0 0 2px;
93
+ }
94
+
95
+ .tab-trigger.active::after {
96
+ transform: scaleX(1);
97
+ }
98
+
99
+ :host([vertical]) .tab-trigger.active::after {
100
+ transform: scaleY(1);
101
+ }
102
+
103
+ .tabs-content {
104
+ padding: 1.5rem 0;
105
+ flex: 1;
106
+ }
107
+
108
+ :host([vertical]) .tabs-content {
109
+ padding: 0 1.5rem;
110
+ }
111
+ `;
112
+ constructor() {
113
+ super(), this.activeTab = "", this.vertical = !1;
114
+ }
115
+ firstUpdated() {
116
+ if (this._updatePanels(), !this.activeTab) {
117
+ const t = this.querySelector("kg-tab-panel");
118
+ t && (this.activeTab = t.value);
119
+ }
120
+ }
121
+ updated(t) {
122
+ t.has("activeTab") && this._updatePanels();
123
+ }
124
+ _handleTabClick(t) {
125
+ this.activeTab = t, this.dispatchEvent(new CustomEvent("kg-tab-change", {
126
+ detail: { value: t },
127
+ bubbles: !0,
128
+ composed: !0
129
+ }));
130
+ }
131
+ _updatePanels() {
132
+ Array.from(this.querySelectorAll("kg-tab-panel")).forEach((e) => {
133
+ e.active = e.value === this.activeTab;
134
+ }), this.requestUpdate();
135
+ }
136
+ render() {
137
+ const t = Array.from(this.querySelectorAll("kg-tab-panel"));
138
+ return r`
139
+ <div class="tabs-header">
140
+ ${t.map((e) => r`
141
+ <button
142
+ class="tab-trigger ${this.activeTab === e.value ? "active" : ""}"
143
+ @click="${() => this._handleTabClick(e.value)}"
144
+ >
145
+ ${e.label}
146
+ </button>
147
+ `)}
148
+ </div>
149
+ <div class="tabs-content">
150
+ <slot @slotchange="${this._updatePanels}"></slot>
151
+ </div>
152
+ `;
153
+ }
154
+ }
155
+ customElements.define("kg-tabs", o);
156
+ export {
157
+ o as kgtabs
158
+ };
@@ -0,0 +1,141 @@
1
+ import { LitElement as e, css as i, html as o } from "lit";
2
+ import { classMap as n } from "lit/directives/class-map.js";
3
+ class r extends e {
4
+ static properties = {
5
+ variant: { type: String },
6
+ // h1, h2, h3, h4, h5, h6, body, small, desc, caption
7
+ color: { type: String },
8
+ // default, muted, primary, secondary, tertiary, error
9
+ weight: { type: String },
10
+ // light, normal, medium, semibold, bold
11
+ align: { type: String },
12
+ // left, center, right, justify
13
+ as: { type: String },
14
+ // p, span, div, h1-h6
15
+ dividing: { type: Boolean },
16
+ disabled: { type: Boolean }
17
+ };
18
+ static styles = i`
19
+ :host {
20
+ display: block;
21
+ font-family: 'Century Gothic', 'Apple Gothic', 'CenturyGothic', sans-serif;
22
+ margin: 0;
23
+ padding: 0;
24
+ color: var(--kg-text);
25
+ line-height: 1.6;
26
+ }
27
+
28
+ :host([as="span"]) {
29
+ display: inline;
30
+ }
31
+
32
+ .ui-text {
33
+ margin: 0;
34
+ padding: 0;
35
+ transition: all 0.2s ease;
36
+ }
37
+
38
+ /* Headers */
39
+ .h1 { font-size: 2.5rem; font-weight: 700; line-height: 1.2; margin-bottom: 0.5em; }
40
+ .h2 { font-size: 2rem; font-weight: 700; line-height: 1.25; margin-bottom: 0.5em; }
41
+ .h3 { font-size: 1.5rem; font-weight: 700; line-height: 1.3; margin-bottom: 0.5em; }
42
+ .h4 { font-size: 1.25rem; font-weight: 700; line-height: 1.4; margin-bottom: 0.5em; }
43
+ .h5 { font-size: 1.1rem; font-weight: 700; line-height: 1.4; margin-bottom: 0.5em; }
44
+ .h6 { font-size: 1rem; font-weight: 700; line-height: 1.4; margin-bottom: 0.5em; }
45
+
46
+ /* Body Variants */
47
+ .body { font-size: 1rem; }
48
+ .small { font-size: 0.85rem; }
49
+ .desc {
50
+ font-size: 0.95rem;
51
+ color: var(--kg-text-muted);
52
+ line-height: 1.5;
53
+ }
54
+ .caption {
55
+ font-size: 0.75rem;
56
+ text-transform: uppercase;
57
+ letter-spacing: 0.05em;
58
+ color: var(--kg-text-muted);
59
+ }
60
+
61
+ /* Features */
62
+ .dividing {
63
+ padding-bottom: 0.25em;
64
+ border-bottom: 1px solid var(--kg-border);
65
+ margin-bottom: 1em;
66
+ }
67
+
68
+ /* Colors */
69
+ .muted { color: var(--kg-text-muted); }
70
+ .primary { color: var(--kg-primary); }
71
+ .secondary { color: var(--kg-secondary); }
72
+ .tertiary { color: var(--kg-tertiary); }
73
+ .error { color: #DB2828; }
74
+
75
+ /* Weights */
76
+ .light { font-weight: 300; }
77
+ .normal { font-weight: 400; }
78
+ .medium { font-weight: 500; }
79
+ .semibold { font-weight: 600; }
80
+ .bold { font-weight: 700; }
81
+
82
+ /* Alignment */
83
+ .center { text-align: center; }
84
+ .right { text-align: right; }
85
+ .justify { text-align: justify; }
86
+
87
+ /* Disabled */
88
+ .disabled {
89
+ opacity: 0.45;
90
+ pointer-events: none;
91
+ }
92
+
93
+ /* Subheader integration if used inside or after kg-text */
94
+ ::slotted([slot="sub"]) {
95
+ display: block;
96
+ font-weight: 400;
97
+ font-size: 0.85em;
98
+ color: var(--kg-text-muted);
99
+ margin-top: 0.25em;
100
+ }
101
+
102
+ ::slotted([slot="icon"]) {
103
+ margin-right: 0.5em;
104
+ opacity: 0.8;
105
+ }
106
+
107
+ .wrapper {
108
+ display: flex;
109
+ align-items: baseline;
110
+ }
111
+ `;
112
+ constructor() {
113
+ super(), this.variant = "body", this.weight = "", this.align = "left", this.dividing = !1;
114
+ }
115
+ render() {
116
+ const t = {
117
+ "ui-text": !0,
118
+ [this.variant]: !0,
119
+ [this.color]: !!this.color,
120
+ [this.weight]: !!this.weight,
121
+ [this.align]: !!this.align,
122
+ dividing: this.dividing,
123
+ disabled: this.disabled
124
+ };
125
+ return o`
126
+ <div class="${n(t)}">
127
+ <div class="wrapper">
128
+ <slot name="icon"></slot>
129
+ <div class="content">
130
+ <slot></slot>
131
+ <slot name="sub"></slot>
132
+ </div>
133
+ </div>
134
+ </div>
135
+ `;
136
+ }
137
+ }
138
+ customElements.define("kg-text", r);
139
+ export {
140
+ r as kgtext
141
+ };
@@ -0,0 +1,162 @@
1
+ import { LitElement as r, css as a, html as t } from "lit";
2
+ import { classMap as i } from "lit/directives/class-map.js";
3
+ class l extends r {
4
+ static properties = {
5
+ value: { type: String },
6
+ label: { type: String },
7
+ placeholder: { type: String },
8
+ rows: { type: Number },
9
+ disabled: { type: Boolean, reflect: !0 },
10
+ error: { type: Boolean, reflect: !0 },
11
+ fullwidth: { type: Boolean, reflect: !0 },
12
+ inverted: { type: Boolean, reflect: !0 },
13
+ resize: { type: String, reflect: !0 }
14
+ // none, both, horizontal, vertical
15
+ };
16
+ static styles = a`
17
+ :host {
18
+ display: inline-block;
19
+ max-width: 100%;
20
+ vertical-align: top;
21
+ }
22
+
23
+ :host([fullwidth]) {
24
+ display: block;
25
+ width: 100%;
26
+ }
27
+
28
+ /* Allow host to grow with content if resize is allowed */
29
+ :host([resize="both"]), :host([resize="horizontal"]) {
30
+ display: inline-block;
31
+ width: auto;
32
+ min-width: 100px;
33
+ }
34
+
35
+ .kg-textarea-container {
36
+ display: flex;
37
+ flex-direction: column;
38
+ gap: 0.5rem;
39
+ width: 100%;
40
+ }
41
+
42
+ .textarea-label {
43
+ font-size: 0.875rem;
44
+ font-weight: 600;
45
+ color: var(--kg-text);
46
+ opacity: 0.8;
47
+ margin-left: 2px;
48
+ }
49
+
50
+ .ui-textarea {
51
+ display: inline-flex;
52
+ width: 100%;
53
+ color: var(--kg-text);
54
+ font-family: inherit;
55
+ }
56
+
57
+ .textarea-wrapper {
58
+ display: flex;
59
+ width: 100%;
60
+ height: 100%;
61
+ align-items: stretch;
62
+ background: var(--kg-surface);
63
+ border: 1px solid var(--kg-border);
64
+ border-radius: var(--kg-radius-md, 8px);
65
+ transition: border-color 0.2s ease, background-color 0.2s ease, box-shadow 0.2s ease;
66
+ position: relative;
67
+ }
68
+
69
+ .textarea-wrapper:focus-within {
70
+ border-color: var(--kg-primary);
71
+ background: var(--kg-bg);
72
+ box-shadow: 0 0 0 2px rgba(65, 171, 52, 0.2);
73
+ }
74
+
75
+ textarea {
76
+ margin: 0;
77
+ flex: 1 1 auto;
78
+ outline: none;
79
+ -webkit-tap-highlight-color: rgba(0,0,0,0);
80
+ text-align: left;
81
+ line-height: 1.5;
82
+ font-family: inherit;
83
+ padding: 0.75rem 1rem;
84
+ background: transparent;
85
+ border: none;
86
+ color: inherit;
87
+ min-width: 0;
88
+ width: 100%;
89
+ min-height: 5rem;
90
+ }
91
+
92
+ textarea::placeholder {
93
+ color: var(--kg-text-muted);
94
+ opacity: 0.6;
95
+ }
96
+
97
+ /* States */
98
+ .disabled { opacity: 0.45; pointer-events: none; }
99
+
100
+ .error .textarea-wrapper {
101
+ border-color: #DB2828;
102
+ background-color: rgba(219, 40, 40, 0.02);
103
+ }
104
+
105
+ /* Variations */
106
+ :host([inverted]) .textarea-label {
107
+ color: rgba(255, 255, 255, 0.9);
108
+ }
109
+ :host([inverted]) .textarea-wrapper {
110
+ background: rgba(255, 255, 255, 0.08);
111
+ border-color: rgba(255, 255, 255, 0.15);
112
+ color: #FFFFFF;
113
+ }
114
+ :host([inverted]) .textarea-wrapper:focus-within {
115
+ background: rgba(255, 255, 255, 0.12);
116
+ border-color: var(--kg-primary);
117
+ }
118
+ :host([inverted]) textarea::placeholder {
119
+ color: rgba(255, 255, 255, 0.5);
120
+ }
121
+ `;
122
+ constructor() {
123
+ super(), this.value = "", this.placeholder = "", this.rows = 3, this.disabled = !1, this.error = !1, this.fullwidth = !1, this.inverted = !1, this.resize = "vertical";
124
+ }
125
+ _handleInput(e) {
126
+ this.value = e.target.value, this.dispatchEvent(new CustomEvent("kg-input", {
127
+ detail: { value: this.value },
128
+ bubbles: !0,
129
+ composed: !0
130
+ }));
131
+ }
132
+ render() {
133
+ const e = {
134
+ "ui-textarea": !0,
135
+ disabled: this.disabled,
136
+ error: this.error,
137
+ fullwidth: this.fullwidth,
138
+ inverted: this.inverted
139
+ };
140
+ return t`
141
+ <div class="kg-textarea-container">
142
+ ${this.label ? t`<label class="textarea-label">${this.label}</label>` : ""}
143
+ <div class="${i(e)}">
144
+ <div class="textarea-wrapper">
145
+ <textarea
146
+ placeholder="${this.placeholder}"
147
+ .value="${this.value}"
148
+ rows="${this.rows}"
149
+ ?disabled="${this.disabled}"
150
+ style="resize: ${this.resize}"
151
+ @input="${this._handleInput}"
152
+ ></textarea>
153
+ </div>
154
+ </div>
155
+ </div>
156
+ `;
157
+ }
158
+ }
159
+ customElements.define("kg-textarea", l);
160
+ export {
161
+ l as kgtextarea
162
+ };
@@ -0,0 +1,200 @@
1
+ import { LitElement as d, css as m, html as a } from "lit";
2
+ import "lit/directives/class-map.js";
3
+ class h extends d {
4
+ static properties = {
5
+ color: { type: String, reflect: !0 },
6
+ title: { type: String },
7
+ message: { type: String },
8
+ duration: { type: Number },
9
+ visible: { type: Boolean, reflect: !0 }
10
+ };
11
+ static styles = m`
12
+ :host {
13
+ --toast-accent: var(--kg-secondary);
14
+ display: block;
15
+ pointer-events: none;
16
+ transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
17
+ opacity: 0;
18
+ transform: translateY(-20px) scale(0.95);
19
+ margin-bottom: 0.75rem;
20
+ }
21
+
22
+ :host([visible]) {
23
+ opacity: 1;
24
+ transform: translateY(0) scale(1);
25
+ }
26
+
27
+ .toast-container {
28
+ pointer-events: auto;
29
+ min-width: 260px;
30
+ max-width: 320px;
31
+ backdrop-filter: blur(12px);
32
+ -webkit-backdrop-filter: blur(12px);
33
+ border-radius: var(--kg-radius-md, 8px);
34
+ box-shadow: 0 10px 30px rgba(0,0,0,0.1);
35
+ padding: 0.8rem 1rem;
36
+ display: flex;
37
+ flex-direction: column;
38
+ gap: 0.2rem;
39
+ position: relative;
40
+ border-left: 5px solid var(--toast-accent);
41
+ transition: all 0.3s ease;
42
+ }
43
+
44
+ .toast-header {
45
+ font-weight: 700;
46
+ font-size: 0.95rem;
47
+ display: flex;
48
+ justify-content: space-between;
49
+ align-items: center;
50
+ padding-right: 1.5rem;
51
+ color: var(--toast-text-color, var(--kg-text));
52
+ }
53
+
54
+ .toast-message {
55
+ font-size: 0.85rem;
56
+ line-height: 1.4;
57
+ color: var(--toast-text-color, var(--kg-text));
58
+ opacity: 0.85;
59
+ }
60
+
61
+ .close-btn {
62
+ position: absolute;
63
+ top: 0.4rem;
64
+ right: 0.4rem;
65
+ width: 24px;
66
+ height: 24px;
67
+ display: flex;
68
+ align-items: center;
69
+ justify-content: center;
70
+ cursor: pointer;
71
+ opacity: 0.5;
72
+ font-size: 0.8rem;
73
+ transition: all 0.2s;
74
+ border-radius: 50%;
75
+ color: var(--toast-text-color, var(--kg-text));
76
+ }
77
+
78
+ .close-btn:hover {
79
+ opacity: 1;
80
+ background: rgba(255, 255, 255, 0.1);
81
+ }
82
+
83
+ /* Glassmorphic Vibrant Colors */
84
+ :host([color="primary"]) {
85
+ --toast-accent: var(--kg-primary);
86
+ --toast-bg: rgba(65, 171, 52, 0.15);
87
+ --toast-text-color: #2b7122;
88
+ }
89
+ :host([color="secondary"]) {
90
+ --toast-accent: var(--kg-secondary);
91
+ --toast-bg: rgba(19, 103, 255, 0.12);
92
+ --toast-text-color: #0d46ad;
93
+ }
94
+ :host([color="tertiary"]) {
95
+ --toast-accent: var(--kg-tertiary);
96
+ --toast-bg: rgba(251, 177, 64, 0.18);
97
+ --toast-text-color: #8c5a00;
98
+ }
99
+ :host([color="error"]) {
100
+ --toast-accent: #DB2828;
101
+ --toast-bg: rgba(219, 40, 40, 0.12);
102
+ --toast-text-color: #b21e1e;
103
+ }
104
+
105
+ .toast-container {
106
+ background-color: var(--toast-bg);
107
+ }
108
+
109
+ /* Dark Mode Text Adjustments */
110
+ :host-context([data-theme='dark']) {
111
+ --toast-text-color: white;
112
+ }
113
+ :host-context([data-theme='dark']) :host([color="primary"]) { --toast-bg: rgba(65, 171, 52, 0.25); }
114
+ :host-context([data-theme='dark']) :host([color="secondary"]) { --toast-bg: rgba(19, 103, 255, 0.2); }
115
+ :host-context([data-theme='dark']) :host([color="tertiary"]) { --toast-bg: rgba(251, 177, 64, 0.3); }
116
+ :host-context([data-theme='dark']) :host([color="error"]) { --toast-bg: rgba(219, 40, 40, 0.25); }
117
+
118
+ /* Dark Mode Adjustment */
119
+ :host-context([data-theme='dark']) .toast-container {
120
+ box-shadow: 0 15px 40px rgba(0,0,0,0.4), 0 0 0 1px rgba(255,255,255,0.05) inset;
121
+ }
122
+ `;
123
+ constructor() {
124
+ super(), this.duration = 3e3, this.visible = !1, this.color = "secondary", this._timerId = null;
125
+ }
126
+ connectedCallback() {
127
+ super.connectedCallback(), this.duration > 0 && (this._timerId = setTimeout(() => this.close(), this.duration));
128
+ }
129
+ disconnectedCallback() {
130
+ super.disconnectedCallback(), this._timerId && clearTimeout(this._timerId);
131
+ }
132
+ close() {
133
+ this._timerId && (clearTimeout(this._timerId), this._timerId = null), this.visible = !1, this.dispatchEvent(new CustomEvent("kg-close", { bubbles: !0, composed: !0 }));
134
+ }
135
+ render() {
136
+ return a`
137
+ <div class="toast-container">
138
+ <div class="close-btn" @click=${(t) => {
139
+ t.stopPropagation(), this.close();
140
+ }} title="Close">✕</div>
141
+ <div class="toast-header">
142
+ <span>${this.title}</span>
143
+ </div>
144
+ ${this.message ? a`<div class="toast-message">${this.message}</div>` : ""}
145
+ </div>
146
+ `;
147
+ }
148
+ }
149
+ customElements.define("kg-toast", h);
150
+ const b = {
151
+ show(e) {
152
+ const t = e.position || "top-right";
153
+ let o = document.querySelector(`.kg-toast-container.${t}`);
154
+ if (!o) {
155
+ o = document.createElement("div"), o.className = `kg-toast-container ${t}`;
156
+ const i = t.includes("top"), n = t.includes("bottom"), c = t.includes("left"), l = t.includes("middle") || t.includes("center");
157
+ let s = `
158
+ position: fixed;
159
+ z-index: 99999;
160
+ display: flex;
161
+ flex-direction: column;
162
+ pointer-events: none;
163
+ width: 340px;
164
+ ${i ? "top: 1.5rem;" : "bottom: 1.5rem;"}
165
+ ${n ? "flex-direction: column-reverse;" : ""}
166
+ `;
167
+ l ? s += `
168
+ left: 50%;
169
+ transform: translateX(-50%);
170
+ align-items: center;
171
+ ` : c ? s += "left: 1.5rem;" : s += "right: 1.5rem;", o.setAttribute("style", s), document.body.appendChild(o);
172
+ }
173
+ const r = document.createElement("kg-toast");
174
+ r.title = e.title || "Notification", r.message = e.message || "", r.color = e.color || "secondary", r.duration = e.duration !== void 0 ? e.duration : 4e3, o.appendChild(r), requestAnimationFrame(() => {
175
+ requestAnimationFrame(() => {
176
+ r.visible = !0;
177
+ });
178
+ }), r.addEventListener("kg-close", () => {
179
+ setTimeout(() => {
180
+ r.parentNode === o && r.remove(), o.children.length === 0 && o.remove();
181
+ }, 400);
182
+ });
183
+ },
184
+ success(e, t) {
185
+ this.show({ title: e, message: t, color: "primary" });
186
+ },
187
+ error(e, t) {
188
+ this.show({ title: e, message: t, color: "error" });
189
+ },
190
+ info(e, t) {
191
+ this.show({ title: e, message: t, color: "secondary" });
192
+ },
193
+ warning(e, t) {
194
+ this.show({ title: e, message: t, color: "tertiary" });
195
+ }
196
+ };
197
+ export {
198
+ h as kgtoast,
199
+ b as toast
200
+ };