@logosphere-ui/core 0.0.0-alpha.24 → 0.0.0-alpha.26

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 (87) hide show
  1. package/AGENTS.md +1118 -0
  2. package/dist/AGENTS.md +1118 -0
  3. package/dist/atoms/Badge/badge.d.ts +1 -1
  4. package/dist/atoms/FormField/formfield.d.ts +3 -0
  5. package/dist/badge-CGgnn_UN.js +72 -0
  6. package/dist/badge-DXBwR32c.cjs +13 -0
  7. package/dist/badge.cjs +1 -1
  8. package/dist/badge.js +1 -1
  9. package/dist/button-DRZ4sG4T.cjs +10 -0
  10. package/dist/button-Uu9oaieg.js +58 -0
  11. package/dist/button.cjs +1 -1
  12. package/dist/button.js +1 -1
  13. package/dist/{calendar-WZ_GQvnn.js → calendar-BiJlAmA6.js} +1 -1
  14. package/dist/{calendar-LMn1ZF3N.cjs → calendar-D5W-t26J.cjs} +1 -1
  15. package/dist/calendar.cjs +1 -1
  16. package/dist/calendar.js +1 -1
  17. package/dist/{card-KiNHfEi2.cjs → card-D829aA29.cjs} +1 -1
  18. package/dist/{card-CNoTUaJC.js → card-jDDQ5DHE.js} +1 -1
  19. package/dist/card.cjs +1 -1
  20. package/dist/card.js +1 -1
  21. package/dist/{chatbot-Cn3Cvz8h.js → chatbot-CIagHZwr.js} +146 -84
  22. package/dist/chatbot-Cr1IZF4R.cjs +183 -0
  23. package/dist/chatbot.cjs +1 -1
  24. package/dist/chatbot.js +1 -1
  25. package/dist/{combobox-D5X75iH0.cjs → combobox-BrANDiaM.cjs} +1 -1
  26. package/dist/{combobox-CtvjEL24.js → combobox-D5QdM3ue.js} +3 -3
  27. package/dist/combobox.cjs +1 -1
  28. package/dist/combobox.js +1 -1
  29. package/dist/{datepicker-CwDDA6np.cjs → datepicker-CxKs90IQ.cjs} +1 -1
  30. package/dist/{datepicker-SwKsdw3S.js → datepicker-DZsZdSCv.js} +3 -3
  31. package/dist/datepicker.cjs +1 -1
  32. package/dist/datepicker.js +1 -1
  33. package/dist/{drawer-DVINJB4a.js → drawer-D_qOdapq.js} +2 -2
  34. package/dist/drawer-s1BLy2Xe.cjs +25 -0
  35. package/dist/drawer.cjs +1 -1
  36. package/dist/drawer.js +1 -1
  37. package/dist/{formfield-CNh4mBSs.js → formfield-BZOK4Pkz.js} +23 -16
  38. package/dist/formfield-HIqosWPz.cjs +33 -0
  39. package/dist/formfield.cjs +1 -1
  40. package/dist/formfield.js +1 -1
  41. package/dist/index.cjs +119 -1
  42. package/dist/index.d.ts +2 -0
  43. package/dist/index.js +358 -41
  44. package/dist/index.umd.js +381 -173
  45. package/dist/{input-DcSyXsp9.js → input-CG6RsUJs.js} +2 -2
  46. package/dist/{input-C6OHJuya.cjs → input-DgGaco-Y.cjs} +1 -1
  47. package/dist/input.cjs +1 -1
  48. package/dist/input.js +1 -1
  49. package/dist/left-menu.cjs +1 -1
  50. package/dist/left-menu.js +1 -1
  51. package/dist/{leftmenu-BSb9rGg4.cjs → leftmenu-BSVpwbyD.cjs} +1 -1
  52. package/dist/{leftmenu-vMqGQhcS.js → leftmenu-DJE2N5kl.js} +7 -7
  53. package/dist/molecules/Textarea/text-area.d.ts +5 -1
  54. package/dist/molecules/TimePicker/index.d.ts +2 -0
  55. package/dist/molecules/TimePicker/timepicker.d.ts +62 -0
  56. package/dist/organisms/Chatbot/chatbot.d.ts +7 -0
  57. package/dist/organisms/Toast/index.d.ts +2 -0
  58. package/dist/organisms/Toast/toast-container.d.ts +42 -0
  59. package/dist/organisms/Toast/toast.d.ts +48 -0
  60. package/dist/styles/main.css +186 -182
  61. package/dist/text-area-Bz62kq2S.cjs +51 -0
  62. package/dist/text-area-CG0gBXni.js +235 -0
  63. package/dist/textarea.cjs +1 -1
  64. package/dist/textarea.js +1 -1
  65. package/dist/toast-container-BQ-a-nRG.cjs +64 -0
  66. package/dist/toast-container-Caqh4mDB.js +274 -0
  67. package/dist/toast.cjs +1 -0
  68. package/dist/toast.js +6 -0
  69. package/dist/{tree-menu-BbX8GK_z.js → tree-menu-B39KDvKV.js} +2 -2
  70. package/dist/tree-menu-BZEOD4_f.cjs +47 -0
  71. package/dist/tree-menu.cjs +1 -1
  72. package/dist/tree-menu.js +1 -1
  73. package/dist/ui-icon-BRl1UmIf.cjs +22 -0
  74. package/dist/ui-icon-CFvsDv0z.js +66 -0
  75. package/package.json +26 -11
  76. package/dist/badge-7IIatiRv.cjs +0 -13
  77. package/dist/badge-B2chRYGd.js +0 -72
  78. package/dist/button-BqOMevro.js +0 -58
  79. package/dist/button-CDRccsk9.cjs +0 -10
  80. package/dist/chatbot-DjFe2_HE.cjs +0 -161
  81. package/dist/drawer-BvcPd5nz.cjs +0 -25
  82. package/dist/formfield-BFOIEicR.cjs +0 -33
  83. package/dist/text-area-CZDdxbrN.cjs +0 -46
  84. package/dist/text-area-Dec_k4rs.js +0 -205
  85. package/dist/tree-menu-B1iwfHyd.cjs +0 -47
  86. package/dist/ui-icon-Bys4HYSQ.js +0 -57
  87. package/dist/ui-icon-DWh1MhBa.cjs +0 -22
@@ -0,0 +1,235 @@
1
+ import { unsafeCSS as c, css as y, LitElement as m, nothing as n, html as u } from "lit";
2
+ import { query as _, property as i, state as d, customElement as x } from "lit/decorators.js";
3
+ import { live as g } from "lit/directives/live.js";
4
+ import "./formfield-BZOK4Pkz.js";
5
+ import "./ui-icon-CFvsDv0z.js";
6
+ const f = ".textarea__wrap{position:relative;flex:1;min-width:0}.textarea__field{display:block;width:100%;background:transparent;border:none;outline:none;font-size:14px;font-family:var(--font-family-base);font-weight:var(--font-weight-regular);line-height:1.25rem;letter-spacing:-.14px;color:var(--color-body-text);box-sizing:border-box}.textarea__field::placeholder{color:var(--color-tertiary)}.textarea__field:disabled{cursor:not-allowed}.textarea__field--resize-none{resize:none}.textarea__field--resize-vertical{resize:vertical}.textarea__field--resize-horizontal{resize:horizontal}.textarea__field--resize-both{resize:both}.textarea__field--auto-resize{resize:none;overflow:hidden}.textarea__counter{position:absolute;bottom:5px;right:18px;font-size:11px;font-weight:var(--font-weight-medium);line-height:1rem;letter-spacing:-.11px;color:var(--color-secondary);background-color:var(--color-light-bg-2);border-radius:var(--radius-sm, 4px);padding:0 var(--spacing-1);white-space:nowrap;-webkit-user-select:none;user-select:none;pointer-events:none}.textarea__wrap--no-grip .textarea__counter{right:4px}.textarea__clear-btn{border:none;background:transparent;color:var(--color-tertiary);cursor:pointer;padding:0;display:inline-flex;align-items:center;justify-content:center;flex-shrink:0;outline:none;line-height:0;transition:color var(--transition-speed-fast) var(--transition-timing)}.textarea__clear-btn:hover{color:var(--color-body-text)}";
7
+ var v = Object.defineProperty, b = Object.getOwnPropertyDescriptor, r = (e, a, s, o) => {
8
+ for (var l = o > 1 ? void 0 : o ? b(a, s) : a, h = e.length - 1, p; h >= 0; h--)
9
+ (p = e[h]) && (l = (o ? p(a, s, l) : p(l)) || l);
10
+ return o && l && v(a, s, l), l;
11
+ };
12
+ let t = class extends m {
13
+ constructor() {
14
+ super(...arguments), this.value = "", this.placeholder = "", this.name = "", this.autocomplete = "", this.rows = 3, this.maxRows = 8, this.wrap = "soft", this.resize = "vertical", this.autoResize = !0, this.size = "default", this.variant = "default", this.label = "", this.helper = "", this.error = "", this.required = !1, this.disabled = !1, this.readonly = !1, this._internalError = "", this._charCount = 0, this.handleInput = (e) => {
15
+ const a = e.target;
16
+ this.value = a.value, this._charCount = this.value.length, this.autoResize && this.adjustHeight(), this._internalError && (this._internalError = "", this._textareaElement.setCustomValidity("")), this.dispatchEvent(new CustomEvent("input", {
17
+ bubbles: !0,
18
+ composed: !0,
19
+ detail: { value: this.value, originalEvent: e }
20
+ }));
21
+ }, this.handleChange = (e) => {
22
+ const a = e.target;
23
+ this.value = a.value, a.checkValidity() || (this._internalError = a.validationMessage), this.dispatchEvent(new CustomEvent("change", {
24
+ bubbles: !0,
25
+ composed: !0,
26
+ detail: { value: this.value, originalEvent: e }
27
+ }));
28
+ }, this.handleKeyDown = (e) => {
29
+ this.dispatchEvent(new CustomEvent("keydown", {
30
+ bubbles: !0,
31
+ composed: !0,
32
+ detail: { key: e.key, originalEvent: e }
33
+ }));
34
+ }, this.handleKeyUp = (e) => {
35
+ this.dispatchEvent(new CustomEvent("keyup", {
36
+ bubbles: !0,
37
+ composed: !0,
38
+ detail: { key: e.key, originalEvent: e }
39
+ }));
40
+ }, this.handleClear = () => {
41
+ this.value = "", this._charCount = 0, this._textareaElement && (this._textareaElement.value = "", this.autoResize && this.adjustHeight()), this.dispatchEvent(new CustomEvent("clear", { bubbles: !0, composed: !0 })), this.dispatchEvent(new CustomEvent("input", {
42
+ bubbles: !0,
43
+ composed: !0,
44
+ detail: { value: "", originalEvent: null }
45
+ }));
46
+ };
47
+ }
48
+ get textareaElement() {
49
+ return this._textareaElement;
50
+ }
51
+ focus() {
52
+ this._textareaElement?.focus();
53
+ }
54
+ blur() {
55
+ this._textareaElement?.blur();
56
+ }
57
+ select() {
58
+ this._textareaElement?.select();
59
+ }
60
+ setSelectionRange(e, a, s) {
61
+ this._textareaElement?.setSelectionRange(e, a, s);
62
+ }
63
+ checkValidity() {
64
+ return this._textareaElement?.checkValidity() ?? !0;
65
+ }
66
+ reportValidity() {
67
+ return this._textareaElement?.reportValidity() ?? !0;
68
+ }
69
+ setCustomValidity(e) {
70
+ this._textareaElement?.setCustomValidity(e), this._internalError = e, this.requestUpdate();
71
+ }
72
+ adjustHeight() {
73
+ if (!this.autoResize || !this._textareaElement) return;
74
+ const e = this._textareaElement;
75
+ e.style.height = "", e.style.overflow = "hidden";
76
+ const a = e.scrollHeight;
77
+ if (a !== 0) {
78
+ if (this.maxRows > 0) {
79
+ const s = parseFloat(getComputedStyle(e).lineHeight) || 20, o = Math.round(s * this.maxRows);
80
+ if (a >= o) {
81
+ e.style.height = `${o}px`, e.style.overflow = "auto";
82
+ return;
83
+ }
84
+ }
85
+ e.style.height = `${a}px`;
86
+ }
87
+ }
88
+ getResizeClass() {
89
+ return this.autoResize ? "textarea__field--auto-resize" : {
90
+ none: "textarea__field--resize-none",
91
+ vertical: "textarea__field--resize-vertical",
92
+ horizontal: "textarea__field--resize-horizontal",
93
+ both: "textarea__field--resize-both"
94
+ }[this.resize];
95
+ }
96
+ firstUpdated() {
97
+ this._charCount = this.value.length, this.autoResize && requestAnimationFrame(() => this.adjustHeight());
98
+ }
99
+ updated(e) {
100
+ super.updated(e), e.has("value") && (this._charCount = this.value.length, this.autoResize && this.adjustHeight());
101
+ }
102
+ getWrapClass() {
103
+ return this.autoResize || this.resize === "none" ? "textarea__wrap textarea__wrap--no-grip" : "textarea__wrap";
104
+ }
105
+ render() {
106
+ const e = this.error || this._internalError, a = !!this.value && !this.disabled && !this.readonly, s = this.maxlength != null, o = `textarea__field ${this.getResizeClass()}`;
107
+ return u`
108
+ <logosphere-formfield
109
+ .label=${this.label}
110
+ .helper=${this.helper}
111
+ .error=${e}
112
+ .required=${this.required}
113
+ .disabled=${this.disabled}
114
+ .readonly=${this.readonly}
115
+ .size=${this.size}
116
+ .variant=${this.variant}
117
+ .multiline=${!0}
118
+ >
119
+ <slot name="prefix" slot="prefix"></slot>
120
+ <div class="${this.getWrapClass()}">
121
+ <textarea
122
+ class="${o}"
123
+ .value=${g(this.value)}
124
+ placeholder=${this.placeholder || n}
125
+ name=${this.name || n}
126
+ autocomplete=${this.autocomplete || n}
127
+ ?required=${this.required}
128
+ ?disabled=${this.disabled}
129
+ ?readonly=${this.readonly}
130
+ minlength=${this.minlength ?? n}
131
+ maxlength=${this.maxlength ?? n}
132
+ rows=${this.rows}
133
+ cols=${this.cols ?? n}
134
+ wrap=${this.wrap}
135
+ @input=${this.handleInput}
136
+ @change=${this.handleChange}
137
+ @keydown=${this.handleKeyDown}
138
+ @keyup=${this.handleKeyUp}
139
+ ></textarea>
140
+ ${s ? u`
141
+ <span class="textarea__counter">${this._charCount}/${this.maxlength}</span>
142
+ ` : n}
143
+ </div>
144
+ ${a ? u`
145
+ <button
146
+ type="button"
147
+ slot="clear"
148
+ class="textarea__clear-btn"
149
+ @click=${this.handleClear}
150
+ tabindex="-1"
151
+ >
152
+ <ui-icon name="uil-times" size="14"></ui-icon>
153
+ </button>
154
+ ` : n}
155
+ <slot name="suffix" slot="suffix"></slot>
156
+ </logosphere-formfield>
157
+ `;
158
+ }
159
+ };
160
+ t.styles = [y`${c(f)}`];
161
+ r([
162
+ _("textarea")
163
+ ], t.prototype, "_textareaElement", 2);
164
+ r([
165
+ i({ type: String })
166
+ ], t.prototype, "value", 2);
167
+ r([
168
+ i({ type: String })
169
+ ], t.prototype, "placeholder", 2);
170
+ r([
171
+ i({ type: String })
172
+ ], t.prototype, "name", 2);
173
+ r([
174
+ i({ type: String })
175
+ ], t.prototype, "autocomplete", 2);
176
+ r([
177
+ i({ type: Number })
178
+ ], t.prototype, "minlength", 2);
179
+ r([
180
+ i({ type: Number })
181
+ ], t.prototype, "maxlength", 2);
182
+ r([
183
+ i({ type: Number })
184
+ ], t.prototype, "rows", 2);
185
+ r([
186
+ i({ type: Number })
187
+ ], t.prototype, "maxRows", 2);
188
+ r([
189
+ i({ type: Number })
190
+ ], t.prototype, "cols", 2);
191
+ r([
192
+ i({ type: String })
193
+ ], t.prototype, "wrap", 2);
194
+ r([
195
+ i({ type: String })
196
+ ], t.prototype, "resize", 2);
197
+ r([
198
+ i({ type: Boolean })
199
+ ], t.prototype, "autoResize", 2);
200
+ r([
201
+ i({ type: String })
202
+ ], t.prototype, "size", 2);
203
+ r([
204
+ i({ type: String })
205
+ ], t.prototype, "variant", 2);
206
+ r([
207
+ i({ type: String })
208
+ ], t.prototype, "label", 2);
209
+ r([
210
+ i({ type: String })
211
+ ], t.prototype, "helper", 2);
212
+ r([
213
+ i({ type: String })
214
+ ], t.prototype, "error", 2);
215
+ r([
216
+ i({ type: Boolean })
217
+ ], t.prototype, "required", 2);
218
+ r([
219
+ i({ type: Boolean })
220
+ ], t.prototype, "disabled", 2);
221
+ r([
222
+ i({ type: Boolean })
223
+ ], t.prototype, "readonly", 2);
224
+ r([
225
+ d()
226
+ ], t.prototype, "_internalError", 2);
227
+ r([
228
+ d()
229
+ ], t.prototype, "_charCount", 2);
230
+ t = r([
231
+ x("logosphere-textarea")
232
+ ], t);
233
+ export {
234
+ t as T
235
+ };
package/dist/textarea.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./text-area-CZDdxbrN.cjs");Object.defineProperty(exports,"TextArea",{enumerable:!0,get:()=>e.TextArea});
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./text-area-Bz62kq2S.cjs");Object.defineProperty(exports,"TextArea",{enumerable:!0,get:()=>e.TextArea});
package/dist/textarea.js CHANGED
@@ -1,4 +1,4 @@
1
- import { T as a } from "./text-area-Dec_k4rs.js";
1
+ import { T as a } from "./text-area-CG0gBXni.js";
2
2
  export {
3
3
  a as TextArea
4
4
  };
@@ -0,0 +1,64 @@
1
+ "use strict";const o=require("lit"),a=require("lit/decorators.js"),m=require("lit/directives/repeat.js");require("./ui-icon-BRl1UmIf.cjs");require("./button-DRZ4sG4T.cjs");const d=".toast{position:relative;display:grid;grid-template-columns:auto 1fr auto;gap:12px;align-items:start;width:100%;box-sizing:border-box;border-radius:var(--radius-md);border-left:4px solid var(--toast-accent);background:#fff;box-shadow:var(--shadow-md);padding:var(--spacing-4);color:#3d3d3d;font-family:var(--font-family-base);animation:toast-enter .22s cubic-bezier(.2,.8,.2,1);transform-origin:top right}.toast__icon{display:inline-flex;margin-top:2px;color:var(--toast-accent)}.toast__content{min-width:0}.toast__title{margin:0;font-size:var(--font-size-lg);line-height:var(--line-height-tight);font-weight:var(--font-weight-semibold)}.toast__title--as-text{font-size:var(--font-size-base);line-height:var(--line-height-normal);font-weight:var(--font-weight-regular);color:#555}.toast__text{margin:4px 0 0;font-size:var(--font-size-base);line-height:var(--line-height-normal);color:#555}.toast__actions{display:flex;gap:10px;margin-top:12px}.toast__close{border:0;background:transparent;color:#5a5a5a;cursor:pointer;display:inline-flex;align-items:center;justify-content:center;margin-top:2px}.toast__close:hover{color:#2f2f2f}.toast--success{--toast-accent: var(--color-success-active)}.toast--danger{--toast-accent: var(--color-danger-active)}.toast--warning{--toast-accent: var(--color-warning-active)}.toast--info{--toast-accent: var(--color-info-active)}.toast[data-closing=true]{pointer-events:none;animation:toast-exit .22s cubic-bezier(.4,0,1,1) forwards}@keyframes toast-enter{0%{opacity:0;transform:translate3d(18px,-8px,0) scale(.98)}to{opacity:1;transform:translateZ(0) scale(1)}}@keyframes toast-exit{0%{opacity:1;transform:translateZ(0) scale(1);max-height:240px;margin-bottom:0}to{opacity:0;transform:translate3d(20px,-6px,0) scale(.97);max-height:0;margin-bottom:-12px}}";var g=Object.defineProperty,f=Object.getOwnPropertyDescriptor,r=(n,t,e,s)=>{for(var i=s>1?void 0:s?f(t,e):t,c=n.length-1,l;c>=0;c--)(l=n[c])&&(i=(s?l(t,e,i):l(i))||i);return s&&i&&g(t,e,i),i};const h=6e3,T=220,v={success:"uil-check-circle",danger:"uil-exclamation-octagon",warning:"uil-exclamation-triangle",info:"uil-info-circle"};exports.LogosphereToast=class extends o.LitElement{constructor(){super(...arguments),this.type="info",this.title="",this.text="",this.icon="",this.closeable=!0,this.duration=h,this.autoDismiss=!0,this.isClosing=!1,this.remainingMs=h,this.startedAt=0}connectedCallback(){super.connectedCallback(),this.remainingMs=this.duration,this.startTimer()}disconnectedCallback(){super.disconnectedCallback(),this.clearTimer(),this.closeTimerId&&(clearTimeout(this.closeTimerId),this.closeTimerId=void 0)}updated(t){t.has("duration")&&(this.remainingMs=this.duration,this.restartTimer()),(t.has("action")||t.has("autoDismiss")||t.has("type"))&&this.restartTimer()}close(t="manual"){this.isClosing||(this.clearTimer(),this.isClosing=!0,this.closeTimerId=setTimeout(()=>{this.dispatchEvent(new CustomEvent("toast-close",{detail:{reason:t},bubbles:!0,composed:!0}))},T))}get canAutoDismiss(){return this.autoDismiss&&this.type!=="danger"&&!this.hasActions}get resolvedTitle(){return this.title||this.text}get resolvedText(){return this.title?this.text:""}get resolvedIcon(){return this.icon||v[this.type]}get hasActions(){return!!this.action}onActionClick(t){this.action&&(t==="okay"?this.action.onOkay?.():this.action.onCancel?.(),(this.action.closeOnAction??!0)&&this.close("manual"))}clearTimer(){this.timerId&&(clearTimeout(this.timerId),this.timerId=void 0)}startTimer(){this.clearTimer(),!(!this.canAutoDismiss||this.remainingMs<=0)&&(this.startedAt=Date.now(),this.timerId=setTimeout(()=>this.close("auto"),this.remainingMs))}pauseTimer(){this.timerId&&(this.clearTimer(),this.remainingMs=Math.max(0,this.remainingMs-(Date.now()-this.startedAt)))}resumeTimer(){this.canAutoDismiss&&this.startTimer()}restartTimer(){this.clearTimer(),this.startTimer()}render(){return o.html`
2
+ <article
3
+ class="toast toast--${this.type}"
4
+ data-closing=${this.isClosing?"true":"false"}
5
+ role="status"
6
+ aria-live=${this.type==="danger"?"assertive":"polite"}
7
+ @mouseenter=${this.pauseTimer}
8
+ @mouseleave=${this.resumeTimer}
9
+ >
10
+ <span class="toast__icon">
11
+ <ui-icon name=${this.resolvedIcon} size="20"></ui-icon>
12
+ </span>
13
+
14
+ <div class="toast__content">
15
+ <h4 class=${this.title?"toast__title":"toast__title toast__title--as-text"}>
16
+ ${this.resolvedTitle}
17
+ </h4>
18
+ ${this.resolvedText?o.html`<p class="toast__text">${this.resolvedText}</p>`:o.nothing}
19
+ ${this.hasActions?o.html`
20
+ <div class="toast__actions">
21
+ <logosphere-button
22
+ variant="outline"
23
+ theme="primary"
24
+ @click=${()=>this.onActionClick("okay")}
25
+ >
26
+ ${this.action?.okayLabel||"Tamam"}
27
+ </logosphere-button>
28
+ <logosphere-button
29
+ variant="text"
30
+ theme="secondary"
31
+ @click=${()=>this.onActionClick("cancel")}
32
+ >
33
+ ${this.action?.cancelLabel||"İptal"}
34
+ </logosphere-button>
35
+ </div>
36
+ `:o.nothing}
37
+ </div>
38
+
39
+ ${this.closeable?o.html`
40
+ <button class="toast__close" @click=${()=>this.close("manual")} aria-label="Close">
41
+ <ui-icon name="uil-times" size="20"></ui-icon>
42
+ </button>
43
+ `:o.nothing}
44
+ </article>
45
+ `}};exports.LogosphereToast.styles=[o.css`
46
+ ${o.unsafeCSS(d)}
47
+ `];r([a.property({type:String})],exports.LogosphereToast.prototype,"type",2);r([a.property({type:String})],exports.LogosphereToast.prototype,"title",2);r([a.property({type:String})],exports.LogosphereToast.prototype,"text",2);r([a.property({type:String})],exports.LogosphereToast.prototype,"icon",2);r([a.property({type:Boolean})],exports.LogosphereToast.prototype,"closeable",2);r([a.property({type:Number})],exports.LogosphereToast.prototype,"duration",2);r([a.property({type:Boolean})],exports.LogosphereToast.prototype,"autoDismiss",2);r([a.property({attribute:!1})],exports.LogosphereToast.prototype,"action",2);r([a.state()],exports.LogosphereToast.prototype,"isClosing",2);exports.LogosphereToast=r([a.customElement("logosphere-toast")],exports.LogosphereToast);const b=":host{position:fixed;top:16px;right:16px;z-index:9999;width:min(420px,calc(100vw - 24px));box-sizing:border-box}.toast-container{display:flex;flex-direction:column;gap:12px}";var y=Object.defineProperty,x=Object.getOwnPropertyDescriptor,p=(n,t,e,s)=>{for(var i=s>1?void 0:s?x(t,e):t,c=n.length-1,l;c>=0;c--)(l=n[c])&&(i=(s?l(t,e,i):l(i))||i);return s&&i&&y(t,e,i),i};const u=4;exports.LogosphereToastContainer=class extends o.LitElement{constructor(){super(...arguments),this.visibleToasts=[],this.queuedToasts=[]}show(t){const e=this.toToast(t);return this.visibleToasts.length<u?(this.visibleToasts=[e,...this.visibleToasts],e.id):(this.queuedToasts.push(e),e.id)}close(t){const e=this.visibleToasts.findIndex(s=>s.id===t);if(e!==-1){const s=this.visibleToasts.slice();s.splice(e,1),this.visibleToasts=s,this.dequeue();return}this.queuedToasts=this.queuedToasts.filter(s=>s.id!==t)}clear(){this.visibleToasts=[],this.queuedToasts=[]}dequeue(){if(!this.queuedToasts.length||this.visibleToasts.length>=u)return;const t=this.queuedToasts.shift();t&&(this.visibleToasts=[t,...this.visibleToasts])}toToast(t){return{id:t.id||this.createId(),type:t.type||"info",title:t.title||"",text:t.text,icon:t.icon||"",closeable:t.closeable??!0,autoDismiss:t.autoDismiss??!0,duration:t.duration??6e3,action:t.action}}createId(){return`toast-${Date.now()}-${Math.random().toString(36).slice(2,8)}`}render(){return o.html`
48
+ <div class="toast-container" role="region" aria-label="Notifications">
49
+ ${m.repeat(this.visibleToasts,t=>t.id,t=>o.html`
50
+ <logosphere-toast
51
+ .type=${t.type}
52
+ .title=${t.title}
53
+ .text=${t.text}
54
+ .icon=${t.icon}
55
+ .closeable=${t.closeable}
56
+ .autoDismiss=${t.autoDismiss}
57
+ .duration=${t.duration}
58
+ .action=${t.action}
59
+ @toast-close=${()=>this.close(t.id)}
60
+ >
61
+ </logosphere-toast>
62
+ `)}
63
+ </div>
64
+ `}};exports.LogosphereToastContainer.styles=[o.css`${o.unsafeCSS(b)}`];p([a.state()],exports.LogosphereToastContainer.prototype,"visibleToasts",2);exports.LogosphereToastContainer=p([a.customElement("logosphere-toast-container")],exports.LogosphereToastContainer);class _{static show(t){return this.getContainer().show(t)}static success(t){return this.show({...t,type:"success"})}static danger(t){return this.show({...t,type:"danger",autoDismiss:!1})}static warning(t){return this.show({...t,type:"warning"})}static info(t){return this.show({...t,type:"info"})}static close(t){this.getContainer().close(t)}static clear(){this.getContainer().clear()}static getContainer(){if(this.container&&document.body.contains(this.container))return this.container;const t=document.querySelector("logosphere-toast-container");if(t&&t instanceof exports.LogosphereToastContainer)return this.container=t,t;const e=document.createElement("logosphere-toast-container");return document.body.appendChild(e),this.container=e,e}}exports.ToastService=_;
@@ -0,0 +1,274 @@
1
+ import { unsafeCSS as g, css as f, LitElement as v, nothing as p, html as h } from "lit";
2
+ import { property as n, state as b, customElement as T } from "lit/decorators.js";
3
+ import { repeat as y } from "lit/directives/repeat.js";
4
+ import "./ui-icon-CFvsDv0z.js";
5
+ import "./button-Uu9oaieg.js";
6
+ const _ = ".toast{position:relative;display:grid;grid-template-columns:auto 1fr auto;gap:12px;align-items:start;width:100%;box-sizing:border-box;border-radius:var(--radius-md);border-left:4px solid var(--toast-accent);background:#fff;box-shadow:var(--shadow-md);padding:var(--spacing-4);color:#3d3d3d;font-family:var(--font-family-base);animation:toast-enter .22s cubic-bezier(.2,.8,.2,1);transform-origin:top right}.toast__icon{display:inline-flex;margin-top:2px;color:var(--toast-accent)}.toast__content{min-width:0}.toast__title{margin:0;font-size:var(--font-size-lg);line-height:var(--line-height-tight);font-weight:var(--font-weight-semibold)}.toast__title--as-text{font-size:var(--font-size-base);line-height:var(--line-height-normal);font-weight:var(--font-weight-regular);color:#555}.toast__text{margin:4px 0 0;font-size:var(--font-size-base);line-height:var(--line-height-normal);color:#555}.toast__actions{display:flex;gap:10px;margin-top:12px}.toast__close{border:0;background:transparent;color:#5a5a5a;cursor:pointer;display:inline-flex;align-items:center;justify-content:center;margin-top:2px}.toast__close:hover{color:#2f2f2f}.toast--success{--toast-accent: var(--color-success-active)}.toast--danger{--toast-accent: var(--color-danger-active)}.toast--warning{--toast-accent: var(--color-warning-active)}.toast--info{--toast-accent: var(--color-info-active)}.toast[data-closing=true]{pointer-events:none;animation:toast-exit .22s cubic-bezier(.4,0,1,1) forwards}@keyframes toast-enter{0%{opacity:0;transform:translate3d(18px,-8px,0) scale(.98)}to{opacity:1;transform:translateZ(0) scale(1)}}@keyframes toast-exit{0%{opacity:1;transform:translateZ(0) scale(1);max-height:240px;margin-bottom:0}to{opacity:0;transform:translate3d(20px,-6px,0) scale(.97);max-height:0;margin-bottom:-12px}}";
7
+ var $ = Object.defineProperty, w = Object.getOwnPropertyDescriptor, a = (t, e, s, r) => {
8
+ for (var i = r > 1 ? void 0 : r ? w(e, s) : e, c = t.length - 1, l; c >= 0; c--)
9
+ (l = t[c]) && (i = (r ? l(e, s, i) : l(i)) || i);
10
+ return r && i && $(e, s, i), i;
11
+ };
12
+ const m = 6e3, C = 220, D = {
13
+ success: "uil-check-circle",
14
+ danger: "uil-exclamation-octagon",
15
+ warning: "uil-exclamation-triangle",
16
+ info: "uil-info-circle"
17
+ };
18
+ let o = class extends v {
19
+ constructor() {
20
+ super(...arguments), this.type = "info", this.title = "", this.text = "", this.icon = "", this.closeable = !0, this.duration = m, this.autoDismiss = !0, this.isClosing = !1, this.remainingMs = m, this.startedAt = 0;
21
+ }
22
+ connectedCallback() {
23
+ super.connectedCallback(), this.remainingMs = this.duration, this.startTimer();
24
+ }
25
+ disconnectedCallback() {
26
+ super.disconnectedCallback(), this.clearTimer(), this.closeTimerId && (clearTimeout(this.closeTimerId), this.closeTimerId = void 0);
27
+ }
28
+ updated(t) {
29
+ t.has("duration") && (this.remainingMs = this.duration, this.restartTimer()), (t.has("action") || t.has("autoDismiss") || t.has("type")) && this.restartTimer();
30
+ }
31
+ close(t = "manual") {
32
+ this.isClosing || (this.clearTimer(), this.isClosing = !0, this.closeTimerId = setTimeout(() => {
33
+ this.dispatchEvent(
34
+ new CustomEvent("toast-close", {
35
+ detail: { reason: t },
36
+ bubbles: !0,
37
+ composed: !0
38
+ })
39
+ );
40
+ }, C));
41
+ }
42
+ get canAutoDismiss() {
43
+ return this.autoDismiss && this.type !== "danger" && !this.hasActions;
44
+ }
45
+ get resolvedTitle() {
46
+ return this.title || this.text;
47
+ }
48
+ get resolvedText() {
49
+ return this.title ? this.text : "";
50
+ }
51
+ get resolvedIcon() {
52
+ return this.icon || D[this.type];
53
+ }
54
+ get hasActions() {
55
+ return !!this.action;
56
+ }
57
+ onActionClick(t) {
58
+ this.action && (t === "okay" ? this.action.onOkay?.() : this.action.onCancel?.(), (this.action.closeOnAction ?? !0) && this.close("manual"));
59
+ }
60
+ clearTimer() {
61
+ this.timerId && (clearTimeout(this.timerId), this.timerId = void 0);
62
+ }
63
+ startTimer() {
64
+ this.clearTimer(), !(!this.canAutoDismiss || this.remainingMs <= 0) && (this.startedAt = Date.now(), this.timerId = setTimeout(() => this.close("auto"), this.remainingMs));
65
+ }
66
+ pauseTimer() {
67
+ this.timerId && (this.clearTimer(), this.remainingMs = Math.max(0, this.remainingMs - (Date.now() - this.startedAt)));
68
+ }
69
+ resumeTimer() {
70
+ this.canAutoDismiss && this.startTimer();
71
+ }
72
+ restartTimer() {
73
+ this.clearTimer(), this.startTimer();
74
+ }
75
+ render() {
76
+ return h`
77
+ <article
78
+ class="toast toast--${this.type}"
79
+ data-closing=${this.isClosing ? "true" : "false"}
80
+ role="status"
81
+ aria-live=${this.type === "danger" ? "assertive" : "polite"}
82
+ @mouseenter=${this.pauseTimer}
83
+ @mouseleave=${this.resumeTimer}
84
+ >
85
+ <span class="toast__icon">
86
+ <ui-icon name=${this.resolvedIcon} size="20"></ui-icon>
87
+ </span>
88
+
89
+ <div class="toast__content">
90
+ <h4 class=${this.title ? "toast__title" : "toast__title toast__title--as-text"}>
91
+ ${this.resolvedTitle}
92
+ </h4>
93
+ ${this.resolvedText ? h`<p class="toast__text">${this.resolvedText}</p>` : p}
94
+ ${this.hasActions ? h`
95
+ <div class="toast__actions">
96
+ <logosphere-button
97
+ variant="outline"
98
+ theme="primary"
99
+ @click=${() => this.onActionClick("okay")}
100
+ >
101
+ ${this.action?.okayLabel || "Tamam"}
102
+ </logosphere-button>
103
+ <logosphere-button
104
+ variant="text"
105
+ theme="secondary"
106
+ @click=${() => this.onActionClick("cancel")}
107
+ >
108
+ ${this.action?.cancelLabel || "İptal"}
109
+ </logosphere-button>
110
+ </div>
111
+ ` : p}
112
+ </div>
113
+
114
+ ${this.closeable ? h`
115
+ <button class="toast__close" @click=${() => this.close("manual")} aria-label="Close">
116
+ <ui-icon name="uil-times" size="20"></ui-icon>
117
+ </button>
118
+ ` : p}
119
+ </article>
120
+ `;
121
+ }
122
+ };
123
+ o.styles = [
124
+ f`
125
+ ${g(_)}
126
+ `
127
+ ];
128
+ a([
129
+ n({ type: String })
130
+ ], o.prototype, "type", 2);
131
+ a([
132
+ n({ type: String })
133
+ ], o.prototype, "title", 2);
134
+ a([
135
+ n({ type: String })
136
+ ], o.prototype, "text", 2);
137
+ a([
138
+ n({ type: String })
139
+ ], o.prototype, "icon", 2);
140
+ a([
141
+ n({ type: Boolean })
142
+ ], o.prototype, "closeable", 2);
143
+ a([
144
+ n({ type: Number })
145
+ ], o.prototype, "duration", 2);
146
+ a([
147
+ n({ type: Boolean })
148
+ ], o.prototype, "autoDismiss", 2);
149
+ a([
150
+ n({ attribute: !1 })
151
+ ], o.prototype, "action", 2);
152
+ a([
153
+ b()
154
+ ], o.prototype, "isClosing", 2);
155
+ o = a([
156
+ T("logosphere-toast")
157
+ ], o);
158
+ const I = ":host{position:fixed;top:16px;right:16px;z-index:9999;width:min(420px,calc(100vw - 24px));box-sizing:border-box}.toast-container{display:flex;flex-direction:column;gap:12px}";
159
+ var A = Object.defineProperty, S = Object.getOwnPropertyDescriptor, x = (t, e, s, r) => {
160
+ for (var i = r > 1 ? void 0 : r ? S(e, s) : e, c = t.length - 1, l; c >= 0; c--)
161
+ (l = t[c]) && (i = (r ? l(e, s, i) : l(i)) || i);
162
+ return r && i && A(e, s, i), i;
163
+ };
164
+ const d = 4;
165
+ let u = class extends v {
166
+ constructor() {
167
+ super(...arguments), this.visibleToasts = [], this.queuedToasts = [];
168
+ }
169
+ show(t) {
170
+ const e = this.toToast(t);
171
+ return this.visibleToasts.length < d ? (this.visibleToasts = [e, ...this.visibleToasts], e.id) : (this.queuedToasts.push(e), e.id);
172
+ }
173
+ close(t) {
174
+ const e = this.visibleToasts.findIndex((s) => s.id === t);
175
+ if (e !== -1) {
176
+ const s = this.visibleToasts.slice();
177
+ s.splice(e, 1), this.visibleToasts = s, this.dequeue();
178
+ return;
179
+ }
180
+ this.queuedToasts = this.queuedToasts.filter((s) => s.id !== t);
181
+ }
182
+ clear() {
183
+ this.visibleToasts = [], this.queuedToasts = [];
184
+ }
185
+ dequeue() {
186
+ if (!this.queuedToasts.length || this.visibleToasts.length >= d) return;
187
+ const t = this.queuedToasts.shift();
188
+ t && (this.visibleToasts = [t, ...this.visibleToasts]);
189
+ }
190
+ toToast(t) {
191
+ return {
192
+ id: t.id || this.createId(),
193
+ type: t.type || "info",
194
+ title: t.title || "",
195
+ text: t.text,
196
+ icon: t.icon || "",
197
+ closeable: t.closeable ?? !0,
198
+ autoDismiss: t.autoDismiss ?? !0,
199
+ duration: t.duration ?? 6e3,
200
+ action: t.action
201
+ };
202
+ }
203
+ createId() {
204
+ return `toast-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`;
205
+ }
206
+ render() {
207
+ return h`
208
+ <div class="toast-container" role="region" aria-label="Notifications">
209
+ ${y(
210
+ this.visibleToasts,
211
+ (t) => t.id,
212
+ (t) => h`
213
+ <logosphere-toast
214
+ .type=${t.type}
215
+ .title=${t.title}
216
+ .text=${t.text}
217
+ .icon=${t.icon}
218
+ .closeable=${t.closeable}
219
+ .autoDismiss=${t.autoDismiss}
220
+ .duration=${t.duration}
221
+ .action=${t.action}
222
+ @toast-close=${() => this.close(t.id)}
223
+ >
224
+ </logosphere-toast>
225
+ `
226
+ )}
227
+ </div>
228
+ `;
229
+ }
230
+ };
231
+ u.styles = [f`${g(I)}`];
232
+ x([
233
+ b()
234
+ ], u.prototype, "visibleToasts", 2);
235
+ u = x([
236
+ T("logosphere-toast-container")
237
+ ], u);
238
+ class E {
239
+ static show(e) {
240
+ return this.getContainer().show(e);
241
+ }
242
+ static success(e) {
243
+ return this.show({ ...e, type: "success" });
244
+ }
245
+ static danger(e) {
246
+ return this.show({ ...e, type: "danger", autoDismiss: !1 });
247
+ }
248
+ static warning(e) {
249
+ return this.show({ ...e, type: "warning" });
250
+ }
251
+ static info(e) {
252
+ return this.show({ ...e, type: "info" });
253
+ }
254
+ static close(e) {
255
+ this.getContainer().close(e);
256
+ }
257
+ static clear() {
258
+ this.getContainer().clear();
259
+ }
260
+ static getContainer() {
261
+ if (this.container && document.body.contains(this.container))
262
+ return this.container;
263
+ const e = document.querySelector("logosphere-toast-container");
264
+ if (e && e instanceof u)
265
+ return this.container = e, e;
266
+ const s = document.createElement("logosphere-toast-container");
267
+ return document.body.appendChild(s), this.container = s, s;
268
+ }
269
+ }
270
+ export {
271
+ o as L,
272
+ E as T,
273
+ u as a
274
+ };
package/dist/toast.cjs ADDED
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./toast-container-BQ-a-nRG.cjs");Object.defineProperty(exports,"LogosphereToast",{enumerable:!0,get:()=>e.LogosphereToast});Object.defineProperty(exports,"LogosphereToastContainer",{enumerable:!0,get:()=>e.LogosphereToastContainer});exports.ToastService=e.ToastService;
package/dist/toast.js ADDED
@@ -0,0 +1,6 @@
1
+ import { L as e, a as s, T as r } from "./toast-container-Caqh4mDB.js";
2
+ export {
3
+ e as LogosphereToast,
4
+ s as LogosphereToastContainer,
5
+ r as ToastService
6
+ };
@@ -1,8 +1,8 @@
1
1
  import { unsafeCSS as p, css as _, LitElement as u, html as a, nothing as c } from "lit";
2
2
  import { property as d, state as v, customElement as b } from "lit/decorators.js";
3
3
  import { unsafeHTML as g } from "lit/directives/unsafe-html.js";
4
- import "./ui-icon-Bys4HYSQ.js";
5
- const f = ".tree{width:100%;font-family:var(--font-family-base)}.tree__list,.tree__children{list-style:none;margin:0;padding:0}.tree__item{margin:0;padding:0}.tree__row{display:flex;align-items:center;gap:var(--spacing-1);padding:var(--spacing-2) var(--spacing-3);padding-left:calc(var(--spacing-3) + (var(--tree-level, 0) * 14px));border-radius:var(--radius-sm);color:var(--color-body-text);cursor:pointer;-webkit-user-select:none;user-select:none;transition:background-color var(--transition-speed-fast) var(--transition-timing)}.tree--icons .tree__row{justify-content:center;padding:0;width:44px;height:44px;min-height:44px;margin:0 auto}.tree__row:hover{background-color:var(--color-tertiary-bg)}.tree__row:focus-visible{outline:2px solid var(--color-secondary);outline-offset:1px}.tree__row--disabled{opacity:.5;cursor:not-allowed}.tree__row--active .tree__label,.tree__row--active .tree__icon{color:var(--color-primary)}.tree:not(.tree--icons) .tree__row--active{background-color:var(--color-tertiary-bg)}.tree__icon{width:20px;min-width:20px;display:inline-flex;align-items:center;justify-content:center;color:inherit}.tree--icons .tree__icon{width:20px;min-width:20px;height:20px}.tree--icons .tree__row--active{background-color:var(--color-primary)}.tree--icons .tree__row--active .tree__icon{color:#fff}.tree--icons .tree__row--active:hover{background-color:var(--color-primary-hover)}.tree__chevron-btn{display:inline-flex;align-items:center;justify-content:center;width:20px;height:20px;border:none;background:transparent;color:var(--color-tertiary);cursor:pointer;padding:0;flex-shrink:0}.tree__chevron-btn--right{margin-left:auto}.tree__chevron{transform:rotate(-90deg);transition:transform var(--transition-speed-fast) var(--transition-timing)}.tree__chevron--open{transform:rotate(0)}.tree__chevron-spacer{width:20px;height:20px;flex-shrink:0}.tree__label{display:inline-flex;align-items:center;font-size:var(--font-size-sm);color:inherit}";
4
+ import "./ui-icon-CFvsDv0z.js";
5
+ const f = ".tree{width:100%;font-family:var(--font-family-base)}.tree__list,.tree__children{list-style:none;margin:0;padding:0}.tree__item{margin:0;padding:0}.tree__row{display:flex;align-items:center;gap:var(--spacing-1);padding:var(--spacing-2) var(--spacing-3);padding-left:calc(var(--spacing-3) + (var(--tree-level, 0) * 14px));border-radius:var(--radius-sm);color:var(--color-body-color);cursor:pointer;-webkit-user-select:none;user-select:none;transition:background-color var(--transition-speed-fast) var(--transition-timing)}.tree--icons .tree__row{justify-content:center;padding:0;width:44px;height:44px;min-height:44px;margin:0 auto}.tree__row:hover{background-color:var(--color-tertiary)}.tree__row:focus-visible{outline:2px solid var(--color-secondary);outline-offset:1px}.tree__row--disabled{opacity:.5;cursor:not-allowed}.tree__row--active .tree__label,.tree__row--active .tree__icon{color:var(--color-primary)}.tree:not(.tree--icons) .tree__row--active{background-color:var(--color-tertiary)}.tree__icon{width:20px;min-width:20px;display:inline-flex;align-items:center;justify-content:center;color:inherit}.tree--icons .tree__icon{width:20px;min-width:20px;height:20px}.tree--icons .tree__row--active{background-color:var(--color-primary)}.tree--icons .tree__row--active .tree__icon{color:#fff}.tree--icons .tree__row--active:hover{background-color:var(--color-primary-hover)}.tree__chevron-btn{display:inline-flex;align-items:center;justify-content:center;width:20px;height:20px;border:none;background:transparent;color:var(--color-tertiary);cursor:pointer;padding:0;flex-shrink:0}.tree__chevron-btn--right{margin-left:auto}.tree__chevron{transform:rotate(-90deg);transition:transform var(--transition-speed-fast) var(--transition-timing)}.tree__chevron--open{transform:rotate(0)}.tree__chevron-spacer{width:20px;height:20px;flex-shrink:0}.tree__label{display:inline-flex;align-items:center;font-size:var(--font-size-sm);color:inherit}";
6
6
  var w = Object.defineProperty, x = Object.getOwnPropertyDescriptor, l = (e, t, r, n) => {
7
7
  for (var o = n > 1 ? void 0 : n ? x(t, r) : t, s = e.length - 1, h; s >= 0; s--)
8
8
  (h = e[s]) && (o = (n ? h(t, r, o) : h(o)) || o);